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: keep open recycle bin local

wyt83a769f583b7
diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.json
index cfd73ee6..4b5f0e77 100644
--- a/src/renderer/locales/en.json
+++ b/src/renderer/locales/en.json
@@ -1273,13 +1273,6 @@
"memory.copied_inline": "Copied",
"memory.copy_failed": "Copy failed",
"memory.export_foot": "",
- "settings.recycle.source_cloud_sync": "Local deletion",
- "settings.recycle.source_app": "Deleted on this device",
- "settings.recycle.tab_cloud": "History",
- "settings.recycle.tab_local": "Local",
- "settings.recycle.tabs_aria": "Deletion record source",
- "settings.recycle.empty_cloud": "No historical deletion records",
- "settings.recycle.empty_local": "No local deletion records",
"settings.recycle.deleted_at": "{date}",
"settings.recycle.view": "View",
"settings.recycle.collapse": "Collapse",
diff --git a/src/renderer/locales/ja.json b/src/renderer/locales/ja.json
index 3d434c09..c91ed818 100644
--- a/src/renderer/locales/ja.json
+++ b/src/renderer/locales/ja.json
@@ -1270,13 +1270,6 @@
"memory.copied_inline": "コピーしました",
"memory.copy_failed": "コピーに失敗",
"memory.export_foot": "",
- "settings.recycle.source_cloud_sync": "この端末での削除",
- "settings.recycle.source_app": "この端末での削除",
- "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": "閉じる",
diff --git a/src/renderer/locales/pt.json b/src/renderer/locales/pt.json
index 80f672cf..71db592a 100644
--- a/src/renderer/locales/pt.json
+++ b/src/renderer/locales/pt.json
@@ -1266,13 +1266,6 @@
"memory.reveal_file": "Abrir pasta do arquivo",
"memory.copied_inline": "Copiado",
"memory.copy_failed": "Falha na cópia",
- "settings.recycle.source_cloud_sync": "Exclusão local",
- "settings.recycle.source_app": "Excluído neste dispositivo",
- "settings.recycle.tab_cloud": "Histórico",
- "settings.recycle.tab_local": "Locais",
- "settings.recycle.tabs_aria": "Fonte de registro de exclusão",
- "settings.recycle.empty_cloud": "Nenhum registro histórico de exclusão",
- "settings.recycle.empty_local": "Nenhum registro de exclusão local",
"settings.recycle.deleted_at": "{date}",
"settings.recycle.view": "Ver",
"settings.recycle.collapse": "Recolher",
diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.json
index da06bf7a..a7333aa0 100644
--- a/src/renderer/locales/zh.json
+++ b/src/renderer/locales/zh.json
@@ -1273,13 +1273,6 @@
"memory.copied_inline": "已复制",
"memory.copy_failed": "复制失败",
"memory.export_foot": "",
- "settings.recycle.source_cloud_sync": "本机删除",
- "settings.recycle.source_app": "本设备删除",
- "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": "收起",
diff --git a/src/renderer/modules/settings.js b/src/renderer/modules/settings.js
index 56a88f10..9a63f254 100644
--- a/src/renderer/modules/settings.js
+++ b/src/renderer/modules/settings.js
@@ -381,21 +381,7 @@ 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, '');
@@ -578,54 +564,20 @@ function _settingsRecycleRowHtml(batch) {
`;
}
-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 : [];
- 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>`;
+ // This build does not create remote-deletion batches. Keep older batches
+ // readable, but present every snapshot through one local recycle-bin
+ // surface instead of exposing the hosted product's source split.
+ const rowsHtml = batches.length
+ ? batches.map(_settingsRecycleRowHtml).join('')
+ : `<div class="settings-empty">${escapeHtml(t('settings.recycle.empty'))}</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)}">
+ <div class="settings-recycle-scroll" data-recycle-source="local">
${rowsHtml}
</div>
`;
@@ -643,15 +595,6 @@ 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') || '';
diff --git a/src/renderer/style.css b/src/renderer/style.css
index a4602c4b..bf253f0c 100644
--- a/src/renderer/style.css
+++ b/src/renderer/style.css
@@ -12702,51 +12702,6 @@ body.model-not-configured .main-content { flex-direction: column; }
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;
@@ -12758,16 +12713,6 @@ body.model-not-configured .main-content { flex-direction: column; }
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-row {
display: flex;
flex-direction: column;
diff --git a/test/e2e/settings_e2e_modules.spec.ts b/test/e2e/settings_e2e_modules.spec.ts
index 9bc55208..7657b410 100644
--- a/test/e2e/settings_e2e_modules.spec.ts
+++ b/test/e2e/settings_e2e_modules.spec.ts
@@ -16,6 +16,8 @@ test.describe('settings modules and model guard', () => {
await expect(appPage.locator('#settings-recycle-body')).toBeVisible();
const recycleViewport = appPage.locator('#settings-recycle-body .settings-recycle-scroll');
await expect(recycleViewport).toBeVisible();
+ await expect(recycleViewport).toHaveAttribute('data-recycle-source', 'local');
+ await expect(appPage.locator('#settings-recycle-body [data-recycle-tab]')).toHaveCount(0);
const recycleLayout = await recycleViewport.evaluate((element) => {
const style = getComputedStyle(element);
return { overflowY: style.overflowY, maxHeight: Number.parseFloat(style.maxHeight) };
diff --git a/test/renderer/settings-recycle.test.ts b/test/renderer/settings-recycle.test.ts
index 51fcd692..ebcfa873 100644
--- a/test/renderer/settings-recycle.test.ts
+++ b/test/renderer/settings-recycle.test.ts
@@ -10,11 +10,7 @@ const settingsSource = readFileSync(
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.empty': '暂无可恢复数据',
'settings.recycle.deleted_at': '{date}',
'settings.recycle.view': '查看',
'settings.recycle.collapse': '收起',
@@ -100,9 +96,26 @@ describe('Settings recycle bin', () => {
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"');
+ expect(body.innerHTML).toContain('data-recycle-source="local"');
+ expect(body.innerHTML).not.toContain('data-recycle-tab=');
+ });
+
+ it('combines legacy sync and local batches into one local list', async () => {
+ const legacyBatch = {
+ ...batch,
+ id: 'batch-legacy',
+ source: 'cloud_sync',
+ display_items: [
+ { category: 'conversation', id: 'gconv-legacy', title: '旧删除任务', path: 'cloud/chats/gconv-legacy.jsonl' },
+ ],
+ };
+ const { sandbox, body } = loadHarness([legacyBatch, batch]);
+
+ await sandbox._settingsRefreshRecycleBin();
+
+ expect(body.innerHTML).toContain('旧删除任务');
+ expect(body.innerHTML).toContain(repeatedTitle);
+ expect(body.innerHTML).not.toContain('data-recycle-tab=');
});
it('uses structured display items, removes duplicate titles, and bounds the summary', async () => {