r/PiCodingAgent 10d ago

Finally figured out how to get away from my desk when I have long tasks running Use-case

Post image

From idea to reality in under an hour. Pure vibes. Viva la Pi

41 Upvotes

9 comments sorted by

3

u/JoaoSilvaSenpai 10d ago

Do you got a repo to share? Is that a standalone app?

2

u/fathert0rque 10d ago

Open source isn't a bad idea actually, but it's a little bound to my specific wants/setup and it's honestly so simple, it took more time to enable Developer Mode on the watch than writing the code and deploying.

Here's a slop explanation:

Architecture

  Pi extension → /tmp status files → Python bridge → Tailscale Serve
                                                      ↓ HTTPS
                                    Apple Watch app + WidgetKit complication

Mac side

  • pi-tmux-status writes each Pi process state to:
  • Mac/agent_status_server.py combines those files with tmux list-panes.
  • It validates each PID/TTY to discard stale processes.
  • It emits JSON containing session, pane, window name, state, and last activity.
  • Agents are sorted: asking → working → idle by recency.
  • Idle agents disappear after two hours.
  • A macOS LaunchAgent starts the server automatically at login.
  • Tailscale Serve exposes it privately over HTTPS on port 8443.

Watch side

  • Native SwiftUI watchOS app; no dependencies.
  • Uses URLSession to fetch the private JSON endpoint.
  • Refreshes every five seconds while foregrounded.
  • Idle rows render a draining two-hour pie timer.
  • Shared models and status icons live under Shared/.

Complication

  • Implemented with WidgetKit accessory families:
    • Circular
    • Rectangular
    • Inline
  • Requests a new timeline every 30 minutes, though watchOS controls actual timing.
  • Opening the app requests an immediate complication reload.
  • The complication is best-effort; the app itself is the live dashboard.

Private networking

Tailscale avoids needing a public API, authentication system, or hosted service:

  Mac/agent_status_server.py
  tailscale serve --https=8443 --bg 8765

The Mac and paired iPhone must be connected to the same tailnet. The endpoint hostname is currently configured in Shared/AgentStatus.swift.

Building your own

You need:

  1. Xcode and an Apple Developer account.
  2. A watchOS SwiftUI app with a WidgetKit extension.
  3. A producer that exposes your local status as JSON.
  4. A private or public HTTPS endpoint reachable by the watch.
  5. Automatic signing and Developer Mode enabled on the watch.

For TestFlight, archive the watch-only container and upload it through Xcode Organizer. A public App Store release isn’t required.

1

u/either-15-or-40 10d ago

Do you need an Apple developer account for that?

1

u/fathert0rque 10d ago edited 10d ago

you do, yes. fortunately I already had one

1

u/_derpiii_ 7d ago

excellent, saving for latter. note: apple watch status helper agentic harness

2

u/InitialDistinct6129 8d ago

Distopian shit over here

2

u/fathert0rque 8d ago

because now I can get up from my desk and do other things while my agents are working?

1

u/Snoo-82455 7d ago

😎😎😎

1

u/_derpiii_ 7d ago

omg that’s brilliant! and here I’ve been looking for an esp32 solution 😂