singularity-forge/web/lib
Andrew 6cc6c36a69 fix(web): auth token gate — synthetic 401 on missing token, unauthenticated boot state, and recovery screen (#2740)
When `gsd --web` is opened without the #token= hash fragment (manual URL
entry, bookmark, new tab), `authenticatedFetch` previously fell through to
a naked `fetch()` that always returned 401, flooding the console with
cascading errors and leaving the UI in a broken state with no recovery path.

Three changes:

1. `web/lib/auth.ts` — `authFetch()` now returns a synthetic 401 Response
   when `getAuthToken()` returns null instead of delegating to bare fetch.
   This makes missing-token failures consistent and immediately catchable
   by all callers without a network round-trip.

2. `web/lib/gsd-workspace-store.tsx` — Added `"unauthenticated"` to
   `WorkspaceStatus`. `refreshBoot()` now detects a 401 response from
   /api/boot and patches `bootStatus` to `"unauthenticated"` instead of
   throwing a generic error. This is a distinct state — not an error worth
   retrying, but a configuration problem the user must resolve.

3. `web/components/gsd/app-shell.tsx` — Added an early-return guard that
   renders a minimal "Authentication Required" screen when
   `bootStatus === "unauthenticated"`. The screen explains the problem and
   tells users to copy the full terminal URL (including `#token=…`) or
   restart with `gsd --web`.

Fixes #2731
2026-03-26 16:17:12 -06:00
..
auth.ts fix(web): auth token gate — synthetic 401 on missing token, unauthenticated boot state, and recovery screen (#2740) 2026-03-26 16:17:12 -06:00
browser-slash-command-dispatch.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
command-surface-contract.ts feat: managed RTK integration with opt-in preference and web UI toggle (#2620) 2026-03-26 09:33:07 -06:00
dev-overrides.tsx feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
diagnostics-types.ts feat: enhance /gsd forensics with journal and activity log awareness 2026-03-25 18:19:08 +00:00
git-summary-contract.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
gsd-workspace-store.tsx fix(web): auth token gate — synthetic 401 on missing token, unauthenticated boot state, and recovery screen (#2740) 2026-03-26 16:17:12 -06:00
image-utils.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
initial-gsd-header-filter.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
knowledge-captures-types.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
project-store-manager.tsx feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
project-url.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
pty-chat-parser.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
pty-manager.ts feat: managed RTK integration with opt-in preference and web UI toggle (#2620) 2026-03-26 09:33:07 -06:00
remaining-command-types.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
session-browser-contract.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
settings-types.ts feat: managed RTK integration with opt-in preference and web UI toggle (#2620) 2026-03-26 09:33:07 -06:00
shutdown-gate.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
use-editor-font-size.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
use-terminal-font-size.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
use-user-mode.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
utils.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
visualizer-types.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
workflow-action-execution.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
workflow-actions.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
workspace-status.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00