dsh-paoding 0.4.1 → 0.4.2
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
CHANGED
|
@@ -22,7 +22,7 @@ dsh-paoding(中文品牌「庖丁」,典出《庄子》——庖丁顺纹理
|
|
|
22
22
|
- **保存前先体检**:预览/应用时自动过一遍检查——配置了但未挂载的工具、零工具角色、查无此名的模型、预设落后于配置,分级提示一目了然;CLI 侧 `dsh-paoding doctor` 六项只读自检(配置可解析、安装轨道、声明行托管块、孤儿目录、版本标记、预设漂移),一条命令查全身。
|
|
23
23
|
- **场景模板一键换班底**:轻量(只留实现)、调研(只留检索)、全开(全员到齐、主 agent 带满检测库存)三档点一下就切,只动「谁在场 + 主 agent 额外带什么」,精调过的角色配置分毫不动。
|
|
24
24
|
- **配置可导出可导入**:面板「更多」菜单一键下载 `dsh-paoding.config.yml`,换机迁移、备份整份拷走;导入先验格式,覆盖整体配置(含工作区段)需二次确认。
|
|
25
|
-
- **面板中英双语**:界面文案 zh/en
|
|
25
|
+
- **面板中英双语**:界面文案 zh/en 全覆盖,语言自动识别(显式选择 → 中文信号优先:浏览器语言、宿主页面语言、中文时区),「更多」菜单一键切换并记住。
|
|
26
26
|
- **版本更新有提醒,面板一键升级**:面板会对比 npm registry(npmmirror 镜像、GitHub release 依次兜底)上的最新版本,发现新版就地提示并附上发布页链接;点「升级」就地换上新版(profile 自动探测:普通 profile 走 `dsh plugin update dsh-paoding`;desktop profile 被 dsh CLI 的 Electron 专属守卫挡住,改在 profile 目录直跑 `pnpm add dsh-paoding@<版本>`),重启 DSH 后生效,编排预设会在重启时按新版自动重生成。开发检出的 link 形态无法就地升级,面板会提示切回 registry 版的办法;检测失败时页头留一行「版本检测失败 · 重试」(完整原因与代理排查提示在悬浮提示里),不弹窗打扰。
|
|
27
27
|
- **来去自由**:不改 DSH 一行源码;装完新会话即用,卸载即删目录。
|
|
28
28
|
- **两代宿主都兼容**:DSH 0.1.5 – 0.2.0-rc.2 全支持(0.1.5 / 0.1.6 / 0.1.7-rc.1 / 0.1.7-rc.2 / 0.2.0-rc.1 / 0.2.0-rc.2)——两代宿主发现预设的机制不同(目录扫描 vs patch 声明行),安装器自动检测宿主版本选对落点;编排组合里的 workflow worker 行也按宿主版本自动适配(0.1.5 用 workflow-worker-thread,0.1.6+ 换 workflow-ptc——旧包 0.1.6 起已删除,残留行正是 0.2.0 面板上「加载失败」的元凶),宿主升级、降级后的首次保存/自愈自动迁移,全程无感。
|
package/README_en.md
CHANGED
|
@@ -22,7 +22,7 @@ dsh-paoding (Chinese brand 「庖丁」/ Pao Ding, from the Zhuangzi parable of
|
|
|
22
22
|
- **A health check before every save**: preview/apply runs a built-in check — tools configured but not mounted, zero-tool roles, unknown model names, a preset lagging behind the config — each flagged by severity; on the CLI side, `dsh-paoding doctor` runs six read-only checks (config parses, install track, managed declaration block, orphan directories, version marker, preset drift) in one command.
|
|
23
23
|
- **Scenario templates swap the roster in one click**: Lite (implement only), Research (search roles only), and Full (everyone on deck, main agent carrying the whole detected inventory) — templates only touch who is present and what the main agent carries; hand-tuned role settings are never touched.
|
|
24
24
|
- **Config export & import**: download `dsh-paoding.config.yml` from the panel's More menu for migration or backup; imports are validated first, and overwriting the whole config (workspaces included) asks for confirmation.
|
|
25
|
-
- **Panel in English and Chinese**: every UI string ships in both languages, auto-detected
|
|
25
|
+
- **Panel in English and Chinese**: every UI string ships in both languages, auto-detected (explicit choice first, then Chinese signals — browser language, host page language, Chinese time zones — outrank English ones, since the Electron shell pins navigator to en-US regardless of the OS), switchable from the More menu and remembered.
|
|
26
26
|
- **Notified of new releases, one-click upgrade in the panel**: the panel compares your local version against the latest npm registry publish (npmmirror and GitHub release as successive fallbacks) and points to the release page when a newer one is out. The Upgrade button swaps in the new version in place (profile auto-detected): regular profiles go through `dsh plugin update dsh-paoding`, while the Electron-owned desktop profile — which the dsh CLI guards against — gets a direct `pnpm add dsh-paoding@<version>` run in the profile directory; a DSH restart applies it, and the orchestrator preset regenerates itself against the new version on startup. A dev checkout in link: form cannot be upgraded in place — the panel tells you how to switch back to the registry version. If the check fails (offline, rate-limited), a subdued "version check failed · retry" row stays in the header (full causes and proxy hints in its tooltip) without popping anything up.
|
|
27
27
|
- **Installs and uninstalls cleanly**: no DSH source changes; active in a new session right after install, gone when you delete one directory.
|
|
28
28
|
- **Works on both host generations**: DSH 0.1.5 through 0.2.0-rc.2 are all supported (0.1.5 / 0.1.6 / 0.1.7-rc.1 / 0.1.7-rc.2 / 0.2.0-rc.1 / 0.2.0-rc.2) — the two generations discover presets differently (directory scan vs patch declaration rows), and the installer picks the right landing automatically; from 0.2.0 the workflow worker row in the orchestration composition also adapts to the host version at generation time (0.1.5 uses workflow-worker-thread, 0.1.6+ swaps to workflow-ptc). Migration happens on the first save/self-heal after a host upgrade or downgrade, all without user action.
|
package/package.json
CHANGED
|
@@ -97,9 +97,12 @@ window.__ModuleLoader__.load({
|
|
|
97
97
|
// - t(key, params):按当前语言取文案,params 做 {name} 插值(split/join
|
|
98
98
|
// 而非 replace,避免替换串里的 $ 模式被二次解释)。缺 key 原样返回 key
|
|
99
99
|
// 本身——线上宁可露出 key 也不静默吞掉,测试侧保证不会发生。
|
|
100
|
-
// -
|
|
101
|
-
// navigator.language
|
|
102
|
-
//
|
|
100
|
+
// - 语言解析(zh 信号优先):localStorage "paoding-lang" 显式优先 →
|
|
101
|
+
// navigator.language/languages 与宿主页面 <html lang> 任一带 zh 前缀
|
|
102
|
+
// → zh → 时区属中文地区 → zh → en 前缀命中 → en → 兜底 zh。Electron
|
|
103
|
+
// 外壳会把 navigator 语言钉成应用 locale(常 en-US,不跟操作系统),
|
|
104
|
+
// en 信号不可信而时区可信,故 zh 信号整体压过 en;服务端消息仅中文,
|
|
105
|
+
// 误判 zh(真英文用户点一次 English 即记住)代价远小于误判 en 混排。
|
|
103
106
|
// - 切语言:setLang(lang) 写 localStorage + 同步广播 onLangChange;
|
|
104
107
|
// 监听方各自刷新(86 PageShell 整页重渲染、82 委派行重建标题),面板
|
|
105
108
|
// 数据重拉复用既有 registerReload 通道,不另造机制。
|
|
@@ -113,15 +116,48 @@ window.__ModuleLoader__.load({
|
|
|
113
116
|
// 语言探测:localStorage 显式值优先;其余按 navigator.language 首缀猜 zh,
|
|
114
117
|
// 兜底 en。全程 try/catch——非浏览器/受限环境(vm 测试、老内核)不炸,逐层回落。
|
|
115
118
|
function paodingDetectLang() {
|
|
119
|
+
// zh 信号优先于 en 信号(不是平级链):Electron 外壳会把 navigator
|
|
120
|
+
// 语言钉成应用 locale(常为 en-US,跟打包不跟操作系统),en 命中在
|
|
121
|
+
// 本环境不可信;而本插件服务端消息仅中文,误判 zh 的代价(真英文
|
|
122
|
+
// 用户点一次 English,localStorage 记住)远小于误判 en(中文用户看
|
|
123
|
+
// 中英混排面板)。故顺序:显式选择 → 任一 zh 信号 → en 信号 → zh。
|
|
124
|
+
// ① 手动选择(localStorage)显式最优先
|
|
116
125
|
try {
|
|
117
126
|
var saved = window.localStorage.getItem(PAODING_LANG_KEY);
|
|
118
127
|
if (saved === "zh" || saved === "en") return saved;
|
|
119
128
|
} catch (err) { /* localStorage 不可用:继续探测 */ }
|
|
129
|
+
var navLangs = [];
|
|
120
130
|
try {
|
|
121
|
-
if (typeof navigator !== "undefined"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
if (typeof navigator !== "undefined") {
|
|
132
|
+
if (navigator.language) navLangs.push(String(navigator.language));
|
|
133
|
+
if (navigator.languages && navigator.languages.length) {
|
|
134
|
+
for (var i = 0; i < navigator.languages.length; i++) navLangs.push(String(navigator.languages[i]));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} catch (err) { /* navigator 不可用:navLangs 留空 */ }
|
|
138
|
+
var docLang = "";
|
|
139
|
+
try {
|
|
140
|
+
docLang = String((document.documentElement && document.documentElement.lang) || "");
|
|
141
|
+
} catch (err) { /* 无 document:留空 */ }
|
|
142
|
+
// ② navigator / 宿主页面 <html lang> 任一带 zh 前缀 → zh
|
|
143
|
+
for (var j = 0; j < navLangs.length; j++) {
|
|
144
|
+
if (navLangs[j].toLowerCase().indexOf("zh") === 0) return "zh";
|
|
145
|
+
}
|
|
146
|
+
if (docLang.toLowerCase().indexOf("zh") === 0) return "zh";
|
|
147
|
+
// ③ 时区属中文地区 → zh:Electron webview 里 navigator 常整体被钉成
|
|
148
|
+
// en-US,时区是跟着操作系统走的最后真身(Asia/Shanghai 等)。
|
|
149
|
+
try {
|
|
150
|
+
var tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
151
|
+
if (/Asia\/(Shanghai|Hong_Kong|Macau|Taipei|Urumqi|Chongqing)$/.test(tz)) return "zh";
|
|
152
|
+
} catch (err) { /* 无 Intl:继续 */ }
|
|
153
|
+
// ④ en 信号(浏览器环境常规英文用户在此命中;Electron 假 en-US 已被
|
|
154
|
+
// ③ 时区先一步接走——中文时区的 Electron 用户不会再走到这里)
|
|
155
|
+
for (var k = 0; k < navLangs.length; k++) {
|
|
156
|
+
if (navLangs[k].toLowerCase().indexOf("en") === 0) return "en";
|
|
157
|
+
}
|
|
158
|
+
if (docLang.toLowerCase().indexOf("en") === 0) return "en";
|
|
159
|
+
// ⑤ 无任何信号 → zh(服务端消息仅中文,en 面板必混排)
|
|
160
|
+
return "zh";
|
|
125
161
|
}
|
|
126
162
|
|
|
127
163
|
var paodingLang = paodingDetectLang();
|