refactor: restructure project for multi-agent extensibility
- Migrate source to packages/client and packages/server directories - Namespace all Hermes-specific code under hermes/ subdirectories (api/hermes/, components/hermes/, views/hermes/, stores/hermes/) - Add hermes.* route names and /hermes/* path prefixes - Upgrade @koa/router to v15, adapt path-to-regexp v8 syntax - Fix proxy path rewriting: /api/hermes/v1/* → /v1/*, /api/hermes/* → /api/* - Fix frontend API paths to match backend /api/hermes/* routes - Fix WebSocket terminal path to /api/hermes/terminal - Add proxyMiddleware for reliable unmatched route proxying - Add profiles route module and hermes-cli profile commands - Update CLAUDE.md development guide with new architecture - Add Chinese README (README_zh.md) - Add Web Terminal feature to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import { hasApiKey } from '@/api/client'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'login',
|
||||
component: () => import('@/views/LoginView.vue'),
|
||||
meta: { public: true },
|
||||
},
|
||||
{
|
||||
path: '/hermes/chat',
|
||||
name: 'hermes.chat',
|
||||
component: () => import('@/views/hermes/ChatView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/jobs',
|
||||
name: 'hermes.jobs',
|
||||
component: () => import('@/views/hermes/JobsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/models',
|
||||
name: 'hermes.models',
|
||||
component: () => import('@/views/hermes/ModelsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/logs',
|
||||
name: 'hermes.logs',
|
||||
component: () => import('@/views/hermes/LogsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/usage',
|
||||
name: 'hermes.usage',
|
||||
component: () => import('@/views/hermes/UsageView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/skills',
|
||||
name: 'hermes.skills',
|
||||
component: () => import('@/views/hermes/SkillsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/memory',
|
||||
name: 'hermes.memory',
|
||||
component: () => import('@/views/hermes/MemoryView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/settings',
|
||||
name: 'hermes.settings',
|
||||
component: () => import('@/views/hermes/SettingsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/channels',
|
||||
name: 'hermes.channels',
|
||||
component: () => import('@/views/hermes/ChannelsView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/hermes/terminal',
|
||||
name: 'hermes.terminal',
|
||||
component: () => import('@/views/hermes/TerminalView.vue'),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
router.beforeEach((to, _from, next) => {
|
||||
// Public pages don't need auth
|
||||
if (to.meta.public) {
|
||||
// Already has key, skip login
|
||||
if (to.name === 'login' && hasApiKey()) {
|
||||
next({ path: '/hermes/chat' })
|
||||
return
|
||||
}
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// All other pages require token
|
||||
if (!hasApiKey()) {
|
||||
next({ name: 'login' })
|
||||
return
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user