Add managed desktop daemon runtime support

This commit is contained in:
Mohamed Boudra
2026-03-08 15:40:02 +07:00
parent faa5aaab6f
commit 2d5d0dcacd
35 changed files with 5377 additions and 421 deletions
+19 -6
View File
@@ -65,9 +65,22 @@ try {
console.log('✓ daemon status reports stopped when not running\n')
}
// Test 4: daemon status --json outputs valid JSON
// Test 4: daemon pair --json outputs valid JSON
{
console.log('Test 4: daemon status --json outputs JSON')
console.log('Test 4: daemon pair --json outputs JSON')
const result =
await $`PASEO_HOME=${paseoHome} npx paseo daemon pair --json`.nothrow()
assert.strictEqual(result.exitCode, 0, 'daemon pair --json should succeed')
const pairing = JSON.parse(result.stdout)
assert.strictEqual(pairing.relayEnabled, true, 'pairing should report relay enabled')
assert.match(pairing.url, /#offer=/, 'pairing URL should include offer fragment')
assert.strictEqual(typeof pairing.qr, 'string', 'pairing should include QR content')
console.log('✓ daemon pair --json outputs valid JSON\n')
}
// Test 5: daemon status --json outputs valid JSON
{
console.log('Test 5: daemon status --json outputs JSON')
const result =
await $`PASEO_HOME=${paseoHome} npx paseo daemon status --json`.nothrow()
assert.strictEqual(result.exitCode, 0, '--json status should succeed')
@@ -77,9 +90,9 @@ try {
console.log('✓ daemon status --json outputs valid JSON\n')
}
// Test 5: daemon stop handles daemon not running gracefully
// Test 6: daemon stop handles daemon not running gracefully
{
console.log('Test 5: daemon stop handles daemon not running')
console.log('Test 6: daemon stop handles daemon not running')
const result =
await $`PASEO_HOME=${paseoHome} npx paseo daemon stop`.nothrow()
// Stop should succeed even if daemon is not running (idempotent).
@@ -92,9 +105,9 @@ try {
console.log('✓ daemon stop succeeds gracefully when daemon not running\n')
}
// Test 6: daemon restart starts daemon and can be stopped
// Test 7: daemon restart starts daemon and can be stopped
{
console.log('Test 6: daemon restart starts daemon and can be stopped')
console.log('Test 7: daemon restart starts daemon and can be stopped')
const result =
await $`PASEO_HOME=${paseoHome} npx paseo daemon restart --port ${String(port)}`.nothrow()
assert.strictEqual(result.exitCode, 0, 'restart should succeed even when previously stopped')
@@ -29,6 +29,8 @@ console.log('=== Local Daemon Utility Helpers ===\n')
console.log('Test 3: rejects unix socket listen values')
assert.strictEqual(resolveTcpHostFromListen('/tmp/paseo.sock'), null)
assert.strictEqual(resolveTcpHostFromListen('unix:///tmp/paseo.sock'), null)
assert.strictEqual(resolveTcpHostFromListen('pipe://\\\\.\\pipe\\paseo-managed-test'), null)
assert.strictEqual(resolveTcpHostFromListen('\\\\.\\pipe\\paseo-managed-test'), null)
console.log('✓ rejects unix socket listen values\n')
}
@@ -0,0 +1,30 @@
#!/usr/bin/env npx tsx
import assert from 'node:assert'
import { resolveDaemonTarget } from '../src/utils/client.js'
console.log('=== CLI IPC Target Helpers ===\n')
{
console.log('Test 1: unix hosts resolve to ws+unix URLs')
const target = resolveDaemonTarget('unix:///tmp/paseo.sock')
assert.deepStrictEqual(target, {
type: 'ipc',
url: 'ws+unix:///tmp/paseo.sock:/ws',
socketPath: '/tmp/paseo.sock',
})
console.log('✓ unix hosts resolve to ws+unix URLs\n')
}
{
console.log('Test 2: pipe hosts preserve the Node socketPath transport form')
const target = resolveDaemonTarget('pipe://\\\\.\\pipe\\paseo-managed-test')
assert.deepStrictEqual(target, {
type: 'ipc',
url: 'ws://localhost/ws',
socketPath: '\\\\.\\pipe\\paseo-managed-test',
})
console.log('✓ pipe hosts preserve Node socketPath transport form\n')
}
console.log('=== All CLI IPC target tests passed ===')