dsh-code-server-app 0.1.31 → 0.1.32

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.en.md CHANGED
@@ -62,7 +62,7 @@ pnpm pack
62
62
 
63
63
  ```powershell
64
64
  # 2) Install (published tarball; the plugin has no postinstall → no pnpm approve-builds / allowBuilds needed)
65
- dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.31.tgz
65
+ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.32.tgz
66
66
  ```
67
67
 
68
68
  > Installation only drops plugin files: **no package scripts run and code-server is not installed**
@@ -77,7 +77,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-
77
77
  - **code-server is not in `dependencies`** (pnpm never touches it; no script-approval issues); instead
78
78
  `scripts/setup-code-server.mjs` installs **the latest** `code-server` **with npm into a dedicated profile
79
79
  directory** on demand (version not pinned; npm `latest` is used at install time):
80
- - Triggers: host `POST /code-server/setup` (startup guide modal "Install" / settings card "Install environment"),
80
+ - Triggers: host `POST /api/code-server/setup` (startup guide modal "Install" / settings card "Install environment"),
81
81
  or manually `npm run setup:code-server`;
82
82
  - Install root: `<profile>\.code-server-app` (e.g. `C:\Users\User\.dsh\profiles\web\.code-server-app`),
83
83
  a standalone project isolated from the profile dependency tree (avoids ERESOLVE);
@@ -208,15 +208,32 @@ User-level override example (write in `$DSH_HOME/profiles/web/cordis.patch.yml`,
208
208
  bin: C:\Users\User\AppData\Roaming\npm\code-server.cmd
209
209
  ```
210
210
 
211
- ## JSON API (same-origin fetch; shared by the overlay and the web page)
211
+ ## JSON API (same-origin fetch; identical paths in web and desktop)
212
+
213
+ **No `webServer` dependency**: the host half registers its routes on DSH Connection's shared `/api` channel through
214
+ `ctx.connection.fetch.register`. In the web profile Connection mounts the `/api` prefix on webServer itself (with the
215
+ Host/Origin fence and browser auth); in the desktop profile `apps/desktop-host` feeds `/api/*` into the same
216
+ `createSharedFetchHandler('/api')` (IPC framed pipe, no HTTP server). The client only writes relative paths
217
+ (`fetch('/api/code-server/<op>')`), so both carriers behave identically.
212
218
 
213
219
  | Method | Path | Description |
214
220
  |---|---|---|
215
- | GET | `/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }` (also `env` environment check and `setup` install-task progress) |
216
- | POST | `/code-server/start` | body `{ cwd? }` (omit cwd to keep the current workspace); idempotent |
217
- | POST | `/code-server/stop` | Stop and recycle the process tree |
218
- | POST | `/code-server/setup` | Run the environment install in the background (npm install code-server + native + VS Code internal deps); progress via `status.setup` polling |
219
- | POST | `/code-server/open-file` | body `{ file }` — writes the signal consumed by the built-in `dshcs-open-file` extension to open the file in code-server (also auto-expands the window from the client side) |
221
+ | GET | `/api/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }` (also `env` environment check and `setup` install-task progress) |
222
+ | POST | `/api/code-server/start` | body `{ cwd? }` (omit cwd to keep the current workspace); idempotent |
223
+ | POST | `/api/code-server/stop` | Stop and recycle the process tree |
224
+ | POST | `/api/code-server/setup` | Run the environment install in the background (npm install code-server + native + VS Code internal deps); progress via `status.setup` polling |
225
+ | POST | `/api/code-server/open-file` | body `{ file }` — writes the signal consumed by the built-in `dshcs-open-file` extension to open the file in code-server |
226
+
227
+ > The plugin no longer registers `/code-server/*` webServer-only routes, and the code-server icon is inlined as a data URI
228
+ > in the client bundle — the client requests no plugin-owned HTTP resource at all.
229
+
230
+ ## DSH Desktop (no webServer)
231
+
232
+ - The host half is `inject = ['connection', 'settings']` (**no `webServer`**) — the desktop profile disables webserver/web-runtime
233
+ and the plugin still works: `/api/*` requests travel Electron `dsh-app://` protocol handler → IPC framed pipe → `createSharedFetchHandler('/api')`.
234
+ - The right-sidebar tab, guide entry box, artifact button, and settings card behave the same as in web (code-server remains an
235
+ iframe to the local `http://127.0.0.1:<port>`; the desktop renderer uses `webSecurity: true` with no CSP, so the cross-origin iframe loads).
236
+ - Install into the desktop profile with `dsh plugin --profile desktop add dsh-code-server-app@<version>` (or the desktop plugin manager).
220
237
 
221
238
  ## Artifact open buttons
222
239
 
package/README.md CHANGED
@@ -69,7 +69,7 @@ pnpm pack
69
69
 
70
70
  ```powershell
71
71
  # 2) 安装(发布形态 tarball;插件无 postinstall → 无需 pnpm approve-builds / allowBuilds)
72
- dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.31.tgz
72
+ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-server-app-0.1.32.tgz
73
73
  ```
74
74
 
75
75
  > 安装只落插件文件,**不执行任何包脚本、不安装 code-server**(pnpm 不会提示 build scripts 许可)。
@@ -83,7 +83,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app\dsh-code-
83
83
  - **code-server 不在 `dependencies`**(pnpm 不触碰它、无脚本许可问题),改由
84
84
  `scripts/setup-code-server.mjs` 在 **profile 专用目录**用 **npm** 按需安装
85
85
  **最新版** `code-server`(不锁版本,安装时取 npm latest):
86
- - 触发方式:host `POST /code-server/setup`(启动安装指引弹窗「开始安装」/ 设置卡片「安装环境」)
86
+ - 触发方式:host `POST /api/code-server/setup`(启动安装指引弹窗「开始安装」/ 设置卡片「安装环境」)
87
87
  或手动 `npm run setup:code-server`;
88
88
  - 安装根:`<profile>\.code-server-app`(如 `C:\Users\User\.dsh\profiles\web\.code-server-app`),
89
89
  独立项目,与 profile 依赖树隔离(避开 ERESOLVE);
@@ -210,14 +210,31 @@ host 探测顺序:`<profile>\.code-server-app`(专用目录)> 插件包内 `node
210
210
  bin: C:\Users\User\AppData\Roaming\npm\code-server.cmd
211
211
  ```
212
212
 
213
- ## JSON API(同源 fetch,浮层与网页共用)
213
+ ## JSON API(同源 fetch;web 与 desktop 同一套路径)
214
+
215
+ **不依赖 `webServer`**:host 半部经 `ctx.connection.fetch.register` 把路由挂在 DSH Connection 的共享 `/api` 通道上——
216
+ web profile 由 Connection 自己把 `/api` 前缀挂到 webServer(带 Host/Origin 校验 + 浏览器鉴权),
217
+ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createSharedFetchHandler('/api')`(IPC 帧管道,无 HTTP 服务器)。
218
+ 客户端只写相对路径 `fetch('/api/code-server/<op>')`,两端行为一致。
214
219
 
215
220
  | 方法 | 路径 | 说明 |
216
221
  |---|---|---|
217
- | GET | `/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }`(另含 `env` 环境检测与 `setup` 安装任务进度) |
218
- | POST | `/code-server/start` | body `{ cwd? }`(省略 cwd 不切换工作目录);幂等 |
219
- | POST | `/code-server/stop` | 停止并回收进程树 |
220
- | POST | `/code-server/setup` | 后台执行环境安装(npm 自装 code-server + native + VS Code 内部依赖);进度经 `status.setup` 轮询 |
222
+ | GET | `/api/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }`(另含 `env` 环境检测与 `setup` 安装任务进度) |
223
+ | POST | `/api/code-server/start` | body `{ cwd? }`(省略 cwd 不切换工作目录);幂等 |
224
+ | POST | `/api/code-server/stop` | 停止并回收进程树 |
225
+ | POST | `/api/code-server/setup` | 后台执行环境安装(npm 自装 code-server + native + VS Code 内部依赖);进度经 `status.setup` 轮询 |
226
+ | POST | `/api/code-server/open-file` | body `{ file }` — 写信号文件,由内置扩展 `dshcs-open-file` 在 code-server 中打开 |
227
+
228
+ > 插件不再注册 `/code-server/*` 这类 webServer 专有路由;code-server 图标已内联为 data URI(client bundle 内),
229
+ > 因此客户端不请求任何插件自有 HTTP 资源。
230
+
231
+ ## DSH Desktop(无 webServer)
232
+
233
+ - host 半部 `inject = ['connection', 'settings']`(**不含 `webServer`**)——desktop profile 关掉了 webserver/web-runtime,
234
+ 本插件照常工作;`/api/*` 请求由 Electron `dsh-app://` 协议处理器 → IPC 帧管道 → `createSharedFetchHandler('/api')`。
235
+ - 右侧栏标签、guide 入口框、产物按钮、设置卡片在 desktop 下与 web 相同(code-server 仍是本机 `http://127.0.0.1:<port>` 的 iframe;
236
+ 桌面端 `webSecurity: true` 且页面无 CSP 限制,跨源 iframe 正常加载)。
237
+ - 安装到 desktop profile:`dsh plugin --profile desktop add dsh-code-server-app@<版本>`(或桌面端插件管理窗)。
221
238
 
222
239
  ## 已知限制
223
240