Skip to content

Ai prompt fix#396

Merged
shobhit99 merged 3 commits into
mainfrom
ai-prompt-fix
May 15, 2026
Merged

Ai prompt fix#396
shobhit99 merged 3 commits into
mainfrom
ai-prompt-fix

Conversation

@shobhit99
Copy link
Copy Markdown
Contributor

No description provided.

shobhit99 and others added 3 commits May 15, 2026 19:19
The prompt window's 'window-shown' IPC message was sent immediately after
createPromptWindow() — but on the first open the BrowserWindow had just
been created and the React app hadn't mounted yet, so PromptApp's
onWindowShown listener wasn't registered. The message was silently
dropped. Subsequent opens reused the already-loaded window, so the
listener was live and the text arrived correctly.

Fix mirrors the pattern used for the main launcher window:

- PromptApp now calls rendererReady() on mount, emitting the same
  'renderer-ready' IPC signal the main App.tsx sends.
- createPromptWindow registers an ipcMain.once('renderer-ready') handler
  (with re-register-on-wrong-sender semantics) that sets
  promptRendererReady=true and flushes any pending payload.
- showPromptWindow checks promptRendererReady: if true, sends
  immediately (all subsequent opens); if false, stores the payload in
  pendingPromptWindowShown so the handler delivers it once the app mounts.

Also rewrites get-selected-text.swift with BFS traversal across focused
element, focused window, and system-wide element roots; adds text marker
range support for Chromium/Electron apps; skips secure text fields; and
adds AXEnhancedUserInterface opt-in for richer attribute access. Adds
AppKit framework to the native build command to support NSWorkspace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- clipboard-manager.ts: update getFastPasteAddon → getNativeHelpersAddon /
  fast_paste.node → native_helpers.node (addon rename from #392). Adopt
  main's expanded image-format support (jpeg/webp/heic/tiff via
  readClipboardBufferForFormats, nativeImage fallback). Keep our changeCount
  optimisation and add fallbackImage to destructuring.
- native_helpers.mm: export both getPasteboardChangeCount (this branch)
  and setWindowAnimationBehaviorNone (from #392).
- package.json build:native: keep -framework AppKit for get-selected-text
  (required by the selected-text fix on this branch) while using
  native-helpers-addon / native_helpers.node paths from main's rename.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a351c68720

ℹ️ 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".

Comment on lines +181 to +182
enqueueFocusedChild(of: element, depth: depth, into: &queue)
enqueueChildren(of: element, depth: depth, into: &queue)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict selection lookup to focused AX subtree

findSelectedText now breadth-first scans every AXChildren node and returns the first non-empty selection it finds, even if that element is not focused. In multi-pane apps (editors, split views, sidebars), an unfocused control can keep stale selected text while the active control exposes selection only via marker APIs, so this search can return unrelated text and cause cursor-prompt rewrites to target the wrong content. The lookup should constrain accepted matches to the focused chain (or otherwise validate focus ownership) before returning.

Useful? React with 👍 / 👎.

@shobhit99 shobhit99 merged commit 812c63c into main May 15, 2026
3 checks passed
@shobhit99 shobhit99 deleted the ai-prompt-fix branch May 15, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant