Skip to content

Commit bafbb0a

Browse files
authored
Merge branch 'main' into fix/composer-command-description-width
2 parents 2f6e067 + 14f15cf commit bafbb0a

817 files changed

Lines changed: 52043 additions & 17368 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.

‎.coderabbit.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
reviews:
2+
review_status: false
3+
auto_review:
4+
enabled: false

‎.github/VOUCHED.td‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# -github:username reason for denouncement
1010
#
1111
# Keep entries sorted alphabetically.
12+
github:0x4bs3nt
13+
github:Adamulek123
1214
github:adityavardhansharma
1315
github:arhxam
1416
github:bil0000
@@ -26,6 +28,7 @@ github:github-actions[bot]
2628
github:gsimone
2729
github:GuilhermeVieiraDev
2830
github:hwanseoc
31+
github:ipanasenko
2932
github:jakeleventhal
3033
github:jamesx0416
3134
github:jappyjan
@@ -37,7 +40,9 @@ github:lnieuwenhuis
3740
github:Lucenx9
3841
github:mackinleysmith
3942
github:maria-rcks
43+
github:maxwellyoung
4044
github:mwolson
45+
github:nateEc
4146
github:nmggithub
4247
github:Noojuno
4348
github:notkainoa
@@ -57,6 +62,7 @@ github:StiensWout
5762
github:SunkenInTime
5863
github:tarik02
5964
github:tris203
65+
github:tsouth89
6066
github:UtkarshUsername
6167
github:Yash-Singh1
6268
github:yashranaway

‎.github/workflows/release.yml‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -851,35 +851,6 @@ jobs:
851851
fi
852852
done
853853
854-
# - name: Merge Windows updater manifests
855-
# run: |
856-
# shopt -s nullglob
857-
# found_windows_manifest=false
858-
# for x64_manifest in release-assets/*-win-x64.yml; do
859-
# if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
860-
# continue
861-
# fi
862-
863-
# arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
864-
# output_manifest="${x64_manifest/-win-x64.yml/.yml}"
865-
# if [[ ! -f "$arm64_manifest" ]]; then
866-
# echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
867-
# exit 1
868-
# fi
869-
870-
# found_windows_manifest=true
871-
# node scripts/merge-update-manifests.ts --platform win \
872-
# "$arm64_manifest" \
873-
# "$x64_manifest" \
874-
# "$output_manifest"
875-
# rm -f "$arm64_manifest" "$x64_manifest"
876-
# done
877-
878-
# if [[ "$found_windows_manifest" != true ]]; then
879-
# echo "No Windows updater manifests found to merge." >&2
880-
# exit 1
881-
# fi
882-
883854
- name: Publish release
884855
if: needs.preflight.outputs.previous_tag != ''
885856
uses: softprops/action-gh-release@v3

‎.macroscope/approvability.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
Use Macroscope's default approvability criteria.
22

33
Additionally, any pull request that changes product defaults is not auto-approvable and requires human review.
4+
5+
Any pull request that adds or broadens a directive that disables or suppresses a lint,
6+
type-checker, LSP, or other static-analysis diagnostic is not auto-approvable and requires
7+
human review. This includes file-level, line-level, and configuration-level overrides.

‎.macroscope/check-run-agents/effect-service-conventions.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Review changed TypeScript and directly affected call sites for the conventions b
8282
## Change discipline
8383

8484
- Preserve useful comments, invariants, and specification documentation while moving code.
85+
- Require every new or broadened directive that disables or suppresses a lint, type-checker, LSP, or other static-analysis diagnostic to have an adjacent comment explaining why that diagnostic must be disabled there. The directive itself is not an explanation. Report a missing explanation as a concrete violation.
8586
- Do not add large tests solely to prove a mechanical refactor. Update existing tests and imports as needed.
8687
- If backend behavior changes, require focused tests. Use test implementations/layers for external services only; do not mock out core business logic.
8788
- Do not require `Layer.effect`, universal namespace imports, generic `make`/`layer` names for abstract-port implementations, separate error classes for diagnostic-only fields, or new tests for import-only changes.

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Contributing
22

3+
## Developer Setup
4+
5+
See the [maintainer scripts guide](docs/internals/scripts.md#first-checkout) for the initial checkout,
6+
development commands, tests, and platform-specific desktop packaging prerequisites.
7+
38
## Read This First
49

510
We are not actively accepting contributions right now.

‎app.json‎

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

‎apps/desktop/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.0.37",
3+
"version": "0.0.38",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/main.cjs",
@@ -21,7 +21,7 @@
2121
"@t3tools/ssh": "workspace:*",
2222
"@t3tools/tailscale": "workspace:*",
2323
"effect": "catalog:",
24-
"electron": "41.5.0",
24+
"electron": "43.4.1",
2525
"electron-store": "^8.2.0",
2626
"electron-updater": "^6.6.2",
2727
"playwright-core": "1.60.0",

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as ElectronDialog from "../electron/ElectronDialog.ts";
1111
import * as ElectronProtocol from "../electron/ElectronProtocol.ts";
1212
import * as ElectronSafeStorage from "../electron/ElectronSafeStorage.ts";
1313
import { installDesktopIpcHandlers } from "../ipc/DesktopIpcHandlers.ts";
14+
import * as DesktopAppActivation from "./DesktopAppActivation.ts";
1415
import * as DesktopAppIdentity from "./DesktopAppIdentity.ts";
1516
import * as DesktopClerk from "./DesktopClerk.ts";
1617
import * as DesktopApplicationMenu from "../window/DesktopApplicationMenu.ts";
@@ -26,6 +27,7 @@ import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts";
2627
import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts";
2728
import * as DesktopShellEnvironment from "../shell/DesktopShellEnvironment.ts";
2829
import * as DesktopState from "./DesktopState.ts";
30+
import * as DesktopRemoteUpdates from "../updates/DesktopRemoteUpdates.ts";
2931
import * as DesktopUpdates from "../updates/DesktopUpdates.ts";
3032
import * as DesktopWslBackend from "../wsl/DesktopWslBackend.ts";
3133

@@ -148,6 +150,7 @@ const bootstrap = Effect.gen(function* () {
148150
const serverExposure = yield* DesktopServerExposure.DesktopServerExposure;
149151
const wslBackend = yield* DesktopWslBackend.DesktopWslBackend;
150152
const desktopWindow = yield* DesktopWindow.DesktopWindow;
153+
const appActivation = yield* DesktopAppActivation.DesktopAppActivation;
151154
yield* logBootstrapInfo("bootstrap start");
152155

153156
if (environment.isDevelopment && Option.isNone(environment.configuredBackendPort)) {
@@ -210,6 +213,10 @@ const bootstrap = Effect.gen(function* () {
210213
}
211214
yield* primaryBackend.start;
212215
yield* logBootstrapInfo("bootstrap backend start requested");
216+
yield* appActivation.start.pipe(
217+
Effect.tap(() => logBootstrapInfo("desktop app control socket ready")),
218+
Effect.catch((error) => logStartupError("desktop app control socket unavailable", { error })),
219+
);
213220
// Bring up the WSL backend if the user previously enabled it. The
214221
// primary is already starting; reconcile fires off the WSL register
215222
// in parallel rather than blocking primary readiness on a possibly
@@ -286,6 +293,7 @@ const startup = Effect.gen(function* () {
286293
yield* appIdentity.configure;
287294
yield* applicationMenu.configure;
288295
yield* updates.configure;
296+
yield* DesktopRemoteUpdates.listen;
289297
yield* linuxUrlHandler.register;
290298
yield* bootstrap.pipe(Effect.catchCause((cause) => fatalStartupCause("bootstrap", cause)));
291299
}).pipe(Effect.withSpan("desktop.startup"));
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// @effect-diagnostics nodeBuiltinImport:off -- This adapter test binds a real local socket or Windows named pipe and verifies its cleanup.
2+
import * as NodeFSP from "node:fs/promises";
3+
import * as NodeNet from "node:net";
4+
import * as NodeOS from "node:os";
5+
import * as NodePath from "node:path";
6+
7+
import {
8+
ProjectId,
9+
ThreadId,
10+
type DesktopAppActivationRequest,
11+
type DesktopAppActivationResponse,
12+
} from "@t3tools/contracts";
13+
import { resolveDesktopAppControlAddress } from "@t3tools/shared/desktopAppControl";
14+
import { HostProcessPlatform, HostProcessUserId } from "@t3tools/shared/hostProcess";
15+
import { it } from "@effect/vitest";
16+
import * as Effect from "effect/Effect";
17+
import { afterEach, describe, expect } from "vite-plus/test";
18+
19+
import { startDesktopAppControlServer } from "./DesktopAppActivation.ts";
20+
21+
const openServers: Array<{ close: () => Promise<void> }> = [];
22+
23+
afterEach(async () => {
24+
await Promise.all(openServers.splice(0).map((server) => server.close()));
25+
});
26+
27+
function makeTarget(stateDir: string, platform: NodeJS.Platform, userId: number | undefined) {
28+
return resolveDesktopAppControlAddress({
29+
stateDir,
30+
platform,
31+
tempDir: NodeOS.tmpdir(),
32+
userId,
33+
joinPath: NodePath.join,
34+
});
35+
}
36+
37+
function request(requestId: string, platform: NodeJS.Platform): DesktopAppActivationRequest {
38+
return {
39+
version: 1,
40+
requestId,
41+
type: "open-workspace",
42+
workspaceRoot: NodePath.join(NodeOS.tmpdir(), "project"),
43+
platform: platform === "win32" ? "win32" : platform === "darwin" ? "darwin" : "linux",
44+
};
45+
}
46+
47+
function exchange(address: string, payload: DesktopAppActivationRequest) {
48+
return new Promise<DesktopAppActivationResponse>((resolve, reject) => {
49+
const socket = NodeNet.createConnection(address);
50+
socket.setEncoding("utf8");
51+
let buffer = "";
52+
socket.once("error", reject);
53+
socket.once("connect", () => socket.write(`${JSON.stringify(payload)}\n`));
54+
socket.on("data", (chunk) => {
55+
buffer += chunk;
56+
const newline = buffer.indexOf("\n");
57+
if (newline === -1) return;
58+
socket.destroy();
59+
resolve(JSON.parse(buffer.slice(0, newline)) as DesktopAppActivationResponse);
60+
});
61+
});
62+
}
63+
64+
describe("desktop app control server", () => {
65+
it.effect("roundtrips a request and removes its socket on shutdown", () =>
66+
Effect.gen(function* () {
67+
const platform = yield* HostProcessPlatform;
68+
const userId = yield* HostProcessUserId;
69+
yield* Effect.promise(async () => {
70+
const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-app-control-test-"));
71+
const target = makeTarget(NodePath.join(root, "userdata"), platform, userId);
72+
const received: DesktopAppActivationRequest[] = [];
73+
const server = await startDesktopAppControlServer({
74+
...target,
75+
userId,
76+
handle: async (input) => {
77+
received.push(input);
78+
return {
79+
version: 1,
80+
requestId: input.requestId,
81+
ok: true,
82+
projectId: ProjectId.make("project-1"),
83+
threadId: ThreadId.make("thread-1"),
84+
};
85+
},
86+
cancel: () => undefined,
87+
});
88+
openServers.push(server);
89+
90+
const response = await exchange(target.address, request("request-1", platform));
91+
92+
expect(received).toHaveLength(1);
93+
expect(response).toMatchObject({ ok: true, requestId: "request-1" });
94+
await server.close();
95+
openServers.splice(openServers.indexOf(server), 1);
96+
if (target.directory !== null) {
97+
await expect(NodeFSP.stat(target.address)).rejects.toMatchObject({ code: "ENOENT" });
98+
}
99+
await NodeFSP.rm(root, { recursive: true, force: true });
100+
});
101+
}),
102+
);
103+
104+
it.effect("cancels a queued request when the client disconnects", () =>
105+
Effect.gen(function* () {
106+
const platform = yield* HostProcessPlatform;
107+
const userId = yield* HostProcessUserId;
108+
yield* Effect.promise(async () => {
109+
const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-app-cancel-test-"));
110+
const target = makeTarget(NodePath.join(root, "userdata"), platform, userId);
111+
let resolveCanceled: (requestId: string) => void = () => undefined;
112+
const canceled = new Promise<string>((resolve) => {
113+
resolveCanceled = resolve;
114+
});
115+
const server = await startDesktopAppControlServer({
116+
...target,
117+
userId,
118+
handle: () => new Promise(() => undefined),
119+
cancel: resolveCanceled,
120+
});
121+
openServers.push(server);
122+
const socket = NodeNet.createConnection(target.address);
123+
await new Promise<void>((resolve, reject) => {
124+
socket.once("error", reject);
125+
socket.once("connect", () => {
126+
socket.write(`${JSON.stringify(request("request-canceled", platform))}\n`, () => {
127+
socket.destroy();
128+
resolve();
129+
});
130+
});
131+
});
132+
133+
await expect(canceled).resolves.toBe("request-canceled");
134+
await server.close();
135+
openServers.splice(openServers.indexOf(server), 1);
136+
await NodeFSP.rm(root, { recursive: true, force: true });
137+
});
138+
}),
139+
);
140+
});

0 commit comments

Comments
 (0)