@agentlensai/server 0.11.0 → 0.13.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 (633) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cloud/auth/rbac.d.ts +1 -1
  3. package/dist/cloud/auth/rbac.d.ts.map +1 -1
  4. package/dist/cloud/auth/rbac.js +2 -2
  5. package/dist/cloud/auth/rbac.js.map +1 -1
  6. package/dist/cloud/billing/stripe-client.d.ts.map +1 -1
  7. package/dist/cloud/billing/stripe-client.js +6 -1
  8. package/dist/cloud/billing/stripe-client.js.map +1 -1
  9. package/dist/cloud/ingestion/gateway.d.ts.map +1 -1
  10. package/dist/cloud/ingestion/gateway.js +0 -1
  11. package/dist/cloud/ingestion/gateway.js.map +1 -1
  12. package/dist/cloud/middleware/validate-org-access.d.ts +14 -0
  13. package/dist/cloud/middleware/validate-org-access.d.ts.map +1 -0
  14. package/dist/cloud/middleware/validate-org-access.js +38 -0
  15. package/dist/cloud/middleware/validate-org-access.js.map +1 -0
  16. package/dist/cloud/routes/index.d.ts +13 -0
  17. package/dist/cloud/routes/index.d.ts.map +1 -0
  18. package/dist/cloud/routes/index.js +98 -0
  19. package/dist/cloud/routes/index.js.map +1 -0
  20. package/dist/config.d.ts +33 -1
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +71 -1
  23. package/dist/config.js.map +1 -1
  24. package/dist/db/api-key-lookup.d.ts +25 -0
  25. package/dist/db/api-key-lookup.d.ts.map +1 -0
  26. package/dist/db/api-key-lookup.js +38 -0
  27. package/dist/db/api-key-lookup.js.map +1 -0
  28. package/dist/db/connection.postgres.d.ts +44 -0
  29. package/dist/db/connection.postgres.d.ts.map +1 -0
  30. package/dist/db/connection.postgres.js +79 -0
  31. package/dist/db/connection.postgres.js.map +1 -0
  32. package/dist/db/cost-budget-store.d.ts +30 -0
  33. package/dist/db/cost-budget-store.d.ts.map +1 -0
  34. package/dist/db/cost-budget-store.js +201 -0
  35. package/dist/db/cost-budget-store.js.map +1 -0
  36. package/dist/db/drizzle/0000_initial.sql +336 -0
  37. package/dist/db/drizzle/0001_indexes.sql +20 -0
  38. package/dist/db/drizzle/0002_pgvector.sql +19 -0
  39. package/dist/db/drizzle/drizzle/0000_initial.sql +336 -0
  40. package/dist/db/drizzle/drizzle/0001_indexes.sql +20 -0
  41. package/dist/db/drizzle/drizzle/0002_pgvector.sql +19 -0
  42. package/dist/db/drizzle/drizzle/meta/0000_snapshot.json +2593 -0
  43. package/dist/db/drizzle/drizzle/meta/_journal.json +27 -0
  44. package/dist/db/drizzle/meta/0000_snapshot.json +2593 -0
  45. package/dist/db/drizzle/meta/_journal.json +27 -0
  46. package/dist/db/embedding-store.d.ts +2 -1
  47. package/dist/db/embedding-store.d.ts.map +1 -1
  48. package/dist/db/embedding-store.interface.d.ts +19 -0
  49. package/dist/db/embedding-store.interface.d.ts.map +1 -0
  50. package/dist/db/embedding-store.interface.js +7 -0
  51. package/dist/db/embedding-store.interface.js.map +1 -0
  52. package/dist/db/embedding-store.js +3 -1
  53. package/dist/db/embedding-store.js.map +1 -1
  54. package/dist/db/eval-store.d.ts +88 -0
  55. package/dist/db/eval-store.d.ts.map +1 -0
  56. package/dist/db/eval-store.js +408 -0
  57. package/dist/db/eval-store.js.map +1 -0
  58. package/dist/db/guardrail-store.d.ts +9 -0
  59. package/dist/db/guardrail-store.d.ts.map +1 -1
  60. package/dist/db/guardrail-store.js +57 -3
  61. package/dist/db/guardrail-store.js.map +1 -1
  62. package/dist/db/index.d.ts +7 -0
  63. package/dist/db/index.d.ts.map +1 -1
  64. package/dist/db/index.js +4 -12
  65. package/dist/db/index.js.map +1 -1
  66. package/dist/db/migrate.d.ts +5 -22
  67. package/dist/db/migrate.d.ts.map +1 -1
  68. package/dist/db/migrate.js +7 -637
  69. package/dist/db/migrate.js.map +1 -1
  70. package/dist/db/migrate.postgres.d.ts +16 -0
  71. package/dist/db/migrate.postgres.d.ts.map +1 -0
  72. package/dist/db/migrate.postgres.js +23 -0
  73. package/dist/db/migrate.postgres.js.map +1 -0
  74. package/dist/db/migrate.sqlite.d.ts +26 -0
  75. package/dist/db/migrate.sqlite.d.ts.map +1 -0
  76. package/dist/db/migrate.sqlite.js +920 -0
  77. package/dist/db/migrate.sqlite.js.map +1 -0
  78. package/dist/db/postgres-embedding-store.d.ts +23 -0
  79. package/dist/db/postgres-embedding-store.d.ts.map +1 -0
  80. package/dist/db/postgres-embedding-store.js +218 -0
  81. package/dist/db/postgres-embedding-store.js.map +1 -0
  82. package/dist/db/postgres-store.d.ts +80 -0
  83. package/dist/db/postgres-store.d.ts.map +1 -0
  84. package/dist/db/postgres-store.js +910 -0
  85. package/dist/db/postgres-store.js.map +1 -0
  86. package/dist/db/prompt-store.d.ts +57 -0
  87. package/dist/db/prompt-store.d.ts.map +1 -0
  88. package/dist/db/prompt-store.js +300 -0
  89. package/dist/db/prompt-store.js.map +1 -0
  90. package/dist/db/repositories/agent-repository.d.ts +21 -0
  91. package/dist/db/repositories/agent-repository.d.ts.map +1 -0
  92. package/dist/db/repositories/agent-repository.js +142 -0
  93. package/dist/db/repositories/agent-repository.js.map +1 -0
  94. package/dist/db/repositories/alert-repository.d.ts +27 -0
  95. package/dist/db/repositories/alert-repository.d.ts.map +1 -0
  96. package/dist/db/repositories/alert-repository.js +164 -0
  97. package/dist/db/repositories/alert-repository.js.map +1 -0
  98. package/dist/db/repositories/analytics-repository.d.ts +24 -0
  99. package/dist/db/repositories/analytics-repository.d.ts.map +1 -0
  100. package/dist/db/repositories/analytics-repository.js +147 -0
  101. package/dist/db/repositories/analytics-repository.js.map +1 -0
  102. package/dist/db/repositories/event-repository.d.ts +81 -0
  103. package/dist/db/repositories/event-repository.d.ts.map +1 -0
  104. package/dist/db/repositories/event-repository.js +331 -0
  105. package/dist/db/repositories/event-repository.js.map +1 -0
  106. package/dist/db/repositories/notification-channel-repository.d.ts +28 -0
  107. package/dist/db/repositories/notification-channel-repository.d.ts.map +1 -0
  108. package/dist/db/repositories/notification-channel-repository.js +151 -0
  109. package/dist/db/repositories/notification-channel-repository.js.map +1 -0
  110. package/dist/db/repositories/session-repository.d.ts +26 -0
  111. package/dist/db/repositories/session-repository.d.ts.map +1 -0
  112. package/dist/db/repositories/session-repository.js +240 -0
  113. package/dist/db/repositories/session-repository.js.map +1 -0
  114. package/dist/db/schema.postgres.d.ts +4681 -0
  115. package/dist/db/schema.postgres.d.ts.map +1 -0
  116. package/dist/db/schema.postgres.js +458 -0
  117. package/dist/db/schema.postgres.js.map +1 -0
  118. package/dist/db/schema.sqlite.d.ts +2221 -671
  119. package/dist/db/schema.sqlite.d.ts.map +1 -1
  120. package/dist/db/schema.sqlite.js +137 -2
  121. package/dist/db/schema.sqlite.js.map +1 -1
  122. package/dist/db/services/retention-service.d.ts +13 -0
  123. package/dist/db/services/retention-service.d.ts.map +1 -0
  124. package/dist/db/services/retention-service.js +48 -0
  125. package/dist/db/services/retention-service.js.map +1 -0
  126. package/dist/db/shared/query-helpers.d.ts +32 -0
  127. package/dist/db/shared/query-helpers.d.ts.map +1 -0
  128. package/dist/db/shared/query-helpers.js +180 -0
  129. package/dist/db/shared/query-helpers.js.map +1 -0
  130. package/dist/db/sqlite-store.d.ts +48 -55
  131. package/dist/db/sqlite-store.d.ts.map +1 -1
  132. package/dist/db/sqlite-store.js +78 -945
  133. package/dist/db/sqlite-store.js.map +1 -1
  134. package/dist/db/tenant-scoped-store.d.ts +18 -1
  135. package/dist/db/tenant-scoped-store.d.ts.map +1 -1
  136. package/dist/db/tenant-scoped-store.js +6 -0
  137. package/dist/db/tenant-scoped-store.js.map +1 -1
  138. package/dist/index.d.ts +28 -14
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +432 -97
  141. package/dist/index.js.map +1 -1
  142. package/dist/lib/alert-engine.d.ts +10 -0
  143. package/dist/lib/alert-engine.d.ts.map +1 -1
  144. package/dist/lib/alert-engine.js +73 -20
  145. package/dist/lib/alert-engine.js.map +1 -1
  146. package/dist/lib/audit-verify.d.ts +40 -0
  147. package/dist/lib/audit-verify.d.ts.map +1 -0
  148. package/dist/lib/audit-verify.js +128 -0
  149. package/dist/lib/audit-verify.js.map +1 -0
  150. package/dist/lib/audit.d.ts +37 -0
  151. package/dist/lib/audit.d.ts.map +1 -0
  152. package/dist/lib/audit.js +59 -0
  153. package/dist/lib/audit.js.map +1 -0
  154. package/dist/lib/budget-engine.d.ts +26 -0
  155. package/dist/lib/budget-engine.d.ts.map +1 -0
  156. package/dist/lib/budget-engine.js +201 -0
  157. package/dist/lib/budget-engine.js.map +1 -0
  158. package/dist/lib/compliance-export.d.ts +41 -0
  159. package/dist/lib/compliance-export.d.ts.map +1 -0
  160. package/dist/lib/compliance-export.js +124 -0
  161. package/dist/lib/compliance-export.js.map +1 -0
  162. package/dist/lib/compliance-report.d.ts +87 -0
  163. package/dist/lib/compliance-report.d.ts.map +1 -0
  164. package/dist/lib/compliance-report.js +148 -0
  165. package/dist/lib/compliance-report.js.map +1 -0
  166. package/dist/lib/context/retrieval.d.ts +5 -3
  167. package/dist/lib/context/retrieval.d.ts.map +1 -1
  168. package/dist/lib/context/retrieval.js +5 -2
  169. package/dist/lib/context/retrieval.js.map +1 -1
  170. package/dist/lib/cost-anomaly-detector.d.ts +23 -0
  171. package/dist/lib/cost-anomaly-detector.d.ts.map +1 -0
  172. package/dist/lib/cost-anomaly-detector.js +108 -0
  173. package/dist/lib/cost-anomaly-detector.js.map +1 -0
  174. package/dist/lib/db-resilience.d.ts +15 -0
  175. package/dist/lib/db-resilience.d.ts.map +1 -0
  176. package/dist/lib/db-resilience.js +49 -0
  177. package/dist/lib/db-resilience.js.map +1 -0
  178. package/dist/lib/diagnostics/cache.d.ts +29 -0
  179. package/dist/lib/diagnostics/cache.d.ts.map +1 -0
  180. package/dist/lib/diagnostics/cache.js +88 -0
  181. package/dist/lib/diagnostics/cache.js.map +1 -0
  182. package/dist/lib/diagnostics/context-builder.d.ts +41 -0
  183. package/dist/lib/diagnostics/context-builder.d.ts.map +1 -0
  184. package/dist/lib/diagnostics/context-builder.js +135 -0
  185. package/dist/lib/diagnostics/context-builder.js.map +1 -0
  186. package/dist/lib/diagnostics/index.d.ts +34 -0
  187. package/dist/lib/diagnostics/index.d.ts.map +1 -0
  188. package/dist/lib/diagnostics/index.js +223 -0
  189. package/dist/lib/diagnostics/index.js.map +1 -0
  190. package/dist/lib/diagnostics/llm-client.d.ts +24 -0
  191. package/dist/lib/diagnostics/llm-client.d.ts.map +1 -0
  192. package/dist/lib/diagnostics/llm-client.js +42 -0
  193. package/dist/lib/diagnostics/llm-client.js.map +1 -0
  194. package/dist/lib/diagnostics/prompt-templates.d.ts +18 -0
  195. package/dist/lib/diagnostics/prompt-templates.d.ts.map +1 -0
  196. package/dist/lib/diagnostics/prompt-templates.js +144 -0
  197. package/dist/lib/diagnostics/prompt-templates.js.map +1 -0
  198. package/dist/lib/diagnostics/providers/anthropic.d.ts +8 -0
  199. package/dist/lib/diagnostics/providers/anthropic.d.ts.map +1 -0
  200. package/dist/lib/diagnostics/providers/anthropic.js +79 -0
  201. package/dist/lib/diagnostics/providers/anthropic.js.map +1 -0
  202. package/dist/lib/diagnostics/providers/openai.d.ts +8 -0
  203. package/dist/lib/diagnostics/providers/openai.d.ts.map +1 -0
  204. package/dist/lib/diagnostics/providers/openai.js +70 -0
  205. package/dist/lib/diagnostics/providers/openai.js.map +1 -0
  206. package/dist/lib/diagnostics/providers/types.d.ts +23 -0
  207. package/dist/lib/diagnostics/providers/types.d.ts.map +1 -0
  208. package/dist/lib/diagnostics/providers/types.js +5 -0
  209. package/dist/lib/diagnostics/providers/types.js.map +1 -0
  210. package/dist/lib/diagnostics/response-parser.d.ts +60 -0
  211. package/dist/lib/diagnostics/response-parser.d.ts.map +1 -0
  212. package/dist/lib/diagnostics/response-parser.js +55 -0
  213. package/dist/lib/diagnostics/response-parser.js.map +1 -0
  214. package/dist/lib/diagnostics/types.d.ts +60 -0
  215. package/dist/lib/diagnostics/types.d.ts.map +1 -0
  216. package/dist/lib/diagnostics/types.js +7 -0
  217. package/dist/lib/diagnostics/types.js.map +1 -0
  218. package/dist/lib/embeddings/index.d.ts +6 -3
  219. package/dist/lib/embeddings/index.d.ts.map +1 -1
  220. package/dist/lib/embeddings/index.js +7 -15
  221. package/dist/lib/embeddings/index.js.map +1 -1
  222. package/dist/lib/embeddings/worker.d.ts +2 -2
  223. package/dist/lib/embeddings/worker.d.ts.map +1 -1
  224. package/dist/lib/embeddings/worker.js +3 -1
  225. package/dist/lib/embeddings/worker.js.map +1 -1
  226. package/dist/lib/error-sanitizer.d.ts +28 -0
  227. package/dist/lib/error-sanitizer.d.ts.map +1 -0
  228. package/dist/lib/error-sanitizer.js +106 -0
  229. package/dist/lib/error-sanitizer.js.map +1 -0
  230. package/dist/lib/eval/index.d.ts +15 -0
  231. package/dist/lib/eval/index.d.ts.map +1 -0
  232. package/dist/lib/eval/index.js +24 -0
  233. package/dist/lib/eval/index.js.map +1 -0
  234. package/dist/lib/eval/runner.d.ts +28 -0
  235. package/dist/lib/eval/runner.d.ts.map +1 -0
  236. package/dist/lib/eval/runner.js +260 -0
  237. package/dist/lib/eval/runner.js.map +1 -0
  238. package/dist/lib/eval/scorers/contains.d.ts +10 -0
  239. package/dist/lib/eval/scorers/contains.d.ts.map +1 -0
  240. package/dist/lib/eval/scorers/contains.js +33 -0
  241. package/dist/lib/eval/scorers/contains.js.map +1 -0
  242. package/dist/lib/eval/scorers/exact-match.d.ts +10 -0
  243. package/dist/lib/eval/scorers/exact-match.d.ts.map +1 -0
  244. package/dist/lib/eval/scorers/exact-match.js +33 -0
  245. package/dist/lib/eval/scorers/exact-match.js.map +1 -0
  246. package/dist/lib/eval/scorers/index.d.ts +20 -0
  247. package/dist/lib/eval/scorers/index.d.ts.map +1 -0
  248. package/dist/lib/eval/scorers/index.js +19 -0
  249. package/dist/lib/eval/scorers/index.js.map +1 -0
  250. package/dist/lib/eval/scorers/llm-judge.d.ts +22 -0
  251. package/dist/lib/eval/scorers/llm-judge.d.ts.map +1 -0
  252. package/dist/lib/eval/scorers/llm-judge.js +79 -0
  253. package/dist/lib/eval/scorers/llm-judge.js.map +1 -0
  254. package/dist/lib/eval/scorers/regex.d.ts +10 -0
  255. package/dist/lib/eval/scorers/regex.d.ts.map +1 -0
  256. package/dist/lib/eval/scorers/regex.js +36 -0
  257. package/dist/lib/eval/scorers/regex.js.map +1 -0
  258. package/dist/lib/guardrails/actions.d.ts +6 -0
  259. package/dist/lib/guardrails/actions.d.ts.map +1 -1
  260. package/dist/lib/guardrails/actions.js +82 -0
  261. package/dist/lib/guardrails/actions.js.map +1 -1
  262. package/dist/lib/guardrails/conditions.d.ts +47 -0
  263. package/dist/lib/guardrails/conditions.d.ts.map +1 -1
  264. package/dist/lib/guardrails/conditions.js +55 -10
  265. package/dist/lib/guardrails/conditions.js.map +1 -1
  266. package/dist/lib/guardrails/content-engine.d.ts +19 -0
  267. package/dist/lib/guardrails/content-engine.d.ts.map +1 -0
  268. package/dist/lib/guardrails/content-engine.js +154 -0
  269. package/dist/lib/guardrails/content-engine.js.map +1 -0
  270. package/dist/lib/guardrails/engine.d.ts +33 -0
  271. package/dist/lib/guardrails/engine.d.ts.map +1 -1
  272. package/dist/lib/guardrails/engine.js +37 -2
  273. package/dist/lib/guardrails/engine.js.map +1 -1
  274. package/dist/lib/guardrails/scanners/base-scanner.d.ts +23 -0
  275. package/dist/lib/guardrails/scanners/base-scanner.d.ts.map +1 -0
  276. package/dist/lib/guardrails/scanners/base-scanner.js +7 -0
  277. package/dist/lib/guardrails/scanners/base-scanner.js.map +1 -0
  278. package/dist/lib/guardrails/scanners/patterns/pii-patterns.d.ts +13 -0
  279. package/dist/lib/guardrails/scanners/patterns/pii-patterns.d.ts.map +1 -0
  280. package/dist/lib/guardrails/scanners/patterns/pii-patterns.js +49 -0
  281. package/dist/lib/guardrails/scanners/patterns/pii-patterns.js.map +1 -0
  282. package/dist/lib/guardrails/scanners/patterns/secret-patterns.d.ts +6 -0
  283. package/dist/lib/guardrails/scanners/patterns/secret-patterns.d.ts.map +1 -0
  284. package/dist/lib/guardrails/scanners/patterns/secret-patterns.js +69 -0
  285. package/dist/lib/guardrails/scanners/patterns/secret-patterns.js.map +1 -0
  286. package/dist/lib/guardrails/scanners/pii-scanner.d.ts +10 -0
  287. package/dist/lib/guardrails/scanners/pii-scanner.d.ts.map +1 -0
  288. package/dist/lib/guardrails/scanners/pii-scanner.js +57 -0
  289. package/dist/lib/guardrails/scanners/pii-scanner.js.map +1 -0
  290. package/dist/lib/guardrails/scanners/scanner-registry.d.ts +14 -0
  291. package/dist/lib/guardrails/scanners/scanner-registry.d.ts.map +1 -0
  292. package/dist/lib/guardrails/scanners/scanner-registry.js +51 -0
  293. package/dist/lib/guardrails/scanners/scanner-registry.js.map +1 -0
  294. package/dist/lib/guardrails/scanners/secrets-scanner.d.ts +9 -0
  295. package/dist/lib/guardrails/scanners/secrets-scanner.d.ts.map +1 -0
  296. package/dist/lib/guardrails/scanners/secrets-scanner.js +47 -0
  297. package/dist/lib/guardrails/scanners/secrets-scanner.js.map +1 -0
  298. package/dist/lib/logger.d.ts +8 -0
  299. package/dist/lib/logger.d.ts.map +1 -0
  300. package/dist/lib/logger.js +31 -0
  301. package/dist/lib/logger.js.map +1 -0
  302. package/dist/lib/lore-client.d.ts +128 -0
  303. package/dist/lib/lore-client.d.ts.map +1 -0
  304. package/dist/lib/lore-client.js +188 -0
  305. package/dist/lib/lore-client.js.map +1 -0
  306. package/dist/lib/mesh-client.d.ts +31 -0
  307. package/dist/lib/mesh-client.d.ts.map +1 -0
  308. package/dist/lib/mesh-client.js +72 -0
  309. package/dist/lib/mesh-client.js.map +1 -0
  310. package/dist/lib/notifications/grouping-buffer.d.ts +25 -0
  311. package/dist/lib/notifications/grouping-buffer.d.ts.map +1 -0
  312. package/dist/lib/notifications/grouping-buffer.js +73 -0
  313. package/dist/lib/notifications/grouping-buffer.js.map +1 -0
  314. package/dist/lib/notifications/provider.d.ts +10 -0
  315. package/dist/lib/notifications/provider.d.ts.map +1 -0
  316. package/dist/lib/notifications/provider.js +5 -0
  317. package/dist/lib/notifications/provider.js.map +1 -0
  318. package/dist/lib/notifications/providers/email.d.ts +14 -0
  319. package/dist/lib/notifications/providers/email.d.ts.map +1 -0
  320. package/dist/lib/notifications/providers/email.js +88 -0
  321. package/dist/lib/notifications/providers/email.js.map +1 -0
  322. package/dist/lib/notifications/providers/pagerduty.d.ts +16 -0
  323. package/dist/lib/notifications/providers/pagerduty.d.ts.map +1 -0
  324. package/dist/lib/notifications/providers/pagerduty.js +94 -0
  325. package/dist/lib/notifications/providers/pagerduty.js.map +1 -0
  326. package/dist/lib/notifications/providers/slack.d.ts +14 -0
  327. package/dist/lib/notifications/providers/slack.d.ts.map +1 -0
  328. package/dist/lib/notifications/providers/slack.js +106 -0
  329. package/dist/lib/notifications/providers/slack.js.map +1 -0
  330. package/dist/lib/notifications/providers/webhook.d.ts +16 -0
  331. package/dist/lib/notifications/providers/webhook.d.ts.map +1 -0
  332. package/dist/lib/notifications/providers/webhook.js +78 -0
  333. package/dist/lib/notifications/providers/webhook.js.map +1 -0
  334. package/dist/lib/notifications/router.d.ts +30 -0
  335. package/dist/lib/notifications/router.d.ts.map +1 -0
  336. package/dist/lib/notifications/router.js +137 -0
  337. package/dist/lib/notifications/router.js.map +1 -0
  338. package/dist/lib/notifications/ssrf.d.ts +13 -0
  339. package/dist/lib/notifications/ssrf.d.ts.map +1 -0
  340. package/dist/lib/notifications/ssrf.js +37 -0
  341. package/dist/lib/notifications/ssrf.js.map +1 -0
  342. package/dist/lib/optimization/analyzers/model-downgrade.d.ts +15 -0
  343. package/dist/lib/optimization/analyzers/model-downgrade.d.ts.map +1 -0
  344. package/dist/lib/optimization/analyzers/model-downgrade.js +58 -0
  345. package/dist/lib/optimization/analyzers/model-downgrade.js.map +1 -0
  346. package/dist/lib/optimization/analyzers/prompt-optimization.d.ts +17 -0
  347. package/dist/lib/optimization/analyzers/prompt-optimization.d.ts.map +1 -0
  348. package/dist/lib/optimization/analyzers/prompt-optimization.js +160 -0
  349. package/dist/lib/optimization/analyzers/prompt-optimization.js.map +1 -0
  350. package/dist/lib/optimization/analyzers/types.d.ts +23 -0
  351. package/dist/lib/optimization/analyzers/types.d.ts.map +1 -0
  352. package/dist/lib/optimization/analyzers/types.js +5 -0
  353. package/dist/lib/optimization/analyzers/types.js.map +1 -0
  354. package/dist/lib/optimization/classifier.d.ts +4 -3
  355. package/dist/lib/optimization/classifier.d.ts.map +1 -1
  356. package/dist/lib/optimization/classifier.js +15 -9
  357. package/dist/lib/optimization/classifier.js.map +1 -1
  358. package/dist/lib/optimization/cost-optimizer.d.ts +21 -0
  359. package/dist/lib/optimization/cost-optimizer.d.ts.map +1 -0
  360. package/dist/lib/optimization/cost-optimizer.js +114 -0
  361. package/dist/lib/optimization/cost-optimizer.js.map +1 -0
  362. package/dist/lib/optimization/engine.d.ts.map +1 -1
  363. package/dist/lib/optimization/engine.js +45 -6
  364. package/dist/lib/optimization/engine.js.map +1 -1
  365. package/dist/lib/optimization/forecast.d.ts +39 -0
  366. package/dist/lib/optimization/forecast.d.ts.map +1 -0
  367. package/dist/lib/optimization/forecast.js +128 -0
  368. package/dist/lib/optimization/forecast.js.map +1 -0
  369. package/dist/lib/secrets.d.ts +30 -0
  370. package/dist/lib/secrets.d.ts.map +1 -0
  371. package/dist/lib/secrets.js +103 -0
  372. package/dist/lib/secrets.js.map +1 -0
  373. package/dist/lib/threshold-monitor.d.ts +53 -0
  374. package/dist/lib/threshold-monitor.d.ts.map +1 -0
  375. package/dist/lib/threshold-monitor.js +112 -0
  376. package/dist/lib/threshold-monitor.js.map +1 -0
  377. package/dist/middleware/audit.d.ts +16 -0
  378. package/dist/middleware/audit.d.ts.map +1 -0
  379. package/dist/middleware/audit.js +16 -0
  380. package/dist/middleware/audit.js.map +1 -0
  381. package/dist/middleware/auth-errors.d.ts +67 -0
  382. package/dist/middleware/auth-errors.d.ts.map +1 -0
  383. package/dist/middleware/auth-errors.js +84 -0
  384. package/dist/middleware/auth-errors.js.map +1 -0
  385. package/dist/middleware/auth.d.ts +5 -2
  386. package/dist/middleware/auth.d.ts.map +1 -1
  387. package/dist/middleware/auth.js +44 -17
  388. package/dist/middleware/auth.js.map +1 -1
  389. package/dist/middleware/body-limit.d.ts +9 -0
  390. package/dist/middleware/body-limit.d.ts.map +1 -0
  391. package/dist/middleware/body-limit.js +15 -0
  392. package/dist/middleware/body-limit.js.map +1 -0
  393. package/dist/middleware/cors-config.d.ts +30 -0
  394. package/dist/middleware/cors-config.d.ts.map +1 -0
  395. package/dist/middleware/cors-config.js +55 -0
  396. package/dist/middleware/cors-config.js.map +1 -0
  397. package/dist/middleware/rate-limit.d.ts +9 -0
  398. package/dist/middleware/rate-limit.d.ts.map +1 -0
  399. package/dist/middleware/rate-limit.js +56 -0
  400. package/dist/middleware/rate-limit.js.map +1 -0
  401. package/dist/middleware/rbac.d.ts +30 -0
  402. package/dist/middleware/rbac.d.ts.map +1 -0
  403. package/dist/middleware/rbac.js +87 -0
  404. package/dist/middleware/rbac.js.map +1 -0
  405. package/dist/middleware/security-headers.d.ts +12 -0
  406. package/dist/middleware/security-headers.d.ts.map +1 -0
  407. package/dist/middleware/security-headers.js +57 -0
  408. package/dist/middleware/security-headers.js.map +1 -0
  409. package/dist/middleware/unified-auth.d.ts +49 -0
  410. package/dist/middleware/unified-auth.d.ts.map +1 -0
  411. package/dist/middleware/unified-auth.js +246 -0
  412. package/dist/middleware/unified-auth.js.map +1 -0
  413. package/dist/middleware/validation.d.ts +31 -0
  414. package/dist/middleware/validation.d.ts.map +1 -0
  415. package/dist/middleware/validation.js +45 -0
  416. package/dist/middleware/validation.js.map +1 -0
  417. package/dist/routes/alerts.d.ts.map +1 -1
  418. package/dist/routes/alerts.js +4 -3
  419. package/dist/routes/alerts.js.map +1 -1
  420. package/dist/routes/analytics.d.ts +2 -1
  421. package/dist/routes/analytics.d.ts.map +1 -1
  422. package/dist/routes/analytics.js +175 -95
  423. package/dist/routes/analytics.js.map +1 -1
  424. package/dist/routes/api-keys.d.ts +5 -0
  425. package/dist/routes/api-keys.d.ts.map +1 -1
  426. package/dist/routes/api-keys.js +89 -8
  427. package/dist/routes/api-keys.js.map +1 -1
  428. package/dist/routes/audit-verify.d.ts +12 -0
  429. package/dist/routes/audit-verify.d.ts.map +1 -0
  430. package/dist/routes/audit-verify.js +73 -0
  431. package/dist/routes/audit-verify.js.map +1 -0
  432. package/dist/routes/audit.d.ts +4 -6
  433. package/dist/routes/audit.d.ts.map +1 -1
  434. package/dist/routes/audit.js +54 -157
  435. package/dist/routes/audit.js.map +1 -1
  436. package/dist/routes/auth.d.ts +21 -0
  437. package/dist/routes/auth.d.ts.map +1 -0
  438. package/dist/routes/auth.js +235 -0
  439. package/dist/routes/auth.js.map +1 -0
  440. package/dist/routes/benchmarks.d.ts.map +1 -1
  441. package/dist/routes/benchmarks.js +63 -11
  442. package/dist/routes/benchmarks.js.map +1 -1
  443. package/dist/routes/capabilities-top.d.ts.map +1 -1
  444. package/dist/routes/capabilities-top.js +1 -4
  445. package/dist/routes/capabilities-top.js.map +1 -1
  446. package/dist/routes/capabilities.d.ts.map +1 -1
  447. package/dist/routes/capabilities.js +1 -7
  448. package/dist/routes/capabilities.js.map +1 -1
  449. package/dist/routes/compliance.d.ts +17 -0
  450. package/dist/routes/compliance.d.ts.map +1 -0
  451. package/dist/routes/compliance.js +151 -0
  452. package/dist/routes/compliance.js.map +1 -0
  453. package/dist/routes/config.d.ts +1 -13
  454. package/dist/routes/config.d.ts.map +1 -1
  455. package/dist/routes/context.d.ts.map +1 -1
  456. package/dist/routes/context.js +6 -5
  457. package/dist/routes/context.js.map +1 -1
  458. package/dist/routes/cost-budgets.d.ts +20 -0
  459. package/dist/routes/cost-budgets.d.ts.map +1 -0
  460. package/dist/routes/cost-budgets.js +194 -0
  461. package/dist/routes/cost-budgets.js.map +1 -0
  462. package/dist/routes/delegation.d.ts.map +1 -1
  463. package/dist/routes/delegation.js +67 -41
  464. package/dist/routes/delegation.js.map +1 -1
  465. package/dist/routes/delegations-top.d.ts.map +1 -1
  466. package/dist/routes/delegations-top.js +1 -3
  467. package/dist/routes/delegations-top.js.map +1 -1
  468. package/dist/routes/diagnose.d.ts +16 -0
  469. package/dist/routes/diagnose.d.ts.map +1 -0
  470. package/dist/routes/diagnose.js +82 -0
  471. package/dist/routes/diagnose.js.map +1 -0
  472. package/dist/routes/discovery.d.ts.map +1 -1
  473. package/dist/routes/discovery.js +50 -38
  474. package/dist/routes/discovery.js.map +1 -1
  475. package/dist/routes/eval.d.ts +24 -0
  476. package/dist/routes/eval.d.ts.map +1 -0
  477. package/dist/routes/eval.js +281 -0
  478. package/dist/routes/eval.js.map +1 -0
  479. package/dist/routes/events.d.ts.map +1 -1
  480. package/dist/routes/events.js +11 -6
  481. package/dist/routes/events.js.map +1 -1
  482. package/dist/routes/guardrails.d.ts +2 -1
  483. package/dist/routes/guardrails.d.ts.map +1 -1
  484. package/dist/routes/guardrails.js +85 -14
  485. package/dist/routes/guardrails.js.map +1 -1
  486. package/dist/routes/health.d.ts +14 -11
  487. package/dist/routes/health.d.ts.map +1 -1
  488. package/dist/routes/health.js +181 -61
  489. package/dist/routes/health.js.map +1 -1
  490. package/dist/routes/lore-proxy.d.ts +13 -0
  491. package/dist/routes/lore-proxy.d.ts.map +1 -0
  492. package/dist/routes/lore-proxy.js +229 -0
  493. package/dist/routes/lore-proxy.js.map +1 -0
  494. package/dist/routes/mesh-proxy.d.ts +7 -0
  495. package/dist/routes/mesh-proxy.d.ts.map +1 -0
  496. package/dist/routes/mesh-proxy.js +94 -0
  497. package/dist/routes/mesh-proxy.js.map +1 -0
  498. package/dist/routes/notifications.d.ts +19 -0
  499. package/dist/routes/notifications.d.ts.map +1 -0
  500. package/dist/routes/notifications.js +129 -0
  501. package/dist/routes/notifications.js.map +1 -0
  502. package/dist/routes/optimize.d.ts.map +1 -1
  503. package/dist/routes/optimize.js +44 -0
  504. package/dist/routes/optimize.js.map +1 -1
  505. package/dist/routes/otlp.d.ts +17 -0
  506. package/dist/routes/otlp.d.ts.map +1 -0
  507. package/dist/routes/otlp.js +544 -0
  508. package/dist/routes/otlp.js.map +1 -0
  509. package/dist/routes/prompts.d.ts +21 -0
  510. package/dist/routes/prompts.d.ts.map +1 -0
  511. package/dist/routes/prompts.js +173 -0
  512. package/dist/routes/prompts.js.map +1 -0
  513. package/dist/routes/recall.d.ts.map +1 -1
  514. package/dist/routes/recall.js +6 -4
  515. package/dist/routes/recall.js.map +1 -1
  516. package/dist/routes/replay.d.ts.map +1 -1
  517. package/dist/routes/replay.js +2 -1
  518. package/dist/routes/replay.js.map +1 -1
  519. package/dist/routes/server-info.d.ts +9 -0
  520. package/dist/routes/server-info.d.ts.map +1 -0
  521. package/dist/routes/server-info.js +18 -0
  522. package/dist/routes/server-info.js.map +1 -0
  523. package/dist/routes/sessions.d.ts +7 -7
  524. package/dist/routes/sessions.d.ts.map +1 -1
  525. package/dist/routes/sessions.js +112 -35
  526. package/dist/routes/sessions.js.map +1 -1
  527. package/dist/routes/stats.d.ts.map +1 -1
  528. package/dist/routes/stats.js +40 -0
  529. package/dist/routes/stats.js.map +1 -1
  530. package/dist/routes/stream.d.ts +2 -2
  531. package/dist/routes/stream.d.ts.map +1 -1
  532. package/dist/routes/stream.js +7 -11
  533. package/dist/routes/stream.js.map +1 -1
  534. package/dist/routes/tenant-helper.d.ts +15 -10
  535. package/dist/routes/tenant-helper.d.ts.map +1 -1
  536. package/dist/routes/tenant-helper.js +36 -22
  537. package/dist/routes/tenant-helper.js.map +1 -1
  538. package/dist/routes/trust.d.ts.map +1 -1
  539. package/dist/routes/trust.js +1 -3
  540. package/dist/routes/trust.js.map +1 -1
  541. package/dist/schemas/api-keys.d.ts +11 -0
  542. package/dist/schemas/api-keys.d.ts.map +1 -0
  543. package/dist/schemas/api-keys.js +10 -0
  544. package/dist/schemas/api-keys.js.map +1 -0
  545. package/dist/schemas/common.d.ts +34 -0
  546. package/dist/schemas/common.d.ts.map +1 -0
  547. package/dist/schemas/common.js +43 -0
  548. package/dist/schemas/common.js.map +1 -0
  549. package/dist/schemas/delegation.d.ts +23 -0
  550. package/dist/schemas/delegation.d.ts.map +1 -0
  551. package/dist/schemas/delegation.js +22 -0
  552. package/dist/schemas/delegation.js.map +1 -0
  553. package/dist/schemas/discovery.d.ts +17 -0
  554. package/dist/schemas/discovery.d.ts.map +1 -0
  555. package/dist/schemas/discovery.js +15 -0
  556. package/dist/schemas/discovery.js.map +1 -0
  557. package/dist/schemas/health.d.ts +75 -0
  558. package/dist/schemas/health.d.ts.map +1 -0
  559. package/dist/schemas/health.js +55 -0
  560. package/dist/schemas/health.js.map +1 -0
  561. package/dist/schemas/index.d.ts +6 -0
  562. package/dist/schemas/index.d.ts.map +1 -0
  563. package/dist/schemas/index.js +6 -0
  564. package/dist/schemas/index.js.map +1 -0
  565. package/dist/schemas/sessions.d.ts +67 -0
  566. package/dist/schemas/sessions.d.ts.map +1 -0
  567. package/dist/schemas/sessions.js +58 -0
  568. package/dist/schemas/sessions.js.map +1 -0
  569. package/dist/services/delegation-service.d.ts +1 -4
  570. package/dist/services/delegation-service.d.ts.map +1 -1
  571. package/dist/services/delegation-service.js +5 -31
  572. package/dist/services/delegation-service.js.map +1 -1
  573. package/package.json +29 -19
  574. package/dist/db/lesson-store.d.ts +0 -57
  575. package/dist/db/lesson-store.d.ts.map +0 -1
  576. package/dist/db/lesson-store.js +0 -217
  577. package/dist/db/lesson-store.js.map +0 -1
  578. package/dist/lib/embeddings/local.d.ts +0 -15
  579. package/dist/lib/embeddings/local.d.ts.map +0 -1
  580. package/dist/lib/embeddings/local.js +0 -65
  581. package/dist/lib/embeddings/local.js.map +0 -1
  582. package/dist/lib/redaction/human-review-layer.d.ts +0 -37
  583. package/dist/lib/redaction/human-review-layer.d.ts.map +0 -1
  584. package/dist/lib/redaction/human-review-layer.js +0 -62
  585. package/dist/lib/redaction/human-review-layer.js.map +0 -1
  586. package/dist/lib/redaction/index.d.ts +0 -12
  587. package/dist/lib/redaction/index.d.ts.map +0 -1
  588. package/dist/lib/redaction/index.js +0 -12
  589. package/dist/lib/redaction/index.js.map +0 -1
  590. package/dist/lib/redaction/pii-detection-layer.d.ts +0 -30
  591. package/dist/lib/redaction/pii-detection-layer.d.ts.map +0 -1
  592. package/dist/lib/redaction/pii-detection-layer.js +0 -183
  593. package/dist/lib/redaction/pii-detection-layer.js.map +0 -1
  594. package/dist/lib/redaction/pipeline.d.ts +0 -26
  595. package/dist/lib/redaction/pipeline.d.ts.map +0 -1
  596. package/dist/lib/redaction/pipeline.js +0 -91
  597. package/dist/lib/redaction/pipeline.js.map +0 -1
  598. package/dist/lib/redaction/secret-detection-layer.d.ts +0 -10
  599. package/dist/lib/redaction/secret-detection-layer.d.ts.map +0 -1
  600. package/dist/lib/redaction/secret-detection-layer.js +0 -79
  601. package/dist/lib/redaction/secret-detection-layer.js.map +0 -1
  602. package/dist/lib/redaction/secret-patterns.d.ts +0 -29
  603. package/dist/lib/redaction/secret-patterns.d.ts.map +0 -1
  604. package/dist/lib/redaction/secret-patterns.js +0 -133
  605. package/dist/lib/redaction/secret-patterns.js.map +0 -1
  606. package/dist/lib/redaction/semantic-denylist-layer.d.ts +0 -10
  607. package/dist/lib/redaction/semantic-denylist-layer.d.ts.map +0 -1
  608. package/dist/lib/redaction/semantic-denylist-layer.js +0 -64
  609. package/dist/lib/redaction/semantic-denylist-layer.js.map +0 -1
  610. package/dist/lib/redaction/tenant-deidentification-layer.d.ts +0 -10
  611. package/dist/lib/redaction/tenant-deidentification-layer.d.ts.map +0 -1
  612. package/dist/lib/redaction/tenant-deidentification-layer.js +0 -64
  613. package/dist/lib/redaction/tenant-deidentification-layer.js.map +0 -1
  614. package/dist/lib/redaction/url-path-scrubbing-layer.d.ts +0 -14
  615. package/dist/lib/redaction/url-path-scrubbing-layer.d.ts.map +0 -1
  616. package/dist/lib/redaction/url-path-scrubbing-layer.js +0 -156
  617. package/dist/lib/redaction/url-path-scrubbing-layer.js.map +0 -1
  618. package/dist/routes/community.d.ts +0 -24
  619. package/dist/routes/community.d.ts.map +0 -1
  620. package/dist/routes/community.js +0 -272
  621. package/dist/routes/community.js.map +0 -1
  622. package/dist/routes/lessons.d.ts +0 -19
  623. package/dist/routes/lessons.d.ts.map +0 -1
  624. package/dist/routes/lessons.js +0 -164
  625. package/dist/routes/lessons.js.map +0 -1
  626. package/dist/routes/redaction-test.d.ts +0 -14
  627. package/dist/routes/redaction-test.d.ts.map +0 -1
  628. package/dist/routes/redaction-test.js +0 -33
  629. package/dist/routes/redaction-test.js.map +0 -1
  630. package/dist/services/community-service.d.ts +0 -283
  631. package/dist/services/community-service.d.ts.map +0 -1
  632. package/dist/services/community-service.js +0 -816
  633. package/dist/services/community-service.js.map +0 -1
@@ -0,0 +1,2593 @@
1
+ {
2
+ "id": "31c0f1d7-484c-4e84-85d6-307168b5b9d5",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.agent_sharing_config": {
8
+ "name": "agent_sharing_config",
9
+ "schema": "",
10
+ "columns": {
11
+ "tenant_id": {
12
+ "name": "tenant_id",
13
+ "type": "text",
14
+ "primaryKey": false,
15
+ "notNull": true
16
+ },
17
+ "agent_id": {
18
+ "name": "agent_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "enabled": {
24
+ "name": "enabled",
25
+ "type": "boolean",
26
+ "primaryKey": false,
27
+ "notNull": true,
28
+ "default": false
29
+ },
30
+ "categories": {
31
+ "name": "categories",
32
+ "type": "jsonb",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "'[]'::jsonb"
36
+ },
37
+ "updated_at": {
38
+ "name": "updated_at",
39
+ "type": "text",
40
+ "primaryKey": false,
41
+ "notNull": true
42
+ }
43
+ },
44
+ "indexes": {},
45
+ "foreignKeys": {},
46
+ "compositePrimaryKeys": {
47
+ "agent_sharing_config_tenant_id_agent_id_pk": {
48
+ "name": "agent_sharing_config_tenant_id_agent_id_pk",
49
+ "columns": [
50
+ "tenant_id",
51
+ "agent_id"
52
+ ]
53
+ }
54
+ },
55
+ "uniqueConstraints": {},
56
+ "policies": {},
57
+ "checkConstraints": {},
58
+ "isRLSEnabled": false
59
+ },
60
+ "public.agents": {
61
+ "name": "agents",
62
+ "schema": "",
63
+ "columns": {
64
+ "id": {
65
+ "name": "id",
66
+ "type": "text",
67
+ "primaryKey": false,
68
+ "notNull": true
69
+ },
70
+ "name": {
71
+ "name": "name",
72
+ "type": "text",
73
+ "primaryKey": false,
74
+ "notNull": true
75
+ },
76
+ "description": {
77
+ "name": "description",
78
+ "type": "text",
79
+ "primaryKey": false,
80
+ "notNull": false
81
+ },
82
+ "first_seen_at": {
83
+ "name": "first_seen_at",
84
+ "type": "text",
85
+ "primaryKey": false,
86
+ "notNull": true
87
+ },
88
+ "last_seen_at": {
89
+ "name": "last_seen_at",
90
+ "type": "text",
91
+ "primaryKey": false,
92
+ "notNull": true
93
+ },
94
+ "session_count": {
95
+ "name": "session_count",
96
+ "type": "integer",
97
+ "primaryKey": false,
98
+ "notNull": true,
99
+ "default": 0
100
+ },
101
+ "tenant_id": {
102
+ "name": "tenant_id",
103
+ "type": "text",
104
+ "primaryKey": false,
105
+ "notNull": true,
106
+ "default": "'default'"
107
+ },
108
+ "model_override": {
109
+ "name": "model_override",
110
+ "type": "text",
111
+ "primaryKey": false,
112
+ "notNull": false
113
+ },
114
+ "paused_at": {
115
+ "name": "paused_at",
116
+ "type": "text",
117
+ "primaryKey": false,
118
+ "notNull": false
119
+ },
120
+ "pause_reason": {
121
+ "name": "pause_reason",
122
+ "type": "text",
123
+ "primaryKey": false,
124
+ "notNull": false
125
+ }
126
+ },
127
+ "indexes": {
128
+ "idx_agents_tenant_id": {
129
+ "name": "idx_agents_tenant_id",
130
+ "columns": [
131
+ {
132
+ "expression": "tenant_id",
133
+ "isExpression": false,
134
+ "asc": true,
135
+ "nulls": "last"
136
+ }
137
+ ],
138
+ "isUnique": false,
139
+ "concurrently": false,
140
+ "method": "btree",
141
+ "with": {}
142
+ }
143
+ },
144
+ "foreignKeys": {},
145
+ "compositePrimaryKeys": {
146
+ "agents_id_tenant_id_pk": {
147
+ "name": "agents_id_tenant_id_pk",
148
+ "columns": [
149
+ "id",
150
+ "tenant_id"
151
+ ]
152
+ }
153
+ },
154
+ "uniqueConstraints": {},
155
+ "policies": {},
156
+ "checkConstraints": {},
157
+ "isRLSEnabled": false
158
+ },
159
+ "public.alert_history": {
160
+ "name": "alert_history",
161
+ "schema": "",
162
+ "columns": {
163
+ "id": {
164
+ "name": "id",
165
+ "type": "text",
166
+ "primaryKey": true,
167
+ "notNull": true
168
+ },
169
+ "rule_id": {
170
+ "name": "rule_id",
171
+ "type": "text",
172
+ "primaryKey": false,
173
+ "notNull": true
174
+ },
175
+ "triggered_at": {
176
+ "name": "triggered_at",
177
+ "type": "text",
178
+ "primaryKey": false,
179
+ "notNull": true
180
+ },
181
+ "resolved_at": {
182
+ "name": "resolved_at",
183
+ "type": "text",
184
+ "primaryKey": false,
185
+ "notNull": false
186
+ },
187
+ "current_value": {
188
+ "name": "current_value",
189
+ "type": "double precision",
190
+ "primaryKey": false,
191
+ "notNull": true
192
+ },
193
+ "threshold": {
194
+ "name": "threshold",
195
+ "type": "double precision",
196
+ "primaryKey": false,
197
+ "notNull": true
198
+ },
199
+ "message": {
200
+ "name": "message",
201
+ "type": "text",
202
+ "primaryKey": false,
203
+ "notNull": true
204
+ },
205
+ "tenant_id": {
206
+ "name": "tenant_id",
207
+ "type": "text",
208
+ "primaryKey": false,
209
+ "notNull": true,
210
+ "default": "'default'"
211
+ }
212
+ },
213
+ "indexes": {
214
+ "idx_alert_history_rule_id": {
215
+ "name": "idx_alert_history_rule_id",
216
+ "columns": [
217
+ {
218
+ "expression": "rule_id",
219
+ "isExpression": false,
220
+ "asc": true,
221
+ "nulls": "last"
222
+ }
223
+ ],
224
+ "isUnique": false,
225
+ "concurrently": false,
226
+ "method": "btree",
227
+ "with": {}
228
+ }
229
+ },
230
+ "foreignKeys": {
231
+ "alert_history_rule_id_alert_rules_id_fk": {
232
+ "name": "alert_history_rule_id_alert_rules_id_fk",
233
+ "tableFrom": "alert_history",
234
+ "tableTo": "alert_rules",
235
+ "columnsFrom": [
236
+ "rule_id"
237
+ ],
238
+ "columnsTo": [
239
+ "id"
240
+ ],
241
+ "onDelete": "no action",
242
+ "onUpdate": "no action"
243
+ }
244
+ },
245
+ "compositePrimaryKeys": {},
246
+ "uniqueConstraints": {},
247
+ "policies": {},
248
+ "checkConstraints": {},
249
+ "isRLSEnabled": false
250
+ },
251
+ "public.alert_rules": {
252
+ "name": "alert_rules",
253
+ "schema": "",
254
+ "columns": {
255
+ "id": {
256
+ "name": "id",
257
+ "type": "text",
258
+ "primaryKey": true,
259
+ "notNull": true
260
+ },
261
+ "name": {
262
+ "name": "name",
263
+ "type": "text",
264
+ "primaryKey": false,
265
+ "notNull": true
266
+ },
267
+ "enabled": {
268
+ "name": "enabled",
269
+ "type": "boolean",
270
+ "primaryKey": false,
271
+ "notNull": true,
272
+ "default": true
273
+ },
274
+ "condition": {
275
+ "name": "condition",
276
+ "type": "text",
277
+ "primaryKey": false,
278
+ "notNull": true
279
+ },
280
+ "threshold": {
281
+ "name": "threshold",
282
+ "type": "double precision",
283
+ "primaryKey": false,
284
+ "notNull": true
285
+ },
286
+ "window_minutes": {
287
+ "name": "window_minutes",
288
+ "type": "integer",
289
+ "primaryKey": false,
290
+ "notNull": true
291
+ },
292
+ "scope": {
293
+ "name": "scope",
294
+ "type": "jsonb",
295
+ "primaryKey": false,
296
+ "notNull": true,
297
+ "default": "'{}'::jsonb"
298
+ },
299
+ "notify_channels": {
300
+ "name": "notify_channels",
301
+ "type": "jsonb",
302
+ "primaryKey": false,
303
+ "notNull": true,
304
+ "default": "'[]'::jsonb"
305
+ },
306
+ "created_at": {
307
+ "name": "created_at",
308
+ "type": "text",
309
+ "primaryKey": false,
310
+ "notNull": true
311
+ },
312
+ "updated_at": {
313
+ "name": "updated_at",
314
+ "type": "text",
315
+ "primaryKey": false,
316
+ "notNull": true
317
+ },
318
+ "tenant_id": {
319
+ "name": "tenant_id",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": true,
323
+ "default": "'default'"
324
+ }
325
+ },
326
+ "indexes": {},
327
+ "foreignKeys": {},
328
+ "compositePrimaryKeys": {},
329
+ "uniqueConstraints": {},
330
+ "policies": {},
331
+ "checkConstraints": {},
332
+ "isRLSEnabled": false
333
+ },
334
+ "public.anonymous_id_map": {
335
+ "name": "anonymous_id_map",
336
+ "schema": "",
337
+ "columns": {
338
+ "tenant_id": {
339
+ "name": "tenant_id",
340
+ "type": "text",
341
+ "primaryKey": false,
342
+ "notNull": true
343
+ },
344
+ "agent_id": {
345
+ "name": "agent_id",
346
+ "type": "text",
347
+ "primaryKey": false,
348
+ "notNull": true
349
+ },
350
+ "anonymous_agent_id": {
351
+ "name": "anonymous_agent_id",
352
+ "type": "text",
353
+ "primaryKey": false,
354
+ "notNull": true
355
+ },
356
+ "valid_from": {
357
+ "name": "valid_from",
358
+ "type": "text",
359
+ "primaryKey": false,
360
+ "notNull": true
361
+ },
362
+ "valid_until": {
363
+ "name": "valid_until",
364
+ "type": "text",
365
+ "primaryKey": false,
366
+ "notNull": true
367
+ }
368
+ },
369
+ "indexes": {
370
+ "idx_anon_map_anon_id": {
371
+ "name": "idx_anon_map_anon_id",
372
+ "columns": [
373
+ {
374
+ "expression": "anonymous_agent_id",
375
+ "isExpression": false,
376
+ "asc": true,
377
+ "nulls": "last"
378
+ }
379
+ ],
380
+ "isUnique": false,
381
+ "concurrently": false,
382
+ "method": "btree",
383
+ "with": {}
384
+ }
385
+ },
386
+ "foreignKeys": {},
387
+ "compositePrimaryKeys": {
388
+ "anonymous_id_map_tenant_id_agent_id_valid_from_pk": {
389
+ "name": "anonymous_id_map_tenant_id_agent_id_valid_from_pk",
390
+ "columns": [
391
+ "tenant_id",
392
+ "agent_id",
393
+ "valid_from"
394
+ ]
395
+ }
396
+ },
397
+ "uniqueConstraints": {},
398
+ "policies": {},
399
+ "checkConstraints": {},
400
+ "isRLSEnabled": false
401
+ },
402
+ "public.api_keys": {
403
+ "name": "api_keys",
404
+ "schema": "",
405
+ "columns": {
406
+ "id": {
407
+ "name": "id",
408
+ "type": "text",
409
+ "primaryKey": true,
410
+ "notNull": true
411
+ },
412
+ "key_hash": {
413
+ "name": "key_hash",
414
+ "type": "text",
415
+ "primaryKey": false,
416
+ "notNull": true
417
+ },
418
+ "name": {
419
+ "name": "name",
420
+ "type": "text",
421
+ "primaryKey": false,
422
+ "notNull": true
423
+ },
424
+ "scopes": {
425
+ "name": "scopes",
426
+ "type": "jsonb",
427
+ "primaryKey": false,
428
+ "notNull": true
429
+ },
430
+ "created_at": {
431
+ "name": "created_at",
432
+ "type": "integer",
433
+ "primaryKey": false,
434
+ "notNull": true
435
+ },
436
+ "last_used_at": {
437
+ "name": "last_used_at",
438
+ "type": "integer",
439
+ "primaryKey": false,
440
+ "notNull": false
441
+ },
442
+ "revoked_at": {
443
+ "name": "revoked_at",
444
+ "type": "integer",
445
+ "primaryKey": false,
446
+ "notNull": false
447
+ },
448
+ "rate_limit": {
449
+ "name": "rate_limit",
450
+ "type": "integer",
451
+ "primaryKey": false,
452
+ "notNull": false
453
+ },
454
+ "tenant_id": {
455
+ "name": "tenant_id",
456
+ "type": "text",
457
+ "primaryKey": false,
458
+ "notNull": true,
459
+ "default": "'default'"
460
+ },
461
+ "created_by": {
462
+ "name": "created_by",
463
+ "type": "text",
464
+ "primaryKey": false,
465
+ "notNull": false
466
+ },
467
+ "role": {
468
+ "name": "role",
469
+ "type": "text",
470
+ "primaryKey": false,
471
+ "notNull": true,
472
+ "default": "'editor'"
473
+ },
474
+ "rotated_at": {
475
+ "name": "rotated_at",
476
+ "type": "integer",
477
+ "primaryKey": false,
478
+ "notNull": false
479
+ },
480
+ "expires_at": {
481
+ "name": "expires_at",
482
+ "type": "integer",
483
+ "primaryKey": false,
484
+ "notNull": false
485
+ }
486
+ },
487
+ "indexes": {
488
+ "idx_api_keys_hash": {
489
+ "name": "idx_api_keys_hash",
490
+ "columns": [
491
+ {
492
+ "expression": "key_hash",
493
+ "isExpression": false,
494
+ "asc": true,
495
+ "nulls": "last"
496
+ }
497
+ ],
498
+ "isUnique": false,
499
+ "concurrently": false,
500
+ "method": "btree",
501
+ "with": {}
502
+ }
503
+ },
504
+ "foreignKeys": {
505
+ "api_keys_created_by_users_id_fk": {
506
+ "name": "api_keys_created_by_users_id_fk",
507
+ "tableFrom": "api_keys",
508
+ "tableTo": "users",
509
+ "columnsFrom": [
510
+ "created_by"
511
+ ],
512
+ "columnsTo": [
513
+ "id"
514
+ ],
515
+ "onDelete": "no action",
516
+ "onUpdate": "no action"
517
+ }
518
+ },
519
+ "compositePrimaryKeys": {},
520
+ "uniqueConstraints": {},
521
+ "policies": {},
522
+ "checkConstraints": {},
523
+ "isRLSEnabled": false
524
+ },
525
+ "public.audit_log": {
526
+ "name": "audit_log",
527
+ "schema": "",
528
+ "columns": {
529
+ "id": {
530
+ "name": "id",
531
+ "type": "text",
532
+ "primaryKey": true,
533
+ "notNull": true
534
+ },
535
+ "timestamp": {
536
+ "name": "timestamp",
537
+ "type": "text",
538
+ "primaryKey": false,
539
+ "notNull": true
540
+ },
541
+ "tenant_id": {
542
+ "name": "tenant_id",
543
+ "type": "text",
544
+ "primaryKey": false,
545
+ "notNull": true
546
+ },
547
+ "actor_type": {
548
+ "name": "actor_type",
549
+ "type": "text",
550
+ "primaryKey": false,
551
+ "notNull": true
552
+ },
553
+ "actor_id": {
554
+ "name": "actor_id",
555
+ "type": "text",
556
+ "primaryKey": false,
557
+ "notNull": true
558
+ },
559
+ "action": {
560
+ "name": "action",
561
+ "type": "text",
562
+ "primaryKey": false,
563
+ "notNull": true
564
+ },
565
+ "resource_type": {
566
+ "name": "resource_type",
567
+ "type": "text",
568
+ "primaryKey": false,
569
+ "notNull": false
570
+ },
571
+ "resource_id": {
572
+ "name": "resource_id",
573
+ "type": "text",
574
+ "primaryKey": false,
575
+ "notNull": false
576
+ },
577
+ "details": {
578
+ "name": "details",
579
+ "type": "jsonb",
580
+ "primaryKey": false,
581
+ "notNull": true,
582
+ "default": "'{}'::jsonb"
583
+ },
584
+ "ip_address": {
585
+ "name": "ip_address",
586
+ "type": "text",
587
+ "primaryKey": false,
588
+ "notNull": false
589
+ },
590
+ "user_agent": {
591
+ "name": "user_agent",
592
+ "type": "text",
593
+ "primaryKey": false,
594
+ "notNull": false
595
+ }
596
+ },
597
+ "indexes": {
598
+ "idx_audit_log_tenant_ts": {
599
+ "name": "idx_audit_log_tenant_ts",
600
+ "columns": [
601
+ {
602
+ "expression": "tenant_id",
603
+ "isExpression": false,
604
+ "asc": true,
605
+ "nulls": "last"
606
+ },
607
+ {
608
+ "expression": "timestamp",
609
+ "isExpression": false,
610
+ "asc": true,
611
+ "nulls": "last"
612
+ }
613
+ ],
614
+ "isUnique": false,
615
+ "concurrently": false,
616
+ "method": "btree",
617
+ "with": {}
618
+ },
619
+ "idx_audit_log_action": {
620
+ "name": "idx_audit_log_action",
621
+ "columns": [
622
+ {
623
+ "expression": "action",
624
+ "isExpression": false,
625
+ "asc": true,
626
+ "nulls": "last"
627
+ }
628
+ ],
629
+ "isUnique": false,
630
+ "concurrently": false,
631
+ "method": "btree",
632
+ "with": {}
633
+ }
634
+ },
635
+ "foreignKeys": {},
636
+ "compositePrimaryKeys": {},
637
+ "uniqueConstraints": {},
638
+ "policies": {},
639
+ "checkConstraints": {},
640
+ "isRLSEnabled": false
641
+ },
642
+ "public.capability_registry": {
643
+ "name": "capability_registry",
644
+ "schema": "",
645
+ "columns": {
646
+ "id": {
647
+ "name": "id",
648
+ "type": "text",
649
+ "primaryKey": true,
650
+ "notNull": true
651
+ },
652
+ "tenant_id": {
653
+ "name": "tenant_id",
654
+ "type": "text",
655
+ "primaryKey": false,
656
+ "notNull": true
657
+ },
658
+ "agent_id": {
659
+ "name": "agent_id",
660
+ "type": "text",
661
+ "primaryKey": false,
662
+ "notNull": true
663
+ },
664
+ "task_type": {
665
+ "name": "task_type",
666
+ "type": "text",
667
+ "primaryKey": false,
668
+ "notNull": true
669
+ },
670
+ "custom_type": {
671
+ "name": "custom_type",
672
+ "type": "text",
673
+ "primaryKey": false,
674
+ "notNull": false
675
+ },
676
+ "input_schema": {
677
+ "name": "input_schema",
678
+ "type": "jsonb",
679
+ "primaryKey": false,
680
+ "notNull": true
681
+ },
682
+ "output_schema": {
683
+ "name": "output_schema",
684
+ "type": "jsonb",
685
+ "primaryKey": false,
686
+ "notNull": true
687
+ },
688
+ "quality_metrics": {
689
+ "name": "quality_metrics",
690
+ "type": "jsonb",
691
+ "primaryKey": false,
692
+ "notNull": true,
693
+ "default": "'{}'::jsonb"
694
+ },
695
+ "estimated_latency_ms": {
696
+ "name": "estimated_latency_ms",
697
+ "type": "integer",
698
+ "primaryKey": false,
699
+ "notNull": false
700
+ },
701
+ "estimated_cost_usd": {
702
+ "name": "estimated_cost_usd",
703
+ "type": "double precision",
704
+ "primaryKey": false,
705
+ "notNull": false
706
+ },
707
+ "max_input_bytes": {
708
+ "name": "max_input_bytes",
709
+ "type": "integer",
710
+ "primaryKey": false,
711
+ "notNull": false
712
+ },
713
+ "scope": {
714
+ "name": "scope",
715
+ "type": "text",
716
+ "primaryKey": false,
717
+ "notNull": true,
718
+ "default": "'internal'"
719
+ },
720
+ "enabled": {
721
+ "name": "enabled",
722
+ "type": "boolean",
723
+ "primaryKey": false,
724
+ "notNull": true,
725
+ "default": true
726
+ },
727
+ "accept_delegations": {
728
+ "name": "accept_delegations",
729
+ "type": "boolean",
730
+ "primaryKey": false,
731
+ "notNull": true,
732
+ "default": false
733
+ },
734
+ "inbound_rate_limit": {
735
+ "name": "inbound_rate_limit",
736
+ "type": "integer",
737
+ "primaryKey": false,
738
+ "notNull": true,
739
+ "default": 10
740
+ },
741
+ "outbound_rate_limit": {
742
+ "name": "outbound_rate_limit",
743
+ "type": "integer",
744
+ "primaryKey": false,
745
+ "notNull": true,
746
+ "default": 20
747
+ },
748
+ "created_at": {
749
+ "name": "created_at",
750
+ "type": "text",
751
+ "primaryKey": false,
752
+ "notNull": true
753
+ },
754
+ "updated_at": {
755
+ "name": "updated_at",
756
+ "type": "text",
757
+ "primaryKey": false,
758
+ "notNull": true
759
+ }
760
+ },
761
+ "indexes": {
762
+ "idx_capability_tenant_agent": {
763
+ "name": "idx_capability_tenant_agent",
764
+ "columns": [
765
+ {
766
+ "expression": "tenant_id",
767
+ "isExpression": false,
768
+ "asc": true,
769
+ "nulls": "last"
770
+ },
771
+ {
772
+ "expression": "agent_id",
773
+ "isExpression": false,
774
+ "asc": true,
775
+ "nulls": "last"
776
+ }
777
+ ],
778
+ "isUnique": false,
779
+ "concurrently": false,
780
+ "method": "btree",
781
+ "with": {}
782
+ },
783
+ "idx_capability_task_type": {
784
+ "name": "idx_capability_task_type",
785
+ "columns": [
786
+ {
787
+ "expression": "tenant_id",
788
+ "isExpression": false,
789
+ "asc": true,
790
+ "nulls": "last"
791
+ },
792
+ {
793
+ "expression": "task_type",
794
+ "isExpression": false,
795
+ "asc": true,
796
+ "nulls": "last"
797
+ }
798
+ ],
799
+ "isUnique": false,
800
+ "concurrently": false,
801
+ "method": "btree",
802
+ "with": {}
803
+ }
804
+ },
805
+ "foreignKeys": {},
806
+ "compositePrimaryKeys": {},
807
+ "uniqueConstraints": {},
808
+ "policies": {},
809
+ "checkConstraints": {},
810
+ "isRLSEnabled": false
811
+ },
812
+ "public.delegation_log": {
813
+ "name": "delegation_log",
814
+ "schema": "",
815
+ "columns": {
816
+ "id": {
817
+ "name": "id",
818
+ "type": "text",
819
+ "primaryKey": true,
820
+ "notNull": true
821
+ },
822
+ "tenant_id": {
823
+ "name": "tenant_id",
824
+ "type": "text",
825
+ "primaryKey": false,
826
+ "notNull": true
827
+ },
828
+ "direction": {
829
+ "name": "direction",
830
+ "type": "text",
831
+ "primaryKey": false,
832
+ "notNull": true
833
+ },
834
+ "agent_id": {
835
+ "name": "agent_id",
836
+ "type": "text",
837
+ "primaryKey": false,
838
+ "notNull": true
839
+ },
840
+ "anonymous_target_id": {
841
+ "name": "anonymous_target_id",
842
+ "type": "text",
843
+ "primaryKey": false,
844
+ "notNull": false
845
+ },
846
+ "anonymous_source_id": {
847
+ "name": "anonymous_source_id",
848
+ "type": "text",
849
+ "primaryKey": false,
850
+ "notNull": false
851
+ },
852
+ "task_type": {
853
+ "name": "task_type",
854
+ "type": "text",
855
+ "primaryKey": false,
856
+ "notNull": true
857
+ },
858
+ "status": {
859
+ "name": "status",
860
+ "type": "text",
861
+ "primaryKey": false,
862
+ "notNull": true
863
+ },
864
+ "request_size_bytes": {
865
+ "name": "request_size_bytes",
866
+ "type": "integer",
867
+ "primaryKey": false,
868
+ "notNull": false
869
+ },
870
+ "response_size_bytes": {
871
+ "name": "response_size_bytes",
872
+ "type": "integer",
873
+ "primaryKey": false,
874
+ "notNull": false
875
+ },
876
+ "execution_time_ms": {
877
+ "name": "execution_time_ms",
878
+ "type": "integer",
879
+ "primaryKey": false,
880
+ "notNull": false
881
+ },
882
+ "cost_usd": {
883
+ "name": "cost_usd",
884
+ "type": "double precision",
885
+ "primaryKey": false,
886
+ "notNull": false
887
+ },
888
+ "created_at": {
889
+ "name": "created_at",
890
+ "type": "text",
891
+ "primaryKey": false,
892
+ "notNull": true
893
+ },
894
+ "completed_at": {
895
+ "name": "completed_at",
896
+ "type": "text",
897
+ "primaryKey": false,
898
+ "notNull": false
899
+ }
900
+ },
901
+ "indexes": {
902
+ "idx_delegation_tenant_ts": {
903
+ "name": "idx_delegation_tenant_ts",
904
+ "columns": [
905
+ {
906
+ "expression": "tenant_id",
907
+ "isExpression": false,
908
+ "asc": true,
909
+ "nulls": "last"
910
+ },
911
+ {
912
+ "expression": "created_at",
913
+ "isExpression": false,
914
+ "asc": true,
915
+ "nulls": "last"
916
+ }
917
+ ],
918
+ "isUnique": false,
919
+ "concurrently": false,
920
+ "method": "btree",
921
+ "with": {}
922
+ },
923
+ "idx_delegation_agent": {
924
+ "name": "idx_delegation_agent",
925
+ "columns": [
926
+ {
927
+ "expression": "tenant_id",
928
+ "isExpression": false,
929
+ "asc": true,
930
+ "nulls": "last"
931
+ },
932
+ {
933
+ "expression": "agent_id",
934
+ "isExpression": false,
935
+ "asc": true,
936
+ "nulls": "last"
937
+ }
938
+ ],
939
+ "isUnique": false,
940
+ "concurrently": false,
941
+ "method": "btree",
942
+ "with": {}
943
+ },
944
+ "idx_delegation_status": {
945
+ "name": "idx_delegation_status",
946
+ "columns": [
947
+ {
948
+ "expression": "tenant_id",
949
+ "isExpression": false,
950
+ "asc": true,
951
+ "nulls": "last"
952
+ },
953
+ {
954
+ "expression": "status",
955
+ "isExpression": false,
956
+ "asc": true,
957
+ "nulls": "last"
958
+ }
959
+ ],
960
+ "isUnique": false,
961
+ "concurrently": false,
962
+ "method": "btree",
963
+ "with": {}
964
+ }
965
+ },
966
+ "foreignKeys": {},
967
+ "compositePrimaryKeys": {},
968
+ "uniqueConstraints": {},
969
+ "policies": {},
970
+ "checkConstraints": {},
971
+ "isRLSEnabled": false
972
+ },
973
+ "public.deny_list_rules": {
974
+ "name": "deny_list_rules",
975
+ "schema": "",
976
+ "columns": {
977
+ "id": {
978
+ "name": "id",
979
+ "type": "text",
980
+ "primaryKey": true,
981
+ "notNull": true
982
+ },
983
+ "tenant_id": {
984
+ "name": "tenant_id",
985
+ "type": "text",
986
+ "primaryKey": false,
987
+ "notNull": true
988
+ },
989
+ "pattern": {
990
+ "name": "pattern",
991
+ "type": "text",
992
+ "primaryKey": false,
993
+ "notNull": true
994
+ },
995
+ "is_regex": {
996
+ "name": "is_regex",
997
+ "type": "boolean",
998
+ "primaryKey": false,
999
+ "notNull": true,
1000
+ "default": false
1001
+ },
1002
+ "reason": {
1003
+ "name": "reason",
1004
+ "type": "text",
1005
+ "primaryKey": false,
1006
+ "notNull": true
1007
+ },
1008
+ "created_at": {
1009
+ "name": "created_at",
1010
+ "type": "text",
1011
+ "primaryKey": false,
1012
+ "notNull": true
1013
+ }
1014
+ },
1015
+ "indexes": {
1016
+ "idx_deny_list_rules_tenant": {
1017
+ "name": "idx_deny_list_rules_tenant",
1018
+ "columns": [
1019
+ {
1020
+ "expression": "tenant_id",
1021
+ "isExpression": false,
1022
+ "asc": true,
1023
+ "nulls": "last"
1024
+ }
1025
+ ],
1026
+ "isUnique": false,
1027
+ "concurrently": false,
1028
+ "method": "btree",
1029
+ "with": {}
1030
+ }
1031
+ },
1032
+ "foreignKeys": {},
1033
+ "compositePrimaryKeys": {},
1034
+ "uniqueConstraints": {},
1035
+ "policies": {},
1036
+ "checkConstraints": {},
1037
+ "isRLSEnabled": false
1038
+ },
1039
+ "public.discovery_config": {
1040
+ "name": "discovery_config",
1041
+ "schema": "",
1042
+ "columns": {
1043
+ "tenant_id": {
1044
+ "name": "tenant_id",
1045
+ "type": "text",
1046
+ "primaryKey": true,
1047
+ "notNull": true
1048
+ },
1049
+ "min_trust_threshold": {
1050
+ "name": "min_trust_threshold",
1051
+ "type": "integer",
1052
+ "primaryKey": false,
1053
+ "notNull": true,
1054
+ "default": 60
1055
+ },
1056
+ "delegation_enabled": {
1057
+ "name": "delegation_enabled",
1058
+ "type": "boolean",
1059
+ "primaryKey": false,
1060
+ "notNull": true,
1061
+ "default": false
1062
+ },
1063
+ "updated_at": {
1064
+ "name": "updated_at",
1065
+ "type": "text",
1066
+ "primaryKey": false,
1067
+ "notNull": true
1068
+ }
1069
+ },
1070
+ "indexes": {},
1071
+ "foreignKeys": {},
1072
+ "compositePrimaryKeys": {},
1073
+ "uniqueConstraints": {},
1074
+ "policies": {},
1075
+ "checkConstraints": {},
1076
+ "isRLSEnabled": false
1077
+ },
1078
+ "public.embeddings": {
1079
+ "name": "embeddings",
1080
+ "schema": "",
1081
+ "columns": {
1082
+ "id": {
1083
+ "name": "id",
1084
+ "type": "text",
1085
+ "primaryKey": true,
1086
+ "notNull": true
1087
+ },
1088
+ "tenant_id": {
1089
+ "name": "tenant_id",
1090
+ "type": "text",
1091
+ "primaryKey": false,
1092
+ "notNull": true
1093
+ },
1094
+ "source_type": {
1095
+ "name": "source_type",
1096
+ "type": "text",
1097
+ "primaryKey": false,
1098
+ "notNull": true
1099
+ },
1100
+ "source_id": {
1101
+ "name": "source_id",
1102
+ "type": "text",
1103
+ "primaryKey": false,
1104
+ "notNull": true
1105
+ },
1106
+ "content_hash": {
1107
+ "name": "content_hash",
1108
+ "type": "text",
1109
+ "primaryKey": false,
1110
+ "notNull": true
1111
+ },
1112
+ "text_content": {
1113
+ "name": "text_content",
1114
+ "type": "text",
1115
+ "primaryKey": false,
1116
+ "notNull": true
1117
+ },
1118
+ "embedding": {
1119
+ "name": "embedding",
1120
+ "type": "bytea",
1121
+ "primaryKey": false,
1122
+ "notNull": true
1123
+ },
1124
+ "embedding_model": {
1125
+ "name": "embedding_model",
1126
+ "type": "text",
1127
+ "primaryKey": false,
1128
+ "notNull": true
1129
+ },
1130
+ "dimensions": {
1131
+ "name": "dimensions",
1132
+ "type": "integer",
1133
+ "primaryKey": false,
1134
+ "notNull": true
1135
+ },
1136
+ "created_at": {
1137
+ "name": "created_at",
1138
+ "type": "text",
1139
+ "primaryKey": false,
1140
+ "notNull": true
1141
+ }
1142
+ },
1143
+ "indexes": {
1144
+ "idx_embeddings_tenant": {
1145
+ "name": "idx_embeddings_tenant",
1146
+ "columns": [
1147
+ {
1148
+ "expression": "tenant_id",
1149
+ "isExpression": false,
1150
+ "asc": true,
1151
+ "nulls": "last"
1152
+ }
1153
+ ],
1154
+ "isUnique": false,
1155
+ "concurrently": false,
1156
+ "method": "btree",
1157
+ "with": {}
1158
+ },
1159
+ "idx_embeddings_source": {
1160
+ "name": "idx_embeddings_source",
1161
+ "columns": [
1162
+ {
1163
+ "expression": "source_type",
1164
+ "isExpression": false,
1165
+ "asc": true,
1166
+ "nulls": "last"
1167
+ },
1168
+ {
1169
+ "expression": "source_id",
1170
+ "isExpression": false,
1171
+ "asc": true,
1172
+ "nulls": "last"
1173
+ }
1174
+ ],
1175
+ "isUnique": false,
1176
+ "concurrently": false,
1177
+ "method": "btree",
1178
+ "with": {}
1179
+ },
1180
+ "idx_embeddings_content_hash": {
1181
+ "name": "idx_embeddings_content_hash",
1182
+ "columns": [
1183
+ {
1184
+ "expression": "tenant_id",
1185
+ "isExpression": false,
1186
+ "asc": true,
1187
+ "nulls": "last"
1188
+ },
1189
+ {
1190
+ "expression": "content_hash",
1191
+ "isExpression": false,
1192
+ "asc": true,
1193
+ "nulls": "last"
1194
+ }
1195
+ ],
1196
+ "isUnique": false,
1197
+ "concurrently": false,
1198
+ "method": "btree",
1199
+ "with": {}
1200
+ },
1201
+ "idx_embeddings_tenant_source_time": {
1202
+ "name": "idx_embeddings_tenant_source_time",
1203
+ "columns": [
1204
+ {
1205
+ "expression": "tenant_id",
1206
+ "isExpression": false,
1207
+ "asc": true,
1208
+ "nulls": "last"
1209
+ },
1210
+ {
1211
+ "expression": "source_type",
1212
+ "isExpression": false,
1213
+ "asc": true,
1214
+ "nulls": "last"
1215
+ },
1216
+ {
1217
+ "expression": "created_at",
1218
+ "isExpression": false,
1219
+ "asc": true,
1220
+ "nulls": "last"
1221
+ }
1222
+ ],
1223
+ "isUnique": false,
1224
+ "concurrently": false,
1225
+ "method": "btree",
1226
+ "with": {}
1227
+ }
1228
+ },
1229
+ "foreignKeys": {},
1230
+ "compositePrimaryKeys": {},
1231
+ "uniqueConstraints": {},
1232
+ "policies": {},
1233
+ "checkConstraints": {},
1234
+ "isRLSEnabled": false
1235
+ },
1236
+ "public.events": {
1237
+ "name": "events",
1238
+ "schema": "",
1239
+ "columns": {
1240
+ "id": {
1241
+ "name": "id",
1242
+ "type": "text",
1243
+ "primaryKey": true,
1244
+ "notNull": true
1245
+ },
1246
+ "timestamp": {
1247
+ "name": "timestamp",
1248
+ "type": "text",
1249
+ "primaryKey": false,
1250
+ "notNull": true
1251
+ },
1252
+ "session_id": {
1253
+ "name": "session_id",
1254
+ "type": "text",
1255
+ "primaryKey": false,
1256
+ "notNull": true
1257
+ },
1258
+ "agent_id": {
1259
+ "name": "agent_id",
1260
+ "type": "text",
1261
+ "primaryKey": false,
1262
+ "notNull": true
1263
+ },
1264
+ "event_type": {
1265
+ "name": "event_type",
1266
+ "type": "text",
1267
+ "primaryKey": false,
1268
+ "notNull": true
1269
+ },
1270
+ "severity": {
1271
+ "name": "severity",
1272
+ "type": "text",
1273
+ "primaryKey": false,
1274
+ "notNull": true,
1275
+ "default": "'info'"
1276
+ },
1277
+ "payload": {
1278
+ "name": "payload",
1279
+ "type": "jsonb",
1280
+ "primaryKey": false,
1281
+ "notNull": true
1282
+ },
1283
+ "metadata": {
1284
+ "name": "metadata",
1285
+ "type": "jsonb",
1286
+ "primaryKey": false,
1287
+ "notNull": true,
1288
+ "default": "'{}'::jsonb"
1289
+ },
1290
+ "prev_hash": {
1291
+ "name": "prev_hash",
1292
+ "type": "text",
1293
+ "primaryKey": false,
1294
+ "notNull": false
1295
+ },
1296
+ "hash": {
1297
+ "name": "hash",
1298
+ "type": "text",
1299
+ "primaryKey": false,
1300
+ "notNull": true
1301
+ },
1302
+ "tenant_id": {
1303
+ "name": "tenant_id",
1304
+ "type": "text",
1305
+ "primaryKey": false,
1306
+ "notNull": true,
1307
+ "default": "'default'"
1308
+ }
1309
+ },
1310
+ "indexes": {
1311
+ "idx_events_timestamp": {
1312
+ "name": "idx_events_timestamp",
1313
+ "columns": [
1314
+ {
1315
+ "expression": "timestamp",
1316
+ "isExpression": false,
1317
+ "asc": true,
1318
+ "nulls": "last"
1319
+ }
1320
+ ],
1321
+ "isUnique": false,
1322
+ "concurrently": false,
1323
+ "method": "btree",
1324
+ "with": {}
1325
+ },
1326
+ "idx_events_session_id": {
1327
+ "name": "idx_events_session_id",
1328
+ "columns": [
1329
+ {
1330
+ "expression": "session_id",
1331
+ "isExpression": false,
1332
+ "asc": true,
1333
+ "nulls": "last"
1334
+ }
1335
+ ],
1336
+ "isUnique": false,
1337
+ "concurrently": false,
1338
+ "method": "btree",
1339
+ "with": {}
1340
+ },
1341
+ "idx_events_agent_id": {
1342
+ "name": "idx_events_agent_id",
1343
+ "columns": [
1344
+ {
1345
+ "expression": "agent_id",
1346
+ "isExpression": false,
1347
+ "asc": true,
1348
+ "nulls": "last"
1349
+ }
1350
+ ],
1351
+ "isUnique": false,
1352
+ "concurrently": false,
1353
+ "method": "btree",
1354
+ "with": {}
1355
+ },
1356
+ "idx_events_type": {
1357
+ "name": "idx_events_type",
1358
+ "columns": [
1359
+ {
1360
+ "expression": "event_type",
1361
+ "isExpression": false,
1362
+ "asc": true,
1363
+ "nulls": "last"
1364
+ }
1365
+ ],
1366
+ "isUnique": false,
1367
+ "concurrently": false,
1368
+ "method": "btree",
1369
+ "with": {}
1370
+ },
1371
+ "idx_events_session_ts": {
1372
+ "name": "idx_events_session_ts",
1373
+ "columns": [
1374
+ {
1375
+ "expression": "session_id",
1376
+ "isExpression": false,
1377
+ "asc": true,
1378
+ "nulls": "last"
1379
+ },
1380
+ {
1381
+ "expression": "timestamp",
1382
+ "isExpression": false,
1383
+ "asc": true,
1384
+ "nulls": "last"
1385
+ }
1386
+ ],
1387
+ "isUnique": false,
1388
+ "concurrently": false,
1389
+ "method": "btree",
1390
+ "with": {}
1391
+ },
1392
+ "idx_events_agent_type_ts": {
1393
+ "name": "idx_events_agent_type_ts",
1394
+ "columns": [
1395
+ {
1396
+ "expression": "agent_id",
1397
+ "isExpression": false,
1398
+ "asc": true,
1399
+ "nulls": "last"
1400
+ },
1401
+ {
1402
+ "expression": "event_type",
1403
+ "isExpression": false,
1404
+ "asc": true,
1405
+ "nulls": "last"
1406
+ },
1407
+ {
1408
+ "expression": "timestamp",
1409
+ "isExpression": false,
1410
+ "asc": true,
1411
+ "nulls": "last"
1412
+ }
1413
+ ],
1414
+ "isUnique": false,
1415
+ "concurrently": false,
1416
+ "method": "btree",
1417
+ "with": {}
1418
+ },
1419
+ "idx_events_tenant_id": {
1420
+ "name": "idx_events_tenant_id",
1421
+ "columns": [
1422
+ {
1423
+ "expression": "tenant_id",
1424
+ "isExpression": false,
1425
+ "asc": true,
1426
+ "nulls": "last"
1427
+ }
1428
+ ],
1429
+ "isUnique": false,
1430
+ "concurrently": false,
1431
+ "method": "btree",
1432
+ "with": {}
1433
+ },
1434
+ "idx_events_tenant_session": {
1435
+ "name": "idx_events_tenant_session",
1436
+ "columns": [
1437
+ {
1438
+ "expression": "tenant_id",
1439
+ "isExpression": false,
1440
+ "asc": true,
1441
+ "nulls": "last"
1442
+ },
1443
+ {
1444
+ "expression": "session_id",
1445
+ "isExpression": false,
1446
+ "asc": true,
1447
+ "nulls": "last"
1448
+ }
1449
+ ],
1450
+ "isUnique": false,
1451
+ "concurrently": false,
1452
+ "method": "btree",
1453
+ "with": {}
1454
+ },
1455
+ "idx_events_tenant_agent_ts": {
1456
+ "name": "idx_events_tenant_agent_ts",
1457
+ "columns": [
1458
+ {
1459
+ "expression": "tenant_id",
1460
+ "isExpression": false,
1461
+ "asc": true,
1462
+ "nulls": "last"
1463
+ },
1464
+ {
1465
+ "expression": "agent_id",
1466
+ "isExpression": false,
1467
+ "asc": true,
1468
+ "nulls": "last"
1469
+ },
1470
+ {
1471
+ "expression": "timestamp",
1472
+ "isExpression": false,
1473
+ "asc": true,
1474
+ "nulls": "last"
1475
+ }
1476
+ ],
1477
+ "isUnique": false,
1478
+ "concurrently": false,
1479
+ "method": "btree",
1480
+ "with": {}
1481
+ }
1482
+ },
1483
+ "foreignKeys": {},
1484
+ "compositePrimaryKeys": {},
1485
+ "uniqueConstraints": {},
1486
+ "policies": {},
1487
+ "checkConstraints": {},
1488
+ "isRLSEnabled": false
1489
+ },
1490
+ "public.lessons": {
1491
+ "name": "lessons",
1492
+ "schema": "",
1493
+ "columns": {
1494
+ "id": {
1495
+ "name": "id",
1496
+ "type": "text",
1497
+ "primaryKey": false,
1498
+ "notNull": true
1499
+ },
1500
+ "tenant_id": {
1501
+ "name": "tenant_id",
1502
+ "type": "text",
1503
+ "primaryKey": false,
1504
+ "notNull": true
1505
+ },
1506
+ "agent_id": {
1507
+ "name": "agent_id",
1508
+ "type": "text",
1509
+ "primaryKey": false,
1510
+ "notNull": false
1511
+ },
1512
+ "category": {
1513
+ "name": "category",
1514
+ "type": "text",
1515
+ "primaryKey": false,
1516
+ "notNull": true,
1517
+ "default": "'general'"
1518
+ },
1519
+ "title": {
1520
+ "name": "title",
1521
+ "type": "text",
1522
+ "primaryKey": false,
1523
+ "notNull": true
1524
+ },
1525
+ "content": {
1526
+ "name": "content",
1527
+ "type": "text",
1528
+ "primaryKey": false,
1529
+ "notNull": true
1530
+ },
1531
+ "context": {
1532
+ "name": "context",
1533
+ "type": "jsonb",
1534
+ "primaryKey": false,
1535
+ "notNull": true,
1536
+ "default": "'{}'::jsonb"
1537
+ },
1538
+ "importance": {
1539
+ "name": "importance",
1540
+ "type": "text",
1541
+ "primaryKey": false,
1542
+ "notNull": true,
1543
+ "default": "'normal'"
1544
+ },
1545
+ "source_session_id": {
1546
+ "name": "source_session_id",
1547
+ "type": "text",
1548
+ "primaryKey": false,
1549
+ "notNull": false
1550
+ },
1551
+ "source_event_id": {
1552
+ "name": "source_event_id",
1553
+ "type": "text",
1554
+ "primaryKey": false,
1555
+ "notNull": false
1556
+ },
1557
+ "access_count": {
1558
+ "name": "access_count",
1559
+ "type": "integer",
1560
+ "primaryKey": false,
1561
+ "notNull": true,
1562
+ "default": 0
1563
+ },
1564
+ "last_accessed_at": {
1565
+ "name": "last_accessed_at",
1566
+ "type": "text",
1567
+ "primaryKey": false,
1568
+ "notNull": false
1569
+ },
1570
+ "created_at": {
1571
+ "name": "created_at",
1572
+ "type": "text",
1573
+ "primaryKey": false,
1574
+ "notNull": true
1575
+ },
1576
+ "updated_at": {
1577
+ "name": "updated_at",
1578
+ "type": "text",
1579
+ "primaryKey": false,
1580
+ "notNull": true
1581
+ },
1582
+ "archived_at": {
1583
+ "name": "archived_at",
1584
+ "type": "text",
1585
+ "primaryKey": false,
1586
+ "notNull": false
1587
+ }
1588
+ },
1589
+ "indexes": {
1590
+ "idx_lessons_tenant": {
1591
+ "name": "idx_lessons_tenant",
1592
+ "columns": [
1593
+ {
1594
+ "expression": "tenant_id",
1595
+ "isExpression": false,
1596
+ "asc": true,
1597
+ "nulls": "last"
1598
+ }
1599
+ ],
1600
+ "isUnique": false,
1601
+ "concurrently": false,
1602
+ "method": "btree",
1603
+ "with": {}
1604
+ },
1605
+ "idx_lessons_tenant_agent": {
1606
+ "name": "idx_lessons_tenant_agent",
1607
+ "columns": [
1608
+ {
1609
+ "expression": "tenant_id",
1610
+ "isExpression": false,
1611
+ "asc": true,
1612
+ "nulls": "last"
1613
+ },
1614
+ {
1615
+ "expression": "agent_id",
1616
+ "isExpression": false,
1617
+ "asc": true,
1618
+ "nulls": "last"
1619
+ }
1620
+ ],
1621
+ "isUnique": false,
1622
+ "concurrently": false,
1623
+ "method": "btree",
1624
+ "with": {}
1625
+ },
1626
+ "idx_lessons_tenant_category": {
1627
+ "name": "idx_lessons_tenant_category",
1628
+ "columns": [
1629
+ {
1630
+ "expression": "tenant_id",
1631
+ "isExpression": false,
1632
+ "asc": true,
1633
+ "nulls": "last"
1634
+ },
1635
+ {
1636
+ "expression": "category",
1637
+ "isExpression": false,
1638
+ "asc": true,
1639
+ "nulls": "last"
1640
+ }
1641
+ ],
1642
+ "isUnique": false,
1643
+ "concurrently": false,
1644
+ "method": "btree",
1645
+ "with": {}
1646
+ },
1647
+ "idx_lessons_tenant_importance": {
1648
+ "name": "idx_lessons_tenant_importance",
1649
+ "columns": [
1650
+ {
1651
+ "expression": "tenant_id",
1652
+ "isExpression": false,
1653
+ "asc": true,
1654
+ "nulls": "last"
1655
+ },
1656
+ {
1657
+ "expression": "importance",
1658
+ "isExpression": false,
1659
+ "asc": true,
1660
+ "nulls": "last"
1661
+ }
1662
+ ],
1663
+ "isUnique": false,
1664
+ "concurrently": false,
1665
+ "method": "btree",
1666
+ "with": {}
1667
+ }
1668
+ },
1669
+ "foreignKeys": {},
1670
+ "compositePrimaryKeys": {
1671
+ "lessons_id_tenant_id_pk": {
1672
+ "name": "lessons_id_tenant_id_pk",
1673
+ "columns": [
1674
+ "id",
1675
+ "tenant_id"
1676
+ ]
1677
+ }
1678
+ },
1679
+ "uniqueConstraints": {},
1680
+ "policies": {},
1681
+ "checkConstraints": {},
1682
+ "isRLSEnabled": false
1683
+ },
1684
+ "public.refresh_tokens": {
1685
+ "name": "refresh_tokens",
1686
+ "schema": "",
1687
+ "columns": {
1688
+ "id": {
1689
+ "name": "id",
1690
+ "type": "text",
1691
+ "primaryKey": true,
1692
+ "notNull": true
1693
+ },
1694
+ "user_id": {
1695
+ "name": "user_id",
1696
+ "type": "text",
1697
+ "primaryKey": false,
1698
+ "notNull": true
1699
+ },
1700
+ "tenant_id": {
1701
+ "name": "tenant_id",
1702
+ "type": "text",
1703
+ "primaryKey": false,
1704
+ "notNull": true,
1705
+ "default": "'default'"
1706
+ },
1707
+ "token_hash": {
1708
+ "name": "token_hash",
1709
+ "type": "text",
1710
+ "primaryKey": false,
1711
+ "notNull": true
1712
+ },
1713
+ "expires_at": {
1714
+ "name": "expires_at",
1715
+ "type": "integer",
1716
+ "primaryKey": false,
1717
+ "notNull": true
1718
+ },
1719
+ "created_at": {
1720
+ "name": "created_at",
1721
+ "type": "integer",
1722
+ "primaryKey": false,
1723
+ "notNull": true
1724
+ },
1725
+ "revoked_at": {
1726
+ "name": "revoked_at",
1727
+ "type": "integer",
1728
+ "primaryKey": false,
1729
+ "notNull": false
1730
+ },
1731
+ "user_agent": {
1732
+ "name": "user_agent",
1733
+ "type": "text",
1734
+ "primaryKey": false,
1735
+ "notNull": false
1736
+ },
1737
+ "ip_address": {
1738
+ "name": "ip_address",
1739
+ "type": "text",
1740
+ "primaryKey": false,
1741
+ "notNull": false
1742
+ }
1743
+ },
1744
+ "indexes": {
1745
+ "idx_refresh_tokens_user": {
1746
+ "name": "idx_refresh_tokens_user",
1747
+ "columns": [
1748
+ {
1749
+ "expression": "user_id",
1750
+ "isExpression": false,
1751
+ "asc": true,
1752
+ "nulls": "last"
1753
+ }
1754
+ ],
1755
+ "isUnique": false,
1756
+ "concurrently": false,
1757
+ "method": "btree",
1758
+ "with": {}
1759
+ },
1760
+ "idx_refresh_tokens_hash": {
1761
+ "name": "idx_refresh_tokens_hash",
1762
+ "columns": [
1763
+ {
1764
+ "expression": "token_hash",
1765
+ "isExpression": false,
1766
+ "asc": true,
1767
+ "nulls": "last"
1768
+ }
1769
+ ],
1770
+ "isUnique": false,
1771
+ "concurrently": false,
1772
+ "method": "btree",
1773
+ "with": {}
1774
+ }
1775
+ },
1776
+ "foreignKeys": {
1777
+ "refresh_tokens_user_id_users_id_fk": {
1778
+ "name": "refresh_tokens_user_id_users_id_fk",
1779
+ "tableFrom": "refresh_tokens",
1780
+ "tableTo": "users",
1781
+ "columnsFrom": [
1782
+ "user_id"
1783
+ ],
1784
+ "columnsTo": [
1785
+ "id"
1786
+ ],
1787
+ "onDelete": "no action",
1788
+ "onUpdate": "no action"
1789
+ }
1790
+ },
1791
+ "compositePrimaryKeys": {},
1792
+ "uniqueConstraints": {},
1793
+ "policies": {},
1794
+ "checkConstraints": {},
1795
+ "isRLSEnabled": false
1796
+ },
1797
+ "public.session_summaries": {
1798
+ "name": "session_summaries",
1799
+ "schema": "",
1800
+ "columns": {
1801
+ "session_id": {
1802
+ "name": "session_id",
1803
+ "type": "text",
1804
+ "primaryKey": false,
1805
+ "notNull": true
1806
+ },
1807
+ "tenant_id": {
1808
+ "name": "tenant_id",
1809
+ "type": "text",
1810
+ "primaryKey": false,
1811
+ "notNull": true
1812
+ },
1813
+ "summary": {
1814
+ "name": "summary",
1815
+ "type": "text",
1816
+ "primaryKey": false,
1817
+ "notNull": true
1818
+ },
1819
+ "topics": {
1820
+ "name": "topics",
1821
+ "type": "jsonb",
1822
+ "primaryKey": false,
1823
+ "notNull": true,
1824
+ "default": "'[]'::jsonb"
1825
+ },
1826
+ "tool_sequence": {
1827
+ "name": "tool_sequence",
1828
+ "type": "jsonb",
1829
+ "primaryKey": false,
1830
+ "notNull": true,
1831
+ "default": "'[]'::jsonb"
1832
+ },
1833
+ "error_summary": {
1834
+ "name": "error_summary",
1835
+ "type": "text",
1836
+ "primaryKey": false,
1837
+ "notNull": false
1838
+ },
1839
+ "outcome": {
1840
+ "name": "outcome",
1841
+ "type": "text",
1842
+ "primaryKey": false,
1843
+ "notNull": false
1844
+ },
1845
+ "created_at": {
1846
+ "name": "created_at",
1847
+ "type": "text",
1848
+ "primaryKey": false,
1849
+ "notNull": true
1850
+ },
1851
+ "updated_at": {
1852
+ "name": "updated_at",
1853
+ "type": "text",
1854
+ "primaryKey": false,
1855
+ "notNull": true
1856
+ }
1857
+ },
1858
+ "indexes": {
1859
+ "idx_session_summaries_tenant": {
1860
+ "name": "idx_session_summaries_tenant",
1861
+ "columns": [
1862
+ {
1863
+ "expression": "tenant_id",
1864
+ "isExpression": false,
1865
+ "asc": true,
1866
+ "nulls": "last"
1867
+ }
1868
+ ],
1869
+ "isUnique": false,
1870
+ "concurrently": false,
1871
+ "method": "btree",
1872
+ "with": {}
1873
+ }
1874
+ },
1875
+ "foreignKeys": {},
1876
+ "compositePrimaryKeys": {
1877
+ "session_summaries_session_id_tenant_id_pk": {
1878
+ "name": "session_summaries_session_id_tenant_id_pk",
1879
+ "columns": [
1880
+ "session_id",
1881
+ "tenant_id"
1882
+ ]
1883
+ }
1884
+ },
1885
+ "uniqueConstraints": {},
1886
+ "policies": {},
1887
+ "checkConstraints": {},
1888
+ "isRLSEnabled": false
1889
+ },
1890
+ "public.sessions": {
1891
+ "name": "sessions",
1892
+ "schema": "",
1893
+ "columns": {
1894
+ "id": {
1895
+ "name": "id",
1896
+ "type": "text",
1897
+ "primaryKey": false,
1898
+ "notNull": true
1899
+ },
1900
+ "agent_id": {
1901
+ "name": "agent_id",
1902
+ "type": "text",
1903
+ "primaryKey": false,
1904
+ "notNull": true
1905
+ },
1906
+ "agent_name": {
1907
+ "name": "agent_name",
1908
+ "type": "text",
1909
+ "primaryKey": false,
1910
+ "notNull": false
1911
+ },
1912
+ "started_at": {
1913
+ "name": "started_at",
1914
+ "type": "text",
1915
+ "primaryKey": false,
1916
+ "notNull": true
1917
+ },
1918
+ "ended_at": {
1919
+ "name": "ended_at",
1920
+ "type": "text",
1921
+ "primaryKey": false,
1922
+ "notNull": false
1923
+ },
1924
+ "status": {
1925
+ "name": "status",
1926
+ "type": "text",
1927
+ "primaryKey": false,
1928
+ "notNull": true,
1929
+ "default": "'active'"
1930
+ },
1931
+ "event_count": {
1932
+ "name": "event_count",
1933
+ "type": "integer",
1934
+ "primaryKey": false,
1935
+ "notNull": true,
1936
+ "default": 0
1937
+ },
1938
+ "tool_call_count": {
1939
+ "name": "tool_call_count",
1940
+ "type": "integer",
1941
+ "primaryKey": false,
1942
+ "notNull": true,
1943
+ "default": 0
1944
+ },
1945
+ "error_count": {
1946
+ "name": "error_count",
1947
+ "type": "integer",
1948
+ "primaryKey": false,
1949
+ "notNull": true,
1950
+ "default": 0
1951
+ },
1952
+ "total_cost_usd": {
1953
+ "name": "total_cost_usd",
1954
+ "type": "double precision",
1955
+ "primaryKey": false,
1956
+ "notNull": true,
1957
+ "default": 0
1958
+ },
1959
+ "llm_call_count": {
1960
+ "name": "llm_call_count",
1961
+ "type": "integer",
1962
+ "primaryKey": false,
1963
+ "notNull": true,
1964
+ "default": 0
1965
+ },
1966
+ "total_input_tokens": {
1967
+ "name": "total_input_tokens",
1968
+ "type": "integer",
1969
+ "primaryKey": false,
1970
+ "notNull": true,
1971
+ "default": 0
1972
+ },
1973
+ "total_output_tokens": {
1974
+ "name": "total_output_tokens",
1975
+ "type": "integer",
1976
+ "primaryKey": false,
1977
+ "notNull": true,
1978
+ "default": 0
1979
+ },
1980
+ "tags": {
1981
+ "name": "tags",
1982
+ "type": "jsonb",
1983
+ "primaryKey": false,
1984
+ "notNull": true,
1985
+ "default": "'[]'::jsonb"
1986
+ },
1987
+ "tenant_id": {
1988
+ "name": "tenant_id",
1989
+ "type": "text",
1990
+ "primaryKey": false,
1991
+ "notNull": true,
1992
+ "default": "'default'"
1993
+ }
1994
+ },
1995
+ "indexes": {
1996
+ "idx_sessions_agent_id": {
1997
+ "name": "idx_sessions_agent_id",
1998
+ "columns": [
1999
+ {
2000
+ "expression": "agent_id",
2001
+ "isExpression": false,
2002
+ "asc": true,
2003
+ "nulls": "last"
2004
+ }
2005
+ ],
2006
+ "isUnique": false,
2007
+ "concurrently": false,
2008
+ "method": "btree",
2009
+ "with": {}
2010
+ },
2011
+ "idx_sessions_started_at": {
2012
+ "name": "idx_sessions_started_at",
2013
+ "columns": [
2014
+ {
2015
+ "expression": "started_at",
2016
+ "isExpression": false,
2017
+ "asc": true,
2018
+ "nulls": "last"
2019
+ }
2020
+ ],
2021
+ "isUnique": false,
2022
+ "concurrently": false,
2023
+ "method": "btree",
2024
+ "with": {}
2025
+ },
2026
+ "idx_sessions_status": {
2027
+ "name": "idx_sessions_status",
2028
+ "columns": [
2029
+ {
2030
+ "expression": "status",
2031
+ "isExpression": false,
2032
+ "asc": true,
2033
+ "nulls": "last"
2034
+ }
2035
+ ],
2036
+ "isUnique": false,
2037
+ "concurrently": false,
2038
+ "method": "btree",
2039
+ "with": {}
2040
+ },
2041
+ "idx_sessions_tenant_id": {
2042
+ "name": "idx_sessions_tenant_id",
2043
+ "columns": [
2044
+ {
2045
+ "expression": "tenant_id",
2046
+ "isExpression": false,
2047
+ "asc": true,
2048
+ "nulls": "last"
2049
+ }
2050
+ ],
2051
+ "isUnique": false,
2052
+ "concurrently": false,
2053
+ "method": "btree",
2054
+ "with": {}
2055
+ },
2056
+ "idx_sessions_tenant_agent": {
2057
+ "name": "idx_sessions_tenant_agent",
2058
+ "columns": [
2059
+ {
2060
+ "expression": "tenant_id",
2061
+ "isExpression": false,
2062
+ "asc": true,
2063
+ "nulls": "last"
2064
+ },
2065
+ {
2066
+ "expression": "agent_id",
2067
+ "isExpression": false,
2068
+ "asc": true,
2069
+ "nulls": "last"
2070
+ }
2071
+ ],
2072
+ "isUnique": false,
2073
+ "concurrently": false,
2074
+ "method": "btree",
2075
+ "with": {}
2076
+ },
2077
+ "idx_sessions_tenant_started": {
2078
+ "name": "idx_sessions_tenant_started",
2079
+ "columns": [
2080
+ {
2081
+ "expression": "tenant_id",
2082
+ "isExpression": false,
2083
+ "asc": true,
2084
+ "nulls": "last"
2085
+ },
2086
+ {
2087
+ "expression": "started_at",
2088
+ "isExpression": false,
2089
+ "asc": true,
2090
+ "nulls": "last"
2091
+ }
2092
+ ],
2093
+ "isUnique": false,
2094
+ "concurrently": false,
2095
+ "method": "btree",
2096
+ "with": {}
2097
+ }
2098
+ },
2099
+ "foreignKeys": {},
2100
+ "compositePrimaryKeys": {
2101
+ "sessions_id_tenant_id_pk": {
2102
+ "name": "sessions_id_tenant_id_pk",
2103
+ "columns": [
2104
+ "id",
2105
+ "tenant_id"
2106
+ ]
2107
+ }
2108
+ },
2109
+ "uniqueConstraints": {},
2110
+ "policies": {},
2111
+ "checkConstraints": {},
2112
+ "isRLSEnabled": false
2113
+ },
2114
+ "public.sharing_audit_log": {
2115
+ "name": "sharing_audit_log",
2116
+ "schema": "",
2117
+ "columns": {
2118
+ "id": {
2119
+ "name": "id",
2120
+ "type": "text",
2121
+ "primaryKey": true,
2122
+ "notNull": true
2123
+ },
2124
+ "tenant_id": {
2125
+ "name": "tenant_id",
2126
+ "type": "text",
2127
+ "primaryKey": false,
2128
+ "notNull": true
2129
+ },
2130
+ "event_type": {
2131
+ "name": "event_type",
2132
+ "type": "text",
2133
+ "primaryKey": false,
2134
+ "notNull": true
2135
+ },
2136
+ "lesson_id": {
2137
+ "name": "lesson_id",
2138
+ "type": "text",
2139
+ "primaryKey": false,
2140
+ "notNull": false
2141
+ },
2142
+ "anonymous_lesson_id": {
2143
+ "name": "anonymous_lesson_id",
2144
+ "type": "text",
2145
+ "primaryKey": false,
2146
+ "notNull": false
2147
+ },
2148
+ "lesson_hash": {
2149
+ "name": "lesson_hash",
2150
+ "type": "text",
2151
+ "primaryKey": false,
2152
+ "notNull": false
2153
+ },
2154
+ "redaction_findings": {
2155
+ "name": "redaction_findings",
2156
+ "type": "text",
2157
+ "primaryKey": false,
2158
+ "notNull": false
2159
+ },
2160
+ "query_text": {
2161
+ "name": "query_text",
2162
+ "type": "text",
2163
+ "primaryKey": false,
2164
+ "notNull": false
2165
+ },
2166
+ "result_ids": {
2167
+ "name": "result_ids",
2168
+ "type": "text",
2169
+ "primaryKey": false,
2170
+ "notNull": false
2171
+ },
2172
+ "pool_endpoint": {
2173
+ "name": "pool_endpoint",
2174
+ "type": "text",
2175
+ "primaryKey": false,
2176
+ "notNull": false
2177
+ },
2178
+ "initiated_by": {
2179
+ "name": "initiated_by",
2180
+ "type": "text",
2181
+ "primaryKey": false,
2182
+ "notNull": false
2183
+ },
2184
+ "timestamp": {
2185
+ "name": "timestamp",
2186
+ "type": "text",
2187
+ "primaryKey": false,
2188
+ "notNull": true
2189
+ }
2190
+ },
2191
+ "indexes": {
2192
+ "idx_sharing_audit_tenant_ts": {
2193
+ "name": "idx_sharing_audit_tenant_ts",
2194
+ "columns": [
2195
+ {
2196
+ "expression": "tenant_id",
2197
+ "isExpression": false,
2198
+ "asc": true,
2199
+ "nulls": "last"
2200
+ },
2201
+ {
2202
+ "expression": "timestamp",
2203
+ "isExpression": false,
2204
+ "asc": true,
2205
+ "nulls": "last"
2206
+ }
2207
+ ],
2208
+ "isUnique": false,
2209
+ "concurrently": false,
2210
+ "method": "btree",
2211
+ "with": {}
2212
+ },
2213
+ "idx_sharing_audit_type": {
2214
+ "name": "idx_sharing_audit_type",
2215
+ "columns": [
2216
+ {
2217
+ "expression": "tenant_id",
2218
+ "isExpression": false,
2219
+ "asc": true,
2220
+ "nulls": "last"
2221
+ },
2222
+ {
2223
+ "expression": "event_type",
2224
+ "isExpression": false,
2225
+ "asc": true,
2226
+ "nulls": "last"
2227
+ }
2228
+ ],
2229
+ "isUnique": false,
2230
+ "concurrently": false,
2231
+ "method": "btree",
2232
+ "with": {}
2233
+ }
2234
+ },
2235
+ "foreignKeys": {},
2236
+ "compositePrimaryKeys": {},
2237
+ "uniqueConstraints": {},
2238
+ "policies": {},
2239
+ "checkConstraints": {},
2240
+ "isRLSEnabled": false
2241
+ },
2242
+ "public.sharing_config": {
2243
+ "name": "sharing_config",
2244
+ "schema": "",
2245
+ "columns": {
2246
+ "tenant_id": {
2247
+ "name": "tenant_id",
2248
+ "type": "text",
2249
+ "primaryKey": true,
2250
+ "notNull": true
2251
+ },
2252
+ "enabled": {
2253
+ "name": "enabled",
2254
+ "type": "boolean",
2255
+ "primaryKey": false,
2256
+ "notNull": true,
2257
+ "default": false
2258
+ },
2259
+ "human_review_enabled": {
2260
+ "name": "human_review_enabled",
2261
+ "type": "boolean",
2262
+ "primaryKey": false,
2263
+ "notNull": true,
2264
+ "default": false
2265
+ },
2266
+ "pool_endpoint": {
2267
+ "name": "pool_endpoint",
2268
+ "type": "text",
2269
+ "primaryKey": false,
2270
+ "notNull": false
2271
+ },
2272
+ "anonymous_contributor_id": {
2273
+ "name": "anonymous_contributor_id",
2274
+ "type": "text",
2275
+ "primaryKey": false,
2276
+ "notNull": false
2277
+ },
2278
+ "purge_token": {
2279
+ "name": "purge_token",
2280
+ "type": "text",
2281
+ "primaryKey": false,
2282
+ "notNull": false
2283
+ },
2284
+ "rate_limit_per_hour": {
2285
+ "name": "rate_limit_per_hour",
2286
+ "type": "integer",
2287
+ "primaryKey": false,
2288
+ "notNull": true,
2289
+ "default": 50
2290
+ },
2291
+ "volume_alert_threshold": {
2292
+ "name": "volume_alert_threshold",
2293
+ "type": "integer",
2294
+ "primaryKey": false,
2295
+ "notNull": true,
2296
+ "default": 100
2297
+ },
2298
+ "updated_at": {
2299
+ "name": "updated_at",
2300
+ "type": "text",
2301
+ "primaryKey": false,
2302
+ "notNull": true
2303
+ }
2304
+ },
2305
+ "indexes": {},
2306
+ "foreignKeys": {},
2307
+ "compositePrimaryKeys": {},
2308
+ "uniqueConstraints": {},
2309
+ "policies": {},
2310
+ "checkConstraints": {},
2311
+ "isRLSEnabled": false
2312
+ },
2313
+ "public.sharing_review_queue": {
2314
+ "name": "sharing_review_queue",
2315
+ "schema": "",
2316
+ "columns": {
2317
+ "id": {
2318
+ "name": "id",
2319
+ "type": "text",
2320
+ "primaryKey": true,
2321
+ "notNull": true
2322
+ },
2323
+ "tenant_id": {
2324
+ "name": "tenant_id",
2325
+ "type": "text",
2326
+ "primaryKey": false,
2327
+ "notNull": true
2328
+ },
2329
+ "lesson_id": {
2330
+ "name": "lesson_id",
2331
+ "type": "text",
2332
+ "primaryKey": false,
2333
+ "notNull": true
2334
+ },
2335
+ "original_title": {
2336
+ "name": "original_title",
2337
+ "type": "text",
2338
+ "primaryKey": false,
2339
+ "notNull": true
2340
+ },
2341
+ "original_content": {
2342
+ "name": "original_content",
2343
+ "type": "text",
2344
+ "primaryKey": false,
2345
+ "notNull": true
2346
+ },
2347
+ "redacted_title": {
2348
+ "name": "redacted_title",
2349
+ "type": "text",
2350
+ "primaryKey": false,
2351
+ "notNull": true
2352
+ },
2353
+ "redacted_content": {
2354
+ "name": "redacted_content",
2355
+ "type": "text",
2356
+ "primaryKey": false,
2357
+ "notNull": true
2358
+ },
2359
+ "redaction_findings": {
2360
+ "name": "redaction_findings",
2361
+ "type": "text",
2362
+ "primaryKey": false,
2363
+ "notNull": true
2364
+ },
2365
+ "status": {
2366
+ "name": "status",
2367
+ "type": "text",
2368
+ "primaryKey": false,
2369
+ "notNull": true,
2370
+ "default": "'pending'"
2371
+ },
2372
+ "reviewed_by": {
2373
+ "name": "reviewed_by",
2374
+ "type": "text",
2375
+ "primaryKey": false,
2376
+ "notNull": false
2377
+ },
2378
+ "reviewed_at": {
2379
+ "name": "reviewed_at",
2380
+ "type": "text",
2381
+ "primaryKey": false,
2382
+ "notNull": false
2383
+ },
2384
+ "created_at": {
2385
+ "name": "created_at",
2386
+ "type": "text",
2387
+ "primaryKey": false,
2388
+ "notNull": true
2389
+ },
2390
+ "expires_at": {
2391
+ "name": "expires_at",
2392
+ "type": "text",
2393
+ "primaryKey": false,
2394
+ "notNull": true
2395
+ }
2396
+ },
2397
+ "indexes": {
2398
+ "idx_review_queue_tenant_status": {
2399
+ "name": "idx_review_queue_tenant_status",
2400
+ "columns": [
2401
+ {
2402
+ "expression": "tenant_id",
2403
+ "isExpression": false,
2404
+ "asc": true,
2405
+ "nulls": "last"
2406
+ },
2407
+ {
2408
+ "expression": "status",
2409
+ "isExpression": false,
2410
+ "asc": true,
2411
+ "nulls": "last"
2412
+ }
2413
+ ],
2414
+ "isUnique": false,
2415
+ "concurrently": false,
2416
+ "method": "btree",
2417
+ "with": {}
2418
+ }
2419
+ },
2420
+ "foreignKeys": {},
2421
+ "compositePrimaryKeys": {},
2422
+ "uniqueConstraints": {},
2423
+ "policies": {},
2424
+ "checkConstraints": {},
2425
+ "isRLSEnabled": false
2426
+ },
2427
+ "public.users": {
2428
+ "name": "users",
2429
+ "schema": "",
2430
+ "columns": {
2431
+ "id": {
2432
+ "name": "id",
2433
+ "type": "text",
2434
+ "primaryKey": true,
2435
+ "notNull": true
2436
+ },
2437
+ "tenant_id": {
2438
+ "name": "tenant_id",
2439
+ "type": "text",
2440
+ "primaryKey": false,
2441
+ "notNull": true,
2442
+ "default": "'default'"
2443
+ },
2444
+ "email": {
2445
+ "name": "email",
2446
+ "type": "text",
2447
+ "primaryKey": false,
2448
+ "notNull": true
2449
+ },
2450
+ "display_name": {
2451
+ "name": "display_name",
2452
+ "type": "text",
2453
+ "primaryKey": false,
2454
+ "notNull": false
2455
+ },
2456
+ "oidc_subject": {
2457
+ "name": "oidc_subject",
2458
+ "type": "text",
2459
+ "primaryKey": false,
2460
+ "notNull": false
2461
+ },
2462
+ "oidc_issuer": {
2463
+ "name": "oidc_issuer",
2464
+ "type": "text",
2465
+ "primaryKey": false,
2466
+ "notNull": false
2467
+ },
2468
+ "role": {
2469
+ "name": "role",
2470
+ "type": "text",
2471
+ "primaryKey": false,
2472
+ "notNull": true,
2473
+ "default": "'viewer'"
2474
+ },
2475
+ "created_at": {
2476
+ "name": "created_at",
2477
+ "type": "integer",
2478
+ "primaryKey": false,
2479
+ "notNull": true
2480
+ },
2481
+ "updated_at": {
2482
+ "name": "updated_at",
2483
+ "type": "integer",
2484
+ "primaryKey": false,
2485
+ "notNull": true
2486
+ },
2487
+ "last_login_at": {
2488
+ "name": "last_login_at",
2489
+ "type": "integer",
2490
+ "primaryKey": false,
2491
+ "notNull": false
2492
+ },
2493
+ "disabled_at": {
2494
+ "name": "disabled_at",
2495
+ "type": "integer",
2496
+ "primaryKey": false,
2497
+ "notNull": false
2498
+ }
2499
+ },
2500
+ "indexes": {
2501
+ "idx_users_tenant": {
2502
+ "name": "idx_users_tenant",
2503
+ "columns": [
2504
+ {
2505
+ "expression": "tenant_id",
2506
+ "isExpression": false,
2507
+ "asc": true,
2508
+ "nulls": "last"
2509
+ }
2510
+ ],
2511
+ "isUnique": false,
2512
+ "concurrently": false,
2513
+ "method": "btree",
2514
+ "with": {}
2515
+ },
2516
+ "idx_users_email": {
2517
+ "name": "idx_users_email",
2518
+ "columns": [
2519
+ {
2520
+ "expression": "email",
2521
+ "isExpression": false,
2522
+ "asc": true,
2523
+ "nulls": "last"
2524
+ }
2525
+ ],
2526
+ "isUnique": false,
2527
+ "concurrently": false,
2528
+ "method": "btree",
2529
+ "with": {}
2530
+ },
2531
+ "idx_users_tenant_email": {
2532
+ "name": "idx_users_tenant_email",
2533
+ "columns": [
2534
+ {
2535
+ "expression": "tenant_id",
2536
+ "isExpression": false,
2537
+ "asc": true,
2538
+ "nulls": "last"
2539
+ },
2540
+ {
2541
+ "expression": "email",
2542
+ "isExpression": false,
2543
+ "asc": true,
2544
+ "nulls": "last"
2545
+ }
2546
+ ],
2547
+ "isUnique": true,
2548
+ "concurrently": false,
2549
+ "method": "btree",
2550
+ "with": {}
2551
+ },
2552
+ "idx_users_oidc": {
2553
+ "name": "idx_users_oidc",
2554
+ "columns": [
2555
+ {
2556
+ "expression": "oidc_issuer",
2557
+ "isExpression": false,
2558
+ "asc": true,
2559
+ "nulls": "last"
2560
+ },
2561
+ {
2562
+ "expression": "oidc_subject",
2563
+ "isExpression": false,
2564
+ "asc": true,
2565
+ "nulls": "last"
2566
+ }
2567
+ ],
2568
+ "isUnique": true,
2569
+ "concurrently": false,
2570
+ "method": "btree",
2571
+ "with": {}
2572
+ }
2573
+ },
2574
+ "foreignKeys": {},
2575
+ "compositePrimaryKeys": {},
2576
+ "uniqueConstraints": {},
2577
+ "policies": {},
2578
+ "checkConstraints": {},
2579
+ "isRLSEnabled": false
2580
+ }
2581
+ },
2582
+ "enums": {},
2583
+ "schemas": {},
2584
+ "sequences": {},
2585
+ "roles": {},
2586
+ "policies": {},
2587
+ "views": {},
2588
+ "_meta": {
2589
+ "columns": {},
2590
+ "schemas": {},
2591
+ "tables": {}
2592
+ }
2593
+ }