Add clickable run detail view to Jarvis run history; fix field mismatches

Each row in the Run History list now opens a Run Details sheet showing
the full, untruncated output/error (the old inline chevron-expand
capped output at 20 lines) plus duration, trigger, tokens, and cost.
Output/error use an explicit Copy button rather than
.textSelection(.enabled), to avoid the same Escape-beeps-instead-of-
dismissing bug just fixed in ModelInfoView.

While wiring this up, found the JarvisAgentRun model didn't match the
real oAI-Web API response shape: output decoded from a nonexistent
"output" key instead of "result" (always nil, hence "No output for
this run" even on successful runs with real content), finishedAt
decoded from "finished_at" instead of "ended_at" (Duration silently
never showed), and the status icon only recognized "completed"/
"failed" instead of the API's actual "success"/"error" values (plain
gray circle instead of a green checkmark). Fixed all three, verified
against a real API response, added 4 decoding tests.
This commit is contained in:
2026-08-07 13:31:39 +02:00
parent 91f67f891b
commit 1925c9c657
3 changed files with 256 additions and 64 deletions
+4 -3
View File
@@ -69,7 +69,7 @@ struct JarvisAgentInput: Codable, Sendable {
struct JarvisAgentRun: Identifiable, Codable, Sendable {
let id: String
let agentId: String?
let status: String // "running" | "completed" | "failed" | "stopped"
let status: String // "running" | "success" | "failed"/"error" | "stopped" (server-observed; not formally documented)
let startedAt: String?
let finishedAt: String?
let output: String?
@@ -80,10 +80,11 @@ struct JarvisAgentRun: Identifiable, Codable, Sendable {
let triggerType: String?
enum CodingKeys: String, CodingKey {
case id, status, output, error
case id, status, error
case agentId = "agent_id"
case startedAt = "started_at"
case finishedAt = "finished_at"
case finishedAt = "ended_at"
case output = "result"
case costUsd = "cost_usd"
case inputTokens = "input_tokens"
case outputTokens = "output_tokens"