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.
169 lines
11 KiB
Swift
169 lines
11 KiB
Swift
//
|
|
// SessionView.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct SessionView: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Account is which subscription or API account under that provider served it. Together with Provider it is what a login revoke matches on to stop the sessions a withdrawn account was paying for. */
|
|
public var account: String?
|
|
/** Actor is WHO this session belongs to, as \"org/sub\" — the same identity a run is billed under. A register that names none takes the calling principal. It is what scopes a login revoke, so a session with the wrong actor is a session the right person cannot stop. */
|
|
public var actor: String?
|
|
/** Agent is the label the surface running this session calls itself by (\"hanzo-dev\"), up to 128 characters. Required at register. It is free text, not a reference: it need not name a defined agent, and nothing resolves it. */
|
|
public var agent: String?
|
|
/** Children is the DIRECT fan-out — how many sessions name this one as parent — and not the size of the subtree. Read the tree for that. */
|
|
public var children: Int64?
|
|
/** CreatedAt is when the row was written, same format. Every path that opens a session stamps it and StartedAt from one clock reading, so the two are equal on every session this surface has ever produced. */
|
|
public var createdAt: String?
|
|
/** Cwd is the directory the session is working in NOW, not the one it started in: a linked shell moves around, and a card showing where `hanzo link` was run answers \"which work is this\" with something that was true once. */
|
|
public var cwd: String?
|
|
/** EndedAt is when it reached done or error, same format. Empty while it is still running or paused, which is how absence reads here: not over yet. */
|
|
public var endedAt: String?
|
|
/** Events is how many turns the session's log holds, counted at read time. It is the whole log, however few of them RecentEvents carries. */
|
|
public var events: Int64?
|
|
/** Execution context (mission-control): the machine/repo/cwd a card shows and the run-target a session is dispatched to. Omitted when a surface didn't report it. */
|
|
public var host: String?
|
|
/** ID is the session's handle, minted here as \"sess_\" + 32 hex characters. Every later read, patch, event append and control command is addressed with it, and a caller cannot choose it. */
|
|
public var id: String?
|
|
/** LastEvent is the compact latest-activity line for the list projection (nil in register/patch/tree responses; set by list + detail). It lets a swipe card show a live one-line preview without fetching full detail. */
|
|
public var lastEvent: LastEventView?
|
|
/** Org is the caller's OWN tenant, echoed so a client can build the public build URL (/builds/:org/:project) without a second call or a guess. It is never another tenant's — every read is org-scoped before it gets here. */
|
|
public var org: String?
|
|
/** ParentSessionID is the session that spawned this one, making this a subagent of it. Empty means this session is a root — a flow of its own. A parent always belongs to the same org, so a tree never crosses a tenant. */
|
|
public var parentSessionId: String?
|
|
/** Progress is how far along this run is — a share of its goal, a phase, and a line saying what it is doing. Always present, so a board never branches on whether it is there; `phase` says \"unknown\" when nothing has estimated it. It is a MODEL ESTIMATE wherever `estimated` is true, and the row's own word where it is false. See progress.go. */
|
|
public var progress: SessionProgress?
|
|
/** The readable build: the product this session built and whether its story is public (provenance.go). */
|
|
public var project: String?
|
|
/** Provider is the linked AI account's provider (claude | codex | hanzo | …) that served this run. Empty when the surface did not say. */
|
|
public var provider: String?
|
|
/** Published is the author's decision to let anyone read this session's story at the public build route. It only ever widens READ access to a session that already exists and grants nothing else; false, an unpublished session is invisible there no matter who asks. It cannot be true without a Project, because that route is keyed on (org, project). */
|
|
public var published: Bool?
|
|
/** Repo is the code the session is working on, as the surface reported it. It is truth the SURFACE states, so it is a label rather than something resolved here. */
|
|
public var repo: String?
|
|
/** Room is the collaborative room this run was started in (HIP-0523), empty when it came from anywhere else — a CLI, a schedule, an API call. It is what lets a space view show the runs of one room beside its messages. */
|
|
public var room: String?
|
|
/** RootSessionID is the top of this session's tree, inherited from the parent and shared by every node in one flow. A root session's own id, when it has no parent. It is the key one indexed read pulls a whole flow by, and what ?root= narrows a list or a stream to. */
|
|
public var rootSessionId: String?
|
|
/** StartedAt is when the session opened, RFC 3339 in UTC to the second. */
|
|
public var startedAt: String?
|
|
/** Status is one of exactly four: running, paused, done, error. running and paused are LIVE; done and error are TERMINAL and monotonic — once a session reaches one it can never go back, because reopening a finished run would fabricate liveness. A control command never moves it: the surface running the agent reports the new status, and until it does the command is only recorded. */
|
|
public var status: String?
|
|
/** Target is the registered run-target this session is dispatched to — a machine the org claimed, resolved same-org when it was set, so it can never point at another tenant's computer. Empty means the session names no machine. */
|
|
public var target: String?
|
|
/** TaskRunID is that workflow's particular run. A workflow is the definition and a run is one execution of it, which is why both are carried. */
|
|
public var taskRunId: String?
|
|
/** TaskWorkflowID is the hanzoai/tasks durable workflow that actually EXECUTES this session — this registry is the view, control and stream layer over it. Set, a control command is FORWARDED to that engine; empty, the running surface polls for commands instead, which is every session today. */
|
|
public var taskWorkflowId: String?
|
|
/** Terminal is where this session can be WATCHED — the URL the machine published for its live terminal. Omitted when it publishes none. */
|
|
public var terminal: String?
|
|
/** Title is the human line a card shows (\"ship the landing page\"), up to 512 characters. Free text, and the one field a surface may rewrite as the work turns out to be something else. */
|
|
public var title: String?
|
|
/** UpdatedAt is the session's last-activity clock, same format. It moves on a write to the row — a status, a title, a re-dispatch — AND on every appended turn, because the append bumps it in the same transaction. The list is ordered on CreatedAt, so this is the field that says whether a session is still saying anything. */
|
|
public var updatedAt: String?
|
|
|
|
public init(account: String? = nil, actor: String? = nil, agent: String? = nil, children: Int64? = nil, createdAt: String? = nil, cwd: String? = nil, endedAt: String? = nil, events: Int64? = nil, host: String? = nil, id: String? = nil, lastEvent: LastEventView? = nil, org: String? = nil, parentSessionId: String? = nil, progress: SessionProgress? = nil, project: String? = nil, provider: String? = nil, published: Bool? = nil, repo: String? = nil, room: String? = nil, rootSessionId: String? = nil, startedAt: String? = nil, status: String? = nil, target: String? = nil, taskRunId: String? = nil, taskWorkflowId: String? = nil, terminal: String? = nil, title: String? = nil, updatedAt: String? = nil) {
|
|
self.account = account
|
|
self.actor = actor
|
|
self.agent = agent
|
|
self.children = children
|
|
self.createdAt = createdAt
|
|
self.cwd = cwd
|
|
self.endedAt = endedAt
|
|
self.events = events
|
|
self.host = host
|
|
self.id = id
|
|
self.lastEvent = lastEvent
|
|
self.org = org
|
|
self.parentSessionId = parentSessionId
|
|
self.progress = progress
|
|
self.project = project
|
|
self.provider = provider
|
|
self.published = published
|
|
self.repo = repo
|
|
self.room = room
|
|
self.rootSessionId = rootSessionId
|
|
self.startedAt = startedAt
|
|
self.status = status
|
|
self.target = target
|
|
self.taskRunId = taskRunId
|
|
self.taskWorkflowId = taskWorkflowId
|
|
self.terminal = terminal
|
|
self.title = title
|
|
self.updatedAt = updatedAt
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case account
|
|
case actor
|
|
case agent
|
|
case children
|
|
case createdAt
|
|
case cwd
|
|
case endedAt
|
|
case events
|
|
case host
|
|
case id
|
|
case lastEvent
|
|
case org
|
|
case parentSessionId
|
|
case progress
|
|
case project
|
|
case provider
|
|
case published
|
|
case repo
|
|
case room
|
|
case rootSessionId
|
|
case startedAt
|
|
case status
|
|
case target
|
|
case taskRunId
|
|
case taskWorkflowId
|
|
case terminal
|
|
case title
|
|
case updatedAt
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(account, forKey: .account)
|
|
try container.encodeIfPresent(actor, forKey: .actor)
|
|
try container.encodeIfPresent(agent, forKey: .agent)
|
|
try container.encodeIfPresent(children, forKey: .children)
|
|
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
|
try container.encodeIfPresent(cwd, forKey: .cwd)
|
|
try container.encodeIfPresent(endedAt, forKey: .endedAt)
|
|
try container.encodeIfPresent(events, forKey: .events)
|
|
try container.encodeIfPresent(host, forKey: .host)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(lastEvent, forKey: .lastEvent)
|
|
try container.encodeIfPresent(org, forKey: .org)
|
|
try container.encodeIfPresent(parentSessionId, forKey: .parentSessionId)
|
|
try container.encodeIfPresent(progress, forKey: .progress)
|
|
try container.encodeIfPresent(project, forKey: .project)
|
|
try container.encodeIfPresent(provider, forKey: .provider)
|
|
try container.encodeIfPresent(published, forKey: .published)
|
|
try container.encodeIfPresent(repo, forKey: .repo)
|
|
try container.encodeIfPresent(room, forKey: .room)
|
|
try container.encodeIfPresent(rootSessionId, forKey: .rootSessionId)
|
|
try container.encodeIfPresent(startedAt, forKey: .startedAt)
|
|
try container.encodeIfPresent(status, forKey: .status)
|
|
try container.encodeIfPresent(target, forKey: .target)
|
|
try container.encodeIfPresent(taskRunId, forKey: .taskRunId)
|
|
try container.encodeIfPresent(taskWorkflowId, forKey: .taskWorkflowId)
|
|
try container.encodeIfPresent(terminal, forKey: .terminal)
|
|
try container.encodeIfPresent(title, forKey: .title)
|
|
try container.encodeIfPresent(updatedAt, forKey: .updatedAt)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension SessionView: Identifiable {}
|