@deepseek-ai/dsh-app-boot 0.1.3-alpha.2 → 0.1.5-alpha.1
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.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +37 -22
- package/lib/types/index.d.ts +1 -1
- package/lib/types/profile.d.ts +13 -0
- package/package.json +12 -12
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/boot/app-boot/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 197ed81c1025f7211c3fb7a694547c52fb058ee8
|
|
6
|
+
README.zh.md: 5e465a86f5e624380710cc8c73d5356c649522e4
|
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ With that entry point, success looks like a running app with every plugin active
|
|
|
47
47
|
|
|
48
48
|
Import profile and bundle declaration types from [`@deepseek-ai/dsh-package-manifest`](../../util/package-manifest/README.md). App-boot owns profile loading, JSON validation, and resolved runtime data.
|
|
49
49
|
|
|
50
|
-
A profile is how one dsh installation ships different app surfaces: `web`, `headless`, `acp`, `sdk`, and `sdk-minimal` start distinct compositions from the same launcher. A profile lives at `$DSH_HOME/profiles/<name>` and combines installable bundles, its own `cordis.patch.yml`, and `patchReload: live | startup`; omitted reload policy keeps the historical `live` default for custom profiles. The shipped `web` template uses live reload, while the other shipped templates apply patches only at startup. `sdk-minimal` names only its standalone bundle; the other templates retain base-plus-mode stacks. `dsh
|
|
50
|
+
A profile is how one dsh installation ships different app surfaces: `web`, `headless`, `acp`, `sdk`, and `sdk-minimal` start distinct compositions from the same launcher. A profile lives at `$DSH_HOME/profiles/<name>` and combines installable bundles, its own `cordis.patch.yml`, and `patchReload: live | startup`; omitted reload policy keeps the historical `live` default for custom profiles. The shipped `web` template uses live reload, while the other shipped templates apply patches only at startup. `sdk-minimal` names only its standalone bundle; the other templates retain base-plus-mode stacks. `dsh --profile <name> --from-default-profile <template>` creates a custom profile at a new non-shipped name from one shipped template, while `dsh plugin` initializes a base-backed profile and manages its installed bundles. A missing bundle or one without a patch declaration fails startup loudly. Application-owned npm projects, such as Electron's reserved Desktop profile, use `loadProfileDirectory` to load an already initialized directory without exposing it through CLI profile lookup.
|
|
51
51
|
|
|
52
52
|
Your machine-local preferences also live in the Harness home:
|
|
53
53
|
|
package/README.zh.md
CHANGED
|
@@ -47,7 +47,7 @@ const ctx = await boot('dsh', resolveConfigPath(argv[2], process.env.DSH_SNAPSHO
|
|
|
47
47
|
|
|
48
48
|
Profile 与 bundle 的声明类型从 [`@deepseek-ai/dsh-package-manifest`](../../util/package-manifest/README.zh.md) 导入。App-boot 负责 profile 加载、JSON 校验和解析后的运行时数据。
|
|
49
49
|
|
|
50
|
-
profile 是同一套 dsh 安装提供不同应用界面的方式:`web`、`headless`、`acp`、`sdk` 与 `sdk-minimal` 从同一 launcher 启动不同组合。profile 位于 `$DSH_HOME/profiles/<name>`,由可安装 bundle、自身 `cordis.patch.yml` 与 `patchReload: live | startup` 组成;自定义 profile 省略 reload 策略时保留历史 `live` 默认值。随产品交付的 `web` 模板实时重载,其他随附模板只在启动时应用 patch。`sdk-minimal` 只列出自身的独立 bundle,其他模板保留 base 加模式 bundle 的栈。`dsh plugin`
|
|
50
|
+
profile 是同一套 dsh 安装提供不同应用界面的方式:`web`、`headless`、`acp`、`sdk` 与 `sdk-minimal` 从同一 launcher 启动不同组合。profile 位于 `$DSH_HOME/profiles/<name>`,由可安装 bundle、自身 `cordis.patch.yml` 与 `patchReload: live | startup` 组成;自定义 profile 省略 reload 策略时保留历史 `live` 默认值。随产品交付的 `web` 模板实时重载,其他随附模板只在启动时应用 patch。`sdk-minimal` 只列出自身的独立 bundle,其他模板保留 base 加模式 bundle 的栈。`dsh --profile <name> --from-default-profile <template>` 从一个随附模板,在新的非内置名称处创建自定义 profile;`dsh plugin` 则初始化以 base 为基础的 profile,并管理其中安装的 bundle。缺失 bundle 或未声明 patch 的 bundle 会让启动明确失败。由应用持有的 npm 项目(例如 Electron 保留的 Desktop profile)通过 `loadProfileDirectory` 加载已经初始化的目录,而不会将它暴露给 CLI profile 查找。
|
|
51
51
|
|
|
52
52
|
你的机器本地偏好同样位于 harness home 中:
|
|
53
53
|
|
package/lib/index.js
CHANGED
|
@@ -831,27 +831,17 @@ function resolveBundleDir(binName, packageName, installAnchor, profileDir) {
|
|
|
831
831
|
throw new Error(`${binName}: cannot resolve profile bundle ${JSON.stringify(packageName)} from the dsh installation or ${profileDir}; run 'dsh plugin --profile ${basename(profileDir)} install' if its dependency is not installed`);
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
834
|
-
* Load
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
* is a misconfiguration, not "no patches".
|
|
834
|
+
* Load an already initialized profile directory without resolving it through
|
|
835
|
+
* the shared Harness home. This is used by application-owned profiles whose
|
|
836
|
+
* package project and lifecycle belong to that application.
|
|
838
837
|
* @param binName - the diagnostic prefix on thrown errors.
|
|
839
|
-
* @param
|
|
840
|
-
* @param installAnchor - absolute path of the dsh app's package.json
|
|
841
|
-
* @param
|
|
842
|
-
* @
|
|
843
|
-
* bundles-only consumer (`--dump-default-config`, a recovery diagnostic)
|
|
844
|
-
* cannot fail on a broken user layer.
|
|
845
|
-
* @returns the loaded profile (empty `patches` when the user layer is skipped).
|
|
838
|
+
* @param dir - absolute profile package directory.
|
|
839
|
+
* @param installAnchor - absolute path of the owning dsh app's package.json.
|
|
840
|
+
* @param options - `userLayer: false` skips reading `cordis.patch.yml`.
|
|
841
|
+
* @returns the resolved bundle layers and optional user patch layer.
|
|
846
842
|
*/
|
|
847
|
-
function
|
|
848
|
-
const
|
|
849
|
-
if (!existsSync(join(dir, "package.json"))) {
|
|
850
|
-
const template = PROFILE_TEMPLATES[name];
|
|
851
|
-
if (template === void 0) throw new Error(`${binName}: profile ${JSON.stringify(name)} does not exist; create it with 'dsh plugin --profile ${name} add <package>'`);
|
|
852
|
-
initProfile(dir, template.bundles, template.patchReload);
|
|
853
|
-
}
|
|
854
|
-
const manifest = normalizeShippedProfile(name, dir, readProfileManifest(binName, dir));
|
|
843
|
+
function loadProfileDirectory(binName, dir, installAnchor, options = {}) {
|
|
844
|
+
const manifest = readProfileManifest(binName, dir);
|
|
855
845
|
const bundles = manifest.dsh?.profile?.bundles ?? [];
|
|
856
846
|
const rawPatchReload = manifest.dsh?.profile?.patchReload;
|
|
857
847
|
if (rawPatchReload !== void 0 && rawPatchReload !== "live" && rawPatchReload !== "startup") throw new Error(`${binName}: profile manifest ${join(dir, "package.json")} dsh.profile.patchReload must be "live" or "startup"`);
|
|
@@ -869,16 +859,41 @@ function loadProfile(binName, name, installAnchor, home = resolveDshHome(), opti
|
|
|
869
859
|
};
|
|
870
860
|
});
|
|
871
861
|
const patchPath = join(dir, PROFILE_PATCH_FILENAME);
|
|
862
|
+
const patches = options.userLayer !== false && existsSync(patchPath) ? loadOverlayPatches(binName, patchPath) : [];
|
|
872
863
|
return {
|
|
873
|
-
name,
|
|
864
|
+
name: basename(dir),
|
|
874
865
|
dir,
|
|
875
866
|
layers,
|
|
876
867
|
patchPath,
|
|
877
|
-
patches
|
|
868
|
+
patches,
|
|
878
869
|
patchReload
|
|
879
870
|
};
|
|
880
871
|
}
|
|
881
872
|
/**
|
|
873
|
+
* Load a profile: resolve every `dsh.profile.bundles` entry to its patch
|
|
874
|
+
* layer and parse the profile's own patch file. A listed bundle without a
|
|
875
|
+
* `dsh.bundle` manifest fails loud — naming a bundle-less package as a layer
|
|
876
|
+
* is a misconfiguration, not "no patches".
|
|
877
|
+
* @param binName - the diagnostic prefix on thrown errors.
|
|
878
|
+
* @param name - the profile name.
|
|
879
|
+
* @param installAnchor - absolute path of the dsh app's package.json (first resolution anchor).
|
|
880
|
+
* @param home - the Harness home; defaults to {@link resolveDshHome}.
|
|
881
|
+
* @param options - `userLayer: false` skips reading `cordis.patch.yml`, so a
|
|
882
|
+
* bundles-only consumer (`--dump-default-config`, a recovery diagnostic)
|
|
883
|
+
* cannot fail on a broken user layer.
|
|
884
|
+
* @returns the loaded profile (empty `patches` when the user layer is skipped).
|
|
885
|
+
*/
|
|
886
|
+
function loadProfile(binName, name, installAnchor, home = resolveDshHome(), options = {}) {
|
|
887
|
+
const dir = resolveProfileDir(name, home);
|
|
888
|
+
if (!existsSync(join(dir, "package.json"))) {
|
|
889
|
+
const template = PROFILE_TEMPLATES[name];
|
|
890
|
+
if (template === void 0) throw new Error(`${binName}: profile ${JSON.stringify(name)} does not exist; create it with 'dsh plugin --profile ${name} add <package>'`);
|
|
891
|
+
initProfile(dir, template.bundles, template.patchReload);
|
|
892
|
+
}
|
|
893
|
+
normalizeShippedProfile(name, dir, readProfileManifest(binName, dir));
|
|
894
|
+
return loadProfileDirectory(binName, dir, installAnchor, options);
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
882
897
|
* Compose patch layers into the effective entry list over an empty root —
|
|
883
898
|
* the same single `applyEntryPatches` call the boot include makes, so flag
|
|
884
899
|
* derivation and config dumps see exactly what mounts.
|
|
@@ -1557,4 +1572,4 @@ function addHarnessSourceSection(ctx, sourceRoot) {
|
|
|
1557
1572
|
});
|
|
1558
1573
|
}
|
|
1559
1574
|
//#endregion
|
|
1560
|
-
export { DEFAULT_PROFILE_BUNDLES, DEFAULT_PROFILE_PATCH_RELOAD, FAIL_LOUD_RELEASE_TIMEOUT_MS, HARNESS_SOURCE_SECTION, PROFILES_DIR, PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, addHarnessSourceSection, assertEntriesActivated, assertEntriesLoaded, boot, composeEntries, healProfilesModuleFallback, initProfile, installFailLoud, loadEnv, loadLayeredEnv, loadOptionalPatches, loadOverlayPatches, loadProfile, mountRootInclude, readProfileManifest, renderConfigDump, resolveBundleDir, resolveConfigPath, resolveProfileDir, watchUserPatches, writeProfileManifest };
|
|
1575
|
+
export { DEFAULT_PROFILE_BUNDLES, DEFAULT_PROFILE_PATCH_RELOAD, FAIL_LOUD_RELEASE_TIMEOUT_MS, HARNESS_SOURCE_SECTION, PROFILES_DIR, PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, addHarnessSourceSection, assertEntriesActivated, assertEntriesLoaded, boot, composeEntries, healProfilesModuleFallback, initProfile, installFailLoud, loadEnv, loadLayeredEnv, loadOptionalPatches, loadOverlayPatches, loadProfile, loadProfileDirectory, mountRootInclude, readProfileManifest, renderConfigDump, resolveBundleDir, resolveConfigPath, resolveProfileDir, watchUserPatches, writeProfileManifest };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare module '@deepseek-ai/cordis' {
|
|
|
16
16
|
dshHomePath?: typeof dshHomePath;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
export { composeEntries, DEFAULT_PROFILE_BUNDLES, DEFAULT_PROFILE_PATCH_RELOAD, healProfilesModuleFallback, initProfile, loadProfile, PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, PROFILES_DIR, readProfileManifest, resolveBundleDir, resolveProfileDir, writeProfileManifest, type Profile, type ProfileLayer, type ProfileManifest, type ProfileModuleFallbackOptions, type ProfileTemplate, } from './profile.ts';
|
|
19
|
+
export { composeEntries, DEFAULT_PROFILE_BUNDLES, DEFAULT_PROFILE_PATCH_RELOAD, healProfilesModuleFallback, initProfile, loadProfile, loadProfileDirectory, PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, PROFILES_DIR, readProfileManifest, resolveBundleDir, resolveProfileDir, writeProfileManifest, type Profile, type ProfileLayer, type ProfileManifest, type ProfileModuleFallbackOptions, type ProfileTemplate, } from './profile.ts';
|
|
20
20
|
/**
|
|
21
21
|
* Resolve the config to boot. Replay swaps a `cordis.yml` basename for
|
|
22
22
|
* `cordis.snapshot.yml` in the same directory; every other mode keeps the path.
|
package/lib/types/profile.d.ts
CHANGED
|
@@ -139,6 +139,19 @@ export declare function writeProfileManifest(dir: string, manifest: ProfileManif
|
|
|
139
139
|
* @returns the bundle package's absolute directory.
|
|
140
140
|
*/
|
|
141
141
|
export declare function resolveBundleDir(binName: string, packageName: string, installAnchor: string, profileDir: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Load an already initialized profile directory without resolving it through
|
|
144
|
+
* the shared Harness home. This is used by application-owned profiles whose
|
|
145
|
+
* package project and lifecycle belong to that application.
|
|
146
|
+
* @param binName - the diagnostic prefix on thrown errors.
|
|
147
|
+
* @param dir - absolute profile package directory.
|
|
148
|
+
* @param installAnchor - absolute path of the owning dsh app's package.json.
|
|
149
|
+
* @param options - `userLayer: false` skips reading `cordis.patch.yml`.
|
|
150
|
+
* @returns the resolved bundle layers and optional user patch layer.
|
|
151
|
+
*/
|
|
152
|
+
export declare function loadProfileDirectory(binName: string, dir: string, installAnchor: string, options?: {
|
|
153
|
+
userLayer?: boolean;
|
|
154
|
+
}): Profile;
|
|
142
155
|
/**
|
|
143
156
|
* Load a profile: resolve every `dsh.profile.bundles` entry to its patch
|
|
144
157
|
* layer and parse the profile's own patch file. A listed bundle without a
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-app-boot",
|
|
3
3
|
"description": "Shared boot glue for the app bins: .env loading, fail-loud Loader guards, snapshot-aware config resolution, and the Loader boot sequence",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"js-yaml": "^4.2.0",
|
|
31
31
|
"resolve.exports": "^2.0.3",
|
|
32
|
-
"@deepseek-ai/dsh-atomic-write": "^0.1.
|
|
33
|
-
"@deepseek-ai/dsh-package-manifest": "^0.1.
|
|
32
|
+
"@deepseek-ai/dsh-atomic-write": "^0.1.5-alpha.1",
|
|
33
|
+
"@deepseek-ai/dsh-package-manifest": "^0.1.5-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@deepseek-ai/cordis-plugin-group": "^1.0.2",
|
|
37
|
-
"@deepseek-ai/cordis-plugin-hmr": "^1.0.17",
|
|
38
37
|
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
38
|
+
"@deepseek-ai/cordis-plugin-hmr": "^1.0.17",
|
|
39
39
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
40
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/
|
|
43
|
-
"@deepseek-ai/
|
|
40
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.5-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-alpha.1",
|
|
42
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
43
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.5-alpha.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@deepseek-ai/cordis-plugin-hmr": {
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/js-yaml": "^4.0.9",
|
|
52
|
+
"@deepseek-ai/cordis-plugin-group": "^1.0.2",
|
|
52
53
|
"@deepseek-ai/cordis-plugin-hmr": "^1.0.17",
|
|
53
54
|
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
54
55
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
55
|
-
"@deepseek-ai/
|
|
56
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.5-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.5-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-alpha.1",
|
|
56
59
|
"@deepseek-ai/cordis-plugin-timer": "^1.1.4",
|
|
57
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.3-alpha.2",
|
|
58
|
-
"@deepseek-ai/dsh-home-paths": "^0.1.3-alpha.2",
|
|
59
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
|
|
60
60
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
61
61
|
}
|
|
62
62
|
}
|