Skip to content

Commit df9c2b8

Browse files
Merge remote-tracking branch 'origin/main' into l72-20415
2 parents 990cece + 4af6618 commit df9c2b8

711 files changed

Lines changed: 36542 additions & 5725 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/ci-changes.cjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const EXTRA_OWNERS = [
3636
// scripts/build-desktop-artifact.ts reads the GNOME extension manifest.
3737
[/^apps\/desktop\/gnome-extension\//, ["@t3tools/scripts"]],
3838
[/^native\/browser-secret\//, ["@t3tools/desktop"]],
39+
[/^native\/kde-snap-shot\//, ["@t3tools/desktop"]],
3940
[/^native\/libghostty-vt\//, ["@t3tools/web"]],
4041
];
4142
const RUST = /^native\/(resource-monitor|kde-snap-shot|hyprland-snap-shot)\//;
@@ -112,10 +113,10 @@ function ownersOf(file, packages) {
112113
// A manifest can change dependencies or versions other packages read.
113114
if (path.posix.basename(file) === "package.json") return null;
114115
if (RUNS_EVERYTHING.some((pattern) => pattern.test(file))) return null;
116+
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
115117
// scripts/build-desktop-artifact.test.ts reads the crates' sources.
116-
if (RUST.test(file)) return ["@t3tools/scripts"];
118+
if (RUST.test(file)) return ["@t3tools/scripts", ...extra];
117119

118-
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
119120
const owner = packages
120121
.filter((pkg) => file.startsWith(`${pkg.dir}/`))
121122
.sort((a, b) => b.dir.length - a.dir.length)[0];

‎.github/workflows/cursor-hygiene-webhook.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Forward to Cursor hygiene
33
on:
44
push:
55
branches: [main]
6-
pull_request:
6+
# Use trusted workflow code and repository secrets for fork PRs.
7+
# Keep this job payload-only: never check out or run PR code.
8+
pull_request_target:
79
types: [opened, reopened, ready_for_review]
810
issues:
911
types: [opened, closed, reopened]
@@ -34,7 +36,7 @@ jobs:
3436
--output /dev/null --write-out '%{http_code}' \
3537
-H "Authorization: $AUTH" \
3638
-H "Content-Type: application/json" \
37-
-H "X-GitHub-Event: ${{ github.event_name }}" \
39+
-H "X-GitHub-Event: ${{ github.event_name == 'pull_request_target' && 'pull_request' || github.event_name }}" \
3840
-H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \
3941
--data-binary @"${{ github.event_path }}") || curl_status=$?
4042
if [ "$curl_status" -eq 0 ]; then

‎apps/desktop/src/app/DesktopApp.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ const bootstrap = Effect.gen(function* () {
239239
}
240240

241241
if (!(yield* Ref.get(state.quitting))) {
242-
if (settings.wslOnly === true && settings.wslBackendEnabled === true) {
243-
yield* desktopWindow.showConnectingSplash;
244-
}
242+
yield* desktopWindow.showConnectingSplash;
245243
yield* primaryBackend.start;
246244
yield* logBootstrapInfo("bootstrap backend start requested");
247245
yield* appActivation.start.pipe(

‎apps/desktop/src/app/DesktopAppErrors.test.ts‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎apps/desktop/src/app/DesktopClerk.test.ts‎

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @effect-diagnostics nodeBuiltinImport:off globalFetchInEffect:off - Hosted handoff test uses a real localhost listener without an OpenAI account.
22
import * as NodeHttp from "node:http";
3-
import * as NodePath from "@effect/platform-node/NodePath";
3+
import * as NodePath from "node:path";
4+
import * as PlatformNodePath from "@effect/platform-node/NodePath";
45
import { codexAuthHandoffUrl, readCodexAuthDelivery } from "@t3tools/shared/codexAuthHandoff";
56
import { EnvironmentId, ProviderInstanceId } from "@t3tools/contracts";
67
import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -59,11 +60,15 @@ const layerDesktopClerk = (
5960
copyText: () => Effect.void,
6061
},
6162
listeners = new Map<string, (...args: unknown[]) => void>(),
63+
isPackaged = false,
6264
) => {
6365
const environment = DesktopEnvironment.DesktopEnvironment.of({
6466
stateDir: "/tmp/t3-state",
6567
isDevelopment,
6668
appDataDirectory: "/tmp/app-data",
69+
isPackaged,
70+
dirname: platform === "win32" ? String.raw`C:\T3 Code\dist-electron` : "/tmp/dist-electron",
71+
path: platform === "win32" ? NodePath.win32 : NodePath.posix,
6772
platform,
6873
} as unknown as DesktopEnvironment.DesktopEnvironment["Service"]);
6974

@@ -95,7 +100,7 @@ const layerDesktopClerk = (
95100
return DesktopClerk.layer.pipe(
96101
Layer.provide(
97102
Layer.mergeAll(
98-
NodePath.layerPosix,
103+
PlatformNodePath.layerPosix,
99104
Layer.succeed(DesktopEnvironment.DesktopEnvironment, environment),
100105
Layer.succeed(ElectronApp.ElectronApp, electronApp),
101106
Layer.succeed(ElectronShell.ElectronShell, shell),
@@ -112,6 +117,67 @@ describe("DesktopClerk", () => {
112117
storageMock.mockReset();
113118
});
114119

120+
it.effect.each([
121+
{ platform: "win32", isPackaged: false, isDevelopment: false, registers: true },
122+
{ platform: "win32", isPackaged: false, isDevelopment: true, registers: false },
123+
{ platform: "win32", isPackaged: true, isDevelopment: false, registers: false },
124+
{ platform: "darwin", isPackaged: false, isDevelopment: false, registers: false },
125+
{ platform: "linux", isPackaged: false, isDevelopment: false, registers: false },
126+
] as const)(
127+
"registers an entry point only for unpackaged non-development Windows ($platform, packaged=$isPackaged, development=$isDevelopment)",
128+
({ platform, isPackaged, isDevelopment, registers }) => {
129+
const events: string[] = [];
130+
storageMock.mockReturnValue(storageAdapter);
131+
createClerkBridgeMock.mockImplementation(() => {
132+
events.push("bridge");
133+
return { cleanup: vi.fn() };
134+
});
135+
const setAsDefaultProtocolClient = vi.fn(() =>
136+
Effect.sync(() => {
137+
events.push("register");
138+
return true;
139+
}),
140+
);
141+
const electronApp = {
142+
on: () => Effect.void,
143+
setAsDefaultProtocolClient,
144+
} as unknown as ElectronApp.ElectronApp["Service"];
145+
146+
return Effect.gen(function* () {
147+
const clerk = yield* DesktopClerk.DesktopClerk;
148+
yield* clerk.configure;
149+
150+
assert.deepEqual(
151+
setAsDefaultProtocolClient.mock.calls,
152+
registers
153+
? [["t3code", process.execPath, [String.raw`C:\T3 Code\dist-electron\main.cjs`]]]
154+
: [],
155+
);
156+
assert.deepEqual(events, registers ? ["bridge", "register"] : ["bridge"]);
157+
}).pipe(
158+
Effect.scoped,
159+
Effect.provide(
160+
layerDesktopClerk(
161+
isDevelopment,
162+
[],
163+
platform,
164+
undefined,
165+
undefined,
166+
undefined,
167+
isPackaged,
168+
),
169+
),
170+
Effect.provideService(ElectronApp.ElectronApp, electronApp),
171+
Effect.provideService(
172+
ElectronWindow.ElectronWindow,
173+
{} as ElectronWindow.ElectronWindow["Service"],
174+
),
175+
Effect.provideService(DesktopWebLinks.DesktopWebLinks, ignoreWebLinks),
176+
Effect.provideService(HostProcess.Arguments, ["electron"]),
177+
);
178+
},
179+
);
180+
115181
it.effect("acquires and releases the SDK bridge with the layer", () => {
116182
const cleanup = vi.fn();
117183
const events: string[] = [];

‎apps/desktop/src/app/DesktopClerk.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@ export const make = Effect.gen(function* () {
151151
const context = yield* Effect.context<ElectronWindow.ElectronWindow>();
152152
const runPromise = Effect.runPromiseWith(context);
153153

154+
// Clerk's bare scheme registration omits the app entry on unpackaged Windows.
155+
// Development callbacks also need dev server environment this command cannot restore.
156+
if (
157+
!environment.isPackaged &&
158+
!environment.isDevelopment &&
159+
environment.platform === "win32"
160+
) {
161+
yield* electronApp.setAsDefaultProtocolClient(
162+
ElectronProtocol.getDesktopScheme(environment.isDevelopment),
163+
process.execPath,
164+
[environment.path.join(environment.dirname, "main.cjs")],
165+
);
166+
}
167+
154168
const startProviderAuthHandoff = (value: string | undefined) => {
155169
if (!value) return false;
156170
const request = readCodexAuthHandoff(value, environment.isDevelopment);

‎apps/desktop/src/app/DesktopDetachedActionErrors.test.ts‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎apps/desktop/src/backend/DesktopBackendPool.test.ts‎

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { assert, describe, it } from "@effect/vitest";
2-
import * as Duration from "effect/Duration";
32
import * as Effect from "effect/Effect";
43
import * as FileSystem from "effect/FileSystem";
54
import * as Layer from "effect/Layer";
@@ -19,29 +18,7 @@ import * as DesktopWindow from "../window/DesktopWindow.ts";
1918
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
2019
import * as DesktopBackendConfiguration from "./DesktopBackendConfiguration.ts";
2120
import * as DesktopBackendPool from "./DesktopBackendPool.ts";
22-
import type { DesktopBackendSnapshot, DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
23-
24-
function makeStubInstance(
25-
id: DesktopBackendPool.BackendInstanceId,
26-
label: string,
27-
): DesktopBackendPool.DesktopBackendInstance {
28-
const snapshot: DesktopBackendSnapshot = {
29-
desiredRunning: false,
30-
ready: false,
31-
activePid: Option.none(),
32-
restartAttempt: 0,
33-
restartScheduled: false,
34-
};
35-
return {
36-
id,
37-
label: Effect.succeed(label),
38-
start: Effect.void,
39-
stop: () => Effect.void,
40-
currentConfig: Effect.succeed(Option.none<DesktopBackendStartConfig>()),
41-
snapshot: Effect.succeed(snapshot),
42-
waitForReady: (_timeout: Duration.Duration) => Effect.succeed(false),
43-
};
44-
}
21+
import type { DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
4522

4623
function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.DesktopBackendPool> {
4724
return DesktopBackendPool.layer.pipe(
@@ -111,36 +88,6 @@ function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.De
11188
}
11289

11390
describe("DesktopBackendPool", () => {
114-
it.effect("layerTest exposes registered instances by id", () =>
115-
Effect.gen(function* () {
116-
const pool = yield* DesktopBackendPool.DesktopBackendPool;
117-
const fetchedPrimary = yield* pool.get(DesktopBackendPool.PRIMARY_INSTANCE_ID);
118-
const fetchedWsl = yield* pool.get(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"));
119-
const fetchedMissing = yield* pool.get(DesktopBackendPool.BackendInstanceId("missing"));
120-
const all = yield* pool.list;
121-
const resolvedPrimary = yield* pool.primary;
122-
123-
assert.equal(yield* Option.getOrThrow(fetchedPrimary).label, "Windows");
124-
assert.equal(yield* Option.getOrThrow(fetchedWsl).label, "WSL (Ubuntu)");
125-
assert.isTrue(Option.isNone(fetchedMissing));
126-
assert.lengthOf(all, 2);
127-
assert.equal(resolvedPrimary.id, DesktopBackendPool.PRIMARY_INSTANCE_ID);
128-
}).pipe(
129-
Effect.provide(
130-
DesktopBackendPool.layerTest([
131-
makeStubInstance(DesktopBackendPool.PRIMARY_INSTANCE_ID, "Windows"),
132-
makeStubInstance(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"), "WSL (Ubuntu)"),
133-
]),
134-
),
135-
),
136-
);
137-
138-
it.effect("layerTest dies when no instances are supplied", () =>
139-
Effect.exit(
140-
DesktopBackendPool.DesktopBackendPool.pipe(Effect.provide(DesktopBackendPool.layerTest([]))),
141-
).pipe(Effect.map((exit) => assert.equal(exit._tag, "Failure"))),
142-
);
143-
14491
it.effect("resolves the primary label lazily after pool layer construction", () =>
14592
Effect.scoped(
14693
Effect.gen(function* () {

‎apps/desktop/src/backend/DesktopBackendPool.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export const layer = Layer.effect(
180180
electronDialog
181181
.showErrorBox(
182182
"This T3 home is unavailable",
183-
"Another T3 Code server, such as the background service, is using this data directory. Stop that server and reopen T3 Code, or set a separate T3CODE_HOME and pair with the running server.",
183+
"Another T3 Code server, such as the background service, is using this data directory, or an older background service is set up for it. Stop that server or try `t3 update`. If the older launcher cannot update, run `t3 service uninstall` and optionally reinstall with `t3 service install` from a current CLI. Use `npx t3@latest` if `t3` is missing or outdated, and pass `--base-dir` with the service's T3 home to each command. Then reopen T3 Code. You can also set a separate T3CODE_HOME and pair with the running server.",
184184
)
185185
.pipe(Effect.andThen(electronApp.quit)),
186186
});

‎apps/desktop/src/backend/tailscaleEndpointProvider.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ describe("tailscale endpoint provider", () => {
209209
return {
210210
magicDnsName: "desktop.tail.ts.net",
211211
tailnetIpv4Addresses: ["100.74.126.34"],
212+
httpsServeEnabled: null,
212213
};
213214
}),
214215
});

0 commit comments

Comments
 (0)