Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by Scripts/regenerate-codex-parser-hash.sh. Do not edit by hand.

enum CodexParserHash {
static let value = "aa0b0865c496e548"
static let value = "dcab8c067490a89e"
}
23 changes: 12 additions & 11 deletions Sources/CodexBarCore/Vendored/CostUsage/CostUsageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,8 @@ enum CostUsageCacheIO {
cache.producerKey = producerKey ?? self.currentProducerKey(provider: provider)
cache.timeZoneIdentifier = calendar.timeZone.identifier

let tmp = dir.appendingPathComponent(".tmp-\(UUID().uuidString).json", isDirectory: false)
let data = (try? JSONEncoder().encode(cache)) ?? Data()
do {
try data.write(to: tmp, options: [.atomic])
if FileManager.default.fileExists(atPath: url.path) {
_ = try FileManager.default.replaceItemAt(url, withItemAt: tmp)
} else {
try FileManager.default.moveItem(at: tmp, to: url)
}
} catch {
try? FileManager.default.removeItem(at: tmp)
}
try? data.write(to: url, options: [.atomic])
}

static func currentProducerKey(
Expand Down Expand Up @@ -173,6 +163,8 @@ struct CostUsageCache: Codable {
var codexPreviousReport: CostUsageCodexPreviousReport?
/// Persistent session-id discovery and generation-scoped negative lookups for fork parents.
var codexSessionDiscovery: CostUsageCodexSessionDiscovery?
/// Resumable bounded discovery for recently modified rollouts in older date partitions.
var codexActiveLookbackState: CostUsageCodexActiveLookbackState?

/// filePath -> file usage
var files: [String: CostUsageFileUsage] = [:]
Expand All @@ -184,6 +176,15 @@ struct CostUsageCache: Codable {
var roots: [String: Int64]?
}

struct CostUsageCodexActiveLookbackState: Codable {
var scanSinceKey: String
var rootPaths: [String]
var nextDayKeyByRoot: [String: String] = [:]
var completedRootPaths: [String] = []
var pendingFilePaths: [String] = []
var legacyRecursivePendingRootPaths: [String] = []
}

struct CostUsageCodexSessionDiscovery: Codable {
struct DirectoryStamp: Codable, Equatable {
var mtimeUnixMs: Int64
Expand Down
Loading