| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "reasonix/internal/event" |
| 5 | "reasonix/internal/evidence" |
| 6 | goaldomain "reasonix/internal/goal" |
| 7 | "reasonix/internal/session" |
| 8 | ) |
| 9 | |
| 10 | // Meta describes the session for the frontend's header and status line. |
| 11 | type Meta struct { |
| 12 | Label string `json:"label"` |
| 13 | Ready bool `json:"ready"` |
| 14 | Runtime SessionRuntimeView `json:"runtime"` |
| 15 | StartupErr string `json:"startupErr,omitempty"` |
| 16 | HistoricalSource *SessionSourceRef `json:"historicalSource,omitempty"` |
| 17 | EventChannel string `json:"eventChannel"` |
| 18 | SessionPath string `json:"sessionPath,omitempty"` |
| 19 | SessionID string `json:"sessionId,omitempty"` |
| 20 | Session *session.SessionRef `json:"session,omitempty"` |
| 21 | SessionRevision int64 `json:"sessionRevision,omitempty"` |
| 22 | SessionDigest string `json:"sessionDigest,omitempty"` |
| 23 | SessionGeneration uint64 `json:"sessionGeneration"` |
| 24 | RuntimeStateSnapshot *event.RuntimeStateSnapshot `json:"runtimeStateSnapshot,omitempty"` |
| 25 | Cwd string `json:"cwd"` |
| 26 | WorkspaceRoot string `json:"workspaceRoot,omitempty"` |
| 27 | WorkspaceName string `json:"workspaceName,omitempty"` |
| 28 | WorkspacePath string `json:"workspacePath,omitempty"` |
| 29 | GitBranch string `json:"gitBranch,omitempty"` |
| 30 | ImageInputEnabled bool `json:"imageInputEnabled"` |
| 31 | VisionFallbackEnabled bool `json:"visionFallbackEnabled,omitempty"` |
| 32 | AutoApproveTools bool `json:"autoApproveTools"` |
| 33 | Bypass bool `json:"bypass"` // legacy JSON key for YOLO/full-access tool auto-approval |
| 34 | CollaborationMode string `json:"collaborationMode"` |
| 35 | ToolApprovalMode string `json:"toolApprovalMode"` |
| 36 | // TokenMode and AgentPreset are deprecated dual-write wire values pinned to |
| 37 | // their safe defaults; one-version-old frontends still parse them. |
| 38 | TokenMode string `json:"tokenMode"` |
| 39 | AgentPreset string `json:"agentPreset,omitempty"` |
| 40 | Goal string `json:"goal,omitempty"` |
| 41 | GoalStatus string `json:"goalStatus,omitempty"` |
| 42 | GoalView *goaldomain.View `json:"goalView,omitempty"` |
| 43 | GoalRuntime *GoalRuntimeView `json:"goalRuntime,omitempty"` |
| 44 | // Nil means no authoritative snapshot; non-nil empty means clear the panel. |
| 45 | CanonicalTodos *[]evidence.TodoItem `json:"canonicalTodos,omitempty"` |
| 46 | // PinnedFiles holds metadata about standing pinned context files for this tab. |
| 47 | PinnedFiles []PinnedFileInfo `json:"pinnedFiles,omitempty"` |
| 48 | // Remote marks a remote session tab; its readiness is carried by the |
| 49 | // remote-tab state channel rather than a local controller. |
| 50 | Remote *RemoteTabRef `json:"remote,omitempty"` |
| 51 | } |
| 52 | |
| 53 | type GoalRuntimeView struct { |
| 54 | TurnsUsed int `json:"turnsUsed"` |
| 55 | TurnsLimit int `json:"turnsLimit"` // Deprecated: always 0. |
| 56 | TokensUsed int `json:"tokensUsed"` |
| 57 | RequestsUsed int `json:"requestsUsed,omitempty"` |
| 58 | WorkDurationMs int64 `json:"workDurationMs,omitempty"` |
| 59 | TokensLimit int `json:"tokensLimit"` // Deprecated: always 0; retained for bridge compatibility. |
| 60 | NoProgressTurns int `json:"noProgressTurns"` |
| 61 | NoProgressLimit int `json:"noProgressLimit"` // Deprecated: always 0. |
| 62 | LastReason string `json:"lastReason,omitempty"` |
| 63 | StopCause string `json:"stopCause,omitempty"` |
| 64 | BudgetExtensions int `json:"budgetExtensions"` // Deprecated: always 0. |
| 65 | } |
| 66 |