feat(desktop): add SnapShots window capture - #121
Conversation
|
Too many files changed for review (212 files, 100 file limit). Bypass the limit by tagging |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c32e3e3d78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7c3f7e396
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a01ef7678
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 678cc73bcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let allowed = false; | ||
| for (const name of CLIENT_NAMES) { | ||
| const owner = await this._getNameOwner(name); | ||
| if (owner === sender) { | ||
| allowed = true; | ||
| break; | ||
| } | ||
| } | ||
| if (!allowed) throw new Error("Only Pathway may request a snapshot."); |
There was a problem hiding this comment.
Authenticate the GNOME caller beyond its public bus name
When the GNOME extension is enabled, any process on the user's session bus can request one of the predictable CLIENT_NAMES and then call Capture, because authorization only compares the caller with the current owner of that name. Pathway owns the name only during its own capture operation, so another process can normally claim it and obtain screenshots of the focused window without portal consent. Bind authorization to the actual Pathway process identity rather than possession of a publicly known D-Bus name.
Useful? React with 👍 / 👎.
| yield* clientSettings.set(settings); | ||
| yield* snapShot.configure(settings); |
There was a problem hiding this comment.
Roll back persisted settings when snapshot configuration fails
If native snapshot configuration fails after the settings file has been written—for example, if globalShortcut.register throws for a malformed externally persisted accelerator—the IPC call rejects and persistClientSettingsPatch restores the renderer's previous snapshot, but the new settings remain on disk. The UI therefore reports that the save failed and shows the old value while the supposedly failed value reappears after restart; make the write and native reconfiguration transactional or restore the previous persisted settings on failure.
Useful? React with 👍 / 👎.
| const discard = async (id: string) => { | ||
| if (!bridge || discarding) return; | ||
| setDiscarding(id); | ||
| try { | ||
| await bridge.acknowledgeSnapShot(id); |
There was a problem hiding this comment.
Serialize discard against automatic delivery
When the coordinator is automatically draining a saved capture while the user clicks Discard in Settings, both paths operate independently on the same ID. If delivery has already read the PNG, this acknowledgement can delete the native files while deliverSnapShot continues and adds the image to the draft; its later acknowledgement then fails because the metadata is gone, producing an error even though the capture the user discarded was attached. Make discard atomically cancel or claim the capture before deletion so the reverse action cannot race with delivery.
AGENTS.md reference: AGENTS.md:L77-L77
Useful? React with 👍 / 👎.
| export async function dismissSnapShotAnimation(id: string): Promise<void> { | ||
| if (!pendingAnimations.some((capture) => capture.id === id)) return; | ||
| finishSnapShotAnimation(id); | ||
| const bridge = getDesktopSnapShotBridge(); | ||
| if (typeof bridge?.dismissSnapShotAnimation !== "function") return; | ||
| await bridge.dismissSnapShotAnimation(id).catch(() => undefined); |
There was a problem hiding this comment.
Dismiss native overlays before the placeholder mounts
When native capture feedback has started but target resolution returns null or fails before beginSnapShotAnimation registers the local placeholder, the coordinator calls this function to tear down the capture. The early return skips the desktop dismissal because the ID is not yet in pendingAnimations, leaving the always-on-top native overlay visible until its independent six-to-ten-second timeout. Always forward dismissal to the desktop bridge even when there is no local animation entry.
Useful? React with 👍 / 👎.
Pathway users can now capture the window they are working in with a desktop shortcut and attach the image, app identity, window title, and available accessibility text to their draft. SnapShots are opt-in and run on the desktop client's computer, including when the conversation uses a remote environment.
This adapts T3 Code PR #8103, merge
299404a754f52c02c69634528d8856b3c93b378c, to Pathway's attachment contracts, V2 provider dispatch, environment-scoped drafts, and native Apple client. It includes macOS and Windows capture, Wayland compositor/portal backends, setup and permission recovery, configurable shortcuts, a command-palette action, and optional capture feedback. X11 remains unsupported.Captures are saved before delivery and acknowledged only after the draft is persisted. Failed delivery can be retried or discarded. Pending captures belong to the signed-in account; account switches, sign-out, and renderer loss stop delivery and release native listeners. Accessibility work runs outside the renderer, with bounded depth and payloads. Provider context marks captured app text as untrusted, preserves the user's message, and covers every adapter through the common start/steer boundary.
Validation:
PathwayProjectIconTests.swift, whose existing optional-string errors prevent the full test target from compiling.Manual verification: the isolated macOS app rendered the settings and setup flow, recognized Screen Recording and Accessibility grants, and recovered from a failed setup capture. That check exposed selection of a tiny same-process popup; capture now resolves Pathway's actual Electron window, with a regression test. The maintainer requested that further testing stop and will complete the hotkey, attachment, and metadata check. End-to-end capture and animation evidence are therefore still pending maintainer verification.
Rebased onto
5be1bbb0b(latest main at publication). The focused checks above ran before that clean rebase; no further checks were run after the maintainer requested a testing handoff.Codex task:
codex://threads/01a08406-d72e-7f93-9e9b-ccf4a37bcef4. GitHub displays this as a copyable URI; no approved HTTPS backlink bridge is configured.Implemented with GPT-6 in the Codex harness, using parallel implementation and review agents.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.