[package]
name = "kanade-client"
description = "End-user-facing Tauri Client App for the kanade endpoint-management system. Talks to the LocalSystem agent over the KLP Named Pipe (SPEC §2.12); presents a tray + window UI for notifications / health / self-service jobs."
readme = "../../README.md"
version.workspace      = true
edition.workspace      = true
rust-version.workspace = true
license.workspace      = true
repository.workspace   = true
homepage.workspace     = true
authors.workspace      = true
keywords.workspace     = true
categories.workspace   = true

# The Client App targets Windows endpoints (SPEC §2.1's
# "ログオン時自動起動 (HKCU…Run)" + the Named Pipe transport in
# SPEC §2.12.1). Tauri's runtime and the KLP Named Pipe client
# are both Windows-bound here, so we cfg-gate every Tauri-stack
# dependency to `target_os = "windows"`. Linux/macOS CI builds
# kanade-client as an empty shim that prints + exits (see
# src/main.rs). Linux UDS support lands in a follow-up PR and
# will widen the gate.

[dependencies]
kanade-shared = { workspace = true }

# Cross-platform bits used by the non-Windows shim path too.
anyhow = { workspace = true }

[target.'cfg(target_os = "windows")'.dependencies]
# Tauri 2.x runtime.
#
# `custom-protocol` is REQUIRED for a working production binary. Without
# it Tauri compiles in "dev" mode (`cfg(dev)`) and at runtime loads
# `build.devUrl` (http://localhost:1420, the Vite dev server) instead of
# the embedded `frontendDist` assets — so a shipped client shows
# "localhost — ERR_CONNECTION_REFUSED" because nothing is serving that
# port. `tauri build` injects this feature automatically, but we build
# the client with plain `cargo build --release --workspace`, so it must
# be enabled here. (Trade-off: `cargo tauri dev` no longer hot-reloads
# from the Vite server for this crate — this repo embeds at build time
# and never uses the dev-server flow, so that's fine.)
tauri = { version = "2.11.2", features = ["custom-protocol"] }
# Native OS toast notifications — used for info/warn toasts. Emergencies are
# built as raw WinRT toasts in `app.rs` (the plugin can't persist a toast nor
# carry the click-to-open `launch`).
tauri-plugin-notification = "2.3.3"
# Single-instance guard (#624): the agent launches a fresh client per
# emergency (#102 fallback), so without this a second emergency >10s after
# the first piles up another hidden process. This forwards the second
# launch's argv to the running instance and exits it. Also the path a
# `kanade-client://` toast-click protocol launch takes back to the running
# instance (#647 reveal-on-click).
tauri-plugin-single-instance = "2.4.2"
# WinRT/Win32: `SetCurrentProcessExplicitAppUserModelID` (AUMID pin so toasts
# render at all, #102) plus `UI_Notifications` + `Data_Xml_Dom` to build the
# emergency toast directly — `scenario=Reminder` (persists until dismissed) and
# a toast-level `launch="kanade-client://…" activationType="protocol"` so a body
# OR button click opens the client, no COM activator needed (#647).
windows = { version = "0.62.2", features = [
    "Win32_UI_Shell",
    "UI_Notifications",
    "Data_Xml_Dom",
] }
# Serde for the IPC commands' params / results.
serde      = { workspace = true }
serde_json = { workspace = true }
# Tokio runtime for the KLP pipe I/O. Reuse the workspace's
# pin so the wire types stay in lockstep with the agent side.
tokio    = { workspace = true }
tracing  = { workspace = true }
tracing-subscriber = { workspace = true }
# UUID v7 for KLP request ids (SPEC §2.12.3 "UUID v7 推奨").
uuid    = { workspace = true }
chrono  = { workspace = true }

[target.'cfg(target_os = "windows")'.build-dependencies]
# `tauri-build` reads `tauri.conf.json` at build time and
# generates the context macro consumed in `app::run`. Gated to
# Windows targets so non-Windows CI doesn't have to compile
# Tauri's build helper (which transitively pulls in heavy
# platform-specific deps).
#
# #260: `build.rs` syncs `version` in tauri.conf.json with the
# workspace's CARGO_PKG_VERSION before tauri-build runs, so the
# binary's embedded VERSIONINFO ProductVersion stays in lockstep
# with the Cargo version instead of drifting. Uses a targeted
# string-replace (no `serde_json` round-trip) so the rewrite
# preserves the file's original key order, formatting, and any
# future comments — anything an `serde_json::Value` round-trip
# would silently rewrite alphabetically (Gemini #266).
tauri-build = { version = "2.6.2", features = [] }
