Skip to content

Commit 2038f11

Browse files
author
T3 Code Test
committed
Merge branch 'stack-01' into stack-02
2 parents 50b5969 + 9d3c4c6 commit 2038f11

253 files changed

Lines changed: 11788 additions & 3441 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.

‎AGENTS.md‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ T3 Code has 3 key app surfaces: **web**, **desktop**, and **mobile**.
2828

2929
**Desktop** is the main surface most users install first. It's a full Electron app that bundles the server runner as well. The desktop app can also be used as the host server, allowing remote connections from app.t3.codes or the mobile app.
3030

31-
**Mobile** is a React native app for both iOS and Android. The mobile app allows for connecting to any T3 Code server to control work remotely. It is still in early access (Testflight), but it is pretty close to shipping globally.
31+
**Mobile** is a React Native app for both iOS and Android, available on the App Store and Google Play. The mobile app allows for connecting to any T3 Code server to control work remotely.
3232

3333
## A note from Theo
3434

@@ -59,7 +59,7 @@ We need to be on the same page with terminology. When communicating, use this la
5959
## The three ways to hurt yourself
6060

6161
1. **Killing by pattern.** Never `pkill -f`, `pgrep | kill`, or `kill` a PID you found by matching a name, path, or worktree string. Your own agent process has this worktree's path in its argv, and this machine runs several other dev servers at once. Kill only a PID you captured at spawn, or the owner of your port from `ss -H -ltnp` after confirming `/proc/<pid>/cwd` is your worktree.
62-
2. **Touching the live install.** `~/.t3/userdata` is the developer's real T3 Code database, in use while you work. Read-only inspection is fine. Never start a server against it, never open it read-write, never clean it up.
62+
2. **Writing to the live install.** `~/.t3/userdata` is the developer's real T3 Code database, in use while you work. Reading it and copying from it are fine, and a good way to get real test data (see Test data). Never start a server against it, never open it read-write, never clean it up.
6363
3. **Baking in origins.** Never set `VITE_HTTP_URL` or `VITE_WS_URL` for dev. Dev is single-origin and Vite proxies `/api`, `/ws`, `/oauth`, and `/.well-known`. Setting them bakes localhost into the bundle and silently breaks every remote browser.
6464

6565
## Hit every surface
@@ -72,7 +72,7 @@ The most common defect in this repo is a change that works on the path you teste
7272
- **Contracts.** Anything crossing the wire is typed in `packages/contracts`. Change the schema and the server, web, mobile, and desktop all follow.
7373
- **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.
7474
- **Connection modes.** Local, remote/relay, and tunnel behave differently. Multi-device and multi-environment cases are real.
75-
- **Docs.** `docs/` mirrors this structure. Behavior changes that a user would notice belong in `docs/user/`; architecture changes in `docs/architecture/`; new vocabulary in `docs/reference/encyclopedia.md`.
75+
- **Docs.** `docs/` splits by audience. Behavior changes that a user would notice belong in `docs/user/` (shipped-product voice, no repo tooling or source paths); architecture and contributor changes in `docs/internals/`; runbooks in `docs/operations/`; new vocabulary in `docs/internals/glossary.md`.
7676

7777
## Dev servers
7878

@@ -85,10 +85,19 @@ The most common defect in this repo is a change that works on the path you teste
8585

8686
## Test data
8787

88-
An empty database is a bad test. Seed your worktree's `.t3` instead of pointing at live state:
88+
An empty database is a bad test. Seed your worktree's `.t3` with a copy of real data instead of pointing at live state:
89+
90+
- Copy from `~/.t3/userdata` (the developer's real data, the most realistic test set) or `~/.t3/dev`. Worktree state lives at `<worktree>/.t3/userdata`.
91+
- Snapshot the database with `VACUUM INTO`, which is safe even while a server has the source open and yields one consistent file:
92+
93+
```bash
94+
mkdir -p .t3/userdata
95+
rm -f .t3/userdata/state.sqlite* # VACUUM INTO refuses to overwrite
96+
bun -e "new (require('bun:sqlite').Database)(process.env.HOME + '/.t3/userdata/state.sqlite', { readonly: true }).run(\"VACUUM INTO '.t3/userdata/state.sqlite'\")"
97+
```
98+
99+
A plain `cp` is only safe when no server has the source open, and must bring the `-wal` and `-shm` siblings along. A live file copy is a corrupt copy.
89100

90-
- Copy from `~/.t3/dev`, never from `~/.t3/userdata`.
91-
- Copy `state.sqlite` together with its `-wal` and `-shm` siblings, and only while no server has the source open. A live copy is a corrupt copy.
92101
- Bring `secrets` and `settings.json` only if the flow under test needs them.
93102
- Copy in, never symlink. Data flows one way: into your sandbox, never back out.
94103

@@ -114,13 +123,13 @@ An empty database is a bad test. Seed your worktree's `.t3` instead of pointing
114123

115124
Clients send typed WebSocket requests. The server turns them into _commands_, a pure _decider_ turns commands into persisted _events_, and a _projector_ derives the read model the UI renders. Provider CLIs run as subprocesses; per-provider _adapters_ translate their native protocols into orchestration events. Side effects run in queue-backed _reactors_ that emit _receipts_ when milestones land. Each turn ends with a _checkpoint_, a hidden git ref, so the app can diff and restore.
116125

117-
Full glossary with file links: `docs/reference/encyclopedia.md`
126+
Full glossary with file links: `docs/internals/glossary.md`
118127

119128
## Where code lives
120129

121-
- `apps/server` - WebSocket, orchestration, providers, checkpointing. Effect-heavy: read `.repos/effect-smol/LLMS.md` and `docs/operations/effect-fn-checklist.md` before writing Effect code.
130+
- `apps/server` - WebSocket, orchestration, providers, checkpointing. Effect-heavy: read `.repos/effect-smol/LLMS.md` before writing Effect code.
122131
- `apps/web` - React/Vite UI. `apps/desktop` wraps it, `apps/mobile` is React Native, `apps/marketing` is the site.
123-
- `packages/contracts` - Effect/Schema contracts. Schema only, no runtime logic.
132+
- `packages/contracts` - Effect/Schema contracts plus small derived helpers. No heavy runtime logic.
124133
- `packages/shared` - shared runtime utils, subpath exports, no barrel.
125134
- `packages/client-runtime` - client code shared by web and mobile.
126135
- `.repos/` - vendored read-only references. Prefer their patterns over invented ones. Never edit or import from them. Sync with `vpr sync:repos` when bumping the matching dependency.

‎README.md‎

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

3-
T3 Code is an "agent harness control surface". It enables control of the agents on your machine with a best-in-class mobile app, [web app](https://app.t3.codes) and [Electron-based desktop app](https://t3.codes).
3+
T3 Code is an "agent harness control surface". It enables control of the agents on your machine with a best-in-class mobile app ([iOS](https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824), [Android](https://play.google.com/store/apps/details?id=com.t3tools.t3code)), [web app](https://app.t3.codes) and [Electron-based desktop app](https://t3.codes).
44

55
Works with your subscriptions on Claude Code, Codex, Cursor, Grok Build, and OpenCode. If they're set up on your computer, T3 Code can control them.
66

@@ -17,13 +17,13 @@ We wanted something performant, remote-ready, and truly open. If we ever go the
1717
>
1818
> - Codex: install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`
1919
> - Claude: install [Claude Code](https://claude.com/product/claude-code) and run `claude auth login`
20-
> - Cursor: install [Cursor CLI](https://cursor.com/cli) and run `cursor-agent login`
20+
> - Cursor: install [Cursor CLI](https://cursor.com/cli) and run `agent login`
2121
> - Grok Build: install [Grok Build CLI](https://x.ai/cli) and run `grok login`
2222
> - OpenCode: install [OpenCode](https://opencode.ai) and run `opencode auth login`
2323
2424
### Try it out (install-free)
2525

26-
The easiest way to test T3 Code is to run the server in your terminal:
26+
The easiest way to test T3 Code is to run the server in your terminal (requires Node.js 22.16+, 23.11+, or 24.10+):
2727

2828
```bash
2929
npx t3@latest
@@ -61,17 +61,20 @@ We are very very early in this project. Expect bugs.
6161

6262
We are (mostly) not accepting contributions yet. Small fixes may be considered. Big features will not be.
6363

64-
There's no public docs site yet, checkout the miscellaneous markdown files in [docs](./docs).
65-
6664
## Documentation
6765

68-
- [Getting started](./docs/getting-started/quick-start.md)
69-
- [Remote access](./docs/user/remote-access.md)
70-
- [Keeping T3 Code in sync](./docs/user/server-updates.md)
71-
- [Architecture overview](./docs/architecture/overview.md)
72-
- [Provider guides](./docs/providers/codex.md)
73-
- [Operations](./docs/operations/ci.md)
74-
- [Reference](./docs/reference/encyclopedia.md)
66+
Full docs live in [docs/](./docs). There's no docs site yet.
67+
68+
- [Install and first run](./docs/user/install.md)
69+
- [Permission modes](./docs/user/permission-modes.md)
70+
- [Keyboard shortcuts](./docs/user/keybindings.md)
71+
- [Remote access from a phone or another machine](./docs/user/remote-access.md)
72+
- [Keeping app and server in sync](./docs/user/updating.md)
73+
- [Source control integrations](./docs/user/source-control.md)
74+
- Multiple accounts: [Codex](./docs/user/providers-codex.md) · [Claude](./docs/user/providers-claude.md)
75+
- Linux: [run T3 Code as a background service](./docs/user/background-service.md)
76+
77+
Building from source? Start at [docs/internals/overview.md](./docs/internals/overview.md).
7578

7679
## If you REALLY want to contribute still.... read this first
7780

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.0.30",
3+
"version": "0.0.31",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/main.cjs",

‎apps/marketing/src/layouts/Layout.astro‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
2-
import { GITHUB_REPOSITORY_URL, MARKETING_STATS } from "../lib/site";
2+
import {
3+
ANDROID_PLAY_STORE_URL,
4+
GITHUB_REPOSITORY_URL,
5+
IOS_APP_STORE_URL,
6+
MARKETING_STATS,
7+
} from "../lib/site";
38
49
interface Props {
510
title?: string;
@@ -69,6 +74,8 @@ const {
6974
<a href={GITHUB_REPOSITORY_URL} target="_blank" rel="noopener noreferrer">GitHub</a>
7075
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
7176
<a href="/download">Download</a>
77+
<a href={IOS_APP_STORE_URL} target="_blank" rel="noopener noreferrer">iOS app</a>
78+
<a href={ANDROID_PLAY_STORE_URL} target="_blank" rel="noopener noreferrer">Android app</a>
7279
<a href="/terms-of-service">Terms</a>
7380
<a href="/privacy-policy">Privacy</a>
7481
<a href="/security-policy">Security</a>

‎apps/marketing/src/lib/site.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
export const GITHUB_REPOSITORY_URL = "https://github.com/pingdotgg/t3code";
22

3+
export const IOS_APP_STORE_URL =
4+
"https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824";
5+
6+
export const ANDROID_PLAY_STORE_URL =
7+
"https://play.google.com/store/apps/details?id=com.t3tools.t3code";
8+
39
export const MARKETING_STATS = {
410
githubStars: "14k+",
511
users: "100,000",

‎apps/marketing/src/pages/download.astro‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import Layout from "../layouts/Layout.astro";
33
import { RELEASES_URL } from "../lib/releases";
4+
import { ANDROID_PLAY_STORE_URL, IOS_APP_STORE_URL } from "../lib/site";
45
---
56

67
<Layout title="Download — T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">
@@ -57,6 +58,24 @@ import { RELEASES_URL } from "../lib/releases";
5758
</a>
5859
</div>
5960
</section>
61+
62+
<!-- Mobile -->
63+
<section class="platform-section">
64+
<div class="platform-header">
65+
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="7" y="2" width="10" height="20" rx="2.5"/><path d="M11 18.5h2"/></svg>
66+
<h2 class="platform-name">Mobile</h2>
67+
</div>
68+
<div class="download-cards">
69+
<a class="download-card" href={IOS_APP_STORE_URL} target="_blank" rel="noopener noreferrer">
70+
<span class="card-arch">iPhone &amp; iPad</span>
71+
<span class="card-format">App Store</span>
72+
</a>
73+
<a class="download-card" href={ANDROID_PLAY_STORE_URL} target="_blank" rel="noopener noreferrer">
74+
<span class="card-arch">Android</span>
75+
<span class="card-format">Google Play</span>
76+
</a>
77+
</div>
78+
</section>
6079
</div>
6180

6281
<p class="releases-link">
@@ -73,7 +92,8 @@ import { RELEASES_URL } from "../lib/releases";
7392

7493
async function init() {
7594
const versionLabel = document.getElementById("version-label");
76-
const cards = document.querySelectorAll<HTMLAnchorElement>(".download-card");
95+
// Only release-asset cards; mobile store cards have no data-asset and keep their href.
96+
const cards = document.querySelectorAll<HTMLAnchorElement>(".download-card[data-asset]");
7797

7898
try {
7999
const release = await fetchLatestRelease();

‎apps/marketing/src/pages/index.astro‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
---
22
import Layout from "../layouts/Layout.astro";
3-
import { GITHUB_REPOSITORY_URL, MARKETING_STATS } from "../lib/site";
3+
import {
4+
ANDROID_PLAY_STORE_URL,
5+
GITHUB_REPOSITORY_URL,
6+
IOS_APP_STORE_URL,
7+
MARKETING_STATS,
8+
} from "../lib/site";
49
import { tweets } from "../lib/tweets";
510
611
const desktopEndorsementRows = [
@@ -66,6 +71,12 @@ const mobileEndorsementRows = [
6671
<span>Steal our code (legally)</span>
6772
<svg class="hero-source-arrow" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17L17 7M8 7h9v9"/></svg>
6873
</a>
74+
<p class="hero-mobile-line">
75+
Also on your phone:
76+
<a href={IOS_APP_STORE_URL} target="_blank" rel="noopener noreferrer">iOS</a>
77+
<span aria-hidden="true">·</span>
78+
<a href={ANDROID_PLAY_STORE_URL} target="_blank" rel="noopener noreferrer">Android</a>
79+
</p>
6980
</div>
7081

7182
<div class="hero-preview">
@@ -578,6 +589,28 @@ const mobileEndorsementRows = [
578589
opacity: 1;
579590
}
580591

592+
.hero-mobile-line {
593+
display: inline-flex;
594+
align-items: center;
595+
gap: 6px;
596+
color: var(--fg-dim);
597+
font-size: 13px;
598+
letter-spacing: -0.005em;
599+
}
600+
601+
.hero-mobile-line a {
602+
color: var(--fg-muted);
603+
text-decoration: underline;
604+
text-decoration-color: rgba(161, 161, 170, 0.4);
605+
text-underline-offset: 3px;
606+
transition: color 0.18s ease, text-decoration-color 0.18s ease;
607+
}
608+
609+
.hero-mobile-line a:hover {
610+
color: var(--fg);
611+
text-decoration-color: var(--fg);
612+
}
613+
581614
/* Download button icons (platform-aware) */
582615
.dl-icon {
583616
display: none;

‎apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private final class ComposerTextView: UITextView {
141141
replace(textRange, withText: "")
142142
}
143143

144-
private func loadImages(from providers: [NSItemProvider]) {
144+
func loadImages(from providers: [NSItemProvider]) {
145145
let group = DispatchGroup()
146146
let lock = NSLock()
147147
var images = [UIImage?](repeating: nil, count: providers.count)
@@ -282,7 +282,7 @@ private final class ComposerTextView: UITextView {
282282
}
283283
}
284284

285-
public final class T3ComposerEditorView: ExpoView, UITextViewDelegate {
285+
public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDropDelegate {
286286
private let textView = ComposerTextView()
287287
private let placeholderLabel = UILabel()
288288
private var value = ""
@@ -326,6 +326,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate {
326326

327327
clipsToBounds = false
328328
textView.delegate = self
329+
textView.textDropDelegate = self
329330
textView.backgroundColor = .clear
330331
textView.textContainerInset = .zero
331332
textView.textContainer.lineFragmentPadding = 0
@@ -500,6 +501,41 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate {
500501
return true
501502
}
502503

504+
public func textDroppableView(
505+
_ textDroppableView: UIView & UITextDroppable,
506+
proposalForDrop drop: UITextDropRequest
507+
) -> UITextDropProposal {
508+
guard droppedImageProviders(in: drop) != nil else {
509+
return drop.suggestedProposal
510+
}
511+
512+
// The composer owns image drops so UIKit does not insert NSTextAttachments
513+
// that the controlled plain-text value cannot represent.
514+
let proposal = UITextDropProposal(operation: .copy)
515+
proposal.dropAction = .insert
516+
proposal.dropPerformer = .delegate
517+
return proposal
518+
}
519+
520+
public func textDroppableView(
521+
_ textDroppableView: UIView & UITextDroppable,
522+
willPerformDrop drop: UITextDropRequest
523+
) {
524+
guard let imageProviders = droppedImageProviders(in: drop) else {
525+
return
526+
}
527+
textView.loadImages(from: imageProviders)
528+
}
529+
530+
private func droppedImageProviders(in drop: UITextDropRequest) -> [NSItemProvider]? {
531+
let providers = drop.dropSession.items.map(\.itemProvider)
532+
guard !providers.isEmpty,
533+
providers.allSatisfy({ $0.canLoadObject(ofClass: UIImage.self) }) else {
534+
return nil
535+
}
536+
return providers
537+
}
538+
503539
public func textViewDidBeginEditing(_ textView: UITextView) {
504540
onComposerFocus()
505541
}

‎apps/mobile/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@expo-google-fonts/dm-sans": "^0.4.2",
5050
"@expo/metro-runtime": "~56.0.15",
5151
"@expo/ui": "~56.0.18",
52-
"@legendapp/list": "3.2.0",
52+
"@legendapp/list": "3.3.3",
5353
"@noble/curves": "catalog:",
5454
"@noble/hashes": "catalog:",
5555
"@pierre/diffs": "catalog:",

‎apps/mobile/src/Stack.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,15 @@ function workspacePathFromState(state: NavigationState): string {
284284
return path.startsWith("/") ? path : `/${path}`;
285285
}
286286

287+
// The drain hook subscribes to the outbox, all thread shells, projects, and
288+
// connection statuses. Hosting it in a null-rendering leaf keeps those
289+
// updates from re-rendering RootStackLayout (and with it every screen) on
290+
// each enqueue, shell change, or reconnect.
291+
function ThreadOutboxDrainWorker() {
292+
useThreadOutboxDrain();
293+
return null;
294+
}
295+
287296
function RootStackLayout(props: {
288297
readonly children: React.ReactNode;
289298
readonly state: NavigationState;
@@ -292,7 +301,6 @@ function RootStackLayout(props: {
292301
const { pendingShare } = useIncomingShare();
293302
const sharePresentationRef = useRef(EMPTY_INCOMING_SHARE_PRESENTATION_STATE);
294303
useAgentNotificationNavigation();
295-
useThreadOutboxDrain();
296304
// Presents the T3 Connect onboarding sheet after an in-session sign-in.
297305
useConnectOnboardingNavigation();
298306
// Launcher app shortcuts: routes shortcut taps and tracks opened threads.
@@ -320,6 +328,7 @@ function RootStackLayout(props: {
320328

321329
return (
322330
<HardwareKeyboardCommandProvider pathname={pathname}>
331+
<ThreadOutboxDrainWorker />
323332
<ShowcaseCaptureCoordinator pathname={pathname} />
324333
<ClerkSettingsSheetDetentProvider initiallyExpanded={false}>
325334
<AdaptiveWorkspaceLayout pathname={workspacePathname}>

0 commit comments

Comments
 (0)