@opengeni/db 1.4.2 → 1.4.4

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 (49) hide show
  1. package/dist/canonical-human-identities.js +2 -2
  2. package/dist/capability-reconciliation.js +1 -1
  3. package/dist/{chunk-IT3EYY2C.js → chunk-45EMCVJC.js} +18 -4
  4. package/dist/{chunk-IT3EYY2C.js.map → chunk-45EMCVJC.js.map} +1 -1
  5. package/dist/{chunk-OV5AUIBA.js → chunk-4SUZSKKW.js} +2 -2
  6. package/dist/{chunk-DKFEUGM4.js → chunk-57FM4RG4.js} +2 -2
  7. package/dist/{chunk-A4J7EECR.js → chunk-7HP5NCRN.js} +2 -2
  8. package/dist/{chunk-Y72DP3JF.js → chunk-A4LPJOKP.js} +2 -2
  9. package/dist/{chunk-W75DRYG3.js → chunk-DEMX4GWU.js} +4 -4
  10. package/dist/{chunk-NZ2SP55O.js → chunk-ISNA4KUA.js} +2 -2
  11. package/dist/{chunk-B5C5SBSI.js → chunk-JYKUR5KT.js} +2 -2
  12. package/dist/{chunk-HUKBIZGH.js → chunk-LGXWM3UJ.js} +2 -2
  13. package/dist/{chunk-TODVDGMO.js → chunk-NI3WPW2L.js} +2 -2
  14. package/dist/{chunk-OKCBARX6.js → chunk-PUOQEL6A.js} +2 -2
  15. package/dist/{chunk-JWBEE4CL.js → chunk-SG5YDHSE.js} +3 -3
  16. package/dist/{chunk-K5MTNKJU.js → chunk-WAFY2TCB.js} +3 -3
  17. package/dist/connect-attempts.js +2 -2
  18. package/dist/database.d.ts +8 -2
  19. package/dist/editable-artifact-durable-export.js +1 -1
  20. package/dist/editable-artifacts.js +2 -2
  21. package/dist/index.js +17 -14
  22. package/dist/index.js.map +1 -1
  23. package/dist/interaction-schema.d.ts +2 -0
  24. package/dist/managed-auth-session-sets.js +2 -2
  25. package/dist/mcp-operations.js +1 -1
  26. package/dist/organization-integration-policy.js +2 -2
  27. package/dist/retained-provider-commands.js +5 -5
  28. package/dist/session-background-commands.js +3 -3
  29. package/dist/session-command-output.js +4 -4
  30. package/dist/session-event-slices.js +2 -2
  31. package/dist/session-mcp-credential-rotation.js +4 -4
  32. package/dist/session-tenancy.js +2 -2
  33. package/dist/video-generation.js +2 -2
  34. package/dist/workspace-tool-defaults.js +3 -3
  35. package/package.json +7 -7
  36. package/src/database.ts +38 -8
  37. package/src/index.ts +4 -1
  38. /package/dist/{chunk-OV5AUIBA.js.map → chunk-4SUZSKKW.js.map} +0 -0
  39. /package/dist/{chunk-DKFEUGM4.js.map → chunk-57FM4RG4.js.map} +0 -0
  40. /package/dist/{chunk-A4J7EECR.js.map → chunk-7HP5NCRN.js.map} +0 -0
  41. /package/dist/{chunk-Y72DP3JF.js.map → chunk-A4LPJOKP.js.map} +0 -0
  42. /package/dist/{chunk-W75DRYG3.js.map → chunk-DEMX4GWU.js.map} +0 -0
  43. /package/dist/{chunk-NZ2SP55O.js.map → chunk-ISNA4KUA.js.map} +0 -0
  44. /package/dist/{chunk-B5C5SBSI.js.map → chunk-JYKUR5KT.js.map} +0 -0
  45. /package/dist/{chunk-HUKBIZGH.js.map → chunk-LGXWM3UJ.js.map} +0 -0
  46. /package/dist/{chunk-TODVDGMO.js.map → chunk-NI3WPW2L.js.map} +0 -0
  47. /package/dist/{chunk-OKCBARX6.js.map → chunk-PUOQEL6A.js.map} +0 -0
  48. /package/dist/{chunk-JWBEE4CL.js.map → chunk-SG5YDHSE.js.map} +0 -0
  49. /package/dist/{chunk-K5MTNKJU.js.map → chunk-WAFY2TCB.js.map} +0 -0
@@ -3128,6 +3128,7 @@ export declare const computerSessions: import("drizzle-orm/pg-core").PgTableWith
3128
3128
  screenCapture: boolean;
3129
3129
  semanticActions: boolean;
3130
3130
  pointerInput: boolean;
3131
+ pointerClickContinuation?: boolean | undefined;
3131
3132
  keyboardInput: boolean;
3132
3133
  clipboard: boolean;
3133
3134
  backgroundActions: boolean;
@@ -3153,6 +3154,7 @@ export declare const computerSessions: import("drizzle-orm/pg-core").PgTableWith
3153
3154
  screenCapture: boolean;
3154
3155
  semanticActions: boolean;
3155
3156
  pointerInput: boolean;
3157
+ pointerClickContinuation?: boolean | undefined;
3156
3158
  keyboardInput: boolean;
3157
3159
  clipboard: boolean;
3158
3160
  backgroundActions: boolean;
@@ -20,8 +20,8 @@ import {
20
20
  reapManagedAuthIsolatedSessions,
21
21
  releaseManagedAuthActorMutationLease,
22
22
  validateManagedAuthActorMutationLease
23
- } from "./chunk-Y72DP3JF.js";
24
- import "./chunk-IT3EYY2C.js";
23
+ } from "./chunk-A4LPJOKP.js";
24
+ import "./chunk-45EMCVJC.js";
25
25
  import "./chunk-JL6TBB76.js";
26
26
  import "./chunk-P7YDM2RI.js";
27
27
  import "./chunk-PZ5AY32C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withRlsContext
3
- } from "./chunk-IT3EYY2C.js";
3
+ } from "./chunk-45EMCVJC.js";
4
4
  import "./chunk-JL6TBB76.js";
5
5
  import {
6
6
  LOSSLESS_CONTENT_CODEC_VERSION,
@@ -3,9 +3,9 @@ import {
3
3
  updateOrganizationIntegrationPolicy,
4
4
  withOrganizationIntegrationAcquisition,
5
5
  withOrganizationIntegrationPolicyFence
6
- } from "./chunk-A4J7EECR.js";
6
+ } from "./chunk-7HP5NCRN.js";
7
7
  import "./chunk-4UJCXBR2.js";
8
- import "./chunk-IT3EYY2C.js";
8
+ import "./chunk-45EMCVJC.js";
9
9
  import "./chunk-JL6TBB76.js";
10
10
  import "./chunk-P7YDM2RI.js";
11
11
  import "./chunk-PZ5AY32C.js";
@@ -14,12 +14,12 @@ import {
14
14
  retainedProviderCommandPersistence,
15
15
  supervisedCommandProtocolReady,
16
16
  validateRouterOutputAdvance
17
- } from "./chunk-W75DRYG3.js";
18
- import "./chunk-K5MTNKJU.js";
19
- import "./chunk-JWBEE4CL.js";
20
- import "./chunk-TODVDGMO.js";
17
+ } from "./chunk-DEMX4GWU.js";
18
+ import "./chunk-WAFY2TCB.js";
19
+ import "./chunk-SG5YDHSE.js";
20
+ import "./chunk-NI3WPW2L.js";
21
21
  import "./chunk-4UJCXBR2.js";
22
- import "./chunk-IT3EYY2C.js";
22
+ import "./chunk-45EMCVJC.js";
23
23
  import "./chunk-JL6TBB76.js";
24
24
  import "./chunk-P7YDM2RI.js";
25
25
  import "./chunk-PZ5AY32C.js";
@@ -27,10 +27,10 @@ import {
27
27
  settleConnectedMachineSessionBackgroundCommandWithMutation,
28
28
  settleSessionBackgroundCommandForRetainedProcessInTransaction,
29
29
  unobservableRetainedProcessOutcomeSql
30
- } from "./chunk-JWBEE4CL.js";
31
- import "./chunk-TODVDGMO.js";
30
+ } from "./chunk-SG5YDHSE.js";
31
+ import "./chunk-NI3WPW2L.js";
32
32
  import "./chunk-4UJCXBR2.js";
33
- import "./chunk-IT3EYY2C.js";
33
+ import "./chunk-45EMCVJC.js";
34
34
  import "./chunk-JL6TBB76.js";
35
35
  import "./chunk-P7YDM2RI.js";
36
36
  import "./chunk-PZ5AY32C.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendSessionCommandOutput
3
- } from "./chunk-K5MTNKJU.js";
4
- import "./chunk-JWBEE4CL.js";
5
- import "./chunk-TODVDGMO.js";
3
+ } from "./chunk-WAFY2TCB.js";
4
+ import "./chunk-SG5YDHSE.js";
5
+ import "./chunk-NI3WPW2L.js";
6
6
  import "./chunk-4UJCXBR2.js";
7
- import "./chunk-IT3EYY2C.js";
7
+ import "./chunk-45EMCVJC.js";
8
8
  import "./chunk-JL6TBB76.js";
9
9
  import "./chunk-P7YDM2RI.js";
10
10
  import "./chunk-PZ5AY32C.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  listSessionEventSlices,
3
3
  readSessionMessageSliceInScope
4
- } from "./chunk-B5C5SBSI.js";
5
- import "./chunk-IT3EYY2C.js";
4
+ } from "./chunk-JYKUR5KT.js";
5
+ import "./chunk-45EMCVJC.js";
6
6
  import "./chunk-JL6TBB76.js";
7
7
  import "./chunk-P7YDM2RI.js";
8
8
  import "./chunk-PZ5AY32C.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  connectionMetadataMatchesBinding
3
- } from "./chunk-OV5AUIBA.js";
3
+ } from "./chunk-4SUZSKKW.js";
4
4
  import {
5
5
  lockSessionEventWriteRows,
6
6
  organizationApiKeyAllowsWorkspace
7
- } from "./chunk-JWBEE4CL.js";
8
- import "./chunk-TODVDGMO.js";
7
+ } from "./chunk-SG5YDHSE.js";
8
+ import "./chunk-NI3WPW2L.js";
9
9
  import "./chunk-4UJCXBR2.js";
10
10
  import {
11
11
  rawRows,
12
12
  setSubjectRlsContext,
13
13
  withRlsContext
14
- } from "./chunk-IT3EYY2C.js";
14
+ } from "./chunk-45EMCVJC.js";
15
15
  import {
16
16
  apiKeys,
17
17
  sessionCommandReceipts,
@@ -13,8 +13,8 @@ import {
13
13
  openPrivateSessionCreateCapability,
14
14
  replayAppliedSessionFork,
15
15
  transitionSessionVisibility
16
- } from "./chunk-DKFEUGM4.js";
17
- import "./chunk-IT3EYY2C.js";
16
+ } from "./chunk-57FM4RG4.js";
17
+ import "./chunk-45EMCVJC.js";
18
18
  import "./chunk-JL6TBB76.js";
19
19
  import "./chunk-P7YDM2RI.js";
20
20
  import "./chunk-PZ5AY32C.js";
@@ -29,9 +29,9 @@ import {
29
29
  settleVideoGenerationFailure,
30
30
  settleVideoGenerationReady,
31
31
  updateWorkspaceVideoGenerationPolicy
32
- } from "./chunk-TODVDGMO.js";
32
+ } from "./chunk-NI3WPW2L.js";
33
33
  import "./chunk-4UJCXBR2.js";
34
- import "./chunk-IT3EYY2C.js";
34
+ import "./chunk-45EMCVJC.js";
35
35
  import "./chunk-JL6TBB76.js";
36
36
  import "./chunk-P7YDM2RI.js";
37
37
  import "./chunk-PZ5AY32C.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  lockWorkspaceInferenceControl
3
- } from "./chunk-JWBEE4CL.js";
4
- import "./chunk-TODVDGMO.js";
3
+ } from "./chunk-SG5YDHSE.js";
4
+ import "./chunk-NI3WPW2L.js";
5
5
  import "./chunk-4UJCXBR2.js";
6
6
  import {
7
7
  withWorkspaceRls
8
- } from "./chunk-IT3EYY2C.js";
8
+ } from "./chunk-45EMCVJC.js";
9
9
  import "./chunk-JL6TBB76.js";
10
10
  import "./chunk-P7YDM2RI.js";
11
11
  import "./chunk-PZ5AY32C.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/db",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "OpenGeni persistence: Drizzle schema, RLS-scoped query layer, the SQL migration runner, and role provisioning.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -115,12 +115,12 @@
115
115
  "prepublishOnly": "bash ../../scripts/prepublish-guard"
116
116
  },
117
117
  "dependencies": {
118
- "@opengeni/codemode": "1.4.2",
119
- "@opengeni/codex": "1.4.2",
120
- "@opengeni/config": "1.4.2",
121
- "@opengeni/contracts": "1.4.2",
122
- "@opengeni/network": "1.4.2",
123
- "@opengeni/observability": "1.4.2",
118
+ "@opengeni/codemode": "1.4.4",
119
+ "@opengeni/codex": "1.4.4",
120
+ "@opengeni/config": "1.4.4",
121
+ "@opengeni/contracts": "1.4.4",
122
+ "@opengeni/network": "1.4.4",
123
+ "@opengeni/observability": "1.4.4",
124
124
  "drizzle-orm": "^0.45.2",
125
125
  "postgres": "^3.4.7"
126
126
  },
package/src/database.ts CHANGED
@@ -864,17 +864,33 @@ export async function withSessionActivityRlsContext<T>(
864
864
  fn: (db: SessionActivityDatabase) => Promise<T>,
865
865
  transactionConfig?: PgTransactionConfig,
866
866
  fenceMode: "shared" | "none" = "shared",
867
- organizationMembershipFence = false,
867
+ organizationMembershipFence: OrganizationMembershipFenceMode = false,
868
868
  ): Promise<T> {
869
869
  await assertSessionActivityGateEntry(db);
870
870
  return await withRlsContext(
871
871
  db,
872
872
  context,
873
873
  async (scopedDb) => {
874
- if (organizationMembershipFence) {
875
- // Claim can inherit membership-fenced authority after locking sessions.
876
- // Acquire membership before even a shared tenancy fence: an exclusive
877
- // tenancy/control waiter can otherwise complete the same lock cycle.
874
+ if (organizationMembershipFence === "shared") {
875
+ // A pure reader of membership truth (the turn claim) only needs to
876
+ // exclude membership/tenancy mutators, which hold this key
877
+ // exclusively. Readers must not serialize each other: an exclusive
878
+ // claim fence made every turn claim in one organization queue behind
879
+ // every other one. Same position as the exclusive mode below, so the
880
+ // membership -> tenancy -> control prefix order is unchanged. A
881
+ // caller using this mode must never request the exclusive lock on the
882
+ // same key later in the transaction (no in-place escalation).
883
+ await scopedDb.execute(sql`select pg_advisory_xact_lock_shared(
884
+ hashtextextended(${`organization-membership:${context.accountId}`}, 0))`);
885
+ if (fenceMode === "shared") {
886
+ await scopedDb.execute(sql`select pg_advisory_xact_lock_shared(
887
+ hashtextextended(${`session-tenancy:${context.workspaceId}`}, 0))`);
888
+ }
889
+ } else if (organizationMembershipFence) {
890
+ // Callers that reauthorize or mutate under the membership lifecycle
891
+ // lock take it exclusively. Acquire membership before even a shared
892
+ // tenancy fence: an exclusive tenancy/control waiter can otherwise
893
+ // complete the same lock cycle.
878
894
  await scopedDb.execute(sql`select pg_advisory_xact_lock(
879
895
  hashtextextended(${`organization-membership:${context.accountId}`}, 0))`);
880
896
  if (fenceMode === "shared") {
@@ -894,10 +910,17 @@ export async function withSessionActivityRlsContext<T>(
894
910
  return value;
895
911
  },
896
912
  transactionConfig,
897
- organizationMembershipFence ? "none" : fenceMode,
913
+ organizationMembershipFence !== false ? "none" : fenceMode,
898
914
  );
899
915
  }
900
916
 
917
+ /**
918
+ * `true`/`"exclusive"`: the callback reauthorizes or mutates under the
919
+ * organization-membership lifecycle lock. `"shared"`: the callback only reads
920
+ * membership-fenced authority and must never escalate to exclusive.
921
+ */
922
+ export type OrganizationMembershipFenceMode = boolean | "exclusive" | "shared";
923
+
901
924
  /**
902
925
  * `organizationMembershipFence` is required when the callback takes the
903
926
  * organization-membership lifecycle lock (for example external-actor
@@ -981,14 +1004,21 @@ export async function retrySessionActivityRls<T>(
981
1004
  /** Claim can inherit membership-fenced causal authority after locking the
982
1005
  * session. Acquire that fence before tenancy/control/session instead. An
983
1006
  * enclosing transaction must preserve this same lock prefix. */
984
- organizationMembershipFence?: boolean;
1007
+ organizationMembershipFence?: OrganizationMembershipFenceMode;
985
1008
  },
986
1009
  fn: (db: SessionActivityDatabase) => Promise<T>,
987
1010
  ): Promise<T> {
988
1011
  return await runIdempotentPersistenceTransaction(options, async () => {
989
1012
  if (options.organizationMembershipFence) {
990
1013
  const context = { ...(await rlsContextForWorkspace(db, workspaceId)), workspaceId };
991
- return await withSessionActivityRlsContext(db, context, fn, undefined, "shared", true);
1014
+ return await withSessionActivityRlsContext(
1015
+ db,
1016
+ context,
1017
+ fn,
1018
+ undefined,
1019
+ "shared",
1020
+ options.organizationMembershipFence,
1021
+ );
992
1022
  }
993
1023
  return await withWorkspaceSessionActivityRls(db, workspaceId, fn);
994
1024
  });
package/src/index.ts CHANGED
@@ -72441,7 +72441,10 @@ export async function claimSessionWorkForAttempt(
72441
72441
  stage: "session_attempts.claim",
72442
72442
  eventTypes: ["session.turn.attempt_claimed"],
72443
72443
  maxAttempts: 3,
72444
- organizationMembershipFence: true,
72444
+ // Claim reads membership-fenced authority; it never mutates membership.
72445
+ // Shared keeps membership mutators fenced while concurrent claims in
72446
+ // one organization stay parallel (exclusive serialized every claim).
72447
+ organizationMembershipFence: "shared",
72445
72448
  },
72446
72449
  async (scopedDb) =>
72447
72450
  await withSessionActivitySavepoint(scopedDb, async (tx) => {