@maci0/dsh-alias 0.7.4 → 0.7.6

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # dsh-alias
2
2
 
3
- Define your own slash commands in DeepSeek Harness, from the composer or from
4
- the Plugins page.
3
+ Define your own slash commands in DeepSeek Harness, from the composer, the
4
+ **Aliases** panel in the sidebar, or the Alias card on the Plugins page.
5
5
 
6
6
  ## What you get
7
7
 
@@ -15,7 +15,9 @@ the Plugins page.
15
15
 
16
16
  After that, `/gm`, `/rev src/app.ts`, and `/ship` are ordinary commands: they
17
17
  show up in the composer's command directory and run without a model turn of
18
- their own. The Plugins page gains an **Alias** card that edits the same set.
18
+ their own. Three surfaces edit the same set: the sidebar's **Aliases** panel,
19
+ the **Alias** card inside the plugin's row on the Plugins page, and `/alias`
20
+ itself.
19
21
 
20
22
  ## Install
21
23
 
@@ -28,14 +30,12 @@ Requires DeepSeek Harness `>=0.2.2-rc.4 <0.3.0`. Restart DSH and refresh the bro
28
30
  > would win).
29
31
 
30
32
  ```sh
31
- dsh plugin --profile web add --save-exact @maci0/dsh-alias@0.7.4
33
+ dsh plugin --profile web add --save-exact @maci0/dsh-alias@0.7.5
32
34
  ```
33
35
 
34
36
  Pin an exact npm version. To upgrade, run the same command with the newer
35
37
  version, then restart `dsh web` (bundle layers compose at boot).
36
38
 
37
- The bundled `cordis.patch.yml` inserts the `alias` row.
38
-
39
39
  ## Commands
40
40
 
41
41
  `/alias add <name> <text>` registers `/<name>`. What `/<name>` does depends on
@@ -74,8 +74,8 @@ Aliases live in one settings field, the plugin's own row:
74
74
 
75
75
  ## How it works
76
76
 
77
- The field is `volatile()`, so the Plugins page's **Alias** card, `/alias`, and
78
- the profile patch are three views of one document: a write from any of them
77
+ The field is `volatile()`, so the sidebar's **Aliases** page, the Plugins page's **Alias** card, `/alias`, and
78
+ the profile patch are four views of one document: a write from any of them
79
79
  lands on the running instance with no remount. A deployment whose settings
80
80
  document refuses writes still gets working aliases in every current session
81
81
  until dsh restarts, and the reply says so. The card reports a write the host refuses.
package/lib/client.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * dsh-alias: browser half.
3
3
  *
4
- * One surface: the Alias card on the Plugins page, keyed on the `alias`
5
- * settings namespace the host half declares as its row id. It lists every
4
+ * Two surfaces over one editor: the Alias card on the Plugins page (the
5
+ * `plugins.row.config` slot) and a global Aliases page behind the sidebar's
6
+ * panel list. Both are keyed on the `alias` settings namespace the host half
7
+ * declares as its row id. The page lists every
6
8
  * defined alias with a Remove control and adds one through a name + text pair;
7
9
  * every write goes through `ctx.configForms`, the same settings document
8
10
  * `/alias` writes on the host, so the two surfaces cannot disagree.
@@ -40,6 +42,9 @@ window.__ModuleLoader__.load({
40
42
  /** Locale namespace for this plugin's copy. */
41
43
  const LOCALE_NS = 'alias'
42
44
 
45
+ /** Global panel id shared by the sidebar entry and the page it opens. */
46
+ const PANEL_ID = 'alias'
47
+
43
48
  /** The names the command registry accepts, mirroring the host half. */
44
49
  const COMMAND_NAME = /^[a-z][a-z0-9_-]*$/u
45
50
 
@@ -63,13 +68,19 @@ window.__ModuleLoader__.load({
63
68
  '.da-button-remove{flex:none;padding:3px 10px;font-size:12px;color:var(--dsw-alias-label-secondary)}',
64
69
  '.da-status{font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}',
65
70
  '.da-error{font-size:12px;line-height:1.5;color:var(--dsw-alias-label-error)}',
71
+ '.da-panel{display:flex;flex-direction:column;height:100%;overflow:auto;box-sizing:border-box;padding:24px 32px}',
72
+ '.da-panel-inner{display:flex;flex-direction:column;gap:16px;width:100%;max-width:920px}',
73
+ '.da-panel-title{font-size:20px;line-height:1.4;font-weight:600;margin:0;color:var(--dsw-alias-label-primary)}',
74
+ '.da-panel-subtitle{font-size:13px;line-height:1.5;margin:0;color:var(--dsw-alias-label-tertiary)}',
66
75
  ].join('')
67
76
 
68
77
  /** Plugin version, shown in the card header. Kept in lockstep with package.json. */
69
- const VERSION = '0.7.4'
78
+ const VERSION = '0.7.6'
70
79
 
71
80
  const en = {
72
81
  title: 'Alias',
82
+ panel: 'Aliases',
83
+ panelSubtitle: 'Define slash commands of your own. Each alias is a command like any other, in the composer and in the catalog.',
73
84
  summaryEmpty: 'No aliases defined.',
74
85
  summary: '{count} alias(es) defined.',
75
86
  groupExisting: 'Defined aliases',
@@ -91,6 +102,8 @@ window.__ModuleLoader__.load({
91
102
 
92
103
  const zh = {
93
104
  title: '别名',
105
+ panel: '别名',
106
+ panelSubtitle: '定义你自己的斜杠命令。每个别名都和普通命令一样,出现在输入框和命令目录里。',
94
107
  summaryEmpty: '未定义别名。',
95
108
  summary: '已定义 {count} 个别名。',
96
109
  groupExisting: '已定义的别名',
@@ -305,6 +318,55 @@ window.__ModuleLoader__.load({
305
318
  }
306
319
  }
307
320
 
321
+ /**
322
+ * Build the global page behind the sidebar entry: the same editor the row
323
+ * card renders, under a page title.
324
+ * @param Card - the row card component.
325
+ * @param t - translate function bound to this plugin's locale namespace.
326
+ * @returns the page component the `main` slot renders.
327
+ */
328
+ function createPanel(Card, t) {
329
+ return function AliasPanel() {
330
+ return React.createElement(
331
+ 'div',
332
+ { className: 'da-panel' },
333
+ React.createElement(
334
+ 'div',
335
+ { className: 'da-panel-inner' },
336
+ React.createElement('h1', { className: 'da-panel-title' }, t('panel')),
337
+ React.createElement('p', { className: 'da-panel-subtitle' }, t('panelSubtitle')),
338
+ React.createElement(Card, { view: 'page' }),
339
+ ),
340
+ )
341
+ }
342
+ }
343
+
344
+ /**
345
+ * Decorative occupant for the sidebar entry; the sidebar owns the
346
+ * accessible label.
347
+ * @param props - the sidebar's icon share: the requested edge size.
348
+ * @returns the alias glyph.
349
+ */
350
+ function AliasPanelIcon(props) {
351
+ const size = props?.size ?? 16
352
+ return React.createElement(
353
+ 'svg',
354
+ {
355
+ width: size,
356
+ height: size,
357
+ viewBox: '0 0 16 16',
358
+ fill: 'none',
359
+ stroke: 'currentColor',
360
+ strokeWidth: 1.5,
361
+ strokeLinecap: 'round',
362
+ strokeLinejoin: 'round',
363
+ 'aria-hidden': 'true',
364
+ },
365
+ React.createElement('path', { d: 'M2.5 5.5h9m0 0-2.5-2.5m2.5 2.5L9 8' }),
366
+ React.createElement('path', { d: 'M13.5 10.5h-9m0 0L7 8m-2.5 2.5L7 13' }),
367
+ )
368
+ }
369
+
308
370
  /**
309
371
  * Mount the browser surface: the Alias card on the Plugins page.
310
372
  * @param ctx - the browser plugin context.
@@ -340,6 +402,23 @@ window.__ModuleLoader__.load({
340
402
  key: '@maci0/dsh-alias#alias',
341
403
  locale: LOCALE_NS,
342
404
  }, Card))
405
+
406
+ // The same editor as a global page behind the sidebar's panel list, so
407
+ // the aliases are reachable without opening the Plugins page and the
408
+ // row detail inside it.
409
+ ctx.slots.inject('main', () => ctx.slots.register({
410
+ name: 'main',
411
+ key: PANEL_ID,
412
+ locale: LOCALE_NS,
413
+ }, createPanel(Card, t)))
414
+
415
+ ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
416
+ name: 'sidebar.panellist',
417
+ id: PANEL_ID,
418
+ order: 20,
419
+ locale: LOCALE_NS,
420
+ label: () => t('panel'),
421
+ }, AliasPanelIcon))
343
422
  }
344
423
 
345
424
  exports.apply = apply
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maci0/dsh-alias",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"