sneakoscope 8.0.2 → 8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -23
- package/config/skills-hash-ledger.v1.json +1 -1
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +55 -13
- package/dist/bin/sks-dispatch.js +1 -1
- package/dist/cli/command-manifest-lite.js +4 -0
- package/dist/cli/command-registry.js +4 -0
- package/dist/cli/install-helpers-codex-lb-chain.js +187 -0
- package/dist/cli/install-helpers-codex-lb-config.js +74 -8
- package/dist/cli/install-helpers.js +89 -44
- package/dist/commands/codex-lb.js +117 -19
- package/dist/commands/doctor.js +697 -37
- package/dist/config/skills-manifest.json +3 -2
- package/dist/core/agents/agent-runner-codex-exec.js +5 -3
- package/dist/core/codex/codex-config-guard.js +238 -52
- package/dist/core/codex-adapter.js +5 -3
- package/dist/core/codex-app/menubar/constants.js +10 -1
- package/dist/core/codex-app/menubar/global-install.js +288 -0
- package/dist/core/codex-app/menubar/installer.js +79 -14
- package/dist/core/codex-app/menubar/launch-agent.js +267 -45
- package/dist/core/codex-app/menubar/paths.js +3 -0
- package/dist/core/codex-app/menubar/rollback.js +55 -7
- package/dist/core/codex-app/menubar/status.js +75 -4
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +3 -1
- package/dist/core/codex-control/codex-0139-web-search-probe.js +3 -1
- package/dist/core/codex-control/codex-app-server-runtime-env.js +13 -4
- package/dist/core/codex-control/codex-app-server-v2-client.js +3 -3
- package/dist/core/codex-exec-output-schema.js +4 -1
- package/dist/core/codex-lb/codex-lb-env.js +63 -72
- package/dist/core/codex-lb/codex-lb-setup.js +15 -2
- package/dist/core/codex-lb/desktop-center-credentials.js +517 -58
- package/dist/core/codex-lb/desktop-controller.js +153 -24
- package/dist/core/codex-lb/routing-truth.js +327 -0
- package/dist/core/codex-native/core-skill-manifest.js +1 -1
- package/dist/core/commands/basic-cli.js +7 -1
- package/dist/core/commands/qa-loop-command.js +3 -1
- package/dist/core/commands/telegram-command.js +241 -0
- package/dist/core/config-adopt/config-adopt-command.js +35 -0
- package/dist/core/config-adopt/config-adopt.js +346 -0
- package/dist/core/config-adopt/index.js +3 -0
- package/dist/core/doctor/command-alias-cleanup.js +4 -1
- package/dist/core/doctor/current-project-guidance-nested.js +37 -6
- package/dist/core/doctor/current-project-guidance.js +11 -6
- package/dist/core/doctor/doctor-readiness-matrix.js +14 -0
- package/dist/core/doctor/retired-managed-residue-private.js +1 -1
- package/dist/core/doctor/sks-menubar-doctor.js +4 -0
- package/dist/core/feature-fixtures.js +8 -0
- package/dist/core/hooks-runtime/hook-context.js +9 -0
- package/dist/core/hooks-runtime/managed-skill-admission.js +54 -4
- package/dist/core/hooks-runtime/official-subagent-lifecycle.js +69 -1
- package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +2 -2
- package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +3 -3
- package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +43 -5
- package/dist/core/hooks-runtime/subagent-skill-availability.js +64 -30
- package/dist/core/hooks-runtime/subagent-stop-hook.js +15 -2
- package/dist/core/hooks-runtime.js +148 -4
- package/dist/core/imagegen/imagegen-capability.js +46 -0
- package/dist/core/imagegen/require-imagegen.js +2 -2
- package/dist/core/init/skills.js +17 -3
- package/dist/core/install/installed-package-smoke.js +8 -2
- package/dist/core/naruto/hardware-capacity-probe.js +9 -3
- package/dist/core/naruto/naruto-concurrency-governor.js +68 -24
- package/dist/core/perf/import-graph-budget.js +0 -1
- package/dist/core/product-design-app-server.js +13 -1
- package/dist/core/release/package-size-budget.js +2 -2
- package/dist/core/release/release-pack-receipt.js +1 -2
- package/dist/core/routes/dollar-manifest-lite.js +1 -1
- package/dist/core/routes.js +1 -1
- package/dist/core/security/private-credential-file.js +209 -0
- package/dist/core/subagents/agent-catalog.js +17 -32
- package/dist/core/subagents/naruto-help-contract.js +5 -5
- package/dist/core/subagents/official-subagent-config.js +16 -6
- package/dist/core/subagents/official-subagent-preparation.js +34 -15
- package/dist/core/subagents/official-subagent-prompt.js +4 -4
- package/dist/core/subagents/official-subagent-runner.js +27 -4
- package/dist/core/subagents/thread-budget.js +19 -12
- package/dist/core/subagents/wave-lifecycle.js +18 -6
- package/dist/core/telegram/access.js +54 -0
- package/dist/core/telegram/client.js +144 -0
- package/dist/core/telegram/confirmation.js +37 -0
- package/dist/core/telegram/doctor.js +151 -0
- package/dist/core/telegram/index.js +9 -0
- package/dist/core/telegram/keychain.js +265 -0
- package/dist/core/telegram/liveness.js +109 -0
- package/dist/core/telegram/poller.js +90 -0
- package/dist/core/telegram/redaction.js +15 -0
- package/dist/core/telegram/types.js +1 -0
- package/dist/core/update/update-diagnostics.js +52 -0
- package/dist/core/update/update-migration-state.js +5 -1
- package/dist/core/update/update-operation.js +2 -1
- package/dist/core/update/update-stage-diagnostics.js +38 -0
- package/dist/core/update/update-status.js +2 -9
- package/dist/core/update-check.js +147 -31
- package/dist/core/version.js +1 -1
- package/dist/core/zellij/zellij-launcher.js +23 -4
- package/dist/native/sks-menubar/Sources/AppDelegate.swift +13 -0
- package/dist/native/sks-menubar/Sources/AppIdentity.swift +7 -0
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +3 -2
- package/dist/native/sks-menubar/Sources/ProvidersConnectTest.swift +115 -0
- package/dist/native/sks-menubar/Sources/ProvidersFastMode.swift +17 -0
- package/dist/native/sks-menubar/Sources/ProvidersRoutingTruth.swift +190 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +100 -59
- package/dist/native/sks-menubar/Sources/SingletonInstanceGuard.swift +328 -0
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileStore.swift +320 -0
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileSupport.swift +303 -0
- package/dist/native/sks-menubar/Sources/TelegramProcessGateway.swift +238 -0
- package/dist/native/sks-menubar/Sources/TelegramRuntimeSupport.swift +56 -0
- package/dist/native/sks-menubar/Sources/TelegramSupport.swift +56 -0
- package/dist/native/sks-menubar/Sources/TelegramTransport.swift +474 -0
- package/dist/native/sks-menubar/Sources/main.swift +15 -1
- package/dist/native/sks-menubar/Tests/OperationCoordinatorTests.swift +4 -3
- package/dist/native/sks-menubar/Tests/ProvidersViewControllerTests.swift +129 -0
- package/dist/native/sks-menubar/Tests/SingletonInstanceGuardTests.swift +183 -0
- package/dist/native/sks-menubar/Tests/TelegramRuntimeSmokeTests.swift +267 -0
- package/dist/native/sks-menubar/Tests/TelegramRuntimeTests.swift +222 -0
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -1
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +1 -1
- package/dist/scripts/current-command-surface-check.js +2 -4
- package/dist/scripts/official-subagent-workflow-check.js +1 -1
- package/dist/scripts/packlist-performance-check.js +1 -2
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Cocoa
|
|
2
|
+
|
|
3
|
+
extension ProvidersViewController {
|
|
4
|
+
func makeCliConnectProgressView() -> NSStackView {
|
|
5
|
+
cliConnectConfigurationStage.setAccessibilityLabel("Codex LB configuration stage: waiting")
|
|
6
|
+
cliConnectConfigurationStage.setAccessibilityIdentifier("sks-center-codex-lb-configuration-stage")
|
|
7
|
+
cliConnectRequestStage.setAccessibilityLabel("Codex LB one-request low-token test stage: waiting")
|
|
8
|
+
cliConnectRequestStage.setAccessibilityIdentifier("sks-center-codex-lb-request-stage")
|
|
9
|
+
cliConnectResponseStage.setAccessibilityLabel("Codex LB response stage: not received")
|
|
10
|
+
cliConnectResponseStage.setAccessibilityIdentifier("sks-center-codex-lb-response-stage")
|
|
11
|
+
cliConnectResult.setAccessibilityLabel("Codex LB connection proof result: not run")
|
|
12
|
+
cliConnectResult.setAccessibilityIdentifier("sks-center-codex-lb-connect-result")
|
|
13
|
+
let title = NativeView.sectionTitle("Connection Proof")
|
|
14
|
+
title.setAccessibilityIdentifier("sks-center-codex-lb-connect-heading")
|
|
15
|
+
let stack = NSStackView(views: [title, cliConnectProgress, cliConnectConfigurationStage, cliConnectRequestStage, cliConnectResponseStage, cliConnectResult])
|
|
16
|
+
stack.orientation = .vertical
|
|
17
|
+
stack.alignment = .width
|
|
18
|
+
stack.spacing = 6
|
|
19
|
+
stack.setAccessibilityRole(.group)
|
|
20
|
+
stack.setAccessibilityLabel("Codex LB connection proof")
|
|
21
|
+
stack.setAccessibilityIdentifier("sks-center-codex-lb-connect-proof")
|
|
22
|
+
return stack
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
func renderCliConnectStages(
|
|
26
|
+
progress: Double,
|
|
27
|
+
configuration: String,
|
|
28
|
+
request: String,
|
|
29
|
+
response: String,
|
|
30
|
+
result: String,
|
|
31
|
+
tone: NSColor
|
|
32
|
+
) {
|
|
33
|
+
cliConnectProgress.doubleValue = min(3, max(0, progress))
|
|
34
|
+
cliConnectProgress.setAccessibilityValue("Stage \(Int(cliConnectProgress.doubleValue)) of 3")
|
|
35
|
+
cliConnectConfigurationStage.stringValue = "1. Configuration · \(configuration)"
|
|
36
|
+
cliConnectConfigurationStage.setAccessibilityLabel("Codex LB configuration stage: \(configuration)")
|
|
37
|
+
cliConnectRequestStage.stringValue = "2. One-request low-token test · \(request)"
|
|
38
|
+
cliConnectRequestStage.setAccessibilityLabel("Codex LB one-request low-token test stage: \(request)")
|
|
39
|
+
cliConnectResponseStage.stringValue = "3. Response · \(response)"
|
|
40
|
+
cliConnectResponseStage.setAccessibilityLabel("Codex LB response stage: \(response)")
|
|
41
|
+
cliConnectResult.stringValue = result
|
|
42
|
+
cliConnectResult.textColor = tone
|
|
43
|
+
cliConnectResult.setAccessibilityLabel("Codex LB connection proof result: \(result)")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@objc func testConnection() {
|
|
47
|
+
runConnectTest()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func runConnectTest() {
|
|
51
|
+
guard !connectTestInFlight else {
|
|
52
|
+
cliProviderStatus.stringValue = "A Codex LB connection proof is already running."
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
guard !busy else { cliProviderStatus.stringValue = "Another provider action is already running."; return }
|
|
56
|
+
guard let snapshot = operations.begin(kind: "codex-lb-connect-test", mutationGroup: nil, summary: "Run Codex LB connect test") else {
|
|
57
|
+
cliProviderStatus.stringValue = "Another guarded operation is already running. Wait or open Diagnostics."
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
connectTestInFlight = true
|
|
61
|
+
setBusy(true)
|
|
62
|
+
cliProviderStatus.stringValue = "Codex LB mode \(codexLbSelectedNow ? "selected" : "selection unconfirmed") · sending one bounded low-token request…"
|
|
63
|
+
renderCliConnectStages(
|
|
64
|
+
progress: 2,
|
|
65
|
+
configuration: codexLbSelectedNow ? "CLI provider selected" : "selection unconfirmed",
|
|
66
|
+
request: "sending one bounded request…",
|
|
67
|
+
response: "waiting",
|
|
68
|
+
result: "Waiting for structured proof. Connectivity has not been claimed.",
|
|
69
|
+
tone: .secondaryLabelColor
|
|
70
|
+
)
|
|
71
|
+
_ = operations.update(snapshot, state: .running, stage: "one-request-low-token-test", progress: 2.0 / 3.0, summary: "Run Codex LB connect test")
|
|
72
|
+
processClient.run(["codex-lb", "connect-test", "--json"], timeout: NativeView.mutationTimeout) { [weak self] result in
|
|
73
|
+
guard let self = self else { return }
|
|
74
|
+
self.connectTestInFlight = false
|
|
75
|
+
self.setBusy(false)
|
|
76
|
+
let parsed = self.json(result.output)
|
|
77
|
+
let proof = parsed.flatMap(CodexLbConnectTestTruth.success(from:))
|
|
78
|
+
let proved = result.code == 0 && proof != nil
|
|
79
|
+
_ = self.operations.update(snapshot, state: proved ? .succeeded : .failed, stage: "complete", progress: 1, summary: proved ? "Codex LB connection proved" : "Codex LB connection proof failed")
|
|
80
|
+
if let proof = proof, result.code == 0 {
|
|
81
|
+
self.codexLbSelectedNow = true
|
|
82
|
+
self.cliProviderStatus.stringValue = "Codex LB mode selected · connection proved by one live response."
|
|
83
|
+
ControlKit.setBadge(self.activeProviderBadge, text: "Codex LB · active · model \(proof.model) · \(proof.latencyMs) ms", tone: .ok)
|
|
84
|
+
self.renderCliConnectStages(
|
|
85
|
+
progress: 3,
|
|
86
|
+
configuration: "CLI provider selected",
|
|
87
|
+
request: "completed · \(proof.outputTokens) output tokens",
|
|
88
|
+
response: "received · id \(proof.responseId)",
|
|
89
|
+
result: proof.renderedSummary,
|
|
90
|
+
tone: .systemGreen
|
|
91
|
+
)
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
let selected = self.codexLbSelectedNow
|
|
95
|
+
let failure = parsed.map(CodexLbConnectTestTruth.validationFailure(from:))
|
|
96
|
+
?? "structured connect-test JSON was not returned"
|
|
97
|
+
self.cliProviderStatus.stringValue = selected
|
|
98
|
+
? "Codex LB mode is selected, but connection proof failed · \(failure)."
|
|
99
|
+
: "Codex LB connection proof failed and provider selection is unconfirmed · \(failure)."
|
|
100
|
+
if selected {
|
|
101
|
+
ControlKit.setBadge(self.activeProviderBadge, text: "Codex LB · selected · connection proof failed", tone: .warning)
|
|
102
|
+
}
|
|
103
|
+
self.renderCliConnectStages(
|
|
104
|
+
progress: 3,
|
|
105
|
+
configuration: selected ? "CLI provider remains selected" : "selection unconfirmed",
|
|
106
|
+
request: "completed without valid proof",
|
|
107
|
+
response: "failed",
|
|
108
|
+
result: selected
|
|
109
|
+
? "Mode is selected, but connection proof failed · \(failure). Use Run Connect Test to retry."
|
|
110
|
+
: "Connection proof failed · \(failure). Confirm the provider, then retry.",
|
|
111
|
+
tone: .systemRed
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Cocoa
|
|
2
|
+
|
|
3
|
+
extension ProvidersViewController {
|
|
4
|
+
func refreshFastStatus() {
|
|
5
|
+
if !busy { fastStatus.stringValue = "Codex Fast: checking the official service-tier setting…" }
|
|
6
|
+
processClient.run(["fast-mode", "status", "--json"], timeout: NativeView.statusTimeout) { [weak self] result in
|
|
7
|
+
guard let self = self else { return }
|
|
8
|
+
guard result.code == 0, let json = self.json(result.output),
|
|
9
|
+
let global = json["global"] as? [String: Any], let on = global["on"] as? Bool else {
|
|
10
|
+
self.fastStatus.stringValue = "Codex Fast: unavailable — no state was assumed."
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
let tier = global["service_tier"] as? String ?? (on ? "fast" : "default")
|
|
14
|
+
self.fastStatus.stringValue = "Codex Fast: \(on ? "On" : "Off") · official service_tier=\(tier) · model and reasoning remain separate."
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -5,6 +5,42 @@ import Foundation
|
|
|
5
5
|
/// bridge modes, `provider.selected == true` means the built-in OpenAI /
|
|
6
6
|
/// ChatGPT OAuth provider is selected.
|
|
7
7
|
struct ProviderRoutingTruth {
|
|
8
|
+
enum MeasuredState: Equatable {
|
|
9
|
+
case inactive
|
|
10
|
+
case active
|
|
11
|
+
case degraded
|
|
12
|
+
case unverified
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct MeasuredRoute {
|
|
16
|
+
let selected: Bool
|
|
17
|
+
let measured: Bool
|
|
18
|
+
let fresh: Bool
|
|
19
|
+
let ok: Bool
|
|
20
|
+
let status: String
|
|
21
|
+
let configuredHost: String?
|
|
22
|
+
let actualHost: String?
|
|
23
|
+
let authTransport: String?
|
|
24
|
+
let authOutcome: String?
|
|
25
|
+
let httpStatus: Int?
|
|
26
|
+
let measuredAt: String?
|
|
27
|
+
let latencyMs: Int?
|
|
28
|
+
let blockers: [String]
|
|
29
|
+
|
|
30
|
+
var active: Bool {
|
|
31
|
+
selected && measured && fresh && ok && status == "verified"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var state: MeasuredState {
|
|
35
|
+
guard selected else { return .inactive }
|
|
36
|
+
if active { return .active }
|
|
37
|
+
if !measured || !fresh || status == "selected_unmeasured" || status == "stale" {
|
|
38
|
+
return .unverified
|
|
39
|
+
}
|
|
40
|
+
return .degraded
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
8
44
|
struct Snapshot {
|
|
9
45
|
let mode: String?
|
|
10
46
|
let desktopFullRouting: Bool
|
|
@@ -53,6 +89,28 @@ struct ProviderRoutingTruth {
|
|
|
53
89
|
)
|
|
54
90
|
}
|
|
55
91
|
|
|
92
|
+
static func measuredRoute(from json: [String: Any]) -> MeasuredRoute? {
|
|
93
|
+
guard let truth = json["routing_truth"] as? [String: Any],
|
|
94
|
+
truth["schema"] as? String == "sks.codex-lb-routing-truth.v1" else {
|
|
95
|
+
return nil
|
|
96
|
+
}
|
|
97
|
+
return MeasuredRoute(
|
|
98
|
+
selected: truth["selected"] as? Bool == true,
|
|
99
|
+
measured: truth["measured"] as? Bool == true,
|
|
100
|
+
fresh: truth["fresh"] as? Bool == true,
|
|
101
|
+
ok: truth["ok"] as? Bool == true,
|
|
102
|
+
status: truth["status"] as? String ?? "unavailable",
|
|
103
|
+
configuredHost: truth["configured_host"] as? String,
|
|
104
|
+
actualHost: truth["actual_host"] as? String,
|
|
105
|
+
authTransport: truth["auth_transport"] as? String,
|
|
106
|
+
authOutcome: truth["auth_outcome"] as? String,
|
|
107
|
+
httpStatus: (truth["http_status"] as? NSNumber)?.intValue,
|
|
108
|
+
measuredAt: truth["measured_at"] as? String ?? truth["checked_at"] as? String,
|
|
109
|
+
latencyMs: (truth["latency_ms"] as? NSNumber)?.intValue,
|
|
110
|
+
blockers: truth["blockers"] as? [String] ?? []
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
56
114
|
static func desktopMode(_ json: [String: Any]) -> String? {
|
|
57
115
|
if let mode = json["desktop_mode"] as? String, !mode.isEmpty { return mode }
|
|
58
116
|
if let mode = json["mode"] as? String, !mode.isEmpty { return mode }
|
|
@@ -129,3 +187,135 @@ struct CapabilityVerificationTruth {
|
|
|
129
187
|
}
|
|
130
188
|
}
|
|
131
189
|
}
|
|
190
|
+
|
|
191
|
+
extension ProvidersViewController {
|
|
192
|
+
func describeRoutingTruth(_ route: ProviderRoutingTruth.MeasuredRoute?) -> String {
|
|
193
|
+
guard let route = route else { return "measured route unavailable · blocker=codex_lb_routing_truth_unavailable" }
|
|
194
|
+
let host = route.actualHost ?? route.configuredHost ?? "host unavailable"
|
|
195
|
+
let auth = route.authOutcome ?? "auth unmeasured"
|
|
196
|
+
let measuredAt = route.measuredAt ?? "time unavailable"
|
|
197
|
+
let latency = route.latencyMs.map { "\($0) ms" } ?? "latency unavailable"
|
|
198
|
+
let http = route.httpStatus.map { " · HTTP \($0)" } ?? ""
|
|
199
|
+
let blockers = route.blockers.isEmpty ? "" : " · blockers=\(route.blockers.prefix(3).joined(separator: ", "))"
|
|
200
|
+
return "status=\(route.status) · host=\(host) · auth=\(auth) · measured=\(measuredAt) · latency=\(latency)\(http)\(blockers)"
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
func renderMeasuredRoutingBadge(_ route: ProviderRoutingTruth.MeasuredRoute?, routeExpected: Bool) {
|
|
204
|
+
guard let route = route else {
|
|
205
|
+
if routeExpected {
|
|
206
|
+
ControlKit.setBadge(activeProviderBadge, text: "Codex LB · unverified · blocker=codex_lb_routing_truth_unavailable", tone: .warning)
|
|
207
|
+
}
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
guard route.selected else { return }
|
|
211
|
+
switch route.state {
|
|
212
|
+
case .active:
|
|
213
|
+
ControlKit.setBadge(activeProviderBadge, text: "Codex LB · active · \(describeRoutingTruth(route))", tone: .ok)
|
|
214
|
+
case .degraded:
|
|
215
|
+
ControlKit.setBadge(activeProviderBadge, text: "Codex LB · degraded · \(describeRoutingTruth(route))", tone: .warning)
|
|
216
|
+
case .unverified:
|
|
217
|
+
ControlKit.setBadge(activeProviderBadge, text: "Codex LB · unverified · \(describeRoutingTruth(route))", tone: .warning)
|
|
218
|
+
case .inactive:
|
|
219
|
+
break
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
struct CodexLbConnectTestTruth {
|
|
225
|
+
static let schema = "sks.codex-lb-connect-test.v1"
|
|
226
|
+
static let maximumAcceptedOutputTokens = 128
|
|
227
|
+
static let maximumRenderedReplyCharacters = 240
|
|
228
|
+
|
|
229
|
+
struct Success {
|
|
230
|
+
let model: String
|
|
231
|
+
let latencyMs: Int
|
|
232
|
+
let responseId: String
|
|
233
|
+
let reply: String
|
|
234
|
+
let inputTokens: Int
|
|
235
|
+
let outputTokens: Int
|
|
236
|
+
let totalTokens: Int
|
|
237
|
+
let httpStatus: Int
|
|
238
|
+
|
|
239
|
+
var renderedSummary: String {
|
|
240
|
+
"Model \(model) · latency \(latencyMs) ms · tokens \(inputTokens) in / \(outputTokens) out / \(totalTokens) total · reply: \(reply)"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static func success(from json: [String: Any]) -> Success? {
|
|
245
|
+
guard validationFailure(from: json) == "none",
|
|
246
|
+
let model = nonemptyString(json["model"]),
|
|
247
|
+
let latencyMs = integer(json["latency_ms"]),
|
|
248
|
+
let responseId = nonemptyString(json["response_id"]),
|
|
249
|
+
let rawReply = nonemptyString(json["result"]),
|
|
250
|
+
let usage = json["usage"] as? [String: Any],
|
|
251
|
+
let inputTokens = integer(usage["input_tokens"]),
|
|
252
|
+
let outputTokens = integer(usage["output_tokens"]),
|
|
253
|
+
let totalTokens = integer(usage["total_tokens"]),
|
|
254
|
+
let httpStatus = integer(json["http_status"]) else { return nil }
|
|
255
|
+
return Success(
|
|
256
|
+
model: model,
|
|
257
|
+
latencyMs: latencyMs,
|
|
258
|
+
responseId: responseId,
|
|
259
|
+
reply: boundedReply(rawReply),
|
|
260
|
+
inputTokens: inputTokens,
|
|
261
|
+
outputTokens: outputTokens,
|
|
262
|
+
totalTokens: totalTokens,
|
|
263
|
+
httpStatus: httpStatus
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
static func validationFailure(from json: [String: Any]) -> String {
|
|
268
|
+
guard json["schema"] as? String == schema else { return "unexpected or missing schema" }
|
|
269
|
+
guard json["ok"] as? Bool == true else { return publicFailure(from: json) }
|
|
270
|
+
guard json["status"] as? String == "connected" else { return "status is not connected" }
|
|
271
|
+
guard nonemptyString(json["model"]) != nil else { return "model evidence is missing" }
|
|
272
|
+
guard let latencyMs = integer(json["latency_ms"]), latencyMs >= 0 else { return "latency evidence is invalid" }
|
|
273
|
+
guard nonemptyString(json["response_id"]) != nil else { return "response id is missing" }
|
|
274
|
+
guard nonemptyString(json["result"]) != nil else { return "returned reply is empty" }
|
|
275
|
+
guard json["result_truncated"] as? Bool != nil else { return "result bound evidence is missing" }
|
|
276
|
+
guard let httpStatus = integer(json["http_status"]), (200..<300).contains(httpStatus) else {
|
|
277
|
+
return "HTTP success evidence is invalid"
|
|
278
|
+
}
|
|
279
|
+
guard let blockers = json["blockers"] as? [String], blockers.isEmpty else {
|
|
280
|
+
return "success blockers are not empty"
|
|
281
|
+
}
|
|
282
|
+
guard let usage = json["usage"] as? [String: Any],
|
|
283
|
+
let inputTokens = integer(usage["input_tokens"]), inputTokens >= 0,
|
|
284
|
+
let outputTokens = integer(usage["output_tokens"]), outputTokens >= 0,
|
|
285
|
+
let totalTokens = integer(usage["total_tokens"]), totalTokens >= 0,
|
|
286
|
+
totalTokens == inputTokens + outputTokens else { return "token usage evidence is invalid" }
|
|
287
|
+
guard outputTokens <= maximumAcceptedOutputTokens else { return "low-token request evidence is invalid" }
|
|
288
|
+
return "none"
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
static func boundedReply(_ value: String) -> String {
|
|
292
|
+
let compact = value.split(whereSeparator: { $0.isWhitespace }).joined(separator: " ")
|
|
293
|
+
guard compact.count > maximumRenderedReplyCharacters else { return compact }
|
|
294
|
+
return String(compact.prefix(maximumRenderedReplyCharacters)) + "…"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
private static func publicFailure(from json: [String: Any]) -> String {
|
|
298
|
+
if let blockers = json["blockers"] as? [String], !blockers.isEmpty {
|
|
299
|
+
return "blocked: \(blockers.prefix(3).joined(separator: ", "))"
|
|
300
|
+
}
|
|
301
|
+
if let error = nonemptyString(json["error"]) { return boundedReply(error) }
|
|
302
|
+
if let status = nonemptyString(json["status"]) { return "status=\(boundedReply(status))" }
|
|
303
|
+
return "ok was not true"
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
private static func nonemptyString(_ value: Any?) -> String? {
|
|
307
|
+
guard let raw = value as? String else { return nil }
|
|
308
|
+
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
309
|
+
return trimmed.isEmpty ? nil : trimmed
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private static func integer(_ value: Any?) -> Int? {
|
|
313
|
+
guard !(value is Bool), let number = value as? NSNumber else { return nil }
|
|
314
|
+
let double = number.doubleValue
|
|
315
|
+
guard double.isFinite,
|
|
316
|
+
double.rounded(.towardZero) == double,
|
|
317
|
+
double >= Double(Int.min),
|
|
318
|
+
double <= Double(Int.max) else { return nil }
|
|
319
|
+
return number.intValue
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -12,6 +12,21 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
12
12
|
let operations: OperationCoordinator
|
|
13
13
|
let providerStatus = NativeView.detail("Desktop routing status unchecked.")
|
|
14
14
|
let cliProviderStatus = NativeView.detail("CLI provider status unchecked.")
|
|
15
|
+
let cliConnectConfigurationStage = NativeView.detail("1. Configuration · waiting")
|
|
16
|
+
let cliConnectRequestStage = NativeView.detail("2. One-request low-token test · waiting")
|
|
17
|
+
let cliConnectResponseStage = NativeView.detail("3. Response · not received")
|
|
18
|
+
let cliConnectResult = NativeView.detail("Connection proof has not run.")
|
|
19
|
+
let cliConnectProgress: NSProgressIndicator = {
|
|
20
|
+
let progress = NSProgressIndicator()
|
|
21
|
+
progress.style = .bar
|
|
22
|
+
progress.isIndeterminate = false
|
|
23
|
+
progress.minValue = 0
|
|
24
|
+
progress.maxValue = 3
|
|
25
|
+
progress.doubleValue = 0
|
|
26
|
+
progress.setAccessibilityLabel("Codex LB connection proof progress")
|
|
27
|
+
progress.setAccessibilityIdentifier("sks-center-codex-lb-connect-progress")
|
|
28
|
+
return progress
|
|
29
|
+
}()
|
|
15
30
|
let capabilityStatus = NativeView.detail("Capabilities have not been verified.")
|
|
16
31
|
let openRouterCredentialStatus = NativeView.detail("Credential: checking…")
|
|
17
32
|
let openRouterActiveStatus = NativeView.detail("Active provider: checking…")
|
|
@@ -51,6 +66,7 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
51
66
|
var roleRefreshInFlight = false
|
|
52
67
|
var openRouterModelSelectionPending = false
|
|
53
68
|
var openRouterActionRan = false
|
|
69
|
+
var connectTestInFlight = false
|
|
54
70
|
var busy = false
|
|
55
71
|
init(processClient: ProcessClient, operations: OperationCoordinator) {
|
|
56
72
|
self.processClient = processClient
|
|
@@ -59,32 +75,35 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
59
75
|
}
|
|
60
76
|
required init?(coder: NSCoder) { nil }
|
|
61
77
|
override func loadView() {
|
|
62
|
-
let enableDesktop =
|
|
78
|
+
let enableDesktop = NativeView.button("Desktop Bridge Mode (keeps ChatGPT sign-in)", target: self, action: #selector(enableDesktopFull))
|
|
63
79
|
let verifyDesktop = NativeView.button("Verify Capabilities", target: self, action: #selector(verifyDesktopCapabilities))
|
|
64
80
|
let disableDesktop = NativeView.button("Use ChatGPT OAuth Only", target: self, action: #selector(disableDesktopRouting))
|
|
65
|
-
enableDesktop.setAccessibilityLabel("
|
|
81
|
+
enableDesktop.setAccessibilityLabel("Advanced Desktop Bridge Mode that keeps ChatGPT sign-in, then restarts Codex App")
|
|
66
82
|
verifyDesktop.setAccessibilityLabel("Verify Desktop transport capabilities")
|
|
67
83
|
disableDesktop.setAccessibilityLabel("Disable Codex LB Desktop routing and keep ordinary ChatGPT OAuth, then restart Codex App")
|
|
68
|
-
// Keep the mode CTAs discoverable: never hide
|
|
84
|
+
// Keep the mode CTAs discoverable: never hide the advanced bridge or ChatGPT OAuth actions based on status parsing.
|
|
69
85
|
let configureCli = NativeView.button("Configure / Update…", target: self, action: #selector(setDomainAndKey))
|
|
70
|
-
let useCli =
|
|
71
|
-
|
|
86
|
+
let useCli = ControlKit.primaryButton("Use Codex LB", target: self, action: #selector(useCliProvider))
|
|
87
|
+
useCli.setAccessibilityLabel("Use Codex LB through the atomic CLI provider path")
|
|
88
|
+
let testCli = NativeView.button("Run Connect Test", target: self, action: #selector(testConnection))
|
|
89
|
+
testCli.setAccessibilityHelp("Send one bounded low-token request through the selected Codex LB provider and show the returned proof.")
|
|
72
90
|
let copyCli = NativeView.button("Copy CLI Command", target: self, action: #selector(copyCliCommand))
|
|
73
91
|
let fastOn = NativeView.button("Codex Fast On", target: self, action: #selector(fastOn))
|
|
74
92
|
let fastOff = NativeView.button("Codex Fast Off", target: self, action: #selector(fastOff))
|
|
75
93
|
actionButtons = [enableDesktop, verifyDesktop, disableDesktop, configureCli, useCli, testCli, copyCli, fastOn, fastOff]
|
|
76
94
|
let desktop = NativeView.card(
|
|
77
|
-
title: "
|
|
78
|
-
subtitle: "
|
|
95
|
+
title: "Advanced · Desktop Bridge / ChatGPT Identity Mode",
|
|
96
|
+
subtitle: "Optional bridge mode: keeps ChatGPT OAuth identity and the built-in OpenAI provider while routing model traffic through the local codex-lb bridge. Use ChatGPT OAuth Only removes bridge routing without touching login.",
|
|
79
97
|
views: [providerStatus, ControlKit.actionRow([enableDesktop, verifyDesktop], trailing: [disableDesktop])]
|
|
80
98
|
)
|
|
81
99
|
let cli = NativeView.card(
|
|
82
|
-
title: "Codex LB · Credentials &
|
|
83
|
-
subtitle: "Saves the official Center Codex LB host and API key (sks-codex-lb store).
|
|
100
|
+
title: "Codex LB · Credentials & Primary Provider",
|
|
101
|
+
subtitle: "Saves the official Center Codex LB host and API key (sks-codex-lb store). Use Codex LB applies the atomic CLI provider path — no shell source or twin env files.",
|
|
84
102
|
views: [
|
|
85
103
|
cliProviderStatus,
|
|
86
104
|
NativeView.detail("One-off command: \(cliLaunchCommand)"),
|
|
87
105
|
ControlKit.actionRow([configureCli, useCli]),
|
|
106
|
+
makeCliConnectProgressView(),
|
|
88
107
|
ControlKit.actionRow([testCli, copyCli])
|
|
89
108
|
]
|
|
90
109
|
)
|
|
@@ -99,8 +118,8 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
99
118
|
)
|
|
100
119
|
view = NativeView.page([
|
|
101
120
|
NativeView.row([NativeView.title("Providers & Models"), globalSpinner]),
|
|
102
|
-
NativeView.detail("Codex LB
|
|
103
|
-
makeActiveProviderCard(),
|
|
121
|
+
NativeView.detail("Use Codex LB selects the atomic CLI provider path. Advanced Desktop Bridge keeps ChatGPT identity; Fast stays independent. Secrets are sent through stdin and redacted from logs."),
|
|
122
|
+
makeActiveProviderCard(), cli, desktop, makeCapabilityMatrixCard(), makeOpenRouterCard(),
|
|
104
123
|
makeMultiProviderRouterCard(), makeRoleModelsCard(), fast
|
|
105
124
|
])
|
|
106
125
|
}
|
|
@@ -145,13 +164,18 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
145
164
|
return
|
|
146
165
|
}
|
|
147
166
|
let snapshot = ProviderRoutingTruth.snapshot(from: json)
|
|
148
|
-
|
|
149
|
-
|
|
167
|
+
let measuredRoute = ProviderRoutingTruth.measuredRoute(from: json)
|
|
168
|
+
let measuredRoutingOk = measuredRoute?.selected == true
|
|
169
|
+
&& measuredRoute?.measured == true
|
|
170
|
+
&& measuredRoute?.ok == true
|
|
171
|
+
self.desktopFullRoutingNow = snapshot.desktopFullRouting && measuredRoutingOk
|
|
172
|
+
self.codexLbSelectedNow = snapshot.legacyCodexLbSelected || measuredRoute?.selected == true
|
|
150
173
|
self.chatgptOauthPresentNow = snapshot.chatgptOauthPresent
|
|
151
174
|
self.renderActiveProviderSummary()
|
|
175
|
+
self.renderMeasuredRoutingBadge(measuredRoute, routeExpected: snapshot.desktopFullRouting || snapshot.legacyCodexLbSelected)
|
|
152
176
|
if !self.busy {
|
|
153
177
|
self.providerStatus.stringValue = self.describeDesktopStatus(snapshot)
|
|
154
|
-
self.cliProviderStatus.stringValue = self.describeCliStatus(snapshot)
|
|
178
|
+
self.cliProviderStatus.stringValue = self.describeCliStatus(snapshot, measuredRoute: measuredRoute)
|
|
155
179
|
}
|
|
156
180
|
}
|
|
157
181
|
refreshOpenRouterStatus()
|
|
@@ -189,7 +213,19 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
189
213
|
? "ChatGPT OAuth mode: active · Codex LB Desktop routing not enabled. Choose Use Codex LB to switch."
|
|
190
214
|
: "ChatGPT OAuth mode available · ChatGPT sign-in is missing · run codex login, then Use Codex LB if needed."
|
|
191
215
|
}
|
|
192
|
-
private func describeCliStatus(_ snapshot: ProviderRoutingTruth.Snapshot) -> String {
|
|
216
|
+
private func describeCliStatus(_ snapshot: ProviderRoutingTruth.Snapshot, measuredRoute: ProviderRoutingTruth.MeasuredRoute?) -> String {
|
|
217
|
+
if let route = measuredRoute, route.selected {
|
|
218
|
+
switch route.state {
|
|
219
|
+
case .active:
|
|
220
|
+
return "CLI provider: active · \(describeRoutingTruth(route))"
|
|
221
|
+
case .degraded:
|
|
222
|
+
return "CLI provider: degraded · \(describeRoutingTruth(route))"
|
|
223
|
+
case .unverified:
|
|
224
|
+
return "CLI provider: selected but unverified · \(describeRoutingTruth(route))"
|
|
225
|
+
case .inactive:
|
|
226
|
+
break
|
|
227
|
+
}
|
|
228
|
+
}
|
|
193
229
|
if snapshot.cliCredentialsConfigured && snapshot.cliProviderStored {
|
|
194
230
|
return "CLI provider: configured · availability remains unverified until Test succeeds."
|
|
195
231
|
}
|
|
@@ -319,7 +355,7 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
319
355
|
}
|
|
320
356
|
}
|
|
321
357
|
@objc private func enableDesktopFull() {
|
|
322
|
-
performDesktopRouting(["codex-lb", "use-desktop-full", "--restart-app", "--json"], title: "
|
|
358
|
+
performDesktopRouting(["codex-lb", "use-desktop-full", "--restart-app", "--json"], title: "Desktop Bridge Mode (keeps ChatGPT sign-in)", kind: "codex-lb-use-desktop-full", expectedMode: "desktop-native-bridge")
|
|
323
359
|
}
|
|
324
360
|
@objc private func disableDesktopRouting() {
|
|
325
361
|
performDesktopRouting(["codex-lb", "disable", "--restart-app", "--json"], title: "Use ChatGPT OAuth Only", kind: "codex-lb-disable-desktop", expectedMode: "disabled")
|
|
@@ -346,12 +382,14 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
346
382
|
self.providerStatus.stringValue = "\(title) was not confirmed · \(self.structuredPublicDetail(parsed, fallback: result.output)) No routing or OAuth change was assumed."
|
|
347
383
|
return
|
|
348
384
|
}
|
|
349
|
-
|
|
385
|
+
let bridgeSelected = expectedMode == "desktop-native-bridge"
|
|
386
|
+
self.desktopFullRoutingNow = false
|
|
350
387
|
self.codexLbSelectedNow = false
|
|
351
388
|
self.chatgptOauthPresentNow = routing?.chatgptOauthPresent ?? self.chatgptOauthPresentNow
|
|
352
389
|
self.renderActiveProviderSummary()
|
|
353
|
-
self.
|
|
354
|
-
|
|
390
|
+
if bridgeSelected { self.renderMeasuredRoutingBadge(nil, routeExpected: true) }
|
|
391
|
+
self.providerStatus.stringValue = bridgeSelected
|
|
392
|
+
? "Desktop Bridge Mode enabled · ChatGPT sign-in preserved · measured routing verification still required."
|
|
355
393
|
: "ChatGPT OAuth mode active · Codex LB Desktop routing disabled."
|
|
356
394
|
self.refresh()
|
|
357
395
|
}
|
|
@@ -385,7 +423,7 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
385
423
|
}
|
|
386
424
|
}
|
|
387
425
|
@objc private func useCliProvider() {
|
|
388
|
-
performCliCommand(["codex-lb", "use-cli", "--json"], title: "
|
|
426
|
+
performCliCommand(["codex-lb", "use-cli", "--json"], title: "Use Codex LB", kind: "codex-lb-use-cli")
|
|
389
427
|
}
|
|
390
428
|
private func performCliCommand(_ args: [String], title: String, kind: String) {
|
|
391
429
|
guard !busy else { cliProviderStatus.stringValue = "Another provider action is already running."; return }
|
|
@@ -395,42 +433,58 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
395
433
|
}
|
|
396
434
|
setBusy(true)
|
|
397
435
|
cliProviderStatus.stringValue = "\(title)…"
|
|
436
|
+
renderCliConnectStages(
|
|
437
|
+
progress: 0,
|
|
438
|
+
configuration: "applying CLI provider…",
|
|
439
|
+
request: "waiting for configuration",
|
|
440
|
+
response: "not received",
|
|
441
|
+
result: "Selecting Codex LB mode. Connectivity has not been claimed.",
|
|
442
|
+
tone: .secondaryLabelColor
|
|
443
|
+
)
|
|
398
444
|
_ = operations.update(snapshot, state: .running, stage: "configuring", progress: nil, summary: title)
|
|
399
445
|
processClient.run(args, timeout: NativeView.mutationTimeout) { [weak self] result in
|
|
400
446
|
guard let self = self else { return }
|
|
401
|
-
self.setBusy(false)
|
|
402
447
|
let parsed = self.json(result.output)
|
|
403
448
|
let routing = parsed.map(ProviderRoutingTruth.snapshot(from:))
|
|
404
449
|
let mode = routing?.mode
|
|
405
450
|
let oauthPreserved = routing.flatMap { $0.oauthPreservedFlag }
|
|
406
451
|
let authMutated = routing.flatMap { $0.authMutated }
|
|
407
|
-
let ok = result.code == 0
|
|
452
|
+
let ok = result.code == 0
|
|
453
|
+
&& parsed?["ok"] as? Bool == true
|
|
454
|
+
&& mode == "cli-provider"
|
|
455
|
+
&& oauthPreserved != false
|
|
456
|
+
&& authMutated != true
|
|
408
457
|
_ = self.operations.update(snapshot, state: ok ? .succeeded : .failed, stage: "complete", progress: 1, summary: ok ? "CLI provider configured" : "CLI provider configuration needs action")
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
_ = operations.update(snapshot, state: .running, stage: "testing", progress: nil, summary: "Test CLI provider")
|
|
424
|
-
processClient.run(["codex-lb", "health", "--json"], timeout: NativeView.mutationTimeout) { [weak self] result in
|
|
425
|
-
guard let self = self else { return }
|
|
458
|
+
guard ok else {
|
|
459
|
+
self.setBusy(false)
|
|
460
|
+
let detail = self.structuredPublicDetail(parsed, fallback: result.output)
|
|
461
|
+
self.cliProviderStatus.stringValue = "CLI provider was not confirmed · \(detail)"
|
|
462
|
+
self.renderCliConnectStages(
|
|
463
|
+
progress: 1,
|
|
464
|
+
configuration: "failed",
|
|
465
|
+
request: "not run",
|
|
466
|
+
response: "not received",
|
|
467
|
+
result: "Codex LB mode was not confirmed. Connection proof did not run.",
|
|
468
|
+
tone: .systemRed
|
|
469
|
+
)
|
|
470
|
+
return
|
|
471
|
+
}
|
|
426
472
|
self.setBusy(false)
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
self.
|
|
432
|
-
|
|
433
|
-
|
|
473
|
+
self.codexLbSelectedNow = true
|
|
474
|
+
self.desktopFullRoutingNow = false
|
|
475
|
+
self.openRouterSelectedNow = false
|
|
476
|
+
self.routerSelectedNow = false
|
|
477
|
+
ControlKit.setBadge(self.activeProviderBadge, text: "Codex LB · selected · connection proof running", tone: .busy)
|
|
478
|
+
self.cliProviderStatus.stringValue = "Codex LB mode selected · running the required one-request connection proof…"
|
|
479
|
+
self.renderCliConnectStages(
|
|
480
|
+
progress: 1,
|
|
481
|
+
configuration: "CLI provider selected",
|
|
482
|
+
request: "starting…",
|
|
483
|
+
response: "not received",
|
|
484
|
+
result: "Mode is selected. Connectivity remains unproved until a structured response is received.",
|
|
485
|
+
tone: .secondaryLabelColor
|
|
486
|
+
)
|
|
487
|
+
self.runConnectTest()
|
|
434
488
|
}
|
|
435
489
|
}
|
|
436
490
|
@objc private func copyCliCommand() {
|
|
@@ -440,19 +494,6 @@ final class ProvidersViewController: NSViewController, ControlCenterPage, NSText
|
|
|
440
494
|
? "Copied CLI command: \(cliLaunchCommand)"
|
|
441
495
|
: "Could not copy the CLI command. Select it above and copy manually."
|
|
442
496
|
}
|
|
443
|
-
private func refreshFastStatus() {
|
|
444
|
-
if !busy { fastStatus.stringValue = "Codex Fast: checking the official service-tier setting…" }
|
|
445
|
-
processClient.run(["fast-mode", "status", "--json"], timeout: NativeView.statusTimeout) { [weak self] result in
|
|
446
|
-
guard let self = self else { return }
|
|
447
|
-
guard result.code == 0, let json = self.json(result.output),
|
|
448
|
-
let global = json["global"] as? [String: Any], let on = global["on"] as? Bool else {
|
|
449
|
-
self.fastStatus.stringValue = "Codex Fast: unavailable — no state was assumed."
|
|
450
|
-
return
|
|
451
|
-
}
|
|
452
|
-
let tier = global["service_tier"] as? String ?? (on ? "fast" : "default")
|
|
453
|
-
self.fastStatus.stringValue = "Codex Fast: \(on ? "On" : "Off") · official service_tier=\(tier) · model and reasoning remain separate."
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
497
|
@objc private func fastOn() { run(["fast-mode", "on", "--json"], title: "Codex Fast On", kind: "fast-mode-on", group: "codex-config", timeout: NativeView.statusTimeout) { [weak self] in self?.refreshFastStatus() } }
|
|
457
498
|
@objc private func fastOff() { run(["fast-mode", "off", "--json"], title: "Codex Fast Off", kind: "fast-mode-off", group: "codex-config", timeout: NativeView.statusTimeout) { [weak self] in self?.refreshFastStatus() } }
|
|
458
499
|
}
|