@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,53 @@
1
+ // GENERATED by platform db compose — do not edit
2
+ // source: package:settings.prisma
3
+
4
+ // =============================================================================
5
+ // Settings
6
+ // =============================================================================
7
+
8
+ model SystemSettings {
9
+ id String @id @default(uuid()) @db.Uuid
10
+ key String @unique
11
+ value Json
12
+ version Int @default(1)
13
+ updatedByUserId String? @map("updated_by_user_id") @db.Uuid
14
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
15
+
16
+ // Relations
17
+ updatedByUser User? @relation("SettingsUpdater", fields: [updatedByUserId], references: [id], onDelete: SetNull)
18
+
19
+ @@map("system_settings")
20
+ }
21
+
22
+ model UserSettings {
23
+ id String @id @default(uuid()) @db.Uuid
24
+ userId String @unique @map("user_id") @db.Uuid
25
+ value Json
26
+ version Int @default(1)
27
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
28
+
29
+ // Relations
30
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
31
+
32
+ @@map("user_settings")
33
+ }
34
+
35
+ // One organization's overrides of the org-overridable system settings
36
+ // namespaces (#733): `{ "<namespace>": { "<field>": value } }`, only the fields
37
+ // each namespace's `org.schema` allows. An org table: FORCEd row-level security
38
+ // on org_id (`org_settings_org_isolation`, migration 0028_add_org_settings),
39
+ // reached only through `runInOrg`. Its own `version` for If-Match.
40
+ model OrgSettings {
41
+ id String @id @default(uuid()) @db.Uuid
42
+ orgId String @unique @map("org_id") @db.Uuid
43
+ value Json @db.JsonB
44
+ version Int @default(1)
45
+ updatedByUserId String? @map("updated_by_user_id") @db.Uuid
46
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
47
+
48
+ // Relations
49
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
50
+ updatedByUser User? @relation("OrgSettingsUpdater", fields: [updatedByUserId], references: [id], onDelete: SetNull)
51
+
52
+ @@map("org_settings")
53
+ }
@@ -0,0 +1,208 @@
1
+ // GENERATED by platform db compose — do not edit
2
+ // source: package:sharing.prisma
3
+
4
+ // =============================================================================
5
+ // Sharing: groups (PP-7.1, issue #728) and grants (PP-7.2, issue #729)
6
+ // =============================================================================
7
+ //
8
+ // A GROUP is a set of users INSIDE ONE ORGANIZATION that can own and share
9
+ // content (spec decision D6: groups are sharing groups, never tenants). Every
10
+ // row carries `org_id` and falls under the organization row-level-security
11
+ // model of `0025_org_scoped_rls`: the three tables `ENABLE` and `FORCE ROW
12
+ // LEVEL SECURITY` with one `<table>_org_isolation` policy each (migration
13
+ // `0026_add_groups`, listed in `rls-policies.json`).
14
+ //
15
+ // A member row and an invite row reach their group through the COMPOSITE key
16
+ // `(group_id, org_id)` -> `groups (id, org_id)`: a foreign-key check bypasses
17
+ // row-level security, so a plain key would let one organization store a
18
+ // reference to another organization's group, and the composite key also
19
+ // guarantees `group_members.org_id = groups.org_id`.
20
+ //
21
+ // `group_invites_pending_uniq_idx` (one PENDING invite per group and address)
22
+ // exists only in migration SQL: it is a partial unique index, which Prisma
23
+ // cannot express. Never "fix" the drift with `@@unique([groupId, email])`: a
24
+ // declined or revoked address must be invitable again.
25
+ //
26
+ // The names below are part of the public contract once released.
27
+ // =============================================================================
28
+
29
+ // The member and invite `role` columns are plain text (migration
30
+ // `0037_open_sharing_vocabularies`): the vocabulary is the API's group-role
31
+ // registry (`registerGroupRole`), which ships `admin` (manage the group, its
32
+ // members and invites; full rights on group-owned resources), `editor` (write
33
+ // on group-owned resources, MemoriaHub "collaborator") and `viewer` (read).
34
+ // A row must outlive the registry that produced it, so there is no CHECK.
35
+
36
+ // @extensible — back-relations only, added with "extend model Group { ... }" in a fragment
37
+ model Group {
38
+ id String @id @default(uuid()) @db.Uuid
39
+ orgId String @map("org_id") @db.Uuid
40
+ name String
41
+ description String?
42
+ /// Apps keep extra fields here (spec: never add columns to package-owned tables).
43
+ metadata Json? @db.JsonB
44
+ createdById String? @map("created_by_id") @db.Uuid
45
+ // Optimistic concurrency for PATCH (If-Match), per docs/API.md.
46
+ version Int @default(1)
47
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
48
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
49
+
50
+ // Relations
51
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
52
+ createdBy User? @relation("GroupCreatedBy", fields: [createdById], references: [id], onDelete: SetNull)
53
+ members GroupMember[]
54
+ invites GroupInvite[]
55
+ grants Grant[]
56
+
57
+ // The target of the members' and invites' composite foreign keys.
58
+ @@unique([id, orgId])
59
+ @@index([orgId])
60
+ @@map("groups")
61
+ }
62
+
63
+ model GroupMember {
64
+ id String @id @default(uuid()) @db.Uuid
65
+ groupId String @map("group_id") @db.Uuid
66
+ userId String @map("user_id") @db.Uuid
67
+ // Denormalised for row-level security; equal to groups.org_id by the
68
+ // composite foreign key below.
69
+ orgId String @map("org_id") @db.Uuid
70
+ /// A registered group role id (`registerGroupRole`). A plain string: a row must outlive the registry that produced it.
71
+ role String @default("viewer")
72
+ addedById String? @map("added_by_id") @db.Uuid
73
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
74
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
75
+
76
+ // Relations
77
+ //
78
+ // Composite: (group_id, org_id) -> groups (id, org_id).
79
+ group Group @relation(fields: [groupId, orgId], references: [id, orgId], onDelete: Cascade)
80
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
81
+ user User @relation("GroupMemberUser", fields: [userId], references: [id], onDelete: Cascade)
82
+ addedBy User? @relation("GroupMemberAddedBy", fields: [addedById], references: [id], onDelete: SetNull)
83
+
84
+ @@unique([groupId, userId])
85
+ @@index([userId])
86
+ @@index([orgId])
87
+ @@map("group_members")
88
+ }
89
+
90
+ model GroupInvite {
91
+ id String @id @default(uuid()) @db.Uuid
92
+ groupId String @map("group_id") @db.Uuid
93
+ orgId String @map("org_id") @db.Uuid
94
+ // Stored lower-cased. At most one PENDING invite per (group, email):
95
+ // group_invites_pending_uniq_idx, raw SQL only.
96
+ email String
97
+ /// The role the invitee gets on acceptance: a registered group role id. A plain string.
98
+ role String @default("viewer")
99
+ invitedById String? @map("invited_by_id") @db.Uuid
100
+ // NULL: no expiry. Expiry is evaluated when the invite is read; no sweep.
101
+ expiresAt DateTime? @map("expires_at") @db.Timestamptz
102
+ acceptedAt DateTime? @map("accepted_at") @db.Timestamptz
103
+ acceptedById String? @map("accepted_by_id") @db.Uuid
104
+ declinedAt DateTime? @map("declined_at") @db.Timestamptz
105
+ revokedAt DateTime? @map("revoked_at") @db.Timestamptz
106
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
107
+
108
+ // Relations
109
+ //
110
+ // Composite: (group_id, org_id) -> groups (id, org_id).
111
+ group Group @relation(fields: [groupId, orgId], references: [id, orgId], onDelete: Cascade)
112
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
113
+ invitedBy User? @relation("GroupInviteInvitedBy", fields: [invitedById], references: [id], onDelete: SetNull)
114
+ acceptedBy User? @relation("GroupInviteAcceptedBy", fields: [acceptedById], references: [id], onDelete: SetNull)
115
+
116
+ @@index([email])
117
+ @@index([groupId])
118
+ @@index([orgId])
119
+ @@map("group_invites")
120
+ }
121
+
122
+ // =============================================================================
123
+ // Sharing: grants (PP-7.2, issue #729)
124
+ // =============================================================================
125
+ //
126
+ // A GRANT shares ONE record of a registered resource type with a user, a
127
+ // group of the same organization or (#730) a link, with a role and an
128
+ // optional expiry. The resource is POLYMORPHIC, `(resource_type,
129
+ // resource_id)`, with no foreign key: the platform cannot know app tables.
130
+ // Integrity comes from `GrantsService.deleteForResources()` (called inside the
131
+ // app's delete transaction) and the `sharing.grants.prune` job.
132
+ //
133
+ // Revocation is SOFT (`revoked_at`, `revoked_by_id`) so the audit trail
134
+ // survives; the prune job deletes revoked and expired rows after the
135
+ // retention period.
136
+ //
137
+ // Raw SQL only (migration `0027_add_grants`, intentional schema drift):
138
+ // grants_active_user_uniq_idx one ACTIVE grant per (resource, user)
139
+ // grants_active_group_uniq_idx one ACTIVE grant per (resource, group)
140
+ // grants_grantee_consistency_check the grantee columns match grantee_kind
141
+ // grants_active_ref_uniq_idx one ACTIVE grant per (resource, app kind, reference) (0037)
142
+ // Never "fix" the drift with `@@unique`, and never replace the indexes with a
143
+ // `findFirst` pre-check: the service upserts on them.
144
+ //
145
+ // The group grantee reaches its group through the COMPOSITE key
146
+ // `(grantee_group_id, org_id)` -> `groups (id, org_id)`, so a grant can never
147
+ // point at another organization's group (a foreign-key check bypasses
148
+ // row-level security).
149
+ // =============================================================================
150
+
151
+ // `grants.grantee_kind` is plain text (migration `0037_open_sharing_vocabularies`):
152
+ // the platform ships `user` (one user of the resource's organization), `group`
153
+ // (one group of the organization) and `link` (anyone holding the link token,
154
+ // #730), and an app registers more with `registerGranteeKind`. A grant of an
155
+ // app kind stores its reference in `grantee_ref` and leaves the three
156
+ // built-in grantee columns NULL; `grants_grantee_consistency_check` allows
157
+ // exactly those four shapes and `grants_active_ref_uniq_idx` keeps one ACTIVE
158
+ // grant per (resource, kind, reference).
159
+
160
+ // @extensible — back-relations only, added with "extend model Grant { ... }" in a fragment
161
+ // (an app's own annotation of a grant, for example an approval record). The table is
162
+ // org-owned with row-level security forced, so a table of the app's that holds `org_id`
163
+ // links with a composite foreign key `(grant_id, org_id)` -> `grants (id, org_id)`; the
164
+ // `@@unique([id, orgId])` below exists for it. The two partial unique indexes of the
165
+ // table stay raw SQL (never an `@@unique` on their columns).
166
+ model Grant {
167
+ id String @id @default(uuid()) @db.Uuid
168
+ orgId String @map("org_id") @db.Uuid
169
+ /// Registered resource type id. Permanent once rows exist, like a job type string.
170
+ resourceType String @map("resource_type")
171
+ resourceId String @map("resource_id") @db.Uuid
172
+ /// `user`, `group`, `link` or a registered app kind. A plain string: a row must outlive the registry that produced it.
173
+ granteeKind String @map("grantee_kind")
174
+ granteeUserId String? @map("grantee_user_id") @db.Uuid
175
+ granteeGroupId String? @map("grantee_group_id") @db.Uuid
176
+ /// The reference of an app-registered grantee kind (a domain, a team id), as its `validateGrantee` normalised it. NULL for the built-in kinds.
177
+ granteeRef String? @map("grantee_ref")
178
+ /// One of the resource type's registered roles. A plain string: a row must outlive the registry that produced it.
179
+ role String
180
+ /// Link grants only (#730): SHA-256 of the token, and the token encrypted with the platform secret cipher.
181
+ linkTokenHash String? @unique @map("link_token_hash")
182
+ linkTokenCiphertext String? @map("link_token_ciphertext") @db.Text
183
+ linkLabel String? @map("link_label")
184
+ expiresAt DateTime? @map("expires_at") @db.Timestamptz
185
+ revokedAt DateTime? @map("revoked_at") @db.Timestamptz
186
+ revokedById String? @map("revoked_by_id") @db.Uuid
187
+ grantedById String? @map("granted_by_id") @db.Uuid
188
+ /// Apps keep extra fields here (spec: never add columns to package-owned tables).
189
+ metadata Json? @db.JsonB
190
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
191
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
192
+
193
+ // Relations
194
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
195
+ granteeUser User? @relation("GrantGranteeUser", fields: [granteeUserId], references: [id], onDelete: Cascade)
196
+ // Composite: (grantee_group_id, org_id) -> groups (id, org_id).
197
+ granteeGroup Group? @relation(fields: [granteeGroupId, orgId], references: [id, orgId], onDelete: Cascade)
198
+ revokedBy User? @relation("GrantRevokedBy", fields: [revokedById], references: [id], onDelete: SetNull)
199
+ grantedBy User? @relation("GrantGrantedBy", fields: [grantedById], references: [id], onDelete: SetNull)
200
+
201
+ @@index([resourceType, resourceId])
202
+ @@index([granteeUserId])
203
+ @@index([granteeGroupId])
204
+ @@index([orgId])
205
+ // The target of an app table's composite foreign key (id, org_id); see the note above the model.
206
+ @@unique([id, orgId])
207
+ @@map("grants")
208
+ }
@@ -0,0 +1,118 @@
1
+ // GENERATED by platform db compose — do not edit
2
+ // source: package:storage.prisma
3
+
4
+ // =============================================================================
5
+ // Storage Objects
6
+ // =============================================================================
7
+
8
+ enum StorageObjectStatus {
9
+ pending // Upload initiated, awaiting chunks
10
+ uploading // Chunks being uploaded
11
+ processing // Post-upload processing in progress
12
+ ready // Available for use
13
+ failed // Upload or processing failed
14
+ }
15
+
16
+ // @extensible — back-relations only, added with "extend model StorageObject { ... }" in a fragment
17
+ model StorageObject {
18
+ id String @id @default(uuid()) @db.Uuid
19
+ name String // Original filename
20
+ size BigInt // Total size in bytes (BigInt for GB-scale)
21
+ mimeType String @map("mime_type")
22
+ storageKey String @unique @map("storage_key") // S3 object key
23
+ storageProvider String @default("s3") @map("storage_provider")
24
+ bucket String?
25
+ status StorageObjectStatus @default(pending)
26
+ s3UploadId String? @map("s3_upload_id") // S3 multipart upload ID
27
+ metadata Json? // JSONB for flexible metadata
28
+ uploadedById String? @map("uploaded_by_id") @db.Uuid
29
+ // The organization the object belongs to (#725). NOT NULL, row-level
30
+ // security forced (policy `storage_objects_org_isolation`, see
31
+ // `0025_org_scoped_rls`). `Restrict`: an organization with objects cannot be
32
+ // deleted until they are purged deliberately.
33
+ orgId String @map("org_id") @db.Uuid
34
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
35
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
36
+
37
+ // Relations
38
+ uploadedBy User? @relation("UserStorageObjects", fields: [uploadedById], references: [id], onDelete: SetNull)
39
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Restrict)
40
+ chunks StorageObjectChunk[]
41
+
42
+ // The target of the chunks' composite foreign key (object_id, org_id): a
43
+ // reference between two org-owned tables is composite, because a foreign-key
44
+ // check bypasses row-level security (ADR 0002 D5).
45
+
46
+ // composed from app:kvox.graph.prisma
47
+ // Back-relations onto the platform's StorageObject (an `extend model` block holds back-relation fields only).
48
+ // Connected Knowledge (epic #344, issue #351). SetNull — an import's
49
+ // evidence row is a citation into the imported file, and survives losing
50
+ // the object the same way a transcript/note evidence pointer does. See
51
+ // the block comment above `KgEvidence`.
52
+ kgEvidenceImports KgEvidence[]
53
+
54
+ // #386 — a rendered graph export (`managed_by: 'graph'`). Restrict, the
55
+ // `noteExportFiles` reasoning: only the export sweep / `kg.purge`, clearing
56
+ // the `kg_exports` reference first, may remove the file.
57
+ kgExportFiles KgExport[]
58
+
59
+ // composed from app:kvox.notes.prisma
60
+ // Back-relations onto the platform's StorageObject (an `extend model` block holds back-relation fields only).
61
+ // Two back-relations from notes (issue #48, epic #45), the identical
62
+ // Restrict-FK reasoning as the five transcript ones above: only
63
+ // `note.purge`/`notes.housekeeping` deleting the referencing row first may
64
+ // ever remove one of these objects.
65
+ notesAsSourceObject Note[] @relation("NoteSourceObject")
66
+ noteExportFiles NoteExport[] @relation("NoteExportObject")
67
+
68
+ // composed from app:kvox.transcripts.prisma
69
+ // Back-relations onto the platform's StorageObject (an `extend model` block holds back-relation fields only).
70
+ // Five back-relations from transcripts (issue #24, epic #19), one per
71
+ // `storage_objects` FK the transcript tables hold. Every one of those FKs
72
+ // is `onDelete: Restrict` — see the block comment above the `Transcript`
73
+ // model for why a managed object like these may only ever be removed by
74
+ // `transcript.purge` deleting the referencing row first, never by an
75
+ // unrelated storage cleanup deleting the object out from under it. List
76
+ // types, not optional singulars, because nothing here declares these FKs
77
+ // `@unique` — a future column reusing an existing object (unlikely, but
78
+ // not schema-prevented) would still be representable.
79
+ transcriptsAsSource Transcript[] @relation("TranscriptSourceObject")
80
+ transcriptsAsPlayback Transcript[] @relation("TranscriptPlaybackObject")
81
+ transcriptsAsRawResult Transcript[] @relation("TranscriptRawResultObject")
82
+ transcriptVersionSnapshots TranscriptVersion[] @relation("TranscriptVersionSnapshotObject")
83
+ transcriptExportFiles TranscriptExport[] @relation("TranscriptExportObject")
84
+
85
+ @@unique([id, orgId])
86
+ @@index([uploadedById])
87
+ @@index([status])
88
+ @@index([createdAt])
89
+ // The policy filter `org_id = X` leads every query; these serve the hot paths
90
+ // behind it (a user's list, newest first; the cleanup sweep by status).
91
+ @@index([orgId, uploadedById, createdAt])
92
+ @@index([orgId, status])
93
+ @@map("storage_objects")
94
+ }
95
+
96
+ model StorageObjectChunk {
97
+ id String @id @default(uuid()) @db.Uuid
98
+ objectId String @map("object_id") @db.Uuid
99
+ partNumber Int @map("part_number") // S3 part number (1-10000)
100
+ eTag String @map("e_tag") // S3 ETag for verification
101
+ size BigInt // Chunk size in bytes
102
+ // The organization of the parent object (#725), carried here because a policy
103
+ // cannot join through the parent. NOT NULL, row-level security forced.
104
+ orgId String @map("org_id") @db.Uuid
105
+ uploadedAt DateTime @default(now()) @map("uploaded_at") @db.Timestamptz
106
+
107
+ // Relations
108
+ //
109
+ // Composite: (object_id, org_id) -> storage_objects (id, org_id), so a chunk
110
+ // can never name another organization's object. Cascade, as before.
111
+ object StorageObject @relation(fields: [objectId, orgId], references: [id, orgId], onDelete: Cascade)
112
+ org Organization @relation(fields: [orgId], references: [id], onDelete: Restrict)
113
+
114
+ @@unique([objectId, partNumber])
115
+ @@index([objectId])
116
+ @@index([orgId, objectId])
117
+ @@map("storage_object_chunks")
118
+ }
package/package.json CHANGED
@@ -1 +1,112 @@
1
- {"name":"@marinoscar/kvox-eval","version":"0.0.0-bootstrap","description":"Name reservation.","license":"MIT"}
1
+ {
2
+ "name": "@marinoscar/kvox-eval",
3
+ "version": "0.1.0-next.0",
4
+ "description": "The KVox knowledge-graph and Ask evaluation: the synthetic golden set, its schemas, the scorers, the report and the live runners, over the model port only (CommonJS, with the kvox-eval CLI).",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "engines": {
8
+ "node": ">=24"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/marinoscar/kvox.git",
13
+ "directory": "packages/kvox-eval"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "provenance": true
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "bin": {
22
+ "kvox-eval": "./dist/cli/main.js"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./ask-run": {
30
+ "types": "./dist/ask-run/index.d.ts",
31
+ "default": "./dist/ask-run/index.js"
32
+ },
33
+ "./fixtures": {
34
+ "types": "./dist/fixtures/index.d.ts",
35
+ "default": "./dist/fixtures/index.js"
36
+ },
37
+ "./parity": {
38
+ "types": "./dist/parity/index.d.ts",
39
+ "default": "./dist/parity/index.js"
40
+ },
41
+ "./package.json": "./package.json"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "fixtures",
46
+ "parity",
47
+ "host",
48
+ "!host/prisma.config.ts",
49
+ "!host/.stamp",
50
+ "README.md",
51
+ "CHANGELOG.md",
52
+ "LICENSE"
53
+ ],
54
+ "scripts": {
55
+ "prepare:host": "node scripts/prepare-host.mjs",
56
+ "prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && node scripts/prepare-host.mjs",
57
+ "prepack": "node ../../scripts/kvox-packages/copy-license.mjs",
58
+ "build": "tsc -p tsconfig.build.json",
59
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
60
+ "pretypecheck": "node scripts/prepare-host.mjs",
61
+ "typecheck": "tsc --noEmit",
62
+ "predocs": "node scripts/prepare-host.mjs",
63
+ "docs": "typedoc --options typedoc.json",
64
+ "pretest": "node scripts/prepare-host.mjs",
65
+ "test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js -c test/jest.config.js",
66
+ "pretest:run": "node scripts/prepare-host.mjs",
67
+ "test:run": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js -c test/jest.config.js --ci"
68
+ },
69
+ "peerDependencies": {
70
+ "@electric-sql/pglite": "0.5.10",
71
+ "@electric-sql/pglite-pgvector": "0.0.11",
72
+ "@electric-sql/pglite-socket": "0.2.13",
73
+ "@marinoscar/kvox-ai": ">=0.0.0-0 || >=0.1.0-0",
74
+ "@marinoscar/kvox-api": ">=0.0.0-0 || >=0.1.0-0",
75
+ "@marinoscar/kvox-contract": ">=0.0.0-0 || >=0.1.0-0",
76
+ "@marinoscar/platform-api": "0.1.0-next.5",
77
+ "@nestjs/common": "^11.1.12",
78
+ "@nestjs/core": "^11.1.12",
79
+ "@prisma/adapter-pg": "^7.8.0",
80
+ "@prisma/client": "^7.8.0",
81
+ "pg": "^8.23.0",
82
+ "reflect-metadata": "^0.2.2",
83
+ "rxjs": "^7.8.1",
84
+ "zod": "^4.4.3"
85
+ },
86
+ "devDependencies": {
87
+ "@electric-sql/pglite": "0.5.10",
88
+ "@electric-sql/pglite-pgvector": "0.0.11",
89
+ "@electric-sql/pglite-socket": "0.2.13",
90
+ "@marinoscar/kvox-ai": "0.1.0-next.0",
91
+ "@marinoscar/kvox-api": "0.1.0-next.0",
92
+ "@marinoscar/kvox-contract": "0.1.0-next.0",
93
+ "@marinoscar/kvox-db": "0.1.0-next.0",
94
+ "@marinoscar/platform-api": "0.1.0-next.5",
95
+ "@marinoscar/platform-db": "0.1.0-next.5",
96
+ "@nestjs/common": "^11.1.12",
97
+ "@nestjs/core": "^11.1.12",
98
+ "@prisma/adapter-pg": "^7.8.0",
99
+ "@prisma/client": "^7.8.0",
100
+ "@prisma/config": "^7.8.0",
101
+ "@types/jest": "^30.0.0",
102
+ "@types/node": "^22.15.32",
103
+ "jest": "^30.4.2",
104
+ "pg": "^8.23.0",
105
+ "prisma": "^7.8.0",
106
+ "reflect-metadata": "^0.2.2",
107
+ "rxjs": "^7.8.1",
108
+ "ts-jest": "^29.4.12",
109
+ "typescript": "^6.0.3",
110
+ "zod": "^4.4.3"
111
+ }
112
+ }