Agent desk platform
The agent desk platform is the Vue client for Helpdesk work. It joins the Frappe session and site context to a browser application, guides new sites through setup, sends signed-in users to the right persona experience, and shares live desk data across its pages. The desk application shell and identity, permissions, and real-time behavior pages explain the visual shell and the session and event rules in more detail.
Platform boundary
The desk is a browser application hosted by Frappe under /helpdesk/. Frappe provides the session, site settings, user identity, setup status, and service endpoints. The Vue client turns those values into startup behavior, first-run setup, protected navigation, shared state, and agent work areas.
The platform connects four concerns:
- site-aware application startup
- access-controlled agent navigation
- shared state for identity, settings, workflow, availability, and notices
- HTTP and socket access to Frappe services
The platform also supports shared editing state for administrative areas such as the knowledge base, holiday lists, and SLA policies. These areas use common reactive data so a multi-step form can move between views without losing its current work.
Application startup
Boot sequence
The boot sequence joins Frappe site context to the Vue application before the first desk page renders. It installs the Frappe UI services and shared state, starts the router and site socket, then mounts the application; development mode first loads the same context that production provides to the page.
The main startup boundary is:
flowchart LR
A[Frappe site context] --> B[Vue bootstrap]
B --> C[Frappe UI services]
B --> D[Shared Pinia state]
B --> E[Router and access checks]
B --> F[Site socket]
C --> G[Mounted agent desk]
D --> G
E --> G
F --> G
The application applies site language, text direction, time zones, theme, and branding at this boundary. It also gives the shared UI layer one place to show server messages, request failures, and browser connectivity changes. Boot data includes the setup flags that decide whether the first-run flow must remain open.
References: desk/…/main.js• L1-100 desk/…/App.vue• L1-44 desk/…/types.ts• L663-679
Service feedback
The client gives Frappe UI a common request and error boundary. Server messages become user feedback when they carry useful desk information, while request failures become visible error notices instead of staying inside a page-level request.
This boundary keeps the feedback model consistent across resources such as settings, statuses, notifications, and administrative forms. The application therefore presents service results through the same desk-wide message and dialog services.
References: desk/…/main.js• L36-64 desk/…/App.vue• L1-6
Setup onboarding
Setup flow
The setup flow prepares a new Helpdesk site before normal desk work begins. It presents a required password step and optional workspace, email, and team steps, then records completion with Frappe before opening the desk.
The flow keeps the user's progress and preview in one shared setup state. A user can skip optional work and finish it later from Settings, while a pending setup flag keeps normal desk routes from opening early.
This diagram shows how first-run choices become a ready Helpdesk site.
flowchart LR
A[Setup pending] --> B[Set password]
B --> C[Name workspace]
C --> D[Connect support email]
D --> E[Invite agents]
E --> F[Complete setup in Frappe]
F --> G[Open Helpdesk]
C -. skip optional steps .-> F
D -. set up later .-> E
References: desk/…/Setup.vue• L31-96 desk/…/setup.ts• L32-79 desk/…/setup.ts• L221-252 desk/…/index.ts• L142-153 desk/…/types.ts• L676-678
Setup services
The setup flow uses Frappe services to save the first password and workspace identity, connect a mailbox, and invite agents. A connected support mailbox turns incoming email into tickets, while the workspace name and logo shape the customer portal and desk identity.
The email step supports provider sign-in and manual account setup. It can continue after the mailbox is ready for import, so mailbox connection does not block the rest of the setup flow.
References: desk/…/SetupPasswordStep.vue• L131-209 desk/…/SetupWorkspaceStep.vue• L146-225 desk/…/SetupEmailStep.vue• L142-229 desk/…/SetupProviderPicker.vue• L499-576 desk/…/SetupTeamStep.vue• L251-313
Setup outcome
The completion dialog summarizes the mailbox and agent results and can collect setup feedback. The final navigation waits for the server to record setup, then opens the desk with a fresh ticket route.
References: desk/…/Setup.vue• L90-96 desk/…/SetupDoneDialog.vue• L267-315 desk/…/setup.ts• L225-252
Persona routing
Desk access
The platform uses the signed-in Frappe session to decide whether a user can enter the agent desk. Authentication answers whether a session exists; the user information resource then supplies the access and role facts used by navigation.
The access outcomes are:
| Session state | Platform outcome |
|---|---|
| No session or a guest session | Redirect to the Frappe login flow and preserve the requested desk path when present |
| Signed-in user without desk access | Redirect to the configured customer home page |
| Signed-in user with desk access | Continue to the requested agent desk route |
| Agent user opening an agent ticket route | Continue in the agent desk |
| Non-agent user opening an agent ticket route | Redirect to the customer ticket route |
The router applies these checks before a protected page continues. It also loads the shared user lookup after navigation so later pages can use one common set of user data.
References: desk/…/index.ts• L9-20 desk/…/index.ts• L154-195 desk/…/auth.ts• L14-85
Route groups
The router maps the /helpdesk/ history base to the agent root and its work areas. The route set covers home, tickets, notifications, knowledge base, search, customers, contacts, dashboards, and call logs; ticket views can select a mobile presentation when the screen is small.
The route guard treats ticket access as a persona boundary. An agent can use the internal ticket route, while a user without agent status is sent to the customer-facing ticket path instead of receiving the internal ticket view. A site with pending setup is held on the setup route until setup is complete.
References: desk/…/index.ts• L23-153 desk/…/index.ts• L155-187
Shared application state
State model
Pinia and shared reactive resources keep desk-wide facts consistent across pages. The stores combine server-backed data with short-lived form and view state so pages do not create separate copies of identity, policy, workflow, and availability.
The main state groups are:
| State group | Platform role |
|---|---|
| Session identity and access | User identity, desk access, role facts, teams, locale, and agent availability supplied by Frappe |
| Site policy | Brand values and settings that shape assignment, feedback, comments, and workflow behavior |
| Agent availability | Status choices, current availability, expiry, optimistic changes, and live updates for agents |
| Ticket workflow | Agent and customer labels, order, enabled states, categories, and colors for shared ticket views |
| Notifications | Current-user notices, unread state, filters, and ticket deep links |
| Administrative editing | In-progress knowledge base, holiday list, and SLA data with validation and reset behavior |
The state layer keeps durable service data separate from local editing state. Server-backed resources remain the source of truth, while local state supports a multi-step screen until it is saved or reset. Shared settings include a bounded brand name and uploaded logo and favicon values so the desk and customer-facing surfaces keep one site identity.
References: desk/…/auth.ts• L14-111 desk/…/config.ts• L6-51 desk/…/agentStatus.ts• L54-118 desk/…/ticketStatus.ts• L8-62 desk/…/notification.ts• L8-71 desk/…/holidayList.ts• L10-49 desk/…/knowledgeBase.ts• L4-119 desk/…/sla.ts• L16-103 desk/…/types.ts• L523-542 desk/…/utils.ts• L24-36
Agent availability
Agent availability is a shared view of the current status of each agent. The client seeds the signed-in agent from session data, receives changes through the site socket, and writes changes through the Frappe document service.
Expiry is part of the same status model. Agents can choose a time preset or leave a status active without expiry; the client shows the remaining time and returns the agent to the default status when the expiry passes. The server remains authoritative, so failed writes restore the last confirmed value.
References: desk/…/agentStatus.ts• L54-74 desk/…/agentStatus.ts• L92-170 desk/…/agentStatus.ts• L177-339 desk/…/statusExpiry.ts• L9-76
Ticket workflow state
Ticket status state gives agent and customer views one shared workflow definition. A status can have different labels for each persona while retaining one order, category, enabled state, and color definition.
This shared mapping prevents the same ticket workflow from splitting into separate client rules. Views can resolve either persona label to the same status and use the same color meaning.
References: desk/…/ticketStatus.ts• L8-39 desk/…/ticketStatus.ts• L41-62
Administrative editing state
The administrative stores support work that spans more than one screen. Knowledge base state covers article and category actions, holiday state builds and validates date ranges and recurring days, and SLA state validates priorities, service hours, breaks, and conditions before a policy is accepted.
These stores do not replace Frappe as the durable record owner. They shape and validate the user's current input, then expose resource actions that send the resulting change to Frappe services.
References: desk/…/knowledgeBase.ts• L4-119 desk/…/holidayList.ts• L10-133 desk/…/sla.ts• L16-35 desk/…/sla.ts• L100-328
Frappe service integration
HTTP service contract
The desk treats Frappe as the source of truth for session identity, access, site policy, workflow definitions, notifications, and Helpdesk records. Frappe UI resources and calls provide one service boundary for reading, validating, and changing those records through the current session.
The main service roles are:
- Session service: returns the current user and access facts.
- Resource service: loads lists and shared settings and submits document changes.
- Feature services: provide knowledge base actions and other Helpdesk-specific operations.
- Feedback service: turns server messages and failures into desk-wide notices.
The browser does not define a second identity system. The active Frappe session and its server-side access rules remain responsible for what the user can do.
References: desk/…/auth.ts• L15-21 desk/…/config.ts• L8-11 desk/…/knowledgeBase.ts• L5-89 desk/…/agentStatus.ts• L171-173 desk/…/main.js• L39-64 desk/…/types.ts• L5-55 desk/…/types.ts• L98-130
Site configuration
Site configuration shapes the shared desk experience rather than one page. The configuration resource supplies brand data and behavior flags, and the config store exposes those values as shared policy for the shell and work areas.
Settings changes can update the brand name, logo, and favicon through the Frappe document service. When the site reports a settings change, the store reloads the configuration. Open pages can then use the current policy without a full browser refresh.
References: desk/…/config.ts• L6-37 desk/…/Branding.vue• L48-124 desk/…/App.vue• L19-43 desk/…/utils.ts• L31-36
Real-time service
The desk opens a socket for the active Frappe site and shares it through the application state layer. Socket events update live concerns such as agent availability and site settings, while notifications use the same connection to keep the current user's notice state current.
HTTP remains the path for durable reads and writes. Real-time events provide the signal that another client changed shared data or that an open page should update its view.
References: desk/…/main.js• L82-100 desk/…/agentStatus.ts• L126-141 desk/…/config.ts• L6-37 desk/…/notification.ts• L8-17
Agent invitation service
Agent invitations use Frappe's user invitation service and keep role meaning consistent between setup and Settings. The platform sends the selected role and every lower agent role required by that role, then shows pending invitations and supports cancellation.
Only roles allowed by the current manager or administrator appear in the Settings flow. Setup can invite several roles in groups and keeps successful invitations separate from disabled or failed addresses, so a partial result does not hide the invitations that did succeed.
References: desk/…/InviteAgents.vue• L105-265 desk/…/SetupTeamStep.vue• L136-313 desk/…/utils.ts• L24-36
Related platform pages
Read Desk application shell for the application root, layouts, navigation, and responsive behavior. Read Identity, permissions, and real-time behavior for session rules, access decisions, notifications, and live event handling.
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to startup context must stay aligned with the values used by main.js, App.vue, theme setup, language direction, time-zone handling, and setup gating.
- Changes to setup steps or completion must preserve the contract between
window.setup_pending, the router guard, the server completion call, and the final desk redirect. - Changes to access fields must preserve the contract between the auth resource, router guard, customer redirect, and agent ticket route.
- Changes to route paths or names must preserve notification deep links and the mobile ticket route choice.
- Changes to socket event names or payloads must update the stores that use them to refresh availability, settings, or notifications.
- Changes to agent status expiry must keep preset display, server time conversion, local timers, and the server availability fields aligned.
- Changes to ticket status labels or colors must preserve the shared mapping between agent and customer views.
- Changes to administrative form fields must keep local validation and the Frappe resource payload in agreement.
- Changes to agent roles must keep
AGENT_ROLES, role inheritance, visible role options, invitation payloads, and pending-invite filtering aligned. - Changes to brand fields must preserve the shared name limit and the Frappe fields used by setup, Settings, the desk, and the customer portal.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
The session cookie is missing or represents Guest | The router sends the user to login instead of rendering the desk | Preserve the Frappe login round trip and requested path |
| A signed-in user has no desk access | An internal route cannot render the intended agent experience | Redirect to the configured customer home page before navigation continues |
| Setup completion is not recorded before redirect | The next boot can send the user back into setup | Await or retry complete_setup before opening the desk |
| A non-agent opens an agent ticket route | The user could see an internal ticket view without agent status | Redirect that ticket to the customer route |
| A mailbox connection returns a failed OAuth result | Setup can appear connected when the provider did not create an account | Keep the failure result visible and require a successful account connection |
| Agent invitation results are treated as all-or-nothing | Successful invitations can be lost when one address is disabled | Keep sent and failed addresses separate and refresh pending invitations |
| Agent status writes run in parallel | Frappe document version checks can reject a later status change | Queue availability writes and restore the confirmed state on failure |
| A status expiry uses a local time as a server time | The status can clear too early or too late | Convert presets to system time and compare server instants |
| A socket settings event is ignored | Open pages continue to use old site policy | Reload the shared configuration resource on the event |
| Agent and customer status labels drift apart | The same workflow state can show different meanings across views | Keep both labels and their shared status mapping current |
| A multi-step administrative form skips local validation | Invalid holidays, service hours, or SLA conditions can reach the save action | Run the store validation before submitting the Frappe resource |
Key files
| File | Why to read it |
|---|---|
| desk/…/main.js | Shows the client bootstrap, Frappe UI setup, shared plugins, and socket start. |
| desk/…/App.vue | Shows the top-level provider, site-wide UI feedback, theme, favicon, and time-zone setup. |
| desk/…/index.ts | Shows the agent route map, setup gating, mobile ticket selection, and access guard. |
| desk/…/Setup.vue | Shows the first-run flow, progress, optional skip behavior, and completion dialog. |
| desk/…/setup.ts | Shows shared setup state, step transitions, service completion, and setup outcome tracking. |
| desk/…/SetupProviderPicker.vue | Shows mailbox provider selection, OAuth outcomes, and manual account setup. |
| desk/…/SetupTeamStep.vue | Shows grouped role invitations and partial invitation results. |
| desk/…/auth.ts | Shows the client view of the Frappe session and access contract. |
| desk/…/agentStatus.ts | Shows shared availability, expiry, live updates, and failure recovery. |
| desk/…/statusExpiry.ts | Shows the user-facing status expiry choices and remaining-time model. |
| desk/…/ticketStatus.ts | Shows the shared agent and customer ticket status mapping. |
| desk/…/config.ts | Shows how site policy becomes shared state and responds to live changes. |
| desk/…/Branding.vue | Shows how site branding changes reach shared configuration. |
| desk/…/InviteAgents.vue | Shows role-aware invitations and pending invite management outside setup. |
| desk/…/notification.ts | Shows current-user notification state and ticket deep links. |
| desk/…/knowledgeBase.ts | Shows the service boundary for knowledge base edits. |
| desk/…/holidayList.ts | Shows shared holiday form state and recurring date validation. |
| desk/…/sla.ts | Shows shared SLA form state and policy validation. |