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.
76 lines
3.6 KiB
Swift
76 lines
3.6 KiB
Swift
//
|
|
// Span.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Span: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** EndLine is the last line of the span, inclusive. It equals Line for a one-line span rather than being zero or absent. */
|
|
public var endLine: Int64?
|
|
/** File is the path inside the repo, relative to its root and never absolute. */
|
|
public var file: String?
|
|
/** Kind is what the indexer decided this chunk IS — \"func\", \"method\", \"type\", \"struct\", \"interface\", \"var\", \"const\", or \"block\" for a run of code that declares nothing. Absent when the chunker could not classify it. */
|
|
public var kind: String?
|
|
/** Line is where the span starts, 1-based, as an editor counts. */
|
|
public var line: Int64?
|
|
/** Repo is the indexed repository the span was found in, as it was indexed (\"owner/name\"). A search may be scoped to one repo or run across all of them, so this is how a caller tells the results apart. */
|
|
public var repo: String?
|
|
/** context: match | definition | caller */
|
|
public var role: String?
|
|
/** Score ranks this span against the OTHERS IN THE SAME RESPONSE and means nothing across responses or between tiers: the hybrid tier's number is a reciprocal-rank fusion sum (Σ 1/(60+rank), so tenths at best), the symbol tier's is a descending position count, and the text and semantic tiers pass through bm25 and cosine. Compare within a list; never threshold on it. */
|
|
public var score: Double?
|
|
/** Snippet is the code itself: a bounded excerpt on /search, the whole chunk on /context — which is why the same type serves both and why a /context span is the one an agent pastes into its window. */
|
|
public var snippet: String?
|
|
/** Symbol is the declared name, when the span declares one. Absent on a block. */
|
|
public var symbol: String?
|
|
/** Tier is which retrieval produced the span: \"hybrid\" (the default — all three fused), \"text\" (trigram/FTS), \"regex\", \"semantic\" (vector), or \"symbol\". It is what explains a Score, so the two travel together. */
|
|
public var tier: String?
|
|
|
|
public init(endLine: Int64? = nil, file: String? = nil, kind: String? = nil, line: Int64? = nil, repo: String? = nil, role: String? = nil, score: Double? = nil, snippet: String? = nil, symbol: String? = nil, tier: String? = nil) {
|
|
self.endLine = endLine
|
|
self.file = file
|
|
self.kind = kind
|
|
self.line = line
|
|
self.repo = repo
|
|
self.role = role
|
|
self.score = score
|
|
self.snippet = snippet
|
|
self.symbol = symbol
|
|
self.tier = tier
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case endLine
|
|
case file
|
|
case kind
|
|
case line
|
|
case repo
|
|
case role
|
|
case score
|
|
case snippet
|
|
case symbol
|
|
case tier
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(endLine, forKey: .endLine)
|
|
try container.encodeIfPresent(file, forKey: .file)
|
|
try container.encodeIfPresent(kind, forKey: .kind)
|
|
try container.encodeIfPresent(line, forKey: .line)
|
|
try container.encodeIfPresent(repo, forKey: .repo)
|
|
try container.encodeIfPresent(role, forKey: .role)
|
|
try container.encodeIfPresent(score, forKey: .score)
|
|
try container.encodeIfPresent(snippet, forKey: .snippet)
|
|
try container.encodeIfPresent(symbol, forKey: .symbol)
|
|
try container.encodeIfPresent(tier, forKey: .tier)
|
|
}
|
|
}
|
|
|