hermes-web-ui 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +138 -205
  2. package/bin/hermes-web-ui.mjs +14 -2
  3. package/dist/assets/{Button-DBOPt_s1.js → Button-BHvh9zmj.js} +1 -1
  4. package/dist/assets/{ChannelsView-BU9QAub-.css → ChannelsView-C7Wor1FB.css} +1 -1
  5. package/dist/assets/ChannelsView-DZMniRoi.js +1 -0
  6. package/dist/assets/ChatView-Dt1eqp6-.js +127 -0
  7. package/dist/assets/{ChatView-D1SaZAvQ.css → ChatView-gR62J-Xr.css} +1 -1
  8. package/dist/assets/Close-DYPlamoH.js +45 -0
  9. package/dist/assets/{FormItem-De01hN-G.js → FormItem-C75Y2lpf.js} +1 -1
  10. package/dist/assets/Input-CS0p63GR.js +234 -0
  11. package/dist/assets/InputNumber-lHTE1DBf.js +13 -0
  12. package/dist/assets/JobsView-DoUtVQm_.css +1 -0
  13. package/dist/assets/JobsView-kGXDpDGq.js +2 -0
  14. package/dist/assets/LoginView-BXByybMK.css +1 -0
  15. package/dist/assets/LoginView-HQwDR5A7.js +1 -0
  16. package/dist/assets/{LogsView-BgmSycD4.js → LogsView-KPcTBGzh.js} +1 -1
  17. package/dist/assets/{MarkdownRenderer-z5xC7cOw.js → MarkdownRenderer-Bp-uAEtp.js} +1 -1
  18. package/dist/assets/{MemoryView-BUZGXC60.js → MemoryView-CWEya0jB.js} +1 -1
  19. package/dist/assets/{Modal-BLLYorfc.js → Modal-mFCAbKPD.js} +5 -5
  20. package/dist/assets/{ModelsView-ByryHyh7.js → ModelsView-BdPt2Mo_.js} +1 -1
  21. package/dist/assets/{ModelsView-DCR-0I10.css → ModelsView-DbBXgw4g.css} +1 -1
  22. package/dist/assets/Popconfirm-C2OzcGTX.js +16 -0
  23. package/dist/assets/Popover-CRZpNb8Q.js +117 -0
  24. package/dist/assets/Scrollbar-CA0Mq0os.js +77 -0
  25. package/dist/assets/Select-DLECSo9D.js +340 -0
  26. package/dist/assets/SettingRow-CsKwX-jv.js +1 -0
  27. package/dist/assets/{SettingsView-Y2Et1YHr.css → SettingsView-Citzr3ci.css} +1 -1
  28. package/dist/assets/SettingsView-DWXjfdpD.js +352 -0
  29. package/dist/assets/{SkillsView-CREfL6dQ.css → SkillsView-BNEWlriU.css} +1 -1
  30. package/dist/assets/{SkillsView-Blcv_g2_.js → SkillsView-Gb4tyJjH.js} +1 -1
  31. package/dist/assets/{Spin-DiwsqMEC.js → Spin-BbbA3R-G.js} +1 -1
  32. package/dist/assets/Suffix-BMwB7UJK.js +25 -0
  33. package/dist/assets/{Switch-Ce0Tgpcj.js → Switch-Xa0U6jwA.js} +2 -2
  34. package/dist/assets/{Tag-BUJuCRNX.js → Tag-NMAaTGW7.js} +2 -2
  35. package/dist/assets/TerminalView-B7iMIrM8.css +1 -0
  36. package/dist/assets/TerminalView-CvTXTM3W.js +36 -0
  37. package/dist/assets/{Tooltip-C65FWX0W.js → Tooltip-C9RmASqV.js} +1 -1
  38. package/dist/assets/{UsageView-CKMaJ5W0.css → UsageView-DKigFrVY.css} +1 -1
  39. package/dist/assets/UsageView-DiCHVrs8.js +1 -0
  40. package/dist/assets/Warning-CmJYhk3M.js +1 -0
  41. package/dist/assets/{_plugin-vue_export-helper-DkLSTLBi.js → _plugin-vue_export-helper-NLzeiXdV.js} +1 -1
  42. package/dist/assets/{app-DtII96CF.js → app-CQZfHgyy.js} +1 -1
  43. package/dist/assets/app-DeeNNd_a.js +1 -0
  44. package/dist/assets/{browser-oMT2KRlV.js → browser-DNwI2j4X.js} +1 -1
  45. package/dist/assets/{chat-nPd2Ount.js → chat-DnFbBAAK.js} +2 -2
  46. package/dist/assets/context-DLFTSrww.js +1 -0
  47. package/dist/assets/fade-in-scale-up.cssr-BMJXPg-3.js +1 -0
  48. package/dist/assets/index-DlNQjiQP.js +306 -0
  49. package/dist/assets/{index-8v0lZOmS.css → index-TVVcuwR0.css} +1 -1
  50. package/dist/assets/{jobs-fIgcRW5v.js → jobs-B7U8gZia.js} +1 -1
  51. package/dist/assets/{pinia-D41F8A9y.js → pinia-DKSOddVw.js} +1 -1
  52. package/dist/assets/{router-B0PaAFys.js → router-CpYvE976.js} +2 -2
  53. package/dist/assets/{sessions-Dsqr5aLA.js → sessions-DTV2WuAE.js} +1 -1
  54. package/dist/assets/{skills-COmQAkb0.js → skills-DwX9oZGG.js} +1 -1
  55. package/dist/assets/use-compitable-D2-fMbL2.js +1 -0
  56. package/dist/assets/{use-message-CG8KB3t0.js → use-message-17mZlZe3.js} +1 -1
  57. package/dist/index.html +22 -18
  58. package/dist/server/index.js +3 -0
  59. package/dist/server/routes/terminal.d.ts +2 -0
  60. package/dist/server/routes/terminal.js +288 -0
  61. package/package.json +28 -4
  62. package/dist/assets/ChannelsView-CIZXL3vY.js +0 -1
  63. package/dist/assets/ChatView-DvAYfM24.js +0 -142
  64. package/dist/assets/Close-Ck11Jegf.js +0 -45
  65. package/dist/assets/Input-CyvPny5v.js +0 -234
  66. package/dist/assets/InputNumber-v7Tkrv97.js +0 -13
  67. package/dist/assets/JobsView-Cch6Sv2Y.js +0 -2
  68. package/dist/assets/JobsView-DARa8llR.css +0 -1
  69. package/dist/assets/LoginView-Cp-xfwtv.css +0 -1
  70. package/dist/assets/LoginView-DsClZpVT.js +0 -1
  71. package/dist/assets/Popover-ZzeCeChJ.js +0 -117
  72. package/dist/assets/Select-CPQQRbMt.js +0 -340
  73. package/dist/assets/SettingRow-BvAmImkg.js +0 -1
  74. package/dist/assets/SettingsView-B_5pGI0B.js +0 -352
  75. package/dist/assets/Suffix-La8FFPWu.js +0 -101
  76. package/dist/assets/UsageView-MZGY4EKW.js +0 -1
  77. package/dist/assets/app-DVSCPXta.js +0 -1
  78. package/dist/assets/context-DRBiUHq_.js +0 -1
  79. package/dist/assets/index-DNNVWa6r.js +0 -306
  80. /package/dist/assets/{omit-C6t0n7Zy.js → omit-C4dR5R2G.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./router-B0PaAFys.js";async function t(t,n){let r=new URLSearchParams;t&&r.set(`source`,t),n&&r.set(`limit`,String(n));let i=r.toString();return(await e(`/api/sessions${i?`?${i}`:``}`)).sessions}async function n(t){try{return(await e(`/api/sessions/${t}`)).session}catch{return null}}async function r(t){try{return await e(`/api/sessions/${t}`,{method:`DELETE`}),!0}catch{return!1}}async function i(t,n){try{return await e(`/api/sessions/${t}/rename`,{method:`POST`,body:JSON.stringify({title:n})}),!0}catch{return!1}}export{i,n,t as r,r as t};
1
+ import{o as e}from"./router-CpYvE976.js";async function t(t,n){let r=new URLSearchParams;t&&r.set(`source`,t),n&&r.set(`limit`,String(n));let i=r.toString();return(await e(`/api/sessions${i?`?${i}`:``}`)).sessions}async function n(t){try{return(await e(`/api/sessions/${t}`)).session}catch{return null}}async function r(t){try{return await e(`/api/sessions/${t}`,{method:`DELETE`}),!0}catch{return!1}}async function i(t,n){try{return await e(`/api/sessions/${t}/rename`,{method:`POST`,body:JSON.stringify({title:n})}),!0}catch{return!1}}export{i,n,t as r,r as t};
@@ -1 +1 @@
1
- import{o as e}from"./router-B0PaAFys.js";async function t(){return(await e(`/api/skills`)).categories}async function n(t){return(await e(`/api/skills/${t}`)).content}async function r(t,n){return(await e(`/api/skills/${t}/${n}/files`)).files}async function i(){return e(`/api/memory`)}async function a(t,n){await e(`/api/memory`,{method:`POST`,body:JSON.stringify({section:t,content:n})})}async function o(t,n){await e(`/api/skills/toggle`,{method:`PUT`,body:JSON.stringify({name:t,enabled:n})})}export{a,t as i,n,o,r,i as t};
1
+ import{o as e}from"./router-CpYvE976.js";async function t(){return(await e(`/api/skills`)).categories}async function n(t){return(await e(`/api/skills/${t}`)).content}async function r(t,n){return(await e(`/api/skills/${t}/${n}/files`)).files}async function i(){return e(`/api/memory`)}async function a(t,n){await e(`/api/memory`,{method:`POST`,body:JSON.stringify({section:t,content:n})})}async function o(t,n){await e(`/api/skills/toggle`,{method:`PUT`,body:JSON.stringify({name:t,enabled:n})})}export{a,t as i,n,o,r,i as t};
@@ -0,0 +1 @@
1
+ import{C as e}from"./router-CpYvE976.js";function t(t,n){return e(()=>{for(let e of n)if(t[e]!==void 0)return t[e];return t[n[n.length-1]]})}export{t};
@@ -1 +1 @@
1
- import{F as e}from"./router-B0PaAFys.js";import{J as t}from"./browser-oMT2KRlV.js";import{t as n}from"./context-DRBiUHq_.js";function r(){let r=e(n,null);return r===null&&t(`use-message`,"No outer <n-message-provider /> founded. See prerequisite in https://www.naiveui.com/en-US/os-theme/components/message for more details. If you want to use `useMessage` outside setup, please check https://www.naiveui.com/zh-CN/os-theme/components/message#Q-&-A."),r}export{r as t};
1
+ import{F as e}from"./router-CpYvE976.js";import{J as t}from"./browser-DNwI2j4X.js";import{t as n}from"./context-DLFTSrww.js";function r(){let r=e(n,null);return r===null&&t(`use-message`,"No outer <n-message-provider /> founded. See prerequisite in https://www.naiveui.com/en-US/os-theme/components/message for more details. If you want to use `useMessage` outside setup, please check https://www.naiveui.com/zh-CN/os-theme/components/message#Q-&-A."),r}export{r as t};
package/dist/index.html CHANGED
@@ -6,25 +6,29 @@
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Hermes</title>
9
- <script type="module" crossorigin src="/assets/index-DNNVWa6r.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/router-B0PaAFys.js">
11
- <link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-DkLSTLBi.js">
12
- <link rel="modulepreload" crossorigin href="/assets/browser-oMT2KRlV.js">
13
- <link rel="modulepreload" crossorigin href="/assets/Suffix-La8FFPWu.js">
14
- <link rel="modulepreload" crossorigin href="/assets/Close-Ck11Jegf.js">
15
- <link rel="modulepreload" crossorigin href="/assets/Popover-ZzeCeChJ.js">
16
- <link rel="modulepreload" crossorigin href="/assets/Button-DBOPt_s1.js">
17
- <link rel="modulepreload" crossorigin href="/assets/Tag-BUJuCRNX.js">
18
- <link rel="modulepreload" crossorigin href="/assets/Select-CPQQRbMt.js">
19
- <link rel="modulepreload" crossorigin href="/assets/Modal-BLLYorfc.js">
20
- <link rel="modulepreload" crossorigin href="/assets/omit-C6t0n7Zy.js">
21
- <link rel="modulepreload" crossorigin href="/assets/context-DRBiUHq_.js">
22
- <link rel="modulepreload" crossorigin href="/assets/pinia-D41F8A9y.js">
23
- <link rel="modulepreload" crossorigin href="/assets/sessions-Dsqr5aLA.js">
24
- <link rel="modulepreload" crossorigin href="/assets/app-DtII96CF.js">
25
- <link rel="modulepreload" crossorigin href="/assets/chat-nPd2Ount.js">
9
+ <script type="module" crossorigin src="/assets/index-DlNQjiQP.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/router-CpYvE976.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-NLzeiXdV.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/browser-DNwI2j4X.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/Scrollbar-CA0Mq0os.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/use-compitable-D2-fMbL2.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/Popover-CRZpNb8Q.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/Close-DYPlamoH.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/Button-BHvh9zmj.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/Suffix-BMwB7UJK.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/fade-in-scale-up.cssr-BMJXPg-3.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/Tag-NMAaTGW7.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/Select-DLECSo9D.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/Warning-CmJYhk3M.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/Modal-mFCAbKPD.js">
24
+ <link rel="modulepreload" crossorigin href="/assets/omit-C4dR5R2G.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/context-DLFTSrww.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/pinia-DKSOddVw.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/sessions-DTV2WuAE.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/app-CQZfHgyy.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/chat-DnFbBAAK.js">
26
30
  <link rel="modulepreload" crossorigin href="/assets/logo-Cd-t_oGE.js">
27
- <link rel="stylesheet" crossorigin href="/assets/index-8v0lZOmS.css">
31
+ <link rel="stylesheet" crossorigin href="/assets/index-TVVcuwR0.css">
28
32
  </head>
29
33
 
30
34
  <body>
@@ -53,6 +53,7 @@ const logs_1 = require("./routes/logs");
53
53
  const filesystem_1 = require("./routes/filesystem");
54
54
  const config_2 = require("./routes/config");
55
55
  const weixin_1 = require("./routes/weixin");
56
+ const terminal_1 = require("./routes/terminal");
56
57
  const hermesCli = __importStar(require("./services/hermes-cli"));
57
58
  const auth_1 = require("./services/auth");
58
59
  const app = new koa_1.default();
@@ -119,6 +120,8 @@ async function bootstrap() {
119
120
  });
120
121
  // 🚀 启动服务
121
122
  server = app.listen(config_1.config.port, '0.0.0.0');
123
+ // Terminal WebSocket (must be after server is created)
124
+ (0, terminal_1.setupTerminalWebSocket)(server);
122
125
  server.on('listening', () => {
123
126
  console.log(`➜ Server: http://localhost:${config_1.config.port}`);
124
127
  console.log(`➜ Upstream: ${config_1.config.upstream}`);
@@ -0,0 +1,2 @@
1
+ import type { Server as HttpServer } from 'http';
2
+ export declare function setupTerminalWebSocket(httpServer: HttpServer): void;
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.setupTerminalWebSocket = setupTerminalWebSocket;
37
+ const ws_1 = require("ws");
38
+ const fs_1 = require("fs");
39
+ const pty = __importStar(require("node-pty"));
40
+ const auth_1 = require("../services/auth");
41
+ // ─── Shell detection ────────────────────────────────────────────
42
+ function findShell() {
43
+ const candidates = [
44
+ process.env.SHELL,
45
+ '/bin/zsh',
46
+ '/bin/bash',
47
+ process.platform === 'win32' ? 'powershell.exe' : null,
48
+ process.platform === 'win32' ? 'cmd.exe' : null,
49
+ ].filter(Boolean);
50
+ for (const shell of candidates) {
51
+ if ((0, fs_1.existsSync)(shell))
52
+ return shell;
53
+ }
54
+ return '/bin/bash';
55
+ }
56
+ function shellName(shell) {
57
+ return shell.split('/').pop() || 'shell';
58
+ }
59
+ // ─── Helpers ────────────────────────────────────────────────────
60
+ function generateId() {
61
+ return Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
62
+ }
63
+ function createSession(shell) {
64
+ const id = generateId();
65
+ let ptyProcess;
66
+ try {
67
+ ptyProcess = pty.spawn(shell, [], {
68
+ name: 'xterm-color',
69
+ cols: 80,
70
+ rows: 24,
71
+ cwd: process.env.HOME || undefined,
72
+ });
73
+ }
74
+ catch (err) {
75
+ throw new Error(`Failed to spawn shell "${shell}": ${err.message}. Run "npm rebuild node-pty" to fix.`);
76
+ }
77
+ const session = {
78
+ id,
79
+ pty: ptyProcess,
80
+ shell,
81
+ pid: ptyProcess.pid,
82
+ createdAt: Date.now(),
83
+ };
84
+ return session;
85
+ }
86
+ // ─── WebSocket server setup ─────────────────────────────────────
87
+ function setupTerminalWebSocket(httpServer) {
88
+ const wss = new ws_1.WebSocketServer({ noServer: true });
89
+ const defaultShell = findShell();
90
+ httpServer.on('upgrade', async (req, socket, head) => {
91
+ const url = new URL(req.url || '', `http://${req.headers.host}`);
92
+ if (url.pathname !== '/terminal') {
93
+ socket.destroy();
94
+ return;
95
+ }
96
+ // Auth check
97
+ const authToken = await (0, auth_1.getToken)();
98
+ if (authToken) {
99
+ const token = url.searchParams.get('token') || '';
100
+ if (token !== authToken) {
101
+ socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n');
102
+ socket.destroy();
103
+ return;
104
+ }
105
+ }
106
+ wss.handleUpgrade(req, socket, head, (ws) => {
107
+ wss.emit('connection', ws, req);
108
+ });
109
+ });
110
+ wss.on('connection', (ws) => {
111
+ const conn = {
112
+ sessions: new Map(),
113
+ activeSessionId: null,
114
+ outputBuffers: new Map(),
115
+ };
116
+ // ─── PTY output → WebSocket ──────────────────────────────────
117
+ function attachPtyOutput(session) {
118
+ session.pty.onData((data) => {
119
+ if (ws.readyState !== ws.OPEN)
120
+ return;
121
+ if (conn.activeSessionId === session.id) {
122
+ ws.send(data);
123
+ }
124
+ else {
125
+ // Buffer output for inactive sessions
126
+ let buf = conn.outputBuffers.get(session.id);
127
+ if (!buf) {
128
+ buf = [];
129
+ conn.outputBuffers.set(session.id, buf);
130
+ }
131
+ buf.push(data);
132
+ // Cap buffer at 1MB to prevent memory issues
133
+ if (buf.length > 5000) {
134
+ buf.splice(0, buf.length - 5000);
135
+ }
136
+ }
137
+ });
138
+ session.pty.onExit(({ exitCode }) => {
139
+ conn.outputBuffers.delete(session.id);
140
+ if (ws.readyState === ws.OPEN) {
141
+ ws.send(JSON.stringify({ type: 'exited', id: session.id, exitCode }));
142
+ }
143
+ conn.sessions.delete(session.id);
144
+ console.log(`[Terminal] Session ${session.id} exited (pid ${session.pid}, code ${exitCode})`);
145
+ });
146
+ }
147
+ // ─── Message handler ────────────────────────────────────────
148
+ ws.on('message', (raw) => {
149
+ const msg = Buffer.isBuffer(raw) ? raw.toString('utf8') : String(raw);
150
+ // JSON control message
151
+ if (msg.charCodeAt(0) === 0x7B) {
152
+ try {
153
+ const parsed = JSON.parse(msg);
154
+ handleControl(parsed);
155
+ }
156
+ catch {
157
+ // Not valid JSON, fall through to raw input
158
+ writeRaw(msg);
159
+ }
160
+ return;
161
+ }
162
+ writeRaw(msg);
163
+ });
164
+ function writeRaw(data) {
165
+ const session = conn.activeSessionId ? conn.sessions.get(conn.activeSessionId) : null;
166
+ if (session) {
167
+ session.pty.write(data);
168
+ }
169
+ }
170
+ function handleControl(parsed) {
171
+ switch (parsed.type) {
172
+ case 'create': {
173
+ const shell = parsed.shell || defaultShell;
174
+ let session;
175
+ try {
176
+ session = createSession(shell);
177
+ }
178
+ catch (err) {
179
+ ws.send(JSON.stringify({ type: 'error', message: err.message }));
180
+ return;
181
+ }
182
+ conn.sessions.set(session.id, session);
183
+ conn.activeSessionId = session.id;
184
+ attachPtyOutput(session);
185
+ ws.send(JSON.stringify({
186
+ type: 'created',
187
+ id: session.id,
188
+ pid: session.pid,
189
+ shell: shellName(shell),
190
+ }));
191
+ console.log(`[Terminal] Session created: ${session.id} (${shellName(shell)}, pid ${session.pid})`);
192
+ break;
193
+ }
194
+ case 'switch': {
195
+ const { sessionId } = parsed;
196
+ const session = conn.sessions.get(sessionId);
197
+ if (!session) {
198
+ ws.send(JSON.stringify({ type: 'error', message: 'Session not found' }));
199
+ return;
200
+ }
201
+ conn.activeSessionId = sessionId;
202
+ // Send switched first so frontend mounts the correct terminal
203
+ ws.send(JSON.stringify({ type: 'switched', id: sessionId }));
204
+ // Then flush buffered output for this session
205
+ const buf = conn.outputBuffers.get(sessionId);
206
+ if (buf && buf.length > 0) {
207
+ for (const chunk of buf) {
208
+ ws.send(chunk);
209
+ }
210
+ conn.outputBuffers.delete(sessionId);
211
+ }
212
+ console.log(`[Terminal] Switched to session ${sessionId}`);
213
+ break;
214
+ }
215
+ case 'close': {
216
+ const { sessionId } = parsed;
217
+ const session = conn.sessions.get(sessionId);
218
+ if (!session)
219
+ return;
220
+ session.pty.kill();
221
+ conn.sessions.delete(sessionId);
222
+ conn.outputBuffers.delete(sessionId);
223
+ if (conn.activeSessionId === sessionId) {
224
+ // Auto-switch to the first remaining session
225
+ const remaining = Array.from(conn.sessions.keys());
226
+ conn.activeSessionId = remaining.length > 0 ? remaining[0] : null;
227
+ }
228
+ console.log(`[Terminal] Session closed: ${sessionId}`);
229
+ break;
230
+ }
231
+ case 'resize': {
232
+ const session = conn.activeSessionId ? conn.sessions.get(conn.activeSessionId) : null;
233
+ if (!session)
234
+ return;
235
+ const cols = Math.max(1, parsed.cols || 0);
236
+ const rows = Math.max(1, parsed.rows || 0);
237
+ try {
238
+ session.pty.resize(cols, rows);
239
+ }
240
+ catch { }
241
+ break;
242
+ }
243
+ }
244
+ }
245
+ // ─── Cleanup ────────────────────────────────────────────────
246
+ ws.on('close', () => {
247
+ for (const session of Array.from(conn.sessions.values())) {
248
+ try {
249
+ session.pty.kill();
250
+ }
251
+ catch { }
252
+ }
253
+ conn.sessions.clear();
254
+ console.log(`[Terminal] Connection closed, all sessions killed`);
255
+ });
256
+ ws.on('error', () => {
257
+ for (const session of Array.from(conn.sessions.values())) {
258
+ try {
259
+ session.pty.kill();
260
+ }
261
+ catch { }
262
+ }
263
+ conn.sessions.clear();
264
+ });
265
+ // ─── Auto-create first session ──────────────────────────────
266
+ let firstSession;
267
+ try {
268
+ firstSession = createSession(defaultShell);
269
+ }
270
+ catch (err) {
271
+ ws.send(JSON.stringify({ type: 'error', message: err.message }));
272
+ console.error(`[Terminal] Failed to create session: ${err.message}`);
273
+ ws.close();
274
+ return;
275
+ }
276
+ conn.sessions.set(firstSession.id, firstSession);
277
+ conn.activeSessionId = firstSession.id;
278
+ attachPtyOutput(firstSession);
279
+ ws.send(JSON.stringify({
280
+ type: 'created',
281
+ id: firstSession.id,
282
+ pid: firstSession.pid,
283
+ shell: shellName(defaultShell),
284
+ }));
285
+ console.log(`[Terminal] First session created: ${firstSession.id} (${shellName(defaultShell)}, pid ${firstSession.pid})`);
286
+ });
287
+ console.log(`[Terminal] WebSocket ready at /terminal (shell: ${defaultShell})`);
288
+ }
package/package.json CHANGED
@@ -1,13 +1,31 @@
1
1
  {
2
2
  "name": "hermes-web-ui",
3
- "version": "0.2.5",
4
- "description": "Hermes Agent Web UI - Chat and Job Management Dashboard",
3
+ "version": "0.2.6",
4
+ "description": "Web dashboard for Hermes Agent multi-platform AI chat, session management, scheduled jobs, usage analytics & channel configuration (Telegram, Discord, Slack, WhatsApp)",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/EKKOLearnAI/hermes-web-ui.git"
8
8
  },
9
9
  "homepage": "https://github.com/EKKOLearnAI/hermes-web-ui",
10
10
  "license": "MIT",
11
+ "keywords": [
12
+ "hermes",
13
+ "ai-agent",
14
+ "llm",
15
+ "chat-ui",
16
+ "dashboard",
17
+ "telegram",
18
+ "discord",
19
+ "slack",
20
+ "whatsapp",
21
+ "matrix",
22
+ "feishu",
23
+ "weixin",
24
+ "multi-platform",
25
+ "vue3",
26
+ "typescript",
27
+ "naive-ui"
28
+ ],
11
29
  "bin": {
12
30
  "hermes-web-ui": "./bin/hermes-web-ui.mjs"
13
31
  },
@@ -25,9 +43,12 @@
25
43
  ],
26
44
  "dependencies": {
27
45
  "@koa/bodyparser": "^5.0.0",
28
- "axios": "^1.9.0",
29
46
  "@koa/cors": "^5.0.0",
30
47
  "@koa/router": "^13.1.0",
48
+ "@xterm/addon-fit": "^0.11.0",
49
+ "@xterm/addon-web-links": "^0.12.0",
50
+ "@xterm/xterm": "^6.0.0",
51
+ "axios": "^1.9.0",
31
52
  "highlight.js": "^11.11.1",
32
53
  "js-yaml": "^4.1.1",
33
54
  "koa": "^2.15.3",
@@ -35,11 +56,13 @@
35
56
  "koa-static": "^5.0.0",
36
57
  "markdown-it": "^14.1.1",
37
58
  "naive-ui": "^2.44.1",
59
+ "node-pty": "^1.1.0",
38
60
  "pinia": "^3.0.4",
39
61
  "qrcode": "^1.5.4",
40
62
  "vue": "^3.5.32",
41
63
  "vue-i18n": "^11.3.2",
42
- "vue-router": "^4.6.4"
64
+ "vue-router": "^4.6.4",
65
+ "ws": "^8.20.0"
43
66
  },
44
67
  "devDependencies": {
45
68
  "@types/js-yaml": "^4.0.9",
@@ -51,6 +74,7 @@
51
74
  "@types/markdown-it": "^14.1.2",
52
75
  "@types/node": "^24.12.2",
53
76
  "@types/qrcode": "^1.5.6",
77
+ "@types/ws": "^8.18.1",
54
78
  "@vitejs/plugin-vue": "^6.0.5",
55
79
  "@vue/tsconfig": "^0.9.1",
56
80
  "concurrently": "^9.2.1",
@@ -1 +0,0 @@
1
- import{A as e,C as t,D as n,E as r,G as i,J as a,Q as o,T as s,U as c,W as l,ct as u,gt as d,j as f,k as p,mt as m,pt as h,q as g,w as _,y as v}from"./router-B0PaAFys.js";import{r as y,t as b}from"./_plugin-vue_export-helper-DkLSTLBi.js";import{t as x}from"./Button-DBOPt_s1.js";import{t as S}from"./Input-CyvPny5v.js";import{t as C}from"./Tag-BUJuCRNX.js";import{t as w}from"./use-message-CG8KB3t0.js";import{t as T}from"./Spin-DiwsqMEC.js";import{t as E}from"./Switch-Ce0Tgpcj.js";import{a as D,i as O,n as k,o as A,r as j,t as M}from"./SettingRow-BvAmImkg.js";var N={class:`platform-info`},P=[`innerHTML`],F={class:`platform-name`},I={key:0,class:`platform-card-body`},L=b(f({__name:`PlatformCard`,props:{name:{},icon:{},config:{},credentials:{}},setup(s){let c=s,l=u(!0),{t:f}=y(),g=t(()=>{let e=c.credentials;if(!e)return!1;let t=[`token`,`api_key`,`app_id`,`client_id`,`secret`,`app_secret`,`client_secret`,`access_token`,`bot_id`,`account_id`,`enabled`];return[e,e.extra].filter(Boolean).some(e=>t.some(t=>{let n=e[t];return n!=null&&n!==``&&n!==!1}))});return(t,c)=>(i(),n(`div`,{class:m([`platform-card`,{configured:g.value}])},[_(`div`,{class:`platform-card-header`,onClick:c[0]||=e=>l.value=!l.value},[_(`div`,N,[_(`span`,{class:`platform-icon`,innerHTML:s.icon},null,8,P),_(`span`,F,d(s.name),1),e(h(C),{type:g.value?`success`:`default`,size:`small`,round:``},{default:o(()=>[p(d(g.value?h(f)(`common.configured`):h(f)(`common.notConfigured`)),1)]),_:1},8,[`type`])]),_(`span`,{class:m([`expand-icon`,{expanded:l.value}])},`▾`,2)]),l.value?(i(),n(`div`,I,[a(t.$slots,`default`,{},void 0,!0)])):r(``,!0)],2))}}),[[`__scopeId`,`data-v-ee5f4168`]]),R={class:`settings-section`},z={class:`weixin-qr-section`},B={key:1,class:`weixin-qr-loading`},V={key:2,class:`weixin-qr-hint`},H=b(f({__name:`PlatformSettings`,setup(t){let a=k(),c=w(),{t:f}=y();async function m(e,t){try{await a.saveSection(e,t),c.success(f(`settings.saved`))}catch{c.error(f(`settings.saveFailed`))}}async function b(e,t){try{await D(e,t),await a.fetchSettings(),c.success(f(`settings.saved`))}catch{c.error(f(`settings.saveFailed`))}}function C(e){return a.platforms[e]||{}}let N=u(``),P=u(``),F=u(`idle`),I=null;async function H(){F.value=`loading`,N.value=``,P.value=``,W();try{let e=await j();P.value=e.qrcode,N.value=e.qrcode_url,window.open(e.qrcode_url,`_blank`),F.value=`waiting`,U()}catch(e){F.value=`error`,c.error(e.message||`Failed to get QR code`)}}function U(){P.value&&(I=setTimeout(async()=>{try{let e=await O(P.value);e.status===`wait`?U():e.status===`scaned`?(F.value=`scaned`,U()):e.status===`expired`?F.value=`expired`:e.status===`confirmed`&&(F.value=`confirmed`,await A({account_id:e.account_id,token:e.token,base_url:e.base_url}),await a.fetchSettings(),c.success(f(`settings.saved`)))}catch{U()}},3e3))}function W(){I&&=(clearTimeout(I),null)}l(()=>{W()});let G=[{key:`telegram`,name:`Telegram`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>`},{key:`discord`,name:`Discord`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189z"/></svg>`},{key:`slack`,name:`Slack`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.122 0a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V5.042zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1 2.523-2.52h6.313A2.528 2.528 0 0 1 24 18.956a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>`},{key:`whatsapp`,name:`WhatsApp`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>`},{key:`matrix`,name:`Matrix`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.48.324.448.217.786.619 1.017 1.205.24-.376.558-.702.956-.98.398-.277.872-.414 1.424-.414.41 0 .784.065 1.122.194.34.13.629.325.87.588.241.263.428.59.56.984.132.393.198.85.198 1.368v5.89h-2.49v-4.893c0-.268-.016-.525-.048-.77a1.627 1.627 0 00-.2-.63 1.028 1.028 0 00-.392-.426 1.294 1.294 0 00-.616-.134c-.277 0-.508.05-.693.15a1.043 1.043 0 00-.43.41 1.768 1.768 0 00-.214.616 4.15 4.15 0 00-.06.74v4.937H9.29v-4.937c0-.25-.01-.498-.032-.742a1.84 1.84 0 00-.166-.638.998.998 0 00-.363-.448 1.206 1.206 0 00-.624-.154c-.26 0-.483.048-.67.144a1.055 1.055 0 00-.436.402 1.744 1.744 0 00-.227.616 4.108 4.108 0 00-.063.74v4.937H5.21V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg>`},{key:`feishu`,name:`Feishu`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M6.59 3.41a2.25 2.25 0 0 1 3.182 0L13.5 7.14l-3.182 3.182L6.59 7.59a2.25 2.25 0 0 1 0-3.182zm5.303 5.303L15.075 5.53a2.25 2.25 0 0 1 3.182 3.182L15.075 11.894 11.893 8.713zM3.41 6.59a2.25 2.25 0 0 1 3.182 0l3.182 3.182-3.182 3.182a2.25 2.25 0 0 1-3.182-3.182L3.41 6.59zm5.303 5.303L11.894 15.075a2.25 2.25 0 0 1-3.182 3.182L5.53 15.075 8.713 11.893zm5.303-5.303L17.478 9.778a2.25 2.25 0 0 1-3.182 3.182L10.53 10.075l3.182-3.182 0 .023z"/></svg>`},{key:`weixin`,name:`Weixin`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>`},{key:`wecom`,name:`WeCom`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>`}];return(t,c)=>(i(),n(`section`,R,[(i(),n(v,null,g(G,t=>e(L,{key:t.key,name:t.name,icon:t.icon,config:h(a)[t.key],credentials:C(t.key)},{default:o(()=>[t.key===`telegram`?(i(),n(v,{key:0},[e(M,{label:h(f)(`platform.botToken`),hint:h(f)(`platform.botTokenHint`)},{default:o(()=>[e(h(S),{value:C(`telegram`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`123456:ABC-DEF...`,"onUpdate:value":c[0]||=e=>b(`telegram`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionGroup`)},{default:o(()=>[e(h(E),{value:h(a).telegram.require_mention,"onUpdate:value":c[1]||=e=>m(`telegram`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.reactions`),hint:h(f)(`platform.reactionsHint`)},{default:o(()=>[e(h(E),{value:h(a).telegram.reactions,"onUpdate:value":c[2]||=e=>m(`telegram`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChats`),hint:h(f)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(h(S),{value:h(a).telegram.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[3]||=e=>m(`telegram`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.mentionPatterns`),hint:h(f)(`platform.mentionPatternsHint`)},{default:o(()=>[e(h(S),{value:(h(a).telegram.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[4]||=e=>m(`telegram`,{mention_patterns:e?e.split(`,`).map(e=>e.trim()):[]})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`discord`?(i(),n(v,{key:1},[e(M,{label:h(f)(`platform.botToken`),hint:h(f)(`platform.botTokenHint`)},{default:o(()=>[e(h(S),{value:C(`discord`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot token...`,"onUpdate:value":c[5]||=e=>b(`discord`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionChannel`)},{default:o(()=>[e(h(E),{value:h(a).discord.require_mention,"onUpdate:value":c[6]||=e=>m(`discord`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.autoThread`),hint:h(f)(`platform.autoThreadHint`)},{default:o(()=>[e(h(E),{value:h(a).discord.auto_thread,"onUpdate:value":c[7]||=e=>m(`discord`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.reactions`),hint:h(f)(`platform.reactionsHint`)},{default:o(()=>[e(h(E),{value:h(a).discord.reactions,"onUpdate:value":c[8]||=e=>m(`discord`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChannels`),hint:h(f)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(h(S),{value:h(a).discord.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[9]||=e=>m(`discord`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.allowedChannels`),hint:h(f)(`platform.allowedChannelsHint`)},{default:o(()=>[e(h(S),{value:h(a).discord.allowed_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[10]||=e=>m(`discord`,{allowed_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.ignoredChannels`),hint:h(f)(`platform.ignoredChannelsHint`)},{default:o(()=>[e(h(S),{value:h(a).discord.ignored_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[11]||=e=>m(`discord`,{ignored_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.noThreadChannels`),hint:h(f)(`platform.noThreadChannelsHint`)},{default:o(()=>[e(h(S),{value:h(a).discord.no_thread_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[12]||=e=>m(`discord`,{no_thread_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`slack`?(i(),n(v,{key:2},[e(M,{label:h(f)(`platform.botToken`),hint:h(f)(`platform.botTokenHint`)},{default:o(()=>[e(h(S),{value:C(`slack`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`xoxb-...`,"onUpdate:value":c[13]||=e=>b(`slack`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionChannel`)},{default:o(()=>[e(h(E),{value:h(a).slack.require_mention,"onUpdate:value":c[14]||=e=>m(`slack`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.allowBots`),hint:h(f)(`platform.allowBotsHint`)},{default:o(()=>[e(h(E),{value:h(a).slack.allow_bots,"onUpdate:value":c[15]||=e=>m(`slack`,{allow_bots:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChannels`),hint:h(f)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(h(S),{value:h(a).slack.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[16]||=e=>m(`slack`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`whatsapp`?(i(),n(v,{key:3},[e(M,{label:h(f)(`platform.waEnabled`),hint:h(f)(`platform.waEnabledHint`)},{default:o(()=>[e(h(E),{value:C(`whatsapp`).enabled,"onUpdate:value":c[17]||=e=>b(`whatsapp`,{enabled:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionGroup`)},{default:o(()=>[e(h(E),{value:h(a).whatsapp.require_mention,"onUpdate:value":c[18]||=e=>m(`whatsapp`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChats`),hint:h(f)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(h(S),{value:h(a).whatsapp.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[19]||=e=>m(`whatsapp`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.mentionPatterns`),hint:h(f)(`platform.mentionPatternsHint`)},{default:o(()=>[e(h(S),{value:(h(a).whatsapp.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[20]||=e=>m(`whatsapp`,{mention_patterns:e?e.split(`,`).map(e=>e.trim()):[]})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`matrix`?(i(),n(v,{key:4},[e(M,{label:h(f)(`platform.accessToken`),hint:h(f)(`platform.accessTokenHint`)},{default:o(()=>[e(h(S),{value:C(`matrix`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`syt_...`,"onUpdate:value":c[21]||=e=>b(`matrix`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.homeserver`),hint:h(f)(`platform.homeserverHint`)},{default:o(()=>[e(h(S),{value:C(`matrix`).extra?.homeserver||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`https://matrix.org`,"onUpdate:value":c[22]||=e=>b(`matrix`,{extra:{...C(`matrix`).extra,homeserver:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionRoom`)},{default:o(()=>[e(h(E),{value:h(a).matrix.require_mention,"onUpdate:value":c[23]||=e=>m(`matrix`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.autoThread`),hint:h(f)(`platform.autoThreadHintRoom`)},{default:o(()=>[e(h(E),{value:h(a).matrix.auto_thread,"onUpdate:value":c[24]||=e=>m(`matrix`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.dmMentionThreads`),hint:h(f)(`platform.dmMentionThreadsHint`)},{default:o(()=>[e(h(E),{value:h(a).matrix.dm_mention_threads,"onUpdate:value":c[25]||=e=>m(`matrix`,{dm_mention_threads:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseRooms`),hint:h(f)(`platform.freeResponseRoomsHint`)},{default:o(()=>[e(h(S),{value:h(a).matrix.free_response_rooms||``,size:`small`,placeholder:`room_id1,room_id2`,"onUpdate:value":c[26]||=e=>m(`matrix`,{free_response_rooms:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`feishu`?(i(),n(v,{key:5},[e(M,{label:h(f)(`platform.appId`),hint:h(f)(`platform.appIdHint`)},{default:o(()=>[e(h(S),{value:C(`feishu`).extra?.app_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`cli_...`,"onUpdate:value":c[27]||=e=>b(`feishu`,{extra:{...C(`feishu`).extra,app_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.appSecret`),hint:h(f)(`platform.appSecretHint`)},{default:o(()=>[e(h(S),{value:C(`feishu`).extra?.app_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`App Secret`,"onUpdate:value":c[28]||=e=>b(`feishu`,{extra:{...C(`feishu`).extra,app_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionGroup`)},{default:o(()=>[e(h(E),{value:h(a).feishu.require_mention,"onUpdate:value":c[29]||=e=>m(`feishu`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChats`),hint:h(f)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(h(S),{value:h(a).feishu.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[30]||=e=>m(`feishu`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`dingtalk`?(i(),n(v,{key:6},[e(M,{label:h(f)(`platform.clientId`),hint:h(f)(`platform.clientIdHint`)},{default:o(()=>[e(h(S),{value:C(`dingtalk`).extra?.client_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client ID`,"onUpdate:value":c[31]||=e=>b(`dingtalk`,{extra:{...C(`dingtalk`).extra,client_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.clientSecret`),hint:h(f)(`platform.clientSecretHint`)},{default:o(()=>[e(h(S),{value:C(`dingtalk`).extra?.client_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client Secret`,"onUpdate:value":c[32]||=e=>b(`dingtalk`,{extra:{...C(`dingtalk`).extra,client_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.requireMention`),hint:h(f)(`platform.requireMentionGroup`)},{default:o(()=>[e(h(E),{value:h(a).dingtalk.require_mention,"onUpdate:value":c[33]||=e=>m(`dingtalk`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.freeResponseChats`),hint:h(f)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(h(S),{value:h(a).dingtalk.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[34]||=e=>m(`dingtalk`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`weixin`?(i(),n(v,{key:7},[_(`div`,z,[F.value===`idle`||F.value===`error`||F.value===`expired`||F.value===`confirmed`?(i(),s(h(x),{key:0,type:`primary`,size:`small`,onClick:H},{default:o(()=>[p(d(F.value===`confirmed`?h(f)(`platform.qrRelogin`):h(f)(`platform.qrLogin`)),1)]),_:1})):r(``,!0),F.value===`loading`?(i(),n(`div`,B,[e(h(T),{size:`small`}),_(`span`,null,d(h(f)(`platform.qrFetching`)),1)])):r(``,!0),F.value===`waiting`||F.value===`scaned`?(i(),n(`div`,V,d(F.value===`scaned`?h(f)(`platform.qrScanedHint`):h(f)(`platform.qrScanHint`)),1)):r(``,!0)]),e(M,{label:h(f)(`platform.weixinToken`),hint:h(f)(`platform.weixinTokenHint`)},{default:o(()=>[e(h(S),{value:C(`weixin`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Token`,"onUpdate:value":c[35]||=e=>b(`weixin`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.accountId`),hint:h(f)(`platform.accountIdHint`)},{default:o(()=>[e(h(S),{value:C(`weixin`).extra?.account_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Account ID`,"onUpdate:value":c[36]||=e=>b(`weixin`,{extra:{...C(`weixin`).extra,account_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`wecom`?(i(),n(v,{key:8},[e(M,{label:h(f)(`platform.botId`),hint:h(f)(`platform.botIdHint`)},{default:o(()=>[e(h(S),{value:C(`wecom`).extra?.bot_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot ID`,"onUpdate:value":c[37]||=e=>b(`wecom`,{extra:{...C(`wecom`).extra,bot_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(M,{label:h(f)(`platform.appSecret`),hint:h(f)(`platform.wecomSecretHint`)},{default:o(()=>[e(h(S),{value:C(`wecom`).extra?.secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Secret`,"onUpdate:value":c[38]||=e=>b(`wecom`,{extra:{...C(`wecom`).extra,secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0)]),_:2},1032,[`name`,`icon`,`config`,`credentials`])),64))]))}}),[[`__scopeId`,`data-v-42f61b1e`]]),U={class:`channels-view`},W={class:`page-header`},G={class:`header-title`},K={class:`channels-content`},q=b(f({__name:`ChannelsView`,setup(t){let r=k(),{t:a}=y();return c(()=>{r.fetchSettings()}),(t,s)=>(i(),n(`div`,U,[_(`header`,W,[_(`h2`,G,d(h(a)(`sidebar.channels`)),1)]),_(`div`,K,[e(h(T),{show:h(r).loading},{default:o(()=>[e(H)]),_:1},8,[`show`])])]))}}),[[`__scopeId`,`data-v-cddaaa50`]]);export{q as default};