feat(macos): hover HUD for activity

This commit is contained in:
Peter Steinberger
2025-12-19 00:03:58 +01:00
parent 0c06276b48
commit 47510e2912
8 changed files with 512 additions and 70 deletions

View File

@@ -25,6 +25,37 @@ struct WorkActivityStoreTests {
#expect(store.current == nil)
}
@Test func jobStaysWorkingAfterToolResultGrace() async {
let store = WorkActivityStore()
store.handleJob(sessionKey: "main", state: "started")
#expect(store.iconState == .workingMain(.job))
store.handleTool(
sessionKey: "main",
phase: "start",
name: "read",
meta: nil,
args: ["path": AnyCodable("/tmp/file.txt")])
#expect(store.iconState == .workingMain(.tool(.read)))
store.handleTool(
sessionKey: "main",
phase: "result",
name: "read",
meta: nil,
args: ["path": AnyCodable("/tmp/file.txt")])
for _ in 0..<50 {
if store.iconState == .workingMain(.job) { break }
try? await Task.sleep(nanoseconds: 100_000_000)
}
#expect(store.iconState == .workingMain(.job))
store.handleJob(sessionKey: "main", state: "done")
#expect(store.iconState == .idle)
}
@Test func toolLabelExtractsFirstLineAndShortensHome() {
let store = WorkActivityStore()
let home = NSHomeDirectory()
@@ -65,4 +96,3 @@ struct WorkActivityStoreTests {
#expect(store.iconState == .overridden(.tool(.edit)))
}
}