@opengeni/db 3.5.2-canary.0 → 3.7.3-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.
- package/dist/canonical-human-identities.js +3 -3
- package/dist/{chunk-PERPE2UY.js → chunk-4NAR7FBA.js} +122 -6
- package/dist/chunk-4NAR7FBA.js.map +1 -0
- package/dist/{chunk-ORKVXHL2.js → chunk-5NNCGFQY.js} +2 -2
- package/dist/{chunk-TRCYF26N.js → chunk-DZCYW2WT.js} +2 -2
- package/dist/{chunk-X6T2P3L3.js → chunk-F6PBS6WE.js} +5 -7
- package/dist/chunk-F6PBS6WE.js.map +1 -0
- package/dist/{chunk-6NYKC5DD.js → chunk-O56DM5GZ.js} +5062 -4661
- package/dist/chunk-O56DM5GZ.js.map +1 -0
- package/dist/{chunk-FJHEWYV5.js → chunk-S3TDDCS2.js} +3 -3
- package/dist/{chunk-Y44FKTYU.js → chunk-SZAWDXQC.js} +3 -3
- package/dist/{chunk-U7NKCX5E.js → chunk-U4WPPEBH.js} +2 -2
- package/dist/{chunk-NRGUX3M5.js → chunk-US4IS6IV.js} +2 -2
- package/dist/codex-token-resolver.d.ts +12 -1
- package/dist/company-profile-agent-admin.d.ts +4 -2
- package/dist/company-profile-agent-policy.d.ts +20 -0
- package/dist/company-profile-schema.d.ts +573 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +404 -20
- package/dist/index.js +5433 -2309
- package/dist/index.js.map +1 -1
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/managed-human-provisioning.d.ts +3 -3
- package/dist/memory-domain.d.ts +5 -3
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +7 -6
- package/dist/schema.d.ts +732 -10
- package/dist/schema.js +19 -1
- package/dist/session-background-commands.js +3 -3
- package/dist/session-control.d.ts +40 -5
- package/dist/session-queue-commands.d.ts +2 -0
- package/dist/session-tenancy.js +3 -3
- package/dist/user-resource-authority.d.ts +8 -0
- package/dist/video-generation.js +3 -3
- package/dist/work-claims-schema.d.ts +975 -0
- package/dist/work-claims.d.ts +83 -0
- package/drizzle/0365_permission_scoped_work_claims.sql +1306 -0
- package/drizzle/0366_session_discovery_title_search_index.sql +5 -0
- package/drizzle/0367_session_discovery_goal_search_index.sql +5 -0
- package/drizzle/0368_session_discovery_claim_search_index.sql +6 -0
- package/drizzle/0369_local_human_personal_authority.sql +350 -0
- package/drizzle/0370_workspace_member_management_scope.sql +98 -0
- package/drizzle/0371_workspace_member_candidate_inventory.sql +128 -0
- package/drizzle/0372_ordered_variable_set_runtime_authority.sql +287 -0
- package/drizzle/0373_sandbox_shared_preparation.sql +59 -0
- package/drizzle/0374_session_event_cursors.sql +315 -0
- package/drizzle/0375_session_recovery_observability.sql +73 -0
- package/drizzle/0376_organization_workspace_inventory.sql +88 -0
- package/drizzle/0377_scoped_rig_health_projection.sql +80 -0
- package/drizzle/0378_scoped_rig_health_audit_timestamp.sql +77 -0
- package/drizzle/0379_session_event_raw_lane_activation.sql +518 -0
- package/drizzle/0380_autonomous_company_profile_agent_policy.sql +829 -0
- package/drizzle/0381_organization_codex_subscription_inheritance.sql +720 -0
- package/drizzle/0382_organization_api_key_provenance.sql +91 -0
- package/drizzle/0383_codex_cooldown_reconciliation.sql +51 -0
- package/drizzle/0384_codex_cooldown_revision_guard_privileges.sql +6 -0
- package/drizzle/0385_connected_machine_legacy_tilde_workdirs.sql +25 -0
- package/drizzle/0386_local_organization_administration.sql +157 -0
- package/package.json +6 -6
- package/src/codex-token-resolver.ts +26 -1
- package/src/company-brain-governed-writes.ts +30 -1
- package/src/company-profile-agent-admin.ts +68 -1
- package/src/company-profile-agent-policy.ts +126 -0
- package/src/company-profile-schema.ts +115 -1
- package/src/database.ts +3 -5
- package/src/index.ts +4677 -786
- package/src/managed-human-provisioning.ts +3 -3
- package/src/memory-domain.ts +9 -4
- package/src/organization-membership-lifecycle.ts +0 -1
- package/src/provision-roles.ts +101 -4
- package/src/runtime-posture.ts +34 -0
- package/src/schema.ts +162 -8
- package/src/session-control.ts +177 -59
- package/src/session-queue-commands.ts +146 -40
- package/src/session-tool-call-settlement.ts +34 -7
- package/src/user-resource-authority.ts +56 -0
- package/src/work-claims-schema.ts +148 -0
- package/src/work-claims.ts +200 -0
- package/dist/chunk-6NYKC5DD.js.map +0 -1
- package/dist/chunk-PERPE2UY.js.map +0 -1
- package/dist/chunk-X6T2P3L3.js.map +0 -1
- /package/dist/{chunk-ORKVXHL2.js.map → chunk-5NNCGFQY.js.map} +0 -0
- /package/dist/{chunk-TRCYF26N.js.map → chunk-DZCYW2WT.js.map} +0 -0
- /package/dist/{chunk-FJHEWYV5.js.map → chunk-S3TDDCS2.js.map} +0 -0
- /package/dist/{chunk-Y44FKTYU.js.map → chunk-SZAWDXQC.js.map} +0 -0
- /package/dist/{chunk-U7NKCX5E.js.map → chunk-U4WPPEBH.js.map} +0 -0
- /package/dist/{chunk-NRGUX3M5.js.map → chunk-US4IS6IV.js.map} +0 -0
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
getCanonicalHumanIdentityProjection,
|
|
12
12
|
synchronizeCanonicalHumanLoginBindings,
|
|
13
13
|
validateCanonicalHumanSession
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-U4WPPEBH.js";
|
|
15
|
+
import "./chunk-F6PBS6WE.js";
|
|
16
|
+
import "./chunk-O56DM5GZ.js";
|
|
17
17
|
import "./chunk-PZ5AY32C.js";
|
|
18
18
|
export {
|
|
19
19
|
CanonicalHumanIdentityAuthorityError,
|
|
@@ -158,6 +158,8 @@ var ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES = [
|
|
|
158
158
|
"list_organization_administration_members(uuid, text)",
|
|
159
159
|
"get_organization_administration_overview(uuid, text)",
|
|
160
160
|
"get_workspace_kind(uuid, uuid)",
|
|
161
|
+
"resolve_workspace_codex_subscription_source(uuid, uuid)",
|
|
162
|
+
"list_organization_workspace_ids(uuid)",
|
|
161
163
|
"organization_workspace_command(jsonb)",
|
|
162
164
|
"resolve_organization_workspace_removal_subject(uuid, text, uuid)",
|
|
163
165
|
"prepare_organization_workspace_member_removal(jsonb)",
|
|
@@ -275,6 +277,7 @@ var USER_RESOURCE_LIFECYCLE_ROUTINES = [
|
|
|
275
277
|
"accept_turn_personal_resource_attachment(uuid, uuid, uuid, uuid, text, integer, boolean, integer)",
|
|
276
278
|
"list_self_user_resource_authorities(uuid, uuid, text, uuid, integer)",
|
|
277
279
|
"issue_self_user_resource_grant(uuid, uuid, uuid, text, text, text, uuid, integer, boolean)",
|
|
280
|
+
"issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean)",
|
|
278
281
|
"revoke_self_user_resource_grant(uuid, uuid, uuid)",
|
|
279
282
|
"authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid)"
|
|
280
283
|
];
|
|
@@ -433,6 +436,10 @@ var TASK_NOTE_CAPABILITY_ROUTINES = [
|
|
|
433
436
|
"replace_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, integer, text, text, integer, text)",
|
|
434
437
|
"resolve_task_note_knowledge_promotion_source(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text)"
|
|
435
438
|
];
|
|
439
|
+
var WORK_CLAIM_CAPABILITY_ROUTINES = [
|
|
440
|
+
"upsert_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text, text, text, text, text)",
|
|
441
|
+
"release_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)"
|
|
442
|
+
];
|
|
436
443
|
var COMPANY_BRAIN_CONTEXT_SELECTION_ROUTINE = "company_brain_context_get_or_create_selection(uuid, uuid, uuid, uuid, uuid, integer)";
|
|
437
444
|
var COMPANY_BRAIN_CONTEXT_INSPECTION_ROUTINE = "company_brain_inspect_context_receipts(uuid, uuid, text, uuid, timestamp with time zone, uuid, integer)";
|
|
438
445
|
var GOVERNED_LEARNING_EVALUATION_ROUTINE = "evaluate_governed_learning_proposal(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, uuid)";
|
|
@@ -456,15 +463,21 @@ var GOVERNED_LEARNING_INSPECTION_AUTHORITY_TABLES = [
|
|
|
456
463
|
];
|
|
457
464
|
var COMPANY_PROFILE_AGENT_ADMIN_ROUTINES = [
|
|
458
465
|
"propose_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, text)",
|
|
459
|
-
"
|
|
466
|
+
"propose_company_profile_for_attempt_v2(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, text, text, text)",
|
|
467
|
+
"confirm_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)",
|
|
468
|
+
"get_company_profile_agent_policy(uuid, uuid, text)",
|
|
469
|
+
"update_company_profile_agent_policy(uuid, uuid, text, text, bigint, uuid)"
|
|
460
470
|
];
|
|
461
471
|
var COMPANY_PROFILE_AGENT_ADMIN_AUTHORITY_TABLES = [
|
|
462
472
|
"company_profile_activation_events",
|
|
473
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
463
474
|
"company_profile_agent_confirmation_receipts",
|
|
464
475
|
"company_profile_agent_proposal_receipts",
|
|
465
476
|
"company_profile_heads",
|
|
466
477
|
"company_profile_revisions",
|
|
467
478
|
"managed_accounts",
|
|
479
|
+
"organization_company_profile_agent_policies",
|
|
480
|
+
"organization_company_profile_agent_policy_events",
|
|
468
481
|
"organization_memberships",
|
|
469
482
|
"session_human_input_requests",
|
|
470
483
|
"session_turn_attempts",
|
|
@@ -545,6 +558,7 @@ var SESSION_AUTHORITY_ROUTINES = /* @__PURE__ */ new Set([
|
|
|
545
558
|
...PRIVATE_SESSION_CREATE_CAPABILITY_ROUTINES,
|
|
546
559
|
TRANSITION_SESSION_VISIBILITY_ROUTINE,
|
|
547
560
|
...TASK_NOTE_CAPABILITY_ROUTINES,
|
|
561
|
+
...WORK_CLAIM_CAPABILITY_ROUTINES,
|
|
548
562
|
COMPANY_BRAIN_CONTEXT_SELECTION_ROUTINE,
|
|
549
563
|
COMPANY_BRAIN_CONTEXT_INSPECTION_ROUTINE
|
|
550
564
|
]);
|
|
@@ -597,6 +611,7 @@ var RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
|
597
611
|
...MANAGED_AUTH_SESSION_SET_ROUTINES,
|
|
598
612
|
...ORGANIZATION_RECOVERY_ROUTINES,
|
|
599
613
|
...TASK_NOTE_CAPABILITY_ROUTINES,
|
|
614
|
+
...WORK_CLAIM_CAPABILITY_ROUTINES,
|
|
600
615
|
SESSION_PRIVATE_ACTOR_VISIBLE_ROUTINE,
|
|
601
616
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
602
617
|
SESSION_VISIBILITY_LIFECYCLE_CAPABILITY_ROUTINE,
|
|
@@ -621,6 +636,7 @@ var RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES = [
|
|
|
621
636
|
...DOCUMENT_MIGRATION_AUDIT_INTERNAL_ROUTINES
|
|
622
637
|
];
|
|
623
638
|
var RUNTIME_TARGET_SCHEMA_INVOKER_ROUTINES = [
|
|
639
|
+
"resolve_workspace_codex_subscription_source(uuid, uuid)",
|
|
624
640
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
625
641
|
XAI_SNAPSHOT_VALIDATOR_ROUTINE
|
|
626
642
|
];
|
|
@@ -677,6 +693,7 @@ var FORCE_RLS_TABLES = [
|
|
|
677
693
|
"company_brain_preference_proposal_receipts",
|
|
678
694
|
"company_brain_turn_context_snapshots",
|
|
679
695
|
"company_profile_activation_events",
|
|
696
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
680
697
|
"company_profile_agent_confirmation_receipts",
|
|
681
698
|
"company_profile_agent_proposal_receipts",
|
|
682
699
|
"company_profile_heads",
|
|
@@ -785,6 +802,9 @@ var FORCE_RLS_TABLES = [
|
|
|
785
802
|
"model_call_facts",
|
|
786
803
|
"network_routes",
|
|
787
804
|
"new_session_drafts",
|
|
805
|
+
"organization_codex_rotation_settings",
|
|
806
|
+
"organization_company_profile_agent_policies",
|
|
807
|
+
"organization_company_profile_agent_policy_events",
|
|
788
808
|
"organization_invitation_binding_events",
|
|
789
809
|
"organization_membership_invitations",
|
|
790
810
|
"organization_membership_lifecycle_events",
|
|
@@ -867,6 +887,7 @@ var FORCE_RLS_TABLES = [
|
|
|
867
887
|
"session_attempt_tool_catalogs",
|
|
868
888
|
"session_background_commands",
|
|
869
889
|
"session_command_receipts",
|
|
890
|
+
"session_event_cursors",
|
|
870
891
|
"session_events",
|
|
871
892
|
"session_goal_revisions",
|
|
872
893
|
"session_goals",
|
|
@@ -892,6 +913,9 @@ var FORCE_RLS_TABLES = [
|
|
|
892
913
|
"session_turns",
|
|
893
914
|
"session_variable_set_attachments",
|
|
894
915
|
"session_visibility_write_capabilities",
|
|
916
|
+
"session_work_claim_revisions",
|
|
917
|
+
"session_work_claim_write_capabilities",
|
|
918
|
+
"session_work_claims",
|
|
895
919
|
"session_workflow_wake_outbox",
|
|
896
920
|
"sessions",
|
|
897
921
|
"site_auth_connections",
|
|
@@ -940,6 +964,7 @@ var FORCE_RLS_TABLES = [
|
|
|
940
964
|
"workspace_artifact_versions",
|
|
941
965
|
"workspace_artifacts",
|
|
942
966
|
"workspace_captures",
|
|
967
|
+
"workspace_codex_subscription_preferences",
|
|
943
968
|
"workspace_control_events",
|
|
944
969
|
"workspace_inference_controls",
|
|
945
970
|
"workspace_instruction_policy_activation_events",
|
|
@@ -1053,6 +1078,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1053
1078
|
"memory_slack_publications",
|
|
1054
1079
|
"model_call_facts",
|
|
1055
1080
|
"new_session_drafts",
|
|
1081
|
+
"organization_codex_rotation_settings",
|
|
1056
1082
|
"pack_installation_components",
|
|
1057
1083
|
"pack_installations",
|
|
1058
1084
|
"pr_review_app_registrations",
|
|
@@ -1073,6 +1099,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1073
1099
|
"session_attempt_interruptions",
|
|
1074
1100
|
"session_background_commands",
|
|
1075
1101
|
"session_command_receipts",
|
|
1102
|
+
"session_event_cursors",
|
|
1076
1103
|
"session_events",
|
|
1077
1104
|
"session_goals",
|
|
1078
1105
|
"session_history_items",
|
|
@@ -1118,6 +1145,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1118
1145
|
"video_generation_references",
|
|
1119
1146
|
"workspace_artifacts",
|
|
1120
1147
|
"workspace_captures",
|
|
1148
|
+
"workspace_codex_subscription_preferences",
|
|
1121
1149
|
"workspace_control_events",
|
|
1122
1150
|
"workspace_inference_controls",
|
|
1123
1151
|
"workspace_instruction_policy_heads",
|
|
@@ -1146,6 +1174,7 @@ var RUNTIME_READ_ONLY_TABLES = [
|
|
|
1146
1174
|
"preference_registry_events",
|
|
1147
1175
|
"preference_registry_snapshots",
|
|
1148
1176
|
"session_tenancy_activations",
|
|
1177
|
+
"session_work_claims",
|
|
1149
1178
|
"slack_installation_bindings",
|
|
1150
1179
|
"slack_task_policy_activation_events",
|
|
1151
1180
|
"slack_task_policy_heads",
|
|
@@ -1247,6 +1276,7 @@ var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1247
1276
|
"company_brain_context_selection_receipts",
|
|
1248
1277
|
"company_brain_preference_proposal_receipts",
|
|
1249
1278
|
"company_brain_turn_context_snapshots",
|
|
1279
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
1250
1280
|
"company_profile_agent_confirmation_receipts",
|
|
1251
1281
|
"company_profile_agent_proposal_receipts",
|
|
1252
1282
|
"connection_use_audit_facts",
|
|
@@ -1272,6 +1302,8 @@ var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1272
1302
|
"managed_auth_login_transactions",
|
|
1273
1303
|
"managed_auth_session_set_operations",
|
|
1274
1304
|
"managed_auth_session_sets",
|
|
1305
|
+
"organization_company_profile_agent_policies",
|
|
1306
|
+
"organization_company_profile_agent_policy_events",
|
|
1275
1307
|
"organization_invitation_binding_events",
|
|
1276
1308
|
"organization_membership_invitations",
|
|
1277
1309
|
"organization_membership_lifecycle_events",
|
|
@@ -1329,6 +1361,8 @@ var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1329
1361
|
"session_tenancy_greenfield_activation_evidence",
|
|
1330
1362
|
"session_variable_set_attachments",
|
|
1331
1363
|
"session_visibility_write_capabilities",
|
|
1364
|
+
"session_work_claim_revisions",
|
|
1365
|
+
"session_work_claim_write_capabilities",
|
|
1332
1366
|
"task_note_events",
|
|
1333
1367
|
"task_note_knowledge_promotion_capabilities",
|
|
1334
1368
|
"task_note_replacement_receipts",
|
|
@@ -3106,7 +3140,9 @@ END $$;
|
|
|
3106
3140
|
`);
|
|
3107
3141
|
}
|
|
3108
3142
|
async function ensureLoginRole(sql2, role, password) {
|
|
3109
|
-
await
|
|
3143
|
+
await executeRoleConvergence(
|
|
3144
|
+
sql2,
|
|
3145
|
+
`
|
|
3110
3146
|
DO $$
|
|
3111
3147
|
BEGIN
|
|
3112
3148
|
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${literal(role)}) THEN
|
|
@@ -3115,10 +3151,13 @@ BEGIN
|
|
|
3115
3151
|
EXECUTE format('ALTER ROLE %I LOGIN PASSWORD %L', ${literal(role)}, ${literal(password)});
|
|
3116
3152
|
END IF;
|
|
3117
3153
|
END $$;
|
|
3118
|
-
`
|
|
3154
|
+
`
|
|
3155
|
+
);
|
|
3119
3156
|
}
|
|
3120
3157
|
async function ensureRestrictedAppLoginRole(sql2, role, password) {
|
|
3121
|
-
await
|
|
3158
|
+
await executeRoleConvergence(
|
|
3159
|
+
sql2,
|
|
3160
|
+
`
|
|
3122
3161
|
DO $$
|
|
3123
3162
|
BEGIN
|
|
3124
3163
|
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${literal(role)}) THEN
|
|
@@ -3146,7 +3185,26 @@ BEGIN
|
|
|
3146
3185
|
);
|
|
3147
3186
|
END IF;
|
|
3148
3187
|
END $$;
|
|
3149
|
-
`
|
|
3188
|
+
`
|
|
3189
|
+
);
|
|
3190
|
+
}
|
|
3191
|
+
var ROLE_CONVERGENCE_MAX_ATTEMPTS = 20;
|
|
3192
|
+
function isRetryableConcurrentRoleMutation(error) {
|
|
3193
|
+
const details = error;
|
|
3194
|
+
return details.code === "XX000" && details.message === "tuple concurrently updated" && details.routine === "simple_heap_update" || details.code === "42710" && typeof details.message === "string" && /^role ".+" already exists$/u.test(details.message);
|
|
3195
|
+
}
|
|
3196
|
+
async function executeRoleConvergence(sql2, statement) {
|
|
3197
|
+
for (let attempt = 1; attempt <= ROLE_CONVERGENCE_MAX_ATTEMPTS; attempt += 1) {
|
|
3198
|
+
try {
|
|
3199
|
+
await sql2.unsafe(statement);
|
|
3200
|
+
return;
|
|
3201
|
+
} catch (error) {
|
|
3202
|
+
if (!isRetryableConcurrentRoleMutation(error) || attempt === ROLE_CONVERGENCE_MAX_ATTEMPTS) {
|
|
3203
|
+
throw error;
|
|
3204
|
+
}
|
|
3205
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(25 * attempt, 250)));
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3150
3208
|
}
|
|
3151
3209
|
async function assertAppRoleSafeToNormalize(sql2, role) {
|
|
3152
3210
|
const exists = await sql2`
|
|
@@ -3254,6 +3312,7 @@ async function grantAppRoleIfSchemaExists(sql2, role, schema) {
|
|
|
3254
3312
|
const runtimeReadUpdateTables = `ARRAY[${RUNTIME_READ_UPDATE_TABLES.map(literal).join(", ")}]`;
|
|
3255
3313
|
const runtimeReadInsertTables = `ARRAY[${RUNTIME_READ_INSERT_TABLES.map(literal).join(", ")}]`;
|
|
3256
3314
|
const runtimeReadInsertUpdateTables = `ARRAY[${RUNTIME_READ_INSERT_UPDATE_TABLES.map(literal).join(", ")}]`;
|
|
3315
|
+
const workClaimCapabilityRoutines = `ARRAY[${WORK_CLAIM_CAPABILITY_ROUTINES.map(literal).join(", ")}]`;
|
|
3257
3316
|
const organizationMembershipLifecycleRoutines = `ARRAY[${[
|
|
3258
3317
|
"list_self_organization_memberships(text)",
|
|
3259
3318
|
"list_self_organization_invitations(text)",
|
|
@@ -3264,6 +3323,8 @@ async function grantAppRoleIfSchemaExists(sql2, role, schema) {
|
|
|
3264
3323
|
"list_organization_invitations(uuid,text,uuid,integer)",
|
|
3265
3324
|
"get_organization_administration_overview(uuid,text)",
|
|
3266
3325
|
"get_workspace_kind(uuid,uuid)",
|
|
3326
|
+
"resolve_workspace_codex_subscription_source(uuid,uuid)",
|
|
3327
|
+
"list_organization_workspace_ids(uuid)",
|
|
3267
3328
|
"organization_workspace_command(jsonb)",
|
|
3268
3329
|
"resolve_organization_workspace_removal_subject(uuid,text,uuid)",
|
|
3269
3330
|
"prepare_organization_workspace_member_removal(jsonb)",
|
|
@@ -3763,6 +3824,22 @@ BEGIN
|
|
|
3763
3824
|
${literal(role)}
|
|
3764
3825
|
);
|
|
3765
3826
|
END IF;
|
|
3827
|
+
-- Migration 0365 creates the advisory work-claim mutation capabilities
|
|
3828
|
+
-- before a custom runtime role may exist. Re-converge their exact grants
|
|
3829
|
+
-- for migrate-then-provision installs without exposing claim history or
|
|
3830
|
+
-- the write-capability ledger to direct runtime DML.
|
|
3831
|
+
FOREACH routine_signature IN ARRAY ${workClaimCapabilityRoutines} LOOP
|
|
3832
|
+
IF to_regprocedure(format('%I.%s', ${literal(schema)}, routine_signature)) IS NOT NULL THEN
|
|
3833
|
+
EXECUTE format(
|
|
3834
|
+
'REVOKE ALL ON FUNCTION %I.%s FROM PUBLIC',
|
|
3835
|
+
${literal(schema)}, routine_signature
|
|
3836
|
+
);
|
|
3837
|
+
EXECUTE format(
|
|
3838
|
+
'GRANT EXECUTE ON FUNCTION %I.%s TO %I',
|
|
3839
|
+
${literal(schema)}, routine_signature, ${literal(role)}
|
|
3840
|
+
);
|
|
3841
|
+
END IF;
|
|
3842
|
+
END LOOP;
|
|
3766
3843
|
IF to_regprocedure(
|
|
3767
3844
|
format(
|
|
3768
3845
|
'%I.workspace_instruction_policy_get_or_create_snapshot(uuid,uuid,uuid,uuid,uuid,integer)',
|
|
@@ -3811,6 +3888,18 @@ BEGIN
|
|
|
3811
3888
|
${literal(role)}
|
|
3812
3889
|
);
|
|
3813
3890
|
END IF;
|
|
3891
|
+
IF to_regprocedure(
|
|
3892
|
+
format(
|
|
3893
|
+
'%I.propose_company_profile_for_attempt_v2(uuid,uuid,uuid,uuid,uuid,integer,uuid,uuid,text,text,text)',
|
|
3894
|
+
${literal(schema)}
|
|
3895
|
+
)
|
|
3896
|
+
) IS NOT NULL THEN
|
|
3897
|
+
EXECUTE format(
|
|
3898
|
+
'GRANT EXECUTE ON FUNCTION %I.propose_company_profile_for_attempt_v2(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, text, text, text) TO %I',
|
|
3899
|
+
${literal(schema)},
|
|
3900
|
+
${literal(role)}
|
|
3901
|
+
);
|
|
3902
|
+
END IF;
|
|
3814
3903
|
IF to_regprocedure(
|
|
3815
3904
|
format(
|
|
3816
3905
|
'%I.confirm_company_profile_for_attempt(uuid,uuid,uuid,uuid,uuid,integer,uuid,uuid,uuid)',
|
|
@@ -3823,6 +3912,27 @@ BEGIN
|
|
|
3823
3912
|
${literal(role)}
|
|
3824
3913
|
);
|
|
3825
3914
|
END IF;
|
|
3915
|
+
IF to_regprocedure(
|
|
3916
|
+
format('%I.get_company_profile_agent_policy(uuid,uuid,text)', ${literal(schema)})
|
|
3917
|
+
) IS NOT NULL THEN
|
|
3918
|
+
EXECUTE format(
|
|
3919
|
+
'GRANT EXECUTE ON FUNCTION %I.get_company_profile_agent_policy(uuid, uuid, text) TO %I',
|
|
3920
|
+
${literal(schema)},
|
|
3921
|
+
${literal(role)}
|
|
3922
|
+
);
|
|
3923
|
+
END IF;
|
|
3924
|
+
IF to_regprocedure(
|
|
3925
|
+
format(
|
|
3926
|
+
'%I.update_company_profile_agent_policy(uuid,uuid,text,text,bigint,uuid)',
|
|
3927
|
+
${literal(schema)}
|
|
3928
|
+
)
|
|
3929
|
+
) IS NOT NULL THEN
|
|
3930
|
+
EXECUTE format(
|
|
3931
|
+
'GRANT EXECUTE ON FUNCTION %I.update_company_profile_agent_policy(uuid, uuid, text, text, bigint, uuid) TO %I',
|
|
3932
|
+
${literal(schema)},
|
|
3933
|
+
${literal(role)}
|
|
3934
|
+
);
|
|
3935
|
+
END IF;
|
|
3826
3936
|
IF to_regprocedure(
|
|
3827
3937
|
format(
|
|
3828
3938
|
'%I.workspace_learning_policy_apply_activation(uuid,text,uuid,uuid,uuid,uuid,bigint,text,text,text)',
|
|
@@ -4409,6 +4519,11 @@ BEGIN
|
|
|
4409
4519
|
EXECUTE format('REVOKE ALL ON FUNCTION %I.authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid) FROM PUBLIC', ${literal(schema)});
|
|
4410
4520
|
EXECUTE format('GRANT EXECUTE ON FUNCTION %I.authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid) TO %I', ${literal(schema)}, ${literal(role)});
|
|
4411
4521
|
END IF;
|
|
4522
|
+
IF to_regprocedure(format('%I.issue_self_local_connection_use_grant(uuid,uuid,uuid,text,boolean)', ${literal(schema)}))
|
|
4523
|
+
IS NOT NULL THEN
|
|
4524
|
+
EXECUTE format('REVOKE ALL ON FUNCTION %I.issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean) FROM PUBLIC', ${literal(schema)});
|
|
4525
|
+
EXECUTE format('GRANT EXECUTE ON FUNCTION %I.issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean) TO %I', ${literal(schema)}, ${literal(role)});
|
|
4526
|
+
END IF;
|
|
4412
4527
|
IF to_regprocedure(format('%I.resolve_connection_use_authority(uuid,uuid,uuid,jsonb)', ${literal(schema)}))
|
|
4413
4528
|
IS NOT NULL THEN
|
|
4414
4529
|
EXECUTE format('REVOKE ALL ON FUNCTION %I.list_self_connection_authorities(uuid) FROM PUBLIC', ${literal(schema)});
|
|
@@ -4965,6 +5080,7 @@ if (import.meta.main) {
|
|
|
4965
5080
|
}
|
|
4966
5081
|
|
|
4967
5082
|
export {
|
|
5083
|
+
WORK_CLAIM_CAPABILITY_ROUTINES,
|
|
4968
5084
|
RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES,
|
|
4969
5085
|
RUNTIME_TARGET_SCHEMA_PUBLIC_POLICY_PREDICATE_ROUTINES,
|
|
4970
5086
|
RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES,
|
|
@@ -4986,4 +5102,4 @@ export {
|
|
|
4986
5102
|
runtimeDatabaseReadyCheck,
|
|
4987
5103
|
provisionRoles
|
|
4988
5104
|
};
|
|
4989
|
-
//# sourceMappingURL=chunk-
|
|
5105
|
+
//# sourceMappingURL=chunk-4NAR7FBA.js.map
|