12 KiB
Step-by-Step Setup & Operator Routing Readiness Wizard Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Build a complete step-by-step setup wizard, operator routing readiness diagnostic, live route simulator, and one-click quick-fix system across backend and frontend in all three locales (en-US, ru-RU, zh-CN).
Architecture: A dedicated SetupReadinessService in Go evaluates the 6-step customer-to-operator routing chain (AgentTeam -> AgentTeamSchedule -> AgentProfile -> AIAgent -> Channel -> End-to-End path), simulates channel dispatch dry-runs, and executes atomic one-click fixes. The Next.js frontend exposes this through a dedicated /dashboard/setup page, a setup banner on /dashboard, a sidebar navigation entry, and an interactive operator readiness indicator in WorkbenchHeader and SiteHeader.
Tech Stack: Go 1.26, Gin, GORM (github.com/mlogclub/simple/sqls), Next.js 16 App Router, React 19, TypeScript, Tailwind CSS, Base UI / shadcn primitives.
Spec: docs/superpowers/specs/2026-10-16-onboarding-readiness-wizard-design.md
Global Constraints
- Follow
models -> repositories -> services -> handlers -> builders/response DTOslayer ownership (AGENTS.md4.1). - Use
anyinstead ofinterface{}in new Go code (AGENTS.md3). - Support all 3 locales on both backend (
internal/pkg/i18nx/locales/{en-US,ru-RU,zh-CN}.yml) and frontend (web/messages/{en-US,ru-RU,zh-CN}.json). - Route all frontend API calls through
web/lib/api/client.ts(AGENTS.md5.1). - Use
rounded-mdand noshadowon support/dashboard cards, and useOptionComboboxfor dropdowns (AGENTS.md5.1, 5.4).
Review Focus
- Off-hours schedule false-positive:
AgentTeamScheduleexists for a team, but itsStartAt/EndAtwindow does not covertime.Now()->schedulesstep must return"warning"withno_schedule_nowandcan_receive_requests_now = false. - AI-Only mode blocking human handoff: All active
AIAgentrecords haveServiceMode == IMConversationServiceModeAIOnly->ai_agentsstep must flag"agent_ai_only_mode"and simulator must report"blocked_ai_only_mode". - Empty
AIAgent.TeamIDsor deleted teams:AIAgent.TeamIDsis""or references only disabled/non-existent team IDs ->ai_agentsstep must flag"agent_no_teams"andfix_ai_agent_handoffmust bind valid active team IDs. - Operator profile busy or
AutoAssignEnabled == false: Operator is in an active team with an active schedule, butServiceStatus == ServiceStatusBusyorAutoAssignEnabled == false->current_operator.can_receive_nowmust befalsewith exactblocker_codes(status_busy/auto_assign_disabled), andenable_my_operator_profilemust restoreServiceStatusIdleandAutoAssignEnabled = true. - Idempotent
quick_setup_allon partially configured database: Runningquick_setup_alltwice in a row must not duplicate default teams, channels, or schedules when valid active ones already exist.
Task 1: Backend DTOs, Locales, and SetupReadinessService (with TDD)
Files:
- Create:
internal/pkg/dto/request/setup_readiness_req.go - Create:
internal/pkg/dto/response/setup_readiness_resp.go - Create:
internal/services/setup_readiness_service.go - Create:
internal/services/setup_readiness_service_test.go - Modify:
internal/pkg/i18nx/locales/en-US.yml - Modify:
internal/pkg/i18nx/locales/ru-RU.yml - Modify:
internal/pkg/i18nx/locales/zh-CN.yml
Interfaces:
-
Produces:
request.SetupSimulateRouteRequest { ChannelID int64; BypassAI bool }request.SetupQuickFixRequest { Action string; EntityID int64 }response.SetupReadinessResponse,response.SetupSimulateRouteResponse,response.SetupQuickFixResponseservices.SetupReadinessService.GetReadiness(operator *dto.AuthPrincipal) (*response.SetupReadinessResponse, error)services.SetupReadinessService.SimulateRoute(req request.SetupSimulateRouteRequest, operator *dto.AuthPrincipal) (*response.SetupSimulateRouteResponse, error)services.SetupReadinessService.ApplyQuickFix(req request.SetupQuickFixRequest, operator *dto.AuthPrincipal) (*response.SetupQuickFixResponse, error)
-
Step 1: Write failing tests in
internal/services/setup_readiness_service_test.goCover:TestSetupReadiness_EmptyDBAndQuickSetupAll(verifies all 6 steps fail on empty DB, thenApplyQuickFix("quick_setup_all")makes all 6 steps"ok",CanReceiveRequestsNow == true,CurrentOperator.CanReceiveNow == true, and a second call is idempotent).TestSetupReadiness_OffHoursAndBusyOperator(verifies schedule outsidenowtriggersno_schedule_nowandteam_off_hours, and busy/auto-assign-off operator triggersstatus_busy/auto_assign_disabled, thenenable_my_operator_profileandensure_team_and_scheduleresolve them).TestSetupReadiness_SimulateRoute_AIOnlyAndMissingTeams(verifiesSimulateRoutereportsblocked_ai_only_modewhenServiceMode == IMConversationServiceModeAIOnly,blocked_agent_no_teamswhenTeamIDs == "", andassigned_to_operatorwith matched operator afterfix_ai_agent_handoff).
-
Step 2: Run test to verify it fails Run:
go test -v ./internal/services -run TestSetupReadinessExpected: FAIL (missing types andSetupReadinessService) -
Step 3: Implement DTOs, backend locale keys, and
SetupReadinessServiceCreateinternal/pkg/dto/request/setup_readiness_req.go,internal/pkg/dto/response/setup_readiness_resp.go, andinternal/services/setup_readiness_service.go. Adderror.setup.*keys toen-US.yml,ru-RU.yml, andzh-CN.yml. -
Step 4: Run tests to verify they pass Run:
go test -v ./internal/services -run TestSetupReadinessExpected: PASS
Task 2: Backend HTTP Handlers and Route Registration
Files:
- Create:
internal/handlers/dashboard/setup_readiness_handler.go - Modify:
internal/bootstrap/routes.go - Modify:
internal/bootstrap/server.go
Interfaces:
-
Consumes:
services.SetupReadinessServicefrom Task 1. -
Produces:
GET /api/dashboard/setup/readiness(dashboard.SetupGetReadiness)POST /api/dashboard/setup/simulate_route(dashboard.SetupPostSimulate_route)POST /api/dashboard/setup/quick_fix(dashboard.SetupPostQuick_fix)
-
Step 1: Create
internal/handlers/dashboard/setup_readiness_handler.goImplementSetupGetReadiness,SetupPostSimulate_route, andSetupPostQuick_fixusingservices.AuthService.GetCurrentPrincipal(ctx)andhttpx.WriteJSON. -
Step 2: Register routes in
internal/bootstrap/routes.goandinternal/bootstrap/server.goAddregisterDashboardSetupRoutes(dashboardGroup.Group("/setup"))inserver.goand defineregisterDashboardSetupRoutesinroutes.go. -
Step 3: Run
gofmtand Go build/tests Run:gofmt -w internal/pkg/dto/request/setup_readiness_req.go internal/pkg/dto/response/setup_readiness_resp.go internal/services/setup_readiness_service.go internal/services/setup_readiness_service_test.go internal/handlers/dashboard/setup_readiness_handler.go internal/bootstrap/routes.go internal/bootstrap/server.go && go test ./internal/services -run TestSetupReadinessExpected: PASS with zero compile/test errors.
Task 3: Frontend API Client & 3-Locale Translations (en-US, ru-RU, zh-CN)
Files:
- Create:
web/lib/api/setup-readiness.ts - Modify:
web/messages/en-US.json - Modify:
web/messages/ru-RU.json - Modify:
web/messages/zh-CN.json - Modify:
web/lib/navigation.tsx
Interfaces:
-
Produces:
fetchSetupReadiness(): Promise<SetupReadinessResponse>simulateSetupRoute(payload: { channel_id?: number; bypass_ai?: boolean }): Promise<SetupSimulateRouteResponse>applySetupQuickFix(payload: { action: SetupQuickFixAction; entity_id?: number }): Promise<SetupQuickFixResponse>nav.setupWizardandsetupWizard.*translation keys inen-US.json,ru-RU.json, andzh-CN.json- Navigation entry
/dashboard/setupinweb/lib/navigation.tsx
-
Step 1: Create
web/lib/api/setup-readiness.tsDefine exact TypeScript interfaces matchingSetupReadinessResponse,SetupSimulateRouteResponse, andSetupQuickFixResponse, usingrequestDatafrom@/lib/api/client. -
Step 2: Add
/dashboard/setuptoweb/lib/navigation.tsxAdd{ titleKey: "nav.setupWizard", url: "/dashboard/setup", icon: <ListChecksIcon /> }todashboardNavSectionsunder Reception Center (nav.receptionCenter) right after Overview, and add page title mapping ingetPageTitleKey. -
Step 3: Add complete
setupWizardandnav.setupWizardtranslations inen-US.json,ru-RU.json, andzh-CN.jsonDelegate translation generation/verification to a Gemini Flash subagent (model: "flash") and apply matching keys across all three JSON files.
Task 4: Frontend Setup Wizard Page, Dashboard Banner, and Operator Readiness Popover
Files:
- Create:
web/app/(dashboard)/dashboard/setup/page.tsx - Create:
web/app/(dashboard)/dashboard/setup/_components/setup-wizard-view.tsx - Create:
web/app/(dashboard)/dashboard/_components/setup-readiness-banner.tsx - Create:
web/components/operator-readiness-indicator.tsx - Modify:
web/app/(dashboard)/dashboard/_components/dashboard-home.tsx - Modify:
web/components/workbench-header.tsx - Modify:
web/components/site-header.tsx
Interfaces:
-
Consumes:
web/lib/api/setup-readiness.tsandsetupWizard.*i18n keys from Task 3. -
Produces:
/dashboard/setuppage with 6-step interactive checklist, current operator readiness card, 1-click quick fixes, and live route simulator with candidate operator table.SetupReadinessBannerdisplayed at the top ofDashboardHomewhenever any step is not"ok"or current operator cannot receive chats.OperatorReadinessIndicatordisplayed inWorkbenchHeaderandSiteHeadershowing live operator readiness status and 1-click fix popover.
-
Step 1: Build
OperatorReadinessIndicator(web/components/operator-readiness-indicator.tsx) Compact header button + popover showing whether customer requests can reach the current operator right now, listing specific blockers (missing_profile,no_team,team_off_hours,status_busy,auto_assign_disabled,at_capacity, or global chain issues), with a 1-click "Enable Chat Reception" (enable_my_operator_profile/quick_setup_all) button and link to/dashboard/setup. -
Step 2: Build
SetupReadinessBanner(web/app/(dashboard)/dashboard/_components/setup-readiness-banner.tsx) Alert card on/dashboardhome page when setup is incomplete or current operator is blocked, showingready_steps / total_steps, broken step badges, 1-click "Fix Automatically" button, and "Open Step-by-Step Setup" button. -
Step 3: Build
/dashboard/setuppage andSetupWizardView(web/app/(dashboard)/dashboard/setup/_components/setup-wizard-view.tsx) Implement the 6-step readiness checklist with per-step issues, 1-click quick-fix actions, management links (/dashboard/agents,/dashboard/agent-team-schedules,/dashboard/ai-agents,/dashboard/channels), current operator status card, and the interactive Route Simulator (OptionComboboxfor channel selection, 5-hop visual pipeline, and candidate operator table). -
Step 4: Wire into
DashboardHome,WorkbenchHeader, andSiteHeaderMount<SetupReadinessBanner />inweb/app/(dashboard)/dashboard/_components/dashboard-home.tsx, and mount<OperatorReadinessIndicator />inweb/components/workbench-header.tsxandweb/components/site-header.tsx. -
Step 5: Run TypeScript check, ESLint, Go tests, and Snyk security scan Run:
cd web && pnpm typecheckcd web && pnpm lintgo test ./internal/services/...- Snyk code scan (
snyk_code_scan) on changed files.