@opengeni/db 1.0.1 → 3.2.0-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/attached-browser-devices.d.ts +7 -0
- package/dist/automations.d.ts +154 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-integrations.d.ts +13 -0
- package/dist/child-lifecycle-notices.d.ts +68 -0
- package/dist/{chunk-4SR4HKKA.js → chunk-2EH4WRHL.js} +19 -11
- package/dist/chunk-2EH4WRHL.js.map +1 -0
- package/dist/{chunk-CUPM3FGB.js → chunk-2PRS4J5Q.js} +3 -3
- package/dist/chunk-6HMM2R5T.js +390 -0
- package/dist/chunk-6HMM2R5T.js.map +1 -0
- package/dist/{chunk-ZWREYEWA.js → chunk-AZHW7R5V.js} +56 -11
- package/dist/chunk-AZHW7R5V.js.map +1 -0
- package/dist/{chunk-LTG3S6ZY.js → chunk-E6CLMKEE.js} +2 -2
- package/dist/{chunk-6ZYKCRFO.js → chunk-KRLPEMLH.js} +7591 -4417
- package/dist/chunk-KRLPEMLH.js.map +1 -0
- package/dist/chunk-NAB6FKFN.js +516 -0
- package/dist/chunk-NAB6FKFN.js.map +1 -0
- package/dist/{chunk-SK7YYHBI.js → chunk-SIBYBA2D.js} +46 -1
- package/dist/chunk-SIBYBA2D.js.map +1 -0
- package/dist/chunk-UZNXG44K.js +4508 -0
- package/dist/chunk-UZNXG44K.js.map +1 -0
- package/dist/codemode-operations.d.ts +1 -6
- package/dist/company-brain-context-selection-schema.d.ts +705 -0
- package/dist/company-brain-context-selection.d.ts +94 -0
- package/dist/company-brain-governed-writes.d.ts +24 -0
- package/dist/company-brain.d.ts +55 -0
- package/dist/company-profile-agent-admin.d.ts +15 -0
- package/dist/company-profile-schema.d.ts +619 -2
- package/dist/company-profile.d.ts +9 -4
- package/dist/connection-authority.d.ts +95 -0
- package/dist/connection-scopes.d.ts +8 -0
- package/dist/connection-tenancy-backfill.d.ts +85 -0
- package/dist/connection-token-resolver.d.ts +30 -1
- package/dist/database.d.ts +23 -4
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.d.ts +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/governed-learning-activation-schema.d.ts +984 -0
- package/dist/governed-learning-activation.d.ts +98 -0
- package/dist/governed-learning-evaluator-schema.d.ts +633 -0
- package/dist/governed-learning-evaluator.d.ts +28 -0
- package/dist/index.d.ts +1606 -81
- package/dist/index.js +21898 -8147
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +18 -0
- package/dist/integration-bindings.d.ts +1 -0
- package/dist/integration-facets.d.ts +30 -0
- package/dist/interaction-placement-loss.d.ts +22 -0
- package/dist/managed-human-provisioning.d.ts +25 -0
- package/dist/memory-domain.d.ts +3 -3
- package/dist/migrate.d.ts +11 -1
- package/dist/migrate.js +1 -1
- package/dist/new-session-drafts.d.ts +43 -5
- package/dist/organization-membership-backfill.d.ts +174 -0
- package/dist/organization-membership-lifecycle.d.ts +162 -0
- package/dist/pr-review.d.ts +107 -0
- package/dist/preference-registry-schema.d.ts +2 -0
- package/dist/preference-registry.d.ts +2 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +29 -8
- package/dist/schema.d.ts +24914 -13703
- package/dist/schema.js +99 -1
- package/dist/scoped-knowledge-schema.d.ts +52 -1
- package/dist/session-background-commands.d.ts +125 -0
- package/dist/session-background-commands.js +34 -0
- package/dist/session-background-commands.js.map +1 -0
- package/dist/session-control.d.ts +156 -3
- package/dist/session-goal-pacing.d.ts +68 -0
- package/dist/session-queue-commands.d.ts +43 -4
- package/dist/session-realtime-ledger.d.ts +2 -0
- package/dist/session-tenancy.d.ts +71 -1
- package/dist/session-tenancy.js +25 -3
- package/dist/session-tool-call-settlement.d.ts +9 -4
- package/dist/slack-routing-personal-workspace.d.ts +23 -0
- package/dist/slack-routing.d.ts +268 -0
- package/dist/slack-task-policy-schema.d.ts +34 -0
- package/dist/slack-task-policy.d.ts +8 -0
- package/dist/slack-user-link-access.d.ts +28 -0
- package/dist/task-notes-schema.d.ts +594 -0
- package/dist/task-notes.d.ts +39 -0
- package/dist/turn-initiator.d.ts +2 -0
- package/dist/user-resource-authority.d.ts +109 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-authority.d.ts +81 -0
- package/dist/workspace-instruction-policies-schema.d.ts +279 -0
- package/dist/workspace-instruction-policies.d.ts +62 -0
- package/dist/workspace-learning-policy.d.ts +1 -0
- package/dist/workspace-membership-permissions.d.ts +2 -0
- package/drizzle/0240_enrollment_connection_authority.sql +39 -0
- package/drizzle/0241_atomic_personal_resource_delegation.sql +1000 -0
- package/drizzle/0241_enrollment_agent_runtime.sql +70 -0
- package/drizzle/0244_slack_app_home_refresh_queue.sql +120 -0
- package/drizzle/0245_model_context_contribution_facts.sql +88 -0
- package/drizzle/0246_integration_personal_instance_authority.sql +70 -0
- package/drizzle/0247_terraform_stacks_provenance_repair.sql +428 -0
- package/drizzle/0248_terraform_stacks_component_resolution_fence.sql +83 -0
- package/drizzle/0249_personal_resource_delegation_authority_correction.sql +662 -0
- package/drizzle/0250_direct_retained_process_owner_liveness.sql +199 -0
- package/drizzle/0251_connected_machine_operation_policy.sql +45 -0
- package/drizzle/0252_scheduled_personal_resource_delegation.sql +1867 -0
- package/drizzle/0253_common_user_resource_authority_lifecycle.sql +1555 -0
- package/drizzle/0254_scoped_variable_set_authority.sql +1255 -0
- package/drizzle/0255_company_brain_governed_write_proposals.sql +524 -0
- package/drizzle/0256_connection_authority_delegation.sql +703 -0
- package/drizzle/0257_goal_revision_decisions_and_root_constraints.sql +436 -0
- package/drizzle/0258_three_scope_document_knowledge_authority.sql +1273 -0
- package/drizzle/0259_company_brain_context_selection_receipts.sql +869 -0
- package/drizzle/0260_task_note_knowledge_promotion.sql +820 -0
- package/drizzle/0261_preference_knowledge_proposal_actor_binding.sql +471 -0
- package/drizzle/0262_scoped_connected_machines_and_rigs.sql +1700 -0
- package/drizzle/0263_organization_membership_lifecycle.sql +3284 -0
- package/drizzle/0264_connection_authority_runtime_activation.sql +1084 -0
- package/drizzle/0266_company_brain_context_receipt_inspection.sql +156 -0
- package/drizzle/0268_governed_learning_decision_receipts.sql +825 -0
- package/drizzle/0269_governed_learning_activation_controller.sql +1874 -0
- package/drizzle/0270_governed_learning_history_inspection.sql +170 -0
- package/drizzle/0271_company_brain_retrieval_only_default.sql +524 -0
- package/drizzle/0272_human_confirmed_learning_activation.sql +591 -0
- package/drizzle/0273_scheduled_variable_set_materialization.sql +268 -0
- package/drizzle/0274_human_confirmed_knowledge_review.sql +310 -0
- package/drizzle/0275_scheduled_connection_authority.sql +5527 -0
- package/drizzle/0276_onboarding_proposal_initiating_human_guc.sql +198 -0
- package/drizzle/0277_workspace_writer_authority_attribution.sql +393 -0
- package/drizzle/0278_workspace_membership_removal_fencing.sql +1174 -0
- package/drizzle/0279_workspace_connection_use_lane.sql +343 -0
- package/drizzle/0280_connection_and_variable_set_audit_attribution.sql +773 -0
- package/drizzle/0281_viewer_holder_authority_claims.sql +52 -0
- package/drizzle/0282_variable_set_session_attach_attribution.sql +178 -0
- package/drizzle/0283_editable_spreadsheet_authored_state.sql +82 -0
- package/drizzle/0284_truthful_human_confirmed_review_reason.sql +930 -0
- package/drizzle/0285_organization_tenancy_inventory.sql +329 -0
- package/drizzle/0286_widen_task_note_expiry_ceiling.sql +391 -0
- package/drizzle/0287_open_suffix_pending_tool_calls.sql +18 -0
- package/drizzle/0288_attached_browser_reenrollment.sql +64 -0
- package/drizzle/0289_session_composer_policy_authority.sql +597 -0
- package/drizzle/0290_organization_membership_backfill.sql +268 -0
- package/drizzle/0291_resource_authority_classification_assertion.sql +371 -0
- package/drizzle/0292_truthful_tenancy_inventory_counters.sql +291 -0
- package/drizzle/0293_confirm_time_rule_rebaseline.sql +615 -0
- package/drizzle/0294_preference_activation_authority.sql +237 -0
- package/drizzle/0295_retire_legacy_standing_memory_mode.sql +476 -0
- package/drizzle/0296_force_rls_backfill_noop_repair.sql +215 -0
- package/drizzle/0297_session_ownership_classification_and_backfill.sql +752 -0
- package/drizzle/0298_organization_tenancy_parity.sql +609 -0
- package/drizzle/0299_organization_membership_lock_order.sql +291 -0
- package/drizzle/0300_tenancy_backfill_ledger.sql +459 -0
- package/drizzle/0301_session_snapshot_and_pin_visibility.sql +181 -0
- package/drizzle/0302_personal_workspace_session_ownership.sql +303 -0
- package/drizzle/0303_session_tenancy_product_activation.sql +919 -0
- package/drizzle/0304_personal_workspace_private_session_reads.sql +97 -0
- package/drizzle/0305_personal_resource_grant_management.sql +584 -0
- package/drizzle/0306_atomic_personal_resource_attachments.sql +1374 -0
- package/drizzle/0307_session_attention_state.sql +51 -0
- package/drizzle/0308_session_archives.sql +35 -0
- package/drizzle/0309_channel_project_pins.sql +6 -0
- package/drizzle/0310_channel_project_order.sql +27 -0
- package/drizzle/0311_company_scope_and_private_session_create.sql +656 -0
- package/drizzle/0312_quiescent_session_tree_deletion.sql +39 -0
- package/drizzle/0313_private_child_session_authority.sql +365 -0
- package/drizzle/0314_unregistered_organization_invitations.sql +606 -0
- package/drizzle/0315_personal_github_repository_selection.sql +624 -0
- package/drizzle/0316_human_confirmed_activation_resumed_generation.sql +869 -0
- package/drizzle/0317_session_goal_continuation_hold.sql +64 -0
- package/drizzle/0318_session_turn_startup_milestones.sql +115 -0
- package/drizzle/0319_event_triggered_automations.sql +254 -0
- package/drizzle/0320_pr_review_pack.sql +113 -0
- package/drizzle/0321_slack_bot_environment_display_name.sql +15 -0
- package/drizzle/0322_session_turns_unclaimed_prompt_trigger_index.sql +5 -0
- package/drizzle/0323_organization_private_session_enablement.sql +489 -0
- package/drizzle/0324_human_confirmed_company_profile_agent_admin.sql +856 -0
- package/drizzle/0325_child_lifecycle_notices.sql +44 -0
- package/drizzle/0326_interaction_operation_error_codes.sql +62 -0
- package/drizzle/0327_slack_first_task_hint.sql +29 -0
- package/drizzle/0328_session_background_commands.sql +590 -0
- package/drizzle/0329_slack_orchestration_delivery_events.sql +91 -0
- package/drizzle/0330_api_key_descriptions.sql +20 -0
- package/drizzle/0331_managed_organization_creation.sql +163 -0
- package/drizzle/0332_organization_shared_workspace_control_plane.sql +539 -0
- package/drizzle/0333_session_turn_prompt_routing.sql +45 -0
- package/drizzle/0334_connected_machine_workspace_root.sql +99 -0
- package/drizzle/0335_slack_workspace_routing.sql +460 -0
- package/drizzle/0336_atomic_session_fork_visibility.sql +667 -0
- package/drizzle/0337_slack_routed_action_handles.sql +189 -0
- package/drizzle/0338_atomic_connected_machine_attachments.sql +410 -0
- package/drizzle/0339_document_authority_reclassification.sql +1153 -0
- package/drizzle/0340_tenancy_backfill_activation_evidence.sql +1347 -0
- package/drizzle/0341_slack_routing_probe_organization_fence.sql +109 -0
- package/drizzle/0342_slack_route_prompt_single_pending.sql +32 -0
- package/drizzle/0343_personal_document_force_rls_lock_repair.sql +146 -0
- package/drizzle/0344_private_session_visibility_transition_gate.sql +85 -0
- package/drizzle/0345_tenant_scoped_session_tenancy_fence.sql +2839 -0
- package/drizzle/0346_document_migration_audit_surface.sql +454 -0
- package/drizzle/0347_connection_authority_convergence_evidence.sql +396 -0
- package/package.json +10 -6
- package/src/attached-browser-devices.ts +233 -5
- package/src/automations.ts +911 -0
- package/src/browser-sessions.ts +10 -0
- package/src/capability-integrations.ts +175 -1
- package/src/child-lifecycle-notices.ts +241 -0
- package/src/codemode-operations.ts +1 -35
- package/src/company-brain-context-selection-schema.ts +100 -0
- package/src/company-brain-context-selection.ts +359 -0
- package/src/company-brain-governed-writes.ts +1170 -0
- package/src/company-brain.ts +309 -0
- package/src/company-profile-agent-admin.ts +225 -0
- package/src/company-profile-schema.ts +121 -1
- package/src/company-profile.ts +21 -0
- package/src/computer-sessions.ts +10 -1
- package/src/connection-authority.ts +290 -0
- package/src/connection-scopes.ts +20 -0
- package/src/connection-tenancy-backfill.ts +167 -0
- package/src/connection-token-resolver.ts +263 -31
- package/src/database.ts +87 -2
- package/src/editable-artifacts-schema.ts +10 -5
- package/src/editable-artifacts.ts +21 -11
- package/src/governed-learning-activation-schema.ts +121 -0
- package/src/governed-learning-activation.ts +588 -0
- package/src/governed-learning-evaluator-schema.ts +72 -0
- package/src/governed-learning-evaluator.ts +217 -0
- package/src/index.ts +11676 -1550
- package/src/insights.ts +107 -0
- package/src/integration-bindings.ts +88 -6
- package/src/integration-facets.ts +287 -84
- package/src/interaction-placement-loss.ts +234 -0
- package/src/managed-human-provisioning.ts +116 -0
- package/src/memory-domain.ts +27 -32
- package/src/migrate.ts +77 -1
- package/src/new-session-drafts.ts +229 -35
- package/src/organization-membership-backfill.ts +735 -0
- package/src/organization-membership-lifecycle.ts +995 -0
- package/src/pr-review.ts +890 -0
- package/src/preference-registry.ts +31 -1
- package/src/provision-roles.ts +905 -6
- package/src/runtime-posture-cli.ts +2 -0
- package/src/runtime-posture.ts +1317 -72
- package/src/schema.ts +3316 -428
- package/src/scoped-knowledge-schema.ts +16 -8
- package/src/scoped-knowledge.ts +1 -1
- package/src/session-background-commands.ts +759 -0
- package/src/session-control.ts +640 -74
- package/src/session-goal-pacing.ts +126 -0
- package/src/session-queue-commands.ts +441 -85
- package/src/session-realtime-context.ts +4 -6
- package/src/session-realtime-ledger.ts +28 -14
- package/src/session-realtime-mirror.ts +1 -1
- package/src/session-tenancy.ts +410 -49
- package/src/session-tool-call-settlement.ts +38 -29
- package/src/slack-routing-personal-workspace.ts +67 -0
- package/src/slack-routing.ts +867 -0
- package/src/slack-task-policy-schema.ts +5 -0
- package/src/slack-task-policy.ts +18 -0
- package/src/slack-user-link-access.ts +138 -11
- package/src/task-notes-schema.ts +74 -0
- package/src/task-notes.ts +124 -2
- package/src/turn-initiator.ts +8 -0
- package/src/user-resource-authority.ts +377 -0
- package/src/workspace-authority.ts +160 -0
- package/src/workspace-instruction-policies-schema.ts +53 -1
- package/src/workspace-instruction-policies.ts +528 -77
- package/src/workspace-learning-policy.ts +21 -5
- package/src/workspace-membership-permissions.ts +9 -0
- package/dist/chunk-4SR4HKKA.js.map +0 -1
- package/dist/chunk-6ZYKCRFO.js.map +0 -1
- package/dist/chunk-NXAFLCQX.js +0 -2468
- package/dist/chunk-NXAFLCQX.js.map +0 -1
- package/dist/chunk-SK7YYHBI.js.map +0 -1
- package/dist/chunk-WD5ROSLL.js +0 -117
- package/dist/chunk-WD5ROSLL.js.map +0 -1
- package/dist/chunk-ZWREYEWA.js.map +0 -1
- /package/dist/{chunk-CUPM3FGB.js.map → chunk-2PRS4J5Q.js.map} +0 -0
- /package/dist/{chunk-LTG3S6ZY.js.map → chunk-E6CLMKEE.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { SessionGoalSnapshot } from "@opengeni/contracts";
|
|
2
|
-
import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, ManagedOrganizationMembershipProjection, McpPersonalConnectionDelegation, Permission, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalChangeKind, SessionGoalCreatedBy, SessionGoalMutationPolicy, SessionGoalRevision, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceMemoryPromptMode, WorkspaceRegisteredPack, Channel, Rig, RigProviderImage, RigProviderImages, RigVersion, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
|
|
3
|
-
import { RequestHumanInteractionToolInput, XaiProviderAccountAuthoritySnapshotV1, type TimelineAnnotation } from "@opengeni/contracts";
|
|
1
|
+
import { type ChildLifecycleSystemUpdateKind, type ChildRequiresActionRespondedByKind, SessionGoalSnapshot } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, ManagedOrganizationMembershipProjection, McpPersonalConnectionDelegation, ModelContextContributionSummary, Permission, PersonalResourceAttachmentIntent, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunAcceptedExecution as ScheduledTaskRunAcceptedExecutionType, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalChangeKind, SessionGoalCreatedBy, SessionGoalMutationPolicy, SessionGoalRevision, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceMemoryPromptMode, WorkspaceRegisteredPack, Channel, Rig, RigProviderImage, RigProviderImages, RigVersion, RigVerificationHealth, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
|
|
3
|
+
import { type WorkspaceArchiveObjectRef, RequestHumanInteractionToolInput, XaiProviderAccountAuthoritySnapshotV1, type TimelineAnnotation } from "@opengeni/contracts";
|
|
4
4
|
import { type LatencyMode, SessionSystemUpdatePayload, TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
5
5
|
import { type Settings } from "@opengeni/config";
|
|
6
6
|
import { type CodexFetch } from "@opengeni/codex";
|
|
7
7
|
export { isCodexBilledModel } from "@opengeni/codex";
|
|
8
|
+
export * from "./pr-review.js";
|
|
8
9
|
import { type SQL } from "drizzle-orm";
|
|
9
10
|
export { frozenInitiatorForCommandActor, type FrozenTurnInitiator } from "./turn-initiator.js";
|
|
10
11
|
export { LOSSLESS_TEXT_PREFIX } from "./lossless-json.js";
|
|
12
|
+
import { type NewSessionDraftSnapshot } from "./new-session-drafts.js";
|
|
11
13
|
import { type SessionDiscoveryControl, type SessionCommandActor, type SessionTurnAttemptOutcome } from "./session-control.js";
|
|
12
14
|
import { type SessionRealtimeContinuityEntry } from "./session-realtime-context.js";
|
|
13
15
|
import * as schema from "./schema.js";
|
|
14
16
|
export { sql as dbSql } from "drizzle-orm";
|
|
17
|
+
export * from "./child-lifecycle-notices.js";
|
|
15
18
|
export * from "./session-control.js";
|
|
16
19
|
export * from "./session-queue-commands.js";
|
|
17
20
|
export * from "./session-realtime.js";
|
|
@@ -20,17 +23,30 @@ export * from "./session-realtime-ledger.js";
|
|
|
20
23
|
export * from "./new-session-drafts.js";
|
|
21
24
|
export * from "./workspace-instruction-policies.js";
|
|
22
25
|
export * from "./company-profile.js";
|
|
26
|
+
export * from "./company-profile-agent-admin.js";
|
|
23
27
|
export * from "./workspace-learning-policy.js";
|
|
28
|
+
export * from "./governed-learning-evaluator.js";
|
|
24
29
|
export * from "./slack-task-policy.js";
|
|
25
30
|
export * from "./preference-registry.js";
|
|
26
31
|
export * from "./memory-governance.js";
|
|
27
32
|
export * from "./memory-slack-delivery.js";
|
|
28
33
|
export * from "./scoped-knowledge.js";
|
|
34
|
+
export * from "./company-brain.js";
|
|
35
|
+
export * from "./company-brain-governed-writes.js";
|
|
36
|
+
export * from "./company-brain-context-selection.js";
|
|
29
37
|
export * from "./knowledge-source-sync.js";
|
|
30
38
|
export * from "./task-notes.js";
|
|
39
|
+
export * from "./managed-human-provisioning.js";
|
|
40
|
+
export * from "./organization-membership-backfill.js";
|
|
41
|
+
export * from "./connection-tenancy-backfill.js";
|
|
31
42
|
export * from "./generated-images.js";
|
|
32
43
|
export * from "./slack-user-link-access.js";
|
|
44
|
+
export * from "./slack-routing.js";
|
|
45
|
+
export * from "./slack-routing-personal-workspace.js";
|
|
46
|
+
export * from "./workspace-membership-permissions.js";
|
|
33
47
|
export * from "./video-generation.js";
|
|
48
|
+
export * from "./user-resource-authority.js";
|
|
49
|
+
export * from "./connection-authority.js";
|
|
34
50
|
export * from "./xai-subscription.js";
|
|
35
51
|
export { interruptedToolCallResult } from "./session-tool-call-settlement.js";
|
|
36
52
|
export { decryptEnvironmentValue, encryptEnvironmentValue } from "./environment-crypto.js";
|
|
@@ -41,12 +57,14 @@ export * from "./capability-integrations.js";
|
|
|
41
57
|
export * from "./integration-bindings.js";
|
|
42
58
|
export * from "./integration-facets.js";
|
|
43
59
|
export * from "./insights.js";
|
|
60
|
+
export * from "./organization-membership-lifecycle.js";
|
|
61
|
+
export { rlsSubjectIdOrEmpty, subjectHasLiveWorkspaceAuthorityInScope, } from "./workspace-authority.js";
|
|
44
62
|
export { memoryTextForStorage } from "./memory-domain.js";
|
|
45
63
|
export { migrate, runMigrations } from "./migrate.js";
|
|
46
64
|
export { provisionRoles, type ProvisionResult, type ProvisionRolesOptions, } from "./provision-roles.js";
|
|
47
65
|
export * from "./memory-domain.js";
|
|
48
66
|
import { type Database, type SessionActivityDatabase } from "./database.js";
|
|
49
|
-
export { createDb, registerDbBinding, retrySessionActivityRls, rlsContextForWorkspace, rlsStrategyFor, setRlsContext, setSubjectRlsContext, withAccountRls, withDatabaseStatementTimeout, withRlsContext, withSessionActivityRlsContext, withSessionActivitySavepoint, withWorkspaceRls, withWorkspaceSessionActivityRls, withWorkspaceSubjectRls, withWorkspaceSubjectSessionActivityRls, withWorkspaceUsageLock, withSandboxProviderReadLock, SandboxProviderReadLockUnavailableError, type CreateDbOptions, type Database, type DbClient, type SessionActivityDatabase, type RlsContext, type SessionRlsActorContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type UserLookup, } from "./database.js";
|
|
67
|
+
export { createDb, registerDbBinding, retrySessionActivityRls, rlsContextForWorkspace, rlsStrategyFor, setRlsContext, setSubjectRlsContext, withAccountRls, withDatabaseStatementTimeout, withRlsContext, withSessionActivityRlsContext, withSessionActivitySavepoint, withWorkspaceRls, withWorkspaceSessionActivityRls, withWorkspaceSubjectRls, withWorkspaceSubjectSessionActivityRls, withWorkspaceUsageLock, withSandboxProviderReadLock, SandboxProviderReadLockUnavailableError, type CreateDbOptions, type Database, type DbClient, type SessionActivityDatabase, type RlsContext, type SessionRlsActorContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type ManagedUserProfile, type UserLookup, type UserProfileLookup, } from "./database.js";
|
|
50
68
|
export { withSessionRlsActorContext } from "./database.js";
|
|
51
69
|
import { buildCodexTokenResolver as buildCodexTokenResolverCore, fetchCodexRateLimitResetCreditsForAccount as fetchCodexRateLimitResetCreditsForAccountCore, fetchCodexUsageForAccount as fetchCodexUsageForAccountCore, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun } from "./codex-token-resolver.js";
|
|
52
70
|
import { buildConnectionTokenResolver as buildConnectionTokenResolverCore, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionTokenResolverOptions } from "./connection-token-resolver.js";
|
|
@@ -232,6 +250,14 @@ export declare function resolveDocumentIndexAuthority(db: Database, input: {
|
|
|
232
250
|
documentId: string;
|
|
233
251
|
}): Promise<DocumentIndexAuthority | null>;
|
|
234
252
|
export declare const allWorkspacePermissions: Permission[];
|
|
253
|
+
/**
|
|
254
|
+
* Runtime capabilities for the authenticated managed human's personal
|
|
255
|
+
* workspace. This projection is deliberately not an administrative grant:
|
|
256
|
+
* workspace administration is a wildcard over member management and API-key
|
|
257
|
+
* delegation, either of which would let the owner create another principal
|
|
258
|
+
* with ambient access to the private workspace.
|
|
259
|
+
*/
|
|
260
|
+
export declare const managedPersonalWorkspacePermissions: Permission[];
|
|
235
261
|
export declare const allAccountPermissions: Permission[];
|
|
236
262
|
export type BootstrapWorkspaceInput = {
|
|
237
263
|
accountExternalSource: string;
|
|
@@ -250,6 +276,7 @@ export declare function ensureManagedAccessForUser(db: Database, input: {
|
|
|
250
276
|
userId: string;
|
|
251
277
|
email: string;
|
|
252
278
|
name: string;
|
|
279
|
+
emailVerified?: boolean;
|
|
253
280
|
}): Promise<AccessContext>;
|
|
254
281
|
export type ManagedAccessProvisioningResult = {
|
|
255
282
|
accessContext: AccessContext;
|
|
@@ -259,6 +286,7 @@ export declare function ensureManagedAccessForUserWithOrganizationMemberships(db
|
|
|
259
286
|
userId: string;
|
|
260
287
|
email: string;
|
|
261
288
|
name: string;
|
|
289
|
+
emailVerified?: boolean;
|
|
262
290
|
}): Promise<ManagedAccessProvisioningResult>;
|
|
263
291
|
export declare function getWorkspace(db: Database, workspaceId: string): Promise<Workspace | null>;
|
|
264
292
|
export declare function getManagedAccount(db: Database, accountId: string): Promise<ManagedAccount | null>;
|
|
@@ -273,6 +301,20 @@ export declare function createWorkspace(db: Database, input: {
|
|
|
273
301
|
externalId?: string | null;
|
|
274
302
|
agentInstructions?: string | null;
|
|
275
303
|
}): Promise<Workspace>;
|
|
304
|
+
/**
|
|
305
|
+
* Create one shared workspace through the direct managed-human organization
|
|
306
|
+
* control plane. Organization authority is rechecked inside the lifecycle
|
|
307
|
+
* function, the operation id is replay-safe, and no operational
|
|
308
|
+
* workspace_memberships row is created for the actor.
|
|
309
|
+
*/
|
|
310
|
+
export declare function createOrganizationSharedWorkspace(db: Database, input: {
|
|
311
|
+
organizationId: string;
|
|
312
|
+
actorSubjectId: string;
|
|
313
|
+
name: string;
|
|
314
|
+
slug?: string | null;
|
|
315
|
+
agentInstructions?: string | null;
|
|
316
|
+
operationId: string;
|
|
317
|
+
}): Promise<Workspace>;
|
|
276
318
|
export declare function grantWorkspaceAccess(db: Database, input: {
|
|
277
319
|
accountId: string;
|
|
278
320
|
workspaceId: string;
|
|
@@ -281,18 +323,55 @@ export declare function grantWorkspaceAccess(db: Database, input: {
|
|
|
281
323
|
role?: string;
|
|
282
324
|
permissions: Permission[];
|
|
283
325
|
}): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Organization control-plane metadata update for one shared workspace. This
|
|
328
|
+
* capability never creates a workspace membership or an operational grant for
|
|
329
|
+
* the actor; the database excludes every Personal workspace before mutation.
|
|
330
|
+
*/
|
|
331
|
+
export declare function updateOrganizationSharedWorkspace(db: Database, input: {
|
|
332
|
+
organizationId: string;
|
|
333
|
+
workspaceId: string;
|
|
334
|
+
actorSubjectId: string;
|
|
335
|
+
name?: string;
|
|
336
|
+
slug?: string | null;
|
|
337
|
+
agentInstructions?: string | null;
|
|
338
|
+
}): Promise<Workspace>;
|
|
339
|
+
/** Same authority as metadata administration, preserving the canonical
|
|
340
|
+
* workspace-settings merge and inference-control lock path. */
|
|
341
|
+
export declare function updateOrganizationSharedWorkspaceSettings(db: Database, input: {
|
|
342
|
+
organizationId: string;
|
|
343
|
+
workspaceId: string;
|
|
344
|
+
actorSubjectId: string;
|
|
345
|
+
patch: Record<string, unknown>;
|
|
346
|
+
}): Promise<Workspace>;
|
|
347
|
+
/** Assign or update one active organization member in one shared workspace. */
|
|
348
|
+
export declare function upsertOrganizationSharedWorkspaceMember(db: Database, input: {
|
|
349
|
+
organizationId: string;
|
|
350
|
+
workspaceId: string;
|
|
351
|
+
actorSubjectId: string;
|
|
352
|
+
targetOrganizationMembershipId: string;
|
|
353
|
+
subjectLabel?: string | null;
|
|
354
|
+
role?: string;
|
|
355
|
+
permissions: Permission[];
|
|
356
|
+
requireExisting: boolean;
|
|
357
|
+
}): Promise<WorkspaceMember>;
|
|
284
358
|
export declare function updateWorkspace(db: Database, workspaceId: string, input: {
|
|
285
359
|
name?: string;
|
|
286
360
|
slug?: string | null;
|
|
287
361
|
agentInstructions?: string | null;
|
|
288
362
|
}): Promise<Workspace>;
|
|
289
|
-
export declare function updateWorkspaceSettings(db: Database, workspaceId: string, patch: Record<string, unknown
|
|
363
|
+
export declare function updateWorkspaceSettings(db: Database, workspaceId: string, patch: Record<string, unknown>, options?: {
|
|
364
|
+
/**
|
|
365
|
+
* Bound the workspace control prefix wait (request-scoped API callers pass
|
|
366
|
+
* `workspaceControlRequestLockTimeoutMs()`); omit for lifecycle callers.
|
|
367
|
+
*/
|
|
368
|
+
controlLockTimeoutMs?: number;
|
|
369
|
+
}): Promise<Workspace>;
|
|
290
370
|
export declare function setWorkspaceDefaultRig(db: Database, workspaceId: string, rigId: string | null): Promise<Workspace>;
|
|
291
371
|
export declare function getWorkspaceGrant(db: Database, subjectId: string, workspaceId: string, provenance?: {
|
|
292
372
|
principalKind?: AccessPrincipalKind;
|
|
293
373
|
}): Promise<AccessGrant | null>;
|
|
294
374
|
export declare function listWorkspaceMembers(db: Database, workspaceId: string): Promise<WorkspaceMember[]>;
|
|
295
|
-
export declare function removeWorkspaceMember(db: Database, workspaceId: string, subjectId: string): Promise<boolean>;
|
|
296
375
|
/**
|
|
297
376
|
* Resolve a managed user email to its user id.
|
|
298
377
|
*
|
|
@@ -311,12 +390,26 @@ export declare function removeWorkspaceMember(db: Database, workspaceId: string,
|
|
|
311
390
|
* unknown users are deferred.
|
|
312
391
|
*/
|
|
313
392
|
export declare function getManagedUserByEmail(db: Database, email: string): Promise<string | null>;
|
|
393
|
+
/**
|
|
394
|
+
* Resolve the safe profile fields organization administrators need to manage
|
|
395
|
+
* their own roster. Embedded deployments can provide the same projection
|
|
396
|
+
* through `userProfileLookup` without exposing their identity store schema.
|
|
397
|
+
*/
|
|
398
|
+
export declare function getManagedUserProfilesByIds(db: Database, userIds: readonly string[]): Promise<Array<{
|
|
399
|
+
id: string;
|
|
400
|
+
name: string | null;
|
|
401
|
+
email: string;
|
|
402
|
+
}>>;
|
|
314
403
|
export declare function deleteWorkspace(db: Database, workspaceId: string): Promise<void>;
|
|
315
404
|
export type TemporalScheduleCleanupClaim = {
|
|
316
405
|
id: string;
|
|
317
406
|
accountId: string;
|
|
318
407
|
workspaceId: string;
|
|
319
408
|
temporalScheduleId: string;
|
|
409
|
+
scheduledTaskId: string | null;
|
|
410
|
+
connectorCleanupSubjectId: string | null;
|
|
411
|
+
connectorCleanupSnapshot: unknown | null;
|
|
412
|
+
connectorCleanupCompletedAt: Date | null;
|
|
320
413
|
claimId: string;
|
|
321
414
|
attemptCount: number;
|
|
322
415
|
};
|
|
@@ -324,7 +417,7 @@ export type DeleteWorkspaceIfQuiescentResult = {
|
|
|
324
417
|
status: "deleted";
|
|
325
418
|
temporalScheduleCleanups: TemporalScheduleCleanupClaim[];
|
|
326
419
|
} | {
|
|
327
|
-
status: "not_found" | "only_workspace" | "active_sessions" | "active_video_generations" | "live_sandboxes";
|
|
420
|
+
status: "not_found" | "only_workspace" | "active_sessions" | "active_video_generations" | "active_background_commands" | "live_sandboxes";
|
|
328
421
|
};
|
|
329
422
|
/**
|
|
330
423
|
* Atomically prove a workspace has no live runtime ownership and delete it.
|
|
@@ -355,10 +448,16 @@ export declare function settleTemporalScheduleCleanup(db: Database, input: {
|
|
|
355
448
|
claimId: string;
|
|
356
449
|
error?: string | null;
|
|
357
450
|
}): Promise<boolean>;
|
|
451
|
+
/** Persist the connector half of a combined cleanup before attempting Temporal. */
|
|
452
|
+
export declare function completeTemporalScheduleConnectorCleanup(db: Database, input: {
|
|
453
|
+
id: string;
|
|
454
|
+
claimId: string;
|
|
455
|
+
}): Promise<boolean>;
|
|
358
456
|
export declare function createApiKey(db: Database, input: {
|
|
359
457
|
accountId: string;
|
|
360
458
|
workspaceId?: string | null;
|
|
361
459
|
name: string;
|
|
460
|
+
description?: string | null;
|
|
362
461
|
prefix: string;
|
|
363
462
|
keyHash: string;
|
|
364
463
|
permissions: Permission[];
|
|
@@ -489,6 +588,7 @@ export type ModelCallFact = {
|
|
|
489
588
|
pricedCostMicros: number;
|
|
490
589
|
estimatedProviderCostMicros: number | null;
|
|
491
590
|
pricingSource: "configured_list_price" | "gateway_reported" | null;
|
|
591
|
+
contextContributions: readonly ModelContextContributionSummary[] | null;
|
|
492
592
|
occurredAt: Date;
|
|
493
593
|
recordedAt: Date;
|
|
494
594
|
};
|
|
@@ -510,6 +610,7 @@ export declare function recordModelCallFact(db: Database, input: {
|
|
|
510
610
|
pricedCostMicros: number;
|
|
511
611
|
estimatedProviderCostMicros?: number | null;
|
|
512
612
|
pricingSource?: "configured_list_price" | "gateway_reported" | null;
|
|
613
|
+
contextContributions?: readonly ModelContextContributionSummary[] | null;
|
|
513
614
|
inputTokens?: number | null;
|
|
514
615
|
outputTokens?: number | null;
|
|
515
616
|
cachedTokens?: number | null;
|
|
@@ -632,6 +733,12 @@ export type UpdateScheduledTaskInput = Partial<{
|
|
|
632
733
|
variableSetId: string | null;
|
|
633
734
|
rigId: string | null;
|
|
634
735
|
metadata: Record<string, unknown>;
|
|
736
|
+
refreshPersonalResourceAuthority: boolean;
|
|
737
|
+
cloneConnectionAuthorityFromRevision: number;
|
|
738
|
+
clonePersonalResourceAuthorityFromRevision: number;
|
|
739
|
+
authorityUpdatedBy: TurnInitiator;
|
|
740
|
+
authorityUpdatedByContext: TurnInitiatorContext;
|
|
741
|
+
authorityUpdatedByActor: AgentSessionCreationActor | null;
|
|
635
742
|
}>;
|
|
636
743
|
export type CreatePackInstallationInput = {
|
|
637
744
|
accountId: string;
|
|
@@ -778,6 +885,25 @@ export type PersistProviderOAuthConnectionInput = CreateConnectionInput & {
|
|
|
778
885
|
providerPrincipalId: string;
|
|
779
886
|
requestedConnectionId?: string;
|
|
780
887
|
requestedConnectionVersion?: number;
|
|
888
|
+
/**
|
|
889
|
+
* Require this exact subject to retain live workspace authority in the same
|
|
890
|
+
* transaction that persists the credential. This is only a consistency
|
|
891
|
+
* fence: the caller must separately prove that the subject is the
|
|
892
|
+
* authenticated managed human before opting in.
|
|
893
|
+
*/
|
|
894
|
+
requireLiveUserAuthority?: boolean;
|
|
895
|
+
/** Permission that must remain present while the owner row is locked. */
|
|
896
|
+
requiredLiveUserPermission?: "connections:write";
|
|
897
|
+
/**
|
|
898
|
+
* Permit the canonical managed-human personal-workspace exception when no
|
|
899
|
+
* ordinary membership row exists. The caller must have authenticated that
|
|
900
|
+
* exact human before opting in.
|
|
901
|
+
*/
|
|
902
|
+
allowCanonicalPersonalWorkspaceOwner?: boolean;
|
|
903
|
+
/** Keep at most one non-revoked provider principal for this owner/family. */
|
|
904
|
+
exclusiveProviderPrincipalPerOwner?: boolean;
|
|
905
|
+
/** Existing values for these metadata keys survive exact-principal convergence. */
|
|
906
|
+
preserveExistingMetadataKeys?: readonly string[];
|
|
781
907
|
};
|
|
782
908
|
export type UpdateSlackBotDocumentDestinationInput = {
|
|
783
909
|
accountId: string;
|
|
@@ -817,6 +943,58 @@ export declare class ConnectionDisconnectGenerationError extends Error {
|
|
|
817
943
|
readonly code = "CONNECTION_GENERATION_CHANGED";
|
|
818
944
|
constructor();
|
|
819
945
|
}
|
|
946
|
+
export type PersonalGitHubRepositoryPermissions = {
|
|
947
|
+
pull: boolean;
|
|
948
|
+
push: boolean;
|
|
949
|
+
admin: boolean;
|
|
950
|
+
maintain: boolean;
|
|
951
|
+
triage: boolean;
|
|
952
|
+
};
|
|
953
|
+
export type PersonalGitHubSelectedRepositoryRecord = {
|
|
954
|
+
repositoryId: string;
|
|
955
|
+
fullName: string;
|
|
956
|
+
canonicalUrl: string;
|
|
957
|
+
defaultBranch: string;
|
|
958
|
+
visibility: "public" | "private" | "internal";
|
|
959
|
+
private: boolean;
|
|
960
|
+
archived: boolean;
|
|
961
|
+
disabled: boolean;
|
|
962
|
+
permissions: PersonalGitHubRepositoryPermissions;
|
|
963
|
+
selectedAccess: "read" | "write";
|
|
964
|
+
selectionGeneration: number;
|
|
965
|
+
selectedAt: string;
|
|
966
|
+
lastVerifiedAt: string;
|
|
967
|
+
};
|
|
968
|
+
export type PersonalGitHubRepositorySelectionState = {
|
|
969
|
+
connectionAuthorityGeneration: number;
|
|
970
|
+
credentialBindingId: string;
|
|
971
|
+
providerPrincipalId: string;
|
|
972
|
+
selectionGeneration: number;
|
|
973
|
+
repositories: PersonalGitHubSelectedRepositoryRecord[];
|
|
974
|
+
};
|
|
975
|
+
export type PersonalGitHubVerifiedRepositoryInput = Omit<PersonalGitHubSelectedRepositoryRecord, "selectionGeneration" | "selectedAt">;
|
|
976
|
+
export type PersonalGitHubRepositorySelectionMutationInput = {
|
|
977
|
+
accountId: string;
|
|
978
|
+
originWorkspaceId: string;
|
|
979
|
+
subjectId: string;
|
|
980
|
+
connectionId: string;
|
|
981
|
+
expectedConnectionAuthorityGeneration: number;
|
|
982
|
+
expectedSelectionGeneration: number;
|
|
983
|
+
idempotencyKey: string;
|
|
984
|
+
repositories: PersonalGitHubVerifiedRepositoryInput[];
|
|
985
|
+
};
|
|
986
|
+
export declare class PersonalGitHubRepositorySelectionChangedError extends Error {
|
|
987
|
+
readonly code = "PERSONAL_GITHUB_REPOSITORY_SELECTION_CHANGED";
|
|
988
|
+
constructor();
|
|
989
|
+
}
|
|
990
|
+
export declare class PersonalGitHubRepositorySelectionIdempotencyError extends Error {
|
|
991
|
+
readonly code = "PERSONAL_GITHUB_REPOSITORY_IDEMPOTENCY_KEY_REUSED";
|
|
992
|
+
constructor();
|
|
993
|
+
}
|
|
994
|
+
export declare class PersonalGitHubRepositorySelectionUnavailableError extends Error {
|
|
995
|
+
readonly code = "PERSONAL_GITHUB_REPOSITORY_SELECTION_UNAVAILABLE";
|
|
996
|
+
constructor();
|
|
997
|
+
}
|
|
820
998
|
/** Server-owned verification facts; public schemas expose them read-only and nullable. */
|
|
821
999
|
export type ConnectionMetadataWithVerification = ConnectionMetadata & {
|
|
822
1000
|
verifiedInstallAt: string | null;
|
|
@@ -994,6 +1172,8 @@ export type RegistryCapabilityCatalogItemInput = {
|
|
|
994
1172
|
scopesHint?: string[];
|
|
995
1173
|
homepageUrl?: string | null;
|
|
996
1174
|
installUrl?: string | null;
|
|
1175
|
+
/** Curated catalog grouping. Defaults to the registry-wide "integrations". */
|
|
1176
|
+
category?: string | null;
|
|
997
1177
|
tags?: string[];
|
|
998
1178
|
metadata?: Record<string, unknown>;
|
|
999
1179
|
};
|
|
@@ -1201,6 +1381,7 @@ export type SessionTurnForExecution = SessionTurn & {
|
|
|
1201
1381
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
1202
1382
|
/** Worker-only causal authority; never inferred from the current worker. */
|
|
1203
1383
|
initiatingHumanSubjectId: string | null;
|
|
1384
|
+
scheduledTaskRunId: string | null;
|
|
1204
1385
|
xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
1205
1386
|
goalSnapshot: SessionGoalSnapshot;
|
|
1206
1387
|
};
|
|
@@ -1259,7 +1440,19 @@ export declare function requireFileForSubject(db: Database, input: {
|
|
|
1259
1440
|
subjectId: string | null;
|
|
1260
1441
|
fileId: string;
|
|
1261
1442
|
}): Promise<FileAsset>;
|
|
1262
|
-
/**
|
|
1443
|
+
/**
|
|
1444
|
+
* Resolve a Document's immutable origin File through one database authority
|
|
1445
|
+
* statement. The resolver proves target-workspace Document visibility, live
|
|
1446
|
+
* portable-owner authority, and provider ACL before returning origin metadata;
|
|
1447
|
+
* it never grants generic visibility into the origin workspace's Files.
|
|
1448
|
+
*/
|
|
1449
|
+
export declare function resolveDocumentOriginalFileForSubject(db: Database, input: {
|
|
1450
|
+
accountId: string;
|
|
1451
|
+
workspaceId: string;
|
|
1452
|
+
subjectId: string;
|
|
1453
|
+
documentId: string;
|
|
1454
|
+
}): Promise<FileAsset | null>;
|
|
1455
|
+
/** Batch form of requireFileForSubject; unauthorized or missing ids are omitted. */
|
|
1263
1456
|
export declare function getFilesForSubject(db: Database, input: {
|
|
1264
1457
|
accountId: string;
|
|
1265
1458
|
workspaceId: string;
|
|
@@ -1269,7 +1462,7 @@ export declare function getFilesForSubject(db: Database, input: {
|
|
|
1269
1462
|
/** One RLS-scoped query for all attachment metadata needed by a model turn. */
|
|
1270
1463
|
export declare function getFiles(db: Database, workspaceId: string, fileIds: readonly string[]): Promise<FileAsset[]>;
|
|
1271
1464
|
/** Build the canonical user row with stable attachment refs, never inline bytes. */
|
|
1272
|
-
export declare function durableUserHistoryItem(prompt: string, resources: readonly ResourceRef[], annotations?: readonly TimelineAnnotation[], modelContext?: string | null): Record<string, unknown>;
|
|
1465
|
+
export declare function durableUserHistoryItem(prompt: string, resources: readonly ResourceRef[], annotations?: readonly TimelineAnnotation[], modelContext?: string | null, goalSnapshot?: SessionGoalSnapshot): Record<string, unknown>;
|
|
1273
1466
|
export type RetainedFileArtifact = {
|
|
1274
1467
|
file: FileAsset;
|
|
1275
1468
|
uploadStatus: FileUploadStatus | null;
|
|
@@ -1500,6 +1693,22 @@ export declare function markStaleRegistryCatalogItems(db: Database, activeKeys:
|
|
|
1500
1693
|
}>, importBatchId: string): Promise<number>;
|
|
1501
1694
|
export declare function upsertCapabilityCatalogItem(db: Database, input: CreateCapabilityCatalogItemInput): Promise<CapabilityCatalogItem>;
|
|
1502
1695
|
export declare function listCapabilityCatalogItems(db: Database, workspaceId: string): Promise<CapabilityCatalogItem[]>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Declarative OAuth profile carried by a global (registry-imported) catalog
|
|
1698
|
+
* row for an exact MCP URL, or null when no row declares one. Only global
|
|
1699
|
+
* rows are consulted: a workspace-created row must not steer another
|
|
1700
|
+
* workspace's OAuth flow, and the OAuth client applies the profile as a
|
|
1701
|
+
* narrowing constraint over its defaults.
|
|
1702
|
+
*
|
|
1703
|
+
* A stale row's profile still applies deliberately: staleness hides the row
|
|
1704
|
+
* from the browse surface, but dropping its declared fences on staleness
|
|
1705
|
+
* would loosen an ownership or origin constraint. Non-stale rows win when a
|
|
1706
|
+
* duplicate `mcp_url` exists under two provider domains; the remaining id
|
|
1707
|
+
* tie-break is only for determinism. The value is returned raw (whatever the
|
|
1708
|
+
* row carries) so the caller's validation decides how a malformed profile
|
|
1709
|
+
* fails; absence of the key is the only null.
|
|
1710
|
+
*/
|
|
1711
|
+
export declare function getGlobalCatalogOAuthProfile(db: Database, workspaceId: string, mcpUrl: string): Promise<unknown | null>;
|
|
1503
1712
|
export declare function getCapabilityCatalogItem(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityCatalogItem | null>;
|
|
1504
1713
|
/**
|
|
1505
1714
|
* Install one immutable, already-validated Skill through the authoritative
|
|
@@ -1524,6 +1733,12 @@ export declare function disableCapabilityInstallation(db: Database, workspaceId:
|
|
|
1524
1733
|
export declare function listCapabilityInstallations(db: Database, workspaceId: string): Promise<CapabilityInstallation[]>;
|
|
1525
1734
|
export declare function getCapabilityInstallation(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityInstallation | null>;
|
|
1526
1735
|
export declare function listEnabledMcpCapabilityServers(db: Database, workspaceId: string): Promise<EnabledMcpCapabilityServer[]>;
|
|
1736
|
+
/**
|
|
1737
|
+
* Metadata-only projection of runnable capability MCP server ids. The query
|
|
1738
|
+
* deliberately computes credential-presence booleans in PostgreSQL and never
|
|
1739
|
+
* selects stored header ciphertext or connection-reference contents.
|
|
1740
|
+
*/
|
|
1741
|
+
export declare function listEnabledMcpCapabilityServerIds(db: Database, workspaceId: string): Promise<string[]>;
|
|
1527
1742
|
/**
|
|
1528
1743
|
* Decrypts an enabled capability MCP's stored credential headers. Returns
|
|
1529
1744
|
* null when the server has none, and "unavailable" when headers exist but
|
|
@@ -1548,6 +1763,14 @@ export declare function createConnection(db: Database, input: CreateConnectionIn
|
|
|
1548
1763
|
export declare function persistProviderOAuthConnection(db: Database, input: PersistProviderOAuthConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1549
1764
|
export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
|
|
1550
1765
|
export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1766
|
+
export declare function getPersonalGitHubRepositorySelectionState(db: Database, input: {
|
|
1767
|
+
accountId: string;
|
|
1768
|
+
originWorkspaceId: string;
|
|
1769
|
+
subjectId: string;
|
|
1770
|
+
connectionId: string;
|
|
1771
|
+
}): Promise<PersonalGitHubRepositorySelectionState | null>;
|
|
1772
|
+
export declare function replacePersonalGitHubRepositorySelections(db: Database, input: PersonalGitHubRepositorySelectionMutationInput): Promise<PersonalGitHubRepositorySelectionState>;
|
|
1773
|
+
export declare function verifyPersonalGitHubRepositorySelections(db: Database, input: PersonalGitHubRepositorySelectionMutationInput): Promise<PersonalGitHubRepositorySelectionState>;
|
|
1551
1774
|
export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1552
1775
|
/**
|
|
1553
1776
|
* Updates only pre-validated workspace Slack-bot destination metadata while
|
|
@@ -1595,6 +1818,11 @@ export type SlackBotUserLink = {
|
|
|
1595
1818
|
slackUserId: string;
|
|
1596
1819
|
subjectId: string;
|
|
1597
1820
|
linkedBySubjectId: string;
|
|
1821
|
+
/**
|
|
1822
|
+
* The exact Slack interaction id that durably claimed this identity's
|
|
1823
|
+
* one-time onboarding hint, or `null` when the hint has not been shown.
|
|
1824
|
+
*/
|
|
1825
|
+
firstTaskHintInteractionId: string | null;
|
|
1598
1826
|
createdAt: Date;
|
|
1599
1827
|
updatedAt: Date;
|
|
1600
1828
|
};
|
|
@@ -1625,6 +1853,25 @@ export type SlackInteractionInboxEntry = {
|
|
|
1625
1853
|
createdAt: Date;
|
|
1626
1854
|
updatedAt: Date;
|
|
1627
1855
|
};
|
|
1856
|
+
export type SlackAppHomeRefresh = {
|
|
1857
|
+
id: string;
|
|
1858
|
+
accountId: string;
|
|
1859
|
+
workspaceId: string;
|
|
1860
|
+
connectionId: string;
|
|
1861
|
+
slackTeamId: string;
|
|
1862
|
+
slackUserId: string;
|
|
1863
|
+
providerEventId: string;
|
|
1864
|
+
providerViewHash: string | null;
|
|
1865
|
+
desiredRevision: number;
|
|
1866
|
+
processedRevision: number;
|
|
1867
|
+
claimHolderId: string | null;
|
|
1868
|
+
claimExpiresAt: Date | null;
|
|
1869
|
+
attemptCount: number;
|
|
1870
|
+
retryAt: Date | null;
|
|
1871
|
+
lastErrorCode: string | null;
|
|
1872
|
+
createdAt: Date;
|
|
1873
|
+
updatedAt: Date;
|
|
1874
|
+
};
|
|
1628
1875
|
export type SlackInteraction = {
|
|
1629
1876
|
id: string;
|
|
1630
1877
|
accountId: string;
|
|
@@ -1647,6 +1894,21 @@ export type SlackInteraction = {
|
|
|
1647
1894
|
deliveryRetryAt: Date | null;
|
|
1648
1895
|
deliveryLastErrorCode: string | null;
|
|
1649
1896
|
ackSlackMessageTs: string | null;
|
|
1897
|
+
/**
|
|
1898
|
+
* Frozen once: whether this interaction's acknowledgement renders the
|
|
1899
|
+
* one-time onboarding hint. `null` means the decision is unresolved.
|
|
1900
|
+
*/
|
|
1901
|
+
firstTaskHint: boolean | null;
|
|
1902
|
+
/**
|
|
1903
|
+
* The routed workspace's name, frozen when the interaction bound.
|
|
1904
|
+
*
|
|
1905
|
+
* Null means "do not say where this went": either routing is off, or the
|
|
1906
|
+
* person had exactly one workspace to begin with, and a constant footer on
|
|
1907
|
+
* every message would be noise. It is frozen rather than looked up at post
|
|
1908
|
+
* time because a rename between the original post and a reconciliation would
|
|
1909
|
+
* make the ledger's byte comparison raise.
|
|
1910
|
+
*/
|
|
1911
|
+
routedWorkspaceLabel: string | null;
|
|
1650
1912
|
progressCount: number;
|
|
1651
1913
|
terminalDeliveryState: "open" | "completed" | "failed" | "cancelled" | "blocked";
|
|
1652
1914
|
createdAt: Date;
|
|
@@ -1686,9 +1948,63 @@ export type SlackInteractionActionHandle = {
|
|
|
1686
1948
|
updatedAt: Date;
|
|
1687
1949
|
};
|
|
1688
1950
|
export declare function resolveSlackInstallationRoute(db: Database, slackTeamId: string): Promise<SlackInstallationRoute | null>;
|
|
1689
|
-
export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt">): Promise<SlackBotUserLink>;
|
|
1951
|
+
export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt" | "firstTaskHintInteractionId">): Promise<SlackBotUserLink>;
|
|
1690
1952
|
export declare function getSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<SlackBotUserLink | null>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Resolve, exactly once, whether one Slack interaction's acknowledgement
|
|
1955
|
+
* renders the one-time onboarding hint, and freeze that answer on the
|
|
1956
|
+
* interaction row.
|
|
1957
|
+
*
|
|
1958
|
+
* `slack_bot_post_operations` binds one operation id to one request digest that
|
|
1959
|
+
* covers the message text, so an acknowledgement re-rendered after a crash, a
|
|
1960
|
+
* lost provider response, or a replica race must produce the same bytes or the
|
|
1961
|
+
* ledger rejects it. Rendering therefore reads a frozen fact instead of asking
|
|
1962
|
+
* a mutable question: the first call decides, every later call replays the
|
|
1963
|
+
* stored decision, and unlinking plus relinking the Slack identity cannot flip
|
|
1964
|
+
* an acknowledgement that was already rendered.
|
|
1965
|
+
*
|
|
1966
|
+
* The per-identity claim row is the single source of truth and is replay-stable:
|
|
1967
|
+
* the frozen answer is exactly "this identity's one claim names THIS
|
|
1968
|
+
* interaction". At most one interaction per Slack identity per installation is
|
|
1969
|
+
* therefore granted the hint, whichever resolver wins the claim, and the freeze
|
|
1970
|
+
* is a separate compare-and-set whose losers read back the stored byte rather
|
|
1971
|
+
* than their own recomputed one. This is deliberately not one transaction: the
|
|
1972
|
+
* claim is a home-tenancy row and the freeze is a target-tenancy row, and one
|
|
1973
|
+
* transaction carries one RLS scope. Failure raises instead of degrading to "no
|
|
1974
|
+
* hint": a caller must never bind a post operation to text that depends on an
|
|
1975
|
+
* unresolved answer.
|
|
1976
|
+
*/
|
|
1977
|
+
export declare function resolveSlackInteractionFirstTaskHint(db: Database, input: {
|
|
1978
|
+
/** HOME: the installation workspace that owns the identity link. */
|
|
1979
|
+
workspaceId: string;
|
|
1980
|
+
connectionId: string;
|
|
1981
|
+
slackUserId: string;
|
|
1982
|
+
interactionId: string;
|
|
1983
|
+
/**
|
|
1984
|
+
* TARGET: the workspace that owns the interaction row. Defaults to HOME,
|
|
1985
|
+
* which is what every caller means until routing exists.
|
|
1986
|
+
*/
|
|
1987
|
+
interactionWorkspaceId?: string;
|
|
1988
|
+
}): Promise<boolean>;
|
|
1691
1989
|
export declare function deleteSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<boolean>;
|
|
1990
|
+
export declare function enqueueSlackAppHomeRefresh(db: Database, input: Pick<SlackAppHomeRefresh, "accountId" | "workspaceId" | "connectionId" | "slackTeamId" | "slackUserId" | "providerEventId" | "providerViewHash">): Promise<SlackAppHomeRefresh>;
|
|
1991
|
+
export declare function claimSlackAppHomeRefresh(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackAppHomeRefresh | null>;
|
|
1992
|
+
export declare function renewSlackAppHomeRefreshClaim(db: Database, input: {
|
|
1993
|
+
refresh: Pick<SlackAppHomeRefresh, "id" | "accountId" | "workspaceId">;
|
|
1994
|
+
claimHolderId: string;
|
|
1995
|
+
claimLeaseMs: number;
|
|
1996
|
+
}): Promise<boolean>;
|
|
1997
|
+
export declare function settleSlackAppHomeRefresh(db: Database, input: {
|
|
1998
|
+
refresh: Pick<SlackAppHomeRefresh, "id" | "accountId" | "workspaceId" | "desiredRevision">;
|
|
1999
|
+
claimHolderId: string;
|
|
2000
|
+
errorCode?: string | null;
|
|
2001
|
+
}): Promise<boolean>;
|
|
2002
|
+
export declare function releaseSlackAppHomeRefresh(db: Database, input: {
|
|
2003
|
+
refresh: Pick<SlackAppHomeRefresh, "id" | "accountId" | "workspaceId" | "desiredRevision">;
|
|
2004
|
+
claimHolderId: string;
|
|
2005
|
+
errorCode: string;
|
|
2006
|
+
retryAt: Date;
|
|
2007
|
+
}): Promise<boolean>;
|
|
1692
2008
|
export declare function enqueueSlackInteractionInbox(db: Database, input: Omit<SlackInteractionInboxEntry, "id" | "status" | "claimHolderId" | "claimExpiresAt" | "attemptCount" | "retryAt" | "lastErrorCode" | "reactionContextCheckpoint" | "processedAt" | "createdAt" | "updatedAt">): Promise<{
|
|
1693
2009
|
inserted: boolean;
|
|
1694
2010
|
entry: SlackInteractionInboxEntry;
|
|
@@ -1711,12 +2027,37 @@ export declare function releaseSlackInteractionInbox(db: Database, input: {
|
|
|
1711
2027
|
errorCode: string;
|
|
1712
2028
|
retryAt: Date;
|
|
1713
2029
|
}): Promise<boolean>;
|
|
1714
|
-
export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "initiatingSlackUserId" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt"> & {
|
|
2030
|
+
export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "initiatingSlackUserId" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "firstTaskHint" | "routedWorkspaceLabel" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt"> & {
|
|
1715
2031
|
initiatingSlackUserId?: string | null;
|
|
2032
|
+
routedWorkspaceLabel?: string | null;
|
|
1716
2033
|
}): Promise<{
|
|
1717
2034
|
created: boolean;
|
|
1718
2035
|
interaction: SlackInteraction;
|
|
1719
2036
|
}>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Connection-scoped thread continuation. `slack_interactions_route_uq` is
|
|
2039
|
+
* `(connection_id, route_key)`, so one Slack thread maps to exactly one
|
|
2040
|
+
* interaction across every workspace this installation can address. The
|
|
2041
|
+
* content-free tenancy probe resolves which workspace that is; the full row is
|
|
2042
|
+
* then read under that workspace's own RLS scope, so nothing is widened.
|
|
2043
|
+
*
|
|
2044
|
+
* `accountId` is the organization the caller is acting for, and the probe is
|
|
2045
|
+
* fenced on it: crossing workspaces within one organization is the whole point,
|
|
2046
|
+
* crossing organizations never is.
|
|
2047
|
+
*/
|
|
2048
|
+
export declare function getSlackInteractionByConnectionRoute(db: Database, input: {
|
|
2049
|
+
accountId: string;
|
|
2050
|
+
connectionId: string;
|
|
2051
|
+
routeKey: string;
|
|
2052
|
+
}): Promise<SlackInteraction | null>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Workspace-fenced route lookup.
|
|
2055
|
+
*
|
|
2056
|
+
* This is NOT the thread-continuation read: `slack_interactions_route_uq` is
|
|
2057
|
+
* `(connection_id, route_key)` and therefore connection-global, so a thread that
|
|
2058
|
+
* belongs to another workspace this installation can address is invisible here.
|
|
2059
|
+
* Use `getSlackInteractionByConnectionRoute` for continuation.
|
|
2060
|
+
*/
|
|
1720
2061
|
export declare function getSlackInteractionByRoute(db: Database, workspaceId: string, connectionId: string, routeKey: string): Promise<SlackInteraction | null>;
|
|
1721
2062
|
export declare function getSlackInteractionById(db: Database, input: {
|
|
1722
2063
|
accountId: string;
|
|
@@ -2043,6 +2384,7 @@ export declare function loadConnectionCredentialForBroker(db: Database, settings
|
|
|
2043
2384
|
kind?: ConnectionKind;
|
|
2044
2385
|
subjectId?: string | null;
|
|
2045
2386
|
allowSubjectOwned?: boolean;
|
|
2387
|
+
expectedAuthorityGeneration?: number;
|
|
2046
2388
|
}): Promise<ConnectionCredentialForBroker | null>;
|
|
2047
2389
|
export declare function workspaceVercelAiGatewayConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
|
|
2048
2390
|
/** Metadata-only capability revision input; never selects/decrypts the API key. */
|
|
@@ -2071,6 +2413,7 @@ export declare function recordConnectionTokenRefresh(db: Database, input: {
|
|
|
2071
2413
|
credentialEncrypted: string;
|
|
2072
2414
|
expiresAt: Date | null;
|
|
2073
2415
|
grantedScopes?: string[];
|
|
2416
|
+
metadata?: Record<string, unknown>;
|
|
2074
2417
|
lastRefreshAt: Date;
|
|
2075
2418
|
subjectId?: string | null;
|
|
2076
2419
|
}): Promise<boolean>;
|
|
@@ -2208,7 +2551,28 @@ export declare function listSocialPosts(db: Database, options: {
|
|
|
2208
2551
|
export declare function createScheduledTask(db: Database, input: CreateScheduledTaskInput): Promise<ScheduledTask>;
|
|
2209
2552
|
export declare function updateScheduledTask(db: Database, workspaceId: string, taskId: string, input: UpdateScheduledTaskInput): Promise<ScheduledTask>;
|
|
2210
2553
|
export declare function getScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask | null>;
|
|
2554
|
+
/** Internal delete-recovery lookup; public list/get surfaces hide tombstones. */
|
|
2555
|
+
export declare function getScheduledTaskIncludingDeleted(db: Database, workspaceId: string, taskId: string): Promise<(ScheduledTask & {
|
|
2556
|
+
deletedAt: string | null;
|
|
2557
|
+
}) | null>;
|
|
2558
|
+
/** Task-first deletion lock; call only inside the surrounding lifecycle transaction. */
|
|
2559
|
+
export declare function getScheduledTaskIncludingDeletedForUpdate(db: Database, workspaceId: string, taskId: string): Promise<(ScheduledTask & {
|
|
2560
|
+
deletedAt: string | null;
|
|
2561
|
+
}) | null>;
|
|
2211
2562
|
export declare function getScheduledTaskPersonalConnectionDelegations(db: Database, workspaceId: string, taskId: string): Promise<McpPersonalConnectionDelegation[]>;
|
|
2563
|
+
/**
|
|
2564
|
+
* Lock and project the exact mutable incident-task authority inside a caller's
|
|
2565
|
+
* dispatch/claim transaction. Returning the frozen personal delegation tuple
|
|
2566
|
+
* from the same row prevents a later task edit from mixing with the task
|
|
2567
|
+
* snapshot used for preflight.
|
|
2568
|
+
*/
|
|
2569
|
+
export declare function requireScheduledTaskIncidentAuthorityInTransaction(tx: Database, input: {
|
|
2570
|
+
workspaceId: string;
|
|
2571
|
+
taskId: string;
|
|
2572
|
+
}): Promise<{
|
|
2573
|
+
task: ScheduledTask;
|
|
2574
|
+
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
2575
|
+
}>;
|
|
2212
2576
|
export declare function getScheduledTaskXaiProviderAccountAuthoritySnapshot(db: Database, workspaceId: string, taskId: string): Promise<XaiProviderAccountAuthoritySnapshotV1>;
|
|
2213
2577
|
export declare function requireScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
|
|
2214
2578
|
export declare class ScheduledTaskTargetConflictError extends Error {
|
|
@@ -2234,18 +2598,114 @@ export declare function listScheduledTasks(db: Database, workspaceId: string, li
|
|
|
2234
2598
|
export declare function listKnowledgeSourceSyncTasksForConnection(db: Database, workspaceId: string, connectionId: string, pageSize?: number): Promise<Array<ScheduledTask & {
|
|
2235
2599
|
action: KnowledgeSourceSyncAction;
|
|
2236
2600
|
}>>;
|
|
2237
|
-
export declare function deleteScheduledTask(db: Database, workspaceId: string, taskId: string
|
|
2601
|
+
export declare function deleteScheduledTask(db: Database, workspaceId: string, taskId: string, options?: {
|
|
2602
|
+
connectorCleanupSubjectId?: string;
|
|
2603
|
+
connectorCleanupCompleted?: boolean;
|
|
2604
|
+
expectedAuthorityRevision?: number;
|
|
2605
|
+
expectedExecutionDigest?: string;
|
|
2606
|
+
}): Promise<{
|
|
2607
|
+
cleanup: TemporalScheduleCleanupClaim | null;
|
|
2608
|
+
changed: boolean;
|
|
2609
|
+
}>;
|
|
2238
2610
|
export declare function createScheduledTaskRun(db: Database, input: {
|
|
2611
|
+
runId?: string;
|
|
2239
2612
|
workspaceId: string;
|
|
2240
2613
|
taskId: string;
|
|
2614
|
+
/** Exact task snapshot read by the dispatching worker. */
|
|
2615
|
+
taskAuthorityRevision?: number | null;
|
|
2616
|
+
/** Exact task snapshot read by the dispatching worker. */
|
|
2617
|
+
taskExecutionDigest?: string | null;
|
|
2241
2618
|
triggerType: ScheduledTaskTriggerType;
|
|
2242
2619
|
/** Stable Temporal workflow/activity producer identity for replay repair. */
|
|
2243
2620
|
producerKey?: string | null;
|
|
2244
2621
|
scheduledAt?: Date | null;
|
|
2245
2622
|
firedAt?: Date;
|
|
2623
|
+
acceptedExecutionSnapshot?: ScheduledTaskRunAcceptedExecutionType | null;
|
|
2246
2624
|
}): Promise<ScheduledTaskRun>;
|
|
2625
|
+
export declare function getScheduledTaskRunAcceptedExecution(db: Database, input: {
|
|
2626
|
+
workspaceId: string;
|
|
2627
|
+
runId: string;
|
|
2628
|
+
}): Promise<ScheduledTaskRunAcceptedExecutionType | null>;
|
|
2629
|
+
export declare function getScheduledTaskRunByProducerKey(db: Database, input: {
|
|
2630
|
+
workspaceId: string;
|
|
2631
|
+
taskId: string;
|
|
2632
|
+
triggerType: ScheduledTaskTriggerType;
|
|
2633
|
+
producerKey: string;
|
|
2634
|
+
}): Promise<ScheduledTaskRun | null>;
|
|
2635
|
+
export type ScheduledTaskRunPersonalResourceAuthority = {
|
|
2636
|
+
taskId: string;
|
|
2637
|
+
taskAuthorityRevision: number;
|
|
2638
|
+
executionDigest: string;
|
|
2639
|
+
initiatingHumanSubjectId: string;
|
|
2640
|
+
resources: Array<{
|
|
2641
|
+
resourceKind: "variable_set" | "rig";
|
|
2642
|
+
resourceId: string;
|
|
2643
|
+
resourceVersionId: string;
|
|
2644
|
+
selectionSources: string[];
|
|
2645
|
+
authorityId: string;
|
|
2646
|
+
authorityGeneration: number;
|
|
2647
|
+
grantId: string;
|
|
2648
|
+
grantGeneration: number;
|
|
2649
|
+
grantMode: "once" | "session" | "always";
|
|
2650
|
+
}>;
|
|
2651
|
+
};
|
|
2652
|
+
export declare function getScheduledTaskRunPersonalResourceAuthority(db: Database, input: {
|
|
2653
|
+
accountId: string;
|
|
2654
|
+
workspaceId: string;
|
|
2655
|
+
runId: string;
|
|
2656
|
+
}): Promise<ScheduledTaskRunPersonalResourceAuthority | null>;
|
|
2657
|
+
export declare function materializeScheduledTaskReusableSessionFromRun(db: Database, input: {
|
|
2658
|
+
accountId: string;
|
|
2659
|
+
workspaceId: string;
|
|
2660
|
+
taskId: string;
|
|
2661
|
+
runId: string;
|
|
2662
|
+
sessionId: string;
|
|
2663
|
+
sourceTaskAuthorityRevision: number;
|
|
2664
|
+
sourceExecutionDigest: string;
|
|
2665
|
+
}): Promise<number>;
|
|
2666
|
+
export declare function bindScheduledTaskRunSessionInTransaction(tx: Database, input: {
|
|
2667
|
+
accountId: string;
|
|
2668
|
+
workspaceId: string;
|
|
2669
|
+
runId: string;
|
|
2670
|
+
sessionId: string;
|
|
2671
|
+
}): Promise<void>;
|
|
2672
|
+
export declare function getScheduledTaskPersonalResourceAuthoritySubject(db: Database, input: {
|
|
2673
|
+
accountId: string;
|
|
2674
|
+
workspaceId: string;
|
|
2675
|
+
taskId: string;
|
|
2676
|
+
taskAuthorityRevision: number;
|
|
2677
|
+
}): Promise<string | null>;
|
|
2678
|
+
export declare function getScheduledTaskRevisionAuthoritySubject(db: Database, input: {
|
|
2679
|
+
accountId: string;
|
|
2680
|
+
workspaceId: string;
|
|
2681
|
+
taskId: string;
|
|
2682
|
+
taskAuthorityRevision: number;
|
|
2683
|
+
}): Promise<string | null>;
|
|
2684
|
+
export declare function getScheduledTaskRevisionAuthority(db: Database, input: {
|
|
2685
|
+
accountId: string;
|
|
2686
|
+
workspaceId: string;
|
|
2687
|
+
taskId: string;
|
|
2688
|
+
taskAuthorityRevision: number;
|
|
2689
|
+
}): Promise<{
|
|
2690
|
+
subjectId: string;
|
|
2691
|
+
organizationMembershipId: string;
|
|
2692
|
+
membershipAuthorizationRevision: number;
|
|
2693
|
+
} | null>;
|
|
2247
2694
|
/** Failure settlement must not rewrite a source already committed as dispatched. */
|
|
2248
2695
|
export declare function markScheduledTaskRunFailedIfQueued(db: Database, workspaceId: string, runId: string, error: string): Promise<void>;
|
|
2696
|
+
export declare function markScheduledTaskRunSkippedIfQueued(db: Database, input: {
|
|
2697
|
+
workspaceId: string;
|
|
2698
|
+
runId: string;
|
|
2699
|
+
sessionId: string;
|
|
2700
|
+
error: string;
|
|
2701
|
+
}): Promise<void>;
|
|
2702
|
+
/** Claim-time stale-authority settlement; no model/tool/sandbox work has started. */
|
|
2703
|
+
export declare function markScheduledTaskRunAuthorityRejectedInTransaction(tx: Database, input: {
|
|
2704
|
+
workspaceId: string;
|
|
2705
|
+
sessionId: string;
|
|
2706
|
+
runId: string;
|
|
2707
|
+
error?: string;
|
|
2708
|
+
}): Promise<void>;
|
|
2249
2709
|
export declare function updateScheduledTaskRun(db: Database, workspaceId: string, runId: string, input: Partial<{
|
|
2250
2710
|
status: ScheduledTaskRunStatus;
|
|
2251
2711
|
sessionId: string | null;
|
|
@@ -2261,13 +2721,17 @@ export declare function settleScheduledTaskRunInTransaction(tx: Database, input:
|
|
|
2261
2721
|
workspaceId: string;
|
|
2262
2722
|
runId: string;
|
|
2263
2723
|
sessionId: string;
|
|
2264
|
-
triggerEventId: string;
|
|
2265
|
-
status: "dispatched";
|
|
2724
|
+
triggerEventId: string | null;
|
|
2725
|
+
status: "dispatched" | "skipped";
|
|
2726
|
+
error?: string | null;
|
|
2266
2727
|
}): Promise<void>;
|
|
2267
2728
|
export declare function listScheduledTaskRuns(db: Database, workspaceId: string, taskId: string, limit?: number): Promise<ScheduledTaskRun[]>;
|
|
2268
2729
|
export declare function createVariableSet(db: Database, input: {
|
|
2269
2730
|
accountId: string;
|
|
2270
2731
|
workspaceId: string;
|
|
2732
|
+
scope?: VariableSet["scope"];
|
|
2733
|
+
subjectId?: string;
|
|
2734
|
+
allowOrganization?: boolean;
|
|
2271
2735
|
name: string;
|
|
2272
2736
|
description?: string | null;
|
|
2273
2737
|
variables?: Array<{
|
|
@@ -2275,9 +2739,14 @@ export declare function createVariableSet(db: Database, input: {
|
|
|
2275
2739
|
valueEncrypted: string;
|
|
2276
2740
|
}>;
|
|
2277
2741
|
}): Promise<VariableSet>;
|
|
2278
|
-
export
|
|
2279
|
-
|
|
2280
|
-
|
|
2742
|
+
export type VariableSetAccessContext = {
|
|
2743
|
+
accountId: string;
|
|
2744
|
+
workspaceId: string;
|
|
2745
|
+
subjectId: string;
|
|
2746
|
+
};
|
|
2747
|
+
export declare function listVariableSets(db: Database, context: VariableSetAccessContext): Promise<VariableSet[]>;
|
|
2748
|
+
export declare function getVariableSet(db: Database, context: VariableSetAccessContext, variableSetId: string): Promise<VariableSet | null>;
|
|
2749
|
+
export declare function getVariableSetByName(db: Database, context: VariableSetAccessContext, name: string, scope?: VariableSet["scope"]): Promise<VariableSet | null>;
|
|
2281
2750
|
export type VariableSetSecretAuditActor = {
|
|
2282
2751
|
kind: "subject";
|
|
2283
2752
|
} | {
|
|
@@ -2309,22 +2778,35 @@ export declare function readVariableSetSecretAtomically(db: Database, input: {
|
|
|
2309
2778
|
actor: VariableSetSecretAuditActor;
|
|
2310
2779
|
decrypt: (valueEncrypted: string) => string;
|
|
2311
2780
|
}): Promise<VariableSetSecret | null>;
|
|
2312
|
-
export declare function updateVariableSet(db: Database,
|
|
2781
|
+
export declare function updateVariableSet(db: Database, context: VariableSetAccessContext, variableSetId: string, input: {
|
|
2313
2782
|
name?: string;
|
|
2314
2783
|
description?: string | null;
|
|
2784
|
+
allowOrganization?: boolean;
|
|
2315
2785
|
}): Promise<VariableSet>;
|
|
2316
|
-
export declare
|
|
2317
|
-
|
|
2786
|
+
export declare class VariableSetAttachedError extends Error {
|
|
2787
|
+
readonly name = "VariableSetAttachedError";
|
|
2788
|
+
constructor(cause?: unknown);
|
|
2789
|
+
}
|
|
2790
|
+
export declare function deleteVariableSet(db: Database, context: VariableSetAccessContext, variableSetId: string, options?: {
|
|
2791
|
+
allowOrganization?: boolean;
|
|
2792
|
+
}): Promise<boolean>;
|
|
2793
|
+
export declare function countVariableSets(db: Database, context: VariableSetAccessContext, scope?: VariableSet["scope"]): Promise<number>;
|
|
2318
2794
|
export declare function countScheduledTasksUsingVariableSet(db: Database, workspaceId: string, variableSetId: string): Promise<number>;
|
|
2319
2795
|
export declare function countActiveSessionsUsingVariableSet(db: Database, workspaceId: string, variableSetId: string): Promise<number>;
|
|
2320
2796
|
export declare function setVariableSetVariable(db: Database, input: {
|
|
2321
2797
|
accountId: string;
|
|
2322
2798
|
workspaceId: string;
|
|
2799
|
+
subjectId: string;
|
|
2323
2800
|
variableSetId: string;
|
|
2324
2801
|
name: string;
|
|
2325
2802
|
valueEncrypted: string;
|
|
2803
|
+
allowOrganization?: boolean;
|
|
2326
2804
|
}): Promise<VariableSetVariableMetadata>;
|
|
2327
|
-
export declare function deleteVariableSetVariable(db: Database,
|
|
2805
|
+
export declare function deleteVariableSetVariable(db: Database, input: VariableSetAccessContext & {
|
|
2806
|
+
variableSetId: string;
|
|
2807
|
+
name: string;
|
|
2808
|
+
allowOrganization?: boolean;
|
|
2809
|
+
}): Promise<boolean>;
|
|
2328
2810
|
export declare class RigChangeTransitionError extends Error {
|
|
2329
2811
|
readonly changeId: string;
|
|
2330
2812
|
readonly fromStatus: string;
|
|
@@ -2353,14 +2835,22 @@ export type RigVersionContentInput = {
|
|
|
2353
2835
|
export declare function createRig(db: Database, input: {
|
|
2354
2836
|
accountId: string;
|
|
2355
2837
|
workspaceId: string;
|
|
2838
|
+
scope?: Rig["scope"];
|
|
2839
|
+
subjectId?: string;
|
|
2840
|
+
allowOrganization?: boolean;
|
|
2356
2841
|
name: string;
|
|
2357
2842
|
description?: string | null;
|
|
2358
2843
|
createdBy?: string | null;
|
|
2359
2844
|
initialVersion?: RigVersionContentInput;
|
|
2360
2845
|
}): Promise<Rig>;
|
|
2361
|
-
export
|
|
2362
|
-
|
|
2363
|
-
|
|
2846
|
+
export type RigAccessContext = {
|
|
2847
|
+
accountId: string;
|
|
2848
|
+
workspaceId: string;
|
|
2849
|
+
subjectId: string;
|
|
2850
|
+
};
|
|
2851
|
+
export declare function listRigs(db: Database, access: string | RigAccessContext): Promise<Rig[]>;
|
|
2852
|
+
export declare function getRig(db: Database, access: string | RigAccessContext, rigId: string): Promise<Rig | null>;
|
|
2853
|
+
export declare function getRigByName(db: Database, access: string | RigAccessContext, name: string, scope?: Rig["scope"]): Promise<Rig | null>;
|
|
2364
2854
|
export declare function updateRig(db: Database, workspaceId: string, rigId: string, input: {
|
|
2365
2855
|
name?: string;
|
|
2366
2856
|
description?: string | null;
|
|
@@ -2370,6 +2860,14 @@ export declare function deleteRigIfNoActiveSessions(db: Database, workspaceId: s
|
|
|
2370
2860
|
deleted: boolean;
|
|
2371
2861
|
activeSessionCount: number;
|
|
2372
2862
|
}>;
|
|
2863
|
+
export declare function updateScopedRig(db: Database, access: RigAccessContext, rigId: string, input: {
|
|
2864
|
+
name?: string;
|
|
2865
|
+
description?: string | null;
|
|
2866
|
+
allowOrganization?: boolean;
|
|
2867
|
+
}): Promise<Rig>;
|
|
2868
|
+
export declare function revokeScopedRig(db: Database, access: RigAccessContext, rigId: string, options?: {
|
|
2869
|
+
allowOrganization?: boolean;
|
|
2870
|
+
}): Promise<void>;
|
|
2373
2871
|
export declare class ChannelNameConflictError extends Error {
|
|
2374
2872
|
constructor(name: string);
|
|
2375
2873
|
}
|
|
@@ -2388,14 +2886,21 @@ export declare function getChannel(db: Database, workspaceId: string, channelId:
|
|
|
2388
2886
|
export declare function updateChannel(db: Database, workspaceId: string, channelId: string, input: {
|
|
2389
2887
|
name?: string | undefined;
|
|
2390
2888
|
description?: string | null | undefined;
|
|
2889
|
+
pinned?: boolean | undefined;
|
|
2391
2890
|
}): Promise<Channel | null>;
|
|
2392
2891
|
export declare function deleteChannel(db: Database, workspaceId: string, channelId: string): Promise<boolean>;
|
|
2892
|
+
/**
|
|
2893
|
+
* Replaces the complete project order in one workspace-scoped transaction.
|
|
2894
|
+
* Callers must supply every current project exactly once so a stale drag can
|
|
2895
|
+
* never silently discard a concurrently created project.
|
|
2896
|
+
*/
|
|
2897
|
+
export declare function reorderChannels(db: Database, workspaceId: string, channelIds: readonly string[]): Promise<Channel[] | null>;
|
|
2393
2898
|
export declare function setSessionChannel(db: Database, input: {
|
|
2394
2899
|
workspaceId: string;
|
|
2395
2900
|
sessionId: string;
|
|
2396
2901
|
channelId: string | null;
|
|
2397
2902
|
}): Promise<boolean>;
|
|
2398
|
-
export declare function countRigs(db: Database,
|
|
2903
|
+
export declare function countRigs(db: Database, access: string | RigAccessContext, scope?: Rig["scope"]): Promise<number>;
|
|
2399
2904
|
export declare function countSessionsUsingRig(db: Database, workspaceId: string, rigId: string): Promise<number>;
|
|
2400
2905
|
export declare function createRigVersion(db: Database, workspaceId: string, rigId: string, input: RigVersionContentInput, options?: {
|
|
2401
2906
|
activate?: boolean;
|
|
@@ -2431,6 +2936,29 @@ export declare function listRigVersionMonitoringSummaries(db: Database, workspac
|
|
|
2431
2936
|
total: number;
|
|
2432
2937
|
}>;
|
|
2433
2938
|
export declare function getRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion | null>;
|
|
2939
|
+
/** Credential-free exact retained Rig metadata under the target workspace's
|
|
2940
|
+
* scoped organization/user authority. Unlike the physical-workspace helpers,
|
|
2941
|
+
* this remains valid for a personal-origin Rig granted into another workspace. */
|
|
2942
|
+
export declare function getScheduledScopedRigVersionMetadata(db: Database, access: RigAccessContext, rigId: string, versionId: string): Promise<{
|
|
2943
|
+
name: string;
|
|
2944
|
+
version: RigVersion;
|
|
2945
|
+
health: RigVerificationHealth;
|
|
2946
|
+
} | null>;
|
|
2947
|
+
export declare function materializeRigVersionForAttempt(db: Database, input: {
|
|
2948
|
+
accountId: string;
|
|
2949
|
+
workspaceId: string;
|
|
2950
|
+
subjectId: string | null;
|
|
2951
|
+
sessionId: string;
|
|
2952
|
+
turnId: string;
|
|
2953
|
+
attemptId: string;
|
|
2954
|
+
executionGeneration: number;
|
|
2955
|
+
}): Promise<{
|
|
2956
|
+
rigName: string;
|
|
2957
|
+
version: RigVersion;
|
|
2958
|
+
} | null>;
|
|
2959
|
+
/** Metadata-only health for one exact frozen rig version. Never reads setup,
|
|
2960
|
+
* variable values, credential material, or the currently active version. */
|
|
2961
|
+
export declare function getRigVersionHealth(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVerificationHealth | null>;
|
|
2434
2962
|
export declare function getRigVersionById(db: Database, workspaceId: string, versionId: string): Promise<RigVersion | null>;
|
|
2435
2963
|
export type RigProviderImageBuildClaim = {
|
|
2436
2964
|
status: "claimed";
|
|
@@ -2506,16 +3034,286 @@ export declare function beginRigChangeVerificationAttempt(db: Database, workspac
|
|
|
2506
3034
|
startedAt: string;
|
|
2507
3035
|
allowAlreadyVerifying?: boolean;
|
|
2508
3036
|
}): Promise<RigChange>;
|
|
3037
|
+
export declare function getScheduledVariableSetExpectedGenerationForAttempt(db: Database, input: {
|
|
3038
|
+
accountId: string;
|
|
3039
|
+
workspaceId: string;
|
|
3040
|
+
/** Actor subject for RLS (a service initiator on pure scheduled turns). */
|
|
3041
|
+
subjectId: string;
|
|
3042
|
+
/** Exact causal human, or null for a pure service attempt (workspace/org sets only). */
|
|
3043
|
+
initiatingHumanSubjectId: string | null;
|
|
3044
|
+
sessionId: string;
|
|
3045
|
+
turnId: string;
|
|
3046
|
+
attemptId: string;
|
|
3047
|
+
executionGeneration: number;
|
|
3048
|
+
variableSetId: string;
|
|
3049
|
+
}): Promise<number | null>;
|
|
2509
3050
|
/**
|
|
2510
3051
|
* The ONLY helper that selects value_encrypted. Used exclusively by the worker
|
|
2511
3052
|
* activity that materializes a sandbox for a run whose session carries an
|
|
2512
3053
|
* variableSet attachment. Do not call from API routes: values are write-only.
|
|
2513
3054
|
*/
|
|
2514
|
-
|
|
3055
|
+
/**
|
|
3056
|
+
* Live session authority epoch, for stamping viewer-facing claims (stream
|
|
3057
|
+
* tokens, viewer holders). Identity/epoch only; NULL when the session is not
|
|
3058
|
+
* visible in this workspace.
|
|
3059
|
+
*/
|
|
3060
|
+
export declare function getSessionAuthorityEpoch(db: Database, input: {
|
|
3061
|
+
accountId: string;
|
|
3062
|
+
workspaceId: string;
|
|
3063
|
+
sessionId: string;
|
|
3064
|
+
}): Promise<number | null>;
|
|
3065
|
+
/**
|
|
3066
|
+
* ORACLE, NOT AN AUTHORIZATION. It sets `opengeni.subject_id` from its own
|
|
3067
|
+
* argument, so `list_self_organization_memberships`' `42501` guard is satisfied
|
|
3068
|
+
* for whatever subject the caller NAMES: it answers for ANY subject and cannot
|
|
3069
|
+
* establish who the caller is. Passing it a request-derived subject is a
|
|
3070
|
+
* vulnerability. Call it only about a subject you are already entitled to ask
|
|
3071
|
+
* about — one authenticated out of band, or the frozen owner of a delegation
|
|
3072
|
+
* you already hold. The `named` prefix is the warning: you are naming a subject,
|
|
3073
|
+
* not proving you are one.
|
|
3074
|
+
*
|
|
3075
|
+
* When the subject IS the caller, use {@link subjectHasLiveWorkspaceAuthorityInScope}
|
|
3076
|
+
* instead: it refuses to set the subject GUC at all, so the oracle shape is
|
|
3077
|
+
* unrepresentable there. Both exist on purpose — some callers legitimately ask
|
|
3078
|
+
* about a non-caller subject, which the in-scope variant cannot express.
|
|
3079
|
+
*
|
|
3080
|
+
* The authority rule itself lives in that in-scope variant; this is a scope
|
|
3081
|
+
* wrapper over it, so there is one implementation.
|
|
3082
|
+
*
|
|
3083
|
+
* The prior `opengeni.subject_id` is restored before returning, so probing a
|
|
3084
|
+
* named subject cannot leak it into the rest of a caller's transaction.
|
|
3085
|
+
*/
|
|
3086
|
+
export declare function namedSubjectHasLiveWorkspaceAuthority(db: Database, input: {
|
|
3087
|
+
accountId: string;
|
|
3088
|
+
workspaceId: string;
|
|
3089
|
+
subjectId: string;
|
|
3090
|
+
}): Promise<boolean>;
|
|
3091
|
+
/**
|
|
3092
|
+
* The ONLY place a Slack request may reach a managed human's personal
|
|
3093
|
+
* workspace. Returns the grant a routed Slack target may act under, or null.
|
|
3094
|
+
*
|
|
3095
|
+
* A Slack webhook has no caller subject: `subjectId` is read out of band from a
|
|
3096
|
+
* durable `slack_bot_user_links` row, whose only writers sit behind a verified
|
|
3097
|
+
* managed-human cookie or a `members:manage` grant. That is why this uses
|
|
3098
|
+
* {@link namedSubjectHasLiveWorkspaceAuthority} rather than the in-scope
|
|
3099
|
+
* variant - the subject was authenticated elsewhere, and this seam is naming
|
|
3100
|
+
* it, not proving it. Callers must therefore never pass a subject taken from a
|
|
3101
|
+
* Slack payload; pass only `link.subjectId`.
|
|
3102
|
+
*
|
|
3103
|
+
* Ordinary membership first, then a derived-and-fenced pointer path (the same
|
|
3104
|
+
* shape as `requirePersonalGitHubCallbackGrant`):
|
|
3105
|
+
*
|
|
3106
|
+
* - `getWorkspaceGrant` is a bare `workspace_memberships` join and is NOT
|
|
3107
|
+
* widened here, because `accessGrantAuthorization` calls it for every
|
|
3108
|
+
* principal kind including API keys and delegated bearers; widening it would
|
|
3109
|
+
* hand a bearer principal personal-workspace access.
|
|
3110
|
+
* - The pointer path accepts only the subject's OWN `personalWorkspaceId` from
|
|
3111
|
+
* an ACTIVE membership in exactly `targetAccountId`, then re-checks live
|
|
3112
|
+
* authority. The workspace id is never taken from a route row or a Slack
|
|
3113
|
+
* payload - it must equal the pointer.
|
|
3114
|
+
* - No Slack branch is ever added to `canonicalManagedCookieContexts`: that
|
|
3115
|
+
* `WeakSet` has exactly one writer, the Better Auth cookie branch of
|
|
3116
|
+
* `resolveAccessContext`, and a Slack-signed webhook can never be in it.
|
|
3117
|
+
*
|
|
3118
|
+
* Slack sessions stay `workspace_shared`: this grant is passed as an ordinary
|
|
3119
|
+
* grant, and `createSessionForRequest` is still called WITHOUT its
|
|
3120
|
+
* `authorization` argument, so Slack privacy remains
|
|
3121
|
+
* `slack_interactions.visibility`.
|
|
3122
|
+
*/
|
|
3123
|
+
export declare function resolveSlackTargetAuthority(db: Database, input: {
|
|
3124
|
+
subjectId: string;
|
|
3125
|
+
targetAccountId: string;
|
|
3126
|
+
targetWorkspaceId: string;
|
|
3127
|
+
}): Promise<AccessGrant | null>;
|
|
3128
|
+
/**
|
|
3129
|
+
* Read-only organization tenancy inventory (0285): content-free counts of
|
|
3130
|
+
* every legacy-attribution population the backfill/parity program gates on.
|
|
3131
|
+
* Integers only - no identities, names, keys, or values.
|
|
3132
|
+
*/
|
|
3133
|
+
export declare function inventoryOrganizationTenancy(db: Database, input: {
|
|
3134
|
+
organizationId: string;
|
|
3135
|
+
}): Promise<Record<string, unknown>>;
|
|
3136
|
+
/**
|
|
3137
|
+
* How much independent evidence a parity gate carries.
|
|
3138
|
+
*
|
|
3139
|
+
* - `constraint` / `trigger`: the property is already enforced by the physical
|
|
3140
|
+
* schema, so the gate is a shadow verification that the enforcement is still
|
|
3141
|
+
* present and validated - it cannot be the first line of defence.
|
|
3142
|
+
* - `runtime`: nothing in the schema prevents the violation. These are the
|
|
3143
|
+
* gates that carry real evidence about a cutover.
|
|
3144
|
+
*/
|
|
3145
|
+
export type TenancyParityGateBasis = "constraint" | "trigger" | "runtime";
|
|
3146
|
+
export interface TenancyParityGateDefinition {
|
|
3147
|
+
readonly id: string;
|
|
3148
|
+
readonly title: string;
|
|
3149
|
+
readonly basis: TenancyParityGateBasis;
|
|
3150
|
+
/** What a violation means, and why it must never resolve to user authority. */
|
|
3151
|
+
readonly rule: string;
|
|
3152
|
+
}
|
|
3153
|
+
export interface TenancyParityGateResult extends TenancyParityGateDefinition {
|
|
3154
|
+
readonly status: "pass" | "fail";
|
|
3155
|
+
readonly violations: number;
|
|
3156
|
+
/** Bounded row identifiers only - never subjects, names, keys, or values. */
|
|
3157
|
+
readonly evidence: readonly string[];
|
|
3158
|
+
readonly evidenceTruncated: boolean;
|
|
3159
|
+
}
|
|
3160
|
+
export interface TenancyParityLaneDefinition {
|
|
3161
|
+
readonly id: string;
|
|
3162
|
+
readonly title: string;
|
|
3163
|
+
/**
|
|
3164
|
+
* `drainable`: a backfill can take it to zero.
|
|
3165
|
+
* `observation`: immutable history, reported over a bounded recent window so
|
|
3166
|
+
* that "the lane stopped being exercised" is still a reachable zero.
|
|
3167
|
+
*/
|
|
3168
|
+
readonly kind: "drainable" | "observation";
|
|
3169
|
+
/** The workstream that owns draining this lane, when it is not this one. */
|
|
3170
|
+
readonly owner?: string;
|
|
3171
|
+
}
|
|
3172
|
+
export interface TenancyParityLaneResult extends TenancyParityLaneDefinition {
|
|
3173
|
+
readonly count: number;
|
|
3174
|
+
readonly drained: boolean;
|
|
3175
|
+
}
|
|
3176
|
+
export interface TenancyParityUnverifiable {
|
|
3177
|
+
readonly id: string;
|
|
3178
|
+
readonly title: string;
|
|
3179
|
+
/** Why no honest number exists for this property today. */
|
|
3180
|
+
readonly reason: string;
|
|
3181
|
+
}
|
|
3182
|
+
export interface TenancyParityReport {
|
|
3183
|
+
readonly schemaVersion: 1;
|
|
3184
|
+
readonly organizationId: string;
|
|
3185
|
+
readonly generatedAt: string;
|
|
3186
|
+
readonly evidenceLimit: number;
|
|
3187
|
+
readonly observationWindowDays: number;
|
|
3188
|
+
/** `fail` when any invariant gate has at least one violation. */
|
|
3189
|
+
readonly status: "pass" | "fail";
|
|
3190
|
+
/** Every gate passes AND every compatibility lane is drained. */
|
|
3191
|
+
readonly cutoverReady: boolean;
|
|
3192
|
+
readonly summary: {
|
|
3193
|
+
readonly gates: number;
|
|
3194
|
+
readonly gatesFailed: number;
|
|
3195
|
+
readonly violations: number;
|
|
3196
|
+
readonly lanes: number;
|
|
3197
|
+
readonly lanesUndrained: number;
|
|
3198
|
+
readonly unverifiable: number;
|
|
3199
|
+
};
|
|
3200
|
+
readonly gates: readonly TenancyParityGateResult[];
|
|
3201
|
+
readonly lanes: readonly TenancyParityLaneResult[];
|
|
3202
|
+
readonly unverifiable: readonly TenancyParityUnverifiable[];
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Ordered catalog of the organization-tenancy parity gates (phase E). Every id
|
|
3206
|
+
* matches a key emitted by `check_organization_tenancy_parity` (migration
|
|
3207
|
+
* 0298); a gate present here but absent from the seam is reported as a
|
|
3208
|
+
* structural mismatch rather than silently passing.
|
|
3209
|
+
*/
|
|
3210
|
+
export declare const TENANCY_PARITY_GATES: readonly TenancyParityGateDefinition[];
|
|
3211
|
+
/**
|
|
3212
|
+
* Compatibility lanes. These are legacy populations, NOT invariant violations:
|
|
3213
|
+
* a non-zero lane blocks a cutover but is not schema corruption.
|
|
3214
|
+
*/
|
|
3215
|
+
export declare const TENANCY_PARITY_LANES: readonly TenancyParityLaneDefinition[];
|
|
3216
|
+
/**
|
|
3217
|
+
* Properties phase E names that have no honest measurement today. They are
|
|
3218
|
+
* reported explicitly instead of being emitted as a counter that can never
|
|
3219
|
+
* reach zero.
|
|
3220
|
+
*/
|
|
3221
|
+
export declare const TENANCY_PARITY_UNVERIFIABLE: readonly TenancyParityUnverifiable[];
|
|
3222
|
+
/**
|
|
3223
|
+
* Compose the operator-facing parity report from the raw seam output. Pure and
|
|
3224
|
+
* total: an id the seam did not emit is reported as a failing gate with an
|
|
3225
|
+
* explicit structural-mismatch violation rather than silently passing.
|
|
3226
|
+
*/
|
|
3227
|
+
export declare function composeTenancyParityReport(raw: Record<string, unknown>, options?: {
|
|
3228
|
+
generatedAt?: string;
|
|
3229
|
+
}): TenancyParityReport;
|
|
3230
|
+
/**
|
|
3231
|
+
* Read-only organization tenancy parity check (0298, phase E). Verifies the
|
|
3232
|
+
* structural tenancy invariants, reports the compatibility lanes, and names the
|
|
3233
|
+
* properties that are currently unverifiable. It never writes, repairs, or
|
|
3234
|
+
* widens anything, and no reported mismatch is resolved toward user authority.
|
|
3235
|
+
*/
|
|
3236
|
+
export declare function checkOrganizationTenancyParity(db: Database, input: {
|
|
3237
|
+
organizationId: string;
|
|
3238
|
+
evidenceLimit?: number;
|
|
3239
|
+
observationWindowDays?: number;
|
|
3240
|
+
generatedAt?: string;
|
|
3241
|
+
}): Promise<TenancyParityReport>;
|
|
3242
|
+
/**
|
|
3243
|
+
* Organization-tenancy phase D classification assertion (0291) for Variable Sets, Rigs, and
|
|
3244
|
+
* Connected Machines. Read-only over every resource table: it proves each row
|
|
3245
|
+
* already carries an explicit terminal authority classification and never
|
|
3246
|
+
* rewrites one. Supplying `runKey` additionally records the verdicts durably
|
|
3247
|
+
* through the 0286 tenancy backfill ledger (one receipt per family plus one
|
|
3248
|
+
* append-only unresolved row per resource that could not be proven); the
|
|
3249
|
+
* result reports `ledgerAvailable` so a run that could not record its
|
|
3250
|
+
* obligations is visible rather than silent. A run key may be used once - the
|
|
3251
|
+
* ledger refuses to re-open a settled receipt.
|
|
3252
|
+
*/
|
|
3253
|
+
export declare function verifyOrganizationResourceClassification(db: Database, input: {
|
|
3254
|
+
organizationId: string;
|
|
3255
|
+
runKey?: string | null;
|
|
3256
|
+
}): Promise<Record<string, unknown>>;
|
|
3257
|
+
/**
|
|
3258
|
+
* Organization-tenancy phase D session ownership classification (0297). Read-only over
|
|
3259
|
+
* `sessions`: it proves every attributed session points at one live,
|
|
3260
|
+
* internally consistent organization membership, and names a fixed reason code
|
|
3261
|
+
* for every session it refuses to attribute. Supplying `runKey` additionally
|
|
3262
|
+
* records those refusals durably through the tenancy backfill ledger (one
|
|
3263
|
+
* `sessions` receipt plus one append-only unresolved row each); the result
|
|
3264
|
+
* reports `ledgerAvailable` so a run that could not record its obligations is
|
|
3265
|
+
* visible rather than silent. A run key may be used once - the ledger refuses
|
|
3266
|
+
* to re-open a settled receipt.
|
|
3267
|
+
*
|
|
3268
|
+
* It never writes a session row and never infers user authority from
|
|
3269
|
+
* `created_by`, a default workspace, or current workspace access.
|
|
3270
|
+
*/
|
|
3271
|
+
export declare function classifyOrganizationSessionOwnership(db: Database, input: {
|
|
3272
|
+
organizationId: string;
|
|
3273
|
+
runKey?: string | null;
|
|
3274
|
+
}): Promise<Record<string, unknown>>;
|
|
3275
|
+
/**
|
|
3276
|
+
* Organization-tenancy phase D session ownership backfill (0297). One bounded, resumable,
|
|
3277
|
+
* idempotent batch of the only two deterministic repairs: a session sitting in
|
|
3278
|
+
* exactly one active membership's personal workspace whose creator subject is
|
|
3279
|
+
* that same membership, and the parent-inheritance closure migration 0225's own
|
|
3280
|
+
* trigger would have produced. `dryRun` defaults to true. Candidates are
|
|
3281
|
+
* claimed with `FOR UPDATE ... SKIP LOCKED`, so concurrent drivers never
|
|
3282
|
+
* contend; keep calling while `moreLikely` is true.
|
|
3283
|
+
*/
|
|
3284
|
+
export declare function backfillOrganizationSessionOwnership(db: Database, input: {
|
|
3285
|
+
organizationId: string;
|
|
3286
|
+
limit?: number;
|
|
3287
|
+
dryRun?: boolean;
|
|
3288
|
+
runKey?: string | null;
|
|
3289
|
+
}): Promise<Record<string, unknown>>;
|
|
3290
|
+
export declare function getVariableSetValuesForRun(db: Database, input: {
|
|
3291
|
+
accountId: string;
|
|
3292
|
+
workspaceId: string;
|
|
3293
|
+
variableSetId: string;
|
|
3294
|
+
authority: {
|
|
3295
|
+
kind: "agent_attempt";
|
|
3296
|
+
subjectId: string;
|
|
3297
|
+
sessionId: string;
|
|
3298
|
+
turnId: string;
|
|
3299
|
+
attemptId: string;
|
|
3300
|
+
executionGeneration: number;
|
|
3301
|
+
initiatingHumanSubjectId?: string | null;
|
|
3302
|
+
} | {
|
|
3303
|
+
kind: "session_attach";
|
|
3304
|
+
sessionId: string;
|
|
3305
|
+
/** The authenticated route subject driving the attach (0282); null
|
|
3306
|
+
* records the explicit legacy sentinel `service:session`. */
|
|
3307
|
+
subjectId: string | null;
|
|
3308
|
+
initiatingHumanSubjectId?: string | null;
|
|
3309
|
+
};
|
|
3310
|
+
}): Promise<{
|
|
2515
3311
|
variableSet: {
|
|
2516
3312
|
id: string;
|
|
2517
3313
|
name: string;
|
|
2518
3314
|
description: string | null;
|
|
3315
|
+
scope: VariableSet["scope"];
|
|
3316
|
+
generation: number;
|
|
2519
3317
|
};
|
|
2520
3318
|
values: Record<string, string>;
|
|
2521
3319
|
} | null>;
|
|
@@ -2547,6 +3345,8 @@ export type VariableSetForRun = {
|
|
|
2547
3345
|
id: string;
|
|
2548
3346
|
name: string;
|
|
2549
3347
|
description: string | null;
|
|
3348
|
+
scope: VariableSet["scope"];
|
|
3349
|
+
generation: number;
|
|
2550
3350
|
values: Record<string, string>;
|
|
2551
3351
|
};
|
|
2552
3352
|
/**
|
|
@@ -2563,7 +3363,27 @@ export type VariableSetForRun = {
|
|
|
2563
3363
|
* missing key or a deleted variableSet throws (names/ids only in messages) instead
|
|
2564
3364
|
* of silently running without the secrets the run expects.
|
|
2565
3365
|
*/
|
|
2566
|
-
export declare function loadVariableSetForRun(db: Database, settings: Settings,
|
|
3366
|
+
export declare function loadVariableSetForRun(db: Database, settings: Settings, input: {
|
|
3367
|
+
accountId: string;
|
|
3368
|
+
workspaceId: string;
|
|
3369
|
+
variableSetId: string | null;
|
|
3370
|
+
authority: {
|
|
3371
|
+
kind: "agent_attempt";
|
|
3372
|
+
subjectId: string;
|
|
3373
|
+
sessionId: string;
|
|
3374
|
+
turnId: string;
|
|
3375
|
+
attemptId: string;
|
|
3376
|
+
executionGeneration: number;
|
|
3377
|
+
initiatingHumanSubjectId?: string | null;
|
|
3378
|
+
} | {
|
|
3379
|
+
kind: "session_attach";
|
|
3380
|
+
sessionId: string;
|
|
3381
|
+
/** The authenticated route subject driving the attach (0282); null
|
|
3382
|
+
* records the explicit legacy sentinel `service:session`. */
|
|
3383
|
+
subjectId: string | null;
|
|
3384
|
+
initiatingHumanSubjectId?: string | null;
|
|
3385
|
+
};
|
|
3386
|
+
}): Promise<VariableSetForRun | null>;
|
|
2567
3387
|
/** @deprecated use loadVariableSetForRun */
|
|
2568
3388
|
export declare const loadWorkspaceEnvironmentForRun: typeof loadVariableSetForRun;
|
|
2569
3389
|
/** @deprecated use VariableSetForRun */
|
|
@@ -3590,7 +4410,7 @@ export type ConnectorActionInvocation = {
|
|
|
3590
4410
|
toolName: string;
|
|
3591
4411
|
arguments: unknown;
|
|
3592
4412
|
/** Explicit per-session MCP approval, rather than a connector-policy decision. */
|
|
3593
|
-
approvalMode?: "session_mcp";
|
|
4413
|
+
approvalMode?: "session_mcp" | "connector_write";
|
|
3594
4414
|
};
|
|
3595
4415
|
export type PrepareConnectorActionApprovalResult = {
|
|
3596
4416
|
managed: false;
|
|
@@ -3612,7 +4432,7 @@ export type BeginConnectorActionExecutionResult = {
|
|
|
3612
4432
|
} | {
|
|
3613
4433
|
allowed: false;
|
|
3614
4434
|
managed: true;
|
|
3615
|
-
reason: "approval_required" | "blocked" | "rejected" | "already_executed" | "uncertain_retry";
|
|
4435
|
+
reason: "approval_required" | "blocked" | "rejected" | "already_executed" | "uncertain_retry" | "not_executed";
|
|
3616
4436
|
requestId: string;
|
|
3617
4437
|
actionFingerprint: string;
|
|
3618
4438
|
};
|
|
@@ -3678,7 +4498,7 @@ export declare function completeConnectorActionExecution(db: Database, input: {
|
|
|
3678
4498
|
workspaceId: string;
|
|
3679
4499
|
requestId: string;
|
|
3680
4500
|
attemptId: string;
|
|
3681
|
-
outcome: "completed" | "uncertain";
|
|
4501
|
+
outcome: "completed" | "uncertain" | "not_executed";
|
|
3682
4502
|
}): Promise<void>;
|
|
3683
4503
|
/** Read the persisted deployment fallback; process configuration is not policy authority. */
|
|
3684
4504
|
export declare function getNestedAgentDepthDeploymentPolicy(db: Database): Promise<NestedAgentDepthDeploymentPolicy>;
|
|
@@ -3690,10 +4510,14 @@ export declare class SessionIdConflictError extends Error {
|
|
|
3690
4510
|
readonly sessionId: string;
|
|
3691
4511
|
constructor(sessionId: string);
|
|
3692
4512
|
}
|
|
4513
|
+
export declare class SessionCreateIdempotencyConflictError extends Error {
|
|
4514
|
+
constructor();
|
|
4515
|
+
}
|
|
3693
4516
|
export type SessionCreateInput = {
|
|
3694
4517
|
requestedSessionId?: string;
|
|
3695
4518
|
accountId: string;
|
|
3696
4519
|
workspaceId: string;
|
|
4520
|
+
visibility?: "user_private" | "workspace_shared";
|
|
3697
4521
|
initialMessage: string;
|
|
3698
4522
|
initialModelContext?: string | null;
|
|
3699
4523
|
resources: ResourceRef[];
|
|
@@ -3705,6 +4529,8 @@ export type SessionCreateInput = {
|
|
|
3705
4529
|
createdByContext?: TurnInitiatorContext;
|
|
3706
4530
|
createdByActor?: AgentSessionCreationActor | null;
|
|
3707
4531
|
model: string;
|
|
4532
|
+
reasoningEffort: ReasoningEffort;
|
|
4533
|
+
latencyMode: LatencyMode;
|
|
3708
4534
|
sandboxBackend: SandboxBackend;
|
|
3709
4535
|
variableSetId?: string | null;
|
|
3710
4536
|
rigId?: string | null;
|
|
@@ -3718,8 +4544,16 @@ export type SessionCreateInput = {
|
|
|
3718
4544
|
createIdempotencyKey?: string | null;
|
|
3719
4545
|
sandboxGroupId?: string | null;
|
|
3720
4546
|
sandboxOs?: SandboxOs;
|
|
4547
|
+
/** Exact accepted generated-session compaction policy; internal lifecycle callers only. */
|
|
4548
|
+
frozenCodexCompactionMode?: Session["codexCompactionMode"];
|
|
4549
|
+
/** Exact accepted root-session depth policy; internal lifecycle callers only. */
|
|
4550
|
+
frozenNestedAgentDepthPolicy?: {
|
|
4551
|
+
effectiveMaxNestedAgentDepth: number;
|
|
4552
|
+
nestedAgentDepthPolicySource: NestedAgentDepthPolicySource;
|
|
4553
|
+
};
|
|
3721
4554
|
mcpServers?: CreateSessionMcpServerInput[];
|
|
3722
4555
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
4556
|
+
initialPersonalResourceAttachmentIntent?: PersonalResourceAttachmentIntent | null;
|
|
3723
4557
|
initialXaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
3724
4558
|
maxNestedAgentDepthOverride?: number | null;
|
|
3725
4559
|
allowNestedAgentDepthIncrease?: boolean;
|
|
@@ -3748,11 +4582,38 @@ export declare function createSessionWithIdempotencyKeyResult(db: Database, inpu
|
|
|
3748
4582
|
* admission transaction and then surfaced as SessionSpawnDeniedDbError;
|
|
3749
4583
|
* callers that need a structured result use createSessionWithIdempotencyKeyResult.
|
|
3750
4584
|
*/
|
|
3751
|
-
export declare function createSessionWithIdempotencyKey(db: Database, input: SessionCreateInput & {
|
|
3752
|
-
createIdempotencyKey: string;
|
|
3753
|
-
}): Promise<SessionCreateSuccessResult>;
|
|
3754
|
-
export declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
|
|
3755
|
-
export declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
|
|
4585
|
+
export declare function createSessionWithIdempotencyKey(db: Database, input: SessionCreateInput & {
|
|
4586
|
+
createIdempotencyKey: string;
|
|
4587
|
+
}): Promise<SessionCreateSuccessResult>;
|
|
4588
|
+
export declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
|
|
4589
|
+
export declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
|
|
4590
|
+
export type DeleteSessionTreeIfQuiescentResult = {
|
|
4591
|
+
status: "deleted";
|
|
4592
|
+
deletedSessionCount: number;
|
|
4593
|
+
} | {
|
|
4594
|
+
status: "not_found" | "not_root" | "active_sessions" | "active_video_generations" | "active_background_commands" | "live_sandboxes" | "externally_referenced";
|
|
4595
|
+
};
|
|
4596
|
+
/**
|
|
4597
|
+
* Permanently delete one complete root session tree after proving that no
|
|
4598
|
+
* runtime or provider-side owner can still act on it.
|
|
4599
|
+
*
|
|
4600
|
+
* The workspace-control and tree row locks fence new sessions and concurrent
|
|
4601
|
+
* lifecycle changes. Session-owned evidence follows the migration-owned
|
|
4602
|
+
* cascade; immutable workspace-level provenance and independent forks
|
|
4603
|
+
* deliberately retain RESTRICT and surface `externally_referenced` instead of
|
|
4604
|
+
* being orphaned.
|
|
4605
|
+
*/
|
|
4606
|
+
export declare function deleteSessionTreeIfQuiescent(db: Database, input: {
|
|
4607
|
+
workspaceId: string;
|
|
4608
|
+
subjectId: string;
|
|
4609
|
+
sessionId: string;
|
|
4610
|
+
/**
|
|
4611
|
+
* Bound the workspace control prefix wait (request-scoped API callers pass
|
|
4612
|
+
* `workspaceControlRequestLockTimeoutMs()`); omit for lifecycle callers.
|
|
4613
|
+
* Exceeding it throws `WorkspaceControlBusyError` before any row is read.
|
|
4614
|
+
*/
|
|
4615
|
+
controlLockTimeoutMs?: number;
|
|
4616
|
+
}): Promise<DeleteSessionTreeIfQuiescentResult>;
|
|
3756
4617
|
export type SessionAuthorityProjection = {
|
|
3757
4618
|
sessionId: string;
|
|
3758
4619
|
rootSessionId: string;
|
|
@@ -3797,26 +4658,75 @@ export type ListSessionsOptions = {
|
|
|
3797
4658
|
limit?: number;
|
|
3798
4659
|
parentSessionId?: string | null;
|
|
3799
4660
|
};
|
|
3800
|
-
export type
|
|
4661
|
+
export type SessionListSnapshotCursor = {
|
|
4662
|
+
kind: "snapshot";
|
|
3801
4663
|
snapshotId: string;
|
|
3802
4664
|
offset: number;
|
|
3803
4665
|
parentSessionFilter: string;
|
|
3804
4666
|
search: string | null;
|
|
4667
|
+
archiveMode: "active" | "archived";
|
|
4668
|
+
};
|
|
4669
|
+
export type SessionListKeysetCursor = {
|
|
4670
|
+
kind: "keyset";
|
|
4671
|
+
/** Decimal committed workspace activity revision frozen on page one. */
|
|
4672
|
+
snapshotRevision: string;
|
|
4673
|
+
/** Exact PostgreSQL timestamp text, including microseconds. */
|
|
4674
|
+
sortAt: string;
|
|
4675
|
+
id: string;
|
|
4676
|
+
parentSessionFilter: string;
|
|
4677
|
+
search: string | null;
|
|
4678
|
+
archiveMode: "active" | "archived";
|
|
3805
4679
|
};
|
|
4680
|
+
export type SessionListCursor = SessionListSnapshotCursor | SessionListKeysetCursor;
|
|
3806
4681
|
export type ListSessionsForSubjectOptions = ListSessionsOptions & {
|
|
3807
4682
|
subjectId: string;
|
|
3808
4683
|
cursor?: SessionListCursor | undefined;
|
|
3809
4684
|
search?: string | undefined;
|
|
3810
4685
|
/** Return only the complete personal pin projection; never scan/snapshot ordinary rows. */
|
|
3811
4686
|
pinsOnly?: boolean | undefined;
|
|
3812
|
-
/**
|
|
4687
|
+
/** List personally archived chats instead of active chats. */
|
|
4688
|
+
archivedOnly?: boolean | undefined;
|
|
4689
|
+
/** Return a continuation cursor. Disable for legacy one-page array reads. */
|
|
3813
4690
|
materializeSnapshot?: boolean | undefined;
|
|
3814
4691
|
authorizationScope?: SessionAuthorizationListScope | undefined;
|
|
4692
|
+
/** See {@link PersonalWorkspaceOwnerException}. Absent means "no exception". */
|
|
4693
|
+
personalWorkspaceOwnerException?: PersonalWorkspaceOwnerException | undefined;
|
|
3815
4694
|
};
|
|
4695
|
+
/**
|
|
4696
|
+
* Whether the caller may use the owner-only managed personal-workspace
|
|
4697
|
+
* exception on this request.
|
|
4698
|
+
*
|
|
4699
|
+
* A managed human's personal workspace has NO `workspace_memberships` row
|
|
4700
|
+
* (migration 0219 raises on one), so a bare membership fence denies the one
|
|
4701
|
+
* human who always belongs. The `organization_memberships.personal_workspace_id`
|
|
4702
|
+
* pointer is their whole grant, and
|
|
4703
|
+
* {@link subjectHasLiveWorkspaceAuthorityInScope} is the single resolver for it.
|
|
4704
|
+
*
|
|
4705
|
+
* **This flag is the authorization.** The resolver it gates is not: it answers
|
|
4706
|
+
* "does subject X hold authority here" and establishes nothing about who the
|
|
4707
|
+
* caller is. The exception is for "the canonical managed-cookie (Better Auth)
|
|
4708
|
+
* session" only — "Bearer/delegated principals, API keys, and account or
|
|
4709
|
+
* organization administrators receive no personal-workspace access through that
|
|
4710
|
+
* exception" — and a host-signed delegated bearer chooses its own `subjectId`,
|
|
4711
|
+
* `principalKind`, `metadata.delegated`, and `serviceInitiator` claims, so no
|
|
4712
|
+
* inspection of the grant can carry that distinction. Set this ONLY from
|
|
4713
|
+
* `AccessGrantAuthorization.canonicalManagedHumanSession` (`@opengeni/core`),
|
|
4714
|
+
* which reflects HOW the request authenticated. Omitted/false keeps the
|
|
4715
|
+
* historical bare-membership fence exactly.
|
|
4716
|
+
*/
|
|
4717
|
+
export type PersonalWorkspaceOwnerException = boolean;
|
|
3816
4718
|
export declare class SessionPinVersionConflictError extends Error {
|
|
3817
4719
|
readonly current: Pick<Session, "pinned" | "pinnedAt" | "pinVersion">;
|
|
3818
4720
|
constructor(current: Pick<Session, "pinned" | "pinnedAt" | "pinVersion">);
|
|
3819
4721
|
}
|
|
4722
|
+
export declare class SessionAttentionVersionConflictError extends Error {
|
|
4723
|
+
readonly current: Pick<Session, "unread" | "activelyWorking" | "attentionVersion">;
|
|
4724
|
+
constructor(current: Pick<Session, "unread" | "activelyWorking" | "attentionVersion">);
|
|
4725
|
+
}
|
|
4726
|
+
export declare class SessionArchiveVersionConflictError extends Error {
|
|
4727
|
+
readonly current: Pick<Session, "archived" | "archivedAt" | "archiveVersion">;
|
|
4728
|
+
constructor(current: Pick<Session, "archived" | "archivedAt" | "archiveVersion">);
|
|
4729
|
+
}
|
|
3820
4730
|
export declare class SessionListCursorError extends Error {
|
|
3821
4731
|
constructor(message?: string);
|
|
3822
4732
|
}
|
|
@@ -3826,9 +4736,6 @@ export declare class SessionListCursorExpiredError extends Error {
|
|
|
3826
4736
|
export declare class SessionListAccessError extends Error {
|
|
3827
4737
|
constructor(message?: string);
|
|
3828
4738
|
}
|
|
3829
|
-
export declare class SessionListSnapshotLimitError extends Error {
|
|
3830
|
-
constructor(message?: string);
|
|
3831
|
-
}
|
|
3832
4739
|
export declare class SessionPinAccessError extends Error {
|
|
3833
4740
|
constructor(message?: string);
|
|
3834
4741
|
}
|
|
@@ -3850,7 +4757,15 @@ export declare function projectSessionForRelatedAccess(session: Session, access:
|
|
|
3850
4757
|
* fixed node/depth budget. `truncated=true` makes every count an explicit lower
|
|
3851
4758
|
* bound when a deep, wide, overlapping, or cyclic graph reaches that budget.
|
|
3852
4759
|
*/
|
|
3853
|
-
export declare function sessionTreeStatsForSessions(db: Database, workspaceId: string, rootIds: string[]): Promise<Map<string, SessionTreeStats>>;
|
|
4760
|
+
export declare function sessionTreeStatsForSessions(db: Database, workspaceId: string, rootIds: string[], subjectId?: string): Promise<Map<string, SessionTreeStats>>;
|
|
4761
|
+
/**
|
|
4762
|
+
* When each given `requires_action` session's own open turn entered that
|
|
4763
|
+
* state: the oldest still-open `requires_action` turn per session. Only the
|
|
4764
|
+
* ids whose current status is `requires_action` should be passed; the lookup
|
|
4765
|
+
* walks `session_turns_workspace_queue_idx` per session and returns no row
|
|
4766
|
+
* for sessions with no such turn.
|
|
4767
|
+
*/
|
|
4768
|
+
export declare function sessionRequiresActionSinceForSessions(db: Database, workspaceId: string, sessionIds: readonly string[]): Promise<Map<string, string>>;
|
|
3854
4769
|
/**
|
|
3855
4770
|
* Convert the embedding host's complete list scope into a workspace-bound SQL
|
|
3856
4771
|
* predicate. Root scopes include every descendant through the durable parent
|
|
@@ -3858,9 +4773,16 @@ export declare function sessionTreeStatsForSessions(db: Database, workspaceId: s
|
|
|
3858
4773
|
* `UNION ALL`) makes legacy cycles terminate without a caller-sized path array.
|
|
3859
4774
|
*/
|
|
3860
4775
|
export declare function sessionAuthorizationScopeFilter(scope: SessionAuthorizationListScope): SQL;
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
4776
|
+
/**
|
|
4777
|
+
* The reserved slot a session-visibility transition leaves behind when it strips
|
|
4778
|
+
* a now-`user_private` session identity out of another subject's cached page
|
|
4779
|
+
* (migration 0301). Replacing rather than removing the slot keeps snapshot
|
|
4780
|
+
* cardinality and every in-flight cursor offset byte-stable; `gen_random_uuid()`
|
|
4781
|
+
* never emits the nil UUID, so the slot resolves to no session and the hydration
|
|
4782
|
+
* below drops it exactly as it already drops a row RLS hid between pages.
|
|
4783
|
+
*/
|
|
4784
|
+
export declare const SESSION_LIST_SNAPSHOT_REDACTED_SESSION_ID = "00000000-0000-0000-0000-000000000000";
|
|
4785
|
+
/** Opaque, URL-safe cursor encoding for bounded session-list pagination. */
|
|
3864
4786
|
export declare function encodeSessionListCursor(cursor: SessionListCursor): string;
|
|
3865
4787
|
/** Decode and validate a cursor before it reaches any SQL predicate. */
|
|
3866
4788
|
export declare function decodeSessionListCursor(value: string): SessionListCursor | null;
|
|
@@ -3869,10 +4791,11 @@ export declare function reapExpiredSessionListSnapshots(db: Database, limit?: nu
|
|
|
3869
4791
|
/**
|
|
3870
4792
|
* Server-authoritative member-specific page. Pinned rows are returned separately
|
|
3871
4793
|
* and omitted from ordinary pages, so list pagination cannot duplicate a
|
|
3872
|
-
* session.
|
|
3873
|
-
*
|
|
3874
|
-
*
|
|
3875
|
-
*
|
|
4794
|
+
* session. New pages use a bounded activity-revision keyset: page one freezes
|
|
4795
|
+
* the committed workspace revision and every continuation reads only `limit +
|
|
4796
|
+
* 1` candidate ids. Legacy short-lived snapshot cursors remain readable during
|
|
4797
|
+
* rolling upgrades, while hydration always joins live rows for current
|
|
4798
|
+
* lifecycle/title and authorization data.
|
|
3876
4799
|
*/
|
|
3877
4800
|
export declare function listSessionsForSubject(db: Database, workspaceId: string, options: ListSessionsForSubjectOptions): Promise<SessionListResponse>;
|
|
3878
4801
|
/** Read a session with the caller subject's personal pin projection. */
|
|
@@ -3889,6 +4812,34 @@ export declare function setSessionPin(db: Database, input: {
|
|
|
3889
4812
|
sessionId: string;
|
|
3890
4813
|
pinned: boolean;
|
|
3891
4814
|
expectedVersion?: number | undefined;
|
|
4815
|
+
/** See {@link PersonalWorkspaceOwnerException}. Absent means "no exception". */
|
|
4816
|
+
personalWorkspaceOwnerException?: PersonalWorkspaceOwnerException | undefined;
|
|
4817
|
+
}): Promise<Session | null>;
|
|
4818
|
+
/**
|
|
4819
|
+
* Idempotently update one member's explicit follow-up state. Route reads remain
|
|
4820
|
+
* side-effect free: a foreground client acknowledges its exact rendered event
|
|
4821
|
+
* frontier through this mutation, and later durable events remain unread.
|
|
4822
|
+
*/
|
|
4823
|
+
export declare function setSessionAttention(db: Database, input: {
|
|
4824
|
+
workspaceId: string;
|
|
4825
|
+
subjectId: string;
|
|
4826
|
+
sessionId: string;
|
|
4827
|
+
unread?: boolean | undefined;
|
|
4828
|
+
acknowledgedThroughSequence?: number | undefined;
|
|
4829
|
+
activelyWorking?: boolean | undefined;
|
|
4830
|
+
expectedVersion?: number | undefined;
|
|
4831
|
+
}): Promise<Session | null>;
|
|
4832
|
+
/**
|
|
4833
|
+
* Archive or restore one root chat for a single member. Archiving also removes
|
|
4834
|
+
* personal pin/follow-up labels so hidden work cannot remain in active rail
|
|
4835
|
+
* sections. Descendants inherit visibility from the archived root at list time.
|
|
4836
|
+
*/
|
|
4837
|
+
export declare function setSessionArchive(db: Database, input: {
|
|
4838
|
+
workspaceId: string;
|
|
4839
|
+
subjectId: string;
|
|
4840
|
+
sessionId: string;
|
|
4841
|
+
archived: boolean;
|
|
4842
|
+
expectedVersion?: number | undefined;
|
|
3892
4843
|
}): Promise<Session | null>;
|
|
3893
4844
|
export declare function listSessions(db: Database, workspaceId: string, limit?: number): Promise<Session[]>;
|
|
3894
4845
|
export declare function listSessions(db: Database, workspaceId: string, options?: ListSessionsOptions): Promise<Session[]>;
|
|
@@ -4022,6 +4973,15 @@ export type ListSessionEventsOptions = {
|
|
|
4022
4973
|
includeClasses?: readonly SessionEventSemanticClass[];
|
|
4023
4974
|
excludeClasses?: readonly SessionEventSemanticClass[];
|
|
4024
4975
|
defaultExcludeTypes?: readonly SessionEventType[];
|
|
4976
|
+
/**
|
|
4977
|
+
* Agent-monitoring conversation boundary: omit a human/API `user.message`
|
|
4978
|
+
* whose accepted turn was never claimed (`session_turns.started_at IS NULL`),
|
|
4979
|
+
* whether it is still queued or reached a terminal state before any claim.
|
|
4980
|
+
* The row appears at its own sequence once the turn is claimed. Forensic,
|
|
4981
|
+
* SSE, and REST readers leave this unset so the retained event log stays
|
|
4982
|
+
* exact.
|
|
4983
|
+
*/
|
|
4984
|
+
excludeUnclaimedHumanPrompts?: boolean;
|
|
4025
4985
|
payloadMode?: SessionEventPayloadMode;
|
|
4026
4986
|
/**
|
|
4027
4987
|
* Internal exclusive-latest selector. Eligible legacy rows with a null
|
|
@@ -4064,6 +5024,8 @@ export declare function listSessionEvents(db: Database, workspaceId: string, ses
|
|
|
4064
5024
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, after: number, limit?: number): Promise<SessionEvent[]>;
|
|
4065
5025
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, options: ListSessionEventsOptions): Promise<SessionEvent[]>;
|
|
4066
5026
|
export declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
|
|
5027
|
+
/** Read one durable event under the exact human subject visibility projection. */
|
|
5028
|
+
export declare function getSessionEventForSubject(db: Database, workspaceId: string, subjectId: string, eventId: string): Promise<SessionEvent | null>;
|
|
4067
5029
|
export declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
|
|
4068
5030
|
export declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
|
|
4069
5031
|
/**
|
|
@@ -4140,6 +5102,8 @@ export declare function acceptSessionHumanInputResponse(db: Database, input: {
|
|
|
4140
5102
|
requestId: string;
|
|
4141
5103
|
response: unknown;
|
|
4142
5104
|
respondedBy: string;
|
|
5105
|
+
/** Bounded responder kind for the parent's resolution notice; derived from `respondedBy` when omitted. */
|
|
5106
|
+
respondedByKind?: ChildRequiresActionRespondedByKind;
|
|
4143
5107
|
clientEventId?: string | null;
|
|
4144
5108
|
expireOnly?: boolean;
|
|
4145
5109
|
}): Promise<AcceptSessionHumanInputResponseResult>;
|
|
@@ -4155,6 +5119,43 @@ export declare function getHumanInputResumeForEvent(db: Database, workspaceId: s
|
|
|
4155
5119
|
response: HumanInputResponse;
|
|
4156
5120
|
} | null>;
|
|
4157
5121
|
export type TurnAttemptFenceRejectReason = "workspace_paused" | "session_paused" | "pending_control" | "active_turn_changed" | "generation_changed" | "attempt_changed" | "turn_terminal" | "not_found";
|
|
5122
|
+
export declare class SessionBackgroundCommandAdoptionFencedError extends Error {
|
|
5123
|
+
readonly reason: TurnAttemptFenceRejectReason;
|
|
5124
|
+
readonly name = "SessionBackgroundCommandAdoptionFencedError";
|
|
5125
|
+
constructor(reason: TurnAttemptFenceRejectReason);
|
|
5126
|
+
}
|
|
5127
|
+
/** Transfer one exact Connected Machine operation from a live turn attempt to
|
|
5128
|
+
* its session. The canonical write fence gives adoption a total order with
|
|
5129
|
+
* Steer, session/workspace Pause, terminal Cancel, and quiescent tree deletion:
|
|
5130
|
+
* an earlier adoption is visible to later control, while earlier control makes
|
|
5131
|
+
* this stale attempt fail before a session-owned row can appear. */
|
|
5132
|
+
export declare function adoptConnectedMachineSessionBackgroundCommand(db: Database, input: {
|
|
5133
|
+
accountId: string;
|
|
5134
|
+
workspaceId: string;
|
|
5135
|
+
sessionId: string;
|
|
5136
|
+
turnId: string;
|
|
5137
|
+
executionGeneration: number;
|
|
5138
|
+
attemptId: string;
|
|
5139
|
+
commandId: string;
|
|
5140
|
+
controlWorkspaceId: string;
|
|
5141
|
+
enrollmentId: string;
|
|
5142
|
+
connectionInstanceId: string;
|
|
5143
|
+
opId: string;
|
|
5144
|
+
command: string;
|
|
5145
|
+
}): Promise<{
|
|
5146
|
+
id: string;
|
|
5147
|
+
workspaceId: string;
|
|
5148
|
+
sessionId: string;
|
|
5149
|
+
provider: "connected_machine" | "managed";
|
|
5150
|
+
state: "exited" | "lost" | "running" | "stopping";
|
|
5151
|
+
commandPreview: string;
|
|
5152
|
+
cancelRequestedAt: string | null;
|
|
5153
|
+
exitCode: number | null;
|
|
5154
|
+
settlementReason: string | null;
|
|
5155
|
+
startedAt: string;
|
|
5156
|
+
settledAt: string | null;
|
|
5157
|
+
updatedAt: string;
|
|
5158
|
+
}>;
|
|
4158
5159
|
export type InstallOrReadTurnExecutionPolicyForAttemptResult = {
|
|
4159
5160
|
accepted: true;
|
|
4160
5161
|
installed: boolean;
|
|
@@ -4235,6 +5236,32 @@ export declare function recordPendingSessionToolCallResult(db: Database, input:
|
|
|
4235
5236
|
accepted: boolean;
|
|
4236
5237
|
recorded: boolean;
|
|
4237
5238
|
}>;
|
|
5239
|
+
export type OpenSuffixInterruptionKind = "human_input" | "approval" | "interaction_intervention";
|
|
5240
|
+
export type OpenSuffixPendingToolCall = {
|
|
5241
|
+
callId: string;
|
|
5242
|
+
callType: string;
|
|
5243
|
+
callItem: Record<string, unknown>;
|
|
5244
|
+
interruptionKind: OpenSuffixInterruptionKind;
|
|
5245
|
+
tiedReasoningItems: Array<Record<string, unknown>>;
|
|
5246
|
+
resultItem: Record<string, unknown> | null;
|
|
5247
|
+
modelToolOutputTruncationTokens: number | null;
|
|
5248
|
+
};
|
|
5249
|
+
/**
|
|
5250
|
+
* Bind unpaired interruption calls and their tied reasoning onto existing
|
|
5251
|
+
* pending receipts. Fail closed when any interruption call is missing.
|
|
5252
|
+
*/
|
|
5253
|
+
export declare function attachOpenSuffixToPendingToolCalls(db: Database, input: Omit<PendingSessionToolCallInput, "callId" | "callType" | "callItem"> & {
|
|
5254
|
+
members: Array<{
|
|
5255
|
+
callId: string;
|
|
5256
|
+
interruptionKind: OpenSuffixInterruptionKind;
|
|
5257
|
+
reasoningItems: Array<Record<string, unknown>>;
|
|
5258
|
+
}>;
|
|
5259
|
+
}): Promise<{
|
|
5260
|
+
accepted: boolean;
|
|
5261
|
+
attached: number;
|
|
5262
|
+
}>;
|
|
5263
|
+
/** Turn-scoped interruption suffix rows, including already-settled members. */
|
|
5264
|
+
export declare function listTurnOpenSuffixToolCalls(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<OpenSuffixPendingToolCall[]>;
|
|
4238
5265
|
/**
|
|
4239
5266
|
* Remove completed receipts only after the full SDK call/result batch is
|
|
4240
5267
|
* durable. Until then every raw result remains available to an attempt-ending
|
|
@@ -4792,6 +5819,12 @@ export interface AcquireLeaseInput {
|
|
|
4792
5819
|
kind: LeaseHolderKind;
|
|
4793
5820
|
holderId: string;
|
|
4794
5821
|
subjectId?: string | null;
|
|
5822
|
+
/** Viewer holders only (0281): the authenticated viewer subject recorded on
|
|
5823
|
+
* the holder row - identity only, never a secret value. */
|
|
5824
|
+
viewerSubjectId?: string;
|
|
5825
|
+
/** Viewer holders only (0281): the session authority epoch observed at
|
|
5826
|
+
* attach, mirrored into the scoped stream token's claims. */
|
|
5827
|
+
viewerAuthorityEpoch?: number;
|
|
4795
5828
|
backend: string;
|
|
4796
5829
|
os?: string;
|
|
4797
5830
|
image?: string | null;
|
|
@@ -5406,6 +6439,29 @@ export declare function releaseLeaseHolder(db: Database, input: {
|
|
|
5406
6439
|
liveness: SandboxLeaseLiveness;
|
|
5407
6440
|
refcount: number;
|
|
5408
6441
|
} | null>;
|
|
6442
|
+
export type LeaseHolderHeartbeatFence = "unsupported_kind" | "lease_missing" | "holder_gone" | "epoch" | "liveness" | "rotation_requested";
|
|
6443
|
+
export type LeaseHolderHeartbeatStatus = {
|
|
6444
|
+
holderAlive: false;
|
|
6445
|
+
leaseExtended: false;
|
|
6446
|
+
fence: "unsupported_kind" | "lease_missing" | "holder_gone";
|
|
6447
|
+
} | {
|
|
6448
|
+
holderAlive: true;
|
|
6449
|
+
leaseExtended: true;
|
|
6450
|
+
fence: null;
|
|
6451
|
+
} | {
|
|
6452
|
+
holderAlive: true;
|
|
6453
|
+
leaseExtended: false;
|
|
6454
|
+
fence: "epoch" | "liveness" | "rotation_requested";
|
|
6455
|
+
};
|
|
6456
|
+
export declare function heartbeatLeaseHolderStatus(db: Database, input: {
|
|
6457
|
+
accountId: string;
|
|
6458
|
+
workspaceId: string;
|
|
6459
|
+
sandboxGroupId: string;
|
|
6460
|
+
kind: LeaseHolderKind;
|
|
6461
|
+
holderId: string;
|
|
6462
|
+
leaseTtlMs: number;
|
|
6463
|
+
expectedEpoch: number;
|
|
6464
|
+
}): Promise<LeaseHolderHeartbeatStatus>;
|
|
5409
6465
|
export declare function heartbeatLeaseHolder(db: Database, input: {
|
|
5410
6466
|
accountId: string;
|
|
5411
6467
|
workspaceId: string;
|
|
@@ -5415,6 +6471,37 @@ export declare function heartbeatLeaseHolder(db: Database, input: {
|
|
|
5415
6471
|
leaseTtlMs: number;
|
|
5416
6472
|
expectedEpoch: number;
|
|
5417
6473
|
}): Promise<boolean>;
|
|
6474
|
+
export type ReinstateTurnLeaseHolderResult = {
|
|
6475
|
+
status: "present" | "reinstated";
|
|
6476
|
+
lease: LeaseSnapshot;
|
|
6477
|
+
} | {
|
|
6478
|
+
status: "lease_missing" | "lease_fenced" | "capture_in_progress" | "reaper_held" | "attempt_fenced";
|
|
6479
|
+
};
|
|
6480
|
+
/**
|
|
6481
|
+
* Defense in depth for the orderly provider-deadline rotation checkpoint: put the
|
|
6482
|
+
* exact canonical turn holder back onto the lease it is still physically using.
|
|
6483
|
+
* The warm capture claim requires exactly this holder, so a holder lost while
|
|
6484
|
+
* the attempt is still the active writer (a stale release, a reap race) would
|
|
6485
|
+
* otherwise silently disable the rotation checkpoint and let the reaper
|
|
6486
|
+
* terminate the box under the running turn.
|
|
6487
|
+
*
|
|
6488
|
+
* Fenced hard: the lease must still be the established epoch and provider
|
|
6489
|
+
* instance, carry no capture/teardown claim and no active reaper hold, and the
|
|
6490
|
+
* attempt must still be the turn's active `claimed`/`running` writer on a
|
|
6491
|
+
* session of this group. A draining lease that passes those fences re-arms to
|
|
6492
|
+
* warm exactly like a late arrival in `acquireLease`; a cold or superseded lease
|
|
6493
|
+
* is never touched. Idempotent: an existing holder is reported `present`.
|
|
6494
|
+
*/
|
|
6495
|
+
export declare function reinstateTurnLeaseHolder(db: Database, input: {
|
|
6496
|
+
accountId: string;
|
|
6497
|
+
workspaceId: string;
|
|
6498
|
+
sandboxGroupId: string;
|
|
6499
|
+
sessionId: string;
|
|
6500
|
+
attemptId: string;
|
|
6501
|
+
expectedEpoch: number;
|
|
6502
|
+
expectedInstanceId: string;
|
|
6503
|
+
leaseTtlMs: number;
|
|
6504
|
+
}): Promise<ReinstateTurnLeaseHolderResult>;
|
|
5418
6505
|
/**
|
|
5419
6506
|
* HOLDER-LIVENESS touch: refresh ONLY this holder's last_heartbeat_at. The
|
|
5420
6507
|
* warmup phase of a turn (acquire -> waitForWarm -> establish/cold-restore ->
|
|
@@ -5509,9 +6596,9 @@ export declare function confirmDrainCold(db: Database, input: {
|
|
|
5509
6596
|
wentCold: boolean;
|
|
5510
6597
|
}>;
|
|
5511
6598
|
export declare class SandboxWorkspaceMutationFencedError extends Error {
|
|
5512
|
-
readonly code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "capture_in_progress" | "admission_fenced" | "operation_invalid" | "generation_exhausted";
|
|
6599
|
+
readonly code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "rotation_in_progress" | "route_fenced" | "process_fenced" | "capture_in_progress" | "admission_fenced" | "operation_invalid" | "generation_exhausted" | "authority_unattributed" | "authority_revoked";
|
|
5513
6600
|
readonly name: string;
|
|
5514
|
-
constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "capture_in_progress" | "admission_fenced" | "operation_invalid" | "generation_exhausted", message: string);
|
|
6601
|
+
constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "rotation_in_progress" | "route_fenced" | "process_fenced" | "capture_in_progress" | "admission_fenced" | "operation_invalid" | "generation_exhausted" | "authority_unattributed" | "authority_revoked", message: string);
|
|
5515
6602
|
}
|
|
5516
6603
|
export type SandboxWorkspaceMutationAdmission = {
|
|
5517
6604
|
id: string;
|
|
@@ -5605,7 +6692,7 @@ export declare function retainedProcessReconciliationProof(process: SandboxRetai
|
|
|
5605
6692
|
export declare class SandboxRetainedProcessPromotionFencedError extends SandboxWorkspaceMutationFencedError {
|
|
5606
6693
|
readonly process: SandboxRetainedProcess;
|
|
5607
6694
|
readonly name = "SandboxRetainedProcessPromotionFencedError";
|
|
5608
|
-
constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced", message: string, process: SandboxRetainedProcess);
|
|
6695
|
+
constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "authority_unattributed" | "authority_revoked", message: string, process: SandboxRetainedProcess);
|
|
5609
6696
|
}
|
|
5610
6697
|
/**
|
|
5611
6698
|
* Advance the live workspace's mutation generation before an acknowledged
|
|
@@ -5631,6 +6718,11 @@ export declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
|
5631
6718
|
captureWaitMs?: number;
|
|
5632
6719
|
/** Cancel the bounded transition wait without creating an admission. */
|
|
5633
6720
|
waitSignal?: AbortSignal;
|
|
6721
|
+
/** Observe only time actually spent blocked behind an archive capture. */
|
|
6722
|
+
onCaptureWait?: (observation: {
|
|
6723
|
+
durationMs: number;
|
|
6724
|
+
outcome: "completed" | "failed";
|
|
6725
|
+
}) => void;
|
|
5634
6726
|
/** Active-routed mutations bind to the exact session pointer. Omitted means
|
|
5635
6727
|
* an intentional home-provider write outside the routing surface. */
|
|
5636
6728
|
routeKind?: "home" | "active";
|
|
@@ -5639,13 +6731,17 @@ export declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
|
5639
6731
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
5640
6732
|
/** Admit an API/direct mutation under an exact request holder and active route.
|
|
5641
6733
|
* Direct actors intentionally have no turn identity and can never inherit the
|
|
5642
|
-
* attempt-quiescence archive fallback.
|
|
6734
|
+
* attempt-quiescence archive fallback. `initiatorSubjectId` is the exact
|
|
6735
|
+
* authenticated principal behind the request and is required: it is this
|
|
6736
|
+
* writer's only causal identity, and it is re-proved against the live grant
|
|
6737
|
+
* inside the admission transaction. */
|
|
5643
6738
|
export declare function advanceWorkspaceGenerationForDirectRequest(db: Database, input: {
|
|
5644
6739
|
accountId: string;
|
|
5645
6740
|
workspaceId: string;
|
|
5646
6741
|
sessionId: string;
|
|
5647
6742
|
requestId: string;
|
|
5648
6743
|
holderId: string;
|
|
6744
|
+
initiatorSubjectId: string;
|
|
5649
6745
|
sandboxGroupId: string;
|
|
5650
6746
|
expectedEpoch: number;
|
|
5651
6747
|
expectedInstanceId: string;
|
|
@@ -5698,6 +6794,7 @@ export declare function verifyDirectWorkspaceMutationSettlement(db: Database, in
|
|
|
5698
6794
|
sessionId: string;
|
|
5699
6795
|
requestId: string;
|
|
5700
6796
|
holderId: string;
|
|
6797
|
+
initiatorSubjectId: string;
|
|
5701
6798
|
sandboxGroupId: string;
|
|
5702
6799
|
expectedEpoch: number;
|
|
5703
6800
|
expectedInstanceId: string;
|
|
@@ -5732,6 +6829,10 @@ export declare function retainWorkspaceMutationProcess(db: Database, input: {
|
|
|
5732
6829
|
key: string;
|
|
5733
6830
|
binding: ModalCheckpointProviderBinding;
|
|
5734
6831
|
} | null;
|
|
6832
|
+
backgroundCommand?: {
|
|
6833
|
+
commandId: string;
|
|
6834
|
+
command: string;
|
|
6835
|
+
};
|
|
5735
6836
|
owner: {
|
|
5736
6837
|
kind: "turn";
|
|
5737
6838
|
turnId: string;
|
|
@@ -5748,6 +6849,7 @@ export declare function retainWorkspaceMutationProcess(db: Database, input: {
|
|
|
5748
6849
|
kind: "direct";
|
|
5749
6850
|
requestId: string;
|
|
5750
6851
|
holderId: string;
|
|
6852
|
+
initiatorSubjectId: string;
|
|
5751
6853
|
sandboxGroupId: string;
|
|
5752
6854
|
expectedEpoch: number;
|
|
5753
6855
|
expectedInstanceId: string;
|
|
@@ -5763,7 +6865,8 @@ export declare function getRetainedProcess(db: Database, input: {
|
|
|
5763
6865
|
processId: string;
|
|
5764
6866
|
}): Promise<SandboxRetainedProcess | null>;
|
|
5765
6867
|
/** Claim a bounded, oldest-due batch of active retained processes whose exact
|
|
5766
|
-
* owner attempt is closed
|
|
6868
|
+
* owner attempt is closed, whose direct request returned, or whose lifecycle
|
|
6869
|
+
* was explicitly transferred to a session background command. Claim
|
|
5767
6870
|
* expiry only recovers coordination after worker death; it is never provider
|
|
5768
6871
|
* exit proof. Rows that settle between the global claim and scoped read are
|
|
5769
6872
|
* deliberately omitted. */
|
|
@@ -6119,10 +7222,13 @@ export declare function persistDrainSnapshot(db: Database, input: {
|
|
|
6119
7222
|
workspaceArchiveMeta?: never;
|
|
6120
7223
|
checkpointArtifactId?: never;
|
|
6121
7224
|
} | {
|
|
6122
|
-
/** Base64 provider receipt or tar archive from the verified runtime capture.
|
|
6123
|
-
|
|
7225
|
+
/** Base64 provider receipt or tar archive from the verified runtime capture.
|
|
7226
|
+
* Omit when `workspaceArchiveRef` locates object-storage bytes. */
|
|
7227
|
+
workspaceArchive?: string;
|
|
6124
7228
|
/** Exact descriptor is mandatory for every new publication. */
|
|
6125
7229
|
workspaceArchiveMeta: SandboxArchiveRevision;
|
|
7230
|
+
/** Object-storage locator for tar bytes. When set, inline bytes are omitted. */
|
|
7231
|
+
workspaceArchiveRef?: WorkspaceArchiveObjectRef | null;
|
|
6126
7232
|
/** Required for Modal-native descriptors; absent for actual tar archives. */
|
|
6127
7233
|
checkpointArtifactId?: string | null;
|
|
6128
7234
|
})): Promise<{
|
|
@@ -6154,6 +7260,7 @@ export declare function rotateWorkspaceArchives(input: {
|
|
|
6154
7260
|
}): {
|
|
6155
7261
|
previousArchive: string | null;
|
|
6156
7262
|
previousArchiveMeta: SandboxArchiveRevision | null;
|
|
7263
|
+
previousArchiveRef: WorkspaceArchiveObjectRef | null;
|
|
6157
7264
|
};
|
|
6158
7265
|
/**
|
|
6159
7266
|
* MID-SESSION /workspace snapshot fold (sandbox-file-persistence). The WARM
|
|
@@ -6177,10 +7284,13 @@ export declare function persistWarmSnapshot(db: Database, input: {
|
|
|
6177
7284
|
expectedInstanceId: string;
|
|
6178
7285
|
expectedWorkspaceGeneration: number;
|
|
6179
7286
|
captureId: string;
|
|
6180
|
-
/** base64 of the provider snapshot-ref / tar archive from persistWorkspace().
|
|
6181
|
-
|
|
7287
|
+
/** base64 of the provider snapshot-ref / tar archive from persistWorkspace().
|
|
7288
|
+
* Omit when `workspaceArchiveRef` locates object-storage bytes. */
|
|
7289
|
+
workspaceArchive?: string;
|
|
6182
7290
|
/** Exact verified archive/tree descriptor produced by the runtime capture. */
|
|
6183
7291
|
workspaceArchiveMeta: SandboxArchiveRevision;
|
|
7292
|
+
/** Object-storage locator for tar bytes. When set, inline bytes are omitted. */
|
|
7293
|
+
workspaceArchiveRef?: WorkspaceArchiveObjectRef | null;
|
|
6184
7294
|
checkpointArtifactId?: string | null;
|
|
6185
7295
|
/** Snapshots newer than this many ms are kept (throttle); 0 = always write. */
|
|
6186
7296
|
minIntervalMs: number;
|
|
@@ -6366,10 +7476,29 @@ export type SandboxKind = (typeof schema.sandboxKindValues)[number];
|
|
|
6366
7476
|
export type EnrollmentExposure = (typeof schema.enrollmentExposureValues)[number];
|
|
6367
7477
|
export type EnrollmentStatus = (typeof schema.enrollmentStatusValues)[number];
|
|
6368
7478
|
export type EnrollmentOs = (typeof schema.enrollmentOsValues)[number];
|
|
7479
|
+
export type AgentUpdateStatus = (typeof schema.agentUpdateStatusValues)[number];
|
|
7480
|
+
export type EnrollmentAgentUpdateRecord = {
|
|
7481
|
+
operationId: string;
|
|
7482
|
+
status: AgentUpdateStatus;
|
|
7483
|
+
targetVersion: string;
|
|
7484
|
+
expectedBinarySha256: string | null;
|
|
7485
|
+
errorCode: string | null;
|
|
7486
|
+
retryable: boolean;
|
|
7487
|
+
rolledBack: boolean;
|
|
7488
|
+
connectionInstanceId: string;
|
|
7489
|
+
connectionGeneration: number;
|
|
7490
|
+
requestedAt: string;
|
|
7491
|
+
updatedAt: string;
|
|
7492
|
+
completedAt: string | null;
|
|
7493
|
+
};
|
|
6369
7494
|
export type EnrollmentRecord = {
|
|
6370
7495
|
id: string;
|
|
6371
7496
|
accountId: string;
|
|
6372
7497
|
workspaceId: string;
|
|
7498
|
+
scope: "organization" | "workspace" | "user";
|
|
7499
|
+
generation: number;
|
|
7500
|
+
sandboxId?: string | null;
|
|
7501
|
+
sandboxName?: string | null;
|
|
6373
7502
|
pubkey: string;
|
|
6374
7503
|
exposure: EnrollmentExposure;
|
|
6375
7504
|
hasDisplay: boolean;
|
|
@@ -6378,10 +7507,28 @@ export type EnrollmentRecord = {
|
|
|
6378
7507
|
* not granted); null when capture is permitted or the machine is headless. */
|
|
6379
7508
|
desktopUnavailableReason: string | null;
|
|
6380
7509
|
allowScreenControl: boolean;
|
|
7510
|
+
operationPolicy: {
|
|
7511
|
+
memoryMaxBytes: number | null;
|
|
7512
|
+
memoryHighBytes: number | null;
|
|
7513
|
+
cpuMaxMillicores: number | null;
|
|
7514
|
+
revision: number;
|
|
7515
|
+
updatedAt: string | null;
|
|
7516
|
+
};
|
|
6381
7517
|
status: EnrollmentStatus;
|
|
6382
7518
|
credentialGeneration: number;
|
|
7519
|
+
/** Exact live runner instance receiving this machine's control traffic. */
|
|
7520
|
+
connectionInstanceId: string | null;
|
|
7521
|
+
/** Monotonic authority generation, advanced only when a different runner claims. */
|
|
7522
|
+
connectionGeneration: number;
|
|
7523
|
+
/** Server-clock expiry for the live runner claim. */
|
|
7524
|
+
connectionLeaseExpiresAt: string | null;
|
|
7525
|
+
/** Valid competing processes denied while another runner held authority. */
|
|
7526
|
+
connectionDuplicateDeniedCount: number;
|
|
7527
|
+
connectionDuplicateDeniedAt: string | null;
|
|
6383
7528
|
os: EnrollmentOs;
|
|
6384
7529
|
arch: string;
|
|
7530
|
+
/** Exact absolute launch root last reported by an authoritative runner Hello. */
|
|
7531
|
+
workspaceRoot: string | null;
|
|
6385
7532
|
lastSeenAt: string | null;
|
|
6386
7533
|
/** When the machine announced a clean GoingOffline; the liveness derivation reads
|
|
6387
7534
|
* an un-cleared marker as offline immediately. NULL ⇒ no goodbye pending. */
|
|
@@ -6389,6 +7536,11 @@ export type EnrollmentRecord = {
|
|
|
6389
7536
|
/** The typed reason string of the pending clean going-offline (e.g.
|
|
6390
7537
|
* GOING_OFFLINE_REASON_UPDATE); NULL when there is no un-cleared marker. */
|
|
6391
7538
|
wentOfflineReason: string | null;
|
|
7539
|
+
agentVersion: string | null;
|
|
7540
|
+
agentBinarySha256: string | null;
|
|
7541
|
+
agentUpdateChannel: "stable" | "beta" | null;
|
|
7542
|
+
agentCapabilities: Record<string, boolean>;
|
|
7543
|
+
agentUpdate: EnrollmentAgentUpdateRecord | null;
|
|
6392
7544
|
createdAt: string;
|
|
6393
7545
|
revokedAt: string | null;
|
|
6394
7546
|
updatedAt: string;
|
|
@@ -6400,6 +7552,8 @@ export type SandboxRecord = {
|
|
|
6400
7552
|
kind: SandboxKind;
|
|
6401
7553
|
name: string;
|
|
6402
7554
|
enrollmentId: string | null;
|
|
7555
|
+
scope?: "organization" | "workspace" | "user";
|
|
7556
|
+
generation?: number;
|
|
6403
7557
|
createdAt: string;
|
|
6404
7558
|
updatedAt: string;
|
|
6405
7559
|
};
|
|
@@ -6413,8 +7567,117 @@ export declare function createEnrollment(db: Database, input: {
|
|
|
6413
7567
|
os?: EnrollmentOs;
|
|
6414
7568
|
arch?: string;
|
|
6415
7569
|
}): Promise<EnrollmentRecord>;
|
|
6416
|
-
export declare function getEnrollment(db: Database,
|
|
6417
|
-
|
|
7570
|
+
export declare function getEnrollment(db: Database, access: string | {
|
|
7571
|
+
accountId: string;
|
|
7572
|
+
workspaceId: string;
|
|
7573
|
+
subjectId: string;
|
|
7574
|
+
}, enrollmentId: string): Promise<EnrollmentRecord | null>;
|
|
7575
|
+
/** Read an enrollment only while its exact runner claim is live according to
|
|
7576
|
+
* PostgreSQL's clock. Callers receive capability + process identity from one
|
|
7577
|
+
* snapshot and never reinterpret lease time using an API host's wall clock. */
|
|
7578
|
+
export declare function getLiveEnrollmentConnection(db: Database, access: string | {
|
|
7579
|
+
accountId: string;
|
|
7580
|
+
workspaceId: string;
|
|
7581
|
+
subjectId: string;
|
|
7582
|
+
}, enrollmentId: string): Promise<EnrollmentRecord | null>;
|
|
7583
|
+
export declare function assertPersonalMachineForAttempt(db: Database, input: {
|
|
7584
|
+
accountId: string;
|
|
7585
|
+
workspaceId: string;
|
|
7586
|
+
subjectId: string;
|
|
7587
|
+
sessionId: string;
|
|
7588
|
+
turnId: string;
|
|
7589
|
+
attemptId: string;
|
|
7590
|
+
executionGeneration: number;
|
|
7591
|
+
enrollmentId: string;
|
|
7592
|
+
requireActiveSandbox?: boolean;
|
|
7593
|
+
}): Promise<boolean>;
|
|
7594
|
+
/** Resolve one personal Connected Machine's live runner only after the exact
|
|
7595
|
+
* accepted attempt and its immutable snapshot/current grant pass pre-use in the
|
|
7596
|
+
* same transaction and PostgreSQL snapshot. This is the last DB boundary used
|
|
7597
|
+
* immediately before a worker or one-off provider dispatch. */
|
|
7598
|
+
export declare function resolvePersonalMachineConnectionForAttempt(db: Database, input: {
|
|
7599
|
+
accountId: string;
|
|
7600
|
+
workspaceId: string;
|
|
7601
|
+
subjectId: string;
|
|
7602
|
+
sessionId: string;
|
|
7603
|
+
turnId: string;
|
|
7604
|
+
attemptId: string;
|
|
7605
|
+
executionGeneration: number;
|
|
7606
|
+
enrollmentId: string;
|
|
7607
|
+
requireActiveSandbox?: boolean;
|
|
7608
|
+
}): Promise<EnrollmentRecord | null>;
|
|
7609
|
+
export declare function authorizePersonalMachineForAttempt(db: Database, input: {
|
|
7610
|
+
accountId: string;
|
|
7611
|
+
workspaceId: string;
|
|
7612
|
+
subjectId: string;
|
|
7613
|
+
sessionId: string;
|
|
7614
|
+
turnId: string;
|
|
7615
|
+
attemptId: string;
|
|
7616
|
+
executionGeneration: number;
|
|
7617
|
+
enrollmentId: string;
|
|
7618
|
+
requireActiveSandbox?: boolean;
|
|
7619
|
+
}): Promise<boolean>;
|
|
7620
|
+
/** Revision-fenced workspace-operator update of one Connected Machine's optional
|
|
7621
|
+
* command resource policy. NULL remains unrestricted. The active-enrollment check,
|
|
7622
|
+
* CAS, mutation, and audit receipt share one RLS transaction. */
|
|
7623
|
+
export declare function updateEnrollmentOperationPolicy(db: Database, input: {
|
|
7624
|
+
accountId: string;
|
|
7625
|
+
workspaceId: string;
|
|
7626
|
+
enrollmentId: string;
|
|
7627
|
+
subjectId?: string;
|
|
7628
|
+
expectedRevision: number;
|
|
7629
|
+
memoryMaxBytes: number | null;
|
|
7630
|
+
memoryHighBytes: number | null;
|
|
7631
|
+
cpuMaxMillicores?: number | null;
|
|
7632
|
+
}): Promise<EnrollmentRecord | null>;
|
|
7633
|
+
export type EnrollmentConnectionClaim = {
|
|
7634
|
+
claimed: boolean;
|
|
7635
|
+
connectionInstanceId: string | null;
|
|
7636
|
+
connectionGeneration: number;
|
|
7637
|
+
connectionLeaseExpiresAt: string | null;
|
|
7638
|
+
};
|
|
7639
|
+
/**
|
|
7640
|
+
* Claims or renews one enrollment's exact live runner instance under the
|
|
7641
|
+
* enrollment-row lock. A second process holding the same valid bearer is denied
|
|
7642
|
+
* while the current runner heartbeats. Once the lease expires, a successor
|
|
7643
|
+
* advances the generation and receives a different NATS address; the old socket
|
|
7644
|
+
* can no longer receive operations even if its short-lived user JWT has not yet
|
|
7645
|
+
* expired.
|
|
7646
|
+
*/
|
|
7647
|
+
export declare function claimEnrollmentConnection(db: Database, input: {
|
|
7648
|
+
workspaceId: string;
|
|
7649
|
+
enrollmentId: string;
|
|
7650
|
+
credentialGeneration: number;
|
|
7651
|
+
connectionInstanceId: string;
|
|
7652
|
+
leaseMs: number;
|
|
7653
|
+
}): Promise<EnrollmentConnectionClaim>;
|
|
7654
|
+
/** Renew only the exact active runner. Stale heartbeats never extend or steal a
|
|
7655
|
+
* successor's lease. */
|
|
7656
|
+
export declare function renewEnrollmentConnection(db: Database, input: {
|
|
7657
|
+
accountId: string;
|
|
7658
|
+
workspaceId: string;
|
|
7659
|
+
enrollmentId: string;
|
|
7660
|
+
connectionInstanceId: string;
|
|
7661
|
+
leaseMs: number;
|
|
7662
|
+
}): Promise<{
|
|
7663
|
+
renewed: boolean;
|
|
7664
|
+
}>;
|
|
7665
|
+
/** Release only the exact active runner. A late goodbye from a fenced process is
|
|
7666
|
+
* ignored and cannot mark its successor offline. */
|
|
7667
|
+
export declare function releaseEnrollmentConnection(db: Database, input: {
|
|
7668
|
+
accountId: string;
|
|
7669
|
+
workspaceId: string;
|
|
7670
|
+
enrollmentId: string;
|
|
7671
|
+
connectionInstanceId: string;
|
|
7672
|
+
reason: string;
|
|
7673
|
+
}): Promise<{
|
|
7674
|
+
released: boolean;
|
|
7675
|
+
}>;
|
|
7676
|
+
export declare function listEnrollments(db: Database, access: string | {
|
|
7677
|
+
accountId: string;
|
|
7678
|
+
workspaceId: string;
|
|
7679
|
+
subjectId: string;
|
|
7680
|
+
}, options?: {
|
|
6418
7681
|
status?: EnrollmentStatus;
|
|
6419
7682
|
}): Promise<EnrollmentRecord[]>;
|
|
6420
7683
|
export type MachineRemovalOutcome = (typeof schema.machineRemovalOperationOutcomeValues)[number];
|
|
@@ -6493,6 +7756,8 @@ export declare function clearEnrollmentWentOffline(db: Database, input: {
|
|
|
6493
7756
|
accountId: string;
|
|
6494
7757
|
workspaceId: string;
|
|
6495
7758
|
enrollmentId: string;
|
|
7759
|
+
/** When present, only the exact still-live runner may clear the marker. */
|
|
7760
|
+
connectionInstanceId?: string;
|
|
6496
7761
|
}): Promise<{
|
|
6497
7762
|
cleared: boolean;
|
|
6498
7763
|
}>;
|
|
@@ -6502,6 +7767,8 @@ export declare function setEnrollmentDisplayState(db: Database, input: {
|
|
|
6502
7767
|
enrollmentId: string;
|
|
6503
7768
|
hasDisplay: boolean;
|
|
6504
7769
|
desktopUnavailableReason: string | null;
|
|
7770
|
+
/** When present, fence the update to the exact still-live runner. */
|
|
7771
|
+
connectionInstanceId?: string;
|
|
6505
7772
|
}): Promise<{
|
|
6506
7773
|
updated: boolean;
|
|
6507
7774
|
}>;
|
|
@@ -6510,6 +7777,61 @@ export declare function setEnrollmentOpStreamState(db: Database, input: {
|
|
|
6510
7777
|
workspaceId: string;
|
|
6511
7778
|
enrollmentId: string;
|
|
6512
7779
|
opStream: boolean;
|
|
7780
|
+
/** When present, fence the update to the exact still-live runner. */
|
|
7781
|
+
connectionInstanceId?: string;
|
|
7782
|
+
}): Promise<{
|
|
7783
|
+
updated: boolean;
|
|
7784
|
+
}>;
|
|
7785
|
+
/** Refresh the exact running agent build/capabilities from an authoritative
|
|
7786
|
+
* process Hello. A pending update becomes succeeded only when the successor
|
|
7787
|
+
* reports BOTH the requested version and the artifact digest selected from the
|
|
7788
|
+
* signed manifest. Merely reaching `restarting` never counts as success. */
|
|
7789
|
+
export declare function setEnrollmentAgentRuntime(db: Database, input: {
|
|
7790
|
+
accountId: string;
|
|
7791
|
+
workspaceId: string;
|
|
7792
|
+
enrollmentId: string;
|
|
7793
|
+
connectionInstanceId: string;
|
|
7794
|
+
agentVersion: string | null;
|
|
7795
|
+
binarySha256: string | null;
|
|
7796
|
+
updateChannel: "stable" | "beta" | null;
|
|
7797
|
+
capabilities: Record<string, boolean>;
|
|
7798
|
+
/** Omitted when an older or malformed Hello did not report a usable root. */
|
|
7799
|
+
workspaceRoot?: string;
|
|
7800
|
+
completedUpdate: {
|
|
7801
|
+
operationId: string;
|
|
7802
|
+
targetVersion: string;
|
|
7803
|
+
binarySha256: string;
|
|
7804
|
+
} | null;
|
|
7805
|
+
}): Promise<{
|
|
7806
|
+
updated: boolean;
|
|
7807
|
+
updateCompleted: boolean;
|
|
7808
|
+
}>;
|
|
7809
|
+
/** Atomically reserve the one process-global update slot on an exact live
|
|
7810
|
+
* runner generation. An in-flight operation is never overwritten. */
|
|
7811
|
+
export declare function beginEnrollmentAgentUpdate(db: Database, input: {
|
|
7812
|
+
accountId: string;
|
|
7813
|
+
workspaceId: string;
|
|
7814
|
+
enrollmentId: string;
|
|
7815
|
+
connectionInstanceId: string;
|
|
7816
|
+
connectionGeneration: number;
|
|
7817
|
+
operationId: string;
|
|
7818
|
+
targetVersion: string;
|
|
7819
|
+
}): Promise<EnrollmentRecord | null>;
|
|
7820
|
+
/** Fold one progress event/dispatch failure into the reserved update. Exact
|
|
7821
|
+
* operation + process authority coordinates fence stale events; monotonic rank
|
|
7822
|
+
* prevents reordered NATS delivery from regressing the UI. */
|
|
7823
|
+
export declare function advanceEnrollmentAgentUpdate(db: Database, input: {
|
|
7824
|
+
accountId: string;
|
|
7825
|
+
workspaceId: string;
|
|
7826
|
+
enrollmentId: string;
|
|
7827
|
+
connectionInstanceId: string;
|
|
7828
|
+
connectionGeneration: number;
|
|
7829
|
+
operationId: string;
|
|
7830
|
+
status: Exclude<AgentUpdateStatus, "requested" | "succeeded">;
|
|
7831
|
+
expectedBinarySha256?: string | null;
|
|
7832
|
+
errorCode?: string | null;
|
|
7833
|
+
retryable?: boolean;
|
|
7834
|
+
rolledBack?: boolean;
|
|
6513
7835
|
}): Promise<{
|
|
6514
7836
|
updated: boolean;
|
|
6515
7837
|
}>;
|
|
@@ -6572,6 +7894,8 @@ export declare function finalizeEnrollmentByToken(db: Database, input: {
|
|
|
6572
7894
|
export declare function approveDeviceEnrollmentRequest(db: Database, input: {
|
|
6573
7895
|
accountId: string;
|
|
6574
7896
|
workspaceId: string;
|
|
7897
|
+
scope?: EnrollmentRecord["scope"];
|
|
7898
|
+
allowOrganization?: boolean;
|
|
6575
7899
|
requestId: string;
|
|
6576
7900
|
allowScreenControl: boolean;
|
|
6577
7901
|
approvedBySubjectId: string;
|
|
@@ -6604,7 +7928,11 @@ export declare function createSandbox(db: Database, input: {
|
|
|
6604
7928
|
name: string;
|
|
6605
7929
|
enrollmentId?: string | null;
|
|
6606
7930
|
}): Promise<SandboxRecord>;
|
|
6607
|
-
export declare function getSandbox(db: Database,
|
|
7931
|
+
export declare function getSandbox(db: Database, access: string | {
|
|
7932
|
+
accountId: string;
|
|
7933
|
+
workspaceId: string;
|
|
7934
|
+
subjectId: string;
|
|
7935
|
+
}, sandboxId: string): Promise<SandboxRecord | null>;
|
|
6608
7936
|
export declare function listSandboxes(db: Database, workspaceId: string): Promise<SandboxRecord[]>;
|
|
6609
7937
|
export type ActiveSandboxPointer = {
|
|
6610
7938
|
activeSandboxId: string | null;
|
|
@@ -6625,6 +7953,13 @@ export declare function setActiveSandbox(db: Database, input: {
|
|
|
6625
7953
|
sessionId: string;
|
|
6626
7954
|
targetSandboxId: string | null;
|
|
6627
7955
|
expectedEpoch: number;
|
|
7956
|
+
subjectId?: string;
|
|
7957
|
+
personalMachineAttempt?: {
|
|
7958
|
+
turnId: string;
|
|
7959
|
+
attemptId: string;
|
|
7960
|
+
executionGeneration: number;
|
|
7961
|
+
initiatingHumanSubjectId: string;
|
|
7962
|
+
};
|
|
6628
7963
|
workingDir?: string | null;
|
|
6629
7964
|
}): Promise<{
|
|
6630
7965
|
swapped: boolean;
|
|
@@ -6812,6 +8147,7 @@ export type CreateSessionGoalInput = {
|
|
|
6812
8147
|
sessionId: string;
|
|
6813
8148
|
text: string;
|
|
6814
8149
|
successCriteria?: string | null;
|
|
8150
|
+
rootConstraints?: string[];
|
|
6815
8151
|
maxAutoContinuations?: number | null;
|
|
6816
8152
|
mutationPolicy?: SessionGoalMutationPolicy;
|
|
6817
8153
|
expectedObjectiveRevision?: number;
|
|
@@ -6819,17 +8155,20 @@ export type CreateSessionGoalInput = {
|
|
|
6819
8155
|
changeKind?: SessionGoalChangeKind;
|
|
6820
8156
|
changeRationale?: string;
|
|
6821
8157
|
sourceProposalId?: string;
|
|
8158
|
+
rollbackOfRevisionId?: string;
|
|
6822
8159
|
createdBy: SessionGoalCreatedBy;
|
|
6823
8160
|
};
|
|
6824
8161
|
export declare function createSessionGoal(db: Database, input: CreateSessionGoalInput): Promise<SessionGoal>;
|
|
6825
8162
|
export declare function getSessionGoal(db: Database, workspaceId: string, sessionId: string): Promise<SessionGoal | null>;
|
|
6826
8163
|
export type SessionGoalContinuationProjection = {
|
|
6827
8164
|
state: "inactive" | "scheduled" | "running" | "blocked" | "invariant_broken";
|
|
6828
|
-
reason: "goal_inactive" | "wake_pending" | "continuation_pending" | "human_work_pending" | "goal_turn_running" | "human_turn_running" | "workstream_paused" | "approval_required" | "provider_backpressure" | "session_cancelled" | "system_work_pending" | "missing_obligation";
|
|
8165
|
+
reason: "goal_inactive" | "wake_pending" | "continuation_pending" | "human_work_pending" | "goal_turn_running" | "human_turn_running" | "workstream_paused" | "approval_required" | "provider_backpressure" | "session_cancelled" | "system_work_pending" | "held_for_input" | "backoff_pending" | "missing_obligation";
|
|
6829
8166
|
wakeRevision: number;
|
|
6830
8167
|
observedRevision: number;
|
|
6831
8168
|
nextAttemptAt: string | null;
|
|
6832
8169
|
lastError: string | null;
|
|
8170
|
+
/** The agent's stated `goal_wait` reason while `held_for_input`; null otherwise. */
|
|
8171
|
+
holdReason: string | null;
|
|
6833
8172
|
};
|
|
6834
8173
|
/**
|
|
6835
8174
|
* Read the goal and its autonomy state from one repeatable Postgres snapshot.
|
|
@@ -6855,6 +8194,21 @@ export declare function upsertSessionGoal(db: Database, input: CreateSessionGoal
|
|
|
6855
8194
|
goal: SessionGoal;
|
|
6856
8195
|
replaced: boolean;
|
|
6857
8196
|
}>;
|
|
8197
|
+
/**
|
|
8198
|
+
* Re-arm one reusable scheduled goal exactly once per admitted run. The receipt,
|
|
8199
|
+
* goal mutation, and timeline fact share the canonical session lock transaction,
|
|
8200
|
+
* so crash recovery cannot reset counters or append goal.set twice.
|
|
8201
|
+
*/
|
|
8202
|
+
export declare function upsertScheduledSessionGoalForRun(db: Database, input: {
|
|
8203
|
+
accountId: string;
|
|
8204
|
+
workspaceId: string;
|
|
8205
|
+
sessionId: string;
|
|
8206
|
+
runId: string;
|
|
8207
|
+
text: string;
|
|
8208
|
+
successCriteria?: string | null;
|
|
8209
|
+
maxAutoContinuations?: number | null;
|
|
8210
|
+
mutationPolicy?: SessionGoalMutationPolicy;
|
|
8211
|
+
}): Promise<SessionEvent[]>;
|
|
6858
8212
|
/**
|
|
6859
8213
|
* Agent/API goal_set: session sequence ownership, the create-or-replace
|
|
6860
8214
|
* mutation, and goal.set timeline fact commit together. The session-first lock
|
|
@@ -6870,12 +8224,32 @@ export declare function upsertSessionGoalWithEvent(db: Database, input: CreateSe
|
|
|
6870
8224
|
events: SessionEvent[];
|
|
6871
8225
|
}>;
|
|
6872
8226
|
export declare function listSessionGoalRevisions(db: Database, workspaceId: string, sessionId: string): Promise<SessionGoalRevision[]>;
|
|
8227
|
+
export declare function listSessionGoalRevisionPage(db: Database, workspaceId: string, sessionId: string, options?: {
|
|
8228
|
+
limit: number;
|
|
8229
|
+
before?: string;
|
|
8230
|
+
}): Promise<{
|
|
8231
|
+
revisions: SessionGoalRevision[];
|
|
8232
|
+
hasMore: boolean;
|
|
8233
|
+
nextCursor: string | null;
|
|
8234
|
+
}>;
|
|
6873
8235
|
export declare function getSessionGoalRevision(db: Database, workspaceId: string, sessionId: string, revisionId: string): Promise<SessionGoalRevision | null>;
|
|
8236
|
+
export declare function rejectSessionGoalRevisionWithEvent(db: Database, input: {
|
|
8237
|
+
accountId: string;
|
|
8238
|
+
workspaceId: string;
|
|
8239
|
+
sessionId: string;
|
|
8240
|
+
revisionId: string;
|
|
8241
|
+
expectedObjectiveRevision: number;
|
|
8242
|
+
rationale: string;
|
|
8243
|
+
}): Promise<{
|
|
8244
|
+
revision: SessionGoalRevision;
|
|
8245
|
+
events: SessionEvent[];
|
|
8246
|
+
replay: boolean;
|
|
8247
|
+
}>;
|
|
6874
8248
|
/**
|
|
6875
8249
|
* Low-level semantic goal revision. The established lifecycle version still
|
|
6876
8250
|
* advances so stale continuation updates are cancelled, while the migration
|
|
6877
|
-
* trigger advances the separate objective revision. A semantic rewrite
|
|
6878
|
-
*
|
|
8251
|
+
* trigger advances the separate objective revision. A semantic rewrite does
|
|
8252
|
+
* not synthesize or consume another continuation.
|
|
6879
8253
|
*/
|
|
6880
8254
|
export declare function updateSessionGoal(db: Database, workspaceId: string, sessionId: string, input: {
|
|
6881
8255
|
text?: string;
|
|
@@ -6918,6 +8292,44 @@ export declare function updateSessionGoalWithEvent(db: Database, workspaceId: st
|
|
|
6918
8292
|
* revision. The attempt-fenced operation receipt makes a recovered tool call
|
|
6919
8293
|
* converge on the original event instead of manufacturing progress twice.
|
|
6920
8294
|
*/
|
|
8295
|
+
/**
|
|
8296
|
+
* Column set that retires an agent-declared `goal_wait` hold. Spread into every
|
|
8297
|
+
* goal head mutation (status transition, applied semantic revision, replace) so
|
|
8298
|
+
* newer truth never sits behind an older wait.
|
|
8299
|
+
*/
|
|
8300
|
+
export declare const SESSION_GOAL_HOLD_MIN_SECONDS = 30;
|
|
8301
|
+
export declare const SESSION_GOAL_HOLD_MAX_SECONDS: number;
|
|
8302
|
+
/**
|
|
8303
|
+
* Agent `goal_wait`: record that the active goal's next continuation should
|
|
8304
|
+
* wait for child results, a message, a human prompt, or the deadline instead of
|
|
8305
|
+
* materializing immediately after the declaring turn ends.
|
|
8306
|
+
*
|
|
8307
|
+
* The hold is bound to the exact caller turn. The materializer honors it only
|
|
8308
|
+
* while that turn is still the latest finished turn and `now < until`; it
|
|
8309
|
+
* never consumes the wake/observed revision ledger. The receipt, goal
|
|
8310
|
+
* mutation, and `goal.held` timeline fact commit under the canonical goal
|
|
8311
|
+
* event-write prefix (control FOR SHARE -> workspace FOR KEY SHARE -> session
|
|
8312
|
+
* FOR NO KEY UPDATE), never a workspace FOR UPDATE. A replacement attempt
|
|
8313
|
+
* replaying the same target-scoped operation key receives the stored result.
|
|
8314
|
+
*/
|
|
8315
|
+
export declare function holdSessionGoalContinuationWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
8316
|
+
reason: string;
|
|
8317
|
+
untilSeconds: number;
|
|
8318
|
+
command: {
|
|
8319
|
+
accountId: string;
|
|
8320
|
+
actor: Extract<SessionCommandActor, {
|
|
8321
|
+
type: "agent_attempt";
|
|
8322
|
+
}>;
|
|
8323
|
+
operationKey: string;
|
|
8324
|
+
};
|
|
8325
|
+
}): Promise<{
|
|
8326
|
+
goal: SessionGoal;
|
|
8327
|
+
events: SessionEvent[];
|
|
8328
|
+
operationId: string;
|
|
8329
|
+
replay: boolean;
|
|
8330
|
+
holdTurnId: string;
|
|
8331
|
+
untilAt: string;
|
|
8332
|
+
}>;
|
|
6921
8333
|
export declare function recordSessionGoalProgressWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
6922
8334
|
progressNote: string;
|
|
6923
8335
|
command: {
|
|
@@ -7002,7 +8414,7 @@ export type GoalContinuationDecision = {
|
|
|
7002
8414
|
decision: "queue";
|
|
7003
8415
|
} | {
|
|
7004
8416
|
decision: "paused";
|
|
7005
|
-
reason: "
|
|
8417
|
+
reason: "max_auto_continuations" | "limits";
|
|
7006
8418
|
goal: SessionGoal;
|
|
7007
8419
|
} | {
|
|
7008
8420
|
decision: "continue";
|
|
@@ -7014,20 +8426,38 @@ export type GoalContinuationDecision = {
|
|
|
7014
8426
|
* Core continuation decision, taken in one transaction with the goal row
|
|
7015
8427
|
* locked. Queued work always wins; any non-terminal turn (queued, running, or
|
|
7016
8428
|
* requires_action awaiting a human approval) blocks auto-continuation. The
|
|
7017
|
-
*
|
|
7018
|
-
*
|
|
7019
|
-
* them.
|
|
8429
|
+
* optional max-continuation guard mutates its counter here only, so a replaying
|
|
8430
|
+
* workflow re-reads recorded activity results and never recomputes it.
|
|
7020
8431
|
*/
|
|
7021
8432
|
export declare function evaluateGoalContinuation(db: Database, input: {
|
|
7022
8433
|
workspaceId: string;
|
|
7023
8434
|
sessionId: string;
|
|
7024
8435
|
defaultMaxAutoContinuations?: number | null;
|
|
7025
|
-
noProgressLimit: number;
|
|
7026
8436
|
budgetBlocked?: string | null;
|
|
7027
8437
|
}): Promise<GoalContinuationDecision>;
|
|
8438
|
+
export declare const GOAL_IDLE_BACKOFF_WAKE_REASON = "goal_idle_backoff";
|
|
8439
|
+
/**
|
|
8440
|
+
* Pacing between consecutive no-input goal continuations. `scheduleMs[n - 1]`
|
|
8441
|
+
* (last entry repeats) is the delay before the n-th consecutive continuation,
|
|
8442
|
+
* measured from when the previous continuation turn finished; `maxMs` bounds
|
|
8443
|
+
* every delay. Omitted/null means no backoff (the legacy immediate behavior).
|
|
8444
|
+
*/
|
|
8445
|
+
export type GoalIdleBackoffPolicy = {
|
|
8446
|
+
scheduleMs: readonly number[];
|
|
8447
|
+
maxMs: number;
|
|
8448
|
+
};
|
|
7028
8449
|
export type MaterializeGoalContinuationResult = {
|
|
7029
8450
|
action: "none" | "queue";
|
|
7030
8451
|
events: [];
|
|
8452
|
+
} | {
|
|
8453
|
+
action: "held";
|
|
8454
|
+
events: [];
|
|
8455
|
+
holdTurnId: string;
|
|
8456
|
+
holdUntil: Date;
|
|
8457
|
+
} | {
|
|
8458
|
+
action: "deferred";
|
|
8459
|
+
events: [];
|
|
8460
|
+
notBefore: Date;
|
|
7031
8461
|
} | {
|
|
7032
8462
|
action: "paused";
|
|
7033
8463
|
events: SessionEvent[];
|
|
@@ -7042,7 +8472,7 @@ export type MaterializeGoalContinuationResult = {
|
|
|
7042
8472
|
* Consume one durable goal-wake revision into one continuation obligation.
|
|
7043
8473
|
*
|
|
7044
8474
|
* This is deliberately one outer PostgreSQL transaction. The existing locked
|
|
7045
|
-
* evaluator runs as a nested savepoint, so its
|
|
8475
|
+
* evaluator runs as a nested savepoint, so its counter mutation is
|
|
7046
8476
|
* rolled back if prompt construction, update/event insertion, metering, or the
|
|
7047
8477
|
* workflow-wake outbox write fails. Retrying after a lost COMMIT response sees
|
|
7048
8478
|
* the same stable goal revision and the already-pending update; it never spends
|
|
@@ -7054,8 +8484,8 @@ export declare function materializeGoalContinuation(db: Database, input: {
|
|
|
7054
8484
|
sessionId: string;
|
|
7055
8485
|
workflowId: string;
|
|
7056
8486
|
defaultMaxAutoContinuations?: number | null;
|
|
7057
|
-
noProgressLimit: number;
|
|
7058
8487
|
budgetBlocked?: string | null;
|
|
8488
|
+
idleBackoff?: GoalIdleBackoffPolicy | null;
|
|
7059
8489
|
policy: {
|
|
7060
8490
|
model: string;
|
|
7061
8491
|
reasoningEffort: ReasoningEffort;
|
|
@@ -7077,15 +8507,34 @@ export type InitializeSessionStartInput = {
|
|
|
7077
8507
|
goal?: {
|
|
7078
8508
|
text: string;
|
|
7079
8509
|
successCriteria?: string | null;
|
|
8510
|
+
rootConstraints?: string[];
|
|
7080
8511
|
maxAutoContinuations?: number | null;
|
|
7081
8512
|
mutationPolicy?: SessionGoalMutationPolicy;
|
|
8513
|
+
createdBy?: SessionGoalCreatedBy;
|
|
7082
8514
|
} | null;
|
|
7083
8515
|
consumeNewSessionDraft?: {
|
|
7084
8516
|
subjectId: string;
|
|
7085
8517
|
expectedRevision: number;
|
|
8518
|
+
expectedSnapshot?: NewSessionDraftSnapshot;
|
|
8519
|
+
acceptedSelection?: {
|
|
8520
|
+
channelId: string | null;
|
|
8521
|
+
targetSandboxId: string | null;
|
|
8522
|
+
workingDir: string | null;
|
|
8523
|
+
};
|
|
8524
|
+
} | null;
|
|
8525
|
+
/** Successful create that preserves, rather than consumes, the draft. */
|
|
8526
|
+
rememberNewSessionSelection?: {
|
|
8527
|
+
subjectId: string;
|
|
8528
|
+
acceptedSelection: {
|
|
8529
|
+
channelId: string | null;
|
|
8530
|
+
targetSandboxId: string | null;
|
|
8531
|
+
workingDir: string | null;
|
|
8532
|
+
};
|
|
7086
8533
|
} | null;
|
|
7087
8534
|
/** Persist session.created only; realtime will supply the first human turn. */
|
|
7088
8535
|
deferInitialTurn?: boolean;
|
|
8536
|
+
/** Public status persisted with a deferred session start. Defaults to idle. */
|
|
8537
|
+
deferredStatus?: Extract<SessionStatus, "idle" | "queued">;
|
|
7089
8538
|
};
|
|
7090
8539
|
export type InitializeSessionStartResult = {
|
|
7091
8540
|
events: SessionEvent[];
|
|
@@ -7124,6 +8573,13 @@ export type ClaimSessionWorkForAttemptInput = {
|
|
|
7124
8573
|
attemptId: string;
|
|
7125
8574
|
dispatchId: string;
|
|
7126
8575
|
trigger: SessionWorkTrigger;
|
|
8576
|
+
/** Optional worker-owned mutable-authority fence for pending machine inputs. */
|
|
8577
|
+
validatePendingSystemUpdateAuthority?: (tx: Database, update: SessionSystemUpdate) => Promise<{
|
|
8578
|
+
action: "accept";
|
|
8579
|
+
} | {
|
|
8580
|
+
action: "reject";
|
|
8581
|
+
reason: string;
|
|
8582
|
+
}>;
|
|
7127
8583
|
};
|
|
7128
8584
|
export type ClaimSessionWorkForAttemptResult = {
|
|
7129
8585
|
action: "claimed";
|
|
@@ -7269,7 +8725,6 @@ export type SessionWorkPeek = {
|
|
|
7269
8725
|
} | {
|
|
7270
8726
|
kind: "idle";
|
|
7271
8727
|
};
|
|
7272
|
-
/** Read durable session state without reserving a turn-worker slot or mutating it. */
|
|
7273
8728
|
export declare function peekSessionWork(db: Database, workspaceId: string, sessionId: string): Promise<SessionWorkPeek>;
|
|
7274
8729
|
export type FailSessionWorkBeforeAttemptClaimInput = {
|
|
7275
8730
|
accountId: string;
|
|
@@ -7347,11 +8802,12 @@ export type ApplySessionTurnSettlementInput = {
|
|
|
7347
8802
|
activeTurnId: string | null;
|
|
7348
8803
|
events: AppendEventInput[];
|
|
7349
8804
|
/**
|
|
7350
|
-
* A mid-turn
|
|
7351
|
-
*
|
|
7352
|
-
* pendingApprovals.
|
|
7353
|
-
*
|
|
7354
|
-
*
|
|
8805
|
+
* A mid-turn requires_action freeze. Human-input rows and interaction
|
|
8806
|
+
* interventions are public protocol; ordinary approvals remain in
|
|
8807
|
+
* pendingApprovals. Pause attaches the bounded open suffix on
|
|
8808
|
+
* `session_pending_tool_calls` and stores the open-suffix sentinel here.
|
|
8809
|
+
* Resume uses the suffix plus paired history and must not call
|
|
8810
|
+
* `RunState.fromString`.
|
|
7355
8811
|
*/
|
|
7356
8812
|
runState?: {
|
|
7357
8813
|
serializedRunState: string;
|
|
@@ -7387,6 +8843,7 @@ export type ApplySessionTurnSettlementInput = {
|
|
|
7387
8843
|
export type ApplySessionTurnSettlementResult = {
|
|
7388
8844
|
action: "settled";
|
|
7389
8845
|
events: SessionEvent[];
|
|
8846
|
+
canonicalStartupMilestones: CanonicalTurnStartupMilestoneReceipt[];
|
|
7390
8847
|
recordingMutationApplied: boolean;
|
|
7391
8848
|
} | {
|
|
7392
8849
|
action: "stale";
|
|
@@ -7401,6 +8858,12 @@ export type ApplySessionTurnSettlementHooks = {
|
|
|
7401
8858
|
turnId: string;
|
|
7402
8859
|
}) => void | Promise<void>) | undefined;
|
|
7403
8860
|
};
|
|
8861
|
+
export type CanonicalTurnStartupMilestoneReceipt = {
|
|
8862
|
+
milestone: "queue" | "provider_dispatch" | "first_byte";
|
|
8863
|
+
outcome: "completed" | "failed";
|
|
8864
|
+
eventId: string;
|
|
8865
|
+
durationMs: number;
|
|
8866
|
+
};
|
|
7404
8867
|
/**
|
|
7405
8868
|
* Atomically append terminal/requires-action truth, update the exact turn, and
|
|
7406
8869
|
* transition the owning session. A superseded dispatch or closed control gate
|
|
@@ -7557,12 +9020,30 @@ export declare function getSessionTurnForAttempt(db: Database, workspaceId: stri
|
|
|
7557
9020
|
* the model that actually ran rather than reverting to a stale default.
|
|
7558
9021
|
*/
|
|
7559
9022
|
export declare function getLatestStartedSessionTurn(db: Database, workspaceId: string, sessionId: string): Promise<SessionTurn | null>;
|
|
9023
|
+
/**
|
|
9024
|
+
* Freeze the effective policy an internal scheduled update would inherit from
|
|
9025
|
+
* an existing session at occurrence admission. The later claim consumes this
|
|
9026
|
+
* exact policy instead of re-reading whichever turn happened to start most
|
|
9027
|
+
* recently in the meantime.
|
|
9028
|
+
*/
|
|
9029
|
+
export declare function getScheduledTargetSessionExecution(db: Database, workspaceId: string, sessionId: string, authoritySubjectId?: string | null): Promise<ScheduledTaskRunAcceptedExecutionType["targetSessionExecution"]>;
|
|
7560
9030
|
export declare function listSessionTurns(db: Database, workspaceId: string, sessionId: string, limit?: number): Promise<SessionTurn[]>;
|
|
7561
9031
|
export declare function listPendingSessionTurns(db: Database, workspaceId: string, sessionId: string): Promise<SessionTurn[]>;
|
|
7562
9032
|
export declare function getSessionQueueSnapshot(db: Database, workspaceId: string, sessionId: string): Promise<SessionQueueSnapshot | null>;
|
|
7563
|
-
type
|
|
7564
|
-
type:
|
|
9033
|
+
type ChildLifecycleOutboxPayload = Extract<SessionSystemUpdatePayload, {
|
|
9034
|
+
type: ChildLifecycleSystemUpdateKind;
|
|
7565
9035
|
}>;
|
|
9036
|
+
/** Derive the bounded responder kind of a human-input/approval resolution. */
|
|
9037
|
+
export declare function childRequiresActionRespondedByKindFor(respondedBy: string, explicit?: ChildRequiresActionRespondedByKind): ChildRequiresActionRespondedByKind;
|
|
9038
|
+
/** The exact kind/payload pair of one child-lifecycle outbox row, correlated for typed re-insert. */
|
|
9039
|
+
export type SessionSystemUpdateOutboxKindPayload = {
|
|
9040
|
+
[Kind in ChildLifecycleSystemUpdateKind]: {
|
|
9041
|
+
kind: Kind;
|
|
9042
|
+
payload: Extract<SessionSystemUpdatePayload, {
|
|
9043
|
+
type: Kind;
|
|
9044
|
+
}>;
|
|
9045
|
+
};
|
|
9046
|
+
}[ChildLifecycleSystemUpdateKind];
|
|
7566
9047
|
export type SessionSystemUpdateOutboxDelivery = {
|
|
7567
9048
|
id: string;
|
|
7568
9049
|
status: "pending" | "delivered";
|
|
@@ -7571,15 +9052,17 @@ export type SessionSystemUpdateOutboxDelivery = {
|
|
|
7571
9052
|
sourceSessionId: string;
|
|
7572
9053
|
targetSessionId: string;
|
|
7573
9054
|
dedupeKey: string;
|
|
7574
|
-
kind:
|
|
9055
|
+
kind: ChildLifecycleSystemUpdateKind;
|
|
7575
9056
|
classification: SystemUpdateClassification;
|
|
7576
9057
|
sourceId: string;
|
|
7577
9058
|
summary: string;
|
|
7578
|
-
payload:
|
|
9059
|
+
payload: ChildLifecycleOutboxPayload;
|
|
7579
9060
|
lineage: Record<string, unknown>;
|
|
7580
9061
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
7581
9062
|
xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
7582
9063
|
};
|
|
9064
|
+
/** Narrow an outbox row back to its correlated typed kind/payload input variant. */
|
|
9065
|
+
export declare function sessionSystemUpdateOutboxKindPayload(outbox: Pick<SessionSystemUpdateOutboxDelivery, "kind" | "payload">): SessionSystemUpdateOutboxKindPayload;
|
|
7583
9066
|
/**
|
|
7584
9067
|
* Read the exact durable parent-update row created by terminal turn settlement.
|
|
7585
9068
|
* Failure delivery must never upsert this row: settlement owns its payload and
|
|
@@ -7686,6 +9169,7 @@ export type AddSessionSystemUpdateInput = {
|
|
|
7686
9169
|
lineage?: Record<string, unknown>;
|
|
7687
9170
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
7688
9171
|
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
9172
|
+
scheduledTaskRunId?: string | null;
|
|
7689
9173
|
} & SessionSystemUpdateInputVariant;
|
|
7690
9174
|
export type AddSessionSystemUpdateResult = {
|
|
7691
9175
|
added: false;
|
|
@@ -7700,12 +9184,46 @@ export type AddSessionSystemUpdateResult = {
|
|
|
7700
9184
|
temporalWorkflowId: string | null;
|
|
7701
9185
|
events: SessionEvent[];
|
|
7702
9186
|
};
|
|
9187
|
+
export type PrepareSessionSystemUpdateSourceResult = {
|
|
9188
|
+
/** Private, bounded, content-free source authority appended before insert. */
|
|
9189
|
+
lineage?: Record<string, unknown>;
|
|
9190
|
+
};
|
|
7703
9191
|
export declare function addSessionSystemUpdate(db: Database, input: AddSessionSystemUpdateInput): Promise<AddSessionSystemUpdateResult>;
|
|
7704
9192
|
/**
|
|
7705
9193
|
* Persist one internal update without fabricating a user prompt or queue row.
|
|
7706
9194
|
* Dedupe and any producer/outbox mutation commit in the same transaction.
|
|
7707
9195
|
*/
|
|
7708
|
-
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null, updateId: string | null) => Promise<void
|
|
9196
|
+
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null, updateId: string | null) => Promise<void>, options?: {
|
|
9197
|
+
/** Runs under the locked session/source transaction before any update/event insert. */
|
|
9198
|
+
prepareSource?: (tx: Database, sessionId: string) => Promise<PrepareSessionSystemUpdateSourceResult | void>;
|
|
9199
|
+
}): Promise<AddSessionSystemUpdateResult>;
|
|
9200
|
+
/**
|
|
9201
|
+
* One durable machine input by id, under the ordinary workspace RLS scope.
|
|
9202
|
+
* The row outlives delivery, so a late bounded projection of an already
|
|
9203
|
+
* announced `system.update.pending` event (Slack notification delivery)
|
|
9204
|
+
* resolves the exact typed notice instead of re-deriving it from the
|
|
9205
|
+
* lossy event preview. Read-only: it never mutates or consumes the update.
|
|
9206
|
+
*/
|
|
9207
|
+
export declare function getSessionSystemUpdateById(db: Database, workspaceId: string, sessionId: string, updateId: string): Promise<SessionSystemUpdate | null>;
|
|
9208
|
+
/**
|
|
9209
|
+
* Whether the parent already holds a `child_requires_action_resolved` notice
|
|
9210
|
+
* for one exact blocked boundary. Read-only, under the ordinary workspace RLS
|
|
9211
|
+
* scope, and answered entirely from the PARENT's own rows: the child session is
|
|
9212
|
+
* never read.
|
|
9213
|
+
*
|
|
9214
|
+
* A resolution supersedes a still-pending `child_requires_action` in the same
|
|
9215
|
+
* commit, but a notice already claimed into a parent turn is `delivered` and
|
|
9216
|
+
* keeps that state forever. A late reader (Slack delivery running behind a
|
|
9217
|
+
* widened retry window) therefore cannot decide staleness from `state` alone.
|
|
9218
|
+
* One accepted response advances that exact (child, turn, generation) boundary
|
|
9219
|
+
* - a re-freeze is a new generation and a new notice - so the presence of the
|
|
9220
|
+
* resolution row in any state is the durable "no longer blocked" fact.
|
|
9221
|
+
*/
|
|
9222
|
+
export declare function childRequiresActionResolutionExists(db: Database, workspaceId: string, sessionId: string, boundary: {
|
|
9223
|
+
childSessionId: string;
|
|
9224
|
+
childTurnId: string;
|
|
9225
|
+
childTurnGeneration: number;
|
|
9226
|
+
}): Promise<boolean>;
|
|
7709
9227
|
export declare function listOutstandingSessionSystemUpdates(db: Database, workspaceId: string, sessionId: string): Promise<SessionSystemUpdate[]>;
|
|
7710
9228
|
/** Internal updates atomically attached when this inference was claimed. */
|
|
7711
9229
|
export declare function listSessionSystemUpdatesForTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionSystemUpdate[]>;
|
|
@@ -7730,6 +9248,8 @@ export declare function acceptSessionApprovalDecision(db: Database, input: {
|
|
|
7730
9248
|
sessionId: string;
|
|
7731
9249
|
subjectId: string;
|
|
7732
9250
|
payload: Record<string, unknown>;
|
|
9251
|
+
/** Bounded decider kind for the parent's resolution notice; `human` when omitted. */
|
|
9252
|
+
respondedByKind?: ChildRequiresActionRespondedByKind;
|
|
7733
9253
|
clientEventId?: string | null;
|
|
7734
9254
|
interactionIntervention?: {
|
|
7735
9255
|
interventionId: string;
|
|
@@ -7763,6 +9283,7 @@ export declare function expireSessionInteractionIntervention(db: Database, input
|
|
|
7763
9283
|
export declare function appendSessionEventsForTurnAttempt(db: Database, workspaceId: string, sessionId: string, turnId: string, executionGeneration: number, attemptId: string, inputs: AppendEventInput[]): Promise<{
|
|
7764
9284
|
events: SessionEvent[];
|
|
7765
9285
|
accepted: boolean;
|
|
9286
|
+
canonicalStartupMilestones: CanonicalTurnStartupMilestoneReceipt[];
|
|
7766
9287
|
}>;
|
|
7767
9288
|
/**
|
|
7768
9289
|
* Commit one exact-attempt mutation and its timeline projection together. The
|
|
@@ -7773,6 +9294,7 @@ export declare function mutateAndAppendSessionEventsForTurnAttempt(db: Database,
|
|
|
7773
9294
|
events: SessionEvent[];
|
|
7774
9295
|
accepted: boolean;
|
|
7775
9296
|
mutationApplied: boolean;
|
|
9297
|
+
canonicalStartupMilestones: CanonicalTurnStartupMilestoneReceipt[];
|
|
7776
9298
|
}>;
|
|
7777
9299
|
export type SettleCodemodeOperationWithOutputInput = {
|
|
7778
9300
|
accountId: string;
|
|
@@ -7869,5 +9391,8 @@ export * from "./browser-auth.js";
|
|
|
7869
9391
|
export * from "./browser-downloads.js";
|
|
7870
9392
|
export * from "./attached-browser-devices.js";
|
|
7871
9393
|
export * from "./interaction-revisions.js";
|
|
9394
|
+
export * from "./interaction-placement-loss.js";
|
|
7872
9395
|
export * from "./canonical-human-identities.js";
|
|
7873
9396
|
export * from "./session-tenancy.js";
|
|
9397
|
+
export * from "./governed-learning-activation.js";
|
|
9398
|
+
export * from "./automations.js";
|