sprag-cli 3.137.0 → 3.138.1
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.ko.md +15 -1
- package/README.md +15 -1
- package/mac/SpragBar.swift +79 -0
- package/package.json +1 -1
- package/src/doc2md.cjs +14 -2
package/README.ko.md
CHANGED
|
@@ -75,6 +75,18 @@ Sprag는 사용자가 고른 모델을 바꾸지 않습니다. 분석은 로컬
|
|
|
75
75
|
|
|
76
76
|
Codex를 쓴다면 아래 [Codex](#codex) 절을 보십시오.
|
|
77
77
|
|
|
78
|
+
## Sprag Bar: macOS 메뉴 막대에서 모든 세션 보기
|
|
79
|
+
|
|
80
|
+
Mac에서는 메뉴 막대에 동물 한 마리가 함께 뜹니다. 에이전트 세션이 기기를 많이 쓸수록 빨리 달리고 옆에 CPU 사용률이 나옵니다. 누르면 실행 중인 Claude Code와 Codex 세션이 모두 보입니다. 세션마다 모델과 effort, 지금 하는 일, 컨텍스트 사용량, 비용, CPU와 메모리가 나오고 계정별 5시간 한도와 주간 한도도 함께 나옵니다.
|
|
81
|
+
|
|
82
|
+
<img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-bar-panel.png" width="400" alt="Sprag Bar 패널. 세션 5개 가운데 3개는 작업 중이고 2개는 입력을 기다립니다. 줄마다 Claude인지 Codex인지, 맡은 일, 모델과 effort, 그 상태로 지난 시간, CPU, 메모리, 컨텍스트, 비용이 나옵니다.">
|
|
83
|
+
|
|
84
|
+
대시보드 창은 세션을 프로젝트별로 묶고 각 세션이 지금 돌리는 도구 호출과 일을 넘긴 서브에이전트를 보여 줍니다. 타일의 이동 단추를 누르면 그 세션이 열린 Terminal.app이나 iTerm2 탭이 앞으로 나옵니다. 창 크기는 세 가지(⌘1, ⌘2, ⌘3)이고 끝난 세션이 남긴 프로세스는 목록에서 골라 끌 수 있습니다.
|
|
85
|
+
|
|
86
|
+
<img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-bar-dashboard.png" width="760" alt="중간 크기의 Sprag Bar 대시보드. 프로젝트별로 묶인 세션 타일마다 상태, 모델, 컨텍스트, CPU, 메모리, GPU, 비용과 지금 하는 단계(테스트를 돌리는 서브에이전트, npm test 등)가 나옵니다.">
|
|
87
|
+
|
|
88
|
+
앱은 실행 파일로 배포하지 않습니다. 세션이 시작될 때 Sprag가 사용자의 Mac에서 Swift 소스를 컴파일하고 릴리스가 그 소스를 바꿨을 때만 다시 컴파일하므로 Xcode 명령줄 도구가 있어야 합니다. `sprag bar off` 로 끄고 `sprag bar on` 으로 다시 켭니다. 앱이 뜨지 않으면 `sprag bar status` 가 이유를 알려 줍니다. 팀에 들어 있으면 메뉴 막대 동물은 이번 달 [Sprag Town](#팀) 등급을 따릅니다.
|
|
89
|
+
|
|
78
90
|
## 작동 방식
|
|
79
91
|
|
|
80
92
|
<picture>
|
|
@@ -304,7 +316,9 @@ CLI는 무료이고 컴퓨터 한 대에서 혼자 동작합니다. 조직에는
|
|
|
304
316
|
<a href="https://sprag.io/assets/video/plan-pro-ko.mp4"><img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/plan-pro-ko.gif" width="640" alt="팀원마다 동물 캐릭터로 앉아 있는 가상 사무실, 지출과 절감액, 좌석, 30일 차트가 있는 조직 대시보드, 한 번 승인하면 모든 컴퓨터에 적용되는 팀 규칙을 차례로 보여 줍니다."></a>
|
|
305
317
|
|
|
306
318
|
- 조직 대시보드와 30일 추이 차트
|
|
307
|
-
- 사람마다 동물
|
|
319
|
+
- Sprag Town: 이번 달 지출과 위임 순위에 따라 사람마다 동물 30종 가운데 하나로 앉아 있는 가상 사무실
|
|
320
|
+
- 멤버 누구나 `sprag team town` 이 여는 12시간짜리 링크로 타운을 봅니다. 다른 사람은 이름과 동물과 팀만 보이고 수치는 보이지 않습니다.
|
|
321
|
+
- 사용량과 위임 비율이 쌓이면 책상 소품과 머리 소품, 반려동물이 열립니다. 내 동물은 Sprag Bar 메뉴 막대에서도 달립니다.
|
|
308
322
|
- 컴퓨터별 상태가 보이는 좌석 명단
|
|
309
323
|
- 세션 시작 때 적용되는 팀 승인 규칙
|
|
310
324
|
- `sprag team join` 으로 조직 배포
|
package/README.md
CHANGED
|
@@ -98,6 +98,18 @@ everything it added and restores a statusline it merged with.
|
|
|
98
98
|
|
|
99
99
|
Using Codex? See [Codex](#codex) below.
|
|
100
100
|
|
|
101
|
+
## Sprag Bar: every session in the macOS menu bar
|
|
102
|
+
|
|
103
|
+
On a Mac, sprag also puts an animal in the menu bar. It runs faster as the agent sessions load the machine, with the CPU figure beside it. Click it to see every running Claude Code and Codex session: the model and effort, what it is doing now, context use, cost, CPU and memory, and the 5-hour and weekly limits of each account.
|
|
104
|
+
|
|
105
|
+
<img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-bar-panel.png" width="400" alt="The Sprag Bar panel: five sessions, three working and two waiting for input. Each row shows Claude or Codex, the task, the model and effort, how long it has been in that state, CPU, memory, context use and cost.">
|
|
106
|
+
|
|
107
|
+
The dashboard window groups the sessions by project and shows what each one is running, from the tool call to the subagent it handed work to. The jump button on a tile brings that session's Terminal.app or iTerm2 tab to the front. The window has three sizes (⌘1, ⌘2, ⌘3), and processes left behind by sessions that have ended can be stopped from a checklist.
|
|
108
|
+
|
|
109
|
+
<img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-bar-dashboard.png" width="760" alt="The Sprag Bar dashboard at its middle size: session tiles grouped by project, each with its state, model, context, CPU, memory, GPU, cost and the step it is on, such as a subagent running the tests or npm test.">
|
|
110
|
+
|
|
111
|
+
The app is not shipped as a binary. Sprag compiles its Swift source on your Mac when a session starts, once per release that changes it, so it needs the Xcode command line tools. `sprag bar off` turns it off, `sprag bar on` brings it back, and `sprag bar status` says why it is not showing. On a team, the animal is your [Sprag Town](#teams) grade for the month.
|
|
112
|
+
|
|
101
113
|
## How it works
|
|
102
114
|
|
|
103
115
|
<picture>
|
|
@@ -365,7 +377,9 @@ The CLI is free and works on its own on one machine. For organizations, **Sprag
|
|
|
365
377
|
<a href="https://sprag.io/assets/video/plan-pro-en.mp4"><img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/plan-pro-en.gif" width="640" alt="A virtual office where every teammate sits as an animal character, then the organization dashboard with spend, savings, seats and a 30-day chart, then team rules approved once and picked up by every machine."></a>
|
|
366
378
|
|
|
367
379
|
- Organization dashboard with a 30-day chart
|
|
368
|
-
-
|
|
380
|
+
- Sprag Town, a virtual office where each person sits as one of 30 animals picked by this month's ranking of spend and delegation
|
|
381
|
+
- `sprag team town` opens the town for any member through a 12-hour link; other people show only their name, animal and team, never their figures
|
|
382
|
+
- Desk props, head props and pets unlock as your usage and delegation grow, and your animal runs in the Sprag Bar menu bar
|
|
369
383
|
- Seat roster with each machine's status
|
|
370
384
|
- Team-approved rules applied at session start
|
|
371
385
|
- Rollout with `sprag team join`
|
package/mac/SpragBar.swift
CHANGED
|
@@ -287,6 +287,79 @@ func jump(to s: Session) {
|
|
|
287
287
|
try? p.run()
|
|
288
288
|
}
|
|
289
289
|
guard let app = owningApp(s.pid) else { return }
|
|
290
|
+
if let script = TAB_SCRIPTS[app.bundleIdentifier ?? ""], let tty = ttyPath(Int32(s.pid)) {
|
|
291
|
+
selectTab(script, tty: tty) { found in if !found { bringForward(app) } }
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
bringForward(app)
|
|
295
|
+
}
|
|
296
|
+
/** The terminal device a process writes to (`/dev/ttys003`), or nil for one without a terminal. */
|
|
297
|
+
func ttyPath(_ pid: Int32) -> String? {
|
|
298
|
+
var info = proc_bsdinfo()
|
|
299
|
+
let size = Int32(MemoryLayout<proc_bsdinfo>.size)
|
|
300
|
+
guard proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &info, size) == size, info.e_tdev != UInt32.max, let name = devname(dev_t(bitPattern: info.e_tdev), S_IFCHR) else { return nil }
|
|
301
|
+
return "/dev/" + String(cString: name)
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Terminals that name each tab's tty to AppleScript, with a script that selects the tab on the tty given as its argument,
|
|
305
|
+
* restores and raises its window and prints true, or prints false when no tab has that tty. Running one asks once for the
|
|
306
|
+
* Automation permission; refused, the script fails and the jump falls back to bringing the app forward.
|
|
307
|
+
*/
|
|
308
|
+
let TAB_SCRIPTS: [String: String] = [
|
|
309
|
+
"com.apple.Terminal": """
|
|
310
|
+
on run argv
|
|
311
|
+
tell application id "com.apple.Terminal"
|
|
312
|
+
repeat with w in windows
|
|
313
|
+
repeat with t in tabs of w
|
|
314
|
+
if tty of t is (item 1 of argv) then
|
|
315
|
+
if miniaturized of w then set miniaturized of w to false
|
|
316
|
+
set selected of t to true
|
|
317
|
+
set index of w to 1
|
|
318
|
+
activate
|
|
319
|
+
return true
|
|
320
|
+
end if
|
|
321
|
+
end repeat
|
|
322
|
+
end repeat
|
|
323
|
+
end tell
|
|
324
|
+
return false
|
|
325
|
+
end run
|
|
326
|
+
""",
|
|
327
|
+
"com.googlecode.iterm2": """
|
|
328
|
+
on run argv
|
|
329
|
+
tell application id "com.googlecode.iterm2"
|
|
330
|
+
repeat with w in windows
|
|
331
|
+
repeat with t in tabs of w
|
|
332
|
+
repeat with s in sessions of t
|
|
333
|
+
if tty of s is (item 1 of argv) then
|
|
334
|
+
if miniaturized of w then set miniaturized of w to false
|
|
335
|
+
select w
|
|
336
|
+
tell t to select
|
|
337
|
+
tell s to select
|
|
338
|
+
activate
|
|
339
|
+
return true
|
|
340
|
+
end if
|
|
341
|
+
end repeat
|
|
342
|
+
end repeat
|
|
343
|
+
end repeat
|
|
344
|
+
end tell
|
|
345
|
+
return false
|
|
346
|
+
end run
|
|
347
|
+
""",
|
|
348
|
+
]
|
|
349
|
+
/** Run a tab script off the main thread; `done` gets whether the tab was found, on the main thread. A permission prompt left unanswered gives up after a minute. */
|
|
350
|
+
func selectTab(_ script: String, tty: String, done: @escaping (Bool) -> Void) {
|
|
351
|
+
let p = Process(), out = Pipe()
|
|
352
|
+
p.executableURL = URL(fileURLWithPath: "/usr/bin/osascript"); p.arguments = ["-e", script, tty]
|
|
353
|
+
p.standardOutput = out; p.standardError = FileHandle.nullDevice
|
|
354
|
+
p.terminationHandler = { _ in
|
|
355
|
+
let text = String(decoding: out.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
|
|
356
|
+
DispatchQueue.main.async { done(text == "true") }
|
|
357
|
+
}
|
|
358
|
+
do { try p.run() } catch { done(false); return }
|
|
359
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 60) { if p.isRunning { p.terminate() } }
|
|
360
|
+
}
|
|
361
|
+
/** Bring a terminal app forward, restoring a minimized window when nothing of it is on screen (see jump). */
|
|
362
|
+
func bringForward(_ app: NSRunningApplication) {
|
|
290
363
|
app.activate(options: [.activateAllWindows])
|
|
291
364
|
if let url = app.bundleURL, app.isHidden || !hasWindowOnScreen(app.processIdentifier) {
|
|
292
365
|
let cfg = NSWorkspace.OpenConfiguration(); cfg.activates = true
|
|
@@ -3456,6 +3529,8 @@ struct PanelView: View {
|
|
|
3456
3529
|
case .warning(let chip): WarningView(w: model.snap?.warnings?.first { $0.chip == chip }, now: model.snap?.at ?? 0, limit: maxHeight, back: { nav.page = .status })
|
|
3457
3530
|
}
|
|
3458
3531
|
}
|
|
3532
|
+
// A page that still comes out taller than the screen loses its bottom, never the header with the back and menu buttons.
|
|
3533
|
+
.frame(maxHeight: still ? nil : maxHeight, alignment: .top)
|
|
3459
3534
|
}
|
|
3460
3535
|
/** How many sessions, and how they stand: working, waiting for a go-ahead, waiting for input. Sessions another one started are counted apart. */
|
|
3461
3536
|
func sessionsTitle(_ snap: Snapshot) -> String {
|
|
@@ -3829,6 +3904,10 @@ final class App: NSObject {
|
|
|
3829
3904
|
/** Size the window to its content and hang it under the menu bar item, wholly inside the screen. */
|
|
3830
3905
|
func place() {
|
|
3831
3906
|
guard let b = item.button, let bw = b.window, let screen = bw.screen ?? NSScreen.main else { return }
|
|
3907
|
+
// The content's own height limit follows the screen the menu bar item is on. Set once from the main screen at
|
|
3908
|
+
// launch, it let a page grow taller than a shorter screen's window, and the window cut the page off at the top.
|
|
3909
|
+
let cap = screen.visibleFrame.height - 12
|
|
3910
|
+
if abs(hosting.rootView.maxHeight - cap) > 0.5 { var v = hosting.rootView; v.maxHeight = cap; hosting.rootView = v }
|
|
3832
3911
|
hosting.layoutSubtreeIfNeeded()
|
|
3833
3912
|
let vis = screen.visibleFrame, fit = hosting.fittingSize
|
|
3834
3913
|
let w = fit.width, h = min(fit.height, vis.height - 12)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprag-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.138.1",
|
|
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": {
|
package/src/doc2md.cjs
CHANGED
|
@@ -358,6 +358,16 @@ const MARKITDOWN_SPEC = 'markitdown[pptx,pdf,xlsx,docx]>=0.1,<0.2';
|
|
|
358
358
|
// pre-installed so "swap the chart on slide 23" does not stall on pip.
|
|
359
359
|
const EDIT_LIBS = ['python-pptx>=1.0,<2', 'python-docx>=1.1,<2', 'openpyxl>=3.1,<4'];
|
|
360
360
|
|
|
361
|
+
// Transitive dependencies held below a release that broke conversion. None of
|
|
362
|
+
// the specs above names them, so pip takes the newest on the day of install.
|
|
363
|
+
// lxml 6.2.0 (2026-11-27) makes markitdown's DocxConverter fail on every .docx
|
|
364
|
+
// with "Could not find the body element"; 6.1.3 converts the same file. Rerunning
|
|
365
|
+
// `sprag doc2md install-converter` moves a venv built on 6.2.0 back down.
|
|
366
|
+
const PIN_LIBS = ['lxml>=4.9,<6.2'];
|
|
367
|
+
|
|
368
|
+
/** Everything one pip call installs into the managed venv, in order. */
|
|
369
|
+
function installSpecs() { return [MARKITDOWN_SPEC, ...EDIT_LIBS, ...PIN_LIBS]; }
|
|
370
|
+
|
|
361
371
|
/**
|
|
362
372
|
* Build the managed venv and install markitdown into it.
|
|
363
373
|
*
|
|
@@ -435,8 +445,8 @@ function installConverter({ onProgress = () => {} } = {}) {
|
|
|
435
445
|
}
|
|
436
446
|
}
|
|
437
447
|
|
|
438
|
-
onProgress(`installing ${MARKITDOWN_SPEC} + ${EDIT_LIBS.join(', ')}`);
|
|
439
|
-
const install = spawnSync(target, ['-m', 'pip', 'install', '--quiet',
|
|
448
|
+
onProgress(`installing ${MARKITDOWN_SPEC} + ${EDIT_LIBS.join(', ')} + ${PIN_LIBS.join(', ')}`);
|
|
449
|
+
const install = spawnSync(target, ['-m', 'pip', 'install', '--quiet', ...installSpecs()], {
|
|
440
450
|
encoding: 'utf8',
|
|
441
451
|
timeout: 900_000,
|
|
442
452
|
windowsHide: true,
|
|
@@ -1072,6 +1082,8 @@ module.exports = {
|
|
|
1072
1082
|
INSTALL_HINT,
|
|
1073
1083
|
MARKITDOWN_SPEC,
|
|
1074
1084
|
EDIT_LIBS,
|
|
1085
|
+
PIN_LIBS,
|
|
1086
|
+
installSpecs,
|
|
1075
1087
|
managedPython,
|
|
1076
1088
|
installConverter,
|
|
1077
1089
|
ensureConverterInstalled,
|