Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
7c05044
refactor(web): share the browser dialog card
BelKed Nov 14, 2026
5b2f2e7
fix(desktop): page dialogs in Browser tabs stay in their tab
BelKed Nov 14, 2026
aaffcbe
fix(web): answer page dialogs in the desktop Browser panel
BelKed Nov 14, 2026
52074e9
fix(server): stop leaving Codex plan items running after their run (#…
grey-tsosie Nov 14, 2026
6fae3c9
perf(gitlab): MR watches check a one-query fingerprint before full re…
TonybynMp4 Nov 14, 2026
20ee041
fix(web): font picker scrolls to every font in short windows (#22795)
Byntham Nov 14, 2026
b9a68e0
fix(source-control): repository paths match however their names are p…
Tabonx Nov 14, 2026
5393882
fix(mcp): return delegated task handles before client timeouts (#15622)
maria-rcks Nov 14, 2026
7873016
fix(web): allow tooltip text to wrap naturally (#36948)
Yash-Singh1 Nov 14, 2026
ed101ef
fix(preview): unload desktop pages before removing their tabs (#35135)
Kirat0201 Nov 14, 2026
0f79b40
fix(web): remove redundant status info icon (#36947)
Yash-Singh1 Nov 14, 2026
ff17cd3
fix(desktop): agent snapshots keep full detail in narrow and mini pre…
juliusmarminge Nov 14, 2026
7f81aa8
test(web): pin the minute clock in the sidebar jump-hint render test …
juliusmarminge Nov 14, 2026
632802c
fix(acp-registry): models show the reasoning levels the agent adverti…
juliusmarminge Nov 14, 2026
cbdf35f
fix(web): enable Send when the composer holds only a thread context (…
only21mil Nov 14, 2026
d080e4e
fix(web): thread details card no longer jumps mid panel animation (#2…
Yuruzuu Nov 14, 2026
20ff8e7
fix(desktop): hold page dialogs from guest attach
BelKed Nov 14, 2026
2dd810d
fix(web,mobile): /btw and /side drafts show the send arrow while a tu…
juliusmarminge Nov 14, 2026
ab2bf94
fix(server): migrated databases can return freed space to disk (#30066)
advaitpaliwal Nov 14, 2026
88c42f4
fix(devices): rename EAS Simulator to Expo Simulators (#36951)
hirbod Nov 14, 2026
3530805
fix(server): find the EAS project of variant app configs (#29466)
krystofwoldrich Nov 14, 2026
7d12d21
fix(web): browser dialog card sits above the page
BelKed Nov 14, 2026
907c200
fix(desktop): navigation dismisses a pending page dialog
BelKed Nov 14, 2026
852f53b
fix(server): include untracked files when Git config hides them (#23134)
only21mil Nov 14, 2026
957aa8f
fix(desktop): closed tab drops its pending dialog
BelKed Nov 14, 2026
c041761
fix(web,server): picking the previous branch after an agent's checkou…
Yuruzuu Nov 14, 2026
35e65e6
fix(server): t3_thread_list leaves out tasks delegated from a linked …
juliusmarminge Nov 14, 2026
733a200
fix(server): prune checkpoint refs owned by deleted threads (#24140)
Zheruel Nov 14, 2026
854b61b
fix(mobile): screen readers hear a thread row's status and time (#34636)
MarcoDotIO Nov 14, 2026
92595ab
fix(server): isolate Linux process launches from the RPC event loop (…
voltcrash Nov 14, 2026
1483e97
perf(server): Pull no longer waits behind other repositories' fetches…
Yuruzuu Nov 14, 2026
4d6ebbd
fix(wsl): label WSL environments with their Windows host on every cli…
RJWadley Nov 14, 2026
2dfc4a9
fix(azure-devops): derive CLI scope from checkout remotes (#21838)
juliusmarminge Nov 14, 2026
c6aea18
fix(server): subagent threads no longer show the remote parent their …
spoukyii Nov 14, 2026
dfd2187
fix(server): t3_thread_launch worktrees honor the new-worktree settin…
LymanBE Nov 14, 2026
5c85e93
perf(server): text-only browser snapshots skip the PNG encode (66 ms …
Yuruzuu Nov 14, 2026
19c9df2
fix(web): diff Copy path uses Windows separators in a Windows workspa…
spoukyii Nov 14, 2026
fed0f74
fix(opencode): usage totals include what OpenCode 2 spends on compact…
MarcoDotIO Nov 14, 2026
304dc13
fix(web): opening a project or deleting the open thread skips delegat…
spoukyii Nov 14, 2026
ee2cddf
chore(web): upgrade @pierre/diffs to 1.7.0-beta.4 and drop patched fi…
juliusmarminge Nov 14, 2026
c62c764
fix(server): keep Vietnamese words readable in scratch folder names (…
epistex-dev Nov 14, 2026
3808e2d
fix(client-runtime): a line of inline triple-backtick code no longer …
MarcoDotIO Nov 14, 2026
62405fc
fix(web): preserve thread identity across composer pastes (#30583)
ElliotDrel Nov 14, 2026
fb915ca
fix(opencode): pages a Code Mode script publishes now show inline (#3…
DavidPerezA12 Nov 14, 2026
77c9e70
fix(cursor): preserve recognized transport failure diagnostics (#30631)
trevoedwards Nov 14, 2026
26bf047
fix(client-runtime): a disconnected machine's scratch folder no longe…
tiliakoos Nov 14, 2026
635ea82
fix(mobile): iOS tab bar no longer covers a thread opened from the Us…
juliusmarminge Nov 14, 2026
1c01db0
fix(cursor): stream Task subagent work into child threads live (#30539)
humbertogontijo Nov 14, 2026
9ca6622
fix(web): app loads in browsers without URL.canParse or URL.parse (#3…
juliusmarminge Nov 14, 2026
a68c367
fix(server): preserve the crash recovery budget across restarts (#25603)
maria-rcks Nov 14, 2026
fa864bf
fix(server): Claude goals no longer re-prompt while a delegated task …
georgenijo Nov 14, 2026
6b9d90f
fix(codex): preserve terminal connection failure categories (#30639)
trevoedwards Nov 14, 2026
5bd2d0c
fix(client-runtime): derive MCP download names before URI suffixes (#…
Jo2234 Nov 14, 2026
abc0fde
fix(desktop): providers are found after a failed shell probe without …
nabettu Nov 14, 2026
e82050b
feat(themes): theme CSS can hold 50,000 characters (#36656)
pouyarezvani Nov 15, 2026
2b6c14b
fix(web): diff file Open and Reveal reach a file whose name has a bac…
only21mil Nov 15, 2026
b64eebb
fix(release): enforce packaged Linux glibc requirements (#30827)
voltcrash Nov 15, 2026
3a87ca8
fix(client-runtime): tool output no longer rounds integers beyond 2^5…
geezoria Nov 15, 2026
1d4765b
fix(gitlab): remove reactions beyond the first award page (#30700)
Jo2234 Nov 15, 2026
0bdf566
fix(server): let Expo decide EAS Simulator access (#29490)
hirbod Nov 15, 2026
3883ed5
perf(azure-devops): opening a pull request no longer reads it twice (…
amv146 Nov 15, 2026
c0561c5
fix(shared): the SQLite reader pool comes back after a failed start (…
navidnadali Nov 15, 2026
33f8c5d
fix(web): keep history-placed guest messages out of the footer (#30718)
Jo2234 Nov 15, 2026
1ba9347
fix(shared): keep Windows path separators beside ampersands (#36977)
tanav29 Nov 15, 2026
ca29ff1
fix(cli): keep log warnings out of JSON output (#30898)
voltcrash Nov 15, 2026
6c7a87c
fix(web,mobile): a late MCP app teardown no longer closes the app tha…
seth-dixon Nov 15, 2026
47e24f6
fix(server): Grok usage counts turns from resumed sessions (#30694)
saphid Nov 15, 2026
2b7ea1b
test(desktop): wait for the published PATH after a fallback-shell ret…
juliusmarminge Nov 15, 2026
6e0cbb3
fix(server): checkpoint restore reverts edits inside submodules (#30829)
muhammad-auon-marham Nov 15, 2026
3e17618
perf(server): delegated tasks start and finish without reading the wh…
t3dotgg Nov 15, 2026
b732f64
fix(pi): resume attached sessions without reloading extensions (#21512)
juliusmarminge Nov 15, 2026
5f29d87
fix(provider-acp): a cancel no longer overtakes the prompt it cancels…
navidnadali Nov 15, 2026
f5ca0f9
fix(server): wake GitLab MR watches when a rebase is required (#30312)
tcrapts Nov 15, 2026
910d459
fix(server): drain queued native child continuations (#21461)
juliusmarminge Nov 15, 2026
2b7fc89
fix(web): a send that finishes after you leave its thread no longer b…
Isaac-b-ux Nov 15, 2026
dae8d6f
fix(mobile): Android menus opened over the keyboard close when it hid…
Onkarj012 Nov 15, 2026
ec844a3
fix(client-runtime): omit machine labels from relay spans (#30940)
Mr-Neutr0n Nov 15, 2026
f7b0b3c
fix(server): MCP list tools clamp an oversized limit instead of faili…
MarcoDotIO Nov 15, 2026
a6d7695
perf(web): collapse all no longer remounts the diff viewer (#36995)
juliusmarminge Nov 15, 2026
92605bf
fix(server): skip Codex page context in imported titles (#31090)
flexi767 Nov 15, 2026
fe59fa4
fix(web): renaming a sidebar thread no longer shifts the row or cover…
shlokkhemani Nov 15, 2026
5b818b3
perf(server): resolve model aliases in one memoized traversal (#31197)
hieu-lee Nov 15, 2026
4cb8da6
perf(relay): reconcile multiline env values without rescanning prefix…
hieu-lee Nov 15, 2026
f6fd89b
fix(server): terminals start a $SHELL whose path contains a space (#3…
MarcoDotIO Nov 15, 2026
2cc4b48
fix(desktop): a waiting update is no longer re-announced on every pol…
onlydole Nov 15, 2026
bbda0c1
fix(acp): replace and remove identified plans across turns (#36978)
tanav29 Nov 15, 2026
96ffe45
fix(server): streamed replies keep updating after a line that starts …
MarcoDotIO Nov 15, 2026
d3217c7
fix(provider-cursor): advertise manual compaction (#31203)
defyrlt Nov 15, 2026
01c8e59
fix(web): preserve published theme IDs during alias lookup (#31318)
Jo2234 Nov 15, 2026
d022d3b
fix(mobile): iOS image viewer pages and dismisses after slow opens (#…
juliusmarminge Nov 15, 2026
bb33fc3
test(server): stop Git auto-maintenance racing the shared repo templa…
juliusmarminge Nov 15, 2026
703810f
fix(server): Open in and Reveal open ~/ file links from projects outs…
MarcoDotIO Nov 15, 2026
6a8f022
perf(server): Windows terminals report exit 0.9 s sooner (PowerShell …
Pyseph Nov 15, 2026
3c8f3f2
fix(web): up-arrow recall keeps thread and machine mentions (#31314)
carlosricojr Nov 15, 2026
0983ab3
fix(web): choosing a provider in the model picker no longer raises th…
vytorrennan Nov 15, 2026
0b30831
fix(cursor): resume stopped turns with Cursor's native resume action …
Yash-Singh1 Nov 15, 2026
9cd5733
fix(web): an unreachable environment no longer hides pull requests fr…
johns1x Nov 15, 2026
4dec8cf
fix(web): honor right panel state in custom shortcuts (#34081)
cesarbahena Nov 15, 2026
cef95b6
fix(shared): decode URI paths in ghq clone folders (#37004)
Lucenx9 Nov 15, 2026
6f8144b
fix(web): overlapping image pastes keep their prompt order (#37010)
StiensWout Nov 15, 2026
48a383c
fix(web): show failed desktop downloads in retry tooltips (#31324)
Jo2234 Nov 15, 2026
a96bb81
perf(right panel): normalize pr tab target once (#37002)
rgodha24 Nov 15, 2026
989c1b5
fix(marketing): prevent harness-grid content overflow on mobile devic…
SimonDdungu Nov 15, 2026
f5dd9c1
fix(mobile): diagonal thread-row swipes open on Android instead of sc…
juliusmarminge Nov 15, 2026
a31fab9
fix(web): focus side-chat composer when selecting its tab (#31360)
joeyvandijk Nov 15, 2026
4adb946
fix(claude): show monitor commands in background work details (#37019)
Yash-Singh1 Nov 15, 2026
617c6c7
fix(web): thread chips in the composer can no longer be dragged out a…
NawfalAhmed Nov 15, 2026
d6c1d17
fix(web): show drag preview inside sidebar search results (#37022)
Yash-Singh1 Nov 15, 2026
1c8143c
perf(desktop): the remote editor list appears in 62 ms instead of 2.5…
Pyseph Nov 15, 2026
252b2c7
fix(codex): crashed handlers and transport workers no longer hang sil…
iXab3r Nov 15, 2026
fbdfe2e
fix(mobile): an answered question no longer shows its raw item JSON (…
Jacksondr5 Nov 15, 2026
a62bc81
perf(server): message ordinals are read through an index, not a scan …
navidnadali Nov 15, 2026
47f2e91
perf(web): batch middle truncate fits (#37001)
rgodha24 Nov 15, 2026
dd3d4a4
fix(web): prevent stray highlights when selecting shell commands (#37…
Yash-Singh1 Nov 15, 2026
c1a7ce3
fix(desktop): Check for Updates says when an update is available (#31…
juliusmarminge Nov 15, 2026
d23f479
fix(web): right panel shortcuts work while a side chat has focus (#32…
juliusmarminge Nov 15, 2026
88621ac
feat(github): issues and PRs from denounced authors close when opened…
maria-rcks Nov 15, 2026
2c5013d
fix(server): threads show the new branch's pull request after a branc…
juliusmarminge Nov 15, 2026
8be0e6c
fix(server): preserve run start time when steering restarts a turn (#…
flamboh Nov 15, 2026
fece893
fix(cli): t3 project add brings back an archived project instead of r…
MarcoDotIO Nov 15, 2026
e1458f2
fix(web): track switch no longer blocked when Local environment is of…
juliusmarminge Nov 15, 2026
ed6cb97
fix(web): reopened composer drafts keep quote spacing and show the ca…
juliusmarminge Nov 15, 2026
dd86dd6
fix(server): SSH device host probe failures say what ssh refused (#31…
ahalekelly Nov 15, 2026
7f6e403
fix(provider-acp): Grok runs complete when a background dev server ke…
juliusmarminge Nov 15, 2026
df15bd4
fix(server): parallel worktree launches no longer leave all but one b…
MarcoDotIO Nov 15, 2026
eb8b1f5
fix(client): avoid worktree setup flash after editing first message (…
aminevg Nov 15, 2026
240fc69
fix(codex): an app-server that exits before initialize reports its ex…
juliusmarminge Nov 15, 2026
bc91203
fix(server): count only newly imported agent threads (#37025)
juliusmarminge Nov 15, 2026
fd985e0
fix(usage): a Claude hub account with an unmeasured window keeps its …
MarcoDotIO Nov 15, 2026
e49d058
fix(server): thread_not_found points agents at linked environments (#…
juliusmarminge Nov 15, 2026
1c86881
perf(web): Expand all folders in the diff file tree no longer rescans…
Pyseph Nov 15, 2026
7a72fe3
fix(server): a send to an idle thread with a queue now waits behind i…
juliusmarminge Nov 15, 2026
bee9eb5
fix(shared): recognize SSH remotes with a single path component (#31781)
darshmahadevia Nov 15, 2026
d93b225
fix(mobile): grouped projects show their own monogram in the picker a…
johns1x Nov 15, 2026
1cec104
fix(shared): file mentions of __init__.py keep their name as the labe…
matyasrathonyi Nov 15, 2026
35b8863
fix(server): delegate_task model refusals name slugs to retry with (#…
juliusmarminge Nov 15, 2026
828200f
fix(server): clearing a terminal that keeps printing no longer hangs …
MarcoDotIO Nov 15, 2026
6615615
fix(shared): preserve Git remote headers after comments (#31788)
darshmahadevia Nov 15, 2026
031ee2d
fix(server): dictionary spellings apply next to Chinese and Japanese …
zedong-peng Nov 15, 2026
2e42cb5
fix(desktop): tab dialog follows the live hold
BelKed Nov 15, 2026
486cd38
Merge remote-tracking branch 'origin/main' into t3/dialog-hold-early
BelKed Nov 15, 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
  •  
  •  
  •  
38 changes: 31 additions & 7 deletions .github/scripts/pr-limits.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,22 @@ function parseExemptions(text) {
}

// VOUCHED.td: one `github:login` per line, `#` comments, and `-github:login reason` to denounce.
function vouchedLogins(text) {
const logins = new Set();
// A login listed both ways is an error: pr-vouch.yml's action reads its first line and
// issue-vouch.yml its last, so no answer here would agree with both labels.
function parseVouchList(text) {
const vouched = new Set();
const denounced = new Set();
for (const raw of text.split("\n")) {
const entry = raw.trim().split(/\s+/)[0];
if (entry.startsWith("github:")) logins.add(entry.slice("github:".length).toLowerCase());
const match = /^(-?)github:(\S+)/.exec(raw.trim());
if (!match) continue;
const login = match[2].toLowerCase();
const [listed, other] = match[1] ? [denounced, vouched] : [vouched, denounced];
if (other.has(login))
throw new Error(`${VOUCHED_PATH}: ${login} is both vouched and denounced`);
listed.add(login);
}
if (logins.size === 0) throw new Error(`${VOUCHED_PATH}: no entries`);
return logins;
if (vouched.size === 0) throw new Error(`${VOUCHED_PATH}: no entries`);
return { vouched, denounced };
}

function labeledAt(pr, name) {
Expand Down Expand Up @@ -278,7 +286,8 @@ async function enforceOpenLimit({ github, context, core, dryRun }) {
// lookups as "not vouched". Every read below throws on failure, and a throw closes nothing.
if (pr.user.type === "Bot") return;
if (parseExemptions(fs.readFileSync(EXEMPTIONS_PATH, "utf8")).has(author.toLowerCase())) return;
if (vouchedLogins(fs.readFileSync(VOUCHED_PATH, "utf8")).has(author.toLowerCase())) return;
const { vouched, denounced } = parseVouchList(fs.readFileSync(VOUCHED_PATH, "utf8"));
if (vouched.has(author.toLowerCase())) return;
const { data: access } = await github.rest.repos.getCollaboratorPermissionLevel({
...context.repo,
username: author,
Expand All @@ -289,6 +298,21 @@ async function enforceOpenLimit({ github, context, core, dryRun }) {
const reopened = context.payload.action === "reopened";
if (reopened && context.payload.sender.login.toLowerCase() !== author.toLowerCase()) return;

if (denounced.has(author.toLowerCase())) {
if (dryRun) {
core.notice(`Dry run. PR #${pr.number} would close: ${author} is denounced.`);
return;
}
await closeWithComment(
github,
context,
pr.number,
`Closing: ${author} is banned from contributing here, so this PR will not be reviewed. See [bans](${guideLink(context, "bans")}).`,
);
core.info(`PR #${pr.number}: closed, ${author} is denounced.`);
return;
}

const q = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:open author:${author} sort:created-asc`;
const { search } = await read(github, AUTHOR_OPEN_PRS_QUERY, { q });
// A new PR counts only the older ones, so two opened together cannot close each other.
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/issue-vouch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ jobs:
ref: context.payload.repository.default_branch,
});
const statusByUser = new Map();
const listedBothWays = new Set();
for (const raw of Buffer.from(file.content, "base64").toString("utf8").split("\n")) {
const match = /^(-?)github:(\S+)/.exec(raw.trim());
if (match) statusByUser.set(match[2].toLowerCase(), match[1] ? "denounced" : "vouched");
if (!match) continue;
const login = match[2].toLowerCase();
const status = match[1] ? "denounced" : "vouched";
if (statusByUser.has(login) && statusByUser.get(login) !== status) listedBothWays.add(login);
statusByUser.set(login, status);
}

const issues =
Expand Down Expand Up @@ -74,4 +79,32 @@ jobs:
await github.rest.issues.addLabels({ owner, repo, issue_number: issue.number, labels: [next] });
core.info(`Issue #${issue.number} (${issue.user.login}): ${status} -> ${next}`);
}

// Only a newly opened issue is closed. One filed before its author was denounced
// may already have a fix on the way, so the sweep leaves those to maintainers.
// Someone else reopening it is a maintainer keeping it open.
const reopenedByOther =
context.payload.action === "reopened" &&
context.payload.sender.login.toLowerCase() !== issue.user.login.toLowerCase();
// The PR rules refuse a list that names a login both ways, so nothing closes for one here.
const trusted =
issue.user.type === "Bot" ||
["OWNER", "MEMBER", "COLLABORATOR"].includes(issue.author_association) ||
listedBothWays.has(issue.user.login.toLowerCase());
if (status === "denounced" && context.eventName === "issues" && !reopenedByOther && !trusted) {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: `Closing: ${issue.user.login} is banned from contributing here, so this issue will not be triaged. See [bans](https://github.com/${owner}/${repo}/blob/main/CONTRIBUTING.md#bans).`,
});
await github.rest.issues.update({
owner,
repo,
issue_number: issue.number,
state: "closed",
state_reason: "not_planned",
});
core.info(`Issue #${issue.number}: closed, ${issue.user.login} is denounced.`);
}
}
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ the open PR limit.
- If you make our lives harder as reviewers and maintainers, you will be banned. Examples are repeated
pings, a fight over a closure, and a second account to get around a limit.

A banned account is denounced in [.github/VOUCHED.td](.github/VOUCHED.td). Any issue or PR it opens
is closed when it is opened.

<a id="closure-and-reconsideration"></a>

## When your PR is closed
Expand Down
1 change: 0 additions & 1 deletion apps/desktop/src/app/DesktopStartupRecovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export const listen: Effect.Effect<
const download = yield* updates.download;
if (!download.completed) return;
}
// Waits for a running background check; plain install would refuse.
yield* updates.installPrepared(current.version);
return;
}
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/ipc/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ export const PREVIEW_SET_ZOOM_FACTOR_CHANNEL = "desktop:preview-set-zoom-factor"
export const PREVIEW_HARD_RELOAD_CHANNEL = "desktop:preview-hard-reload";
export const PREVIEW_SET_COLOR_SCHEME_CHANNEL = "desktop:preview-set-color-scheme";
export const PREVIEW_SET_AUDIO_MUTED_CHANNEL = "desktop:preview-set-audio-muted";
export const PREVIEW_ANSWER_DIALOG_CHANNEL = "desktop:preview-answer-dialog";
export const PREVIEW_FIND_IN_PAGE_CHANNEL = "desktop:preview-find-in-page";
export const PREVIEW_STOP_FIND_IN_PAGE_CHANNEL = "desktop:preview-stop-find-in-page";
export const PREVIEW_SET_SHOWN_CHANNEL = "desktop:preview-set-shown";
export const PREVIEW_SET_CAPTURE_DRAWN_CHANNEL = "desktop:preview-set-capture-drawn";
export const PREVIEW_OPEN_DEVTOOLS_CHANNEL = "desktop:preview-open-devtools";
export const PREVIEW_CLEAR_COOKIES_CHANNEL = "desktop:preview-clear-cookies";
export const PREVIEW_CLEAR_CACHE_CHANNEL = "desktop:preview-clear-cache";
Expand Down
22 changes: 22 additions & 0 deletions apps/desktop/src/ipc/methods/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {
DesktopPreviewRecordingSaveInputSchema,
DesktopPreviewRegisterWebviewInputSchema,
DesktopPreviewScreenshotArtifactSchema,
DesktopPreviewAnswerDialogInputSchema,
DesktopPreviewSetAudioMutedInputSchema,
DesktopPreviewSetShownInputSchema,
DesktopPreviewSetCaptureDrawnInputSchema,
DesktopPreviewSetColorSchemeInputSchema,
DesktopPreviewSetZoomFactorInputSchema,
BrowserImportResult,
Expand Down Expand Up @@ -225,6 +227,15 @@ const setAudioMuted = DesktopIpc.makeIpcMethod({
yield* manager.setAudioMuted(tabId, audioMuted);
}),
});
const answerDialog = DesktopIpc.makeIpcMethod({
channel: IpcChannels.PREVIEW_ANSWER_DIALOG_CHANNEL,
payload: DesktopPreviewAnswerDialogInputSchema,
result: Schema.Void,
handler: Effect.fn("desktop.ipc.preview.answerDialog")(function* ({ tabId, accept, promptText }) {
const manager = yield* PreviewManager.PreviewManager;
yield* manager.answerDialog(tabId, accept, promptText);
}),
});
const setShown = DesktopIpc.makeIpcMethod({
channel: IpcChannels.PREVIEW_SET_SHOWN_CHANNEL,
payload: DesktopPreviewSetShownInputSchema,
Expand All @@ -234,6 +245,15 @@ const setShown = DesktopIpc.makeIpcMethod({
yield* manager.setShown(tabId, shown);
}),
});
const setCaptureDrawn = DesktopIpc.makeIpcMethod({
channel: IpcChannels.PREVIEW_SET_CAPTURE_DRAWN_CHANNEL,
payload: DesktopPreviewSetCaptureDrawnInputSchema,
result: Schema.Void,
handler: Effect.fn("desktop.ipc.preview.setCaptureDrawn")(function* ({ tabId, drawn }) {
const manager = yield* PreviewManager.PreviewManager;
yield* manager.setCaptureDrawn(tabId, drawn);
}),
});
const openDevTools = tabMethod(
IpcChannels.PREVIEW_OPEN_DEVTOOLS_CHANNEL,
"desktop.ipc.preview.openDevTools",
Expand Down Expand Up @@ -487,7 +507,9 @@ export const methods = [
setColorScheme,
setZoomFactor,
setAudioMuted,
answerDialog,
setShown,
setCaptureDrawn,
openDevTools,
clearCookies,
clearCache,
Expand Down
107 changes: 107 additions & 0 deletions apps/desktop/src/ipc/methods/window.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { assert, describe, it } from "@effect/vitest";
import * as NodeServices from "@effect/platform-node/NodeServices";
import type { ManagedPolicyLimits } from "@t3tools/contracts";
import { EDITORS, REMOTE_CAPABLE_EDITOR_IDS } from "@t3tools/contracts";
import { resolveEditorCommand } from "@t3tools/shared/editor";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { ManagedPolicyFileError } from "@t3tools/shared/managedPolicyFile";
import * as FileSystem from "effect/FileSystem";
Expand Down Expand Up @@ -517,3 +519,108 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
assert.include(editors, "webstorm");
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);

describe("probeRemoteEditors PATH scan", () => {
const platform = HostProcess.Platform.defaultValue();
const launcherName = (command: string) => (platform === "win32" ? `${command}.cmd` : command);

const makeFakePath = Effect.fnUntraced(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-probe-path-" });
const dirs = ["a", "b", "c", "d"].map((name) => path.join(root, name));
for (const dir of dirs) yield* fs.makeDirectory(dir, { recursive: true });
// Launchers in different PATH directories, deliberately not in REMOTE_CAPABLE_EDITOR_IDS order.
for (const [dir, command] of [
[dirs[2]!, "webstorm"],
[dirs[0]!, "cursor"],
[dirs[3]!, "code"],
[dirs[1]!, "zeditor"],
] as const) {
const file = path.join(dir, launcherName(command));
yield* fs.writeFileString(file, "#!/bin/sh\n");
if (platform !== "win32") yield* fs.chmod(file, 0o755);
}
return {
root,
env: {
HOME: root,
USERPROFILE: root,
PATH: dirs.join(platform === "win32" ? ";" : ":"),
PATHEXT: ".COM;.EXE;.BAT;.CMD",
},
};
});

const countingFileSystem = (counter: { stat: number; reads: Map<string, number> }) =>
Layer.effect(
FileSystem.FileSystem,
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
return FileSystem.FileSystem.of({
...fs,
stat: (target) => {
counter.stat += 1;
return fs.stat(target);
},
readDirectory: (target, options) => {
counter.reads.set(target, (counter.reads.get(target) ?? 0) + 1);
return fs.readDirectory(target, options);
},
});
}),
).pipe(Layer.provideMerge(NodeServices.layer));

const serialReference = (env: Record<string, string>) =>
Effect.gen(function* () {
const available: Array<string> = [];
for (const editorId of REMOTE_CAPABLE_EDITOR_IDS) {
const editor = EDITORS.find((candidate) => candidate.id === editorId);
if (editor && Option.isSome(yield* resolveEditorCommand(editor, env))) {
available.push(editorId);
}
}
return available;
});

it.effect("reads each PATH directory once instead of stat-ing every candidate per editor", () =>
Effect.gen(function* () {
const { env: baseEnv } = yield* makeFakePath();
const delimiter = platform === "win32" ? ";" : ":";
const uncachedCounter = { stat: 0, reads: new Map<string, number>() };
const cachedCounter = { stat: 0, reads: new Map<string, number>() };
const uncachedEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x1` };
const cachedEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x2` };
const uncached = yield* serialReference(uncachedEnv).pipe(
Effect.provide(countingFileSystem(uncachedCounter)),
);
const cached = yield* probeRemoteEditors
.handler(undefined)
.pipe(
Effect.provideService(HostProcess.Environment, cachedEnv),
Effect.provideService(HostProcess.Platform, platform),
Effect.provide(countingFileSystem(cachedCounter)),
);
// The host can add editors from app folders the fixture can't redirect (e.g. /Applications).
const fixtureEditors = ["cursor", "vscode", "zed", "webstorm"];
assert.deepStrictEqual(
uncached.filter((id) => fixtureEditors.includes(id)),
fixtureEditors,
);
assert.deepStrictEqual(cached, uncached);
assert.isAbove(uncachedCounter.stat, 0);
// On every platform the probe lists each PATH directory at most once. Only PATH entries count:
// resolveEditorCommand also reads app folders such as /Applications on macOS.
const pathReads = cachedEnv.PATH.split(delimiter)
.filter((entry) => entry.length > 0)
.map((entry) => cachedCounter.reads.get(entry) ?? 0);
assert.isAbove(Math.max(...pathReads), 0);
assert.isAtMost(Math.max(...pathReads), 1);
// Without the listings, Windows stats every PATH entry x PATHEXT candidate for each editor;
// elsewhere there is no PATHEXT, so the stat count is about the same either way.
if (platform === "win32") {
assert.isBelow(cachedCounter.stat, uncachedCounter.stat / 2);
}
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);
});
23 changes: 15 additions & 8 deletions apps/desktop/src/ipc/methods/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "@t3tools/contracts";
import { PROJECT_FAVICON_EXTENSIONS } from "@t3tools/shared/projectFavicon";
import { resolveEditorCommand } from "@t3tools/shared/editor";
import { withPathDirectoryListings } from "@t3tools/shared/shell";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { isRelayTracingEnabled } from "@t3tools/shared/otelEnvironment";
import * as FileSystem from "effect/FileSystem";
Expand Down Expand Up @@ -427,20 +428,26 @@ export const openSystemSettings = DesktopIpc.makeIpcMethod({
}),
});

const REMOTE_EDITOR_PROBE_CONCURRENCY = 8;

export const probeRemoteEditors = DesktopIpc.makeIpcMethod({
channel: IpcChannels.PROBE_REMOTE_EDITORS_CHANNEL,
payload: Schema.Undefined,
result: Schema.Array(EditorId),
handler: Effect.fn("desktop.ipc.window.probeRemoteEditors")(function* () {
const available: Array<EditorId> = [];
const env = yield* HostProcess.Environment;
for (const editorId of REMOTE_CAPABLE_EDITOR_IDS) {
const editor = EDITORS.find((editor) => editor.id === editorId);
if (editor && Option.isSome(yield* resolveEditorCommand(editor, env))) {
available.push(editorId);
}
}
return available;
// Shared listings stop each editor re-stating every PATH entry x PATHEXT candidate on Windows.
const resolved = yield* Effect.forEach(
REMOTE_CAPABLE_EDITOR_IDS,
(editorId) => {
const editor = EDITORS.find((editor) => editor.id === editorId);
return editor
? resolveEditorCommand(editor, env).pipe(Effect.map(Option.isSome))
: Effect.succeed(false);
},
{ concurrency: REMOTE_EDITOR_PROBE_CONCURRENCY },
).pipe(withPathDirectoryListings);
return REMOTE_CAPABLE_EDITOR_IDS.filter((_, index) => resolved[index]);
}),
});

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop/src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,12 @@ contextBridge.exposeInMainWorld("desktopBridge", {
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_COLOR_SCHEME_CHANNEL, { tabId, colorScheme }),
setAudioMuted: (tabId, audioMuted) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_AUDIO_MUTED_CHANNEL, { tabId, audioMuted }),
answerDialog: (tabId, accept, promptText) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_ANSWER_DIALOG_CHANNEL, {
tabId,
accept,
...(promptText === undefined ? {} : { promptText }),
}),
findInPage: (tabId, text, { forward, newSession }) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_FIND_IN_PAGE_CHANNEL, {
tabId,
Expand All @@ -414,6 +420,8 @@ contextBridge.exposeInMainWorld("desktopBridge", {
ipcRenderer.invoke(IpcChannels.PREVIEW_STOP_FIND_IN_PAGE_CHANNEL, { tabId }),
setShown: (tabId, shown) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_SHOWN_CHANNEL, { tabId, shown }),
setCaptureDrawn: (tabId, drawn) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_CAPTURE_DRAWN_CHANNEL, { tabId, drawn }),
openDevTools: (tabId) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_OPEN_DEVTOOLS_CHANNEL, { tabId }),
listBrowserImportSources: () => ipcRenderer.invoke(IpcChannels.PREVIEW_IMPORT_SOURCES_CHANNEL),
Expand Down
Loading
Loading