mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The forge tree held the package scaffolding and none of the generated sources — 2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply absent, so anything depending on this copy had a package that compiled to nothing usable. Generated from the current API document rather than reconciled with the other copy: a client is a function of the spec, so regenerating answers "which history wins" without anyone having to choose. .spec-lock records which document, so the next reader can tell.
61 lines
3.2 KiB
Swift
61 lines
3.2 KiB
Swift
//
|
|
// CodeRun.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct CodeRun: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Args become the PROGRAM's argv, never the compiler's. For the compiled languages the toolchain builds first and these are passed to the binary it produced. */
|
|
public var args: [String]?
|
|
/** Code is the WHOLE program, not a fragment: it is written to a single file and that file is what runs, so a compiled language needs its entry point and an interpreted one runs top to bottom. */
|
|
public var code: String
|
|
/** Files are inputs the host already put in some session. Each names the session its bytes live in, which is usually — and ideally — the session this run wants. */
|
|
public var files: [CodeFile]?
|
|
/** Lang selects the toolchain, and with it the filename the code is written to and the line that runs it: py, js, ts, bash, r, php, go, rs, c, cpp, java, d, f90. Anything else is refused rather than guessed at — a run in the wrong language fails somewhere deep in a compiler, which reads as an outage. */
|
|
public var lang: String
|
|
/** RuntimeSessionHint is the stateful-session hint. It is carried so a client that sends it is not silently misread, and it selects nothing here: every session in this implementation is already a warm sandbox, so there is no second kind of runtime for a hint to choose between. */
|
|
public var runtimeSessionHint: String?
|
|
/** SessionID continues an EXISTING sandbox, which is what makes runs stateful: the same filesystem, so one run's output file is the next run's input. Empty leases a fresh sandbox and the id it got comes back on the result. */
|
|
public var sessionId: String?
|
|
/** UserID attributes the run inside the caller's org. It is a label, never a tenant: the org is resolved from the validated principal and a value here cannot widen what the run may reach. */
|
|
public var userId: String?
|
|
|
|
public init(args: [String]? = nil, code: String, files: [CodeFile]? = nil, lang: String, runtimeSessionHint: String? = nil, sessionId: String? = nil, userId: String? = nil) {
|
|
self.args = args
|
|
self.code = code
|
|
self.files = files
|
|
self.lang = lang
|
|
self.runtimeSessionHint = runtimeSessionHint
|
|
self.sessionId = sessionId
|
|
self.userId = userId
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case args
|
|
case code
|
|
case files
|
|
case lang
|
|
case runtimeSessionHint = "runtime_session_hint"
|
|
case sessionId = "session_id"
|
|
case userId = "user_id"
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(args, forKey: .args)
|
|
try container.encode(code, forKey: .code)
|
|
try container.encodeIfPresent(files, forKey: .files)
|
|
try container.encode(lang, forKey: .lang)
|
|
try container.encodeIfPresent(runtimeSessionHint, forKey: .runtimeSessionHint)
|
|
try container.encodeIfPresent(sessionId, forKey: .sessionId)
|
|
try container.encodeIfPresent(userId, forKey: .userId)
|
|
}
|
|
}
|
|
|