From a59fd92632d4a972b75365c711bd575b08749ae1 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sat, 23 May 2026 15:03:02 -0700 Subject: [PATCH] fix(admin-web): replace useAuth-getAccessToken with localStorage helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The devops page was importing useAuth from '@bytelyst/react-auth' and destructuring a non-existent 'getAccessToken' method: src/app/devops/page.tsx Type error: Module '@bytelyst/react-auth' has no exported member 'useAuth'. Property 'getAccessToken' does not exist on type 'AuthContextValue'. This had been silently masked because admin-web wasn't being built in the consumer-repo CI workflows that just used `pnpm build` filtered to /packages/*. Once those CI workflows switched to a broader `pnpm build` (in the fastgap and local_llms workflow rewrites), this dashboard build failure surfaced and blocked EVERY consumer-repo CI run that pulls common-plat at the start (fastgap, local_llms, jarvis_jr, etc.). Two fixes applied to the same file: 1. Import path — useAuth lives in '@/lib/auth-context' (admin-web's own provider exposed via createAuthProvider), not in '@bytelyst/react-auth'. That package only exports the factory, types, and LoginResult. 2. Token access — getAccessToken is NOT on AuthContextValue. The canonical pattern used throughout admin-web (settings/security, settings/devices, debug-sessions, …) is to read the token directly from localStorage under the 'admin_access_token' key. Switched to that pattern with a small typed helper at the top of the file. Both changes documented in-source with a comment block so the next agent doesn't try to re-introduce a useAuth.getAccessToken import. --- .../WINDSURF/.last-refresh.log | 14 +++++++------- .../learning_ai_auth_app/progess.md | 0 dashboards/admin-web/src/app/devops/page.tsx | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 __LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/repo_workflows/learning_ai_auth_app/progess.md diff --git a/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log b/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log index 04024980..00464809 100644 --- a/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log +++ b/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log @@ -1,9 +1,9 @@ -Last refresh: 2026-04-14T06:00:06Z (2026-04-13 23:00:06 PDT) -Cascade conversations: 50 (428M) -Memories: 132 +Last refresh: 2026-05-23T06:00:12Z (2026-05-22 23:00:12 PDT) +Cascade conversations: 50 (438M) +Memories: 137 Implicit context: 20 -Code tracker dirs: 151 -File edit history: 4640 entries -Workspace storage: 41 workspaces +Code tracker dirs: 14 +File edit history: 5093 entries +Workspace storage: 49 workspaces Repo docs: 7 files across 2 repos -Repo workflows: 55 files across 12 repos +Repo workflows: 56 files across 13 repos diff --git a/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/repo_workflows/learning_ai_auth_app/progess.md b/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/repo_workflows/learning_ai_auth_app/progess.md new file mode 100644 index 00000000..e69de29b diff --git a/dashboards/admin-web/src/app/devops/page.tsx b/dashboards/admin-web/src/app/devops/page.tsx index c5c98acf..d9f52166 100644 --- a/dashboards/admin-web/src/app/devops/page.tsx +++ b/dashboards/admin-web/src/app/devops/page.tsx @@ -1,7 +1,19 @@ 'use client'; import { DevopsPanel, type DevopsInfo } from '@bytelyst/devops/ui'; -import { useAuth } from '@bytelyst/react-auth'; + +// Match the canonical token-access pattern used elsewhere in +// admin-web (settings/security, settings/devices, debug-sessions, …): +// the auth-context stores the access token under the +// `admin_access_token` key in localStorage. The createAuthProvider +// AuthContextValue does NOT expose a `getAccessToken` method, so the +// previous `const { getAccessToken } = useAuth()` would not type-check +// once @bytelyst/react-auth's public surface was tightened (see +// commit fixing devops page import 2026-05-23). +function getAccessToken(): string | null { + if (typeof window === 'undefined') return null; + return localStorage.getItem('admin_access_token'); +} const bundleStartTime = Date.now(); @@ -16,8 +28,6 @@ function humanizeUptime(seconds: number): string { } export default function DevOpsPage() { - const { getAccessToken } = useAuth(); - async function fetchBackendInfo(): Promise { const token = getAccessToken(); const platformUrl = process.env.NEXT_PUBLIC_PLATFORM_URL || 'http://localhost:4003';