Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

Merge branch 'feat/win-17-update-ux' into stack2-17

review87f0c0d37321
diff --cc src/main/background-mode.test.ts
index 969597fc4,5d84acc3c..737c5f8bd
--- a/src/main/background-mode.test.ts
+++ b/src/main/background-mode.test.ts
@@@ -43,34 -42,12 +43,37 @@@ describe('main/index.ts background-mod
expect(src).toMatch(/quitting = true \/\/ from here on[^\n]*\n\s*destroyNotchHud\(\)\n\s*backgroundTray\?\.destroy\(\)/)
})
it('keeps the updater restart flipping `quitting` so a hidden window really closes', () => {
- expect(src).toMatch(/initUpdater\(\(\) => \{\s*quitting = true/)
+ expect(src).toMatch(/initUpdater\(\{\s*onBeforeRestart: \(\) => \{\s*quitting = true/)
})
it('tray Quit goes through app.quit() (before-quit + confirm), not app.exit()', () => {
- expect(src).toMatch(/onAction: \(action\) => \(action === 'open' \? showMainWindowFromBackground\(\) : app\.quit\(\)\)/)
+ // ('restart-update' is the updater's own guarded restart; every other action is Quit.)
+ expect(src).toMatch(
+ /onAction: \(action\) =>\s*action === 'open'\s*\? showMainWindowFromBackground\(\)\s*: action === 'restart-update'\s*\? updater\?\.restartToUpdate\(\)\s*: app\.quit\(\)/
+ )
})
})
+
+describe('claimOnceMarker (exclusive create — no exists-then-write race)', () => {
+ it('claims once, then reports already; the first content is kept', () => {
+ const dir = mkdtempSync(join(os.tmpdir(), 'nt-bg-marker-'))
+ try {
+ const f = join(dir, 'marker')
+ expect(claimOnceMarker(f, 'first')).toBe('claimed')
+ expect(claimOnceMarker(f, 'second')).toBe('already')
+ expect(readFileSync(f, 'utf8')).toBe('first')
+ } finally {
+ rmSync(dir, { recursive: true, force: true })
+ }
+ })
+ it('reports failed (not already) when the marker cannot be written', () => {
+ const dir = mkdtempSync(join(os.tmpdir(), 'nt-bg-marker-'))
+ try {
+ expect(claimOnceMarker(join(dir, 'missing-dir', 'marker'), 'x')).toBe('failed')
+ // A directory squatting on the name is an existing entry: the notice is not repeated.
+ mkdirSync(join(dir, 'squat'))
+ expect(claimOnceMarker(join(dir, 'squat'), 'x')).toBe('already')
+ } finally {
+ rmSync(dir, { recursive: true, force: true })
+ }
+ })
+})