zen-gitsync 2.16.27 → 2.16.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/package.json +1 -1
  2. package/src/cli/ai/platformGuard.js +200 -200
  3. package/src/cli/ai/platformGuard.test.js +253 -253
  4. package/src/gitCommit.js +484 -484
  5. package/src/ui/public/assets/AgentView-BPYoiHHQ.js +4 -0
  6. package/src/ui/public/assets/AppVersionBadge-AglUMXsb.js +2 -0
  7. package/src/ui/public/assets/BranchSelector--j-mhugr.js +1 -0
  8. package/src/ui/public/assets/CommitForm-BEDpVfax.js +6 -0
  9. package/src/ui/public/assets/CommonDialog-DRv7kVO-.js +1 -0
  10. package/src/ui/public/assets/EditorView-DxTtUCHU.js +1 -0
  11. package/src/ui/public/assets/{FlowExecutionViewer-B7CdeiSp.js → FlowExecutionViewer-DCtEz-v3.js} +1 -1
  12. package/src/ui/public/assets/FlowOrchestrationWorkspace-BzwzDZHa.js +21 -0
  13. package/src/ui/public/assets/LogList-BlJplIi1.css +1 -0
  14. package/src/ui/public/assets/LogList-CGWd23XS.js +7 -0
  15. package/src/ui/public/assets/MindmapView-Bk_OuB2D.js +2 -0
  16. package/src/ui/public/assets/MonitorView-DO3klU0a.js +1 -0
  17. package/src/ui/public/assets/ProjectStartupButton-BnxH4ePw.js +1 -0
  18. package/src/ui/public/assets/{RemoteRepoCard-DJ7ficOj.js → RemoteRepoCard-yrCYwbwI.js} +2 -2
  19. package/src/ui/public/assets/SourceMapView-ByRGqDEd.js +3 -0
  20. package/src/ui/public/assets/{SvgIcon-CL2qPswh.js → SvgIcon-DrzoiBjT.js} +1 -1
  21. package/src/ui/public/assets/UserInputNode-DF0GnNcS.js +1 -0
  22. package/src/ui/public/assets/WorkbenchView-CEoj3Q4T.js +28 -0
  23. package/src/ui/public/assets/{_plugin-vue_export-helper-D3_upOKo.js → _plugin-vue_export-helper-835DU6GA.js} +3 -3
  24. package/src/ui/public/assets/configStore-avjeYt7I.js +1 -0
  25. package/src/ui/public/assets/{css.worker-CvXBzhp8.js → css.worker-Wv5dxAWO.js} +1 -1
  26. package/src/ui/public/assets/{dagre-CWIGcX9d.js → dagre-CyRyf1aT.js} +1 -1
  27. package/src/ui/public/assets/element-plus--ayTjGvF.js +25 -0
  28. package/src/ui/public/assets/element-plus-D3Dn7nX0.css +1 -0
  29. package/src/ui/public/assets/{flow-mindmap-B5aqOviR.js → flow-mindmap-BcBVGR99.js} +38 -38
  30. package/src/ui/public/assets/{html.worker-BO6WuOEO.js → html.worker-CQP8QQsS.js} +1 -1
  31. package/src/ui/public/assets/index-CNYOMYpP.js +71 -0
  32. package/src/ui/public/assets/{json.worker-BkJRGcCJ.js → json.worker-DzV-CpCQ.js} +1 -1
  33. package/src/ui/public/assets/{monaco-BFLoT2VD.js → monaco-43aputPh.js} +198 -198
  34. package/src/ui/public/assets/socket-io-BZIzo1US.js +1 -0
  35. package/src/ui/public/assets/toolsStore-B2zt5KJ0.js +1 -0
  36. package/src/ui/public/assets/{ts.worker-B0J26iPs.js → ts.worker-Dth06zuC.js} +15 -15
  37. package/src/ui/public/assets/{vendor-Cx8PA1NP.js → vendor-Dan_vdyX.js} +14 -14
  38. package/src/ui/public/assets/{vue-flow-COROsN-V.js → vue-flow-CUR1dbQb.js} +2 -2
  39. package/src/ui/public/favicon.svg +75 -75
  40. package/src/ui/public/index.html +31 -31
  41. package/src/ui/public/logo.svg +74 -74
  42. package/src/ui/server/middleware/requestLogger.js +53 -53
  43. package/src/ui/server/routes/branchStatus.js +105 -105
  44. package/src/ui/server/routes/fileOpen.js +53 -1
  45. package/src/ui/server/routes/git/diff.js +426 -426
  46. package/src/ui/server/routes/git/diffUtils.js +149 -149
  47. package/src/ui/server/routes/git/stash.js +550 -550
  48. package/src/ui/server/routes/git/tags.js +176 -176
  49. package/src/ui/server/routes/process.js +86 -86
  50. package/src/ui/server/routes/status.js +67 -67
  51. package/src/ui/server/routes/workbench/pdfText.js +145 -145
  52. package/src/ui/server/utils/createSavePortToFile.js +48 -48
  53. package/src/ui/server/utils/instanceRegistry.js +282 -282
  54. package/src/ui/server/utils/startServerOnAvailablePort.js +116 -116
  55. package/src/ui/public/assets/AgentView-Bytr0HbV.js +0 -4
  56. package/src/ui/public/assets/AppVersionBadge-BW4vXJxH.js +0 -2
  57. package/src/ui/public/assets/BranchSelector-DsLQi1AR.js +0 -1
  58. package/src/ui/public/assets/CommitForm-CmmxW73q.js +0 -6
  59. package/src/ui/public/assets/CommonDialog-CQz6iEqp.js +0 -1
  60. package/src/ui/public/assets/EditorView-CtygNTuz.js +0 -1
  61. package/src/ui/public/assets/FlowOrchestrationWorkspace-DtTItIzf.js +0 -21
  62. package/src/ui/public/assets/LogList-Bo53PBwg.css +0 -1
  63. package/src/ui/public/assets/LogList-Cwem9ONv.js +0 -7
  64. package/src/ui/public/assets/MindmapView-DR5bT_oQ.js +0 -2
  65. package/src/ui/public/assets/MonitorView-DoLNabxl.js +0 -1
  66. package/src/ui/public/assets/ProjectStartupButton-BiNiH43W.js +0 -1
  67. package/src/ui/public/assets/SourceMapView-CSVCaU8d.js +0 -3
  68. package/src/ui/public/assets/UserInputNode-BftMuqji.js +0 -1
  69. package/src/ui/public/assets/WorkbenchView-Cl9H5uXg.js +0 -28
  70. package/src/ui/public/assets/configStore-Cqnbpz5-.js +0 -1
  71. package/src/ui/public/assets/element-plus-B3pTS_5R.js +0 -32
  72. package/src/ui/public/assets/element-plus-CQrjg9us.css +0 -1
  73. package/src/ui/public/assets/index-D89M9m30.js +0 -71
  74. package/src/ui/public/assets/socket-io-Bcae2P7B.js +0 -1
  75. package/src/ui/public/assets/toolsStore-RkALTxME.js +0 -1
  76. package/src/ui/server/.claude/codediff.txt +0 -8
  77. /package/src/ui/public/assets/{editor.worker-Cn2oRESe.js → editor.worker-Bd9IXS8d.js} +0 -0
  78. /package/src/ui/public/assets/{rolldown-runtime-CMxvf4Kt.js → rolldown-runtime-BM3Ffeng.js} +0 -0
@@ -1,105 +1,105 @@
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
- import { asyncRoute, HttpError } from '../utils/asyncRoute.js'
16
-
17
- import logger from '../utils/logger.js'
18
-
19
- export function registerBranchStatusRoutes({
20
- app,
21
- execGitCommand,
22
- getIsGitRepo,
23
- getBranchStatusCache,
24
- setBranchStatusCache,
25
- getRecentPushStatus,
26
- setRecentPushStatus
27
- }) {
28
- // 获取当前分支 - 直接读取,不缓存(git symbolic-ref 极快,<5ms)
29
- app.get('/api/branch', asyncRoute(async (req, res) => {
30
- try {
31
- const { stdout } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
32
- res.json({ branch: stdout.trim() });
33
- } catch (error) {
34
- res.status(500).json({ error: error.message });
35
- }
36
- }));
37
-
38
- // 获取分支与远程的差异状态(领先/落后提交数)
39
- app.get('/api/branch-status', asyncRoute(async (req, res) => {
40
- try {
41
- if (!getIsGitRepo()) {
42
- return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
43
- }
44
-
45
- const now = Date.now();
46
- const forceRefresh = req.query.force === 'true';
47
-
48
- const recentPushStatus = getRecentPushStatus();
49
- const branchStatusCache = getBranchStatusCache();
50
-
51
- // push 后10秒内直接返回同步状态
52
- if (recentPushStatus.justPushed &&
53
- (now - recentPushStatus.pushTime) < recentPushStatus.validDuration) {
54
- logger.info('检测到最近推送过,直接返回同步状态');
55
- return res.json({
56
- hasUpstream: true,
57
- upstreamBranch: branchStatusCache.upstreamBranch || 'origin/main',
58
- ahead: 0,
59
- behind: 0
60
- });
61
- }
62
-
63
- // 5秒缓存分支名,防止短时间内重复执行 git symbolic-ref / git rev-parse
64
- const branchInfoCacheValid = !forceRefresh &&
65
- branchStatusCache.currentBranch &&
66
- branchStatusCache.upstreamBranch &&
67
- (now - branchStatusCache.lastUpdate) < branchStatusCache.cacheTimeout;
68
-
69
- let currentBranch, upstreamBranch;
70
-
71
- if (branchInfoCacheValid) {
72
- currentBranch = branchStatusCache.currentBranch;
73
- upstreamBranch = branchStatusCache.upstreamBranch;
74
- logger.info(`使用5秒缓存的分支名: ${currentBranch} -> ${upstreamBranch}`);
75
- } else {
76
- // 直接读取,不再走5分钟长缓存
77
- const { stdout: branchOut } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
78
- currentBranch = branchOut.trim();
79
-
80
- const { stdout: upstreamOut } = await execGitCommand(
81
- ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'],
82
- { ignoreError: true }
83
- );
84
- upstreamBranch = upstreamOut.trim() || null;
85
-
86
- if (!upstreamBranch) {
87
- setBranchStatusCache({ currentBranch: null, upstreamBranch: null, lastUpdate: 0, cacheTimeout: 5000 });
88
- return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
89
- }
90
-
91
- setBranchStatusCache({ currentBranch, upstreamBranch, lastUpdate: now, cacheTimeout: 5000 });
92
- }
93
-
94
- const { stdout: aheadBehindOutput } = await execGitCommand(
95
- ['rev-list', '--left-right', '--count', `${currentBranch}...${upstreamBranch}`]
96
- );
97
- const [ahead, behind] = aheadBehindOutput.trim().split('\t').map(Number);
98
-
99
- res.json({ hasUpstream: true, upstreamBranch, ahead, behind });
100
- } catch (error) {
101
- logger.error('获取分支状态失败:', error);
102
- res.status(500).json({ error: error.message });
103
- }
104
- }));
105
- }
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
+ import { asyncRoute, HttpError } from '../utils/asyncRoute.js'
16
+
17
+ import logger from '../utils/logger.js'
18
+
19
+ export function registerBranchStatusRoutes({
20
+ app,
21
+ execGitCommand,
22
+ getIsGitRepo,
23
+ getBranchStatusCache,
24
+ setBranchStatusCache,
25
+ getRecentPushStatus,
26
+ setRecentPushStatus
27
+ }) {
28
+ // 获取当前分支 - 直接读取,不缓存(git symbolic-ref 极快,<5ms)
29
+ app.get('/api/branch', asyncRoute(async (req, res) => {
30
+ try {
31
+ const { stdout } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
32
+ res.json({ branch: stdout.trim() });
33
+ } catch (error) {
34
+ res.status(500).json({ error: error.message });
35
+ }
36
+ }));
37
+
38
+ // 获取分支与远程的差异状态(领先/落后提交数)
39
+ app.get('/api/branch-status', asyncRoute(async (req, res) => {
40
+ try {
41
+ if (!getIsGitRepo()) {
42
+ return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
43
+ }
44
+
45
+ const now = Date.now();
46
+ const forceRefresh = req.query.force === 'true';
47
+
48
+ const recentPushStatus = getRecentPushStatus();
49
+ const branchStatusCache = getBranchStatusCache();
50
+
51
+ // push 后10秒内直接返回同步状态
52
+ if (recentPushStatus.justPushed &&
53
+ (now - recentPushStatus.pushTime) < recentPushStatus.validDuration) {
54
+ logger.info('检测到最近推送过,直接返回同步状态');
55
+ return res.json({
56
+ hasUpstream: true,
57
+ upstreamBranch: branchStatusCache.upstreamBranch || 'origin/main',
58
+ ahead: 0,
59
+ behind: 0
60
+ });
61
+ }
62
+
63
+ // 5秒缓存分支名,防止短时间内重复执行 git symbolic-ref / git rev-parse
64
+ const branchInfoCacheValid = !forceRefresh &&
65
+ branchStatusCache.currentBranch &&
66
+ branchStatusCache.upstreamBranch &&
67
+ (now - branchStatusCache.lastUpdate) < branchStatusCache.cacheTimeout;
68
+
69
+ let currentBranch, upstreamBranch;
70
+
71
+ if (branchInfoCacheValid) {
72
+ currentBranch = branchStatusCache.currentBranch;
73
+ upstreamBranch = branchStatusCache.upstreamBranch;
74
+ logger.info(`使用5秒缓存的分支名: ${currentBranch} -> ${upstreamBranch}`);
75
+ } else {
76
+ // 直接读取,不再走5分钟长缓存
77
+ const { stdout: branchOut } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
78
+ currentBranch = branchOut.trim();
79
+
80
+ const { stdout: upstreamOut } = await execGitCommand(
81
+ ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'],
82
+ { ignoreError: true }
83
+ );
84
+ upstreamBranch = upstreamOut.trim() || null;
85
+
86
+ if (!upstreamBranch) {
87
+ setBranchStatusCache({ currentBranch: null, upstreamBranch: null, lastUpdate: 0, cacheTimeout: 5000 });
88
+ return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
89
+ }
90
+
91
+ setBranchStatusCache({ currentBranch, upstreamBranch, lastUpdate: now, cacheTimeout: 5000 });
92
+ }
93
+
94
+ const { stdout: aheadBehindOutput } = await execGitCommand(
95
+ ['rev-list', '--left-right', '--count', `${currentBranch}...${upstreamBranch}`]
96
+ );
97
+ const [ahead, behind] = aheadBehindOutput.trim().split('\t').map(Number);
98
+
99
+ res.json({ hasUpstream: true, upstreamBranch, ahead, behind });
100
+ } catch (error) {
101
+ logger.error('获取分支状态失败:', error);
102
+ res.status(500).json({ error: error.message });
103
+ }
104
+ }));
105
+ }
@@ -22,6 +22,7 @@ const TOOL_INSTALL_PACKAGES = Object.freeze({
22
22
  claude: '@anthropic-ai/claude-code',
23
23
  codex: '@openai/codex',
24
24
  opencode: 'opencode-ai',
25
+ dsh: '@deepseek-ai/dsh',
25
26
  });
26
27
 
27
28
  const TOOL_DOCS_URLS = Object.freeze({
@@ -31,6 +32,7 @@ const TOOL_DOCS_URLS = Object.freeze({
31
32
  opencode: 'https://opencode.ai/docs',
32
33
  kimi: 'https://moonshotai.github.io/kimi-code/en/guides/getting-started',
33
34
  zcode: 'https://zcode.z.ai/',
35
+ dsh: 'https://github.com/deepseek-ai/deepseek-harness',
34
36
  });
35
37
 
36
38
  function commandExists(command, platform = process.platform) {
@@ -265,6 +267,41 @@ async function launchKimiCode(dirPath) {
265
267
  return launchInTerminal(dirPath, 'kimi');
266
268
  }
267
269
 
270
+ async function launchDsh(dirPath) {
271
+ const executable = await findDshExecutable();
272
+ if (!executable) throw new Error('未检测到 DeepSeek Harness,请先全局安装 dsh CLI');
273
+ if (process.platform === 'win32') {
274
+ // 编码 PowerShell 命令,避免 cmd start 对 dsh.cmd 完整路径中的引号进行二次解析。
275
+ const escapedExecutable = executable.replace(/'/g, "''");
276
+ const script = `& '${escapedExecutable}' web`;
277
+ const encoded = Buffer.from(script, 'utf16le').toString('base64');
278
+ return spawnDetached('cmd.exe', [
279
+ '/c', 'start', '""', 'powershell.exe', '-NoLogo', '-NoExit',
280
+ '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encoded,
281
+ ], { cwd: dirPath });
282
+ }
283
+ return launchInTerminal(dirPath, executable, ['web']);
284
+ }
285
+
286
+ async function findDshExecutable() {
287
+ if (process.platform !== 'win32') return commandExists('dsh') ? 'dsh' : null;
288
+
289
+ const candidates = [path.join(process.env.APPDATA || '', 'npm', 'dsh.cmd')];
290
+ const npmPrefix = spawnSync('npm.cmd', ['prefix', '-g'], {
291
+ encoding: 'utf8',
292
+ windowsHide: true,
293
+ }).stdout?.trim();
294
+ if (npmPrefix) candidates.push(path.join(npmPrefix, 'dsh.cmd'));
295
+
296
+ for (const candidate of candidates.filter(Boolean)) {
297
+ try {
298
+ const stat = await fs.stat(candidate);
299
+ if (stat.isFile()) return candidate;
300
+ } catch {}
301
+ }
302
+ return null;
303
+ }
304
+
268
305
  async function findKimiExecutable() {
269
306
  if (process.platform !== 'win32') return commandExists('kimi') ? 'kimi' : null;
270
307
 
@@ -669,6 +706,19 @@ export function registerFileOpenRoutes({
669
706
  }
670
707
  }));
671
708
 
709
+ // 用 DeepSeek Harness 打开目录
710
+ app.post('/api/open-directory-with-dsh', asyncRoute(async (req, res) => {
711
+ const { path: dirPath } = req.body || {};
712
+ if (!dirPath) throw new HttpError(400, '目录路径不能为空');
713
+ try {
714
+ await fs.access(dirPath);
715
+ await launchDsh(dirPath);
716
+ res.json({ success: true, message: '已启动 DeepSeek Harness' });
717
+ } catch (error) {
718
+ res.status(400).json({ success: false, error: error.message || '无法启动 DeepSeek Harness,请确认已安装 Node.js' });
719
+ }
720
+ }));
721
+
672
722
  // 用 ZCode 打开目录
673
723
  app.post('/api/open-directory-with-zcode', asyncRoute(async (req, res) => {
674
724
  const { path: dirPath } = req.body || {};
@@ -725,13 +775,14 @@ export function registerFileOpenRoutes({
725
775
  setTimeout(() => finish(false), 15000);
726
776
  });
727
777
 
728
- const [vscode, claude, codex, opencode, kimiExecutable, zcodeExecutable] = await Promise.all([
778
+ const [vscode, claude, codex, opencode, kimiExecutable, zcodeExecutable, dshExecutable] = await Promise.all([
729
779
  checkCmd('code'),
730
780
  checkCmd('claude'),
731
781
  checkCmd('codex'),
732
782
  checkCmd('opencode'),
733
783
  findKimiExecutable(),
734
784
  findZCodeExecutable(),
785
+ findDshExecutable(),
735
786
  ]);
736
787
 
737
788
  const installers = getToolInstallers();
@@ -745,6 +796,7 @@ export function registerFileOpenRoutes({
745
796
  opencode,
746
797
  kimi: !!kimiExecutable,
747
798
  zcode: !!zcodeExecutable,
799
+ dsh: !!dshExecutable,
748
800
  });
749
801
  }));
750
802
  }