Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
d2bdd58
fix(server): npm provider updates only offer versions npm will instal…
davisonio Nov 14, 2026
5e06246
fix(web): recovered queued edits keep their mentions and context (#36…
StiensWout Nov 14, 2026
35d01dc
perf(acp): long ACP threads reopen without per-chunk history copies (…
only21mil Nov 14, 2026
4d5d5f8
fix(source-control): preserve .git in Azure DevOps repository names (…
StiensWout Nov 14, 2026
4652544
fix(server): interrupted checkpoints no longer leak temporary packs (…
razzeee Nov 14, 2026
306914f
fix(client-runtime): grouped projects no longer take one folder's nam…
ThomasVuNguyen Nov 14, 2026
bebaf3e
fix(pi): resumed threads run in the worktree after a handoff (#36586)
juliusmarminge Nov 14, 2026
d0a494f
fix(server): honor the configured push remote on tracked branches (#2…
only21mil Nov 14, 2026
000d82d
fix(web): Esc closes the theme editor, not Settings (#25130)
AatmanAJ Nov 14, 2026
c0b140b
fix(server): file changes with an empty list keep their file name (#3…
MinitJain Nov 14, 2026
b4c1bd1
fix(web): re-picking the current model in Settings keeps its traits (…
f4llenz Nov 14, 2026
2b6145b
fix(web): browser tests no longer pick a port Windows has reserved (#…
Zacharon Nov 14, 2026
e4688f7
fix(server): find files in newline-named nested worktrees (#36588)
StiensWout Nov 14, 2026
28f1786
fix(web): recreated folders no longer show deleted files (#36590)
StiensWout Nov 14, 2026
3b18dc2
fix(web): manual compaction counts history beyond the loaded page (#2…
jason5545 Nov 14, 2026
2fa77fb
fix(web): horizontal table scrolling preserves timeline follow (#24045)
nateEc Nov 14, 2026
83a276d
fix(server): setup scripts complete with shell line editors (#25472)
maria-rcks Nov 14, 2026
a61291e
fix(shared): one-letter link schemes no longer become file links on W…
Zacharon Nov 14, 2026
4192234
fix(usage): distinct email-less hub accounts no longer collapse (#36561)
StiensWout Nov 14, 2026
75c544a
fix(pi): async pi-subagents workflow, chain and parallel members show…
juliusmarminge Nov 14, 2026
651accb
fix(web): new browser tabs open at your default zoom and appearance (…
BilalIrfanContact Nov 14, 2026
9e19b7f
feat(server): resume stopped provider threads natively (#36526)
Yash-Singh1 Nov 14, 2026
4574c60
fix(web): preserve saved notebook traceback frame boundaries (#36602)
StiensWout Nov 14, 2026
d6244ac
fix(web): preserve literal entities in EPUB CDATA (#36595)
StiensWout Nov 14, 2026
953ce60
fix(web): changed root files with a leading space open in the diff pa…
StiensWout Nov 14, 2026
43ba62b
fix(server): thread reads wait for pending background work (#36610)
StiensWout Nov 14, 2026
91fa913
fix(server): partial import retries no longer certify missing message…
StiensWout Nov 14, 2026
4b99420
fix(server): background subagents stop running when their Claude sess…
juliusmarminge Nov 14, 2026
b37c959
fix(server): open colon-number project folders correctly in VS Code (…
StiensWout Nov 14, 2026
4121b30
fix(mobile): the open button no longer covers inline page headings (#…
saphid Nov 14, 2026
02e29ce
perf(usage): show saved totals before scanning history (#25711)
hieu-lee Nov 14, 2026
89f1acb
fix(pi): text generation uses the thinking level picked in Settings (…
MarcoDotIO Nov 14, 2026
0fee26d
fix(mobile): launch terminal commands after the measured resize (#36584)
StiensWout Nov 14, 2026
13f89ae
fix(server): repeated imports reach older worktree history (#36608)
StiensWout Nov 14, 2026
8a072ca
fix(ci): pin unenv so release smoke installs resolve its exact peer (…
juliusmarminge Nov 14, 2026
38b3fee
fix(server): cached refs include a newly checked-out external branch …
StiensWout Nov 14, 2026
820f620
fix(web): model picks no longer inherit another model’s traits (#36621)
StiensWout Nov 14, 2026
298c38d
fix(server): subagent hover cards show reasoning effort again (#35333)
Bil0000 Nov 14, 2026
f3b43ef
fix(server): a hung Codex app-server no longer blocks every later Cod…
MahirAbbas Nov 14, 2026
df8c1a1
fix(web): Narrator highlights the sidebar thread title where it is dr…
SunkenInTime Nov 14, 2026
f2764f7
fix(desktop): desktop tests no longer race to install Electron (#26654)
Moinax Nov 14, 2026
9ff435b
fix(server): pause service restart when disk is full (#25924)
gyurix Nov 14, 2026
4c2f04d
fix(web): queued runs, relationships and changed files no longer re-r…
Batuhan1999 Nov 14, 2026
487733b
fix(server): recover Claude cooldown reset times from proxy errors (#…
juliusmarminge Nov 14, 2026
5958d00
perf(web): Update everything downloads a server's update while provid…
Bil0000 Nov 14, 2026
6be1bd6
perf(cursor): long command output streams without copying its tail pe…
hieu-lee Nov 14, 2026
c5f842d
fix(server): regenerate titles on fresh run forks (#36637)
StiensWout Nov 14, 2026
6aa14d3
fix(server): short search prefixes find accented messages (#36632)
StiensWout Nov 14, 2026
060ac23
fix(devices): explain missing npm during tool updates (#27084)
kristofkatzenberger Nov 14, 2026
5ba3a84
fix(server): a locked database no longer leaves a thread stuck in "st…
juliusmarminge Nov 14, 2026
0a8aaa3
fix(server): retained forks keep inherited shell item counts after so…
juliusmarminge Nov 14, 2026
08ba9df
chore(sync): merge pingdotgg/t3code main
Yarden-zamir Nov 14, 2026
bc1dc2a
fix(mobile): keep the thread column out of the iPhone Duo fold (#26923)
chekdotdev Nov 14, 2026
77ad2eb
fix(server): end obsolete link cards after a matching retry succeeds …
stevan-borus Nov 14, 2026
071ae4e
fix(server): deleted projects keep their worktree cleanup policy (#36…
StiensWout Nov 14, 2026
179c032
fix(server): include managed Claude skills in the skill menu (#26732)
greyxp1 Nov 14, 2026
3d3275b
fix(server): PR checkout respects restricted fetch mappings (#27853)
amartani Nov 14, 2026
121f0cf
fix(server): t3_thread_list clamps an oversized limit instead of fail…
MarcoDotIO Nov 14, 2026
0c306f4
fix(ssh): wait for a boot service's server instead of starting a seco…
juliusmarminge Nov 14, 2026
ae49f4d
fix(server): honor custom Claude thinking choices (#28024)
chisewaguri Nov 14, 2026
8cb551a
fix(web): saved files show external edits after a failed reload (#36664)
StiensWout Nov 14, 2026
1159aa2
fix(client-runtime): preserve PR reference links across embedded medi…
StiensWout Nov 14, 2026
913d7fc
fix(web): PageUp and PageDown shortcut labels no longer read Pageup a…
only21mil Nov 14, 2026
1535f3f
fix(desktop): theme changes no longer stop at windows without a title…
swsammy Nov 14, 2026
bb9fde6
fix(scripts): test:cached no longer crashes when vp writes no cache s…
only21mil Nov 14, 2026
8a45c51
fix(desktop): Browser Screenshot saves fresh pixels while T3 Code is …
Quicksaver Nov 14, 2026
92c91aa
fix(client-runtime): keep inherited qualifier values as PR search tex…
Motaghi Nov 14, 2026
0acca1d
fix(server): Resume keeps unaccepted replacement images (#36677)
StiensWout Nov 14, 2026
6effe74
fix(web): show repeated table rows and cells in ODT previews (#36689)
StiensWout Nov 14, 2026
f161a4d
fix(shared): preserve literal ampersands in citation Markdown paths (…
Motaghi Nov 14, 2026
fd6d0ea
fix(web): stashing waits for pasted images to finish compressing (#28…
only21mil Nov 14, 2026
ead133c
fix(web): SSH port field no longer turns 22.5 into port 22 (#28297)
only21mil Nov 14, 2026
ae83739
fix(server): analytics record the thread binding a scheduled task act…
only21mil Nov 14, 2026
e096dee
fix(web): the publish-repository path no longer submits on an IME com…
only21mil Nov 14, 2026
96735d7
fix(web): picking a sidebar search result scrolls the list to that th…
tsmith165 Nov 14, 2026
c3517ec
fix(shared): theme CSS checks allow url() inside a quoted data: addre…
juliusmarminge Nov 14, 2026
0e5e0bb
fix(mobile): removing an environment no longer fails when a queued me…
only21mil Nov 14, 2026
19f6438
fix(server): interrupted checkpoint restores no longer leave files st…
StiensWout Nov 14, 2026
71c2410
fix(web): thread details slides in on close (#28929)
Claudesaul Nov 14, 2026
f4e65cd
fix(contracts): a null model selection options value is treated as om…
jieyuexing Nov 14, 2026
250e502
fix(mobile): scheduled-task edits made in quick succession are no lon…
tcrapts Nov 14, 2026
dafd053
fix(mobile): closed PR numbers match their red icon in the thread lis…
tris203 Nov 14, 2026
13a6782
fix(web): ODS time cells without display text show their value (#36685)
StiensWout Nov 14, 2026
cb35acc
test(web): queued runs fork test mocks the quiet projection hook
Yarden-zamir Nov 14, 2026
0fdc99c
fix(web): notebook previews strip ANSI colors from saved tracebacks (…
juliusmarminge Nov 14, 2026
414d938
fix(server): publish Create PR branches to split push URLs (#36695)
StiensWout Nov 14, 2026
0200dcf
perf(shared): queued SQLite reads stop waiting on one reader while an…
Pyseph Nov 14, 2026
7fcb9ce
Merge pull request #553 from Yarden-zamir/fork-sync/2026-11-14-1038
Yarden-zamir Nov 14, 2026
b28dc0e
perf(mobile): Changes tab no longer redraws every file when one chang…
Yuruzuu Nov 14, 2026
243d66a
fix(server): first commit dialog shows net file changes (#36716)
StiensWout Nov 14, 2026
740a7cc
fix(marketing): download page shows its Releases fallback when the Gi…
only21mil Nov 14, 2026
cb6670b
fix(server): a timed-out Git check no longer turns off threads withou…
jux310 Nov 14, 2026
666631e
fix(web): copied inline code keeps meaningful edge spaces (#36712)
StiensWout Nov 14, 2026
b90ffea
fix(mobile): drop duplicate attachments, as on web (#29143)
ahalekelly Nov 14, 2026
e2f164d
fix(web): let subagent lists pass scrolling to the details panel (#28…
Alb11747 Nov 14, 2026
a678948
fix(web): pending-question digit shortcuts ignore dialogs, menus and …
only21mil Nov 14, 2026
d9973dc
fix(mobile): a shared file no longer fails to send with "Too much con…
derektrimm Nov 14, 2026
9ff79db
chore(sync): merge pingdotgg/t3code main
Yarden-zamir Nov 14, 2026
0e250fa
fix(server): selected-file commits keep a conflicted multi-commit che…
only21mil Nov 14, 2026
20d21cf
fix(mobile): disabled send arrow no longer darkens where its strokes …
RVZO6 Nov 14, 2026
5fa95d9
fix(opencode): wait for the whole listening line before reading the s…
only21mil Nov 14, 2026
331bc9a
fix(mobile): project default model switch uses the updater form of se…
Yarden-zamir Nov 14, 2026
35483c1
fix(opencode): show usage-limit warnings while OpenCode 2 retries (#2…
only21mil Nov 14, 2026
5e27bae
fix(web): a stashed prompt keeps its machine mentions (#28780)
only21mil Nov 14, 2026
a575d45
fix(web,server): the branch label no longer flips back after a switch…
Yuruzuu Nov 14, 2026
77d3358
fix(server): ACP teardown survives processes exiting during the /proc…
juliusmarminge Nov 14, 2026
e72dd50
fix(client): closed terminal views release the shared grid (#36647)
StiensWout Nov 14, 2026
cc0a7bb
fix(shared): file links with parentheses in the path keep their paren…
Abhishek-B-R Nov 14, 2026
f84ad6f
fix(web): discarded drafts stay discarded after image compression (#3…
StiensWout Nov 14, 2026
96ca66f
fix(server): a nested repository with no commits no longer breaks the…
Abhishek-B-R Nov 14, 2026
e26e21c
fix(web,mobile): bound scheduled tasks no longer offer a model their …
juliusmarminge Nov 14, 2026
0788555
fix(shared): honor Windows PATHEXT regardless of key casing (#29376)
luke2x Nov 14, 2026
acd192f
fix(web): removing an environment dismisses its notification toasts (…
StiensWout Nov 14, 2026
2b596b8
fix(web): context meter no longer keeps the retired provider's usage …
karrambol Nov 14, 2026
49d63f1
test(mobile): scheduled task switch mock names each switch by its label
Yarden-zamir Nov 14, 2026
76748e9
test(web): wait for Settings focus before testing the theme editor's …
juliusmarminge Nov 14, 2026
e53417b
fix(server): selected-file commits work again with Git older than 2.2…
only21mil Nov 14, 2026
64d70f8
fix(mobile): sort pull request lists and timelines by time (#28391)
only21mil Nov 14, 2026
1601081
Merge pull request #554 from Yarden-zamir/fork-sync/2026-11-14-1240
Yarden-zamir Nov 14, 2026
db0ae7b
fix(acp): a blank line from an ACP agent no longer ends the session (…
only21mil Nov 14, 2026
3d9aeaf
fix(shared): preview semicolon-separated CSV files as tables (#36738)
SouthCarpet Nov 14, 2026
34a7c0d
fix(cursor): preserve catalog aliases in model discovery (#36752)
StiensWout Nov 14, 2026
68bc281
fix(desktop): Settings opens while the separate preview window has fo…
StiensWout Nov 14, 2026
629242b
fix(server): long scheduled-task titles no longer end in a broken cha…
only21mil Nov 14, 2026
616067d
fix(web): pressing Enter in the Add CLIProxyAPI hub dialog adds the h…
preetsuthar17 Nov 14, 2026
3b816cf
fix(web): ChatGPT sign-in error no longer points to a missing redirec…
juliusmarminge Nov 14, 2026
12102c7
fix(web,mobile): Linked environments shows links made outside the app…
Nabil372 Nov 14, 2026
719042d
fix(server): MCP-launched threads no longer flash in Inbox before Wor…
mmmattG Nov 14, 2026
566370f
fix(server): storage cleanup no longer reports idle threads on a bran…
only21mil Nov 14, 2026
9441a72
fix(mobile): Reconnect and Retry now on a switched-off environment sw…
only21mil Nov 14, 2026
77a39e9
fix(server): cancelling worktree setup removes its unclaimed worktree…
StiensWout Nov 14, 2026
5fe2f7e
fix(web): diagnostics no longer shows near-second spans as "1000 ms" …
M0xoo Nov 14, 2026
313f601
fix(server): Browser tab titles follow page title changes (#36764)
StiensWout Nov 14, 2026
10a44f5
fix(web): RTF previews keep named spaces, hyphens and joiners (#36767)
StiensWout Nov 14, 2026
0351dbb
fix(acp): refused and limit-stopped turns no longer show as completed…
only21mil Nov 14, 2026
6cb47ac
fix(web): Escape that cancels a thread rename no longer also closes t…
preetsuthar17 Nov 14, 2026
3908c4e
fix(terminal): answer OSC color queries so CLIs pick light colors (#3…
juliusmarminge Nov 14, 2026
f52e5c1
fix(server): expand Windows home-relative file paths consistently (#2…
luke2x Nov 14, 2026
081a5d9
fix(clients): the folder picker finds folders with accented names on …
saphid Nov 14, 2026
cebdf39
fix(web): cancelled queued-message edits release their staged uploads…
saphid Nov 14, 2026
0c6f421
perf(desktop): stop rebroadcasting preview ownership on every key (#2…
voltcrash Nov 14, 2026
c666345
fix(web): subagent previews drop image marks and full link URLs (#29637)
saphid Nov 14, 2026
c0ee5a1
fix(server): pushing a branch whose remote branch was deleted publish…
saphid Nov 14, 2026
4ce60c1
fix(mobile): @path search no longer offers the previous worktree's fi…
juliusmarminge Nov 14, 2026
e330593
fix(web): bare URLs no longer swallow Arabic commas and question mark…
newer97 Nov 14, 2026
e5d4322
fix(server): expand unchanged lines beside Git ident keywords (#36774)
StiensWout Nov 14, 2026
c2b06f9
perf(server): Cursor turns no longer write every streamed token to pr…
saphid Nov 14, 2026
4747472
fix(web): clear failed badges when threads are opened (#28616)
BilalIrfanContact Nov 14, 2026
43a71d9
fix(web): a terminal reopened while its open is pending no longer clo…
Salloxy Nov 14, 2026
1c18c16
perf(server): ACP subagent replies no longer rewrite the database on …
M0xoo Nov 14, 2026
4954322
fix(web): don't send completion notifications for snoozed threads (#2…
maximkes Nov 14, 2026
cc578d5
fix(server): settling a usage-limited thread disarms recovery and nam…
EhsanulHaqueSiam Nov 14, 2026
45ff3f5
fix(desktop): bound screencast delivery to slow consumers (#28518)
HomemadeToast57 Nov 14, 2026
1fcb245
fix(server): Claude API-key logins show as Claude API Key in provider…
saphid Nov 14, 2026
86ec940
fix(mobile): a failed archive or delete keeps the earlier Undo (#29628)
saphid Nov 14, 2026
4017eee
chore(sync): merge pingdotgg/t3code main
Yarden-zamir Nov 14, 2026
66a40c7
fix(server): turns stuck in provider retries for 10 minutes fail inst…
jieyuexing Nov 14, 2026
382312a
fix(web): the sidebar shortcut honors terminal and preview focus cond…
saphid Nov 14, 2026
b05c505
fix(mobile): review comment cards keep a trailing blank line in their…
saphid Nov 14, 2026
f751c84
fix(web): the new-thread project picker follows the manual project or…
saphid Nov 14, 2026
0f50b5f
fix(mobile): deleting a thread clears its unsent draft (#29564)
saphid Nov 14, 2026
997b304
fix(server): editing a queued message deletes the attachments you rem…
saphid Nov 14, 2026
c342f3d
fix(web): settled threads no longer offer a PR watch the server refus…
saphid Nov 14, 2026
0457241
fix(clients): a one-hour snooze no longer reads "2h left" (#36785)
juliusmarminge Nov 14, 2026
732198d
fix(web): a disabled Push names the real reason when there are local …
juliusmarminge Nov 14, 2026
b5df3c1
fix(web): a scheduled task with a cleared run time no longer saves as…
juliusmarminge Nov 14, 2026
60e4be4
fix(shared): open relative Codex citations with filename punctuation …
StiensWout Nov 14, 2026
00c7290
fix(mobile): assistant panel uses upstream's restore option for attac…
Yarden-zamir Nov 14, 2026
8b633d9
fix(web): PDF find matches curly quotes when you type straight ones (…
saphid Nov 14, 2026
d3d7ad9
fix(mobile): merging a PR uses the project's default merge method (#2…
saphid Nov 14, 2026
0487654
fix(web): diagnostics CPU time no longer reads "60s" or "60m" (#29395)
M0xoo Nov 14, 2026
8871c26
fix(cursor): shell commands that exit non-zero are recorded as failed…
saphid Nov 14, 2026
5583b26
fix(server,client): preserve literal JSON command output (#36793)
StiensWout Nov 14, 2026
1e9f93a
fix(mobile): stop showing "cannot control this task" while permission…
torztomasz Nov 14, 2026
ee4ef06
fix(web): use optimistic updates for settings across environments (#2…
flamboh Nov 14, 2026
170c1f7
fix(web): Push on the default branch no longer offers a feature branc…
saphid Nov 14, 2026
154c501
fix(web): long preview annotation comments are no longer dropped from…
saphid Nov 14, 2026
554c893
fix(mobile): long pull request searches on iOS no longer fail the lis…
saphid Nov 14, 2026
043d712
fix(shared): atomic saves handle long filenames (#33250)
Lucenx9 Nov 14, 2026
e915057
test(server): worktree tests follow upstream's lock probe and cancel …
Yarden-zamir Nov 14, 2026
48afc47
fix(server): message search no longer finds rolled-back turns or canc…
saphid Nov 14, 2026
776698a
fix(web): OpenDocument slide previews no longer print speaker notes (…
geezoria Nov 14, 2026
0d585f7
fix(mobile): cancelled PR checks count as failing in the checks summa…
saphid Nov 14, 2026
2eb8829
fix(mobile): .markdown, .mdown and .mkd files open with a Markdown pr…
saphid Nov 14, 2026
6829393
test(web): arrow links mock answers upstream's live refresh
Yarden-zamir Nov 14, 2026
49eb9c8
fix(web,mobile): pull request project filter lists pinned projects fi…
saphid Nov 14, 2026
be2a287
fix(server): Claude Fable 5.2 is offered only from Claude Code 2.1.32…
juliusmarminge Nov 14, 2026
6d68333
Merge pull request #555 from Yarden-zamir/fork-sync/2026-11-14-1440
Yarden-zamir Nov 14, 2026
7b26203
fix(mobile): scheduled tasks due within the hour no longer read "Next…
saphid Nov 14, 2026
cfd825c
test(server): title change test ignores a probe pending at browser cl…
t3dotgg Nov 14, 2026
d109866
fix(server): agents can read documents a guest attaches (#29760)
saphid Nov 14, 2026
f05cd35
fix(web): opening a very large folder no longer freezes the Files pan…
thelogicmatrix Nov 14, 2026
abac683
fix(gitlab): a fork's same-named branch no longer hides the branch's …
saphid Nov 14, 2026
b779d40
fix(editors): Open in Zed no longer finds the ZFS event daemon (#33461)
danjdewhurst Nov 14, 2026
77b38f9
fix(server): preview hover and drag fail within their timeout, not up…
only21mil Nov 14, 2026
5a15495
fix(server): skills from CLAUDE_CODE_PLUGIN_DIRS plugins show in the …
DavidMendesOS Nov 14, 2026
17871c7
chore(sync): merge pingdotgg/t3code main
Yarden-zamir Nov 14, 2026
d79ace1
test(server): guest share fork test provides DocumentText
Yarden-zamir Nov 14, 2026
eb91727
Merge pull request #556 from Yarden-zamir/fork-sync/2026-11-14-1638
Yarden-zamir Nov 14, 2026
36a52f5
chore(sync): merge Yarden-zamir/t3code main
TomCohenDev Nov 14, 2026
80bb9ba
style(mobile): format merged ThreadFeed placeholder
TomCohenDev Nov 14, 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
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions apps/desktop/scripts/ensure-electron-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ export function ensureElectronRuntime() {
return electronPath;
}

export function setup() {
ensureElectronRuntime();
}

// `file://${argv[1]}` never matches on Windows (drive letters need `file:///C:/`).
if (process.argv[1] && NodeURL.pathToFileURL(process.argv[1]).href === import.meta.url) {
const electronPath = ensureElectronRuntime();
Expand Down
28 changes: 28 additions & 0 deletions apps/desktop/src/electron/ElectronWindow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,34 @@ describe("ElectronWindow", () => {
}).pipe(Effect.provide(layerTestFor("win32"))),
);

it.effect("reports which windows were created with a title bar overlay", () =>
Effect.gen(function* () {
const framed = { isDestroyed: () => false };
const overlay = { isDestroyed: () => false };
browserWindowMock
.mockImplementationOnce(function FramedWindowMock() {
return framed;
})
.mockImplementationOnce(function OverlayWindowMock() {
return overlay;
});
const electronWindow = yield* ElectronWindow.ElectronWindow;
yield* electronWindow.create({});
yield* electronWindow.create({
titleBarStyle: "hidden",
titleBarOverlay: { color: "#01000000", height: 40 },
});
getAllWindowsMock.mockReturnValue([framed, overlay, { isDestroyed: () => false }]);

const seen: Array<boolean> = [];
yield* electronWindow.syncAllAppearance((_window, { titleBarOverlay }) =>
Effect.sync(() => seen.push(titleBarOverlay)),
);

assert.deepEqual(seen, [false, true, false]);
}).pipe(Effect.provide(layerTestFor("win32"))),
);

it.effect("preserves destroy failures and continues with later windows", () =>
Effect.gen(function* () {
const cause = new Error("window destroy failed");
Expand Down
16 changes: 13 additions & 3 deletions apps/desktop/src/electron/ElectronWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ export class ElectronWindow extends Context.Service<
readonly sendAll: (channel: string, ...args: readonly unknown[]) => Effect.Effect<void>;
readonly destroyAll: Effect.Effect<void>;
readonly syncAllAppearance: <E, R>(
sync: (window: Electron.BrowserWindow) => Effect.Effect<void, E, R>,
sync: (
window: Electron.BrowserWindow,
appearance: { readonly titleBarOverlay: boolean },
) => Effect.Effect<void, E, R>,
) => Effect.Effect<void, E, R>;
}
>()("@t3tools/desktop/electron/ElectronWindow") {}
Expand All @@ -145,6 +148,7 @@ export const make = Effect.gen(function* () {
yield* Effect.addFinalizer(() => Effect.sync(() => windowsForegroundFocus?.close()));
const mainWindowRef = yield* Ref.make<Option.Option<Electron.BrowserWindow>>(Option.none());
const auxiliaryWindows = new WeakSet<Electron.BrowserWindow>();
const titleBarOverlayWindows = new WeakSet<Electron.BrowserWindow>();

const listWindows = Effect.try({
try: () => Electron.BrowserWindow.getAllWindows(),
Expand Down Expand Up @@ -241,6 +245,9 @@ export const make = Effect.gen(function* () {
try: () => {
const window = new Electron.BrowserWindow(options);
if (behavior?.auxiliary === true) auxiliaryWindows.add(window);
if (options.titleBarOverlay !== undefined && options.titleBarOverlay !== false) {
titleBarOverlayWindows.add(window);
}
return window;
},
catch: (cause) => new ElectronWindowCreateError({ options: diagnosticOptions, cause }),
Expand Down Expand Up @@ -383,14 +390,17 @@ export const make = Effect.gen(function* () {
}
}),
syncAllAppearance: Effect.fn("desktop.electron.window.syncAllAppearance")(function* <E, R>(
sync: (window: Electron.BrowserWindow) => Effect.Effect<void, E, R>,
sync: (
window: Electron.BrowserWindow,
appearance: { readonly titleBarOverlay: boolean },
) => Effect.Effect<void, E, R>,
) {
const windows = yield* listWindows;
for (const window of windows) {
if (yield* isWindowDestroyed(window)) {
continue;
}
yield* sync(window);
yield* sync(window, { titleBarOverlay: titleBarOverlayWindows.has(window) });
}
}),
});
Expand Down
69 changes: 65 additions & 4 deletions apps/desktop/src/preview/CdpRelay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
const makeTarget = (
send: CdpRelayTarget["send"],
setDownloadDirectory: CdpRelayTarget["setDownloadDirectory"] = () => {},
ackScreencastFrame: CdpRelayTarget["ackScreencastFrame"] = () => {},
): CdpRelayTarget => ({
send,
targetId: async () => "GUEST-TARGET",
Expand All @@ -17,6 +18,7 @@ const makeTarget = (
userAgent: () => "Electron",
setDownloadDirectory,
receivesScreencast: () => true,
ackScreencastFrame,
});

const makeRelay = (target: CdpRelayTarget, write: (raw: string) => void) =>
Expand Down Expand Up @@ -138,9 +140,13 @@ describe("CDP relay", () => {

describe("CDP relay extra sessions", () => {
it("gives a second page session the page's commands and events", async () => {
const send = vi.fn(async () => ({}));
const send = vi.fn<CdpRelayTarget["send"]>(async () => ({}));
const written: Array<Record<string, unknown>> = [];
const relay = makeRelay(makeTarget(send), (raw) => written.push(JSON.parse(raw)));
const nativeAcks: Array<number> = [];
const relay = makeRelay(
makeTarget(send, undefined, (frameId) => nativeAcks.push(frameId)),
(raw) => written.push(JSON.parse(raw)),
);
relay.receive(JSON.stringify({ id: 1, method: "Target.setAutoAttach", params: {} }));
relay.receive(JSON.stringify({ id: 2, method: "Target.attachToBrowserTarget" }));
await settle();
Expand Down Expand Up @@ -170,8 +176,63 @@ describe("CDP relay extra sessions", () => {
await settle();
expect(send).toHaveBeenLastCalledWith("Page.startScreencast", {}, undefined, extra);
written.length = 0;
relay.event("Page.screencastFrame", { data: "x" }, undefined);
expect(written.map((m) => m["sessionId"])).toEqual(["t3-preview-page", extra]);
const frame = (frameId: number) =>
relay.event("Page.screencastFrame", { data: "x", sessionId: frameId }, undefined);
const ack = (sessionId: string, frameId: number) =>
relay.receive(
JSON.stringify({
id: 6,
method: "Page.screencastFrameAck",
params: { sessionId: frameId },
sessionId,
}),
);
const delivered = () => {
const frames = written
.filter((m) => m["method"])
.map((m) => [m["sessionId"], (m["params"] as { sessionId?: number }).sessionId]);
written.length = 0;
return frames;
};
frame(1);
expect(delivered()).toEqual([
["t3-preview-page", 1],
[extra, 1],
]);
// A session that has not acknowledged its frame gets only the newest one, on its ack.
for (let i = 2; i < 100; i++) frame(i);
expect(delivered()).toEqual([]);
// Frames every session is busy for stay unacknowledged, so Chromium pauses at its in-flight limit.
expect(nativeAcks).toEqual([1]);
ack(extra, 1);
await settle();
expect(delivered()).toEqual([[extra, 99]]);
// Each consumer ack lets Chromium send one more frame.
expect(nativeAcks).toEqual([1, 2]);
ack(extra, 99);
await settle();
expect(delivered()).toEqual([]);
expect(nativeAcks).toEqual([1, 2, 3]);
frame(100);
expect(delivered()).toEqual([[extra, 100]]);
ack(extra, 99);
await settle();
frame(101);
expect(delivered()).toEqual([]);
expect(send.mock.calls.some(([method]) => method === "Page.screencastFrameAck")).toBe(false);
// A restart keeps the unacknowledged frame's slot until its own acknowledgement.
relay.receive(JSON.stringify({ id: 7, method: "Page.stopScreencast", sessionId: extra }));
relay.receive(JSON.stringify({ id: 8, method: "Page.startScreencast", sessionId: extra }));
await settle();
delivered();
frame(102);
expect(delivered()).toEqual([]);
ack(extra, 100);
await settle();
expect(delivered()).toEqual([[extra, 102]]);
// Other events still reach a session while its frame is unacknowledged.
relay.event("Page.loadEventFired", { timestamp: 1 }, undefined);
expect(delivered().map(([session]) => session)).toEqual(["t3-preview-page", extra]);
});
});

Expand Down
70 changes: 62 additions & 8 deletions apps/desktop/src/preview/CdpRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface CdpRelayTarget {
readonly sessionDetached?: (owner: string) => void;
/** Whether a page session, by owner as `send` names it, gets the page's screencast frames. */
readonly receivesScreencast: (owner: string | undefined) => boolean;
/** Acknowledges a native screencast frame, letting Chromium send the next one. */
readonly ackScreencastFrame: (frameId: number) => void;
/** The page's own CDP target id; Playwright keys the main frame by it. */
readonly targetId: () => Promise<string>;
readonly url: () => string;
Expand Down Expand Up @@ -103,6 +105,20 @@ export function createCdpRelayConnection(
let downloadEventsEnabled = false;
/** Relay-created page sessions share one real debugger; child frame sessions retain their own ids. */
const sessions = new Map<string, "browser" | "page">([[PAGE_SESSION_ID, "page"]]);
// Each page session holds one unacknowledged frame and keeps the newest one skipped meanwhile.
const unackedFrames = new Map<string, number>();
const skippedFrames = new Map<string, Record<string, unknown>>();
// Chromium keeps a few frames in flight and reuses one frame id per run, so pacing it means
// leaving frames every session is busy for unacknowledged and releasing one per consumer ack.
const heldNativeFrames: Array<number> = [];
const releaseHeldFramesWithoutHolders = () => {
if (skippedFrames.size === 0)
for (const frameId of heldNativeFrames.splice(0)) target.ackScreencastFrame(frameId);
};
const sendFrame = (sessionId: string, params: Record<string, unknown>) => {
unackedFrames.set(sessionId, params["sessionId"] as number);
send({ method: "Page.screencastFrame", params, sessionId });
};
let sessionSequence = 0;
const newSession = (kind: "browser" | "page") => {
const sessionId = `t3-preview-${kind}-${++sessionSequence}`;
Expand Down Expand Up @@ -170,6 +186,9 @@ export function createCdpRelayConnection(
const sessionId = command.params?.["sessionId"];
if (typeof sessionId === "string" && sessionId !== PAGE_SESSION_ID) {
sessions.delete(sessionId);
unackedFrames.delete(sessionId);
skippedFrames.delete(sessionId);
releaseHeldFramesWithoutHolders();
target.sessionDetached?.(sessionId);
}
return {};
Expand Down Expand Up @@ -202,6 +221,27 @@ export function createCdpRelayConnection(
}
// Playwright asks for this on every page; the host emulates focus only while it is in use.
if (command.method === "Emulation.setFocusEmulationEnabled") return Promise.resolve({});
if (command.method === "Page.screencastFrameAck" && child === undefined) {
// A restart keeps the slot too, or restarting would let frames past an unacknowledged one.
const sessionId = command.sessionId!;
if (unackedFrames.get(sessionId) === command.params?.["sessionId"]) {
unackedFrames.delete(sessionId);
const skipped = skippedFrames.get(sessionId);
skippedFrames.delete(sessionId);
if (
skipped !== undefined &&
target.receivesScreencast(sessionId === PAGE_SESSION_ID ? undefined : sessionId)
)
sendFrame(sessionId, skipped);
const released = heldNativeFrames.shift();
if (released !== undefined) target.ackScreencastFrame(released);
}
return Promise.resolve({});
}
if (command.method === "Page.stopScreencast" && child === undefined) {
skippedFrames.delete(command.sessionId!);
releaseHeldFramesWithoutHolders();
}
// The shared debugger keeps Runtime enabled after an earlier connection, and a repeated
// enable reports no existing contexts; Playwright waits for them, so reset once per connection.
if (command.method === "Runtime.enable" && child === undefined) {
Expand Down Expand Up @@ -262,15 +302,29 @@ export function createCdpRelayConnection(
send({ method, params, sessionId });
return;
}
for (const [id, kind] of sessions) {
if (kind !== "page") continue;
if (
method === "Page.screencastFrame" &&
!target.receivesScreencast(id === PAGE_SESSION_ID ? undefined : id)
)
continue;
send({ method, params, sessionId: id });
if (method === "Page.screencastFrame") {
const frame = (params ?? {}) as Record<string, unknown>;
const frameId = frame["sessionId"];
if (typeof frameId !== "number") return;
let held = false;
let delivered = false;
for (const [id, kind] of sessions) {
if (kind !== "page") continue;
if (!target.receivesScreencast(id === PAGE_SESSION_ID ? undefined : id)) continue;
if (unackedFrames.has(id)) {
skippedFrames.set(id, frame);
held = true;
} else {
sendFrame(id, frame);
delivered = true;
}
}
if (held && !delivered) heldNativeFrames.push(frameId);
else target.ackScreencastFrame(frameId);
return;
}
for (const [id, kind] of sessions)
if (kind === "page") send({ method, params, sessionId: id });
},
};
}
7 changes: 7 additions & 0 deletions apps/desktop/src/preview/DesktopBrowserHost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,13 @@ describe("DesktopBrowserHost", () => {
debuggee.refuse(6);
debuggee.release();
expect([yield* Queue.take(replies), yield* Queue.take(replies)].toSorted()).toEqual([5, 6]);
yield* raw({
id: 7,
method: "Page.screencastFrameAck",
params: { sessionId: 1 },
sessionId: "t3-preview-page-1",
});
expect(yield* Queue.take(replies)).toBe(7);
yield* settle;
frames.length = 0;
debuggee.emit("Page.screencastFrame", { data: "frame", sessionId: 2 });
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/preview/DesktopBrowserHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ export const make = Effect.gen(function* () {
dropSessionHolds(tab, owner);
},
receivesScreencast: (owner) => tab.screencasts.has(owner),
ackScreencastFrame: (frameId) =>
void debuggee
.sendCommand("Page.screencastFrameAck", { sessionId: frameId })
.catch(() => {}),
targetId: () =>
debuggee
.sendCommand("Target.getTargetInfo")
Expand Down
Loading