mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-27 05:13:58 +02:00
feat: add packaging and validation coverage
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { app } from 'electron';
|
||||
import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import type {
|
||||
SidecarCapabilities,
|
||||
@@ -11,6 +10,7 @@ import type {
|
||||
RunTurnCommand,
|
||||
} from '@shared/contracts/sidecar';
|
||||
import type { ChatMessageRecord } from '@shared/domain/session';
|
||||
import { resolveSidecarProcess } from '@main/sidecar/sidecarRuntime';
|
||||
|
||||
type PendingCommand =
|
||||
| {
|
||||
@@ -30,30 +30,6 @@ type PendingCommand =
|
||||
onDelta: (event: TurnDeltaEvent) => void;
|
||||
};
|
||||
|
||||
function getProjectRoot(): string {
|
||||
return app.getAppPath();
|
||||
}
|
||||
|
||||
function resolveSidecarProcess(): { command: string; args: string[] } {
|
||||
if (app.isPackaged) {
|
||||
return {
|
||||
command: join(process.resourcesPath, 'sidecar', 'Kopaya.AgentHost.exe'),
|
||||
args: ['--stdio'],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
command: 'dotnet',
|
||||
args: [
|
||||
'run',
|
||||
'--project',
|
||||
join(getProjectRoot(), 'sidecar', 'src', 'Kopaya.AgentHost', 'Kopaya.AgentHost.csproj'),
|
||||
'--',
|
||||
'--stdio',
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export class SidecarClient {
|
||||
private process?: ChildProcessWithoutNullStreams;
|
||||
private stdoutBuffer = '';
|
||||
@@ -94,9 +70,14 @@ export class SidecarClient {
|
||||
return this.process;
|
||||
}
|
||||
|
||||
const sidecar = resolveSidecarProcess();
|
||||
const sidecar = resolveSidecarProcess({
|
||||
isPackaged: app.isPackaged,
|
||||
appPath: app.getAppPath(),
|
||||
resourcesPath: process.resourcesPath,
|
||||
platform: process.platform,
|
||||
});
|
||||
this.process = spawn(sidecar.command, sidecar.args, {
|
||||
cwd: getProjectRoot(),
|
||||
cwd: sidecar.cwd,
|
||||
stdio: 'pipe',
|
||||
windowsHide: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user