pi-dsh-mimic 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 +22 -0
- package/NOTICE +16 -0
- package/README.md +155 -0
- package/README.zh-CN.md +133 -0
- package/SECURITY.md +41 -0
- package/docs/advanced.md +182 -0
- package/docs/advanced.zh-CN.md +151 -0
- package/docs/project2-evidence.md +230 -0
- package/package.json +70 -0
- package/scripts/session-stats.mjs +117 -0
- package/src/constants.ts +33 -0
- package/src/editor.ts +133 -0
- package/src/index.ts +188 -0
- package/src/protocol.ts +134 -0
- package/src/session-stage.ts +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Utopia-V
|
|
4
|
+
Portions Copyright (c) 2026 DeepSeek
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pi-dsh-mimic is a Pi implementation that reproduces the DSH Minimal request
|
|
2
|
+
surface for one task-bearing bootstrap, then returns to Pi-native execution.
|
|
3
|
+
|
|
4
|
+
Its Minimal persona, bash description, editor description, and function
|
|
5
|
+
schemas reproduce the public DeepSeek Harness Minimal request protocol from:
|
|
6
|
+
|
|
7
|
+
https://github.com/deepseek-ai/deepseek-harness
|
|
8
|
+
commit 47f943859bef60e4160492346772ded9b24f765a
|
|
9
|
+
|
|
10
|
+
DeepSeek Harness is distributed under the MIT License:
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 DeepSeek
|
|
13
|
+
|
|
14
|
+
The retained permission notice is included in LICENSE. Historical experiments
|
|
15
|
+
and research sources are documented separately from the package's source-code
|
|
16
|
+
provenance.
|
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
[Repository index](../../README.en.md) · [简体中文](README.zh-CN.md) · [Experiments and design](docs/advanced.md) · [Project2 evidence ledger (Chinese canonical)](docs/project2-evidence.md)
|
|
2
|
+
|
|
3
|
+
# pi-dsh-mimic
|
|
4
|
+
|
|
5
|
+
`pi-dsh-mimic` reproduces the DeepSeek Harness Minimal environment for the
|
|
6
|
+
first model request in [Pi](https://github.com/earendil-works/pi). DeepSeek V4
|
|
7
|
+
Pro begins from a verified high-capability trajectory; after the first valid
|
|
8
|
+
response, execution returns immediately to Pi with its complete tool catalog
|
|
9
|
+
and the user's other plugins.
|
|
10
|
+
|
|
11
|
+
One session gets both:
|
|
12
|
+
|
|
13
|
+
- the V4 Pro engineering trajectory established by a DSH Minimal first request;
|
|
14
|
+
- Pi's mature tools, session management, and plugin ecosystem.
|
|
15
|
+
|
|
16
|
+
Users do not need to install or run the complete DSH harness, and the session
|
|
17
|
+
does not remain restricted to Minimal's two tools.
|
|
18
|
+
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
For a fresh target session, the real task itself becomes the first model
|
|
22
|
+
request:
|
|
23
|
+
|
|
24
|
+
1. request #1 uses the Minimal persona and exposes only DSH-style `bash` and
|
|
25
|
+
`str_replace_editor`;
|
|
26
|
+
2. after the first successful assistant response or durable tool call, request
|
|
27
|
+
#2 restores Pi's native provider payload and complete current tool catalog;
|
|
28
|
+
3. the Minimal persona remains for the session, while Pi's larger generated
|
|
29
|
+
system prompt is not replayed as an extra user message.
|
|
30
|
+
|
|
31
|
+
The extension adds no identity warm-up or model round, makes no hidden copy of
|
|
32
|
+
the task, does not inject `We need`, and does not proxy the API.
|
|
33
|
+
|
|
34
|
+
## Project2 results
|
|
35
|
+
|
|
36
|
+
Default Pi scored 92. Four final runs of the same one-shot request flow scored
|
|
37
|
+
**98, 96, 96, and 98**, all with F3 at 16/16:
|
|
38
|
+
|
|
39
|
+
| Run | Provider | Score | Key dimensions |
|
|
40
|
+
| --- | --- | ---: | --- |
|
|
41
|
+
| Default Pi baseline | Official DeepSeek API | 92 | F3 11, F6 10, F8 6 |
|
|
42
|
+
| Early Minimal-mimic prototype | Official DeepSeek API | **98** | F3 16, F6 10, F8 7 |
|
|
43
|
+
| Same-flow replication | Official DeepSeek API | 96 | F3 16, F6 10, F8 5 |
|
|
44
|
+
| First packaged implementation | Official DeepSeek API | 96 | F3 16, F6 8, F8 7 |
|
|
45
|
+
| Current independent implementation `0.1.0` | OpenCode Go | **98** | F3 16, F6 10, F8 7 |
|
|
46
|
+
|
|
47
|
+
The results show that a DSH Minimal first request can establish a strong V4 Pro
|
|
48
|
+
trajectory inside Pi and that restoring Pi's full tool catalog does not break
|
|
49
|
+
it. See [Experiments and design](docs/advanced.md) for the rejected alternatives
|
|
50
|
+
and the evidence behind each implementation choice. The
|
|
51
|
+
[Project2 evidence ledger](docs/project2-evidence.md), maintained in Chinese,
|
|
52
|
+
contains evaluator IDs and sources.
|
|
53
|
+
|
|
54
|
+
## Install and use
|
|
55
|
+
|
|
56
|
+
Requirements: Node.js 22.19 or later, Pi 0.84.2 or later, and either official
|
|
57
|
+
DeepSeek API or OpenCode Go configuration. Pi 0.84.2 includes both provider
|
|
58
|
+
routes.
|
|
59
|
+
|
|
60
|
+
Try the current checkout directly:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi -e ./packages/pi-dsh-mimic \
|
|
64
|
+
--provider deepseek \
|
|
65
|
+
--model deepseek-v4-pro
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For OpenCode Go, configure its key through Pi's expected `OPENCODE_API_KEY`
|
|
69
|
+
environment variable:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pi -e ./packages/pi-dsh-mimic \
|
|
73
|
+
--provider opencode-go \
|
|
74
|
+
--model deepseek-v4-pro
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Install it for the current user:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pi install ./packages/pi-dsh-mimic
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use `pi install -l ./packages/pi-dsh-mimic` for project-local settings. The
|
|
84
|
+
package has not been published to npm.
|
|
85
|
+
The manifest already includes the `pi-package` keyword required by the
|
|
86
|
+
[Pi Package Catalog](https://pi.dev/packages); the catalog can discover it only
|
|
87
|
+
after publication to npm. The published install command will be
|
|
88
|
+
`pi install npm:pi-dsh-mimic`.
|
|
89
|
+
|
|
90
|
+
Select V4 Pro before starting a new session. Switching to V4 Pro inside an
|
|
91
|
+
existing conversation does not forge a new bootstrap.
|
|
92
|
+
|
|
93
|
+
## Request lifecycle
|
|
94
|
+
|
|
95
|
+
| | Bootstrap request | Execution requests |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| System persona | `You are a helpful software engineer assistant.` | unchanged |
|
|
98
|
+
| User history | Original task, including Pi-native images | unchanged |
|
|
99
|
+
| Provider-visible tools | `bash`, `str_replace_editor` | Pi's complete current catalog, including plugin tools |
|
|
100
|
+
| Provider payload | DSH Minimal shape; Pi cache fields omitted | Pi-native encoding and ordering; cache follows provider configuration |
|
|
101
|
+
|
|
102
|
+
The extension never calls `setActiveTools` and never overrides Pi's native
|
|
103
|
+
`bash`, `read`, `edit`, or `write`. It registers one executable
|
|
104
|
+
`str_replace_editor` only when a fresh target session arms. From request #2,
|
|
105
|
+
tools contributed by other packages appear in the complete catalog.
|
|
106
|
+
|
|
107
|
+
Provider errors and aborted responses do not consume the bootstrap. A small Pi
|
|
108
|
+
custom entry persists the phase, and durable assistant/tool history repairs a
|
|
109
|
+
crash-stale state on resume.
|
|
110
|
+
|
|
111
|
+
## Offline verification
|
|
112
|
+
|
|
113
|
+
TypeScript typechecking and all 13 automated tests pass. Twelve cover package
|
|
114
|
+
behavior and its manifest; one verifies the session-statistics helper. Package
|
|
115
|
+
behavior coverage includes:
|
|
116
|
+
|
|
117
|
+
- original task, persona, field order, cache omission, and two-tool schemas in
|
|
118
|
+
request #1;
|
|
119
|
+
- Pi-native payload, complete catalog, and plugin-tool restoration in request
|
|
120
|
+
#2;
|
|
121
|
+
- images, API-error retry, text promotion, session resume, and crash-stale
|
|
122
|
+
recovery;
|
|
123
|
+
- existing-conversation isolation, both providers, and non-target models;
|
|
124
|
+
- editor create, view, replace, insert, and ambiguous-replacement rejection.
|
|
125
|
+
|
|
126
|
+
OpenCode Go bash-first and editor-first offline loopbacks also pass through Pi's
|
|
127
|
+
real package loader and provider path with `realModelCalls=0`. Request #2 carries
|
|
128
|
+
a real tool result and restores `read/bash/edit/write/str_replace_editor`. After
|
|
129
|
+
normalizing the user task, the new request #1 matches the historical 98-point
|
|
130
|
+
capture in messages, key order, schemas, `strict:false`, and serialized
|
|
131
|
+
structure.
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cd packages/pi-dsh-mimic
|
|
137
|
+
npm install
|
|
138
|
+
npm run check
|
|
139
|
+
npm run pack:check
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Security, cost, and sources
|
|
143
|
+
|
|
144
|
+
This package runs with the Pi process's filesystem permissions;
|
|
145
|
+
`str_replace_editor` can create and modify files. The task, context, and tool
|
|
146
|
+
results are sent to the selected DeepSeek or OpenCode provider. The package
|
|
147
|
+
does not read, store, log, or transmit API keys and adds no model round. See
|
|
148
|
+
[SECURITY.md](SECURITY.md).
|
|
149
|
+
|
|
150
|
+
The Minimal persona and two tool-protocol texts come from DeepSeek Harness's
|
|
151
|
+
[public Minimal protocol](https://github.com/deepseek-ai/deepseek-harness). See
|
|
152
|
+
[LICENSE](LICENSE) and [NOTICE](NOTICE). The current implementation is based on
|
|
153
|
+
that public protocol, request captures made by this project, and the Project2
|
|
154
|
+
experiments. It is not affiliated with or endorsed by Pi, DeepSeek, OpenCode,
|
|
155
|
+
or OpenAI.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[仓库索引](../../README.md) · [English](README.md) · [实验与设计](docs/advanced.zh-CN.md) · [Project2 证据账本](docs/project2-evidence.md)
|
|
2
|
+
|
|
3
|
+
# pi-dsh-mimic
|
|
4
|
+
|
|
5
|
+
`pi-dsh-mimic` 在 [Pi](https://github.com/earendil-works/pi) 的第一次模型请求中复现
|
|
6
|
+
DeepSeek Harness Minimal 环境,让 DeepSeek V4 Pro 从已验证的高能力轨迹起步;第一次
|
|
7
|
+
有效响应后,它立即回到 Pi 原生执行,恢复完整工具目录和用户安装的其他插件。
|
|
8
|
+
|
|
9
|
+
它把两件事放进同一个 session:
|
|
10
|
+
|
|
11
|
+
- DSH Minimal 首请求带来的 V4 Pro 工程能力;
|
|
12
|
+
- Pi 成熟的工具、session 管理和插件生态。
|
|
13
|
+
|
|
14
|
+
用户无需安装或运行完整 DSH harness,也不必长期停留在两个工具的 Minimal 环境中。
|
|
15
|
+
|
|
16
|
+
## 工作方式
|
|
17
|
+
|
|
18
|
+
新建目标 session 的真实任务直接成为第一次模型请求:
|
|
19
|
+
|
|
20
|
+
1. 请求 #1 使用 Minimal persona,只暴露 DSH 风格的 `bash` 与
|
|
21
|
+
`str_replace_editor`;
|
|
22
|
+
2. 第一个成功 assistant response 或 durable tool call 后,请求 #2 恢复 Pi 原生
|
|
23
|
+
provider payload 和当下完整工具目录;
|
|
24
|
+
3. Minimal persona 在整个 session 保持,Pi 较长的自动 system prompt 不会作为额外
|
|
25
|
+
user message 重放。
|
|
26
|
+
|
|
27
|
+
扩展不增加身份 warm-up 或模型轮次,不复制原任务,不注入 `We need`,也不代理 API。
|
|
28
|
+
|
|
29
|
+
## Project2 结果
|
|
30
|
+
|
|
31
|
+
默认 Pi 得到 92。相同 one-shot 请求流程的四次最终结果为 **98、96、96、98**,均保持
|
|
32
|
+
F3 16/16:
|
|
33
|
+
|
|
34
|
+
| 运行 | Provider | 分数 | 关键分项 |
|
|
35
|
+
| --- | --- | ---: | --- |
|
|
36
|
+
| 默认 Pi baseline | DeepSeek 官方 API | 92 | F3 11,F6 10,F8 6 |
|
|
37
|
+
| 早期 Minimal 模拟原型 | DeepSeek 官方 API | **98** | F3 16,F6 10,F8 7 |
|
|
38
|
+
| 同流程复现实验 | DeepSeek 官方 API | 96 | F3 16,F6 10,F8 5 |
|
|
39
|
+
| 首次 package 化实现 | DeepSeek 官方 API | 96 | F3 16,F6 8,F8 7 |
|
|
40
|
+
| 当前独立实现 `0.1.0` | OpenCode Go | **98** | F3 16,F6 10,F8 7 |
|
|
41
|
+
|
|
42
|
+
这些结果表明:DSH Minimal 首请求可以在 Pi 中稳定建立高能力轨迹,而恢复 Pi 完整工具
|
|
43
|
+
目录不会破坏它。实验过程、被否决的设计和每项实现选择的依据见
|
|
44
|
+
[实验与设计](docs/advanced.zh-CN.md);完整 evaluator IDs 与来源见
|
|
45
|
+
[Project2 证据账本](docs/project2-evidence.md)。
|
|
46
|
+
|
|
47
|
+
## 安装和使用
|
|
48
|
+
|
|
49
|
+
要求:Node.js 22.19 或更新版本、Pi 0.84.2 或更新版本,并已配置 DeepSeek 官方 API 或
|
|
50
|
+
OpenCode Go。Pi 0.84.2 已内置两条 provider 路径。
|
|
51
|
+
|
|
52
|
+
直接试用当前 checkout:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pi -e ./packages/pi-dsh-mimic \
|
|
56
|
+
--provider deepseek \
|
|
57
|
+
--model deepseek-v4-pro
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
使用 OpenCode Go 时,把 key 配置在 Pi 期望的 `OPENCODE_API_KEY` 环境变量中:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi -e ./packages/pi-dsh-mimic \
|
|
64
|
+
--provider opencode-go \
|
|
65
|
+
--model deepseek-v4-pro
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
安装到当前用户:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pi install ./packages/pi-dsh-mimic
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
项目级安装使用 `pi install -l ./packages/pi-dsh-mimic`。当前 package 尚未发布到 npm。
|
|
75
|
+
Manifest 已包含 Pi gallery 要求的 `pi-package` keyword;发布到 npm 后才会出现在
|
|
76
|
+
[Pi Package Catalog](https://pi.dev/packages),安装命令将是
|
|
77
|
+
`pi install npm:pi-dsh-mimic`。当前 checkout 不会被市场索引。
|
|
78
|
+
|
|
79
|
+
先选择 V4 Pro,再新建 session。在已有对话中途切换到 V4 Pro 不会伪造新的 bootstrap。
|
|
80
|
+
|
|
81
|
+
## 请求生命周期
|
|
82
|
+
|
|
83
|
+
| | Bootstrap 请求 | 执行阶段请求 |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| System persona | `You are a helpful software engineer assistant.` | 保持不变 |
|
|
86
|
+
| User 历史 | 原始任务,包括 Pi 原生图片 | 不变 |
|
|
87
|
+
| Provider 可见工具 | `bash`、`str_replace_editor` | Pi 当下完整目录,包括其他插件工具 |
|
|
88
|
+
| Provider payload | DSH Minimal 形状;移除 Pi cache 字段 | Pi 原生编码与排序;cache 随 provider 配置 |
|
|
89
|
+
|
|
90
|
+
扩展不调用 `setActiveTools`,也不覆盖 Pi 原生 `bash`、`read`、`edit` 或 `write`。目标
|
|
91
|
+
新 session 武装时才注册一个可执行 `str_replace_editor`;请求 #2 起,其他 package
|
|
92
|
+
提供的工具会自然出现在完整目录中。
|
|
93
|
+
|
|
94
|
+
Provider error 或 aborted response 不消耗 bootstrap。阶段通过小型 Pi custom entry
|
|
95
|
+
持久化,恢复时也能根据 durable assistant/tool 历史修正 crash-stale 状态。
|
|
96
|
+
|
|
97
|
+
## 离线验证
|
|
98
|
+
|
|
99
|
+
TypeScript typecheck 已通过,13 项自动化测试全部通过。其中 12 项覆盖 package 行为与
|
|
100
|
+
manifest,1 项验证 session 统计工具。Package 行为测试覆盖:
|
|
101
|
+
|
|
102
|
+
- 首请求原任务、persona、字段顺序、cache 移除和两工具 schema;
|
|
103
|
+
- 请求 #2 恢复 Pi 原生 payload、完整目录和其他插件工具;
|
|
104
|
+
- 图片、API error 重试、文本回答晋升、session resume 和 crash-stale 恢复;
|
|
105
|
+
- 已有对话隔离、DeepSeek/OpenCode 双 provider 与非目标模型隔离;
|
|
106
|
+
- editor 的 create、view、replace、insert 和歧义替换拒绝。
|
|
107
|
+
|
|
108
|
+
OpenCode Go bash-first 与 editor-first 离线回环还通过 Pi 的真实 package loader 和 provider
|
|
109
|
+
路径验证了两个请求,`realModelCalls=0`。请求 #2 携带真实工具结果,并恢复
|
|
110
|
+
`read/bash/edit/write/str_replace_editor`。归一 user task 后,新请求 #1 与历史 98 分
|
|
111
|
+
capture 在消息、字段顺序、schema、`strict:false` 和序列化结构上逐项相等。
|
|
112
|
+
|
|
113
|
+
## 开发
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cd packages/pi-dsh-mimic
|
|
117
|
+
npm install
|
|
118
|
+
npm run check
|
|
119
|
+
npm run pack:check
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 安全、费用与来源
|
|
123
|
+
|
|
124
|
+
本 package 以 Pi 进程的文件系统权限运行;`str_replace_editor` 可以创建和修改文件。
|
|
125
|
+
任务、上下文和工具结果会发送给所选 DeepSeek 或 OpenCode provider。package 不读取、
|
|
126
|
+
保存、记录或传输 API key,也不增加额外模型轮次。完整说明见
|
|
127
|
+
[SECURITY.md](SECURITY.md)。
|
|
128
|
+
|
|
129
|
+
Minimal persona 与两项工具协议文本来自
|
|
130
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的公开 Minimal 协议;
|
|
131
|
+
对应许可声明见 [LICENSE](LICENSE) 和 [NOTICE](NOTICE)。当前实现依据该公开协议、本项目
|
|
132
|
+
捕获的请求和 Project2 实验完成,与 Pi、DeepSeek、OpenCode 或 OpenAI 均无隶属或官方
|
|
133
|
+
背书关系。
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## API keys
|
|
4
|
+
|
|
5
|
+
`pi-dsh-mimic` does not read, save, log, or transmit API keys. Provider
|
|
6
|
+
credentials remain under Pi and the selected provider's configuration. Never
|
|
7
|
+
put a DeepSeek or OpenCode key in a prompt, repository file, issue, screenshot,
|
|
8
|
+
or captured request.
|
|
9
|
+
|
|
10
|
+
If a credential has been exposed, revoke or rotate it with the provider before
|
|
11
|
+
continuing.
|
|
12
|
+
|
|
13
|
+
## Provider data boundary
|
|
14
|
+
|
|
15
|
+
For target sessions, the task, conversation messages, tool schemas, and later
|
|
16
|
+
tool results are sent through either `deepseek/deepseek-v4-pro` or
|
|
17
|
+
`opencode-go/deepseek-v4-pro`. The extension changes the first request's
|
|
18
|
+
persona and tool surface, but it is not an API proxy and does not create a
|
|
19
|
+
confidential channel.
|
|
20
|
+
|
|
21
|
+
The package adds no model round. The user's ordinary first task is the
|
|
22
|
+
bootstrap request and is billed normally by the selected provider.
|
|
23
|
+
|
|
24
|
+
## Filesystem and tool ownership
|
|
25
|
+
|
|
26
|
+
The extension runs with the Pi process's filesystem permissions. Its
|
|
27
|
+
`str_replace_editor` can view, create, and modify files. Review the package
|
|
28
|
+
before installation and apply the same workspace and permission controls used
|
|
29
|
+
for any other Pi extension.
|
|
30
|
+
|
|
31
|
+
The package does not call `setActiveTools` and does not override Pi's native
|
|
32
|
+
`bash`, `read`, `edit`, or `write`. Another extension that registers the same
|
|
33
|
+
`str_replace_editor` name creates a real ownership conflict and should not be
|
|
34
|
+
combined without review.
|
|
35
|
+
|
|
36
|
+
## Reports
|
|
37
|
+
|
|
38
|
+
Security reports and redacted repository issues should follow the root
|
|
39
|
+
[security guidance](../../SECURITY.md). Do not submit full provider payloads
|
|
40
|
+
until task content, headers, credentials, and unrelated source have been
|
|
41
|
+
removed.
|
package/docs/advanced.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
[简体中文](advanced.zh-CN.md) · [Back to the user guide](../README.md) · [Complete evidence ledger (Chinese canonical)](project2-evidence.md)
|
|
2
|
+
|
|
3
|
+
# Start V4 Pro with DSH Minimal, then return to Pi
|
|
4
|
+
|
|
5
|
+
`pi-dsh-mimic` reproduces only the most useful part of DSH: the first model
|
|
6
|
+
request. The real task enters a Minimal-persona environment with
|
|
7
|
+
`bash/str_replace_editor`, establishing a verified high-capability V4 Pro
|
|
8
|
+
trajectory. After the first valid response, requests return to Pi-native form
|
|
9
|
+
and the model regains Pi's complete tool catalog and other plugins.
|
|
10
|
+
|
|
11
|
+
There is no need to reproduce the complete DSH harness. DSH Minimal supplies
|
|
12
|
+
the first-request training interface; Pi continues to own sessions, tool
|
|
13
|
+
execution, file editing, and plugin composition. The result combines the
|
|
14
|
+
96–98 Project2 band observed in these experiments with Pi's mature agent
|
|
15
|
+
runtime.
|
|
16
|
+
|
|
17
|
+
## Experimental basis
|
|
18
|
+
|
|
19
|
+
Local runs use Project2 V4.1b at frozen commit
|
|
20
|
+
`04255b55f16c4439e538239fb9783070c4165081`. When a run resumed after an
|
|
21
|
+
interruption, only its final submission score entered the comparison. A wrong
|
|
22
|
+
project root, a zero-token configuration failure, and duplicate evaluation do
|
|
23
|
+
not count as new samples.
|
|
24
|
+
|
|
25
|
+
`We need`, `Let me`, and reasoning-block counts identify trajectory changes.
|
|
26
|
+
Final judgment comes from the F3 ambient-session boundary, F6 migration, F8 ESP
|
|
27
|
+
contract, hidden tests, and complete delivery. Evaluator IDs and exclusions are
|
|
28
|
+
recorded in the [evidence ledger](project2-evidence.md).
|
|
29
|
+
|
|
30
|
+
## DSH Minimal established that the capability is reachable
|
|
31
|
+
|
|
32
|
+
External results provided a clear calibration. Under the same WSL/max/build
|
|
33
|
+
conditions, DSH Minimal scored 99 and 96, while Standard scored 91 and PTC
|
|
34
|
+
scored 92. Later Anchored Standard runs restored a 25-tool catalog after the
|
|
35
|
+
first tool call and scored 98 and 99.
|
|
36
|
+
|
|
37
|
+
These results establish two facts: the first request's persona and schemas can
|
|
38
|
+
change V4 Pro's engineering trajectory, and a complete tool catalog does not
|
|
39
|
+
automatically break the trajectory after it has formed. `pi-dsh-mimic` brings
|
|
40
|
+
both properties into Pi.
|
|
41
|
+
|
|
42
|
+
## The decisive Pi comparison
|
|
43
|
+
|
|
44
|
+
A matched local pair narrowed the main difference to the first request:
|
|
45
|
+
|
|
46
|
+
| Run | First request and later execution | Score | Key result |
|
|
47
|
+
| --- | --- | ---: | --- |
|
|
48
|
+
| Default Pi baseline | Full Pi prompt and five tools; native throughout | 92 | F3 11, F6 10, F8 6 |
|
|
49
|
+
| Early Minimal-mimic prototype | Real task in a Minimal two-tool request; Pi-native after the first tool call; no Pi-context replay | **98** | F3 16, F6 10, F8 7, hidden 44/45 |
|
|
50
|
+
|
|
51
|
+
Around assistant response 107, the 98-point trajectory reversed its earlier
|
|
52
|
+
ambient fallback. Sensitive context had to carry an explicit `session_id`, and
|
|
53
|
+
the voice path first resolved the current session before passing it onward.
|
|
54
|
+
That self-correction directly explains F3 16/16 and is more meaningful than a
|
|
55
|
+
first-line phrase.
|
|
56
|
+
|
|
57
|
+
## Negative results narrowed the implementation
|
|
58
|
+
|
|
59
|
+
Later runs tested the remaining explanations directly:
|
|
60
|
+
|
|
61
|
+
| Question | Experiment | Result | Implementation choice |
|
|
62
|
+
| --- | --- | ---: | --- |
|
|
63
|
+
| Is an identity warm-up required? | Zero-tool Whoami | 93 | Put the real task in request #1 |
|
|
64
|
+
| Is tool scarcity sufficient? | Pi-native `bash/read` | 93 | Use the DSH Minimal schemas |
|
|
65
|
+
| Should the model be forced to emit the fingerprint first? | Wire Think | 94; F3 16, F6 6 | Do not inject or optimize for `We need` |
|
|
66
|
+
| Should DSH wire normalization persist? | Persistent DSH wire | 94; F3 11 | Return to Pi-native requests after the first valid response |
|
|
67
|
+
| Should Pi system context be replayed after promotion? | Full context replay | 90; F6 8 | Keep the Minimal persona without replaying full Pi context |
|
|
68
|
+
| Is an approximate Minimal surface sufficient? | Approximate Minimal → Pi-native | 93; first line returned to `Let me` | Use the observed 98-point first request as the implementation baseline |
|
|
69
|
+
|
|
70
|
+
A same-flow replication scored 96 with F3 still at 16/16. Most of its variation
|
|
71
|
+
was in ESP static completeness.
|
|
72
|
+
|
|
73
|
+
## From experimental prototype to current implementation
|
|
74
|
+
|
|
75
|
+
The same request flow then reached complete Project2 endpoints in two clean
|
|
76
|
+
implementations:
|
|
77
|
+
|
|
78
|
+
| Implementation | Provider | Score | F3 | F6 | F8 |
|
|
79
|
+
| --- | --- | ---: | ---: | ---: | ---: |
|
|
80
|
+
| First packaged implementation | Official DeepSeek API | 96 | 16 | 8 | 7 |
|
|
81
|
+
| Current independent implementation `0.1.0` | OpenCode Go | **98** | 16 | 10 | 7 |
|
|
82
|
+
|
|
83
|
+
The initial OpenCode Go request hit an account opt-in 403 before producing a
|
|
84
|
+
token. The same session resumed after opt-in, stopped naturally, and scored 98.
|
|
85
|
+
The run verifies that the current implementation reaches the same high band
|
|
86
|
+
through OpenCode Go.
|
|
87
|
+
|
|
88
|
+
Both the official DeepSeek API and OpenCode Go reached 96–98. A weaker OpenCode
|
|
89
|
+
model is no longer needed to explain the observed gap.
|
|
90
|
+
|
|
91
|
+
## Why Pi plugins remain available
|
|
92
|
+
|
|
93
|
+
| | Bootstrap request | Execution requests |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| System persona | `You are a helpful software engineer assistant.` | unchanged |
|
|
96
|
+
| User history | Original task, including Pi-native image blocks | unchanged |
|
|
97
|
+
| Provider-visible tools | `bash`, `str_replace_editor` | Pi's complete current catalog, including plugin tools |
|
|
98
|
+
| Provider payload | DSH Minimal shape; Pi cache fields removed | Pi-native encoding and ordering; cache follows provider configuration |
|
|
99
|
+
|
|
100
|
+
The extension never calls `setActiveTools` and never overrides Pi's `bash`,
|
|
101
|
+
`read`, `edit`, or `write`. It registers one executable `str_replace_editor`
|
|
102
|
+
only when a fresh target session arms. From request #2, Pi again owns the
|
|
103
|
+
provider payload and active catalog, so tools from other packages appear
|
|
104
|
+
naturally.
|
|
105
|
+
|
|
106
|
+
That is the boundary between a mimic and a complete harness port: the extension
|
|
107
|
+
establishes a DSH Minimal first request, while Pi remains the execution runtime.
|
|
108
|
+
|
|
109
|
+
## Product behavior and evidence
|
|
110
|
+
|
|
111
|
+
| Current behavior | Main evidence |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| Arm only fresh sessions on the target provider/model pairs | An existing conversation cannot reproduce a real bootstrap; isolation tests cover target and non-target models |
|
|
114
|
+
| Put the original task in request #1 | Early prototype 98; Whoami 93 |
|
|
115
|
+
| Use the Minimal persona and DSH schemas in request #1 | Pi-native `bash/read` 93; approximate Minimal 93 |
|
|
116
|
+
| Return to Pi-native execution after the first valid response | One-shot 96–98; persistent DSH wire 94 |
|
|
117
|
+
| Keep the Minimal persona without replaying full Pi system context | Context replay 90 |
|
|
118
|
+
| Retry bootstrap after provider error or abort | Error-retry, durable-stage, and crash-stale recovery tests |
|
|
119
|
+
|
|
120
|
+
## Trajectory and tool scale
|
|
121
|
+
|
|
122
|
+
With case-insensitive matching, the default baseline contained 156 occurrences
|
|
123
|
+
of `let me` across 78 reasoning blocks, while the 98-point prototype contained
|
|
124
|
+
one across 135 blocks. Exact case-sensitive counts are 115 and one. This quickly
|
|
125
|
+
shows whether the first request changed the model's reasoning habit.
|
|
126
|
+
|
|
127
|
+
The [evidence ledger](project2-evidence.md) now records assistant, reasoning,
|
|
128
|
+
`We need / Let me`, tool-call, tool-name, and stopReason aggregates for all 11
|
|
129
|
+
runs. Tool volume alone does not determine ability: persistent DSH wire made
|
|
130
|
+
225 tool calls and scored 94, while the early prototype made 148 and scored 98.
|
|
131
|
+
The current implementation used `bash/read/edit/write` 193 times and scored 98.
|
|
132
|
+
|
|
133
|
+
The persistent-wire run also contained very few `Let me` occurrences, and Wire
|
|
134
|
+
Think began with `We need` but scored 94. The extension observes these phrases
|
|
135
|
+
without injecting them into the prompt.
|
|
136
|
+
|
|
137
|
+
## Implementation verification
|
|
138
|
+
|
|
139
|
+
TypeScript typechecking and all 13 automated tests pass. Twelve cover both
|
|
140
|
+
providers, images, error retry, text promotion, session resume, crash-stale
|
|
141
|
+
recovery, existing-conversation isolation, and non-target model isolation; one
|
|
142
|
+
verifies the session-statistics helper. Editor tests cover create, view, unique
|
|
143
|
+
replacement, insertion, relative-path rejection, and ambiguous-replacement
|
|
144
|
+
rejection.
|
|
145
|
+
|
|
146
|
+
OpenCode Go bash-first and editor-first offline loopbacks capture two requests
|
|
147
|
+
through Pi's real package loader and provider path with `realModelCalls=0`.
|
|
148
|
+
Request #2 restores `read/bash/edit/write/str_replace_editor` and carries a real
|
|
149
|
+
tool result. After normalizing the user task, the new request #1 matches the
|
|
150
|
+
historical 98-point capture in messages, key order, schemas, `strict:false`, and
|
|
151
|
+
serialized structure.
|
|
152
|
+
|
|
153
|
+
## Score details and reopening criteria
|
|
154
|
+
|
|
155
|
+
The 98-point prototype and the verifiable DSH Minimal 99 both passed hidden
|
|
156
|
+
44/45 and F3 16/16, missing the same one-point F12 rejection-reason string. The
|
|
157
|
+
prototype's remaining loss is a grader function-name mismatch even though the
|
|
158
|
+
implementation checks Wi-Fi, UID, room, and bed. The published score remains
|
|
159
|
+
the evaluator's original score.
|
|
160
|
+
|
|
161
|
+
The current request flow has four Project2 results in the 96–98 band. A new
|
|
162
|
+
task, model or service version, material provider-payload change, or new complete
|
|
163
|
+
task result would justify another paid run.
|
|
164
|
+
|
|
165
|
+
## Sources and attribution
|
|
166
|
+
|
|
167
|
+
The Minimal persona, bash description, editor description, and function schemas
|
|
168
|
+
come from DeepSeek Harness's
|
|
169
|
+
[public Minimal protocol](https://github.com/deepseek-ai/deepseek-harness). The
|
|
170
|
+
exact commit and license notices are in [LICENSE](../LICENSE) and
|
|
171
|
+
[NOTICE](../NOTICE). External Project2 calibration comes from
|
|
172
|
+
[`xiaobright/modeltest`](https://github.com/xiaobright/modeltest) and
|
|
173
|
+
[`xiaobright/dsh-anchored-standard`](https://github.com/xiaobright/dsh-anchored-standard).
|
|
174
|
+
|
|
175
|
+
The current source was implemented from the DeepSeek Harness Minimal protocol,
|
|
176
|
+
request captures made by this project, and this project's experiments. It did
|
|
177
|
+
not reference or port source from
|
|
178
|
+
[`kxh4892636/pi-deepseek-anchor`](https://github.com/kxh4892636/pi-deepseek-anchor).
|
|
179
|
+
An early exploration loaded that extension to test the two-stage path in Pi, so
|
|
180
|
+
the evidence ledger retains that run provenance. The current implementation,
|
|
181
|
+
automated tests, offline loopbacks, and Project2 scores are produced by this
|
|
182
|
+
project.
|