From 972eb5dc9311da022676124f254b824a6227988c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 16 Apr 2026 23:04:50 -0400 Subject: [PATCH] feat(desktop-shell-menu): allow DevTools toggle via AGENTCOMPANY_ENABLE_DEVTOOLS --- src/main/database/runs.ts | 4 ++-- src/main/database/snapshot.ts | 8 +++----- src/main/desktop-shell-menu.ts | 7 ++++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/database/runs.ts b/src/main/database/runs.ts index 6a1a6986..382bee02 100644 --- a/src/main/database/runs.ts +++ b/src/main/database/runs.ts @@ -128,13 +128,13 @@ export function buildRunMethods( } }, - markRunStatus(runId: string, status: RunRecord["status"], message: string) { + markRunStatus(runId: string, status: RunRecord["status"], message: string | null) { const ts = nowIso(); const startedAt = status === "running" ? ts : null; transaction(() => { getDb() .prepare( - "update runs set status = ?, summary = case when ? != '' then ? else summary end, started_at = coalesce(started_at, ?), updated_at = ? where id = ?", + "update runs set status = ?, summary = case when ? is not null then ? else summary end, started_at = coalesce(started_at, ?), updated_at = ? where id = ?", ) .run(status, message, message, startedAt, ts, runId); diff --git a/src/main/database/snapshot.ts b/src/main/database/snapshot.ts index 753885ab..6d06e662 100644 --- a/src/main/database/snapshot.ts +++ b/src/main/database/snapshot.ts @@ -186,11 +186,9 @@ export function buildSnapshotMethods( listRendererSnapshot(): ProfileSnapshot { const currentCompanyId = deps.getCurrentCompanyId(); - if (!currentCompanyId) { - return listSnapshot(); - } - const snapshot = listSnapshot({ companyId: currentCompanyId }); - return snapshot; + return currentCompanyId + ? listSnapshot({ companyId: currentCompanyId }) + : listSnapshot(); }, }; } diff --git a/src/main/desktop-shell-menu.ts b/src/main/desktop-shell-menu.ts index 9e4de115..48d1ffdc 100644 --- a/src/main/desktop-shell-menu.ts +++ b/src/main/desktop-shell-menu.ts @@ -121,7 +121,12 @@ export function createDesktopShellMenu(deps: DesktopShellMenuDependencies) { click: () => onShortcut("refresh"), }, { type: "separator" }, - { role: "toggleDevTools", visible: isDev }, + { + role: "toggleDevTools", + // Hidden in packaged builds unless opted in via env var so power + // users can still inspect rendered state without a dev build. + visible: isDev || process.env.AGENTCOMPANY_ENABLE_DEVTOOLS === "true", + }, ], }, {