mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
2983bbc69d
claude-sdk-python was the last integration still on the legacy auth-first shape: an authenticated-on-load page guarded by a class-based `ChatErrorBoundary`, a `useDemoAuth` exposing `authenticate`/`authenticated`, an `auth-banner` with an `onAuthenticate` prop and bespoke buttons, and NO `sign-in-card`. The byte-identical `auth.spec.ts` (which asserts an unauthenticated-first `SignInCard` with `auth-sign-in-button` / `auth-demo-token`) therefore failed all six cases against it. Port the four auth files verbatim from the langgraph-python gold standard (adapting nothing — the per-integration wiring, `agent="auth-demo"` and `runtimeUrl="/api/copilotkit-auth"`, was already identical): - use-demo-auth.ts: unauth-first, localStorage-backed, exposes `isAuthenticated`/`hasEverSignedIn`/`signIn`/`signOut`. - page.tsx: render `SignInCard` until first sign-in, then keep `<CopilotKit>` mounted across the sign-out cycle; shared `handleAuthError` on BOTH the provider and agent-scoped `<CopilotChat onError>`; clear-on-auth effect; amber `auth-demo-error` surface. - auth-banner.tsx: shared `<Button>`, `onSignIn`/`onSignOut` props. - sign-in-card.tsx: new, ported from the gold standard. Add the shared shadcn primitives the gold-standard frontend depends on and which claude-sdk-python was missing (`src/lib/utils.ts`, `src/components/ui/button.tsx`, `src/components/ui/card.tsx`) plus the `radix-ui` dependency they require, matching the claude-sdk-typescript peer. Red/green on the real surfaces: against the legacy frontend `auth.spec.ts` fails 6/6 (every test times out waiting for `auth-sign-in-button`); against the rebuilt frontend it passes 6/6 and the `--d5 --isolate` auth probe is green.
1.3 KiB
1.3 KiB