This template should help get you started developing with Vue 3 in Vite.
VSCode + Volar (and disable Vetur).
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need Volar to make the TypeScript language service aware of .vue
types.
See Vite Configuration Reference.
bun install
bun dev
bun run build
Lint with ESLint
bun lint
The plugin uses a centralized, event-driven architecture for managing Socket.IO connections. This ensures clean separation of concerns and maintainability.
┌─────────────────┐ Events ┌─────────────────┐ Socket.IO ┌─────────────────┐
│ Settings UI │ ◄──────────► │ Main Plugin │ ◄─────────────► │ AI Server │
│ │ │ │ │ │
│ • Connect │ │ • Connection │ │ • Real-time │
│ • Disconnect │ │ Management │ │ Communication │
│ • Status │ │ • Event Hub │ │ • AI Processing │
│ Display │ │ • State Sync │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
socket:connect-request
- Request connection to serversocket:disconnect-request
- Request disconnection from serversocket:reconnect-request
- Request reconnection to server
socket:status-changed
- General status update with full infosocket:connected
- Successfully connectedsocket:disconnected
- Disconnected from serversocket:connecting
- Attempting to connectsocket:error
- Connection error occurredsocket:reconnecting
- Attempting to reconnect
- Disconnected - No active connection
- Connecting - Establishing initial connection
- Connected - Successfully connected and ready
- Reconnecting - Attempting to restore lost connection
- Error - Connection failed or error occurred
// Request connection
plugin.events.trigger('socket:connect-request', socketAddress)
// Listen for status updates
plugin.events.on('socket:status-changed', (info: SocketConnectionInfo) => {
connectionStatus.value = info.status
connectionError.value = info.error || ''
})
// Handle connection requests
this.events.on('socket:connect-request', (address: string) => {
this.connectSocket(address)
})
// Emit status updates
this.events.trigger('socket:status-changed', {
status: 'connected',
address: socketAddress,
timestamp: new Date()
})
- Centralized Logic - All socket management in main.ts
- Reactive UI - Settings automatically reflect connection state
- Clean Separation - UI and connection logic are decoupled
- Event-Driven - Loose coupling through events
- Maintainable - Easy to extend and modify
- Type Safe - Full TypeScript support with proper interfaces