Skip to content

Commit d60de33

Browse files
Merge branch 'main' into fix/compact-composer-context-meter
2 parents 579a878 + 2675e3c commit d60de33

342 files changed

Lines changed: 23854 additions & 2353 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/VOUCHED.td‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,28 @@
1212
github:0x4bs3nt
1313
github:Adamulek123
1414
github:adityavardhansharma
15+
github:aoright
1516
github:arhxam
1617
github:bil0000
1718
github:binbandit
1819
github:Brechard
20+
github:btsouth
1921
github:chrisdeeming
2022
github:chuks-qua
2123
github:cursoragent
2224
github:D3OXY
25+
github:dbalders
2326
github:eggfriedrice24
2427
github:extoci
28+
github:flamboh
29+
github:FllipEis
2530
github:gbarros-dev
2631
github:gfsaaser24
2732
github:github-actions[bot]
2833
github:gsimone
2934
github:GuilhermeVieiraDev
3035
github:hwanseoc
36+
github:inayayousfi
3137
github:ipanasenko
3238
github:jakeleventhal
3339
github:jamesx0416
@@ -36,13 +42,18 @@ github:jasonLaster
3642
github:JoeEverest
3743
github:justsomelegs
3844
github:kridaydave
45+
github:lgwacker
3946
github:lnieuwenhuis
4047
github:Lucenx9
4148
github:mackinleysmith
4249
github:maria-rcks
50+
github:MatthewFeroz
4351
github:maxwellyoung
4452
github:mwolson
53+
github:myacoub91
54+
github:naMqe-h
4555
github:nateEc
56+
github:naveed949
4657
github:nmggithub
4758
github:Noojuno
4859
github:notkainoa
@@ -64,6 +75,7 @@ github:tarik02
6475
github:tris203
6576
github:tsouth89
6677
github:UtkarshUsername
78+
github:vitalyiegorov
6779
github:Yash-Singh1
6880
github:yashranaway
6981
github:Ymit24

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
- name: Typecheck
5252
run: vpr typecheck
5353

54+
- name: Install browser secret helper build libraries
55+
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
56+
5457
- name: Build desktop pipeline
5558
run: vp run build:desktop
5659

@@ -85,6 +88,9 @@ jobs:
8588
- name: Ensure Electron runtime is installed
8689
run: vp run --filter @t3tools/desktop ensure:electron
8790

91+
- name: Install browser secret helper build libraries
92+
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
93+
8894
- name: Test
8995
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
9096

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Forward to Cursor hygiene
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, reopened, ready_for_review]
8+
issues:
9+
types: [opened, closed, reopened]
10+
discussion:
11+
types: [created, closed, reopened]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
forward:
18+
name: POST to Cursor
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: POST to Cursor
22+
env:
23+
URL: ${{ secrets.CURSOR_T3CODE_WEBHOOK_URL }}
24+
AUTH: ${{ secrets.CURSOR_T3CODE_WEBHOOK_AUTH }}
25+
run: |
26+
set -euo pipefail
27+
if [ -z "${URL:-}" ] || [ -z "${AUTH:-}" ]; then
28+
echo "Missing CURSOR_T3CODE_WEBHOOK_URL or CURSOR_T3CODE_WEBHOOK_AUTH — skipping."
29+
exit 0
30+
fi
31+
curl -fsS --max-time 60 -X POST "$URL" \
32+
-H "Authorization: $AUTH" \
33+
-H "Content-Type: application/json" \
34+
-H "X-GitHub-Event: ${{ github.event_name }}" \
35+
-H "X-GitHub-Delivery: ${{ github.run_id }}-${{ github.run_attempt }}" \
36+
--data-binary @"${{ github.event_path }}"

‎.github/workflows/release.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ jobs:
216216
- name: Typecheck
217217
run: vp run typecheck
218218

219+
- name: Install browser secret helper build libraries
220+
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
221+
219222
- name: Test
220223
run: vp run test
221224

@@ -524,12 +527,13 @@ jobs:
524527
exit $code
525528
}
526529
527-
- name: Install ImageMagick
530+
- name: Install Linux desktop build libraries
528531
if: matrix.platform == 'linux'
529532
shell: bash
530533
run: |
534+
sudo apt-get update
535+
sudo apt-get install -y libsecret-1-dev pkg-config
531536
if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
532-
sudo apt-get update
533537
sudo apt-get install -y imagemagick
534538
fi
535539
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# On-demand Windows test lane. Manual only: nothing in the suite passes on
2+
# Windows yet, so this exists to give contributors (and agents) a cloud Windows
3+
# box to iterate against. Once the suite is green here, fold it into ci.yml.
4+
#
5+
# gh workflow run windows-tests.yml --ref <branch> -f package=packages/shared
6+
# gh workflow run windows-tests.yml --ref <branch> -f package=apps/server \
7+
# -f files="src/process/externalLauncher.test.ts src/cli/theme.test.ts"
8+
# gh run watch && gh run view --log-failed
9+
name: Windows Tests
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
package:
15+
description: "Workspace directory to test, e.g. apps/server or packages/shared. Empty runs every package except apps/server."
16+
type: string
17+
default: ""
18+
files:
19+
description: "Space-separated test files relative to the package directory. Empty runs the package's whole suite. Requires package."
20+
type: string
21+
default: ""
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
test:
28+
name: Test (${{ inputs.package || 'all non-server' }})
29+
runs-on: blacksmith-8vcpu-windows-2025
30+
timeout-minutes: 45
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v6
34+
with:
35+
sparse-checkout: |
36+
/*
37+
!/.repos/
38+
sparse-checkout-cone-mode: false
39+
40+
# setup-vp's own cache restores a Linux-shaped store on Windows, which is
41+
# slower than no cache (see #7975). Cache pnpm's Windows store directly.
42+
- name: Setup Vite+
43+
uses: voidzero-dev/setup-vp@v1
44+
with:
45+
node-version-file: package.json
46+
cache: false
47+
run-install: false
48+
49+
- name: Resolve package cache path
50+
id: package_cache_path
51+
shell: pwsh
52+
run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
53+
54+
- name: Cache packages
55+
uses: actions/cache@v6
56+
with:
57+
path: ${{ steps.package_cache_path.outputs.path }}
58+
key: windows-tests-packages-v1-${{ hashFiles('pnpm-lock.yaml') }}
59+
60+
- name: Install
61+
run: vp install
62+
63+
- name: Ensure Electron runtime is installed
64+
if: inputs.package == '' || inputs.package == 'apps/desktop'
65+
run: vp run --filter "@t3tools/desktop" ensure:electron
66+
67+
# `vp run ... test -- <files>` does not forward positional args to vitest,
68+
# so file-scoped runs call `vp test run` inside the package instead.
69+
- name: Test
70+
shell: pwsh
71+
run: |
72+
$package = '${{ inputs.package }}'
73+
$files = '${{ inputs.files }}'
74+
if ($package -eq '') {
75+
vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
76+
} elseif ($files -eq '') {
77+
vp run --filter "./$package" test
78+
} else {
79+
Set-Location $package
80+
vp test run $files.Split(' ')
81+
}

‎apps/desktop/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@clerk/electron": "catalog:",
1616
"@clerk/electron-passkeys": "catalog:",
1717
"@effect/platform-node": "catalog:",
18+
"@napi-rs/keyring": "^1.3.0",
1819
"@t3tools/client-runtime": "workspace:*",
1920
"@t3tools/contracts": "workspace:*",
2021
"@t3tools/shared": "workspace:*",
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import * as NodeChildProcess from "node:child_process";
2+
import * as NodeFS from "node:fs";
3+
import * as NodeOS from "node:os";
4+
import * as NodePath from "node:path";
5+
import * as NodeURL from "node:url";
6+
import { afterAll, beforeAll, describe, expect, it } from "vite-plus/test";
7+
8+
// oxlint-disable-next-line t3code/no-global-process-runtime -- The native compiler targets the actual host; this script has no Effect runtime.
9+
const hostArch = process.arch;
10+
// oxlint-disable-next-line t3code/no-global-process-runtime -- Native compilation only runs on the actual Linux host.
11+
const hostPlatform = process.platform;
12+
13+
describe.skipIf(hostPlatform !== "linux")("bundled libsecret helper", () => {
14+
let directory;
15+
let executable;
16+
beforeAll(() => {
17+
directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-browser-secret-test-"));
18+
executable = NodePath.join(directory, "t3-browser-secret");
19+
const root = NodeURL.fileURLToPath(new URL("../../../native/browser-secret/", import.meta.url));
20+
const flags = NodeChildProcess.execFileSync(
21+
"pkg-config",
22+
["--cflags", "--libs", "libsecret-1"],
23+
{
24+
encoding: "utf8",
25+
},
26+
)
27+
.trim()
28+
.split(/\s+/);
29+
NodeChildProcess.execFileSync(
30+
process.env.CC || "cc",
31+
[
32+
"-std=c11",
33+
"-Wall",
34+
"-Wextra",
35+
"-Werror",
36+
NodePath.join(root, "main.c"),
37+
NodePath.join(root, "test.c"),
38+
"-Wl,--wrap=secret_service_search_sync",
39+
"-Wl,--wrap=secret_item_get_locked",
40+
"-Wl,--wrap=secret_item_get_secret",
41+
"-o",
42+
executable,
43+
...flags,
44+
],
45+
{ stdio: "pipe" },
46+
);
47+
});
48+
afterAll(() => {
49+
if (directory) NodeFS.rmSync(directory, { recursive: true, force: true });
50+
});
51+
52+
const run = (args) =>
53+
NodeChildProcess.spawnSync(executable, args, {
54+
env: { ...process.env, DBUS_SESSION_BUS_ADDRESS: "unix:path=/unused-test-bus" },
55+
});
56+
57+
it("builds an executable for the requested architecture into a staged resource directory", () => {
58+
const output = NodePath.join(directory, "resources", "browser-secret", "t3-browser-secret");
59+
NodeChildProcess.execFileSync(process.execPath, [
60+
NodeURL.fileURLToPath(new URL("./build-browser-secret.mjs", import.meta.url)),
61+
"--arch",
62+
hostArch,
63+
"--output",
64+
output,
65+
]);
66+
const header = NodeFS.readFileSync(output).subarray(0, 20);
67+
expect(header.toString("hex", 0, 6)).toBe("7f454c460201");
68+
expect(header.readUInt16LE(18)).toBe({ x64: 62, arm64: 183 }[hostArch]);
69+
expect(NodeFS.statSync(output).mode & 0o111).not.toBe(0);
70+
// Invalid arguments exit before the real executable could contact a keyring.
71+
expect(NodeChildProcess.spawnSync(output, []).status).toBe(64);
72+
});
73+
74+
it("preserves the exact secret bytes with no added or removed delimiter", () => {
75+
const result = run(["success"]);
76+
expect(result.status).toBe(0);
77+
expect(result.stdout).toEqual(Buffer.from("secret\0with whitespace \t\r\n"));
78+
expect(result.stderr.length).toBe(0);
79+
});
80+
81+
for (const [scenario, code] of [
82+
["missing", 2],
83+
["empty", 2],
84+
["locked", 3],
85+
["cancelled", 3],
86+
["denied", 3],
87+
["unavailable", 4],
88+
["unloaded", 4],
89+
]) {
90+
it(`reports ${scenario} without emitting a secret`, () => {
91+
const result = run([scenario]);
92+
expect(result.status).toBe(code);
93+
expect(result.stdout.length).toBe(0);
94+
});
95+
}
96+
it("rejects invalid arguments before accessing the keyring", () => {
97+
for (const args of [[], [""], ["chrome", "extra"]]) {
98+
const result = run(args);
99+
expect(result.status).toBe(64);
100+
expect(result.stdout.length).toBe(0);
101+
}
102+
});
103+
});
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import * as NodeChildProcess from "node:child_process";
2+
import * as NodeFS from "node:fs";
3+
import * as NodePath from "node:path";
4+
import * as NodeURL from "node:url";
5+
import * as NodeUtil from "node:util";
6+
7+
// oxlint-disable-next-line t3code/no-global-process-runtime -- The native compiler targets the actual host; this script has no Effect runtime.
8+
const hostArch = process.arch;
9+
// oxlint-disable-next-line t3code/no-global-process-runtime -- Native compilation only runs on the actual Linux host.
10+
const hostPlatform = process.platform;
11+
12+
const { values } = NodeUtil.parseArgs({
13+
options: { output: { type: "string" }, arch: { type: "string", default: hostArch } },
14+
});
15+
16+
if (hostPlatform === "linux") {
17+
const machine = { x64: 62, arm64: 183 }[values.arch];
18+
if (machine === undefined) throw new Error(`Unsupported Linux architecture: ${values.arch}`);
19+
const root = NodeURL.fileURLToPath(new URL("../../../native/browser-secret/", import.meta.url));
20+
const source = NodePath.resolve(root, "main.c");
21+
const output = values.output ?? NodePath.resolve(root, "build", values.arch, "t3-browser-secret");
22+
const matchesArchitecture = (file) => {
23+
const header = NodeFS.readFileSync(file).subarray(0, 20);
24+
return header.toString("hex", 0, 6) === "7f454c460201" && header.readUInt16LE(18) === machine;
25+
};
26+
let current = false;
27+
try {
28+
current =
29+
NodeFS.statSync(output).mtimeMs >=
30+
Math.max(
31+
NodeFS.statSync(source).mtimeMs,
32+
NodeFS.statSync(NodeURL.fileURLToPath(import.meta.url)).mtimeMs,
33+
) && matchesArchitecture(output);
34+
} catch {
35+
/* The first build has no output yet. */
36+
}
37+
if (!current) {
38+
let flags;
39+
try {
40+
flags = NodeChildProcess.execFileSync("pkg-config", ["--cflags", "--libs", "libsecret-1"], {
41+
encoding: "utf8",
42+
})
43+
.trim()
44+
.split(/\s+/);
45+
} catch (cause) {
46+
throw new Error(
47+
"Building the Linux browser import helper requires pkg-config and libsecret development headers (Ubuntu/Debian: libsecret-1-dev).",
48+
{ cause },
49+
);
50+
}
51+
NodeFS.mkdirSync(NodePath.dirname(output), { recursive: true });
52+
const temporary = `${output}.${process.pid}.tmp`;
53+
try {
54+
NodeChildProcess.execFileSync(
55+
process.env.CC || "cc",
56+
["-std=c11", "-O2", "-Wall", "-Wextra", "-Werror", source, "-o", temporary, ...flags],
57+
{ stdio: "inherit" },
58+
);
59+
if (!matchesArchitecture(temporary))
60+
throw new Error(`C compiler did not produce a Linux ${values.arch} executable.`);
61+
NodeFS.renameSync(temporary, output);
62+
} finally {
63+
NodeFS.rmSync(temporary, { force: true });
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)