Weave documentation
Rust referencedbrowser

dbrowser · commands::agent

Source declarations, signatures and documentation for commands::agent.

Source: sigil/weave/tools/dbrowser/src-tauri/src/commands/agent.rs. SHA-256: 6ee2d8639ddd6a5415fdcac059de018d938bb1627c55a6b0b9e3b684ecfca8cd.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

commands::agent::AgentMessage

A chat message in the agent conversation.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentMessage {
/// Unique message identifier.

pub id: String,
/// Role: "user" or "assistant".

pub role: String,
/// Message content (may contain markdown for assistant messages).

pub content: String,
/// Unix timestamp in milliseconds.

pub timestamp: u64
}

Source line: 48.

commands::agent::AgentAction

An action proposed by the agent that requires user approval.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentAction {
/// Unique action identifier.

pub id: String,
/// Action type: "navigate", "click", "dns_update", "file_op", "search".

pub action_type: String,
/// Human-readable description of the proposed action.

pub description: String,
/// Status: "pending", "approved", "rejected", "executed", "failed".

pub status: String,
/// Execution result (populated after approval and dispatch).

#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<String>
}

Source line: 61.

commands::agent::AgentStatus

Agent connection status.

#[derive(Debug, Serialize)]
pub struct AgentStatus {
/// Whether the agent is connected and ready.

pub connected: bool,
/// Agent display name.

pub name: String,
/// Current model being used.

pub model: String
}

Source line: 77.

commands::agent::AgentInferenceConfig

User-scoped inference settings passed from the browser shell.

#[derive(Debug, Clone, Deserialize)]
pub struct AgentInferenceConfig {
pub base_url: String,
pub model: String,
pub authorization: String,
pub provider_id: String
}

Source line: 88.

commands::agent::AgentResponse

Response from sending a message to the agent.

#[derive(Debug, Serialize)]
pub struct AgentResponse {
/// The assistant's reply message.

pub message: AgentMessage,
/// Any actions the agent proposes (may be empty).

pub actions: Vec<AgentAction>
}

Source line: 97.

commands::agent::AuditRecord

A hash-chained audit record for agent action approvals.

Each record includes the hash of the previous record, forming a tamper-evident chain. If any record is modified, the chain breaks.

#[derive(Debug, Clone, Serialize)]
pub struct AuditRecord {
/// Monotonic sequence number.

pub seq: u64,
/// SHA-256 hash of the previous record (hex). Empty for the first record.

pub prev_hash: String,
/// SHA-256 hash of this record's content (hex).

pub hash: String,
/// Unix timestamp in milliseconds.

pub timestamp: u64,
/// The action ID this record refers to.

pub action_id: String,
/// The action type.

pub action_type: String,
/// The decision: "approved", "rejected".

pub decision: String,
/// The DID of the user who made the decision.

pub decided_by: String,
/// Execution outcome (if approved and dispatched).

pub outcome: Option<String>
}

Source line: 141.

commands::agent::AuditLog

Thread-safe audit log.

pub struct AuditLog {

}

Source line: 163.

commands::agent::agent_send_message

Send a message to Hans through Chutes.

The message is sent to the user-authorized Chutes model. The response may include proposed actions that require user approval before execution.

#[tauri::command]
pub async fn agent_send_message(
    message: String,
    inference: AgentInferenceConfig,
    state: State<'_, AppState>,
) -> Result<AgentResponse, String>;

Source line: 407.

commands::agent::agent_get_status

Get the current agent connection status.

Returns the current agent identity. Chutes auth lives in the frontend because the token belongs to the signed-in user.

#[tauri::command]
pub async fn agent_get_status() -> Result<AgentStatus, String>;

Source line: 562.

commands::agent::agent_approve_action

Approve a pending agent action by its ID.

Looks up the action in the pending store, dispatches it to the appropriate handler, and records the decision in the audit log. Returns the updated action with execution results.

#[tauri::command]
pub async fn agent_approve_action(
    id: String,
    state: State<'_, AppState>,
) -> Result<AgentAction, String>;

Source line: 578.

commands::agent::agent_reject_action

Reject a pending agent action by its ID.

Removes the action from the pending store and records the rejection in the audit log.

#[tauri::command]
pub async fn agent_reject_action(
    id: String,
    state: State<'_, AppState>,
) -> Result<AgentAction, String>;

Source line: 633.

On this page