dsh-deep-ptc-mode 1.8.5 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +14 -11
- package/README.zh.md +15 -10
- package/lib/client.js +287 -57
- package/lib/creative.mjs +15 -34
- package/lib/freshness.mjs +31 -0
- package/lib/index.mjs +39 -16
- package/lib/model.mjs +14 -7
- package/lib/preset-compat.mjs +5 -3
- package/lib/shells.mjs +11 -1
- package/lib/skill-card.mjs +0 -0
- package/lib/skill-context.mjs +0 -0
- package/lib/tool-policy.mjs +7 -2
- package/lib/tool-state.mjs +0 -0
- package/lib/upstream.mjs +0 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +4 -2
package/lib/client.js
CHANGED
|
@@ -9,6 +9,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
9
9
|
environment: '执行环境', auto: '自动(Windows:PowerShell;macOS:Zsh;Linux:Bash)',
|
|
10
10
|
wsl: 'WSL Bash(Windows)', powershell: 'PowerShell(Windows)',
|
|
11
11
|
zsh: 'Zsh(macOS / Linux)', bash: '原生 Bash(macOS / Linux)',
|
|
12
|
+
windowsBash: '原生 Bash(Windows)', bashPath: 'bash.exe 的绝对路径',
|
|
13
|
+
bashPathHint: '可填写 dsh-ops 随包的 Niubash。路径不可用时保留官方 Shell。受限模式请选 PowerShell。',
|
|
12
14
|
distribution: 'WSL 发行版', distributionHint: '留空使用 Windows 的默认发行版,例如 Ubuntu。',
|
|
13
15
|
shell: 'Shell 版本', shellAuto: '自动(沿用官方查找顺序)',
|
|
14
16
|
shellHint: '只列出本机已发现的常见版本。文件消失后自动回退。WSL 仍只选择发行版。',
|
|
@@ -23,6 +25,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
23
25
|
environment: 'Execution environment', auto: 'Automatic (Windows: PowerShell; macOS: Zsh; Linux: Bash)',
|
|
24
26
|
wsl: 'WSL Bash (Windows)', powershell: 'PowerShell (Windows)',
|
|
25
27
|
zsh: 'Zsh (macOS / Linux)', bash: 'Native Bash (macOS / Linux)',
|
|
28
|
+
windowsBash: 'Native Bash (Windows)', bashPath: 'Absolute path to bash.exe',
|
|
29
|
+
bashPathHint: 'You can use the Niubash bundled with dsh-ops. An unavailable path keeps the official shell. Choose PowerShell for confined work.',
|
|
26
30
|
distribution: 'WSL distribution', distributionHint: 'Leave blank for the Windows default distribution, for example Ubuntu.',
|
|
27
31
|
shell: 'Shell version', shellAuto: 'Automatic (official lookup)',
|
|
28
32
|
shellHint: 'Lists common executables found on this machine. A missing file falls back to automatic. WSL still selects a distribution only.',
|
|
@@ -55,8 +59,9 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
55
59
|
}, [state.value, state.revision]);
|
|
56
60
|
if (view === 'summary') return t('summary');
|
|
57
61
|
if (state.status !== 'ready') return h('p', null, t('loading'));
|
|
58
|
-
const
|
|
59
|
-
|
|
62
|
+
const platform = state.value.hostPlatform;
|
|
63
|
+
const allowed = allowedEnvironments(platform);
|
|
64
|
+
const windowsBash = platform === 'win32' && environment === 'bash';
|
|
60
65
|
const disabled = !state.writable || saving;
|
|
61
66
|
const changed = () => {
|
|
62
67
|
if (!dirty.current) draftRevision.current = state.revision;
|
|
@@ -70,7 +75,7 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
70
75
|
const ok = await form.mutate([
|
|
71
76
|
{ op: 'set', path: ['environment'], value: environment },
|
|
72
77
|
{ op: 'set', path: ['wslDistribution'], value: distribution.trim() },
|
|
73
|
-
{ op: 'set', path: ['shellExecutable'], value: shellExecutable },
|
|
78
|
+
{ op: 'set', path: ['shellExecutable'], value: windowsBash ? shellExecutable.trim() : shellExecutable },
|
|
74
79
|
], draftRevision.current);
|
|
75
80
|
if (!ok) throw new Error('Configuration was rejected');
|
|
76
81
|
dirty.current = false;
|
|
@@ -96,15 +101,24 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
96
101
|
return h('form', { onSubmit: save, style: { display: 'grid', gap: '12px', maxWidth: '600px' } },
|
|
97
102
|
h('label', { htmlFor: 'deep-ptc-environment' }, t('environment')),
|
|
98
103
|
h('select', { id: 'deep-ptc-environment', value: environment, disabled, style: control,
|
|
99
|
-
onChange: event => {
|
|
104
|
+
onChange: event => {
|
|
105
|
+
changed();
|
|
106
|
+
const next = event.target.value;
|
|
107
|
+
if (platform === 'win32' && (environment === 'bash' || next === 'bash')) setShellExecutable('');
|
|
108
|
+
setEnvironment(next);
|
|
109
|
+
} },
|
|
100
110
|
...['auto', 'wsl', 'powershell', 'zsh', 'bash'].map(value =>
|
|
101
|
-
h('option', { key: value, value, disabled: !allowed.includes(value) }, t(value)))),
|
|
111
|
+
h('option', { key: value, value, disabled: !allowed.includes(value) }, t(platform === 'win32' && value === 'bash' ? 'windowsBash' : value)))),
|
|
102
112
|
environment === 'wsl' ? h(React.Fragment, null,
|
|
103
113
|
h('label', { htmlFor: 'deep-ptc-distribution' }, t('distribution')),
|
|
104
114
|
h('input', { id: 'deep-ptc-distribution', value: distribution, disabled, style: control,
|
|
105
115
|
onChange: event => { changed(); setDistribution(event.target.value); } }),
|
|
106
116
|
h('p', null, t('distributionHint')), h('p', null, t('wslHint'))) : null,
|
|
107
|
-
|
|
117
|
+
windowsBash ? h(React.Fragment, null,
|
|
118
|
+
h('label', { htmlFor: 'deep-ptc-shell' }, t('bashPath')),
|
|
119
|
+
h('input', { id: 'deep-ptc-shell', value: shellExecutable, disabled, style: control, required: true,
|
|
120
|
+
onChange: event => { changed(); setShellExecutable(event.target.value); } }),
|
|
121
|
+
h('p', null, t('bashPathHint'))) : showShell ? h(React.Fragment, null,
|
|
108
122
|
h('label', { htmlFor: 'deep-ptc-shell' }, t('shell')),
|
|
109
123
|
h('select', { id: 'deep-ptc-shell', value: shellExecutable, disabled, style: control,
|
|
110
124
|
onChange: event => { changed(); setShellExecutable(event.target.value); } },
|
|
@@ -114,7 +128,8 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
114
128
|
h('p', null, t('sessions')),
|
|
115
129
|
!state.writable ? h('p', { role: 'status' }, t('readOnly')) : null,
|
|
116
130
|
message ? h('p', { role: failed ? 'alert' : 'status' }, message) : null,
|
|
117
|
-
h('button', { type: 'submit', disabled
|
|
131
|
+
h('button', { type: 'submit', disabled: disabled || (windowsBash && !shellExecutable.trim()),
|
|
132
|
+
style: { justifySelf: 'start', padding: '7px 16px' } }, t(saving ? 'saving' : 'save')),
|
|
118
133
|
);
|
|
119
134
|
}
|
|
120
135
|
|
|
@@ -138,12 +153,18 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
138
153
|
try {
|
|
139
154
|
const outcome = await reset();
|
|
140
155
|
if (current !== generation.current) return;
|
|
141
|
-
if (outcome?.ok === false) throw new Error(outcome.error?.message
|
|
156
|
+
if (outcome?.ok === false) throw new Error(outcome.error?.message);
|
|
142
157
|
const reply = outcome?.ok === true ? outcome.value : outcome;
|
|
158
|
+
if (reply === undefined) throw new Error(t('toolResetUnavailable'));
|
|
143
159
|
const result = reply?.result ?? reply;
|
|
144
|
-
if (result?.kind !== 'success') throw new Error(result?.text
|
|
160
|
+
if (result?.kind !== 'success') throw new Error(result?.text);
|
|
145
161
|
setMessage(t('toolResetDone'));
|
|
146
|
-
} catch (error) {
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (current === generation.current) {
|
|
164
|
+
const detail = String(error?.message ?? error ?? '').slice(0, 220);
|
|
165
|
+
setMessage(detail ? `${t('toolResetFailed')} ${detail}` : t('toolResetFailed'));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
147
168
|
finally { if (current === generation.current) setBusy(false); }
|
|
148
169
|
}
|
|
149
170
|
return h('section', { className: 'dpt-side-section dpt-side-tools', 'aria-label': t('toolsSection') },
|
|
@@ -158,13 +179,21 @@ window.__ModuleLoader__.load({ id: 'dsh-deep-ptc-mode', factory: require => {
|
|
|
158
179
|
message || t('toolResetHint')));
|
|
159
180
|
}
|
|
160
181
|
Object.assign(dictionaries.zh, {
|
|
182
|
+
visualEffects: '界面特效', visualEffectsHint: '使用外部主题或 UI 插件时,建议关闭此开关。',
|
|
183
|
+
jobsTitle: '后台任务', jobsEmpty: '本会话暂无后台任务。', jobsMore: '另有 {count} 个任务',
|
|
184
|
+
jobRunning: '运行中', jobStopping: '正在停止', jobCompleted: '已完成', jobKilled: '已取消', jobFailed: '已失败',
|
|
161
185
|
toolReset: '重载所有工具状态', toolResetBusy: '正在重载…', toolResetDone: '本对话工具状态已重载。',
|
|
162
|
-
toolResetFailed: '
|
|
186
|
+
toolResetFailed: '未能重载工具状态。', toolResetUnavailable: '当前会话无法调用工具重载命令。',
|
|
187
|
+
toolResetHint: '清除本对话的故障标记和按需加载选择;正在运行的任务继续执行。',
|
|
163
188
|
toolFailures: '工具适配提醒', toolFailureHint: '以下外部工具调用失败,可能存在适配问题,已在本对话中禁用。任务会优先使用其他可用工具;未进一步排查故障原因。',
|
|
164
189
|
});
|
|
165
190
|
Object.assign(dictionaries.en, {
|
|
191
|
+
visualEffects: 'Visual effects', visualEffectsHint: 'Keep this off when using an external theme or UI plugin.',
|
|
192
|
+
jobsTitle: 'Background jobs', jobsEmpty: 'No background jobs in this conversation.', jobsMore: '{count} more jobs',
|
|
193
|
+
jobRunning: 'Running', jobStopping: 'Stopping', jobCompleted: 'Completed', jobKilled: 'Canceled', jobFailed: 'Failed',
|
|
166
194
|
toolReset: 'Reload all tool states', toolResetBusy: 'Reloading…', toolResetDone: 'Tool states reloaded for this conversation.',
|
|
167
|
-
toolResetFailed: '
|
|
195
|
+
toolResetFailed: 'Could not reload tool states.', toolResetUnavailable: 'The reload command is unavailable in this conversation.',
|
|
196
|
+
toolResetHint: 'Clear quarantine and on-demand selections in this conversation. Running jobs continue.',
|
|
168
197
|
toolFailures: 'Tool compatibility notice', toolFailureHint: 'These external tools failed and may have compatibility issues. They are disabled in this conversation. Continue with working alternatives; no root-cause investigation was performed.',
|
|
169
198
|
});
|
|
170
199
|
Object.assign(dictionaries.zh, {
|
|
@@ -265,6 +294,7 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
|
|
|
265
294
|
.dpt-side-section{padding:2px 14px 12px}
|
|
266
295
|
.dpt-side-section+.dpt-side-section{border-top:.5px solid var(--dsw-alias-border-l1,#e3e7ee);padding-top:10px}
|
|
267
296
|
.dpt-side-agents{padding-left:8px;padding-right:8px}
|
|
297
|
+
.dpt-side-agents .dpt-agents-list{display:flex;flex-direction:column;gap:4px;padding:2px 0}
|
|
268
298
|
.dpt-side-agents>.dpt-side-label{padding:0 6px}
|
|
269
299
|
.dpt-side-label{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:12px;line-height:18px;font-weight:600;color:var(--dsw-alias-label-secondary,#4a5565)}
|
|
270
300
|
.dpt-side-hint{min-width:0;font-size:11px;font-weight:400;color:var(--dsw-alias-label-tertiary,#667085);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
@@ -290,20 +320,47 @@ ${DARK} .dpt-agents,${DARK} .dpt-agents-pill{box-shadow:0 10px 30px rgba(0,0,0,.
|
|
|
290
320
|
.dpt-agent:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(16,24,40,.05))}
|
|
291
321
|
.dpt-agent:disabled{cursor:default}
|
|
292
322
|
.dpt-agent-dot{flex:none;width:8px;height:8px;margin-top:6px;border-radius:50%;background:var(--dsw-alias-label-tertiary,#98a2b3)}
|
|
293
|
-
.dpt-agent[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff)
|
|
323
|
+
.dpt-agent[data-state="running"] .dpt-agent-dot,.dpt-agents-pill[data-state="running"] .dpt-agent-dot,.dpt-job[data-state="running"] .dpt-agent-dot{background:var(--dpt-accent,#3370ff)}
|
|
324
|
+
${ON} .dpt-agents-pill[data-state="running"] .dpt-agent-dot,${ON} .dpt-agent[data-state="running"] .dpt-agent-dot{animation:dpt-dot-flash 1.2s ease-in-out infinite}
|
|
325
|
+
@keyframes dpt-dot-flash{0%,100%{opacity:1;box-shadow:0 0 4px 1px color-mix(in srgb,var(--dpt-accent,#3370ff) 55%,transparent)}50%{opacity:.35;box-shadow:0 0 10px 3px color-mix(in srgb,var(--dpt-accent,#3370ff) 75%,transparent)}}
|
|
294
326
|
.dpt-agent[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
|
|
327
|
+
.dpt-job[data-state="completed"] .dpt-agent-dot{background:var(--dsw-alias-state-success-primary,#0f7a4f)}
|
|
328
|
+
.dpt-job[data-state="stopping"] .dpt-agent-dot,.dpt-job[data-state="killed"] .dpt-agent-dot{background:var(--dsw-alias-state-warn-primary,#b45309)}
|
|
329
|
+
.dpt-job[data-state="failed"] .dpt-agent-dot{background:var(--dsw-alias-state-error-primary,#c4321f)}
|
|
330
|
+
.dpt-side-effects .dpt-side-label{align-items:center}
|
|
331
|
+
.dpt-jobs-list{display:grid;gap:4px;list-style:none;padding:0;margin:0}
|
|
332
|
+
.dpt-job,.dpt-jobs-more{padding:5px 6px;border-radius:6px;background:var(--dpt-surface-soft,var(--dsw-alias-fill-secondary,transparent))}
|
|
333
|
+
.dpt-job{display:flex;align-items:flex-start;gap:7px}
|
|
334
|
+
.dpt-jobs-more summary{cursor:pointer;font-size:11px;line-height:16px}
|
|
335
|
+
.dpt-jobs-more .dpt-jobs-list{margin-top:4px}
|
|
295
336
|
.dpt-agent-main{flex:1;min-width:0;display:flex;flex-direction:column}
|
|
296
337
|
.dpt-agent-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
297
338
|
.dpt-agent-meta{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#667085);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
298
|
-
.dpt-agent[data-state="running"] .dpt-agent-meta{color:var(--dpt-accent,#3370ff)}
|
|
299
339
|
.dpt-agents-pill{position:fixed;z-index:40;display:inline-flex;align-items:center;gap:8px;height:30px;padding:0 12px;box-sizing:border-box;border-radius:999px;border:.5px solid var(--dsw-alias-border-l2,#d6dce6);background:color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 88%,transparent);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);box-shadow:0 6px 20px rgba(16,24,40,.08);color:var(--dsw-alias-label-primary,#101828);font:inherit;font-size:12px;cursor:pointer;animation:dpt-rise 220ms var(--dpt-ease) both}
|
|
300
340
|
.dpt-agents-pill .dpt-agent-dot{margin-top:0}
|
|
301
|
-
.dpt-agents-pill
|
|
302
|
-
|
|
341
|
+
.dpt-agents,.dpt-agents-pill{--dpt-line:var(--dsw-alias-border-l1,#e3e7ee)}
|
|
342
|
+
.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)}
|
|
343
|
+
.dpt-agents-head{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--dpt-line)}
|
|
344
|
+
.dpt-agents-title{display:flex;align-items:center;gap:8px}
|
|
345
|
+
.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)}
|
|
346
|
+
.dpt-agents .dpt-icon-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
|
|
347
|
+
.dpt-agents .dpt-icon-btn:hover{background:color-mix(in srgb,var(--dpt-accent) 10%,transparent)}
|
|
348
|
+
.dpt-agents .dpt-side-section+.dpt-side-section{border-top:1px solid var(--dpt-line)}
|
|
349
|
+
.dpt-agents .dpt-seg{background:color-mix(in srgb,var(--dpt-accent) 9%,transparent)}
|
|
350
|
+
.dpt-agents .dpt-seg-btn{color:var(--dsw-alias-label-secondary,#4a5565)}
|
|
351
|
+
.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)}
|
|
352
|
+
.dpt-agents .dpt-input,.dpt-agents .dpt-select{background:#fff;border:1px solid var(--dpt-line)}
|
|
353
|
+
.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}
|
|
354
|
+
.dpt-agents .dpt-btn:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 8%,#fff)}
|
|
355
|
+
.dpt-agents .dpt-agent:hover:not(:disabled){background:color-mix(in srgb,var(--dpt-accent) 7%,transparent)}
|
|
356
|
+
.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)}
|
|
357
|
+
${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)}
|
|
358
|
+
[data-conversation-region="chat"][data-dpt-docked]{margin-right:272px!important}
|
|
359
|
+
.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}
|
|
360
|
+
@keyframes dpt-fade-in{from{opacity:0}to{opacity:1}}
|
|
303
361
|
[data-chat-flow-kind="command"]:has([data-dpt-hidden-command]){display:none!important}
|
|
304
362
|
.dpt-command-error{padding:4px 2px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary,#c4321f)}
|
|
305
363
|
@keyframes dpt-rise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
|
|
306
|
-
@keyframes dpt-ping{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--dpt-accent,#3370ff) 45%,transparent)}100%{box-shadow:0 0 0 6px color-mix(in srgb,var(--dpt-accent,#3370ff) 0%,transparent)}}
|
|
307
364
|
@media (prefers-reduced-motion:reduce){.dpt-card,.dpt-agents,.dpt-agents-pill,.dpt-agent-dot,.dpt-switch,.dpt-switch-thumb{animation:none!important;transition:none!important}}
|
|
308
365
|
`;
|
|
309
366
|
const THEME_CSS = `
|
|
@@ -349,7 +406,7 @@ ${ON} [data-dpt-composer]{box-shadow:0 10px 30px rgba(16,24,40,0.07),0 2px 6px r
|
|
|
349
406
|
${ON_DARK} [data-dpt-composer]{box-shadow:0 10px 30px rgba(0,0,0,0.45),0 2px 6px rgba(0,0,0,0.35)}
|
|
350
407
|
${ON} [data-dpt-composer]::before{content:"";position:absolute;inset:-1px;border-radius:inherit;padding:1.5px;pointer-events:none;background:linear-gradient(115deg,var(--dpt-brand),var(--dpt-brand-light),var(--dpt-brand),var(--dpt-brand-light));background-size:300% 100%;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:0;transition:opacity var(--dpt-dur-base) var(--dpt-ease-out)}
|
|
351
408
|
${ON} [data-dpt-composer]:focus-within::before{opacity:1;animation:dpt-sheen 5s linear infinite}
|
|
352
|
-
${ON} [data-dpt-composer]:focus-within{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 10%,transparent),0 14px 38px color-mix(in srgb,var(--dpt-brand) 16%,transparent) !important}
|
|
409
|
+
${ON}:not([data-dpt-busy]) [data-dpt-composer]:focus-within{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 10%,transparent),0 14px 38px color-mix(in srgb,var(--dpt-brand) 16%,transparent) !important}
|
|
353
410
|
${ON} [data-dpt-composer]:hover:not(:focus-within){background-image:radial-gradient(360px circle at var(--dpt-mx,50%) var(--dpt-my,50%),color-mix(in srgb,var(--dpt-brand) 7%,transparent),transparent 70%)}
|
|
354
411
|
@keyframes dpt-sheen{from{background-position:0% 0}to{background-position:300% 0}}
|
|
355
412
|
${ON} [data-dpt-send]:not(:disabled):not([aria-disabled="true"]){background-image:linear-gradient(135deg,var(--dpt-brand-light),var(--dpt-brand)) !important;color:#fff !important;box-shadow:0 4px 14px color-mix(in srgb,var(--dpt-brand) 38%,transparent);transition:transform 160ms var(--dpt-ease-out),box-shadow 160ms var(--dpt-ease-out),filter var(--dpt-dur-fast) var(--dpt-ease-out) !important}
|
|
@@ -368,8 +425,8 @@ ${ON} [data-row-key^="session:"][role="treeitem"]:hover{background-color:color-m
|
|
|
368
425
|
${ON} [data-row-key^="session:"][role="treeitem"]:hover:not(:is([aria-selected="true"],[aria-current="true"],[data-selected="true"],.ld-row-selected)){background-image:radial-gradient(160px circle at var(--dpt-mx,50%) var(--dpt-my,50%),color-mix(in srgb,var(--dpt-brand) 18%,transparent),transparent 72%)}
|
|
369
426
|
${ON} [data-row-key^="session:"][role="treeitem"]:is([aria-selected="true"],[aria-current="true"],[data-selected="true"],.ld-row-selected){background-image:linear-gradient(90deg,color-mix(in srgb,var(--dpt-brand) 15%,transparent),color-mix(in srgb,var(--dpt-brand) 3%,transparent));font-weight:500}
|
|
370
427
|
${ON}[data-dpt-busy] [data-dpt-composer]::before{opacity:1;padding:2.5px;animation:dpt-sheen 1.6s linear infinite}
|
|
371
|
-
${ON}[data-dpt-busy] [data-dpt-composer]{animation:dpt-breathe 1.9s ease-in-out infinite}
|
|
372
|
-
@keyframes dpt-breathe{0%,100%{box-shadow:0 0 0
|
|
428
|
+
${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}
|
|
429
|
+
@keyframes dpt-breathe{0%,100%{box-shadow:0 0 0 1px color-mix(in srgb,var(--dpt-brand) 35%,transparent),0 0 16px 2px color-mix(in srgb,var(--dpt-brand) 28%,transparent),0 10px 30px color-mix(in srgb,var(--dpt-brand) 12%,transparent)}50%{box-shadow:0 0 0 4px color-mix(in srgb,var(--dpt-brand) 22%,transparent),0 0 44px 10px color-mix(in srgb,var(--dpt-brand) 50%,transparent),0 14px 44px color-mix(in srgb,var(--dpt-brand) 24%,transparent)}}
|
|
373
430
|
${ON} [data-dpt-composer][data-dpt-done]{animation:dpt-done 900ms var(--dpt-ease-out) 1}
|
|
374
431
|
@keyframes dpt-done{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--dpt-brand) 60%,transparent)}100%{box-shadow:0 0 0 26px color-mix(in srgb,var(--dpt-brand) 0%,transparent)}}
|
|
375
432
|
${ON}[data-dpt-busy] [data-dpt-send]{position:relative}
|
|
@@ -392,7 +449,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
392
449
|
@keyframes dpt-pop{from{opacity:0;transform:translateY(8px) scale(0.98)}to{opacity:1;transform:none}}
|
|
393
450
|
.dpt-ripple{position:fixed;z-index:2147483000;pointer-events:none;width:20px;height:20px;margin:-10px 0 0 -10px;border-radius:50%;border:2px solid color-mix(in srgb,var(--dpt-brand,#3370ff) 75%,transparent);background:radial-gradient(circle,color-mix(in srgb,var(--dpt-brand,#3370ff) 45%,transparent),color-mix(in srgb,var(--dpt-brand,#3370ff) 12%,transparent) 60%,transparent 72%);animation:dpt-ripple 650ms cubic-bezier(.22,1,.36,1) forwards}
|
|
394
451
|
@keyframes dpt-ripple{0%{transform:scale(.3);opacity:1}100%{transform:scale(7);opacity:0}}
|
|
395
|
-
.dpt-fx{position:fixed;inset:0;width:100vw;height:100vh;z-index:2147482000;pointer-events:none}
|
|
452
|
+
.dpt-fx{position:fixed;inset:0;width:100vw;height:100vh;z-index:2147482000;pointer-events:none;-webkit-app-region:initial!important}
|
|
396
453
|
@media (prefers-reduced-motion:reduce){
|
|
397
454
|
${ON} *,${ON} *::before,${ON} *::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important}
|
|
398
455
|
}
|
|
@@ -416,6 +473,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
416
473
|
// ---------------------------------------------------------------------------------------------
|
|
417
474
|
const SESSIONS = {
|
|
418
475
|
map: new Map(), subs: new Set(),
|
|
476
|
+
// Sessions whose subagents are running, reported by the side card (Deep PTC sessions only).
|
|
477
|
+
working: new Map(),
|
|
478
|
+
setWorking(id, value) { if (this.working.get(id) === value) return; if (value) this.working.set(id, true); else this.working.delete(id); this.emit(); },
|
|
419
479
|
set(id, value) { this.map.set(id, value); this.emit(); },
|
|
420
480
|
del(id) { this.map.delete(id); this.emit(); },
|
|
421
481
|
emit() { for (const listener of this.subs) { try { listener(); } catch (error) { console.warn(`[${PLUGIN}]`, error); } } },
|
|
@@ -431,6 +491,27 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
431
491
|
},
|
|
432
492
|
};
|
|
433
493
|
const BUSY = { bridge: false, dom: false, was: false, timer: 0 };
|
|
494
|
+
const EFFECTS_KEY = `${PLUGIN}:visual-effects`;
|
|
495
|
+
function readEffects() {
|
|
496
|
+
try { return localStorage.getItem(EFFECTS_KEY) !== '0'; } catch { return true; }
|
|
497
|
+
}
|
|
498
|
+
let effectsEnabled = readEffects();
|
|
499
|
+
const effectListeners = new Set();
|
|
500
|
+
const getEffects = () => effectsEnabled;
|
|
501
|
+
function subscribeEffects(listener) {
|
|
502
|
+
effectListeners.add(listener);
|
|
503
|
+
return () => effectListeners.delete(listener);
|
|
504
|
+
}
|
|
505
|
+
function setEffects(enabled) {
|
|
506
|
+
if (effectsEnabled === enabled) return;
|
|
507
|
+
effectsEnabled = enabled;
|
|
508
|
+
for (const listener of effectListeners) listener();
|
|
509
|
+
}
|
|
510
|
+
function toggleEffects() {
|
|
511
|
+
const enabled = !effectsEnabled;
|
|
512
|
+
try { localStorage.setItem(EFFECTS_KEY, enabled ? '1' : '0'); } catch { /* use the in-memory preference */ }
|
|
513
|
+
setEffects(enabled);
|
|
514
|
+
}
|
|
434
515
|
// The standalone dsh-refined-ui draws the same look; never stack both.
|
|
435
516
|
const refinedPresent = () => typeof document !== 'undefined' && document.querySelector('style[data-plugin="dsh-refined-ui"]') !== null;
|
|
436
517
|
const uiOn = () => typeof document !== 'undefined' && document.body?.hasAttribute('data-dpt-ui');
|
|
@@ -438,7 +519,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
438
519
|
if (typeof document === 'undefined') return;
|
|
439
520
|
const busy = uiOn() && (BUSY.bridge || BUSY.dom);
|
|
440
521
|
document.body.toggleAttribute('data-dpt-busy', busy);
|
|
441
|
-
if (BUSY.was && !busy) {
|
|
522
|
+
if (BUSY.was && !busy && uiOn()) {
|
|
442
523
|
const card = document.querySelector('[data-dpt-composer]');
|
|
443
524
|
if (card) {
|
|
444
525
|
card.setAttribute('data-dpt-done', '');
|
|
@@ -450,22 +531,43 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
450
531
|
}
|
|
451
532
|
function watchActiveSession() {
|
|
452
533
|
if (typeof document === 'undefined') return () => {};
|
|
534
|
+
let stopVisuals;
|
|
535
|
+
function disableVisuals() {
|
|
536
|
+
if (!stopVisuals) return;
|
|
537
|
+
clearTimeout(BUSY.timer);
|
|
538
|
+
document.querySelectorAll('[data-dpt-done]').forEach(node => node.removeAttribute('data-dpt-done'));
|
|
539
|
+
stopVisuals();
|
|
540
|
+
stopVisuals = undefined;
|
|
541
|
+
}
|
|
453
542
|
const update = () => {
|
|
454
543
|
const current = SESSIONS.current();
|
|
455
|
-
const on = current?.preset === 'deep-ptc' && !refinedPresent();
|
|
544
|
+
const on = effectsEnabled && current?.preset === 'deep-ptc' && !refinedPresent();
|
|
456
545
|
document.body.toggleAttribute('data-dpt-ui', on);
|
|
457
|
-
|
|
546
|
+
// Like dsh-refined-ui, a running subagent keeps the conversation working.
|
|
547
|
+
BUSY.bridge = on && (current?.busy === true || SESSIONS.working.get(current?.id) === true);
|
|
458
548
|
applyBusy();
|
|
549
|
+
if (on && !stopVisuals) {
|
|
550
|
+
const cleanups = [watchSurfaces(), watchPalette(), watchInteractions(), watchFx()];
|
|
551
|
+
stopVisuals = () => cleanups.reverse().forEach(cleanup => cleanup());
|
|
552
|
+
} else if (!on) disableVisuals();
|
|
459
553
|
};
|
|
460
554
|
SESSIONS.subs.add(update);
|
|
555
|
+
const unsubscribe = subscribeEffects(update);
|
|
556
|
+
const sync = event => { if (event.key === EFFECTS_KEY || event.key === null) setEffects(readEffects()); };
|
|
557
|
+
window.addEventListener('storage', sync);
|
|
461
558
|
// Visibility changes without a remount (split views, tab switches) are caught here.
|
|
462
559
|
const timer = setInterval(update, 1000);
|
|
463
560
|
update();
|
|
464
561
|
return () => {
|
|
465
562
|
SESSIONS.subs.delete(update);
|
|
563
|
+
unsubscribe();
|
|
564
|
+
window.removeEventListener('storage', sync);
|
|
466
565
|
clearInterval(timer);
|
|
467
566
|
document.body.removeAttribute('data-dpt-ui');
|
|
468
567
|
document.body.removeAttribute('data-dpt-busy');
|
|
568
|
+
BUSY.bridge = false;
|
|
569
|
+
BUSY.was = false;
|
|
570
|
+
disableVisuals();
|
|
469
571
|
};
|
|
470
572
|
}
|
|
471
573
|
|
|
@@ -474,7 +576,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
474
576
|
function watchSurfaces() {
|
|
475
577
|
if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return () => {};
|
|
476
578
|
const tagged = new Set();
|
|
477
|
-
const relativized = new
|
|
579
|
+
const relativized = new Map();
|
|
580
|
+
const highlighted = new Set();
|
|
478
581
|
let frame = 0;
|
|
479
582
|
const mark = (node, attribute) => { node.setAttribute(attribute, ''); tagged.add([node, attribute]); };
|
|
480
583
|
const findComposer = input => {
|
|
@@ -493,7 +596,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
493
596
|
card = findComposer(input);
|
|
494
597
|
if (!card) continue;
|
|
495
598
|
mark(card, 'data-dpt-composer');
|
|
496
|
-
if (getComputedStyle(card).position === 'static') {
|
|
599
|
+
if (getComputedStyle(card).position === 'static') {
|
|
600
|
+
relativized.set(card, [card.style.position, card.style.getPropertyPriority('position')]);
|
|
601
|
+
card.style.position = 'relative';
|
|
602
|
+
}
|
|
497
603
|
}
|
|
498
604
|
if (card.querySelector('[data-dpt-send]')) continue;
|
|
499
605
|
// The send button is the right-most button in the card.
|
|
@@ -524,6 +630,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
524
630
|
const rect = host.getBoundingClientRect();
|
|
525
631
|
host.style.setProperty('--dpt-mx', `${event.clientX - rect.left}px`);
|
|
526
632
|
host.style.setProperty('--dpt-my', `${event.clientY - rect.top}px`);
|
|
633
|
+
highlighted.add(host);
|
|
527
634
|
}
|
|
528
635
|
const run = () => {
|
|
529
636
|
frame = 0;
|
|
@@ -545,8 +652,13 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
545
652
|
applyBusy();
|
|
546
653
|
for (const [node, attribute] of tagged) node.removeAttribute(attribute);
|
|
547
654
|
tagged.clear();
|
|
548
|
-
for (const node of relativized)
|
|
549
|
-
|
|
655
|
+
for (const [node, [position, priority]] of relativized) {
|
|
656
|
+
if (node.style.position === 'relative') node.style.setProperty('position', position, priority);
|
|
657
|
+
}
|
|
658
|
+
for (const node of highlighted) {
|
|
659
|
+
node.style.removeProperty('--dpt-mx');
|
|
660
|
+
node.style.removeProperty('--dpt-my');
|
|
661
|
+
}
|
|
550
662
|
};
|
|
551
663
|
}
|
|
552
664
|
|
|
@@ -721,8 +833,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
721
833
|
|
|
722
834
|
// Send burst, completion sparkle and embers while the agent works.
|
|
723
835
|
function watchFx() {
|
|
724
|
-
if (typeof document === 'undefined' || typeof requestAnimationFrame === 'undefined'
|
|
725
|
-
|
|
836
|
+
if (typeof document === 'undefined' || typeof requestAnimationFrame === 'undefined' || typeof MutationObserver === 'undefined'
|
|
837
|
+
|| window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches === true) return () => {};
|
|
726
838
|
const canvas = document.createElement('canvas');
|
|
727
839
|
canvas.className = 'dpt-fx';
|
|
728
840
|
canvas.setAttribute('aria-hidden', 'true');
|
|
@@ -730,16 +842,18 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
730
842
|
if (!paint) return () => {};
|
|
731
843
|
document.body.appendChild(canvas);
|
|
732
844
|
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
733
|
-
let width = 0, height = 0, parts = [], raf = 0, lastEmber = 0
|
|
845
|
+
let width = 0, height = 0, parts = [], raf = 0, lastEmber = 0;
|
|
846
|
+
const fireworks = new Set();
|
|
734
847
|
const hues = ['#3370ff', '#5b8cff', '#7fd0ff', '#9dbcff', '#b48cff', '#ffffff'];
|
|
735
848
|
const busy = () => document.body.hasAttribute('data-dpt-busy');
|
|
849
|
+
let wasBusy = busy();
|
|
736
850
|
function resize() {
|
|
737
851
|
width = window.innerWidth; height = window.innerHeight;
|
|
738
852
|
canvas.width = width * dpr; canvas.height = height * dpr;
|
|
739
853
|
paint.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
740
854
|
}
|
|
741
855
|
function burst(x, y, count, power) {
|
|
742
|
-
if (
|
|
856
|
+
if (!uiOn()) return;
|
|
743
857
|
for (let index = 0; index < count; index++) {
|
|
744
858
|
const angle = Math.random() * Math.PI * 2, speed = (0.4 + Math.random()) * power;
|
|
745
859
|
parts.push({ x, y, vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed - power * 0.35, life: 1,
|
|
@@ -754,12 +868,13 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
754
868
|
paint.globalCompositeOperation = 'lighter';
|
|
755
869
|
const composer = document.querySelector('[data-dpt-composer]');
|
|
756
870
|
const now = performance.now();
|
|
757
|
-
|
|
871
|
+
// Embers rise from the composer while the agent works: twice as often as dsh-refined-ui, slightly larger.
|
|
872
|
+
if (busy() && composer && now - lastEmber > 35) {
|
|
758
873
|
lastEmber = now;
|
|
759
874
|
const rect = composer.getBoundingClientRect();
|
|
760
875
|
parts.push({ x: rect.left + 12 + Math.random() * (rect.width - 24), y: rect.top + 2, vx: (Math.random() - 0.5) * 0.5,
|
|
761
876
|
vy: -(0.5 + Math.random() * 1.1), gravity: -0.004, life: 1, decay: 0.009 + Math.random() * 0.01,
|
|
762
|
-
r: 1.
|
|
877
|
+
r: 1.8 + Math.random() * 2.4, color: hues[(Math.random() * 4) | 0] });
|
|
763
878
|
}
|
|
764
879
|
parts = parts.filter(part => part.life > 0);
|
|
765
880
|
for (const part of parts) {
|
|
@@ -804,8 +919,15 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
804
919
|
observer.observe(document.body, { attributes: true, attributeFilter: ['data-dpt-busy'] });
|
|
805
920
|
document.addEventListener('pointerdown', onDown, true);
|
|
806
921
|
document.addEventListener('keydown', onKey, true);
|
|
922
|
+
if (wasBusy) kick();
|
|
807
923
|
FX.burst = () => {
|
|
808
|
-
[[0.3, 0.45], [0.5, 0.3], [0.7, 0.45]].forEach(([x, y], index) =>
|
|
924
|
+
[[0.3, 0.45], [0.5, 0.3], [0.7, 0.45]].forEach(([x, y], index) => {
|
|
925
|
+
const timer = setTimeout(() => {
|
|
926
|
+
fireworks.delete(timer);
|
|
927
|
+
burst(width * x, height * y, 60, 5.6);
|
|
928
|
+
}, index * 220);
|
|
929
|
+
fireworks.add(timer);
|
|
930
|
+
});
|
|
809
931
|
};
|
|
810
932
|
return () => {
|
|
811
933
|
FX.burst = () => {};
|
|
@@ -814,6 +936,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
814
936
|
document.removeEventListener('keydown', onKey, true);
|
|
815
937
|
observer.disconnect();
|
|
816
938
|
if (raf) cancelAnimationFrame(raf);
|
|
939
|
+
for (const timer of fireworks) clearTimeout(timer);
|
|
817
940
|
canvas.remove();
|
|
818
941
|
};
|
|
819
942
|
}
|
|
@@ -864,6 +987,15 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
864
987
|
onClick: () => { if (!disabled) onChange(!on); } }, h('span', { className: 'dpt-switch-thumb', 'aria-hidden': 'true' }));
|
|
865
988
|
}
|
|
866
989
|
|
|
990
|
+
function VisualEffectsSection({ t }) {
|
|
991
|
+
const enabled = React.useSyncExternalStore(subscribeEffects, getEffects, getEffects);
|
|
992
|
+
const label = t('visualEffects');
|
|
993
|
+
return h('section', { className: 'dpt-side-section dpt-side-effects', 'aria-label': label },
|
|
994
|
+
h('div', { className: 'dpt-side-label' }, h('span', null, label),
|
|
995
|
+
h(SkillSwitch, { on: enabled, label, onChange: toggleEffects })),
|
|
996
|
+
h('p', { className: 'dpt-side-note' }, t('visualEffectsHint')));
|
|
997
|
+
}
|
|
998
|
+
|
|
867
999
|
function SkillCard({ turn, useProjection, useChat, setSkill, setAll, t }) {
|
|
868
1000
|
const [busy, setBusy] = React.useState(false);
|
|
869
1001
|
const [expanded, setExpanded] = React.useState(false);
|
|
@@ -916,6 +1048,8 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
916
1048
|
// ---------------------------------------------------------------------------------------------
|
|
917
1049
|
const AGENT_ROWS = 24;
|
|
918
1050
|
const PANEL_WIDTH = 248;
|
|
1051
|
+
// Docked, the card is a column split off the right side of the conversation, flush with its edge.
|
|
1052
|
+
const SPLIT_WIDTH = 272;
|
|
919
1053
|
const DOCK_MIN_WIDTH = 960;
|
|
920
1054
|
const COLLAPSED_KEY = `${PLUGIN}:subagents-collapsed`;
|
|
921
1055
|
const readCollapsed = () => { try { return localStorage.getItem(COLLAPSED_KEY) === '1'; } catch { return false; } };
|
|
@@ -937,7 +1071,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
937
1071
|
const summary = sessions?.byId?.[entry.id];
|
|
938
1072
|
const timing = summary?.projectionValues?.subagentTiming;
|
|
939
1073
|
const external = entry.mode === 'external';
|
|
940
|
-
|
|
1074
|
+
// The parent's catalog refreshes only when the official dropdown opens; the session list carries
|
|
1075
|
+
// each session's live running flag.
|
|
1076
|
+
const running = !external && (entry.activity === 'running' || summary?.running === true);
|
|
941
1077
|
const completed = !external && entry.activity === 'inactive' && timing?.lastTurnCompleted === true;
|
|
942
1078
|
const duration = timing === undefined || external ? undefined : timing.active === undefined ? timing.settledMs
|
|
943
1079
|
: timing.settledMs + Math.max(0, (running ? now : timing.active.through) - timing.active.since);
|
|
@@ -997,11 +1133,14 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
997
1133
|
const region = regions.find(node => !anyMain || node.closest('[data-slot="main.conversation"]'));
|
|
998
1134
|
const rect = region?.getBoundingClientRect();
|
|
999
1135
|
if (!region || !rect || rect.width === 0) { if (last !== '-') { last = '-'; lastRegion = undefined; setLayout(undefined); } return; }
|
|
1136
|
+
// Docked, the region gives up the column's width, so its parent marks the conversation's right edge.
|
|
1137
|
+
const host = region.parentElement?.getBoundingClientRect() ?? rect;
|
|
1000
1138
|
const composer = region.querySelector('[data-composer-seat]')?.getBoundingClientRect();
|
|
1001
1139
|
const bottom = composer && composer.top > rect.top ? composer.top - 12 : rect.bottom - 12;
|
|
1002
1140
|
const next = { region, top: Math.round(rect.top + 12), right: Math.round(window.innerWidth - rect.right + 16),
|
|
1003
|
-
maxHeight: Math.max(120, Math.round(bottom - rect.top - 12)), wide:
|
|
1004
|
-
|
|
1141
|
+
maxHeight: Math.max(120, Math.round(bottom - rect.top - 12)), wide: host.width >= DOCK_MIN_WIDTH,
|
|
1142
|
+
split: { top: Math.round(rect.top), right: Math.round(window.innerWidth - host.right), height: Math.round(rect.height) } };
|
|
1143
|
+
const key = `${next.top}|${next.right}|${next.maxHeight}|${next.wide}|${next.split.top}|${next.split.right}|${next.split.height}`;
|
|
1005
1144
|
if (key !== last || region !== lastRegion) { last = key; lastRegion = region; setLayout(next); }
|
|
1006
1145
|
};
|
|
1007
1146
|
measure();
|
|
@@ -1018,7 +1157,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1018
1157
|
const NO_FORM = { status: 'unavailable' };
|
|
1019
1158
|
const noSubscribe = () => () => {};
|
|
1020
1159
|
const noSnapshot = () => NO_FORM;
|
|
1021
|
-
const allowedEnvironments = platform => platform === 'win32' ? ['auto', 'wsl', 'powershell'] : ['auto', 'zsh', 'bash'];
|
|
1160
|
+
const allowedEnvironments = platform => platform === 'win32' ? ['auto', 'wsl', 'powershell', 'bash'] : ['auto', 'zsh', 'bash'];
|
|
1022
1161
|
const effectiveEnvironment = (environment, platform) => environment !== 'auto' ? environment
|
|
1023
1162
|
: platform === 'win32' ? 'powershell' : platform === 'darwin' ? 'zsh' : 'bash';
|
|
1024
1163
|
const envLabel = (value, t) => value === 'auto' ? t('envAuto') : ENV_SHORT[value] ?? value;
|
|
@@ -1034,11 +1173,14 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1034
1173
|
const [saving, setSaving] = React.useState(false);
|
|
1035
1174
|
const [message, setMessage] = React.useState(null);
|
|
1036
1175
|
const [distribution, setDistribution] = React.useState(undefined);
|
|
1176
|
+
const [bashPath, setBashPath] = React.useState(undefined);
|
|
1037
1177
|
if (!form || state.status === 'unavailable') return null;
|
|
1038
1178
|
if (state.status !== 'ready' || !state.value) return h('section', { className: 'dpt-side-section' }, h('p', { className: 'dpt-side-note' }, t('loading')));
|
|
1039
1179
|
const value = state.value;
|
|
1040
1180
|
const platform = value.hostPlatform;
|
|
1041
1181
|
const environment = value.environment ?? 'auto';
|
|
1182
|
+
const editingBash = platform === 'win32' && (environment === 'bash' || bashPath !== undefined);
|
|
1183
|
+
const bashDraft = bashPath ?? value.shellExecutable ?? '';
|
|
1042
1184
|
const effective = effectiveEnvironment(environment, platform);
|
|
1043
1185
|
const choices = (Array.isArray(value.shellChoices) ? value.shellChoices : []).filter(item => item && typeof item.id === 'string');
|
|
1044
1186
|
const disabled = !state.writable || saving;
|
|
@@ -1057,6 +1199,12 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1057
1199
|
} finally { setSaving(false); }
|
|
1058
1200
|
}
|
|
1059
1201
|
function choose(next) {
|
|
1202
|
+
if (platform === 'win32' && next === 'bash') {
|
|
1203
|
+
if (environment !== 'bash') setBashPath('');
|
|
1204
|
+
setMessage(null);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
setBashPath(undefined);
|
|
1060
1208
|
if (next === environment) return;
|
|
1061
1209
|
const family = effectiveEnvironment(next, platform);
|
|
1062
1210
|
const current = choices.find(item => item.id === value.shellExecutable);
|
|
@@ -1071,17 +1219,33 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1071
1219
|
if (next === savedDistribution) { setDistribution(undefined); return; }
|
|
1072
1220
|
if (await save([{ op: 'set', path: ['wslDistribution'], value: next }], next ? `WSL (${next})` : 'WSL')) setDistribution(undefined);
|
|
1073
1221
|
}
|
|
1222
|
+
async function saveBash(event) {
|
|
1223
|
+
event.preventDefault();
|
|
1224
|
+
const next = bashDraft.trim();
|
|
1225
|
+
if (!next || (environment === 'bash' && next === value.shellExecutable)) return;
|
|
1226
|
+
if (await save([{ op: 'set', path: ['environment'], value: 'bash' },
|
|
1227
|
+
{ op: 'set', path: ['shellExecutable'], value: next }], 'Bash')) setBashPath(undefined);
|
|
1228
|
+
}
|
|
1074
1229
|
const familyChoices = choices.filter(item => item.family === effective);
|
|
1075
1230
|
return h('section', { className: 'dpt-side-section', 'aria-label': t('environment') },
|
|
1076
1231
|
h('div', { className: 'dpt-side-label' }, h('span', null, t('environment')), h('span', { className: 'dpt-side-hint' }, t('envForNew'))),
|
|
1077
1232
|
h('div', { className: 'dpt-seg', role: 'radiogroup', 'aria-label': t('environment') },
|
|
1078
1233
|
...allowedEnvironments(platform).map(option => h('button', { key: option, type: 'button', role: 'radio', className: 'dpt-seg-btn',
|
|
1079
|
-
'aria-checked': option ===
|
|
1080
|
-
|
|
1234
|
+
'aria-checked': option === (editingBash ? 'bash' : environment), disabled,
|
|
1235
|
+
title: t(platform === 'win32' && option === 'bash' ? 'windowsBash' : option),
|
|
1236
|
+
onClick: () => choose(option) }, envLabel(option, t)))),
|
|
1237
|
+
editingBash ? h(React.Fragment, null,
|
|
1238
|
+
h('form', { className: 'dpt-field', onSubmit: saveBash },
|
|
1239
|
+
h('input', { className: 'dpt-input', value: bashDraft, disabled, placeholder: t('bashPath'), 'aria-label': t('bashPath'),
|
|
1240
|
+
onChange: event => { setBashPath(event.target.value); setMessage(null); } }),
|
|
1241
|
+
(environment !== 'bash' || bashDraft.trim() !== value.shellExecutable)
|
|
1242
|
+
? h('button', { type: 'submit', className: 'dpt-btn', disabled: disabled || !bashDraft.trim() }, t('save')) : null),
|
|
1243
|
+
h('p', { className: 'dpt-side-note' }, t('bashPathHint'))) : null,
|
|
1244
|
+
!editingBash && effective === 'wsl' ? h('form', { className: 'dpt-field', onSubmit: saveDistribution },
|
|
1081
1245
|
h('input', { className: 'dpt-input', value: draft, disabled, placeholder: t('envDefaultDistribution'), 'aria-label': t('distribution'),
|
|
1082
1246
|
title: t('distributionHint'), onChange: event => { setDistribution(event.target.value); setMessage(null); } }),
|
|
1083
1247
|
draft.trim() !== savedDistribution ? h('button', { type: 'submit', className: 'dpt-btn', disabled }, t('save')) : null) : null,
|
|
1084
|
-
effective !== 'wsl' && familyChoices.length > 0 ? h('div', { className: 'dpt-field' },
|
|
1248
|
+
!editingBash && effective !== 'wsl' && familyChoices.length > 0 ? h('div', { className: 'dpt-field' },
|
|
1085
1249
|
h('select', { className: 'dpt-select', value: value.shellExecutable ?? '', disabled, 'aria-label': t('shell'), title: t('shellHint'),
|
|
1086
1250
|
onChange: event => { const item = familyChoices.find(choice => choice.id === event.target.value);
|
|
1087
1251
|
void save([{ op: 'set', path: ['shellExecutable'], value: event.target.value }], item ? item.label : t('shellAuto')); } },
|
|
@@ -1090,7 +1254,58 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1090
1254
|
message ? message.text : !state.writable ? t('readOnly') : environment === 'auto' ? tf(t, 'envAutoNow', { env: envLabel(effective, t) }) : t('envThisSession')));
|
|
1091
1255
|
}
|
|
1092
1256
|
|
|
1093
|
-
|
|
1257
|
+
const JOB_STATUS = new Map([
|
|
1258
|
+
['running', 'jobRunning'], ['stopping', 'jobStopping'], ['completed', 'jobCompleted'],
|
|
1259
|
+
['killed', 'jobKilled'], ['failed', 'jobFailed'],
|
|
1260
|
+
]);
|
|
1261
|
+
const JOB_PREVIEW_LIMIT = 6;
|
|
1262
|
+
const ACTIVE_JOB_LIMIT = 5;
|
|
1263
|
+
const FINISHED_JOB_LIMIT = 3;
|
|
1264
|
+
|
|
1265
|
+
function BackgroundJobs({ jobs, t }) {
|
|
1266
|
+
const active = [];
|
|
1267
|
+
const finished = [];
|
|
1268
|
+
for (const job of jobs ?? []) {
|
|
1269
|
+
if (job.status === 'running' || job.status === 'stopping') active.push(job);
|
|
1270
|
+
else if (JOB_STATUS.has(job.status)) finished.push(job);
|
|
1271
|
+
}
|
|
1272
|
+
active.sort((left, right) => left.startedAt - right.startedAt);
|
|
1273
|
+
finished.sort((left, right) =>
|
|
1274
|
+
(right.finishedAt ?? right.startedAt) - (left.finishedAt ?? left.startedAt) || left.startedAt - right.startedAt);
|
|
1275
|
+
|
|
1276
|
+
const eligible = [...active.slice(0, ACTIVE_JOB_LIMIT), ...finished.slice(0, FINISHED_JOB_LIMIT)];
|
|
1277
|
+
const total = active.length + finished.length;
|
|
1278
|
+
// Overflow itself occupies one of the six positions, including overflow from either status cap.
|
|
1279
|
+
const hasOverflow = total > eligible.length || total > JOB_PREVIEW_LIMIT;
|
|
1280
|
+
const visibleLimit = hasOverflow ? JOB_PREVIEW_LIMIT - 1 : JOB_PREVIEW_LIMIT;
|
|
1281
|
+
const visible = eligible.slice(0, visibleLimit);
|
|
1282
|
+
const hidden = visible.length < total ? [...active, ...finished].filter(job => !visible.includes(job)) : [];
|
|
1283
|
+
const row = job => {
|
|
1284
|
+
const label = job.label || job.kind || job.id;
|
|
1285
|
+
return h('li', { key: job.id, className: 'dpt-job', 'data-state': job.status },
|
|
1286
|
+
h('span', { className: 'dpt-agent-dot', 'aria-hidden': 'true' }),
|
|
1287
|
+
h('span', { className: 'dpt-agent-main' },
|
|
1288
|
+
h('span', { className: 'dpt-agent-name', title: label }, label),
|
|
1289
|
+
h('span', { className: 'dpt-agent-meta' }, t(JOB_STATUS.get(job.status)))));
|
|
1290
|
+
};
|
|
1291
|
+
const title = t('jobsTitle');
|
|
1292
|
+
return h('section', { className: 'dpt-side-section', 'aria-label': title },
|
|
1293
|
+
h('div', { className: 'dpt-side-label' }, h('span', null, title)),
|
|
1294
|
+
total ? h('ul', { className: 'dpt-jobs-list' }, ...visible.map(row),
|
|
1295
|
+
hidden.length ? h('li', { className: 'dpt-jobs-more' },
|
|
1296
|
+
h('details', null, h('summary', null, tf(t, 'jobsMore', { count: hidden.length })),
|
|
1297
|
+
h('ul', { className: 'dpt-jobs-list' }, ...hidden.map(row)))) : null)
|
|
1298
|
+
: h('p', { className: 'dpt-side-note' }, t('jobsEmpty')));
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Desktop RCs expose the jobs roster through a dedicated service. Other hosts include it in sessions.
|
|
1302
|
+
function LiveBackgroundJobs({ sessionId, useJobs, watchJobs, t }) {
|
|
1303
|
+
const jobs = useJobs(state => state.rows[sessionId]);
|
|
1304
|
+
React.useEffect(() => watchJobs(sessionId), [sessionId, watchJobs]);
|
|
1305
|
+
return h(BackgroundJobs, { jobs, t });
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function SidePanel({ sessionId, useSessions, useProjection, useJobs, watchJobs, reset, form, t }) {
|
|
1094
1309
|
const sessions = typeof useSessions === 'function' ? useSessions(state => state) : undefined;
|
|
1095
1310
|
let tools;
|
|
1096
1311
|
try { tools = typeof useProjection === 'function' ? useProjection('deepPtcTools') : undefined; } catch { tools = undefined; }
|
|
@@ -1105,13 +1320,17 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1105
1320
|
const running = rows.filter(row => row.state === 'running').length;
|
|
1106
1321
|
const completed = rows.filter(row => row.state === 'completed').length;
|
|
1107
1322
|
const hasEnvironment = !!form && settings.status !== 'unavailable';
|
|
1108
|
-
const layout = useChatRegion(sessionId,
|
|
1323
|
+
const layout = useChatRegion(sessionId, canPortal());
|
|
1109
1324
|
const docked = !!layout && layout.wide && !collapsed;
|
|
1110
1325
|
React.useEffect(() => {
|
|
1111
1326
|
if (running === 0) return undefined;
|
|
1112
1327
|
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
1113
1328
|
return () => clearInterval(timer);
|
|
1114
1329
|
}, [running > 0]);
|
|
1330
|
+
React.useEffect(() => {
|
|
1331
|
+
SESSIONS.setWorking(sessionId, running > 0);
|
|
1332
|
+
return () => SESSIONS.setWorking(sessionId, false);
|
|
1333
|
+
}, [sessionId, running > 0]);
|
|
1115
1334
|
React.useEffect(() => {
|
|
1116
1335
|
const region = layout?.region;
|
|
1117
1336
|
if (!region) return undefined;
|
|
@@ -1125,7 +1344,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1125
1344
|
};
|
|
1126
1345
|
return () => { PANEL.toggle = () => {}; };
|
|
1127
1346
|
}, [layout?.wide]);
|
|
1128
|
-
if (!layout ||
|
|
1347
|
+
if (!layout || !canPortal()) return null;
|
|
1129
1348
|
const position = { top: `${layout.top}px`, right: `${layout.right}px` };
|
|
1130
1349
|
const summary = [running ? tf(t, 'agentsRunning', { count: running }) : null, completed ? tf(t, 'agentsCompleted', { count: completed }) : null,
|
|
1131
1350
|
rows.length - running - completed > 0 ? tf(t, 'agentsIdle', { count: rows.length - running - completed }) : null].filter(Boolean).join(' · ');
|
|
@@ -1139,7 +1358,10 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1139
1358
|
}
|
|
1140
1359
|
const stateText = row => row.state === 'running' ? t('agentRunning') : row.state === 'completed' ? t('agentCompleted') : row.state === 'external' ? t('agentExternal') : t('agentIdle');
|
|
1141
1360
|
const collapse = () => { if (layout.wide) { writeCollapsed(true); setCollapsed(true); } setPeek(false); };
|
|
1142
|
-
|
|
1361
|
+
const frame = docked
|
|
1362
|
+
? { top: `${layout.split.top}px`, right: `${layout.split.right}px`, height: `${layout.split.height}px`, width: `${SPLIT_WIDTH}px` }
|
|
1363
|
+
: { ...position, maxHeight: `${layout.maxHeight}px`, width: `${PANEL_WIDTH}px` };
|
|
1364
|
+
return ReactDOM.createPortal(h('aside', { className: 'dpt-agents', 'data-split': docked ? '' : undefined, 'aria-label': t('sideTitle'), style: frame },
|
|
1143
1365
|
h('header', { className: 'dpt-agents-head' },
|
|
1144
1366
|
h('span', { className: 'dpt-agents-title' }, t('sideTitle')),
|
|
1145
1367
|
h('span', { className: 'dpt-agents-count' }),
|
|
@@ -1148,6 +1370,7 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1148
1370
|
h('path', { d: 'M6 4l4 4-4 4', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round' })))),
|
|
1149
1371
|
h('div', { className: 'dpt-side-body' },
|
|
1150
1372
|
hasEnvironment ? h(EnvironmentSection, { form, t }) : null,
|
|
1373
|
+
h(VisualEffectsSection, { t }),
|
|
1151
1374
|
rows.length ? h('section', { className: 'dpt-side-section dpt-side-agents', 'aria-label': t('agentsTitle') },
|
|
1152
1375
|
h('div', { className: 'dpt-side-label' }, h('span', null, t('agentsTitle')), h('span', { className: 'dpt-side-hint', title: summary }, summary)),
|
|
1153
1376
|
h('ol', { className: 'dpt-agents-list' }, ...rows.map(row => {
|
|
@@ -1159,6 +1382,9 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1159
1382
|
h('span', { className: 'dpt-agent-main' }, h('span', { className: 'dpt-agent-name', title: row.label }, row.label),
|
|
1160
1383
|
h('span', { className: 'dpt-agent-meta' }, meta))));
|
|
1161
1384
|
}))) : null,
|
|
1385
|
+
typeof useJobs === 'function' && typeof watchJobs === 'function'
|
|
1386
|
+
? h(LiveBackgroundJobs, { key: sessionId, sessionId, useJobs, watchJobs, t })
|
|
1387
|
+
: h(BackgroundJobs, { key: sessionId, jobs: sessions?.jobsBySession?.[sessionId], t }),
|
|
1162
1388
|
hasTools ? h(ToolStateControls, { sessionId, useProjection, reset, t }) : null)), document.body);
|
|
1163
1389
|
}
|
|
1164
1390
|
|
|
@@ -1213,10 +1439,6 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1213
1439
|
ctx.effect(() => ctx.locale.register('deep-ptc', dictionaries));
|
|
1214
1440
|
ctx.effect(() => injectCss(), `${PLUGIN}: style`);
|
|
1215
1441
|
ctx.effect(() => watchActiveSession(), `${PLUGIN}: active session`);
|
|
1216
|
-
ctx.effect(() => watchSurfaces(), `${PLUGIN}: surface tags`);
|
|
1217
|
-
ctx.effect(() => watchPalette(), `${PLUGIN}: command palette`);
|
|
1218
|
-
ctx.effect(() => watchInteractions(), `${PLUGIN}: interactions`);
|
|
1219
|
-
ctx.effect(() => watchFx(), `${PLUGIN}: effects`);
|
|
1220
1442
|
ctx.effect(() => watchDiagnostics(), `${PLUGIN}: diagnostics`);
|
|
1221
1443
|
const form = ctx.configForms.get(NS);
|
|
1222
1444
|
ctx.effect(() => ctx.configForms.whileServed([NS], () =>
|
|
@@ -1250,13 +1472,21 @@ ${ON}[data-dpt-busy] [data-dpt-send]::after{content:"";position:absolute;inset:-
|
|
|
1250
1472
|
// The side card draws beside the conversation through a portal; nothing shows under the composer.
|
|
1251
1473
|
child.slots.inject('conversation.composer.dock', () => child.slots.register({
|
|
1252
1474
|
name: 'conversation.composer.dock', id: 'deep-ptc-side', order: 89,
|
|
1253
|
-
inject: sessionId =>
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1475
|
+
inject: sessionId => {
|
|
1476
|
+
const jobs = child.get?.('jobs');
|
|
1477
|
+
const props = {
|
|
1478
|
+
reset: () => {
|
|
1479
|
+
const execute = child.remote?.commands?.execute;
|
|
1480
|
+
if (typeof execute !== 'function') return Promise.resolve({ ok: false, error: { message: 'unavailable' } });
|
|
1481
|
+
return execute(sessionId, '/deep-ptc-reset-tools', []);
|
|
1482
|
+
},
|
|
1483
|
+
};
|
|
1484
|
+
if (jobs?.state && typeof jobs.watchRows === 'function') {
|
|
1485
|
+
props.hooks = { jobs: jobs.state };
|
|
1486
|
+
props.watchJobs = id => jobs.watchRows(id);
|
|
1487
|
+
}
|
|
1488
|
+
return props;
|
|
1489
|
+
},
|
|
1260
1490
|
}, props => h(SideCardHost, { ...props, form, t })));
|
|
1261
1491
|
} catch { /* the composer stays usable when this slot cannot register */ }
|
|
1262
1492
|
});
|