Skip to main content

Module database

Module database 

Source

Structs§

ApiActivityDetails
ApiActivityState
These are the same structured facts rendered by the web and terminal UIs.
ApiEvent
ApiEventFilter
ApiEventPage
BoundedPromptHistory
What a bounded prompt search found, and whether it stopped early.
ClientSessionState
Atomically advance both the per-client and legacy session read frontiers. Neither value changes when validation or persistence fails. One viewer’s stored state for one session.
DatabaseWriter
Cloneable submission handle for the daemon’s ordered SQLite write lane.
DatabaseWriterOwner
Owns the daemon’s writer thread and persistent SQLite connection.
DetachedSessionDraft
A terminal’s current composer and the shared value it originally inherited. The inherited value is retired on detach, never replaced by client-local text.
MaterializedSessionMutation
Changes derived from one relay event. None leaves a scalar untouched; the nested option on session_title permits explicitly clearing it.
ProjectionIntegrityError
A deterministic projection integrity violation. Retrying cannot fix it, so callers must report it separately from transport failures.
ProjectionPage
One relay page being applied inside a single write transaction. The relay retains everything past the last acknowledgement, so a page that fails part-way rolls back to the previous durable frontier and is simply redelivered. Only a committed page may be acknowledged.
PromptHistoryEntry
StoreSchemaMismatch
A store this build cannot safely read and write.
StoredReview
A second-opinion review that was still open when the UI last stopped.
TranscriptPage
One page of a session’s transcript, ordered by the sequence a reader pages by rather than by creation order.
TranscriptRetention
What one retention pass reclaimed.
TurnReviewState
How far this session has been reviewed.
TurnSummary
What one turn produced, without loading the transcript around it.
UsageCounterTotal
UsageCoverage
UsagePage

Enums§

ApiActivityKind
ApiEventData
HistoryScope
ProjectionApplyOutcome
StoreSchemaMismatchReason
TranscriptMutation

Constants§

PROJECTION_TAIL_ITEMS
How many transcript items a polled projection carries.

Functions§

active_review
The open review for session_id, if the session has one.
adopt_native_session_id
Point a session at a native session its worker opened on its own.
advance_client_read_frontier
advance_viewed_through_event_ordinal
Advance the persisted detach/read receipt monotonically. A receipt cannot acknowledge an event the controller projection has not durably applied.
apply_projection_event
Apply exactly one relay event, as a page of one.
apply_projection_page
Apply one relay page in a single transaction. fill feeds the page’s events through ProjectionPage::apply; the projection changes and the event frontier commit together only when fill succeeds, so callers may acknowledge the page’s last ordinal to the relay after this returns.
assign_new_session_workspace
Assign a newly-created session context to a workspace. Existing contexts remain immutable here; only the guarded resume operation may move one.
assign_new_session_workspace_at
clear_active_review
Forgets the open review once it has finished.
clear_interrupted_turn_reviews
Clears every session’s in-flight review flag.
clear_move_cancellation_for_retry
clear_session_draft_input_if_matches
Retire a submitted shared draft without erasing a newer client’s edit.
client_read_frontier
client_session_state
What this viewer has stored for this session: an unsent draft and how far it has read.
compact_materialized_transcript_through
Drop tool output that a verified checkpoint already holds.
create_or_get_workspace
Create the named workspace, or return the concurrently-created winner.
create_or_get_workspace_at
create_workspace
create_workspace_at
database_path
delete_session
Remove one operational session while retaining its relational history context and prompt history.
delete_workspace
Delete a workspace that owns no active sessions or recoverable drafts.
delete_workspace_at
force_delete_workspace
Force-delete a workspace whose active sessions have already been destroyed.
force_delete_workspace_at
hidden_native_sessions
Native sessions the resume dialog hides. Hel never writes into a harness home, so the hidden set lives here instead of in the harness’s own store.
list_detached_drafts
list_subagents
list_workspaces
list_workspaces_from
load_api_events
load_config_result
The exact result of a configuration command, once durably projected.
load_materialized_projection_tail
Load a projection carrying only the end of its transcript.
load_materialized_queued_prompts
Load only the durable prompt queues without deserializing transcript rows. Dashboard startup uses this path so work is proportional to queued prompts, not to the complete retained conversation history.
load_materialized_session
Load a session’s whole projection, transcript and all.
load_materialized_session_summary
Load only the projection fields needed by dashboard session summaries. Transcript bodies for tools, plans, thoughts, and old messages stay in SQLite, which keeps dashboard startup independent of transcript size.
load_materialized_transcript_after
Read the transcript items whose sequence is above after_seq, oldest first. Returns None when the session has no projection row.
load_materialized_transcript_filtered
load_materialized_transcript_tail
Read the newest limit transcript items for a session, oldest first.
load_materialized_turn_outcome
Where a session stands turn by turn: what is running now, and how the last finished prompt ended. Returns None when the session has no projection row. The API’s wait loop reads this for sessions whose actor is gone.
load_materialized_turn_summary
Summarize the turn that began at turn_start_position.
load_move_operation
load_move_operations
load_profile_config_cache
load_session_usage
load_state
load_state_from
load_state_migrating
load_subagent
load_workspace_pane_sizes
load_workspace_pane_sizes_from
lookup_subagent_request
lose_reviewer_continuity
Marks this session’s reviewer conversation as no longer continuable, and reports the generation a future review must start under.
mark_draft_recovered
mark_session_target_missing
Record that the managed target of an otherwise live session is definitively gone. A verified checkpoint keeps the session recoverable as an error on the dashboard; without one, the session is lost. The state predicate keeps a late poll result from overwriting a concurrent lifecycle transition.
mark_session_target_missing_if_current
Record a definitive worker failure only while the observed session record is still current. A delayed background write must not invalidate a resume.
mark_session_worker_connected
Commit the successful handshake for a newly provisioned worker without replacing checkpoint or display metadata owned by other controller tasks.
mark_subagent_turn_delivered
Record the child turn already reported to its parent.
materialized_event_frontier
Read only the projection’s event frontier. Deciding whether a stored projection already matches an archive costs one row this way, instead of deserializing every transcript item to compare two integers.
migrate_legacy_state
move_checkpoint_is_retained
move_pending_work
Read the confirmation data without loading the conversation history.
persist_client_draft
Store one viewer’s unsent draft.
persist_read_receipt
prune_phone_client_state
Forget web-viewer state that has passed its retention.
reassign_resumable_session_workspace
Move a durable history into the workspace from which it is being resumed.
reassign_resumable_session_workspace_at
rebind_session_bundle
Re-associate a session with another project bundle.
record_api_activities
Called on a blocking task; the shared writer serializes this with relay projection.
record_api_error
record_prompt
record_recovery_failure
record_recovery_success
recover_detached_draft
Explicitly restore a detached draft into its session composer. This is the only operation that merges client-local draft state back into the legacy session field, and the transaction marks the source draft recovered at the same durable boundary.
recover_interrupted_checkpointing_sessions
Recover lifecycle rows stranded by a process exit during checkpoint creation. This must be called once by the top-level controller process while it owns the controller-store guard, not by per-operation reloads.
remember_mount_sources
Atomically apply the controller’s MRU policy for newly used mount sources.
remember_project_directory
remember_reviewer_selection
Record one confirmed selection.
rename_profile_references
Rewrite a configured profile id in every persisted session in one SQLite transaction. Configuration is stored separately, so the controller owns coordinating this update with the matching config-map rename.
rename_target_references
Rewrite a configured target id in every persisted session in one SQLite transaction.
rename_workspace
rename_workspace_at
replace_materialized_queued_prompts
Replace a session’s durable prompt queue without touching its transcript or event frontier. Resume uses this when it keeps the stored projection but still has to drop the queue the archive carried.
replace_mount_history
request_move_cancellation
reviewer_defaults
Replace one host’s remembered mount sources with exactly this list, so the dashboard can forget a directory the user no longer wants suggested. What each workspace last chose for a second opinion.
save_active_review
Records the open review, replacing any earlier one for this session.
save_checkpointed_session
Install a lifecycle transition together with the checkpoint it just verified and the harness session id that produced it.
save_detached_draft
save_detached_session_draft
Preserve unsent input for explicit recovery and retire its unchanged legacy seed together. Empty input still retires the seed: clearing is an edit.
save_lifecycle_session
Update only the fields a lifecycle transition owns on a session that already exists. Everything else — display titles, checkpoints, container settings, and attached directories — stays with its own writer.
save_materialized_session
Replace a complete projection, primarily when seeding a restored checkpoint. Operational SessionRecord metadata and read receipts are not modified.
save_move_operation
save_profile_config_cache
save_session
Persist one operational session without rewriting unrelated controller state. Dashboard lifecycle jobs use this path so independent jobs can commit concurrently without restoring stale copies of other sessions.
save_session_with_container_size
Persist a session and the container size it most recently launched on its host in one transaction.
save_state
save_state_to
save_subagent_session
Persist a borrowed-target child and its parent relationship atomically.
save_turn_review_state
Records how far a session has been reviewed.
save_workspace_pane_sizes
save_workspace_pane_sizes_to
search_prompts
search_prompts_bounded
Search prompt history, stopping at limit matches.
session_ids_for_workspace
session_ids_for_workspace_at
Return sessions whose current or last workspace id matches workspace_id. Callers deciding live membership must additionally check SessionState.
set_native_session_hidden
Hide or reveal one native session in the resume dialog.
set_session_acp_title
Persist the latest ACP-provided title without replacing unrelated session fields that may have changed in another supervised controller task.
set_session_archived
Change only whether the resume dialog hides this session. Archiving is a display choice, so it has its own writer and never rewrites lifecycle, checkpoint, or title columns another task owns.
set_session_container_settings
Change only the per-session container provisioning inputs: the size overrides and the attached directories. Everything else the session row owns is left to its own writer.
set_session_draft_input
Overwrite the unsent chat input carried across a detach. Unlike the read receipt this is not monotonic: a draft can shrink, and an empty string clears it.
set_session_title_override
Change only the user-owned display name. This avoids writing a stale SessionRecord over independently committed checkpoint or relay metadata.
start_database_writer
touch_workspace
touch_workspace_at
turn_review_state
How far session_id has been reviewed, or a fresh state when it has never been reviewed.
workspace_for_session
workspace_for_session_at

Type Aliases§

MaterializedTurnState
Execution state, the running turn, and the last finished turn’s outcome.