Add goal mode app-server API

This commit is contained in:
Eric Traut
2026-04-15 21:28:16 -07:00
parent 6ae8cf4c4c
commit 270c426176
29 changed files with 1556 additions and 2 deletions

View File

@@ -1465,6 +1465,9 @@ pub enum EventMsg {
/// Updated session metadata (e.g., thread name changes).
ThreadNameUpdated(ThreadNameUpdatedEvent),
/// Updated long-running goal metadata for the thread.
ThreadGoalUpdated(ThreadGoalUpdatedEvent),
/// Incremental MCP startup progress updates.
McpStartupUpdate(McpStartupUpdateEvent),
@@ -3512,6 +3515,40 @@ pub struct ThreadNameUpdatedEvent {
pub thread_name: Option<String>,
}
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "protocol/")]
pub enum ThreadGoalStatus {
Active,
Paused,
#[serde(alias = "budgetExceeded")]
BudgetStopped,
Complete,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "protocol/")]
pub struct ThreadGoal {
pub thread_id: ThreadId,
pub objective: String,
pub status: ThreadGoalStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub token_budget: Option<i64>,
pub tokens_used: i64,
pub created_at: i64,
pub updated_at: i64,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "protocol/")]
pub struct ThreadGoalUpdatedEvent {
pub thread_id: ThreadId,
pub goal: ThreadGoal,
}
/// User's decision in response to an ExecApprovalRequest.
#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq, Display, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
@@ -3614,6 +3651,7 @@ pub enum TurnAbortReason {
Interrupted,
Replaced,
ReviewEnded,
BudgetExceeded,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)]