dsh-mini 0.1.0 → 0.1.1

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 (2) hide show
  1. package/lib/client.js +41 -3
  2. package/package.json +29 -9
package/lib/client.js CHANGED
@@ -14,8 +14,40 @@
14
14
  * is one click inside the small window.
15
15
  */
16
16
 
17
+ /**
18
+ * The id this bundle is being loaded under.
19
+ *
20
+ * The host serves an entry's client bundle only under the entry id it composed
21
+ * at scan time. After this plugin was renamed from `dsh-hud-window` to
22
+ * `dsh-mini`, a host that was already running kept its old row, so the boot
23
+ * payload still asked for `dsh-hud-window/client.js` and the loader rejected the
24
+ * file because it registered a different id ("loaded without registering
25
+ * ..."), which fails the whole client boot. Reading the id back from the
26
+ * executing script keeps that stale row harmless: it registers under its own
27
+ * expected id and does nothing (see `apply`), until the next host restart drops
28
+ * the old row for good.
29
+ */
30
+ const SCRIPT_ID = (() => {
31
+ try {
32
+ const src = (typeof document !== 'undefined' && document.currentScript && document.currentScript.src) || ''
33
+ const parts = src.split('/client.js')
34
+ // A multi-entry combo names its members after `??`; only a single-member
35
+ // combo unambiguously identifies this bundle.
36
+ const combo = src.match(/\/plugins\/\?\?([^,&]+)\/client\.js/)
37
+ if (combo && src.split('/client.js').length === 2) return decodeURIComponent(combo[1])
38
+ const single = src.match(/\/plugins\/([^/]+)\/client\.js/)
39
+ return single ? decodeURIComponent(single[1]) : ''
40
+ } catch {
41
+ return ''
42
+ }
43
+ })()
44
+
45
+ /** Legacy ids this bundle may still be requested under by an older host row. */
46
+ const LEGACY_IDS = ['dsh-hud-window']
47
+ const MODULE_ID = SCRIPT_ID === 'dsh-mini' || LEGACY_IDS.includes(SCRIPT_ID) ? SCRIPT_ID : 'dsh-mini'
48
+
17
49
  window.__ModuleLoader__.load({
18
- id: 'dsh-mini',
50
+ id: MODULE_ID,
19
51
  factory: (require) => {
20
52
  var module = { exports: {} }
21
53
  var exports = module.exports
@@ -530,11 +562,17 @@ window.__ModuleLoader__.load({
530
562
 
531
563
  // ---------------------------------------------------------------- apply
532
564
 
533
- exports.name = 'dsh-mini'
565
+ exports.name = MODULE_ID
534
566
  exports.inject = ['slots']
535
567
 
536
568
  exports.apply = (ctx) => {
537
- trace('apply', `${isHud ? 'hud' : 'main'}|${inNativeShell ? 'native' : 'web'}`)
569
+ trace('apply', `${MODULE_ID}|${isHud ? 'hud' : 'main'}|${inNativeShell ? 'native' : 'web'}`)
570
+ // A stale pre-rename row: register (so the loader accepts the bundle) but
571
+ // claim no UI — the current `dsh-mini` entry renders it.
572
+ if (MODULE_ID !== 'dsh-mini') {
573
+ trace('apply:legacy-skip', MODULE_ID)
574
+ return
575
+ }
538
576
  ensureStyles()
539
577
  startTitleKeeper()
540
578
  followHandedSession(ctx)
package/package.json CHANGED
@@ -1,17 +1,32 @@
1
1
  {
2
2
  "name": "dsh-mini",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "DSH 常驻小窗插件:把当前会话一键弹出为独立置顶小窗(WebView2 原生窗口),含整屏/框选截图、划词「问大肥鱼」、全局快捷键与截图自动复制",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
- "license": "MIT",
8
- "keywords": ["dsh", "deepseek-harness", "dsh-plugin", "always-on-top", "screenshot", "webview2"],
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "dsh",
10
+ "deepseek-harness",
11
+ "dsh-plugin",
12
+ "always-on-top",
13
+ "screenshot",
14
+ "webview2"
15
+ ],
9
16
  "homepage": "https://www.npmjs.com/package/dsh-mini",
10
- "os": ["win32"],
11
- "engines": { "node": ">=20" },
17
+ "os": [
18
+ "win32"
19
+ ],
20
+ "engines": {
21
+ "node": ">=20"
22
+ },
12
23
  "exports": {
13
- ".": { "default": "./lib/index.js" },
14
- "./client": { "default": "./lib/client.js" },
24
+ ".": {
25
+ "default": "./lib/index.js"
26
+ },
27
+ "./client": {
28
+ "default": "./lib/client.js"
29
+ },
15
30
  "./package.json": "./package.json"
16
31
  },
17
32
  "files": [
@@ -30,7 +45,9 @@
30
45
  "开发方案-WebView2原生小窗.md"
31
46
  ],
32
47
  "dsh": {
33
- "bundle": { "patch": "./cordis.patch.yml" },
48
+ "bundle": {
49
+ "patch": "./cordis.patch.yml"
50
+ },
34
51
  "client": {
35
52
  "platform": "web",
36
53
  "inject": [
@@ -38,7 +55,10 @@
38
55
  "@deepseek-ai/dsh-client-ui-conversation"
39
56
  ]
40
57
  },
41
- "compatibility": { "node": ">=20", "dsh": ">=0.2.0-rc.1" }
58
+ "compatibility": {
59
+ "node": ">=20",
60
+ "dsh": ">=0.2.0-rc.1"
61
+ }
42
62
  },
43
63
  "dependencies": {},
44
64
  "scripts": {