@suifei/dsh-ai-team 0.4.73 → 0.4.74
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/index.js +1 -1
- package/lib/ledger/namespace.js +22 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -183,7 +183,7 @@ async function boot(diag, config = {}) {
|
|
|
183
183
|
const legacyDir = join(dshHome(), 'ai-team', 'default');
|
|
184
184
|
// 只在**桌面启动器**(profile 以位置参数传入)时搬迁:那个坑正是它造成的。
|
|
185
185
|
// 从 --profile ai-team 起一个 CLI 不该把 GUI 的团队偷走。
|
|
186
|
-
if (dataDir !== legacyDir &&
|
|
186
|
+
if (dataDir !== legacyDir && ['argv-path', 'profiles-single'].includes(resolvedProfile().source)) {
|
|
187
187
|
migrateLegacyNamespace({ fromDir: legacyDir, toDir: dataDir, diag });
|
|
188
188
|
}
|
|
189
189
|
// 默认工作目录:规则与优先级见 lib/host/default-workspace.js(有独立测试)。
|
package/lib/ledger/namespace.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* Profile 命名空间解析与一次性的旧命名空间迁移。
|
|
3
3
|
*
|
|
4
4
|
* 背景:桌面启动器不导出 `DSH_PROFILE`,而是把 profile 目录作为**位置参数**传给
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { existsSync, readdirSync, renameSync, statSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
15
16
|
import { join } from 'node:path';
|
|
16
17
|
|
|
17
18
|
/** 从启动参数/env 解析 profile 名。 */
|
|
@@ -46,9 +47,29 @@ export function resolveProfile(argv = process.argv, env = process.env) {
|
|
|
46
47
|
if (match !== null) return { name: match[1], source: 'argv-path' };
|
|
47
48
|
}
|
|
48
49
|
if (env?.DSH_PROFILE) return { name: env.DSH_PROFILE, source: 'env' };
|
|
50
|
+
// 兜底:某些启动器只传 dsh-root 而不传 profile 目录,于是上面两条都落空,
|
|
51
|
+
// 账本被写进 `ai-team/default/`(实机复现)。此时若 `~/.dsh/profiles` 下
|
|
52
|
+
// **只有一个** profile,它必然就是当前 profile。
|
|
53
|
+
const only = singleProfileName(env);
|
|
54
|
+
if (only !== null) return { name: only, source: 'profiles-single' };
|
|
49
55
|
return { name: 'default', source: 'default' };
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/** `~/.dsh/profiles` 下唯一的 profile 名;不存在或有多个时返回 null(不猜)。 */
|
|
59
|
+
export function singleProfileName(env = process.env) {
|
|
60
|
+
try {
|
|
61
|
+
const home = typeof env?.DSH_HOME === 'string' && env.DSH_HOME.trim() !== ''
|
|
62
|
+
? env.DSH_HOME
|
|
63
|
+
: join(homedir(), '.dsh');
|
|
64
|
+
const entries = readdirSync(join(home, 'profiles'), { withFileTypes: true })
|
|
65
|
+
.filter((entry) => entry.isDirectory())
|
|
66
|
+
.map((entry) => entry.name);
|
|
67
|
+
return entries.length === 1 ? entries[0] : null;
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
52
73
|
/** 目录下所有文件的总字节数;目录不存在按 0 计。 */
|
|
53
74
|
export function dirBytes(dir) {
|
|
54
75
|
if (!existsSync(dir)) return 0;
|
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.74",
|
|
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",
|