Repository navigation
Scrawl for iPhone: show an agent anything on your phone - #100
Draft
adamdotdevin wants to merge 4 commits into
Draft
adamdotdevin wants to merge 4 commits into
adamdotdevin wants to merge 4 commits into
Conversation
…ead a timeline's capture and note
- GET /sessions (token required) lists the open root OpenCode sessions a phone can address its
captures to, newest first, with this Mac's name; routing off lists none, and OpenCode not
answering is a 502 with the error.
- The ingest token is also accepted as X-Scrawl-Token: background URLSession uploads send it
because iOS may drop or replace Authorization.
- A timeline's `capture` ("broadcast" or "shared", from the Scrawl iPhone app) becomes
device.capture, and its `note` the bundle's note when import got none.
- `scrawl link` defaults to --scheme scrawl, the Scrawl iPhone app's.
…ts, and send it to your Mac An iPhone app (ios/, XcodeGen) that speaks ScrawlKit's protocol, so Scrawl on the Mac builds the bundle and queues it into OpenCode as it does for ScrawlKit: - A ReplayKit broadcast extension records the whole screen, whatever app is in front, with the microphone (from the app's Record Screen or Control Center's Screen Recording), and hands the upload to iOS when it stops. - A share extension sends screenshots (a keyframe each) or a screen recording, with a note. - The app pairs from `scrawl link`, lists the Mac's sessions to send to, shows what became of each capture, sends a test capture, and offers a Flag Moment App Shortcut for ⚑ flags. - Uploads are file uploads on background URLSessions, one identifier per attempt; an attempt owns its capture (a claim under an flock the app and extensions share), lost uploads are reconciled against iOS's tasks, and transient failures retry with backoff. Unit tests cover pairing, delivery and ownership, timelines, retention and both movie writers on synthetic ReplayKit buffers; scripts/e2e.sh runs the app and the share extension against a sandboxed `scrawl serve` with a stand-in OpenCode in the simulator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scrawl is great for showing an agent a problem on the Mac. This does the same for whatever's on your phone, in any app, without a cable.
What it is
An iPhone app in
ios/with two extensions:⟨Screenshot 2 of 3⟩) or a screen recording from any app, with a note that lands asNote:in the summary.It speaks ScrawlKit's protocol: the same
scrawl linkpairing,POST /ingestframing and replies. So the Mac builds the same bundle and queues it into OpenCode, and nothing in the bundle pipeline changes. The phone lists the Mac's OpenCode sessions so you can pick where captures go, or leave it on Newest session.iOS doesn't let one app see another's touches or draw over it, so there's no ink or tap tracking. Spoken cues ("look here") still cut keyframes, and a Flag Moment App Shortcut (Action button, Back Tap, Siri) adds
⚑flags, like the mirror's M key.Mac side
Small, all behind the existing token:
GET /sessionson the ingest port lists open root sessions for the picker (502with the error when OpenCode doesn't answer,routing: falsewith--no-opencode). Older Macs answer any GET with{"ok":true}, which the app reads as "can't list".X-Scrawl-Token, since iOS may drop or replaceAuthorizationon background uploads. (ScrawlKit's outbox already sends it to hosted endpoints.)capture(broadcast/shared→device.capture) andnote(→ the bundle's note whenimportgot none).scrawl linkdefaults to--scheme scrawl.Existing captures and ScrawlKit uploads are unchanged.
Delivery
Uploads are file uploads on background
URLSessions, one identifier per attempt, so an extension can hand one to iOS and exit; iOS wakes the app for the reply. An attempt owns its capture (a claim under anflockthe app and extensions share), and only its outcome counts. Lost uploads are reconciled against the tasks iOS actually has, and transient failures retry with backoff, including on a background refresh. Details are inios/README.mdanddocs/iphone-and-routing.md.Testing
cargo test: new tests for/sessions(listing, routing off, OpenCode down, no token), the token header, the timeline fields, andrecent_root_sessions.ios/scripts/e2e.shruns simulator UI tests against a sandboxedscrawl serve(its ownHOME, captures and port) whose OpenCode is a stand-in: a Python server lists sessions, andOPENCODE_BINpoints at a script that writes prompts down. One test pairs, picks a session, sends a test capture and waits for "Sent to"; the other shares a screenshot from Photos through the share extension with a note. The script then checks both bundles and both prompts.Build
cd ios && xcodegen generate. To sign with your own team, copyConfig/Local.xcconfig.exampletoConfig/Local.xcconfig. The generated project isn't checked in. The feature map has three newiphoneentries.