Skip to content

Commit 85389b9

Browse files
juliusmarmingecodexclaude
authored
Nest mobile task settings in bottom sheets (#6224)
Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent db1507e commit 85389b9

41 files changed

Lines changed: 3652 additions & 1836 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/test-t3-mobile/SKILL.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,31 +125,29 @@ Do not start, stop, erase, or reconfigure an emulator owned by another task. Tra
125125

126126
## Pair each client once
127127

128-
Issue a fresh credential against the running backend's exact base directory:
128+
Use the bundled helper from the repository root. It issues a fresh credential against the running backend's exact base directory, opens the existing Add Environment route with the credential in an encoded query parameter, and asks that route to connect once:
129129

130130
```bash
131-
T3CODE_PORT=<server-port> node apps/server/src/bin.ts auth pairing create \
132-
--base-dir <base-dir> \
133-
--base-url <mobile-origin> \
134-
--ttl 15m \
135-
--label agent-mobile-<short-device-id>
131+
.agents/skills/test-t3-mobile/scripts/pair-client.sh \
132+
ios <simulator-udid> <server-port> <base-dir>
133+
134+
.agents/skills/test-t3-mobile/scripts/pair-client.sh \
135+
android <emulator-serial> <server-port> <base-dir>
136136
```
137137

138-
In PowerShell, set `$env:T3CODE_PORT = "<server-port>"` first and run the `node ... auth pairing create` command without the leading assignment.
138+
Run only the command for the selected platform. The helper uses `http://127.0.0.1:<server-port>` for iOS and `http://10.0.2.2:<server-port>` for Android. Pass a fifth argument only when testing a non-development URL scheme.
139139

140-
If the visible Add Environment action is not exposed as a semantic target, open the app's registered route instead of guessing coordinates:
140+
The helper opens this registered route:
141141

142-
```bash
143-
xcrun simctl openurl <simulator-udid> 't3code-dev://connections/new'
144-
adb -s <emulator-serial> shell am start -W \
145-
-a android.intent.action.VIEW \
146-
-d 't3code-dev://connections/new' \
147-
com.t3tools.t3code.dev
142+
```text
143+
t3code-dev://connections/new?pairingUrl=<encoded-pairing-url>&autoConnect=1
148144
```
149145

150-
Run only the command for the selected platform.
146+
The Add Environment route owns the behavior: `pairingUrl` prefills its normal host and token inputs, while `autoConnect=1` submits once in development builds and returns to Home after success. Without `autoConnect`, the same route only prefills the form for manual inspection.
147+
148+
Do not enter pairing hosts or tokens through simulator keyboard automation. Xcode's semantic typer sends HID-style key events through the simulator's active keyboard state, which can corrupt uppercase tokens and punctuation even when the host Mac uses a U.S. input source. The one-shot route is the deterministic pairing path. Use the visible form only as a fallback, and paste credentials rather than typing them character by character.
151149

152-
In T3 Code Dev, open Add Environment and enter the complete `<mobile-origin>` and newly printed `Token`. Verify the expected seeded projects appear before exercising the affected flow.
150+
Verify the expected seeded projects appear before exercising the affected flow.
153151

154152
Pairing credentials are secret, short-lived, and single-use. Create a different credential for every simulator, emulator, physical device, or browser. If an attempt fails, issue a new credential rather than retrying the old one. Do not expose tokens in screenshots, commits, or final responses.
155153

@@ -183,6 +181,8 @@ Keep local verification focused. Do not turn this workflow into a full repositor
183181
- **Old UI or an old error appears:** verify Metro's worktree, variant, URL, and port before diagnosing the app.
184182
- **The environment remains empty:** verify the platform-specific HTTP origin, use a fresh token, and confirm project seeding used the identical base directory.
185183
- **A second client cannot pair:** pairing tokens are single-use; issue another token.
184+
- **The pairing form opens but does not connect:** confirm the deep link uses the existing `connections/new` route, includes `autoConnect=1`, and carries a freshly minted encoded `pairingUrl`.
185+
- **Pairing text changes case or punctuation:** do not retry semantic typing. Use `scripts/pair-client.sh`; the simulator keyboard layout and HID input path are not reliable for credentials.
186186
- **iOS semantic actions fail:** set explicit XcodeBuildMCP defaults and refresh with `snapshot_ui`.
187187
- **Android cannot reach Metro:** verify `adb reverse` for the exact Metro port and relaunch the development-client URL.
188188
- **Android cannot reach the backend:** use `10.0.2.2`, not `127.0.0.1`, for the Android Emulator.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
usage() {
6+
echo "Usage: $0 <ios|android> <device-id> <server-port> <base-dir> [url-scheme]" >&2
7+
exit 2
8+
}
9+
10+
[[ $# -ge 4 && $# -le 5 ]] || usage
11+
12+
platform="$1"
13+
device_id="$2"
14+
server_port="$3"
15+
base_dir="$4"
16+
url_scheme="${5:-t3code-dev}"
17+
18+
case "$platform" in
19+
ios)
20+
mobile_origin="http://127.0.0.1:${server_port}"
21+
;;
22+
android)
23+
mobile_origin="http://10.0.2.2:${server_port}"
24+
;;
25+
*)
26+
usage
27+
;;
28+
esac
29+
30+
repo_root="$(git rev-parse --show-toplevel)"
31+
cd "$repo_root"
32+
33+
if ! pairing_output="$({
34+
T3CODE_PORT="$server_port" node apps/server/src/bin.ts auth pairing create \
35+
--base-dir "$base_dir" \
36+
--base-url "$mobile_origin" \
37+
--ttl 15m \
38+
--label "agent-mobile-${device_id:0:8}"
39+
} 2>&1)"; then
40+
echo "Could not mint a mobile pairing credential." >&2
41+
exit 1
42+
fi
43+
44+
pairing_url="$(printf '%s\n' "$pairing_output" | sed -n 's/^Pair URL: //p' | tail -n 1)"
45+
if [[ -z "$pairing_url" ]]; then
46+
echo "Could not parse the mobile pairing URL." >&2
47+
exit 1
48+
fi
49+
50+
deep_link="$(PAIRING_URL="$pairing_url" URL_SCHEME="$url_scheme" node - <<'NODE'
51+
const query = new URLSearchParams({
52+
pairingUrl: process.env.PAIRING_URL,
53+
autoConnect: "1",
54+
});
55+
process.stdout.write(`${process.env.URL_SCHEME}://connections/new?${query}`);
56+
NODE
57+
)"
58+
59+
case "$platform" in
60+
ios)
61+
xcrun simctl openurl "$device_id" "$deep_link"
62+
;;
63+
android)
64+
# adb shell re-joins its arguments and evaluates them through the device
65+
# shell, so the deep link's `?`/`&` must be quoted once more for that shell.
66+
adb -s "$device_id" shell \
67+
"am start -W -a android.intent.action.VIEW -d '$deep_link' com.t3tools.t3code.dev" \
68+
>/dev/null
69+
;;
70+
esac
71+
72+
echo "Opened the existing Add Environment route with a fresh pairing credential."

0 commit comments

Comments
 (0)