@restregular/dsh-powerup 0.19.3 → 0.19.5

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.
Files changed (2) hide show
  1. package/client.js +60 -6
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -85,7 +85,7 @@
85
85
  const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
86
86
  /** Fallback bucket when the hero cannot resolve an owning workspace yet. */
87
87
  const UNSCOPED_WORKSPACE = '__unscoped__';
88
- const VERSION = '0.19.3';
88
+ const VERSION = '0.19.5';
89
89
  const MENU_GAP = 8;
90
90
  const MENU_WIDTH = 248;
91
91
  /** Reference scheme understood by the Host's `powerup_step_read` tool. */
@@ -4696,6 +4696,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4696
4696
  .dsh-powerup-req-form-foot{display:flex;justify-content:flex-end;gap:8px}
4697
4697
  .dsh-powerup-progress-resizer{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;background:linear-gradient(135deg,transparent 50%,var(--dsw-alias-border-l3) 50%,transparent 62%,var(--dsw-alias-border-l3) 62%,var(--dsw-alias-border-l3) 72%,transparent 72%)}
4698
4698
  .dsh-powerup-progress-req-editor{display:flex;flex-direction:column;gap:10px;padding:8px 0}
4699
+ /* Mobile: the panel's width/top/right come from inline styles (resizable on
4700
+ desktop), so override them here to make it a near-full-width sheet that fits
4701
+ the viewport. No backdrop-filter on the root — the host's right-side panel is
4702
+ full-screen on phones and blurring it would blur the whole conversation. */
4703
+ @media (max-width:767px){
4704
+ .dsh-powerup-progress-panel{left:8px !important;right:8px !important;width:auto !important;max-width:none !important;max-height:calc(100dvh - 88px) !important;border-radius:12px !important}
4705
+ .dsh-powerup-progress-head{padding:12px 12px 8px}
4706
+ .dsh-powerup-progress-model-seat{max-width:120px}
4707
+ .dsh-powerup-progress-body{padding:10px 12px 12px}
4708
+ .dsh-powerup-progress-tabs{padding:0 4px}
4709
+ .dsh-powerup-progress-tab{padding:8px 9px}
4710
+ .dsh-powerup-progress-foot{padding:8px 12px}
4711
+ .dsh-powerup-progress-resizer{display:none}
4712
+ }
4699
4713
  @media (prefers-reduced-motion:reduce){.dsh-powerup-progress-panel,.dsh-powerup-progress-btn.is-running svg,.dsh-powerup-progress-fill{animation:none;transition:none}}
4700
4714
  /* Direct-ask button + dialog */
4701
4715
  .dsh-powerup-directask-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font:inherit;line-height:1;cursor:pointer}
@@ -9414,6 +9428,32 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9414
9428
  return buttons[buttons.length - 1] ?? null;
9415
9429
  }
9416
9430
 
9431
+ /**
9432
+ * The host model directory owns the committed model selection per session
9433
+ * (the composer dropdown writes through `directory.select`, which calls
9434
+ * `sessions.selectModel`). Snapshot its `current` on Direct Ask open and
9435
+ * select it back on close so a model picked for light Q&A never leaks into
9436
+ * the real session.
9437
+ */
9438
+ function findModelDirectory(ctx, sessionId) {
9439
+ try {
9440
+ const service = ctx?.get?.('modelDirectories');
9441
+ if (service === undefined || typeof service.directoryFor !== 'function') return null;
9442
+ const directory = service.directoryFor(sessionId);
9443
+ if (directory === null || typeof directory !== 'object'
9444
+ || directory.store === undefined || typeof directory.store.getSnapshot !== 'function'
9445
+ || typeof directory.select !== 'function') return null;
9446
+ return directory;
9447
+ } catch { return null; }
9448
+ }
9449
+ /** Copy just the selection fields so the snapshot cannot mutate later. */
9450
+ function copyModelSelection(selection) {
9451
+ if (selection === null || typeof selection !== 'object') return null;
9452
+ const copy = { provider: selection.provider, model: selection.model };
9453
+ if (typeof selection.reasoningEffort === 'string') copy.reasoningEffort = selection.reasoningEffort;
9454
+ return copy;
9455
+ }
9456
+
9417
9457
  /**
9418
9458
  * Hide every other plugin's controls in the composer while Direct Ask is
9419
9459
  * open, and put them back byte-for-byte on close. Host controls (add file
@@ -9581,7 +9621,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9581
9621
  // files the user picks through the real composer's file input.
9582
9622
  useEffect(() => {
9583
9623
  if (!open || seat === null) return undefined;
9584
- snapshotRef.current = { draft: draftRef.current };
9624
+ const modelDir = findModelDirectory(ctx, sessionRef.current);
9625
+ const savedModel = modelDir === null ? null : copyModelSelection(modelDir.store.getSnapshot()?.current);
9626
+ snapshotRef.current = { draft: draftRef.current, modelDir, model: savedModel };
9585
9627
  attachSnapshotRef.current = attachmentIdsRef.current.slice();
9586
9628
  filesRef.current = [];
9587
9629
  const takeover = createComposerTakeover(seat);
@@ -9612,10 +9654,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9612
9654
  if (snap !== null && typeof inputActions?.setDraft === 'function') {
9613
9655
  inputActions.setDraft(snap.draft);
9614
9656
  }
9657
+ // Restore the model that was selected before Direct Ask opened. The
9658
+ // model directory writes through to the session on select, so a
9659
+ // model changed while Q&A was open must be put back explicitly.
9660
+ if (snap !== null && snap.model !== null && snap.modelDir !== null) {
9661
+ const current = copyModelSelection(snap.modelDir.store.getSnapshot()?.current);
9662
+ const changed = current === null || current.provider !== snap.model.provider
9663
+ || current.model !== snap.model.model
9664
+ || current.reasoningEffort !== snap.model.reasoningEffort;
9665
+ if (changed) void snap.modelDir.select(snap.model).catch(() => { /* best effort restore */ });
9666
+ }
9615
9667
  pruneAddedAttachments();
9616
9668
  attachSnapshotRef.current = [];
9617
9669
  };
9618
- }, [open, seat, inputActions, pruneAddedAttachments]);
9670
+ }, [open, seat, inputActions, pruneAddedAttachments, ctx]);
9619
9671
 
9620
9672
  useEffect(() => {
9621
9673
  if (bottomRef.current !== null) bottomRef.current.scrollIntoView?.({ block: 'nearest' });
@@ -11333,10 +11385,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11333
11385
  const reqs = useRequirements();
11334
11386
  // Resolve the owning workspace for requirement filtering + create modal.
11335
11387
  // Prefer the slot-provided scoped `useWorkspaces` hook (the client-side
11336
- // `workspaces` service has no `.list`; that is Host-only). Fall back to
11337
- // the live DOM session id if the hook is absent on an older host.
11388
+ // `workspaces` service has no `.list`; that is Host-only). Use sessionId
11389
+ // directly here — sessionRef is declared further down, and referencing it
11390
+ // here throws a TDZ ReferenceError when the hook evaluates the selector
11391
+ // during render, crashing the control so its entry button never renders.
11338
11392
  const workspaceSelector = useMemo(
11339
- () => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionRef.current),
11393
+ () => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionId),
11340
11394
  [sessionId],
11341
11395
  );
11342
11396
  const workspaceId = typeof useWorkspaces === 'function'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
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, workspace prompts, and non-blocking model-generated structured task progress — each toggled independently on the Power-Up page.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",