zen-gitsync 2.18.11 → 2.18.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/package.json +6 -1
- package/src/ui/public/assets/AgentView-CVbcrngz.js +11 -0
- package/src/ui/public/assets/{AgentView-CbBLjlfr.css → AgentView-D6MJOrJt.css} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-CrDf0lYs.js → AppVersionBadge-7gFB6t_t.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-DEHLVln4.js → BranchSelector-BIRNxA6U.js} +1 -1
- package/src/ui/public/assets/{CommitForm-D2rVFZf2.js → CommitForm-CWpaazi7.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-CV7T8OCb.js → CommonDialog-DrxsmpDL.js} +1 -1
- package/src/ui/public/assets/CopySessionButton-C_01fcd3.js +21 -0
- package/src/ui/public/assets/EditorView-B7Rq9QV1.css +1 -0
- package/src/ui/public/assets/EditorView-D80wG480.js +37 -0
- package/src/ui/public/assets/{FlowExecutionViewer-D7FaZSHd.js → FlowExecutionViewer-Ce4Q5ia6.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-BR3cPhyU.js → FlowOrchestrationWorkspace-Cq1zEt5K.js} +1 -1
- package/src/ui/public/assets/{LogList-D_Q3pyMF.js → LogList-DtmJG27U.js} +1 -1
- package/src/ui/public/assets/{MindmapView-A4QZ6_c3.js → MindmapView-BR2_C4Du.js} +1 -1
- package/src/ui/public/assets/{MonitorView-BljWw76B.js → MonitorView-Cs_kwPBu.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-Be5DovFL.js → ProjectStartupButton-BfQJ0i5X.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-DN7ruCU7.js → RecentDirectoriesChat-_gNQGqkM.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-BSCNy4RC.js → RemoteManagerDialog-KY5I3Ftv.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-CeCRQp9p.js → RemoteRepoCard-BUgdGtwC.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-B_S-vspy.js → SourceMapView-RkGgdvnN.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-9IbiSszR.js → SvgIcon-CP7WAT4C.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-DASGnUCl.js → UserInputNode-CwSqPh4O.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-CBfccRIP.js +320 -0
- package/src/ui/public/assets/WorkbenchView-DzBtCzay.css +1 -0
- package/src/ui/public/assets/_plugin-vue_export-helper-BY0jlMBE.js +19 -0
- package/src/ui/public/assets/{agentConversations-Cplq42kA.js → agentConversations-CC01a7SP.js} +6 -6
- package/src/ui/public/assets/{configStore-Z6Z8hVMO.js → configStore-EvRYufor.js} +1 -1
- package/src/ui/public/assets/{dagre-CiGYsZhd.js → dagre-Ct-SQ-7k.js} +3 -3
- package/src/ui/public/assets/{element-plus-CJqN49tX.js → element-plus-CDrtgG55.js} +1 -1
- package/src/ui/public/assets/{flow-mindmap-C-X_QPQI.js → flow-mindmap-C8x6ucsA.js} +1 -1
- package/src/ui/public/assets/{index-C90dYckz.js → index-CyEcaEC9.js} +46 -46
- package/src/ui/public/assets/{monaco-CbN14ZVi.js → monaco-BV4P06MT.js} +1 -1
- package/src/ui/public/assets/{office-docx-8MF5-THx.js → office-docx-B8BoOvth.js} +1 -1
- package/src/ui/public/assets/{office-excel-BTzQyK6y.js → office-excel-CFRkxKv8.js} +1 -1
- package/src/ui/public/assets/{office-pptx-DhxvWA0D.js → office-pptx-DXdbDvLM.js} +1 -1
- package/src/ui/public/assets/useOrchestrator-C8BD2JSO.js +1 -0
- package/src/ui/public/assets/{vendor-Bd8DyOF9.css → vendor-CSFGMcMB.css} +1 -1
- package/src/ui/public/assets/{vendor-Cd7TGb0b.js → vendor-DYtaPSUU.js} +4 -4
- package/src/ui/public/assets/{vue-flow-x4TlHHzT.js → vue-flow-B7Hdmt-y.js} +1 -1
- package/src/ui/public/index.html +12 -12
- package/src/ui/server/routes/fileOpen.js +85 -16
- package/src/ui/server/routes/workbench/agentChatShared.test.js +0 -1
- package/src/ui/server/routes/workbench/dispatchInstruction.js +6 -7
- package/src/ui/server/routes/workbench/dispatchInstruction.test.js +3 -19
- package/src/ui/server/routes/workbench/index.js +6 -16
- package/src/ui/server/routes/workbench/orchestratorPrompt.test.js +2 -2
- package/src/ui/server/routes/workbench/orchestratorStore.js +2 -16
- package/src/ui/server/routes/workbench/projectRegistry.test.js +1 -5
- package/src/ui/server/routes/workbench/shared.js +1 -1
- package/src/ui/public/assets/AgentView-D3I3D3YR.js +0 -11
- package/src/ui/public/assets/CopySessionButton-BbVtrOa7.js +0 -21
- package/src/ui/public/assets/EditorView-BiNRO222.css +0 -1
- package/src/ui/public/assets/EditorView-CiW0kkpS.js +0 -37
- package/src/ui/public/assets/WorkbenchView-B3v-0vWa.js +0 -305
- package/src/ui/public/assets/WorkbenchView-DO2ndsES.css +0 -1
- package/src/ui/public/assets/_plugin-vue_export-helper-zp6tdw8N.js +0 -19
- package/src/ui/public/assets/useOrchestrator-C3wjJ7p4.js +0 -1
|
@@ -111,7 +111,6 @@ import {
|
|
|
111
111
|
} from './dispatchInstruction.js';
|
|
112
112
|
import {
|
|
113
113
|
readOrchestrator,
|
|
114
|
-
setOrchestratorActive,
|
|
115
114
|
setDefaultPrompt,
|
|
116
115
|
setProjectPrompt,
|
|
117
116
|
buildActivityFeed,
|
|
@@ -1068,15 +1067,15 @@ export function registerWorkbenchRoutes({
|
|
|
1068
1067
|
// GET /api/workbench/projects 项目清单 + 看板任务
|
|
1069
1068
|
// GET /api/workbench/project-icon 项目自己的图标(favicon)
|
|
1070
1069
|
// POST /api/workbench/projects/remove 从清单里移除一个项目条目
|
|
1071
|
-
// GET /api/workbench/orchestrator
|
|
1072
|
-
// POST /api/workbench/orchestrator/state 暂停 / 恢复调度
|
|
1070
|
+
// GET /api/workbench/orchestrator 指令存档 + 活动流 + 预设提示词
|
|
1073
1071
|
// POST /api/workbench/orchestrator/dispatch 派发一条人类干预指令
|
|
1074
1072
|
// POST /api/workbench/orchestrator/default-prompt 写全局预设提示词
|
|
1075
1073
|
// POST /api/workbench/orchestrator/project-prompt 写某个项目的预设提示词
|
|
1076
1074
|
//
|
|
1077
|
-
//
|
|
1078
|
-
//
|
|
1079
|
-
//
|
|
1075
|
+
// 派发与否由调用方给的 autoRun 决定(控制台那个"只建任务不执行"的勾选、
|
|
1076
|
+
// 或内置智能体调 dispatch_task 时自己传的值)。**没有**一个全局的
|
|
1077
|
+
// "暂停派发"总开关 —— 2026-10-14 连同它的 UI 一起删了:它唯一的作用是
|
|
1078
|
+
// 让派发出去的活不执行,而派发这个动作本身就是"要它跑"的意思。
|
|
1080
1079
|
// ════════════════════════════════════════════════════════════════════════
|
|
1081
1080
|
|
|
1082
1081
|
/**
|
|
@@ -1376,7 +1375,6 @@ export function registerWorkbenchRoutes({
|
|
|
1376
1375
|
const jobsSnap = snapshotJobs();
|
|
1377
1376
|
res.json({
|
|
1378
1377
|
success: true,
|
|
1379
|
-
active: state.active,
|
|
1380
1378
|
updatedAt: state.updatedAt,
|
|
1381
1379
|
// ⚠️ 这个接口是 5s 轮询的。指令正文在**下发这一份**里被截到
|
|
1382
1380
|
// INSTRUCTION_PREVIEW_CHARS(落盘那份不截,见 shared.js 的注释)。
|
|
@@ -1601,14 +1599,6 @@ export function registerWorkbenchRoutes({
|
|
|
1601
1599
|
}, REPORT_TICK_MS);
|
|
1602
1600
|
stallTimer.unref?.();
|
|
1603
1601
|
|
|
1604
|
-
app.post('/api/workbench/orchestrator/state', asyncRoute(async (req, res) => {
|
|
1605
|
-
const active = req.body?.active;
|
|
1606
|
-
if (typeof active !== 'boolean') throw new HttpError(400, 'active 必须是布尔值');
|
|
1607
|
-
const state = await setOrchestratorActive(active);
|
|
1608
|
-
publish('orchestrator:state', { active: state.active, updatedAt: state.updatedAt });
|
|
1609
|
-
res.json({ success: true, active: state.active, updatedAt: state.updatedAt });
|
|
1610
|
-
}));
|
|
1611
|
-
|
|
1612
1602
|
/** 提示词参数校验:空串是合法值(= 清除),只拦超长与非字符串 */
|
|
1613
1603
|
function assertPromptText(prompt) {
|
|
1614
1604
|
if (typeof prompt !== 'string') throw new HttpError(400, 'prompt 必须是字符串');
|
|
@@ -1670,7 +1660,7 @@ export function registerWorkbenchRoutes({
|
|
|
1670
1660
|
* body: { text, projectPath?, autoRun?, useDefaultPrompt?, executor?, attachments? }
|
|
1671
1661
|
* - projectPath 缺省 -> 交给 targetResolver 判断落到哪个项目(显式指定 > 指令里点名
|
|
1672
1662
|
* > 主 Agent 判断 > 应用当前项目)。用户不必先选项目,落点会如实记进指令流水
|
|
1673
|
-
* - autoRun 默认 true
|
|
1663
|
+
* - autoRun 默认 true;false = 只建任务不执行
|
|
1674
1664
|
*
|
|
1675
1665
|
* 一条指令落成目标项目下的一个任务:整段指令就是那次会话的 prompt。
|
|
1676
1666
|
*
|
|
@@ -29,7 +29,7 @@ import { MAX_DEFAULT_PROMPT_CHARS, INSTRUCTION_PREVIEW_CHARS } from './shared.js
|
|
|
29
29
|
|
|
30
30
|
/** 造一份最小可用的编排状态(字段与 normalizeOrchestrator 的输出对齐) */
|
|
31
31
|
function stateWith({ defaultPrompt = '', projectPrompts = {} } = {}) {
|
|
32
|
-
return { version: 1,
|
|
32
|
+
return { version: 1, updatedAt: null, instructions: [], defaultPrompt, projectPrompts };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const KEY = 'd:\\ws\\alpha';
|
|
@@ -115,7 +115,7 @@ test('拼出来的正文永远不会超过任务提示词字段的上限', () =>
|
|
|
115
115
|
// ── 归一化:磁盘上的脏数据不能让编排台打不开 ──────────────────────────
|
|
116
116
|
|
|
117
117
|
test('normalizeOrchestrator:字段全缺时给出空提示词与空表', () => {
|
|
118
|
-
const s = normalizeOrchestrator({
|
|
118
|
+
const s = normalizeOrchestrator({ instructions: [] });
|
|
119
119
|
assert.equal(s.defaultPrompt, '');
|
|
120
120
|
assert.deepEqual(s.projectPrompts, {});
|
|
121
121
|
});
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
// 主 Agent 编排台的状态存储 + 活动流拼装。
|
|
16
16
|
//
|
|
17
17
|
// 四件事:
|
|
18
|
-
// 1.
|
|
19
|
-
// 「暂停调度」是服务端强制的:暂停期间自动派发会被拒绝(手动点执行不受影响)。
|
|
18
|
+
// 1. 人类干预指令存档,持久化到 ~/.zen-gitsync/orchestrator.json。
|
|
20
19
|
// 2. 派发预设提示词:一条全局的 + 每个项目一条的,同样存在 orchestrator.json。
|
|
21
20
|
// 它们是「派发时自动附加的约束」,不是任务内容 —— 解析规则见 resolveDispatchPrompt。
|
|
22
21
|
// 3. 进度报告:自动报告的间隔配置存在 orchestrator.json(一个数字,跟着轮询下发),
|
|
@@ -61,11 +60,10 @@ export const MAX_ACTIVITY_ENTRIES = 120;
|
|
|
61
60
|
/** 预设提示词的三种来源。前端据此说明"这条指令附带了什么" */
|
|
62
61
|
export const PROMPT_SOURCES = ['global', 'project', 'both'];
|
|
63
62
|
|
|
64
|
-
/**
|
|
63
|
+
/** 默认状态 */
|
|
65
64
|
function defaultState() {
|
|
66
65
|
return {
|
|
67
66
|
version: 1,
|
|
68
|
-
active: true,
|
|
69
67
|
updatedAt: null,
|
|
70
68
|
instructions: [],
|
|
71
69
|
defaultPrompt: '',
|
|
@@ -136,8 +134,6 @@ export function normalizeOrchestrator(raw) {
|
|
|
136
134
|
const instructions = Array.isArray(state.instructions) ? state.instructions : [];
|
|
137
135
|
return {
|
|
138
136
|
version: 1,
|
|
139
|
-
// 只有显式 false 才算暂停;其余(缺字段 / 脏值)一律当调度中
|
|
140
|
-
active: state.active === false ? false : true,
|
|
141
137
|
updatedAt: typeof state.updatedAt === 'string' ? state.updatedAt : base.updatedAt,
|
|
142
138
|
instructions: instructions
|
|
143
139
|
.filter(x => x && typeof x === 'object')
|
|
@@ -174,16 +170,6 @@ async function persist(state) {
|
|
|
174
170
|
return state;
|
|
175
171
|
}
|
|
176
172
|
|
|
177
|
-
/** 暂停 / 恢复调度 */
|
|
178
|
-
export async function setOrchestratorActive(active) {
|
|
179
|
-
return serialize(async () => {
|
|
180
|
-
const state = await readOrchestrator();
|
|
181
|
-
state.active = !!active;
|
|
182
|
-
state.updatedAt = nowIso();
|
|
183
|
-
return persist(state);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
173
|
// ── 派发预设提示词 ──────────────────────────────────────────────────────
|
|
188
174
|
// 两级:全局一条(所有项目都附带)+ 每个项目一条(只在该项目派发时附带)。
|
|
189
175
|
// 存两份而不是"项目级覆盖全局",是刻意的:全局那一条写的是"每次派发都要守的规矩",
|
|
@@ -468,12 +468,8 @@ test('decorateTaskForBoard: 没跑过 / 那次没写正文时 lastReply 是空
|
|
|
468
468
|
|
|
469
469
|
test('normalizeOrchestrator: 缺字段/脏数据都要能起来', () => {
|
|
470
470
|
const fresh = normalizeOrchestrator(null);
|
|
471
|
-
assert.equal(fresh.active, true); // 缺省是"调度中"
|
|
472
471
|
assert.deepEqual(fresh.instructions, []);
|
|
473
472
|
|
|
474
|
-
assert.equal(normalizeOrchestrator({ active: false }).active, false);
|
|
475
|
-
assert.equal(normalizeOrchestrator({ active: 'no' }).active, true); // 只有显式 false 才算暂停
|
|
476
|
-
|
|
477
473
|
const withJunk = normalizeOrchestrator({ instructions: [null, 5, { text: 'hi' }] });
|
|
478
474
|
assert.equal(withJunk.instructions.length, 1);
|
|
479
475
|
assert.equal(withJunk.instructions[0].text, 'hi');
|
|
@@ -535,7 +531,7 @@ test('buildActivityFeed: 只吸收指令后的首次起跑,手动重跑仍保
|
|
|
535
531
|
});
|
|
536
532
|
|
|
537
533
|
test('buildActivityFeed: 指令还没跑起来时,起跑行照旧保留给别的 job', () => {
|
|
538
|
-
//
|
|
534
|
+
// 指令建了任务但没执行(派发时 autoRun=false)——此时该任务的任何起跑都不是它带起来的
|
|
539
535
|
const jobs = [{ id: 'j1', taskId: 't1', status: 'done', startedAt: '2026-01-01T00:00:00Z', endedAt: '2026-01-01T00:05:00Z' }];
|
|
540
536
|
const tasks = [{ id: 't1', title: '手跑的', projectPath: 'D:\\a' }];
|
|
541
537
|
const instructions = [{
|
|
@@ -51,7 +51,7 @@ export const DEFAULT_JOBS_CONFIG = { maxCount: 500, maxSizeMB: 256 };
|
|
|
51
51
|
// 每进程一个文件同时也消掉了多进程 read-modify-write 的丢更新(同 instances/ 的理由)。
|
|
52
52
|
export const LIVE_JOBS_DIR = path.join(DATA_DIR, 'live-jobs');
|
|
53
53
|
|
|
54
|
-
// 主 Agent
|
|
54
|
+
// 主 Agent 编排台:人类干预指令存档 + 派发预设提示词 + 进度报告配置。
|
|
55
55
|
// 指令存档是「我说过什么」的流水,不参与执行逻辑,只用于控制台日志流回放。
|
|
56
56
|
export const ORCHESTRATOR_FILE = path.join(DATA_DIR, 'orchestrator.json');
|
|
57
57
|
export const MAX_ORCHESTRATOR_INSTRUCTIONS = 200;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$t as e,An as t,At as n,Ct as r,Dn as i,En as a,Fn as o,Gn as s,Gt as c,Ht as l,Ir as u,J as d,Jn as f,Jt as p,Ln as m,M as h,On as g,Pn as _,Qn as v,Sn as y,Tt as b,Vn as x,W as S,Xn as C,Yr as w,Yt as T,Zr as E,_n as D,a as O,an as k,dn as A,er as j,et as M,gn as N,i as P,j as F,kn as I,kt as ee,lr as L,lt as R,mn as z,mr as B,mt as te,r as ne,rr as re,sr as V,st as ie,ti as H,tt as ae,ur as U,vn as W,xr as G,yr as oe}from"./element-plus-CJqN49tX.js";import{a as se,r as ce}from"./vendor-Cd7TGb0b.js";import{n as K,t as q}from"./_plugin-vue_export-helper-zp6tdw8N.js";import{t as le}from"./configStore-Z6Z8hVMO.js";import{t as ue}from"./CommonDialog-CV7T8OCb.js";import{J as de,b as fe,q as pe}from"./index-C90dYckz.js";import{a as me,c as he,i as ge,l as _e,m as ve,n as ye,o as be,r as xe,s as Se,t as Ce,u as we}from"./agentConversations-Cplq42kA.js";import{l as Te,s as Ee,t as De}from"./CopySessionButton-BbVtrOa7.js";import{t as Oe}from"./useOrchestrator-C3wjJ7p4.js";async function J(e,t){let n=await fetch(e,{headers:{"Content-Type":`application/json`},...t}),r={};try{r=await n.json()}catch{}if(!n.ok||r.success===!1)throw Error(r.error||`请求失败 (${n.status})`);return r}async function ke(){let e=await J(`/api/schedules`);return Array.isArray(e.tasks)?e.tasks:[]}async function Ae(e){return(await J(`/api/schedules`,{method:`POST`,body:JSON.stringify(e)})).task}async function je(e,t){return(await J(`/api/schedules/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(t)})).task}async function Me(e){await J(`/api/schedules/${encodeURIComponent(e)}`,{method:`DELETE`})}async function Y(e){await J(`/api/schedules/${encodeURIComponent(e)}/run`,{method:`POST`})}async function Ne(e){await J(`/api/schedules/${encodeURIComponent(e)}/stop`,{method:`POST`})}function Pe(e){if(typeof EventSource>`u`)return()=>{};let t=new EventSource(`/api/schedules/events`);return t.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>t.close()}var X=e=>/^\d+$/.test(e)?Number(e):null;function Fe(e){let t=String(e||``).trim(),n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=X(r),l=X(i);if(t===`* * * * *`)return{kind:`every-minute`,raw:t};let u=r.match(/^\*\/(\d+)$/);if(u&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return{kind:`every-n-minutes`,n:Number(u[1]),raw:t};if(c!==null&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return{kind:`hourly`,minute:c,raw:t};if(c!==null&&l!==null&&a===`*`&&o===`*`&&s===`*`)return{kind:`daily`,hour:l,minute:c,raw:t};let d=X(s);if(c!==null&&l!==null&&a===`*`&&o===`*`&&d!==null)return{kind:`weekly`,weekday:d%7,hour:l,minute:c,raw:t};let f=X(a);return c!==null&&l!==null&&f!==null&&o===`*`&&s===`*`?{kind:`monthly`,day:f,hour:l,minute:c,raw:t}:{kind:`custom`,raw:t}}var Z=e=>String(e).padStart(2,`0`),Q=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function Ie(e,t=new Date){if(!e)return{kind:`none`};let n=new Date(e);if(Number.isNaN(n.getTime()))return{kind:`none`};let r=`${Z(n.getHours())}:${Z(n.getMinutes())}`,i=Math.round((Q(n)-Q(t))/864e5);return i<0?{kind:`date`,date:`${n.getMonth()+1}-${Z(n.getDate())}`,time:r}:i===0?{kind:`today`,time:r}:i===1?{kind:`tomorrow`,time:r}:i<7?{kind:`weekday`,weekday:n.getDay(),time:r}:{kind:`date`,date:`${n.getMonth()+1}-${Z(n.getDate())}`,time:r}}function $(e){switch(e){case`ok`:return`ok`;case`error`:case`timed-out`:return`error`;case`skipped-busy`:case`missed`:case`cancelled`:return`skipped`;default:return`pending`}}function Le(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`<1s`;let n=Math.round(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m${Z(n%60)}s`:`${Math.floor(r/60)}h${Z(r%60)}m`}function Re(e){let t=Math.min(59,Math.max(0,Math.floor(e.minute))),n=Math.min(23,Math.max(0,Math.floor(e.hour))),r=(Math.floor(e.weekday)%7+7)%7;switch(e.freq){case`minutes`:return`*/${Math.min(59,Math.max(1,Math.floor(e.everyMinutes??30)))} * * * *`;case`hourly`:return`${t} * * * *`;case`daily`:return`${t} ${n} * * *`;case`weekly`:return`${t} ${n} * * ${r}`;case`custom`:return String(e.custom||``).trim()}}x(),B();var ze=m({__name:`MarketplacePanel`,props:{type:{type:String,required:!0}},setup(e,{expose:t}){t();let n=e,i=le(),o=G([]),s=G([]),u=G(!1),d=G(``),f=G(``),p=G([]),m=G(`project`),h=G(new Set),g=G(new Set),_=G(new Set),v=a(()=>i.currentDirectory||``),y=null;async function b(){if(!u.value){u.value=!0;try{let e=new URLSearchParams({type:n.type,cwd:v.value});f.value&&e.set(`q`,f.value),p.value.length&&e.set(`sources`,p.value.join(`,`));let t=await(await fetch(`/api/agent/marketplace/catalog?${e}`)).json();t?.success?(o.value=t.groups||[],s.value=t.installed||[]):P.error(t?.error||K(`@MKT:加载失败`))}catch{P.error(K(`@MKT:加载失败`))}finally{u.value=!1}}}V(d,e=>{y&&clearTimeout(y),y=setTimeout(()=>{f.value=e.trim(),b()},400)}),V(p,()=>b()),V(()=>n.type,()=>{p.value=[],f.value=``,d.value=``,b()}),V(v,()=>b()),b();let x=a(()=>{let e=v.value?v.value.split(/[\\/]/).filter(Boolean).pop():``;return m.value===`project`?e||K(`@MKT:当前项目`):K(`@MKT:g ai 智能体`)});function S(e){return e.stars?`${C(e.stars)} ★`:e.downloads?`${C(e.downloads)} ${K(`@MKT:周下载`)}`:e.uses?`${C(e.uses)} ${K(`@MKT:次使用`)}`:``}function C(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function w(e){return`${e.id}`}function E(e){return h.value.has(w(e))}let D=a(()=>{let e={project:[],global:[]};for(let t of s.value)(e[t.target]||=[]).push(t);return e}),O=oe({visible:!1,item:null,env:{},args:``});function A(e){return n.type===`mcp`&&(!!e.envKeys?.length||!!e.args?.length)}function j(e){O.item=e,O.env=Object.fromEntries((e.envKeys||[]).map(e=>[e,``])),O.args=(e.args||[]).join(` `),O.visible=!0}function M(){let e=O.item;if(O.visible=!1,!e)return;let t=Object.fromEntries(Object.entries(O.env).filter(([,e])=>e.trim()!==``)),n=O.args.trim()?O.args.trim().match(/(?:[^\s"]+|"[^"]*")+/g)?.map(e=>e.replace(/^"|"$/g,``))??void 0:void 0;F(e,{env:t,...n?{args:n}:{}})}async function N(e){if(!e.installed||await I(e)){if(A(e)){j(e);return}await F(e,{})}}async function F(e,t){let r=w(e);h.value.add(r);try{let r=await fetch(`/api/agent/marketplace/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:m.value,cwd:v.value,item:{...e,...t}})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){P.error(i?.error||K(`@MKT:安装失败`));return}i.item?.warning&&P.warning(i.item.warning),i.item?.envKeys?.length?P.warning(`${K(`@MKT:还缺环境变量`)}: ${i.item.envKeys.join(`, `)}`):P.success(K(`@MKT:安装成功`)),await b()}catch{P.error(K(`@MKT:安装失败`))}finally{h.value.delete(r)}}async function I(e){try{return await ne.confirm(`${e.name} ${K(`@MKT:已安装,要重新安装吗?`)}`,K(`@MKT:重新安装`),{confirmButtonText:K(`@MKT:重装`),cancelButtonText:K(`@MKT:取消`),type:`warning`}),!0}catch{return!1}}async function L(e){let t=`${e.target}:${e.id}`;_.value.add(t);try{let t=await fetch(`/api/agent/marketplace/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:e.target,cwd:v.value,id:e.id})}),r=await t.json().catch(()=>null);(!t.ok||!r?.success)&&P.error(r?.error||K(`@MKT:打开失败`))}catch{P.error(K(`@MKT:打开失败`))}finally{_.value.delete(t)}}async function z(e){try{await ne.confirm(`${K(`@MKT:确定卸载`)} ${e.name}?`,K(`@MKT:卸载`),{confirmButtonText:K(`@MKT:卸载`),cancelButtonText:K(`@MKT:取消`),type:`warning`})}catch{return}let t=`${e.target}:${e.id}`;g.value.add(t);try{let t=new URLSearchParams({target:e.target,cwd:v.value}),r=await fetch(`/api/agent/marketplace/item/${n.type}/${encodeURIComponent(e.id)}?${t}`,{method:`DELETE`}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){P.error(i?.error||K(`@MKT:卸载失败`));return}P.success(K(`@MKT:已卸载`)),await b()}catch{P.error(K(`@MKT:卸载失败`))}finally{g.value.delete(t)}}let B={props:n,configStore:i,groups:o,installed:s,loading:u,searchInput:d,query:f,selectedSources:p,installTarget:m,installing:h,removing:g,revealing:_,cwd:v,get searchTimer(){return y},set searchTimer(e){y=e},loadCatalog:b,targetLabel:x,metricText:S,formatCount:C,cardKey:w,isBusy:E,installedByTarget:D,configDialog:O,needsConfig:A,openConfigDialog:j,confirmConfig:M,onInstall:N,doInstall:F,confirmReinstall:I,onReveal:L,onRemove:z,get $t(){return K},get Search(){return c},get Refresh(){return l},get Delete(){return R},get Link(){return ee},get Check(){return ae},get Star(){return T},get Download(){return te},get Warning(){return k},get FolderOpened(){return r},CommonDialog:ue};return Object.defineProperty(B,"__isScriptSetup",{enumerable:!1,value:!0}),B}});x(),A(),u();var Be={class:`marketplace-panel`},Ve={class:`mp-toolbar`},He={class:`mp-search`},Ue=[`placeholder`],We={class:`mp-toolbar-sub`},Ge={class:`mp-target-hint`},Ke={class:`mp-source-filter`},qe=[`onClick`],Je={class:`mp-body`},Ye={class:`mp-group-header`},Xe={class:`mp-group-title`},Ze={key:0,class:`mp-group-count`},Qe={key:1,class:`mp-group-error`},$e=[`href`,`title`],et={key:0,class:`mp-grid`},tt={class:`mp-card-head`},nt=[`title`],rt={key:0,class:`mp-card-metric`},it=[`title`],at={class:`mp-card-meta`},ot=[`title`],st=[`title`],ct={key:2,class:`mp-tag remote`},lt={class:`mp-card-foot`},ut=[`href`],dt={key:1,class:`mp-installed-chip`},ft=[`disabled`,`onClick`],pt={key:3,class:`mp-not-installable`},mt={key:1,class:`mp-empty`},ht={key:0,class:`mp-group installed`},gt={class:`mp-group-header`},_t={class:`mp-group-title`},vt={class:`mp-group-count`},yt={key:0,class:`mp-installed-block`},bt={class:`mp-installed-target`},xt={class:`mp-installed-list`},St=[`title`],Ct=[`title`],wt={key:1,class:`mp-meta-pkg`},Tt={key:2,class:`mp-tag warn`},Et=[`disabled`,`title`,`onClick`],Dt=[`disabled`,`onClick`],Ot={key:1,class:`mp-empty all`},kt={key:0,class:`mkt-form`},At={class:`mkt-form-name`},jt=[`onUpdate:modelValue`,`placeholder`],Mt={key:0,class:`mkt-field`},Nt={class:`mkt-hint`};function Pt(e,n,r,a,s,c){let l=d,u=F,f=h,p=S,m=O;return v(),t(`div`,Be,[I(` ── 工具栏 ───────────────────────────────── `),i(`div`,Ve,[i(`div`,He,[o(l,{class:`mp-search-icon`},{default:L(()=>[o(a.Search)]),_:1}),U(i(`input`,{"onUpdate:modelValue":n[0]||=e=>a.searchInput=e,class:`mp-search-input`,type:`text`,placeholder:r.type===`skill`?a.$t(`@MKT:搜索 Skill...`):a.$t(`@MKT:搜索 MCP 服务...`)},null,8,Ue),[[W,a.searchInput]])]),o(f,{modelValue:a.installTarget,"onUpdate:modelValue":n[1]||=e=>a.installTarget=e,size:`small`,class:`mp-target`},{default:L(()=>[o(u,{value:`project`},{default:L(()=>[_(H(a.$t(`@MKT:当前项目`)),1)]),_:1}),o(u,{value:`global`},{default:L(()=>[_(H(a.$t(`@MKT:g ai 智能体`)),1)]),_:1})]),_:1},8,[`modelValue`]),o(p,{content:a.$t(`@MKT:刷新`),placement:`top`,"show-after":300},{default:L(()=>[i(`button`,{class:w([`mp-refresh`,{spinning:a.loading}]),onClick:a.loadCatalog},[o(l,null,{default:L(()=>[o(a.Refresh)]),_:1})],2)]),_:1},8,[`content`])]),i(`div`,We,[i(`span`,Ge,[_(H(a.$t(`@MKT:安装到`))+` `,1),i(`b`,null,H(a.targetLabel),1)]),i(`div`,Ke,[(v(!0),t(y,null,j(a.groups,e=>(v(),t(`button`,{key:e.id,class:w([`mp-chip`,{active:a.selectedSources.includes(e.id)}]),onClick:()=>{let t=a.selectedSources.indexOf(e.id);t>=0?a.selectedSources.splice(t,1):a.selectedSources.push(e.id)}},H(e.label),11,qe))),128)),a.selectedSources.length?(v(),t(`button`,{key:0,class:`mp-chip clear`,onClick:n[2]||=e=>a.selectedSources=[]},H(a.$t(`@MKT:全部来源`)),1)):I(`v-if`,!0)])]),I(` ── 内容 ─────────────────────────────────── `),U((v(),t(`div`,Je,[(v(!0),t(y,null,j(a.groups,e=>(v(),t(`section`,{key:e.id,class:`mp-group`},[i(`header`,Ye,[i(`h3`,Xe,H(e.label),1),e.status===`ok`?(v(),t(`span`,Ze,H(e.items.length),1)):(v(),t(`span`,Qe,[o(l,null,{default:L(()=>[o(a.Warning)]),_:1}),_(` `+H(e.error||a.$t(`@MKT:来源不可用`)),1)])),e.homepage?(v(),t(`a`,{key:2,class:`mp-group-link`,href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,title:e.homepage},[o(l,null,{default:L(()=>[o(a.Link)]),_:1})],8,$e)):I(`v-if`,!0)]),e.status===`ok`&&e.items.length?(v(),t(`div`,et,[(v(!0),t(y,null,j(e.items,e=>(v(),t(`article`,{key:a.cardKey(e),class:`mp-card`},[i(`div`,tt,[i(`span`,{class:`mp-card-name`,title:e.name},H(e.name),9,nt),a.metricText(e)?(v(),t(`span`,rt,[o(l,null,{default:L(()=>[e.stars?(v(),g(a.Star,{key:0})):(v(),g(a.Download,{key:1}))]),_:2},1024),_(` `+H(a.metricText(e)),1)])):I(`v-if`,!0)]),i(`p`,{class:`mp-card-desc`,title:e.description},H(e.description||a.$t(`@MKT:暂无描述`)),9,it),i(`div`,at,[e.package?(v(),t(`code`,{key:0,class:`mp-meta-pkg`,title:e.package},H(e.package),9,ot)):e.repository?(v(),t(`span`,{key:1,class:`mp-meta-repo`,title:e.repository+(e.subpath?` · `+e.subpath:``)},[_(H(e.repository),1),e.subpath?(v(),t(y,{key:0},[_(` · `+H(e.subpath),1)],64)):I(`v-if`,!0)],8,st)):I(`v-if`,!0),e.transport===`remote`?(v(),t(`span`,ct,H(a.$t(`@MKT:远程服务`)),1)):I(`v-if`,!0),(v(!0),t(y,null,j((e.tags||[]).slice(0,2),e=>(v(),t(`span`,{key:e,class:`mp-tag`},H(e),1))),128))]),i(`div`,lt,[e.upstream?(v(),t(`a`,{key:0,class:`mp-card-link`,href:e.upstream,target:`_blank`,rel:`noopener noreferrer`},H(a.$t(`@MKT:查看来源`)),9,ut)):I(`v-if`,!0),n[6]||=i(`span`,{class:`mp-foot-spacer`},null,-1),e.installed?(v(),t(`span`,dt,[o(l,null,{default:L(()=>[o(a.Check)]),_:1}),_(H(a.$t(`@MKT:已安装`)),1)])):e.installable===!1?(v(),t(`span`,pt,H(a.$t(`@MKT:暂不支持一键安装`)),1)):(v(),t(`button`,{key:2,class:`mp-install-btn`,disabled:a.isBusy(e),onClick:t=>a.onInstall(e)},H(a.isBusy(e)?a.$t(`@MKT:安装中...`):a.$t(`@MKT:安装`)),9,ft))])]))),128))])):e.status===`ok`?(v(),t(`div`,mt,H(a.$t(`@MKT:该来源暂无结果`)),1)):I(`v-if`,!0)]))),128)),I(` ── 已安装 ─────────────────────────────── `),a.installed.length?(v(),t(`section`,ht,[i(`header`,gt,[i(`h3`,_t,H(a.$t(`@MKT:已安装`)),1),i(`span`,vt,H(a.installed.length),1)]),(v(),t(y,null,j([`project`,`global`],e=>i(`div`,{key:e},[a.installedByTarget[e]?.length?(v(),t(`div`,yt,[i(`div`,bt,H(e===`project`?a.$t(`@MKT:当前项目`):a.$t(`@MKT:g ai 智能体`)),1),i(`div`,xt,[(v(!0),t(y,null,j(a.installedByTarget[e],r=>(v(),t(`div`,{key:e+r.id,class:`mp-installed-row`},[i(`span`,{class:`mp-installed-name`,title:r.name},H(r.name),9,St),I(` 实际落盘的标识:SKILL.md 里的 name 常与仓库名不同(如仓库 taste-skill
|
|
2
|
-
里的 skill 自称 brandkit),不显示这个用户就对不上广场卡片上的名字 `),r.id&&r.id!==r.name?(v(),t(`code`,{key:0,class:`mp-installed-id`,title:r.dir||r.file||r.id},H(r.id),9,Ct)):I(`v-if`,!0),r.package?(v(),t(`code`,wt,H(r.package),1)):I(`v-if`,!0),r.requiredEnv?.length?(v(),t(`span`,Tt,H(a.$t(`@MKT:待配置`))+`: `+H(r.requiredEnv.join(`, `)),1)):I(`v-if`,!0),n[7]||=i(`span`,{class:`mp-foot-spacer`},null,-1),i(`button`,{class:`mp-reveal-btn`,disabled:a.revealing.has(e+r.id),title:r.dir||r.file||``,onClick:e=>a.onReveal(r)},[o(l,null,{default:L(()=>[o(a.FolderOpened)]),_:1}),_(` `+H(a.$t(`@MKT:打开文件夹`)),1)],8,Et),i(`button`,{class:`mp-remove-btn`,disabled:a.removing.has(e+r.id),onClick:e=>a.onRemove(r)},[o(l,null,{default:L(()=>[o(a.Delete)]),_:1}),_(` `+H(a.removing.has(e+r.id)?a.$t(`@MKT:卸载中...`):a.$t(`@MKT:卸载`)),1)],8,Dt)]))),128))])])):I(`v-if`,!0)])),64))])):I(`v-if`,!0),!a.loading&&!a.groups.length?(v(),t(`div`,Ot,H(a.$t(`@MKT:加载失败`)),1)):I(`v-if`,!0)])),[[m,a.loading]]),I(` ── MCP 安装前配置 ───────────────────────── `),o(a.CommonDialog,{modelValue:a.configDialog.visible,"onUpdate:modelValue":n[5]||=e=>a.configDialog.visible=e,title:a.$t(`@MKT:配置 MCP`),width:`460px`,type:`flex`,"close-on-click-modal":!1,"append-to-body":``},{footer:L(()=>[i(`button`,{class:`mkt-cancel`,onClick:n[4]||=e=>a.configDialog.visible=!1},H(a.$t(`@MKT:取消`)),1),i(`button`,{class:`mkt-confirm`,onClick:a.confirmConfig},H(a.$t(`@MKT:安装`)),1)]),default:L(()=>[a.configDialog.item?(v(),t(`div`,kt,[i(`p`,At,H(a.configDialog.item.name),1),(v(!0),t(y,null,j(Object.keys(a.configDialog.env),e=>(v(),t(`div`,{key:e,class:`mkt-field`},[i(`label`,null,H(e),1),U(i(`input`,{"onUpdate:modelValue":t=>a.configDialog.env[e]=t,type:`text`,autocomplete:`off`,placeholder:a.$t(`@MKT:环境变量值`),spellcheck:`false`},null,8,jt),[[W,a.configDialog.env[e]]])]))),128)),a.configDialog.item.args?.length?(v(),t(`div`,Mt,[i(`label`,null,H(a.$t(`@MKT:启动参数`)),1),U(i(`input`,{"onUpdate:modelValue":n[3]||=e=>a.configDialog.args=e,type:`text`,autocomplete:`off`,spellcheck:`false`},null,512),[[W,a.configDialog.args]]),i(`p`,Nt,H(a.$t(`@MKT:参数提示`)),1)])):I(`v-if`,!0)])):I(`v-if`,!0)]),_:1},8,[`modelValue`,`title`])])}var Ft=q(ze,[[`render`,Pt],[`__scopeId`,`data-v-e9f9e851`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/MarketplacePanel.vue`]]);x(),B();var It=m({__name:`SchedulePanel`,emits:[`open-session`],setup(e,{expose:t,emit:n}){t();let r=n,i=le(),o=G([]),s=G(!0),c=G(``),l=G({}),u=null,d=null;async function p(){try{o.value=await ke(),c.value=``}catch(e){c.value=e?.message||String(e)}finally{s.value=!1}}function m(){d===null&&(d=window.setTimeout(()=>{d=null,p()},150))}C(async()=>{await p(),u=Pe(e=>{[`tasks_changed`,`task_started`,`task_finished`,`hello`].includes(e.type)&&m()})}),f(()=>{u?.(),d!==null&&window.clearTimeout(d)});let h=a(()=>{let e=o.value.filter(e=>e.enabled).length,t=o.value.length-e;return o.value.length?K(`@SCHED:{on} 个启用 · {off} 个停用`,{on:e,off:t}):``}),g=[`@SCHED:周日`,`@SCHED:周一`,`@SCHED:周二`,`@SCHED:周三`,`@SCHED:周四`,`@SCHED:周五`,`@SCHED:周六`];function _(e){let t=Fe(e.schedule);switch(t.kind){case`every-minute`:return K(`@SCHED:每分钟`);case`every-n-minutes`:return K(`@SCHED:每 {n} 分钟`,{n:t.n});case`hourly`:return K(`@SCHED:每小时第 {minute} 分钟`,{minute:t.minute});case`daily`:return K(`@SCHED:每天 {time}`,{time:`${String(t.hour).padStart(2,`0`)}:${String(t.minute).padStart(2,`0`)}`});case`weekly`:return K(`@SCHED:每周 {weekday} {time}`,{weekday:K(g[t.weekday]),time:`${String(t.hour).padStart(2,`0`)}:${String(t.minute).padStart(2,`0`)}`});case`monthly`:return K(`@SCHED:每月 {day} 日 {time}`,{day:t.day,time:`${String(t.hour).padStart(2,`0`)}:${String(t.minute).padStart(2,`0`)}`});default:return t.raw}}function v(e){if(!e.enabled)return K(`@SCHED:已停用`);if(e.running)return K(`@SCHED:运行中...`);let t=Ie(e.nextRunAt);switch(t.kind){case`none`:return``;case`today`:return K(`@SCHED:下次 今天 {time}`,{time:t.time});case`tomorrow`:return K(`@SCHED:下次 明天 {time}`,{time:t.time});case`weekday`:return K(`@SCHED:下次 {weekday} {time}`,{weekday:K(g[t.weekday]),time:t.time});case`date`:return K(`@SCHED:下次 {date} {time}`,{date:t.date,time:t.time})}}function y(e){let t=e.lastRun;if(!t)return K(`@SCHED:还没执行过`);switch(t.status){case`ok`:return K(`@SCHED:成功`);case`error`:return K(`@SCHED:失败`);case`timed-out`:return K(`@SCHED:超时中止`);case`skipped-busy`:return K(`@SCHED:已跳过(会话忙)`);case`missed`:return K(`@SCHED:已错过(未运行)`);case`cancelled`:return K(`@SCHED:已停止`);default:return t.status}}function b(e){let t=e.lastRun;if(!t)return K(`@SCHED:还没执行过`);let n=Le(t.durationMs),r=K(`@SCHED:上次 {status}`,{status:y(e)});return n?`${r} · ${n}`:r}function x(e){return e.lastRun?`is-${$(e.lastRun.status)}`:`is-muted`}async function S(e,t){if(!l.value[e.id]){l.value={...l.value,[e.id]:!0};try{await t(),await p()}catch(e){P.error(e?.message||String(e))}finally{let t={...l.value};delete t[e.id],l.value=t}}}function w(e){return S(e,()=>je(e.id,{enabled:!e.enabled}))}function T(e){return S(e,()=>Y(e.id))}function E(e){return S(e,()=>Ne(e.id))}let D=G(!1),O=G(null);function k(e){O.value=e,D.value=!0}async function A(){let e=O.value;if(e)try{await Me(e.id),D.value=!1,await p()}catch(e){P.error(e?.message||String(e))}}let j=G(!1),M=G(``),N=G(``),F=G(!1),I=G({name:``,freq:`daily`,everyMinutes:30,minute:0,hour:9,weekday:1,custom:``,cwd:``,prompt:``,onMissed:`run`,enabled:!0}),ee=a(()=>[{value:`minutes`,label:K(`@SCHED:每 N 分钟`)},{value:`hourly`,label:K(`@SCHED:每小时`)},{value:`daily`,label:K(`@SCHED:每天`)},{value:`weekly`,label:K(`@SCHED:每周`)},{value:`custom`,label:K(`@SCHED:自定义 cron`)}]),L=a(()=>Re({freq:I.value.freq,everyMinutes:I.value.everyMinutes,minute:I.value.minute,hour:I.value.hour,weekday:I.value.weekday,custom:I.value.custom}));function R(){I.value={name:``,freq:`daily`,everyMinutes:30,minute:0,hour:9,weekday:1,custom:``,cwd:i.currentDirectory||``,prompt:``,onMissed:`run`,enabled:!0},N.value=``}function z(){M.value=``,R(),j.value=!0}function B(e){M.value=e.id;let t=Fe(e.schedule),n={name:e.name,freq:`custom`,everyMinutes:30,minute:0,hour:9,weekday:1,custom:e.schedule,cwd:e.cwd,prompt:e.prompt,onMissed:e.onMissed===`skip`?`skip`:`run`,enabled:e.enabled};switch(t.kind){case`every-n-minutes`:n.freq=`minutes`,n.everyMinutes=t.n;break;case`hourly`:n.freq=`hourly`,n.minute=t.minute;break;case`daily`:n.freq=`daily`,n.minute=t.minute,n.hour=t.hour;break;case`weekly`:n.freq=`weekly`,n.minute=t.minute,n.hour=t.hour,n.weekday=t.weekday;break;default:n.freq=`custom`}I.value=n,N.value=``,j.value=!0}async function te(){let e=I.value;if(!e.name.trim()){N.value=K(`@SCHED:任务名不能为空`);return}if(!e.prompt.trim()){N.value=K(`@SCHED:提示词不能为空`);return}let t=L.value;if(!t){N.value=K(`@SCHED:cron 表达式不能为空`);return}let n={name:e.name.trim(),schedule:t,cwd:e.cwd.trim(),prompt:e.prompt.trim(),enabled:e.enabled,onMissed:e.onMissed};F.value=!0;try{M.value?await je(M.value,n):await Ae(n),j.value=!1,await p()}catch(e){N.value=e?.message||String(e)}finally{F.value=!1}}let ne={emit:r,configStore:i,tasks:o,loading:s,errorMsg:c,pending:l,get disposeEvents(){return u},set disposeEvents(e){u=e},get refreshTimer(){return d},set refreshTimer(e){d=e},refresh:p,scheduleRefresh:m,summaryText:h,WEEKDAY_KEYS:g,descText:_,nextText:v,lastStatusText:y,lastText:b,lastClass:x,withPending:S,toggle:w,runNow:T,stop:E,confirmVisible:D,confirmTarget:O,askRemove:k,confirmRemove:A,formVisible:j,editingId:M,formError:N,saving:F,form:I,freqOptions:ee,cronPreview:L,resetForm:R,openCreate:z,openEdit:B,submitForm:te,get $t(){return K},CommonDialog:ue};return Object.defineProperty(ne,"__isScriptSetup",{enumerable:!1,value:!0}),ne}});u(),x(),A();var Lt={class:`schedule-panel`},Rt={class:`schedule-toolbar`},zt={class:`schedule-summary`},Bt={key:0,class:`schedule-error`},Vt={key:1,class:`schedule-loading`},Ht={key:2,class:`schedule-empty`},Ut={class:`schedule-empty-title`},Wt={class:`schedule-empty-desc`},Gt={key:3,class:`schedule-list`},Kt={class:`schedule-card-body`},qt={class:`schedule-card-head`},Jt={class:`schedule-name`},Yt={key:0,class:`schedule-running`},Xt=[`aria-checked`,`aria-label`,`onClick`],Zt={class:`schedule-card-sub`},Qt={class:`schedule-desc`},$t=[`onClick`],en={class:`schedule-card-side`},tn={class:`schedule-actions`},nn=[`disabled`,`onClick`],rn=[`disabled`,`onClick`],an=[`onClick`],on=[`onClick`],sn={class:`sch-form`},cn={class:`sch-field`},ln={class:`sch-field-label`},un=[`placeholder`],dn={class:`sch-field`},fn={class:`sch-field-label`},pn={class:`sch-freq-row`},mn=[`value`],hn={class:`sch-inline-label`},gn=[`value`],_n={class:`sch-inline-label`},vn=[`value`],yn=[`value`],bn=[`value`],xn={class:`sch-inline-label`},Sn=[`value`],Cn={class:`sch-inline-label`},wn=[`placeholder`],Tn={class:`sch-hint`},En={class:`sch-field`},Dn={class:`sch-field-label`},On=[`placeholder`],kn={class:`sch-field`},An={class:`sch-field-label`},jn=[`placeholder`],Mn={class:`sch-field`},Nn={class:`sch-field-label`},Pn={class:`sch-radio-row`},Fn={class:`sch-radio`},In={class:`sch-radio`},Ln={class:`sch-radio`},Rn={key:0,class:`sch-form-error`},zn={class:`sch-form-footer`},Bn=[`disabled`],Vn={class:`sch-confirm-text`},Hn={class:`sch-form-footer`};function Un(e,n,r,a,s,c){return v(),t(`div`,Lt,[i(`div`,Rt,[i(`span`,zt,H(a.summaryText),1),i(`button`,{type:`button`,class:`sch-btn sch-btn-primary`,onClick:a.openCreate},H(a.$t(`@SCHED:新建任务`)),1)]),a.errorMsg?(v(),t(`div`,Bt,H(a.$t(`@SCHED:操作失败:{error}`,{error:a.errorMsg})),1)):I(`v-if`,!0),a.loading?(v(),t(`div`,Vt,H(a.$t(`@SCHED:加载中...`)),1)):a.tasks.length?(v(),t(`div`,Gt,[(v(!0),t(y,null,j(a.tasks,e=>(v(),t(`article`,{key:e.id,class:w([`schedule-card`,{"is-disabled":!e.enabled,"is-running":!!e.running}])},[i(`div`,Kt,[i(`div`,qt,[i(`span`,Jt,H(e.name),1),e.running?(v(),t(`span`,Yt,H(a.$t(`@SCHED:运行中`)),1)):I(`v-if`,!0),i(`button`,{type:`button`,class:w([`sch-switch`,{on:e.enabled}]),role:`switch`,"aria-checked":e.enabled,"aria-label":e.enabled?a.$t(`@SCHED:停用`):a.$t(`@SCHED:启用`),onClick:t=>a.toggle(e)},[...n[17]||=[i(`span`,{class:`sch-switch-knob`},null,-1)]],10,Xt)]),i(`div`,Zt,[i(`span`,Qt,H(a.descText(e)),1),n[18]||=i(`span`,{class:`schedule-sep`},`·`,-1),i(`span`,{class:w([`schedule-last`,a.lastClass(e)])},H(a.lastText(e)),3),e.sessionId?(v(),t(`button`,{key:0,type:`button`,class:`sch-link`,onClick:t=>a.emit(`open-session`,e.sessionId)},H(a.$t(`@SCHED:查看会话`)),9,$t)):I(`v-if`,!0)])]),i(`div`,en,[i(`div`,{class:w([`schedule-next`,{"is-muted":!e.enabled}])},H(a.nextText(e)),3),i(`div`,tn,[e.running?(v(),t(`button`,{key:0,type:`button`,class:`sch-btn`,disabled:!!a.pending[e.id],onClick:t=>a.stop(e)},H(a.$t(`@SCHED:停止`)),9,nn)):(v(),t(`button`,{key:1,type:`button`,class:`sch-btn`,disabled:!!a.pending[e.id],onClick:t=>a.runNow(e)},H(a.$t(`@SCHED:运行`)),9,rn)),i(`button`,{type:`button`,class:`sch-btn`,onClick:t=>a.openEdit(e)},H(a.$t(`@SCHED:编辑`)),9,an),i(`button`,{type:`button`,class:`sch-btn sch-btn-danger`,onClick:t=>a.askRemove(e)},H(a.$t(`@SCHED:删除`)),9,on)])])],2))),128))])):(v(),t(`div`,Ht,[i(`p`,Ut,H(a.$t(`@SCHED:还没有定时任务`)),1),i(`p`,Wt,H(a.$t(`@SCHED:让 g ai 在指定时间自动做事:定时拉代码、定时巡检、定时汇总。也可以在对话里直接说「每天 9 点帮我…」,让 g ai 来创建。`)),1)])),I(` 新建 / 编辑 `),o(a.CommonDialog,{modelValue:a.formVisible,"onUpdate:modelValue":n[14]||=e=>a.formVisible=e,title:a.editingId?a.$t(`@SCHED:编辑任务`):a.$t(`@SCHED:新建任务`),"close-on-click-modal":!1,"append-to-body":!0,size:`medium`,width:`560px`,"z-index":3e6,"custom-class":`schedule-dialog`},{default:L(()=>[i(`div`,sn,[i(`label`,cn,[i(`span`,ln,H(a.$t(`@SCHED:任务名`)),1),U(i(`input`,{"onUpdate:modelValue":n[0]||=e=>a.form.name=e,class:`sch-input`,type:`text`,placeholder:a.$t(`@SCHED:如:每日拉代码`)},null,8,un),[[W,a.form.name]])]),i(`div`,dn,[i(`span`,fn,H(a.$t(`@SCHED:执行计划`)),1),i(`div`,pn,[U(i(`select`,{"onUpdate:modelValue":n[1]||=e=>a.form.freq=e,class:`sch-input sch-select`},[(v(!0),t(y,null,j(a.freqOptions,e=>(v(),t(`option`,{key:e.value,value:e.value},H(e.label),9,mn))),128))],512),[[D,a.form.freq]]),a.form.freq===`minutes`?(v(),t(y,{key:0},[i(`span`,hn,H(a.$t(`@SCHED:每`)),1),U(i(`select`,{"onUpdate:modelValue":n[2]||=e=>a.form.everyMinutes=e,class:`sch-input sch-select sch-select-sm`},[(v(),t(y,null,j([5,10,15,20,30,60],e=>i(`option`,{key:e,value:e},H(e),9,gn)),64))],512),[[D,a.form.everyMinutes,void 0,{number:!0}]]),i(`span`,_n,H(a.$t(`@SCHED:分钟`)),1)],64)):a.form.freq===`daily`||a.form.freq===`weekly`?(v(),t(y,{key:1},[a.form.freq===`weekly`?U((v(),t(`select`,{key:0,"onUpdate:modelValue":n[3]||=e=>a.form.weekday=e,class:`sch-input sch-select sch-select-sm`},[(v(),t(y,null,j(a.WEEKDAY_KEYS,(e,t)=>i(`option`,{key:t,value:t},H(a.$t(e)),9,vn)),64))],512)),[[D,a.form.weekday,void 0,{number:!0}]]):I(`v-if`,!0),U(i(`select`,{"onUpdate:modelValue":n[4]||=e=>a.form.hour=e,class:`sch-input sch-select sch-select-sm`},[(v(),t(y,null,j(24,e=>i(`option`,{key:e-1,value:e-1},H(String(e-1).padStart(2,`0`)),9,yn)),64))],512),[[D,a.form.hour,void 0,{number:!0}]]),n[19]||=i(`span`,{class:`sch-inline-label`},`:`,-1),U(i(`select`,{"onUpdate:modelValue":n[5]||=e=>a.form.minute=e,class:`sch-input sch-select sch-select-sm`},[(v(),t(y,null,j(60,e=>i(`option`,{key:e-1,value:e-1},H(String(e-1).padStart(2,`0`)),9,bn)),64))],512),[[D,a.form.minute,void 0,{number:!0}]])],64)):a.form.freq===`hourly`?(v(),t(y,{key:2},[i(`span`,xn,H(a.$t(`@SCHED:第`)),1),U(i(`select`,{"onUpdate:modelValue":n[6]||=e=>a.form.minute=e,class:`sch-input sch-select sch-select-sm`},[(v(),t(y,null,j(60,e=>i(`option`,{key:e-1,value:e-1},H(String(e-1).padStart(2,`0`)),9,Sn)),64))],512),[[D,a.form.minute,void 0,{number:!0}]]),i(`span`,Cn,H(a.$t(`@SCHED:分钟`)),1)],64)):U((v(),t(`input`,{key:3,"onUpdate:modelValue":n[7]||=e=>a.form.custom=e,class:`sch-input sch-input-cron`,type:`text`,spellcheck:`false`,placeholder:a.$t(`@SCHED:如:0 9 * * 1-5`)},null,8,wn)),[[W,a.form.custom]])]),i(`span`,Tn,H(a.$t(`@SCHED:cron:{cron}(分 时 日 月 周,本地时间)`,{cron:a.cronPreview||`—`})),1)]),i(`label`,En,[i(`span`,Dn,H(a.$t(`@SCHED:项目目录`)),1),U(i(`input`,{"onUpdate:modelValue":n[8]||=e=>a.form.cwd=e,class:`sch-input`,type:`text`,spellcheck:`false`,placeholder:a.$t(`@SCHED:任务在该目录下执行(默认当前项目)`)},null,8,On),[[W,a.form.cwd]])]),i(`label`,kn,[i(`span`,An,H(a.$t(`@SCHED:提示词`)),1),U(i(`textarea`,{"onUpdate:modelValue":n[9]||=e=>a.form.prompt=e,class:`sch-input sch-textarea`,rows:`4`,placeholder:a.$t(`@SCHED:到点后发给 g ai 的完整指令,例如:检查所有仓库远端更新,有变更就 pull;写成一次自足的请求(未来那一轮没有现在的上下文)`)},null,8,jn),[[W,a.form.prompt]])]),i(`div`,Mn,[i(`span`,Nn,H(a.$t(`@SCHED:错过补偿`)),1),i(`div`,Pn,[i(`label`,Fn,[U(i(`input`,{"onUpdate:modelValue":n[10]||=e=>a.form.onMissed=e,type:`radio`,value:`run`},null,512),[[N,a.form.onMissed]]),i(`span`,null,H(a.$t(`@SCHED:补跑一次(g ui 重新运行后)`)),1)]),i(`label`,In,[U(i(`input`,{"onUpdate:modelValue":n[11]||=e=>a.form.onMissed=e,type:`radio`,value:`skip`},null,512),[[N,a.form.onMissed]]),i(`span`,null,H(a.$t(`@SCHED:跳过`)),1)]),i(`label`,Ln,[U(i(`input`,{"onUpdate:modelValue":n[12]||=e=>a.form.enabled=e,type:`checkbox`},null,512),[[z,a.form.enabled]]),i(`span`,null,H(a.$t(`@SCHED:创建后启用`)),1)])])]),a.formError?(v(),t(`p`,Rn,H(a.formError),1)):I(`v-if`,!0)]),i(`div`,zn,[i(`button`,{type:`button`,class:`sch-btn`,onClick:n[13]||=e=>a.formVisible=!1},H(a.$t(`@SCHED:取消`)),1),i(`button`,{type:`button`,class:`sch-btn sch-btn-primary`,disabled:a.saving,onClick:a.submitForm},H(a.saving?a.$t(`@SCHED:保存中...`):a.$t(`@SCHED:保存`)),9,Bn)])]),_:1},8,[`modelValue`,`title`]),I(` 删除确认 `),o(a.CommonDialog,{modelValue:a.confirmVisible,"onUpdate:modelValue":n[16]||=e=>a.confirmVisible=e,title:a.$t(`@SCHED:删除任务`),"close-on-click-modal":!1,"append-to-body":!0,size:`small`,width:`400px`,"z-index":3e6,"custom-class":`schedule-dialog-confirm`},{default:L(()=>[i(`p`,Vn,H(a.$t(`@SCHED:确定删除「{name}」吗?已产生的会话会保留,但任务不再执行。`,{name:a.confirmTarget?.name||``})),1),i(`div`,Hn,[i(`button`,{type:`button`,class:`sch-btn`,onClick:n[15]||=e=>a.confirmVisible=!1},H(a.$t(`@SCHED:取消`)),1),i(`button`,{type:`button`,class:`sch-btn sch-btn-danger`,onClick:a.confirmRemove},H(a.$t(`@SCHED:删除`)),1)])]),_:1},8,[`modelValue`,`title`])])}var Wn=q(It,[[`render`,Un],[`__scopeId`,`data-v-63dc658b`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/SchedulePanel.vue`]]);x(),B();var Gn=4e3,Kn=m({__name:`AgentPromptSettings`,setup(e,{expose:t}){t();let n=le(),{defaultPrompt:r,projectPrompts:i,loadOrchestrator:o,saveDefaultPrompt:s,saveProjectPrompt:c}=Oe(),l=G(``),u=G(!1),d=G(!1),f=a(()=>n.agentDefaultPrompt||``),p=a(()=>l.value.trim()!==f.value.trim());async function m(){if(!u.value&&p.value){u.value=!0;try{await n.saveAiSettings({agentDefaultPrompt:l.value})&&(l.value=f.value,d.value=!0,P.success(K(`@AGENT:已保存 g ai 默认提示词`)))}finally{u.value=!1}}}let h=a(()=>n.currentDirectory||``),g=a(()=>de(h.value)||h.value),_=a(()=>{let e=pe(h.value);return e&&i.value?.[e]?.prompt||``}),v=G(``),y=G(``),b=G(!1),x=G(!1),S=G(!1),w=a(()=>v.value.trim()!==(r.value||``).trim()||!!h.value&&y.value.trim()!==_.value.trim());function T(){v.value=r.value||``,y.value=_.value}C(async()=>{l.value=f.value,T();let e=await o(!0);S.value=!e,e&&T()});async function E(){if(!b.value&&w.value){b.value=!0;try{let e=!0,t=v.value.trim();t!==(r.value||``).trim()&&(e=await s(t));let n=y.value.trim();e&&h.value&&n!==_.value.trim()&&(e=await c(h.value,n)),e&&(T(),x.value=!0)}finally{b.value=!1}}}let D={configStore:n,defaultPrompt:r,projectPrompts:i,loadOrchestrator:o,saveDefaultPrompt:s,saveProjectPrompt:c,MAX_CHARS:Gn,gaiDraft:l,savingGai:u,gaiSaved:d,gaiStored:f,gaiDirty:p,saveGai:m,projectPath:h,projectName:g,projectPrompt:_,globalDraft:v,projectDraft:y,savingDispatch:b,dispatchSaved:x,dispatchLoadFailed:S,dispatchDirty:w,syncDispatchDraft:T,saveDispatch:E,get $t(){return K}};return Object.defineProperty(D,"__isScriptSetup",{enumerable:!1,value:!0}),D}});u(),x(),A();var qn={class:`aps`},Jn={class:`aps__scroll`},Yn={class:`aps__head`},Xn={class:`aps__title`},Zn={class:`aps__intro`},Qn={class:`aps__card aps__card--gai`},$n={class:`aps__card-head`},er={class:`aps__card-title`},tr={class:`aps__count`},nr={class:`aps__hint`},rr=[`placeholder`],ir={class:`aps__foot`},ar={key:0,class:`aps__saved`},or=[`disabled`],sr={class:`aps__card aps__card--dispatch`},cr={class:`aps__card-head`},lr={class:`aps__card-title`},ur={class:`aps__hint`},dr={class:`aps__field`},fr={class:`aps__card-head`},pr={class:`aps__label`,for:`aps-global`},mr={class:`aps__count`},hr=[`placeholder`],gr={class:`aps__field`},_r={class:`aps__card-head`},vr={class:`aps__label`,for:`aps-project`},yr={key:0,class:`aps__count`},br=[`disabled`,`placeholder`],xr={class:`aps__hint`},Sr={class:`aps__foot`},Cr={key:0,class:`aps__saved`},wr={key:1,class:`aps__saved`},Tr=[`disabled`];function Er(e,n,r,a,o,s){return v(),t(`div`,qn,[i(`div`,Jn,[i(`header`,Yn,[i(`h3`,Xn,H(a.$t(`@AGENT:提示词设置`)),1),i(`p`,Zn,H(a.$t(`@AGENT:这里配的两块提示词,和 g ai 对话时每一轮都会自动带上。改完下一次发消息就生效,不用新开会话。`)),1)]),I(` ── ① g ai 智能体的默认提示词 ── `),i(`section`,Qn,[i(`div`,$n,[i(`h4`,er,H(a.$t(`@AGENT:g ai 智能体的默认提示词`)),1),i(`span`,tr,H(a.gaiDraft.length)+` / `+H(a.MAX_CHARS),1)]),i(`p`,nr,H(a.$t(`@AGENT:只作用于 g ai 自己:每次对话都会带上(定时任务也一样)。派发出去的任务读不到这一段。`)),1),U(i(`textarea`,{id:`aps-gai`,"onUpdate:modelValue":n[0]||=e=>a.gaiDraft=e,class:`aps__area`,rows:`6`,maxlength:a.MAX_CHARS,placeholder:a.$t(`@AGENT:例如:回答用中文;改完代码先跑一遍验证再汇报;不要动 dist 目录`)},null,8,rr),[[W,a.gaiDraft]]),i(`div`,ir,[a.gaiSaved&&!a.gaiDirty?(v(),t(`span`,ar,H(a.$t(`@AGENT:已保存`)),1)):I(`v-if`,!0),n[3]||=i(`span`,{class:`aps__spacer`},null,-1),i(`button`,{type:`button`,class:`aps__btn aps__btn--primary`,disabled:a.savingGai||!a.gaiDirty,onClick:a.saveGai},H(a.savingGai?a.$t(`@AGENT:保存中…`):a.$t(`@AGENT:保存`)),9,or)])]),I(` ── ② 派发任务的提示词 ── `),i(`section`,sr,[i(`div`,cr,[i(`h4`,lr,H(a.$t(`@AGENT:派发任务的提示词`)),1)]),i(`p`,ur,H(a.$t(`@AGENT:与工作台「预设提示词」是同一份设置,在哪边改都一样。派发任务时附加在指令之前,和 g ai 对话时也会带上。`)),1),i(`div`,dr,[i(`div`,fr,[i(`label`,pr,H(a.$t(`@AGENT:全局提示词`)),1),i(`span`,mr,H(a.globalDraft.length)+` / `+H(a.MAX_CHARS),1)]),U(i(`textarea`,{id:`aps-global`,"onUpdate:modelValue":n[1]||=e=>a.globalDraft=e,class:`aps__area`,rows:`5`,maxlength:a.MAX_CHARS,placeholder:a.$t(`@AGENT:对所有项目生效。例如:回答用中文;改完代码必须跑一遍测试;不要动 dist 目录`)},null,8,hr),[[W,a.globalDraft]])]),i(`div`,gr,[i(`div`,_r,[i(`label`,vr,H(a.projectPath?a.$t(`@AGENT:「{name}」的项目提示词`,{name:a.projectName}):a.$t(`@AGENT:项目提示词`)),1),a.projectPath?(v(),t(`span`,yr,H(a.projectDraft.length)+` / `+H(a.MAX_CHARS),1)):I(`v-if`,!0)]),U(i(`textarea`,{id:`aps-project`,"onUpdate:modelValue":n[2]||=e=>a.projectDraft=e,class:`aps__area`,rows:`5`,maxlength:a.MAX_CHARS,disabled:!a.projectPath,placeholder:a.projectPath?a.$t(`@AGENT:只在这个项目派发/对话时附加。例如:包管理器用 pnpm;改动集中在 src/ui 下`):a.$t(`@AGENT:当前没有打开项目,项目级提示词暂时不能设置`)},null,8,br),[[W,a.projectDraft]]),i(`p`,xr,H(a.projectPath?a.$t(`@AGENT:项目提示词追加在全局提示词之后(不覆盖全局),在「{name}」里派发或对话时一起带上`,{name:a.projectName}):a.$t(`@AGENT:先在左上角切到一个项目,才能设置它的提示词`)),1)]),i(`div`,Sr,[a.dispatchSaved&&!a.dispatchDirty?(v(),t(`span`,Cr,H(a.$t(`@AGENT:已保存`)),1)):a.dispatchLoadFailed?(v(),t(`span`,wr,H(a.$t(`@AGENT:读取设置失败,请稍后重试`)),1)):I(`v-if`,!0),n[4]||=i(`span`,{class:`aps__spacer`},null,-1),i(`button`,{type:`button`,class:`aps__btn aps__btn--primary`,disabled:a.savingDispatch||!a.dispatchDirty,onClick:a.saveDispatch},H(a.savingDispatch?a.$t(`@AGENT:保存中…`):a.$t(`@AGENT:保存`)),9,Tr)])])])])}var Dr=q(Kn,[[`render`,Er],[`__scopeId`,`data-v-f9ada51b`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/AgentPromptSettings.vue`]]);x(),B();var Or=m({__name:`AgentView`,setup(t,{expose:r}){r();let i=le(),o=G(null),{narrow:c}=Te(o),l=G(`chat`),u=G(`chat`),m=a(()=>u.value===`mcp`?`mcp`:`skill`),h=a(()=>[{id:`chat`,label:K(`@AGENT:对话`),icon:M},{id:`schedule`,label:K(`@AGENT:定时任务`),icon:e},{id:`skill`,label:K(`@AGENT:Skill 广场`),icon:b},{id:`mcp`,label:K(`@AGENT:MCP 广场`),icon:ie},{id:`settings`,label:K(`@AGENT:设置`),icon:p}]),{sessions:g,sessionsLoading:_,currentSessionId:v,messages:y,displayMessages:x,isStreaming:S,sessionLoading:w,loadSessions:T,loadSession:E,deleteSession:D,renameSession:O,newSession:k,sendMessage:A,retryTurn:j,questionPanel:N,answeringQuestion:P,answerQuestion:F,isSessionGenerating:I,currentEngine:ee,pendingEngine:L,isEngineLocked:R,pickEngine:z,stop:B,inputContextUsage:te,queuedMessages:ne,queuePaused:re,removeQueuedMessage:H,flushQueued:ae}=we(),U=a(()=>R.value?ee.value:L.value);function W(e){R.value||z(e)}let oe=a(()=>{let e=i.theme;return e===`dark`||e===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}),q=a(()=>he(g.value,I)),ue=me(),de=a(()=>q.value.find(e=>e.id===v.value)?.title||K(`@AGENT:对话`)),pe={"--welcome-avatar":`url("${Ce}")`},Oe=a(()=>fe(i.agentPresetPrompts));async function J(e){await A(e.text,e.files),await s(),Y()}async function ke(e){await A(e.prompt),await s(),Y()}let Ae=be(),je=G(null),Me=Se();function Y(e=!0){je.value?.scrollToBottom(e)}V(()=>y.value.length,()=>{s(()=>Y(!1))});function Ne(e){E(e),l.value=`chat`}function X(e){e&&(u.value=`chat`,Ne(e))}function Fe(){k(),l.value=`chat`}let Z=G(280),Q=G(!1);function Ie(e){Q.value=!0;let t=e.clientX,n=Z.value,r=e=>{let r=e.clientX-t,i=Math.max(200,Math.min(500,n+r));Z.value=i},i=()=>{Q.value=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}V(c,e=>{e||(l.value=`chat`)}),V(()=>[i.currentDirectory,S.value],async([e,t],n)=>{let r=!n||e!==n[0],i=!!n&&n[1]===!0&&!t;(r||i)&&await T(),v.value&&!S.value&&!g.value.some(e=>e.sessionId===v.value)&&k()},{immediate:!0});let $=null;C(()=>{$=Pe(e=>{e.type===`task_finished`&&T().catch(()=>{})})}),f(()=>{$?.(),$=null});let Le={configStore:i,rootRef:o,narrow:c,chatPage:l,activeTab:u,marketplaceType:m,tabs:h,sessions:g,sessionsLoading:_,currentSessionId:v,messages:y,displayMessages:x,isStreaming:S,sessionLoading:w,loadSessions:T,loadSession:E,deleteSession:D,renameSession:O,newSession:k,sendMessage:A,retryTurn:j,questionPanel:N,answeringQuestion:P,answerQuestion:F,isSessionGenerating:I,currentEngine:ee,pendingEngine:L,isEngineLocked:R,pickEngine:z,stop:B,inputContextUsage:te,queuedMessages:ne,queuePaused:re,removeQueuedMessage:H,flushQueued:ae,displayEngine:U,handleEngineSelect:W,chatTheme:oe,conversationItems:q,conversationLabels:ue,currentSessionTitle:de,welcomeAvatarStyle:pe,presetQuestions:Oe,onSend:J,onSelectPreset:ke,questionLabels:Ae,chatContainerRef:je,queueLabels:Me,scrollToBottom:Y,selectSession:Ne,handleScheduleOpenSession:X,handleNewSession:Fe,sidebarWidth:Z,isResizing:Q,startResize:Ie,get disposeScheduleEvents(){return $},set disposeScheduleEvents(e){$=e},get $t(){return K},get ElIcon(){return d},get Loading(){return n},get ChatContainer(){return se},get ConversationList(){return ce},get AGENT_UPLOAD_ACCEPT(){return _e},get AGENT_ASSISTANT_NAME(){return ye},get AGENT_ASSISTANT_AVATAR(){return Ce},get MESSAGE_RAIL_CONFIG(){return ge},get MESSAGE_META_CONFIG(){return xe},get agentEngineName(){return ve},MarketplacePanel:Ft,SchedulePanel:Wn,AgentPromptSettings:Dr,AgentEngineSelector:Ee,CopySessionButton:De};return Object.defineProperty(Le,"__isScriptSetup",{enumerable:!1,value:!0}),Le}});x(),u();var kr={ref:`rootRef`,class:`agent-view`},Ar={class:`agent-chat-area`},jr={class:`agent-tabs`,role:`tablist`},Mr=[`aria-selected`,`onClick`],Nr={class:`agent-tab-body`},Pr={key:0,class:`agent-chat-pane`},Fr={key:0,class:`agent-list-page`},Ir={key:0,class:`agent-page-bar`},Lr=[`title`,`aria-label`],Rr={class:`agent-page-title`},zr={key:0,class:`chat-loading`};function Br(e,n,r,a,s,c){return v(),t(`div`,kr,[I(` ═══ 宽屏:左侧会话列表(只在「对话」Tab 显示)═══
|
|
3
|
-
窄屏时这一整块不渲染,会话列表改成 body 里的一个整页(见 .agent-list-page) `),a.activeTab===`chat`&&!a.narrow?(v(),t(y,{key:0},[i(`aside`,{class:`agent-sidebar`,style:E({width:a.sidebarWidth+`px`})},[I(` 会话列表:UI 与交互都在组件库的 ConversationList 里 `),o(a.ConversationList,{class:`agent-conversations`,items:a.conversationItems,"active-id":a.currentSessionId,loading:a.sessionsLoading,labels:a.conversationLabels,onSelect:a.selectSession,onNew:a.handleNewSession,onRename:a.renameSession,onDelete:a.deleteSession},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],4),I(` 拖拽分隔条 `),i(`div`,{class:w([`sidebar-resizer`,{active:a.isResizing}]),onMousedown:a.startResize},null,34)],64)):I(`v-if`,!0),I(` ═══ 右侧:Tab 栏 + 内容区 ═══ `),i(`main`,Ar,[i(`nav`,jr,[(v(!0),t(y,null,j(a.tabs,e=>(v(),t(`button`,{key:e.id,type:`button`,class:w([`agent-tab`,{active:a.activeTab===e.id}]),role:`tab`,"aria-selected":a.activeTab===e.id,onClick:t=>a.activeTab=e.id},[o(a.ElIcon,null,{default:L(()=>[(v(),g(re(e.icon)))]),_:2},1024),i(`span`,null,H(e.label),1)],10,Mr))),128)),I(` ═══ 引擎选择器 ═══
|
|
4
|
-
与工作台执行器下拉同一套交互(点击展开、未安装标出来、点了直接开安装弹窗)。
|
|
5
|
-
下拉本体收口在 AgentEngineSelector,文件空间 g ai 面板复用同一份实现。
|
|
6
|
-
会话一旦落盘就置灰:引擎在会话建立时锁定(三家续聊标识互不通用),要换请新建。 `),a.activeTab===`chat`?(v(),g(a.AgentEngineSelector,{key:0,class:`agent-engine`,engine:a.displayEngine,locked:a.isEngineLocked,onSelect:a.handleEngineSelect},null,8,[`engine`,`locked`])):I(`v-if`,!0),I(` 复制整条会话(默认精简范围,小箭头可选全量)——与工作台的「复制执行内容」同一套口径 `),a.activeTab===`chat`?(v(),g(a.CopySessionButton,{key:1,class:`agent-copy`,messages:a.messages,title:a.currentSessionTitle,engine:a.agentEngineName(a.displayEngine)},null,8,[`messages`,`title`,`engine`])):I(`v-if`,!0)]),i(`div`,Nr,[I(` ── 对话 ── `),a.activeTab===`chat`?(v(),t(`div`,Pr,[I(` 窄屏 · 会话列表页:列表独占整页 `),a.narrow&&a.chatPage===`list`?(v(),t(`div`,Fr,[o(a.ConversationList,{class:`agent-conversations`,items:a.conversationItems,"active-id":a.currentSessionId,loading:a.sessionsLoading,labels:a.conversationLabels,onSelect:a.selectSession,onNew:a.handleNewSession,onRename:a.renameSession,onDelete:a.deleteSession},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])])):(v(),t(y,{key:1},[I(` 对话页(窄屏时顶上多一条返回条;宽屏左侧就摆着列表,不需要) `),a.narrow?(v(),t(`div`,Ir,[i(`button`,{type:`button`,class:`agent-page-back`,title:a.$t(`@AGENT:返回会话列表`),"aria-label":a.$t(`@AGENT:返回会话列表`),onClick:n[0]||=e=>a.chatPage=`list`},[...n[1]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Lr),i(`span`,Rr,H(a.currentSessionTitle),1)])):I(`v-if`,!0),I(`
|
|
7
|
-
对话宿主:单独开一层裁剪边界。
|
|
8
|
-
欢迎页在矮/窄窗口里会比可用高度还高,而它是垂直居中的 —— 溢出的部分
|
|
9
|
-
会**向上**跑出 .acu-chat,盖到刚加的返回条上(把返回条的点击也一起吃掉,
|
|
10
|
-
e2e 实测就是这个症状)。宿主的 overflow:hidden 把它裁在自己这一格里。
|
|
11
|
-
`),i(`div`,{class:`agent-chat-host`,style:a.welcomeAvatarStyle},[I(` 加载中 `),a.sessionLoading?(v(),t(`div`,zr,[o(a.ElIcon,{class:`is-loading`,size:32},{default:L(()=>[o(a.Loading)]),_:1}),i(`span`,null,H(a.$t(`@AGENT:加载会话中...`)),1)])):(v(),t(y,{key:1},[I(` ChatContainer `),o(a.ChatContainer,{ref:`chatContainerRef`,messages:a.displayMessages,"preset-questions":a.presetQuestions,"welcome-title":a.$t(`@AGENT:智能体助手`),"welcome-description":a.$t(`@AGENT:我可以帮你阅读代码、执行命令、修改文件。选择下方话题或直接输入你的问题。`),"assistant-name":a.AGENT_ASSISTANT_NAME,"assistant-avatar":a.AGENT_ASSISTANT_AVATAR,theme:a.chatTheme,generating:a.isStreaming,"allow-queue":!0,queued:a.queuedMessages,"queue-paused":a.queuePaused,"queue-labels":a.queueLabels,"upload-config":{accept:a.AGENT_UPLOAD_ACCEPT},"context-usage":a.inputContextUsage,placeholder:a.isStreaming?a.$t(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):a.$t(`@AGENT:输入消息,Enter 发送`),question:a.questionPanel,"question-submitting":a.answeringQuestion,"question-labels":a.questionLabels,"plan-config":{labels:{title:a.$t(`@AGENT:计划`),raw:a.$t(`@AGENT:原始参数`)}},"message-rail-config":a.MESSAGE_RAIL_CONFIG,"message-meta-config":a.MESSAGE_META_CONFIG,onSend:a.onSend,onSelect:a.onSelectPreset,onStop:a.stop,onUnqueue:a.removeQueuedMessage,onFlushQueued:a.flushQueued,onAnswer:a.answerQuestion,onRetry:a.retryTurn},null,8,[`messages`,`preset-questions`,`welcome-title`,`welcome-description`,`assistant-name`,`assistant-avatar`,`theme`,`generating`,`queued`,`queue-paused`,`queue-labels`,`upload-config`,`context-usage`,`placeholder`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`message-meta-config`,`onStop`,`onUnqueue`,`onFlushQueued`,`onAnswer`,`onRetry`])],2112))])],64))])):a.activeTab===`schedule`?(v(),t(y,{key:1},[I(` ── 定时任务 ── `),o(a.SchedulePanel,{onOpenSession:a.handleScheduleOpenSession})],2112)):a.activeTab===`skill`||a.activeTab===`mcp`?(v(),t(y,{key:2},[I(` ── Skill 广场 / MCP 广场 ── `),o(a.MarketplacePanel,{type:a.marketplaceType},null,8,[`type`])],2112)):(v(),t(y,{key:3},[I(` ── 设置(提示词设置)── `),o(a.AgentPromptSettings)],2112))])])],512)}var Vr=q(Or,[[`render`,Br],[`__scopeId`,`data-v-bd681ddd`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/AgentView.vue`]]);export{Vr as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,C as t,Dn as n,En as r,Fn as i,Gn as a,Ir as o,J as s,Jn as c,Ln as l,On as u,Pn as d,Qn as f,S as p,Sn as m,Vn as h,Xn as ee,Y as g,Yr as _,er as v,i as y,kn as b,lr as x,mr as S,ti as C,tt as te,w,xr as T}from"./element-plus-CJqN49tX.js";import{n as E,t as D}from"./_plugin-vue_export-helper-zp6tdw8N.js";import{t as ne}from"./SvgIcon-9IbiSszR.js";import{c as re,l as ie,s as ae,t as oe}from"./configStore-Z6Z8hVMO.js";import{W as se,h as ce,k as O}from"./index-C90dYckz.js";import{f as k,h as A,m as j,n as M,p as N}from"./agentConversations-Cplq42kA.js";h(),S();function P(e,t=680){let n=T(0),i=null;function o(){let t=e.value;return t?(n.value=t.clientWidth,typeof ResizeObserver>`u`||(i=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width;typeof t==`number`&&(n.value=t)}),i.observe(t),!0)):!1}return ee(()=>{o()||a(()=>o())}),c(()=>{i?.disconnect(),i=null}),{width:n,narrow:r(()=>n.value>0&&n.value<t)}}h();function F(){let e=oe(),t=se(),n=r({get:()=>e.resolvedTaskExecutor,set:t=>{re(t)&&e.setLastTaskExecutor(t)}}),i=r(()=>({claude:t.claudeAvailable,opencode:t.opencodeAvailable,codex:t.codexAvailable,codebuddy:t.codebuddyAvailable,pi:t.piAvailable})),a=r(()=>ae.some(e=>i.value[e.id])),o=r(()=>i.value[n.value]?n.value:Object.keys(i.value).find(e=>i.value[e])??n.value);function s(e){i.value[e]&&(n.value=e)}function c(e){return t.executorModelText(e)}function l(e){return[c(e),t.executorModelDetail(e)].filter(Boolean).join(` · `)}return{selected:n,active:o,availability:i,hasAnyExecutor:a,choose:s,executorModelText:c,executorModelTitle:l}}h(),S();var I=l({__name:`AgentEngineSelector`,props:{engine:{type:String,required:!0},locked:{type:Boolean,required:!1}},emits:[`select`],setup(e,{expose:n,emit:i}){n();let a=e,o=i,{availability:c}=F(),l=r(()=>j(a.engine)),u=r(()=>({gai:!0,...c.value})),d=T(!1),f=T(null);function m(e){if(!a.locked){if(!u.value[e]){if(!A(e))return;f.value=e,d.value=!0;return}o(`select`,e)}}let h={props:a,emit:o,executorAvailability:c,engineName:l,engineAvailability:u,installDialogVisible:d,installTool:f,onCommand:m,get $t(){return E},get ElIcon(){return s},get ElDropdown(){return p},get ElDropdownMenu(){return w},get ElDropdownItem(){return t},get ArrowDown(){return g},get Check(){return te},get AGENT_ENGINE_OPTIONS(){return k},get BUILTIN_ENGINE_ICON(){return N},get isExternalAgentEngine(){return A},SvgIcon:ne,TaskExecutorIcon:ce,ToolInstallDialog:O};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});h(),o();var L={class:`agent-engine`},R=[`disabled`,`title`,`aria-label`],z={class:`agent-engine__name`},B={class:`agent-engine__item`},V={class:`agent-engine__item-name`},H={key:3,class:`agent-engine__item-missing`};function U(t,r,a,o,s,c){return f(),e(m,null,[b(` 单根包一层:父级传下来的 class(Tab 行的 margin-left:auto、面板的 flex:none)
|
|
2
|
-
才能可靠落到这里 —— 多根组件会丢掉 fallthrough class。 `),n(`div`,L,[i(o.ElDropdown,{trigger:`click`,onCommand:o.onCommand},{dropdown:x(()=>[i(o.ElDropdownMenu,null,{default:x(()=>[(f(!0),e(m,null,v(o.AGENT_ENGINE_OPTIONS,t=>(f(),u(o.ElDropdownItem,{key:t.id,command:t.id},{default:x(()=>[n(`span`,B,[o.isExternalAgentEngine(t.id)?(f(),u(o.TaskExecutorIcon,{key:0,executor:t.id,class:`agent-engine__item-icon`},null,8,[`executor`])):(f(),u(o.SvgIcon,{key:1,"icon-class":o.BUILTIN_ENGINE_ICON,class:`agent-engine__item-icon`},null,8,[`icon-class`])),n(`span`,V,C(t.name),1),a.engine===t.id?(f(),u(o.ElIcon,{key:2,class:`agent-engine__item-check`},{default:x(()=>[i(o.Check)]),_:1})):o.engineAvailability[t.id]?b(`v-if`,!0):(f(),e(`span`,H,C(o.$t(`@42BB9:未安装`)),1))])]),_:2},1032,[`command`]))),128))]),_:1})]),default:x(()=>[n(`button`,{type:`button`,class:_([`agent-engine__btn`,{"is-locked":a.locked}]),disabled:a.locked,title:a.locked?o.$t(`@AGENT:本会话的引擎已锁定;要换引擎请新建会话`):o.$t(`@AGENT:新建会话使用的引擎`),"aria-label":o.$t(`@AGENT:智能体引擎`)},[o.isExternalAgentEngine(a.engine)?(f(),u(o.TaskExecutorIcon,{key:0,executor:a.engine,class:`agent-engine__icon`},null,8,[`executor`])):(f(),u(o.SvgIcon,{key:1,"icon-class":o.BUILTIN_ENGINE_ICON,class:`agent-engine__icon`},null,8,[`icon-class`])),n(`span`,z,C(o.engineName),1),i(o.ElIcon,{class:`agent-engine__caret`},{default:x(()=>[i(o.ArrowDown)]),_:1})],10,R)]),_:1}),i(o.ToolInstallDialog,{modelValue:o.installDialogVisible,"onUpdate:modelValue":r[0]||=e=>o.installDialogVisible=e,tool:o.installTool},null,8,[`modelValue`,`tool`])])],2112)}var W=D(I,[[`render`,U],[`__scopeId`,`data-v-c67a4d14`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/AgentEngineSelector.vue`]]),G=8192;function le(e,t){return e.length>t?`…(前文已截断)\n${e.slice(-t)}`:e}function ue(e,t){let n=e||`done`;return n!==`pending`&&n!==`running`||t===`running`||t===`pending`?n:t===`cancelled`||t===`error`?`error`:`done`}function K(e){let t=e?.toolCalls;if(!Array.isArray(t)||t.length===0)return[];let n=e?.status||`done`,r=[];for(let e=0;e<t.length;e++){let i=t[e];if(!i||typeof i!=`object`)continue;let a=ue(i.status,n),o=typeof i.result==`string`?i.result:``;r.push({id:typeof i.id==`string`&&i.id?i.id:`tool-${e}`,name:typeof i.name==`string`?i.name:``,argsPreview:typeof i.argsPreview==`string`?i.argsPreview:``,arguments:typeof i.arguments==`string`?i.arguments:``,result:o?le(o,G):``,status:a,error:typeof i.error==`string`&&i.error?i.error:void 0})}return r}var de=`
|
|
3
|
-
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
`,fe=`[运行环境 ·`,pe=`## 跨会话记忆库`,me=/\n\n---\n本任务包含 \d+ 个附件(请按文件路径读取[\s\S]*$/,he=/\n\n续接 #\d+\s*$/;function q(e){let t=e.indexOf(de);return t===-1?0:t+7}function J(e){let t=typeof e==`string`?e:``;return t?(t.startsWith(fe)&&(t=t.slice(q(t))),t.startsWith(pe)&&(t=t.slice(q(t))),t=t.replace(me,``).replace(he,``),t.trim()):``}function Y(e){switch(e){case`todo`:return E(`@WORKBENCH:待执行`);case`running`:return E(`@WORKBENCH:执行中`);case`done`:return E(`@WORKBENCH:已完成`);case`error`:return E(`@WORKBENCH:出错`);case`cancelled`:return E(`@WORKBENCH:已取消`);case`pending`:return E(`@WORKBENCH:排队中`);default:return e}}function ge(e){switch(e){case`running`:return`var(--color-primary)`;case`done`:return`#22c55e`;case`error`:return`#ef4444`;case`cancelled`:return`#9ca3af`;case`pending`:return`#f59e0b`;default:return`var(--text-tertiary)`}}function X(e){let t=e?new Date(e):new Date;if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function _e(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function ve(e){let t=(e.match(/`+/g)||[]).reduce((e,t)=>Math.max(e,t.length),0),n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}function Z(e,t){return`### ${e}\n\n${t.trim()}`}function ye(e){let t=[];return e.forEach((e,n)=>{let r=e.name||E(`@WORKBENCH:工具`),i=_e(e.argsPreview||``);t.push(`${n+1}. **${r}**${i?` — \`${i}\``:``}`);let a=(e.status===`error`?e.error:e.result)||e.result||e.error||``;a.trim()&&t.push(``,ve(a.trim()))}),t.join(`
|
|
7
|
-
`)}function be(e,t={},n={}){let r=Array.isArray(e)?e.filter(Boolean):[],i=n.scope===`brief`,a=[];if(r.forEach((e,t)=>{let n=[],r=J(e.prompt);if(r&&n.push(Z(E(`@WORKBENCH:用户提示词`),r)),!i){let t=(e.thinking||``).trim();t&&n.push(Z(E(`@WORKBENCH:Claude 思考`),t));let r=ye(K(e));r&&n.push(Z(E(`@WORKBENCH:工具调用`),r))}let o=(e.output||``).trim();o&&n.push(Z(E(`@WORKBENCH:模型返回`),o));let s=(e.error||e.agentError||``).trim();if(s&&n.push(Z(E(`@WORKBENCH:出错`),s)),n.length===0)return;let c=[ie(e.agent),Y(e.status),X(e.startedAt)].filter(Boolean);a.push(`## ${E(`@WORKBENCH:第 {n} 轮`,{n:t+1})}\n\n*${c.join(` · `)}*\n\n${n.join(`
|
|
8
|
-
|
|
9
|
-
`)}`)}),a.length===0)return``;let o=[`# ${(t.title||``).trim()||E(`@WORKBENCH:未命名任务`)}`],s=(t.projectName||``).trim();return s&&o.push(``,`- ${E(`@WORKBENCH:项目:{name}`,{name:s})}`),o.push(`- ${E(`@WORKBENCH:导出时间:{time}`,{time:X((t.now||new Date).toISOString())})}`),`${o.join(`
|
|
10
|
-
`)}\n\n---\n\n${a.join(`
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
`)}\n`}function xe(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function Se(e){let t=(e.match(/`+/g)||[]).reduce((e,t)=>Math.max(e,t.length),0),n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}function Q(e,t){return`### ${e}\n\n${t.trim()}`}function Ce(e,t){return e===`user`?E(`@AGENT:我`):t}function we(e){if(!Array.isArray(e)||!e.length)return``;let t=[];return e.forEach((e,n)=>{let r=e.name||E(`@AGENT:工具`),i=xe(e.argsPreview||``);t.push(`${n+1}. **${r}**${i?` — \`${i}\``:``}`);let a=(e.status===`error`?e.error:e.result)||e.result||e.error||``;a.trim()&&t.push(``,Se(a.trim()))}),t.join(`
|
|
15
|
-
`)}function Te(e,t,n){if(e.role===`system`)return``;let r=[];if(t){let t=(e.reasoning||``).trim();t&&r.push(Q(E(`@AGENT:思考`),t));let n=we(e.toolCalls);n&&r.push(Q(E(`@AGENT:工具调用`),n))}let i=(e.content||``).trim();i&&r.push(i);let a=(e.attachments||[]).map(e=>e.name).filter(Boolean);a.length&&r.push(`${E(`@AGENT:附件`)}:${a.join(`、`)}`);let o=(e.error||``).trim();if(o&&r.push(`> ⚠️ ${o}`),r.length===0){if(e.role!==`assistant`)return``;r.push(`*${E(`@AGENT:本轮未输出正文`)}*`)}return`## ${Ce(e.role,n)}\n\n${r.join(`
|
|
16
|
-
|
|
17
|
-
`)}`}function Ee(e,t={},n={}){let r=Array.isArray(e)?e.filter(Boolean):[],i=n.scope===`full`,a=(t.assistantName||``).trim()||`g ai`,o=[];for(let e of r){let t=Te(e,i,a);t&&o.push(t)}if(o.length===0)return``;let s=[`${E(`@AGENT:导出时间`)}:${X((t.now||new Date).toISOString())}`],c=(t.engine||``).trim();return c&&s.push(`${E(`@AGENT:引擎`)}:${c}`),s.push(E(`@AGENT:共 {n} 条消息`,{n:o.length})),`${`# ${(t.title||``).trim()||E(`@AGENT:无标题`)}\n\n- ${s.join(` · `)}`}\n\n---\n\n${o.join(`
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
`)}\n`}h(),S();var De=l({__name:`CopySessionButton`,props:{messages:{type:Array,required:!0},title:{type:String,required:!1},engine:{type:String,required:!1}},setup(e,{expose:t}){t();let n=e,r=T(!1),i=null;c(()=>{i&&clearTimeout(i)});async function a(e){try{if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function o(e){let t=Ee(n.messages||[],{title:n.title,engine:n.engine,assistantName:M},{scope:e});if(!t){y.warning(E(`@AGENT:暂无会话内容可复制`));return}if(!await a(t)){y.error(E(`@AGENT:复制失败`));return}r.value=!0,y.success(E(`@AGENT:已复制会话`)),i&&clearTimeout(i),i=setTimeout(()=>{r.value=!1,i=null},1500)}function s(e){o(e===`full`?`full`:`brief`)}let l={props:n,flash:r,get timer(){return i},set timer(e){i=e},copyToClipboard:a,doCopy:o,onCommand:s,get $t(){return E}};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}});h(),o();var $={class:`csb`},Oe=[`title`,`aria-label`],ke={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ae={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},je=[`title`,`aria-label`];function Me(r,a,o,s,c,l){let u=t,m=w,h=p;return f(),e(`div`,$,[n(`button`,{type:`button`,class:_([`csb__btn`,{"is-flash":s.flash}]),title:s.$t(`@AGENT:复制本会话的对话内容(默认精简:仅对话正文)`),"aria-label":s.$t(`@AGENT:复制会话`),onClick:a[0]||=e=>s.doCopy(`brief`)},[s.flash?(f(),e(`svg`,ke,[...a[1]||=[n(`polyline`,{points:`20 6 9 17 4 12`},null,-1)]])):(f(),e(`svg`,Ae,[...a[2]||=[n(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),n(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},null,-1)]]))],10,Oe),i(h,{trigger:`click`,placement:`bottom-end`,onCommand:s.onCommand},{dropdown:x(()=>[i(m,null,{default:x(()=>[i(u,{command:`brief`},{default:x(()=>[d(C(s.$t(`@AGENT:精简:对话正文`)),1)]),_:1}),i(u,{command:`full`},{default:x(()=>[d(C(s.$t(`@AGENT:全量:对话正文 + 思考 + 工具调用`)),1)]),_:1})]),_:1})]),default:x(()=>[n(`button`,{type:`button`,class:`csb__btn csb__caret`,title:s.$t(`@AGENT:选择复制范围`),"aria-label":s.$t(`@AGENT:选择复制范围`)},[...a[3]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`11`,height:`11`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`6 9 12 15 18 9`})],-1)]],8,je)]),_:1})])}var Ne=D(De,[[`render`,Me],[`__scopeId`,`data-v-76f63575`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/CopySessionButton.vue`]]);export{J as a,F as c,Y as i,P as l,be as n,K as o,ge as r,W as s,Ne as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.mindmap-preview[data-v-3969a8bf]{background:var(--bg-container,#fff);flex-direction:column;width:100%;height:100%;display:flex}.mindmap-preview-header[data-v-3969a8bf]{background:var(--bg-panel,var(--md-bg-subtle));font-size:var(--font-size-sm);align-items:center;gap:12px;padding:8px 14px;display:flex}.mindmap-preview-title[data-v-3969a8bf]{color:var(--text-primary,var(--md-text-strong));letter-spacing:.5px;font-weight:600}.mindmap-preview-hint[data-v-3969a8bf]{color:var(--text-secondary,var(--md-text-muted));font-size:var(--font-size-xs)}.mindmap-preview-canvas[data-v-3969a8bf]{flex:1;width:100%;min-height:0}.mindmap-preview-canvas[data-v-3969a8bf] .zm-mindmap,.mindmap-preview-canvas[data-v-3969a8bf]>*{width:100%;height:100%}.editor-agent-panel[data-v-7cc12c51]{background:var(--bg-panel);border-left:1px solid var(--border-color);flex-direction:column;flex-grow:1;flex-basis:0;min-width:200px;min-height:0;display:flex;overflow:hidden}.agent-panel-header[data-v-7cc12c51]{border-bottom:1px solid var(--border-color);flex-shrink:0;align-items:center;gap:8px;height:34px;padding:0 6px 0 12px;display:flex}.agent-panel-title[data-v-7cc12c51]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-meta);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-weight:700;overflow:hidden}.agent-panel-spacer[data-v-7cc12c51]{flex:1}.agent-panel-engine[data-v-7cc12c51]{flex:none}.agent-panel-icon-btn[data-v-7cc12c51]{border-radius:var(--radius-xs);width:24px;height:24px;color:var(--text-meta);cursor:pointer;transition:var(--transition-ui-fast);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex}.agent-panel-icon-btn[data-v-7cc12c51]:hover{background:var(--bg-hover);color:var(--text-secondary)}.agent-panel-body[data-v-7cc12c51]{flex:1;grid-template:"stage"minmax(0,1fr)"composer"/minmax(0,1fr);min-height:0;display:grid}.agent-panel-body.is-wide[data-v-7cc12c51]{grid-template-columns:240px minmax(0,1fr);grid-template-areas:"list chat""list composer"}.agent-panel-convs[data-v-7cc12c51]{grid-area:stage;min-height:0;padding:8px 10px;overflow-y:auto}.agent-panel-chat[data-v-7cc12c51]{grid-area:stage;min-height:0;display:flex}.agent-panel-body.is-wide .agent-panel-convs[data-v-7cc12c51]{grid-area:list}.agent-panel-body.is-wide .agent-panel-chat[data-v-7cc12c51]{grid-area:chat}.agent-panel-composer[data-v-7cc12c51]{padding:var(--acu-space-3) var(--acu-space-4) var(--acu-space-4);background:linear-gradient(to top, var(--acu-bg) 70%, transparent);grid-area:composer}.agent-panel-composer[data-v-7cc12c51] .acu-input-queue{--acu-queue-edge:var(--role-pending-edge);--acu-queue-surface:var(--role-pending-surface);--acu-queue-ink:var(--role-pending-ink);--acu-queue-wash:var(--role-pending-wash)}.agent-panel-chat[data-v-7cc12c51]>.acu-chat{flex:1;min-width:0}.agent-panel-chat[data-v-7cc12c51] .acu-avatar--left{background:0 0}.agent-panel-chat[data-v-7cc12c51] .acu-bubble-row.is-assistant .acu-bubble-main{width:var(--acu-bubble-max-width);max-width:var(--acu-bubble-max-width);position:relative}.agent-panel-chat[data-v-7cc12c51] .acu-bubble-row.is-assistant .acu-bubble{align-self:flex-start}.agent-panel-chat[data-v-7cc12c51] .acu-message-meta{margin:0;position:absolute;top:0;right:0}.agent-panel-composer[data-v-7cc12c51] .acu-input-wrap>.agent-context-slot{gap:var(--acu-space-2,8px);padding:var(--acu-space-2,8px) var(--acu-space-2,8px) 0;flex-wrap:wrap;display:flex}.agent-panel-composer[data-v-7cc12c51] .acu-input-attachments>.agent-context-slot{display:inline-flex}.agent-context-att[data-v-7cc12c51]{align-items:center;gap:var(--acu-space-2,8px);max-width:180px;padding:var(--acu-space-2,8px) var(--acu-space-3,12px);border:1px solid var(--acu-border);border-radius:var(--acu-radius-sm,8px);background:var(--acu-bg,var(--bg-container));color:var(--acu-text-secondary,var(--text-secondary));font-size:var(--acu-font-size-xs,12px);display:inline-flex;position:relative}.agent-context-att-icon[data-v-7cc12c51]{opacity:.75;flex-shrink:0}.agent-context-att-name[data-v-7cc12c51]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-context-att-remove[data-v-7cc12c51]{border-radius:var(--acu-radius-full,999px);background:var(--acu-text,var(--text-primary));width:18px;height:18px;color:var(--acu-bg,var(--bg-container));cursor:pointer;box-shadow:var(--acu-shadow-sm,0 1px 2px #0003);transition:transform var(--acu-duration-fast,.15s) var(--acu-easing,ease);border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:-6px;right:-6px}.agent-context-att-remove[data-v-7cc12c51]:hover{transform:scale(1.12)}.agent-context-att-remove[data-v-7cc12c51]:active{transform:scale(1.02)}.editor-view[data-v-fc2ebf13]{background:var(--bg-container);width:100%;height:100%;box-shadow:var(--shadow-sm);border-radius:0;display:flex;overflow:hidden}.editor-sidebar[data-v-fc2ebf13]{background:var(--bg-panel);flex-direction:column;flex-shrink:0;display:flex;overflow:hidden}.sidebar-header[data-v-fc2ebf13]{flex-shrink:0;justify-content:space-between;align-items:center;padding:8px 10px 6px;display:flex}.sidebar-title[data-v-fc2ebf13]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.sidebar-action-btn[data-v-fc2ebf13]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);background:0 0;border:none;align-items:center;padding:3px;display:flex}.sidebar-action-btn[data-v-fc2ebf13]:hover{color:var(--text-primary);background:var(--bg-hover)}.sidebar-search[data-v-fc2ebf13]{flex-shrink:0;align-items:center;padding:6px 10px;display:flex;position:relative}.sidebar-search-icon[data-v-fc2ebf13]{color:var(--text-meta);pointer-events:none;position:absolute;left:18px}.sidebar-search-input[data-v-fc2ebf13]{min-width:0;height:26px;font-size:var(--font-size-sm);color:var(--text-primary);background:var(--bg-input,#ffffff0a);border:1px solid var(--border-color);border-radius:var(--radius-base);transition:border-color var(--transition-fast), background var(--transition-fast);outline:none;flex:1;padding:0 24px 0 26px}.sidebar-search-input[data-v-fc2ebf13]::placeholder{color:var(--text-meta)}.sidebar-search-input[data-v-fc2ebf13]:hover{border-color:var(--text-tertiary)}.sidebar-search-input[data-v-fc2ebf13]:focus{border-color:var(--color-primary);background:var(--bg-panel)}.sidebar-search-clear[data-v-fc2ebf13]{cursor:pointer;width:18px;height:18px;color:var(--text-meta);transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;display:flex;position:absolute;right:14px}.sidebar-search-clear[data-v-fc2ebf13]:hover{background:var(--bg-hover);color:var(--text-primary)}.tree-name-hit[data-v-fc2ebf13]{color:var(--color-warning-light);border-radius:var(--radius-xs);background:#f59e0b26;padding:0 1px}.sidebar-tree[data-v-fc2ebf13]{flex:1;padding:4px 0;overflow:hidden auto}.tree-node[data-v-fc2ebf13]{cursor:pointer;border-radius:var(--radius-base);-webkit-user-select:none;user-select:none;height:24px;color:var(--text-primary);font-size:var(--font-size-mid);transition:background var(--transition-fast);white-space:nowrap;align-items:center;gap:4px;padding-right:8px;display:flex;overflow:hidden}.tree-node[data-v-fc2ebf13]:hover{background:var(--bg-hover)}.tree-node--active[data-v-fc2ebf13]{background:var(--tint-primary-12);color:var(--color-primary)}.tree-node--selected[data-v-fc2ebf13]{outline-offset:-1px;background:#63b3ed26;outline:1px solid #63b3ed59}.tree-arrow[data-v-fc2ebf13]{color:var(--text-meta);transition:transform var(--transition-fast);flex-shrink:0;align-items:center;width:12px;display:flex}.tree-arrow.expanded[data-v-fc2ebf13]{transform:rotate(90deg)}.tree-arrow-spacer[data-v-fc2ebf13]{flex-shrink:0;width:12px}.tree-icon[data-v-fc2ebf13]{font-size:var(--font-size-base);flex-shrink:0;align-items:center;line-height:1;display:flex}.tree-icon.mit-icon[data-v-fc2ebf13]{fill:currentColor;vertical-align:middle;width:14px;height:14px;display:inline-block}.tree-icon--dir[data-v-fc2ebf13]{color:#e8b84b}.tree-name[data-v-fc2ebf13]{text-overflow:ellipsis;min-width:0;font-size:var(--font-size-mid);flex:1;overflow:hidden}.tree-loading[data-v-fc2ebf13]{border:1.5px solid var(--color-primary);border-top-color:#0000;border-radius:50%;flex-shrink:0;width:10px;height:10px;animation:.8s linear infinite spin-fc2ebf13;display:inline-block}.tree-empty[data-v-fc2ebf13]{font-size:var(--font-size-sm);color:var(--text-meta);text-align:center;padding:24px 12px}.sidebar-loading[data-v-fc2ebf13]{flex:1;justify-content:center;align-items:center;display:flex}.spin-icon[data-v-fc2ebf13]{border:2px solid var(--color-primary);border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite spin-fc2ebf13;display:inline-block}@keyframes spin-fc2ebf13{to{transform:rotate(360deg)}}.editor-resizer[data-v-fc2ebf13]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;position:relative}.editor-resizer[data-v-fc2ebf13]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.editor-resizer[data-v-fc2ebf13]:hover{background:var(--tint-primary-06)}.editor-resizer[data-v-fc2ebf13]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.editor-main[data-v-fc2ebf13]{flex-direction:column;flex:1;display:flex;overflow:hidden}.editor-tabs[data-v-fc2ebf13]{background:var(--bg-panel);scrollbar-width:none;flex-shrink:0;display:flex;overflow:auto hidden}.editor-tabs[data-v-fc2ebf13]::-webkit-scrollbar{display:none}.editor-tab[data-v-fc2ebf13]{cursor:pointer;height:34px;font-size:var(--font-size-mid);color:var(--text-secondary);transition:background var(--transition-fast), color var(--transition-fast);-webkit-user-select:none;user-select:none;flex-shrink:0;align-items:center;gap:6px;min-width:80px;max-width:200px;padding:0 12px;display:flex}.editor-tab[data-v-fc2ebf13]:hover{background:var(--bg-hover);color:var(--text-primary)}.editor-tab.active[data-v-fc2ebf13]{background:var(--bg-container);color:var(--text-primary);border-bottom:2px solid var(--color-primary)}.tab-name[data-v-fc2ebf13]{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.tab-dirty-dot[data-v-fc2ebf13]{background:var(--color-warning);border-radius:50%;flex-shrink:0;width:6px;height:6px}.tab-close[data-v-fc2ebf13]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);opacity:0;transition:opacity var(--transition-fast), background var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;padding:2px;display:flex}.editor-tab:hover .tab-close[data-v-fc2ebf13],.editor-tab.active .tab-close[data-v-fc2ebf13]{opacity:1}.tab-close[data-v-fc2ebf13]:hover{background:var(--bg-hover);color:var(--color-danger-dark)}.editor-empty[data-v-fc2ebf13]{flex:1}.monaco-container[data-v-fc2ebf13]{flex:1;min-width:0;overflow:hidden}.monaco-container.hidden[data-v-fc2ebf13]{display:none}.image-tab-placeholder[data-v-fc2ebf13]{justify-content:center;align-items:center;gap:var(--spacing-sm);color:var(--text-secondary);background:var(--bg-container);text-align:center;padding:var(--spacing-lg);flex-direction:column;flex:1;display:flex}.image-tab-placeholder-title[data-v-fc2ebf13]{font-size:var(--font-size-md);font-weight:var(--font-weight-medium);color:var(--text-primary);word-break:break-all;margin:0}.image-tab-placeholder-hint[data-v-fc2ebf13]{font-size:var(--font-size-sm);color:var(--text-meta);margin:0}.editor-body[data-v-fc2ebf13]{flex:1;min-height:0;display:flex;overflow:hidden}.preview-resizer[data-v-fc2ebf13]{cursor:col-resize;width:6px;transition:background var(--transition-fast);z-index:2;background:0 0;flex-shrink:0;order:99;margin-left:auto;position:relative}.preview-resizer[data-v-fc2ebf13]:after{content:"";background:var(--color-gray-300);border-radius:var(--radius-xs);width:2px;height:32px;transition:background var(--transition-fast), height var(--transition-fast);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.preview-resizer[data-v-fc2ebf13]:hover{background:var(--tint-primary-06)}.preview-resizer[data-v-fc2ebf13]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.preview-panel[data-v-fc2ebf13]{background:var(--bg-panel);flex-direction:column;flex:1 1 0;min-width:200px;display:flex;overflow:hidden}.preview-header[data-v-fc2ebf13]{background:var(--bg-panel);flex-shrink:0;align-items:center;gap:6px;height:34px;padding:0 10px;display:flex}.preview-title[data-v-fc2ebf13]{font-size:var(--font-size-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--text-secondary);-webkit-user-select:none;user-select:none;font-weight:700}.preview-ext-badge[data-v-fc2ebf13]{font-size:var(--font-size-xs);border-radius:var(--radius-base);background:var(--tint-primary-16);color:var(--color-primary);letter-spacing:.04em;padding:1px 5px;font-weight:600}.preview-header-spacer[data-v-fc2ebf13]{flex:1}.preview-close-btn[data-v-fc2ebf13]{cursor:pointer;color:var(--text-meta);border-radius:var(--radius-base);transition:color var(--transition-fast), background var(--transition-fast);background:0 0;border:none;align-items:center;padding:3px;display:flex}.preview-close-btn[data-v-fc2ebf13]:hover{color:var(--color-danger-dark);background:var(--bg-hover)}.preview-body[data-v-fc2ebf13]{flex-direction:column;flex:1;display:flex;overflow:hidden}.preview-copybar[data-v-fc2ebf13]{border-bottom:1px solid var(--border-color);background:var(--bg-panel);flex-wrap:wrap;flex-shrink:0;align-items:center;gap:6px;padding:6px 10px;display:flex}.preview-copy-btn[data-v-fc2ebf13]{border:1px solid var(--border-color);border-radius:var(--radius-base);background:var(--bg-panel);color:var(--text-secondary);font-size:var(--font-size-xs);cursor:pointer;white-space:nowrap;transition:background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);align-items:center;gap:5px;padding:3px 10px;font-weight:600;display:inline-flex}.preview-copy-btn[data-v-fc2ebf13]:hover:not(:disabled){background:var(--bg-hover);color:var(--text-primary)}.preview-copy-btn[data-v-fc2ebf13]:disabled{opacity:.6;cursor:default}.preview-copy-btn.done[data-v-fc2ebf13]{border-color:var(--color-primary);color:var(--color-primary);background:var(--tint-primary-12)}.preview-copy-btn--primary[data-v-fc2ebf13]{background:var(--color-primary);color:#fff;border-color:#0000}.preview-copy-btn--primary[data-v-fc2ebf13]:hover:not(:disabled){background:var(--color-primary-dark,var(--color-primary));color:#fff}.preview-copy-btn--primary.done[data-v-fc2ebf13]{background:var(--color-primary);color:#fff;border-color:#0000}.preview-copy-btn-icon[data-v-fc2ebf13]{opacity:.75;font-family:monospace;font-size:11px}.preview-copy-embed[data-v-fc2ebf13]{color:var(--text-meta);font-size:var(--font-size-xs);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:5px;margin-left:auto;display:inline-flex}.preview-copy-embed input[data-v-fc2ebf13]{accent-color:var(--color-primary);margin:0}.preview-iframe[data-v-fc2ebf13]{background:0 0;border:none;flex:1;width:100%;height:100%}.preview-markdown[data-v-fc2ebf13]{flex:1;width:100%;height:100%;overflow:auto}.preview-mindmap[data-v-fc2ebf13]{background:var(--bg-container,#fff);flex-direction:column;flex:1;width:100%;height:100%;display:flex;overflow:hidden}.mindmap-toggle-btn.disabled[data-v-fc2ebf13]{opacity:.45;cursor:not-allowed}.mindmap-toggle-btn.active[data-v-fc2ebf13]{color:#fff;background:linear-gradient(#6366f1 0%,#4f46e5 100%);border-color:#4f46e5}.preview-image-wrap[data-v-fc2ebf13]{background:var(--bg-container);flex:1;justify-content:center;align-items:center;padding:16px;display:flex;overflow:auto}.preview-image-wrap img[data-v-fc2ebf13]{object-fit:contain;border-radius:var(--radius-base);max-width:100%;max-height:100%;box-shadow:0 2px 12px #0003}.editor-tabs-spacer[data-v-fc2ebf13]{flex:1}.preview-toggle-btn[data-v-fc2ebf13]{cursor:pointer;height:34px;color:var(--text-secondary);font-size:var(--font-size-sm);white-space:nowrap;transition:background var(--transition-fast), color var(--transition-fast);background:0 0;border:none;flex-shrink:0;align-items:center;gap:5px;padding:0 10px;display:flex}.preview-toggle-btn[data-v-fc2ebf13]:hover{background:var(--bg-hover);color:var(--text-primary)}.preview-toggle-btn.active[data-v-fc2ebf13]{color:var(--color-primary);background:var(--tint-primary-08)}.sidebar-actions[data-v-fc2ebf13]{align-items:center;gap:2px;display:flex}.tree-inline-input-row[data-v-fc2ebf13]{cursor:default;background:var(--bg-hover)}.tree-inline-input[data-v-fc2ebf13]{min-width:0;height:20px;font-size:var(--font-size-mid);background:var(--bg-container);border:1px solid var(--color-primary);border-radius:var(--radius-base);color:var(--text-primary);outline:none;flex:1;padding:0 5px;font-family:inherit}.ctx-menu[data-v-fc2ebf13]{z-index:var(--z-menu-float);background:var(--bg-container);border:1px solid var(--border-color);border-radius:var(--radius-md);-webkit-user-select:none;user-select:none;min-width:160px;padding:4px;position:fixed;box-shadow:0 8px 24px #00000059}.ctx-menu-icon[data-v-fc2ebf13]{flex-shrink:0;width:13px;height:13px}.ctx-menu-item[data-v-fc2ebf13]{border-radius:var(--radius-base);cursor:pointer;width:100%;font-size:var(--font-size-mid);color:var(--text-primary);text-align:left;transition:background var(--transition-fast);background:0 0;border:none;align-items:center;gap:8px;padding:6px 10px;display:flex}.ctx-menu-item[data-v-fc2ebf13]:hover{background:var(--bg-hover)}.ctx-menu-item--danger[data-v-fc2ebf13]{color:var(--color-danger-dark)}.ctx-menu-item--danger[data-v-fc2ebf13]:hover{background:#ef44441a}.ctx-menu-sep[data-v-fc2ebf13]{background:var(--border-color);height:1px;margin:4px 2px}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Dn as t,En as n,Fn as r,Gn as i,Ir as a,Jn as o,Ln as s,Nn as c,On as l,Pn as u,Qn as d,Sn as f,Sr as ee,Vn as p,W as te,Xn as ne,Yr as m,Zr as h,bn as re,dn as g,er as _,i as v,kn as y,lr as b,mn as ie,mr as ae,r as oe,sr as x,ti as S,ur as C,vn as w,wn as se,xn as T,xr as E,yn as ce}from"./element-plus-CJqN49tX.js";import{a as le,n as ue,r as de}from"./vendor-Cd7TGb0b.js";import{n as D,t as fe}from"./_plugin-vue_export-helper-zp6tdw8N.js";import{t as pe}from"./SvgIcon-9IbiSszR.js";import{t as me}from"./configStore-Z6Z8hVMO.js";import{a as he,c as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./monaco-CbN14ZVi.js";import{n as Se,r as O}from"./flow-mindmap-C-X_QPQI.js";import{B as Ce,F as we,I as Te,L as Ee,N as De,P as Oe,R as ke,V as k,a as A,f as Ae,z as j}from"./index-C90dYckz.js";import{a as M,c as N,i as je,l as Me,m as Ne,n as Pe,o as P,r as F,s as Fe,t as Ie,u as Le}from"./agentConversations-Cplq42kA.js";import{l as Re,s as I,t as L}from"./CopySessionButton-BbVtrOa7.js";function ze(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}p();var Be=s({__name:`MindmapPreview`,props:{content:{type:String,required:!0}},setup(e,{expose:t}){t();let r=e,i={props:r,data:n(()=>O(r.content||``,`未命名文档`)),get MindMap(){return Se}};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}});p();var R={class:`mindmap-preview`},z={class:`mindmap-preview-canvas`};function B(n,i,a,o,s,c){return d(),e(`div`,R,[i[0]||=t(`div`,{class:`mindmap-preview-header`},[t(`span`,{class:`mindmap-preview-title`},`整篇导图`),t(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),t(`div`,z,[r(o.MindMap,{data:o.data,"preview-mode":``},null,8,[`data`])])])}var Ve=fe(Be,[[`render`,B],[`__scopeId`,`data-v-3969a8bf`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/MindmapPreview.vue`]]);p(),ae();var He=s({__name:`EditorAgentPanel`,props:{activeFilePath:{type:[String,null],required:!1},activeFileName:{type:String,required:!1},active:{type:Boolean,required:!1}},emits:[`close`],setup(e,{expose:t,emit:r}){t();let a=e,s=r,{theme:c}=ke(),l=n(()=>c.value===`dark`?`dark`:`light`),{sessions:u,sessionsLoading:d,currentSessionId:f,messages:ee,displayMessages:p,isStreaming:te,questionPanel:m,answeringQuestion:h,isSessionGenerating:re,currentEngine:g,pendingEngine:_,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:ie,deleteSession:ae,renameSession:oe,newSession:S,sendMessage:C,retryTurn:w,answerQuestion:se,stop:T,inputContextUsage:ce,queuedMessages:fe,queuePaused:pe,removeQueuedMessage:me,flushQueued:he}=Le(),ge=n(()=>v.value?g.value:_.value);function _e(e){v.value||y(e)}let ve=n(()=>N(u.value,re)),ye=M(),be=P(),xe=Fe(),Se=n(()=>ve.value.find(e=>e.id===f.value)?.title||``),O=E(null),Ce=E(null),we=E(null),Te=E(null),Ee=E(null),{width:De,narrow:Oe}=Re(Ee),k=E(`chat`),A=E(null),Ae=E(!1),j=null,ze=n(()=>!!a.activeFileName&&!Ae.value);function Be(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function R(){let e=Ce.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!ze.value){if(!t)return;A.value=null,i(()=>t.remove());return}let n=A.value&&e.contains(A.value)?A.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Be(e),a=r??e;n.parentElement!==a&&a.insertBefore(n,r?r.firstChild:e.firstChild),A.value=n}function z(e=!0){O.value?.scrollToBottom(e)}async function B(e){let t=Ae.value?void 0:a.activeFilePath||void 0;await C(e.text,e.files,{openFilePath:t}),await i(),z()}function Ve(e){ie(e),k.value=`chat`}function He(){S(),k.value=`chat`}x(()=>ee.value.length,()=>{i(()=>z(!1))});function Ue(){let e=Te.value;!e||typeof MutationObserver>`u`||(j?.disconnect(),j=new MutationObserver(()=>R()),j.observe(e,{childList:!0,subtree:!0}))}x(()=>a.active,e=>{e&&(k.value=`chat`,b().catch(()=>{}),i(()=>{R(),z(!1)}))}),x(Oe,e=>{e||(k.value=`chat`)}),x(()=>a.activeFilePath,()=>{Ae.value=!1}),x(ze,e=>{e&&i(R)}),ne(()=>{b().catch(()=>{}),i(()=>{R(),Ue()})}),o(()=>{j?.disconnect(),j=null,A.value=null});let We={props:a,emit:s,theme:c,chatTheme:l,sessions:u,sessionsLoading:d,currentSessionId:f,messages:ee,displayMessages:p,isStreaming:te,questionPanel:m,answeringQuestion:h,isSessionGenerating:re,currentEngine:g,pendingEngine:_,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:ie,deleteSession:ae,renameSession:oe,newSession:S,sendMessage:C,retryTurn:w,answerQuestion:se,stop:T,inputContextUsage:ce,queuedMessages:fe,queuePaused:pe,removeQueuedMessage:me,flushQueued:he,displayEngine:ge,onEngineSelect:_e,conversationItems:ve,conversationLabels:ye,questionLabels:be,queueLabels:xe,currentSessionTitle:Se,chatRef:O,inputRef:Ce,chatHostRef:we,composerRef:Te,rootRef:Ee,width:De,narrow:Oe,page:k,contextSlot:A,contextDismissed:Ae,get slotObserver(){return j},set slotObserver(e){j=e},showContextCard:ze,findAttachmentsHost:Be,syncContextSlot:R,scrollToBottom:z,onSend:B,onSelectSession:Ve,onNewSession:He,watchChatDom:Ue,get $t(){return D},get ChatContainer(){return le},get ChatInput(){return ue},get ConversationList(){return de},get AGENT_UPLOAD_ACCEPT(){return Me},get agentEngineName(){return Ne},get AGENT_ASSISTANT_NAME(){return Pe},get AGENT_ASSISTANT_AVATAR(){return Ie},get MESSAGE_RAIL_CONFIG(){return je},get MESSAGE_META_CONFIG(){return F},AgentEngineSelector:I,CopySessionButton:L};return Object.defineProperty(We,"__isScriptSetup",{enumerable:!1,value:!0}),We}});p(),a(),g();var Ue={ref:`rootRef`,class:`editor-agent-panel`},We={class:`agent-panel-header`},Ge=[`title`,`aria-label`],Ke={class:`agent-panel-title`},qe={key:1,class:`agent-panel-title`},V=[`title`,`aria-label`],Je=[`title`],Ye={class:`agent-panel-convs`},Xe={ref:`chatHostRef`,class:`agent-panel-chat`},H=[`data-theme`],Ze=[`title`],Qe={class:`agent-context-att-name`},$e=[`title`,`aria-label`];function U(n,i,a,o,s,u){return d(),e(f,null,[y(`
|
|
2
|
-
文件空间右侧的 g ai 对话面板。
|
|
3
|
-
- 够宽(≥680px,判据同「智能体」视图):左边一列会话历史 + 右边对话,历史**直接摆在那儿**,
|
|
4
|
-
不用先点按钮翻过去;不够宽就折成两页,头部按钮来回翻
|
|
5
|
-
- 输入框常驻底部:ChatContainer 传 show-input=false,输入框拆出来自己摆在面板最下方。
|
|
6
|
-
于是两种形态、两个页面都有输入框 —— 列表页也能直接开聊,翻页时草稿与附件都不丢
|
|
7
|
-
- 复用的都是组件库的独立导出:ConversationList(列表)+ ChatContainer(气泡区)+ ChatInput(输入框)
|
|
8
|
-
- "当前打开的文档"通过请求级注入告知模型(sendMessage 的 openFilePath 选项);
|
|
9
|
-
它修饰的是**这一条消息的上下文**,所以做成附件卡片、搬进输入框内部(见 contextSlot)
|
|
10
|
-
- 自己持有一个 useAgentChat 实例:runs/refs 与「对话」Tab 隔离,互不打断
|
|
11
|
-
`),t(`div`,Ue,[t(`div`,We,[y(` 窄屏的列表页:整条 header 让给「返回对话 + 标题」 `),o.narrow&&o.page===`list`?(d(),e(f,{key:0},[t(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:o.$t(`@EDITOR:返回对话`),"aria-label":o.$t(`@EDITOR:返回对话`),onClick:i[0]||=e=>o.page=`chat`},[...i[4]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),t(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ge),t(`span`,Ke,S(o.$t(`@EDITOR:会话列表`)),1)],64)):(d(),e(`span`,qe,S(o.$t(`@EDITOR:g ai 对话`)),1)),i[7]||=t(`div`,{class:`agent-panel-spacer`},null,-1),y(` 引擎切换:与「智能体」视图同一套(同一个 AgentEngineSelector)。
|
|
12
|
-
宽屏左边摆着历史,对话区一直在,所以常驻;窄屏只在对话页出现 ——
|
|
13
|
-
列表页没有正在跑的对话,摆这儿只会挤占标题。 `),!o.narrow||o.page===`chat`?(d(),l(o.AgentEngineSelector,{key:2,class:`agent-panel-engine`,engine:o.displayEngine,locked:o.isEngineLocked,onSelect:o.onEngineSelect},null,8,[`engine`,`locked`])):y(`v-if`,!0),y(` 复制整条会话:只有对话页才有"当前这条会话"可复制(列表页连引擎选择器都不摆) `),!o.narrow||o.page===`chat`?(d(),l(o.CopySessionButton,{key:3,class:`agent-panel-copy`,messages:o.messages,title:o.currentSessionTitle,engine:o.agentEngineName(o.displayEngine)},null,8,[`messages`,`title`,`engine`])):y(`v-if`,!0),y(` 会话列表按钮:只有"列表是独立一页"时才需要它(宽屏列表就在旁边) `),o.narrow&&o.page===`chat`?(d(),e(`button`,{key:4,class:`agent-panel-icon-btn agent-panel-list-btn`,title:o.$t(`@EDITOR:会话列表`),"aria-label":o.$t(`@EDITOR:会话列表`),onClick:i[1]||=e=>o.page=`list`},[...i[5]||=[c(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-7cc12c51><line x1="8" y1="6" x2="21" y2="6" data-v-7cc12c51></line><line x1="8" y1="12" x2="21" y2="12" data-v-7cc12c51></line><line x1="8" y1="18" x2="21" y2="18" data-v-7cc12c51></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-7cc12c51></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-7cc12c51></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-7cc12c51></line></svg>`,1)]],8,V)):y(`v-if`,!0),t(`button`,{class:`agent-panel-icon-btn`,title:o.$t(`@EDITOR:关闭对话`),onClick:i[2]||=e=>o.emit(`close`)},[...i[6]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Je)]),t(`div`,{class:m([`agent-panel-body`,{"is-wide":!o.narrow}])},[y(` 会话历史:宽屏是常驻左列(行高正常 + 带搜索框),窄屏是独享整页 `),C(t(`div`,Ye,[r(o.ConversationList,{"show-search":!0,items:o.conversationItems,"active-id":o.currentSessionId,loading:o.sessionsLoading,labels:o.conversationLabels,onSelect:o.onSelectSession,onNew:o.onNewSession,onRename:o.renameSession,onDelete:o.deleteSession},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[ce,!o.narrow||o.page===`list`]]),y(` 气泡区:输入框已经不在这里了(show-input=false),见下面常驻的那一条 `),C(t(`div`,Xe,[r(o.ChatContainer,{ref:`chatRef`,"show-input":!1,messages:o.displayMessages,"assistant-name":o.AGENT_ASSISTANT_NAME,"assistant-avatar":o.AGENT_ASSISTANT_AVATAR,theme:o.chatTheme,question:o.questionPanel,"question-submitting":o.answeringQuestion,"question-labels":o.questionLabels,"plan-config":{labels:{title:o.$t(`@AGENT:计划`),raw:o.$t(`@AGENT:原始参数`)}},"message-rail-config":o.MESSAGE_RAIL_CONFIG,"message-meta-config":o.MESSAGE_META_CONFIG,onAnswer:o.answerQuestion,onRetry:o.retryTurn},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`message-meta-config`,`onAnswer`,`onRetry`])],512),[[ce,!o.narrow||o.page===`chat`]]),y(`
|
|
14
|
-
输入框常驻:两种形态、两个页面都在最下方(与演示页同一套做法)。
|
|
15
|
-
它被拆到 ChatContainer 外面,所以 acu-root 与 data-theme 得自己套上:
|
|
16
|
-
库把盒模型重置限定在 .acu-root 子树里,而 ChatInput 根节点是 div(不是 button),
|
|
17
|
-
少了它就会退回 content-box、横着溢出面板。
|
|
18
|
-
|
|
19
|
-
v-if="width > 0":**等量到本面板的宽度再挂载输入框**。库的 ChatInput 只在
|
|
20
|
-
onMounted 里量一次 scrollHeight,量到的宽度不对就再也纠不回来 —— 实测首帧挂载时
|
|
21
|
-
容器还没宽度,占位文案被折成十几行,textarea 直接顶到 200px 上限并一直卡在那里。
|
|
22
|
-
宽度是 useNarrowPane 在 onMounted 里同步量到的,所以这里晚的只是一次重渲染。
|
|
23
|
-
`),o.width>0?(d(),e(`div`,{key:0,ref:`composerRef`,class:`agent-panel-composer acu-root`,"data-theme":o.chatTheme},[r(o.ChatInput,{ref:`inputRef`,generating:o.isStreaming,"allow-queue":!0,queued:o.queuedMessages,"queue-paused":o.queuePaused,"queue-labels":o.queueLabels,placeholder:o.isStreaming?o.$t(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):o.$t(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:o.AGENT_UPLOAD_ACCEPT},"context-usage":o.inputContextUsage,onSend:o.onSend,onStop:o.stop,onUnqueue:o.removeQueuedMessage,onFlushQueued:o.flushQueued},null,8,[`generating`,`queued`,`queue-paused`,`queue-labels`,`placeholder`,`upload-config`,`context-usage`,`onStop`,`onUnqueue`,`onFlushQueued`]),y(`
|
|
24
|
-
当前文档:**和添加的附件同处一行、同一副样子**。
|
|
25
|
-
组件库的 ChatContainer / ChatInput 没有任何插槽(dist 里 \`slots\` 出现 0 次),
|
|
26
|
-
没法声明式地往输入框里放东西,所以:
|
|
27
|
-
· 往 \`.acu-input-wrap\` 插一个锚点,再把卡片 Teleport 进去(节点仍是 Vue 渲染的);
|
|
28
|
-
· **有附件行(.acu-input-attachments)时锚点住进它内部** —— 卡片因此成为那一行的
|
|
29
|
-
flex item,与附件并排、共用同一套 gap/wrap。只插在输入框最前面是不行的:
|
|
30
|
-
Vue 更新输入框时会用自己的锚点 \`insertBefore\`,把外来节点挤到后面去。
|
|
31
|
-
`),o.contextSlot?(d(),l(se,{key:0,to:o.contextSlot},[o.showContextCard?(d(),e(`div`,{key:0,class:`agent-context-att`,title:a.activeFilePath||``},[i[9]||=t(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[t(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),t(`polyline`,{points:`14 3 14 8 19 8`})],-1),t(`span`,Qe,S(a.activeFileName),1),t(`button`,{type:`button`,class:`agent-context-att-remove`,title:o.$t(`@EDITOR:不引用当前文档`),"aria-label":o.$t(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>o.contextDismissed=!0},[...i[8]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)],8,Ze)):y(`v-if`,!0)],8,[`to`])):y(`v-if`,!0)],8,H)):y(`v-if`,!0)],2)],512)],2112)}var et=fe(He,[[`render`,U],[`__scopeId`,`data-v-7cc12c51`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/EditorAgentPanel.vue`]]),W=1080,tt=6e5,nt=.86;function rt(e){if(!e||e.startsWith(`data:`))return!1;if(e.startsWith(`blob:`)||e.startsWith(`/`))return!0;try{return new URL(e,location.href).origin===location.origin}catch{return!1}}async function it(e){try{let t=await fetch(e);if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result||``),t.onerror=()=>e(``),t.readAsDataURL(n)})}catch{return null}}function at(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};if(typeof Image>`u`){r(e);return}let i=new Image,a=setTimeout(()=>r(e),4e3);i.onload=()=>{if(clearTimeout(a),!(i.naturalWidth>W||e.length>tt)){r(e);return}try{let t=Math.min(1,W/i.naturalWidth),n=Math.max(1,Math.round(i.naturalWidth*t)),a=Math.max(1,Math.round(i.naturalHeight*t)),o=document.createElement(`canvas`);o.width=n,o.height=a;let s=o.getContext(`2d`);if(!s){r(e);return}s.fillStyle=`#ffffff`,s.fillRect(0,0,n,a),s.drawImage(i,0,0,n,a),r(o.toDataURL(`image/jpeg`,nt))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function ot(e){let t=await it(e);return t?at(t):null}async function st(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>rt(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await ot(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function G(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var K={h1:`font-size:26px;font-weight:700;line-height:1.35;margin:28px 0 16px;color:#111;`,h2:`font-size:22px;font-weight:700;line-height:1.4;margin:26px 0 14px;color:#111;`,h3:`font-size:19px;font-weight:700;line-height:1.45;margin:22px 0 12px;color:#222;`,h4:`font-size:17px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:#333;`,h5:`font-size:16px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#333;`,h6:`font-size:15px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#555;`,p:`font-size:16px;line-height:1.8;margin:16px 0;color:#333;`,li:`font-size:16px;line-height:1.8;margin:0 0 6px;color:#333;`,ul:`margin:16px 0;padding-left:24px;`,ol:`margin:16px 0;padding-left:24px;`,blockquote:`margin:16px 0;padding:8px 16px;border-left:4px solid #e2e2e2;background:#f7f7f7;color:#666;font-size:15px;line-height:1.8;`,hr:`border:none;border-top:1px solid #e5e5e5;margin:26px 0;`,a:`color:#576b95;text-decoration:none;`,strong:`font-weight:700;color:#111;`,em:`font-style:italic;color:#555;`,code:`font-family:Menlo,Consolas,Monaco,monospace;font-size:0.92em;background:#f2f3f5;color:#c7254e;padding:1px 5px;border-radius:3px;`,pre:`font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.6;background:#f6f8fa;color:#24292f;padding:12px 14px;border-radius:6px;overflow-x:auto;margin:16px 0;`,table:`border-collapse:collapse;width:100%;margin:16px 0;font-size:14px;`,th:`border:1px solid #e0e0e0;padding:8px 10px;background:#f6f8fa;font-weight:600;text-align:left;color:#333;`,td:`border:1px solid #e0e0e0;padding:8px 10px;color:#333;`,img:`max-width:100%;height:auto;display:block;margin:16px auto;border-radius:6px;`};function ct(e){e.querySelectorAll(`*`).forEach(e=>{let t=K[e.tagName.toLowerCase()];t&&e.setAttribute(`style`,t)}),e.querySelectorAll(`pre code`).forEach(e=>e.setAttribute(`style`,`background:none;padding:0;color:inherit;font-size:inherit;`))}async function lt(e,t){let n=e.cloneNode(!0),r=t?await st(n):0;return{html:n.innerHTML,leftover:r}}async function ut(e,t){let n=e.cloneNode(!0),r=t.inline?await st(n):0;ct(n);let i=(t.title||``).trim();return{html:`<section style="font-size:16px;line-height:1.8;color:#333;word-break:break-word;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;">${i?`<h1 style="font-size:26px;font-weight:700;line-height:1.35;margin:0 0 22px;color:#111;">${G(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}p(),ae();var dt=6e4,ft=3e4,pt=s({__name:`EditorView`,props:{pendingFilePath:{type:[String,null],required:!1}},setup(e,{expose:t}){t(),self.MonacoEnvironment={getWorker(e,t){return t===`json`?new xe:t===`css`||t===`scss`||t===`less`?new ye:t===`html`||t===`handlebars`||t===`razor`?new he:t===`typescript`||t===`javascript`?new _e:new ge}};let r=e,a=me(),s=Ae(),c=E([]),l=E(!1),u=E(``),d=E(``),f=null;function p(){u.value=``,d.value=``,f&&=(clearTimeout(f),null)}x(u,e=>{f&&clearTimeout(f),f=setTimeout(()=>{d.value=e,f=null},180)}),o(()=>{f&&clearTimeout(f),re(),Xe()});let m=null;function h(){re(),a.ui.fileTreeAutoRefresh&&(m=setInterval(()=>{document.hidden||a.currentDirectory&&(u.value.trim()||S())},dt))}function re(){m&&=(clearInterval(m),null)}x(()=>a.currentDirectory,async()=>{if(F=!1,h(),await _(),O.value.some(e=>e.isDirty)){F=!0;return}O.value=[],M.value=null,R(),await Le()}),x(()=>a.ui.fileTreeAutoRefresh,()=>{h()});async function g(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function _(){let e=a.currentDirectory;if(e){l.value=!0;try{c.value=await g(e,0)}finally{l.value=!1}}}function y(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&y(n.children,t));return t}function b(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=b(e.children,t+1),n.expanded=!0),n})}async function ie(e){let t=a.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:b(n.items,0)}catch{return null}}function ae(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?ae(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function S(e={}){if(!a.currentDirectory)return;let t=await ie([...y(c.value)]);if(!t){e.notifyOnError&&v.error(D(`@EDITOR:刷新失败`));return}if(c.value.length===0){c.value=t;return}ae(c.value,t)&&(c.value=t)}async function C(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await g(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function w(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...w(n.children));return t}let se=n(()=>d.value.trim().toLowerCase());function T(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?T(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let ce=n(()=>T(c.value,se.value)),le=n(()=>se.value.length>0&&ce.value.length===0);function ue(e){let t=d.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let de=E(null);function fe(){let e=de.value;e&&(e.focus(),e.select())}function Se(){u.value?(p(),de.value?.focus()):(de.value?.blur(),I.value?.focus())}let O=E([]),M=E(null),N=E(null);async function je(e){if(N.value=e,e.type!==`file`){C(e);return}let t=O.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:O.value.length}),t){M.value=e.path,i(()=>B());return}let n=e.name.split(`.`).pop()||``;if(Rt.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};O.value.push(t),M.value=e.path,Y.value=!0;return}if(j(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};O.value.push(t),M.value=e.path,X.value=!1,Y.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){v.error(`${D(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=ze(n),a=L.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),O.value.push(o),M.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,O.value.length,`activeTabPath=`,M.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),v.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}x(()=>r.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await i();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await je({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Me(e,t){t.stopPropagation();let n=O.value.findIndex(t=>t.path===e);n!==-1&&(!O.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(O.value.splice(n,1),M.value===e&&(M.value=O.value[Math.min(n,O.value.length-1)]?.path??null))}let Ne=()=>O.value.find(e=>e.path===M.value)??null,Pe=n(()=>({expandedDirs:[...y(c.value)],tabs:O.value.map(e=>e.path),activeTab:M.value})),P=!1,F=!1;function Fe(){F&&!P&&a.isUiLoaded&&a.saveEditorWorkspace(Pe.value)}x(Pe,()=>Fe());async function Ie(e){if(O.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Rt.has(n)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(j(t)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=L.get(e);i&&!i.isDisposed()&&I.value?.getModel()!==i&&(i.dispose(),L.delete(e)),O.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:ze(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Le(){try{for(let e=0;e<100&&!a.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!a.isUiLoaded)return;W.value=a.ui.editorSidebarWidth;let e=a.getEditorWorkspace();if(!e)return;P=!0;try{if(e.expandedDirs.length>0){let t=await ie(e.expandedDirs);t&&(c.value=t)}for(let t of e.tabs)await Ie(t);if(!r.pendingFilePath&&e.activeTab&&O.value.some(t=>t.path===e.activeTab)){M.value=e.activeTab;let t=Ne(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Rt.has(n)||j(t.name))&&(Y.value=!0)}}finally{P=!1}}finally{F=!0,Fe()}}let Re=E(null),I=ee(null),L=new Map;function Be(e){let t=L.get(e.path);return(!t||t.isDisposed())&&(t=be.createModel(e.content,e.language,ve.file(e.path)),L.set(e.path,t)),t}function R(){I.value?.setModel(null);for(let e of L.values())e.isDisposed()||e.dispose();L.clear()}function z(){if(!Re.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;I.value=be.create(Re.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),I.value.onDidChangeModelContent(()=>{let e=Ne();if(!e)return;let t=I.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),I.value.onDidBlurEditorText(()=>{a.ui.editorAutoSave&&Ne()?.isDirty&&Qe(!1),requestAnimationFrame(()=>{if(!U.value||U.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})})}x(M,e=>{if(!I.value||!e)return;let t=O.value.find(t=>t.path===e);if(!t)return;let n=Be(t);I.value.setModel(n),i(()=>B()),qe(e)});function B(){if(!I.value)return;I.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let He=0,Ue=new Map;async function We(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function Ge(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function Ke(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=L.get(e.path);if(!r||r.isDisposed())return;let i=I.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function qe(e){if(!e)return;let t=O.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++He,r=await We(e);if(n!==He||O.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Ue.get(e)===r.mtimeMs)return;Ue.set(e,r.mtimeMs);try{await oe.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Ge(e);i&&O.value.find(t=>t.path===e)===t&&Ke(t,i.content,i.mtimeMs)}function V(){document.hidden||qe(M.value)}let Je=null;function Ye(){Xe(),Je=setInterval(()=>{document.hidden||qe(M.value)},ft)}function Xe(){Je&&=(clearInterval(Je),null)}x(()=>O.value.filter(e=>e.isDirty).length,e=>{s.setDirtyCount(e)},{immediate:!0}),o(()=>s.setDirtyCount(0)),ke(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;be.setTheme(e?`vs-dark`:`vs`)});let H=null;function Ze(){if(H||!U.value)return;let e=[U.value],t=U.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}H=new MutationObserver(()=>{U.value&&U.value.offsetParent!==null&&M.value&&I.value&&(qe(M.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()}))});let n=H;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{z(),await _(),await Le(),Ze(),h(),window.addEventListener(`focus`,V),document.addEventListener(`visibilitychange`,V),Ye(),M.value&&i(()=>B())}),o(()=>{H?.disconnect(),H=null,window.removeEventListener(`focus`,V),document.removeEventListener(`visibilitychange`,V),I.value?.dispose(),L.forEach(e=>e.dispose()),L.clear()});async function Qe(e=!1){let t=Ne();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){v.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||v.success(D(`@EDITOR:已保存`))}catch(e){v.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function $e(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),fe();return}t&&e.key===`s`&&(e.preventDefault(),Qe())}ne(()=>window.addEventListener(`keydown`,$e)),o(()=>window.removeEventListener(`keydown`,$e));let U=E(null),W=E(a.ui.editorSidebarWidth),tt=!1,nt=0,rt=0;function it(e){tt=!0,nt=e.clientX,rt=W.value,document.addEventListener(`mousemove`,at),document.addEventListener(`mouseup`,ot),e.preventDefault()}function at(e){if(!tt)return;let t=e.clientX-nt;W.value=Math.max(140,Math.min(400,rt+t))}function ot(){tt=!1,document.removeEventListener(`mousemove`,at),document.removeEventListener(`mouseup`,ot),W.value!==a.ui.editorSidebarWidth&&a.setEditorSidebarWidth(W.value)}function st(e){return e.type===`directory`?k(e.name):Ce(e.name)}let G=E(null),K=E(null),ct=E(null),pt=E(null);function mt(){let e=N.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):a.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:a.currentDirectory??``,afterNode:null,depth:0}}async function ht(){let e=mt();N.value?.type===`directory`&&!N.value.expanded&&await C(N.value),G.value={...e,kind:`file`,value:``},await i(),ct.value?.focus()}async function gt(){let e=mt();N.value?.type===`directory`&&!N.value.expanded&&await C(N.value),G.value={...e,kind:`directory`,value:``},await i(),ct.value?.focus()}function _t(){G.value=null}async function vt(){let e=G.value;if(!e||!e.value.trim()){G.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){v.error(e.error);return}v.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){v.error(e.error);return}v.success(D(`@EDITOR:创建成功`))}G.value=null,await S()}function yt(e){e.key===`Enter`&&(e.preventDefault(),vt()),e.key===`Escape`&&(e.preventDefault(),_t())}let q=E(null),bt=E(null);function xt(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function St(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await C(e);let t=mt();G.value={...t,kind:`file`,value:``},await i(),ct.value?.focus()}async function Ct(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await C(e);let t=mt();G.value={...t,kind:`directory`,value:``},await i(),ct.value?.focus()}async function wt(){let e=q.value?.node;J(),e&&(K.value={node:e,value:e.name},await i(),pt.value?.focus(),pt.value?.select())}async function Tt(){let e=K.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){K.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){v.error(r.error);return}let i=O.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,M.value===e.node.path&&(M.value=n)),K.value=null,await S()}function Et(e){e.key===`Enter`&&(e.preventDefault(),Tt()),e.key===`Escape`&&(e.preventDefault(),K.value=null)}async function Dt(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){v.error(n.error);return}let r=O.value.findIndex(t=>t.path===e.path);r!==-1&&(O.value.splice(r,1),M.value===e.path&&(M.value=O.value[Math.max(0,r-1)]?.path??null)),v.success(D(`@EDITOR:已删除`)),await S()}async function Ot(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error)}catch(e){v.error(e?.message||String(e))}}function kt(e){let t=a.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function At(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function jt(){let e=q.value?.node;J(),e&&(await At(e.path)?v.success(D(`@EDITOR:已复制到剪贴板`)):v.error(D(`@EDITOR:复制失败`)))}async function Mt(){let e=q.value?.node;J(),e&&(await At(kt(e.path))?v.success(D(`@EDITOR:已复制到剪贴板`)):v.error(D(`@EDITOR:复制失败`)))}async function Nt(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){v.error(e?.message||String(e))}}let Pt=new Set([`html`,`htm`]),Ft=n(()=>{let e=q.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Pt.has(t)});async function It(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){v.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,J)),o(()=>document.removeEventListener(`click`,J));let Lt=new Set([`md`,`html`,`htm`,`svg`]),Rt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),Y=E(!1),X=E(!1),Z=E(!1),zt=E(!1),Bt=E(0),Q=n(()=>O.value.find(e=>e.path===M.value)??null),Vt=n(()=>Q.value?.language===`plaintext`&&Q.value?.content===``),Ht=n(()=>Q.value?.language===`office`),$=n(()=>(Q.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Ut=n(()=>Lt.has($.value)||Rt.has($.value)||j($.value)),Wt=n(()=>((Q.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Gt=n(()=>$.value===`md`&&Wt.value>0);x(M,()=>{Y.value&&!Ut.value&&(Y.value=!1),X.value&&!Gt.value&&(X.value=!1)});function Kt(){Ut.value&&(Y.value||(X.value=!1,Z.value=!1),Y.value=!Y.value)}function qt(){Gt.value&&(X.value||(Y.value=!1,Z.value=!1),X.value=!X.value)}function Jt(){Z.value||(Y.value=!1,X.value=!1),Z.value=!Z.value,zt.value=!0}let Yt=E(null),Xt=E(!1),Zt=E(``),Qt=E(!0),$t=null,en=n(()=>!X.value&&Y.value&&$.value===`md`&&!!Q.value);function tn(){return Q.value?.content??``}function nn(){return tn().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function rn(e,t,n){if(!e){v.error(D(`@EDITOR:复制失败`));return}Zt.value=n,$t&&clearTimeout($t),$t=setTimeout(()=>{Zt.value=``},1800),t>0?v.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):v.success(D(`@EDITOR:已复制`))}async function an(){rn(await At(tn()),0,`md`)}async function on(){let e=Yt.value?.getRenderedElement();if(e){Xt.value=!0;try{let{html:t,leftover:n}=await lt(e,Qt.value);rn(await At(t),n,`html`)}finally{Xt.value=!1}}}function sn(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0;`,t.innerHTML=e,document.body.appendChild(t);try{let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n);let r=document.execCommand(`copy`);return e?.removeAllRanges(),r}catch{return!1}finally{document.body.removeChild(t)}}async function cn(){let e=Yt.value?.getRenderedElement();if(e){Xt.value=!0;try{let{html:t,leftover:n}=await ut(e,{inline:Qt.value,title:nn()}),r=tn(),i=!1;try{navigator.clipboard?.write&&typeof ClipboardItem<`u`&&(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([r],{type:`text/plain`})})]),i=!0)}catch{i=!1}i||=sn(t),rn(i,n,`rich`)}finally{Xt.value=!1}}}let ln=n(()=>{let e=Q.value;if(!e)return``;let t=$.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Oe(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),un=!1,dn=0,fn=0;function pn(e){un=!0,dn=e.clientX,fn=Bt.value,document.addEventListener(`mousemove`,mn),document.addEventListener(`mouseup`,hn),e.preventDefault()}function mn(e){if(!un)return;let t=e.clientX-dn;Bt.value=Math.max(200,Math.min(900,fn+t))}function hn(){un=!1,document.removeEventListener(`mousemove`,mn),document.removeEventListener(`mouseup`,hn)}let gn={props:r,configStore:a,editorTabsStore:s,treeNodes:c,treeLoading:l,searchQuery:u,debouncedSearchQuery:d,get searchDebounceTimer(){return f},set searchDebounceTimer(e){f=e},clearSearch:p,TREE_POLL_MS:dt,get treePollTimer(){return m},set treePollTimer(e){m=e},startTreePolling:h,stopTreePolling:re,loadDir:g,initTree:_,collectExpandedPaths:y,toTreeNodes:b,fetchTreeSnapshot:ie,reconcileTree:ae,refreshTree:S,toggleDir:C,flattenTree:w,searchQueryLower:se,filterTree:T,visibleTree:ce,noSearchResults:le,highlightName:ue,searchInputRef:de,focusSearchInput:fe,onSearchEscape:Se,tabs:O,activeTabPath:M,selectedNode:N,openFile:je,closeTab:Me,activeTab:Ne,workspaceSnapshot:Pe,get workspaceRestoring(){return P},set workspaceRestoring(e){P=e},get workspaceHydrated(){return F},set workspaceHydrated(e){F=e},persistWorkspace:Fe,restoreTab:Ie,restoreWorkspace:Le,editorContainerRef:Re,editorInstance:I,modelCache:L,getOrCreateModel:Be,disposeAllModels:R,mountEditor:z,focusEditor:B,get diskSyncSeq(){return He},set diskSyncSeq(e){He=e},diskConflictPromptedAt:Ue,fetchFileMeta:We,fetchFileContent:Ge,applyDiskContent:Ke,syncActiveTabWithDisk:qe,handleWindowFocus:V,DISK_SYNC_POLL_MS:ft,get diskSyncTimer(){return Je},set diskSyncTimer(e){Je=e},startDiskSyncPolling:Ye,stopDiskSyncPolling:Xe,get viewVisibilityObserver(){return H},set viewVisibilityObserver(e){H=e},setupViewVisibilityObserver:Ze,saveCurrentFile:Qe,handleKeydown:$e,containerRef:U,sidebarWidth:W,get isResizing(){return tt},set isResizing(e){tt=e},get resizeStartX(){return nt},set resizeStartX(e){nt=e},get resizeStartW(){return rt},set resizeStartW(e){rt=e},startSidebarResize:it,onSidebarResize:at,stopSidebarResize:ot,getNodeSpriteId:st,inlineInput:G,renameInput:K,inlineInputRef:ct,renameInputRef:pt,getTargetDir:mt,startNewFile:ht,startNewFolder:gt,cancelInlineInput:_t,confirmInlineInput:vt,handleInlineKeydown:yt,ctxMenu:q,ctxMenuRef:bt,openContextMenu:xt,closeContextMenu:J,ctxNewFile:St,ctxNewFolder:Ct,ctxRename:wt,confirmRename:Tt,handleRenameKeydown:Et,ctxDelete:Dt,ctxRevealInExplorer:Ot,toWorkspaceRelative:kt,copyToClipboard:At,ctxCopyAbsolutePath:jt,ctxCopyRelativePath:Mt,ctxOpenInVscode:Nt,BROWSER_OPEN_EXTS:Pt,ctxMenuCanOpenInBrowser:Ft,ctxOpenInBrowser:It,PREVIEW_TEXT_EXTS:Lt,IMAGE_EXTS:Rt,showPreview:Y,showMindmap:X,showAgentChat:Z,agentOpened:zt,previewWidth:Bt,activeTabRef:Q,activeTabIsImage:Vt,activeTabIsOffice:Ht,activeExt:$,isPreviewable:Ut,mindmapTitleCount:Wt,isMindmapable:Gt,togglePreview:Kt,toggleMindmap:qt,toggleAgentChat:Jt,mdPreviewRef:Yt,mdCopyBusy:Xt,mdCopiedType:Zt,mdCopyInlineImages:Qt,get mdCopiedTimer(){return $t},set mdCopiedTimer(e){$t=e},mdCopyAvailable:en,mdSourceText:tn,mdDocTitle:nn,mdCopyFeedback:rn,copyMarkdownSource:an,copyRenderedHtml:on,copyRichTextBySelection:sn,copyRichTextToClipboard:cn,previewSrcdoc:ln,get isPreviewResizing(){return un},set isPreviewResizing(e){un=e},get previewResizeStartX(){return dn},set previewResizeStartX(e){dn=e},get previewResizeStartW(){return fn},set previewResizeStartW(e){fn=e},startPreviewResize:pn,onPreviewResize:mn,stopPreviewResize:hn,get $t(){return D},get ElTooltip(){return te},ImagePreview:Ee,OfficePreview:we,MarkdownPreview:Te,MindmapPreview:Ve,EditorAgentPanel:et,EmptyState:A,SvgIcon:pe,get PREVIEW_IFRAME_SANDBOX(){return De}};return Object.defineProperty(gn,"__isScriptSetup",{enumerable:!1,value:!0}),gn}});p(),a(),g();var mt={class:`editor-view`,ref:`containerRef`},ht={class:`sidebar-header`},gt={class:`sidebar-title`},_t={class:`sidebar-actions`},vt={class:`sidebar-search`},yt=[`placeholder`,`title`],q=[`title`,`aria-label`],bt={key:0,class:`sidebar-tree`},xt={key:1,class:`tree-arrow-spacer`},J={class:`tree-icon mit-icon`,"aria-hidden":`true`},St=[`xlink:href`],Ct=[`onClick`,`onContextmenu`],wt={key:1,class:`tree-arrow-spacer`},Tt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},Et=[`xlink:href`],Dt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ot=[`xlink:href`],kt=[`title`],At={key:0,class:`tree-name-hit`},jt={key:4,class:`tree-loading`},Mt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Nt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Pt=[`placeholder`],Ft={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},It={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Lt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Rt=[`placeholder`],Y={key:1,class:`tree-empty`},X={key:1,class:`sidebar-loading`},Z={class:`editor-main`},zt={key:0,class:`editor-tabs`},Bt=[`onClick`,`title`],Q={class:`tab-name`},Vt={key:0,class:`tab-dirty-dot`},Ht=[`onClick`],$=[`title`],Ut=[`disabled`,`title`],Wt=[`title`],Gt={class:`editor-body`},Kt={key:0,class:`image-tab-placeholder`},qt={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},Jt={class:`image-tab-placeholder-title`},Yt={class:`image-tab-placeholder-hint`},Xt={class:`preview-header`},Zt={class:`preview-title`},Qt={class:`preview-ext-badge`},$t=[`title`],en={class:`preview-body`},tn={key:0,class:`preview-copybar`},nn=[`disabled`,`title`],rn=[`disabled`,`title`],an=[`disabled`,`title`],on=[`title`],sn=[`sandbox`,`srcdoc`];function cn(n,i,a,o,s,ee){return d(),e(f,null,[t(`div`,mt,[y(` 左侧文件树 `),t(`div`,{class:`editor-sidebar`,style:h({width:o.sidebarWidth+`px`})},[t(`div`,ht,[t(`span`,gt,S(o.$t(`@EDITOR:资源管理器`)),1),t(`div`,_t,[r(o.ElTooltip,{content:o.$t(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:o.startNewFile},[y(` new-file icon `),i[12]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),t(`polyline`,{points:`14 2 14 8 20 8`}),t(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),t(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)])]),_:1},8,[`content`]),r(o.ElTooltip,{content:o.$t(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:o.startNewFolder},[y(` new-folder icon `),i[13]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),t(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),t(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)])]),_:1},8,[`content`]),r(o.ElTooltip,{content:o.$t(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>o.refreshTree({notifyOnError:!0})},[...i[14]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`1 4 1 10 7 10`}),t(`polyline`,{points:`23 20 23 14 17 14`}),t(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),t(`div`,vt,[i[16]||=t(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[t(`circle`,{cx:`11`,cy:`11`,r:`7`}),t(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),C(t(`input`,{ref:`searchInputRef`,"onUpdate:modelValue":i[1]||=e=>o.searchQuery=e,type:`text`,class:`sidebar-search-input`,placeholder:o.$t(`@EDITOR:搜索文件...`),title:o.$t(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(o.onSearchEscape,[`escape`])},null,40,yt),[[w,o.searchQuery]]),o.searchQuery?(d(),e(`button`,{key:0,class:`sidebar-search-clear`,title:o.$t(`@EDITOR:清除搜索`),"aria-label":o.$t(`@EDITOR:清除搜索`),onClick:o.clearSearch},[...i[15]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,q)):y(`v-if`,!0)]),o.treeLoading?(d(),e(`div`,X,[...i[25]||=[t(`span`,{class:`spin-icon`},null,-1)]])):(d(),e(`div`,bt,[(d(!0),e(f,null,_(o.flattenTree(o.visibleTree),n=>(d(),e(f,{key:n.path},[y(` 重命名时用输入框替换节点 `),o.renameInput&&o.renameInput.node.path===n.path?(d(),e(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+n.depth*14+`px`})},[n.type===`directory`?(d(),e(`span`,{key:0,class:m([`tree-arrow`,{expanded:n.expanded}])},[...i[17]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(d(),e(`span`,xt)),(d(),e(`svg`,J,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,St)])),C(t(`input`,{ref_for:!0,ref:`renameInputRef`,"onUpdate:modelValue":i[2]||=e=>o.renameInput.value=e,onKeydown:o.handleRenameKeydown,onBlur:o.confirmRename,onClick:i[3]||=T(()=>{},[`stop`])},null,544),[[w,o.renameInput.value]])],4)):(d(),e(f,{key:1},[y(` 普通节点 `),t(`div`,{class:m([`tree-node`,{"tree-node--dir":n.type===`directory`,"tree-node--file":n.type===`file`,"tree-node--active":o.activeTabPath===n.path,"tree-node--selected":o.selectedNode?.path===n.path&&o.activeTabPath!==n.path}]),style:h({paddingLeft:12+n.depth*14+`px`}),onClick:e=>o.openFile(n),onContextmenu:e=>o.openContextMenu(e,n)},[y(` 展开箭头 `),n.type===`directory`?(d(),e(`span`,{key:0,class:m([`tree-arrow`,{expanded:n.expanded}])},[...i[18]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(d(),e(`span`,wt)),y(` 图标 `),n.type===`directory`?(d(),e(`svg`,Tt,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,Et)])):(d(),e(`svg`,Dt,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,Ot)])),y(` 名称(命中关键字高亮) `),t(`span`,{class:`tree-name`,title:n.path},[(d(!0),e(f,null,_(o.highlightName(n.name),(t,n)=>(d(),e(f,{key:n},[t.hit?(d(),e(`span`,At,S(t.text),1)):(d(),e(f,{key:1},[u(S(t.text),1)],64))],64))),128))],8,kt),n.loading?(d(),e(`span`,jt)):y(`v-if`,!0)],46,Ct)],2112)),y(` 内联新建输入框:紧跟在 afterNode 之后 `),o.inlineInput&&o.inlineInput.afterNode?.path===n.path?(d(),e(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+o.inlineInput.depth*14+`px`})},[i[21]||=t(`span`,{class:`tree-arrow-spacer`},null,-1),o.inlineInput.kind===`directory`?(d(),e(`svg`,Mt,[...i[19]||=[t(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(d(),e(`svg`,Nt,[...i[20]||=[t(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),t(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),C(t(`input`,{ref_for:!0,ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>o.inlineInput.value=e,placeholder:o.inlineInput.kind===`file`?o.$t(`@EDITOR:输入文件名`):o.$t(`@EDITOR:输入文件夹名`),onKeydown:o.handleInlineKeydown,onBlur:o.cancelInlineInput,onClick:i[5]||=T(()=>{},[`stop`])},null,40,Pt),[[w,o.inlineInput.value]])],4)):y(`v-if`,!0)],64))),128)),y(` 根级输入框(无选中节点时出现在列表末尾) `),o.inlineInput&&o.inlineInput.afterNode===null?(d(),e(`div`,Ft,[i[24]||=t(`span`,{class:`tree-arrow-spacer`},null,-1),o.inlineInput.kind===`directory`?(d(),e(`svg`,It,[...i[22]||=[t(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(d(),e(`svg`,Lt,[...i[23]||=[t(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),t(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),C(t(`input`,{ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>o.inlineInput.value=e,placeholder:o.inlineInput.kind===`file`?o.$t(`@EDITOR:输入文件名`):o.$t(`@EDITOR:输入文件夹名`),onKeydown:o.handleInlineKeydown,onBlur:o.cancelInlineInput,onClick:i[7]||=T(()=>{},[`stop`])},null,40,Rt),[[w,o.inlineInput.value]])])):y(`v-if`,!0),!o.inlineInput&&(o.noSearchResults||o.treeNodes.length===0)?(d(),e(`div`,Y,S(o.noSearchResults?o.$t(`@EDITOR:未找到匹配文件`):o.$t(`@EDITOR:暂无文件`)),1)):y(`v-if`,!0)]))],4),y(` 拖拽分隔条 `),t(`div`,{class:`editor-resizer`,onMousedown:o.startSidebarResize},null,32),y(` 右侧编辑区 `),t(`div`,Z,[y(` 标签栏 `),o.tabs.length>0?(d(),e(`div`,zt,[(d(!0),e(f,null,_(o.tabs,n=>(d(),e(`div`,{key:n.path,class:m([`editor-tab`,{active:o.activeTabPath===n.path,dirty:n.isDirty}]),onClick:e=>o.activeTabPath=n.path,title:n.path},[t(`span`,Q,S(n.name),1),n.isDirty?(d(),e(`span`,Vt)):y(`v-if`,!0),t(`button`,{class:`tab-close`,onClick:e=>o.closeTab(n.path,e)},[...i[26]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)],10,Bt))),128)),i[30]||=t(`div`,{class:`editor-tabs-spacer`},null,-1),y(` 预览切换按钮 `),o.isPreviewable?(d(),e(`button`,{key:0,class:m([`preview-toggle-btn`,{active:o.showPreview}]),title:o.showPreview?o.$t(`@EDITOR:关闭预览`):o.$t(`@EDITOR:打开预览`),onClick:o.togglePreview},[i[27]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),t(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),t(`span`,null,S(o.$t(`@EDITOR:预览`)),1)],10,$)):y(`v-if`,!0),y(` 思维导图:整篇 markdown 渲染为一张大导图 `),o.isMindmapable?(d(),e(`button`,{key:1,class:m([`preview-toggle-btn mindmap-toggle-btn`,{active:o.showMindmap,disabled:!o.isMindmapable}]),disabled:!o.isMindmapable,title:o.isMindmapable?o.showMindmap?o.$t(`@EDITOR:关闭思维导图`):o.$t(`@EDITOR:打开思维导图`):o.$t(`@EDITOR:需要至少一个 # 标题`),onClick:o.toggleMindmap},[i[28]||=c(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-fc2ebf13><circle cx="12" cy="12" r="2" data-v-fc2ebf13></circle><circle cx="5" cy="6" r="1.6" data-v-fc2ebf13></circle><circle cx="19" cy="6" r="1.6" data-v-fc2ebf13></circle><circle cx="5" cy="18" r="1.6" data-v-fc2ebf13></circle><circle cx="19" cy="18" r="1.6" data-v-fc2ebf13></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-fc2ebf13></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-fc2ebf13></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-fc2ebf13></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-fc2ebf13></line></svg>`,1),t(`span`,null,S(o.$t(`@EDITOR:思维导图`)),1)],10,Ut)):y(`v-if`,!0),y(` g ai 对话:文件空间右侧的智能体面板(与预览/思维导图互斥) `),t(`button`,{class:m([`preview-toggle-btn agent-toggle-btn`,{active:o.showAgentChat}]),title:o.showAgentChat?o.$t(`@EDITOR:关闭 g ai 对话`):o.$t(`@EDITOR:打开 g ai 对话`),onClick:o.toggleAgentChat},[i[29]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),t(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),t(`span`,null,S(o.$t(`@EDITOR:g ai 对话`)),1)],10,Wt)])):y(`v-if`,!0),y(` 无文件打开时的提示 `),o.tabs.length===0?(d(),l(o.EmptyState,{key:1,class:`editor-empty`,title:o.$t(`@EDITOR:从左侧选择文件打开`),hint:o.$t(`@EDITOR:Ctrl+S 保存`)},{icon:b(()=>[...i[31]||=[t(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),t(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):y(`v-if`,!0),y(` Monaco 容器(始终挂载,tab 为空或 image tab 时隐藏) `),t(`div`,Gt,[t(`div`,{class:m([`monaco-container`,{hidden:o.tabs.length===0||o.activeTabIsImage||o.activeTabIsOffice}]),ref:`editorContainerRef`},null,2),y(` 图片 tab 时的占位提示(主预览区在右侧 preview-panel) `),o.activeTabIsImage&&o.tabs.length>0&&!o.showPreview&&!o.showMindmap?(d(),e(`div`,Kt,[(d(),e(`svg`,qt,[...i[32]||=[t(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),t(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),t(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),t(`p`,Jt,S(o.activeTabRef?.name),1),t(`p`,Yt,S(o.$t(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):y(`v-if`,!0),y(` 预览分隔条(在面板右侧,拉动调整面板宽度) `),(o.showPreview||o.showMindmap||o.showAgentChat)&&o.tabs.length>0?(d(),e(`div`,{key:1,class:`preview-resizer`,onMousedown:o.startPreviewResize},null,32)):y(`v-if`,!0),y(` g ai 对话面板:v-if 懒挂载 + v-show 保状态(切到预览再切回来,进行中的流还在) `),o.agentOpened?C((d(),l(o.EditorAgentPanel,{key:2,active:o.showAgentChat&&o.tabs.length>0,"active-file-path":o.activeTabPath,"active-file-name":o.activeTabRef?.name??``,style:h({flexBasis:o.previewWidth+`px`}),onClose:i[8]||=e=>o.showAgentChat=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[ce,o.showAgentChat&&o.tabs.length>0]]):y(`v-if`,!0),y(` 预览面板 `),(o.showPreview||o.showMindmap)&&o.tabs.length>0?(d(),e(`div`,{key:3,class:`preview-panel`,style:h({flexBasis:o.previewWidth+`px`})},[t(`div`,Xt,[t(`span`,Zt,S(o.showMindmap?o.$t(`@EDITOR:思维导图`):o.$t(`@EDITOR:预览`)),1),t(`span`,Qt,S(o.activeExt.toUpperCase()),1),i[34]||=t(`div`,{class:`preview-header-spacer`},null,-1),t(`button`,{class:`preview-close-btn`,title:o.showMindmap?o.$t(`@EDITOR:关闭思维导图`):o.$t(`@EDITOR:关闭预览`),onClick:i[9]||=e=>o.showMindmap?o.showMindmap=!1:o.showPreview=!1},[...i[33]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$t)]),t(`div`,en,[y(` 复制栏:Markdown 预览导出到公众号 / 其它富文本编辑器 `),o.mdCopyAvailable?(d(),e(`div`,tn,[t(`button`,{class:m([`preview-copy-btn`,{done:o.mdCopiedType===`md`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制 Markdown 源码`),onClick:o.copyMarkdownSource},[i[35]||=t(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),t(`span`,null,S(o.mdCopiedType===`md`?o.$t(`@EDITOR:已复制`):`Markdown`),1)],10,nn),t(`button`,{class:m([`preview-copy-btn`,{done:o.mdCopiedType===`html`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:o.copyRenderedHtml},[i[36]||=t(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),t(`span`,null,S(o.mdCopiedType===`html`?o.$t(`@EDITOR:已复制`):`HTML`),1)],10,rn),t(`button`,{class:m([`preview-copy-btn preview-copy-btn--primary`,{done:o.mdCopiedType===`rich`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:o.copyRichTextToClipboard},[i[37]||=t(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),t(`span`,null,S(o.mdCopyBusy?o.$t(`@EDITOR:转换图片中…`):o.mdCopiedType===`rich`?o.$t(`@EDITOR:已复制`):o.$t(`@EDITOR:复制富文本`)),1)],10,an),t(`label`,{class:`preview-copy-embed`,title:o.$t(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[C(t(`input`,{"onUpdate:modelValue":i[10]||=e=>o.mdCopyInlineImages=e,type:`checkbox`},null,512),[[ie,o.mdCopyInlineImages]]),t(`span`,null,S(o.$t(`@EDITOR:图片转 Base64`)),1)],8,on)])):y(`v-if`,!0),y(` 思维导图:整篇 markdown → 一张大导图 `),o.showMindmap&&o.activeExt===`md`&&o.activeTabRef?(d(),l(o.MindmapPreview,{key:1,content:o.activeTabRef.content,class:`preview-mindmap`},null,8,[`content`])):o.showPreview&&o.activeExt===`md`&&o.activeTabRef?(d(),e(f,{key:2},[y(` Markdown → in-app 渲染 `),y(` :key 按文件路径切 —— 预览的滚动容器就是这个组件自己的根节点
|
|
32
|
-
(.preview-markdown[overflow:auto]),不换 key 时切 tab 走的是同类型
|
|
33
|
-
组件 → Vue 复用同一个 DOM 节点、只把内容换掉,scrollTop 不在 patch
|
|
34
|
-
范围里,会从上一个文件原样带过来(表现为"新文件预览停在上一个文件的
|
|
35
|
-
滚动位置")。key 随路径变 → 重建节点,天然回到顶部。
|
|
36
|
-
注意 key 只取 path、不取 content:同一个文件里改字时预览是实时镜像,
|
|
37
|
-
那种情况下不该把用户踢回顶部。 `),(d(),l(o.MarkdownPreview,{ref:`mdPreviewRef`,key:o.activeTabRef.path,content:o.activeTabRef.content,"base-path":o.activeTabRef.path,class:`preview-markdown`},null,8,[`content`,`base-path`]))],2112)):o.showPreview&&[`html`,`htm`,`svg`].includes(o.activeExt)?(d(),e(f,{key:3},[y(` HTML / SVG → sandboxed iframe (JS 可执行,不透明 origin 隔离宿主) `),t(`iframe`,{class:`preview-iframe`,sandbox:o.PREVIEW_IFRAME_SANDBOX,srcdoc:o.previewSrcdoc},null,8,sn)],2112)):o.showPreview&&o.IMAGE_EXTS.has(o.activeExt)&&o.activeTabRef?(d(),e(f,{key:4},[y(` 图片预览(使用增强版 ImagePreview,支持缩放/拖拽) `),r(o.ImagePreview,{"file-path":o.activeTabRef.path,"file-name":o.activeTabRef.name},null,8,[`file-path`,`file-name`])],2112)):o.showPreview&&o.activeTabIsOffice&&o.activeTabRef?(d(),l(o.OfficePreview,{key:5,"file-path":o.activeTabRef.path},null,8,[`file-path`])):y(`v-if`,!0)])],4)):y(`v-if`,!0)])])],512),y(` 右键菜单 `),(d(),l(se,{to:`body`},[o.ctxMenu?(d(),e(`div`,{key:0,ref:`ctxMenuRef`,class:`ctx-menu`,style:h({left:o.ctxMenu.x+`px`,top:o.ctxMenu.y+`px`}),onClick:i[11]||=T(()=>{},[`stop`])},[t(`button`,{class:`ctx-menu-item`,onClick:o.ctxNewFile},[i[38]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),t(`polyline`,{points:`14 2 14 8 20 8`}),t(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),t(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),u(` `+S(o.$t(`@EDITOR:新建文件`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxNewFolder},[i[39]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),t(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),t(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),u(` `+S(o.$t(`@EDITOR:新建文件夹`)),1)]),i[46]||=t(`div`,{class:`ctx-menu-sep`},null,-1),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxCopyAbsolutePath},[i[40]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),t(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),u(` `+S(o.$t(`@EDITOR:复制绝对路径`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxCopyRelativePath},[i[41]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),t(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),u(` `+S(o.$t(`@EDITOR:复制相对路径`)),1)]),i[47]||=t(`div`,{class:`ctx-menu-sep`},null,-1),y(` 只有 HTML 才有"用浏览器打开":浏览器能直接渲染出结果 `),o.ctxMenuCanOpenInBrowser?(d(),e(`button`,{key:0,class:`ctx-menu-item`,onClick:o.ctxOpenInBrowser},[i[42]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`circle`,{cx:`12`,cy:`12`,r:`9`}),t(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),t(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),u(` `+S(o.$t(`@EDITOR:在浏览器中打开`)),1)])):y(`v-if`,!0),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxRevealInExplorer},[i[43]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),t(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),u(` `+S(o.$t(`@EDITOR:在资源管理器中打开`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxOpenInVscode},[r(o.SvgIcon,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),u(` `+S(o.$t(`@EDITOR:在 VSCode 中打开`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxRename},[i[44]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),t(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),u(` `+S(o.$t(`@EDITOR:重命名`)),1)]),t(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:o.ctxDelete},[i[45]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`3 6 5 6 21 6`}),t(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),t(`path`,{d:`M10 11v6`}),t(`path`,{d:`M14 11v6`}),t(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),u(` `+S(o.$t(`@EDITOR:删除`)),1)])],4)):y(`v-if`,!0)]))],64)}var ln=fe(pt,[[`render`,cn],[`__scopeId`,`data-v-fc2ebf13`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/EditorView.vue`]]);export{ln as default};
|