Skip to content

feat: 完善wewrok前端页面 - #1164

Merged
qdaxb merged 40 commits into
wecode-ai:mainfrom
Micro66:human/coyote-20260525-050753
May 26, 2026
Merged

qdaxb merged 40 commits into
wecode-ai:mainfrom
Micro66:human/coyote-20260525-050753

Conversation

@Micro66

@Micro66 Micro66 commented May 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features

    • Added authentication system with password and OpenID Connect (OIDC) login support
    • Launched interactive chat interface with real-time message streaming and error handling
    • Introduced comprehensive workbench with project navigation, task management, and resizable workspace panels
    • Added mobile-responsive design alongside desktop layout
    • Enabled context menu, model selection, and mode switching in chat composer
  • Chores

    • Removed specification documentation files

Review Change Stack

Micro66 added 30 commits May 25, 2026 17:50
@qdaxb
qdaxb merged commit ee65fe5 into wecode-ai:main May 26, 2026
15 checks passed
@coderabbitai

coderabbitai Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8ed805d-459f-4d4a-bdf9-680fceab5967

📥 Commits

Reviewing files that changed from the base of the PR and between ae00842 and 5d41ef9.

⛔ Files ignored due to path filters (1)
  • wework/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (78)
  • docs/superpowers/specs/2026-05-09-pipeline-next-step-context-design.md
  • docs/superpowers/specs/2026-05-13-agent-api-curl-guide-design.md
  • docs/superpowers/specs/2026-05-13-frontend-message-queue-design.md
  • start.sh
  • wework/.vite/deps/_metadata.json
  • wework/.vite/deps/package.json
  • wework/package.json
  • wework/src/App.test.tsx
  • wework/src/App.tsx
  • wework/src/api/adapters.test.ts
  • wework/src/api/auth.test.ts
  • wework/src/api/auth.ts
  • wework/src/api/http.test.ts
  • wework/src/api/http.ts
  • wework/src/api/projects.ts
  • wework/src/api/tasks.ts
  • wework/src/api/teams.ts
  • wework/src/components/chat/ChatInput.test.tsx
  • wework/src/components/chat/ChatInput.tsx
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx
  • wework/src/components/chat/composer/CompactChatComposer.tsx
  • wework/src/components/chat/composer/ComposerTextarea.tsx
  • wework/src/components/chat/composer/DesktopChatComposer.tsx
  • wework/src/components/chat/composer/DesktopComposerToolbar.tsx
  • wework/src/components/chat/composer/DesktopContextMenu.tsx
  • wework/src/components/chat/composer/DesktopModeSelector.tsx
  • wework/src/components/chat/composer/DesktopModelSelector.tsx
  • wework/src/components/chat/composer/ProjectWorkBar.tsx
  • wework/src/components/chat/composer/useAutoResizeTextarea.ts
  • wework/src/components/chat/composer/useOutsideClick.ts
  • wework/src/components/layout/DesktopSettingsMenu.tsx
  • wework/src/components/layout/DesktopSidebar.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.tsx
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/layout/MobileDrawer.tsx
  • wework/src/components/layout/MobileWorkbenchLayout.test.tsx
  • wework/src/components/layout/MobileWorkbenchLayout.tsx
  • wework/src/components/layout/useResizableSidebar.ts
  • wework/src/components/layout/workspace-panels/BottomWorkspacePanel.tsx
  • wework/src/components/layout/workspace-panels/RightWorkspacePanel.tsx
  • wework/src/components/layout/workspace-panels/WorkspacePanelActions.tsx
  • wework/src/components/layout/workspace-panels/WorkspacePanelCards.tsx
  • wework/src/components/layout/workspace-panels/useResizableWorkspacePanel.ts
  • wework/src/components/ui/button.tsx
  • wework/src/config/runtime.ts
  • wework/src/features/auth/AuthProvider.test.tsx
  • wework/src/features/auth/AuthProvider.tsx
  • wework/src/features/auth/redirect.test.ts
  • wework/src/features/auth/redirect.ts
  • wework/src/features/auth/useAuth.ts
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/WorkbenchProvider.tsx
  • wework/src/features/workbench/messageReducer.test.ts
  • wework/src/features/workbench/messageReducer.ts
  • wework/src/features/workbench/useWorkbench.ts
  • wework/src/features/workbench/workbenchReducer.test.ts
  • wework/src/features/workbench/workbenchReducer.ts
  • wework/src/hooks/useIsDesktop.ts
  • wework/src/hooks/useIsMobile.ts
  • wework/src/i18n/index.ts
  • wework/src/i18n/locales/en/common.json
  • wework/src/i18n/locales/zh-CN/common.json
  • wework/src/pages/LoginPage.test.tsx
  • wework/src/pages/LoginPage.tsx
  • wework/src/pages/OidcCallbackPage.test.tsx
  • wework/src/pages/OidcCallbackPage.tsx
  • wework/src/pages/WorkbenchPage.tsx
  • wework/src/stream/chatStream.test.ts
  • wework/src/stream/chatStream.ts
  • wework/src/stream/socketClient.ts
  • wework/src/styles/globals.css
  • wework/src/test/setup.ts
  • wework/src/types/api.ts
  • wework/src/types/workbench.ts
  • wework/tsconfig.app.json
  • wework/vite.config.ts

📝 Walkthrough

Walkthrough

This PR removes three design specification documents and implements a complete Wework frontend MVP: authentication flow with password/OIDC login, HTTP client with Bearer token handling and 401 redirect support, Socket.IO chat streaming, Redux-style state reducers for messages and workbench state, responsive desktop/mobile layouts with resizable components, REST API adapters, and internationalization. Comprehensive test coverage and build tooling (Vitest, React Testing Library, jsdom) are configured.

Changes

Wework Frontend MVP Implementation

Layer / File(s) Summary
Build Configuration & Development Setup
package.json, start.sh, wework/vite.config.ts, wework/tsconfig.app.json, wework/.vite/deps/*
Package dependencies (lucide-react, socket.io-client, vitest, testing libraries) and Vite proxy configuration for /api and /socket.io targets sourced from runtime environment variables.
Type Definitions
wework/src/types/api.ts, wework/src/types/workbench.ts
API entity contracts (User, Team, Project, Task, Chat payloads) and workbench state shapes (messages with role/status, UI selection state, input/sending flags).
HTTP Client & Token Management
wework/src/api/http.ts, wework/src/api/http.test.ts, wework/src/api/auth.ts, wework/src/api/auth.test.ts
Typed HTTP client with Bearer auth, error parsing, 401 redirect to /login with session persistence. Token storage (localStorage + auth cookie), expiry computation from JWT payload, and session helpers.
Redirect & Auth Routing Utilities
wework/src/features/auth/redirect.ts, wework/src/features/auth/redirect.test.ts, wework/src/features/auth/useAuth.ts
Path sanitization rejecting external URLs and dangerous schemes, session-persisted post-login targets, auth context and hook for consuming auth state.
Authentication Provider & State
wework/src/features/auth/AuthProvider.tsx, wework/src/features/auth/AuthProvider.test.tsx, wework/src/config/runtime.ts
AuthProvider managing user state, token refresh, login/logout flows, periodic validation, and protected-route redirects. Runtime configuration reading Vite env variables with sensible defaults.
Login Pages
wework/src/pages/LoginPage.tsx, wework/src/pages/LoginPage.test.tsx, wework/src/pages/OidcCallbackPage.tsx, wework/src/pages/OidcCallbackPage.test.tsx
LoginPage supporting password and/or OIDC authentication modes with form validation and error display. OidcCallbackPage parsing tokens and query parameters, storing redirect targets, and forwarding to server.
REST API Adapters
wework/src/api/projects.ts, wework/src/api/tasks.ts, wework/src/api/teams.ts, wework/src/api/adapters.test.ts
Typed HTTP client factories for projects (list/get/create conversation), tasks (recent with pagination, detail), and teams (list/default selection by mode preference).
Socket.IO & Chat Streaming
wework/src/stream/socketClient.ts, wework/src/stream/chatStream.ts, wework/src/stream/chatStream.test.ts
Socket.IO client with auth token and reconnection config. Chat stream adapter wrapping socket events (start/chunk/done/error), task join/leave, message send operations.
State Reducers: Messages & Workbench
wework/src/features/workbench/messageReducer.ts, wework/src/features/workbench/messageReducer.test.ts, wework/src/features/workbench/workbenchReducer.ts, wework/src/features/workbench/workbenchReducer.test.ts
Message reducer handling user/assistant creation, streaming chunks, status transitions. Workbench reducer managing bootstrapping, project/task selection, input, sending state.
Workbench Provider: Orchestration
wework/src/features/workbench/WorkbenchProvider.tsx, wework/src/features/workbench/WorkbenchProvider.test.tsx, wework/src/features/workbench/useWorkbench.ts
WorkbenchProvider bootstrapping team/projects/tasks, subscribing to chat stream, exposing actions for selection/input/send. Includes dependency injection and context hook.
Chat UI: Input, Messages, Composers
wework/src/components/chat/ChatInput.tsx, wework/src/components/chat/ChatInput.test.tsx, wework/src/components/chat/MessageList.tsx, wework/src/components/chat/MessageList.test.tsx, wework/src/components/chat/composer/*
ChatInput dispatcher selecting layout variant, MessageList displaying messages with status/error. Desktop/compact composers with auto-resizing textareas, toolbars with dropdowns (model/mode/context), and helper hooks.
Desktop Layout: Sidebar, Main, Panels
wework/src/components/layout/DesktopSidebar.tsx, wework/src/components/layout/DesktopWorkbenchLayout.tsx, wework/src/components/layout/DesktopWorkbenchMain.tsx, wework/src/components/layout/workspace-panels/*, wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
Resizable sidebar with project/task navigation and settings menu. Main area with conversation/empty-state views, togglable right/bottom panels with resize handles. Comprehensive layout tests.
Mobile Layout: Drawer & Workbench
wework/src/components/layout/MobileDrawer.tsx, wework/src/components/layout/MobileWorkbenchLayout.tsx, wework/src/components/layout/MobileWorkbenchLayout.test.tsx
Mobile drawer with user avatar, navigation, project/task lists. Mobile workbench layout with conversation/empty-state views, drawer integration, and localized strings.
App Routing & Auth Gating
wework/src/App.tsx, wework/src/App.test.tsx, wework/src/pages/WorkbenchPage.tsx
App root wrapping routes in AuthProvider, auth-gated routing for login/OIDC callback/workbench. WorkbenchPage selecting responsive layouts via media query hooks.
Internationalization
wework/src/i18n/index.ts, wework/src/i18n/locales/zh-CN/common.json, wework/src/i18n/locales/en/common.json
i18n config with zh-CN default, supported languages, and comprehensive locale files for workbench UI, authentication, and chat features.
Global Styles & Responsive Hooks
wework/src/styles/globals.css, wework/src/hooks/useIsDesktop.ts, wework/src/hooks/useIsMobile.ts, wework/src/components/ui/button.tsx
CSS baseline reset with layout height, typography inheritance, button cursor behavior. Media query hooks for responsive layout selection.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

  • wecode-ai/Wegent#1159: Modifies start.sh and backend service integration for WeWork, sharing environment variable setup and local development workflow configuration with this PR.

Suggested Reviewers

  • qdaxb

Poem

🐰 A frontend blooms with auth and chat,
Where messages stream and ui's flat,
Desktop dances, mobile sways,
With tests and i18n, code's ablaze!
From socket whispers to reducer's might—
WeWork workbench shines so bright! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

2 participants