@restregular/dsh-powerup 0.8.15 → 0.8.17

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 (4) hide show
  1. package/README.md +16 -8
  2. package/client.js +605 -122
  3. package/index.js +86 -3
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -178,18 +178,26 @@ entries other plugins add) become an icon grid instead of a one-per-row list:
178
178
  Save reusable prompts and drop one into a new session without retyping it.
179
179
 
180
180
  - Open the sidebar **Power-Up** page, switch on **Workspace prompts**, then open
181
- the **Workspace prompts** tab. Create a prompt with an optional title, an
182
- optional workspace scope, and the prompt body. Without a title the dropdown
183
- shows the first few characters of the body. A blank workspace scope makes the
184
- prompt available in every workspace; otherwise it appears only in that one.
181
+ the **Prompts** tab. Prompts are grouped by workspace, each group collapsible,
182
+ and every prompt card stays folded to just its title plus edit/delete until you
183
+ open it. Create a prompt with an optional title, an optional workspace scope,
184
+ and the prompt body. Without a title the dropdown shows the first few
185
+ characters of the body. A blank workspace scope makes the prompt available in
186
+ every workspace; otherwise it appears only in that one.
185
187
  - In the New Session row, to the right of the Agent preset, a dropdown lists the
186
188
  prompts available in the current workspace. **Clicking a prompt fills the
187
189
  composer** so you can keep editing before sending. Each row also has a
188
190
  **Send now** button that fills and submits immediately.
189
- - **Create a new prompt…** in the dropdown opens the management tab on the
190
- create form. The tab is styled after dsh-memory's segmented controls and
191
- cards; prompts, the last pick per workspace, and the on/off setting are all
192
- stored in this browser's `localStorage`.
191
+ - **Create a new prompt…** in the dropdown opens an in-conversation dialog. A
192
+ prompt created here is pinned to the current workspace — you may only keep
193
+ that scope or switch to **All workspaces**, never pick another workspace.
194
+ Closing the dialog keeps what you typed, so reopening it restores the draft
195
+ until the prompt is actually created. The **Prompts** settings tab can also
196
+ create and manage prompts freely across workspaces; both use the same
197
+ dsh-memory-style segmented tabs and cards.
198
+ - Prompts are stored on disk under the active workspace, in
199
+ `.dsh/dsh-powerup/prompts.json`; they travel with the workspace rather than
200
+ living in the browser.
193
201
 
194
202
  ## Install a plugin
195
203
 
package/client.js CHANGED
@@ -69,13 +69,21 @@
69
69
 
70
70
  const NS = 'dsh-powerup';
71
71
  const SETTINGS_KEY = 'dsh-powerup:settings:v1';
72
- /** Reusable prompts. Shape: [{id,title,text,workspaceId}] (workspaceId '' = all workspaces). */
73
- const PROMPTS_KEY = 'dsh-powerup:prompts:v1';
72
+ /**
73
+ * Reusable prompts. Shape: [{id,title,text,workspaceId}] (workspaceId ''
74
+ * = all workspaces). They live on disk, not in the browser.
75
+ */
74
76
  /** Last prompt used per workspace, for the dropdown button label. */
75
77
  const PROMPTS_LAST_KEY = 'dsh-powerup:prompts:last:v1';
78
+ /**
79
+ * In-progress "new prompt" dialog text, kept in memory so closing and
80
+ * reopening the dialog restores what the user had already typed instead
81
+ * of resetting it. Cleared once the prompt is actually created.
82
+ */
83
+ const promptCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
76
84
  /** Fallback bucket when the hero cannot resolve an owning workspace yet. */
77
85
  const UNSCOPED_WORKSPACE = '__unscoped__';
78
- const VERSION = '0.8.15';
86
+ const VERSION = '0.8.17';
79
87
  const MENU_GAP = 8;
80
88
  const MENU_WIDTH = 248;
81
89
  /** Reference scheme understood by the Host's `powerup_step_read` tool. */
@@ -299,10 +307,10 @@
299
307
  'page.promptsTitle': '工作区提示词',
300
308
  'page.promptsDesc': '为每个工作区保存可复用的提示词。开启后,新会话行的 Agent 预设右侧会出现一个下拉列表,选择即可把提示词填入输入框(可继续编辑),或点提示词右侧的发送按钮直接发出。',
301
309
  'page.promptsHow': '先启用本功能,再切到「工作区提示词」标签页创建提示词;提示词按工作区隔离,没有标题时显示开头几个字。',
302
- 'prompts.tabFeatures': '功能',
303
- 'prompts.tabManage': '工作区提示词',
310
+ 'prompts.tabFeatures': '功能列表',
311
+ 'prompts.tabManage': '提示词',
304
312
  'prompts.sectionTitle': '统一管理各工作区的提示词',
305
- 'prompts.sectionSub': '提示词保存在当前浏览器,仅你可见;选择后填入输入框,可继续编辑再发送。',
313
+ 'prompts.sectionSub': '提示词按工作区分组保存在工作区目录的 .dsh/dsh-powerup/prompts.json;选择后填入输入框,可继续编辑再发送。',
306
314
  'prompts.new': '新建提示词',
307
315
  'prompts.cancel': '取消',
308
316
  'prompts.save': '保存',
@@ -333,6 +341,11 @@
333
341
  'prompts.sendDirect': '直接发送',
334
342
  'prompts.createNew': '创建新的提示词…',
335
343
  'prompts.noPrompts': '这个工作区还没有提示词',
344
+ 'prompts.createTitle': '新建提示词',
345
+ 'prompts.createScopeHint': '这个提示词会自动归属到当前工作区;你也可以改为「所有工作区」。',
346
+ 'prompts.createFailed': '创建失败:{message}',
347
+ 'prompts.workspaceCurrent': '当前工作区',
348
+ 'prompts.workspaceNone': '未识别当前工作区,将保存到所有工作区',
336
349
  },
337
350
  en: {
338
351
  'panel.title': 'Power-Up',
@@ -547,9 +560,9 @@
547
560
  'page.promptsDesc': 'Save reusable prompts per workspace. When enabled, a dropdown appears next to the Agent preset in the New Session row: pick a prompt to fill the composer (still editable), or click its send button to send it right away.',
548
561
  'page.promptsHow': 'Enable this feature, then open the "Workspace prompts" tab to create prompts. Prompts are scoped per workspace; without a title the first few characters are shown.',
549
562
  'prompts.tabFeatures': 'Features',
550
- 'prompts.tabManage': 'Workspace prompts',
563
+ 'prompts.tabManage': 'Prompts',
551
564
  'prompts.sectionTitle': 'Manage prompts for every workspace',
552
- 'prompts.sectionSub': 'Prompts live in this browser and are only visible to you. Picking one fills the composer so you can edit before sending.',
565
+ 'prompts.sectionSub': 'Prompts are grouped by workspace and stored in that workspace\'s .dsh/dsh-powerup/prompts.json. Picking one fills the composer so you can edit before sending.',
553
566
  'prompts.new': 'New prompt',
554
567
  'prompts.cancel': 'Cancel',
555
568
  'prompts.save': 'Save',
@@ -580,6 +593,11 @@
580
593
  'prompts.sendDirect': 'Send now',
581
594
  'prompts.createNew': 'Create a new prompt…',
582
595
  'prompts.noPrompts': 'No prompts for this workspace yet',
596
+ 'prompts.createTitle': 'New prompt',
597
+ 'prompts.createScopeHint': 'This prompt will belong to the current workspace automatically; you can also choose "All workspaces".',
598
+ 'prompts.createFailed': 'Could not create: {message}',
599
+ 'prompts.workspaceCurrent': 'Current workspace',
600
+ 'prompts.workspaceNone': 'Current workspace unknown; it will be saved for all workspaces',
583
601
  },
584
602
  };
585
603
 
@@ -682,35 +700,65 @@
682
700
  }
683
701
 
684
702
  // ------------------------------------------------------------------
685
- // Workspace prompts store (localStorage, shared by the hero dropdown and
686
- // the management tab of the Power-Up page).
703
+ // Workspace prompts store. Prompts live in the active workspace's own
704
+ // directory (`.dsh/dsh-powerup/prompts.json`) through a Host route; the
705
+ // browser keeps only an in-memory cache so both the hero dropdown and the
706
+ // management tab see the same list.
687
707
  // ------------------------------------------------------------------
708
+ const PROMPTS_API = '/dsh-powerup/api/prompts';
709
+ let promptsCache = [];
710
+ let promptStoreWorkspace = '';
711
+
712
+ /** Normalize an arbitrary value into a clean prompt record. */
713
+ function normalizePrompt(item) {
714
+ if (item === null || typeof item !== 'object') return null;
715
+ return {
716
+ id: typeof item.id === 'string' && item.id !== '' ? item.id : newId(),
717
+ title: typeof item.title === 'string' ? item.title : '',
718
+ text: typeof item.text === 'string' ? item.text : '',
719
+ workspaceId: typeof item.workspaceId === 'string' ? item.workspaceId : '',
720
+ };
721
+ }
722
+
688
723
  /** @returns {Array<{id:string,title:string,text:string,workspaceId:string}>} */
689
724
  function readPrompts() {
725
+ return promptsCache;
726
+ }
727
+
728
+ /**
729
+ * Load the store from the active workspace's directory. The list is
730
+ * workspace-independent in shape, so whichever workspace is currently
731
+ * open provides the file; a missing file is simply an empty store.
732
+ */
733
+ async function loadPrompts(workspaceId) {
734
+ const id = typeof workspaceId === 'string' ? workspaceId : '';
735
+ promptStoreWorkspace = id;
690
736
  try {
691
- const parsed = JSON.parse(localStorage.getItem(PROMPTS_KEY) || '[]');
692
- if (Array.isArray(parsed)) {
693
- return parsed.filter((item) => item !== null && typeof item === 'object')
694
- .map((item) => ({
695
- id: typeof item.id === 'string' && item.id !== '' ? item.id : newId(),
696
- title: typeof item.title === 'string' ? item.title : '',
697
- text: typeof item.text === 'string' ? item.text : '',
698
- workspaceId: typeof item.workspaceId === 'string' ? item.workspaceId : '',
699
- }));
700
- }
737
+ const response = await fetch(PROMPTS_API + '?workspaceId=' + encodeURIComponent(id), {
738
+ headers: { accept: 'application/json' },
739
+ });
740
+ const data = response.ok ? await response.json() : null;
741
+ const list = data !== null && Array.isArray(data.prompts) ? data.prompts : [];
742
+ promptsCache = list.map(normalizePrompt).filter(Boolean);
701
743
  } catch {
702
- /* Private mode or a corrupted value: start from an empty list. */
744
+ /* Host unavailable: keep the last known list for this page. */
703
745
  }
704
- return [];
746
+ emitPrompts();
747
+ return promptsCache;
705
748
  }
706
749
 
707
750
  function writePrompts(list) {
708
- try {
709
- localStorage.setItem(PROMPTS_KEY, JSON.stringify(Array.isArray(list) ? list : []));
710
- } catch {
711
- /* The in-memory list still works for this page. */
712
- }
751
+ const next = (Array.isArray(list) ? list : []).map(normalizePrompt).filter(Boolean);
752
+ promptsCache = next;
713
753
  emitPrompts();
754
+ const id = promptStoreWorkspace;
755
+ fetch(PROMPTS_API, {
756
+ method: 'POST',
757
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
758
+ body: JSON.stringify({ workspaceId: id, prompts: next }),
759
+ }).catch(() => {
760
+ /* The in-memory list still works for this page. */
761
+ });
714
762
  }
715
763
 
716
764
  const promptsListeners = new Set();
@@ -757,9 +805,14 @@
757
805
  return t('prompts.summaryFallback');
758
806
  }
759
807
 
760
- function usePrompts() {
808
+ function usePrompts(workspaceId) {
761
809
  const [value, setValue] = useState(readPrompts);
762
810
  useEffect(() => subscribePrompts(() => setValue(readPrompts())), []);
811
+ useEffect(() => {
812
+ if (typeof workspaceId === 'string' && workspaceId !== '') {
813
+ void loadPrompts(workspaceId);
814
+ }
815
+ }, [workspaceId]);
763
816
  return value;
764
817
  }
765
818
 
@@ -2688,6 +2741,149 @@
2688
2741
  return dispose;
2689
2742
  }
2690
2743
 
2744
+ /**
2745
+ * In-conversation create dialog. The workspace is pinned to the session's
2746
+ * own workspace: the user may only keep it or switch to "all workspaces",
2747
+ * never pick another workspace.
2748
+ */
2749
+ function PromptCreateModal({ workspaceId, workspaceTitle, onClose, onCreated }) {
2750
+ const t = (key, params) => translateCurrent(key, params);
2751
+ const fixedScope = typeof workspaceId !== 'string' || workspaceId === '';
2752
+ // Reopening the dialog for the same workspace restores the previous
2753
+ // draft; switching to another workspace starts from a clean slate.
2754
+ const sameWorkspace = promptCreateDraft.workspaceId === (fixedScope ? '' : workspaceId);
2755
+ if (!sameWorkspace) {
2756
+ promptCreateDraft.workspaceId = fixedScope ? '' : workspaceId;
2757
+ promptCreateDraft.title = '';
2758
+ promptCreateDraft.text = '';
2759
+ promptCreateDraft.scope = fixedScope ? 'all' : 'current';
2760
+ }
2761
+ const [title, setTitle] = useState(promptCreateDraft.title);
2762
+ const [text, setText] = useState(promptCreateDraft.text);
2763
+ const [scope, setScope] = useState(promptCreateDraft.scope);
2764
+ const titleRef = useRef(null);
2765
+ useEffect(() => {
2766
+ promptCreateDraft.title = title;
2767
+ promptCreateDraft.text = text;
2768
+ promptCreateDraft.scope = scope;
2769
+ }, [title, text, scope]);
2770
+ useEffect(() => {
2771
+ try {
2772
+ titleRef.current?.focus?.();
2773
+ } catch {
2774
+ /* Focus is a nicety. */
2775
+ }
2776
+ }, []);
2777
+ useEffect(() => {
2778
+ const onKey = (event) => {
2779
+ if (event.key === 'Escape') {
2780
+ event.preventDefault();
2781
+ onClose();
2782
+ }
2783
+ };
2784
+ document.addEventListener('keydown', onKey, true);
2785
+ return () => document.removeEventListener('keydown', onKey, true);
2786
+ }, [onClose]);
2787
+ const save = () => {
2788
+ const body = typeof text === 'string' ? text.trim() : '';
2789
+ if (body === '') return;
2790
+ const record = {
2791
+ id: newId(),
2792
+ title: typeof title === 'string' ? title.trim() : '',
2793
+ text: body,
2794
+ workspaceId: scope === 'current' && typeof workspaceId === 'string' ? workspaceId : '',
2795
+ };
2796
+ const list = readPrompts();
2797
+ list.push(record);
2798
+ writePrompts(list);
2799
+ // The draft became a real prompt: the next dialog starts empty.
2800
+ promptCreateDraft.title = '';
2801
+ promptCreateDraft.text = '';
2802
+ promptCreateDraft.scope = fixedScope ? 'all' : 'current';
2803
+ onCreated(record);
2804
+ };
2805
+ const fieldClass = 'dsh-powerup-prompt-input';
2806
+ const labelClass = 'dsh-powerup-prompt-field-label';
2807
+ return renderInBody(h('div', {
2808
+ className: 'dsh-powerup-prompt-modal-mask',
2809
+ role: 'presentation',
2810
+ 'data-powerup-prompt-modal-mask': '',
2811
+ onPointerDown: (event) => {
2812
+ if (event.target === event.currentTarget) onClose();
2813
+ },
2814
+ },
2815
+ h('div', {
2816
+ className: 'dsh-powerup-prompt-modal',
2817
+ role: 'dialog',
2818
+ 'aria-modal': 'true',
2819
+ 'aria-label': t('prompts.createTitle'),
2820
+ },
2821
+ h('div', { className: 'dsh-powerup-prompt-modal-head' },
2822
+ h('div', null,
2823
+ h('div', { className: 'dsh-powerup-prompt-modal-heading' }, t('prompts.createTitle')),
2824
+ h('p', { className: 'dsh-powerup-prompt-modal-sub' },
2825
+ fixedScope ? t('prompts.workspaceNone') : t('prompts.createScopeHint')),
2826
+ ),
2827
+ h('button', {
2828
+ type: 'button',
2829
+ className: 'dsh-powerup-prompt-modal-close',
2830
+ 'aria-label': t('prompts.cancel'),
2831
+ onClick: onClose,
2832
+ }, '\u00d7'),
2833
+ ),
2834
+ h('div', { className: 'dsh-powerup-prompt-modal-body' },
2835
+ h('label', { className: 'dsh-powerup-prompt-field' },
2836
+ h('span', { className: labelClass }, t('prompts.titleLabel')),
2837
+ h('input', {
2838
+ ref: titleRef,
2839
+ className: fieldClass,
2840
+ type: 'text',
2841
+ value: title,
2842
+ placeholder: t('prompts.titlePlaceholder'),
2843
+ onChange: (event) => setTitle(event.target.value),
2844
+ }),
2845
+ ),
2846
+ !fixedScope
2847
+ ? h('label', { className: 'dsh-powerup-prompt-field' },
2848
+ h('span', { className: labelClass }, t('prompts.workspaceLabel')),
2849
+ h(WorkspaceSelect, {
2850
+ value: scope,
2851
+ options: [
2852
+ { value: 'current', label: t('prompts.workspaceCurrent'), hint: workspaceTitle },
2853
+ { value: 'all', label: t('prompts.anyWorkspace') },
2854
+ ],
2855
+ onChange: setScope,
2856
+ t,
2857
+ }),
2858
+ )
2859
+ : null,
2860
+ h('label', { className: 'dsh-powerup-prompt-field' },
2861
+ h('span', { className: labelClass }, t('prompts.textLabel')),
2862
+ h('textarea', {
2863
+ className: fieldClass + ' dsh-powerup-prompt-textarea',
2864
+ value: text,
2865
+ placeholder: t('prompts.textPlaceholder'),
2866
+ onChange: (event) => setText(event.target.value),
2867
+ }),
2868
+ ),
2869
+ ),
2870
+ h('div', { className: 'dsh-powerup-prompt-modal-foot' },
2871
+ h('button', {
2872
+ type: 'button',
2873
+ className: 'dsh-powerup-prompt-modal-cancel',
2874
+ onClick: onClose,
2875
+ }, t('prompts.cancel')),
2876
+ h('button', {
2877
+ type: 'button',
2878
+ className: 'dsh-powerup-prompt-modal-save',
2879
+ disabled: text.trim() === '',
2880
+ onClick: save,
2881
+ }, t('prompts.create')),
2882
+ ),
2883
+ ),
2884
+ ));
2885
+ }
2886
+
2691
2887
  /**
2692
2888
  * Slot occupant for `conversation.hero.options`. Choosing a prompt fills
2693
2889
  * the composer so the user can keep editing; the per-row send button
@@ -2695,8 +2891,13 @@
2695
2891
  */
2696
2892
  function HeroPromptsControl({ sessionId, inputActions, useWorkspaces, useInput }) {
2697
2893
  const settings = useSettings();
2698
- const prompts = usePrompts();
2894
+ const workspaceSelector = useMemo(() => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionId), [sessionId]);
2895
+ const workspaceId = typeof useWorkspaces === 'function'
2896
+ ? useWorkspaces(workspaceSelector) ?? ''
2897
+ : '';
2898
+ const prompts = usePrompts(workspaceId);
2699
2899
  const [, forceLocale] = useState(0);
2900
+ const [creating, setCreating] = useState(false);
2700
2901
  const anchorRef = useRef(null);
2701
2902
  const disposeRef = useRef(null);
2702
2903
  const t = (key, params) => translateCurrent(key, params);
@@ -2709,9 +2910,14 @@
2709
2910
  if (typeof disposeRef.current === 'function') disposeRef.current();
2710
2911
  }, []);
2711
2912
 
2712
- const workspaceSelector = useMemo(() => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionId), [sessionId]);
2713
- const workspaceId = typeof useWorkspaces === 'function'
2714
- ? useWorkspaces(workspaceSelector) ?? ''
2913
+ const workspaceTitle = typeof useWorkspaces === 'function'
2914
+ ? (useWorkspaces((snapshot) => {
2915
+ const items = snapshot !== null && typeof snapshot === 'object' && Array.isArray(snapshot.items)
2916
+ ? snapshot.items : [];
2917
+ const found = items.find((item) => item !== null && typeof item === 'object'
2918
+ && typeof item.workspaceId === 'string' && item.workspaceId === workspaceId);
2919
+ return found?.title ?? '';
2920
+ }) ?? '')
2715
2921
  : '';
2716
2922
  if (!settings.workspacePrompts) return null;
2717
2923
 
@@ -2754,14 +2960,15 @@
2754
2960
  }
2755
2961
  };
2756
2962
 
2757
- return h('button', {
2758
- type: 'button',
2759
- ref: anchorRef,
2760
- className: 'dsh-powerup-prompt-trigger',
2761
- 'data-powerup-prompts': '',
2762
- 'aria-haspopup': 'menu',
2763
- 'aria-expanded': 'false',
2764
- title: t('prompts.pickHint'),
2963
+ return h(React.Fragment, null,
2964
+ h('button', {
2965
+ type: 'button',
2966
+ ref: anchorRef,
2967
+ className: 'dsh-powerup-prompt-trigger',
2968
+ 'data-powerup-prompts': '',
2969
+ 'aria-haspopup': 'menu',
2970
+ 'aria-expanded': 'false',
2971
+ title: t('prompts.pickHint'),
2765
2972
  onClick: (event) => {
2766
2973
  event.preventDefault();
2767
2974
  event.stopPropagation();
@@ -2779,7 +2986,7 @@
2779
2986
  placement: (node) => popoverPlacement(node, 260, 340),
2780
2987
  onPick: (prompt) => apply(prompt, false),
2781
2988
  onSend: (prompt) => apply(prompt, true),
2782
- onCreate: () => requestPromptsTab('create'),
2989
+ onCreate: () => setCreating(true),
2783
2990
  onDispose: () => {
2784
2991
  disposeRef.current = null;
2785
2992
  try {
@@ -2792,17 +2999,29 @@
2792
2999
  disposeRef.current = dispose;
2793
3000
  },
2794
3001
  },
2795
- h('span', { className: 'dsh-powerup-prompt-trigger-icon', 'aria-hidden': 'true' },
2796
- h('svg', { width: 14, height: 14, viewBox: '0 0 16 16', fill: 'none' },
2797
- h('path', { d: 'M3 4.5h10M3 8h10M3 11.5h6', stroke: 'currentColor', strokeWidth: 1.3, strokeLinecap: 'round' }),
3002
+ h('span', { className: 'dsh-powerup-prompt-trigger-icon', 'aria-hidden': 'true' },
3003
+ h('svg', { width: 14, height: 14, viewBox: '0 0 16 16', fill: 'none' },
3004
+ h('path', { d: 'M3 4.5h10M3 8h10M3 11.5h6', stroke: 'currentColor', strokeWidth: 1.3, strokeLinecap: 'round' }),
3005
+ ),
2798
3006
  ),
2799
- ),
2800
- h('span', { className: 'dsh-powerup-prompt-trigger-label' }, label),
2801
- h('span', { className: 'dsh-powerup-prompt-trigger-chevron', 'aria-hidden': 'true' },
2802
- h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none' },
2803
- h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' }),
3007
+ h('span', { className: 'dsh-powerup-prompt-trigger-label' }, label),
3008
+ h('span', { className: 'dsh-powerup-prompt-trigger-chevron', 'aria-hidden': 'true' },
3009
+ h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none' },
3010
+ h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' }),
3011
+ ),
2804
3012
  ),
2805
3013
  ),
3014
+ creating
3015
+ ? h(PromptCreateModal, {
3016
+ workspaceId,
3017
+ workspaceTitle,
3018
+ onClose: () => setCreating(false),
3019
+ onCreated: (record) => {
3020
+ setCreating(false);
3021
+ writeLastPrompt(workspaceId, record.id);
3022
+ },
3023
+ })
3024
+ : null,
2806
3025
  );
2807
3026
  }
2808
3027
 
@@ -3378,7 +3597,8 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
3378
3597
  .dsh-powerup-session-pop-item[data-current]:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-3))}
3379
3598
  .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}
3380
3599
  .dsh-powerup-session-pop-dot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-state-success-primary)}
3381
- .dsh-powerup-session-pop-item[data-current] .dsh-powerup-session-pop-dot{background:var(--dsw-alias-brand-primary)}
3600
+ .dsh-powerup-session-pop-dot[data-status=blocked]{background:var(--dsw-alias-state-warn-primary,var(--dsw-alias-state-error-primary))}
3601
+ .dsh-powerup-session-pop-item[data-current] .dsh-powerup-session-pop-dot[data-status=running]{background:var(--dsw-alias-brand-primary)}
3382
3602
  .dsh-powerup-session-pop-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3383
3603
  .dsh-powerup-session-pop-empty{padding:14px 12px;color:var(--dsw-alias-label-secondary);text-align:center}
3384
3604
  @media (prefers-reduced-motion:reduce){.dsh-powerup-session-pop{transition:none}}
@@ -3436,21 +3656,42 @@ marker is only present while our button is mounted, and the host's
3436
3656
  .dsh-powerup-prompt-new{height:30px;padding:0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.5;cursor:pointer;transition:border-color .12s ease,color .12s ease}
3437
3657
  .dsh-powerup-prompt-new:hover{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
3438
3658
  .dsh-powerup-prompt-new:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
3439
- .dsh-powerup-prompt-list{display:flex;flex-direction:column;gap:9px;margin-top:12px}
3440
- .dsh-powerup-prompt-card{border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);overflow:hidden}
3441
- .dsh-powerup-prompt-card-head{display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);background:linear-gradient(120deg,color-mix(in srgb,var(--dsw-alias-brand-primary) 5%,var(--dsw-alias-bg-layer-1)),var(--dsw-alias-bg-layer-1) 62%);flex-wrap:wrap}
3442
- .dsh-powerup-prompt-card.folded .dsh-powerup-prompt-card-head{border-bottom:0}
3659
+ .dsh-powerup-prompt-groups{display:flex;flex-direction:column;gap:14px;margin-top:14px}
3660
+ .dsh-powerup-prompt-group{border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}
3661
+ .dsh-powerup-prompt-group-head{display:flex;align-items:center;gap:8px;width:100%;padding:9px 12px;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer}
3662
+ .dsh-powerup-prompt-group-head:hover{background:var(--dsw-alias-interactive-bg-hover)}
3663
+ .dsh-powerup-prompt-group-head:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
3664
+ .dsh-powerup-prompt-group-chevron{flex:none;display:inline-flex;color:var(--dsw-alias-label-tertiary);transition:transform .15s ease}
3665
+ .dsh-powerup-prompt-group.is-collapsed .dsh-powerup-prompt-group-chevron{transform:rotate(-90deg)}
3666
+ .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}
3667
+ .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}
3668
+ .dsh-powerup-prompt-group-body{display:flex;flex-direction:column;gap:7px;padding:0 8px 8px}
3669
+ .dsh-powerup-prompt-card{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1);overflow:hidden}
3670
+ .dsh-powerup-prompt-card-head{display:flex;align-items:center;gap:10px;padding:8px 11px;flex-wrap:wrap}
3443
3671
  .dsh-powerup-prompt-name{font-size:13px;font-weight:600;line-height:1.4;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3444
- .dsh-powerup-prompt-scope{flex:none;padding:0 7px;border:1px solid var(--dsw-alias-border-l1);border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:10px;line-height:1.7}
3445
3672
  .dsh-powerup-prompt-card-actions{display:flex;align-items:center;gap:4px;margin-left:auto;flex-wrap:wrap}
3446
3673
  .dsh-powerup-linkbtn{background:none;border:0;padding:2px 4px;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:1.7;cursor:pointer;border-radius:5px}
3447
3674
  .dsh-powerup-linkbtn:hover{color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}
3448
3675
  .dsh-powerup-linkbtn.danger:hover{color:var(--dsw-alias-state-error-primary,#d33)}
3449
- .dsh-powerup-prompt-card-body{padding:11px 13px}
3450
- .dsh-powerup-prompt-preview{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary);font-size:11.5px;line-height:1.55}
3451
3676
  .dsh-powerup-prompt-form{display:flex;flex-direction:column;gap:10px;padding:11px 13px;border-top:1px solid var(--dsw-alias-border-l1)}
3452
3677
  .dsh-powerup-prompt-field{display:flex;flex-direction:column;gap:5px;min-width:0}
3453
3678
  .dsh-powerup-prompt-field-label{color:var(--dsw-alias-label-secondary);font-size:11.5px;line-height:1.5}
3679
+ /* Custom workspace picker: a styled trigger + portaled option list. */
3680
+ .dsh-powerup-ws-select{position:relative}
3681
+ .dsh-powerup-ws-trigger{display:flex;align-items:center;gap:8px;width:100%;min-height:32px;padding:5px 9px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.5;text-align:left;cursor:pointer;transition:border-color .12s ease,background .12s ease}
3682
+ .dsh-powerup-ws-trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}
3683
+ .dsh-powerup-ws-trigger[aria-expanded=true]{border-color:var(--dsw-alias-state-business-primary)}
3684
+ .dsh-powerup-ws-trigger:focus-visible,.dsh-powerup-ws-option:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
3685
+ .dsh-powerup-ws-value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3686
+ .dsh-powerup-ws-chevron{flex:none;display:inline-flex;color:var(--dsw-alias-label-tertiary);transition:transform .15s ease}
3687
+ .dsh-powerup-ws-trigger[aria-expanded=true] .dsh-powerup-ws-chevron{transform:rotate(180deg)}
3688
+ .dsh-powerup-ws-menu{position:fixed;z-index:1600;box-sizing:border-box;min-width:180px;max-width:min(360px,calc(100vw - 24px));max-height:min(320px,50vh);overflow-y:auto;padding:4px;border:0;border-radius:var(--dsw-radius-panel,14px);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;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}
3689
+ .dsh-powerup-ws-option{display:flex;align-items:center;gap:8px;width:100%;min-height:30px;padding:0 9px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer}
3690
+ .dsh-powerup-ws-option:hover{background:var(--dsw-alias-interactive-bg-hover)}
3691
+ .dsh-powerup-ws-option[aria-selected=true]{background:var(--dsw-alias-interactive-bg-active)}
3692
+ .dsh-powerup-ws-option-check{flex:none;display:inline-flex;width:14px;color:var(--dsw-alias-brand-primary)}
3693
+ .dsh-powerup-ws-option-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3694
+ .dsh-powerup-ws-option-hint{flex:none;color:var(--dsw-alias-label-tertiary);font-size:10.5px}
3454
3695
  .dsh-powerup-prompt-input{box-sizing:border-box;width:100%;min-height:32px;padding:6px 9px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.5;outline:none;transition:border-color .12s ease}
3455
3696
  .dsh-powerup-prompt-input:focus{border-color:var(--dsw-alias-state-business-primary)}
3456
3697
  .dsh-powerup-prompt-input::placeholder{color:var(--dsw-alias-label-caption)}
@@ -3459,7 +3700,23 @@ marker is only present while our button is mounted, and the host's
3459
3700
  .dsh-powerup-prompt-form-actions .dsh-powerup-prompt-new{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary));color:var(--dsw-alias-label-primary-foreground);border-color:transparent}
3460
3701
  .dsh-powerup-prompt-form-actions .dsh-powerup-prompt-new:hover{background:var(--dsw-alias-button-primary-hover,var(--dsw-alias-brand-primary));color:var(--dsw-alias-label-primary-foreground)}
3461
3702
  .dsh-powerup-prompt-empty{padding:18px 12px;border:1px dashed var(--dsw-alias-border-l2);border-radius:12px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.6;text-align:center}
3462
- @media (prefers-reduced-motion:reduce){.dsh-powerup-prompt-pop,.dsh-powerup-prompt-trigger-chevron{transition:none}}
3703
+ /* In-conversation create-prompt dialog. */
3704
+ .dsh-powerup-prompt-modal-mask{position:fixed;inset:0;z-index:1500;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur,blur(3px));pointer-events:auto;animation:dsh-powerup-toast-in .14s ease-out}
3705
+ .dsh-powerup-prompt-modal{box-sizing:border-box;display:flex;flex-direction:column;width:min(460px,100%);max-height:min(680px,calc(100vh - 48px));max-height:min(680px,calc(100dvh - 48px));border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow:hidden}
3706
+ .dsh-powerup-prompt-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 14px 8px 22px}
3707
+ .dsh-powerup-prompt-modal-heading{font-size:16px;line-height:24px;font-weight:500}
3708
+ .dsh-powerup-prompt-modal-sub{margin:2px 0 0;color:var(--dsw-alias-label-tertiary);font-size:11.5px;line-height:17px}
3709
+ .dsh-powerup-prompt-modal-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:-4px -2px 0 0;padding:0;border:0;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:18px;line-height:1;cursor:pointer}
3710
+ .dsh-powerup-prompt-modal-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
3711
+ .dsh-powerup-prompt-modal-body{display:flex;flex-direction:column;gap:12px;min-height:0;margin-top:8px;padding:0 22px 4px;overflow-y:auto}
3712
+ .dsh-powerup-prompt-modal-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:14px 22px 20px}
3713
+ .dsh-powerup-prompt-modal-cancel{height:36px;padding:0 14px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:22px;cursor:pointer}
3714
+ .dsh-powerup-prompt-modal-cancel:hover{background:var(--dsw-alias-interactive-bg-hover)}
3715
+ .dsh-powerup-prompt-modal-save{height:36px;padding:0 14px;border:0;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary));color:var(--dsw-alias-label-primary-foreground);font:inherit;font-size:14px;line-height:22px;cursor:pointer}
3716
+ .dsh-powerup-prompt-modal-save:disabled{opacity:.4;cursor:not-allowed}
3717
+ .dsh-powerup-prompt-modal-close:focus-visible,.dsh-powerup-prompt-modal-cancel:focus-visible,.dsh-powerup-prompt-modal-save:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
3718
+ @media (max-width:560px){.dsh-powerup-prompt-modal-mask{padding:12px}.dsh-powerup-prompt-modal-head{padding:16px 12px 8px 16px}.dsh-powerup-prompt-modal-body{padding:0 16px 4px}.dsh-powerup-prompt-modal-foot{padding:12px 16px 16px}}
3719
+ @media (prefers-reduced-motion:reduce){.dsh-powerup-prompt-pop,.dsh-powerup-prompt-trigger-chevron,.dsh-powerup-prompt-modal-mask{transition:none;animation:none}}
3463
3720
  `;
3464
3721
 
3465
3722
  /** Max display length of a session option, in Unicode code points. */
@@ -3505,19 +3762,26 @@ marker is only present while our button is mounted, and the host's
3505
3762
  * @param {unknown} snapshot value of `sessions.list.getSnapshot()`
3506
3763
  * @param {string | undefined} currentId id of the open session
3507
3764
  * @param {(sessionId: string, cwd?: string) => string} [workspaceOf] resolve a workspace name
3508
- * @returns {Array<{id:string,title:string,current:boolean}>}
3765
+ * @param {{extraIds?: Iterable<string>, statusOf?: (id:string)=>string}} [options]
3766
+ * @returns {Array<{id:string,title:string,current:boolean,status:string}>}
3509
3767
  */
3510
- function runningSessionRows(snapshot, currentId, workspaceOf) {
3768
+ function runningSessionRows(snapshot, currentId, workspaceOf, options) {
3769
+ const opts = options !== null && typeof options === 'object' ? options : {};
3511
3770
  const state = snapshot !== null && typeof snapshot === 'object' ? snapshot : {};
3512
3771
  const byId = state.byId !== null && typeof state.byId === 'object' ? state.byId : {};
3513
3772
  const ids = Array.isArray(state.ids) ? state.ids : Object.keys(byId);
3514
3773
  const resolveWorkspace = typeof workspaceOf === 'function' ? workspaceOf : () => '';
3774
+ const statusOf = typeof opts.statusOf === 'function' ? opts.statusOf : () => 'running';
3775
+ const extra = opts.extraIds instanceof Set || Array.isArray(opts.extraIds) ? opts.extraIds : [];
3515
3776
  const rows = [];
3516
3777
  const seen = new Set();
3517
3778
  for (const id of ids) {
3518
3779
  if (typeof id !== 'string' || seen.has(id)) continue;
3519
3780
  const item = byId[id];
3520
- if (item === null || typeof item !== 'object' || item.running !== true) continue;
3781
+ if (item === null || typeof item !== 'object') continue;
3782
+ const running = item.running === true;
3783
+ const extraKeep = extra instanceof Set ? extra.has(id) : extra.indexOf(id) !== -1;
3784
+ if (!running && !extraKeep) continue;
3521
3785
  seen.add(id);
3522
3786
  const title = typeof item.displayTitle === 'string' && item.displayTitle !== ''
3523
3787
  ? item.displayTitle
@@ -3530,7 +3794,7 @@ marker is only present while our button is mounted, and the host's
3530
3794
  workspace = '';
3531
3795
  }
3532
3796
  const label = sessionOptionLabel(workspace, title);
3533
- rows.push({ id, title: label, current: id === currentId });
3797
+ rows.push({ id, title: label, current: id === currentId, status: statusOf(id) });
3534
3798
  }
3535
3799
  return rows;
3536
3800
  }
@@ -3741,7 +4005,7 @@ marker is only present while our button is mounted, and the host's
3741
4005
 
3742
4006
  /** Rows as a stable signature, so unchanged lists cost no DOM work. */
3743
4007
  function rowsSignature(rows) {
3744
- return rows.map((row) => `${row.id}\u0000${row.current ? '1' : '0'}\u0000${row.title}`).join('\u0001');
4008
+ return rows.map((row) => `${row.id}\u0000${row.current ? '1' : '0'}\u0000${row.status ?? 'running'}\u0000${row.title}`).join('\u0001');
3745
4009
  }
3746
4010
 
3747
4011
  /**
@@ -3885,6 +4149,7 @@ marker is only present while our button is mounted, and the host's
3885
4149
  if (row.current) button.setAttribute('data-current', '');
3886
4150
  const dot = document.createElement('span');
3887
4151
  dot.className = 'dsh-powerup-session-pop-dot';
4152
+ dot.setAttribute('data-status', row.status === 'blocked' ? 'blocked' : 'running');
3888
4153
  dot.setAttribute('aria-hidden', 'true');
3889
4154
  const label = document.createElement('span');
3890
4155
  label.className = 'dsh-powerup-session-pop-label';
@@ -4047,6 +4312,26 @@ marker is only present while our button is mounted, and the host's
4047
4312
  }
4048
4313
  return undefined;
4049
4314
  };
4315
+ // Sessions that finished while another one was open stay in the list
4316
+ // until the user actually switches to them. A switch removes the id.
4317
+ const finishedUnseen = new Set();
4318
+ const seenRunning = new Set();
4319
+ let lastOpenedId = currentSessionId();
4320
+
4321
+ /** 'blocked' while a question/plan-review interaction is pending. */
4322
+ const statusOf = (id) => {
4323
+ try {
4324
+ const ui = ctx.get('uiSession');
4325
+ const statuses = ui?.sessionStatus?.getSnapshot?.();
4326
+ const state = statuses instanceof Map ? statuses.get(id) : undefined;
4327
+ const kind = state?.pendingInteraction?.kind;
4328
+ if (kind === 'question' || kind === 'plan-review') return 'blocked';
4329
+ } catch {
4330
+ /* No status service: fall back to running. */
4331
+ }
4332
+ return 'running';
4333
+ };
4334
+
4050
4335
  const core = createSessionSwitcherCore({
4051
4336
  t: (key, params) => translateCurrent(key, params),
4052
4337
  currentSessionId,
@@ -4055,6 +4340,23 @@ marker is only present while our button is mounted, and the host's
4055
4340
  const sessions = ctx.get('sessions');
4056
4341
  const list = sessions?.list;
4057
4342
  if (list === undefined || typeof list.getSnapshot !== 'function') return [];
4343
+ const snapshot = list.getSnapshot();
4344
+ const state = snapshot !== null && typeof snapshot === 'object' ? snapshot : {};
4345
+ const byId = state.byId !== null && typeof state.byId === 'object' ? state.byId : {};
4346
+ const activeId = currentSessionId();
4347
+ if (typeof activeId === 'string' && activeId !== '') {
4348
+ if (activeId !== lastOpenedId) finishedUnseen.delete(activeId);
4349
+ lastOpenedId = activeId;
4350
+ }
4351
+ // Remember sessions that transitioned from running to idle.
4352
+ for (const id of Object.keys(byId)) {
4353
+ const item = byId[id];
4354
+ if (item !== null && typeof item === 'object' && item.running === true) finishedUnseen.delete(id);
4355
+ else if (item !== null && typeof item === 'object' && item.running === false && id !== lastOpenedId) {
4356
+ // Only track a session we have actually seen running before.
4357
+ if (finishedUnseen.has(id) || seenRunning.has(id)) finishedUnseen.add(id);
4358
+ }
4359
+ }
4058
4360
  const workspaces = ctx.get('workspaces');
4059
4361
  let index = { bySession: {}, byPath: {} };
4060
4362
  if (workspaces?.list !== undefined && typeof workspaces.list.getSnapshot === 'function') {
@@ -4070,13 +4372,18 @@ marker is only present while our button is mounted, and the host's
4070
4372
  }
4071
4373
  return '';
4072
4374
  };
4073
- return runningSessionRows(list.getSnapshot(), currentSessionId(), workspaceOf);
4375
+ return runningSessionRows(snapshot, currentSessionId(), workspaceOf, {
4376
+ extraIds: finishedUnseen,
4377
+ statusOf,
4378
+ });
4074
4379
  } catch {
4075
4380
  return [];
4076
4381
  }
4077
4382
  },
4078
4383
  openSession: (id) => {
4079
4384
  try {
4385
+ finishedUnseen.delete(id);
4386
+ lastOpenedId = id;
4080
4387
  const uiWorkspace = ctx.get('uiWorkspace');
4081
4388
  if (uiWorkspace === undefined || typeof uiWorkspace.openSession !== 'function') return false;
4082
4389
  uiWorkspace.openSession(id);
@@ -4087,6 +4394,35 @@ marker is only present while our button is mounted, and the host's
4087
4394
  }
4088
4395
  },
4089
4396
  });
4397
+ // Seed "seen running" from the first snapshot so a session finishing
4398
+ // later can be retained in the list.
4399
+ try {
4400
+ const sessions = ctx.get('sessions');
4401
+ const snapshot = sessions?.list?.getSnapshot?.();
4402
+ const byId = snapshot?.byId ?? {};
4403
+ for (const id of Object.keys(byId)) {
4404
+ if (byId[id]?.running === true) seenRunning.add(id);
4405
+ }
4406
+ } catch {
4407
+ /* No session service yet. */
4408
+ }
4409
+ ctx.effect(() => {
4410
+ const sessions = ctx.get('sessions');
4411
+ const off = typeof sessions?.list?.subscribe === 'function'
4412
+ ? sessions.list.subscribe(() => {
4413
+ const byId = sessions.list.getSnapshot()?.byId ?? {};
4414
+ for (const id of Object.keys(byId)) {
4415
+ if (byId[id]?.running === true) {
4416
+ seenRunning.add(id);
4417
+ finishedUnseen.delete(id);
4418
+ }
4419
+ }
4420
+ })
4421
+ : undefined;
4422
+ return () => {
4423
+ if (typeof off === 'function') off();
4424
+ };
4425
+ }, 'dsh-powerup: session status watch');
4090
4426
  function warnSwitch(error) {
4091
4427
  try {
4092
4428
  console.warn('[dsh-powerup] session switch failed:', error?.message ?? error);
@@ -7211,11 +7547,117 @@ marker is only present while our button is mounted, and the host's
7211
7547
  // ------------------------------------------------------------------
7212
7548
  // Prompt management tab (dsh-memory-style cards)
7213
7549
  // ------------------------------------------------------------------
7550
+ /**
7551
+ * Custom workspace picker: a host-styled trigger with a portaled option
7552
+ * list, so the settings page does not use the browser's native select.
7553
+ */
7554
+ function WorkspaceSelect({ value, options, onChange, t }) {
7555
+ const [open, setOpen] = useState(false);
7556
+ const anchorRef = useRef(null);
7557
+ const menuRef = useRef(null);
7558
+ const [, forceTick] = useState(0);
7559
+ const current = options.find((option) => option.value === value) ?? options[0];
7560
+ const label = current?.label ?? t('prompts.anyWorkspace');
7561
+
7562
+ const place = () => {
7563
+ const menu = menuRef.current;
7564
+ const anchor = anchorRef.current;
7565
+ if (menu === null || menu === undefined || anchor === null || anchor === undefined) return;
7566
+ try {
7567
+ const pos = popoverPlacement(anchor, Math.max(anchor.getBoundingClientRect().width, 180), 320);
7568
+ menu.style.width = pos.width + 'px';
7569
+ menu.style.maxHeight = pos.maxHeight + 'px';
7570
+ menu.style.left = pos.left + 'px';
7571
+ if (typeof pos.bottom === 'number') {
7572
+ menu.style.bottom = pos.bottom + 'px';
7573
+ menu.style.top = 'auto';
7574
+ } else {
7575
+ menu.style.top = typeof pos.top === 'number' ? pos.top + 'px' : '0px';
7576
+ menu.style.bottom = 'auto';
7577
+ }
7578
+ } catch {
7579
+ /* The menu still renders at its default position. */
7580
+ }
7581
+ };
7582
+ useEffect(() => {
7583
+ if (!open) return undefined;
7584
+ place();
7585
+ const onOutside = (event) => {
7586
+ if (menuRef.current?.contains?.(event.target)) return;
7587
+ if (anchorRef.current?.contains?.(event.target)) return;
7588
+ setOpen(false);
7589
+ };
7590
+ const onKey = (event) => {
7591
+ if (event.key === 'Escape') setOpen(false);
7592
+ };
7593
+ const onScroll = () => place();
7594
+ document.addEventListener('pointerdown', onOutside, true);
7595
+ document.addEventListener('keydown', onKey, true);
7596
+ window.addEventListener?.('resize', onScroll, true);
7597
+ window.addEventListener?.('scroll', onScroll, true);
7598
+ return () => {
7599
+ document.removeEventListener('pointerdown', onOutside, true);
7600
+ document.removeEventListener('keydown', onKey, true);
7601
+ window.removeEventListener?.('resize', onScroll, true);
7602
+ window.removeEventListener?.('scroll', onScroll, true);
7603
+ };
7604
+ }, [open]);
7605
+ useEffect(() => () => forceTick(0), []);
7606
+
7607
+ return h('div', { className: 'dsh-powerup-ws-select' },
7608
+ h('button', {
7609
+ type: 'button',
7610
+ ref: anchorRef,
7611
+ className: 'dsh-powerup-ws-trigger',
7612
+ 'aria-haspopup': 'listbox',
7613
+ 'aria-expanded': open ? 'true' : 'false',
7614
+ onClick: (event) => {
7615
+ event.preventDefault();
7616
+ event.stopPropagation();
7617
+ setOpen((v) => !v);
7618
+ },
7619
+ },
7620
+ h('span', { className: 'dsh-powerup-ws-value' }, label),
7621
+ h('span', { className: 'dsh-powerup-ws-chevron', 'aria-hidden': 'true' },
7622
+ h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none' },
7623
+ h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' }),
7624
+ ),
7625
+ ),
7626
+ ),
7627
+ open
7628
+ ? renderInBody(h('div', {
7629
+ ref: menuRef,
7630
+ className: 'dsh-powerup-ws-menu',
7631
+ role: 'listbox',
7632
+ }, options.map((option) => h('button', {
7633
+ type: 'button',
7634
+ key: option.value,
7635
+ className: 'dsh-powerup-ws-option',
7636
+ role: 'option',
7637
+ 'aria-selected': option.value === value ? 'true' : 'false',
7638
+ onClick: (event) => {
7639
+ event.preventDefault();
7640
+ event.stopPropagation();
7641
+ onChange(option.value);
7642
+ setOpen(false);
7643
+ },
7644
+ },
7645
+ h('span', { className: 'dsh-powerup-ws-option-check', 'aria-hidden': 'true' },
7646
+ option.value === value ? h(CheckIcon, { size: 12 }) : null),
7647
+ h('span', { className: 'dsh-powerup-ws-option-label' }, option.label),
7648
+ option.hint ? h('span', { className: 'dsh-powerup-ws-option-hint' }, option.hint) : null,
7649
+ ))))
7650
+ : null,
7651
+ );
7652
+ }
7653
+
7214
7654
  function PromptManager({ ctx }) {
7215
7655
  const prompts = usePrompts();
7216
7656
  const [, forceLocale] = useState(0);
7217
7657
  const [expanded, setExpanded] = useState(null);
7218
7658
  const [draft, setDraft] = useState(null);
7659
+ // Groups start expanded; collapsing one only affects this view.
7660
+ const [collapsedGroups, setCollapsedGroups] = useState(() => new Set());
7219
7661
  const t = (key, params) => translateCurrent(key, params);
7220
7662
  useEffect(() => {
7221
7663
  const locale = ctx.get('locale');
@@ -7301,17 +7743,19 @@ marker is only present while our button is mounted, and the host's
7301
7743
  field(t('prompts.titleLabel'), 'title', t('prompts.titlePlaceholder')),
7302
7744
  h('label', { className: 'dsh-powerup-prompt-field' },
7303
7745
  h('span', { className: 'dsh-powerup-prompt-field-label' }, t('prompts.workspaceLabel')),
7304
- h('select', {
7305
- className: 'dsh-powerup-prompt-input',
7746
+ h(WorkspaceSelect, {
7306
7747
  value: draft?.workspaceId ?? '',
7307
- onChange: (event) => setDraft((current) => ({ ...current, workspaceId: event.target.value })),
7308
- },
7309
- h('option', { value: '' }, t('prompts.anyWorkspace')),
7310
- workspaces.map((ws) => h('option', {
7311
- key: ws.workspaceId,
7312
- value: ws.workspaceId,
7313
- }, ws.title || ws.path || ws.workspaceId)),
7314
- ),
7748
+ options: [
7749
+ { value: '', label: t('prompts.anyWorkspace') },
7750
+ ...workspaces.map((ws) => ({
7751
+ value: ws.workspaceId,
7752
+ label: ws.title || ws.workspaceId,
7753
+ hint: ws.title ? ws.workspaceId : undefined,
7754
+ })),
7755
+ ],
7756
+ onChange: (value) => setDraft((current) => ({ ...current, workspaceId: value })),
7757
+ t,
7758
+ }),
7315
7759
  ),
7316
7760
  field(t('prompts.textLabel'), 'text', t('prompts.textPlaceholder')),
7317
7761
  h('div', { className: 'dsh-powerup-prompt-form-actions' },
@@ -7320,39 +7764,95 @@ marker is only present while our button is mounted, and the host's
7320
7764
  ),
7321
7765
  );
7322
7766
 
7323
- const cards = prompts.length === 0
7767
+ const workspaceTitleOf = (id) => {
7768
+ if (id === '') return t('prompts.anyWorkspace');
7769
+ const found = workspaces.find((ws) => ws.workspaceId === id);
7770
+ return found?.title || id;
7771
+ };
7772
+
7773
+ /**
7774
+ * Group prompts by workspace: "all workspaces" first, then every real
7775
+ * workspace in list order, then any orphaned scope not in the registry.
7776
+ */
7777
+ const groups = [];
7778
+ const seenScope = new Set();
7779
+ const pushGroup = (id) => {
7780
+ if (seenScope.has(id)) return;
7781
+ const items = prompts.filter((p) => p.workspaceId === id);
7782
+ if (items.length === 0) return;
7783
+ seenScope.add(id);
7784
+ groups.push({ id, title: workspaceTitleOf(id), items });
7785
+ };
7786
+ pushGroup('');
7787
+ for (const ws of workspaces) pushGroup(ws.workspaceId);
7788
+ for (const prompt of prompts) pushGroup(prompt.workspaceId);
7789
+
7790
+ const toggleGroup = (id) => {
7791
+ setCollapsedGroups((current) => {
7792
+ const next = new Set(current);
7793
+ if (next.has(id)) next.delete(id);
7794
+ else next.add(id);
7795
+ return next;
7796
+ });
7797
+ };
7798
+
7799
+ /** One collapsed prompt card: only the title plus edit/delete actions. */
7800
+ const promptCard = (prompt) => {
7801
+ const isExpanded = expanded === prompt.id;
7802
+ return h('section', {
7803
+ key: prompt.id,
7804
+ className: 'dsh-powerup-prompt-card' + (isExpanded ? '' : ' folded'),
7805
+ },
7806
+ h('div', { className: 'dsh-powerup-prompt-card-head' },
7807
+ h('span', { className: 'dsh-powerup-prompt-name' }, promptLabel(prompt, t)),
7808
+ h('div', { className: 'dsh-powerup-prompt-card-actions' },
7809
+ h('button', {
7810
+ type: 'button',
7811
+ className: 'dsh-powerup-linkbtn',
7812
+ onClick: () => (isExpanded ? cancelEdit() : beginEdit(prompt)),
7813
+ }, isExpanded ? t('prompts.cancel') : t('prompts.edit')),
7814
+ h('button', {
7815
+ type: 'button',
7816
+ className: 'dsh-powerup-linkbtn danger',
7817
+ onClick: () => remove(prompt),
7818
+ }, t('prompts.delete')),
7819
+ ),
7820
+ ),
7821
+ isExpanded ? form : null,
7822
+ );
7823
+ };
7824
+
7825
+ const groupsView = groups.length === 0
7324
7826
  ? h('div', { className: 'dsh-powerup-prompt-empty' }, t('prompts.empty'))
7325
- : h('div', { className: 'dsh-powerup-prompt-list' }, prompts.map((prompt) => {
7326
- const isExpanded = expanded === prompt.id;
7327
- const preview = [...(prompt.text || '').trim()].slice(0, 80).join('');
7827
+ : h('div', { className: 'dsh-powerup-prompt-groups' }, groups.map((group) => {
7828
+ const collapsed = collapsedGroups.has(group.id);
7328
7829
  return h('section', {
7329
- key: prompt.id,
7330
- className: 'dsh-powerup-prompt-card' + (isExpanded ? '' : ' folded'),
7830
+ key: 'group:' + group.id,
7831
+ className: 'dsh-powerup-prompt-group' + (collapsed ? ' is-collapsed' : ''),
7331
7832
  },
7332
- h('div', { className: 'dsh-powerup-prompt-card-head' },
7333
- h('span', { className: 'dsh-powerup-prompt-name' }, promptLabel(prompt, t)),
7334
- h('span', { className: 'dsh-powerup-prompt-scope' },
7335
- prompt.workspaceId === ''
7336
- ? t('prompts.anyWorkspace')
7337
- : (workspaces.find((ws) => ws.workspaceId === prompt.workspaceId)?.title
7338
- || prompt.workspaceId)),
7339
- h('div', { className: 'dsh-powerup-prompt-card-actions' },
7340
- h('button', {
7341
- type: 'button',
7342
- className: 'dsh-powerup-linkbtn',
7343
- onClick: () => (isExpanded ? cancelEdit() : beginEdit(prompt)),
7344
- }, isExpanded ? t('prompts.cancel') : t('prompts.edit')),
7345
- h('button', {
7346
- type: 'button',
7347
- className: 'dsh-powerup-linkbtn danger',
7348
- onClick: () => remove(prompt),
7349
- }, t('prompts.delete')),
7350
- ),
7833
+ h('button', {
7834
+ type: 'button',
7835
+ className: 'dsh-powerup-prompt-group-head',
7836
+ 'aria-expanded': collapsed ? 'false' : 'true',
7837
+ onClick: () => toggleGroup(group.id),
7838
+ },
7839
+ h('span', {
7840
+ className: 'dsh-powerup-prompt-group-chevron',
7841
+ 'aria-hidden': 'true',
7842
+ }, h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none' },
7843
+ h('path', {
7844
+ d: 'm4 6 4 4 4-4',
7845
+ stroke: 'currentColor',
7846
+ strokeWidth: 1.4,
7847
+ strokeLinecap: 'round',
7848
+ strokeLinejoin: 'round',
7849
+ }))),
7850
+ h('span', { className: 'dsh-powerup-prompt-group-title' }, group.title),
7851
+ h('span', { className: 'dsh-powerup-prompt-group-count' },
7852
+ t('prompts.itemsCount', { count: group.items.length })),
7351
7853
  ),
7352
- isExpanded ? form : (preview !== ''
7353
- ? h('div', { className: 'dsh-powerup-prompt-card-body' },
7354
- h('p', { className: 'dsh-powerup-prompt-preview' }, preview))
7355
- : null),
7854
+ collapsed ? null : h('div', { className: 'dsh-powerup-prompt-group-body' },
7855
+ group.items.map(promptCard)),
7356
7856
  );
7357
7857
  }));
7358
7858
 
@@ -7371,7 +7871,7 @@ marker is only present while our button is mounted, and the host's
7371
7871
  expanded === 'new'
7372
7872
  ? h('section', { className: 'dsh-powerup-prompt-card' }, form)
7373
7873
  : null,
7374
- cards,
7874
+ groupsView,
7375
7875
  );
7376
7876
  }
7377
7877
 
@@ -7498,23 +7998,6 @@ marker is only present while our button is mounted, and the host's
7498
7998
  featureCard('workspacePrompts', TagIcon, 'page.promptsTitle', 'page.promptsDesc', 'page.promptsHow'),
7499
7999
  featureCard('jobStop', StopIcon, 'page.jobStopTitle', 'page.jobStopDesc', 'page.jobStopHow'),
7500
8000
  featureCard('update', UpdateIcon, 'page.updateTitle', 'page.updateDesc', 'page.updateHow', oneClickDetail),
7501
- h('section', { className: 'dsh-powerup-card dsh-powerup-how-card' },
7502
- h('h2', { className: 'dsh-powerup-section-title', style: { marginBottom: '10px' } }, t('page.howTitle')),
7503
- h('ol', { className: 'dsh-powerup-steps' },
7504
- h('li', { className: 'dsh-powerup-step' },
7505
- h('span', { className: 'dsh-powerup-step-num' }, '1'),
7506
- h('span', null, t('page.how1')),
7507
- ),
7508
- h('li', { className: 'dsh-powerup-step' },
7509
- h('span', { className: 'dsh-powerup-step-num' }, '2'),
7510
- h('span', null, t('page.how2')),
7511
- ),
7512
- h('li', { className: 'dsh-powerup-step' },
7513
- h('span', { className: 'dsh-powerup-step-num' }, '3'),
7514
- h('span', null, t('page.how3')),
7515
- ),
7516
- ),
7517
- ),
7518
8001
  );
7519
8002
 
7520
8003
  return h('div', { className: 'dsh-powerup-page' },
@@ -7675,8 +8158,8 @@ marker is only present while our button is mounted, and the host's
7675
8158
  SESSION_SWITCH_CSS,
7676
8159
  LOCATE_CSS,
7677
8160
  PROMPTS_CSS,
7678
- PROMPTS_KEY,
7679
8161
  PROMPTS_LAST_KEY,
8162
+ promptCreateDraft,
7680
8163
  readPrompts,
7681
8164
  writePrompts,
7682
8165
  promptsForWorkspace,
package/index.js CHANGED
@@ -31,8 +31,8 @@
31
31
  */
32
32
 
33
33
  import { randomUUID } from 'node:crypto';
34
- import { appendFileSync, mkdirSync, readFileSync, statSync } from 'node:fs';
35
- import { dirname, join } from 'node:path';
34
+ import { appendFileSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
35
+ import { dirname, join, resolve as resolvePath, sep } from 'node:path';
36
36
  import { homedir } from 'node:os';
37
37
  import { defineTool } from '@deepseek-ai/dsh-tools';
38
38
  import { describeClose, describeRestart, requestRestart, requestShutdown } from './lib/restart.js';
@@ -50,6 +50,10 @@ const SELF_UPDATE_DELAY_MS = 600;
50
50
  /** Request body bound for the small JSON commands. */
51
51
  const BODY_LIMIT = 16 * 1024;
52
52
 
53
+ /** Per-workspace prompts live under the workspace's own .dsh directory. */
54
+ const PROMPTS_DIR = join('.dsh', 'dsh-powerup');
55
+ const PROMPTS_FILE = 'prompts.json';
56
+
53
57
  /** The moment this Host process started; a profile file newer than it may await a restart. */
54
58
  const HOST_STARTED_AT = Date.now() - process.uptime() * 1000;
55
59
 
@@ -343,6 +347,40 @@ export async function performSelfUpdate(ctx, version, registry, options = {}) {
343
347
  }
344
348
  }
345
349
 
350
+ /**
351
+ * Absolute path of one workspace's prompt store. The workspace path is
352
+ * canonical (realpath) and the id is a uuid, so a stray id can never escape
353
+ * into an arbitrary directory.
354
+ * @param {import('@deepseek-ai/cordis').Context} ctx
355
+ * @param {string} workspaceId
356
+ * @returns {string | undefined}
357
+ */
358
+ function promptStorePath(ctx, workspaceId) {
359
+ if (typeof workspaceId !== 'string' || workspaceId === '') return undefined;
360
+ const registry = ctx?.get?.('workspaceRegistry');
361
+ const workspace = registry?.get?.(workspaceId);
362
+ if (workspace === null || workspace === undefined || typeof workspace.path !== 'string' || workspace.path === '') {
363
+ return undefined;
364
+ }
365
+ const root = resolvePath(workspace.path);
366
+ const target = resolvePath(root, PROMPTS_DIR, PROMPTS_FILE);
367
+ // The store must stay inside the workspace, whatever the registry returned.
368
+ const prefix = root.endsWith(sep) ? root : root + sep;
369
+ if (!target.startsWith(prefix)) return undefined;
370
+ return target;
371
+ }
372
+
373
+ /** Read one workspace's prompts from disk; a missing file is an empty list. */
374
+ function readPromptStore(filePath) {
375
+ try {
376
+ const parsed = JSON.parse(readFileSync(filePath, 'utf8'));
377
+ return Array.isArray(parsed) ? parsed : [];
378
+ } catch (error) {
379
+ if (error?.code === 'ENOENT') return [];
380
+ throw error;
381
+ }
382
+ }
383
+
346
384
  /**
347
385
  * @param {import('node:http').IncomingMessage} req
348
386
  * @param {import('node:http').ServerResponse} res
@@ -356,11 +394,53 @@ async function handle(req, res, ctx) {
356
394
 
357
395
  const url = new URL(req.url ?? ROUTE, 'http://localhost');
358
396
  const op = url.pathname.slice(ROUTE.length).replace(/^\/+/u, '') || url.searchParams.get('op') || '';
359
- if (op !== '' && op !== 'restart' && op !== 'close' && op !== 'self-update' && op !== 'audit' && op !== 'job-kill') {
397
+ if (op !== '' && op !== 'restart' && op !== 'close' && op !== 'self-update' && op !== 'audit' && op !== 'job-kill' && op !== 'prompts') {
360
398
  sendJson(res, { ok: false, error: 'not-found' }, 404);
361
399
  return;
362
400
  }
363
401
 
402
+ if (op === 'prompts') {
403
+ // The active workspace's directory holds the whole prompt store, including
404
+ // prompts scoped to other workspaces and the "all workspaces" ones.
405
+ const targetId = req.method === 'GET'
406
+ ? (url.searchParams.get('workspaceId') ?? '')
407
+ : '';
408
+ let workspaceId = targetId;
409
+ if (req.method === 'POST') {
410
+ try {
411
+ const body = await readJsonBody(req);
412
+ workspaceId = typeof body?.workspaceId === 'string' ? body.workspaceId.trim() : '';
413
+ const filePath = promptStorePath(ctx, workspaceId);
414
+ if (filePath === undefined) {
415
+ sendJson(res, { ok: false, code: 'workspace-not-found', error: 'workspace not found' }, 404);
416
+ return;
417
+ }
418
+ const prompts = Array.isArray(body?.prompts) ? body.prompts : [];
419
+ mkdirSync(dirname(filePath), { recursive: true });
420
+ writeFileSync(filePath, JSON.stringify(prompts, null, 2) + '\n', 'utf8');
421
+ sendJson(res, { ok: true, workspaceId, prompts });
422
+ } catch (error) {
423
+ sendJson(res, { ok: false, error: String(error?.message ?? error) }, 500);
424
+ }
425
+ return;
426
+ }
427
+ if (req.method !== 'GET') {
428
+ sendJson(res, { ok: false, error: 'method-not-allowed' }, 405);
429
+ return;
430
+ }
431
+ try {
432
+ const filePath = promptStorePath(ctx, workspaceId);
433
+ if (filePath === undefined) {
434
+ sendJson(res, { ok: false, code: 'workspace-not-found', error: 'workspace not found' }, 404);
435
+ return;
436
+ }
437
+ sendJson(res, { ok: true, workspaceId, prompts: readPromptStore(filePath) });
438
+ } catch (error) {
439
+ sendJson(res, { ok: false, error: String(error?.message ?? error) }, 500);
440
+ }
441
+ return;
442
+ }
443
+
364
444
  if (op === 'job-kill') {
365
445
  if (req.method !== 'POST') {
366
446
  sendJson(res, { ok: false, error: 'method-not-allowed' }, 405);
@@ -509,8 +589,11 @@ export const __test = {
509
589
  selfVersion,
510
590
  auditProfileBundles,
511
591
  profileDirectory,
592
+ promptStorePath,
593
+ readPromptStore,
512
594
  HOST_STARTED_AT,
513
595
  SELF_VERSION,
514
596
  ROUTE,
515
597
  MODULE_ID,
598
+ PROMPTS_DIR,
516
599
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.8.15",
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 设置页启用后,新会话行的 Agent 预设右侧出现下拉列表,可为当前工作区选择已保存的提示词——点击提示词填入输入框继续编辑,或点右侧「直接发送」立即发出;下拉里可一键创建新的提示词,并在 Power-Up 页新增「工作区提示词」标签页统一管理(标题可选,缺省显示正文开头摘要),UI 参考 dsh-memory 的分段标签与卡片样式。 · 所有功能均可在 Power-Up 页面独立启用/禁用,弹窗统一为宿主原生样式。",
3
+ "version": "0.8.17",
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 设置页启用后,新会话行的 Agent 预设右侧出现下拉列表,可为当前工作区选择已保存的提示词——点击提示词填入输入框继续编辑,或点右侧「直接发送」立即发出;下拉里可一键创建新的提示词,并在 Power-Up 页新增「工作区提示词」标签页统一管理(标题可选,缺省显示正文开头摘要),UI 参考 dsh-memory 的分段标签与卡片样式。 · 会话内「创建新的提示词」走会话弹窗,固定归属当前工作区(仅可改为所有工作区);设置页同样可管理新建,工作区列表为自定义样式下拉。提示词保存在工作区目录 .dsh/dsh-powerup/prompts.json,不再存浏览器。会话标题弹窗的任务圆点区分运行/阻塞(等待询问工具回答),任务结束后保留到用户切换过去才消失。 · 提示词管理面板按工作区分组展示(分组可折叠),每条提示词默认折叠只显示标题与编辑/删除;会话内新建提示词的弹窗关闭后保留已填内容,重新打开可继续编辑。 · 所有功能均可在 Power-Up 页面独立启用/禁用,弹窗统一为宿主原生样式。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
7
7
  "main": "index.js",