@suifei/dsh-ai-team 0.4.58 → 0.4.59
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/CHANGELOG.md +11 -0
- package/index.js +7 -2
- package/lib/host/default-workspace.js +19 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.59 - 2026-11-12
|
|
4
|
+
|
|
5
|
+
**默认工作目录改成 `~/works` 子目录(不再用主目录根)**
|
|
6
|
+
|
|
7
|
+
0.4.57 把建议值修成主目录 `C:\Users\SuiFei`——用户裁定这也不行:**不能把主目录根当工作目录,必须是它下面的子目录**(`~/works`)。跨平台由调用方的 `homedir()` 决定(Windows 是 `USERPROFILE`,Linux/macOS 是 `~`),本模块只做 `join`,不自己判断平台。
|
|
8
|
+
|
|
9
|
+
- 候选顺序:配置项 → 显式 cwd(须存在且不在 `~/.dsh`、非系统目录)→ **`join(homedir(), 'works')`**。
|
|
10
|
+
- `~/works` 可能尚不存在,而 `project.workspace.update` 只接受已存在的目录:boot 解析出建议值后**创建它**(失败则不给建议,不阻断启动)。
|
|
11
|
+
- 真机实测:`cwd=…\.dsh\profiles\desktop` → 建议 `C:\Users\SuiFei\works`,不等于主目录;创建成功。
|
|
12
|
+
- 测试:`node --test` **258 通过 / 1 跳过**(`default-workspace` 6 例,新增「永远是 home 的子目录、绝非 home 根」与「home 落在 ~/.dsh 内时不给建议」)。
|
|
13
|
+
|
|
3
14
|
## 0.4.58 - 2026-11-12
|
|
4
15
|
|
|
5
16
|
**让「归档修复跑没跑」可判定:`host.repair.ok` 进 errors 白名单**
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { homedir } from 'node:os';
|
|
12
12
|
import { join, sep } from 'node:path';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
|
-
import { existsSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
15
15
|
import z from '@deepseek-ai/schemastery';
|
|
16
16
|
import { ProjectRuntime } from './lib/host/project-runtime.js';
|
|
17
17
|
import { ProjectRegistry } from './lib/host/project-registry.js';
|
|
@@ -185,7 +185,7 @@ async function boot(diag, config = {}) {
|
|
|
185
185
|
migrateLegacyNamespace({ fromDir: legacyDir, toDir: dataDir, diag });
|
|
186
186
|
}
|
|
187
187
|
// 默认工作目录:规则与优先级见 lib/host/default-workspace.js(有独立测试)。
|
|
188
|
-
|
|
188
|
+
let defaultWorkspace = resolveDefaultWorkspace({
|
|
189
189
|
configured: typeof config?.defaultWorkspace === 'string' ? config.defaultWorkspace : '',
|
|
190
190
|
cwd: process.cwd(),
|
|
191
191
|
home: homedir(),
|
|
@@ -193,6 +193,11 @@ async function boot(diag, config = {}) {
|
|
|
193
193
|
// 整个 ~/.dsh 都不能当工作目录(桌面启动器的 cwd 就是 profile 目录)。
|
|
194
194
|
excludeRoots: [dshHome()],
|
|
195
195
|
});
|
|
196
|
+
// 兜底建议是 `~/works`:它可能还不存在,而 `project.workspace.update` 只接受
|
|
197
|
+
// 已存在的目录。用户确认的就是这个子目录,所以在这里建出来(失败则不提供建议)。
|
|
198
|
+
if (defaultWorkspace !== '' && !existsSync(defaultWorkspace)) {
|
|
199
|
+
try { mkdirSync(defaultWorkspace, { recursive: true }); } catch { defaultWorkspace = ''; }
|
|
200
|
+
}
|
|
196
201
|
const registry = ProjectRegistry.load(dataDir, { defaultWorkspacePath: defaultWorkspace });
|
|
197
202
|
const runtimes = new Map();
|
|
198
203
|
for (const project of registry.list()) {
|
|
@@ -5,22 +5,30 @@
|
|
|
5
5
|
* 1. 只有**没有指定**项目工作目录时才用默认目录;
|
|
6
6
|
* 2. 项目一旦切换过工作目录,就按项目自己的目录执行(本模块只负责默认值);
|
|
7
7
|
* 3. 默认值不能是插件自己的数据目录,否则成员会退化成「在账本目录里干活」;
|
|
8
|
-
* 4.
|
|
8
|
+
* 4. 不能把用户主目录**根**当工作目录——必须是它下面的子目录(`~/works`);
|
|
9
|
+
* 5. 系统目录(Windows / Program Files)不当作团队工作目录——桌面启动器的
|
|
9
10
|
* cwd 可能就是程序目录。
|
|
11
|
+
*
|
|
12
|
+
* 跨平台:主目录一律来自调用方的 `homedir()`(Windows 是 `USERPROFILE`,
|
|
13
|
+
* Linux/macOS 是 `~`),本模块不自己判断平台,只用 `join` 拼路径。
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
16
|
import { statSync } from 'node:fs';
|
|
13
|
-
import { sep } from 'node:path';
|
|
17
|
+
import { join, sep } from 'node:path';
|
|
14
18
|
|
|
15
19
|
const SYSTEM_DIR = /^[a-z]:[\\/](windows|program files|program files \(x86\))([\\/]|$)/i;
|
|
16
20
|
|
|
21
|
+
/** 用户主目录下的工作区子目录名(不给主目录根本身)。 */
|
|
22
|
+
export const WORKSPACE_SUBDIR = 'works';
|
|
23
|
+
|
|
17
24
|
const isDirectory = (value) => {
|
|
18
25
|
try { return statSync(value).isDirectory() === true; } catch { return false; }
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
/**
|
|
22
|
-
* @param {{ configured?: string, cwd?: string, home?: string, dataDir?: string }} input
|
|
23
|
-
* @returns {string}
|
|
29
|
+
* @param {{ configured?: string, cwd?: string, home?: string, dataDir?: string, excludeRoots?: string[] }} input
|
|
30
|
+
* @returns {string} 绝对目录;找不到任何可用目录时返回空串。
|
|
31
|
+
* 注意:返回的路径**可能尚不存在**——那是 `~/works` 建议值,调用方负责创建。
|
|
24
32
|
*/
|
|
25
33
|
export function resolveDefaultWorkspace({ configured = '', cwd = '', home = '', dataDir = '', excludeRoots = [] } = {}) {
|
|
26
34
|
const explicit = typeof configured === 'string' ? configured.trim() : '';
|
|
@@ -37,7 +45,7 @@ export function resolveDefaultWorkspace({ configured = '', cwd = '', home = '',
|
|
|
37
45
|
for (const root of excludeRoots) if (under(value, root)) return true;
|
|
38
46
|
return false;
|
|
39
47
|
};
|
|
40
|
-
for (const raw of [explicit, cwd
|
|
48
|
+
for (const raw of [explicit, cwd]) {
|
|
41
49
|
if (typeof raw !== 'string' || raw === '') continue;
|
|
42
50
|
if (!isDirectory(raw)) continue;
|
|
43
51
|
if (excluded(raw)) continue;
|
|
@@ -45,5 +53,11 @@ export function resolveDefaultWorkspace({ configured = '', cwd = '', home = '',
|
|
|
45
53
|
if (raw !== explicit && SYSTEM_DIR.test(raw)) continue;
|
|
46
54
|
return raw;
|
|
47
55
|
}
|
|
56
|
+
// 兜底:用户主目录下的 `works` 子目录(跨平台由调用方传入 homedir)。
|
|
57
|
+
if (typeof home === 'string' && home !== '') {
|
|
58
|
+
const suggested = join(home, WORKSPACE_SUBDIR);
|
|
59
|
+
// 主目录本身被排除(例如 home 就落在 ~/.dsh 下)时不再兜底。
|
|
60
|
+
if (!excluded(suggested)) return suggested;
|
|
61
|
+
}
|
|
48
62
|
return '';
|
|
49
63
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
|
|
6
6
|
"license": "MIT",
|