x-callback-url actions on the orgstar: scheme !523

merged merged by cmc on 2026-11-27 06:42 UTC · krz/orgstar:175-x-callback-url into main

Discussion

cmc 2026-11-27 06:35 UTC

x-callback-url 1.0 on the orgstar: scheme, Mac and iOS: orgstar://x-callback-url/<action> with x-success, x-error, x-cancel and x-source.

  • Actions: capture, open, agenda, clock-in, clock-out, clock-status. Logic in OrgApp/XCallback.swift (XCallbackRequest, XCallbackRunner, XCallbackApprovals); the apps only show sheets, alerts and open callbacks.
  • capture files without the sheet when template and text are given and every prompt has a parameter named for its prompt text; otherwise the capture window/sheet opens and x-cancel fires if it closes without filing. url/title work as org-protocol's.
  • agenda runs a built-in or views.toml view and returns result (JSON array), count, total; limit defaults to 50, capped at 200. Calendar events and reminders are left out.
  • Existing orgstar://agenda|clock|review|capture|entry links are unchanged.

Decisions:

  • Callbacks are opened only for other apps' schemes. Refused: orgstar (loops), org-protocol (would capture), http, https, file, ftp, javascript, data, about, blob (results to a web server, or a download). The action still runs.
  • Safety: capture without the sheet, clock-in, clock-out, agenda and clock-status need orgstar+ (as Shortcuts actions do) and ask once per source: Allow/Don't Allow, remembered on the device. A source is the x-source name plus the schemes of its callbacks, so a link naming an allowed app but sending results elsewhere asks again. x-source is unauthenticated; the scheme part is what keeps a web page from receiving data under an allowed name. Don't Allow replies not-allowed. open and capture through the sheet never ask, matching org-protocol capture: they show what they do and write nothing until the user files. Allowed apps are listed with Forget in Settings ▸ Capture (Mac) and the iOS Settings tab.
  • Errors are errorCode (unknown-action, missing-parameter, invalid-parameter, not-found, capture-failed, clock-failed, no-clock, not-allowed, needs-orgstar-plus, not-ready) and an English errorMessage.
  • On iOS, capture and clock writes are saved at once, as the Shortcuts action does; the Mac follows its save setting, as Capture to orgstar does.

Manual: "orgstar:// links and x-callback-url" in 15-alongside-emacs.org, with pointers from Capture and iOS, including when to use Shortcuts' action instead.

Tested: swift test (new XCallbackTests: parsing, callback URL building and refused schemes, approvals, each action's results and errors) and both Xcode builds, no new warnings in Sources/. iPhone 17 simulator: approval alert, capture without the sheet (file written, shortcuts://?file=…&template=e opened), agenda (shortcuts://?count=3&result=…&total=9&view=TODO%20List opened), capture sheet for a missing prompt and x-cancel on Cancel, the Settings list. Mac (renamed-bundle copy, throwaway folders): capture without the window writes the file, capture window opens for a missing prompt, Settings ▸ Capture list. Not checked: the Mac approval alert (modal blocks the snapshot hook) and the Mac opening a callback URL. Gates: see comment.

cmc 2026-11-27 06:41 UTC

Gates: two runs failed on the 1 MB open, typing p95 and Markdown newline gates, both at load 8-12 from another agent's builds (the second started at 4.9 and rose to 8.8). This change touches no parsing, indexing, highlighting or editor code; rerun on a quiet machine before merging.

Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form