@monotykamary/dsh-web-app 0.1.0-rc.5
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 +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +26 -0
- package/README.zh.md +26 -0
- package/cordis.patch.yml +424 -0
- package/lib/index.js +117 -0
- package/lib/invariant.js +25 -0
- package/lib/startup.js +50 -0
- package/lib/types/index.d.ts +62 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/startup.d.ts +32 -0
- package/package.json +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/bundle/web-app/README.md
|
|
5
|
+
README.md: 4b564ca4bbe5ee5f74b53fb3e4732d17f2393cbd
|
|
6
|
+
README.zh.md: 79dc4c61cab475e5dbc25bfa10a95393083c2012
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# `@monotykamary/dsh-web-app`
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
The dsh browser-surface bundle. [`cordis.patch.yml`](cordis.patch.yml) rides over [`dsh-base`](../base/README.md): it sets the coding persona, inserts the Web host rows (webserver, API gateway, workspace, projection cache, storage) and the browser plugin roster, the always-on client-plugin reload chain ([`dsh-client-hmr`](../../client/hmr/README.md), idle until a rebuild watcher rewrites client bundles), and mounts this package's `web-runtime` glue plugin (config `{printUrl, surfaceContext, trustedHosts}`). That plugin resolves the built frontend dist through `@monotykamary/dsh-web-frontend`'s exports, samples bind-dependent LAN trust once, provides it as `webRuntime` to the browser-trust fence and client roster, mounts the [`frontend-static`](../../host/frontend-static/README.md) fallback owner, registers the harness-source and web-surface prompt sections plus the bash-visible `DSH_WEB_URL` runtime variable when `surfaceContext` is true, and prints the `dsh web:` URL line when `printUrl` is true, after its Loader tree settles so a sibling failure cannot announce a dead app. This bundle also owns the app command line: the ordinary `web-startup` provider ([`src/startup.ts`](src/startup.ts)) injects `ctx.cmdlineArgs` ([`dsh-cmdline`](../../boot/cmdline/README.md)), parses `--host`, `--port`, repeatable `--trusted-host`, and the app's `--help`, then provides `webStartup`. It rejects `--host 0.0.0.0` before publishing that service because the CLI intentionally does not support all-interfaces binding yet. Flag-configured rows inject the service and read it directly from lazy config, so nothing binds a port before argument resolution and `dsh --profile web --help` starts no server. [`dsh-headless`](../headless/README.md) is a sibling surface over the same base and does not mount this bundle.
|
|
6
|
+
|
|
7
|
+
## Model Experience
|
|
8
|
+
|
|
9
|
+
### Harness-source and Web-surface context
|
|
10
|
+
|
|
11
|
+
#### What the model sees
|
|
12
|
+
|
|
13
|
+
When `surfaceContext` is true, the `harness:source` section identifies the on-disk Harness implementation without claiming it is the working directory, and the `app:web-surface` global section (order −98) orients the model to the GUI: the canonical local URL, the "this page" referent, the update contract (the reload receiver is always on; no-refresh reloads additionally need the `pnpm run dev:web` watcher), and the instruction not to start replacement servers. `DSH_WEB_URL` additionally appears in the managed bash environment with its description, resolved per invocation from the live server. When it is false, neither section nor the variable is registered.
|
|
14
|
+
|
|
15
|
+
#### Token effect
|
|
16
|
+
|
|
17
|
+
One source line and one prompt paragraph per session plus two managed-environment variable lines; constant per process.
|
|
18
|
+
|
|
19
|
+
#### KV Cache effect
|
|
20
|
+
|
|
21
|
+
The prompt section sits near the system prompt's head and is stable for the life of the process (the port is a boot fact), so it does not invalidate the cache across turns.
|
|
22
|
+
|
|
23
|
+
## Known Limitations and Deferred Work
|
|
24
|
+
|
|
25
|
+
- **The frontend dist must be built** — `require.resolve` of the dist fails loud at activation with a build hint; there is no source-serving fallback.
|
|
26
|
+
- **`lanAddresses` is a boot-time snapshot** — interface changes after boot are not re-advertised; the printed LAN URL always matches the configured trust fence.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# `@monotykamary/dsh-web-app`
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
dsh 浏览器表层组合包。[`cordis.patch.yml`](cordis.patch.yml) 叠加在 [`dsh-base`](../base/README.md) 之上:设置 coding persona,插入 Web 宿主行(webserver、API 网关、workspace、投影缓存、存储)、浏览器插件名录与始终挂载的客户端插件重载链([`dsh-client-hmr`](../../client/hmr/README.md),在重建 watcher 改写客户端 bundle 之前保持空闲),并挂载本包的 `web-runtime` 粘合插件(配置为 `{printUrl, surfaceContext, trustedHosts}`)。该插件通过 `@monotykamary/dsh-web-frontend` 的 exports 解析已构建的前端 dist,只采样一次依赖 bind 的 LAN 信任信息并将其作为 `webRuntime` 提供给浏览器信任栅栏和客户端名录,挂载 [`frontend-static`](../../host/frontend-static/README.md) 回退席位所有者,在 `surfaceContext` 为 true 时注册 Harness 源码与 Web 表层提示词段落,以及 bash 可见的 `DSH_WEB_URL` 运行时变量,并在 `printUrl` 为 true 时等自身的 Loader 配置树结算后再打印 `dsh web:` URL 行,避免兄弟行失败时公告一个已失效的应用。本组合包还持有应用命令行:普通 `web-startup` 提供方([`src/startup.ts`](src/startup.ts))注入 `ctx.cmdlineArgs`([`dsh-cmdline`](../../boot/cmdline/README.md)),解析 `--host`、`--port`、可重复的 `--trusted-host` 以及应用自己的 `--help`,再提供 `webStartup`。它会在发布该服务前拒绝 `--host 0.0.0.0`,因为 CLI 目前有意不支持绑定所有网络接口。由 flag 配置的行会注入该服务,并在惰性配置中直接读取它,因此参数解析完成前不会有任何东西绑定端口,`dsh --profile web --help` 也不会启动服务器。[`dsh-headless`](../headless/README.md) 是同一 base 之上的同级表层,不挂载本组合包。
|
|
6
|
+
|
|
7
|
+
## 模型体验
|
|
8
|
+
|
|
9
|
+
### Harness 源码与 Web 表层上下文
|
|
10
|
+
|
|
11
|
+
#### 模型看到的内容
|
|
12
|
+
|
|
13
|
+
当 `surfaceContext` 为 true 时,`harness:source` 段落标明磁盘上的 Harness 实现,但不会声称它就是工作目录;全局段落 `app:web-surface`(顺序 −98)则向模型说明 GUI:规范的本地 URL、「this page」指代什么、更新约定(重载接收端始终开启;无刷新重载还需要 `pnpm run dev:web` watcher),以及不要启动替代服务器的指令。`DSH_WEB_URL` 还会连同描述出现在受管 bash 环境中,每次调用时从运行中的服务器解析。当它为 false 时,这两个段落和该变量都不会注册。
|
|
14
|
+
|
|
15
|
+
#### Token 影响
|
|
16
|
+
|
|
17
|
+
每个会话一行源码说明和一段提示词,外加两行受管环境变量;每个进程内保持恒定。
|
|
18
|
+
|
|
19
|
+
#### KV Cache 影响
|
|
20
|
+
|
|
21
|
+
该提示词段落位于系统提示词靠前位置,且在进程整个生命周期内稳定(端口是启动期事实),因此不会使跨轮次缓存失效。
|
|
22
|
+
|
|
23
|
+
## 已知限制与延期工作
|
|
24
|
+
|
|
25
|
+
- **前端 dist 必须已构建**:对 dist 的 `require.resolve` 在激活时明确报错并给出构建提示;没有从源码直接服务的回退路径。
|
|
26
|
+
- **`lanAddresses` 是启动期快照**:启动后的网卡变化不会重新公告;打印的 LAN URL 始终与配置的信任栅栏一致。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
# The dsh-web-app bundle patch: the browser surface over the dsh-base layer.
|
|
2
|
+
# Applied after dsh-base's insert; rows here override base rows by id, with
|
|
3
|
+
# the profile's own cordis.patch.yml and any --patch overlays still to come.
|
|
4
|
+
#
|
|
5
|
+
# A patch replaces the targeted row's whole `config`, so each row below
|
|
6
|
+
# restates every key it owns.
|
|
7
|
+
#
|
|
8
|
+
# The web-startup plugin injects `cmdlineArgs` and provides `webStartup` as an
|
|
9
|
+
# ordinary Cordis service. Rows configured from flags inject that service, so
|
|
10
|
+
# Loader resolves their expressions only after it exists. The web runtime then
|
|
11
|
+
# provides bind-dependent `webRuntime` values to the trust fence.
|
|
12
|
+
# `dsh --profile web --help` provides neither service, so no server binds.
|
|
13
|
+
|
|
14
|
+
# ── surface-specific values the base deliberately omits ─────────────────────
|
|
15
|
+
|
|
16
|
+
- id: system-prompt
|
|
17
|
+
config:
|
|
18
|
+
persona: >-
|
|
19
|
+
You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
|
|
20
|
+
|
|
21
|
+
# TODO: Re-enable shared HMR for Web after its reload lifecycle is tested.
|
|
22
|
+
- id: hmr
|
|
23
|
+
disabled: true
|
|
24
|
+
|
|
25
|
+
# Full-text session search is opt-in (the base row's `openAt: never`). This
|
|
26
|
+
# restatement keeps the Web values on one ephemeral in-memory index; a
|
|
27
|
+
# deployment enabling content search overrides `openAt` to `first-search` in a
|
|
28
|
+
# later patch layer, which defers the node:sqlite import and in-memory handle
|
|
29
|
+
# to the first search so Node 22 startup stays quiet.
|
|
30
|
+
- id: session-query-sqlite
|
|
31
|
+
config:
|
|
32
|
+
path: ':memory:'
|
|
33
|
+
openAt: never
|
|
34
|
+
|
|
35
|
+
- id: tools
|
|
36
|
+
config:
|
|
37
|
+
# TEMPORARY workaround: DSH_TOOLS_MODE (native|code|both) opts a whole dsh
|
|
38
|
+
# process into Code Mode while per-session tool-presentation selection is being
|
|
39
|
+
# designed; unset keeps the schema default (native). Remove the env seam
|
|
40
|
+
# once the web UI owns the choice per session.
|
|
41
|
+
mode: !!js process.env.DSH_TOOLS_MODE
|
|
42
|
+
|
|
43
|
+
# ── web-only host rows, the transport layer, and the browser roster ─────────
|
|
44
|
+
|
|
45
|
+
# `dsh.client` rows are the browser roster the modules node half scans into
|
|
46
|
+
# window.__DSH_BOOT__; the modules row is simultaneously a host row.
|
|
47
|
+
- insert:
|
|
48
|
+
- id: code-runtime
|
|
49
|
+
name: '@monotykamary/dsh-code-runtime-worker-thread'
|
|
50
|
+
|
|
51
|
+
- id: storage
|
|
52
|
+
name: '@monotykamary/dsh-storage'
|
|
53
|
+
|
|
54
|
+
- id: storage-json
|
|
55
|
+
name: '@monotykamary/dsh-storage-json'
|
|
56
|
+
config:
|
|
57
|
+
root: !!js dshHomePath('storages')
|
|
58
|
+
|
|
59
|
+
- id: storage-domain
|
|
60
|
+
name: '@monotykamary/dsh-storage-domain'
|
|
61
|
+
config:
|
|
62
|
+
backend: json
|
|
63
|
+
|
|
64
|
+
- id: message-feedback
|
|
65
|
+
name: '@monotykamary/dsh-message-feedback'
|
|
66
|
+
config:
|
|
67
|
+
maxNoteBytes: 8192
|
|
68
|
+
|
|
69
|
+
# Browser Session export: `/export` command plus the shared download dialog.
|
|
70
|
+
- id: session-log-download
|
|
71
|
+
name: '@monotykamary/dsh-session-log-export'
|
|
72
|
+
|
|
73
|
+
- id: workspace
|
|
74
|
+
name: '@monotykamary/dsh-workspace'
|
|
75
|
+
|
|
76
|
+
- id: session-projection-cache
|
|
77
|
+
name: '@monotykamary/dsh-session-projection-cache'
|
|
78
|
+
config:
|
|
79
|
+
writeEveryEvents: 200
|
|
80
|
+
writeIntervalMs: 5000
|
|
81
|
+
|
|
82
|
+
# Whole-log turn/step counts for the chat stats strip (the sessionStats
|
|
83
|
+
# projection key); the projection registry itself is a base-layer row.
|
|
84
|
+
- id: session-stats
|
|
85
|
+
name: '@monotykamary/dsh-session-stats'
|
|
86
|
+
|
|
87
|
+
# Resolve bind host, SSH launch, and display once at boot, then mount the
|
|
88
|
+
# matching dual-face directory picker. Mount -native or -browse directly in
|
|
89
|
+
# an overlay to pin the interaction.
|
|
90
|
+
- id: directory-picker
|
|
91
|
+
name: '@monotykamary/dsh-host-directory-picker-auto'
|
|
92
|
+
|
|
93
|
+
# Read-only projection of current Loader entries for trusted client RPCs.
|
|
94
|
+
- id: plugin-inventory
|
|
95
|
+
name: '@monotykamary/dsh-host-plugin-inventory'
|
|
96
|
+
|
|
97
|
+
# The API gateway: the transport-agnostic dispatch face every client shape
|
|
98
|
+
# shares. The base layer's agent-default-model service owns the default model.
|
|
99
|
+
- id: api-gateway
|
|
100
|
+
name: '@monotykamary/dsh-host-apiproxy'
|
|
101
|
+
|
|
102
|
+
- id: cordis-host-runner
|
|
103
|
+
name: '@monotykamary/dsh-cordis-host-runner'
|
|
104
|
+
|
|
105
|
+
# Ordinary provider for the parsed Web flags. Its plugin-level injection
|
|
106
|
+
# waits for cmdlineArgs; no launcher metadata or special row kind is needed.
|
|
107
|
+
- id: web-startup
|
|
108
|
+
name: '@monotykamary/dsh-web-app/startup'
|
|
109
|
+
|
|
110
|
+
# ── layer 2: transport/service ──────────────────────────────────────────────
|
|
111
|
+
|
|
112
|
+
# Plain route-registration carrier; host and port come from the app's
|
|
113
|
+
# webStartup provider, with these deployment fallbacks. The dist is served by
|
|
114
|
+
# the web-runtime row below through the fallback seat.
|
|
115
|
+
- id: webserver
|
|
116
|
+
name: '@monotykamary/dsh-host-webserver'
|
|
117
|
+
inject: [webStartup]
|
|
118
|
+
config:
|
|
119
|
+
host: !!js ctx.webStartup.host ?? '127.0.0.1'
|
|
120
|
+
port: !!js ctx.webStartup.port ?? 3080
|
|
121
|
+
|
|
122
|
+
# Web glue owned by this bundle: resolves the built frontend dist (an
|
|
123
|
+
# assembly fact of dsh-web-app, never user config), mounts the
|
|
124
|
+
# frontend-static fallback owner, registers the web-surface prompt
|
|
125
|
+
# section and the bash runtime variable, and prints the URL line. The
|
|
126
|
+
# webStartup provider supplies invocation-only values; after the server
|
|
127
|
+
# binds, this row samples LAN trust once and provides `webRuntime`. A
|
|
128
|
+
# complete agent-preset persona suppresses the prompt section for that
|
|
129
|
+
# agent while retaining the host-owned shell variable.
|
|
130
|
+
- id: web-runtime
|
|
131
|
+
name: '@monotykamary/dsh-web-app'
|
|
132
|
+
inject: [webStartup]
|
|
133
|
+
config:
|
|
134
|
+
printUrl: true
|
|
135
|
+
surfaceContext: true
|
|
136
|
+
trustedHosts: !!js ctx.webStartup.trustedHosts
|
|
137
|
+
|
|
138
|
+
# The client-plugin reload chain, always mounted: it is idle until a
|
|
139
|
+
# rebuild watcher (pnpm run dev:web) actually rewrites client bundles. It
|
|
140
|
+
# is a row rather than a child of web-runtime because its node half is a
|
|
141
|
+
# client-side package, which a host-side bundle cannot import.
|
|
142
|
+
- id: client-hmr
|
|
143
|
+
name: '@monotykamary/dsh-client-hmr'
|
|
144
|
+
|
|
145
|
+
# ── browser plugin roster (dsh.client rows; node halves are layer-2 hosts) ──
|
|
146
|
+
|
|
147
|
+
# Dual-face: the node half scans this tree, composes window.__DSH_BOOT__,
|
|
148
|
+
# and serves /plugins/<id>/client.js; the browser half is the module table
|
|
149
|
+
# the shell kernel constructs before cordis exists (adopted as a plugin
|
|
150
|
+
# entry by the kernel, never fetched).
|
|
151
|
+
- id: modules
|
|
152
|
+
name: '@monotykamary/dsh-client-modules'
|
|
153
|
+
|
|
154
|
+
# Owns both ends of the web transport: node half binds the gateway to the
|
|
155
|
+
# webserver under /api; browser half is the fetch/SSE client.
|
|
156
|
+
- id: connection
|
|
157
|
+
name: '@monotykamary/dsh-client-connection'
|
|
158
|
+
inject: [webRuntime]
|
|
159
|
+
config:
|
|
160
|
+
# LAN literals derived from the active bind plus --trusted-host extras.
|
|
161
|
+
# A deployment adding authorities keeps this expression and concatenates
|
|
162
|
+
# its literals, for example: ['app.internal', ...ctx.webRuntime.trustedHosts].
|
|
163
|
+
trustedHosts: !!js ctx.webRuntime.trustedHosts
|
|
164
|
+
|
|
165
|
+
- id: api-remotes
|
|
166
|
+
name: '@monotykamary/dsh-api-remotes'
|
|
167
|
+
|
|
168
|
+
- id: client-runtime
|
|
169
|
+
name: '@monotykamary/dsh-client-runtime'
|
|
170
|
+
|
|
171
|
+
- id: cordis-client-runner
|
|
172
|
+
name: '@monotykamary/dsh-cordis-client-runner'
|
|
173
|
+
|
|
174
|
+
- id: ui-theme
|
|
175
|
+
name: '@monotykamary/dsh-client-ui-theme'
|
|
176
|
+
|
|
177
|
+
- id: locale
|
|
178
|
+
name: '@monotykamary/dsh-client-locale'
|
|
179
|
+
|
|
180
|
+
- id: ui-layout
|
|
181
|
+
name: '@monotykamary/dsh-client-ui-layout'
|
|
182
|
+
|
|
183
|
+
- id: ui-sidebar
|
|
184
|
+
name: '@monotykamary/dsh-client-ui-sidebar'
|
|
185
|
+
|
|
186
|
+
- id: ui-settings
|
|
187
|
+
name: '@monotykamary/dsh-client-ui-settings'
|
|
188
|
+
|
|
189
|
+
- id: ui-settings-general
|
|
190
|
+
name: '@monotykamary/dsh-client-ui-settings-general'
|
|
191
|
+
|
|
192
|
+
- id: ui-settings-models
|
|
193
|
+
name: '@monotykamary/dsh-client-ui-settings-models'
|
|
194
|
+
|
|
195
|
+
- id: ui-settings-plugin-inventory
|
|
196
|
+
name: '@monotykamary/dsh-client-ui-settings-plugin-inventory'
|
|
197
|
+
|
|
198
|
+
- id: ui-conversation
|
|
199
|
+
name: '@monotykamary/dsh-client-ui-conversation'
|
|
200
|
+
|
|
201
|
+
# Tool call tree, generic fallback, and keyed business Tool views.
|
|
202
|
+
- id: ui-tool
|
|
203
|
+
name: '@monotykamary/dsh-client-ui-tool'
|
|
204
|
+
|
|
205
|
+
- id: ui-cordis
|
|
206
|
+
name: '@monotykamary/dsh-client-ui-cordis'
|
|
207
|
+
|
|
208
|
+
# Durable workflow lifecycle as an independent Chat node after the
|
|
209
|
+
# existing generic workflow tool row.
|
|
210
|
+
- id: ui-workflow-run
|
|
211
|
+
name: '@monotykamary/dsh-client-ui-workflow-run'
|
|
212
|
+
|
|
213
|
+
# Turn tail: the produced-files row under each closing assistant message.
|
|
214
|
+
# Remove this entry to turn the surface off; the tail hole renders empty.
|
|
215
|
+
- id: ui-deliverables
|
|
216
|
+
name: '@monotykamary/dsh-client-ui-deliverables'
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
- id: ui-workspace
|
|
220
|
+
name: '@monotykamary/dsh-client-ui-workspace'
|
|
221
|
+
|
|
222
|
+
# Input triggers: the '/' | '@' pipeline (ui-input-trigger), the command surface over
|
|
223
|
+
# it (ui-commands), and the two reference sources (ui-skill / ui-subagent).
|
|
224
|
+
- id: ui-input-trigger
|
|
225
|
+
name: '@monotykamary/dsh-client-ui-input-trigger'
|
|
226
|
+
|
|
227
|
+
- id: ui-commands
|
|
228
|
+
name: '@monotykamary/dsh-client-ui-commands'
|
|
229
|
+
|
|
230
|
+
- id: ui-skill
|
|
231
|
+
name: '@monotykamary/dsh-client-ui-skill'
|
|
232
|
+
|
|
233
|
+
- id: ui-subagent
|
|
234
|
+
name: '@monotykamary/dsh-client-ui-subagent'
|
|
235
|
+
|
|
236
|
+
# Background jobs: the session-header list over the jobsBySession mirror.
|
|
237
|
+
- id: ui-jobs
|
|
238
|
+
name: '@monotykamary/dsh-client-ui-jobs'
|
|
239
|
+
|
|
240
|
+
# Goal surface: GoalBar in the input dock over the goal session projection.
|
|
241
|
+
- id: ui-goal
|
|
242
|
+
name: '@monotykamary/dsh-client-ui-goal'
|
|
243
|
+
|
|
244
|
+
# Per-message feedback: Like/Dislike plus an optional note in the
|
|
245
|
+
# assistant-message action strip, over the messageFeedback Remote.
|
|
246
|
+
- id: ui-message-feedback
|
|
247
|
+
name: '@monotykamary/dsh-client-ui-message-feedback'
|
|
248
|
+
|
|
249
|
+
# Model selection: the /model popupSelect + composer seat over session.models.
|
|
250
|
+
- id: ui-model-selection
|
|
251
|
+
name: '@monotykamary/dsh-client-ui-model-selection'
|
|
252
|
+
|
|
253
|
+
- id: ui-permission
|
|
254
|
+
name: '@monotykamary/dsh-client-ui-permission-presets'
|
|
255
|
+
|
|
256
|
+
# The agent-preset row in General settings: the default preset for
|
|
257
|
+
# sessions created later. Absent a roster it renders nothing.
|
|
258
|
+
- id: ui-agent-preset
|
|
259
|
+
name: '@monotykamary/dsh-client-ui-agent-preset'
|
|
260
|
+
|
|
261
|
+
# Plugin configuration: the host-plane sections a user owns, as expandable
|
|
262
|
+
# cards. A namespace this deployment does not expose renders nothing.
|
|
263
|
+
- id: ui-settings-plugins
|
|
264
|
+
name: '@monotykamary/dsh-client-ui-settings-plugins'
|
|
265
|
+
|
|
266
|
+
# Plan control: the composer plan seat over the plan projection + /plan channel.
|
|
267
|
+
- id: ui-plan
|
|
268
|
+
name: '@monotykamary/dsh-client-ui-plan'
|
|
269
|
+
|
|
270
|
+
- id: ui-user-questions
|
|
271
|
+
name: '@monotykamary/dsh-client-ui-user-questions'
|
|
272
|
+
|
|
273
|
+
- id: ui-trajectory
|
|
274
|
+
name: '@monotykamary/dsh-client-ui-trajectory'
|
|
275
|
+
|
|
276
|
+
# ── the agent plane moves behind agent presets ─────────────────────────────
|
|
277
|
+
#
|
|
278
|
+
# Every row below composes what ONE agent contributes to the host registries:
|
|
279
|
+
# its tools, its prompt sections, its delegation backends. The base keeps them
|
|
280
|
+
# for the TUI, which is single-session and composes its agent process-wide; the
|
|
281
|
+
# Web surface disables them here and lets each session mount a preset instead.
|
|
282
|
+
#
|
|
283
|
+
# Disabling rather than deleting is deliberate: the base is shared, and a row
|
|
284
|
+
# absent from a surface overlay would silently reappear the day someone reorders
|
|
285
|
+
# the composition.
|
|
286
|
+
|
|
287
|
+
# `shell-env` STAYS in the host plane: `apps/cli/src/web.ts` injects it to
|
|
288
|
+
# publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
|
|
289
|
+
# the criterion for host-plane ownership — injection resolves before any session
|
|
290
|
+
# exists, so there is no agent to key by. Behind a preset realm those variables
|
|
291
|
+
# would never reach the model's shell at all.
|
|
292
|
+
|
|
293
|
+
- id: tool-bash
|
|
294
|
+
disabled: true
|
|
295
|
+
|
|
296
|
+
- id: tool-pwsh
|
|
297
|
+
disabled: true
|
|
298
|
+
|
|
299
|
+
# The background-job REGISTRY stays on the host plane; only the model-facing
|
|
300
|
+
# `job_*` controls move. Its producers — `tool-bash` here, `tool-terminal` and a
|
|
301
|
+
# non-continuable `tool-subagent` elsewhere — are preset rows that resolve it
|
|
302
|
+
# with `ctx.get`, and an entry-local realm around the registry is invisible to
|
|
303
|
+
# every sibling row outside that realm, so `run_in_background` answered
|
|
304
|
+
# "background jobs unavailable" while the controls sat in the catalog. That is
|
|
305
|
+
# the `goals` criterion read from inside the preset: a Service a row outside its
|
|
306
|
+
# realm READS belongs to the plane both can see. The registry is keyed by owning
|
|
307
|
+
# agent, so one host instance serves every session exactly as before presets.
|
|
308
|
+
|
|
309
|
+
- id: tool-jobs
|
|
310
|
+
disabled: true
|
|
311
|
+
|
|
312
|
+
- id: tool-fs
|
|
313
|
+
disabled: true
|
|
314
|
+
|
|
315
|
+
- id: tool-fs-search
|
|
316
|
+
disabled: true
|
|
317
|
+
|
|
318
|
+
- id: tool-str-replace-editor
|
|
319
|
+
disabled: true
|
|
320
|
+
|
|
321
|
+
# The `skill` REGISTRY stays in the host plane. It is host+per-scope layered
|
|
322
|
+
# (the tools-registry shape): deployment-level providers — repository plugins,
|
|
323
|
+
# a host skill-filesystem row — register into its global layer, while a preset's
|
|
324
|
+
# `skill-filesystem` registers into that preset's layer, and each agent reads the
|
|
325
|
+
# merged catalog its scope chain selects. Only the per-agent rows move behind
|
|
326
|
+
# presets: the base host `skill-filesystem` row is disabled here (presets own local
|
|
327
|
+
# discovery), and `tool-skill` is what a preset mounts to give its agent the
|
|
328
|
+
# catalog and loader at all.
|
|
329
|
+
|
|
330
|
+
- id: skill-filesystem
|
|
331
|
+
disabled: true
|
|
332
|
+
|
|
333
|
+
- id: tool-skill
|
|
334
|
+
disabled: true
|
|
335
|
+
|
|
336
|
+
# The goal SERVICE, its session driver, and the `/goal` command STAY on the
|
|
337
|
+
# host plane; only the model-facing tool moves. The Gateway serves the goal
|
|
338
|
+
# domain as Remote endpoints, and a Remote method picks its receiver Service
|
|
339
|
+
# from a generated descriptor — it resolves `goals` on the host, so a
|
|
340
|
+
# per-session realm would answer `service-unavailable` for every browser call.
|
|
341
|
+
# That is the `shell-env` criterion read from the other side: injection is not
|
|
342
|
+
# the only host relationship a Service can have. The registry is keyed by
|
|
343
|
+
# session, so one host instance serves every session exactly as before presets.
|
|
344
|
+
|
|
345
|
+
- id: tool-goal
|
|
346
|
+
disabled: true
|
|
347
|
+
|
|
348
|
+
- id: plan-mode
|
|
349
|
+
disabled: true
|
|
350
|
+
|
|
351
|
+
# The token METER stays on the host plane; only the compaction backend that
|
|
352
|
+
# reads it moves. It owns the context-meter projection units, and that table is
|
|
353
|
+
# process-wide, so preset ownership would make the meter a function of which
|
|
354
|
+
# presets happen to be mounted rather than a per-session fact. Same criterion as
|
|
355
|
+
# `tasks` and `goals`; the reasoning has one home in
|
|
356
|
+
# `.agents/notes/implemented/architecture/2026-08-10-host-plane-ownership-after-presets.md`.
|
|
357
|
+
|
|
358
|
+
- id: compaction-basic
|
|
359
|
+
disabled: true
|
|
360
|
+
|
|
361
|
+
- id: command-compact
|
|
362
|
+
disabled: true
|
|
363
|
+
|
|
364
|
+
- id: tool-result-pruner
|
|
365
|
+
disabled: true
|
|
366
|
+
|
|
367
|
+
# The subagent registry and its backends STAY in the host plane. `subagents` is
|
|
368
|
+
# a process singleton with a cross-session query surface (`listChildren`,
|
|
369
|
+
# `followup`) that the host api-proxy serves to the browser, and a provider
|
|
370
|
+
# registers under a globally unique name, so a per-session copy would both
|
|
371
|
+
# starve that host row and collide on the second session. What a preset
|
|
372
|
+
# chooses is which delegation TOOLS its agent sees, below.
|
|
373
|
+
|
|
374
|
+
- id: tool-subagent-control
|
|
375
|
+
disabled: true
|
|
376
|
+
|
|
377
|
+
- id: tool-subagent-list-agents
|
|
378
|
+
disabled: true
|
|
379
|
+
|
|
380
|
+
- id: tool-subagent
|
|
381
|
+
disabled: true
|
|
382
|
+
|
|
383
|
+
- id: tool-subagent-fork
|
|
384
|
+
disabled: true
|
|
385
|
+
|
|
386
|
+
# `tool-subagent-report` is host-plane for the same reason as the registry, not
|
|
387
|
+
# because a preset may not want it: it registers a CONTINUABLE SETUP on that
|
|
388
|
+
# singleton rather than a tool this agent calls, and the setup list is not
|
|
389
|
+
# scope-aware — one copy per mounted preset means every child gets `report`
|
|
390
|
+
# registered once per live session, which throws on the second.
|
|
391
|
+
|
|
392
|
+
- id: workflow-worker-thread
|
|
393
|
+
disabled: true
|
|
394
|
+
|
|
395
|
+
- id: tool-workflow
|
|
396
|
+
disabled: true
|
|
397
|
+
|
|
398
|
+
- id: tool-ralph
|
|
399
|
+
disabled: true
|
|
400
|
+
|
|
401
|
+
- id: agent-instructions
|
|
402
|
+
disabled: true
|
|
403
|
+
|
|
404
|
+
- id: tool-todo
|
|
405
|
+
disabled: true
|
|
406
|
+
|
|
407
|
+
- id: tool-web
|
|
408
|
+
disabled: true
|
|
409
|
+
|
|
410
|
+
# The preset roster. `config/agent-presets/` ships with the deployment and is
|
|
411
|
+
# read-only (its entries carry `system` trust); `$DSH_HOME/.agent-presets` is
|
|
412
|
+
# where a person — or an agent — authors their own, and carries the same trust
|
|
413
|
+
# as shell access because a preset IS a composition.
|
|
414
|
+
#
|
|
415
|
+
# Only the SHIPPED root is an assembly fact: it sits beside the installed app's
|
|
416
|
+
# own config, so `apps/cli`'s `composeProfile` resolves and patches it in — the
|
|
417
|
+
# same treatment `distIndex` gets on the webserver row. The writable root is
|
|
418
|
+
# `dsh-agent-presets`' own default (`includeUserRoot`), so a composition that
|
|
419
|
+
# never reaches that patch still finds a person's presets.
|
|
420
|
+
- insert:
|
|
421
|
+
- id: agent-presets
|
|
422
|
+
name: '@monotykamary/dsh-agent-presets'
|
|
423
|
+
config:
|
|
424
|
+
default: standard
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { networkInterfaces } from "node:os";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import z from "@monotykamary/schemastery";
|
|
5
|
+
import { addHarnessSourceSection } from "@monotykamary/dsh-app-boot";
|
|
6
|
+
import * as FrontendStatic from "@monotykamary/dsh-host-frontend-static";
|
|
7
|
+
//#region lib/types/index.js
|
|
8
|
+
/**
|
|
9
|
+
* @monotykamary/dsh-web-app — the browser-surface bundle's runtime glue plugin
|
|
10
|
+
* plus the bundle patch (`cordis.patch.yml`, declared by the `dsh.bundle.patch`
|
|
11
|
+
* manifest field). The plugin owns the browser-surface glue: it resolves
|
|
12
|
+
* the built frontend dist (workspace knowledge of this bundle, never user
|
|
13
|
+
* config), mounts the `frontend-static` fallback owner over it, registers the
|
|
14
|
+
* harness-source and web-surface prompt sections, the bash-visible web runtime
|
|
15
|
+
* variable, and the URL line. App command-line values arrive through the
|
|
16
|
+
* `webStartup` service expressions in the bundle patch.
|
|
17
|
+
* @module @monotykamary/dsh-web-app
|
|
18
|
+
*/
|
|
19
|
+
/** Stable Cordis plugin name. */
|
|
20
|
+
const name = "web-app";
|
|
21
|
+
/** This dsh installation's root, from either this package's source or built entry. */
|
|
22
|
+
const SOURCE_ROOT = fileURLToPath(new URL("../../../..", import.meta.url));
|
|
23
|
+
/** Runtime service that releases Web rows after bind-dependent values resolve. */
|
|
24
|
+
const WEB_RUNTIME_SERVICE = "webRuntime";
|
|
25
|
+
/** Services required before the web runtime can mount. */
|
|
26
|
+
const inject = ["webServer"];
|
|
27
|
+
const Config = z.object({
|
|
28
|
+
printUrl: z.boolean().default(true),
|
|
29
|
+
surfaceContext: z.boolean().default(true),
|
|
30
|
+
trustedHosts: z.array(String).default([])
|
|
31
|
+
});
|
|
32
|
+
/** Environment variable naming the canonical local URL of this Web GUI. */
|
|
33
|
+
const DSH_WEB_URL = "DSH_WEB_URL";
|
|
34
|
+
const LOOPBACK_HOST = "127.0.0.1";
|
|
35
|
+
/** The webserver schema's all-interfaces bind literal. */
|
|
36
|
+
const ALL_INTERFACES_HOST = "0.0.0.0";
|
|
37
|
+
/**
|
|
38
|
+
* Resolve one LAN-trust snapshot from the active server bind.
|
|
39
|
+
*
|
|
40
|
+
* Derived entries are port-less IP literals: DNS rebinding needs an
|
|
41
|
+
* attacker-controlled name, while an IP-literal Host is safe on any port and
|
|
42
|
+
* an OS-assigned port is unknowable before bind.
|
|
43
|
+
* @param bindHost - the active webserver bind host.
|
|
44
|
+
* @param extra - explicit `--trusted-host` values, in argument order.
|
|
45
|
+
* @returns the LAN display addresses and invocation-derived fence authorities.
|
|
46
|
+
*/
|
|
47
|
+
function resolveLanTrust(bindHost, extra) {
|
|
48
|
+
const lanAddresses = bindHost === ALL_INTERFACES_HOST ? Object.values(networkInterfaces()).flat().filter((iface) => iface !== void 0 && iface.family === "IPv4" && !iface.internal).map((iface) => iface.address) : [];
|
|
49
|
+
return {
|
|
50
|
+
lanAddresses,
|
|
51
|
+
trustedHosts: [...lanAddresses, ...extra]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Model-visible orientation and acceptance boundary for sessions created through `dsh web`. */
|
|
55
|
+
function webSurfacePrompt(webUrl) {
|
|
56
|
+
return `You are interacting with the user through the DeepSeek Harness Web GUI at ${webUrl}. When the user refers to "this page", "this GUI", or "this app" without naming another target, they mean this GUI. The browser provides no implicit DOM, route, or screenshot context. The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while \`pnpm run dev:web\` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates. Every other change — the apps/web shell and plain packages — requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh. Starting another server does not update this GUI. The apps/web Vite entry builds the shell but is not a standalone application because only dsh web injects window.__DSH_BOOT__. Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL.`;
|
|
57
|
+
}
|
|
58
|
+
/** Resolve the canonical loopback URL from the active Web server. */
|
|
59
|
+
function localWebUrl(ctx) {
|
|
60
|
+
const port = ctx.get("webServer")?.port;
|
|
61
|
+
if (port === void 0) throw new Error("web-app: webServer service missing while resolving Web runtime");
|
|
62
|
+
return `http://${LOOPBACK_HOST}:${String(port)}`;
|
|
63
|
+
}
|
|
64
|
+
/** Dist location is workspace knowledge of this bundle: resolved through the frontend package exports, not configured. */
|
|
65
|
+
function resolveDistIndex() {
|
|
66
|
+
const require = createRequire(import.meta.url);
|
|
67
|
+
try {
|
|
68
|
+
return require.resolve("@monotykamary/dsh-web-frontend/dist/index.html");
|
|
69
|
+
} catch {
|
|
70
|
+
/* v8 ignore next 2 -- reachable only on a checkout without a built dist; the test tree builds it */
|
|
71
|
+
throw new Error("web-app: frontend dist not built; run pnpm run build from the repository root first");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Test hook: hosts with no built frontend dist substitute the resolver; production never touches this. */
|
|
75
|
+
const internals = { resolveDistIndex };
|
|
76
|
+
/**
|
|
77
|
+
* Mount the Web runtime: dist serving, surface prompt, the bash runtime
|
|
78
|
+
* variable, and the URL line.
|
|
79
|
+
* @param ctx - plugin context carrying the webServer service.
|
|
80
|
+
* @param config - validated {@link Config}.
|
|
81
|
+
*/
|
|
82
|
+
function apply(ctx, config) {
|
|
83
|
+
const runtime = resolveLanTrust(ctx.webServer.host, config.trustedHosts);
|
|
84
|
+
ctx.provide(WEB_RUNTIME_SERVICE, runtime);
|
|
85
|
+
ctx.plugin(FrontendStatic, { distIndex: internals.resolveDistIndex() });
|
|
86
|
+
if (config.surfaceContext) {
|
|
87
|
+
ctx.inject(["systemPrompt"], (promptCtx) => {
|
|
88
|
+
addHarnessSourceSection(promptCtx, SOURCE_ROOT);
|
|
89
|
+
promptCtx.systemPrompt.section({
|
|
90
|
+
name: "app:web-surface",
|
|
91
|
+
order: -98,
|
|
92
|
+
text: () => webSurfacePrompt(localWebUrl(promptCtx))
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
ctx.inject(["shellEnv"], (runtimeCtx) => {
|
|
96
|
+
runtimeCtx.shellEnv.register({
|
|
97
|
+
name: "web-runtime",
|
|
98
|
+
variables: { [DSH_WEB_URL]: { description: "Canonical local URL of the DeepSeek Harness Web GUI serving this session." } },
|
|
99
|
+
resolve: () => ({ [DSH_WEB_URL]: localWebUrl(runtimeCtx) })
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (config.printUrl) {
|
|
104
|
+
const printUrl = () => {
|
|
105
|
+
const lanCandidate = runtime.lanAddresses[0];
|
|
106
|
+
const port = ctx.webServer.port;
|
|
107
|
+
console.log(`dsh web: ${localWebUrl(ctx)}${lanCandidate === void 0 ? "" : ` (LAN: http://${lanCandidate}:${String(port)})`}`);
|
|
108
|
+
};
|
|
109
|
+
const settled = ctx.get("loader")?.await();
|
|
110
|
+
if (settled === void 0) printUrl();
|
|
111
|
+
else settled.then(() => {
|
|
112
|
+
if (ctx.get("webServer") !== void 0) printUrl();
|
|
113
|
+
}, () => {});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { Config, apply, inject, internals, name, resolveLanTrust };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@monotykamary/dsh-web-app`.
|
|
4
|
+
* @module @monotykamary/dsh-web-app/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@monotykamary/dsh-web-app";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "web-app-invariant";
|
|
9
|
+
/** Service required before the companion can register. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: every contribution (frontend-static child plugin,
|
|
13
|
+
* prompt section, bashEnv registration) is registry-disposed with the fiber,
|
|
14
|
+
* and each owning registry's package carries that relation's invariant; the
|
|
15
|
+
* package holds no mutable state of its own to audit.
|
|
16
|
+
*/
|
|
17
|
+
const install = () => {};
|
|
18
|
+
/**
|
|
19
|
+
* Register this package's invariant companion.
|
|
20
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
21
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
22
|
+
*/
|
|
23
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
24
|
+
//#endregion
|
|
25
|
+
export { apply, inject, name };
|
package/lib/startup.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { parseCmdline } from "@monotykamary/dsh-cmdline";
|
|
3
|
+
//#region lib/types/startup.js
|
|
4
|
+
/**
|
|
5
|
+
* The web app's command-line provider: it parses the `dsh --profile web` flag
|
|
6
|
+
* family (`--host`, `--port`, `--trusted-host`) and its `--help`
|
|
7
|
+
* text, then provides the immutable values as {@link WEB_STARTUP_SERVICE}.
|
|
8
|
+
* Ordinary rows inject that service before reading it from lazy config.
|
|
9
|
+
* @module @monotykamary/dsh-web-app/startup
|
|
10
|
+
*/
|
|
11
|
+
/** Stable Cordis plugin name. */
|
|
12
|
+
const name = "web-startup";
|
|
13
|
+
/** Services required before the flags can be resolved. */
|
|
14
|
+
const inject = ["cmdlineArgs"];
|
|
15
|
+
/** Service provided by this ordinary plugin and injected by flag-configured rows. */
|
|
16
|
+
const WEB_STARTUP_SERVICE = "webStartup";
|
|
17
|
+
/**
|
|
18
|
+
* This app's command: its flags, its description, and its help text.
|
|
19
|
+
* @returns a fresh program, so one process can parse more than once (tests).
|
|
20
|
+
*/
|
|
21
|
+
function webCommand() {
|
|
22
|
+
return new Command().name("dsh --profile web").description("Serve the DeepSeek Harness browser UI.").helpOption("-h, --help", "show this help").option("--host <host>", "bind host").option("--port <port>", "listen port; pass 0 to let the OS pick a free one").option("--trusted-host <authority...>", "extra authority the /api browser-trust fence accepts (host or host:port; repeatable)").addHelpText("after", `
|
|
23
|
+
Examples:
|
|
24
|
+
dsh --profile web serve on the composed host and port
|
|
25
|
+
dsh --profile web --port 8080 serve on another port
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse and provide the Web invocation as an ordinary Cordis service. The
|
|
30
|
+
* command's action publishes the flags this invocation named; `--host 0.0.0.0`
|
|
31
|
+
* or a non-numeric `--port` is a usage error, so on rejection (and on `--help`)
|
|
32
|
+
* nothing is provided.
|
|
33
|
+
* @param ctx - plugin context carrying the command line.
|
|
34
|
+
*/
|
|
35
|
+
function apply(ctx) {
|
|
36
|
+
const program = webCommand();
|
|
37
|
+
program.action(() => {
|
|
38
|
+
const options = program.opts();
|
|
39
|
+
if (options.host === "0.0.0.0") program.error("error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead");
|
|
40
|
+
if (options.port !== void 0 && !/^\d+$/.test(options.port)) program.error(`error: --port must be a number, got ${JSON.stringify(options.port)}`);
|
|
41
|
+
ctx.provide(WEB_STARTUP_SERVICE, {
|
|
42
|
+
...options.host !== void 0 && { host: options.host },
|
|
43
|
+
...options.port !== void 0 && { port: Number(options.port) },
|
|
44
|
+
trustedHosts: options.trustedHost ?? []
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
parseCmdline(ctx, program);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { WEB_STARTUP_SERVICE, apply, inject, name };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monotykamary/dsh-web-app — the browser-surface bundle's runtime glue plugin
|
|
3
|
+
* plus the bundle patch (`cordis.patch.yml`, declared by the `dsh.bundle.patch`
|
|
4
|
+
* manifest field). The plugin owns the browser-surface glue: it resolves
|
|
5
|
+
* the built frontend dist (workspace knowledge of this bundle, never user
|
|
6
|
+
* config), mounts the `frontend-static` fallback owner over it, registers the
|
|
7
|
+
* harness-source and web-surface prompt sections, the bash-visible web runtime
|
|
8
|
+
* variable, and the URL line. App command-line values arrive through the
|
|
9
|
+
* `webStartup` service expressions in the bundle patch.
|
|
10
|
+
* @module @monotykamary/dsh-web-app
|
|
11
|
+
*/
|
|
12
|
+
import type { Context } from '@monotykamary/cordis';
|
|
13
|
+
import z from '@monotykamary/schemastery';
|
|
14
|
+
/** Stable Cordis plugin name. */
|
|
15
|
+
export declare const name = "web-app";
|
|
16
|
+
/** Services required before the web runtime can mount. */
|
|
17
|
+
export declare const inject: string[];
|
|
18
|
+
/** Plugin config: composed deployment settings plus per-invocation command-line values. */
|
|
19
|
+
export interface Config {
|
|
20
|
+
/** Print the URL line on activation; a non-interactive layer can turn it off. */
|
|
21
|
+
printUrl: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Register the model-visible surface context (the `app:web-surface` prompt
|
|
24
|
+
* section and the `DSH_WEB_URL` bash variable). A one-shot non-interactive
|
|
25
|
+
* layer can turn it off when its user is not in the GUI, so the
|
|
26
|
+
* orientation text would be false.
|
|
27
|
+
*/
|
|
28
|
+
surfaceContext: boolean;
|
|
29
|
+
/** Explicit `--trusted-host` authorities from this invocation. */
|
|
30
|
+
trustedHosts: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare const Config: z<Config>;
|
|
33
|
+
/** Bind-dependent Web values shared by the trust fence and URL display. */
|
|
34
|
+
export interface WebRuntimeValues {
|
|
35
|
+
/** LAN IPv4 literals sampled once when the server binds all interfaces. */
|
|
36
|
+
lanAddresses: string[];
|
|
37
|
+
/** LAN literals followed by explicit invocation authorities. */
|
|
38
|
+
trustedHosts: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve one LAN-trust snapshot from the active server bind.
|
|
42
|
+
*
|
|
43
|
+
* Derived entries are port-less IP literals: DNS rebinding needs an
|
|
44
|
+
* attacker-controlled name, while an IP-literal Host is safe on any port and
|
|
45
|
+
* an OS-assigned port is unknowable before bind.
|
|
46
|
+
* @param bindHost - the active webserver bind host.
|
|
47
|
+
* @param extra - explicit `--trusted-host` values, in argument order.
|
|
48
|
+
* @returns the LAN display addresses and invocation-derived fence authorities.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveLanTrust(bindHost: string, extra: readonly string[]): WebRuntimeValues;
|
|
51
|
+
/** Test hook: hosts with no built frontend dist substitute the resolver; production never touches this. */
|
|
52
|
+
export declare const internals: {
|
|
53
|
+
resolveDistIndex: () => string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Mount the Web runtime: dist serving, surface prompt, the bash runtime
|
|
57
|
+
* variable, and the URL line.
|
|
58
|
+
* @param ctx - plugin context carrying the webServer service.
|
|
59
|
+
* @param config - validated {@link Config}.
|
|
60
|
+
*/
|
|
61
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@monotykamary/dsh-web-app`.
|
|
3
|
+
* @module @monotykamary/dsh-web-app/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@monotykamary/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "web-app-invariant";
|
|
8
|
+
/** Service required before the companion can register. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web app's command-line provider: it parses the `dsh --profile web` flag
|
|
3
|
+
* family (`--host`, `--port`, `--trusted-host`) and its `--help`
|
|
4
|
+
* text, then provides the immutable values as {@link WEB_STARTUP_SERVICE}.
|
|
5
|
+
* Ordinary rows inject that service before reading it from lazy config.
|
|
6
|
+
* @module @monotykamary/dsh-web-app/startup
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@monotykamary/cordis';
|
|
9
|
+
/** Stable Cordis plugin name. */
|
|
10
|
+
export declare const name = "web-startup";
|
|
11
|
+
/** Services required before the flags can be resolved. */
|
|
12
|
+
export declare const inject: string[];
|
|
13
|
+
/** Service provided by this ordinary plugin and injected by flag-configured rows. */
|
|
14
|
+
export declare const WEB_STARTUP_SERVICE = "webStartup";
|
|
15
|
+
/** What the web rows read from {@link WEB_STARTUP_SERVICE}. */
|
|
16
|
+
export interface WebStartupValues {
|
|
17
|
+
/** `--host`, absent when the invocation did not name one. */
|
|
18
|
+
host?: string;
|
|
19
|
+
/** `--port`, absent when the invocation did not name one. */
|
|
20
|
+
port?: number;
|
|
21
|
+
/** Explicit `--trusted-host` authorities, in argument order. */
|
|
22
|
+
trustedHosts: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse and provide the Web invocation as an ordinary Cordis service. The
|
|
26
|
+
* command's action publishes the flags this invocation named; `--host 0.0.0.0`
|
|
27
|
+
* or a non-numeric `--port` is a usage error, so on rejection (and on `--help`)
|
|
28
|
+
* nothing is provided.
|
|
29
|
+
* @param ctx - plugin context carrying the command line.
|
|
30
|
+
*/
|
|
31
|
+
export declare function apply(ctx: Context): void;
|
|
32
|
+
//# sourceMappingURL=startup.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monotykamary/dsh-web-app",
|
|
3
|
+
"description": "The dsh browser-surface bundle: the web patch layer over dsh-base plus the runtime glue plugin (frontend dist serving, web-surface prompt, bash runtime variables, URL line)",
|
|
4
|
+
"version": "0.1.0-rc.5",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/bundle/web-app"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./startup": {
|
|
22
|
+
"types": "./lib/types/startup.d.ts",
|
|
23
|
+
"default": "./lib/startup.js"
|
|
24
|
+
},
|
|
25
|
+
"./invariant": {
|
|
26
|
+
"types": "./lib/types/invariant.d.ts",
|
|
27
|
+
"default": "./lib/invariant.js"
|
|
28
|
+
},
|
|
29
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
30
|
+
"./src/*": "./src/*",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"lib/index.js",
|
|
35
|
+
"lib/invariant.js",
|
|
36
|
+
"lib/startup.js",
|
|
37
|
+
"cordis.patch.yml",
|
|
38
|
+
"lib/types/**/*.d.ts"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dsh": {
|
|
42
|
+
"bundle": {
|
|
43
|
+
"patch": "./cordis.patch.yml"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"commander": "^15.0.0",
|
|
48
|
+
"@monotykamary/dsh-client-modules": "^0.1.0-rc.5",
|
|
49
|
+
"@monotykamary/dsh-api-remotes": "^0.1.0-rc.5",
|
|
50
|
+
"@monotykamary/dsh-client-connection": "^0.1.0-rc.5",
|
|
51
|
+
"@monotykamary/dsh-client-locale": "^0.1.0-rc.5",
|
|
52
|
+
"@monotykamary/dsh-agent-presets": "^0.1.0-rc.5",
|
|
53
|
+
"@monotykamary/dsh-client-ui-commands": "^0.1.0-rc.5",
|
|
54
|
+
"@monotykamary/dsh-client-hmr": "^0.1.0-rc.5",
|
|
55
|
+
"@monotykamary/dsh-client-ui-directory-picker-browse": "^0.1.0-rc.5",
|
|
56
|
+
"@monotykamary/dsh-client-runtime": "^0.1.0-rc.5",
|
|
57
|
+
"@monotykamary/dsh-client-ui-directory-picker-native": "^0.1.0-rc.5",
|
|
58
|
+
"@monotykamary/dsh-client-ui-conversation": "^0.1.0-rc.5",
|
|
59
|
+
"@monotykamary/dsh-client-ui-deliverables": "^0.1.0-rc.5",
|
|
60
|
+
"@monotykamary/dsh-client-ui-agent-preset": "^0.1.0-rc.5",
|
|
61
|
+
"@monotykamary/dsh-app-boot": "^0.1.0-rc.5",
|
|
62
|
+
"@monotykamary/dsh-client-ui-cordis": "^0.1.0-rc.5",
|
|
63
|
+
"@monotykamary/dsh-client-ui-message-feedback": "^0.1.0-rc.5",
|
|
64
|
+
"@monotykamary/dsh-client-ui-goal": "^0.1.0-rc.5",
|
|
65
|
+
"@monotykamary/dsh-client-ui-model-selection": "^0.1.0-rc.5",
|
|
66
|
+
"@monotykamary/dsh-client-ui-layout": "^0.1.0-rc.5",
|
|
67
|
+
"@monotykamary/dsh-client-ui-settings-models": "^0.1.0-rc.5",
|
|
68
|
+
"@monotykamary/dsh-client-ui-settings-plugin-inventory": "^0.1.0-rc.5",
|
|
69
|
+
"@monotykamary/dsh-client-ui-permission-presets": "^0.1.0-rc.5",
|
|
70
|
+
"@monotykamary/dsh-client-ui-settings-plugins": "^0.1.0-rc.5",
|
|
71
|
+
"@monotykamary/dsh-client-ui-settings-general": "^0.1.0-rc.5",
|
|
72
|
+
"@monotykamary/dsh-client-ui-sidebar": "^0.1.0-rc.5",
|
|
73
|
+
"@monotykamary/dsh-client-ui-plan": "^0.1.0-rc.5",
|
|
74
|
+
"@monotykamary/dsh-client-ui-settings": "^0.1.0-rc.5",
|
|
75
|
+
"@monotykamary/dsh-client-ui-user-questions": "^0.1.0-rc.5",
|
|
76
|
+
"@monotykamary/dsh-client-ui-theme": "^0.1.0-rc.5",
|
|
77
|
+
"@monotykamary/dsh-client-ui-workflow-run": "^0.1.0-rc.5",
|
|
78
|
+
"@monotykamary/dsh-client-ui-jobs": "^0.1.0-rc.5",
|
|
79
|
+
"@monotykamary/dsh-client-ui-subagent": "^0.1.0-rc.5",
|
|
80
|
+
"@monotykamary/dsh-client-ui-workspace": "^0.1.0-rc.5",
|
|
81
|
+
"@monotykamary/dsh-client-ui-input-trigger": "^0.1.0-rc.5",
|
|
82
|
+
"@monotykamary/dsh-cmdline": "^0.1.0-rc.5",
|
|
83
|
+
"@monotykamary/dsh-client-ui-trajectory": "^0.1.0-rc.5",
|
|
84
|
+
"@monotykamary/dsh-client-ui-tool": "^0.1.0-rc.5",
|
|
85
|
+
"@monotykamary/dsh-web-frontend": "^0.1.0-rc.5",
|
|
86
|
+
"@monotykamary/dsh-client-ui-skill": "^0.1.0-rc.5",
|
|
87
|
+
"@monotykamary/dsh-host-directory-picker-auto": "^0.1.0-rc.5",
|
|
88
|
+
"@monotykamary/dsh-host-directory-picker-browse": "^0.1.0-rc.5",
|
|
89
|
+
"@monotykamary/dsh-host-frontend-static": "^0.1.0-rc.5",
|
|
90
|
+
"@monotykamary/dsh-host-directory-picker-native": "^0.1.0-rc.5",
|
|
91
|
+
"@monotykamary/dsh-host-plugin-inventory": "^0.1.0-rc.5",
|
|
92
|
+
"@monotykamary/dsh-host-webserver": "^0.1.0-rc.5",
|
|
93
|
+
"@monotykamary/dsh-message-feedback": "^0.1.0-rc.5",
|
|
94
|
+
"@monotykamary/dsh-cordis-client-runner": "^0.1.0-rc.5",
|
|
95
|
+
"@monotykamary/dsh-session-stats": "^0.1.0-rc.5",
|
|
96
|
+
"@monotykamary/dsh-code-runtime-worker-thread": "^0.1.0-rc.5",
|
|
97
|
+
"@monotykamary/dsh-storage": "^0.1.0-rc.5",
|
|
98
|
+
"@monotykamary/dsh-storage-domain": "^0.1.0-rc.5",
|
|
99
|
+
"@monotykamary/dsh-session-log-export": "^0.1.0-rc.5",
|
|
100
|
+
"@monotykamary/dsh-storage-json": "^0.1.0-rc.5",
|
|
101
|
+
"@monotykamary/schemastery": "^3.18.1",
|
|
102
|
+
"@monotykamary/dsh-host-apiproxy": "^0.1.0-rc.5",
|
|
103
|
+
"@monotykamary/dsh-session-projection-cache": "^0.1.0-rc.5",
|
|
104
|
+
"@monotykamary/dsh-cordis-host-runner": "^0.1.0-rc.5",
|
|
105
|
+
"@monotykamary/dsh-workspace": "^0.1.0-rc.5"
|
|
106
|
+
},
|
|
107
|
+
"peerDependencies": {
|
|
108
|
+
"@monotykamary/cordis-plugin-loader": "^1.0.2",
|
|
109
|
+
"@monotykamary/dsh-shell-env": "^0.1.0-rc.5",
|
|
110
|
+
"@monotykamary/dsh-invariants": "^0.1.0-rc.5",
|
|
111
|
+
"@monotykamary/dsh-system-prompt": "^0.1.0-rc.5",
|
|
112
|
+
"@monotykamary/cordis": "^4.0.1"
|
|
113
|
+
},
|
|
114
|
+
"devDependencies": {
|
|
115
|
+
"@monotykamary/cordis-plugin-loader": "^1.0.2",
|
|
116
|
+
"@monotykamary/cordis": "^4.0.1",
|
|
117
|
+
"@monotykamary/dsh-invariants": "^0.1.0-rc.5",
|
|
118
|
+
"@monotykamary/dsh-system-prompt": "^0.1.0-rc.5",
|
|
119
|
+
"@monotykamary/dsh-shell-env": "^0.1.0-rc.5"
|
|
120
|
+
}
|
|
121
|
+
}
|