| 176 | |
| 177 | /** Fetch full status detail from the server via RPC. */ |
| 178 | export async function loadStatusDetail( |
| 179 | sessionId: string, |
| 180 | directory: string, |
| 181 | modelKey?: string, |
| 182 | ): Promise<StatusDetail> { |
| 183 | const emptyDetail: StatusDetail = { |
| 184 | ...EMPTY_SNAPSHOT, |
| 185 | sessionId, |
| 186 | tagCounter: 0, |
| 187 | activeTags: 0, |
| 188 | droppedTags: 0, |
| 189 | totalTags: 0, |
| 190 | activeBytes: 0, |
| 191 | lastResponseTime: 0, |
| 192 | lastNudgeTokens: 0, |
| 193 | lastTransformError: null, |
| 194 | isSubagent: false, |
| 195 | pendingOps: [], |
| 196 | contextLimit: 0, |
| 197 | cacheTtlMs: 0, |
| 198 | cacheRemainingMs: 0, |
| 199 | cacheExpired: false, |
| 200 | executeThreshold: 65, |
| 201 | executeThresholdMode: "percentage", |
| 202 | protectedTagCount: 20, |
| 203 | historyBudgetPercentage: 0.15, |
| 204 | historyBlockTokens: 0, |
| 205 | compressionBudget: null, |
| 206 | compressionUsage: null, |
| 207 | toastDurationMs: 5000, |
| 208 | }; |
| 209 | |
| 210 | if (!rpcClient) return emptyDetail; |
| 211 | try { |
| 212 | const result = await rpcClient.call<StatusDetail>("status-detail", { |
| 213 | sessionId, |
| 214 | directory, |
| 215 | modelKey, |
| 216 | }); |
| 217 | if ((result as unknown as Record<string, unknown>).error) { |
| 218 | return emptyDetail; |
| 219 | } |
| 220 | return result; |
| 221 | } catch { |
| 222 | return emptyDetail; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | const EMPTY_EMBED_DETAIL: EmbedDetail = { |
| 227 | enabled: false, |