dsh-kbar 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.3.0
4
+
5
+ - 新增**斜杠命令搜索与执行**:读取当前会话的命令目录,选中即通过 `commands.execute` 执行 `/name`;
6
+ - 新增**技能搜索**:读取当前会话的可用技能,选中把 `/技能名` 复制到剪贴板,粘到输入框即可调用;
7
+ - 分类标签(模型/插件/命令/技能)与中文提示。
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  - 新增**模型搜索与切换**:列出当前会话可用的全部模型(按厂商分组),选中即切换,沿用模型默认推理强度;
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A command palette for DeepSeek Harness. One shortcut to search sessions and run common actions.
4
4
 
5
5
  - Default shortcut: `Ctrl+Shift+P` on Windows/Linux, `Cmd+Shift+P` on macOS.
6
- - Searches sessions by title and working directory, runs any registered DSH shortcut command, switches the session model, and opens any installed bundle's detail page from the palette.
6
+ - Searches sessions, slash commands, skills, models and installed bundles, and runs any registered DSH shortcut command from one palette.
7
7
  - `↑`/`↓` to select, `Enter` to run, `Esc` to close.
8
8
 
9
9
  > `Ctrl+K` is already DSH's own session search, so KBar uses `Ctrl+Shift+P` to avoid a shortcut conflict. Rebind it in Settings → Shortcuts if you prefer.
package/client.js CHANGED
@@ -16,6 +16,10 @@ window.__ModuleLoader__.load({
16
16
  sessionTag: '会话',
17
17
  actionTag: '动作',
18
18
  commandTag: '命令',
19
+ modelTag: '模型',
20
+ pluginTag: '插件',
21
+ slashTag: '命令',
22
+ skillTag: '技能',
19
23
  newSession: '新建会话',
20
24
  pluginsPage: '打开插件页',
21
25
  hintNavigate: '↑↓ 选择',
@@ -32,6 +36,10 @@ window.__ModuleLoader__.load({
32
36
  sessionTag: 'session',
33
37
  actionTag: 'action',
34
38
  commandTag: 'command',
39
+ modelTag: 'model',
40
+ pluginTag: 'plugin',
41
+ slashTag: 'command',
42
+ skillTag: 'skill',
35
43
  newSession: 'New session',
36
44
  pluginsPage: 'Open the plugins page',
37
45
  hintNavigate: '↑↓ select',
@@ -40,6 +48,25 @@ window.__ModuleLoader__.load({
40
48
  results: '{n} results',
41
49
  }
42
50
 
51
+ function kindLabel(kind) {
52
+ switch (kind) {
53
+ case 'session':
54
+ return TEXT.sessionTag
55
+ case 'command':
56
+ return TEXT.commandTag
57
+ case 'model':
58
+ return TEXT.modelTag
59
+ case 'plugin':
60
+ return TEXT.pluginTag
61
+ case 'slash':
62
+ return TEXT.slashTag
63
+ case 'skill':
64
+ return TEXT.skillTag
65
+ default:
66
+ return TEXT.actionTag
67
+ }
68
+ }
69
+
43
70
  const IS_MAC = (() => {
44
71
  try {
45
72
  const p = (navigator.platform || '') + ' ' + (navigator.userAgent || '')
@@ -75,6 +102,8 @@ window.__ModuleLoader__.load({
75
102
  let state = { open: false, query: '', index: 0, rows: [] }
76
103
  let models = []
77
104
  let plugins = null
105
+ let slashCommands = []
106
+ let skills = []
78
107
  let loading = false
79
108
  const listeners = new Set()
80
109
  let lastFocus = null
@@ -255,6 +284,64 @@ window.__ModuleLoader__.load({
255
284
  if (state.open) refreshRows()
256
285
  }
257
286
 
287
+ async function loadSlashCommands() {
288
+ const row = currentSession()
289
+ if (!row) return
290
+ try {
291
+ const result = await ctx.remote.commands.list(row.id)
292
+ if (!result || !result.ok || !Array.isArray(result.value)) return
293
+ slashCommands = result.value.map((command) => ({
294
+ kind: 'slash',
295
+ id: 'slash:' + command.name,
296
+ title: '/' + command.name,
297
+ secondary: String(command.description || (command.input && command.input.hint) || ''),
298
+ keywords: String(command.description || '') + ' 命令 command 斜杠 slash',
299
+ updatedAt: 0,
300
+ run: () => {
301
+ const pending = ctx.remote.commands.execute(row.id, '/' + command.name, [])
302
+ if (pending && typeof pending.then === 'function') {
303
+ return pending.then((outcome) => {
304
+ if (!outcome || outcome.ok !== true) {
305
+ throw new Error((outcome && outcome.error && outcome.error.message) || 'command execution failed')
306
+ }
307
+ })
308
+ }
309
+ return undefined
310
+ },
311
+ }))
312
+ if (state.open) refreshRows()
313
+ } catch {
314
+ /* command catalog unavailable */
315
+ }
316
+ }
317
+
318
+ async function loadSkills() {
319
+ const row = currentSession()
320
+ if (!row) return
321
+ try {
322
+ const result = await ctx.remote.skills.list({ sessionId: row.id })
323
+ if (!result || !result.ok || !result.value || !Array.isArray(result.value.skills)) return
324
+ skills = result.value.skills.map((skill) => ({
325
+ kind: 'skill',
326
+ id: 'skill:' + skill.name,
327
+ title: '/' + skill.name,
328
+ secondary: String(skill.description || '') + ' · 复制调用命令',
329
+ keywords: String(skill.description || '') + ' 技能 skill 斜杠 slash',
330
+ updatedAt: 0,
331
+ run: () => {
332
+ const text = '/' + skill.name
333
+ if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
334
+ return navigator.clipboard.writeText(text)
335
+ }
336
+ return undefined
337
+ },
338
+ }))
339
+ if (state.open) refreshRows()
340
+ } catch {
341
+ /* skill catalog unavailable */
342
+ }
343
+ }
344
+
258
345
  function compute() {
259
346
  const query = state.query.trim().toLowerCase()
260
347
  const actions = actionItems()
@@ -265,12 +352,14 @@ window.__ModuleLoader__.load({
265
352
  if (!query) {
266
353
  return actions
267
354
  .concat(models.slice(0, 6))
268
- .concat(commands.slice(0, 8))
355
+ .concat(slashCommands.slice(0, 8))
356
+ .concat(skills.slice(0, 8))
357
+ .concat(commands.slice(0, 6))
269
358
  .concat(sessions.slice(0, 8))
270
359
  .concat((plugins || []).slice(0, 8))
271
360
  }
272
361
  const scored = []
273
- for (const item of actions.concat(models, commands, sessions, plugins || [])) {
362
+ for (const item of actions.concat(models, slashCommands, skills, commands, sessions, plugins || [])) {
274
363
  const value = score(query, item)
275
364
  if (value > 0) scored.push({ item, value: value + boost(item) })
276
365
  }
@@ -302,6 +391,8 @@ window.__ModuleLoader__.load({
302
391
  set({ open: true, query: '', index: 0, rows: compute() })
303
392
  loadModels()
304
393
  loadPlugins()
394
+ loadSlashCommands()
395
+ loadSkills()
305
396
  },
306
397
  close() {
307
398
  if (!state.open || closing) return
@@ -589,7 +680,7 @@ window.__ModuleLoader__.load({
589
680
  h('div', { style: styles.rowTitle }, item.title),
590
681
  item.secondary ? h('div', { style: styles.rowSecondary }, item.secondary) : null,
591
682
  ),
592
- h('span', { style: styles.badge }, item.kind === 'session' ? TEXT.sessionTag : item.kind === 'command' ? TEXT.commandTag : TEXT.actionTag),
683
+ h('span', { style: styles.badge }, kindLabel(item.kind)),
593
684
  ),
594
685
  ),
595
686
  ),
package/docs/DETAIL.md CHANGED
@@ -15,6 +15,8 @@ KBar 在 DSH 界面之上加一个命令面板:按一次快捷键,输入几
15
15
  | --- | --- |
16
16
  | 会话 | 当前会话目录里列出的所有会话(标题、工作目录),按最近更新排序,选中即切换 |
17
17
  | 命令 | DSH 里所有已注册的快捷键命令(新建会话、设置、侧栏、终端、文件等),选中即执行 |
18
+ | 斜杠命令 | 当前会话的命令目录(`/compact` 等),选中即执行 |
19
+ | 技能 | 当前会话可用的技能,选中把 `/技能名` 复制到剪贴板(粘到输入框即可调用) |
18
20
  | 模型 | 当前会话可用的模型(按厂商分组),选中即切换,并沿用该模型的默认推理强度 |
19
21
  | 插件 | 插件管理器里的 bundle(名称、版本),选中打开对应的插件详情页 |
20
22
  | 动作 | 新建会话;打开插件页 |
@@ -27,7 +29,9 @@ KBar 在 DSH 界面之上加一个命令面板:按一次快捷键,输入几
27
29
 
28
30
  ## 已知限制
29
31
 
30
- - 命令来自 DSH 的快捷键注册表,只包含带快捷键定义的应用命令;斜杠命令与技能尚未进入搜索范围(后续版本计划)。
32
+ - 快捷键命令只包含带快捷键定义的应用命令;斜杠命令与技能来自当前会话,需要会话处于打开状态。
33
+ - 需要参数的斜杠命令直接执行可能提示参数缺失,请改用输入框补全参数。
34
+ - 技能只提供“复制 /技能名”,不直接替用户发送,避免误触模型调用。
31
35
  - 模型列表只在存在当前会话时加载;没有会话时该分组为空。
32
36
  - 插件列表来自插件管理器的 bundle 列表,选中后打开插件详情页,不在面板内直接启停。
33
37
  - 部分命令依赖当前焦点所在的控件,通过面板执行时可能提示“不可用”(例如需要选中某个侧栏标签的命令)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-kbar",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "KBar: a command palette for DeepSeek Harness — one shortcut to search sessions and run common actions.",
5
5
  "type": "module",
6
6
  "main": "index.js",