@fefeding/aicmd 1.0.11 → 1.0.13
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/dist/public/index.js +76 -0
- package/dist/public/views.css +282 -56
- package/dist/public/views.js +1013 -337
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +39 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.ts +40 -0
- package/dist/server/service/connection.service.d.ts +1 -0
- package/dist/server/service/connection.service.d.ts.map +1 -1
- package/dist/server/service/connection.service.js +43 -3
- package/dist/server/service/connection.service.js.map +1 -1
- package/dist/server/service/connection.service.ts +42 -3
- package/dist/server/service/ssh.service.d.ts +77 -1
- package/dist/server/service/ssh.service.d.ts.map +1 -1
- package/dist/server/service/ssh.service.js +484 -32
- package/dist/server/service/ssh.service.js.map +1 -1
- package/dist/server/service/ssh.service.ts +507 -32
- package/electron/main.js +48 -0
- package/electron/preload.js +6 -0
- package/package.json +1 -1
- package/server.js +49 -0
package/dist/public/views.js
CHANGED
|
@@ -159,7 +159,7 @@ var init_modal = __esmMin((() => {
|
|
|
159
159
|
/**
|
|
160
160
|
* 解包 API 响应
|
|
161
161
|
*/
|
|
162
|
-
function unwrap$
|
|
162
|
+
function unwrap$5(res) {
|
|
163
163
|
if (res && typeof res === "object" && "ret" in res) {
|
|
164
164
|
if (res.ret !== 0) throw new Error(res.msg || "请求失败");
|
|
165
165
|
return res.data;
|
|
@@ -167,16 +167,16 @@ function unwrap$4(res) {
|
|
|
167
167
|
return res;
|
|
168
168
|
}
|
|
169
169
|
function getSessions() {
|
|
170
|
-
return request("/api/terminal/getSessions", {}).then(unwrap$
|
|
170
|
+
return request("/api/terminal/getSessions", {}).then(unwrap$5);
|
|
171
171
|
}
|
|
172
172
|
function renameSession(sessionId, name) {
|
|
173
173
|
return request("/api/terminal/renameSession", {
|
|
174
174
|
sessionId,
|
|
175
175
|
name
|
|
176
|
-
}).then(unwrap$
|
|
176
|
+
}).then(unwrap$5);
|
|
177
177
|
}
|
|
178
178
|
function deleteSession(sessionId) {
|
|
179
|
-
return request("/api/terminal/deleteSession", { sessionId }).then(unwrap$
|
|
179
|
+
return request("/api/terminal/deleteSession", { sessionId }).then(unwrap$5);
|
|
180
180
|
}
|
|
181
181
|
var init_terminal$1 = __esmMin((() => {
|
|
182
182
|
init_base();
|
|
@@ -361,51 +361,51 @@ var init_terminal = __esmMin((() => {
|
|
|
361
361
|
}));
|
|
362
362
|
//#endregion
|
|
363
363
|
//#region src/components/terminal-sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
364
|
-
var _hoisted_1$
|
|
364
|
+
var _hoisted_1$10, _hoisted_2$10, _hoisted_3$10, _hoisted_4$10, _hoisted_5$10, _hoisted_6$10, _hoisted_7$9, _hoisted_8$9, _hoisted_9$9, _hoisted_10$9, _hoisted_11$9, _hoisted_12$9, _hoisted_13$9, _hoisted_14$9, _hoisted_15$9, _hoisted_16$9, _hoisted_17$8, _hoisted_18$8, _hoisted_19$8, _hoisted_20$8, _hoisted_21$7, _hoisted_22$7, _hoisted_23$7, _hoisted_24$7, terminal_sidebar_vue_vue_type_script_setup_true_lang_default;
|
|
365
365
|
var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
366
366
|
init_vue_runtime_esm_bundler();
|
|
367
367
|
init_vue_i18n();
|
|
368
368
|
init_i18n();
|
|
369
|
-
_hoisted_1$
|
|
369
|
+
_hoisted_1$10 = {
|
|
370
370
|
class: "d-flex align-items-center justify-content-between p-2 border-bottom",
|
|
371
371
|
style: { "border-color": "var(--border-color) !important" }
|
|
372
372
|
};
|
|
373
|
-
_hoisted_2$
|
|
374
|
-
_hoisted_3$
|
|
375
|
-
_hoisted_4$
|
|
376
|
-
_hoisted_5$
|
|
377
|
-
_hoisted_6$
|
|
378
|
-
_hoisted_7$
|
|
379
|
-
_hoisted_8$
|
|
380
|
-
_hoisted_9$
|
|
373
|
+
_hoisted_2$10 = { class: "d-flex gap-1" };
|
|
374
|
+
_hoisted_3$10 = ["title"];
|
|
375
|
+
_hoisted_4$10 = ["title"];
|
|
376
|
+
_hoisted_5$10 = ["title"];
|
|
377
|
+
_hoisted_6$10 = { class: "p-2" };
|
|
378
|
+
_hoisted_7$9 = ["placeholder"];
|
|
379
|
+
_hoisted_8$9 = { class: "flex-grow-1 overflow-auto" };
|
|
380
|
+
_hoisted_9$9 = {
|
|
381
381
|
key: 0,
|
|
382
382
|
class: "text-center p-4",
|
|
383
383
|
style: { "color": "var(--text-secondary)" }
|
|
384
384
|
};
|
|
385
|
-
_hoisted_10$
|
|
385
|
+
_hoisted_10$9 = {
|
|
386
386
|
key: 1,
|
|
387
387
|
class: "text-center p-4",
|
|
388
388
|
style: { "color": "var(--text-secondary)" }
|
|
389
389
|
};
|
|
390
|
-
_hoisted_11$
|
|
391
|
-
_hoisted_12$
|
|
392
|
-
_hoisted_13$
|
|
393
|
-
_hoisted_14$
|
|
394
|
-
_hoisted_15$
|
|
390
|
+
_hoisted_11$9 = { class: "mt-2" };
|
|
391
|
+
_hoisted_12$9 = { key: 2 };
|
|
392
|
+
_hoisted_13$9 = ["onDblclick", "onContextmenu"];
|
|
393
|
+
_hoisted_14$9 = { class: "flex-grow-1 overflow-hidden" };
|
|
394
|
+
_hoisted_15$9 = {
|
|
395
395
|
class: "text-truncate",
|
|
396
396
|
style: { "font-size": "13px" }
|
|
397
397
|
};
|
|
398
|
-
_hoisted_16$
|
|
398
|
+
_hoisted_16$9 = {
|
|
399
399
|
class: "text-truncate",
|
|
400
400
|
style: {
|
|
401
401
|
"font-size": "11px",
|
|
402
402
|
"color": "var(--text-secondary)"
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
|
-
_hoisted_17$
|
|
406
|
-
_hoisted_18$
|
|
407
|
-
_hoisted_19$
|
|
408
|
-
_hoisted_20$
|
|
405
|
+
_hoisted_17$8 = ["onClick", "title"];
|
|
406
|
+
_hoisted_18$8 = ["onClick", "title"];
|
|
407
|
+
_hoisted_19$8 = ["onClick", "title"];
|
|
408
|
+
_hoisted_20$8 = {
|
|
409
409
|
class: "p-2 text-center d-flex align-items-center justify-content-between",
|
|
410
410
|
style: {
|
|
411
411
|
"font-size": "11px",
|
|
@@ -413,10 +413,10 @@ var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
413
413
|
"border-top": "1px solid var(--border-color)"
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
|
-
_hoisted_21$
|
|
417
|
-
_hoisted_22$
|
|
418
|
-
_hoisted_23$
|
|
419
|
-
_hoisted_24$
|
|
416
|
+
_hoisted_21$7 = { class: "d-flex gap-1 align-items-center" };
|
|
417
|
+
_hoisted_22$7 = ["title"];
|
|
418
|
+
_hoisted_23$7 = ["title"];
|
|
419
|
+
_hoisted_24$7 = ["title"];
|
|
420
420
|
terminal_sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
421
421
|
__name: "terminal-sidebar",
|
|
422
422
|
props: {
|
|
@@ -454,27 +454,27 @@ var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
454
454
|
class: "sidebar d-flex flex-column",
|
|
455
455
|
style: normalizeStyle({ width: __props.collapsed ? "0px" : "var(--sidebar-width)" })
|
|
456
456
|
}, [
|
|
457
|
-
createBaseVNode("div", _hoisted_1$
|
|
457
|
+
createBaseVNode("div", _hoisted_1$10, [_cache[11] || (_cache[11] = createBaseVNode("span", {
|
|
458
458
|
class: "fw-bold",
|
|
459
459
|
style: { "color": "var(--accent)" }
|
|
460
|
-
}, [createBaseVNode("i", { class: "bi bi-terminal me-1" }), createTextVNode("aicmd ")], -1)), createBaseVNode("div", _hoisted_2$
|
|
460
|
+
}, [createBaseVNode("i", { class: "bi bi-terminal me-1" }), createTextVNode("aicmd ")], -1)), createBaseVNode("div", _hoisted_2$10, [
|
|
461
461
|
createBaseVNode("button", {
|
|
462
462
|
class: "btn-toolbar",
|
|
463
463
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("add-connection")),
|
|
464
464
|
title: unref(t)("app.addConnection")
|
|
465
|
-
}, [..._cache[8] || (_cache[8] = [createBaseVNode("i", { class: "bi bi-plus-lg" }, null, -1)])], 8, _hoisted_3$
|
|
465
|
+
}, [..._cache[8] || (_cache[8] = [createBaseVNode("i", { class: "bi bi-plus-lg" }, null, -1)])], 8, _hoisted_3$10),
|
|
466
466
|
createBaseVNode("button", {
|
|
467
467
|
class: "btn-toolbar",
|
|
468
468
|
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("refresh")),
|
|
469
469
|
title: unref(t)("common.refresh")
|
|
470
|
-
}, [..._cache[9] || (_cache[9] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_4$
|
|
470
|
+
}, [..._cache[9] || (_cache[9] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_4$10),
|
|
471
471
|
createBaseVNode("button", {
|
|
472
472
|
class: "btn-toolbar",
|
|
473
473
|
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("toggle-sidebar")),
|
|
474
474
|
title: unref(t)("sidebar.collapse")
|
|
475
|
-
}, [..._cache[10] || (_cache[10] = [createBaseVNode("i", { class: "bi bi-chevron-left" }, null, -1)])], 8, _hoisted_5$
|
|
475
|
+
}, [..._cache[10] || (_cache[10] = [createBaseVNode("i", { class: "bi bi-chevron-left" }, null, -1)])], 8, _hoisted_5$10)
|
|
476
476
|
])]),
|
|
477
|
-
createBaseVNode("div", _hoisted_6$
|
|
477
|
+
createBaseVNode("div", _hoisted_6$10, [withDirectives(createBaseVNode("input", {
|
|
478
478
|
type: "text",
|
|
479
479
|
class: "form-control form-control-sm",
|
|
480
480
|
placeholder: unref(t)("sidebar.searchPlaceholder"),
|
|
@@ -484,18 +484,18 @@ var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
484
484
|
"border-color": "#45475a",
|
|
485
485
|
"color": "var(--text-primary)"
|
|
486
486
|
}
|
|
487
|
-
}, null, 8, _hoisted_7$
|
|
488
|
-
createBaseVNode("div", _hoisted_8$
|
|
487
|
+
}, null, 8, _hoisted_7$9), [[vModelText, searchQuery.value]])]),
|
|
488
|
+
createBaseVNode("div", _hoisted_8$9, [__props.loading ? (openBlock(), createElementBlock("div", _hoisted_9$9, [_cache[12] || (_cache[12] = createBaseVNode("div", { class: "spinner-border spinner-border-sm me-2" }, null, -1)), createTextVNode(toDisplayString(unref(t)("common.loading")), 1)])) : filteredConnections.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10$9, [
|
|
489
489
|
_cache[14] || (_cache[14] = createBaseVNode("i", {
|
|
490
490
|
class: "bi bi-inbox",
|
|
491
491
|
style: { "font-size": "24px" }
|
|
492
492
|
}, null, -1)),
|
|
493
|
-
createBaseVNode("div", _hoisted_11$
|
|
493
|
+
createBaseVNode("div", _hoisted_11$9, toDisplayString(unref(t)("sidebar.noConnections")), 1),
|
|
494
494
|
createBaseVNode("button", {
|
|
495
495
|
class: "btn btn-sm btn-outline-primary mt-2",
|
|
496
496
|
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("add-connection"))
|
|
497
497
|
}, [_cache[13] || (_cache[13] = createBaseVNode("i", { class: "bi bi-plus me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("sidebar.addConnection")), 1)])
|
|
498
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_12$
|
|
498
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_12$9, [(openBlock(true), createElementBlock(Fragment, null, renderList(filteredConnections.value, (conn) => {
|
|
499
499
|
return openBlock(), createElementBlock("div", {
|
|
500
500
|
key: conn.id,
|
|
501
501
|
class: "connection-item",
|
|
@@ -506,7 +506,7 @@ var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
506
506
|
class: normalizeClass(conn.type === "local" ? "bi bi-terminal" : "bi bi-hdd-network"),
|
|
507
507
|
style: { "color": "var(--accent)" }
|
|
508
508
|
}, null, 2),
|
|
509
|
-
createBaseVNode("div", _hoisted_14$
|
|
509
|
+
createBaseVNode("div", _hoisted_14$9, [createBaseVNode("div", _hoisted_15$9, toDisplayString(conn.name), 1), createBaseVNode("div", _hoisted_16$9, toDisplayString(conn.type === "local" ? unref(t)("app.localShell") : `${conn.username}@${conn.host}:${conn.port}`), 1)]),
|
|
510
510
|
createBaseVNode("div", {
|
|
511
511
|
class: "d-flex gap-1",
|
|
512
512
|
onClick: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
|
|
@@ -515,36 +515,36 @@ var init_terminal_sidebar_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
515
515
|
class: "btn-conn",
|
|
516
516
|
onClick: ($event) => _ctx.$emit("connect", conn),
|
|
517
517
|
title: unref(t)("sidebar.connect")
|
|
518
|
-
}, [..._cache[15] || (_cache[15] = [createBaseVNode("i", { class: "bi bi-play-fill" }, null, -1)])], 8, _hoisted_17$
|
|
518
|
+
}, [..._cache[15] || (_cache[15] = [createBaseVNode("i", { class: "bi bi-play-fill" }, null, -1)])], 8, _hoisted_17$8),
|
|
519
519
|
createBaseVNode("button", {
|
|
520
520
|
class: "btn-conn",
|
|
521
521
|
onClick: ($event) => _ctx.$emit("edit-connection", conn),
|
|
522
522
|
title: unref(t)("common.edit")
|
|
523
|
-
}, [..._cache[16] || (_cache[16] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8, _hoisted_18$
|
|
523
|
+
}, [..._cache[16] || (_cache[16] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8, _hoisted_18$8),
|
|
524
524
|
createBaseVNode("button", {
|
|
525
525
|
class: "btn-conn btn-conn-danger",
|
|
526
526
|
onClick: ($event) => _ctx.$emit("delete-connection", conn),
|
|
527
527
|
title: unref(t)("common.delete")
|
|
528
|
-
}, [..._cache[17] || (_cache[17] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_19$
|
|
528
|
+
}, [..._cache[17] || (_cache[17] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_19$8)
|
|
529
529
|
])
|
|
530
|
-
], 40, _hoisted_13$
|
|
530
|
+
], 40, _hoisted_13$9);
|
|
531
531
|
}), 128))]))]),
|
|
532
|
-
createBaseVNode("div", _hoisted_20$
|
|
532
|
+
createBaseVNode("div", _hoisted_20$8, [createBaseVNode("span", null, toDisplayString(__props.connections.length) + " " + toDisplayString(unref(t)("sidebar.connectionCount")), 1), createBaseVNode("div", _hoisted_21$7, [
|
|
533
533
|
createBaseVNode("button", {
|
|
534
534
|
class: "btn-ai-settings",
|
|
535
535
|
onClick: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("open-ai-settings")),
|
|
536
536
|
title: unref(t)("ai.settings")
|
|
537
|
-
}, [..._cache[18] || (_cache[18] = [createBaseVNode("i", { class: "bi bi-robot" }, null, -1)])], 8, _hoisted_22$
|
|
537
|
+
}, [..._cache[18] || (_cache[18] = [createBaseVNode("i", { class: "bi bi-robot" }, null, -1)])], 8, _hoisted_22$7),
|
|
538
538
|
createBaseVNode("button", {
|
|
539
539
|
class: "btn-ai-settings",
|
|
540
540
|
onClick: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("open-batch")),
|
|
541
541
|
title: unref(t)("batch.title")
|
|
542
|
-
}, [..._cache[19] || (_cache[19] = [createBaseVNode("i", { class: "bi bi-hdd-rack" }, null, -1)])], 8, _hoisted_23$
|
|
542
|
+
}, [..._cache[19] || (_cache[19] = [createBaseVNode("i", { class: "bi bi-hdd-rack" }, null, -1)])], 8, _hoisted_23$7),
|
|
543
543
|
createBaseVNode("button", {
|
|
544
544
|
class: "btn-lang-switch",
|
|
545
545
|
onClick: toggleLocale,
|
|
546
546
|
title: currentLocale.value === "zh-CN" ? "Switch to English" : "切换到中文"
|
|
547
|
-
}, toDisplayString(currentLocale.value === "zh-CN" ? "EN" : "中"), 9, _hoisted_24$
|
|
547
|
+
}, toDisplayString(currentLocale.value === "zh-CN" ? "EN" : "中"), 9, _hoisted_24$7)
|
|
548
548
|
])])
|
|
549
549
|
], 4);
|
|
550
550
|
};
|
|
@@ -3286,7 +3286,7 @@ var init_zmodem = __esmMin((() => {
|
|
|
3286
3286
|
* base.request 返回 {ret, msg, data},此函数提取 data 字段
|
|
3287
3287
|
* 若 ret !== 0 则抛出异常
|
|
3288
3288
|
*/
|
|
3289
|
-
function unwrap$
|
|
3289
|
+
function unwrap$4(res) {
|
|
3290
3290
|
if (res && typeof res === "object" && "ret" in res) {
|
|
3291
3291
|
if (res.ret !== 0) throw new Error(res.msg || "请求失败");
|
|
3292
3292
|
return res.data;
|
|
@@ -3294,42 +3294,42 @@ function unwrap$3(res) {
|
|
|
3294
3294
|
return res;
|
|
3295
3295
|
}
|
|
3296
3296
|
function getAIConfig() {
|
|
3297
|
-
return request("/api/ai/getConfig", {}).then(unwrap$
|
|
3297
|
+
return request("/api/ai/getConfig", {}).then(unwrap$4);
|
|
3298
3298
|
}
|
|
3299
3299
|
function updateAIConfig(config) {
|
|
3300
|
-
return request("/api/ai/updateConfig", config).then(unwrap$
|
|
3300
|
+
return request("/api/ai/updateConfig", config).then(unwrap$4);
|
|
3301
3301
|
}
|
|
3302
3302
|
function clearHistory(sessionId) {
|
|
3303
|
-
return request("/api/ai/clearHistory", { sessionId }).then(unwrap$
|
|
3303
|
+
return request("/api/ai/clearHistory", { sessionId }).then(unwrap$4);
|
|
3304
3304
|
}
|
|
3305
3305
|
function getDisplayHistory(sessionId) {
|
|
3306
|
-
return request("/api/ai/getDisplayHistory", { sessionId }).then(unwrap$
|
|
3306
|
+
return request("/api/ai/getDisplayHistory", { sessionId }).then(unwrap$4);
|
|
3307
3307
|
}
|
|
3308
3308
|
function saveDisplayHistory(sessionId, messages, sessionName) {
|
|
3309
3309
|
return request("/api/ai/saveDisplayHistory", {
|
|
3310
3310
|
sessionId,
|
|
3311
3311
|
messages,
|
|
3312
3312
|
sessionName
|
|
3313
|
-
}).then(unwrap$
|
|
3313
|
+
}).then(unwrap$4);
|
|
3314
3314
|
}
|
|
3315
3315
|
function listHistories() {
|
|
3316
|
-
return request("/api/ai/listHistories", {}).then(unwrap$
|
|
3316
|
+
return request("/api/ai/listHistories", {}).then(unwrap$4);
|
|
3317
3317
|
}
|
|
3318
3318
|
function loadHistory(sessionId) {
|
|
3319
|
-
return request("/api/ai/loadHistory", { sessionId }).then(unwrap$
|
|
3319
|
+
return request("/api/ai/loadHistory", { sessionId }).then(unwrap$4);
|
|
3320
3320
|
}
|
|
3321
3321
|
function getSystemContext(sessionId) {
|
|
3322
|
-
return request("/api/ai/getSystemContext", { sessionId }).then(unwrap$
|
|
3322
|
+
return request("/api/ai/getSystemContext", { sessionId }).then(unwrap$4);
|
|
3323
3323
|
}
|
|
3324
3324
|
function getSkills() {
|
|
3325
|
-
return request("/api/ai/getSkills", {}).then(unwrap$
|
|
3325
|
+
return request("/api/ai/getSkills", {}).then(unwrap$4);
|
|
3326
3326
|
}
|
|
3327
3327
|
var init_ai = __esmMin((() => {
|
|
3328
3328
|
init_base();
|
|
3329
3329
|
}));
|
|
3330
3330
|
//#endregion
|
|
3331
3331
|
//#region src/service/audit.ts
|
|
3332
|
-
function unwrap$
|
|
3332
|
+
function unwrap$3(res) {
|
|
3333
3333
|
if (res && typeof res === "object" && "ret" in res) {
|
|
3334
3334
|
if (res.ret !== 0) throw new Error(res.msg || "请求失败");
|
|
3335
3335
|
return res.data;
|
|
@@ -3337,17 +3337,17 @@ function unwrap$2(res) {
|
|
|
3337
3337
|
return res;
|
|
3338
3338
|
}
|
|
3339
3339
|
function getAuditLogs(query = {}) {
|
|
3340
|
-
return request("/api/audit/list", query).then(unwrap$
|
|
3340
|
+
return request("/api/audit/list", query).then(unwrap$3);
|
|
3341
3341
|
}
|
|
3342
3342
|
function getAuditStats(date) {
|
|
3343
|
-
return request("/api/audit/stats", { date }).then(unwrap$
|
|
3343
|
+
return request("/api/audit/stats", { date }).then(unwrap$3);
|
|
3344
3344
|
}
|
|
3345
3345
|
function exportAuditLogs(startDate, endDate, format = "json") {
|
|
3346
3346
|
return request("/api/audit/export", {
|
|
3347
3347
|
startDate,
|
|
3348
3348
|
endDate,
|
|
3349
3349
|
format
|
|
3350
|
-
}).then(unwrap$
|
|
3350
|
+
}).then(unwrap$3);
|
|
3351
3351
|
}
|
|
3352
3352
|
var init_audit = __esmMin((() => {
|
|
3353
3353
|
init_base();
|
|
@@ -3393,69 +3393,69 @@ async function copy(text) {
|
|
|
3393
3393
|
var init_clipboard = __esmMin((() => {}));
|
|
3394
3394
|
//#endregion
|
|
3395
3395
|
//#region src/components/audit-panel/index.vue?vue&type=script&setup=true&lang.ts
|
|
3396
|
-
var _hoisted_1$
|
|
3396
|
+
var _hoisted_1$9, _hoisted_2$9, _hoisted_3$9, _hoisted_4$9, _hoisted_5$9, _hoisted_6$9, _hoisted_7$8, _hoisted_8$8, _hoisted_9$8, _hoisted_10$8, _hoisted_11$8, _hoisted_12$8, _hoisted_13$8, _hoisted_14$8, _hoisted_15$8, _hoisted_16$8, _hoisted_17$7, _hoisted_18$7, _hoisted_19$7, _hoisted_20$7, _hoisted_21$6, _hoisted_22$6, _hoisted_23$6, _hoisted_24$6, _hoisted_25$6, _hoisted_26$5, _hoisted_27$5, _hoisted_28$5, _hoisted_29$5, _hoisted_30$5, _hoisted_31$4, _hoisted_32$3, _hoisted_33$3, _hoisted_34$3, _hoisted_35$3, _hoisted_36$3, _hoisted_37$3, _hoisted_38$3, _hoisted_39$3, _hoisted_40$2, _hoisted_41$2, index_vue_vue_type_script_setup_true_lang_default$6;
|
|
3397
3397
|
var init_index_vue_vue_type_script_setup_true_lang$6 = __esmMin((() => {
|
|
3398
3398
|
init_vue_runtime_esm_bundler();
|
|
3399
3399
|
init_vue_i18n();
|
|
3400
3400
|
init_audit();
|
|
3401
3401
|
init_clipboard();
|
|
3402
|
-
_hoisted_1$
|
|
3403
|
-
_hoisted_2$
|
|
3404
|
-
_hoisted_3$
|
|
3405
|
-
_hoisted_4$
|
|
3402
|
+
_hoisted_1$9 = { class: "audit-panel" };
|
|
3403
|
+
_hoisted_2$9 = { class: "audit-header" };
|
|
3404
|
+
_hoisted_3$9 = { class: "audit-header-left" };
|
|
3405
|
+
_hoisted_4$9 = {
|
|
3406
3406
|
key: 0,
|
|
3407
3407
|
class: "audit-badge"
|
|
3408
3408
|
};
|
|
3409
|
-
_hoisted_5$
|
|
3410
|
-
_hoisted_6$
|
|
3411
|
-
_hoisted_7$
|
|
3412
|
-
_hoisted_8$
|
|
3413
|
-
_hoisted_9$
|
|
3414
|
-
_hoisted_10$
|
|
3415
|
-
_hoisted_11$
|
|
3416
|
-
_hoisted_12$
|
|
3417
|
-
_hoisted_13$
|
|
3418
|
-
_hoisted_14$
|
|
3409
|
+
_hoisted_5$9 = { class: "audit-header-right" };
|
|
3410
|
+
_hoisted_6$9 = ["title"];
|
|
3411
|
+
_hoisted_7$8 = ["title"];
|
|
3412
|
+
_hoisted_8$8 = { class: "audit-filters" };
|
|
3413
|
+
_hoisted_9$8 = ["placeholder"];
|
|
3414
|
+
_hoisted_10$8 = { value: "" };
|
|
3415
|
+
_hoisted_11$8 = { value: "success" };
|
|
3416
|
+
_hoisted_12$8 = { value: "error" };
|
|
3417
|
+
_hoisted_13$8 = { value: "blocked" };
|
|
3418
|
+
_hoisted_14$8 = {
|
|
3419
3419
|
key: 0,
|
|
3420
3420
|
class: "audit-stats"
|
|
3421
3421
|
};
|
|
3422
|
-
_hoisted_15$
|
|
3423
|
-
_hoisted_16$
|
|
3424
|
-
_hoisted_17$
|
|
3425
|
-
_hoisted_18$
|
|
3422
|
+
_hoisted_15$8 = { class: "stat-item stat-total" };
|
|
3423
|
+
_hoisted_16$8 = { class: "stat-item stat-success" };
|
|
3424
|
+
_hoisted_17$7 = { class: "stat-item stat-error" };
|
|
3425
|
+
_hoisted_18$7 = {
|
|
3426
3426
|
key: 0,
|
|
3427
3427
|
class: "stat-item stat-blocked"
|
|
3428
3428
|
};
|
|
3429
|
-
_hoisted_19$
|
|
3429
|
+
_hoisted_19$7 = {
|
|
3430
3430
|
key: 0,
|
|
3431
3431
|
class: "audit-empty"
|
|
3432
3432
|
};
|
|
3433
|
-
_hoisted_20$
|
|
3433
|
+
_hoisted_20$7 = {
|
|
3434
3434
|
key: 1,
|
|
3435
3435
|
class: "audit-empty"
|
|
3436
3436
|
};
|
|
3437
|
-
_hoisted_21$
|
|
3438
|
-
_hoisted_22$
|
|
3439
|
-
_hoisted_23$
|
|
3440
|
-
_hoisted_24$
|
|
3441
|
-
_hoisted_25$
|
|
3442
|
-
_hoisted_26$
|
|
3443
|
-
_hoisted_27$
|
|
3444
|
-
_hoisted_28$
|
|
3437
|
+
_hoisted_21$6 = ["onClick"];
|
|
3438
|
+
_hoisted_22$6 = { class: "entry-header" };
|
|
3439
|
+
_hoisted_23$6 = { class: "entry-status" };
|
|
3440
|
+
_hoisted_24$6 = { class: "entry-command" };
|
|
3441
|
+
_hoisted_25$6 = { class: "entry-meta" };
|
|
3442
|
+
_hoisted_26$5 = { class: "entry-duration" };
|
|
3443
|
+
_hoisted_27$5 = { class: "entry-time" };
|
|
3444
|
+
_hoisted_28$5 = {
|
|
3445
3445
|
key: 0,
|
|
3446
3446
|
class: "entry-detail"
|
|
3447
3447
|
};
|
|
3448
|
-
_hoisted_29$
|
|
3449
|
-
_hoisted_30$
|
|
3450
|
-
_hoisted_31$
|
|
3451
|
-
_hoisted_32$
|
|
3452
|
-
_hoisted_33$
|
|
3453
|
-
_hoisted_34$
|
|
3454
|
-
_hoisted_35$
|
|
3455
|
-
_hoisted_36$
|
|
3456
|
-
_hoisted_37$
|
|
3457
|
-
_hoisted_38$
|
|
3458
|
-
_hoisted_39$
|
|
3448
|
+
_hoisted_29$5 = { class: "detail-row" };
|
|
3449
|
+
_hoisted_30$5 = { class: "detail-label" };
|
|
3450
|
+
_hoisted_31$4 = { class: "detail-row" };
|
|
3451
|
+
_hoisted_32$3 = { class: "detail-label" };
|
|
3452
|
+
_hoisted_33$3 = { class: "detail-row" };
|
|
3453
|
+
_hoisted_34$3 = { class: "detail-label" };
|
|
3454
|
+
_hoisted_35$3 = { class: "detail-code" };
|
|
3455
|
+
_hoisted_36$3 = { class: "detail-row" };
|
|
3456
|
+
_hoisted_37$3 = { class: "detail-label" };
|
|
3457
|
+
_hoisted_38$3 = { class: "detail-code" };
|
|
3458
|
+
_hoisted_39$3 = { class: "detail-actions" };
|
|
3459
3459
|
_hoisted_40$2 = ["onClick"];
|
|
3460
3460
|
_hoisted_41$2 = ["onClick"];
|
|
3461
3461
|
index_vue_vue_type_script_setup_true_lang_default$6 = /* @__PURE__ */ defineComponent({
|
|
@@ -3555,21 +3555,21 @@ var init_index_vue_vue_type_script_setup_true_lang$6 = __esmMin((() => {
|
|
|
3555
3555
|
refresh
|
|
3556
3556
|
});
|
|
3557
3557
|
return (_ctx, _cache) => {
|
|
3558
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3559
|
-
createBaseVNode("div", _hoisted_2$
|
|
3558
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
3559
|
+
createBaseVNode("div", _hoisted_2$9, [createBaseVNode("div", _hoisted_3$9, [
|
|
3560
3560
|
_cache[3] || (_cache[3] = createBaseVNode("i", { class: "bi bi-shield-check me-1" }, null, -1)),
|
|
3561
3561
|
createBaseVNode("span", null, toDisplayString(unref(t)("audit.title")), 1),
|
|
3562
|
-
stats.value ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
3563
|
-
]), createBaseVNode("div", _hoisted_5$
|
|
3562
|
+
stats.value ? (openBlock(), createElementBlock("span", _hoisted_4$9, toDisplayString(stats.value.today) + " " + toDisplayString(unref(t)("audit.today")), 1)) : createCommentVNode("", true)
|
|
3563
|
+
]), createBaseVNode("div", _hoisted_5$9, [createBaseVNode("button", {
|
|
3564
3564
|
class: "btn-audit",
|
|
3565
3565
|
onClick: refresh,
|
|
3566
3566
|
title: unref(t)("common.refresh")
|
|
3567
|
-
}, [..._cache[4] || (_cache[4] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_6$
|
|
3567
|
+
}, [..._cache[4] || (_cache[4] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_6$9), createBaseVNode("button", {
|
|
3568
3568
|
class: "btn-audit",
|
|
3569
3569
|
onClick: handleExport,
|
|
3570
3570
|
title: unref(t)("audit.export")
|
|
3571
|
-
}, [..._cache[5] || (_cache[5] = [createBaseVNode("i", { class: "bi bi-download" }, null, -1)])], 8, _hoisted_7$
|
|
3572
|
-
createBaseVNode("div", _hoisted_8$
|
|
3571
|
+
}, [..._cache[5] || (_cache[5] = [createBaseVNode("i", { class: "bi bi-download" }, null, -1)])], 8, _hoisted_7$8)])]),
|
|
3572
|
+
createBaseVNode("div", _hoisted_8$8, [
|
|
3573
3573
|
withDirectives(createBaseVNode("input", {
|
|
3574
3574
|
type: "date",
|
|
3575
3575
|
class: "filter-input",
|
|
@@ -3582,50 +3582,50 @@ var init_index_vue_vue_type_script_setup_true_lang$6 = __esmMin((() => {
|
|
|
3582
3582
|
placeholder: unref(t)("audit.searchPlaceholder"),
|
|
3583
3583
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => keyword.value = $event),
|
|
3584
3584
|
onInput: debouncedLoad
|
|
3585
|
-
}, null, 40, _hoisted_9$
|
|
3585
|
+
}, null, 40, _hoisted_9$8), [[vModelText, keyword.value]]),
|
|
3586
3586
|
withDirectives(createBaseVNode("select", {
|
|
3587
3587
|
class: "filter-input",
|
|
3588
3588
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => statusFilter.value = $event),
|
|
3589
3589
|
onChange: loadLogs
|
|
3590
3590
|
}, [
|
|
3591
|
-
createBaseVNode("option", _hoisted_10$
|
|
3592
|
-
createBaseVNode("option", _hoisted_11$
|
|
3593
|
-
createBaseVNode("option", _hoisted_12$
|
|
3594
|
-
createBaseVNode("option", _hoisted_13$
|
|
3591
|
+
createBaseVNode("option", _hoisted_10$8, toDisplayString(unref(t)("audit.allStatus")), 1),
|
|
3592
|
+
createBaseVNode("option", _hoisted_11$8, toDisplayString(unref(t)("audit.success")), 1),
|
|
3593
|
+
createBaseVNode("option", _hoisted_12$8, toDisplayString(unref(t)("audit.error")), 1),
|
|
3594
|
+
createBaseVNode("option", _hoisted_13$8, toDisplayString(unref(t)("audit.blocked")), 1)
|
|
3595
3595
|
], 544), [[vModelSelect, statusFilter.value]])
|
|
3596
3596
|
]),
|
|
3597
|
-
stats.value ? (openBlock(), createElementBlock("div", _hoisted_14$
|
|
3598
|
-
createBaseVNode("span", _hoisted_15$
|
|
3599
|
-
createBaseVNode("span", _hoisted_16$
|
|
3600
|
-
createBaseVNode("span", _hoisted_17$
|
|
3601
|
-
stats.value.blocked ? (openBlock(), createElementBlock("span", _hoisted_18$
|
|
3597
|
+
stats.value ? (openBlock(), createElementBlock("div", _hoisted_14$8, [
|
|
3598
|
+
createBaseVNode("span", _hoisted_15$8, toDisplayString(stats.value.total) + " " + toDisplayString(unref(t)("audit.total")), 1),
|
|
3599
|
+
createBaseVNode("span", _hoisted_16$8, [createTextVNode(toDisplayString(stats.value.success) + " ", 1), _cache[6] || (_cache[6] = createBaseVNode("i", { class: "bi bi-check-circle" }, null, -1))]),
|
|
3600
|
+
createBaseVNode("span", _hoisted_17$7, [createTextVNode(toDisplayString(stats.value.error) + " ", 1), _cache[7] || (_cache[7] = createBaseVNode("i", { class: "bi bi-x-circle" }, null, -1))]),
|
|
3601
|
+
stats.value.blocked ? (openBlock(), createElementBlock("span", _hoisted_18$7, [createTextVNode(toDisplayString(stats.value.blocked) + " ", 1), _cache[8] || (_cache[8] = createBaseVNode("i", { class: "bi bi-shield-x" }, null, -1))])) : createCommentVNode("", true)
|
|
3602
3602
|
])) : createCommentVNode("", true),
|
|
3603
3603
|
createBaseVNode("div", {
|
|
3604
3604
|
class: "audit-list",
|
|
3605
3605
|
ref_key: "listRef",
|
|
3606
3606
|
ref: listRef
|
|
3607
|
-
}, [loading.value ? (openBlock(), createElementBlock("div", _hoisted_19$
|
|
3607
|
+
}, [loading.value ? (openBlock(), createElementBlock("div", _hoisted_19$7, [_cache[9] || (_cache[9] = createBaseVNode("i", { class: "bi bi-hourglass-split" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("common.loading")), 1)])) : entries.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_20$7, [_cache[10] || (_cache[10] = createBaseVNode("i", { class: "bi bi-inbox" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("audit.noLogs")), 1)])) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(entries.value, (entry) => {
|
|
3608
3608
|
return openBlock(), createElementBlock("div", {
|
|
3609
3609
|
key: entry.id,
|
|
3610
3610
|
class: normalizeClass(["audit-entry", "status-" + entry.status]),
|
|
3611
3611
|
onClick: ($event) => toggleExpand(entry.id)
|
|
3612
|
-
}, [createBaseVNode("div", _hoisted_22$
|
|
3613
|
-
createBaseVNode("span", _hoisted_23$
|
|
3614
|
-
createBaseVNode("code", _hoisted_24$
|
|
3615
|
-
createBaseVNode("span", _hoisted_25$
|
|
3616
|
-
]), expandedIds.has(entry.id) ? (openBlock(), createElementBlock("div", _hoisted_28$
|
|
3617
|
-
createBaseVNode("div", _hoisted_29$
|
|
3618
|
-
createBaseVNode("div", _hoisted_31$
|
|
3619
|
-
createBaseVNode("div", _hoisted_33$
|
|
3620
|
-
createBaseVNode("div", _hoisted_36$
|
|
3621
|
-
createBaseVNode("div", _hoisted_39$
|
|
3612
|
+
}, [createBaseVNode("div", _hoisted_22$6, [
|
|
3613
|
+
createBaseVNode("span", _hoisted_23$6, [createBaseVNode("i", { class: normalizeClass(statusIcon(entry.status)) }, null, 2)]),
|
|
3614
|
+
createBaseVNode("code", _hoisted_24$6, toDisplayString(entry.command || entry.tool), 1),
|
|
3615
|
+
createBaseVNode("span", _hoisted_25$6, [createBaseVNode("span", _hoisted_26$5, toDisplayString(formatDuration(entry.duration)), 1), createBaseVNode("span", _hoisted_27$5, toDisplayString(formatTime(entry.timestamp)), 1)])
|
|
3616
|
+
]), expandedIds.has(entry.id) ? (openBlock(), createElementBlock("div", _hoisted_28$5, [
|
|
3617
|
+
createBaseVNode("div", _hoisted_29$5, [createBaseVNode("span", _hoisted_30$5, toDisplayString(unref(t)("audit.session")) + ":", 1), createBaseVNode("span", null, toDisplayString(entry.sessionName || entry.sessionId), 1)]),
|
|
3618
|
+
createBaseVNode("div", _hoisted_31$4, [createBaseVNode("span", _hoisted_32$3, toDisplayString(unref(t)("audit.userRequest")) + ":", 1), createBaseVNode("span", null, toDisplayString(entry.userMessage), 1)]),
|
|
3619
|
+
createBaseVNode("div", _hoisted_33$3, [createBaseVNode("span", _hoisted_34$3, toDisplayString(unref(t)("audit.command")) + ":", 1), createBaseVNode("pre", _hoisted_35$3, toDisplayString(entry.command), 1)]),
|
|
3620
|
+
createBaseVNode("div", _hoisted_36$3, [createBaseVNode("span", _hoisted_37$3, toDisplayString(unref(t)("audit.result")) + ":", 1), createBaseVNode("pre", _hoisted_38$3, toDisplayString(entry.result), 1)]),
|
|
3621
|
+
createBaseVNode("div", _hoisted_39$3, [createBaseVNode("button", {
|
|
3622
3622
|
class: "btn-copy",
|
|
3623
3623
|
onClick: withModifiers(($event) => copyText(entry.command), ["stop"])
|
|
3624
3624
|
}, [_cache[11] || (_cache[11] = createBaseVNode("i", { class: "bi bi-clipboard" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("audit.copyCommand")), 1)], 8, _hoisted_40$2), createBaseVNode("button", {
|
|
3625
3625
|
class: "btn-copy",
|
|
3626
3626
|
onClick: withModifiers(($event) => copyText(entry.result), ["stop"])
|
|
3627
3627
|
}, [_cache[12] || (_cache[12] = createBaseVNode("i", { class: "bi bi-clipboard" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("audit.copyResult")), 1)], 8, _hoisted_41$2)])
|
|
3628
|
-
])) : createCommentVNode("", true)], 10, _hoisted_21$
|
|
3628
|
+
])) : createCommentVNode("", true)], 10, _hoisted_21$6);
|
|
3629
3629
|
}), 128))], 512)
|
|
3630
3630
|
]);
|
|
3631
3631
|
};
|
|
@@ -3647,7 +3647,7 @@ var init_audit_panel = __esmMin((() => {
|
|
|
3647
3647
|
}));
|
|
3648
3648
|
//#endregion
|
|
3649
3649
|
//#region src/service/monitor.ts
|
|
3650
|
-
function unwrap$
|
|
3650
|
+
function unwrap$2(res) {
|
|
3651
3651
|
if (res && typeof res === "object" && "ret" in res) {
|
|
3652
3652
|
if (res.ret !== 0) throw new Error(res.msg || "请求失败");
|
|
3653
3653
|
return res.data;
|
|
@@ -3660,13 +3660,13 @@ function startMonitor(sessionId, connectionId, logPath, pattern) {
|
|
|
3660
3660
|
connectionId,
|
|
3661
3661
|
logPath,
|
|
3662
3662
|
pattern
|
|
3663
|
-
}).then(unwrap$
|
|
3663
|
+
}).then(unwrap$2);
|
|
3664
3664
|
}
|
|
3665
3665
|
function stopMonitor(monitorId) {
|
|
3666
|
-
return request("/api/monitor/stop", { monitorId }).then(unwrap$
|
|
3666
|
+
return request("/api/monitor/stop", { monitorId }).then(unwrap$2);
|
|
3667
3667
|
}
|
|
3668
3668
|
function getMonitorBatch(monitorId) {
|
|
3669
|
-
return request("/api/monitor/analyze", { monitorId }).then(unwrap$
|
|
3669
|
+
return request("/api/monitor/analyze", { monitorId }).then(unwrap$2);
|
|
3670
3670
|
}
|
|
3671
3671
|
var init_monitor = __esmMin((() => {
|
|
3672
3672
|
init_base();
|
|
@@ -3756,48 +3756,48 @@ var init_sanitize_html = __esmMin((() => {
|
|
|
3756
3756
|
}));
|
|
3757
3757
|
//#endregion
|
|
3758
3758
|
//#region src/components/log-monitor/index.vue?vue&type=script&setup=true&lang.ts
|
|
3759
|
-
var _hoisted_1$
|
|
3759
|
+
var _hoisted_1$8, _hoisted_2$8, _hoisted_3$8, _hoisted_4$8, _hoisted_5$8, _hoisted_6$8, _hoisted_7$7, _hoisted_8$7, _hoisted_9$7, _hoisted_10$7, _hoisted_11$7, _hoisted_12$7, _hoisted_13$7, _hoisted_14$7, _hoisted_15$7, _hoisted_16$7, _hoisted_17$6, _hoisted_18$6, _hoisted_19$6, _hoisted_20$6, index_vue_vue_type_script_setup_true_lang_default$5;
|
|
3760
3760
|
var init_index_vue_vue_type_script_setup_true_lang$5 = __esmMin((() => {
|
|
3761
3761
|
init_vue_runtime_esm_bundler();
|
|
3762
3762
|
init_vue_i18n();
|
|
3763
3763
|
init_monitor();
|
|
3764
3764
|
init_ai();
|
|
3765
3765
|
init_sanitize_html();
|
|
3766
|
-
_hoisted_1$
|
|
3767
|
-
_hoisted_2$
|
|
3768
|
-
_hoisted_3$
|
|
3769
|
-
_hoisted_4$
|
|
3770
|
-
_hoisted_5$
|
|
3771
|
-
_hoisted_6$
|
|
3766
|
+
_hoisted_1$8 = { class: "monitor-panel" };
|
|
3767
|
+
_hoisted_2$8 = { class: "monitor-controls" };
|
|
3768
|
+
_hoisted_3$8 = ["placeholder", "disabled"];
|
|
3769
|
+
_hoisted_4$8 = ["disabled"];
|
|
3770
|
+
_hoisted_5$8 = ["disabled", "title"];
|
|
3771
|
+
_hoisted_6$8 = {
|
|
3772
3772
|
key: 0,
|
|
3773
3773
|
class: "monitor-status"
|
|
3774
3774
|
};
|
|
3775
|
-
_hoisted_7$
|
|
3776
|
-
_hoisted_8$
|
|
3775
|
+
_hoisted_7$7 = { class: "status-stats" };
|
|
3776
|
+
_hoisted_8$7 = {
|
|
3777
3777
|
key: 1,
|
|
3778
3778
|
class: "monitor-alerts"
|
|
3779
3779
|
};
|
|
3780
|
-
_hoisted_9$
|
|
3781
|
-
_hoisted_10$
|
|
3780
|
+
_hoisted_9$7 = ["title"];
|
|
3781
|
+
_hoisted_10$7 = {
|
|
3782
3782
|
key: 0,
|
|
3783
3783
|
class: "alerts-list"
|
|
3784
3784
|
};
|
|
3785
|
-
_hoisted_11$
|
|
3786
|
-
_hoisted_12$
|
|
3787
|
-
_hoisted_13$
|
|
3788
|
-
_hoisted_14$
|
|
3789
|
-
_hoisted_15$
|
|
3785
|
+
_hoisted_11$7 = { class: "alert-header" };
|
|
3786
|
+
_hoisted_12$7 = { class: "alert-level" };
|
|
3787
|
+
_hoisted_13$7 = { class: "alert-time" };
|
|
3788
|
+
_hoisted_14$7 = { class: "alert-message" };
|
|
3789
|
+
_hoisted_15$7 = {
|
|
3790
3790
|
key: 0,
|
|
3791
3791
|
class: "alert-analysis"
|
|
3792
3792
|
};
|
|
3793
|
-
_hoisted_16$
|
|
3794
|
-
_hoisted_17$
|
|
3793
|
+
_hoisted_16$7 = ["innerHTML"];
|
|
3794
|
+
_hoisted_17$6 = {
|
|
3795
3795
|
key: 2,
|
|
3796
3796
|
class: "monitor-analysis"
|
|
3797
3797
|
};
|
|
3798
|
-
_hoisted_18$
|
|
3799
|
-
_hoisted_19$
|
|
3800
|
-
_hoisted_20$
|
|
3798
|
+
_hoisted_18$6 = { class: "analysis-header" };
|
|
3799
|
+
_hoisted_19$6 = ["innerHTML"];
|
|
3800
|
+
_hoisted_20$6 = {
|
|
3801
3801
|
key: 0,
|
|
3802
3802
|
class: "monitor-empty"
|
|
3803
3803
|
};
|
|
@@ -3938,34 +3938,34 @@ var init_index_vue_vue_type_script_setup_true_lang$5 = __esmMin((() => {
|
|
|
3938
3938
|
stopMonitoring
|
|
3939
3939
|
});
|
|
3940
3940
|
return (_ctx, _cache) => {
|
|
3941
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3942
|
-
createBaseVNode("div", _hoisted_2$
|
|
3941
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
3942
|
+
createBaseVNode("div", _hoisted_2$8, [
|
|
3943
3943
|
withDirectives(createBaseVNode("input", {
|
|
3944
3944
|
type: "text",
|
|
3945
3945
|
class: "monitor-input",
|
|
3946
3946
|
placeholder: unref(t)("monitor.logPathPlaceholder"),
|
|
3947
3947
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => logPath.value = $event),
|
|
3948
3948
|
disabled: isMonitoring.value
|
|
3949
|
-
}, null, 8, _hoisted_3$
|
|
3949
|
+
}, null, 8, _hoisted_3$8), [[vModelText, logPath.value]]),
|
|
3950
3950
|
createBaseVNode("button", {
|
|
3951
3951
|
class: normalizeClass(["btn-monitor", { active: isMonitoring.value }]),
|
|
3952
3952
|
onClick: toggleMonitor,
|
|
3953
3953
|
disabled: !logPath.value.trim() && !isMonitoring.value
|
|
3954
|
-
}, [createBaseVNode("i", { class: normalizeClass(isMonitoring.value ? "bi bi-stop-fill" : "bi bi-play-fill") }, null, 2), createTextVNode(" " + toDisplayString(isMonitoring.value ? unref(t)("monitor.stop") : unref(t)("monitor.start")), 1)], 10, _hoisted_4$
|
|
3954
|
+
}, [createBaseVNode("i", { class: normalizeClass(isMonitoring.value ? "bi bi-stop-fill" : "bi bi-play-fill") }, null, 2), createTextVNode(" " + toDisplayString(isMonitoring.value ? unref(t)("monitor.stop") : unref(t)("monitor.start")), 1)], 10, _hoisted_4$8),
|
|
3955
3955
|
isMonitoring.value ? (openBlock(), createElementBlock("button", {
|
|
3956
3956
|
key: 0,
|
|
3957
3957
|
class: "btn-monitor btn-analyze",
|
|
3958
3958
|
onClick: triggerAIAnalysis,
|
|
3959
3959
|
disabled: analyzing.value,
|
|
3960
3960
|
title: unref(t)("monitor.aiAnalyze")
|
|
3961
|
-
}, [_cache[4] || (_cache[4] = createBaseVNode("i", { class: "bi bi-robot" }, null, -1)), createTextVNode(" " + toDisplayString(analyzing.value ? unref(t)("monitor.analyzing") : unref(t)("monitor.aiAnalyze")), 1)], 8, _hoisted_5$
|
|
3961
|
+
}, [_cache[4] || (_cache[4] = createBaseVNode("i", { class: "bi bi-robot" }, null, -1)), createTextVNode(" " + toDisplayString(analyzing.value ? unref(t)("monitor.analyzing") : unref(t)("monitor.aiAnalyze")), 1)], 8, _hoisted_5$8)) : createCommentVNode("", true)
|
|
3962
3962
|
]),
|
|
3963
|
-
isMonitoring.value ? (openBlock(), createElementBlock("div", _hoisted_6$
|
|
3963
|
+
isMonitoring.value ? (openBlock(), createElementBlock("div", _hoisted_6$8, [
|
|
3964
3964
|
_cache[5] || (_cache[5] = createBaseVNode("span", { class: "status-indicator active" }, null, -1)),
|
|
3965
3965
|
createBaseVNode("span", null, toDisplayString(unref(t)("monitor.monitoring")) + ": " + toDisplayString(logPath.value), 1),
|
|
3966
|
-
createBaseVNode("span", _hoisted_7$
|
|
3966
|
+
createBaseVNode("span", _hoisted_7$7, toDisplayString(lineCount.value) + " " + toDisplayString(unref(t)("monitor.lines")) + " · " + toDisplayString(alerts.value.length) + " " + toDisplayString(unref(t)("monitor.alerts")), 1)
|
|
3967
3967
|
])) : createCommentVNode("", true),
|
|
3968
|
-
alerts.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
3968
|
+
alerts.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_8$7, [createBaseVNode("div", {
|
|
3969
3969
|
class: "alerts-header",
|
|
3970
3970
|
onClick: _cache[2] || (_cache[2] = ($event) => showAlerts.value = !showAlerts.value)
|
|
3971
3971
|
}, [
|
|
@@ -3976,18 +3976,18 @@ var init_index_vue_vue_type_script_setup_true_lang$5 = __esmMin((() => {
|
|
|
3976
3976
|
class: "btn-clear-alerts",
|
|
3977
3977
|
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => alerts.value = [], ["stop"])),
|
|
3978
3978
|
title: unref(t)("monitor.clearAlerts")
|
|
3979
|
-
}, [..._cache[6] || (_cache[6] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])], 8, _hoisted_9$
|
|
3980
|
-
]), showAlerts.value ? (openBlock(), createElementBlock("div", _hoisted_10$
|
|
3979
|
+
}, [..._cache[6] || (_cache[6] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])], 8, _hoisted_9$7)
|
|
3980
|
+
]), showAlerts.value ? (openBlock(), createElementBlock("div", _hoisted_10$7, [(openBlock(true), createElementBlock(Fragment, null, renderList(alerts.value.slice(-20).reverse(), (alert) => {
|
|
3981
3981
|
return openBlock(), createElementBlock("div", {
|
|
3982
3982
|
key: alert.id,
|
|
3983
3983
|
class: normalizeClass(["alert-item", "level-" + alert.level])
|
|
3984
3984
|
}, [
|
|
3985
|
-
createBaseVNode("div", _hoisted_11$
|
|
3986
|
-
createBaseVNode("div", _hoisted_14$
|
|
3987
|
-
alert.aiAnalysis ? (openBlock(), createElementBlock("div", _hoisted_15$
|
|
3985
|
+
createBaseVNode("div", _hoisted_11$7, [createBaseVNode("span", _hoisted_12$7, toDisplayString(alert.level.toUpperCase()), 1), createBaseVNode("span", _hoisted_13$7, toDisplayString(formatTime(alert.timestamp)), 1)]),
|
|
3986
|
+
createBaseVNode("div", _hoisted_14$7, toDisplayString(alert.message), 1),
|
|
3987
|
+
alert.aiAnalysis ? (openBlock(), createElementBlock("div", _hoisted_15$7, [_cache[8] || (_cache[8] = createBaseVNode("i", { class: "bi bi-robot" }, null, -1)), createBaseVNode("span", { innerHTML: renderSimpleMarkdown(alert.aiAnalysis) }, null, 8, _hoisted_16$7)])) : createCommentVNode("", true)
|
|
3988
3988
|
], 2);
|
|
3989
3989
|
}), 128))])) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
3990
|
-
aiAnalysisResult.value ? (openBlock(), createElementBlock("div", _hoisted_17$
|
|
3990
|
+
aiAnalysisResult.value ? (openBlock(), createElementBlock("div", _hoisted_17$6, [createBaseVNode("div", _hoisted_18$6, [
|
|
3991
3991
|
_cache[10] || (_cache[10] = createBaseVNode("i", { class: "bi bi-robot" }, null, -1)),
|
|
3992
3992
|
createBaseVNode("span", null, toDisplayString(unref(t)("monitor.aiAnalysisResult")), 1),
|
|
3993
3993
|
createBaseVNode("button", {
|
|
@@ -3997,12 +3997,12 @@ var init_index_vue_vue_type_script_setup_true_lang$5 = __esmMin((() => {
|
|
|
3997
3997
|
]), createBaseVNode("div", {
|
|
3998
3998
|
class: "analysis-content",
|
|
3999
3999
|
innerHTML: renderSimpleMarkdown(aiAnalysisResult.value)
|
|
4000
|
-
}, null, 8, _hoisted_19$
|
|
4000
|
+
}, null, 8, _hoisted_19$6)])) : createCommentVNode("", true),
|
|
4001
4001
|
createBaseVNode("div", {
|
|
4002
4002
|
class: "monitor-output",
|
|
4003
4003
|
ref_key: "outputRef",
|
|
4004
4004
|
ref: outputRef
|
|
4005
|
-
}, [lines.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_20$
|
|
4005
|
+
}, [lines.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_20$6, [_cache[11] || (_cache[11] = createBaseVNode("i", { class: "bi bi-terminal" }, null, -1)), createBaseVNode("span", null, toDisplayString(isMonitoring.value ? unref(t)("monitor.waitingForLogs") : unref(t)("monitor.notStarted")), 1)])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(displayLines.value, (line, idx) => {
|
|
4006
4006
|
return openBlock(), createElementBlock("div", {
|
|
4007
4007
|
key: idx,
|
|
4008
4008
|
class: normalizeClass(["log-line", getLineClass(line)])
|
|
@@ -4028,7 +4028,7 @@ var init_log_monitor = __esmMin((() => {
|
|
|
4028
4028
|
}));
|
|
4029
4029
|
//#endregion
|
|
4030
4030
|
//#region src/components/ai-chat/index.vue?vue&type=script&setup=true&lang.ts
|
|
4031
|
-
var _hoisted_1$
|
|
4031
|
+
var _hoisted_1$7, _hoisted_2$7, _hoisted_3$7, _hoisted_4$7, _hoisted_5$7, _hoisted_6$7, _hoisted_7$6, _hoisted_8$6, _hoisted_9$6, _hoisted_10$6, _hoisted_11$6, _hoisted_12$6, _hoisted_13$6, _hoisted_14$6, _hoisted_15$6, _hoisted_16$6, _hoisted_17$5, _hoisted_18$5, _hoisted_19$5, _hoisted_20$5, _hoisted_21$5, _hoisted_22$5, _hoisted_23$5, _hoisted_24$5, _hoisted_25$5, _hoisted_26$4, _hoisted_27$4, _hoisted_28$4, _hoisted_29$4, _hoisted_30$4, _hoisted_31$3, _hoisted_32$2, _hoisted_33$2, _hoisted_34$2, _hoisted_35$2, _hoisted_36$2, _hoisted_37$2, _hoisted_38$2, _hoisted_39$2, _hoisted_40$1, _hoisted_41$1, _hoisted_42$1, _hoisted_43$1, _hoisted_44$1, _hoisted_45$1, _hoisted_46$1, _hoisted_47$1, _hoisted_48$1, index_vue_vue_type_script_setup_true_lang_default$4;
|
|
4032
4032
|
var init_index_vue_vue_type_script_setup_true_lang$4 = __esmMin((() => {
|
|
4033
4033
|
init_vue_runtime_esm_bundler();
|
|
4034
4034
|
init_vue_i18n();
|
|
@@ -4036,78 +4036,78 @@ var init_index_vue_vue_type_script_setup_true_lang$4 = __esmMin((() => {
|
|
|
4036
4036
|
init_audit_panel();
|
|
4037
4037
|
init_log_monitor();
|
|
4038
4038
|
init_sanitize_html();
|
|
4039
|
-
_hoisted_1$
|
|
4040
|
-
_hoisted_2$
|
|
4041
|
-
_hoisted_3$
|
|
4042
|
-
_hoisted_4$
|
|
4043
|
-
_hoisted_5$
|
|
4044
|
-
_hoisted_6$
|
|
4045
|
-
_hoisted_7$
|
|
4046
|
-
_hoisted_8$
|
|
4047
|
-
_hoisted_9$
|
|
4048
|
-
_hoisted_10$
|
|
4039
|
+
_hoisted_1$7 = { class: "ai-chat-header" };
|
|
4040
|
+
_hoisted_2$7 = { class: "d-flex align-items-center gap-2" };
|
|
4041
|
+
_hoisted_3$7 = { class: "ai-tab-bar" };
|
|
4042
|
+
_hoisted_4$7 = { class: "d-flex gap-1" };
|
|
4043
|
+
_hoisted_5$7 = ["title"];
|
|
4044
|
+
_hoisted_6$7 = ["title"];
|
|
4045
|
+
_hoisted_7$6 = ["title"];
|
|
4046
|
+
_hoisted_8$6 = ["title"];
|
|
4047
|
+
_hoisted_9$6 = ["title"];
|
|
4048
|
+
_hoisted_10$6 = {
|
|
4049
4049
|
key: 0,
|
|
4050
4050
|
class: "ai-chat-empty"
|
|
4051
4051
|
};
|
|
4052
|
-
_hoisted_11$
|
|
4053
|
-
_hoisted_12$
|
|
4054
|
-
_hoisted_13$
|
|
4052
|
+
_hoisted_11$6 = { class: "ai-message-avatar" };
|
|
4053
|
+
_hoisted_12$6 = { class: "ai-message-content" };
|
|
4054
|
+
_hoisted_13$6 = {
|
|
4055
4055
|
key: 0,
|
|
4056
4056
|
class: "skill-badge"
|
|
4057
4057
|
};
|
|
4058
|
-
_hoisted_14$
|
|
4058
|
+
_hoisted_14$6 = {
|
|
4059
4059
|
key: 1,
|
|
4060
4060
|
class: "agent-steps"
|
|
4061
4061
|
};
|
|
4062
|
-
_hoisted_15$
|
|
4062
|
+
_hoisted_15$6 = {
|
|
4063
4063
|
key: 0,
|
|
4064
4064
|
class: "agent-step thinking-step"
|
|
4065
4065
|
};
|
|
4066
|
-
_hoisted_16$
|
|
4067
|
-
_hoisted_17$
|
|
4066
|
+
_hoisted_16$6 = { class: "step-label" };
|
|
4067
|
+
_hoisted_17$5 = {
|
|
4068
4068
|
key: 1,
|
|
4069
4069
|
class: "agent-step tool-call-step"
|
|
4070
4070
|
};
|
|
4071
|
-
_hoisted_18$
|
|
4072
|
-
_hoisted_19$
|
|
4073
|
-
_hoisted_20$
|
|
4071
|
+
_hoisted_18$5 = ["onClick"];
|
|
4072
|
+
_hoisted_19$5 = { class: "step-cmd" };
|
|
4073
|
+
_hoisted_20$5 = {
|
|
4074
4074
|
key: 0,
|
|
4075
4075
|
class: "step-result"
|
|
4076
4076
|
};
|
|
4077
|
-
_hoisted_21$
|
|
4078
|
-
_hoisted_22$
|
|
4077
|
+
_hoisted_21$5 = ["innerHTML"];
|
|
4078
|
+
_hoisted_22$5 = {
|
|
4079
4079
|
key: 0,
|
|
4080
4080
|
class: "skills-panel"
|
|
4081
4081
|
};
|
|
4082
|
-
_hoisted_23$
|
|
4083
|
-
_hoisted_24$
|
|
4084
|
-
_hoisted_25$
|
|
4085
|
-
_hoisted_26$
|
|
4086
|
-
_hoisted_27$
|
|
4087
|
-
_hoisted_28$
|
|
4082
|
+
_hoisted_23$5 = { class: "skills-panel-header" };
|
|
4083
|
+
_hoisted_24$5 = { class: "skills-grid" };
|
|
4084
|
+
_hoisted_25$5 = ["onClick"];
|
|
4085
|
+
_hoisted_26$4 = { class: "skill-item-header" };
|
|
4086
|
+
_hoisted_27$4 = { class: "skill-name" };
|
|
4087
|
+
_hoisted_28$4 = {
|
|
4088
4088
|
key: 0,
|
|
4089
4089
|
class: "skill-source"
|
|
4090
4090
|
};
|
|
4091
|
-
_hoisted_29$
|
|
4091
|
+
_hoisted_29$4 = {
|
|
4092
4092
|
key: 0,
|
|
4093
4093
|
class: "skill-desc"
|
|
4094
4094
|
};
|
|
4095
|
-
_hoisted_30$
|
|
4095
|
+
_hoisted_30$4 = {
|
|
4096
4096
|
key: 0,
|
|
4097
4097
|
class: "skills-empty"
|
|
4098
4098
|
};
|
|
4099
|
-
_hoisted_31$
|
|
4099
|
+
_hoisted_31$3 = {
|
|
4100
4100
|
key: 1,
|
|
4101
4101
|
class: "history-panel"
|
|
4102
4102
|
};
|
|
4103
|
-
_hoisted_32$
|
|
4104
|
-
_hoisted_33$
|
|
4105
|
-
_hoisted_34$
|
|
4106
|
-
_hoisted_35$
|
|
4107
|
-
_hoisted_36$
|
|
4108
|
-
_hoisted_37$
|
|
4109
|
-
_hoisted_38$
|
|
4110
|
-
_hoisted_39$
|
|
4103
|
+
_hoisted_32$2 = { class: "history-panel-header" };
|
|
4104
|
+
_hoisted_33$2 = { class: "history-list" };
|
|
4105
|
+
_hoisted_34$2 = ["onClick"];
|
|
4106
|
+
_hoisted_35$2 = { class: "history-item-top" };
|
|
4107
|
+
_hoisted_36$2 = { class: "history-name" };
|
|
4108
|
+
_hoisted_37$2 = { class: "history-time" };
|
|
4109
|
+
_hoisted_38$2 = { class: "history-preview" };
|
|
4110
|
+
_hoisted_39$2 = { class: "history-meta" };
|
|
4111
4111
|
_hoisted_40$1 = {
|
|
4112
4112
|
key: 0,
|
|
4113
4113
|
class: "history-empty"
|
|
@@ -4498,44 +4498,44 @@ var init_index_vue_vue_type_script_setup_true_lang$4 = __esmMin((() => {
|
|
|
4498
4498
|
});
|
|
4499
4499
|
return (_ctx, _cache) => {
|
|
4500
4500
|
return openBlock(), createElementBlock("div", { class: normalizeClass(["ai-chat-panel", { collapsed: !__props.isOpen }]) }, [
|
|
4501
|
-
createBaseVNode("div", _hoisted_1$
|
|
4501
|
+
createBaseVNode("div", _hoisted_1$7, [createBaseVNode("div", _hoisted_2$7, [createBaseVNode("div", _hoisted_3$7, [createBaseVNode("button", {
|
|
4502
4502
|
class: normalizeClass(["ai-tab", { active: activeTab.value === "chat" }]),
|
|
4503
4503
|
onClick: _cache[0] || (_cache[0] = ($event) => activeTab.value = "chat")
|
|
4504
4504
|
}, [_cache[6] || (_cache[6] = createBaseVNode("i", { class: "bi bi-robot" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("ai.chat")), 1)], 2), createBaseVNode("button", {
|
|
4505
4505
|
class: normalizeClass(["ai-tab", { active: activeTab.value === "audit" }]),
|
|
4506
4506
|
onClick: _cache[1] || (_cache[1] = ($event) => activeTab.value = "audit")
|
|
4507
|
-
}, [_cache[7] || (_cache[7] = createBaseVNode("i", { class: "bi bi-shield-check" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("audit.title")), 1)], 2)])]), createBaseVNode("div", _hoisted_4$
|
|
4507
|
+
}, [_cache[7] || (_cache[7] = createBaseVNode("i", { class: "bi bi-shield-check" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("audit.title")), 1)], 2)])]), createBaseVNode("div", _hoisted_4$7, [activeTab.value === "chat" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4508
4508
|
createBaseVNode("button", {
|
|
4509
4509
|
class: "btn-ai-action",
|
|
4510
4510
|
onClick: handleOpenSettings,
|
|
4511
4511
|
title: unref(t)("ai.settings")
|
|
4512
|
-
}, [..._cache[8] || (_cache[8] = [createBaseVNode("i", { class: "bi bi-gear" }, null, -1)])], 8, _hoisted_5$
|
|
4512
|
+
}, [..._cache[8] || (_cache[8] = [createBaseVNode("i", { class: "bi bi-gear" }, null, -1)])], 8, _hoisted_5$7),
|
|
4513
4513
|
createBaseVNode("button", {
|
|
4514
4514
|
class: normalizeClass(["btn-ai-action", { active: showHistoryPanel.value }]),
|
|
4515
4515
|
onClick: toggleHistoryPanel,
|
|
4516
4516
|
title: unref(t)("ai.history")
|
|
4517
|
-
}, [..._cache[9] || (_cache[9] = [createBaseVNode("i", { class: "bi bi-clock-history" }, null, -1)])], 10, _hoisted_6$
|
|
4517
|
+
}, [..._cache[9] || (_cache[9] = [createBaseVNode("i", { class: "bi bi-clock-history" }, null, -1)])], 10, _hoisted_6$7),
|
|
4518
4518
|
isAgentRunning.value ? (openBlock(), createElementBlock("button", {
|
|
4519
4519
|
key: 0,
|
|
4520
4520
|
class: "btn-ai-action btn-stop",
|
|
4521
4521
|
onClick: handleStop,
|
|
4522
4522
|
title: unref(t)("ai.stopAgent")
|
|
4523
|
-
}, [..._cache[10] || (_cache[10] = [createBaseVNode("i", { class: "bi bi-stop-circle" }, null, -1)])], 8, _hoisted_7$
|
|
4523
|
+
}, [..._cache[10] || (_cache[10] = [createBaseVNode("i", { class: "bi bi-stop-circle" }, null, -1)])], 8, _hoisted_7$6)) : createCommentVNode("", true),
|
|
4524
4524
|
createBaseVNode("button", {
|
|
4525
4525
|
class: "btn-ai-action",
|
|
4526
4526
|
onClick: handleClear,
|
|
4527
4527
|
title: unref(t)("ai.clearHistory")
|
|
4528
|
-
}, [..._cache[11] || (_cache[11] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_8$
|
|
4528
|
+
}, [..._cache[11] || (_cache[11] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_8$6)
|
|
4529
4529
|
], 64)) : createCommentVNode("", true), createBaseVNode("button", {
|
|
4530
4530
|
class: "btn-ai-action",
|
|
4531
4531
|
onClick: handleClose,
|
|
4532
4532
|
title: unref(t)("common.close")
|
|
4533
|
-
}, [..._cache[12] || (_cache[12] = [createBaseVNode("i", { class: "bi bi-x-lg" }, null, -1)])], 8, _hoisted_9$
|
|
4533
|
+
}, [..._cache[12] || (_cache[12] = [createBaseVNode("i", { class: "bi bi-x-lg" }, null, -1)])], 8, _hoisted_9$6)])]),
|
|
4534
4534
|
withDirectives(createBaseVNode("div", {
|
|
4535
4535
|
class: "ai-chat-messages",
|
|
4536
4536
|
ref_key: "messagesContainer",
|
|
4537
4537
|
ref: messagesContainer
|
|
4538
|
-
}, [messages.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10$
|
|
4538
|
+
}, [messages.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10$6, [_cache[13] || (_cache[13] = createBaseVNode("i", {
|
|
4539
4539
|
class: "bi bi-robot",
|
|
4540
4540
|
style: {
|
|
4541
4541
|
"font-size": "32px",
|
|
@@ -4545,60 +4545,60 @@ var init_index_vue_vue_type_script_setup_true_lang$4 = __esmMin((() => {
|
|
|
4545
4545
|
return openBlock(), createElementBlock("div", {
|
|
4546
4546
|
key: index,
|
|
4547
4547
|
class: normalizeClass(["ai-message", [msg.role, { "system-info": msg.isSystemInfo }]])
|
|
4548
|
-
}, [createBaseVNode("div", _hoisted_11$
|
|
4549
|
-
msg.skillName ? (openBlock(), createElementBlock("div", _hoisted_13$
|
|
4550
|
-
msg.agentSteps && msg.agentSteps.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_14$
|
|
4551
|
-
return openBlock(), createElementBlock(Fragment, { key: stepIdx }, [step.type === "thinking" ? (openBlock(), createElementBlock("div", _hoisted_15$
|
|
4548
|
+
}, [createBaseVNode("div", _hoisted_11$6, [createBaseVNode("i", { class: normalizeClass(msg.isSystemInfo ? "bi bi-info-circle" : msg.role === "user" ? "bi bi-person" : "bi bi-robot") }, null, 2)]), createBaseVNode("div", _hoisted_12$6, [
|
|
4549
|
+
msg.skillName ? (openBlock(), createElementBlock("div", _hoisted_13$6, [_cache[14] || (_cache[14] = createBaseVNode("i", { class: "bi bi-lightning-charge-fill" }, null, -1)), createBaseVNode("span", null, toDisplayString(msg.skillName), 1)])) : createCommentVNode("", true),
|
|
4550
|
+
msg.agentSteps && msg.agentSteps.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_14$6, [(openBlock(true), createElementBlock(Fragment, null, renderList(msg.agentSteps, (step, stepIdx) => {
|
|
4551
|
+
return openBlock(), createElementBlock(Fragment, { key: stepIdx }, [step.type === "thinking" ? (openBlock(), createElementBlock("div", _hoisted_15$6, [_cache[15] || (_cache[15] = createBaseVNode("div", { class: "ai-loading" }, [
|
|
4552
4552
|
createBaseVNode("span"),
|
|
4553
4553
|
createBaseVNode("span"),
|
|
4554
4554
|
createBaseVNode("span")
|
|
4555
|
-
], -1)), createBaseVNode("span", _hoisted_16$
|
|
4555
|
+
], -1)), createBaseVNode("span", _hoisted_16$6, toDisplayString(unref(t)("ai.agentThinking")), 1)])) : createCommentVNode("", true), step.type === "tool_call" ? (openBlock(), createElementBlock("div", _hoisted_17$5, [createBaseVNode("div", {
|
|
4556
4556
|
class: "step-header",
|
|
4557
4557
|
onClick: ($event) => toggleStep(step)
|
|
4558
4558
|
}, [
|
|
4559
4559
|
createBaseVNode("i", { class: normalizeClass([step.collapsed ? "bi bi-chevron-right" : "bi bi-chevron-down", "step-chevron"]) }, null, 2),
|
|
4560
4560
|
_cache[16] || (_cache[16] = createBaseVNode("i", { class: "bi bi-terminal step-icon" }, null, -1)),
|
|
4561
|
-
createBaseVNode("code", _hoisted_19$
|
|
4561
|
+
createBaseVNode("code", _hoisted_19$5, toDisplayString(getToolDisplayCmd(step)), 1),
|
|
4562
4562
|
step.result ? (openBlock(), createElementBlock("i", {
|
|
4563
4563
|
key: 0,
|
|
4564
4564
|
class: normalizeClass([step.collapsed ? "bi bi-check-circle" : "bi bi-check-circle-fill", "step-status"])
|
|
4565
4565
|
}, null, 2)) : createCommentVNode("", true)
|
|
4566
|
-
], 8, _hoisted_18$
|
|
4566
|
+
], 8, _hoisted_18$5), !step.collapsed && step.result ? (openBlock(), createElementBlock("div", _hoisted_20$5, [createBaseVNode("pre", null, toDisplayString(step.result), 1)])) : createCommentVNode("", true)])) : createCommentVNode("", true)], 64);
|
|
4567
4567
|
}), 128))])) : createCommentVNode("", true),
|
|
4568
4568
|
msg.content ? (openBlock(), createElementBlock("div", {
|
|
4569
4569
|
key: 2,
|
|
4570
4570
|
class: "ai-message-text",
|
|
4571
4571
|
innerHTML: renderMarkdown(msg.content)
|
|
4572
|
-
}, null, 8, _hoisted_21$
|
|
4572
|
+
}, null, 8, _hoisted_21$5)) : createCommentVNode("", true)
|
|
4573
4573
|
])], 2);
|
|
4574
4574
|
}), 128))], 512), [[vShow, activeTab.value === "chat"]]),
|
|
4575
|
-
showSkillsPanel.value ? (openBlock(), createElementBlock("div", _hoisted_22$
|
|
4575
|
+
showSkillsPanel.value ? (openBlock(), createElementBlock("div", _hoisted_22$5, [createBaseVNode("div", _hoisted_23$5, [createBaseVNode("span", null, toDisplayString(unref(t)("ai.selectSkill")), 1), createBaseVNode("button", {
|
|
4576
4576
|
class: "btn-ai-action",
|
|
4577
4577
|
onClick: _cache[2] || (_cache[2] = ($event) => showSkillsPanel.value = false)
|
|
4578
|
-
}, [..._cache[17] || (_cache[17] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])])]), createBaseVNode("div", _hoisted_24$
|
|
4578
|
+
}, [..._cache[17] || (_cache[17] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])])]), createBaseVNode("div", _hoisted_24$5, [(openBlock(true), createElementBlock(Fragment, null, renderList(skills.value, (skill) => {
|
|
4579
4579
|
return openBlock(), createElementBlock("div", {
|
|
4580
4580
|
key: skill.id,
|
|
4581
4581
|
class: normalizeClass(["skill-item", { active: selectedSkill.value?.id === skill.id }]),
|
|
4582
4582
|
onClick: ($event) => toggleSkill(skill)
|
|
4583
|
-
}, [createBaseVNode("div", _hoisted_26$
|
|
4583
|
+
}, [createBaseVNode("div", _hoisted_26$4, [
|
|
4584
4584
|
_cache[18] || (_cache[18] = createBaseVNode("i", { class: "bi bi-lightning-charge-fill" }, null, -1)),
|
|
4585
|
-
createBaseVNode("span", _hoisted_27$
|
|
4586
|
-
skill.source === "user" ? (openBlock(), createElementBlock("span", _hoisted_28$
|
|
4587
|
-
]), skill.description ? (openBlock(), createElementBlock("div", _hoisted_29$
|
|
4588
|
-
}), 128)), skills.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_30$
|
|
4589
|
-
showHistoryPanel.value ? (openBlock(), createElementBlock("div", _hoisted_31$
|
|
4585
|
+
createBaseVNode("span", _hoisted_27$4, toDisplayString(skill.name), 1),
|
|
4586
|
+
skill.source === "user" ? (openBlock(), createElementBlock("span", _hoisted_28$4, toDisplayString(unref(t)("ai.userSkill")), 1)) : createCommentVNode("", true)
|
|
4587
|
+
]), skill.description ? (openBlock(), createElementBlock("div", _hoisted_29$4, toDisplayString(skill.description), 1)) : createCommentVNode("", true)], 10, _hoisted_25$5);
|
|
4588
|
+
}), 128)), skills.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_30$4, toDisplayString(unref(t)("ai.noSkills")), 1)) : createCommentVNode("", true)])])) : createCommentVNode("", true),
|
|
4589
|
+
showHistoryPanel.value ? (openBlock(), createElementBlock("div", _hoisted_31$3, [createBaseVNode("div", _hoisted_32$2, [createBaseVNode("span", null, toDisplayString(unref(t)("ai.history")), 1), createBaseVNode("button", {
|
|
4590
4590
|
class: "btn-ai-action",
|
|
4591
4591
|
onClick: _cache[3] || (_cache[3] = ($event) => showHistoryPanel.value = false)
|
|
4592
|
-
}, [..._cache[19] || (_cache[19] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])])]), createBaseVNode("div", _hoisted_33$
|
|
4592
|
+
}, [..._cache[19] || (_cache[19] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])])]), createBaseVNode("div", _hoisted_33$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(historyList.value, (h) => {
|
|
4593
4593
|
return openBlock(), createElementBlock("div", {
|
|
4594
4594
|
key: h.sessionId,
|
|
4595
4595
|
class: "history-item",
|
|
4596
4596
|
onClick: ($event) => loadPastHistory(h.sessionId)
|
|
4597
4597
|
}, [
|
|
4598
|
-
createBaseVNode("div", _hoisted_35$
|
|
4599
|
-
createBaseVNode("div", _hoisted_38$
|
|
4600
|
-
createBaseVNode("div", _hoisted_39$
|
|
4601
|
-
], 8, _hoisted_34$
|
|
4598
|
+
createBaseVNode("div", _hoisted_35$2, [createBaseVNode("span", _hoisted_36$2, toDisplayString(h.sessionName || h.sessionId.substring(0, 8)), 1), createBaseVNode("span", _hoisted_37$2, toDisplayString(formatTime(h.savedAt)), 1)]),
|
|
4599
|
+
createBaseVNode("div", _hoisted_38$2, toDisplayString(h.preview || unref(t)("ai.noHistory")), 1),
|
|
4600
|
+
createBaseVNode("div", _hoisted_39$2, toDisplayString(h.messageCount) + " " + toDisplayString(unref(t)("ai.messages")), 1)
|
|
4601
|
+
], 8, _hoisted_34$2);
|
|
4602
4602
|
}), 128)), historyList.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_40$1, toDisplayString(unref(t)("ai.noHistory")), 1)) : createCommentVNode("", true)])])) : createCommentVNode("", true),
|
|
4603
4603
|
withDirectives(createBaseVNode("div", _hoisted_41$1, [createVNode(audit_panel_default, {
|
|
4604
4604
|
ref_key: "auditPanelRef",
|
|
@@ -4661,67 +4661,84 @@ var init_ai_chat = __esmMin((() => {
|
|
|
4661
4661
|
}));
|
|
4662
4662
|
//#endregion
|
|
4663
4663
|
//#region src/components/file-transfer.vue?vue&type=script&setup=true&lang.ts
|
|
4664
|
-
var _hoisted_1$
|
|
4664
|
+
var _hoisted_1$6, _hoisted_2$6, _hoisted_3$6, _hoisted_4$6, _hoisted_5$6, _hoisted_6$6, _hoisted_7$5, _hoisted_8$5, _hoisted_9$5, _hoisted_10$5, _hoisted_11$5, _hoisted_12$5, _hoisted_13$5, _hoisted_14$5, _hoisted_15$5, _hoisted_16$5, _hoisted_17$4, _hoisted_18$4, _hoisted_19$4, _hoisted_20$4, _hoisted_21$4, _hoisted_22$4, _hoisted_23$4, _hoisted_24$4, _hoisted_25$4, _hoisted_26$3, _hoisted_27$3, _hoisted_28$3, _hoisted_29$3, _hoisted_30$3, file_transfer_vue_vue_type_script_setup_true_lang_default;
|
|
4665
4665
|
var init_file_transfer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
4666
4666
|
init_vue_runtime_esm_bundler();
|
|
4667
4667
|
init_vue_i18n();
|
|
4668
4668
|
init_zmodem();
|
|
4669
4669
|
init_toast();
|
|
4670
|
-
_hoisted_1$
|
|
4671
|
-
_hoisted_2$
|
|
4672
|
-
_hoisted_3$
|
|
4673
|
-
_hoisted_4$
|
|
4674
|
-
_hoisted_5$
|
|
4675
|
-
_hoisted_6$
|
|
4670
|
+
_hoisted_1$6 = { class: "ft-title" };
|
|
4671
|
+
_hoisted_2$6 = { class: "ft-header-actions" };
|
|
4672
|
+
_hoisted_3$6 = ["title"];
|
|
4673
|
+
_hoisted_4$6 = ["title"];
|
|
4674
|
+
_hoisted_5$6 = { class: "ft-body" };
|
|
4675
|
+
_hoisted_6$6 = {
|
|
4676
4676
|
key: 0,
|
|
4677
4677
|
class: "d-flex gap-2 mb-2"
|
|
4678
4678
|
};
|
|
4679
|
-
_hoisted_7$
|
|
4680
|
-
_hoisted_8$
|
|
4681
|
-
_hoisted_9$
|
|
4682
|
-
|
|
4679
|
+
_hoisted_7$5 = { key: 1 };
|
|
4680
|
+
_hoisted_8$5 = { class: "ms-2" };
|
|
4681
|
+
_hoisted_9$5 = {
|
|
4682
|
+
key: 0,
|
|
4683
|
+
class: "dest-dir-hint mt-2 px-2 py-1"
|
|
4684
|
+
};
|
|
4685
|
+
_hoisted_10$5 = { class: "text-info" };
|
|
4686
|
+
_hoisted_11$5 = { class: "d-flex align-items-center gap-2" };
|
|
4687
|
+
_hoisted_12$5 = ["disabled"];
|
|
4688
|
+
_hoisted_13$5 = {
|
|
4689
|
+
key: 0,
|
|
4690
|
+
class: "text-danger mt-1",
|
|
4691
|
+
style: { "font-size": "12px" }
|
|
4692
|
+
};
|
|
4693
|
+
_hoisted_14$5 = {
|
|
4694
|
+
key: 1,
|
|
4695
|
+
class: "text-warning mt-1",
|
|
4696
|
+
style: { "font-size": "12px" }
|
|
4697
|
+
};
|
|
4698
|
+
_hoisted_15$5 = { key: 2 };
|
|
4699
|
+
_hoisted_16$5 = {
|
|
4683
4700
|
key: 0,
|
|
4684
4701
|
class: "text-center py-2"
|
|
4685
4702
|
};
|
|
4686
|
-
|
|
4703
|
+
_hoisted_17$4 = {
|
|
4687
4704
|
key: 1,
|
|
4688
4705
|
class: "mb-2"
|
|
4689
4706
|
};
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4707
|
+
_hoisted_18$4 = ["placeholder"];
|
|
4708
|
+
_hoisted_19$4 = ["disabled"];
|
|
4709
|
+
_hoisted_20$4 = {
|
|
4693
4710
|
key: 3,
|
|
4694
4711
|
class: "mt-2"
|
|
4695
4712
|
};
|
|
4696
|
-
|
|
4697
|
-
|
|
4713
|
+
_hoisted_21$4 = { class: "transfer-list" };
|
|
4714
|
+
_hoisted_22$4 = {
|
|
4698
4715
|
key: 0,
|
|
4699
4716
|
class: "transfer-item"
|
|
4700
4717
|
};
|
|
4701
|
-
|
|
4702
|
-
|
|
4718
|
+
_hoisted_23$4 = { class: "d-flex align-items-center justify-content-between mb-1" };
|
|
4719
|
+
_hoisted_24$4 = {
|
|
4703
4720
|
class: "text-truncate",
|
|
4704
4721
|
style: { "font-size": "12px" }
|
|
4705
4722
|
};
|
|
4706
|
-
|
|
4723
|
+
_hoisted_25$4 = { style: {
|
|
4707
4724
|
"font-size": "11px",
|
|
4708
4725
|
"color": "var(--text-secondary)"
|
|
4709
4726
|
} };
|
|
4710
|
-
|
|
4727
|
+
_hoisted_26$3 = {
|
|
4711
4728
|
class: "progress",
|
|
4712
4729
|
style: { "height": "3px" }
|
|
4713
4730
|
};
|
|
4714
|
-
|
|
4731
|
+
_hoisted_27$3 = {
|
|
4715
4732
|
key: 0,
|
|
4716
4733
|
class: "text-danger",
|
|
4717
4734
|
style: { "font-size": "11px" }
|
|
4718
4735
|
};
|
|
4719
|
-
|
|
4720
|
-
|
|
4736
|
+
_hoisted_28$3 = { class: "d-flex align-items-center justify-content-between" };
|
|
4737
|
+
_hoisted_29$3 = {
|
|
4721
4738
|
class: "text-truncate",
|
|
4722
4739
|
style: { "font-size": "12px" }
|
|
4723
4740
|
};
|
|
4724
|
-
|
|
4741
|
+
_hoisted_30$3 = {
|
|
4725
4742
|
key: 4,
|
|
4726
4743
|
class: "mt-2 text-center"
|
|
4727
4744
|
};
|
|
@@ -4793,6 +4810,36 @@ var init_file_transfer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
4793
4810
|
let zmodemSession = null;
|
|
4794
4811
|
let zmodemAutoMode = ref(false);
|
|
4795
4812
|
let activeTermRef = null;
|
|
4813
|
+
const destDir = ref("");
|
|
4814
|
+
const destDirLoading = ref(false);
|
|
4815
|
+
const destDirError = ref("");
|
|
4816
|
+
const isZmodemSend = ref(false);
|
|
4817
|
+
async function queryCwd() {
|
|
4818
|
+
const sid = activeTermRef?.sessionId;
|
|
4819
|
+
if (!sid) return "";
|
|
4820
|
+
destDirLoading.value = true;
|
|
4821
|
+
destDirError.value = "";
|
|
4822
|
+
try {
|
|
4823
|
+
const electronApi = window.electronAPI;
|
|
4824
|
+
let cwd = "";
|
|
4825
|
+
if (electronApi?.api?.getCwd) {
|
|
4826
|
+
const res = await electronApi.api.getCwd(sid);
|
|
4827
|
+
cwd = res?.cwd || "";
|
|
4828
|
+
if (!cwd && res?.error) destDirError.value = res.error;
|
|
4829
|
+
} else {
|
|
4830
|
+
const data = await (await fetch(`/api/cwd?sessionId=${encodeURIComponent(sid)}`)).json();
|
|
4831
|
+
cwd = data?.cwd || "";
|
|
4832
|
+
if (!cwd && data?.error) destDirError.value = data.error;
|
|
4833
|
+
}
|
|
4834
|
+
destDir.value = cwd;
|
|
4835
|
+
return cwd;
|
|
4836
|
+
} catch (e) {
|
|
4837
|
+
destDirError.value = e?.message || String(e);
|
|
4838
|
+
return "";
|
|
4839
|
+
} finally {
|
|
4840
|
+
destDirLoading.value = false;
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4796
4843
|
/**
|
|
4797
4844
|
* 向终端发送数据(自动附带正确的 sessionId)
|
|
4798
4845
|
*/
|
|
@@ -4862,6 +4909,10 @@ var init_file_transfer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
4862
4909
|
zmodemSession = null;
|
|
4863
4910
|
mode.value = "upload";
|
|
4864
4911
|
}
|
|
4912
|
+
if (mode.value === "upload") {
|
|
4913
|
+
isZmodemSend.value = !!activeTermRef?.zmodemSender;
|
|
4914
|
+
queryCwd();
|
|
4915
|
+
} else isZmodemSend.value = false;
|
|
4865
4916
|
}
|
|
4866
4917
|
function handleClose() {
|
|
4867
4918
|
if (transferring.value) cancelTransfer();
|
|
@@ -4938,8 +4989,8 @@ var init_file_transfer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
4938
4989
|
};
|
|
4939
4990
|
const safeName = file.name.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
4940
4991
|
const sid = activeTermRef.sessionId;
|
|
4941
|
-
const cwd =
|
|
4942
|
-
const remoteName = cwd
|
|
4992
|
+
const cwd = destDir.value && destDir.value.startsWith("/") ? destDir.value : "";
|
|
4993
|
+
const remoteName = cwd ? `${cwd.replace(/\/$/, "")}/${safeName}` : safeName;
|
|
4943
4994
|
console.log(`[FileTransfer] HTTP upload: ${file.name} -> ${remoteName}, size=${file.size}, sessionId=${sid}`);
|
|
4944
4995
|
currentProgress.value = {
|
|
4945
4996
|
direction: "upload",
|
|
@@ -5147,95 +5198,676 @@ var init_file_transfer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
5147
5198
|
class: "ft-header",
|
|
5148
5199
|
onMousedown: onDragStart,
|
|
5149
5200
|
onDblclick: _cache[1] || (_cache[1] = ($event) => isCollapsed.value = !isCollapsed.value)
|
|
5150
|
-
}, [createBaseVNode("span", _hoisted_1$
|
|
5201
|
+
}, [createBaseVNode("span", _hoisted_1$6, [_cache[8] || (_cache[8] = createBaseVNode("i", { class: "bi bi-cloud-arrow-up me-1" }, null, -1)), transferring.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(unref(t)("fileTransfer.transferring")), 1)], 64)) : transferHistory.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(unref(t)("fileTransfer.title")) + " (" + toDisplayString(transferHistory.value.length) + ") ", 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(unref(t)("fileTransfer.title")), 1)], 64))]), createBaseVNode("div", _hoisted_2$6, [createBaseVNode("button", {
|
|
5151
5202
|
class: "ft-btn-icon",
|
|
5152
5203
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => isCollapsed.value = !isCollapsed.value, ["stop"])),
|
|
5153
5204
|
title: isCollapsed.value ? "展开" : "收起"
|
|
5154
|
-
}, [createBaseVNode("i", { class: normalizeClass(isCollapsed.value ? "bi bi-chevron-up" : "bi bi-chevron-down") }, null, 2)], 8, _hoisted_3$
|
|
5205
|
+
}, [createBaseVNode("i", { class: normalizeClass(isCollapsed.value ? "bi bi-chevron-up" : "bi bi-chevron-down") }, null, 2)], 8, _hoisted_3$6), createBaseVNode("button", {
|
|
5155
5206
|
class: "ft-btn-icon",
|
|
5156
5207
|
onClick: withModifiers(handleClose, ["stop"]),
|
|
5157
5208
|
title: unref(t)("common.close")
|
|
5158
|
-
}, [..._cache[
|
|
5159
|
-
!unref(zmodemAutoMode) ? (openBlock(), createElementBlock("div", _hoisted_6$
|
|
5209
|
+
}, [..._cache[9] || (_cache[9] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])], 8, _hoisted_4$6)])], 32), withDirectives(createBaseVNode("div", _hoisted_5$6, [
|
|
5210
|
+
!unref(zmodemAutoMode) ? (openBlock(), createElementBlock("div", _hoisted_6$6, [createBaseVNode("button", {
|
|
5160
5211
|
class: normalizeClass(["btn btn-sm flex-fill", mode.value === "upload" ? "btn-primary" : "btn-outline-secondary"]),
|
|
5161
5212
|
onClick: _cache[2] || (_cache[2] = ($event) => mode.value = "upload")
|
|
5162
|
-
}, [_cache[
|
|
5213
|
+
}, [_cache[10] || (_cache[10] = createBaseVNode("i", { class: "bi bi-upload me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("fileTransfer.upload")), 1)], 2), createBaseVNode("button", {
|
|
5163
5214
|
class: normalizeClass(["btn btn-sm flex-fill", mode.value === "download" ? "btn-primary" : "btn-outline-secondary"]),
|
|
5164
5215
|
onClick: _cache[3] || (_cache[3] = ($event) => mode.value = "download")
|
|
5165
|
-
}, [_cache[
|
|
5166
|
-
mode.value === "upload" ? (openBlock(), createElementBlock("div", _hoisted_7$
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5216
|
+
}, [_cache[11] || (_cache[11] = createBaseVNode("i", { class: "bi bi-download me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("fileTransfer.download")), 1)], 2)])) : createCommentVNode("", true),
|
|
5217
|
+
mode.value === "upload" ? (openBlock(), createElementBlock("div", _hoisted_7$5, [
|
|
5218
|
+
createBaseVNode("div", {
|
|
5219
|
+
class: normalizeClass(["drop-zone", { dragging: isDragging.value }]),
|
|
5220
|
+
onDragover: _cache[4] || (_cache[4] = withModifiers(($event) => isDragging.value = true, ["prevent"])),
|
|
5221
|
+
onDragleave: _cache[5] || (_cache[5] = ($event) => isDragging.value = false),
|
|
5222
|
+
onDrop: withModifiers(handleDrop, ["prevent"]),
|
|
5223
|
+
onClick: triggerFileInput
|
|
5224
|
+
}, [_cache[12] || (_cache[12] = createBaseVNode("i", {
|
|
5225
|
+
class: "bi bi-cloud-upload",
|
|
5226
|
+
style: { "font-size": "20px" }
|
|
5227
|
+
}, null, -1)), createBaseVNode("span", _hoisted_8$5, toDisplayString(unref(t)("fileTransfer.dropZone")), 1)], 34),
|
|
5228
|
+
createBaseVNode("input", {
|
|
5229
|
+
ref_key: "fileInput",
|
|
5230
|
+
ref: fileInput,
|
|
5231
|
+
type: "file",
|
|
5232
|
+
multiple: "",
|
|
5233
|
+
style: { "display": "none" },
|
|
5234
|
+
onChange: handleFileSelect
|
|
5235
|
+
}, null, 544),
|
|
5236
|
+
mode.value === "upload" ? (openBlock(), createElementBlock("div", _hoisted_9$5, [isZmodemSend.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5237
|
+
_cache[13] || (_cache[13] = createBaseVNode("i", { class: "bi bi-folder2 me-1 text-info" }, null, -1)),
|
|
5238
|
+
_cache[14] || (_cache[14] = createBaseVNode("span", { class: "text-secondary" }, "远端 rz 将写入当前目录:", -1)),
|
|
5239
|
+
createBaseVNode("code", _hoisted_10$5, toDisplayString(destDir.value || "(解析中…)"), 1)
|
|
5240
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createBaseVNode("div", _hoisted_11$5, [
|
|
5241
|
+
_cache[15] || (_cache[15] = createBaseVNode("label", { class: "text-secondary mb-0 text-nowrap" }, [createBaseVNode("i", { class: "bi bi-folder2 me-1 text-info" }), createTextVNode("目标目录")], -1)),
|
|
5242
|
+
withDirectives(createBaseVNode("input", {
|
|
5243
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => destDir.value = $event),
|
|
5244
|
+
type: "text",
|
|
5245
|
+
class: "form-control form-control-sm",
|
|
5246
|
+
placeholder: "/当前/目录(可手动修改)",
|
|
5247
|
+
spellcheck: "false"
|
|
5248
|
+
}, null, 512), [[vModelText, destDir.value]]),
|
|
5249
|
+
createBaseVNode("button", {
|
|
5250
|
+
class: "btn btn-sm btn-outline-secondary",
|
|
5251
|
+
disabled: destDirLoading.value,
|
|
5252
|
+
onClick: queryCwd,
|
|
5253
|
+
title: "重新检测当前目录"
|
|
5254
|
+
}, [createBaseVNode("i", { class: normalizeClass(["bi", destDirLoading.value ? "bi-hourglass-split" : "bi-arrow-clockwise"]) }, null, 2)], 8, _hoisted_12$5)
|
|
5255
|
+
]), destDir.value && !destDir.value.startsWith("/") ? (openBlock(), createElementBlock("div", _hoisted_13$5, [..._cache[16] || (_cache[16] = [createBaseVNode("i", { class: "bi bi-exclamation-triangle me-1" }, null, -1), createTextVNode("目录必须是绝对路径(以 / 开头),否则将回退到家目录。 ", -1)])])) : !destDir.value ? (openBlock(), createElementBlock("div", _hoisted_14$5, [_cache[17] || (_cache[17] = createBaseVNode("i", { class: "bi bi-exclamation-triangle me-1" }, null, -1)), createTextVNode(" 未能自动检测当前目录" + toDisplayString(destDirError.value ? ":" + destDirError.value : "") + ",请手动填写目标目录(绝对路径),否则文件会传到家目录。 ", 1)])) : createCommentVNode("", true)], 64))])) : createCommentVNode("", true)
|
|
5256
|
+
])) : createCommentVNode("", true),
|
|
5257
|
+
mode.value === "download" ? (openBlock(), createElementBlock("div", _hoisted_15$5, [unref(zmodemAutoMode) ? (openBlock(), createElementBlock("div", _hoisted_16$5, [_cache[18] || (_cache[18] = createBaseVNode("div", { class: "spinner-border spinner-border-sm text-primary me-2" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("fileTransfer.waitingForFiles")), 1)])) : (openBlock(), createElementBlock("div", _hoisted_17$4, [withDirectives(createBaseVNode("input", {
|
|
5184
5258
|
type: "text",
|
|
5185
5259
|
class: "form-control form-control-sm",
|
|
5186
|
-
"onUpdate:modelValue": _cache[
|
|
5260
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => remoteFilePath.value = $event),
|
|
5187
5261
|
placeholder: unref(t)("fileTransfer.remotePathPlaceholder"),
|
|
5188
5262
|
style: {
|
|
5189
5263
|
"background": "#313244",
|
|
5190
5264
|
"border-color": "#45475a",
|
|
5191
5265
|
"color": "var(--text-primary)"
|
|
5192
5266
|
}
|
|
5193
|
-
}, null, 8,
|
|
5267
|
+
}, null, 8, _hoisted_18$4), [[vModelText, remoteFilePath.value]]), createBaseVNode("button", {
|
|
5194
5268
|
class: "btn btn-primary btn-sm w-100 mt-2",
|
|
5195
5269
|
disabled: !remoteFilePath.value || transferring.value,
|
|
5196
5270
|
onClick: startManualDownload
|
|
5197
|
-
}, [_cache[
|
|
5198
|
-
transferring.value || transferHistory.value.length > 0 ? (openBlock(), createElementBlock("div",
|
|
5199
|
-
createBaseVNode("div",
|
|
5200
|
-
createBaseVNode("div",
|
|
5271
|
+
}, [_cache[19] || (_cache[19] = createBaseVNode("i", { class: "bi bi-download me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("fileTransfer.startDownload")), 1)], 8, _hoisted_19$4)]))])) : createCommentVNode("", true),
|
|
5272
|
+
transferring.value || transferHistory.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_20$4, [createBaseVNode("div", _hoisted_21$4, [currentProgress.value ? (openBlock(), createElementBlock("div", _hoisted_22$4, [
|
|
5273
|
+
createBaseVNode("div", _hoisted_23$4, [createBaseVNode("span", _hoisted_24$4, [createBaseVNode("i", { class: normalizeClass([currentProgress.value.direction === "upload" ? "bi bi-upload" : "bi bi-download", "me-1"]) }, null, 2), createTextVNode(" " + toDisplayString(currentProgress.value.fileName), 1)]), createBaseVNode("span", _hoisted_25$4, toDisplayString(formatSize(currentProgress.value.bytesSent)) + " / " + toDisplayString(formatSize(currentProgress.value.bytesTotal)), 1)]),
|
|
5274
|
+
createBaseVNode("div", _hoisted_26$3, [createBaseVNode("div", {
|
|
5201
5275
|
class: normalizeClass(["progress-bar", currentProgress.value.state === "error" ? "bg-danger" : "bg-primary"]),
|
|
5202
5276
|
style: normalizeStyle({ width: currentProgress.value.percent + "%" })
|
|
5203
5277
|
}, null, 6)]),
|
|
5204
|
-
currentProgress.value.state === "error" ? (openBlock(), createElementBlock("div",
|
|
5278
|
+
currentProgress.value.state === "error" ? (openBlock(), createElementBlock("div", _hoisted_27$3, toDisplayString(unref(t)("fileTransfer.transferFailed")), 1)) : createCommentVNode("", true)
|
|
5205
5279
|
])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(transferHistory.value, (item, idx) => {
|
|
5206
5280
|
return openBlock(), createElementBlock("div", {
|
|
5207
5281
|
key: idx,
|
|
5208
5282
|
class: "transfer-item"
|
|
5209
|
-
}, [createBaseVNode("div",
|
|
5283
|
+
}, [createBaseVNode("div", _hoisted_28$3, [createBaseVNode("span", _hoisted_29$3, [createBaseVNode("i", { class: normalizeClass([item.direction === "upload" ? "bi bi-upload" : "bi bi-download", "me-1"]) }, null, 2), createTextVNode(" " + toDisplayString(item.fileName), 1)]), createBaseVNode("span", {
|
|
5210
5284
|
style: { "font-size": "11px" },
|
|
5211
5285
|
class: normalizeClass(item.state === "complete" ? "text-success" : "text-danger")
|
|
5212
5286
|
}, toDisplayString(item.state === "complete" ? unref(t)("fileTransfer.complete") : unref(t)("fileTransfer.failed")), 3)])]);
|
|
5213
5287
|
}), 128))])])) : createCommentVNode("", true),
|
|
5214
|
-
transferring.value ? (openBlock(), createElementBlock("div",
|
|
5288
|
+
transferring.value ? (openBlock(), createElementBlock("div", _hoisted_30$3, [createBaseVNode("button", {
|
|
5215
5289
|
class: "btn btn-outline-danger btn-sm",
|
|
5216
5290
|
onClick: cancelTransfer
|
|
5217
|
-
}, [_cache[
|
|
5291
|
+
}, [_cache[20] || (_cache[20] = createBaseVNode("i", { class: "bi bi-x-circle me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("fileTransfer.cancelTransfer")), 1)])])) : createCommentVNode("", true)
|
|
5218
5292
|
], 512), [[vShow, !isCollapsed.value]])], 6)) : createCommentVNode("", true);
|
|
5219
5293
|
};
|
|
5220
5294
|
}
|
|
5221
5295
|
});
|
|
5222
5296
|
}));
|
|
5223
5297
|
//#endregion
|
|
5224
|
-
//#region src/components/file-transfer.vue?vue&type=style&index=0&scoped=
|
|
5225
|
-
var
|
|
5298
|
+
//#region src/components/file-transfer.vue?vue&type=style&index=0&scoped=bde4aff5&lang.css
|
|
5299
|
+
var init_file_transfer_vue_vue_type_style_index_0_scoped_bde4aff5_lang = __esmMin((() => {}));
|
|
5226
5300
|
//#endregion
|
|
5227
5301
|
//#region src/components/file-transfer.vue
|
|
5228
5302
|
var file_transfer_default;
|
|
5229
5303
|
var init_file_transfer = __esmMin((() => {
|
|
5230
5304
|
init_file_transfer_vue_vue_type_script_setup_true_lang();
|
|
5231
5305
|
init_file_transfer_vue_vue_type_script_setup_true_lang();
|
|
5232
|
-
|
|
5306
|
+
init_file_transfer_vue_vue_type_style_index_0_scoped_bde4aff5_lang();
|
|
5233
5307
|
init__plugin_vue_export_helper();
|
|
5234
|
-
file_transfer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(file_transfer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5308
|
+
file_transfer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(file_transfer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bde4aff5"]]);
|
|
5309
|
+
}));
|
|
5310
|
+
//#endregion
|
|
5311
|
+
//#region src/service/file.ts
|
|
5312
|
+
function unwrap$1(res) {
|
|
5313
|
+
if (res && typeof res === "object" && "ret" in res) {
|
|
5314
|
+
if (res.ret !== 0) throw new Error(res.msg || "请求失败");
|
|
5315
|
+
return res.data;
|
|
5316
|
+
}
|
|
5317
|
+
return res;
|
|
5318
|
+
}
|
|
5319
|
+
function listDirectory(sessionId, remotePath) {
|
|
5320
|
+
return request("/api/file/list", {
|
|
5321
|
+
sessionId,
|
|
5322
|
+
path: remotePath
|
|
5323
|
+
}).then(unwrap$1);
|
|
5324
|
+
}
|
|
5325
|
+
function makeDirectory(sessionId, remotePath) {
|
|
5326
|
+
return request("/api/file/mkdir", {
|
|
5327
|
+
sessionId,
|
|
5328
|
+
path: remotePath
|
|
5329
|
+
}).then(unwrap$1);
|
|
5330
|
+
}
|
|
5331
|
+
function removePath(sessionId, remotePath) {
|
|
5332
|
+
return request("/api/file/remove", {
|
|
5333
|
+
sessionId,
|
|
5334
|
+
path: remotePath
|
|
5335
|
+
}).then(unwrap$1);
|
|
5336
|
+
}
|
|
5337
|
+
function renamePath(sessionId, oldPath, newPath) {
|
|
5338
|
+
return request("/api/file/rename", {
|
|
5339
|
+
sessionId,
|
|
5340
|
+
oldPath,
|
|
5341
|
+
newPath
|
|
5342
|
+
}).then(unwrap$1);
|
|
5343
|
+
}
|
|
5344
|
+
function getDefaultDir(sessionId) {
|
|
5345
|
+
return request("/api/file/defaultDir", { sessionId }).then(unwrap$1);
|
|
5346
|
+
}
|
|
5347
|
+
/** 判断当前是否处于 Electron 生产模式(文件二进制走主进程 IPC) */
|
|
5348
|
+
function isElectronProduction() {
|
|
5349
|
+
const api = window.electronAPI;
|
|
5350
|
+
return !!(api && api.isElectron && api.isPackaged && api.api);
|
|
5351
|
+
}
|
|
5352
|
+
/** 上传本地文件到远程指定路径 */
|
|
5353
|
+
async function uploadFile(sessionId, remotePath, file) {
|
|
5354
|
+
if (isElectronProduction()) {
|
|
5355
|
+
const api = window.electronAPI.api;
|
|
5356
|
+
const buf = await file.arrayBuffer();
|
|
5357
|
+
const res = await api.uploadFile(sessionId, remotePath, buf);
|
|
5358
|
+
if (!res || !res.success) throw new Error(res?.error || "上传失败");
|
|
5359
|
+
return;
|
|
5360
|
+
}
|
|
5361
|
+
const url = getRequestUrl("/api/file-upload");
|
|
5362
|
+
const resp = await fetch(url, {
|
|
5363
|
+
method: "POST",
|
|
5364
|
+
headers: {
|
|
5365
|
+
"X-Session-Id": sessionId,
|
|
5366
|
+
"X-File-Name": remotePath,
|
|
5367
|
+
"Content-Type": "application/octet-stream"
|
|
5368
|
+
},
|
|
5369
|
+
body: file,
|
|
5370
|
+
credentials: "include"
|
|
5371
|
+
});
|
|
5372
|
+
const data = await resp.json().catch(() => ({}));
|
|
5373
|
+
if (!resp.ok || !data.success) throw new Error(data.error || "上传失败");
|
|
5374
|
+
}
|
|
5375
|
+
/** 下载远程文件到本地 */
|
|
5376
|
+
async function downloadFile(sessionId, remotePath, fileName) {
|
|
5377
|
+
if (isElectronProduction()) {
|
|
5378
|
+
const res = await window.electronAPI.api.downloadFile(sessionId, remotePath, fileName);
|
|
5379
|
+
if (res && res.canceled) return;
|
|
5380
|
+
if (!res || !res.success) throw new Error(res?.error || "下载失败");
|
|
5381
|
+
return;
|
|
5382
|
+
}
|
|
5383
|
+
const params = new URLSearchParams({
|
|
5384
|
+
sessionId,
|
|
5385
|
+
path: remotePath
|
|
5386
|
+
});
|
|
5387
|
+
const url = getRequestUrl("/api/file/download") + "?" + params.toString();
|
|
5388
|
+
const resp = await fetch(url, { credentials: "include" });
|
|
5389
|
+
if (!resp.ok) {
|
|
5390
|
+
const errData = await resp.json().catch(() => ({}));
|
|
5391
|
+
throw new Error(errData.error || errData.msg || `下载失败 (${resp.status})`);
|
|
5392
|
+
}
|
|
5393
|
+
const blob = await resp.blob();
|
|
5394
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
5395
|
+
const a = document.createElement("a");
|
|
5396
|
+
a.href = blobUrl;
|
|
5397
|
+
a.download = fileName || remotePath.split("/").pop() || "download";
|
|
5398
|
+
document.body.appendChild(a);
|
|
5399
|
+
a.click();
|
|
5400
|
+
document.body.removeChild(a);
|
|
5401
|
+
URL.revokeObjectURL(blobUrl);
|
|
5402
|
+
}
|
|
5403
|
+
var init_file = __esmMin((() => {
|
|
5404
|
+
init_base();
|
|
5405
|
+
}));
|
|
5406
|
+
//#endregion
|
|
5407
|
+
//#region src/components/file-manager.vue?vue&type=script&setup=true&lang.ts
|
|
5408
|
+
var _hoisted_1$5, _hoisted_2$5, _hoisted_3$5, _hoisted_4$5, _hoisted_5$5, _hoisted_6$5, _hoisted_7$4, _hoisted_8$4, _hoisted_9$4, _hoisted_10$4, _hoisted_11$4, _hoisted_12$4, _hoisted_13$4, _hoisted_14$4, _hoisted_15$4, _hoisted_16$4, _hoisted_17$3, _hoisted_18$3, _hoisted_19$3, _hoisted_20$3, _hoisted_21$3, _hoisted_22$3, _hoisted_23$3, _hoisted_24$3, _hoisted_25$3, _hoisted_26$2, _hoisted_27$2, _hoisted_28$2, _hoisted_29$2, _hoisted_30$2, _hoisted_31$2, _hoisted_32$1, _hoisted_33$1, _hoisted_34$1, _hoisted_35$1, _hoisted_36$1, _hoisted_37$1, _hoisted_38$1, _hoisted_39$1, file_manager_vue_vue_type_script_setup_true_lang_default;
|
|
5409
|
+
var init_file_manager_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
5410
|
+
init_vue_runtime_esm_bundler();
|
|
5411
|
+
init_vue_i18n();
|
|
5412
|
+
init_file();
|
|
5413
|
+
init_modal();
|
|
5414
|
+
init_toast();
|
|
5415
|
+
_hoisted_1$5 = { class: "fm-panel" };
|
|
5416
|
+
_hoisted_2$5 = { class: "fm-header" };
|
|
5417
|
+
_hoisted_3$5 = { class: "fm-title" };
|
|
5418
|
+
_hoisted_4$5 = { class: "fm-header-actions" };
|
|
5419
|
+
_hoisted_5$5 = ["title"];
|
|
5420
|
+
_hoisted_6$5 = { class: "fm-toolbar" };
|
|
5421
|
+
_hoisted_7$4 = ["disabled"];
|
|
5422
|
+
_hoisted_8$4 = ["disabled"];
|
|
5423
|
+
_hoisted_9$4 = ["title"];
|
|
5424
|
+
_hoisted_10$4 = { class: "fm-breadcrumbs" };
|
|
5425
|
+
_hoisted_11$4 = ["onClick"];
|
|
5426
|
+
_hoisted_12$4 = { class: "fm-table" };
|
|
5427
|
+
_hoisted_13$4 = { class: "fm-col-check" };
|
|
5428
|
+
_hoisted_14$4 = ["checked"];
|
|
5429
|
+
_hoisted_15$4 = { class: "fm-col-size" };
|
|
5430
|
+
_hoisted_16$4 = { class: "fm-col-time" };
|
|
5431
|
+
_hoisted_17$3 = { class: "fm-col-perm" };
|
|
5432
|
+
_hoisted_18$3 = { class: "fm-col-actions" };
|
|
5433
|
+
_hoisted_19$3 = ["onClick", "onDblclick"];
|
|
5434
|
+
_hoisted_20$3 = { class: "fm-col-check" };
|
|
5435
|
+
_hoisted_21$3 = ["checked", "onClick"];
|
|
5436
|
+
_hoisted_22$3 = { class: "fm-col-name" };
|
|
5437
|
+
_hoisted_23$3 = { class: "fm-file-icon" };
|
|
5438
|
+
_hoisted_24$3 = { class: "fm-file-name" };
|
|
5439
|
+
_hoisted_25$3 = { class: "fm-col-size" };
|
|
5440
|
+
_hoisted_26$2 = { class: "fm-col-time" };
|
|
5441
|
+
_hoisted_27$2 = { class: "fm-col-perm" };
|
|
5442
|
+
_hoisted_28$2 = { class: "fm-col-actions" };
|
|
5443
|
+
_hoisted_29$2 = ["onClick"];
|
|
5444
|
+
_hoisted_30$2 = ["onClick"];
|
|
5445
|
+
_hoisted_31$2 = ["onClick"];
|
|
5446
|
+
_hoisted_32$1 = { key: 0 };
|
|
5447
|
+
_hoisted_33$1 = {
|
|
5448
|
+
colspan: "6",
|
|
5449
|
+
class: "fm-empty"
|
|
5450
|
+
};
|
|
5451
|
+
_hoisted_34$1 = {
|
|
5452
|
+
key: 0,
|
|
5453
|
+
class: "fm-loading"
|
|
5454
|
+
};
|
|
5455
|
+
_hoisted_35$1 = {
|
|
5456
|
+
key: 1,
|
|
5457
|
+
class: "fm-loading"
|
|
5458
|
+
};
|
|
5459
|
+
_hoisted_36$1 = {
|
|
5460
|
+
key: 2,
|
|
5461
|
+
class: "fm-loading"
|
|
5462
|
+
};
|
|
5463
|
+
_hoisted_37$1 = { class: "fm-prompt" };
|
|
5464
|
+
_hoisted_38$1 = { class: "fm-prompt-title" };
|
|
5465
|
+
_hoisted_39$1 = { class: "fm-prompt-actions" };
|
|
5466
|
+
file_manager_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
5467
|
+
__name: "file-manager",
|
|
5468
|
+
props: {
|
|
5469
|
+
sessionId: {},
|
|
5470
|
+
initialPath: {}
|
|
5471
|
+
},
|
|
5472
|
+
emits: ["close"],
|
|
5473
|
+
setup(__props, { emit: __emit }) {
|
|
5474
|
+
const props = __props;
|
|
5475
|
+
const emit = __emit;
|
|
5476
|
+
const { t } = useI18n();
|
|
5477
|
+
const currentPath = ref("");
|
|
5478
|
+
const items = ref([]);
|
|
5479
|
+
const loading = ref(false);
|
|
5480
|
+
const uploading = ref(false);
|
|
5481
|
+
const uploadProgress = ref({
|
|
5482
|
+
current: 0,
|
|
5483
|
+
total: 0
|
|
5484
|
+
});
|
|
5485
|
+
const downloading = ref(false);
|
|
5486
|
+
const selectedItems = ref([]);
|
|
5487
|
+
const fileInput = ref(null);
|
|
5488
|
+
const promptState = ref(null);
|
|
5489
|
+
const promptInput = ref(null);
|
|
5490
|
+
let loadSeq = 0;
|
|
5491
|
+
const canGoUp = computed(() => currentPath.value !== "/" && currentPath.value !== "");
|
|
5492
|
+
const breadcrumbSegments = computed(() => {
|
|
5493
|
+
const p = currentPath.value.replace(/\/$/, "");
|
|
5494
|
+
if (!p) return [];
|
|
5495
|
+
return p.split("/").filter(Boolean).map((name) => ({ name }));
|
|
5496
|
+
});
|
|
5497
|
+
const allSelected = computed(() => items.value.length > 0 && selectedItems.value.length === items.value.length);
|
|
5498
|
+
function pathOf(index) {
|
|
5499
|
+
const parts = currentPath.value.replace(/\/$/, "").split("/").filter(Boolean);
|
|
5500
|
+
if (index <= 0) return "/";
|
|
5501
|
+
return "/" + parts.slice(0, index).join("/");
|
|
5502
|
+
}
|
|
5503
|
+
function navigateTo(index) {
|
|
5504
|
+
currentPath.value = pathOf(index);
|
|
5505
|
+
load();
|
|
5506
|
+
}
|
|
5507
|
+
function goUp() {
|
|
5508
|
+
if (!canGoUp.value) return;
|
|
5509
|
+
const p = currentPath.value.replace(/\/$/, "");
|
|
5510
|
+
const idx = p.lastIndexOf("/");
|
|
5511
|
+
currentPath.value = idx <= 0 ? "/" : p.substring(0, idx);
|
|
5512
|
+
load();
|
|
5513
|
+
}
|
|
5514
|
+
async function load(path) {
|
|
5515
|
+
if (!props.sessionId) {
|
|
5516
|
+
toast.error(t("fileManager.noSession"));
|
|
5517
|
+
return;
|
|
5518
|
+
}
|
|
5519
|
+
const target = path ?? currentPath.value;
|
|
5520
|
+
const seq = ++loadSeq;
|
|
5521
|
+
loading.value = true;
|
|
5522
|
+
try {
|
|
5523
|
+
const list = await listDirectory(props.sessionId, target);
|
|
5524
|
+
if (seq !== loadSeq) return;
|
|
5525
|
+
items.value = list;
|
|
5526
|
+
selectedItems.value = [];
|
|
5527
|
+
} catch (e) {
|
|
5528
|
+
if (seq !== loadSeq) return;
|
|
5529
|
+
items.value = [];
|
|
5530
|
+
toast.error(t("fileManager.loadFailed", { msg: e?.message || String(e) }));
|
|
5531
|
+
} finally {
|
|
5532
|
+
if (seq === loadSeq) loading.value = false;
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
function isSelected(item) {
|
|
5536
|
+
return selectedItems.value.some((i) => i.path === item.path);
|
|
5537
|
+
}
|
|
5538
|
+
function toggleSelect(item) {
|
|
5539
|
+
const idx = selectedItems.value.findIndex((i) => i.path === item.path);
|
|
5540
|
+
if (idx >= 0) selectedItems.value.splice(idx, 1);
|
|
5541
|
+
else selectedItems.value.push(item);
|
|
5542
|
+
}
|
|
5543
|
+
function toggleAll() {
|
|
5544
|
+
if (allSelected.value) selectedItems.value = [];
|
|
5545
|
+
else selectedItems.value = [...items.value];
|
|
5546
|
+
}
|
|
5547
|
+
function openItem(item) {
|
|
5548
|
+
if (item.isDirectory) {
|
|
5549
|
+
currentPath.value = item.path;
|
|
5550
|
+
load();
|
|
5551
|
+
} else downloadItem(item);
|
|
5552
|
+
}
|
|
5553
|
+
function refresh() {
|
|
5554
|
+
load();
|
|
5555
|
+
}
|
|
5556
|
+
function onUploadClick() {
|
|
5557
|
+
fileInput.value?.click();
|
|
5558
|
+
}
|
|
5559
|
+
async function uploadFiles(files) {
|
|
5560
|
+
if (!props.sessionId) return;
|
|
5561
|
+
const list = Array.from(files);
|
|
5562
|
+
if (!list.length) return;
|
|
5563
|
+
uploading.value = true;
|
|
5564
|
+
uploadProgress.value = {
|
|
5565
|
+
current: 0,
|
|
5566
|
+
total: list.length
|
|
5567
|
+
};
|
|
5568
|
+
let ok = 0;
|
|
5569
|
+
for (const file of list) {
|
|
5570
|
+
const remotePath = currentPath.value.replace(/\/$/, "") + "/" + file.name;
|
|
5571
|
+
try {
|
|
5572
|
+
await uploadFile(props.sessionId, remotePath, file);
|
|
5573
|
+
ok++;
|
|
5574
|
+
} catch (e) {
|
|
5575
|
+
toast.error(t("fileManager.uploadFailed", { msg: e?.message || String(e) }));
|
|
5576
|
+
}
|
|
5577
|
+
uploadProgress.value.current++;
|
|
5578
|
+
}
|
|
5579
|
+
uploading.value = false;
|
|
5580
|
+
if (ok > 0) {
|
|
5581
|
+
toast.success(t("fileManager.uploadSuccess", { count: ok }));
|
|
5582
|
+
await load();
|
|
5583
|
+
}
|
|
5584
|
+
}
|
|
5585
|
+
function onFileSelected(e) {
|
|
5586
|
+
const input = e.target;
|
|
5587
|
+
if (input.files) uploadFiles(input.files);
|
|
5588
|
+
input.value = "";
|
|
5589
|
+
}
|
|
5590
|
+
function onDrop(e) {
|
|
5591
|
+
if (e.dataTransfer?.files?.length) uploadFiles(e.dataTransfer.files);
|
|
5592
|
+
}
|
|
5593
|
+
async function downloadItem(item) {
|
|
5594
|
+
downloading.value = true;
|
|
5595
|
+
try {
|
|
5596
|
+
await downloadFile(props.sessionId, item.path, item.name);
|
|
5597
|
+
} catch (e) {
|
|
5598
|
+
toast.error(e?.message || String(e));
|
|
5599
|
+
} finally {
|
|
5600
|
+
downloading.value = false;
|
|
5601
|
+
}
|
|
5602
|
+
}
|
|
5603
|
+
function requestNewFolder() {
|
|
5604
|
+
promptState.value = {
|
|
5605
|
+
mode: "mkdir",
|
|
5606
|
+
value: ""
|
|
5607
|
+
};
|
|
5608
|
+
nextTick(() => promptInput.value?.focus());
|
|
5609
|
+
}
|
|
5610
|
+
function requestRename(item) {
|
|
5611
|
+
promptState.value = {
|
|
5612
|
+
mode: "rename",
|
|
5613
|
+
value: item.name,
|
|
5614
|
+
target: item
|
|
5615
|
+
};
|
|
5616
|
+
nextTick(() => promptInput.value?.focus());
|
|
5617
|
+
}
|
|
5618
|
+
async function confirmPrompt() {
|
|
5619
|
+
const ps = promptState.value;
|
|
5620
|
+
if (!ps) return;
|
|
5621
|
+
const name = ps.value.trim();
|
|
5622
|
+
if (!name) {
|
|
5623
|
+
promptState.value = null;
|
|
5624
|
+
return;
|
|
5625
|
+
}
|
|
5626
|
+
if (name.includes("/")) {
|
|
5627
|
+
toast.error(t("fileManager.invalidName"));
|
|
5628
|
+
return;
|
|
5629
|
+
}
|
|
5630
|
+
try {
|
|
5631
|
+
if (ps.mode === "mkdir") {
|
|
5632
|
+
const remotePath = currentPath.value.replace(/\/$/, "") + "/" + name;
|
|
5633
|
+
await makeDirectory(props.sessionId, remotePath);
|
|
5634
|
+
toast.success(t("fileManager.created"));
|
|
5635
|
+
} else if (ps.target) {
|
|
5636
|
+
const parent = ps.target.path.replace(/\/$/, "");
|
|
5637
|
+
const idx = parent.lastIndexOf("/");
|
|
5638
|
+
const newPath = (idx <= 0 ? "" : parent.substring(0, idx)) + "/" + name;
|
|
5639
|
+
await renamePath(props.sessionId, ps.target.path, newPath);
|
|
5640
|
+
toast.success(t("fileManager.renamed"));
|
|
5641
|
+
}
|
|
5642
|
+
promptState.value = null;
|
|
5643
|
+
await load();
|
|
5644
|
+
} catch (e) {
|
|
5645
|
+
toast.error(e?.message || String(e));
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
async function removeItem(item) {
|
|
5649
|
+
if (!await modal.confirm(t("fileManager.confirmDelete", { name: item.name }))) return;
|
|
5650
|
+
try {
|
|
5651
|
+
await removePath(props.sessionId, item.path);
|
|
5652
|
+
toast.success(t("fileManager.deleted"));
|
|
5653
|
+
await load();
|
|
5654
|
+
} catch (e) {
|
|
5655
|
+
toast.error(e?.message || String(e));
|
|
5656
|
+
}
|
|
5657
|
+
}
|
|
5658
|
+
async function removeSelected() {
|
|
5659
|
+
if (!selectedItems.value.length) return;
|
|
5660
|
+
if (!await modal.confirm(t("fileManager.confirmDeleteMulti", { count: selectedItems.value.length }))) return;
|
|
5661
|
+
for (const item of selectedItems.value) try {
|
|
5662
|
+
await removePath(props.sessionId, item.path);
|
|
5663
|
+
} catch (e) {
|
|
5664
|
+
toast.error(e?.message || String(e));
|
|
5665
|
+
}
|
|
5666
|
+
toast.success(t("fileManager.deleted"));
|
|
5667
|
+
await load();
|
|
5668
|
+
}
|
|
5669
|
+
function close() {
|
|
5670
|
+
emit("close");
|
|
5671
|
+
}
|
|
5672
|
+
function formatSize(bytes) {
|
|
5673
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
5674
|
+
const units = [
|
|
5675
|
+
"KB",
|
|
5676
|
+
"MB",
|
|
5677
|
+
"GB",
|
|
5678
|
+
"TB"
|
|
5679
|
+
];
|
|
5680
|
+
let size = bytes / 1024;
|
|
5681
|
+
let i = 0;
|
|
5682
|
+
while (size >= 1024 && i < units.length - 1) {
|
|
5683
|
+
size /= 1024;
|
|
5684
|
+
i++;
|
|
5685
|
+
}
|
|
5686
|
+
return `${size.toFixed(1)} ${units[i]}`;
|
|
5687
|
+
}
|
|
5688
|
+
function formatTime(ms) {
|
|
5689
|
+
if (!ms) return "—";
|
|
5690
|
+
const d = new Date(ms);
|
|
5691
|
+
if (isNaN(d.getTime())) return "—";
|
|
5692
|
+
return d.toLocaleString();
|
|
5693
|
+
}
|
|
5694
|
+
function iconFor(item) {
|
|
5695
|
+
if (item.isDirectory) return "📁";
|
|
5696
|
+
if (item.isSymbolicLink) return "🔗";
|
|
5697
|
+
return "📄";
|
|
5698
|
+
}
|
|
5699
|
+
function onKey(e) {
|
|
5700
|
+
if (e.key === "Escape") if (promptState.value) promptState.value = null;
|
|
5701
|
+
else close();
|
|
5702
|
+
}
|
|
5703
|
+
onMounted(async () => {
|
|
5704
|
+
window.addEventListener("keydown", onKey);
|
|
5705
|
+
selectedItems.value = [];
|
|
5706
|
+
if (props.initialPath) {
|
|
5707
|
+
currentPath.value = props.initialPath;
|
|
5708
|
+
await load();
|
|
5709
|
+
} else {
|
|
5710
|
+
try {
|
|
5711
|
+
currentPath.value = await getDefaultDir(props.sessionId) || "/";
|
|
5712
|
+
} catch {
|
|
5713
|
+
currentPath.value = "/";
|
|
5714
|
+
}
|
|
5715
|
+
await load();
|
|
5716
|
+
}
|
|
5717
|
+
});
|
|
5718
|
+
onBeforeUnmount(() => {
|
|
5719
|
+
window.removeEventListener("keydown", onKey);
|
|
5720
|
+
});
|
|
5721
|
+
return (_ctx, _cache) => {
|
|
5722
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
5723
|
+
createBaseVNode("div", _hoisted_2$5, [createBaseVNode("div", _hoisted_3$5, [_cache[7] || (_cache[7] = createBaseVNode("span", { class: "fm-icon" }, "🗂", -1)), createTextVNode(" " + toDisplayString(unref(t)("fileManager.title")), 1)]), createBaseVNode("div", _hoisted_4$5, [createBaseVNode("button", {
|
|
5724
|
+
class: "fm-btn fm-close",
|
|
5725
|
+
title: unref(t)("common.close"),
|
|
5726
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
|
|
5727
|
+
}, "✕", 8, _hoisted_5$5)])]),
|
|
5728
|
+
createBaseVNode("div", _hoisted_6$5, [
|
|
5729
|
+
createBaseVNode("button", {
|
|
5730
|
+
class: "fm-btn",
|
|
5731
|
+
disabled: !canGoUp.value,
|
|
5732
|
+
onClick: goUp
|
|
5733
|
+
}, "⬆ " + toDisplayString(unref(t)("fileManager.up")), 9, _hoisted_7$4),
|
|
5734
|
+
createBaseVNode("button", {
|
|
5735
|
+
class: "fm-btn",
|
|
5736
|
+
onClick: refresh
|
|
5737
|
+
}, "⟳ " + toDisplayString(unref(t)("fileManager.refresh")), 1),
|
|
5738
|
+
createBaseVNode("button", {
|
|
5739
|
+
class: "fm-btn",
|
|
5740
|
+
onClick: requestNewFolder
|
|
5741
|
+
}, "+ " + toDisplayString(unref(t)("fileManager.newFolder")), 1),
|
|
5742
|
+
createBaseVNode("button", {
|
|
5743
|
+
class: "fm-btn",
|
|
5744
|
+
onClick: onUploadClick
|
|
5745
|
+
}, "⬆ " + toDisplayString(unref(t)("fileManager.upload")), 1),
|
|
5746
|
+
createBaseVNode("button", {
|
|
5747
|
+
class: "fm-btn fm-danger",
|
|
5748
|
+
disabled: !selectedItems.value.length,
|
|
5749
|
+
onClick: removeSelected
|
|
5750
|
+
}, " 🗑 " + toDisplayString(unref(t)("fileManager.deleteSelected")) + " (" + toDisplayString(selectedItems.value.length) + ") ", 9, _hoisted_8$4),
|
|
5751
|
+
createBaseVNode("span", {
|
|
5752
|
+
class: "fm-cwd",
|
|
5753
|
+
title: currentPath.value
|
|
5754
|
+
}, toDisplayString(currentPath.value), 9, _hoisted_9$4)
|
|
5755
|
+
]),
|
|
5756
|
+
createBaseVNode("div", _hoisted_10$4, [createBaseVNode("span", {
|
|
5757
|
+
class: "fm-crumb",
|
|
5758
|
+
onClick: _cache[1] || (_cache[1] = ($event) => navigateTo(0))
|
|
5759
|
+
}, "/"), (openBlock(true), createElementBlock(Fragment, null, renderList(breadcrumbSegments.value, (seg, i) => {
|
|
5760
|
+
return openBlock(), createElementBlock(Fragment, { key: i }, [_cache[8] || (_cache[8] = createBaseVNode("span", { class: "fm-sep" }, "/", -1)), createBaseVNode("span", {
|
|
5761
|
+
class: "fm-crumb",
|
|
5762
|
+
onClick: ($event) => navigateTo(i + 1)
|
|
5763
|
+
}, toDisplayString(seg.name), 9, _hoisted_11$4)], 64);
|
|
5764
|
+
}), 128))]),
|
|
5765
|
+
createBaseVNode("div", {
|
|
5766
|
+
class: "fm-list",
|
|
5767
|
+
onDragover: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
|
|
5768
|
+
onDrop: withModifiers(onDrop, ["prevent"])
|
|
5769
|
+
}, [
|
|
5770
|
+
createBaseVNode("table", _hoisted_12$4, [createBaseVNode("thead", null, [createBaseVNode("tr", null, [
|
|
5771
|
+
createBaseVNode("th", _hoisted_13$4, [createBaseVNode("input", {
|
|
5772
|
+
type: "checkbox",
|
|
5773
|
+
checked: allSelected.value,
|
|
5774
|
+
onChange: toggleAll
|
|
5775
|
+
}, null, 40, _hoisted_14$4)]),
|
|
5776
|
+
createBaseVNode("th", null, toDisplayString(unref(t)("fileManager.name")), 1),
|
|
5777
|
+
createBaseVNode("th", _hoisted_15$4, toDisplayString(unref(t)("fileManager.size")), 1),
|
|
5778
|
+
createBaseVNode("th", _hoisted_16$4, toDisplayString(unref(t)("fileManager.modified")), 1),
|
|
5779
|
+
createBaseVNode("th", _hoisted_17$3, toDisplayString(unref(t)("fileManager.permissions")), 1),
|
|
5780
|
+
createBaseVNode("th", _hoisted_18$3, toDisplayString(unref(t)("fileManager.actions")), 1)
|
|
5781
|
+
])]), createBaseVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
|
|
5782
|
+
return openBlock(), createElementBlock("tr", {
|
|
5783
|
+
key: item.path,
|
|
5784
|
+
class: normalizeClass({ "fm-selected": isSelected(item) }),
|
|
5785
|
+
onClick: ($event) => toggleSelect(item),
|
|
5786
|
+
onDblclick: withModifiers(($event) => openItem(item), ["stop"])
|
|
5787
|
+
}, [
|
|
5788
|
+
createBaseVNode("td", _hoisted_20$3, [createBaseVNode("input", {
|
|
5789
|
+
type: "checkbox",
|
|
5790
|
+
checked: isSelected(item),
|
|
5791
|
+
onClick: withModifiers(($event) => toggleSelect(item), ["stop"])
|
|
5792
|
+
}, null, 8, _hoisted_21$3)]),
|
|
5793
|
+
createBaseVNode("td", _hoisted_22$3, [createBaseVNode("span", _hoisted_23$3, toDisplayString(iconFor(item)), 1), createBaseVNode("span", _hoisted_24$3, toDisplayString(item.name), 1)]),
|
|
5794
|
+
createBaseVNode("td", _hoisted_25$3, toDisplayString(item.isDirectory ? "—" : formatSize(item.size)), 1),
|
|
5795
|
+
createBaseVNode("td", _hoisted_26$2, toDisplayString(formatTime(item.mtime)), 1),
|
|
5796
|
+
createBaseVNode("td", _hoisted_27$2, toDisplayString(item.permissions), 1),
|
|
5797
|
+
createBaseVNode("td", _hoisted_28$2, [
|
|
5798
|
+
!item.isDirectory ? (openBlock(), createElementBlock("button", {
|
|
5799
|
+
key: 0,
|
|
5800
|
+
class: "fm-link",
|
|
5801
|
+
onClick: withModifiers(($event) => downloadItem(item), ["stop"])
|
|
5802
|
+
}, toDisplayString(unref(t)("fileManager.download")), 9, _hoisted_29$2)) : createCommentVNode("", true),
|
|
5803
|
+
createBaseVNode("button", {
|
|
5804
|
+
class: "fm-link",
|
|
5805
|
+
onClick: withModifiers(($event) => requestRename(item), ["stop"])
|
|
5806
|
+
}, toDisplayString(unref(t)("fileManager.rename")), 9, _hoisted_30$2),
|
|
5807
|
+
createBaseVNode("button", {
|
|
5808
|
+
class: "fm-link fm-link-danger",
|
|
5809
|
+
onClick: withModifiers(($event) => removeItem(item), ["stop"])
|
|
5810
|
+
}, toDisplayString(unref(t)("fileManager.delete")), 9, _hoisted_31$2)
|
|
5811
|
+
])
|
|
5812
|
+
], 42, _hoisted_19$3);
|
|
5813
|
+
}), 128)), !loading.value && !items.value.length ? (openBlock(), createElementBlock("tr", _hoisted_32$1, [createBaseVNode("td", _hoisted_33$1, toDisplayString(unref(t)("fileManager.empty")), 1)])) : createCommentVNode("", true)])]),
|
|
5814
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_34$1, toDisplayString(unref(t)("fileManager.loading")), 1)) : createCommentVNode("", true),
|
|
5815
|
+
uploading.value ? (openBlock(), createElementBlock("div", _hoisted_35$1, toDisplayString(unref(t)("fileManager.uploading", {
|
|
5816
|
+
current: uploadProgress.value.current,
|
|
5817
|
+
total: uploadProgress.value.total
|
|
5818
|
+
})), 1)) : createCommentVNode("", true),
|
|
5819
|
+
downloading.value ? (openBlock(), createElementBlock("div", _hoisted_36$1, toDisplayString(unref(t)("fileManager.downloading")), 1)) : createCommentVNode("", true)
|
|
5820
|
+
], 32),
|
|
5821
|
+
createBaseVNode("input", {
|
|
5822
|
+
ref_key: "fileInput",
|
|
5823
|
+
ref: fileInput,
|
|
5824
|
+
type: "file",
|
|
5825
|
+
multiple: "",
|
|
5826
|
+
hidden: "",
|
|
5827
|
+
onChange: onFileSelected
|
|
5828
|
+
}, null, 544),
|
|
5829
|
+
promptState.value ? (openBlock(), createElementBlock("div", {
|
|
5830
|
+
key: 0,
|
|
5831
|
+
class: "fm-prompt-mask",
|
|
5832
|
+
onClick: _cache[6] || (_cache[6] = withModifiers(($event) => promptState.value = null, ["self"]))
|
|
5833
|
+
}, [createBaseVNode("div", _hoisted_37$1, [
|
|
5834
|
+
createBaseVNode("div", _hoisted_38$1, toDisplayString(promptState.value.mode === "mkdir" ? unref(t)("fileManager.newFolderPrompt") : unref(t)("fileManager.renamePrompt")), 1),
|
|
5835
|
+
withDirectives(createBaseVNode("input", {
|
|
5836
|
+
ref_key: "promptInput",
|
|
5837
|
+
ref: promptInput,
|
|
5838
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => promptState.value.value = $event),
|
|
5839
|
+
class: "fm-prompt-input",
|
|
5840
|
+
onKeyup: [withKeys(confirmPrompt, ["enter"]), _cache[4] || (_cache[4] = withKeys(($event) => promptState.value = null, ["esc"]))]
|
|
5841
|
+
}, null, 544), [[vModelText, promptState.value.value]]),
|
|
5842
|
+
createBaseVNode("div", _hoisted_39$1, [createBaseVNode("button", {
|
|
5843
|
+
class: "fm-btn",
|
|
5844
|
+
onClick: confirmPrompt
|
|
5845
|
+
}, toDisplayString(unref(t)("common.confirm")), 1), createBaseVNode("button", {
|
|
5846
|
+
class: "fm-btn",
|
|
5847
|
+
onClick: _cache[5] || (_cache[5] = ($event) => promptState.value = null)
|
|
5848
|
+
}, toDisplayString(unref(t)("common.cancel")), 1)])
|
|
5849
|
+
])])) : createCommentVNode("", true)
|
|
5850
|
+
]);
|
|
5851
|
+
};
|
|
5852
|
+
}
|
|
5853
|
+
});
|
|
5854
|
+
}));
|
|
5855
|
+
//#endregion
|
|
5856
|
+
//#region src/components/file-manager.vue?vue&type=style&index=0&scoped=aa64e51d&lang.css
|
|
5857
|
+
var init_file_manager_vue_vue_type_style_index_0_scoped_aa64e51d_lang = __esmMin((() => {}));
|
|
5858
|
+
//#endregion
|
|
5859
|
+
//#region src/components/file-manager.vue
|
|
5860
|
+
var file_manager_default;
|
|
5861
|
+
var init_file_manager = __esmMin((() => {
|
|
5862
|
+
init_file_manager_vue_vue_type_script_setup_true_lang();
|
|
5863
|
+
init_file_manager_vue_vue_type_script_setup_true_lang();
|
|
5864
|
+
init_file_manager_vue_vue_type_style_index_0_scoped_aa64e51d_lang();
|
|
5865
|
+
init__plugin_vue_export_helper();
|
|
5866
|
+
file_manager_default = /* @__PURE__ */ _plugin_vue_export_helper_default(file_manager_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-aa64e51d"]]);
|
|
5235
5867
|
}));
|
|
5236
5868
|
//#endregion
|
|
5237
5869
|
//#region src/components/terminal-tab.vue?vue&type=script&setup=true&lang.ts
|
|
5238
|
-
var import_xterm, import_addon_fit, import_addon_web_links, _hoisted_1$4, _hoisted_2$4, _hoisted_3$4, _hoisted_4$4, _hoisted_5$4, MAX_RECONNECT_ATTEMPTS, RECONNECT_BASE_DELAY, AI_CHAT_MIN_WIDTH, AI_CHAT_MAX_WIDTH_RATIO, terminal_tab_vue_vue_type_script_setup_true_lang_default;
|
|
5870
|
+
var import_xterm, import_addon_fit, import_addon_web_links, _hoisted_1$4, _hoisted_2$4, _hoisted_3$4, _hoisted_4$4, _hoisted_5$4, _hoisted_6$4, FM_MIN_WIDTH, FM_MAX_WIDTH_RATIO, MAX_RECONNECT_ATTEMPTS, RECONNECT_BASE_DELAY, AI_CHAT_MIN_WIDTH, AI_CHAT_MAX_WIDTH_RATIO, terminal_tab_vue_vue_type_script_setup_true_lang_default;
|
|
5239
5871
|
var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
5240
5872
|
init_vue_runtime_esm_bundler();
|
|
5241
5873
|
init_vue_i18n();
|
|
@@ -5246,23 +5878,27 @@ var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
5246
5878
|
init_zmodem();
|
|
5247
5879
|
init_ai_chat();
|
|
5248
5880
|
init_file_transfer();
|
|
5881
|
+
init_file_manager();
|
|
5249
5882
|
_hoisted_1$4 = ["title"];
|
|
5250
|
-
_hoisted_2$4 =
|
|
5251
|
-
|
|
5883
|
+
_hoisted_2$4 = ["title"];
|
|
5884
|
+
_hoisted_3$4 = {
|
|
5885
|
+
key: 3,
|
|
5252
5886
|
class: "terminal-status"
|
|
5253
5887
|
};
|
|
5254
|
-
|
|
5255
|
-
key:
|
|
5888
|
+
_hoisted_4$4 = {
|
|
5889
|
+
key: 4,
|
|
5256
5890
|
class: "terminal-status text-danger"
|
|
5257
5891
|
};
|
|
5258
|
-
|
|
5259
|
-
key:
|
|
5892
|
+
_hoisted_5$4 = {
|
|
5893
|
+
key: 5,
|
|
5260
5894
|
class: "terminal-status text-secondary"
|
|
5261
5895
|
};
|
|
5262
|
-
|
|
5263
|
-
key:
|
|
5896
|
+
_hoisted_6$4 = {
|
|
5897
|
+
key: 6,
|
|
5264
5898
|
class: "terminal-status text-warning"
|
|
5265
5899
|
};
|
|
5900
|
+
FM_MIN_WIDTH = 280;
|
|
5901
|
+
FM_MAX_WIDTH_RATIO = .5;
|
|
5266
5902
|
MAX_RECONNECT_ATTEMPTS = 5;
|
|
5267
5903
|
RECONNECT_BASE_DELAY = 2e3;
|
|
5268
5904
|
AI_CHAT_MIN_WIDTH = 280;
|
|
@@ -5290,6 +5926,28 @@ var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
5290
5926
|
const errorMessage = ref("");
|
|
5291
5927
|
const showAIChat = ref(false);
|
|
5292
5928
|
const aiChatRef = ref();
|
|
5929
|
+
const showFileManager = ref(false);
|
|
5930
|
+
const fmWidth = ref(360);
|
|
5931
|
+
function startFmResize(e) {
|
|
5932
|
+
e.preventDefault();
|
|
5933
|
+
const startX = e.clientX;
|
|
5934
|
+
const startWidth = fmWidth.value;
|
|
5935
|
+
const maxWidth = (terminalWrapper.value?.clientWidth || 800) * FM_MAX_WIDTH_RATIO;
|
|
5936
|
+
const onMouseMove = (ev) => {
|
|
5937
|
+
const delta = ev.clientX - startX;
|
|
5938
|
+
fmWidth.value = Math.min(Math.max(startWidth + delta, FM_MIN_WIDTH), maxWidth);
|
|
5939
|
+
};
|
|
5940
|
+
const onMouseUp = () => {
|
|
5941
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
5942
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
5943
|
+
document.body.style.cursor = "";
|
|
5944
|
+
document.body.style.userSelect = "";
|
|
5945
|
+
};
|
|
5946
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
5947
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
5948
|
+
document.body.style.cursor = "col-resize";
|
|
5949
|
+
document.body.style.userSelect = "none";
|
|
5950
|
+
}
|
|
5293
5951
|
/** 显示文件传输浮动面板 */
|
|
5294
5952
|
function showFileTransfer(info) {
|
|
5295
5953
|
const termRef = {
|
|
@@ -6066,6 +6724,17 @@ var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
6066
6724
|
ref_key: "terminalWrapper",
|
|
6067
6725
|
ref: terminalWrapper
|
|
6068
6726
|
}, [
|
|
6727
|
+
showFileManager.value && status.value === "connected" ? (openBlock(), createElementBlock("div", {
|
|
6728
|
+
key: 0,
|
|
6729
|
+
class: "file-manager-wrapper",
|
|
6730
|
+
style: normalizeStyle({ width: fmWidth.value + "px" })
|
|
6731
|
+
}, [createBaseVNode("div", {
|
|
6732
|
+
class: "fm-resize-handle",
|
|
6733
|
+
onMousedown: startFmResize
|
|
6734
|
+
}, null, 32), createVNode(file_manager_default, {
|
|
6735
|
+
sessionId: unref(sessionId) || __props.tabId,
|
|
6736
|
+
onClose: _cache[0] || (_cache[0] = ($event) => showFileManager.value = false)
|
|
6737
|
+
}, null, 8, ["sessionId"])], 4)) : createCommentVNode("", true),
|
|
6069
6738
|
createBaseVNode("div", {
|
|
6070
6739
|
class: "terminal-container",
|
|
6071
6740
|
ref_key: "terminalContainer",
|
|
@@ -6076,12 +6745,19 @@ var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
6076
6745
|
ref: fileTransferRef
|
|
6077
6746
|
}, null, 512),
|
|
6078
6747
|
status.value === "connected" ? (openBlock(), createElementBlock("button", {
|
|
6079
|
-
key:
|
|
6748
|
+
key: 1,
|
|
6080
6749
|
class: normalizeClass(["ai-toggle-btn", { active: showAIChat.value }]),
|
|
6081
6750
|
style: normalizeStyle(showAIChat.value ? { right: aiChatWidth.value + 12 + "px" } : {}),
|
|
6082
6751
|
onClick: toggleAIChat,
|
|
6083
6752
|
title: unref(t)("ai.chat")
|
|
6084
|
-
}, [..._cache[
|
|
6753
|
+
}, [..._cache[5] || (_cache[5] = [createBaseVNode("i", { class: "bi bi-robot" }, null, -1)])], 14, _hoisted_1$4)) : createCommentVNode("", true),
|
|
6754
|
+
status.value === "connected" ? (openBlock(), createElementBlock("button", {
|
|
6755
|
+
key: 2,
|
|
6756
|
+
class: normalizeClass(["ai-toggle-btn", { active: showFileManager.value }]),
|
|
6757
|
+
style: normalizeStyle(showAIChat.value ? { right: aiChatWidth.value + 52 + "px" } : { right: "52px" }),
|
|
6758
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showFileManager.value = !showFileManager.value),
|
|
6759
|
+
title: unref(t)("fileManager.title")
|
|
6760
|
+
}, [..._cache[6] || (_cache[6] = [createBaseVNode("i", { class: "bi bi-folder2-open" }, null, -1)])], 14, _hoisted_2$4)) : createCommentVNode("", true),
|
|
6085
6761
|
withDirectives(createBaseVNode("div", {
|
|
6086
6762
|
class: "ai-chat-wrapper",
|
|
6087
6763
|
style: normalizeStyle({ width: aiChatWidth.value + "px" }),
|
|
@@ -6098,58 +6774,58 @@ var init_terminal_tab_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
6098
6774
|
connectionId: props.connection.id,
|
|
6099
6775
|
isOpen: showAIChat.value,
|
|
6100
6776
|
getTerminalContext,
|
|
6101
|
-
onClose: _cache[
|
|
6777
|
+
onClose: _cache[2] || (_cache[2] = ($event) => showAIChat.value = false),
|
|
6102
6778
|
onWsSend: handleAISend,
|
|
6103
|
-
onOpenSettings: _cache[
|
|
6779
|
+
onOpenSettings: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("open-ai-settings"))
|
|
6104
6780
|
}, null, 8, [
|
|
6105
6781
|
"sessionId",
|
|
6106
6782
|
"sessionName",
|
|
6107
6783
|
"connectionId",
|
|
6108
6784
|
"isOpen"
|
|
6109
6785
|
])], 4), [[vShow, showAIChat.value]]),
|
|
6110
|
-
status.value === "connecting" ? (openBlock(), createElementBlock("div",
|
|
6111
|
-
status.value === "error" ? (openBlock(), createElementBlock("div",
|
|
6112
|
-
status.value === "disconnected" ? (openBlock(), createElementBlock("div",
|
|
6113
|
-
_cache[
|
|
6786
|
+
status.value === "connecting" ? (openBlock(), createElementBlock("div", _hoisted_3$4, [_cache[7] || (_cache[7] = createBaseVNode("div", { class: "spinner-border spinner-border-sm text-warning me-2" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("tab.connecting")), 1)])) : createCommentVNode("", true),
|
|
6787
|
+
status.value === "error" ? (openBlock(), createElementBlock("div", _hoisted_4$4, [_cache[8] || (_cache[8] = createBaseVNode("i", { class: "bi bi-exclamation-triangle me-2" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("tab.connectionFailed")) + ": " + toDisplayString(errorMessage.value), 1)])) : createCommentVNode("", true),
|
|
6788
|
+
status.value === "disconnected" ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
|
|
6789
|
+
_cache[10] || (_cache[10] = createBaseVNode("i", { class: "bi bi-wifi-off me-2" }, null, -1)),
|
|
6114
6790
|
createTextVNode(" " + toDisplayString(unref(t)("tab.disconnected")) + " ", 1),
|
|
6115
6791
|
createBaseVNode("button", {
|
|
6116
6792
|
class: "btn btn-sm btn-outline-light ms-3",
|
|
6117
6793
|
onClick: reconnect
|
|
6118
|
-
}, [_cache[
|
|
6794
|
+
}, [_cache[9] || (_cache[9] = createBaseVNode("i", { class: "bi bi-arrow-clockwise me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("tab.reconnect")), 1)])
|
|
6119
6795
|
])) : createCommentVNode("", true),
|
|
6120
|
-
status.value === "reconnecting" ? (openBlock(), createElementBlock("div",
|
|
6796
|
+
status.value === "reconnecting" ? (openBlock(), createElementBlock("div", _hoisted_6$4, [_cache[11] || (_cache[11] = createBaseVNode("div", { class: "spinner-border spinner-border-sm text-warning me-2" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("tab.reconnecting")), 1)])) : createCommentVNode("", true),
|
|
6121
6797
|
contextMenuVisible.value ? (openBlock(), createElementBlock("div", {
|
|
6122
|
-
key:
|
|
6798
|
+
key: 7,
|
|
6123
6799
|
class: "terminal-context-menu",
|
|
6124
6800
|
style: normalizeStyle({
|
|
6125
6801
|
left: contextMenuX.value + "px",
|
|
6126
6802
|
top: contextMenuY.value + "px"
|
|
6127
6803
|
}),
|
|
6128
|
-
onClick: _cache[
|
|
6804
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
|
|
6129
6805
|
}, [createBaseVNode("div", {
|
|
6130
6806
|
class: "context-menu-item",
|
|
6131
6807
|
onClick: handleContextCopy
|
|
6132
|
-
}, [_cache[
|
|
6808
|
+
}, [_cache[12] || (_cache[12] = createBaseVNode("i", { class: "bi bi-clipboard" }, null, -1)), createTextVNode(toDisplayString(unref(t)("context.copy") || "Copy"), 1)]), createBaseVNode("div", {
|
|
6133
6809
|
class: "context-menu-item",
|
|
6134
6810
|
onClick: handleContextPaste
|
|
6135
|
-
}, [_cache[
|
|
6811
|
+
}, [_cache[13] || (_cache[13] = createBaseVNode("i", { class: "bi bi-clipboard-check" }, null, -1)), createTextVNode(toDisplayString(unref(t)("context.paste") || "Paste"), 1)])], 4)) : createCommentVNode("", true)
|
|
6136
6812
|
], 512);
|
|
6137
6813
|
};
|
|
6138
6814
|
}
|
|
6139
6815
|
});
|
|
6140
6816
|
}));
|
|
6141
6817
|
//#endregion
|
|
6142
|
-
//#region src/components/terminal-tab.vue?vue&type=style&index=0&scoped=
|
|
6143
|
-
var
|
|
6818
|
+
//#region src/components/terminal-tab.vue?vue&type=style&index=0&scoped=66af4892&lang.css
|
|
6819
|
+
var init_terminal_tab_vue_vue_type_style_index_0_scoped_66af4892_lang = __esmMin((() => {}));
|
|
6144
6820
|
//#endregion
|
|
6145
6821
|
//#region src/components/terminal-tab.vue
|
|
6146
6822
|
var terminal_tab_default;
|
|
6147
6823
|
var init_terminal_tab = __esmMin((() => {
|
|
6148
6824
|
init_terminal_tab_vue_vue_type_script_setup_true_lang();
|
|
6149
6825
|
init_terminal_tab_vue_vue_type_script_setup_true_lang();
|
|
6150
|
-
|
|
6826
|
+
init_terminal_tab_vue_vue_type_style_index_0_scoped_66af4892_lang();
|
|
6151
6827
|
init__plugin_vue_export_helper();
|
|
6152
|
-
terminal_tab_default = /* @__PURE__ */ _plugin_vue_export_helper_default(terminal_tab_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
6828
|
+
terminal_tab_default = /* @__PURE__ */ _plugin_vue_export_helper_default(terminal_tab_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-66af4892"]]);
|
|
6153
6829
|
}));
|
|
6154
6830
|
//#endregion
|
|
6155
6831
|
//#region src/components/connection-editor/index.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -7548,8 +8224,8 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
7548
8224
|
});
|
|
7549
8225
|
}));
|
|
7550
8226
|
//#endregion
|
|
7551
|
-
//#region src/views/index.vue?vue&type=style&index=0&scoped=
|
|
7552
|
-
var
|
|
8227
|
+
//#region src/views/index.vue?vue&type=style&index=0&scoped=1c14a0a5&lang.css
|
|
8228
|
+
var init_index_vue_vue_type_style_index_0_scoped_1c14a0a5_lang = __esmMin((() => {}));
|
|
7553
8229
|
//#endregion
|
|
7554
8230
|
//#region src/views/index.vue
|
|
7555
8231
|
var views_default;
|
|
@@ -7557,8 +8233,8 @@ var views_default;
|
|
|
7557
8233
|
__esmMin((() => {
|
|
7558
8234
|
init_index_vue_vue_type_script_setup_true_lang();
|
|
7559
8235
|
init_index_vue_vue_type_script_setup_true_lang();
|
|
7560
|
-
|
|
8236
|
+
init_index_vue_vue_type_style_index_0_scoped_1c14a0a5_lang();
|
|
7561
8237
|
init__plugin_vue_export_helper();
|
|
7562
|
-
views_default = /* @__PURE__ */ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
8238
|
+
views_default = /* @__PURE__ */ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-1c14a0a5"]]);
|
|
7563
8239
|
}))();
|
|
7564
8240
|
export { views_default as default };
|