@opengeni/db 3.6.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-744DFC65.js → chunk-4NAR7FBA.js} +92 -6
- package/dist/chunk-4NAR7FBA.js.map +1 -0
- package/dist/{chunk-IW6O6G7R.js → chunk-5NNCGFQY.js} +2 -2
- package/dist/{chunk-G3732M3T.js → chunk-DZCYW2WT.js} +2 -2
- package/dist/{chunk-WW7AJ5IC.js → chunk-F6PBS6WE.js} +5 -7
- package/dist/chunk-F6PBS6WE.js.map +1 -0
- package/dist/{chunk-UJ2EW3QI.js → chunk-O56DM5GZ.js} +340 -85
- package/dist/chunk-O56DM5GZ.js.map +1 -0
- package/dist/{chunk-CDMMSUWJ.js → chunk-S3TDDCS2.js} +3 -3
- package/dist/{chunk-Q5YUGQVK.js → chunk-SZAWDXQC.js} +3 -3
- package/dist/{chunk-UGDVSQ6U.js → chunk-U4WPPEBH.js} +2 -2
- package/dist/{chunk-2NT476HD.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 +382 -18
- package/dist/index.js +4513 -2065
- 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 +5 -5
- package/dist/schema.d.ts +725 -4
- package/dist/schema.js +13 -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/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 +3626 -456
- 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 +83 -4
- package/src/runtime-posture.ts +22 -0
- package/src/schema.ts +161 -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/dist/chunk-744DFC65.js.map +0 -1
- package/dist/chunk-UJ2EW3QI.js.map +0 -1
- package/dist/chunk-WW7AJ5IC.js.map +0 -1
- /package/dist/{chunk-IW6O6G7R.js.map → chunk-5NNCGFQY.js.map} +0 -0
- /package/dist/{chunk-G3732M3T.js.map → chunk-DZCYW2WT.js.map} +0 -0
- /package/dist/{chunk-CDMMSUWJ.js.map → chunk-S3TDDCS2.js.map} +0 -0
- /package/dist/{chunk-Q5YUGQVK.js.map → chunk-SZAWDXQC.js.map} +0 -0
- /package/dist/{chunk-UGDVSQ6U.js.map → chunk-U4WPPEBH.js.map} +0 -0
- /package/dist/{chunk-2NT476HD.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
|
];
|
|
@@ -460,15 +463,21 @@ var GOVERNED_LEARNING_INSPECTION_AUTHORITY_TABLES = [
|
|
|
460
463
|
];
|
|
461
464
|
var COMPANY_PROFILE_AGENT_ADMIN_ROUTINES = [
|
|
462
465
|
"propose_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, text)",
|
|
463
|
-
"
|
|
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)"
|
|
464
470
|
];
|
|
465
471
|
var COMPANY_PROFILE_AGENT_ADMIN_AUTHORITY_TABLES = [
|
|
466
472
|
"company_profile_activation_events",
|
|
473
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
467
474
|
"company_profile_agent_confirmation_receipts",
|
|
468
475
|
"company_profile_agent_proposal_receipts",
|
|
469
476
|
"company_profile_heads",
|
|
470
477
|
"company_profile_revisions",
|
|
471
478
|
"managed_accounts",
|
|
479
|
+
"organization_company_profile_agent_policies",
|
|
480
|
+
"organization_company_profile_agent_policy_events",
|
|
472
481
|
"organization_memberships",
|
|
473
482
|
"session_human_input_requests",
|
|
474
483
|
"session_turn_attempts",
|
|
@@ -627,6 +636,7 @@ var RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES = [
|
|
|
627
636
|
...DOCUMENT_MIGRATION_AUDIT_INTERNAL_ROUTINES
|
|
628
637
|
];
|
|
629
638
|
var RUNTIME_TARGET_SCHEMA_INVOKER_ROUTINES = [
|
|
639
|
+
"resolve_workspace_codex_subscription_source(uuid, uuid)",
|
|
630
640
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
631
641
|
XAI_SNAPSHOT_VALIDATOR_ROUTINE
|
|
632
642
|
];
|
|
@@ -683,6 +693,7 @@ var FORCE_RLS_TABLES = [
|
|
|
683
693
|
"company_brain_preference_proposal_receipts",
|
|
684
694
|
"company_brain_turn_context_snapshots",
|
|
685
695
|
"company_profile_activation_events",
|
|
696
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
686
697
|
"company_profile_agent_confirmation_receipts",
|
|
687
698
|
"company_profile_agent_proposal_receipts",
|
|
688
699
|
"company_profile_heads",
|
|
@@ -791,6 +802,9 @@ var FORCE_RLS_TABLES = [
|
|
|
791
802
|
"model_call_facts",
|
|
792
803
|
"network_routes",
|
|
793
804
|
"new_session_drafts",
|
|
805
|
+
"organization_codex_rotation_settings",
|
|
806
|
+
"organization_company_profile_agent_policies",
|
|
807
|
+
"organization_company_profile_agent_policy_events",
|
|
794
808
|
"organization_invitation_binding_events",
|
|
795
809
|
"organization_membership_invitations",
|
|
796
810
|
"organization_membership_lifecycle_events",
|
|
@@ -873,6 +887,7 @@ var FORCE_RLS_TABLES = [
|
|
|
873
887
|
"session_attempt_tool_catalogs",
|
|
874
888
|
"session_background_commands",
|
|
875
889
|
"session_command_receipts",
|
|
890
|
+
"session_event_cursors",
|
|
876
891
|
"session_events",
|
|
877
892
|
"session_goal_revisions",
|
|
878
893
|
"session_goals",
|
|
@@ -949,6 +964,7 @@ var FORCE_RLS_TABLES = [
|
|
|
949
964
|
"workspace_artifact_versions",
|
|
950
965
|
"workspace_artifacts",
|
|
951
966
|
"workspace_captures",
|
|
967
|
+
"workspace_codex_subscription_preferences",
|
|
952
968
|
"workspace_control_events",
|
|
953
969
|
"workspace_inference_controls",
|
|
954
970
|
"workspace_instruction_policy_activation_events",
|
|
@@ -1062,6 +1078,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1062
1078
|
"memory_slack_publications",
|
|
1063
1079
|
"model_call_facts",
|
|
1064
1080
|
"new_session_drafts",
|
|
1081
|
+
"organization_codex_rotation_settings",
|
|
1065
1082
|
"pack_installation_components",
|
|
1066
1083
|
"pack_installations",
|
|
1067
1084
|
"pr_review_app_registrations",
|
|
@@ -1082,6 +1099,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1082
1099
|
"session_attempt_interruptions",
|
|
1083
1100
|
"session_background_commands",
|
|
1084
1101
|
"session_command_receipts",
|
|
1102
|
+
"session_event_cursors",
|
|
1085
1103
|
"session_events",
|
|
1086
1104
|
"session_goals",
|
|
1087
1105
|
"session_history_items",
|
|
@@ -1127,6 +1145,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
1127
1145
|
"video_generation_references",
|
|
1128
1146
|
"workspace_artifacts",
|
|
1129
1147
|
"workspace_captures",
|
|
1148
|
+
"workspace_codex_subscription_preferences",
|
|
1130
1149
|
"workspace_control_events",
|
|
1131
1150
|
"workspace_inference_controls",
|
|
1132
1151
|
"workspace_instruction_policy_heads",
|
|
@@ -1257,6 +1276,7 @@ var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1257
1276
|
"company_brain_context_selection_receipts",
|
|
1258
1277
|
"company_brain_preference_proposal_receipts",
|
|
1259
1278
|
"company_brain_turn_context_snapshots",
|
|
1279
|
+
"company_profile_agent_automatic_activation_receipts",
|
|
1260
1280
|
"company_profile_agent_confirmation_receipts",
|
|
1261
1281
|
"company_profile_agent_proposal_receipts",
|
|
1262
1282
|
"connection_use_audit_facts",
|
|
@@ -1282,6 +1302,8 @@ var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1282
1302
|
"managed_auth_login_transactions",
|
|
1283
1303
|
"managed_auth_session_set_operations",
|
|
1284
1304
|
"managed_auth_session_sets",
|
|
1305
|
+
"organization_company_profile_agent_policies",
|
|
1306
|
+
"organization_company_profile_agent_policy_events",
|
|
1285
1307
|
"organization_invitation_binding_events",
|
|
1286
1308
|
"organization_membership_invitations",
|
|
1287
1309
|
"organization_membership_lifecycle_events",
|
|
@@ -3118,7 +3140,9 @@ END $$;
|
|
|
3118
3140
|
`);
|
|
3119
3141
|
}
|
|
3120
3142
|
async function ensureLoginRole(sql2, role, password) {
|
|
3121
|
-
await
|
|
3143
|
+
await executeRoleConvergence(
|
|
3144
|
+
sql2,
|
|
3145
|
+
`
|
|
3122
3146
|
DO $$
|
|
3123
3147
|
BEGIN
|
|
3124
3148
|
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${literal(role)}) THEN
|
|
@@ -3127,10 +3151,13 @@ BEGIN
|
|
|
3127
3151
|
EXECUTE format('ALTER ROLE %I LOGIN PASSWORD %L', ${literal(role)}, ${literal(password)});
|
|
3128
3152
|
END IF;
|
|
3129
3153
|
END $$;
|
|
3130
|
-
`
|
|
3154
|
+
`
|
|
3155
|
+
);
|
|
3131
3156
|
}
|
|
3132
3157
|
async function ensureRestrictedAppLoginRole(sql2, role, password) {
|
|
3133
|
-
await
|
|
3158
|
+
await executeRoleConvergence(
|
|
3159
|
+
sql2,
|
|
3160
|
+
`
|
|
3134
3161
|
DO $$
|
|
3135
3162
|
BEGIN
|
|
3136
3163
|
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${literal(role)}) THEN
|
|
@@ -3158,7 +3185,26 @@ BEGIN
|
|
|
3158
3185
|
);
|
|
3159
3186
|
END IF;
|
|
3160
3187
|
END $$;
|
|
3161
|
-
`
|
|
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
|
+
}
|
|
3162
3208
|
}
|
|
3163
3209
|
async function assertAppRoleSafeToNormalize(sql2, role) {
|
|
3164
3210
|
const exists = await sql2`
|
|
@@ -3277,6 +3323,8 @@ async function grantAppRoleIfSchemaExists(sql2, role, schema) {
|
|
|
3277
3323
|
"list_organization_invitations(uuid,text,uuid,integer)",
|
|
3278
3324
|
"get_organization_administration_overview(uuid,text)",
|
|
3279
3325
|
"get_workspace_kind(uuid,uuid)",
|
|
3326
|
+
"resolve_workspace_codex_subscription_source(uuid,uuid)",
|
|
3327
|
+
"list_organization_workspace_ids(uuid)",
|
|
3280
3328
|
"organization_workspace_command(jsonb)",
|
|
3281
3329
|
"resolve_organization_workspace_removal_subject(uuid,text,uuid)",
|
|
3282
3330
|
"prepare_organization_workspace_member_removal(jsonb)",
|
|
@@ -3840,6 +3888,18 @@ BEGIN
|
|
|
3840
3888
|
${literal(role)}
|
|
3841
3889
|
);
|
|
3842
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;
|
|
3843
3903
|
IF to_regprocedure(
|
|
3844
3904
|
format(
|
|
3845
3905
|
'%I.confirm_company_profile_for_attempt(uuid,uuid,uuid,uuid,uuid,integer,uuid,uuid,uuid)',
|
|
@@ -3852,6 +3912,27 @@ BEGIN
|
|
|
3852
3912
|
${literal(role)}
|
|
3853
3913
|
);
|
|
3854
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;
|
|
3855
3936
|
IF to_regprocedure(
|
|
3856
3937
|
format(
|
|
3857
3938
|
'%I.workspace_learning_policy_apply_activation(uuid,text,uuid,uuid,uuid,uuid,bigint,text,text,text)',
|
|
@@ -4438,6 +4519,11 @@ BEGIN
|
|
|
4438
4519
|
EXECUTE format('REVOKE ALL ON FUNCTION %I.authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid) FROM PUBLIC', ${literal(schema)});
|
|
4439
4520
|
EXECUTE format('GRANT EXECUTE ON FUNCTION %I.authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid) TO %I', ${literal(schema)}, ${literal(role)});
|
|
4440
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;
|
|
4441
4527
|
IF to_regprocedure(format('%I.resolve_connection_use_authority(uuid,uuid,uuid,jsonb)', ${literal(schema)}))
|
|
4442
4528
|
IS NOT NULL THEN
|
|
4443
4529
|
EXECUTE format('REVOKE ALL ON FUNCTION %I.list_self_connection_authorities(uuid) FROM PUBLIC', ${literal(schema)});
|
|
@@ -5016,4 +5102,4 @@ export {
|
|
|
5016
5102
|
runtimeDatabaseReadyCheck,
|
|
5017
5103
|
provisionRoles
|
|
5018
5104
|
};
|
|
5019
|
-
//# sourceMappingURL=chunk-
|
|
5105
|
+
//# sourceMappingURL=chunk-4NAR7FBA.js.map
|