Skip to content

Commit 092586d

Browse files
Merge branch 'main' into fix/issue-29323
2 parents 37441e9 + f6503f0 commit 092586d

536 files changed

Lines changed: 16407 additions & 5150 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/workflows/release-desktop.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ jobs:
203203
native/hyprland-snap-shot/target/${{ inputs.rust_target }}/release/t3-hyprland-snap-shot
204204
key: linux-capture-helpers-${{ inputs.rust_target }}-${{ hashFiles('native/kde-snap-shot/Cargo.lock', 'native/kde-snap-shot/Cargo.toml', 'native/kde-snap-shot/src/**', 'native/hyprland-snap-shot/Cargo.lock', 'native/hyprland-snap-shot/Cargo.toml', 'native/hyprland-snap-shot/src/**', 'native/hyprland-snap-shot/protocols/**') }}
205205

206+
- name: Ensure Rosetta for macOS x64 bytecode generation
207+
if: inputs.platform == 'mac' && inputs.arch == 'x64'
208+
shell: bash
209+
run: |
210+
if [[ "$(uname -m)" == "arm64" ]] && ! /usr/bin/arch -x86_64 /usr/bin/true; then
211+
sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license
212+
fi
213+
206214
- name: Setup Rust
207215
if: steps.resource_monitor_cache.outputs.cache-hit != 'true' || (inputs.platform == 'linux' && steps.capture_helper_cache.outputs.cache-hit != 'true')
208216
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# T3 Code
22

3-
T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity) and serves web, desktop, and mobile clients.
3+
T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity, Kiro) and serves web, desktop, and mobile clients.
44

55
You can think of T3 Code as an open source "bring-your-own-subscription" alternative to apps like Claude Desktop, Codex App, Cursor Glass and Conductor.
66

@@ -68,7 +68,7 @@ The most common defect in this repo is a change that works on the path you teste
6868

6969
- **Entry points.** A behavior reachable from the chat view is usually also reachable from Settings, the command palette, and a keybinding. Fixing one is not fixing the feature.
7070
- **Clients.** Web, desktop (wraps web, adds Electron shell/IPC), and mobile (React Native, separate navigation). Shared logic lives in `packages/client-runtime`
71-
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, and Antigravity each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
71+
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, Antigravity, and Kiro each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
7272
- **Agents.** A capability a user can trigger is usually one an agent should reach through MCP tools, and scheduled tasks run the same paths. That only works when it is a service method, not handler code.
7373
- **Contracts.** Anything crossing the wire is typed in `packages/contracts`. Change the schema and the server, web, mobile, and desktop all follow.
7474
- **Reverse states.** If you added a way in, add the way out and the way to see it. Snooze needs unsnooze. Close needs reopen. A one-way door is a bug.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as Ref from "effect/Ref";
66
import * as Schema from "effect/Schema";
77

88
import * as NetService from "@t3tools/shared/Net";
9-
import * as Crypto from "effect/Crypto";
9+
import * as SecureRandom from "effect/crypto/SecureRandom";
1010
import * as ElectronApp from "../electron/ElectronApp.ts";
1111
import * as ElectronDialog from "../electron/ElectronDialog.ts";
1212
import * as ElectronProtocol from "../electron/ElectronProtocol.ts";
@@ -42,8 +42,8 @@ const DEFAULT_DESKTOP_BACKEND_PORT = 3773;
4242
const MAX_TCP_PORT = 65_535;
4343
const DESKTOP_BACKEND_PORT_PROBE_HOSTS = ["127.0.0.1", "0.0.0.0", "::"] as const;
4444

45-
const makeDesktopRunId = Crypto.Crypto.pipe(
46-
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
45+
const makeDesktopRunId = SecureRandom.SecureRandom.pipe(
46+
Effect.flatMap((random) => random.uuidV4()),
4747
Effect.map((value) => value.replaceAll("-", "").slice(0, 12)),
4848
);
4949

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
12
import * as NodeServices from "@effect/platform-node/NodeServices";
23
import { assert, describe, it } from "@effect/vitest";
34
import { ConnectionCatalogDocument } from "@t3tools/client-runtime/platform";
@@ -75,6 +76,7 @@ function layerFor(
7576
layerEnvironment,
7677
layerSafeStorage,
7778
NodeServices.layer,
79+
NodeCrypto.layer,
7880
fileSystemLayer,
7981
);
8082
const layerSavedEnvironments = DesktopSavedEnvironments.layer.pipe(

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import type { PersistedSavedEnvironmentRecord } from "@t3tools/contracts";
1414
import { fromLenientJson } from "@t3tools/shared/schemaJson";
1515
import * as Context from "effect/Context";
16-
import * as Crypto from "effect/Crypto";
16+
import * as SecureRandom from "effect/crypto/SecureRandom";
1717
import * as Effect from "effect/Effect";
1818
import * as Base64 from "effect/encoding/Base64";
1919
import * as FileSystem from "effect/FileSystem";
@@ -381,7 +381,7 @@ export const make = Effect.gen(function* () {
381381
const fileSystem = yield* FileSystem.FileSystem;
382382
const path = yield* Path.Path;
383383
const safeStorage = yield* ElectronSafeStorage.ElectronSafeStorage;
384-
const crypto = yield* Crypto.Crypto;
384+
const random = yield* SecureRandom.SecureRandom;
385385
const savedEnvironments = yield* DesktopSavedEnvironments.DesktopSavedEnvironments;
386386
const catalogPath = path.join(environment.stateDir, "connection-catalog.json");
387387
const encryptionAvailable = safeStorage.isEncryptionAvailable.pipe(
@@ -410,16 +410,7 @@ export const make = Effect.gen(function* () {
410410
),
411411
),
412412
);
413-
const suffix = (yield* crypto.randomUUIDv4().pipe(
414-
Effect.mapError(
415-
(cause) =>
416-
new DesktopConnectionCatalogStoreWriteError({
417-
operation: "create-temporary-file-name",
418-
path: catalogPath,
419-
cause,
420-
}),
421-
),
422-
)).replace(/-/g, "");
413+
const suffix = (yield* random.uuidV4()).replace(/-/g, "");
423414
yield* writeDocument({
424415
fileSystem,
425416
path,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ describe("DesktopLinuxUrlHandler", () => {
381381
if (!ChildProcess.isStandardCommand(command)) {
382382
return yield* Effect.die("expected a single registration command");
383383
}
384-
recorded.commands.push({ command: command.command, args: command.args });
384+
recorded.commands.push({ command: command.command, args: command.args.map(String) });
385385
if (command.command !== stalledHelper) return mockProcess(0);
386386
const child = yield* realSpawner.spawn(
387387
ChildProcess.make(

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
12
import * as NodeServices from "@effect/platform-node/NodeServices";
23
import { assert, describe, it } from "@effect/vitest";
34
import { currentDesktopBootstrapToken } from "@t3tools/shared/desktopBootstrapToken";
@@ -76,6 +77,7 @@ function layerEnvironment(
7677
Layer.provide(
7778
Layer.mergeAll(
7879
NodeServices.layer,
80+
NodeCrypto.layer,
7981
DesktopConfig.layerTest({
8082
T3CODE_HOME: baseDir,
8183
T3CODE_PORT: "9999",
@@ -127,7 +129,7 @@ const withHarness = <A, E, R>(
127129
),
128130
),
129131
);
130-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer));
132+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)));
131133

132134
interface PackagedWslHarnessContext {
133135
readonly baseDir: string;
@@ -219,7 +221,7 @@ const withPackagedWslHarness = <A, E, R>(
219221
),
220222
),
221223
);
222-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer));
224+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)));
223225

224226
describe("DesktopBackendConfiguration", () => {
225227
it.effect("resolvePrimary produces a stable scoped bootstrap token", () =>
@@ -316,7 +318,7 @@ describe("DesktopBackendConfiguration", () => {
316318
path.join(resourcesPath, "server.asar/apps/server/dist/bin.mjs"),
317319
);
318320
assert.equal(config.env.ELECTRON_RUN_AS_NODE, "1");
319-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
321+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
320322
);
321323

322324
it.effect("resolveWsl pins a default-tracking run to the concrete default distro", () =>
@@ -376,7 +378,7 @@ describe("DesktopBackendConfiguration", () => {
376378
assert.deepEqual(config.args.slice(0, 2), ["-d", "Ubuntu"]);
377379
assert.deepEqual(observedDistros, ["Ubuntu", "Ubuntu", "Ubuntu"]);
378380
assert.isTrue(Option.isNone(config.preflightFailure));
379-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
381+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
380382
);
381383

382384
it.effect("resolveWsl launches a packaged backend from the WSL-local runtime cache", () => {
@@ -665,7 +667,7 @@ describe("DesktopBackendConfiguration", () => {
665667
assert.notInclude(config.args, "/bin/sh");
666668
assert.notInclude(config.args, "-c");
667669
assert.isTrue(Option.isNone(config.preflightFailure));
668-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
670+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
669671
);
670672

671673
it.effect("resolvePrimary and resolveWsl share one token under concurrent resolution", () =>
@@ -733,7 +735,7 @@ describe("DesktopBackendConfiguration", () => {
733735
restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
734736
restoreEnv("OTEL_RESOURCE_ATTRIBUTES", previousResourceAttributes);
735737
}
736-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
738+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
737739
);
738740

739741
it.effect("resolveWsl preserves existing WSLENV entries when forwarding backend secrets", () =>
@@ -800,7 +802,7 @@ describe("DesktopBackendConfiguration", () => {
800802
restoreEnv("T3CODE_OTLP_PROTOCOL", previousOtlpProtocol);
801803
for (const [name, value] of ambientOtel) restoreEnv(name, value);
802804
}
803-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
805+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
804806
);
805807

806808
it.effect(
@@ -837,7 +839,7 @@ describe("DesktopBackendConfiguration", () => {
837839
),
838840
),
839841
);
840-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
842+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
841843
);
842844

843845
it.effect(
@@ -880,7 +882,7 @@ describe("DesktopBackendConfiguration", () => {
880882
),
881883
),
882884
);
883-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
885+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
884886
);
885887

886888
it.effect("resolveWsl marks a missing packaged server entry as fatal", () =>
@@ -913,7 +915,7 @@ describe("DesktopBackendConfiguration", () => {
913915
),
914916
),
915917
);
916-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
918+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
917919
);
918920

919921
it.effect("prefers the external packaged resource monitor over the copy inside the asar", () =>
@@ -962,7 +964,7 @@ describe("DesktopBackendConfiguration", () => {
962964
),
963965
),
964966
);
965-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
967+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
966968
);
967969

968970
it("resolvePrimaryLabel is runSync-safe against the real WSL availability probe", async () => {
@@ -983,7 +985,7 @@ describe("DesktopBackendConfiguration", () => {
983985
),
984986
),
985987
Layer.provideMerge(layerEnvironment("/tmp/t3-wsl-isavailable", { platform: "win32" })),
986-
Layer.provide(NodeServices.layer),
988+
Layer.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
987989
),
988990
);
989991
try {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serve
44
import { currentDesktopBootstrapToken } from "@t3tools/shared/desktopBootstrapToken";
55
import * as Clock from "effect/Clock";
66
import * as Context from "effect/Context";
7-
import * as Crypto from "effect/Crypto";
7+
import * as SecureRandom from "effect/crypto/SecureRandom";
88
import * as Effect from "effect/Effect";
99
import * as Hex from "effect/encoding/Hex";
1010
import * as FileSystem from "effect/FileSystem";
@@ -723,14 +723,14 @@ export const make = Effect.gen(function* () {
723723
const wslEnvironment = yield* DesktopWslEnvironment.DesktopWslEnvironment;
724724
const wslServerTree = yield* DesktopWslServerTree.DesktopWslServerTree;
725725
const settings = yield* DesktopAppSettings.DesktopAppSettings;
726-
const crypto = yield* Crypto.Crypto;
726+
const random = yield* SecureRandom.SecureRandom;
727727
// Random generation yields; serialize it so concurrent backends cannot capture distinct bootstrap secrets.
728728
const secretRef = yield* SynchronizedRef.make(Option.none<string>());
729729
const getOrCreateBootstrapSecret = SynchronizedRef.modifyEffect(secretRef, (current) =>
730730
Option.match(current, {
731731
onSome: (secret) => Effect.succeed([secret, current] as const),
732732
onNone: () =>
733-
crypto.randomBytes(32).pipe(
733+
random.randomBytes(32).pipe(
734734
Effect.map((bytes) => {
735735
const secret = Hex.encode(bytes);
736736
return [secret, Option.some(secret)] as const;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
22
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
3+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
34
import * as NodeServices from "@effect/platform-node/NodeServices";
45
import { assert, describe, it } from "@effect/vitest";
56
import * as Deferred from "effect/Deferred";
@@ -81,7 +82,11 @@ function layerEnvironmentFor(baseDir: string, env: Record<string, string | undef
8182
runningUnderArm64Translation: false,
8283
}).pipe(
8384
Layer.provide(
84-
Layer.mergeAll(NodeServices.layer, DesktopConfig.layerTest({ T3CODE_HOME: baseDir, ...env })),
85+
Layer.mergeAll(
86+
NodeServices.layer,
87+
NodeCrypto.layer,
88+
DesktopConfig.layerTest({ T3CODE_HOME: baseDir, ...env }),
89+
),
8590
),
8691
);
8792
}
@@ -145,7 +150,7 @@ const withHarness = <A, E, R>(
145150
}),
146151
),
147152
);
148-
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped);
153+
}).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)), Effect.scoped);
149154

150155
describe("DesktopServerExposure", () => {
151156
it.effect("uses cached Tailscale identity to exclude another VPN's pairing address", () => {

‎apps/desktop/src/main.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ for (const stream of [process.stdout, process.stderr]) {
77

88
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
99
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
10+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
1011
import * as NodeServices from "@effect/platform-node/NodeServices";
1112
// @effect-diagnostics-next-line nodeBuiltinImport:off - Version output must flush before Electron exits, without acquiring the runtime.
1213
import * as NodeFS from "node:fs";
@@ -230,12 +231,12 @@ const layerDesktopClerk = DesktopClerk.layer.pipe(
230231
Layer.provide(DesktopPreReadyFileSystem.layer),
231232
Layer.provideMerge(ElectronShell.layer),
232233
Layer.provideMerge(layerDesktopEnvironment),
233-
Layer.provideMerge(NodeServices.layer),
234+
Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
234235
Layer.provideMerge(ElectronApp.layer),
235236
);
236237

237238
const layerDesktopApplicationRuntime = layerDesktopApplication.pipe(
238-
Layer.provideMerge(NodeServices.layer),
239+
Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
239240
Layer.provideMerge(NodeHttpClient.layerUndici),
240241
Layer.provideMerge(NetService.layer),
241242
Layer.provideMerge(layerElectron),

0 commit comments

Comments
 (0)