dsh-deep-ptc-mode 1.6.0 → 1.6.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/CHANGELOG.md +8 -0
- package/README.md +7 -7
- package/README.zh.md +10 -9
- package/lib/ask-user.mjs +12 -4
- package/lib/base-snapshot.json +13 -0
- package/lib/executor.mjs +35 -28
- package/lib/host.mjs +65 -0
- package/lib/index.mjs +41 -5
- package/lib/jobs-tool.mjs +11 -5
- package/lib/lifecycle.mjs +1 -1
- package/lib/model.mjs +79 -60
- package/lib/terminal.mjs +10 -10
- package/lib/upstream.mjs +29 -0
- package/package.json +6 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.1 — 2026-11-04
|
|
4
|
+
|
|
5
|
+
- Follow the official modules instead of naming them. The shell, job and question wrappers no longer import `@deepseek-ai/dsh-tool-bash`, `dsh-tool-pwsh`, `dsh-tool-jobs` or `dsh-tool-ask-user`: each derived row carries the module name and options of the official row it replaces (`upstream`, `options`), and the wrapper loads that module through the installed runtime's module graph with the official plugin's own `inject` and `Config`. A renamed or replaced official tool is followed rather than breaking the mount.
|
|
6
|
+
- Read the shell executors from the base deployment declaration (`@deepseek-ai/dsh-base/cordis.patch.yml`, rows `bash-sandbox` and `pwsh-sandbox`), including their official options; only the foreground cap is added. The WSL/Zsh executor extends the official bash executor class named there instead of importing `dsh-bash-local`/`dsh-bash-sandbox`.
|
|
7
|
+
- Fall back to the official shell rows when the chosen environment cannot be mapped: no official shell tool row, no declared executor, or an official bash executor whose API WSL/Zsh can no longer extend (probed before the preset is published). The reachability guard still applies; the preset never publishes rows that cannot mount.
|
|
8
|
+
- Keep `lib/base-snapshot.json` as the executor fallback beside `lib/preset.json`; `npm run sync:snapshot` regenerates both. Drop the official tool and executor packages from `peerDependencies` and add `@deepseek-ai/dsh-base`.
|
|
9
|
+
- `scripts/check-preset.cjs` also resolves the official modules the wrappers name. The runtime checks (`check-reachability.mjs`, `check-host.cjs`) now also run on `0.2.2-rc.1`, whose tool batches go through a selected executor and whose preset registry requires the agent registry.
|
|
10
|
+
|
|
3
11
|
## 1.6.0 — 2026-11-04
|
|
4
12
|
|
|
5
13
|
- Derive the preset from the PTC preset the installed Harness declares (`@deepseek-ai/dsh-web-app/presets/ptc.patch.yml`) instead of freezing a copy. Official rows, settings and additions are inherited; Deep PTC still replaces only its persona, execution environment, reachability guard, and the official job/question wrappers.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Deep PTC mode
|
|
2
2
|
|
|
3
|
-
[中文](README.zh.md) · MIT · **1.
|
|
3
|
+
[中文](README.zh.md) · MIT · **1.6.1**
|
|
4
4
|
|
|
5
5
|
A DeepSeek Harness agent preset with exactly the built-in PTC tool surface and a different way of working: the model uses its full capability, stays interruptible while work runs, asks for approval only when a task is long, asks you instead of guessing, and runs commands in the environment you choose.
|
|
6
6
|
|
|
@@ -77,10 +77,10 @@ A prompt changes the model's working tendency, not the real token limit or billi
|
|
|
77
77
|
Requires Node `>=24` and DSH `>=0.2.1-rc.5`. Windows desktop rc.5 was used for real WSL/PowerShell command checks. macOS/Zsh configuration, argv and tool mounting were checked; native macOS execution has not been verified on this Windows host.
|
|
78
78
|
|
|
79
79
|
```js
|
|
80
|
-
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.
|
|
80
|
+
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.6.1" })
|
|
81
81
|
// Or from a local checkout or archive:
|
|
82
82
|
plugin_manager({ action: "install_bundle", target: "C:\\path\\to\\dsh-deep-ptc-mode" })
|
|
83
|
-
// Or target: "C:\\path\\to\\dsh-deep-ptc-mode-1.
|
|
83
|
+
// Or target: "C:\\path\\to\\dsh-deep-ptc-mode-1.6.1.tgz"
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
Repository locator: `github:lishize20040802-rgb/dsh-deep-ptc-mode`. It installs content actually published there; a local upgrade does not publish to GitHub or npm.
|
|
@@ -100,16 +100,16 @@ Prefer the UI, which uses revisioned, atomic Host form writes.
|
|
|
100
100
|
|
|
101
101
|
## Compatibility and development
|
|
102
102
|
|
|
103
|
-
Deep PTC is composed at load time from the PTC preset the installed Harness declares (`@deepseek-ai/dsh-web-app/presets/ptc.patch.yml`). Every official row is inherited as-is; Deep PTC replaces only its persona text, swaps the two platform-switched shell tools for one isolated execution group, adds the reachability guard, and wraps the official job and question tools. An official PTC change therefore reaches this mode without a plugin release, and a removed or renamed upstream module cannot leave a stale row behind. If the declaration cannot be resolved, read or parsed, the bundled `lib/preset.json` snapshot is used as a fallback and the fallback is logged.
|
|
103
|
+
Deep PTC is composed at load time from the PTC preset the installed Harness declares (`@deepseek-ai/dsh-web-app/presets/ptc.patch.yml`). Every official row is inherited as-is; Deep PTC replaces only its persona text, swaps the two platform-switched shell tools for one isolated execution group, adds the reachability guard, and wraps the official job and question tools. The wrappers and the execution group never name an official module themselves: they load the module the official row names (and the shell executors the base deployment declares in `@deepseek-ai/dsh-base/cordis.patch.yml`), with the official options. An official PTC change therefore reaches this mode without a plugin release, and a removed or renamed upstream module cannot leave a stale row behind. When the chosen execution environment cannot be mapped onto the official rows, those rows are kept and the change is logged. If the declaration cannot be resolved, read or parsed, the bundled `lib/preset.json` snapshot is used as a fallback and the fallback is logged.
|
|
104
104
|
|
|
105
|
-
Because the
|
|
105
|
+
Because the declarations are resolved through the host runtime, every host package the plugin imports statically is declared in `peerDependencies` — including `@deepseek-ai/dsh-web-app`. The host routes those names to the installation for a linked plugin; `npm run check` fails if one is missing, which is what keeps a `link:` installation on the live declaration instead of silently using the fallback snapshot. `compatibility.json` records the upstream release the checked fixture was taken from and its hash; `npm run check` verifies that the bundled fallback still derives the same preset as that fixture and that the inheritance invariants hold. The engines range is an installation floor, not proof that every future release was tested, so run `npm run check:upstream -- <path>` against a new release before trusting it.
|
|
106
106
|
|
|
107
107
|
```sh
|
|
108
108
|
npm ci
|
|
109
109
|
npm run check
|
|
110
110
|
npm test
|
|
111
111
|
npm run check:upstream -- /path/to/the/new/upstream/ptc.patch.yml
|
|
112
|
-
npm run sync:snapshot # refresh lib/preset.json from the installed
|
|
112
|
+
npm run sync:snapshot # refresh lib/preset.json and lib/base-snapshot.json from the installed declarations
|
|
113
113
|
PTC_RUNTIME_MODULES=/path/to/dsh/node_modules node scripts/check-preset.cjs # loader-level row resolution on a real runtime
|
|
114
114
|
PTC_RUNTIME_MODULES=/path/to/dsh/node_modules node scripts/check-reachability.mjs # interruptible waits on a real runtime
|
|
115
115
|
npm pack
|
|
@@ -117,7 +117,7 @@ npm pack
|
|
|
117
117
|
|
|
118
118
|
The checker parses `!!js` as data and asserts the derivation invariants: every official row survives unchanged except the persona, the shell rows and the two wrapped tools (including when the official preset nests them in a group); row ids stay unique; derivation is deterministic across nine platform/environment pairs. Tests cover future compositions as well (unknown rows, reordered rows, removed shell or wrapped rows), plus platforms, argv boundaries, confined WSL refusal, atomic settings writes and stale revisions. Real-task evaluations should measure successful completion, unnecessary questions, scope expansion, background-work collection and latency.
|
|
119
119
|
|
|
120
|
-
Main files: `cordis.patch.yml` is the settings entry; `lib/index.mjs` manages revisions; `lib/model.mjs` builds isolated execution configurations; `lib/executor.mjs`
|
|
120
|
+
Main files: `cordis.patch.yml` is the settings entry; `lib/index.mjs` manages revisions; `lib/model.mjs` builds isolated execution configurations; `lib/executor.mjs` extends the official bash executor for WSL/Zsh; `lib/terminal.mjs` runs the official shell tool the declaration names, with interruptible waits and the Zsh dialect; `lib/jobs-tool.mjs` and `lib/ask-user.mjs` run the official job and question tools the declaration names; `lib/host.mjs` resolves those official modules through the installed runtime; `lib/guard.mjs`, `lib/rules.mjs`, `lib/sleep-lint.mjs` and `lib/reachable.mjs` implement the pause/polling guard and interruptible waits; `lib/client.js` owns the bilingual settings card; `lib/upstream.mjs` locates and parses the installed PTC declaration; `lib/preset.json` holds the persona and the fallback snapshot used only when that declaration is unavailable.
|
|
121
121
|
|
|
122
122
|
Uninstall with `plugin_manager` action `remove_bundle`, target `dsh-deep-ptc-mode`. Local link installations depend on their source directory: uninstall before deleting it.
|
|
123
123
|
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 深度 PTC 模式
|
|
2
2
|
|
|
3
|
-
[English](README.md) · MIT · 当前版本:**1.
|
|
3
|
+
[English](README.md) · MIT · 当前版本:**1.6.1**
|
|
4
4
|
|
|
5
5
|
DeepSeek Harness 的 Agent 模式(preset),工具面与内置 PTC 完全一致,只换掉「工作方式」:让模型把能力用满、全程可被打断、按任务大小决定要不要你批准、拿不准就问你,并且自己选命令在哪个环境里跑。
|
|
6
6
|
|
|
@@ -79,10 +79,10 @@ WSL 命令使用 Linux/POSIX 语法;文件工具和 `workdir` 仍用 Windows
|
|
|
79
79
|
本地目录或构建产物可通过插件管理器安装:
|
|
80
80
|
|
|
81
81
|
```js
|
|
82
|
-
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.
|
|
82
|
+
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.6.1" })
|
|
83
83
|
// 也可从本地目录或安装包安装:
|
|
84
84
|
plugin_manager({ action: "install_bundle", target: "C:\\path\\to\\dsh-deep-ptc-mode" })
|
|
85
|
-
// 或 target: "C:\\path\\to\\dsh-deep-ptc-mode-1.
|
|
85
|
+
// 或 target: "C:\\path\\to\\dsh-deep-ptc-mode-1.6.1.tgz"
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
GitHub 地址:`github:lishize20040802-rgb/dsh-deep-ptc-mode`。该地址安装远端实际内容;本地升级不会自动发布到 GitHub/npm。
|
|
@@ -102,16 +102,16 @@ GitHub 地址:`github:lishize20040802-rgb/dsh-deep-ptc-mode`。该地址安装
|
|
|
102
102
|
|
|
103
103
|
## 兼容性与维护
|
|
104
104
|
|
|
105
|
-
Deep PTC 在加载时依据已安装 Harness 声明的 PTC 预设(`@deepseek-ai/dsh-web-app/presets/ptc.patch.yml`)现场组合:官方行原样继承,仅替换 persona 文本、把两个互斥 shell 工具换成一个带 `shell` 隔离的执行组、加入可达性守卫,并包装官方 job
|
|
105
|
+
Deep PTC 在加载时依据已安装 Harness 声明的 PTC 预设(`@deepseek-ai/dsh-web-app/presets/ptc.patch.yml`)现场组合:官方行原样继承,仅替换 persona 文本、把两个互斥 shell 工具换成一个带 `shell` 隔离的执行组、加入可达性守卫,并包装官方 job 与提问工具。包装层和执行组自身不写死任何官方模块名:加载的都是官方行里写的模块(shell 执行器取自基础部署声明 `@deepseek-ai/dsh-base/cordis.patch.yml`),并沿用官方配置。官方怎么改 PTC,本模式无需发版即可继承;官方改名或删除的模块也不会留下失效行。所选执行环境无法对应到官方行时,保留官方 shell 行并在日志中说明。只有在该声明无法解析、读取或解析失败时,才退回内置的 `lib/preset.json` 快照,并在日志中说明。
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
官方声明通过宿主运行时解析,因此插件静态引用的宿主包都必须声明在 `peerDependencies` 中(包括 `@deepseek-ai/dsh-web-app`):对 `link:` 本地安装,宿主只有看到 peer 声明才会把这些包名路由到已安装运行时。漏声明时 `npm run check` 会失败——这正是避免本地安装静默退回快照的关键。`compatibility.json` 记录 fixture 所取自的上游版本及其哈希;`npm run check` 会验证内置回退快照与 fixture 仍组合出同一预设,并检查继承不变量。`engines` 是安装下限,不能证明之后所有宿主都经过测试,遇到新版本先用 `npm run check:upstream -- <path>` 复核。
|
|
108
108
|
|
|
109
109
|
```sh
|
|
110
110
|
npm ci
|
|
111
111
|
npm run check
|
|
112
112
|
npm test
|
|
113
113
|
npm run check:upstream -- /path/to/ptc.patch.yml
|
|
114
|
-
npm run sync:snapshot # 从已安装声明刷新 lib/preset.json 回退快照
|
|
114
|
+
npm run sync:snapshot # 从已安装声明刷新 lib/preset.json 与 lib/base-snapshot.json 回退快照
|
|
115
115
|
PTC_RUNTIME_MODULES=/path/to/dsh/node_modules node scripts/check-preset.cjs # 用真实运行时检查每行模块可解析
|
|
116
116
|
PTC_RUNTIME_MODULES=/path/to/dsh/node_modules node scripts/check-reachability.mjs # 用真实运行时验证可打断等待
|
|
117
117
|
npm pack
|
|
@@ -124,9 +124,10 @@ npm pack
|
|
|
124
124
|
- `cordis.patch.yml`:宿主设置入口。
|
|
125
125
|
- `lib/index.mjs`:配置 schema、preset 注册和版本切换。
|
|
126
126
|
- `lib/model.mjs`:平台选择、参数、隔离配置和环境说明,以及从官方声明派生 preset。
|
|
127
|
-
- `lib/executor.mjs
|
|
128
|
-
- `lib/terminal.mjs
|
|
129
|
-
- `lib/jobs-tool.mjs`、`lib/ask-user.mjs
|
|
127
|
+
- `lib/executor.mjs`:继承基础部署声明里的官方 bash 执行器,实现 WSL/Zsh。
|
|
128
|
+
- `lib/terminal.mjs`:运行官方声明指定的 shell 工具,等待可被用户消息打断,并提供 Zsh 方言与工具名。
|
|
129
|
+
- `lib/jobs-tool.mjs`、`lib/ask-user.mjs`:运行官方声明指定的 job 工具与提问工具,等待可被用户消息打断。
|
|
130
|
+
- `lib/host.mjs`:通过已安装运行时解析这些官方模块。
|
|
130
131
|
- `lib/guard.mjs`、`lib/rules.mjs`、`lib/sleep-lint.mjs`、`lib/reachable.mjs`:拒绝长暂停与轮询的工具守卫,以及可打断等待的实现。
|
|
131
132
|
- `lib/client.js`:中英文设置卡片。
|
|
132
133
|
- `lib/upstream.mjs`:定位并解析已安装的 PTC 声明。
|
package/lib/ask-user.mjs
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import z from '@deepseek-ai/schemastery';
|
|
2
2
|
import { adaptContext } from './adapt.mjs';
|
|
3
|
+
import { applyOfficial } from './host.mjs';
|
|
3
4
|
import { steerableQuestions, steeringWatch } from './reachable.mjs';
|
|
4
5
|
|
|
5
6
|
export const name = 'deep-ptc-tool-ask-user';
|
|
6
|
-
export
|
|
7
|
+
export const inject = [];
|
|
8
|
+
export const Config = z.object({
|
|
9
|
+
// The official question tool module and its options, as the installed PTC declaration names them.
|
|
10
|
+
upstream: z.string().required(),
|
|
11
|
+
options: z.any(),
|
|
12
|
+
});
|
|
7
13
|
|
|
8
14
|
// The official question tool. In timed mode a question the user leaves unanswered becomes pending,
|
|
9
15
|
// and a message the user writes instead ends the wait early.
|
|
10
|
-
export function apply(ctx, config) {
|
|
16
|
+
export async function apply(ctx, config) {
|
|
11
17
|
const watch = steeringWatch(ctx);
|
|
12
|
-
|
|
18
|
+
await applyOfficial(ctx, config.upstream, config.options, child => adaptContext(child, {
|
|
19
|
+
userQuestions: questions => steerableQuestions(questions, watch),
|
|
20
|
+
}));
|
|
13
21
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "@deepseek-ai/dsh-base/cordis.patch.yml",
|
|
3
|
+
"verifiedUpstream": "0.2.2-rc.1",
|
|
4
|
+
"bash": {
|
|
5
|
+
"name": "@deepseek-ai/dsh-bash-sandbox",
|
|
6
|
+
"config": {
|
|
7
|
+
"timeoutMs": 60000
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"pwsh": {
|
|
11
|
+
"name": "@deepseek-ai/dsh-pwsh-sandbox"
|
|
12
|
+
}
|
|
13
|
+
}
|
package/lib/executor.mjs
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
import {
|
|
3
|
-
import { SandboxBashExecutor } from '@deepseek-ai/dsh-bash-sandbox';
|
|
2
|
+
import { importHost, pluginOf } from './host.mjs';
|
|
4
3
|
import { assertExecutionPolicy, shellArgv } from './model.mjs';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
maxSpillBytes: z.number().min(1).default(67108864).volatile(),
|
|
16
|
-
graceMs: z.number().min(1).default(3000).volatile(),
|
|
17
|
-
});
|
|
5
|
+
export const name = 'deep-ptc-mapped-executor';
|
|
6
|
+
export const inject = [];
|
|
7
|
+
export const Config = z.object({
|
|
8
|
+
environment: z.union(['wsl', 'zsh']).required(),
|
|
9
|
+
wslDistribution: z.string().default(''),
|
|
10
|
+
// The official bash executor module and its options, as the installed base declaration names them.
|
|
11
|
+
base: z.string().required(),
|
|
12
|
+
options: z.any(),
|
|
13
|
+
});
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
// Extend the official bash executor: its process handles, output retention, cancellation, jobs,
|
|
16
|
+
// sandbox and Config stay official; only the argv that starts the shell changes.
|
|
17
|
+
export function mappedExecutor(Base, environment, distribution = '') {
|
|
18
|
+
return class MappedShellExecutor extends Base {
|
|
19
|
+
async execute(spec) {
|
|
20
|
+
assertExecutionPolicy(environment, spec.sandboxPolicy);
|
|
21
|
+
if (spec.sandboxPolicy.mode !== 'danger-full-access') return super.execute(spec);
|
|
22
|
+
const process = await super.executeArgv(spec, shellArgv(environment, spec, distribution));
|
|
23
|
+
return Base.decorateResult(process, result => ({
|
|
24
|
+
...result, sandbox: { mode: spec.sandboxPolicy.mode, denied: false },
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
confine(command, policy, signal) {
|
|
29
|
+
assertExecutionPolicy(environment, policy);
|
|
30
|
+
return this.ctx.sandbox.confine(shellArgv(environment,
|
|
31
|
+
{ command, workdir: policy.workspaceRoot }, distribution), policy, signal);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function apply(ctx, config) {
|
|
37
|
+
const Base = pluginOf(await importHost(config.base));
|
|
38
|
+
if (typeof Base !== 'function' || typeof Base.decorateResult !== 'function' || typeof Base.prototype.executeArgv !== 'function')
|
|
39
|
+
throw new Error(`${config.base} no longer exposes the executor API Deep PTC extends; choose PowerShell or native Bash`);
|
|
40
|
+
ctx.plugin(mappedExecutor(Base, config.environment, config.wslDistribution), config.options);
|
|
34
41
|
}
|
package/lib/host.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Load host modules by the names the official declarations use. Nothing here names an official tool:
|
|
2
|
+
// callers pass the module name read from the installed Harness, so a rename or replacement upstream
|
|
3
|
+
// is followed instead of breaking a hard-coded import.
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import { OFFICIAL_PACKAGE } from './upstream.mjs';
|
|
7
|
+
|
|
8
|
+
function anchor() {
|
|
9
|
+
try {
|
|
10
|
+
return import.meta.resolve(`${OFFICIAL_PACKAGE}/package.json`);
|
|
11
|
+
} catch {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a host module the way the installed runtime would.
|
|
18
|
+
* A linked installation only routes peer-declared names to the runtime, so a name the official
|
|
19
|
+
* declaration introduces later is resolved from the runtime's own package graph instead.
|
|
20
|
+
* @returns a URL, or undefined when the runtime does not provide the module.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveHost(specifier) {
|
|
23
|
+
try {
|
|
24
|
+
return import.meta.resolve(specifier);
|
|
25
|
+
} catch {
|
|
26
|
+
// Not routed for this plugin; ask the runtime's graph.
|
|
27
|
+
}
|
|
28
|
+
const from = anchor();
|
|
29
|
+
if (from === undefined) return undefined;
|
|
30
|
+
try {
|
|
31
|
+
return pathToFileURL(createRequire(from).resolve(specifier)).href;
|
|
32
|
+
} catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function importHost(specifier) {
|
|
38
|
+
const url = resolveHost(specifier);
|
|
39
|
+
if (url === undefined) throw new Error(`the installed Harness provides no module ${JSON.stringify(specifier)}`);
|
|
40
|
+
return import(url);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The Cordis plugin a module exports: the namespace itself, or its default export.
|
|
44
|
+
export function pluginOf(namespace) {
|
|
45
|
+
if (typeof namespace?.apply === 'function') return namespace;
|
|
46
|
+
return namespace?.default ?? namespace;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Start the official plugin `upstream` with its own inject list and Config, giving its apply an
|
|
51
|
+
* adapted context. A plugin of another shape is started unadapted, so the official behaviour stays.
|
|
52
|
+
*/
|
|
53
|
+
export async function applyOfficial(ctx, upstream, options, adapt) {
|
|
54
|
+
const plugin = pluginOf(await importHost(upstream));
|
|
55
|
+
if (typeof plugin?.apply !== 'function') {
|
|
56
|
+
ctx.logger.warn('Deep PTC: %s is not an apply-style plugin; loading it without Deep PTC wait handling', upstream);
|
|
57
|
+
return ctx.plugin(plugin, options);
|
|
58
|
+
}
|
|
59
|
+
return ctx.plugin({
|
|
60
|
+
name: plugin.name ?? upstream,
|
|
61
|
+
...plugin.inject === undefined ? {} : { inject: plugin.inject },
|
|
62
|
+
...plugin.Config === undefined ? {} : { Config: plugin.Config },
|
|
63
|
+
apply: (child, config) => plugin.apply(adapt(child), config),
|
|
64
|
+
}, options);
|
|
65
|
+
}
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
2
|
import snapshot from './preset.json' with { type: 'json' };
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { availableEnvironments, BASE_SNAPSHOT, DEFAULT_FOREGROUND_SECONDS, deriveDeepPtc, normalizeDistribution, resolveEnvironment } from './model.mjs';
|
|
6
|
+
import { BASE_DECLARATION_SPECIFIER, loadOfficialPreset, parseOfficialExecutors } from './upstream.mjs';
|
|
7
|
+
import { importHost, pluginOf, resolveHost } from './host.mjs';
|
|
5
8
|
import { presetLifecycle } from './lifecycle.mjs';
|
|
6
9
|
|
|
7
10
|
export const name = 'deep-ptc-settings';
|
|
@@ -21,12 +24,45 @@ function settingsOf(config) {
|
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
// The shell executors the installed Harness declares in its base deployment, by kind.
|
|
28
|
+
function officialExecutors(ctx) {
|
|
29
|
+
try {
|
|
30
|
+
const url = resolveHost(BASE_DECLARATION_SPECIFIER);
|
|
31
|
+
if (url === undefined) throw new Error(`cannot resolve ${BASE_DECLARATION_SPECIFIER}`);
|
|
32
|
+
const executors = parseOfficialExecutors(readFileSync(fileURLToPath(url), 'utf8'));
|
|
33
|
+
for (const kind of ['bash', 'pwsh']) if (executors[kind] === undefined)
|
|
34
|
+
ctx.logger.warn('Deep PTC: %s declares no %s executor; using the bundled snapshot entry', url, kind);
|
|
35
|
+
return { ...BASE_SNAPSHOT, ...executors };
|
|
36
|
+
} catch (error) {
|
|
37
|
+
ctx.logger.warn('Deep PTC: official executors unavailable (%s); using the bundled snapshot', error.message);
|
|
38
|
+
return BASE_SNAPSHOT;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// WSL and Zsh extend the official bash executor class. Probe it before choosing that path so an
|
|
43
|
+
// incompatible Harness falls back to the official shell rows instead of a preset that cannot mount.
|
|
44
|
+
async function canExtend(ctx, executor) {
|
|
45
|
+
try {
|
|
46
|
+
const Base = pluginOf(await importHost(executor.name));
|
|
47
|
+
if (typeof Base === 'function' && typeof Base.decorateResult === 'function'
|
|
48
|
+
&& typeof Base.prototype.executeArgv === 'function') return true;
|
|
49
|
+
ctx.logger.warn('Deep PTC: %s no longer exposes the executor API WSL/Zsh extend', executor.name);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
ctx.logger.warn('Deep PTC: cannot load %s (%s)', executor.name, error.message);
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
24
56
|
// Derive Deep PTC from the PTC preset the installed Harness declares, so an
|
|
25
57
|
// official change is inherited instead of leaving a stale frozen row behind.
|
|
26
58
|
// The bundled snapshot is only a fallback when the installed declaration
|
|
27
59
|
// cannot be read or cannot be composed.
|
|
28
|
-
function buildPreset(ctx, config) {
|
|
60
|
+
async function buildPreset(ctx, config) {
|
|
29
61
|
const settings = settingsOf(config);
|
|
62
|
+
const executors = officialExecutors(ctx);
|
|
63
|
+
const environment = resolveEnvironment(settings.environment);
|
|
64
|
+
if (environment === 'wsl' || environment === 'zsh') settings.mappedExecutor = await canExtend(ctx, executors.bash);
|
|
65
|
+
settings.executors = executors;
|
|
30
66
|
let upstream = snapshot;
|
|
31
67
|
let source = 'bundled snapshot';
|
|
32
68
|
try {
|
|
@@ -39,8 +75,8 @@ function buildPreset(ctx, config) {
|
|
|
39
75
|
try {
|
|
40
76
|
const { preset, report } = deriveDeepPtc(upstream, settings);
|
|
41
77
|
ctx.logger.info(
|
|
42
|
-
'Deep PTC preset derived from %s: %d official rows; persona %s; shell rows [%s]; wrapped [%s]; skipped [%s]',
|
|
43
|
-
source, report.upstreamRows, report.persona,
|
|
78
|
+
'Deep PTC preset derived from %s: %d official rows; persona %s; environment %s; shell rows [%s]; wrapped [%s]; skipped [%s]',
|
|
79
|
+
source, report.upstreamRows, report.persona, report.environment,
|
|
44
80
|
report.replacedShellRows.join('; ') || '-', report.wrapped.join(', ') || '-', report.skipped.join('; ') || '-',
|
|
45
81
|
);
|
|
46
82
|
return preset;
|
package/lib/jobs-tool.mjs
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import z from '@deepseek-ai/schemastery';
|
|
2
2
|
import { adaptContext, registering } from './adapt.mjs';
|
|
3
|
+
import { applyOfficial } from './host.mjs';
|
|
3
4
|
import { steerableJobs, steerableTool, steeringWatch } from './reachable.mjs';
|
|
4
5
|
|
|
5
6
|
export const name = 'deep-ptc-tool-jobs';
|
|
6
|
-
export
|
|
7
|
+
export const inject = [];
|
|
8
|
+
export const Config = z.object({
|
|
9
|
+
// The official job tool module and its options, as the installed PTC declaration names them.
|
|
10
|
+
upstream: z.string().required(),
|
|
11
|
+
options: z.any(),
|
|
12
|
+
});
|
|
7
13
|
|
|
8
14
|
// The official job tools, with job_output waits ending when the user sends a message.
|
|
9
|
-
export function apply(ctx, config) {
|
|
15
|
+
export async function apply(ctx, config) {
|
|
10
16
|
const watch = steeringWatch(ctx);
|
|
11
|
-
|
|
17
|
+
await applyOfficial(ctx, config.upstream, config.options, child => adaptContext(child, {
|
|
12
18
|
tools: tools => registering(tools, definition => definition.name === 'job_output' ? steerableTool(definition) : definition),
|
|
13
19
|
jobs: jobs => steerableJobs(jobs, watch),
|
|
14
|
-
})
|
|
20
|
+
}));
|
|
15
21
|
}
|
package/lib/lifecycle.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export function presetLifecycle(register, getDefinition, onError) {
|
|
|
6
6
|
const refresh = () => {
|
|
7
7
|
queue = queue.then(async () => {
|
|
8
8
|
if (disposed) return;
|
|
9
|
-
const definition = getDefinition(); // Validate before removing the last good definition.
|
|
9
|
+
const definition = await getDefinition(); // Validate before removing the last good definition.
|
|
10
10
|
await unregister?.();
|
|
11
11
|
unregister = undefined;
|
|
12
12
|
if (disposed) return;
|
package/lib/model.mjs
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// the official job and question tools. A change on the official side therefore
|
|
8
8
|
// never leaves a stale module name behind.
|
|
9
9
|
import snapshot from './preset.json' with { type: 'json' };
|
|
10
|
+
import baseSnapshot from './base-snapshot.json' with { type: 'json' };
|
|
10
11
|
|
|
11
12
|
export const ENVIRONMENTS = ['auto', 'wsl', 'powershell', 'zsh', 'bash'];
|
|
12
13
|
|
|
@@ -69,40 +70,45 @@ export function normalizeForegroundSeconds(value = DEFAULT_FOREGROUND_SECONDS) {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* a
|
|
73
|
+
* Lookup hints for the official rows Deep PTC replaces with its execution group. Hints only find
|
|
74
|
+
* rows; the modules Deep PTC loads are always the ones the official rows (or the base declaration)
|
|
75
|
+
* name, so a renamed or replaced official module is followed rather than hard-coded.
|
|
75
76
|
*/
|
|
77
|
+
export const SHELL_TOOLS = {
|
|
78
|
+
bash: { ids: ['tool-bash'], names: ['@deepseek-ai/dsh-tool-bash'] },
|
|
79
|
+
pwsh: { ids: ['tool-pwsh'], names: ['@deepseek-ai/dsh-tool-pwsh'] },
|
|
80
|
+
};
|
|
81
|
+
const SHELL_EXECUTOR_NAMES = [
|
|
82
|
+
'@deepseek-ai/dsh-bash-local',
|
|
83
|
+
'@deepseek-ai/dsh-bash-sandbox',
|
|
84
|
+
'@deepseek-ai/dsh-pwsh-local',
|
|
85
|
+
'@deepseek-ai/dsh-pwsh-sandbox',
|
|
86
|
+
];
|
|
76
87
|
export const SHELL_ROWS = {
|
|
77
|
-
ids: [
|
|
78
|
-
names: [
|
|
79
|
-
'@deepseek-ai/dsh-tool-bash',
|
|
80
|
-
'@deepseek-ai/dsh-tool-pwsh',
|
|
81
|
-
'@deepseek-ai/dsh-bash-local',
|
|
82
|
-
'@deepseek-ai/dsh-bash-sandbox',
|
|
83
|
-
'@deepseek-ai/dsh-pwsh-sandbox',
|
|
84
|
-
],
|
|
88
|
+
ids: [...SHELL_TOOLS.bash.ids, ...SHELL_TOOLS.pwsh.ids],
|
|
89
|
+
names: [...SHELL_TOOLS.bash.names, ...SHELL_TOOLS.pwsh.names, ...SHELL_EXECUTOR_NAMES],
|
|
85
90
|
};
|
|
86
91
|
|
|
87
|
-
/**
|
|
92
|
+
/** Lookup hints for the official rows Deep PTC keeps but wraps, keyed by row id. */
|
|
88
93
|
export const WRAPPED_ROWS = {
|
|
89
94
|
'tool-jobs': '@deepseek-ai/dsh-tool-jobs',
|
|
90
95
|
'tool-ask-user': '@deepseek-ai/dsh-tool-ask-user',
|
|
91
96
|
};
|
|
92
97
|
|
|
98
|
+
/** Fallback executor declaration, used only when the installed base declaration cannot be read. */
|
|
99
|
+
export const BASE_SNAPSHOT = baseSnapshot;
|
|
100
|
+
|
|
93
101
|
const PERSONA_ROW = { ids: ['persona'], names: ['@deepseek-ai/dsh-persona'] };
|
|
94
102
|
const WRAP_TARGETS = [
|
|
95
103
|
{
|
|
96
104
|
key: 'tool-jobs',
|
|
97
|
-
upstream: '@deepseek-ai/dsh-tool-jobs',
|
|
98
105
|
replacement: 'dsh-deep-ptc-mode/jobs-tool',
|
|
99
|
-
|
|
106
|
+
options: milliseconds => ({ waitTimeoutMs: milliseconds, maxWaitTimeoutMs: milliseconds }),
|
|
100
107
|
},
|
|
101
108
|
{
|
|
102
109
|
key: 'tool-ask-user',
|
|
103
|
-
upstream: '@deepseek-ai/dsh-tool-ask-user',
|
|
104
110
|
replacement: 'dsh-deep-ptc-mode/ask-user',
|
|
105
|
-
|
|
111
|
+
options: () => ({ mode: 'timed', timeout: QUESTION_SECONDS }),
|
|
106
112
|
},
|
|
107
113
|
];
|
|
108
114
|
|
|
@@ -208,17 +214,33 @@ export function deriveDeepPtc(upstream, options = {}, platform = process.platfor
|
|
|
208
214
|
report.persona = 'replaced';
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
// Execution environment:
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
// Execution environment: replace the official shell rows (wherever the official preset nests them)
|
|
218
|
+
// with the selectable execution group in the same place. The group runs the official shell tool
|
|
219
|
+
// and executor the installed Harness names; when they cannot be mapped, the official rows stay.
|
|
220
|
+
const kind = environment === 'powershell' ? 'pwsh' : 'bash';
|
|
221
|
+
const executors = { ...BASE_SNAPSHOT, ...(options.executors ?? {}) };
|
|
222
|
+
const tool = findRow(plugins, SHELL_TOOLS[kind]);
|
|
223
|
+
const official = executors[kind];
|
|
224
|
+
const mapped = environment === 'wsl' || environment === 'zsh';
|
|
225
|
+
const unusable = tool === undefined ? `the official PTC preset has no ${kind} tool row`
|
|
226
|
+
: typeof official?.name !== 'string' ? `the installed Harness declares no ${kind} executor`
|
|
227
|
+
: mapped && options.mappedExecutor === false ? `the official bash executor cannot be extended for ${environment}`
|
|
228
|
+
: undefined;
|
|
229
|
+
report.environment = unusable === undefined ? environment : 'official';
|
|
219
230
|
let anchorSiblings = plugins;
|
|
220
231
|
let anchorIndex;
|
|
221
|
-
|
|
232
|
+
const rows = [];
|
|
233
|
+
if (unusable !== undefined) {
|
|
234
|
+
report.skipped.push(`execution environment ${environment} (${unusable}; official shell rows kept)`);
|
|
235
|
+
const topLevelPersona = plugins.findIndex(row => row && row.group !== true
|
|
236
|
+
&& (PERSONA_ROW.names.includes(row.name) || PERSONA_ROW.ids.includes(row.id)));
|
|
237
|
+
anchorIndex = topLevelPersona + 1;
|
|
238
|
+
} else {
|
|
239
|
+
const removed = [];
|
|
240
|
+
walkRows(plugins, (row, siblings, index) => {
|
|
241
|
+
if (isShellRow(row)) removed.push({ row, siblings, index });
|
|
242
|
+
});
|
|
243
|
+
report.replacedShellRows = removed.map(({ row }) => `${row.id ?? '?'} (${row.name})`);
|
|
222
244
|
anchorSiblings = removed[0].siblings;
|
|
223
245
|
const bySiblings = new Map();
|
|
224
246
|
for (const { siblings, index } of removed) {
|
|
@@ -229,49 +251,46 @@ export function deriveDeepPtc(upstream, options = {}, platform = process.platfor
|
|
|
229
251
|
for (const [siblings, indexes] of bySiblings) {
|
|
230
252
|
for (const index of [...indexes].sort((left, right) => right - left)) siblings.splice(index, 1);
|
|
231
253
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
254
|
+
// With background jobs available, the executor timeout only decides when a foreground command
|
|
255
|
+
// moves to the background; the official tools run such commands with onExpiry: none.
|
|
256
|
+
const executorOptions = { ...(official.config ?? {}), timeoutMs: foregroundMs, maxTimeoutMs: foregroundMs };
|
|
257
|
+
const executor = mapped
|
|
258
|
+
? { id: 'executor', name: 'dsh-deep-ptc-mode/executor',
|
|
259
|
+
config: { environment, wslDistribution: distribution, base: official.name, options: executorOptions } }
|
|
260
|
+
: { id: 'executor', name: official.name, config: executorOptions };
|
|
261
|
+
const terminal = {
|
|
262
|
+
id: environment === 'zsh' ? 'tool-zsh' : tool.id ?? `tool-${kind}`,
|
|
263
|
+
name: 'dsh-deep-ptc-mode/terminal',
|
|
264
|
+
config: {
|
|
265
|
+
upstream: tool.name,
|
|
266
|
+
...tool.config === undefined ? {} : { options: tool.config },
|
|
267
|
+
...environment === 'zsh' ? { dialect: 'zsh' } : {},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
rows.push({
|
|
271
|
+
id: uniqueRowId(plugins, 'execution'), name: 'cordis:group', group: true, isolate: { shell: true },
|
|
272
|
+
config: [executor, terminal, { id: 'execution-instructions', name: 'dsh-deep-ptc-mode/environment',
|
|
273
|
+
config: { environment, wslDistribution: distribution } }],
|
|
274
|
+
});
|
|
237
275
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
id: 'executor',
|
|
241
|
-
name: environment === 'powershell' ? '@deepseek-ai/dsh-pwsh-sandbox'
|
|
242
|
-
: environment === 'bash' ? '@deepseek-ai/dsh-bash-sandbox' : 'dsh-deep-ptc-mode/executor',
|
|
243
|
-
config: {
|
|
244
|
-
...(environment === 'wsl' || environment === 'zsh' ? { environment, wslDistribution: distribution } : {}),
|
|
245
|
-
timeoutMs: foregroundMs, maxTimeoutMs: foregroundMs,
|
|
246
|
-
},
|
|
247
|
-
};
|
|
248
|
-
const terminal = {
|
|
249
|
-
id: environment === 'zsh' ? 'tool-zsh' : environment === 'powershell' ? 'tool-pwsh' : 'tool-bash',
|
|
250
|
-
name: 'dsh-deep-ptc-mode/terminal',
|
|
251
|
-
config: { tool: environment === 'powershell' ? 'pwsh' : 'bash', ...(environment === 'zsh' ? { dialect: 'zsh' } : {}) },
|
|
252
|
-
};
|
|
253
|
-
const execution = {
|
|
254
|
-
id: uniqueRowId(plugins, 'execution'), name: 'cordis:group', group: true, isolate: { shell: true },
|
|
255
|
-
config: [executor, terminal, { id: 'execution-instructions', name: 'dsh-deep-ptc-mode/environment',
|
|
256
|
-
config: { environment, wslDistribution: distribution } }],
|
|
257
|
-
};
|
|
258
|
-
const guard = {
|
|
259
|
-
id: uniqueRowId([...plugins, execution], 'reachability'),
|
|
276
|
+
rows.push({
|
|
277
|
+
id: uniqueRowId([...plugins, ...rows], 'reachability'),
|
|
260
278
|
name: 'dsh-deep-ptc-mode/guard', config: { foregroundSeconds },
|
|
261
|
-
};
|
|
262
|
-
anchorSiblings.splice(anchorIndex, 0,
|
|
279
|
+
});
|
|
280
|
+
anchorSiblings.splice(anchorIndex, 0, ...rows);
|
|
263
281
|
|
|
264
|
-
// Wrapped tools:
|
|
265
|
-
// Deep PTC wait behaviour
|
|
282
|
+
// Wrapped tools: the wrapper loads the module the official row names, with the official options
|
|
283
|
+
// plus the Deep PTC wait behaviour.
|
|
266
284
|
for (const target of WRAP_TARGETS) {
|
|
267
|
-
const row = findRow(plugins, { ids: [target.key], names: [target.
|
|
285
|
+
const row = findRow(plugins, { ids: [target.key], names: [WRAPPED_ROWS[target.key]] });
|
|
268
286
|
if (row === undefined) {
|
|
269
|
-
report.skipped.push(`${target.key} (
|
|
287
|
+
report.skipped.push(`${target.key} (no official row)`);
|
|
270
288
|
continue;
|
|
271
289
|
}
|
|
290
|
+
const upstreamName = row.name;
|
|
272
291
|
row.name = target.replacement;
|
|
273
|
-
row.config = { ...(row.config ?? {}), ...target.
|
|
274
|
-
report.wrapped.push(target.key);
|
|
292
|
+
row.config = { upstream: upstreamName, options: { ...(row.config ?? {}), ...target.options(foregroundMs) } };
|
|
293
|
+
report.wrapped.push(`${target.key} (${upstreamName})`);
|
|
275
294
|
}
|
|
276
295
|
|
|
277
296
|
const description = `${PRESET_META.description} 当前环境:${environment}${environment === 'wsl' && distribution ? ` (${distribution})` : ''}`;
|
package/lib/terminal.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
import { apply as applyBash } from '@deepseek-ai/dsh-tool-bash';
|
|
3
|
-
import { apply as applyPwsh } from '@deepseek-ai/dsh-tool-pwsh';
|
|
4
2
|
import { adaptContext, registering } from './adapt.mjs';
|
|
3
|
+
import { applyOfficial } from './host.mjs';
|
|
5
4
|
import { finishPromoted, steerableJobs, steerableTool, steeringWatch } from './reachable.mjs';
|
|
6
5
|
|
|
7
6
|
export const name = 'deep-ptc-terminal';
|
|
8
|
-
export const inject = [
|
|
7
|
+
export const inject = [];
|
|
9
8
|
export const Config = z.object({
|
|
10
|
-
tool
|
|
9
|
+
// The official shell tool module and its options, as the installed PTC declaration names them.
|
|
10
|
+
upstream: z.string().required(),
|
|
11
|
+
options: z.any(),
|
|
11
12
|
dialect: z.union(['zsh']),
|
|
12
13
|
});
|
|
13
14
|
|
|
14
|
-
//
|
|
15
|
-
// messages; the Zsh dialect only renames the
|
|
16
|
-
export function apply(ctx, config) {
|
|
15
|
+
// Run the official shell tool with its own execution, jobs and approval implementation. Foreground
|
|
16
|
+
// waits yield to user messages; the Zsh dialect only renames the tool's public face.
|
|
17
|
+
export async function apply(ctx, config) {
|
|
17
18
|
const watch = steeringWatch(ctx);
|
|
18
19
|
const zsh = config.dialect === 'zsh';
|
|
19
20
|
const dialect = text => zsh ? text.replace(/\bbash\b/gu, 'zsh').replace(/\bBash\b/gu, 'Zsh') : text;
|
|
20
|
-
|
|
21
|
+
await applyOfficial(ctx, config.upstream, config.options, child => adaptContext(child, {
|
|
21
22
|
tools: tools => registering(tools, definition => steerableTool({
|
|
22
23
|
...definition,
|
|
23
24
|
...zsh ? { name: definition.name === 'bash' ? 'zsh' : definition.name, description: dialect(definition.description) } : {},
|
|
@@ -31,6 +32,5 @@ export function apply(ctx, config) {
|
|
|
31
32
|
},
|
|
32
33
|
}) : prompt,
|
|
33
34
|
jobs: jobs => steerableJobs(jobs, watch),
|
|
34
|
-
});
|
|
35
|
-
(config.tool === 'pwsh' ? applyPwsh : applyBash)(adapted, {});
|
|
35
|
+
}));
|
|
36
36
|
}
|
package/lib/upstream.mjs
CHANGED
|
@@ -107,6 +107,35 @@ export function parseOfficialPreset(text) {
|
|
|
107
107
|
return preset;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/** Base deployment declaration that names the shell executors the Harness ships. */
|
|
111
|
+
export const BASE_DECLARATION_SPECIFIER = '@deepseek-ai/dsh-base/cordis.patch.yml';
|
|
112
|
+
const EXECUTOR_ROW_IDS = { bash: 'bash-sandbox', pwsh: 'pwsh-sandbox' };
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Read the official bash and PowerShell executor rows out of the base deployment declaration.
|
|
116
|
+
* @param text - YAML source of `@deepseek-ai/dsh-base/cordis.patch.yml`.
|
|
117
|
+
* @returns `{ bash?, pwsh? }`, each `{ name, config? }` as the declaration states it.
|
|
118
|
+
*/
|
|
119
|
+
export function parseOfficialExecutors(text) {
|
|
120
|
+
const document = loadYaml().load(text, { schema: presetSchema() });
|
|
121
|
+
const found = {};
|
|
122
|
+
const visit = rows => {
|
|
123
|
+
if (!Array.isArray(rows)) return;
|
|
124
|
+
for (const row of rows) {
|
|
125
|
+
if (!row || typeof row !== 'object') continue;
|
|
126
|
+
for (const [kind, id] of Object.entries(EXECUTOR_ROW_IDS)) {
|
|
127
|
+
if (row.id !== id || typeof row.name !== 'string' || found[kind] !== undefined) continue;
|
|
128
|
+
const config = row.config && typeof row.config === 'object' && !Array.isArray(row.config) ? row.config : undefined;
|
|
129
|
+
found[kind] = { name: row.name, ...config === undefined ? {} : { config } };
|
|
130
|
+
}
|
|
131
|
+
visit(row.insert);
|
|
132
|
+
if (Array.isArray(row.config)) visit(row.config);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
visit(Array.isArray(document) ? document : []);
|
|
136
|
+
return found;
|
|
137
|
+
}
|
|
138
|
+
|
|
110
139
|
function tryResolve(specifier) {
|
|
111
140
|
try {
|
|
112
141
|
return import.meta.resolve(specifier);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-deep-ptc-mode",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Deep PTC mode for DeepSeek Harness: no token rationing, code-enforced no-sleep (long commands move to the background and user messages interrupt waits), plans by task size (approval only for long tasks), asks instead of guessing intent, and runs commands in WSL, PowerShell, Zsh or Bash.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -75,40 +75,17 @@
|
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@deepseek-ai/schemastery": "^3.18.4",
|
|
78
|
-
"@deepseek-ai/dsh-bash-local": ">=0.2.1-rc.5",
|
|
79
|
-
"@deepseek-ai/dsh-bash-sandbox": ">=0.2.1-rc.5",
|
|
80
|
-
"@deepseek-ai/dsh-tool-bash": ">=0.2.1-rc.5",
|
|
81
|
-
"@deepseek-ai/dsh-tool-pwsh": ">=0.2.1-rc.5",
|
|
82
|
-
"@deepseek-ai/dsh-tool-jobs": ">=0.2.1-rc.5",
|
|
83
|
-
"@deepseek-ai/dsh-tool-ask-user": ">=0.2.1-rc.5",
|
|
84
78
|
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.1-rc.5",
|
|
85
79
|
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.1-rc.5",
|
|
86
80
|
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.1-rc.5",
|
|
87
81
|
"@deepseek-ai/dsh-client-locale": ">=0.2.1-rc.5",
|
|
88
|
-
"@deepseek-ai/dsh-web-app": ">=0.2.1-rc.5"
|
|
82
|
+
"@deepseek-ai/dsh-web-app": ">=0.2.1-rc.5",
|
|
83
|
+
"@deepseek-ai/dsh-base": ">=0.2.1-rc.5"
|
|
89
84
|
},
|
|
90
85
|
"peerDependenciesMeta": {
|
|
91
86
|
"@deepseek-ai/schemastery": {
|
|
92
87
|
"optional": true
|
|
93
88
|
},
|
|
94
|
-
"@deepseek-ai/dsh-bash-local": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
97
|
-
"@deepseek-ai/dsh-bash-sandbox": {
|
|
98
|
-
"optional": true
|
|
99
|
-
},
|
|
100
|
-
"@deepseek-ai/dsh-tool-bash": {
|
|
101
|
-
"optional": true
|
|
102
|
-
},
|
|
103
|
-
"@deepseek-ai/dsh-tool-pwsh": {
|
|
104
|
-
"optional": true
|
|
105
|
-
},
|
|
106
|
-
"@deepseek-ai/dsh-tool-jobs": {
|
|
107
|
-
"optional": true
|
|
108
|
-
},
|
|
109
|
-
"@deepseek-ai/dsh-tool-ask-user": {
|
|
110
|
-
"optional": true
|
|
111
|
-
},
|
|
112
89
|
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
113
90
|
"optional": true
|
|
114
91
|
},
|
|
@@ -123,6 +100,9 @@
|
|
|
123
100
|
},
|
|
124
101
|
"@deepseek-ai/dsh-web-app": {
|
|
125
102
|
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"@deepseek-ai/dsh-base": {
|
|
105
|
+
"optional": true
|
|
126
106
|
}
|
|
127
107
|
},
|
|
128
108
|
"dependencies": {
|