Files
AgentCompany/src/main/app-lifecycle-service.ts
T
ZacharyZhang-NYandClaude Opus 4.6 d52985f61e feat: deliverable review gate, app lifecycle fixes, CI/CD pipeline
- Add deliverable review gate: pause workflow when agents produce important
  documents (PRDs, design docs, etc.) for human review before continuing
- Add company-level reviewDeliverables setting with onboarding card selector
- Block agent heartbeats when deliverable review is pending (agent + CEO)
- Trigger review at document creation time in API server for reliability
- Fix autoApproveHires vs reviewDeliverables conflict in approval-policy
- Fix app quit: force-exit on all platforms (macOS Dock, Windows tray, Linux)
- Add multi-platform CI/CD pipeline (macOS arm64/x64, Windows x64/arm64,
  Linux x64/arm64 with deb/AppImage/rpm/snap) with code signing support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 23:31:48 -04:00

63 lines
1.5 KiB
TypeScript

import { app } from "electron";
interface AppLifecycleDependencies {
getMainWindow: () => Electron.BrowserWindow | null;
ensureWindow: () => Promise<Electron.BrowserWindow | null>;
shouldQuit: () => boolean;
onBeforeQuit: () => void;
}
export function createAppLifecycleService({
getMainWindow,
ensureWindow,
shouldQuit,
onBeforeQuit,
}: AppLifecycleDependencies) {
function register(hasSingleInstanceLock: boolean) {
app.on("activate", async () => {
const mainWindow = getMainWindow();
if (mainWindow && !mainWindow.isDestroyed()) {
if (!mainWindow.isVisible()) {
mainWindow.show();
}
mainWindow.focus();
return;
}
await ensureWindow();
});
app.on("second-instance", () => {
if (!hasSingleInstanceLock) {
return;
}
const mainWindow = getMainWindow();
if (!mainWindow) {
return;
}
if (!mainWindow.isVisible()) {
mainWindow.show();
}
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();
});
app.on("window-all-closed", () => {
// On macOS, keep the app running when all windows are closed (standard behavior)
// UNLESS the user explicitly chose Quit (before-quit already fired).
if (process.platform !== "darwin" || shouldQuit()) {
app.quit();
}
});
app.on("before-quit", () => {
onBeforeQuit();
});
}
return {
register,
};
}