Skip to main content

Crate ag_session

Crate ag_session 

Source
Expand description

Frontend-neutral session management, selection catalog, and session models.

Host applications implement SessionBackend to connect the stable programmatic API to their persistence, agent, Git, and forge workflows. Callers such as background callers use SessionService without depending on terminal UI state.

Structs§

AcceptTaskChainPlanRequest
Explicit acceptance and initial implementation admission in one action.
AcceptTaskPlanRequest
Producing task and attempt selected by the user for plan acceptance.
AcceptedTaskPlan
Caller-supplied, explicitly accepted plan for an implementation attempt.
AgentAnswerContent
Role-attributed task-chain answer stored as SessionMessageKind::AgentAnswer content.
AgentCliInfo
One locally runnable agent CLI and the installed version refreshed at startup.
AgentSelection
Session-level agent selection that keeps provider kind and model together.
AnswerQuestionsRequest
Structured input for resuming one session from clarification questions.
ContinueTaskChainRequest
Explicit revision, clarification, or retry of the current workflow stage.
CreateSessionRequest
Explicit input for creating one session.
CreateTaskRequest
A desired outcome to persist without admitting an attempt or starting work.
DurableMessageRequest
Idempotent turn submitted to one session.
Personality
One enabled personality loaded from a workspace agent definition.
PersonalitySummary
Lightweight personality metadata stored in prompt-composer state.
Project
Persisted project metadata used for multi-project management.
ProjectListItem
Aggregated project snapshot for list and switcher views.
QuestionAnswer
One structured response to a persisted clarification question.
QuestionItem
One extracted question with predefined answer choices.
ReplyToTaskChainRequest
Natural-language user reply addressed to a session’s latest workflow.
ResolvedEnv
Host-resolved local environment for execution in a shared session worktree.
ReviewRequest
Persisted forge linkage for one session.
ReviewRequestSummary
Normalized remote summary for one linked review request.
Session
Complete persisted session aggregate returned by the programmatic API.
SessionId
Shared stable identifier for one session.
SessionMessage
One persisted transcript message for a session.
SessionMessageKindParseError
Error returned when a stored session message kind is unknown.
SessionService
Stable programmatic facade for session lifecycle operations.
SessionSettings
Complete session-scoped execution settings returned by the API.
SessionStats
Token and diff usage statistics associated with one agent session or isolated prompt.
SessionTranscript
Ordered transcript view assembled from persisted session messages.
StartPlanThenImplementRequest
Idempotent launch input captured before the first Planner attempt.
StaticAgentAvailabilityProbe
Availability probe that returns one caller-provided snapshot.
SubmitAgentTaskRequest
Explicit role-aware attempt, separate from legacy session-context tasks.
SubmitTaskRequest
An explicit attempt to advance a task in an existing idle session.
Task
A desired outcome with retained attempt history, scoped to one session.
TaskAgentAssignment
Immutable role and provider/model selection assigned to one task.
TaskAgentContext
Durable identity of one task’s conversation and runtime resources.
TaskAgentHistory
Durable task conversation, independent of ordinary session messages.
TaskAgentInput
Explicit input for a task’s own conversation, excluding session replay.
TaskAgentTurn
One response retained in an isolated task conversation.
TaskAttempt
One turn and its ordered post-processing, backed by a unique operation.
TaskChain
Consistent durable workflow snapshot; reading never dispatches work.

Enums§

AgentCliVersion
Automatic update and version probe state for one locally runnable agent CLI.
AgentContextRequirement
Inputs a workflow must explicitly supply, in addition to workspace access.
AgentKind
Supported agent provider families.
AgentModel
Supported agent model names across all providers.
AgentOutputKind
Semantic answer content; does not replace the protocol’s response schema.
BuiltinAgentDefinition
Built-in role contracts for a planner-to-implementer workflow.
CreateSessionMode
Creation strategy for a new session.
DurableMessageVisibility
Transcript treatment for one durable prompt.
EnvId
Stable identity and lifecycle owner of an execution environment.
FocusedReviewStatus
Durable state of one focused-review generation attempt.
ForgeKind
Shared forge family enum reused by persistence and forge adapters.
PermissionMode
Supported permission mode values for agent execution workflows.
PersonalityParseError
Error returned when one agent definition cannot be parsed safely.
ReasoningLevel
Supported reasoning-effort levels for task execution.
ResponseStyle
Preferred amount of detail in user-facing session responses.
ReviewRequestState
Normalized remote lifecycle state for one linked review request.
SessionDiffState
Known availability of a session worktree diff.
SessionError
Stable error returned by crate::SessionService operations.
SessionMessageKind
Durable category for one saved session transcript message.
SessionStatus
High-level lifecycle state for one session.
SettingName
Stable keys used in the setting and project_setting tables.
SpeedMode
Response-speed preference applied to one agent session.
TaskAttemptStatus
Operation lifecycle exposed by the task read model.
TaskChainPhase
Workflow presentation derived from the current attempt and saved response. Success records execution, never implicit acceptance of a plan or outcome.
TaskChainReplyOutcome
Workflow action admitted for one natural-language reply.
TranscriptNotice
Canonical labels for bracketed workflow notices appended to a session transcript.

Constants§

PERSONALITY_PROMPT_MAX_BYTES
Maximum UTF-8 byte length retained for one personality prompt.

Traits§

AgentAvailabilityProbe
Detects which provider CLIs are locally runnable on the current machine.
AgentSelectionMetadata
Human-readable metadata for slash-menu selectable items.
SessionBackend
Host implementation boundary for session persistence and workflows.

Functions§

activity_day_key_with_offset
Converts Unix timestamp seconds to a day key after applying a UTC offset.
build_apply_review_prompt
Builds the agent-facing /apply prompt from focused-review suggestions.
default_option_index
Returns the initial highlighted option for a clarification question.
has_actionable_review_suggestions
Returns whether focused-review markdown contains suggestions that /apply can act on.
mru_project_order
Returns indices into project_items ordered most-recently-opened first.
normalized_message_content
Returns raw persisted message content with only outer whitespace removed.
ordered_project_items
Returns the project rows named by project_order, skipping stale indices.
parse_agent_definition
Parses one .agents agent definition.
parse_agent_summary
Parses lightweight picker metadata from one .agents agent definition.
parse_persisted_session_agent_model
Parses one persisted session agent/model pair without deriving the agent from the model when the saved agent kind is available.
project_name_from_path
Derives a readable project name from its filesystem path.
resolve_agent_kind_for_model
Resolves a provider kind that can run model from the available provider list.
resolve_agent_selection_for_model
Resolves an AgentSelection for a model-only setting.
resolve_model_for_available_agent_kinds
Resolves one model against the currently available agent kinds.
resolve_prompt_model_agent_kind
Resolves the agent kind used for prompt-side /model selection.
review_suggestions
Extracts actionable suggestion content from focused-review markdown.
selectable_models_for_agent_kinds
Returns all selectable models owned by the provided agent kinds in stable settings and slash-menu order.
session_branch
Returns the default worktree branch name for a session.
stored_message_content
Returns the durable message content for one kind.