Skip to content

feat(): session and event identification#52

Merged
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:feat-session-and-event-identification
May 20, 2026
Merged

feat(): session and event identification#52
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:feat-session-and-event-identification

Conversation

@StuBehan

@StuBehan StuBehan commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Sessions become first-class identities: renames persist, propagate into the Events tab live, and every row carries a stable color accent so the eye can link a nudge to its session.

Changes

  • Persistence — new panel/SessionPersistence.swift. Disk-backed store at ~/.stack-nudge/sessions.json, keyed by (canonical-agent, projectPath). Atomic write, decode-failure-safe. Agent.canonical(_:) bridges wire names (claude-code, cursorclaude) so events and sessions agree on identity.
  • SessionStore — seeds customName from persistence on every newly-discovered session (survives pid churn + restart). Writes on rename. Bumps lastSeenAt once per launch per named session, not per poll.
  • EventRow@EnvironmentObject SessionPersistence injected at the panel root. The "· project" pill now shows customName when set, else project basename. Render-time lookup, so a rename in the Sessions tab updates matching event rows instantly.
  • Sessions tab — redesigned as a two-line card: name + agent tag + status (active · 14:23 / ended 5m ago); terminalApp · tilde-abbreviated cwd. Selected cards expand with N nudges · last X ago for active events matching the session.
  • Color identitySessionColor deterministic FNV-1a over the canonicalized join key → palette of 6 muted colors. Applied as a 3pt left-edge accent on both SessionRow and EventRow. Active 0.85 opacity, finished 0.45.
  • Tests — 30 new XCTest cases across SessionPersistenceTests, AgentTests, SessionColorTests. Cover roundtrip, removal semantics, decode-failure recovery, canonicalization on read/write, determinism, palette membership.
  • build.sh — added SessionPersistence.swift to the explicit source list (SPM auto-discovers; build.sh doesn't).
image image

Testing

  • swift build and ./build.sh clean.
  • make reload, fired varied trial events: same-project events share a color, different projects get different colors, gemini gets its own, long titles still truncate, no-projectPath events render without a session chip.
  • Rename loop end-to-end: renamed a running claude session in the Sessions tab → matching event rows picked up the new name immediately.
  • 30 new XCTest cases — CI's test-macos job runs them; not run locally (CLI tools only, no Xcode).

@StuBehan StuBehan merged commit 9d6bdd9 into StackOneHQ:main May 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants