dsh-code-server-app 0.3.58 → 0.3.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/README.en.md +122 -89
- package/README.md +117 -87
- package/assets/extensions/dshcs-editor-bridge/extension.js +43 -220
- package/assets/extensions/dshcs-editor-bridge/lib/bridge-client.js +5 -37
- package/assets/extensions/dshcs-editor-bridge/package.json +2 -2
- package/lib/bridge-session.mjs +55 -5
- package/lib/bridge.mjs +11 -7
- package/lib/client.js +922 -87
- package/lib/index.js +73 -205
- package/package.json +5 -28
- package/vendor/VENDOR.json +1 -1
- package/assets/extensions/dshcs-editor-bridge/lib/ask-panel.js +0 -416
- package/assets/extensions/dshcs-editor-bridge/webview/THIRD-PARTY.md +0 -22
- package/assets/extensions/dshcs-editor-bridge/webview/src/app.jsx +0 -242
- package/assets/extensions/dshcs-editor-bridge/webview/src/approval.jsx +0 -61
- package/assets/extensions/dshcs-editor-bridge/webview/src/official-tokens.css +0 -576
- package/assets/extensions/dshcs-editor-bridge/webview/src/panel.css +0 -380
- package/assets/extensions/dshcs-editor-bridge/webview/src/thread.jsx +0 -160
- package/assets/extensions/dshcs-editor-bridge/webview/thread.css +0 -1
- package/assets/extensions/dshcs-editor-bridge/webview/thread.js +0 -465
package/README.en.md
CHANGED
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
A static profile plugin (npm package with host + client bundle) that ships the **VS Code server tree** from a [code-server](https://github.com/coder/code-server) release as a **platform-independent dependency package** (pack-time artifact `vendor/vscode` → `@jinsiyu/dshcs-vscode-server`, no install scripts, no postinstall). The code-server **Node service layer is replaced by the plugin's own `lib/launcher.mjs`**: it drives `<tree>/lib/vscode/out/server-main.js` (`loadCodeWithNls()` / `createServer()` / `handleRequest()` / `handleUpgrade()`) directly and re-adds the few HTTP endpoints code-server used to provide (`/healthz`, `/manifest.json`, `/_static/*`, `/proxy/:port`). The 16 native modules (node-pty / @vscode/sqlite3 / spdlog / …) come from `@jinsiyu/dshcs-*` sub-packages declared **directly on the plugin's dependency table** under their real names (os/cpu-gated per target), with the original import names restored by runtime junctions. VS Code's inner dependencies and the prebuilt native modules are **all installed by the package manager together with the plugin** — no global npm install, no `bin` configuration, no profile config changes, no second install command, **no argon2/C++ toolchain**.
|
|
14
14
|
|
|
15
|
-
>
|
|
16
|
-
>
|
|
17
|
-
>
|
|
18
|
-
>
|
|
15
|
+
> **The "ask DSH" dialog** renders the session's new content with **DSH's own Markdown renderer** and can
|
|
16
|
+
> **answer approval requests in place** (writing outside the workspace / running commands). The panel is a
|
|
17
|
+
> hand-written React component inside `lib/client.js`: it requires `react-dom/client` and
|
|
18
|
+
> `@deepseek-ai/dsh-client-ui-primitives` straight from the DSH page's module table (the very instance the UI
|
|
19
|
+
> uses), so typography, highlighting and math match the UI and a renderer version mismatch is impossible.
|
|
20
|
+
> There is **no build step anywhere on that chain**. See "Working with DSH: the editor bridge".
|
|
19
21
|
|
|
20
22
|
## UI carrier and required DSH version (0.2.3: right-sidebar DSH only)
|
|
21
23
|
|
|
@@ -225,62 +227,70 @@ only the editor knows, and lets editor gestures drive the current session.
|
|
|
225
227
|
| Direction | Capability | Mechanism |
|
|
226
228
|
|---|---|---|
|
|
227
229
|
| editor → agent | **unsaved buffers** (disk ≠ what the user sees), active file and selection, **language-server diagnostics** with `file:line`, source and code | agent tools `editor_context` / `editor_diagnostics`; plus a notice attached before writing a dirty file |
|
|
228
|
-
| editor → DSH | select code → context menu **"DSH: ask about selection"** → an **ask
|
|
229
|
-
| DSH → editor (approval) | when the agent wants to **write outside the workspace or run a command**, the approval request shows up as a card in the
|
|
230
|
+
| editor → DSH | select code → context menu **"DSH: ask about selection"** → an **ask dialog** opens in the DSH page (its title bar carries `file:line`); the question enters the current session as **user input**, and that session's **new content** is rendered in the dialog by DSH's own Markdown renderer | extension command `dsh-code-server.askAboutSelection` (one of the **top two** editor context-menu items) → bridge `POST /event {kind:'ask-open'}` → the client half's `POST /api/code-server/ask/send` |
|
|
231
|
+
| DSH → editor (approval) | when the agent wants to **write outside the workspace or run a command**, the approval request shows up as a card in the dialog (tool, reason, countdown); "allow once" / "reject" takes effect immediately | the `approvals` field of `/api/code-server/ask/state` + `POST /api/code-server/ask/approve` (the plugin's **only** write route; constraints under "Security model") |
|
|
230
232
|
| agent → editor | the agent changed a file → a **native diff** opens (left = the **full pre-write text**, right = what is on disk now); if that buffer has unsaved changes you get a warning and **no overwrite** | the host reads `result.value.before` (the complete pre-write text) in `tools/post-execute` into a bounded snapshot cache → the `tools/result` event carries an opaque key → the extension fetches the text and opens the diff |
|
|
231
233
|
|
|
232
234
|
- The tools are only registered while the bridge is live (so the model never sees an unusable tool), and the
|
|
233
235
|
system-prompt section renders only then too.
|
|
234
|
-
- **Ask
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
the
|
|
239
|
-
|
|
240
|
-
only when something is actually selected, while "ask about file" **never carries line numbers or a selection** —
|
|
241
|
-
cursor line is irrelevant to the question and only misleads the agent. With no selection, the selection
|
|
242
|
-
degrades to the plain file.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
236
|
+
- **Ask dialog**: the context-menu command only reports its intent to the host; the dialog itself is popped up by
|
|
237
|
+
the plugin's client half inside the DSH page — draggable, resizable (bottom-right, ✕ closes it), leaving the
|
|
238
|
+
editor layout alone. The selection can still be changed while the dialog stays open.
|
|
239
|
+
When the host cannot prove the dialog is alive (page not open / browser still running an old client) you get a
|
|
240
|
+
one-line notice telling you to open or refresh the Code Server tab — there is **no second ask UI** in the editor.
|
|
241
|
+
- **The two commands remember their intent**: "ask about selection" carries a **line range + selection text**
|
|
242
|
+
only when something is actually selected, while "ask about file" **never carries line numbers or a selection** —
|
|
243
|
+
the cursor line is irrelevant to the question and only misleads the agent. With no selection, the selection
|
|
244
|
+
command also degrades to the plain file. The host takes that context from its cached editor state; the extension
|
|
245
|
+
only reports the intent.
|
|
246
|
+
- **Follow-ups are delivered according to DSH's own setting**: `ui-conversation.busyEnter` (Settings → Conversation,
|
|
247
|
+
"Enter while busy") accepts `queue` (the default) or `steer`. Pressing Enter in the dialog is the same gesture as
|
|
248
|
+
pressing Enter in the main composer, so it reads the same value: `steer` ⇒ the host calls `agent.steer()` and the
|
|
249
|
+
follow-up is consumed at the **running turn's next step boundary** (answered within that turn); `queue` ⇒ the host
|
|
250
|
+
calls `agent.followup()` and the question becomes **its own later turn**, leaving the running one alone. If the
|
|
251
|
+
setting cannot be read (namespace unregistered / minimal composition) or the host has no `agent.steer`, delivery
|
|
252
|
+
falls back to `queue` — a setting never makes a question undeliverable. The panel's status row **says which one was
|
|
253
|
+
used** ("inserted into the current turn…" / "queued for the next turn…"), because while `queue` is in effect the
|
|
254
|
+
**DSH main UI cannot show that message yet**: it sits in the host-side pending queue (`next-turn`) and the main
|
|
255
|
+
client does not render pending queues (it joins the chat flow only once it becomes its own turn). The message is
|
|
256
|
+
not lost.
|
|
257
|
+
- **Injected context is collapsed**: the location line plus the selection code block the bridge adds to the
|
|
258
|
+
message are split out into a collapsed Context row (click it to see the code), while the bubble keeps only the
|
|
259
|
+
user's own words — the same treatment the DSH UI gives injected context.
|
|
260
|
+
- **The body is exactly what DSH renders**: it is handed to DSH's official Markdown renderer
|
|
261
|
+
(`MarkdownText` from `@deepseek-ai/dsh-client-ui-primitives`) — the same micromark/mdast pipeline, the same
|
|
262
|
+
incremental streaming parser, the same shiki highlighting (DSH's own lazily-loaded grammar set), KaTeX math and
|
|
263
|
+
the same heading/table typography. Only **new content** is rendered (from the moment the dialog subscribes);
|
|
264
|
+
history is **not replayed** and there is no "load earlier". If the official components cannot be resolved the
|
|
265
|
+
body degrades to plain-text `<pre>` instead of a blank panel.
|
|
266
|
+
- **Thinking shows up like in DSH**: assistant reasoning becomes a Think row — **collapsed by default**,
|
|
252
267
|
showing its first line (or the latest line while streaming) and expanding on a row click, built from the official
|
|
253
268
|
`DisclosureRow` plus the official think icon and typography language.
|
|
254
|
-
- **Approvals are handled right in the
|
|
255
|
-
session's approval requests ask the
|
|
256
|
-
immediately; **closing the
|
|
257
|
-
path (the DSH UI shows the same card).
|
|
258
|
-
grey before anyone could click (reported as "the approval box stopped working"); the window is now 5 minutes and
|
|
259
|
-
closing the panel hands off immediately instead of waiting it out.
|
|
269
|
+
- **Approvals are handled right in the dialog**: while it is open, that
|
|
270
|
+
session's approval requests ask the dialog first (5-minute window). Clicking "allow once" / "reject" settles it
|
|
271
|
+
immediately; **closing the dialog** or letting the window expire hands the request back **unchanged** to the official
|
|
272
|
+
path (the DSH UI shows the same card).
|
|
260
273
|
**Nothing is ever auto-approved** — `allowed-once` can only come from a click, and there is no "always allow".
|
|
261
|
-
- The question enters the DSH session as a **plain user message** (`source: { kind: 'user' }
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
(see invariant 2 below). The agent's writes still go through its own `fs` tools; the bridge only *knows about*
|
|
267
|
-
and carries your answer back.
|
|
274
|
+
- The question enters the DSH session as a **plain user message** (`source: { kind: 'user' }`): provenance stays in
|
|
275
|
+
the first line of the text (`From the editor: <file>[:<line>]`), and the panel folds it into the Context row.
|
|
276
|
+
- **The bridge is completely read-only**: it never writes files, applies edits, or runs commands — all four routes
|
|
277
|
+
(`/health`, `/sync`, `/old`, `/event`) are reads. The only route that can change state is the DSH-same-origin
|
|
278
|
+
`POST /api/code-server/ask/approve`, which can only **answer an approval request that already exists**
|
|
279
|
+
(see invariant 2 below). The agent's writes still go through its own `fs` tools; the bridge only *knows about*
|
|
280
|
+
them and carries your answer back.
|
|
268
281
|
- Status bar shows `$(plug) DSH` while connected (click it for the log in the "DSH Editor Bridge" output channel).
|
|
269
|
-
- **The extension ships as a built-in
|
|
270
|
-
`<tree>/lib/vscode/extensions/` next to `dshcs-open-file
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
every start, so **the bridge never reported any state**. To turn the bridge off use the plugin setting
|
|
274
|
-
`editorBridge=false` (no mount, no tools) rather than uninstalling the extension from the Extensions view.
|
|
282
|
+
- **The extension ships as a built-in**: `dshcs-editor-bridge` is installed into
|
|
283
|
+
`<tree>/lib/vscode/extensions/` next to `dshcs-open-file` — an extension left in the *user* extensions folder is
|
|
284
|
+
marked `.obsolete` (log line `Marked extension as removed`) by the VS Code server and skipped forever.
|
|
285
|
+
To turn the bridge off use the plugin setting `editorBridge=false` (no mount, no tools).
|
|
275
286
|
|
|
276
287
|
### The channels (since 0.3.13 over **local IPC**: a Windows named pipe / unix socket)
|
|
277
288
|
|
|
278
289
|
```
|
|
279
|
-
extension → host POST /code-server-bridge/sync one round trip: push editor state
|
|
280
|
-
extension → host POST /code-server-bridge/ask push an editor question into the current session
|
|
281
|
-
extension → host POST /code-server-bridge/approve answer an approval request that **already exists** (the only non-read-only route)
|
|
290
|
+
extension → host POST /code-server-bridge/sync one round trip: push editor state + take events and the capability bit
|
|
282
291
|
extension → host GET /code-server-bridge/health unauthenticated liveness probe
|
|
283
|
-
extension → host
|
|
292
|
+
extension → host GET /code-server-bridge/old fetch one "pre-write text" snapshot (events carry an opaque key)
|
|
293
|
+
extension → host POST /code-server-bridge/event report intent: open the dialog / open·close a file etc. (host log tail)
|
|
284
294
|
host → extension <extensionsDir>/.dshcs-bridge/bridge.json endpoint + token, re-read every 5s
|
|
285
295
|
(the same content is also written **next to the built-in extension** in
|
|
286
296
|
`<tree>/lib/vscode/extensions/.dshcs-bridge/` — the env var is only injected when the host
|
|
@@ -289,14 +299,19 @@ host → extension <extensionsDir>/.dshcs-bridge/bridge.json endpoint + toke
|
|
|
289
299
|
```
|
|
290
300
|
|
|
291
301
|
Requests use `http.request({ socketPath })` (`fetch` has no socket support) and **no port is ever opened**.
|
|
302
|
+
All four routes are **read-only**; questions and approval answers do not go through the bridge but through the
|
|
303
|
+
DSH-same-origin `/api/code-server/ask/*` (called by the plugin's client half inside the DSH page, under DSH's own
|
|
304
|
+
cookie/Origin checks).
|
|
292
305
|
|
|
293
|
-
The
|
|
306
|
+
The four state fields the dialog actually consumes (`GET /api/code-server/ask/state?rev=N`; an unchanged revision
|
|
307
|
+
returns a single number):
|
|
294
308
|
|
|
295
309
|
| Field | Content | How the panel uses it |
|
|
296
310
|
|---|---|---|
|
|
297
|
-
| `
|
|
298
|
-
| `approvals` | pending approval requests `[{id, toolName, reason, at}]` (≤4) | renders the card with a countdown; a click posts `/approve` |
|
|
299
|
-
| `approvalHoldMs`
|
|
311
|
+
| `entries` | **new content** entries (user / assistant / tool / approval) of the session the dialog watches; bounded: ≤120 entries per session, ≤8000 chars per body, ≤4 watched sessions | assistant bodies go to the official renderer; tools and approvals become compact summary rows |
|
|
312
|
+
| `approvals` | pending approval requests `[{id, toolName, reason, at}]` (≤4) | renders the card with a countdown; a click posts `/ask/approve` |
|
|
313
|
+
| `approvalHoldMs` | the approval window (300000 ms = 5 minutes by default) | countdown basis |
|
|
314
|
+
| `contextText` / `mode` | the title line (from the host's cached editor state) plus the ask intent | title text; `mode` decides whether line numbers / the selection travel with the question |
|
|
300
315
|
|
|
301
316
|
> **Why not HTTP (settled in 0.3.13, all three measured)**
|
|
302
317
|
> 1. **Desktop has no HTTP surface at all**: the renderer calls `host.fetch()` through Electron IPC
|
|
@@ -355,7 +370,7 @@ user**, so:
|
|
|
355
370
|
(d) when no panel is watching, the panel is closed, or the window (5 minutes by default) expires, the request goes
|
|
356
371
|
**back to the official
|
|
357
372
|
path** — never auto-approved (DSH's `approval/request` itself fails closed; this bridge can only keep
|
|
358
|
-
"nobody answered" as "nobody answered"). `pnpm test:
|
|
373
|
+
"nobody answered" as "nobody answered"). `pnpm test:ask-dialog` asserts these four plus the host-side whitelist.
|
|
359
374
|
3. **Any request carrying `Origin` gets 403.** Browsers always send one (including a sandboxed iframe's literal
|
|
360
375
|
`Origin: null`); the Node extension host never does. Origin is checked **before** the token — otherwise the
|
|
361
376
|
bridge would be a "did you guess the token right" oracle for a web page.
|
|
@@ -438,7 +453,8 @@ Diagnostics: `GET /api/code-server/status` exposes
|
|
|
438
453
|
crash/exit updates status live; after a DSH host restart the plugin **adopts** a still-running instance (verifies pid + `/healthz`), without duplicate start or killing unrelated processes;
|
|
439
454
|
- `node_modules` and the pack-time artifact `vendor/` are git-ignored; after cloning, follow
|
|
440
455
|
"Install the plugin (script-free install; code-server bundled)" below — `pnpm install` → `pnpm run vendor:vscode` →
|
|
441
|
-
`pnpm
|
|
456
|
+
`pnpm pack` + `dsh plugin --profile web add` (after 0.3.58/0.3.59 the client half **and** the ask panel are
|
|
457
|
+
committed hand-written source: there is no build step anywhere on that chain).
|
|
442
458
|
|
|
443
459
|
> Verified locally (BM: Windows 11 ARM64): the whole tree/dependency chain hangs directly off the plugin's
|
|
444
460
|
> dependency table — the tree package `@jinsiyu/dshcs-vscode-server` (currently 4.137.0, a 50.8 MB tarball),
|
|
@@ -452,13 +468,12 @@ Diagnostics: `GET /api/code-server/status` exposes
|
|
|
452
468
|
|
|
453
469
|
```powershell
|
|
454
470
|
cd C:\Users\User\Desktop\dsh-code-server-app
|
|
455
|
-
pnpm install # dev
|
|
456
|
-
pnpm run build:webview # ask panel: official Markdown renderer + panel shell → webview/thread.{js,css} (not committed; must be built first)
|
|
471
|
+
pnpm install # one dev dependency left (@deepseek-ai/schemastery); allowBuilds is explicit → no postinstall runs
|
|
457
472
|
pnpm run vendor:check # optional: show the bundled tree version vs the latest code-server release
|
|
458
473
|
pnpm run vendor:vscode # ① produce vendor/vscode (the trimmed VS Code tree, ~197MB)
|
|
459
474
|
pnpm run repack:build -- --target win32-arm64,win32-x64 --pack # ② one script builds every sub-package
|
|
460
475
|
pnpm run publish:repacks # ③ publish every @jinsiyu/* sub-package (default dist-tag: next)
|
|
461
|
-
pnpm pack # ④ → dsh-code-server-app-<version>.tgz
|
|
476
|
+
pnpm pack # ④ → dsh-code-server-app-<version>.tgz
|
|
462
477
|
pnpm run publish:plugin # ⑤ publish the plugin itself (default dist-tag: next)
|
|
463
478
|
# once the user has restarted dsh web and confirmed it works, promote latest:
|
|
464
479
|
pnpm run promote -- <version>
|
|
@@ -473,13 +488,11 @@ pnpm run promote -- <version>
|
|
|
473
488
|
> so their dist-tags do not affect resolution, but they default to `next` as well.
|
|
474
489
|
> Inspect the current tags with `npm dist-tag ls dsh-code-server-app`.
|
|
475
490
|
|
|
476
|
-
>
|
|
477
|
-
>
|
|
478
|
-
>
|
|
479
|
-
>
|
|
480
|
-
>
|
|
481
|
-
> Rationale (why not an iframe, where the tokens come from, size trade-offs) is section 21 of
|
|
482
|
-
> `docs/analysis-code-server-as-dsh-plugin.md`.
|
|
491
|
+
> **There is no build step on this chain**: `lib/client.js` — including the "ask DSH" dialog panel — is committed
|
|
492
|
+
> hand-written source, and so is the extension (plain JS). `prepack` is down to `vendor:vscode`, the published
|
|
493
|
+
> package carries no frontend bundle, and `devDependencies` holds exactly one entry (`@deepseek-ai/schemastery`,
|
|
494
|
+
> used by the tests).
|
|
495
|
+
> The per-version analysis of the panel and the DSH page lives in `docs/analysis-code-server-as-dsh-plugin.md`.
|
|
483
496
|
|
|
484
497
|
`repack:build` (`scripts/vendor-repacks.mjs`) is the **single script that produces every sub-package**:
|
|
485
498
|
|
|
@@ -513,7 +526,7 @@ Both workflows live in `.github/workflows/`, and the regression list exists exac
|
|
|
513
526
|
|
|
514
527
|
| Workflow | Trigger | What it does |
|
|
515
528
|
|---|---|---|
|
|
516
|
-
| `ci.yml` | push to `main` / PR / manual | `ubuntu-latest` + `windows-latest` matrix: `pnpm install --frozen-lockfile` → `
|
|
529
|
+
| `ci.yml` | push to `main` / PR / manual | `ubuntu-latest` + `windows-latest` matrix: `pnpm install --frozen-lockfile` → `pnpm test` (the whole suite; since 0.3.59 there is **no build step in front of it**) → `vendor:check` (report only) |
|
|
517
530
|
| `release.yml` | push a `v<version>` tag / manual (rehearsal, never publishes) | prepares `vendor/vscode` **at the version pinned in `dependencies`** → builds → full suite → `pnpm pack` → verifies the tarball manifest → **really installs it twice** (windows-latest proves the 16 win32 sub-packages, ubuntu-latest the 10 Linux ones: each deploys a real DSH, installs via the official path `dsh plugin --profile web add <tgz>`, then runs the `test:installed` + `dump-config` assertions; both legs must pass before anything is published) → publishes to npm **`next`** → creates a GitHub Release with the tgz attached |
|
|
518
531
|
| `linux-repack-probe.yml` | push to this file / manual | **feasibility probe (never publishes; superseded by the Linux legs of `repacks.yml`)**: on Linux, builds the platform-specific repack packages per target (`linux-x64` → `ubuntu-latest`, `linux-arm64` → `ubuntu-24.04-arm`) and reports which modules really produce a `.node` and which are Windows-only. It runs the existing `vendor-repacks.mjs` itself; all writes happen in a copy of the repo under `$RUNNER_TEMP`. **Note**: it emits one notice per module, which hits GitHub's ~20-annotations-per-check-run cap and leaves only the tail; for the full verdict use the Linux legs of `repacks.yml` (one summary line per target) |
|
|
519
532
|
| `repacks.yml` | manual (`publish` and `probe_oidc` both default to **false**, the four `build_*` legs default to **true**) / push to this file / push `.github/oidc-probe.enabled` | **builds and publishes the platform-specific sub-packages** (`@jinsiyu/dshcs-*`): one host-architecture runner per target (`win32-x64` → `windows-latest`, `win32-arm64` → `windows-11-arm`, `linux-x64` → `ubuntu-latest`, `linux-arm64` → `ubuntu-24.04-arm`); by default it only builds and uploads `repack/tgz/*.tgz`, and only publishes to npm (default `next`) when `publish` is checked. Ownership and ordering (**five legs, disjoint sets**): the `independent` leg runs **first** (windows-latest; it produces the **VS Code tree package + the 8 platform-independent repacks**, which are the same artifact for all four targets and are therefore published only once); the four platform-specific legs `needs: independent`, build with `--skip-independent` and publish with `--only <their own target>` ⇒ a broken base layer blocks the rest (no half-published state) and no package name is ever published twice. **Auth**: with no `NPM_TOKEN` it uses OIDC (per-package trust entries, all with workflow `repacks.yml` — see below). The Linux legs additionally verify that the `lib/vendored.json` / `package.json` they generate match the committed ones (the platform policy is meant to be host-independent). A `probe-oidc` job additionally does a **staged-only** probe of that OIDC route, so the channel can be proven without publishing anything real |
|
|
@@ -612,8 +625,8 @@ pnpm test:apply # apply() under a stub ctx
|
|
|
612
625
|
pnpm test:claim-types # claim-type syntax and defaults
|
|
613
626
|
pnpm test:bridge-routes # bridge route whitelist (read-only + /approve + /old) / Origin-vs-token order / token header agreement
|
|
614
627
|
pnpm test:edit-snapshot # pre-write snapshots: value.before from tools/post-execute, session-cwd path resolution, triple-bounded cache, /old's 400-404-200
|
|
615
|
-
pnpm test:bridge-extension # extension-side pure logic (dirty buffers, diagnostics, diff old-side priority, delivery,
|
|
616
|
-
pnpm test:
|
|
628
|
+
pnpm test:bridge-extension # extension-side pure logic (dirty buffers, diagnostics, diff old-side priority, delivery, ask intent + "dialog unavailable" notice)
|
|
629
|
+
pnpm test:ask-dialog # ask-dialog wiring: no artifacts/build chain left, the host's four ask routes, the extension only reporting editor state, the four approval constraints, the bridge's safety invariants
|
|
617
630
|
pnpm test:launcher-routes # launcher HTTP surface (spawns a real process; slow)
|
|
618
631
|
pnpm test:workspace-switch # switching workspaces does not restart the process
|
|
619
632
|
pnpm test:workspace-cwd # "current workspace directory" resolution (DSH 0.1.6-alpha.2 sessionId vs. the older current)
|
|
@@ -726,9 +739,6 @@ one itself (with no `NPM_TOKEN` it uses OIDC):
|
|
|
726
739
|
probe versions (`npm stage list`, then `npm stage reject <id>`; needs 2FA on your machine) — do **not**
|
|
727
740
|
approve, since approving is what would turn a probe into a real version. Delete the sentinel file to
|
|
728
741
|
return to "no automatic probe".
|
|
729
|
-
- **Optional** repository variable `DSH_UI_VERSION` = the version of `@deepseek-ai/dsh-web-frontend` in the current
|
|
730
|
-
deployment: when set, `release.yml` enforces that the panel renderer matches the deployed UI (the local
|
|
731
|
-
`build:webview` always checks this; a runner has no DSH deployment).
|
|
732
742
|
|
|
733
743
|
Things you must know:
|
|
734
744
|
|
|
@@ -741,8 +751,9 @@ Things you must know:
|
|
|
741
751
|
assertion). Packing happens only in `release.yml`, after
|
|
742
752
|
`node scripts/vendor-vscode-server.mjs --version <pinned>`.
|
|
743
753
|
- **Release gates** (any failure stops the run; `next` is never advanced): tag ≠ `package.json.version`, the
|
|
744
|
-
version already exists on npm, the tree version does not match (`test:vendored`), the suite fails, or
|
|
745
|
-
|
|
754
|
+
version already exists on npm, the tree version does not match (`test:vendored`), the suite fails, or the
|
|
755
|
+
tarball manifest / the two real-install legs disagree. (0.3.59 dropped one gate: the panel renderer no longer
|
|
756
|
+
needs to match the deployed DSH UI — it *is* that instance.)
|
|
746
757
|
- `@deepseek-ai/schemastery` is a **devDependency** (pinned to 3.18.2, the version the deployment uses):
|
|
747
758
|
`lib/index.js` normally takes it from the DSH deployment (in production, the copy hoisted inside the
|
|
748
759
|
profile), and a clean clone / CI runner has no DSH at all — without this devDependency the `apply`-style
|
|
@@ -857,7 +868,7 @@ Costs and rules (read before editing `lib/client.js`):
|
|
|
857
868
|
| Rule | Why | Enforced by |
|
|
858
869
|
|---|---|---|
|
|
859
870
|
| No top-level `import`/`export`/`await` | syntax errors in a classic script ⇒ the whole client half fails to load (empty UI) | `pnpm test:client-entry` E1 + the harness really loading it (E3) |
|
|
860
|
-
| `require(...)` may only name `react` / `react/jsx-runtime` | the DSH module table is frozen; anything else throws "unknown module" | E1 |
|
|
871
|
+
| `require(...)` may only name DSH module-table seed words (`react` / `react/jsx-runtime` / `react-dom/client` / `@deepseek-ai/dsh-client-ui-primitives`) | the DSH module table is frozen; anything else throws "unknown module" | E1 (and, when a local DSH install exists, it cross-checks the real `staticModules` list word by word) |
|
|
861
872
|
| Every section's top-level identifiers share one scope | after inlining, a `var`/`function` collision is a **silent overwrite** (real hit: `state` existed in both the surface and the plugin body — the former is now `surfaceState`) | no automatic guard ⇒ grep before adding a top-level name |
|
|
862
873
|
| The claim-types section is a **copy** | a classic script cannot reach the host module `lib/claim-types.js` | E2 compares both over a sample table |
|
|
863
874
|
|
|
@@ -865,8 +876,35 @@ Size: ~114 KB uncompressed (was a 49.7 KB minified artifact) — a one-time down
|
|
|
865
876
|
unchanged. Test hook: the entry exports `__internals` only when `window.__dshcsTestHooks === true` (used by
|
|
866
877
|
`test-workspace-cwd.mjs` / `test-sidebar-fullscreen.mjs` to call pure functions); DSH never sets that flag.
|
|
867
878
|
|
|
868
|
-
|
|
869
|
-
|
|
879
|
+
### Why the "ask DSH" dialog has no build step
|
|
880
|
+
|
|
881
|
+
The dialog's panel (conversation stream, collapsible thinking rows, approval cards, input box) lives **inside
|
|
882
|
+
`lib/client.js`** — hand-written, committed, with no artifact, no `/ask/bundle`, no injected `<script>` and no fake
|
|
883
|
+
`acquireVsCodeApi`.
|
|
884
|
+
|
|
885
|
+
Why it can work that way: the dialog already runs **inside the DSH page**, and the shell's module table
|
|
886
|
+
(`staticModules` of `dsh-web-frontend`) freezes `react` / `react/jsx-runtime` / `react-dom` / `react-dom/client` /
|
|
887
|
+
`@deepseek-ai/dsh-client-ui-primitives` / … — so the panel simply requires them:
|
|
888
|
+
|
|
889
|
+
- the renderer, the design tokens, the KaTeX styles and the shiki grammars **all come from the page** (the same
|
|
890
|
+
instance the DSH UI uses) ⇒ typography matches the UI and a version mismatch is impossible;
|
|
891
|
+
- the panel creates its own React root via `require('react-dom/client')` (its container is the dialog's own div);
|
|
892
|
+
- opening the dialog has no "fetch + parse + execute" step to wait for — there is no artifact.
|
|
893
|
+
|
|
894
|
+
Costs and rules:
|
|
895
|
+
|
|
896
|
+
| Rule | Why | Enforced by |
|
|
897
|
+
|---|---|---|
|
|
898
|
+
| CSS injected into the page may only target `.dshcs-*` | the styles land in DSH's own document; touching `:root`/`body` would restyle the whole UI | `pnpm test:ask-panel` P3 (every selector + a ban on at-rules) |
|
|
899
|
+
| Every `var(--vscode-*)` needs a fallback | the DSH page has no `--vscode-*`; a bare `var()` is invalid at computed-value time ⇒ transparent buttons/inputs | P3 |
|
|
900
|
+
| A component with hooks may only be written as `React.createElement(Name, …)` | there is no JSX here; `Name({…})` puts the child's `useState` into the parent's hook chain, and a changed branch throws "Rendered more hooks than during the previous render" | P4 (source-level lookbehind regex) |
|
|
901
|
+
| Official components must be resolved as "function **or** `{$$typeof}` object" | `MarkdownText` is a `React.memo` product (an **object**); testing `typeof === 'function'` silently degraded every body to `<pre>` | P4's `askComponent` cases |
|
|
902
|
+
| Missing seed words / official components must degrade | the panel is the primary path; a blank panel means asking is broken | P5 (`<pre>` body, native `button`) + an error boundary |
|
|
903
|
+
| Three message routes (ask / approve / close) | panel and shell share one window (no postMessage), so messages must reach `/ask/send|approve|close` | P6 |
|
|
904
|
+
|
|
905
|
+
The extension side has no build step either: it is plain JS (`extension.js` + `lib/*.js`) and only reports intent.
|
|
906
|
+
Those two "no build step" claims are guarded by `pnpm test:client-entry` / `pnpm test:ask-panel` (the panel itself)
|
|
907
|
+
and `pnpm test:ask-dialog` (the wiring, plus "not one trace of the build chain may remain").
|
|
870
908
|
|
|
871
909
|
### Development: install from source (changes take effect immediately)
|
|
872
910
|
|
|
@@ -879,13 +917,12 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
879
917
|
> too — but the not-yet-published local `@jinsiyu/*` packages must either be published first, or the
|
|
880
918
|
> `repack/tgz/*.tgz` files must be installed into the profile as `file:` dependencies.
|
|
881
919
|
>
|
|
882
|
-
> **Changing the client half**: edit `lib/client.js` directly (
|
|
883
|
-
>
|
|
884
|
-
>
|
|
885
|
-
>
|
|
886
|
-
>
|
|
887
|
-
>
|
|
888
|
-
> to pick it up, because the extension host caches the webview resources).
|
|
920
|
+
> **Changing the client half / the ask dialog**: edit `lib/client.js` directly (it is **hand-written source**:
|
|
921
|
+
> no build step, no `src/**` layer; the format rules are in that file's header and are enforced by
|
|
922
|
+
> `pnpm test:client-entry` and `pnpm test:ask-panel`). After installing into a profile a hard refresh picks it up.
|
|
923
|
+
> **Changing the extension**: edit `assets/extensions/dshcs-editor-bridge/{extension.js,lib/*.js}` (plain JS, no
|
|
924
|
+
> build). The IDE side needs one restart to load the new extension code, because the extension host caches loaded
|
|
925
|
+
> extensions.
|
|
889
926
|
|
|
890
927
|
### Pack-machine environment (the user machine needs nothing)
|
|
891
928
|
|
|
@@ -1105,16 +1142,12 @@ What remains on the plugin side:
|
|
|
1105
1142
|
or by simply calling `editor_context` — 0.3.0–0.3.11 sat in the state "health says bridge:true, extension never
|
|
1106
1143
|
loaded" (cause above: the user-level install was marked `.obsolete`).
|
|
1107
1144
|
- **Bridged state can lag by up to 600 ms**, and the tools say "stale" rather than serving data older than 10 s.
|
|
1108
|
-
- **The
|
|
1145
|
+
- **The dialog renders only "new content"**: the subscription starts when the dialog opens, the history
|
|
1109
1146
|
`records` from `follow`'s opening frame are discarded, and the panel has **no "load earlier"** (the history-paging
|
|
1110
1147
|
API `sessionController.page()` is deliberately not called in this version). Switch to the DSH UI for older content.
|
|
1111
|
-
- **
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
For the full set: `node scripts/build-webview.mjs --all-grammars`.
|
|
1115
|
-
- **Panel assets are pinned to the DSH version**: the renderer is bundled against the UI version of the deployed
|
|
1116
|
-
DSH, so after upgrading DSH you must rebuild the panel (`pnpm run build:webview`; the build fails loudly on a
|
|
1117
|
-
version mismatch). The panel also shows a mismatch notice at runtime instead of silently using the wrong renderer.
|
|
1148
|
+
- **Highlighting follows DSH's own lazily-loaded grammar set**: the panel uses the page's renderer instance, so
|
|
1149
|
+
there is no "the artifact only carries a few grammars" limitation.
|
|
1150
|
+
- **A renderer version mismatch is impossible**: the panel requires the very instance the UI uses.
|
|
1118
1151
|
- **The approval window in the panel is 5 minutes**: while the panel is open, approvals ask the panel first (the card
|
|
1119
1152
|
shows a countdown); **closing the panel** or letting the 5 minutes run out hands the request back to the DSH UI —
|
|
1120
1153
|
after that, that request can **only** be answered there (the card disappears from the panel and the thread keeps an
|