xrkh-better-sidebar 0.17.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 (155) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +42 -0
  3. package/README_EN.md +42 -0
  4. package/cordis.patch.yml +49 -0
  5. package/package.json +182 -0
  6. package/scripts/install-xrkh.ps1 +15 -0
  7. package/scripts/install-xrkh.sh +12 -0
  8. package/scripts/install.ps1 +306 -0
  9. package/scripts/install.sh +287 -0
  10. package/src/agent-opens.ts +265 -0
  11. package/src/agent-pty.ts +527 -0
  12. package/src/browser-probe.ts +26 -0
  13. package/src/bundle-route.ts +129 -0
  14. package/src/client/BrowserView.tsx +289 -0
  15. package/src/client/DiffTab.tsx +115 -0
  16. package/src/client/EditorHost.tsx +563 -0
  17. package/src/client/FenceErrorNotice.tsx +40 -0
  18. package/src/client/FileTree.tsx +701 -0
  19. package/src/client/FreeWindow.tsx +337 -0
  20. package/src/client/MarkdownHtml.tsx +296 -0
  21. package/src/client/OrphanedTab.tsx +27 -0
  22. package/src/client/PdfView.tsx +110 -0
  23. package/src/client/RenderBoundary.tsx +49 -0
  24. package/src/client/SandboxStatusBar.tsx +60 -0
  25. package/src/client/SideCardSection.module.css +960 -0
  26. package/src/client/SideCardSection.tsx +1163 -0
  27. package/src/client/SideChatView.module.css +466 -0
  28. package/src/client/SideChatView.tsx +772 -0
  29. package/src/client/Sidebar.tsx +1778 -0
  30. package/src/client/SubagentView.module.css +547 -0
  31. package/src/client/SubagentView.tsx +883 -0
  32. package/src/client/TabBar.tsx +365 -0
  33. package/src/client/TerminalView.tsx +424 -0
  34. package/src/client/TextEditor.tsx +468 -0
  35. package/src/client/TreePanel.tsx +279 -0
  36. package/src/client/UploadOverlay.tsx +62 -0
  37. package/src/client/add-plugin-modal.tsx +199 -0
  38. package/src/client/api.ts +390 -0
  39. package/src/client/binary-download.tsx +23 -0
  40. package/src/client/breakpoints.ts +61 -0
  41. package/src/client/browser.ts +167 -0
  42. package/src/client/builtins/index.ts +37 -0
  43. package/src/client/builtins/tabs.tsx +389 -0
  44. package/src/client/builtins/viewers.tsx +125 -0
  45. package/src/client/changes/ChangesTab.tsx +204 -0
  46. package/src/client/changes/DiffPane.tsx +313 -0
  47. package/src/client/changes/GitLens.tsx +734 -0
  48. package/src/client/changes/SessionLens.tsx +102 -0
  49. package/src/client/changes/changes.module.css +399 -0
  50. package/src/client/changes/ops.ts +230 -0
  51. package/src/client/chunk-loader.ts +350 -0
  52. package/src/client/chunks/editor.tsx +9 -0
  53. package/src/client/chunks/mermaid.tsx +10 -0
  54. package/src/client/chunks/terminal.tsx +9 -0
  55. package/src/client/cm-themes.ts +129 -0
  56. package/src/client/conversation-draft.ts +29 -0
  57. package/src/client/css-modules.d.ts +5 -0
  58. package/src/client/desktop-env.ts +72 -0
  59. package/src/client/diff/DiffFiles.tsx +122 -0
  60. package/src/client/diff/DiffRows.tsx +271 -0
  61. package/src/client/diff/diff.module.css +86 -0
  62. package/src/client/diff/highlight.ts +383 -0
  63. package/src/client/diff/rows.ts +473 -0
  64. package/src/client/editor-load.ts +92 -0
  65. package/src/client/frame-batcher.ts +56 -0
  66. package/src/client/icons.tsx +175 -0
  67. package/src/client/image-types.ts +8 -0
  68. package/src/client/ime-guard.ts +47 -0
  69. package/src/client/index.tsx +425 -0
  70. package/src/client/intercept.tsx +172 -0
  71. package/src/client/lang.ts +225 -0
  72. package/src/client/layout-push.ts +37 -0
  73. package/src/client/layout.css +101 -0
  74. package/src/client/lazy-chunk.tsx +89 -0
  75. package/src/client/link-intercept.ts +73 -0
  76. package/src/client/locales-ar.ts +425 -0
  77. package/src/client/locales-de.ts +410 -0
  78. package/src/client/locales-fr.ts +417 -0
  79. package/src/client/locales-hi.ts +424 -0
  80. package/src/client/locales-id.ts +422 -0
  81. package/src/client/locales-it.ts +415 -0
  82. package/src/client/locales-ja.ts +424 -0
  83. package/src/client/locales-ko.ts +416 -0
  84. package/src/client/locales-nl.ts +422 -0
  85. package/src/client/locales-pl.ts +426 -0
  86. package/src/client/locales-pt.ts +407 -0
  87. package/src/client/locales-ru.ts +422 -0
  88. package/src/client/locales-sv.ts +407 -0
  89. package/src/client/locales-th.ts +424 -0
  90. package/src/client/locales-tr.ts +424 -0
  91. package/src/client/locales-vi.ts +424 -0
  92. package/src/client/locales-zh-HK.ts +439 -0
  93. package/src/client/locales-zh-MO.ts +439 -0
  94. package/src/client/locales-zh-TW.ts +439 -0
  95. package/src/client/locales.ts +1008 -0
  96. package/src/client/markdown-html.ts +331 -0
  97. package/src/client/markdown-images.ts +137 -0
  98. package/src/client/markdown-labels.tsx +31 -0
  99. package/src/client/md-toc.tsx +127 -0
  100. package/src/client/mermaid-blocks.ts +110 -0
  101. package/src/client/mermaid-sanitize.ts +93 -0
  102. package/src/client/mermaid.tsx +406 -0
  103. package/src/client/open-when-sized.ts +43 -0
  104. package/src/client/open-with-settings.tsx +135 -0
  105. package/src/client/open-with.ts +221 -0
  106. package/src/client/openpath-intercept.ts +79 -0
  107. package/src/client/paths.ts +72 -0
  108. package/src/client/pdf-types.ts +4 -0
  109. package/src/client/pinned.ts +184 -0
  110. package/src/client/plugin-settings.ts +43 -0
  111. package/src/client/plugins-shared.ts +29 -0
  112. package/src/client/plugins-tabs.ts +153 -0
  113. package/src/client/plugins-viewers.ts +44 -0
  114. package/src/client/prefs.ts +219 -0
  115. package/src/client/produced-files.ts +120 -0
  116. package/src/client/selection-payload.ts +86 -0
  117. package/src/client/service.ts +873 -0
  118. package/src/client/settings-nav-icon.ts +45 -0
  119. package/src/client/shell-presets.ts +83 -0
  120. package/src/client/sidebar.module.css +2538 -0
  121. package/src/client/sidechat-transcript.ts +488 -0
  122. package/src/client/split-pane.tsx +333 -0
  123. package/src/client/state.ts +1646 -0
  124. package/src/client/subagent-detect.ts +137 -0
  125. package/src/client/subagent-jobs.ts +161 -0
  126. package/src/client/tab-content-memo.ts +55 -0
  127. package/src/client/terminal-font.ts +224 -0
  128. package/src/client/terminal-links.ts +194 -0
  129. package/src/client/theme.ts +110 -0
  130. package/src/client/titlebar-strip.ts +37 -0
  131. package/src/client/upload.ts +187 -0
  132. package/src/client/wco.ts +120 -0
  133. package/src/config.ts +157 -0
  134. package/src/context-types.ts +572 -0
  135. package/src/fs-operations.ts +97 -0
  136. package/src/fs-search.ts +113 -0
  137. package/src/fs-tree.ts +158 -0
  138. package/src/git.ts +446 -0
  139. package/src/html-route.ts +106 -0
  140. package/src/index.ts +1346 -0
  141. package/src/invariant.ts +32 -0
  142. package/src/jobs-routes.ts +257 -0
  143. package/src/open-external.ts +89 -0
  144. package/src/path-security.ts +81 -0
  145. package/src/prefs-shared.ts +312 -0
  146. package/src/pty-deps.ts +240 -0
  147. package/src/pty-manager.ts +376 -0
  148. package/src/sidechat-core.ts +473 -0
  149. package/src/sidechat-routes.ts +400 -0
  150. package/src/subagent-activity.ts +91 -0
  151. package/src/subagent-live-route.ts +93 -0
  152. package/src/tools.ts +482 -0
  153. package/src/trust-fence.ts +84 -0
  154. package/src/wire.ts +100 -0
  155. package/xrk.plugin.json +15 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xrkseek
4
+ Copyright (c) 2026 dsh-external
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # xrkh-better-sidebar
2
+
3
+ > **读者**:XRK-Harness 终端用户 · 集成者
4
+
5
+ XRK-Harness(`xrkh`)标准侧边栏插件:资源管理器 · 编辑器 · 终端 · Git · 浏览器等工作台,按会话隔离。
6
+ Host 侧 `/sidebar/*` 由产品内置兼容器接线;本包提供 **client 半包**(及可选进程清单)。
7
+
8
+ ## 安装
9
+
10
+ 前置:`xrkh web` 或 `npx @xrkseek/harness-cli web`,Node ≥ 26。
11
+
12
+ ```bash
13
+ xrkh plugin add xrkh-better-sidebar@latest
14
+ xrkh restart
15
+ ```
16
+
17
+ 从源码(SSH):
18
+
19
+ ```bash
20
+ git clone git@github.com:xrkseek/xrkh-better-sidebar.git
21
+ xrkh plugin add ./xrkh-better-sidebar
22
+ xrkh restart
23
+ ```
24
+
25
+ 装完硬刷新浏览器(Ctrl+Shift+R)。
26
+
27
+ ## 契约
28
+
29
+ | 项 | 说明 |
30
+ |----|------|
31
+ | npm | `xrkh-better-sidebar` |
32
+ | 仓库 | `xrkseek/xrkh-better-sidebar` |
33
+ | 清单 | `xrk.client`(`package.json`)· `xrk.plugin.json` |
34
+ | 注入 | `@xrkseek/client-runtime` · `client-locale` · `client-ui-slots` · `client-ui-conversation` · `client-modules` |
35
+ | Host | 产品 `dsh-compat` 提供 `/sidebar/api` · `/sidebar/bundle` · PTY 等 |
36
+
37
+ ## 开发
38
+
39
+ ```bash
40
+ pnpm install
41
+ pnpm bundle
42
+ ```
package/README_EN.md ADDED
@@ -0,0 +1,42 @@
1
+ # xrkh-better-sidebar
2
+
3
+ > **Audience**: XRK-Harness end users · integrators
4
+
5
+ Standard sidebar plugin for XRK-Harness (`xrkh`): explorer · editor · terminal · git · browser, isolated per session.
6
+ Host serves `/sidebar/*` via the product adapter; this package ships the **client** half (and optional process manifest).
7
+
8
+ ## Install
9
+
10
+ Requires `xrkh web` or `npx @xrkseek/harness-cli web`, Node ≥ 26.
11
+
12
+ ```bash
13
+ xrkh plugin add xrkh-better-sidebar@latest
14
+ xrkh restart
15
+ ```
16
+
17
+ From source (SSH):
18
+
19
+ ```bash
20
+ git clone git@github.com:xrkseek/xrkh-better-sidebar.git
21
+ xrkh plugin add ./xrkh-better-sidebar
22
+ xrkh restart
23
+ ```
24
+
25
+ Hard-refresh the browser after install (Ctrl+Shift+R).
26
+
27
+ ## Contract
28
+
29
+ | Item | Notes |
30
+ |------|--------|
31
+ | npm | `xrkh-better-sidebar` |
32
+ | Repo | `xrkseek/xrkh-better-sidebar` |
33
+ | Manifest | `xrk.client` · `xrk.plugin.json` |
34
+ | Inject | `@xrkseek/client-*` (runtime, locale, slots, conversation, modules) |
35
+ | Host | Product adapter: `/sidebar/api` · `/sidebar/bundle` · PTY |
36
+
37
+ ## Develop
38
+
39
+ ```bash
40
+ pnpm install
41
+ pnpm bundle
42
+ ```
@@ -0,0 +1,49 @@
1
+ # dsh-better-sidebar bundle patch
2
+ #
3
+ # This file is the `dsh.bundle.patch` layer of the published npm package: when
4
+ # the plugin is installed through the official CLI —
5
+ #
6
+ # dsh plugin --profile <name> add dsh-better-sidebar@<version>
7
+ #
8
+ # — the command reconciles `dsh.profile.bundles` against installed packages
9
+ # and, seeing this declaration, appends `dsh-better-sidebar` to the bundle
10
+ # stack. The profile boot then merges THIS patch (a single `insert` of the
11
+ # plugin row) exactly like the manual cordis.patch.yml mount line used
12
+ # before. No profile file edits needed — one command installs and mounts.
13
+ #
14
+ # If the profile still carries the old manual mount line in its own
15
+ # cordis.patch.yml, remove it before switching to the bundle channel to
16
+ # avoid double-mounting (two Node halves, two sidebars).
17
+ #
18
+ # To choose the terminal shell, add `config.shell` to the inserted plugin
19
+ # row (or to the profile's manual cordis.patch.yml mount line). When omitted,
20
+ # the host keeps resolving $SHELL / the login shell / powershell.exe.
21
+ # `config.shellArgs` optionally supplies explicit startup arguments; when
22
+ # non-empty they replace the automatic POSIX `-l` login flag:
23
+ #
24
+ # - insert:
25
+ # - id: better-sidebar
26
+ # name: 'dsh-better-sidebar'
27
+ # config:
28
+ # shell: /bin/zsh
29
+ # shellArgs:
30
+ # - --noprofile
31
+ # - --no-rc
32
+ #
33
+ # Aggregate double-mount guard: aggregate bundles (e.g. @linxin666/dsh-web-ui-all)
34
+ # may already mount this package under their own entry id (e.g.
35
+ # `web-ui-better-sidebar`). Two mounts register /sidebar/api twice and fail the
36
+ # whole plugin tree at boot ("duplicate prefix route"). The `!!js` disabled
37
+ # expression backs THIS row off when another *enabled* entry already mounts
38
+ # `dsh-better-sidebar`; the aggregate instance then owns the sidebar. The
39
+ # loader evaluates it when this row is processed (entry-list order, only rows
40
+ # before this one are visible), so the aggregate bundle must precede this one
41
+ # in `dsh.profile.bundles` — the standard install order, since `dsh plugin add`
42
+ # appends new bundles last. The reverse order (this bundle before the
43
+ # aggregate) is a known limitation: the guard cannot see rows that come after
44
+ # it, and no runtime singleton guard is added. Same-id manual duplicates still
45
+ # fail loudly at the loader as before.
46
+ - insert:
47
+ - id: better-sidebar
48
+ name: 'dsh-better-sidebar'
49
+ disabled: !!js "[...ctx.loader.entries()].some((e) => e.options.name === 'dsh-better-sidebar' && e.options.id !== 'better-sidebar' && !e.disabled)"
package/package.json ADDED
@@ -0,0 +1,182 @@
1
+ {
2
+ "name": "xrkh-better-sidebar",
3
+ "version": "0.17.1",
4
+ "description": "XRK-Harness (xrkh) standard sidebar plugin: explorer, editor, terminal, git, browser.",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+ssh://git@github.com/xrkseek/xrkh-better-sidebar.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "main": "lib/index.js",
14
+ "types": "lib/types/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./lib/types/index.d.ts",
18
+ "default": "./lib/index.js"
19
+ },
20
+ "./invariant": {
21
+ "types": "./lib/types/invariant.d.ts",
22
+ "default": "./lib/invariant.js"
23
+ },
24
+ "./client": {
25
+ "types": "./lib/types/client/index.d.ts",
26
+ "default": "./lib/client.js"
27
+ },
28
+ "./client/service": {
29
+ "types": "./lib/types/client/service.d.ts",
30
+ "default": "./lib/client.js"
31
+ },
32
+ "./client/api": {
33
+ "types": "./lib/types/client/service.d.ts",
34
+ "default": "./lib/client.js"
35
+ },
36
+ "./src/*": "./src/*",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "engines": {
40
+ "node": ">=26"
41
+ },
42
+ "files": [
43
+ "lib/index.js",
44
+ "lib/invariant.js",
45
+ "lib/client.js",
46
+ "lib/client-registry.js",
47
+ "lib/client-terminal.js",
48
+ "lib/client-editor.js",
49
+ "lib/client-mermaid.js",
50
+ "lib/types/**/*.d.ts",
51
+ "src",
52
+ "scripts/install.sh",
53
+ "scripts/install.ps1",
54
+ "cordis.patch.yml",
55
+ "README.md",
56
+ "README_EN.md",
57
+ "LICENSE",
58
+ "scripts/install-xrkh.ps1",
59
+ "scripts/install-xrkh.sh",
60
+ "xrk.plugin.json"
61
+ ],
62
+ "scripts": {
63
+ "build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown",
64
+ "typecheck": "tsc --noEmit",
65
+ "bundle": "tsdown",
66
+ "watch": "tsdown --watch",
67
+ "test": "vitest run",
68
+ "test:mount": "bash scripts/e2e-mount.sh",
69
+ "check:consumer-types": "bash scripts/check-consumer-types.sh"
70
+ },
71
+ "license": "MIT",
72
+ "peerDependencies": {
73
+ "@xrkseek/cordis": "*",
74
+ "@xrkseek/client-locale": "*",
75
+ "@xrkseek/client-ui-conversation": "*",
76
+ "@xrkseek/client-ui-primitives": "*",
77
+ "@xrkseek/client-ui-settings": "^0.1.2-alpha.3",
78
+ "@xrkseek/client-ui-slots": "*",
79
+ "@xrkseek/xrk-invariants": "*",
80
+ "@huanlin/dsh-plugin-better-locale": "^0.1.0",
81
+ "react": "^18.2.0",
82
+ "react-dom": "^18.2.0"
83
+ },
84
+ "peerDependenciesMeta": {
85
+ "@huanlin/dsh-plugin-better-locale": {
86
+ "optional": true
87
+ }
88
+ },
89
+ "dependencies": {
90
+ "@codemirror/commands": "^6.10.4",
91
+ "@codemirror/lang-cpp": "^6.0.3",
92
+ "@codemirror/lang-css": "^6.3.1",
93
+ "@codemirror/lang-go": "^6.0.1",
94
+ "@codemirror/lang-html": "^6.4.12",
95
+ "@codemirror/lang-java": "^6.0.2",
96
+ "@codemirror/lang-javascript": "^6.2.5",
97
+ "@codemirror/lang-json": "^6.0.2",
98
+ "@codemirror/lang-markdown": "^6.5.2",
99
+ "@codemirror/lang-php": "^6.0.2",
100
+ "@codemirror/lang-python": "^6.2.1",
101
+ "@codemirror/lang-rust": "^6.0.2",
102
+ "@codemirror/lang-sql": "^6.10.0",
103
+ "@codemirror/lang-vue": "^0.1.3",
104
+ "@codemirror/lang-xml": "^6.1.0",
105
+ "@codemirror/lang-yaml": "^6.1.3",
106
+ "@codemirror/language": "^6.12.4",
107
+ "@codemirror/legacy-modes": "^6.5.3",
108
+ "@codemirror/search": "^6.7.1",
109
+ "@codemirror/state": "^6.7.1",
110
+ "@codemirror/view": "^6.43.8",
111
+ "@lezer/highlight": "^1.2.3",
112
+ "clsx": "^2.1.1",
113
+ "dompurify": "^3.4.14",
114
+ "mermaid": "^11.16.1",
115
+ "node-pty": "^1.1.0",
116
+ "react-icons": "5.7.0",
117
+ "rxjs": "^7.8.2",
118
+ "schemastery": "^3.18.0",
119
+ "ws": "^8.18.0"
120
+ },
121
+ "devDependencies": {
122
+ "@cordisjs/plugin-loader": "^1.0.0-rc.5",
123
+ "@deepseek-ai/dsh-attachment": "0.1.2-alpha.3",
124
+ "@xrkseek/client-locale": "0.1.2-alpha.3",
125
+ "@xrkseek/client-ui-conversation": "0.1.2-alpha.3",
126
+ "@xrkseek/client-ui-primitives": "0.1.2-alpha.3",
127
+ "@xrkseek/client-ui-settings": "0.1.2-alpha.3",
128
+ "@xrkseek/client-ui-slots": "0.1.2-alpha.3",
129
+ "@deepseek-ai/dsh-code-runtime": "0.1.2-alpha.3",
130
+ "@xrkseek/xrk-invariants": "0.1.2-alpha.3",
131
+ "@deepseek-ai/dsh-scope": "0.1.2-alpha.3",
132
+ "@deepseek-ai/dsh-session-projection": "0.1.2-alpha.3",
133
+ "@deepseek-ai/dsh-system-prompt": "0.1.2-alpha.3",
134
+ "@deepseek-ai/dsh-user-approval": "0.1.2-alpha.3",
135
+ "@deepseek-ai/dsh-util-time": "0.1.2-alpha.3",
136
+ "@huanlin/dsh-plugin-better-locale": "^0.1.0",
137
+ "@playwright/test": "^1.62.1",
138
+ "@types/node": "^24.0.0",
139
+ "@types/react": "~18.3.1",
140
+ "@types/react-dom": "~18.3.1",
141
+ "@types/ws": "^8.5.10",
142
+ "@xterm/addon-fit": "^0.11.0",
143
+ "@xterm/xterm": "^5.5.0",
144
+ "cordis": "^4.0.0-rc.8",
145
+ "jsdom": "^29.1.1",
146
+ "lightningcss": "^1.32.0",
147
+ "react": "^18.2.0",
148
+ "react-dom": "18.2.0",
149
+ "tsdown": "^0.22.2",
150
+ "typescript": "^5.6.0",
151
+ "unrun": "^0.2.39",
152
+ "vitest": "^4.1.8"
153
+ },
154
+ "xrk": {
155
+ "client": {
156
+ "inject": [
157
+ "@xrkseek/client-runtime",
158
+ "@xrkseek/client-locale",
159
+ "@xrkseek/client-ui-slots",
160
+ "@xrkseek/client-ui-conversation",
161
+ "@xrkseek/client-modules"
162
+ ],
163
+ "platform": "web"
164
+ }
165
+ },
166
+ "dsh": {
167
+ "client": {
168
+ "inject": [
169
+ "@deepseek-ai/dsh-client-runtime",
170
+ "@deepseek-ai/dsh-client-locale",
171
+ "@deepseek-ai/dsh-client-ui-slots",
172
+ "@deepseek-ai/dsh-client-ui-conversation",
173
+ "@deepseek-ai/dsh-client-modules"
174
+ ],
175
+ "platform": "web"
176
+ }
177
+ },
178
+ "bugs": {
179
+ "url": "https://github.com/xrkseek/xrkh-better-sidebar/issues"
180
+ },
181
+ "homepage": "https://github.com/xrkseek/xrkh-better-sidebar#readme"
182
+ }
@@ -0,0 +1,15 @@
1
+ # One-shot install for XRK-Harness (Windows).
2
+ param(
3
+ [string]$Version = "latest",
4
+ [switch]$Restart
5
+ )
6
+ $ErrorActionPreference = "Stop"
7
+ $pkg = if ($Version -and $Version -ne "latest") { "xrkh-better-sidebar@$Version" } else { "xrkh-better-sidebar@latest" }
8
+ if (Get-Command xrkh -ErrorAction SilentlyContinue) {
9
+ & xrkh plugin add $pkg
10
+ if ($Restart) { & xrkh restart }
11
+ } else {
12
+ & npx -y @xrkseek/harness-cli plugin add $pkg
13
+ if ($Restart) { & npx -y @xrkseek/harness-cli restart }
14
+ }
15
+ Write-Host "Done. Hard-refresh the browser (Ctrl+Shift+R)."
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ VERSION="${1:-latest}"
4
+ PKG="xrkh-better-sidebar@${VERSION}"
5
+ if command -v xrkh >/dev/null 2>&1; then
6
+ xrkh plugin add "$PKG"
7
+ xrkh restart
8
+ else
9
+ npx -y @xrkseek/harness-cli plugin add "$PKG"
10
+ npx -y @xrkseek/harness-cli restart
11
+ fi
12
+ echo "Done. Hard-refresh the browser."
@@ -0,0 +1,306 @@
1
+ ## =============================================================================
2
+ # dsh-better-sidebar 一键安装脚本(官方 CLI 方式,Windows PowerShell 5.1+ / pwsh)
3
+ #
4
+ # 通过 DSH 官方插件命令安装 npm 包并自动挂载:
5
+ # dsh plugin --profile web add dsh-better-sidebar@<version>
6
+ #
7
+ # 包内声明了 dsh.bundle.patch(cordis.patch.yml):CLI 的 bundle 协调会把它
8
+ # 自动加进 profile 的 dsh.profile.bundles,下次启动即挂载——无需手动写
9
+ # cordis.patch.yml 挂载行。符合仓库硬约束:不修改 DSH 源码,插件永远作为
10
+ # 独立包被 profile 引用。
11
+ #
12
+ # 用法(任选其一):
13
+ # # 默认最新版
14
+ # $script = (irm 'https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1').TrimStart([char]0xFEFF)
15
+ # & ([scriptblock]::Create($script))
16
+ # # 指定版本 / 装完重启
17
+ # $script = (irm 'https://raw.githubusercontent.com/omdsh-dev/DSH-better-sidebar/main/scripts/install.ps1').TrimStart([char]0xFEFF)
18
+ # & ([scriptblock]::Create($script)) -Version 0.10.2 -Restart
19
+ # # 本地保存后运行
20
+ # powershell -ExecutionPolicy Bypass -File install.ps1 -Version 0.10.2 -DryRun
21
+ # # 修复 node-pty 依赖(终端提示「node-pty 加载失败」时用,见 issue #140)
22
+ # powershell -ExecutionPolicy Bypass -File install.ps1 -Repair
23
+ #
24
+ # 参数:
25
+ # -Version npm 版本号/范围,缺省 latest(自动解析为最新)。
26
+ # -Repair 修复模式:不重装插件,只确保 profile 的 pnpm-workspace.yaml
27
+ # 放行 node-pty 构建脚本,然后重跑 pnpm install + pnpm rebuild
28
+ # node-pty。
29
+ # -Profile 目标 profile 名(缺省 web);安装与修复模式均适用。
30
+ # -Restart 装完后尝试 `pm2 restart dsh-web`(无 pm2 时仅提示)。会断开当前页面会话。
31
+ # -DryRun 只打印将要执行的操作,不写任何文件。
32
+ #
33
+ # 环境变量(均可省略):
34
+ # DSH_HOME 默认 %USERPROFILE%\.dsh
35
+ # REGISTRY 默认 https://registry.npmjs.org
36
+ # DSH_CMD 默认优先 PATH 上的 dsh,缺省回退 npx -y --package @deepseek-ai/dsh
37
+ #
38
+ # 说明:
39
+ # - pnpm 11 的 strict-dep-builds 会拦截 node-pty/protobufjs 的构建脚本并使
40
+ # `dsh plugin add` 非零退出。脚本会先把这两个构建许可写进 profile 的
41
+ # pnpm-workspace.yaml(幂等),保证 CLI 一步成功。
42
+ # - pnpm 11 的 minimumReleaseAge 会拒绝发布 <24h 的新版本。脚本会预写
43
+ # minimumReleaseAgeExclude(幂等),放行本插件,避免"重跑一次才成功"。
44
+ # - 老版本(<0.10.2)用手动挂载行,bundle 通道激活后需移除,否则双挂载。
45
+ # 脚本会幂等移除 better-sidebar 挂载行。
46
+ # =============================================================================
47
+ param(
48
+ [string]$Version = '',
49
+ [switch]$Restart,
50
+ [switch]$DryRun,
51
+ [switch]$Repair,
52
+ [string]$Profile = 'web'
53
+ )
54
+
55
+ $PKG = 'dsh-better-sidebar'
56
+ $REGISTRY = if ($env:REGISTRY) { $env:REGISTRY } else { 'https://registry.npmjs.org' }
57
+
58
+ # DSH_HOME:DSH_HOME 环境变量 > %USERPROFILE% > $HOME
59
+ if ($env:DSH_HOME) {
60
+ $DSH_HOME = $env:DSH_HOME
61
+ } elseif ($env:USERPROFILE) {
62
+ $DSH_HOME = Join-Path $env:USERPROFILE '.dsh'
63
+ } else {
64
+ $DSH_HOME = Join-Path $HOME '.dsh'
65
+ }
66
+ $PROFILE_DIR = Join-Path $DSH_HOME "profiles\$Profile"
67
+ $WS_YML = Join-Path $PROFILE_DIR 'pnpm-workspace.yaml'
68
+ $PATCH_YML = Join-Path $PROFILE_DIR 'cordis.patch.yml'
69
+
70
+ function Say([string]$m) { Write-Host "[install] $m" -ForegroundColor Green }
71
+ function Warn([string]$m) { Write-Host "[warn] $m" -ForegroundColor Yellow }
72
+ function Die([string]$m) { Write-Host "[error] $m" -ForegroundColor Red; exit 1 }
73
+
74
+ # 解析版本 -> npm spec("x.y.z" / "^x.y.z" / latest)
75
+ function Resolve-Spec {
76
+ param([string]$Given)
77
+ if ([string]::IsNullOrWhiteSpace($Given) -or $Given -eq 'latest') {
78
+ $v = $null
79
+ foreach ($tool in @('npm', 'pnpm')) {
80
+ if (Get-Command $tool -ErrorAction SilentlyContinue) {
81
+ $v = (& $tool view $PKG version "--registry=$REGISTRY" 2>$null | Select-Object -Last 1)
82
+ if ($v) { break }
83
+ }
84
+ }
85
+ if ($v) { return ([string]$v).Trim() }
86
+ Warn '无法联网解析最新版本(npm/pnpm 查询失败),回退为 latest,由 pnpm 直接解析。'
87
+ Warn '若已知版本号,可显式传入:-Version 0.10.2'
88
+ return 'latest'
89
+ }
90
+ return $Given
91
+ }
92
+
93
+ # 组装 dsh CLI:优先 PATH 上的 dsh,缺省 npx 拉官方包
94
+ function Get-DshCli {
95
+ if ($env:DSH_CMD) { return $env:DSH_CMD }
96
+ if (Get-Command dsh -ErrorAction SilentlyContinue) { return 'dsh' }
97
+ if (Get-Command npx -ErrorAction SilentlyContinue) { return 'npx' }
98
+ return $null
99
+ }
100
+
101
+ # 步骤 1(安装与修复共用):预写 workspace 设置(幂等),保证 pnpm 不拦截
102
+ # node-pty/protobufjs 构建脚本、放行本插件新版本
103
+ function Ensure-WorkspaceSettings {
104
+ $wsScript = @'
105
+ const fs = require("fs");
106
+ const p = process.argv[2];
107
+ let t = fs.readFileSync(p, "utf8");
108
+ const before = t;
109
+ t = t.replace(/^(\s*)(node-pty|protobufjs):.*$/gm, "$1$2: true");
110
+ if (!/^\s*allowBuilds:\s*$/m.test(t)) {
111
+ t += "\nallowBuilds:\n node-pty: true\n protobufjs: true\n";
112
+ } else {
113
+ for (const k of ["node-pty", "protobufjs"]) {
114
+ if (!new RegExp("^\\s*" + k + ":\\s*true\\s*$", "m").test(t)) {
115
+ t = t.replace(/^(\s*allowBuilds:\s*)$/m, "$1\n " + k + ": true");
116
+ }
117
+ }
118
+ }
119
+ if (!/^\s*-\s+dsh-better-sidebar\s*$/m.test(t)) {
120
+ if (/^\s*minimumReleaseAgeExclude:\s*$/m.test(t)) {
121
+ t = t.replace(/^(\s*minimumReleaseAgeExclude:\s*)$/m, "$1\n - dsh-better-sidebar");
122
+ } else {
123
+ t += "\nminimumReleaseAgeExclude:\n - dsh-better-sidebar\n";
124
+ }
125
+ }
126
+ if (t !== before) fs.writeFileSync(p, t);
127
+ console.log(t === before ? "unchanged" : "updated");
128
+ '@
129
+ # PowerShell 5.1 把含内嵌双引号的多行 JS 作为参数传给 `node -e` 时,引号会被
130
+ # Windows 命令行解析吞掉,导致 JS 语法错误(Expected ',', got ':')。
131
+ # 改用临时文件方式,兼容 PS 5.1 与 pwsh 7。
132
+ $wsJs = Join-Path $env:TEMP ("dshbs-ws-" + [guid]::NewGuid().ToString("N") + ".js")
133
+ Set-Content -LiteralPath $wsJs -Value $wsScript -Encoding UTF8
134
+ $wsOut = node $wsJs "$WS_YML" 2>&1
135
+ $wsCode = $LASTEXITCODE
136
+ Remove-Item -LiteralPath $wsJs -Force -ErrorAction SilentlyContinue
137
+ $wsResult = (($wsOut | Out-String)).Trim()
138
+ if ($wsCode -ne 0) { Die "处理 $WS_YML 失败(node 退出码 $wsCode):$wsResult" }
139
+ if ($wsResult -eq 'updated') {
140
+ Say "已确保 $WS_YML:allowBuilds(node-pty/protobufjs: true)+ minimumReleaseAgeExclude($PKG)"
141
+ } else {
142
+ Say 'workspace 设置已就绪,跳过'
143
+ }
144
+ }
145
+
146
+ # 前置校验
147
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
148
+ Die '未找到 node(DSH 运行需要 Node.js >= 20),请先安装 Node.js 并加入 PATH。'
149
+ }
150
+ if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) {
151
+ Die '未找到 pnpm;安装脚本需要 pnpm >= 10。请先安装或升级 pnpm 并加入 PATH。'
152
+ }
153
+ $pnpmVersion = (& pnpm --version 2>$null | Select-Object -Last 1)
154
+ if ($LASTEXITCODE -ne 0 -or -not $pnpmVersion) {
155
+ Die '无法读取 pnpm 版本;安装脚本需要 pnpm >= 10。'
156
+ }
157
+ $pnpmVersionText = ([string]$pnpmVersion).Trim()
158
+ $pnpmMajor = 0
159
+ if (-not [int]::TryParse(($pnpmVersionText -split '\.')[0], [ref]$pnpmMajor)) {
160
+ Die "无法解析 pnpm 版本(输出:$pnpmVersionText);安装脚本需要 pnpm >= 10。"
161
+ }
162
+ if ($pnpmMajor -lt 10) {
163
+ Die "安装脚本需要 pnpm >= 10;当前版本为 $pnpmVersionText。请升级 pnpm 后重试。"
164
+ }
165
+ if (-not (Test-Path $PROFILE_DIR)) {
166
+ Die "找不到 profile 目录:$PROFILE_DIR(请先安装并运行过一次 dsh web)"
167
+ }
168
+ if (-not (Test-Path $WS_YML)) {
169
+ Die "找不到 $WS_YML(请先初始化 $Profile profile)"
170
+ }
171
+
172
+ # ── 修复模式(issue #140):不重装插件,只修复 node-pty 依赖 ────────────
173
+ # 终端提示「node-pty 加载失败」时运行:确保 allowBuilds 后重跑
174
+ # pnpm install + pnpm rebuild node-pty(重放被 pnpm 11 拦截的构建脚本)。
175
+ if ($Repair) {
176
+ if ($DryRun) {
177
+ Say "[dry-run] 修复:确保 $WS_YML 含 allowBuilds(node-pty: true)"
178
+ Say "[dry-run] 修复:cd $PROFILE_DIR; pnpm install; pnpm rebuild node-pty"
179
+ exit 0
180
+ }
181
+ Say "修复模式:重装 node-pty(profile: $Profile,$PROFILE_DIR)..."
182
+ Ensure-WorkspaceSettings
183
+ Push-Location $PROFILE_DIR
184
+ try {
185
+ pnpm install
186
+ if ($LASTEXITCODE -ne 0) { Die "pnpm install 失败(退出码 $LASTEXITCODE)。请确认 pnpm 在 PATH 上、网络可用,然后重试。" }
187
+ pnpm rebuild node-pty
188
+ if ($LASTEXITCODE -ne 0) { Die "pnpm rebuild node-pty 失败(退出码 $LASTEXITCODE)。请确认 pnpm 在 PATH 上,然后重试。" }
189
+ } finally {
190
+ Pop-Location
191
+ }
192
+ Say '修复完成:node-pty 已重装(与 DSH 核心保持同一版本)。请重启 DSH 后重试终端。'
193
+ exit 0
194
+ }
195
+
196
+ $SPEC = Resolve-Spec $Version
197
+ $CLI = Get-DshCli
198
+ if (-not $CLI) {
199
+ Die '未找到 dsh 或 npx。请先安装 DSH(并确保 Node/npm 可用),或用 DSH_CMD 指定。'
200
+ }
201
+ Say "目标:$CLI plugin --profile $Profile add $PKG@$SPEC(profile: $PROFILE_DIR)"
202
+
203
+ if ($DryRun) {
204
+ Say "[dry-run] 步骤 1:确保 $WS_YML 含 allowBuilds(node-pty/protobufjs: true)与 minimumReleaseAgeExclude($PKG)"
205
+ Say "[dry-run] 步骤 2:执行 $CLI plugin --profile $Profile add $PKG@$SPEC(安装 + bundle 自动注册)"
206
+ Say "[dry-run] 步骤 3:校验 dsh.profile.bundles 含 $PKG"
207
+ Say "[dry-run] 步骤 4:幂等移除 $PATCH_YML 里旧的 better-sidebar 手动挂载行(避免双挂载)"
208
+ if ($Restart) { Say '[dry-run] 步骤 5:pm2 restart dsh-web' } else { Say '[dry-run] 步骤 5:提示用户手动重启 DSH' }
209
+ exit 0
210
+ }
211
+
212
+ # 步骤 1:预写 workspace 设置(幂等),保证 pnpm 不拦截构建、放行本插件新版本
213
+ Ensure-WorkspaceSettings
214
+
215
+ # 步骤 2:官方 CLI 安装 + bundle 自动注册(含挂载)
216
+ if ($CLI -eq 'dsh') {
217
+ $cliArgs = @('plugin', '--profile', $Profile, 'add', "$PKG@$SPEC")
218
+ } else {
219
+ $cliArgs = @('-y', '--package', '@deepseek-ai/dsh', 'dsh', 'plugin', '--profile', $Profile, 'add', "$PKG@$SPEC")
220
+ }
221
+ Say "执行 $CLI plugin --profile $Profile add $PKG@$SPEC ..."
222
+ $addOut = & $CLI @cliArgs 2>&1
223
+ $addCode = $LASTEXITCODE
224
+ $addOut | ForEach-Object { $_ }
225
+ if ($addCode -ne 0) {
226
+ Warn 'dsh plugin add 失败。已预写 allowBuilds 与 minimumReleaseAgeExclude,仍失败的可能原因:'
227
+ Warn ' - 网络/登录问题:npm registry 不可达或需要登录。'
228
+ Warn " - 依赖安装冲突:可手动重试 cd $PROFILE_DIR; pnpm install。"
229
+ exit 1
230
+ }
231
+
232
+ # 步骤 3:校验 bundle 已注册(挂载生效的判据)
233
+ $pkgJson = Get-Content -Raw (Join-Path $PROFILE_DIR 'package.json') | ConvertFrom-Json
234
+ $bundles = $pkgJson.dsh.profile.bundles
235
+ if ($bundles -notcontains $PKG) {
236
+ Warn 'dsh-better-sidebar 未出现在 dsh.profile.bundles 中——挂载未注册。'
237
+ Warn "若上面的 pnpm 输出提示 ignored build scripts,请确认 $WS_YML 的 allowBuilds 后重跑本脚本。"
238
+ exit 1
239
+ }
240
+ Say "bundle 已注册:dsh.profile.bundles 包含 $PKG(下次启动自动挂载)"
241
+
242
+ # 步骤 4:幂等移除旧的 manual 挂载行(避免与 bundle 双挂载)
243
+ $mountScript = @'
244
+ const fs = require("fs");
245
+ const p = process.argv[2];
246
+ const lines = fs.readFileSync(p, "utf8").split("\n");
247
+ const out = [];
248
+ let i = 0;
249
+ let removed = false;
250
+ while (i < lines.length) {
251
+ const line = lines[i];
252
+ if (/^[ \t]*- insert:\s*$/.test(line)) {
253
+ const block = [line];
254
+ let j = i + 1;
255
+ while (j < lines.length && lines[j].trim() !== "" && !/^-\s/.test(lines[j])) {
256
+ block.push(lines[j]);
257
+ j++;
258
+ }
259
+ if (block.some((l) => /id:\s*better-sidebar\b/.test(l))) {
260
+ while (out.length && /^[ \t]*#/.test(out[out.length - 1])) out.pop();
261
+ i = j;
262
+ removed = true;
263
+ continue;
264
+ }
265
+ }
266
+ out.push(line);
267
+ i++;
268
+ }
269
+ if (!removed) {
270
+ console.log("none");
271
+ } else {
272
+ const t = out.join("\n").replace(/\n{3,}/g, "\n\n");
273
+ fs.writeFileSync(p, t);
274
+ console.log("removed");
275
+ }
276
+ '@
277
+ $mountJs = Join-Path $env:TEMP ("dshbs-mount-" + [guid]::NewGuid().ToString("N") + ".js")
278
+ Set-Content -LiteralPath $mountJs -Value $mountScript -Encoding UTF8
279
+ $mountOut = node $mountJs "$PATCH_YML" 2>&1
280
+ $mountCode = $LASTEXITCODE
281
+ Remove-Item -LiteralPath $mountJs -Force -ErrorAction SilentlyContinue
282
+ $mountResult = (($mountOut | Out-String)).Trim()
283
+ if ($mountCode -ne 0) { Die "处理 $PATCH_YML 失败(node 退出码 $mountCode):$mountResult" }
284
+ if ($mountResult -eq 'removed') {
285
+ Say "已从 $PATCH_YML 移除旧的 better-sidebar 手动挂载行(bundle 通道接管挂载)"
286
+ } else {
287
+ Say '无旧手动挂载行,跳过'
288
+ }
289
+
290
+ Say "安装完成:$PKG@$SPEC"
291
+
292
+ # 步骤 5:重启提示
293
+ if ($Restart) {
294
+ if (Get-Command pm2 -ErrorAction SilentlyContinue) {
295
+ Say '重启 dsh-web(pm2)...'
296
+ pm2 restart dsh-web
297
+ if ($LASTEXITCODE -ne 0) { Warn 'pm2 restart 失败,请手动重启 DSH' }
298
+ } else {
299
+ Warn '未找到 pm2,请手动重启 DSH(如:pm2 restart dsh-web 或 dsh web)'
300
+ }
301
+ } else {
302
+ Say '下一步:重启 DSH 并硬刷新(Ctrl+Shift+R / Cmd+Shift+R)使新副本生效。'
303
+ if (Get-Command pm2 -ErrorAction SilentlyContinue) {
304
+ Say '本机可用:pm2 restart dsh-web(会短暂断开当前页面会话)'
305
+ }
306
+ }