-
Notifications
You must be signed in to change notification settings - Fork 18
B2C Flow v1 #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
B2C Flow v1 #381
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement human-assisted mode enabling admins to monitor and respond to chat sessions in real-time. Key features: - Database schema updates: chat_session_mode enum (autonomous/human_assisted), mode column, admin_user_id tracking - Admin interface for viewing and responding to chat sessions with real-time updates (5-second polling) - Mode switching functionality with user notifications - Admin message API endpoints for viewing and creating responses - Enhanced chat session columns with mode indicators - Type safety improvements with centralized AdminSessionDetail and AdminSessionMessagesResponse types Technical changes: - Migration 0008: Add chat_session_mode enum and mode column with autonomous default - New API routes: GET/POST /api/admin/chat-sessions/[sessionId]/messages - Enhanced /api/admin/chat-sessions/[sessionId] with mode switching - Real-time message polling in admin chat interface - Justfile updates for migrations workflow - Fix knip warnings by making AdminMessage and ChatMessageRole internal types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Extract data fetching and mutation logic from admin chat session detail page into a dedicated custom hook following TanStack Query best practices. This improves code organization, testability, and reusability. Changes: - NEW: src/hooks/use-admin-chat-session.ts - Custom hook for admin chat session operations - MODIFIED: src/app/(admin)/admin/chat-sessions/[id]/page.tsx - Refactored to use new hook - MODIFIED: src/lib/types/chat-sessions.ts - Added hook type definitions (UseAdminChatSessionOptions, UseAdminChatSessionReturn) Benefits: - Separates data layer from presentation layer - Centralizes session and message queries - Simplifies component logic and state management - Improves code maintainability and testability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
… UI consistency and readability style(chat-interface.tsx): update alert component layout for better visual alignment and spacing
- Replace simple Input with ChatInput component for consistency with user interface - Add API support for handling FormData with file attachments - Implement file upload to Digital Ocean Spaces for admin messages - Update hook and types to support attachment parameters - Improve UI styling to match other admin detail views - Fix loading state flash showing Session not found - Add proper dark mode support for message area 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…ction status for imported projects - Update ProjectCard to use ProjectWithOwnerStatus for better type safety. - Modify API routes to check if the project owner has a connected GitHub account. - Add userHasGitHubConnected function to verify GitHub connection status without fetching the token. - Improve user experience by providing feedback on GitHub connection status in various components.
- Add useReverification hook to handle stale session tokens automatically - Add early GitHub connection checks in organizations and repositories API routes - Enhance GitHub token fetch error logging with detailed debugging information - Handle reverification cancellation gracefully without throwing errors
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Added comprehensive logging to debug GitHub App authentication during PR creation: - Added logging to getProjectOctokit() to trace installation ID usage - Added GitHub App authentication verification in PR creation endpoint - Added PR creation result logging to verify identity of PR creator This helps identify whether PRs are created as the GitHub App bot or incorrectly as the user.
- Include user email in PR description for better traceability - Fetch user email from ClerkService in API route as fallback - Pass email from client when dbUser is available - Remove debug console.log statements from useGitHubRepositories hook
Add B2C user flow for requirements collection before development: - Add project status field (requirements/requirements_ready/in_development/active) - Add requirements messages table for separate chat flow - Create requirements-specific preview components (preview, ready, in-development) - Add agent health check API and hook with polling - Implement requirements confirmation flow with Slack notifications - Add mode-aware chat interface supporting both development and requirements modes - Create slot machine animation component for in-development status - Add sandbox health monitoring for agent status display - Update preview panel with status-based content rendering - Make waitForAgent public in SandboxManager for requirements API
Refactor the requirements messages endpoint to stream AI responses in real-time via Server-Sent Events (SSE), matching the pattern used by the chat sessions endpoint. Changes: - API route now uses ReadableStream for SSE streaming - Frontend hook consumes stream with getReader() for incremental updates - Chat interface shows streaming UI for requirements mode - Removed dedicated requirements sandbox - uses existing project sandbox
…anel Move the "Confirm Requirements" button and confirmation modal from ChatInterface to RequirementsPreview for better UX placement. The button now appears in the preview header alongside a new sidebar collapse toggle. Changes: - Add sidebar toggle and confirm button to RequirementsPreview header - Add tooltip with contextual message based on content state - Improve empty state with Alert component - Pass confirmation props through PreviewPanel - Remove confirm button logic from ChatInterface
Agent status in the model banner now shows Checking until 3 consecutive health checks confirm the sandbox is not running, instead of immediately showing Sandbox stopped on the first failure.
…g phase Poll requirements document every 5 seconds while project status is 'requirements' to keep the preview in sync with sandbox updates. Stops polling when tab is hidden to reduce unnecessary requests.
Integrate BlockNote editor for requirements editing with real-time polling for requirement docs during gathering phase.
Lift save status state from editor to preview component and display the saving/saved indicator in the header next to the confirm button. Also adds top padding between header and editor content.
…otifications Add payment status management to B2C flow: - Add waiting_for_payment and paid status to project schema - Add stripeInvoiceUrl field to projects table - Create admin API endpoint to update payment status - Implement email notifications via Resend for status changes - Add WaitingForPaymentPreview component with invoice link - Update admin project page with payment status controls - Extend admin projects API to return payment-related fields
- Add collapse sidebar icon to WaitingForPaymentPreview and InDevelopmentPreview - Update types to include onToggleSidebar and isSidebarCollapsed props - Set consistent h-12 height across all preview headers - Remove redundant TooltipProvider wrappers - Add vertical padding to BlockNote editor content area
Add hover-triggered copy button to chat messages that copies message content including text, thinking blocks, and tool calls
The sandbox was emitting search_results events from web search but the API route was not forwarding them to the browser client.
When requirements are confirmed, commit .kosuke/docs.md to git before changing status. If commit fails, confirmation is blocked. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add automated environment variable detection and configuration flow: - Environment analysis worker to detect required variables from project - Environment preview component with form inputs for each variable - Re-analyze functionality with confirmation dialog - API endpoints for environment status, values, and updates - Database schema for environment jobs tracking
Add ability to switch between environment variables configuration and requirements document view in the EnvironmentsPreview component, similar to the game/docs toggle in InDevelopmentPreview.
Adds a copy-to-clipboard button that appears on hover in the top-right corner of the requirements editor, allowing users to copy markdown content regardless of project status
Add git commit functionality for kosuke.config.json when confirming environment variables, similar to how requirements are committed.
Resolve conflicts and regenerate migrations: - Keep both projectStatusEnum (B2C) and chatSessionModeEnum (human-in-the-loop) - Drop conflicting 0008_nifty_switch migration, regenerate as 0016 - Merge UI changes for admin/human-assisted chat support - Fix TypeScript types for admin role and adminUserId 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add Slack notifications for two key events: - New user signup: notifies when user completes onboarding (creates workspace) - Human mode messages: notifies on every user message when chat is in human_assisted mode Both notifications are non-blocking (fire and forget) and use the existing SLACK_DEV_CHANNEL_WEBHOOK_URL environment variable.
Replace the separate requirementsMessages table with a messageType enum column on chatMessages. This simplifies the schema by using a single table for all message types, distinguished by 'chat' or 'requirements'. - Add messageTypeEnum to distinguish message types - Update requirements API route to use chatMessages with messageType filter - Remove requirementsMessages table, relations, and types
…t updates Add comprehensive notification infrastructure: - Database schema for notifications, product updates, and user preferences - Inbox dropdown UI with tabs for notifications and product updates - API routes for managing notifications and read status - Admin panel for managing product updates and sending notifications - User notification settings page with preference toggles - Ghost CMS admin client for product update sync - Email service refactoring with template system
Resolve conflicts in project-card.tsx and page.tsx: keep ProjectActionsDropdown component approach, remove duplicate headers (moved to ProjectHeader), remove unused NavbarInbox import
Fixes TS7016 error by adding module declaration with proper types for GhostAdminAPI class and members API
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
agent-onlymode for sandbox