-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(desktop): Tauri v2 cross-platform tray + webview shell (desktop stack 2/5) #5260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
devin-ai-integration
wants to merge
4
commits into
devin/1789877991-standalone-binary
from
devin/1789879088-tauri-desktop-shell
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6c8ec5a
feat(desktop): add Tauri desktop shell
lidge-jun 4265213
fix(desktop): kill sidecar on quit, real icons, min macOS 13, exact-p…
lidge-jun 4b2eec0
fix(desktop): clear sidecar state on stop-proxy, drop dead API and mo…
lidge-jun 10f3a73
fix(desktop): clear sidecar state when stop-proxy finds the proxy alr…
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # OpenCodex desktop shell | ||
|
|
||
| The Tauri shell attaches to the local OpenCodex proxy and keeps the dashboard | ||
| in the proxy's loopback origin. During development: | ||
|
|
||
| ```sh | ||
| bun run prepare-sidecar | ||
| bun run dev | ||
| ``` | ||
|
|
||
| The sidecar is generated from the repository's standalone binary build and is | ||
| not checked into git. | ||
|
|
||
| The CI desktop-shell job performs Rust-only checks. It creates an empty | ||
| platform-named sidecar stub and a placeholder dashboard resource directory | ||
| solely for Tauri's external-binary and resource validation; it does not build | ||
| or run the standalone binary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "name": "@opencodex/desktop", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "tauri dev", | ||
| "build": "tauri build", | ||
| "prepare-sidecar": "bun scripts/prepare-sidecar.ts" | ||
| }, | ||
| "devDependencies": { | ||
| "@tauri-apps/cli": "2.5.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { copyFileSync, cpSync, existsSync, mkdirSync } from "node:fs"; | ||
| import { join, resolve } from "node:path"; | ||
|
|
||
| const targetByTriple: Record<string, string> = { | ||
| "aarch64-apple-darwin": "bun-darwin-arm64", | ||
| "x86_64-apple-darwin": "bun-darwin-x64", | ||
| "x86_64-pc-windows-msvc": "bun-windows-x64", | ||
| "x86_64-unknown-linux-gnu": "bun-linux-x64", | ||
| "aarch64-unknown-linux-gnu": "bun-linux-arm64", | ||
| }; | ||
|
|
||
| function argument(name: string): string | undefined { | ||
| const index = Bun.argv.indexOf(name); | ||
| return index < 0 ? undefined : Bun.argv[index + 1]; | ||
| } | ||
|
|
||
| function hostTriple(): string | undefined { | ||
| const result = Bun.spawnSync(["rustc", "-vV"], { stdout: "pipe", stderr: "ignore" }); | ||
| if (result.exitCode !== 0) return undefined; | ||
| const host = result.stdout.toString().match(/^host:\s*(\S+)$/m)?.[1]; | ||
| return host; | ||
| } | ||
|
|
||
| const repoRoot = resolve(import.meta.dir, "../.."); | ||
| const triple = | ||
| argument("--target") ?? | ||
| process.env.TARGET ?? | ||
| process.env.RUST_TARGET ?? | ||
| Bun.env.RUST_TARGET ?? | ||
| hostTriple(); | ||
| if (!triple || !targetByTriple[triple]) { | ||
| throw new Error( | ||
| `Unsupported Rust target ${triple ?? "(host unavailable)"}; pass --target ${Object.keys(targetByTriple).join("|")}`, | ||
| ); | ||
| } | ||
|
|
||
| const target = targetByTriple[triple]; | ||
| const source = join(repoRoot, "dist", "standalone", target); | ||
| const executable = join(source, target.startsWith("bun-windows-") ? "ocx.exe" : "ocx"); | ||
| if (!existsSync(executable)) { | ||
| const result = Bun.spawnSync([ | ||
| process.execPath, | ||
| "run", | ||
| "build:standalone", | ||
| "--target", | ||
| target, | ||
| ], { cwd: repoRoot, stdout: "inherit", stderr: "inherit" }); | ||
| if (result.exitCode !== 0) process.exit(result.exitCode); | ||
| } | ||
|
|
||
| const desktopRoot = resolve(import.meta.dir, ".."); | ||
| const binaries = join(desktopRoot, "src-tauri", "binaries"); | ||
| const resources = join(desktopRoot, "src-tauri", "resources", "gui", "dist"); | ||
| mkdirSync(binaries, { recursive: true }); | ||
| mkdirSync(resources, { recursive: true }); | ||
| const destination = join(binaries, `ocx-${triple}${target.startsWith("bun-windows-") ? ".exe" : ""}`); | ||
| copyFileSync(executable, destination); | ||
| cpSync(join(repoRoot, "gui", "dist"), resources, { recursive: true }); | ||
| console.log(`Prepared ${destination}`); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a clean checkout,
gui/distis ignored and absent, but this path invokesbuild:standalone, whose first prerequisite check rejects the build unlessgui/dist/index.htmlalready exists; the latercpSynchas the same unstated dependency. Consequently the documentedbun run prepare-sidecarworkflow fails before producing a sidecar unless the user happened to runbun run build:guiseparately. Have this preparation command build the GUI first or fail with and document the required prerequisite.Useful? React with 👍 / 👎.