dsh-edge 0.18.0 → 0.19.0-alpha.2
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.i18n.yaml +2 -2
- package/README.md +8 -8
- package/README.zh.md +8 -8
- package/THIRD_PARTY_NOTICES.md +2011 -449
- package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
- package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
- package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
- package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
- package/dist/assets/index-Cq6ljTv2.css +1 -0
- package/dist/assets/index-Dy0OhsZ5.js +127 -0
- package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
- package/dist/assets/langs/bat-BkioyH1T.js +2 -0
- package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
- package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
- package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
- package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
- package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
- package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
- package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
- package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
- package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
- package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
- package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
- package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
- package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
- package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
- package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
- package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
- package/dist/assets/langs/html-fwsONPVS.js +2 -0
- package/dist/assets/langs/http-DcV90OkR.js +2 -0
- package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
- package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
- package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
- package/dist/assets/langs/log-2UxHyX5q.js +2 -0
- package/dist/assets/langs/make-CHLpvVh8.js +2 -0
- package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
- package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
- package/dist/assets/langs/php-LEPfNACG.js +2 -0
- package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
- package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
- package/dist/assets/langs/r-Dspwwk_N.js +2 -0
- package/dist/assets/langs/rst-BbocfKWr.js +2 -0
- package/dist/assets/langs/ruby-R292Iif0.js +2 -0
- package/dist/assets/langs/scala-C151Ov-r.js +2 -0
- package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
- package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
- package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
- package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
- package/dist/assets/langs/vue-Dq2x6432.js +2 -0
- package/dist/favicon-dark.svg +3 -0
- package/dist/favicon.svg +0 -5
- package/dist/index.html +5 -4
- package/dist/manifest.webmanifest +3 -4
- package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
- package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
- package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
- package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
- package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
- package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
- package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
- package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
- package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
- package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
- package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
- package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
- package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
- package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
- package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
- package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
- package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
- package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
- package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
- package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
- package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
- package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
- package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
- package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
- package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
- package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
- package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
- package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
- package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
- package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
- package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
- package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
- package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
- package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
- package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
- package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
- package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
- package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
- package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
- package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
- package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
- package/package.json +96 -86
- package/scripts/cli.mjs +16 -4
- package/scripts/install.d.mts +12 -2
- package/scripts/install.mjs +36 -9
- package/scripts/legal-files.mjs +15 -0
- package/worker/direct/index.js +2564 -1822
- package/worker/isolated/index.js +2144 -1402
- package/dist/assets/index-BKQ_L1z6.js +0 -117
- package/dist/assets/index-DPX2bQLO.css +0 -1
- package/dist/assets/langs/html-CfGypltT.js +0 -2
- package/dist/assets/langs/php-DJl5gRdb.js +0 -2
- package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
- package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
- package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
|
@@ -8,26 +8,54 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
/** Browser-relative form of {@link OPEN_IN_APP_APPS_PATH}. */
|
|
12
|
+
const OPEN_IN_APP_APPS_ROUTE = "/open-in-app/apps".slice(1);
|
|
13
|
+
/** Browser-relative form of {@link OPEN_IN_APP_ICON_PREFIX_PATH}. */
|
|
14
|
+
const OPEN_IN_APP_ICON_PREFIX_ROUTE = "/open-in-app/icon".slice(1);
|
|
15
|
+
/** Browser-relative form of {@link OPEN_IN_APP_OPEN_PATH}. */
|
|
16
|
+
const OPEN_IN_APP_OPEN_ROUTE = "/open-in-app/open".slice(1);
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region lib/types/client/applications.js
|
|
19
|
+
/** Label keys for applications supported by this client. */
|
|
20
|
+
const APP_LABEL_KEY = {
|
|
21
|
+
finder: "app.finder",
|
|
22
|
+
explorer: "app.explorer",
|
|
23
|
+
filemanager: "app.filemanager",
|
|
24
|
+
cursor: "app.cursor",
|
|
25
|
+
vscode: "app.vscode",
|
|
26
|
+
vscodeinsiders: "app.vscodeinsiders",
|
|
27
|
+
windsurf: "app.windsurf",
|
|
28
|
+
zed: "app.zed",
|
|
29
|
+
sublimetext: "app.sublimetext",
|
|
30
|
+
xcode: "app.xcode",
|
|
31
|
+
androidstudio: "app.androidstudio",
|
|
32
|
+
intellij: "app.intellij",
|
|
33
|
+
pycharm: "app.pycharm",
|
|
34
|
+
webstorm: "app.webstorm",
|
|
35
|
+
phpstorm: "app.phpstorm",
|
|
36
|
+
goland: "app.goland",
|
|
37
|
+
rider: "app.rider",
|
|
38
|
+
rustrover: "app.rustrover",
|
|
39
|
+
fork: "app.fork",
|
|
40
|
+
sourcetree: "app.sourcetree",
|
|
41
|
+
github: "app.github",
|
|
42
|
+
tower: "app.tower",
|
|
43
|
+
gitkraken: "app.gitkraken",
|
|
44
|
+
smartgit: "app.smartgit",
|
|
45
|
+
sublimemerge: "app.sublimemerge",
|
|
46
|
+
ghostty: "app.ghostty",
|
|
47
|
+
warp: "app.warp",
|
|
48
|
+
iterm: "app.iterm",
|
|
49
|
+
kitty: "app.kitty",
|
|
50
|
+
terminal: "app.terminal",
|
|
51
|
+
windowsterminal: "app.windowsterminal",
|
|
52
|
+
gitbash: "app.gitbash",
|
|
53
|
+
gnometerminal: "app.gnometerminal",
|
|
54
|
+
konsole: "app.konsole"
|
|
55
|
+
};
|
|
23
56
|
//#endregion
|
|
24
57
|
//#region lib/types/client/controller.js
|
|
25
58
|
/** Browser availability/choice state and the launch carrier for the split button. */
|
|
26
|
-
/** Resolve the browser's Host base with the connection carrier's null-origin fallback. */
|
|
27
|
-
function hostBase() {
|
|
28
|
-
const origin = globalThis.location?.origin;
|
|
29
|
-
return origin !== void 0 && origin !== "null" ? origin : "http://dsh.internal";
|
|
30
|
-
}
|
|
31
59
|
/**
|
|
32
60
|
* Owns the once-per-page availability read, the persisted last choice, and
|
|
33
61
|
* the launch POST. Availability and choice publish through uSES-safe sources
|
|
@@ -39,6 +67,20 @@ window.__ModuleLoader__.load({
|
|
|
39
67
|
apps = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
|
|
40
68
|
/** Last chosen app id, or empty before the first choice, shared across sessions and browser restarts. */
|
|
41
69
|
choice = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)("", { persist: { name: "dsh.open-in-app.choice" } });
|
|
70
|
+
/** Current launch, shared by pointer and keyboard gestures. */
|
|
71
|
+
operation = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
72
|
+
phase: "idle",
|
|
73
|
+
path: null
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Resolve the remembered nameable installed application, with the button's first-app fallback.
|
|
77
|
+
* @returns the installed app id, or undefined while unavailable.
|
|
78
|
+
*/
|
|
79
|
+
currentApp() {
|
|
80
|
+
const apps = (this.apps.getSnapshot() ?? []).filter((id) => APP_LABEL_KEY[id] !== void 0);
|
|
81
|
+
const choice = this.choice.getSnapshot();
|
|
82
|
+
return apps.includes(choice) ? choice : apps[0];
|
|
83
|
+
}
|
|
42
84
|
loading;
|
|
43
85
|
/**
|
|
44
86
|
* @param fetcher - HTTP carrier for the apps read and the launch POST.
|
|
@@ -60,30 +102,48 @@ window.__ModuleLoader__.load({
|
|
|
60
102
|
* @param appId - catalog id from the availability list.
|
|
61
103
|
*/
|
|
62
104
|
choose(appId) {
|
|
63
|
-
this.choice.set(appId);
|
|
105
|
+
if (this.operation.getSnapshot().phase !== "busy") this.choice.set(appId);
|
|
64
106
|
}
|
|
65
107
|
/**
|
|
66
108
|
* Launch one installed app on a workspace directory.
|
|
67
109
|
* @param appId - catalog id from the availability list.
|
|
68
110
|
* @param path - the session's absolute workspace directory.
|
|
111
|
+
* Concurrent gestures are ignored until the current Host request settles.
|
|
69
112
|
* @returns after the host acknowledged the launch; rejects on any failure.
|
|
70
113
|
*/
|
|
71
114
|
async launch(appId, path) {
|
|
115
|
+
if (this.operation.getSnapshot().phase === "busy") return;
|
|
116
|
+
this.operation.set({
|
|
117
|
+
phase: "busy",
|
|
118
|
+
path
|
|
119
|
+
});
|
|
72
120
|
const body = {
|
|
73
121
|
app: appId,
|
|
74
122
|
path
|
|
75
123
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
124
|
+
try {
|
|
125
|
+
const response = await this.fetcher(OPEN_IN_APP_OPEN_ROUTE, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: { "content-type": "application/json" },
|
|
128
|
+
body: JSON.stringify(body)
|
|
129
|
+
});
|
|
130
|
+
if (!response.ok) throw new Error(`open failed: HTTP ${String(response.status)}`);
|
|
131
|
+
this.operation.set({
|
|
132
|
+
phase: "idle",
|
|
133
|
+
path
|
|
134
|
+
});
|
|
135
|
+
} catch (error) {
|
|
136
|
+
this.operation.set({
|
|
137
|
+
phase: "error",
|
|
138
|
+
path
|
|
139
|
+
});
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
82
142
|
}
|
|
83
143
|
async run() {
|
|
84
144
|
let apps = [];
|
|
85
145
|
try {
|
|
86
|
-
const response = await this.fetcher(
|
|
146
|
+
const response = await this.fetcher(OPEN_IN_APP_APPS_ROUTE, { headers: { accept: "application/json" } });
|
|
87
147
|
if (response.ok) {
|
|
88
148
|
const payload = await response.json();
|
|
89
149
|
if (Array.isArray(payload.apps)) apps = payload.apps.filter((id) => typeof id === "string");
|
|
@@ -93,9 +153,39 @@ window.__ModuleLoader__.load({
|
|
|
93
153
|
}
|
|
94
154
|
};
|
|
95
155
|
//#endregion
|
|
96
|
-
//#region
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
//#region lib/types/client/open-failure-toast.js
|
|
157
|
+
/** Per-control failure banner for path gestures. */
|
|
158
|
+
/**
|
|
159
|
+
* Transient failure banner owned by the control that initiated the gesture,
|
|
160
|
+
* so one failed request announces once, from the control the user pressed.
|
|
161
|
+
* @returns `toast` owned by the control and `show` to announce one
|
|
162
|
+
* failure with resolved copy; announcing again replays the banner.
|
|
163
|
+
*/
|
|
164
|
+
function useOpenFailureToast() {
|
|
165
|
+
const seq = (0, react.useRef)(0);
|
|
166
|
+
const [banner, setBanner] = (0, react.useState)(null);
|
|
167
|
+
const dismiss = (0, react.useCallback)(() => {
|
|
168
|
+
setBanner(null);
|
|
169
|
+
}, []);
|
|
170
|
+
return {
|
|
171
|
+
toast: banner === null ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
172
|
+
text: banner.text,
|
|
173
|
+
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}),
|
|
174
|
+
onDone: dismiss
|
|
175
|
+
}, banner.seq),
|
|
176
|
+
show: (text) => {
|
|
177
|
+
seq.current += 1;
|
|
178
|
+
setBanner({
|
|
179
|
+
seq: seq.current,
|
|
180
|
+
text
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-open-in-app/src/client/OpenTargetButton.module.css.mjs
|
|
187
|
+
const css = ".OMoRSG_menuAnchor{flex:none;align-self:center;display:inline-flex}.OMoRSG_split{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);height:24px;font-family:var(--dsw-font-family);align-items:stretch;display:inline-flex;overflow:hidden}.OMoRSG_main,.OMoRSG_chevron{color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;font-size:11px;line-height:16px;display:inline-flex}.OMoRSG_main{gap:4px;padding:3px 5px}.OMoRSG_chevron{border-left:.5px solid var(--dsw-alias-border-l4);color:var(--dsw-alias-label-secondary);padding:3px 4px 3px 3px}.OMoRSG_main:hover:not(:disabled),.OMoRSG_main:focus-visible,.OMoRSG_chevron:hover:not(:disabled),.OMoRSG_chevron:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.OMoRSG_main:disabled,.OMoRSG_chevron:disabled{cursor:default}.OMoRSG_appIcon{object-fit:contain}.OMoRSG_split[data-size=large]{border-radius:var(--dsw-radius-md);border-color:var(--dsw-alias-border-l2);height:36px}.OMoRSG_split[data-size=large] .OMoRSG_main{gap:6px;padding:6px 14px;font-size:14px}.OMoRSG_split[data-size=large] .OMoRSG_chevron{padding:6px 10px}.OMoRSG_skeleton{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-interactive-bg-hover);flex:none;display:inline-block}";
|
|
188
|
+
const tagId = "@deepseek-ai/dsh-client-ui-open-in-app/OpenTargetButton.module.css";
|
|
99
189
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
100
190
|
const tag = document.createElement("style");
|
|
101
191
|
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-open-in-app";
|
|
@@ -103,219 +193,475 @@ window.__ModuleLoader__.load({
|
|
|
103
193
|
tag.textContent = css;
|
|
104
194
|
document.head.appendChild(tag);
|
|
105
195
|
}
|
|
106
|
-
var
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"main": "
|
|
110
|
-
"
|
|
196
|
+
var OpenTargetButton_module_css_default = {
|
|
197
|
+
"appIcon": "OMoRSG_appIcon",
|
|
198
|
+
"chevron": "OMoRSG_chevron",
|
|
199
|
+
"main": "OMoRSG_main",
|
|
200
|
+
"menuAnchor": "OMoRSG_menuAnchor",
|
|
201
|
+
"skeleton": "OMoRSG_skeleton",
|
|
202
|
+
"split": "OMoRSG_split"
|
|
111
203
|
};
|
|
112
204
|
//#endregion
|
|
113
|
-
//#region lib/types/client/
|
|
114
|
-
/**
|
|
115
|
-
* Label keys per catalog id: the browser renders only ids it can name, so a
|
|
116
|
-
* host catalog extension without a matching dictionary entry stays invisible
|
|
117
|
-
* instead of showing a raw id.
|
|
118
|
-
*/
|
|
119
|
-
const APP_LABEL_KEY = {
|
|
120
|
-
finder: "app.finder",
|
|
121
|
-
explorer: "app.explorer",
|
|
122
|
-
filemanager: "app.filemanager",
|
|
123
|
-
cursor: "app.cursor",
|
|
124
|
-
vscode: "app.vscode",
|
|
125
|
-
vscodeinsiders: "app.vscodeinsiders",
|
|
126
|
-
windsurf: "app.windsurf",
|
|
127
|
-
zed: "app.zed",
|
|
128
|
-
sublimetext: "app.sublimetext",
|
|
129
|
-
xcode: "app.xcode",
|
|
130
|
-
androidstudio: "app.androidstudio",
|
|
131
|
-
intellij: "app.intellij",
|
|
132
|
-
pycharm: "app.pycharm",
|
|
133
|
-
webstorm: "app.webstorm",
|
|
134
|
-
phpstorm: "app.phpstorm",
|
|
135
|
-
goland: "app.goland",
|
|
136
|
-
rider: "app.rider",
|
|
137
|
-
rustrover: "app.rustrover",
|
|
138
|
-
fork: "app.fork",
|
|
139
|
-
sourcetree: "app.sourcetree",
|
|
140
|
-
github: "app.github",
|
|
141
|
-
tower: "app.tower",
|
|
142
|
-
gitkraken: "app.gitkraken",
|
|
143
|
-
smartgit: "app.smartgit",
|
|
144
|
-
sublimemerge: "app.sublimemerge",
|
|
145
|
-
ghostty: "app.ghostty",
|
|
146
|
-
warp: "app.warp",
|
|
147
|
-
iterm: "app.iterm",
|
|
148
|
-
kitty: "app.kitty",
|
|
149
|
-
terminal: "app.terminal",
|
|
150
|
-
windowsterminal: "app.windowsterminal",
|
|
151
|
-
gitbash: "app.gitbash",
|
|
152
|
-
gnometerminal: "app.gnometerminal",
|
|
153
|
-
konsole: "app.konsole"
|
|
154
|
-
};
|
|
155
|
-
/** App ids whose icon image already failed this page; a 404 icon is fetched once, not per menu open. */
|
|
156
|
-
const failedIcons = /* @__PURE__ */ new Set();
|
|
205
|
+
//#region lib/types/client/OpenTargetButton.js
|
|
206
|
+
/** Shared file and directory opener: one default action, application menu, and per-gesture feedback. */
|
|
157
207
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* @param
|
|
161
|
-
* @returns the
|
|
208
|
+
* Serialize gestures and announce their failures through the initiating control's toast.
|
|
209
|
+
* @param execute - target adapter that returns the failure to announce, or null.
|
|
210
|
+
* @param t - localized control copy.
|
|
211
|
+
* @returns the pending state, feedback, and guarded action callback.
|
|
162
212
|
*/
|
|
163
|
-
function
|
|
164
|
-
const [
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
213
|
+
function useOpenTargetGesture(execute, t) {
|
|
214
|
+
const [pending, setPending] = (0, react.useState)(false);
|
|
215
|
+
const inFlight = (0, react.useRef)(false);
|
|
216
|
+
const { toast, show } = useOpenFailureToast();
|
|
217
|
+
return {
|
|
218
|
+
pending,
|
|
219
|
+
toast,
|
|
220
|
+
act: (operation) => {
|
|
221
|
+
if (inFlight.current) return;
|
|
222
|
+
inFlight.current = true;
|
|
223
|
+
setPending(true);
|
|
224
|
+
execute(operation).then((failure) => {
|
|
225
|
+
if (failure !== null) show(t(`path.${failure}`));
|
|
226
|
+
}).finally(() => {
|
|
227
|
+
inFlight.current = false;
|
|
228
|
+
setPending(false);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/** One application image with a per-image fallback, shared by main and menu buttons. */
|
|
234
|
+
function ApplicationIcon({ source, size = 14 }) {
|
|
235
|
+
const [failed, setFailed] = (0, react.useState)(false);
|
|
236
|
+
return source === null || failed ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutlineRegular, { size }) : (0, react_jsx_runtime.jsx)("img", {
|
|
237
|
+
src: source,
|
|
184
238
|
width: size,
|
|
185
239
|
height: size,
|
|
186
|
-
className:
|
|
240
|
+
className: OpenTargetButton_module_css_default.appIcon,
|
|
187
241
|
alt: "",
|
|
188
|
-
"aria-hidden": true,
|
|
189
242
|
draggable: false,
|
|
190
243
|
onError: () => {
|
|
191
|
-
failedIcons.add(id);
|
|
192
244
|
setFailed(true);
|
|
193
245
|
}
|
|
194
246
|
});
|
|
195
247
|
}
|
|
196
248
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
|
|
201
|
-
const BUSY_DRESS_DELAY_MS = 250;
|
|
202
|
-
/**
|
|
203
|
-
* Session-header split button: the main button opens the session's workspace
|
|
204
|
-
* directory in the remembered application, the chevron opens the menu of
|
|
205
|
-
* every application the host probed as installed. It renders nothing until
|
|
206
|
-
* the host reported at least one nameable application and the session has a
|
|
207
|
-
* known workspace directory, so a host without the capability never grows
|
|
208
|
-
* the control.
|
|
209
|
-
* @param props - session runtime, injected controller face, and localized copy.
|
|
210
|
-
* @returns the split button and its menu, or null when there is nothing to offer.
|
|
249
|
+
* Render identical split buttons for files and directories. File reveal always
|
|
250
|
+
* stays last; it is the default only when no application is registered.
|
|
251
|
+
* @param props - target applications, default selection, and operations.
|
|
252
|
+
* @returns the control and its transient failure feedback.
|
|
211
253
|
*/
|
|
212
|
-
function
|
|
213
|
-
const {
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
clearTimeout(errorTimer.current);
|
|
225
|
-
}, []);
|
|
226
|
-
const apps = (available ?? []).map((id) => ({
|
|
227
|
-
id,
|
|
228
|
-
labelKey: APP_LABEL_KEY[id]
|
|
229
|
-
})).filter((entry) => entry.labelKey !== void 0);
|
|
230
|
-
const currentEntry = apps.find((entry) => entry.id === choice) ?? apps[0];
|
|
231
|
-
if (currentEntry === void 0 || cwd === void 0 || cwd === "") return null;
|
|
232
|
-
const current = currentEntry.id;
|
|
233
|
-
const currentLabel = t(currentEntry.labelKey);
|
|
234
|
-
const title = phase === "error" ? t("open.error") : t("open.title", { app: currentLabel });
|
|
235
|
-
const launch = (appId) => {
|
|
236
|
-
if (inFlight.current) return;
|
|
237
|
-
inFlight.current = true;
|
|
238
|
-
clearTimeout(errorTimer.current);
|
|
239
|
-
clearTimeout(busyTimer.current);
|
|
240
|
-
busyTimer.current = setTimeout(() => {
|
|
241
|
-
setPhase("busy");
|
|
242
|
-
}, BUSY_DRESS_DELAY_MS);
|
|
243
|
-
props.launch(appId, cwd).then(() => {
|
|
244
|
-
inFlight.current = false;
|
|
245
|
-
clearTimeout(busyTimer.current);
|
|
246
|
-
setPhase("idle");
|
|
247
|
-
}, () => {
|
|
248
|
-
inFlight.current = false;
|
|
249
|
-
clearTimeout(busyTimer.current);
|
|
250
|
-
setPhase("error");
|
|
251
|
-
clearTimeout(errorTimer.current);
|
|
252
|
-
errorTimer.current = setTimeout(() => {
|
|
253
|
-
setPhase("idle");
|
|
254
|
-
}, 2e3);
|
|
255
|
-
});
|
|
254
|
+
function OpenTargetButton(props) {
|
|
255
|
+
const { applications, defaultId, kind, t } = props;
|
|
256
|
+
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
257
|
+
const { pending, toast, act } = useOpenTargetGesture(props.execute, t);
|
|
258
|
+
const preferred = kind === "file" ? applications.find((app) => app.id === defaultId) ?? applications[0] : applications.find((app) => app.id === defaultId);
|
|
259
|
+
const disabled = pending || props.busy === true || props.loading === true;
|
|
260
|
+
const hasMenu = props.loading === true || props.failed || applications.length + (kind === "file" ? 1 : 0) > 1;
|
|
261
|
+
const revealDefault = kind === "file" && preferred === void 0 && props.loading !== true;
|
|
262
|
+
const primaryLabel = preferred === void 0 ? t("path.reveal") : t("open.title", { app: preferred.name });
|
|
263
|
+
const run = (operation) => {
|
|
264
|
+
setMenuOpen(false);
|
|
265
|
+
act(operation);
|
|
256
266
|
};
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
267
|
+
const primary = () => {
|
|
268
|
+
if (revealDefault) {
|
|
269
|
+
run({ kind: "reveal" });
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (preferred !== void 0 && preferred.id !== defaultId) {
|
|
273
|
+
run({
|
|
274
|
+
kind: "application",
|
|
275
|
+
id: preferred.id
|
|
276
|
+
});
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
run({ kind: "default" });
|
|
280
|
+
};
|
|
281
|
+
const icon = props.loading === true && preferred === void 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
282
|
+
className: OpenTargetButton_module_css_default.skeleton,
|
|
283
|
+
"data-open-target-skeleton": true,
|
|
284
|
+
"aria-hidden": "true",
|
|
285
|
+
style: {
|
|
286
|
+
width: props.prominent ? 18 : 13,
|
|
287
|
+
height: props.prominent ? 18 : 13
|
|
288
|
+
}
|
|
289
|
+
}) : revealDefault ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutlineRegular, { size: props.prominent ? 18 : 13 }) : (0, react_jsx_runtime.jsx)(ApplicationIcon, {
|
|
290
|
+
source: preferred?.icon ?? null,
|
|
291
|
+
size: props.prominent ? 18 : 13
|
|
292
|
+
}, preferred?.icon);
|
|
293
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
294
|
+
className: OpenTargetButton_module_css_default.menuAnchor,
|
|
295
|
+
open: menuOpen && !disabled && hasMenu,
|
|
296
|
+
autoFocus: true,
|
|
297
|
+
portal: true,
|
|
260
298
|
dense: true,
|
|
261
|
-
|
|
299
|
+
align: "end",
|
|
262
300
|
onClose: () => {
|
|
263
|
-
|
|
301
|
+
setMenuOpen(false);
|
|
264
302
|
},
|
|
265
|
-
items:
|
|
266
|
-
id:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
303
|
+
items: [...applications.map((app) => ({
|
|
304
|
+
id: `app:${app.id}`,
|
|
305
|
+
icon: (0, react_jsx_runtime.jsx)(ApplicationIcon, { source: app.icon }, app.icon),
|
|
306
|
+
label: app.id === preferred?.id ? t("path.appDefault", { app: app.name }) : app.name
|
|
307
|
+
})), ...props.failed ? [{
|
|
308
|
+
id: "unavailable",
|
|
309
|
+
label: t("path.appsError"),
|
|
310
|
+
disabled: true
|
|
311
|
+
}] : []],
|
|
312
|
+
footer: kind === "file" ? [{
|
|
313
|
+
id: "reveal",
|
|
314
|
+
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutlineRegular, {}),
|
|
315
|
+
label: revealDefault ? t("path.appDefault", { app: t("path.reveal") }) : t("path.reveal")
|
|
316
|
+
}] : [],
|
|
275
317
|
onSelect: (id) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
318
|
+
run(id === "reveal" ? { kind: "reveal" } : {
|
|
319
|
+
kind: "application",
|
|
320
|
+
id: id.slice(4)
|
|
321
|
+
});
|
|
280
322
|
},
|
|
281
323
|
anchor: (0, react_jsx_runtime.jsxs)("div", {
|
|
282
|
-
className:
|
|
324
|
+
className: OpenTargetButton_module_css_default.split,
|
|
325
|
+
"data-open-target": kind,
|
|
326
|
+
"data-size": props.prominent ? "large" : "compact",
|
|
327
|
+
"data-open-path": kind === "file" && !props.prominent ? "" : void 0,
|
|
328
|
+
"data-state": disabled ? "busy" : "idle",
|
|
283
329
|
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
284
|
-
|
|
330
|
+
portal: true,
|
|
331
|
+
label: primaryLabel,
|
|
332
|
+
shortcutKeys: props.shortcut?.keys,
|
|
285
333
|
side: "bottom",
|
|
286
|
-
|
|
334
|
+
delayMs: 500,
|
|
335
|
+
children: (0, react_jsx_runtime.jsxs)("button", {
|
|
287
336
|
type: "button",
|
|
288
|
-
className:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
"aria-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
children:
|
|
296
|
-
id: current,
|
|
297
|
-
url: props.iconUrl(current),
|
|
298
|
-
size: 15
|
|
299
|
-
})
|
|
337
|
+
className: OpenTargetButton_module_css_default.main,
|
|
338
|
+
disabled,
|
|
339
|
+
"aria-label": props.prominent ? void 0 : primaryLabel,
|
|
340
|
+
"aria-keyshortcuts": props.shortcut?.aria,
|
|
341
|
+
"data-open-path-open": kind === "file" && !props.prominent ? "" : void 0,
|
|
342
|
+
"data-open-path-unpreviewable": props.prominent ? "" : void 0,
|
|
343
|
+
onClick: primary,
|
|
344
|
+
children: [icon, props.prominent && (revealDefault ? t("path.reveal") : t("path.open"))]
|
|
300
345
|
})
|
|
301
|
-
}), (0, react_jsx_runtime.jsx)("button", {
|
|
346
|
+
}), hasMenu && (0, react_jsx_runtime.jsx)("button", {
|
|
302
347
|
type: "button",
|
|
303
|
-
className:
|
|
304
|
-
|
|
348
|
+
className: OpenTargetButton_module_css_default.chevron,
|
|
349
|
+
disabled,
|
|
305
350
|
"aria-haspopup": "menu",
|
|
306
|
-
|
|
307
|
-
"aria-label": t("
|
|
351
|
+
"aria-expanded": menuOpen && !disabled,
|
|
352
|
+
"aria-label": t("path.more"),
|
|
353
|
+
"data-open-path-more": kind === "file" && !props.prominent ? "" : void 0,
|
|
308
354
|
onClick: () => {
|
|
309
|
-
|
|
355
|
+
if (!menuOpen) props.refresh?.();
|
|
356
|
+
setMenuOpen((value) => !value);
|
|
310
357
|
},
|
|
311
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.
|
|
358
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: props.prominent ? 14 : 10 })
|
|
312
359
|
})]
|
|
313
360
|
})
|
|
361
|
+
}), toast] });
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region lib/types/client/OpenInAppAction.js
|
|
365
|
+
/**
|
|
366
|
+
* Adapt the installed directory catalog to the shared opening control.
|
|
367
|
+
* @param props - workspace state, installed catalog, and launch operations.
|
|
368
|
+
* @returns the shared control, or null without an eligible application and directory.
|
|
369
|
+
*/
|
|
370
|
+
function OpenInAppAction(props) {
|
|
371
|
+
const { sessionId, useSessions, useOpenInAppApps, useOpenInAppChoice, t } = props;
|
|
372
|
+
const cwd = useSessions((state) => state.byId[sessionId]?.cwd);
|
|
373
|
+
const available = useOpenInAppApps((apps) => apps);
|
|
374
|
+
const choice = useOpenInAppChoice((id) => id);
|
|
375
|
+
const operation = props.useOpenInAppLaunch((value) => value);
|
|
376
|
+
const shortcut = props.useShortcuts((rows) => rows.find((row) => row.id === "workspace.openLocal"));
|
|
377
|
+
const apps = (available ?? []).flatMap((id) => {
|
|
378
|
+
const key = APP_LABEL_KEY[id];
|
|
379
|
+
return key === void 0 ? [] : [{
|
|
380
|
+
id,
|
|
381
|
+
name: t(key),
|
|
382
|
+
icon: props.iconUrl(id)
|
|
383
|
+
}];
|
|
384
|
+
});
|
|
385
|
+
const preferred = apps.find((app) => app.id === choice) ?? apps[0];
|
|
386
|
+
if (preferred === void 0 || cwd === void 0 || cwd === "") return null;
|
|
387
|
+
return (0, react_jsx_runtime.jsx)(OpenTargetButton, {
|
|
388
|
+
kind: "directory",
|
|
389
|
+
applications: apps,
|
|
390
|
+
defaultId: preferred.id,
|
|
391
|
+
failed: false,
|
|
392
|
+
t,
|
|
393
|
+
busy: operation.phase === "busy",
|
|
394
|
+
shortcut,
|
|
395
|
+
execute: async (operation) => {
|
|
396
|
+
const id = operation.kind === "application" ? operation.id : preferred.id;
|
|
397
|
+
try {
|
|
398
|
+
await props.launch(id, cwd);
|
|
399
|
+
} catch (_error) {
|
|
400
|
+
return "openError";
|
|
401
|
+
}
|
|
402
|
+
if (operation.kind === "application") props.choose(id);
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
}, cwd);
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region lib/types/client/open-path.js
|
|
409
|
+
/**
|
|
410
|
+
* Host desktop availability, file associations, and open/reveal actions over the Session Remote.
|
|
411
|
+
* The desktop answer is read once per page; a failed read renders no control.
|
|
412
|
+
*/
|
|
413
|
+
/** Page-lifetime desktop availability and the open/reveal carrier shared by every path control. */
|
|
414
|
+
var OpenInAppPathController = class {
|
|
415
|
+
remote;
|
|
416
|
+
/** Whether the Host desktop can open paths; null until the Host answered, false also after a failed read. */
|
|
417
|
+
desktop = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
|
|
418
|
+
loading;
|
|
419
|
+
/**
|
|
420
|
+
* @param remote - the Session Remote namespace answering availability and running gestures.
|
|
421
|
+
*/
|
|
422
|
+
constructor(remote) {
|
|
423
|
+
this.remote = remote;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Read desktop availability once per controller life; concurrent calls share the read.
|
|
427
|
+
* @returns after availability is published.
|
|
428
|
+
*/
|
|
429
|
+
load() {
|
|
430
|
+
this.loading ??= this.run();
|
|
431
|
+
return this.loading;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Open one Host path in its default application, or reveal it in the file manager.
|
|
435
|
+
* @param path - absolute path on the Host, as the file's metadata reports it.
|
|
436
|
+
* @param action - default application open, or file-manager reveal.
|
|
437
|
+
* @param application - registered application path for an explicit open.
|
|
438
|
+
* @returns the failure kind to announce, or `null` once the Host acknowledged.
|
|
439
|
+
*/
|
|
440
|
+
async openPath(path, action, application) {
|
|
441
|
+
const request = action === "reveal" ? {
|
|
442
|
+
path,
|
|
443
|
+
action
|
|
444
|
+
} : {
|
|
445
|
+
path,
|
|
446
|
+
...application === void 0 ? {} : { application }
|
|
447
|
+
};
|
|
448
|
+
let ok = false;
|
|
449
|
+
try {
|
|
450
|
+
ok = (await this.remote.session.openWorkspacePath(request)).ok;
|
|
451
|
+
} catch {}
|
|
452
|
+
return ok ? null : action === "open" ? "openError" : "revealError";
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Refresh the file's OS associations; failures remain distinct from an empty handler list.
|
|
456
|
+
* @param path - file path reported by the Host.
|
|
457
|
+
* @param signal - lifetime of the requesting preview.
|
|
458
|
+
* @returns application metadata, or null when the query fails.
|
|
459
|
+
*/
|
|
460
|
+
async applications(path, signal) {
|
|
461
|
+
let result;
|
|
462
|
+
try {
|
|
463
|
+
result = await this.remote.session.workspacePathApplications({ path }, signal);
|
|
464
|
+
} catch (_error) {
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
return result.ok ? result.value : null;
|
|
468
|
+
}
|
|
469
|
+
async run() {
|
|
470
|
+
let available = false;
|
|
471
|
+
try {
|
|
472
|
+
const result = await this.remote.session.canOpenWorkspacePath();
|
|
473
|
+
available = result.ok && result.value;
|
|
474
|
+
} catch {}
|
|
475
|
+
this.desktop.set(available);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region lib/types/client/file-applications.js
|
|
480
|
+
/** File association reads shared by mounted controls using the same reader and target. */
|
|
481
|
+
const EMPTY = {
|
|
482
|
+
apps: [],
|
|
483
|
+
loading: true,
|
|
484
|
+
failed: false
|
|
485
|
+
};
|
|
486
|
+
const readers = /* @__PURE__ */ new WeakMap();
|
|
487
|
+
/** Each mounted consumer retains the query; the last release cancels and discards it. */
|
|
488
|
+
function subscribe(query, target, listener) {
|
|
489
|
+
let targets = readers.get(query);
|
|
490
|
+
if (targets === void 0) {
|
|
491
|
+
targets = /* @__PURE__ */ new Map();
|
|
492
|
+
readers.set(query, targets);
|
|
493
|
+
}
|
|
494
|
+
let entry = targets.get(target);
|
|
495
|
+
const initial = entry === void 0;
|
|
496
|
+
if (entry === void 0) {
|
|
497
|
+
const created = {
|
|
498
|
+
state: (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(EMPTY),
|
|
499
|
+
users: 0,
|
|
500
|
+
controller: null,
|
|
501
|
+
refresh: () => {
|
|
502
|
+
created.controller?.abort();
|
|
503
|
+
const controller = new AbortController();
|
|
504
|
+
created.controller = controller;
|
|
505
|
+
query(target, controller.signal).then((apps) => {
|
|
506
|
+
if (!controller.signal.aborted) created.state.set({
|
|
507
|
+
apps: apps ?? [],
|
|
508
|
+
loading: false,
|
|
509
|
+
failed: apps === null
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
entry = created;
|
|
515
|
+
targets.set(target, entry);
|
|
516
|
+
}
|
|
517
|
+
const retained = entry;
|
|
518
|
+
retained.users += 1;
|
|
519
|
+
const release = retained.state.subscribe(listener);
|
|
520
|
+
if (initial) retained.refresh();
|
|
521
|
+
return () => {
|
|
522
|
+
release();
|
|
523
|
+
retained.users -= 1;
|
|
524
|
+
if (retained.users === 0) {
|
|
525
|
+
retained.controller?.abort();
|
|
526
|
+
targets.delete(target);
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Share associations and refreshes across mounted controls for the same file and reader.
|
|
532
|
+
* @param target - path or authenticated route identifying the current file.
|
|
533
|
+
* @param query - stable reader scoped to the serving Host; failures resolve to null.
|
|
534
|
+
* @param enabled - whether a native desktop is available.
|
|
535
|
+
* @returns metadata, initial loading state, failure state, and a shared refresh callback.
|
|
536
|
+
*/
|
|
537
|
+
function useFileApplications(target, query, enabled) {
|
|
538
|
+
const retain = (0, react.useCallback)((listener) => enabled ? subscribe(query, target, listener) : () => {}, [
|
|
539
|
+
enabled,
|
|
540
|
+
query,
|
|
541
|
+
target
|
|
542
|
+
]);
|
|
543
|
+
const snapshot = (0, react.useCallback)(() => enabled ? readers.get(query)?.get(target)?.state.getSnapshot() ?? EMPTY : EMPTY, [
|
|
544
|
+
enabled,
|
|
545
|
+
query,
|
|
546
|
+
target
|
|
547
|
+
]);
|
|
548
|
+
const state = (0, react.useSyncExternalStore)(retain, snapshot, snapshot);
|
|
549
|
+
const refresh = (0, react.useCallback)(() => {
|
|
550
|
+
readers.get(query)?.get(target)?.refresh();
|
|
551
|
+
}, [query, target]);
|
|
552
|
+
return {
|
|
553
|
+
...state,
|
|
554
|
+
refresh
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region lib/types/client/OpenPathAction.js
|
|
559
|
+
/** File association adapter for the shared file/directory opening control. */
|
|
560
|
+
/**
|
|
561
|
+
* Resolve file associations and adapt operations without embedding platform behavior in the control.
|
|
562
|
+
* @param props - verified file path, desktop query, native operations, and display variant.
|
|
563
|
+
* @returns the shared opening control, or null without a desktop.
|
|
564
|
+
*/
|
|
565
|
+
function FileOpenTarget(props) {
|
|
566
|
+
const desktop = props.useOpenInAppDesktop((value) => value);
|
|
567
|
+
const association = useFileApplications(props.absolutePath, props.applications, desktop === true);
|
|
568
|
+
(0, react.useEffect)(() => {
|
|
569
|
+
if (desktop === null) props.loadDesktop();
|
|
570
|
+
}, [desktop, props.loadDesktop]);
|
|
571
|
+
if (desktop !== true) return null;
|
|
572
|
+
const { apps } = association;
|
|
573
|
+
return (0, react_jsx_runtime.jsx)(OpenTargetButton, {
|
|
574
|
+
kind: "file",
|
|
575
|
+
applications: apps,
|
|
576
|
+
defaultId: apps.find((app) => app.default)?.id,
|
|
577
|
+
loading: association.loading,
|
|
578
|
+
failed: association.failed,
|
|
579
|
+
prominent: props.empty === true,
|
|
580
|
+
t: props.t,
|
|
581
|
+
refresh: association.refresh,
|
|
582
|
+
execute: (operation) => props.openPath(props.absolutePath, operation.kind === "reveal" ? "reveal" : "open", operation.kind === "application" ? operation.id : void 0)
|
|
583
|
+
}, props.absolutePath);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Render the file adapter in the document header.
|
|
587
|
+
* @param props - document owner inputs and injected opening capabilities.
|
|
588
|
+
* @returns the shared split button.
|
|
589
|
+
*/
|
|
590
|
+
function OpenPathAction(props) {
|
|
591
|
+
return (0, react_jsx_runtime.jsx)(FileOpenTarget, { ...props });
|
|
592
|
+
}
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region ../../util/native-command/src/types.ts
|
|
595
|
+
/**
|
|
596
|
+
* Validate file association metadata received from a native process or authenticated Host.
|
|
597
|
+
* @param value - decoded application list.
|
|
598
|
+
* @returns validated application metadata.
|
|
599
|
+
* @throws Error for malformed entries or unsupported icon URLs.
|
|
600
|
+
*/
|
|
601
|
+
function parseNativeFileApplications(value) {
|
|
602
|
+
if (!Array.isArray(value)) throw new Error("Invalid native application list");
|
|
603
|
+
const applications = [];
|
|
604
|
+
const entries = value;
|
|
605
|
+
for (const entry of entries) {
|
|
606
|
+
if (typeof entry !== "object" || entry === null || !("id" in entry) || !("name" in entry) || !("default" in entry) || !("icon" in entry) || typeof entry.id !== "string" || entry.id.length === 0 || typeof entry.name !== "string" || typeof entry.default !== "boolean" || !(entry.icon === null || typeof entry.icon === "string" && /^data:image\/(?:png|svg\+xml);base64,[A-Za-z0-9+/=]+$/.test(entry.icon))) throw new Error("Invalid native application entry");
|
|
607
|
+
applications.push({
|
|
608
|
+
id: entry.id,
|
|
609
|
+
name: entry.name,
|
|
610
|
+
default: entry.default,
|
|
611
|
+
icon: entry.icon
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
return applications;
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region lib/types/client/FileRouteAction.js
|
|
618
|
+
async function queryRoute(url, signal) {
|
|
619
|
+
try {
|
|
620
|
+
const response = await fetch(url, { signal });
|
|
621
|
+
if (!response.ok) return null;
|
|
622
|
+
return parseNativeFileApplications(await response.json());
|
|
623
|
+
} catch (_error) {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Render file actions without bypassing the owning Session's authorization route.
|
|
629
|
+
* @param props - authenticated route, desktop availability, and native gesture callback.
|
|
630
|
+
* @returns the shared compact control, or null without a desktop.
|
|
631
|
+
*/
|
|
632
|
+
function FileRouteAction(props) {
|
|
633
|
+
const association = useFileApplications(props.actionUrl, queryRoute, props.available);
|
|
634
|
+
if (!props.available) return null;
|
|
635
|
+
return (0, react_jsx_runtime.jsx)(OpenTargetButton, {
|
|
636
|
+
kind: "file",
|
|
637
|
+
applications: association.apps,
|
|
638
|
+
defaultId: association.apps.find((app) => app.default)?.id,
|
|
639
|
+
failed: association.failed,
|
|
640
|
+
loading: association.loading,
|
|
641
|
+
busy: props.pending,
|
|
642
|
+
refresh: association.refresh,
|
|
643
|
+
t: props.t,
|
|
644
|
+
execute: async (operation) => {
|
|
645
|
+
return props.onAction(operation.kind === "reveal" ? "reveal" : "open", operation.kind === "application" ? operation.id : void 0);
|
|
646
|
+
}
|
|
647
|
+
}, props.actionUrl);
|
|
648
|
+
}
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region lib/types/client/OpenPathEmptyAction.js
|
|
651
|
+
/**
|
|
652
|
+
* Render the shared file opening menu with a larger labeled main button.
|
|
653
|
+
* @param props - unpreviewable file and injected opening capabilities.
|
|
654
|
+
* @returns the shared file opening action.
|
|
655
|
+
*/
|
|
656
|
+
function OpenPathEmptyAction(props) {
|
|
657
|
+
return (0, react_jsx_runtime.jsx)(FileOpenTarget, {
|
|
658
|
+
...props,
|
|
659
|
+
empty: true
|
|
314
660
|
});
|
|
315
661
|
}
|
|
316
662
|
//#endregion
|
|
317
663
|
//#region lib/types/client/locales.js
|
|
318
|
-
/** `open-in-app` namespace dictionaries. */
|
|
664
|
+
/** `open-in-app` namespace dictionaries: the workspace split button and the document-preview path controls. */
|
|
319
665
|
/** Dictionary namespace owned by this plugin. */
|
|
320
666
|
const NS = "open-in-app";
|
|
321
667
|
/** Application labels shared verbatim by both dictionaries (product names). */
|
|
@@ -353,11 +699,17 @@ window.__ModuleLoader__.load({
|
|
|
353
699
|
};
|
|
354
700
|
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
355
701
|
const zh = {
|
|
356
|
-
"open.title": "
|
|
702
|
+
"open.title": "用 {app} 打开",
|
|
703
|
+
"path.appDefault": "{app}(默认)",
|
|
704
|
+
"path.appsError": "无法获取应用列表",
|
|
705
|
+
"shortcut.busy": "正在打开工作区",
|
|
706
|
+
"shortcut.unavailable": "当前工作区或本地应用不可用",
|
|
357
707
|
"open.tooltip": "在本地打开",
|
|
358
|
-
"open
|
|
359
|
-
"
|
|
360
|
-
"
|
|
708
|
+
"path.open": "打开",
|
|
709
|
+
"path.more": "更多打开方式",
|
|
710
|
+
"path.reveal": "显示文件位置",
|
|
711
|
+
"path.openError": "打开失败,请重试",
|
|
712
|
+
"path.revealError": "无法显示文件位置,请重试",
|
|
361
713
|
...PRODUCT_NAMES,
|
|
362
714
|
"app.finder": "访达",
|
|
363
715
|
"app.explorer": "文件资源管理器",
|
|
@@ -366,11 +718,17 @@ window.__ModuleLoader__.load({
|
|
|
366
718
|
};
|
|
367
719
|
/** English dictionary, key-identical to the Chinese source of truth. */
|
|
368
720
|
const en = {
|
|
369
|
-
"open.title": "Open
|
|
721
|
+
"open.title": "Open in {app}",
|
|
722
|
+
"path.appDefault": "{app} (default)",
|
|
723
|
+
"path.appsError": "Could not load applications",
|
|
724
|
+
"shortcut.busy": "Opening workspace",
|
|
725
|
+
"shortcut.unavailable": "Current workspace or local application unavailable",
|
|
370
726
|
"open.tooltip": "Open locally",
|
|
371
|
-
"open
|
|
372
|
-
"
|
|
373
|
-
"
|
|
727
|
+
"path.open": "Open",
|
|
728
|
+
"path.more": "More ways to open",
|
|
729
|
+
"path.reveal": "Show file location",
|
|
730
|
+
"path.openError": "Could not open. Try again.",
|
|
731
|
+
"path.revealError": "Could not show the file location. Try again.",
|
|
374
732
|
...PRODUCT_NAMES,
|
|
375
733
|
"app.finder": "Finder",
|
|
376
734
|
"app.explorer": "File Explorer",
|
|
@@ -380,29 +738,91 @@ window.__ModuleLoader__.load({
|
|
|
380
738
|
//#endregion
|
|
381
739
|
//#region lib/types/client/index.js
|
|
382
740
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* apps route; the last choice persists in the browser through the controller's
|
|
387
|
-
* persisted snapshot store.
|
|
741
|
+
* Shared native opening controls for workspace directories, document previews,
|
|
742
|
+
* delivery cards, and changed-file review. Directory choices persist in the browser;
|
|
743
|
+
* file defaults and application lists come from the serving Host desktop.
|
|
388
744
|
*/
|
|
389
|
-
/** Required services
|
|
745
|
+
/** Required services: sessions, layout selection, the slot registry, copy, Remote calls, and shortcuts. */
|
|
390
746
|
const inject = [
|
|
391
747
|
"sessions",
|
|
392
748
|
"slots",
|
|
393
|
-
"locale"
|
|
749
|
+
"locale",
|
|
750
|
+
"remote",
|
|
751
|
+
"remote.session",
|
|
752
|
+
"shortcuts",
|
|
753
|
+
"layout"
|
|
394
754
|
];
|
|
395
755
|
/**
|
|
396
|
-
* Client plugin body: register the dictionaries
|
|
756
|
+
* Client plugin body: register the dictionaries, the header split button, and
|
|
757
|
+
* the document preview's path controls.
|
|
397
758
|
* @param ctx - client root context.
|
|
398
759
|
*/
|
|
399
760
|
function apply(ctx) {
|
|
400
761
|
const controller = new OpenInAppController();
|
|
401
762
|
controller.load();
|
|
763
|
+
const paths = new OpenInAppPathController(ctx.remote);
|
|
402
764
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
403
765
|
zh,
|
|
404
766
|
en
|
|
405
767
|
}), "open-in-app: dictionaries");
|
|
768
|
+
const t = ctx.locale.bind(NS);
|
|
769
|
+
const target = () => {
|
|
770
|
+
if (ctx.layout.panelInfo.getSnapshot().activePanelId !== null) return void 0;
|
|
771
|
+
const session = Object.values(ctx.sessions.list.getSnapshot().byId).find((row) => (row.retainedBy.mainView ?? 0) > 0);
|
|
772
|
+
const appId = controller.currentApp();
|
|
773
|
+
return session?.cwd && appId !== void 0 ? {
|
|
774
|
+
appId,
|
|
775
|
+
path: session.cwd
|
|
776
|
+
} : void 0;
|
|
777
|
+
};
|
|
778
|
+
ctx.effect(() => ctx.shortcuts.register({
|
|
779
|
+
id: "workspace.openLocal",
|
|
780
|
+
label: () => t("open.tooltip"),
|
|
781
|
+
aliases: ["open workspace locally", "open in app"],
|
|
782
|
+
defaults: {
|
|
783
|
+
"desktop:macos": {
|
|
784
|
+
code: "KeyO",
|
|
785
|
+
modifiers: ["primary", "alt"]
|
|
786
|
+
},
|
|
787
|
+
"desktop:windows": {
|
|
788
|
+
code: "KeyO",
|
|
789
|
+
modifiers: ["primary", "alt"]
|
|
790
|
+
},
|
|
791
|
+
"desktop:linux": {
|
|
792
|
+
code: "KeyO",
|
|
793
|
+
modifiers: ["primary", "alt"]
|
|
794
|
+
},
|
|
795
|
+
"web:macos": {
|
|
796
|
+
code: "KeyO",
|
|
797
|
+
modifiers: ["primary", "shift"]
|
|
798
|
+
},
|
|
799
|
+
"web:windows": {
|
|
800
|
+
code: "KeyO",
|
|
801
|
+
modifiers: ["primary", "shift"]
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
regions: ["page", "editable"],
|
|
805
|
+
modals: [],
|
|
806
|
+
resolve: () => {
|
|
807
|
+
if (controller.operation.getSnapshot().phase === "busy") return {
|
|
808
|
+
status: "blocked",
|
|
809
|
+
reason: t("shortcut.busy")
|
|
810
|
+
};
|
|
811
|
+
const selected = target();
|
|
812
|
+
if (selected === void 0) return {
|
|
813
|
+
status: "blocked",
|
|
814
|
+
reason: t("shortcut.unavailable")
|
|
815
|
+
};
|
|
816
|
+
return {
|
|
817
|
+
status: "handled",
|
|
818
|
+
run: () => {
|
|
819
|
+
controller.launch(selected.appId, selected.path).catch((error) => {
|
|
820
|
+
console.warn("workspace open rejected:", error);
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
}), "open-in-app: workspace command");
|
|
406
826
|
ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
407
827
|
name: "conversation.session.header.utilities",
|
|
408
828
|
id: "open-in-app",
|
|
@@ -411,15 +831,46 @@ window.__ModuleLoader__.load({
|
|
|
411
831
|
inject: () => ({
|
|
412
832
|
hooks: {
|
|
413
833
|
openInAppApps: controller.apps,
|
|
414
|
-
openInAppChoice: controller.choice
|
|
834
|
+
openInAppChoice: controller.choice,
|
|
835
|
+
openInAppLaunch: controller.operation,
|
|
836
|
+
shortcuts: ctx.shortcuts.catalog
|
|
415
837
|
},
|
|
416
838
|
launch: (appId, path) => controller.launch(appId, path),
|
|
417
839
|
choose: (appId) => {
|
|
418
840
|
controller.choose(appId);
|
|
419
841
|
},
|
|
420
|
-
iconUrl: (appId) => `${
|
|
842
|
+
iconUrl: (appId) => `${OPEN_IN_APP_ICON_PREFIX_ROUTE}/${appId}`
|
|
421
843
|
})
|
|
422
844
|
}, OpenInAppAction));
|
|
845
|
+
const applications = (path, signal) => paths.applications(path, signal);
|
|
846
|
+
const pathInjected = () => ({
|
|
847
|
+
hooks: { openInAppDesktop: paths.desktop },
|
|
848
|
+
loadDesktop: () => paths.load(),
|
|
849
|
+
openPath: (path, action, application) => paths.openPath(path, action, application),
|
|
850
|
+
applications
|
|
851
|
+
});
|
|
852
|
+
ctx.slots.inject("sidebar.right.tab.document.actions", () => ctx.slots.register({
|
|
853
|
+
name: "sidebar.right.tab.document.actions",
|
|
854
|
+
id: "open-in-app",
|
|
855
|
+
locale: NS,
|
|
856
|
+
inject: pathInjected
|
|
857
|
+
}, OpenPathAction));
|
|
858
|
+
ctx.slots.inject("sidebar.right.tab.document.unpreviewable", () => ctx.slots.register({
|
|
859
|
+
name: "sidebar.right.tab.document.unpreviewable",
|
|
860
|
+
id: "open-in-app",
|
|
861
|
+
locale: NS,
|
|
862
|
+
inject: pathInjected
|
|
863
|
+
}, OpenPathEmptyAction));
|
|
864
|
+
ctx.slots.inject("deliverables.file.actions", () => ctx.slots.register({
|
|
865
|
+
name: "deliverables.file.actions",
|
|
866
|
+
id: "open-in-app",
|
|
867
|
+
locale: NS
|
|
868
|
+
}, FileRouteAction));
|
|
869
|
+
ctx.slots.inject("deliverables.review.file.actions", () => ctx.slots.register({
|
|
870
|
+
name: "deliverables.review.file.actions",
|
|
871
|
+
id: "open-in-app",
|
|
872
|
+
locale: NS
|
|
873
|
+
}, FileRouteAction));
|
|
423
874
|
}
|
|
424
875
|
//#endregion
|
|
425
876
|
exports.apply = apply;
|