@yadsh/dsh-session-scope 0.5.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/README.md +110 -0
- package/compatibility.json +20 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.d.ts +1 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +716 -0
- package/lib/client.js.map +1 -0
- package/lib/core.d.ts +204 -0
- package/lib/core.d.ts.map +1 -0
- package/lib/core.js +375 -0
- package/lib/core.js.map +1 -0
- package/lib/host-api.d.ts +23 -0
- package/lib/host-api.d.ts.map +1 -0
- package/lib/host-api.js +40 -0
- package/lib/host-api.js.map +1 -0
- package/lib/index.d.ts +32 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +594 -0
- package/lib/index.js.map +1 -0
- package/lib/scope-context.d.ts +3 -0
- package/lib/scope-context.d.ts.map +1 -0
- package/lib/scope-context.js +29 -0
- package/lib/scope-context.js.map +1 -0
- package/lib/scope-delegation.d.ts +23 -0
- package/lib/scope-delegation.d.ts.map +1 -0
- package/lib/scope-delegation.js +49 -0
- package/lib/scope-delegation.js.map +1 -0
- package/lib/scope-fs.d.ts +47 -0
- package/lib/scope-fs.d.ts.map +1 -0
- package/lib/scope-fs.js +150 -0
- package/lib/scope-fs.js.map +1 -0
- package/lib/scope-processes.d.ts +31 -0
- package/lib/scope-processes.d.ts.map +1 -0
- package/lib/scope-processes.js +71 -0
- package/lib/scope-processes.js.map +1 -0
- package/lib/scope-sandbox-linux.d.ts +35 -0
- package/lib/scope-sandbox-linux.d.ts.map +1 -0
- package/lib/scope-sandbox-linux.js +177 -0
- package/lib/scope-sandbox-linux.js.map +1 -0
- package/lib/scope-visibility.d.ts +14 -0
- package/lib/scope-visibility.d.ts.map +1 -0
- package/lib/scope-visibility.js +62 -0
- package/lib/scope-visibility.js.map +1 -0
- package/lib/session-scope.d.ts +54 -0
- package/lib/session-scope.d.ts.map +1 -0
- package/lib/session-scope.js +200 -0
- package/lib/session-scope.js.map +1 -0
- package/lib/tool-guard.d.ts +52 -0
- package/lib/tool-guard.d.ts.map +1 -0
- package/lib/tool-guard.js +233 -0
- package/lib/tool-guard.js.map +1 -0
- package/package.json +150 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jiangr100
|
|
4
|
+
Copyright (c) 2026 xarleyn
|
|
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/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# dsh-session-scope
|
|
2
|
+
|
|
3
|
+
[](https://github.com/xarleyn/dsh-plugins/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@yadsh/dsh-session-scope)
|
|
5
|
+
[](https://www.npmjs.com/package/@yadsh/dsh-session-scope)
|
|
6
|
+
[](package.json)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Per-session workspace visibility scopes for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
|
|
10
|
+
|
|
11
|
+
`dsh-session-scope` keeps a session's original workspace and working directory while exposing only explicitly selected workspace directories to the agent. Permission controls effects; scope independently controls visibility.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Permission != Scope
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
[Specification](SPEC_%20dsh-session-scope.md) · [Compatibility matrix](compatibility.json) · [Release notes](RELEASING.md)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install the published npm package by name:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
dsh plugin --profile web add @yadsh/dsh-session-scope
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To remove the plugin:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin --profile web remove @yadsh/dsh-session-scope
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The package includes its Host and Web client entry points plus the `cordis.patch.yml` bundle patch. Restart the DeepSeek Harness host if bundle hot reload does not pick up the newly installed plugin or browser client.
|
|
34
|
+
|
|
35
|
+
## Scope modes
|
|
36
|
+
|
|
37
|
+
| Mode | Visibility and enforcement |
|
|
38
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `full` | The ordinary complete workspace view |
|
|
40
|
+
| `focused` | Selected roots across DSH filesystem services and known path-aware tools; arbitrary shell processes are not confined |
|
|
41
|
+
| `isolated` | Selected roots plus Linux process confinement through a fully enforcing, recognized bubblewrap profile |
|
|
42
|
+
|
|
43
|
+
`isolated` is unavailable on unsupported backends and cannot currently be combined with `danger-full-access`. Unsupported or partially enforced combinations fail closed instead of silently degrading to `focused`.
|
|
44
|
+
|
|
45
|
+
## What works now
|
|
46
|
+
|
|
47
|
+
Version `0.5.0` implements the specification through Phase 4:
|
|
48
|
+
|
|
49
|
+
- durable `session-scope/set` snapshots with a last-write-wins fold;
|
|
50
|
+
- canonical root validation, nested-root collapse, navigation ancestors, and stable error codes;
|
|
51
|
+
- typed host operations, the `/scope` command, and a `session-scope` projection;
|
|
52
|
+
- filtered directory listings and scoped glob, grep, and search roots;
|
|
53
|
+
- per-session filesystem enforcement carried with `AsyncLocalStorage`;
|
|
54
|
+
- a monotonic final guard for known path-aware tools;
|
|
55
|
+
- model-facing context that names accessible roots without revealing hidden siblings;
|
|
56
|
+
- an independent **Scope** chip and tree picker beside Workspace and permission controls;
|
|
57
|
+
- Linux isolation for one-shot bash and persistent PTY creation;
|
|
58
|
+
- permission-aware read-only and writable mounts in an empty workspace overlay;
|
|
59
|
+
- lifecycle fences that prevent scope changes while processes retain an older mount view;
|
|
60
|
+
- scoped project instructions and skill discovery;
|
|
61
|
+
- fail-closed LSP calls while the upstream provider indexes the complete workspace;
|
|
62
|
+
- scope inheritance for forks, nested subagents, and resumed children;
|
|
63
|
+
- compatibility folding for legacy `workspace-scope/selection` sessions;
|
|
64
|
+
- unit, integration, package-contract, and packed-composition coverage.
|
|
65
|
+
|
|
66
|
+
## Design boundaries
|
|
67
|
+
|
|
68
|
+
- `read-only`, `workspace-write`, and `danger-full-access` remain DSH permission modes; they are not scope modes.
|
|
69
|
+
- Focused scope constrains supported DSH services and tools, not arbitrary child processes.
|
|
70
|
+
- Isolated scope requires the supported Linux sandbox path and a recognized bubblewrap profile.
|
|
71
|
+
- Unknown runner profiles, partial enforcement, and unsupported platforms fail closed.
|
|
72
|
+
- Scope changes are blocked while foreground jobs, background jobs, or persistent terminals retain the previous mount view.
|
|
73
|
+
|
|
74
|
+
## Requirements
|
|
75
|
+
|
|
76
|
+
- Node.js 20 or newer
|
|
77
|
+
- pnpm 10.4.1 for development
|
|
78
|
+
- DeepSeek Harness `>=0.1.1-rc.2 <0.2.0`
|
|
79
|
+
- Linux with bubblewrap for `isolated` mode
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
From the monorepo root:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm install --frozen-lockfile
|
|
87
|
+
pnpm --filter @yadsh/dsh-session-scope check
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The package check runs the TypeScript build, Vitest suite, client and package-contract checks, and compatibility verification. The packed-plugin smoke test can be run separately:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pnpm --filter @yadsh/dsh-session-scope smoke:packed
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Releases
|
|
97
|
+
|
|
98
|
+
This package uses independent Nx Version Plans from the monorepo. Add a plan with `pnpm release:plan`; maintainers publish verified tarballs through the shared [release workflow](../../docs/RELEASING.md).
|
|
99
|
+
|
|
100
|
+
## Prior art and attribution
|
|
101
|
+
|
|
102
|
+
The initial directory picker, path canonicalization, filesystem fencing, and sandbox integration were adapted from [`dsh-workspace-scope-selection`](https://github.com/jiangr100/dsh-workspace-scope-selection) by [jiangr100](https://github.com/jiangr100), used under the MIT License. The original copyright notice is preserved in [LICENSE](LICENSE).
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
Issues and focused pull requests are welcome. Read the monorepo [contribution guide](../../CONTRIBUTING.md) and run the package check before submitting a change.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
[MIT](LICENSE). This is an independent community project and is not affiliated with or endorsed by DeepSeek.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"deepseekHarness": {
|
|
3
|
+
"testedReleases": [
|
|
4
|
+
"0.1.1-rc.2"
|
|
5
|
+
],
|
|
6
|
+
"requiredHostFeatures": [
|
|
7
|
+
"fs.readBytes",
|
|
8
|
+
"tools.guard",
|
|
9
|
+
"tools/execute",
|
|
10
|
+
"agent/pre-step",
|
|
11
|
+
"sessionProjections",
|
|
12
|
+
"sandbox.confine.full-enforcement"
|
|
13
|
+
],
|
|
14
|
+
"requiredClientFeatures": [
|
|
15
|
+
"conversation.input.left",
|
|
16
|
+
"remote.commands",
|
|
17
|
+
"session-projections"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# dsh-session-scope bundle patch — mounts the plugin row into the
|
|
2
|
+
# profile composition. The `dsh.bundle.patch` manifest field points here, so
|
|
3
|
+
# `dsh plugin --profile web add <this directory>` activates this row
|
|
4
|
+
# automatically on the next boot.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: dsh-session-scope
|
|
7
|
+
name: "@yadsh/dsh-session-scope"
|
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":""}
|