dsh-deep-ptc-mode 1.8.6 → 1.8.7
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 +14 -0
- package/README.md +12 -9
- package/README.zh.md +13 -8
- package/lib/client.js +237 -44
- package/lib/creative.mjs +15 -34
- package/lib/index.mjs +9 -4
- package/lib/model.mjs +14 -7
- package/lib/shells.mjs +11 -1
- package/lib/skill-card.mjs +0 -0
- package/lib/skill-context.mjs +0 -0
- package/lib/tool-state.mjs +0 -0
- package/lib/upstream.mjs +0 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.7 — 2026-11-10
|
|
4
|
+
|
|
5
|
+
- 在深度 PTC 侧栏加入界面特效开关。关闭后即时撤掉界面美化和动画,设置保存在当前客户端。使用外部主题或 UI 插件时建议关闭。
|
|
6
|
+
- 新增后台任务卡片。默认最多六个位置,运行中的任务优先且最多五条,已结束最多三条。折叠入口占一个位置并显示隐藏数量。
|
|
7
|
+
- 合并 PTC 和创造模式的 Skill 目录,修复重复注册文件系统提供器后误退安全模式的问题。
|
|
8
|
+
- 修复 Electron 特效层覆盖窗口拖动区的问题,区分工具重载命令不可用和执行失败,并添加中英文插件详情。
|
|
9
|
+
- Windows 可填写 Niubash 的 `bash.exe` 路径来使用原生 Bash。受限模式可选 PowerShell。宿主最低版本为 DSH `0.2.2-rc.1`。
|
|
10
|
+
|
|
11
|
+
- Add a visual effects switch to the Deep PTC side card. It applies immediately and remembers the choice in the current client. Keep it off when using an external theme or UI plugin.
|
|
12
|
+
- Show background jobs in six preview positions. Up to five active jobs take priority over up to three finished jobs. The overflow row uses one position and shows the hidden count.
|
|
13
|
+
- Merge PTC and creative-mode skill directories into one filesystem provider to avoid an unnecessary fallback to safe mode.
|
|
14
|
+
- Restore Electron window dragging with effects enabled, distinguish unavailable reload commands from execution errors, and add English and Chinese plugin details.
|
|
15
|
+
- Support native Windows Bash through an explicit Niubash `bash.exe` path. Use PowerShell for confined Windows work. The minimum host version is DSH `0.2.2-rc.1`.
|
|
16
|
+
|
|
3
17
|
## 1.8.6 — 2026-11-09
|
|
4
18
|
|
|
5
19
|
- 运行中的输入框泛蓝光:对话运行时输入框边框转蓝并持续呼吸发光。1.8.5 已移植这段动效,但发送后输入框处于聚焦状态,聚焦样式的 `!important` 阴影压过了动画,所以看不到;现在聚焦样式只在空闲时生效。
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Deep PTC mode
|
|
2
2
|
|
|
3
|
-
[中文](README.zh.md) · MIT · **1.8.
|
|
3
|
+
[中文](README.zh.md) · MIT · **1.8.7**
|
|
4
4
|
|
|
5
5
|
[1.7.3 实测汇总 / Test summary](TEST_REPORT.md)
|
|
6
6
|
**Reports. Asks. Stays awake. Plans. Stays reachable.**
|
|
@@ -26,7 +26,7 @@ Not every third-party plugin is guaranteed to fit: the interface is verified for
|
|
|
26
26
|
|
|
27
27
|
### 1. Dynamic preset and tool loading
|
|
28
28
|
|
|
29
|
-
Read the running host's official PTC declaration and inherit its rows as they are; only the persona, execution group, reachability guard, job wrapper and question wrapper are replaced. Rebuild only when the declaration or settings change
|
|
29
|
+
Read the running host's official PTC declaration and inherit its rows as they are; only the persona, execution group, reachability guard, job wrapper and question wrapper are replaced. Rebuild only when the declaration or settings change, checked when settings change and once before each Deep PTC conversation is created or resumed, with no polling timer; fall back to the bundled snapshot with a warning if it cannot be loaded, parsed or derived. An official upgrade can add tools without a release of this preset; existing sessions are not forcibly switched.
|
|
30
30
|
|
|
31
31
|
### 2. Flexible creative-mode tools
|
|
32
32
|
|
|
@@ -66,16 +66,18 @@ After each turn, a card at the end of that turn in the conversation (where offic
|
|
|
66
66
|
- The card tracks skills loaded directly through the official `skill` tool and skills loaded by a PTC inner call inside `run_code`. The latter usually reach the program rather than the model context, so closing one only removes it from the card, not from program output. `/name` injections are not covered yet.
|
|
67
67
|
- A switch leaves no command row in the conversation (the session log still records it); only a failed switch shows a short error line in place.
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## Visual effects and side card
|
|
70
70
|
|
|
71
71
|
The look from dsh-refined-ui is part of this plugin and applies **only while the conversation on screen is a Deep PTC session**; other modes and the new-session page keep the official look.
|
|
72
72
|
|
|
73
73
|
- Calmer light and dark neutrals, a Chinese-first font stack, slim scrollbars, a floating composer card with a flowing blue hairline on focus, a blue gradient send button, soft blue user bubbles, roomier assistant text, and a blue wash on hovered and selected sidebar rows.
|
|
74
74
|
- Interactions: Ctrl/Cmd+K command palette (sessions, new session, plugins, automations), pointer spotlight, click ripple, magnetic send button, `/` to focus the composer, Alt+Up/Down to switch sessions, Ctrl+Alt+D diagnostics.
|
|
75
75
|
- Motion: while the conversation runs, the composer turns blue and breathes (also while focused), with a send-button ring and a steady stream of sparks rising above it; sparks on send and completion. Everything honours reduced motion.
|
|
76
|
-
-
|
|
77
|
-
- **Execution environment
|
|
76
|
+
- Each Deep PTC conversation has a **side card** on the right.
|
|
77
|
+
- **Execution environment** offers WSL, PowerShell, native Bash, or Zsh depending on the host. It writes the same host settings as the settings page and applies to newly created Deep PTC sessions.
|
|
78
|
+
- **Visual effects** toggles styling and animations immediately and saves the preference in the current client. Keep it off when using an external theme or UI plugin.
|
|
78
79
|
- **Subagents**, when there are any: name, state, duration and tokens from the official subagent catalog and timing data; a row opens that subagent's chat in the official right sidebar.
|
|
80
|
+
- **Background jobs** shows the current conversation's active and finished jobs. The card has six positions by default, with up to five active jobs first and up to three finished jobs. An expandable row uses one position and shows how many jobs it contains.
|
|
79
81
|
- **Tool state**: the “Reload all tool states” button and, when present, the failed external tools.
|
|
80
82
|
The column uses the host's background with light grey dividers, blue only for the selected option, button outlines and status squares, and the host's usual black and grey text; for a running subagent only its small status square flashes blue. In a narrow conversation the card folds into a small pill, whose status square flashes the same way. It can be collapsed, and that choice is kept on this machine.
|
|
81
83
|
- While the standalone dsh-refined-ui is still running, this plugin does not draw the same look a second time.
|
|
@@ -135,6 +137,7 @@ Open **Settings → Plugins → Deep PTC**, choose an environment, save, and cre
|
|
|
135
137
|
| Automatic | Windows / macOS / Linux | PowerShell on Windows, Zsh on macOS, Bash on Linux |
|
|
136
138
|
| WSL Bash | Windows | Explicit `wsl.exe ... --exec bash -lc`, tool `bash` |
|
|
137
139
|
| PowerShell | Windows | Official native PowerShell executor, tool `pwsh` |
|
|
140
|
+
| Native Bash | Windows | An absolute path to `bash.exe`, such as the Niubash binary bundled with `dsh-ops` |
|
|
138
141
|
| Zsh | macOS / Linux | `/bin/zsh -lc` on macOS; installed `zsh` on Linux; tool `zsh` |
|
|
139
142
|
| Native Bash | macOS / Linux | Official Bash executor, tool `bash` |
|
|
140
143
|
|
|
@@ -146,9 +149,9 @@ WSL source uses Linux/POSIX syntax, while file tools and `workdir` use Windows h
|
|
|
146
149
|
|
|
147
150
|
### Sandbox behavior
|
|
148
151
|
|
|
149
|
-
Native PowerShell
|
|
152
|
+
Native PowerShell and the macOS/Linux shells use Harness sandbox, approval and process management. On Windows, WSL and native Bash require execution already authorized as `danger-full-access`. Choose PowerShell for confined Windows work.
|
|
150
153
|
|
|
151
|
-
PowerShell, Bash and Zsh can use a
|
|
154
|
+
PowerShell, macOS/Linux Bash and Zsh can use a discovered executable. On Windows, native Bash accepts an absolute path to `bash.exe`, such as `<profile>/node_modules/dsh-ops/runtime/win32-x64/niubash/winuxcmd/bin/bash.exe`. If that path is unavailable, new sessions keep the official shell.
|
|
152
155
|
|
|
153
156
|
## Plugin lab: official creative mode, in memory
|
|
154
157
|
|
|
@@ -196,10 +199,10 @@ A prompt changes the model's working tendency, not the real token limit or billi
|
|
|
196
199
|
|
|
197
200
|
## Install or upgrade
|
|
198
201
|
|
|
199
|
-
Requires Node `>=24` and DSH
|
|
202
|
+
Requires Node `>=24` and DSH `>=0.2.2-rc.1`. The installer rejects the current package on DSH `0.2.1-rc.5` based on its manifest. macOS/Zsh checks cover configuration, argv and tool mounting.
|
|
200
203
|
|
|
201
204
|
```js
|
|
202
|
-
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.8.
|
|
205
|
+
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.8.7" })
|
|
203
206
|
// Or from a local checkout or archive:
|
|
204
207
|
plugin_manager({ action: "install_bundle", target: "C:\\path\\to\\dsh-deep-ptc-mode" })
|
|
205
208
|
// Or target: "C:\\path\\to\\dsh-deep-ptc-mode-1.8.5.tgz"
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 深度 PTC 模式
|
|
2
2
|
|
|
3
|
-
[English](README.md) · MIT ·
|
|
3
|
+
[English](README.md) · MIT · 当前版本 **1.8.7**
|
|
4
4
|
|
|
5
5
|
[1.7.3 实测汇总 / Test summary](TEST_REPORT.md)
|
|
6
6
|
**会汇报,先提问,不休眠,有计划,能插话。**
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
### 1. 预设与工具的动态读取
|
|
28
28
|
|
|
29
|
-
运行时读取宿主正在发布的官方 PTC 声明,官方行原样继承;仅替换 persona、执行组、可达性守卫、job
|
|
29
|
+
运行时读取宿主正在发布的官方 PTC 声明,官方行原样继承;仅替换 persona、执行组、可达性守卫、job 与提问包装。在设置变更时、以及每个深度PTC对话创建或恢复之前确认一次声明,仅在声明或配置变化时重建,不再定时轮询;声明读不到/解析失败才用随包快照并记录日志。官方升级后无需为本模式发版即可继承新工具;新建会话使用新版,已有会话不强制切换。
|
|
30
30
|
|
|
31
31
|
### 2. 创造模式工具的灵活加入
|
|
32
32
|
|
|
@@ -66,16 +66,18 @@
|
|
|
66
66
|
- 卡片会跟踪官方 `skill` 工具直接加载,以及 `run_code` 内 PTC 子调用加载的 Skill;后者通常只进入程序而非模型上下文,关闭时只从卡片移除,不重写程序输出。`/name` 注入暂不纳入。
|
|
67
67
|
- 切换开关不会在对话里留下命令回显(会话日志仍记录这次操作);只有切换失败时,原位显示一行错误。
|
|
68
68
|
|
|
69
|
-
##
|
|
69
|
+
## 界面特效与侧边卡片
|
|
70
70
|
|
|
71
71
|
dsh-refined-ui 的界面精修并入本插件,**只在当前显示的是深度PTC会话时生效**,切到其他模式或新会话页时恢复官方原样:
|
|
72
72
|
|
|
73
73
|
- 明暗两套更克制的中性色、中文优先字体、细滚动条;悬浮的输入框卡片,聚焦时出现流动的蓝色细线;蓝色渐变发送键;淡蓝渐变的用户气泡;更宽松的助手正文;侧栏悬停与选中的蓝色底。
|
|
74
74
|
- 交互:Ctrl/⌘+K 命令面板(跳转会话、新会话、插件、自动化任务)、指针追光、点击涟漪、磁吸发送键、`/` 聚焦输入框、Alt+↑/↓ 切换会话、Ctrl+Alt+D 诊断。
|
|
75
75
|
- 动效:对话运行时输入框边框转蓝并呼吸发光(聚焦时也不例外),发送键光环,输入框上方持续冒出光点,发送与完成时的光点;全部遵循系统的“减少动态效果”。
|
|
76
|
-
-
|
|
77
|
-
-
|
|
76
|
+
- 深度 PTC 会话在对话区右侧显示**侧边卡片**。
|
|
77
|
+
- **执行环境**可选择 WSL、PowerShell、原生 Bash 或 Zsh,选项取决于宿主系统。和设置页写同一份宿主设置,对之后新建的深度 PTC 会话生效。
|
|
78
|
+
- **界面特效**开关即时关闭界面美化与动画,选择保存在当前客户端。使用外部主题或 UI 插件时,建议关闭。
|
|
78
79
|
- **子代理**(有子代理时才出现):名称、状态、用时和 token,按官方子代理目录与计时数据计算;点击一行在官方右侧栏打开该子代理的对话。
|
|
80
|
+
- **后台任务**显示当前会话的运行和结束状态。默认最多六个位置,运行中优先且最多五条,已结束最多三条。超出部分合为一条可展开的记录,显示隐藏任务数量。
|
|
79
81
|
- **工具状态**:“重载所有工具状态”按钮,以及调用失败的外部工具(如有)。
|
|
80
82
|
侧栏为白底,浅灰色分割线,蓝色只用于选中项、按钮描边和状态小方块,文字与其他地方一样用黑色和灰色;运行中的子代理只有行首的状态小方块闪烁蓝光。对话区较窄时收成右上角的小胶囊,小方块同样会闪;卡片可收起,选择记在本机。
|
|
81
83
|
- 独立的 dsh-refined-ui 仍在运行时,本插件检测到它就不再重复绘制这一套样式。
|
|
@@ -135,18 +137,21 @@ const skills = await tools.deep_ptc_tools({ action: 'skills', query: 'build test
|
|
|
135
137
|
| 自动 | Windows / macOS / Linux | Windows 选 PowerShell,macOS 选 Zsh,Linux 选 Bash |
|
|
136
138
|
| WSL Bash | Windows | `wsl.exe ... --exec bash -lc`,工具名 `bash` |
|
|
137
139
|
| PowerShell | Windows | Harness 官方原生 PowerShell 执行器,工具名 `pwsh` |
|
|
140
|
+
| 原生 Bash | Windows | 填写 `bash.exe` 的绝对路径,可使用 `dsh-ops` 随包的 Niubash |
|
|
138
141
|
| Zsh | macOS / Linux | macOS 用 `/bin/zsh -lc`;Linux 用已安装的 `zsh`;工具名 `zsh` |
|
|
139
142
|
| 原生 Bash | macOS / Linux | Harness 官方 Bash 执行器,工具名 `bash` |
|
|
140
143
|
|
|
141
144
|
不适用于宿主的选项会禁用,运行时配置也会拒绝这些选择。WSL 发行版留空时使用 Windows 默认发行版,也可填写 `Ubuntu` 等已安装名称。Linux 上选择 Zsh 前需要安装 Zsh。
|
|
142
145
|
|
|
146
|
+
Windows 选择原生 Bash 时,可以填入 `<profile>/node_modules/dsh-ops/runtime/win32-x64/niubash/winuxcmd/bin/bash.exe` 的实际绝对路径。路径不可用时新会话保留官方 Shell。原生 Windows Bash 仅在宿主已授权的 `danger-full-access` 下执行,受限模式请选择 PowerShell。
|
|
147
|
+
|
|
143
148
|
**选择会改变实际执行器和模型看到的命令语法,不只改工具名称。** 执行器隔离在本 preset 中,不修改全局 shell,也不影响其他 preset。保存设置后,新会话使用新版本;已有会话和后台任务继续使用创建时的环境。切换环境时请新建会话,避免同一任务中途换方言。
|
|
144
149
|
|
|
145
150
|
WSL 命令使用 Linux/POSIX 语法;文件工具和 `workdir` 仍用 Windows 宿主路径。执行器用 `--cd` 进入目录,发行版、目录和命令分别作为 argv 传递,不额外拼接 shell 字符串。WSL 内的 PATH、代理等由所选发行版的登录 shell 配置决定,Windows 环境变量不会全部自动变成 Linux 环境变量。
|
|
146
151
|
|
|
147
152
|
### 沙箱边界
|
|
148
153
|
|
|
149
|
-
原生 PowerShell
|
|
154
|
+
原生 PowerShell 和 macOS/Linux 的 Shell 使用 Harness 的沙箱、审批和进程管理。Windows 的 WSL 与原生 Bash 仅在宿主已授权的 `danger-full-access` 下执行,受限模式请选择 PowerShell。
|
|
150
155
|
|
|
151
156
|
选择 PowerShell、Bash 或 Zsh 时,可以指定本机已经发现的常见可执行文件。留空则沿用官方查找顺序。WSL 仍只选择发行版。所选文件不存在时记一条警告并回到自动。PowerShell 的选择写入官方执行器的 `pwshPath`。Bash 和 Zsh 只改启动参数。
|
|
152
157
|
|
|
@@ -196,12 +201,12 @@ WSL 命令使用 Linux/POSIX 语法;文件工具和 `workdir` 仍用 Windows
|
|
|
196
201
|
|
|
197
202
|
## 安装和升级
|
|
198
203
|
|
|
199
|
-
要求 Node `>=24`、DSH
|
|
204
|
+
要求 Node `>=24`、DSH `>=0.2.2-rc.1`。使用 `0.2.1-rc.5` 时,安装器会根据插件清单拒绝安装当前版本。macOS/Zsh 分支做了配置、工具挂载与参数测试,尚未在 macOS 真机执行。
|
|
200
205
|
|
|
201
206
|
本地目录或构建产物可通过插件管理器安装:
|
|
202
207
|
|
|
203
208
|
```js
|
|
204
|
-
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.8.
|
|
209
|
+
plugin_manager({ action: "install_bundle", target: "dsh-deep-ptc-mode@1.8.7" })
|
|
205
210
|
// 也可从本地目录或安装包安装:
|
|
206
211
|
plugin_manager({ action: "install_bundle", target: "C:\\path\\to\\dsh-deep-ptc-mode" })
|
|
207
212
|
// 或 target: "C:\\path\\to\\dsh-deep-ptc-mode-1.8.5.tgz"
|
package/lib/client.js
CHANGED
|
@@ -9,6 +9,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
9
9
|
environment: '执行环境', auto: '自动(Windows:PowerShell;macOS:Zsh;Linux:Bash)',
|
|
10
10
|
wsl: 'WSL Bash(Windows)', powershell: 'PowerShell(Windows)',
|
|
11
11
|
zsh: 'Zsh(macOS / Linux)', bash: '原生 Bash(macOS / Linux)',
|
|
12
|
+
windowsBash: '原生 Bash(Windows)', bashPath: 'bash.exe 的绝对路径',
|
|
13
|
+
bashPathHint: '可填写 dsh-ops 随包的 Niubash。路径不可用时保留官方 Shell。受限模式请选 PowerShell。',
|
|
12
14
|
distribution: 'WSL 发行版', distributionHint: '留空使用 Windows 的默认发行版,例如 Ubuntu。',
|
|
13
15
|
shell: 'Shell 版本', shellAuto: '自动(沿用官方查找顺序)',
|
|
14
16
|
shellHint: '只列出本机已发现的常见版本。文件消失后自动回退。WSL 仍只选择发行版。',
|
|
@@ -23,6 +25,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
23
25
|
environment: 'Execution environment', auto: 'Automatic (Windows: PowerShell; macOS: Zsh; Linux: Bash)',
|
|
24
26
|
wsl: 'WSL Bash (Windows)', powershell: 'PowerShell (Windows)',
|
|
25
27
|
zsh: 'Zsh (macOS / Linux)', bash: 'Native Bash (macOS / Linux)',
|
|
28
|
+
windowsBash: 'Native Bash (Windows)', bashPath: 'Absolute path to bash.exe',
|
|
29
|
+
bashPathHint: 'You can use the Niubash bundled with dsh-ops. An unavailable path keeps the official shell. Choose PowerShell for confined work.',
|
|
26
30
|
distribution: 'WSL distribution', distributionHint: 'Leave blank for the Windows default distribution, for example Ubuntu.',
|
|
27
31
|
shell: 'Shell version', shellAuto: 'Automatic (official lookup)',
|
|
28
32
|
shellHint: 'Lists common executables found on this machine. A missing file falls back to automatic. WSL still selects a distribution only.',
|
|
@@ -55,8 +59,9 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
55
59
|
}, [state.value, state.revision]);
|
|
56
60
|
if (view === 'summary') return t('summary');
|
|
57
61
|
if (state.status !== 'ready') return h('p', null, t('loading'));
|
|
58
|
-
const
|
|
59
|
-
|
|
62
|
+
const platform = state.value.hostPlatform;
|
|
63
|
+
const allowed = allowedEnvironments(platform);
|
|
64
|
+
const windowsBash = platform === 'win32' && environment === 'bash';
|
|
60
65
|
const disabled = !state.writable || saving;
|
|
61
66
|
const changed = () => {
|
|
62
67
|
if (!dirty.current) draftRevision.current = state.revision;
|
|
@@ -70,7 +75,7 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
70
75
|
const ok = await form.mutate([
|
|
71
76
|
{ op: 'set', path: ['environment'], value: environment },
|
|
72
77
|
{ op: 'set', path: ['wslDistribution'], value: distribution.trim() },
|
|
73
|
-
{ op: 'set', path: ['shellExecutable'], value: shellExecutable },
|
|
78
|
+
{ op: 'set', path: ['shellExecutable'], value: windowsBash ? shellExecutable.trim() : shellExecutable },
|
|
74
79
|
], draftRevision.current);
|
|
75
80
|
if (!ok) throw new Error('Configuration was rejected');
|
|
76
81
|
dirty.current = false;
|
|
@@ -96,15 +101,24 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
96
101
|
return h('form', { onSubmit: save, style: { display: 'grid', gap: '12px', maxWidth: '600px' } },
|
|
97
102
|
h('label', { htmlFor: 'deep-ptc-environment' }, t('environment')),
|
|
98
103
|
h('select', { id: 'deep-ptc-environment', value: environment, disabled, style: control,
|
|
99
|
-
onChange: event => {
|
|
104
|
+
onChange: event => {
|
|
105
|
+
changed();
|
|
106
|
+
const next = event.target.value;
|
|
107
|
+
if (platform === 'win32' && (environment === 'bash' || next === 'bash')) setShellExecutable('');
|
|
108
|
+
setEnvironment(next);
|
|
109
|
+
} },
|
|
100
110
|
...['auto', 'wsl', 'powershell', 'zsh', 'bash'].map(value =>
|
|
101
|
-
h('option', { key: value, value, disabled: !allowed.includes(value) }, t(value)))),
|
|
111
|
+
h('option', { key: value, value, disabled: !allowed.includes(value) }, t(platform === 'win32' && value === 'bash' ? 'windowsBash' : value)))),
|
|
102
112
|
environment === 'wsl' ? h(React.Fragment, null,
|
|
103
113
|
h('label', { htmlFor: 'deep-ptc-distribution' }, t('distribution')),
|
|
104
114
|
h('input', { id: 'deep-ptc-distribution', value: distribution, disabled, style: control,
|
|
105
115
|
onChange: event => { changed(); setDistribution(event.target.value); } }),
|
|
106
116
|
h('p', null, t('distributionHint')), h('p', null, t('wslHint'))) : null,
|
|
107
|
-
|
|
117
|
+
windowsBash ? h(React.Fragment, null,
|
|
118
|
+
h('label', { htmlFor: 'deep-ptc-shell' }, t('bashPath')),
|
|
119
|
+
h('input', { id: 'deep-ptc-shell', value: shellExecutable, disabled, style: control, required: true,
|
|
120
|
+
onChange: event => { changed(); setShellExecutable(event.target.value); } }),
|
|
121
|
+
h('p', null, t('bashPathHint'))) : showShell ? h(React.Fragment, null,
|
|
108
122
|
h('label', { htmlFor: 'deep-ptc-shell' }, t('shell')),
|
|
109
123
|
h('select', { id: 'deep-ptc-shell', value: shellExecutable, disabled, style: control,
|
|
110
124
|
onChange: event => { changed(); setShellExecutable(event.target.value); } },
|
|
@@ -114,7 +128,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
114
128
|
h('p', null, t('sessions')),
|
|
115
129
|
!state.writable ? h('p', { role: 'status' }, t('readOnly')) : null,
|
|
116
130
|
message ? h('p', { role: failed ? 'alert' : 'status' }, message) : null,
|
|
117
|
-
h('button', { type: 'submit', disabled
|
|
131
|
+
h('button', { type: 'submit', disabled: disabled || (windowsBash && !shellExecutable.trim()),
|
|
132
|
+
style: { justifySelf: 'start', padding: '7px 16px' } }, t(saving ? 'saving' : 'save')),
|
|
118
133
|
);
|
|
119
134
|
}
|
|
120
135
|
|
|
@@ -138,12 +153,18 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
138
153
|
try {
|
|
139
154
|
const outcome = await reset();
|
|
140
155
|
if (current !== generation.current) return;
|
|
141
|
-
if (outcome?.ok === false) throw new Error(outcome.error?.message
|
|
156
|
+
if (outcome?.ok === false) throw new Error(outcome.error?.message);
|
|
142
157
|
const reply = outcome?.ok === true ? outcome.value : outcome;
|
|
158
|
+
if (reply === undefined) throw new Error(t('toolResetUnavailable'));
|
|
143
159
|
const result = reply?.result ?? reply;
|
|
144
|
-
if (result?.kind !== 'success') throw new Error(result?.text
|
|
160
|
+
if (result?.kind !== 'success') throw new Error(result?.text);
|
|
145
161
|
setMessage(t('toolResetDone'));
|
|
146
|
-
} catch (error) {
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (current === generation.current) {
|
|
164
|
+
const detail = String(error?.message ?? error ?? '').slice(0, 220);
|
|
165
|
+
setMessage(detail ? `${t('toolResetFailed')} ${detail}` : t('toolResetFailed'));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
147
168
|
finally { if (current === generation.current) setBusy(false); }
|
|
148
169
|
}
|
|
149
170
|
return h('section', { className: 'dpt-side-section dpt-side-tools', 'aria-label': t('toolsSection') },
|
|
@@ -158,13 +179,21 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
158
179
|
message || t('toolResetHint')));
|
|
159
180
|
}
|
|
160
181
|
Object.assign(dictionaries.zh, {
|
|
182
|
+
visualEffects: '界面特效', visualEffectsHint: '使用外部主题或 UI 插件时,建议关闭此开关。',
|
|
183
|
+
jobsTitle: '后台任务', jobsEmpty: '本会话暂无后台任务。', jobsMore: '另有 {count} 个任务',
|
|
184
|
+
jobRunning: '运行中', jobStopping: '正在停止', jobCompleted: '已完成', jobKilled: '已取消', jobFailed: '已失败',
|
|
161
185
|
toolReset: '重载所有工具状态', toolResetBusy: '正在重载…', toolResetDone: '本对话工具状态已重载。',
|
|
162
|
-
toolResetFailed: '
|
|
186
|
+
toolResetFailed: '未能重载工具状态。', toolResetUnavailable: '当前会话无法调用工具重载命令。',
|
|
187
|
+
toolResetHint: '清除本对话的故障标记和按需加载选择;正在运行的任务继续执行。',
|
|
163
188
|
toolFailures: '工具适配提醒', toolFailureHint: '以下外部工具调用失败,可能存在适配问题,已在本对话中禁用。任务会优先使用其他可用工具;未进一步排查故障原因。',
|
|
164
189
|
});
|
|
165
190
|
Object.assign(dictionaries.en, {
|
|
191
|
+
visualEffects: 'Visual effects', visualEffectsHint: 'Keep this off when using an external theme or UI plugin.',
|
|
192
|
+
jobsTitle: 'Background jobs', jobsEmpty: 'No background jobs in this conversation.', jobsMore: '{count} more jobs',
|
|
193
|
+
jobRunning: 'Running', jobStopping: 'Stopping', jobCompleted: 'Completed', jobKilled: 'Canceled', jobFailed: 'Failed',
|
|
166
194
|
toolReset: 'Reload all tool states', toolResetBusy: 'Reloading…', toolResetDone: 'Tool states reloaded for this conversation.',
|
|
167
|
-
toolResetFailed: '
|
|
195
|
+
toolResetFailed: 'Could not reload tool states.', toolResetUnavailable: 'The reload command is unavailable in this conversation.',
|
|
196
|
+
toolResetHint: 'Clear quarantine and on-demand selections in this conversation. Running jobs continue.',
|
|
168
197
|
toolFailures: 'Tool compatibility notice', toolFailureHint: 'These external tools failed and may have compatibility issues. They are disabled in this conversation. Continue with working alternatives; no root-cause investigation was performed.',
|
|
169
198
|
});
|
|
170
199
|
Object.assign(dictionaries.zh, {
|
|
@@ -291,9 +320,19 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
|
|
|
291
320
|
.dpt-agent:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
|
|
292
321
|
.dpt-agent:disabled{cursor:default}
|
|
293
322
|
.dpt-agent-dot{flex:none;width:8px;height:8px;margin-top:6px;border-radius:50%;background:var(--dsw-alias-label-tertiary,#98a2b3)}
|
|
294
|
-
.dpt-agent[data-state="running"] .dpt-agent-dot,.dpt-agents-pill[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff)
|
|
323
|
+
.dpt-agent[data-state="running"] .dpt-agent-dot,.dpt-agents-pill[data-state="running"] .dpt-agent-dot,.dpt-job[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff)}
|
|
324
|
+
${ON} .dpt-agents-pill[data-state="running"] .dpt-agent-dot,${ON} .dpt-agent[data-state="running"] .dpt-agent-dot{animation:dpt-dot-flash 1.2s ease-in-out infinite}
|
|
295
325
|
@keyframes dpt-dot-flash{0%,100%{opacity:1;box-shadow:0 0 4px 1px color-mix(in srgb,var(--dpt-accent,#3370ff) 55%,transparent)}50%{opacity:.35;box-shadow:0 0 10px 3px color-mix(in srgb,var(--dpt-accent,#3370ff) 75%,transparent)}}
|
|
296
326
|
.dpt-agent[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
|
|
327
|
+
.dpt-job[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
|
|
328
|
+
.dpt-job[data-state="stopping"] .dpt-agent-dot,.dpt-job[data-state="killed"] .dpt-agent-dot{background:var(--dsw-alias-state-warn-primary,#b45309)}
|
|
329
|
+
.dpt-job[data-state="failed"] .dpt-agent-dot{background:var(--dsw-alias-state-error-primary,#c4321f)}
|
|
330
|
+
.dpt-side-effects .dpt-side-label{align-items:center}
|
|
331
|
+
.dpt-jobs-list{display:grid;gap:4px;list-style:none;padding:0;margin:0}
|
|
332
|
+
.dpt-job,.dpt-jobs-more{padding:5px 6px;border-radius:6px;background:var(--dpt-surface-soft,var(--dsw-alias-fill-secondary,transparent))}
|
|
333
|
+
.dpt-job{display:flex;align-items:flex-start;gap:7px}
|
|
334
|
+
.dpt-jobs-more summary{cursor:pointer;font-size:11px;line-height:16px}
|
|
335
|
+
.dpt-jobs-more .dpt-jobs-list{margin-top:4px}
|
|
297
336
|
.dpt-agent-main{flex:1;min-width:0;display:flex;flex-direction:column}
|
|
298
337
|
.dpt-agent-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
299
338
|
.dpt-agent-meta{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#667085);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
@@ -410,7 +449,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
410
449
|
@keyframes dpt-pop{from{opacity:0;transform:translateY(8px) scale(0.98)}to{opacity:1;transform:none}}
|
|
411
450
|
.dpt-ripple{position:fixed;z-index:2147483000;pointer-events:none;width:20px;height:20px;margin:-10px 0 0 -10px;border-radius:50%;border:2px solid color-mix(in srgb,var(--dpt-brand,#3370ff) 75%,transparent);background:radial-gradient(circle,color-mix(in srgb,var(--dpt-brand,#3370ff) 45%,transparent),color-mix(in srgb,var(--dpt-brand,#3370ff) 12%,transparent) 60%,transparent 72%);animation:dpt-ripple 650ms cubic-bezier(.22,1,.36,1) forwards}
|
|
412
451
|
@keyframes dpt-ripple{0%{transform:scale(.3);opacity:1}100%{transform:scale(7);opacity:0}}
|
|
413
|
-
.dpt-fx{position:fixed;inset:0;width:100vw;height:100vh;z-index:2147482000;pointer-events:none}
|
|
452
|
+
.dpt-fx{position:fixed;inset:0;width:100vw;height:100vh;z-index:2147482000;pointer-events:none;-webkit-app-region:initial!important}
|
|
414
453
|
@media (prefers-reduced-motion:reduce){
|
|
415
454
|
${ON} *,${ON} *::before,${ON} *::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important}
|
|
416
455
|
}
|
|
@@ -452,6 +491,27 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
452
491
|
},
|
|
453
492
|
};
|
|
454
493
|
const BUSY = { bridge: false, dom: false, was: false, timer: 0 };
|
|
494
|
+
const EFFECTS_KEY = `${PLUGIN}:visual-effects`;
|
|
495
|
+
function readEffects() {
|
|
496
|
+
try { return localStorage.getItem(EFFECTS_KEY) !== '0'; } catch { return true; }
|
|
497
|
+
}
|
|
498
|
+
let effectsEnabled = readEffects();
|
|
499
|
+
const effectListeners = new Set();
|
|
500
|
+
const getEffects = () => effectsEnabled;
|
|
501
|
+
function subscribeEffects(listener) {
|
|
502
|
+
effectListeners.add(listener);
|
|
503
|
+
return () => effectListeners.delete(listener);
|
|
504
|
+
}
|
|
505
|
+
function setEffects(enabled) {
|
|
506
|
+
if (effectsEnabled === enabled) return;
|
|
507
|
+
effectsEnabled = enabled;
|
|
508
|
+
for (const listener of effectListeners) listener();
|
|
509
|
+
}
|
|
510
|
+
function toggleEffects() {
|
|
511
|
+
const enabled = !effectsEnabled;
|
|
512
|
+
try { localStorage.setItem(EFFECTS_KEY, enabled ? '1' : '0'); } catch { /* use the in-memory preference */ }
|
|
513
|
+
setEffects(enabled);
|
|
514
|
+
}
|
|
455
515
|
// The standalone dsh-refined-ui draws the same look; never stack both.
|
|
456
516
|
const refinedPresent = () => typeof document !== 'undefined' && document.querySelector('style[data-plugin="dsh-refined-ui"]') !== null;
|
|
457
517
|
const uiOn = () => typeof document !== 'undefined' && document.body?.hasAttribute('data-dpt-ui');
|
|
@@ -459,7 +519,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
459
519
|
if (typeof document === 'undefined') return;
|
|
460
520
|
const busy = uiOn() && (BUSY.bridge || BUSY.dom);
|
|
461
521
|
document.body.toggleAttribute('data-dpt-busy', busy);
|
|
462
|
-
if (BUSY.was && !busy) {
|
|
522
|
+
if (BUSY.was && !busy && uiOn()) {
|
|
463
523
|
const card = document.querySelector('[data-dpt-composer]');
|
|
464
524
|
if (card) {
|
|
465
525
|
card.setAttribute('data-dpt-done', '');
|
|
@@ -471,23 +531,43 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
471
531
|
}
|
|
472
532
|
function watchActiveSession() {
|
|
473
533
|
if (typeof document === 'undefined') return () => {};
|
|
534
|
+
let stopVisuals;
|
|
535
|
+
function disableVisuals() {
|
|
536
|
+
if (!stopVisuals) return;
|
|
537
|
+
clearTimeout(BUSY.timer);
|
|
538
|
+
document.querySelectorAll('[data-dpt-done]').forEach(node => node.removeAttribute('data-dpt-done'));
|
|
539
|
+
stopVisuals();
|
|
540
|
+
stopVisuals = undefined;
|
|
541
|
+
}
|
|
474
542
|
const update = () => {
|
|
475
543
|
const current = SESSIONS.current();
|
|
476
|
-
const on = current?.preset === 'deep-ptc' && !refinedPresent();
|
|
544
|
+
const on = effectsEnabled && current?.preset === 'deep-ptc' && !refinedPresent();
|
|
477
545
|
document.body.toggleAttribute('data-dpt-ui', on);
|
|
478
546
|
// Like dsh-refined-ui, a running subagent keeps the conversation working.
|
|
479
547
|
BUSY.bridge = on && (current?.busy === true || SESSIONS.working.get(current?.id) === true);
|
|
480
548
|
applyBusy();
|
|
549
|
+
if (on && !stopVisuals) {
|
|
550
|
+
const cleanups = [watchSurfaces(), watchPalette(), watchInteractions(), watchFx()];
|
|
551
|
+
stopVisuals = () => cleanups.reverse().forEach(cleanup => cleanup());
|
|
552
|
+
} else if (!on) disableVisuals();
|
|
481
553
|
};
|
|
482
554
|
SESSIONS.subs.add(update);
|
|
555
|
+
const unsubscribe = subscribeEffects(update);
|
|
556
|
+
const sync = event => { if (event.key === EFFECTS_KEY || event.key === null) setEffects(readEffects()); };
|
|
557
|
+
window.addEventListener('storage', sync);
|
|
483
558
|
// Visibility changes without a remount (split views, tab switches) are caught here.
|
|
484
559
|
const timer = setInterval(update, 1000);
|
|
485
560
|
update();
|
|
486
561
|
return () => {
|
|
487
562
|
SESSIONS.subs.delete(update);
|
|
563
|
+
unsubscribe();
|
|
564
|
+
window.removeEventListener('storage', sync);
|
|
488
565
|
clearInterval(timer);
|
|
489
566
|
document.body.removeAttribute('data-dpt-ui');
|
|
490
567
|
document.body.removeAttribute('data-dpt-busy');
|
|
568
|
+
BUSY.bridge = false;
|
|
569
|
+
BUSY.was = false;
|
|
570
|
+
disableVisuals();
|
|
491
571
|
};
|
|
492
572
|
}
|
|
493
573
|
|
|
@@ -496,7 +576,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
496
576
|
function watchSurfaces() {
|
|
497
577
|
if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return () => {};
|
|
498
578
|
const tagged = new Set();
|
|
499
|
-
const relativized = new
|
|
579
|
+
const relativized = new Map();
|
|
580
|
+
const highlighted = new Set();
|
|
500
581
|
let frame = 0;
|
|
501
582
|
const mark = (node, attribute) => { node.setAttribute(attribute, ''); tagged.add([node, attribute]); };
|
|
502
583
|
const findComposer = input => {
|
|
@@ -515,7 +596,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
515
596
|
card = findComposer(input);
|
|
516
597
|
if (!card) continue;
|
|
517
598
|
mark(card, 'data-dpt-composer');
|
|
518
|
-
if (getComputedStyle(card).position === 'static') {
|
|
599
|
+
if (getComputedStyle(card).position === 'static') {
|
|
600
|
+
relativized.set(card, [card.style.position, card.style.getPropertyPriority('position')]);
|
|
601
|
+
card.style.position = 'relative';
|
|
602
|
+
}
|
|
519
603
|
}
|
|
520
604
|
if (card.querySelector('[data-dpt-send]')) continue;
|
|
521
605
|
// The send button is the right-most button in the card.
|
|
@@ -546,6 +630,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
546
630
|
const rect = host.getBoundingClientRect();
|
|
547
631
|
host.style.setProperty('--dpt-mx', `${event.clientX - rect.left}px`);
|
|
548
632
|
host.style.setProperty('--dpt-my', `${event.clientY - rect.top}px`);
|
|
633
|
+
highlighted.add(host);
|
|
549
634
|
}
|
|
550
635
|
const run = () => {
|
|
551
636
|
frame = 0;
|
|
@@ -567,8 +652,13 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
567
652
|
applyBusy();
|
|
568
653
|
for (const [node, attribute] of tagged) node.removeAttribute(attribute);
|
|
569
654
|
tagged.clear();
|
|
570
|
-
for (const node of relativized)
|
|
571
|
-
|
|
655
|
+
for (const [node, [position, priority]] of relativized) {
|
|
656
|
+
if (node.style.position === 'relative') node.style.setProperty('position', position, priority);
|
|
657
|
+
}
|
|
658
|
+
for (const node of highlighted) {
|
|
659
|
+
node.style.removeProperty('--dpt-mx');
|
|
660
|
+
node.style.removeProperty('--dpt-my');
|
|
661
|
+
}
|
|
572
662
|
};
|
|
573
663
|
}
|
|
574
664
|
|
|
@@ -743,8 +833,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
743
833
|
|
|
744
834
|
// Send burst, completion sparkle and embers while the agent works.
|
|
745
835
|
function watchFx() {
|
|
746
|
-
if (typeof document === 'undefined' || typeof requestAnimationFrame === 'undefined'
|
|
747
|
-
|
|
836
|
+
if (typeof document === 'undefined' || typeof requestAnimationFrame === 'undefined' || typeof MutationObserver === 'undefined'
|
|
837
|
+
|| window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches === true) return () => {};
|
|
748
838
|
const canvas = document.createElement('canvas');
|
|
749
839
|
canvas.className = 'dpt-fx';
|
|
750
840
|
canvas.setAttribute('aria-hidden', 'true');
|
|
@@ -752,16 +842,18 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
752
842
|
if (!paint) return () => {};
|
|
753
843
|
document.body.appendChild(canvas);
|
|
754
844
|
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
755
|
-
let width = 0, height = 0, parts = [], raf = 0, lastEmber = 0
|
|
845
|
+
let width = 0, height = 0, parts = [], raf = 0, lastEmber = 0;
|
|
846
|
+
const fireworks = new Set();
|
|
756
847
|
const hues = ['#3370ff', '#5b8cff', '#7fd0ff', '#9dbcff', '#b48cff', '#ffffff'];
|
|
757
848
|
const busy = () => document.body.hasAttribute('data-dpt-busy');
|
|
849
|
+
let wasBusy = busy();
|
|
758
850
|
function resize() {
|
|
759
851
|
width = window.innerWidth; height = window.innerHeight;
|
|
760
852
|
canvas.width = width * dpr; canvas.height = height * dpr;
|
|
761
853
|
paint.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
762
854
|
}
|
|
763
855
|
function burst(x, y, count, power) {
|
|
764
|
-
if (
|
|
856
|
+
if (!uiOn()) return;
|
|
765
857
|
for (let index = 0; index < count; index++) {
|
|
766
858
|
const angle = Math.random() * Math.PI * 2, speed = (0.4 + Math.random()) * power;
|
|
767
859
|
parts.push({ x, y, vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed - power * 0.35, life: 1,
|
|
@@ -777,7 +869,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
777
869
|
const composer = document.querySelector('[data-dpt-composer]');
|
|
778
870
|
const now = performance.now();
|
|
779
871
|
// Embers rise from the composer while the agent works: twice as often as dsh-refined-ui, slightly larger.
|
|
780
|
-
if (busy() &&
|
|
872
|
+
if (busy() && composer && now - lastEmber > 35) {
|
|
781
873
|
lastEmber = now;
|
|
782
874
|
const rect = composer.getBoundingClientRect();
|
|
783
875
|
parts.push({ x: rect.left + 12 + Math.random() * (rect.width - 24), y: rect.top + 2, vx: (Math.random() - 0.5) * 0.5,
|
|
@@ -827,8 +919,15 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
827
919
|
observer.observe(document.body, { attributes: true, attributeFilter: ['data-dpt-busy'] });
|
|
828
920
|
document.addEventListener('pointerdown', onDown, true);
|
|
829
921
|
document.addEventListener('keydown', onKey, true);
|
|
922
|
+
if (wasBusy) kick();
|
|
830
923
|
FX.burst = () => {
|
|
831
|
-
[[0.3, 0.45], [0.5, 0.3], [0.7, 0.45]].forEach(([x, y], index) =>
|
|
924
|
+
[[0.3, 0.45], [0.5, 0.3], [0.7, 0.45]].forEach(([x, y], index) => {
|
|
925
|
+
const timer = setTimeout(() => {
|
|
926
|
+
fireworks.delete(timer);
|
|
927
|
+
burst(width * x, height * y, 60, 5.6);
|
|
928
|
+
}, index * 220);
|
|
929
|
+
fireworks.add(timer);
|
|
930
|
+
});
|
|
832
931
|
};
|
|
833
932
|
return () => {
|
|
834
933
|
FX.burst = () => {};
|
|
@@ -837,6 +936,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
837
936
|
document.removeEventListener('keydown', onKey, true);
|
|
838
937
|
observer.disconnect();
|
|
839
938
|
if (raf) cancelAnimationFrame(raf);
|
|
939
|
+
for (const timer of fireworks) clearTimeout(timer);
|
|
840
940
|
canvas.remove();
|
|
841
941
|
};
|
|
842
942
|
}
|
|
@@ -887,6 +987,15 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
887
987
|
onClick: () => { if (!disabled) onChange(!on); } }, h('span', { className: 'dpt-switch-thumb', 'aria-hidden': 'true' }));
|
|
888
988
|
}
|
|
889
989
|
|
|
990
|
+
function VisualEffectsSection({ t }) {
|
|
991
|
+
const enabled = React.useSyncExternalStore(subscribeEffects, getEffects, getEffects);
|
|
992
|
+
const label = t('visualEffects');
|
|
993
|
+
return h('section', { className: 'dpt-side-section dpt-side-effects', 'aria-label': label },
|
|
994
|
+
h('div', { className: 'dpt-side-label' }, h('span', null, label),
|
|
995
|
+
h(SkillSwitch, { on: enabled, label, onChange: toggleEffects })),
|
|
996
|
+
h('p', { className: 'dpt-side-note' }, t('visualEffectsHint')));
|
|
997
|
+
}
|
|
998
|
+
|
|
890
999
|
function SkillCard({ turn, useProjection, useChat, setSkill, setAll, t }) {
|
|
891
1000
|
const [busy, setBusy] = React.useState(false);
|
|
892
1001
|
const [expanded, setExpanded] = React.useState(false);
|
|
@@ -1048,7 +1157,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1048
1157
|
const NO_FORM = { status: 'unavailable' };
|
|
1049
1158
|
const noSubscribe = () => () => {};
|
|
1050
1159
|
const noSnapshot = () => NO_FORM;
|
|
1051
|
-
const allowedEnvironments = platform => platform === 'win32' ? ['auto', 'wsl', 'powershell'] : ['auto', 'zsh', 'bash'];
|
|
1160
|
+
const allowedEnvironments = platform => platform === 'win32' ? ['auto', 'wsl', 'powershell', 'bash'] : ['auto', 'zsh', 'bash'];
|
|
1052
1161
|
const effectiveEnvironment = (environment, platform) => environment !== 'auto' ? environment
|
|
1053
1162
|
: platform === 'win32' ? 'powershell' : platform === 'darwin' ? 'zsh' : 'bash';
|
|
1054
1163
|
const envLabel = (value, t) => value === 'auto' ? t('envAuto') : ENV_SHORT[value] ?? value;
|
|
@@ -1064,11 +1173,14 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1064
1173
|
const [saving, setSaving] = React.useState(false);
|
|
1065
1174
|
const [message, setMessage] = React.useState(null);
|
|
1066
1175
|
const [distribution, setDistribution] = React.useState(undefined);
|
|
1176
|
+
const [bashPath, setBashPath] = React.useState(undefined);
|
|
1067
1177
|
if (!form || state.status === 'unavailable') return null;
|
|
1068
1178
|
if (state.status !== 'ready' || !state.value) return h('section', { className: 'dpt-side-section' }, h('p', { className: 'dpt-side-note' }, t('loading')));
|
|
1069
1179
|
const value = state.value;
|
|
1070
1180
|
const platform = value.hostPlatform;
|
|
1071
1181
|
const environment = value.environment ?? 'auto';
|
|
1182
|
+
const editingBash = platform === 'win32' && (environment === 'bash' || bashPath !== undefined);
|
|
1183
|
+
const bashDraft = bashPath ?? value.shellExecutable ?? '';
|
|
1072
1184
|
const effective = effectiveEnvironment(environment, platform);
|
|
1073
1185
|
const choices = (Array.isArray(value.shellChoices) ? value.shellChoices : []).filter(item => item && typeof item.id === 'string');
|
|
1074
1186
|
const disabled = !state.writable || saving;
|
|
@@ -1087,6 +1199,12 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1087
1199
|
} finally { setSaving(false); }
|
|
1088
1200
|
}
|
|
1089
1201
|
function choose(next) {
|
|
1202
|
+
if (platform === 'win32' && next === 'bash') {
|
|
1203
|
+
if (environment !== 'bash') setBashPath('');
|
|
1204
|
+
setMessage(null);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
setBashPath(undefined);
|
|
1090
1208
|
if (next === environment) return;
|
|
1091
1209
|
const family = effectiveEnvironment(next, platform);
|
|
1092
1210
|
const current = choices.find(item => item.id === value.shellExecutable);
|
|
@@ -1101,17 +1219,33 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1101
1219
|
if (next === savedDistribution) { setDistribution(undefined); return; }
|
|
1102
1220
|
if (await save([{ op: 'set', path: ['wslDistribution'], value: next }], next ? `WSL (${next})` : 'WSL')) setDistribution(undefined);
|
|
1103
1221
|
}
|
|
1222
|
+
async function saveBash(event) {
|
|
1223
|
+
event.preventDefault();
|
|
1224
|
+
const next = bashDraft.trim();
|
|
1225
|
+
if (!next || (environment === 'bash' && next === value.shellExecutable)) return;
|
|
1226
|
+
if (await save([{ op: 'set', path: ['environment'], value: 'bash' },
|
|
1227
|
+
{ op: 'set', path: ['shellExecutable'], value: next }], 'Bash')) setBashPath(undefined);
|
|
1228
|
+
}
|
|
1104
1229
|
const familyChoices = choices.filter(item => item.family === effective);
|
|
1105
1230
|
return h('section', { className: 'dpt-side-section', 'aria-label': t('environment') },
|
|
1106
1231
|
h('div', { className: 'dpt-side-label' }, h('span', null, t('environment')), h('span', { className: 'dpt-side-hint' }, t('envForNew'))),
|
|
1107
1232
|
h('div', { className: 'dpt-seg', role: 'radiogroup', 'aria-label': t('environment') },
|
|
1108
1233
|
...allowedEnvironments(platform).map(option => h('button', { key: option, type: 'button', role: 'radio', className: 'dpt-seg-btn',
|
|
1109
|
-
'aria-checked': option ===
|
|
1110
|
-
|
|
1234
|
+
'aria-checked': option === (editingBash ? 'bash' : environment), disabled,
|
|
1235
|
+
title: t(platform === 'win32' && option === 'bash' ? 'windowsBash' : option),
|
|
1236
|
+
onClick: () => choose(option) }, envLabel(option, t)))),
|
|
1237
|
+
editingBash ? h(React.Fragment, null,
|
|
1238
|
+
h('form', { className: 'dpt-field', onSubmit: saveBash },
|
|
1239
|
+
h('input', { className: 'dpt-input', value: bashDraft, disabled, placeholder: t('bashPath'), 'aria-label': t('bashPath'),
|
|
1240
|
+
onChange: event => { setBashPath(event.target.value); setMessage(null); } }),
|
|
1241
|
+
(environment !== 'bash' || bashDraft.trim() !== value.shellExecutable)
|
|
1242
|
+
? h('button', { type: 'submit', className: 'dpt-btn', disabled: disabled || !bashDraft.trim() }, t('save')) : null),
|
|
1243
|
+
h('p', { className: 'dpt-side-note' }, t('bashPathHint'))) : null,
|
|
1244
|
+
!editingBash && effective === 'wsl' ? h('form', { className: 'dpt-field', onSubmit: saveDistribution },
|
|
1111
1245
|
h('input', { className: 'dpt-input', value: draft, disabled, placeholder: t('envDefaultDistribution'), 'aria-label': t('distribution'),
|
|
1112
1246
|
title: t('distributionHint'), onChange: event => { setDistribution(event.target.value); setMessage(null); } }),
|
|
1113
1247
|
draft.trim() !== savedDistribution ? h('button', { type: 'submit', className: 'dpt-btn', disabled }, t('save')) : null) : null,
|
|
1114
|
-
effective !== 'wsl' && familyChoices.length > 0 ? h('div', { className: 'dpt-field' },
|
|
1248
|
+
!editingBash && effective !== 'wsl' && familyChoices.length > 0 ? h('div', { className: 'dpt-field' },
|
|
1115
1249
|
h('select', { className: 'dpt-select', value: value.shellExecutable ?? '', disabled, 'aria-label': t('shell'), title: t('shellHint'),
|
|
1116
1250
|
onChange: event => { const item = familyChoices.find(choice => choice.id === event.target.value);
|
|
1117
1251
|
void save([{ op: 'set', path: ['shellExecutable'], value: event.target.value }], item ? item.label : t('shellAuto')); } },
|
|
@@ -1120,7 +1254,58 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1120
1254
|
message ? message.text : !state.writable ? t('readOnly') : environment === 'auto' ? tf(t, 'envAutoNow', { env: envLabel(effective, t) }) : t('envThisSession')));
|
|
1121
1255
|
}
|
|
1122
1256
|
|
|
1123
|
-
|
|
1257
|
+
const JOB_STATUS = new Map([
|
|
1258
|
+
['running', 'jobRunning'], ['stopping', 'jobStopping'], ['completed', 'jobCompleted'],
|
|
1259
|
+
['killed', 'jobKilled'], ['failed', 'jobFailed'],
|
|
1260
|
+
]);
|
|
1261
|
+
const JOB_PREVIEW_LIMIT = 6;
|
|
1262
|
+
const ACTIVE_JOB_LIMIT = 5;
|
|
1263
|
+
const FINISHED_JOB_LIMIT = 3;
|
|
1264
|
+
|
|
1265
|
+
function BackgroundJobs({ jobs, t }) {
|
|
1266
|
+
const active = [];
|
|
1267
|
+
const finished = [];
|
|
1268
|
+
for (const job of jobs ?? []) {
|
|
1269
|
+
if (job.status === 'running' || job.status === 'stopping') active.push(job);
|
|
1270
|
+
else if (JOB_STATUS.has(job.status)) finished.push(job);
|
|
1271
|
+
}
|
|
1272
|
+
active.sort((left, right) => left.startedAt - right.startedAt);
|
|
1273
|
+
finished.sort((left, right) =>
|
|
1274
|
+
(right.finishedAt ?? right.startedAt) - (left.finishedAt ?? left.startedAt) || left.startedAt - right.startedAt);
|
|
1275
|
+
|
|
1276
|
+
const eligible = [...active.slice(0, ACTIVE_JOB_LIMIT), ...finished.slice(0, FINISHED_JOB_LIMIT)];
|
|
1277
|
+
const total = active.length + finished.length;
|
|
1278
|
+
// Overflow itself occupies one of the six positions, including overflow from either status cap.
|
|
1279
|
+
const hasOverflow = total > eligible.length || total > JOB_PREVIEW_LIMIT;
|
|
1280
|
+
const visibleLimit = hasOverflow ? JOB_PREVIEW_LIMIT - 1 : JOB_PREVIEW_LIMIT;
|
|
1281
|
+
const visible = eligible.slice(0, visibleLimit);
|
|
1282
|
+
const hidden = visible.length < total ? [...active, ...finished].filter(job => !visible.includes(job)) : [];
|
|
1283
|
+
const row = job => {
|
|
1284
|
+
const label = job.label || job.kind || job.id;
|
|
1285
|
+
return h('li', { key: job.id, className: 'dpt-job', 'data-state': job.status },
|
|
1286
|
+
h('span', { className: 'dpt-agent-dot', 'aria-hidden': 'true' }),
|
|
1287
|
+
h('span', { className: 'dpt-agent-main' },
|
|
1288
|
+
h('span', { className: 'dpt-agent-name', title: label }, label),
|
|
1289
|
+
h('span', { className: 'dpt-agent-meta' }, t(JOB_STATUS.get(job.status)))));
|
|
1290
|
+
};
|
|
1291
|
+
const title = t('jobsTitle');
|
|
1292
|
+
return h('section', { className: 'dpt-side-section', 'aria-label': title },
|
|
1293
|
+
h('div', { className: 'dpt-side-label' }, h('span', null, title)),
|
|
1294
|
+
total ? h('ul', { className: 'dpt-jobs-list' }, ...visible.map(row),
|
|
1295
|
+
hidden.length ? h('li', { className: 'dpt-jobs-more' },
|
|
1296
|
+
h('details', null, h('summary', null, tf(t, 'jobsMore', { count: hidden.length })),
|
|
1297
|
+
h('ul', { className: 'dpt-jobs-list' }, ...hidden.map(row)))) : null)
|
|
1298
|
+
: h('p', { className: 'dpt-side-note' }, t('jobsEmpty')));
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Desktop RCs expose the jobs roster through a dedicated service. Other hosts include it in sessions.
|
|
1302
|
+
function LiveBackgroundJobs({ sessionId, useJobs, watchJobs, t }) {
|
|
1303
|
+
const jobs = useJobs(state => state.rows[sessionId]);
|
|
1304
|
+
React.useEffect(() => watchJobs(sessionId), [sessionId, watchJobs]);
|
|
1305
|
+
return h(BackgroundJobs, { jobs, t });
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function SidePanel({ sessionId, useSessions, useProjection, useJobs, watchJobs, reset, form, t }) {
|
|
1124
1309
|
const sessions = typeof useSessions === 'function' ? useSessions(state => state) : undefined;
|
|
1125
1310
|
let tools;
|
|
1126
1311
|
try { tools = typeof useProjection === 'function' ? useProjection('deepPtcTools') : undefined; } catch { tools = undefined; }
|
|
@@ -1135,7 +1320,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1135
1320
|
const running = rows.filter(row => row.state === 'running').length;
|
|
1136
1321
|
const completed = rows.filter(row => row.state === 'completed').length;
|
|
1137
1322
|
const hasEnvironment = !!form && settings.status !== 'unavailable';
|
|
1138
|
-
const layout = useChatRegion(sessionId,
|
|
1323
|
+
const layout = useChatRegion(sessionId, canPortal());
|
|
1139
1324
|
const docked = !!layout && layout.wide && !collapsed;
|
|
1140
1325
|
React.useEffect(() => {
|
|
1141
1326
|
if (running === 0) return undefined;
|
|
@@ -1159,7 +1344,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1159
1344
|
};
|
|
1160
1345
|
return () => { PANEL.toggle = () => {}; };
|
|
1161
1346
|
}, [layout?.wide]);
|
|
1162
|
-
if (!layout ||
|
|
1347
|
+
if (!layout || !canPortal()) return null;
|
|
1163
1348
|
const position = { top: `${layout.top}px`, right: `${layout.right}px` };
|
|
1164
1349
|
const summary = [running ? tf(t, 'agentsRunning', { count: running }) : null, completed ? tf(t, 'agentsCompleted', { count: completed }) : null,
|
|
1165
1350
|
rows.length - running - completed > 0 ? tf(t, 'agentsIdle', { count: rows.length - running - completed }) : null].filter(Boolean).join(' · ');
|
|
@@ -1185,6 +1370,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1185
1370
|
h('path', { d: 'M6 4l4 4-4 4', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round' })))),
|
|
1186
1371
|
h('div', { className: 'dpt-side-body' },
|
|
1187
1372
|
hasEnvironment ? h(EnvironmentSection, { form, t }) : null,
|
|
1373
|
+
h(VisualEffectsSection, { t }),
|
|
1188
1374
|
rows.length ? h('section', { className: 'dpt-side-section dpt-side-agents', 'aria-label': t('agentsTitle') },
|
|
1189
1375
|
h('div', { className: 'dpt-side-label' }, h('span', null, t('agentsTitle')), h('span', { className: 'dpt-side-hint', title: summary }, summary)),
|
|
1190
1376
|
h('ol', { className: 'dpt-agents-list' }, ...rows.map(row => {
|
|
@@ -1196,6 +1382,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1196
1382
|
h('span', { className: 'dpt-agent-main' }, h('span', { className: 'dpt-agent-name', title: row.label }, row.label),
|
|
1197
1383
|
h('span', { className: 'dpt-agent-meta' }, meta))));
|
|
1198
1384
|
}))) : null,
|
|
1385
|
+
typeof useJobs === 'function' && typeof watchJobs === 'function'
|
|
1386
|
+
? h(LiveBackgroundJobs, { key: sessionId, sessionId, useJobs, watchJobs, t })
|
|
1387
|
+
: h(BackgroundJobs, { key: sessionId, jobs: sessions?.jobsBySession?.[sessionId], t }),
|
|
1199
1388
|
hasTools ? h(ToolStateControls, { sessionId, useProjection, reset, t }) : null)), document.body);
|
|
1200
1389
|
}
|
|
1201
1390
|
|
|
@@ -1250,10 +1439,6 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1250
1439
|
ctx.effect(() => ctx.locale.register('deep-ptc', dictionaries));
|
|
1251
1440
|
ctx.effect(() => injectCss(), `${PLUGIN}: style`);
|
|
1252
1441
|
ctx.effect(() => watchActiveSession(), `${PLUGIN}: active session`);
|
|
1253
|
-
ctx.effect(() => watchSurfaces(), `${PLUGIN}: surface tags`);
|
|
1254
|
-
ctx.effect(() => watchPalette(), `${PLUGIN}: command palette`);
|
|
1255
|
-
ctx.effect(() => watchInteractions(), `${PLUGIN}: interactions`);
|
|
1256
|
-
ctx.effect(() => watchFx(), `${PLUGIN}: effects`);
|
|
1257
1442
|
ctx.effect(() => watchDiagnostics(), `${PLUGIN}: diagnostics`);
|
|
1258
1443
|
const form = ctx.configForms.get(NS);
|
|
1259
1444
|
ctx.effect(() => ctx.configForms.whileServed([NS], () =>
|
|
@@ -1287,13 +1472,21 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1287
1472
|
// The side card draws beside the conversation through a portal; nothing shows under the composer.
|
|
1288
1473
|
child.slots.inject('conversation.composer.dock', () => child.slots.register({
|
|
1289
1474
|
name: 'conversation.composer.dock', id: 'deep-ptc-side', order: 89,
|
|
1290
|
-
inject: sessionId =>
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1475
|
+
inject: sessionId => {
|
|
1476
|
+
const jobs = child.get?.('jobs');
|
|
1477
|
+
const props = {
|
|
1478
|
+
reset: () => {
|
|
1479
|
+
const execute = child.remote?.commands?.execute;
|
|
1480
|
+
if (typeof execute !== 'function') return Promise.resolve({ ok: false, error: { message: 'unavailable' } });
|
|
1481
|
+
return execute(sessionId, '/deep-ptc-reset-tools', []);
|
|
1482
|
+
},
|
|
1483
|
+
};
|
|
1484
|
+
if (jobs?.state && typeof jobs.watchRows === 'function') {
|
|
1485
|
+
props.hooks = { jobs: jobs.state };
|
|
1486
|
+
props.watchJobs = id => jobs.watchRows(id);
|
|
1487
|
+
}
|
|
1488
|
+
return props;
|
|
1489
|
+
},
|
|
1297
1490
|
}, props => h(SideCardHost, { ...props, form, t })));
|
|
1298
1491
|
} catch { /* the composer stays usable when this slot cannot register */ }
|
|
1299
1492
|
});
|
package/lib/creative.mjs
CHANGED
|
@@ -35,18 +35,6 @@ function walk(rows, visit) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function idsOf(rows) {
|
|
39
|
-
const ids = new Set();
|
|
40
|
-
walk(rows, row => { if (typeof row.id === 'string') ids.add(row.id); });
|
|
41
|
-
return ids;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function rowById(rows, id) {
|
|
45
|
-
let found;
|
|
46
|
-
walk(rows, row => { if (found === undefined && row.id === id) found = row; });
|
|
47
|
-
return found;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
38
|
function pinDir(entry, root) {
|
|
51
39
|
if (!root || !entry || typeof entry !== 'object' || typeof entry.__jsExpr !== 'string') return entry;
|
|
52
40
|
if (!entry.__jsExpr.includes('baseUrl') || !entry.__jsExpr.includes('skills')) return entry;
|
|
@@ -69,26 +57,18 @@ function withPinnedSkillDirs(row, root) {
|
|
|
69
57
|
}
|
|
70
58
|
|
|
71
59
|
/**
|
|
72
|
-
*
|
|
73
|
-
* Baseline rows stay as they are: official PTC remains the fallback.
|
|
60
|
+
* Collect creative-only rows and merge shared skill directories into the existing provider.
|
|
74
61
|
* @param {object[]} creativePlugins
|
|
75
|
-
* @param {object[]} baselinePlugins
|
|
62
|
+
* @param {object[]} baselinePlugins Writable copy of the PTC rows for this derivation.
|
|
76
63
|
* @param {{ root?: string }} [options] directory of the creative preset, used to pin skill paths
|
|
77
64
|
*/
|
|
78
65
|
export function creativeAdditions(creativePlugins, baselinePlugins, options = {}) {
|
|
79
66
|
const root = typeof options.root === 'string' ? options.root : '';
|
|
80
|
-
const
|
|
67
|
+
const baselineById = new Map();
|
|
68
|
+
walk(baselinePlugins, row => { if (typeof row.id === 'string') baselineById.set(row.id, row); });
|
|
81
69
|
const additions = [];
|
|
82
70
|
const seen = new Set();
|
|
83
71
|
|
|
84
|
-
const uniqueId = preferred => {
|
|
85
|
-
if (!baselineIds.has(preferred) && !seen.has(preferred)) return preferred;
|
|
86
|
-
for (let suffix = 2; ; suffix += 1) {
|
|
87
|
-
const candidate = `${preferred}-${suffix}`;
|
|
88
|
-
if (!baselineIds.has(candidate) && !seen.has(candidate)) return candidate;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
72
|
const push = row => {
|
|
93
73
|
if (!row || seen.has(row.id)) return;
|
|
94
74
|
seen.add(row.id);
|
|
@@ -97,24 +77,25 @@ export function creativeAdditions(creativePlugins, baselinePlugins, options = {}
|
|
|
97
77
|
|
|
98
78
|
const consider = row => {
|
|
99
79
|
if (!row || typeof row !== 'object' || isPersona(row)) return;
|
|
80
|
+
const baseline = baselineById.get(row.id);
|
|
100
81
|
if (row.group === true) {
|
|
101
|
-
if (
|
|
82
|
+
if (baseline) {
|
|
102
83
|
if (Array.isArray(row.config)) for (const child of row.config) consider(child);
|
|
103
84
|
return;
|
|
104
85
|
}
|
|
105
86
|
push(withPinnedSkillDirs(row, root));
|
|
106
87
|
return;
|
|
107
88
|
}
|
|
108
|
-
if (
|
|
109
|
-
const baseline = rowById(baselinePlugins, row.id);
|
|
89
|
+
if (baseline) {
|
|
110
90
|
const creativeDirs = row.config?.customSkillDirs;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
91
|
+
if (baseline.group === true || !Array.isArray(creativeDirs) || !creativeDirs.length) return;
|
|
92
|
+
const current = baseline.config?.customSkillDirs ?? [];
|
|
93
|
+
if (!Array.isArray(current)) return;
|
|
94
|
+
const merged = [...current];
|
|
95
|
+
for (const dir of pinDirs(structuredClone(creativeDirs), root)) {
|
|
96
|
+
if (!merged.some(existing => sameDir(existing, dir))) merged.push(dir);
|
|
97
|
+
}
|
|
98
|
+
if (merged.length > current.length) baseline.config = { ...baseline.config, customSkillDirs: merged };
|
|
118
99
|
return;
|
|
119
100
|
}
|
|
120
101
|
push(withPinnedSkillDirs(row, root));
|
package/lib/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
2
|
import snapshot from './preset.json' with { type: 'json' };
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { CREATIVE_PRESET_ID } from './creative.mjs';
|
|
7
7
|
import { normalizePreferences } from './tool-policy.mjs';
|
|
8
8
|
import { availableEnvironments, BASE_SNAPSHOT, DEFAULT_FOREGROUND_SECONDS, deriveDeepPtc, normalizeDistribution, resolveEnvironment } from './model.mjs';
|
|
9
|
-
import { discoverShells, resolveShellExecutable, shellNote } from './shells.mjs';
|
|
9
|
+
import { discoverShells, resolveShellExecutable, resolveWindowsBash, shellNote } from './shells.mjs';
|
|
10
10
|
import { BASE_DECLARATION_SPECIFIER, creativePresetUrl, loadCreativePreset, loadCurrentPreset, officialPresetUrl, parseOfficialExecutors } from './upstream.mjs';
|
|
11
11
|
import { importHost, pluginOf, resolveHost } from './host.mjs';
|
|
12
12
|
import { presetLifecycle } from './lifecycle.mjs';
|
|
@@ -122,8 +122,13 @@ async function buildPreset(ctx, config, safeMode) {
|
|
|
122
122
|
const family = shellFamily(environment);
|
|
123
123
|
if (family) {
|
|
124
124
|
const requested = typeof settings.shellExecutable === 'string' ? settings.shellExecutable : '';
|
|
125
|
-
const
|
|
126
|
-
|
|
125
|
+
const windowsBash = process.platform === 'win32' && environment === 'bash';
|
|
126
|
+
const resolved = windowsBash ? resolveWindowsBash(requested, path => {
|
|
127
|
+
try { return statSync(path, { throwIfNoEntry: false })?.isFile() === true; } catch { return false; }
|
|
128
|
+
}) : resolveShellExecutable(requested, { family, discovered: discoveredShells, exists: existsSync });
|
|
129
|
+
if (windowsBash && !resolved) {
|
|
130
|
+
ctx.logger.warn('Deep PTC: Windows Bash requires an available absolute path to bash.exe; retaining the official shell rows');
|
|
131
|
+
} else if (requested && requested !== 'auto' && !resolved) {
|
|
127
132
|
ctx.logger.warn('Deep PTC: selected shell %s is not available; using the automatic executable', requested);
|
|
128
133
|
}
|
|
129
134
|
settings.shellExecutable = resolved;
|
package/lib/model.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { normalizePreferences } from './tool-policy.mjs';
|
|
|
14
14
|
export const ENVIRONMENTS = ['auto', 'wsl', 'powershell', 'zsh', 'bash'];
|
|
15
15
|
|
|
16
16
|
export function availableEnvironments(platform) {
|
|
17
|
-
return platform === 'win32' ? ['auto', 'wsl', 'powershell'] : ['auto', 'zsh', 'bash'];
|
|
17
|
+
return platform === 'win32' ? ['auto', 'wsl', 'powershell', 'bash'] : ['auto', 'zsh', 'bash'];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function resolveEnvironment(environment = 'auto', platform = process.platform) {
|
|
@@ -48,18 +48,23 @@ export function shellArgv(environment, spec, distribution = '', platform = proce
|
|
|
48
48
|
throw new Error(`No mapped executor for ${environment}`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export function assertExecutionPolicy(environment, policy) {
|
|
51
|
+
export function assertExecutionPolicy(environment, policy, platform = process.platform) {
|
|
52
52
|
if (environment === 'wsl' && policy?.mode !== 'danger-full-access') {
|
|
53
53
|
throw new Error('WSL execution is not supported under a confined Windows sandbox. Select PowerShell for confined work, or use the host\'s existing approval flow for this exact command. No command was executed.');
|
|
54
54
|
}
|
|
55
|
+
if (environment === 'bash' && platform === 'win32' && policy?.mode !== 'danger-full-access') {
|
|
56
|
+
throw new Error('Native Bash is unavailable under a confined Windows sandbox. Select PowerShell for confined work. No command was executed.');
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
export function environmentText(environment, distribution = '', note = '') {
|
|
60
|
+
export function environmentText(environment, distribution = '', note = '', platform = process.platform) {
|
|
58
61
|
const descriptions = {
|
|
59
62
|
wsl: `Execution environment: WSL Bash${distribution ? ` (${distribution})` : ' (Windows default distribution)'}. The bash tool runs POSIX source via wsl.exe and bash -lc. File tools and the tool workdir use Windows host paths; Linux paths belong inside command source. WSL is available only in danger-full-access; a confined call fails without execution. Never silently fall back to PowerShell or another distribution.`,
|
|
60
63
|
powershell: 'Execution environment: native Windows PowerShell. Use the pwsh tool and PowerShell syntax, native Windows paths and $env:NAME. This selection takes precedence over older workspace guidance that assumed WSL. The configured sandbox and approval policy still apply.',
|
|
61
64
|
zsh: 'Execution environment: native Zsh. Use the zsh tool with Zsh/POSIX command source. On macOS the executor is /bin/zsh -lc; elsewhere zsh must be installed. File tools and workdir use native host paths. The configured sandbox and approval policy still apply.',
|
|
62
|
-
bash:
|
|
65
|
+
bash: platform === 'win32'
|
|
66
|
+
? 'Execution environment: native Windows Bash. Use the bash tool with Bash/POSIX command source and Windows host paths for the tool workdir. Confined calls fail without execution. Select PowerShell for confined work.'
|
|
67
|
+
: 'Execution environment: native Bash. Use the bash tool with Bash/POSIX command source and native host paths. The configured sandbox and approval policy still apply.',
|
|
63
68
|
};
|
|
64
69
|
if (!descriptions[environment]) throw new Error(`Unknown environment ${environment}`);
|
|
65
70
|
return typeof note === 'string' && note !== '' ? `${descriptions[environment]}\n${note}` : descriptions[environment];
|
|
@@ -247,7 +252,8 @@ export function deriveDeepPtc(upstream, options = {}, platform = process.platfor
|
|
|
247
252
|
const official = executors[kind];
|
|
248
253
|
const shellPath = chosenExecutable(environment, options.shellExecutable);
|
|
249
254
|
const mapped = environment === 'wsl' || environment === 'zsh' || (environment === 'bash' && shellPath !== '');
|
|
250
|
-
const unusable =
|
|
255
|
+
const unusable = environment === 'bash' && platform === 'win32' && shellPath === '' ? 'Windows native Bash needs an available bash.exe'
|
|
256
|
+
: tool === undefined ? `the official PTC preset has no ${kind} tool row`
|
|
251
257
|
: typeof official?.name !== 'string' ? `the installed Harness declares no ${kind} executor`
|
|
252
258
|
: mapped && options.mappedExecutor === false ? `the official bash executor cannot be extended for ${environment}`
|
|
253
259
|
: undefined;
|
|
@@ -338,13 +344,14 @@ export function deriveDeepPtc(upstream, options = {}, platform = process.platfor
|
|
|
338
344
|
if (options.pluginLab === true) {
|
|
339
345
|
const additions = creativeAdditions(options.creativePlugins, plugins, {
|
|
340
346
|
root: typeof options.creativeRoot === 'string' ? options.creativeRoot : '',
|
|
341
|
-
}).filter(row => !isHostRunner(row));
|
|
347
|
+
}).filter(row => !isHostRunner(row) && !isShellRow(row));
|
|
342
348
|
plugins.push(...additions);
|
|
343
349
|
plugins.push({ id: uniqueRowId(plugins, 'plugin-lab'), name: 'dsh-deep-ptc-mode/lab' });
|
|
344
350
|
report.pluginLab = additions.map(row => `${row.id} (${row.name})`);
|
|
345
351
|
}
|
|
346
352
|
|
|
347
|
-
const
|
|
353
|
+
const environmentLabel = environment === 'bash' && platform === 'win32' && unusable !== undefined ? '官方默认' : environment;
|
|
354
|
+
const description = `${PRESET_META.description} 当前环境:${environmentLabel}${environment === 'wsl' && distribution ? ` (${distribution})` : ''}`;
|
|
348
355
|
return {
|
|
349
356
|
preset: {
|
|
350
357
|
...upstream,
|
package/lib/shells.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// Filesystem probe for shell executables. Callers supply
|
|
1
|
+
// Filesystem probe for shell executables. Callers supply file checks; this module never spawns.
|
|
2
|
+
import { win32 } from 'node:path';
|
|
2
3
|
|
|
3
4
|
export const AUTO_SHELL = '';
|
|
4
5
|
|
|
@@ -93,6 +94,15 @@ export function resolveShellExecutable(value, { family, discovered, exists }) {
|
|
|
93
94
|
return '';
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
export function resolveWindowsBash(value, isFile) {
|
|
98
|
+
if (typeof value !== 'string') return '';
|
|
99
|
+
const path = value.trim();
|
|
100
|
+
const { root, base } = win32.parse(path);
|
|
101
|
+
// A single leading slash still depends on the caller's current drive.
|
|
102
|
+
if (!win32.isAbsolute(path) || root.length < 2 || base.toLowerCase() !== 'bash.exe' || /[\u0000-\u001f]/u.test(path)) return '';
|
|
103
|
+
return isFile(path) ? path : '';
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
function fileNameIs(filePath, name) {
|
|
97
107
|
const normalized = String(filePath).replace(/[\\/]+/gu, '/');
|
|
98
108
|
const slash = normalized.lastIndexOf('/');
|
package/lib/skill-card.mjs
CHANGED
|
File without changes
|
package/lib/skill-context.mjs
CHANGED
|
File without changes
|
package/lib/tool-state.mjs
CHANGED
|
File without changes
|
package/lib/upstream.mjs
CHANGED
|
File without changes
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-deep-ptc-mode",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.8.7",
|
|
4
|
+
"description": "Deep PTC agent mode for DSH with interruptible background jobs, selectable shells, and plugin-aware tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"dsh-plugin",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"cordis.patch.yml",
|
|
38
38
|
"lib",
|
|
39
|
+
"locale",
|
|
39
40
|
"compatibility.json",
|
|
40
41
|
"README.md",
|
|
41
42
|
"README.zh.md",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"./environment": "./lib/environment.mjs",
|
|
77
78
|
"./lab": "./lib/lab.mjs",
|
|
78
79
|
"./client": "./lib/client.js",
|
|
80
|
+
"./locale/*.json": "./locale/*.json",
|
|
79
81
|
"./package.json": "./package.json"
|
|
80
82
|
},
|
|
81
83
|
"scripts": {
|