Skip to content

Add feature to discover running tauri app and attach to pid#1

Open
eugeneoshepkov wants to merge 1 commit intodirvine:mainfrom
eugeneoshepkov:main
Open

Add feature to discover running tauri app and attach to pid#1
eugeneoshepkov wants to merge 1 commit intodirvine:mainfrom
eugeneoshepkov:main

Conversation

@eugeneoshepkov
Copy link
Copy Markdown

@eugeneoshepkov eugeneoshepkov commented Jul 27, 2025

This pull request adds the ability to discover and attach to running Tauri applications by PID.

Overview

This update introduces two features to the project:
• Discovery of running Tauri applications on the system
• Ability to attach to an already running Tauri application by its process ID (PID)

Key Changes

  1. New Tool Methods
    • Added two new tool methods in ‎⁠server/index.js⁠:
    ▫ ‎⁠find_running_apps⁠: Finds running Tauri applications on the system.
    ▫ ‎⁠attach_to_app⁠: Attaches to an already running Tauri application using its PID.

  2. Rust Backend Enhancements (‎⁠src/tools/process.rs⁠)
    • ProcessInfo Struct:
    ▫ Added ‎⁠is_attached⁠ flag to distinguish between processes started by the tool and those attached externally.
    ▫ Changed ‎⁠child⁠ from a required field to an ‎⁠Option⁠ to support attached processes that don’t have a child process handle.
    • Process Management:
    ▫ Updated logic to prevent killing processes that were not started by the tool (i.e., attached processes).
    ▫ Added ‎⁠find_running_apps⁠ method to scan system processes and identify likely Tauri apps by name or command-line arguments.
    ▫ Added ‎⁠attach_to_app⁠ method to allow tracking and interacting with an existing process by PID, even if it wasn’t started by the tool.

  3. Server Integration (‎⁠src/server.rs⁠)
    • Registered the new tool methods (‎⁠find_running_apps⁠, ‎⁠attach_to_app⁠) in the server’s method list and JSON-RPC interface.
    • Implemented handlers for these methods, including input validation and error handling.
    • Updated the tool listing to include the new methods and their input schemas.

Summary

With these changes, users can now:
• List all running Tauri applications on their system.
• Attach to any of these running applications by specifying its PID, allowing for monitoring or interaction even if the process was not started by this tool.

These features improve the flexibility and usability of the tool for managing Tauri applications.

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