export declare const prefix = "everest-auth";
export declare const description = "Everest Playwright authentication \u2014 inject Cognito localStorage for browser automation against *.everest-systems.com";
export declare const scope = "prompt";
export declare const body = "# Everest Playwright Authentication\n\n## Why a cookie alone is not enough\nEverest uses AWS Amplify + Cognito with federated Google sign-in. The React app shell reads its auth state from `localStorage` on every page load. Injecting only the `everest-token` cookie still redirects to the login page because Amplify cannot find the localStorage keys it expects.\n\n## The 8 localStorage keys required\nAll under the prefix `CognitoIdentityServiceProvider.<clientId>.<username>.`:\n\n| Key suffix | Description |\n|---|---|\n| `oauthMetadata` | OAuth state bag |\n| `clockDrift` | Cognito clock-drift value |\n| `refreshToken` | Long-lived refresh token |\n| `LastAuthUser` | Username stored per-client |\n| `idToken` | JWT id token (short-lived, ~1 h) |\n| `accessToken` | JWT access token (short-lived) |\n| `oauthSignIn` | OAuth sign-in flag |\n\nPlus the top-level key:\n`CognitoIdentityServiceProvider.<clientId>.LastAuthUser`\n\n## Step 1 \u2014 Ask the user for the localStorage dump\nAsk the user:\n\n> \"Please open `https://appdev.everest-systems.com` in your normal browser (while logged in), open DevTools \u2192 Console, run the snippet below, and paste the result here.\"\n\n```js\ncopy(JSON.stringify(Object.fromEntries(\n  Object.entries(localStorage).filter(([k]) => k.startsWith('CognitoIdentityServiceProvider'))\n)))\n```\n\nThe result is a JSON object with all Cognito keys as properties.\n\n**Token expiry note:** `idToken` and `accessToken` expire after ~1 hour. If a dump from an earlier session fails (user still lands on login page), ask for a fresh dump.\n\n## Step 2 \u2014 First-time browser setup (if needed)\nIf the `playwright__browser_navigate` tool returns \"chrome-for-testing is not installed\", install it once:\n```bash\nnpx @playwright/mcp install-browser chrome-for-testing\n```\n\n## Step 3 \u2014 Inject and navigate\n1. Call `playwright__browser_navigate` with `url: \"https://appdev.everest-systems.com\"`\n   (establishes the origin for localStorage scope)\n2. Call `playwright__browser_evaluate` to inject all keys:\n   ```js\n   ({ dump }) => {\n     const data = JSON.parse(dump);\n     for (const [k, v] of Object.entries(data)) localStorage.setItem(k, v);\n   }\n   ```\n   Pass the user's JSON string as the `dump` argument.\n3. Call `playwright__browser_navigate` with the actual target URL\n   (Amplify bootstraps on page load and finds the keys \u2192 user is signed in)\n\n## Common failure modes\n| Symptom | Fix |\n|---|---|\n| Login screen still shown after injection | Check that all 8 keys were injected, not just `idToken`. Re-dump and re-inject. |\n| `localStorage.setItem` refused | Make sure step 1 navigated to an `everest-systems.com` URL *before* the inject step \u2014 browser must be on the same origin. |\n| Token expired error in-app | Ask the user for a fresh dump; tokens live ~1 hour. |\n\n## Cookie fallback (limited use)\nIf you have only the JWT id token as `everest-token` cookie, it works for **direct API calls** (`/api/...`) but the React app shell still redirects to login. Use the localStorage path for any UI-driving task.\n\n## Safety\nThe dump contains live access and refresh tokens. **Do not** echo it back to the user, save it to any file, or include it in a commit. Treat it as ephemeral credentials valid for this browser session only.\n";
