interface main { // // app store API as presented by main:app_store:sys-v0 // use standard.{package-id}; record onchain-metadata { name: option, description: option, image: option, external-url: option, animation-url: option, properties: onchain-properties, } record onchain-properties { package-name: string, publisher: string, current-version: string, mirrors: list, code-hashes: list>, license: option, screenshots: option>, wit-version: option, dependencies: option>, } variant request { remote(remote-request), local(local-request), } variant response { remote(remote-response), local(local-response), } variant remote-request { download(remote-download-request), } record remote-download-request { package-id: package-id, desired-version-hash: option, } variant remote-response { download-approved, download-denied(reason), } variant reason { no-package, not-mirroring, hash-mismatch(hash-mismatch), file-not-found, worker-spawn-failed } record hash-mismatch { requested: string, have: string, } variant local-request { new-package(new-package-request), download(download-request), install(package-id), uninstall(package-id), start-mirroring(package-id), stop-mirroring(package-id), start-auto-update(package-id), stop-auto-update(package-id), rebuild-index, apis, get-api(package-id), } record new-package-request { package-id: package-id, metadata: onchain-metadata, mirror: bool, } record download-request { package-id: package-id, download-from: string, mirror: bool, auto-update: bool, desired-version-hash: option, } variant local-response { new-package-response(new-package-response), download-response(download-response), install-response(install-response), uninstall-response(uninstall-response), mirror-response(mirror-response), auto-update-response(auto-update-response), rebuild-index-response(rebuild-index-response), apis-response(apis-response), get-api-response(get-api-response), } enum new-package-response { success, no-blob, install-failed, already-exists, } variant download-response { started, bad-response, denied(reason), already-exists, already-downloading, } enum install-response { success, failure, // TODO } enum uninstall-response { success, failure, // TODO } enum mirror-response { success, failure, // TODO } enum auto-update-response { success, failure, // TODO } enum rebuild-index-response { success, failure, // TODO } record apis-response { apis: list, } // the API itself will be in response blob if success! enum get-api-response { success, failure, // TODO } } world app-store-sys-v0 { import main; include process-v0; }