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.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Keep notification permission recovery beside its setting
wyt258e359c21f4
diff --git a/src/renderer/index.html b/src/renderer/index.htmlindex bb673693..9352c15c 100644--- a/src/renderer/index.html+++ b/src/renderer/index.html@@ -1216,6 +1216,10 @@<input type="checkbox" id="settings-task-notifications-toggle" checked aria-labelledby="settings-task-notifications-title" /></label></div>+ <div class="settings-row settings-task-notification-permission" id="settings-task-notification-permission" role="status" aria-live="polite" hidden>+ <span class="settings-task-notification-permission-text" id="settings-task-notification-permission-text" data-i18n="settings.task_notifications.permission_disabled">系统已关闭 Orkas 的通知权限。请前往系统设置开启,否则无法收到任务进度提醒。</span>+ <button type="button" class="btn btn-sm" id="settings-task-notification-open-settings" data-i18n="settings.task_notifications.open_settings">打开系统设置</button>+ </div><div class="settings-row"><div class="settings-row-copy"><div class="settings-row-title" id="settings-operator-title" data-i18n="quality.operator.title">Custom validation</div>@@ -1226,10 +1230,6 @@<button class="btn btn-sm" id="settings-operator-reload" data-i18n="quality.operator.reload">Reload</button><label class="toggle-switch settings-switch"><input type="checkbox" id="settings-operator-toggle" aria-labelledby="settings-operator-title" /></label></div>- <div class="settings-row settings-task-notification-permission" id="settings-task-notification-permission" role="status" aria-live="polite" hidden>- <span class="settings-task-notification-permission-text" id="settings-task-notification-permission-text" data-i18n="settings.task_notifications.permission_disabled">系统已关闭 Orkas 的通知权限。请前往系统设置开启,否则无法收到任务进度提醒。</span>- <button type="button" class="btn btn-sm" id="settings-task-notification-open-settings" data-i18n="settings.task_notifications.open_settings">打开系统设置</button>- </div></div></section>diff --git a/src/renderer/style.css b/src/renderer/style.cssindex 798cce42..d97789dd 100644--- a/src/renderer/style.css+++ b/src/renderer/style.css@@ -14896,11 +14896,12 @@ body.is-task-side-panel-resizing * { cursor: col-resize !important; }.settings-task-notification-permission {align-items: center;- justify-content: space-between;gap: 12px;+ margin: 0 12px 12px;padding: 10px 12px;+ min-height: 0;border: 1px solid rgba(220, 38, 38, 0.24);- border-radius: var(--radius-sm);+ border-radius: 10px;background: rgba(220, 38, 38, 0.07);}.settings-task-notification-permission-text {@@ -19035,6 +19036,7 @@ html[dir="rtl"] .sidebar-search-label { text-align: start; }.settings-sheet > .settings-row:not([hidden]) ~ .settings-row { border-top: 1px solid var(--border); }+.settings-sheet > .settings-row:not([hidden]) ~ .settings-task-notification-permission { border-top: 1px solid rgba(220, 38, 38, 0.24); }.settings-row > .btn,.settings-row > .toggle-switch { flex: 0 0 auto; }.settings-sheet#settings-recycle-body { padding: 12px 18px 14px; }@@ -19042,12 +19044,6 @@ html[dir="rtl"] .sidebar-search-label { text-align: start; }.settings-mode-opt { padding: 8px 10px; border-radius: 8px; transition: background .12s; }.settings-mode-opt input[type="radio"] { accent-color: var(--primary); }.settings-mode-label { font-weight: 500; }-.settings-task-notification-permission {- margin: 0 12px 12px;- padding: 10px 12px;- min-height: 0;- border-radius: 10px;-}.settings-form-row > .ai-select,.settings-form-row > .form-input { width: 100%; }.settings-form-status:empty,diff --git a/test/e2e/settings_e2e_persistence.spec.ts b/test/e2e/settings_e2e_persistence.spec.tsindex 6a4a56b7..b23df4bc 100644--- a/test/e2e/settings_e2e_persistence.spec.ts+++ b/test/e2e/settings_e2e_persistence.spec.ts@@ -1,6 +1,17 @@import type { Page } from '@playwright/test';import { expect, test } from './fixtures/orkas';+// Classic-script globals are available in the renderer's main world. These+// declarations let presentation cases control OS state without changing the+// machine's notification settings or opening System Settings.+declare const _settingsState: {+ taskNotifications: {+ enabled: boolean;+ permission: { state: string; can_open_settings: boolean };+ };+};+declare function _settingsRenderTaskNotifications(): void;+async function openGeneralSettings(page: Page): Promise<void> {await page.locator('#settings-btn').click();await expect(page.locator('#panel-settings')).toHaveClass(/\bactive\b/);@@ -12,6 +23,72 @@ async function openGeneralSettings(page: Page): Promise<void> {test.describe('settings persistence', () => {+ for (const [language, width] of [['en', 1280], ['zh', 620]] as const) {+ test.describe(`notification permission recovery ${language}`, () => {+ test(`keeps the warning with task notifications at ${width}px`, async ({ appPage }, testInfo) => {+ await appPage.setViewportSize({ width, height: 900 });+ await openGeneralSettings(appPage);+ await appPage.evaluate(async language => { await (window as any).setLang(language); }, language);+ await expect(appPage.locator('html')).toHaveAttribute('lang', language === 'zh' ? 'zh-CN' : 'en');+ const toggle = appPage.locator('#settings-task-notifications-toggle');+ await expect(toggle).toBeEnabled();+ const warning = appPage.locator('#settings-task-notification-permission');+ const openSettings = appPage.locator('#settings-task-notification-open-settings');+ const validation = appPage.locator('#settings-operator-title');+ const render = async (state: string, enabled = true) => {+ await appPage.evaluate(({ state, enabled }) => {+ _settingsState.taskNotifications = {+ enabled, permission: { state, can_open_settings: true },+ };+ _settingsRenderTaskNotifications();+ }, { state, enabled });+ };++ await render('denied');+ await expect(warning).toBeVisible();+ await expect(openSettings).toBeVisible();+ await expect(toggle).toBeChecked();+ const layout = await warning.evaluate(element => {+ const previous = element.previousElementSibling!;+ const sheet = element.parentElement!;+ const style = getComputedStyle(element);+ return {+ followsNotifications: !!previous.querySelector('#settings-task-notifications-toggle'),+ borderTop: style.borderTopColor,+ borderLeft: style.borderLeftColor,+ borderWidth: style.borderTopWidth,+ fitsSheet: element.getBoundingClientRect().right <= sheet.getBoundingClientRect().right,+ noOverflow: sheet.scrollWidth <= sheet.clientWidth + 1,+ };+ });+ expect.soft(layout.followsNotifications).toBe(true);+ expect.soft(layout.borderTop).toBe(layout.borderLeft);+ expect(layout.borderWidth).toBe('1px');+ expect(layout.fitsSheet).toBe(true);+ expect(layout.noOverflow).toBe(true);+ const warningBox = (await warning.boundingBox())!;+ const validationBox = (await validation.boundingBox())!;+ expect.soft(warningBox.y + warningBox.height).toBeLessThanOrEqual(validationBox.y);+ await openSettings.focus();+ await expect(openSettings).toBeFocused();+ await warning.locator('..').screenshot({ path: testInfo.outputPath(`notification-recovery-${language}-${width}.png`) });++ for (const state of ['granted', 'not_determined', 'unknown']) {+ await render(state);+ await expect(warning).toBeHidden();+ }+ await render('denied', false);+ await expect(warning).toBeHidden();+ await expect(toggle).not.toBeChecked();+ await render('presentation_disabled');+ await expect(warning).toBeVisible();+ await expect(appPage.locator('#settings-task-notification-permission-text'))+ .toHaveAttribute('data-i18n', 'settings.task_notifications.presentation_disabled');+ await expect(validation).toBeVisible();+ });+ });+ }+test('switches tabs immediately while settings loads and preserves the choice after repeated loads', async ({ orkas }) => {const page = orkas.page!;await page.evaluate(() => {