Skip to content

feat: odek serve token auth + TUI polish pass#7

Merged
jkyberneees merged 3 commits into
mainfrom
feat/serve-token-auth
Jul 25, 2026
Merged

feat: odek serve token auth + TUI polish pass#7
jkyberneees merged 3 commits into
mainfrom
feat/serve-token-auth

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

Token auth — current odek serve protects its WebSocket and REST APIs with a per-instance token printed at startup. bodek now resolves it in order:

  1. --token flag (explicit)
  2. ?token=… in the attach --url (paste the URL odek serve printed; query is stripped)
  3. the stderr banner of a spawned server, scanned live via a passthrough writer
  4. legacy fallback for odek versions that predate enforced auth (cookie fetch, then an auth-enforcement probe with a clear error telling the user how to attach)

The token is sent as X-Odek-Ws-Token on every REST request and on the WS handshake. README and --help examples updated.

TUI polish:

  • /clear and ctrl+l reset session telemetry (turns, tools, tokens, age) so /stats and the header gauge start fresh
  • viewport height stays stable when the taller approval panel opens/closes — the footer never jumps
  • finalized transcript prefix is cached; only the streaming tail re-renders on spinner ticks (invalidated on finalize, resize, resume, clear)
  • busy refresh no longer yanks the reader out of scrollback
  • gauge fill glyphs switch on the same 75%/90% bands as its colors
  • emoji sandbox badge replaced with width-stable monochrome glyphs (● sandboxed / ▲ host access)
  • live elapsed badge ticks in whole seconds (tenths flickered at 12fps)
  • truncate() guarded against zero/negative budgets on very narrow terminals
  • human() promotes to M at the 999.5k rounding seam
  • /help restyled as a pre-styled brand card; session-delete hint tinted red; faint body text brightened for readability

Test plan

  • go build ./...
  • go test ./... — all packages pass, including new tests for token URL splitting, stderr token scanning, legacy fallback, guarded stand-in server (with/without enforcement), telemetry reset on clear, approval-panel layout stability, transcript prefix caching, busy-scroll preservation, and gauge glyph bands

Current odek serve protects its WS and REST APIs with a per-instance
token printed at startup. Resolve it in order: --token flag, ?token= in
the attach --url, the stderr banner of a spawned server (scanned live
via a passthrough writer), then a legacy cookie/probe fallback for odek
versions that predate enforced auth. The token is sent as
X-Odek-Ws-Token on every REST request and on the WS handshake.
- /clear and ctrl+l now reset session telemetry (turns, tools, tokens,
  age) so /stats and the header gauge start fresh
- keep the viewport height stable when the taller approval panel
  opens/closes, so the footer never jumps
- cache the finalized transcript prefix; re-render only the streaming
  tail on spinner ticks (invalidate on finalize, resize, resume, clear)
- busy refresh no longer yanks the reader out of scrollback
- gauge fill glyphs now switch on the same 75%/90% bands as its colors
- replace emoji sandbox badge with width-stable monochrome glyphs
- live elapsed badge ticks in whole seconds (tenths flickered at 12fps)
- guard truncate() against zero/negative budgets on narrow terminals
- human() promotes to M at the 999.5k rounding seam
- restyle /help as a pre-styled brand card; tint the destructive
  session-delete hint red; brighten faint body text
Cover the remaining gaps across server, tokens, and tui:

- server: Connect attach-not-ready and port-allocation errors, spawn
  start failure, Stop's kill fallback for SIGINT-ignoring children
  (extracts the hardcoded 8s kill wait into a stopTimeout var, mirroring
  readyTimeout), splitTokenURL's unparseable-URL return, legacyToken's
  probe error, and freePort under fd starvation (unix-only test)
- tokens: concurrent Set/Get/Delete smoke test under -race
- tui: shortenHome arms, welcome cwd line, resource glyphs, /stats
  conditional arms, esc/^R/^O keys, error-event fallback, disconnect
  log-path hint, thinking-enabled submit, step-glyph dedup/cap,
  fetchModels cmd, relayout-not-ready, syncAC query reuse and 6-file
  trim, elapsed minutes, multibyte capThinking, ctxGauge clamps,
  gaugeColor bands, acPopup cmd mode/narrow floor, footer gap floor

The three remaining uncovered blocks are verified-unreachable defensive
branches (json.MarshalIndent of map[string]string, glamour Render with
its fixed config, and a pad guard that cannot fire by construction).

Also gitignore the coverage.out written by `make cover`.
@jkyberneees
jkyberneees merged commit 7f6ec08 into main Jul 25, 2026
5 checks passed
@jkyberneees
jkyberneees deleted the feat/serve-token-auth branch July 25, 2026 15:02
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.

1 participant