dsh-webui-studio 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CH4ACKO3
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/PRODUCT.md ADDED
@@ -0,0 +1,74 @@
1
+ # Product
2
+
3
+ <!-- impeccable:product-schema 1 -->
4
+
5
+ ## Platform
6
+
7
+ web
8
+
9
+ ## Users
10
+
11
+ The primary users are developers who build, adapt, and debug DeepSeek Harness WebUI plugins and Harmony patches. They need to understand the live WebUI, work against the same plugin graph their users run, and turn changes into distributable plugin-owned patches instead of editing installed DSH sources.
12
+
13
+ The wider product context also includes DSH users who install plugins and manage Harmony patch order. Studio does not replace their normal DSH workflow; it helps plugin developers produce changes that remain compatible with that workflow.
14
+
15
+ ## Product Purpose
16
+
17
+ `dsh-webui-studio` is a local development environment for creating and modifying DSH WebUI plugins as isolated Draft layers. It combines an interactive real WebUI preview, DOM and React inspection, source editing, build and Harmony activation, readiness checks, and DSH-hosted Agent assistance without loading in-progress plugin code into the user's stable DSH Host.
18
+
19
+ Success means a developer can start from a new package or an existing local plugin folder, test the Draft against a representative DSH profile, trace previewed UI back to relevant source, make a plugin-shaped change, and verify the activated result while the stable DSH environment remains usable.
20
+
21
+ ## Positioning
22
+
23
+ Studio is not a generic page builder and does not treat the rendered WebUI as freely editable application source. It treats each change as a plugin or Harmony patch layered over an existing DSH WebUI whose components and data may come from multiple plugins.
24
+
25
+ Its defining mechanism is a stable DSH control plane paired with one isolated Git worktree, child `DSH_HOME`, dependency tree, Harmony state, and child Preview Host per Draft. This lets multiple Drafts run concurrently and preserves the real DSH plugin and Patch semantics during development.
26
+
27
+ ## Operating Context
28
+
29
+ Studio is served by a stable local `dsh web` Host at `/studio`. The stable Host owns the Studio interface, Draft registry, and Agent sessions. Each running Draft is previewed by a separate child `dsh web` Host inside Studio's main iframe, which can expand to fullscreen.
30
+
31
+ Developers may create a minimal new Web Client plugin or import an existing local plugin folder as an isolated snapshot. A new plugin remains Studio-only by default; creation may record an optional absolute destination for a new or empty local folder, but Studio does not touch that folder until the user explicitly saves the project there. Later explicit saves synchronize the Studio snapshot without deleting destination-only files. Studio validates the Web Client manifest, excludes `.git` and `node_modules`, rejects symbolic links, and commits the copy into a Studio-owned Git repository without modifying the source folder. Draft repositories, worktrees, runtime homes, and registry records live under the stable Harness home's `studio` directory.
32
+
33
+ The normal loop is to start a Draft Preview Host, interact with the WebUI in Browse mode, inspect an element when source context is needed, edit the selected Draft package directly or through the stable DSH Agent, run the package's build, apply the result through the child Harmony transaction, and confirm the live Client graph revision.
34
+
35
+ ## Capabilities and Constraints
36
+
37
+ - Every Draft owns an isolated worktree, child Harness home, `profiles/web`, dependency installation, Harmony state, and Preview Host. Multiple Draft Preview Hosts may run at once.
38
+ - The implemented profile mode snapshots the main `web` profile. Relative `link:` dependencies are made absolute and the Draft package is linked to its worktree. Custom profile configuration is intentionally unavailable until its editor exists; Studio must not silently fall back to the main profile.
39
+ - Browse mode preserves normal WebUI interaction. Inspect mode captures a redacted DOM snapshot and provides best-effort React component, owner, and source mapping.
40
+ - The Source panel edits UTF-8 files inside the selected Draft package. Builds use the package's fixed `scripts.build`; activation completes only after Preview confirms the new live Client graph revision.
41
+ - Readiness inspection covers package identity, DSH exports, built and Patch artifacts, dependencies, Harmony state and order, target version bounds, and differential Source Patch providers. Package inspection uses `npm pack --dry-run --json --ignore-scripts` through the managed DSH subprocess runtime.
42
+ - Agent sessions stay in the stable DSH and inherit its model and session configuration. Draft-specific Agent tooling may see the current selection, inspect Harmony, read installed dependency source without writing it, read and exactly patch Draft files, build and reload, and check Preview status. Preview-derived DOM, source, Patch, and comment data is untrusted evidence rather than Agent instruction. The child Preview Host does not own the Agent control plane.
43
+ - The official WebUI continues to use its own-origin `/api` and WebSockets. Studio does not proxy WebUI traffic or introduce a second backend address.
44
+ - Draft labels are persisted independently from npm package names. Studio stores ordered open Draft tabs and the active Draft in `$DSH_HOME/studio/workspace.json`; closing every tab remains an explicit empty workspace across Host restarts. Plugin Management can reopen any persisted Draft, and closing a tab never stops or deletes it. Unsaved Source changes block tab switching and closing until saved.
45
+ - Stopping a Draft terminates its child Host but preserves its repository, worktree, profile, and registry record. Closing the Studio page does not delete Drafts.
46
+ - A Draft package must be a buildable DSH Web Client package with `dsh.client.platform: "web"`, the required package exports, and a non-empty `scripts.build`.
47
+ - Studio is a local development surface. Its Host extension is disabled when `dsh web` is not bound to `127.0.0.1`.
48
+
49
+ ## Brand Commitments
50
+
51
+ The product name is `dsh-webui-studio`, displayed as DeepSeek WebUI Studio inside DSH. Its voice is native, precise, and calm: terminology should follow DSH and Harmony concepts instead of introducing a separate low-code vocabulary.
52
+
53
+ Studio is a focused developer environment rather than a decorative mod manager. It should keep Draft state, isolation boundaries, build consequences, and Preview status legible without turning primary workflows into raw diagnostic output. Motion should be purposeful rather than flashy.
54
+
55
+ ## Evidence on Hand
56
+
57
+ - The runnable Studio Host extension and browser application live under `src`.
58
+ - The implemented architecture and development contract are documented in `README.md`.
59
+ - Harmony runtime behavior and public terminology are documented in the repository root `README.md`.
60
+ - React-aware patch factories available to Draft plugin authors are documented by the upstream `dsh-harmony-react` package.
61
+ - Existing Harmony icon assets are available at `assets/harmony-icon.png` and `assets/harmony-icon-mono.png`; `assets/webui-banner-example.jpg` is a WebUI integration example, not product proof.
62
+ - There are no confirmed customer testimonials, usage benchmarks, pricing claims, or deployment claims. Future product or marketing work must not fabricate them.
63
+
64
+ ## Product Principles
65
+
66
+ - Preserve the stable DSH environment: unfinished Draft code belongs in isolated Preview Hosts.
67
+ - Express changes as distributable plugin and Harmony artifacts, not arbitrary edits to installed WebUI sources.
68
+ - Preview the real system: retain DSH origin, plugin graph, data, and interaction semantics during testing.
69
+ - Make state transitions explicit: distinguish staged, built, preview-pending, active, stopped, and preserved Draft state.
70
+ - Keep the development loop layered and direct: inspect, edit, build, activate, and verify without hiding the underlying files or Patch behavior.
71
+
72
+ ## Accessibility & Inclusion
73
+
74
+ Follow the host WebUI accessibility baseline. Essential Studio actions need keyboard-accessible controls and visible focus; status and validation must not rely on color alone; reduced-motion preferences and the host theme's contrast-tested tokens must be respected.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ <div align="center">
2
+ <a href="https://github.com/CH4ACKO3/dsh-harmony">
3
+ <img width="132" alt="Harmony" src="assets/harmony-icon.png">
4
+ </a>
5
+
6
+ <h1>DeepSeek WebUI Studio</h1>
7
+
8
+ <p>
9
+ <strong>A visual-first studio for building DSH WebUI plugins.</strong>
10
+ <br />
11
+ Inspect the real interface, edit source, run builds, and validate patches without loading unfinished code into your stable DSH Host.
12
+ <br />
13
+ Powered by <a href="https://github.com/CH4ACKO3/dsh-harmony"><strong>dsh-harmony</strong></a>.
14
+ </p>
15
+
16
+ <p>
17
+ <a href="#getting-started"><strong>Get started</strong></a>
18
+ ·
19
+ <a href="https://github.com/CH4ACKO3/dsh-webui-studio/issues">Report a bug</a>
20
+ ·
21
+ <a href="https://github.com/CH4ACKO3/dsh-webui-studio/issues">Request a feature</a>
22
+ </p>
23
+
24
+ [![License: MIT](https://img.shields.io/badge/license-MIT-0b63f6.svg)](LICENSE)
25
+ [![CI](https://github.com/CH4ACKO3/dsh-webui-studio/actions/workflows/ci.yml/badge.svg)](https://github.com/CH4ACKO3/dsh-webui-studio/actions/workflows/ci.yml)
26
+ [![npm](https://img.shields.io/npm/v/dsh-webui-studio.svg?color=0b63f6)](https://www.npmjs.com/package/dsh-webui-studio)
27
+ [![Node.js](https://img.shields.io/badge/node-%5E22.22.3%20%7C%7C%20%3E%3D24.11.1-2f6f3e.svg)](package.json)
28
+ [![GitHub stars](https://img.shields.io/github/stars/CH4ACKO3/dsh-webui-studio?style=flat&color=0b63f6)](https://github.com/CH4ACKO3/dsh-webui-studio/stargazers)
29
+ [![Powered by Harmony](https://img.shields.io/badge/powered%20by-dsh--harmony-111827.svg)](https://github.com/CH4ACKO3/dsh-harmony)
30
+
31
+ [简体中文](README.zh-CN.md) / [English](README.md)
32
+ </div>
33
+
34
+ ## A visual workspace for the real DSH WebUI
35
+
36
+ WebUI Studio is not a mock page builder. It runs against the official DSH WebUI
37
+ and its real plugin graph, then turns visual inspection and source edits into
38
+ distributable plugin-owned artifacts.
39
+
40
+ Studio is an independent downstream application of
41
+ [`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony). It uses Harmony's
42
+ public Host extension, runtime, Patch engine, and Draft APIs together with the
43
+ generic React registration API from
44
+ [`dsh-harmony-react`](https://github.com/CH4ACKO3/dsh-harmony/tree/main/packages/react).
45
+ The dependency direction stays one-way: Studio depends on Harmony; Harmony does
46
+ not depend on Studio.
47
+
48
+ ## What you can do
49
+
50
+ - [x] Create a minimal DSH Web Client plugin or import an existing local plugin folder
51
+ - [x] Give every Draft its own Git worktree, `DSH_HOME`, profile, dependencies, and child Host
52
+ - [x] Preview the official WebUI without loading Draft code into the stable Host
53
+ - [x] Browse normally or inspect DOM, React owners, source candidates, and Patch traces
54
+ - [x] Edit Draft source with CodeMirror and protect installed dependency sources as read-only
55
+ - [x] Build, apply through Harmony, reload, and confirm the live Client graph revision
56
+ - [x] Run Draft-scoped DSH Agents with explicit Studio tools
57
+ - [x] Check package exports, artifacts, Patch state, ordering, dependencies, and pack output
58
+ - [x] Run multiple isolated Draft Preview Hosts at the same time
59
+ - [ ] Configure custom Draft profiles in the UI
60
+
61
+ ## How it works
62
+
63
+ ```mermaid
64
+ flowchart LR
65
+ A["Stable DSH Host"] --> B["WebUI Studio"]
66
+ B --> C["Draft worktree"]
67
+ B --> D["Draft worktree"]
68
+ C --> E["Isolated DSH Home + Preview Host"]
69
+ D --> F["Isolated DSH Home + Preview Host"]
70
+ E --> G["Harmony runtime + real WebUI"]
71
+ F --> G
72
+ ```
73
+
74
+ The stable Host owns the Studio interface, Draft registry, and Agent sessions.
75
+ Each Draft owns an isolated worktree and child Preview Host. A build becomes
76
+ active only after the Preview confirms the new live Client graph revision.
77
+ Stopping a Draft terminates its child Host but preserves its files and state.
78
+
79
+ Studio is served locally at:
80
+
81
+ ```text
82
+ http://127.0.0.1:<dsh-port>/studio
83
+ ```
84
+
85
+ Its managed data lives under `$DSH_HOME/studio/`:
86
+
87
+ ```text
88
+ studio/
89
+ ├── workspace.json
90
+ ├── drafts/<draft-id>.json
91
+ ├── repositories/<draft-id>/
92
+ ├── worktrees/<draft-id>/
93
+ └── runtimes/<draft-id>/dsh-home/profiles/web/
94
+ ```
95
+
96
+ Creating a new plugin initializes and commits a minimal DSH Web Client package.
97
+ New plugins stay inside Studio by default. Creation can optionally record an
98
+ absolute destination for a new or empty local folder; Studio does not create
99
+ or modify that folder until **Save plugin to folder** is used from the instance
100
+ panel. Later saves synchronize the Studio-owned project snapshot while leaving
101
+ destination-only files such as `node_modules` untouched.
102
+ Importing an existing plugin accepts an absolute local folder after validating
103
+ its Web Client manifest, then copies an isolated snapshot without `.git` or
104
+ `node_modules` into a Studio-owned Git repository. Symbolic links are rejected,
105
+ and the original folder is never modified.
106
+
107
+ Draft display names are independent from npm package identities and can be
108
+ renamed in the instance panel. Studio persists the ordered open tabs and active
109
+ Draft in `workspace.json`; closing a tab only removes it from the current
110
+ workspace and never stops or deletes the Draft. Plugin Management can reopen
111
+ any persisted Draft. Unsaved Source changes must be saved with `Ctrl+S` or
112
+ `Command+S` before switching or closing tabs.
113
+
114
+ ## Getting started
115
+
116
+ > [!IMPORTANT]
117
+ > Studio requires the public Harmony extension and Draft APIs documented in
118
+ > [`docs/harmony-api-requirements.md`](docs/harmony-api-requirements.md).
119
+ > `dsh-harmony@0.1.3` is the minimum compatible release.
120
+
121
+ ```sh
122
+ dsh plugin --profile web add dsh-webui-studio --allow-build=dsh-harmony
123
+ dsh web
124
+ ```
125
+
126
+ Harmony is resolved transitively and does not need to be installed as a second
127
+ plugin. The build permission allows its global-only DSH shim installer; normal
128
+ profile installs do not modify the global command.
129
+
130
+ To develop Studio itself from source:
131
+
132
+ ```sh
133
+ git clone https://github.com/CH4ACKO3/dsh-webui-studio.git
134
+ cd dsh-webui-studio
135
+ npm install
136
+ npm run check
137
+
138
+ dsh plugin --profile web add link:$(pwd)
139
+ dsh web
140
+ ```
141
+
142
+ To exercise the same single-package installation path as a release artifact:
143
+
144
+ ```sh
145
+ studio_tarball="$(npm pack --silent --ignore-scripts)"
146
+ dsh plugin --profile web add "file:$(pwd)/${studio_tarball}" \
147
+ --allow-build=dsh-harmony
148
+ ```
149
+
150
+ Open the Studio URL printed by the local `dsh web` process, create or import a
151
+ Draft, and start its Preview Host.
152
+
153
+ A Draft package must:
154
+
155
+ - declare `dsh.client.platform: "web"`;
156
+ - export `.`, `./client`, and `./package.json`;
157
+ - define a non-empty `scripts.build` command.
158
+
159
+ ## Development
160
+
161
+ | Command | Purpose |
162
+ | --- | --- |
163
+ | `npm run typecheck` | Check the Host, browser app, and Preview bridge |
164
+ | `npm test` | Run the unit and component test suite |
165
+ | `npm run build` | Build the Host, Studio UI, and Preview bridge |
166
+ | `npm run check` | Run typecheck, tests, build, and packed fresh-install integration |
167
+ | `npm run test:integration` | Pack and install the tarball in a fresh DSH home, then exercise Host, Draft, Preview, build, activation, and shutdown end to end |
168
+
169
+ The integration test requires a Harmony build that exposes the APIs described
170
+ in the compatibility note above.
171
+
172
+ ## Design boundaries
173
+
174
+ - The official WebUI keeps its own-origin `/api` and WebSockets; Studio does not proxy them.
175
+ - The Preview bridge requires the exact parent origin and a per-start capability.
176
+ - Preview DOM, React, source, Patch, and comment data is treated as untrusted evidence.
177
+ - Source writes stay inside the selected Draft package and never follow symbolic links outside it.
178
+ - Registered element boundaries and Patch traces are candidate evidence, not claims of exact DOM ownership.
179
+
180
+ ## Frequently asked questions
181
+
182
+ ### How is Studio different from other WYSIWYG tools?
183
+
184
+ DSH WebUI changes are delivered through plugins rather than direct edits to
185
+ the upstream source. Its interface elements also participate in Cordis plugin
186
+ lifecycle and control logic, so the problem extends beyond manipulating static
187
+ DOM and CSS. Those constraints call for a dedicated toolkit that understands
188
+ the DSH plugin system from preview through distribution.
189
+
190
+ ### Why not simply ask an Agent to edit the source?
191
+
192
+ Studio still connects to the real Agent inside DSH. It gives that Agent richer
193
+ project context, integrated previews, purpose-built tools and skills, and a
194
+ tighter edit-build-inspect-validate loop. Studio does not replace the Agent; it
195
+ turns source editing into a more capable interactive workflow for both the
196
+ Agent and the developer.
197
+
198
+ ### What is Harmony, and why use it?
199
+
200
+ The DSH WebUI exposes many useful slots, but Studio aims for deeper and more
201
+ flexible changes—including UI and behavior introduced by other plugins—while
202
+ keeping independently authored modifications as compatible as possible.
203
+ [`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony) provides the runtime
204
+ patching and extension model that makes this possible.
205
+
206
+ ## Related projects
207
+
208
+ - [`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony) - runtime patching, Host extension mounting, Draft lifecycle, and Patch inspection
209
+ - [`dsh-harmony-react`](https://github.com/CH4ACKO3/dsh-harmony/tree/main/packages/react) - React-aware Patch factories and Studio element/variable registration
210
+
211
+ ## License
212
+
213
+ Distributed under the [MIT License](LICENSE).
@@ -0,0 +1,196 @@
1
+ <div align="center">
2
+ <a href="https://github.com/CH4ACKO3/dsh-harmony">
3
+ <img width="132" alt="Harmony" src="assets/harmony-icon.png">
4
+ </a>
5
+
6
+ <h1>DeepSeek WebUI Studio</h1>
7
+
8
+ <p>
9
+ <strong>DSH WebUI 插件的可视化优先开发环境。</strong>
10
+ <br />
11
+ 实时预览你的插件对 dsh webui 的修改效果,在可视化的集成开发工具中交互式地与 agent 协作构建插件客户端。
12
+ <br />
13
+ Powered by <a href="https://github.com/CH4ACKO3/dsh-harmony"><strong>dsh-harmony</strong></a>.
14
+ </p>
15
+
16
+ <p>
17
+ <a href="#快速开始"><strong>快速开始</strong></a>
18
+ ·
19
+ <a href="https://github.com/CH4ACKO3/dsh-webui-studio/issues">报告问题</a>
20
+ ·
21
+ <a href="https://github.com/CH4ACKO3/dsh-webui-studio/issues">功能建议</a>
22
+ </p>
23
+
24
+ [![License: MIT](https://img.shields.io/badge/license-MIT-0b63f6.svg)](LICENSE)
25
+ [![CI](https://github.com/CH4ACKO3/dsh-webui-studio/actions/workflows/ci.yml/badge.svg)](https://github.com/CH4ACKO3/dsh-webui-studio/actions/workflows/ci.yml)
26
+ [![npm](https://img.shields.io/npm/v/dsh-webui-studio.svg?color=0b63f6)](https://www.npmjs.com/package/dsh-webui-studio)
27
+ [![Node.js](https://img.shields.io/badge/node-%5E22.22.3%20%7C%7C%20%3E%3D24.11.1-2f6f3e.svg)](package.json)
28
+ [![GitHub stars](https://img.shields.io/github/stars/CH4ACKO3/dsh-webui-studio?style=flat&color=0b63f6)](https://github.com/CH4ACKO3/dsh-webui-studio/stargazers)
29
+ [![Powered by Harmony](https://img.shields.io/badge/powered%20by-dsh--harmony-111827.svg)](https://github.com/CH4ACKO3/dsh-harmony)
30
+
31
+ [简体中文](README.zh-CN.md) / [English](README.md)
32
+ </div>
33
+
34
+ ## 面向真实 DSH WebUI 的可视化工作区
35
+
36
+ WebUI Studio 不是模拟页面生成器。它运行在官方 DSH WebUI 和真实插件图谱之上,
37
+ 把可视化检查与源码修改转化为可分发、由插件自身拥有的产物。
38
+
39
+ Studio 是 [`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony)
40
+ 的独立下游应用。它通过公共 package exports 使用 Harmony 的 Host extension、runtime、
41
+ Patch engine 与 Draft API,并使用
42
+ [`dsh-harmony-react`](https://github.com/CH4ACKO3/dsh-harmony/tree/main/packages/react)
43
+ 提供的通用 React 注册 API。依赖始终保持单向:Studio 依赖 Harmony,Harmony 不依赖 Studio。
44
+
45
+ ## 你可以做什么
46
+
47
+ - [x] 创建最小 DSH Web Client 插件,或导入已有的本地插件文件夹
48
+ - [x] 为每个 Draft 分配独立 Git worktree、`DSH_HOME`、profile、依赖树和 child Host
49
+ - [x] 预览官方 WebUI,同时不把 Draft 代码加载进稳定 Host
50
+ - [x] 正常浏览,或检查 DOM、React owner、源码候选和 Patch trace
51
+ - [x] 使用 CodeMirror 编辑 Draft 源码,并保持已安装依赖源码只读
52
+ - [x] 构建、经 Harmony 应用、重载,并确认实时 Client graph revision
53
+ - [x] 运行带显式 Studio tools 的 Draft 级 DSH Agent
54
+ - [x] 检查 package exports、构建产物、Patch 状态、顺序、依赖和 pack 输出
55
+ - [x] 同时运行多个相互隔离的 Draft Preview Host
56
+ - [ ] 在 UI 中配置自定义 Draft profile
57
+
58
+ ## 工作原理
59
+
60
+ ```mermaid
61
+ flowchart LR
62
+ A["稳定 DSH Host"] --> B["WebUI Studio"]
63
+ B --> C["Draft worktree"]
64
+ B --> D["Draft worktree"]
65
+ C --> E["独立 DSH Home + Preview Host"]
66
+ D --> F["独立 DSH Home + Preview Host"]
67
+ E --> G["Harmony runtime + 真实 WebUI"]
68
+ F --> G
69
+ ```
70
+
71
+ 稳定 Host 负责 Studio 界面、Draft registry 和 Agent session。每个 Draft 拥有隔离的
72
+ worktree 与 child Preview Host。只有在 Preview 确认新的实时 Client graph revision 后,
73
+ 构建结果才会激活。停止 Draft 只终止 child Host,不会删除文件和状态。
74
+
75
+ Studio 的本地地址为:
76
+
77
+ ```text
78
+ http://127.0.0.1:<dsh-port>/studio
79
+ ```
80
+
81
+ 托管数据位于 `$DSH_HOME/studio/`:
82
+
83
+ ```text
84
+ studio/
85
+ ├── workspace.json
86
+ ├── drafts/<draft-id>.json
87
+ ├── repositories/<draft-id>/
88
+ ├── worktrees/<draft-id>/
89
+ └── runtimes/<draft-id>/dsh-home/profiles/web/
90
+ ```
91
+
92
+ 创建新插件时,Studio 会初始化并提交一个最小 DSH Web Client package,并默认只将它
93
+ 保存在 Studio 内。创建时也可以记录一个新建或空白本地文件夹的绝对路径;在实例面板
94
+ 显式点击“保存插件到文件夹”前,Studio 不会创建或修改该目录。后续保存会同步 Studio
95
+ 中的项目快照,同时保留目标目录独有的 `node_modules` 等文件。导入已有插件时,
96
+ Studio 只接受本机绝对文件夹路径;验证 Web Client manifest 后,它会跳过 `.git` 与
97
+ `node_modules`,将快照复制到 Studio 自有 Git repository。符号链接会被拒绝,原插件
98
+ 文件夹始终保持只读且不会被修改。
99
+
100
+ Draft 显示名与 npm package identity 相互独立,可在实例面板中重命名。Studio 会在
101
+ `workspace.json` 中保存标签顺序与当前 Draft;关闭标签只会将其移出当前工作区,不会
102
+ 停止或删除 Draft。所有持久化 Draft 都可以从插件管理页重新打开。Source 存在未保存
103
+ 修改时,必须先按 `Ctrl+S` 或 `Command+S` 保存,才能切换或关闭标签。
104
+
105
+ ## 快速开始
106
+
107
+ > [!IMPORTANT]
108
+ > Studio 依赖 [`docs/harmony-api-requirements.md`](docs/harmony-api-requirements.md)
109
+ > 中列出的 Harmony 公共 extension 与 Draft API,最低兼容版本为
110
+ > `dsh-harmony@0.1.3`。
111
+
112
+ ```sh
113
+ dsh plugin --profile web add dsh-webui-studio --allow-build=dsh-harmony
114
+ dsh web
115
+ ```
116
+
117
+ Harmony 会作为传递依赖自动解析,无需作为第二个插件单独安装。该构建权限用于允许其
118
+ 仅在全局安装时生效的 DSH shim 安装器;普通 profile 安装不会修改全局命令。
119
+
120
+ 如需开发 Studio 本身:
121
+
122
+ ```sh
123
+ git clone https://github.com/CH4ACKO3/dsh-webui-studio.git
124
+ cd dsh-webui-studio
125
+ npm install
126
+ npm run check
127
+
128
+ dsh plugin --profile web add link:$(pwd)
129
+ dsh web
130
+ ```
131
+
132
+ 如需用发布产物验证相同的单包安装流程:
133
+
134
+ ```sh
135
+ studio_tarball="$(npm pack --silent --ignore-scripts)"
136
+ dsh plugin --profile web add "file:$(pwd)/${studio_tarball}" \
137
+ --allow-build=dsh-harmony
138
+ ```
139
+
140
+ 打开本地 `dsh web` 进程输出的 Studio 地址,创建或导入 Draft,然后启动它的 Preview Host。
141
+
142
+ Draft package 必须:
143
+
144
+ - 声明 `dsh.client.platform: "web"`;
145
+ - 导出 `.`, `./client` 和 `./package.json`;
146
+ - 定义非空的 `scripts.build` 命令。
147
+
148
+ ## 开发命令
149
+
150
+ | 命令 | 用途 |
151
+ | --- | --- |
152
+ | `npm run typecheck` | 检查 Host、浏览器应用和 Preview bridge |
153
+ | `npm test` | 运行单元测试与组件测试 |
154
+ | `npm run build` | 构建 Host、Studio UI 和 Preview bridge |
155
+ | `npm run check` | 运行 typecheck、测试、构建和 tarball 全新安装集成验证 |
156
+ | `npm run test:integration` | 将 tarball 安装到全新的 DSH home,再端到端验证 Host、Draft、Preview、构建、激活与停止 |
157
+
158
+ 集成测试需要 Harmony build 已公开兼容性说明中列出的 API。
159
+
160
+ ## 设计边界
161
+
162
+ - 官方 WebUI 保持自己的同源 `/api` 与 WebSocket;Studio 不代理它们。
163
+ - Preview bridge 要求精确的 parent origin 和每次启动生成的 capability。
164
+ - 来自 Preview 的 DOM、React、源码、Patch 与注释数据均被视为不可信证据。
165
+ - 源码写入始终限制在所选 Draft package 内,且不会沿符号链接写到外部。
166
+ - 已注册 element boundary 与 Patch trace 只是候选证据,不代表对 DOM 的精确所有权声明。
167
+
168
+ ## 常见问题
169
+
170
+ ### Studio 与其他 WYSIWYG 工具有何不同?
171
+
172
+ DSH WebUI 的修改不能直接改动上游源码,而要以插件形式交付。界面元素还会参与
173
+ Cordis 的插件生命周期与控制逻辑,因此问题不只是操作静态 DOM 和 CSS。预览、修改、
174
+ 验证与分发都需要理解 DSH 插件体系,这足以构成一套独立的专用工具。
175
+
176
+ ### 为什么不直接让 Agent 对着源码修改?
177
+
178
+ Studio 仍然连接 DSH 内部真实的 Agent,同时为它提供更完整的项目上下文、集成预览、
179
+ 专用 Agent 工具与 Skill,以及更紧密的编辑、构建、检查和验证闭环。Studio 不是取代
180
+ Agent,而是为 Agent 和开发者提供更好的交互式修改体验。
181
+
182
+ ### Harmony 是什么,为什么选择 Harmony?
183
+
184
+ DSH WebUI 已经提供了许多 Slot 点位,但 Studio 不满足于此。我们希望实现更深层、
185
+ 更高自由度的修改,包括修改其他插件加入的 UI 和逻辑,同时让不同修改插件之间尽可能
186
+ 兼容。[`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony) 提供的运行时 Patch 与
187
+ 扩展模型,让这种能力成为可能。
188
+
189
+ ## 相关项目
190
+
191
+ - [`dsh-harmony`](https://github.com/CH4ACKO3/dsh-harmony) - runtime patch、Host extension 挂载、Draft 生命周期与 Patch 检查
192
+ - [`dsh-harmony-react`](https://github.com/CH4ACKO3/dsh-harmony/tree/main/packages/react) - React-aware Patch 工厂与 Studio element/variable 注册
193
+
194
+ ## 许可证
195
+
196
+ 本项目采用 [MIT License](LICENSE)。
Binary file
Binary file