Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix: constrain and deduplicate recycle bin

wytcfad380b61fb
diff --git a/src/renderer/modules/settings.js b/src/renderer/modules/settings.js
index 562da27c..56a88f10 100644
--- a/src/renderer/modules/settings.js
+++ b/src/renderer/modules/settings.js
@@ -381,51 +381,254 @@ function _settingsRecycleAvailable() {
);
}
+let _settingsRecycleActiveSource = 'cloud_sync';
+let _settingsRecycleSourceTouched = false;
+const _settingsRecycleExpandedIds = new Set();
+const _SETTINGS_RECYCLE_SOURCE_CONFIG = [
+ {
+ source: 'cloud_sync',
+ tabKey: 'settings.recycle.tab_cloud',
+ emptyKey: 'settings.recycle.empty_cloud',
+ },
+ {
+ source: 'app',
+ tabKey: 'settings.recycle.tab_local',
+ emptyKey: 'settings.recycle.empty_local',
+ },
+];
+
+function _settingsRecycleCategoryKey(category) {
+ const value = String(category || '').replace(/[^A-Za-z0-9_]/g, '');
+ return value || 'other';
+}
+
+function _settingsRecyclePathTitle(pathValue) {
+ const clean = String(pathValue || '').replace(/\\/g, '/').replace(/^cloud\//, '');
+ const parts = clean.split('/').filter(Boolean);
+ return parts[parts.length - 1] || clean || t('settings.recycle.display_unknown');
+}
+
+function _settingsRecycleCoreId(item, category) {
+ if (_settingsRecycleCategoryKey(item?.category) !== category) return '';
+ const id = String(item?.id || '').trim();
+ if (/^[A-Za-z0-9_.-]+$/.test(id)) return id;
+ const pathValue = String(item?.path || '').replace(/\\/g, '/');
+ const match = new RegExp(`^cloud/${category}s/([^/]+)/`).exec(pathValue);
+ if (match && /^[A-Za-z0-9_.-]+$/.test(match[1])) return match[1];
+ const title = String(item?.title || '').trim();
+ return /^[A-Za-z0-9_.-]+$/.test(title) ? title : '';
+}
+
+function _settingsRecycleAssociatedTarget(item) {
+ const category = _settingsRecycleCategoryKey(item?.category);
+ if (category === 'edit_conversation') {
+ const match = /^(agent|skill):(.+)$/.exec(String(item?.id || ''));
+ if (match && /^[A-Za-z0-9_.-]+$/.test(match[2])) {
+ return { kind: match[1], id: match[2] };
+ }
+ }
+ if (category === 'conversation') {
+ const raw = String(item?.id || item?.title || _settingsRecyclePathTitle(item?.path || '')).trim();
+ const match = /^(agent|skill)-(.+)\.jsonl$/.exec(raw);
+ if (match && /^[A-Za-z0-9_.-]+$/.test(match[2])) {
+ return { kind: match[1], id: match[2] };
+ }
+ }
+ return null;
+}
+
+function _settingsRecycleDisplayItems(batch) {
+ const items = Array.isArray(batch?.display_items) ? batch.display_items : [];
+ const agentIds = new Set();
+ const skillIds = new Set();
+ for (const item of items) {
+ const agentId = _settingsRecycleCoreId(item, 'agent');
+ if (agentId) agentIds.add(agentId);
+ const skillId = _settingsRecycleCoreId(item, 'skill');
+ if (skillId) skillIds.add(skillId);
+ }
+ const collapsed = items.filter((item) => {
+ const target = _settingsRecycleAssociatedTarget(item);
+ if (!target) return true;
+ return target.kind === 'skill' ? !skillIds.has(target.id) : !agentIds.has(target.id);
+ });
+ const supplemental = new Set(['file', 'settings', 'marketplace', 'other']);
+ const hasCore = collapsed.some((item) => !supplemental.has(_settingsRecycleCategoryKey(item?.category)));
+ return hasCore
+ ? collapsed.filter((item) => !supplemental.has(_settingsRecycleCategoryKey(item?.category)))
+ : collapsed;
+}
+
+function _settingsRecycleListJoin(items) {
+ const values = Array.from(new Set((items || []).map((item) => String(item || '').trim()).filter(Boolean)));
+ if (values.length <= 1) return values[0] || '';
+ const lang = (typeof getLang === 'function' ? getLang() : '')
+ || document.documentElement?.lang
+ || (typeof navigator !== 'undefined' ? navigator.language : '')
+ || '';
+ if (/^ja/i.test(lang)) return values.join('、');
+ if (/^en/i.test(lang)) return values.join(', ');
+ return values.join(',');
+}
+
function _settingsRecycleTitle(batch) {
- const direct = String(batch?.display_title || batch?.label || '').trim();
+ const groups = new Map();
+ for (const item of _settingsRecycleDisplayItems(batch)) {
+ const title = String(item?.title || '').trim();
+ if (!title) continue;
+ const category = _settingsRecycleCategoryKey(item?.category);
+ const titles = groups.get(category) || [];
+ if (!titles.includes(title)) titles.push(title);
+ groups.set(category, titles);
+ }
+ if (groups.size > 0) {
+ const joinerKey = t('settings.recycle.display_group_joiner');
+ const joiner = joinerKey === 'settings.recycle.display_group_joiner' ? ';' : joinerKey;
+ return Array.from(groups.entries()).map(([category, titles]) => {
+ const visibleTitles = titles.slice(0, 3);
+ if (titles.length > visibleTitles.length) visibleTitles.push(`+${titles.length - visibleTitles.length}`);
+ return t('settings.recycle.display_group')
+ .replace('{type}', t(`settings.recycle.display_${category}`))
+ .replace('{items}', _settingsRecycleListJoin(visibleTitles));
+ }).join(joiner);
+ }
+ const direct = String(batch?.label || batch?.display_title || '').trim();
if (direct) return direct;
- const displayItems = Array.isArray(batch?.display_items) ? batch.display_items : [];
- const titles = displayItems
- .map((item) => String(item?.title || '').trim())
- .filter(Boolean);
- if (titles.length) return titles.join('; ');
const paths = Array.isArray(batch?.paths_preview) ? batch.paths_preview : [];
- const names = paths
- .map((item) => String(item || '').split('/').filter(Boolean).pop() || '')
- .filter(Boolean);
- return names.join('; ') || t('settings.recycle.display_unknown');
+ return _settingsRecycleListJoin(paths.map(_settingsRecyclePathTitle))
+ || t('settings.recycle.display_unknown');
+}
+
+function _settingsRecycleCategoryLabel(category) {
+ const key = _settingsRecycleCategoryKey(category);
+ const labelKey = `settings.recycle.display_${key}`;
+ const label = t(labelKey);
+ return label === labelKey ? t('settings.recycle.display_other') : label;
+}
+
+function _settingsRecycleItemTitle(item) {
+ const title = String(item?.title || '').trim() || t('settings.recycle.display_unknown');
+ const detail = String(item?.detail || '').trim();
+ if (!detail) return title;
+ return t('settings.recycle.display_with_detail')
+ .replace('{title}', title)
+ .replace('{detail}', detail);
+}
+
+function _settingsRecycleDetailsHtml(batch) {
+ const rows = [];
+ const seen = new Set();
+ for (const item of _settingsRecycleDisplayItems(batch)) {
+ const title = _settingsRecycleItemTitle(item);
+ const category = _settingsRecycleCategoryLabel(item?.category);
+ const pathValue = String(item?.path || '').replace(/^cloud\//, '');
+ const key = `${category}\n${title}\n${pathValue}`;
+ if (seen.has(key)) continue;
+ seen.add(key);
+ rows.push({ category, title, path: pathValue });
+ }
+ if (!rows.length) {
+ for (const item of Array.isArray(batch?.items) ? batch.items : []) {
+ const pathValue = String(item?.path || '').replace(/^cloud\//, '');
+ if (!pathValue || seen.has(pathValue)) continue;
+ seen.add(pathValue);
+ rows.push({
+ category: _settingsRecycleCategoryLabel('file'),
+ title: _settingsRecyclePathTitle(pathValue),
+ path: pathValue,
+ });
+ }
+ }
+ if (!rows.length) return '';
+ return `
+ <div class="settings-recycle-details">
+ ${rows.map((row) => `
+ <div class="settings-recycle-detail-row">
+ <span class="settings-recycle-detail-category">${escapeHtml(row.category)}</span>
+ <span class="settings-recycle-detail-title">${escapeHtml(row.title)}</span>
+ ${row.path ? `<span class="settings-recycle-detail-path" title="${escapeHtml(row.path)}">${escapeHtml(row.path)}</span>` : ''}
+ </div>
+ `).join('')}
+ </div>
+ `;
}
function _settingsRecycleRowHtml(batch) {
const id = escapeHtml(String(batch?.id || ''));
const title = escapeHtml(_settingsRecycleTitle(batch));
const timestamp = Number(batch?.created_at_ms) || 0;
- const deletedAt = timestamp ? new Date(timestamp).toLocaleString() : '';
+ const date = timestamp ? new Date(timestamp).toLocaleString() : '';
+ const deletedAt = t('settings.recycle.deleted_at').replace('{date}', date);
+ const expanded = _settingsRecycleExpandedIds.has(String(batch?.id || ''));
return `
- <div class="settings-recycle-row">
+ <div class="settings-recycle-row${expanded ? ' is-expanded' : ''}">
<div class="settings-recycle-row-head">
<div class="settings-recycle-main">
<div class="settings-recycle-name">${title}</div>
<div class="settings-recycle-meta">${escapeHtml(deletedAt)}</div>
</div>
<div class="settings-recycle-actions">
+ <button class="btn btn-sm" type="button" data-recycle-view="${id}" aria-expanded="${expanded ? 'true' : 'false'}">${escapeHtml(t(expanded ? 'settings.recycle.collapse' : 'settings.recycle.view'))}</button>
<button class="btn btn-sm" type="button" data-recycle-restore="${id}">${escapeHtml(t('settings.recycle.restore'))}</button>
<button class="btn btn-sm btn-danger" type="button" data-recycle-delete="${id}">${escapeHtml(t('settings.recycle.delete'))}</button>
</div>
</div>
+ ${expanded ? _settingsRecycleDetailsHtml(batch) : ''}
</div>
`;
}
+function _settingsRecycleSourceGroups(batches) {
+ return _SETTINGS_RECYCLE_SOURCE_CONFIG.map((config) => ({
+ ...config,
+ items: batches.filter((batch) => (
+ config.source === 'app' ? batch?.source === 'app' : batch?.source !== 'app'
+ )),
+ }));
+}
+
async function _settingsRefreshRecycleBin() {
const body = document.getElementById('settings-recycle-body');
if (!body || !_settingsRecycleAvailable()) return;
try {
const res = await window.orkas.recycleBin.list();
const batches = Array.isArray(res?.batches) ? res.batches : [];
- body.innerHTML = batches.length
- ? batches.map(_settingsRecycleRowHtml).join('')
- : `<div class="settings-empty">${escapeHtml(t('settings.recycle.empty'))}</div>`;
+ const groups = _settingsRecycleSourceGroups(batches);
+ let selectedGroup = groups.find((group) => group.source === _settingsRecycleActiveSource) || groups[0];
+ if (!_settingsRecycleSourceTouched && selectedGroup.items.length === 0) {
+ const firstNonEmpty = groups.find((group) => group.items.length > 0);
+ if (firstNonEmpty) {
+ _settingsRecycleActiveSource = firstNonEmpty.source;
+ selectedGroup = firstNonEmpty;
+ }
+ }
+ const tabsHtml = groups.map((group) => {
+ const active = group.source === selectedGroup.source;
+ return `
+ <button
+ class="settings-recycle-tab${active ? ' is-active' : ''}"
+ type="button"
+ role="tab"
+ aria-selected="${active ? 'true' : 'false'}"
+ tabindex="${active ? '0' : '-1'}"
+ data-recycle-tab="${escapeHtml(group.source)}"
+ >
+ <span>${escapeHtml(t(group.tabKey))}</span>
+ <span class="settings-recycle-tab-count">${escapeHtml(String(group.items.length))}</span>
+ </button>
+ `;
+ }).join('');
+ const rowsHtml = selectedGroup.items.length
+ ? selectedGroup.items.map(_settingsRecycleRowHtml).join('')
+ : `<div class="settings-empty">${escapeHtml(t(selectedGroup.emptyKey))}</div>`;
+ body.innerHTML = `
+ <div class="settings-recycle-tabs" role="tablist" aria-label="${escapeHtml(t('settings.recycle.tabs_aria'))}">
+ ${tabsHtml}
+ </div>
+ <div class="settings-recycle-scroll" role="tabpanel" data-recycle-source="${escapeHtml(selectedGroup.source)}">
+ ${rowsHtml}
+ </div>
+ `;
} catch (err) {
_settingsLog.warn('recycle bin refresh failed', {
error: (err && err.message) || String(err),
@@ -440,6 +643,24 @@ function _settingsBindRecycleBinOnce() {
if (!body) return;
_settingsState.recycleBound = true;
body.addEventListener('click', async (event) => {
+ const tab = event.target?.closest?.('[data-recycle-tab]');
+ if (tab) {
+ const source = tab.getAttribute('data-recycle-tab') || '';
+ if (!_SETTINGS_RECYCLE_SOURCE_CONFIG.some((config) => config.source === source)) return;
+ _settingsRecycleActiveSource = source;
+ _settingsRecycleSourceTouched = true;
+ await _settingsRefreshRecycleBin();
+ return;
+ }
+ const viewButton = event.target?.closest?.('[data-recycle-view]');
+ if (viewButton) {
+ const id = viewButton.getAttribute('data-recycle-view') || '';
+ if (!id) return;
+ if (_settingsRecycleExpandedIds.has(id)) _settingsRecycleExpandedIds.delete(id);
+ else _settingsRecycleExpandedIds.add(id);
+ await _settingsRefreshRecycleBin();
+ return;
+ }
const button = event.target?.closest?.('[data-recycle-restore], [data-recycle-delete]');
if (!button || !_settingsRecycleAvailable()) return;
const deleting = button.hasAttribute('data-recycle-delete');
@@ -461,6 +682,7 @@ function _settingsBindRecycleBinOnce() {
if (deleting) {
const res = await window.orkas.recycleBin.delete(id);
if (!res?.deleted) throw new Error(t('settings.recycle.delete_not_found'));
+ _settingsRecycleExpandedIds.delete(id);
} else {
await window.orkas.recycleBin.restore(id);
if (typeof loadProjects === 'function') await loadProjects(true);
diff --git a/src/renderer/style.css b/src/renderer/style.css
index 4251852e..a4602c4b 100644
--- a/src/renderer/style.css
+++ b/src/renderer/style.css
@@ -12751,75 +12751,8 @@ body.model-not-configured .main-content { flex-direction: column; }
max-height: min(320px, 42vh);
min-height: 72px;
overflow-y: auto;
- padding-right: 4px;
- display: flex;
- flex-direction: column;
- gap: 8px;
-}
-.settings-recycle-section {
- display: flex;
- flex-direction: column;
- gap: 8px;
-}
-.settings-recycle-section-title {
- font-size: 12px;
- font-weight: 600;
- color: var(--muted);
-}
-.settings-recycle-body {
- display: flex;
- flex-direction: column;
- gap: 10px;
-}
-.settings-recycle-tabs {
- display: flex;
- gap: 18px;
- border-bottom: 1px solid var(--border);
-}
-.settings-recycle-tab {
- min-width: 0;
- border: none;
- border-bottom: 2px solid transparent;
- background: transparent;
- color: var(--text-2);
- font-family: inherit;
- font-size: 12.5px;
- font-weight: 500;
- padding: 7px 2px 9px;
- margin-bottom: -1px;
- display: inline-flex;
- align-items: center;
- gap: 6px;
- cursor: pointer;
-}
-.settings-recycle-tab:hover {
- color: var(--text);
-}
-.settings-recycle-tab.is-active {
- color: var(--text);
- border-bottom-color: var(--primary);
- font-weight: 600;
-}
-.settings-recycle-tab-count {
- min-width: 18px;
- height: 18px;
- border-radius: 99px;
- padding: 0 6px;
- background: var(--surface-2);
- color: var(--muted);
- font-family: var(--font-mono);
- font-size: 11px;
- line-height: 18px;
- text-align: center;
-}
-.settings-recycle-tab.is-active .settings-recycle-tab-count {
- background: var(--primary-soft);
- color: var(--primary-text);
-}
-.settings-recycle-scroll {
- max-height: min(320px, 42vh);
- min-height: 72px;
- overflow-y: auto;
+ overscroll-behavior: contain;
+ scrollbar-gutter: stable;
padding-right: 4px;
display: flex;
flex-direction: column;
@@ -12870,6 +12803,10 @@ body.model-not-configured .main-content { flex-direction: column; }
font-weight: 500;
color: var(--text);
line-height: 1.4;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
overflow-wrap: anywhere;
}
.settings-recycle-meta,
diff --git a/test/e2e/settings_e2e_modules.spec.ts b/test/e2e/settings_e2e_modules.spec.ts
index ad9322b8..9bc55208 100644
--- a/test/e2e/settings_e2e_modules.spec.ts
+++ b/test/e2e/settings_e2e_modules.spec.ts
@@ -14,6 +14,15 @@ test.describe('settings modules and model guard', () => {
await expect(appPage.locator('#settings-data-root-btn')).toBeVisible();
await expect(appPage.locator('#settings-recycle-group')).toBeVisible();
await expect(appPage.locator('#settings-recycle-body')).toBeVisible();
+ const recycleViewport = appPage.locator('#settings-recycle-body .settings-recycle-scroll');
+ await expect(recycleViewport).toBeVisible();
+ const recycleLayout = await recycleViewport.evaluate((element) => {
+ const style = getComputedStyle(element);
+ return { overflowY: style.overflowY, maxHeight: Number.parseFloat(style.maxHeight) };
+ });
+ expect(recycleLayout.overflowY).toBe('auto');
+ expect(recycleLayout.maxHeight).toBeGreaterThan(0);
+ expect(recycleLayout.maxHeight).toBeLessThanOrEqual(320);
await openSettingsTab(appPage, 'credentials');
await expect(appPage.locator('#settings-add-entry-btn')).toBeVisible();
diff --git a/test/renderer/settings-recycle.test.ts b/test/renderer/settings-recycle.test.ts
new file mode 100644
index 00000000..51fcd692
--- /dev/null
+++ b/test/renderer/settings-recycle.test.ts
@@ -0,0 +1,147 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import vm from 'node:vm';
+import { describe, expect, it, vi } from 'vitest';
+
+const settingsSource = readFileSync(
+ resolve(__dirname, '../../src/renderer/modules/settings.js'),
+ 'utf8',
+);
+const styleSource = readFileSync(resolve(__dirname, '../../src/renderer/style.css'), 'utf8');
+
+const translations: Record<string, string> = {
+ 'settings.recycle.tab_cloud': '历史',
+ 'settings.recycle.tab_local': '本地',
+ 'settings.recycle.tabs_aria': '删除记录来源',
+ 'settings.recycle.empty_cloud': '暂无历史删除记录',
+ 'settings.recycle.empty_local': '暂无本地删除记录',
+ 'settings.recycle.deleted_at': '{date}',
+ 'settings.recycle.view': '查看',
+ 'settings.recycle.collapse': '收起',
+ 'settings.recycle.restore': '恢复',
+ 'settings.recycle.delete': '删除',
+ 'settings.recycle.display_group': '{type}:{items}',
+ 'settings.recycle.display_group_joiner': ';',
+ 'settings.recycle.display_with_detail': '{title}({detail})',
+ 'settings.recycle.display_conversation': '任务',
+ 'settings.recycle.display_file': '文件',
+ 'settings.recycle.display_other': '其他',
+ 'settings.recycle.display_unknown': '已删除项目',
+};
+
+function escapeHtml(value: unknown): string {
+ return String(value ?? '')
+ .replaceAll('&', '&amp;')
+ .replaceAll('<', '&lt;')
+ .replaceAll('>', '&gt;')
+ .replaceAll('"', '&quot;')
+ .replaceAll("'", '&#39;');
+}
+
+function loadHarness(batches: Array<Record<string, unknown>>) {
+ let clickListener: ((event: any) => Promise<void>) | undefined;
+ const body: any = {
+ innerHTML: '',
+ addEventListener(type: string, listener: (event: any) => Promise<void>) {
+ if (type === 'click') clickListener = listener;
+ },
+ };
+ const recycleBin = {
+ list: vi.fn(async () => ({ ok: true, batches })),
+ restore: vi.fn(async () => ({ ok: true, restored: 1 })),
+ delete: vi.fn(async () => ({ ok: true, deleted: true })),
+ };
+ const sandbox: any = {
+ console,
+ createLogger: () => ({ info: vi.fn(), warn: vi.fn(), error: vi.fn() }),
+ t: (key: string) => translations[key] || key,
+ escapeHtml,
+ getLang: () => 'zh',
+ document: {
+ documentElement: { lang: 'zh' },
+ getElementById: (id: string) => (id === 'settings-recycle-body' ? body : null),
+ querySelectorAll: () => [],
+ },
+ window: {
+ addEventListener: vi.fn(),
+ orkas: { recycleBin, invoke: vi.fn() },
+ },
+ setTimeout,
+ clearTimeout,
+ setInterval,
+ clearInterval,
+ URL,
+ };
+ vm.runInNewContext(settingsSource, sandbox, { filename: 'settings.js' });
+ return { sandbox, body, recycleBin, getClickListener: () => clickListener };
+}
+
+describe('Settings recycle bin', () => {
+ const repeatedTitle = '@ContentWriter 最近关于模型即应用';
+ const batch = {
+ id: 'batch-1',
+ source: 'app',
+ created_at_ms: Date.UTC(2026, 7, 23, 9, 22, 53),
+ display_title: `${repeatedTitle};${repeatedTitle};${repeatedTitle}`,
+ display_items: [
+ { category: 'conversation', id: 'gconv-a', title: repeatedTitle, path: 'cloud/chats/gconv-a/chat.jsonl' },
+ { category: 'conversation', id: 'gconv-a', title: repeatedTitle, path: 'cloud/sessions/gconv-a.jsonl' },
+ { category: 'conversation', id: 'gconv-a', title: repeatedTitle, path: 'cloud/sessions/gconv-a.tool-results' },
+ { category: 'conversation', id: 'gconv-b', title: '第二个任务', path: 'cloud/chats/gconv-b/chat.jsonl' },
+ { category: 'conversation', id: 'gconv-c', title: '第三个任务', path: 'cloud/chats/gconv-c/chat.jsonl' },
+ { category: 'conversation', id: 'gconv-d', title: '第四个任务', path: 'cloud/chats/gconv-d/chat.jsonl' },
+ { category: 'conversation', id: 'gconv-e', title: '第五个任务', path: 'cloud/chats/gconv-e/chat.jsonl' },
+ ],
+ };
+
+ it('renders batches inside the bounded scrolling viewport', async () => {
+ const { sandbox, body } = loadHarness([batch]);
+
+ await sandbox._settingsRefreshRecycleBin();
+
+ expect(body.innerHTML).toContain('class="settings-recycle-scroll"');
+ expect(body.innerHTML).toContain('data-recycle-source="app"');
+ expect(body.innerHTML).toContain('data-recycle-tab="cloud_sync"');
+ expect(body.innerHTML).toContain('data-recycle-tab="app"');
+ });
+
+ it('uses structured display items, removes duplicate titles, and bounds the summary', async () => {
+ const { sandbox, body } = loadHarness([batch]);
+
+ await sandbox._settingsRefreshRecycleBin();
+
+ const titleMatches = body.innerHTML.match(new RegExp(repeatedTitle, 'g')) || [];
+ expect(titleMatches).toHaveLength(1);
+ expect(body.innerHTML).not.toContain(batch.display_title);
+ expect(body.innerHTML).toContain('任务:');
+ expect(body.innerHTML).toContain('+2');
+ });
+
+ it('keeps the compact summary by default and exposes deduplicated details on demand', async () => {
+ const { sandbox, body, getClickListener } = loadHarness([batch]);
+ sandbox._settingsBindRecycleBinOnce();
+ await sandbox._settingsRefreshRecycleBin();
+ expect(body.innerHTML).not.toContain('settings-recycle-details');
+
+ const viewButton = {
+ getAttribute: (name: string) => (name === 'data-recycle-view' ? 'batch-1' : ''),
+ };
+ await getClickListener()!({
+ target: {
+ closest(selector: string) {
+ return selector === '[data-recycle-view]' ? viewButton : null;
+ },
+ },
+ });
+
+ expect(body.innerHTML).toContain('settings-recycle-details');
+ expect(body.innerHTML).toContain('chats/gconv-a/chat.jsonl');
+ expect(body.innerHTML).toContain('aria-expanded="true"');
+ });
+
+ it('defines one bounded scroll rule and clamps row summaries to two lines', () => {
+ expect(styleSource.match(/\.settings-recycle-body\s*\{/g)).toHaveLength(1);
+ expect(styleSource).toMatch(/\.settings-recycle-scroll\s*\{[^}]*max-height:\s*min\(320px, 42vh\)[^}]*overflow-y:\s*auto/s);
+ expect(styleSource).toMatch(/\.settings-recycle-name\s*\{[^}]*-webkit-line-clamp:\s*2[^}]*overflow:\s*hidden/s);
+ });
+});