dsh-deep-ptc-mode 1.8.5 → 1.8.6

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.6 — 2026-11-09
4
+
5
+ - 运行中的输入框泛蓝光:对话运行时输入框边框转蓝并持续呼吸发光。1.8.5 已移植这段动效,但发送后输入框处于聚焦状态,聚焦样式的 `!important` 阴影压过了动画,所以看不到;现在聚焦样式只在空闲时生效。
6
+ - 侧边卡片改为白底蓝点缀:底色与宿主一致(暗色主题跟随宿主深色),分割线与边框为浅灰色,只有选中的执行环境、按钮描边和子代理状态小方块用蓝色;文字与其他地方一样用宿主的黑色与灰色。
7
+ - 侧边卡片停靠时不再是悬浮卡片,而是从对话区右侧分出的一栏:贴住右边缘、上下通高,只留左侧分隔线;对话区让出这一栏的宽度,滚动条不会被遮住。窄屏收起的小胶囊点开后仍是悬浮卡片。
8
+ - 运行中的子代理只有行首的状态小方块闪烁蓝光,整行不发光;收起成小胶囊时也一样。系统开启“减少动态效果”时停止闪烁。
9
+ - 修复:子代理的运行状态改为同时参考会话列表里的实时状态。父会话的子代理目录只在打开官方下拉框时刷新,之前正在运行的子代理会显示为“空闲”。
10
+ - 官方声明的升级检测不再每 5 秒读一次:只在设置变更时,以及每个深度PTC对话创建或恢复、宿主确定预设之前确认一次;声明有变化时先重新派生,新对话直接用上最新预设。确认最多等 5 秒,出错或超时都照常继续。
11
+ - 预设身份兼容层的诊断改写到宿主日志,不再写入固定的本机路径(此前 1.8.0–1.8.5 的包里带有一个写死的 Windows 用户目录)。
12
+ - 工具启动自己的程序失败(`spawn … ENOENT`,无论是否带错误码)判为不可用;外部工具执行的命令不存在(command not found / not recognized)算一次普通失败,连续三次才隔离,不再当作输入错误。
13
+ - 与 refined ui 一致,子代理运行期间也算对话在运行:主代理交出这一轮后,输入框仍保持蓝光和冒泡,直到子代理结束。
14
+ - 输入框上方冒出的光点更多、稍大:频率翻倍,半径略增,样式不变。
15
+
16
+ - The composer glows blue while the conversation runs. 1.8.5 carried the animation, but the composer keeps focus after sending and the focus style's `!important` shadow beat the animation; the focus style now applies only when idle.
17
+ - The side card is white with blue accents: the host's own background (dark themes follow the host), light grey dividers and borders, and blue only on the selected environment, button outlines and the subagent status squares; text keeps the host's black and grey as elsewhere.
18
+ - Docked, the side card is no longer a floating card but a column split off the right of the conversation: flush with the edge, full height, with only a left divider. The conversation gives up that width, so its scrollbar stays visible. Opened from the narrow-window pill it is still a floating card.
19
+ - For a running subagent only the small status square flashes blue; the row itself does not glow, and the folded pill behaves the same. Reduced motion stops the flashing.
20
+ - Fix: a subagent's running state also follows the live session list. The parent's subagent catalog refreshes only when the official dropdown opens, so a running subagent used to show as idle.
21
+ - The upstream-declaration check no longer reads every 5 seconds: it runs when settings change and once before each Deep PTC conversation is created or resumed, right before the host resolves its preset; a changed declaration is re-derived first, so the new conversation gets the fresh preset. The check waits at most 5 seconds and never blocks on an error.
22
+ - The preset identity layer logs through the host logger instead of a fixed path on one machine (1.8.0–1.8.5 shipped a hard-coded Windows user directory).
23
+ - A tool that cannot start its own program (`spawn … ENOENT`, with or without the code) is unavailable; a command an external tool ran that is not installed (command not found / not recognized) is an ordinary failure, quarantined only after three in a row, instead of wrong input.
24
+ - As in dsh-refined-ui, a running subagent keeps the conversation working: after the main agent hands off its turn, the composer keeps its glow and bubbles until the subagent finishes.
25
+ - More, slightly larger sparks rise from the composer: twice as often and a little bigger, in the same style.
26
+
3
27
  ## 1.8.5 — 2026-11-09
4
28
 
5
29
  - 插件实验台改为**始终开启**,移除设置开关:新建深度 PTC 会话会读取宿主创造模式并加载相对 PTC 的差量行。
package/README.md CHANGED
@@ -72,12 +72,12 @@ The look from dsh-refined-ui is part of this plugin and applies **only while the
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
- - Motion: a breathing composer, a send-button ring and embers while the agent works, sparks on send and completion. Everything honours reduced motion.
76
- - The floating task windows of dsh-refined-ui are replaced by a **side card beside the conversation** in every Deep PTC session, with three parts:
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
+ - The floating task windows of dsh-refined-ui are replaced by a **side card split off the right of the conversation** in every Deep PTC session (flush with the edge, full height; the conversation gives up that width), with three parts:
77
77
  - **Execution environment**: Auto / WSL / PowerShell on Windows (Auto / Zsh / Bash on macOS and Linux), the WSL distribution, and a discovered shell version. It writes the same host settings form as the settings page and applies to Deep PTC sessions created afterwards; the current session keeps the environment it was created with.
78
78
  - **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.
79
79
  - **Tool state**: the “Reload all tool states” button and, when present, the failed external tools.
80
- In a narrow conversation the card folds into a small pill. It can be collapsed, and that choice is kept on this machine.
80
+ 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
81
  - While the standalone dsh-refined-ui is still running, this plugin does not draw the same look a second time.
82
82
 
83
83
  ## 1.7.2: lightweight, on-demand tool orchestration
package/README.zh.md CHANGED
@@ -72,12 +72,12 @@ dsh-refined-ui 的界面精修并入本插件,**只在当前显示的是深度
72
72
 
73
73
  - 明暗两套更克制的中性色、中文优先字体、细滚动条;悬浮的输入框卡片,聚焦时出现流动的蓝色细线;蓝色渐变发送键;淡蓝渐变的用户气泡;更宽松的助手正文;侧栏悬停与选中的蓝色底。
74
74
  - 交互:Ctrl/⌘+K 命令面板(跳转会话、新会话、插件、自动化任务)、指针追光、点击涟漪、磁吸发送键、`/` 聚焦输入框、Alt+↑/↓ 切换会话、Ctrl+Alt+D 诊断。
75
- - 动效:工作中输入框呼吸光、发送键光环和萤火,发送与完成时的光点;全部遵循系统的“减少动态效果”。
76
- - 原插件的“任务星图”浮窗不并入,改为深度PTC会话里**对话区右侧的侧边卡片**,分三块:
75
+ - 动效:对话运行时输入框边框转蓝并呼吸发光(聚焦时也不例外),发送键光环,输入框上方持续冒出光点,发送与完成时的光点;全部遵循系统的“减少动态效果”。
76
+ - 原插件的“任务星图”浮窗不并入,改为深度PTC会话里**从对话区右侧分出的一栏侧边卡片**(贴住右边缘、上下通高,对话区让出这一栏),分三块:
77
77
  - **执行环境**:Windows 上是 自动 / WSL / PowerShell(macOS、Linux 上是 自动 / Zsh / Bash),以及 WSL 发行版和已发现的 Shell 版本。和设置页写同一份宿主设置,对之后新建的深度PTC会话生效;当前会话保持创建时的环境。
78
78
  - **子代理**(有子代理时才出现):名称、状态、用时和 token,按官方子代理目录与计时数据计算;点击一行在官方右侧栏打开该子代理的对话。
79
79
  - **工具状态**:“重载所有工具状态”按钮,以及调用失败的外部工具(如有)。
80
- 对话区较窄时收成右上角的小胶囊,点开再看;卡片可收起,选择记在本机。
80
+ 侧栏为白底,浅灰色分割线,蓝色只用于选中项、按钮描边和状态小方块,文字与其他地方一样用黑色和灰色;运行中的子代理只有行首的状态小方块闪烁蓝光。对话区较窄时收成右上角的小胶囊,小方块同样会闪;卡片可收起,选择记在本机。
81
81
  - 独立的 dsh-refined-ui 仍在运行时,本插件检测到它就不再重复绘制这一套样式。
82
82
 
83
83
  ## 1.7.2:轻量、按需、可恢复的工具调用层
package/lib/client.js CHANGED
@@ -265,6 +265,7 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
265
265
  .dpt-side-section{padding:2px 14px 12px}
266
266
  .dpt-side-section+.dpt-side-section{border-top:.5px solid var(--dsw-alias-border-l1,#e3e7ee);padding-top:10px}
267
267
  .dpt-side-agents{padding-left:8px;padding-right:8px}
268
+ .dpt-side-agents .dpt-agents-list{display:flex;flex-direction:column;gap:4px;padding:2px 0}
268
269
  .dpt-side-agents>.dpt-side-label{padding:0 6px}
269
270
  .dpt-side-label{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:12px;line-height:18px;font-weight:600;color:var(--dsw-alias-label-secondary,#4a5565)}
270
271
  .dpt-side-hint{min-width:0;font-size:11px;font-weight:400;color:var(--dsw-alias-label-tertiary,#667085);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@@ -290,20 +291,37 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
290
291
  .dpt-agent:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
291
292
  .dpt-agent:disabled{cursor:default}
292
293
  .dpt-agent-dot{flex:none;width:8px;height:8px;margin-top:6px;border-radius:50%;background:var(--dsw-alias-label-tertiary,#98a2b3)}
293
- .dpt-agent[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff);animation:dpt-ping 1.4s ease-out infinite}
294
+ .dpt-agent[data-state="running"] .dpt-agent-dot,.dpt-agents-pill[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff);animation:dpt-dot-flash 1.2s ease-in-out infinite}
295
+ @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)}}
294
296
  .dpt-agent[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
295
297
  .dpt-agent-main{flex:1;min-width:0;display:flex;flex-direction:column}
296
298
  .dpt-agent-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
297
299
  .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}
298
- .dpt-agent[data-state="running"] .dpt-agent-meta{color:var(--dpt-accent,#3370ff)}
299
300
  .dpt-agents-pill{position:fixed;z-index:40;display:inline-flex;align-items:center;gap:8px;height:30px;padding:0 12px;box-sizing:border-box;border-radius:999px;border:.5px solid var(--dsw-alias-border-l2,#d6dce6);background:color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 88%,transparent);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);box-shadow:0 6px 20px rgba(16,24,40,.08);color:var(--dsw-alias-label-primary,#101828);font:inherit;font-size:12px;cursor:pointer;animation:dpt-rise 220ms var(--dpt-ease) both}
300
301
  .dpt-agents-pill .dpt-agent-dot{margin-top:0}
301
- .dpt-agents-pill[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff);animation:dpt-ping 1.4s ease-out infinite}
302
- [data-conversation-region="chat"][data-dpt-docked] [data-conversation-scroll]{box-sizing:border-box;padding-right:268px}
302
+ .dpt-agents,.dpt-agents-pill{--dpt-line:var(--dsw-alias-border-l1,#e3e7ee)}
303
+ .dpt-agents{background:var(--dsw-alias-bg-base,#fff);-webkit-backdrop-filter:none;backdrop-filter:none;border:1px solid var(--dpt-line);box-shadow:0 12px 32px color-mix(in srgb,var(--dpt-accent) 14%,transparent),0 1px 3px rgba(16,24,40,.06)}
304
+ .dpt-agents-head{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--dpt-line)}
305
+ .dpt-agents-title{display:flex;align-items:center;gap:8px}
306
+ .dpt-agents-title::before{content:"";width:8px;height:8px;border-radius:50%;background:linear-gradient(135deg,var(--dpt-brand-light,#7fb0ff),var(--dpt-accent));box-shadow:0 0 0 3px color-mix(in srgb,var(--dpt-accent) 15%,transparent)}
307
+ .dpt-agents .dpt-icon-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
308
+ .dpt-agents .dpt-icon-btn:hover{background:color-mix(in srgb,var(--dpt-accent) 10%,transparent)}
309
+ .dpt-agents .dpt-side-section+.dpt-side-section{border-top:1px solid var(--dpt-line)}
310
+ .dpt-agents .dpt-seg{background:color-mix(in srgb,var(--dpt-accent) 9%,transparent)}
311
+ .dpt-agents .dpt-seg-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
312
+ .dpt-agents .dpt-seg-btn[aria-checked="true"]{background:#fff;color:var(--dsw-alias-label-primary,#101828);box-shadow:0 1px 3px color-mix(in srgb,var(--dpt-accent) 25%,transparent),0 0 0 1px color-mix(in srgb,var(--dpt-accent) 35%,transparent)}
313
+ .dpt-agents .dpt-input,.dpt-agents .dpt-select{background:#fff;border:1px solid var(--dpt-line)}
314
+ .dpt-agents .dpt-btn{background:#fff;border:1px solid color-mix(in srgb,var(--dpt-accent) 35%,transparent);color:var(--dsw-alias-label-primary,#101828);font-weight:500}
315
+ .dpt-agents .dpt-btn:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 8%,#fff)}
316
+ .dpt-agents .dpt-agent:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 7%,transparent)}
317
+ .dpt-agents-pill{background:var(--dsw-alias-bg-base,#fff);-webkit-backdrop-filter:none;backdrop-filter:none;border:1px solid var(--dpt-line);color:var(--dsw-alias-label-primary,#101828);box-shadow:0 6px 20px color-mix(in srgb,var(--dpt-accent) 18%,transparent)}
318
+ ${DARK} .dpt-agents .dpt-seg-btn[aria-checked="true"],${DARK} .dpt-agents .dpt-input,${DARK} .dpt-agents .dpt-select,${DARK} .dpt-agents .dpt-btn{background:var(--dsw-alias-bg-base,#161b24)}
319
+ [data-conversation-region="chat"][data-dpt-docked]{margin-right:272px!important}
320
+ .dpt-agents[data-split]{border:0;border-left:1px solid var(--dpt-line,#e3e7ee);border-radius:0;box-shadow:none;animation:dpt-fade-in 160ms ease-out both}
321
+ @keyframes dpt-fade-in{from{opacity:0}to{opacity:1}}
303
322
  [data-chat-flow-kind="command"]:has([data-dpt-hidden-command]){display:none!important}
304
323
  .dpt-command-error{padding:4px 2px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary,#c4321f)}
305
324
  @keyframes dpt-rise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
306
- @keyframes dpt-ping{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--dpt-accent,#3370ff) 45%,transparent)}100%{box-shadow:0 0 0 6px color-mix(in srgb,var(--dpt-accent,#3370ff) 0%,transparent)}}
307
325
  @media (prefers-reduced-motion:reduce){.dpt-card,.dpt-agents,.dpt-agents-pill,.dpt-agent-dot,.dpt-switch,.dpt-switch-thumb{animation:none!important;transition:none!important}}
308
326
  `;
309
327
  const THEME_CSS = `
@@ -349,7 +367,7 @@ ${ON} [data-dpt-composer]{box-shadow:0 10px 30px rgba(16,24,40,0.07),0 2px 6px r
349
367
  ${ON_DARK} [data-dpt-composer]{box-shadow:0 10px 30px rgba(0,0,0,0.45),0 2px 6px rgba(0,0,0,0.35)}
350
368
  ${ON} [data-dpt-composer]::before{content:"";position:absolute;inset:-1px;border-radius:inherit;padding:1.5px;pointer-events:none;background:linear-gradient(115deg,var(--dpt-brand),var(--dpt-brand-light),var(--dpt-brand),var(--dpt-brand-light));background-size:300% 100%;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:0;transition:opacity var(--dpt-dur-base) var(--dpt-ease-out)}
351
369
  ${ON} [data-dpt-composer]:focus-within::before{opacity:1;animation:dpt-sheen 5s linear infinite}
352
- ${ON} [data-dpt-composer]:focus-within{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 10%,transparent),0 14px 38px color-mix(in srgb,var(--dpt-brand) 16%,transparent) !important}
370
+ ${ON}:not([data-dpt-busy]) [data-dpt-composer]:focus-within{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 10%,transparent),0 14px 38px color-mix(in srgb,var(--dpt-brand) 16%,transparent) !important}
353
371
  ${ON} [data-dpt-composer]:hover:not(:focus-within){background-image:radial-gradient(360px circle at var(--dpt-mx,50%) var(--dpt-my,50%),color-mix(in srgb,var(--dpt-brand) 7%,transparent),transparent 70%)}
354
372
  @keyframes dpt-sheen{from{background-position:0% 0}to{background-position:300% 0}}
355
373
  ${ON} [data-dpt-send]:not(:disabled):not([aria-disabled="true"]){background-image:linear-gradient(135deg,var(--dpt-brand-light),var(--dpt-brand)) !important;color:#fff !important;box-shadow:0 4px 14px color-mix(in srgb,var(--dpt-brand) 38%,transparent);transition:transform 160ms var(--dpt-ease-out),box-shadow 160ms var(--dpt-ease-out),filter var(--dpt-dur-fast) var(--dpt-ease-out) !important}
@@ -368,8 +386,8 @@ ${ON} [data-row-key^="session:"][role="treeitem"]:hover{background-color:color-m
368
386
  ${ON} [data-row-key^="session:"][role="treeitem"]:hover:not(:is([aria-selected="true"],[aria-current="true"],[data-selected="true"],.ld-row-selected)){background-image:radial-gradient(160px circle at var(--dpt-mx,50%) var(--dpt-my,50%),color-mix(in srgb,var(--dpt-brand) 18%,transparent),transparent 72%)}
369
387
  ${ON} [data-row-key^="session:"][role="treeitem"]:is([aria-selected="true"],[aria-current="true"],[data-selected="true"],.ld-row-selected){background-image:linear-gradient(90deg,color-mix(in srgb,var(--dpt-brand) 15%,transparent),color-mix(in srgb,var(--dpt-brand) 3%,transparent));font-weight:500}
370
388
  ${ON}[data-dpt-busy] [data-dpt-composer]::before{opacity:1;padding:2.5px;animation:dpt-sheen 1.6s linear infinite}
371
- ${ON}[data-dpt-busy] [data-dpt-composer]{animation:dpt-breathe 1.9s ease-in-out infinite}
372
- @keyframes dpt-breathe{0%,100%{box-shadow:0 0 0 0 color-mix(in srgb,var(--dpt-brand) 0%,transparent),0 0 18px 0 color-mix(in srgb,var(--dpt-brand) 22%,transparent)}50%{box-shadow:0 0 0 7px color-mix(in srgb,var(--dpt-brand) 20%,transparent),0 0 56px 6px color-mix(in srgb,var(--dpt-brand) 48%,transparent)}}
389
+ ${ON}[data-dpt-busy] [data-dpt-composer]{border-color:color-mix(in srgb,var(--dpt-brand) 55%,transparent) !important;animation:dpt-breathe 1.9s ease-in-out infinite}
390
+ @keyframes dpt-breathe{0%,100%{box-shadow:0 0 0 1px color-mix(in srgb,var(--dpt-brand) 35%,transparent),0 0 16px 2px color-mix(in srgb,var(--dpt-brand) 28%,transparent),0 10px 30px color-mix(in srgb,var(--dpt-brand) 12%,transparent)}50%{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 22%,transparent),0 0 44px 10px color-mix(in srgb,var(--dpt-brand) 50%,transparent),0 14px 44px color-mix(in srgb,var(--dpt-brand) 24%,transparent)}}
373
391
  ${ON} [data-dpt-composer][data-dpt-done]{animation:dpt-done 900ms var(--dpt-ease-out) 1}
374
392
  @keyframes dpt-done{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--dpt-brand) 60%,transparent)}100%{box-shadow:0 0 0 26px color-mix(in srgb,var(--dpt-brand) 0%,transparent)}}
375
393
  ${ON}[data-dpt-busy] [data-dpt-send]{position:relative}
@@ -416,6 +434,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
416
434
  // ---------------------------------------------------------------------------------------------
417
435
  const SESSIONS = {
418
436
  map: new Map(), subs: new Set(),
437
+ // Sessions whose subagents are running, reported by the side card (Deep PTC sessions only).
438
+ working: new Map(),
439
+ setWorking(id, value) { if (this.working.get(id) === value) return; if (value) this.working.set(id, true); else this.working.delete(id); this.emit(); },
419
440
  set(id, value) { this.map.set(id, value); this.emit(); },
420
441
  del(id) { this.map.delete(id); this.emit(); },
421
442
  emit() { for (const listener of this.subs) { try { listener(); } catch (error) { console.warn(`[${PLUGIN}]`, error); } } },
@@ -454,7 +475,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
454
475
  const current = SESSIONS.current();
455
476
  const on = current?.preset === 'deep-ptc' && !refinedPresent();
456
477
  document.body.toggleAttribute('data-dpt-ui', on);
457
- BUSY.bridge = on && current?.busy === true;
478
+ // Like dsh-refined-ui, a running subagent keeps the conversation working.
479
+ BUSY.bridge = on && (current?.busy === true || SESSIONS.working.get(current?.id) === true);
458
480
  applyBusy();
459
481
  };
460
482
  SESSIONS.subs.add(update);
@@ -754,12 +776,13 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
754
776
  paint.globalCompositeOperation = 'lighter';
755
777
  const composer = document.querySelector('[data-dpt-composer]');
756
778
  const now = performance.now();
757
- if (busy() && !reduce && composer && now - lastEmber > 70) {
779
+ // Embers rise from the composer while the agent works: twice as often as dsh-refined-ui, slightly larger.
780
+ if (busy() && !reduce && composer && now - lastEmber > 35) {
758
781
  lastEmber = now;
759
782
  const rect = composer.getBoundingClientRect();
760
783
  parts.push({ x: rect.left + 12 + Math.random() * (rect.width - 24), y: rect.top + 2, vx: (Math.random() - 0.5) * 0.5,
761
784
  vy: -(0.5 + Math.random() * 1.1), gravity: -0.004, life: 1, decay: 0.009 + Math.random() * 0.01,
762
- r: 1.2 + Math.random() * 2, color: hues[(Math.random() * 4) | 0] });
785
+ r: 1.8 + Math.random() * 2.4, color: hues[(Math.random() * 4) | 0] });
763
786
  }
764
787
  parts = parts.filter(part => part.life > 0);
765
788
  for (const part of parts) {
@@ -916,6 +939,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
916
939
  // ---------------------------------------------------------------------------------------------
917
940
  const AGENT_ROWS = 24;
918
941
  const PANEL_WIDTH = 248;
942
+ // Docked, the card is a column split off the right side of the conversation, flush with its edge.
943
+ const SPLIT_WIDTH = 272;
919
944
  const DOCK_MIN_WIDTH = 960;
920
945
  const COLLAPSED_KEY = `${PLUGIN}:subagents-collapsed`;
921
946
  const readCollapsed = () => { try { return localStorage.getItem(COLLAPSED_KEY) === '1'; } catch { return false; } };
@@ -937,7 +962,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
937
962
  const summary = sessions?.byId?.[entry.id];
938
963
  const timing = summary?.projectionValues?.subagentTiming;
939
964
  const external = entry.mode === 'external';
940
- const running = !external && entry.activity === 'running';
965
+ // The parent's catalog refreshes only when the official dropdown opens; the session list carries
966
+ // each session's live running flag.
967
+ const running = !external && (entry.activity === 'running' || summary?.running === true);
941
968
  const completed = !external && entry.activity === 'inactive' && timing?.lastTurnCompleted === true;
942
969
  const duration = timing === undefined || external ? undefined : timing.active === undefined ? timing.settledMs
943
970
  : timing.settledMs + Math.max(0, (running ? now : timing.active.through) - timing.active.since);
@@ -997,11 +1024,14 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
997
1024
  const region = regions.find(node => !anyMain || node.closest('[data-slot="main.conversation"]'));
998
1025
  const rect = region?.getBoundingClientRect();
999
1026
  if (!region || !rect || rect.width === 0) { if (last !== '-') { last = '-'; lastRegion = undefined; setLayout(undefined); } return; }
1027
+ // Docked, the region gives up the column's width, so its parent marks the conversation's right edge.
1028
+ const host = region.parentElement?.getBoundingClientRect() ?? rect;
1000
1029
  const composer = region.querySelector('[data-composer-seat]')?.getBoundingClientRect();
1001
1030
  const bottom = composer && composer.top > rect.top ? composer.top - 12 : rect.bottom - 12;
1002
1031
  const next = { region, top: Math.round(rect.top + 12), right: Math.round(window.innerWidth - rect.right + 16),
1003
- maxHeight: Math.max(120, Math.round(bottom - rect.top - 12)), wide: rect.width >= DOCK_MIN_WIDTH };
1004
- const key = `${next.top}|${next.right}|${next.maxHeight}|${next.wide}`;
1032
+ maxHeight: Math.max(120, Math.round(bottom - rect.top - 12)), wide: host.width >= DOCK_MIN_WIDTH,
1033
+ split: { top: Math.round(rect.top), right: Math.round(window.innerWidth - host.right), height: Math.round(rect.height) } };
1034
+ const key = `${next.top}|${next.right}|${next.maxHeight}|${next.wide}|${next.split.top}|${next.split.right}|${next.split.height}`;
1005
1035
  if (key !== last || region !== lastRegion) { last = key; lastRegion = region; setLayout(next); }
1006
1036
  };
1007
1037
  measure();
@@ -1112,6 +1142,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1112
1142
  const timer = setInterval(() => setNow(Date.now()), 1000);
1113
1143
  return () => clearInterval(timer);
1114
1144
  }, [running > 0]);
1145
+ React.useEffect(() => {
1146
+ SESSIONS.setWorking(sessionId, running > 0);
1147
+ return () => SESSIONS.setWorking(sessionId, false);
1148
+ }, [sessionId, running > 0]);
1115
1149
  React.useEffect(() => {
1116
1150
  const region = layout?.region;
1117
1151
  if (!region) return undefined;
@@ -1139,7 +1173,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1139
1173
  }
1140
1174
  const stateText = row => row.state === 'running' ? t('agentRunning') : row.state === 'completed' ? t('agentCompleted') : row.state === 'external' ? t('agentExternal') : t('agentIdle');
1141
1175
  const collapse = () => { if (layout.wide) { writeCollapsed(true); setCollapsed(true); } setPeek(false); };
1142
- return ReactDOM.createPortal(h('aside', { className: 'dpt-agents', 'aria-label': t('sideTitle'), style: { ...position, maxHeight: `${layout.maxHeight}px`, width: `${PANEL_WIDTH}px` } },
1176
+ const frame = docked
1177
+ ? { top: `${layout.split.top}px`, right: `${layout.split.right}px`, height: `${layout.split.height}px`, width: `${SPLIT_WIDTH}px` }
1178
+ : { ...position, maxHeight: `${layout.maxHeight}px`, width: `${PANEL_WIDTH}px` };
1179
+ return ReactDOM.createPortal(h('aside', { className: 'dpt-agents', 'data-split': docked ? '' : undefined, 'aria-label': t('sideTitle'), style: frame },
1143
1180
  h('header', { className: 'dpt-agents-head' },
1144
1181
  h('span', { className: 'dpt-agents-title' }, t('sideTitle')),
1145
1182
  h('span', { className: 'dpt-agents-count' }),
@@ -0,0 +1,31 @@
1
+ // Confirm the upstream declarations once before a Deep PTC conversation is created or resumed,
2
+ // instead of polling. The host resolves a session's preset right before mounting it; wrapping that
3
+ // call lets a changed declaration be re-derived first, so the new conversation gets the fresh preset.
4
+ const FRESH_MARK = Symbol.for('dsh-deep-ptc-mode.freshness');
5
+ export const CHECK_TIMEOUT_MS = 5000;
6
+
7
+ /**
8
+ * Run `check` before the registry resolves one of `ids` (or the default when it is one of them).
9
+ * The check never blocks a conversation longer than `timeoutMs`, and its failures are ignored.
10
+ * @returns a disposer that restores the original method.
11
+ */
12
+ export function checkBeforeResolve(registry, check, { ids = ['deep-ptc'], timeoutMs = CHECK_TIMEOUT_MS } = {}) {
13
+ const original = registry?.resolve;
14
+ if (typeof original !== 'function' || original[FRESH_MARK] === true) return () => {};
15
+ const hadOwn = Object.hasOwn(registry, 'resolve');
16
+ const patched = async function resolve(id, ...rest) {
17
+ if (ids.includes(id ?? registry.defaultId)) {
18
+ let timer;
19
+ const timeout = new Promise(done => { timer = setTimeout(done, timeoutMs); timer.unref?.(); });
20
+ try { await Promise.race([Promise.resolve().then(check).catch(() => {}), timeout]); } finally { clearTimeout(timer); }
21
+ }
22
+ return original.call(registry, id, ...rest);
23
+ };
24
+ Object.defineProperty(patched, FRESH_MARK, { value: true });
25
+ Object.defineProperty(registry, 'resolve', { value: patched, configurable: true, writable: true });
26
+ return () => {
27
+ if (registry.resolve !== patched) return;
28
+ if (hadOwn) Object.defineProperty(registry, 'resolve', { value: original, configurable: true, writable: true });
29
+ else delete registry.resolve;
30
+ };
31
+ }
package/lib/index.mjs CHANGED
@@ -11,6 +11,7 @@ import { BASE_DECLARATION_SPECIFIER, creativePresetUrl, loadCreativePreset, load
11
11
  import { importHost, pluginOf, resolveHost } from './host.mjs';
12
12
  import { presetLifecycle } from './lifecycle.mjs';
13
13
  import { installPresetCompat } from './preset-compat.mjs';
14
+ import { checkBeforeResolve } from './freshness.mjs';
14
15
  import { apply as applySkillContext } from './skill-context.mjs';
15
16
  import { applyRoot as applyToolStateRoot } from './tool-state.mjs';
16
17
 
@@ -209,20 +210,37 @@ export async function apply(ctx, config) {
209
210
  const refreshed = () => lifecycle.refresh().then(() => { void verify().catch(() => {}); });
210
211
  // Read the installed declarations, not fixture versions. Refresh only when our settings or
211
212
  // upstream declaration bytes change. Existing sessions keep their leased preset generation.
213
+ // The check runs when settings change and once before each Deep PTC conversation starts; no timer.
212
214
  const signature = async () => {
213
- const read = url => {try{return readFileSync(fileURLToPath(url),'utf8');}catch{return '';}};
214
- let runtime='';try{runtime=JSON.stringify(await ctx.agentPresets.readDocument?.('ptc'));}catch{}
215
- let creative='';try{creative=JSON.stringify(await ctx.agentPresets.readDocument?.(CREATIVE_PRESET_ID));}catch{}
216
- return JSON.stringify(settingsOf(ctx,config))+'\0'+runtime+'\0'+creative+'\0'+read(officialPresetUrl())+'\0'+read(resolveHost(BASE_DECLARATION_SPECIFIER))+'\0'+read(creativePresetUrl());
215
+ const read = url => {
216
+ try { return readFileSync(fileURLToPath(url), 'utf8'); } catch { return ''; }
217
+ };
218
+ const document = async id => {
219
+ try { return JSON.stringify(await ctx.agentPresets.readDocument?.(id)); } catch { return ''; }
220
+ };
221
+ return [JSON.stringify(settingsOf(ctx, config)), await document('ptc'), await document(CREATIVE_PRESET_ID),
222
+ read(officialPresetUrl()), read(resolveHost(BASE_DECLARATION_SPECIFIER)), read(creativePresetUrl())].join('\0');
217
223
  };
218
- let previous=await signature(), detecting=false, active=true;
219
- const detect = async () => {
220
- if(detecting||!active)return;detecting=true;
221
- try {const current=await signature();if(!active||current===previous)return;previous=current;safeMode=false;await refreshed().catch(()=>{});}catch(error){ctx.logger.warn('Deep PTC: upstream detection failed (%s); retaining the active preset',error.message);}finally{detecting=false;}
222
- };
223
- ctx.on('loader/volatile-update', detect);
224
- const upstreamWatch=setInterval(detect,5000);upstreamWatch.unref?.();
225
- ctx.effect(()=>()=>{active=false;clearInterval(upstreamWatch);});
224
+ let previous = await signature();
225
+ let detecting;
226
+ let active = true;
227
+ // Concurrent callers share one check, so several conversations opening together read once.
228
+ const detect = () => detecting ??= (async () => {
229
+ try {
230
+ const current = await signature();
231
+ if (!active || current === previous) return;
232
+ previous = current;
233
+ safeMode = false;
234
+ await refreshed().catch(() => {});
235
+ } catch (error) {
236
+ ctx.logger.warn('Deep PTC: upstream detection failed (%s); retaining the active preset', error.message);
237
+ } finally {
238
+ detecting = undefined;
239
+ }
240
+ })();
241
+ ctx.on('loader/volatile-update', () => { void detect(); });
242
+ const restoreResolve = checkBeforeResolve(ctx.agentPresets, detect);
243
+ ctx.effect(() => () => { active = false; restoreResolve(); });
226
244
  ctx.inject(['settings'], child => {
227
245
  child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
228
246
  });
@@ -17,7 +17,7 @@
17
17
  //
18
18
  // Host internals that must keep the exact identity (subagent child headers, scheduled
19
19
  // session creation, the registry itself) are recognised from the immediate frames.
20
- import { appendFileSync, readFileSync, readdirSync, statSync } from 'node:fs';
20
+ import { readFileSync, readdirSync, statSync } from 'node:fs';
21
21
  import { dirname, join, parse } from 'node:path';
22
22
  import { fileURLToPath } from 'node:url';
23
23
 
@@ -32,14 +32,15 @@ const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'docs', 'test', 'test
32
32
  const MAX_FILES = 800;
33
33
  const MAX_FILE_BYTES = 1024 * 1024;
34
34
  const MAX_TOTAL_BYTES = 8 * 1024 * 1024;
35
- const LOG = 'C:/Users/13987/.dsh/tmp/deep-ptc-preset-compat.log';
36
35
 
37
36
  const packageCache = new Map();
38
37
  const callerCache = new Map();
39
38
  const logged = new Set();
40
39
 
40
+ // Diagnostics go to the host logger of the plugin that installed the layer.
41
+ let sink = () => {};
41
42
  function log(line) {
42
- try { appendFileSync(LOG, line + '\n'); } catch { /* diagnostics only */ }
43
+ try { sink(line); } catch { /* diagnostics only */ }
43
44
  }
44
45
 
45
46
  function fileOf(value) {
@@ -233,6 +234,7 @@ function logDecision(info, id) {
233
234
  * @returns owner handle; dispose() restores the unpatched method.
234
235
  */
235
236
  export function installPresetCompat(ctx, options) {
237
+ if (typeof ctx?.logger?.debug === 'function') sink = line => ctx.logger.debug('Deep PTC preset identity: %s', line);
236
238
  const registry = ctx?.agentPresets;
237
239
  const current = registry?.composedPreset;
238
240
  if (typeof current !== 'function') {
@@ -17,6 +17,9 @@ export const compatibilityPolicy = `## Efficient tool cooperation
17
17
  // plugins, so these patterns separate a broken provider from wrong input and passing trouble.
18
18
  const MISSING_TEXT = /is not a (?:function|constructor)|cannot find (?:module|package)|err_module_not_found|not implemented|cannot read propert(?:y|ies) of (?:undefined|null)/iu;
19
19
  const DENIED_TEXT = /permission denied|eacces|eperm|forbidden|unauthori[sz]ed|\b40[13]\b/iu;
20
+ // A command the tool ran is not installed. Not wrong input, and not proof that the tool itself is broken
21
+ // (an external shell tool may simply run a missing command), so it counts as a strike.
22
+ const MISSING_COMMAND_TEXT = /command not found|not recognized as an internal or external command|is not recognized as the name of a cmdlet/iu;
20
23
  const INPUT_TEXT = /enoent|no such file|not found|does not exist|invalid|missing required|bad request|\b40[04]\b/iu;
21
24
  const TEMPORARY_TEXT = /timed? ?out|timeout|etimedout|econnreset|econnrefused|eai_again|enotfound|socket hang up|network|fetch failed|rate.?limit|too many requests|\b429\b|\b50[234]\b|temporar|try again|overloaded/iu;
22
25
  /** Consecutive unexplained or temporary failures before a capability is quarantined. */
@@ -44,14 +47,16 @@ export function classifyToolOutcome(exec, result) {
44
47
  if (/ABORT|CANCEL/u.test(code) || status === 'cancelled') return { kind: 'cancelled', effect };
45
48
  if (/DENIED|FORBIDDEN|POLICY|APPROVAL|PERMISSION|EACCES|EPERM|READ_ONLY/u.test(code))
46
49
  return { kind: 'denied', effect };
47
- if (code === 'ENOENT' && /\bspawn(?:sync)?\b[^\n]*\bENOENT\b/iu.test(String(result?.error?.message ?? failure?.message ?? ''))) return {kind:'unavailable',effect};
50
+ const message = String(result?.error?.message ?? failure?.message ?? '');
51
+ // The tool could not start its own program: the provider is incompletely installed.
52
+ if ((code === 'ENOENT' || code === '') && /\bspawn(?:sync)?\b[^\n]*\bENOENT\b/iu.test(message)) return { kind: 'unavailable', effect };
53
+ if (MISSING_COMMAND_TEXT.test(message)) return { kind: 'failure', effect };
48
54
  if (/ARGUMENT|INVALID_ARGS|VALIDATION|ENOENT|NOT_FOUND/u.test(code) && code !== 'UNKNOWN_TOOL')
49
55
  return { kind: 'input', effect };
50
56
  if (status === 'partial') return { kind: 'partial', effect };
51
57
  if (/UNKNOWN_TOOL|UNAVAILABLE|WORKER_MISSING|RUNTIME_MISSING/u.test(code) || status === 'unavailable')
52
58
  return { kind: 'unavailable', effect };
53
59
  if (code) return { kind: /TIMEOUT|RATE|BUSY|OVERLOAD/u.test(code) ? 'temporary' : 'failure', effect };
54
- const message = String(result?.error?.message ?? failure?.message ?? '');
55
60
  if (MISSING_TEXT.test(message)) return { kind: 'unavailable', effect };
56
61
  if (DENIED_TEXT.test(message)) return { kind: 'denied', effect };
57
62
  if (TEMPORARY_TEXT.test(message)) return { kind: 'temporary', effect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deep-ptc-mode",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "Agent mode for DSH: reporting, asking, reachability, planning, budget use. Plugin-first, official PTC fallback, dynamic tools, creative lab, dsh-go, multi-shell, dsh-ops-tested. / 面向 DSH:汇报、先问、休眠、计划、预算;插件优先、官方兜底,动态工具、创造模式、dsh-go、多 shell 与外部工具(dsh-ops 已测)。",
5
5
  "type": "module",
6
6
  "keywords": [