From 9430bee86fbf943283eb5a6f63bd750b875ff433 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Fri, 23 Jan 2026 20:51:28 +0800 Subject: feat(ui): add new ui project --- packages/ui-new/src/types/bindings/assistant.ts | 25 ++++++ packages/ui-new/src/types/bindings/auth.ts | 32 ++++++++ packages/ui-new/src/types/bindings/config.ts | 61 +++++++++++++++ packages/ui-new/src/types/bindings/core.ts | 47 ++++++++++++ packages/ui-new/src/types/bindings/downloader.ts | 63 +++++++++++++++ packages/ui-new/src/types/bindings/fabric.ts | 74 ++++++++++++++++++ packages/ui-new/src/types/bindings/forge.ts | 21 +++++ packages/ui-new/src/types/bindings/game_version.ts | 89 ++++++++++++++++++++++ packages/ui-new/src/types/bindings/index.ts | 11 +++ packages/ui-new/src/types/bindings/instance.ts | 32 ++++++++ packages/ui-new/src/types/bindings/java.ts | 52 +++++++++++++ packages/ui-new/src/types/bindings/manifest.ts | 22 ++++++ 12 files changed, 529 insertions(+) create mode 100644 packages/ui-new/src/types/bindings/assistant.ts create mode 100644 packages/ui-new/src/types/bindings/auth.ts create mode 100644 packages/ui-new/src/types/bindings/config.ts create mode 100644 packages/ui-new/src/types/bindings/core.ts create mode 100644 packages/ui-new/src/types/bindings/downloader.ts create mode 100644 packages/ui-new/src/types/bindings/fabric.ts create mode 100644 packages/ui-new/src/types/bindings/forge.ts create mode 100644 packages/ui-new/src/types/bindings/game_version.ts create mode 100644 packages/ui-new/src/types/bindings/index.ts create mode 100644 packages/ui-new/src/types/bindings/instance.ts create mode 100644 packages/ui-new/src/types/bindings/java.ts create mode 100644 packages/ui-new/src/types/bindings/manifest.ts (limited to 'packages/ui-new/src/types') diff --git a/packages/ui-new/src/types/bindings/assistant.ts b/packages/ui-new/src/types/bindings/assistant.ts new file mode 100644 index 0000000..827f008 --- /dev/null +++ b/packages/ui-new/src/types/bindings/assistant.ts @@ -0,0 +1,25 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type GenerationStats = { + totalDuration: bigint; + loadDuration: bigint; + promptEvalCount: bigint; + promptEvalDuration: bigint; + evalCount: bigint; + evalDuration: bigint; +}; + +export type Message = { role: string; content: string }; + +export type ModelInfo = { + id: string; + name: string; + size: string | null; + details: string | null; +}; + +export type StreamChunk = { + content: string; + done: boolean; + stats: GenerationStats | null; +}; diff --git a/packages/ui-new/src/types/bindings/auth.ts b/packages/ui-new/src/types/bindings/auth.ts new file mode 100644 index 0000000..a65f0a4 --- /dev/null +++ b/packages/ui-new/src/types/bindings/auth.ts @@ -0,0 +1,32 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Account = + | ({ type: "offline" } & OfflineAccount) + | ({ type: "microsoft" } & MicrosoftAccount); + +export type DeviceCodeResponse = { + userCode: string; + deviceCode: string; + verificationUri: string; + expiresIn: bigint; + interval: bigint; + message: string | null; +}; + +export type MicrosoftAccount = { + username: string; + uuid: string; + accessToken: string; + refreshToken: string | null; + expiresAt: bigint; +}; + +export type MinecraftProfile = { id: string; name: string }; + +export type OfflineAccount = { username: string; uuid: string }; + +export type TokenResponse = { + accessToken: string; + refreshToken: string | null; + expiresIn: bigint; +}; diff --git a/packages/ui-new/src/types/bindings/config.ts b/packages/ui-new/src/types/bindings/config.ts new file mode 100644 index 0000000..e9de4f5 --- /dev/null +++ b/packages/ui-new/src/types/bindings/config.ts @@ -0,0 +1,61 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type AssistantConfig = { + enabled: boolean; + llmProvider: string; + ollamaEndpoint: string; + ollamaModel: string; + openaiApiKey: string | null; + openaiEndpoint: string; + openaiModel: string; + systemPrompt: string; + responseLanguage: string; + ttsEnabled: boolean; + ttsProvider: string; +}; + +/** + * Feature-gated arguments configuration + */ +export type FeatureFlags = { + /** + * Demo user: enables demo-related arguments when rules require it + */ + demoUser: boolean; + /** + * Quick Play: enable quick play arguments + */ + quickPlayEnabled: boolean; + /** + * Quick Play singleplayer world path (if provided) + */ + quickPlayPath: string | null; + /** + * Quick Play singleplayer flag + */ + quickPlaySingleplayer: boolean; + /** + * Quick Play multiplayer server address (optional) + */ + quickPlayMultiplayerServer: string | null; +}; + +export type LauncherConfig = { + minMemory: number; + maxMemory: number; + javaPath: string; + width: number; + height: number; + downloadThreads: number; + customBackgroundPath: string | null; + enableGpuAcceleration: boolean; + enableVisualEffects: boolean; + activeEffect: string; + theme: string; + logUploadService: string; + pastebinApiKey: string | null; + assistant: AssistantConfig; + useSharedCaches: boolean; + keepLegacyPerInstanceStorage: boolean; + featureFlags: FeatureFlags; +}; diff --git a/packages/ui-new/src/types/bindings/core.ts b/packages/ui-new/src/types/bindings/core.ts new file mode 100644 index 0000000..94e3bde --- /dev/null +++ b/packages/ui-new/src/types/bindings/core.ts @@ -0,0 +1,47 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * File information for instance file browser + */ +export type FileInfo = { + name: string; + path: string; + isDirectory: boolean; + size: bigint; + modified: bigint; +}; + +export type GithubRelease = { + tagName: string; + name: string; + publishedAt: string; + body: string; + htmlUrl: string; +}; + +/** + * Installed version info + */ +export type InstalledVersion = { id: string; type: string }; + +/** + * Migrate instance caches to shared global caches + */ +export type MigrationResult = { + movedFiles: number; + hardlinks: number; + copies: number; + savedBytes: bigint; + savedMb: number; +}; + +export type PastebinResponse = { url: string }; + +/** + * Version metadata for display in the UI + */ +export type VersionMetadata = { + id: string; + javaVersion: bigint | null; + isInstalled: boolean; +}; diff --git a/packages/ui-new/src/types/bindings/downloader.ts b/packages/ui-new/src/types/bindings/downloader.ts new file mode 100644 index 0000000..a1734d5 --- /dev/null +++ b/packages/ui-new/src/types/bindings/downloader.ts @@ -0,0 +1,63 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Metadata for resumable downloads stored in .part.meta file + */ +export type DownloadMetadata = { + url: string; + fileName: string; + totalSize: bigint; + downloadedBytes: bigint; + checksum: string | null; + timestamp: bigint; + segments: Array; +}; + +/** + * Download queue for persistence + */ +export type DownloadQueue = { pendingDownloads: Array }; + +/** + * A download segment for multi-segment parallel downloading + */ +export type DownloadSegment = { + start: bigint; + end: bigint; + downloaded: bigint; + completed: boolean; +}; + +export type DownloadTask = { + url: string; + path: string; + sha1: string | null; + sha256: string | null; +}; + +/** + * Progress event for Java download + */ +export type JavaDownloadProgress = { + fileName: string; + downloadedBytes: bigint; + totalBytes: bigint; + speedBytesPerSec: bigint; + etaSeconds: bigint; + status: string; + percentage: number; +}; + +/** + * Pending download task for queue persistence + */ +export type PendingJavaDownload = { + majorVersion: number; + imageType: string; + downloadUrl: string; + fileName: string; + fileSize: bigint; + checksum: string | null; + installPath: string; + createdAt: bigint; +}; diff --git a/packages/ui-new/src/types/bindings/fabric.ts b/packages/ui-new/src/types/bindings/fabric.ts new file mode 100644 index 0000000..181f8be --- /dev/null +++ b/packages/ui-new/src/types/bindings/fabric.ts @@ -0,0 +1,74 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Represents a Minecraft version supported by Fabric. + */ +export type FabricGameVersion = { version: string; stable: boolean }; + +/** + * Represents a Fabric intermediary mapping version. + */ +export type FabricIntermediaryVersion = { + maven: string; + version: string; + stable: boolean; +}; + +/** + * Launcher metadata from Fabric Meta API. + */ +export type FabricLauncherMeta = { + version: number; + libraries: FabricLibraries; + mainClass: FabricMainClass; +}; + +/** + * Libraries required by Fabric loader. + */ +export type FabricLibraries = { + client: Array; + common: Array; + server: Array; +}; + +/** + * A single Fabric library dependency. + */ +export type FabricLibrary = { name: string; url: string | null }; + +/** + * Represents a combined loader + intermediary version entry. + */ +export type FabricLoaderEntry = { + loader: FabricLoaderVersion; + intermediary: FabricIntermediaryVersion; + launcherMeta: FabricLauncherMeta; +}; + +/** + * Represents a Fabric loader version from the Meta API. + */ +export type FabricLoaderVersion = { + separator: string; + build: number; + maven: string; + version: string; + stable: boolean; +}; + +/** + * Main class configuration for Fabric. + * Can be either a struct with client/server fields or a simple string. + */ +export type FabricMainClass = { client: string; server: string } | string; + +/** + * Information about an installed Fabric version. + */ +export type InstalledFabricVersion = { + id: string; + minecraftVersion: string; + loaderVersion: string; + path: string; +}; diff --git a/packages/ui-new/src/types/bindings/forge.ts b/packages/ui-new/src/types/bindings/forge.ts new file mode 100644 index 0000000..a9790e7 --- /dev/null +++ b/packages/ui-new/src/types/bindings/forge.ts @@ -0,0 +1,21 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Represents a Forge version entry. + */ +export type ForgeVersion = { + version: string; + minecraftVersion: string; + recommended: boolean; + latest: boolean; +}; + +/** + * Information about an installed Forge version. + */ +export type InstalledForgeVersion = { + id: string; + minecraftVersion: string; + forgeVersion: string; + path: string; +}; diff --git a/packages/ui-new/src/types/bindings/game_version.ts b/packages/ui-new/src/types/bindings/game_version.ts new file mode 100644 index 0000000..1b1c395 --- /dev/null +++ b/packages/ui-new/src/types/bindings/game_version.ts @@ -0,0 +1,89 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Arguments = { + game: Record; + jvm: Record; +}; + +export type AssetIndex = { + id: string; + sha1: string; + size: bigint; + url: string; + totalSize: bigint | null; +}; + +export type DownloadArtifact = { + sha1: string | null; + size: bigint | null; + url: string; + path: string | null; +}; + +export type Downloads = { + client: DownloadArtifact; + server: DownloadArtifact | null; +}; + +/** + * Represents a Minecraft version JSON, supporting both vanilla and modded (Fabric/Forge) formats. + * Modded versions use `inheritsFrom` to reference a parent vanilla version. + */ +export type GameVersion = { + id: string; + /** + * Optional for mod loaders that inherit from vanilla + */ + downloads: Downloads | null; + /** + * Optional for mod loaders that inherit from vanilla + */ + assetIndex: AssetIndex | null; + libraries: Array; + mainClass: string; + minecraftArguments: string | null; + arguments: Arguments | null; + javaVersion: JavaVersion | null; + /** + * For mod loaders: the vanilla version this inherits from + */ + inheritsFrom: string | null; + /** + * Fabric/Forge may specify a custom assets version + */ + assets: string | null; + /** + * Release type (release, snapshot, old_beta, etc.) + */ + type: string | null; +}; + +export type JavaVersion = { component: string; majorVersion: bigint }; + +export type Library = { + downloads: LibraryDownloads | null; + name: string; + rules: Array | null; + natives: Record; + /** + * Maven repository URL for mod loader libraries + */ + url: string | null; +}; + +export type LibraryDownloads = { + artifact: DownloadArtifact | null; + classifiers: Record; +}; + +export type OsRule = { + name: string | null; + version: string | null; + arch: string | null; +}; + +export type Rule = { + action: string; + os: OsRule | null; + features: Record; +}; diff --git a/packages/ui-new/src/types/bindings/index.ts b/packages/ui-new/src/types/bindings/index.ts new file mode 100644 index 0000000..510c240 --- /dev/null +++ b/packages/ui-new/src/types/bindings/index.ts @@ -0,0 +1,11 @@ +export * from "./assistant"; +export * from "./auth"; +export * from "./config"; +export * from "./core"; +export * from "./downloader"; +export * from "./fabric"; +export * from "./forge"; +export * from "./game_version"; +export * from "./instance"; +export * from "./java"; +export * from "./manifest"; diff --git a/packages/ui-new/src/types/bindings/instance.ts b/packages/ui-new/src/types/bindings/instance.ts new file mode 100644 index 0000000..079e8f0 --- /dev/null +++ b/packages/ui-new/src/types/bindings/instance.ts @@ -0,0 +1,32 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Represents a game instance/profile + */ +export type Instance = { + id: string; + name: string; + gameDir: string; + versionId: string | null; + createdAt: bigint; + lastPlayed: bigint | null; + iconPath: string | null; + notes: string | null; + modLoader: string | null; + modLoaderVersion: string | null; + jvmArgsOverride: string | null; + memoryOverride: MemoryOverride | null; +}; + +/** + * Configuration for all instances + */ +export type InstanceConfig = { + instances: Array; + activeInstanceId: string | null; +}; + +/** + * Memory settings override for an instance + */ +export type MemoryOverride = { min: number; max: number }; diff --git a/packages/ui-new/src/types/bindings/java.ts b/packages/ui-new/src/types/bindings/java.ts new file mode 100644 index 0000000..5db128e --- /dev/null +++ b/packages/ui-new/src/types/bindings/java.ts @@ -0,0 +1,52 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * Java image type: JRE or JDK + */ +export type ImageType = "jre" | "jdk"; + +/** + * Java catalog containing all available versions + */ +export type JavaCatalog = { + releases: Array; + availableMajorVersions: Array; + ltsVersions: Array; + cachedAt: bigint; +}; + +/** + * Java download information from Adoptium + */ +export type JavaDownloadInfo = { + version: string; + releaseName: string; + downloadUrl: string; + fileName: string; + fileSize: bigint; + checksum: string | null; + imageType: string; +}; + +export type JavaInstallation = { + path: string; + version: string; + is64bit: boolean; +}; + +/** + * Java release information for UI display + */ +export type JavaReleaseInfo = { + majorVersion: number; + imageType: string; + version: string; + releaseName: string; + releaseDate: string | null; + fileSize: bigint; + checksum: string | null; + downloadUrl: string; + isLts: boolean; + isAvailable: boolean; + architecture: string; +}; diff --git a/packages/ui-new/src/types/bindings/manifest.ts b/packages/ui-new/src/types/bindings/manifest.ts new file mode 100644 index 0000000..2180962 --- /dev/null +++ b/packages/ui-new/src/types/bindings/manifest.ts @@ -0,0 +1,22 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Latest = { release: string; snapshot: string }; + +export type Version = { + id: string; + type: string; + url: string; + time: string; + releaseTime: string; + /** + * Java version requirement (major version number) + * This is populated from the version JSON file if the version is installed locally + */ + javaVersion: bigint | null; + /** + * Whether this version is installed locally + */ + isInstalled: boolean | null; +}; + +export type VersionManifest = { latest: Latest; versions: Array }; -- cgit v1.2.3-70-g09d2