mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
99 lines
5.9 KiB
Swift
99 lines
5.9 KiB
Swift
//
|
|
// AgentRunView.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct AgentRunView: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Actor is the \"org/sub\" identity the run was executed and billed AS. Empty means there was no PERSON — a schedule or a service token — which is a different fact from \"we do not know\", and the difference is what an audit asks about. */
|
|
public var actor: String?
|
|
/** What an operator needs to answer \"what ran, for whom, and what did it do\" — and, through traceId, to leave this record for the waterfall of the very same run rather than a search that hopefully lands near it. Agent is on the row because the org-wide feed lists runs across agents, and a run that cannot name its agent is an orphan in exactly the view built to make sense of many of them. Every field is omitempty: a run recorded before these columns existed reports absence rather than a zero it never measured. */
|
|
public var agent: String?
|
|
/** CompletionTokens is the same measurement for what the model produced, on the same final completion. It is a count of TOKENS, not of turns and not of money. */
|
|
public var completionTokens: Int64?
|
|
/** CreatedAt is when the run finished, RFC 3339 in UTC to the second — the duration above already says how long it had been going. */
|
|
public var createdAt: String?
|
|
/** DurationMs is wall-clock milliseconds around the completion, including a failover's retries. It is time SPENT, not time billed. */
|
|
public var durationMs: Int64?
|
|
/** Error is why an \"ok\"-less run failed, as the failing call reported it. Empty on every successful run. */
|
|
public var error: String?
|
|
/** ID is the run's handle, minted as \"run_\" + 32 hex characters. It is the key the metering ledger records this run's per-round token spend under, so it is how a bill and a run are joined. */
|
|
public var id: String?
|
|
/** Input is the text the run was given, verbatim. */
|
|
public var input: String?
|
|
/** Model is the model that actually SERVED this run, which is not always the one the agent is defined on — a failover records what answered. Normalized to our name on the way out; the stored row is left exactly as it happened, because a run is a record and rewriting it would be worse than the name it carries. */
|
|
public var model: String?
|
|
/** Output is what the model produced. Empty on an error run, and empty is also a legitimate answer from a run that succeeded with nothing to say — Status is what separates those. */
|
|
public var output: String?
|
|
/** PromptTokens is what the gateway reported for the run's FINAL completion, and only that one — a tool loop's earlier rounds are the metering ledger's account, joined by this run's id. Reading it as the run's total spend undercounts a loop. */
|
|
public var promptTokens: Int64?
|
|
/** Status is the run's outcome, and there are exactly two: \"ok\" when the model answered, \"error\" when it did not. It is written when the run ends, so no row here is in flight. */
|
|
public var status: String?
|
|
/** ToolCalls is how many tool dispatches the run made — a count of ACTIONS, which is a different measurement from the token counts above and from the turns a build reports. Zero is a run that answered straight from the model. */
|
|
public var toolCalls: Int64?
|
|
/** TraceID is the trace this run IS, so the record and its spans are one thing to move between: it opens the waterfall for THIS run rather than a search that lands near it. Empty when the process had no tracer, never a fabricated id. */
|
|
public var traceId: String?
|
|
|
|
public init(actor: String? = nil, agent: String? = nil, completionTokens: Int64? = nil, createdAt: String? = nil, durationMs: Int64? = nil, error: String? = nil, id: String? = nil, input: String? = nil, model: String? = nil, output: String? = nil, promptTokens: Int64? = nil, status: String? = nil, toolCalls: Int64? = nil, traceId: String? = nil) {
|
|
self.actor = actor
|
|
self.agent = agent
|
|
self.completionTokens = completionTokens
|
|
self.createdAt = createdAt
|
|
self.durationMs = durationMs
|
|
self.error = error
|
|
self.id = id
|
|
self.input = input
|
|
self.model = model
|
|
self.output = output
|
|
self.promptTokens = promptTokens
|
|
self.status = status
|
|
self.toolCalls = toolCalls
|
|
self.traceId = traceId
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case actor
|
|
case agent
|
|
case completionTokens
|
|
case createdAt
|
|
case durationMs
|
|
case error
|
|
case id
|
|
case input
|
|
case model
|
|
case output
|
|
case promptTokens
|
|
case status
|
|
case toolCalls
|
|
case traceId
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(actor, forKey: .actor)
|
|
try container.encodeIfPresent(agent, forKey: .agent)
|
|
try container.encodeIfPresent(completionTokens, forKey: .completionTokens)
|
|
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
|
try container.encodeIfPresent(durationMs, forKey: .durationMs)
|
|
try container.encodeIfPresent(error, forKey: .error)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(input, forKey: .input)
|
|
try container.encodeIfPresent(model, forKey: .model)
|
|
try container.encodeIfPresent(output, forKey: .output)
|
|
try container.encodeIfPresent(promptTokens, forKey: .promptTokens)
|
|
try container.encodeIfPresent(status, forKey: .status)
|
|
try container.encodeIfPresent(toolCalls, forKey: .toolCalls)
|
|
try container.encodeIfPresent(traceId, forKey: .traceId)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension AgentRunView: Identifiable {}
|