WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage fro

fix: reuse cached auth #41

Merged kueda.net
targeting main from kueda.net/tangled-cli:fix-persist-refreshed-session
Merged opened by and assigned to kueda.net
targeting main from kueda.net/tangled-cli:fix-persist-refreshed-session

resumeSession always forces a token refresh, and atproto refresh tokens are single-use: the server rotates the refresh token and invalidates the old one. Rotated tokens weren't getting persisted, so the keychain kept the original refresh token. Once the server stopped accepting the consumed token, every command failed until re-authenticating

This saves the agent's session after resumeSession so the rotated tokens are durably stored for the next invocation, and adds an integration test that drives the real CredentialSession through a stubbed fetch to prove the rotated refresh token reaches the keychain.

Co-authored-by: Claude (claude-opus-4-8) noreply@anthropic.com

Commits 3

fix: reuse valid access tokens instead of refreshing every command
fix: report auth state based on session validation
fix: store rotated access and refresh tokens when resuming session