dsh-x-core 0.1.21 → 0.1.23

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 (50) hide show
  1. package/assets/dsh-preview.png +0 -0
  2. package/assets/dsh.ico +0 -0
  3. package/assets/icon.ico +0 -0
  4. package/assets/tray.ico +0 -0
  5. package/assets/tray.png +0 -0
  6. package/core-npm.js +201 -183
  7. package/desktop-plugins.js +86 -0
  8. package/desktop.js +200 -0
  9. package/filemanager-base.js +7 -8
  10. package/filemanager-linux.js +124 -0
  11. package/filemanager.js +4 -7
  12. package/native-notify.js +74 -0
  13. package/node/node +2 -1
  14. package/package.json +1 -1
  15. package/packs/dsh-x-workbench/README.md +61 -0
  16. package/packs/dsh-x-workbench/dspack.json +4 -0
  17. package/packs/dsh-x-workbench/home/skills/agent-browser/LICENSE-APACHE-2.0.txt +202 -0
  18. package/packs/dsh-x-workbench/home/skills/agent-browser/NOTICE.md +6 -0
  19. package/packs/dsh-x-workbench/home/skills/agent-browser/SKILL.md +697 -0
  20. package/packs/dsh-x-workbench/home/skills/agent-browser/references/authentication.md +313 -0
  21. package/packs/dsh-x-workbench/home/skills/agent-browser/references/commands.md +300 -0
  22. package/packs/dsh-x-workbench/home/skills/agent-browser/references/profiling.md +120 -0
  23. package/packs/dsh-x-workbench/home/skills/agent-browser/references/proxy-support.md +194 -0
  24. package/packs/dsh-x-workbench/home/skills/agent-browser/references/session-management.md +201 -0
  25. package/packs/dsh-x-workbench/home/skills/agent-browser/references/snapshot-refs.md +229 -0
  26. package/packs/dsh-x-workbench/home/skills/agent-browser/references/video-recording.md +173 -0
  27. package/packs/dsh-x-workbench/home/skills/agent-browser/templates/authenticated-session.sh +105 -0
  28. package/packs/dsh-x-workbench/home/skills/agent-browser/templates/capture-workflow.sh +69 -0
  29. package/packs/dsh-x-workbench/home/skills/agent-browser/templates/form-automation.sh +62 -0
  30. package/packs/dsh-x-workbench/home/skills/electron/LICENSE-APACHE-2.0.txt +202 -0
  31. package/packs/dsh-x-workbench/home/skills/electron/NOTICE.md +6 -0
  32. package/packs/dsh-x-workbench/home/skills/electron/SKILL.md +243 -0
  33. package/packs/dsh-x-workbench/manifest.json +35 -0
  34. package/perf/patch-hooks.mjs +14 -1
  35. package/perf/plugin-profile.mjs +204 -0
  36. package/perf/register.mjs +4 -0
  37. package/platform.js +2 -1
  38. package/public/booting.html +475 -0
  39. package/public/favicon.ico +0 -0
  40. package/public/favicon.png +0 -0
  41. package/public/icon.png +0 -0
  42. package/public/index.html +9277 -8173
  43. package/public/internal-tabs.js +45 -41
  44. package/public/launcher.css +285 -98
  45. package/public/mascot.js +1 -1
  46. package/public/theme.css +33 -6
  47. package/public/water.js +1 -1
  48. package/registry.js +38 -3
  49. package/server.js +1060 -119
  50. package/settings.js +78 -1
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Z.AI Co., Ltd
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ # 出处与许可
2
+
3
+ - 上游:vercel-labs/agent-browser(`skills/electron/SKILL.md`),Copyright 2025 Vercel Inc.,Apache-2.0。
4
+ - 本副本取自 zai-org/ZCode 的 `.agents/skills/electron`(commit `3c5b227649371507ddc4eb46ac5133afe6db1cab`,Apache-2.0);ZCode 侧对内容做过本地集成、格式与适配调整。
5
+ - DSH-X 原样收录,未再修改;许可全文见同目录 `LICENSE-APACHE-2.0.txt`。
6
+ - 依赖 `agent-browser` CLI,并用 Chrome DevTools Protocol 连接 Electron 应用;启动时需带 `--remote-debugging-port`。
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: electron
3
+ description: Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.
4
+ allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
5
+ ---
6
+
7
+ <!--
8
+ Derived from vercel-labs/agent-browser (skills/electron/SKILL.md).
9
+ Copyright 2025 Vercel Inc. Licensed under Apache-2.0.
10
+ Modified by ZCode: local integration, formatting and adaptations.
11
+ See THIRD-PARTY-NOTICES.md in the repository root for license and provenance.
12
+ -->
13
+
14
+ # Electron App Automation
15
+
16
+ Automate any Electron desktop app using agent-browser. Electron apps are built on Chromium and expose a Chrome DevTools Protocol (CDP) port that agent-browser can connect to, enabling the same snapshot-interact workflow used for web pages.
17
+
18
+ ## Core Workflow
19
+
20
+ 1. **Launch** the Electron app with remote debugging enabled
21
+ 2. **Connect** agent-browser to the CDP port
22
+ 3. **Snapshot** to discover interactive elements
23
+ 4. **Interact** using element refs
24
+ 5. **Re-snapshot** after navigation or state changes
25
+
26
+ ```bash
27
+ # Launch an Electron app with remote debugging
28
+ open -a "Slack" --args --remote-debugging-port=9222
29
+
30
+ # Connect agent-browser to the app
31
+ agent-browser connect 9222
32
+
33
+ # Standard workflow from here
34
+ agent-browser snapshot -i
35
+ agent-browser click @e5
36
+ agent-browser screenshot slack-desktop.png
37
+ ```
38
+
39
+ ## Launching Electron Apps with CDP
40
+
41
+ Every Electron app supports the `--remote-debugging-port` flag since it's built into Chromium.
42
+
43
+ ### macOS
44
+
45
+ ```bash
46
+ # Slack
47
+ open -a "Slack" --args --remote-debugging-port=9222
48
+
49
+ # VS Code
50
+ open -a "Visual Studio Code" --args --remote-debugging-port=9223
51
+
52
+ # Discord
53
+ open -a "Discord" --args --remote-debugging-port=9224
54
+
55
+ # Figma
56
+ open -a "Figma" --args --remote-debugging-port=9225
57
+
58
+ # Notion
59
+ open -a "Notion" --args --remote-debugging-port=9226
60
+
61
+ # Spotify
62
+ open -a "Spotify" --args --remote-debugging-port=9227
63
+ ```
64
+
65
+ ### Linux
66
+
67
+ ```bash
68
+ slack --remote-debugging-port=9222
69
+ code --remote-debugging-port=9223
70
+ discord --remote-debugging-port=9224
71
+ ```
72
+
73
+ ### Windows
74
+
75
+ ```bash
76
+ "C:\Users\%USERNAME%\AppData\Local\slack\slack.exe" --remote-debugging-port=9222
77
+ "C:\Users\%USERNAME%\AppData\Local\Programs\Microsoft VS Code\Code.exe" --remote-debugging-port=9223
78
+ ```
79
+
80
+ **Important:** If the app is already running, quit it first, then relaunch with the flag. The `--remote-debugging-port` flag must be present at launch time.
81
+
82
+ ## Connecting
83
+
84
+ ```bash
85
+ # Connect to a specific port
86
+ agent-browser connect 9222
87
+
88
+ # Or use --cdp on each command
89
+ agent-browser --cdp 9222 snapshot -i
90
+
91
+ # Auto-discover a running Chromium-based app
92
+ agent-browser --auto-connect snapshot -i
93
+ ```
94
+
95
+ After `connect`, all subsequent commands target the connected app without needing `--cdp`.
96
+
97
+ ## Tab Management
98
+
99
+ Electron apps often have multiple windows or webviews. Use tab commands to list and switch between them:
100
+
101
+ ```bash
102
+ # List all available targets (windows, webviews, etc.)
103
+ agent-browser tab
104
+
105
+ # Switch to a specific tab by index
106
+ agent-browser tab 2
107
+
108
+ # Switch by URL pattern
109
+ agent-browser tab --url "*settings*"
110
+ ```
111
+
112
+ ## Webview Support
113
+
114
+ Electron `<webview>` elements are automatically discovered and can be controlled like regular pages. Webviews appear as separate targets in the tab list with `type: "webview"`:
115
+
116
+ ```bash
117
+ # Connect to running Electron app
118
+ agent-browser connect 9222
119
+
120
+ # List targets -- webviews appear alongside pages
121
+ agent-browser tab
122
+ # Example output:
123
+ # 0: [page] Slack - Main Window https://app.slack.com/
124
+ # 1: [webview] Embedded Content https://example.com/widget
125
+
126
+ # Switch to a webview
127
+ agent-browser tab 1
128
+
129
+ # Interact with the webview normally
130
+ agent-browser snapshot -i
131
+ agent-browser click @e3
132
+ agent-browser screenshot webview.png
133
+ ```
134
+
135
+ **Note:** Webview support works via raw CDP connection.
136
+
137
+ ## Common Patterns
138
+
139
+ ### Inspect and Navigate an App
140
+
141
+ ```bash
142
+ open -a "Slack" --args --remote-debugging-port=9222
143
+ sleep 3 # Wait for app to start
144
+ agent-browser connect 9222
145
+ agent-browser snapshot -i
146
+ # Read the snapshot output to identify UI elements
147
+ agent-browser click @e10 # Navigate to a section
148
+ agent-browser snapshot -i # Re-snapshot after navigation
149
+ ```
150
+
151
+ ### Take Screenshots of Desktop Apps
152
+
153
+ ```bash
154
+ agent-browser connect 9222
155
+ agent-browser screenshot app-state.png
156
+ agent-browser screenshot --full full-app.png
157
+ agent-browser screenshot --annotate annotated-app.png
158
+ ```
159
+
160
+ ### Extract Data from a Desktop App
161
+
162
+ ```bash
163
+ agent-browser connect 9222
164
+ agent-browser snapshot -i
165
+ agent-browser get text @e5
166
+ agent-browser snapshot --json > app-state.json
167
+ ```
168
+
169
+ ### Fill Forms in Desktop Apps
170
+
171
+ ```bash
172
+ agent-browser connect 9222
173
+ agent-browser snapshot -i
174
+ agent-browser fill @e3 "search query"
175
+ agent-browser press Enter
176
+ agent-browser wait 1000
177
+ agent-browser snapshot -i
178
+ ```
179
+
180
+ ### Run Multiple Apps Simultaneously
181
+
182
+ Use named sessions to control multiple Electron apps at the same time:
183
+
184
+ ```bash
185
+ # Connect to Slack
186
+ agent-browser --session slack connect 9222
187
+
188
+ # Connect to VS Code
189
+ agent-browser --session vscode connect 9223
190
+
191
+ # Interact with each independently
192
+ agent-browser --session slack snapshot -i
193
+ agent-browser --session vscode snapshot -i
194
+ ```
195
+
196
+ ## Color Scheme
197
+
198
+ The default color scheme when connecting via CDP may be `light`. To preserve dark mode:
199
+
200
+ ```bash
201
+ agent-browser connect 9222
202
+ agent-browser --color-scheme dark snapshot -i
203
+ ```
204
+
205
+ Or set it globally:
206
+
207
+ ```bash
208
+ AGENT_BROWSER_COLOR_SCHEME=dark agent-browser connect 9222
209
+ ```
210
+
211
+ ## Troubleshooting
212
+
213
+ ### "Connection refused" or "Cannot connect"
214
+
215
+ - Make sure the app was launched with `--remote-debugging-port=NNNN`
216
+ - If the app was already running, quit and relaunch with the flag
217
+ - Check that the port isn't in use by another process: `lsof -i :9222`
218
+
219
+ ### App launches but connect fails
220
+
221
+ - Wait a few seconds after launch before connecting (`sleep 3`)
222
+ - Some apps take time to initialize their webview
223
+
224
+ ### Elements not appearing in snapshot
225
+
226
+ - The app may use multiple webviews. Use `agent-browser tab` to list targets and switch to the right one
227
+
228
+ ### Cannot type in input fields
229
+
230
+ - Try `agent-browser keyboard type "text"` to type at the current focus without a selector
231
+ - Some Electron apps use custom input components; use `agent-browser keyboard inserttext "text"` to bypass key events
232
+
233
+ ## Supported Apps
234
+
235
+ Any app built on Electron works, including:
236
+
237
+ - **Communication:** Slack, Discord, Microsoft Teams, Signal, Telegram Desktop
238
+ - **Development:** VS Code, GitHub Desktop, Postman, Insomnia
239
+ - **Design:** Figma, Notion, Obsidian
240
+ - **Media:** Spotify, Tidal
241
+ - **Productivity:** Todoist, Linear, 1Password
242
+
243
+ If an app is built with Electron, it supports `--remote-debugging-port` and can be automated with agent-browser.
@@ -0,0 +1,35 @@
1
+ {
2
+ "manifestVersion": 5,
3
+ "type": "profile",
4
+ "name": "dsh-x-workbench",
5
+ "displayName": "DSH-X 桌面工作台",
6
+ "version": "1.0.0",
7
+ "description": "把 dsh-tauri 桌面版最常用的几项能力在纯 dsh 生态里凑齐,再带上 ZCode 的两份通用技能。五件插件:dsh-better-sidebar —— 右侧栏完整工作台(文件树/编辑器、终端、Git 变更与提交图、子代理);@cerbur/clutch-dsh-worktree —— 按 Workspace → Worktree → Session 分组的 Git 工作树视图;dsh-plugin-cron-scheduler —— 定时任务,到点向会话注入一条 user 消息触发完整 agent 轮次;dsh-archived-conversations —— 设置页里的已归档对话列表与只读预览;dsh-plugin-notify-sounds —— 需要你决策或任务完成时的提示音与系统通知。两份技能:agent-browser(浏览器自动化 CLI)与 electron(通过 CDP 驱动 Electron 应用,也适用于 DSH-X 自己的 Electron 壳),装进 ~/.dsh/skills,所有 profile 共用。装它 = 得到一个独立 profile(默认名 workbench),和现有环境互不打扰。",
8
+ "author": "yyh",
9
+ "license": "MIT",
10
+ "homepage": "https://github.com/yyh-001/DSH-X",
11
+ "category": "desktop",
12
+ "dshVersion": ">=0.2.1-rc.1 <0.3.0-0",
13
+ "profileName": "workbench",
14
+ "keywords": [
15
+ "dsh-pack",
16
+ "desktop",
17
+ "workbench",
18
+ "skills"
19
+ ],
20
+ "dependencies": {
21
+ "dsh-better-sidebar": "^0.28.2",
22
+ "@cerbur/clutch-dsh-worktree": "^0.1.19",
23
+ "dsh-plugin-cron-scheduler": "^0.2.10",
24
+ "dsh-archived-conversations": "^0.3.2",
25
+ "dsh-plugin-notify-sounds": "^1.9.0"
26
+ },
27
+ "bundles": [
28
+ "dsh-better-sidebar",
29
+ "@cerbur/clutch-dsh-worktree",
30
+ "dsh-plugin-cron-scheduler",
31
+ "dsh-archived-conversations",
32
+ "dsh-plugin-notify-sounds"
33
+ ],
34
+ "conflicts": []
35
+ }
@@ -13,6 +13,12 @@ import { patchProfileBoot } from './startup-resolver.mjs'
13
13
 
14
14
  const TARGET = 'dsh-client-modules/lib/index.js'
15
15
  const PROFILE_BOOT = /\/dsh\/lib\/profile-boot(?:-[^/]+)?\.js(?:\?.*)?$/
16
+ /** Cordis loader:启动账本靠它知道每个 entry 什么时候结算完(只观测,不改行为)。 */
17
+ const LOADER = 'cordis-plugin-loader/lib/index.js'
18
+ const LOADER_ENTRY = 'async _init() {'
19
+ const LOADER_FIBER = 'this.fiber = this.ctx.registry.plugin(plugin, this.options.config, this.getOuterStack).ctx.fiber;'
20
+ const LOADER_ENTRY_HOOK = 'async _init() {\n\t\tglobalThis[Symbol.for("dsh-x/plugin-profile")]?.enter(this);'
21
+ const LOADER_FIBER_HOOK = `${LOADER_FIBER}\n\t\tglobalThis[Symbol.for("dsh-x/plugin-profile")]?.imported(this);`
16
22
 
17
23
  /** 已知的慢实现(用于校验,必须精确匹配才动手)。 */
18
24
  const SLOW_NEWLINE = 'function newlineCount(value) {\n\tlet count = 0;\n\tfor (const char of value) if (char === "\\n") count += 1;\n\treturn count;\n}'
@@ -24,7 +30,8 @@ const FAST_MAPPINGS = 'const _lines = newlineCount(source); const mappings = _li
24
30
  export function load(url, context, nextLoad) {
25
31
  const result = nextLoad(url, context)
26
32
  const profileBoot = PROFILE_BOOT.test(url)
27
- if (!profileBoot && !url.includes(TARGET)) return result
33
+ const loader = url.includes(LOADER)
34
+ if (!profileBoot && !loader && !url.includes(TARGET)) return result
28
35
  if (result.format !== 'module' || result.source === undefined) return result
29
36
 
30
37
  let source = Buffer.isBuffer(result.source) ? result.source.toString('utf8') : String(result.source)
@@ -32,6 +39,12 @@ export function load(url, context, nextLoad) {
32
39
  const patched = patchProfileBoot(source)
33
40
  return patched === source ? result : { ...result, source: patched }
34
41
  }
42
+ if (loader) {
43
+ // 两个锚点都在才注入:上游改了 loader 实现就整段跳过,账本自然没有 entry 时间线,启动照旧。
44
+ if (!source.includes(LOADER_ENTRY) || !source.includes(LOADER_FIBER)) return result
45
+ const patched = source.replace(LOADER_ENTRY, LOADER_ENTRY_HOOK).replace(LOADER_FIBER, LOADER_FIBER_HOOK)
46
+ return { ...result, source: patched }
47
+ }
35
48
  const applied = []
36
49
 
37
50
  // 逐字符校验后才替换:只有长得和实测过的慢实现一模一样才动手