zcode-pro 0.20.3 → 1.0.0

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.
@@ -38,6 +38,39 @@ export async function getConfig(force = false) {
38
38
  }
39
39
  export function clearConfigCache() { configCache = { value: null, at: 0 }; }
40
40
 
41
+ // —— ZCode 版本判断(按官方版本启用/停用功能)——
42
+ // 版本来源:启动器从 app.asar 读出后写进 bootstrap(window.__ZCODEPRO__.zcodeVersion),
43
+ // helper 的 /config 响应也附加同名字段。读不到时为空串,各判断保持旧行为。
44
+ export function zcodeAppVersion() {
45
+ const v = liveBoot().zcodeVersion;
46
+ return typeof v === 'string' && v ? v : '';
47
+ }
48
+
49
+ export function zcodeVersionGte(version, major, minor, patch = 0) {
50
+ const m = String(version || '').match(/^(\d+)\.(\d+)\.(\d+)/);
51
+ if (!m) return false;
52
+ const a = Number(m[1]), b = Number(m[2]), c = Number(m[3]);
53
+ return a > major || (a === major && (b > minor || (b === minor && c >= patch)));
54
+ }
55
+
56
+ // 官方“编辑项目”(修改项目名称 + 多文件夹)自 3.16.1 起提供
57
+ export function officialRenameSupported() {
58
+ return zcodeVersionGte(zcodeAppVersion(), 3, 16, 1);
59
+ }
60
+
61
+ // 新侧栏检测(3.16.1 起“虚拟项目”重构,workspace-item 系列节点已下线):
62
+ // 版本 >= 3.16.1,或页面出现 section[data-project-id] 项目行(覆盖版本读不到的
63
+ // 构建)。一旦命中即记住——同一会话内侧栏不会退回旧结构。
64
+ let newSidebarCached = false;
65
+ export function isNewProjectSidebar() {
66
+ if (newSidebarCached) return true;
67
+ if (officialRenameSupported()) { newSidebarCached = true; return true; }
68
+ try {
69
+ if (document.querySelector('section[data-project-id]')) { newSidebarCached = true; return true; }
70
+ } catch { /* ignore */ }
71
+ return false;
72
+ }
73
+
41
74
  const zh = {
42
75
  settingsTitle: 'ZCode Pro',
43
76
  tabFeatures: '功能',
@@ -84,7 +117,7 @@ const zh = {
84
117
  syncRecLink: '坚果云 WebDAV',
85
118
  syncRecSuffix: ':登录与密码填“应用密码”,不是账号密码。',
86
119
  syncIncludeZcp: 'ZCode Pro 设置',
87
- syncIncludeZcpDesc: '功能开关、样式调整、项目别名与代理设置;同步配置与凭据本身不参与同步。',
120
+ syncIncludeZcpDesc: '功能开关、样式调整与代理设置;同步配置与凭据本身不参与同步。项目别名不同步(官方已支持改项目名)。',
88
121
  syncIncludeModel: '模型设置',
89
122
  syncIncludeModelDesc: '自定义供应商与模型配置(config.json 与 provider_config.json,含 API Key)。账号登录的凭据(如 BigModel 订阅)不参与同步,各机器用各自账号登录。',
90
123
  syncUpload: '上传到云端',
@@ -184,8 +217,8 @@ const zh = {
184
217
  titleGenTesting: '生成中…',
185
218
  titleGenTestOk: '生成结果:',
186
219
  titleGenTestFailed: '生成失败',
187
- featureWsRunning: '折叠项目运行提示(实验性)',
188
- featureWsRunningDesc: '折叠的项目里仍有会话在运行时,项目图标旋转提示;全部结束或展开项目后恢复。期间每 60 秒在后台短暂展开该项目复核运行状态再收起,会话行不显示,仅项目位置可能有约四分之一秒的轻微高度起伏。',
220
+ featureWsRunning: '折叠时任务运行中提示',
221
+ featureWsRunningDesc: '有会话在运行时,折叠的项目与“任务”“已置顶”等分区头显示与任务运行中同款的加载图标,全部结束后消失;3.16.1 之前每 60 秒会在后台短暂展开项目复核再收起。',
189
222
  tabPerformance: '性能',
190
223
  perfDesc: 'ZCode 为每个打开过的项目常驻一个会话进程,应用自身不会回收,项目多了内存占用就高。开启后,长时间未使用且没有任务在跑的项目会被自动释放:会话记录不受影响,再次打开时自动恢复,仅首次回复有几秒等待。正在使用的项目、运行中的会话与后台命令、定时任务都不会被回收。后台命令检测依赖系统进程信息(Linux / macOS / Windows 各走系统自带工具),检测不可用时功能自动停用。',
191
224
  featureIdleReclaim: '空闲项目内存回收',
@@ -225,17 +258,16 @@ const zh = {
225
258
  imageCopied: '图片已复制到剪贴板',
226
259
  imageCopyFailed: '复制图片失败',
227
260
  openFolderItem: '打开文件夹',
261
+ openFolderPrimary: '主目录',
228
262
  copyPathItem: '复制路径',
229
263
  pathCopied: '路径已复制到剪贴板',
230
264
  pathCopyFailed: '复制路径失败',
231
265
  fileOpenDefault: '默认应用打开',
232
266
  fileReveal: '打开所在目录',
233
- featurePinnedExpand: '置顶会话保持项目折叠(实验性)',
234
- featurePinnedExpandDesc: '点击折叠项目的置顶会话后将其保持折叠。受限于应用机制,项目会先短暂展开再缩起。',
235
- featureAutoUpdatePlugins: '自动更新 zcode-plugins 插件',
236
- featureAutoUpdatePluginsDesc: '启动时自动检查并更新已安装的 zcode-plugins 插件(只升级不安装,卸载不会被撤销),更新在新会话生效。',
237
- pluginsUpdateTitle: '插件更新 · zcode-plugins',
238
- pluginsCheckNow: '检查并更新',
267
+ featureAutoUpdatePlugins: '自动更新',
268
+ featureAutoUpdatePluginsRepo: 'duanluan/zcode-plugins',
269
+ featureAutoUpdatePluginsDesc: '',
270
+ pluginsCheckNow: '检查更新',
239
271
  pluginsUpdating: '正在更新插件…',
240
272
  pluginsUpToDate: '插件已是最新',
241
273
  pluginsUpdatesFound: '{n} 个插件可更新',
@@ -313,6 +345,8 @@ const zh = {
313
345
  hrUsageNone: '当前没有走 headroom 的供应商,未切换',
314
346
  headroomLoadFailed: '读取 Headroom 配置失败',
315
347
  headroomStatusTitle: '运行状态',
348
+ hrInstRunning: '运行中',
349
+ hrInstStopped: '未运行',
316
350
  headroomStatusLoadFailed: '读取运行状态失败',
317
351
  headroomProxyUp: '代理运行中',
318
352
  headroomProxyDown: '代理未运行',
@@ -378,6 +412,30 @@ const zh = {
378
412
  aliasSaved: '别名已更新',
379
413
  aliasCleared: '已恢复真实名称',
380
414
  aliasHint: '磁盘目录名不变:终端、文件管理器与其他引用真实路径的界面仍显示原名。',
415
+ featureProjectMenuDescNew: '项目“更多”菜单中的切换文件夹、打开文件夹与复制路径。官方已支持修改项目名称(编辑项目),自定义别名已停用。',
416
+ aliasMigrateTitle: '迁移项目别名',
417
+ aliasMigrateDesc: '当前 ZCode 已支持修改项目名称(项目“更多”菜单 → 编辑项目),自定义别名功能已停用。可把已保存的别名写入官方项目名称,勾选要迁移的项目;迁移只改项目名称,磁盘目录不受影响。',
418
+ aliasMigrateItemHint: '迁移后将作为项目名称保存(可随时在“编辑项目”中再改)。仅无标记的条目可勾选;已迁移、已并入、项目已删除、本机不存在(旧机器路径)以及项目已重命名的都不可勾选——要改这些项目的名字,直接用项目“更多”菜单里的“编辑项目”。',
419
+ aliasMigrateStateDone: '已迁移',
420
+ aliasMigrateStateMerged: '已并入「{name}」',
421
+ aliasMigrateStateDeleted: '项目已删除',
422
+ aliasMigrateStateMissing: '本机不存在',
423
+ aliasMigrateStateRenamed: '项目已重命名',
424
+ aliasMigrateDeadSummary: '已失效 {n} 条(本机不存在 / 项目已删除,多为设置同步带来的旧机器路径)',
425
+ aliasMigrateClearDead: '清除失效条目',
426
+ aliasMigrateDeadCleared: '已清除 {n} 条失效别名',
427
+ aliasMigrateDeadClearFailed: '部分失效别名未能清除,请重试',
428
+ aliasMigrateGo: '迁移所选',
429
+ aliasMigrateRunning: '迁移中…',
430
+ aliasMigrateProgress: '正在迁移 {i}/{n}:{name}',
431
+ aliasMigrateStateFailed: '失败',
432
+ aliasMigrateSkip: '暂不迁移',
433
+ aliasMigrateDone: '已迁移 {n} 个别名',
434
+ aliasMigratePartial: '{n} 个已迁移,{m} 个未成功;未成功的可稍后在 ZCode Pro 设置中重试',
435
+ aliasMigrateAllFailed: '别名迁移未成功,可稍后在 ZCode Pro 设置中重试',
436
+ aliasMigrateCardName: '别名迁移',
437
+ aliasMigrateCardDesc: '官方已支持修改项目名称,还有 {n} 个自定义别名未迁移。',
438
+ aliasMigrateRun: '迁移',
381
439
  taskOrderSaved: '顺序已更新',
382
440
  qqGroupTitle: 'QQ 群:428403354',
383
441
  qqGroupDesc: '问题反馈与交流',
@@ -450,7 +508,7 @@ const en = {
450
508
  syncRecLink: 'Jianguoyun WebDAV',
451
509
  syncRecSuffix: ' — use the app password, not your account password.',
452
510
  syncIncludeZcp: 'ZCode Pro settings',
453
- syncIncludeZcpDesc: 'Feature toggles, style adjustments, project aliases and the proxy setting; the sync config and credentials themselves are never synced.',
511
+ syncIncludeZcpDesc: 'Feature toggles, style adjustments and the proxy setting; the sync config and credentials themselves are never synced. Project aliases are not synced (renaming is built in now).',
454
512
  syncIncludeModel: 'Model settings',
455
513
  syncIncludeModelDesc: 'Custom providers and model config (config.json and provider_config.json, API keys included). Account sign-in credentials (e.g. the BigModel subscription) are not synced; each computer signs in with its own account.',
456
514
  syncUpload: 'Upload',
@@ -550,8 +608,8 @@ const en = {
550
608
  titleGenTesting: 'Generating…',
551
609
  titleGenTestOk: 'Result: ',
552
610
  titleGenTestFailed: 'Generation failed',
553
- featureWsRunning: 'Running indicator on collapsed projects (experimental)',
554
- featureWsRunningDesc: 'Spins a collapsed project\'s icon while any of its sessions is still running; stops when they all finish or the project is expanded. While spinning, the project is briefly re-expanded in the background every 60 s to re-check and then collapsed — rows stay hidden, with only a subtle quarter-second height ripple at the project.',
611
+ featureWsRunning: 'Running indicator when collapsed',
612
+ featureWsRunningDesc: 'Shows the same spinning loader as running tasks on collapsed projects and on section headers (“Tasks”, “Pinned”) while any session is running; clears when they all finish. Before ZCode 3.16.1 the project is briefly re-expanded in the background every 60 s to re-check.',
555
613
  tabPerformance: 'Performance',
556
614
  perfDesc: 'ZCode keeps a session process resident for every project you have opened and never reclaims it, so memory grows with projects. When enabled, projects unused for a while with nothing running release their memory automatically: sessions are untouched and reload when reopened, with a few seconds wait on the first reply. The project in use, running sessions, background commands and scheduled tasks are never reclaimed. Background-command detection reads system process info via built-in tools (Linux / macOS / Windows); when unavailable, the feature disables itself.',
557
615
  featureIdleReclaim: 'Idle project memory reclaim',
@@ -591,17 +649,16 @@ const en = {
591
649
  imageCopied: 'Image copied to the clipboard.',
592
650
  imageCopyFailed: 'Failed to copy the image.',
593
651
  openFolderItem: 'Open folder',
652
+ openFolderPrimary: 'primary',
594
653
  copyPathItem: 'Copy path',
595
654
  pathCopied: 'Path copied to the clipboard.',
596
655
  pathCopyFailed: 'Failed to copy the path.',
597
656
  fileOpenDefault: 'Open with default app',
598
657
  fileReveal: 'Reveal in file manager',
599
- featurePinnedExpand: 'Keep projects collapsed for pinned sessions (experimental)',
600
- featurePinnedExpandDesc: 'Keeps the project collapsed after clicking a pinned session. Note: it briefly expands first, then collapses.',
601
- featureAutoUpdatePlugins: 'Auto-update zcode-plugins plugins',
602
- featureAutoUpdatePluginsDesc: 'Checks and updates installed zcode-plugins plugins on startup (updates only — never installs; uninstalled plugins stay uninstalled). Updates apply to new sessions.',
603
- pluginsUpdateTitle: 'Plugin updates · zcode-plugins',
604
- pluginsCheckNow: 'Check & update',
658
+ featureAutoUpdatePlugins: 'Auto-update',
659
+ featureAutoUpdatePluginsRepo: 'duanluan/zcode-plugins',
660
+ featureAutoUpdatePluginsDesc: '',
661
+ pluginsCheckNow: 'Check for updates',
605
662
  pluginsUpdating: 'Updating plugins…',
606
663
  pluginsUpToDate: 'Plugins are up to date',
607
664
  pluginsUpdatesFound: '{n} plugin(s) can be updated',
@@ -679,6 +736,8 @@ const en = {
679
736
  hrUsageNone: 'No providers route through headroom; nothing changed',
680
737
  headroomLoadFailed: 'Failed to load the Headroom config',
681
738
  headroomStatusTitle: 'Status',
739
+ hrInstRunning: 'running',
740
+ hrInstStopped: 'down',
682
741
  headroomStatusLoadFailed: 'Failed to load the status',
683
742
  headroomProxyUp: 'Proxy running',
684
743
  headroomProxyDown: 'Proxy down',
@@ -744,6 +803,30 @@ const en = {
744
803
  aliasSaved: 'Alias updated.',
745
804
  aliasCleared: 'Real name restored.',
746
805
  aliasHint: 'The directory name on disk is unchanged: terminals, file managers and other path-based UI still show the real name.',
806
+ featureProjectMenuDescNew: 'Switch folder, open folder and copy path in the project "More" menu. Renaming is built in since ZCode 3.16.1 ("Edit project"), so the custom alias is retired.',
807
+ aliasMigrateTitle: 'Migrate project aliases',
808
+ aliasMigrateDesc: 'This ZCode supports renaming projects (project "More" menu → Edit project), so the custom alias feature is retired. Write your saved aliases into the official project names by picking the projects below; only the project name changes, folders on disk are untouched.',
809
+ aliasMigrateItemHint: 'The alias becomes the project name (re-editable anytime via "Edit project"). Only unmarked entries can be checked; migrated, merged, deleted, not-on-this-machine and manually-renamed ones cannot — to rename those projects, use "Edit project" in the project "More" menu directly.',
810
+ aliasMigrateStateDone: 'Migrated',
811
+ aliasMigrateStateMerged: 'Merged into "{name}"',
812
+ aliasMigrateStateDeleted: 'Project deleted',
813
+ aliasMigrateStateMissing: 'Not on this machine',
814
+ aliasMigrateStateRenamed: 'Project renamed',
815
+ aliasMigrateDeadSummary: '{n} stale entries (not on this machine / project deleted — usually old-machine paths from settings sync)',
816
+ aliasMigrateClearDead: 'Clear stale entries',
817
+ aliasMigrateDeadCleared: 'Removed {n} stale alias(es)',
818
+ aliasMigrateDeadClearFailed: 'Some stale aliases could not be removed; please retry',
819
+ aliasMigrateGo: 'Migrate selected',
820
+ aliasMigrateRunning: 'Migrating…',
821
+ aliasMigrateProgress: 'Migrating {i}/{n}: {name}',
822
+ aliasMigrateStateFailed: 'Failed',
823
+ aliasMigrateSkip: 'Not now',
824
+ aliasMigrateDone: 'Migrated {n} alias(es)',
825
+ aliasMigratePartial: '{n} migrated, {m} failed; retry the rest later in ZCode Pro settings',
826
+ aliasMigrateAllFailed: 'Alias migration failed; retry later in ZCode Pro settings',
827
+ aliasMigrateCardName: 'Alias migration',
828
+ aliasMigrateCardDesc: 'Project renaming is built in now; {n} custom alias(es) are not migrated yet.',
829
+ aliasMigrateRun: 'Migrate',
747
830
  taskOrderSaved: 'Order updated.',
748
831
  qqGroupTitle: 'QQ group: 428403354',
749
832
  qqGroupDesc: 'Feedback & discussion',