@deepseek-ai/dsh-tool-pwsh-persistent 0.2.0-rc.1 → 0.2.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +6 -6
- package/README.md +2 -3
- package/README.zh.md +2 -3
- package/lib/index.js +1 -1
- package/package.json +26 -26
package/README.i18n.yaml
CHANGED
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
en: 8d94a7381bca3fa9
|
|
34
34
|
zh: f4bd2866fff6fa8d
|
|
35
35
|
/deepseek-ai-dsh-tool-pwsh-persistent/understand-the-implementation/design-philosophy:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: b9b75c3251f29f02
|
|
37
|
+
zh: 9114aad4726f6d0c
|
|
38
38
|
/deepseek-ai-dsh-tool-pwsh-persistent/understand-the-implementation/source-map:
|
|
39
|
-
en:
|
|
40
|
-
zh:
|
|
39
|
+
en: 857e036f41c913ac
|
|
40
|
+
zh: e9f383f7ee384c59
|
|
41
41
|
/deepseek-ai-dsh-tool-pwsh-persistent/understand-the-implementation/command-flow:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 7440916d998ed5bd
|
|
43
|
+
zh: 66f70f803c519802
|
|
44
44
|
/deepseek-ai-dsh-tool-pwsh-persistent/further-exploration:
|
|
45
45
|
en: e836ecbf7370bc76
|
|
46
46
|
zh: 84fed68318df81ff
|
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ This section explains the design decisions behind the tool and points at the cod
|
|
|
73
73
|
### Design philosophy
|
|
74
74
|
|
|
75
75
|
- **A deliberate twin of `dsh-tool-bash-persistent`.** The session registry, polling loop, and reset contract mirror the persistent bash tool by design ([pwsh persistent PTY Agent Note](../../../.agents/notes/archived/architecture/2026-08-11-pwsh-persistent-pty.md)).
|
|
76
|
-
- **Backend-owned prompt readiness.** The shell's `prompt` function belongs to the backend: it prints a BEL-terminated OSC marker plus the controlled printable prompt
|
|
76
|
+
- **Backend-owned prompt readiness.** The shell's `prompt` function belongs to the backend: it prints a BEL-terminated OSC marker plus the controlled printable prompt. The backend accepts recognized prompt text through its fast path and otherwise uses its own readiness checks or silence tier. The tool neither installs nor matches a prompt of its own.
|
|
77
77
|
- **PSReadLine echo stripped by anchoring.** PowerShell renders submitted input back into the stream; the marker-anchored extraction and a wrapper-source strip remove the echo, and a wrapper that wraps across the terminal width may leave a partial echo in partial-output results.
|
|
78
78
|
- **Reset, never repair.** Any uncertain state — an explicit `exit`, a timeout, a send failure, an abort — closes the shell and starts the next call fresh.
|
|
79
79
|
|
|
@@ -82,11 +82,10 @@ This section explains the design decisions behind the tool and points at the cod
|
|
|
82
82
|
| File | Role |
|
|
83
83
|
|---|---|
|
|
84
84
|
| [`src/index.ts`](src/index.ts) | Plugin entry: shell registry, command wrapping, scrollback polling, extraction and rendering |
|
|
85
|
-
| — | No runtime invariant companion is published; the adapter's private owner-to-shell cache has no observable event or data relation. Lifecycle tests prove its cleanup without adding a public API solely for an invariant. |
|
|
86
85
|
|
|
87
86
|
### Command flow
|
|
88
87
|
|
|
89
|
-
A first command spawns the shell through `ctx.terminals.spawn`, whose pwsh startup installs the controlled `prompt` function and returns only once the shell reached readiness. Each command is wrapped into one physical line — `Write-Output` of the start marker, the body escaped with backtick escapes into a double-quoted string, and `Write-Output` of the end marker plus the exit status — so PSReadLine's echo of a wrapped line cannot fabricate completion. The tool polls the scrollback in 1,000-line pages until
|
|
88
|
+
A first command spawns the shell through `ctx.terminals.spawn`, whose pwsh startup installs the controlled `prompt` function and returns only once the shell reached readiness. Each command is wrapped into one physical line — `Write-Output` of the start marker, the body escaped with backtick escapes into a double-quoted string, and `Write-Output` of the end marker plus the exit status — so PSReadLine's echo of a wrapped line cannot fabricate completion. The parser accepts ASCII-space padding after the status digits but still requires LF or CRLF. Spaces in command output remain unchanged. The tool polls the scrollback in 1,000-line pages until a complete end-marker status line is available or the send settles as `stdin_read`, extracts the span, strips the echoed wrapper, and renders it with any status marker. A timeout aborts the deadline, captures the partial output, and resets the shell.
|
|
90
89
|
|
|
91
90
|
</details>
|
|
92
91
|
|
package/README.zh.md
CHANGED
|
@@ -73,7 +73,7 @@ kind: "package-reference"
|
|
|
73
73
|
### 设计理念
|
|
74
74
|
|
|
75
75
|
- **`dsh-tool-bash-persistent` 的刻意孪生。** 会话注册表、轮询循环与重置约定按设计镜像持久 bash 工具([pwsh 持久 PTY Agent Note](../../../.agents/notes/archived/architecture/2026-08-11-pwsh-persistent-pty.md))。
|
|
76
|
-
- **后端拥有提示符就绪。** shell 的 `prompt` 函数属于后端:它打印 BEL 结尾的 OSC
|
|
76
|
+
- **后端拥有提示符就绪。** shell 的 `prompt` 函数属于后端:它打印 BEL 结尾的 OSC 标记加受控的可打印提示符。后端通过快路径接受已识别的提示符文本,否则使用其自身的就绪检查或静默层级。工具既不安装也不匹配自己的提示符。
|
|
77
77
|
- **PSReadLine 回显靠锚定剥离。** PowerShell 会把提交的输入渲染回流中;标记锚定提取与包装源码剥离移除回显,而跨终端宽度换行的包装可能在部分输出结果中留下部分回显。
|
|
78
78
|
- **重置,而非修复。** 任何不确定状态——显式 `exit`、超时、发送失败、中止——都会关闭 shell 并让下一次调用从全新状态开始。
|
|
79
79
|
|
|
@@ -82,11 +82,10 @@ kind: "package-reference"
|
|
|
82
82
|
| 文件 | 职责 |
|
|
83
83
|
|---|---|
|
|
84
84
|
| [`src/index.ts`](src/index.ts) | 插件入口:shell 注册表、命令包装、scrollback 轮询、提取与渲染 |
|
|
85
|
-
| — | 不发布运行时不变式伴生入口;适配器私有的 owner-to-shell 缓存不存在可观察的事件或数据关系。生命周期测试无需仅为不变式增加公共 API 即可验证其清理。 |
|
|
86
85
|
|
|
87
86
|
### 命令流程
|
|
88
87
|
|
|
89
|
-
首条命令通过 `ctx.terminals.spawn` 生成 shell,其 pwsh 启动流程安装受控的 `prompt` 函数,并只在该 shell 达到就绪后返回。随后每条命令都包装成一行物理文本——`Write-Output` 起始标记、用反引号转义进双引号字符串的命令体、`Write-Output` 结束标记加退出状态——因此 PSReadLine
|
|
88
|
+
首条命令通过 `ctx.terminals.spawn` 生成 shell,其 pwsh 启动流程安装受控的 `prompt` 函数,并只在该 shell 达到就绪后返回。随后每条命令都包装成一行物理文本——`Write-Output` 起始标记、用反引号转义进双引号字符串的命令体、`Write-Output` 结束标记加退出状态——因此 PSReadLine 对换行包装的回显无法伪造完成。解析器允许状态码数字后的 ASCII 空格,但仍要求以 LF 或 CRLF 结束。命令输出中的空格保持不变。工具以 1,000 行一页轮询 scrollback,直到出现完整的结束标记状态行或该 send 以 `stdin_read` 结算,提取区间、剥离回显的包装,并连同任何状态标记一起渲染。超时会中止截止时间、捕获部分输出并重置 shell。
|
|
90
89
|
|
|
91
90
|
</details>
|
|
92
91
|
|
package/lib/index.js
CHANGED
|
@@ -106,7 +106,7 @@ function trimTrailingNewline(text) {
|
|
|
106
106
|
function commandOutput(snapshot, marker, wrapper) {
|
|
107
107
|
const text = snapshot.text;
|
|
108
108
|
const end = text.lastIndexOf(marker.end);
|
|
109
|
-
const status = /^(\d+)
|
|
109
|
+
const status = /^(\d+) *\r?\n/.exec(text.slice(end + marker.end.length))?.[1];
|
|
110
110
|
if (status === void 0) return void 0;
|
|
111
111
|
const startMarker = text.lastIndexOf(marker.start, end);
|
|
112
112
|
const start = startMarker < 0 ? 0 : startMarker + marker.start.length;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-pwsh-persistent",
|
|
3
3
|
"description": "Model-facing owner-scoped persistent PowerShell tool backed by the Harness PTY service",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -26,34 +26,34 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@deepseek-ai/dsh-
|
|
30
|
-
"@deepseek-ai/dsh-terminal": "0.2.
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-
|
|
33
|
-
"@deepseek-ai/
|
|
34
|
-
"@deepseek-ai/
|
|
29
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
|
|
30
|
+
"@deepseek-ai/dsh-terminal": "0.2.1-alpha.1",
|
|
31
|
+
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.1",
|
|
32
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
|
|
33
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
34
|
+
"@deepseek-ai/dsh-output-retention": "0.2.1-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
37
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@deepseek-ai/cordis-plugin-include": "~1.0.
|
|
41
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0.
|
|
42
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
43
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.
|
|
44
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-output-retention": "0.2.
|
|
46
|
-
"@deepseek-ai/dsh-terminal": "0.2.
|
|
47
|
-
"@deepseek-ai/dsh-terminal-bash": "0.2.
|
|
48
|
-
"@deepseek-ai/dsh-pwsh-local": "0.2.
|
|
49
|
-
"@deepseek-ai/dsh-sandbox": "0.2.
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-session
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/
|
|
57
|
-
"@deepseek-ai/
|
|
40
|
+
"@deepseek-ai/cordis-plugin-include": "~1.0.10-alpha.1",
|
|
41
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.1",
|
|
42
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
|
|
43
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.1",
|
|
44
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
|
|
45
|
+
"@deepseek-ai/dsh-output-retention": "0.2.1-alpha.1",
|
|
46
|
+
"@deepseek-ai/dsh-terminal": "0.2.1-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-terminal-bash": "0.2.1-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-pwsh-local": "0.2.1-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
|
|
57
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
58
58
|
}
|
|
59
59
|
}
|