@restregular/dsh-powerup 0.9.2 → 0.9.4

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 (3) hide show
  1. package/README.md +5 -3
  2. package/client.js +42 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -185,9 +185,11 @@ Save reusable prompts and drop one into a new session without retyping it.
185
185
  characters of the body. A blank workspace scope makes the prompt available in
186
186
  every workspace; otherwise it appears only in that one.
187
187
  - In the New Session row, to the right of the Agent preset, a dropdown lists the
188
- prompts available in the current workspace. **Clicking a prompt fills the
189
- composer** so you can keep editing before sending. Each row also has a
190
- **Send now** button that fills and submits immediately.
188
+ prompts available in the current workspace. In an **ongoing session** the same
189
+ picker also appears in the composer's bottom tool row, just right of the
190
+ permission dropdown; there its menu opens **upward**. **Clicking a prompt
191
+ fills the composer** so you can keep editing before sending. Each row also has
192
+ a **Send now** button that fills and submits immediately.
191
193
  - **Create a new prompt…** in the dropdown opens an in-conversation dialog. A
192
194
  prompt created here is pinned to the current workspace — you may only keep
193
195
  that scope or switch to **All workspaces**, never pick another workspace.
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.9.2';
86
+ const VERSION = '0.9.4';
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. */
@@ -3126,12 +3126,16 @@
3126
3126
  }
3127
3127
 
3128
3128
  /**
3129
- * Slot occupant for `conversation.hero.options`. Choosing a prompt fills
3130
- * the composer so the user can keep editing; the per-row send button
3131
- * submits immediately.
3129
+ * Prompt picker shared by two slots: `conversation.hero.options` (new
3130
+ * session) and `conversation.input.left` (ongoing session, beside the
3131
+ * host's permission dropdown). In the composer the popover expands
3132
+ * upward and the trigger uses a compact icon-only style.
3133
+ * Choosing a prompt fills the composer; the per-row send button submits
3134
+ * immediately.
3132
3135
  */
3133
- function HeroPromptsControl({ sessionId, inputActions, useWorkspaces, useInput }) {
3136
+ function PromptsControl({ sessionId, inputActions, useWorkspaces, useInput, variant }) {
3134
3137
  const settings = useSettings();
3138
+ const compact = variant === 'composer';
3135
3139
  const workspaceSelector = useMemo(() => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionId), [sessionId]);
3136
3140
  const workspaceId = typeof useWorkspaces === 'function'
3137
3141
  ? useWorkspaces(workspaceSelector) ?? ''
@@ -3205,8 +3209,9 @@
3205
3209
  h('button', {
3206
3210
  type: 'button',
3207
3211
  ref: anchorRef,
3208
- className: 'dsh-powerup-prompt-trigger',
3212
+ className: 'dsh-powerup-prompt-trigger' + (compact ? ' dsh-powerup-prompt-trigger-compact' : ''),
3209
3213
  'data-powerup-prompts': '',
3214
+ 'data-powerup-prompts-variant': compact ? 'composer' : 'hero',
3210
3215
  'aria-haspopup': 'menu',
3211
3216
  'aria-expanded': 'false',
3212
3217
  title: t('prompts.pickHint'),
@@ -3224,7 +3229,7 @@
3224
3229
  anchor,
3225
3230
  t,
3226
3231
  items: visible,
3227
- placement: (node) => popoverPlacement(node, 260, 340),
3232
+ placement: (node) => popoverPlacement(node, 360, 340, { preferUp: compact }),
3228
3233
  onPick: (prompt) => apply(prompt, false),
3229
3234
  onSend: (prompt) => apply(prompt, true),
3230
3235
  onCreate: () => setCreating(true),
@@ -3266,6 +3271,14 @@
3266
3271
  );
3267
3272
  }
3268
3273
 
3274
+ /** Thin wrappers so both slots share one implementation. */
3275
+ function HeroPromptsControl(props) {
3276
+ return PromptsControl({ ...props, variant: 'hero' });
3277
+ }
3278
+ function ComposerPromptsControl(props) {
3279
+ return PromptsControl({ ...props, variant: 'composer' });
3280
+ }
3281
+
3269
3282
  // ------------------------------------------------------------------
3270
3283
  // Icons (16-grid, currentColor, host stroke convention)
3271
3284
  // ------------------------------------------------------------------
@@ -3919,12 +3932,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
3919
3932
  .dsh-powerup-prompt-trigger-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3920
3933
  .dsh-powerup-prompt-trigger-chevron{flex:none;display:inline-flex;color:var(--dsw-alias-label-tertiary);transition:transform .15s ease}
3921
3934
  .dsh-powerup-prompt-trigger[aria-expanded=true] .dsh-powerup-prompt-trigger-chevron{transform:rotate(180deg)}
3935
+ /* Compact variant in the ongoing-session composer tool row: icon + short label,
3936
+ left of the send controls, pops upward above the permission dropdown row. */
3937
+ .dsh-powerup-prompt-trigger-compact{max-width:none;height:30px;padding:0 8px;font-size:11.5px}
3938
+ .dsh-powerup-prompt-trigger-compact .dsh-powerup-prompt-trigger-label{max-width:96px}
3922
3939
  .dsh-powerup-prompt-pop{position:fixed;z-index:1600;box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;overflow-x:hidden;border:0;border-radius:10px;background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:1.5;opacity:0;transform:translateY(-4px);transition:opacity .12s ease,transform .12s ease;pointer-events:auto;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}
3923
3940
  .dsh-powerup-prompt-pop.is-open{opacity:1;transform:none}
3924
3941
  .dsh-powerup-prompt-pop-head{flex:none;display:flex;align-items:center;gap:6px;padding:8px 11px 7px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:600;letter-spacing:.03em}
3925
- .dsh-powerup-prompt-pop-list{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:1px;padding:4px;overflow-y:auto;overflow-x:hidden}
3926
- .dsh-powerup-prompt-pop-item{display:flex;align-items:center;gap:4px;width:100%;min-width:0;min-height:34px;padding:2px 4px 2px 7px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;text-align:left}
3927
- .dsh-powerup-prompt-pop-item:hover{background:var(--dsw-alias-interactive-bg-hover)}
3942
+ .dsh-powerup-prompt-pop-list{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:4px;padding:6px;overflow-y:auto;overflow-x:hidden}
3943
+ .dsh-powerup-prompt-pop-item{display:flex;align-items:center;gap:6px;width:100%;min-width:0;min-height:38px;padding:4px 5px 4px 9px;border:.5px solid transparent;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;text-align:left;transition:border-color .12s ease,background .12s ease}
3944
+ .dsh-powerup-prompt-pop-item:hover{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-interactive-bg-hover)}
3928
3945
  .dsh-powerup-prompt-pop-main{flex:1 1 auto;display:flex;flex-direction:column;gap:1px;min-width:0;padding:3px 0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
3929
3946
  .dsh-powerup-prompt-pop-name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;line-height:18px}
3930
3947
  .dsh-powerup-prompt-pop-preview{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:15px}
@@ -6373,17 +6390,22 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
6373
6390
  * @param {number} preferredHeight
6374
6391
  * @returns {{ left: number, width: number, top?: number, bottom?: number, maxHeight: number }}
6375
6392
  */
6376
- function popoverPlacement(anchor, minWidth, preferredHeight) {
6393
+ function popoverPlacement(anchor, minWidth, preferredHeight, options) {
6377
6394
  const rect = anchor.getBoundingClientRect();
6378
6395
  const gap = 6;
6379
6396
  const margin = 12;
6397
+ const opts = options ?? {};
6380
6398
  const viewportWidth = typeof window === 'undefined' ? 1280 : window.innerWidth;
6381
6399
  const viewportHeight = typeof window === 'undefined' ? 900 : window.innerHeight;
6382
6400
  const width = Math.min(Math.max(rect.width, minWidth), Math.max(200, viewportWidth - margin * 2));
6383
6401
  const left = Math.min(Math.max(margin, rect.left), Math.max(margin, viewportWidth - width - margin));
6384
6402
  const spaceBelow = viewportHeight - rect.bottom - margin - gap;
6385
6403
  const spaceAbove = rect.top - margin - gap;
6386
- const above = spaceBelow < Math.min(preferredHeight, 180) && spaceAbove > spaceBelow;
6404
+ // 'up' forces upward expansion (composer at the screen bottom); 'auto'
6405
+ // keeps the original flip-when-cramped behavior used by the hero.
6406
+ const above = opts.preferUp === true
6407
+ ? spaceAbove >= Math.min(preferredHeight, 180)
6408
+ : spaceBelow < Math.min(preferredHeight, 180) && spaceAbove > spaceBelow;
6387
6409
  return {
6388
6410
  left,
6389
6411
  width,
@@ -8957,6 +8979,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
8957
8979
  t: (key, params) => translateCurrent(key, params),
8958
8980
  }), 'dsh-powerup: dual send buttons');
8959
8981
 
8982
+ // In an ongoing session, place the prompt picker in the bottom tool row
8983
+ // just after the host's permission / plan dropdowns; its popover opens
8984
+ // upward so it is not clipped by the screen bottom.
8985
+ register('conversation.input.left', {
8986
+ id: 'powerup-prompts-composer',
8987
+ order: 10,
8988
+ }, ComposerPromptsControl, 'dsh-powerup: composer prompt picker');
8989
+
8960
8990
  // Per-workspace Power-Up settings as a Conversation View tab, ordered
8961
8991
  // after the host's Trajectory view (order 10).
8962
8992
  register('conversation.view', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
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",