@restregular/dsh-powerup 0.9.9 → 0.10.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/client.js +38 -4
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
const promptCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
|
|
84
84
|
/** Fallback bucket when the hero cannot resolve an owning workspace yet. */
|
|
85
85
|
const UNSCOPED_WORKSPACE = '__unscoped__';
|
|
86
|
-
const VERSION = '0.
|
|
86
|
+
const VERSION = '0.10.0';
|
|
87
87
|
const MENU_GAP = 8;
|
|
88
88
|
const MENU_WIDTH = 248;
|
|
89
89
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -8407,6 +8407,36 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
8407
8407
|
* host primary button keep their own behavior; we add explicit queued and
|
|
8408
8408
|
* interrupt controls that bypass the system busy-time setting.
|
|
8409
8409
|
*/
|
|
8410
|
+
/**
|
|
8411
|
+
* Whether the given session is currently working. Reads the host's
|
|
8412
|
+
* sessions list snapshot (`byId[id].running`) and re-renders when that
|
|
8413
|
+
* store changes. Falls back to false when the host exposes no list, so an
|
|
8414
|
+
* unknown state keeps the native single button.
|
|
8415
|
+
*/
|
|
8416
|
+
function useSessionRunning(ctx, sessionId) {
|
|
8417
|
+
const read = useCallback(() => {
|
|
8418
|
+
if (typeof sessionId !== 'string' || sessionId === '') return false;
|
|
8419
|
+
try {
|
|
8420
|
+
const list = ctx.get('sessions')?.list;
|
|
8421
|
+
if (list === undefined || typeof list.getSnapshot !== 'function') return false;
|
|
8422
|
+
const snapshot = list.getSnapshot();
|
|
8423
|
+
const byId = snapshot !== null && typeof snapshot === 'object' ? snapshot.byId : undefined;
|
|
8424
|
+
const item = byId !== null && typeof byId === 'object' ? byId[sessionId] : undefined;
|
|
8425
|
+
return item !== null && typeof item === 'object' && item.running === true;
|
|
8426
|
+
} catch {
|
|
8427
|
+
return false;
|
|
8428
|
+
}
|
|
8429
|
+
}, [ctx, sessionId]);
|
|
8430
|
+
const [running, setRunning] = useState(read);
|
|
8431
|
+
useEffect(() => {
|
|
8432
|
+
setRunning(read());
|
|
8433
|
+
const list = ctx.get('sessions')?.list;
|
|
8434
|
+
if (list === undefined || typeof list.subscribe !== 'function') return undefined;
|
|
8435
|
+
return list.subscribe(() => setRunning(read()));
|
|
8436
|
+
}, [read, ctx]);
|
|
8437
|
+
return running;
|
|
8438
|
+
}
|
|
8439
|
+
|
|
8410
8440
|
function DualSendButtons({ sessionId, useInput, inputActions, ctx, t }) {
|
|
8411
8441
|
const settings = useSettings();
|
|
8412
8442
|
const draft = typeof useInput === 'function' ? useInput((s) => s.draft) : '';
|
|
@@ -8423,6 +8453,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
8423
8453
|
}
|
|
8424
8454
|
};
|
|
8425
8455
|
const trimmed = typeof draft === 'string' ? draft.trim() : '';
|
|
8456
|
+
// Dual send only makes sense while the session is actually working:
|
|
8457
|
+
// "queue" vs "interrupt" is meaningless on an idle session, where the
|
|
8458
|
+
// host's single Send button is the correct affordance.
|
|
8459
|
+
const sessionRunning = useSessionRunning(ctx, sessionId);
|
|
8426
8460
|
const currentDraft = { trimmed, sessionId, inputActions, ctx };
|
|
8427
8461
|
const send = (mode, text) => {
|
|
8428
8462
|
const value = typeof text === 'string' ? text.trim() : trimmed;
|
|
@@ -8477,9 +8511,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
8477
8511
|
}, [settings.dualSend, sessionId, draft, ctx, inputActions]);
|
|
8478
8512
|
void currentDraft;
|
|
8479
8513
|
// Replace the host's single primary button with our two only while the
|
|
8480
|
-
// composer
|
|
8481
|
-
//
|
|
8482
|
-
const active = settings.dualSend && trimmed !== '';
|
|
8514
|
+
// composer holds text AND the session is working. An idle session (or
|
|
8515
|
+
// an empty draft) keeps the native button, where it is Send or Stop.
|
|
8516
|
+
const active = settings.dualSend && trimmed !== '' && sessionRunning;
|
|
8483
8517
|
const wrapRef = useRef(null);
|
|
8484
8518
|
useEffect(() => {
|
|
8485
8519
|
if (!settings.dualSend || typeof document === 'undefined' || document === null) return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, and workspace prompts — each toggled independently on the Power-Up page.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|