feat(desktop): add Electron desktop shell over the web profile

Spawn the real dsh CLI running the web profile on loopback (OS-assigned
port), parse the printed readiness URL, and open a native window at it.
The harness and its native addons stay on the system Node ABI; the main
imports only electron and node builtins.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Pine
2026-08-14 10:23:22 +08:00
parent 47f943859b
commit 0cdbbfbf1a
8 changed files with 266 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest'
import { parseReadyPort } from '../src/ready-port.ts'
describe('parseReadyPort', () => {
it('extracts the port from a complete readiness line', () => {
expect(parseReadyPort('dsh web: http://127.0.0.1:38291')).toBe(38291)
})
it('ignores lines without a readiness URL', () => {
expect(parseReadyPort('loading plugins…')).toBeUndefined()
expect(parseReadyPort('http://192.168.1.5:8080')).toBeUndefined()
})
it('matches the loopback URL before a LAN suffix on the same line', () => {
expect(parseReadyPort('dsh web: http://127.0.0.1:38291 (LAN: http://192.168.1.5:8080)')).toBe(38291)
})
})