@opengeni/db 1.0.2-canary.37202341988001 → 1.1.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 (69) hide show
  1. package/dist/artifact-catalog.d.ts +12 -0
  2. package/dist/canonical-human-identities.js +3 -3
  3. package/dist/capability-reconciliation.js +2 -2
  4. package/dist/{chunk-KEDWSSNP.js → chunk-7Z7ALFRE.js} +2 -2
  5. package/dist/{chunk-OQZOGCLG.js → chunk-BLUQG54M.js} +2 -2
  6. package/dist/{chunk-Y77PVZZD.js → chunk-BZV5ZDRY.js} +2 -2
  7. package/dist/{chunk-MACELCXG.js → chunk-CIGHXFPD.js} +3 -3
  8. package/dist/{chunk-7S53WLPI.js → chunk-EKXCF3FH.js} +4 -4
  9. package/dist/{chunk-F3YMVRF4.js → chunk-GLA5YCQS.js} +4 -4
  10. package/dist/{chunk-KH3TYDGY.js → chunk-J4WFOVBV.js} +2 -2
  11. package/dist/{chunk-NLSG7GGA.js → chunk-KJVOBLFC.js} +3 -3
  12. package/dist/{chunk-7POTLB24.js → chunk-M2YGXCCQ.js} +2 -2
  13. package/dist/{chunk-PQGTWFRF.js → chunk-M3SWH4MU.js} +2 -2
  14. package/dist/{chunk-OMHBVHX7.js → chunk-ODKYBA3C.js} +5 -5
  15. package/dist/{chunk-56MYWKQV.js → chunk-SKYRM7R7.js} +2 -2
  16. package/dist/{chunk-N5QCKHYL.js → chunk-T5NHDEZW.js} +62 -19
  17. package/dist/chunk-T5NHDEZW.js.map +1 -0
  18. package/dist/{chunk-LDTQGYD2.js → chunk-VOB6TXSJ.js} +16 -1
  19. package/dist/chunk-VOB6TXSJ.js.map +1 -0
  20. package/dist/{chunk-UEQQ2WWU.js → chunk-Z5HJXH3X.js} +3 -26
  21. package/dist/chunk-Z5HJXH3X.js.map +1 -0
  22. package/dist/connect-attempts.js +3 -3
  23. package/dist/editable-artifact-durable-export.js +2 -2
  24. package/dist/editable-artifacts.js +3 -3
  25. package/dist/index.d.ts +14 -5
  26. package/dist/index.js +85 -30
  27. package/dist/index.js.map +1 -1
  28. package/dist/managed-auth-session-sets.js +3 -3
  29. package/dist/mcp-operations.js +2 -2
  30. package/dist/organization-integration-policy.js +3 -3
  31. package/dist/provision-roles.js +1 -1
  32. package/dist/retained-provider-commands.js +6 -6
  33. package/dist/runtime-posture.d.ts +3 -2
  34. package/dist/schema.d.ts +93 -0
  35. package/dist/schema.js +3 -1
  36. package/dist/session-background-commands.js +4 -4
  37. package/dist/session-command-output.js +5 -5
  38. package/dist/session-event-slices.js +3 -3
  39. package/dist/session-mcp-credential-rotation.js +5 -5
  40. package/dist/session-tenancy.d.ts +6 -1
  41. package/dist/session-tenancy.js +3 -5
  42. package/dist/video-generation.js +3 -3
  43. package/dist/workspace-tool-defaults.js +4 -4
  44. package/drizzle/0610_artifact_catalog_pins.sql +165 -0
  45. package/drizzle/0611_universal_session_tenancy_activation.sql +166 -0
  46. package/drizzle/0612_scheduled_model_unavailable_refusal.sql +21 -0
  47. package/package.json +7 -7
  48. package/src/artifact-catalog.ts +31 -5
  49. package/src/index.ts +94 -19
  50. package/src/provision-roles.ts +16 -0
  51. package/src/runtime-posture-cli.ts +0 -2
  52. package/src/runtime-posture.ts +64 -27
  53. package/src/schema.ts +17 -0
  54. package/src/session-tenancy.ts +9 -31
  55. package/dist/chunk-LDTQGYD2.js.map +0 -1
  56. package/dist/chunk-N5QCKHYL.js.map +0 -1
  57. package/dist/chunk-UEQQ2WWU.js.map +0 -1
  58. /package/dist/{chunk-KEDWSSNP.js.map → chunk-7Z7ALFRE.js.map} +0 -0
  59. /package/dist/{chunk-OQZOGCLG.js.map → chunk-BLUQG54M.js.map} +0 -0
  60. /package/dist/{chunk-Y77PVZZD.js.map → chunk-BZV5ZDRY.js.map} +0 -0
  61. /package/dist/{chunk-MACELCXG.js.map → chunk-CIGHXFPD.js.map} +0 -0
  62. /package/dist/{chunk-7S53WLPI.js.map → chunk-EKXCF3FH.js.map} +0 -0
  63. /package/dist/{chunk-F3YMVRF4.js.map → chunk-GLA5YCQS.js.map} +0 -0
  64. /package/dist/{chunk-KH3TYDGY.js.map → chunk-J4WFOVBV.js.map} +0 -0
  65. /package/dist/{chunk-NLSG7GGA.js.map → chunk-KJVOBLFC.js.map} +0 -0
  66. /package/dist/{chunk-7POTLB24.js.map → chunk-M2YGXCCQ.js.map} +0 -0
  67. /package/dist/{chunk-PQGTWFRF.js.map → chunk-M3SWH4MU.js.map} +0 -0
  68. /package/dist/{chunk-OMHBVHX7.js.map → chunk-ODKYBA3C.js.map} +0 -0
  69. /package/dist/{chunk-56MYWKQV.js.map → chunk-SKYRM7R7.js.map} +0 -0
@@ -4,6 +4,8 @@ export type ArtifactCatalogPosition = {
4
4
  key: string;
5
5
  kind: ArtifactCatalogKind;
6
6
  id: string;
7
+ /** Legacy cursor frontiers did not carry this bit. */
8
+ pinned?: boolean | undefined;
7
9
  };
8
10
  /** Internal candidates are NOT an authorized public projection. */
9
11
  export type ArtifactCatalogCandidate = {
@@ -18,7 +20,17 @@ export type ArtifactCatalogCandidate = {
18
20
  source_session_id: string | null;
19
21
  version_id: string | null;
20
22
  sort_key: string;
23
+ pinned?: boolean;
21
24
  };
25
+ /** API callers must first verify publish permission and domain-specific read authority. */
26
+ export declare function updateArtifactPin(db: Database, scope: {
27
+ accountId: string;
28
+ workspaceId: string;
29
+ }, input: {
30
+ kind: ArtifactCatalogKind;
31
+ artifactId: string;
32
+ pinned: boolean;
33
+ }): Promise<void>;
22
34
  /** Called only after immutable bytes have been retained by explicit publication. */
23
35
  export declare function recordSandboxFilePublication(db: Database, input: {
24
36
  accountId: string;
@@ -11,9 +11,9 @@ import {
11
11
  getCanonicalHumanIdentityProjection,
12
12
  synchronizeCanonicalHumanLoginBindings,
13
13
  validateCanonicalHumanSession
14
- } from "./chunk-KEDWSSNP.js";
15
- import "./chunk-56MYWKQV.js";
16
- import "./chunk-LDTQGYD2.js";
14
+ } from "./chunk-7Z7ALFRE.js";
15
+ import "./chunk-SKYRM7R7.js";
16
+ import "./chunk-VOB6TXSJ.js";
17
17
  import "./chunk-P7YDM2RI.js";
18
18
  import "./chunk-PZ5AY32C.js";
19
19
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  withWorkspaceRls
3
- } from "./chunk-56MYWKQV.js";
4
- import "./chunk-LDTQGYD2.js";
3
+ } from "./chunk-SKYRM7R7.js";
4
+ import "./chunk-VOB6TXSJ.js";
5
5
  import "./chunk-P7YDM2RI.js";
6
6
  import "./chunk-PZ5AY32C.js";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  nestedPostgresSqlState,
3
3
  rawRows
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
 
6
6
  // src/canonical-human-identities.ts
7
7
  import { createHash } from "crypto";
@@ -318,4 +318,4 @@ export {
318
318
  getCanonicalHumanIdentityProjection,
319
319
  applyCanonicalHumanIdentityOperation
320
320
  };
321
- //# sourceMappingURL=chunk-KEDWSSNP.js.map
321
+ //# sourceMappingURL=chunk-7Z7ALFRE.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  rawRows,
3
3
  withWorkspaceSubjectRls
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
 
6
6
  // src/connect-attempts.ts
7
7
  import { createHash } from "crypto";
@@ -216,4 +216,4 @@ export {
216
216
  claimConnectOperation,
217
217
  finishConnectOperation
218
218
  };
219
- //# sourceMappingURL=chunk-OQZOGCLG.js.map
219
+ //# sourceMappingURL=chunk-BLUQG54M.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
 
6
6
  // src/editable-artifacts.ts
7
7
  import { createHash } from "crypto";
@@ -3592,4 +3592,4 @@ export {
3592
3592
  PostgresEditableArtifactLiveReadStore,
3593
3593
  transactionallyAuthorizeEditableArtifactActor
3594
3594
  };
3595
- //# sourceMappingURL=chunk-Y77PVZZD.js.map
3595
+ //# sourceMappingURL=chunk-BZV5ZDRY.js.map
@@ -6,7 +6,7 @@ import {
6
6
  setSubjectRlsContext,
7
7
  withRlsContext,
8
8
  withWorkspaceRls
9
- } from "./chunk-56MYWKQV.js";
9
+ } from "./chunk-SKYRM7R7.js";
10
10
  import {
11
11
  connections,
12
12
  creditLedgerEntries,
@@ -18,7 +18,7 @@ import {
18
18
  workspaceVideoGenerationPolicies,
19
19
  workspaceVideoGenerationQuotas,
20
20
  workspaces
21
- } from "./chunk-LDTQGYD2.js";
21
+ } from "./chunk-VOB6TXSJ.js";
22
22
 
23
23
  // src/video-generation.ts
24
24
  import {
@@ -1332,4 +1332,4 @@ export {
1332
1332
  mediaGenerationResultForStoredOperation,
1333
1333
  getVideoGenerationOperationSummary
1334
1334
  };
1335
- //# sourceMappingURL=chunk-MACELCXG.js.map
1335
+ //# sourceMappingURL=chunk-CIGHXFPD.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cancelUnacceptedVideoGenerationsForToolCallsInTransaction
3
- } from "./chunk-MACELCXG.js";
3
+ } from "./chunk-CIGHXFPD.js";
4
4
  import {
5
5
  external_exports
6
6
  } from "./chunk-4UJCXBR2.js";
@@ -14,7 +14,7 @@ import {
14
14
  withSessionActivityRlsContext,
15
15
  withWorkspaceRls,
16
16
  withWorkspaceSubjectRls
17
- } from "./chunk-56MYWKQV.js";
17
+ } from "./chunk-SKYRM7R7.js";
18
18
  import {
19
19
  auditEvents,
20
20
  codexCapacityWaiters,
@@ -41,7 +41,7 @@ import {
41
41
  workspaceInferenceControls,
42
42
  workspaceMemberships,
43
43
  workspaces
44
- } from "./chunk-LDTQGYD2.js";
44
+ } from "./chunk-VOB6TXSJ.js";
45
45
  import {
46
46
  LOSSLESS_CONTENT_CODEC_VERSION,
47
47
  fromPostgresLosslessJson,
@@ -6416,4 +6416,4 @@ export {
6416
6416
  setWorkspacePauseTimerInTransaction,
6417
6417
  fireWorkspacePauseTimerInTransaction
6418
6418
  };
6419
- //# sourceMappingURL=chunk-7S53WLPI.js.map
6419
+ //# sourceMappingURL=chunk-EKXCF3FH.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  lockSessionEventWriteRows
3
- } from "./chunk-7S53WLPI.js";
3
+ } from "./chunk-EKXCF3FH.js";
4
4
  import {
5
5
  withSessionActivityRlsContext
6
- } from "./chunk-56MYWKQV.js";
6
+ } from "./chunk-SKYRM7R7.js";
7
7
  import {
8
8
  sandboxRetainedProcesses,
9
9
  sessionBackgroundCommands,
10
10
  sessionEvents,
11
11
  sessions
12
- } from "./chunk-LDTQGYD2.js";
12
+ } from "./chunk-VOB6TXSJ.js";
13
13
  import {
14
14
  fromPostgresLosslessJson,
15
15
  withLosslessContentWriteVersion
@@ -140,4 +140,4 @@ async function appendSessionCommandOutput(db, input) {
140
140
  export {
141
141
  appendSessionCommandOutput
142
142
  };
143
- //# sourceMappingURL=chunk-F3YMVRF4.js.map
143
+ //# sourceMappingURL=chunk-GLA5YCQS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  nestedPostgresSqlState,
3
3
  rawRows
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
 
6
6
  // src/managed-auth-session-sets.ts
7
7
  import {
@@ -296,4 +296,4 @@ export {
296
296
  reapManagedAuthIsolatedSessions,
297
297
  reapExpiredManagedAuthSessionSets
298
298
  };
299
- //# sourceMappingURL=chunk-KH3TYDGY.js.map
299
+ //# sourceMappingURL=chunk-J4WFOVBV.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  rawRows,
3
3
  withWorkspaceRls
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
  import {
6
6
  sessionEvents,
7
7
  sessionTurns
8
- } from "./chunk-LDTQGYD2.js";
8
+ } from "./chunk-VOB6TXSJ.js";
9
9
  import {
10
10
  LOSSLESS_JSON_STRING_PREFIX,
11
11
  fromPostgresLosslessJson,
@@ -254,4 +254,4 @@ export {
254
254
  readSessionMessageSliceInScope,
255
255
  listSessionEventSlices
256
256
  };
257
- //# sourceMappingURL=chunk-NLSG7GGA.js.map
257
+ //# sourceMappingURL=chunk-KJVOBLFC.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  setSubjectRlsContext,
3
3
  withRlsContext
4
- } from "./chunk-56MYWKQV.js";
4
+ } from "./chunk-SKYRM7R7.js";
5
5
 
6
6
  // src/connection-token-resolver.ts
7
7
  import { normalizeSlackScopes, OFFICIAL_SLACK_MCP_URL } from "@opengeni/contracts/slack-rest-mcp";
@@ -857,4 +857,4 @@ export {
857
857
  refreshOAuthConnectionCredential,
858
858
  isPrivateAddress
859
859
  };
860
- //# sourceMappingURL=chunk-7POTLB24.js.map
860
+ //# sourceMappingURL=chunk-M2YGXCCQ.js.map
@@ -6,7 +6,7 @@ import {
6
6
  rlsContextForWorkspace,
7
7
  setSubjectRlsContext,
8
8
  withRlsContext
9
- } from "./chunk-56MYWKQV.js";
9
+ } from "./chunk-SKYRM7R7.js";
10
10
 
11
11
  // src/organization-integration-policy.ts
12
12
  import {
@@ -153,4 +153,4 @@ export {
153
153
  withOrganizationIntegrationPolicyFence,
154
154
  withOrganizationIntegrationAcquisition
155
155
  };
156
- //# sourceMappingURL=chunk-PQGTWFRF.js.map
156
+ //# sourceMappingURL=chunk-M3SWH4MU.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  appendSessionCommandOutput
3
- } from "./chunk-F3YMVRF4.js";
3
+ } from "./chunk-GLA5YCQS.js";
4
4
  import {
5
5
  lockSessionEventWriteRows
6
- } from "./chunk-7S53WLPI.js";
6
+ } from "./chunk-EKXCF3FH.js";
7
7
  import {
8
8
  withRlsContext,
9
9
  withSessionActivityRlsContext
10
- } from "./chunk-56MYWKQV.js";
10
+ } from "./chunk-SKYRM7R7.js";
11
11
  import {
12
12
  sandboxRetainedProcesses
13
- } from "./chunk-LDTQGYD2.js";
13
+ } from "./chunk-VOB6TXSJ.js";
14
14
 
15
15
  // src/retained-provider-commands.ts
16
16
  import { and, eq, sql } from "drizzle-orm";
@@ -299,4 +299,4 @@ export {
299
299
  retainedProcessCancellationRequested,
300
300
  requestRetainedProcessDeadlineCancellation
301
301
  };
302
- //# sourceMappingURL=chunk-OMHBVHX7.js.map
302
+ //# sourceMappingURL=chunk-ODKYBA3C.js.map
@@ -3,7 +3,7 @@ import {
3
3
  sessions,
4
4
  workspaceSessionActivityRevisions,
5
5
  workspaces
6
- } from "./chunk-LDTQGYD2.js";
6
+ } from "./chunk-VOB6TXSJ.js";
7
7
  import {
8
8
  LOSSLESS_CONTENT_WRITER_APPLICATION_NAME
9
9
  } from "./chunk-P7YDM2RI.js";
@@ -853,4 +853,4 @@ export {
853
853
  withAccountRls,
854
854
  dbBindingFor
855
855
  };
856
- //# sourceMappingURL=chunk-56MYWKQV.js.map
856
+ //# sourceMappingURL=chunk-SKYRM7R7.js.map
@@ -153,6 +153,12 @@ var SANDBOX_FILE_PUBLICATION_RUNTIME_ROUTINES = [
153
153
  "list_sandbox_file_publications(uuid, uuid, jsonb)"
154
154
  ];
155
155
  var SANDBOX_FILE_PUBLICATIONS_TABLE = "sandbox_file_publications";
156
+ var ARTIFACT_PIN_RUNTIME_ROUTINES = [
157
+ "update_artifact_pin(uuid, uuid, text, text, boolean)",
158
+ "list_artifact_pins(uuid, uuid)",
159
+ "list_sandbox_file_publications_pinned(uuid, uuid, jsonb)"
160
+ ];
161
+ var ARTIFACT_PINS_TABLE = "artifact_catalog_pins";
156
162
  var SCHEDULED_SLACK_BOT_MESSAGE_RUNTIME_ROUTINES = [
157
163
  "prepare_scheduled_slack_bot_message(uuid, uuid, uuid, uuid, uuid, integer, text, text, text)",
158
164
  "read_scheduled_slack_bot_message(uuid, uuid, uuid, uuid)"
@@ -1785,10 +1791,6 @@ async function inspectRuntimeDatabasePosture(db, options) {
1785
1791
  replication: identity.rolreplication,
1786
1792
  bypassRls: identity.rolbypassrls
1787
1793
  };
1788
- const activationRows = resultRows(
1789
- await tx.execute(sql`select session_tenancy_any_product_activation() as activated`)
1790
- );
1791
- const sessionTenancyProductActivationPresent = activationRows[0]?.activated === true;
1792
1794
  const variableSetCutoverRows = resultRows(
1793
1795
  await tx.execute(sql`
1794
1796
  select to_regprocedure(
@@ -1814,7 +1816,6 @@ async function inspectRuntimeDatabasePosture(db, options) {
1814
1816
  privateTables: [],
1815
1817
  targetRoutines: [],
1816
1818
  privateRoutines: [],
1817
- sessionTenancyProductActivationPresent,
1818
1819
  sessionVariableSetAttachmentsCutoverPresent,
1819
1820
  claudeSubscriptionPoolActivationPresent
1820
1821
  };
@@ -1917,25 +1918,31 @@ async function inspectRuntimeDatabasePosture(db, options) {
1917
1918
  c.relforcerowsecurity as rls_forced,
1918
1919
  row_security_active(c.oid) as rls_active,
1919
1920
  (select count(*)::int from pg_policy policy where policy.polrelid = c.oid) as policy_count,
1920
- -- Column-only grants on the inventory stamp are also unsafe; in
1921
- -- particular INSERT can mint authority without a table grant.
1921
+ -- Column-only grants on capability tables are also unsafe; a pin
1922
+ -- table must remain EXECUTE-only even after column ACL drift.
1922
1923
  (has_table_privilege(current_user, c.oid, 'SELECT') or
1923
- ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches') or
1924
+ ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches', ${ARTIFACT_PINS_TABLE}) or
1924
1925
  c.relname in (select jsonb_array_elements_text(${JSON.stringify(RUNTIME_ALLOWANCE_PRIVATE_TABLES)}::jsonb))) and
1925
1926
  has_any_column_privilege(current_user, c.oid, 'SELECT'))) as can_select,
1926
1927
  (has_table_privilege(current_user, c.oid, 'INSERT') or
1927
- ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches') or
1928
+ ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches', ${ARTIFACT_PINS_TABLE}) or
1928
1929
  c.relname in (select jsonb_array_elements_text(${JSON.stringify(RUNTIME_ALLOWANCE_PRIVATE_TABLES)}::jsonb))) and
1929
1930
  has_any_column_privilege(current_user, c.oid, 'INSERT'))) as can_insert,
1930
1931
  (has_table_privilege(current_user, c.oid, 'UPDATE') or
1931
- ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches') or
1932
+ ((c.relname in ('modal_inventory_read_capabilities','usage_allowance_capabilities','session_import_batches', ${ARTIFACT_PINS_TABLE}) or
1932
1933
  c.relname in (select jsonb_array_elements_text(${JSON.stringify(RUNTIME_ALLOWANCE_PRIVATE_TABLES)}::jsonb))) and
1933
1934
  has_any_column_privilege(current_user, c.oid, 'UPDATE'))) as can_update,
1934
1935
  has_table_privilege(current_user, c.oid, 'DELETE') as can_delete,
1935
1936
  has_table_privilege(current_user, c.oid, 'TRUNCATE') as can_truncate,
1936
1937
  (has_table_privilege(current_user, c.oid, 'REFERENCES') or
1937
1938
  has_any_column_privilege(current_user, c.oid, 'REFERENCES')) as can_references,
1938
- has_table_privilege(current_user, c.oid, 'TRIGGER') as can_trigger
1939
+ has_table_privilege(current_user, c.oid, 'TRIGGER') as can_trigger,
1940
+ CASE WHEN c.relname = ${ARTIFACT_PINS_TABLE} THEN ARRAY(
1941
+ SELECT DISTINCT acl.privilege_type FROM aclexplode(coalesce(c.relacl, acldefault('r', c.relowner))) acl
1942
+ WHERE acl.privilege_type NOT IN ('SELECT','INSERT','UPDATE','DELETE','TRUNCATE','REFERENCES','TRIGGER')
1943
+ AND CASE WHEN acl.grantee = 0 THEN true ELSE pg_has_role(current_user, acl.grantee, 'USAGE') END
1944
+ ORDER BY acl.privilege_type
1945
+ ) ELSE ARRAY[]::text[] END AS extra_privileges
1939
1946
  from pg_class c
1940
1947
  join pg_namespace n on n.oid = c.relnamespace
1941
1948
  where n.nspname = 'opengeni_private'
@@ -1949,6 +1956,7 @@ async function inspectRuntimeDatabasePosture(db, options) {
1949
1956
  ${SCOPED_COMPUTE_CAPABILITY_TABLE},
1950
1957
  ${CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE},
1951
1958
  ${SANDBOX_FILE_PUBLICATIONS_TABLE},
1959
+ ${ARTIFACT_PINS_TABLE},
1952
1960
  ${SCHEDULED_SLACK_BOT_MESSAGES_TABLE},
1953
1961
  ${ORGANIZATION_SIGNUP_USE_CASES_TABLE},
1954
1962
  ${SLACK_FILE_UPLOAD_OPERATIONS_TABLE},
@@ -1985,7 +1993,8 @@ async function inspectRuntimeDatabasePosture(db, options) {
1985
1993
  delete: row.can_delete,
1986
1994
  truncate: row.can_truncate,
1987
1995
  references: row.can_references,
1988
- trigger: row.can_trigger
1996
+ trigger: row.can_trigger,
1997
+ ...row.extra_privileges?.length ? { extraPrivileges: row.extra_privileges } : {}
1989
1998
  }));
1990
1999
  const targetRoutines = resultRows(
1991
2000
  await tx.execute(sql`
@@ -2059,7 +2068,6 @@ async function inspectRuntimeDatabasePosture(db, options) {
2059
2068
  privateTables,
2060
2069
  targetRoutines,
2061
2070
  privateRoutines,
2062
- sessionTenancyProductActivationPresent,
2063
2071
  sessionVariableSetAttachmentsCutoverPresent,
2064
2072
  claudeSubscriptionPoolActivationPresent
2065
2073
  };
@@ -2086,11 +2094,6 @@ function evaluateRuntimeDatabasePosture(posture, options) {
2086
2094
  if (!posture.sessionVariableSetAttachmentsCutoverPresent) {
2087
2095
  violations.push("database is missing the 0352 session Variable Set attachment runtime receipt");
2088
2096
  }
2089
- if (posture.sessionTenancyProductActivationPresent && options.organizationTenancyCanonicalActivationEnabled !== true) {
2090
- violations.push(
2091
- "session-tenancy product activation is durable but OPENGENI_ORGANIZATION_TENANCY_CANONICAL_ACTIVATION_ENABLED is not true"
2092
- );
2093
- }
2094
2097
  if (!identity.currentUser || !identity.sessionUser) {
2095
2098
  violations.push("database identity is empty");
2096
2099
  }
@@ -3504,6 +3507,29 @@ function evaluateRuntimeDatabasePosture(posture, options) {
3504
3507
  }
3505
3508
  }
3506
3509
  }
3510
+ const pinTables = posture.privateTables.filter((table) => table.name === ARTIFACT_PINS_TABLE);
3511
+ if (pinTables.length !== 1) {
3512
+ if (!options.protectedTables)
3513
+ violations.push("artifact pin private relation is missing or ambiguous");
3514
+ } else {
3515
+ const table = pinTables[0];
3516
+ if (!table.rlsEnabled || !table.rlsForced || !table.rlsActive || (table.policyCount ?? 0) < 1)
3517
+ violations.push("artifact pin relation lacks active FORCE-RLS workspace isolation");
3518
+ if (table.select || table.insert || table.update || table.delete || table.truncate || table.references || table.trigger || table.extraPrivileges?.length || table.owner === expectedRole)
3519
+ violations.push("runtime role has forbidden direct artifact pin authority");
3520
+ if (tableByName.get("files")?.owner && table.owner !== tableByName.get("files").owner)
3521
+ violations.push("artifact pin owner does not match workspace authority");
3522
+ const quotedSchema = `"${targetSchema.replaceAll('"', '""')}"`;
3523
+ const searchPaths = /* @__PURE__ */ new Set([
3524
+ `search_path=pg_catalog, ${quotedSchema}, pg_temp`,
3525
+ `search_path=pg_catalog, ${/^[a-z_][a-z0-9_]*$/.test(targetSchema) ? targetSchema : quotedSchema}, pg_temp`
3526
+ ]);
3527
+ for (const name of ARTIFACT_PIN_RUNTIME_ROUTINES) {
3528
+ const routines = posture.privateRoutines.filter((routine) => routine.name === name);
3529
+ if (routines.length !== 1 || !routines[0].execute || routines[0].publicExecute || !routines[0].securityDefiner || routines[0].owner !== table.owner || !routines[0].configuration?.some((configuration) => searchPaths.has(configuration)))
3530
+ violations.push(`artifact pin capability ${name} is missing or unsafe`);
3531
+ }
3532
+ }
3507
3533
  const slackFileUploadTables = posture.privateTables.filter(
3508
3534
  (table) => table.name === SLACK_FILE_UPLOAD_OPERATIONS_TABLE
3509
3535
  );
@@ -5799,6 +5825,22 @@ BEGIN
5799
5825
  REVOKE ALL ON FUNCTION opengeni_private.record_sandbox_file_publication(uuid,uuid,uuid,uuid) FROM PUBLIC;
5800
5826
  REVOKE ALL ON FUNCTION opengeni_private.list_sandbox_file_publications(uuid,uuid,jsonb) FROM PUBLIC;
5801
5827
  END IF;
5828
+ IF to_regclass('opengeni_private.artifact_catalog_pins') IS NOT NULL THEN
5829
+ EXECUTE format('REVOKE ALL ON TABLE opengeni_private.artifact_catalog_pins FROM %I', ${literal(role)});
5830
+ -- Table revocation does not remove column ACLs. Reconcile every current
5831
+ -- column for both the runtime and PUBLIC, including future additions.
5832
+ EXECUTE format('REVOKE ALL (%s) ON TABLE opengeni_private.artifact_catalog_pins FROM %I',
5833
+ (SELECT string_agg(quote_ident(attname),',' ORDER BY attnum) FROM pg_attribute
5834
+ WHERE attrelid='opengeni_private.artifact_catalog_pins'::regclass AND attnum>0 AND NOT attisdropped),
5835
+ ${literal(role)});
5836
+ REVOKE ALL ON TABLE opengeni_private.artifact_catalog_pins FROM PUBLIC;
5837
+ EXECUTE format('REVOKE ALL (%s) ON TABLE opengeni_private.artifact_catalog_pins FROM PUBLIC',
5838
+ (SELECT string_agg(quote_ident(attname),',' ORDER BY attnum) FROM pg_attribute
5839
+ WHERE attrelid='opengeni_private.artifact_catalog_pins'::regclass AND attnum>0 AND NOT attisdropped));
5840
+ REVOKE ALL ON FUNCTION opengeni_private.update_artifact_pin(uuid,uuid,text,text,boolean),
5841
+ opengeni_private.list_artifact_pins(uuid,uuid),
5842
+ opengeni_private.list_sandbox_file_publications_pinned(uuid,uuid,jsonb) FROM PUBLIC;
5843
+ END IF;
5802
5844
  IF to_regclass('opengeni_private.slack_file_upload_operations') IS NOT NULL THEN
5803
5845
  -- Ordinary RLS repositories own the upload CAS, not owner capabilities.
5804
5846
  -- Never allow deletion/truncation to erase its durable completion fence.
@@ -6043,6 +6085,7 @@ if (import.meta.main) {
6043
6085
 
6044
6086
  export {
6045
6087
  SANDBOX_FILE_PUBLICATION_RUNTIME_ROUTINES,
6088
+ ARTIFACT_PIN_RUNTIME_ROUTINES,
6046
6089
  SCHEDULED_SLACK_BOT_MESSAGE_RUNTIME_ROUTINES,
6047
6090
  ORGANIZATION_SIGNUP_USE_CASE_RUNTIME_ROUTINES,
6048
6091
  SLACK_FILE_UPLOAD_OPERATIONS_TABLE,
@@ -6072,4 +6115,4 @@ export {
6072
6115
  runtimeDatabaseReadyCheck,
6073
6116
  provisionRoles
6074
6117
  };
6075
- //# sourceMappingURL=chunk-N5QCKHYL.js.map
6118
+ //# sourceMappingURL=chunk-T5NHDEZW.js.map