@zaofan/dsh-qqbot 1.10.29 → 1.10.31
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/client/qqbot-settings.js +957 -952
- package/package.json +1 -1
- package/settings-host.js +31 -17
package/package.json
CHANGED
package/settings-host.js
CHANGED
|
@@ -4899,6 +4899,21 @@ const WHY_MAP = { busy: '目标会话回合活跃,已等待至回合结束仍超
|
|
|
4899
4899
|
return out;
|
|
4900
4900
|
}
|
|
4901
4901
|
|
|
4902
|
+
/**
|
|
4903
|
+
* 把工作区路径归一成**绝对路径**(与 src/util/abs-path.ts 的 absCwdOf 同一套规则)。
|
|
4904
|
+
* 绝对路径原样返回,只给相对路径补前导 `/`。
|
|
4905
|
+
*/
|
|
4906
|
+
function absCwd(p) {
|
|
4907
|
+
const raw = String(p == null ? '' : p).trim();
|
|
4908
|
+
if (!raw) return '';
|
|
4909
|
+
if (/^[A-Za-z]:[\\/]/.test(raw)) return raw;
|
|
4910
|
+
if (raw.startsWith('\\\\') || raw.startsWith('//')) return raw;
|
|
4911
|
+
if (raw.startsWith('/')) return raw;
|
|
4912
|
+
const s = raw.replace(/\\/g, '/');
|
|
4913
|
+
if (process.platform !== 'win32') return '/' + s;
|
|
4914
|
+
return raw;
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4902
4917
|
/** 扫一个扩展根(含六个 kind 子目录),返回 { kinds:{tools:[...]}, total } */
|
|
4903
4918
|
function scanExtRoot(root, dataRoot) {
|
|
4904
4919
|
const kinds = {};
|
|
@@ -4936,12 +4951,12 @@ const WHY_MAP = { busy: '目标会话回合活跃,已等待至回合结束仍超
|
|
|
4936
4951
|
const bcwd = norm(cfg.cwd);
|
|
4937
4952
|
if (!bcwd || bcwd !== target) continue;
|
|
4938
4953
|
if (cfg.dataRoot) return { dataRoot: String(cfg.dataRoot), source: 'bot.dataRoot' };
|
|
4939
|
-
return { dataRoot: join(String(cfg.cwd), 'dshqqbot'), source: 'bot.cwd' };
|
|
4954
|
+
return { dataRoot: join(absCwd(cfg.cwd) || String(cfg.cwd), 'dshqqbot'), source: 'bot.cwd' };
|
|
4940
4955
|
}
|
|
4941
4956
|
}
|
|
4942
4957
|
|
|
4943
4958
|
// ③ 传入的 cwd(该工作区没绑 bot 时,扩展目录仍在它自己的 dshqqbot 下)
|
|
4944
|
-
if (hint) return { dataRoot: join(hint, 'dshqqbot'), source: 'workspace' };
|
|
4959
|
+
if (hint) return { dataRoot: join(absCwd(hint) || hint, 'dshqqbot'), source: 'workspace' };
|
|
4945
4960
|
|
|
4946
4961
|
// ④ 兜底:老的推断
|
|
4947
4962
|
for (const b of bots) {
|
|
@@ -5231,22 +5246,21 @@ const WHY_MAP = { busy: '目标会话回合活跃,已等待至回合结束仍超
|
|
|
5231
5246
|
* --D-newwenjianjia-aiwork-~9CB8~9C7C~5A18-- ⇒ D:\newwenjianjia\aiwork\鲸鱼娘
|
|
5232
5247
|
* '-' = 分隔符;'~XXXX' = 一个 UTF-16 码元;首段单字母 = 盘符
|
|
5233
5248
|
*/
|
|
5249
|
+
/**
|
|
5250
|
+
* `~/.dsh/sessions/{转义目录名}` → 工作区真实路径。
|
|
5251
|
+
*
|
|
5252
|
+
* 2026-10-24 修 issue #19:这里原来自己写了一遍解码(和 decodeSessionDirName 重复),
|
|
5253
|
+
* 而且有三个叠加缺陷:
|
|
5254
|
+
* ① `segs.join(String.fromCharCode(92, 92))` —— 拼出了**两个**反斜杠字符;
|
|
5255
|
+
* ② 分隔符写死反斜杠,POSIX 上直接坏;
|
|
5256
|
+
* ③ 目录名转义时根部的 `/` 就丢了,还原后也没补。
|
|
5257
|
+
* 结果 Android/Linux 上还原成 `storage\\emulated\\0\\大肥鱼` —— 相对路径,
|
|
5258
|
+
* 扩展面板拿它去 readdirSync 必然落空,三块计数全 0。
|
|
5259
|
+
*
|
|
5260
|
+
* 现在直接复用 decodeSessionDirName(那边已经按盘符/POSIX 分支处理过)。
|
|
5261
|
+
*/
|
|
5234
5262
|
function wsPathFromDir(dir) {
|
|
5235
|
-
|
|
5236
|
-
const parts = [];
|
|
5237
|
-
let cur = '';
|
|
5238
|
-
let i = 0;
|
|
5239
|
-
while (i < t.length) {
|
|
5240
|
-
const ch = t[i];
|
|
5241
|
-
if (ch === '-') { parts.push(cur); cur = ''; i += 1; continue; }
|
|
5242
|
-
const m = /^~([0-9A-Fa-f]{4})/.exec(t.slice(i, i + 5));
|
|
5243
|
-
if (m) { cur += String.fromCharCode(parseInt(m[1], 16)); i += 5; continue; }
|
|
5244
|
-
cur += ch; i += 1;
|
|
5245
|
-
}
|
|
5246
|
-
parts.push(cur);
|
|
5247
|
-
const segs = parts.filter((p) => p !== '');
|
|
5248
|
-
if (segs.length && /^[A-Za-z]$/.test(segs[0])) segs[0] = segs[0] + ':';
|
|
5249
|
-
return segs.join('\\\\');
|
|
5263
|
+
return decodeSessionDirName(String(dir || ''));
|
|
5250
5264
|
}
|
|
5251
5265
|
|
|
5252
5266
|
/**
|