@opengeni/db 3.1.0-canary.0 → 3.2.0-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 (57) hide show
  1. package/dist/canonical-human-identities.js +3 -3
  2. package/dist/{chunk-NMUBV7Z5.js → chunk-2EH4WRHL.js} +2 -2
  3. package/dist/{chunk-NJVZPWXY.js → chunk-2PRS4J5Q.js} +3 -3
  4. package/dist/{chunk-TIKF3KTI.js → chunk-6HMM2R5T.js} +11 -4
  5. package/dist/chunk-6HMM2R5T.js.map +1 -0
  6. package/dist/{chunk-SCPUJS53.js → chunk-AZHW7R5V.js} +17 -9
  7. package/dist/chunk-AZHW7R5V.js.map +1 -0
  8. package/dist/{chunk-EULAN2NP.js → chunk-E6CLMKEE.js} +2 -2
  9. package/dist/{chunk-PR2WMLOQ.js → chunk-KRLPEMLH.js} +12 -1
  10. package/dist/chunk-KRLPEMLH.js.map +1 -0
  11. package/dist/{chunk-ZZ5LJEFX.js → chunk-NAB6FKFN.js} +3 -3
  12. package/dist/{chunk-OF5OBB76.js → chunk-UZNXG44K.js} +56 -5
  13. package/dist/chunk-UZNXG44K.js.map +1 -0
  14. package/dist/connection-tenancy-backfill.d.ts +44 -0
  15. package/dist/database.d.ts +4 -4
  16. package/dist/editable-artifact-durable-export.js +2 -2
  17. package/dist/editable-artifacts.js +3 -3
  18. package/dist/index.d.ts +12 -1
  19. package/dist/index.js +1384 -1078
  20. package/dist/index.js.map +1 -1
  21. package/dist/provision-roles.js +1 -1
  22. package/dist/runtime-posture.d.ts +9 -2
  23. package/dist/schema.js +1 -1
  24. package/dist/session-background-commands.js +3 -3
  25. package/dist/session-queue-commands.d.ts +2 -0
  26. package/dist/session-tenancy.js +3 -3
  27. package/dist/slack-routing.d.ts +115 -0
  28. package/dist/slack-user-link-access.d.ts +27 -0
  29. package/dist/video-generation.js +3 -3
  30. package/drizzle/0342_slack_route_prompt_single_pending.sql +32 -0
  31. package/drizzle/0343_personal_document_force_rls_lock_repair.sql +146 -0
  32. package/drizzle/0344_private_session_visibility_transition_gate.sql +85 -0
  33. package/drizzle/0345_tenant_scoped_session_tenancy_fence.sql +2839 -0
  34. package/drizzle/0346_document_migration_audit_surface.sql +454 -0
  35. package/drizzle/0347_connection_authority_convergence_evidence.sql +396 -0
  36. package/package.json +6 -6
  37. package/src/connection-tenancy-backfill.ts +86 -0
  38. package/src/database.ts +12 -0
  39. package/src/index.ts +25 -2
  40. package/src/organization-membership-lifecycle.ts +15 -5
  41. package/src/provision-roles.ts +28 -0
  42. package/src/runtime-posture.ts +31 -1
  43. package/src/schema.ts +13 -0
  44. package/src/session-queue-commands.ts +4 -1
  45. package/src/session-realtime-context.ts +1 -3
  46. package/src/session-realtime-ledger.ts +6 -3
  47. package/src/session-tenancy.ts +7 -0
  48. package/src/slack-routing.ts +399 -1
  49. package/src/slack-user-link-access.ts +121 -10
  50. package/dist/chunk-OF5OBB76.js.map +0 -1
  51. package/dist/chunk-PR2WMLOQ.js.map +0 -1
  52. package/dist/chunk-SCPUJS53.js.map +0 -1
  53. package/dist/chunk-TIKF3KTI.js.map +0 -1
  54. /package/dist/{chunk-NMUBV7Z5.js.map → chunk-2EH4WRHL.js.map} +0 -0
  55. /package/dist/{chunk-NJVZPWXY.js.map → chunk-2PRS4J5Q.js.map} +0 -0
  56. /package/dist/{chunk-EULAN2NP.js.map → chunk-E6CLMKEE.js.map} +0 -0
  57. /package/dist/{chunk-ZZ5LJEFX.js.map → chunk-NAB6FKFN.js.map} +0 -0
@@ -22,6 +22,50 @@ export type ConnectionAuthorityBackfillReport = {
22
22
  upgraded: number;
23
23
  moreLikely: boolean;
24
24
  };
25
+ export type ConnectionAuthorityConvergenceClassification = "connection_backfill_ready" | "membership_backfill_eligible" | "membership_lifecycle_review_required" | "external_subject_requires_classification" | "missing_login_identity" | "organization_identity_mismatch" | "missing_owner_workspace_membership" | "conflicting_authority_rows" | "legacy_shape_unrecognized";
26
+ export type ConnectionAuthorityConvergenceAction = "run_connection_backfill" | "run_membership_backfill_then_connection_backfill" | "review_membership_lifecycle_do_not_reactivate_automatically" | "classify_external_subject_then_migrate_via_authorized_connection_lifecycle" | "restore_login_identity_then_recheck" | "correct_organization_identity_through_supported_account_lifecycle_then_recheck" | "establish_owner_workspace_membership_through_supported_membership_lifecycle_then_recheck" | "repair_conflicting_connection_authority_rows_under_incident_procedure" | "repair_unrecognized_connection_authority_shape_under_incident_procedure";
27
+ export type ConnectionAuthorityConvergenceEvidence = {
28
+ schemaVersion: 1;
29
+ organizationId: string;
30
+ limit: number;
31
+ afterConnectionId: string | null;
32
+ items: Array<{
33
+ connectionId: string;
34
+ subjectId: string | null;
35
+ classification: ConnectionAuthorityConvergenceClassification;
36
+ action: ConnectionAuthorityConvergenceAction;
37
+ }>;
38
+ returned: number;
39
+ hasMore: boolean;
40
+ nextCursor: string | null;
41
+ /** Full-organization totals. They are deliberately independent of the page cursor. */
42
+ remaining: {
43
+ total: number;
44
+ autoRemediable: number;
45
+ manualReview: number;
46
+ byClassification: {
47
+ connectionBackfillReady: number;
48
+ membershipBackfillEligible: number;
49
+ membershipLifecycleReviewRequired: number;
50
+ externalSubjectRequiresClassification: number;
51
+ missingLoginIdentity: number;
52
+ organizationIdentityMismatch: number;
53
+ missingOwnerWorkspaceMembership: number;
54
+ conflictingAuthorityRows: number;
55
+ legacyShapeUnrecognized: number;
56
+ };
57
+ };
58
+ };
59
+ /**
60
+ * Read one bounded evidence page while also returning cursor-independent
61
+ * full-organization residual totals. The database routine holds a read-only,
62
+ * invocation-exact FORCE-RLS capability and never writes connection authority.
63
+ */
64
+ export declare function inspectOrganizationConnectionAuthorityConvergence(db: Database, input: {
65
+ organizationId: string;
66
+ limit?: number;
67
+ afterConnectionId?: string | null;
68
+ }): Promise<ConnectionAuthorityConvergenceEvidence>;
25
69
  /**
26
70
  * Full-population connection authority classification. Supplying a fresh run
27
71
  * key writes one immutable migration-0300 receipt and exact unresolved rows.
@@ -157,7 +157,7 @@ export declare function registerDbBinding(db: Database, binding: {
157
157
  userProfileLookup?: UserProfileLookup;
158
158
  }): void;
159
159
  export declare function setRlsContext(db: Database, context: RlsContext): Promise<void>;
160
- export declare function withRlsContext<T>(db: Database, context: RlsContext, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
160
+ export declare function withRlsContext<T>(db: Database, context: RlsContext, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig, sessionTenancyFence?: "shared" | "none"): Promise<T>;
161
161
  /**
162
162
  * Run one bounded database operation on a transaction-pinned backend.
163
163
  *
@@ -175,7 +175,7 @@ export declare function withWorkspaceRls<T>(db: Database, workspaceId: string, f
175
175
  */
176
176
  export declare function withSessionActivityRlsContext<T>(db: Database, context: RlsContext & {
177
177
  workspaceId: string;
178
- }, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
178
+ }, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig, fenceMode?: "shared" | "none"): Promise<T>;
179
179
  export declare function withWorkspaceSessionActivityRls<T>(db: Database, workspaceId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
180
180
  /**
181
181
  * Run one of several ordered workspace activity scopes inside a caller-owned
@@ -199,8 +199,8 @@ export declare function retryRlsPersistence<T>(db: Database, context: RlsContext
199
199
  * `session_pins` uses this helper so FORCE RLS rejects another member's rows
200
200
  * even if a future query accidentally omits its explicit subject predicate.
201
201
  */
202
- export declare function withWorkspaceSubjectRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
203
- export declare function withWorkspaceSubjectSessionActivityRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
202
+ export declare function withWorkspaceSubjectRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig, sessionTenancyFence?: "shared" | "none"): Promise<T>;
203
+ export declare function withWorkspaceSubjectSessionActivityRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: SessionActivityDatabase) => Promise<T>, transactionConfig?: PgTransactionConfig, fenceMode?: "shared" | "none"): Promise<T>;
204
204
  /** Apply and verify actor-private RLS on an already transaction-pinned handle. */
205
205
  export declare function setSubjectRlsContext(db: Database, subjectId: string): Promise<void>;
206
206
  export declare function withWorkspaceUsageLock<T>(db: Database, workspaceId: string, fn: (db: Database) => Promise<T>): Promise<T>;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-SCPUJS53.js";
5
- import "./chunk-PR2WMLOQ.js";
4
+ } from "./chunk-AZHW7R5V.js";
5
+ import "./chunk-KRLPEMLH.js";
6
6
  import "./chunk-PZ5AY32C.js";
7
7
 
8
8
  // src/editable-artifact-durable-export.ts
@@ -8,9 +8,9 @@ import {
8
8
  PostgresEditableArtifactStore,
9
9
  listEditableArtifactIdsForSession,
10
10
  touchEditableArtifactSessionLink
11
- } from "./chunk-NMUBV7Z5.js";
12
- import "./chunk-SCPUJS53.js";
13
- import "./chunk-PR2WMLOQ.js";
11
+ } from "./chunk-2EH4WRHL.js";
12
+ import "./chunk-AZHW7R5V.js";
13
+ import "./chunk-KRLPEMLH.js";
14
14
  import "./chunk-PZ5AY32C.js";
15
15
  export {
16
16
  EDITABLE_ARTIFACT_INTENT_MAX_BYTES,
package/dist/index.d.ts CHANGED
@@ -1899,6 +1899,16 @@ export type SlackInteraction = {
1899
1899
  * one-time onboarding hint. `null` means the decision is unresolved.
1900
1900
  */
1901
1901
  firstTaskHint: boolean | null;
1902
+ /**
1903
+ * The routed workspace's name, frozen when the interaction bound.
1904
+ *
1905
+ * Null means "do not say where this went": either routing is off, or the
1906
+ * person had exactly one workspace to begin with, and a constant footer on
1907
+ * every message would be noise. It is frozen rather than looked up at post
1908
+ * time because a rename between the original post and a reconciliation would
1909
+ * make the ledger's byte comparison raise.
1910
+ */
1911
+ routedWorkspaceLabel: string | null;
1902
1912
  progressCount: number;
1903
1913
  terminalDeliveryState: "open" | "completed" | "failed" | "cancelled" | "blocked";
1904
1914
  createdAt: Date;
@@ -2017,8 +2027,9 @@ export declare function releaseSlackInteractionInbox(db: Database, input: {
2017
2027
  errorCode: string;
2018
2028
  retryAt: Date;
2019
2029
  }): Promise<boolean>;
2020
- export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "initiatingSlackUserId" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "firstTaskHint" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt"> & {
2030
+ export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "initiatingSlackUserId" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "firstTaskHint" | "routedWorkspaceLabel" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt"> & {
2021
2031
  initiatingSlackUserId?: string | null;
2032
+ routedWorkspaceLabel?: string | null;
2022
2033
  }): Promise<{
2023
2034
  created: boolean;
2024
2035
  interaction: SlackInteraction;