On this page

Third-Party Compatibility & IPC Integration

Integrate Seer with an AI Agent

Replace the placeholder below, then give the complete instruction to your coding agent:

Read and follow the Seer SDK IPC integration guide at https://raw.githubusercontent.com/ccseer/Seer-sdk/refs/heads/main/IPC_PROMPT.md (and use the matching raw headers/examples referenced inside it when needed). Treat IPC_PROMPT.md as the source of truth for transports, Win32 commands, JSON-RPC methods/events, security checks, and constraints. If the guide is unavailable, stop and report that before proceeding.

Before doing any work, inspect the Requirement below. If it is missing, unchanged placeholder text, or too ambiguous about the target app's language/framework or integration goal, ask one clarifying question and wait. Do not infer the missing requirement.

Once clear, implement a complete, runnable Seer IPC integration in the current workspace using the mechanism that fits the requirement (Named Pipe JSON-RPC 2.0, WM_COPYDATA 6000/6001, Dynamic Explorer 4002/4003 + 4000/4001, or legacy WM_COPYDATA 5000-5010). Do not invent undocumented parameters/fields, do not modify Seer itself, and do not stop at a plan or rough snippets.

Apply every applicable contract from the guide: call seer.getInfo first to probe methods and events before invoking newer RPCs; for Named Pipe clients, use access 0x0012018B, SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, PIPE_READMODE_MESSAGE, server session/owner SID verification, and FILE_FLAG_OVERLAPPED + a reader thread if subscribing to events; for file-manager Spacebar hooks, register topHwnd dynamically, handle SEER_CORE_READY restarts, and reply synchronously to 4000 -> 4001 within 150 ms; always handle Seer not running, invalid/relative paths, and error responses cleanly.

Run the project's available build or verification checks and report actual results; if live Seer runtime testing was not performed, state that explicitly.

Requirement: [REPLACE THIS PLACEHOLDER with your target app/language and integration goal, e.g. add Spacebar Quick Look integration to our C++/Win32 file manager, or open/control Seer previews and subscribe to close events from our Python launcher]

Developer Guide

Ready-to-run examples (C++, Python, C#, Rust, Go, PowerShell, AutoHotkey) are available in the Seer SDK repository.

Seer supports out-of-process integration with third-party applications, scripts, and custom file managers through:

  1. Named Pipe JSON-RPC 2.0 (\\.\pipe\Seer.IPC.v2.<SessionId>) — primary programmatic API for opening/closing/pinning previews, querying session state, registering file manager windows, and subscribing to lifecycle events.
  2. Win32 WM_COPYDATA — dynamic file manager registration (4002 / 4003 + 4000 / 4001 + SEER_CORE_READY), JSON-RPC (6000 / 6001), and legacy fire-and-forget commands (5000–5010).

Connect to \\.\pipe\Seer.IPC.v2.<SessionId> (where <SessionId> comes from ProcessIdToSessionId(GetCurrentProcessId(), ...)), exchange single-line \n-delimited UTF-8 JSON-RPC 2.0 frames (no BOM, max 64 KiB), and switch the client handle to PIPE_READMODE_MESSAGE.

Pipe connection & security requirements:

  • Access mask: Request 0x0012018B (READ_CONTROL | SYNCHRONIZE | FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES). Do not pass GENERIC_WRITE — it includes FILE_CREATE_PIPE_INSTANCE (0x4), which Seer's hardened pipe DACL rejects (ERROR_ACCESS_DENIED).
  • SQOS flags: Pass SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION (0x00100000 | 0x00010000) to CreateFileW.
  • Server verification: Immediately verify GetNamedPipeServerSessionId matches your session ID and the pipe owner SID (GetSecurityInfo OWNER_SECURITY_INFORMATION) matches your user SID, BUILTIN\Administrators, or NT AUTHORITY\SYSTEM.
  • Event subscriptions: Clients calling seer.events.subscribe must also pass FILE_FLAG_OVERLAPPED and read on a dedicated background thread so synchronous ReadFile does not block WriteFile.

Available API areas:

Area Representative methods Notes
Introspection seer.getInfo, seer.app.getState, seer.viewers.list, seer.viewers.resolve Exempt from the license and activation gate.
Preview lifecycle seer.preview.open, close, getState, list, switchViewer, reload, separate, closeAllSub mode: main / separated / pinned / standalone.
File actions seer.preview.reveal, openDefault, getProperties, capture Do not change preview visibility.
Viewer and control actions seer.preview.listControls, triggerControl, listViewerActions, triggerViewerAction Whitelisted actions only.
Window control seer.window.focus, showToast, pin, waggle, setBounds, setFullscreen, setInspector Bounds are physical pixels, clamped to the work area.
File-manager registration seer.explorer.register, unregister, suspend topHwnd is a JSON uint32 in [1, 0xFFFFFFFF].
Plugin packages seer.plugins.list, install, upgrade, remove Writes are Named Pipe only.
Events seer.events.subscribe, unsubscribe Named Pipe only; explicit event names, no wildcards.

Full parameter schemas, return values, event payloads, session rules, and the complete error-code list are documented in IPC_PROMPT.md.

License and connection limits: seer.preview.* and seer.window.* require an active license; seer.plugins.* writes require a valid license but are exempt from activation; introspection, viewer, explorer, and event methods stay available regardless of license or activation state. Check seer.getInfo.methods and seer.getInfo.events before calling methods added after your integration shipped. Up to 4 concurrent connections per process and 16 in total.


Custom File Manager Integration (Spacebar Hook)

Custom file managers register their top-level window handles dynamically at runtime so Seer intercepts the Spacebar keypress when that window is in the foreground and requests the currently selected file path.

Step 1: Register Your Top-Level Window (4002)

Locate Seer via FindWindowW(L"SeerWindowClass", nullptr) and send WM_COPYDATA with dwData = SEER_REGISTER_EXPLORER (4002), fixed 8-byte payload (ULONGLONG holding the low 32 bits of your topHwnd), and wParam set to a valid HWND owned by your process (wParam = 0 is always rejected):

bool registerToSeer(HWND myTopHwnd)
{
    HWND seer = FindWindowW(SEER_CLASS_NAME, nullptr);
    if (!seer || !myTopHwnd) {
        return false;
    }

    ULONGLONG payload = static_cast<ULONGLONG>(static_cast<DWORD>(reinterpret_cast<ULONG_PTR>(myTopHwnd)));
    COPYDATASTRUCT cds{};
    cds.dwData = SEER_REGISTER_EXPLORER; // 4002
    cds.cbData = sizeof(payload);        // fixed 8 bytes
    cds.lpData = &payload;

    DWORD_PTR result = 0;
    if (!SendMessageTimeoutW(seer, WM_COPYDATA, reinterpret_cast<WPARAM>(myTopHwnd),
                             reinterpret_cast<LPARAM>(&cds), SMTO_ABORTIFHUNG, 500, &result)) {
        return false;
    }
    return result != 0;
}

Listen for the RegisterWindowMessageW(L"SEER_CORE_READY") broadcast in your window procedure and re-run registerToSeer(myTopHwnd) so your integration continues working if Seer starts later or restarts. Optionally send SEER_UNREGISTER_EXPLORER (4003) before destroying your window.

If your file manager runs elevated while Seer runs non-elevated, allow messages on your top-level window with ChangeWindowMessageFilterEx for WM_COPYDATA and RegisterWindowMessageW(L"SEER_CORE_READY").

Step 2: Handle Spacebar Press (4000 -> 4001)

When the user presses Spacebar inside a registered foreground window, Seer sends WM_COPYDATA with dwData = SEER_REQUEST_PATH (4000), cbData = 0, and lpData = nullptr.

Seer waits 150ms (SendMessageTimeout) for your synchronous SEER_RESPONSE_PATH (4001) reply before returning from WM_COPYDATA handling so the UI never hangs.

Respond back to FindWindowW(SEER_CLASS_NAME, nullptr) with dwData = SEER_RESPONSE_PATH (4001) carrying the NUL-terminated UTF-16LE absolute path (cbData = (wcslen(path) + 1) * sizeof(wchar_t)). See examples/cpp_explorer/main.cpp for a complete runnable implementation.


Custom App Trigger (Legacy WM_COPYDATA)

Existing integrations using one-shot WM_COPYDATA preview commands (5000–5010) continue to work unchanged. The preview, visibility, version, and current-file commands are documented together with their payload rules in seer/ipclegacyhelper.h, seer/ipc.h, and examples/legacy/:

HWND seer = FindWindowW(L"SeerWindowClass", nullptr);
if (seer) {
    COPYDATASTRUCT cd{};
    cd.cbData = static_cast<DWORD>((wcslen(path) + 1) * sizeof(wchar_t));
    cd.lpData = const_cast<LPWSTR>(path);
    cd.dwData = SEER_INVOKE_W32; // 5000
    SendMessageW(seer, WM_COPYDATA, 0, reinterpret_cast<LPARAM>(&cd));
}

New integrations should prefer the Named Pipe API, where seer.preview.getState replaces the shared-memory current-file query and seer.events replaces polling.


Common Error Codes

The full list, including the package-installation range and the standard JSON-RPC codes, lives in IPC_PROMPT.md. These are the ones integrations usually hit first:

Code Name Typical cause
-32001 NOT_ACTIVE Seer's keyboard hook / preview service is paused or inactive (active == false), and the method is behind the activation gate.
-32002 SESSION_NOT_FOUND The window was closed, or Seer restarted and invalidated session IDs.
-32003 SESSION_PINNED A close request targeted a pinned window.
-32004 INVALID_STATE Hidden, unloaded, or resolving window; also a plugin write while Settings is open.
-32005 TRANSPORT_UNSUPPORTED An event subscription or plugin write was sent over 6000 instead of the Named Pipe.
-32009 LICENSE_EXPIRED Trial or license expired; takes precedence over -32001.

SeerViewer.exe (SeerViewerWindowClass) handles standalone previews and returns FALSE (0) for 4002, 4003, and 6000.