@restregular/dsh-powerup 0.8.12 → 0.8.14
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/README.md +18 -0
- package/client.js +229 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,24 @@ actions. The setting is stored in the browser. It also holds the defaults for
|
|
|
40
40
|
**one-click install** (auto-enable and auto-restart), which the plugin installer
|
|
41
41
|
uses.
|
|
42
42
|
|
|
43
|
+
### Switch sessions from the title
|
|
44
|
+
|
|
45
|
+
Clicking the current conversation title opens a dropdown of the sessions that
|
|
46
|
+
are running, each prefixed with its workspace name; picking one switches the
|
|
47
|
+
conversation. The title is only marked with a `data-*` attribute — React keeps
|
|
48
|
+
owning the crumb — and the dropdown is a body-level fixed panel, so the header's
|
|
49
|
+
drag area and clipping cannot swallow it. The title row is also a window-drag
|
|
50
|
+
region, so a press that moves more than a few pixels is treated as a drag and
|
|
51
|
+
never opens the panel.
|
|
52
|
+
|
|
53
|
+
The panel behaves like the host's own background-jobs popover: it stays open
|
|
54
|
+
while the page keeps changing. Streaming output, new records, a refreshed job
|
|
55
|
+
list or a session starting/stopping only re-render the rows in place. If the
|
|
56
|
+
host replaces the crumb node the panel re-anchors onto the new one instead of
|
|
57
|
+
closing; if the current session changes, the header disappears, or the panel's
|
|
58
|
+
title is clicked again, it closes. `Esc` and a click anywhere outside also
|
|
59
|
+
close it. It is on by default and can be turned off in the Power-Up page.
|
|
60
|
+
|
|
43
61
|
### Stop a background job with a reason
|
|
44
62
|
|
|
45
63
|
The session header's background jobs panel keeps the host's list, live output,
|
package/client.js
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
const NS = 'dsh-powerup';
|
|
71
71
|
const SETTINGS_KEY = 'dsh-powerup:settings:v1';
|
|
72
|
-
const VERSION = '0.8.
|
|
72
|
+
const VERSION = '0.8.14';
|
|
73
73
|
const MENU_GAP = 8;
|
|
74
74
|
const MENU_WIDTH = 248;
|
|
75
75
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -2877,9 +2877,11 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
2877
2877
|
.dsh-powerup-session-pop.is-open{opacity:1;transform:none}
|
|
2878
2878
|
.dsh-powerup-session-pop-head{flex:none;padding:10px 12px 8px;border-bottom:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:uppercase}
|
|
2879
2879
|
.dsh-powerup-session-pop-list{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:4px;padding:6px}
|
|
2880
|
-
.dsh-powerup-session-pop-item{display:flex;align-items:center;gap:8px;width:100%;box-sizing:border-box;padding:7px 9px;border:0;border-radius:var(--dsw-radius-md,7px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;text-align:left;cursor:pointer}
|
|
2881
|
-
.dsh-powerup-session-pop-item:hover{background:var(--dsw-alias-bg-layer-
|
|
2880
|
+
.dsh-powerup-session-pop-item{display:flex;align-items:center;gap:8px;width:100%;box-sizing:border-box;padding:7px 9px;border:0;border-radius:var(--dsw-radius-md,7px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;text-align:left;cursor:pointer;transition:background .12s ease,color .12s ease}
|
|
2881
|
+
.dsh-powerup-session-pop-item:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-3));color:var(--dsw-alias-label-primary)}
|
|
2882
2882
|
.dsh-powerup-session-pop-item[data-current]{background:var(--dsw-alias-bg-layer-2)}
|
|
2883
|
+
.dsh-powerup-session-pop-item[data-current]:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-3))}
|
|
2884
|
+
.dsh-powerup-session-pop-item:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-1px}
|
|
2883
2885
|
.dsh-powerup-session-pop-dot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-state-success-primary)}
|
|
2884
2886
|
.dsh-powerup-session-pop-item[data-current] .dsh-powerup-session-pop-dot{background:var(--dsw-alias-brand-primary)}
|
|
2885
2887
|
.dsh-powerup-session-pop-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -2888,6 +2890,11 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
2888
2890
|
`;
|
|
2889
2891
|
|
|
2890
2892
|
const LOCATE_CSS = `
|
|
2893
|
+
/* The host caps the toolbar's action row at 60px (two 28px buttons plus the
|
|
2894
|
+
4px gap) and clips the overflow, so a third button would be invisible. The
|
|
2895
|
+
marker is only present while our button is mounted, and the host's
|
|
2896
|
+
"search expanded" class still collapses the row. */
|
|
2897
|
+
[data-sidebar-workspace-header] [data-powerup-locate-actions]:not([class*="headerActionsHidden"]){max-width:none}
|
|
2891
2898
|
[data-sidebar-workspace-header] .dsh-powerup-locate{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-caption);cursor:pointer;transition:background .12s ease,color .12s ease}
|
|
2892
2899
|
[data-sidebar-workspace-header] .dsh-powerup-locate:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
2893
2900
|
[data-sidebar-workspace-header] .dsh-powerup-locate:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
@@ -2980,17 +2987,24 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
2980
2987
|
const t = typeof options.t === 'function' ? options.t : (key) => key;
|
|
2981
2988
|
const listRows = typeof options.listRows === 'function' ? options.listRows : () => [];
|
|
2982
2989
|
const openSession = typeof options.openSession === 'function' ? options.openSession : () => false;
|
|
2990
|
+
const currentSessionId = typeof options.currentSessionId === 'function' ? options.currentSessionId : () => undefined;
|
|
2983
2991
|
|
|
2984
2992
|
const MIN_WIDTH = 220;
|
|
2985
2993
|
const PREFERRED_HEIGHT = 320;
|
|
2986
2994
|
const GAP = 6;
|
|
2987
2995
|
const DRAG_THRESHOLD = 6;
|
|
2996
|
+
/** Re-anchor retries before a missing title counts as a view switch. */
|
|
2997
|
+
const REANCHOR_RETRY = 3;
|
|
2998
|
+
const REANCHOR_DELAY = 120;
|
|
2999
|
+
/** How often an open popup re-reads the session list while the host mutates. */
|
|
3000
|
+
const ROWS_REFRESH_MS = 400;
|
|
2988
3001
|
|
|
2989
3002
|
let observer = null;
|
|
2990
3003
|
let marked = [];
|
|
2991
3004
|
let popup = null;
|
|
2992
3005
|
let press = null;
|
|
2993
3006
|
let started = false;
|
|
3007
|
+
let positionQueued = false;
|
|
2994
3008
|
|
|
2995
3009
|
function warn(message, error) {
|
|
2996
3010
|
try {
|
|
@@ -3031,7 +3045,13 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3031
3045
|
return out;
|
|
3032
3046
|
}
|
|
3033
3047
|
|
|
3034
|
-
/**
|
|
3048
|
+
/**
|
|
3049
|
+
* Re-apply the marker after React re-renders the crumb. An open popup
|
|
3050
|
+
* must survive unrelated re-renders: React may replace the crumb node
|
|
3051
|
+
* the popup was anchored to (streaming tokens, a new background job, a
|
|
3052
|
+
* status line), which used to look like a view switch. Instead of
|
|
3053
|
+
* closing, re-anchor to the live title and re-place the panel.
|
|
3054
|
+
*/
|
|
3035
3055
|
function sync() {
|
|
3036
3056
|
if (!started || !hasDocument()) return;
|
|
3037
3057
|
const found = findTitles();
|
|
@@ -3041,6 +3061,100 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3041
3061
|
if (!el.hasAttribute('data-powerup-session-title')) el.setAttribute('data-powerup-session-title', '');
|
|
3042
3062
|
if (el.getAttribute('title') !== hint) el.setAttribute('title', hint);
|
|
3043
3063
|
}
|
|
3064
|
+
if (popup === null) return;
|
|
3065
|
+
// A mounted title belonging to another session means the view really
|
|
3066
|
+
// switched. An empty list is only a re-render in progress, so it is
|
|
3067
|
+
// left to the retry path below.
|
|
3068
|
+
const owners = found
|
|
3069
|
+
.map((el) => ownerSessionId(el))
|
|
3070
|
+
.filter((id) => typeof id === 'string' && id !== '');
|
|
3071
|
+
if (typeof popup.sessionId === 'string' && popup.sessionId !== ''
|
|
3072
|
+
&& owners.length > 0 && !owners.includes(popup.sessionId)) {
|
|
3073
|
+
closePopup();
|
|
3074
|
+
return;
|
|
3075
|
+
}
|
|
3076
|
+
if (isUsableAnchor(popup.anchor)) {
|
|
3077
|
+
popup.retries = 0;
|
|
3078
|
+
refreshPopupRows();
|
|
3079
|
+
schedulePosition();
|
|
3080
|
+
return;
|
|
3081
|
+
}
|
|
3082
|
+
reanchor(found);
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
/** A title crumb the panel can actually be placed against. */
|
|
3086
|
+
function isUsableAnchor(el) {
|
|
3087
|
+
return el !== null && el !== undefined
|
|
3088
|
+
&& el.isConnected === true
|
|
3089
|
+
&& typeof el.getBoundingClientRect === 'function';
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/** The conversation header that owns a title crumb. */
|
|
3093
|
+
function ownerHeader(el) {
|
|
3094
|
+
try {
|
|
3095
|
+
return typeof el.closest === 'function' ? el.closest('header[data-window-drag]') : null;
|
|
3096
|
+
} catch {
|
|
3097
|
+
return null;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
/** The session id of the conversation subtree that owns a node. */
|
|
3102
|
+
function ownerSessionId(el) {
|
|
3103
|
+
try {
|
|
3104
|
+
const host = typeof el.closest === 'function' ? el.closest('[data-conversation-session]') : null;
|
|
3105
|
+
const id = host === null ? null : host.getAttribute('data-conversation-session');
|
|
3106
|
+
return typeof id === 'string' && id !== '' ? id : undefined;
|
|
3107
|
+
} catch {
|
|
3108
|
+
return undefined;
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
/**
|
|
3113
|
+
* Move the open popup onto a live title after its anchor was replaced.
|
|
3114
|
+
* A view switch removes every title, so a missing anchor only counts
|
|
3115
|
+
* as a switch once the retries are exhausted; until then the popup
|
|
3116
|
+
* stays open at its last position.
|
|
3117
|
+
*/
|
|
3118
|
+
function reanchor(found) {
|
|
3119
|
+
if (popup === null) return;
|
|
3120
|
+
const target = pickAnchor(found);
|
|
3121
|
+
if (target !== null && target !== popup.anchor) {
|
|
3122
|
+
popup.anchor = target;
|
|
3123
|
+
popup.retries = 0;
|
|
3124
|
+
schedulePosition();
|
|
3125
|
+
return;
|
|
3126
|
+
}
|
|
3127
|
+
if (popup.retries >= REANCHOR_RETRY) {
|
|
3128
|
+
closePopup();
|
|
3129
|
+
return;
|
|
3130
|
+
}
|
|
3131
|
+
popup.retries += 1;
|
|
3132
|
+
scheduleRetry();
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
/** The title to anchor on: the same header's crumb, else the session's. */
|
|
3136
|
+
function pickAnchor(found) {
|
|
3137
|
+
if (!Array.isArray(found) || found.length === 0) return null;
|
|
3138
|
+
const usable = found.filter((el) => isUsableAnchor(el));
|
|
3139
|
+
if (usable.length === 0) return null;
|
|
3140
|
+
if (usable.length === 1) return usable[0];
|
|
3141
|
+
if (popup !== null && popup.header !== null) {
|
|
3142
|
+
const same = usable.filter((el) => ownerHeader(el) === popup.header);
|
|
3143
|
+
if (same.length > 0) return same[0];
|
|
3144
|
+
}
|
|
3145
|
+
if (popup !== null && typeof popup.sessionId === 'string' && popup.sessionId !== '') {
|
|
3146
|
+
for (const el of usable) {
|
|
3147
|
+
if (ownerSessionId(el) === popup.sessionId) return el;
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
return usable[0];
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
function scheduleRetry() {
|
|
3154
|
+
if (!started) return;
|
|
3155
|
+
if (typeof window !== 'undefined' && window !== null && typeof window.setTimeout === 'function') {
|
|
3156
|
+
window.setTimeout(() => { if (started && popup !== null) sync(); }, REANCHOR_DELAY);
|
|
3157
|
+
}
|
|
3044
3158
|
}
|
|
3045
3159
|
|
|
3046
3160
|
function scheduleSync() {
|
|
@@ -3052,6 +3166,45 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3052
3166
|
}
|
|
3053
3167
|
}
|
|
3054
3168
|
|
|
3169
|
+
/** Coalesce position updates coming from host re-renders. */
|
|
3170
|
+
function schedulePosition() {
|
|
3171
|
+
if (popup === null || positionQueued) return;
|
|
3172
|
+
positionQueued = true;
|
|
3173
|
+
const run = () => {
|
|
3174
|
+
positionQueued = false;
|
|
3175
|
+
if (popup !== null) positionPopup();
|
|
3176
|
+
};
|
|
3177
|
+
if (typeof requestAnimationFrame === 'function') requestAnimationFrame(run);
|
|
3178
|
+
else run();
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
/** Rows as a stable signature, so unchanged lists cost no DOM work. */
|
|
3182
|
+
function rowsSignature(rows) {
|
|
3183
|
+
return rows.map((row) => `${row.id}\u0000${row.current ? '1' : '0'}\u0000${row.title}`).join('\u0001');
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
/**
|
|
3187
|
+
* Keep the open list current while the host keeps mutating the page:
|
|
3188
|
+
* a session that starts or stops changes the rows, and the popup must
|
|
3189
|
+
* reflect that without being torn down and reopened. Reading the
|
|
3190
|
+
* session snapshot is cheap but not free, so it is throttled.
|
|
3191
|
+
*/
|
|
3192
|
+
function refreshPopupRows() {
|
|
3193
|
+
if (popup === null) return;
|
|
3194
|
+
const now = Date.now();
|
|
3195
|
+
if (popup.rowsAt !== undefined && now - popup.rowsAt < ROWS_REFRESH_MS) return;
|
|
3196
|
+
popup.rowsAt = now;
|
|
3197
|
+
let rows;
|
|
3198
|
+
try {
|
|
3199
|
+
rows = listRows();
|
|
3200
|
+
} catch {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
if (!Array.isArray(rows)) return;
|
|
3204
|
+
if (popup.signature === rowsSignature(rows)) return;
|
|
3205
|
+
renderPopup();
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3055
3208
|
function onMouseDown(event) {
|
|
3056
3209
|
if (event.button !== 0 || typeof event.target?.closest !== 'function') return;
|
|
3057
3210
|
const anchor = event.target.closest('[data-powerup-session-title]');
|
|
@@ -3061,7 +3214,13 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3061
3214
|
function onOutside(event) {
|
|
3062
3215
|
if (popup === null || event.target === null || event.target === undefined) return;
|
|
3063
3216
|
if (typeof popup.element.contains === 'function' && popup.element.contains(event.target)) return;
|
|
3064
|
-
|
|
3217
|
+
// A re-rendered title is still our anchor: let the click handler
|
|
3218
|
+
// decide between closing and switching, never treat it as outside.
|
|
3219
|
+
if (typeof event.target.closest === 'function') {
|
|
3220
|
+
const title = event.target.closest('[data-powerup-session-title]');
|
|
3221
|
+
if (title !== null) return;
|
|
3222
|
+
}
|
|
3223
|
+
if (popup.anchor !== null && typeof popup.anchor.contains === 'function' && popup.anchor.contains(event.target)) return;
|
|
3065
3224
|
closePopup();
|
|
3066
3225
|
}
|
|
3067
3226
|
|
|
@@ -3072,10 +3231,19 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3072
3231
|
closePopup();
|
|
3073
3232
|
}
|
|
3074
3233
|
|
|
3234
|
+
/**
|
|
3235
|
+
* Scrolling is not a dismissal: the host scrolls its own content while
|
|
3236
|
+
* a response streams. Keep the panel open and follow the anchor.
|
|
3237
|
+
*/
|
|
3075
3238
|
function onScroll(event) {
|
|
3076
3239
|
if (popup === null || event.target === null || event.target === undefined) return;
|
|
3077
3240
|
if (typeof popup.element.contains === 'function' && popup.element.contains(event.target)) return;
|
|
3078
|
-
|
|
3241
|
+
schedulePosition();
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
function onResize() {
|
|
3245
|
+
if (popup === null) return;
|
|
3246
|
+
schedulePosition();
|
|
3079
3247
|
}
|
|
3080
3248
|
|
|
3081
3249
|
function onClick(event) {
|
|
@@ -3091,7 +3259,8 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3091
3259
|
&& Math.abs(event.clientX - press.x) + Math.abs(event.clientY - press.y) > DRAG_THRESHOLD) return;
|
|
3092
3260
|
event.preventDefault();
|
|
3093
3261
|
event.stopPropagation();
|
|
3094
|
-
|
|
3262
|
+
// The title is the toggle: a second click closes, never reopens.
|
|
3263
|
+
if (popup !== null) {
|
|
3095
3264
|
closePopup();
|
|
3096
3265
|
return;
|
|
3097
3266
|
}
|
|
@@ -3102,7 +3271,9 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3102
3271
|
if (popup === null || typeof window === 'undefined' || window === null) return;
|
|
3103
3272
|
const anchor = popup.anchor;
|
|
3104
3273
|
if (anchor === null || anchor.isConnected !== true || typeof anchor.getBoundingClientRect !== 'function') {
|
|
3105
|
-
|
|
3274
|
+
// Leave the panel where it is and let sync() re-anchor it; that
|
|
3275
|
+
// path also owns the "the view really switched" close decision.
|
|
3276
|
+
scheduleSync();
|
|
3106
3277
|
return;
|
|
3107
3278
|
}
|
|
3108
3279
|
const rect = anchor.getBoundingClientRect();
|
|
@@ -3128,6 +3299,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3128
3299
|
if (popup === null) return;
|
|
3129
3300
|
const rows = listRows();
|
|
3130
3301
|
popup.rows = rows;
|
|
3302
|
+
popup.signature = rowsSignature(rows);
|
|
3131
3303
|
const element = popup.element;
|
|
3132
3304
|
element.textContent = '';
|
|
3133
3305
|
const head = document.createElement('div');
|
|
@@ -3183,7 +3355,13 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3183
3355
|
element.setAttribute('role', 'dialog');
|
|
3184
3356
|
element.setAttribute('data-powerup-session-pop', '');
|
|
3185
3357
|
document.body.appendChild(element);
|
|
3186
|
-
|
|
3358
|
+
let openedSessionId;
|
|
3359
|
+
try {
|
|
3360
|
+
openedSessionId = currentSessionId();
|
|
3361
|
+
} catch {
|
|
3362
|
+
openedSessionId = undefined;
|
|
3363
|
+
}
|
|
3364
|
+
popup = { element, anchor, rows: [], retries: 0, sessionId: openedSessionId, header: ownerHeader(anchor) };
|
|
3187
3365
|
renderPopup();
|
|
3188
3366
|
const reveal = () => {
|
|
3189
3367
|
if (popup !== null && popup.element === element) element.classList.add('is-open');
|
|
@@ -3193,7 +3371,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3193
3371
|
document.addEventListener('pointerdown', onOutside, true);
|
|
3194
3372
|
document.addEventListener('keydown', onKey, true);
|
|
3195
3373
|
if (typeof window !== 'undefined' && window !== null) {
|
|
3196
|
-
window.addEventListener('resize',
|
|
3374
|
+
window.addEventListener('resize', onResize, true);
|
|
3197
3375
|
window.addEventListener('scroll', onScroll, true);
|
|
3198
3376
|
}
|
|
3199
3377
|
}
|
|
@@ -3202,10 +3380,11 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3202
3380
|
if (popup === null) return;
|
|
3203
3381
|
const element = popup.element;
|
|
3204
3382
|
popup = null;
|
|
3383
|
+
positionQueued = false;
|
|
3205
3384
|
document.removeEventListener('pointerdown', onOutside, true);
|
|
3206
3385
|
document.removeEventListener('keydown', onKey, true);
|
|
3207
3386
|
if (typeof window !== 'undefined' && window !== null) {
|
|
3208
|
-
window.removeEventListener('resize',
|
|
3387
|
+
window.removeEventListener('resize', onResize, true);
|
|
3209
3388
|
window.removeEventListener('scroll', onScroll, true);
|
|
3210
3389
|
}
|
|
3211
3390
|
element.classList.remove('is-open');
|
|
@@ -3219,7 +3398,8 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3219
3398
|
document.addEventListener('click', onClick, true);
|
|
3220
3399
|
if (typeof MutationObserver === 'function') {
|
|
3221
3400
|
observer = new MutationObserver(() => {
|
|
3222
|
-
|
|
3401
|
+
// Host re-renders are not view switches: keep an open popup and
|
|
3402
|
+
// let sync() re-anchor it onto the live title.
|
|
3223
3403
|
scheduleSync();
|
|
3224
3404
|
});
|
|
3225
3405
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
@@ -3308,6 +3488,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3308
3488
|
};
|
|
3309
3489
|
const core = createSessionSwitcherCore({
|
|
3310
3490
|
t: (key, params) => translateCurrent(key, params),
|
|
3491
|
+
currentSessionId,
|
|
3311
3492
|
listRows: () => {
|
|
3312
3493
|
try {
|
|
3313
3494
|
const sessions = ctx.get('sessions');
|
|
@@ -3444,6 +3625,20 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3444
3625
|
reveal();
|
|
3445
3626
|
}
|
|
3446
3627
|
|
|
3628
|
+
/** The action row the button lives in, marked so CSS can widen it. */
|
|
3629
|
+
let actions = null;
|
|
3630
|
+
|
|
3631
|
+
function clearActions() {
|
|
3632
|
+
if (actions !== null) {
|
|
3633
|
+
try {
|
|
3634
|
+
actions.removeAttribute('data-powerup-locate-actions');
|
|
3635
|
+
} catch {
|
|
3636
|
+
/* A detached node is already clean. */
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
actions = null;
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3447
3642
|
function ensureButton() {
|
|
3448
3643
|
const host = header();
|
|
3449
3644
|
if (host === null || !isEnabled()) {
|
|
@@ -3451,9 +3646,21 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3451
3646
|
button.remove();
|
|
3452
3647
|
button = null;
|
|
3453
3648
|
}
|
|
3649
|
+
clearActions();
|
|
3650
|
+
return;
|
|
3651
|
+
}
|
|
3652
|
+
if (button !== null && button.isConnected === true) {
|
|
3653
|
+
// React can replace the row without dropping our button; re-mark it.
|
|
3654
|
+
const parent = button.parentElement;
|
|
3655
|
+
if (parent !== null && parent !== undefined
|
|
3656
|
+
&& typeof parent.setAttribute === 'function'
|
|
3657
|
+
&& typeof parent.hasAttribute === 'function'
|
|
3658
|
+
&& !parent.hasAttribute('data-powerup-locate-actions')) {
|
|
3659
|
+
parent.setAttribute('data-powerup-locate-actions', '');
|
|
3660
|
+
actions = parent;
|
|
3661
|
+
}
|
|
3454
3662
|
return;
|
|
3455
3663
|
}
|
|
3456
|
-
if (button !== null && button.isConnected === true) return;
|
|
3457
3664
|
button = document.createElement('button');
|
|
3458
3665
|
button.type = 'button';
|
|
3459
3666
|
button.className = 'dsh-powerup-locate';
|
|
@@ -3466,8 +3673,14 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3466
3673
|
event.stopPropagation();
|
|
3467
3674
|
locate();
|
|
3468
3675
|
});
|
|
3469
|
-
const
|
|
3470
|
-
|
|
3676
|
+
const row = host.querySelector('[class*="headerActions"]') ?? host;
|
|
3677
|
+
// The host clips this row at 60px; the marker lets LOCATE_CSS widen it
|
|
3678
|
+
// so the third button is actually reachable.
|
|
3679
|
+
if (typeof row.setAttribute === 'function') {
|
|
3680
|
+
row.setAttribute('data-powerup-locate-actions', '');
|
|
3681
|
+
actions = row;
|
|
3682
|
+
}
|
|
3683
|
+
row.appendChild(button);
|
|
3471
3684
|
}
|
|
3472
3685
|
|
|
3473
3686
|
function sync() {
|
|
@@ -3491,6 +3704,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
3491
3704
|
observer = null;
|
|
3492
3705
|
if (button !== null) button.remove();
|
|
3493
3706
|
button = null;
|
|
3707
|
+
clearActions();
|
|
3494
3708
|
}
|
|
3495
3709
|
|
|
3496
3710
|
return { start, stop, sync, locate, sessionRow, collapsedWorkspaces };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.14",
|
|
4
4
|
"description": "Power-Up — small, opt-in upgrades for DeepSeek Harness. Adds a right-click action menu to the Trajectory ledger, an optional stop reason in the session header's background jobs panel (appended to the injected completion notice), and an install control for third-party plugins from the Plugins page: read versions from the configured registries, install the version in the input through the Add plugin path (removing the old copy first), mark restart-needed installs, hand Power-Up's own install to the background, and optionally restart DSH. One-click install skips the enable and restart questions and can apply those actions automatically with configurable defaults. The ledger menu also copies a step reference (session id + step id) that the read-only powerup_step_read tool resolves back into the raw session data. · 为 DeepSeek Harness 提供小型增强:在轨迹页面右键记录即可复制、引用、查看详情或从该记录 Fork;右键「复制步骤引用」得到「会话 ID + 步骤 ID」,Agent 用只读工具 powerup_step_read 即可取回该步骤的完整原始数据;在会话顶部的后台任务面板手动停止任务时可填写停止原因,原因会附加到任务结束后的会话提示;并在插件页为第三方已安装插件提供安装按钮,从安装源读取版本,按输入框中的版本沿用「添加插件」流程安装(先卸载旧版),支持待重启标记、Power-Up 自身后台安装与可选重启;安装面板提供「一键安装」,按输入框版本安装并跳过启用/重启询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。 · 侧边栏启动器:把左侧边栏的面板按钮变成随宽度自适应的图标网格(图标在上、文字在下),支持拖拽排序与分组(拖到另一个图标中间即合并为分组,点击分组弹出浮层展示内部图标),可随时整体关闭;网格里自带「返回会话」「重启 DSH」「关闭 DSH」三个按钮,它们和「更多」一样可以拖进分组,重启/关闭沿用插件安装流程的确认对话框。 · 会话切换:把会话标题变成可点击,点击后弹出下拉列表,列出正在运行中的会话标题(带工作区名称前缀),点击即可切换到对应会话。 · 定位当前会话:工作区按钮栏新增按钮,把当前会话在工作区列表中展开并居中显示,自动展开折叠的工作区。 · 所有功能均可在 Power-Up 页面独立启用/禁用,弹窗统一为宿主原生样式。",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|