openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
104 lines (103 loc) • 4.87 kB
JavaScript
//#region src/state/openclaw-state-db-contract.ts
const DOCTOR_OWNED_STATE_TABLES = ["agent_deletion_journal"];
const FIRST_USE_STATE_TABLES = [
"user_profile_identities",
"local_workspace_projections",
"update_runs",
"session_repository_workspaces",
"github_repository_publication_requests",
"github_publication_session_lifecycles",
"skill_library_entries",
"skill_library_revisions",
"skill_library_events",
"skill_library_uploads",
"github_personal_publication_requests",
"cron_job_runtime_authorities",
"cron_run_trigger_state_retirements",
"execution_identity_contexts",
"mcp_oauth_pending_authorizations",
"node_worker_launch_containers",
"node_worker_launch_boots",
"node_worker_launch_cleanup",
"node_worker_launch_process_scopes",
"node_worker_launches",
"node_worker_prepared_workspaces",
"node_worker_turns",
"operator_approval_execution_identities",
"operator_approval_standing_grants",
"operator_approval_standing_grant_generations",
"web_push_approval_deliveries",
"execution_decision_facts",
"execution_owner_lifecycle_bindings",
"outbound_message_execution_bindings",
"outbound_message_progress"
];
const FIRST_USE_STATE_INDEXES = [
"idx_user_profile_identities_profile_id",
"idx_user_profile_identities_authorization",
"idx_update_runs_created",
"idx_update_runs_active",
"idx_github_repository_publication_shared_request",
"idx_github_repository_publication_personal_request",
"idx_github_personal_publication_owner_session",
"idx_github_personal_publication_pending",
"idx_node_worker_launches_terminal_completed",
"idx_node_worker_turns_terminal_completed",
"idx_node_worker_turns_active_owner",
"idx_operator_approval_standing_grants_binding",
"idx_web_push_approval_deliveries_subscription",
"execution_identity_contexts_run_created_idx",
"execution_decision_facts_context_occurred_idx",
"execution_decision_facts_run_occurred_idx",
"outbound_message_execution_bindings_execution_event_idx",
"outbound_message_progress_occurred_idx",
"outbound_message_progress_run_occurred_idx"
];
const LAZY_ADDITIVE_STATE_TABLES = [
...FIRST_USE_STATE_TABLES,
"agent_provenance",
"cron_run_receipts",
"config_revision_keys",
"secret_store_entries",
"projects",
"worktree_templates",
"user_preferences",
"device_pair_setup_completions",
"github_publication_requests",
"device_pairing_join_codes",
"skill_workshop_changes",
"worker_environment_ssh_fallback_ports",
"worker_session_placement_moves"
];
const LAZY_ADDITIVE_STATE_INDEXES = [
...FIRST_USE_STATE_INDEXES,
"idx_cron_run_receipts_active_job",
"idx_cron_run_receipts_job_history",
"idx_github_publication_requests_pending",
"secret_store_entries_live_idx",
"idx_skill_workshop_changes_agent_time"
];
/** Maximum time one synchronous SQLite call may wait for a lock. */
const OPENCLAW_SQLITE_BUSY_TIMEOUT_MS = 5e3;
/** User-facing guide for schema refusals; lives here so error sites avoid import cycles. */
const OPENCLAW_DATABASE_SCHEMA_DOCS_URL = "https://docs.openclaw.ai/reference/database-schemas";
const STATE_SCHEMA_MIGRATION_DESCRIPTIONS = {
"agent-databases-composite-primary-key": "agent database registry primary key → agent_id,path",
"audit-events-v2": "audit event ledger → versioned message lifecycle schema",
"commitments-retirement-v7": "retired commitments storage → discarded rows, table, and indexes",
"worker-placement-execution-mode-v8": "cloud worker placements → execution-mode claims",
"agent-databases-relative-paths-v9": "agent database registry paths → state-relative storage",
"state-table-retirement-v10": "retired shared-state tables → removed tables and indexes",
"state-table-retirement-v11": "retired skill curator tables → removed tables and indexes",
"singleton-state-foldin-v12": "singleton state tables → shared configuration state",
"state-consolidation-v13": "cron jobs and subagent runs → canonical JSON storage",
"creator-namespace-v14": "historical cron creators → unknown source attribution",
"conversation-binding-targets-v15": "conversation bindings → exact target keys without agent/session projections",
"prepared-worker-ownership-v17": "prepared workers → one-use capacity and fixed workspace ownership",
"github-publication-requester-authority-v18": "GitHub publication receipts → original requesting authority",
"operator-approvals-system-agent": "operator approvals → OpenClaw system changes",
"session-watch-cursor-provenance-v4": "session watch cursors → provenance column",
"strict-tables-v3": "tables → SQLite STRICT typing"
};
//#endregion
export { LAZY_ADDITIVE_STATE_TABLES as a, STATE_SCHEMA_MIGRATION_DESCRIPTIONS as c, LAZY_ADDITIVE_STATE_INDEXES as i, FIRST_USE_STATE_INDEXES as n, OPENCLAW_DATABASE_SCHEMA_DOCS_URL as o, FIRST_USE_STATE_TABLES as r, OPENCLAW_SQLITE_BUSY_TIMEOUT_MS as s, DOCTOR_OWNED_STATE_TABLES as t };