Add OpenCode binary selection with version detection

- Add binary selector component with dropdown and validation
- Support custom OpenCode binary paths and system PATH binary
- Async version checking for all binaries when selector opens
- Store recent binaries with timestamps and version info
- Enhanced instance creation to use selected binary
- Improved storage system for binary preferences
- Fixed validation to handle system PATH binaries properly
This commit is contained in:
Shantur Rathore
2025-10-26 10:26:32 +00:00
parent f4a664bfe7
commit f63a4b3754
11 changed files with 684 additions and 55 deletions

View File

@@ -40,7 +40,7 @@ function removeInstance(id: string) {
}
}
async function createInstance(folder: string): Promise<string> {
async function createInstance(folder: string, binaryPath?: string): Promise<string> {
const id = `instance-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
const instance: Instance = {
@@ -56,7 +56,12 @@ async function createInstance(folder: string): Promise<string> {
addInstance(instance)
try {
const { id: returnedId, port, pid, binaryPath } = await window.electronAPI.createInstance(id, folder)
const {
id: returnedId,
port,
pid,
binaryPath: actualBinaryPath,
} = await window.electronAPI.createInstance(id, folder, binaryPath)
const client = sdkManager.createClient(port)
@@ -65,7 +70,7 @@ async function createInstance(folder: string): Promise<string> {
pid,
client,
status: "ready",
binaryPath,
binaryPath: actualBinaryPath,
})
setActiveInstanceId(id)