[workspace]
members = [".", "crates/*"]
resolver = "3"

[workspace.dependencies]
jacquard = { version = "0.12", default-features = false, features = ["derive", "api_bluesky"] }
jacquard-axum = { version = "0.12" }
jacquard-common = { version = "0.12" }
jacquard-derive = { version = "0.12" }
jacquard-lexicon = { version = "0.12", default-features = false }
serde = { version = "1.0", features = ["derive"] }
thiserror = "2.0"
miette = "7.6"

[package]
name = "polymodel"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Agent-workflow demo app built with Rust, Dioxus, Jacquard, Jira, Confluence, and Polytoken."

[features]
default = ["web"]
web = ["dioxus/web"]
desktop = ["dioxus/desktop"]
mobile = ["dioxus/mobile"]
server = [
    "dioxus/server",
    "dep:axum",
    "dep:tower",
    "dep:tower-http",
    # XRPC read endpoint handlers (jacquard-axum ExtractXrpc / IntoRouter).
    "dep:jacquard-axum",
    # Generated typed XRPC request/response/view types.

    # Indexing infrastructure (Hydrant firehose + SQLite projection)
    "dep:hydrant",
    "dep:sqlx",
    "dep:libsqlite3-sys",
    "dep:tokio",
    "dep:futures",
    "dep:anyhow",
    "dep:dotenvy",
    "dep:chrono",
    "dep:tracing-subscriber",
    "dep:rustls",
    # OAuth (PM-27): confidential client, private cookie jar key, secret sources.
    "dep:axum-extra",

    "dep:keyring",
    "dep:base64",
]
[dependencies]
dioxus = { version = "0.7", features = ["router", "fullstack"] }
jacquard = { workspace = true }
jacquard-axum = { workspace = true, optional = true }
jacquard-common = { workspace = true }
jacquard-derive = { workspace = true }
# Generated lexicon bindings (typed request/response/view types for XRPC routes).
polymodel-api = { path = "crates/polymodel-api" }
serde = { workspace = true }
serde_json = "1.0"
thiserror = { workspace = true }
tracing = { version = "0.1", default-features = false, features = ["std"] }
three-d-asset = { version = "0.10", default-features = false }
stl_io = "0.11"

axum = { version = "0.8", optional = true }
tower = { version = "0.5", optional = true }
tower-http = { version = "0.6", optional = true, features = ["trace"] }
three-d = { version = "0.19.0", default-features = false }
rustls = { version = "0.23", default-features = false, features = ["aws-lc-rs", "std"], optional = true }
# Server-only indexing infrastructure.
# hydrant is pinned to a specific commit to protect against breaking API changes.
hydrant = { git = "https://tangled.org/ptr.pet/hydrant", rev = "1145fa1bb194372ceea81ab48b5d68d304da34ad", default-features = false, features = ["indexer", "indexer_stream"], optional = true }
# Compile-time-checked queries. sqlx version matches the `sqlx-cli` provided by
# the nix dev shell so `cargo sqlx prepare` and the macros agree on the .sqlx
# cache format. `cargo sqlx prepare --features server` generates the committed
# .sqlx cache for offline/CI builds.
sqlx = { version = "0.9", default-features = false, features = [
    "runtime-tokio",
    "sqlite",
    "macros",
    "migrate",
], optional = true }
# Bundle SQLite (libsqlite3-sys bundled enables FTS5) so no system libsqlite3 is
# required. Version follows sqlx 0.9's libsqlite3-sys requirement.
libsqlite3-sys = { version = "0.37", features = ["bundled"], optional = true }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"], optional = true }
futures = { version = "0.3", optional = true }
anyhow = { version = "1", optional = true }
dotenvy = { version = "0.15", optional = true }
chrono = { version = "0.4", optional = true }
tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = [
    "std",
    "fmt",
    "env-filter",
] }
http = "1.4"
reqwest = { version = "0.12", default-features = false, features = ["json", "charset"] }

# PM-27 OAuth: private cookie-jar signing key and swappable secret sources
# (OS keyring preferred; env override). reqwest is shared with the client crate.
axum-extra = { version = "0.10", optional = true, features = ["cookie"] }

keyring = { version = "3", optional = true }
base64 = { version = "0.22", optional = true }


[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
console_error_panic_hook = "0.1"
js-sys = "0.3"
tracing-wasm = "0.2"
wasm-bindgen = "=0.2.121"
wasm-bindgen-futures = "0.4"
web-sys = { version = "0.3", features = ["Window", "Document", "Element", "Event", "EventTarget", "HtmlCanvasElement", "WebGl2RenderingContext", "Performance", "MouseEvent", "WheelEvent", "PointerEvent", "DomRect", "BroadcastChannel", "console", "Response"] }

[dev-dependencies]
tokio = { version = "1", features = ["rt", "macros"] }

[build-dependencies]
dotenvy = "0.15"
serde_json = "1.0"

[profile.web-release]
inherits = "release"
opt-level = "z"
lto = "fat"
codegen-units = 1
strip = "symbols"
