@opengeni/db 4.0.0-canary.2 → 4.0.0-canary.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.
- package/dist/canonical-human-identities.js +3 -3
- package/dist/{chunk-B5Y3TCSP.js → chunk-3JGOYOWD.js} +2 -2
- package/dist/{chunk-NPKBYGAK.js → chunk-CZXYNVEU.js} +2 -2
- package/dist/{chunk-L2QFSPFP.js → chunk-DIFDLF2C.js} +2 -2
- package/dist/{chunk-XIYAXH47.js → chunk-GPKHEPVX.js} +2 -2
- package/dist/{chunk-CQF6G4IF.js → chunk-HUCU5BDD.js} +3 -3
- package/dist/{chunk-VU2IK37Y.js → chunk-OWZ36ST7.js} +2 -2
- package/dist/{chunk-DUB3LUVM.js → chunk-R6LIJYG6.js} +140 -8
- package/dist/chunk-R6LIJYG6.js.map +1 -0
- package/dist/{chunk-FRIYCNK2.js → chunk-SOLRMQCL.js} +3 -1
- package/dist/chunk-SOLRMQCL.js.map +1 -0
- package/dist/{chunk-PWJJKCTF.js → chunk-WU3MSPZS.js} +19 -2
- package/dist/chunk-WU3MSPZS.js.map +1 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +37 -14
- package/dist/index.js.map +1 -1
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +1 -1
- package/dist/schema.d.ts +85 -0
- package/dist/schema.js +1 -1
- package/dist/session-background-commands.js +4 -4
- package/dist/session-command-output.js +4 -4
- package/dist/session-control.d.ts +26 -1
- package/dist/session-event-slices.js +2 -2
- package/dist/session-tenancy.js +3 -3
- package/dist/video-generation.js +3 -3
- package/dist/workspace-artifacts.d.ts +1 -0
- package/drizzle/0420_workspace_pause_timers.sql +53 -0
- package/drizzle/0421_recovery_notification_claim_snapshot.sql +279 -0
- package/drizzle/0422_personal_workspace_organization_codex_inheritance.sql +363 -0
- package/package.json +6 -6
- package/src/index.ts +23 -5
- package/src/provision-roles.ts +1 -0
- package/src/runtime-posture.ts +1 -0
- package/src/schema.ts +20 -1
- package/src/session-control.ts +177 -4
- package/src/workspace-artifacts.ts +9 -0
- package/dist/chunk-DUB3LUVM.js.map +0 -1
- package/dist/chunk-FRIYCNK2.js.map +0 -1
- package/dist/chunk-PWJJKCTF.js.map +0 -1
- /package/dist/{chunk-B5Y3TCSP.js.map → chunk-3JGOYOWD.js.map} +0 -0
- /package/dist/{chunk-NPKBYGAK.js.map → chunk-CZXYNVEU.js.map} +0 -0
- /package/dist/{chunk-L2QFSPFP.js.map → chunk-DIFDLF2C.js.map} +0 -0
- /package/dist/{chunk-XIYAXH47.js.map → chunk-GPKHEPVX.js.map} +0 -0
- /package/dist/{chunk-CQF6G4IF.js.map → chunk-HUCU5BDD.js.map} +0 -0
- /package/dist/{chunk-VU2IK37Y.js.map → chunk-OWZ36ST7.js.map} +0 -0
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
reapManagedAuthIsolatedSessions,
|
|
21
21
|
releaseManagedAuthActorMutationLease,
|
|
22
22
|
validateManagedAuthActorMutationLease
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-OWZ36ST7.js";
|
|
24
|
+
import "./chunk-GPKHEPVX.js";
|
|
25
|
+
import "./chunk-WU3MSPZS.js";
|
|
26
26
|
import "./chunk-PZ5AY32C.js";
|
|
27
27
|
export {
|
|
28
28
|
ManagedAuthActorMutationInFlightError,
|
package/dist/provision-roles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Database, RlsStrategy } from "./database.js";
|
|
2
2
|
export declare const WORK_CLAIM_CAPABILITY_ROUTINES: readonly ["upsert_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text, text, text, text, text)", "release_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)"];
|
|
3
|
-
export declare const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES: readonly ["company_brain_inspect_context_receipts(uuid, uuid, text, uuid, timestamp with time zone, uuid, integer)", "company_brain_context_get_or_create_selection(uuid, uuid, uuid, uuid, uuid, integer)", "propose_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, text)", "propose_company_profile_for_attempt_v2(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, text, text, text)", "confirm_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)", "get_company_profile_agent_policy(uuid, uuid, text)", "update_company_profile_agent_policy(uuid, uuid, text, text, bigint, uuid)", "evaluate_governed_learning_proposal(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, uuid)", "activate_governed_learning_decision(uuid, uuid, uuid, uuid)", "activate_human_confirmed_learning_decision(uuid, uuid, uuid, uuid, uuid)", "confirm_remember_knowledge_claim(uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)", "materialize_remember_knowledge_memory(uuid, uuid, uuid)", "undo_governed_learning_activation(uuid, uuid, uuid, uuid)", "inspect_governed_learning_decisions(uuid, uuid, text, integer)", "inspect_governed_learning_activations(uuid, uuid, text, integer)", "inspect_governed_learning_activation_undos(uuid, uuid, text, integer)", "fork_session_content(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)", "fork_session_content(uuid, uuid, uuid, text, uuid, text, text, text, integer)", "replay_applied_session_fork(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)", "session_tenancy_product_activated(uuid, integer)", "session_tenancy_any_product_activation()", "xai_subscription_authority_live(uuid, uuid, text, uuid, text, uuid, uuid, bigint)", "create_xai_subscription_credential(uuid, uuid, text, text, text, text, text, text, text, timestamp with time zone)", "disconnect_xai_subscription_credential(uuid, uuid, text, uuid, jsonb)", "google_drive_document_citation(uuid, uuid, text, uuid, uuid)", "google_drive_file_authorized(uuid, uuid, text, uuid)", "knowledge_source_sync_lock_authority(uuid, uuid, uuid)", "ensure_managed_human_personal_workspace(uuid, text, uuid)", "list_self_organization_memberships(text)", "list_self_organization_invitations(text)", "list_self_organization_invitations(text, uuid, integer)", "get_self_organization_invitation(text, uuid)", "list_organization_invitations(uuid, text, uuid, integer)", "list_organization_members(uuid, text)", "list_organization_administration_members(uuid, text)", "get_organization_administration_overview(uuid, text)", "get_workspace_kind(uuid, uuid)", "resolve_workspace_codex_subscription_source(uuid, uuid)", "list_organization_workspace_ids(uuid)", "organization_workspace_command(jsonb)", "authorize_organization_shared_workspace_administration(uuid, uuid, text)", "resolve_organization_workspace_removal_subject(uuid, text, uuid)", "prepare_organization_workspace_member_removal(jsonb)", "record_organization_workspace_member_removal(jsonb, uuid, uuid)", "create_additional_managed_organization(text, text, text, text, uuid)", "create_managed_organization(text, text, text, uuid)", "assert_organization_shared_workspace_administrator(uuid, uuid, text)", "open_organization_shared_workspace_administration_capability(uuid, uuid, text)", "close_organization_shared_workspace_administration_capability(uuid)", "create_organization_shared_workspace(uuid, text, text, text, text, uuid)", "upsert_organization_shared_workspace_member(uuid, uuid, text, uuid, text, text, jsonb, boolean)", "update_organization_name(uuid, text, text, timestamp with time zone, uuid)", "create_organization_invitation_v2(jsonb)", "bind_pending_organization_invitations_for_verified_email(text, text)", "has_pending_organization_invitation_for_subject(text)", "accept_organization_invitation_v2(jsonb)", "complete_self_service_organization_setup(jsonb)", "ensure_organization_user_setup_intent(jsonb)", "claim_organization_user_setup_delivery(jsonb)", "claim_organization_user_setup_delivery_v2(jsonb)", "prepare_organization_user_setup_delivery(jsonb)", "prepare_organization_user_setup_delivery_v2(jsonb)", "settle_organization_user_setup_delivery(jsonb)", "preview_organization_user_setup(text)", "get_organization_invitation_for_administration(uuid, text, uuid)", "preflight_organization_user_setup(text)", "complete_organization_user_setup(jsonb)", "organization_membership_command(jsonb)", "prepare_organization_membership_protocol_settlements(jsonb)", "assert_active_managed_human_organization_membership(uuid, text)", "resolve_workspace_writer_grant_identity(uuid, text)", "prepare_workspace_membership_removal_settlements(jsonb)", "workspace_membership_removal_command(jsonb)", "get_organization_retention_policy(uuid, text)", "preview_organization_retention_deletions(uuid, integer)", "claim_organization_retention_deletion(uuid, uuid, uuid[])", "list_organization_retention_deletion_objects(uuid, uuid, uuid, text, integer)", "record_organization_retention_object_deleted(uuid, uuid, uuid, text, text, text, text)", "fail_organization_retention_deletion(uuid, uuid, uuid, text)", "finalize_organization_retention_deletion(uuid, uuid, uuid, text)", "complete_organization_retention_deletion(uuid, uuid, uuid, text)", ...string[], "open_private_session_create_capability(uuid, uuid, uuid, text)", "open_private_child_session_create_capability(uuid, uuid, uuid, uuid, uuid, uuid, integer)", "close_private_session_create_capability(uuid)", "resolve_session_attempt_personal_resources(uuid, uuid, uuid)", "accept_turn_personal_resource_attachment(uuid, uuid, uuid, uuid, text, integer, boolean, integer)", "list_self_user_resource_authorities(uuid, uuid, text, uuid, integer)", "issue_self_user_resource_grant(uuid, uuid, uuid, text, text, text, uuid, integer, boolean)", "issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean)", "revoke_self_user_resource_grant(uuid, uuid, uuid)", "authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid)", "preference_registry_create_knowledge_proposal_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, uuid, text, text, text, text, integer, text, jsonb, timestamp with time zone, text)", "create_scoped_variable_set(uuid, uuid, text, text, text, jsonb, boolean)", "list_scoped_variable_sets(uuid, uuid, uuid, text, text)", "count_scoped_variable_sets(uuid, uuid, text)", "mutate_scoped_variable_set(uuid, uuid, uuid, text, text, boolean, text, boolean, text, text, boolean)", "read_scoped_variable_set_secret(uuid, uuid, uuid, text, text, text, uuid, uuid, uuid, integer)", "materialize_scoped_variable_set_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "materialize_scoped_variable_set_for_session(uuid, uuid, uuid, uuid)", "connection_authority_convergence_audit_capability_active(uuid)", "resolve_personal_connection_authority_selection(uuid, uuid, text, uuid, jsonb)", "resolve_accepted_connection_use(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, uuid, text, text, text, text)", "resolve_connection_use_authority(uuid, uuid, uuid, jsonb)", "inspect_organization_connection_authority_convergence(uuid, integer, uuid)", "get_self_personal_github_repository_selection(uuid, uuid, text, uuid)", "mutate_self_personal_github_repository_selection(uuid, uuid, text, uuid, bigint, bigint, text, jsonb, boolean)", "create_personal_document_authority(uuid, uuid, uuid)", "resolve_document_original_file(uuid, uuid, text, uuid)", "resolve_session_attempt_personal_document_reads(uuid, uuid, uuid, uuid)", "list_document_authority_reclassifications(uuid, uuid, text, uuid, integer, timestamp with time zone, uuid)", "reclassify_document_authority(jsonb)", "run_document_default_collection_backfill(jsonb)", "list_document_default_collection_backfill_runs(jsonb)", "get_document_default_collection_backfill_audit(jsonb)", "list_organization_document_authority_reclassifications(jsonb)", "create_scoped_rig(uuid, uuid, text, text, text, text, jsonb, boolean)", "list_scoped_rigs(uuid, uuid, uuid, text, text)", "count_scoped_rigs(uuid, uuid, text)", "mutate_scoped_rig(uuid, uuid, uuid, text, text, boolean, text, boolean, boolean)", "finalize_scoped_enrollment(uuid, uuid, text, text, boolean, boolean, text, text, text, boolean)", "list_scoped_enrollments(uuid, uuid, uuid, text)", "get_scoped_sandbox(uuid, uuid, uuid)", "authorize_scoped_sandbox_attach(uuid, uuid, uuid)", "materialize_scoped_rig_version_for_attempt(uuid, uuid, uuid, uuid, uuid, integer)", "authorize_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "assert_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid, boolean)", "list_scoped_machine_dependent_sessions(uuid, uuid, uuid)", "detach_scoped_machine_dependent_sessions(uuid, uuid, uuid)", "freeze_scheduled_task_personal_resources(uuid, uuid, uuid, bigint)", "clone_scheduled_task_personal_resource_authority(uuid, uuid, uuid, bigint, bigint)", "refresh_scheduled_task_personal_resources_clone_connections(uuid, uuid, uuid, bigint, bigint)", "create_scheduled_agent_run_with_admission(uuid, uuid, uuid, uuid, bigint, text, text, text, timestamp with time zone, timestamp with time zone, jsonb)", "materialize_scheduled_task_reusable_session_from_run(uuid, uuid, uuid, uuid, uuid, bigint, text)", "scheduled_task_run_personal_resource_authority(uuid, uuid, uuid)", "scheduled_task_run_connection_authority_subject(uuid, uuid, uuid)", "scheduled_task_personal_resource_authority_subject(uuid, uuid, uuid, bigint)", "record_scheduled_task_revision_authority(uuid, uuid, uuid, bigint)", "clone_scheduled_task_revision_authority(uuid, uuid, uuid, bigint, bigint)", "scheduled_task_revision_authority_subject(uuid, uuid, uuid, bigint)", "scheduled_task_revision_authority_snapshot(uuid, uuid, uuid, bigint)", "validate_scheduled_agent_run_live_authority(uuid, uuid, uuid)", "scheduled_scoped_rig_version_metadata(uuid, uuid, text, uuid, uuid)", "scheduled_variable_set_expected_generation_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "bind_scheduled_task_run_session(uuid, uuid, uuid, uuid)", "transition_scheduled_agent_run(uuid, uuid, uuid, uuid, uuid, text, text)", "ensure_canonical_human_identity(text, text)", "validate_canonical_human_session(text, text, boolean)", "get_canonical_human_identity_projection(text)", "apply_canonical_human_identity_operation(uuid, text, bigint, text, uuid, text, text, text)", "get_canonical_human_exact_login_binding(text, text)", "managed_auth_session_set_authority_state(text)", "managed_auth_session_set_snapshot(text, text, boolean, boolean, boolean)", "managed_auth_session_set_bootstrap(text, text, text, text, uuid, text, bigint, bigint)", "managed_auth_session_set_begin_transaction(text, text, text, uuid, text, bigint, uuid, bigint, text, text, uuid, uuid, text, timestamp with time zone)", "managed_auth_session_set_complete_transaction(text, text, uuid, text, bigint, bigint, uuid, text, text, text)", "managed_auth_session_set_mutate(text, text, uuid, text, bigint, bigint, text, uuid, uuid, uuid, text, text)", "managed_auth_actor_mutation_fence(text, bigint, uuid)", "managed_auth_actor_mutation_lease_acquire(text, bigint, uuid, integer)", "managed_auth_actor_mutation_lease_release(text, uuid)", "managed_auth_actor_mutation_lease_validate(text, bigint, uuid)", "managed_auth_adopted_session_snapshot(text)", "managed_auth_isolated_session_reap(integer)", "managed_auth_expired_session_set_reap(integer)", "managed_auth_session_set_operation_receipt(text, uuid, text, text)", "get_organization_recovery_overview(uuid, text, jsonb, text, text)", "organization_recovery_command(jsonb)", "create_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, integer)", "archive_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)", "list_task_notes_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, boolean, integer)", "replace_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, integer, text, text, integer, text)", "resolve_task_note_knowledge_promotion_source(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text)", "upsert_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text, text, text, text, text)", "release_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)", "session_private_actor_visible(uuid, uuid, uuid, text)", "session_reference_visible(uuid, uuid, uuid)", "session_visibility_lifecycle_capability_held()", "transition_session_visibility(uuid, uuid, uuid, text, text, integer, text, text, integer)", "xai_subscription_pool_visible(uuid, uuid, text, text, uuid)", "resolve_xai_authority_pool(uuid, uuid, text, jsonb)", "revalidate_xai_subscription_authority(uuid, text, uuid, jsonb)", "xai_provider_account_authority_snapshot_v1_valid(jsonb)"];
|
|
3
|
+
export declare const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES: readonly ["company_brain_inspect_context_receipts(uuid, uuid, text, uuid, timestamp with time zone, uuid, integer)", "company_brain_context_get_or_create_selection(uuid, uuid, uuid, uuid, uuid, integer)", "propose_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, text)", "propose_company_profile_for_attempt_v2(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, text, text, text)", "confirm_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)", "get_company_profile_agent_policy(uuid, uuid, text)", "update_company_profile_agent_policy(uuid, uuid, text, text, bigint, uuid)", "evaluate_governed_learning_proposal(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, uuid)", "activate_governed_learning_decision(uuid, uuid, uuid, uuid)", "activate_human_confirmed_learning_decision(uuid, uuid, uuid, uuid, uuid)", "confirm_remember_knowledge_claim(uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)", "materialize_remember_knowledge_memory(uuid, uuid, uuid)", "undo_governed_learning_activation(uuid, uuid, uuid, uuid)", "inspect_governed_learning_decisions(uuid, uuid, text, integer)", "inspect_governed_learning_activations(uuid, uuid, text, integer)", "inspect_governed_learning_activation_undos(uuid, uuid, text, integer)", "fork_session_content(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)", "fork_session_content(uuid, uuid, uuid, text, uuid, text, text, text, integer)", "replay_applied_session_fork(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)", "session_tenancy_product_activated(uuid, integer)", "session_tenancy_any_product_activation()", "xai_subscription_authority_live(uuid, uuid, text, uuid, text, uuid, uuid, bigint)", "create_xai_subscription_credential(uuid, uuid, text, text, text, text, text, text, text, timestamp with time zone)", "disconnect_xai_subscription_credential(uuid, uuid, text, uuid, jsonb)", "google_drive_document_citation(uuid, uuid, text, uuid, uuid)", "google_drive_file_authorized(uuid, uuid, text, uuid)", "knowledge_source_sync_lock_authority(uuid, uuid, uuid)", "ensure_managed_human_personal_workspace(uuid, text, uuid)", "list_self_organization_memberships(text)", "list_self_organization_invitations(text)", "list_self_organization_invitations(text, uuid, integer)", "get_self_organization_invitation(text, uuid)", "list_organization_invitations(uuid, text, uuid, integer)", "list_organization_members(uuid, text)", "list_organization_administration_members(uuid, text)", "get_organization_administration_overview(uuid, text)", "get_workspace_kind(uuid, uuid)", "resolve_workspace_codex_subscription_source(uuid, uuid)", "list_organization_workspace_ids(uuid)", "list_organization_codex_workspace_ids(uuid)", "organization_workspace_command(jsonb)", "authorize_organization_shared_workspace_administration(uuid, uuid, text)", "resolve_organization_workspace_removal_subject(uuid, text, uuid)", "prepare_organization_workspace_member_removal(jsonb)", "record_organization_workspace_member_removal(jsonb, uuid, uuid)", "create_additional_managed_organization(text, text, text, text, uuid)", "create_managed_organization(text, text, text, uuid)", "assert_organization_shared_workspace_administrator(uuid, uuid, text)", "open_organization_shared_workspace_administration_capability(uuid, uuid, text)", "close_organization_shared_workspace_administration_capability(uuid)", "create_organization_shared_workspace(uuid, text, text, text, text, uuid)", "upsert_organization_shared_workspace_member(uuid, uuid, text, uuid, text, text, jsonb, boolean)", "update_organization_name(uuid, text, text, timestamp with time zone, uuid)", "create_organization_invitation_v2(jsonb)", "bind_pending_organization_invitations_for_verified_email(text, text)", "has_pending_organization_invitation_for_subject(text)", "accept_organization_invitation_v2(jsonb)", "complete_self_service_organization_setup(jsonb)", "ensure_organization_user_setup_intent(jsonb)", "claim_organization_user_setup_delivery(jsonb)", "claim_organization_user_setup_delivery_v2(jsonb)", "prepare_organization_user_setup_delivery(jsonb)", "prepare_organization_user_setup_delivery_v2(jsonb)", "settle_organization_user_setup_delivery(jsonb)", "preview_organization_user_setup(text)", "get_organization_invitation_for_administration(uuid, text, uuid)", "preflight_organization_user_setup(text)", "complete_organization_user_setup(jsonb)", "organization_membership_command(jsonb)", "prepare_organization_membership_protocol_settlements(jsonb)", "assert_active_managed_human_organization_membership(uuid, text)", "resolve_workspace_writer_grant_identity(uuid, text)", "prepare_workspace_membership_removal_settlements(jsonb)", "workspace_membership_removal_command(jsonb)", "get_organization_retention_policy(uuid, text)", "preview_organization_retention_deletions(uuid, integer)", "claim_organization_retention_deletion(uuid, uuid, uuid[])", "list_organization_retention_deletion_objects(uuid, uuid, uuid, text, integer)", "record_organization_retention_object_deleted(uuid, uuid, uuid, text, text, text, text)", "fail_organization_retention_deletion(uuid, uuid, uuid, text)", "finalize_organization_retention_deletion(uuid, uuid, uuid, text)", "complete_organization_retention_deletion(uuid, uuid, uuid, text)", ...string[], "open_private_session_create_capability(uuid, uuid, uuid, text)", "open_private_child_session_create_capability(uuid, uuid, uuid, uuid, uuid, uuid, integer)", "close_private_session_create_capability(uuid)", "resolve_session_attempt_personal_resources(uuid, uuid, uuid)", "accept_turn_personal_resource_attachment(uuid, uuid, uuid, uuid, text, integer, boolean, integer)", "list_self_user_resource_authorities(uuid, uuid, text, uuid, integer)", "issue_self_user_resource_grant(uuid, uuid, uuid, text, text, text, uuid, integer, boolean)", "issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean)", "revoke_self_user_resource_grant(uuid, uuid, uuid)", "authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid)", "preference_registry_create_knowledge_proposal_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, uuid, text, text, text, text, integer, text, jsonb, timestamp with time zone, text)", "create_scoped_variable_set(uuid, uuid, text, text, text, jsonb, boolean)", "list_scoped_variable_sets(uuid, uuid, uuid, text, text)", "count_scoped_variable_sets(uuid, uuid, text)", "mutate_scoped_variable_set(uuid, uuid, uuid, text, text, boolean, text, boolean, text, text, boolean)", "read_scoped_variable_set_secret(uuid, uuid, uuid, text, text, text, uuid, uuid, uuid, integer)", "materialize_scoped_variable_set_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "materialize_scoped_variable_set_for_session(uuid, uuid, uuid, uuid)", "connection_authority_convergence_audit_capability_active(uuid)", "resolve_personal_connection_authority_selection(uuid, uuid, text, uuid, jsonb)", "resolve_accepted_connection_use(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, uuid, text, text, text, text)", "resolve_connection_use_authority(uuid, uuid, uuid, jsonb)", "inspect_organization_connection_authority_convergence(uuid, integer, uuid)", "get_self_personal_github_repository_selection(uuid, uuid, text, uuid)", "mutate_self_personal_github_repository_selection(uuid, uuid, text, uuid, bigint, bigint, text, jsonb, boolean)", "create_personal_document_authority(uuid, uuid, uuid)", "resolve_document_original_file(uuid, uuid, text, uuid)", "resolve_session_attempt_personal_document_reads(uuid, uuid, uuid, uuid)", "list_document_authority_reclassifications(uuid, uuid, text, uuid, integer, timestamp with time zone, uuid)", "reclassify_document_authority(jsonb)", "run_document_default_collection_backfill(jsonb)", "list_document_default_collection_backfill_runs(jsonb)", "get_document_default_collection_backfill_audit(jsonb)", "list_organization_document_authority_reclassifications(jsonb)", "create_scoped_rig(uuid, uuid, text, text, text, text, jsonb, boolean)", "list_scoped_rigs(uuid, uuid, uuid, text, text)", "count_scoped_rigs(uuid, uuid, text)", "mutate_scoped_rig(uuid, uuid, uuid, text, text, boolean, text, boolean, boolean)", "finalize_scoped_enrollment(uuid, uuid, text, text, boolean, boolean, text, text, text, boolean)", "list_scoped_enrollments(uuid, uuid, uuid, text)", "get_scoped_sandbox(uuid, uuid, uuid)", "authorize_scoped_sandbox_attach(uuid, uuid, uuid)", "materialize_scoped_rig_version_for_attempt(uuid, uuid, uuid, uuid, uuid, integer)", "authorize_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "assert_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid, boolean)", "list_scoped_machine_dependent_sessions(uuid, uuid, uuid)", "detach_scoped_machine_dependent_sessions(uuid, uuid, uuid)", "freeze_scheduled_task_personal_resources(uuid, uuid, uuid, bigint)", "clone_scheduled_task_personal_resource_authority(uuid, uuid, uuid, bigint, bigint)", "refresh_scheduled_task_personal_resources_clone_connections(uuid, uuid, uuid, bigint, bigint)", "create_scheduled_agent_run_with_admission(uuid, uuid, uuid, uuid, bigint, text, text, text, timestamp with time zone, timestamp with time zone, jsonb)", "materialize_scheduled_task_reusable_session_from_run(uuid, uuid, uuid, uuid, uuid, bigint, text)", "scheduled_task_run_personal_resource_authority(uuid, uuid, uuid)", "scheduled_task_run_connection_authority_subject(uuid, uuid, uuid)", "scheduled_task_personal_resource_authority_subject(uuid, uuid, uuid, bigint)", "record_scheduled_task_revision_authority(uuid, uuid, uuid, bigint)", "clone_scheduled_task_revision_authority(uuid, uuid, uuid, bigint, bigint)", "scheduled_task_revision_authority_subject(uuid, uuid, uuid, bigint)", "scheduled_task_revision_authority_snapshot(uuid, uuid, uuid, bigint)", "validate_scheduled_agent_run_live_authority(uuid, uuid, uuid)", "scheduled_scoped_rig_version_metadata(uuid, uuid, text, uuid, uuid)", "scheduled_variable_set_expected_generation_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)", "bind_scheduled_task_run_session(uuid, uuid, uuid, uuid)", "transition_scheduled_agent_run(uuid, uuid, uuid, uuid, uuid, text, text)", "ensure_canonical_human_identity(text, text)", "validate_canonical_human_session(text, text, boolean)", "get_canonical_human_identity_projection(text)", "apply_canonical_human_identity_operation(uuid, text, bigint, text, uuid, text, text, text)", "get_canonical_human_exact_login_binding(text, text)", "managed_auth_session_set_authority_state(text)", "managed_auth_session_set_snapshot(text, text, boolean, boolean, boolean)", "managed_auth_session_set_bootstrap(text, text, text, text, uuid, text, bigint, bigint)", "managed_auth_session_set_begin_transaction(text, text, text, uuid, text, bigint, uuid, bigint, text, text, uuid, uuid, text, timestamp with time zone)", "managed_auth_session_set_complete_transaction(text, text, uuid, text, bigint, bigint, uuid, text, text, text)", "managed_auth_session_set_mutate(text, text, uuid, text, bigint, bigint, text, uuid, uuid, uuid, text, text)", "managed_auth_actor_mutation_fence(text, bigint, uuid)", "managed_auth_actor_mutation_lease_acquire(text, bigint, uuid, integer)", "managed_auth_actor_mutation_lease_release(text, uuid)", "managed_auth_actor_mutation_lease_validate(text, bigint, uuid)", "managed_auth_adopted_session_snapshot(text)", "managed_auth_isolated_session_reap(integer)", "managed_auth_expired_session_set_reap(integer)", "managed_auth_session_set_operation_receipt(text, uuid, text, text)", "get_organization_recovery_overview(uuid, text, jsonb, text, text)", "organization_recovery_command(jsonb)", "create_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, integer)", "archive_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)", "list_task_notes_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, boolean, integer)", "replace_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, integer, text, text, integer, text)", "resolve_task_note_knowledge_promotion_source(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text)", "upsert_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text, text, text, text, text)", "release_session_work_claim_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)", "session_private_actor_visible(uuid, uuid, uuid, text)", "session_reference_visible(uuid, uuid, uuid)", "session_visibility_lifecycle_capability_held()", "transition_session_visibility(uuid, uuid, uuid, text, text, integer, text, text, integer)", "xai_subscription_pool_visible(uuid, uuid, text, text, uuid)", "resolve_xai_authority_pool(uuid, uuid, text, jsonb)", "revalidate_xai_subscription_authority(uuid, text, uuid, jsonb)", "xai_provider_account_authority_snapshot_v1_valid(jsonb)"];
|
|
4
4
|
/**
|
|
5
5
|
* Boolean-only predicates that shared-table RLS policies must be able to
|
|
6
6
|
* evaluate under table owners and SECURITY DEFINER roles unknown at migration
|
package/dist/schema.d.ts
CHANGED
|
@@ -1463,6 +1463,91 @@ export declare const workspaceInferenceControls: import("drizzle-orm/pg-core").P
|
|
|
1463
1463
|
identity: undefined;
|
|
1464
1464
|
generated: undefined;
|
|
1465
1465
|
}, {}, {}>;
|
|
1466
|
+
timerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1467
|
+
name: "timer_id";
|
|
1468
|
+
tableName: "workspace_inference_controls";
|
|
1469
|
+
dataType: "string";
|
|
1470
|
+
columnType: "PgUUID";
|
|
1471
|
+
data: string;
|
|
1472
|
+
driverParam: string;
|
|
1473
|
+
notNull: false;
|
|
1474
|
+
hasDefault: false;
|
|
1475
|
+
isPrimaryKey: false;
|
|
1476
|
+
isAutoincrement: false;
|
|
1477
|
+
hasRuntimeDefault: false;
|
|
1478
|
+
enumValues: undefined;
|
|
1479
|
+
baseColumn: never;
|
|
1480
|
+
identity: undefined;
|
|
1481
|
+
generated: undefined;
|
|
1482
|
+
}, {}, {}>;
|
|
1483
|
+
timerAction: import("drizzle-orm/pg-core").PgColumn<{
|
|
1484
|
+
name: "timer_action";
|
|
1485
|
+
tableName: "workspace_inference_controls";
|
|
1486
|
+
dataType: "string";
|
|
1487
|
+
columnType: "PgText";
|
|
1488
|
+
data: string;
|
|
1489
|
+
driverParam: string;
|
|
1490
|
+
notNull: false;
|
|
1491
|
+
hasDefault: false;
|
|
1492
|
+
isPrimaryKey: false;
|
|
1493
|
+
isAutoincrement: false;
|
|
1494
|
+
hasRuntimeDefault: false;
|
|
1495
|
+
enumValues: [string, ...string[]];
|
|
1496
|
+
baseColumn: never;
|
|
1497
|
+
identity: undefined;
|
|
1498
|
+
generated: undefined;
|
|
1499
|
+
}, {}, {}>;
|
|
1500
|
+
timerDueAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
1501
|
+
name: "timer_due_at";
|
|
1502
|
+
tableName: "workspace_inference_controls";
|
|
1503
|
+
dataType: "date";
|
|
1504
|
+
columnType: "PgTimestamp";
|
|
1505
|
+
data: Date;
|
|
1506
|
+
driverParam: string;
|
|
1507
|
+
notNull: false;
|
|
1508
|
+
hasDefault: false;
|
|
1509
|
+
isPrimaryKey: false;
|
|
1510
|
+
isAutoincrement: false;
|
|
1511
|
+
hasRuntimeDefault: false;
|
|
1512
|
+
enumValues: undefined;
|
|
1513
|
+
baseColumn: never;
|
|
1514
|
+
identity: undefined;
|
|
1515
|
+
generated: undefined;
|
|
1516
|
+
}, {}, {}>;
|
|
1517
|
+
timerPauseForSeconds: import("drizzle-orm/pg-core").PgColumn<{
|
|
1518
|
+
name: "timer_pause_for_seconds";
|
|
1519
|
+
tableName: "workspace_inference_controls";
|
|
1520
|
+
dataType: "number";
|
|
1521
|
+
columnType: "PgInteger";
|
|
1522
|
+
data: number;
|
|
1523
|
+
driverParam: string | number;
|
|
1524
|
+
notNull: false;
|
|
1525
|
+
hasDefault: false;
|
|
1526
|
+
isPrimaryKey: false;
|
|
1527
|
+
isAutoincrement: false;
|
|
1528
|
+
hasRuntimeDefault: false;
|
|
1529
|
+
enumValues: undefined;
|
|
1530
|
+
baseColumn: never;
|
|
1531
|
+
identity: undefined;
|
|
1532
|
+
generated: undefined;
|
|
1533
|
+
}, {}, {}>;
|
|
1534
|
+
timerPauseRevision: import("drizzle-orm/pg-core").PgColumn<{
|
|
1535
|
+
name: "timer_pause_revision";
|
|
1536
|
+
tableName: "workspace_inference_controls";
|
|
1537
|
+
dataType: "number";
|
|
1538
|
+
columnType: "PgBigInt53";
|
|
1539
|
+
data: number;
|
|
1540
|
+
driverParam: string | number;
|
|
1541
|
+
notNull: false;
|
|
1542
|
+
hasDefault: false;
|
|
1543
|
+
isPrimaryKey: false;
|
|
1544
|
+
isAutoincrement: false;
|
|
1545
|
+
hasRuntimeDefault: false;
|
|
1546
|
+
enumValues: undefined;
|
|
1547
|
+
baseColumn: never;
|
|
1548
|
+
identity: undefined;
|
|
1549
|
+
generated: undefined;
|
|
1550
|
+
}, {}, {}>;
|
|
1466
1551
|
workspacePauseRevision: import("drizzle-orm/pg-core").PgColumn<{
|
|
1467
1552
|
name: "workspace_pause_revision";
|
|
1468
1553
|
tableName: "workspace_inference_controls";
|
package/dist/schema.js
CHANGED
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
settleClaimedConnectedMachineBackgroundCommandWithMutation,
|
|
23
23
|
settleConnectedMachineSessionBackgroundCommandWithMutation,
|
|
24
24
|
settleSessionBackgroundCommandForRetainedProcessInTransaction
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-R6LIJYG6.js";
|
|
26
|
+
import "./chunk-HUCU5BDD.js";
|
|
27
|
+
import "./chunk-GPKHEPVX.js";
|
|
28
|
+
import "./chunk-WU3MSPZS.js";
|
|
29
29
|
import "./chunk-PZ5AY32C.js";
|
|
30
30
|
export {
|
|
31
31
|
COMMAND_OUTPUT_DEFAULT_BYTES,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
lockSessionEventWriteRows
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-R6LIJYG6.js";
|
|
4
|
+
import "./chunk-HUCU5BDD.js";
|
|
5
5
|
import {
|
|
6
6
|
withSessionActivityRlsContext
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GPKHEPVX.js";
|
|
8
8
|
import {
|
|
9
9
|
fromPostgresLosslessJson,
|
|
10
10
|
sandboxRetainedProcesses,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
sessionEvents,
|
|
13
13
|
sessions,
|
|
14
14
|
withLosslessContentWriteVersion
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WU3MSPZS.js";
|
|
16
16
|
import "./chunk-PZ5AY32C.js";
|
|
17
17
|
|
|
18
18
|
// src/session-command-output.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SessionMcpApprovalPolicy, type TurnInitiatorContext } from "@opengeni/contracts";
|
|
1
|
+
import { type WorkspacePauseTimerRequest, type SessionMcpApprovalPolicy, type TurnInitiatorContext } from "@opengeni/contracts";
|
|
2
2
|
import type { Database, SessionActivityDatabase } from "./database.js";
|
|
3
3
|
import * as schema from "./schema.js";
|
|
4
4
|
export declare const SESSION_ANCESTRY_LIMIT = 10000;
|
|
@@ -131,6 +131,11 @@ export type WorkspaceControlRow = {
|
|
|
131
131
|
revision: number | string;
|
|
132
132
|
workspaceState: string;
|
|
133
133
|
workspacePauseRevision: number | string | null;
|
|
134
|
+
timerId: string | null;
|
|
135
|
+
timerAction: string | null;
|
|
136
|
+
timerDueAt: Date | string | null;
|
|
137
|
+
timerPauseForSeconds: number | null;
|
|
138
|
+
timerPauseRevision: number | string | null;
|
|
134
139
|
reason: string | null;
|
|
135
140
|
changedBy: string | null;
|
|
136
141
|
changedAt: Date | string | null;
|
|
@@ -584,7 +589,27 @@ export declare function mutateWorkspaceControlInTransaction(db: Database, input:
|
|
|
584
589
|
operationKey: string;
|
|
585
590
|
action: "pause" | "resume";
|
|
586
591
|
reason?: string | null;
|
|
592
|
+
/** Internal timer executor retains/replaces its own timer atomically. */
|
|
593
|
+
timerExecution?: boolean;
|
|
587
594
|
expectedRevision?: number | null;
|
|
588
595
|
/** Request-scoped callers bound the control prefix wait; lifecycle callers omit it. */
|
|
589
596
|
controlLockTimeoutMs?: number;
|
|
590
597
|
}): Promise<WorkspaceControlMutationResult>;
|
|
598
|
+
export declare class WorkspacePauseTimerInputError extends Error {
|
|
599
|
+
}
|
|
600
|
+
/** Called under workspace RLS. The same control fence serializes timers and human actions. */
|
|
601
|
+
export declare function setWorkspacePauseTimerInTransaction(db: Database, input: WorkspacePauseTimerRequest & {
|
|
602
|
+
accountId: string;
|
|
603
|
+
workspaceId: string;
|
|
604
|
+
subjectId: string;
|
|
605
|
+
}): Promise<{
|
|
606
|
+
workspaceControlEventId: string | null;
|
|
607
|
+
}>;
|
|
608
|
+
/** Discovery is a hint. Identity, deadline and pause ownership are rechecked under the fence. */
|
|
609
|
+
export declare function fireWorkspacePauseTimerInTransaction(db: Database, input: {
|
|
610
|
+
workspaceId: string;
|
|
611
|
+
timerId: string;
|
|
612
|
+
}): Promise<{
|
|
613
|
+
workspaceControlEventId: string | null;
|
|
614
|
+
wakeCount: number;
|
|
615
|
+
} | null>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rawRows,
|
|
3
3
|
withWorkspaceRls
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GPKHEPVX.js";
|
|
5
5
|
import {
|
|
6
6
|
LOSSLESS_JSON_STRING_PREFIX,
|
|
7
7
|
fromPostgresLosslessJson,
|
|
8
8
|
sessionEvents,
|
|
9
9
|
sessionTurns
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WU3MSPZS.js";
|
|
11
11
|
import "./chunk-PZ5AY32C.js";
|
|
12
12
|
|
|
13
13
|
// src/session-event-slices.ts
|
package/dist/session-tenancy.js
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
replayAppliedSessionFork,
|
|
15
15
|
sessionTenancyProductActivated,
|
|
16
16
|
transitionSessionVisibility
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-3JGOYOWD.js";
|
|
18
|
+
import "./chunk-GPKHEPVX.js";
|
|
19
|
+
import "./chunk-WU3MSPZS.js";
|
|
20
20
|
import "./chunk-PZ5AY32C.js";
|
|
21
21
|
export {
|
|
22
22
|
SessionTenancyAccessError,
|
package/dist/video-generation.js
CHANGED
|
@@ -29,9 +29,9 @@ import {
|
|
|
29
29
|
settleVideoGenerationFailure,
|
|
30
30
|
settleVideoGenerationReady,
|
|
31
31
|
updateWorkspaceVideoGenerationPolicy
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-HUCU5BDD.js";
|
|
33
|
+
import "./chunk-GPKHEPVX.js";
|
|
34
|
+
import "./chunk-WU3MSPZS.js";
|
|
35
35
|
import "./chunk-PZ5AY32C.js";
|
|
36
36
|
export {
|
|
37
37
|
ACTIVE_VIDEO_GENERATION_STATUSES,
|
|
@@ -45,6 +45,7 @@ export declare function listWorkspaceArtifacts(db: Database, workspaceId: string
|
|
|
45
45
|
limit?: number;
|
|
46
46
|
cursor?: string;
|
|
47
47
|
status?: "active" | "archived";
|
|
48
|
+
sourceSessionId?: string;
|
|
48
49
|
}): Promise<{
|
|
49
50
|
artifacts: WorkspaceArtifact[];
|
|
50
51
|
nextCursor: string | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- deployment-mode: maintenance
|
|
2
|
+
-- Drain old API/control/turn workers before activation. New timer event actions
|
|
3
|
+
-- and manual-control cancellation semantics must be installed together.
|
|
4
|
+
ALTER TABLE workspace_inference_controls
|
|
5
|
+
ADD COLUMN timer_id uuid,
|
|
6
|
+
ADD COLUMN timer_action text,
|
|
7
|
+
ADD COLUMN timer_due_at timestamptz,
|
|
8
|
+
ADD COLUMN timer_pause_for_seconds integer,
|
|
9
|
+
ADD COLUMN timer_pause_revision bigint,
|
|
10
|
+
ADD CONSTRAINT workspace_pause_timer_shape CHECK (
|
|
11
|
+
(timer_id IS NULL AND timer_action IS NULL AND timer_due_at IS NULL
|
|
12
|
+
AND timer_pause_for_seconds IS NULL AND timer_pause_revision IS NULL)
|
|
13
|
+
OR (timer_id IS NOT NULL AND timer_action IS NOT NULL AND timer_due_at IS NOT NULL
|
|
14
|
+
AND ((timer_action = 'pause' AND timer_pause_revision IS NULL)
|
|
15
|
+
OR (timer_action = 'resume' AND timer_pause_revision IS NOT NULL AND timer_pause_for_seconds IS NULL))
|
|
16
|
+
AND (timer_pause_for_seconds IS NULL OR timer_pause_for_seconds BETWEEN 60 AND 2592000))
|
|
17
|
+
);
|
|
18
|
+
CREATE INDEX workspace_pause_timer_due_idx ON workspace_inference_controls(timer_due_at, workspace_id)
|
|
19
|
+
WHERE timer_id IS NOT NULL;
|
|
20
|
+
ALTER TABLE workspace_control_events DROP CONSTRAINT workspace_control_events_action_check;
|
|
21
|
+
ALTER TABLE workspace_control_events ADD CONSTRAINT workspace_control_events_action_check
|
|
22
|
+
CHECK (action IN ('pause', 'resume', 'timer_set', 'timer_cancelled'));
|
|
23
|
+
|
|
24
|
+
-- Narrow, read-only inventory capability. FORCE RLS stays enabled; only the
|
|
25
|
+
-- table owner inside this SECURITY DEFINER function gets cross-tenant discovery.
|
|
26
|
+
DO $migration$
|
|
27
|
+
DECLARE data_schema text := current_schema(); owner_name text := current_user;
|
|
28
|
+
BEGIN
|
|
29
|
+
EXECUTE format('CREATE POLICY workspace_pause_timer_discovery ON %I.workspace_inference_controls
|
|
30
|
+
FOR SELECT TO %I USING (current_setting(''opengeni.pause_timer_discovery'', true) = ''1'')',
|
|
31
|
+
data_schema, owner_name);
|
|
32
|
+
EXECUTE format($create$
|
|
33
|
+
CREATE FUNCTION opengeni_private.list_due_workspace_pause_timers(p_limit integer)
|
|
34
|
+
RETURNS TABLE(workspace_id uuid, timer_id uuid)
|
|
35
|
+
LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog
|
|
36
|
+
AS $body$
|
|
37
|
+
DECLARE previous text := current_setting('opengeni.pause_timer_discovery', true);
|
|
38
|
+
BEGIN
|
|
39
|
+
PERFORM set_config('opengeni.pause_timer_discovery', '1', true);
|
|
40
|
+
RETURN QUERY SELECT c.workspace_id, c.timer_id FROM %I.workspace_inference_controls c
|
|
41
|
+
WHERE c.timer_id IS NOT NULL AND c.timer_due_at <= clock_timestamp()
|
|
42
|
+
ORDER BY c.timer_due_at, c.workspace_id LIMIT greatest(1, least(coalesce(p_limit, 100), 1000));
|
|
43
|
+
PERFORM set_config('opengeni.pause_timer_discovery', coalesce(previous, ''), true);
|
|
44
|
+
END $body$;
|
|
45
|
+
$create$, data_schema);
|
|
46
|
+
END $migration$;
|
|
47
|
+
REVOKE ALL ON FUNCTION opengeni_private.list_due_workspace_pause_timers(integer) FROM PUBLIC;
|
|
48
|
+
DO $grant$
|
|
49
|
+
BEGIN
|
|
50
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
|
|
51
|
+
GRANT EXECUTE ON FUNCTION opengeni_private.list_due_workspace_pause_timers(integer) TO opengeni_app;
|
|
52
|
+
END IF;
|
|
53
|
+
END $grant$;
|