sprag-cli 3.133.0 → 3.134.0
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/mac/SpragBar.swift +33 -8
- package/package.json +1 -1
package/mac/SpragBar.swift
CHANGED
|
@@ -3331,13 +3331,32 @@ struct PanelView: View {
|
|
|
3331
3331
|
|
|
3332
3332
|
// ---------- the menu bar item and its window ----------
|
|
3333
3333
|
final class FloatPanel: NSPanel { override var canBecomeKey: Bool { true } }
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3334
|
+
/**
|
|
3335
|
+
* The Dock icon while the dashboard is open: the member's town animal, white on a coral rounded square, the same
|
|
3336
|
+
* species that runs in the menu bar. It is one still frame, redrawn only when the grade changes; a running Dock icon
|
|
3337
|
+
* would spend CPU and pull the eye away from the dashboard. Drawn on the macOS icon grid (an 824 square in 1024).
|
|
3338
|
+
*/
|
|
3339
|
+
func dockIcon(_ grade: String?) -> NSImage {
|
|
3340
|
+
let sp = runnerSpecies(grade)
|
|
3341
|
+
// a frame that reads as that animal at rest in motion: wings up for fliers, mid-leap for the frog, a stride otherwise
|
|
3342
|
+
let frame = sp.fly > 0 || sp.x.contains("wings") ? 2 : sp.kind == 4 ? 2 : sp.kind == 7 ? 0 : sp.kind == 5 || sp.kind == 6 ? 1 : 7
|
|
3343
|
+
let still = runner(sp, frame: frame, idle: false)
|
|
3344
|
+
return NSImage(size: NSSize(width: 512, height: 512), flipped: false) { r in
|
|
3345
|
+
let k = r.width / 1024
|
|
3346
|
+
let body = NSRect(x: 100 * k, y: 100 * k, width: 824 * k, height: 824 * k)
|
|
3347
|
+
let shape = NSBezierPath(roundedRect: body, xRadius: 185 * k, yRadius: 185 * k)
|
|
3348
|
+
let top = NSColor(srgbRed: 0.941, green: 0.573, blue: 0.416, alpha: 1), bottom = NSColor(srgbRed: 0.788, green: 0.341, blue: 0.235, alpha: 1)
|
|
3349
|
+
NSGraphicsContext.saveGraphicsState()
|
|
3350
|
+
let sh = NSShadow(); sh.shadowColor = NSColor.black.withAlphaComponent(0.28); sh.shadowBlurRadius = 22 * k; sh.shadowOffset = NSSize(width: 0, height: -10 * k); sh.set()
|
|
3351
|
+
top.setFill(); shape.fill()
|
|
3352
|
+
NSGraphicsContext.restoreGraphicsState()
|
|
3353
|
+
NSGradient(starting: top, ending: bottom)?.draw(in: shape, angle: -90)
|
|
3354
|
+
// a soft shadow on the ground under the animal
|
|
3355
|
+
NSColor(srgbRed: 0.478, green: 0.180, blue: 0.118, alpha: 0.35).setFill()
|
|
3356
|
+
NSBezierPath(ovalIn: NSRect(x: 262 * k, y: 262 * k, width: 500 * k, height: 44 * k)).fill()
|
|
3357
|
+
let w = 700 * k, h = w * still.size.height / still.size.width
|
|
3358
|
+
let white = NSImage(size: still.size, flipped: false) { rr in still.draw(in: rr); NSColor.white.set(); rr.fill(using: .sourceAtop); return true }
|
|
3359
|
+
white.draw(in: NSRect(x: r.midX - w / 2 + 10 * k, y: 250 * k, width: w, height: h))
|
|
3341
3360
|
return true
|
|
3342
3361
|
}
|
|
3343
3362
|
}
|
|
@@ -3392,7 +3411,7 @@ final class App: NSObject {
|
|
|
3392
3411
|
// A menu bar app has no Dock icon, so a dashboard that slipped behind other windows could only be found through the
|
|
3393
3412
|
// menu bar again. While the window is open the app is a regular one: Dock icon, app switcher, and a click on either brings it back.
|
|
3394
3413
|
NSApp.setActivationPolicy(.regular)
|
|
3395
|
-
NSApp.applicationIconImage = dockIcon()
|
|
3414
|
+
dockGrade = model.snap?.animal?.grade; NSApp.applicationIconImage = dockIcon(dockGrade)
|
|
3396
3415
|
if NSApp.mainMenu == nil { NSApp.mainMenu = dashboardMenu() }
|
|
3397
3416
|
NSApp.activate(ignoringOtherApps: true)
|
|
3398
3417
|
if dash?.isMiniaturized == true { dash?.deminiaturize(nil) }
|
|
@@ -3448,7 +3467,11 @@ final class App: NSObject {
|
|
|
3448
3467
|
b.attributedTitle = out
|
|
3449
3468
|
b.toolTip = model.sysCpu != nil ? String(format: "기기 전체 CPU %.0f%%, 그중 AI 세션 %.0f%%. 세션 %d개 실행 중", (model.sysCpu ?? 0) * 100, model.share(nil), s.totals.sessions) : "작업 중인 세션 수 / 실행 중인 세션 수"
|
|
3450
3469
|
}
|
|
3470
|
+
var dockGrade: String? = nil // the grade the Dock icon was drawn for
|
|
3451
3471
|
func animate() {
|
|
3472
|
+
if NSApp.activationPolicy() == .regular, model.snap?.animal?.grade != dockGrade {
|
|
3473
|
+
dockGrade = model.snap?.animal?.grade; NSApp.applicationIconImage = dockIcon(dockGrade)
|
|
3474
|
+
}
|
|
3452
3475
|
// RunCat's rule, on the same thing RunCat measures: the whole machine. A runner that strolls while the machine is
|
|
3453
3476
|
// flat out, because the agent sessions' own share happens to be small, reads as wrong.
|
|
3454
3477
|
let load = min(100, max(0, (model.sysCpu ?? 0) * 100))
|
|
@@ -3724,6 +3747,8 @@ func dashboardTest(_ prefix: String) {
|
|
|
3724
3747
|
DispatchQueue.main.asyncAfter(deadline: .now() + 4.0) {
|
|
3725
3748
|
let m = main.model
|
|
3726
3749
|
print("DASHBOARD window \(main.dash.map { "\(Int($0.frame.width))x\(Int($0.frame.height)) visible \($0.isVisible)" } ?? "none") | panel closed \(!main.isOpen) | asked for detail \(m.wantDetail) | sessions \(m.snap?.sessions.count ?? 0) with detail \(m.snap?.sessions.filter { $0.detail != nil }.count ?? 0)")
|
|
3750
|
+
if let icon = NSApp.applicationIconImage { png(icon, "\(prefix)-dock.png") }
|
|
3751
|
+
print("DOCK icon drawn for grade \(main.dockGrade ?? "none") (species \(runnerSpecies(main.dockGrade).id))")
|
|
3727
3752
|
print("DOCK regular app while the dashboard is open: \(NSApp.activationPolicy() == .regular) | icon set \(NSApp.applicationIconImage != nil) | menu \(NSApp.mainMenu != nil) | reopen handler \(NSApp.delegate is App)")
|
|
3728
3753
|
print("STARTED BY " + (m.parentSession.isEmpty ? "none" : m.parentSession.map { c, up in "\(m.snap?.sessions.first { $0.pid == c }?.name ?? "\(c)") <- \(m.snap?.sessions.first { $0.pid == up }?.name ?? "\(up)")" }.sorted().joined(separator: " | ")))
|
|
3729
3754
|
print("PHASE " + (m.snap?.sessions ?? []).map { s in "\(s.name ?? s.agent) \(m.phase(s)) [" + m.working(s, max: 3).map { "\($0.name) cpu \(pct1($0.w.cpu * 100)) gpu \(pct1($0.w.gpu * 100)) \(memText($0.w.mem))" }.joined(separator: "; ") + "]" }.joined(separator: " | "))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.134.0",
|
|
4
4
|
"description": "The delegation layer for Claude Code and Codex: each task goes to the model and effort that fits it, down to cheaper models for lookups and up to higher effort when a cheaper run would miss, backed by public replay cases, with a live statusline and team rules for Pro and Enterprise.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|