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
@@ -4,243 +4,215 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- let _deepseek_ai_cordis = require("@deepseek-ai/cordis");
8
7
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
8
+ let _deepseek_ai_cordis = require("@deepseek-ai/cordis");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let react = require("react");
11
11
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
12
- //#region lib/types/client/navigation.js
13
- /** Workspace archive and directory UI capability. */
14
- /** Structured directory failure exposed to directory UI consumers. */
15
- var DirectoryBrowseError = class extends Error {
16
- rpcError;
17
- name = "DirectoryBrowseError";
18
- /** @param rpcError - Host directory business failure. */
19
- constructor(rpcError) {
20
- super(`directory browse failed: ${rpcError.code}: ${rpcError.message}`);
21
- this.rpcError = rpcError;
22
- }
23
- };
24
- /** Implements Workspace archive and directory UI operations. */
25
- var UiWorkspaceService = class extends _deepseek_ai_cordis.Service {
26
- directoryPicker;
27
- workspaces;
28
- sessions;
29
- connecting = /* @__PURE__ */ new Map();
30
- lifetime = new AbortController();
31
- /**
32
- * @param ctx - Client root Context.
33
- * @param directoryPicker - the directory-picking Remote namespace.
34
- * @param workspaces - pure Workspace Controller.
35
- * @param sessions - pure Session Controller.
36
- */
37
- constructor(ctx, directoryPicker, workspaces, sessions) {
38
- super(ctx, "uiWorkspace");
39
- this.directoryPicker = directoryPicker;
40
- this.workspaces = workspaces;
41
- this.sessions = sessions;
42
- ctx.effect(() => this.watchNavigation(), "ui-workspace: Workspace navigation policy");
43
- }
44
- async connectWorkspace(workspaceId) {
45
- const workspace = this.workspaces.list.getSnapshot().items.find((item) => item.workspaceId === workspaceId);
46
- if (workspace === void 0) throw new Error(`uiWorkspace.connectWorkspace: unknown workspace ${workspaceId}`);
47
- const inflight = this.connecting.get(workspaceId);
48
- if (inflight !== void 0) return inflight;
49
- const archived = this.workspaces.list.getSnapshot().archivedSessionIds;
50
- const sessions = this.sessions.list.getSnapshot();
51
- for (const id of sessions.ids) {
52
- const summary = sessions.byId[id];
53
- if (summary !== void 0 && summary.blank && summary.cwd === workspace.path && workspace.sessionIds.includes(summary.id) && !archived.includes(summary.id)) return summary.id;
54
- }
55
- const attempt = this.sessions.create({ workspaceId }).finally(() => {
56
- this.connecting.delete(workspaceId);
57
- });
58
- this.connecting.set(workspaceId, attempt);
59
- return attempt;
60
- }
61
- openSession(sessionId) {
62
- this.sessions.open(sessionId);
63
- this.ctx.layout.selectPanel(null);
64
- }
65
- async openWorkspace(workspaceId, beforeOpen) {
66
- const navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);
67
- const isCurrent = () => !navigation.aborted;
68
- const sessionId = await this.connectWorkspace(workspaceId);
69
- if (!isCurrent()) return;
70
- beforeOpen?.(sessionId);
71
- if (isCurrent()) this.openSession(sessionId);
72
- }
73
- async forkSession(sessionId) {
74
- const navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);
75
- const childId = await this.sessions.fork({
76
- sessionId,
77
- increaseTitle: true
78
- });
79
- if (!navigation.aborted) this.openSession(childId);
80
- }
81
- startSession(workspaceId) {
82
- const workspace = this.workspaces.list.getSnapshot();
83
- const sessions = this.sessions.list.getSnapshot();
84
- const current = sessions.current;
85
- const currentWorkspaceId = current === void 0 ? void 0 : workspace.items.find((item) => item.sessionIds.includes(current))?.workspaceId;
86
- const recent = workspace.phase === "ready" && sessions.phase === "ready" ? recentWorkspace(workspace.items, sessions.byId) : void 0;
87
- const target = workspaceId ?? currentWorkspaceId ?? recent;
88
- if (target === void 0) {
89
- this.sessions.clear();
90
- this.ctx.layout.selectPanel(null);
91
- return;
92
- }
93
- this.openWorkspace(target).catch((reason) => {
94
- console.warn("new session failed:", reason);
95
- });
96
- }
97
- async archiveSession(sessionId) {
98
- await this.workspaces.archiveSession(sessionId);
99
- }
100
- async pickDirectory() {
101
- const result = await this.directoryPicker.pick();
102
- if (!result.ok) throw new Error(`directory picker failed: ${result.error.message}`);
103
- return result.value;
104
- }
105
- async listDirectory(path, signal) {
106
- const result = await this.directoryPicker.list(path, signal);
107
- if (!result.ok) throw new DirectoryBrowseError(result.error);
108
- return result.value;
109
- }
110
- async createDirectory(path, name) {
111
- const result = await this.directoryPicker.createDirectory(path, name);
112
- if (!result.ok) throw new DirectoryBrowseError(result.error);
113
- return result.value;
114
- }
115
- watchNavigation() {
116
- let initial = "waiting";
117
- const reconcile = () => {
118
- if (this.lifetime.signal.aborted) return;
119
- if (this.clearArchivedCurrent()) return;
120
- if (initial !== "waiting") return;
121
- const workspace = this.workspaces.list.getSnapshot();
122
- const sessions = this.sessions.list.getSnapshot();
123
- if (workspace.phase !== "ready" || sessions.phase !== "ready") return;
124
- if (sessions.current !== void 0) {
125
- initial = "done";
126
- return;
127
- }
128
- const target = recentWorkspace(workspace.items, sessions.byId);
129
- if (target === void 0) {
130
- initial = "done";
131
- return;
132
- }
133
- initial = "connecting";
134
- this.connectWorkspace(target).then((sessionId) => {
135
- if (this.lifetime.signal.aborted) return;
136
- if (this.sessions.list.getSnapshot().current === void 0) this.sessions.open(sessionId);
137
- initial = "done";
138
- }, (reason) => {
139
- if (this.lifetime.signal.aborted) return;
140
- initial = "waiting";
141
- console.warn("initial workspace selection failed:", reason);
142
- });
143
- };
144
- const disposeWorkspaces = this.workspaces.list.subscribe(reconcile);
145
- const disposeSessions = this.sessions.list.subscribe(reconcile);
146
- reconcile();
147
- return () => {
148
- this.lifetime.abort();
149
- disposeSessions();
150
- disposeWorkspaces();
151
- };
152
- }
153
- /** @returns true when an archived current selection was cleared. */
154
- clearArchivedCurrent() {
155
- const current = this.sessions.list.getSnapshot().current;
156
- if (current === void 0 || !this.workspaces.list.getSnapshot().archivedSessionIds.includes(current)) return false;
157
- this.sessions.clear();
158
- return true;
159
- }
160
- };
161
- /** Stable tie-breaking follows Host Workspace order. */
162
- function recentWorkspace(workspaces, sessions) {
163
- let selected;
164
- let selectedTime = Number.NEGATIVE_INFINITY;
165
- for (const workspace of workspaces) {
166
- let latest = Number.NEGATIVE_INFINITY;
167
- for (const sessionId of workspace.sessionIds) {
168
- const session = sessions[sessionId];
169
- if (session !== void 0) latest = Math.max(latest, session.updatedAt);
170
- }
171
- if (latest === Number.NEGATIVE_INFINITY) latest = Date.parse(workspace.createdAt);
172
- if (selected === void 0 || latest > selectedTime) {
173
- selected = workspace.workspaceId;
174
- selectedTime = latest;
175
- }
176
- }
177
- return selected;
178
- }
12
+ //#region lib/types/client/contract/slots.js
13
+ /**
14
+ * Bind the row's render occurrence into the entries' `useMenuOpenState` hook:
15
+ * the owner supplies its open-state pair as the occurrence's `hookContext`,
16
+ * and the hook hands that pair back.
17
+ * @param _standard - framework standard props (unused).
18
+ * @param state - the menu's open-state pair from the render occurrence.
19
+ * @returns the hook the entry calls.
20
+ */
21
+ const menuOpenStateFactory = (_standard, state) => () => state;
179
22
  //#endregion
180
- //#region lib/types/client/stores.js
23
+ //#region lib/types/client/shortcuts.js
181
24
  /**
182
- * The workspace browser's viewing store: the session-list grouping mode,
183
- * persisted across reloads. Module level exports the factory only (a
184
- * module-level handle would pin the store identity across plugin reloads);
185
- * register() receives the factory and the browser derives its PropsStore
186
- * share from the return type.
25
+ * Create the private browser request source shared by commands and controls.
26
+ * @returns observable state and its complete mutation callbacks.
187
27
  */
188
- /** Browser-local order account for the hierarchy-free flat Session list. */
189
- const FLAT_SESSION_ORDER_KEY = "__flat_session_order__";
28
+ function createWorkspaceShortcutControls() {
29
+ const state = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
30
+ searchRequest: 0,
31
+ addRequested: false,
32
+ directoryBusy: false,
33
+ renameTarget: null,
34
+ forkError: null
35
+ });
36
+ let forkErrorSeq = 0;
37
+ return {
38
+ state,
39
+ search: () => {
40
+ state.set({
41
+ ...state.getSnapshot(),
42
+ searchRequest: state.getSnapshot().searchRequest + 1
43
+ });
44
+ },
45
+ add: () => {
46
+ state.set(state.getSnapshot().directoryBusy ? state.getSnapshot() : {
47
+ ...state.getSnapshot(),
48
+ addRequested: true
49
+ });
50
+ },
51
+ closeAdd: () => {
52
+ state.set({
53
+ ...state.getSnapshot(),
54
+ addRequested: false
55
+ });
56
+ },
57
+ directoryBusy: (busy) => {
58
+ state.set({
59
+ ...state.getSnapshot(),
60
+ directoryBusy: busy
61
+ });
62
+ },
63
+ rename: (sessionId, currentTitle) => {
64
+ state.set({
65
+ ...state.getSnapshot(),
66
+ renameTarget: {
67
+ sessionId,
68
+ currentTitle
69
+ }
70
+ });
71
+ },
72
+ closeRename: () => {
73
+ state.set({
74
+ ...state.getSnapshot(),
75
+ renameTarget: null
76
+ });
77
+ },
78
+ forkFailed: (reason) => {
79
+ forkErrorSeq += 1;
80
+ state.set({
81
+ ...state.getSnapshot(),
82
+ forkError: {
83
+ reason,
84
+ seq: forkErrorSeq
85
+ }
86
+ });
87
+ },
88
+ dismissForkError: () => {
89
+ state.set({
90
+ ...state.getSnapshot(),
91
+ forkError: null
92
+ });
93
+ }
94
+ };
95
+ }
190
96
  /**
191
- * Create the workspace browser viewing store handle.
192
- * @returns the store handle (spec + type + identity + factory in one).
97
+ * Register navigation commands against the existing workspace owner.
98
+ * @param ctx - plugin context with the shortcut, locale, and model services.
99
+ * @param navigation - session creation and forking from the pointer controls' navigation service.
100
+ * @param controls - browser-owned opening requests.
101
+ * @param archiveSession - shared archive action, including running-work confirmation and notices.
193
102
  */
194
- function createWorkspaceViewStore() {
195
- return (0, _deepseek_ai_dsh_client_store.defineStore)({
196
- init: () => ({
197
- groupBy: "workspace",
198
- orderBy: "updated",
199
- groupExpansion: {},
200
- sessionOrderByAccount: {},
201
- sessionUpdatedAtByAccount: {}
202
- }),
203
- persist: "dsh.workspace.view.v5",
204
- actions: {
205
- setGroupBy: (d, mode) => {
206
- d.groupBy = mode;
207
- },
208
- setOrderBy: (d, mode) => {
209
- d.orderBy = mode;
210
- },
211
- setGroupExpanded: (d, key, expanded) => {
212
- d.groupExpansion[key] = expanded;
213
- },
214
- retainAccountKeys: (d, workspaceKeys) => {
215
- const retained = new Set(workspaceKeys);
216
- d.groupExpansion = Object.fromEntries(Object.entries(d.groupExpansion).filter(([key]) => retained.has(key)));
217
- d.sessionOrderByAccount = Object.fromEntries(Object.entries(d.sessionOrderByAccount).filter(([key]) => retained.has(key)));
218
- d.sessionUpdatedAtByAccount = Object.fromEntries(Object.entries(d.sessionUpdatedAtByAccount).filter(([key]) => retained.has(key)));
219
- },
220
- syncSessionOrderAccount: (d, accountKey, order, updatedAt) => {
221
- d.sessionOrderByAccount[accountKey] = order;
222
- d.sessionUpdatedAtByAccount[accountKey] = updatedAt;
103
+ function installWorkspaceShortcuts(ctx, navigation, controls, archiveSession) {
104
+ const t = ctx.locale.bind("workspace");
105
+ const current = () => Object.values(ctx.sessions.list.getSnapshot().byId).find((row) => (row.retainedBy.mainView ?? 0) > 0);
106
+ const addReason = () => ctx.slots.entries("sidebar.workspaces.directoryFlow").length === 0 ? t("shortcut.noPicker") : controls.state.getSnapshot().directoryBusy ? t("shortcut.directoryBusy") : null;
107
+ const register = (id, label, aliases, code, modifiers, webModifiers, resolve) => {
108
+ ctx.effect(() => ctx.shortcuts.register({
109
+ id,
110
+ label,
111
+ aliases,
112
+ defaults: {
113
+ "desktop:macos": {
114
+ code,
115
+ modifiers
116
+ },
117
+ "desktop:windows": {
118
+ code,
119
+ modifiers
120
+ },
121
+ "desktop:linux": {
122
+ code,
123
+ modifiers
124
+ },
125
+ "web:macos": {
126
+ code,
127
+ modifiers: webModifiers
128
+ },
129
+ "web:windows": {
130
+ code,
131
+ modifiers: webModifiers
132
+ }
223
133
  },
224
- setSessionOrder: (d, accountKey, order) => {
225
- d.sessionOrderByAccount[accountKey] = order;
226
- }
134
+ regions: ["page", "editable"],
135
+ modals: [],
136
+ resolve
137
+ }), `ui-workspace: ${id}`);
138
+ };
139
+ register("session.new", () => t("session.new"), ["new session", "new chat"], "KeyN", ["primary"], ["primary", "alt"], () => ({
140
+ status: "handled",
141
+ run: () => {
142
+ navigation.startSession();
227
143
  }
144
+ }));
145
+ register("session.search", () => t("search.sessions.aria"), ["search sessions"], "KeyK", ["primary"], ["primary", "alt"], () => ({
146
+ status: "handled",
147
+ run: controls.search
148
+ }));
149
+ register("workspace.add", () => t("workspace.add"), ["add workspace", "open folder"], "KeyO", ["primary"], ["primary", "alt"], () => {
150
+ const reason = addReason();
151
+ return reason === null ? {
152
+ status: "handled",
153
+ run: controls.add
154
+ } : {
155
+ status: "blocked",
156
+ reason
157
+ };
158
+ });
159
+ register("session.rename", () => t("rename.session.title"), ["rename session"], "KeyR", ["primary", "alt"], ["primary", "shift"], () => {
160
+ const target = current();
161
+ return target === void 0 ? {
162
+ status: "blocked",
163
+ reason: t("shortcut.noSession")
164
+ } : {
165
+ status: "handled",
166
+ run: () => {
167
+ controls.rename(target.id, target.title?.trim() ?? "");
168
+ }
169
+ };
170
+ });
171
+ register("session.fork", () => t("menu.fork"), ["fork session"], "KeyF", ["primary", "alt"], ["primary", "shift"], () => {
172
+ const target = current();
173
+ if (target === void 0) return {
174
+ status: "blocked",
175
+ reason: t("shortcut.noSession")
176
+ };
177
+ if (target.blank) return {
178
+ status: "blocked",
179
+ reason: t("shortcut.noCompletedTurn")
180
+ };
181
+ return {
182
+ status: "handled",
183
+ run: () => {
184
+ navigation.forkSession(target.id).catch((error) => {
185
+ const unavailable = error instanceof Error && error.name === "SessionForkError" && error.rpcError.code === "session/fork-unavailable";
186
+ controls.forkFailed(unavailable ? "unavailable" : "failed");
187
+ if (!unavailable) console.warn("session fork rejected:", error);
188
+ });
189
+ }
190
+ };
191
+ });
192
+ register("session.archive", () => t("menu.archiveSession"), ["archive session"], "KeyA", ["primary", "shift"], ["primary", "alt"], () => {
193
+ const target = current();
194
+ return target === void 0 ? {
195
+ status: "blocked",
196
+ reason: t("shortcut.noSession")
197
+ } : {
198
+ status: "handled",
199
+ run: () => {
200
+ archiveSession(target.id);
201
+ }
202
+ };
228
203
  });
229
204
  }
230
205
  //#endregion
231
- //#region ../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
232
- function r(e) {
233
- var t, f, n = "";
234
- if ("string" == typeof e || "number" == typeof e) n += e;
235
- else if ("object" == typeof e) if (Array.isArray(e)) {
236
- var o = e.length;
237
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
238
- } else for (f in e) e[f] && (n && (n += " "), n += f);
239
- return n;
240
- }
241
- function clsx() {
242
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
243
- return n;
206
+ //#region ../../util/values/src/index.ts
207
+ /**
208
+ * Mark an unreachable closed-union branch.
209
+ * @param value - impossible value; an unhandled typed variant fails at the call site.
210
+ * @param context - optional switch-site label included in the failure message.
211
+ * @returns never; a runtime value that escaped its type always throws.
212
+ */
213
+ function assertNever$1(value, context) {
214
+ const rendered = JSON.stringify(value) ?? String(value);
215
+ throw new Error(`unreachable variant${context ? ` in ${context}` : ""}: ${rendered}`);
244
216
  }
245
217
  //#endregion
246
218
  //#region ../../util/workspace-path/src/index.ts
@@ -274,36 +246,6 @@ window.__ModuleLoader__.load({
274
246
  const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
275
247
  return trimmed.slice(separator + 1);
276
248
  }
277
- //#endregion
278
- //#region lib/types/client/subagent-lineage.js
279
- /** UI Workspace-owned projection of descendant counts from Session summaries. */
280
- /**
281
- * Index uninterrupted subagent descendants under each ancestor.
282
- * @param summaries - Session summaries keyed by id.
283
- * @returns descendant totals keyed by possible parent id.
284
- */
285
- function indexSubagentDescendants(summaries) {
286
- const indexed = /* @__PURE__ */ new Map();
287
- for (const descendant of Object.values(summaries)) {
288
- if (descendant.origin !== "subagent") continue;
289
- const seen = /* @__PURE__ */ new Set();
290
- let current = descendant;
291
- while (current?.origin === "subagent" && current.parentId !== void 0 && !seen.has(current.id)) {
292
- seen.add(current.id);
293
- const aggregate = indexed.get(current.parentId);
294
- if (aggregate === void 0) indexed.set(current.parentId, {
295
- count: 1,
296
- runningCount: descendant.running ? 1 : 0
297
- });
298
- else {
299
- aggregate.count += 1;
300
- if (descendant.running) aggregate.runningCount += 1;
301
- }
302
- current = summaries[current.parentId];
303
- }
304
- }
305
- return indexed;
306
- }
307
249
  /**
308
250
  * Resolve the Workspace browser group that owns one Session.
309
251
  * @param workspaces - authoritative Workspace membership.
@@ -313,6 +255,9 @@ window.__ModuleLoader__.load({
313
255
  function owningGroupKey(workspaces, sessionId) {
314
256
  return workspaces.find((workspace) => workspace.sessionIds.includes(sessionId))?.workspaceId ?? "";
315
257
  }
258
+ function mainSessionId(list) {
259
+ return Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
260
+ }
316
261
  /**
317
262
  * Directory display label: basename of the path (both separators accepted).
318
263
  * Ungrouped-bucket fallback for surfaces without a workspace title.
@@ -324,69 +269,155 @@ window.__ModuleLoader__.load({
324
269
  const base = workspaceTitleOf(cwd);
325
270
  return base !== "" ? base : cwd;
326
271
  }
327
- /** Recency comparator: newest first, id as the deterministic tiebreak (ids are unique per group). */
328
- function byRecency(a, b) {
329
- if (b.updatedAt !== a.updatedAt) return b.updatedAt - a.updatedAt;
330
- return a.id < b.id ? -1 : 1;
331
- }
332
272
  /**
333
- * Ordinary sessions are visible; among blank sessions, only the current one
334
- * is visible. Subagent children use their parent header catalog; archived
335
- * sessions are visible nowhere, while their accounting slots remain so
336
- * unarchiving restores position.
273
+ * Project known account members by current Session recency.
274
+ * @param sessionIds - authoritative account membership.
275
+ * @param summaries - current Session summaries; members without a summary are omitted until it arrives.
276
+ * @returns known members newest first, with Session identity as the deterministic tie-break.
337
277
  */
338
- function sessionVisible(session, current, archived) {
339
- return session.origin !== "subagent" && !archived.has(session.id) && (!session.blank || session.id === current);
278
+ function orderByRecency(sessionIds, summaries) {
279
+ return sessionIds.flatMap((id) => {
280
+ const summary = summaries[id];
281
+ if (summary === void 0) return [];
282
+ return [{
283
+ id,
284
+ rank: summary.updatedAt
285
+ }];
286
+ }).sort((a, b) => {
287
+ if (a.rank !== b.rank) return b.rank - a.rank;
288
+ return a.id < b.id ? -1 : 1;
289
+ }).map((member) => member.id);
340
290
  }
341
291
  /**
342
- * A blank session is the selected Workspace's provisional New Session row;
343
- * its canonical title never enters search (blank rows are query-excluded)
344
- * and the renderer localizes its display label.
292
+ * Reconcile a browser-local manual order with current account membership.
293
+ * New ordinary forks precede their sources without changing saved entries' relative order.
294
+ * @param memberIds - authoritative account membership.
295
+ * @param savedOrder - previously saved browser-local order.
296
+ * @param summaries - current Session metadata; unknown new members wait for their summaries.
297
+ * @param rowState - global pin and archive membership; only account members can supplement the order.
298
+ * @returns saved relative positions plus missing members ordered by pin, fork source, recency, and archive status.
345
299
  */
346
- function sessionTitle(session) {
347
- return session.blank ? "" : session.displayTitle;
300
+ function reconcileManualOrder(memberIds, savedOrder, summaries, rowState) {
301
+ const members = new Map(memberIds.map((id) => [id, id]));
302
+ const included = /* @__PURE__ */ new Set();
303
+ const ordered = [];
304
+ for (const key of savedOrder ?? []) {
305
+ const id = members.get(key);
306
+ if (id === void 0 || included.has(key)) continue;
307
+ ordered.push(id);
308
+ included.add(key);
309
+ }
310
+ const archived = new Set(rowState?.archivedSessionIds);
311
+ const pins = [];
312
+ for (const sessionId of rowState?.pinnedSessionIds ?? []) {
313
+ const id = members.get(sessionId);
314
+ if (id === void 0 || included.has(id) || archived.has(id) || summaries[id] === void 0) continue;
315
+ pins.push(id);
316
+ included.add(id);
317
+ }
318
+ const ordinary = [];
319
+ const archives = [];
320
+ for (const id of orderByRecency([...members.values()].filter((id) => !included.has(id)), summaries)) if (archived.has(id)) archives.push(id);
321
+ else ordinary.push(id);
322
+ const result = [
323
+ ...pins,
324
+ ...ordered,
325
+ ...ordinary,
326
+ ...archives
327
+ ];
328
+ const pending = new Set(ordinary);
329
+ const placeFork = (id) => {
330
+ if (!pending.delete(id)) return;
331
+ const parentId = summaries[id]?.parentId;
332
+ if (parentId === void 0 || parentId === id || !result.includes(parentId)) return;
333
+ placeFork(parentId);
334
+ result.splice(result.indexOf(id), 1);
335
+ result.splice(result.indexOf(parentId), 0, id);
336
+ };
337
+ for (const id of [...ordinary].reverse()) placeFork(id);
338
+ return result;
348
339
  }
349
- /** The list projection alone owns the best-effort active-Schedule indicator. */
350
- function hasActiveSchedule(session) {
351
- return (session.projectionValues?.schedule?.length ?? 0) > 0;
340
+ /**
341
+ * Keep the selected provisional New Session ahead of either base order.
342
+ * @param order - recency or reconciled manual order.
343
+ * @param currentBlank - selected blank Session in this account, when present.
344
+ * @returns a copy with the selected blank first and no duplicate slot.
345
+ */
346
+ function pinCurrentBlank(order, currentBlank) {
347
+ if (currentBlank === void 0) return [...order];
348
+ return [currentBlank, ...order.filter((id) => id !== currentBlank)];
352
349
  }
353
- /** Build one group without projecting session lineage into presentation. */
354
- function buildGroup(key, workspaceId, cwd, createdAt, label, members, order) {
355
- const sessions = [...members];
356
- if (order === "recency") sessions.sort(byRecency);
350
+ /**
351
+ * Ordinary sessions are visible; among blank sessions, only the current one
352
+ * is visible. Subagent children use their parent header catalog; archived
353
+ * sessions follow the archived filter, while their accounting slots remain
354
+ * either way so unarchiving restores position.
355
+ */
356
+ function sessionVisible(session, current, archived, archivedFilter) {
357
+ if (session.origin === "subagent") return false;
358
+ if (session.blank && session.id !== current) return false;
359
+ switch (archivedFilter) {
360
+ case "default": return !archived.has(session.id);
361
+ case "show": return true;
362
+ case "only": return archived.has(session.id);
363
+ /* v8 ignore next 2 -- closed-union backstop; only reached if the filter is forged */
364
+ default: return assertNever$1(archivedFilter);
365
+ }
366
+ }
367
+ /**
368
+ * Keep the visible New Session placeholder first, then partition pinned and
369
+ * ordinary rows without changing either partition's caller order.
370
+ */
371
+ function sectionMembers(members, pinned, archived) {
372
+ const placeholders = [];
373
+ const leading = [];
374
+ const rest = [];
375
+ for (const member of members) if (member.blank) placeholders.push(member);
376
+ else if (!archived.has(member.id) && pinned.has(member.id)) leading.push(member);
377
+ else rest.push(member);
378
+ return [
379
+ ...placeholders,
380
+ ...leading,
381
+ ...rest
382
+ ];
383
+ }
384
+ /**
385
+ * A blank session is the selected Workspace's provisional New Session row;
386
+ * its canonical title never enters search (blank rows are query-excluded)
387
+ * and the renderer localizes its display label. Unnamed history also yields an
388
+ * empty title for localization and does not match a directory-name title search.
389
+ */
390
+ function sessionTitle(session) {
391
+ return session.blank ? "" : session.title?.trim() ?? "";
392
+ }
393
+ /** Build one group without projecting session lineage into presentation. */
394
+ function buildGroup(key, workspaceId, cwd, createdAt, label, members) {
357
395
  return {
358
396
  key,
359
397
  workspaceId,
360
398
  cwd,
361
399
  createdAt,
362
400
  label,
363
- sessions
401
+ sessions: [...members]
364
402
  };
365
403
  }
366
404
  /** Apply a stored Ungrouped order and append newly loose Sessions by recency. */
367
- function orderedUngrouped(members, stored) {
405
+ function orderedUngrouped(members, stored, summaries) {
368
406
  const byId = new Map(members.map((session) => [session.id, session]));
369
- const included = /* @__PURE__ */ new Set();
370
- const ordered = [];
371
- for (const key of stored) {
372
- const session = byId.get(key);
373
- if (session === void 0 || included.has(key)) continue;
374
- ordered.push(session);
375
- included.add(key);
376
- }
377
- for (const session of [...members].sort(byRecency)) {
378
- if (included.has(session.id)) continue;
379
- ordered.push(session);
380
- }
381
- return ordered;
407
+ return (stored === void 0 ? orderByRecency(members.map((session) => session.id), summaries) : reconcileManualOrder(members.map((session) => session.id), stored, summaries)).flatMap((id) => {
408
+ const session = byId.get(id);
409
+ /* v8 ignore next -- ids are projected exclusively from the members used to build byId. */
410
+ return session === void 0 ? [] : [session];
411
+ });
382
412
  }
383
413
  /**
384
- * Group Sessions by Host Workspace: one group per entity in stable Host
385
- * order, with members resolved from sessionIds in their stored order. Sessions
386
- * outside every Workspace trail in the browser-local Ungrouped order, which
387
- * falls back to recency before that order is initialized.
414
+ * Group Sessions by Workspace: one group per caller-ordered entity, with
415
+ * members resolved from caller-ordered sessionIds. Sessions outside every
416
+ * Workspace trail in the browser-local Ungrouped order, which falls back to
417
+ * recency before that order is initialized.
388
418
  */
389
- function groupByWorkspace(list, workspaces, archived, ungroupedOrder) {
419
+ function groupByWorkspace(list, workspaces, archived, archivedFilter, ungroupedOrder) {
420
+ const current = mainSessionId(list);
390
421
  const groups = [];
391
422
  const accounted = /* @__PURE__ */ new Set();
392
423
  for (const workspace of workspaces) {
@@ -395,13 +426,14 @@ window.__ModuleLoader__.load({
395
426
  const summary = list.byId[id];
396
427
  if (summary === void 0) continue;
397
428
  accounted.add(id);
398
- if (!sessionVisible(summary, list.current, archived)) continue;
429
+ if (!sessionVisible(summary, current, archived, archivedFilter)) continue;
399
430
  members.push(summary);
400
431
  }
401
- groups.push(buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members, "account"));
432
+ if (archivedFilter === "only" && members.length === 0) continue;
433
+ groups.push(buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members));
402
434
  }
403
- const stray = list.ids.map((id) => list.byId[id]).filter((s) => s !== void 0 && !accounted.has(s.id) && sessionVisible(s, list.current, archived));
404
- if (stray.length > 0) groups.push(buildGroup("", void 0, void 0, void 0, "", ungroupedOrder === void 0 ? stray : orderedUngrouped(stray, ungroupedOrder), ungroupedOrder === void 0 ? "recency" : "account"));
435
+ const stray = list.ids.map((id) => list.byId[id]).filter((s) => s !== void 0 && !accounted.has(s.id) && sessionVisible(s, current, archived, archivedFilter));
436
+ if (stray.length > 0) groups.push(buildGroup("", void 0, void 0, void 0, "", orderedUngrouped(stray, ungroupedOrder, list.byId)));
405
437
  return groups;
406
438
  }
407
439
  /** Keep navigation presentation independent from domain-owned interaction objects. */
@@ -413,16 +445,21 @@ window.__ModuleLoader__.load({
413
445
  default: return;
414
446
  }
415
447
  }
416
- function sessionNode(s, descendants, pendingInteractions) {
417
- const pendingInteraction = visiblePendingKind(pendingInteractions.get(s.id)?.kind);
448
+ function runningChildCount(list, parentId, statuses) {
449
+ return list.projectionsBySession[parentId]?.values.subagentCatalog?.reduce((count, child) => count + ((statuses.get(child.id)?.running ?? list.byId[child.id]?.running) === true ? 1 : 0), 0) ?? 0;
450
+ }
451
+ function sessionNode(s, list, statuses, pinned, archived) {
452
+ const status = statuses.get(s.id);
453
+ const pendingInteraction = visiblePendingKind(status?.pendingInteraction?.kind);
418
454
  return {
419
455
  id: s.id,
420
456
  title: sessionTitle(s),
421
457
  blank: s.blank,
422
- running: s.running,
423
- runningSubagentCount: descendants.get(s.id)?.runningCount ?? 0,
424
- completed: s.completed === true,
425
- hasActiveSchedule: hasActiveSchedule(s),
458
+ running: status?.running ?? s.running,
459
+ runningSubagentCount: runningChildCount(list, s.id, statuses),
460
+ completed: status?.completionUnread === true,
461
+ pinned: !archived.has(s.id) && pinned.has(s.id),
462
+ archived: archived.has(s.id),
426
463
  updatedAt: s.updatedAt,
427
464
  ...pendingInteraction === void 0 ? {} : { pendingInteraction }
428
465
  };
@@ -430,25 +467,27 @@ window.__ModuleLoader__.load({
430
467
  /**
431
468
  * Derive the workspace browser groups with every session as a top-level row.
432
469
  *
433
- * Every group shows; sessions populate under expanded groups in the selected
434
- * local order. Blank sessions are excluded except for the selected
435
- * provisional New Session row; archived sessions are excluded everywhere.
436
- * Content search lives outside this derivation
437
- * (see {@link deriveSearchResults}).
438
- * @param list - sessions list snapshot (`current` feeds containsCurrent).
439
- * @param workspaces - real workspaces in stable Host order.
440
- * @param archivedSessionIds - registry-global archive set.
441
- * @param pendingInteractions - pending UI interactions by Session.
470
+ * Every group shows, except that the archived-only filter drops groups
471
+ * without visible members; sessions populate under expanded groups with
472
+ * pinned rows leading in the selected local order. Blank sessions are
473
+ * excluded except for the selected provisional New Session row; archived
474
+ * sessions keep their slots and appear per the archived filter. Content
475
+ * search lives outside this derivation (see {@link deriveSearchResults}).
476
+ * @param list - sessions list snapshot (`mainView` retention feeds containsCurrent).
477
+ * @param workspaces - real Workspaces in Host group order with caller-projected Session order.
478
+ * @param rowState - registry-global pin and archive sets plus the archived filter.
479
+ * @param statuses - unified UI status by Session.
442
480
  * @param view - local expansion arrays.
443
481
  * @returns group sections in render order.
444
482
  */
445
- function deriveGroups(list, workspaces, archivedSessionIds, pendingInteractions, view) {
446
- const archived = new Set(archivedSessionIds);
483
+ function deriveGroups(list, workspaces, rowState, statuses, view) {
484
+ const archived = new Set(rowState.archivedSessionIds);
485
+ const pinned = new Set(rowState.pinnedSessionIds);
447
486
  const expandedGroups = new Set(view.expandedGroups);
448
- const descendants = indexSubagentDescendants(list.byId);
449
- const currentGroup = list.current === void 0 ? void 0 : owningGroupKey(workspaces, list.current);
487
+ const current = mainSessionId(list);
488
+ const currentGroup = current === void 0 ? void 0 : owningGroupKey(workspaces, current);
450
489
  const groups = [];
451
- for (const g of groupByWorkspace(list, workspaces, archived, view.ungroupedOrder)) {
490
+ for (const g of groupByWorkspace(list, workspaces, archived, rowState.archivedFilter, view.ungroupedOrder)) {
452
491
  const expanded = expandedGroups.has(g.key);
453
492
  groups.push({
454
493
  key: g.key,
@@ -459,32 +498,51 @@ window.__ModuleLoader__.load({
459
498
  sessionCount: g.sessions.length,
460
499
  expanded,
461
500
  containsCurrent: g.key === currentGroup,
462
- sessions: expanded ? g.sessions.map((session) => sessionNode(session, descendants, pendingInteractions)) : []
501
+ sessions: expanded ? sectionMembers(g.sessions, pinned, archived).map((session) => sessionNode(session, list, statuses, pinned, archived)) : []
463
502
  });
464
503
  }
465
504
  return groups;
466
505
  }
467
506
  /**
468
- * Derive the flat session list ("In one list" mode): every session — fork
469
- * children included — as a top-level row, strictly newest-first. No grouping,
470
- * no parent/child adjacency. Content search lives outside this derivation
471
- * (see {@link deriveSearchResults}).
507
+ * Select complete flat-list membership, independently of archive visibility.
508
+ * @param list - sessions list snapshot.
509
+ * @returns known ordinary Session ids, including archives and only the current blank.
510
+ */
511
+ function sessionMemberIds(list) {
512
+ return visibleSessionIds(list, [], "show");
513
+ }
514
+ /**
515
+ * Select visible flat-list members without deriving row presentation or ordering.
472
516
  * @param list - sessions list snapshot.
473
517
  * @param archivedSessionIds - registry-global archive set.
474
- * @param pendingInteractions - pending UI interactions by Session.
475
- * @returns flat rows in render order.
518
+ * @param archivedFilter - archived-row visibility choice.
519
+ * @returns known visible Session ids in list order, including ordinary forks and only the current blank.
476
520
  */
477
- function deriveFlat(list, archivedSessionIds, pendingInteractions) {
521
+ function visibleSessionIds(list, archivedSessionIds, archivedFilter) {
478
522
  const archived = new Set(archivedSessionIds);
479
- const descendants = indexSubagentDescendants(list.byId);
480
- const rows = [];
481
- for (const id of list.ids) {
523
+ const current = mainSessionId(list);
524
+ return list.ids.filter((id) => {
482
525
  const s = list.byId[id];
483
- if (s === void 0 || !sessionVisible(s, list.current, archived)) continue;
484
- rows.push(s);
485
- }
486
- rows.sort(byRecency);
487
- return rows.map((session) => sessionNode(session, descendants, pendingInteractions));
526
+ return s !== void 0 && sessionVisible(s, current, archived, archivedFilter);
527
+ });
528
+ }
529
+ /**
530
+ * Derive flat rows from the browser's complete ordered Session ids, with
531
+ * pinned rows fronted ahead of the supplied order.
532
+ * @param list - sessions list snapshot used to select the ids.
533
+ * @param sessionIds - complete account members in the selected order, including hidden archives.
534
+ * @param rowState - registry-global pin and archive sets plus the archived filter.
535
+ * @param statuses - unified UI status by Session.
536
+ * @returns flat rows in sectioned order with current status indicators.
537
+ */
538
+ function deriveFlat(list, sessionIds, rowState, statuses) {
539
+ const archived = new Set(rowState.archivedSessionIds);
540
+ const pinned = new Set(rowState.pinnedSessionIds);
541
+ const current = mainSessionId(list);
542
+ return sectionMembers(sessionIds.flatMap((id) => {
543
+ const session = list.byId[id];
544
+ return session !== void 0 && sessionVisible(session, current, archived, rowState.archivedFilter) ? [session] : [];
545
+ }), pinned, archived).map((session) => sessionNode(session, list, statuses, pinned, archived));
488
546
  }
489
547
  /**
490
548
  * Merge immediate title/Workspace substring matches with ranked Host content
@@ -493,20 +551,21 @@ window.__ModuleLoader__.load({
493
551
  * @param list - session metadata authority.
494
552
  * @param workspaces - Workspace membership and display labels.
495
553
  * @param query - caller text; surrounding whitespace is ignored.
496
- * @param archivedSessionIds - registry-global archive set (members never match).
497
- * @param pendingInteractions - pending UI interactions by Session.
554
+ * @param archivedSessionIds - registry-global archive set (members match per the archived filter).
555
+ * @param archivedFilter - archived-row visibility choice; search follows it.
556
+ * @param statuses - unified UI status by Session.
498
557
  * @param content - ranked Host content-search page.
499
558
  * @param limit - protocol-owned maximum merged row count.
500
559
  * @returns bounded deduplicated flat rows and a refine-query hint bit.
501
560
  */
502
- function deriveSearchResults(list, workspaces, query, archivedSessionIds, pendingInteractions, content, limit) {
561
+ function deriveSearchResults(list, workspaces, query, archivedSessionIds, archivedFilter, statuses, content, limit) {
503
562
  const q = query.trim().toLowerCase();
504
563
  if (q === "") return {
505
564
  items: [],
506
565
  hasMore: false
507
566
  };
508
567
  const archived = new Set(archivedSessionIds);
509
- const descendants = indexSubagentDescendants(list.byId);
568
+ const current = mainSessionId(list);
510
569
  const workspaceBySession = /* @__PURE__ */ new Map();
511
570
  for (const workspace of workspaces) for (const sessionId of workspace.sessionIds) if (!workspaceBySession.has(sessionId)) workspaceBySession.set(sessionId, workspace.title);
512
571
  const labelOf = (summary) => workspaceBySession.get(summary.id) ?? workspaceLabel(summary.cwd);
@@ -515,10 +574,11 @@ window.__ModuleLoader__.load({
515
574
  const local = [];
516
575
  for (const id of list.ids) {
517
576
  const summary = list.byId[id];
518
- if (summary === void 0 || summary.blank || !sessionVisible(summary, list.current, archived)) continue;
577
+ if (summary === void 0 || summary.blank || !sessionVisible(summary, current, archived, archivedFilter)) continue;
519
578
  if (sessionTitle(summary).toLowerCase().includes(q) || labelOf(summary).toLowerCase().includes(q)) local.push(summary);
520
579
  }
521
- local.sort(byRecency);
580
+ const localById = new Map(local.map((summary) => [summary.id, summary]));
581
+ const orderedLocal = orderByRecency(local.map((summary) => summary.id), list.byId).map((id) => localById.get(id));
522
582
  const ordered = [];
523
583
  const included = /* @__PURE__ */ new Set();
524
584
  const include = (summary) => {
@@ -526,51 +586,497 @@ window.__ModuleLoader__.load({
526
586
  included.add(summary.id);
527
587
  ordered.push(summary);
528
588
  };
529
- for (const summary of local) include(summary);
589
+ for (const summary of orderedLocal) include(summary);
530
590
  for (const item of content.items) {
531
591
  const summary = list.byId[item.sessionId];
532
- if (summary !== void 0 && !summary.blank && sessionVisible(summary, list.current, archived)) include(summary);
592
+ if (summary !== void 0 && !summary.blank && sessionVisible(summary, current, archived, archivedFilter)) include(summary);
533
593
  }
534
594
  return {
535
595
  items: ordered.slice(0, limit).map((summary) => {
536
596
  const match = contentBySession.get(summary.id);
537
- const pendingInteraction = visiblePendingKind(pendingInteractions.get(summary.id)?.kind);
597
+ const status = statuses.get(summary.id);
598
+ const pendingInteraction = visiblePendingKind(status?.pendingInteraction?.kind);
538
599
  return {
539
600
  id: summary.id,
540
601
  title: sessionTitle(summary),
541
602
  workspace: labelOf(summary),
542
- running: summary.running,
543
- runningSubagentCount: descendants.get(summary.id)?.runningCount ?? 0,
603
+ running: status?.running ?? summary.running,
604
+ runningSubagentCount: runningChildCount(list, summary.id, statuses),
544
605
  ...pendingInteraction === void 0 ? {} : { pendingInteraction },
545
- completed: summary.completed === true,
546
- hasActiveSchedule: hasActiveSchedule(summary),
606
+ completed: status?.completionUnread === true,
607
+ archived: archived.has(summary.id),
547
608
  ...match === void 0 ? {} : { snippet: match.snippet }
548
609
  };
549
610
  }),
550
611
  hasMore: content.hasMore || ordered.length > limit
551
612
  };
552
613
  }
614
+ /** Normalize separators for comparison without interpreting POSIX backslashes as separators. */
615
+ function folderPath(path) {
616
+ return (/^[A-Za-z]:[/\\]/.test(path) || path.startsWith("\\\\") ? path.replaceAll("\\", "/") : path).replace(/\/+$/, "");
617
+ }
618
+ /**
619
+ * Find the nearest registered ancestor, excluding the Workspace directory itself.
620
+ * Paths use Host spelling; matching is case-sensitive, like Workspace identity.
621
+ * @param path - Workspace directory.
622
+ * @param parents - registered Workspace directory paths.
623
+ * @returns the owning parent path, or undefined when no parent contains the Workspace.
624
+ */
625
+ function owningParentFolder(path, parents) {
626
+ const child = folderPath(path);
627
+ let owner;
628
+ let length = -1;
629
+ for (const parent of parents) {
630
+ const root = folderPath(parent);
631
+ if (root.length > length && child !== root && child.startsWith(`${root}/`)) {
632
+ owner = parent;
633
+ length = root.length;
634
+ }
635
+ }
636
+ return owner;
637
+ }
638
+ //#endregion
639
+ //#region lib/types/client/stores.js
640
+ /**
641
+ * The workspace browser's viewing store: the session-list grouping mode,
642
+ * persisted across reloads. Module level exports the factory only (a
643
+ * module-level handle would pin the store identity across plugin reloads);
644
+ * register() receives the factory and the browser derives its PropsStore
645
+ * share from the return type.
646
+ */
647
+ /** Browser-local order account for the hierarchy-free flat Session list. */
648
+ const FLAT_SESSION_ORDER_KEY = "__flat_session_order__";
649
+ /** Copy read-only projections into the persisted mutable store representation. */
650
+ function copySessionOrders(orders) {
651
+ return Object.fromEntries(Object.entries(orders).map(([key, order]) => [key, [...order]]));
652
+ }
653
+ /**
654
+ * Create the workspace browser viewing store handle.
655
+ * @returns the store handle (spec + type + identity + factory in one).
656
+ */
657
+ function createWorkspaceViewStore() {
658
+ return (0, _deepseek_ai_dsh_client_store.defineStore)({
659
+ init: () => ({
660
+ groupBy: "workspace",
661
+ orderBy: "updated",
662
+ groupExpansion: {},
663
+ sessionOrderByAccount: {},
664
+ archivedFilter: "default"
665
+ }),
666
+ persist: "dsh.workspace.view.v5",
667
+ actions: {
668
+ setGroupBy: (d, mode) => {
669
+ d.groupBy = mode;
670
+ },
671
+ setOrderBy: (d, mode, initialOrders) => {
672
+ if (mode === d.orderBy) return;
673
+ d.sessionOrderByAccount = mode === "manual" ? copySessionOrders(initialOrders) : {};
674
+ d.orderBy = mode;
675
+ },
676
+ setGroupExpanded: (d, key, expanded) => {
677
+ d.groupExpansion[key] = expanded;
678
+ },
679
+ retainAccountKeys: (d, workspaceKeys) => {
680
+ const retained = new Set(workspaceKeys);
681
+ d.groupExpansion = Object.fromEntries(Object.entries(d.groupExpansion).filter(([key]) => retained.has(key)));
682
+ d.sessionOrderByAccount = Object.fromEntries(Object.entries(d.sessionOrderByAccount).filter(([key]) => retained.has(key)));
683
+ delete d.sessionUpdatedAtByAccount;
684
+ },
685
+ syncSessionOrders: (d, orders) => {
686
+ if (d.orderBy !== "manual") return;
687
+ Object.assign(d.sessionOrderByAccount, copySessionOrders(orders));
688
+ },
689
+ setSessionOrder: (d, accountKey, order, initialOrders) => {
690
+ if (d.orderBy === "updated") d.sessionOrderByAccount = copySessionOrders(initialOrders);
691
+ else Object.assign(d.sessionOrderByAccount, copySessionOrders(initialOrders));
692
+ d.orderBy = "manual";
693
+ d.sessionOrderByAccount[accountKey] = [...order];
694
+ },
695
+ pinSessionOrder: (d, sessionId, accountKeys, source) => {
696
+ const selected = new Set(accountKeys);
697
+ d.sessionOrderByAccount = Object.fromEntries(Object.entries(source.members).map(([key, members]) => {
698
+ const order = reconcileManualOrder(members, d.sessionOrderByAccount[key], source.summaries, source.rowState);
699
+ return [key, selected.has(key) ? [sessionId, ...order.filter((id) => id !== sessionId)] : order];
700
+ }));
701
+ },
702
+ setArchivedFilter: (d, filter) => {
703
+ d.archivedFilter = filter;
704
+ }
705
+ }
706
+ });
707
+ }
708
+ //#endregion
709
+ //#region lib/types/client/pin-order.js
710
+ /**
711
+ * Every account's complete membership: each Workspace, Ungrouped, and the flat list.
712
+ * @param workspaces - current Host Workspaces.
713
+ * @param list - current Session list snapshot.
714
+ * @param rowState - registry-global pin and archive sets.
715
+ * @returns the order source for one pin write.
716
+ */
717
+ function pinOrderSource(workspaces, list, rowState) {
718
+ const accounted = new Set(workspaces.flatMap((workspace) => workspace.sessionIds));
719
+ return {
720
+ members: Object.fromEntries([
721
+ ...workspaces.map((workspace) => [workspace.workspaceId, workspace.sessionIds]),
722
+ ["", list.ids.filter((id) => list.byId[id] !== void 0 && !accounted.has(id))],
723
+ [FLAT_SESSION_ORDER_KEY, sessionMemberIds(list)]
724
+ ]),
725
+ summaries: list.byId,
726
+ rowState
727
+ };
728
+ }
729
+ /**
730
+ * The accounts a pinned Session leads: its group (or Ungrouped) and the flat list.
731
+ * @param workspaces - current Host Workspaces.
732
+ * @param sessionId - the Session being pinned.
733
+ * @returns the account keys `pinSessionOrder` fronts.
734
+ */
735
+ function pinOrderAccounts(workspaces, sessionId) {
736
+ return [owningGroupKey(workspaces, sessionId), FLAT_SESSION_ORDER_KEY];
737
+ }
738
+ //#endregion
739
+ //#region lib/types/client/navigation.js
740
+ /** Workspace archive and directory UI capability. */
741
+ /** Structured directory failure exposed to directory UI consumers. */
742
+ var DirectoryBrowseError = class extends Error {
743
+ rpcError;
744
+ name = "DirectoryBrowseError";
745
+ /** @param rpcError - Host directory business failure. */
746
+ constructor(rpcError) {
747
+ super(`directory browse failed: ${rpcError.code}: ${rpcError.message}`);
748
+ this.rpcError = rpcError;
749
+ }
750
+ };
751
+ /** Implements Workspace archive and directory UI operations. */
752
+ var UiWorkspaceService = class extends _deepseek_ai_cordis.Service {
753
+ directoryPicker;
754
+ workspaces;
755
+ sessions;
756
+ view;
757
+ notify;
758
+ connecting = /* @__PURE__ */ new Map();
759
+ lifetime = new AbortController();
760
+ selection = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({}, { persist: { name: "dsh.sessions.current" } });
761
+ mainReference;
762
+ /**
763
+ * @param ctx - Client root Context.
764
+ * @param directoryPicker - the directory-picking Remote namespace.
765
+ * @param workspaces - pure Workspace Controller.
766
+ * @param sessions - pure Session Controller.
767
+ * @param view - the browser's viewing-store write set (one instance shared with its registration).
768
+ * @param notify - show one notice through the Workspace notice channel.
769
+ */
770
+ constructor(ctx, directoryPicker, workspaces, sessions, view, notify) {
771
+ super(ctx, "uiWorkspace");
772
+ this.directoryPicker = directoryPicker;
773
+ this.workspaces = workspaces;
774
+ this.sessions = sessions;
775
+ this.view = view;
776
+ this.notify = notify;
777
+ ctx.effect(() => {
778
+ const stop = this.watchNavigation();
779
+ return () => {
780
+ stop();
781
+ this.lifetime.abort();
782
+ const reference = this.mainReference;
783
+ this.mainReference = void 0;
784
+ reference?.release();
785
+ };
786
+ }, "ui-workspace: Workspace navigation policy");
787
+ }
788
+ async connectWorkspace(workspaceId) {
789
+ const workspace = this.workspaces.list.getSnapshot().items.find((item) => item.workspaceId === workspaceId);
790
+ if (workspace === void 0) throw new Error(`uiWorkspace.connectWorkspace: unknown workspace ${workspaceId}`);
791
+ const inflight = this.connecting.get(workspaceId);
792
+ if (inflight !== void 0) return inflight;
793
+ const attempt = this.reuseOrCreateBlank(workspace).finally(() => {
794
+ this.connecting.delete(workspaceId);
795
+ });
796
+ this.connecting.set(workspaceId, attempt);
797
+ return attempt;
798
+ }
799
+ reuseOrCreateBlank(workspace) {
800
+ const archived = this.workspaces.list.getSnapshot().archivedSessionIds;
801
+ const sessions = this.sessions.list.getSnapshot();
802
+ for (const id of sessions.ids) {
803
+ const summary = sessions.byId[id];
804
+ if (summary === void 0 || !summary.blank || summary.cwd !== workspace.path || !workspace.sessionIds.includes(id) || archived.includes(id)) continue;
805
+ return this.reuseBlank(workspace.workspaceId, id);
806
+ }
807
+ return this.sessions.create({ workspaceId: workspace.workspaceId });
808
+ }
809
+ async reuseBlank(workspaceId, sessionId) {
810
+ try {
811
+ return await this.sessions.create({
812
+ workspaceId,
813
+ sessionId
814
+ });
815
+ } catch (error) {
816
+ if (sessionCreateErrorOf(error)?.rpcError.code !== "session/writer-held") throw error;
817
+ return this.sessions.create({ workspaceId });
818
+ }
819
+ }
820
+ openSession(target) {
821
+ this.replaceMain(target, this.lifetime.signal, "reveal");
822
+ }
823
+ async openWorkspace(workspaceId, beforeOpen) {
824
+ const navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);
825
+ let sessionId;
826
+ try {
827
+ sessionId = await this.connectWorkspace(workspaceId);
828
+ } catch (error) {
829
+ if (!navigation.aborted) this.notify({
830
+ kind: "createFailed",
831
+ message: creationFailureMessage(error)
832
+ });
833
+ throw error;
834
+ }
835
+ if (navigation.aborted) return;
836
+ this.replaceMain(sessionId, navigation, "reveal", beforeOpen);
837
+ }
838
+ async forkSession(sessionId, onCreated) {
839
+ return this.sessions.fork({
840
+ sessionId,
841
+ increaseTitle: true,
842
+ ...onCreated === void 0 ? {} : { onCreated }
843
+ });
844
+ }
845
+ startSession(workspaceId) {
846
+ const workspace = this.workspaces.list.getSnapshot();
847
+ const sessions = this.sessions.list.getSnapshot();
848
+ const current = this.mainReference?.sessionId;
849
+ const currentWorkspaceId = current === void 0 ? void 0 : workspace.items.find((item) => item.sessionIds.includes(current))?.workspaceId;
850
+ const recent = workspace.phase === "ready" && sessions.phase === "ready" ? recentWorkspace(workspace.items, sessions.byId) : void 0;
851
+ const target = workspaceId ?? currentWorkspaceId ?? recent;
852
+ if (target === void 0) {
853
+ this.clearMain();
854
+ return;
855
+ }
856
+ this.openWorkspace(target).catch((reason) => {
857
+ console.warn("new session failed:", reason);
858
+ });
859
+ }
860
+ async archiveSession(sessionId, options = {}) {
861
+ await this.workspaces.archiveSession(sessionId, options);
862
+ if (this.mainReference?.sessionId === sessionId) this.clearMain();
863
+ }
864
+ async unarchiveSession(sessionId) {
865
+ await this.workspaces.unarchiveSession(sessionId);
866
+ }
867
+ async pinSession(sessionId) {
868
+ await this.workspaces.pinSession(sessionId);
869
+ const { items, pinnedSessionIds, archivedSessionIds } = this.workspaces.list.getSnapshot();
870
+ this.view.pinSessionOrder(sessionId, pinOrderAccounts(items, sessionId), pinOrderSource(items, this.sessions.list.getSnapshot(), {
871
+ pinnedSessionIds,
872
+ archivedSessionIds
873
+ }));
874
+ }
875
+ async unpinSession(sessionId) {
876
+ await this.workspaces.unpinSession(sessionId);
877
+ }
878
+ async pickDirectory() {
879
+ const result = await this.directoryPicker.pick();
880
+ if (!result.ok) throw new Error(`directory picker failed: ${result.error.message}`);
881
+ return result.value;
882
+ }
883
+ async listDirectory(path, signal) {
884
+ const result = await this.directoryPicker.list(path, signal);
885
+ if (!result.ok) throw new DirectoryBrowseError(result.error);
886
+ return result.value;
887
+ }
888
+ async createDirectory(path, name) {
889
+ const result = await this.directoryPicker.createDirectory(path, name);
890
+ if (!result.ok) throw new DirectoryBrowseError(result.error);
891
+ return result.value;
892
+ }
893
+ watchNavigation() {
894
+ let initial = "waiting";
895
+ const reconcile = () => {
896
+ if (this.lifetime.signal.aborted) return;
897
+ if (this.clearArchivedCurrent()) return;
898
+ if (initial !== "waiting") return;
899
+ const workspace = this.workspaces.list.getSnapshot();
900
+ const sessions = this.sessions.list.getSnapshot();
901
+ if (workspace.phase !== "ready" || sessions.phase !== "ready") return;
902
+ if (this.mainReference !== void 0) {
903
+ initial = "done";
904
+ return;
905
+ }
906
+ initial = "connecting";
907
+ this.restoreSelection(workspace, sessions).then(() => {
908
+ initial = "done";
909
+ }, (reason) => {
910
+ if (this.lifetime.signal.aborted) return;
911
+ initial = "waiting";
912
+ console.warn("initial Session restoration failed:", reason);
913
+ });
914
+ };
915
+ const disposeWorkspaces = this.workspaces.list.subscribe(reconcile);
916
+ const disposeSessions = this.sessions.list.subscribe(reconcile);
917
+ reconcile();
918
+ return () => {
919
+ this.lifetime.abort();
920
+ disposeSessions();
921
+ disposeWorkspaces();
922
+ };
923
+ }
924
+ async restoreSelection(workspaces, sessions) {
925
+ const saved = this.selection.getSnapshot();
926
+ if (saved.subagentAddress !== void 0) {
927
+ this.replaceMain(saved.subagentAddress, this.lifetime.signal, "preserve");
928
+ return;
929
+ }
930
+ const summary = saved.sessionId === void 0 ? void 0 : sessions.byId[saved.sessionId];
931
+ const workspace = summary === void 0 ? void 0 : workspaces.items.find((item) => item.sessionIds.includes(summary.id));
932
+ if (summary !== void 0 && (!summary.blank || workspace === void 0)) {
933
+ this.replaceMain(summary.id, this.lifetime.signal, "preserve");
934
+ return;
935
+ }
936
+ const navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);
937
+ let sessionId;
938
+ if (summary !== void 0 && workspace !== void 0 && summary.cwd === workspace.path && !workspaces.archivedSessionIds.includes(summary.id)) sessionId = await this.reuseBlank(workspace.workspaceId, summary.id);
939
+ let target = workspace?.workspaceId ?? recentWorkspace(workspaces.items, sessions.byId);
940
+ if (target === void 0 && workspaces.items.length === 0 && sessions.ids.length === 0) {
941
+ const prepared = await this.initializeDefaultWorkspace(navigation);
942
+ if (navigation.aborted) return;
943
+ target = prepared?.workspaceId;
944
+ }
945
+ if (sessionId === void 0 && target !== void 0) sessionId = await this.connectWorkspace(target);
946
+ if (sessionId !== void 0 && !navigation.aborted) this.replaceMain(sessionId, navigation, "preserve");
947
+ }
948
+ async initializeDefaultWorkspace(signal) {
949
+ try {
950
+ return await this.workspaces.initializeDefault(signal);
951
+ } catch (_error) {
952
+ if (!signal.aborted) this.notify({ kind: "defaultWorkspaceFailed" });
953
+ return;
954
+ }
955
+ }
956
+ /** @returns true when an archived current selection was cleared. */
957
+ clearArchivedCurrent() {
958
+ const current = this.mainReference?.sessionId;
959
+ if (current === void 0 || !this.workspaces.list.getSnapshot().archivedSessionIds.includes(current)) return false;
960
+ this.clearMain();
961
+ return true;
962
+ }
963
+ clearMain() {
964
+ const previous = this.mainReference;
965
+ this.mainReference = void 0;
966
+ this.selection.set({});
967
+ previous?.release();
968
+ this.ctx.layout.selectPanel(null);
969
+ }
970
+ replaceMain(target, signal, panel, beforeOpen) {
971
+ signal.throwIfAborted();
972
+ const reference = this.sessions.retain(target, { source: "mainView" });
973
+ try {
974
+ signal.throwIfAborted();
975
+ beforeOpen?.(reference.sessionId);
976
+ if (signal.aborted) {
977
+ reference.release();
978
+ return;
979
+ }
980
+ const subagentAddress = typeof target === "string" ? this.sessions.subagentAddress(reference.sessionId) : target;
981
+ this.selection.set({
982
+ sessionId: reference.sessionId,
983
+ ...subagentAddress === void 0 ? {} : { subagentAddress }
984
+ });
985
+ } catch (error) {
986
+ reference.release();
987
+ throw error;
988
+ }
989
+ const previous = this.mainReference;
990
+ this.mainReference = reference;
991
+ previous?.release();
992
+ if (panel === "reveal") this.ctx.layout.selectPanel(null);
993
+ }
994
+ };
995
+ /**
996
+ * `error` as the Session Controller's creation failure, or undefined when it
997
+ * is not one. Client plugin bundles do not share error-class identity, so the
998
+ * name decides.
999
+ */
1000
+ function sessionCreateErrorOf(error) {
1001
+ return error instanceof Error && error.name === "SessionCreateError" ? error : void 0;
1002
+ }
1003
+ /**
1004
+ * The words a failed Session creation is reported in: a Host refusal keeps its
1005
+ * stable code and message; any other failure keeps its own message.
1006
+ */
1007
+ function creationFailureMessage(error) {
1008
+ const refused = sessionCreateErrorOf(error);
1009
+ if (refused !== void 0) return `${refused.rpcError.code}: ${refused.rpcError.message}`;
1010
+ return error instanceof Error ? error.message : String(error);
1011
+ }
1012
+ /** Stable tie-breaking follows Host Workspace order. */
1013
+ function recentWorkspace(workspaces, sessions) {
1014
+ let selected;
1015
+ let selectedTime = Number.NEGATIVE_INFINITY;
1016
+ for (const workspace of workspaces) {
1017
+ let latest = Number.NEGATIVE_INFINITY;
1018
+ for (const sessionId of workspace.sessionIds) {
1019
+ const session = sessions[sessionId];
1020
+ if (session !== void 0) latest = Math.max(latest, session.updatedAt);
1021
+ }
1022
+ if (latest === Number.NEGATIVE_INFINITY) latest = Date.parse(workspace.createdAt);
1023
+ if (selected === void 0 || latest > selectedTime) {
1024
+ selected = workspace.workspaceId;
1025
+ selectedTime = latest;
1026
+ }
1027
+ }
1028
+ return selected;
1029
+ }
1030
+ //#endregion
1031
+ //#region ../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
1032
+ function r(e) {
1033
+ var t, f, n = "";
1034
+ if ("string" == typeof e || "number" == typeof e) n += e;
1035
+ else if ("object" == typeof e) if (Array.isArray(e)) {
1036
+ var o = e.length;
1037
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
1038
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
1039
+ return n;
1040
+ }
1041
+ function clsx() {
1042
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
1043
+ return n;
1044
+ }
1045
+ /**
1046
+ * The text one Workspace is labeled with. A Workspace still carrying the
1047
+ * automatic first-use title reads as the caller's localized default name; every
1048
+ * other title reads verbatim in every language. A title the user typed as
1049
+ * exactly {@link DEFAULT_WORKSPACE_DIRECTORY} is labeled as the default too;
1050
+ * nothing else depends on the distinction.
1051
+ * @param title - stored Workspace title.
1052
+ * @param localizedDefault - the default Workspace name in the active language.
1053
+ * @returns the title to display.
1054
+ */
1055
+ function workspaceDisplayTitle(title, localizedDefault) {
1056
+ return title === "default-workspace" ? localizedDefault : title;
1057
+ }
553
1058
  //#endregion
554
1059
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-workspace/src/client/rows/Rows.module.css.mjs
555
- const css$2 = ".YDXeBa_projectRow,.YDXeBa_sessionRow{cursor:pointer;user-select:none;color:var(--dsw-alias-label-primary);border-radius:8px;align-items:center;gap:6px;padding:0 8px;display:flex}.YDXeBa_projectRow:hover,.YDXeBa_sessionRow:hover,.YDXeBa_sessionRow.YDXeBa_selected{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_searchResultRow{box-sizing:border-box;cursor:pointer;text-align:left;width:100%;min-height:48px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:8px;flex-direction:column;align-items:stretch;padding:4px 8px;display:flex}.YDXeBa_searchResultRow:hover,.YDXeBa_searchResultRow.YDXeBa_selected{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_searchResultHeading{align-items:center;min-width:0;display:flex}.YDXeBa_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.YDXeBa_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.YDXeBa_searchResultWorkspace,.YDXeBa_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.YDXeBa_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.YDXeBa_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.YDXeBa_projectRow{box-sizing:border-box;align-items:center;height:34px}.YDXeBa_projectRow .YDXeBa_rowActions{height:20px}.YDXeBa_sessionRow{height:32px;animation:YDXeBa_row-in .15s var(--ds-ease-in-out);gap:0}.YDXeBa_sessionRow .YDXeBa_title{margin:0 6px 0 4px}.YDXeBa_flatSessionRowWithoutStatus .YDXeBa_title{margin-left:0}@keyframes YDXeBa_row-in{0%{opacity:0}}.YDXeBa_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.YDXeBa_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.YDXeBa_folderActive{color:var(--dsw-alias-state-business-primary)}.YDXeBa_projectRow .YDXeBa_chevron{display:none}.YDXeBa_projectRow:hover .YDXeBa_chevron{display:inline-flex}.YDXeBa_projectRow:hover .YDXeBa_folder{display:none}.YDXeBa_arrow{transition:transform .15s var(--ds-ease-in-out)}.YDXeBa_arrowOpen{transform:rotate(90deg)}.YDXeBa_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.YDXeBa_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.YDXeBa_renameInput{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;border-radius:4px;outline:none;padding:0 2px;font-size:14px;line-height:20px}.YDXeBa_sessionRow .YDXeBa_title{flex:1}.YDXeBa_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.YDXeBa_time{color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px;line-height:20px}.YDXeBa_scheduleIndicator{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;margin-right:6px;display:inline-flex}.YDXeBa_searchScheduleIndicator{margin-left:4px;margin-right:0}.YDXeBa_dot{flex:none}.YDXeBa_rowActions{flex:none;align-items:center;gap:12px;display:none}.YDXeBa_projectRow:hover .YDXeBa_rowActions,.YDXeBa_sessionRow:hover .YDXeBa_rowActions,.YDXeBa_projectRow.YDXeBa_menuOpen .YDXeBa_rowActions,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_rowActions{display:inline-flex}.YDXeBa_sessionRow:hover .YDXeBa_time,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_time{display:none}.YDXeBa_projectRow.YDXeBa_menuOpen,.YDXeBa_sessionRow.YDXeBa_menuOpen{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_sessionRow.YDXeBa_dropBefore,.YDXeBa_sessionRow.YDXeBa_dropAfter{position:relative}.YDXeBa_sessionRow.YDXeBa_dropBefore:before,.YDXeBa_sessionRow.YDXeBa_dropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.YDXeBa_sessionRow.YDXeBa_dropBefore:before{top:-7px}.YDXeBa_sessionRow.YDXeBa_dropAfter:after{bottom:-7px}.YDXeBa_hoverContent{flex-direction:column;gap:8px;display:flex}.YDXeBa_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.YDXeBa_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.YDXeBa_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.YDXeBa_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.YDXeBa_iconButton{cursor:pointer;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YDXeBa_iconButton:hover{color:var(--dsw-alias-label-primary)}.YDXeBa_chevron{color:var(--dsw-alias-label-caption)}@media (prefers-reduced-motion:reduce){.YDXeBa_sessionRow,.YDXeBa_arrow{transition:none;animation:none}}";
556
- const tagId$2 = "@deepseek-ai/dsh-client-ui-workspace/Rows.module.css";
557
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
1060
+ const css$3 = ".YDXeBa_projectRow,.YDXeBa_sessionRow{border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex}.YDXeBa_projectRow:hover,.YDXeBa_sessionRow:hover,.YDXeBa_sessionRow.YDXeBa_selected{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;width:100%;min-height:48px;color:var(--dsw-alias-label-primary);background:0 0;border:none;flex-direction:column;align-items:stretch;padding:4px 8px;display:flex}.YDXeBa_searchResultRow:hover,.YDXeBa_searchResultRow.YDXeBa_selected{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_searchResultHeading{align-items:center;min-width:0;display:flex}.YDXeBa_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.YDXeBa_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.YDXeBa_searchResultWorkspace,.YDXeBa_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.YDXeBa_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.YDXeBa_searchResultWorkspace:only-child{max-width:100%}.YDXeBa_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.YDXeBa_projectRow{box-sizing:border-box;align-items:center;height:34px}.YDXeBa_projectRow .YDXeBa_rowActions{height:20px}.YDXeBa_sessionRow{gap:0;height:32px}.YDXeBa_sessionRow .YDXeBa_title{margin:0 6px 0 4px}.YDXeBa_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.YDXeBa_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.YDXeBa_folderActive{color:var(--dsw-alias-state-business-primary)}.YDXeBa_projectRow .YDXeBa_chevron{display:none}.YDXeBa_projectRow:hover .YDXeBa_chevron{display:inline-flex}.YDXeBa_projectRow:hover .YDXeBa_folder{display:none}.YDXeBa_arrow{transition:transform .15s var(--ds-ease-in-out)}.YDXeBa_arrowOpen{transform:rotate(90deg)}.YDXeBa_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.YDXeBa_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.YDXeBa_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.YDXeBa_sessionRow .YDXeBa_title{flex:1}.YDXeBa_sessionRow .YDXeBa_title[data-scrolled]{mask-image:linear-gradient(90deg,#0000,#000 12px)}.YDXeBa_sessionRow .YDXeBa_title[data-clipped]{mask-image:linear-gradient(270deg,#0000,#000 12px)}.YDXeBa_sessionRow .YDXeBa_title[data-scrolled][data-clipped]{mask-image:linear-gradient(90deg,#0000,#000 12px calc(100% - 12px),#0000)}.YDXeBa_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.YDXeBa_time{color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.YDXeBa_pinIndicator{width:16px;height:20px;color:var(--dsw-alias-label-caption);flex:none;justify-content:center;align-items:center;margin-left:6px;display:inline-flex}.YDXeBa_sessionRow.YDXeBa_archived .YDXeBa_title,.YDXeBa_searchResultRow.YDXeBa_archived .YDXeBa_searchResultTitle,.YDXeBa_searchResultRow.YDXeBa_archived .YDXeBa_searchResultWorkspace,.YDXeBa_searchResultRow.YDXeBa_archived .YDXeBa_searchResultSnippet{color:var(--dsw-alias-label-caption)}.YDXeBa_dot{flex:none}.YDXeBa_rowActions{flex:none;align-items:center;gap:10px;display:none}.YDXeBa_projectRow:hover .YDXeBa_rowActions,.YDXeBa_sessionRow:hover .YDXeBa_rowActions,.YDXeBa_searchResultRow:hover .YDXeBa_rowActions,.YDXeBa_projectRow.YDXeBa_menuOpen .YDXeBa_rowActions,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_rowActions{display:inline-flex}.YDXeBa_searchResultHeading .YDXeBa_rowActions{margin-left:auto}.YDXeBa_sessionRow:hover .YDXeBa_time,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_time,.YDXeBa_sessionRow:hover .YDXeBa_pinIndicator,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_pinIndicator{display:none}@media (hover:hover){.YDXeBa_sessionRow:hover .YDXeBa_title,.YDXeBa_sessionRow.YDXeBa_menuOpen .YDXeBa_title{text-overflow:clip}}.YDXeBa_projectRow.YDXeBa_menuOpen,.YDXeBa_sessionRow.YDXeBa_menuOpen{background:var(--dsw-alias-interactive-bg-hover)}.YDXeBa_sessionRow.YDXeBa_dropBefore,.YDXeBa_sessionRow.YDXeBa_dropAfter{position:relative}.YDXeBa_sessionRow.YDXeBa_dropBefore:before,.YDXeBa_sessionRow.YDXeBa_dropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.YDXeBa_sessionRow.YDXeBa_dropBefore:before{top:-7px}.YDXeBa_sessionRow.YDXeBa_dropAfter:after{bottom:-7px}.YDXeBa_hoverContent{flex-direction:column;gap:8px;display:flex}.YDXeBa_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.YDXeBa_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.YDXeBa_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.YDXeBa_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.YDXeBa_hoverArchived svg{flex-shrink:0;margin:0 -4px}.YDXeBa_iconButton{border-radius:var(--dsw-radius-xs);cursor:pointer;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YDXeBa_iconButton:hover{color:var(--dsw-alias-label-primary)}.YDXeBa_chevron{color:var(--dsw-alias-label-caption)}@media (prefers-reduced-motion:reduce){.YDXeBa_arrow{transition:none;animation:none}}";
1061
+ const tagId$3 = "@deepseek-ai/dsh-client-ui-workspace/Rows.module.css";
1062
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
558
1063
  const tag = document.createElement("style");
559
1064
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
560
- tag.dataset.pluginCss = tagId$2;
561
- tag.textContent = css$2;
1065
+ tag.dataset.pluginCss = tagId$3;
1066
+ tag.textContent = css$3;
562
1067
  document.head.appendChild(tag);
563
1068
  }
564
1069
  var Rows_module_css_default = {
1070
+ "archived": "YDXeBa_archived",
565
1071
  "arrow": "YDXeBa_arrow",
566
1072
  "arrowOpen": "YDXeBa_arrowOpen",
567
1073
  "chevron": "YDXeBa_chevron",
568
1074
  "dot": "YDXeBa_dot",
569
1075
  "dropAfter": "YDXeBa_dropAfter",
570
1076
  "dropBefore": "YDXeBa_dropBefore",
571
- "flatSessionRowWithoutStatus": "YDXeBa_flatSessionRowWithoutStatus",
572
1077
  "folder": "YDXeBa_folder",
573
1078
  "folderActive": "YDXeBa_folderActive",
1079
+ "hoverArchived": "YDXeBa_hoverArchived",
574
1080
  "hoverContent": "YDXeBa_hoverContent",
575
1081
  "hoverPath": "YDXeBa_hoverPath",
576
1082
  "hoverStatus": "YDXeBa_hoverStatus",
@@ -579,19 +1085,17 @@ window.__ModuleLoader__.load({
579
1085
  "iconButton": "YDXeBa_iconButton",
580
1086
  "menuOpen": "YDXeBa_menuOpen",
581
1087
  "meta": "YDXeBa_meta",
1088
+ "pinIndicator": "YDXeBa_pinIndicator",
582
1089
  "projectRow": "YDXeBa_projectRow",
583
1090
  "projectText": "YDXeBa_projectText",
584
1091
  "renameInput": "YDXeBa_renameInput",
585
- "row-in": "YDXeBa_row-in",
586
1092
  "rowActions": "YDXeBa_rowActions",
587
- "scheduleIndicator": "YDXeBa_scheduleIndicator",
588
1093
  "searchResultHeading": "YDXeBa_searchResultHeading",
589
1094
  "searchResultMeta": "YDXeBa_searchResultMeta",
590
1095
  "searchResultRow": "YDXeBa_searchResultRow",
591
1096
  "searchResultSnippet": "YDXeBa_searchResultSnippet",
592
1097
  "searchResultTitle": "YDXeBa_searchResultTitle",
593
1098
  "searchResultWorkspace": "YDXeBa_searchResultWorkspace",
594
- "searchScheduleIndicator": "YDXeBa_searchScheduleIndicator",
595
1099
  "selected": "YDXeBa_selected",
596
1100
  "sessionRow": "YDXeBa_sessionRow",
597
1101
  "slot": "YDXeBa_slot",
@@ -604,13 +1108,100 @@ window.__ModuleLoader__.load({
604
1108
  /**
605
1109
  * Workspace browser tree row components (figma Cell set 14:3080): pure presentational —
606
1110
  * all data and callbacks arrive via props. Hover swaps (folder->chevron,
607
- * time->ellipsis, action buttons) are CSS-only. Row ... menus are visual-only
608
- * except workspace Rename/Delete and session Rename/Fork/Archive; the session
609
- * and workspace hover cards are suppressed while a menu is open.
1111
+ * time->ellipsis, action buttons) are CSS-only, and a session row's clipped
1112
+ * title marquees programmatically while the row is hovered. Workspace row
1113
+ * menus are visual-only except Rename/Delete. A Session row's "..." menu and
1114
+ * its hover buttons are the `sidebar.workspaces.session.menu.item` and
1115
+ * `sidebar.workspaces.session.row.action` lists, rendered through the
1116
+ * browser's `renderSlot` with the menu's open state as the occurrence's hook
1117
+ * context; this package's own actions are entries like any plugin's. The
1118
+ * session and workspace hover cards are suppressed while a menu is open.
610
1119
  */
611
1120
  /** Row display title: blank rows show the localized New Session label. */
612
1121
  function displayTitle(node, t) {
613
- return node.blank ? t("session.new") : node.title;
1122
+ return node.blank ? t("session.new") : node.title || t("session.untitled");
1123
+ }
1124
+ const MIN_TITLE_REVEAL_PX = 8;
1125
+ const TITLE_MARQUEE_PX_PER_MS = .03;
1126
+ /**
1127
+ * Place the title's scroll position and publish the stylesheet's fade-mask
1128
+ * hooks: `data-scrolled` while the title has left its start (left fade) and
1129
+ * `data-clipped` while text remains beyond the right edge (right fade).
1130
+ * @param title - the row's clipping title element.
1131
+ * @param left - scroll offset in CSS pixels.
1132
+ * @param range - the title's maximum scroll offset in CSS pixels.
1133
+ */
1134
+ function placeTitle(title, left, range) {
1135
+ if (typeof title.scrollTo === "function") title.scrollTo({
1136
+ left,
1137
+ behavior: "instant"
1138
+ });
1139
+ else title.scrollLeft = left;
1140
+ if (left > 0) title.dataset.scrolled = "";
1141
+ else delete title.dataset.scrolled;
1142
+ if (left < range) title.dataset.clipped = "";
1143
+ else delete title.dataset.clipped;
1144
+ }
1145
+ /**
1146
+ * Return the title to its resting state: scrolled to the start with both fade
1147
+ * masks off, so the resting ellipsis renders at full strength.
1148
+ * @param title - the row's clipping title element.
1149
+ */
1150
+ function restTitle(title) {
1151
+ if (typeof title.scrollTo === "function") title.scrollTo({
1152
+ left: 0,
1153
+ behavior: "instant"
1154
+ });
1155
+ else title.scrollLeft = 0;
1156
+ delete title.dataset.scrolled;
1157
+ delete title.dataset.clipped;
1158
+ }
1159
+ /**
1160
+ * Marquee a title wider than its one-line cell while its row is hovered: the
1161
+ * title clips its own text, so entering crawls it at a constant speed until the
1162
+ * far edge (a fork's incremented title, for example) is in view, then rests
1163
+ * there under the pointer. Overflow of at most {@link MIN_TITLE_REVEAL_PX}
1164
+ * stays put — a barely-clipped title moving a few pixels reads as jitter, not a
1165
+ * reveal. Leaving returns the title to the start in one step, because the
1166
+ * resting ellipsis and the narrowed cell would otherwise meet the text while it
1167
+ * travelled back. Reduced motion jumps to the far edge instead of crawling.
1168
+ * @param title - ref to the row's clipping title element.
1169
+ * @returns stable pointer enter/leave handlers for the row.
1170
+ */
1171
+ function useTitleMarquee(title) {
1172
+ const frame = (0, react.useRef)(0);
1173
+ (0, react.useEffect)(() => () => {
1174
+ cancelAnimationFrame(frame.current);
1175
+ }, []);
1176
+ return (0, react.useMemo)(() => ({
1177
+ enter: () => {
1178
+ /* v8 ignore next -- defensive: the title span renders unconditionally. */
1179
+ if (title.current === null) return;
1180
+ const element = title.current;
1181
+ const range = element.scrollWidth - element.clientWidth;
1182
+ if (range <= MIN_TITLE_REVEAL_PX) return;
1183
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
1184
+ placeTitle(element, range, range);
1185
+ return;
1186
+ }
1187
+ cancelAnimationFrame(frame.current);
1188
+ let previous;
1189
+ let position = 0;
1190
+ const step = (now) => {
1191
+ position += previous === void 0 ? 0 : (now - previous) * TITLE_MARQUEE_PX_PER_MS;
1192
+ previous = now;
1193
+ placeTitle(element, Math.min(position, range), range);
1194
+ if (position < range) frame.current = requestAnimationFrame(step);
1195
+ };
1196
+ frame.current = requestAnimationFrame(step);
1197
+ },
1198
+ leave: () => {
1199
+ cancelAnimationFrame(frame.current);
1200
+ /* v8 ignore next -- defensive: the title span renders unconditionally. */
1201
+ if (title.current === null) return;
1202
+ restTitle(title.current);
1203
+ }
1204
+ }), [title]);
614
1205
  }
615
1206
  /** Localized compact relative time ("刚刚"/"5分钟" in zh, "now"/"5min" in en). */
616
1207
  function timeLabel(updatedAt, now, t) {
@@ -667,6 +1258,7 @@ window.__ModuleLoader__.load({
667
1258
  * Workspace shows its hover card (the ungrouped bucket has none).
668
1259
  * `containsCurrent` arrives on the node (derivation fact, no renderer scan).
669
1260
  * @param props.group - derived group node.
1261
+ * @param props.containsCurrentDescendant - highlight an ancestor even when its subtree is collapsed.
670
1262
  * @param props.onToggle - expand/collapse the group.
671
1263
  * @param props.onCreate - start a frontend Session inside this Workspace.
672
1264
  * @param props.drag - optional workspace-row drag wiring.
@@ -674,23 +1266,24 @@ window.__ModuleLoader__.load({
674
1266
  * @param props.t - the browser root's locale seat.
675
1267
  * @returns the row element.
676
1268
  */
677
- function ProjectRowItem({ group, onToggle, onCreate, actions, drag, home, t }) {
1269
+ function ProjectRowItem({ group, containsCurrentDescendant = false, onToggle, onCreate, actions, drag, home, newShortcut, t }) {
678
1270
  const row = group;
679
1271
  const label = row.workspaceId === void 0 ? t("group.ungrouped") : row.label;
680
- const active = group.expanded && group.containsCurrent;
1272
+ const active = containsCurrentDescendant || group.expanded && group.containsCurrent;
681
1273
  const [menuOpen, setMenuOpen] = (0, react.useState)(false);
682
1274
  const workspaceMenuItems = [{
683
1275
  id: "rename",
684
1276
  label: t("rename"),
685
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {})
1277
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, {})
686
1278
  }, {
687
1279
  id: "delete",
688
1280
  label: t("delete.workspace"),
689
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, {}),
1281
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineRegular, {}),
690
1282
  danger: true
691
1283
  }];
692
1284
  const ownRow = (0, react_jsx_runtime.jsxs)("div", {
693
1285
  className: clsx(Rows_module_css_default.projectRow, menuOpen && Rows_module_css_default.menuOpen),
1286
+ "data-row-key": `workspace:${group.key}`,
694
1287
  role: "treeitem",
695
1288
  "aria-expanded": row.expanded,
696
1289
  onClick: onToggle,
@@ -704,11 +1297,11 @@ window.__ModuleLoader__.load({
704
1297
  children: [
705
1298
  (0, react_jsx_runtime.jsx)("span", {
706
1299
  className: clsx(Rows_module_css_default.slot, Rows_module_css_default.folder, active && Rows_module_css_default.folderActive),
707
- children: row.expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpen16, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderClose16, {})
1300
+ children: row.expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, {})
708
1301
  }),
709
1302
  (0, react_jsx_runtime.jsx)("span", {
710
1303
  className: clsx(Rows_module_css_default.slot, Rows_module_css_default.chevron),
711
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTriangleRightFill14, { className: clsx(Rows_module_css_default.arrow, row.expanded && Rows_module_css_default.arrowOpen) })
1304
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTriangleRightFillRegular, { className: clsx(Rows_module_css_default.arrow, row.expanded && Rows_module_css_default.arrowOpen) })
712
1305
  }),
713
1306
  (0, react_jsx_runtime.jsx)("span", {
714
1307
  className: Rows_module_css_default.projectText,
@@ -742,17 +1335,25 @@ window.__ModuleLoader__.load({
742
1335
  e.stopPropagation();
743
1336
  setMenuOpen((v) => !v);
744
1337
  },
745
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutline16, {})
1338
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutlineRegular, {})
1339
+ })
1340
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1341
+ label: t("actions.newSession"),
1342
+ shortcutKeys: newShortcut?.keys,
1343
+ side: "bottom",
1344
+ align: "end",
1345
+ delayMs: 500,
1346
+ children: (0, react_jsx_runtime.jsx)("button", {
1347
+ type: "button",
1348
+ className: Rows_module_css_default.iconButton,
1349
+ "aria-keyshortcuts": newShortcut?.aria,
1350
+ "aria-label": t("actions.newSession.aria", { name: label }),
1351
+ onClick: (e) => {
1352
+ e.stopPropagation();
1353
+ onCreate();
1354
+ },
1355
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconNewChatOutlineRegular, {})
746
1356
  })
747
- }), (0, react_jsx_runtime.jsx)("button", {
748
- type: "button",
749
- className: Rows_module_css_default.iconButton,
750
- "aria-label": t("actions.newSession.aria", { name: label }),
751
- onClick: (e) => {
752
- e.stopPropagation();
753
- onCreate();
754
- },
755
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, {})
756
1357
  })]
757
1358
  })
758
1359
  ]
@@ -766,6 +1367,7 @@ window.__ModuleLoader__.load({
766
1367
  createdAt: row.createdAt,
767
1368
  t
768
1369
  }),
1370
+ openDelayMs: 800,
769
1371
  disabled: menuOpen,
770
1372
  copyText: row.cwd,
771
1373
  copyLabel: t("copy"),
@@ -790,19 +1392,22 @@ window.__ModuleLoader__.load({
790
1392
  case "approval":
791
1393
  pending = {
792
1394
  state: "warning",
793
- label: t("status.waitingApproval")
1395
+ label: t("status.waitingApproval"),
1396
+ trailingLabel: t("status.compact.approval")
794
1397
  };
795
1398
  break;
796
1399
  case "plan-review":
797
1400
  pending = {
798
1401
  state: "warning",
799
- label: t("status.planReview")
1402
+ label: t("status.planReview"),
1403
+ trailingLabel: t("status.compact.planReview")
800
1404
  };
801
1405
  break;
802
1406
  case "question":
803
1407
  pending = {
804
1408
  state: "warning",
805
- label: t("status.waitingAnswer")
1409
+ label: t("status.waitingAnswer"),
1410
+ trailingLabel: t("status.compact.answer")
806
1411
  };
807
1412
  break;
808
1413
  case void 0: break;
@@ -823,7 +1428,7 @@ window.__ModuleLoader__.load({
823
1428
  label: t("status.completed")
824
1429
  }];
825
1430
  return [{
826
- state: "done",
1431
+ state: "idle",
827
1432
  label: t("status.idle")
828
1433
  }];
829
1434
  }
@@ -834,20 +1439,24 @@ window.__ModuleLoader__.load({
834
1439
  children: status.label
835
1440
  }, status.label))] });
836
1441
  }
837
- /** Non-interactive active-Schedule marker; the enclosing row remains the only action. */
838
- function ActiveScheduleIndicator({ t, search = false }) {
839
- const label = t("schedule.active");
1442
+ /** Non-interactive pinned-row marker; the enclosing row remains the only action. */
1443
+ function PinnedIndicator({ t }) {
1444
+ const label = t("row.pinned");
840
1445
  return (0, react_jsx_runtime.jsx)("span", {
841
- className: clsx(Rows_module_css_default.scheduleIndicator, search && Rows_module_css_default.searchScheduleIndicator),
1446
+ className: Rows_module_css_default.pinIndicator,
842
1447
  role: "img",
843
1448
  "aria-label": label,
844
1449
  title: label,
845
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAlarmClockOutline16, {})
1450
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, { size: 14 })
846
1451
  });
847
1452
  }
848
- /** Hover-card body: full title, relative time, and every relevant live status. */
849
- function SessionHoverContent({ node, now, t }) {
850
- const statuses = sessionStatuses(node, t);
1453
+ /**
1454
+ * Hover-card body: full title, relative time, the Session's own scheduled-task
1455
+ * section, and every relevant live status. The task section sits above the
1456
+ * status lines so they stay the card's trailing status line.
1457
+ */
1458
+ function SessionHoverContent({ node, now, renderSlot, t }) {
1459
+ const statuses = sessionStatuses(node, t).filter((status) => !(node.archived && (status.state === "done" || status.state === "idle")));
851
1460
  return (0, react_jsx_runtime.jsxs)("div", {
852
1461
  className: Rows_module_css_default.hoverContent,
853
1462
  children: [
@@ -859,32 +1468,39 @@ window.__ModuleLoader__.load({
859
1468
  className: Rows_module_css_default.hoverTime,
860
1469
  children: hoverTimeLabel(node.updatedAt, now, t)
861
1470
  }),
1471
+ renderSlot("sidebar.session.row.hover", { sessionId: node.id }),
862
1472
  statuses.map((status) => (0, react_jsx_runtime.jsxs)("div", {
863
1473
  className: Rows_module_css_default.hoverStatus,
864
1474
  children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: status.state }), (0, react_jsx_runtime.jsx)("span", { children: status.label })]
865
- }, status.label))
1475
+ }, status.label)),
1476
+ node.archived && (0, react_jsx_runtime.jsxs)("div", {
1477
+ className: clsx(Rows_module_css_default.hoverStatus, Rows_module_css_default.hoverArchived),
1478
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutlineRegular, { size: 14 }), (0, react_jsx_runtime.jsx)("span", { children: t("row.archived") })]
1479
+ })
866
1480
  ]
867
1481
  });
868
1482
  }
869
1483
  /**
870
1484
  * One flat search result: title, Workspace context, and optional content
871
1485
  * excerpt. Search navigation opens the session only; it does not address an
872
- * event inside the conversation.
1486
+ * event inside the conversation. Archived rows carry a hover unarchive
1487
+ * button, because search is where the filter surfaces them for recovery.
873
1488
  * @param props.result - merged local/content search row.
874
1489
  * @param props.currentId - selected session id.
875
1490
  * @param props.onOpen - open the selected session.
1491
+ * @param props.onUnarchive - unarchive an archived result row.
876
1492
  * @param props.t - Workspace-browser translation seat.
877
- * @returns the result button.
1493
+ * @returns the result row.
878
1494
  */
879
- function SearchResultItem({ result, currentId, onOpen, t }) {
1495
+ function SearchResultItem({ result, currentId, onOpen, onUnarchive, t }) {
880
1496
  const selected = result.id === currentId;
881
1497
  const statuses = sessionStatuses(result, t);
882
1498
  const primaryStatus = statuses[0];
883
- return (0, react_jsx_runtime.jsxs)("button", {
884
- type: "button",
885
- className: clsx(Rows_module_css_default.searchResultRow, selected && Rows_module_css_default.selected),
1499
+ return (0, react_jsx_runtime.jsxs)("div", {
1500
+ className: clsx(Rows_module_css_default.searchResultRow, selected && Rows_module_css_default.selected, result.archived && Rows_module_css_default.archived),
886
1501
  role: "treeitem",
887
1502
  "aria-selected": selected,
1503
+ "aria-description": result.archived ? t("toast.archivedNotOpenable") : void 0,
888
1504
  onClick: () => {
889
1505
  onOpen(result.id);
890
1506
  },
@@ -893,15 +1509,30 @@ window.__ModuleLoader__.load({
893
1509
  children: [
894
1510
  (0, react_jsx_runtime.jsx)("span", {
895
1511
  className: Rows_module_css_default.slot,
896
- children: (primaryStatus.state !== "done" || result.completed) && (0, react_jsx_runtime.jsx)(SessionStatusDots, { statuses })
1512
+ children: !result.archived && primaryStatus.state !== "idle" && (0, react_jsx_runtime.jsx)(SessionStatusDots, { statuses })
897
1513
  }),
898
1514
  (0, react_jsx_runtime.jsx)("span", {
899
1515
  className: Rows_module_css_default.searchResultTitle,
900
- children: result.title
1516
+ children: result.title || t("session.untitled")
901
1517
  }),
902
- result.hasActiveSchedule && (0, react_jsx_runtime.jsx)(ActiveScheduleIndicator, {
903
- t,
904
- search: true
1518
+ result.archived && (0, react_jsx_runtime.jsx)("span", {
1519
+ className: Rows_module_css_default.rowActions,
1520
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1521
+ label: t("actions.unarchive"),
1522
+ side: "bottom",
1523
+ align: "end",
1524
+ delayMs: 500,
1525
+ children: (0, react_jsx_runtime.jsx)("button", {
1526
+ type: "button",
1527
+ className: Rows_module_css_default.iconButton,
1528
+ "aria-label": t("menu.unarchiveSession"),
1529
+ onClick: (e) => {
1530
+ e.stopPropagation();
1531
+ onUnarchive(result.id);
1532
+ },
1533
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUnarchiveOutlineRegular, { size: 14 })
1534
+ })
1535
+ })
905
1536
  })
906
1537
  ]
907
1538
  }), (0, react_jsx_runtime.jsxs)("span", {
@@ -917,67 +1548,63 @@ window.__ModuleLoader__.load({
917
1548
  });
918
1549
  }
919
1550
  /**
920
- * One top-level 34px session row: status dot (pending user interaction outranks
921
- * own or descendant activity), title, relative time, and the row actions menu.
1551
+ * One top-level 32px session row: leading 16px cell (status dot, or the
1552
+ * leading seat while the row's primary state is idle), title, relative time or
1553
+ * compact pending label, and the row actions menu. A row that owns a state dot
1554
+ * keeps that cell and renders no seat, so an ambient automation mark never
1555
+ * appears beside the row's own state dot. An archived row keeps the cell blank:
1556
+ * neither marker renders there, and its live status stays on the hover card.
922
1557
  * @param props.node - derived session node.
923
1558
  * @param props.currentId - selected session id (row highlight).
924
1559
  * @param props.now - epoch ms for relative-time formatting.
925
1560
  * @param props.onOpen - open a session by id.
926
- * @param props.onRename - open the session rename dialog (id + current title).
927
- * @param props.onFork - fork a session at its last completed turn.
928
- * @param props.onArchive - archive a session by id.
1561
+ * @param props.onRenameRequest - open the rename dialog from a title double-click (id + current title).
1562
+ * @param props.renderSlot - child-seat renderer for the row's action lists
1563
+ * (`sidebar.workspaces.session.menu.item` / `sidebar.workspaces.session.row.action`),
1564
+ * its leading decoration, and its hover-card section.
929
1565
  * @param props.onReveal - scroll this row into view after search navigation, then acknowledge it.
930
- * @param props.drag - optional draggable-row wiring.
931
- * @param props.flat - omit the empty status slot in the hierarchy-free flat list.
1566
+ * @param props.drag - optional row-drag target wiring; blank rows cannot start a drag.
932
1567
  * @param props.t - the browser root's locale seat.
933
1568
  * @returns the session row.
934
1569
  */
935
- function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onReveal, drag, flat = false, t }) {
1570
+ function SessionNodeItem({ node, currentId, now, onOpen, onRenameRequest, renderSlot, onReveal, drag, t }) {
936
1571
  const row = node;
937
1572
  const title = displayTitle(node, t);
938
1573
  const selected = node.id === currentId;
939
1574
  const statuses = sessionStatuses(node, t);
940
- const showStatus = statuses[0].state !== "done" || row.completed;
1575
+ const primaryStatus = statuses[0];
1576
+ const showStatus = primaryStatus.state !== "idle";
1577
+ const draggable = drag !== void 0 && !row.blank && !row.archived;
941
1578
  const [menuOpen, setMenuOpen] = (0, react.useState)(false);
1579
+ const menuOpenState = (0, react.useMemo)(() => [menuOpen, setMenuOpen], [menuOpen]);
942
1580
  const rowRef = (0, react.useRef)(null);
1581
+ const titleRef = (0, react.useRef)(null);
1582
+ const marquee = useTitleMarquee(titleRef);
943
1583
  (0, react.useEffect)(() => {
944
1584
  if (onReveal === void 0) return;
945
1585
  rowRef.current?.scrollIntoView({ block: "nearest" });
946
1586
  onReveal();
947
1587
  }, [onReveal]);
948
- const sessionMenuItems = [
949
- {
950
- id: "rename",
951
- label: t("rename"),
952
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {})
953
- },
954
- {
955
- id: "fork",
956
- label: t("menu.fork"),
957
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutline16, {})
958
- },
959
- {
960
- id: "archive",
961
- label: t("menu.archiveSession"),
962
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutline20, { size: 16 })
963
- }
964
- ];
965
1588
  return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.HoverCard, {
966
1589
  anchor: (0, react_jsx_runtime.jsxs)("div", {
967
1590
  ref: rowRef,
968
- className: clsx(Rows_module_css_default.sessionRow, selected && Rows_module_css_default.selected, menuOpen && Rows_module_css_default.menuOpen, flat && !showStatus && Rows_module_css_default.flatSessionRowWithoutStatus, drag?.marker === "before" && Rows_module_css_default.dropBefore, drag?.marker === "after" && Rows_module_css_default.dropAfter),
1591
+ "data-row-key": `session:${node.id}`,
1592
+ className: clsx(Rows_module_css_default.sessionRow, selected && Rows_module_css_default.selected, menuOpen && Rows_module_css_default.menuOpen, row.archived && Rows_module_css_default.archived, drag?.marker === "before" && Rows_module_css_default.dropBefore, drag?.marker === "after" && Rows_module_css_default.dropAfter),
969
1593
  role: "treeitem",
970
1594
  "aria-selected": selected,
1595
+ "aria-description": row.archived ? t("toast.archivedNotOpenable") : void 0,
971
1596
  onClick: () => {
972
1597
  onOpen(node.id);
973
1598
  },
974
- draggable: drag !== void 0,
975
- onDragStart: drag === void 0 ? void 0 : (e) => {
1599
+ onPointerEnter: marquee.enter,
1600
+ onPointerLeave: marquee.leave,
1601
+ draggable,
1602
+ onDragStart: !draggable ? void 0 : (e) => {
976
1603
  e.dataTransfer.effectAllowed = "move";
977
1604
  e.dataTransfer.setData("text/plain", node.id);
978
1605
  drag.start();
979
1606
  },
980
- onDragEnd: drag?.end,
1607
+ onDragEnd: !draggable ? void 0 : drag.end,
981
1608
  onDragOver: drag === void 0 ? void 0 : (e) => {
982
1609
  if (!drag.active) return;
983
1610
  e.preventDefault();
@@ -990,61 +1617,247 @@ window.__ModuleLoader__.load({
990
1617
  drag.drop(rowHalf(e));
991
1618
  },
992
1619
  children: [
993
- (!flat || showStatus) && (0, react_jsx_runtime.jsx)("span", {
1620
+ (0, react_jsx_runtime.jsx)("span", {
994
1621
  className: Rows_module_css_default.slot,
995
- children: showStatus && (0, react_jsx_runtime.jsx)(SessionStatusDots, { statuses })
1622
+ children: !row.archived && !row.blank && (showStatus ? (0, react_jsx_runtime.jsx)(SessionStatusDots, { statuses }) : renderSlot("sidebar.session.row.leading", { sessionId: node.id }))
996
1623
  }),
997
1624
  (0, react_jsx_runtime.jsx)("span", {
1625
+ ref: titleRef,
998
1626
  className: Rows_module_css_default.title,
1627
+ onDoubleClick: row.blank ? void 0 : (e) => {
1628
+ e.stopPropagation();
1629
+ onRenameRequest(node.id, row.title);
1630
+ },
999
1631
  children: title
1000
1632
  }),
1001
- row.hasActiveSchedule && (0, react_jsx_runtime.jsx)(ActiveScheduleIndicator, { t }),
1002
1633
  !row.blank && (0, react_jsx_runtime.jsx)("span", {
1003
1634
  className: Rows_module_css_default.time,
1004
- children: timeLabel(row.updatedAt, now, t)
1635
+ "aria-hidden": primaryStatus.trailingLabel === void 0 ? void 0 : true,
1636
+ children: primaryStatus.trailingLabel ?? timeLabel(row.updatedAt, now, t)
1005
1637
  }),
1006
- !row.blank && (0, react_jsx_runtime.jsx)("span", {
1638
+ row.pinned && !row.archived && (0, react_jsx_runtime.jsx)(PinnedIndicator, { t }),
1639
+ !row.blank && (0, react_jsx_runtime.jsxs)("span", {
1007
1640
  className: Rows_module_css_default.rowActions,
1008
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
1641
+ onClick: (e) => {
1642
+ e.stopPropagation();
1643
+ },
1644
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
1009
1645
  open: menuOpen,
1010
1646
  onClose: () => {
1011
1647
  setMenuOpen(false);
1012
1648
  },
1013
- items: sessionMenuItems,
1014
- onSelect: (id) => {
1015
- setMenuOpen(false);
1016
- if (id === "rename") onRename(node.id, row.title);
1017
- if (id === "fork") onFork(node.id);
1018
- if (id === "archive") onArchive(node.id);
1019
- },
1020
1649
  portal: true,
1021
1650
  closeOnPointerLeave: true,
1022
1651
  anchor: (0, react_jsx_runtime.jsx)("button", {
1023
1652
  type: "button",
1024
1653
  className: Rows_module_css_default.iconButton,
1025
1654
  "aria-label": t("actions.session.aria", { name: title }),
1026
- onClick: (e) => {
1027
- e.stopPropagation();
1655
+ onClick: () => {
1028
1656
  setMenuOpen((v) => !v);
1029
1657
  },
1030
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutline16, {})
1031
- })
1032
- })
1658
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEllipsisOutlineRegular, {})
1659
+ }),
1660
+ children: renderSlot("sidebar.workspaces.session.menu.item", {
1661
+ sessionId: node.id,
1662
+ displayTitle: row.title
1663
+ }, { hookContext: menuOpenState })
1664
+ }), renderSlot("sidebar.workspaces.session.row.action", {
1665
+ sessionId: node.id,
1666
+ displayTitle: row.title
1667
+ })]
1033
1668
  })
1034
1669
  ]
1035
1670
  }),
1036
1671
  content: (0, react_jsx_runtime.jsx)(SessionHoverContent, {
1037
1672
  node,
1038
1673
  now,
1674
+ renderSlot,
1039
1675
  t
1040
1676
  }),
1677
+ openDelayMs: 800,
1041
1678
  disabled: menuOpen || drag?.active === true,
1042
- copyText: row.blank ? void 0 : row.title,
1679
+ copyText: row.blank || row.title === "" ? void 0 : row.title,
1043
1680
  copyLabel: t("copy"),
1044
1681
  copiedLabel: t("hover.copied")
1045
1682
  });
1046
1683
  }
1047
1684
  //#endregion
1685
+ //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-workspace/src/client/rows/AnimatedRows.module.css.mjs
1686
+ const css$2 = ".Qg_5Eq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}";
1687
+ const tagId$2 = "@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css";
1688
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
1689
+ const tag = document.createElement("style");
1690
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
1691
+ tag.dataset.pluginCss = tagId$2;
1692
+ tag.textContent = css$2;
1693
+ document.head.appendChild(tag);
1694
+ }
1695
+ var AnimatedRows_module_css_default = { "exits": "Qg_5Eq_exits" };
1696
+ //#endregion
1697
+ //#region lib/types/client/rows/AnimatedRows.js
1698
+ /** React-commit-driven movement and entry/exit fades for the sidebar's keyed rows. */
1699
+ const ROW_FADE_MS = 100;
1700
+ const ROW_GLIDE_MS = 200;
1701
+ function sameRows(previous, next) {
1702
+ return previous.rowKeys.length === next.rowKeys.length && previous.rowKeys.every((key, index) => key === next.rowKeys[index]);
1703
+ }
1704
+ function intersects(row, viewport) {
1705
+ return row.bottom > viewport.top && row.top < viewport.bottom && row.right > viewport.left && row.left < viewport.right;
1706
+ }
1707
+ /**
1708
+ * Animates keyed sidebar rows only when their rendered membership or order changes.
1709
+ * Motion starts after the first pointer or keyboard input inside the mounted list.
1710
+ * The parent supplies a positioned container for the inert exit overlay.
1711
+ */
1712
+ var AnimatedRows = class extends react.Component {
1713
+ armed = false;
1714
+ list = (0, react.createRef)();
1715
+ overlay = (0, react.createRef)();
1716
+ movements = /* @__PURE__ */ new Map();
1717
+ exits = /* @__PURE__ */ new Map();
1718
+ getSnapshotBeforeUpdate(previous) {
1719
+ const list = this.list.current;
1720
+ if (!this.armed || sameRows(previous, this.props) || previous.resetKey !== this.props.resetKey || !previous.ready || !this.props.ready || list === null || typeof list.animate !== "function" || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return null;
1721
+ const viewport = list.getBoundingClientRect();
1722
+ const positions = this.readPositions();
1723
+ const nextKeys = new Set(this.props.rowKeys);
1724
+ const removed = /* @__PURE__ */ new Map();
1725
+ for (const [key, row] of positions) {
1726
+ if (nextKeys.has(key) || !intersects(row.rect, viewport)) continue;
1727
+ const clone = row.element.cloneNode(true);
1728
+ clone.removeAttribute("data-row-key");
1729
+ clone.inert = true;
1730
+ clone.style.setProperty("--dsh-workspace-indent", getComputedStyle(row.element).getPropertyValue("--dsh-workspace-indent"));
1731
+ removed.set(key, {
1732
+ ...row,
1733
+ element: clone
1734
+ });
1735
+ }
1736
+ return {
1737
+ positions,
1738
+ removed
1739
+ };
1740
+ }
1741
+ componentDidUpdate(previous, _state, snapshot) {
1742
+ if (snapshot === null) {
1743
+ if (!sameRows(previous, this.props) || previous.resetKey !== this.props.resetKey || previous.ready !== this.props.ready) this.clear();
1744
+ return;
1745
+ }
1746
+ this.cancelMovements();
1747
+ const list = this.list.current;
1748
+ const overlay = this.overlay.current;
1749
+ const viewport = list.getBoundingClientRect();
1750
+ const origin = overlay.getBoundingClientRect();
1751
+ const positions = this.readPositions();
1752
+ for (const [key, row] of positions) {
1753
+ this.removeExit(key);
1754
+ const previousRow = snapshot.positions.get(key);
1755
+ if (!intersects(row.rect, viewport) && (previousRow === void 0 || !intersects(previousRow.rect, viewport))) continue;
1756
+ if (previousRow === void 0) {
1757
+ this.move(row.element, [{ opacity: 0 }, { opacity: 1 }], ROW_FADE_MS);
1758
+ continue;
1759
+ }
1760
+ const dx = previousRow.rect.left - row.rect.left;
1761
+ const dy = previousRow.rect.top - row.rect.top;
1762
+ if (dx === 0 && dy === 0 && previousRow.opacity === 1) continue;
1763
+ this.move(row.element, [{
1764
+ transform: `translate(${String(dx)}px, ${String(dy)}px)`,
1765
+ opacity: previousRow.opacity
1766
+ }, {
1767
+ transform: "translate(0, 0)",
1768
+ opacity: 1
1769
+ }], ROW_GLIDE_MS);
1770
+ }
1771
+ for (const [key, row] of snapshot.removed) {
1772
+ const { element } = row;
1773
+ this.removeExit(key);
1774
+ Object.assign(element.style, {
1775
+ position: "absolute",
1776
+ margin: "0",
1777
+ transform: "none",
1778
+ boxSizing: "border-box",
1779
+ left: `${String(row.rect.left - origin.left)}px`,
1780
+ top: `${String(row.rect.top - origin.top)}px`,
1781
+ width: `${String(row.rect.width)}px`,
1782
+ height: `${String(row.rect.height)}px`
1783
+ });
1784
+ overlay.append(element);
1785
+ const animation = element.animate([{ opacity: row.opacity }, { opacity: 0 }], {
1786
+ duration: ROW_FADE_MS,
1787
+ easing: "ease-out",
1788
+ fill: "forwards"
1789
+ });
1790
+ this.exits.set(key, {
1791
+ element,
1792
+ animation
1793
+ });
1794
+ animation.onfinish = () => {
1795
+ this.removeExit(key);
1796
+ };
1797
+ }
1798
+ }
1799
+ componentWillUnmount() {
1800
+ this.clear();
1801
+ }
1802
+ readPositions() {
1803
+ const rows = this.list.current.querySelectorAll("[data-row-key]");
1804
+ return new Map(Array.from(rows, (element) => [element.dataset.rowKey, {
1805
+ element,
1806
+ rect: element.getBoundingClientRect(),
1807
+ opacity: this.movements.has(element) ? Number(getComputedStyle(element).opacity) : 1
1808
+ }]));
1809
+ }
1810
+ move(element, keyframes, duration) {
1811
+ const animation = element.animate(keyframes, {
1812
+ duration,
1813
+ easing: "ease-out"
1814
+ });
1815
+ this.movements.set(element, animation);
1816
+ animation.onfinish = () => {
1817
+ this.movements.delete(element);
1818
+ animation.cancel();
1819
+ };
1820
+ }
1821
+ cancelMovements() {
1822
+ for (const animation of this.movements.values()) {
1823
+ animation.onfinish = null;
1824
+ animation.cancel();
1825
+ }
1826
+ this.movements.clear();
1827
+ }
1828
+ removeExit(key) {
1829
+ const exit = this.exits.get(key);
1830
+ if (exit === void 0) return;
1831
+ exit.animation.onfinish = null;
1832
+ exit.animation.cancel();
1833
+ exit.element.remove();
1834
+ this.exits.delete(key);
1835
+ }
1836
+ clear() {
1837
+ this.cancelMovements();
1838
+ for (const key of this.exits.keys()) this.removeExit(key);
1839
+ }
1840
+ render() {
1841
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("div", {
1842
+ ref: this.list,
1843
+ className: this.props.className,
1844
+ role: "tree",
1845
+ "aria-label": this.props.label,
1846
+ onPointerDownCapture: () => {
1847
+ this.armed = true;
1848
+ },
1849
+ onKeyDownCapture: () => {
1850
+ this.armed = true;
1851
+ },
1852
+ children: this.props.children
1853
+ }), (0, react_jsx_runtime.jsx)("div", {
1854
+ ref: this.overlay,
1855
+ className: AnimatedRows_module_css_default.exits,
1856
+ "aria-hidden": "true"
1857
+ })] });
1858
+ }
1859
+ };
1860
+ //#endregion
1048
1861
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-workspace/src/client/WorkspacePicker.module.css.mjs
1049
1862
  const css$1 = "._G5b-a_modalAction{min-width:72px}._G5b-a_modalError,._G5b-a_menuStatus{margin-top:8px;font-size:12px;line-height:18px}._G5b-a_modalError{color:var(--dsw-alias-state-error-primary)}._G5b-a_menuStatus{color:var(--dsw-alias-label-secondary)}";
1050
1863
  const tagId$1 = "@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css";
@@ -1068,7 +1881,7 @@ window.__ModuleLoader__.load({
1068
1881
  * @param props - owner-controlled flow props.
1069
1882
  * @returns menu + dialog elements.
1070
1883
  */
1071
- function WorkspacePickFlow({ t, open, anchorRef, useWorkspaces, createWorkspace, useDirectoryFlow, renderDirectoryFlow, onPick, onClose, addOnly = false, side = "bottom", selectedId }) {
1884
+ function WorkspacePickFlow({ t, open, anchorRef, useWorkspaces, createWorkspace, useDirectoryFlow, renderDirectoryFlow, onPick, onClose, addOnly = false, onBusyChange, side = "bottom", selectedId }) {
1072
1885
  const workspaceSnapshot = useWorkspaces((state) => state);
1073
1886
  const workspaces = workspaceSnapshot.items;
1074
1887
  const getAnchorRect = (0, react.useCallback)(() => anchorRef?.current?.getBoundingClientRect() ?? null, [anchorRef]);
@@ -1077,6 +1890,9 @@ window.__ModuleLoader__.load({
1077
1890
  const [flowOpen, setFlowOpen] = (0, react.useState)(false);
1078
1891
  const [pickingFolder, setPickingFolder] = (0, react.useState)(false);
1079
1892
  const flowBusy = flowOpen || pickingFolder;
1893
+ (0, react.useEffect)(() => {
1894
+ onBusyChange?.(flowBusy);
1895
+ }, [flowBusy, onBusyChange]);
1080
1896
  const flowAvailable = useDirectoryFlow((occupied) => occupied);
1081
1897
  (0, react.useEffect)(() => {
1082
1898
  if (flowOpen && !flowAvailable) setFlowOpen(false);
@@ -1084,14 +1900,14 @@ window.__ModuleLoader__.load({
1084
1900
  const addEntries = flowAvailable ? [{
1085
1901
  id: ADD_WORKSPACE,
1086
1902
  label: t("menu.addWorkspace"),
1087
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 16 }),
1903
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 16 }),
1088
1904
  disabled: flowBusy
1089
1905
  }] : [];
1090
1906
  const pinAdd = !addOnly && workspaces.length > 0;
1091
1907
  const items = pinAdd ? workspaces.map((workspace) => ({
1092
1908
  id: workspace.workspaceId,
1093
- label: workspace.title,
1094
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderClose16, { size: 16 }),
1909
+ label: workspaceDisplayTitle(workspace.title, t("workspace.defaultName")),
1910
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, { size: 16 }),
1095
1911
  disabled: flowBusy
1096
1912
  })) : addEntries;
1097
1913
  const menuIsEmpty = items.length === 0;
@@ -1216,7 +2032,7 @@ window.__ModuleLoader__.load({
1216
2032
  }
1217
2033
  //#endregion
1218
2034
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css.mjs
1219
- const css = ".bhn1Oq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:8px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}.bhn1Oq_root.bhn1Oq_rail{padding-right:0}.bhn1Oq_iconButton{corner-shape:round;cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:12px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:4px;padding-left:4px;display:flex;overflow:hidden}.bhn1Oq_root:not(.bhn1Oq_rail) .bhn1Oq_sectionHeader{margin-top:2px;margin-right:-4px}.bhn1Oq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;line-height:20px;overflow:hidden}.bhn1Oq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.bhn1Oq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.bhn1Oq_searchSlotExpanded{max-width:100%;padding-left:0}.bhn1Oq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.bhn1Oq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.bhn1Oq_search{box-sizing:border-box;corner-shape:round;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;border-radius:50%;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.bhn1Oq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.bhn1Oq_searchButton{corner-shape:round;cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_searchExpanded .bhn1Oq_searchButton{width:28px;height:30px}.bhn1Oq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_searchExpanded .bhn1Oq_searchButton:hover{background:0 0}.bhn1Oq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.bhn1Oq_searchExpanded .bhn1Oq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.bhn1Oq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.bhn1Oq_clearButton{corner-shape:round;cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_rail .bhn1Oq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.bhn1Oq_rail .bhn1Oq_headerActions{max-width:none}.bhn1Oq_rail .bhn1Oq_iconButton{width:36px;height:36px;color:var(--dsw-alias-label-primary)}.bhn1Oq_rail .bhn1Oq_search{background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.bhn1Oq_rail .bhn1Oq_searchButton{width:36px;height:36px;color:var(--dsw-alias-label-primary)}.bhn1Oq_rail .bhn1Oq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.bhn1Oq_rail .bhn1Oq_listArea{margin-left:0;margin-right:0;padding-left:0}.bhn1Oq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.bhn1Oq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}.bhn1Oq_wide{animation:bhn1Oq_wide-in .2s var(--ds-ease-in-out)}@keyframes bhn1Oq_wide-in{0%{opacity:0}}.bhn1Oq_list{min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;overflow-y:auto}.bhn1Oq_flatList>*+*,.bhn1Oq_searchTree>[role=treeitem]+[role=treeitem],.bhn1Oq_groupSection>*+*{margin-top:2px}.bhn1Oq_searchStatus,.bhn1Oq_searchWarning{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.bhn1Oq_searchWarning{color:var(--dsw-alias-label-secondary)}.bhn1Oq_groupSection{position:relative}.bhn1Oq_groupSection+.bhn1Oq_groupSection{margin-top:4px}.bhn1Oq_listTopDropIndicator,.bhn1Oq_workspaceDropBefore:before,.bhn1Oq_workspaceDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.bhn1Oq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.bhn1Oq_listTopDropActive>.bhn1Oq_workspaceDropBefore:first-child:before{display:none}.bhn1Oq_workspaceDropBefore:before{top:-8px}.bhn1Oq_workspaceDropAfter:after{bottom:-8px}.bhn1Oq_sessionOverflowButton{cursor:pointer;text-align:left;width:100%;height:28px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:8px;padding:0 12px 0 28px;font-size:12px}.bhn1Oq_groupSection>.bhn1Oq_sessionOverflowButton{margin-top:0}.bhn1Oq_sessionOverflowButton:hover{color:var(--dsw-alias-label-secondary);background:0 0}.bhn1Oq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.bhn1Oq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;border-radius:22px;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.bhn1Oq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.bhn1Oq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.bhn1Oq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.bhn1Oq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}@media (prefers-reduced-motion:reduce){.bhn1Oq_wide{animation:none}.bhn1Oq_search,.bhn1Oq_sectionLabel,.bhn1Oq_searchSlot,.bhn1Oq_searchInput,.bhn1Oq_headerActions{transition:none}}";
2035
+ const css = ".bhn1Oq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}.bhn1Oq_root.bhn1Oq_rail{padding-right:0}.bhn1Oq_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_iconButton:focus-visible,.bhn1Oq_searchButton:focus-visible,.bhn1Oq_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.bhn1Oq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_viewOptionsMenu{min-width:200px}.bhn1Oq_sectionHeader{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:4px;padding-left:4px;display:flex;overflow:hidden}.bhn1Oq_root:not(.bhn1Oq_rail) .bhn1Oq_sectionHeader{margin-top:2px;margin-right:-4px}.bhn1Oq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;line-height:20px;overflow:hidden}.bhn1Oq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.bhn1Oq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.bhn1Oq_searchSlotExpanded{max-width:100%;padding-left:0}.bhn1Oq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.bhn1Oq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.bhn1Oq_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.bhn1Oq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.bhn1Oq_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_searchExpanded .bhn1Oq_searchButton{width:28px;height:30px}.bhn1Oq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_searchExpanded .bhn1Oq_searchButton:hover{background:0 0}.bhn1Oq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.bhn1Oq_searchExpanded .bhn1Oq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.bhn1Oq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.bhn1Oq_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.bhn1Oq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_rail .bhn1Oq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.bhn1Oq_rail .bhn1Oq_headerActions{max-width:none}.bhn1Oq_rail .bhn1Oq_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.bhn1Oq_rail .bhn1Oq_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.bhn1Oq_rail .bhn1Oq_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.bhn1Oq_rail .bhn1Oq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.bhn1Oq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.bhn1Oq_rail .bhn1Oq_listArea{margin-left:0;margin-right:0;padding-left:0}.bhn1Oq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.bhn1Oq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .bhn1Oq_fade{display:none}.bhn1Oq_wide{animation:bhn1Oq_wide-in .2s var(--ds-ease-in-out)}@keyframes bhn1Oq_wide-in{0%{opacity:0}}.bhn1Oq_list{min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;overflow-y:auto}.bhn1Oq_flatList>*+*,.bhn1Oq_searchTree>[role=treeitem]+[role=treeitem],.bhn1Oq_groupSection>*+*{margin-top:2px}.bhn1Oq_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.bhn1Oq_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.bhn1Oq_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.bhn1Oq_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.bhn1Oq_skeletonDot,.bhn1Oq_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite bhn1Oq_search-skeleton}.bhn1Oq_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.bhn1Oq_skeletonBarWide{width:90%;height:13px}@keyframes bhn1Oq_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.bhn1Oq_groupSection{position:relative}.bhn1Oq_groupSection+.bhn1Oq_groupSection{margin-top:4px}.bhn1Oq_listTopDropIndicator,.bhn1Oq_workspaceDropBefore:before,.bhn1Oq_workspaceDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.bhn1Oq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.bhn1Oq_listTopDropActive>.bhn1Oq_workspaceDropBefore:first-child:before{display:none}.bhn1Oq_workspaceDropBefore:before{top:-8px}.bhn1Oq_workspaceDropAfter:after{bottom:-8px}.bhn1Oq_sessionOverflowButton{border-radius:var(--dsw-radius-sm);width:100%;height:28px;padding:0 12px 0 calc(28px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;font-size:12px}.bhn1Oq_groupSection>.bhn1Oq_sessionOverflowButton{margin-top:0}.bhn1Oq_sessionOverflowButton:hover{color:var(--dsw-alias-label-secondary);background:0 0}.bhn1Oq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.bhn1Oq_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.bhn1Oq_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.bhn1Oq_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.bhn1Oq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.bhn1Oq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.bhn1Oq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.bhn1Oq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.bhn1Oq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.bhn1Oq_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.bhn1Oq_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.bhn1Oq_wide,.bhn1Oq_skeletonDot,.bhn1Oq_skeletonBar{animation:none}.bhn1Oq_search,.bhn1Oq_sectionLabel,.bhn1Oq_searchSlot,.bhn1Oq_searchInput,.bhn1Oq_headerActions{transition:none}}";
1220
2036
  const tagId = "@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css";
1221
2037
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
1222
2038
  const tag = document.createElement("style");
@@ -1226,10 +2042,13 @@ window.__ModuleLoader__.load({
1226
2042
  document.head.appendChild(tag);
1227
2043
  }
1228
2044
  var WorkspaceBrowser_module_css_default = {
2045
+ "archiveActivity": "bhn1Oq_archiveActivity",
1229
2046
  "clearButton": "bhn1Oq_clearButton",
1230
2047
  "deleteAction": "bhn1Oq_deleteAction",
1231
2048
  "deleteStatus": "bhn1Oq_deleteStatus",
1232
2049
  "empty": "bhn1Oq_empty",
2050
+ "emptyAction": "bhn1Oq_emptyAction",
2051
+ "emptyState": "bhn1Oq_emptyState",
1233
2052
  "fade": "bhn1Oq_fade",
1234
2053
  "flatList": "bhn1Oq_flatList",
1235
2054
  "groupSection": "bhn1Oq_groupSection",
@@ -1245,6 +2064,7 @@ window.__ModuleLoader__.load({
1245
2064
  "renameInput": "bhn1Oq_renameInput",
1246
2065
  "root": "bhn1Oq_root",
1247
2066
  "search": "bhn1Oq_search",
2067
+ "search-skeleton": "bhn1Oq_search-skeleton",
1248
2068
  "searchButton": "bhn1Oq_searchButton",
1249
2069
  "searchExpanded": "bhn1Oq_searchExpanded",
1250
2070
  "searchInput": "bhn1Oq_searchInput",
@@ -1252,12 +2072,17 @@ window.__ModuleLoader__.load({
1252
2072
  "searchSlotExpanded": "bhn1Oq_searchSlotExpanded",
1253
2073
  "searchStatus": "bhn1Oq_searchStatus",
1254
2074
  "searchTree": "bhn1Oq_searchTree",
1255
- "searchWarning": "bhn1Oq_searchWarning",
1256
2075
  "sectionHeader": "bhn1Oq_sectionHeader",
1257
2076
  "sectionLabel": "bhn1Oq_sectionLabel",
1258
2077
  "sectionLabelHidden": "bhn1Oq_sectionLabelHidden",
1259
2078
  "sessionOverflowButton": "bhn1Oq_sessionOverflowButton",
2079
+ "skeletonBar": "bhn1Oq_skeletonBar",
2080
+ "skeletonBarWide": "bhn1Oq_skeletonBarWide",
2081
+ "skeletonBars": "bhn1Oq_skeletonBars",
2082
+ "skeletonDot": "bhn1Oq_skeletonDot",
2083
+ "skeletonRow": "bhn1Oq_skeletonRow",
1260
2084
  "treeBody": "bhn1Oq_treeBody",
2085
+ "viewOptionsMenu": "bhn1Oq_viewOptionsMenu",
1261
2086
  "wide": "bhn1Oq_wide",
1262
2087
  "wide-in": "bhn1Oq_wide-in",
1263
2088
  "workspaceDropAfter": "bhn1Oq_workspaceDropAfter",
@@ -1274,7 +2099,12 @@ window.__ModuleLoader__.load({
1274
2099
  * rail entry path, each requesting expansion through the owner share. Adding
1275
2100
  * is the header button's one action, so it raises the directory flow with no
1276
2101
  * menu in between; the flow and its error dialog live in WorkspacePicker
1277
- * (same package — direct composition, no slot between them).
2102
+ * (same package — direct composition, no slot between them). A Session row's
2103
+ * "..." menu and hover buttons are the `sidebar.workspaces.session.menu.item`
2104
+ * and `sidebar.workspaces.session.row.action` lists rendered through this
2105
+ * entry's `renderSlot`; the actions in them, this package's own included,
2106
+ * are slot entries with their own behavior, so this component threads no
2107
+ * action callbacks and hosts no action surface.
1278
2108
  */
1279
2109
  /**
1280
2110
  * Column slide length (--ds-transition-duration-slow): rail-search focus waits it out —
@@ -1285,15 +2115,15 @@ window.__ModuleLoader__.load({
1285
2115
  const SEARCH_DEBOUNCE_MS = 250;
1286
2116
  /** `session.search` wire bound, measured in JavaScript UTF-16 code units. */
1287
2117
  const SEARCH_QUERY_MAX_CODE_UNITS = 500;
1288
- /** Session rows visible per Workspace before the local overflow control. */
2118
+ /** Idle Session rows visible per Workspace before the local overflow control. */
1289
2119
  const COLLAPSED_SESSION_LIMIT = 5;
1290
- /** Fold one Workspace without charging its provisional New Session against the ordinary-row limit. */
1291
- function collapsedSessionRows(sessions) {
1292
- let ordinaryCount = 0;
2120
+ /** Keep provisional and running rows outside the idle-session quota, including parents with running children. */
2121
+ function collapsedSessionRows(sessions, limit = COLLAPSED_SESSION_LIMIT) {
2122
+ let idleCount = 0;
1293
2123
  const rows = sessions.filter((session) => {
1294
- if (session.blank) return true;
1295
- if (ordinaryCount >= COLLAPSED_SESSION_LIMIT) return false;
1296
- ordinaryCount += 1;
2124
+ if (session.blank || session.running || session.runningSubagentCount > 0) return true;
2125
+ if (idleCount >= limit) return false;
2126
+ idleCount += 1;
1297
2127
  return true;
1298
2128
  });
1299
2129
  return {
@@ -1311,10 +2141,6 @@ window.__ModuleLoader__.load({
1311
2141
  if (last >= 55296 && last <= 56319 && next >= 56320 && next <= 57343) end--;
1312
2142
  return withoutNul.slice(0, end);
1313
2143
  }
1314
- /** Immutable membership toggle for the local expand-all array. */
1315
- function toggled(list, key) {
1316
- return list.includes(key) ? list.filter((k) => k !== key) : [...list, key];
1317
- }
1318
2144
  /**
1319
2145
  * Accept the native drag at document level while a row drag is active: row
1320
2146
  * hover still owns the insertion marker, and releasing outside the list must
@@ -1338,60 +2164,8 @@ window.__ModuleLoader__.load({
1338
2164
  };
1339
2165
  }, [active]);
1340
2166
  }
1341
- /** Reconcile a stored view order with the Workspace's current session account. */
1342
- function reconciledSessionOrder(sessionIds, stored) {
1343
- if (stored === void 0) return [...sessionIds];
1344
- const byId = new Map(sessionIds.map((id) => [id, id]));
1345
- const ordered = [];
1346
- const included = /* @__PURE__ */ new Set();
1347
- for (const key of stored) {
1348
- const id = byId.get(key);
1349
- if (id === void 0 || included.has(key)) continue;
1350
- ordered.push(id);
1351
- included.add(key);
1352
- }
1353
- for (const id of sessionIds) {
1354
- if (included.has(id)) continue;
1355
- ordered.push(id);
1356
- }
1357
- return ordered;
1358
- }
1359
- /** Newest update first with stable Session identity as the tie-break. */
1360
- function compareSessionRecency(a, b, byId) {
1361
- const aUpdatedAt = byId[a]?.updatedAt ?? Number.NEGATIVE_INFINITY;
1362
- const bUpdatedAt = byId[b]?.updatedAt ?? Number.NEGATIVE_INFINITY;
1363
- if (aUpdatedAt !== bUpdatedAt) return bUpdatedAt - aUpdatedAt;
1364
- return a < b ? -1 : 1;
1365
- }
1366
- /** Reconcile one editable order account and apply its activity-promotion policy. */
1367
- function nextSessionOrderAccount({ sessionIds, previousOrder, previousUpdatedAt, list, orderBy, sortByRecency }) {
1368
- let order = reconciledSessionOrder(sessionIds, previousOrder);
1369
- if (sortByRecency) order.sort((a, b) => compareSessionRecency(a, b, list.byId));
1370
- else if (orderBy === "updated") {
1371
- const promoted = sessionIds.filter((id) => {
1372
- const session = list.byId[id];
1373
- return session !== void 0 && (previousUpdatedAt[id] === void 0 || session.updatedAt > previousUpdatedAt[id]);
1374
- }).sort((a, b) => compareSessionRecency(a, b, list.byId));
1375
- if (promoted.length > 0) {
1376
- const promotedIds = new Set(promoted);
1377
- order = [...promoted, ...order.filter((id) => !promotedIds.has(id))];
1378
- }
1379
- }
1380
- const updatedAt = {};
1381
- for (const id of sessionIds) {
1382
- const session = list.byId[id];
1383
- if (session !== void 0) updatedAt[id] = session.updatedAt;
1384
- }
1385
- const orderChanged = previousOrder === void 0 || order.length !== previousOrder.length || order.some((id, index) => id !== previousOrder[index]);
1386
- const timestampsChanged = Object.keys(updatedAt).length !== Object.keys(previousUpdatedAt).length || Object.entries(updatedAt).some(([id, timestamp]) => previousUpdatedAt[id] !== timestamp);
1387
- return {
1388
- order,
1389
- updatedAt,
1390
- changed: orderChanged || timestampsChanged
1391
- };
1392
- }
1393
- /** Grouping and ordering menu; own open state so it resets with the wide chrome. */
1394
- function ViewOptionsMenu({ groupBy, orderBy, onGroupPick, onOrderPick, t }) {
2167
+ /** Grouping, ordering, and archived-filter menu; own open state so it resets with the wide chrome. */
2168
+ function ViewOptionsMenu({ groupBy, orderBy, archivedFilter, onGroupPick, onOrderPick, onArchivedFilterPick, t }) {
1395
2169
  const [open, setOpen] = (0, react.useState)(false);
1396
2170
  return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
1397
2171
  open,
@@ -1406,11 +2180,18 @@ window.__ModuleLoader__.load({
1406
2180
  },
1407
2181
  {
1408
2182
  id: "workspace",
1409
- label: t("groupBy.workspace")
2183
+ label: t("groupBy.workspace"),
2184
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, {})
2185
+ },
2186
+ {
2187
+ id: "workspace-tree",
2188
+ label: t("groupBy.workspaceTree"),
2189
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWorkspaceTreeOutlineRegular, {})
1410
2190
  },
1411
2191
  {
1412
2192
  id: "flat",
1413
- label: t("groupBy.flat")
2193
+ label: t("groupBy.flat"),
2194
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFlatListOutlineRegular, {})
1414
2195
  },
1415
2196
  {
1416
2197
  type: "separator",
@@ -1423,21 +2204,59 @@ window.__ModuleLoader__.load({
1423
2204
  },
1424
2205
  {
1425
2206
  id: "manual",
1426
- label: t("orderBy.manual")
2207
+ label: t("orderBy.manual"),
2208
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronsUpDownOutlineRegular, {})
1427
2209
  },
1428
2210
  {
1429
2211
  id: "updated",
1430
- label: t("orderBy.updated")
2212
+ label: t("orderBy.updated"),
2213
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, {})
2214
+ },
2215
+ {
2216
+ type: "separator",
2217
+ id: "archived-filter-separator"
2218
+ },
2219
+ {
2220
+ type: "label",
2221
+ id: "filter-by",
2222
+ text: t("filterBy.label")
2223
+ },
2224
+ {
2225
+ id: "hide-archived",
2226
+ label: t("viewOptions.hideArchived"),
2227
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOffOutlineRegular, {})
2228
+ },
2229
+ {
2230
+ id: "show-archived",
2231
+ label: t("viewOptions.showArchived"),
2232
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQueueOutlineRegular, {})
2233
+ },
2234
+ {
2235
+ id: "only-archived",
2236
+ label: t("viewOptions.onlyArchived"),
2237
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveCheckOutlineRegular, {})
1431
2238
  }
1432
2239
  ],
1433
- selectedIds: [groupBy, orderBy],
2240
+ selectedIds: [
2241
+ groupBy,
2242
+ orderBy,
2243
+ {
2244
+ default: "hide-archived",
2245
+ show: "show-archived",
2246
+ only: "only-archived"
2247
+ }[archivedFilter]
2248
+ ],
1434
2249
  onSelect: (id) => {
1435
- if (id === "workspace" || id === "flat") onGroupPick(id);
2250
+ if (id === "workspace" || id === "workspace-tree" || id === "flat") onGroupPick(id);
1436
2251
  else if (id === "manual" || id === "updated") onOrderPick(id);
2252
+ else if (id === "hide-archived") onArchivedFilterPick("default");
2253
+ else if (id === "show-archived") onArchivedFilterPick("show");
2254
+ else if (id === "only-archived") onArchivedFilterPick("only");
1437
2255
  setOpen(false);
1438
2256
  },
1439
2257
  align: "end",
1440
2258
  dense: true,
2259
+ listClassName: WorkspaceBrowser_module_css_default.viewOptionsMenu,
1441
2260
  portal: true,
1442
2261
  anchor: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1443
2262
  label: t("viewOptions.label"),
@@ -1450,30 +2269,61 @@ window.__ModuleLoader__.load({
1450
2269
  onClick: () => {
1451
2270
  setOpen((v) => !v);
1452
2271
  },
1453
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPersonalizationOutline16, {})
2272
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSlidersTwoOutlineRegular, {})
1454
2273
  })
1455
2274
  })
1456
2275
  });
1457
2276
  }
1458
- /** Resolve an insertion side from the full rendered workspace group. */
2277
+ /** Apply a visible drop to the complete account without removing hidden members. */
2278
+ function sessionDragOrder(order, rows, drag, over) {
2279
+ const source = rows.find((row) => row.id === drag.sessionId);
2280
+ const target = rows.find((row) => row.id === over.id);
2281
+ if (source === void 0 || target === void 0 || source.blank || source.pinned !== drag.pinned || target.pinned !== drag.pinned || source.id === target.id || !order.includes(source.id)) return;
2282
+ const section = rows.filter((row) => row.pinned === drag.pinned);
2283
+ const sourceIndex = section.findIndex((row) => row.id === source.id);
2284
+ if (section.filter((row) => row.id !== source.id).findIndex((row) => row.id === target.id) + (over.half === "after" ? 1 : 0) === sourceIndex) return;
2285
+ const next = order.filter((id) => id !== source.id);
2286
+ const targetIndex = next.indexOf(target.id);
2287
+ if (targetIndex === -1) return;
2288
+ next.splice(targetIndex + (over.half === "after" ? 1 : 0), 0, source.id);
2289
+ return pinCurrentBlank(next, rows.find((row) => row.blank)?.id);
2290
+ }
2291
+ /** Resolve an insertion side across the Workspace header, descendants, and Sessions. */
1459
2292
  function workspaceGroupHalf(e) {
1460
2293
  const rect = e.currentTarget.getBoundingClientRect();
1461
2294
  return e.clientY < rect.top + rect.height / 2 ? "before" : "after";
1462
2295
  }
1463
- /** The scrolling session tree; unmounting drops the sessions subscription and expand-all state. */
1464
- function SessionTree({ useSessions, useSessionPendingInteraction, startSession, open, forkSession, workspaces, archivedSessionIds, workspaceReady, usePanelInfo, onRenameRequest, onDeleteRequest, onSessionRename, onSessionArchive, insertWorkspaceBefore, insertSessionBefore, orderBy, groupExpansion, setGroupExpanded, sessionOrderByAccount, sessionUpdatedAtByAccount, syncSessionOrderAccount, setSessionOrder, home, t, revealSessionId, onSessionRevealed }) {
2296
+ /** The list-empty placeholder — a glyph over the text; the archived-only view names its filter and offers the way back. */
2297
+ function EmptySessions({ rowState, onLeaveArchivedOnly, t }) {
2298
+ const archivedOnly = rowState.archivedFilter === "only";
2299
+ return (0, react_jsx_runtime.jsxs)("div", {
2300
+ className: WorkspaceBrowser_module_css_default.emptyState,
2301
+ "data-row-key": "empty",
2302
+ children: [
2303
+ archivedOnly ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutlineRegular, { size: 24 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQueueOutlineRegular, { size: 24 }),
2304
+ (0, react_jsx_runtime.jsx)("div", { children: archivedOnly ? t("empty.noneArchived") : t("empty.none") }),
2305
+ archivedOnly && (0, react_jsx_runtime.jsx)("button", {
2306
+ type: "button",
2307
+ className: WorkspaceBrowser_module_css_default.emptyAction,
2308
+ onClick: onLeaveArchivedOnly,
2309
+ children: t("empty.viewOthers")
2310
+ })
2311
+ ]
2312
+ });
2313
+ }
2314
+ /** The scrolling session tree; unmounting drops the sessions subscription and local row limits. */
2315
+ function SessionTree({ list, useSessionStatus, startSession, open, workspaces, ungroupedSessionIds, rowState, onLeaveArchivedOnly, workspaceReady, animationResetKey, usePanelInfo, onRenameRequest, onDeleteRequest, onSessionRenameRequest, renderSlot, insertWorkspaceBefore, nestWorkspaces, groupExpansion, setGroupExpanded, setSessionOrder, home, t, revealSessionId, onSessionRevealed, shortcuts }) {
1465
2316
  const panelActive = usePanelInfo((info) => info.activePanelId !== null);
1466
- const list = useSessions((s) => s);
1467
- const pendingInteractions = useSessionPendingInteraction((s) => s);
1468
- const current = panelActive ? void 0 : list.current;
2317
+ const statuses = useSessionStatus((s) => s);
2318
+ const current = panelActive ? void 0 : Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
1469
2319
  const revealGroup = revealSessionId === void 0 || !workspaceReady ? void 0 : owningGroupKey(workspaces, revealSessionId);
1470
- const [expandedSessionGroups, setExpandedSessionGroups] = (0, react.useState)([]);
2320
+ const [sessionLimits, setSessionLimits] = (0, react.useState)({});
1471
2321
  const [drag, setDrag] = (0, react.useState)(null);
1472
2322
  const sessionDropCommitted = (0, react.useRef)(false);
1473
2323
  const [workspaceDrag, setWorkspaceDrag] = (0, react.useState)(null);
1474
2324
  const workspaceDropCommitted = (0, react.useRef)(false);
1475
- const previousOrderBy = (0, react.useRef)(orderBy);
1476
- useNativeDragAcceptance(drag !== null || workspaceDrag !== null);
2325
+ const nativeDragActive = drag !== null || workspaceDrag !== null;
2326
+ useNativeDragAcceptance(nativeDragActive);
1477
2327
  const currentGroup = current === void 0 || !workspaceReady ? void 0 : owningGroupKey(workspaces, current);
1478
2328
  (0, react.useEffect)(() => {
1479
2329
  if (current === void 0 || currentGroup === void 0 || Object.hasOwn(groupExpansion, currentGroup)) return;
@@ -1484,70 +2334,44 @@ window.__ModuleLoader__.load({
1484
2334
  setGroupExpanded,
1485
2335
  groupExpansion
1486
2336
  ]);
1487
- const expandedGroups = (0, react.useMemo)(() => Object.entries(groupExpansion).filter(([, expanded]) => expanded).map(([key]) => key), [groupExpansion]);
1488
- const ungroupedSessionIds = (0, react.useMemo)(() => {
1489
- const accounted = new Set(workspaces.flatMap((workspace) => workspace.sessionIds));
1490
- return list.ids.filter((id) => list.byId[id] !== void 0 && !accounted.has(id));
1491
- }, [list, workspaces]);
1492
- (0, react.useEffect)(() => {
1493
- if (list.phase !== "ready") return;
1494
- const switchedToUpdated = previousOrderBy.current !== "updated" && orderBy === "updated";
1495
- previousOrderBy.current = orderBy;
1496
- const accounts = [...workspaces.map((workspace) => ({
1497
- key: workspace.workspaceId,
1498
- sessionIds: workspace.sessionIds.filter((id) => list.byId[id] !== void 0)
1499
- })), {
1500
- key: "",
1501
- sessionIds: ungroupedSessionIds
1502
- }];
1503
- for (const { key, sessionIds } of accounts) {
1504
- const previousOrder = sessionOrderByAccount[key];
1505
- const next = nextSessionOrderAccount({
1506
- sessionIds,
1507
- previousOrder,
1508
- previousUpdatedAt: sessionUpdatedAtByAccount[key] ?? {},
1509
- list,
1510
- orderBy,
1511
- sortByRecency: orderBy === "updated" && (previousOrder === void 0 || switchedToUpdated)
1512
- });
1513
- if (next.changed) syncSessionOrderAccount(key, next.order.map((id) => id), next.updatedAt);
1514
- }
2337
+ const parents = (0, react.useMemo)(() => {
2338
+ if (!nestWorkspaces) return /* @__PURE__ */ new Map();
2339
+ const keysByPath = new Map(workspaces.map((workspace) => [workspace.path, workspace.workspaceId]));
2340
+ const paths = [...keysByPath.keys()];
2341
+ return new Map(workspaces.map((workspace) => {
2342
+ const path = owningParentFolder(workspace.path, paths);
2343
+ return [workspace.workspaceId, path === void 0 ? void 0 : keysByPath.get(path)];
2344
+ }));
2345
+ }, [nestWorkspaces, workspaces]);
2346
+ const currentAncestors = (0, react.useMemo)(() => {
2347
+ const keys = /* @__PURE__ */ new Set();
2348
+ for (let key = currentGroup === void 0 ? void 0 : parents.get(currentGroup); key !== void 0; key = parents.get(key)) keys.add(key);
2349
+ return keys;
2350
+ }, [currentGroup, parents]);
2351
+ const expandedGroups = (0, react.useMemo)(() => {
2352
+ const ancestorKeys = new Set(parents.values());
2353
+ return [...workspaces.map((workspace) => workspace.workspaceId), ""].filter((key) => groupExpansion[key] ?? ancestorKeys.has(key));
1515
2354
  }, [
1516
- list,
1517
- orderBy,
1518
- sessionOrderByAccount,
1519
- sessionUpdatedAtByAccount,
1520
- syncSessionOrderAccount,
1521
- ungroupedSessionIds,
2355
+ groupExpansion,
2356
+ parents,
1522
2357
  workspaces
1523
2358
  ]);
1524
- const orderedWorkspaces = (0, react.useMemo)(() => {
1525
- return workspaces.map((workspace) => {
1526
- const stored = sessionOrderByAccount[workspace.workspaceId];
1527
- const sessionIds = reconciledSessionOrder(workspace.sessionIds, stored);
1528
- return {
1529
- ...workspace,
1530
- sessionIds
1531
- };
1532
- });
1533
- }, [sessionOrderByAccount, workspaces]);
1534
- const orderedUngroupedSessionIds = (0, react.useMemo)(() => reconciledSessionOrder(ungroupedSessionIds, sessionOrderByAccount[""]), [sessionOrderByAccount, ungroupedSessionIds]);
1535
- const groups = (0, react.useMemo)(() => deriveGroups(list, orderedWorkspaces, archivedSessionIds, pendingInteractions, {
2359
+ const groups = (0, react.useMemo)(() => deriveGroups(list, workspaces, rowState, statuses, {
1536
2360
  expandedGroups,
1537
- ...sessionOrderByAccount[""] === void 0 ? {} : { ungroupedOrder: sessionOrderByAccount[""] }
2361
+ ungroupedOrder: ungroupedSessionIds
1538
2362
  }), [
1539
2363
  list,
1540
- orderedWorkspaces,
1541
- archivedSessionIds,
1542
- pendingInteractions,
2364
+ workspaces,
2365
+ rowState,
2366
+ statuses,
1543
2367
  expandedGroups,
1544
- sessionOrderByAccount
2368
+ ungroupedSessionIds
1545
2369
  ]);
1546
2370
  (0, react.useEffect)(() => {
1547
- if (revealGroup === void 0 || groupExpansion[revealGroup] === true) return;
1548
- setGroupExpanded(revealGroup, true);
2371
+ for (let key = revealGroup; key !== void 0; key = parents.get(key)) if (groupExpansion[key] === false || key === revealGroup && groupExpansion[key] !== true) setGroupExpanded(key, true);
1549
2372
  }, [
1550
2373
  groupExpansion,
2374
+ parents,
1551
2375
  revealGroup,
1552
2376
  setGroupExpanded
1553
2377
  ]);
@@ -1556,7 +2380,10 @@ window.__ModuleLoader__.load({
1556
2380
  const group = groups.find((candidate) => candidate.key === revealGroup);
1557
2381
  if (group === void 0 || !group.expanded || !group.sessions.some((row) => row.id === revealSessionId)) return;
1558
2382
  if (collapsedSessionRows(group.sessions).rows.some((row) => row.id === revealSessionId)) return;
1559
- setExpandedSessionGroups((keys) => keys.includes(revealGroup) ? keys : [...keys, revealGroup]);
2383
+ setSessionLimits((limits) => limits[revealGroup] === Infinity ? limits : {
2384
+ ...limits,
2385
+ [revealGroup]: Infinity
2386
+ });
1560
2387
  }, [
1561
2388
  groups,
1562
2389
  revealGroup,
@@ -1569,313 +2396,298 @@ window.__ModuleLoader__.load({
1569
2396
  setDrag(null);
1570
2397
  const group = groups.find((candidate) => candidate.key === activeDrag.accountKey);
1571
2398
  if (group === void 0) return;
1572
- const sessionsExpanded = expandedSessionGroups.includes(group.key);
1573
- const renderedSessions = sessionsExpanded ? group.sessions : collapsedSessionRows(group.sessions).rows;
1574
- const targetIndex = renderedSessions.findIndex((session) => session.id === over.id);
1575
- if (targetIndex === -1) return;
1576
- const sourceIndex = renderedSessions.findIndex((session) => session.id === activeDrag.sessionId);
1577
2399
  if (over.id === activeDrag.sessionId) return;
1578
- const withoutSource = renderedSessions.filter((session) => session.id !== activeDrag.sessionId);
1579
- const targetWithoutSourceIndex = withoutSource.findIndex((session) => session.id === over.id);
1580
- if (targetWithoutSourceIndex === -1) return;
1581
- const visibleInsertAt = over.half === "before" ? targetWithoutSourceIndex : targetWithoutSourceIndex + 1;
1582
- if (sourceIndex !== -1 && visibleInsertAt === sourceIndex) return;
1583
- const accountSessionIds = activeDrag.accountKey === "" ? orderedUngroupedSessionIds : orderedWorkspaces.find((workspace) => workspace.workspaceId === activeDrag.accountKey)?.sessionIds;
2400
+ const accountSessionIds = activeDrag.accountKey === "" ? ungroupedSessionIds : workspaces.find((workspace) => workspace.workspaceId === activeDrag.accountKey)?.sessionIds;
1584
2401
  if (accountSessionIds === void 0) return;
1585
- const nextOrder = accountSessionIds.filter((id) => id !== activeDrag.sessionId);
1586
- let anchor;
1587
- if (sessionsExpanded) anchor = over.half === "before" ? over.id : renderedSessions[targetIndex + 1]?.id;
1588
- else {
1589
- const previousVisible = withoutSource[visibleInsertAt - 1]?.id;
1590
- if (previousVisible === void 0) anchor = nextOrder[0];
1591
- else {
1592
- const previousIndex = nextOrder.indexOf(previousVisible);
1593
- if (previousIndex === -1) return;
1594
- anchor = nextOrder[previousIndex + 1];
1595
- }
1596
- }
1597
- const insertAt = anchor === void 0 ? nextOrder.length : nextOrder.indexOf(anchor);
1598
- nextOrder.splice(insertAt === -1 ? nextOrder.length : insertAt, 0, activeDrag.sessionId);
1599
- if (!sessionsExpanded && sourceIndex !== -1) {
1600
- const nodes = new Map(group.sessions.map((node) => [node.id, node]));
1601
- if (!collapsedSessionRows(nextOrder.flatMap((id) => {
1602
- const node = nodes.get(id);
1603
- return node === void 0 ? [] : [node];
1604
- })).rows.some((node) => node.id === activeDrag.sessionId)) return;
1605
- }
1606
- setSessionOrder(activeDrag.accountKey, nextOrder.map((id) => id));
1607
- if (orderBy === "updated" || activeDrag.accountKey === "") return;
1608
- insertSessionBefore(activeDrag.accountKey, activeDrag.sessionId, anchor).catch((reason) => {
1609
- console.warn("session reorder rejected:", reason);
1610
- });
2402
+ const renderedSessions = collapsedSessionRows(group.sessions, sessionLimits[group.key]).rows;
2403
+ const nextOrder = sessionDragOrder(accountSessionIds, renderedSessions, activeDrag, over);
2404
+ if (nextOrder !== void 0) setSessionOrder(activeDrag.accountKey, nextOrder);
1611
2405
  };
1612
2406
  const commitWorkspaceDrag = (activeDrag, over) => {
1613
2407
  if (workspaceDropCommitted.current) return;
1614
2408
  workspaceDropCommitted.current = true;
1615
2409
  setWorkspaceDrag(null);
1616
- const rowIndex = workspaces.findIndex((workspace) => workspace.workspaceId === over.id);
2410
+ const owner = parents.get(activeDrag.workspaceId);
2411
+ const siblings = workspaces.filter((workspace) => parents.get(workspace.workspaceId) === owner);
2412
+ const rowIndex = siblings.findIndex((workspace) => workspace.workspaceId === over.id);
1617
2413
  if (rowIndex === -1) return;
1618
- const anchor = over.half === "before" ? over.id : workspaces[rowIndex + 1]?.workspaceId;
2414
+ const anchor = over.half === "before" ? over.id : siblings[rowIndex + 1]?.workspaceId;
1619
2415
  if (anchor === activeDrag.workspaceId) return;
1620
- const sourceIndex = workspaces.findIndex((workspace) => workspace.workspaceId === activeDrag.workspaceId);
1621
- const anchorIndex = anchor === void 0 ? workspaces.length : workspaces.findIndex((workspace) => workspace.workspaceId === anchor);
2416
+ const sourceIndex = siblings.findIndex((workspace) => workspace.workspaceId === activeDrag.workspaceId);
2417
+ const anchorIndex = anchor === void 0 ? siblings.length : siblings.findIndex((workspace) => workspace.workspaceId === anchor);
1622
2418
  if (sourceIndex !== -1 && (anchorIndex === sourceIndex || anchorIndex === sourceIndex + 1)) return;
1623
2419
  insertWorkspaceBefore(activeDrag.workspaceId, anchor).catch((reason) => {
1624
2420
  console.warn("workspace reorder rejected:", reason);
1625
2421
  });
1626
2422
  };
1627
- const workspaceDropAtListStart = groups[0]?.workspaceId !== void 0 && workspaceDrag?.over?.id === groups[0].workspaceId && workspaceDrag.over.half === "before";
1628
- return (0, react_jsx_runtime.jsxs)("div", {
1629
- className: clsx(WorkspaceBrowser_module_css_default.treeBody, WorkspaceBrowser_module_css_default.wide),
1630
- children: [
1631
- workspaceDropAtListStart && (0, react_jsx_runtime.jsx)("span", {
1632
- className: WorkspaceBrowser_module_css_default.listTopDropIndicator,
1633
- "aria-hidden": "true"
1634
- }),
1635
- (0, react_jsx_runtime.jsxs)("div", {
1636
- className: clsx(WorkspaceBrowser_module_css_default.list, workspaceDropAtListStart && WorkspaceBrowser_module_css_default.listTopDropActive),
1637
- role: "tree",
1638
- "aria-label": t("section.sessions"),
1639
- children: [groups.length === 0 && (0, react_jsx_runtime.jsx)("div", {
1640
- className: WorkspaceBrowser_module_css_default.empty,
1641
- children: t("empty.none")
1642
- }), groups.map((group) => {
1643
- const workspaceId = group.workspaceId;
1644
- const collapsed = collapsedSessionRows(group.sessions);
1645
- const sessionsExpanded = expandedSessionGroups.includes(group.key);
1646
- const workspaceMarker = workspaceId !== void 0 && workspaceDrag?.over?.id === workspaceId ? workspaceDrag.over.half : null;
1647
- const workspaceDragProps = workspaceId === void 0 ? void 0 : {
2423
+ const childrenByParent = (0, react.useMemo)(() => {
2424
+ const rendered = new Set(groups.map((group) => group.key));
2425
+ const children = /* @__PURE__ */ new Map();
2426
+ for (const group of groups) {
2427
+ let parent = parents.get(group.key);
2428
+ while (parent !== void 0 && !rendered.has(parent)) parent = parents.get(parent);
2429
+ const siblings = children.get(parent);
2430
+ if (siblings === void 0) children.set(parent, [group]);
2431
+ else siblings.push(group);
2432
+ }
2433
+ return children;
2434
+ }, [groups, parents]);
2435
+ const rootGroups = childrenByParent.get(void 0) ?? [];
2436
+ const workspaceDropAtListStart = rootGroups[0]?.workspaceId !== void 0 && workspaceDrag?.over?.id === rootGroups[0].workspaceId && workspaceDrag.over.half === "before";
2437
+ const rowKeys = groups.length === 0 ? ["empty"] : [];
2438
+ const renderGroup = (group, depth) => {
2439
+ const workspaceId = group.workspaceId;
2440
+ const children = childrenByParent.get(group.key) ?? [];
2441
+ const compatibleDrag = workspaceDrag !== null && parents.get(workspaceDrag.workspaceId) === parents.get(group.key);
2442
+ const collapsed = collapsedSessionRows(group.sessions);
2443
+ const visible = collapsedSessionRows(group.sessions, sessionLimits[group.key]);
2444
+ const sessionsExpanded = visible.hiddenCount === 0;
2445
+ rowKeys.push(`workspace:${group.key}`);
2446
+ const childRows = group.expanded ? children.map((child) => renderGroup(child, depth + 1)) : [];
2447
+ const sessions = visible.rows;
2448
+ for (const node of sessions) rowKeys.push(`session:${node.id}`);
2449
+ if (collapsed.hiddenCount > 0) rowKeys.push(`overflow:${group.key}`);
2450
+ const workspaceMarker = workspaceId !== void 0 && workspaceDrag?.over?.id === workspaceId ? workspaceDrag.over.half : null;
2451
+ const workspaceDragProps = workspaceId === void 0 ? void 0 : {
2452
+ start: () => {
2453
+ workspaceDropCommitted.current = false;
2454
+ setWorkspaceDrag({
2455
+ workspaceId,
2456
+ over: null
2457
+ });
2458
+ },
2459
+ end: () => {
2460
+ if (workspaceDrag?.over !== null && workspaceDrag?.over !== void 0) commitWorkspaceDrag(workspaceDrag, workspaceDrag.over);
2461
+ else setWorkspaceDrag(null);
2462
+ workspaceDropCommitted.current = false;
2463
+ }
2464
+ };
2465
+ const hoverWorkspace = workspaceId === void 0 || !compatibleDrag ? void 0 : (half) => {
2466
+ setWorkspaceDrag((active) => active === null ? active : {
2467
+ ...active,
2468
+ over: {
2469
+ id: workspaceId,
2470
+ half
2471
+ }
2472
+ });
2473
+ };
2474
+ const dropWorkspace = workspaceId === void 0 || !compatibleDrag ? void 0 : (half) => {
2475
+ commitWorkspaceDrag(workspaceDrag, {
2476
+ id: workspaceId,
2477
+ half
2478
+ });
2479
+ };
2480
+ return (0, react_jsx_runtime.jsxs)("div", {
2481
+ style: { "--dsh-workspace-indent": `${depth * 12}px` },
2482
+ className: clsx(WorkspaceBrowser_module_css_default.groupSection, workspaceMarker === "before" && WorkspaceBrowser_module_css_default.workspaceDropBefore, workspaceMarker === "after" && WorkspaceBrowser_module_css_default.workspaceDropAfter),
2483
+ onDragOver: workspaceDrag === null ? void 0 : (e) => {
2484
+ e.preventDefault();
2485
+ if (hoverWorkspace === void 0 && parents.get(group.key) !== void 0) return;
2486
+ e.stopPropagation();
2487
+ if (hoverWorkspace === void 0) {
2488
+ e.dataTransfer.dropEffect = "none";
2489
+ if (workspaceDrag.over !== null) setWorkspaceDrag({
2490
+ ...workspaceDrag,
2491
+ over: null
2492
+ });
2493
+ } else {
2494
+ e.dataTransfer.dropEffect = "move";
2495
+ hoverWorkspace(workspaceGroupHalf(e));
2496
+ }
2497
+ },
2498
+ onDrop: workspaceDrag === null ? void 0 : (e) => {
2499
+ e.preventDefault();
2500
+ if (dropWorkspace === void 0 && parents.get(group.key) !== void 0) return;
2501
+ e.stopPropagation();
2502
+ if (dropWorkspace === void 0) {
2503
+ workspaceDropCommitted.current = true;
2504
+ setWorkspaceDrag(null);
2505
+ } else dropWorkspace(workspaceGroupHalf(e));
2506
+ },
2507
+ children: [
2508
+ (0, react_jsx_runtime.jsx)(ProjectRowItem, {
2509
+ newShortcut: shortcuts.find((row) => row.id === "session.new"),
2510
+ group,
2511
+ containsCurrentDescendant: currentAncestors.has(group.key),
2512
+ home,
2513
+ t,
2514
+ onToggle: () => {
2515
+ if (group.expanded) setSessionLimits((limits) => ({
2516
+ ...limits,
2517
+ [group.key]: COLLAPSED_SESSION_LIMIT
2518
+ }));
2519
+ setGroupExpanded(group.key, !group.expanded);
2520
+ },
2521
+ onCreate: () => {
2522
+ if (group.workspaceId !== void 0) {
2523
+ setGroupExpanded(group.key, true);
2524
+ startSession(group.workspaceId);
2525
+ }
2526
+ },
2527
+ drag: workspaceDragProps,
2528
+ actions: group.workspaceId === void 0 ? void 0 : {
2529
+ rename: () => {
2530
+ /* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
2531
+ if (group.workspaceId !== void 0) onRenameRequest(group.workspaceId, group.label);
2532
+ },
2533
+ delete: () => {
2534
+ /* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
2535
+ if (group.workspaceId !== void 0) onDeleteRequest(group.workspaceId, group.label);
2536
+ }
2537
+ }
2538
+ }),
2539
+ childRows.length > 0 && (0, react_jsx_runtime.jsx)("div", {
2540
+ role: "group",
2541
+ children: childRows
2542
+ }),
2543
+ sessions.map((node) => {
2544
+ const sameGroupDrag = drag !== null && drag.accountKey === group.key;
2545
+ const compatibleTarget = sameGroupDrag && drag.pinned === node.pinned;
2546
+ const normalizeHalf = (half) => node.blank ? "after" : half;
2547
+ const dragProps = {
1648
2548
  start: () => {
1649
- workspaceDropCommitted.current = false;
1650
- setWorkspaceDrag({
1651
- workspaceId,
2549
+ sessionDropCommitted.current = false;
2550
+ setDrag({
2551
+ accountKey: group.key,
2552
+ sessionId: node.id,
2553
+ pinned: node.pinned,
1652
2554
  over: null
1653
2555
  });
1654
2556
  },
2557
+ active: compatibleTarget,
2558
+ marker: sameGroupDrag && drag.over?.id === node.id ? drag.over.half : null,
2559
+ hover: (half) => {
2560
+ /* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
2561
+ setDrag((d) => d === null ? d : {
2562
+ ...d,
2563
+ over: {
2564
+ id: node.id,
2565
+ half: normalizeHalf(half)
2566
+ }
2567
+ });
2568
+ },
2569
+ drop: (half) => {
2570
+ /* v8 ignore next -- narrowing guard: Rows gates drop on `active`, which is false while the drag state is null. */
2571
+ if (drag === null) return;
2572
+ commitSessionDrag(drag, {
2573
+ id: node.id,
2574
+ half: normalizeHalf(half)
2575
+ });
2576
+ },
1655
2577
  end: () => {
1656
- if (workspaceDrag?.over !== null && workspaceDrag?.over !== void 0) commitWorkspaceDrag(workspaceDrag, workspaceDrag.over);
1657
- else setWorkspaceDrag(null);
1658
- workspaceDropCommitted.current = false;
2578
+ if (drag?.over !== null && drag?.over !== void 0) commitSessionDrag(drag, drag.over);
2579
+ else setDrag(null);
2580
+ sessionDropCommitted.current = false;
1659
2581
  }
1660
2582
  };
1661
- const hoverWorkspace = workspaceId === void 0 ? void 0 : (half) => {
1662
- setWorkspaceDrag((active) => active === null ? active : {
1663
- ...active,
1664
- over: {
1665
- id: workspaceId,
1666
- half
1667
- }
1668
- });
1669
- };
1670
- const dropWorkspace = workspaceId === void 0 ? void 0 : (half) => {
1671
- if (workspaceDrag === null) return;
1672
- commitWorkspaceDrag(workspaceDrag, {
1673
- id: workspaceId,
1674
- half
1675
- });
1676
- };
1677
- return (0, react_jsx_runtime.jsxs)("div", {
1678
- className: clsx(WorkspaceBrowser_module_css_default.groupSection, workspaceMarker === "before" && WorkspaceBrowser_module_css_default.workspaceDropBefore, workspaceMarker === "after" && WorkspaceBrowser_module_css_default.workspaceDropAfter),
1679
- onDragOver: workspaceDrag === null || hoverWorkspace === void 0 ? void 0 : (e) => {
1680
- e.preventDefault();
1681
- e.dataTransfer.dropEffect = "move";
1682
- hoverWorkspace(workspaceGroupHalf(e));
1683
- },
1684
- onDrop: workspaceDrag === null || dropWorkspace === void 0 ? void 0 : (e) => {
1685
- e.preventDefault();
1686
- dropWorkspace(workspaceGroupHalf(e));
1687
- },
1688
- children: [
1689
- (0, react_jsx_runtime.jsx)(ProjectRowItem, {
1690
- group,
1691
- home,
1692
- t,
1693
- onToggle: () => {
1694
- if (group.expanded) setExpandedSessionGroups((keys) => keys.filter((key) => key !== group.key));
1695
- setGroupExpanded(group.key, !group.expanded);
1696
- },
1697
- onCreate: () => {
1698
- if (group.workspaceId !== void 0) {
1699
- setGroupExpanded(group.key, true);
1700
- startSession(group.workspaceId);
1701
- }
1702
- },
1703
- drag: workspaceDragProps,
1704
- actions: group.workspaceId === void 0 ? void 0 : {
1705
- rename: () => {
1706
- /* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
1707
- if (group.workspaceId !== void 0) onRenameRequest(group.workspaceId, group.label);
1708
- },
1709
- delete: () => {
1710
- /* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
1711
- if (group.workspaceId !== void 0) onDeleteRequest(group.workspaceId, group.label);
1712
- }
1713
- }
1714
- }),
1715
- (sessionsExpanded ? group.sessions : collapsed.rows).map((node) => {
1716
- const sameGroupDrag = drag !== null && drag.accountKey === group.key;
1717
- const dragProps = {
1718
- start: () => {
1719
- sessionDropCommitted.current = false;
1720
- setDrag({
1721
- accountKey: group.key,
1722
- sessionId: node.id,
1723
- over: null
1724
- });
1725
- },
1726
- active: sameGroupDrag,
1727
- marker: sameGroupDrag && drag.over?.id === node.id ? drag.over.half : null,
1728
- hover: (half) => {
1729
- /* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
1730
- setDrag((d) => d === null ? d : {
1731
- ...d,
1732
- over: {
1733
- id: node.id,
1734
- half
1735
- }
1736
- });
1737
- },
1738
- drop: (half) => {
1739
- /* v8 ignore next -- narrowing guard: Rows gates drop on `active`, which is false while the drag state is null. */
1740
- if (drag === null) return;
1741
- commitSessionDrag(drag, {
1742
- id: node.id,
1743
- half
1744
- });
1745
- },
1746
- end: () => {
1747
- if (drag?.over !== null && drag?.over !== void 0) commitSessionDrag(drag, drag.over);
1748
- else setDrag(null);
1749
- sessionDropCommitted.current = false;
1750
- }
1751
- };
1752
- return (0, react_jsx_runtime.jsx)(SessionNodeItem, {
1753
- node,
1754
- currentId: current,
1755
- now,
1756
- onOpen: open,
1757
- onRename: onSessionRename,
1758
- onFork: forkSession,
1759
- onArchive: onSessionArchive,
1760
- onReveal: node.id === revealSessionId && group.key === revealGroup ? () => {
1761
- onSessionRevealed(node.id);
1762
- } : void 0,
1763
- drag: dragProps,
1764
- t
1765
- }, node.id);
1766
- }),
1767
- collapsed.hiddenCount > 0 && (0, react_jsx_runtime.jsx)("button", {
1768
- type: "button",
1769
- className: WorkspaceBrowser_module_css_default.sessionOverflowButton,
1770
- "aria-expanded": sessionsExpanded,
1771
- onClick: () => {
1772
- setExpandedSessionGroups((keys) => toggled(keys, group.key));
1773
- },
1774
- children: sessionsExpanded ? t("sessions.collapse") : t("sessions.expand", { n: collapsed.hiddenCount })
1775
- })
1776
- ]
1777
- }, group.key);
1778
- })]
2583
+ return (0, react_jsx_runtime.jsx)(SessionNodeItem, {
2584
+ node,
2585
+ currentId: current,
2586
+ now,
2587
+ onOpen: open,
2588
+ onRenameRequest: onSessionRenameRequest,
2589
+ renderSlot,
2590
+ onReveal: node.id === revealSessionId && group.key === revealGroup ? () => {
2591
+ onSessionRevealed(node.id);
2592
+ } : void 0,
2593
+ drag: dragProps,
2594
+ t
2595
+ }, node.id);
2596
+ }),
2597
+ collapsed.hiddenCount > 0 && (0, react_jsx_runtime.jsx)("button", {
2598
+ type: "button",
2599
+ className: WorkspaceBrowser_module_css_default.sessionOverflowButton,
2600
+ "data-row-key": `overflow:${group.key}`,
2601
+ "aria-expanded": sessionsExpanded,
2602
+ onClick: () => {
2603
+ setSessionLimits((limits) => ({
2604
+ ...limits,
2605
+ [group.key]: sessionsExpanded ? COLLAPSED_SESSION_LIMIT : visible.hiddenCount <= COLLAPSED_SESSION_LIMIT ? Infinity : (limits[group.key] ?? COLLAPSED_SESSION_LIMIT) + COLLAPSED_SESSION_LIMIT
2606
+ }));
2607
+ },
2608
+ children: sessionsExpanded ? t("sessions.collapse") : t("sessions.expand", { n: visible.hiddenCount })
2609
+ })
2610
+ ]
2611
+ }, group.key);
2612
+ };
2613
+ const groupRows = rootGroups.map((group) => renderGroup(group, 0));
2614
+ return (0, react_jsx_runtime.jsxs)("div", {
2615
+ className: clsx(WorkspaceBrowser_module_css_default.treeBody, WorkspaceBrowser_module_css_default.wide),
2616
+ children: [
2617
+ workspaceDropAtListStart && (0, react_jsx_runtime.jsx)("span", {
2618
+ className: WorkspaceBrowser_module_css_default.listTopDropIndicator,
2619
+ "aria-hidden": "true"
2620
+ }),
2621
+ (0, react_jsx_runtime.jsxs)(AnimatedRows, {
2622
+ className: clsx(WorkspaceBrowser_module_css_default.list, workspaceDropAtListStart && WorkspaceBrowser_module_css_default.listTopDropActive),
2623
+ label: t("section.sessions"),
2624
+ rowKeys,
2625
+ ready: list.phase === "ready" && workspaceReady && !nativeDragActive,
2626
+ resetKey: JSON.stringify([animationResetKey, sessionLimits]),
2627
+ children: [groups.length === 0 && (0, react_jsx_runtime.jsx)(EmptySessions, {
2628
+ rowState,
2629
+ onLeaveArchivedOnly,
2630
+ t
2631
+ }), groupRows]
1779
2632
  }),
1780
2633
  (0, react_jsx_runtime.jsx)("span", { className: WorkspaceBrowser_module_css_default.fade })
1781
2634
  ]
1782
2635
  });
1783
2636
  }
1784
2637
  /** The flat "In one list" body: every session is one draggable top-level row. */
1785
- function FlatList({ useSessions, useSessionPendingInteraction, open, forkSession, onSessionRename, onSessionArchive, archivedSessionIds, usePanelInfo, orderBy, sessionOrderByAccount, sessionUpdatedAtByAccount, syncSessionOrderAccount, setSessionOrder, revealSessionId, onSessionRevealed, t }) {
2638
+ function FlatList({ list, sessionIds, rowState, onLeaveArchivedOnly, useSessionStatus, open, onSessionRenameRequest, usePanelInfo, setSessionOrder, workspaceReady, animationResetKey, revealSessionId, onSessionRevealed, renderSlot, t }) {
1786
2639
  const panelActive = usePanelInfo((info) => info.activePanelId !== null);
1787
- const list = useSessions((s) => s);
1788
- const pendingInteractions = useSessionPendingInteraction((s) => s);
1789
- const baseRows = (0, react.useMemo)(() => deriveFlat(list, archivedSessionIds, pendingInteractions), [
1790
- list,
1791
- archivedSessionIds,
1792
- pendingInteractions
1793
- ]);
1794
- const sessionIds = (0, react.useMemo)(() => baseRows.map((row) => row.id), [baseRows]);
1795
- const previousOrderBy = (0, react.useRef)(orderBy);
1796
- (0, react.useEffect)(() => {
1797
- if (list.phase !== "ready") return;
1798
- const previousOrder = sessionOrderByAccount[FLAT_SESSION_ORDER_KEY];
1799
- const previousUpdatedAt = sessionUpdatedAtByAccount["__flat_session_order__"] ?? {};
1800
- const switchedToUpdated = previousOrderBy.current !== "updated" && orderBy === "updated";
1801
- previousOrderBy.current = orderBy;
1802
- const next = nextSessionOrderAccount({
1803
- sessionIds,
1804
- previousOrder,
1805
- previousUpdatedAt,
1806
- list,
1807
- orderBy,
1808
- sortByRecency: orderBy === "updated" && (previousOrder === void 0 || switchedToUpdated)
1809
- });
1810
- if (next.changed) syncSessionOrderAccount(FLAT_SESSION_ORDER_KEY, next.order.map((id) => id), next.updatedAt);
1811
- }, [
2640
+ const statuses = useSessionStatus((s) => s);
2641
+ const rows = (0, react.useMemo)(() => deriveFlat(list, sessionIds, rowState, statuses), [
1812
2642
  list,
1813
- orderBy,
1814
- sessionOrderByAccount,
1815
- sessionUpdatedAtByAccount,
1816
2643
  sessionIds,
1817
- syncSessionOrderAccount
1818
- ]);
1819
- const rows = (0, react.useMemo)(() => {
1820
- const byId = new Map(baseRows.map((row) => [row.id, row]));
1821
- return reconciledSessionOrder(sessionIds, sessionOrderByAccount[FLAT_SESSION_ORDER_KEY]).flatMap((id) => {
1822
- const row = byId.get(id);
1823
- return row === void 0 ? [] : [row];
1824
- });
1825
- }, [
1826
- baseRows,
1827
- sessionOrderByAccount,
1828
- sessionIds
2644
+ rowState,
2645
+ statuses
1829
2646
  ]);
1830
2647
  const [drag, setDrag] = (0, react.useState)(null);
1831
2648
  const dropCommitted = (0, react.useRef)(false);
1832
2649
  useNativeDragAcceptance(drag !== null);
2650
+ const currentId = panelActive ? void 0 : Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
1833
2651
  const commitDrag = (activeDrag, over) => {
1834
2652
  if (dropCommitted.current) return;
1835
2653
  dropCommitted.current = true;
1836
2654
  setDrag(null);
1837
- const targetIndex = rows.findIndex((row) => row.id === over.id);
1838
- if (targetIndex === -1) return;
1839
- const anchor = over.half === "before" ? over.id : rows[targetIndex + 1]?.id;
1840
- if (anchor === activeDrag.sessionId) return;
1841
- const sourceIndex = rows.findIndex((row) => row.id === activeDrag.sessionId);
1842
- const anchorIndex = anchor === void 0 ? rows.length : rows.findIndex((row) => row.id === anchor);
1843
- if (sourceIndex !== -1 && (anchorIndex === sourceIndex || anchorIndex === sourceIndex + 1)) return;
1844
- const nextOrder = rows.map((row) => row.id).filter((id) => id !== activeDrag.sessionId);
1845
- const insertAt = anchor === void 0 ? nextOrder.length : nextOrder.indexOf(anchor);
1846
- nextOrder.splice(insertAt === -1 ? nextOrder.length : insertAt, 0, activeDrag.sessionId);
1847
- setSessionOrder(FLAT_SESSION_ORDER_KEY, nextOrder.map((id) => id));
2655
+ const nextOrder = sessionDragOrder(sessionIds, rows, activeDrag, over);
2656
+ if (nextOrder !== void 0) setSessionOrder(FLAT_SESSION_ORDER_KEY, nextOrder);
1848
2657
  };
1849
2658
  const now = Date.now();
1850
2659
  return (0, react_jsx_runtime.jsxs)("div", {
1851
2660
  className: clsx(WorkspaceBrowser_module_css_default.treeBody, WorkspaceBrowser_module_css_default.wide),
1852
- children: [(0, react_jsx_runtime.jsxs)("div", {
2661
+ children: [(0, react_jsx_runtime.jsxs)(AnimatedRows, {
1853
2662
  className: clsx(WorkspaceBrowser_module_css_default.list, WorkspaceBrowser_module_css_default.flatList),
1854
- role: "tree",
1855
- "aria-label": t("section.sessions"),
1856
- children: [rows.length === 0 && (0, react_jsx_runtime.jsx)("div", {
1857
- className: WorkspaceBrowser_module_css_default.empty,
1858
- children: t("empty.none")
2663
+ label: t("section.sessions"),
2664
+ rowKeys: rows.length === 0 ? ["empty"] : rows.map((row) => `session:${row.id}`),
2665
+ ready: list.phase === "ready" && workspaceReady && drag === null,
2666
+ resetKey: animationResetKey,
2667
+ children: [rows.length === 0 && (0, react_jsx_runtime.jsx)(EmptySessions, {
2668
+ rowState,
2669
+ onLeaveArchivedOnly,
2670
+ t
1859
2671
  }), rows.map((node) => {
1860
- const active = drag !== null;
2672
+ const active = drag !== null && drag.pinned === node.pinned;
2673
+ const normalizeHalf = (half) => node.blank ? "after" : half;
1861
2674
  return (0, react_jsx_runtime.jsx)(SessionNodeItem, {
1862
2675
  node,
1863
- currentId: panelActive ? void 0 : list.current,
2676
+ currentId,
1864
2677
  now,
1865
2678
  onOpen: open,
1866
- onRename: onSessionRename,
1867
- onFork: forkSession,
1868
- onArchive: onSessionArchive,
2679
+ onRenameRequest: onSessionRenameRequest,
2680
+ renderSlot,
1869
2681
  onReveal: node.id === revealSessionId ? () => {
1870
2682
  onSessionRevealed(node.id);
1871
2683
  } : void 0,
1872
- flat: true,
1873
2684
  drag: {
1874
2685
  start: () => {
1875
2686
  dropCommitted.current = false;
1876
2687
  setDrag({
1877
2688
  accountKey: FLAT_SESSION_ORDER_KEY,
1878
2689
  sessionId: node.id,
2690
+ pinned: node.pinned,
1879
2691
  over: null
1880
2692
  });
1881
2693
  },
@@ -1886,14 +2698,14 @@ window.__ModuleLoader__.load({
1886
2698
  ...current,
1887
2699
  over: {
1888
2700
  id: node.id,
1889
- half
2701
+ half: normalizeHalf(half)
1890
2702
  }
1891
2703
  });
1892
2704
  },
1893
2705
  drop: (half) => {
1894
2706
  if (drag !== null) commitDrag(drag, {
1895
2707
  id: node.id,
1896
- half
2708
+ half: normalizeHalf(half)
1897
2709
  });
1898
2710
  },
1899
2711
  end: () => {
@@ -1909,27 +2721,28 @@ window.__ModuleLoader__.load({
1909
2721
  });
1910
2722
  }
1911
2723
  /** Flat search body: local metadata matches plus the current Host result page. */
1912
- function SearchResults({ useSessions, useSessionPendingInteraction, open, workspaces, archivedSessionIds, query, remote, resultLimit, usePanelInfo, t }) {
2724
+ function SearchResults({ useSessions, useSessionStatus, open, onUnarchive, workspaces, archivedSessionIds, archivedFilter, query, remote, resultLimit, usePanelInfo, t }) {
1913
2725
  const panelActive = usePanelInfo((info) => info.activePanelId !== null);
1914
2726
  const list = useSessions((s) => s);
1915
- const pendingInteractions = useSessionPendingInteraction((s) => s);
2727
+ const statuses = useSessionStatus((s) => s);
1916
2728
  const currentRemote = remote.query === query ? remote : {
1917
2729
  query,
1918
2730
  status: "loading",
1919
2731
  items: [],
1920
2732
  hasMore: false
1921
2733
  };
1922
- const results = (0, react.useMemo)(() => deriveSearchResults(list, workspaces, query, archivedSessionIds, pendingInteractions, currentRemote, resultLimit), [
2734
+ const results = (0, react.useMemo)(() => deriveSearchResults(list, workspaces, query, archivedSessionIds, archivedFilter, statuses, currentRemote, resultLimit), [
1923
2735
  list,
1924
2736
  workspaces,
1925
2737
  query,
1926
2738
  archivedSessionIds,
1927
- pendingInteractions,
2739
+ archivedFilter,
2740
+ statuses,
1928
2741
  currentRemote,
1929
2742
  resultLimit
1930
2743
  ]);
1931
2744
  const pending = currentRemote.status === "loading";
1932
- const failed = currentRemote.status === "error";
2745
+ const currentId = panelActive ? void 0 : Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
1933
2746
  return (0, react_jsx_runtime.jsxs)("div", {
1934
2747
  className: clsx(WorkspaceBrowser_module_css_default.treeBody, WorkspaceBrowser_module_css_default.wide),
1935
2748
  children: [(0, react_jsx_runtime.jsxs)("div", {
@@ -1941,20 +2754,23 @@ window.__ModuleLoader__.load({
1941
2754
  "aria-label": t("search.results.aria"),
1942
2755
  children: results.items.map((result) => (0, react_jsx_runtime.jsx)(SearchResultItem, {
1943
2756
  result,
1944
- currentId: panelActive ? void 0 : list.current,
2757
+ currentId,
1945
2758
  onOpen: open,
2759
+ onUnarchive,
1946
2760
  t
1947
2761
  }, result.id))
1948
2762
  }),
1949
2763
  pending && (0, react_jsx_runtime.jsx)("div", {
1950
- className: WorkspaceBrowser_module_css_default.searchStatus,
1951
- role: "status",
1952
- children: t("search.pending")
1953
- }),
1954
- failed && (0, react_jsx_runtime.jsx)("div", {
1955
- className: WorkspaceBrowser_module_css_default.searchWarning,
1956
2764
  role: "status",
1957
- children: t("search.unavailable")
2765
+ "aria-label": t("search.pending"),
2766
+ children: (results.items.length === 0 ? [0, 1] : [0]).map((i) => (0, react_jsx_runtime.jsxs)("div", {
2767
+ className: WorkspaceBrowser_module_css_default.skeletonRow,
2768
+ "aria-hidden": "true",
2769
+ children: [(0, react_jsx_runtime.jsx)("span", { className: WorkspaceBrowser_module_css_default.skeletonDot }), (0, react_jsx_runtime.jsxs)("span", {
2770
+ className: WorkspaceBrowser_module_css_default.skeletonBars,
2771
+ children: [(0, react_jsx_runtime.jsx)("span", { className: WorkspaceBrowser_module_css_default.skeletonBar }), (0, react_jsx_runtime.jsx)("span", { className: clsx(WorkspaceBrowser_module_css_default.skeletonBar, WorkspaceBrowser_module_css_default.skeletonBarWide) })]
2772
+ })]
2773
+ }, i))
1958
2774
  }),
1959
2775
  !pending && results.items.length === 0 && (0, react_jsx_runtime.jsx)("div", {
1960
2776
  className: WorkspaceBrowser_module_css_default.empty,
@@ -1973,45 +2789,99 @@ window.__ModuleLoader__.load({
1973
2789
  * @param props - composed slot props (shell owner share + store + injected actions).
1974
2790
  * @returns the region element tree.
1975
2791
  */
1976
- function WorkspaceBrowser({ wide, usePanelInfo, expandSidebar, useSessions, useSessionPendingInteraction, useWorkspaces, useStore, actions, startSession, open, renameSession, forkSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, archiveSession, insertSessionBefore, createWorkspace, searchSessions, searchResultLimit, useDirectoryFlow, useHostInfo, renderSlot, t }) {
2792
+ function WorkspaceBrowser({ wide, usePanelInfo, expandSidebar, useSessions, useSessionStatus, useWorkspaces, useStore, actions, startSession, open, requestSessionRename, notifyArchivedNotOpenable, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, unarchiveSession, createWorkspace, searchSessions, searchResultLimit, useDirectoryFlow, useHostInfo, useShortcuts, useWorkspaceShortcuts, requestSearch, requestAddWorkspace, closeAddWorkspace, setDirectoryBusy, dismissForkError, renderSlot, t }) {
1977
2793
  const home = useHostInfo((info) => info.home);
1978
- const workspaces = useWorkspaces((state) => state.items);
2794
+ const shortcuts = useShortcuts((rows) => rows);
2795
+ const searchShortcut = shortcuts.find((row) => row.id === "session.search");
2796
+ const addShortcut = shortcuts.find((row) => row.id === "workspace.add");
2797
+ const shortcutState = useWorkspaceShortcuts((state) => state);
2798
+ const list = useSessions((state) => state);
2799
+ const storedWorkspaces = useWorkspaces((state) => state.items);
2800
+ const defaultWorkspaceName = t("workspace.defaultName");
2801
+ const workspaces = (0, react.useMemo)(() => storedWorkspaces.map((workspace) => ({
2802
+ ...workspace,
2803
+ title: workspaceDisplayTitle(workspace.title, defaultWorkspaceName)
2804
+ })), [storedWorkspaces, defaultWorkspaceName]);
1979
2805
  const workspacePhase = useWorkspaces((state) => state.phase);
1980
2806
  const workspaceStreamState = useWorkspaces((state) => state.state);
1981
2807
  const archivedSessionIds = useWorkspaces((state) => state.archivedSessionIds);
2808
+ const pinnedSessionIds = useWorkspaces((state) => state.pinnedSessionIds);
1982
2809
  const directoryFlowAvailable = useDirectoryFlow((occupied) => occupied);
1983
2810
  const groupBy = useStore((s) => s.groupBy);
1984
2811
  const orderBy = useStore((s) => s.orderBy);
2812
+ const archivedFilter = useStore((s) => s.archivedFilter ?? "default");
1985
2813
  const groupExpansion = useStore((s) => s.groupExpansion);
1986
2814
  const sessionOrderByAccount = useStore((s) => s.sessionOrderByAccount);
1987
- const sessionUpdatedAtByAccount = useStore((s) => s.sessionUpdatedAtByAccount);
1988
- const currentBlankSessionId = useSessions((state) => {
1989
- const current = state.current;
1990
- return current !== void 0 && state.byId[current]?.blank === true ? current : void 0;
1991
- });
1992
- const currentBlankAccount = currentBlankSessionId === void 0 || workspacePhase !== "ready" ? void 0 : owningGroupKey(workspaces, currentBlankSessionId);
1993
- const promotedBlank = (0, react.useRef)(void 0);
1994
- (0, react.useEffect)(() => {
1995
- if (currentBlankSessionId === void 0 || currentBlankAccount === void 0) {
1996
- promotedBlank.current = void 0;
2815
+ const guardedOpen = (sessionId) => {
2816
+ if (archivedSessionIds.includes(sessionId)) {
2817
+ notifyArchivedNotOpenable();
1997
2818
  return;
1998
2819
  }
1999
- const promoted = promotedBlank.current;
2000
- if (promoted !== void 0 && promoted.sessionId === currentBlankSessionId && promoted.accountKey === currentBlankAccount) return;
2001
- promotedBlank.current = {
2002
- sessionId: currentBlankSessionId,
2003
- accountKey: currentBlankAccount
2820
+ open(sessionId);
2821
+ };
2822
+ const leaveArchivedOnly = () => {
2823
+ actions.setArchivedFilter("default");
2824
+ };
2825
+ const workspaceReady = workspacePhase === "ready" && workspaceStreamState !== "loading";
2826
+ const mainSessionId = Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
2827
+ const currentBlank = mainSessionId !== void 0 && list.byId[mainSessionId]?.blank === true ? mainSessionId : void 0;
2828
+ const ungroupedMemberIds = (0, react.useMemo)(() => {
2829
+ const accounted = new Set(workspaces.flatMap((workspace) => workspace.sessionIds));
2830
+ return list.ids.filter((id) => list.byId[id] !== void 0 && !accounted.has(id));
2831
+ }, [list, workspaces]);
2832
+ const orderState = (0, react.useMemo)(() => ({
2833
+ pinnedSessionIds,
2834
+ archivedSessionIds
2835
+ }), [archivedSessionIds, pinnedSessionIds]);
2836
+ const rowState = (0, react.useMemo)(() => ({
2837
+ ...orderState,
2838
+ archivedFilter
2839
+ }), [orderState, archivedFilter]);
2840
+ const flatMemberIds = (0, react.useMemo)(() => sessionMemberIds(list), [list]);
2841
+ const orderedWorkspaces = (0, react.useMemo)(() => workspaces.map((workspace) => {
2842
+ const memberIds = workspace.sessionIds;
2843
+ const baseOrder = orderBy === "updated" ? orderByRecency(memberIds, list.byId) : reconcileManualOrder(memberIds, sessionOrderByAccount[workspace.workspaceId], list.byId, orderState);
2844
+ return {
2845
+ ...workspace,
2846
+ sessionIds: pinCurrentBlank(baseOrder, currentBlank !== void 0 && memberIds.includes(currentBlank) ? currentBlank : void 0)
2004
2847
  };
2005
- for (const accountKey of new Set([currentBlankAccount, FLAT_SESSION_ORDER_KEY])) {
2006
- const previous = sessionOrderByAccount[accountKey] ?? [];
2007
- actions.setSessionOrder(accountKey, [currentBlankSessionId, ...previous.filter((id) => id !== currentBlankSessionId)]);
2008
- }
2848
+ }), [
2849
+ currentBlank,
2850
+ list.byId,
2851
+ orderBy,
2852
+ orderState,
2853
+ sessionOrderByAccount,
2854
+ workspaces
2855
+ ]);
2856
+ const orderedUngroupedSessionIds = (0, react.useMemo)(() => {
2857
+ return pinCurrentBlank(orderBy === "updated" ? orderByRecency(ungroupedMemberIds, list.byId) : reconcileManualOrder(ungroupedMemberIds, sessionOrderByAccount[""], list.byId, orderState), currentBlank !== void 0 && ungroupedMemberIds.includes(currentBlank) ? currentBlank : void 0);
2858
+ }, [
2859
+ currentBlank,
2860
+ list.byId,
2861
+ orderBy,
2862
+ orderState,
2863
+ sessionOrderByAccount,
2864
+ ungroupedMemberIds
2865
+ ]);
2866
+ const orderedFlatSessionIds = (0, react.useMemo)(() => {
2867
+ return pinCurrentBlank(orderBy === "updated" ? orderByRecency(flatMemberIds, list.byId) : reconcileManualOrder(flatMemberIds, sessionOrderByAccount[FLAT_SESSION_ORDER_KEY], list.byId, orderState), currentBlank !== void 0 && flatMemberIds.includes(currentBlank) ? currentBlank : void 0);
2009
2868
  }, [
2010
- actions.setSessionOrder,
2011
- currentBlankAccount,
2012
- currentBlankSessionId,
2869
+ currentBlank,
2870
+ flatMemberIds,
2871
+ list.byId,
2872
+ orderBy,
2873
+ orderState,
2013
2874
  sessionOrderByAccount
2014
2875
  ]);
2876
+ const activeSessionOrders = (0, react.useMemo)(() => Object.fromEntries([
2877
+ ...orderedWorkspaces.map((workspace) => [workspace.workspaceId, workspace.sessionIds]),
2878
+ ["", orderedUngroupedSessionIds],
2879
+ [FLAT_SESSION_ORDER_KEY, orderedFlatSessionIds]
2880
+ ]), [
2881
+ orderedFlatSessionIds,
2882
+ orderedUngroupedSessionIds,
2883
+ orderedWorkspaces
2884
+ ]);
2015
2885
  (0, react.useEffect)(() => {
2016
2886
  if (workspacePhase !== "ready") return;
2017
2887
  actions.retainAccountKeys([
@@ -2024,6 +2894,41 @@ window.__ModuleLoader__.load({
2024
2894
  workspacePhase,
2025
2895
  workspaces
2026
2896
  ]);
2897
+ (0, react.useEffect)(() => {
2898
+ if (list.phase !== "ready" || workspaceReady || orderBy !== "manual" || currentBlank === void 0) return;
2899
+ const changed = {};
2900
+ for (const [key, ids] of Object.entries(activeSessionOrders)) {
2901
+ if (key !== "__flat_session_order__" && workspacePhase !== "ready") continue;
2902
+ const saved = sessionOrderByAccount[key] ?? [];
2903
+ if (ids[0] !== currentBlank || saved[0] === currentBlank) continue;
2904
+ changed[key] = [currentBlank, ...saved.filter((id) => id !== currentBlank)];
2905
+ }
2906
+ if (Object.keys(changed).length > 0) actions.syncSessionOrders(changed);
2907
+ }, [
2908
+ actions.syncSessionOrders,
2909
+ activeSessionOrders,
2910
+ currentBlank,
2911
+ list.phase,
2912
+ orderBy,
2913
+ sessionOrderByAccount,
2914
+ workspacePhase,
2915
+ workspaceReady
2916
+ ]);
2917
+ (0, react.useEffect)(() => {
2918
+ if (list.phase !== "ready" || !workspaceReady || orderBy !== "manual" || currentBlank === void 0) return;
2919
+ if (Object.entries(activeSessionOrders).some(([key, ids]) => ids[0] === currentBlank && sessionOrderByAccount[key]?.[0] !== currentBlank)) actions.syncSessionOrders(activeSessionOrders);
2920
+ }, [
2921
+ actions.syncSessionOrders,
2922
+ activeSessionOrders,
2923
+ currentBlank,
2924
+ list.phase,
2925
+ orderBy,
2926
+ sessionOrderByAccount,
2927
+ workspaceReady
2928
+ ]);
2929
+ const saveSessionOrder = (accountKey, order) => {
2930
+ actions.setSessionOrder(accountKey, order, activeSessionOrders);
2931
+ };
2027
2932
  const [query, setQuery] = (0, react.useState)("");
2028
2933
  const [searchExpanded, setSearchExpanded] = (0, react.useState)(false);
2029
2934
  const [revealSessionId, setRevealSessionId] = (0, react.useState)(void 0);
@@ -2036,10 +2941,14 @@ window.__ModuleLoader__.load({
2036
2941
  });
2037
2942
  const searchRoot = (0, react.useRef)(null);
2038
2943
  const searchInput = (0, react.useRef)(null);
2039
- const [wsPickerOpen, setWsPickerOpen] = (0, react.useState)(false);
2944
+ const wsPickerOpen = shortcutState.addRequested;
2040
2945
  const wsPlusRef = (0, react.useRef)(null);
2041
2946
  const composingRef = (0, react.useRef)(false);
2042
2947
  const openSearchResult = (sessionId) => {
2948
+ if (archivedSessionIds.includes(sessionId)) {
2949
+ notifyArchivedNotOpenable();
2950
+ return;
2951
+ }
2043
2952
  setRevealSessionId(sessionId);
2044
2953
  setQuery("");
2045
2954
  setSearchExpanded(false);
@@ -2063,6 +2972,15 @@ window.__ModuleLoader__.load({
2063
2972
  };
2064
2973
  }
2065
2974
  }, [wide, searchOnExpand]);
2975
+ (0, react.useEffect)(() => {
2976
+ if (shortcutState.searchRequest === 0) return;
2977
+ closeAddWorkspace();
2978
+ setSearchExpanded(true);
2979
+ if (!wide) {
2980
+ setSearchOnExpand(true);
2981
+ expandSidebar();
2982
+ } else searchInput.current?.focus({ preventScroll: true });
2983
+ }, [shortcutState.searchRequest]);
2066
2984
  (0, react.useEffect)(() => {
2067
2985
  if (!wide || !searchExpanded || searchOnExpand) return;
2068
2986
  searchInput.current?.focus({ preventScroll: true });
@@ -2135,8 +3053,8 @@ window.__ModuleLoader__.load({
2135
3053
  const [renaming, setRenaming] = (0, react.useState)(false);
2136
3054
  const [renameError, setRenameError] = (0, react.useState)(null);
2137
3055
  const renameTrimmed = renameDraft.trim();
2138
- const renameDuplicate = renameTarget !== null && renameTrimmed !== "" && renameTrimmed !== renameTarget.currentTitle && workspaces.some((w) => w.title === renameTrimmed);
2139
- const renameBlocked = renaming || renameTrimmed === "" || renameTarget === null || renameTrimmed === renameTarget.currentTitle || renameDuplicate;
3056
+ const renameDuplicate = renameTarget !== null && renameTrimmed !== "" && workspaces.some((w) => w.workspaceId !== renameTarget.workspaceId && w.title === renameTrimmed);
3057
+ const renameBlocked = renaming || renameTrimmed === "" || renameTarget === null || renameTrimmed === renameTarget.storedTitle || renameDuplicate;
2140
3058
  const closeRename = () => {
2141
3059
  if (renaming) return;
2142
3060
  setRenameTarget(null);
@@ -2154,40 +3072,9 @@ window.__ModuleLoader__.load({
2154
3072
  setRenameError(reason instanceof Error ? reason.message : String(reason));
2155
3073
  });
2156
3074
  };
2157
- const [sessionRenameTarget, setSessionRenameTarget] = (0, react.useState)(null);
2158
- const [sessionRenameDraft, setSessionRenameDraft] = (0, react.useState)("");
2159
- const [sessionRenaming, setSessionRenaming] = (0, react.useState)(false);
2160
- const [sessionRenameError, setSessionRenameError] = (0, react.useState)(null);
2161
- const sessionRenameTrimmed = sessionRenameDraft.trim();
2162
- const sessionRenameBlocked = sessionRenaming || sessionRenameTrimmed === "" || sessionRenameTarget === null;
2163
- const closeSessionRename = () => {
2164
- if (sessionRenaming) return;
2165
- setSessionRenameTarget(null);
2166
- setSessionRenameError(null);
2167
- };
2168
- const confirmSessionRename = () => {
2169
- if (sessionRenameBlocked) return;
2170
- setSessionRenaming(true);
2171
- setSessionRenameError(null);
2172
- renameSession(sessionRenameTarget.sessionId, sessionRenameTrimmed).then(() => {
2173
- setSessionRenaming(false);
2174
- setSessionRenameTarget(null);
2175
- }).catch((reason) => {
2176
- setSessionRenaming(false);
2177
- setSessionRenameError(reason instanceof Error ? reason.message : String(reason));
2178
- });
2179
- };
2180
- const onSessionRename = (sessionId, currentTitle) => {
2181
- setSessionRenameTarget({
2182
- sessionId,
2183
- currentTitle
2184
- });
2185
- setSessionRenameDraft(currentTitle);
2186
- setSessionRenameError(null);
2187
- };
2188
- const onSessionArchive = (sessionId) => {
2189
- archiveSession(sessionId).catch((reason) => {
2190
- console.warn("session archive rejected:", reason);
3075
+ const onSessionUnarchive = (sessionId) => {
3076
+ unarchiveSession(sessionId).catch((reason) => {
3077
+ console.warn("session unarchive rejected:", reason);
2191
3078
  });
2192
3079
  };
2193
3080
  const [deleteTarget, setDeleteTarget] = (0, react.useState)(null);
@@ -2234,13 +3121,14 @@ window.__ModuleLoader__.load({
2234
3121
  ref: searchRoot,
2235
3122
  className: clsx(WorkspaceBrowser_module_css_default.search, searchExpanded && WorkspaceBrowser_module_css_default.searchExpanded),
2236
3123
  onClick: () => {
2237
- setWsPickerOpen(false);
3124
+ closeAddWorkspace();
2238
3125
  setSearchExpanded(true);
2239
3126
  searchInput.current?.focus();
2240
3127
  },
2241
3128
  children: [
2242
3129
  (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2243
3130
  label: t("search"),
3131
+ shortcutKeys: searchShortcut?.keys,
2244
3132
  side: "bottom",
2245
3133
  delayMs: 500,
2246
3134
  disabled: searchExpanded,
@@ -2248,12 +3136,12 @@ window.__ModuleLoader__.load({
2248
3136
  type: "button",
2249
3137
  className: WorkspaceBrowser_module_css_default.searchButton,
2250
3138
  "aria-label": t("search.sessions.aria"),
3139
+ "aria-keyshortcuts": searchShortcut?.aria,
2251
3140
  "aria-expanded": searchExpanded,
2252
3141
  onClick: () => {
2253
- setWsPickerOpen(false);
2254
- setSearchExpanded(true);
3142
+ requestSearch();
2255
3143
  },
2256
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutline16, { size: searchExpanded ? 11 : 14 })
3144
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: searchExpanded ? 11 : 14 })
2257
3145
  })
2258
3146
  }),
2259
3147
  (0, react_jsx_runtime.jsx)("input", {
@@ -2282,7 +3170,7 @@ window.__ModuleLoader__.load({
2282
3170
  setQuery("");
2283
3171
  setSearchExpanded(false);
2284
3172
  },
2285
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseFill14, {})
3173
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseFillRegular, {})
2286
3174
  })
2287
3175
  ]
2288
3176
  })
@@ -2292,15 +3180,16 @@ window.__ModuleLoader__.load({
2292
3180
  children: [wide && (0, react_jsx_runtime.jsx)(ViewOptionsMenu, {
2293
3181
  groupBy,
2294
3182
  orderBy,
2295
- onGroupPick: (mode) => {
2296
- actions.setGroupBy(mode);
2297
- },
3183
+ archivedFilter,
3184
+ onGroupPick: actions.setGroupBy,
2298
3185
  onOrderPick: (mode) => {
2299
- actions.setOrderBy(mode);
3186
+ actions.setOrderBy(mode, activeSessionOrders);
2300
3187
  },
3188
+ onArchivedFilterPick: actions.setArchivedFilter,
2301
3189
  t
2302
3190
  }), directoryFlowAvailable && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2303
3191
  label: t("workspace.add"),
3192
+ shortcutKeys: addShortcut?.keys,
2304
3193
  side: "bottom",
2305
3194
  delayMs: 500,
2306
3195
  children: (0, react_jsx_runtime.jsx)("button", {
@@ -2308,10 +3197,11 @@ window.__ModuleLoader__.load({
2308
3197
  type: "button",
2309
3198
  className: WorkspaceBrowser_module_css_default.iconButton,
2310
3199
  "aria-label": t("workspace.add"),
3200
+ "aria-keyshortcuts": addShortcut?.aria,
2311
3201
  onClick: () => {
2312
- setWsPickerOpen((v) => !v);
3202
+ requestAddWorkspace();
2313
3203
  },
2314
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconProjectAddOutline16, { size: wide ? 16 : 18 })
3204
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconProjectAddOutlineRegular, { size: wide ? 16 : 18 })
2315
3205
  })
2316
3206
  })]
2317
3207
  }),
@@ -2324,13 +3214,14 @@ window.__ModuleLoader__.load({
2324
3214
  useDirectoryFlow,
2325
3215
  renderDirectoryFlow: (owner) => renderSlot("sidebar.workspaces.directoryFlow", owner),
2326
3216
  addOnly: true,
3217
+ onBusyChange: setDirectoryBusy,
2327
3218
  side: "right",
2328
3219
  onPick: (workspaceId) => {
2329
- setWsPickerOpen(false);
3220
+ closeAddWorkspace();
2330
3221
  startSession(workspaceId);
2331
3222
  },
2332
3223
  onClose: () => {
2333
- setWsPickerOpen(false);
3224
+ closeAddWorkspace();
2334
3225
  }
2335
3226
  })
2336
3227
  ]
@@ -2339,16 +3230,16 @@ window.__ModuleLoader__.load({
2339
3230
  className: WorkspaceBrowser_module_css_default.search,
2340
3231
  children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2341
3232
  label: t("search"),
3233
+ shortcutKeys: searchShortcut?.keys,
2342
3234
  children: (0, react_jsx_runtime.jsx)("button", {
2343
3235
  type: "button",
2344
3236
  className: WorkspaceBrowser_module_css_default.searchButton,
2345
3237
  "aria-label": t("search.sessions.aria"),
3238
+ "aria-keyshortcuts": searchShortcut?.aria,
2346
3239
  onClick: () => {
2347
- setSearchExpanded(true);
2348
- setSearchOnExpand(true);
2349
- expandSidebar();
3240
+ requestSearch();
2350
3241
  },
2351
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutline16, { size: 18 })
3242
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 18 })
2352
3243
  })
2353
3244
  })
2354
3245
  }),
@@ -2357,62 +3248,62 @@ window.__ModuleLoader__.load({
2357
3248
  children: wide && (normalizedQuery !== "" ? (0, react_jsx_runtime.jsx)(SearchResults, {
2358
3249
  usePanelInfo,
2359
3250
  useSessions,
2360
- useSessionPendingInteraction,
3251
+ useSessionStatus,
2361
3252
  open: openSearchResult,
3253
+ onUnarchive: onSessionUnarchive,
2362
3254
  workspaces,
2363
3255
  archivedSessionIds,
3256
+ archivedFilter,
2364
3257
  query: normalizedQuery,
2365
3258
  remote: remoteSearch,
2366
3259
  resultLimit: searchResultLimit,
2367
3260
  t
2368
3261
  }) : groupBy === "flat" ? (0, react_jsx_runtime.jsx)(FlatList, {
2369
3262
  usePanelInfo,
2370
- useSessions,
2371
- useSessionPendingInteraction,
2372
- open,
2373
- forkSession,
2374
- onSessionRename,
2375
- onSessionArchive,
2376
- archivedSessionIds,
2377
- orderBy,
2378
- sessionOrderByAccount,
2379
- sessionUpdatedAtByAccount,
2380
- syncSessionOrderAccount: actions.syncSessionOrderAccount,
2381
- setSessionOrder: actions.setSessionOrder,
3263
+ list,
3264
+ sessionIds: orderedFlatSessionIds,
3265
+ rowState,
3266
+ onLeaveArchivedOnly: leaveArchivedOnly,
3267
+ workspaceReady,
3268
+ animationResetKey: `${groupBy}/${orderBy}/${archivedFilter}`,
3269
+ useSessionStatus,
3270
+ open: guardedOpen,
3271
+ onSessionRenameRequest: requestSessionRename,
3272
+ renderSlot,
3273
+ setSessionOrder: saveSessionOrder,
2382
3274
  revealSessionId,
2383
3275
  onSessionRevealed: acknowledgeSessionReveal,
2384
3276
  t
2385
3277
  }) : (0, react_jsx_runtime.jsx)(SessionTree, {
2386
3278
  usePanelInfo,
2387
- useSessions,
2388
- useSessionPendingInteraction,
2389
- onSessionRename,
2390
- onSessionArchive,
2391
- forkSession,
2392
- workspaces,
2393
- workspaceReady: workspacePhase === "ready" && workspaceStreamState !== "loading",
3279
+ list,
3280
+ shortcuts,
3281
+ useSessionStatus,
3282
+ onSessionRenameRequest: requestSessionRename,
3283
+ renderSlot,
3284
+ workspaces: orderedWorkspaces,
3285
+ ungroupedSessionIds: orderedUngroupedSessionIds,
3286
+ workspaceReady,
3287
+ nestWorkspaces: groupBy === "workspace-tree",
3288
+ animationResetKey: `${groupBy}/${orderBy}/${archivedFilter}`,
2394
3289
  groupExpansion,
2395
3290
  setGroupExpanded: actions.setGroupExpanded,
2396
- sessionOrderByAccount,
2397
- sessionUpdatedAtByAccount,
2398
- syncSessionOrderAccount: actions.syncSessionOrderAccount,
2399
- setSessionOrder: actions.setSessionOrder,
2400
- archivedSessionIds,
3291
+ setSessionOrder: saveSessionOrder,
3292
+ rowState,
3293
+ onLeaveArchivedOnly: leaveArchivedOnly,
2401
3294
  startSession,
2402
- open,
3295
+ open: guardedOpen,
2403
3296
  insertWorkspaceBefore,
2404
- insertSessionBefore,
2405
- orderBy,
2406
3297
  revealSessionId,
2407
3298
  onSessionRevealed: acknowledgeSessionReveal,
2408
3299
  home,
2409
3300
  t,
2410
- onRenameRequest: (workspaceId, currentTitle) => {
3301
+ onRenameRequest: (workspaceId, displayTitle) => {
2411
3302
  setRenameTarget({
2412
3303
  workspaceId,
2413
- currentTitle
3304
+ storedTitle: storedWorkspaces.find((w) => w.workspaceId === workspaceId)?.title ?? displayTitle
2414
3305
  });
2415
- setRenameDraft(currentTitle);
3306
+ setRenameDraft(displayTitle);
2416
3307
  setRenameError(null);
2417
3308
  },
2418
3309
  onDeleteRequest: (workspaceId, title) => {
@@ -2445,7 +3336,7 @@ window.__ModuleLoader__.load({
2445
3336
  className: WorkspaceBrowser_module_css_default.renameInput,
2446
3337
  value: renameDraft,
2447
3338
  "aria-label": t("field.workspaceName"),
2448
- autoFocus: true,
3339
+ "data-modal-autofocus": true,
2449
3340
  disabled: renaming,
2450
3341
  onFocus: (e) => {
2451
3342
  e.target.select();
@@ -2479,53 +3370,6 @@ window.__ModuleLoader__.load({
2479
3370
  })
2480
3371
  ]
2481
3372
  }),
2482
- (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
2483
- open: sessionRenameTarget !== null,
2484
- onClose: closeSessionRename,
2485
- closeLabel: t("close"),
2486
- title: t("rename.session.title"),
2487
- footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2488
- variant: "outline",
2489
- disabled: sessionRenaming,
2490
- onClick: closeSessionRename,
2491
- children: t("cancel")
2492
- }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2493
- variant: "primary",
2494
- disabled: sessionRenameBlocked,
2495
- onClick: confirmSessionRename,
2496
- children: t("rename")
2497
- })] }),
2498
- children: [(0, react_jsx_runtime.jsx)("input", {
2499
- className: WorkspaceBrowser_module_css_default.renameInput,
2500
- value: sessionRenameDraft,
2501
- "aria-label": t("field.sessionName"),
2502
- autoFocus: true,
2503
- disabled: sessionRenaming,
2504
- onFocus: (e) => {
2505
- e.target.select();
2506
- },
2507
- onChange: (e) => {
2508
- setSessionRenameDraft(e.target.value);
2509
- setSessionRenameError(null);
2510
- },
2511
- onCompositionStart: () => {
2512
- composingRef.current = true;
2513
- },
2514
- onCompositionEnd: () => {
2515
- composingRef.current = false;
2516
- },
2517
- onKeyDown: (e) => {
2518
- if (e.key === "Enter" && !composingRef.current) {
2519
- e.preventDefault();
2520
- confirmSessionRename();
2521
- }
2522
- }
2523
- }), sessionRenameError !== null && (0, react_jsx_runtime.jsx)("div", {
2524
- className: WorkspaceBrowser_module_css_default.renameError,
2525
- role: "alert",
2526
- children: sessionRenameError
2527
- })]
2528
- }),
2529
3373
  (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
2530
3374
  open: deleteTarget !== null,
2531
3375
  onClose: closeDelete,
@@ -2553,10 +3397,464 @@ window.__ModuleLoader__.load({
2553
3397
  role: "alert",
2554
3398
  children: deleteError
2555
3399
  })]
3400
+ }),
3401
+ shortcutState.forkError !== null && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
3402
+ text: t(shortcutState.forkError.reason === "unavailable" ? "shortcut.noCompletedTurn" : "shortcut.forkFailed"),
3403
+ onDone: dismissForkError
3404
+ }, shortcutState.forkError.seq)
3405
+ ]
3406
+ });
3407
+ }
3408
+ //#endregion
3409
+ //#region lib/types/client/session-actions/ArchiveSession.js
3410
+ /**
3411
+ * The archive action: a `sidebar.workspaces.session.menu.item` row and a
3412
+ * `sidebar.workspaces.session.row.action` button over one injected behavior,
3413
+ * plus the `shell.overlay` dialog that confirms stopping a Session's running
3414
+ * work before archiving it. The same entries restore an archived row; the
3415
+ * notice a successful archive raises and the diagnostics for Host rejections
3416
+ * live in the injected callbacks, not here.
3417
+ */
3418
+ /**
3419
+ * Menu row (order 400): archive, or restore an archived row.
3420
+ * @param props - owner share, the archive share, and the menu open state.
3421
+ * @returns the row.
3422
+ */
3423
+ function ArchiveSessionMenuItem({ sessionId, useArchived, useMenuOpenState, useShortcuts, archiveSession, unarchiveSession, t }) {
3424
+ const [, setMenuOpen] = useMenuOpenState();
3425
+ const shortcut = useShortcuts((rows) => rows.find((row) => row.id === "session.archive"));
3426
+ const archived = useArchived((set) => set.has(sessionId));
3427
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
3428
+ shortcut: archived ? void 0 : shortcut,
3429
+ icon: archived ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUnarchiveOutlineRegular, { size: 14 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutlineRegular, { size: 14 }),
3430
+ onSelect: () => {
3431
+ setMenuOpen(false);
3432
+ (archived ? unarchiveSession : archiveSession)(sessionId);
3433
+ },
3434
+ children: t(archived ? "menu.unarchiveSession" : "menu.archiveSession")
3435
+ });
3436
+ }
3437
+ /**
3438
+ * Hover button (order 100): archive, or restore an archived row.
3439
+ * @param props - owner share and the archive share.
3440
+ * @returns the button.
3441
+ */
3442
+ function ArchiveSessionRowButton({ sessionId, useArchived, archiveSession, unarchiveSession, t }) {
3443
+ const archived = useArchived((set) => set.has(sessionId));
3444
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3445
+ label: t(archived ? "actions.unarchive" : "actions.archive"),
3446
+ side: "bottom",
3447
+ align: "end",
3448
+ delayMs: 500,
3449
+ children: (0, react_jsx_runtime.jsx)("button", {
3450
+ type: "button",
3451
+ className: Rows_module_css_default.iconButton,
3452
+ "aria-label": t(archived ? "menu.unarchiveSession" : "menu.archiveSession"),
3453
+ onClick: () => {
3454
+ (archived ? unarchiveSession : archiveSession)(sessionId);
3455
+ },
3456
+ children: archived ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUnarchiveOutlineRegular, { size: 14 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconArchiveOutlineRegular, { size: 14 })
3457
+ })
3458
+ });
3459
+ }
3460
+ /**
3461
+ * The `shell.overlay` entry: nothing while no confirmation is pending,
3462
+ * otherwise one dialog per request (keyed by the Session). Confirming asks
3463
+ * the Host to stop the listed work and archive; cancelling leaves the
3464
+ * Session running and visible.
3465
+ * @param props - the request hook, its settlement, the stop-and-archive hop, and the locale seat.
3466
+ * @returns the open dialog, or null.
3467
+ */
3468
+ function SessionArchiveConfirmDialog({ useArchiveRequest, settleSessionArchive, stopAndArchiveSession, t }) {
3469
+ const request = useArchiveRequest((pending) => pending);
3470
+ if (request === null) return null;
3471
+ return (0, react_jsx_runtime.jsx)(ArchiveConfirmForm, {
3472
+ request,
3473
+ stopAndArchiveSession,
3474
+ onSettle: settleSessionArchive,
3475
+ t
3476
+ }, request.sessionId);
3477
+ }
3478
+ /** One request's dialog: in-flight and error state die with it. */
3479
+ function ArchiveConfirmForm({ request, stopAndArchiveSession, onSettle, t }) {
3480
+ const [archiving, setArchiving] = (0, react.useState)(false);
3481
+ const [error, setError] = (0, react.useState)(null);
3482
+ const close = () => {
3483
+ if (archiving) return;
3484
+ onSettle();
3485
+ };
3486
+ const confirm = () => {
3487
+ setArchiving(true);
3488
+ setError(null);
3489
+ stopAndArchiveSession(request.sessionId).then(() => {
3490
+ setArchiving(false);
3491
+ onSettle();
3492
+ }).catch((reason) => {
3493
+ setArchiving(false);
3494
+ setError(reason instanceof Error ? reason.message : String(reason));
3495
+ });
3496
+ };
3497
+ return (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
3498
+ open: true,
3499
+ onClose: close,
3500
+ closeLabel: t("close"),
3501
+ title: t("archive.confirm.title"),
3502
+ description: t("archive.confirm.desc", { title: request.displayTitle }),
3503
+ footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3504
+ variant: "outline",
3505
+ disabled: archiving,
3506
+ onClick: close,
3507
+ children: t("cancel")
3508
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3509
+ variant: "outline",
3510
+ className: WorkspaceBrowser_module_css_default.deleteAction,
3511
+ disabled: archiving,
3512
+ onClick: confirm,
3513
+ children: t("archive.confirm.action")
3514
+ })] }),
3515
+ children: [
3516
+ (0, react_jsx_runtime.jsx)("ul", {
3517
+ className: WorkspaceBrowser_module_css_default.archiveActivity,
3518
+ "aria-label": t("archive.confirm.activity"),
3519
+ children: request.activity.map((entry, index) => (0, react_jsx_runtime.jsx)("li", { children: activityLine(entry, t) }, `${entry.kind}-${String(index)}`))
3520
+ }),
3521
+ archiving && (0, react_jsx_runtime.jsx)("div", {
3522
+ className: WorkspaceBrowser_module_css_default.deleteStatus,
3523
+ role: "status",
3524
+ children: t("archive.confirm.pending")
3525
+ }),
3526
+ error !== null && (0, react_jsx_runtime.jsx)("div", {
3527
+ className: WorkspaceBrowser_module_css_default.renameError,
3528
+ role: "alert",
3529
+ children: error
2556
3530
  })
2557
3531
  ]
2558
3532
  });
2559
3533
  }
3534
+ /**
3535
+ * One family's line: its count and the items' labels (ids when a family
3536
+ * carries no label). A family this dictionary does not know — a provider
3537
+ * merged into the kind map — falls through to the generic line.
3538
+ */
3539
+ function activityLine(entry, t) {
3540
+ const items = entry.items ?? [];
3541
+ const n = items.length;
3542
+ const names = items.map((item) => item.label ?? item.id).join(t("archive.confirm.listSeparator"));
3543
+ const plural = n === 1 ? "one" : "other";
3544
+ switch (entry.kind) {
3545
+ case "turn": return t("archive.confirm.turn");
3546
+ case "subagent": return t(`archive.confirm.subagents.${plural}`, {
3547
+ n,
3548
+ names
3549
+ });
3550
+ case "job": return t(`archive.confirm.jobs.${plural}`, {
3551
+ n,
3552
+ names
3553
+ });
3554
+ case "schedule": return t(`archive.confirm.schedules.${plural}`, {
3555
+ n,
3556
+ names
3557
+ });
3558
+ default: return t(`archive.confirm.other.${plural}`, {
3559
+ kind: entry.kind,
3560
+ n
3561
+ });
3562
+ }
3563
+ }
3564
+ //#endregion
3565
+ //#region lib/types/client/session-actions/derived.js
3566
+ /**
3567
+ * Project one observable into another, recomputing only when the source
3568
+ * snapshot changes identity, so consumers that select from the projection
3569
+ * (a Set lookup per row) never rebuild it per read.
3570
+ * @param source - the observable to project.
3571
+ * @param project - pure projection of one source snapshot.
3572
+ * @returns the projected observable, subscribing through the source.
3573
+ */
3574
+ function derive(source, project) {
3575
+ let seen;
3576
+ let value;
3577
+ return {
3578
+ getSnapshot: () => {
3579
+ const snapshot = source.getSnapshot();
3580
+ if (value === void 0 || snapshot !== seen) {
3581
+ seen = snapshot;
3582
+ value = project(snapshot);
3583
+ }
3584
+ return value;
3585
+ },
3586
+ subscribe: (listener) => source.subscribe(listener)
3587
+ };
3588
+ }
3589
+ //#endregion
3590
+ //#region lib/types/client/session-actions/ForkSession.js
3591
+ /** The fork action: one `sidebar.workspaces.session.menu.item` row. */
3592
+ /**
3593
+ * Menu row (order 300): fork at the Session's last completed turn; the child
3594
+ * arrives through the Host list beside its source.
3595
+ * @param props - owner share, menu open state, and the fork share.
3596
+ * @returns the row.
3597
+ */
3598
+ function ForkSessionMenuItem({ sessionId, useMenuOpenState, useShortcuts, forkSession, t }) {
3599
+ const [, setMenuOpen] = useMenuOpenState();
3600
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
3601
+ shortcut: useShortcuts((rows) => rows.find((row) => row.id === "session.fork")),
3602
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, {}),
3603
+ onSelect: () => {
3604
+ setMenuOpen(false);
3605
+ forkSession(sessionId);
3606
+ },
3607
+ children: t("menu.fork")
3608
+ });
3609
+ }
3610
+ //#endregion
3611
+ //#region lib/types/client/session-actions/PinSession.js
3612
+ /**
3613
+ * The pin action: a `sidebar.workspaces.session.menu.item` row and a
3614
+ * `sidebar.workspaces.session.row.action` button over one injected behavior.
3615
+ * Pin and archive are mutually exclusive on the Host, so the action reads both
3616
+ * sets and does not offer itself on an archived row; what a pin does beyond
3617
+ * the Host call (fronting the Session in its saved orders, the failure
3618
+ * notice) lives in the injected callbacks, not here.
3619
+ */
3620
+ /** The row's pin and archive membership, one Set lookup each. */
3621
+ function usePinState({ sessionId, usePinned, useArchived }) {
3622
+ return {
3623
+ pinned: usePinned((pinned) => pinned.has(sessionId)),
3624
+ archived: useArchived((archived) => archived.has(sessionId))
3625
+ };
3626
+ }
3627
+ /**
3628
+ * Menu row (order 100): pin or unpin by the row's current state; absent on archived rows.
3629
+ * @param props - owner share, the pin share, and the menu open state.
3630
+ * @returns the row, or null for an archived Session.
3631
+ */
3632
+ function PinSessionMenuItem(props) {
3633
+ const { sessionId, useMenuOpenState, pinSession, unpinSession, t } = props;
3634
+ const [, setMenuOpen] = useMenuOpenState();
3635
+ const { pinned, archived } = usePinState(props);
3636
+ if (archived) return null;
3637
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
3638
+ icon: pinned ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinOutlineRegular, {}),
3639
+ onSelect: () => {
3640
+ setMenuOpen(false);
3641
+ (pinned ? unpinSession : pinSession)(sessionId);
3642
+ },
3643
+ children: t(pinned ? "menu.unpinSession" : "menu.pinSession")
3644
+ });
3645
+ }
3646
+ /**
3647
+ * Hover button (order 200, rightmost: it lands where the rest-state pin marker sits); absent on archived rows.
3648
+ * @param props - owner share and the pin share.
3649
+ * @returns the button, or null for an archived Session.
3650
+ */
3651
+ function PinSessionRowButton(props) {
3652
+ const { sessionId, pinSession, unpinSession, t } = props;
3653
+ const { pinned, archived } = usePinState(props);
3654
+ if (archived) return null;
3655
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3656
+ label: t(pinned ? "actions.unpin" : "actions.pin"),
3657
+ side: "bottom",
3658
+ align: "end",
3659
+ delayMs: 500,
3660
+ children: (0, react_jsx_runtime.jsx)("button", {
3661
+ type: "button",
3662
+ className: Rows_module_css_default.iconButton,
3663
+ "aria-label": t(pinned ? "menu.unpinSession" : "menu.pinSession"),
3664
+ onClick: () => {
3665
+ (pinned ? unpinSession : pinSession)(sessionId);
3666
+ },
3667
+ children: pinned ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinFillRegular, { size: 14 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPinOutlineRegular, { size: 14 })
3668
+ })
3669
+ });
3670
+ }
3671
+ //#endregion
3672
+ //#region lib/types/client/session-actions/RenameSession.js
3673
+ /**
3674
+ * The rename action: a `sidebar.workspaces.session.menu.item` row that raises
3675
+ * the rename request, and the `shell.overlay` dialog entry that answers it.
3676
+ * The dialog lives outside the row menu because the row unmounts with the
3677
+ * menu; the browser raises the same request from a title double-click.
3678
+ */
3679
+ /**
3680
+ * Menu row (order 200): ask for the rename dialog, seeded with the row's current title.
3681
+ * @param props - owner share, menu open state, and the rename share.
3682
+ * @returns the row.
3683
+ */
3684
+ function RenameSessionMenuItem({ sessionId, displayTitle, useMenuOpenState, useShortcuts, requestSessionRename, t }) {
3685
+ const [, setMenuOpen] = useMenuOpenState();
3686
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
3687
+ shortcut: useShortcuts((rows) => rows.find((row) => row.id === "session.rename")),
3688
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, {}),
3689
+ onSelect: () => {
3690
+ setMenuOpen(false);
3691
+ requestSessionRename(sessionId, displayTitle);
3692
+ },
3693
+ children: t("rename")
3694
+ });
3695
+ }
3696
+ /**
3697
+ * The `shell.overlay` entry: nothing while no rename is requested, otherwise
3698
+ * one dialog per request (keyed by the Session, so a new request starts a
3699
+ * fresh draft). Sessions have no client-side name-conflict rule (the host
3700
+ * normalizes), and unlike Workspace rename an unchanged title is NOT
3701
+ * blocked. An unnamed Session starts with an empty draft and requires a name.
3702
+ * @param props - the request hook, its settlement, the rename hop, and the locale seat.
3703
+ * @returns the open dialog, or null.
3704
+ */
3705
+ function SessionRenameDialog({ useRenameRequest, settleSessionRename, renameSession, t }) {
3706
+ const request = useRenameRequest((pending) => pending);
3707
+ if (request === null) return null;
3708
+ return (0, react_jsx_runtime.jsx)(RenameForm, {
3709
+ request,
3710
+ renameSession,
3711
+ onSettle: settleSessionRename,
3712
+ t
3713
+ }, request.sessionId);
3714
+ }
3715
+ /** One request's dialog: the draft seeds from the request on mount; in-flight and error state die with it. */
3716
+ function RenameForm({ request, renameSession, onSettle, t }) {
3717
+ const [draft, setDraft] = (0, react.useState)(request.currentTitle);
3718
+ const [renaming, setRenaming] = (0, react.useState)(false);
3719
+ const [error, setError] = (0, react.useState)(null);
3720
+ const composingRef = (0, react.useRef)(false);
3721
+ const trimmed = draft.trim();
3722
+ const blocked = renaming || trimmed === "";
3723
+ const close = () => {
3724
+ if (renaming) return;
3725
+ onSettle();
3726
+ };
3727
+ const confirm = () => {
3728
+ if (blocked) return;
3729
+ setRenaming(true);
3730
+ setError(null);
3731
+ renameSession(request.sessionId, trimmed).then(() => {
3732
+ setRenaming(false);
3733
+ onSettle();
3734
+ }).catch((reason) => {
3735
+ setRenaming(false);
3736
+ setError(reason instanceof Error ? reason.message : String(reason));
3737
+ });
3738
+ };
3739
+ return (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
3740
+ open: true,
3741
+ onClose: close,
3742
+ closeLabel: t("close"),
3743
+ title: t("rename.session.title"),
3744
+ footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3745
+ variant: "outline",
3746
+ disabled: renaming,
3747
+ onClick: close,
3748
+ children: t("cancel")
3749
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3750
+ variant: "primary",
3751
+ disabled: blocked,
3752
+ onClick: confirm,
3753
+ children: t("rename")
3754
+ })] }),
3755
+ children: [(0, react_jsx_runtime.jsx)("input", {
3756
+ className: WorkspaceBrowser_module_css_default.renameInput,
3757
+ value: draft,
3758
+ "aria-label": t("field.sessionName"),
3759
+ "data-modal-autofocus": true,
3760
+ disabled: renaming,
3761
+ onFocus: (e) => {
3762
+ e.target.select();
3763
+ },
3764
+ onChange: (e) => {
3765
+ setDraft(e.target.value);
3766
+ setError(null);
3767
+ },
3768
+ onCompositionStart: () => {
3769
+ composingRef.current = true;
3770
+ },
3771
+ onCompositionEnd: () => {
3772
+ composingRef.current = false;
3773
+ },
3774
+ onKeyDown: (e) => {
3775
+ if (e.key === "Enter" && !composingRef.current) {
3776
+ e.preventDefault();
3777
+ confirm();
3778
+ }
3779
+ }
3780
+ }), error !== null && (0, react_jsx_runtime.jsx)("div", {
3781
+ className: WorkspaceBrowser_module_css_default.renameError,
3782
+ role: "alert",
3783
+ children: error
3784
+ })]
3785
+ });
3786
+ }
3787
+ //#endregion
3788
+ //#region lib/types/client/session-actions/RowActionToast.js
3789
+ /**
3790
+ * The `shell.overlay` entry for Workspace and Session notices.
3791
+ * One notice is visible at a time; a parent rerender does not extend its hold.
3792
+ */
3793
+ /**
3794
+ * Hold for the notices that take longer to read than a one-line warning: the
3795
+ * actionable archived notice (two buttons to react to) and a refused Session
3796
+ * creation, which quotes the Host's reason.
3797
+ */
3798
+ const LONG_TOAST_HOLD_MS = 6e3;
3799
+ /**
3800
+ * Render the current notice: the archived and stopped-and-archived notices
3801
+ * with their undo action — plus the show-archived action while archived rows
3802
+ * are hidden — on a 6 s hold, a refused Session creation with the Host's
3803
+ * reason on the same hold, or a plain warning for a failed pin, an archived
3804
+ * row that was clicked, or default Workspace creation.
3805
+ * @param props - the notice hook, the shared viewing store, the notice dismissal, the two archived-notice actions, and the locale seat.
3806
+ * @returns the notice on display, or null.
3807
+ */
3808
+ function RowActionToast({ useToast, useStore, dismissToast, undoArchive, showArchived, t }) {
3809
+ const toast = useToast((current) => current);
3810
+ const archivedRowsVisible = useStore((state) => (state.archivedFilter ?? "default") !== "default");
3811
+ if (toast === null) return null;
3812
+ if (toast.kind === "archived" || toast.kind === "stoppedAndArchived") {
3813
+ const { sessionId } = toast;
3814
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
3815
+ text: t(toast.kind === "archived" ? "toast.archived" : "toast.stoppedAndArchived"),
3816
+ tone: "success",
3817
+ holdMs: LONG_TOAST_HOLD_MS,
3818
+ actions: [{
3819
+ label: t("toast.archivedUndo"),
3820
+ onClick: () => {
3821
+ dismissToast();
3822
+ undoArchive(sessionId);
3823
+ }
3824
+ }, ...archivedRowsVisible ? [] : [{
3825
+ prefix: t("toast.archivedOr"),
3826
+ label: t("toast.archivedFilter"),
3827
+ onClick: () => {
3828
+ dismissToast();
3829
+ showArchived();
3830
+ }
3831
+ }]],
3832
+ onDone: dismissToast
3833
+ }, `toast-${String(toast.seq)}`);
3834
+ }
3835
+ if (toast.kind === "createFailed") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
3836
+ text: t("toast.createFailed", { message: toast.message }),
3837
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}),
3838
+ holdMs: LONG_TOAST_HOLD_MS,
3839
+ onDone: dismissToast
3840
+ }, `toast-${String(toast.seq)}`);
3841
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
3842
+ text: plainNoticeText(toast, t),
3843
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}),
3844
+ onDone: dismissToast
3845
+ }, `toast-${String(toast.seq)}`);
3846
+ }
3847
+ /** The copy of one plain warning, keyed by the notice kind the union closes over. */
3848
+ function plainNoticeText(toast, t) {
3849
+ switch (toast.kind) {
3850
+ case "pinFailed": return t("toast.pinFailed");
3851
+ case "unpinFailed": return t("toast.unpinFailed");
3852
+ case "defaultWorkspaceFailed": return t("defaultWorkspace.failed");
3853
+ case "archivedNotOpenable": return t("toast.archivedNotOpenable");
3854
+ /* v8 ignore next 2 -- closed-union backstop; only reached if a notice kind is forged */
3855
+ default: return assertNever$1(toast);
3856
+ }
3857
+ }
2560
3858
  //#endregion
2561
3859
  //#region lib/types/client/locales.js
2562
3860
  /**
@@ -2566,28 +3864,41 @@ window.__ModuleLoader__.load({
2566
3864
  */
2567
3865
  /** Simplified Chinese dictionary (the key-set source of truth). */
2568
3866
  const zh = {
3867
+ "defaultWorkspace.failed": "无法创建默认工作区,请通过“选择工作区”选择文件夹",
2569
3868
  "group.ungrouped": "未分组",
2570
3869
  "session.new": "新会话",
3870
+ "session.untitled": "未命名",
3871
+ "shortcut.noSession": "请先选择一个会话",
3872
+ "shortcut.noPicker": "目录选择器不可用",
3873
+ "shortcut.directoryBusy": "正在选择或添加工作区",
3874
+ "shortcut.noCompletedTurn": "当前会话没有已结束的轮次",
3875
+ "shortcut.forkFailed": "无法分叉会话,请重试",
2571
3876
  "section.workspaces": "工作区",
2572
3877
  "section.sessions": "会话",
2573
3878
  "viewOptions.label": "视图选项",
2574
3879
  "groupBy.label": "分组方式",
2575
3880
  "groupBy.workspace": "按工作区",
3881
+ "groupBy.workspaceTree": "按工作区树",
2576
3882
  "groupBy.flat": "单列表",
2577
3883
  "orderBy.label": "排序方式",
2578
3884
  "orderBy.manual": "手动排序",
2579
3885
  "orderBy.updated": "最近更新",
3886
+ "filterBy.label": "筛选会话",
3887
+ "viewOptions.hideArchived": "隐藏已归档",
3888
+ "viewOptions.showArchived": "全部对话(显示已归档)",
3889
+ "viewOptions.onlyArchived": "仅显示已归档",
2580
3890
  "sessions.expand": "展开其余 {n} 个会话",
2581
3891
  "sessions.collapse": "收起",
2582
3892
  "empty.none": "暂无会话",
3893
+ "empty.noneArchived": "暂无已归档会话",
3894
+ "empty.viewOthers": "查看其他会话",
2583
3895
  "empty.noMatches": "无匹配结果",
2584
3896
  "workspace.add": "添加工作区",
2585
3897
  "search.sessions.aria": "搜索会话",
2586
- "search.placeholder": "搜索会话…",
3898
+ "search.placeholder": "搜索会话名称",
2587
3899
  "search.clear": "清除搜索",
2588
3900
  "search.results.aria": "搜索结果",
2589
3901
  "search.pending": "正在搜索会话历史…",
2590
- "search.unavailable": "内容搜索暂不可用,仅显示名称匹配。",
2591
3902
  "search.noMatches": "无匹配会话",
2592
3903
  "search.hasMore": "仅显示前 {n} 条结果,请缩小搜索范围。",
2593
3904
  "menu.addWorkspace": "添加工作区…",
@@ -2605,20 +3916,56 @@ window.__ModuleLoader__.load({
2605
3916
  "delete.pending": "正在删除工作区…",
2606
3917
  "menu.fork": "分叉会话",
2607
3918
  "menu.archiveSession": "归档会话",
3919
+ "menu.unarchiveSession": "取消归档",
3920
+ "menu.pinSession": "置顶会话",
3921
+ "menu.unpinSession": "取消置顶",
3922
+ "row.archived": "已归档",
3923
+ "row.pinned": "已置顶",
3924
+ "toast.archivedNotOpenable": "已归档对话暂时无法查看,请取消归档后查看",
3925
+ "toast.archived": "会话已归档,可",
3926
+ "toast.stoppedAndArchived": "已停止并归档,可",
3927
+ "archive.confirm.title": "停止并归档此会话?",
3928
+ "archive.confirm.desc": "“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。",
3929
+ "archive.confirm.activity": "将被停止的工作",
3930
+ "archive.confirm.turn": "进行中的回合",
3931
+ "archive.confirm.subagents.one": "{n} 个运行中的子智能体:{names}",
3932
+ "archive.confirm.subagents.other": "{n} 个运行中的子智能体:{names}",
3933
+ "archive.confirm.jobs.one": "{n} 个后台任务:{names}",
3934
+ "archive.confirm.jobs.other": "{n} 个后台任务:{names}",
3935
+ "archive.confirm.schedules.one": "{n} 条定时提醒:{names}",
3936
+ "archive.confirm.schedules.other": "{n} 条定时提醒:{names}",
3937
+ "archive.confirm.other.one": "{n} 项其他工作({kind})",
3938
+ "archive.confirm.other.other": "{n} 项其他工作({kind})",
3939
+ "archive.confirm.listSeparator": "、",
3940
+ "archive.confirm.action": "停止并归档",
3941
+ "archive.confirm.pending": "正在停止并归档…",
3942
+ "toast.archivedUndo": "撤销",
3943
+ "toast.archivedOr": "或",
3944
+ "toast.archivedFilter": "筛选已归档会话",
3945
+ "toast.pinFailed": "置顶失败,请稍后重试",
3946
+ "toast.unpinFailed": "取消置顶失败,请稍后重试",
3947
+ "toast.createFailed": "新建会话失败:{message}",
2608
3948
  "sessions.count.one": "{n} 个会话",
2609
3949
  "sessions.count.other": "{n} 个会话",
2610
3950
  "actions.workspace.aria": "工作区“{name}”的操作",
2611
3951
  "actions.session.aria": "会话“{name}”的操作",
3952
+ "actions.archive": "归档会话",
3953
+ "actions.unarchive": "取消归档",
3954
+ "actions.pin": "置顶会话",
3955
+ "actions.unpin": "取消置顶",
3956
+ "actions.newSession": "新会话",
2612
3957
  "actions.newSession.aria": "在“{name}”中新建会话",
2613
3958
  "status.running": "进行中",
2614
- "status.subagentsRunning.one": "{n} 个子代理运行中",
2615
- "status.subagentsRunning.other": "{n} 个子代理运行中",
3959
+ "status.subagentsRunning.one": "{n} 个子智能体运行中",
3960
+ "status.subagentsRunning.other": "{n} 个子智能体运行中",
2616
3961
  "status.idle": "空闲",
2617
3962
  "status.waitingApproval": "等待审批",
2618
3963
  "status.planReview": "计划待审",
2619
3964
  "status.waitingAnswer": "等待回答",
3965
+ "status.compact.approval": "待审批",
3966
+ "status.compact.planReview": "计划待审",
3967
+ "status.compact.answer": "待回答",
2620
3968
  "status.completed": "已完成",
2621
- "schedule.active": "有活动定时任务",
2622
3969
  "hover.created": "创建于 {time}",
2623
3970
  "hover.copied": "已复制",
2624
3971
  "date.ymd": "{y}年{m}月{d}日",
@@ -2632,28 +3979,41 @@ window.__ModuleLoader__.load({
2632
3979
  };
2633
3980
  /** English dictionary, checked complete against the zh key set. */
2634
3981
  const en = {
3982
+ "defaultWorkspace.failed": "Unable to create default workspace. Use Choose workspace to select a folder.",
2635
3983
  "group.ungrouped": "Ungrouped",
2636
3984
  "session.new": "New Session",
3985
+ "session.untitled": "Untitled",
3986
+ "shortcut.noSession": "Select a session first",
3987
+ "shortcut.noPicker": "Directory picker unavailable",
3988
+ "shortcut.directoryBusy": "Selecting or adding a workspace",
3989
+ "shortcut.noCompletedTurn": "This session has no completed turn",
3990
+ "shortcut.forkFailed": "Could not fork the session. Try again.",
2637
3991
  "section.workspaces": "Workspaces",
2638
3992
  "section.sessions": "Sessions",
2639
3993
  "viewOptions.label": "View options",
2640
3994
  "groupBy.label": "Group by",
2641
3995
  "groupBy.workspace": "WorkSpace",
3996
+ "groupBy.workspaceTree": "Workspace Tree",
2642
3997
  "groupBy.flat": "In one list",
2643
3998
  "orderBy.label": "Order by",
2644
3999
  "orderBy.manual": "Manual",
2645
4000
  "orderBy.updated": "Last updated",
4001
+ "filterBy.label": "Filter sessions",
4002
+ "viewOptions.hideArchived": "Hide archived",
4003
+ "viewOptions.showArchived": "All conversations (show archived)",
4004
+ "viewOptions.onlyArchived": "Archived only",
2646
4005
  "sessions.expand": "Show {n} more sessions",
2647
4006
  "sessions.collapse": "Show less",
2648
4007
  "empty.none": "No sessions yet",
4008
+ "empty.noneArchived": "No archived sessions yet",
4009
+ "empty.viewOthers": "View other sessions",
2649
4010
  "empty.noMatches": "No matches",
2650
4011
  "workspace.add": "Add workspace",
2651
4012
  "search.sessions.aria": "Search sessions",
2652
- "search.placeholder": "Search sessions...",
4013
+ "search.placeholder": "Search session names",
2653
4014
  "search.clear": "Clear search",
2654
4015
  "search.results.aria": "Search results",
2655
4016
  "search.pending": "Searching session history…",
2656
- "search.unavailable": "Content search is temporarily unavailable. Showing name matches.",
2657
4017
  "search.noMatches": "No matching sessions",
2658
4018
  "search.hasMore": "Showing the first {n} results. Narrow your search.",
2659
4019
  "menu.addWorkspace": "Add workspace…",
@@ -2671,10 +4031,44 @@ window.__ModuleLoader__.load({
2671
4031
  "delete.pending": "Deleting workspace…",
2672
4032
  "menu.fork": "Fork session",
2673
4033
  "menu.archiveSession": "Archive session",
4034
+ "menu.unarchiveSession": "Unarchive session",
4035
+ "menu.pinSession": "Pin session",
4036
+ "menu.unpinSession": "Unpin session",
4037
+ "row.archived": "Archived",
4038
+ "row.pinned": "Pinned",
4039
+ "toast.archivedNotOpenable": "Archived sessions cannot be opened. Unarchive it to view.",
4040
+ "toast.archived": "Session archived. You can ",
4041
+ "toast.stoppedAndArchived": "Session stopped and archived. You can ",
4042
+ "archive.confirm.title": "Stop and archive this session?",
4043
+ "archive.confirm.desc": "“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.",
4044
+ "archive.confirm.activity": "Work that will be stopped",
4045
+ "archive.confirm.turn": "The turn in progress",
4046
+ "archive.confirm.subagents.one": "{n} running subagent: {names}",
4047
+ "archive.confirm.subagents.other": "{n} running subagents: {names}",
4048
+ "archive.confirm.jobs.one": "{n} background job: {names}",
4049
+ "archive.confirm.jobs.other": "{n} background jobs: {names}",
4050
+ "archive.confirm.schedules.one": "{n} scheduled reminder: {names}",
4051
+ "archive.confirm.schedules.other": "{n} scheduled reminders: {names}",
4052
+ "archive.confirm.other.one": "{n} other item of work ({kind})",
4053
+ "archive.confirm.other.other": "{n} other items of work ({kind})",
4054
+ "archive.confirm.listSeparator": ", ",
4055
+ "archive.confirm.action": "Stop and archive",
4056
+ "archive.confirm.pending": "Stopping and archiving…",
4057
+ "toast.archivedUndo": "undo",
4058
+ "toast.archivedOr": " or ",
4059
+ "toast.archivedFilter": "filter archived sessions",
4060
+ "toast.pinFailed": "Pin failed. Try again later.",
4061
+ "toast.unpinFailed": "Unpin failed. Try again later.",
4062
+ "toast.createFailed": "New session failed: {message}",
2674
4063
  "sessions.count.one": "{n} session",
2675
4064
  "sessions.count.other": "{n} sessions",
2676
4065
  "actions.workspace.aria": "Workspace actions for {name}",
2677
4066
  "actions.session.aria": "Session actions for {name}",
4067
+ "actions.archive": "Archive",
4068
+ "actions.unarchive": "Unarchive",
4069
+ "actions.pin": "Pin",
4070
+ "actions.unpin": "Unpin",
4071
+ "actions.newSession": "New session",
2678
4072
  "actions.newSession.aria": "New session in {name}",
2679
4073
  "status.running": "Running",
2680
4074
  "status.subagentsRunning.one": "{n} subagent running",
@@ -2683,8 +4077,10 @@ window.__ModuleLoader__.load({
2683
4077
  "status.waitingApproval": "Waiting for approval",
2684
4078
  "status.planReview": "Plan awaiting review",
2685
4079
  "status.waitingAnswer": "Waiting for answer",
4080
+ "status.compact.approval": "Approval",
4081
+ "status.compact.planReview": "Plan review",
4082
+ "status.compact.answer": "Answer",
2686
4083
  "status.completed": "Completed",
2687
- "schedule.active": "Has active scheduled task",
2688
4084
  "hover.created": "Created {time}",
2689
4085
  "hover.copied": "Copied",
2690
4086
  "date.ymd": "{y}-{m}-{d}",
@@ -2715,7 +4111,8 @@ window.__ModuleLoader__.load({
2715
4111
  "locale",
2716
4112
  "remote",
2717
4113
  "remote.directoryPicker",
2718
- "layout"
4114
+ "layout",
4115
+ "shortcuts"
2719
4116
  ];
2720
4117
  /**
2721
4118
  * Register the browser and picker once their slot declarations are on the
@@ -2726,12 +4123,27 @@ window.__ModuleLoader__.load({
2726
4123
  function apply(ctx) {
2727
4124
  const sessions = ctx.get("sessions");
2728
4125
  const workspaces = ctx.get("workspaces");
2729
- const uiWorkspace = new UiWorkspaceService(ctx, ctx.remote.directoryPicker, workspaces, sessions);
4126
+ const viewHandle = createWorkspaceViewStore();
4127
+ const viewInstance = viewHandle.create();
4128
+ const viewStore = {
4129
+ ...viewHandle,
4130
+ create: () => viewInstance
4131
+ };
4132
+ const rowToast = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
4133
+ let toastSeq = 0;
4134
+ const notify = (toast) => {
4135
+ rowToast.set({
4136
+ ...toast,
4137
+ seq: ++toastSeq
4138
+ });
4139
+ };
4140
+ const uiWorkspace = new UiWorkspaceService(ctx, ctx.remote.directoryPicker, workspaces, sessions, viewInstance.actions, notify);
2730
4141
  ctx.slots.provideRoot({ hooks: { workspaces: workspaces.list } });
2731
4142
  ctx.effect(() => ctx.locale.register(NS, {
2732
4143
  zh,
2733
4144
  en
2734
4145
  }), "ui-workspace: dictionaries");
4146
+ const shortcutControls = createWorkspaceShortcutControls();
2735
4147
  const searchSessions = async (query, signal) => {
2736
4148
  const result = await sessions.search(query, signal);
2737
4149
  if (!result.ok) throw new Error(result.error.message);
@@ -2750,6 +4162,99 @@ window.__ModuleLoader__.load({
2750
4162
  const openSession = (sessionId) => {
2751
4163
  uiWorkspace.openSession(sessionId);
2752
4164
  };
4165
+ const pinnedSet = derive(workspaces.list, (snapshot) => new Set(snapshot.pinnedSessionIds));
4166
+ const archivedSet = derive(workspaces.list, (snapshot) => new Set(snapshot.archivedSessionIds));
4167
+ const renameRequest = derive(shortcutControls.state, (state) => state.renameTarget);
4168
+ const archiveRequest = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
4169
+ const requestSessionRename = shortcutControls.rename;
4170
+ const unarchiveSession = (sessionId) => {
4171
+ uiWorkspace.unarchiveSession(sessionId).catch((reason) => {
4172
+ console.warn("session unarchive rejected:", reason);
4173
+ });
4174
+ };
4175
+ const renameSession = async (sessionId, title) => {
4176
+ const result = await sessions.using(sessionId, { source: "workspaceOperation" }, (reference) => reference.binding.session.rename(title));
4177
+ if (!result.ok) throw new Error(result.error.message);
4178
+ };
4179
+ const pinInjected = () => ({
4180
+ hooks: {
4181
+ pinned: pinnedSet,
4182
+ archived: archivedSet
4183
+ },
4184
+ pinSession: (sessionId) => {
4185
+ uiWorkspace.pinSession(sessionId).catch(() => {
4186
+ notify({ kind: "pinFailed" });
4187
+ });
4188
+ },
4189
+ unpinSession: (sessionId) => {
4190
+ uiWorkspace.unpinSession(sessionId).catch(() => {
4191
+ notify({ kind: "unpinFailed" });
4192
+ });
4193
+ }
4194
+ });
4195
+ const archiveInjected = () => ({
4196
+ hooks: { archived: archivedSet },
4197
+ archiveSession: (sessionId) => {
4198
+ uiWorkspace.archiveSession(sessionId).then(() => {
4199
+ notify({
4200
+ kind: "archived",
4201
+ sessionId
4202
+ });
4203
+ }).catch((reason) => {
4204
+ const activity = activeSessionRefusal(reason);
4205
+ if (activity === void 0) {
4206
+ console.warn("session archive rejected:", reason);
4207
+ return;
4208
+ }
4209
+ const displayTitle = sessions.list.getSnapshot().byId[sessionId]?.displayTitle ?? sessionId;
4210
+ archiveRequest.set({
4211
+ sessionId,
4212
+ displayTitle,
4213
+ activity
4214
+ });
4215
+ });
4216
+ },
4217
+ unarchiveSession
4218
+ });
4219
+ installWorkspaceShortcuts(ctx, uiWorkspace, shortcutControls, archiveInjected().archiveSession);
4220
+ const archiveConfirmInjected = () => ({
4221
+ hooks: { archiveRequest },
4222
+ settleSessionArchive: () => {
4223
+ archiveRequest.set(null);
4224
+ },
4225
+ stopAndArchiveSession: async (sessionId) => {
4226
+ await uiWorkspace.archiveSession(sessionId, { stopActivity: true });
4227
+ notify({
4228
+ kind: "stoppedAndArchived",
4229
+ sessionId
4230
+ });
4231
+ }
4232
+ });
4233
+ const forkInjected = () => ({ forkSession: (sessionId) => {
4234
+ uiWorkspace.forkSession(sessionId, (childId) => {
4235
+ ctx.get("productAnalytics")?.track("branch_session_click", {
4236
+ session_id: childId,
4237
+ parent_session_id: sessionId,
4238
+ click_position: "sidebar"
4239
+ });
4240
+ }).catch(() => {});
4241
+ } });
4242
+ const renameInjected = () => ({ requestSessionRename });
4243
+ const renameDialogInjected = () => ({
4244
+ hooks: { renameRequest },
4245
+ settleSessionRename: shortcutControls.closeRename,
4246
+ renameSession
4247
+ });
4248
+ const rowToastInjected = () => ({
4249
+ hooks: { toast: rowToast },
4250
+ dismissToast: () => {
4251
+ rowToast.set(null);
4252
+ },
4253
+ undoArchive: unarchiveSession,
4254
+ showArchived: () => {
4255
+ viewInstance.actions.setArchivedFilter("show");
4256
+ }
4257
+ });
2753
4258
  const browserInjected = () => ({
2754
4259
  startSession: (workspaceId) => {
2755
4260
  uiWorkspace.startSession(workspaceId);
@@ -2757,14 +4262,9 @@ window.__ModuleLoader__.load({
2757
4262
  open: openSession,
2758
4263
  searchSessions,
2759
4264
  searchResultLimit: sessions.searchResultLimit,
2760
- renameSession: async (sessionId, title) => {
2761
- const session = sessions.binding(sessionId)?.session;
2762
- if (session === void 0) throw new Error(`unknown session "${sessionId}"`);
2763
- const result = await session.rename(title);
2764
- if (!result.ok) throw new Error(result.error.message);
2765
- },
2766
- forkSession: (sessionId) => {
2767
- uiWorkspace.forkSession(sessionId).catch(() => {});
4265
+ requestSessionRename,
4266
+ notifyArchivedNotOpenable: () => {
4267
+ notify({ kind: "archivedNotOpenable" });
2768
4268
  },
2769
4269
  renameWorkspace: async (workspaceId, title) => {
2770
4270
  await workspaces.rename(workspaceId, title);
@@ -2775,16 +4275,20 @@ window.__ModuleLoader__.load({
2775
4275
  insertWorkspaceBefore: async (workspaceId, beforeWorkspaceId) => {
2776
4276
  await workspaces.insertBefore(workspaceId, beforeWorkspaceId);
2777
4277
  },
2778
- archiveSession: async (sessionId) => {
2779
- await uiWorkspace.archiveSession(sessionId);
2780
- },
2781
- insertSessionBefore: async (workspaceId, sessionId, beforeSessionId) => {
2782
- await workspaces.insertSessionBefore(workspaceId, sessionId, beforeSessionId);
4278
+ unarchiveSession: async (sessionId) => {
4279
+ await uiWorkspace.unarchiveSession(sessionId);
2783
4280
  },
2784
4281
  createWorkspace: (input) => workspaces.create(input),
4282
+ requestSearch: shortcutControls.search,
4283
+ requestAddWorkspace: shortcutControls.add,
4284
+ closeAddWorkspace: shortcutControls.closeAdd,
4285
+ setDirectoryBusy: shortcutControls.directoryBusy,
4286
+ dismissForkError: shortcutControls.dismissForkError,
2785
4287
  hooks: {
2786
4288
  directoryFlow: browserFlowSource,
2787
- hostInfo
4289
+ hostInfo,
4290
+ workspaceShortcuts: shortcutControls.state,
4291
+ shortcuts: ctx.shortcuts.catalog
2788
4292
  }
2789
4293
  });
2790
4294
  const pickerInjected = () => ({
@@ -2793,14 +4297,103 @@ window.__ModuleLoader__.load({
2793
4297
  });
2794
4298
  ctx.slots.inject("sidebar.workspaces", () => ctx.slots.register({
2795
4299
  name: "sidebar.workspaces",
2796
- children: { "sidebar.workspaces.directoryFlow": {
2797
- kind: "single",
2798
- scope: "root"
2799
- } },
2800
- store: createWorkspaceViewStore(),
4300
+ children: {
4301
+ "sidebar.workspaces.directoryFlow": {
4302
+ kind: "single",
4303
+ scope: "root"
4304
+ },
4305
+ "sidebar.workspaces.session.menu.item": {
4306
+ kind: "list",
4307
+ scope: "root",
4308
+ inject: { hooks: {
4309
+ menuOpenState: menuOpenStateFactory,
4310
+ shortcuts: ctx.shortcuts.catalog
4311
+ } }
4312
+ },
4313
+ "sidebar.workspaces.session.row.action": {
4314
+ kind: "list",
4315
+ scope: "root"
4316
+ },
4317
+ "sidebar.session.row.leading": {
4318
+ kind: "list",
4319
+ scope: "root"
4320
+ },
4321
+ "sidebar.session.row.hover": {
4322
+ kind: "list",
4323
+ scope: "root"
4324
+ }
4325
+ },
4326
+ store: viewStore,
2801
4327
  inject: browserInjected,
2802
4328
  locale: NS
2803
4329
  }, WorkspaceBrowser));
4330
+ ctx.slots.inject("sidebar.workspaces.session.menu.item", function* () {
4331
+ yield ctx.slots.register({
4332
+ name: "sidebar.workspaces.session.menu.item",
4333
+ id: "pin",
4334
+ order: 100,
4335
+ locale: NS,
4336
+ inject: pinInjected
4337
+ }, PinSessionMenuItem);
4338
+ yield ctx.slots.register({
4339
+ name: "sidebar.workspaces.session.menu.item",
4340
+ id: "rename",
4341
+ order: 200,
4342
+ locale: NS,
4343
+ inject: renameInjected
4344
+ }, RenameSessionMenuItem);
4345
+ yield ctx.slots.register({
4346
+ name: "sidebar.workspaces.session.menu.item",
4347
+ id: "fork",
4348
+ order: 300,
4349
+ locale: NS,
4350
+ inject: forkInjected
4351
+ }, ForkSessionMenuItem);
4352
+ yield ctx.slots.register({
4353
+ name: "sidebar.workspaces.session.menu.item",
4354
+ id: "archive",
4355
+ order: 400,
4356
+ locale: NS,
4357
+ inject: archiveInjected
4358
+ }, ArchiveSessionMenuItem);
4359
+ });
4360
+ ctx.slots.inject("sidebar.workspaces.session.row.action", function* () {
4361
+ yield ctx.slots.register({
4362
+ name: "sidebar.workspaces.session.row.action",
4363
+ id: "archive",
4364
+ order: 100,
4365
+ locale: NS,
4366
+ inject: archiveInjected
4367
+ }, ArchiveSessionRowButton);
4368
+ yield ctx.slots.register({
4369
+ name: "sidebar.workspaces.session.row.action",
4370
+ id: "pin",
4371
+ order: 200,
4372
+ locale: NS,
4373
+ inject: pinInjected
4374
+ }, PinSessionRowButton);
4375
+ });
4376
+ ctx.slots.inject("shell.overlay", function* () {
4377
+ yield ctx.slots.register({
4378
+ name: "shell.overlay",
4379
+ id: "workspace.session-rename",
4380
+ locale: NS,
4381
+ inject: renameDialogInjected
4382
+ }, SessionRenameDialog);
4383
+ yield ctx.slots.register({
4384
+ name: "shell.overlay",
4385
+ id: "workspace.session-archive",
4386
+ locale: NS,
4387
+ inject: archiveConfirmInjected
4388
+ }, SessionArchiveConfirmDialog);
4389
+ yield ctx.slots.register({
4390
+ name: "shell.overlay",
4391
+ id: "workspace.row-toast",
4392
+ locale: NS,
4393
+ store: viewStore,
4394
+ inject: rowToastInjected
4395
+ }, RowActionToast);
4396
+ });
2804
4397
  ctx.slots.inject("conversation.hero.workspace", () => ctx.slots.register({
2805
4398
  name: "conversation.hero.workspace",
2806
4399
  children: { "conversation.hero.workspace.directoryFlow": {
@@ -2811,6 +4404,16 @@ window.__ModuleLoader__.load({
2811
4404
  locale: NS
2812
4405
  }, WorkspacePicker));
2813
4406
  }
4407
+ /**
4408
+ * The activity a Host `workspace/session-active` refusal reported, or nothing
4409
+ * for any other failure. The class identity check goes by name: client plugin
4410
+ * bundles do not share error-class identity.
4411
+ */
4412
+ function activeSessionRefusal(reason) {
4413
+ if (!(reason instanceof Error) || reason.name !== "WorkspaceArchiveError") return void 0;
4414
+ const { rpcError } = reason;
4415
+ return rpcError.code === "workspace/session-active" ? rpcError.details.activity : void 0;
4416
+ }
2814
4417
  //#endregion
2815
4418
  exports.apply = apply;
2816
4419
  exports.inject = inject;