@qlzt/dsh-tool-pwsh 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 +124 -0
- package/README.md +219 -2
- package/README.zh.md +220 -0
- package/lib/index.js +732 -0
- package/lib/types/background.d.ts +50 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/types/render.d.ts +65 -0
- package/package.json +69 -4
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,124 @@
|
|
|
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/shell/tool-pwsh/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: 83e748b077469aac
|
|
7
|
+
zh: f858d23ea8c1c6ba
|
|
8
|
+
/deepseek-ai-dsh-tool-pwsh:
|
|
9
|
+
en: 7e214a666e7b1ef8
|
|
10
|
+
zh: d9166b57a6f54afd
|
|
11
|
+
/deepseek-ai-dsh-tool-pwsh/summary:
|
|
12
|
+
en: c0470c24b1056b6c
|
|
13
|
+
zh: 8d9fcd643367e1c9
|
|
14
|
+
/deepseek-ai-dsh-tool-pwsh/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package:
|
|
18
|
+
en: 873b8b99a2018ed7
|
|
19
|
+
zh: c4481ffd20168071
|
|
20
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/when-to-choose-it:
|
|
21
|
+
en: d274c33ae8a646f8
|
|
22
|
+
zh: 99e3e64e61735e50
|
|
23
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/minimal-configuration:
|
|
24
|
+
en: addf35c4e607d33c
|
|
25
|
+
zh: 081f511d6b5a79d6
|
|
26
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/running-a-command:
|
|
27
|
+
en: 80195c9b61b29737
|
|
28
|
+
zh: 0a187f3f52814b90
|
|
29
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/foreground-commands-as-jobs:
|
|
30
|
+
en: 4a487e48ef146846
|
|
31
|
+
zh: 0a34dc49bffb03af
|
|
32
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/windows-specific-sandbox-behavior:
|
|
33
|
+
en: 76f3f791f53d1005
|
|
34
|
+
zh: e5b262db24e6eb83
|
|
35
|
+
/deepseek-ai-dsh-tool-pwsh/use-this-package/what-can-go-wrong:
|
|
36
|
+
en: c1a9cc1201ed3a89
|
|
37
|
+
zh: a43a659d350e9d4a
|
|
38
|
+
/deepseek-ai-dsh-tool-pwsh/understand-the-implementation:
|
|
39
|
+
en: 165313776a851b51
|
|
40
|
+
zh: 828f48807036aff0
|
|
41
|
+
/deepseek-ai-dsh-tool-pwsh/understand-the-implementation/design-philosophy:
|
|
42
|
+
en: 86a8ad5203f7e239
|
|
43
|
+
zh: 056c0d6d6ca5f36a
|
|
44
|
+
/deepseek-ai-dsh-tool-pwsh/understand-the-implementation/source-map:
|
|
45
|
+
en: aa2adb29a0f27fcd
|
|
46
|
+
zh: 612829167064acd1
|
|
47
|
+
/deepseek-ai-dsh-tool-pwsh/understand-the-implementation/rendering-and-exit-markers:
|
|
48
|
+
en: facd01af9a403fec
|
|
49
|
+
zh: 7a943dac19a01c39
|
|
50
|
+
/deepseek-ai-dsh-tool-pwsh/further-exploration:
|
|
51
|
+
en: 8b2f3ab83ada2fe5
|
|
52
|
+
zh: b7803b21d5373ece
|
|
53
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience:
|
|
54
|
+
en: 215e7ba838619b7b
|
|
55
|
+
zh: a311da3843709f90
|
|
56
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/system-prompt:
|
|
57
|
+
en: cf78b9dd5596495f
|
|
58
|
+
zh: bd44560f8c2435e8
|
|
59
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/system-prompt/what-the-model-sees:
|
|
60
|
+
en: ed8a75117d71cc5d
|
|
61
|
+
zh: 7b9119a5246d096e
|
|
62
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/system-prompt/what-the-model-sees/pwsh-guidance:
|
|
63
|
+
en: de907562b460fc1b
|
|
64
|
+
zh: 2a398555cc929dd3
|
|
65
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/system-prompt/token-effect:
|
|
66
|
+
en: 4fea242a5deec6d2
|
|
67
|
+
zh: 8dcbe863eb960a4d
|
|
68
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/system-prompt/kv-cache-effect:
|
|
69
|
+
en: 3959f5f66ff2f4be
|
|
70
|
+
zh: 66636c0d90becdb1
|
|
71
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-schemas:
|
|
72
|
+
en: 3039bc5e7a796b21
|
|
73
|
+
zh: 6b7a9eaf69c9ea53
|
|
74
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-schemas/what-the-model-sees:
|
|
75
|
+
en: 319b3a4512305a26
|
|
76
|
+
zh: fed6a1c70bf79a0e
|
|
77
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-schemas/token-effect:
|
|
78
|
+
en: 97cce067584eadff
|
|
79
|
+
zh: 54b1f5cd5899e7f3
|
|
80
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-schemas/kv-cache-effect:
|
|
81
|
+
en: a6768b4fdc27de21
|
|
82
|
+
zh: 6d1d9b8357441af8
|
|
83
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/foreground-result:
|
|
84
|
+
en: d83f1f25a3719c54
|
|
85
|
+
zh: 445ca808e28dc936
|
|
86
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/foreground-result/what-the-model-sees:
|
|
87
|
+
en: f3691c5a09006efe
|
|
88
|
+
zh: 4e9fb6880fb3b0df
|
|
89
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/foreground-result/token-effect:
|
|
90
|
+
en: b2018adbda15b8a7
|
|
91
|
+
zh: efa06f083800a36b
|
|
92
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/foreground-result/kv-cache-effect:
|
|
93
|
+
en: f5d5f97a153f7c70
|
|
94
|
+
zh: 31911b4f3506d6c8
|
|
95
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/background-result:
|
|
96
|
+
en: 3f23f9211197b0b9
|
|
97
|
+
zh: 8cff3c78249b66ff
|
|
98
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/background-result/what-the-model-sees:
|
|
99
|
+
en: a471e423bb4fd271
|
|
100
|
+
zh: 8949b37acf642e0c
|
|
101
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/background-result/token-effect:
|
|
102
|
+
en: 1480a7a9ec4e3a96
|
|
103
|
+
zh: c7ec0cee960c8c99
|
|
104
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/background-result/kv-cache-effect:
|
|
105
|
+
en: f5d5f97a153f7c70
|
|
106
|
+
zh: 31911b4f3506d6c8
|
|
107
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-errors:
|
|
108
|
+
en: 2d4f2c8605eccab3
|
|
109
|
+
zh: 67f1f0218f73c6bf
|
|
110
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-errors/what-the-model-sees:
|
|
111
|
+
en: f0802a10dbe0f7d2
|
|
112
|
+
zh: 80f8b312dcfc0065
|
|
113
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-errors/token-effect:
|
|
114
|
+
en: 243bad012dd99c7f
|
|
115
|
+
zh: 5ee74905020bd49a
|
|
116
|
+
/deepseek-ai-dsh-tool-pwsh/model-experience/tool-errors/kv-cache-effect:
|
|
117
|
+
en: f5d5f97a153f7c70
|
|
118
|
+
zh: 31911b4f3506d6c8
|
|
119
|
+
/deepseek-ai-dsh-tool-pwsh/known-limitations-and-deferred-work:
|
|
120
|
+
en: 04c2102bcc5ebc6d
|
|
121
|
+
zh: d13640d3fddb8e9c
|
|
122
|
+
/deepseek-ai-dsh-tool-pwsh/known-limitations-and-deferred-work/dev-note:
|
|
123
|
+
en: e67f633dc6fe7773
|
|
124
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -1,3 +1,220 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "The model-facing pwsh tool for users and maintainers choosing, configuring, or debugging one-shot PowerShell execution, background jobs, and sandbox escalation on Windows."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-tool-pwsh
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-tool-pwsh` lets the agent run PowerShell commands through a mounted shell executor. Each call uses a fresh process; with a job registry composed every command is a job from the moment it starts, so `run_in_background` returns the id at once and a foreground command that outlives its timeout returns the same id, with observable output. Commands use native Windows paths and `$env:NAME` variables without dialect translation. Calls receive the managed `DSH_*` environment, and sandboxed execution enforces Windows language-mode and named-pipe requirements. Mount it with a PowerShell executor such as `dsh-pwsh-local` and the `dsh-shell-env` plugin.
|
|
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
|
+
New commands start in the Session's current working directory. Relative `workdir` values resolve from that directory; per-call overrides and background jobs do not change it.
|
|
29
|
+
|
|
30
|
+
Load this plugin in any composition where the agent should run PowerShell commands — typically a Windows composition whose `ctx.shell` is backed by a PowerShell executor. It registers the `pwsh` tool once the executor provider and the `dsh-shell-env` registry are mounted.
|
|
31
|
+
|
|
32
|
+
### When to choose it
|
|
33
|
+
|
|
34
|
+
Choose the pwsh tool when commands must be written in PowerShell — native paths and `$env:` variables — or when the deployment is Windows-native. Choose `dsh-tool-bash` when the command set is bash-dialect; there is no translation between the two. When work needs cross-call state (cwd, variables), the persistent counterpart [`dsh-tool-pwsh-persistent`](../tool-pwsh-persistent/README.md) keeps one owner-scoped shell alive.
|
|
35
|
+
|
|
36
|
+
### Minimal configuration
|
|
37
|
+
|
|
38
|
+
The common path is a PowerShell executor provider, the environment registry, and this tool.
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- name: '@deepseek-ai/dsh-pwsh-local'
|
|
42
|
+
- name: '@deepseek-ai/dsh-shell-env'
|
|
43
|
+
- name: '@deepseek-ai/dsh-tool-pwsh'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The config fields govern the background surface.
|
|
47
|
+
|
|
48
|
+
| Field | Default | Meaning |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `enableRunInBackground` | `true` | Expose `run_in_background` while a job registry is composed; when `false`, forced background calls are rejected |
|
|
51
|
+
| `promoteOnTimeout` | `true` | Keep a foreground command that reaches its timeout running as its background job instead of killing it |
|
|
52
|
+
|
|
53
|
+
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-pwsh) is the exhaustive source for every accepted field and its JSDoc; the generated [tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-pwsh) carries the full argument schema.
|
|
54
|
+
|
|
55
|
+
### Running a command
|
|
56
|
+
|
|
57
|
+
The tool executes `pwsh -Command <command>` and returns the combined output. Commands run in a fresh pwsh process every call, so state never persists — pass `workdir` instead of `cd`. Paths use native Windows form and environment variables are read with `$env:NAME`. A non-zero exit is reported as `[exit code: N]`; on Windows a force-killed command settles as `[exit code: 1]` without a signal marker, so the agent treats a bare exit 1 after an interruption as a termination, not a command failure. The schema lists `description` before `command` and asks the model to emit it first, without enforcing JSON member order. The description tells the agent to verify the resolved absolute target path before any delete or move and not to assign to automatic variables such as `$HOME`. Background runs, output truncation, and the `description`/`timeoutMs`/`workdir` arguments behave exactly as in [`dsh-tool-bash`](../tool-bash/README.md#running-long-commands-in-the-background), including job-owned cancellation during asynchronous shell preparation.
|
|
58
|
+
|
|
59
|
+
### Foreground commands as jobs
|
|
60
|
+
|
|
61
|
+
With a job registry composed, a foreground command is registered with `ctx.jobs` at its start and the call waits on that job: the command is listed, streams through `job.list` and `job.follow`, and can be stopped from the Web task list for as long as it runs. A command that finishes within the timeout returns the ordinary foreground result and its job record leaves the registry with it, so the model never sees an id. A command that outlives the timeout keeps running as the job it already was, and the call returns `[still running after <timeoutMs>ms; moved to background job <id>]` plus the job hand-off guidance, seeded with one consuming read of the output so far — `job_output` continues exactly after it. A kill from outside the call (the human stopping the job) settles the foreground result with `[stopped: <reason>]` ahead of the exit marker, so the model reads the reason instead of a command failure; cancelling the call itself kills the job. Registration is best-effort: `promoteOnTimeout: false`, a missing job registry, or a registry that refuses the job at its start (the owner's job limit, no controller) run the command under the executor's deadline kill instead, and the `timeoutMs` parameter description advertises the hand-over only when it holds.
|
|
62
|
+
|
|
63
|
+
### Windows-specific sandbox behavior
|
|
64
|
+
|
|
65
|
+
Under a sandboxing executor, denied commands report `[sandbox: file access denied under <mode> mode]`, and the same one-shot escalation path applies: retry the exact command once with `sandbox_permissions` plus a `justification` through user approval. The justification asks the model to use the language of the current user request. The tool also teaches two Windows-restricted-token contracts in its description: read-only pwsh runs in ConstrainedLanguage (`.NET` static calls, `Add-Type`, COM, and reflection fail with "only core types" errors), and in both confined modes programs cannot open named pipes, so a command that captures another program's output through piped stdio fails with EPERM — escalate the exact command once or restructure it to avoid capturing output.
|
|
66
|
+
|
|
67
|
+
### What can go wrong
|
|
68
|
+
|
|
69
|
+
A composition with no PowerShell executor never activates the tool, and the injected services (`tools`, `shell`, `systemPrompt`, `shellEnv`) must all exist. Background calls without the job runtime fail with `background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs`, and `sandbox_permissions` without a sandboxing executor fails with `sandbox_permissions is not available in this composition (no sandboxing executor to escalate)`.
|
|
70
|
+
|
|
71
|
+
-----
|
|
72
|
+
|
|
73
|
+
<a id="understand-the-implementation"></a>
|
|
74
|
+
## Understand the implementation
|
|
75
|
+
|
|
76
|
+
<details>
|
|
77
|
+
<summary>Implementation internals — click to expand</summary>
|
|
78
|
+
|
|
79
|
+
Structured foreground and background results expose `cwd`, the executor-resolved launch directory. Persisted presentation metadata carries the same value so settled cards retain the directory used by that call. A command’s own `cd` does not change this launch value; native result text remains stdout, stderr, and status markers.
|
|
80
|
+
|
|
81
|
+
This section explains the design decisions behind the tool and points at the code that realizes them; the observable behavior is fully covered in [Use this package](#use-this-package).
|
|
82
|
+
|
|
83
|
+
### Design philosophy
|
|
84
|
+
|
|
85
|
+
- **A deliberate twin of `dsh-tool-bash`.** Foreground and background execution, the managed environment, the sandbox escalation surface, and the marker/truncation rendering mirror the bash tool call-for-call, so consumers of one accept the other's wire shape ([pwsh tool bash parity reference](README.md)).
|
|
86
|
+
- **PowerShell-dialect contract.** The tool contract is PowerShell: native paths and `$env:` variables, executed via `pwsh -Command` with no intermediate shell.
|
|
87
|
+
- **Windows sandbox facts taught in the description.** The ConstrainedLanguage and named-pipe contracts are Windows-restricted-token behavior; the gate for teaching them is "any confining executor is mounted", which is safe because every shipped pairing is win32-only.
|
|
88
|
+
- **Non-zero exits are reported, not errored.** Only infrastructure failures (spawn errors, aborts) surface as tool errors, matching the bash story.
|
|
89
|
+
|
|
90
|
+
### Source map
|
|
91
|
+
|
|
92
|
+
| File | Role |
|
|
93
|
+
|---|---|
|
|
94
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry: tool registration, prompt section, arg validation, escalation, request assembly |
|
|
95
|
+
| [`src/background.ts`](src/background.ts) | Map a settled process onto generic job outcome vocabulary and render a ring read as a process read |
|
|
96
|
+
| [`src/render.ts`](src/render.ts) | Model-facing result text: streams, markers, truncation notices (bash twin) |
|
|
97
|
+
|
|
98
|
+
### Rendering and exit markers
|
|
99
|
+
|
|
100
|
+
The renderer shares the bash tool's structure and the `parseExitStatus` marker contract from `dsh-shell`: a clean exit (0, no signal) produces no marker; the UI card consumes the exit marker as its exit-status pill. Windows forced termination settles as exit 1 without a signal, so `[killed by signal: …]` is POSIX-only there. The `tool:pwsh` prompt section (first-party order 1010) teaches the exit-marker convention and the Windows exit-1-after-interruption reading.
|
|
101
|
+
|
|
102
|
+
</details>
|
|
103
|
+
|
|
104
|
+
-----
|
|
105
|
+
|
|
106
|
+
<a id="further-exploration"></a>
|
|
107
|
+
## Further Exploration
|
|
108
|
+
|
|
109
|
+
Read these pages when the package-level contract is not enough. They move from the shell family to the executor seam and the design notes behind the Windows behavior.
|
|
110
|
+
|
|
111
|
+
- [shell package map](../README.md) — the bash capability family and its roles.
|
|
112
|
+
- [Bash executor subsystem](../../../docs/subsystems/shell.md) — request/spec vocabulary, results, and background processes.
|
|
113
|
+
- [shell-env](../shell-env/README.md) — the managed `DSH_*` environment every call receives.
|
|
114
|
+
- [tool-jobs](../../jobs/tool-jobs/README.md) — `job_output`, `job_list`, and `job_kill` controls for background runs.
|
|
115
|
+
- [historical pwsh tool bash parity Agent Note](../../../.agents/notes/archived/feature/2026-08-02-pwsh-tool-bash-parity.md) — why the tool mirrors the bash tool.
|
|
116
|
+
- [Windows ACL restricted-token sandbox Agent Note](../../../.agents/notes/implemented/feature/2026-08-08-windows-acl-restricted-token-sandbox.md) — the language-mode and named-pipe contracts.
|
|
117
|
+
- [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-pwsh) — the exact `pwsh` argument schema.
|
|
118
|
+
- [Generated configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-pwsh) — every accepted config field and its source declaration.
|
|
119
|
+
|
|
120
|
+
-----
|
|
121
|
+
|
|
122
|
+
<a id="model-experience"></a>
|
|
123
|
+
## Model Experience
|
|
124
|
+
|
|
125
|
+
### System prompt
|
|
126
|
+
|
|
127
|
+
#### What the model sees
|
|
128
|
+
|
|
129
|
+
Every request in this plugin's registration scope contains the pwsh guidance below at first-party order 1010. Scoped tool restrictions can hide the schema without removing this independently registered section.
|
|
130
|
+
|
|
131
|
+
##### Pwsh guidance
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
Non-zero exits are reported as `[exit code: N]` markers; investigate failures before moving on. On Windows a killed process settles as `[exit code: 1]` without a signal marker; treat a bare exit 1 after an interruption as a termination, not a command failure.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Token effect
|
|
138
|
+
|
|
139
|
+
Small fixed input cost per request while the plugin is active.
|
|
140
|
+
|
|
141
|
+
#### KV Cache effect
|
|
142
|
+
|
|
143
|
+
Prefix-stable while the registration scope and prompt text are unchanged. Plugin activation or disposal may invalidate reuse from this prompt section.
|
|
144
|
+
|
|
145
|
+
### Tool schemas
|
|
146
|
+
|
|
147
|
+
#### What the model sees
|
|
148
|
+
|
|
149
|
+
The model sees the generated [`pwsh` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-pwsh). Its justification asks the model to use the language of the current user request. Agent-scoped tool restrictions can remove the definition for that agent.
|
|
150
|
+
|
|
151
|
+
#### Token effect
|
|
152
|
+
|
|
153
|
+
Fixed schema cost on every request where the tool is visible.
|
|
154
|
+
|
|
155
|
+
#### KV Cache effect
|
|
156
|
+
|
|
157
|
+
Prefix-stable while visibility and the tool definition are unchanged. A restriction or config change may invalidate reuse from the first changed token.
|
|
158
|
+
|
|
159
|
+
### Foreground result
|
|
160
|
+
|
|
161
|
+
#### What the model sees
|
|
162
|
+
|
|
163
|
+
The renderer emits the data-dependent stdout tail, then optional `[stderr]` and the stderr tail. Conditional lines are exactly `[output truncated; full output: <path-or-(unavailable)>]`, `[sandbox: file access denied under <mode> mode]` plus the escalation hint `[sandbox: escalation available — …]` (only when the composition advertises escalation), `[timed out after <timeoutMs>ms]`, `[stopped: <reason>]`, `[killed by signal: <signal>]`, and `[exit code: <exitCode>]` (nonzero exits only); an empty body renders as `(no output)`.
|
|
164
|
+
|
|
165
|
+
#### Token effect
|
|
166
|
+
|
|
167
|
+
Zero result tokens before a call. Output is bounded per stream, while each emitted line remains in history until compaction.
|
|
168
|
+
|
|
169
|
+
#### KV Cache effect
|
|
170
|
+
|
|
171
|
+
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
|
|
172
|
+
|
|
173
|
+
### Background result
|
|
174
|
+
|
|
175
|
+
#### What the model sees
|
|
176
|
+
|
|
177
|
+
A background start renders exactly `started background job <id>`; subsequent reads and status flow through the generic `job_output`/`job_kill` tools, including the lossy-read spill notice when in-memory truncation dropped unread bytes.
|
|
178
|
+
|
|
179
|
+
#### Token effect
|
|
180
|
+
|
|
181
|
+
The ack is a fixed short line; job output is bounded per read.
|
|
182
|
+
|
|
183
|
+
#### KV Cache effect
|
|
184
|
+
|
|
185
|
+
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
|
|
186
|
+
|
|
187
|
+
### Tool errors
|
|
188
|
+
|
|
189
|
+
#### What the model sees
|
|
190
|
+
|
|
191
|
+
Validation and infrastructure failures are normalized as `Error: <message>`. This package's stable messages are `invalid command: expected a non-empty string`, `invalid description: expected a non-empty string`, `invalid timeoutMs: expected a positive number, got <value>`, the escalation pairing failures, `sandbox_permissions is not available in this composition (no sandboxing executor to escalate)`, the shared escalation failures (not strictly wider / no approval service / no agent to route / no approval channel / user rejected / was cancelled), `run_in_background is disabled for this deployment (enableRunInBackground: false)`, `background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs`, and `tool call aborted`.
|
|
192
|
+
|
|
193
|
+
#### Token effect
|
|
194
|
+
|
|
195
|
+
Only the failing call adds these retained tokens; an aborted call adds no command output.
|
|
196
|
+
|
|
197
|
+
#### KV Cache effect
|
|
198
|
+
|
|
199
|
+
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
|
|
200
|
+
|
|
201
|
+
## Known Limitations and Deferred Work
|
|
202
|
+
|
|
203
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
These limits define when the tool is a poor fit or needs special care. They are current package constraints, not a task backlog.
|
|
207
|
+
|
|
208
|
+
- **Language mode and named-pipe capture under the Windows sandbox** — under the [Windows ACL sandbox](../../sandbox/sandbox-windows-acl/README.md), read-only pwsh starts in ConstrainedLanguage because its temp write denial makes PowerShell's AppLocker probe fail closed: `Add-Type`, non-core .NET statics (`[System.IO.*]::`, `[math]::`), COM objects, and reflection fail with "only core types" errors, and the mode cannot be lifted from inside. Workspace-write's private temp lets the probe complete, so it stays in FullLanguage unless host policy says otherwise. Both confined modes deny named-pipe opens, so a piped-stdio spawn inside a confined command fails with EPERM. The tool description teaches both contracts to the model; the backend README owns the full limitations.
|
|
209
|
+
- **No persistent shell** — every call starts a fresh `pwsh -Command`; the persistent-shell counterpart is [`@deepseek-ai/dsh-tool-pwsh-persistent`](../tool-pwsh-persistent/README.md), which keeps one owner-scoped pwsh alive across calls.
|
|
210
|
+
- **PowerShell-dialect contract** — the model must write PowerShell (native paths, `$env:` variables), not bash; there is no dialect translation.
|
|
211
|
+
|
|
212
|
+
<a id="dev-note"></a>
|
|
213
|
+
### Dev Note
|
|
214
|
+
|
|
215
|
+
<details>
|
|
216
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
217
|
+
|
|
218
|
+
None.
|
|
219
|
+
|
|
220
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "面向模型的 pwsh 工具,供选择、配置或排查 Windows 上一次性 PowerShell 执行、后台任务与沙箱升权的使用者与维护者阅读。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-tool-pwsh
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-tool-pwsh` 让 agent(智能体)通过已挂载的 shell 执行器运行 PowerShell 命令。每次调用使用全新进程;组合中有 job 注册表时,每条命令从启动那一刻起就是一个任务,因此 `run_in_background` 立即返回 id,超过超时仍在运行的前台命令返回同一个 id,输出可观测。命令使用原生 Windows 路径和 `$env:NAME` 变量,不做方言翻译。调用获得受管 `DSH_*` 环境,沙箱执行会落实 Windows 语言模式与命名管道要求。请与 `dsh-pwsh-local` 等 PowerShell 执行器及 `dsh-shell-env` 插件一起挂载。
|
|
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
|
+
新命令从 Session 的当前工作目录启动。相对 `workdir` 从该目录解析;单次调用的覆盖值与后台任务不会改变该目录。
|
|
29
|
+
|
|
30
|
+
在 agent 需要运行 PowerShell 命令的任何组合中加载本插件——通常是 `ctx.shell` 由 PowerShell 执行器支撑的 Windows 组合。一旦挂载执行器提供方与 `dsh-shell-env` 注册表,它就注册 `pwsh` 工具。
|
|
31
|
+
|
|
32
|
+
### 何时选择
|
|
33
|
+
|
|
34
|
+
当命令必须用 PowerShell 编写——原生路径与 `$env:` 变量——或部署是 Windows 原生时,选择 pwsh 工具。当命令集是 bash 方言时选择 `dsh-tool-bash`;两者之间没有翻译。当工作依赖跨调用状态(cwd、变量)时,持久对应物 [`dsh-tool-pwsh-persistent`](../tool-pwsh-persistent/README.zh.md) 会保持一个按所有者隔离的 shell 存活。
|
|
35
|
+
|
|
36
|
+
### 最小配置
|
|
37
|
+
|
|
38
|
+
常用路径是 PowerShell 执行器提供方、环境注册表与本工具。
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- name: '@deepseek-ai/dsh-pwsh-local'
|
|
42
|
+
- name: '@deepseek-ai/dsh-shell-env'
|
|
43
|
+
- name: '@deepseek-ai/dsh-tool-pwsh'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
配置字段决定后台能力面。
|
|
47
|
+
|
|
48
|
+
| 字段 | 默认值 | 含义 |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `enableRunInBackground` | `true` | 组合中有 job 注册表时暴露 `run_in_background`;为 `false` 时拒绝强制后台调用 |
|
|
51
|
+
| `promoteOnTimeout` | `true` | 到达超时的前台命令继续作为它的后台任务运行,而不是杀掉它 |
|
|
52
|
+
|
|
53
|
+
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-tool-pwsh)是每个受支持字段及其 JSDoc 的穷尽式真源;生成的[工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-pwsh)携带完整参数 schema。
|
|
54
|
+
|
|
55
|
+
### 运行命令
|
|
56
|
+
|
|
57
|
+
工具执行 `pwsh -Command <command>` 并返回合并后的输出。命令每次调用都运行在全新 pwsh 进程中,因此状态从不保留——请传 `workdir` 而不是 `cd`。路径使用原生 Windows 形式,环境变量用 `$env:NAME` 读取。非零退出以 `[exit code: N]` 报告;在 Windows 上,强制终止的命令以 `[exit code: 1]` 结算且没有信号标记,因此 agent 把中断后的裸 exit 1 当作终止而非命令失败。schema 将 `description` 列在 `command` 前并要求模型先输出它,但不强制 JSON 成员顺序。工具描述要求 agent 在任何删除或移动前校验解析后的绝对目标路径,并且不要给 `$HOME` 等自动变量赋值。后台运行、输出截断以及 `description`/`timeoutMs`/`workdir` 参数的行为与 [`dsh-tool-bash`](../tool-bash/README.zh.md#running-long-commands-in-the-background) 完全一致,包括异步 shell 准备过程中由任务负责的取消。
|
|
58
|
+
|
|
59
|
+
### 前台命令即任务
|
|
60
|
+
|
|
61
|
+
组合中有 job 注册表时,前台命令一启动就登记到 `ctx.jobs`,调用等待该任务:命令在运行期间始终被列出、经 `job.list` 与 `job.follow` 流式观看,并可从 Web 任务列表停止。在超时内完成的命令返回普通前台结果,其任务记录随结果一起离开注册表,模型从不看到 id。超过超时仍在运行的命令继续作为它本来就是的那个任务运行,调用返回 `[still running after <timeoutMs>ms; moved to background job <id>]` 加任务交接指引,并以一次消费式读取带上目前为止的输出——`job_output` 恰好从此处接续。来自调用之外的杀停(人在界面上停止任务)会让前台结果在退出标记之前带上 `[stopped: <reason>]`,模型读到的是原因而不是命令失败;取消调用本身则杀掉任务。登记是尽力而为的:`promoteOnTimeout: false`、缺少 job 注册表,或注册表在启动时拒绝该任务(持有者的任务上限、没有控制器)都会改为在执行器的 deadline 杀下运行命令,`timeoutMs` 参数描述也只在交接语义成立时才宣传它。
|
|
62
|
+
|
|
63
|
+
### Windows 特有的沙箱行为
|
|
64
|
+
|
|
65
|
+
在沙箱执行器下,被拒绝的命令会报告 `[sandbox: file access denied under <mode> mode]`,并适用相同的单次升权路径:用 `sandbox_permissions` 加一句 `justification`,经用户审批后重试完全相同的命令一次。理由字段提示模型使用用户当前提问的语言。工具还会在其描述中教授两条 Windows 受限令牌约定:只读 pwsh 运行在 ConstrainedLanguage 中(`.NET` 静态调用、`Add-Type`、COM 与反射会以 "only core types" 错误失败);两种受限模式下程序都无法打开命名管道,因此通过管道 stdio 捕获另一程序输出的命令会以 EPERM 失败——请升权该确切命令一次,或重构命令以避免捕获输出。
|
|
66
|
+
|
|
67
|
+
### 可能出什么问题
|
|
68
|
+
|
|
69
|
+
没有 PowerShell 执行器的组合永远不会激活该工具,且注入的服务(`tools`、`shell`、`systemPrompt`、`shellEnv`)必须全部存在。没有任务运行时的后台调用会以 `background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs` 失败;没有沙箱执行器时的 `sandbox_permissions` 会以 `sandbox_permissions is not available in this composition (no sandboxing executor to escalate)` 失败。
|
|
70
|
+
|
|
71
|
+
-----
|
|
72
|
+
|
|
73
|
+
<a id="understand-the-implementation"></a>
|
|
74
|
+
## 理解实现
|
|
75
|
+
|
|
76
|
+
<details>
|
|
77
|
+
<summary>实现细节——点击展开</summary>
|
|
78
|
+
|
|
79
|
+
前台与后台的结构化结果均包含 `cwd`,即执行器解析后的启动目录。持久化展示元数据携带同一值,使已结束的调用卡片保留该次调用使用的目录。命令内部的 `cd` 不会改变这个启动值;原生结果文本仍由 stdout、stderr 与状态标记组成。
|
|
80
|
+
|
|
81
|
+
本节解释工具背后的设计决策,并指出实现它们的代码位置;可观察行为已在[使用本包](#use-this-package)中完整说明。
|
|
82
|
+
|
|
83
|
+
### 设计理念
|
|
84
|
+
|
|
85
|
+
- **`dsh-tool-bash` 的刻意孪生。** 前台与后台执行、受管环境、沙箱升权面以及标记/截断渲染都逐调用镜像 bash 工具,因此其中之一的消费方也能接受另一个的协议形状([pwsh 工具与 bash 对齐 参考](README.zh.md))。
|
|
86
|
+
- **PowerShell 方言约定。** 工具约定是 PowerShell:原生路径与 `$env:` 变量,经由 `pwsh -Command` 执行,没有中间 shell。
|
|
87
|
+
- **Windows 沙箱事实写进描述。** ConstrainedLanguage 与命名管道约定是 Windows 受限令牌行为;教授它们的条件是「已挂载任意约束执行器」,之所以安全,是因为每个已发布的配对都是 win32-only。
|
|
88
|
+
- **非零退出只报告、不失败。** 只有基础设施故障(spawn 错误、中止)才会作为工具错误暴露,与 bash 的故事一致。
|
|
89
|
+
|
|
90
|
+
### 源码地图
|
|
91
|
+
|
|
92
|
+
| 文件 | 职责 |
|
|
93
|
+
|---|---|
|
|
94
|
+
| [`src/index.ts`](src/index.ts) | 插件入口:工具注册、提示词区段、参数校验、升权、请求组装 |
|
|
95
|
+
| [`src/background.ts`](src/background.ts) | 把已结算的进程映射为通用任务结果词汇,并把输出环读取渲染为进程读取 |
|
|
96
|
+
| [`src/render.ts`](src/render.ts) | 模型侧结果文本:流、标记、截断通知(bash 孪生) |
|
|
97
|
+
|
|
98
|
+
### 渲染与退出标记
|
|
99
|
+
|
|
100
|
+
渲染器共享 bash 工具的结构与来自 `dsh-shell` 的 `parseExitStatus` 标记约定:干净退出(0、无信号)不产生标记;UI 卡片把退出标记消费为退出状态 pill。Windows 强制终止以 exit 1 结算且没有信号,因此 `[killed by signal: …]` 仅适用于 POSIX。`tool:pwsh` 提示词区段(first-party 顺序 1010)教授退出标记约定与「中断后 exit 1」的 Windows 解读。
|
|
101
|
+
|
|
102
|
+
</details>
|
|
103
|
+
|
|
104
|
+
-----
|
|
105
|
+
|
|
106
|
+
<a id="further-exploration"></a>
|
|
107
|
+
## 进一步探索
|
|
108
|
+
|
|
109
|
+
当包级约定不够用时阅读以下页面。它们从 shell 家族逐步进入执行器 seam,以及 Windows 行为背后的设计笔记。
|
|
110
|
+
|
|
111
|
+
- [shell 包映射](../README.zh.md)——bash 能力家族及其角色。
|
|
112
|
+
- [Bash 执行器子系统](../../../docs/subsystems/shell.zh.md)——请求/spec 词汇、结果与后台进程。
|
|
113
|
+
- [shell-env](../shell-env/README.zh.md)——每次调用都会收到的受管 `DSH_*` 环境。
|
|
114
|
+
- [tool-jobs](../../jobs/tool-jobs/README.zh.md)——后台运行的 `job_output`、`job_list` 与 `job_kill` 控制。
|
|
115
|
+
- [历史pwsh 工具与 bash 对齐 Agent Note](../../../.agents/notes/archived/feature/2026-08-02-pwsh-tool-bash-parity.md)——为什么工具镜像 bash 工具。
|
|
116
|
+
- [Windows ACL 受限令牌沙箱 Agent Note](../../../.agents/notes/implemented/feature/2026-08-08-windows-acl-restricted-token-sandbox.zh.md)——语言模式与命名管道约定。
|
|
117
|
+
- [生成的工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-pwsh)——`pwsh` 参数 schema 的确切内容。
|
|
118
|
+
- [生成的配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-tool-pwsh)——每个受支持配置字段及其源声明。
|
|
119
|
+
|
|
120
|
+
-----
|
|
121
|
+
|
|
122
|
+
<a id="model-experience"></a>
|
|
123
|
+
## 模型体验
|
|
124
|
+
|
|
125
|
+
### 系统提示词
|
|
126
|
+
|
|
127
|
+
#### 模型看到什么
|
|
128
|
+
|
|
129
|
+
该插件注册作用域内的每次请求都在 first-party 顺序 1010 处包含以下 pwsh 指引。按作用域实施的工具限制可以隐藏 schema,却不会移除这个独立注册的区段。
|
|
130
|
+
|
|
131
|
+
##### Pwsh 指引
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
Non-zero exits are reported as `[exit code: N]` markers; investigate failures before moving on. On Windows a killed process settles as `[exit code: 1]` without a signal marker; treat a bare exit 1 after an interruption as a termination, not a command failure.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Token 影响
|
|
138
|
+
|
|
139
|
+
插件激活期间,每次请求都会产生少量固定的输入 token 开销。
|
|
140
|
+
|
|
141
|
+
#### KV Cache 影响
|
|
142
|
+
|
|
143
|
+
只要注册作用域与提示词文本不变,前缀就保持稳定。插件激活或释放可能使从该提示词区段起的复用失效。
|
|
144
|
+
|
|
145
|
+
### 工具 schema
|
|
146
|
+
|
|
147
|
+
#### 模型看到什么
|
|
148
|
+
|
|
149
|
+
模型会看到生成的 [`pwsh` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-pwsh)。其理由字段提示模型使用用户当前提问的语言。按 agent 作用域实施的工具限制可以移除该 agent 的定义。
|
|
150
|
+
|
|
151
|
+
#### Token 影响
|
|
152
|
+
|
|
153
|
+
工具可见的每个请求都会产生固定 schema 开销。
|
|
154
|
+
|
|
155
|
+
#### KV Cache 影响
|
|
156
|
+
|
|
157
|
+
只要可见性与工具定义不变,前缀就保持稳定。限制或配置变化可能从首个变化的 token 开始使复用失效。
|
|
158
|
+
|
|
159
|
+
### 前台结果
|
|
160
|
+
|
|
161
|
+
#### 模型看到什么
|
|
162
|
+
|
|
163
|
+
渲染器输出依数据而定的 stdout 尾部,再输出可选的 `[stderr]` 和 stderr 尾部。条件行精确为 `[output truncated; full output: <path-or-(unavailable)>]`、`[sandbox: file access denied under <mode> mode]` 加升权提示 `[sandbox: escalation available — …]`(仅在组合声明升权时)、`[timed out after <timeoutMs>ms]`、`[stopped: <reason>]`、`[killed by signal: <signal>]` 与 `[exit code: <exitCode>]`(仅非零退出);空正文渲染为 `(no output)`。
|
|
164
|
+
|
|
165
|
+
#### Token 影响
|
|
166
|
+
|
|
167
|
+
调用前的结果 token 为零。输出按流设界,而每行已发出的内容在压缩(compaction)前保留于历史。
|
|
168
|
+
|
|
169
|
+
#### KV Cache 影响
|
|
170
|
+
|
|
171
|
+
仅追加;新可见内容位于可复用请求前缀之后,不会使现有 KV-cache 条目失效。
|
|
172
|
+
|
|
173
|
+
### 后台结果
|
|
174
|
+
|
|
175
|
+
#### 模型看到什么
|
|
176
|
+
|
|
177
|
+
后台启动精确渲染为 `started background job <id>`;随后的读取与状态经由通用 `job_output`/`job_kill` 工具流转,包括内存截断丢弃未读字节时的有损读取 spill 通知。
|
|
178
|
+
|
|
179
|
+
#### Token 影响
|
|
180
|
+
|
|
181
|
+
确认是一行固定的短文本;任务输出按每次读取设界。
|
|
182
|
+
|
|
183
|
+
#### KV Cache 影响
|
|
184
|
+
|
|
185
|
+
仅追加;新可见内容位于可复用请求前缀之后,不会使现有 KV-cache 条目失效。
|
|
186
|
+
|
|
187
|
+
### 工具错误
|
|
188
|
+
|
|
189
|
+
#### 模型看到什么
|
|
190
|
+
|
|
191
|
+
验证与基础设施失败统一为 `Error: <message>`。本包的稳定消息包括 `invalid command: expected a non-empty string`、`invalid description: expected a non-empty string`、`invalid timeoutMs: expected a positive number, got <value>`、升权配对失败、`sandbox_permissions is not available in this composition (no sandboxing executor to escalate)`、共享升权失败(未严格加宽/无审批服务/无 agent 可路由/无审批通道/用户拒绝/已取消)、`run_in_background is disabled for this deployment (enableRunInBackground: false)`、`background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs`,以及 `tool call aborted`。
|
|
192
|
+
|
|
193
|
+
#### Token 影响
|
|
194
|
+
|
|
195
|
+
只有失败调用会增加这些保留 token;被中止的调用不会添加命令输出。
|
|
196
|
+
|
|
197
|
+
#### KV Cache 影响
|
|
198
|
+
|
|
199
|
+
仅追加;新可见内容位于可复用请求前缀之后,不会使现有 KV-cache 条目失效。
|
|
200
|
+
|
|
201
|
+
## 已知限制与延期工作
|
|
202
|
+
|
|
203
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
这些限制说明工具何时不合适或需要特别小心。它们是当前包约束,不是任务积压。
|
|
207
|
+
|
|
208
|
+
- **Windows 沙箱下的语言模式与命名管道捕获**——在 [Windows ACL 沙箱](../../sandbox/sandbox-windows-acl/README.zh.md)下,只读 pwsh 以 ConstrainedLanguage 启动,因为其临时目录写入被拒绝,导致 PowerShell 的 AppLocker 探测失败并按拒绝处理:`Add-Type`、非核心 .NET 静态调用(`[System.IO.*]::`、`[math]::`)、COM 对象与反射会以 "only core types" 错误失败,且该模式无法从内部解除。workspace-write 的私有临时目录让探测完成,因此除非宿主策略另有规定,它保持 FullLanguage。两种受限模式都拒绝命名管道打开,因此受限命令内部的管道 stdio spawn 会以 EPERM 失败。工具描述把两条约定都教给模型;完整限制以后端 README 为准。
|
|
209
|
+
- **没有持久 shell**——每次调用都启动全新的 `pwsh -Command`;持久 shell 对应物是 [`@deepseek-ai/dsh-tool-pwsh-persistent`](../tool-pwsh-persistent/README.zh.md),它跨调用保持一个按所有者隔离的 pwsh 存活。
|
|
210
|
+
- **PowerShell 方言约定**——模型必须编写 PowerShell(原生路径、`$env:` 变量),而不是 bash;没有方言翻译。
|
|
211
|
+
|
|
212
|
+
<a id="dev-note"></a>
|
|
213
|
+
### 开发备注
|
|
214
|
+
|
|
215
|
+
<details>
|
|
216
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
217
|
+
|
|
218
|
+
无。
|
|
219
|
+
|
|
220
|
+
</details>
|