@dungsil/dsh-plugin-ui-sidebar-inbox 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @dungsil/dsh-plugin-ui-sidebar-inbox
2
2
 
3
- DSH의 기존 사이드바 모양을 유지하면서, 프로젝트별 목록을 T3 Code Nightly처럼 상태별 목록으로 배치합니다. 기본 보기 옵션은 DSH 그대로 두고, 보기 옵션의 `[정렬 기준] > [에이전트 활동]`을 선택한 동안에만 상태별 배치를 사용합니다.
3
+ DSH의 기존 사이드바 모양을 유지하면서, 프로젝트별 목록을 T3 Code Nightly처럼 상태별 목록으로 배치합니다. 설치 후 최초 활성화 시 `[그룹 기준] > [하나의 목록]`과 `[정렬 기준] > [에이전트 활동]`을 자동으로 선택합니다. 이후 사용자가 바꾼 보기 옵션은 유지합니다.
4
4
 
5
5
  기존 `@dungsil/dsh-plugin-sidebar-inbox`를 대체하는 패키지이며, 새 이름의 첫 버전은 `0.1.0`입니다. 기존 패키지의 모든 버전은 사용 중단(deprecated) 대상입니다. 기존 패키지를 비활성화하고 새 패키지를 설치·활성화합니다. 두 패키지를 동시에 활성화하지 마세요. 기존 정렬 선택과 이전 정렬 복원 설정은 유지됩니다.
6
6
 
@@ -21,14 +21,14 @@ DSH `0.2.2-alpha.2`의 영어 UI에서 예시 세션으로 촬영한 화면입
21
21
 
22
22
  목록 제목과 메뉴 항목은 DSH UI 언어를 따릅니다. 한국어 UI에서는 정렬 항목이 `에이전트 활동`, 영역 제목이 `작업 중`·`보관됨`으로 표시됩니다. 번역 사전은 이 플러그인이 직접 포함하므로 한국어 UI 언어 팩을 따로 설치하지 않아도 됩니다.
23
23
 
24
- Pinned와 Inbox는 별도 제목 없이 위쪽 목록에 표시합니다. Working과 Archived는 목록을 스크롤해도 사이드바 하단에 붙어 있습니다. 기본값은 Working을 펼치고 Archived를 접은 상태입니다. 두 제목을 누르거나 키보드로 활성화하면 각 영역이 부드럽게 펼쳐지고 접힙니다. Archived는 세션 필터가 `모든 대화 (보관된 세션 포함)`일 때만 접을 수 있습니다. `보관된 세션만` 필터에서는 보관한 세션이 목록 전체이므로 접지 않고 그대로 표시합니다. 새로고침하면 기본값으로 돌아갑니다.
24
+ Pinned와 Inbox는 별도 제목 없이 위쪽 목록에 표시합니다. Working과 Archived는 하단의 스크롤 영역을 공유합니다. 두 영역의 제목과 세션을 합친 높이는 사이드바 목록 표시 영역의 50%를 넘지 않습니다. 내용이 많으면 하단 영역 안에서 스크롤하며, Pinned와 Inbox는 위쪽에서 따로 스크롤합니다. 기본값은 Working을 펼치고 Archived를 접은 상태입니다. 두 제목을 누르거나 키보드로 활성화하면 각 영역이 부드럽게 펼쳐지고 접힙니다. Archived는 세션 필터가 `모든 대화 (보관된 세션 포함)`일 때만 접을 수 있습니다. `보관된 세션만` 필터에서는 보관한 세션이 목록 전체이므로 접지 않고 그대로 표시합니다. 새로고침하면 기본값으로 돌아갑니다.
25
25
 
26
26
  이 배치와 제목은 `그룹 기준`이 `하나의 목록`일 때만 적용됩니다. `작업 공간`·`작업 공간 트리` 그룹에서는 DSH 기본 표시를 따르며, 정렬을 켠 채 그룹 기준을 바꾸면 자동으로 해제됩니다.
27
27
 
28
28
  ## 사용법
29
29
 
30
- 1. 사이드바의 **보기 옵션**(필터 아이콘) → **그룹 기준**을 **하나의 목록**으로 맞춥니다. `에이전트 활동` 정렬은 이 그룹에서만 선택할 수 있습니다.
31
- 2. 같은 메뉴의 **정렬 기준**에서 **에이전트 활동**을 선택합니다.
30
+ 1. 설치 후 최초 활성화하면 **하나의 목록 / 에이전트 활동**이 자동으로 적용됩니다. 세션 필터는 바꾸지 않습니다.
31
+ 2. 나중에 다시 켜려면 사이드바의 **보기 옵션**(필터 아이콘)에서 **그룹 기준**을 **하나의 목록**, **정렬 기준**을 **에이전트 활동**으로 맞춥니다.
32
32
  3. 그만 쓰려면 **수동**이나 **최근 수정일**을 선택하거나 같은 **에이전트 활동** 항목을 다시 선택합니다. 전자는 고른 정렬로 바뀌고, 후자는 에이전트 활동을 켜기 전에 쓰던 정렬로 돌아갑니다.
33
33
  4. 정리할 세션의 `⋯` 메뉴에서 `세션 보관`을 선택합니다.
34
34
  5. 사이드바의 세션 필터를 `모든 대화 (보관된 세션 포함)`으로 바꾸면 보관한 세션이 하단 `Archived` 영역에 접힌 채로 표시됩니다.
@@ -55,15 +55,16 @@ DSH의 플러그인 관리 화면에서 **Sidebar Inbox / 사이드바 수신함
55
55
 
56
56
  ## 동작 범위
57
57
 
58
- - 기본 동작은 no-op입니다. `그룹 기준`, `정렬 기준`, `세션 필터`를 덮어쓰지 않으며, `에이전트 활동` 정렬을 선택한 동안에만 순서를 계산합니다.
58
+ - 이전 정렬 복원 설정이 없는 새 설치에서는 최초 활성화 시에만 `하나의 목록 / 에이전트 활동`을 적용합니다. 기존 복원 설정이 있으면 사용자가 선택한 보기 옵션을 유지하며, 새로고침이나 재활성화로 정렬을 강제로 켜지 않습니다. 브라우저 저장소를 사용할 수 없으면 자동 적용하지 않습니다. `세션 필터`는 바꾸지 않으며, `에이전트 활동` 정렬을 선택한 동안에만 순서를 계산합니다.
59
59
  - 플러그인은 DSH의 공유 Workspace 보기 저장소에 `agent-activity` 정렬 값을 저장합니다. DSH는 이 값을 수동 정렬처럼 읽으므로 화면 순서와 DOM 순서가 일치하고, 새로고침 후에도 선택이 유지됩니다.
60
60
  - 정렬은 `그룹 기준`이 `하나의 목록`일 때만 활성화됩니다. 다른 그룹 기준에서는 보기 옵션의 `에이전트 활동` 항목이 비활성화되고, 정렬을 켠 채 그룹 기준을 바꾸면 이전 정렬 기준으로 자동 해제됩니다. 정렬을 선택한 동안에는 `하나의 목록`의 순서만 갱신합니다.
61
61
  - 행을 드래그하면 DSH가 수동 정렬로 전환하므로 에이전트 활동이 자동으로 해제됩니다. DSH의 정렬 변경 규칙을 그대로 따르므로, 에이전트 활동을 켜기 전에 드래그해 둔 수동 배치는 복원되지 않습니다.
62
62
  - 보관 상태와 보관 필터는 DSH가 소유합니다. 이 플러그인은 브라우저 저장소에 상태를 남기지 않으며, 보관한 세션도 하단 영역에서 그대로 복원할 수 있습니다.
63
63
  - 기존 세션 행, 검색, 메뉴, 선택, 고정, 보관 필터를 재사용합니다. CSS로 순서만 바꾸지 않고 DSH의 목록 정렬을 갱신하므로 화면 순서와 DOM 순서가 일치합니다.
64
- - 영역을 접고 펼 때는 160~180ms 높이 전환으로 애니메이션합니다. 운영체제의 동작 줄이기(`prefers-reduced-motion`) 설정을 켜면 애니메이션 없이 즉시 바뀝니다.
64
+ - Working의 펼침은 320ms로 유지합니다. Archived는 세션 수와 관계없이 실제로 보이는 하단 영역을 480ms 동안 펼칩니다. 접힘은 260ms이며, 운영체제의 동작 줄이기(`prefers-reduced-motion`) 설정을 켜면 애니메이션 없이 즉시 바뀝니다.
65
+ - 위쪽 목록과 하단 영역은 DSH 기본 스크롤바의 두께·색상·호버 스타일을 사용합니다. Shadow DOM 안에서도 DSH의 스크롤바 테마 변수를 그대로 따릅니다.
65
66
  - 접힌 영역의 래퍼는 목록 행 간격을 남기지 않아, 보이는 내용이 짧아도 불필요한 세로 스크롤바가 생기지 않습니다.
66
- - DSH `0.2.x`의 보기 옵션 메뉴에는 플러그인 확장 슬롯이 없어서 정렬 항목을 메뉴 DOM에 직접 추가합니다. DSH가 이 메뉴 구조를 바꾸면 호환성 갱신이 필요합니다. 같은 이유로 공유 Workspace 보기 저장소와 `data-row-key`를 사용하며, 기본 행은 교체하거나 다른 DOM 부모로 옮기지 않고 영역 제목만 추가합니다.
67
+ - DSH `0.2.x`의 보기 옵션 메뉴에는 플러그인 확장 슬롯이 없어서 정렬 항목을 메뉴 DOM에 직접 추가합니다. DSH가 이 메뉴 구조를 바꾸면 호환성 갱신이 필요합니다. 같은 이유로 공유 Workspace 보기 저장소와 `data-row-key`를 사용합니다. 기본 행은 교체하거나 다른 DOM 부모로 옮기지 않습니다. Shadow DOM 슬롯으로 위쪽 목록과 하단 영역을 나누며, 비활성화하면 기본 슬롯으로 원래 목록 표시를 복원합니다.
67
68
  - 플러그인을 비활성화하면 이전에 쓰던 정렬 기준으로 돌아갑니다. 정렬 기준이 어긋나 보이면 보기 옵션에서 수동이나 최근 수정일을 한 번 선택하면 DSH 기본 동작으로 돌아갑니다.
68
69
 
69
70
  ## 검증
@@ -74,4 +75,4 @@ pnpm --filter @dungsil/dsh-plugin-ui-sidebar-inbox typecheck
74
75
  pnpm --filter @dungsil/dsh-plugin-ui-sidebar-inbox test
75
76
  ```
76
77
 
77
- 자동 테스트는 기본 보기 옵션을 건드리지 않는지, 정렬 항목 주입과 키보드 순서·선택 표시, 하나의 목록에서의 상태별 순서, 그룹 기준이 다를 때 정렬 항목 비활성화와 자동 해제, 보관한 세션의 하단 배치, 보관 필터별 표시, Working과 Archived의 기본 펼침·접힘과 제목 토글, 보관 해제 반영, UI 언어 전환에 따른 제목 갱신, 정렬 해제와 이전 정렬 복원을 확인합니다.
78
+ 자동 테스트는 새 설치에서의 기본 정렬 적용과 이후 선택 유지, 정렬 항목 주입과 키보드 순서·선택 표시, 하나의 목록에서의 상태별 순서, 그룹 기준이 다를 때 정렬 항목 비활성화와 자동 해제, 보관한 세션의 하단 배치, 보관 필터별 표시, Working과 Archived의 기본 펼침·접힘과 제목 토글, 보관 해제 반영, UI 언어 전환에 따른 제목 갱신, 정렬 해제와 이전 정렬 복원을 확인합니다.
package/dist/client.js CHANGED
@@ -1,5 +1,8 @@
1
1
  window.__ModuleLoader__.load({ id: "@dungsil/dsh-plugin-ui-sidebar-inbox", factory(require) { const module = { exports: {} }; const exports = module.exports;
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ let react = require("react");
4
+ let react_dom_client = require("react-dom/client");
5
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
3
6
  // src/inbox.ts
4
7
  /**
5
8
  * Archive is DSH's own explicit state, not a synonym for completion or viewing a
@@ -53,8 +56,12 @@ function placeSessions(list, statuses, pinned, archived) {
53
56
  */
54
57
  function installHeadings(placements, labels, archivedCollapsible, active = () => true) {
55
58
  const headings = /* @__PURE__ */ new Map();
59
+ const icons = /* @__PURE__ */ new Map();
56
60
  const trees = /* @__PURE__ */ new Set();
57
61
  const wrappers = /* @__PURE__ */ new Set();
62
+ const originalSlots = /* @__PURE__ */ new Map();
63
+ const panes = /* @__PURE__ */ new Map();
64
+ const archiveAnimations = /* @__PURE__ */ new Map();
58
65
  /** Each footer opens independently; a reload resets to these defaults. */
59
66
  const open = {
60
67
  Working: true,
@@ -62,23 +69,26 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
62
69
  };
63
70
  const style = document.createElement("style");
64
71
  style.textContent = `
65
- [data-dsh-inbox-tree] { display: flex; flex-direction: column; padding-bottom: 0; interpolate-size: allow-keywords; }
72
+ [data-dsh-inbox-tree] {
73
+ display: flex; flex-direction: column; padding-bottom: 0;
74
+ overflow: hidden; scrollbar-gutter: auto; interpolate-size: allow-keywords;
75
+ }
66
76
  [data-dsh-inbox-tree] > * { flex: none; }
67
77
  [data-dsh-inbox-tree] ~ span { display: none; }
68
- [data-dsh-inbox-footer] {
69
- position: sticky; z-index: 1; background: var(--dsw-specific-sidebar-fill);
70
- bottom: var(--dsh-inbox-bottom, 0px);
71
- }
72
- [data-dsh-inbox-first] { margin-top: auto !important; }
78
+ [data-dsh-inbox-footer] { background: var(--dsw-specific-sidebar-fill); }
79
+ [data-dsh-inbox-first] { margin-top: 0 !important; }
73
80
  /* Closed rows keep their box at zero height, so a heading press animates in
74
81
  both directions without moving or cloning React-owned rows. */
75
82
  [data-dsh-inbox-footer] > [data-row-key] {
76
83
  overflow: hidden;
77
- transition: height 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 140ms ease-out, visibility 0s;
84
+ transition: height 320ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease-out, visibility 0s;
85
+ }
86
+ [data-dsh-inbox-footer="Archived"] > [data-row-key] {
87
+ transition: height 480ms cubic-bezier(0.4, 0, 0.2, 1), opacity 280ms ease-in-out, visibility 0s;
78
88
  }
79
89
  [data-dsh-inbox-closed] > [data-row-key] {
80
90
  height: 0; opacity: 0; visibility: hidden;
81
- transition: height 160ms cubic-bezier(0.4, 0, 1, 1), opacity 120ms ease-in, visibility 0s 160ms;
91
+ transition: height 260ms cubic-bezier(0.4, 0, 1, 1), opacity 180ms ease-in, visibility 0s 260ms;
82
92
  }
83
93
  @media (prefers-reduced-motion: reduce) {
84
94
  [data-dsh-inbox-footer] > [data-row-key],
@@ -92,31 +102,114 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
92
102
  color: var(--dsw-alias-label-tertiary); font-weight: 500;
93
103
  }
94
104
  [data-dsh-inbox-heading] button {
95
- display: block; width: 100%; padding: 0; border: 0; background: none;
96
- color: inherit; font: inherit; text-align: left; cursor: pointer;
105
+ display: flex; align-items: center; width: 100%; padding: 0; border: 0; background: none;
106
+ color: inherit; font: inherit; text-align: start; cursor: pointer;
97
107
  }
98
- [data-dsh-inbox-heading] button::before { content: '▸'; display: inline-block; width: 16px; }
99
- [data-dsh-inbox-heading] button[aria-expanded="true"]::before { content: '▾'; }
108
+ [data-dsh-inbox-heading] button > span:first-child { display: flex; flex: 0 0 16px; }
100
109
  `;
101
110
  document.head.append(style);
102
111
  const clearWrapper = (wrapper) => {
103
112
  delete wrapper.dataset.dshInboxFooter;
104
113
  delete wrapper.dataset.dshInboxFirst;
105
114
  delete wrapper.dataset.dshInboxClosed;
106
- wrapper.style.removeProperty("--dsh-inbox-bottom");
115
+ if (originalSlots.has(wrapper)) {
116
+ const slot = originalSlots.get(wrapper);
117
+ if (slot === null) wrapper.removeAttribute("slot");
118
+ else wrapper.setAttribute("slot", slot);
119
+ originalSlots.delete(wrapper);
120
+ }
107
121
  };
108
- const positionFooters = () => {
109
- for (const tree of trees) {
110
- let bottom = 0;
111
- const footers = [...tree.querySelectorAll("[data-dsh-inbox-footer]")];
112
- for (const wrapper of footers.reverse()) {
113
- wrapper.style.setProperty("--dsh-inbox-bottom", `${bottom}px`);
114
- const height = wrapper.offsetHeight;
115
- if (height > 0) bottom += height + 2;
116
- }
122
+ const releasePane = (tree) => {
123
+ archiveAnimations.get(tree)?.();
124
+ const pane = panes.get(tree);
125
+ if (!pane) return;
126
+ const slot = document.createElement("slot");
127
+ slot.dataset.dshInboxNative = "";
128
+ pane.root.replaceChildren(slot);
129
+ panes.delete(tree);
130
+ };
131
+ const installPane = (tree) => {
132
+ if (panes.has(tree)) return;
133
+ const root = tree.shadowRoot ?? tree.attachShadow({ mode: "open" });
134
+ const sheet = document.createElement("style");
135
+ sheet.textContent = `
136
+ slot { display: contents; }
137
+ .pane {
138
+ box-sizing: border-box; min-inline-size: 0; min-block-size: 0;
139
+ overflow: auto; overscroll-behavior: contain;
140
+ scrollbar-gutter: stable;
141
+ }
142
+ @supports not selector(::-webkit-scrollbar) {
143
+ .pane { scrollbar-width: thin; scrollbar-color: var(--dsh-scrollbar-thumb) transparent; }
144
+ }
145
+ ::-webkit-scrollbar { width: var(--dsh-scrollbar-width); height: var(--dsh-scrollbar-width); }
146
+ ::-webkit-scrollbar-track { margin-block: var(--dsh-scrollbar-track-margin); background: transparent; }
147
+ ::-webkit-scrollbar-thumb {
148
+ border: var(--dsh-scrollbar-thumb-border) solid transparent; corner-shape: round;
149
+ background: var(--dsh-scrollbar-thumb); background-clip: content-box; border-radius: 999px;
150
+ }
151
+ ::-webkit-scrollbar-thumb:hover { background-color: var(--dsh-scrollbar-thumb-hover); }
152
+ ::-webkit-scrollbar-corner { background: transparent; }
153
+ .main { flex: 1; }
154
+ .footer { flex: none; max-block-size: 50%; }
155
+ @media (prefers-reduced-motion: reduce) { .footer { transition: none !important; } }
156
+ ::slotted(*) { display: block; }
157
+ `;
158
+ const main = document.createElement("div");
159
+ main.className = "pane main";
160
+ main.append(document.createElement("slot"));
161
+ const footer = document.createElement("div");
162
+ footer.className = "pane footer";
163
+ footer.dataset.dshInboxPane = "";
164
+ const slot = document.createElement("slot");
165
+ slot.name = "dsh-inbox-footer";
166
+ footer.append(slot);
167
+ const notifyScroll = () => tree.dispatchEvent(new Event("scroll"));
168
+ main.addEventListener("scroll", notifyScroll);
169
+ footer.addEventListener("scroll", notifyScroll);
170
+ root.replaceChildren(sheet, main, footer);
171
+ panes.set(tree, {
172
+ root,
173
+ footer
174
+ });
175
+ };
176
+ const sizeFooters = () => {
177
+ for (const [tree, { footer }] of panes) footer.style.maxBlockSize = `${tree.clientHeight / 2}px`;
178
+ };
179
+ const animateArchive = (tree, from) => {
180
+ archiveAnimations.get(tree)?.();
181
+ const footer = panes.get(tree)?.footer;
182
+ if (!footer || tree.clientHeight === 0 || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
183
+ let naturalHeight = 0;
184
+ for (const wrapper of wrappers) {
185
+ if (wrapper.parentElement !== tree) continue;
186
+ const row = wrapper.querySelector("[data-row-key]");
187
+ const margins = getComputedStyle(wrapper);
188
+ naturalHeight += (headings.get(wrapper)?.offsetHeight ?? 0) + (wrapper.hasAttribute("data-dsh-inbox-closed") ? 0 : row?.scrollHeight ?? 0) + (Number.parseFloat(margins.marginTop) || 0) + (Number.parseFloat(margins.marginBottom) || 0);
117
189
  }
190
+ const target = Math.min(naturalHeight, tree.clientHeight / 2);
191
+ if (Math.abs(target - from) < .5) return;
192
+ const duration = open.Archived ? 480 : 260;
193
+ footer.style.transition = "none";
194
+ footer.style.height = `${from}px`;
195
+ footer.getBoundingClientRect();
196
+ footer.style.transition = `height ${duration}ms cubic-bezier(0.4, 0, 0.2, 1)`;
197
+ footer.style.height = `${target}px`;
198
+ const finish = () => {
199
+ clearTimeout(timeout);
200
+ footer.removeEventListener("transitionend", onEnd);
201
+ footer.style.removeProperty("height");
202
+ footer.style.removeProperty("transition");
203
+ archiveAnimations.delete(tree);
204
+ };
205
+ const onEnd = (event) => {
206
+ if (event.target === footer && event.propertyName === "height") finish();
207
+ };
208
+ const timeout = setTimeout(finish, duration + 100);
209
+ footer.addEventListener("transitionend", onEnd);
210
+ archiveAnimations.set(tree, finish);
118
211
  };
119
- const resize = new ResizeObserver(positionFooters);
212
+ const resize = new ResizeObserver(sizeFooters);
120
213
  let scheduled = false;
121
214
  let disposed = false;
122
215
  const refresh = () => {
@@ -133,7 +226,10 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
133
226
  for (const wrapper of wrappers) clearWrapper(wrapper);
134
227
  wrappers.clear();
135
228
  if (!active()) {
229
+ for (const tree of panes.keys()) releasePane(tree);
136
230
  for (const [wrapper, heading] of headings) {
231
+ icons.get(heading)?.unmount();
232
+ icons.delete(heading);
137
233
  heading.remove();
138
234
  headings.delete(wrapper);
139
235
  }
@@ -141,6 +237,8 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
141
237
  }
142
238
  for (const tree of document.querySelectorAll("[role=\"tree\"]")) {
143
239
  if (tree.querySelector("[data-row-key^=\"workspace:\"]")) continue;
240
+ if (tree.shadowRoot && !panes.has(tree) && !tree.shadowRoot.querySelector("[data-dsh-inbox-native]")) continue;
241
+ if ([...tree.children].some((child) => child.getAttribute("slot"))) continue;
144
242
  let previous;
145
243
  let firstFooter = true;
146
244
  for (const row of tree.querySelectorAll("[data-row-key^=\"session:\"]")) {
@@ -153,17 +251,24 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
153
251
  trees.add(tree);
154
252
  tree.dataset.dshInboxTree = "";
155
253
  wrappers.add(wrapper);
156
- wrapper.dataset.dshInboxFooter = "";
254
+ originalSlots.set(wrapper, wrapper.getAttribute("slot"));
255
+ wrapper.slot = "dsh-inbox-footer";
256
+ wrapper.dataset.dshInboxFooter = section;
157
257
  if (firstFooter) wrapper.dataset.dshInboxFirst = "";
158
258
  firstFooter = false;
159
259
  if (section !== previous) wanted.set(wrapper, section);
160
260
  if (!open[section]) wrapper.dataset.dshInboxClosed = "";
161
261
  previous = section;
162
- resize.observe(wrapper);
163
262
  }
164
- if (trees.has(tree)) resize.observe(tree);
263
+ if (trees.has(tree)) {
264
+ installPane(tree);
265
+ resize.observe(tree);
266
+ }
165
267
  }
268
+ for (const tree of panes.keys()) if (!trees.has(tree)) releasePane(tree);
166
269
  for (const [wrapper, heading] of headings) if (!wanted.has(wrapper)) {
270
+ icons.get(heading)?.unmount();
271
+ icons.delete(heading);
167
272
  heading.remove();
168
273
  headings.delete(wrapper);
169
274
  }
@@ -177,6 +282,8 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
177
282
  headings.set(wrapper, heading);
178
283
  }
179
284
  if (heading.dataset.dshInboxSection !== section) {
285
+ icons.get(heading)?.unmount();
286
+ icons.delete(heading);
180
287
  heading.textContent = "";
181
288
  heading.dataset.dshInboxSection = section;
182
289
  }
@@ -184,22 +291,37 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
184
291
  if (!button) {
185
292
  button = document.createElement("button");
186
293
  button.type = "button";
294
+ const icon = document.createElement("span");
295
+ icon.setAttribute("aria-hidden", "true");
296
+ icons.set(heading, (0, react_dom_client.createRoot)(icon));
297
+ button.append(icon, document.createElement("span"));
187
298
  button.onclick = (event) => {
188
299
  event.stopPropagation();
189
300
  const current = heading.dataset.dshInboxSection;
190
301
  if (current !== "Working" && current !== "Archived") return;
302
+ const tree = wrapper.parentElement;
303
+ const from = (panes.get(tree)?.footer)?.getBoundingClientRect().height ?? 0;
304
+ const animate = current === "Archived" || archiveAnimations.has(tree);
191
305
  open[current] = !open[current];
192
306
  refresh();
307
+ if (animate) queueMicrotask(() => {
308
+ if (!disposed && panes.has(tree)) animateArchive(tree, from);
309
+ });
193
310
  };
194
311
  heading.append(button);
195
312
  }
196
313
  const text = section === "Archived" ? labels().archived : labels().working;
197
- if (button.textContent !== text) button.textContent = text;
314
+ const label = button.lastElementChild;
315
+ if (label.textContent !== text) label.textContent = text;
198
316
  button.setAttribute("aria-label", text);
199
- button.setAttribute("aria-expanded", String(open[section]));
317
+ const expanded = String(open[section]);
318
+ if (button.getAttribute("aria-expanded") !== expanded) {
319
+ button.setAttribute("aria-expanded", expanded);
320
+ icons.get(heading).render((0, react.createElement)(open[section] ? _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular : _deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 16 }));
321
+ }
200
322
  if (wrapper.firstChild !== heading) wrapper.prepend(heading);
201
323
  }
202
- positionFooters();
324
+ sizeFooters();
203
325
  });
204
326
  };
205
327
  const observer = new MutationObserver((records) => {
@@ -219,10 +341,13 @@ function installHeadings(placements, labels, archivedCollapsible, active = () =>
219
341
  disposed = true;
220
342
  observer.disconnect();
221
343
  resize.disconnect();
344
+ for (const root of icons.values()) root.unmount();
345
+ icons.clear();
222
346
  for (const heading of headings.values()) heading.remove();
223
347
  headings.clear();
224
348
  for (const tree of trees) delete tree.dataset.dshInboxTree;
225
349
  for (const wrapper of wrappers) clearWrapper(wrapper);
350
+ for (const tree of panes.keys()) releasePane(tree);
226
351
  style.remove();
227
352
  }
228
353
  };
@@ -448,7 +573,7 @@ const FLAT_ORDER = "__flat_session_order__";
448
573
  * order is what the sidebar renders while this mode is selected.
449
574
  */
450
575
  const AGENT_ACTIVITY = "agent-activity";
451
- /** Remembers the native sort to restore when the plugin mode is released. */
576
+ /** Remembers the native sort; its presence also marks first-use setup complete. */
452
577
  const PREVIOUS_SORT_KEY = "dungsil.sidebar-inbox.sort.v1";
453
578
  function isAgentActivity(orderBy) {
454
579
  return String(orderBy) === AGENT_ACTIVITY;
@@ -520,6 +645,19 @@ function apply(ctx) {
520
645
  const entry = ctx.slots.entries("sidebar.workspaces").find((candidate) => candidate.registrant === "@deepseek-ai/dsh-client-ui-workspace") ?? ctx.slots.entries("sidebar.workspaces").find((candidate) => (candidate.options.priority ?? 0) === 0);
521
646
  if (!entry?.store || typeof entry.store === "function") throw new Error("Sidebar Inbox requires the DSH 0.2.1 workspace view store");
522
647
  view = entry.store.create();
648
+ try {
649
+ if (localStorage.getItem(PREVIOUS_SORT_KEY) === null && !isActive()) {
650
+ const current = view.getSnapshot();
651
+ if (current.orderBy === "manual" || current.orderBy === "updated") {
652
+ localStorage.setItem(PREVIOUS_SORT_KEY, current.orderBy);
653
+ view.store.set({
654
+ ...current,
655
+ groupBy: "flat",
656
+ orderBy: AGENT_ACTIVITY
657
+ });
658
+ }
659
+ }
660
+ } catch {}
523
661
  const headings = installHeadings(() => placements, () => ({
524
662
  working: translate("heading.working"),
525
663
  archived: translate("heading.archived")
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "侧边栏收件箱",
4
+ "description": "在原生视图选项中添加“智能体活动”排序。单列表启用此排序时,会话按收件箱、进行中、已归档的顺序排列;在 DSH 中归档的会话会折叠显示在“所有对话”视图底部。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dungsil/dsh-plugin-ui-sidebar-inbox",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "State-based Inbox, Working and Archived sidebar ordering for DeepSeek Harness, selected from a native Agent activity sort option.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,12 +22,6 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "scripts": {
26
- "build": "tsdown",
27
- "typecheck": "tsc --noEmit",
28
- "test": "node --test test/*.test.mjs",
29
- "prepack": "pnpm build"
30
- },
31
25
  "devDependencies": {
32
26
  "@deepseek-ai/cordis": "4.0.5",
33
27
  "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.5",
@@ -41,10 +35,12 @@
41
35
  "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
42
36
  "@deepseek-ai/dsh-client-ui-workspace": "0.2.1-rc.5",
43
37
  "@deepseek-ai/dsh-session": "0.2.1-rc.5",
44
- "@dungsil/dsh-tsconfig": "workspace:*",
38
+ "@dungsil/dsh-tsconfig": "0.0.0",
45
39
  "@types/react": "18.3.18",
40
+ "@types/react-dom": "18.3.7",
46
41
  "happy-dom": "21.0.4",
47
42
  "react": "18.3.1",
43
+ "react-dom": "18.3.1",
48
44
  "tsdown": "0.23.4"
49
45
  },
50
46
  "engines": {
@@ -69,11 +65,13 @@
69
65
  "order": 5,
70
66
  "title": {
71
67
  "en": "Sidebar Inbox",
72
- "ko": "사이드바 수신함"
68
+ "ko": "사이드바 수신함",
69
+ "zh": "侧边栏收件箱"
73
70
  },
74
71
  "description": {
75
72
  "en": "Groups sidebar sessions into Inbox, Working, and Archived lists without changing the existing sidebar.",
76
- "ko": "기존 사이드바 모양을 유지하면서 세션 목록을 수신함·작업 중·보관됨으로 나눠 배치합니다."
73
+ "ko": "기존 사이드바 모양을 유지하면서 세션 목록을 수신함·작업 중·보관됨으로 나눠 배치합니다.",
74
+ "zh": "将侧边栏会话分为收件箱、进行中和已归档列表,不改变现有侧边栏外观。"
77
75
  },
78
76
  "category": "ui",
79
77
  "labels": [],
@@ -83,5 +81,10 @@
83
81
  "inbox",
84
82
  "archived"
85
83
  ]
84
+ },
85
+ "scripts": {
86
+ "build": "tsdown",
87
+ "typecheck": "tsc --noEmit",
88
+ "test": "node --test test/*.test.mjs"
86
89
  }
87
- }
90
+ }