@restregular/dsh-powerup 0.10.3 → 0.10.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 (3) hide show
  1. package/README.md +3 -1
  2. package/client.js +74 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -190,7 +190,9 @@ Save reusable prompts and drop one into a new session without retyping it.
190
190
  level as the group headers, under **Ungrouped**. In the **Prompts** settings
191
191
  tab you can create, rename and delete groups for each scope, and **drag a
192
192
  prompt onto a group header to move it** (or onto Ungrouped to take it out of
193
- a group). Deleting a group never deletes its prompts — they become ungrouped.
193
+ a group), and **drop a prompt onto another prompt to reorder them within the
194
+ same group**. Deleting a group never deletes its prompts — they become
195
+ ungrouped.
194
196
  - In the New Session row, to the right of the Agent preset, a dropdown lists the
195
197
  prompts available in the current workspace, grouped the same way. In an
196
198
  **ongoing session** the same picker also appears in the composer's bottom
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.10.3';
86
+ const VERSION = '0.10.5';
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. */
@@ -399,7 +399,7 @@
399
399
  'prompts.groupConfirmDelete': '删除这个分组?其中的提示词会变为未分组,不会被删除。',
400
400
  'prompts.moveToGroup': '移动到分组',
401
401
  'prompts.moveUngrouped': '移出分组',
402
- 'prompts.dropHint': '拖拽提示词到分组标题即可移动;拖到「未分组」可移出分组。',
402
+ 'prompts.dropHint': '拖拽提示词到分组标题即可移动,拖到「未分组」可移出分组;拖到另一条提示词上可调整组内排序。',
403
403
  },
404
404
  en: {
405
405
  'panel.title': 'Power-Up',
@@ -705,7 +705,7 @@
705
705
  'prompts.groupConfirmDelete': 'Delete this group? Its prompts stay as ungrouped and are not deleted.',
706
706
  'prompts.moveToGroup': 'Move to group',
707
707
  'prompts.moveUngrouped': 'Move out of group',
708
- 'prompts.dropHint': 'Drag a prompt onto a group header to move it; drop on Ungrouped to take it out of a group.',
708
+ 'prompts.dropHint': 'Drag a prompt onto a group header to move it, or onto Ungrouped to take it out; drop on another prompt to reorder within the group.',
709
709
  },
710
710
  };
711
711
 
@@ -3070,16 +3070,28 @@
3070
3070
  for (const section of sectionsList) {
3071
3071
  const scopeHead = document.createElement('div');
3072
3072
  scopeHead.className = 'dsh-powerup-prompt-pop-scope';
3073
- scopeHead.textContent = section.label;
3073
+ const scopeLabel = document.createElement('span');
3074
+ scopeLabel.textContent = section.label;
3075
+ scopeHead.appendChild(scopeLabel);
3074
3076
  list.appendChild(scopeHead);
3075
3077
  for (const group of section.groups) {
3076
3078
  if (group.items.length === 0 && !group.group) continue;
3077
3079
  const isUngrouped = group.isUngrouped === true;
3078
3080
  const key = section.key + ':' + group.id;
3079
3081
  const isCollapsed = localCollapsed.has(key);
3082
+ const block = document.createElement('div');
3083
+ block.className = 'dsh-powerup-prompt-pop-block';
3084
+ if (isCollapsed) block.classList.add('is-collapsed');
3085
+ if (isUngrouped) block.classList.add('is-ungrouped');
3080
3086
  if (isUngrouped) {
3081
- // Ungrouped prompts sit at the same level as group headers.
3082
- for (const prompt of group.items) list.appendChild(renderRow(prompt));
3087
+ // Ungrouped prompts sit at the same level as group headers, but
3088
+ // under a plain label so they are clearly not inside a folder.
3089
+ const label = document.createElement('div');
3090
+ label.className = 'dsh-powerup-prompt-pop-ungrouped-label';
3091
+ label.textContent = t('prompts.ungrouped');
3092
+ block.appendChild(label);
3093
+ for (const prompt of group.items) block.appendChild(renderRow(prompt));
3094
+ list.appendChild(block);
3083
3095
  continue;
3084
3096
  }
3085
3097
  const head = document.createElement('button');
@@ -3089,6 +3101,7 @@
3089
3101
  head.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
3090
3102
  head.innerHTML = '<svg width="10" height="10" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path d="m4 6 4 4 4-4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
3091
3103
  const label = document.createElement('span');
3104
+ label.className = 'dsh-powerup-prompt-pop-group-name';
3092
3105
  label.textContent = group.name || t('prompts.untitled');
3093
3106
  const count = document.createElement('span');
3094
3107
  count.className = 'dsh-powerup-prompt-pop-group-count';
@@ -3102,10 +3115,14 @@
3102
3115
  if (typeof onToggleGroup === 'function') onToggleGroup(key, !localCollapsed.has(key));
3103
3116
  renderList();
3104
3117
  });
3105
- list.appendChild(head);
3118
+ block.appendChild(head);
3106
3119
  if (!isCollapsed) {
3107
- for (const prompt of group.items) list.appendChild(renderRow(prompt));
3120
+ const body = document.createElement('div');
3121
+ body.className = 'dsh-powerup-prompt-pop-group-body';
3122
+ for (const prompt of group.items) body.appendChild(renderRow(prompt));
3123
+ block.appendChild(body);
3108
3124
  }
3125
+ list.appendChild(block);
3109
3126
  }
3110
3127
  }
3111
3128
  };
@@ -4206,12 +4223,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4206
4223
  .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)}
4207
4224
  .dsh-powerup-prompt-pop.is-open{opacity:1;transform:none}
4208
4225
  .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}
4209
- .dsh-powerup-prompt-pop-scope{flex:none;padding:5px 9px 3px;color:var(--dsw-alias-label-tertiary);font-size:10px;font-weight:600;letter-spacing:.03em}
4210
- .dsh-powerup-prompt-pop-group{flex:none;display:flex;align-items:center;gap:5px;width:100%;min-height:26px;padding:2px 9px;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;font-weight:600;line-height:1.5;text-align:left;cursor:pointer}
4211
- .dsh-powerup-prompt-pop-group svg{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform .12s ease}
4226
+ /* Scope dividers: a full-width label with hairline rules on both sides. */
4227
+ .dsh-powerup-prompt-pop-scope{flex:none;display:flex;align-items:center;gap:8px;padding:9px 10px 5px;color:var(--dsw-alias-brand-primary);font-size:10.5px;font-weight:700;letter-spacing:.04em}
4228
+ .dsh-powerup-prompt-pop-scope::before,.dsh-powerup-prompt-pop-scope::after{content:'';flex:1 1 auto;height:1px;background:var(--dsw-alias-border-l1)}
4229
+ /* One group: a tinted header chip with a clearly indented, rail-joined body. */
4230
+ .dsh-powerup-prompt-pop-block{flex:none;display:flex;flex-direction:column;gap:3px;margin:2px 0 4px}
4231
+ .dsh-powerup-prompt-pop-group{flex:none;display:flex;align-items:center;gap:6px;width:100%;min-height:28px;padding:3px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font:inherit;font-size:11.5px;font-weight:600;line-height:1.5;text-align:left;cursor:pointer;transition:background .12s ease,border-color .12s ease}
4232
+ .dsh-powerup-prompt-pop-group svg{flex:none;color:var(--dsw-alias-label-secondary);transition:transform .12s ease}
4212
4233
  .dsh-powerup-prompt-pop-group[aria-expanded=false] svg{transform:rotate(-90deg)}
4213
- .dsh-powerup-prompt-pop-group:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
4214
- .dsh-powerup-prompt-pop-group-count{margin-left:auto;color:var(--dsw-alias-label-tertiary);font-size:10px;font-weight:400}
4234
+ .dsh-powerup-prompt-pop-group:hover{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-interactive-bg-hover)}
4235
+ .dsh-powerup-prompt-pop-group-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
4236
+ .dsh-powerup-prompt-pop-group-count{margin-left:auto;flex:none;min-width:18px;padding:0 5px;border-radius:9px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font-size:10px;font-weight:500;line-height:16px;text-align:center;font-variant-numeric:tabular-nums}
4237
+ .dsh-powerup-prompt-pop-group-body{flex:none;display:flex;flex-direction:column;gap:4px;margin-left:12px;padding-left:9px;border-left:1px solid var(--dsw-alias-border-l2)}
4238
+ .dsh-powerup-prompt-pop-ungrouped-label{flex:none;padding:3px 9px;color:var(--dsw-alias-label-tertiary);font-size:10px;font-weight:600;letter-spacing:.03em}
4239
+ .dsh-powerup-prompt-pop-block.is-ungrouped{margin:2px 0 6px}
4215
4240
  .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}
4216
4241
  .dsh-powerup-prompt-pop-item{box-sizing:border-box;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}
4217
4242
  .dsh-powerup-prompt-pop-item:hover{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-interactive-bg-hover)}
@@ -4256,8 +4281,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4256
4281
  .dsh-powerup-prompt-group-title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:1.4}
4257
4282
  .dsh-powerup-prompt-group-count{flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5;font-variant-numeric:tabular-nums}
4258
4283
  .dsh-powerup-prompt-group-body{display:flex;flex-direction:column;gap:7px;padding:0 8px 8px}
4259
- .dsh-powerup-group-form{display:flex;align-items:center;gap:6px;padding:6px 12px 9px}
4260
- .dsh-powerup-group-form .dsh-powerup-prompt-input{flex:1 1 auto;min-width:0}
4284
+ .dsh-powerup-group-form{display:flex;align-items:center;gap:6px;padding:6px 12px 9px;flex-wrap:wrap}
4285
+ .dsh-powerup-group-form .dsh-powerup-prompt-input{flex:1 1 120px;min-width:0}
4286
+ .dsh-powerup-group-form .dsh-powerup-prompt-new{flex:none;white-space:nowrap;padding:0 10px}
4261
4287
  .dsh-powerup-prompt-card{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1);overflow:hidden;transition:border-color .12s ease}
4262
4288
  .dsh-powerup-prompt-card.drop-target{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-interactive-bg-hover)}
4263
4289
  .dsh-powerup-prompt-card[draggable=true]{cursor:grab}
@@ -9017,6 +9043,29 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9017
9043
  movePrompt(groupId, scopeId);
9018
9044
  },
9019
9045
  });
9046
+ /**
9047
+ * Drop one prompt onto another to reorder inside that group. The array
9048
+ * order is the display order within a group, so removing and reinserting
9049
+ * before the target card also adopts the target's group/workspace.
9050
+ */
9051
+ const reorderBefore = (targetId) => {
9052
+ const id = dragRef.current;
9053
+ dragRef.current = null;
9054
+ setDragOver(null);
9055
+ if (typeof id !== 'string' || id === '' || id === targetId) return;
9056
+ const moving = prompts.find((p) => p.id === id);
9057
+ const target = prompts.find((p) => p.id === targetId);
9058
+ if (moving === undefined || target === undefined) return;
9059
+ const next = prompts.filter((p) => p.id !== id);
9060
+ const moved = {
9061
+ ...moving,
9062
+ groupId: typeof target.groupId === 'string' ? target.groupId : '',
9063
+ workspaceId: typeof target.workspaceId === 'string' ? target.workspaceId : '',
9064
+ };
9065
+ const idx = next.findIndex((p) => p.id === targetId);
9066
+ next.splice(idx < 0 ? next.length : idx, 0, moved);
9067
+ writeAll([...groups, ...next]);
9068
+ };
9020
9069
  const field = (label, key, placeholder, className) => h('label', { className: 'dsh-powerup-prompt-field' },
9021
9070
  h('span', { className: 'dsh-powerup-prompt-field-label' }, label),
9022
9071
  key === 'text'
@@ -9089,6 +9138,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9089
9138
  try { event.dataTransfer?.setData?.('text/plain', prompt.id); } catch { /* best effort */ }
9090
9139
  },
9091
9140
  onDragEnd: () => { dragRef.current = null; setDragOver(null); },
9141
+ onDragOver: (event) => {
9142
+ event.preventDefault();
9143
+ if (dragOver !== 'card:' + prompt.id) setDragOver('card:' + prompt.id);
9144
+ },
9145
+ onDragLeave: () => setDragOver((current) => (current === 'card:' + prompt.id ? null : current)),
9146
+ onDrop: (event) => {
9147
+ event.preventDefault();
9148
+ event.stopPropagation();
9149
+ reorderBefore(prompt.id);
9150
+ },
9092
9151
  },
9093
9152
  h('div', { className: 'dsh-powerup-prompt-card-head' },
9094
9153
  h('span', { className: 'dsh-powerup-prompt-drag-handle', 'aria-hidden': 'true' }, '\u2807'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.10.3",
3
+ "version": "0.10.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, and workspace prompts — each toggled independently on the Power-Up page.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",