@marinoscar/kvox-eval 0.0.0-bootstrap → 0.1.0-next.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 (245) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +166 -0
  4. package/dist/ask/index.d.ts +6 -0
  5. package/dist/ask/index.js +28 -0
  6. package/dist/ask/question-schema.d.ts +121 -0
  7. package/dist/ask/question-schema.js +167 -0
  8. package/dist/ask/report.d.ts +88 -0
  9. package/dist/ask/report.js +170 -0
  10. package/dist/ask/scorer.d.ts +104 -0
  11. package/dist/ask/scorer.js +164 -0
  12. package/dist/ask-run/ask-command.d.ts +62 -0
  13. package/dist/ask-run/ask-command.js +254 -0
  14. package/dist/ask-run/host/app.d.ts +65 -0
  15. package/dist/ask-run/host/app.js +146 -0
  16. package/dist/ask-run/host/db.d.ts +38 -0
  17. package/dist/ask-run/host/db.js +126 -0
  18. package/dist/ask-run/host/ports.d.ts +35 -0
  19. package/dist/ask-run/host/ports.js +113 -0
  20. package/dist/ask-run/index.d.ts +13 -0
  21. package/dist/ask-run/index.js +35 -0
  22. package/dist/ask-run/replay.d.ts +128 -0
  23. package/dist/ask-run/replay.js +212 -0
  24. package/dist/ask-run/run-ask-eval.d.ts +125 -0
  25. package/dist/ask-run/run-ask-eval.js +193 -0
  26. package/dist/ask-run/seed-golden-graph.d.ts +64 -0
  27. package/dist/ask-run/seed-golden-graph.js +495 -0
  28. package/dist/cli/index.d.ts +3 -0
  29. package/dist/cli/index.js +12 -0
  30. package/dist/cli/kg-command.d.ts +66 -0
  31. package/dist/cli/kg-command.js +238 -0
  32. package/dist/cli/main.d.ts +18 -0
  33. package/dist/cli/main.js +69 -0
  34. package/dist/fixtures/domains.d.ts +16 -0
  35. package/dist/fixtures/domains.js +33 -0
  36. package/dist/fixtures/fixture-schema.d.ts +323 -0
  37. package/dist/fixtures/fixture-schema.js +199 -0
  38. package/dist/fixtures/index.d.ts +16 -0
  39. package/dist/fixtures/index.js +40 -0
  40. package/dist/fixtures/load.d.ts +73 -0
  41. package/dist/fixtures/load.js +137 -0
  42. package/dist/fixtures/questions.d.ts +15 -0
  43. package/dist/fixtures/questions.js +26 -0
  44. package/dist/index.d.ts +20 -0
  45. package/dist/index.js +36 -0
  46. package/dist/kg/gold-runner.d.ts +13 -0
  47. package/dist/kg/gold-runner.js +57 -0
  48. package/dist/kg/index.d.ts +17 -0
  49. package/dist/kg/index.js +65 -0
  50. package/dist/kg/internals.d.ts +7 -0
  51. package/dist/kg/internals.js +17 -0
  52. package/dist/kg/prediction-schema.d.ts +245 -0
  53. package/dist/kg/prediction-schema.js +102 -0
  54. package/dist/kg/predictions.d.ts +11 -0
  55. package/dist/kg/predictions.js +49 -0
  56. package/dist/kg/report.d.ts +84 -0
  57. package/dist/kg/report.js +125 -0
  58. package/dist/kg/run-kg-eval.d.ts +77 -0
  59. package/dist/kg/run-kg-eval.js +137 -0
  60. package/dist/kg/runner.d.ts +72 -0
  61. package/dist/kg/runner.js +51 -0
  62. package/dist/kg/runners/extract-resolve-runner.d.ts +40 -0
  63. package/dist/kg/runners/extract-resolve-runner.js +199 -0
  64. package/dist/kg/runners/extract-runner.d.ts +65 -0
  65. package/dist/kg/runners/extract-runner.js +243 -0
  66. package/dist/kg/scorer.d.ts +226 -0
  67. package/dist/kg/scorer.js +463 -0
  68. package/dist/kg/targets.d.ts +17 -0
  69. package/dist/kg/targets.js +16 -0
  70. package/dist/kg/text.d.ts +45 -0
  71. package/dist/kg/text.js +100 -0
  72. package/dist/live/adapters.d.ts +16 -0
  73. package/dist/live/adapters.js +58 -0
  74. package/dist/live/env.d.ts +39 -0
  75. package/dist/live/env.js +56 -0
  76. package/dist/live/index.d.ts +6 -0
  77. package/dist/live/index.js +16 -0
  78. package/dist/live/live-ai.d.ts +104 -0
  79. package/dist/live/live-ai.js +157 -0
  80. package/dist/parity/constants.d.ts +79 -0
  81. package/dist/parity/constants.js +104 -0
  82. package/dist/parity/index.d.ts +20 -0
  83. package/dist/parity/index.js +38 -0
  84. package/dist/parity/internals.d.ts +8 -0
  85. package/dist/parity/internals.js +16 -0
  86. package/dist/parity/scenario.d.ts +45 -0
  87. package/dist/parity/scenario.js +245 -0
  88. package/dist/parity/script.d.ts +44 -0
  89. package/dist/parity/script.js +136 -0
  90. package/dist/parity/snapshot.d.ts +43 -0
  91. package/dist/parity/snapshot.js +71 -0
  92. package/dist/real-data/index.d.ts +2 -0
  93. package/dist/real-data/index.js +12 -0
  94. package/dist/real-data/real-data.d.ts +76 -0
  95. package/dist/real-data/real-data.js +156 -0
  96. package/fixtures/kg-golden/README.md +136 -0
  97. package/fixtures/kg-golden/ask-questions.json +458 -0
  98. package/fixtures/kg-golden/meetings/m01-northwind-pilot-kickoff.json +792 -0
  99. package/fixtures/kg-golden/meetings/m02-halden-migration-planning.json +814 -0
  100. package/fixtures/kg-golden/meetings/m03-larkspur-weekly-sync.json +601 -0
  101. package/fixtures/kg-golden/meetings/m04-corvid-intake-discovery.json +690 -0
  102. package/fixtures/kg-golden/meetings/m05-hosting-vendor-selection.json +631 -0
  103. package/fixtures/kg-golden/meetings/m06-northwind-floor-data-review.json +649 -0
  104. package/fixtures/kg-golden/meetings/m07-gullwing-intro-notes.json +428 -0
  105. package/fixtures/kg-golden/meetings/m08-halden-migration-checkpoint.json +672 -0
  106. package/fixtures/kg-golden/meetings/m09-northwind-platform-org-update.json +711 -0
  107. package/fixtures/kg-golden/meetings/m10-corvid-prototype-review.json +623 -0
  108. package/fixtures/kg-golden/meetings/m11-solvane-grid-dashboard-scoping.json +689 -0
  109. package/fixtures/kg-golden/meetings/m12-northwind-pilot-replan.json +681 -0
  110. package/fixtures/kg-golden/meetings/m13-halden-cutover-go-no-go.json +721 -0
  111. package/fixtures/kg-golden/meetings/m14-gullwing-discovery-readout.json +719 -0
  112. package/fixtures/kg-golden/meetings/m15-halden-handover-ravi-leaving.json +716 -0
  113. package/fixtures/kg-golden/meetings/m16-varden-claims-portal-intro.json +704 -0
  114. package/fixtures/kg-golden/meetings/m17-corvid-usability-debrief.json +572 -0
  115. package/fixtures/kg-golden/meetings/m18-hosting-decision-revisited.json +655 -0
  116. package/fixtures/kg-golden/meetings/m19-solvane-integration-kickoff.json +726 -0
  117. package/fixtures/kg-golden/meetings/m20-northwind-go-live-retro.json +673 -0
  118. package/fixtures/kg-golden/meetings/m21-quarterly-account-review.json +449 -0
  119. package/fixtures/kg-golden/meetings/m22-halden-intro-call-2020.json +558 -0
  120. package/fixtures/kg-golden/meetings/m23-gullwing-model-review.json +702 -0
  121. package/fixtures/kg-golden/meetings/m24-varden-discovery-midpoint.json +643 -0
  122. package/fixtures/kg-golden/meetings/m25-corvid-rollout-planning.json +642 -0
  123. package/fixtures/kg-golden/meetings/m26-larkspur-engineering-prep.json +695 -0
  124. package/fixtures/kg-golden/meetings/m27-solvane-phase-one-demo.json +649 -0
  125. package/fixtures/kg-golden/meetings/m28-northwind-building-5-scoping.json +715 -0
  126. package/fixtures/kg-golden/meetings/m29-halden-southern-cutover-review.json +752 -0
  127. package/fixtures/kg-golden/meetings/m30-varden-portal-build-kickoff.json +697 -0
  128. package/fixtures/kg-golden/meetings/m31-gullwing-rollout-renewal.json +681 -0
  129. package/fixtures/kg-golden/meetings/m32-brambleway-weekly-sync.json +472 -0
  130. package/fixtures/kg-golden/meetings/m33-nina-oliver-one-on-one.json +342 -0
  131. package/fixtures/kg-golden/meetings/m34-coffee-with-dana.json +249 -0
  132. package/fixtures/kg-golden/meetings/m35-brambleway-june-sync.json +553 -0
  133. package/fixtures/kg-golden/meetings/m36-copenhagen-conference-planning.json +296 -0
  134. package/host/generated/client.d.ts +1 -0
  135. package/host/generated/client.js +5 -0
  136. package/host/generated/default.d.ts +1 -0
  137. package/host/generated/default.js +5 -0
  138. package/host/generated/edge.d.ts +1 -0
  139. package/host/generated/edge.js +1658 -0
  140. package/host/generated/index-browser.js +1684 -0
  141. package/host/generated/index.d.ts +192335 -0
  142. package/host/generated/index.js +1658 -0
  143. package/host/generated/package.json +139 -0
  144. package/host/generated/query_compiler_fast_bg.js +2 -0
  145. package/host/generated/query_compiler_fast_bg.wasm +0 -0
  146. package/host/generated/query_compiler_fast_bg.wasm-base64.js +2 -0
  147. package/host/generated/runtime/client.d.ts +3433 -0
  148. package/host/generated/runtime/client.js +110 -0
  149. package/host/generated/runtime/index-browser.d.ts +90 -0
  150. package/host/generated/runtime/index-browser.js +6 -0
  151. package/host/generated/runtime/wasm-compiler-edge.js +100 -0
  152. package/host/generated/schema.prisma +6312 -0
  153. package/host/generated/wasm-edge-light-loader.mjs +5 -0
  154. package/host/generated/wasm-worker-loader.mjs +5 -0
  155. package/host/prisma/fragments/kvox.ask.prisma +126 -0
  156. package/host/prisma/fragments/kvox.graph.prisma +1073 -0
  157. package/host/prisma/fragments/kvox.notes.prisma +787 -0
  158. package/host/prisma/fragments/kvox.search.prisma +211 -0
  159. package/host/prisma/fragments/kvox.transcripts.prisma +790 -0
  160. package/host/prisma/kvox.lock +101 -0
  161. package/host/prisma/migrations/20240101000000_initial/migration.sql +297 -0
  162. package/host/prisma/migrations/20240101000001_add_personal_access_tokens/migration.sql +31 -0
  163. package/host/prisma/migrations/20240101000002_add_credentials/migration.sql +20 -0
  164. package/host/prisma/migrations/20240101000003_add_notification_deliveries/migration.sql +27 -0
  165. package/host/prisma/migrations/20240101000004_drop_stale_uuid_defaults/migration.sql +35 -0
  166. package/host/prisma/migrations/20240101000005_add_notifications/migration.sql +22 -0
  167. package/host/prisma/migrations/20240101000006_add_push_subscriptions/migration.sql +25 -0
  168. package/host/prisma/migrations/20240101000007_add_jobs/migration.sql +110 -0
  169. package/host/prisma/migrations/20240101000008_add_worker_nodes/migration.sql +90 -0
  170. package/host/prisma/migrations/20240101000009_add_database_backup_runs/migration.sql +104 -0
  171. package/host/prisma/migrations/20240101000010_add_notification_broadcasts/migration.sql +57 -0
  172. package/host/prisma/migrations/20240101000011_add_backup_run_job_link/migration.sql +87 -0
  173. package/host/prisma/migrations/20240101000012_add_job_node_secrets/migration.sql +61 -0
  174. package/host/prisma/migrations/20240101000013_add_backup_run_pg_dump_version/migration.sql +26 -0
  175. package/host/prisma/migrations/20240101000014_add_job_claim_token/migration.sql +92 -0
  176. package/host/prisma/migrations/20240101000015_add_ai_platform/migration.sql +108 -0
  177. package/host/prisma/migrations/20240101000016_revoke_viewer_ai_use/migration.sql +32 -0
  178. package/host/prisma/migrations/20240101000017_add_user_credentials/migration.sql +29 -0
  179. package/host/prisma/migrations/20240101000018_add_device_session_credential_link/migration.sql +52 -0
  180. package/host/prisma/migrations/20240101000019_add_worker_node_vitals/migration.sql +3 -0
  181. package/host/prisma/migrations/20240101000020_add_job_trace_context/migration.sql +6 -0
  182. package/host/prisma/migrations/20240101000021_add_retention_created_at_indexes/migration.sql +13 -0
  183. package/host/prisma/migrations/20240101000022_add_organizations/migration.sql +142 -0
  184. package/host/prisma/migrations/20240101000023_split_system_org_roles/migration.sql +131 -0
  185. package/host/prisma/migrations/20240101000024_org_scoped_rls/migration.sql +215 -0
  186. package/host/prisma/migrations/20240101000025_add_groups/migration.sql +165 -0
  187. package/host/prisma/migrations/20240101000026_add_grants/migration.sql +117 -0
  188. package/host/prisma/migrations/20240101000027_add_org_settings/migration.sql +49 -0
  189. package/host/prisma/migrations/20240101000028_add_org_credentials/migration.sql +54 -0
  190. package/host/prisma/migrations/20240101000029_add_jobs_org_id/migration.sql +18 -0
  191. package/host/prisma/migrations/20240101000030_add_jobs_org_id_status_index/migration.sql +6 -0
  192. package/host/prisma/migrations/20240101000031_add_broadcast_target_org/migration.sql +21 -0
  193. package/host/prisma/migrations/20240101000032_add_android_app/migration.sql +60 -0
  194. package/host/prisma/migrations/20240101000033_open_job_reason/migration.sql +16 -0
  195. package/host/prisma/migrations/20240101000034_ai_usage_feature/migration.sql +37 -0
  196. package/host/prisma/migrations/20240101000035_add_app_metadata/migration.sql +49 -0
  197. package/host/prisma/migrations/20240101000036_open_sharing_vocabularies/migration.sql +97 -0
  198. package/host/prisma/migrations/20260914130000_kvox_add_transcripts/migration.sql +322 -0
  199. package/host/prisma/migrations/20260914140000_kvox_add_notes/migration.sql +311 -0
  200. package/host/prisma/migrations/20260915120000_kvox_add_search_vectors/migration.sql +150 -0
  201. package/host/prisma/migrations/20260915130000_kvox_add_search_embeddings/migration.sql +362 -0
  202. package/host/prisma/migrations/20260915210000_kvox_add_note_title_source/migration.sql +30 -0
  203. package/host/prisma/migrations/20260923120000_kvox_add_note_generation_context_snapshot/migration.sql +24 -0
  204. package/host/prisma/migrations/20260923130000_kvox_add_user_hidden_note_templates/migration.sql +35 -0
  205. package/host/prisma/migrations/20260923140000_kvox_add_transcript_speaker_identities/migration.sql +6 -0
  206. package/host/prisma/migrations/20260923150000_kvox_transcript_name_checks/migration.sql +95 -0
  207. package/host/prisma/migrations/20260923160000_kvox_add_note_body_format/migration.sql +27 -0
  208. package/host/prisma/migrations/20260923170000_kvox_add_note_version_body_format/migration.sql +23 -0
  209. package/host/prisma/migrations/20260926012548_kvox_add_knowledge_graph/migration.sql +680 -0
  210. package/host/prisma/migrations/20260926030000_kvox_fix_kg_relations_valid_precision_chk/migration.sql +29 -0
  211. package/host/prisma/migrations/20260926030100_kvox_add_transcript_recorded_at/migration.sql +9 -0
  212. package/host/prisma/migrations/20260926030200_kvox_kg_evidence_invariant/migration.sql +60 -0
  213. package/host/prisma/migrations/20260926040000_kvox_add_kg_graph_layouts/migration.sql +30 -0
  214. package/host/prisma/migrations/20260926050000_kvox_add_ask_conversations/migration.sql +99 -0
  215. package/host/prisma/migrations/20260926231512_kvox_add_kg_exports/migration.sql +52 -0
  216. package/host/prisma/migrations/20261016120000_kvox_transcripts_org_id/migration.sql +49 -0
  217. package/host/prisma/platform.lock +319 -0
  218. package/host/prisma/schema/app.kvox.ask.prisma +110 -0
  219. package/host/prisma/schema/app.kvox.graph.prisma +1030 -0
  220. package/host/prisma/schema/app.kvox.notes.prisma +746 -0
  221. package/host/prisma/schema/app.kvox.search.prisma +208 -0
  222. package/host/prisma/schema/app.kvox.transcripts.prisma +726 -0
  223. package/host/prisma/schema/platform.ai.prisma +419 -0
  224. package/host/prisma/schema/platform.android-app.prisma +46 -0
  225. package/host/prisma/schema/platform.base.prisma +15 -0
  226. package/host/prisma/schema/platform.credentials.prisma +156 -0
  227. package/host/prisma/schema/platform.db-backup.prisma +359 -0
  228. package/host/prisma/schema/platform.identity.prisma +638 -0
  229. package/host/prisma/schema/platform.jobs.prisma +824 -0
  230. package/host/prisma/schema/platform.notifications.prisma +641 -0
  231. package/host/prisma/schema/platform.settings.prisma +53 -0
  232. package/host/prisma/schema/platform.sharing.prisma +208 -0
  233. package/host/prisma/schema/platform.storage.prisma +118 -0
  234. package/package.json +112 -1
  235. package/parity/requests.ask.json +2681 -0
  236. package/parity/requests.m01.json +1554 -0
  237. package/parity/requests.m02.json +1554 -0
  238. package/parity/requests.m03.json +1554 -0
  239. package/parity/requests.m04.json +1554 -0
  240. package/parity/requests.m05.json +1554 -0
  241. package/parity/requests.m06.json +1554 -0
  242. package/parity/requests.m07.json +1554 -0
  243. package/parity/requests.m08.json +1554 -0
  244. package/parity/requests.m09.json +1554 -0
  245. package/parity/requests.m10.json +1554 -0
@@ -0,0 +1,29 @@
1
+ -- =============================================================================
2
+ -- Fix kg_relations_valid_precision_chk's NULL hole (issue #398, epic #344)
3
+ -- =============================================================================
4
+ --
5
+ -- 20260926012548_add_knowledge_graph (#351) wrote this CHECK as
6
+ --
7
+ -- ("valid" IS NULL) = ("valid_precision" IS NULL) OR "valid_precision" = 'unknown'
8
+ --
9
+ -- With `valid` set and `valid_precision` NULL, the equality is false and
10
+ -- `"valid_precision" = 'unknown'` is NULL, so the whole expression is
11
+ -- `false OR NULL` = NULL. PostgreSQL treats a NULL CHECK result as SATISFIED
12
+ -- (only an explicit false fails a CHECK), so the one row this constraint
13
+ -- exists to reject — a range with no stated precision — was silently accepted.
14
+ --
15
+ -- `IS NOT DISTINCT FROM` is never NULL: a NULL precision makes that branch
16
+ -- false, and the row is rejected. The intended exemption is unchanged — a
17
+ -- relation whose time is admittedly unknown may still carry 'unknown' with
18
+ -- no range.
19
+ --
20
+ -- Safe to replace in place: nothing writes kg_relations yet (#355 is the
21
+ -- first writer), so no existing row can violate the corrected constraint.
22
+ -- Hand-written, like the original: Prisma cannot express a CHECK.
23
+ -- =============================================================================
24
+
25
+ ALTER TABLE "kg_relations" DROP CONSTRAINT "kg_relations_valid_precision_chk";
26
+
27
+ ALTER TABLE "kg_relations" ADD CONSTRAINT "kg_relations_valid_precision_chk"
28
+ CHECK (("valid" IS NULL) = ("valid_precision" IS NULL)
29
+ OR "valid_precision" IS NOT DISTINCT FROM 'unknown');
@@ -0,0 +1,9 @@
1
+ -- Issue #352: when the recording was made. Additive, backfilled from
2
+ -- `created_at` (the upload instant) so the column is total and the fallback
3
+ -- is explicit and editable rather than implicit in every consumer.
4
+ ALTER TABLE "transcripts" ADD COLUMN "recorded_at" TIMESTAMPTZ;
5
+ UPDATE "transcripts" SET "recorded_at" = "created_at";
6
+ ALTER TABLE "transcripts"
7
+ ALTER COLUMN "recorded_at" SET DEFAULT CURRENT_TIMESTAMP,
8
+ ALTER COLUMN "recorded_at" SET NOT NULL;
9
+ CREATE INDEX "transcripts_owner_id_recorded_at_idx" ON "transcripts" ("owner_id", "recorded_at" DESC);
@@ -0,0 +1,60 @@
1
+ -- =============================================================================
2
+ -- The knowledge graph's no-orphans invariant, enforced by the database
3
+ -- (issue #355, epic #344; docs/specs/ontology.md §3.3, §5.3, §8)
4
+ -- =============================================================================
5
+ --
6
+ -- HAND-WRITTEN, INTENTIONAL SCHEMA DRIFT: Prisma has no DSL for a trigger, so
7
+ -- nothing here appears in schema.prisma — the same pattern as the partial
8
+ -- unique indexes and CHECK constraints the kg_* migration already carries.
9
+ --
10
+ -- The invariant: every `accepted`/`edited` entity, relation and item carries
11
+ -- at least one `kg_evidence` row. `GraphWriteService` checks it before any SQL
12
+ -- runs; this is the BACKSTOP for a writer that bypasses the service (a raw
13
+ -- SQL fix, a hurried migration), turning a silent orphan into a failed COMMIT.
14
+ --
15
+ -- DEFERRED, not immediate: a writer inserts the subject first and its
16
+ -- evidence second, inside one transaction — an immediate check would fail
17
+ -- between the two statements. `DEFERRABLE INITIALLY DEFERRED` runs every check
18
+ -- at COMMIT, against the transaction's final state:
19
+ --
20
+ -- - The subject's CURRENT review status is re-read at COMMIT, so a subject
21
+ -- deleted in the same transaction (purge, forget, revert) finds no row and
22
+ -- passes, and a merge tombstone (`merged`) whose evidence was re-pointed at
23
+ -- the survivor passes.
24
+ -- - `kg_evidence` rows anchoring a proposal item or an import are not graph
25
+ -- rows and are never checked (the WHEN clause).
26
+ --
27
+ -- SQLSTATE 23514 (check_violation). Surfacing it is a writer bug, never a user
28
+ -- error: the service maps it to a 500 and logs `kg no-orphans invariant
29
+ -- violated` at error level.
30
+ -- =============================================================================
31
+
32
+ CREATE FUNCTION kg_assert_has_evidence() RETURNS trigger LANGUAGE plpgsql AS $$
33
+ DECLARE kind text := TG_ARGV[0]; subj uuid; status text;
34
+ BEGIN
35
+ IF TG_TABLE_NAME = 'kg_evidence' THEN subj := OLD.subject_id; kind := OLD.subject_kind::text;
36
+ ELSE subj := NEW.id; END IF;
37
+ -- re-read the subject's CURRENT status; it may have been deleted or tombstoned in the same tx
38
+ EXECUTE format('SELECT review_status::text FROM %I WHERE id = $1',
39
+ CASE kind WHEN 'entity' THEN 'kg_entities' WHEN 'relation' THEN 'kg_relations' WHEN 'item' THEN 'kg_items' END)
40
+ INTO status USING subj;
41
+ IF status IN ('accepted','edited') AND NOT EXISTS (
42
+ SELECT 1 FROM kg_evidence WHERE subject_kind::text = kind AND subject_id = subj) THEN
43
+ RAISE EXCEPTION 'kg no-orphans invariant: % % has no evidence', kind, subj USING ERRCODE = '23514';
44
+ END IF;
45
+ RETURN NULL;
46
+ END $$;
47
+
48
+ CREATE CONSTRAINT TRIGGER kg_entities_evidence_trg AFTER INSERT OR UPDATE OF review_status ON kg_entities
49
+ DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION kg_assert_has_evidence('entity');
50
+
51
+ CREATE CONSTRAINT TRIGGER kg_relations_evidence_trg AFTER INSERT OR UPDATE OF review_status ON kg_relations
52
+ DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION kg_assert_has_evidence('relation');
53
+
54
+ CREATE CONSTRAINT TRIGGER kg_items_evidence_trg AFTER INSERT OR UPDATE OF review_status ON kg_items
55
+ DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION kg_assert_has_evidence('item');
56
+
57
+ CREATE CONSTRAINT TRIGGER kg_evidence_delete_trg AFTER DELETE OR UPDATE OF subject_id ON kg_evidence
58
+ DEFERRABLE INITIALLY DEFERRED FOR EACH ROW
59
+ WHEN (OLD.subject_kind IN ('entity','relation','item'))
60
+ EXECUTE FUNCTION kg_assert_has_evidence('evidence'); -- arg ignored: the kind is read from OLD.subject_kind
@@ -0,0 +1,30 @@
1
+ -- =============================================================================
2
+ -- `kg_graph_layouts` — whole-graph layout snapshots (issue #371, epic #347)
3
+ -- =============================================================================
4
+ -- Latest precomputed clusters + positions per owner, produced by the
5
+ -- `kg.graph_layout` job (spec §22). A cache of derived data, never a source
6
+ -- of truth: entity/relation labels are deliberately NOT stored here, so a
7
+ -- renamed or forgotten entity never shows a stale label through this table
8
+ -- (spec §15). See the block comment above `KgGraphLayout` in schema.prisma.
9
+ -- =============================================================================
10
+
11
+ -- CreateTable
12
+ CREATE TABLE "kg_graph_layouts" (
13
+ "id" UUID NOT NULL,
14
+ "owner_id" UUID NOT NULL,
15
+ "computed_at" TIMESTAMPTZ(6) NOT NULL,
16
+ "node_count" INTEGER NOT NULL,
17
+ "edge_count" INTEGER NOT NULL,
18
+ "clusters" JSONB NOT NULL,
19
+ "positions" JSONB NOT NULL,
20
+ "ontology_version" TEXT NOT NULL,
21
+ "source_updated_at" TIMESTAMPTZ(6),
22
+
23
+ CONSTRAINT "kg_graph_layouts_pkey" PRIMARY KEY ("id")
24
+ );
25
+
26
+ -- CreateIndex
27
+ CREATE INDEX "kg_graph_layouts_owner_id_computed_at_idx" ON "kg_graph_layouts"("owner_id", "computed_at" DESC);
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE "kg_graph_layouts" ADD CONSTRAINT "kg_graph_layouts_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,99 @@
1
+ -- =============================================================================
2
+ -- `ask_conversations` / `ask_messages` — saved Ask conversations
3
+ -- (issue #376, epic #348; docs/specs/ontology.md §21)
4
+ -- =============================================================================
5
+ -- One row per saved conversation with the read-only graph agent, and one row
6
+ -- per turn in it. An assistant turn's `content` is the durable stream buffer
7
+ -- `ask.respond` (#378) appends to and the SSE endpoint (#379) reads from —
8
+ -- the `note_generations` "durable buffer, stream is a view" contract.
9
+ --
10
+ -- `owner_id` CASCADES (no Ask history survives its owner; there is no
11
+ -- `ask:read_any`). `scope_entity_id` is SET NULL: forgetting or merging the
12
+ -- scoped entity drops the scope link, never the conversation. `job_id`
13
+ -- mirrors `transcript_exports.job_id` (unique, nullable, SET NULL).
14
+ --
15
+ -- INTENTIONAL SCHEMA DRIFT: `ask_messages_one_running_turn_uniq_idx` at the
16
+ -- bottom of this file is a PARTIAL unique index Prisma cannot express, so it
17
+ -- exists here only and `prisma migrate diff` will report it as extra. It
18
+ -- enforces at most one running (pending/streaming) assistant turn per
19
+ -- conversation IN THE DATABASE — the `database_backup_runs_active_uniq_idx`
20
+ -- pattern, never a `findFirst` before the insert, which races. #378 maps its
21
+ -- violation (SQLSTATE 23505) to 409 `ask_turn_running`. Do not "fix" the
22
+ -- drift by adding a `@@unique` to the model.
23
+ -- =============================================================================
24
+
25
+ -- CreateEnum
26
+ CREATE TYPE "AskMessageRole" AS ENUM ('user', 'assistant');
27
+
28
+ -- CreateEnum
29
+ CREATE TYPE "AskMessageStatus" AS ENUM ('pending', 'streaming', 'complete', 'failed');
30
+
31
+ -- CreateEnum
32
+ CREATE TYPE "AskErrorClass" AS ENUM ('auth', 'refusal', 'rate_limit', 'budget', 'timeout', 'other');
33
+
34
+ -- CreateEnum
35
+ CREATE TYPE "AskFinishReason" AS ENUM ('stop', 'step_cap', 'token_cap', 'time_cap');
36
+
37
+ -- CreateTable
38
+ CREATE TABLE "ask_conversations" (
39
+ "id" UUID NOT NULL,
40
+ "owner_id" UUID NOT NULL,
41
+ "title" TEXT,
42
+ "scope_entity_id" UUID,
43
+ "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
44
+ "updated_at" TIMESTAMPTZ(6) NOT NULL,
45
+
46
+ CONSTRAINT "ask_conversations_pkey" PRIMARY KEY ("id")
47
+ );
48
+
49
+ -- CreateTable
50
+ CREATE TABLE "ask_messages" (
51
+ "id" UUID NOT NULL,
52
+ "conversation_id" UUID NOT NULL,
53
+ "role" "AskMessageRole" NOT NULL,
54
+ "content" TEXT NOT NULL DEFAULT '',
55
+ "status" "AskMessageStatus" NOT NULL DEFAULT 'pending',
56
+ "tool_calls" JSONB NOT NULL DEFAULT '[]',
57
+ "citations" JSONB NOT NULL DEFAULT '[]',
58
+ "model" TEXT,
59
+ "provider" TEXT,
60
+ "prompt_tokens" INTEGER,
61
+ "completion_tokens" INTEGER,
62
+ "error_class" "AskErrorClass",
63
+ "finish_reason" "AskFinishReason",
64
+ "job_id" UUID,
65
+ "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
66
+
67
+ CONSTRAINT "ask_messages_pkey" PRIMARY KEY ("id")
68
+ );
69
+
70
+ -- CreateIndex
71
+ CREATE INDEX "ask_conversations_owner_id_updated_at_idx" ON "ask_conversations"("owner_id", "updated_at" DESC);
72
+
73
+ -- CreateIndex
74
+ CREATE INDEX "ask_conversations_owner_id_scope_entity_id_idx" ON "ask_conversations"("owner_id", "scope_entity_id");
75
+
76
+ -- CreateIndex
77
+ CREATE UNIQUE INDEX "ask_messages_job_id_key" ON "ask_messages"("job_id");
78
+
79
+ -- CreateIndex
80
+ CREATE INDEX "ask_messages_conversation_id_created_at_idx" ON "ask_messages"("conversation_id", "created_at");
81
+
82
+ -- AddForeignKey
83
+ ALTER TABLE "ask_conversations" ADD CONSTRAINT "ask_conversations_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
84
+
85
+ -- AddForeignKey
86
+ ALTER TABLE "ask_conversations" ADD CONSTRAINT "ask_conversations_scope_entity_id_fkey" FOREIGN KEY ("scope_entity_id") REFERENCES "kg_entities"("id") ON DELETE SET NULL ON UPDATE CASCADE;
87
+
88
+ -- AddForeignKey
89
+ ALTER TABLE "ask_messages" ADD CONSTRAINT "ask_messages_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "ask_conversations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
90
+
91
+ -- AddForeignKey
92
+ ALTER TABLE "ask_messages" ADD CONSTRAINT "ask_messages_job_id_fkey" FOREIGN KEY ("job_id") REFERENCES "jobs"("id") ON DELETE SET NULL ON UPDATE CASCADE;
93
+
94
+
95
+ -- HAND-WRITTEN (intentional schema drift — see the header): at most one
96
+ -- running assistant turn per conversation.
97
+ CREATE UNIQUE INDEX "ask_messages_one_running_turn_uniq_idx"
98
+ ON "ask_messages" ("conversation_id")
99
+ WHERE "role" = 'assistant' AND "status" IN ('pending', 'streaming');
@@ -0,0 +1,52 @@
1
+ -- =============================================================================
2
+ -- `kg_exports` — RDF exports of one owner's graph (issue #386, epic #349)
3
+ -- =============================================================================
4
+ -- One row per requested JSON-LD / Turtle / N-Quads render, produced by the
5
+ -- `kg.export` job into a `managed_by: 'graph'` storage object and expiring
6
+ -- after 7 days (spec §18.2). Content-addressed on `graph_fingerprint`, a plain
7
+ -- non-unique lookup index exactly like `note_exports_lookup_idx`. Every
8
+ -- constraint is Prisma-expressible — no hand-written SQL, no schema drift.
9
+ -- See the block comment above `KgExport` in schema.prisma.
10
+ -- =============================================================================
11
+
12
+ -- CreateEnum
13
+ CREATE TYPE "kg_export_format" AS ENUM ('jsonld', 'turtle', 'nquads');
14
+
15
+ -- CreateEnum
16
+ CREATE TYPE "kg_export_status" AS ENUM ('pending', 'running', 'ready', 'failed');
17
+
18
+ -- CreateTable
19
+ CREATE TABLE "kg_exports" (
20
+ "id" UUID NOT NULL,
21
+ "owner_id" UUID NOT NULL,
22
+ "format" "kg_export_format" NOT NULL,
23
+ "status" "kg_export_status" NOT NULL DEFAULT 'pending',
24
+ "graph_fingerprint" TEXT NOT NULL,
25
+ "ontology_version" TEXT NOT NULL,
26
+ "object_id" UUID,
27
+ "stats" JSONB NOT NULL DEFAULT '{}',
28
+ "error_message" TEXT,
29
+ "job_id" UUID,
30
+ "expires_at" TIMESTAMPTZ(6) NOT NULL,
31
+ "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
32
+
33
+ CONSTRAINT "kg_exports_pkey" PRIMARY KEY ("id")
34
+ );
35
+
36
+ -- CreateIndex
37
+ CREATE UNIQUE INDEX "kg_exports_job_id_key" ON "kg_exports"("job_id");
38
+
39
+ -- CreateIndex
40
+ CREATE INDEX "kg_exports_owner_id_format_graph_fingerprint_idx" ON "kg_exports"("owner_id", "format", "graph_fingerprint");
41
+
42
+ -- CreateIndex
43
+ CREATE INDEX "kg_exports_expires_at_idx" ON "kg_exports"("expires_at");
44
+
45
+ -- AddForeignKey
46
+ ALTER TABLE "kg_exports" ADD CONSTRAINT "kg_exports_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
47
+
48
+ -- AddForeignKey
49
+ ALTER TABLE "kg_exports" ADD CONSTRAINT "kg_exports_object_id_fkey" FOREIGN KEY ("object_id") REFERENCES "storage_objects"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
50
+
51
+ -- AddForeignKey
52
+ ALTER TABLE "kg_exports" ADD CONSTRAINT "kg_exports_job_id_fkey" FOREIGN KEY ("job_id") REFERENCES "jobs"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,49 @@
1
+ -- transcripts.org_id (issue #485, epic #478).
2
+ --
3
+ -- The platform sharing slice decides a record's access inside ONE organization:
4
+ -- `grants.org_id` must equal the record's `org_id`, and `AccessPolicy` denies a
5
+ -- record whose `loadOwners` organization is not the caller's active one. A
6
+ -- transcript therefore carries the organization it belongs to.
7
+ --
8
+ -- `transcripts` is deliberately NOT put under row-level security. The spike for
9
+ -- #485 found that neither `AccessPolicy` nor the sharing conformance suite asks
10
+ -- for it: `loadOwners` only has to report `{ owner, orgId }`, and the grant
11
+ -- queries run in the caller's organization scope on the `grants` table, which
12
+ -- IS under forced RLS. No policy is created here and no composite key is
13
+ -- needed (`grants` names a transcript by a plain `resource_id`, no foreign key).
14
+ --
15
+ -- Single-organization deployment: every existing transcript is backfilled with
16
+ -- the default organization (add nullable, backfill, set NOT NULL). A database
17
+ -- that holds transcripts but no default organization cannot be migrated, and the
18
+ -- migration says so instead of leaving rows with a NULL organization.
19
+ --
20
+ -- Reverse: ALTER TABLE "transcripts" DROP COLUMN "org_id"; (the foreign key
21
+ -- and the index go with the column).
22
+
23
+ BEGIN;
24
+
25
+ -- AlterTable
26
+ ALTER TABLE "transcripts" ADD COLUMN "org_id" UUID;
27
+
28
+ -- Backfill: the default organization.
29
+ UPDATE "transcripts"
30
+ SET "org_id" = (SELECT "id" FROM "organizations" WHERE "is_default" LIMIT 1);
31
+
32
+ DO $$
33
+ BEGIN
34
+ IF EXISTS (SELECT 1 FROM "transcripts" WHERE "org_id" IS NULL) THEN
35
+ RAISE EXCEPTION 'transcripts.org_id backfill: transcripts exist but there is no default organization';
36
+ END IF;
37
+ END
38
+ $$;
39
+
40
+ -- AlterTable
41
+ ALTER TABLE "transcripts" ALTER COLUMN "org_id" SET NOT NULL;
42
+
43
+ -- CreateIndex
44
+ CREATE INDEX "transcripts_org_id_idx" ON "transcripts"("org_id");
45
+
46
+ -- AddForeignKey
47
+ ALTER TABLE "transcripts" ADD CONSTRAINT "transcripts_org_id_fkey" FOREIGN KEY ("org_id") REFERENCES "organizations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
48
+
49
+ COMMIT;
@@ -0,0 +1,319 @@
1
+ {
2
+ "appMigrations": [
3
+ "20260914130000_kvox_add_transcripts",
4
+ "20260914140000_kvox_add_notes",
5
+ "20260915120000_kvox_add_search_vectors",
6
+ "20260915130000_kvox_add_search_embeddings",
7
+ "20260915210000_kvox_add_note_title_source",
8
+ "20260923120000_kvox_add_note_generation_context_snapshot",
9
+ "20260923130000_kvox_add_user_hidden_note_templates",
10
+ "20260923140000_kvox_add_transcript_speaker_identities",
11
+ "20260923150000_kvox_transcript_name_checks",
12
+ "20260923160000_kvox_add_note_body_format",
13
+ "20260923170000_kvox_add_note_version_body_format",
14
+ "20260926012548_kvox_add_knowledge_graph",
15
+ "20260926030000_kvox_fix_kg_relations_valid_precision_chk",
16
+ "20260926030100_kvox_add_transcript_recorded_at",
17
+ "20260926030200_kvox_kg_evidence_invariant",
18
+ "20260926040000_kvox_add_kg_graph_layouts",
19
+ "20260926050000_kvox_add_ask_conversations",
20
+ "20260926231512_kvox_add_kg_exports",
21
+ "20261016120000_kvox_transcripts_org_id"
22
+ ],
23
+ "lockVersion": 1,
24
+ "migrations": [
25
+ {
26
+ "localDir": "20240101000000_initial",
27
+ "originId": "platform:0001_initial",
28
+ "sha256": "755688a7d01e70c97f497efdbd5a72adecf9404ba20fc5fc15c748c2bb7d0d2e",
29
+ "since": "1.0.0"
30
+ },
31
+ {
32
+ "localDir": "20240101000001_add_personal_access_tokens",
33
+ "originId": "platform:0002_add_personal_access_tokens",
34
+ "sha256": "696a7bc4a974a2b0142f7183fe795d98b21a353f402ad21b3d5a5e79c06800cd",
35
+ "since": "1.0.0"
36
+ },
37
+ {
38
+ "localDir": "20240101000002_add_credentials",
39
+ "originId": "platform:0003_add_credentials",
40
+ "sha256": "825d08352a40f595a16e3086862c7d0eeb0333c8643119a618666627e87bcb32",
41
+ "since": "1.0.0"
42
+ },
43
+ {
44
+ "localDir": "20240101000003_add_notification_deliveries",
45
+ "originId": "platform:0004_add_notification_deliveries",
46
+ "sha256": "242c3fc6a3a8c68c3515b0a5f19c819e48dd0b8ee3719007a24ffcbf2d8eacdc",
47
+ "since": "1.0.0"
48
+ },
49
+ {
50
+ "localDir": "20240101000004_drop_stale_uuid_defaults",
51
+ "originId": "platform:0005_drop_stale_uuid_defaults",
52
+ "sha256": "34e3ee9325646bd77d3123090826798c7c7fc7b57938ee7cee6584a03d24d6ad",
53
+ "since": "1.0.0"
54
+ },
55
+ {
56
+ "localDir": "20240101000005_add_notifications",
57
+ "originId": "platform:0006_add_notifications",
58
+ "sha256": "56a8156d13b09f0bdfdaa6033c5cf3f0adbd0191a53680eeb2376e13a637c383",
59
+ "since": "1.0.0"
60
+ },
61
+ {
62
+ "localDir": "20240101000006_add_push_subscriptions",
63
+ "originId": "platform:0007_add_push_subscriptions",
64
+ "sha256": "7bfd542911735beae1152c3584e4ae8e131e37413d6d59054a29e9d4ab967e85",
65
+ "since": "1.0.0"
66
+ },
67
+ {
68
+ "localDir": "20240101000007_add_jobs",
69
+ "originId": "platform:0008_add_jobs",
70
+ "sha256": "29ca499509b06bc8ee11c09ed86d8d5b2385bcc9aa48fe597c0efc1ccb40febf",
71
+ "since": "1.0.0"
72
+ },
73
+ {
74
+ "localDir": "20240101000008_add_worker_nodes",
75
+ "originId": "platform:0009_add_worker_nodes",
76
+ "sha256": "d26c1412c6e293f562422bbe292e9e833f1506cb1dc3466f78eacd7bc34ea398",
77
+ "since": "1.0.0"
78
+ },
79
+ {
80
+ "localDir": "20240101000009_add_database_backup_runs",
81
+ "originId": "platform:0010_add_database_backup_runs",
82
+ "sha256": "e6a2c130a155748768148a1993b7e47cabca09236a4eeb31f8793448b389077a",
83
+ "since": "1.0.0"
84
+ },
85
+ {
86
+ "localDir": "20240101000010_add_notification_broadcasts",
87
+ "originId": "platform:0011_add_notification_broadcasts",
88
+ "sha256": "d218ee33f855f575c6633cf0d9a709cb3e0db69a83ff2d38b48c501e730d4370",
89
+ "since": "1.0.0"
90
+ },
91
+ {
92
+ "localDir": "20240101000011_add_backup_run_job_link",
93
+ "originId": "platform:0012_add_backup_run_job_link",
94
+ "sha256": "1a11a1bed116e303136bd1f7ee5065f3b470cb2cb04bb33d0c083b3dfec37144",
95
+ "since": "1.0.0"
96
+ },
97
+ {
98
+ "localDir": "20240101000012_add_job_node_secrets",
99
+ "originId": "platform:0013_add_job_node_secrets",
100
+ "sha256": "309f4a371c0d5ed62b140a10acb28a705fc92c8a1412551fc07ac20b9cb77f0a",
101
+ "since": "1.0.0"
102
+ },
103
+ {
104
+ "localDir": "20240101000013_add_backup_run_pg_dump_version",
105
+ "originId": "platform:0014_add_backup_run_pg_dump_version",
106
+ "sha256": "966c2e2af657739d7e4e447761bf93635c7e8bd41dbc31494f7118ffb4e8a67c",
107
+ "since": "1.0.0"
108
+ },
109
+ {
110
+ "localDir": "20240101000014_add_job_claim_token",
111
+ "originId": "platform:0015_add_job_claim_token",
112
+ "sha256": "22815ddb2bd4fe39edb4ec6bb11709a15df887c46c261d8d567a3a2cae7f2047",
113
+ "since": "1.0.0"
114
+ },
115
+ {
116
+ "localDir": "20240101000015_add_ai_platform",
117
+ "originId": "platform:0016_add_ai_platform",
118
+ "sha256": "89bf4f29db08eb4261b10c5bd64faa61b65d73f524af70851e019fe264fe7617",
119
+ "since": "1.0.0"
120
+ },
121
+ {
122
+ "localDir": "20240101000016_revoke_viewer_ai_use",
123
+ "originId": "platform:0017_revoke_viewer_ai_use",
124
+ "sha256": "85b27bc2d52666f8a3babc5d0abfa9f589f1844869d79fbbdaa7935e6d49b3df",
125
+ "since": "1.0.0"
126
+ },
127
+ {
128
+ "localDir": "20240101000017_add_user_credentials",
129
+ "originId": "platform:0018_add_user_credentials",
130
+ "sha256": "360316e38bf4af727fc095c65e4cac246108b9e91fc3c184646161ce7a5859fb",
131
+ "since": "1.0.0"
132
+ },
133
+ {
134
+ "localDir": "20240101000018_add_device_session_credential_link",
135
+ "originId": "platform:0019_add_device_session_credential_link",
136
+ "sha256": "e2f26e504872850a0fe799151efdf1df4f153e51db3d686f5ad7e603b1796326",
137
+ "since": "1.0.0"
138
+ },
139
+ {
140
+ "localDir": "20240101000019_add_worker_node_vitals",
141
+ "originId": "platform:0020_add_worker_node_vitals",
142
+ "sha256": "978649d6700635017d22d08a492845307659b8a2f6fdb46e230a887d966a2fe4",
143
+ "since": "1.0.0"
144
+ },
145
+ {
146
+ "localDir": "20240101000020_add_job_trace_context",
147
+ "originId": "platform:0021_add_job_trace_context",
148
+ "sha256": "4d54077792406901812bb76d697e6708c9058245ec1003c49bc8983b53b01302",
149
+ "since": "1.0.0"
150
+ },
151
+ {
152
+ "localDir": "20240101000021_add_retention_created_at_indexes",
153
+ "originId": "platform:0022_add_retention_created_at_indexes",
154
+ "sha256": "f7bc4ab3ec81c55261752c61e48e750faf7affb7202635f8e051934a9410c32f",
155
+ "since": "1.0.0"
156
+ },
157
+ {
158
+ "localDir": "20240101000022_add_organizations",
159
+ "originId": "platform:0023_add_organizations",
160
+ "sha256": "68bed4bfebd7c94600546943bc66dd6245fd912d0cf5583f3485267c89e0faed",
161
+ "since": "1.0.0"
162
+ },
163
+ {
164
+ "localDir": "20240101000023_split_system_org_roles",
165
+ "originId": "platform:0024_split_system_org_roles",
166
+ "sha256": "11484b30fdabf64abb14ec99e4d218c1897f5692130bd5a04720d08b905e1332",
167
+ "since": "1.0.0"
168
+ },
169
+ {
170
+ "localDir": "20240101000024_org_scoped_rls",
171
+ "originId": "platform:0025_org_scoped_rls",
172
+ "sha256": "f6a0a61d07e5b91767b9bf18824ae1872e236f566877282c4cb2332f024dd636",
173
+ "since": "1.0.0"
174
+ },
175
+ {
176
+ "localDir": "20240101000025_add_groups",
177
+ "originId": "platform:0026_add_groups",
178
+ "sha256": "93e97e6b72578a89bf5232a036ecfe6a067c883c7f3c9f091bfdc00475c6e714",
179
+ "since": "1.0.0"
180
+ },
181
+ {
182
+ "localDir": "20240101000026_add_grants",
183
+ "originId": "platform:0027_add_grants",
184
+ "sha256": "2e2d5515f131c104ee7f4e5b2ee4d76fbf5409e500da0b412edd4bad0b71c6da",
185
+ "since": "1.0.0"
186
+ },
187
+ {
188
+ "localDir": "20240101000027_add_org_settings",
189
+ "originId": "platform:0028_add_org_settings",
190
+ "sha256": "e4d811ab7c5446d905e5e4fbb3ce2b94e06d82488f916352a2a413cdc55f94a4",
191
+ "since": "1.0.0"
192
+ },
193
+ {
194
+ "localDir": "20240101000028_add_org_credentials",
195
+ "originId": "platform:0029_add_org_credentials",
196
+ "sha256": "fa5db76f0081149b5716f763166d2099b134857f27f15f36f9a4ea33e1a0806e",
197
+ "since": "1.0.0"
198
+ },
199
+ {
200
+ "localDir": "20240101000029_add_jobs_org_id",
201
+ "originId": "platform:0030_add_jobs_org_id",
202
+ "sha256": "26556306864283a8feb2233692d5fcb66b9f38d2671cfeb66e2e094d4c8f84bb",
203
+ "since": "1.0.0"
204
+ },
205
+ {
206
+ "localDir": "20240101000030_add_jobs_org_id_status_index",
207
+ "originId": "platform:0031_add_jobs_org_id_status_index",
208
+ "sha256": "434d69d4112bcb429de609942a851e08c49793212a538adcc5a2481d1f8b0bb0",
209
+ "since": "1.0.0"
210
+ },
211
+ {
212
+ "localDir": "20240101000031_add_broadcast_target_org",
213
+ "originId": "platform:0032_add_broadcast_target_org",
214
+ "sha256": "9f266799b1e3769233ea72873ce55394340da9f8ef1312a7e0b7b2ae410152e2",
215
+ "since": "1.0.0"
216
+ },
217
+ {
218
+ "localDir": "20240101000032_add_android_app",
219
+ "originId": "platform:0033_add_android_app",
220
+ "sha256": "7f343a96417825c1372388c199ad2dbecfcf8632a4ebc5080afb29c82109b719",
221
+ "since": "1.0.0"
222
+ },
223
+ {
224
+ "localDir": "20240101000033_open_job_reason",
225
+ "originId": "platform:0034_open_job_reason",
226
+ "sha256": "31b16d3aeddb81840ad34ec2df29aeaf065b1f5082c839bbc31c94c90a205d77",
227
+ "since": "1.0.0"
228
+ },
229
+ {
230
+ "localDir": "20240101000034_ai_usage_feature",
231
+ "originId": "platform:0035_ai_usage_feature",
232
+ "sha256": "ad7322539e971a2248cc2f73a12e188453a3312cc1a04d168bc4e7ddd68e5752",
233
+ "since": "1.0.0"
234
+ },
235
+ {
236
+ "localDir": "20240101000035_add_app_metadata",
237
+ "originId": "platform:0036_add_app_metadata",
238
+ "sha256": "17e727075b3d02d129f60cdebf156b9736113e3b689ff35513c474c520185f75",
239
+ "since": "1.0.0"
240
+ },
241
+ {
242
+ "localDir": "20240101000036_open_sharing_vocabularies",
243
+ "originId": "platform:0037_open_sharing_vocabularies",
244
+ "sha256": "4b7047703bacab08af629004ff569e250869355acd03795f17d1b1e5b277c5e6",
245
+ "since": "1.0.0"
246
+ }
247
+ ],
248
+ "platformVersion": "0.1.0-next.5",
249
+ "rawSqlIndexes": [
250
+ {
251
+ "definition": "CREATE UNIQUE INDEX ask_messages_one_running_turn_uniq_idx ON public.ask_messages USING btree (conversation_id) WHERE ((role = 'assistant'::\"AskMessageRole\") AND (status = ANY (ARRAY['pending'::\"AskMessageStatus\", 'streaming'::\"AskMessageStatus\"])))",
252
+ "name": "ask_messages_one_running_turn_uniq_idx"
253
+ },
254
+ {
255
+ "definition": "CREATE INDEX kg_entities_embedding_hnsw_idx ON public.kg_entities USING hnsw (embedding vector_cosine_ops)",
256
+ "name": "kg_entities_embedding_hnsw_idx"
257
+ },
258
+ {
259
+ "definition": "CREATE INDEX kg_entities_label_trgm_idx ON public.kg_entities USING gin (label gin_trgm_ops)",
260
+ "name": "kg_entities_label_trgm_idx"
261
+ },
262
+ {
263
+ "definition": "CREATE INDEX kg_entity_aliases_normalized_trgm_idx ON public.kg_entity_aliases USING gin (normalized gin_trgm_ops)",
264
+ "name": "kg_entity_aliases_normalized_trgm_idx"
265
+ },
266
+ {
267
+ "definition": "CREATE INDEX kg_items_embedding_hnsw_idx ON public.kg_items USING hnsw (embedding vector_cosine_ops)",
268
+ "name": "kg_items_embedding_hnsw_idx"
269
+ },
270
+ {
271
+ "definition": "CREATE UNIQUE INDEX kg_items_live_statement_uniq_idx ON public.kg_items USING btree (owner_id, kind, subject_id, statement_hash) WHERE ((review_status = ANY (ARRAY['accepted'::kg_review_status, 'edited'::kg_review_status])) AND (subject_id IS NOT NULL))",
272
+ "name": "kg_items_live_statement_uniq_idx"
273
+ },
274
+ {
275
+ "definition": "CREATE INDEX kg_items_valid_gist_idx ON public.kg_items USING gist (valid)",
276
+ "name": "kg_items_valid_gist_idx"
277
+ },
278
+ {
279
+ "definition": "CREATE UNIQUE INDEX kg_proposals_note_draft_uniq_idx ON public.kg_proposals USING btree (note_id) WHERE (status = 'draft'::kg_proposal_status)",
280
+ "name": "kg_proposals_note_draft_uniq_idx"
281
+ },
282
+ {
283
+ "definition": "CREATE UNIQUE INDEX kg_proposals_note_extracting_uniq_idx ON public.kg_proposals USING btree (note_id) WHERE (status = 'extracting'::kg_proposal_status)",
284
+ "name": "kg_proposals_note_extracting_uniq_idx"
285
+ },
286
+ {
287
+ "definition": "CREATE UNIQUE INDEX kg_proposals_owner_import_extracting_uniq_idx ON public.kg_proposals USING btree (owner_id) WHERE ((kind = 'import'::kg_proposal_kind) AND (status = 'extracting'::kg_proposal_status))",
288
+ "name": "kg_proposals_owner_import_extracting_uniq_idx"
289
+ },
290
+ {
291
+ "definition": "CREATE UNIQUE INDEX kg_relations_speaker_link_uniq_idx ON public.kg_relations USING btree (from_speaker_id) WHERE (from_speaker_id IS NOT NULL)",
292
+ "name": "kg_relations_speaker_link_uniq_idx"
293
+ },
294
+ {
295
+ "definition": "CREATE INDEX kg_relations_valid_gist_idx ON public.kg_relations USING gist (valid)",
296
+ "name": "kg_relations_valid_gist_idx"
297
+ },
298
+ {
299
+ "definition": "CREATE INDEX notes_search_vector_idx ON public.notes USING gin (search_vector)",
300
+ "name": "notes_search_vector_idx"
301
+ },
302
+ {
303
+ "definition": "CREATE INDEX search_embeddings_embedding_hnsw_idx ON public.search_embeddings USING hnsw (embedding vector_cosine_ops)",
304
+ "name": "search_embeddings_embedding_hnsw_idx"
305
+ },
306
+ {
307
+ "definition": "CREATE INDEX transcript_segments_search_vector_idx ON public.transcript_segments USING gin (search_vector)",
308
+ "name": "transcript_segments_search_vector_idx"
309
+ },
310
+ {
311
+ "definition": "CREATE UNIQUE INDEX transcript_speakers_transcript_id_label_key ON public.transcript_speakers USING btree (transcript_id, label) WHERE (label IS NOT NULL)",
312
+ "name": "transcript_speakers_transcript_id_label_key"
313
+ },
314
+ {
315
+ "definition": "CREATE INDEX transcripts_title_search_vector_idx ON public.transcripts USING gin (title_search_vector)",
316
+ "name": "transcripts_title_search_vector_idx"
317
+ }
318
+ ]
319
+ }