@deepseek-ai/dsh-harness-dev-context 0.0.0-stage → 0.2.1-alpha.3
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 +67 -0
- package/README.md +131 -2
- package/README.zh.md +132 -0
- package/lib/index.js +124 -0
- package/lib/types/index.d.ts +36 -0
- package/package.json +46 -3
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,67 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/context/harness-dev-context/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: 8fed567b18e9dfa2
|
|
7
|
+
zh: 2ab54db218cc0197
|
|
8
|
+
/deepseek-ai-dsh-harness-dev-context:
|
|
9
|
+
en: b47701c093269adb
|
|
10
|
+
zh: e147a06ec0d6047f
|
|
11
|
+
/deepseek-ai-dsh-harness-dev-context/summary:
|
|
12
|
+
en: daf618174270461e
|
|
13
|
+
zh: 4c5b56fe4380c91f
|
|
14
|
+
/deepseek-ai-dsh-harness-dev-context/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-harness-dev-context/use-this-package:
|
|
18
|
+
en: d3192709a416f7fb
|
|
19
|
+
zh: 479253a5ae1adcb2
|
|
20
|
+
/deepseek-ai-dsh-harness-dev-context/use-this-package/what-the-model-gets:
|
|
21
|
+
en: d9f5b11af33b3eb8
|
|
22
|
+
zh: fc96b972503a0b99
|
|
23
|
+
/deepseek-ai-dsh-harness-dev-context/use-this-package/sessions-from-earlier-releases:
|
|
24
|
+
en: d810950db5118265
|
|
25
|
+
zh: d20e3965fa78e0f8
|
|
26
|
+
/deepseek-ai-dsh-harness-dev-context/understand-the-implementation:
|
|
27
|
+
en: 2d21fa2aad5a729d
|
|
28
|
+
zh: cfbfada0eb647435
|
|
29
|
+
/deepseek-ai-dsh-harness-dev-context/understand-the-implementation/design-concept:
|
|
30
|
+
en: 401a852a3444aff4
|
|
31
|
+
zh: 5288a593f61c168b
|
|
32
|
+
/deepseek-ai-dsh-harness-dev-context/understand-the-implementation/source-map:
|
|
33
|
+
en: 4696b6c3a1f91f96
|
|
34
|
+
zh: 3a56d257ec768a5e
|
|
35
|
+
/deepseek-ai-dsh-harness-dev-context/understand-the-implementation/main-flow:
|
|
36
|
+
en: f3844a1825b2e329
|
|
37
|
+
zh: bdcafbcadbc6d316
|
|
38
|
+
/deepseek-ai-dsh-harness-dev-context/further-exploration:
|
|
39
|
+
en: f291741c499581ac
|
|
40
|
+
zh: 8ee0baef51e69ef0
|
|
41
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience:
|
|
42
|
+
en: 215e7ba838619b7b
|
|
43
|
+
zh: a311da3843709f90
|
|
44
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui:
|
|
45
|
+
en: ddbe5927f55a6275
|
|
46
|
+
zh: 1687795c41c16a8c
|
|
47
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui/what-the-model-sees:
|
|
48
|
+
en: f3236c45cf5bc3a6
|
|
49
|
+
zh: 1a3499b2e21f4761
|
|
50
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui/what-the-model-sees/system-prompt-paragraphs:
|
|
51
|
+
en: c6c9fa4caf6f2f30
|
|
52
|
+
zh: f501149c17c0ea60
|
|
53
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui/what-the-model-sees/runtime-context-lines:
|
|
54
|
+
en: 37680cbe3eaabef5
|
|
55
|
+
zh: 8c1b432ddf7d20b5
|
|
56
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui/token-effect:
|
|
57
|
+
en: 2c629df08d801b36
|
|
58
|
+
zh: 437d43a9c5fdc68a
|
|
59
|
+
/deepseek-ai-dsh-harness-dev-context/model-experience/harness-checkout-and-web-gui/kv-cache-effect:
|
|
60
|
+
en: e8f89a14bd36dae0
|
|
61
|
+
zh: bd4ec43e07e234c9
|
|
62
|
+
/deepseek-ai-dsh-harness-dev-context/known-limitations-and-deferred-work:
|
|
63
|
+
en: 558945e2f537db5b
|
|
64
|
+
zh: f584fcde6275c2da
|
|
65
|
+
/deepseek-ai-dsh-harness-dev-context/known-limitations-and-deferred-work/dev-note:
|
|
66
|
+
en: e67f633dc6fe7773
|
|
67
|
+
zh: e88aeb617ffb74ea
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Model context for users and maintainers of the Web GUI that names the DeepSeek Harness checkout and GUI URL without letting either change the system prompt."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-harness-dev-context
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-harness-dev-context` tells an agent running behind the DeepSeek Harness Web GUI where the harness implementation checkout lives, how the GUI relates to "this page", and which URL serves it. The system prompt carries only value-free guidance; the current checkout path and GUI URL arrive as runtime context, so starting the process from another checkout, port, or installation never rewrites a Session's logged system prompt. Sessions whose prompt still embeds those values from earlier releases keep that text verbatim.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
The shipped Web bundle mounts this plugin as its `harness-dev-context` row. Disable that row in a profile patch when the agent should not learn the harness checkout or GUI URL. The plugin takes no configuration and activates only where every injected service exists: `systemPrompt`, `sessionProjections`, and the `webApp` service of the Web runtime, so `--help` and non-Web compositions never mount it.
|
|
29
|
+
|
|
30
|
+
### What the model gets
|
|
31
|
+
|
|
32
|
+
Two system-prompt sections explain that the checkout differs from the working directory and that "this page" means this GUI, together with the GUI update contract. Two runtime-context lines state the current values: the installation root four directories above this package, and the Web GUI's advertised URL from `webApp.getAdvertisedUrl()`, the same value as `DSH_WEB_URL` and the startup URL. Runtime context follows the shared snapshot rules: an unchanged value adds nothing, and a changed one appends a snapshot before the step's input instead of rewriting earlier messages.
|
|
33
|
+
|
|
34
|
+
### Sessions from earlier releases
|
|
35
|
+
|
|
36
|
+
Earlier releases embedded both values in the system prompt. When a Session's latest nonempty system prompt still contains those exact paragraphs, the sections repeat them verbatim, old values included, so upgrading and later port or checkout changes leave that Session's prompt byte-identical; the runtime-context lines still give the current values. Text that only resembles an earlier paragraph receives the current guidance.
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## Understand the implementation
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>Implementation internals — click to expand</summary>
|
|
45
|
+
|
|
46
|
+
This section explains the design of the plugin; the observable behavior is covered in [Use this package](#use-this-package).
|
|
47
|
+
|
|
48
|
+
### Design concept
|
|
49
|
+
|
|
50
|
+
A host-only session projection, `harnessDevLegacyPrompt`, folds every committed nonempty `system/message` into the earlier-format paragraphs it contains, matched by their fixed text around the value on one line. The section text providers read that state through `AssembleContext.agent`; assemblies without an agent use the current guidance. The projection is restored with every other unit when a Session resumes, so no historical event is read synchronously.
|
|
51
|
+
|
|
52
|
+
### Source map
|
|
53
|
+
|
|
54
|
+
| File | Role |
|
|
55
|
+
|---|---|
|
|
56
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry: sections, runtime contexts, earlier-format projection |
|
|
57
|
+
|
|
58
|
+
### Main flow
|
|
59
|
+
|
|
60
|
+
Activation registers the projection unit, both sections, and both contexts. At each assembly the sections choose the admitted earlier paragraph or the current guidance; at each request admission the contexts read the advertised URL. Disposing the plugin fiber removes every registration.
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
<a id="further-exploration"></a>
|
|
67
|
+
## Further Exploration
|
|
68
|
+
|
|
69
|
+
Read these pages when the package-level contract is not enough. They move from the decision record to the services this plugin reads.
|
|
70
|
+
|
|
71
|
+
- [Process-specific values as runtime context](../../../.agents/notes/implemented/bug-fix/2026-10-11-process-specific-prompt-values-in-runtime-context.md) — why the values left the system prompt and how earlier Sessions stay stable.
|
|
72
|
+
- [Session projections subsystem](../../../docs/subsystems/session-projection.md) — the projection contract the earlier-format state uses.
|
|
73
|
+
- [Web app bundle](../../bundle/web-app/README.md) — the `webApp` service and the row that mounts this plugin.
|
|
74
|
+
- [Context group map](../README.md) — sibling request-context packages.
|
|
75
|
+
|
|
76
|
+
-----
|
|
77
|
+
|
|
78
|
+
<a id="model-experience"></a>
|
|
79
|
+
## Model Experience
|
|
80
|
+
|
|
81
|
+
### Harness checkout and Web GUI
|
|
82
|
+
|
|
83
|
+
#### What the model sees
|
|
84
|
+
|
|
85
|
+
Two system-prompt paragraphs at first-party orders 10000 and 10100, after reusable instructions, and two runtime-context lines at context orders 200 and 210. A Session admitted under an earlier release sees its own earlier paragraphs instead of the two below.
|
|
86
|
+
|
|
87
|
+
##### System-prompt paragraphs
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
The runtime context names the DeepSeek Harness implementation checkout. The checkout location and current working directory are separate values and may differ; never infer the working directory from the checkout path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself.
|
|
91
|
+
|
|
92
|
+
You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names. 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.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
##### Runtime-context lines
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
Current DeepSeek Harness implementation checkout: "<installation root>".
|
|
99
|
+
|
|
100
|
+
Current DeepSeek Harness Web GUI URL: "<advertised URL>".
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Token effect
|
|
104
|
+
|
|
105
|
+
Two prompt paragraphs per Session and two lines in each runtime-context snapshot. A changed checkout or URL adds one snapshot.
|
|
106
|
+
|
|
107
|
+
#### KV Cache effect
|
|
108
|
+
|
|
109
|
+
The system prompt is identical across checkouts, ports, and installations, so a process started elsewhere leaves the cached prefix intact; a changed value appends one runtime-context snapshot after it.
|
|
110
|
+
|
|
111
|
+
## Known Limitations and Deferred Work
|
|
112
|
+
|
|
113
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
114
|
+
|
|
115
|
+
These limits describe what the stability guarantee covers. They are current package constraints.
|
|
116
|
+
|
|
117
|
+
- **Two paragraphs only** — other system-prompt text that changes between releases still rewrites the first system message on routes without in-history prompt updates.
|
|
118
|
+
- **Earlier values stay** — an earlier-format Session keeps its old checkout path and URL in the system prompt for its whole lifetime; only the later runtime-context lines are current.
|
|
119
|
+
- **Mixed releases** — a release without this package rewrites the first system message of a Session started with it, so every checkout that serves a shared `DSH_HOME` needs this package before they alternate.
|
|
120
|
+
- **Optional values** — the two runtime-context lines are optional, so a custom persona that sets `includeRuntimeContext: false` without `complete: true` keeps the sections that point at values its requests never carry. The shipped `minimal` persona sets both.
|
|
121
|
+
- **Sessions without the sections** — a Session created while `surfaceContext: false` hid both paragraphs has neither in its log, so the first resumed request adds the new sections and rewrites the first system message on routes without in-history prompt updates.
|
|
122
|
+
- **One earlier wording** — the projection recognizes the paragraphs as the release immediately before this package rendered them; a Session holding an older wording gets the current guidance.
|
|
123
|
+
|
|
124
|
+
<a id="dev-note"></a>
|
|
125
|
+
### Dev Note
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
129
|
+
|
|
130
|
+
None.
|
|
131
|
+
|
|
132
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "面向 Web GUI 用户与维护者的模型上下文:给出 DeepSeek Harness checkout 与 GUI URL,且两者都不会改变系统提示词。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-harness-dev-context
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-harness-dev-context` 告诉运行在 DeepSeek Harness Web GUI 背后的 agent:harness 实现 checkout 在哪里、GUI 与「this page」是什么关系,以及哪个 URL 提供该 GUI。系统提示词只包含不含值的说明;当前 checkout 路径与 GUI URL 以运行时上下文送达,因此从别的 checkout、端口或安装位置启动进程,绝不会改写会话已记录的系统提示词。提示词仍嵌有早期版本这些值的会话会原样保留那段文本。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
随附的 Web bundle 以 `harness-dev-context` 行挂载此插件。不希望 agent 得知 harness checkout 或 GUI URL 时,在 profile patch 中禁用该行。插件不接受配置,只在每个注入服务都存在时激活:`systemPrompt`、`sessionProjections`,以及 Web 运行时的 `webApp` 服务,因此 `--help` 与非 Web 组合永远不会挂载它。
|
|
29
|
+
|
|
30
|
+
### 模型得到什么
|
|
31
|
+
|
|
32
|
+
两个系统提示词段落说明 checkout 与工作目录不同、「this page」指此 GUI,并给出 GUI 的更新约定。两行运行时上下文给出当前值:本包上方四层目录处的安装根,以及 `webApp.getAdvertisedUrl()` 给出的 Web GUI 公告 URL,与 `DSH_WEB_URL` 和启动 URL 相同。运行时上下文遵循共享的快照规则:值不变不追加内容,值变化时在本步输入之前追加一份快照,而不是改写更早的消息。
|
|
33
|
+
|
|
34
|
+
### 早期版本的会话
|
|
35
|
+
|
|
36
|
+
早期版本把两个值都嵌在系统提示词里。会话最新的非空系统提示词仍含那两段原文时,两个段落会原样重复它们(包括旧值),因此升级以及之后更换端口或 checkout 都不会改变该会话提示词的任何字节;运行时上下文行仍给出当前值。只是看起来像早期段落的文本会得到当前说明。
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## 理解实现
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>实现细节——点击展开</summary>
|
|
45
|
+
|
|
46
|
+
本节解释插件的设计;可观察行为见[使用本包](#use-this-package)。
|
|
47
|
+
|
|
48
|
+
### 设计思路
|
|
49
|
+
|
|
50
|
+
仅限宿主的会话投影 `harnessDevLegacyPrompt` 把每个已提交的非空 `system/message` 折叠为其中包含的早期格式段落,按值两侧的固定文本在同一行内匹配。段落文本提供函数通过 `AssembleContext.agent` 读取该状态;没有 agent 的组装使用当前说明。会话恢复时该投影与其他单元一起恢复,因此不同步读取任何历史事件。
|
|
51
|
+
|
|
52
|
+
### 源码地图
|
|
53
|
+
|
|
54
|
+
| 文件 | 职责 |
|
|
55
|
+
|---|---|
|
|
56
|
+
| [`src/index.ts`](src/index.ts) | 插件入口:段落、运行时上下文、早期格式投影 |
|
|
57
|
+
|
|
58
|
+
### 主流程
|
|
59
|
+
|
|
60
|
+
激活时注册投影单元、两个段落与两个上下文。每次组装时,段落在已提交的早期段落与当前说明之间选择;每次请求准入时,上下文读取公告 URL。销毁插件 fiber 会移除全部注册。
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
<a id="further-exploration"></a>
|
|
67
|
+
## 进一步探索
|
|
68
|
+
|
|
69
|
+
包级约定不够用时阅读这些页面。它们从决策记录走到本插件读取的服务。
|
|
70
|
+
|
|
71
|
+
- [进程相关值改走运行时上下文](../../../.agents/notes/implemented/bug-fix/2026-10-11-process-specific-prompt-values-in-runtime-context.zh.md)——这些值为什么离开系统提示词,以及早期会话如何保持稳定。
|
|
72
|
+
- [会话投影子系统](../../../docs/subsystems/session-projection.zh.md)——早期格式状态使用的投影约定。
|
|
73
|
+
- [Web app bundle](../../bundle/web-app/README.zh.md)——`webApp` 服务与挂载本插件的行。
|
|
74
|
+
- [Context 组地图](../README.zh.md)——同组的请求上下文包。
|
|
75
|
+
|
|
76
|
+
-----
|
|
77
|
+
|
|
78
|
+
<a id="model-experience"></a>
|
|
79
|
+
## 模型体验
|
|
80
|
+
|
|
81
|
+
### Harness checkout 与 Web GUI
|
|
82
|
+
|
|
83
|
+
#### 模型看到什么
|
|
84
|
+
|
|
85
|
+
两个系统提示词段落,位于可复用指令之后的第一方顺序 10000 与 10100;两行运行时上下文,位于上下文顺序 200 与 210。在早期版本下提交过提示词的会话看到的是自己的早期段落,而不是下面两段。
|
|
86
|
+
|
|
87
|
+
##### 系统提示词段落
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
The runtime context names the DeepSeek Harness implementation checkout. The checkout location and current working directory are separate values and may differ; never infer the working directory from the checkout path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself.
|
|
91
|
+
|
|
92
|
+
You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names. 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.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
##### 运行时上下文行
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
Current DeepSeek Harness implementation checkout: "<installation root>".
|
|
99
|
+
|
|
100
|
+
Current DeepSeek Harness Web GUI URL: "<advertised URL>".
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Token 影响
|
|
104
|
+
|
|
105
|
+
每个会话两段提示词,每份运行时上下文快照两行。checkout 或 URL 变化时追加一份快照。
|
|
106
|
+
|
|
107
|
+
#### KV Cache 影响
|
|
108
|
+
|
|
109
|
+
系统提示词在不同 checkout、端口与安装位置下完全相同,因此在别处启动的进程不会破坏已缓存的前缀;值变化时在其后追加一份运行时上下文快照。
|
|
110
|
+
|
|
111
|
+
## 已知限制与延期工作
|
|
112
|
+
|
|
113
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
114
|
+
|
|
115
|
+
这些限制说明稳定性保证覆盖哪些内容。它们是当前包约束。
|
|
116
|
+
|
|
117
|
+
- **只覆盖两段**——版本之间变化的其他系统提示词文本,在不支持 in-history 提示词更新的路由上仍会改写第一条 system 消息。
|
|
118
|
+
- **早期值保留**——早期格式会话在整个生命周期内都在系统提示词里保留旧 checkout 路径与 URL;只有之后的运行时上下文行是当前值。
|
|
119
|
+
- **混用版本**——不含本包的版本会改写以本包启动的会话的第一条 system 消息,因此共用同一 `DSH_HOME` 的每个 checkout 都需要先包含本包,才能交替运行。
|
|
120
|
+
- **可选值**——两行运行时上下文是可选的,因此设置 `includeRuntimeContext: false` 但未设置 `complete: true` 的自定义 persona 会保留指向其请求从不携带之值的段落。随附的 `minimal` persona 两者都设置。
|
|
121
|
+
- **没有段落的会话**——在 `surfaceContext: false` 隐藏两段时创建的会话,日志中两段都没有,因此恢复后的第一个请求会加入新段落,并在不支持 in-history 提示词更新的路由上改写第一条 system 消息。
|
|
122
|
+
- **只认一版早期措辞**——投影按本包之前紧邻的版本渲染的段落识别;保存更早措辞的会话会得到当前说明。
|
|
123
|
+
|
|
124
|
+
<a id="dev-note"></a>
|
|
125
|
+
### 开发备注
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary>维护者工作上下文——点击展开</summary>
|
|
129
|
+
|
|
130
|
+
无。
|
|
131
|
+
|
|
132
|
+
</details>
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region lib/types/index.js
|
|
4
|
+
/**
|
|
5
|
+
* @deepseek-ai/dsh-harness-dev-context — model context for an agent that can
|
|
6
|
+
* inspect and extend the DeepSeek Harness serving its Web GUI. It registers
|
|
7
|
+
* path- and URL-free prompt sections and states the current implementation
|
|
8
|
+
* checkout and Web GUI URL as runtime context, so a process started from
|
|
9
|
+
* another checkout, port, or installation leaves the system prompt unchanged.
|
|
10
|
+
* A Session whose admitted prompt holds the paragraphs that embedded those
|
|
11
|
+
* values keeps them verbatim, so resuming it never rewrites its logged prompt.
|
|
12
|
+
* @module @deepseek-ai/dsh-harness-dev-context
|
|
13
|
+
*/
|
|
14
|
+
/** Stable Cordis plugin name. */
|
|
15
|
+
const name = "harness-dev-context";
|
|
16
|
+
/** Prompt registries, the projection registry, and the Web GUI whose URL the model learns. */
|
|
17
|
+
const inject = [
|
|
18
|
+
"systemPrompt",
|
|
19
|
+
"sessionProjections",
|
|
20
|
+
"webApp"
|
|
21
|
+
];
|
|
22
|
+
/** This installation's root, four directories above this package's source or built entry. */
|
|
23
|
+
const SOURCE_ROOT = fileURLToPath(new URL("../../../..", import.meta.url));
|
|
24
|
+
/** Prompt-section and runtime-context name for the implementation checkout. */
|
|
25
|
+
const HARNESS_SOURCE = "harness:source";
|
|
26
|
+
/** Prompt-section and runtime-context name for the Web GUI orientation and its URL. */
|
|
27
|
+
const WEB_SURFACE = "app:web-surface";
|
|
28
|
+
const HARNESS_SOURCE_PROMPT = `The runtime context names the DeepSeek Harness implementation checkout. The checkout location and current working directory are separate values and may differ; never infer the working directory from the checkout path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself.`;
|
|
29
|
+
const WEB_SURFACE_PROMPT = `You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names. 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.`;
|
|
30
|
+
/**
|
|
31
|
+
* Fixed text around the value in each paragraph that embedded it, frozen as
|
|
32
|
+
* those releases rendered it: never edit these together with the current
|
|
33
|
+
* guidance, or Sessions holding the earlier paragraphs stop matching and
|
|
34
|
+
* rewrite their logged prompt.
|
|
35
|
+
*/
|
|
36
|
+
const LEGACY_SOURCE = {
|
|
37
|
+
prefix: "The DeepSeek Harness implementation checkout is at ",
|
|
38
|
+
suffix: ". The checkout location and current working directory are separate values and may differ; never infer the working directory from this path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself."
|
|
39
|
+
};
|
|
40
|
+
const LEGACY_WEB_SURFACE = {
|
|
41
|
+
prefix: "You are interacting with the user through the DeepSeek Harness Web GUI at ",
|
|
42
|
+
suffix: ". 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."
|
|
43
|
+
};
|
|
44
|
+
/** Host-only projection key of the value-bearing paragraphs a Session admitted. */
|
|
45
|
+
const LEGACY_PROMPT = "harnessDevLegacyPrompt";
|
|
46
|
+
const legacyPromptSchema = z.object({
|
|
47
|
+
source: z.string().nullable(),
|
|
48
|
+
web: z.string().nullable()
|
|
49
|
+
});
|
|
50
|
+
/** The complete single-line paragraph between `prefix` and `suffix`, or `null` when the prompt has none. */
|
|
51
|
+
function legacyParagraph(prompt, { prefix, suffix }) {
|
|
52
|
+
const start = prompt.indexOf(prefix);
|
|
53
|
+
if (start < 0) return null;
|
|
54
|
+
const end = prompt.indexOf(suffix, start + prefix.length);
|
|
55
|
+
if (end < 0) return null;
|
|
56
|
+
const paragraph = prompt.slice(start, end + suffix.length);
|
|
57
|
+
return paragraph.includes("\n") ? null : paragraph;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Fold one committed event into the admitted paragraphs. Like the loop's own
|
|
61
|
+
* prompt-version reading, only a single nonempty text block is a prompt
|
|
62
|
+
* version; an emptied or other version keeps the previous state, because a
|
|
63
|
+
* series consolidation can log only the emptied later version.
|
|
64
|
+
*/
|
|
65
|
+
function foldLegacyPrompt(state, event) {
|
|
66
|
+
if (event.type !== "system/message") return state;
|
|
67
|
+
const { content } = event.data.message;
|
|
68
|
+
const [block] = content;
|
|
69
|
+
if (content.length !== 1 || block?.type !== "text" || block.text === "") return state;
|
|
70
|
+
const source = legacyParagraph(block.text, LEGACY_SOURCE);
|
|
71
|
+
const web = legacyParagraph(block.text, LEGACY_WEB_SURFACE);
|
|
72
|
+
return source === state.source && web === state.web ? state : {
|
|
73
|
+
source,
|
|
74
|
+
web
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const ADMITS_NOTHING = {
|
|
78
|
+
source: null,
|
|
79
|
+
web: null
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Register the two sections, their runtime-context values, and the
|
|
83
|
+
* projection that keeps a Session's admitted paragraphs.
|
|
84
|
+
* @param ctx - plugin context with every {@link inject} service.
|
|
85
|
+
*/
|
|
86
|
+
function apply(ctx) {
|
|
87
|
+
ctx.sessionProjections.register({
|
|
88
|
+
key: LEGACY_PROMPT,
|
|
89
|
+
stateVersion: 1,
|
|
90
|
+
stateSchema: legacyPromptSchema,
|
|
91
|
+
init: () => ADMITS_NOTHING,
|
|
92
|
+
apply: foldLegacyPrompt
|
|
93
|
+
});
|
|
94
|
+
const admitted = (context) => {
|
|
95
|
+
const session = context.agent?.session;
|
|
96
|
+
return session === void 0 ? ADMITS_NOTHING : ctx.sessionProjections.stateOf(session, LEGACY_PROMPT);
|
|
97
|
+
};
|
|
98
|
+
ctx.systemPrompt.section({
|
|
99
|
+
name: HARNESS_SOURCE,
|
|
100
|
+
order: ctx.systemPrompt.getSectionOrder("HARNESS_SOURCE"),
|
|
101
|
+
interpolate: false,
|
|
102
|
+
text: (context) => admitted(context).source ?? HARNESS_SOURCE_PROMPT
|
|
103
|
+
});
|
|
104
|
+
ctx.systemPrompt.context({
|
|
105
|
+
name: HARNESS_SOURCE,
|
|
106
|
+
order: ctx.systemPrompt.getContextOrder("HARNESS_SOURCE"),
|
|
107
|
+
interpolate: false,
|
|
108
|
+
text: `Current DeepSeek Harness implementation checkout: ${JSON.stringify(SOURCE_ROOT)}.`
|
|
109
|
+
});
|
|
110
|
+
ctx.systemPrompt.section({
|
|
111
|
+
name: WEB_SURFACE,
|
|
112
|
+
order: ctx.systemPrompt.getSectionOrder("WEB_SURFACE"),
|
|
113
|
+
interpolate: false,
|
|
114
|
+
text: (context) => admitted(context).web ?? WEB_SURFACE_PROMPT
|
|
115
|
+
});
|
|
116
|
+
ctx.systemPrompt.context({
|
|
117
|
+
name: WEB_SURFACE,
|
|
118
|
+
order: ctx.systemPrompt.getContextOrder("WEB_SURFACE"),
|
|
119
|
+
interpolate: false,
|
|
120
|
+
text: () => `Current DeepSeek Harness Web GUI URL: ${JSON.stringify(ctx.webApp.getAdvertisedUrl())}.`
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deepseek-ai/dsh-harness-dev-context — model context for an agent that can
|
|
3
|
+
* inspect and extend the DeepSeek Harness serving its Web GUI. It registers
|
|
4
|
+
* path- and URL-free prompt sections and states the current implementation
|
|
5
|
+
* checkout and Web GUI URL as runtime context, so a process started from
|
|
6
|
+
* another checkout, port, or installation leaves the system prompt unchanged.
|
|
7
|
+
* A Session whose admitted prompt holds the paragraphs that embedded those
|
|
8
|
+
* values keeps them verbatim, so resuming it never rewrites its logged prompt.
|
|
9
|
+
* @module @deepseek-ai/dsh-harness-dev-context
|
|
10
|
+
*/
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
import { z as zod } from 'zod';
|
|
13
|
+
/** Stable Cordis plugin name. */
|
|
14
|
+
export declare const name = "harness-dev-context";
|
|
15
|
+
/** Prompt registries, the projection registry, and the Web GUI whose URL the model learns. */
|
|
16
|
+
export declare const inject: string[];
|
|
17
|
+
declare const legacyPromptSchema: zod.ZodObject<{
|
|
18
|
+
source: zod.ZodNullable<zod.ZodString>;
|
|
19
|
+
web: zod.ZodNullable<zod.ZodString>;
|
|
20
|
+
}, zod.core.$strip>;
|
|
21
|
+
/** Value-bearing paragraphs of the latest nonempty system prompt a Session committed; `null` where it has none. */
|
|
22
|
+
type LegacyPrompt = zod.infer<typeof legacyPromptSchema>;
|
|
23
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
24
|
+
interface SessionProjectionStateMap {
|
|
25
|
+
/** Value-bearing harness-source and Web-surface paragraphs of the latest nonempty admitted system prompt. */
|
|
26
|
+
harnessDevLegacyPrompt: LegacyPrompt;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Register the two sections, their runtime-context values, and the
|
|
31
|
+
* projection that keeps a Session's admitted paragraphs.
|
|
32
|
+
* @param ctx - plugin context with every {@link inject} service.
|
|
33
|
+
*/
|
|
34
|
+
export declare function apply(ctx: Context): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-harness-dev-context",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Model context naming the DeepSeek Harness checkout and Web GUI URL without letting either change the system prompt",
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
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/context/harness-dev-context"
|
|
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
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/index.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"zod": "4.4.3"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
|
|
42
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.3",
|
|
43
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
|
|
44
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.3",
|
|
45
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-web-app": "0.2.1-alpha.3"
|
|
48
|
+
}
|
|
6
49
|
}
|