dsh-deep-ptc-mode 1.8.8 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -216,15 +216,20 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
216
216
  skillShowAll: '显示全部 {count} 个', skillShowLess: '收起',
217
217
  agentsTitle: '子代理', agentsRunning: '{count} 个运行中', agentsCompleted: '{count} 个已完成', agentsIdle: '{count} 个空闲',
218
218
  agentRunning: '运行中', agentCompleted: '已完成', agentIdle: '空闲', agentExternal: '外部',
219
- agentsCollapse: '收起侧边卡片', agentsExpand: '展开侧边卡片', agentOpen: '在右侧栏打开这个子代理的对话',
219
+ agentOpen: '在右侧栏打开这个子代理的对话',
220
220
  sideTitle: '深度 PTC', toolsSection: '工具状态', envAuto: '自动', envForNew: '新会话生效', envThisSession: '本会话保持创建时的环境。',
221
221
  envAutoNow: '当前按自动选择:{env}。本会话保持创建时的环境。', envSaved: '已保存,之后新建的会话使用 {env}。',
222
222
  envFailed: '未能保存,请检查发行版名称或设置是否已在别处修改。', envDefaultDistribution: '默认发行版',
223
223
  durationSeconds: '{s} 秒', durationMinutes: '{m} 分 {s} 秒', durationHours: '{h} 小时 {m} 分', tokens: '{value} tokens',
224
- palTitle: '命令面板', palPlaceholder: '搜索会话,或输入命令…', palEmpty: '没有匹配的结果', palFoot: '↑↓ 选择 ↵ 打开 Esc 关闭',
225
- palCommand: '命令', palEffect: '特效', palSession: '会话', palNewSub: '开始一个新的对话', palPluginsSub: '打开插件页面',
226
- palAutomationSub: '打开自动化任务', palAgents: '侧边卡片:展开 / 收起', palAgentsSub: '执行环境与子代理',
227
- palFireworks: '放烟花', palFireworksSub: '庆祝一下',
224
+ sideGuide: '执行环境、子代理、后台任务、输出文件与 SSH', sideOtherMode: '当前对话不是深度 PTC 模式。这里的执行环境用于之后新建的深度 PTC 会话。',
225
+ capsuleOpen: '打开深度 PTC 面板',
226
+ outputsTitle: '输出文件', outputsEmpty: '本会话暂无输出文件。', outputsMore: '另有 {count} 个文件',
227
+ outputPresented: '已交付', outputTurn: '第 {turn} 轮',
228
+ sshTitle: 'SSH 连接', sshHint: '非交互连接', sshNoClient: '未找到 OpenSSH 客户端', sshConfigured: '已配置',
229
+ sshUsed: '第 {turn} 轮 · {count} 次', sshFailed: '第 {turn} 轮失败', sshEmpty: '~/.ssh/config 中没有主机别名,本会话也未连接过远程主机。',
230
+ appearance: '外观', visualEffectsAuto: '检测到外观插件 {name},特效默认关闭。手动打开后会保留你的选择。',
231
+ diagTitle: '诊断信息', diagHint: '复制后可附在 issue 中,便于排查界面问题。', diagCopy: '复制诊断信息', diagCopied: '已复制',
232
+ shellStore: 'PowerShell 7(应用商店)', presetSafeReason: '当前为安全模式:{reason}',
228
233
  });
229
234
  Object.assign(dictionaries.en, {
230
235
  skillTitle: 'Skills in context', skillLoaded: '{count} loaded', skillClosing: '{count} leave after your next message',
@@ -233,15 +238,20 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
233
238
  skillShowAll: 'Show all {count}', skillShowLess: 'Show less',
234
239
  agentsTitle: 'Subagents', agentsRunning: '{count} running', agentsCompleted: '{count} done', agentsIdle: '{count} idle',
235
240
  agentRunning: 'Running', agentCompleted: 'Done', agentIdle: 'Idle', agentExternal: 'External',
236
- agentsCollapse: 'Collapse the side card', agentsExpand: 'Expand the side card', agentOpen: 'Open this subagent in the right sidebar',
241
+ agentOpen: 'Open this subagent in the right sidebar',
237
242
  sideTitle: 'Deep PTC', toolsSection: 'Tool state', envAuto: 'Auto', envForNew: 'for new sessions', envThisSession: 'This session keeps the environment it was created with.',
238
243
  envAutoNow: 'Automatic picks {env}. This session keeps the environment it was created with.', envSaved: 'Saved. New sessions use {env}.',
239
244
  envFailed: 'Could not save. Check the distribution name, or whether settings changed elsewhere.', envDefaultDistribution: 'Default distribution',
240
245
  durationSeconds: '{s}s', durationMinutes: '{m}m {s}s', durationHours: '{h}h {m}m', tokens: '{value} tokens',
241
- palTitle: 'Command palette', palPlaceholder: 'Search sessions or type a command…', palEmpty: 'No matches', palFoot: '↑↓ select ↵ open Esc close',
242
- palCommand: 'Command', palEffect: 'Effect', palSession: 'Session', palNewSub: 'Start a new conversation', palPluginsSub: 'Open plugins',
243
- palAutomationSub: 'Open automations', palAgents: 'Side card: expand / collapse', palAgentsSub: 'Execution environment and subagents',
244
- palFireworks: 'Fireworks', palFireworksSub: 'Celebrate',
246
+ sideGuide: 'Environment, subagents, background jobs, output files and SSH', sideOtherMode: 'This conversation is not in Deep PTC mode. The environment here applies to new Deep PTC sessions.',
247
+ capsuleOpen: 'Open the Deep PTC panel',
248
+ outputsTitle: 'Output files', outputsEmpty: 'No output files in this conversation.', outputsMore: '{count} more files',
249
+ outputPresented: 'Delivered', outputTurn: 'Turn {turn}',
250
+ sshTitle: 'SSH connections', sshHint: 'non-interactive', sshNoClient: 'OpenSSH client not found', sshConfigured: 'Configured',
251
+ sshUsed: 'Turn {turn} · {count}×', sshFailed: 'Failed in turn {turn}', sshEmpty: 'No host aliases in ~/.ssh/config and no remote host reached in this conversation.',
252
+ appearance: 'Appearance', visualEffectsAuto: '{name} is installed, so effects start off. Turning them on keeps your choice.',
253
+ diagTitle: 'Diagnostics', diagHint: 'Copy and attach to an issue to help investigate interface problems.', diagCopy: 'Copy diagnostics', diagCopied: 'Copied',
254
+ shellStore: 'PowerShell 7 (Microsoft Store)', presetSafeReason: 'Safe mode: {reason}',
245
255
  });
246
256
 
247
257
  // Placeholders are filled here, so the text is right whether or not the host locale interpolates.
@@ -256,24 +266,24 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
256
266
  const key = commandMessageKeys.get(text);
257
267
  return key ? t(key) : text;
258
268
  }
259
- let T = key => key;
260
269
  let hostCtx;
261
- let ReactDOM;
262
- try { ReactDOM = require('react-dom'); } catch { ReactDOM = undefined; }
263
- const canPortal = () => typeof ReactDOM?.createPortal === 'function' && typeof document !== 'undefined';
264
270
 
265
271
  // ---------------------------------------------------------------------------------------------
266
- // Stylesheet. The cards are only rendered in Deep PTC sessions. The refined look and its motion
267
- // (ported from dsh-refined-ui, without its floating task windows) apply only while the
268
- // conversation on screen is a Deep PTC session: every rule is scoped by body[data-dpt-ui].
272
+ // Stylesheet. The cards render only in Deep PTC sessions. The visual effects (the refined look and
273
+ // its motion) apply only while the conversation on screen is a Deep PTC session and effects are on:
274
+ // every effect rule is scoped by body[data-dpt-ui]. Effect rules target the host's own stable
275
+ // attributes (data-composer-card, data-message-bubble); the send button is the one element tagged.
276
+ // Looping animations change opacity or transform only, so the compositor runs them without repaints.
269
277
  // ---------------------------------------------------------------------------------------------
270
278
  const PLUGIN = 'dsh-deep-ptc-mode';
271
279
  const ON = 'body[data-dpt-ui]';
272
280
  const ON0 = ':where(body[data-dpt-ui])';
273
281
  const DARK = 'body[data-ds-dark-theme]:not([data-ds-dark-theme="false"])';
274
282
  const ON_DARK = 'body[data-dpt-ui][data-ds-dark-theme]:not([data-ds-dark-theme="false"])';
283
+ const COMPOSER = '[data-composer-card]';
284
+ const BUBBLE = ':is([data-chat-flow-kind="user"],[data-chat-flow-kind="steering"]) [data-message-bubble]';
275
285
  const CARD_CSS = `
276
- .dpt-card,.dpt-agents,.dpt-agents-pill{--dpt-accent:var(--dpt-brand,#3370ff);--dpt-ease:cubic-bezier(.22,1,.36,1)}
286
+ .dpt-card,.dpt-panel,.dpt-capsule,.dpt-settings{--dpt-accent:var(--dpt-brand,#3370ff);--dpt-ease:cubic-bezier(.22,1,.36,1);--dpt-line:var(--dsw-alias-border-l1,#e3e7ee)}
277
287
  .dpt-card{--dpt-card-fill:var(--dsw-static-neutral-50,#f7f8fa);box-sizing:border-box;width:100%;margin:2px 0 4px;border:.5px solid var(--dsw-alias-border-l2,#d6dce6);border-radius:var(--dsw-radius-lg,16px);background:var(--dpt-card-fill);color:var(--dsw-alias-label-primary,#101828);font-size:13px;line-height:20px;overflow:hidden;animation:dpt-rise 220ms var(--dpt-ease) both}
278
288
  ${DARK} .dpt-card{--dpt-card-fill:var(--dsw-static-neutral-850,#1a1f29)}
279
289
  .dpt-card-head{display:flex;align-items:center;gap:10px;padding:10px 12px 6px}
@@ -283,11 +293,13 @@ ${DARK} .dpt-card{--dpt-card-fill:var(--dsw-static-neutral-850,#1a1f29)}
283
293
  .dpt-card-sub{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#667085);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
284
294
  .dpt-card-sub [data-tone="warn"]{color:var(--dsw-alias-state-warn-primary,#b45309)}
285
295
  .dpt-card-actions{flex:none;display:flex;gap:6px}
286
- .dpt-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;height:26px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l3,#c9d0db);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-button-floating-fill,#fff);color:var(--dsw-alias-label-primary,#101828);font:inherit;font-size:12px;line-height:18px;white-space:nowrap;cursor:pointer;transition:background-color 120ms,border-color 120ms,opacity 120ms}
287
- .dpt-btn:hover:not(:disabled){background:var(--dsw-alias-button-floating-hover,var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05)))}
296
+ .dpt-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;height:26px;padding:0 10px;border:1px solid color-mix(in srgb,var(--dpt-accent) 35%,transparent);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#101828);font:inherit;font-size:12px;font-weight:500;line-height:18px;white-space:nowrap;cursor:pointer;transition:background-color 120ms,border-color 120ms,opacity 120ms}
297
+ .dpt-btn:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 8%,var(--dsw-alias-bg-base,#fff))}
298
+ .dpt-card .dpt-btn{border:.5px solid var(--dsw-alias-border-l3,#c9d0db);background:var(--dsw-alias-button-floating-fill,#fff);font-weight:400}
299
+ .dpt-card .dpt-btn:hover:not(:disabled){background:var(--dsw-alias-button-floating-hover,var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05)))}
288
300
  .dpt-btn:disabled{opacity:.45;cursor:default}
289
301
  .dpt-btn[aria-busy="true"]{cursor:wait}
290
- .dpt-btn:focus-visible,.dpt-switch:focus-visible,.dpt-agent:focus-visible,.dpt-icon-btn:focus-visible,.dpt-link:focus-visible,.dpt-agents-pill:focus-visible{outline:2px solid var(--dpt-accent,#3370ff);outline-offset:2px}
302
+ .dpt-btn:focus-visible,.dpt-switch:focus-visible,.dpt-agent:focus-visible,.dpt-icon-btn:focus-visible,.dpt-link:focus-visible,.dpt-capsule:focus-visible{outline:2px solid var(--dpt-accent,#3370ff);outline-offset:2px}
291
303
  .dpt-skill-list{list-style:none;margin:0;padding:0 4px 4px;display:flex;flex-direction:column;gap:2px}
292
304
  .dpt-skill{display:flex;align-items:center;gap:12px;padding:7px 8px 7px 10px;border-radius:10px;transition:background-color 120ms}
293
305
  .dpt-skill:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
@@ -305,29 +317,24 @@ ${DARK} .dpt-card{--dpt-card-fill:var(--dsw-static-neutral-850,#1a1f29)}
305
317
  .dpt-switch[aria-checked="true"] .dpt-switch-thumb{transform:translateX(14px)}
306
318
  .dpt-card-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0;padding:8px 14px 10px;border-top:.5px solid var(--dsw-alias-border-l1,#e3e7ee);font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#667085)}
307
319
  .dpt-link{flex:none;border:0;background:none;padding:0;font:inherit;color:var(--dpt-accent,#3370ff);cursor:pointer}
308
- .dpt-agents{position:fixed;z-index:40;box-sizing:border-box;width:248px;display:flex;flex-direction:column;border-radius:16px;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) saturate(1.2);backdrop-filter:blur(16px) saturate(1.2);box-shadow:0 10px 30px rgba(16,24,40,.08),0 1px 3px rgba(16,24,40,.06);color:var(--dsw-alias-label-primary,#101828);font-size:13px;line-height:20px;overflow:hidden;animation:dpt-rise 220ms var(--dpt-ease) both}
309
- ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.45),0 1px 3px rgba(0,0,0,.35)}
310
- .dpt-agents-head{display:flex;align-items:center;gap:8px;padding:10px 8px 6px 14px}
311
- .dpt-agents-title{flex:none;font-weight:600}
312
- .dpt-agents-count{flex:1;min-width:0;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#667085);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
313
- .dpt-icon-btn{flex:none;display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#4a5565);cursor:pointer}
314
- .dpt-icon-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
315
- .dpt-side-body{overflow:auto;min-height:0}
320
+ .dpt-panel{box-sizing:border-box;display:flex;flex-direction:column;height:100%;min-height:0;color:var(--dsw-alias-label-primary,#101828);font-size:13px;line-height:20px}
321
+ .dpt-panel[data-inline]{height:auto;max-height:min(60vh,520px);margin:6px 0 2px;border:1px solid var(--dpt-line);border-radius:14px;background:var(--dsw-alias-bg-base,#fff);overflow:hidden;animation:dpt-rise 200ms var(--dpt-ease) both}
322
+ .dpt-side-body{flex:1;overflow:auto;min-height:0;padding-top:10px}
316
323
  .dpt-side-section{padding:2px 14px 12px}
317
- .dpt-side-section+.dpt-side-section{border-top:.5px solid var(--dsw-alias-border-l1,#e3e7ee);padding-top:10px}
324
+ .dpt-side-section+.dpt-side-section{border-top:1px solid var(--dpt-line);padding-top:10px}
318
325
  .dpt-side-agents{padding-left:8px;padding-right:8px}
319
326
  .dpt-side-agents .dpt-agents-list{display:flex;flex-direction:column;gap:4px;padding:2px 0}
320
327
  .dpt-side-agents>.dpt-side-label{padding:0 6px}
321
328
  .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)}
322
329
  .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}
323
- .dpt-seg{display:flex;gap:2px;padding:2px;border-radius:10px;background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
330
+ .dpt-seg{display:flex;gap:2px;padding:2px;border-radius:10px;background:color-mix(in srgb,var(--dpt-accent) 9%,transparent)}
324
331
  .dpt-seg-btn{flex:1;min-width:0;height:26px;padding:0 6px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#4a5565);font:inherit;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;transition:background-color 120ms,color 120ms,box-shadow 120ms}
325
332
  .dpt-seg-btn:hover:not(:disabled):not([aria-checked="true"]){color:var(--dsw-alias-label-primary,#101828)}
326
- .dpt-seg-btn[aria-checked="true"]{background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#101828);font-weight:600;box-shadow:0 1px 2px rgba(16,24,40,.12),0 0 0 .5px var(--dsw-alias-border-l1,#e3e7ee)}
333
+ .dpt-seg-btn[aria-checked="true"]{background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#101828);font-weight:600;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)}
327
334
  .dpt-seg-btn:disabled{cursor:default}
328
335
  .dpt-seg-btn:focus-visible,.dpt-input:focus-visible,.dpt-select:focus-visible{outline:2px solid var(--dpt-accent,#3370ff);outline-offset:1px}
329
336
  .dpt-field{display:flex;gap:6px;margin-top:8px}
330
- .dpt-input,.dpt-select{flex:1;min-width:0;box-sizing:border-box;height:28px;padding:0 8px;border:.5px solid var(--dsw-alias-border-l2,#d6dce6);border-radius:8px;background:var(--dsw-alias-bg-base,#fff);color:inherit;font:inherit;font-size:12px}
337
+ .dpt-input,.dpt-select{flex:1;min-width:0;box-sizing:border-box;height:28px;padding:0 8px;border:1px solid var(--dpt-line);border-radius:8px;background:var(--dsw-alias-bg-base,#fff);color:inherit;font:inherit;font-size:12px}
331
338
  .dpt-btn-block{display:flex;width:100%}
332
339
  .dpt-side-hint[data-tone="warn"]{color:var(--dsw-alias-state-warn-primary,#b45309)}
333
340
  .dpt-tool-failures{margin:0 0 8px;padding:8px 10px;border-radius:10px;background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d97706) 10%,transparent);font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#4a5565)}
@@ -339,14 +346,13 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
339
346
  .dpt-side-note[data-tone="error"]{color:var(--dsw-alias-state-error-primary,#c4321f)}
340
347
  .dpt-agents-list{list-style:none;margin:0;padding:0;overflow:visible;min-height:0}
341
348
  .dpt-agent{display:flex;align-items:flex-start;gap:10px;width:100%;box-sizing:border-box;padding:7px 8px 7px calc(8px + var(--dpt-depth,0) * 14px);border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background-color 120ms}
342
- .dpt-agent:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
349
+ .dpt-agent:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 7%,transparent)}
343
350
  .dpt-agent:disabled{cursor:default}
344
351
  .dpt-agent-dot{flex:none;width:8px;height:8px;margin-top:6px;border-radius:50%;background:var(--dsw-alias-label-tertiary,#98a2b3)}
345
- .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)}
346
- ${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}
347
- @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)}}
348
- .dpt-agent[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
349
- .dpt-job[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
352
+ .dpt-agent[data-state="running"] .dpt-agent-dot,.dpt-capsule[data-state="running"] .dpt-agent-dot,.dpt-job[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff);box-shadow:0 0 6px 2px color-mix(in srgb,var(--dpt-accent,#3370ff) 60%,transparent)}
353
+ ${ON} .dpt-capsule[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}
354
+ @keyframes dpt-dot-flash{0%,100%{opacity:1}50%{opacity:.35}}
355
+ .dpt-agent[data-state="completed"] .dpt-agent-dot,.dpt-job[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
350
356
  .dpt-job[data-state="stopping"] .dpt-agent-dot,.dpt-job[data-state="killed"] .dpt-agent-dot{background:var(--dsw-alias-state-warn-primary,#b45309)}
351
357
  .dpt-job[data-state="failed"] .dpt-agent-dot{background:var(--dsw-alias-state-error-primary,#c4321f)}
352
358
  .dpt-side-effects .dpt-side-label{align-items:center}
@@ -358,32 +364,35 @@ ${ON} .dpt-agents-pill[data-state="running"] .dpt-agent-dot,${ON} .dpt-agent[dat
358
364
  .dpt-agent-main{flex:1;min-width:0;display:flex;flex-direction:column}
359
365
  .dpt-agent-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
360
366
  .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}
361
- .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}
362
- .dpt-agents-pill .dpt-agent-dot{margin-top:0}
363
- .dpt-agents,.dpt-agents-pill{--dpt-line:var(--dsw-alias-border-l1,#e3e7ee)}
364
- .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)}
365
- .dpt-agents-head{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--dpt-line)}
366
- .dpt-agents-title{display:flex;align-items:center;gap:8px}
367
- .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)}
368
- .dpt-agents .dpt-icon-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
369
- .dpt-agents .dpt-icon-btn:hover{background:color-mix(in srgb,var(--dpt-accent) 10%,transparent)}
370
- .dpt-agents .dpt-side-section+.dpt-side-section{border-top:1px solid var(--dpt-line)}
371
- .dpt-agents .dpt-seg{background:color-mix(in srgb,var(--dpt-accent) 9%,transparent)}
372
- .dpt-agents .dpt-seg-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
373
- .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)}
374
- .dpt-agents .dpt-input,.dpt-agents .dpt-select{background:#fff;border:1px solid var(--dpt-line)}
375
- .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}
376
- .dpt-agents .dpt-btn:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 8%,#fff)}
377
- .dpt-agents .dpt-agent:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 7%,transparent)}
378
- .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)}
379
- ${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)}
380
- [data-conversation-region="chat"][data-dpt-docked]{margin-right:272px!important}
381
- .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}
382
- @keyframes dpt-fade-in{from{opacity:0}to{opacity:1}}
367
+ .dpt-capsule-row{display:flex;flex-direction:column;align-items:flex-end;padding:4px 2px 0}
368
+ .dpt-capsule{display:inline-flex;align-items:center;gap:8px;max-width:100%;height:26px;padding:0 11px;box-sizing:border-box;border-radius:999px;border:1px solid var(--dpt-line);background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-secondary,#4a5565);font:inherit;font-size:12px;cursor:pointer;transition:border-color 120ms,color 120ms}
369
+ .dpt-capsule>span:last-child{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
370
+ .dpt-capsule:hover,.dpt-capsule[aria-expanded="true"]{color:var(--dsw-alias-label-primary,#101828);border-color:color-mix(in srgb,var(--dpt-accent) 40%,transparent)}
371
+ .dpt-capsule .dpt-agent-dot{margin-top:0}
372
+ .dpt-capsule-row>.dpt-panel{align-self:stretch}
373
+ .dpt-tab-title{display:inline-flex;align-items:center;gap:6px}
374
+ .dpt-tab-title::before,.dpt-panel-mark::before{content:"";width:8px;height:8px;border-radius:50%;background:linear-gradient(135deg,var(--dpt-brand-light,#7fb0ff),var(--dpt-accent,#3370ff))}
375
+ .dpt-settings{display:grid;gap:22px;max-width:640px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary,#101828)}
376
+ .dpt-settings h3{margin:0 0 10px;font-size:14px;line-height:20px;font-weight:600}
377
+ .dpt-settings .dpt-side-section{padding:0}
378
+ .dpt-settings .dpt-side-section+.dpt-side-section{border:0;padding:0}
379
+ .dpt-settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}
380
+ .dpt-diag{margin:8px 0 0;padding:10px 12px;max-height:220px;overflow:auto;border-radius:10px;border:1px solid var(--dpt-line);font:11px/16px var(--ds-font-family-code,ui-monospace,monospace);white-space:pre-wrap;word-break:break-word}
381
+ .dpt-files{display:grid;gap:1px;list-style:none;margin:0;padding:0}
382
+ .dpt-file{display:flex;align-items:center;gap:6px;min-width:0;height:22px;padding:0 6px;border-radius:6px;font-size:12px;line-height:18px}
383
+ .dpt-file:hover{background:color-mix(in srgb,var(--dpt-accent) 6%,transparent)}
384
+ .dpt-file-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:11.5px}
385
+ .dpt-file-meta{flex:none;max-width:45%;font-size:11px;color:var(--dsw-alias-label-tertiary,#667085);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
386
+ .dpt-file[data-kind="presented"] .dpt-file-name{color:var(--dpt-accent,#3370ff)}
387
+ .dpt-files-more{padding:0 6px}
388
+ .dpt-files-more summary{cursor:pointer;height:22px;font-size:11px;line-height:22px;color:var(--dsw-alias-label-tertiary,#667085)}
389
+ .dpt-host .dpt-agent-dot{width:6px;height:6px;margin-top:0}
390
+ .dpt-host[data-state="ok"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
391
+ .dpt-host[data-state="failed"] .dpt-agent-dot{background:var(--dsw-alias-state-error-primary,#c4321f)}
383
392
  [data-chat-flow-kind="command"]:has([data-dpt-hidden-command]){display:none!important}
384
393
  .dpt-command-error{padding:4px 2px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary,#c4321f)}
385
394
  @keyframes dpt-rise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
386
- @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}}
395
+ @media (prefers-reduced-motion:reduce){.dpt-card,.dpt-panel,.dpt-capsule,.dpt-agent-dot,.dpt-switch,.dpt-switch-thumb{animation:none!important;transition:none!important}}
387
396
  `;
388
397
  const THEME_CSS = `
389
398
  ${ON}{--dpt-dur-fast:120ms;--dpt-dur-base:200ms;--dpt-ease-out:cubic-bezier(0.22,1,0.36,1);--dpt-brand:#3370ff;--dpt-brand-ink:#1f4fc4;--dpt-brand-light:color-mix(in srgb,var(--dpt-brand) 70%,#7fd0ff)}
@@ -424,18 +433,19 @@ ${ON0} :where(button,[role="button"],[role="menuitem"],[role="tab"],a,summary,se
424
433
  }
425
434
  ${ON0} :where(button:active:not(:disabled),[role="button"]:active:not([aria-disabled="true"])){transform:scale(0.98)}
426
435
  ${ON} ::selection{background:color-mix(in srgb,var(--dpt-brand) 24%,transparent)}
427
- ${ON} [data-dpt-composer]{box-shadow:0 10px 30px rgba(16,24,40,0.07),0 2px 6px rgba(16,24,40,0.05);transition:border-color var(--dpt-dur-base) var(--dpt-ease-out),box-shadow var(--dpt-dur-base) var(--dpt-ease-out),transform var(--dpt-dur-base) var(--dpt-ease-out)}
428
- ${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)}
429
- ${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)}
430
- ${ON} [data-dpt-composer]:focus-within::before{opacity:1;animation:dpt-sheen 5s linear infinite}
431
- ${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}
432
- ${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%)}
436
+ ${ON} ${COMPOSER}{position:relative;box-shadow:0 10px 30px rgba(16,24,40,0.07),0 2px 6px rgba(16,24,40,0.05);transition:border-color var(--dpt-dur-base) var(--dpt-ease-out),box-shadow var(--dpt-dur-base) var(--dpt-ease-out)}
437
+ ${ON_DARK} ${COMPOSER}{box-shadow:0 10px 30px rgba(0,0,0,0.45),0 2px 6px rgba(0,0,0,0.35)}
438
+ ${ON} ${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)}
439
+ ${ON} ${COMPOSER}:focus-within::before{opacity:1}
440
+ ${ON} ${COMPOSER}::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;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) 46%,transparent),0 14px 44px color-mix(in srgb,var(--dpt-brand) 22%,transparent);transition:opacity var(--dpt-dur-base) var(--dpt-ease-out)}
441
+ ${ON}:not([data-dpt-busy]) ${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}
442
+ ${ON} ${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%)}
433
443
  @keyframes dpt-sheen{from{background-position:0% 0}to{background-position:300% 0}}
434
444
  ${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}
435
445
  ${ON} [data-dpt-send]:not(:disabled):not([aria-disabled="true"]):hover{transform:translateY(-1px);box-shadow:0 8px 20px color-mix(in srgb,var(--dpt-brand) 46%,transparent);filter:saturate(1.08)}
436
446
  ${ON} [data-dpt-send]:not(:disabled):not([aria-disabled="true"]):active{transform:translateY(0) scale(0.94);transition-duration:60ms}
437
- ${ON} [data-dpt-bubble]{background-image:linear-gradient(90deg,color-mix(in srgb,var(--dpt-brand) 20%,transparent),color-mix(in srgb,var(--dpt-brand) 7%,transparent)) !important;background-color:transparent !important;color:var(--dsw-alias-label-primary) !important;border-radius:18px 18px 6px 18px !important;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dpt-brand) 16%,transparent);animation:dpt-bubble-rise var(--dpt-dur-base) var(--dpt-ease-out) both}
438
- ${ON} [data-dpt-bubble] *{color:inherit}
447
+ ${ON} ${BUBBLE}{background-image:linear-gradient(90deg,color-mix(in srgb,var(--dpt-brand) 20%,transparent),color-mix(in srgb,var(--dpt-brand) 7%,transparent)) !important;background-color:transparent !important;color:var(--dsw-alias-label-primary) !important;border-radius:18px 18px 6px 18px !important;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dpt-brand) 16%,transparent);animation:dpt-bubble-rise var(--dpt-dur-base) var(--dpt-ease-out) both}
448
+ ${ON} ${BUBBLE} *{color:inherit}
439
449
  @keyframes dpt-bubble-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
440
450
  ${ON} [data-chat-flow-kind="assistant-step"]{font-size:15px}
441
451
  ${ON} [data-chat-flow-kind="assistant-step"] :is(p,li){line-height:1.82}
@@ -446,32 +456,18 @@ ${ON} [data-row-key^="session:"][role="treeitem"]{transition:background-color va
446
456
  ${ON} [data-row-key^="session:"][role="treeitem"]:hover{background-color:color-mix(in srgb,var(--dpt-brand) 7%,transparent)}
447
457
  ${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%)}
448
458
  ${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}
449
- ${ON}[data-dpt-busy] [data-dpt-composer]::before{opacity:1;padding:2.5px;animation:dpt-sheen 1.6s linear infinite}
450
- ${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}
451
- @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)}}
452
- ${ON} [data-dpt-composer][data-dpt-done]{animation:dpt-done 900ms var(--dpt-ease-out) 1}
459
+ ${ON}[data-dpt-busy] ${COMPOSER}::before{opacity:1;padding:2.5px;animation:dpt-sheen 1.6s linear infinite}
460
+ ${ON}[data-dpt-busy] ${COMPOSER}{border-color:color-mix(in srgb,var(--dpt-brand) 55%,transparent) !important}
461
+ ${ON}[data-dpt-busy] ${COMPOSER}::after{animation:dpt-glow 1.9s ease-in-out infinite}
462
+ @keyframes dpt-glow{0%,100%{opacity:.3}50%{opacity:1}}
463
+ ${ON} ${COMPOSER}[data-dpt-done]{animation:dpt-done 900ms var(--dpt-ease-out) 1}
453
464
  @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)}}
454
465
  ${ON}[data-dpt-busy] [data-dpt-send]{position:relative}
455
466
  ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-4px;border-radius:50%;padding:2.5px;pointer-events:none;background:conic-gradient(from 0deg,transparent 0 40%,var(--dpt-brand-light) 70%,#fff 100%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;animation:dpt-spin 1.1s linear infinite}
456
467
  @keyframes dpt-spin{to{transform:rotate(360deg)}}
457
- .dpt-pal-backdrop{position:fixed;inset:0;z-index:2147483000;display:flex;justify-content:center;align-items:flex-start;padding-top:14vh;background:color-mix(in srgb,#0b1220 32%,transparent);-webkit-backdrop-filter:blur(8px) saturate(1.1);backdrop-filter:blur(8px) saturate(1.1);animation:dpt-fade 200ms cubic-bezier(.22,1,.36,1) both}
458
- .dpt-pal{position:relative;width:min(600px,92vw);overflow:hidden;border-radius:20px;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#101828);border:1px solid var(--dsw-alias-border-l2,#d6dce6);box-shadow:0 24px 70px rgba(11,18,32,0.35);font:14px/1.5 var(--ds-font-family,system-ui,sans-serif);animation:dpt-pop 200ms cubic-bezier(.22,1,.36,1) both}
459
- .dpt-pal::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,var(--dpt-brand,#3370ff),var(--dpt-brand-light,#7fb0ff),var(--dpt-brand,#3370ff));background-size:200% 100%;animation:dpt-sheen 6s linear infinite}
460
- .dpt-pal-input{display:block;width:100%;box-sizing:border-box;padding:18px 20px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:16px;border-bottom:1px solid var(--dsw-alias-border-l1,#e3e7ee)}
461
- .dpt-pal-input::placeholder{color:var(--dsw-alias-label-tertiary,#667085)}
462
- .dpt-pal-list{max-height:min(52vh,420px);overflow:auto;padding:8px}
463
- .dpt-pal-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:12px;cursor:pointer;transition:background-color 120ms}
464
- .dpt-pal-item[aria-selected="true"]{background-image:linear-gradient(90deg,color-mix(in srgb,var(--dpt-brand,#3370ff) 20%,transparent),color-mix(in srgb,var(--dpt-brand,#3370ff) 7%,transparent))}
465
- .dpt-pal-kind{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:color-mix(in srgb,var(--dpt-brand,#3370ff) 12%,transparent);color:var(--dpt-brand-ink,#1f4fc4)}
466
- .dpt-pal-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
467
- .dpt-pal-sub{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary,#667085)}
468
- .dpt-pal-empty{padding:22px;text-align:center;color:var(--dsw-alias-label-tertiary,#667085)}
469
- .dpt-pal-foot{display:flex;gap:16px;padding:9px 20px;font-size:12px;color:var(--dsw-alias-label-tertiary,#667085);border-top:1px solid var(--dsw-alias-border-l1,#e3e7ee)}
470
- @keyframes dpt-fade{from{opacity:0}to{opacity:1}}
471
- @keyframes dpt-pop{from{opacity:0;transform:translateY(8px) scale(0.98)}to{opacity:1;transform:none}}
472
468
  .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}
473
469
  @keyframes dpt-ripple{0%{transform:scale(.3);opacity:1}100%{transform:scale(7);opacity:0}}
474
- .dpt-fx{position:fixed;inset:0;width:100vw;height:100vh;z-index:2147482000;pointer-events:none;-webkit-app-region:initial!important}
470
+ .dpt-fx{position:fixed;left:0;top:0;z-index:2147482000;pointer-events:none;-webkit-app-region:initial!important}
475
471
  @media (prefers-reduced-motion:reduce){
476
472
  ${ON} *,${ON} *::before,${ON} *::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important}
477
473
  }
@@ -491,12 +487,21 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
491
487
 
492
488
  // ---------------------------------------------------------------------------------------------
493
489
  // Which session is on screen. Each conversation header mounts a hidden bridge; the visible one
494
- // in the main conversation decides whether the refined look is on and whether the agent works.
490
+ // in the main conversation decides whether the effects are on and whether the agent works. An
491
+ // IntersectionObserver on each bridge's container reports when a conversation is shown or hidden
492
+ // without remounting (split views, a fullscreen sidebar).
495
493
  // ---------------------------------------------------------------------------------------------
496
494
  const SESSIONS = {
497
495
  map: new Map(), subs: new Set(),
498
- // Sessions whose subagents are running, reported by the side card (Deep PTC sessions only).
496
+ // Sessions whose subagents are running, reported by the capsule (Deep PTC sessions only).
499
497
  working: new Map(),
498
+ visibility: undefined,
499
+ watch(element) {
500
+ if (!element || typeof IntersectionObserver !== 'function') return () => {};
501
+ this.visibility ??= new IntersectionObserver(() => this.emit());
502
+ this.visibility.observe(element);
503
+ return () => this.visibility?.unobserve(element);
504
+ },
500
505
  setWorking(id, value) { if (this.working.get(id) === value) return; if (value) this.working.set(id, true); else this.working.delete(id); this.emit(); },
501
506
  set(id, value) { this.map.set(id, value); this.emit(); },
502
507
  del(id) { this.map.delete(id); this.emit(); },
@@ -512,37 +517,53 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
512
517
  return pick ?? fallback;
513
518
  },
514
519
  };
515
- const BUSY = { bridge: false, dom: false, was: false, timer: 0 };
520
+
521
+ // ---------------------------------------------------------------------------------------------
522
+ // The visual effects switch. Without an explicit choice the effects are on, unless an appearance
523
+ // plugin restyles the same composer and bubbles. The host's module loader tags every plugin's
524
+ // <style> with data-plugin, so detection reads only that host-guaranteed marker.
525
+ // ---------------------------------------------------------------------------------------------
516
526
  const EFFECTS_KEY = `${PLUGIN}:visual-effects`;
517
- function readEffects() {
518
- try { return localStorage.getItem(EFFECTS_KEY) !== '0'; } catch { return true; }
527
+ const APPEARANCE_PLUGINS = ['dsh-claude-style', 'dsh-refined-ui'];
528
+ function appearancePlugin() {
529
+ if (typeof document === 'undefined') return undefined;
530
+ return APPEARANCE_PLUGINS.find(name => document.querySelector(`style[data-plugin="${name}"]`) !== null);
531
+ }
532
+ function storedEffects() {
533
+ try {
534
+ const value = localStorage.getItem(EFFECTS_KEY);
535
+ return value === '1' ? true : value === '0' ? false : undefined;
536
+ } catch { return undefined; }
519
537
  }
520
- let effectsEnabled = readEffects();
538
+ let effectsChoice = storedEffects();
521
539
  const effectListeners = new Set();
522
- const getEffects = () => effectsEnabled;
540
+ const getEffects = () => effectsChoice ?? appearancePlugin() === undefined;
541
+ const getEffectsChoice = () => effectsChoice;
523
542
  function subscribeEffects(listener) {
524
543
  effectListeners.add(listener);
525
544
  return () => effectListeners.delete(listener);
526
545
  }
527
- function setEffects(enabled) {
528
- if (effectsEnabled === enabled) return;
529
- effectsEnabled = enabled;
546
+ function setEffectsChoice(choice) {
547
+ if (effectsChoice === choice) return;
548
+ effectsChoice = choice;
530
549
  for (const listener of effectListeners) listener();
531
550
  }
532
551
  function toggleEffects() {
533
- const enabled = !effectsEnabled;
552
+ const enabled = !getEffects();
534
553
  try { localStorage.setItem(EFFECTS_KEY, enabled ? '1' : '0'); } catch { /* use the in-memory preference */ }
535
- setEffects(enabled);
554
+ setEffectsChoice(enabled);
536
555
  }
537
- // The standalone dsh-refined-ui draws the same look; never stack both.
556
+ // The standalone dsh-refined-ui draws the same look; never stack both, whatever the switch says.
538
557
  const refinedPresent = () => typeof document !== 'undefined' && document.querySelector('style[data-plugin="dsh-refined-ui"]') !== null;
539
558
  const uiOn = () => typeof document !== 'undefined' && document.body?.hasAttribute('data-dpt-ui');
559
+
560
+ const BUSY = { on: false, was: false, timer: 0 };
540
561
  function applyBusy() {
541
562
  if (typeof document === 'undefined') return;
542
- const busy = uiOn() && (BUSY.bridge || BUSY.dom);
563
+ const busy = uiOn() && BUSY.on;
543
564
  document.body.toggleAttribute('data-dpt-busy', busy);
544
565
  if (BUSY.was && !busy && uiOn()) {
545
- const card = document.querySelector('[data-dpt-composer]');
566
+ const card = document.querySelector(COMPOSER);
546
567
  if (card) {
547
568
  card.setAttribute('data-dpt-done', '');
548
569
  clearTimeout(BUSY.timer);
@@ -551,6 +572,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
551
572
  }
552
573
  BUSY.was = busy;
553
574
  }
575
+
554
576
  function watchActiveSession() {
555
577
  if (typeof document === 'undefined') return () => {};
556
578
  let stopVisuals;
@@ -563,255 +585,79 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
563
585
  }
564
586
  const update = () => {
565
587
  const current = SESSIONS.current();
566
- const on = effectsEnabled && current?.preset === 'deep-ptc' && !refinedPresent();
588
+ const on = getEffects() && current?.preset === 'deep-ptc' && !refinedPresent();
567
589
  document.body.toggleAttribute('data-dpt-ui', on);
568
590
  // Like dsh-refined-ui, a running subagent keeps the conversation working.
569
- BUSY.bridge = on && (current?.busy === true || SESSIONS.working.get(current?.id) === true);
591
+ BUSY.on = on && (current?.busy === true || SESSIONS.working.get(current?.id) === true);
570
592
  applyBusy();
571
593
  if (on && !stopVisuals) {
572
- const cleanups = [watchSurfaces(), watchPalette(), watchInteractions(), watchFx(), watchDiagnostics()];
594
+ const cleanups = [watchSurfaces(), watchFx()];
573
595
  stopVisuals = () => cleanups.reverse().forEach(cleanup => cleanup());
574
596
  } else if (!on) disableVisuals();
575
597
  };
576
598
  SESSIONS.subs.add(update);
577
599
  const unsubscribe = subscribeEffects(update);
578
- const sync = event => { if (event.key === EFFECTS_KEY || event.key === null) setEffects(readEffects()); };
600
+ const sync = event => { if (event.key === EFFECTS_KEY || event.key === null) setEffectsChoice(storedEffects()); };
579
601
  window.addEventListener('storage', sync);
580
- // Visibility changes without a remount (split views, tab switches) are caught here.
581
- const timer = setInterval(update, 1000);
582
602
  update();
583
603
  return () => {
584
604
  SESSIONS.subs.delete(update);
585
605
  unsubscribe();
586
606
  window.removeEventListener('storage', sync);
587
- clearInterval(timer);
588
607
  document.body.removeAttribute('data-dpt-ui');
589
608
  document.body.removeAttribute('data-dpt-busy');
590
- BUSY.bridge = false;
609
+ BUSY.on = false;
591
610
  BUSY.was = false;
592
611
  disableVisuals();
593
612
  };
594
613
  }
595
614
 
596
- // Tag the composer card, its send button and the user bubbles so the CSS needs no hashed class
597
- // names. Only data-dpt-* attributes (and position:relative on a static composer) are written.
615
+ // The send button carries no stable host attribute: it is the right-most button in the composer
616
+ // card. Pointer effects (spotlight, magnetic send button, click ripple) read layout at most once
617
+ // per animation frame, whatever the pointer rate.
598
618
  function watchSurfaces() {
599
619
  if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return () => {};
620
+ const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;
600
621
  const tagged = new Set();
601
- const relativized = new Map();
602
622
  const highlighted = new Set();
603
- let frame = 0;
604
- const mark = (node, attribute) => { node.setAttribute(attribute, ''); tagged.add([node, attribute]); };
605
- const findComposer = input => {
606
- for (let node = input.parentElement, depth = 0; node && node !== document.body && depth < 8; node = node.parentElement, depth++) {
607
- const style = getComputedStyle(node);
608
- const round = parseFloat(style.borderTopLeftRadius) >= 14;
609
- const framed = style.boxShadow !== 'none' || parseFloat(style.borderTopWidth) > 0;
610
- if (round && framed) return node;
611
- }
612
- return null;
613
- };
614
- function tagComposer() {
615
- for (const input of document.querySelectorAll('[data-composer-input]')) {
616
- let card = input.closest('[data-dpt-composer]');
617
- if (!card) {
618
- card = findComposer(input);
619
- if (!card) continue;
620
- mark(card, 'data-dpt-composer');
621
- if (getComputedStyle(card).position === 'static') {
622
- relativized.set(card, [card.style.position, card.style.getPropertyPriority('position')]);
623
- card.style.position = 'relative';
624
- }
625
- }
623
+ let tagFrame = 0, pointerFrame = 0, pointer = null, magnet = null;
624
+ function tagSend() {
625
+ tagFrame = 0;
626
+ for (const card of document.querySelectorAll(COMPOSER)) {
626
627
  if (card.querySelector('[data-dpt-send]')) continue;
627
- // The send button is the right-most button in the card.
628
628
  let best = null, bestRight = -1;
629
629
  for (const button of card.querySelectorAll('button,[role="button"]')) {
630
630
  const rect = button.getBoundingClientRect();
631
631
  if (rect.width > 0 && rect.right >= bestRight) { best = button; bestRight = rect.right; }
632
632
  }
633
- if (best) mark(best, 'data-dpt-send');
633
+ if (best) { best.setAttribute('data-dpt-send', ''); tagged.add(best); }
634
634
  }
635
635
  }
636
- function tagBubbles() {
637
- for (const row of document.querySelectorAll('[data-chat-flow-kind="user"],[data-chat-flow-kind="steering"]')) {
638
- if (row.querySelector('[data-dpt-bubble]')) continue;
639
- const nodes = row.querySelectorAll('*');
640
- for (let index = 0; index < nodes.length && index < 60; index++) {
641
- const node = nodes[index];
642
- if (node.tagName === 'BUTTON' || node.tagName === 'SVG' || !node.textContent?.trim()) continue;
643
- const style = getComputedStyle(node);
644
- const filled = style.backgroundColor && style.backgroundColor !== 'transparent' && style.backgroundColor !== 'rgba(0, 0, 0, 0)';
645
- if (filled && parseFloat(style.borderTopLeftRadius) >= 10) { mark(node, 'data-dpt-bubble'); break; }
646
- }
636
+ function track() {
637
+ pointerFrame = 0;
638
+ const event = pointer;
639
+ pointer = null;
640
+ if (!event || !uiOn()) return;
641
+ const host = event.target?.closest?.(`[data-row-key^="session:"],${COMPOSER}`);
642
+ if (host) {
643
+ const rect = host.getBoundingClientRect();
644
+ host.style.setProperty('--dpt-mx', `${event.x - rect.left}px`);
645
+ host.style.setProperty('--dpt-my', `${event.y - rect.top}px`);
646
+ highlighted.add(host);
647
647
  }
648
+ if (reduce) return;
649
+ const button = document.querySelector('[data-dpt-send]');
650
+ if (magnet && magnet !== button) { magnet.style.translate = ''; magnet = null; }
651
+ if (!button) return;
652
+ const rect = button.getBoundingClientRect();
653
+ const dx = event.x - (rect.left + rect.width / 2), dy = event.y - (rect.top + rect.height / 2);
654
+ if (Math.hypot(dx, dy) < 70) { button.style.translate = `${(dx * 0.18).toFixed(1)}px ${(dy * 0.18).toFixed(1)}px`; magnet = button; }
655
+ else if (magnet) { button.style.translate = ''; magnet = null; }
648
656
  }
649
657
  function onMove(event) {
650
- const host = event.target?.closest?.('[data-row-key^="session:"],[data-dpt-composer]');
651
- if (!host || !uiOn()) return;
652
- const rect = host.getBoundingClientRect();
653
- host.style.setProperty('--dpt-mx', `${event.clientX - rect.left}px`);
654
- host.style.setProperty('--dpt-my', `${event.clientY - rect.top}px`);
655
- highlighted.add(host);
656
- }
657
- const run = () => {
658
- frame = 0;
659
- tagComposer();
660
- tagBubbles();
661
- BUSY.dom = document.querySelector('[data-streaming="true"]') !== null;
662
- applyBusy();
663
- };
664
- const schedule = () => { if (!frame) frame = requestAnimationFrame(run); };
665
- const observer = new MutationObserver(schedule);
666
- observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-streaming'] });
667
- document.addEventListener('pointermove', onMove, { capture: true, passive: true });
668
- schedule();
669
- return () => {
670
- observer.disconnect();
671
- document.removeEventListener('pointermove', onMove, true);
672
- if (frame) cancelAnimationFrame(frame);
673
- BUSY.dom = false;
674
- applyBusy();
675
- for (const [node, attribute] of tagged) node.removeAttribute(attribute);
676
- tagged.clear();
677
- for (const [node, [position, priority]] of relativized) {
678
- if (node.style.position === 'relative') node.style.setProperty('position', position, priority);
679
- }
680
- for (const node of highlighted) {
681
- node.style.removeProperty('--dpt-mx');
682
- node.style.removeProperty('--dpt-my');
683
- }
684
- };
685
- }
686
-
687
- // Ctrl/Cmd+K palette. It only clicks entries the host already renders.
688
- const PANEL = { toggle() {}, state: {} };
689
- const FX = { burst() {} };
690
- function findClickable(labels) {
691
- let fallback = null;
692
- for (const node of document.querySelectorAll('button,[role="button"],[role="treeitem"],[role="menuitem"],a,div,span')) {
693
- if (!labels.includes((node.textContent ?? '').trim()) || node.closest('[data-dpt-palette]')) continue;
694
- const role = node.getAttribute('role');
695
- if (node.tagName === 'BUTTON' || node.tagName === 'A' || role === 'button' || role === 'treeitem' || role === 'menuitem') return node;
696
- fallback ??= node;
697
- }
698
- return fallback;
699
- }
700
- function paletteItems() {
701
- const items = [];
702
- for (const [labels, sub] of [[['新会话', 'New session'], 'palNewSub'], [['插件', 'Plugins'], 'palPluginsSub'], [['自动化任务', 'Automations'], 'palAutomationSub']]) {
703
- const node = findClickable(labels);
704
- if (node) items.push({ kind: T('palCommand'), title: (node.textContent ?? '').trim(), sub: T(sub), run: () => node.click() });
658
+ pointer = { x: event.clientX, y: event.clientY, target: event.target };
659
+ if (!pointerFrame) pointerFrame = requestAnimationFrame(track);
705
660
  }
706
- items.push({ kind: T('palEffect'), title: T('palAgents'), sub: T('palAgentsSub'), run: () => PANEL.toggle() });
707
- items.push({ kind: T('palEffect'), title: T('palFireworks'), sub: T('palFireworksSub'), run: () => FX.burst() });
708
- const rows = document.querySelectorAll('[data-row-key^="session:"]');
709
- for (let index = 0; index < rows.length && index < 80; index++) {
710
- const row = rows[index];
711
- const lines = (row.innerText ?? '').split('\n').map(line => line.trim()).filter(Boolean);
712
- if (lines.length) items.push({ kind: T('palSession'), title: lines[0], sub: lines.length > 1 ? lines.at(-1) : '', run: () => row.click() });
713
- }
714
- return items;
715
- }
716
- function watchPalette() {
717
- if (typeof document === 'undefined') return () => {};
718
- let backdrop = null, panel, foot, input, list, items = [], shown = [], index = 0;
719
- const close = () => { backdrop?.remove(); backdrop = null; };
720
- function mark() {
721
- for (let at = 0; at < list.children.length; at++) list.children[at].setAttribute('aria-selected', at === index ? 'true' : 'false');
722
- list.children[index]?.scrollIntoView?.({ block: 'nearest' });
723
- }
724
- function render() {
725
- list.textContent = '';
726
- if (!shown.length) {
727
- const empty = document.createElement('div');
728
- empty.className = 'dpt-pal-empty';
729
- empty.textContent = T('palEmpty');
730
- list.appendChild(empty);
731
- return;
732
- }
733
- shown.forEach((item, at) => {
734
- const row = document.createElement('div');
735
- row.className = 'dpt-pal-item';
736
- row.setAttribute('role', 'option');
737
- const kind = document.createElement('span'); kind.className = 'dpt-pal-kind'; kind.textContent = item.kind;
738
- const title = document.createElement('span'); title.className = 'dpt-pal-title'; title.textContent = item.title;
739
- const sub = document.createElement('span'); sub.className = 'dpt-pal-sub'; sub.textContent = item.sub;
740
- row.append(kind, title, sub);
741
- row.addEventListener('pointermove', () => { if (index !== at) { index = at; mark(); } });
742
- row.addEventListener('click', () => choose(at));
743
- list.appendChild(row);
744
- });
745
- mark();
746
- }
747
- function filter() {
748
- const query = input.value.trim().toLowerCase();
749
- shown = query ? items.filter(item => `${item.title} ${item.kind}`.toLowerCase().includes(query)) : items.slice(0, 12);
750
- index = 0;
751
- render();
752
- }
753
- function choose(at) {
754
- const item = shown[at];
755
- if (!item) return;
756
- close();
757
- setTimeout(() => { try { item.run(); } catch (error) { console.warn(`[${PLUGIN}] palette action failed:`, error); } }, 30);
758
- }
759
- function translatePalette() {
760
- if (!backdrop) return;
761
- panel.setAttribute('aria-label', T('palTitle'));
762
- input.placeholder = T('palPlaceholder');
763
- input.setAttribute('aria-label', input.placeholder);
764
- foot.textContent = T('palFoot');
765
- items = paletteItems();
766
- filter();
767
- }
768
- function open() {
769
- backdrop = document.createElement('div');
770
- backdrop.className = 'dpt-pal-backdrop';
771
- backdrop.setAttribute('data-dpt-palette', '');
772
- panel = document.createElement('div');
773
- panel.className = 'dpt-pal';
774
- panel.setAttribute('role', 'dialog');
775
- input = document.createElement('input');
776
- input.className = 'dpt-pal-input';
777
- list = document.createElement('div');
778
- list.className = 'dpt-pal-list';
779
- list.setAttribute('role', 'listbox');
780
- foot = document.createElement('div');
781
- foot.className = 'dpt-pal-foot';
782
- panel.append(input, list, foot);
783
- backdrop.appendChild(panel);
784
- document.body.appendChild(backdrop);
785
- backdrop.addEventListener('pointerdown', event => { if (event.target === backdrop) close(); });
786
- input.addEventListener('input', filter);
787
- input.addEventListener('keydown', event => {
788
- if (event.isComposing || event.keyCode === 229) return;
789
- if (event.key === 'ArrowDown') { event.preventDefault(); index = Math.min(index + 1, shown.length - 1); mark(); }
790
- else if (event.key === 'ArrowUp') { event.preventDefault(); index = Math.max(index - 1, 0); mark(); }
791
- else if (event.key === 'Enter') { event.preventDefault(); choose(index); }
792
- else if (event.key === 'Escape') { event.preventDefault(); close(); }
793
- });
794
- translatePalette();
795
- input.focus();
796
- }
797
- function onKey(event) {
798
- if (!(event.ctrlKey || event.metaKey) || event.altKey || event.shiftKey || (event.key !== 'k' && event.key !== 'K')) return;
799
- if (!backdrop && !uiOn()) return;
800
- event.preventDefault();
801
- event.stopPropagation();
802
- if (backdrop) close(); else open();
803
- }
804
- document.addEventListener('keydown', onKey, true);
805
- const unsubscribe = hostCtx.locale.subscribe?.(translatePalette);
806
- return () => { unsubscribe?.(); document.removeEventListener('keydown', onKey, true); close(); };
807
- }
808
-
809
- // Click ripple, magnetic send button, "/" focuses the composer, Alt+Up/Down switches sessions.
810
- function watchInteractions() {
811
- if (typeof document === 'undefined') return () => {};
812
- const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;
813
- let magnet = null;
814
- const typing = target => target && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/u.test(target.tagName));
815
661
  function onDown(event) {
816
662
  if (event.button !== 0 || reduce || !uiOn()) return;
817
663
  if (!event.target?.closest?.('button,a,[role=button],[role=treeitem],[role=tab],[role=menuitem],[role=option],summary')) return;
@@ -822,43 +668,32 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
822
668
  document.body.appendChild(ripple);
823
669
  setTimeout(() => ripple.remove(), 700);
824
670
  }
825
- function onMove(event) {
826
- const button = uiOn() ? document.querySelector('[data-dpt-send]') : null;
827
- if (magnet && magnet !== button) { magnet.style.translate = ''; magnet = null; }
828
- if (!button || reduce) return;
829
- const rect = button.getBoundingClientRect();
830
- const dx = event.clientX - (rect.left + rect.width / 2), dy = event.clientY - (rect.top + rect.height / 2);
831
- if (Math.hypot(dx, dy) < 70) { button.style.translate = `${(dx * 0.18).toFixed(1)}px ${(dy * 0.18).toFixed(1)}px`; magnet = button; }
832
- else if (magnet) { button.style.translate = ''; magnet = null; }
833
- }
834
- function onKey(event) {
835
- if (event.isComposing || event.keyCode === 229 || !uiOn() || document.querySelector('.dpt-pal-backdrop')) return;
836
- if (event.key === '/' && !event.ctrlKey && !event.metaKey && !event.altKey && !typing(event.target)) {
837
- const input = document.querySelector('[data-composer-input]');
838
- if (input) { event.preventDefault(); input.focus(); }
839
- return;
840
- }
841
- if (event.altKey && !event.ctrlKey && !event.metaKey && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
842
- const rows = [...document.querySelectorAll('[data-row-key^="session:"][role="treeitem"]')];
843
- if (!rows.length) return;
844
- const current = rows.findIndex(row => row.matches('[aria-selected="true"],[aria-current="true"],[data-selected="true"]'));
845
- const next = rows[Math.max(0, Math.min(rows.length - 1, current + (event.key === 'ArrowDown' ? 1 : -1)))];
846
- if (next && next !== rows[current]) { event.preventDefault(); next.click(); next.scrollIntoView({ block: 'nearest' }); }
847
- }
848
- }
849
- document.addEventListener('pointerdown', onDown, true);
850
- document.addEventListener('pointermove', onMove, true);
851
- document.addEventListener('keydown', onKey, true);
671
+ // Streaming text mutates the document constantly; each burst costs one cheap query per frame.
672
+ const observer = new MutationObserver(() => { if (!tagFrame) tagFrame = requestAnimationFrame(tagSend); });
673
+ observer.observe(document.body, { childList: true, subtree: true });
674
+ document.addEventListener('pointermove', onMove, { capture: true, passive: true });
675
+ document.addEventListener('pointerdown', onDown, { capture: true, passive: true });
676
+ tagSend();
852
677
  return () => {
853
- document.removeEventListener('pointerdown', onDown, true);
678
+ observer.disconnect();
854
679
  document.removeEventListener('pointermove', onMove, true);
855
- document.removeEventListener('keydown', onKey, true);
680
+ document.removeEventListener('pointerdown', onDown, true);
681
+ if (tagFrame) cancelAnimationFrame(tagFrame);
682
+ if (pointerFrame) cancelAnimationFrame(pointerFrame);
856
683
  if (magnet) magnet.style.translate = '';
684
+ for (const node of tagged) node.removeAttribute('data-dpt-send');
685
+ tagged.clear();
686
+ for (const node of highlighted) {
687
+ node.style.removeProperty('--dpt-mx');
688
+ node.style.removeProperty('--dpt-my');
689
+ }
857
690
  for (const node of document.querySelectorAll('.dpt-ripple')) node.remove();
858
691
  };
859
692
  }
860
693
 
861
- // Send burst, completion sparkle and embers while the agent works.
694
+ // Send burst, completion sparkle and embers while the agent works. The canvas covers only the
695
+ // composer and the space above it where the sparks rise, at no more than 1.5 device pixels per
696
+ // CSS pixel, and the frame loop stops whenever nothing moves or the window is hidden.
862
697
  function watchFx() {
863
698
  if (typeof document === 'undefined' || typeof requestAnimationFrame === 'undefined' || typeof MutationObserver === 'undefined'
864
699
  || window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches === true) return () => {};
@@ -868,60 +703,74 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
868
703
  const paint = canvas.getContext('2d');
869
704
  if (!paint) return () => {};
870
705
  document.body.appendChild(canvas);
871
- const dpr = Math.min(window.devicePixelRatio || 1, 2);
872
- let width = 0, height = 0, parts = [], raf = 0, lastEmber = 0;
873
- const fireworks = new Set();
706
+ const dpr = Math.min(window.devicePixelRatio || 1, 1.5);
707
+ const PAD_X = 48, PAD_TOP = 240, PAD_BOTTOM = 24, MAX_PARTS = 160;
874
708
  const hues = ['#3370ff', '#5b8cff', '#7fd0ff', '#9dbcff', '#b48cff', '#ffffff'];
709
+ let box, parts = [], raf = 0, lastEmber = 0;
875
710
  const busy = () => document.body.hasAttribute('data-dpt-busy');
876
711
  let wasBusy = busy();
877
- function resize() {
878
- width = window.innerWidth; height = window.innerHeight;
879
- canvas.width = width * dpr; canvas.height = height * dpr;
880
- paint.setTransform(dpr, 0, 0, dpr, 0, 0);
712
+ function place() {
713
+ const composer = document.querySelector(COMPOSER)?.getBoundingClientRect();
714
+ if (!composer || composer.width === 0) { box = undefined; canvas.style.display = 'none'; return; }
715
+ const left = Math.max(0, Math.floor(composer.left - PAD_X)), top = Math.max(0, Math.floor(composer.top - PAD_TOP));
716
+ const width = Math.max(1, Math.ceil(Math.min(window.innerWidth, composer.right + PAD_X) - left));
717
+ const height = Math.max(1, Math.ceil(Math.min(window.innerHeight, composer.bottom + PAD_BOTTOM) - top));
718
+ if (box?.width !== width || box?.height !== height) {
719
+ canvas.width = Math.round(width * dpr); canvas.height = Math.round(height * dpr);
720
+ canvas.style.width = `${width}px`; canvas.style.height = `${height}px`;
721
+ paint.setTransform(dpr, 0, 0, dpr, 0, 0);
722
+ }
723
+ if (box?.left !== left || box?.top !== top) canvas.style.transform = `translate(${left}px,${top}px)`;
724
+ canvas.style.display = '';
725
+ box = { left, top, width, height, composer };
881
726
  }
727
+ const kick = () => { if (!raf && !document.hidden) { place(); raf = requestAnimationFrame(frame); } };
882
728
  function burst(x, y, count, power) {
883
729
  if (!uiOn()) return;
884
- for (let index = 0; index < count; index++) {
730
+ for (let index = 0; index < count && parts.length < MAX_PARTS; index++) {
885
731
  const angle = Math.random() * Math.PI * 2, speed = (0.4 + Math.random()) * power;
886
732
  parts.push({ x, y, vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed - power * 0.35, life: 1,
887
733
  decay: 0.014 + Math.random() * 0.016, r: 1.4 + Math.random() * 2.4, color: hues[(Math.random() * hues.length) | 0] });
888
734
  }
889
735
  kick();
890
736
  }
891
- const kick = () => { if (!raf) raf = requestAnimationFrame(frame); };
892
- function frame() {
737
+ function frame(now) {
893
738
  raf = 0;
894
- paint.clearRect(0, 0, width, height);
895
- paint.globalCompositeOperation = 'lighter';
896
- const composer = document.querySelector('[data-dpt-composer]');
897
- const now = performance.now();
898
- // Embers rise from the composer while the agent works: twice as often as dsh-refined-ui, slightly larger.
899
- if (busy() && composer && now - lastEmber > 35) {
739
+ if (!box) { parts = []; return; }
740
+ paint.clearRect(0, 0, box.width, box.height);
741
+ // Embers rise from the composer while the agent works.
742
+ if (busy() && now - lastEmber > 35 && parts.length < MAX_PARTS) {
900
743
  lastEmber = now;
901
- const rect = composer.getBoundingClientRect();
744
+ const rect = box.composer;
902
745
  parts.push({ x: rect.left + 12 + Math.random() * (rect.width - 24), y: rect.top + 2, vx: (Math.random() - 0.5) * 0.5,
903
746
  vy: -(0.5 + Math.random() * 1.1), gravity: -0.004, life: 1, decay: 0.009 + Math.random() * 0.01,
904
747
  r: 1.8 + Math.random() * 2.4, color: hues[(Math.random() * 4) | 0] });
905
748
  }
906
- parts = parts.filter(part => part.life > 0);
749
+ paint.globalCompositeOperation = 'lighter';
750
+ let live = 0;
907
751
  for (const part of parts) {
908
752
  part.x += part.vx; part.y += part.vy; part.vy += part.gravity ?? 0.09; part.vx *= 0.985; part.life -= part.decay;
909
- paint.globalAlpha = Math.max(part.life, 0);
753
+ if (part.life <= 0) continue;
754
+ parts[live++] = part;
755
+ paint.globalAlpha = part.life;
910
756
  paint.fillStyle = part.color;
911
757
  paint.beginPath();
912
- paint.arc(part.x, part.y, part.r * (0.4 + part.life * 0.6), 0, 6.3);
758
+ paint.arc(part.x - box.left, part.y - box.top, part.r * (0.4 + part.life * 0.6), 0, 6.3);
913
759
  paint.fill();
914
760
  }
761
+ parts.length = live;
915
762
  paint.globalAlpha = 1;
916
763
  paint.globalCompositeOperation = 'source-over';
917
- if (parts.length || busy()) kick();
764
+ if (parts.length || busy()) raf = document.hidden ? 0 : requestAnimationFrame(frame);
765
+ else paint.clearRect(0, 0, box.width, box.height);
918
766
  }
919
767
  const center = node => { const rect = node.getBoundingClientRect(); return [rect.left + rect.width / 2, rect.top + rect.height / 2]; };
920
768
  function onDown(event) {
921
769
  const button = event.target?.closest?.('[data-dpt-send]');
922
770
  if (button && event.button === 0) burst(...center(button), 34, 4.2);
923
771
  }
924
- function onKey(event) {
772
+ // Sending with Enter bursts like a click; the key event is only observed, never consumed.
773
+ function onSend(event) {
925
774
  if (event.key !== 'Enter' || event.shiftKey || event.isComposing || event.keyCode === 229) return;
926
775
  if (!event.target?.closest?.('[data-composer-input]')) return;
927
776
  const button = document.querySelector('[data-dpt-send]');
@@ -930,9 +779,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
930
779
  const observer = new MutationObserver(() => {
931
780
  const now = busy();
932
781
  if (wasBusy && !now) {
933
- const composer = document.querySelector('[data-dpt-composer]');
934
- if (composer) {
935
- const rect = composer.getBoundingClientRect();
782
+ place();
783
+ const rect = box?.composer;
784
+ if (rect) {
936
785
  burst(rect.left + rect.width / 2, rect.top, 22, 3.2);
937
786
  burst(rect.left + rect.width * 0.25, rect.top, 10, 2.4);
938
787
  burst(rect.left + rect.width * 0.75, rect.top, 10, 2.4);
@@ -941,66 +790,37 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
941
790
  if (now) kick();
942
791
  wasBusy = now;
943
792
  });
944
- resize();
945
- window.addEventListener('resize', resize);
793
+ const onResize = () => { if (raf) place(); };
794
+ const onVisibility = () => { if (!document.hidden && (parts.length || busy())) kick(); };
795
+ window.addEventListener('resize', onResize);
796
+ document.addEventListener('visibilitychange', onVisibility);
946
797
  observer.observe(document.body, { attributes: true, attributeFilter: ['data-dpt-busy'] });
947
- document.addEventListener('pointerdown', onDown, true);
948
- document.addEventListener('keydown', onKey, true);
798
+ document.addEventListener('pointerdown', onDown, { capture: true, passive: true });
799
+ document.addEventListener('keydown', onSend, { capture: true, passive: true });
949
800
  if (wasBusy) kick();
950
- FX.burst = () => {
951
- [[0.3, 0.45], [0.5, 0.3], [0.7, 0.45]].forEach(([x, y], index) => {
952
- const timer = setTimeout(() => {
953
- fireworks.delete(timer);
954
- burst(width * x, height * y, 60, 5.6);
955
- }, index * 220);
956
- fireworks.add(timer);
957
- });
958
- };
959
801
  return () => {
960
- FX.burst = () => {};
961
- window.removeEventListener('resize', resize);
802
+ window.removeEventListener('resize', onResize);
803
+ document.removeEventListener('visibilitychange', onVisibility);
962
804
  document.removeEventListener('pointerdown', onDown, true);
963
- document.removeEventListener('keydown', onKey, true);
805
+ document.removeEventListener('keydown', onSend, true);
964
806
  observer.disconnect();
965
807
  if (raf) cancelAnimationFrame(raf);
966
- for (const timer of fireworks) clearTimeout(timer);
967
808
  canvas.remove();
968
809
  };
969
810
  }
970
811
 
971
- // Ctrl+Alt+D shows and copies a read-only outline of the markers this plugin relies on.
812
+ // A read-only outline of what the effects rely on, copied from the settings page for bug reports.
972
813
  function diagnostics() {
973
- const count = selector => document.querySelectorAll(selector).length;
814
+ const count = selector => typeof document === 'undefined' ? 0 : document.querySelectorAll(selector).length;
974
815
  const current = SESSIONS.current();
975
- const lines = [
976
- `${PLUGIN} client | ui=${uiOn()} busy=${document.body.hasAttribute('data-dpt-busy')} session=${current?.id ?? '-'} preset=${current?.preset ?? '-'} refined-ui=${refinedPresent()}`,
977
- `tags: composer=${count('[data-dpt-composer]')} send=${count('[data-dpt-send]')} bubble=${count('[data-dpt-bubble]')} docked=${count('[data-dpt-docked]')}`,
978
- `markers: composer-input=${count('[data-composer-input]')} user-rows=${count('[data-chat-flow-kind="user"]')} assistant=${count('[data-chat-flow-kind="assistant-step"]')} session-rows=${count('[data-row-key^="session:"]')} chat-regions=${count('[data-conversation-region="chat"]')} main=${count('[data-slot="main.conversation"]')}`,
979
- `cards: skills=${count('.dpt-skills')} side=${count('.dpt-agents')} pill=${count('.dpt-agents-pill')} side-state=${JSON.stringify(PANEL.state)}`,
980
- ];
981
- return lines.join('\n');
982
- }
983
- function watchDiagnostics() {
984
- if (typeof document === 'undefined') return () => {};
985
- let panel = null;
986
- const close = () => { panel?.remove(); panel = null; };
987
- function onKey(event) {
988
- if (!(event.ctrlKey && event.altKey && (event.key === 'd' || event.key === 'D'))) return;
989
- if (!panel && !uiOn()) return;
990
- event.preventDefault();
991
- if (panel) { close(); return; }
992
- const text = diagnostics();
993
- try { navigator.clipboard?.writeText(text); } catch { /* copying is a convenience */ }
994
- panel = document.createElement('pre');
995
- panel.dataset.plugin = PLUGIN;
996
- panel.textContent = text;
997
- panel.style.cssText = 'position:fixed;z-index:2147483647;right:12px;bottom:12px;max-width:760px;max-height:70vh;overflow:auto;margin:0;padding:10px 12px;background:#0b1220;color:#dbe7ff;font:11px/1.45 ui-monospace,Consolas,monospace;border-radius:10px;white-space:pre-wrap;box-shadow:0 10px 30px rgba(0,0,0,.4)';
998
- document.body.appendChild(panel);
999
- }
1000
- document.addEventListener('keydown', onKey, true);
1001
- return () => { document.removeEventListener('keydown', onKey, true); close(); };
816
+ return [
817
+ `${PLUGIN} client | effects=${getEffects()} choice=${String(effectsChoice)} appearance=${appearancePlugin() ?? '-'} ui=${uiOn()}`,
818
+ `session=${current?.id ?? '-'} preset=${current?.preset ?? '-'} busy=${current?.busy === true} working=${SESSIONS.working.size}`,
819
+ `host: composer=${count(COMPOSER)} input=${count('[data-composer-input]')} bubble=${count('[data-message-bubble]')} send=${count('[data-dpt-send]')}`,
820
+ `ui: capsule=${count('.dpt-capsule')} panel=${count('.dpt-panel')} skills=${count('.dpt-skills')}`,
821
+ `ua=${typeof navigator === 'undefined' ? '-' : navigator.userAgent}`,
822
+ ].join('\n');
1002
823
  }
1003
-
1004
824
  // ---------------------------------------------------------------------------------------------
1005
825
  // Skill card, at the end of the latest turn in the conversation.
1006
826
  // ---------------------------------------------------------------------------------------------
@@ -1016,11 +836,13 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1016
836
 
1017
837
  function VisualEffectsSection({ t }) {
1018
838
  const enabled = React.useSyncExternalStore(subscribeEffects, getEffects, getEffects);
839
+ const choice = React.useSyncExternalStore(subscribeEffects, getEffectsChoice, getEffectsChoice);
840
+ const appearance = choice === undefined ? appearancePlugin() : undefined;
1019
841
  const label = t('visualEffects');
1020
842
  return h('section', { className: 'dpt-side-section dpt-side-effects', 'aria-label': label },
1021
843
  h('div', { className: 'dpt-side-label' }, h('span', null, label),
1022
844
  h(SkillSwitch, { on: enabled, label, onChange: toggleEffects })),
1023
- h('p', { className: 'dpt-side-note' }, t('visualEffectsHint')));
845
+ h('p', { className: 'dpt-side-note' }, appearance ? tf(t, 'visualEffectsAuto', { name: appearance }) : t('visualEffectsHint')));
1024
846
  }
1025
847
 
1026
848
  function SkillCard({ turn, useProjection, useChat, setSkill, setAll, t }) {
@@ -1070,17 +892,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1070
892
  }
1071
893
 
1072
894
  // ---------------------------------------------------------------------------------------------
1073
- // Subagent panel beside the main conversation. Rows follow the official subagent catalog and
1074
- // timing projections; a row opens the official subagent chat in the right sidebar.
895
+ // The Deep PTC panel. Subagent rows follow the official subagent catalog and timing projections;
896
+ // a row opens the official subagent chat in the right sidebar.
1075
897
  // ---------------------------------------------------------------------------------------------
1076
898
  const AGENT_ROWS = 24;
1077
- const PANEL_WIDTH = 248;
1078
- // Docked, the card is a column split off the right side of the conversation, flush with its edge.
1079
- const SPLIT_WIDTH = 272;
1080
- const DOCK_MIN_WIDTH = 960;
1081
- const COLLAPSED_KEY = `${PLUGIN}:subagents-collapsed`;
1082
- const readCollapsed = () => { try { return localStorage.getItem(COLLAPSED_KEY) === '1'; } catch { return false; } };
1083
- const writeCollapsed = value => { try { localStorage.setItem(COLLAPSED_KEY, value ? '1' : '0'); } catch { /* per-viewer convenience only */ } };
1084
899
 
1085
900
  function subagentRows(sessions, rootId, now) {
1086
901
  const catalogOf = id => {
@@ -1140,42 +955,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1140
955
  const workspace = hostCtx?.get?.('uiWorkspace');
1141
956
  if (typeof workspace?.openSession === 'function') {
1142
957
  workspace.openSession({ parentSessionId: row.parentId, childSessionId: row.id, mode: row.mode });
1143
- return;
1144
958
  }
1145
- const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(row.id) : row.id;
1146
- document.querySelector(`[data-row-key="session:${escaped}"]`)?.click();
1147
- }
1148
-
1149
- // Where the panel sits: the right edge of this session's chat region, above the composer.
1150
- function useChatRegion(sessionId, enabled) {
1151
- const [layout, setLayout] = React.useState(undefined);
1152
- React.useEffect(() => {
1153
- if (!enabled || typeof document === 'undefined') { setLayout(undefined); return undefined; }
1154
- let last = '';
1155
- let lastRegion;
1156
- const measure = () => {
1157
- const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(sessionId) : sessionId;
1158
- const regions = [...document.querySelectorAll(`[data-conversation-region="chat"][data-conversation-session="${escaped}"]`)];
1159
- const anyMain = document.querySelector('[data-slot="main.conversation"]') !== null;
1160
- const region = regions.find(node => !anyMain || node.closest('[data-slot="main.conversation"]'));
1161
- const rect = region?.getBoundingClientRect();
1162
- if (!region || !rect || rect.width === 0) { if (last !== '-') { last = '-'; lastRegion = undefined; setLayout(undefined); } return; }
1163
- // Docked, the region gives up the column's width, so its parent marks the conversation's right edge.
1164
- const host = region.parentElement?.getBoundingClientRect() ?? rect;
1165
- const composer = region.querySelector('[data-composer-seat]')?.getBoundingClientRect();
1166
- const bottom = composer && composer.top > rect.top ? composer.top - 12 : rect.bottom - 12;
1167
- const next = { region, top: Math.round(rect.top + 12), right: Math.round(window.innerWidth - rect.right + 16),
1168
- maxHeight: Math.max(120, Math.round(bottom - rect.top - 12)), wide: host.width >= DOCK_MIN_WIDTH,
1169
- split: { top: Math.round(rect.top), right: Math.round(window.innerWidth - host.right), height: Math.round(rect.height) } };
1170
- const key = `${next.top}|${next.right}|${next.maxHeight}|${next.wide}|${next.split.top}|${next.split.right}|${next.split.height}`;
1171
- if (key !== last || region !== lastRegion) { last = key; lastRegion = region; setLayout(next); }
1172
- };
1173
- measure();
1174
- const timer = setInterval(measure, 400);
1175
- window.addEventListener('resize', measure);
1176
- return () => { clearInterval(timer); window.removeEventListener('resize', measure); };
1177
- }, [sessionId, enabled]);
1178
- return layout;
1179
959
  }
1180
960
 
1181
961
  // The execution environment for Deep PTC sessions created from now on. It writes the same host
@@ -1190,31 +970,40 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1190
970
  const envLabel = (value, t) => value === 'auto' ? t('envAuto') : ENV_SHORT[value] ?? value;
1191
971
  function shellLabel(label, t) {
1192
972
  if (label === 'PowerShell 7 Preview') return t('shellPreview');
973
+ if (label === 'PowerShell 7 (Microsoft Store)') return t('shellStore');
1193
974
  const system = /^(bash|zsh) \(system\)$/u.exec(label);
1194
975
  return system ? tf(t, 'shellSystem', { name: system[1] }) : label;
1195
976
  }
1196
977
 
978
+ // Only slots that show one entry are localized here. The settings page lists every entry of
979
+ // settings.section, so Deep PTC has its own page instead of a second Agent presets entry.
1197
980
  const PRESET_LABEL_SLOTS = [
1198
981
  ['conversation.hero.agentPreset', undefined, 'useAgentPresetSeat', 'options'],
1199
982
  ['conversation.session.header.actions', 'agent-preset', 'useAgentPresets', 'options'],
1200
- ['settings.section', 'agent-presets', 'useAgentPresetSection', 'rows'],
1201
983
  ];
1202
984
 
985
+ // The host publishes `Deep PTC · <status>` (presetDescription in lib/model.mjs), readable as is in
986
+ // any language. This reads the status back so the picker can show it in the active language.
987
+ const STATUS_PREFIX = 'Deep PTC · ';
988
+ const SAFE_LABEL = '安全模式 Safe mode';
989
+ const OFFICIAL_LABEL = '官方 Shell Official shell';
990
+ function presetStatus(description) {
991
+ if (typeof description !== 'string' || !description.startsWith(STATUS_PREFIX)) return undefined;
992
+ const text = description.slice(STATUS_PREFIX.length);
993
+ if (text.startsWith(SAFE_LABEL)) return { kind: 'safe', reason: text.slice(SAFE_LABEL.length).replace(/^:\s*/u, '') };
994
+ if (text === OFFICIAL_LABEL) return { kind: 'official' };
995
+ const environment = /^(WSL|PowerShell|Zsh|Bash)(?: \((.+)\))?$/u.exec(text);
996
+ return environment ? { kind: 'environment', label: environment[1], distribution: environment[2] } : undefined;
997
+ }
998
+
1203
999
  function translatedPreset(row, t) {
1204
1000
  if (row?.id !== 'deep-ptc') return row;
1205
- const name = t('presetName');
1206
- const description = row.description ?? '';
1207
- let status;
1208
- if (description.endsWith('当前为安全模式')) status = t('presetSafeMode');
1209
- else {
1210
- // The preset derivation publishes the mounted environment in this suffix.
1211
- const current = /当前环境:(\S+)(?: \(([^\n]*)\))?$/u.exec(description);
1212
- if (current) {
1213
- const shell = current[1] === '官方默认' ? t('presetOfficial') : envLabel(current[1], t);
1214
- status = tf(t, 'presetEnvironment', { env: current[2] ? `${shell} (${current[2]})` : shell });
1215
- }
1216
- }
1217
- return { ...row, name, description: [t('presetDescription'), status].filter(Boolean).join(' ') };
1001
+ const status = presetStatus(row.description);
1002
+ let line;
1003
+ if (status?.kind === 'safe') line = status.reason ? tf(t, 'presetSafeReason', { reason: status.reason }) : t('presetSafeMode');
1004
+ else if (status?.kind === 'official') line = tf(t, 'presetEnvironment', { env: t('presetOfficial') });
1005
+ else if (status?.kind === 'environment') line = tf(t, 'presetEnvironment', { env: status.distribution ? `${status.label} (${status.distribution})` : status.label });
1006
+ return { ...row, name: t('presetName'), description: [t('presetDescription'), line].filter(Boolean).join(' ') };
1218
1007
  }
1219
1008
 
1220
1009
  function presetSnapshotTranslator(rowsKey, t) {
@@ -1420,74 +1209,80 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1420
1209
  React.useEffect(() => watchJobs(sessionId), [sessionId, watchJobs]);
1421
1210
  return h(BackgroundJobs, { jobs, t });
1422
1211
  }
1212
+ // Output files: newest first, at most three positions, and overflow takes one of them.
1213
+ const OUTPUT_PREVIEW_LIMIT = 3;
1214
+ const fileName = path => String(path).split(/[\\/]/u).filter(Boolean).at(-1) ?? String(path);
1423
1215
 
1424
- function SidePanel({ sessionId, useSessions, useProjection, useJobs, watchJobs, reset, form, t }) {
1425
- const sessions = typeof useSessions === 'function' ? useSessions(state => state) : undefined;
1426
- let tools;
1427
- try { tools = typeof useProjection === 'function' ? useProjection('deepPtcTools') : undefined; } catch { tools = undefined; }
1428
- const hasTools = typeof reset === 'function';
1429
- const toolFailures = tools && typeof tools === 'object' ? (tools.report?.tools ?? []).length : 0;
1430
- PANEL.state = { tools: tools === null ? 'null' : typeof tools, reset: typeof reset, form: form ? 'yes' : 'no' };
1216
+ function OutputsSection({ outputs, t }) {
1217
+ const rows = Array.isArray(outputs) ? outputs : [];
1218
+ const overflow = rows.length > OUTPUT_PREVIEW_LIMIT;
1219
+ const visible = rows.slice(0, overflow ? OUTPUT_PREVIEW_LIMIT - 1 : OUTPUT_PREVIEW_LIMIT);
1220
+ const hidden = overflow ? rows.slice(visible.length) : [];
1221
+ const row = item => h('li', { key: item.path, className: 'dpt-file', 'data-kind': item.kind, title: item.path },
1222
+ h('span', { className: 'dpt-file-name' }, fileName(item.path)),
1223
+ h('span', { className: 'dpt-file-meta' }, item.kind === 'presented' ? t('outputPresented') : tf(t, 'outputTurn', { turn: item.turn })));
1224
+ const title = t('outputsTitle');
1225
+ return h('section', { className: 'dpt-side-section dpt-side-files', 'aria-label': title },
1226
+ h('div', { className: 'dpt-side-label' }, h('span', null, title), rows.length ? h('span', { className: 'dpt-side-hint' }, String(rows.length)) : null),
1227
+ rows.length ? h('ul', { className: 'dpt-files' }, ...visible.map(row),
1228
+ hidden.length ? h('li', { className: 'dpt-files-more' },
1229
+ h('details', null, h('summary', null, tf(t, 'outputsMore', { count: hidden.length })),
1230
+ h('ul', { className: 'dpt-files' }, ...hidden.map(row)))) : null)
1231
+ : h('p', { className: 'dpt-side-note' }, t('outputsEmpty')));
1232
+ }
1233
+
1234
+ // SSH: the configured host aliases and the hosts this conversation reached, most recent first.
1235
+ function SshSection({ form, ssh, t }) {
1431
1236
  const settings = useSettingsForm(form);
1237
+ const configured = settings.status === 'ready' && Array.isArray(settings.value?.sshHosts) ? settings.value.sshHosts : [];
1238
+ const client = settings.status === 'ready' ? settings.value?.sshClient : undefined;
1239
+ const used = Array.isArray(ssh) ? ssh : [];
1240
+ const names = new Set(used.map(row => row.host));
1241
+ const rows = [...used.map(row => ({ host: row.host, used: row, config: configured.find(item => item.alias === row.host) })),
1242
+ ...configured.filter(item => !names.has(item.alias)).map(item => ({ host: item.alias, config: item }))];
1243
+ const endpoint = config => config ? [config.user ? `${config.user}@` : '', config.hostName || '', config.port && config.port !== '22' ? `:${config.port}` : ''].join('') : '';
1244
+ const title = t('sshTitle');
1245
+ return h('section', { className: 'dpt-side-section dpt-side-ssh', 'aria-label': title },
1246
+ h('div', { className: 'dpt-side-label' }, h('span', null, title),
1247
+ h('span', { className: 'dpt-side-hint', 'data-tone': client === '' ? 'warn' : undefined }, client === '' ? t('sshNoClient') : t('sshHint'))),
1248
+ rows.length ? h('ul', { className: 'dpt-files' }, ...rows.slice(0, 8).map(item => h('li', { key: item.host, className: 'dpt-file dpt-host',
1249
+ 'data-state': item.used ? (item.used.ok ? 'ok' : 'failed') : 'idle', title: endpoint(item.config) || item.host },
1250
+ h('span', { className: 'dpt-agent-dot', 'aria-hidden': 'true' }),
1251
+ h('span', { className: 'dpt-file-name' }, item.host),
1252
+ h('span', { className: 'dpt-file-meta' }, item.used
1253
+ ? tf(t, item.used.ok ? 'sshUsed' : 'sshFailed', { count: item.used.count, turn: item.used.turn })
1254
+ : endpoint(item.config) || t('sshConfigured')))))
1255
+ : h('p', { className: 'dpt-side-note' }, t('sshEmpty')));
1256
+ }
1257
+
1258
+ function projectionValue(useProjection, key) {
1259
+ try { return typeof useProjection === 'function' ? useProjection(key) : undefined; } catch { return undefined; }
1260
+ }
1261
+
1262
+ // The Deep PTC panel: one conversation's environment, subagents, jobs, outputs, SSH and tool state.
1263
+ // It is the right sidebar tab, or opens under the composer where the host has no right sidebar.
1264
+ function DeepPtcPanel({ sessionId, useSessions, useProjection, useJobs, watchJobs, reset, form, inline, t }) {
1265
+ const sessions = typeof useSessions === 'function' ? useSessions(state => state) : undefined;
1266
+ const preset = projectionValue(useProjection, 'agentPreset');
1267
+ const activity = projectionValue(useProjection, 'deepPtcActivity');
1432
1268
  const [now, setNow] = React.useState(() => Date.now());
1433
- const [collapsed, setCollapsed] = React.useState(readCollapsed);
1434
- const [peek, setPeek] = React.useState(false);
1435
- const rows = subagentRows(sessions, sessionId, now);
1269
+ const deep = preset === 'deep-ptc';
1270
+ const rows = deep ? subagentRows(sessions, sessionId, now) : [];
1436
1271
  const running = rows.filter(row => row.state === 'running').length;
1437
1272
  const completed = rows.filter(row => row.state === 'completed').length;
1438
- const hasEnvironment = !!form && settings.status !== 'unavailable';
1439
- const layout = useChatRegion(sessionId, canPortal());
1440
- const docked = !!layout && layout.wide && !collapsed;
1441
1273
  React.useEffect(() => {
1442
1274
  if (running === 0) return undefined;
1443
1275
  const timer = setInterval(() => setNow(Date.now()), 1000);
1444
1276
  return () => clearInterval(timer);
1445
1277
  }, [running > 0]);
1446
- React.useEffect(() => {
1447
- SESSIONS.setWorking(sessionId, running > 0);
1448
- return () => SESSIONS.setWorking(sessionId, false);
1449
- }, [sessionId, running > 0]);
1450
- React.useEffect(() => {
1451
- const region = layout?.region;
1452
- if (!region) return undefined;
1453
- region.toggleAttribute('data-dpt-docked', docked);
1454
- return () => region.removeAttribute('data-dpt-docked');
1455
- }, [layout?.region, docked]);
1456
- React.useEffect(() => {
1457
- PANEL.toggle = () => {
1458
- if (layout && !layout.wide) { setPeek(value => !value); return; }
1459
- setCollapsed(value => { writeCollapsed(!value); return !value; });
1460
- };
1461
- return () => { PANEL.toggle = () => {}; };
1462
- }, [layout?.wide]);
1463
- if (!layout || !canPortal()) return null;
1464
- const position = { top: `${layout.top}px`, right: `${layout.right}px` };
1465
1278
  const summary = [running ? tf(t, 'agentsRunning', { count: running }) : null, completed ? tf(t, 'agentsCompleted', { count: completed }) : null,
1466
1279
  rows.length - running - completed > 0 ? tf(t, 'agentsIdle', { count: rows.length - running - completed }) : null].filter(Boolean).join(' · ');
1467
- const environment = settings.status === 'ready' && settings.value ? envLabel(settings.value.environment ?? 'auto', t) : undefined;
1468
- if (!docked && !peek) {
1469
- const expand = () => { if (layout.wide) { writeCollapsed(false); setCollapsed(false); } else setPeek(true); };
1470
- const label = [environment, rows.length ? `${t('agentsTitle')} ${rows.length}` : null, toolFailures ? `${t('toolFailures')} ${toolFailures}` : null].filter(Boolean).join(' · ');
1471
- return ReactDOM.createPortal(h('button', { type: 'button', className: 'dpt-agents-pill', style: position, 'data-state': running ? 'running' : 'idle',
1472
- 'aria-label': t('agentsExpand'), title: summary || t('agentsExpand'), onClick: expand },
1473
- h('span', { className: 'dpt-agent-dot', 'aria-hidden': 'true' }), label || t('sideTitle')), document.body);
1474
- }
1475
1280
  const stateText = row => row.state === 'running' ? t('agentRunning') : row.state === 'completed' ? t('agentCompleted') : row.state === 'external' ? t('agentExternal') : t('agentIdle');
1476
- const collapse = () => { if (layout.wide) { writeCollapsed(true); setCollapsed(true); } setPeek(false); };
1477
- const frame = docked
1478
- ? { top: `${layout.split.top}px`, right: `${layout.split.right}px`, height: `${layout.split.height}px`, width: `${SPLIT_WIDTH}px` }
1479
- : { ...position, maxHeight: `${layout.maxHeight}px`, width: `${PANEL_WIDTH}px` };
1480
- return ReactDOM.createPortal(h('aside', { className: 'dpt-agents', 'data-split': docked ? '' : undefined, 'aria-label': t('sideTitle'), style: frame },
1481
- h('header', { className: 'dpt-agents-head' },
1482
- h('span', { className: 'dpt-agents-title' }, t('sideTitle')),
1483
- h('span', { className: 'dpt-agents-count' }),
1484
- h('button', { type: 'button', className: 'dpt-icon-btn', 'aria-label': t('agentsCollapse'), title: t('agentsCollapse'), onClick: collapse },
1485
- h('svg', { width: 14, height: 14, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
1486
- h('path', { d: 'M6 4l4 4-4 4', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round' })))),
1281
+ return h('div', { className: 'dpt-panel', 'data-inline': inline ? '' : undefined, 'aria-label': t('sideTitle') },
1487
1282
  h('div', { className: 'dpt-side-body' },
1488
- hasEnvironment ? h(EnvironmentSection, { form, t }) : null,
1489
- h(VisualEffectsSection, { t }),
1490
- rows.length ? h('section', { className: 'dpt-side-section dpt-side-agents', 'aria-label': t('agentsTitle') },
1283
+ form ? h(EnvironmentSection, { form, t }) : null,
1284
+ !deep ? h('section', { className: 'dpt-side-section' }, h('p', { className: 'dpt-side-note' }, t('sideOtherMode'))) : null,
1285
+ deep && rows.length ? h('section', { className: 'dpt-side-section dpt-side-agents', 'aria-label': t('agentsTitle') },
1491
1286
  h('div', { className: 'dpt-side-label' }, h('span', null, t('agentsTitle')), h('span', { className: 'dpt-side-hint', title: summary }, summary)),
1492
1287
  h('ol', { className: 'dpt-agents-list' }, ...rows.map(row => {
1493
1288
  const meta = [stateText(row), row.duration !== undefined ? formatDuration(row.duration, t) : null,
@@ -1498,13 +1293,42 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1498
1293
  h('span', { className: 'dpt-agent-main' }, h('span', { className: 'dpt-agent-name', title: row.label }, row.label),
1499
1294
  h('span', { className: 'dpt-agent-meta' }, meta))));
1500
1295
  }))) : null,
1501
- typeof useJobs === 'function' && typeof watchJobs === 'function'
1502
- ? h(LiveBackgroundJobs, { key: sessionId, sessionId, useJobs, watchJobs, t })
1503
- : h(BackgroundJobs, { key: sessionId, jobs: sessions?.jobsBySession?.[sessionId], t }),
1504
- hasTools ? h(ToolStateControls, { sessionId, useProjection, reset, t }) : null)), document.body);
1296
+ deep ? (typeof useJobs === 'function' && typeof watchJobs === 'function'
1297
+ ? h(LiveBackgroundJobs, { key: `jobs:${sessionId}`, sessionId, useJobs, watchJobs, t })
1298
+ : h(BackgroundJobs, { key: `jobs:${sessionId}`, jobs: sessions?.jobsBySession?.[sessionId], t })) : null,
1299
+ deep ? h(OutputsSection, { outputs: activity?.outputs, t }) : null,
1300
+ h(SshSection, { form, ssh: deep ? activity?.ssh : undefined, t }),
1301
+ deep && typeof reset === 'function' ? h(ToolStateControls, { sessionId, useProjection, reset, t }) : null,
1302
+ h(VisualEffectsSection, { t })));
1505
1303
  }
1506
1304
 
1507
- // A boundary keeps a failing bridge or panel from taking the conversation header with it.
1305
+ // The capsule under the composer: a glance at the environment, subagents and tool notices. It opens
1306
+ // the Deep PTC tab in the right sidebar, so it sits in the composer's own dock and never over messages.
1307
+ function Capsule(props) {
1308
+ const { sessionId, useSessions, useProjection, form, openPanel, t } = props;
1309
+ const sessions = typeof useSessions === 'function' ? useSessions(state => state) : undefined;
1310
+ const tools = projectionValue(useProjection, 'deepPtcTools');
1311
+ const settings = useSettingsForm(form);
1312
+ const [open, setOpen] = React.useState(false);
1313
+ const rows = subagentRows(sessions, sessionId, Date.now());
1314
+ const running = rows.filter(row => row.state === 'running').length;
1315
+ React.useEffect(() => {
1316
+ SESSIONS.setWorking(sessionId, running > 0);
1317
+ return () => SESSIONS.setWorking(sessionId, false);
1318
+ }, [sessionId, running > 0]);
1319
+ const failures = tools && typeof tools === 'object' ? (tools.report?.tools ?? []).length : 0;
1320
+ const environment = settings.status === 'ready' && settings.value ? envLabel(settings.value.environment ?? 'auto', t) : undefined;
1321
+ const label = [environment, rows.length ? `${t('agentsTitle')} ${rows.length}` : null, failures ? `${t('toolFailures')} ${failures}` : null]
1322
+ .filter(Boolean).join(' · ') || t('sideTitle');
1323
+ const toggle = () => { if (!openPanel?.()) setOpen(value => !value); };
1324
+ return h('div', { className: 'dpt-capsule-row' },
1325
+ h('button', { type: 'button', className: 'dpt-capsule', 'data-state': running ? 'running' : 'idle', 'aria-expanded': open,
1326
+ title: t('capsuleOpen'), onClick: toggle },
1327
+ h('span', { className: 'dpt-agent-dot', 'aria-hidden': 'true' }), h('span', null, label)),
1328
+ open ? h(DeepPtcPanel, { ...props, inline: true }) : null);
1329
+ }
1330
+
1331
+ // A boundary keeps a failing bridge or panel from taking the conversation with it.
1508
1332
  class Boundary extends React.Component {
1509
1333
  constructor(props) { super(props); this.state = { failed: false }; }
1510
1334
  static getDerivedStateFromError() { return { failed: true }; }
@@ -1515,23 +1339,57 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1515
1339
  function SessionBridge(props) {
1516
1340
  const { sessionId } = props;
1517
1341
  const marker = React.useRef(null);
1518
- let preset;
1519
- try { preset = typeof props.useProjection === 'function' ? props.useProjection('agentPreset') : undefined; } catch { preset = undefined; }
1342
+ const preset = projectionValue(props.useProjection, 'agentPreset');
1520
1343
  const statuses = typeof props.useSessionStatus === 'function' ? props.useSessionStatus(state => state) : undefined;
1521
1344
  const busy = statuses?.get?.(sessionId)?.running === true;
1522
1345
  React.useEffect(() => { SESSIONS.set(sessionId, { id: sessionId, preset, busy, el: marker.current }); }, [sessionId, preset, busy]);
1523
1346
  React.useEffect(() => () => SESSIONS.del(sessionId), [sessionId]);
1347
+ React.useEffect(() => SESSIONS.watch(marker.current?.parentElement), []);
1524
1348
  return h('span', { ref: marker, hidden: true, 'aria-hidden': 'true', 'data-dpt-bridge': sessionId });
1525
1349
  }
1526
1350
 
1527
- function SideCardHost(props) {
1528
- // Registered for every session; only Deep PTC sessions read their projections or draw the card.
1529
- let preset;
1530
- try { preset = props.useProjection('agentPreset'); } catch { return null; }
1531
- if (preset !== 'deep-ptc') return null;
1532
- return h(Boundary, null, h(SidePanel, props));
1351
+ function DockHost(props) {
1352
+ // Registered for every session; only Deep PTC sessions draw the capsule.
1353
+ if (projectionValue(props.useProjection, 'agentPreset') !== 'deep-ptc') return null;
1354
+ return h(Boundary, null, h(Capsule, props));
1355
+ }
1356
+
1357
+ function TabHost(props) {
1358
+ return h(Boundary, null, h(DeepPtcPanel, props));
1359
+ }
1360
+
1361
+ function TabTitle({ t }) {
1362
+ return h('span', { className: 'dpt-tab-title' }, t('sideTitle'));
1533
1363
  }
1534
1364
 
1365
+ function DiagnosticsSection({ t }) {
1366
+ const [text, setText] = React.useState('');
1367
+ const [copied, setCopied] = React.useState(false);
1368
+ async function copy() {
1369
+ const value = diagnostics();
1370
+ setText(value);
1371
+ try { await navigator.clipboard?.writeText(value); setCopied(true); } catch { setCopied(false); }
1372
+ }
1373
+ return h('section', { 'aria-label': t('diagTitle') },
1374
+ h('h3', null, t('diagTitle')),
1375
+ h('div', { className: 'dpt-settings-row' }, h('p', { className: 'dpt-side-note' }, t('diagHint')),
1376
+ h('button', { type: 'button', className: 'dpt-btn', onClick: () => { void copy(); } }, copied ? t('diagCopied') : t('diagCopy'))),
1377
+ text ? h('pre', { className: 'dpt-diag' }, text) : null);
1378
+ }
1379
+
1380
+ // The Deep PTC settings page: the environment form, the effects switch and diagnostics.
1381
+ function SettingsPage({ form, t }) {
1382
+ return h('div', { className: 'dpt-settings' },
1383
+ // The form labels its own environment field.
1384
+ h('section', { 'aria-label': t('environment') },
1385
+ form ? h(Card, { form, t }) : h('p', { className: 'dpt-side-note' }, t('readOnly'))),
1386
+ h('section', { 'aria-label': t('visualEffects') }, h('h3', null, t('appearance')), h(VisualEffectsSection, { t })),
1387
+ h(DiagnosticsSection, { t }));
1388
+ }
1389
+
1390
+ const SettingsIcon = ({ size = 16 }) => h('svg', { width: size, height: size, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
1391
+ h('path', { d: 'M2.5 4.5h6M2.5 8h11M2.5 11.5h8', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round' }),
1392
+ h('circle', { cx: 11.5, cy: 4.5, r: 1.6, stroke: 'currentColor', strokeWidth: 1.3 }));
1535
1393
  // The skill switches run a host command, and the host logs every command. The log keeps it; the
1536
1394
  // conversation shows nothing for a success and a short line for a failure.
1537
1395
  function SkillCommandRow({ node, t }) {
@@ -1547,6 +1405,43 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1547
1405
  // The remote command API takes the full line plus attachments. The JSON payload is command input.
1548
1406
  return execute(sessionId, `/${SKILL_COMMAND_NAME} ` + JSON.stringify(payload), []);
1549
1407
  }
1408
+ const TAB_KIND = 'deep-ptc';
1409
+
1410
+ // Per-conversation props shared by the composer capsule and the right sidebar tab.
1411
+ function sessionTools(child) {
1412
+ return sessionId => {
1413
+ const jobs = child.get?.('jobs');
1414
+ const props = {
1415
+ reset: () => {
1416
+ const execute = child.remote?.commands?.execute;
1417
+ if (typeof execute !== 'function') return Promise.resolve({ ok: true, value: undefined });
1418
+ return execute(sessionId, '/deep-ptc-reset-tools', []);
1419
+ },
1420
+ };
1421
+ if (jobs?.state && typeof jobs.watchRows === 'function') {
1422
+ props.hooks = { jobs: jobs.state };
1423
+ props.watchJobs = id => jobs.watchRows(id);
1424
+ }
1425
+ return props;
1426
+ };
1427
+ }
1428
+
1429
+ // Opens the Deep PTC tab in the right sidebar; false when this host has none, so the capsule
1430
+ // opens the panel under the composer instead.
1431
+ let tabRegistered = false;
1432
+ function openPanel() {
1433
+ const sidebar = hostCtx?.get?.('sidebarRight');
1434
+ if (!tabRegistered || typeof sidebar?.openTab !== 'function') return false;
1435
+ try {
1436
+ sidebar.openTab(TAB_KIND);
1437
+ // Revealing a page that is already open does not expand a collapsed column; check once the
1438
+ // open has rendered, so an open that did expand it is not toggled closed again.
1439
+ if (typeof sidebar.isExpanded === 'function' && typeof sidebar.toggleExpanded === 'function') {
1440
+ setTimeout(() => { if (!sidebar.isExpanded()) sidebar.toggleExpanded(); }, 0);
1441
+ }
1442
+ return true;
1443
+ } catch { return false; }
1444
+ }
1550
1445
 
1551
1446
  function apply(ctx) {
1552
1447
  hostCtx = ctx;
@@ -1558,17 +1453,31 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1558
1453
  useLocaleRevision();
1559
1454
  return h(component, { ...props, t: props.t ?? t });
1560
1455
  }
1561
- T = key => t(key);
1562
1456
  ctx.effect(() => ctx.locale.register('deep-ptc', dictionaries));
1563
1457
  installPresetLabels(ctx.slots, t, useLocaleRevision);
1564
1458
  ctx.effect(() => injectCss(), `${PLUGIN}: style`);
1565
1459
  ctx.effect(() => watchActiveSession(), `${PLUGIN}: active session`);
1566
1460
  const form = ctx.configForms.get(NS);
1567
- ctx.effect(() => ctx.configForms.whileServed([NS], () =>
1568
- ctx.slots.inject('plugins.item', () => ctx.slots.register({
1569
- name: 'plugins.item', id: 'deep-ptc', order: 41,
1570
- label: () => t('title'), locale: 'deep-ptc',
1571
- }, props => h(LocalizedSlot, { ...props, form, component: Card })))));
1461
+ ctx.effect(() => ctx.configForms.whileServed([NS], () => {
1462
+ const disposers = [
1463
+ // The plugin manager row keeps its settings card.
1464
+ ctx.slots.inject('plugins.item', () => ctx.slots.register({
1465
+ name: 'plugins.item', id: 'deep-ptc', order: 41,
1466
+ label: () => t('title'), locale: 'deep-ptc',
1467
+ }, props => h(LocalizedSlot, { ...props, form, component: Card }))),
1468
+ // Deep PTC's own settings page, under its own id: no other entry is shadowed.
1469
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
1470
+ name: 'settings.section', id: 'deep-ptc', order: 24,
1471
+ label: () => t('title'), locale: 'deep-ptc',
1472
+ }, props => h(LocalizedSlot, { ...props, form, component: SettingsPage }))),
1473
+ ];
1474
+ try {
1475
+ disposers.push(ctx.slots.inject('settings.section.icon', () => ctx.slots.register({
1476
+ name: 'settings.section.icon', id: 'deep-ptc',
1477
+ }, SettingsIcon)));
1478
+ } catch { /* the nav keeps its default icon */ }
1479
+ return () => disposers.reverse().forEach(dispose => dispose?.());
1480
+ }));
1572
1481
  try {
1573
1482
  ctx.slots.inject('conversation.chat.commandview', () => ctx.slots.register({
1574
1483
  name: 'conversation.chat.commandview', key: SKILL_COMMAND_NAME, locale: 'deep-ptc',
@@ -1592,28 +1501,34 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
1592
1501
  }, props => h(LocalizedSlot, { ...props, component: SkillTail })));
1593
1502
  } catch { /* a broken card must not take the conversation with it */ }
1594
1503
  try {
1595
- // The side card draws beside the conversation through a portal; nothing shows under the composer.
1504
+ // The capsule renders in the composer's own dock, in the page flow.
1596
1505
  child.slots.inject('conversation.composer.dock', () => child.slots.register({
1597
1506
  name: 'conversation.composer.dock', id: 'deep-ptc-side', order: 89, locale: 'deep-ptc',
1598
- inject: sessionId => {
1599
- const jobs = child.get?.('jobs');
1600
- const props = {
1601
- reset: () => {
1602
- const execute = child.remote?.commands?.execute;
1603
- if (typeof execute !== 'function') return Promise.resolve({ ok: true, value: undefined });
1604
- return execute(sessionId, '/deep-ptc-reset-tools', []);
1605
- },
1606
- };
1607
- if (jobs?.state && typeof jobs.watchRows === 'function') {
1608
- props.hooks = { jobs: jobs.state };
1609
- props.watchJobs = id => jobs.watchRows(id);
1610
- }
1611
- return props;
1612
- },
1613
- }, props => h(LocalizedSlot, { ...props, form, component: SideCardHost })));
1507
+ inject: sessionTools(child),
1508
+ }, props => h(LocalizedSlot, { ...props, form, openPanel, component: DockHost })));
1614
1509
  } catch { /* the composer stays usable when this slot cannot register */ }
1615
1510
  });
1616
1511
  } catch { /* the composer stays usable when this slot cannot register */ }
1512
+ try {
1513
+ // The panel is a page type of the official right sidebar: the host places, docks, floats and
1514
+ // hides it, and lists it on the sidebar's new-tab guide.
1515
+ ctx.inject?.(['remote', 'remote.commands', 'sidebarRightTabs'], child => {
1516
+ child.effect(() => {
1517
+ const dispose = child.sidebarRightTabs.register({
1518
+ id: PLUGIN, kind: TAB_KIND, title: () => t('sideTitle'),
1519
+ guide: [{ id: TAB_KIND, order: 60, title: () => t('sideTitle'), description: () => t('sideGuide') }],
1520
+ });
1521
+ tabRegistered = true;
1522
+ return () => { tabRegistered = false; dispose(); };
1523
+ }, `${PLUGIN}: sidebar tab type`);
1524
+ child.slots.inject('sidebar.right.pane.tab', () => child.slots.register({
1525
+ name: 'sidebar.right.pane.tab', key: PLUGIN, locale: 'deep-ptc', inject: sessionTools(child),
1526
+ }, props => h(LocalizedSlot, { ...props, form, component: TabHost })));
1527
+ child.slots.inject('sidebar.right.pane.tab.title', () => child.slots.register({
1528
+ name: 'sidebar.right.pane.tab.title', key: PLUGIN,
1529
+ }, props => h(LocalizedSlot, { ...props, component: TabTitle })));
1530
+ });
1531
+ } catch { /* without a right sidebar the capsule opens the panel in place */ }
1617
1532
  }
1618
1533
  return { apply, inject };
1619
1534
  } });