@opengeni/db 3.7.4 → 3.8.2-canary.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 (77) hide show
  1. package/dist/automations.d.ts +4 -0
  2. package/dist/canonical-human-identities.js +3 -3
  3. package/dist/{chunk-O56DM5GZ.js → chunk-53A2PEHT.js} +328 -31
  4. package/dist/chunk-53A2PEHT.js.map +1 -0
  5. package/dist/{chunk-SZAWDXQC.js → chunk-5S4BQAHX.js} +3 -3
  6. package/dist/{chunk-S3TDDCS2.js → chunk-CITYUGMW.js} +3 -3
  7. package/dist/{chunk-4NAR7FBA.js → chunk-F5YOZEYQ.js} +49 -1
  8. package/dist/chunk-F5YOZEYQ.js.map +1 -0
  9. package/dist/{chunk-F6PBS6WE.js → chunk-HZV7O6JR.js} +2 -2
  10. package/dist/{chunk-5NNCGFQY.js → chunk-RLQVPOVR.js} +2 -2
  11. package/dist/{chunk-DZCYW2WT.js → chunk-UKOGHUGC.js} +2 -2
  12. package/dist/{chunk-US4IS6IV.js → chunk-X6TO5HII.js} +2 -2
  13. package/dist/{chunk-U4WPPEBH.js → chunk-Y53WEFYB.js} +2 -2
  14. package/dist/connection-token-resolver.d.ts +4 -0
  15. package/dist/editable-artifact-durable-export.js +2 -2
  16. package/dist/editable-artifacts.js +3 -3
  17. package/dist/index.d.ts +164 -14
  18. package/dist/index.js +7327 -5442
  19. package/dist/index.js.map +1 -1
  20. package/dist/insights.d.ts +9 -0
  21. package/dist/managed-auth-session-sets.js +3 -3
  22. package/dist/model-catalog.d.ts +153 -0
  23. package/dist/new-session-drafts.d.ts +12 -0
  24. package/dist/organization-membership-lifecycle.d.ts +8 -1
  25. package/dist/organization-model-providers.d.ts +101 -0
  26. package/dist/pack-components.d.ts +1 -0
  27. package/dist/pr-review.d.ts +9 -0
  28. package/dist/provision-roles.js +1 -1
  29. package/dist/runtime-posture.d.ts +7 -7
  30. package/dist/schema.d.ts +989 -2
  31. package/dist/schema.js +11 -1
  32. package/dist/session-background-commands.js +3 -3
  33. package/dist/session-control.d.ts +35 -0
  34. package/dist/session-queue-commands.d.ts +17 -0
  35. package/dist/session-tenancy.js +3 -3
  36. package/dist/video-generation.js +3 -3
  37. package/dist/xai-subscription.d.ts +8 -0
  38. package/drizzle/0387_bound_host_export_session_payloads.sql +165 -0
  39. package/drizzle/0388_sandbox_provider_deadline_interactions.sql +491 -0
  40. package/drizzle/0389_model_catalog_and_gateway_custom_models.sql +241 -0
  41. package/drizzle/0390_organization_model_provider_connections.sql +197 -0
  42. package/drizzle/0391_sandbox_provider_deadline_interaction_followup.sql +295 -0
  43. package/drizzle/0392_context_compaction_pending_observability.sql +198 -0
  44. package/drizzle/0393_workspace_memory_and_learning_defaults.sql +102 -0
  45. package/drizzle/0394_session_selected_skill_activation.sql +20 -0
  46. package/drizzle/0395_scheduled_task_unclaimed_occurrence_invalidation.sql +154 -0
  47. package/drizzle/0396_model_call_equivalent_credit_cost.sql +28 -0
  48. package/drizzle/0397_sandbox_deadline_rotation_preemption.sql +113 -0
  49. package/drizzle/0398_organization_workspace_management_entry.sql +206 -0
  50. package/drizzle/0399_additional_managed_organization_creation.sql +691 -0
  51. package/package.json +6 -6
  52. package/src/automations.ts +9 -1
  53. package/src/connection-token-resolver.ts +12 -0
  54. package/src/index.ts +1551 -272
  55. package/src/insights-model-bundle.ts +54 -5
  56. package/src/insights.ts +53 -7
  57. package/src/model-catalog.ts +682 -0
  58. package/src/new-session-drafts.ts +66 -21
  59. package/src/organization-membership-lifecycle.ts +47 -5
  60. package/src/organization-model-providers.ts +614 -0
  61. package/src/pack-components.ts +15 -2
  62. package/src/pr-review.ts +19 -0
  63. package/src/provision-roles.ts +2 -0
  64. package/src/runtime-posture.ts +48 -0
  65. package/src/schema.ts +348 -32
  66. package/src/session-control.ts +170 -0
  67. package/src/session-queue-commands.ts +157 -82
  68. package/src/xai-subscription.ts +66 -14
  69. package/dist/chunk-4NAR7FBA.js.map +0 -1
  70. package/dist/chunk-O56DM5GZ.js.map +0 -1
  71. /package/dist/{chunk-SZAWDXQC.js.map → chunk-5S4BQAHX.js.map} +0 -0
  72. /package/dist/{chunk-S3TDDCS2.js.map → chunk-CITYUGMW.js.map} +0 -0
  73. /package/dist/{chunk-F6PBS6WE.js.map → chunk-HZV7O6JR.js.map} +0 -0
  74. /package/dist/{chunk-5NNCGFQY.js.map → chunk-RLQVPOVR.js.map} +0 -0
  75. /package/dist/{chunk-DZCYW2WT.js.map → chunk-UKOGHUGC.js.map} +0 -0
  76. /package/dist/{chunk-US4IS6IV.js.map → chunk-X6TO5HII.js.map} +0 -0
  77. /package/dist/{chunk-U4WPPEBH.js.map → chunk-Y53WEFYB.js.map} +0 -0
@@ -536,9 +536,11 @@ async function grantAppRoleIfSchemaExists(
536
536
  "resolve_workspace_codex_subscription_source(uuid,uuid)",
537
537
  "list_organization_workspace_ids(uuid)",
538
538
  "organization_workspace_command(jsonb)",
539
+ "authorize_organization_shared_workspace_administration(uuid,uuid,text)",
539
540
  "resolve_organization_workspace_removal_subject(uuid,text,uuid)",
540
541
  "prepare_organization_workspace_member_removal(jsonb)",
541
542
  "record_organization_workspace_member_removal(jsonb,uuid,uuid)",
543
+ "create_additional_managed_organization(text,text,text,text,uuid)",
542
544
  "create_managed_organization(text,text,text,uuid)",
543
545
  "assert_organization_shared_workspace_administrator(uuid,uuid,text)",
544
546
  "open_organization_shared_workspace_administration_capability(uuid,uuid,text)",
@@ -81,6 +81,8 @@ const KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES = [
81
81
  ] as const;
82
82
  const MANAGED_HUMAN_PERSONAL_WORKSPACE_ROUTINE =
83
83
  "ensure_managed_human_personal_workspace(uuid, text, uuid)";
84
+ const ADDITIONAL_ORGANIZATION_CREATION_ROUTINE =
85
+ "create_additional_managed_organization(text, text, text, text, uuid)";
84
86
  const ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES = [
85
87
  "list_self_organization_memberships(text)",
86
88
  "list_self_organization_invitations(text)",
@@ -94,9 +96,11 @@ const ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES = [
94
96
  "resolve_workspace_codex_subscription_source(uuid, uuid)",
95
97
  "list_organization_workspace_ids(uuid)",
96
98
  "organization_workspace_command(jsonb)",
99
+ "authorize_organization_shared_workspace_administration(uuid, uuid, text)",
97
100
  "resolve_organization_workspace_removal_subject(uuid, text, uuid)",
98
101
  "prepare_organization_workspace_member_removal(jsonb)",
99
102
  "record_organization_workspace_member_removal(jsonb, uuid, uuid)",
103
+ ADDITIONAL_ORGANIZATION_CREATION_ROUTINE,
100
104
  "create_managed_organization(text, text, text, uuid)",
101
105
  "assert_organization_shared_workspace_administrator(uuid, uuid, text)",
102
106
  "open_organization_shared_workspace_administration_capability(uuid, uuid, text)",
@@ -154,6 +158,10 @@ const ORGANIZATION_MEMBERSHIP_LIFECYCLE_AUTHORITY_TABLES = [
154
158
  "organization_workspace_operation_receipts",
155
159
  "self_service_organization_setup_receipts",
156
160
  ] as const;
161
+ const ADDITIONAL_ORGANIZATION_CREATION_AUTHORITY_TABLES = [
162
+ ...ORGANIZATION_MEMBERSHIP_LIFECYCLE_AUTHORITY_TABLES,
163
+ "additional_organization_creation_receipts",
164
+ ] as const;
157
165
  const PRIVATE_SESSION_CREATE_POLICY_ROUTINE = "get_private_session_create_policy(uuid, uuid, text)";
158
166
  const ORGANIZATION_PRIVATE_SESSION_SETTINGS_READ_ROUTINE =
159
167
  "get_organization_private_session_settings(uuid, text)";
@@ -489,6 +497,8 @@ const TENANCY_BACKFILL_ACTIVATION_EVIDENCE_ROUTINE =
489
497
  "check_tenancy_backfill_activation_evidence(uuid)";
490
498
  const GREENFIELD_SESSION_TENANCY_ACTIVATION_ROUTINE =
491
499
  "activate_greenfield_session_tenancy_from_setup(text)";
500
+ const ADDITIONAL_ORGANIZATION_SESSION_TENANCY_ACTIVATION_ROUTINE =
501
+ "activate_session_tenancy_from_additional_organization(uuid)";
492
502
  const SESSION_VISIBILITY_LIFECYCLE_CAPABILITY_ROUTINE =
493
503
  "session_visibility_lifecycle_capability_held()";
494
504
  const PRIVATE_SESSION_CREATE_CAPABILITY_ROUTINES = [
@@ -597,6 +607,7 @@ const RUNTIME_TARGET_SCHEMA_PUBLIC_POLICY_PREDICATE_ROUTINE_SET = new Set<string
597
607
 
598
608
  /** Owner-internal helpers that must exist but must never be callable by the runtime role. */
599
609
  export const RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES = [
610
+ ADDITIONAL_ORGANIZATION_SESSION_TENANCY_ACTIVATION_ROUTINE,
600
611
  AUTOMATIC_SESSION_TITLE_QUARANTINE_FENCE_ROUTINE,
601
612
  ORGANIZATION_PRIVATE_SESSIONS_ENABLED_ROUTINE,
602
613
  GREENFIELD_SESSION_TENANCY_ACTIVATION_ROUTINE,
@@ -620,6 +631,7 @@ const RUNTIME_TARGET_SCHEMA_INVOKER_ROUTINE_SET = new Set<string>(
620
631
  * commit as the migration so startup cannot silently accept an unreviewed gap.
621
632
  */
622
633
  export const FORCE_RLS_TABLES = [
634
+ "additional_organization_creation_receipts",
623
635
  "agent_run_states",
624
636
  "api_keys",
625
637
  "attached_browser_devices",
@@ -786,6 +798,9 @@ export const FORCE_RLS_TABLES = [
786
798
  "organization_membership_lifecycle_events",
787
799
  "organization_membership_operation_receipts",
788
800
  "organization_memberships",
801
+ "organization_model_provider_connection_operations",
802
+ "organization_model_provider_connections",
803
+ "organization_model_provider_custom_models",
789
804
  "organization_private_session_setting_events",
790
805
  "organization_private_session_settings",
791
806
  "organization_profile_events",
@@ -883,6 +898,7 @@ export const FORCE_RLS_TABLES = [
883
898
  "session_system_update_outbox",
884
899
  "session_system_updates",
885
900
  "session_tenancy_activations",
901
+ "session_tenancy_additional_organization_activation_evidence",
886
902
  "session_tenancy_greenfield_activation_evidence",
887
903
  "session_turn_attempts",
888
904
  "session_turn_startup_milestones",
@@ -942,6 +958,7 @@ export const FORCE_RLS_TABLES = [
942
958
  "workspace_captures",
943
959
  "workspace_codex_subscription_preferences",
944
960
  "workspace_control_events",
961
+ "workspace_gateway_custom_models",
945
962
  "workspace_inference_controls",
946
963
  "workspace_instruction_policy_activation_events",
947
964
  "workspace_instruction_policy_deactivation_events",
@@ -981,6 +998,7 @@ export const NON_RLS_RUNTIME_TABLES = [
981
998
  "auth_users",
982
999
  "auth_verifications",
983
1000
  "automation_webhook_endpoints",
1001
+ "deployment_model_catalog",
984
1002
  "integration_oauth_clients",
985
1003
  "managed_accounts",
986
1004
  "nested_agent_depth_configuration",
@@ -1067,6 +1085,9 @@ export const RUNTIME_FULL_DML_TABLES = [
1067
1085
  "model_call_facts",
1068
1086
  "new_session_drafts",
1069
1087
  "organization_codex_rotation_settings",
1088
+ "organization_model_provider_connection_operations",
1089
+ "organization_model_provider_connections",
1090
+ "organization_model_provider_custom_models",
1070
1091
  "pack_installation_components",
1071
1092
  "pack_installations",
1072
1093
  "pr_review_app_registrations",
@@ -1135,6 +1156,7 @@ export const RUNTIME_FULL_DML_TABLES = [
1135
1156
  "workspace_captures",
1136
1157
  "workspace_codex_subscription_preferences",
1137
1158
  "workspace_control_events",
1159
+ "workspace_gateway_custom_models",
1138
1160
  "workspace_inference_controls",
1139
1161
  "workspace_instruction_policy_heads",
1140
1162
  "workspace_memberships",
@@ -1156,6 +1178,7 @@ export const RUNTIME_READ_ONLY_TABLES = [
1156
1178
  "company_profile_activation_events",
1157
1179
  "company_profile_heads",
1158
1180
  "company_profile_snapshots",
1181
+ "deployment_model_catalog",
1159
1182
  "document_authority_reclassifications",
1160
1183
  "knowledge_lifecycle_events",
1161
1184
  "knowledge_memory_lifecycle_events",
@@ -1270,6 +1293,7 @@ export const RUNTIME_READ_INSERT_UPDATE_TABLES = [
1270
1293
  * The ordinary application role must have no direct table privileges on them.
1271
1294
  */
1272
1295
  export const PROTECTED_NO_DIRECT_DML_TABLES = [
1296
+ "additional_organization_creation_receipts",
1273
1297
  "canonical_human_identities",
1274
1298
  "canonical_human_identity_operations",
1275
1299
  "canonical_human_identity_subjects",
@@ -1359,6 +1383,7 @@ export const PROTECTED_NO_DIRECT_DML_TABLES = [
1359
1383
  "session_attempt_personal_document_snapshots",
1360
1384
  "session_attempt_personal_resource_admissions",
1361
1385
  "session_attempt_personal_resource_snapshots",
1386
+ "session_tenancy_additional_organization_activation_evidence",
1362
1387
  "session_tenancy_greenfield_activation_evidence",
1363
1388
  "session_variable_set_attachments",
1364
1389
  "session_visibility_write_capabilities",
@@ -2295,6 +2320,29 @@ export function evaluateRuntimeDatabasePosture(
2295
2320
  );
2296
2321
  }
2297
2322
  }
2323
+ } else if (routine.name === ADDITIONAL_ORGANIZATION_CREATION_ROUTINE) {
2324
+ const missingAuthorityTables = ADDITIONAL_ORGANIZATION_CREATION_AUTHORITY_TABLES.filter(
2325
+ (tableName) => !tableByName.has(tableName),
2326
+ );
2327
+ if (missingAuthorityTables.length > 0) {
2328
+ violations.push(
2329
+ `target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
2330
+ );
2331
+ } else {
2332
+ const authorityTables = ADDITIONAL_ORGANIZATION_CREATION_AUTHORITY_TABLES.map(
2333
+ (tableName) => tableByName.get(tableName)!,
2334
+ );
2335
+ const authorityOwners = new Set(authorityTables.map((table) => table.owner));
2336
+ if (authorityOwners.size !== 1) {
2337
+ violations.push(
2338
+ `target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
2339
+ );
2340
+ } else if (routine.owner !== authorityTables[0]!.owner) {
2341
+ violations.push(
2342
+ `target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
2343
+ );
2344
+ }
2345
+ }
2298
2346
  } else if (
2299
2347
  (ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES as readonly string[]).includes(routine.name)
2300
2348
  ) {