Backup before continuing from Codex 5.2 session - User storage, compaction suggestions, streaming improvements
This commit is contained in:
@@ -5,6 +5,7 @@ import { fileURLToPath } from "url"
|
||||
import { createApplicationMenu } from "./menu"
|
||||
import { setupCliIPC } from "./ipc"
|
||||
import { CliProcessManager } from "./process-manager"
|
||||
import { ensureDefaultUsers, getActiveUser, getUserDataRoot, clearGuestUsers } from "./user-store"
|
||||
|
||||
const mainFilename = fileURLToPath(import.meta.url)
|
||||
const mainDirname = dirname(mainFilename)
|
||||
@@ -225,6 +226,24 @@ function getPreloadPath() {
|
||||
return join(mainDirname, "../preload/index.js")
|
||||
}
|
||||
|
||||
function applyUserEnvToCli() {
|
||||
const active = getActiveUser()
|
||||
if (!active) {
|
||||
const fallback = ensureDefaultUsers()
|
||||
const fallbackRoot = getUserDataRoot(fallback.id)
|
||||
cliManager.setUserEnv({
|
||||
CODENOMAD_USER_DIR: fallbackRoot,
|
||||
CLI_CONFIG: join(fallbackRoot, "config.json"),
|
||||
})
|
||||
return
|
||||
}
|
||||
const root = getUserDataRoot(active.id)
|
||||
cliManager.setUserEnv({
|
||||
CODENOMAD_USER_DIR: root,
|
||||
CLI_CONFIG: join(root, "config.json"),
|
||||
})
|
||||
}
|
||||
|
||||
function destroyPreloadingView(target?: BrowserView | null) {
|
||||
const view = target ?? preloadingView
|
||||
if (!view) {
|
||||
@@ -274,7 +293,7 @@ function createWindow() {
|
||||
currentCliUrl = null
|
||||
loadLoadingScreen(mainWindow)
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (process.env.NODE_ENV === "development" && process.env.NOMADARCH_OPEN_DEVTOOLS === "true") {
|
||||
mainWindow.webContents.openDevTools({ mode: "detach" })
|
||||
}
|
||||
|
||||
@@ -452,6 +471,8 @@ if (isMac) {
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
ensureDefaultUsers()
|
||||
applyUserEnvToCli()
|
||||
startCli()
|
||||
|
||||
if (isMac) {
|
||||
@@ -480,6 +501,7 @@ app.whenReady().then(() => {
|
||||
app.on("before-quit", async (event) => {
|
||||
event.preventDefault()
|
||||
await cliManager.stop().catch(() => { })
|
||||
clearGuestUsers()
|
||||
app.exit(0)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user