hermes-web-ui 0.2.7 → 0.2.9
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.
- package/README.md +2 -2
- package/bin/hermes-web-ui.mjs +50 -13
- package/dist/client/assets/Add-XpaL69a7.js +1 -0
- package/dist/client/assets/{Button-zECKCotA.js → Button-DZWlvt3_.js} +14 -14
- package/dist/client/assets/{ChannelsView-xCdAEZam.css → ChannelsView-D168bwSq.css} +1 -1
- package/dist/client/assets/ChannelsView-DsFZWVNp.js +1 -0
- package/dist/client/assets/ChatView-DoqDlZLC.js +127 -0
- package/dist/client/assets/{Close-DjLWDodG.js → Close-CynFIaWE.js} +10 -10
- package/dist/client/assets/FormItem-9JbgiHgw.js +110 -0
- package/dist/client/assets/Input-BUMpvosL.js +234 -0
- package/dist/client/assets/InputNumber-BOptkZXt.js +13 -0
- package/dist/client/assets/{JobsView-DsfGyjnT.js → JobsView-C-nRY00Q.js} +2 -2
- package/dist/client/assets/{LoginView-BiWaCYS0.js → LoginView-CLrTbJPK.js} +1 -1
- package/dist/client/assets/{LogsView-DuORyFFY.js → LogsView-BjeUz4w_.js} +1 -1
- package/dist/client/assets/{MarkdownRenderer-BA3oPVqT.js → MarkdownRenderer-pJXYVaJf.js} +1 -1
- package/dist/client/assets/MemoryView-B_b0Bw4s.js +7 -0
- package/dist/client/assets/MemoryView-hIfyUkwz.css +1 -0
- package/dist/client/assets/{Modal-WQKdvHJY.js → Modal-Gb5CDHOn.js} +56 -56
- package/dist/client/assets/ModelsView-BHO6JeeK.js +1 -0
- package/dist/client/assets/{Popconfirm-02A7vL_z.js → Popconfirm-f3hviugz.js} +4 -4
- package/dist/client/assets/Popover-BtQeULHo.js +117 -0
- package/dist/client/assets/ProfilesView-C4GoKpgi.js +440 -0
- package/dist/client/assets/ProfilesView-jqeO8Zv3.css +1 -0
- package/dist/client/assets/{Scrollbar-Bg2FeTtI.js → Scrollbar-Bui9E0cT.js} +17 -17
- package/dist/client/assets/Select-By6oALhZ.js +340 -0
- package/dist/client/assets/{SettingRow-CLLFxWP3.js → SettingRow-CWqG1TP7.js} +1 -1
- package/dist/client/assets/SettingsView-CzgT0dAx.js +352 -0
- package/dist/client/assets/{SkillsView-D6CegW4w.js → SkillsView-2xeOBpxm.js} +1 -1
- package/dist/client/assets/{Spin-lybeIDeX.js → Spin-DD5RgTEV.js} +4 -4
- package/dist/client/assets/{Suffix-Dv1UElLH.js → Suffix-CkTuXehC.js} +5 -5
- package/dist/client/assets/{Switch-mgeu-lpD.js → Switch-BqpUglHp.js} +15 -15
- package/dist/client/assets/{Tag-DWc4lbAm.js → Tag-BdqJCtwA.js} +15 -15
- package/dist/client/assets/{TerminalView-DmnXOHFu.js → TerminalView-DOvaJfhr.js} +1 -1
- package/dist/client/assets/{Tooltip-DrDTmrj3.js → Tooltip-2f394xdV.js} +1 -1
- package/dist/client/assets/{UsageView-C3O6-vbW.js → UsageView-Cd7Gui1x.js} +1 -1
- package/dist/client/assets/{Warning-t1i_4T5i.js → Warning-21tMOc2L.js} +1 -1
- package/dist/client/assets/{_plugin-vue_export-helper-BkT4A29V.js → _plugin-vue_export-helper-C39Y8Snr.js} +1 -1
- package/dist/client/assets/app-Dc1GzlQi.js +1 -0
- package/dist/client/assets/app-DjAPGKg7.js +1 -0
- package/dist/client/assets/{browser-DzAOCZtm.js → browser-DMdqvQBg.js} +9 -9
- package/dist/client/assets/{chat-CX1Hza8X.js → chat-1kL3Ps59.js} +2 -2
- package/dist/client/assets/composables-BxlGNoT-.js +1 -0
- package/dist/client/assets/create-5zWq3BEB.js +1 -0
- package/dist/client/assets/fade-in-scale-up.cssr-HXBs3oL0.js +1 -0
- package/dist/client/assets/index-BT19Bivl.css +1 -0
- package/dist/client/assets/index-CFIEnaxD.js +284 -0
- package/dist/client/assets/{jobs-B9NHIxuL.js → jobs-YFhNrsBu.js} +1 -1
- package/dist/client/assets/{pinia-bPUFQqFK.js → pinia-BPgWlB7x.js} +1 -1
- package/dist/client/assets/profiles-H8Bd9mDO.js +23 -0
- package/dist/client/assets/{router-COwpqexM.js → router-cAIqC_mO.js} +2 -2
- package/dist/client/assets/{sessions-B1SPfe-R.js → sessions-fFwnFvo3.js} +1 -1
- package/dist/client/assets/{skills-CRtljpt6.js → skills-DZWMwFIf.js} +1 -1
- package/dist/client/assets/use-compitable-esQP7BHf.js +1 -0
- package/dist/client/assets/use-message-CnDHqZf8.js +1 -0
- package/dist/client/index.html +24 -22
- package/dist/server/data/.token +1 -0
- package/dist/server/index.js +70 -4
- package/dist/server/routes/hermes/config.js +11 -11
- package/dist/server/routes/hermes/filesystem.js +154 -29
- package/dist/server/routes/hermes/profiles.js +136 -14
- package/dist/server/routes/hermes/terminal.js +12 -34
- package/dist/server/routes/hermes/weixin.js +6 -6
- package/dist/server/services/hermes-cli.d.ts +4 -0
- package/dist/server/services/hermes-cli.js +17 -0
- package/dist/server/services/hermes-profile.d.ts +22 -0
- package/dist/server/services/hermes-profile.js +60 -0
- package/dist/server/shared/providers.js +8 -14
- package/package.json +1 -1
- package/dist/client/assets/ChannelsView-Bvh3tnio.js +0 -1
- package/dist/client/assets/ChatView-CJZahJ1V.js +0 -127
- package/dist/client/assets/FormItem-CZ9auYA2.js +0 -110
- package/dist/client/assets/Input-DxJk6pT-.js +0 -234
- package/dist/client/assets/InputNumber-BTqp81h0.js +0 -13
- package/dist/client/assets/MemoryView-CU3JHweh.css +0 -1
- package/dist/client/assets/MemoryView-VgQFNMsP.js +0 -5
- package/dist/client/assets/ModelsView-QDRloKd5.js +0 -1
- package/dist/client/assets/Popover-2C1zuptC.js +0 -117
- package/dist/client/assets/Select-C_hKaXgI.js +0 -340
- package/dist/client/assets/SettingsView-CeScqhwO.js +0 -352
- package/dist/client/assets/app-BUjbfMSg.js +0 -1
- package/dist/client/assets/app-p59ZckFN.js +0 -1
- package/dist/client/assets/context-BM8ZQCOz.js +0 -1
- package/dist/client/assets/fade-in-scale-up.cssr-DQl-Z54c.js +0 -1
- package/dist/client/assets/index-95z-iQoj.js +0 -306
- package/dist/client/assets/index-C33O1KZm.css +0 -1
- package/dist/client/assets/use-compitable-BnlNjEug.js +0 -1
- package/dist/client/assets/use-message-g8F4Z57w.js +0 -1
- /package/dist/client/assets/{omit-C4dR5R2G.js → omit-1BRB6K75.js} +0 -0
|
@@ -38,7 +38,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.profileRoutes = void 0;
|
|
40
40
|
const router_1 = __importDefault(require("@koa/router"));
|
|
41
|
+
const fs_1 = require("fs");
|
|
42
|
+
const promises_1 = require("fs/promises");
|
|
43
|
+
const path_1 = require("path");
|
|
44
|
+
const os_1 = require("os");
|
|
45
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
41
46
|
const hermesCli = __importStar(require("../../services/hermes-cli"));
|
|
47
|
+
const apiServerDefaults = {
|
|
48
|
+
enabled: true,
|
|
49
|
+
host: '127.0.0.1',
|
|
50
|
+
port: 8642,
|
|
51
|
+
key: '',
|
|
52
|
+
cors_origins: '*',
|
|
53
|
+
};
|
|
54
|
+
function ensureApiServerConfig(profilePath) {
|
|
55
|
+
const configPath = (0, path_1.join)(profilePath, 'config.yaml');
|
|
56
|
+
try {
|
|
57
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
58
|
+
// Profile has no config.yaml — run hermes setup --reset to generate full defaults,
|
|
59
|
+
// then inject api_server config (setup itself doesn't add it)
|
|
60
|
+
console.log(`[Profile] No config.yaml for ${profilePath}, running setup --reset`);
|
|
61
|
+
return { needSetup: true, path: profilePath };
|
|
62
|
+
}
|
|
63
|
+
const content = (0, fs_1.readFileSync)(configPath, 'utf-8');
|
|
64
|
+
const cfg = js_yaml_1.default.load(content) || {};
|
|
65
|
+
if (!cfg.platforms)
|
|
66
|
+
cfg.platforms = {};
|
|
67
|
+
if (!cfg.platforms.api_server) {
|
|
68
|
+
cfg.platforms.api_server = { ...apiServerDefaults };
|
|
69
|
+
(0, fs_1.writeFileSync)(configPath, js_yaml_1.default.dump(cfg), 'utf-8');
|
|
70
|
+
console.log(`[Profile] Ensured api_server config for: ${profilePath}`);
|
|
71
|
+
}
|
|
72
|
+
return { needSetup: false, path: profilePath };
|
|
73
|
+
}
|
|
74
|
+
catch { }
|
|
75
|
+
return { needSetup: false, path: profilePath };
|
|
76
|
+
}
|
|
42
77
|
exports.profileRoutes = new router_1.default();
|
|
43
78
|
// GET /api/profiles - List all profiles
|
|
44
79
|
exports.profileRoutes.get('/api/hermes/profiles', async (ctx) => {
|
|
@@ -136,12 +171,12 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
136
171
|
return;
|
|
137
172
|
}
|
|
138
173
|
try {
|
|
139
|
-
// 1. Stop gateway
|
|
174
|
+
// 1. Stop gateway
|
|
140
175
|
try {
|
|
141
176
|
await hermesCli.stopGateway();
|
|
142
177
|
}
|
|
143
178
|
catch { }
|
|
144
|
-
// 2. Kill gateway by port if still running
|
|
179
|
+
// 2. Kill gateway by port if still running
|
|
145
180
|
try {
|
|
146
181
|
const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
147
182
|
const isWin = process.platform === 'win32';
|
|
@@ -168,12 +203,38 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
168
203
|
// 3. Switch profile
|
|
169
204
|
const output = await hermesCli.useProfile(name);
|
|
170
205
|
await new Promise(r => setTimeout(r, 1000));
|
|
171
|
-
// 4.
|
|
206
|
+
// 4. Ensure api_server config for new profile
|
|
172
207
|
try {
|
|
173
|
-
await hermesCli.
|
|
208
|
+
const detail = await hermesCli.getProfile(name);
|
|
209
|
+
console.log(`[Profile] detail.path = ${detail.path}`);
|
|
210
|
+
const result = ensureApiServerConfig(detail.path);
|
|
211
|
+
if (result?.needSetup) {
|
|
212
|
+
// No config.yaml — run setup --reset to create full default config,
|
|
213
|
+
// then ensure api_server is present
|
|
214
|
+
try {
|
|
215
|
+
await hermesCli.setupReset();
|
|
216
|
+
}
|
|
217
|
+
catch { }
|
|
218
|
+
ensureApiServerConfig(detail.path);
|
|
219
|
+
}
|
|
220
|
+
// Create .env if target has none
|
|
221
|
+
const profileEnv = (0, path_1.join)(detail.path, '.env');
|
|
222
|
+
console.log(`[Profile] .env exists: ${(0, fs_1.existsSync)(profileEnv)}, path: ${profileEnv}`);
|
|
223
|
+
if (!(0, fs_1.existsSync)(profileEnv)) {
|
|
224
|
+
(0, fs_1.writeFileSync)(profileEnv, '# Hermes Agent Environment Configuration\n', 'utf-8');
|
|
225
|
+
console.log(`[Profile] Created .env for: ${detail.path}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
console.error(`[Profile] Ensure config failed:`, err.message);
|
|
230
|
+
}
|
|
231
|
+
// 5. Start gateway
|
|
232
|
+
try {
|
|
233
|
+
await hermesCli.startGateway();
|
|
234
|
+
console.log('[Profile] Gateway started');
|
|
174
235
|
}
|
|
175
236
|
catch {
|
|
176
|
-
// Fallback for WSL
|
|
237
|
+
// Fallback: background mode (for WSL etc.)
|
|
177
238
|
try {
|
|
178
239
|
const pid = await hermesCli.startGatewayBackground();
|
|
179
240
|
await new Promise(r => setTimeout(r, 3000));
|
|
@@ -190,32 +251,93 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
190
251
|
ctx.body = { error: err.message };
|
|
191
252
|
}
|
|
192
253
|
});
|
|
193
|
-
// POST /api/profiles/:name/export - Export profile to archive
|
|
254
|
+
// POST /api/profiles/:name/export - Export profile to archive and download
|
|
194
255
|
exports.profileRoutes.post('/api/hermes/profiles/:name/export', async (ctx) => {
|
|
195
256
|
const { name } = ctx.params;
|
|
196
|
-
const
|
|
257
|
+
const outputPath = (0, path_1.join)((0, os_1.tmpdir)(), `hermes-profile-${name}.tar.gz`);
|
|
197
258
|
try {
|
|
198
|
-
|
|
199
|
-
|
|
259
|
+
await hermesCli.exportProfile(name, outputPath);
|
|
260
|
+
if (!(0, fs_1.existsSync)(outputPath)) {
|
|
261
|
+
ctx.status = 500;
|
|
262
|
+
ctx.body = { error: 'Export file not found' };
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const filename = (0, path_1.basename)(outputPath);
|
|
266
|
+
ctx.set('Content-Disposition', `attachment; filename="${filename}"`);
|
|
267
|
+
ctx.set('Content-Type', 'application/gzip');
|
|
268
|
+
ctx.body = (0, fs_1.createReadStream)(outputPath);
|
|
269
|
+
// Clean up temp file after response ends
|
|
270
|
+
ctx.res.on('finish', () => {
|
|
271
|
+
try {
|
|
272
|
+
(0, fs_1.unlinkSync)(outputPath);
|
|
273
|
+
}
|
|
274
|
+
catch { }
|
|
275
|
+
});
|
|
200
276
|
}
|
|
201
277
|
catch (err) {
|
|
202
278
|
ctx.status = 500;
|
|
203
279
|
ctx.body = { error: err.message };
|
|
204
280
|
}
|
|
205
281
|
});
|
|
206
|
-
// POST /api/profiles/import - Import profile from archive
|
|
282
|
+
// POST /api/profiles/import - Import profile from uploaded archive
|
|
207
283
|
exports.profileRoutes.post('/api/hermes/profiles/import', async (ctx) => {
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
284
|
+
const contentType = ctx.get('content-type') || '';
|
|
285
|
+
if (!contentType.startsWith('multipart/form-data')) {
|
|
286
|
+
ctx.status = 400;
|
|
287
|
+
ctx.body = { error: 'Expected multipart/form-data' };
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const boundary = '--' + contentType.split('boundary=')[1];
|
|
291
|
+
if (!boundary || boundary === '--undefined') {
|
|
292
|
+
ctx.status = 400;
|
|
293
|
+
ctx.body = { error: 'Missing boundary' };
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const tmpDir = (0, path_1.join)((0, os_1.tmpdir)(), 'hermes-import');
|
|
297
|
+
await (0, promises_1.mkdir)(tmpDir, { recursive: true });
|
|
298
|
+
// Read raw body and parse multipart
|
|
299
|
+
const chunks = [];
|
|
300
|
+
for await (const chunk of ctx.req)
|
|
301
|
+
chunks.push(chunk);
|
|
302
|
+
const body = Buffer.concat(chunks).toString('latin1');
|
|
303
|
+
const parts = body.split(boundary).slice(1, -1);
|
|
304
|
+
let archivePath = '';
|
|
305
|
+
for (const part of parts) {
|
|
306
|
+
const headerEnd = part.indexOf('\r\n\r\n');
|
|
307
|
+
if (headerEnd === -1)
|
|
308
|
+
continue;
|
|
309
|
+
const header = part.substring(0, headerEnd);
|
|
310
|
+
const data = part.substring(headerEnd + 4, part.length - 2);
|
|
311
|
+
const filenameMatch = header.match(/filename="([^"]+)"/);
|
|
312
|
+
if (!filenameMatch)
|
|
313
|
+
continue;
|
|
314
|
+
const filename = filenameMatch[1];
|
|
315
|
+
const ext = filename.includes('.') ? '.' + filename.split('.').pop() : '';
|
|
316
|
+
if (!['.gz', '.tar.gz', '.zip', '.tgz'].includes(ext))
|
|
317
|
+
continue;
|
|
318
|
+
archivePath = (0, path_1.join)(tmpDir, filename);
|
|
319
|
+
await (0, promises_1.writeFile)(archivePath, Buffer.from(data, 'binary'));
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
if (!archivePath) {
|
|
210
323
|
ctx.status = 400;
|
|
211
|
-
ctx.body = { error: '
|
|
324
|
+
ctx.body = { error: 'No archive file found (.gz, .zip, .tgz)' };
|
|
212
325
|
return;
|
|
213
326
|
}
|
|
214
327
|
try {
|
|
215
|
-
const result = await hermesCli.importProfile(
|
|
328
|
+
const result = await hermesCli.importProfile(archivePath);
|
|
329
|
+
// Clean up temp file
|
|
330
|
+
try {
|
|
331
|
+
(0, fs_1.unlinkSync)(archivePath);
|
|
332
|
+
}
|
|
333
|
+
catch { }
|
|
216
334
|
ctx.body = { success: true, message: result.trim() };
|
|
217
335
|
}
|
|
218
336
|
catch (err) {
|
|
337
|
+
try {
|
|
338
|
+
(0, fs_1.unlinkSync)(archivePath);
|
|
339
|
+
}
|
|
340
|
+
catch { }
|
|
219
341
|
ctx.status = 500;
|
|
220
342
|
ctx.body = { error: err.message };
|
|
221
343
|
}
|
|
@@ -1,43 +1,17 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.setupTerminalWebSocket = setupTerminalWebSocket;
|
|
37
4
|
const ws_1 = require("ws");
|
|
38
5
|
const fs_1 = require("fs");
|
|
39
|
-
const pty = __importStar(require("node-pty"));
|
|
40
6
|
const auth_1 = require("../../services/auth");
|
|
7
|
+
let pty = null;
|
|
8
|
+
try {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
|
+
pty = require('node-pty');
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
console.warn('[Terminal] node-pty failed to load, terminal feature disabled');
|
|
14
|
+
}
|
|
41
15
|
// ─── Shell detection ────────────────────────────────────────────
|
|
42
16
|
function findShell() {
|
|
43
17
|
const candidates = [
|
|
@@ -85,6 +59,10 @@ function createSession(shell) {
|
|
|
85
59
|
}
|
|
86
60
|
// ─── WebSocket server setup ─────────────────────────────────────
|
|
87
61
|
function setupTerminalWebSocket(httpServer) {
|
|
62
|
+
if (!pty) {
|
|
63
|
+
console.warn('[Terminal] node-pty not available, skipping terminal WebSocket setup');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
88
66
|
const wss = new ws_1.WebSocketServer({ noServer: true });
|
|
89
67
|
const defaultShell = findShell();
|
|
90
68
|
httpServer.on('upgrade', async (req, socket, head) => {
|
|
@@ -8,10 +8,9 @@ const router_1 = __importDefault(require("@koa/router"));
|
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const promises_1 = require("fs/promises");
|
|
10
10
|
const promises_2 = require("fs/promises");
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
const os_1 = require("os");
|
|
13
11
|
const hermes_cli_1 = require("../../services/hermes-cli");
|
|
14
|
-
const
|
|
12
|
+
const hermes_profile_1 = require("../../services/hermes-profile");
|
|
13
|
+
const envPath = () => (0, hermes_profile_1.getActiveEnvPath)();
|
|
15
14
|
const ILINK_BASE = 'https://ilinkai.weixin.qq.com';
|
|
16
15
|
exports.weixinRoutes = new router_1.default();
|
|
17
16
|
// GET /api/weixin/qrcode — fetch QR code from Tencent iLink API
|
|
@@ -79,7 +78,7 @@ exports.weixinRoutes.post('/api/hermes/weixin/save', async (ctx) => {
|
|
|
79
78
|
try {
|
|
80
79
|
let raw;
|
|
81
80
|
try {
|
|
82
|
-
raw = await (0, promises_1.readFile)(envPath, 'utf-8');
|
|
81
|
+
raw = await (0, promises_1.readFile)(envPath(), 'utf-8');
|
|
83
82
|
}
|
|
84
83
|
catch {
|
|
85
84
|
raw = '';
|
|
@@ -116,9 +115,10 @@ exports.weixinRoutes.post('/api/hermes/weixin/save', async (ctx) => {
|
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
let output = result.join('\n').replace(/\n{3,}/g, '\n\n').replace(/\n+$/, '') + '\n';
|
|
119
|
-
|
|
118
|
+
const ep = envPath();
|
|
119
|
+
await (0, promises_1.writeFile)(ep, output, 'utf-8');
|
|
120
120
|
try {
|
|
121
|
-
await (0, promises_2.chmod)(
|
|
121
|
+
await (0, promises_2.chmod)(ep, 0o600);
|
|
122
122
|
}
|
|
123
123
|
catch { /* ignore */ }
|
|
124
124
|
await (0, hermes_cli_1.restartGateway)();
|
|
@@ -115,6 +115,10 @@ export declare function useProfile(name: string): Promise<string>;
|
|
|
115
115
|
* Export profile to archive
|
|
116
116
|
*/
|
|
117
117
|
export declare function exportProfile(name: string, outputPath?: string): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Run hermes setup --non-interactive --reset to generate default config for current profile
|
|
120
|
+
*/
|
|
121
|
+
export declare function setupReset(): Promise<string>;
|
|
118
122
|
/**
|
|
119
123
|
* Import profile from archive
|
|
120
124
|
*/
|
|
@@ -18,6 +18,7 @@ exports.deleteProfile = deleteProfile;
|
|
|
18
18
|
exports.renameProfile = renameProfile;
|
|
19
19
|
exports.useProfile = useProfile;
|
|
20
20
|
exports.exportProfile = exportProfile;
|
|
21
|
+
exports.setupReset = setupReset;
|
|
21
22
|
exports.importProfile = importProfile;
|
|
22
23
|
const child_process_1 = require("child_process");
|
|
23
24
|
const util_1 = require("util");
|
|
@@ -429,6 +430,22 @@ async function exportProfile(name, outputPath) {
|
|
|
429
430
|
throw new Error(`Failed to export profile: ${err.message}`);
|
|
430
431
|
}
|
|
431
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Run hermes setup --non-interactive --reset to generate default config for current profile
|
|
435
|
+
*/
|
|
436
|
+
async function setupReset() {
|
|
437
|
+
try {
|
|
438
|
+
const { stdout, stderr } = await execFileAsync('hermes', ['setup', '--non-interactive', '--reset'], {
|
|
439
|
+
timeout: 30000,
|
|
440
|
+
...execOpts,
|
|
441
|
+
});
|
|
442
|
+
return stdout || stderr;
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
console.error('[Hermes CLI] setup reset failed:', err.message);
|
|
446
|
+
throw new Error(`Failed to reset config: ${err.message}`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
432
449
|
/**
|
|
433
450
|
* Import profile from archive
|
|
434
451
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the active profile's home directory.
|
|
3
|
+
* default → ~/.hermes/
|
|
4
|
+
* other → ~/.hermes/profiles/{name}/
|
|
5
|
+
*/
|
|
6
|
+
export declare function getActiveProfileDir(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the active profile's config.yaml path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getActiveConfigPath(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the active profile's auth.json path.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getActiveAuthPath(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the active profile's .env path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getActiveEnvPath(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the active profile name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getActiveProfileName(): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActiveProfileDir = getActiveProfileDir;
|
|
4
|
+
exports.getActiveConfigPath = getActiveConfigPath;
|
|
5
|
+
exports.getActiveAuthPath = getActiveAuthPath;
|
|
6
|
+
exports.getActiveEnvPath = getActiveEnvPath;
|
|
7
|
+
exports.getActiveProfileName = getActiveProfileName;
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const os_1 = require("os");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const HERMES_BASE = (0, path_1.resolve)((0, os_1.homedir)(), '.hermes');
|
|
12
|
+
/**
|
|
13
|
+
* Get the active profile's home directory.
|
|
14
|
+
* default → ~/.hermes/
|
|
15
|
+
* other → ~/.hermes/profiles/{name}/
|
|
16
|
+
*/
|
|
17
|
+
function getActiveProfileDir() {
|
|
18
|
+
const activeFile = (0, path_1.join)(HERMES_BASE, 'active_profile');
|
|
19
|
+
try {
|
|
20
|
+
const name = (0, fs_1.readFileSync)(activeFile, 'utf-8').trim();
|
|
21
|
+
if (name && name !== 'default') {
|
|
22
|
+
const dir = (0, path_1.join)(HERMES_BASE, 'profiles', name);
|
|
23
|
+
if ((0, fs_1.existsSync)(dir))
|
|
24
|
+
return dir;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
return HERMES_BASE;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the active profile's config.yaml path.
|
|
32
|
+
*/
|
|
33
|
+
function getActiveConfigPath() {
|
|
34
|
+
return (0, path_1.join)(getActiveProfileDir(), 'config.yaml');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the active profile's auth.json path.
|
|
38
|
+
*/
|
|
39
|
+
function getActiveAuthPath() {
|
|
40
|
+
return (0, path_1.join)(getActiveProfileDir(), 'auth.json');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the active profile's .env path.
|
|
44
|
+
*/
|
|
45
|
+
function getActiveEnvPath() {
|
|
46
|
+
return (0, path_1.join)(getActiveProfileDir(), '.env');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the active profile name.
|
|
50
|
+
*/
|
|
51
|
+
function getActiveProfileName() {
|
|
52
|
+
const activeFile = (0, path_1.join)(HERMES_BASE, 'active_profile');
|
|
53
|
+
try {
|
|
54
|
+
const name = (0, fs_1.readFileSync)(activeFile, 'utf-8').trim();
|
|
55
|
+
return name || 'default';
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return 'default';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -39,7 +39,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
39
39
|
{
|
|
40
40
|
label: 'DeepSeek',
|
|
41
41
|
value: 'deepseek',
|
|
42
|
-
base_url: 'https://api.deepseek.com
|
|
42
|
+
base_url: 'https://api.deepseek.com',
|
|
43
43
|
models: ['deepseek-chat', 'deepseek-reasoner'],
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -49,8 +49,8 @@ exports.PROVIDER_PRESETS = [
|
|
|
49
49
|
models: ['glm-5', 'glm-5-turbo', 'glm-4.7', 'glm-4.5', 'glm-4.5-flash'],
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
label: 'Kimi Coding
|
|
53
|
-
value: 'kimi-coding',
|
|
52
|
+
label: 'Kimi for Coding',
|
|
53
|
+
value: 'kimi-for-coding',
|
|
54
54
|
base_url: 'https://api.kimi.com/coding/v1',
|
|
55
55
|
models: [
|
|
56
56
|
'kimi-for-coding',
|
|
@@ -61,12 +61,6 @@ exports.PROVIDER_PRESETS = [
|
|
|
61
61
|
'kimi-k2-0905-preview',
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
|
-
{
|
|
65
|
-
label: 'Moonshot (Pay-as-you-go)',
|
|
66
|
-
value: 'moonshot',
|
|
67
|
-
base_url: 'https://api.moonshot.ai/v1',
|
|
68
|
-
models: ['kimi-k2.5', 'kimi-k2-thinking', 'kimi-k2-turbo-preview', 'kimi-k2-0905-preview'],
|
|
69
|
-
},
|
|
70
64
|
{
|
|
71
65
|
label: 'xAI',
|
|
72
66
|
value: 'xai',
|
|
@@ -87,7 +81,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
87
81
|
{
|
|
88
82
|
label: 'MiniMax',
|
|
89
83
|
value: 'minimax',
|
|
90
|
-
base_url: 'https://api.minimax.io/anthropic',
|
|
84
|
+
base_url: 'https://api.minimax.io/anthropic/v1',
|
|
91
85
|
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
|
92
86
|
},
|
|
93
87
|
{
|
|
@@ -133,7 +127,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
133
127
|
},
|
|
134
128
|
{
|
|
135
129
|
label: 'Kilo Code',
|
|
136
|
-
value: '
|
|
130
|
+
value: 'kilo',
|
|
137
131
|
base_url: 'https://api.kilo.ai/api/gateway',
|
|
138
132
|
models: [
|
|
139
133
|
'anthropic/claude-opus-4.6',
|
|
@@ -144,8 +138,8 @@ exports.PROVIDER_PRESETS = [
|
|
|
144
138
|
],
|
|
145
139
|
},
|
|
146
140
|
{
|
|
147
|
-
label: 'AI Gateway',
|
|
148
|
-
value: '
|
|
141
|
+
label: 'Vercel AI Gateway',
|
|
142
|
+
value: 'vercel',
|
|
149
143
|
base_url: 'https://ai-gateway.vercel.sh/v1',
|
|
150
144
|
models: [
|
|
151
145
|
'anthropic/claude-opus-4.6',
|
|
@@ -164,7 +158,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
164
158
|
},
|
|
165
159
|
{
|
|
166
160
|
label: 'OpenCode Zen',
|
|
167
|
-
value: 'opencode
|
|
161
|
+
value: 'opencode',
|
|
168
162
|
base_url: 'https://opencode.ai/zen/v1',
|
|
169
163
|
models: [
|
|
170
164
|
'gpt-5.4-pro',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-web-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
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",
|
|
@@ -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,Y as u,ct as d,gt as f,j as p,k as m,mt as h,pt as g,q as _,w as v,y}from"./router-COwpqexM.js";import{r as b,t as x}from"./_plugin-vue_export-helper-BkT4A29V.js";import{t as S}from"./Button-zECKCotA.js";import{t as C}from"./Input-DxJk6pT-.js";import{t as w}from"./Tag-DWc4lbAm.js";import{t as T}from"./use-message-g8F4Z57w.js";import{t as E}from"./Spin-lybeIDeX.js";import{t as D}from"./Switch-mgeu-lpD.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./SettingRow-CLLFxWP3.js";var P={class:`platform-info`},F=[`innerHTML`],I={class:`platform-name`},L={key:0,class:`platform-card-body`},R=x(p({__name:`PlatformCard`,props:{name:{},icon:{},config:{},credentials:{}},setup(s){let c=s,l=d(!0),{t:u}=b(),p=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:h([`platform-card`,{configured:p.value}])},[v(`div`,{class:`platform-card-header`,onClick:c[0]||=e=>l.value=!l.value},[v(`div`,P,[v(`span`,{class:`platform-icon`,innerHTML:s.icon},null,8,F),v(`span`,I,f(s.name),1),e(g(w),{type:p.value?`success`:`default`,size:`small`,round:``},{default:o(()=>[m(f(p.value?g(u)(`common.configured`):g(u)(`common.notConfigured`)),1)]),_:1},8,[`type`])]),v(`span`,{class:h([`expand-icon`,{expanded:l.value}])},`▾`,2)]),l.value?(i(),n(`div`,L,[a(t.$slots,`default`,{},void 0,!0)])):r(``,!0)],2))}}),[[`__scopeId`,`data-v-07636e04`]]),z={class:`settings-section`},B={class:`weixin-qr-section`},V={key:1,class:`weixin-qr-loading`},H={key:2,class:`weixin-qr-hint`},U=x(p({__name:`PlatformSettings`,setup(t){let a=A(),c=T(),{t:p}=b();async function h(e,t){try{await a.saveSection(e,t),c.success(p(`settings.saved`))}catch{c.error(p(`settings.saveFailed`))}}let x=d(!1);async function w(e,t){x.value=!0;try{await O(e,t),await a.fetchSettings(),c.success(p(`settings.saved`))}catch{c.error(p(`settings.saveFailed`))}finally{x.value=!1}}function E(e){return a.platforms[e]||{}}let P=d(``),F=d(``),I=d(`idle`),L=null;async function U(){I.value=`loading`,P.value=``,F.value=``,G();try{let e=await M();F.value=e.qrcode,P.value=e.qrcode_url,window.open(e.qrcode_url,`_blank`),I.value=`waiting`,W()}catch(e){I.value=`error`,c.error(e.message||p(`platform.qrFetching`))}}function W(){F.value&&(L=setTimeout(async()=>{try{let e=await k(F.value);e.status===`wait`?W():e.status===`scaned`?(I.value=`scaned`,W()):e.status===`expired`?I.value=`expired`:e.status===`confirmed`&&(I.value=`confirmed`,await j({account_id:e.account_id,token:e.token,base_url:e.base_url}),await a.fetchSettings(),c.success(p(`settings.saved`)))}catch{W()}},3e3))}function G(){L&&=(clearTimeout(L),null)}l(()=>{G()});let K=[{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)=>{let l=u(`NSpin`);return i(),n(`section`,z,[(i(),n(y,null,_(K,t=>e(R,{key:t.key,name:t.name,icon:t.icon,config:g(a)[t.key],credentials:E(t.key)},{default:o(()=>[t.key===`telegram`?(i(),n(y,{key:0},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`telegram`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`123456:ABC-DEF...`,"onUpdate:value":c[0]||=e=>w(`telegram`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).telegram.require_mention,"onUpdate:value":c[1]||=e=>h(`telegram`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.reactions`),hint:g(p)(`platform.reactionsHint`)},{default:o(()=>[e(g(D),{value:g(a).telegram.reactions,"onUpdate:value":c[2]||=e=>h(`telegram`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).telegram.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[3]||=e=>h(`telegram`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.mentionPatterns`),hint:g(p)(`platform.mentionPatternsHint`)},{default:o(()=>[e(g(C),{value:(g(a).telegram.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[4]||=e=>h(`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(y,{key:1},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`discord`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot token...`,"onUpdate:value":c[5]||=e=>w(`discord`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionChannel`)},{default:o(()=>[e(g(D),{value:g(a).discord.require_mention,"onUpdate:value":c[6]||=e=>h(`discord`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.autoThread`),hint:g(p)(`platform.autoThreadHint`)},{default:o(()=>[e(g(D),{value:g(a).discord.auto_thread,"onUpdate:value":c[7]||=e=>h(`discord`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.reactions`),hint:g(p)(`platform.reactionsHint`)},{default:o(()=>[e(g(D),{value:g(a).discord.reactions,"onUpdate:value":c[8]||=e=>h(`discord`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChannels`),hint:g(p)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[9]||=e=>h(`discord`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.allowedChannels`),hint:g(p)(`platform.allowedChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.allowed_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[10]||=e=>h(`discord`,{allowed_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.ignoredChannels`),hint:g(p)(`platform.ignoredChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.ignored_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[11]||=e=>h(`discord`,{ignored_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.noThreadChannels`),hint:g(p)(`platform.noThreadChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.no_thread_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[12]||=e=>h(`discord`,{no_thread_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`slack`?(i(),n(y,{key:2},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`slack`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`xoxb-...`,"onUpdate:value":c[13]||=e=>w(`slack`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionChannel`)},{default:o(()=>[e(g(D),{value:g(a).slack.require_mention,"onUpdate:value":c[14]||=e=>h(`slack`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.allowBots`),hint:g(p)(`platform.allowBotsHint`)},{default:o(()=>[e(g(D),{value:g(a).slack.allow_bots,"onUpdate:value":c[15]||=e=>h(`slack`,{allow_bots:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChannels`),hint:g(p)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).slack.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[16]||=e=>h(`slack`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`whatsapp`?(i(),n(y,{key:3},[e(N,{label:g(p)(`platform.waEnabled`),hint:g(p)(`platform.waEnabledHint`)},{default:o(()=>[e(g(D),{value:E(`whatsapp`).enabled,"onUpdate:value":c[17]||=e=>w(`whatsapp`,{enabled:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).whatsapp.require_mention,"onUpdate:value":c[18]||=e=>h(`whatsapp`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).whatsapp.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[19]||=e=>h(`whatsapp`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.mentionPatterns`),hint:g(p)(`platform.mentionPatternsHint`)},{default:o(()=>[e(g(C),{value:(g(a).whatsapp.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[20]||=e=>h(`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(y,{key:4},[e(N,{label:g(p)(`platform.accessToken`),hint:g(p)(`platform.accessTokenHint`)},{default:o(()=>[e(g(C),{value:E(`matrix`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`syt_...`,"onUpdate:value":c[21]||=e=>w(`matrix`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.homeserver`),hint:g(p)(`platform.homeserverHint`)},{default:o(()=>[e(g(C),{value:E(`matrix`).extra?.homeserver||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`https://matrix.org`,"onUpdate:value":c[22]||=e=>w(`matrix`,{extra:{...E(`matrix`).extra,homeserver:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionRoom`)},{default:o(()=>[e(g(D),{value:g(a).matrix.require_mention,"onUpdate:value":c[23]||=e=>h(`matrix`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.autoThread`),hint:g(p)(`platform.autoThreadHintRoom`)},{default:o(()=>[e(g(D),{value:g(a).matrix.auto_thread,"onUpdate:value":c[24]||=e=>h(`matrix`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.dmMentionThreads`),hint:g(p)(`platform.dmMentionThreadsHint`)},{default:o(()=>[e(g(D),{value:g(a).matrix.dm_mention_threads,"onUpdate:value":c[25]||=e=>h(`matrix`,{dm_mention_threads:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseRooms`),hint:g(p)(`platform.freeResponseRoomsHint`)},{default:o(()=>[e(g(C),{value:g(a).matrix.free_response_rooms||``,size:`small`,placeholder:`room_id1,room_id2`,"onUpdate:value":c[26]||=e=>h(`matrix`,{free_response_rooms:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`feishu`?(i(),n(y,{key:5},[e(N,{label:g(p)(`platform.appId`),hint:g(p)(`platform.appIdHint`)},{default:o(()=>[e(g(C),{value:E(`feishu`).extra?.app_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`cli_...`,"onUpdate:value":c[27]||=e=>w(`feishu`,{extra:{...E(`feishu`).extra,app_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.appSecret`),hint:g(p)(`platform.appSecretHint`)},{default:o(()=>[e(g(C),{value:E(`feishu`).extra?.app_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`App Secret`,"onUpdate:value":c[28]||=e=>w(`feishu`,{extra:{...E(`feishu`).extra,app_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).feishu.require_mention,"onUpdate:value":c[29]||=e=>h(`feishu`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).feishu.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[30]||=e=>h(`feishu`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`dingtalk`?(i(),n(y,{key:6},[e(N,{label:g(p)(`platform.clientId`),hint:g(p)(`platform.clientIdHint`)},{default:o(()=>[e(g(C),{value:E(`dingtalk`).extra?.client_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client ID`,"onUpdate:value":c[31]||=e=>w(`dingtalk`,{extra:{...E(`dingtalk`).extra,client_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.clientSecret`),hint:g(p)(`platform.clientSecretHint`)},{default:o(()=>[e(g(C),{value:E(`dingtalk`).extra?.client_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client Secret`,"onUpdate:value":c[32]||=e=>w(`dingtalk`,{extra:{...E(`dingtalk`).extra,client_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).dingtalk.require_mention,"onUpdate:value":c[33]||=e=>h(`dingtalk`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).dingtalk.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[34]||=e=>h(`dingtalk`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`weixin`?(i(),n(y,{key:7},[v(`div`,B,[I.value===`idle`||I.value===`error`||I.value===`expired`||I.value===`confirmed`?(i(),s(g(S),{key:0,type:`primary`,size:`small`,onClick:U},{default:o(()=>[m(f(I.value===`confirmed`?g(p)(`platform.qrRelogin`):g(p)(`platform.qrLogin`)),1)]),_:1})):r(``,!0),I.value===`loading`?(i(),n(`div`,V,[e(l,{size:`small`}),v(`span`,null,f(g(p)(`platform.qrFetching`)),1)])):r(``,!0),I.value===`waiting`||I.value===`scaned`?(i(),n(`div`,H,f(I.value===`scaned`?g(p)(`platform.qrScanedHint`):g(p)(`platform.qrScanHint`)),1)):r(``,!0)]),e(N,{label:g(p)(`platform.weixinToken`),hint:g(p)(`platform.weixinTokenHint`)},{default:o(()=>[e(g(C),{value:E(`weixin`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Token`,"onUpdate:value":c[35]||=e=>w(`weixin`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.accountId`),hint:g(p)(`platform.accountIdHint`)},{default:o(()=>[e(g(C),{value:E(`weixin`).extra?.account_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Account ID`,"onUpdate:value":c[36]||=e=>w(`weixin`,{extra:{...E(`weixin`).extra,account_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`wecom`?(i(),n(y,{key:8},[e(N,{label:g(p)(`platform.botId`),hint:g(p)(`platform.botIdHint`)},{default:o(()=>[e(g(C),{value:E(`wecom`).extra?.bot_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot ID`,"onUpdate:value":c[37]||=e=>w(`wecom`,{extra:{...E(`wecom`).extra,bot_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.appSecret`),hint:g(p)(`platform.wecomSecretHint`)},{default:o(()=>[e(g(C),{value:E(`wecom`).extra?.secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Secret`,"onUpdate:value":c[38]||=e=>w(`wecom`,{extra:{...E(`wecom`).extra,secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0)]),_:2},1032,[`name`,`icon`,`config`,`credentials`])),64))])}}}),[[`__scopeId`,`data-v-89b6c2e1`]]),W={class:`channels-view`},G={class:`page-header`},K={class:`header-title`},q={class:`channels-content`},J=x(p({__name:`ChannelsView`,setup(t){let r=A(),{t:a}=b();return c(()=>{r.fetchSettings()}),(t,s)=>(i(),n(`div`,W,[v(`header`,G,[v(`h2`,K,f(g(a)(`sidebar.channels`)),1)]),v(`div`,q,[e(g(E),{show:g(r).loading||g(r).saving,size:`large`,description:g(a)(`common.loading`)},{default:o(()=>[e(U)]),_:1},8,[`show`,`description`])])]))}}),[[`__scopeId`,`data-v-51c1ea7b`]]);export{J as default};
|