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.
Files changed (118) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/THIRD_PARTY_NOTICES.md +2011 -449
  5. package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
  6. package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
  7. package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
  8. package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
  9. package/dist/assets/index-Cq6ljTv2.css +1 -0
  10. package/dist/assets/index-Dy0OhsZ5.js +127 -0
  11. package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
  12. package/dist/assets/langs/bat-BkioyH1T.js +2 -0
  13. package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
  14. package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
  15. package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
  16. package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
  17. package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
  18. package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
  19. package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
  20. package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
  21. package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
  22. package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
  23. package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
  24. package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
  25. package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
  26. package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
  27. package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
  28. package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
  29. package/dist/assets/langs/html-fwsONPVS.js +2 -0
  30. package/dist/assets/langs/http-DcV90OkR.js +2 -0
  31. package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
  32. package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
  33. package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
  34. package/dist/assets/langs/log-2UxHyX5q.js +2 -0
  35. package/dist/assets/langs/make-CHLpvVh8.js +2 -0
  36. package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
  37. package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
  38. package/dist/assets/langs/php-LEPfNACG.js +2 -0
  39. package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
  40. package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
  41. package/dist/assets/langs/r-Dspwwk_N.js +2 -0
  42. package/dist/assets/langs/rst-BbocfKWr.js +2 -0
  43. package/dist/assets/langs/ruby-R292Iif0.js +2 -0
  44. package/dist/assets/langs/scala-C151Ov-r.js +2 -0
  45. package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
  46. package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
  47. package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
  48. package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
  49. package/dist/assets/langs/vue-Dq2x6432.js +2 -0
  50. package/dist/favicon-dark.svg +3 -0
  51. package/dist/favicon.svg +0 -5
  52. package/dist/index.html +5 -4
  53. package/dist/manifest.webmanifest +3 -4
  54. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
  55. package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
  56. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
  57. package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
  58. package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
  59. package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
  60. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
  61. package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
  62. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
  63. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
  64. package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
  65. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
  66. package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
  67. package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
  68. package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
  69. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
  70. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
  71. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
  72. package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
  73. package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
  74. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
  75. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
  76. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
  77. package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
  78. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
  79. package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
  80. package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
  81. package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
  82. package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
  83. package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
  84. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
  85. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
  86. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
  87. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
  88. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
  89. package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
  90. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
  91. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
  92. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
  93. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
  94. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
  95. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
  96. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
  97. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
  98. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
  99. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
  100. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
  101. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
  103. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
  104. package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
  105. package/package.json +96 -86
  106. package/scripts/cli.mjs +16 -4
  107. package/scripts/install.d.mts +12 -2
  108. package/scripts/install.mjs +36 -9
  109. package/scripts/legal-files.mjs +15 -0
  110. package/worker/direct/index.js +2564 -1822
  111. package/worker/isolated/index.js +2144 -1402
  112. package/dist/assets/index-BKQ_L1z6.js +0 -117
  113. package/dist/assets/index-DPX2bQLO.css +0 -1
  114. package/dist/assets/langs/html-CfGypltT.js +0 -2
  115. package/dist/assets/langs/php-DJl5gRdb.js +0 -2
  116. package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
  118. 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
- //#region ../../host/open-in-app/src/shared.ts
12
- /**
13
- * Route paths and wire payloads shared verbatim by the host routes and the
14
- * browser package (`@deepseek-ai/dsh-client-ui-open-in-app`), published as
15
- * the `./shared` subpath. Browser-safe: constants and types only.
16
- */
17
- /** GET route serving the probed application ids. */
18
- const OPEN_IN_APP_APPS_ROUTE = "/open-in-app/apps";
19
- /** GET prefix serving one PNG bundle icon per application id. */
20
- const OPEN_IN_APP_ICON_PREFIX = "/open-in-app/icon";
21
- /** POST route launching one application on one workspace directory. */
22
- const OPEN_IN_APP_OPEN_ROUTE = "/open-in-app/open";
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
- const response = await this.fetcher(new URL(OPEN_IN_APP_OPEN_ROUTE, hostBase()), {
77
- method: "POST",
78
- headers: { "content-type": "application/json" },
79
- body: JSON.stringify(body)
80
- });
81
- if (!response.ok) throw new Error(`open failed: HTTP ${String(response.status)}`);
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(new URL(OPEN_IN_APP_APPS_ROUTE, hostBase()), { headers: { accept: "application/json" } });
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 \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-open-in-app/src/client/OpenInAppAction.module.css.mjs
97
- const css = ".CAgGvG_split{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);height:28px;font-family:var(--dsw-font-family);border-radius:14px;align-items:stretch;display:inline-flex;overflow:hidden}.CAgGvG_main,.CAgGvG_chevron{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;background:0 0;border:0;align-items:center;gap:5px;font-size:11px;font-weight:400;line-height:16px;display:inline-flex}.CAgGvG_main{padding:5px 6px 5px 7px}.CAgGvG_main:hover:not(:disabled),.CAgGvG_main:focus-visible,.CAgGvG_chevron:hover,.CAgGvG_chevron:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.CAgGvG_main:disabled{color:var(--dsw-alias-label-dimmed);cursor:wait}.CAgGvG_main[data-state=error]{color:var(--dsw-alias-state-error-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-error-primary)}.CAgGvG_chevron{border-left:.5px solid var(--dsw-alias-border-l4);color:var(--dsw-alias-label-secondary);padding:5px 6px 5px 4px}.CAgGvG_icon{flex:none}img.CAgGvG_icon{object-fit:contain;user-select:none;display:block}";
98
- const tagId = "@deepseek-ai/dsh-client-ui-open-in-app/OpenInAppAction.module.css";
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 OpenInAppAction_module_css_default = {
107
- "chevron": "CAgGvG_chevron",
108
- "icon": "CAgGvG_icon",
109
- "main": "CAgGvG_main",
110
- "split": "CAgGvG_split"
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/OpenInAppAction.js
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
- * One application's real bundle icon (host-served PNG) with an inline generic
159
- * app-square fallback while the host has none.
160
- * @param props - catalog id, host icon URL, and rendered size.
161
- * @returns the icon image or its fallback glyph.
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 AppIcon({ id, url, size }) {
164
- const [failed, setFailed] = (0, react.useState)(failedIcons.has(id));
165
- if (failed) return (0, react_jsx_runtime.jsx)("svg", {
166
- width: size,
167
- height: size,
168
- viewBox: "0 0 24 24",
169
- fill: "none",
170
- stroke: "currentColor",
171
- strokeWidth: 1.8,
172
- className: OpenInAppAction_module_css_default.icon,
173
- "aria-hidden": true,
174
- children: (0, react_jsx_runtime.jsx)("rect", {
175
- x: 3,
176
- y: 3,
177
- width: 18,
178
- height: 18,
179
- rx: 5
180
- })
181
- });
182
- return (0, react_jsx_runtime.jsx)("img", {
183
- src: url,
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: OpenInAppAction_module_css_default.icon,
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
- * Quick launches settle well under this delay, so their busy dress never
198
- * paints — the visible dim-and-wait treatment is reserved for launches that
199
- * are actually taking a while, instead of flashing on every click.
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 OpenInAppAction(props) {
213
- const { sessionId, useSessions, useOpenInAppApps, useOpenInAppChoice, t } = props;
214
- const cwd = useSessions((state) => state.byId[sessionId]?.cwd);
215
- const available = useOpenInAppApps((apps) => apps);
216
- const choice = useOpenInAppChoice((id) => id);
217
- const [open, setOpen] = (0, react.useState)(false);
218
- const [phase, setPhase] = (0, react.useState)("idle");
219
- const inFlight = (0, react.useRef)(false);
220
- const busyTimer = (0, react.useRef)(void 0);
221
- const errorTimer = (0, react.useRef)(void 0);
222
- (0, react.useEffect)(() => () => {
223
- clearTimeout(busyTimer.current);
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
- return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
258
- open,
259
- align: "end",
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
- selection: "fill",
299
+ align: "end",
262
300
  onClose: () => {
263
- setOpen(false);
301
+ setMenuOpen(false);
264
302
  },
265
- items: apps.map((entry) => ({
266
- id: entry.id,
267
- label: t(entry.labelKey),
268
- icon: (0, react_jsx_runtime.jsx)(AppIcon, {
269
- id: entry.id,
270
- url: props.iconUrl(entry.id),
271
- size: 18
272
- })
273
- })),
274
- selectedId: current,
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
- setOpen(false);
277
- if (inFlight.current) return;
278
- props.choose(id);
279
- launch(id);
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: OpenInAppAction_module_css_default.split,
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
- label: phase === "error" ? t("open.error") : t("open.tooltip"),
330
+ portal: true,
331
+ label: primaryLabel,
332
+ shortcutKeys: props.shortcut?.keys,
285
333
  side: "bottom",
286
- children: (0, react_jsx_runtime.jsx)("button", {
334
+ delayMs: 500,
335
+ children: (0, react_jsx_runtime.jsxs)("button", {
287
336
  type: "button",
288
- className: OpenInAppAction_module_css_default.main,
289
- "data-state": phase,
290
- disabled: phase === "busy",
291
- "aria-label": title,
292
- onClick: () => {
293
- launch(current);
294
- },
295
- children: (0, react_jsx_runtime.jsx)(AppIcon, {
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: OpenInAppAction_module_css_default.chevron,
304
- "aria-expanded": open,
348
+ className: OpenTargetButton_module_css_default.chevron,
349
+ disabled,
305
350
  "aria-haspopup": "menu",
306
- title: t("menu.toggle"),
307
- "aria-label": t("menu.toggle"),
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
- setOpen((value) => !value);
355
+ if (!menuOpen) props.refresh?.();
356
+ setMenuOpen((value) => !value);
310
357
  },
311
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { size: 11 })
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": "在 {app} 中打开工作目录",
702
+ "open.title": "用 {app} 打开",
703
+ "path.appDefault": "{app}(默认)",
704
+ "path.appsError": "无法获取应用列表",
705
+ "shortcut.busy": "正在打开工作区",
706
+ "shortcut.unavailable": "当前工作区或本地应用不可用",
357
707
  "open.tooltip": "在本地打开",
358
- "open.error": "打开失败",
359
- "menu.toggle": "选择打开方式",
360
- "menu.aria": "打开方式",
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 workspace in {app}",
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.error": "Failed to open",
372
- "menu.toggle": "Choose an app to open in",
373
- "menu.aria": "Open in",
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
- * Browser half of open-in-app: one Session-header split button opening the
384
- * session's workspace directory (the summary's `cwd`) in the remembered
385
- * installed application. Availability arrives once per page from the host
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 for locale registration and the header-slot contribution. */
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 and the header split button.
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) => `${OPEN_IN_APP_ICON_PREFIX}/${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;