@deepseek-ai/dsh-shell-env 0.1.2-rc.1 → 0.1.3-alpha.2
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 +2 -2
- package/README.md +4 -5
- package/README.zh.md +4 -5
- package/lib/index.js +2 -13
- package/lib/types/index.d.ts +1 -2
- package/package.json +10 -12
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/shell/shell-env/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: f85fb0005e94dc59939cfd2e9f0d69e5cdc7d133
|
|
6
|
+
README.zh.md: f0d02de700c2e5e7d8fe0081813cda96bd099a78
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-shell-env` provides the trusted `DSH_*` environment that every model shell call — bash or pwsh — runs with: built-in facts such as `DSH_HOME`, `DSH_SHELL=1`, and the agent's `DSH_SESSION_ID
|
|
12
|
+
`dsh-shell-env` provides the trusted `DSH_*` environment that every model shell call — bash or pwsh — runs with: built-in facts such as `DSH_HOME`, `DSH_SHELL=1`, and the agent's `DSH_SESSION_ID`. Plugin authors can register their own facts with declared keys, collected per execution and disposed with their plugin; duplicate ownership or undeclared runtime keys fail loudly instead of silently overwriting. The registry changes nothing else the model sees — the shell tools own their own schemas and prompts. Choose it in any composition that mounts a model shell tool; configuration only picks the Harness home directory.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ Load this plugin in any composition that mounts a model shell tool (`dsh-tool-ba
|
|
|
29
29
|
|
|
30
30
|
### What every shell call receives
|
|
31
31
|
|
|
32
|
-
Every call receives `DSH_HOME` (the absolute Harness home), `DSH_SHELL=1`, and, for agent calls, `DSH_SESSION_ID` (the calling session's id).
|
|
32
|
+
Every call receives `DSH_HOME` (the absolute Harness home), `DSH_SHELL=1`, and, for agent calls, `DSH_SESSION_ID` (the calling session's id).
|
|
33
33
|
|
|
34
34
|
### Adding your own environment facts
|
|
35
35
|
|
|
@@ -80,13 +80,13 @@ This section explains the design decisions behind the registry and points at the
|
|
|
80
80
|
|
|
81
81
|
- **Trusted namespace, rebuilt per call.** The environment is a Harness-owned `DSH_*` namespace: the shell executor discards inherited `DSH_*` values and merges the registry's current snapshot for each execution, so nested harnesses and concurrent parent/child agents cannot leak stale identities, and `process.env` is never modified.
|
|
82
82
|
- **Declared ownership, loud conflicts.** Contributors declare their keys up front so duplicate ownership is detected before the first command; resolvers may only return declared keys.
|
|
83
|
-
- **Built-ins stay here.** `DSH_HOME`, `DSH_SHELL`, and `DSH_SESSION_ID` are reserved for the registry;
|
|
83
|
+
- **Built-ins stay here.** `DSH_HOME`, `DSH_SHELL`, and `DSH_SESSION_ID` are reserved for the registry; contributors cannot claim them.
|
|
84
84
|
|
|
85
85
|
### Source map
|
|
86
86
|
|
|
87
87
|
| File | Role |
|
|
88
88
|
|---|---|
|
|
89
|
-
| [`src/index.ts`](src/index.ts) | Plugin entry, `ShellEnvRegistry` service, built-in facts
|
|
89
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry, `ShellEnvRegistry` service, and the built-in facts |
|
|
90
90
|
| — | No runtime invariant companion is published; the environment registry validates ownership and collected values at each registration/collection; it publishes no independent snapshot that a companion could cross-check. |
|
|
91
91
|
|
|
92
92
|
### Collection
|
|
@@ -128,7 +128,6 @@ The managed environment never enters the request prefix, so it does not invalida
|
|
|
128
128
|
These limits define when the registry is a poor fit or needs care. They are current package constraints, not a task backlog.
|
|
129
129
|
|
|
130
130
|
- **`list()` enumerates plugin-contributed variables only** — registry-owned built-ins (`DSH_HOME`, `DSH_SHELL`, `DSH_SESSION_ID`) are not included, so diagnostics, prompt, or UI code must not treat `list()` as an exhaustive environment catalog.
|
|
131
|
-
- **`DSH_SESSION_JSONL` is a location hint, not a guarantee** — the file may not exist before the first flush and may not contain the current buffered turn, and the value is not an authorization credential.
|
|
132
131
|
|
|
133
132
|
<a id="dev-note"></a>
|
|
134
133
|
### Dev Note
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-shell-env` 提供每次模型 shell 调用——bash 或 pwsh——所运行的受信 `DSH_*` 环境:内置事实如 `DSH_HOME`、`DSH_SHELL=1` 与 agent(智能体)的 `DSH_SESSION_ID
|
|
12
|
+
`dsh-shell-env` 提供每次模型 shell 调用——bash 或 pwsh——所运行的受信 `DSH_*` 环境:内置事实如 `DSH_HOME`、`DSH_SHELL=1` 与 agent(智能体)的 `DSH_SESSION_ID`。插件作者可以注册自己的事实,带声明键、按每次执行收集,并随插件释放;重复所有权或未声明的运行时键会响亮失败,而不是静默覆盖。注册表不会改变模型看到的其他任何内容——shell 工具拥有各自的 schema 与提示词。任何挂载了模型 shell 工具的组合都适合选择它;配置只决定 Harness 主目录。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ kind: "package-reference"
|
|
|
29
29
|
|
|
30
30
|
### 每次 shell 调用都会收到什么
|
|
31
31
|
|
|
32
|
-
每次调用都会收到 `DSH_HOME`(Harness 主目录的绝对路径)、`DSH_SHELL=1`,agent 调用还会收到 `DSH_SESSION_ID`(调用方会话的 id
|
|
32
|
+
每次调用都会收到 `DSH_HOME`(Harness 主目录的绝对路径)、`DSH_SHELL=1`,agent 调用还会收到 `DSH_SESSION_ID`(调用方会话的 id)。
|
|
33
33
|
|
|
34
34
|
### 添加你自己的环境事实
|
|
35
35
|
|
|
@@ -80,13 +80,13 @@ contributor 必须声明它返回的每个键;返回未声明或非字符串
|
|
|
80
80
|
|
|
81
81
|
- **受信命名空间,每次调用重建。** 环境是归 Harness 所有的 `DSH_*` 命名空间:shell 执行器丢弃继承的 `DSH_*` 值,并为每次执行合并注册表的当前快照,因此嵌套 harness 与并发的父子 agent 无法泄漏陈旧身份,`process.env` 也永不被修改。
|
|
82
82
|
- **声明的所有权,响亮的冲突。** contributor 预先声明键,使重复所有权在第一条命令之前就被发现;resolver 只能返回已声明的键。
|
|
83
|
-
- **内置键留在这里。** `DSH_HOME`、`DSH_SHELL` 与 `DSH_SESSION_ID`
|
|
83
|
+
- **内置键留在这里。** `DSH_HOME`、`DSH_SHELL` 与 `DSH_SESSION_ID` 为注册表保留;contributor 不能声称拥有它们。
|
|
84
84
|
|
|
85
85
|
### 源码地图
|
|
86
86
|
|
|
87
87
|
| 文件 | 职责 |
|
|
88
88
|
|---|---|
|
|
89
|
-
| [`src/index.ts`](src/index.ts) | 插件入口、`ShellEnvRegistry`
|
|
89
|
+
| [`src/index.ts`](src/index.ts) | 插件入口、`ShellEnvRegistry` 服务与内置事实 |
|
|
90
90
|
| — | 不发布运行时不变式伴生入口;收集可通过工具执行观察。 |
|
|
91
91
|
|
|
92
92
|
### 收集
|
|
@@ -128,7 +128,6 @@ contributor 必须声明它返回的每个键;返回未声明或非字符串
|
|
|
128
128
|
这些限制说明注册表何时不合适或需要小心使用。它们是当前包约束,不是任务积压。
|
|
129
129
|
|
|
130
130
|
- **`list()` 只枚举插件贡献的变量**——注册表自有的内置键(`DSH_HOME`、`DSH_SHELL`、`DSH_SESSION_ID`)不包含在内,因此诊断、prompt 或 UI 代码不得把 `list()` 当作完整的环境目录。
|
|
131
|
-
- **`DSH_SESSION_JSONL` 只是位置提示,不是保证**——首次 flush 之前文件可能不存在,也可能不包含当前缓冲中的轮次,而且该值不是授权凭据。
|
|
132
131
|
|
|
133
132
|
<a id="dev-note"></a>
|
|
134
133
|
### 开发备注
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,6 @@ const inject = [];
|
|
|
18
18
|
const Config = z.object({ dshHome: z.string() });
|
|
19
19
|
const DSH_SHELL_KEY = `${DSH_ENV_PREFIX}SHELL`;
|
|
20
20
|
const DSH_SESSION_ID_KEY = `${DSH_ENV_PREFIX}SESSION_ID`;
|
|
21
|
-
const DSH_SESSION_JSONL_KEY = `${DSH_ENV_PREFIX}SESSION_JSONL`;
|
|
22
21
|
const RESERVED_BASH_ENV_KEYS = new Set([
|
|
23
22
|
DSH_HOME_ENV,
|
|
24
23
|
DSH_SHELL_KEY,
|
|
@@ -108,22 +107,12 @@ var ShellEnvRegistry = class extends Service {
|
|
|
108
107
|
}
|
|
109
108
|
};
|
|
110
109
|
/**
|
|
111
|
-
* Load the shell-env plugin: register the `ctx.shellEnv` service
|
|
112
|
-
* shell-agnostic persistence contributor (`DSH_SESSION_JSONL`).
|
|
110
|
+
* Load the shell-env plugin: register the `ctx.shellEnv` registry service.
|
|
113
111
|
* @param ctx - Cordis context that owns the service and registrations.
|
|
114
112
|
* @param config - home-directory configuration for the built-in variables.
|
|
115
113
|
*/
|
|
116
114
|
function apply(ctx, config = {}) {
|
|
117
|
-
new ShellEnvRegistry(ctx, config)
|
|
118
|
-
name: "session-persistence",
|
|
119
|
-
variables: { [DSH_SESSION_JSONL_KEY]: { description: "Absolute target path of the current session JSONL when the active persistence backend provides one." } },
|
|
120
|
-
resolve(execution) {
|
|
121
|
-
const agent = execution.agent;
|
|
122
|
-
if (agent === void 0) return {};
|
|
123
|
-
const location = ctx.get("sessionPersistence")?.locate(agent.session.header);
|
|
124
|
-
return location?.kind === "jsonl" ? { [DSH_SESSION_JSONL_KEY]: location.path } : {};
|
|
125
|
-
}
|
|
126
|
-
});
|
|
115
|
+
new ShellEnvRegistry(ctx, config);
|
|
127
116
|
}
|
|
128
117
|
//#endregion
|
|
129
118
|
export { Config, ShellEnvRegistry, apply, inject, name };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -92,8 +92,7 @@ export declare class ShellEnvRegistry extends Service {
|
|
|
92
92
|
list(): BashEnvVariableInfo[];
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Load the shell-env plugin: register the `ctx.shellEnv` service
|
|
96
|
-
* shell-agnostic persistence contributor (`DSH_SESSION_JSONL`).
|
|
95
|
+
* Load the shell-env plugin: register the `ctx.shellEnv` registry service.
|
|
97
96
|
* @param ctx - Cordis context that owns the service and registrations.
|
|
98
97
|
* @param config - home-directory configuration for the built-in variables.
|
|
99
98
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-shell-env",
|
|
3
3
|
"description": "Tool-independent managed DSH_* shell environment registry",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,22 +27,20 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-
|
|
33
|
-
"@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
|
|
30
|
+
"@deepseek-ai/dsh-shell": "^0.1.3-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.3-alpha.2",
|
|
34
33
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/dsh-home-paths": "^0.1.
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/cordis": "^4.0.2"
|
|
46
|
-
"@deepseek-ai/dsh-tools": "^0.1.2-rc.1"
|
|
39
|
+
"@deepseek-ai/dsh-shell": "^0.1.3-alpha.2",
|
|
40
|
+
"@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.3-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
|
|
44
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
47
45
|
}
|
|
48
46
|
}
|