Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
3e1eb7f
Merge remote-tracking branch 'origin/main' into fix/android-tablet-la…
juliusmarminge Oct 19, 2026
2fc09ed
fix(mobile): apply Android launch orientation before content
juliusmarminge Oct 19, 2026
913f61f
Merge remote-tracking branch 'origin/main' into fix/android-tablet-la…
juliusmarminge Oct 19, 2026
48f66be
fix(mobile): preserve chat history when opening pull requests
PixPMusic Oct 12, 2026
926808a
fix(android): preserve contextual PR navigation history
juliusmarminge Oct 19, 2026
2b2f7f7
fix(mobile): keep contextual Back alongside subagent parent Back
PixPMusic Oct 21, 2026
2546872
fix(mobile): reconcile contextual PR navigation with current main
maria-rcks Oct 26, 2026
001a470
fix(mobile): return linked threads to the PR diff
maria-rcks Oct 26, 2026
9d3aac8
fix(mobile): preserve chat history through PR self-links
maria-rcks Oct 26, 2026
dc6f194
chore(mobile): merge main into tablet orientation fix
maria-rcks Oct 26, 2026
701e13c
fix(web): hide image action tooltip in expanded viewer (#29329)
Yash-Singh1 Nov 2, 2026
22b5252
feat(server): log fast and ultrafast service tiers in analytics (#29348)
t3dotgg Nov 2, 2026
ac8dce0
fix(marketing): show 40k+ GitHub stars (#29362)
t3dotgg Nov 2, 2026
edc37c9
fix(web): center authorized client settings rows (#29382)
Yash-Singh1 Nov 2, 2026
5e966bc
fix(mobile): keep One UI navigation and Compose on one row (#29203)
none23 Nov 2, 2026
d833184
perf(server): bound runtime recovery reads by thread ownership (#29429)
Yash-Singh1 Nov 2, 2026
7cf653b
perf(server): narrow delegated recovery reads to delivery records (#2…
Yash-Singh1 Nov 2, 2026
c8a601c
fix(cursor): /compact compacts with the SDK's summarize (#29398)
SunkenInTime Nov 2, 2026
ed8833f
fix(mobile): pending auto-merge shows in the merge button (#29465)
juliusmarminge Nov 2, 2026
8657eec
fix(server): defer Tailscale endpoint discovery during startup (#29432)
Yash-Singh1 Nov 2, 2026
0847a44
fix(mobile): merge button names merged, closed, draft, and conflict s…
juliusmarminge Nov 2, 2026
1416947
test(evals): guard how agents tell threads from tasks and subagents (…
gabrielelpidio Nov 2, 2026
9bcf753
fix(server): background agent asks go to delegate_task, not a backgro…
gabrielelpidio Nov 2, 2026
84537c4
feat(server): read source control host tokens from a secret provider …
yordis Nov 2, 2026
a497f7b
fix(web): confirm before removing a provider instance's saved setting…
juliusmarminge Nov 2, 2026
3ddd398
fix(server): settled threads no longer re-send relay clears on every …
juliusmarminge Nov 2, 2026
a821f03
fix(client-runtime): connection diagnosis no longer blames the host w…
juliusmarminge Nov 2, 2026
6f41364
fix(opencode): Claude usage limits through OpenCode keep their reset …
juliusmarminge Nov 2, 2026
bdf5806
fix(desktop): prepare macOS x64 bytecode under Rosetta (#29484)
Yash-Singh1 Nov 2, 2026
cc59f99
fix(server): keep PR watches active after host failures (#29450)
Yash-Singh1 Nov 2, 2026
af00cf7
fix(cursor): show Cursor usage after signing in with Cursor (#29419)
serhiyhvala Nov 2, 2026
cbd3e14
perf(server): skip redundant claude session naming (#28910)
maria-rcks Nov 2, 2026
a9ac1e8
fix(mobile): keep the conversation steady during layout changes (#29545)
juliusmarminge Nov 2, 2026
60aec28
feat(marketing): fetch GitHub stars at build time (#29555)
juliusmarminge Nov 2, 2026
065a433
perf(server): pin the index for the unscoped agent event high-water (…
juliusmarminge Nov 2, 2026
30084f0
perf(web): the pull request code tab derives its file model once per …
juliusmarminge Nov 2, 2026
ea16fcb
perf(server): stop tracing project enrichment cache reads (#29640)
juliusmarminge Nov 2, 2026
8648aea
perf(server): seek live nodes for the subagent recovery probe (#29644)
juliusmarminge Nov 2, 2026
55e2538
feat(provider-kiro): add Kiro as an ACP provider (#14693)
juliusmarminge Nov 2, 2026
a036489
revert(web): undo hover timestamp change from #28610 (#29680)
maria-rcks Nov 2, 2026
bad610b
perf(server): idle compaction reads only the latest run, live work an…
juliusmarminge Nov 2, 2026
71646e0
perf(server): cancelling a task reads only the tasks and runs it uses…
juliusmarminge Nov 2, 2026
5b9731c
fix(web): screen readers can browse and Tab through the threads sideb…
nibarAhmed Nov 3, 2026
57cd059
chore(deps): upgrade Effect to 4.1.2 and alchemy to beta.85 (#26833)
juliusmarminge Nov 3, 2026
d8a829e
perf(web): PDF previews reload without starting a new pdf.js worker (…
saphid Nov 3, 2026
9213610
Merge upstream pingdotgg/t3code main into fork (through 701e13ce)
yvesoddly Nov 3, 2026
f6503f0
fix(mobile): shorten the iOS undo toast and balance its insets (#29775)
shivamhwp Nov 3, 2026
2d2299a
fix(web): file save session browser test no longer hangs on the disco…
juliusmarminge Nov 3, 2026
92dee20
fix(server): Changes totals no longer diff against a guessed base aft…
tris203 Nov 3, 2026
3c59595
perf(server): skip unused parent history in linked task status (#27913)
Adamulek123 Nov 3, 2026
6a61904
fix(server): native Claude updates use the native release feed (#27958)
NathanGlasby Nov 3, 2026
e2d3aa9
fix(tailscale): escalate hung serve commands to SIGKILL (#28529)
rishabhx29 Nov 3, 2026
948433d
refactor(server): provider registry owns explicit model cache invalid…
tris203 Nov 3, 2026
0b2c13a
perf(server): bound ordinal recovery to selected messages (#27495)
Motaghi Nov 3, 2026
1d80d0e
fix(client-runtime): branch picker shows branches changed outside T3 …
ebrahimHakimuddin Nov 3, 2026
f981b7a
perf(client): skip idle inbox placement serialization (#27460)
UtkarshUsername Nov 3, 2026
8430db6
fix(server): project content search finds matches past a line's first…
saphid Nov 3, 2026
ab06e2a
fix(clients): attachment sizes just under 1 MB no longer read "1024 K…
saphid Nov 3, 2026
a4f4741
fix(gitlab): merge request links keep an HTTP remote's port and schem…
saphid Nov 3, 2026
064cf8f
fix(server): an upstream shadowed by a local origin/<branch> branch k…
saphid Nov 3, 2026
5815442
fix(server): turn diffs keep signed commits' files under log.showSign…
saphid Nov 3, 2026
50106ef
fix(server): generated commit and PR text no longer reads colored git…
saphid Nov 3, 2026
4494faa
fix(client-runtime): checking out a pull request refreshes cached bra…
saphid Nov 3, 2026
5fa0d0b
fix(clients): cancel oversized project icon responses (#29006)
luke2x Nov 3, 2026
63f06d5
Merge upstream pingdotgg/t3code main into fork (through d8a829e5)
yvesoddly Nov 3, 2026
d1e5044
fix(shared): context chip labels no longer split an emoji at the 200-…
saphid Nov 3, 2026
448c1ac
fix(server): create_threads titles no longer end in a broken characte…
saphid Nov 3, 2026
59869da
Merge upstream pingdotgg/t3code main into fork (through d1e5044c)
yvesoddly Nov 3, 2026
6739dd7
perf(server): thread snapshots skip serializing a row past the row li…
Yuruzuu Nov 3, 2026
071660e
fix(server): Uncommitted review keeps a staged deletion that git pair…
saphid Nov 3, 2026
a565d89
fix(cli): t3 thread start titles no longer end in a broken character …
saphid Nov 3, 2026
89c2a5c
perf(client-runtime): expanding deferred work skips an unused timelin…
Yuruzuu Nov 3, 2026
b1913b9
fix(server): honor relocated systemd user configuration (#29244)
voltcrash Nov 3, 2026
5231459
fix(web): review comments keep a trailing blank line in their diff (#…
saphid Nov 3, 2026
dfbafee
fix(server): side chat and merge-back context no longer cut an emoji …
saphid Nov 3, 2026
a5e7e5b
perf(server): loading a file's diff skips unused repository lookups (…
Yuruzuu Nov 3, 2026
87e13d3
fix(cli): make relative install homes produce working commands (#29241)
voltcrash Nov 3, 2026
c3cfb5e
fix(forgejo): dismissed reviews no longer read as requested changes o…
saphid Nov 3, 2026
efcb937
fix(shared): Linux file links preserve literal backslashes (#29245)
voltcrash Nov 3, 2026
5349ecb
fix(gitcafe): PR link previews show a GitHub-merged pull request as m…
saphid Nov 3, 2026
ba962f2
fix(codex): restoring a checkpoint works after the Codex session was …
saphid Nov 3, 2026
cf48ea8
perf(acp): ACP agents skip decoding output twice for unused diagnosti…
Yuruzuu Nov 3, 2026
35af849
fix(server): diffs keep blank context lines under diff.suppressBlankE…
saphid Nov 3, 2026
f639c15
fix(scripts): check:changed passes when only lint-ignored code change…
saphid Nov 3, 2026
a6a921c
perf(client): streamed row updates no longer rescan question history …
Yuruzuu Nov 3, 2026
5eb8154
perf(desktop): keep Linux MIME helpers off the startup path (#29247)
voltcrash Nov 3, 2026
e051363
perf(server): shell updates read a burst of threads once (#29101)
Yuruzuu Nov 3, 2026
ae1ccb1
fix(opencode): forks from compacted threads no longer fail (#29221)
voltcrash Nov 3, 2026
8cebee4
fix(scripts): check:changed lints Astro components and runs knip for …
saphid Nov 3, 2026
e72a0c7
fix(desktop): Linux .deb no longer installs files any local user can …
shivamhwp Nov 3, 2026
9f63268
fix(desktop): native builds prepare server bytecode again after the E…
maria-rcks Nov 3, 2026
30b9c4a
fix(codex): a background command's wake no longer hangs when its outp…
saphid Nov 3, 2026
edb3bfd
merge: update carried upstream PR #18634 to dc6f194db9
yvesoddly Nov 3, 2026
daacf4e
fix: scope dictation shortcuts and preserve draft feedback
maria-rcks Nov 3, 2026
209c7f6
fix: fork lint suppressions use the renamed no-unreasoned-state-sync …
yvesoddly Nov 3, 2026
fae6ed8
fix: preserve dictation context and session lifecycle
maria-rcks Oct 31, 2026
07846fc
test(scripts): expect the unmatched-pattern flag in the Astro check:c…
maria-rcks Nov 3, 2026
963ab81
merge: update carried upstream PR #18839 to 9d3aac8a0e
yvesoddly Nov 3, 2026
657c2dc
test(mobile): consolidate native keyboard regression coverage
juliusmarminge Oct 19, 2026
24e5faf
fix(mobile): guard disabled hardware submission and clarify keybindings
juliusmarminge Oct 19, 2026
927a2c6
fix(mobile): drafts on threads with colons in their ids upload attach…
juliusmarminge Nov 3, 2026
d0f5ae6
fix(server): provider refresh no longer reverts an enriched sign-in s…
juliusmarminge Nov 3, 2026
c2b7d08
fix(mobile): expose Android keyboard settings and preserve terminal c…
juliusmarminge Oct 19, 2026
3aae4b8
test(mobile): cover hardware Return during IME composition
juliusmarminge Oct 19, 2026
83c539a
fix(mobile): leave composing text to the Android IME
juliusmarminge Oct 19, 2026
ff73c4c
fix(server): forked Claude threads keep their compaction chain (#27577)
juliusmarminge Nov 3, 2026
759ecca
style(mobile): wrap native keyboard checks for ktlint
juliusmarminge Oct 19, 2026
709cfb3
fix(server): Claude subagents left by a stopped process no longer sta…
juliusmarminge Nov 3, 2026
95414cf
fix(server): usage-limit auto-resume no longer arms children of settl…
juliusmarminge Nov 3, 2026
727a502
fix(cursor): a write-after-end in the Cursor SDK no longer stops the …
juliusmarminge Nov 3, 2026
5a9a133
fix(mobile): name Android follow-up modifier correctly
juliusmarminge Oct 19, 2026
65aaf97
fix(server): avoid reparsing streamed replies for timestamps (#25252)
juliusmarminge Nov 3, 2026
f2513bd
fix(web): project settings can set a checkout's grouping rule again (…
juliusmarminge Nov 3, 2026
42ca7c0
fix(server): reject oversized goal objectives before dispatch (#23033)
juliusmarminge Nov 3, 2026
1ae265c
fix(mobile): keep IME Return from submitting drafts
juliusmarminge Oct 19, 2026
8c99f81
fix(mobile): preserve hardware keys forwarded by IMEs
juliusmarminge Oct 19, 2026
07a1e79
fix(server): checkpoints no longer rehash every file when one entry i…
juliusmarminge Nov 3, 2026
be2b116
test(mobile): keep fork paste and drop coverage beside #15030's keybo…
yvesoddly Nov 3, 2026
e0f69e9
fix(web,mobile): chat images reload when the agent rewrites the file …
juliusmarminge Nov 3, 2026
e8db066
chore(fork): track the updated carried PRs and drop superseded #19424
yvesoddly Nov 3, 2026
e1e520c
fix(web): show the project pin before the remote badge (#29704)
maria-rcks Nov 3, 2026
4cd144f
Merge upstream pingdotgg/t3code main into fork (through e1e520c9)
yvesoddly Nov 3, 2026
2caa5a5
fix(cursor): usage keeps the CLI login's account beside another insta…
yvesoddly Nov 3, 2026
d08d16d
fix(cursor): a failing API key no longer hides the Keychain enable pr…
yvesoddly Nov 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 6 additions & 12 deletions .github/fork/carried-prs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"prs": [
{
"number": 15030,
"takenSha": "a2d855c9f602d50da63fea6c07d3ca6c7db36655",
"takenSha": "10a559eb78969c6b4338baa550a8383506ffb0a2",
"reason": "iOS race fixes and Android keyboard parity"
},
{
Expand All @@ -25,31 +25,25 @@
},
{
"number": 17890,
"takenSha": "0a5d3e0083e43946b180dc4cc89568af111c645c",
"takenSha": "8f5b0434d7404ca8d1cfa0f60c62b79a7b719b1a",
"reason": "Android subscription usage widgets",
"note": "8f5b0434d7 only merges upstream main into the PR; the fork resolved the same merge itself.",
"closedUpstream": true
},
{
"number": 18634,
"takenSha": "6485555d5d7c365849dd6def5a335c8171238ccf",
"takenSha": "dc6f194db92178418f6aa34ceeb2bc4577ab0b17",
"reason": "Android tablets launched in landscape open full screen"
},
{
"number": 18839,
"takenSha": "457acb425c5fa5d5248bc0ed646b5ccb68f8f256",
"takenSha": "9d3aac8a0ee60a1883f067185ca1a9705e385360",
"reason": "Android PR viewer keeps the chat back stack"
},
{
"number": 19273,
"takenSha": "c983c522ad9c2e3ffd5735cdbfca6c073f9cde95",
"takenSha": "b8d5c37cf59f7989edaf14dea2822f28ae841fdb",
"reason": "Local-model composer dictation"
},
{
"number": 19424,
"takenSha": "9e5e520f786566b3004a004efc9e21817ad49e9c",
"reason": "Android foldables use the sidebar header",
"note": "Took only the first two commits. Upstream superseded it with merged #21071, #20812 and #20813.",
"closedUpstream": true
}
]
}
8 changes: 8 additions & 0 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ jobs:
native/hyprland-snap-shot/target/${{ inputs.rust_target }}/release/t3-hyprland-snap-shot
key: linux-capture-helpers-${{ inputs.rust_target }}-${{ hashFiles('native/kde-snap-shot/Cargo.lock', 'native/kde-snap-shot/Cargo.toml', 'native/kde-snap-shot/src/**', 'native/hyprland-snap-shot/Cargo.lock', 'native/hyprland-snap-shot/Cargo.toml', 'native/hyprland-snap-shot/src/**', 'native/hyprland-snap-shot/protocols/**') }}

- name: Ensure Rosetta for macOS x64 bytecode generation
if: inputs.platform == 'mac' && inputs.arch == 'x64'
shell: bash
run: |
if [[ "$(uname -m)" == "arm64" ]] && ! /usr/bin/arch -x86_64 /usr/bin/true; then
sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi
- name: Setup Rust
if: steps.resource_monitor_cache.outputs.cache-hit != 'true' || (inputs.platform == 'linux' && steps.capture_helper_cache.outputs.cache-hit != 'true')
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# T3 Code

T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity) and serves web, desktop, and mobile clients.
T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity, Kiro) and serves web, desktop, and mobile clients.

You can think of T3 Code as an open source "bring-your-own-subscription" alternative to apps like Claude Desktop, Codex App, Cursor Glass and Conductor.

Expand Down Expand Up @@ -68,7 +68,7 @@ The most common defect in this repo is a change that works on the path you teste

- **Entry points.** A behavior reachable from the chat view is usually also reachable from Settings, the command palette, and a keybinding. Fixing one is not fixing the feature.
- **Clients.** Web, desktop (wraps web, adds Electron shell/IPC), and mobile (React Native, separate navigation). Shared logic lives in `packages/client-runtime`
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, and Antigravity each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, Antigravity, and Kiro each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
- **Agents.** A capability a user can trigger is usually one an agent should reach through MCP tools, and scheduled tasks run the same paths. That only works when it is a service method, not handler code.
- **Contracts.** Anything crossing the wire is typed in `packages/contracts`. Change the schema and the server, web, mobile, and desktop all follow.
- **Reverse states.** If you added a way in, add the way out and the way to see it. Snooze needs unsnooze. Close needs reopen. A one-way door is a bug.
Expand Down
233 changes: 233 additions & 0 deletions apps/desktop/src/app/DesktopApp.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
import { assert, it } from "@effect/vitest";
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as HttpClient from "effect/http/HttpClient";
import * as NetService from "@t3tools/shared/Net";
import * as Fiber from "effect/Fiber";
import * as Option from "effect/Option";
import * as Ref from "effect/Ref";
import * as Stream from "effect/Stream";
import { vi } from "vite-plus/test";

vi.mock("electron", () => ({}));
vi.mock("@clerk/electron", () => ({ createClerkBridge: vi.fn() }));
vi.mock("@clerk/electron/storage", () => ({ storage: vi.fn() }));
vi.mock("../ipc/DesktopIpcHandlers.ts", () => ({
installDesktopIpcHandlers: () => Effect.void,
}));
vi.mock("../updates/DesktopRemoteUpdates.ts", () => ({ listen: Effect.void }));
vi.mock("./DesktopStartupRecovery.ts", () => ({ listen: Effect.void }));

import * as DesktopApp from "./DesktopApp.ts";
import * as DesktopAppActivation from "./DesktopAppActivation.ts";
import * as DesktopAppIdentity from "./DesktopAppIdentity.ts";
import * as DesktopClerk from "./DesktopClerk.ts";
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
import * as DesktopLegacyLocalStorage from "./DesktopLegacyLocalStorage.ts";
import * as DesktopLifecycle from "./DesktopLifecycle.ts";
import * as DesktopLinuxUrlHandler from "./DesktopLinuxUrlHandler.ts";
import * as DesktopPreReadyPlatform from "./DesktopPreReadyPlatform.ts";
import * as DesktopShutdown from "./DesktopShutdown.ts";
import * as DesktopState from "./DesktopState.ts";
import * as DesktopBackendPool from "../backend/DesktopBackendPool.ts";
import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts";
import * as ElectronApp from "../electron/ElectronApp.ts";
import * as ElectronDialog from "../electron/ElectronDialog.ts";
import * as ElectronProtocol from "../electron/ElectronProtocol.ts";
import * as ElectronSafeStorage from "../electron/ElectronSafeStorage.ts";
import * as PreviewPasskeys from "../preview/Passkeys.ts";
import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts";
import * as DesktopShellEnvironment from "../shell/DesktopShellEnvironment.ts";
import * as DesktopSnapShot from "../snapShot/DesktopSnapShot.ts";
import * as DesktopRendererHistory from "../telemetry/DesktopRendererHistory.ts";
import * as DesktopUpdates from "../updates/DesktopUpdates.ts";
import * as DesktopApplicationMenu from "../window/DesktopApplicationMenu.ts";
import * as DesktopWindow from "../window/DesktopWindow.ts";
import * as DesktopWslBackend from "../wsl/DesktopWslBackend.ts";

import * as BrowserImport from "../preview/BrowserImport/BrowserImport.ts";
import * as DesktopBackendConfiguration from "../backend/DesktopBackendConfiguration.ts";
import * as DesktopCliCommand from "./DesktopCliCommand.ts";
import * as DesktopClientSettings from "../settings/DesktopClientSettings.ts";
import * as DesktopConnectionCatalogStore from "./DesktopConnectionCatalogStore.ts";
import * as DesktopIpc from "../ipc/DesktopIpc.ts";
import * as DesktopLocalEnvironmentAuth from "../backend/DesktopLocalEnvironmentAuth.ts";
import * as DesktopManagedPolicy from "./DesktopManagedPolicy.ts";
import * as DesktopSshEnvironment from "../ssh/DesktopSshEnvironment.ts";
import * as DesktopSshPasswordPrompts from "../ssh/DesktopSshPasswordPrompts.ts";
import * as DesktopTelemetryPublisher from "../telemetry/DesktopTelemetryPublisher.ts";
import * as DesktopWebLinks from "./DesktopWebLinks.ts";
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
import * as ElectronMenu from "../electron/ElectronMenu.ts";
import * as ElectronShell from "../electron/ElectronShell.ts";
import * as ElectronTheme from "../electron/ElectronTheme.ts";
import * as ElectronWindow from "../electron/ElectronWindow.ts";
import * as MacPermissions from "../permissions/MacPermissions.ts";
import * as PreviewManager from "../preview/Manager.ts";

it.effect(
"starts the backend and window while Linux registration is stalled and cancels it on shutdown",
() =>
Effect.gen(function* () {
const registrationStarted = yield* Deferred.make<void>();
const releaseRegistration = yield* Deferred.make<void>();
const registrationStopped = yield* Deferred.make<void>();
const windowStarted = yield* Deferred.make<void>();
const quitting = yield* Ref.make(false);
const events: string[] = [];
const record = (event: string) =>
Effect.sync(() => {
events.push(event);
});
const runApp = DesktopApp.program
.pipe(
Effect.provide(NodeCrypto.layer),
Effect.provideService(DesktopAppIdentity.DesktopAppIdentity, {
resolveUserDataPath: Effect.succeed("/isolated/userdata"),
configure: record("identity"),
} as DesktopAppIdentity.DesktopAppIdentity["Service"]),
Effect.provideService(ElectronApp.ElectronApp, {
setPath: () => Effect.void,
whenReady: record("ready"),
} as unknown as ElectronApp.ElectronApp["Service"]),
Effect.provideService(ElectronDialog.ElectronDialog, {
showErrorBox: () => Effect.die("unexpected fatal startup error"),
} as unknown as ElectronDialog.ElectronDialog["Service"]),
Effect.provideService(DesktopEnvironment.DesktopEnvironment, {
platform: "linux",
isDevelopment: false,
isPackaged: true,
configuredBackendPort: Option.some(3773),
defaultDesktopSettings: { serverExposureMode: "local-only" },
} as unknown as DesktopEnvironment.DesktopEnvironment["Service"]),
Effect.provideService(DesktopPreReadyPlatform.DesktopPreReadyElectronOptions, {
linux: null,
linuxPasswordStoreCommandLine: "basic",
}),
Effect.provideService(DesktopShellEnvironment.DesktopShellEnvironment, {
installIntoProcess: Effect.succeed(true),
awaitDiscovery: Effect.succeed(true),
updates: Stream.empty,
}),
Effect.provideService(DesktopAppSettings.DesktopAppSettings, {
load: Effect.void,
get: Effect.succeed({
localEnvironmentEnabled: true,
serverExposureMode: "local-only",
}),
} as unknown as DesktopAppSettings.DesktopAppSettings["Service"]),
Effect.provideService(DesktopLifecycle.DesktopLifecycle, {
register: Effect.void,
relaunch: () => Effect.void,
}),
Effect.provideService(DesktopClerk.DesktopClerk, {
configure: Effect.void,
} as DesktopClerk.DesktopClerk["Service"]),
Effect.provideService(ElectronSafeStorage.ElectronSafeStorage, {
selectedStorageBackend: Effect.succeedNone,
} as unknown as ElectronSafeStorage.ElectronSafeStorage["Service"]),
Effect.provideService(PreviewPasskeys.PreviewPasskeys, {
configure: Effect.void,
} as PreviewPasskeys.PreviewPasskeys["Service"]),
Effect.provideService(DesktopApplicationMenu.DesktopApplicationMenu, {
configure: Effect.void,
}),
Effect.provideService(DesktopUpdates.DesktopUpdates, {
configure: Effect.void,
} as unknown as DesktopUpdates.DesktopUpdates["Service"]),
Effect.provideService(DesktopLinuxUrlHandler.DesktopLinuxUrlHandler, {
register: Deferred.succeed(registrationStarted, undefined).pipe(
Effect.andThen(Deferred.await(releaseRegistration)),
Effect.ensuring(Deferred.succeed(registrationStopped, undefined)),
),
}),
)
.pipe(
Effect.provideService(ElectronProtocol.ElectronProtocol, {
registerDesktopProtocol: () => Effect.void,
} as unknown as ElectronProtocol.ElectronProtocol["Service"]),
Effect.provideService(DesktopLegacyLocalStorage.DesktopLegacyLocalStorage, {
load: () => Effect.void,
} as unknown as DesktopLegacyLocalStorage.DesktopLegacyLocalStorage["Service"]),
Effect.provideService(DesktopSnapShot.DesktopSnapShot, {
initialize: Effect.void,
} as DesktopSnapShot.DesktopSnapShot["Service"]),
Effect.provideService(DesktopState.DesktopState, {
quitting,
} as DesktopState.DesktopState["Service"]),
Effect.provideService(DesktopWindow.DesktopWindow, {
ensureMain: record("window").pipe(
Effect.andThen(Deferred.succeed(windowStarted, undefined)),
),
} as unknown as DesktopWindow.DesktopWindow["Service"]),
Effect.provideService(DesktopBackendPool.DesktopBackendPool, {
primary: Effect.succeed({
start: record("backend"),
currentConfig: Effect.succeedSome({ preflightFailure: Option.none() }),
}),
list: Effect.succeed([]),
} as unknown as DesktopBackendPool.DesktopBackendPool["Service"]),
Effect.provideService(DesktopServerExposure.DesktopServerExposure, {
configureFromSettings: () => Effect.succeed({ mode: "local-only" }),
backendConfig: Effect.succeed({ httpBaseUrl: new URL("http://127.0.0.1:3773") }),
} as unknown as DesktopServerExposure.DesktopServerExposure["Service"]),
Effect.provideService(DesktopWslBackend.DesktopWslBackend, {
reconcile: Effect.void,
} as DesktopWslBackend.DesktopWslBackend["Service"]),
Effect.provideService(DesktopAppActivation.DesktopAppActivation, {
start: Effect.void,
} as unknown as DesktopAppActivation.DesktopAppActivation["Service"]),
Effect.provideService(DesktopRendererHistory.DesktopRendererHistory, {
shutdown: Effect.void,
} as DesktopRendererHistory.DesktopRendererHistory["Service"]),
);
const app = yield* runApp.pipe(
Effect.provide(
Layer.mergeAll(
Layer.mock(BrowserImport.BrowserImport, {}),
Layer.mock(DesktopBackendConfiguration.DesktopBackendConfiguration, {}),
Layer.mock(DesktopCliCommand.DesktopCliCommand, {}),
Layer.mock(DesktopClientSettings.DesktopClientSettings, {}),
Layer.mock(DesktopConnectionCatalogStore.DesktopConnectionCatalogStore, {}),
Layer.mock(DesktopIpc.DesktopIpc, {}),
Layer.mock(DesktopLocalEnvironmentAuth.DesktopLocalEnvironmentAuth, {}),
Layer.mock(DesktopManagedPolicy.DesktopManagedPolicy, {}),
Layer.mock(DesktopSshEnvironment.DesktopSshEnvironment, {}),
Layer.mock(DesktopSshPasswordPrompts.DesktopSshPasswordPrompts, {}),
Layer.mock(DesktopTelemetryPublisher.DesktopTelemetryPublisher, {}),
Layer.mock(DesktopWebLinks.DesktopWebLinks, {}),
Layer.mock(DesktopWslEnvironment.DesktopWslEnvironment, {}),
Layer.mock(ElectronMenu.ElectronMenu, {}),
Layer.mock(ElectronShell.ElectronShell, {}),
Layer.mock(ElectronTheme.ElectronTheme, {}),
Layer.mock(ElectronWindow.ElectronWindow, {}),
Layer.mock(MacPermissions.MacPermissions, {}),
Layer.mock(PreviewManager.PreviewManager, {
isBrowserPartition: () => {
throw new Error("unexpected browser partition lookup");
},
}),
FileSystem.layerNoop({}),
Layer.mock(NetService.NetService, {}),
Path.layer,
Layer.succeed(
HttpClient.HttpClient,
HttpClient.make(() => Effect.die("unexpected HTTP request")),
),
),
),
Effect.forkScoped,
);
yield* Deferred.await(registrationStarted);
yield* Deferred.await(windowStarted);
assert.deepEqual(events, ["identity", "ready", "identity", "backend", "window"]);
assert.isFalse(yield* Deferred.isDone(registrationStopped));
yield* (yield* DesktopShutdown.DesktopShutdown).request;
yield* Fiber.join(app);
assert.isTrue(yield* Deferred.isDone(registrationStopped));
}).pipe(Effect.provide(DesktopShutdown.layer)),
);
9 changes: 5 additions & 4 deletions apps/desktop/src/app/DesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";

import * as NetService from "@t3tools/shared/Net";
import * as Crypto from "effect/Crypto";
import * as SecureRandom from "effect/crypto/SecureRandom";
import * as ElectronApp from "../electron/ElectronApp.ts";
import * as ElectronDialog from "../electron/ElectronDialog.ts";
import * as ElectronProtocol from "../electron/ElectronProtocol.ts";
Expand Down Expand Up @@ -42,8 +42,8 @@ const DEFAULT_DESKTOP_BACKEND_PORT = 3773;
const MAX_TCP_PORT = 65_535;
const DESKTOP_BACKEND_PORT_PROBE_HOSTS = ["127.0.0.1", "0.0.0.0", "::"] as const;

const makeDesktopRunId = Crypto.Crypto.pipe(
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
const makeDesktopRunId = SecureRandom.SecureRandom.pipe(
Effect.flatMap((random) => random.uuidV4()),
Effect.map((value) => value.replaceAll("-", "").slice(0, 12)),
);

Expand Down Expand Up @@ -337,7 +337,8 @@ const startup = Effect.gen(function* () {
yield* updates.configure;
yield* DesktopRemoteUpdates.listen;
yield* DesktopStartupRecovery.listen;
yield* linuxUrlHandler.register;
// Portal identity is prepared pre-ready; MIME helpers must not gate the backend or window.
yield* linuxUrlHandler.register.pipe(Effect.forkScoped);
yield* bootstrap.pipe(Effect.catchCause((cause) => fatalStartupCause("bootstrap", cause)));
}).pipe(Effect.withSpan("desktop.startup"));

Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, describe, it } from "@effect/vitest";
import { ConnectionCatalogDocument } from "@t3tools/client-runtime/platform";
Expand Down Expand Up @@ -75,6 +76,7 @@ function layerFor(
layerEnvironment,
layerSafeStorage,
NodeServices.layer,
NodeCrypto.layer,
fileSystemLayer,
);
const layerSavedEnvironments = DesktopSavedEnvironments.layer.pipe(
Expand Down
Loading
Loading