@qzsy/dsh-command-palette 0.0.0-stage → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 qzsy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,144 @@
1
- # Temporary Holding Version
1
+ # @qzsy/dsh-command-palette
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > Packaged from the local DSH plugin dsh-command-palette; published under the @qzsy scope.
4
+
5
+ ## Install
6
+
7
+ ~~~bash
8
+ dsh plugin add @qzsy/dsh-command-palette
9
+ ~~~
10
+
11
+ ## Upstream README
12
+
13
+ # Command Palette for DSH
14
+
15
+ A persistent DeepSeek Harness Client plugin that turns `Command+K` into a command
16
+ palette for the Web/Desktop GUI: recent sessions with live status, workspaces,
17
+ files, and actions — searchable in Chinese, English, full pinyin, pinyin
18
+ initials, or any mixed form.
19
+
20
+ ## What it does
21
+
22
+ - **Command+K on the Desktop app** opens a floating palette; the same chord toggles
23
+ it closed. In the browser profile it adopts the browser-safe chord that
24
+ `session.search` used before (Mod+Alt+K on macOS).
25
+ - **Sections and filters**: All / Sessions / Workspaces / Files / Actions.
26
+ - *Sessions*: every non-blank, non-archived Session ordered by `updatedAt`,
27
+ with its Workspace label, a compact relative age, and a **live status
28
+ badge** from the unified Session status snapshot: `工作中` (pulsing blue dot),
29
+ `待批准` / `待审阅` / `待回答` (amber), or `已完成` (green, unread completion).
30
+ The section label counts active Sessions, e.g. `近期会话 · 2 个进行中`; the
31
+ count updates live while the palette stays open. When the Git badge bundle
32
+ is installed, the Workspace name under each thread title also carries that
33
+ Workspace's `+N −M` / `干净` / `无 Git` badge.
34
+ - **Sub-agent threads are hidden by default.** Sessions whose
35
+ `origin === "subagent"` are excluded from rows, search results, workspace
36
+ activity badges and counts. When any exist, the footer shows
37
+ `显示 N 个子代理会话`; the toggle includes them for the current palette
38
+ session and returns to the hidden default on the next open, so teammate and
39
+ research threads never crowd the list unless asked for.
40
+ - *Workspaces*: Workspaces ordered by their most recent Session activity, with
41
+ an abbreviated path and an aggregate status badge (`N 个工作中` /
42
+ `N 个待处理`). When the `@qzsy/dsh-git-badge` bundle is installed, each
43
+ workspace name also carries its Git badge: `+N −M` line changes, `干净` for a
44
+ clean repository, `无 Git` outside a repository, or the file count when only
45
+ untracked files changed. Git data comes from the Host's
46
+ `POST /api/git-badge` route (8 s palette cache); without that route the
47
+ badges are simply absent. Enter opens the newest Session in the Workspace,
48
+ or a fresh blank Session when it has none.
49
+ - *Files*: live, debounced Host file-reference lookup scoped to the Session in
50
+ the main panel; choosing a row opens the file in the right-hand preview.
51
+ Opened files are remembered locally (origin-scoped `localStorage`) and listed
52
+ as *Recent files* when the search box is empty. File matching stays
53
+ Host-ranked path matching (see limitations).
54
+ - *Actions*: every registered shortcut command (labels and keys come from the
55
+ live shortcut catalog, so plugin commands appear automatically). Enter
56
+ invokes the command through the shortcut registry; Settings and the keyboard
57
+ shortcut reference open from here.
58
+ - **Mixed Chinese/English search** through [`text-search-engine`](https://github.com/cjinhuo/text-search-engine):
59
+ one query covers Han characters (`登录`), full pinyin (`denglu`), pinyin
60
+ initials (`dl`), English subsequences (`nextjs`), space-separated terms, and
61
+ mixed forms (`qunxingerp`, `群erp`, `qxkf`). Matched ranges are highlighted in
62
+ titles and subtitles. Ranking prefers tighter, earlier title hits, then
63
+ detail hits, then recency.
64
+ - **Keyboard**: Up/Down move the selection, Enter opens, Escape closes. The
65
+ filter switches with bare ← / → (both directions, wrapping) or Tab /
66
+ Shift+Tab; holding Alt/Ctrl/Cmd with an arrow keeps native caret or word
67
+ movement inside the query. IME composition is never intercepted, so pinyin
68
+ candidate selection keeps working. Focus returns to whatever had it before
69
+ opening.
70
+ - **Sidebar entry**: the *命令面板 / Command palette* row joins the global panel
71
+ stack directly below 自动化任务 / Automations (glyph-only in the collapsed
72
+ rail). Choosing it opens the overlay without switching the main panel: the row
73
+ is an action, so the plugin answers that one panel id in the layout selection
74
+ and delegates every other id to the layout owner.
75
+ - Light/dark themes follow `--dsw-*` tokens; all copy is registered in the Client
76
+ locale service (zh/en).
77
+
78
+ ## Search engine integration
79
+
80
+ DSH's browser module table only resolves its own platform modules and
81
+ client-plugin rows, so a plain-JS plugin cannot `require('text-search-engine')`
82
+ at runtime. The package's minified browser IIFE is therefore vendored and
83
+ injected into the client bundle:
84
+
85
+ - `vendor/text-search-engine.min.js` — exact browser build from the pinned
86
+ `text-search-engine@1.6.0` dependency (MIT; license in
87
+ `vendor/text-search-engine.LICENSE`).
88
+ - `scripts/sync-vendor-engine.mjs` — rewrites the marked region in `client.js`
89
+ from the vendored file; run `node scripts/sync-vendor-engine.mjs` after
90
+ updating the vendored build.
91
+ - `client.js` — the generated region captures the engine exports in a factory
92
+ scope constant and uses `createSearcher()` with `title`/`detail` fields,
93
+ custom ranking, and hit ranges for highlighting. If the engine fails to
94
+ initialize, a built-in subsequence matcher keeps the palette usable.
95
+
96
+ File search is delegated to the Host (`ctx.remote.fileReferences.list`), which
97
+ retrieves and ranks paths from the current Session workspace; pinyin is applied
98
+ to sessions, workspaces, and actions, where titles are user-facing Chinese text.
99
+
100
+ ## Session status
101
+
102
+ The palette reads the root `useSessionStatus` hook of the `shell.overlay` slot
103
+ (provided by `dsh-client-ui-session`). That observable snapshot carries
104
+ `running`, `pendingInteraction.kind`, and `completionUnread` per Session, so
105
+ badges and counts change live as agents start, wait for input, and finish.
106
+ Pending states take precedence over running, because they need the user.
107
+
108
+ ## Shortcut ownership
109
+
110
+ `session.search` already owns `Command+K` in the shipped UI. The palette registers
111
+ with the free `Command+Shift+P` default and, once per device preference document,
112
+ uses the public `ctx.shortcuts.edit()` API to:
113
+
114
+ 1. clear `session.search`'s binding, and
115
+ 2. bind `palette.open` to the chord `session.search` had (Command+K on Desktop,
116
+ Mod+Alt+K in the browser).
117
+
118
+ That is a normal, visible override in Settings → Keyboard shortcuts: both rows
119
+ show as modified, and *Restore All Defaults* restores the palette to
120
+ `Command+Shift+P` and search to `Command+K`. On the next launch the plugin
121
+ re-adopts the chord while both rows are still at their unmodified defaults, so
122
+ `Command+K` keeps opening the palette. Session search itself stays available from
123
+ the palette's Actions list and from the sidebar search icon.
124
+
125
+ ## Install
126
+
127
+ The bundle is installed into the current profile with
128
+ `plugin_manager install_bundle` (absolute package directory). It needs no build
129
+ step at install time: `client.js` is a plain-JS `__ModuleLoader__` module that
130
+ only requires `react` from the browser module table, with the vendored engine
131
+ already inlined.
132
+
133
+ ## Files
134
+
135
+ - `package.json` — bundle manifest (`dsh.bundle.patch`, `dsh.client`, display resources)
136
+ - `cordis.patch.yml` — inserts the Host row
137
+ - `index.js` — Host half (no-op; the palette is client-only)
138
+ - `client.js` — shortcut adoption, overlay palette, live status badges, ranked
139
+ mixed-script search, sidebar trigger, zh/en dictionaries
140
+ - `vendor/` — vendored engine build and its MIT license
141
+ - `scripts/sync-vendor-engine.mjs` — regenerates the vendored engine region
142
+ - `locale/en.json`, `locale/zh.json` — Plugin Manager title/description
143
+ - `icon.svg` — original artwork
144
+ - `docs/` — verification screenshots
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: command-palette
3
+ name: '@qzsy/dsh-command-palette'