zen-gitsync 2.17.46 → 2.17.48
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 +16 -2
- package/package.json +2 -1
- package/src/cli/ai/agent.js +1342 -1342
- package/src/cli/ai/context.js +431 -253
- package/src/cli/ai/context.test.js +376 -258
- package/src/cli/ai/mcp.js +323 -27
- package/src/cli/ai/mcp.test.js +202 -2
- package/src/cli/ai/runtime.test.js +7 -4
- package/src/cli/ai/turn.js +166 -166
- package/src/config.js +906 -871
- package/src/ui/public/assets/{AgentEngineSelector-D6rlSfMD.js → AgentEngineSelector-B829U5mr.js} +1 -1
- package/src/ui/public/assets/AgentView-r3_ClUmr.js +1 -0
- package/src/ui/public/assets/{AgentView-h2YnbB7J.css → AgentView-uHf-KMCH.css} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-BnPsn1X5.js → AppVersionBadge-NtghusOI.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-D30GJwUl.js → BranchSelector-D0claXAs.js} +1 -1
- package/src/ui/public/assets/{CommitForm-Dvg-RUZI.js → CommitForm-BIq6-sqk.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-BzLau2RJ.js → CommonDialog-NqZURH2F.js} +1 -1
- package/src/ui/public/assets/EditorView-0T5LR5Hz.css +1 -0
- package/src/ui/public/assets/EditorView-Cny0lDhG.js +1 -0
- package/src/ui/public/assets/{FlowExecutionViewer-VL-rUElj.js → FlowExecutionViewer-DxDKzmaP.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-BPNlHRVu.js → FlowOrchestrationWorkspace-B3CAJZ-U.js} +1 -1
- package/src/ui/public/assets/{LogList-COwGjQl6.js → LogList-D5sS4Il3.js} +1 -1
- package/src/ui/public/assets/{MindmapView-BVuqPD_H.js → MindmapView-6bc0EAJM.js} +1 -1
- package/src/ui/public/assets/{MonitorView-hqe-4xd0.js → MonitorView-BnUV4RaV.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-RBc-DJBR.js → ProjectStartupButton-Cbw079DB.js} +1 -1
- package/src/ui/public/assets/RecentDirectoriesChat-BCZsJR7n.js +1 -0
- package/src/ui/public/assets/RecentDirectoriesChat-THkqWEtO.css +1 -0
- package/src/ui/public/assets/{RemoteManagerDialog-D6Rbjchl.js → RemoteManagerDialog-BWWPEnSd.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-l0NpXgvB.js → RemoteRepoCard-BhA3-4PZ.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-CeVystt0.js → SourceMapView-DHDmNzSh.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-B-xDJQA1.js → SvgIcon-DcVasCdo.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-DJglU68l.js → UserInputNode-B313MadX.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-NCE_bk5a.js +20 -0
- package/src/ui/public/assets/WorkbenchView-rscs76HF.css +1 -0
- package/src/ui/public/assets/_plugin-vue_export-helper-Bsx6Zj3t.js +19 -0
- package/src/ui/public/assets/agentConversations-BAhGYmeY.js +8 -0
- package/src/ui/public/assets/{configStore-CMlW8sMa.js → configStore-DQSKV2_Y.js} +1 -1
- package/src/ui/public/assets/{dagre-DyI0XLXY.js → dagre-BmYeUlEa.js} +3 -3
- package/src/ui/public/assets/{element-plus-DrCk0pcV.js → element-plus-DTtm3XCd.js} +1 -1
- package/src/ui/public/assets/{flow-mindmap-Cx5RNYN9.js → flow-mindmap-JxOspgwx.js} +1 -1
- package/src/ui/public/assets/{index-u9LyUFkr.css → index-BgN6Z2X9.css} +1 -1
- package/src/ui/public/assets/{index-BQxIFopZ.js → index-DQuqmPuL.js} +9 -9
- package/src/ui/public/assets/{monaco-Dfcwm1aX.js → monaco-D3R9OM26.js} +1 -1
- package/src/ui/public/assets/{office-docx-C0unxEAm.js → office-docx-CO7mIaWO.js} +1 -1
- package/src/ui/public/assets/{office-excel-DPdyr_DJ.js → office-excel-gA4KEkK4.js} +1 -1
- package/src/ui/public/assets/{office-pptx-eojGAs9D.js → office-pptx-CQK4l_1Q.js} +1 -1
- package/src/ui/public/assets/{vendor-yntih_em.js → vendor-O17eRefg.js} +222 -222
- package/src/ui/public/assets/vendor-U3ZXMgeO.css +1 -0
- package/src/ui/public/assets/{vue-flow-De8mr_Fv.js → vue-flow-BG6ZF1It.js} +1 -1
- package/src/ui/public/index.html +13 -13
- package/src/ui/server/routes/config.js +1321 -1314
- package/src/ui/server/routes/workbench/agentChat.js +594 -571
- package/src/ui/server/routes/workbench/agentChatShared.test.js +302 -233
- package/src/ui/server/routes/workbench/agentMarketplace.js +65 -30
- package/src/ui/server/routes/workbench/agentMarketplace.test.js +28 -4
- package/src/ui/server/routes/workbench/agentRoutes.js +631 -631
- package/src/ui/server/routes/workbench/liveJobs.js +4 -0
- package/src/ui/server/routes/workbench/liveJobs.test.js +11 -0
- package/src/ui/server/routes/workbench/taskRunner.js +44 -7
- package/src/ui/server/routes/workbench/taskRunner.thinking.test.js +115 -0
- package/src/ui/public/assets/AgentView-BFRGoIVb.js +0 -1
- package/src/ui/public/assets/EditorView-8Rb4n-Wh.css +0 -1
- package/src/ui/public/assets/EditorView-D4ZQutRw.js +0 -1
- package/src/ui/public/assets/RecentDirectoriesChat-BxbpKrXc.css +0 -1
- package/src/ui/public/assets/RecentDirectoriesChat-DFljcYFH.js +0 -1
- package/src/ui/public/assets/WorkbenchView-BSQ87CDi.css +0 -1
- package/src/ui/public/assets/WorkbenchView-BpH5kNht.js +0 -20
- package/src/ui/public/assets/_plugin-vue_export-helper-Dz1ARW9a.js +0 -19
- package/src/ui/public/assets/agentConversations-B8nY45V4.js +0 -7
- package/src/ui/public/assets/vendor-CP-WuGZG.css +0 -1
|
@@ -91,6 +91,10 @@ export function projectJob(j) {
|
|
|
91
91
|
// 最后一次产出的时刻。别的实例跑的任务,进度报告只能从这份文件上读它 ——
|
|
92
92
|
// 不过白名单就会变成"本实例的报告说得出静默多久,跨实例的报告永远说不出来"。
|
|
93
93
|
lastActivityAt: j.lastActivityAt || null,
|
|
94
|
+
// 思考段计时(第一个思考分片 → 最后一个分片)。前端折叠态显示「想了多久」靠它,
|
|
95
|
+
// 运行中的任务也要能看到 —— 不过白名单就变成"本实例看得见耗时、别的实例看不见"。
|
|
96
|
+
thinkingStartedAt: j.thinkingStartedAt || null,
|
|
97
|
+
thinkingEndedAt: j.thinkingEndedAt || null,
|
|
94
98
|
endedAt: j.endedAt || null,
|
|
95
99
|
exitCode: typeof j.exitCode === 'number' ? j.exitCode : null,
|
|
96
100
|
error: j.error || null,
|
|
@@ -87,6 +87,8 @@ const runningJob = (id, extra = {}) => ({
|
|
|
87
87
|
prompt: 'p',
|
|
88
88
|
output: 'out',
|
|
89
89
|
thinking: 'think',
|
|
90
|
+
thinkingStartedAt: '2026-09-28T14:56:52.000Z',
|
|
91
|
+
thinkingEndedAt: '2026-09-28T14:56:58.500Z',
|
|
90
92
|
toolCalls: [],
|
|
91
93
|
claudeSessionId: null,
|
|
92
94
|
// 不该被广播出去的内部字段(白名单投影必须剥掉)
|
|
@@ -112,11 +114,20 @@ test('projectJob:白名单投影剥掉 child 等不可序列化字段,保留前
|
|
|
112
114
|
assert.equal(rec.agent, 'claude');
|
|
113
115
|
assert.equal(rec.claudeSessionId, null);
|
|
114
116
|
assert.deepEqual(rec.toolCalls, []);
|
|
117
|
+
// 思考段计时必须过白名单:漏了它 = 本实例看得见「想了多久」、别的实例永远看不见
|
|
118
|
+
assert.equal(rec.thinkingStartedAt, '2026-09-28T14:56:52.000Z');
|
|
119
|
+
assert.equal(rec.thinkingEndedAt, '2026-09-28T14:56:58.500Z');
|
|
115
120
|
assert.ok(!('child' in rec), 'child 必须先剥掉,否则 JSON.stringify 直接抛');
|
|
116
121
|
// 投影结果要能真的序列化
|
|
117
122
|
assert.doesNotThrow(() => JSON.stringify(rec));
|
|
118
123
|
});
|
|
119
124
|
|
|
125
|
+
test('projectJob:老 job 没有计时字段时归成 null(不是 undefined,前端不用判两种空)', () => {
|
|
126
|
+
const rec = projectJob(runningJob('j-old', { thinkingStartedAt: undefined, thinkingEndedAt: undefined }));
|
|
127
|
+
assert.equal(rec.thinkingStartedAt, null);
|
|
128
|
+
assert.equal(rec.thinkingEndedAt, null);
|
|
129
|
+
});
|
|
130
|
+
|
|
120
131
|
test('toLiveRecord:正文/思考截尾,工具流水只留最近若干条', () => {
|
|
121
132
|
const toolCalls = Array.from({ length: LIVE_TOOL_CALL_LIMIT + 5 }, (_, i) => ({
|
|
122
133
|
id: `c${i}`,
|
|
@@ -577,6 +577,40 @@ export function createToolCallTracker(job, onUpdates) {
|
|
|
577
577
|
return { record, flush, seal };
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
+
/**
|
|
581
|
+
* 思考文本的保底上限(尾部截断:模型偶尔会长时间闷头思考,尾巴才是最新的)。
|
|
582
|
+
* 与工具流水的截断同一口径,只是这里量级更大。
|
|
583
|
+
*/
|
|
584
|
+
export const MAX_THINKING = 100 * 1024 * 1024;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* 追加一段思考文本:截尾 + 记「思考段计时」。
|
|
588
|
+
*
|
|
589
|
+
* 计时口径与 zen-ai-chat-ui 的 ThinkingBlock 一致:**第一个分片记起点、之后每个
|
|
590
|
+
* 分片把终点往前推**(不是"思考状态转 done 为止"——那样会把"想完了但正文还没开始"
|
|
591
|
+
* 的空档也算进去)。这两个时间戳随 job 落盘(jobs.json)、随 live-jobs 跨实例可见,
|
|
592
|
+
* 前端折叠着也能显示「想了多久」;只在内存里算的话,刷新页面就没了。
|
|
593
|
+
*
|
|
594
|
+
* 导出仅为回归测试可见(taskRunner.thinking.test.js):跑整条 runSingleSubtask
|
|
595
|
+
* 去断言这两个字段,代价是起一个假 CLI 进程,不划算。
|
|
596
|
+
*
|
|
597
|
+
* @param {object} job 执行记录(thinking / lastActivityAt 与两个计时字段都记在它身上)
|
|
598
|
+
* @param {string} text 本批新增的思考文本
|
|
599
|
+
* @param {string} [at] 时间戳(ISO);默认取当前时刻,测试可注入
|
|
600
|
+
* @returns {string} 本次真正追加进 job.thinking 的增量(供批量推送用)
|
|
601
|
+
*/
|
|
602
|
+
export function appendThinkingToJob(job, text, at = nowIso()) {
|
|
603
|
+
if (!text) return '';
|
|
604
|
+
job.lastActivityAt = at;
|
|
605
|
+
if (!job.thinkingStartedAt) job.thinkingStartedAt = at;
|
|
606
|
+
job.thinkingEndedAt = at;
|
|
607
|
+
const prev = job.thinking || '';
|
|
608
|
+
job.thinking = (prev + text).slice(-MAX_THINKING);
|
|
609
|
+
// 顶到上限之后这里返回 ''(增量不再往前端推)—— 100MB 的思考文本没有真实场景,
|
|
610
|
+
// 真到那一步终态快照仍带全文尾巴,不值得为它把增量算法复杂化。
|
|
611
|
+
return job.thinking.slice(prev.length);
|
|
612
|
+
}
|
|
613
|
+
|
|
580
614
|
/**
|
|
581
615
|
* claude stream-json 事件处理器。
|
|
582
616
|
* system/init → session_id(--resume 续接用)
|
|
@@ -961,7 +995,12 @@ export async function runSingleSubtask(task, sub, repoPath, branch, options) {
|
|
|
961
995
|
claudeSessionId: resumeSessionId,
|
|
962
996
|
// 工具调用流水({id,name,argsPreview,arguments,result,status,error}[])。
|
|
963
997
|
// 先给个空数组,前端拿到的 job:update 就有了稳定形态,不用到处判 undefined。
|
|
964
|
-
toolCalls: []
|
|
998
|
+
toolCalls: [],
|
|
999
|
+
// 思考段计时(第一个思考分片 → 最后一个分片,ISO 字符串)。
|
|
1000
|
+
// 显式给 null 而不是不写:快照 / 落盘 / 跨实例的口径要一致,前端也不用判 undefined。
|
|
1001
|
+
// 记法与语义见 appendThinkingToJob。
|
|
1002
|
+
thinkingStartedAt: null,
|
|
1003
|
+
thinkingEndedAt: null
|
|
965
1004
|
};
|
|
966
1005
|
jobs.set(jobId, job);
|
|
967
1006
|
publish('job:update', job);
|
|
@@ -998,7 +1037,7 @@ export async function runSingleSubtask(task, sub, repoPath, branch, options) {
|
|
|
998
1037
|
// 工具调用 → job.toolCalls(前端工具块 + 落盘归档)
|
|
999
1038
|
// 其他事件 → 忽略,避免噪声
|
|
1000
1039
|
const MAX_OUTPUT = 100 * 1024 * 1024;
|
|
1001
|
-
|
|
1040
|
+
// 思考的截断上限是模块级的 MAX_THINKING(appendThinkingToJob 要用)
|
|
1002
1041
|
job.output = '';
|
|
1003
1042
|
job.thinking = '';
|
|
1004
1043
|
const lineBuf = { stdout: '', stderr: '' };
|
|
@@ -1022,11 +1061,9 @@ export async function runSingleSubtask(task, sub, repoPath, branch, options) {
|
|
|
1022
1061
|
}
|
|
1023
1062
|
};
|
|
1024
1063
|
const appendThinking = (text) => {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
job.thinking = (job.thinking + text).slice(-MAX_THINKING);
|
|
1029
|
-
thinkingBatch += job.thinking.slice(prevLen);
|
|
1064
|
+
// 追加 / 截断 / 思考段计时都在 appendThinkingToJob 里(导出给回归测试的那份),
|
|
1065
|
+
// 这里只负责批量推送:一批 NDJSON 处理完统一 flush 一次
|
|
1066
|
+
thinkingBatch += appendThinkingToJob(job, text);
|
|
1030
1067
|
};
|
|
1031
1068
|
|
|
1032
1069
|
// 工具调用:写进 job.toolCalls(随 job 落盘),并按批推 job:toolcalls 给前端。
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Copyright 2026 xz333221
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// 思考段计时的回归测试(2026-10-08)。
|
|
16
|
+
//
|
|
17
|
+
// 背景:任务执行弹窗里的思考块以前只有「思考」两个字,折叠着看不出它想了多久。
|
|
18
|
+
// zen-ai-chat-ui 的 ThinkingBlock 支持在标题右侧显示「第一个思考分片 → 最后一个
|
|
19
|
+
// 分片」的耗时(折叠也看得见),但时间戳得由宿主喂 —— 也就是这里测的
|
|
20
|
+
// appendThinkingToJob。口径拧了「单测全绿而数字是错的」(比如把起点记成 job 开始、
|
|
21
|
+
// 或每次追加都重置起点),所以把口径钉死在单测里。
|
|
22
|
+
//
|
|
23
|
+
// 钉住的口径:
|
|
24
|
+
// 1. 第一个分片记起点,之后每个分片把终点往前推(**不是**"到第一个正文为止")
|
|
25
|
+
// 2. 起点一旦记下就不再移动(中途隔着工具调用再想一段,预览窗口跟着往后推)
|
|
26
|
+
// 3. 空分片不产生任何副作用(连 lastActivityAt 都不碰)
|
|
27
|
+
// 4. 老 job(没有这两个字段)第一次追加也补得上
|
|
28
|
+
// 5. 返回值 = 本次真正追加的增量(批量推送 job:thinking-delta 用它)
|
|
29
|
+
//
|
|
30
|
+
// 隔离策略同 taskRunner.toolcalls.test.js:import taskRunner.js 之前把
|
|
31
|
+
// USERPROFILE/HOME 指向 mkdtemp 沙箱(taskRunner → jobStore import 时就会 hydrate)。
|
|
32
|
+
|
|
33
|
+
import { test } from 'node:test';
|
|
34
|
+
import assert from 'node:assert/strict';
|
|
35
|
+
import path from 'node:path';
|
|
36
|
+
import os from 'node:os';
|
|
37
|
+
import { mkdtempSync } from 'node:fs';
|
|
38
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
39
|
+
|
|
40
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const projectRoot = path.resolve(__dirname, '../../../../..');
|
|
42
|
+
|
|
43
|
+
// ---- 环境隔离:必须在 import taskRunner.js 之前完成 ----
|
|
44
|
+
const sandbox = mkdtempSync(path.join(os.tmpdir(), 'zen-thinking-test-'));
|
|
45
|
+
process.env.USERPROFILE = sandbox;
|
|
46
|
+
process.env.HOME = sandbox;
|
|
47
|
+
delete process.env.HOMEDRIVE;
|
|
48
|
+
delete process.env.HOMEPATH;
|
|
49
|
+
|
|
50
|
+
const { appendThinkingToJob } = await import(
|
|
51
|
+
pathToFileURL(path.join(projectRoot, 'src/ui/server/routes/workbench/taskRunner.js')).href
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
/** 一个刚创建、还没产出任何思考的 job(字段形状照 runSingleSubtask 里那个字面量) */
|
|
55
|
+
const makeJob = (extra = {}) => ({
|
|
56
|
+
id: 'j1',
|
|
57
|
+
thinking: '',
|
|
58
|
+
lastActivityAt: null,
|
|
59
|
+
thinkingStartedAt: null,
|
|
60
|
+
thinkingEndedAt: null,
|
|
61
|
+
...extra,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('第一个分片记起点,之后每个分片把终点往前推', () => {
|
|
65
|
+
const job = makeJob();
|
|
66
|
+
const t1 = '2026-10-08T01:00:00.000Z';
|
|
67
|
+
const t2 = '2026-10-08T01:00:03.000Z';
|
|
68
|
+
const t3 = '2026-10-08T01:00:09.000Z';
|
|
69
|
+
|
|
70
|
+
appendThinkingToJob(job, '先看看目录', t1);
|
|
71
|
+
assert.equal(job.thinkingStartedAt, t1, '第一个分片就是起点');
|
|
72
|
+
assert.equal(job.thinkingEndedAt, t1, '只有一个分片时终点与起点相同');
|
|
73
|
+
|
|
74
|
+
appendThinkingToJob(job, ',再读文件', t2);
|
|
75
|
+
assert.equal(job.thinkingStartedAt, t1, '起点不随后续分片移动');
|
|
76
|
+
assert.equal(job.thinkingEndedAt, t2, '每来一个分片,终点往前推');
|
|
77
|
+
|
|
78
|
+
// 中间隔着工具调用再想一段 —— 窗口跟着推到最后一段(与 ThinkingBlock 的
|
|
79
|
+
// 「第一个思考分片 → 最后一个分片」同口径,不把中间干活的时间算进去)
|
|
80
|
+
appendThinkingToJob(job, ',最后收个尾', t3);
|
|
81
|
+
assert.equal(job.thinkingStartedAt, t1);
|
|
82
|
+
assert.equal(job.thinkingEndedAt, t3);
|
|
83
|
+
assert.equal(job.thinking, '先看看目录,再读文件,最后收个尾');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('每次追加都把 lastActivityAt 记到同一时刻(静默看门狗的记账口径)', () => {
|
|
87
|
+
const job = makeJob();
|
|
88
|
+
appendThinkingToJob(job, '想', '2026-10-08T02:00:00.000Z');
|
|
89
|
+
assert.equal(job.lastActivityAt, '2026-10-08T02:00:00.000Z');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('返回值 = 本次真正追加的增量(供批量推送 job:thinking-delta)', () => {
|
|
93
|
+
const job = makeJob();
|
|
94
|
+
assert.equal(appendThinkingToJob(job, '第一段', '2026-10-08T02:10:00.000Z'), '第一段');
|
|
95
|
+
assert.equal(appendThinkingToJob(job, '第二段', '2026-10-08T02:10:01.000Z'), '第二段');
|
|
96
|
+
assert.equal(job.thinking, '第一段第二段');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('空分片:整条记录一个字都不动(连 lastActivityAt 都不碰)', () => {
|
|
100
|
+
const job = makeJob({ lastActivityAt: '2026-10-08T03:00:00.000Z' });
|
|
101
|
+
assert.equal(appendThinkingToJob(job, ''), '');
|
|
102
|
+
assert.equal(appendThinkingToJob(job, undefined), '');
|
|
103
|
+
assert.equal(job.thinking, '');
|
|
104
|
+
assert.equal(job.thinkingStartedAt, null, '空分片不该开出计时窗口');
|
|
105
|
+
assert.equal(job.thinkingEndedAt, null);
|
|
106
|
+
assert.equal(job.lastActivityAt, '2026-10-08T03:00:00.000Z', 'lastActivityAt 保持原值');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('老 job(字段都不存在)第一次追加也补得上计时', () => {
|
|
110
|
+
const job = { id: 'old', thinking: '旧内容' };
|
|
111
|
+
appendThinkingToJob(job, '新的', '2026-10-08T04:00:00.000Z');
|
|
112
|
+
assert.equal(job.thinkingStartedAt, '2026-10-08T04:00:00.000Z');
|
|
113
|
+
assert.equal(job.thinkingEndedAt, '2026-10-08T04:00:00.000Z');
|
|
114
|
+
assert.equal(job.thinking, '旧内容新的');
|
|
115
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{At as e,Cn as t,Ct as n,Dn as r,En as i,Gr as a,Hn as o,J as ee,Jt as te,M as s,Mn as c,Mr as l,Pn as u,Rn as d,Tn as f,Tt as p,Vt as ne,W as re,Wt as m,Xr as h,Yn as g,Zn as _,a as v,dr as y,er as b,et as x,gr as S,hn as C,i as w,ir as T,j as ie,jn as E,kt as ae,ln as D,lt as O,mt as k,or as A,qr as j,r as M,rn as oe,sr as N,st as P,tt as se,vr as F,wn as I,wr as L,yn as R}from"./element-plus-DrCk0pcV.js";import{a as z,t as B}from"./vendor-yntih_em.js";import{n as V,t as H}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{t as ce}from"./configStore-CMlW8sMa.js";import{t as le}from"./CommonDialog-BzLau2RJ.js";import{a as U,i as ue,n as de,o as W,r as G,s as K,t as q}from"./agentConversations-B8nY45V4.js";import{n as J,t as fe}from"./AgentEngineSelector-D6rlSfMD.js";d(),y(),D(),l();var Y={class:`marketplace-panel`},pe={class:`mp-toolbar`},me={class:`mp-search`},he=[`placeholder`],ge={class:`mp-toolbar-sub`},_e={class:`mp-target-hint`},X={class:`mp-source-filter`},ve=[`onClick`],ye={class:`mp-body`},be={class:`mp-group-header`},xe={class:`mp-group-title`},Se={key:0,class:`mp-group-count`},Ce={key:1,class:`mp-group-error`},we=[`href`,`title`],Te={key:0,class:`mp-grid`},Z={class:`mp-card-head`},Ee=[`title`],De={key:0,class:`mp-card-metric`},Q=[`title`],$={class:`mp-card-meta`},Oe=[`title`],ke=[`title`],Ae={key:2,class:`mp-tag remote`},je={class:`mp-card-foot`},Me=[`href`],Ne={key:1,class:`mp-installed-chip`},Pe=[`disabled`,`onClick`],Fe={key:3,class:`mp-not-installable`},Ie={key:1,class:`mp-empty`},Le={key:0,class:`mp-group installed`},Re={class:`mp-group-header`},ze={class:`mp-group-title`},Be={class:`mp-group-count`},Ve={key:0,class:`mp-installed-block`},He={class:`mp-installed-target`},Ue={class:`mp-installed-list`},We=[`title`],Ge=[`title`],Ke={key:1,class:`mp-meta-pkg`},qe={key:2,class:`mp-tag warn`},Je=[`disabled`,`title`,`onClick`],Ye=[`disabled`,`onClick`],Xe={key:1,class:`mp-empty all`},Ze={key:0,class:`mkt-form`},Qe={class:`mkt-form-name`},$e=[`onUpdate:modelValue`,`placeholder`],et={key:0,class:`mkt-field`},tt={class:`mkt-hint`},nt=H(u({__name:`MarketplacePanel`,props:{type:{}},setup(e){let o=e,l=ce(),u=F([]),d=F([]),p=F(!1),y=F(``),b=F(``),x=F([]),D=F(`project`),j=F(new Set),P=F(new Set),z=F(new Set),B=t(()=>l.currentDirectory||``),H=null;async function U(){if(!p.value){p.value=!0;try{let e=new URLSearchParams({type:o.type,cwd:B.value});b.value&&e.set(`q`,b.value),x.value.length&&e.set(`sources`,x.value.join(`,`));let t=await(await fetch(`/api/agent/marketplace/catalog?${e}`)).json();t?.success?(u.value=t.groups||[],d.value=t.installed||[]):w.error(t?.error||V(`@MKT:加载失败`))}catch{w.error(V(`@MKT:加载失败`))}finally{p.value=!1}}}T(y,e=>{H&&clearTimeout(H),H=setTimeout(()=>{b.value=e.trim(),U()},400)}),T(x,()=>U()),T(()=>o.type,()=>{x.value=[],b.value=``,y.value=``,U()}),T(B,()=>U()),U();let ue=t(()=>{let e=B.value?B.value.split(/[\\/]/).filter(Boolean).pop():``;return D.value===`project`?e||V(`@MKT:当前项目`):V(`@MKT:g ai 智能体`)});function de(e){return e.stars?`${W(e.stars)} ★`:e.downloads?`${W(e.downloads)} ${V(`@MKT:周下载`)}`:e.uses?`${W(e.uses)} ${V(`@MKT:次使用`)}`:``}function W(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function G(e){return`${e.id}`}function K(e){return j.value.has(G(e))}let q=t(()=>{let e={project:[],global:[]};for(let t of d.value)(e[t.target]||=[]).push(t);return e}),J=S({visible:!1,item:null,env:{},args:``});function fe(e){return o.type===`mcp`&&(!!e.envKeys?.length||!!e.args?.length)}function nt(e){J.item=e,J.env=Object.fromEntries((e.envKeys||[]).map(e=>[e,``])),J.args=(e.args||[]).join(` `),J.visible=!0}function rt(){let e=J.item;if(J.visible=!1,!e)return;let t=Object.fromEntries(Object.entries(J.env).filter(([,e])=>e.trim()!==``)),n=J.args.trim()?J.args.trim().match(/(?:[^\s"]+|"[^"]*")+/g)?.map(e=>e.replace(/^"|"$/g,``))??void 0:void 0;at(e,{env:t,...n?{args:n}:{}})}async function it(e){if(!e.installed||await ot(e)){if(fe(e)){nt(e);return}await at(e,{})}}async function at(e,t){let n=G(e);j.value.add(n);try{let n=await fetch(`/api/agent/marketplace/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:o.type,target:D.value,cwd:B.value,item:{...e,...t}})}),r=await n.json().catch(()=>null);if(!n.ok||!r?.success){w.error(r?.error||V(`@MKT:安装失败`));return}r.item?.warning&&w.warning(r.item.warning),r.item?.envKeys?.length?w.warning(`${V(`@MKT:还缺环境变量`)}: ${r.item.envKeys.join(`, `)}`):w.success(V(`@MKT:安装成功`)),await U()}catch{w.error(V(`@MKT:安装失败`))}finally{j.value.delete(n)}}async function ot(e){try{return await M.confirm(`${e.name} ${V(`@MKT:已安装,要重新安装吗?`)}`,V(`@MKT:重新安装`),{confirmButtonText:V(`@MKT:重装`),cancelButtonText:V(`@MKT:取消`),type:`warning`}),!0}catch{return!1}}async function st(e){let t=`${e.target}:${e.id}`;z.value.add(t);try{let t=await fetch(`/api/agent/marketplace/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:o.type,target:e.target,cwd:B.value,id:e.id})}),n=await t.json().catch(()=>null);(!t.ok||!n?.success)&&w.error(n?.error||V(`@MKT:打开失败`))}catch{w.error(V(`@MKT:打开失败`))}finally{z.value.delete(t)}}async function ct(e){try{await M.confirm(`${V(`@MKT:确定卸载`)} ${e.name}?`,V(`@MKT:卸载`),{confirmButtonText:V(`@MKT:卸载`),cancelButtonText:V(`@MKT:取消`),type:`warning`})}catch{return}let t=`${e.target}:${e.id}`;P.value.add(t);try{let t=new URLSearchParams({target:e.target,cwd:B.value}),n=await fetch(`/api/agent/marketplace/item/${o.type}/${encodeURIComponent(e.id)}?${t}`,{method:`DELETE`}),r=await n.json().catch(()=>null);if(!n.ok||!r?.success){w.error(r?.error||V(`@MKT:卸载失败`));return}w.success(V(`@MKT:已卸载`)),await U()}catch{w.error(V(`@MKT:卸载失败`))}finally{P.value.delete(t)}}return(t,o)=>{let l=ee,b=ie,S=s,w=re,T=v;return g(),r(`div`,Y,[I(`div`,pe,[I(`div`,me,[c(l,{class:`mp-search-icon`},{default:A(()=>[c(L(m))]),_:1}),N(I(`input`,{"onUpdate:modelValue":o[0]||=e=>y.value=e,class:`mp-search-input`,type:`text`,placeholder:e.type===`skill`?L(V)(`@MKT:搜索 Skill...`):L(V)(`@MKT:搜索 MCP 服务...`)},null,8,he),[[C,y.value]])]),c(S,{modelValue:D.value,"onUpdate:modelValue":o[1]||=e=>D.value=e,size:`small`,class:`mp-target`},{default:A(()=>[c(b,{value:`project`},{default:A(()=>[E(h(L(V)(`@MKT:当前项目`)),1)]),_:1}),c(b,{value:`global`},{default:A(()=>[E(h(L(V)(`@MKT:g ai 智能体`)),1)]),_:1})]),_:1},8,[`modelValue`]),c(w,{content:L(V)(`@MKT:刷新`),placement:`top`,"show-after":300},{default:A(()=>[I(`button`,{class:a([`mp-refresh`,{spinning:p.value}]),onClick:U},[c(l,null,{default:A(()=>[c(L(ne))]),_:1})],2)]),_:1},8,[`content`])]),I(`div`,ge,[I(`span`,_e,[E(h(L(V)(`@MKT:安装到`))+` `,1),I(`b`,null,h(ue.value),1)]),I(`div`,X,[(g(!0),r(R,null,_(u.value,e=>(g(),r(`button`,{key:e.id,class:a([`mp-chip`,{active:x.value.includes(e.id)}]),onClick:()=>{let t=x.value.indexOf(e.id);t>=0?x.value.splice(t,1):x.value.push(e.id)}},h(e.label),11,ve))),128)),x.value.length?(g(),r(`button`,{key:0,class:`mp-chip clear`,onClick:o[2]||=e=>x.value=[]},h(L(V)(`@MKT:全部来源`)),1)):i(``,!0)])]),N((g(),r(`div`,ye,[(g(!0),r(R,null,_(u.value,e=>(g(),r(`section`,{key:e.id,class:`mp-group`},[I(`header`,be,[I(`h3`,xe,h(e.label),1),e.status===`ok`?(g(),r(`span`,Se,h(e.items.length),1)):(g(),r(`span`,Ce,[c(l,null,{default:A(()=>[c(L(oe))]),_:1}),E(` `+h(e.error||L(V)(`@MKT:来源不可用`)),1)])),e.homepage?(g(),r(`a`,{key:2,class:`mp-group-link`,href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,title:e.homepage},[c(l,null,{default:A(()=>[c(L(ae))]),_:1})],8,we)):i(``,!0)]),e.status===`ok`&&e.items.length?(g(),r(`div`,Te,[(g(!0),r(R,null,_(e.items,e=>(g(),r(`article`,{key:G(e),class:`mp-card`},[I(`div`,Z,[I(`span`,{class:`mp-card-name`,title:e.name},h(e.name),9,Ee),de(e)?(g(),r(`span`,De,[c(l,null,{default:A(()=>[e.stars?(g(),f(L(te),{key:0})):(g(),f(L(k),{key:1}))]),_:2},1024),E(` `+h(de(e)),1)])):i(``,!0)]),I(`p`,{class:`mp-card-desc`,title:e.description},h(e.description||L(V)(`@MKT:暂无描述`)),9,Q),I(`div`,$,[e.package?(g(),r(`code`,{key:0,class:`mp-meta-pkg`,title:e.package},h(e.package),9,Oe)):e.repository?(g(),r(`span`,{key:1,class:`mp-meta-repo`,title:e.repository+(e.subpath?` · `+e.subpath:``)},[E(h(e.repository),1),e.subpath?(g(),r(R,{key:0},[E(` · `+h(e.subpath),1)],64)):i(``,!0)],8,ke)):i(``,!0),e.transport===`remote`?(g(),r(`span`,Ae,h(L(V)(`@MKT:远程服务`)),1)):i(``,!0),(g(!0),r(R,null,_((e.tags||[]).slice(0,2),e=>(g(),r(`span`,{key:e,class:`mp-tag`},h(e),1))),128))]),I(`div`,je,[e.upstream?(g(),r(`a`,{key:0,class:`mp-card-link`,href:e.upstream,target:`_blank`,rel:`noopener noreferrer`},h(L(V)(`@MKT:查看来源`)),9,Me)):i(``,!0),o[6]||=I(`span`,{class:`mp-foot-spacer`},null,-1),e.installed?(g(),r(`span`,Ne,[c(l,null,{default:A(()=>[c(L(se))]),_:1}),E(h(L(V)(`@MKT:已安装`)),1)])):e.installable===!1?(g(),r(`span`,Fe,h(L(V)(`@MKT:暂不支持一键安装`)),1)):(g(),r(`button`,{key:2,class:`mp-install-btn`,disabled:K(e),onClick:t=>it(e)},h(K(e)?L(V)(`@MKT:安装中...`):L(V)(`@MKT:安装`)),9,Pe))])]))),128))])):e.status===`ok`?(g(),r(`div`,Ie,h(L(V)(`@MKT:该来源暂无结果`)),1)):i(``,!0)]))),128)),d.value.length?(g(),r(`section`,Le,[I(`header`,Re,[I(`h3`,ze,h(L(V)(`@MKT:已安装`)),1),I(`span`,Be,h(d.value.length),1)]),(g(),r(R,null,_([`project`,`global`],e=>I(`div`,{key:e},[q.value[e]?.length?(g(),r(`div`,Ve,[I(`div`,He,h(e===`project`?L(V)(`@MKT:当前项目`):L(V)(`@MKT:g ai 智能体`)),1),I(`div`,Ue,[(g(!0),r(R,null,_(q.value[e],t=>(g(),r(`div`,{key:e+t.id,class:`mp-installed-row`},[I(`span`,{class:`mp-installed-name`,title:t.name},h(t.name),9,We),t.id&&t.id!==t.name?(g(),r(`code`,{key:0,class:`mp-installed-id`,title:t.dir||t.file||t.id},h(t.id),9,Ge)):i(``,!0),t.package?(g(),r(`code`,Ke,h(t.package),1)):i(``,!0),t.requiredEnv?.length?(g(),r(`span`,qe,h(L(V)(`@MKT:待配置`))+`: `+h(t.requiredEnv.join(`, `)),1)):i(``,!0),o[7]||=I(`span`,{class:`mp-foot-spacer`},null,-1),I(`button`,{class:`mp-reveal-btn`,disabled:z.value.has(e+t.id),title:t.dir||t.file||``,onClick:e=>st(t)},[c(l,null,{default:A(()=>[c(L(n))]),_:1}),E(` `+h(L(V)(`@MKT:打开文件夹`)),1)],8,Je),I(`button`,{class:`mp-remove-btn`,disabled:P.value.has(e+t.id),onClick:e=>ct(t)},[c(l,null,{default:A(()=>[c(L(O))]),_:1}),E(` `+h(P.value.has(e+t.id)?L(V)(`@MKT:卸载中...`):L(V)(`@MKT:卸载`)),1)],8,Ye)]))),128))])])):i(``,!0)])),64))])):i(``,!0),!p.value&&!u.value.length?(g(),r(`div`,Xe,h(L(V)(`@MKT:加载失败`)),1)):i(``,!0)])),[[T,p.value]]),c(le,{modelValue:J.visible,"onUpdate:modelValue":o[5]||=e=>J.visible=e,title:L(V)(`@MKT:配置 MCP`),width:`460px`,type:`flex`,"close-on-click-modal":!1,"append-to-body":``},{footer:A(()=>[I(`button`,{class:`mkt-cancel`,onClick:o[4]||=e=>J.visible=!1},h(L(V)(`@MKT:取消`)),1),I(`button`,{class:`mkt-confirm`,onClick:rt},h(L(V)(`@MKT:安装`)),1)]),default:A(()=>[J.item?(g(),r(`div`,Ze,[I(`p`,Qe,h(J.item.name),1),(g(!0),r(R,null,_(Object.keys(J.env),e=>(g(),r(`div`,{key:e,class:`mkt-field`},[I(`label`,null,h(e),1),N(I(`input`,{"onUpdate:modelValue":t=>J.env[e]=t,type:`text`,autocomplete:`off`,placeholder:L(V)(`@MKT:环境变量值`),spellcheck:`false`},null,8,$e),[[C,J.env[e]]])]))),128)),J.item.args?.length?(g(),r(`div`,et,[I(`label`,null,h(L(V)(`@MKT:启动参数`)),1),N(I(`input`,{"onUpdate:modelValue":o[3]||=e=>J.args=e,type:`text`,autocomplete:`off`,spellcheck:`false`},null,512),[[C,J.args]]),I(`p`,tt,h(L(V)(`@MKT:参数提示`)),1)])):i(``,!0)])):i(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-536d7952`]]);d(),y(),l();var rt={class:`agent-chat-area`},it={class:`agent-tabs`,role:`tablist`},at=[`aria-selected`,`onClick`],ot={class:`agent-tab-body`},st={key:0,class:`agent-chat-pane`},ct={key:0,class:`agent-list-page`},lt={key:0,class:`agent-page-bar`},ut=[`title`,`aria-label`],dt={class:`agent-page-title`},ft={key:0,class:`chat-loading`},pt=H(u({__name:`AgentView`,setup(n){let te=ce(),s=F(null),{narrow:l}=J(s),u=F(`chat`),d=F(`chat`),ne=t(()=>d.value===`mcp`?`mcp`:`skill`),re=t(()=>[{id:`chat`,label:V(`@AGENT:对话`),icon:x},{id:`skill`,label:V(`@AGENT:Skill 广场`),icon:p},{id:`mcp`,label:V(`@AGENT:MCP 广场`),icon:P}]),{sessions:m,sessionsLoading:v,currentSessionId:y,messages:S,isStreaming:C,sessionLoading:w,loadSessions:ie,loadSession:E,deleteSession:ae,renameSession:D,newSession:O,sendMessage:k,pendingQuestion:M,answeringQuestion:oe,answerQuestion:N,isSessionGenerating:se,currentEngine:H,pendingEngine:le,isEngineLocked:Y,pickEngine:pe,stop:me}=K(),he=t(()=>Y.value?H.value:le.value);function ge(e){Y.value||pe(e)}let _e=t(()=>{let e=te.theme;return e===`dark`||e===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}),X=t(()=>U(m.value,se)),ve=G(),ye=t(()=>X.value.find(e=>e.id===y.value)?.title||V(`@AGENT:对话`)),be={"--welcome-avatar":`url("${q}")`},xe=t(()=>[{id:`p1`,label:V(`@AGENT:查看项目结构`),prompt:V(`@AGENT:prompt_p1`)},{id:`p2`,label:V(`@AGENT:分析代码质量`),prompt:V(`@AGENT:prompt_p2`)},{id:`p3`,label:V(`@AGENT:帮我写测试`),prompt:V(`@AGENT:prompt_p3`)},{id:`p4`,label:V(`@AGENT:Git 状态检查`),prompt:V(`@AGENT:prompt_p4`)},{id:`p5`,label:V(`@AGENT:帮我启动项目`),prompt:V(`@AGENT:prompt_p5`)}]);async function Se(e){await k(e.text,e.files),await o(),Z()}async function Ce(e){await k(e.prompt),await o(),Z()}let we=ue(),Te=F(null);function Z(e=!0){Te.value?.scrollToBottom(e)}T(()=>S.value.length,()=>{o(()=>Z(!1))});function Ee(e){E(e),u.value=`chat`}function De(){O(),u.value=`chat`}let Q=F(280),$=F(!1);function Oe(e){$.value=!0;let t=e.clientX,n=Q.value,r=e=>{let r=e.clientX-t,i=Math.max(200,Math.min(500,n+r));Q.value=i},i=()=>{$.value=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}return T(l,e=>{e||(u.value=`chat`)}),T(()=>[te.currentDirectory,C.value],async([e,t],n)=>{let r=!n||e!==n[0],i=!!n&&n[1]===!0&&!t;(r||i)&&await ie(),y.value&&!C.value&&!m.value.some(e=>e.sessionId===y.value)&&O()},{immediate:!0}),(t,n)=>(g(),r(`div`,{ref_key:`rootRef`,ref:s,class:`agent-view`},[d.value===`chat`&&!L(l)?(g(),r(R,{key:0},[I(`aside`,{class:`agent-sidebar`,style:j({width:Q.value+`px`})},[c(L(B),{class:`agent-conversations`,items:X.value,"active-id":L(y),loading:L(v),labels:L(ve),onSelect:Ee,onNew:De,onRename:L(D),onDelete:L(ae)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],4),I(`div`,{class:a([`sidebar-resizer`,{active:$.value}]),onMousedown:Oe},null,34)],64)):i(``,!0),I(`main`,rt,[I(`nav`,it,[(g(!0),r(R,null,_(re.value,e=>(g(),r(`button`,{key:e.id,type:`button`,class:a([`agent-tab`,{active:d.value===e.id}]),role:`tab`,"aria-selected":d.value===e.id,onClick:t=>d.value=e.id},[c(L(ee),null,{default:A(()=>[(g(),f(b(e.icon)))]),_:2},1024),I(`span`,null,h(e.label),1)],10,at))),128)),d.value===`chat`?(g(),f(fe,{key:0,class:`agent-engine`,engine:he.value,locked:L(Y),onSelect:ge},null,8,[`engine`,`locked`])):i(``,!0)]),I(`div`,ot,[d.value===`chat`?(g(),r(`div`,st,[L(l)&&u.value===`list`?(g(),r(`div`,ct,[c(L(B),{class:`agent-conversations`,items:X.value,"active-id":L(y),loading:L(v),labels:L(ve),onSelect:Ee,onNew:De,onRename:L(D),onDelete:L(ae)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])])):(g(),r(R,{key:1},[L(l)?(g(),r(`div`,lt,[I(`button`,{type:`button`,class:`agent-page-back`,title:L(V)(`@AGENT:返回会话列表`),"aria-label":L(V)(`@AGENT:返回会话列表`),onClick:n[0]||=e=>u.value=`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,ut),I(`span`,dt,h(ye.value),1)])):i(``,!0),I(`div`,{class:`agent-chat-host`,style:be},[L(w)?(g(),r(`div`,ft,[c(L(ee),{class:`is-loading`,size:32},{default:A(()=>[c(L(e))]),_:1}),I(`span`,null,h(L(V)(`@AGENT:加载会话中...`)),1)])):(g(),f(L(z),{key:1,ref_key:`chatContainerRef`,ref:Te,messages:L(S),"preset-questions":xe.value,"welcome-title":L(V)(`@AGENT:智能体助手`),"welcome-description":L(V)(`@AGENT:我可以帮你阅读代码、执行命令、修改文件。选择下方话题或直接输入你的问题。`),"assistant-name":L(de),"assistant-avatar":L(q),theme:_e.value,disabled:L(C),generating:L(C),"upload-config":{accept:L(W)},placeholder:L(C)?L(V)(`@AGENT:正在生成中...`):L(V)(`@AGENT:输入消息,Enter 发送`),question:L(M),"question-submitting":L(oe),"question-labels":L(we),"plan-config":{labels:{title:L(V)(`@AGENT:计划`),raw:L(V)(`@AGENT:原始参数`)}},onSend:Se,onSelect:Ce,onStop:L(me),onAnswer:L(N)},null,8,[`messages`,`preset-questions`,`welcome-title`,`welcome-description`,`assistant-name`,`assistant-avatar`,`theme`,`disabled`,`generating`,`upload-config`,`placeholder`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onStop`,`onAnswer`]))])],64))])):(g(),f(nt,{key:1,type:ne.value},null,8,[`type`]))])])],512))}}),[[`__scopeId`,`data-v-855f248d`]]);export{pt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.mindmap-preview[data-v-d2fe328b]{background:var(--bg-container,#fff);flex-direction:column;width:100%;height:100%;display:flex}.mindmap-preview-header[data-v-d2fe328b]{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-d2fe328b]{color:var(--text-primary,var(--md-text-strong));letter-spacing:.5px;font-weight:600}.mindmap-preview-hint[data-v-d2fe328b]{color:var(--text-secondary,var(--md-text-muted));font-size:var(--font-size-xs)}.mindmap-preview-canvas[data-v-d2fe328b]{flex:1;width:100%;min-height:0}.mindmap-preview-canvas[data-v-d2fe328b] .zm-mindmap,.mindmap-preview-canvas[data-v-d2fe328b]>*{width:100%;height:100%}.editor-agent-panel[data-v-1b43252d]{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-1b43252d]{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-1b43252d]{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-1b43252d]{flex:1}.agent-panel-engine[data-v-1b43252d]{flex:none}.agent-panel-icon-btn[data-v-1b43252d]{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-1b43252d]:hover{background:var(--bg-hover);color:var(--text-secondary)}.agent-panel-body[data-v-1b43252d]{flex:1;grid-template:"stage"minmax(0,1fr)"composer"/minmax(0,1fr);min-height:0;display:grid}.agent-panel-body.is-wide[data-v-1b43252d]{grid-template-columns:240px minmax(0,1fr);grid-template-areas:"list chat""list composer"}.agent-panel-convs[data-v-1b43252d]{grid-area:stage;min-height:0;padding:8px 10px;overflow-y:auto}.agent-panel-chat[data-v-1b43252d]{grid-area:stage;min-height:0;display:flex}.agent-panel-body.is-wide .agent-panel-convs[data-v-1b43252d]{grid-area:list}.agent-panel-body.is-wide .agent-panel-chat[data-v-1b43252d]{grid-area:chat}.agent-panel-composer[data-v-1b43252d]{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-chat[data-v-1b43252d]>.acu-chat{flex:1;min-width:0}.agent-panel-chat[data-v-1b43252d] .acu-avatar--left{background:0 0}.agent-panel-composer[data-v-1b43252d] .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-1b43252d] .acu-input-attachments>.agent-context-slot{display:inline-flex}.agent-context-att[data-v-1b43252d]{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-1b43252d]{opacity:.75;flex-shrink:0}.agent-context-att-name[data-v-1b43252d]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-context-att-remove[data-v-1b43252d]{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-1b43252d]:hover{transform:scale(1.12)}.agent-context-att-remove[data-v-1b43252d]:active{transform:scale(1.02)}.editor-view[data-v-c65c2d3f]{background:var(--bg-container);width:100%;height:100%;box-shadow:var(--shadow-sm);border-radius:0;display:flex;overflow:hidden}.editor-sidebar[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex-shrink:0;display:flex;overflow:hidden}.sidebar-header[data-v-c65c2d3f]{flex-shrink:0;justify-content:space-between;align-items:center;padding:8px 10px 6px;display:flex}.sidebar-title[data-v-c65c2d3f]{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-c65c2d3f]{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-c65c2d3f]:hover{color:var(--text-primary);background:var(--bg-hover)}.sidebar-search[data-v-c65c2d3f]{flex-shrink:0;align-items:center;padding:6px 10px;display:flex;position:relative}.sidebar-search-icon[data-v-c65c2d3f]{color:var(--text-meta);pointer-events:none;position:absolute;left:18px}.sidebar-search-input[data-v-c65c2d3f]{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-c65c2d3f]::placeholder{color:var(--text-meta)}.sidebar-search-input[data-v-c65c2d3f]:hover{border-color:var(--text-tertiary)}.sidebar-search-input[data-v-c65c2d3f]:focus{border-color:var(--color-primary);background:var(--bg-panel)}.sidebar-search-clear[data-v-c65c2d3f]{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-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.tree-name-hit[data-v-c65c2d3f]{color:var(--color-warning-light);border-radius:var(--radius-xs);background:#f59e0b26;padding:0 1px}.sidebar-tree[data-v-c65c2d3f]{flex:1;padding:4px 0;overflow:hidden auto}.tree-node[data-v-c65c2d3f]{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-c65c2d3f]:hover{background:var(--bg-hover)}.tree-node--active[data-v-c65c2d3f]{background:var(--tint-primary-12);color:var(--color-primary)}.tree-node--selected[data-v-c65c2d3f]{outline-offset:-1px;background:#63b3ed26;outline:1px solid #63b3ed59}.tree-arrow[data-v-c65c2d3f]{color:var(--text-meta);transition:transform var(--transition-fast);flex-shrink:0;align-items:center;width:12px;display:flex}.tree-arrow.expanded[data-v-c65c2d3f]{transform:rotate(90deg)}.tree-arrow-spacer[data-v-c65c2d3f]{flex-shrink:0;width:12px}.tree-icon[data-v-c65c2d3f]{font-size:var(--font-size-base);flex-shrink:0;align-items:center;line-height:1;display:flex}.tree-icon.mit-icon[data-v-c65c2d3f]{fill:currentColor;vertical-align:middle;width:14px;height:14px;display:inline-block}.tree-icon--dir[data-v-c65c2d3f]{color:#e8b84b}.tree-name[data-v-c65c2d3f]{text-overflow:ellipsis;min-width:0;font-size:var(--font-size-mid);flex:1;overflow:hidden}.tree-loading[data-v-c65c2d3f]{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-c65c2d3f;display:inline-block}.tree-empty[data-v-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);text-align:center;padding:24px 12px}.sidebar-loading[data-v-c65c2d3f]{flex:1;justify-content:center;align-items:center;display:flex}.spin-icon[data-v-c65c2d3f]{border:2px solid var(--color-primary);border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite spin-c65c2d3f;display:inline-block}@keyframes spin-c65c2d3f{to{transform:rotate(360deg)}}.editor-resizer[data-v-c65c2d3f]{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-c65c2d3f]: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-c65c2d3f]:hover{background:var(--tint-primary-06)}.editor-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.editor-main[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.editor-tabs[data-v-c65c2d3f]{background:var(--bg-panel);scrollbar-width:none;flex-shrink:0;display:flex;overflow:auto hidden}.editor-tabs[data-v-c65c2d3f]::-webkit-scrollbar{display:none}.editor-tab[data-v-c65c2d3f]{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-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.editor-tab.active[data-v-c65c2d3f]{background:var(--bg-container);color:var(--text-primary);border-bottom:2px solid var(--color-primary)}.tab-name[data-v-c65c2d3f]{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.tab-dirty-dot[data-v-c65c2d3f]{background:var(--color-warning);border-radius:50%;flex-shrink:0;width:6px;height:6px}.tab-close[data-v-c65c2d3f]{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-c65c2d3f],.editor-tab.active .tab-close[data-v-c65c2d3f]{opacity:1}.tab-close[data-v-c65c2d3f]:hover{background:var(--bg-hover);color:var(--color-danger-dark)}.editor-empty[data-v-c65c2d3f]{flex:1}.monaco-container[data-v-c65c2d3f]{flex:1;min-width:0;overflow:hidden}.monaco-container.hidden[data-v-c65c2d3f]{display:none}.image-tab-placeholder[data-v-c65c2d3f]{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-c65c2d3f]{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-c65c2d3f]{font-size:var(--font-size-sm);color:var(--text-meta);margin:0}.editor-body[data-v-c65c2d3f]{flex:1;min-height:0;display:flex;overflow:hidden}.preview-resizer[data-v-c65c2d3f]{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-c65c2d3f]: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-c65c2d3f]:hover{background:var(--tint-primary-06)}.preview-resizer[data-v-c65c2d3f]:hover:after{background:var(--color-primary);height:48px;box-shadow:0 0 8px #3b82f666}.preview-panel[data-v-c65c2d3f]{background:var(--bg-panel);flex-direction:column;flex:1 1 0;min-width:200px;display:flex;overflow:hidden}.preview-header[data-v-c65c2d3f]{background:var(--bg-panel);flex-shrink:0;align-items:center;gap:6px;height:34px;padding:0 10px;display:flex}.preview-title[data-v-c65c2d3f]{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-c65c2d3f]{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-c65c2d3f]{flex:1}.preview-close-btn[data-v-c65c2d3f]{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-c65c2d3f]:hover{color:var(--color-danger-dark);background:var(--bg-hover)}.preview-body[data-v-c65c2d3f]{flex-direction:column;flex:1;display:flex;overflow:hidden}.preview-iframe[data-v-c65c2d3f]{background:0 0;border:none;flex:1;width:100%;height:100%}.preview-markdown[data-v-c65c2d3f]{flex:1;width:100%;height:100%;overflow:auto}.preview-mindmap[data-v-c65c2d3f]{background:var(--bg-container,#fff);flex-direction:column;flex:1;width:100%;height:100%;display:flex;overflow:hidden}.mindmap-toggle-btn.disabled[data-v-c65c2d3f]{opacity:.45;cursor:not-allowed}.mindmap-toggle-btn.active[data-v-c65c2d3f]{color:#fff;background:linear-gradient(#6366f1 0%,#4f46e5 100%);border-color:#4f46e5}.preview-image-wrap[data-v-c65c2d3f]{background:var(--bg-container);flex:1;justify-content:center;align-items:center;padding:16px;display:flex;overflow:auto}.preview-image-wrap img[data-v-c65c2d3f]{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-c65c2d3f]{flex:1}.preview-toggle-btn[data-v-c65c2d3f]{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-c65c2d3f]:hover{background:var(--bg-hover);color:var(--text-primary)}.preview-toggle-btn.active[data-v-c65c2d3f]{color:var(--color-primary);background:var(--tint-primary-08)}.sidebar-actions[data-v-c65c2d3f]{align-items:center;gap:2px;display:flex}.tree-inline-input-row[data-v-c65c2d3f]{cursor:default;background:var(--bg-hover)}.tree-inline-input[data-v-c65c2d3f]{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-c65c2d3f]{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-c65c2d3f]{flex-shrink:0;width:13px;height:13px}.ctx-menu-item[data-v-c65c2d3f]{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-c65c2d3f]:hover{background:var(--bg-hover)}.ctx-menu-item--danger[data-v-c65c2d3f]{color:var(--color-danger-dark)}.ctx-menu-item--danger[data-v-c65c2d3f]:hover{background:#ef44441a}.ctx-menu-sep[data-v-c65c2d3f]{background:var(--border-color);height:1px;margin:4px 2px}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,Hn as o,Mn as s,Mr as c,Pn as l,Rn as u,Tn as d,W as ee,Xr as f,Yn as p,Zn as te,_n as ne,dr as m,gn as re,hn as ie,i as h,ir as g,jn as _,ln as v,or as ae,qn as oe,qr as y,r as se,sr as b,vn as ce,vr as x,wn as S,wr as C,xn as le,yn as w,yr as ue}from"./element-plus-DrCk0pcV.js";import{a as de,r as T,t as fe}from"./vendor-yntih_em.js";import{n as E,t as D}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{t as pe}from"./SvgIcon-B-xDJQA1.js";import{t as me}from"./configStore-CMlW8sMa.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-Dfcwm1aX.js";import{n as Se,r as O}from"./flow-mindmap-Cx5RNYN9.js";import{A as Ce,F as we,I as Te,M as Ee,N as De,O as Oe,P as ke,d as Ae,i as je,j as Me,k}from"./index-BQxIFopZ.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./agentConversations-B8nY45V4.js";import{n as Be,t as A}from"./AgentEngineSelector-D6rlSfMD.js";function j(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`}u(),m();var M={class:`mindmap-preview`},N={class:`mindmap-preview-canvas`},P=D(l({__name:`MindmapPreview`,props:{content:{}},setup(e){let r=e,i=t(()=>O(r.content||``,`未命名文档`));return(e,t)=>(p(),n(`div`,M,[t[0]||=S(`div`,{class:`mindmap-preview-header`},[S(`span`,{class:`mindmap-preview-title`},`整篇导图`),S(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),S(`div`,N,[s(C(Se),{data:i.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);u(),m(),c(),v();var Ve={class:`agent-panel-header`},He=[`title`,`aria-label`],Ue={class:`agent-panel-title`},We={key:1,class:`agent-panel-title`},Ge=[`title`,`aria-label`],Ke=[`title`],qe={class:`agent-panel-convs`},Je=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],Ye=D(l({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(c,{emit:l}){let u=c,ee=l,{theme:te}=De(),ne=t(()=>te.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:ie,currentSessionId:h,messages:_,isStreaming:v,pendingQuestion:ae,answeringQuestion:y,isSessionGenerating:se,currentEngine:ce,pendingEngine:ue,isEngineLocked:D,pickEngine:pe,loadSessions:me,loadSession:he,deleteSession:ge,renameSession:_e,newSession:ve,sendMessage:ye,answerQuestion:be,stop:xe}=Re(),Se=t(()=>D.value?ce.value:ue.value);function O(e){D.value||pe(e)}let Ce=t(()=>Ne(m.value,se)),we=Le(),Te=Pe(),Ee=x(null),Oe=x(null),ke=x(null),Ae=x(null),je=x(null),{width:Me,narrow:k}=Be(je),j=x(`chat`),M=x(null),N=x(!1),P=null,Ye=t(()=>!!u.activeFileName&&!N.value);function Xe(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Ze(){let e=Oe.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Ye.value){if(!t)return;M.value=null,o(()=>t.remove());return}let n=M.value&&e.contains(M.value)?M.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Xe(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),M.value=n}function Qe(e=!0){Ee.value?.scrollToBottom(e)}async function $e(e){let t=N.value?void 0:u.activeFilePath||void 0;await ye(e.text,e.files,{openFilePath:t}),await o(),Qe()}function et(e){he(e),j.value=`chat`}function tt(){ve(),j.value=`chat`}g(()=>_.value.length,()=>{o(()=>Qe(!1))});function nt(){let e=Ae.value;!e||typeof MutationObserver>`u`||(P?.disconnect(),P=new MutationObserver(()=>Ze()),P.observe(e,{childList:!0,subtree:!0}))}return g(()=>u.active,e=>{e&&(j.value=`chat`,me().catch(()=>{}),o(()=>{Ze(),Qe(!1)}))}),g(k,e=>{e||(j.value=`chat`)}),g(()=>u.activeFilePath,()=>{N.value=!1}),g(Ye,e=>{e&&o(Ze)}),oe(()=>{me().catch(()=>{}),o(()=>{Ze(),nt()})}),i(()=>{P?.disconnect(),P=null,M.value=null}),(t,i)=>(p(),n(`div`,{ref_key:`rootRef`,ref:je,class:`editor-agent-panel`},[S(`div`,Ve,[C(k)&&j.value===`list`?(p(),n(w,{key:0},[S(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:C(E)(`@EDITOR:返回对话`),"aria-label":C(E)(`@EDITOR:返回对话`),onClick:i[0]||=e=>j.value=`chat`},[...i[4]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),S(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,He),S(`span`,Ue,f(C(E)(`@EDITOR:会话列表`)),1)],64)):(p(),n(`span`,We,f(C(E)(`@EDITOR:g ai 对话`)),1)),i[7]||=S(`div`,{class:`agent-panel-spacer`},null,-1),!C(k)||j.value===`chat`?(p(),d(A,{key:2,class:`agent-panel-engine`,engine:Se.value,locked:C(D),onSelect:O},null,8,[`engine`,`locked`])):r(``,!0),C(k)&&j.value===`chat`?(p(),n(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:C(E)(`@EDITOR:会话列表`),"aria-label":C(E)(`@EDITOR:会话列表`),onClick:i[1]||=e=>j.value=`list`},[...i[5]||=[e(`<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-1b43252d><line x1="8" y1="6" x2="21" y2="6" data-v-1b43252d></line><line x1="8" y1="12" x2="21" y2="12" data-v-1b43252d></line><line x1="8" y1="18" x2="21" y2="18" data-v-1b43252d></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-1b43252d></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-1b43252d></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-1b43252d></line></svg>`,1)]],8,Ge)):r(``,!0),S(`button`,{class:`agent-panel-icon-btn`,title:C(E)(`@EDITOR:关闭对话`),onClick:i[2]||=e=>ee(`close`)},[...i[6]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ke)]),S(`div`,{class:a([`agent-panel-body`,{"is-wide":!C(k)}])},[b(S(`div`,qe,[s(C(fe),{"show-search":!0,items:Ce.value,"active-id":C(h),loading:C(ie),labels:C(we),onSelect:et,onNew:tt,onRename:C(_e),onDelete:C(ge)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[re,!C(k)||j.value===`list`]]),b(S(`div`,{ref_key:`chatHostRef`,ref:ke,class:`agent-panel-chat`},[s(C(de),{ref_key:`chatRef`,ref:Ee,"show-input":!1,messages:C(_),"assistant-name":C(Fe),"assistant-avatar":C(ze),theme:ne.value,question:C(ae),"question-submitting":C(y),"question-labels":C(Te),"plan-config":{labels:{title:C(E)(`@AGENT:计划`),raw:C(E)(`@AGENT:原始参数`)}},onAnswer:C(be)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[re,!C(k)||j.value===`chat`]]),C(Me)>0?(p(),n(`div`,{key:0,ref_key:`composerRef`,ref:Ae,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[s(C(T),{ref_key:`inputRef`,ref:Oe,disabled:C(v),generating:C(v),placeholder:C(v)?C(E)(`@AGENT:正在生成中...`):C(E)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:C(Ie)},onSend:$e,onStop:C(xe)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),M.value?(p(),d(le,{key:0,to:M.value},[Ye.value?(p(),n(`div`,{key:0,class:`agent-context-att`,title:c.activeFilePath||``},[i[9]||=S(`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`},[S(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),S(`polyline`,{points:`14 3 14 8 19 8`})],-1),S(`span`,I,f(c.activeFileName),1),S(`button`,{type:`button`,class:`agent-context-att-remove`,title:C(E)(`@EDITOR:不引用当前文档`),"aria-label":C(E)(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>N.value=!0},[...i[8]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):r(``,!0)],8,[`to`])):r(``,!0)],8,Je)):r(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-1b43252d`]]);u(),m(),c(),v();var Xe={class:`sidebar-header`},Ze={class:`sidebar-title`},Qe={class:`sidebar-actions`},$e={class:`sidebar-search`},et=[`placeholder`,`title`],tt=[`title`,`aria-label`],nt={key:0,class:`sidebar-tree`},rt={key:1,class:`tree-arrow-spacer`},it={class:`tree-icon mit-icon`,"aria-hidden":`true`},at=[`xlink:href`],ot=[`onClick`,`onContextmenu`],st={key:1,class:`tree-arrow-spacer`},ct={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},dt=[`xlink:href`],ft=[`title`],pt={key:0,class:`tree-name-hit`},mt={key:4,class:`tree-loading`},ht={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)`}},gt={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)`}},_t=[`placeholder`],vt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},yt={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)`}},bt={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)`}},xt=[`placeholder`],St={key:1,class:`tree-empty`},Ct={key:1,class:`sidebar-loading`},wt={class:`editor-main`},Tt={key:0,class:`editor-tabs`},Et=[`onClick`,`title`],Dt={class:`tab-name`},Ot={key:0,class:`tab-dirty-dot`},kt=[`onClick`],At=[`title`],jt=[`disabled`,`title`],Mt=[`title`],Nt={class:`editor-body`},Pt={key:0,class:`image-tab-placeholder`},Ft={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`}},It={class:`image-tab-placeholder-title`},Lt={class:`image-tab-placeholder-hint`},Rt={class:`preview-header`},zt={class:`preview-title`},Bt={class:`preview-ext-badge`},Vt=[`title`],Ht={class:`preview-body`},Ut=[`sandbox`,`srcdoc`],Wt=6e4,Gt=3e4,Kt=D(l({__name:`EditorView`,props:{pendingFilePath:{}},setup(c){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 l=c,u=me(),m=Ae(),v=x([]),de=x(!1),T=x(``),fe=x(``),D=null;function Se(){T.value=``,fe.value=``,D&&=(clearTimeout(D),null)}g(T,e=>{D&&clearTimeout(D),D=setTimeout(()=>{fe.value=e,D=null},180)}),i(()=>{D&&clearTimeout(D),Pe(),gn()});let O=null;function Ne(){Pe(),u.ui.fileTreeAutoRefresh&&(O=setInterval(()=>{document.hidden||u.currentDirectory&&(T.value.trim()||A())},Wt))}function Pe(){O&&=(clearInterval(O),null)}g(()=>u.currentDirectory,async()=>{if(Zt=!1,Ne(),await Ie(),F.value.some(e=>e.isDirty)){Zt=!0;return}F.value=[],I.value=null,rn(),await en()}),g(()=>u.ui.fileTreeAutoRefresh,()=>{Ne()});async function Fe(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 Ie(){let e=u.currentDirectory;if(e){de.value=!0;try{v.value=await Fe(e,0)}finally{de.value=!1}}}function Le(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Le(n.children,t));return t}function Re(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=Re(e.children,t+1),n.expanded=!0),n})}async function ze(e){let t=u.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:Re(n.items,0)}catch{return null}}function Be(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)?Be(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function A(e={}){if(!u.currentDirectory)return;let t=await ze([...Le(v.value)]);if(!t){e.notifyOnError&&h.error(E(`@EDITOR:刷新失败`));return}if(v.value.length===0){v.value=t;return}Be(v.value,t)&&(v.value=t)}async function M(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Fe(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function N(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...N(n.children));return t}let Ve=t(()=>fe.value.trim().toLowerCase());function He(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?He(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 Ue=t(()=>He(v.value,Ve.value)),We=t(()=>Ve.value.length>0&&Ue.value.length===0);function Ge(e){let t=fe.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 Ke=x(null);function qe(){let e=Ke.value;e&&(e.focus(),e.select())}function Je(){T.value?(Se(),Ke.value?.focus()):(Ke.value?.blur(),R.value?.focus())}let F=x([]),I=x(null),L=x(null);async function Kt(e){if(L.value=e,e.type!==`file`){M(e);return}let t=F.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:F.value.length}),t){I.value=e.path,o(()=>on());return}let n=e.name.split(`.`).pop()||``;if(q.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ke(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.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){h.error(`${E(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=j(n),a=z.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}),F.value.push(o),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),h.error(`${E(`@EDITOR:打开文件失败: `)}${e.message}`)}}g(()=>l.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await o();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Kt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function qt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(E(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Jt=()=>F.value.find(e=>e.path===I.value)??null,Yt=t(()=>({expandedDirs:[...Le(v.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Xt=!1,Zt=!1;function Qt(){Zt&&!Xt&&u.isUiLoaded&&u.saveEditorWorkspace(Yt.value)}g(Yt,()=>Qt());async function $t(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(q.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ke(t)){F.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=z.get(e);i&&!i.isDisposed()&&R.value?.getModel()!==i&&(i.dispose(),z.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:j(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function en(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;V.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Xt=!0;try{if(e.expandedDirs.length>0){let t=await ze(e.expandedDirs);t&&(v.value=t)}for(let t of e.tabs)await $t(t);if(!l.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Jt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(q.has(n)||ke(t.name))&&(J.value=!0)}}finally{Xt=!1}}finally{Zt=!0,Qt()}}let tn=x(null),R=ue(null),z=new Map;function nn(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=be.createModel(e.content,e.language,ve.file(e.path)),z.set(e.path,t)),t}function rn(){R.value?.setModel(null);for(let e of z.values())e.isDisposed()||e.dispose();z.clear()}function an(){if(!tn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=be.create(tn.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}),R.value.onDidChangeModelContent(()=>{let e=Jt();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Jt()?.isDirty&&yn(!1),requestAnimationFrame(()=>{if(!B.value||B.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`))||on()})})}g(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=nn(t);R.value.setModel(n),o(()=>on()),fn(e)});function on(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let sn=0,cn=new Map;async function ln(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 un(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 dn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=z.get(e.path);if(!r||r.isDisposed())return;let i=R.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 fn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++sn,r=await ln(e);if(n!==sn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(cn.get(e)===r.mtimeMs)return;cn.set(e,r.mtimeMs);try{await se.confirm(E(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),E(`@EDITOR:文件已被外部改动`),{confirmButtonText:E(`@EDITOR:重新加载`),cancelButtonText:E(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await un(e);i&&F.value.find(t=>t.path===e)===t&&dn(t,i.content,i.mtimeMs)}function pn(){document.hidden||fn(I.value)}let mn=null;function hn(){gn(),mn=setInterval(()=>{document.hidden||fn(I.value)},Gt)}function gn(){mn&&=(clearInterval(mn),null)}g(()=>F.value.filter(e=>e.isDirty).length,e=>{m.setDirtyCount(e)},{immediate:!0}),i(()=>m.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;be.setTheme(e?`vs-dark`:`vs`)});let _n=null;function vn(){if(_n||!B.value)return;let e=[B.value],t=B.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}_n=new MutationObserver(()=>{B.value&&B.value.offsetParent!==null&&I.value&&R.value&&(fn(I.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`))||on()}))});let n=_n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}oe(async()=>{an(),await Ie(),await en(),vn(),Ne(),window.addEventListener(`focus`,pn),document.addEventListener(`visibilitychange`,pn),hn(),I.value&&o(()=>on())}),i(()=>{_n?.disconnect(),_n=null,window.removeEventListener(`focus`,pn),document.removeEventListener(`visibilitychange`,pn),R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function yn(e=!1){let t=Jt();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){h.error(`${E(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||h.success(E(`@EDITOR:已保存`))}catch(e){h.error(`${E(`@EDITOR:保存失败: `)}${e.message}`)}}function bn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),qe();return}t&&e.key===`s`&&(e.preventDefault(),yn())}oe(()=>window.addEventListener(`keydown`,bn)),i(()=>window.removeEventListener(`keydown`,bn));let B=x(null),V=x(u.ui.editorSidebarWidth),xn=!1,Sn=0,Cn=0;function wn(e){xn=!0,Sn=e.clientX,Cn=V.value,document.addEventListener(`mousemove`,Tn),document.addEventListener(`mouseup`,En),e.preventDefault()}function Tn(e){if(!xn)return;let t=e.clientX-Sn;V.value=Math.max(140,Math.min(400,Cn+t))}function En(){xn=!1,document.removeEventListener(`mousemove`,Tn),document.removeEventListener(`mouseup`,En),V.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(V.value)}function Dn(e){return e.type===`directory`?Te(e.name):we(e.name)}let H=x(null),U=x(null),W=x(null),On=x(null);function kn(){let e=L.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(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function An(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`file`,value:``},await o(),W.value?.focus()}async function jn(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`directory`,value:``},await o(),W.value?.focus()}function Mn(){H.value=null}async function Nn(){let e=H.value;if(!e||!e.value.trim()){H.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){h.error(e.error);return}h.success(E(`@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){h.error(e.error);return}h.success(E(`@EDITOR:创建成功`))}H.value=null,await A()}function Pn(e){e.key===`Enter`&&(e.preventDefault(),Nn()),e.key===`Escape`&&(e.preventDefault(),Mn())}let G=x(null),Fn=x(null);function In(e,t){e.preventDefault(),G.value={x:e.clientX,y:e.clientY,node:t}}function K(){G.value=null}async function Ln(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`file`,value:``},await o(),W.value?.focus()}async function Rn(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`directory`,value:``},await o(),W.value?.focus()}async function zn(){let e=G.value?.node;K(),e&&(U.value={node:e,value:e.name},await o(),On.value?.focus(),On.value?.select())}async function Bn(){let e=U.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){U.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){h.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),U.value=null,await A()}function Vn(e){e.key===`Enter`&&(e.preventDefault(),Bn()),e.key===`Escape`&&(e.preventDefault(),U.value=null)}async function Hn(){let e=G.value?.node;if(K(),!e)return;let t=e.type===`directory`?E(`@EDITOR:文件夹`):E(`@EDITOR:文件`);if(!confirm(`${E(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){h.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),h.success(E(`@EDITOR:已删除`)),await A()}async function Un(){let e=G.value?.node;if(K(),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||h.error(t.error)}catch(e){h.error(e?.message||String(e))}}function Wn(e){let t=u.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 Gn(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 Kn(){let e=G.value?.node;K(),e&&(await Gn(e.path)?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function qn(){let e=G.value?.node;K(),e&&(await Gn(Wn(e.path))?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function Jn(){let e=G.value?.node;if(K(),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||h.error(t.error||E(`@EDITOR:VSCode 未安装`))}catch(e){h.error(e?.message||String(e))}}let Yn=new Set([`html`,`htm`]),Xn=t(()=>{let e=G.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Yn.has(t)});async function Zn(){let e=G.value?.node;if(K(),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||h.error(t.error||E(`@EDITOR:浏览器打开失败`))}catch(e){h.error(e?.message||String(e))}}oe(()=>document.addEventListener(`click`,K)),i(()=>document.removeEventListener(`click`,K));let Qn=new Set([`md`,`html`,`htm`,`svg`]),q=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=x(!1),Y=x(!1),X=x(!1),$n=x(!1),er=x(0),Z=t(()=>F.value.find(e=>e.path===I.value)??null),tr=t(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),nr=t(()=>Z.value?.language===`office`),Q=t(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),rr=t(()=>Qn.has(Q.value)||q.has(Q.value)||ke(Q.value)),ir=t(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=t(()=>Q.value===`md`&&ir.value>0);g(I,()=>{J.value&&!rr.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function ar(){rr.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function or(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function sr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,$n.value=!0}let cr=t(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?k(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>`:``}),lr=!1,ur=0,dr=0;function fr(e){lr=!0,ur=e.clientX,dr=er.value,document.addEventListener(`mousemove`,pr),document.addEventListener(`mouseup`,mr),e.preventDefault()}function pr(e){if(!lr)return;let t=e.clientX-ur;er.value=Math.max(200,Math.min(900,dr+t))}function mr(){lr=!1,document.removeEventListener(`mousemove`,pr),document.removeEventListener(`mouseup`,mr)}return(t,i)=>(p(),n(w,null,[S(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:B},[S(`div`,{class:`editor-sidebar`,style:y({width:V.value+`px`})},[S(`div`,Xe,[S(`span`,Ze,f(C(E)(`@EDITOR:资源管理器`)),1),S(`div`,Qe,[s(C(ee),{content:C(E)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:An},[...i[11]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:jn},[...i[12]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>A({notifyOnError:!0})},[...i[13]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`1 4 1 10 7 10`}),S(`polyline`,{points:`23 20 23 14 17 14`}),S(`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`])])]),S(`div`,$e,[i[15]||=S(`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`},[S(`circle`,{cx:`11`,cy:`11`,r:`7`}),S(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),b(S(`input`,{ref_key:`searchInputRef`,ref:Ke,"onUpdate:modelValue":i[1]||=e=>T.value=e,type:`text`,class:`sidebar-search-input`,placeholder:C(E)(`@EDITOR:搜索文件...`),title:C(E)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ne(Je,[`escape`])},null,40,et),[[ie,T.value]]),T.value?(p(),n(`button`,{key:0,class:`sidebar-search-clear`,title:C(E)(`@EDITOR:清除搜索`),"aria-label":C(E)(`@EDITOR:清除搜索`),onClick:Se},[...i[14]||=[S(`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`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,tt)):r(``,!0)]),de.value?(p(),n(`div`,Ct,[...i[24]||=[S(`span`,{class:`spin-icon`},null,-1)]])):(p(),n(`div`,nt,[(p(!0),n(w,null,te(N(Ue.value),e=>(p(),n(w,{key:e.path},[U.value&&U.value.node.path===e.path?(p(),n(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[16]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,rt)),(p(),n(`svg`,it,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,at)])),b(S(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:On,"onUpdate:modelValue":i[2]||=e=>U.value.value=e,onKeydown:Vn,onBlur:Bn,onClick:i[3]||=ce(()=>{},[`stop`])},null,544),[[ie,U.value.value]])],4)):(p(),n(`div`,{key:1,class:a([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":I.value===e.path,"tree-node--selected":L.value?.path===e.path&&I.value!==e.path}]),style:y({paddingLeft:12+e.depth*14+`px`}),onClick:t=>Kt(e),onContextmenu:t=>In(t,e)},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[17]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,st)),e.type===`directory`?(p(),n(`svg`,ct,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,lt)])):(p(),n(`svg`,ut,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,dt)])),S(`span`,{class:`tree-name`,title:e.path},[(p(!0),n(w,null,te(Ge(e.name),(e,t)=>(p(),n(w,{key:t},[e.hit?(p(),n(`span`,pt,f(e.text),1)):(p(),n(w,{key:1},[_(f(e.text),1)],64))],64))),128))],8,ft),e.loading?(p(),n(`span`,mt)):r(``,!0)],46,ot)),H.value&&H.value.afterNode?.path===e.path?(p(),n(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+H.value.depth*14+`px`})},[i[20]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,ht,[...i[18]||=[S(`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)]])):(p(),n(`svg`,gt,[...i[19]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[5]||=ce(()=>{},[`stop`])},null,40,_t),[[ie,H.value.value]])],4)):r(``,!0)],64))),128)),H.value&&H.value.afterNode===null?(p(),n(`div`,vt,[i[23]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,yt,[...i[21]||=[S(`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)]])):(p(),n(`svg`,bt,[...i[22]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[7]||=ce(()=>{},[`stop`])},null,40,xt),[[ie,H.value.value]])])):r(``,!0),!H.value&&(We.value||v.value.length===0)?(p(),n(`div`,St,f(We.value?C(E)(`@EDITOR:未找到匹配文件`):C(E)(`@EDITOR:暂无文件`)),1)):r(``,!0)]))],4),S(`div`,{class:`editor-resizer`,onMousedown:wn},null,32),S(`div`,wt,[F.value.length>0?(p(),n(`div`,Tt,[(p(!0),n(w,null,te(F.value,e=>(p(),n(`div`,{key:e.path,class:a([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[S(`span`,Dt,f(e.name),1),e.isDirty?(p(),n(`span`,Ot)):r(``,!0),S(`button`,{class:`tab-close`,onClick:t=>qt(e.path,t)},[...i[25]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,kt)],10,Et))),128)),i[29]||=S(`div`,{class:`editor-tabs-spacer`},null,-1),rr.value?(p(),n(`button`,{key:0,class:a([`preview-toggle-btn`,{active:J.value}]),title:J.value?C(E)(`@EDITOR:关闭预览`):C(E)(`@EDITOR:打开预览`),onClick:ar},[i[26]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),S(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),S(`span`,null,f(C(E)(`@EDITOR:预览`)),1)],10,At)):r(``,!0),$.value?(p(),n(`button`,{key:1,class:a([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:打开思维导图`):C(E)(`@EDITOR:需要至少一个 # 标题`),onClick:or},[i[27]||=e(`<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-c65c2d3f><circle cx="12" cy="12" r="2" data-v-c65c2d3f></circle><circle cx="5" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="5" cy="18" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="18" r="1.6" data-v-c65c2d3f></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-c65c2d3f></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-c65c2d3f></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-c65c2d3f></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-c65c2d3f></line></svg>`,1),S(`span`,null,f(C(E)(`@EDITOR:思维导图`)),1)],10,jt)):r(``,!0),S(`button`,{class:a([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?C(E)(`@EDITOR:关闭 g ai 对话`):C(E)(`@EDITOR:打开 g ai 对话`),onClick:sr},[i[28]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`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),S(`span`,null,f(C(E)(`@EDITOR:g ai 对话`)),1)],10,Mt)])):r(``,!0),F.value.length===0?(p(),d(je,{key:1,class:`editor-empty`,title:C(E)(`@EDITOR:从左侧选择文件打开`),hint:C(E)(`@EDITOR:Ctrl+S 保存`)},{icon:ae(()=>[...i[30]||=[S(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):r(``,!0),S(`div`,Nt,[S(`div`,{class:a([`monaco-container`,{hidden:F.value.length===0||tr.value||nr.value}]),ref_key:`editorContainerRef`,ref:tn},null,2),tr.value&&F.value.length>0&&!J.value&&!Y.value?(p(),n(`div`,Pt,[(p(),n(`svg`,Ft,[...i[31]||=[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),S(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),S(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),S(`p`,It,f(Z.value?.name),1),S(`p`,Lt,f(C(E)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):r(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(p(),n(`div`,{key:1,class:`preview-resizer`,onMousedown:fr},null,32)):r(``,!0),$n.value?b((p(),d(Ye,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:y({flexBasis:er.value+`px`}),onClose:i[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[re,X.value&&F.value.length>0]]):r(``,!0),(J.value||Y.value)&&F.value.length>0?(p(),n(`div`,{key:3,class:`preview-panel`,style:y({flexBasis:er.value+`px`})},[S(`div`,Rt,[S(`span`,zt,f(Y.value?C(E)(`@EDITOR:思维导图`):C(E)(`@EDITOR:预览`)),1),S(`span`,Bt,f(Q.value.toUpperCase()),1),i[33]||=S(`div`,{class:`preview-header-spacer`},null,-1),S(`button`,{class:`preview-close-btn`,title:Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:关闭预览`),onClick:i[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...i[32]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Vt)]),S(`div`,Ht,[Y.value&&Q.value===`md`&&Z.value?(p(),d(P,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(p(),d(Me,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(p(),n(`iframe`,{key:2,class:`preview-iframe`,sandbox:C(Oe),srcdoc:cr.value},null,8,Ut)):J.value&&C(q).has(Q.value)&&Z.value?(p(),d(Ee,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&nr.value&&Z.value?(p(),d(Ce,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):r(``,!0)])],4)):r(``,!0)])])],512),(p(),d(le,{to:`body`},[G.value?(p(),n(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Fn,class:`ctx-menu`,style:y({left:G.value.x+`px`,top:G.value.y+`px`}),onClick:i[10]||=ce(()=>{},[`stop`])},[S(`button`,{class:`ctx-menu-item`,onClick:Ln},[i[34]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Rn},[i[35]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件夹`)),1)]),i[42]||=S(`div`,{class:`ctx-menu-sep`},null,-1),S(`button`,{class:`ctx-menu-item`,onClick:Kn},[i[36]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),S(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),_(` `+f(C(E)(`@EDITOR:复制绝对路径`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:qn},[i[37]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),S(`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),_(` `+f(C(E)(`@EDITOR:复制相对路径`)),1)]),i[43]||=S(`div`,{class:`ctx-menu-sep`},null,-1),Xn.value?(p(),n(`button`,{key:0,class:`ctx-menu-item`,onClick:Zn},[i[38]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`9`}),S(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),S(`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),_(` `+f(C(E)(`@EDITOR:在浏览器中打开`)),1)])):r(``,!0),S(`button`,{class:`ctx-menu-item`,onClick:Un},[i[39]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),_(` `+f(C(E)(`@EDITOR:在资源管理器中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Jn},[s(pe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),_(` `+f(C(E)(`@EDITOR:在 VSCode 中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:zn},[i[40]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),S(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),_(` `+f(C(E)(`@EDITOR:重命名`)),1)]),S(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Hn},[i[41]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`3 6 5 6 21 6`}),S(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),S(`path`,{d:`M10 11v6`}),S(`path`,{d:`M14 11v6`}),S(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),_(` `+f(C(E)(`@EDITOR:删除`)),1)])],4)):r(``,!0)]))],64))}}),[[`__scopeId`,`data-v-c65c2d3f`]]);export{Kt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.dir-chat[data-v-6da5fad8]{height:min(420px,42vh);min-height:200px;margin-top:var(--spacing-sm);border-top:1px solid var(--border-color-light);padding-top:var(--spacing-sm);flex-direction:column;display:flex}.dir-chat__bar[data-v-6da5fad8]{margin-bottom:var(--spacing-xs);flex-shrink:0;justify-content:flex-end;display:flex}.dir-chat__new[data-v-6da5fad8]{height:22px;padding:0 var(--spacing-base);border:1px solid var(--border-color);border-radius:var(--radius-base);color:var(--text-meta);font:inherit;font-size:var(--font-size-sm);cursor:pointer;transition:color var(--transition-fast), border-color var(--transition-fast);background:0 0;align-items:center;gap:4px;line-height:1;display:inline-flex}.dir-chat__new[data-v-6da5fad8]:hover{color:var(--color-primary);border-color:var(--color-primary)}.dir-chat__new[data-v-6da5fad8]:focus-visible{outline:var(--focus-outline);outline-offset:1px}.dir-chat[data-v-6da5fad8]>.acu-chat{flex:1;min-width:0;min-height:0}.dir-chat--fill[data-v-6da5fad8]{flex:auto;height:auto;min-height:0}.dir-chat[data-v-6da5fad8] .acu-welcome{padding:var(--spacing-base);align-items:flex-start;overflow-y:auto}.dir-chat[data-v-6da5fad8] .acu-welcome-inner{margin-block:auto}.dir-chat[data-v-6da5fad8] .acu-welcome-logo{display:none}.dir-chat[data-v-6da5fad8] .acu-welcome-title{font-size:var(--font-size-lg);margin-bottom:var(--spacing-xs)}.dir-chat[data-v-6da5fad8] .acu-welcome-desc{font-size:var(--font-size-sm);margin-bottom:var(--spacing-base)}.dir-chat[data-v-6da5fad8] .acu-welcome-grid{gap:var(--spacing-sm)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cn as e,Dn as t,En as n,Gn as r,Gr as i,Mn as a,Mr as o,Pn as s,Rn as c,Xr as l,Yn as u,dr as d,wn as f,wr as p}from"./element-plus-DrCk0pcV.js";import{a as m}from"./vendor-yntih_em.js";import{n as h,t as g}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{N as _}from"./index-BQxIFopZ.js";import{i as v,n as y,s as b}from"./agentConversations-B8nY45V4.js";c(),d(),o();var x={key:0,class:`dir-chat__bar`},S=[`title`,`aria-label`],C=g(s({__name:`RecentDirectoriesChat`,props:{dirStatus:{},summary:{},fill:{type:Boolean}},setup(o){let s=o,{theme:c}=_(),d=e(()=>c.value===`dark`?`dark`:`light`),{messages:g,isStreaming:C,pendingQuestion:w,answeringQuestion:T,sendMessage:E,answerQuestion:D,newSession:O,stop:k}=b(),A=v(),j=e(()=>[{id:`priority`,label:h(`@13D1C:这些项目该先处理哪个?`),prompt:h(`@13D1C:这些项目里该先处理哪个?按优先级给我一个处理顺序,并说明每一项该做什么。`)},{id:`behind`,label:h(`@13D1C:哪些项目落后远端?`),prompt:h(`@13D1C:哪些项目落后远端?分别落后多少个提交?`)},{id:`pull-behind`,label:h(`@13D1C:落后远端的都帮我 pull 下代码`),prompt:h(`@13D1C:落后远端的项目都帮我 pull 下代码,逐个执行并汇报结果。`)},{id:`uncommitted`,label:h(`@13D1C:看一下各项目未提交的都改了什么`),prompt:h(`@13D1C:看一下各项目未提交的改动都改了什么,按项目列出来。`)}]);async function M(e){await E(e.text,e.files,{engine:`gai`,dirStatus:s.dirStatus,dirSummary:s.summary})}async function N(e){await M({text:e.prompt,files:[]})}function P(){k(),O()}return r(()=>{k()}),(e,r)=>(u(),t(`div`,{class:i([`dir-chat`,{"dir-chat--fill":o.fill}])},[p(g).length?(u(),t(`div`,x,[f(`button`,{type:`button`,class:`dir-chat__new`,title:p(h)(`@13D1C:新建对话,当前会话会保留`),"aria-label":p(h)(`@13D1C:新建对话`),onClick:P},[r[0]||=f(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[f(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),f(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})],-1),f(`span`,null,l(p(h)(`@13D1C:新建对话`)),1)],8,S)])):n(``,!0),a(p(m),{messages:p(g),"assistant-name":p(y),theme:d.value,disabled:p(C),generating:p(C),"show-avatar":!1,"upload-config":{enabled:!1},placeholder:p(C)?p(h)(`@13D1C:g ai 正在回答...`):p(h)(`@13D1C:追问 g ai:这批项目该怎么处理?`),"welcome-title":p(h)(`@13D1C:可以接着问 g ai`),"welcome-description":p(h)(`@13D1C:它已经拿到了这批目录的 Git 状态,可以直接问该先处理哪个、某个项目落后了什么。`),"preset-questions":j.value,question:p(w),"question-submitting":p(T),"question-labels":p(A),"plan-config":{labels:{title:p(h)(`@AGENT:计划`),raw:p(h)(`@AGENT:原始参数`)}},onSend:M,onSelect:N,onStop:p(k),onAnswer:p(D)},null,8,[`messages`,`assistant-name`,`theme`,`disabled`,`generating`,`placeholder`,`welcome-title`,`welcome-description`,`preset-questions`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onStop`,`onAnswer`])],2))}}),[[`__scopeId`,`data-v-6da5fad8`]]);export{C as default};
|