Skip to content

Commit 4709540

Browse files
committed
Merge remote-tracking branch 'upstream/main' into yordis/chore-sync-upstream
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com> # Conflicts: # apps/server/src/server.ts # apps/web/src/components/ComposerPromptEditor.tsx # apps/web/src/components/chat/ChatComposer.tsx # apps/web/src/components/files/fileTreeDragMention.test.ts
2 parents fce8558 + 8ca4eec commit 4709540

175 files changed

Lines changed: 15006 additions & 2142 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.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) OpenAI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
name: ios-debugger-agent
3+
description: Build, launch, inspect, and drive iOS apps with the repository-configured XcodeBuildMCP server. Use on macOS for iOS Simulator builds, focused native test runs, semantic UI automation, screenshots, logs, or debugging, including T3 Code Mobile verification.
4+
---
5+
6+
# iOS Debugger Agent
7+
8+
Use the repository-configured `xcodebuildmcp` tools instead of requiring a globally installed Codex plugin. Prefer MCP tools over raw `xcodebuild`, `xcrun`, or `simctl` when the client exposes them.
9+
10+
## Confirm availability
11+
12+
This workflow requires macOS 14.5 or newer, Xcode 16 or newer, and Node.js 18 or newer. The repository pins XcodeBuildMCP in both `.mcp.json` for Claude Code and `.codex/config.toml` for Codex. Project MCP servers may require one-time trust or approval followed by a new session.
13+
14+
If the tools are missing:
15+
16+
1. Confirm the repository is trusted and its project MCP server was approved.
17+
2. Restart or recreate the agent session after approving configuration.
18+
3. Run `npx --yes xcodebuildmcp@2.6.2 doctor` when the server starts but simulator or UI-automation tools are unavailable. Follow its actionable Xcode or AXe setup guidance.
19+
4. Fall back to the pinned XcodeBuildMCP CLI or native Apple CLIs only when the current agent client cannot expose project MCP tools.
20+
21+
Do not ask contributors to install the OpenAI `build-ios-apps` plugin globally.
22+
23+
## Establish one simulator context
24+
25+
1. Call `session_show_defaults` before discovery, build, launch, or UI work.
26+
2. Call `list_sims` and select one explicit simulator UDID. Prefer a simulator that is already booted; boot an installed simulator when verification requires it, but do not create or download runtimes without user authorization.
27+
3. Call `session_set_defaults` with the project or workspace, scheme, Debug configuration, simulator ID, and bundle identifier when known.
28+
4. Keep every subsequent build, launch, screenshot, log capture, and UI action pinned to that same UDID.
29+
30+
Avoid generic Mac window automation for switching among Simulator windows. Explicit device identity is more reliable.
31+
32+
## Choose build or launch
33+
34+
- Use `build_run_sim` when native source, native dependencies, entitlements, or project configuration changed.
35+
- Use `test_sim` for the smallest relevant native test target or test cases; do not run an entire workspace test matrix routinely.
36+
- Use `launch_app_sim` when a compatible app is already installed and no native rebuild is needed.
37+
- To reuse an existing build artifact, use `get_sim_app_path` or `get_app_bundle_id`, install it with `install_app_sim` when necessary, and then launch it.
38+
- Do not run a build-only action immediately before `build_run_sim` unless the task requires both artifacts.
39+
40+
After launch, call `snapshot_ui` or `screenshot` before interacting. An open Simulator window alone is not evidence that the intended app launched.
41+
42+
## Drive the UI semantically
43+
44+
1. Call `snapshot_ui` to obtain the current accessibility hierarchy and element references.
45+
2. Use only current `elementRef` values whose snapshot entries list the intended action. XcodeBuildMCP `2.6.2` does not accept coordinates for `tap`; when the app exposes no actionable reference, prefer a registered deep link or another app-supported route and otherwise report the accessibility blocker.
46+
3. Refresh with `snapshot_ui` after navigation or layout changes. Element references are snapshot-specific.
47+
4. Use `wait_for_ui` for asynchronous transitions when available rather than fixed sleeps.
48+
5. Capture a final `screenshot` for the state that proves the affected flow.
49+
50+
Use `gesture` or scoped swipe actions when needed. If a gesture is unreliable, return to a known route or relaunch rather than switching to generic desktop automation.
51+
52+
## Capture logs and debug
53+
54+
- Use `start_sim_log_cap` and `stop_sim_log_cap` with the exact bundle identifier for focused runtime logs.
55+
- Use debugger tools only when the task requires runtime diagnosis; attach to the selected simulator and app rather than an ambiguous process.
56+
- Summarize relevant errors instead of returning unbounded logs.
57+
58+
## Clean up
59+
60+
Stop only log captures, debugger sessions, apps, or simulators started for the current test. Leave pre-existing simulators and unrelated sessions alone.
61+
62+
## Upstream
63+
64+
Adapted from OpenAI's [`build-ios-apps`](https://github.com/openai/plugins/tree/main/plugins/build-ios-apps) plugin version `0.1.2` (`ios-debugger-agent`, MIT) and aligned with XcodeBuildMCP `2.6.2` tool names.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
interface:
2+
display_name: "iOS Debugger Agent"
3+
short_description: "Build and drive iOS Simulator apps"
4+
default_prompt: "Use $ios-debugger-agent to build, launch, and inspect the current iOS app on Simulator."
5+
dependencies:
6+
tools:
7+
- type: "mcp"
8+
value: "xcodebuildmcp"
9+
description: "Repository-configured Xcode build, simulator, logging, debugging, and semantic UI tools"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) OpenAI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: ios-simulator-browser
3+
description: Stream an explicit iOS Simulator through pinned serve-sim into the T3 Code in-app browser or another agent browser. Use on Apple Silicon macOS when the user should watch simulator verification live or when browser-visible simulator evidence is needed.
4+
---
5+
6+
# iOS Simulator Browser
7+
8+
Use serve-sim as the shared visual feed for an iOS Simulator. Use `ios-debugger-agent` and XcodeBuildMCP semantic UI tools to drive the app; do not treat browser-canvas coordinates as a substitute for missing app accessibility.
9+
10+
## Confirm availability
11+
12+
serve-sim `0.1.45` requires Apple Silicon macOS, Xcode command-line tools, and Node.js 20 or newer. If the host is unsupported, continue with XcodeBuildMCP screenshots and report that live streaming was unavailable.
13+
14+
When running inside T3 Code, use its product-native browser MCP to open the stream. Other agent hosts may use their own browser or preview surface.
15+
16+
Keep serve-sim on its default `127.0.0.1` binding. Do not expose its preview to a LAN or tunnel unless the user explicitly requests that access and the network is trusted; the preview includes a token-gated shell-execution route.
17+
18+
## Start one owned stream
19+
20+
1. Obtain the exact simulator UDID from the iOS build or launch workflow.
21+
2. Check whether an existing serve-sim stream for that UDID belongs to another task. Reuse it only when explicitly shared; never kill another task's stream.
22+
3. Otherwise, clear only a stale stream for that UDID and start the pinned version with scoped cleanup:
23+
24+
```bash
25+
SIMULATOR_ID=<simulator-udid>
26+
cleanup_serve_sim() {
27+
npx --yes serve-sim@0.1.45 --kill "$SIMULATOR_ID" >/dev/null 2>&1 || true
28+
}
29+
trap cleanup_serve_sim EXIT INT TERM HUP
30+
cleanup_serve_sim
31+
npx --yes serve-sim@0.1.45 "$SIMULATOR_ID"
32+
```
33+
34+
4. Keep the terminal alive and open the exact local URL printed by serve-sim in the agent's browser.
35+
5. Verify that a live simulator frame renders. A loaded wrapper page is not sufficient evidence.
36+
37+
## Observe while driving semantically
38+
39+
- Let the user watch the serve-sim stream while XcodeBuildMCP performs `snapshot_ui`, semantic taps, typing, gestures, and screenshots.
40+
- Keep the browser and Xcode tooling pinned to the same simulator UDID.
41+
- Do not switch to generic desktop automation or browser-canvas clicking merely because the stream is visible.
42+
43+
If the in-app browser explicitly reports that previews are unavailable, do not install unrelated browser automation. Continue through XcodeBuildMCP, capture a simulator screenshot, report the unavailable live stream, and clean up the owned serve-sim process.
44+
45+
## Finish
46+
47+
Stop the long-running terminal and wait for its cleanup trap to finish. If it disappeared without cleanup, run `npx --yes serve-sim@0.1.45 --kill <simulator-udid>` for that exact simulator. Never run an unscoped `--kill`.
48+
49+
## Upstream
50+
51+
Adapted from OpenAI's [`build-ios-apps`](https://github.com/openai/plugins/tree/main/plugins/build-ios-apps) plugin version `0.1.2` (`ios-simulator-browser`, MIT). It invokes serve-sim `0.1.45` under its Apache-2.0 license without vendoring the package.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "iOS Simulator Browser"
3+
short_description: "Stream iOS Simulator in the browser"
4+
default_prompt: "Use $ios-simulator-browser to stream the selected iOS Simulator into the T3 Code in-app browser."
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: test-t3-app
3+
description: Launch and test the T3 Code web app in isolated development environments, including first-try browser authentication with one-time pairing URLs, pairing-token recovery, worktree-safe state directories, dev server lifecycle, and direct SQLite inspection or fixture seeding. Use when an agent needs to run T3 locally, test UI behavior in a browser, recover from an expired or consumed pairing token, isolate dev state, or prepare test data in state.sqlite.
4+
---
5+
6+
# Test T3 App
7+
8+
Use this skill for the web client. For iOS Simulator, Android Emulator, or physical-device testing against an isolated T3 backend, use the sibling [`test-t3-mobile`](../test-t3-mobile/SKILL.md) skill.
9+
10+
## Start an isolated web environment
11+
12+
1. Run commands from the repository root.
13+
2. Choose a base directory that belongs only to the current worktree or test:
14+
- Use the repository's ignored `.t3` directory for reusable worktree-local state.
15+
- Use `mktemp -d /tmp/t3code-test.XXXXXX` for disposable state and retain the printed absolute path.
16+
3. Start the full web stack with `vp run dev --home-dir <base-dir>`.
17+
4. Keep the terminal session alive and read the selected server port, web port, base directory, and pairing URL from its output.
18+
19+
Treat a base directory as disposable only when it was created or deliberately selected for the current test. Never delete or directly seed the shared `~/.t3` directory. Prefer starting with a new temporary base directory over clearing state of uncertain ownership.
20+
21+
The dev runner disables browser auto-open by default. Do not pass `--browser` during automated testing: an automatically opened page can consume the one-time bootstrap token before the controlled browser uses it.
22+
23+
## Authenticate the browser on the first navigation
24+
25+
1. Wait for the server log that says authentication is required and includes a URL ending in `/pair#token=...`.
26+
2. Use the controlled in-app browser or browser-automation surface available to the agent. Do not use a system-browser launch command during automated testing.
27+
3. Open that complete URL exactly once as the controlled browser's first navigation. Preserve the fragment and token verbatim.
28+
4. Wait for the pairing exchange and redirect to finish before navigating elsewhere.
29+
5. Continue in the same browser context so its stored bearer session remains available.
30+
31+
Treat pairing URLs as secrets. Do not copy them into final responses, screenshots, committed files, or durable logs. A pairing token is short-lived and single-use; opening the URL in another browser or opening it twice can consume it.
32+
33+
## Recover a consumed or expired pairing token
34+
35+
Create another token against the same database and web URL as the running dev server:
36+
37+
```bash
38+
T3CODE_PORT=<server-port> node apps/server/src/bin.ts auth pairing create \
39+
--base-dir <base-dir> \
40+
--dev-url <web-url> \
41+
--base-url <web-url> \
42+
--ttl 15m \
43+
--label agent-ui-test
44+
```
45+
46+
Use the `Pair URL` from this command once. Derive `<server-port>` and `<web-url>` from the current dev-runner output, including any automatically selected port offset. Setting `T3CODE_PORT` keeps the administrative CLI from probing for an unrelated free port.
47+
48+
Always pass `--dev-url` for a dev-runner environment so the generated pairing URL uses the current web origin. An explicit base directory stores runtime state in `<base-dir>/userdata`; the `<base-dir>/dev` fallback is only used by an implicit dev home. Use `auth pairing list` to inspect active token metadata; it intentionally cannot reveal token secrets.
49+
50+
## Inspect or seed SQLite state
51+
52+
Read [references/sqlite-fixtures.md](references/sqlite-fixtures.md) before changing the database.
53+
54+
- Use `node apps/server/scripts/t3-sqlite-state.ts query` for schema discovery and read-only checks.
55+
- Stop the dev server before using `node apps/server/scripts/t3-sqlite-state.ts exec`, then restart it with the same base directory.
56+
- Seed projection tables only for disposable UI fixtures. Use application commands and APIs when testing business behavior or projection correctness.
57+
- Use the auth CLI, not direct `auth_*` table edits, for pairing and sessions.
58+
59+
The helper refuses to write to the shared `~/.t3` directory by default and creates a database backup before each mutation.
60+
61+
## Finish the test
62+
63+
Stop the dev process with its terminal interrupt. Preserve the isolated base directory when it contains useful reproduction evidence; otherwise remove only a path that was created for this test after resolving and verifying the exact target. A fresh isolated base directory is the safest reset when authentication, migrations, or fixture state becomes ambiguous.
64+
65+
## Troubleshoot predictably
66+
67+
- If the browser shows an unauthenticated pairing screen, issue a new token instead of retrying the consumed URL.
68+
- If the pairing URL is no longer visible, create a replacement token with both `--dev-url` and `--base-url`.
69+
- If the replacement token is rejected, verify that the CLI and server use the identical absolute base directory and web URL.
70+
- If the UI shows unexpected data, verify that every command uses the identical explicit base directory before editing anything.
71+
- If ports move because another instance is running, trust the current dev-runner output rather than assuming ports `13773` and `5733`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "T3 App Testing"
3+
short_description: "Launch and seed isolated T3 test environments"
4+
default_prompt: "Use $test-t3-app to launch an isolated T3 development environment and test it in the browser."
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SQLite fixtures
2+
3+
Load this reference only when inspecting or seeding local T3 state directly.
4+
5+
## Select the correct database
6+
7+
When `--base-dir` or `--home-dir` is explicit, runtime state lives under `<base-dir>/userdata` and the database path is `<base-dir>/userdata/state.sqlite`. The `<base-dir>/dev` state directory is only the fallback for an implicit development home, preventing an ordinary `vp run dev` from touching production state.
8+
9+
Start the target runtime once before seeding so all migrations have run. Use an isolated base directory. Stop the server before writes to avoid racing application state or an active projection.
10+
11+
## Use the helper
12+
13+
List tables:
14+
15+
```bash
16+
node apps/server/scripts/t3-sqlite-state.ts query \
17+
--base-dir <base-dir> \
18+
--sql "SELECT name FROM sqlite_schema WHERE type = 'table' ORDER BY name"
19+
```
20+
21+
Inspect current columns before writing a fixture:
22+
23+
```bash
24+
node apps/server/scripts/t3-sqlite-state.ts query \
25+
--base-dir <base-dir> \
26+
--sql "PRAGMA table_info(projection_threads)"
27+
```
28+
29+
Apply a SQL fixture from a file:
30+
31+
```bash
32+
node apps/server/scripts/t3-sqlite-state.ts exec \
33+
--base-dir <base-dir> \
34+
--file /tmp/t3-seed.sql
35+
```
36+
37+
Use one statement per invocation for both `query` and `exec`; the helper wraps writes in a transaction and prints the backup path after a successful mutation. Use a single insert with multiple value rows when a fixture needs several records.
38+
39+
## Seed projection data carefully
40+
41+
The web UI primarily reads these projection tables:
42+
43+
- `projection_projects`
44+
- `projection_threads`
45+
- `projection_thread_messages`
46+
- `projection_thread_activities`
47+
- `projection_thread_sessions`
48+
- `projection_turns`
49+
- `projection_pending_approvals`
50+
- `projection_thread_proposed_plans`
51+
52+
Inspect `PRAGMA table_info(<table>)` and the current migrations under `apps/server/src/persistence/Migrations/` before constructing inserts. Keep identifiers unique, timestamps as ISO strings, JSON columns valid, and related project/thread/turn IDs consistent.
53+
54+
For a substantial current example, inspect `seedDatabase` in `scripts/mobile-showcase-environment.ts`. Adapt its column set to the target database instead of assuming copied SQL remains current.
55+
56+
Direct projection writes are appropriate for ephemeral visual states, edge-case counts, long titles, activity lists, and similar UI fixtures. They do not create a coherent orchestration event history. Do not modify `orchestration_events` unless the test specifically exercises projector internals, and do not use direct projection writes to claim backend business behavior works.
57+
58+
Use the app's commands or APIs for behavior tests. Use `node apps/server/src/bin.ts auth ...` for auth state rather than editing `auth_pairing_links` or `auth_sessions`.

0 commit comments

Comments
 (0)