feat(coding): add core host api composition

This commit is contained in:
2026-08-23 20:00:35 +08:00
parent 98bac20639
commit 22b4a9f9c4
23 changed files with 2258 additions and 59 deletions

View File

@@ -68,6 +68,16 @@ export function createCodingProjectStorageFromStore(
};
}
export async function createElectronCodingProjectStorage(): Promise<CodingProjectStorage> {
const Store = (await import('electron-store')).default;
const store = new Store<{ projects?: CodingProjectStoreData }>({
// Preserve the installed-user storage identity while replacing the
// OpenCode-owned service and types with the product-owned store.
name: 'opencode-projects',
});
return createCodingProjectStorageFromStore(store, 'projects');
}
function emptyStoreData(): CodingProjectStoreData {
return { projects: {}, activeProjectId: null };
}