@dsh-workbench/core 0.2.7 → 0.2.9

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
@@ -91,7 +91,9 @@ npx @dsh-workbench/core # ② 起工作台,默认 :3081
91
91
  再打开这一页拉一次即可。见 [ADR-0044](../../docs/adr/0044-config-sync-replaces-the-web-patch-overlay.md)。
92
92
  - ⚠️ **别在 Settings → 插件里把 `@dsh-workbench/core` 关掉**:关掉 = 它那份 bundle patch 整份不再应用
93
93
  (包括里面的"禁用出厂左栏"),界面会**退化成原版 dsh web**(左栏回来、右侧面板消失)。
94
- **数据一个都不丢**;把开关拨回来就恢复 —— 进不去设置页就按 `Meta+,`。别当成故障去重建 profile。
94
+ **数据一个都不丢**;把开关拨回来就恢复 —— 进不去设置页就按 `Meta+,`。进程已经退过的话,
95
+ 启动器读到"bundle 没被选中"会直接拒绝启动并给一条命令:`./bin/dsh-workbench setup`(幂等,
96
+ 把这一项补回 `dsh.profile.bundles`)。别当成故障去重建 profile。
95
97
 
96
98
  ## 常见问题
97
99
 
@@ -102,7 +104,7 @@ npx @dsh-workbench/core # ② 起工作台,默认 :3081
102
104
  | 面板一直空着 | 多半是没登录 Coding(见上);或这个工作区的 git `origin` 不指向 `e.coding.net` |
103
105
  | 打开面板 / 按刷新要等 5–8 秒 | 正常:opencli 每次调用有**固定约 5 秒**开销(起浏览器会话)。**没有缓存**,数据一律实时 |
104
106
  | 体检那屏说「检测浏览器通道 · 没连上」,可面板照样能用 | 本机全局 opencli 与隔离运行时版本不一致,daemon 被顶成对方那版;下一条浏览器命令会自动把它重启回来,体检复检后改回「已连接」 |
105
- | 一切正常,但左栏是出厂样子、右边没有面板 | 工作台插件在 Settings 里被关了(见上一条 ⚠️) |
107
+ | 一切正常,但左栏是出厂样子、右边没有面板 | 工作台插件在 Settings 里被关了(见上一条 ⚠️)。**重启之后**启动器不会再让你拿到这种实例:它读到 `dsh.profile.bundles` 里没有它就直接拒绝启动,并打印 `./bin/dsh-workbench setup` |
106
108
  | 模型列表里只有出厂的几个、没有自己配的供应商 | 新装的 profile 不带设置(ADR-0044):设置 → 「配置同步」→ 选来源 → 勾 `llm-` 那几行 → 同步(即生效)|
107
109
  | 「配置同步」里某一行说 `@x 还没装` | 那一行点名的包不在这个 profile 的 `node_modules` 里:`dsh plugin --profile workbench add @x`(或在模块市场装),(装完 dsh 会自行重组;它报 `restartReason` 时才重启)|
108
110
 
package/bin/dsh-workbench CHANGED
@@ -75,6 +75,13 @@ run_setup() {
75
75
 
76
76
  dsh plugin --profile "$PROFILE" add "$SPEC"
77
77
 
78
+ # 装包与"被选中"是 dsh 那侧的两件事:`dsh plugin add` 的 pnpm 那半管装,
79
+ # 而登记 `dsh.profile.bundles` 是它装完后的对账,那条对账**跳过已存在的依赖** ——
80
+ # 依赖已经在清单里时(重跑 setup、上次装到一半),bundle 名单永远缺那一项。
81
+ # 所以装完再确保选中一遍:缺了就补进 `dsh.profile.bundles`,相等就一个字节不写。
82
+ # 启动器现在拿"选中"当硬门禁(没选中就拒绝启动),这一步就是那条修复命令的落点。
83
+ bash "$REPO_DIR/scripts/seed-profile.sh" ensure-selected
84
+
78
85
  cat <<EOF
79
86
 
80
87
  装好了。起工作台:
@@ -107,10 +114,39 @@ if [ ! -f "$PROFILE_DIR/package.json" ]; then
107
114
  exit 1
108
115
  fi
109
116
 
110
- # 软提醒:bundle 没装的话面板不会出现,但服务照常起来。
111
- if ! grep -q "\"$PKG\"" "$PROFILE_DIR/package.json"; then
112
- echo "dsh-workbench: 提醒 —— 工作台 bundle 还没装进 profile '$PROFILE'," >&2
113
- echo " 侧边栏不会出现「工作台」入口。运行: $REPO_DIR/bin/dsh-workbench setup" >&2
117
+ # ── 硬门禁:工作台 bundle 必须**被选中**(在 `dsh.profile.bundles` 里)─────────
118
+ #
119
+ # 判据只能是 `dsh.profile.bundles`,**不能** grep 整个 package.json:依赖装着 ≠ 被选中。
120
+ # 只有 dependencies 而没有 bundles 时,profile 照常组起来、服务照常监听,只是
121
+ # 侧边栏什么也不出现 —— 用户拿到的是一台"什么都对、就是没有工作台"的实例,
122
+ # 而且没有任何报错。所以这里读到没选中就**拒绝启动**,并给一条能照抄的修复命令。
123
+ #
124
+ # 这条断法是真会发生的:依赖已经在清单里时(重跑 setup、上次装到一半),
125
+ # `dsh plugin add` 的 pnpm 那半只回一句"已是最新",而它装完的登记跳过**已存在**的
126
+ # 依赖,于是 bundle 名单永远缺那一项。setup 为此多了一步"确保选中"
127
+ # (`scripts/seed-profile.sh ensure-selected`),这里给的就是回到那一步的命令。
128
+ BUNDLE_GUARD=0
129
+ WB_PROFILE_MANIFEST="$PROFILE_DIR/package.json" WB_PKG="$PKG" node -e '
130
+ const fs = require("node:fs");
131
+ const manifestPath = process.env.WB_PROFILE_MANIFEST;
132
+ let profile = {};
133
+ try {
134
+ profile = (JSON.parse(fs.readFileSync(manifestPath, "utf8")).dsh || {}).profile || {};
135
+ } catch (error) {
136
+ console.error("dsh-workbench: 读不了 profile 清单 " + manifestPath + ":" + error.message);
137
+ process.exit(2);
138
+ }
139
+ const bundles = Array.isArray(profile.bundles) ? profile.bundles : [];
140
+ if (!bundles.includes(process.env.WB_PKG)) process.exit(1);
141
+ ' || BUNDLE_GUARD=$?
142
+
143
+ if [ "$BUNDLE_GUARD" -ne 0 ]; then
144
+ if [ "$BUNDLE_GUARD" -eq 1 ]; then
145
+ echo "dsh-workbench: profile '$PROFILE' 没选中工作台 bundle($PKG 不在 dsh.profile.bundles 里)。" >&2
146
+ echo " 这样起只会得到一台没有工作台入口的实例,所以这里直接拒绝启动。" >&2
147
+ fi
148
+ echo " 修好它(幂等,会补上这一项): $REPO_DIR/bin/dsh-workbench setup" >&2
149
+ exit 1
114
150
  fi
115
151
 
116
152
  # 清掉从父 dsh 会话继承来的身份变量。