diff --git a/.gitignore b/.gitignore index e699cc17..3d0848f1 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ mykey.py tasks/ *.zip +*.exe memory/* !memory/memory_management_sop.md diff --git a/frontends/desktop/.gitignore b/frontends/desktop/.gitignore new file mode 100644 index 00000000..b051b24a --- /dev/null +++ b/frontends/desktop/.gitignore @@ -0,0 +1,7 @@ +# Rust build artifacts +src-tauri/target/ +src-tauri/gen/ + +# Node +node_modules/ +package-lock.json diff --git a/frontends/desktop/package.json b/frontends/desktop/package.json new file mode 100644 index 00000000..24e549dc --- /dev/null +++ b/frontends/desktop/package.json @@ -0,0 +1,10 @@ +{ + "name": "genericagent-web2", + "version": "0.1.0", + "scripts": { + "tauri": "tauri" + }, + "devDependencies": { + "@tauri-apps/cli": "^2" + } +} diff --git a/frontends/desktop/src-tauri/Cargo.lock b/frontends/desktop/src-tauri/Cargo.lock new file mode 100644 index 00000000..266d871f --- /dev/null +++ b/frontends/desktop/src-tauri/Cargo.lock @@ -0,0 +1,4569 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "brotli" +version = "8.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.11.1", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "cargo_toml" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" +dependencies = [ + "serde", + "toml 0.9.12+spec-1.1.0", +] + +[[package]] +name = "cc" +version = "1.2.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags 2.11.1", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.11.1", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "ctor" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "352d39c2f7bef1d6ad73db6f5160efcaed66d94ef8c6c573a8410c00bf909a98" +dependencies = [ + "ctor-proc-macro", + "dtor", +] + +[[package]] +name = "ctor-proc-macro" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dbus" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b942602992bb7acfd1f51c49811c58a610ef9181b6e66f3e519d79b540a3bf73" +dependencies = [ + "libc", + "libdbus-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.117", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.11.1", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dlopen2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dom_query" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" +dependencies = [ + "bit-set", + "cssparser", + "foldhash 0.2.0", + "html5ever", + "precomputed-hash", + "selectors", + "tendril", +] + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dtor" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1057d6c64987086ff8ed0fd3fbf377a6b7d205cc7715868cd401705f715cbe4" +dependencies = [ + "dtor-proc-macro", +] + +[[package]] +name = "dtor-proc-macro" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "embed-resource" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31a88c8d26de40ed18fe748c547845aa39de1db3afd958f8cb91579f3644bcb" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 1.1.2+spec-1.1.0", + "vswhom", + "winreg", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkx11" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps", + "x11", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.11.1", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +dependencies = [ + "log", + "markup5ever", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371" +dependencies = [ + "byteorder", + "png 0.17.16", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +dependencies = [ + "cfb", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "javascriptcore-rs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "js-sys" +version = "0.3.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "jsonptr" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.11.1", + "serde", + "unicode-segmentation", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libdbus-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libredox" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +dependencies = [ + "libc", +] + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "markup5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "muda" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae8844f63b5b118e334e205585b8c5c17b984121dbdb179d44aeb087ffad3cb" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "once_cell", + "png 0.18.1", + "serde", + "thiserror 2.0.18", + "windows-sys 0.61.2", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.11.1", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "num-conv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.11.1", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.11.1", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.11.1", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-location" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.11.1", + "block2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.11.1", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-location", + "objc2-core-text", + "objc2-foundation", + "objc2-quartz-core", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags 2.11.1", + "block2", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plist" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "092791278e026273c1b65bbdcfbba3a300f2994c896bd01ab01da613c29c46f1" +dependencies = [ + "base64 0.22.1", + "indexmap 2.14.0", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.11.1", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.11+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.39.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.117", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "selectors" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" +dependencies = [ + "bitflags 2.11.1", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "phf", + "phf_codegen", + "precomputed-hash", + "rustc-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_with" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e72c1c2cb7b223fafb600a619537a871c2818583d619401b785e7c0b746ccde2" +dependencies = [ + "base64 0.22.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.0", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90c488738ecb4fb0262f41f43bc40efc5868d9fb744319ddf5f5317f417bfac" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "servo_arc" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "bytemuck", + "js-sys", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall", + "tracing", + "wasm-bindgen", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "soup3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "swift-rs" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "tao" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33f7f9e486ade65fcf1e45c440f9236c904f5c1002cdc7fc6ae582777345ce4" +dependencies = [ + "bitflags 2.11.1", + "block2", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dbus", + "dispatch2", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni", + "libc", + "log", + "ndk", + "ndk-sys", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "once_cell", + "parking_lot", + "percent-encoding", + "raw-window-handle", + "tao-macros", + "unicode-segmentation", + "url", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93bd86d231f0a8138f11a02a584769fe4b703dc36ae133d783228dbc4801405" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.4", + "glob", + "gtk", + "heck 0.5.0", + "http", + "jni", + "libc", + "log", + "mime", + "muda", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.18", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows", +] + +[[package]] +name = "tauri-build" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a318b234cc2dea65f575467bafcfb76286bce228ebc3778e337d61d03213007" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "heck 0.5.0", + "json-patch", + "schemars 0.8.22", + "semver", + "serde", + "serde_json", + "tauri-utils", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd11644962add2549a60b7e7c6800f17d7020156e02f516021d8103e80cc528" +dependencies = [ + "base64 0.22.1", + "brotli", + "ico", + "json-patch", + "plist", + "png 0.17.16", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.117", + "tauri-utils", + "thiserror 2.0.18", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-hello" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", +] + +[[package]] +name = "tauri-macros" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed9d3742a37a355d2e47c9af924e9fbc112abb76f9835d35d4780e318419502" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.117", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-runtime" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fef478ba1d2ac21c2d528740b24d0cb315e1e8b1111aae53fafac34804371fc" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni", + "objc2", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.18", + "url", + "webkit2gtk", + "webview2-com", + "windows", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3989df2ae1c476404fe0a2e8ffc4cfbde97e51efd613c2bb5355fbc9ab52cf0" +dependencies = [ + "gtk", + "http", + "jni", + "log", + "objc2", + "objc2-app-kit", + "once_cell", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d57200389a2f82b4b0a40ae29ca19b6978116e8f4d4e974c3234ce40c0ffbdec" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dom_query", + "dunce", + "glob", + "http", + "infer", + "json-patch", + "log", + "memchr", + "phf", + "plist", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.18", + "toml 1.1.2+spec-1.1.0", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6" +dependencies = [ + "dunce", + "embed-resource", + "toml 1.1.2+spec-1.1.0", +] + +[[package]] +name = "tendril" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" +dependencies = [ + "new_debug_unreachable", + "utf-8", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap 2.14.0", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "indexmap 2.14.0", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.3", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.14.0", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.14.0", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.25.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +dependencies = [ + "indexmap 2.14.0", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.3", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.3", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68d6fdd9f81c2819c9a8b0e0cd91660e7746a8e6ea2ba7c6b2b057985f6bcb51" +dependencies = [ + "bitflags 2.11.1", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tray-icon" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15edbb0d80583e85ee8df283410038e17314df5cba30da2087a54a85216c0773" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "once_cell", + "png 0.18.1", + "serde", + "thiserror 2.0.18", + "windows-sys 0.61.2", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-ucd-ident" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlpattern" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +dependencies = [ + "regex", + "serde", + "unic-ucd-ident", + "url", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96492d0d3ffba25305a7dc88720d250b1401d7edca02cc3bcd50633b424673b8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.14.0", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.1", + "hashbrown 0.15.5", + "indexmap 2.14.0", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webkit2gtk" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps", +] + +[[package]] +name = "webview2-com" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows", + "windows-core 0.61.2", + "windows-implement", + "windows-interface", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "webview2-com-sys" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" +dependencies = [ + "thiserror 2.0.18", + "windows", + "windows-core 0.61.2", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "window-vibrancy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" +dependencies = [ + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "raw-window-handle", + "windows-sys 0.59.0", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +dependencies = [ + "cfg-if", + "windows-sys 0.59.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap 2.14.0", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.1", + "indexmap 2.14.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.14.0", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "wry" +version = "0.55.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186f9871daa55fd9c016578b810d149de58367113db7fb72b462d2323ce19514" +dependencies = [ + "base64 0.22.1", + "block2", + "cookie", + "crossbeam-channel", + "dirs", + "dom_query", + "dpi", + "dunce", + "gdkx11", + "gtk", + "http", + "javascriptcore-rs", + "jni", + "libc", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "once_cell", + "percent-encoding", + "raw-window-handle", + "sha2", + "soup3", + "tao-macros", + "thiserror 2.0.18", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/frontends/desktop/src-tauri/Cargo.toml b/frontends/desktop/src-tauri/Cargo.toml new file mode 100644 index 00000000..d12bed0d --- /dev/null +++ b/frontends/desktop/src-tauri/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tauri-hello" +version = "0.1.0" +edition = "2021" + +[build-dependencies] +tauri-build = { version = "2", features = [] } + +[dependencies] +tauri = { version = "2", features = [] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" + +[lib] +name = "tauri_hello_lib" +crate-type = ["lib", "cdylib", "staticlib"] diff --git a/frontends/desktop/src-tauri/build.rs b/frontends/desktop/src-tauri/build.rs new file mode 100644 index 00000000..d860e1e6 --- /dev/null +++ b/frontends/desktop/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build() +} diff --git a/frontends/desktop/src-tauri/icons/icon.ico b/frontends/desktop/src-tauri/icons/icon.ico new file mode 100644 index 00000000..cf8d4697 Binary files /dev/null and b/frontends/desktop/src-tauri/icons/icon.ico differ diff --git a/frontends/desktop/src-tauri/src/lib.rs b/frontends/desktop/src-tauri/src/lib.rs new file mode 100644 index 00000000..adbc6b9f --- /dev/null +++ b/frontends/desktop/src-tauri/src/lib.rs @@ -0,0 +1,86 @@ +use std::process::{Command, Child}; +use std::sync::Mutex; +use std::net::TcpStream; +use std::time::{Duration, Instant}; +use std::thread; +use std::path::PathBuf; + +#[cfg(windows)] +use std::os::windows::process::CommandExt; + +static BRIDGE_PROCESS: Mutex> = Mutex::new(None); + +fn find_bridge_script() -> PathBuf { + // exe is at frontends/GenericAgent.exe + // bridge is at frontends/desktop_bridge.py + let exe_dir = std::env::current_exe() + .expect("cannot get exe path") + .parent() + .expect("cannot get exe dir") + .to_path_buf(); + exe_dir.join("desktop_bridge.py") +} + +fn wait_for_port(port: u16, timeout: Duration) -> bool { + let start = Instant::now(); + while start.elapsed() < timeout { + if TcpStream::connect(("127.0.0.1", port)).is_ok() { + return true; + } + thread::sleep(Duration::from_millis(100)); + } + false +} + +fn start_bridge() { + let script = find_bridge_script(); + if !script.exists() { + eprintln!("[tauri] bridge script not found: {:?}", script); + return; + } + + let show_console = std::env::args().any(|a| a == "--console"); + + let mut cmd = Command::new("python"); + cmd.arg(&script) + .current_dir(script.parent().unwrap()); + + #[cfg(windows)] + if !show_console { + const CREATE_NO_WINDOW: u32 = 0x08000000; + cmd.creation_flags(CREATE_NO_WINDOW); + } + + let child = cmd.spawn().expect("failed to start desktop_bridge.py"); + + eprintln!("[tauri] started bridge PID={}", child.id()); + *BRIDGE_PROCESS.lock().unwrap() = Some(child); + + if !wait_for_port(14168, Duration::from_secs(15)) { + eprintln!("[tauri] WARNING: bridge did not become ready within 15s"); + } +} + +fn stop_bridge() { + if let Some(mut child) = BRIDGE_PROCESS.lock().unwrap().take() { + eprintln!("[tauri] stopping bridge PID={}", child.id()); + let _ = child.kill(); + let _ = child.wait(); + } +} + +#[cfg_attr(mobile, tauri::mobile_entry_point)] +pub fn run() { + start_bridge(); + + tauri::Builder::default() + .on_window_event(|_window, event| { + if let tauri::WindowEvent::Destroyed = event { + stop_bridge(); + } + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + + stop_bridge(); +} diff --git a/frontends/desktop/src-tauri/src/main.rs b/frontends/desktop/src-tauri/src/main.rs new file mode 100644 index 00000000..810b32ae --- /dev/null +++ b/frontends/desktop/src-tauri/src/main.rs @@ -0,0 +1,5 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +fn main() { + tauri_hello_lib::run() +} diff --git a/frontends/desktop/src-tauri/tauri.conf.json b/frontends/desktop/src-tauri/tauri.conf.json new file mode 100644 index 00000000..cbcfe48c --- /dev/null +++ b/frontends/desktop/src-tauri/tauri.conf.json @@ -0,0 +1,29 @@ +{ + "productName": "GenericAgent", + "version": "0.1.0", + "identifier": "com.genericagent.app", + "build": { + "frontendDist": "../static" + }, + "app": { + "withGlobalTauri": true, + "security": { + "csp": null + }, + "windows": [ + { + "title": "GenericAgent", + "label": "main", + "width": 1280, + "height": 800, + "resizable": true, + "url": "http://127.0.0.1:14168/" + } + ] + }, + "bundle": { + "active": true, + "targets": "nsis", + "icon": ["icons/icon.ico"] + } +} diff --git a/frontends/desktop/static/app.js b/frontends/desktop/static/app.js new file mode 100644 index 00000000..e5a3b2b3 --- /dev/null +++ b/frontends/desktop/static/app.js @@ -0,0 +1,2240 @@ +window.process = window.process || { platform: navigator.platform.toLowerCase().includes('mac') ? 'darwin' : 'win32' }; +// GenericAgent Desktop — Renderer Logic +// Handles UI state, sessions, streaming, slash commands. + +'use strict'; + +// ─── State ──────────────────────────────────────────────────────────────── +const state = { + sessions: new Map(), // localSessionId -> { id, bridgeSessionId, title, messages: [], cwd, config, diagnostics } + activeId: null, + bridgeReady: false, + defaultConfig: { theme: 'auto', llmNo: 0, gaRoot: '' }, + modelProfiles: [], + restartingBridge: false, + bridgeNoticeMessage: null, + mykeyReady: true, + runtimeBySessionId: new Map(), +}; + +// Helper: get config/diagnostics for the active session (or defaults) +function getActiveConfig() { + const sess = state.sessions.get(state.activeId); + return sess ? sess.config : state.defaultConfig; +} +function getActiveDiagnostics() { + const sess = state.sessions.get(state.activeId); + return sess ? sess.diagnostics : []; +} + +// ─── DOM refs ───────────────────────────────────────────────────────────── +const $ = (id) => document.getElementById(id); +const messagesEl = $('messages'); +const inputEl = $('input'); +const sendBtn = $('send-btn'); +const sessionListEl = $('session-list'); +const sessionTitleEl = $('session-title'); +const statusBadge = $('status-badge'); +const statusText = $('status-text'); +const settingsModal = $('settings-modal'); +const errorBanner = $('error-banner'); +const diagnosticsPanel = $('diagnostics-panel'); +const diagnosticsLogEl = $('diagnostics-log'); + + +// ─── Diagnostics ───────────────────────────────────────────────────────── +const MAX_DIAGNOSTICS = 200; + +function diagnosticText(payload) { + if (payload == null) return ''; + if (typeof payload === 'string') return payload; + if (payload instanceof Error) return payload.stack || payload.message; + try { + return JSON.stringify(payload); + } catch (_) { + return String(payload); + } +} + +function addDiagnostic(level, message, payload) { + const ts = new Date().toISOString(); + const detail = diagnosticText(payload); + const diags = getActiveDiagnostics(); + diags.push({ ts, level, message, detail }); + if (diags.length > MAX_DIAGNOSTICS) diags.shift(); + renderDiagnostics(); +} + +function formatDiagnostics() { + const diags = getActiveDiagnostics(); + if (diags.length === 0) return 'No diagnostics yet.'; + return diags.map((entry) => { + const suffix = entry.detail ? `\n ${entry.detail}` : ''; + return `[${entry.ts}] ${entry.level.toUpperCase()} ${entry.message}${suffix}`; + }).join('\n'); +} + +function renderDiagnostics() { + if (diagnosticsLogEl) diagnosticsLogEl.textContent = formatDiagnostics(); +} + +function openDiagnostics() { + renderDiagnostics(); + diagnosticsPanel.classList.remove('hidden'); +} + +function closeDiagnostics() { + diagnosticsPanel.classList.add('hidden'); +} + +async function copyDiagnostics() { + const text = formatDiagnostics(); + try { + await navigator.clipboard.writeText(text); + addDiagnostic('info', 'Diagnostics copied to clipboard'); + } catch (err) { + addDiagnostic('error', 'Failed to copy diagnostics', err); + showError('Failed to copy diagnostics: ' + (err.message || err), null, null, { skipDiagnostic: true }); + } +} + +function clearDiagnostics() { + const sess = state.sessions.get(state.activeId); + if (sess) sess.diagnostics = []; + renderDiagnostics(); +} + +// ─── Markdown ───────────────────────────────────────────────────────────── +if (typeof marked !== 'undefined') { + marked.setOptions({ + gfm: true, + breaks: true, + mangle: false, + headerIds: false + }); +} + +const ALLOWED_URI_RE = /^(https?:|mailto:|tel:|#|\/)/i; + +function renderMarkdown(text) { + if (typeof marked === 'undefined') { + const div = document.createElement('div'); + div.textContent = text; + return div.innerHTML; + } + try { + return sanitizeMarkdown(marked.parse(text)); + } catch (e) { + return escapeHtml(text); + } +} + +function sanitizeMarkdown(html) { + const template = document.createElement('template'); + template.innerHTML = String(html); + const blockedTags = new Set(['SCRIPT', 'STYLE', 'IFRAME', 'OBJECT', 'EMBED', 'LINK', 'META', 'BASE', 'FORM', 'INPUT', 'BUTTON']); + const walker = document.createTreeWalker(template.content, NodeFilter.SHOW_ELEMENT); + const removals = []; + while (walker.nextNode()) { + const el = walker.currentNode; + if (blockedTags.has(el.tagName)) { + removals.push(el); + continue; + } + for (const attr of Array.from(el.attributes)) { + const name = attr.name.toLowerCase(); + const value = attr.value.trim(); + if (name.startsWith('on') || name === 'srcdoc') { + el.removeAttribute(attr.name); + continue; + } + if ((name === 'href' || name === 'src' || name === 'xlink:href') && value && !ALLOWED_URI_RE.test(value)) { + el.removeAttribute(attr.name); + } + } + if (el.tagName === 'A') { + el.setAttribute('rel', 'noopener noreferrer'); + el.setAttribute('target', '_blank'); + } + } + for (const el of removals) el.remove(); + return template.innerHTML; +} + + +function detectStructuredKind(line) { + const trimmed = String(line || '').trim(); + const m = trimmed.match(/^(TOOL_RECALL|TOOL_REQUEST|TOOL_RESPONSE|COWORK|TUNR|TURN|ACTION|OBSERVATION|THOUGHT|TOOL)[\s:_-]*(.*)$/i); + if (m) return { kind: m[1].toUpperCase(), rest: (m[2] || '').trim() }; + + // GenericAgent's ACP bridge currently streams tool calls/results as plain + // assistant text, not as ACP `tool_call` notifications. Recognize the real + // XML-ish markers so streamed code_run/file_read/etc. blocks are folded. + if (/^]*>/i.test(trimmed) || /^]*\bname=["'][^"']+["'][^>]*>/i.test(trimmed)) { + return { kind: 'TOOL_CALL', rest: trimmed }; + } + if (/^]*>/i.test(trimmed) || /^]*>/i.test(trimmed)) { + return { kind: 'TOOL_RESULT', rest: trimmed }; + } + return null; +} + +function isStructuredClosingLine(line, kind, textSoFar) { + const trimmed = String(line || '').trim(); + const block = String(textSoFar || ''); + if (kind === 'TOOL_CALL') { + if (/^<\/function_calls>$/i.test(trimmed)) return true; + // Single-invoke streams may omit the wrapper. + return /^<\/invoke>$/i.test(trimmed) && !/^\s*$/i.test(trimmed)) return true; + // Single-result streams may omit the wrapper. + return /^<\/result>$/i.test(trimmed) && !/^\s* tag content only + const summaryMatch = raw.match(/\s*([\s\S]*?)\s*<\/summary>/i); + if (summaryMatch) { + const line = summaryMatch[1].trim().split('\n')[0] || kind; + return line.length > 96 ? line.slice(0, 96) + '…' : line; + } + // No summary tag: show kind only (no body text leakage) + if (kind === 'LLM_RUNNING') return 'LLM Running'; + return kind; +} + +const LLM_RUNNING_MARKER_RE = /(\**LLM Running \(Turn \d+\) \.\.\.\**)/g; + +function splitLLMRunningSegments(raw) { + const placeholders = []; + const protect = value => { + placeholders.push(value); + return `\u0000PH${placeholders.length - 1}\u0000`; + }; + let safe = String(raw || '').replace(/`{4,}[\s\S]*?`{4,}/g, protect); + safe = safe.replace(/`{4,}[^`][\s\S]*$/g, protect); + const restore = value => String(value || '').replace(/\u0000PH(\d+)\u0000/g, (_, i) => placeholders[Number(i)] || ''); + const parts = safe.split(LLM_RUNNING_MARKER_RE).map(restore); + if (parts.length < 4) return null; + const segments = []; + if (parts[0] && parts[0].trim()) segments.push({ kind: 'agent_message_chunk', text: parts[0].trimEnd() }); + const turns = []; + for (let i = 1; i < parts.length; i += 2) { + turns.push({ marker: parts[i] || '', content: parts[i + 1] || '' }); + } + turns.forEach((turn, idx) => { + const text = `${turn.marker}${turn.content}`.trimEnd(); + if (!text) return; + // Match Streamlit: historical/intermediate LLM Running turns are folded; + // the latest turn remains plain so final answers are not hidden by default. + segments.push({ kind: idx < turns.length - 1 ? 'LLM_RUNNING' : 'agent_message_chunk', text }); + }); + return segments.length ? segments : null; +} + +function splitStructuredSegments(text) { + const raw = String(text || ''); + const llmSegments = splitLLMRunningSegments(raw); + if (llmSegments) return llmSegments; + const lines = raw.split(/\r?\n/); + const segments = []; + let buf = []; + let kind = 'agent_message_chunk'; + let inFence = false; + const flush = () => { + if (!buf.length) return; + segments.push({ kind, text: buf.join('\n').trimEnd() }); + buf = []; + }; + for (const line of lines) { + const fence = /^\s*```/.test(line); + const hit = !inFence ? detectStructuredKind(line) : null; + if (hit && hit.kind !== kind) { + flush(); + kind = hit.kind; + buf.push(line); + } else { + buf.push(line); + } + if (!inFence && kind !== 'agent_message_chunk' && isStructuredClosingLine(line, kind, buf.join('\n'))) { + flush(); + kind = 'agent_message_chunk'; + } + if (fence) inFence = !inFence; + } + flush(); + return segments.length ? segments : [{ kind: 'agent_message_chunk', text: raw }]; +} + +function hasUnfencedStructuredMarker(text) { + let inFence = false; + for (const line of String(text || '').split(/\r?\n/)) { + const fence = /^\s*```/.test(line); + if (!inFence && detectStructuredKind(line)) return true; + if (fence) inFence = !inFence; + } + return false; +} + +function shouldFoldSegment(kind, text) { + return kind !== 'agent_message_chunk' || hasUnfencedStructuredMarker(text); +} + +function getNowMs() { + if (typeof performance !== 'undefined' && typeof performance.now === 'function') return Math.round(performance.now()); + return Date.now(); +} + +function formatDuration(ms) { + const value = Number(ms); + if (!Number.isFinite(value) || value < 0) return ''; + if (value < 1000) return `${Math.max(1, Math.round(value))}ms`; + if (value < 60000) return `${(value / 1000).toFixed(value < 10000 ? 1 : 0)}s`; + const minutes = Math.floor(value / 60000); + const seconds = Math.round((value % 60000) / 1000); + return `${minutes}m ${seconds}s`; +} + +function formatTaskElapsed(ms, ended) { + const totalSeconds = Math.max(0, Math.floor(Number(ms) / 1000)); + const hours = Math.floor(totalSeconds / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + const parts = []; + if (hours) parts.push(`${hours}h`); + if (hours || minutes) parts.push(`${minutes}min`); + parts.push(`${seconds}s`); + const text = `已运行 ${parts.join(' ')}`; + return ended ? `${text}. 已完成!` : text; +} + +function getSessionRuntime(sess) { + if (!sess) return null; + const sessionId = sess.id; + let runtime = state.runtimeBySessionId.get(sessionId); + if (!runtime) { + runtime = { + busy: false, + currentTurnEl: null, + lastMessageType: null, + taskStartedAt: 0, + taskTimerId: null, + assistantDraft: null, + + }; + state.runtimeBySessionId.set(sessionId, runtime); + } + return runtime; +} + +function getActiveSessionRuntime() { + const sess = state.sessions.get(state.activeId); + return sess ? getSessionRuntime(sess) : null; +} + +function findSessionByBridgeId(bridgeSessionId) { + if (!bridgeSessionId) return state.sessions.get(state.activeId) || null; + for (const sess of state.sessions.values()) { + if (sess.bridgeSessionId === bridgeSessionId || sess.id === bridgeSessionId) return sess; + } + return null; +} + +function isActiveSession(sess) { + return !!sess && sess.id === state.activeId; +} + +function withSessionDom(sess, fn) { + if (isActiveSession(sess)) return fn(); + return null; +} + +function updateTaskRuntimeBadges(now = getNowMs()) { + const badges = document.querySelectorAll('.task-elapsed[data-started-at]'); + badges.forEach((badge) => { + const startedAt = Number(badge.dataset.startedAt || 0); + if (startedAt) badge.textContent = formatTaskElapsed(now - startedAt); + }); +} + +function clearTaskTimer(sess) { + const runtime = sess ? getSessionRuntime(sess) : getActiveSessionRuntime(); + if (runtime?.taskTimerId) { + clearInterval(runtime.taskTimerId); + runtime.taskTimerId = null; + } +} + +function startTaskTimer(sess, startedAt = getNowMs()) { + const runtime = getSessionRuntime(sess); + clearTaskTimer(sess); + runtime.taskStartedAt = Number(startedAt) || getNowMs(); + if (isActiveSession(sess)) updateTaskRuntimeBadges(runtime.taskStartedAt); + runtime.taskTimerId = setInterval(() => { + if (isActiveSession(sess)) updateTaskRuntimeBadges(); + }, 1000); +} + +function stopTaskTimer(sess) { + if (isActiveSession(sess)) updateTaskRuntimeBadges(); + const runtime = getSessionRuntime(sess); + clearTaskTimer(sess); + runtime.taskStartedAt = 0; +} + +function taskElapsedBadge(startedAt, endedAt) { + const start = Number(startedAt || 0); + if (!start) return ''; + const end = Number(endedAt || 0); + const now = end || getNowMs(); + const ended = !!end; + const liveAttr = ended ? 'data-ended="1"' : `data-started-at="${escapeHtml(String(start))}"`; + return `${escapeHtml(formatTaskElapsed(now - start, ended))}`; +} + +function ensureAssistantTaskElapsed(wrap, startedAt, endedAt) { + if (!wrap) return null; + const html = taskElapsedBadge(startedAt, endedAt); + let badge = wrap.querySelector(':scope > .task-elapsed'); + if (!html) { + badge?.remove(); + return null; + } + if (!badge) { + wrap.insertAdjacentHTML('afterbegin', html); + badge = wrap.querySelector(':scope > .task-elapsed'); + } else { + const holder = document.createElement('div'); + holder.innerHTML = html; + badge.replaceWith(holder.firstElementChild); + badge = wrap.querySelector(':scope > .task-elapsed'); + } + return badge; +} + +function turnLabelForSegment(seg, index) { + const summary = summarizeStructuredBlock(seg.kind, seg.text); + if (seg.kind === 'LLM_RUNNING') return summary || `Turn ${index + 1}`; + if (seg.kind === 'TOOL_CALL') return '工具调用'; + if (seg.kind === 'TOOL_RESULT') return '工具结果'; + return summary || seg.kind || `Turn ${index + 1}`; +} + +function nextTurnIndexForWrap(wrap) { + const current = Number(wrap?.dataset?.turnIndex || 0) || 0; + const next = current + 1; + if (wrap) wrap.dataset.turnIndex = String(next); + return next; +} + +function turnHeaderLabel(index, label) { + return `Turn ${index} : ${label || 'response'}`; +} + +function groupIntoTurns(segments, options = {}) { + let foldIndex = 0; + return (segments || []).map((seg) => { + if (!shouldFoldSegment(seg.kind, seg.text)) return { type: 'plain', segment: seg }; + const index = ++foldIndex; + return { + type: 'turn', + index, + label: turnLabelForSegment(seg, index - 1), + segment: seg + }; + }); +} + +function extractTagBody(text, tag) { + const escapedTag = String(tag || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const pattern = '<' + escapedTag + '\\b[^>]*>([\\s\\S]*?)<\\/' + escapedTag + '>'; + const m = String(text || '').match(new RegExp(pattern, 'i')); + return m ? m[1].trim() : ''; +} + +function parseToolDetails(kind, text) { + const raw = String(text || ''); + if (kind === 'TOOL_CALL') { + const invoke = raw.match(/]*\bname=["']([^"']+)["'][^>]*>/i); + const tool = invoke ? invoke[1] : ''; + const params = extractTagBody(raw, 'parameter') || extractTagBody(raw, 'arguments') || extractTagBody(raw, 'args'); + const jsonish = params || (raw.match(/]*>[\s\S]*?<\/invoke>/i)?.[0] || '').replace(/<\/?invoke[^>]*>/gi, '').trim(); + if (tool || jsonish) return { title: tool ? `Tool: ${tool}` : 'Tool call', tool, args: jsonish }; + } + if (kind === 'TOOL_RESULT') { + const result = extractTagBody(raw, 'result') || raw.replace(/<\/?function_results[^>]*>/gi, '').trim(); + if (result) return { title: 'Tool result', tool: 'result', args: result }; + } + return null; +} + +function renderToolDetailInto(container, seg) { + const detail = parseToolDetails(seg.kind, seg.text); + if (!detail) return; + const detailTurn = document.createElement('div'); + detailTurn.className = 'turn tool-detail-turn'; + const header = document.createElement('button'); + header.type = 'button'; + header.className = 'turn-header tool-detail-header'; + header.innerHTML = `▼${escapeHtml(detail.title)}args`; + header.addEventListener('click', () => detailTurn.classList.toggle('collapsed')); + const body = document.createElement('div'); + body.className = 'turn-body md tool-detail-body'; + const codeText = `Tool: ${detail.tool || detail.title.replace(/^Tool:\s*/, '') || 'tool'}\nargs:\n${detail.args || ''}`; + body.innerHTML = `
${escapeHtml(codeText)}
`; + detailTurn.appendChild(header); + detailTurn.appendChild(body); + container.appendChild(detailTurn); +} + +function renderTurnTreeInto(container, turn) { + const seg = turn.segment; + const node = document.createElement('div'); + node.className = 'turn collapsed structured-turn turn-group'; + node.dataset.kind = seg.kind; + node.dataset.buf = seg.text; + const header = document.createElement('button'); + header.type = 'button'; + header.className = 'turn-header'; + header.innerHTML = `▼${escapeHtml(turnHeaderLabel(turn.index, `已处理. ${turn.label}`))}`; + header.addEventListener('click', () => node.classList.toggle('collapsed')); + const body = document.createElement('div'); + body.className = 'turn-body md'; + const hasToolDetail = Boolean(parseToolDetails(seg.kind, seg.text)); + renderToolDetailInto(body, seg); + if (!hasToolDetail) { + const rendered = document.createElement('div'); + rendered.className = 'turn-rendered-md'; + rendered.innerHTML = renderMarkdown(seg.text); + body.appendChild(rendered); + } + node.appendChild(header); + node.appendChild(body); + container.appendChild(node); +} + +/** + * Extract ... from text, render it as a faded italic hint, + * and return the remaining text. If no summary tag found, returns text unchanged. + */ +/** + * Strip leading and tags from text. + * Returns { summary, think, remaining } where summary/think are the extracted + * content strings (or null), and remaining is the text to render as markdown. + */ +function stripLeadingMetaTags(text) { + let remaining = text; + let summary = null; + let think = null; + // Strip ... at start + const sumRe = /^([\s\S]*?)<\/summary>\s*/i; + const sumM = remaining.match(sumRe); + if (sumM) { + summary = sumM[1].trim(); + remaining = remaining.slice(sumM[0].length); + } + // Strip ... at start (or after summary) + const thinkRe = /^([\s\S]*?)<\/think>\s*/i; + const thinkM = remaining.match(thinkRe); + if (thinkM) { + think = thinkM[1].trim(); + remaining = remaining.slice(thinkM[0].length); + } + return { summary, think, remaining }; +} + +function extractAndRenderSummary(container, text) { + const { summary, think, remaining } = stripLeadingMetaTags(text); + if (summary) { + const hint = document.createElement('div'); + hint.className = 'summary-hint'; + hint.textContent = summary; + container.appendChild(hint); + } + if (think) { + const thinkEl = document.createElement('div'); + thinkEl.className = 'think-hint'; + thinkEl.textContent = think; + container.appendChild(thinkEl); + } + return remaining; +} + +function renderStructuredMarkdownInto(container, text, options = {}) { + const segments = splitStructuredSegments(text); + container.innerHTML = ''; + if (segments.length === 1 && !shouldFoldSegment(segments[0].kind, segments[0].text)) { + const remaining = extractAndRenderSummary(container, text); + if (remaining) container.insertAdjacentHTML('beforeend', renderMarkdown(remaining)); + return; + } + for (const item of groupIntoTurns(segments, options)) { + if (item.type === 'plain') { + const plain = document.createElement('div'); + plain.className = 'md'; + const remaining = extractAndRenderSummary(plain, item.segment.text); + if (remaining) plain.insertAdjacentHTML('beforeend', renderMarkdown(remaining)); + container.appendChild(plain); + continue; + } + renderTurnTreeInto(container, item); + } +} + +// ─── Copy button injection for code blocks and pre blocks ───────────────── +function injectCopyButtons(container) { + if (!container) return; + const blocks = container.querySelectorAll('pre'); + blocks.forEach(pre => { + if (pre.querySelector('.copy-btn')) return; // already injected + pre.style.position = 'relative'; + const btn = document.createElement('button'); + btn.className = 'copy-btn'; + btn.textContent = 'Copy'; + btn.setAttribute('aria-label', 'Copy code'); + btn.addEventListener('click', () => { + const code = pre.querySelector('code') || pre; + navigator.clipboard.writeText(code.textContent).then(() => { + btn.textContent = '✓ Copied'; + btn.classList.add('copied'); + setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000); + }).catch(() => { + btn.textContent = '✗ Failed'; + setTimeout(() => { btn.textContent = 'Copy'; }, 2000); + }); + }); + pre.appendChild(btn); + }); +} + +function escapeHtml(s) { + return String(s).replace(/[&<>"']/g, c => ({ + '&':'&','<':'<','>':'>','"':'"',"'":''' + }[c])); +} + +// ─── Session management ────────────────────────────────────────────────── +function isUntitledSessionTitle(title) { + return !title || /^new\s+chat$/i.test(String(title).trim()); +} + +function createLocalSession(id, title, bridgeSessionId = id) { + const sess = { + id, bridgeSessionId, title: title || 'New chat', messages: [], cwd: null, + untitled: isUntitledSessionTitle(title), + config: { ...state.defaultConfig }, + diagnostics: [], + }; + getSessionRuntime(sess); + // Keep freshly-created chats visually quiet: the empty state is enough guidance. + state.sessions.set(id, sess); + renderSessionList(); + return sess; +} + +function setActiveSession(id) { + state.activeId = id; + const sess = state.sessions.get(id); + if (!sess) return; + sessionTitleEl.textContent = sess.title; + renderMessages(); + renderSessionList(); + renderDiagnostics(); + const runtime = getSessionRuntime(sess); + setBusy(runtime.busy, runtime.busy ? 'Agent is responding…' : null, sess); +} + +function renderSessionList() { + // Preserve the + button (must remain in DOM as anchor for insertBefore) + const newBtn = document.getElementById('new-session-btn'); + // Remove only existing tab elements, never the + button + sessionListEl.querySelectorAll('.session-tab').forEach((el) => el.remove()); + if (state.sessions.size === 0) return; + for (const sess of state.sessions.values()) { + const item = document.createElement('button'); + item.type = 'button'; + item.className = 'session-tab' + (sess.id === state.activeId ? ' active' : ''); + item.setAttribute('role', 'tab'); + item.setAttribute('aria-selected', sess.id === state.activeId ? 'true' : 'false'); + item.setAttribute('data-session-id', sess.id); + item.title = sess.title; + // ─── Drag-and-drop reorder ─── + item.draggable = true; + item.addEventListener('dragstart', (e) => { + e.dataTransfer.setData('text/plain', sess.id); + e.dataTransfer.effectAllowed = 'move'; + item.classList.add('dragging'); + }); + item.addEventListener('dragend', () => { + item.classList.remove('dragging'); + sessionListEl.querySelectorAll('.session-tab.drag-over').forEach(el => el.classList.remove('drag-over')); + }); + item.addEventListener('dragover', (e) => { + e.preventDefault(); + e.dataTransfer.dropEffect = 'move'; + item.classList.add('drag-over'); + }); + item.addEventListener('dragleave', () => { + item.classList.remove('drag-over'); + }); + item.addEventListener('drop', (e) => { + e.preventDefault(); + item.classList.remove('drag-over'); + const draggedId = e.dataTransfer.getData('text/plain'); + if (draggedId && draggedId !== sess.id) { + reorderSession(draggedId, sess.id); + } + }); + // Per-tab status dot + const dot = document.createElement('span'); + dot.className = 'tab-dot'; + const runtime = getSessionRuntime(sess); + if (runtime && runtime.busy) dot.classList.add('busy'); + item.appendChild(dot); + // Tab label + const label = document.createElement('span'); + label.className = 'tab-label'; + label.textContent = sess.title; + item.appendChild(label); + // Close button (Chrome-style ×) + const closeBtn = document.createElement('span'); + closeBtn.className = 'tab-close'; + closeBtn.setAttribute('role', 'button'); + closeBtn.setAttribute('aria-label', 'Close tab'); + closeBtn.textContent = '×'; + closeBtn.addEventListener('click', (e) => { + e.stopPropagation(); + closeSession(sess.id); + }); + item.appendChild(closeBtn); + item.addEventListener('click', () => setActiveSession(sess.id)); + sessionListEl.insertBefore(item, newBtn); + } +} + +// ─── Tab drag reorder helper ───────────────────────────────────────────────── +function reorderSession(draggedId, targetId) { + const entries = [...state.sessions.entries()]; + const fromIdx = entries.findIndex(([id]) => id === draggedId); + const toIdx = entries.findIndex(([id]) => id === targetId); + if (fromIdx === -1 || toIdx === -1 || fromIdx === toIdx) return; + const [moved] = entries.splice(fromIdx, 1); + entries.splice(toIdx, 0, moved); + state.sessions = new Map(entries); + renderSessionList(); +} + +function closeSession(id) { + if (state.sessions.size <= 1) return; // Don't close the last tab + // Notify bridge to delete this session + const sess = state.sessions.get(id); + if (sess && sess.bridgeSessionId) { + const bridgeUrl = window.ga.bridgeUrl || 'http://127.0.0.1:14168'; + fetch(`${bridgeUrl}/session/${sess.bridgeSessionId}`, { method: 'DELETE' }).catch(() => {}); + } + const keys = [...state.sessions.keys()]; + const idx = keys.indexOf(id); + state.sessions.delete(id); + state.runtimeBySessionId.delete(id); + if (state.activeId === id) { + // Switch to adjacent tab (prefer right, fallback left) + const newIdx = Math.min(idx, keys.length - 2); + const remaining = [...state.sessions.keys()]; + setActiveSession(remaining[Math.max(0, Math.min(newIdx, remaining.length - 1))]); + } else { + renderSessionList(); + } +} + +async function newSession() { + if (!state.bridgeReady) { + showError('Bridge is not ready yet. Please wait a moment.'); + return; + } + const previousSess = state.sessions.get(state.activeId) || null; + // Don't mark previousSess as busy - it's not doing anything + // Just show status text without changing any tab dot + const statusEl = $('status'); + if (statusEl) statusEl.textContent = 'Creating session…'; + let createdSess = null; + try { + const cwd = await getCwd(); + const res = await window.ga.rpc('session/new', { cwd, mcp_servers: [] }); + if (res.error) throw new Error(typeof res.error === 'string' ? res.error : (res.error.message || JSON.stringify(res.error))); + const bridgeSessionId = res.sessionId; + const localSessionId = `local-${Date.now()}-${Math.random().toString(16).slice(2)}`; + createdSess = createLocalSession(localSessionId, 'New chat', bridgeSessionId); + createdSess.cwd = cwd; + setActiveSession(localSessionId); + } catch (e) { + showError('Failed to create session: ' + e.message); + } finally { + setBusy(false, null, createdSess || previousSess); + } +} + +async function getCwd() { + // Use GA root as default cwd + const status = await window.ga.checkStatus(); + return status.gaRoot; +} + +// ─── Messages rendering ────────────────────────────────────────────────── +function renderMessages() { + const sess = state.sessions.get(state.activeId); + messagesEl.innerHTML = ''; + const runtime = sess ? getSessionRuntime(sess) : null; + if (runtime) { + runtime.currentTurnEl = null; + runtime.lastMessageType = null; + } + + const hasSavedMessages = !!sess && sess.messages.length > 0; + const hasDraft = !!runtime?.assistantDraft && !runtime.assistantDraft.finalized; + if (!sess || (!hasSavedMessages && !hasDraft)) { + messagesEl.classList.add('empty'); + messagesEl.innerHTML = ` +
+
New task
+
Task me anything. Type /help for commands.
+
`; + return; + } + messagesEl.classList.remove('empty'); + for (const m of sess.messages) renderMessage(m, false); + if (hasDraft) renderAssistantDraft(sess, runtime.assistantDraft); + scrollToBottom(); +} + +function prepareMessagesForContent() { + if (messagesEl.classList.contains('empty')) messagesEl.innerHTML = ''; + messagesEl.classList.remove('empty'); +} + +function renderMessage(msg, append = true) { + prepareMessagesForContent(); + + if (msg.role === 'user') { + const wrap = document.createElement('div'); + wrap.className = 'msg msg-user'; + let imagesHtml = ''; + const ids = msg.image_ids || []; + if (ids.length > 0) { + imagesHtml = '
' + ids.map(id => { + const dataUrl = sessionStorage.getItem('img:' + id); + if (dataUrl) { + return ``; + } + return `🖼`; + }).join('') + '
'; + } + wrap.innerHTML = `
${imagesHtml}${escapeHtml(msg.content)}
`; + messagesEl.appendChild(wrap); + const sess = state.sessions.get(state.activeId); + const runtime = sess ? getSessionRuntime(sess) : null; + if (runtime) { + runtime.currentTurnEl = null; // reset turn grouping on user message + runtime.lastMessageType = 'user'; + } + } else if (msg.role === 'system') { + const wrap = document.createElement('div'); + wrap.className = 'msg msg-system'; + wrap.textContent = msg.content; + messagesEl.appendChild(wrap); + } else if (msg.role === 'error') { + const wrap = document.createElement('div'); + wrap.className = 'msg msg-error'; + wrap.textContent = msg.content; + messagesEl.appendChild(wrap); + const sess = state.sessions.get(state.activeId); + const runtime = sess ? getSessionRuntime(sess) : null; + if (runtime) runtime.currentTurnEl = null; + } else if (msg.role === 'assistant') { + // Final full message (when reloading from state) + const wrap = document.createElement('div'); + wrap.className = 'msg msg-assistant'; + if (msg.segments) { + ensureAssistantTaskElapsed(wrap, msg.taskStartedAt, msg.taskEndedAt); + for (const seg of msg.segments) { + wrap.appendChild(buildTurn(seg.kind, seg.text, seg.collapsed, nextTurnIndexForWrap(wrap))); + } + } else { + const body = document.createElement('div'); + body.className = 'assistant-response md'; + ensureAssistantTaskElapsed(wrap, msg.taskStartedAt, msg.taskEndedAt); + const cleanContent = (msg.content || '').replace(/\n*`{5}\n*\[Info\] Final response to user\.\n*`{5}\s*$/, ''); + renderStructuredMarkdownInto(body, cleanContent); + injectCopyButtons(body); + wrap.appendChild(body); + } + injectCopyButtons(wrap); + messagesEl.appendChild(wrap); + } + if (append) scrollToBottom(); +} + +function buildTurn(kind, text, collapsed, index) { + const turn = document.createElement('div'); + turn.className = 'turn' + (collapsed ? ' collapsed' : ''); + turn.dataset.kind = kind; + const turnIndex = Number(index || 0); + const label = turnIndex ? turnHeaderLabel(turnIndex, kind) : kind; + const summary = summarizeStructuredBlock(kind, text); + const header = document.createElement('div'); + header.className = 'turn-header'; + header.innerHTML = `▼${escapeHtml(label)}${escapeHtml(summary)}`; + header.addEventListener('click', () => turn.classList.toggle('collapsed')); + const body = document.createElement('div'); + body.className = 'turn-body md'; + const hasToolDetail = Boolean(parseToolDetails(kind, text)); + renderToolDetailInto(body, { kind, text }); + if (!hasToolDetail) { + const rendered = document.createElement('div'); + rendered.className = 'turn-rendered-md'; + rendered.innerHTML = renderMarkdown(text); + body.appendChild(rendered); + } + turn.appendChild(header); + turn.appendChild(body); + injectCopyButtons(body); + return turn; +} + +function scrollToBottom(smooth = true) { + messagesEl.scrollTo({ top: messagesEl.scrollHeight, behavior: smooth ? 'smooth' : 'auto' }); +} + +// ─── Streaming chunks (from ACP bridge notifications) ──────────────────── +// ACP sends method='session/update' with params.update.sessionUpdate= +// agent_message_chunk | agent_thought_chunk | tool_call | tool_call_update | plan | available_commands_update +function handleNotification(msg) { + if (msg.method !== 'session/update') return; + const update = msg.params?.update; + if (!update) return; + const kind = update.sessionUpdate; + const bridgeSessionId = msg.params?.sessionId || update.sessionId || update.session?.id; + const sess = findSessionByBridgeId(bridgeSessionId); + if (!sess) return; + + + if (kind === 'agent_message_chunk') { + const text = extractText(update.content); + appendAssistantChunk(sess, text); + } else if (kind === 'task_started') { + hideError(); + startTaskTimer(sess); + setBusy(true, 'Thinking…', sess); + } else if (kind === 'task_completed' || kind === 'cancelled') { + finalizeAssistantReply(sess); + setBusy(false, null, sess); + hideError(); + } else if (kind === 'error') { + finalizeAssistantReply(sess); + setBusy(false, null, sess); + const errText = update.message || update.error || 'Bridge error'; + sess.messages.push({ role: 'error', content: errText }); + if (isActiveSession(sess)) renderMessage({ role: 'error', content: errText }); + showError(errText); + } else if (kind === 'agent_thought_chunk') { + const text = extractText(update.content); + appendStreamChunk(sess, kind, text); + } else if (kind === 'tool_call') { + const toolName = update.title || update.name || update.kind || update.toolCallId || 'tool'; + const args = update.arguments || update.args || update.input || update.content || ''; + const argText = typeof args === 'string' ? args : JSON.stringify(args, null, 2); + const text = ` + +${escapeHtml(argText)} + +`; + appendTurn(sess, 'TOOL_CALL', text, true); + } else if (kind === 'tool_call_update') { + // Status updates, keep simple + if (update.status && update.status !== 'in_progress') { + appendTurn(sess, 'tool', `[${update.status}] ${update.toolCallId || ''}`, true); + } + } else if (kind === 'plan') { + const lines = (update.entries || []).map(e => + `- [${e.status || 'pending'}] ${e.content || ''}` + ).join('\n'); + appendTurn(sess, 'plan', lines, false); + } +} + +function extractText(content) { + if (!content) return ''; + if (typeof content === 'string') return content; + if (content.type === 'text') return content.text || ''; + if (Array.isArray(content)) return content.map(extractText).join(''); + return ''; +} + +function getLiveAssistantWrap(sess) { + if (!isActiveSession(sess)) return null; + const last = messagesEl.lastElementChild; + if (last?.classList?.contains('msg-assistant') && last.dataset.finalized !== '1') return last; + const wrap = document.createElement('div'); + wrap.className = 'msg msg-assistant'; + const runtime = getSessionRuntime(sess); + if (runtime.taskStartedAt) { + wrap.dataset.taskStartedAt = String(runtime.taskStartedAt); + ensureAssistantTaskElapsed(wrap, runtime.taskStartedAt); + } + messagesEl.appendChild(wrap); + return wrap; +} + +function getAssistantDraft(sess) { + const runtime = getSessionRuntime(sess); + if (!runtime.assistantDraft || runtime.assistantDraft.finalized) { + runtime.assistantDraft = { + text: '', + segments: [], + currentSegmentIndex: -1, + taskStartedAt: runtime.taskStartedAt || 0, + taskEndedAt: 0, + finalized: false, + bridgeMessageId: 0 + }; + } + if (!runtime.assistantDraft.taskStartedAt && runtime.taskStartedAt) runtime.assistantDraft.taskStartedAt = runtime.taskStartedAt; + return runtime.assistantDraft; +} + +function renderAssistantDraft(sess, draft) { + if (!isActiveSession(sess) || !draft || draft.finalized) return null; + prepareMessagesForContent(); + const wrap = document.createElement('div'); + wrap.className = 'msg msg-assistant'; + if (draft.taskStartedAt) { + wrap.dataset.taskStartedAt = String(draft.taskStartedAt); + ensureAssistantTaskElapsed(wrap, draft.taskStartedAt, draft.taskEndedAt); + } + if (draft.text) { + wrap.dataset.buf = draft.text; + const body = document.createElement('div'); + body.className = 'assistant-response md'; + renderStructuredMarkdownInto(body, draft.text); + injectCopyButtons(body); + if (!draft.finalized) body.insertAdjacentHTML('beforeend', ''); + wrap.appendChild(body); + } + for (const seg of draft.segments || []) { + wrap.appendChild(buildTurn(seg.kind, seg.text, seg.collapsed, nextTurnIndexForWrap(wrap))); + } + injectCopyButtons(wrap); + messagesEl.appendChild(wrap); + return wrap; +} + +function renderAssistantDraftInPlace(sess, draft) { + if (!isActiveSession(sess) || !draft || draft.finalized) return null; + prepareMessagesForContent(); + const runtime = getSessionRuntime(sess); + const wrap = getLiveAssistantWrap(sess); + if (draft.taskStartedAt || runtime.taskStartedAt) { + const startedAt = draft.taskStartedAt || runtime.taskStartedAt; + wrap.dataset.taskStartedAt = String(startedAt); + ensureAssistantTaskElapsed(wrap, startedAt, draft.taskEndedAt); + } + wrap.dataset.buf = draft.text || ''; + let body = wrap.querySelector('.assistant-response'); + if (!body) { + body = document.createElement('div'); + body.className = 'assistant-response md'; + // Keep plain assistant text before folded/tool turns. + const firstTurn = wrap.querySelector('.turn'); + if (firstTurn) wrap.insertBefore(body, firstTurn); + else wrap.appendChild(body); + } + renderStructuredMarkdownInto(body, draft.text || ''); + injectCopyButtons(body); + body.insertAdjacentHTML('beforeend', ''); + scrollToBottom(false); + return wrap; +} + +function appendAssistantChunk(sess, text) { + if (!text) return; + const runtime = getSessionRuntime(sess); + const draft = getAssistantDraft(sess); + draft.text += text; + draft.currentSegmentIndex = -1; + runtime.currentTurnEl = null; + if (!isActiveSession(sess)) return; + prepareMessagesForContent(); + let wrap = getLiveAssistantWrap(sess); + let body = wrap.querySelector('.assistant-response'); + if (!body) { + body = document.createElement('div'); + body.className = 'assistant-response md'; + wrap.appendChild(body); + } + wrap.dataset.buf = draft.text; + ensureAssistantTaskElapsed(wrap, draft.taskStartedAt || runtime.taskStartedAt); + renderStructuredMarkdownInto(body, draft.text); + body.insertAdjacentHTML('beforeend', ''); + scrollToBottom(false); +} + +function appendStreamChunk(sess, kind, text) { + if (!text) return; + // Group consecutive chunks of same kind into one turn (fold_turns style) + const runtime = getSessionRuntime(sess); + const draft = getAssistantDraft(sess); + let seg = draft.segments[draft.currentSegmentIndex]; + if (!seg || seg.kind !== kind) { + seg = { kind, text: '', collapsed: false }; + draft.segments.push(seg); + draft.currentSegmentIndex = draft.segments.length - 1; + runtime.currentTurnEl = null; + } + seg.text += text; + if (!isActiveSession(sess)) return; + let turn = runtime.currentTurnEl; + const currentKind = turn?.dataset.kind; + if (!turn || currentKind !== kind) { + turn = createStreamingTurn(sess, kind); + runtime.currentTurnEl = turn; + } + turn.dataset.buf = seg.text; + const body = turn.querySelector('.turn-body'); + const { summary, remaining: cleanText } = stripLeadingMetaTags(seg.text); + // Update the header turn-summary span (visible when collapsed) + const summarySpan = turn.querySelector('.turn-summary'); + if (summarySpan && summary) { + summarySpan.textContent = summary; + } + // Only render the clean body text (no summary-hint in body) + body.innerHTML = renderMarkdown(cleanText) + ''; + scrollToBottom(false); +} + +function appendTurn(sess, kind, text, collapsed) { + const draft = getAssistantDraft(sess); + draft.segments.push({ kind, text, collapsed: !!collapsed }); + draft.currentSegmentIndex = -1; + if (!isActiveSession(sess)) return; + prepareMessagesForContent(); + const wrap = getLiveAssistantWrap(sess); + wrap.appendChild(buildTurn(kind, text, collapsed, nextTurnIndexForWrap(wrap))); + scrollToBottom(false); +} + +function createStreamingTurn(sess, kind) { + prepareMessagesForContent(); + const wrap = getLiveAssistantWrap(sess); + const turn = document.createElement('div'); + turn.className = 'turn'; + turn.dataset.kind = kind; + const displayKind = kind === 'agent_thought_chunk' ? 'thinking' : 'response'; + const turnIndex = nextTurnIndexForWrap(wrap); + turn.innerHTML = ` +
▼${escapeHtml(turnHeaderLabel(turnIndex, displayKind))}
+
`; + turn.querySelector('.turn-header').addEventListener('click', () => turn.classList.toggle('collapsed')); + // thinking turns collapsed by default once complete + if (kind === 'agent_thought_chunk') turn.dataset.autoCollapse = '1'; + wrap.appendChild(turn); + return turn; +} + +function getCurrentAssistantWrap(sess) { + if (!isActiveSession(sess)) return null; + const last = messagesEl.lastElementChild; + if (last?.classList?.contains('msg-assistant') && last.dataset.finalized !== '1') return last; + return null; +} + +function finalizeStreamingTurn(sess) { + const runtime = getSessionRuntime(sess); + const wrap = getCurrentAssistantWrap(sess); + const liveAssistant = wrap?.querySelector('.assistant-response'); + if (liveAssistant) { + renderStructuredMarkdownInto(liveAssistant, wrap.dataset.buf || ''); + injectCopyButtons(liveAssistant); + } + if (runtime.assistantDraft?.segments?.length) { + for (const seg of runtime.assistantDraft.segments) { + if (seg.kind === 'agent_thought_chunk') seg.collapsed = true; + } + } + if (!runtime.currentTurnEl) return; + const t = runtime.currentTurnEl; + const body = t.querySelector('.turn-body'); + // Remove cursor, strip summary/think tags; set turn-summary in header + if (body) { + const { summary: extractedSummary, remaining: cleanBuf } = stripLeadingMetaTags(t.dataset.buf || ''); + body.innerHTML = renderMarkdown(cleanBuf); + // Set the turn-summary span in the header for collapsed display + const summaryEl = t.querySelector('.turn-summary'); + if (summaryEl) { + const kind = t.dataset.kind || 'response'; + summaryEl.textContent = extractedSummary || summarizeStructuredBlock(kind, cleanBuf); + } + } + if (t.dataset.autoCollapse === '1') t.classList.add('collapsed'); + const idx = runtime.assistantDraft?.currentSegmentIndex; + if (Number.isInteger(idx) && runtime.assistantDraft?.segments?.[idx]) { + runtime.assistantDraft.segments[idx].collapsed = t.classList.contains('collapsed'); + } + runtime.currentTurnEl = null; +} + +function finalizeAssistantReply(sess) { + const endedAt = getNowMs(); + finalizeStreamingTurn(sess); + // Remove any residual blinking cursors (e.g. after RPC timeout) + messagesEl.querySelectorAll('.cursor').forEach(el => el.remove()); + const runtime = getSessionRuntime(sess); + const draft = runtime.assistantDraft; + const wrap = getCurrentAssistantWrap(sess); + if (draft && sess && !draft.finalized) { + draft.finalized = true; + draft.taskEndedAt = endedAt; + // Strip trailing [Info] Final response to user. marker (wrapped in 5 backticks) + if (draft.text) { + draft.text = draft.text.replace(/\n*`{5}\n*\[Info\] Final response to user\.\n*`{5}\s*$/, ''); + } + if (draft.segments?.length) { + const last = draft.segments[draft.segments.length - 1]; + if (last && last.text) { + last.text = last.text.replace(/\n*`{5}\n*\[Info\] Final response to user\.\n*`{5}\s*$/, ''); + } + } + const msg = { role: 'assistant', finalized: true, taskEndedAt: endedAt }; + if (draft.bridgeMessageId) msg.id = Number(draft.bridgeMessageId); + if (draft.taskStartedAt) msg.taskStartedAt = Number(draft.taskStartedAt); + if (draft.text) msg.content = draft.text; + if (draft.segments?.length) msg.segments = draft.segments.map((seg) => ({ + kind: seg.kind, + text: seg.text || '', + collapsed: !!seg.collapsed + })); + if (msg.content || msg.segments?.length) sess.messages.push(msg); + runtime.assistantDraft = null; + } + if (wrap) { + wrap.dataset.finalized = '1'; + wrap.dataset.taskEndedAt = String(endedAt); + ensureAssistantTaskElapsed(wrap, wrap.dataset.taskStartedAt || runtime.taskStartedAt || draft?.taskStartedAt, endedAt); + renderMessages(); + } + stopTaskTimer(sess); +} + +// ─── Sending prompts ───────────────────────────────────────────────────── +function normalizeBridgeMessage(msg) { + return { + id: Number(msg.id || 0), + role: msg.role || 'system', + content: msg.content || '', + image_ids: msg.image_ids || [] + }; +} + +function upsertPolledMessage(sess, raw, { partial = false } = {}) { + if (!sess || !raw) return; + const msg = normalizeBridgeMessage(raw); + if (!msg.id) return; + const runtime = getSessionRuntime(sess); + if (!runtime.seenBridgeMessageIds) runtime.seenBridgeMessageIds = new Set(); + + if (partial && msg.role === 'assistant') { + const draft = getAssistantDraft(sess); + const changed = draft.bridgeMessageId !== msg.id || draft.text !== (msg.content || ''); + draft.bridgeMessageId = msg.id; + draft.text = msg.content || ''; + draft.currentSegmentIndex = -1; + draft.finalized = false; + // Polling partial updates used to call renderMessages(), which rebuilt the + // whole message list every 500ms. That destroys user fold/collapse DOM + // state and can make the live answer appear to jump/duplicate. Update only + // the live assistant draft in-place; final messages are still reconciled by + // id in the non-partial branch below. + if (changed && isActiveSession(sess)) renderAssistantDraftInPlace(sess, draft); + return; + } + + if (runtime.seenBridgeMessageIds.has(msg.id)) return; + runtime.seenBridgeMessageIds.add(msg.id); + runtime.lastPolledMessageId = Math.max(Number(runtime.lastPolledMessageId || 0), msg.id); + + const draft = runtime.assistantDraft; + if (msg.role === 'assistant' && draft && !draft.finalized && Number(draft.bridgeMessageId || 0) === msg.id) { + draft.text = msg.content || draft.text || ''; + finalizeAssistantReply(sess); + return; + } + sess.messages.push(msg); + if (isActiveSession(sess)) renderMessage(msg); +} + +async function pollSessionMessages(sess) { + if (!sess) return; + const runtime = getSessionRuntime(sess); + if (runtime.polling) return; + runtime.polling = true; + try { + while (runtime.busy || runtime.forcePollOnce) { + runtime.forcePollOnce = false; + const res = await window.ga.pollSession(sess.bridgeSessionId || sess.id, runtime.lastPolledMessageId || 0); + if (res?.error) throw new Error(res.error.message || res.error); + const result = res.result || res; + for (const msg of (result.messages || [])) upsertPolledMessage(sess, msg, { partial: false }); + if (result.partial) upsertPolledMessage(sess, result.partial, { partial: true }); + const busy = result.status === 'running' || !!result.partial; + setBusy(busy, busy ? 'Thinking…' : null, sess); + if (!busy) { + finalizeAssistantReply(sess); + break; + } + await new Promise(resolve => setTimeout(resolve, 500)); + } + } catch (e) { + addDiagnostic('error', 'Polling failed', e); + showError('Polling failed: ' + (e.message || e)); + setBusy(false, null, sess); + } finally { + runtime.polling = false; + } +} + +async function sendPrompt(text, images = []) { + if (!state.bridgeReady) { + showError('Bridge is not ready.'); + return; + } + if (!state.activeId) { + await newSession(); + if (!state.activeId) return; + } + const sess = state.sessions.get(state.activeId); + const runtime = getSessionRuntime(sess); + if (runtime.busy) return; + + // Store images in sessionStorage and collect ids + const imageIds = images.map(img => { + try { sessionStorage.setItem('img:' + img.id, img.dataUrl); } catch(e) { /* quota */ } + return img.id; + }); + + const localUserMsg = { role: 'user', content: text, image_ids: imageIds }; + sess.messages.push(localUserMsg); + renderMessage(localUserMsg); + startTaskTimer(sess); + if (sess.untitled || isUntitledSessionTitle(sess.title)) { + sess.title = text.trim().slice(0, 40) + (text.trim().length > 40 ? '…' : ''); + sess.untitled = false; + sessionTitleEl.textContent = sess.title; + renderSessionList(); + } + + setBusy(true, 'Thinking…', sess); + try { + const res = await window.ga.rpc('session/prompt', { + sessionId: await ensureBridgeSession(sess), + prompt: text, + images: images.map(img => ({id: img.id, dataUrl: img.dataUrl})), + llmNo: sess.config.llmNo + }); + if (res?.error) throw new Error(res.error.message || res.error); + const acceptedUserId = Number(res.userMessageId || res.result?.userMessageId || 0); + if (acceptedUserId) { + if (!runtime.seenBridgeMessageIds) runtime.seenBridgeMessageIds = new Set(); + runtime.seenBridgeMessageIds.add(acceptedUserId); + runtime.lastPolledMessageId = Math.max(Number(runtime.lastPolledMessageId || 0), acceptedUserId); + } + runtime.forcePollOnce = true; + pollSessionMessages(sess); + } catch (e) { + sess.messages.push({ role: 'error', content: e.message || String(e) }); + if (isActiveSession(sess)) renderMessage({ role: 'error', content: e.message || String(e) }); + setBusy(false, null, sess); + } +} + +async function cancelPrompt() { + const sess = state.sessions.get(state.activeId); + const runtime = sess ? getSessionRuntime(sess) : null; + if (!runtime?.busy) return false; + try { + const res = await window.ga.rpc('session/cancel', { sessionId: sess?.bridgeSessionId || state.activeId }); + if (res.error) throw new Error(res.error.message || res.error); + return true; + } catch (e) { + showSystem('Stop failed: ' + (e.message || e)); + return false; + } +} + +// ─── Slash commands ────────────────────────────────────────────────────── +async function handleSlash(cmd) { + const [name, ...rest] = cmd.trim().slice(1).split(/\s+/); + const arg = rest.join(' '); + const sess = state.sessions.get(state.activeId); + + switch (name) { + case 'help': + showSystem([ + 'Available commands:', + ' /new New session', + ' /clear Clear current session display', + ' /stop Cancel the current request', + ' /continue List & restore past sessions', + ' /theme Switch theme (light|dark|auto)', + ].join('\n')); + break; + case 'continue': + await handleContinueCommand(arg); + break; + case 'new': + await newSession(); + break; + case 'clear': + if (sess) { sess.messages = []; renderMessages(); } + break; + case 'stop': + if (await cancelPrompt()) showSystem('Stop requested.'); + break; + case 'restart': + await restartBridge(); + break; + case 'settings': + openSettings(); + break; + case 'theme': + if (['light', 'dark', 'auto'].includes(arg)) { + const cfg = getActiveConfig(); + cfg.theme = arg; + applyTheme(); + await window.ga.saveConfig(cfg); + showSystem(`Theme → ${arg}`); + } else { + showSystem('Usage: /theme light|dark|auto'); + } + break; + case 'cwd': + if (!arg) { + const status = await window.ga.checkStatus(); + showSystem(`cwd: ${sess?.cwd || status.gaRoot}`); + } else { + showSystem(`Creating new session in ${arg}…`); + // Need a new session for different cwd + const res = await window.ga.rpc('session/new', { cwd: arg, mcp_servers: [] }); + if (res.error) showSystem('Failed: ' + (res.error.message || res.error)); + else { + const bridgeSessionId = res.sessionId; + const localSessionId = `local-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const ns = createLocalSession(localSessionId, arg.split('/').pop() || arg, bridgeSessionId); + ns.cwd = arg; + setActiveSession(localSessionId); + } + } + break; + default: + showSystem(`Unknown command: /${name}. Try /help.`); + } +} + +/** + * Filter restored history from bridge: show only the first user input, + * a summary placeholder for omitted middle turns, and the last assistant output. + * This avoids rendering hundreds of system/tool messages from the full context. + */ +function filterRestoredHistory(history) { + const SYSTEM_MARKERS = [ + '[WORKING MEMORY]', '[SYSTEM TIPS]', 'tool_result', '', + '', '', '### [WORKING MEMORY]', '[CONSTITUTION]', + '[Memory]', '[RULES]', '[FILE]', '### Action Protocol', + '', 'Current turn:', '[DANGER]' + ]; + + // Collect all real user messages and the last meaningful assistant message + const userMessages = []; + let lastAssistant = null; + + for (const entry of history) { + if (entry.role === 'user') { + const text = (entry.text || '').trim(); + if (!text || text.length <= 5) continue; + const isSystem = SYSTEM_MARKERS.some(marker => text.includes(marker)); + if (isSystem) continue; + userMessages.push(text); + } else if (entry.role === 'assistant') { + let cleaned = cleanRestoredAssistantText(entry.text || ''); + cleaned = cleaned.replace(/[\s\S]*?<\/summary>\s*/g, '').trim(); + if (cleaned) lastAssistant = cleaned; + } + } + + // Build minimal result: first user input + omission note + last assistant + const result = []; + if (userMessages.length > 0) { + result.push({ role: 'user', text: userMessages[0] }); + } + if (userMessages.length > 1) { + result.push({ role: 'system', text: `… ${userMessages.length - 1} earlier turns omitted …` }); + } + if (lastAssistant) { + result.push({ role: 'assistant', text: lastAssistant }); + } + return result; +} + +/** + * Defensive parser for restored assistant text from bridge. + * Bridge may return raw Python list repr like: + * [{'text': '...', 'type': 'text'}, {'id': '...', 'type': 'tool_use'}] + * This function extracts all 'text' fields from type='text' entries and joins them. + * Strategy: convert Python repr to valid JSON then parse, with multiple fallbacks. + */ +function cleanRestoredAssistantText(raw) { + if (!raw || typeof raw !== 'string') return raw || ''; + const trimmed = raw.trim(); + // Only process if it looks like a Python/JSON list of dicts + if (!/^\[/.test(trimmed)) return raw; + // Attempt 1: direct JSON parse (double-quoted format) + try { + const parsed = JSON.parse(trimmed); + if (Array.isArray(parsed)) { + const texts = parsed.filter(e => e && e.type === 'text' && e.text).map(e => e.text); + if (texts.length > 0) return texts.join('\n'); + } + } catch (_) { /* not JSON */ } + // Attempt 2: Python repr → JSON conversion then parse + // Convert single quotes to double quotes carefully, handling escaped quotes + if (/'type'\s*:\s*'text'/.test(trimmed) || /"type"\s*:\s*"text"/.test(trimmed)) { + try { + // Strategy: use Python-style ast.literal_eval equivalent + // Replace Python True/False/None with JSON equivalents + let jsonStr = trimmed + .replace(/\bTrue\b/g, 'true') + .replace(/\bFalse\b/g, 'false') + .replace(/\bNone\b/g, 'null'); + // Convert single-quoted strings to double-quoted + // This is a simplified approach: replace ' with " but handle escapes + jsonStr = pythonReprToJson(jsonStr); + const parsed = JSON.parse(jsonStr); + if (Array.isArray(parsed)) { + const texts = parsed.filter(e => e && e.type === 'text' && e.text).map(e => e.text); + if (texts.length > 0) return texts.join('\n'); + } + } catch (_) { /* conversion failed */ } + } + // Attempt 3: regex extraction as last resort - find 'type': 'text' entries + // and extract their 'text' value using a state-machine approach + if (/'type'\s*:\s*'text'/.test(trimmed)) { + const extracted = extractTextFromPythonRepr(trimmed); + if (extracted) return extracted; + } + return raw; +} + +/** Convert Python repr string to JSON string (best-effort) */ +function pythonReprToJson(s) { + let result = ''; + let i = 0; + while (i < s.length) { + if (s[i] === "'") { + // Find matching closing single quote, handling escapes + result += '"'; + i++; + while (i < s.length && s[i] !== "'") { + if (s[i] === '\\' && i + 1 < s.length) { + if (s[i + 1] === "'") { result += "'"; i += 2; } + else if (s[i + 1] === '"') { result += '\\"'; i += 2; } + else if (s[i + 1] === 'n') { result += '\\n'; i += 2; } + else if (s[i + 1] === 't') { result += '\\t'; i += 2; } + else if (s[i + 1] === '\\') { result += '\\\\'; i += 2; } + else { result += s[i]; i++; } + } else if (s[i] === '"') { + result += '\\"'; i++; + } else if (s[i] === '\n') { + result += '\\n'; i++; + } else if (s[i] === '\t') { + result += '\\t'; i++; + } else { + result += s[i]; i++; + } + } + result += '"'; + if (i < s.length) i++; // skip closing ' + } else { + result += s[i]; i++; + } + } + return result; +} + +/** State-machine extraction: find all dicts with 'type':'text' and get their 'text' value */ +function extractTextFromPythonRepr(s) { + const texts = []; + // Find each {'text': '...', 'type': 'text'} or {'type': 'text', 'text': '...'} + // by locating 'type': 'text' markers and then finding the associated 'text' value + const typeTextPattern = /'type'\s*:\s*'text'/g; + let match; + while ((match = typeTextPattern.exec(s)) !== null) { + // Search backwards for the opening { of this dict entry + let braceStart = s.lastIndexOf('{', match.index); + if (braceStart === -1) continue; + // Search forward for the closing } - need to handle nested braces + let depth = 0; + let braceEnd = -1; + for (let j = braceStart; j < s.length; j++) { + if (s[j] === '{') depth++; + else if (s[j] === '}') { depth--; if (depth === 0) { braceEnd = j; break; } } + else if (s[j] === "'" ) { + // Skip string content + j++; + while (j < s.length && s[j] !== "'") { + if (s[j] === '\\') j++; + j++; + } + } + } + if (braceEnd === -1) continue; + const dictStr = s.substring(braceStart, braceEnd + 1); + // Extract 'text': '...' from this dict + const textMatch = dictStr.match(/'text'\s*:\s*'/); + if (!textMatch) continue; + // Find the value - parse the string starting after 'text': ' + const valStart = textMatch.index + textMatch[0].length; + let val = ''; + let k = valStart; + while (k < dictStr.length && dictStr[k] !== "'") { + if (dictStr[k] === '\\' && k + 1 < dictStr.length) { + const next = dictStr[k + 1]; + if (next === 'n') { val += '\n'; k += 2; } + else if (next === 't') { val += '\t'; k += 2; } + else if (next === "'") { val += "'"; k += 2; } + else if (next === '\\') { val += '\\'; k += 2; } + else { val += dictStr[k]; k++; } + } else { + val += dictStr[k]; k++; + } + } + if (val) texts.push(val); + } + return texts.length > 0 ? texts.join('\n') : null; +} + +async function handleContinueCommand(arg) { + if (!arg) { + // List available sessions + const res = await window.ga.rpc('list_continuable_sessions', {}); + if (res.error) { showSystem('Error: ' + (res.error.message || res.error)); return; } + const sessions = (res.result && res.result.sessions) || []; + if (sessions.length === 0) { showSystem('No continuable sessions found.'); return; } + const lines = ['Continuable sessions (/continue N to restore):']; + sessions.forEach((s, i) => { + const preview = s.firstUser || '(empty)'; + lines.push(` ${i + 1}. [${s.mtimeStr}] (${s.nRounds} rounds) ${preview}`); + }); + // Store session list for later selection + const sess = state.sessions.get(state.activeId); + if (sess) sess._continueList = sessions; + showSystem(lines.join('\n')); + } else { + // Restore session N + const idx = parseInt(arg, 10); + const sess = state.sessions.get(state.activeId); + const list = sess && sess._continueList; + if (!list || isNaN(idx) || idx < 1 || idx > list.length) { + showSystem('Usage: /continue (list) or /continue N (restore Nth session)'); + return; + } + const chosen = list[idx - 1]; + showSystem(`Restoring session from ${chosen.mtimeStr}…`); + const res = await window.ga.rpc('restore_session', { path: chosen.path }); + if (res.error) { showSystem('Error: ' + (res.error.message || res.error)); return; } + const history = (res.result && res.result.history) || []; + if (history.length === 0) { showSystem('Session is empty.'); return; } + // Populate current tab with restored history — filter out system/tool messages + if (sess) { + sess.messages = []; + const filtered = filterRestoredHistory(history); + for (const entry of filtered) { + if (entry.role === 'user') { + sess.messages.push({ role: 'user', content: entry.text }); + } else if (entry.role === 'assistant') { + sess.messages.push({ role: 'assistant', content: entry.text }); + } else if (entry.role === 'system') { + sess.messages.push({ role: 'system', content: entry.text }); + } + } + renderMessages(); + } + showSystem(`Restored session (${sess.messages.length} visible messages from ${history.length} total).`); + } +} + +function showSystem(text) { + const msg = { role: 'system', content: text }; + const sess = state.sessions.get(state.activeId); + if (sess) sess.messages.push(msg); + renderMessage(msg); + return msg; +} + +function updateBridgeNotice(text) { + const notice = state.bridgeNoticeMessage; + state.bridgeNoticeMessage = null; + if (!notice) return; + notice.content = text; + const sess = state.sessions.get(state.activeId); + if (sess && sess.messages.includes(notice)) renderMessages(); +} + +// ─── Status / UI helpers ───────────────────────────────────────────────── +function setStatus(kind, text) { + statusBadge.className = 'badge ' + kind; + statusText.textContent = text; + // Update per-tab dot for active session + updateTabDot(state.activeId, kind); +} + +function updateTabDot(sessionId, kind) { + if (!sessionId) return; + const tab = sessionListEl.querySelector(`[data-session-id="${sessionId}"]`); + if (!tab) return; + const dot = tab.querySelector('.tab-dot'); + if (!dot) return; + dot.className = 'tab-dot'; + if (kind === 'busy') dot.classList.add('busy'); + else if (kind === 'warn') dot.classList.add('warn'); + else if (kind === 'err') dot.classList.add('err'); + // 'ok' = default green (no extra class needed) +} + +const SEND_ICON = ``; +const STOP_ICON = ``; + +function setBusy(busy, label, sess = state.sessions.get(state.activeId)) { + const runtime = sess ? getSessionRuntime(sess) : null; + if (runtime) runtime.busy = busy; + // Always update per-tab dot for this session + if (sess) { + const dotKind = busy ? 'busy' : (state.bridgeReady ? 'ok' : 'warn'); + updateTabDot(sess.id, dotKind); + } + if (!isActiveSession(sess)) return; + if (busy) setStatus('busy', label || 'Working…'); + else setStatus(state.bridgeReady ? 'ok' : 'warn', state.bridgeReady ? 'Ready' : 'Starting…'); + renderSendButtonState(); +} + +function renderSendButtonState() { + const hasText = inputEl.value.trim().length > 0; + const busy = !!getActiveSessionRuntime()?.busy; + sendBtn.classList.toggle('stop', busy); + sendBtn.title = busy ? 'Stop (Esc)' : 'Send (Enter)'; + sendBtn.innerHTML = busy ? STOP_ICON : SEND_ICON; + sendBtn.disabled = !hasText && !busy; +} + +function updateSendButton() { + renderSendButtonState(); +} + +function showError(text, actionLabel, actionFn, options = {}) { + if (!options.skipDiagnostic) addDiagnostic('error', text); + $('error-text').textContent = text; + const actionBtn = $('error-action'); + if (actionLabel && actionFn) { + actionBtn.textContent = actionLabel; + actionBtn.classList.remove('hidden'); + actionBtn.onclick = async () => { + try { + await actionFn(); + } catch (err) { + showError('Action failed: ' + (err.message || err)); + } + }; + } else { + actionBtn.classList.add('hidden'); + } + errorBanner.classList.remove('hidden'); + clearTimeout(showError._t); + if (!actionLabel) { + showError._t = setTimeout(() => errorBanner.classList.add('hidden'), 6000); + } +} +function hideError() { errorBanner.classList.add('hidden'); } + +// ─── Theme ─────────────────────────────────────────────────────────────── +function applyTheme() { + const cfg = getActiveConfig(); + document.documentElement.setAttribute('data-theme', cfg.theme || 'auto'); +} + +// ─── Settings modal ────────────────────────────────────────────────────── +function renderModelOptions() { + const select = $('cfg-llm'); + const selected = String(getActiveConfig().llmNo || 0); + const profiles = Array.isArray(state.modelProfiles) ? state.modelProfiles : []; + const options = profiles.length ? profiles : [{ llmNo: 0, name: 'Default / Auto' }]; + select.textContent = ''; + for (const profile of options) { + const opt = document.createElement('option'); + opt.value = String(profile.llmNo); + // Display as "name/model" when both fields available + const displayName = profile.name && profile.model + ? `${profile.name}/${profile.model}` + : profile.name || profile.model || `Model ${profile.llmNo}`; + opt.textContent = displayName; + select.appendChild(opt); + } + if (![...select.options].some((opt) => opt.value === selected)) { + const opt = document.createElement('option'); + opt.value = selected; + opt.textContent = selected === '0' ? 'Default / Auto' : `Model ${selected}`; + select.appendChild(opt); + } + select.value = selected; +} + +async function loadModelProfiles() { + try { + const result = await window.ga.getModelProfiles(); + state.modelProfiles = Array.isArray(result && result.profiles) ? result.profiles : []; + renderModelOptions(); + } catch (err) { + addDiagnostic('warn', 'Failed to load model names', err); + renderModelOptions(); + } +} + +function openSettings() { + renderModelOptions(); + const cfg = getActiveConfig(); + $('cfg-llm').value = String(cfg.llmNo || 0); + settingsModal.classList.remove('hidden'); + loadModelProfiles(); +} +function closeSettings() { settingsModal.classList.add('hidden'); } + +async function openConfigFile(openFn, label) { + try { + const result = await openFn(); + if (result && result.ok === false) { + showError(`Failed to open ${label}: ${result.error || result.path || 'unknown error'}`); + } + } catch (err) { + showError(`Failed to open ${label}: ${err.message || err}`); + } +} + +async function saveSettings() { + const saveBtn = $('save-settings'); + saveBtn.disabled = true; + try { + const sess = state.sessions.get(state.activeId); + if (!sess) throw new Error('No active session'); + const cfg = sess.config; + cfg.llmNo = Math.max(0, parseInt($('cfg-llm').value, 10) || 0); + await window.ga.saveConfig(cfg); + closeSettings(); + } catch (err) { + showError('Failed to save settings: ' + (err.message || err)); + } finally { + saveBtn.disabled = false; + } +} + +async function ensureBridgeSession(sess) { + if (!sess) throw new Error('No active session.'); + if (sess.bridgeSessionId) return sess.bridgeSessionId; + const cwd = sess.cwd || await getCwd(); + const res = await window.ga.rpc('session/new', { cwd, mcp_servers: [] }); + if (res.error) throw new Error(typeof res.error === 'string' ? res.error : (res.error.message || JSON.stringify(res.error))); + sess.bridgeSessionId = res.sessionId; + sess.cwd = cwd; + return sess.bridgeSessionId; +} + +async function restartBridge(options = {}) { + const { remapSessions = false } = options; + setStatus('warn', 'Restarting…'); + state.bridgeReady = false; + state.restartingBridge = true; + if (remapSessions) { + for (const sess of state.sessions.values()) sess.bridgeSessionId = null; + } + state.bridgeNoticeMessage = showSystem('Bridge restarting…'); + await window.ga.startBridge(getActiveConfig().llmNo || 0); + window.setTimeout(() => { + if (state.restartingBridge && !state.bridgeReady && !getActiveSessionRuntime()?.busy) { + markBridgeReady('Bridge ready.'); + addDiagnostic('warn', 'Bridge ready event timeout; restored Ready status locally'); + } + }, 2500); +} + +// ─── Bridge events ─────────────────────────────────────────────────────── +let _bootstrappingSession = false; +async function markBridgeReady(noticeText = 'Bridge ready.') { + if (state.bridgeReady) return; // already marked ready, prevent double-fire + state.bridgeReady = true; + state.restartingBridge = false; + if (getActiveSessionRuntime()?.busy) setStatus('busy', 'Agent is responding…'); + else setStatus('ok', 'Ready'); + updateBridgeNotice(noticeText); + hideError(); + // Restore sessions from bridge (survives page refresh) or create first session + if (state.sessions.size === 0 && !_bootstrappingSession) { + _bootstrappingSession = true; + try { + // Try to restore existing sessions from bridge + const bridgeUrl = window.ga.bridgeUrl || 'http://127.0.0.1:14168'; + const listRes = await fetch(`${bridgeUrl}/sessions`).then(r => r.json()).catch(() => null); + const existingSessions = listRes?.sessions || []; + if (existingSessions.length > 0) { + // Restore each session from bridge + for (const bSess of existingSessions) { + const localId = `local-${Date.now()}-${Math.random().toString(16).slice(2)}`; + const sess = createLocalSession(localId, bSess.title || 'Restored', bSess.id || bSess.sessionId); + // Fetch full messages for this session + const sid = bSess.id || bSess.sessionId; + const msgRes = await fetch(`${bridgeUrl}/session/${sid}/messages?after=0&limit=9999`).then(r => r.json()).catch(() => null); + if (msgRes?.messages) { + sess.messages = msgRes.messages; + // Initialize polling state so we don't re-fetch these messages + const runtime = getSessionRuntime(sess); + runtime.seenBridgeMessageIds = new Set(); + let maxId = 0; + for (const m of msgRes.messages) { + if (m.id) { runtime.seenBridgeMessageIds.add(Number(m.id)); maxId = Math.max(maxId, Number(m.id)); } + } + runtime.lastPolledMessageId = maxId; + } + } + // Activate the first session + const firstLocalId = [...state.sessions.keys()][0]; + if (firstLocalId) setActiveSession(firstLocalId); + } else { + await newSession(); + } + } finally { _bootstrappingSession = false; } + } + updateSendButton(); + // Refresh model profiles from bridge (authoritative source) + loadModelProfiles(); +} + +window.ga.onBridgeReady(() => { + markBridgeReady(); +}); + +window.ga.onBridgeMessage(() => { + // RPC responses are resolved in main; renderer readiness comes from bridge-ready. +}); + +window.ga.onBridgeNotification((msg) => { + handleNotification(msg); +}); + +window.ga.onBridgeError((err) => { + console.error('Bridge error:', err); + addDiagnostic('error', 'Bridge error', err); + setStatus('err', 'Error'); + state.bridgeReady = false; + state.restartingBridge = false; + + if (err.type === 'no-mykey') { + showError(err.message, 'Setup', async () => { + await window.ga.openMykeyTemplate(); + }, { skipDiagnostic: true }); + } else if (err.type === 'no-python') { + showError(err.message, 'Settings', openSettings, { skipDiagnostic: true }); + } else { + showError(err.message || 'Bridge error', null, null, { skipDiagnostic: true }); + } +}); + +window.ga.onBridgeClosed((info) => { + addDiagnostic('warn', 'Bridge closed', info); + if (state.restartingBridge) { + setStatus('warn', 'Restarting…'); + return; + } + state.bridgeReady = false; + setStatus('err', `Bridge stopped (${info.code})`); +}); + +window.ga.onBridgeLog((text) => { + console.log('[bridge]', text); + addDiagnostic('info', 'Bridge log', text); +}); + +// ─── Input handling ────────────────────────────────────────────────────── +inputEl.addEventListener('input', () => { + // auto-resize + inputEl.style.height = 'auto'; + inputEl.style.height = Math.min(inputEl.scrollHeight, 200) + 'px'; + updateSendButton(); +}); + +inputEl.addEventListener('keydown', (e) => { + if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) { + e.preventDefault(); + submitInput(); + } else if (e.key === 'Escape' && getActiveSessionRuntime()?.busy) { + e.preventDefault(); + cancelPrompt(); + } +}); + +// ─── Image paste handling ───────────────────────────────────────────────── +const imagePreviews = document.getElementById('image-previews'); +const pendingImages = []; // Array of { dataUrl, id } + +inputEl.addEventListener('paste', (e) => { + const items = e.clipboardData?.items; + if (!items) return; + for (const item of items) { + if (item.type.startsWith('image/')) { + e.preventDefault(); + const file = item.getAsFile(); + if (!file) continue; + const reader = new FileReader(); + reader.onload = () => { + const dataUrl = reader.result; + const id = `img-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`; + pendingImages.push({ dataUrl, id }); + renderImagePreviews(); + }; + reader.readAsDataURL(file); + break; // handle one image per paste + } + } +}); + +function renderImagePreviews() { + imagePreviews.innerHTML = ''; + for (const img of pendingImages) { + const wrapper = document.createElement('div'); + wrapper.className = 'image-preview-item'; + wrapper.dataset.imgId = img.id; + + const imgEl = document.createElement('img'); + imgEl.src = img.dataUrl; + imgEl.alt = 'Pasted image'; + + const closeBtn = document.createElement('button'); + closeBtn.className = 'remove-img'; + closeBtn.textContent = '×'; + closeBtn.setAttribute('aria-label', 'Remove image'); + closeBtn.addEventListener('click', () => { + const idx = pendingImages.findIndex(i => i.id === img.id); + if (idx !== -1) pendingImages.splice(idx, 1); + renderImagePreviews(); + }); + + wrapper.appendChild(imgEl); + wrapper.appendChild(closeBtn); + imagePreviews.appendChild(wrapper); + } + imagePreviews.style.display = pendingImages.length ? 'flex' : 'none'; +} + +function clearPendingImages() { + pendingImages.length = 0; + renderImagePreviews(); +} + +function submitInput() { + const text = inputEl.value.trim(); + if (!text && pendingImages.length === 0) return; + if (getActiveSessionRuntime()?.busy) { + showSystem('Agent is still responding. Press Esc or Stop before sending another message.'); + return; + } + const images = [...pendingImages]; + inputEl.value = ''; + inputEl.style.height = 'auto'; + clearPendingImages(); + updateSendButton(); + + if (text.startsWith('/')) { + handleSlash(text).catch((err) => { + showSystem('Command failed: ' + (err.message || err)); + }); + } else { + sendPrompt(text, images); + } +} + +sendBtn.addEventListener('click', () => { + if (getActiveSessionRuntime()?.busy) { + cancelPrompt().then((ok) => { + if (ok) showSystem('Stop requested.'); + }); + } else submitInput(); +}); + +// ─── Buttons ───────────────────────────────────────────────────────────── +$('new-session-btn').addEventListener('click', newSession); +$('settings-btn').addEventListener('click', openSettings); +$('close-settings').addEventListener('click', closeSettings); +$('cancel-settings').addEventListener('click', closeSettings); +$('save-settings').addEventListener('click', saveSettings); +$('open-mykey').addEventListener('click', () => openConfigFile(window.ga.openMykey, 'mykey.py')); +$('error-dismiss').addEventListener('click', hideError); + +settingsModal.querySelector('.modal-backdrop').addEventListener('click', closeSettings); + +// ─── Message Search (Cmd/Ctrl+F) ───────────────────────────────────────── +(function initSearch() { + const searchBar = document.getElementById('search-bar'); + const searchInput = document.getElementById('search-input'); + const searchClose = document.getElementById('search-close'); + const searchPrev = document.getElementById('search-prev'); + const searchNext = document.getElementById('search-next'); + const searchCount = document.getElementById('search-count'); + + let highlights = []; + let currentIdx = -1; + + function openSearch() { + searchBar.classList.remove('hidden'); + searchBar.classList.add('visible'); + searchInput.focus(); + searchInput.select(); + } + + function closeSearch() { + searchBar.classList.remove('visible'); + searchBar.classList.add('hidden'); + clearHighlights(); + searchInput.value = ''; + searchCount.textContent = ''; + } + + function clearHighlights() { + highlights.forEach(el => { + const parent = el.parentNode; + if (parent) { + parent.replaceChild(document.createTextNode(el.textContent), el); + parent.normalize(); + } + }); + highlights = []; + currentIdx = -1; + } + + function doSearch(query) { + clearHighlights(); + if (!query) { searchCount.textContent = ''; return; } + + const chatArea = document.getElementById('messages'); + const walker = document.createTreeWalker(chatArea, NodeFilter.SHOW_TEXT, null); + const textNodes = []; + while (walker.nextNode()) textNodes.push(walker.currentNode); + + const lowerQ = query.toLowerCase(); + textNodes.forEach(node => { + const text = node.textContent; + const lower = text.toLowerCase(); + let idx = lower.indexOf(lowerQ); + if (idx === -1) return; + + const frag = document.createDocumentFragment(); + let lastIdx = 0; + while (idx !== -1) { + frag.appendChild(document.createTextNode(text.slice(lastIdx, idx))); + const mark = document.createElement('mark'); + mark.className = 'search-highlight'; + mark.textContent = text.slice(idx, idx + query.length); + frag.appendChild(mark); + highlights.push(mark); + lastIdx = idx + query.length; + idx = lower.indexOf(lowerQ, lastIdx); + } + frag.appendChild(document.createTextNode(text.slice(lastIdx))); + node.parentNode.replaceChild(frag, node); + }); + + searchCount.textContent = highlights.length ? `1/${highlights.length}` : '0'; + if (highlights.length) { currentIdx = 0; scrollToHighlight(); } + } + + function scrollToHighlight() { + highlights.forEach((el, i) => el.classList.toggle('active', i === currentIdx)); + if (highlights[currentIdx]) { + // Expand any collapsed ancestor turns so the match is visible + let ancestor = highlights[currentIdx].parentElement; + while (ancestor && ancestor !== document.body) { + if (ancestor.classList.contains('turn') && ancestor.classList.contains('collapsed')) { + ancestor.classList.remove('collapsed'); + } + ancestor = ancestor.parentElement; + } + highlights[currentIdx].scrollIntoView({ block: 'center', behavior: 'smooth' }); + searchCount.textContent = `${currentIdx + 1}/${highlights.length}`; + } + } + + function nextMatch() { if (!highlights.length) return; currentIdx = (currentIdx + 1) % highlights.length; scrollToHighlight(); } + function prevMatch() { if (!highlights.length) return; currentIdx = (currentIdx - 1 + highlights.length) % highlights.length; scrollToHighlight(); } + + // Event listeners + searchClose.addEventListener('click', closeSearch); + searchPrev.addEventListener('click', prevMatch); + searchNext.addEventListener('click', nextMatch); + + let searchTimeout; + searchInput.addEventListener('input', () => { + clearTimeout(searchTimeout); + searchTimeout = setTimeout(() => doSearch(searchInput.value), 200); + }); + searchInput.addEventListener('keydown', (e) => { + if (e.key === 'Enter') { e.shiftKey ? prevMatch() : nextMatch(); e.preventDefault(); } + if (e.key === 'Escape') { closeSearch(); e.preventDefault(); } + }); + + // Global shortcut: Cmd+F (Mac) / Ctrl+F (Win/Linux) + // Note: On macOS Electron intercepts Cmd+F via menu accelerator, + // so we also listen for IPC 'open-search' from main process. + document.addEventListener('keydown', (e) => { + const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; + const mod = isMac ? e.metaKey : e.ctrlKey; + if (mod && e.key === 'f') { + e.preventDefault(); + openSearch(); + } + if (e.key === 'Escape' && searchBar.classList.contains('visible')) { + e.preventDefault(); + closeSearch(); + } + }); + + // Listen for IPC from main process (menu accelerator on macOS) + if (window.ga && window.ga.onOpenSearch) { + window.ga.onOpenSearch(() => openSearch()); + } +})(); + +// ─── Init ──────────────────────────────────────────────────────────────── +(async function init() { + // Add platform class to body for platform-specific CSS + const platform = (window.ga && window.ga.platform) || process.platform || 'unknown'; + document.body.classList.add('platform-' + platform); + + try { + const saved = await window.ga.getConfig(); + Object.assign(state.defaultConfig, saved); + } catch (err) { + addDiagnostic('error', 'Failed to load settings', err); + showError('Failed to load settings; using defaults: ' + (err.message || err)); + } + applyTheme(); + await loadModelProfiles(); + updateSendButton(); + inputEl.focus(); +})(); diff --git a/frontends/desktop/static/ga-web.js b/frontends/desktop/static/ga-web.js new file mode 100644 index 00000000..960f0b92 --- /dev/null +++ b/frontends/desktop/static/ga-web.js @@ -0,0 +1,142 @@ +// GenericAgent Web2 browser bridge adapter. +// HTTP is the command/data channel. WebSocket only carries small state events. +(() => { + 'use strict'; + + const listeners = new Map(); + let ws = null; + let cachedBridgeReady = null; + const bridgeBase = `${location.protocol}//${location.hostname}:14168`; + const wsUrl = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.hostname}:14168/ws`; + + function on(channel, cb) { + if (typeof cb !== 'function') return () => {}; + if (!listeners.has(channel)) listeners.set(channel, new Set()); + listeners.get(channel).add(cb); + if (channel === 'bridge-ready' && cachedBridgeReady) { + try { cb(cachedBridgeReady); } catch (err) { console.error('[ga-web2 listener] replay bridge-ready', err); } + } + return () => listeners.get(channel)?.delete(cb); + } + + function emit(channel, payload) { + if (channel === 'bridge-ready') cachedBridgeReady = payload; + const set = listeners.get(channel); + if (!set) return; + for (const cb of Array.from(set)) { + try { cb(payload); } catch (err) { console.error('[ga-web2 listener]', channel, err); } + } + } + + async function http(path, options = {}) { + const headers = Object.assign({}, options.headers || {}); + const init = Object.assign({}, options, { headers }); + if (init.body && typeof init.body !== 'string') { + headers['Content-Type'] = headers['Content-Type'] || 'application/json'; + init.body = JSON.stringify(init.body); + } + const res = await fetch(`${bridgeBase}${path}`, init); + const text = await res.text(); + let data = null; + try { data = text ? JSON.parse(text) : {}; } catch (_) { data = { raw: text }; } + if (!res.ok) { + const err = new Error((data && (data.error || data.message)) || `${res.status} ${res.statusText}`); + err.status = res.status; + err.data = data; + throw err; + } + return data; + } + + function connectWs() { + if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) return; + try { + ws = new WebSocket(wsUrl); + ws.addEventListener('open', () => emit('bridge-log', 'WS state channel connected')); + ws.addEventListener('message', (ev) => { + let msg; + try { msg = JSON.parse(ev.data); } catch (_) { return; } + if (msg.type === 'bridge-ready') { + emit('bridge-ready', msg); + } else if (msg.type === 'session-state') { + emit('bridge-notification', msg); + } else if (msg.type === 'bridge-log') { + emit('bridge-log', msg.payload || msg); + } else if (msg.type === 'bridge-error') { + emit('bridge-error', msg.payload || msg); + } + }); + ws.addEventListener('close', () => emit('bridge-closed', { reason: 'ws-closed' })); + ws.addEventListener('error', () => emit('bridge-error', { type: 'ws-error', message: 'WebSocket state channel error' })); + } catch (err) { + emit('bridge-error', { type: 'ws-error', message: err.message || String(err) }); + } + } + + async function rpc(method, params = {}) { + switch (method) { + case 'app/status': + return http('/status'); + case 'app/config/get': + return http('/config'); + case 'app/config/save': + return http('/config', { method: 'POST', body: params || {} }); + case 'get/model-profiles': + return http('/model-profiles'); + case 'session/new': + return http('/session/new', { method: 'POST', body: params || {} }); + case 'session/prompt': { + const sid = params.sessionId || params.id || params.bridgeSessionId; + if (!sid) throw new Error('session/prompt missing sessionId'); + return http(`/session/${encodeURIComponent(sid)}/prompt`, { method: 'POST', body: params || {} }); + } + case 'session/poll': { + const sid = params.sessionId || params.id || params.bridgeSessionId; + if (!sid) throw new Error('session/poll missing sessionId'); + const after = params.afterId ?? params.after ?? 0; + const limit = params.limit ?? 200; + return http(`/session/${encodeURIComponent(sid)}/messages?after=${encodeURIComponent(after)}&limit=${encodeURIComponent(limit)}`); + } + case 'session/cancel': { + const sid = params.sessionId || params.id || params.bridgeSessionId; + if (!sid) throw new Error('session/cancel missing sessionId'); + return http(`/session/${encodeURIComponent(sid)}/cancel`, { method: 'POST', body: params || {} }); + } + case 'app/path/open': + return http('/path/open', { method: 'POST', body: params || {} }); + case 'app/path/selectGaRoot': + return http('/config'); + case 'list_continuable_sessions': + return { sessions: [] }; + case 'restore_session': + throw new Error('restore_session is not implemented in web2 bridge'); + default: + throw new Error(`Unknown RPC method: ${method}`); + } + } + + window.ga = { + platform: navigator.platform.toLowerCase().includes('mac') ? 'darwin' : 'win32', + startBridge: async () => { connectWs(); return http('/status'); }, + stopBridge: async () => ({ ok: true }), + checkStatus: () => rpc('app/status', {}), + getConfig: () => rpc('app/config/get', {}), + saveConfig: (cfg) => rpc('app/config/save', cfg || {}), + getModelProfiles: () => rpc('get/model-profiles', {}), + selectGaRoot: () => rpc('app/path/selectGaRoot', {}), + openMykeyTemplate: () => rpc('app/path/open', { kind: 'mykeyTemplate' }), + openMykey: () => rpc('app/path/open', { kind: 'mykey' }), + pollSession: (sessionId, afterId = 0) => rpc('session/poll', { sessionId, afterId }), + rpc, + onBridgeMessage: (cb) => on('bridge-message', cb), + onBridgeNotification: (cb) => on('bridge-notification', cb), + onBridgeError: (cb) => on('bridge-error', cb), + onBridgeClosed: (cb) => on('bridge-closed', cb), + onBridgeReady: (cb) => on('bridge-ready', cb), + onBridgeLog: (cb) => on('bridge-log', cb), + onOpenSearch: (cb) => on('open-search', cb) + }; + + connectWs(); + http('/status').then(status => emit('bridge-ready', status)).catch(err => emit('bridge-error', { type: 'http-error', message: err.message || String(err) })); +})(); diff --git a/frontends/desktop/static/index.html b/frontends/desktop/static/index.html new file mode 100644 index 00000000..3fa70a5a --- /dev/null +++ b/frontends/desktop/static/index.html @@ -0,0 +1,116 @@ + + + + + GenericAgent + + + +
+ +
+
+
+
+ +
+
+
+

GenericAgent

+ + + Starting… + +
+
+ + + +
+
+
New task
+
Task me anything. Type /help for commands.
+
+
+ +
+
+
+ +
+
+ + +
+ +
+
+
+
+ + + + + + + + +
+ + + + + + diff --git a/frontends/desktop/static/styles.css b/frontends/desktop/static/styles.css new file mode 100644 index 00000000..217f6985 --- /dev/null +++ b/frontends/desktop/static/styles.css @@ -0,0 +1,897 @@ +/* GenericAgent Desktop — Minimal Codex-inspired styling */ + +:root { + --bg: #ffffff; + --bg-subtle: #fafafa; + --bg-hover: #f3f3f3; + --bg-active: #ededed; + --border: #e8e8e8; + --border-strong: #d4d4d4; + --text: #0a0a0a; + --text-muted: #6b6b6b; + --text-faint: #9a9a9a; + --accent: #0a0a0a; + --accent-text: #ffffff; + --user-bg: #f5f5f5; + --code-bg: #f5f5f5; + --code-text: #1a1a1a; + --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.04); + --shadow-strong: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05); + --radius: 10px; + --radius-sm: 6px; + --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif; + --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif; + --font-mono: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace; + --ok: #16a34a; + --warn: #f59e0b; + --err: #dc2626; +} + +[data-theme="dark"] { + --bg: #1a1a1a; + --bg-subtle: #1f1f1f; + --bg-hover: #262626; + --bg-active: #2d2d2d; + --border: #2a2a2a; + --border-strong: #3a3a3a; + --text: #ededed; + --text-muted: #a0a0a0; + --text-faint: #6b6b6b; + --accent: #ededed; + --accent-text: #0a0a0a; + --user-bg: #262626; + --code-bg: #0f0f0f; + --code-text: #e0e0e0; + --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04); + --shadow-strong: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05); +} + +@media (prefers-color-scheme: dark) { + [data-theme="auto"] { + --bg: #1a1a1a; + --bg-subtle: #1f1f1f; + --bg-hover: #262626; + --bg-active: #2d2d2d; + --border: #2a2a2a; + --border-strong: #3a3a3a; + --text: #ededed; + --text-muted: #a0a0a0; + --text-faint: #6b6b6b; + --accent: #ededed; + --accent-text: #0a0a0a; + --user-bg: #262626; + --code-bg: #0f0f0f; + --code-text: #e0e0e0; + --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04); + --shadow-strong: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05); + } +} + +* { box-sizing: border-box; } + +html, body { + margin: 0; padding: 0; height: 100%; + font-family: var(--font); + font-size: 14px; + letter-spacing: -0.01em; + color: var(--text); + background: var(--bg); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + overflow: hidden; +} + +#app { + display: flex; + height: 100vh; + width: 100vw; +} + +/* ─── Top tabs ───────────────────────────────────────────────────────── */ +button, input, textarea, select, .icon-btn, .btn, .send-btn, .session-tab, .tab-new-btn { + -webkit-app-region: no-drag; +} + +.tab-strip { + flex: 1; + min-width: 0; + display: flex; + align-items: flex-end; + gap: 2px; + overflow: hidden; + padding: 8px 0 0 0; + scrollbar-width: none; +} +/* macOS: leave space for traffic-light buttons */ +body.platform-darwin .tab-strip { + padding-left: 80px; +} +.tab-strip::-webkit-scrollbar { display: none; } + +/* Chrome-like chat tabs */ +.session-tab { + display: flex; + align-items: center; + gap: 4px; + flex: 0 1 180px; + min-width: 60px; + height: 32px; + padding: 0 6px 0 10px; + border: 1px solid transparent; + border-bottom: 0; + border-radius: 10px 10px 0 0; + background: transparent; + color: var(--text-muted); + font: inherit; + font-size: 13px; + text-align: left; + white-space: nowrap; + overflow: hidden; + cursor: pointer; +} +.session-tab .tab-label { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; +} +.session-tab .tab-dot { + flex-shrink: 0; + width: 7px; height: 7px; + border-radius: 50%; + background: var(--ok); + margin-right: 2px; +} +.session-tab .tab-dot.busy { background: var(--warn); animation: pulse 1.2s infinite; } +.session-tab .tab-dot.err { background: var(--err); } +.session-tab .tab-dot.warn { background: var(--warn); } +.session-tab .tab-close { + flex-shrink: 0; + width: 18px; + height: 18px; + border-radius: 50%; + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 14px; + line-height: 1; + color: var(--text-faint); + opacity: 0; + transition: opacity 0.1s, background 0.1s; + cursor: pointer; +} +.session-tab:hover .tab-close { opacity: 1; } +.session-tab .tab-close:hover { + background: var(--bg-active); + color: var(--text); +} +.session-tab:hover { background: var(--bg-hover); color: var(--text); } +.session-tab.active { + background: var(--bg); + border-color: var(--border); + color: var(--text); + font-weight: 600; +} +.session-tab.active .tab-close { opacity: 0.6; } +.session-tab.active .tab-close:hover { opacity: 1; background: var(--bg-active); } + +.tab-new-btn { + width: 28px; + height: 28px; + margin: 0 8px 2px 2px; + border: 0; + border-radius: 50%; + background: transparent; + color: var(--text-muted); + display: inline-flex; + align-items: center; + justify-content: center; + cursor: pointer; + flex-shrink: 0; + align-self: flex-end; +} +.tab-new-btn:hover { background: var(--bg-hover); color: var(--text); } + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +/* ─── Main ────────────────────────────────────────────────────────────── */ +#main { + flex: 1; + display: flex; + flex-direction: column; + min-width: 0; + background: var(--bg); +} + +#topbar { + height: 44px; + border-bottom: 1px solid var(--border); + display: flex; + align-items: stretch; + justify-content: space-between; + padding: 0 12px 0 0; + -webkit-app-region: drag; + flex-shrink: 0; + background: var(--bg-subtle); +} + +.topbar-left, .topbar-right { + display: flex; + align-items: center; + gap: 0; +} +.topbar-right { display: none; } +.topbar-left { flex: 1; min-width: 0; align-items: stretch; } +.topbar-right { flex-shrink: 0; } + +#session-title { + font-size: 13px; + font-weight: 600; + margin: 0; + letter-spacing: -0.01em; +} + +.badge { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 3px 8px; + border-radius: 10px; + background: var(--bg-subtle); + border: 1px solid var(--border); + font-size: 11px; + color: var(--text-muted); +} + +.status-dot { + width: 6px; height: 6px; + border-radius: 50%; + background: var(--text-faint); +} +.badge.ok .status-dot { background: var(--ok); } +.badge.warn .status-dot { background: var(--warn); } +.badge.err .status-dot { background: var(--err); } +.badge.busy .status-dot { background: var(--warn); animation: pulse 1.2s infinite; } + +@keyframes pulse { 50% { opacity: 0.3; } } + +/* ─── Messages ─────────────────────────────────────────────────────────── */ +#messages { + flex: 1; + overflow-y: auto; + padding: 24px 20px 8px; + scroll-behavior: smooth; +} + +#messages.empty { + display: flex; + align-items: center; + justify-content: center; +} + +.empty-state { + text-align: center; + color: var(--text-muted); + max-width: 400px; +} +.empty-logo { + font-size: 36px; + color: var(--text-muted); + margin-bottom: 12px; + letter-spacing: 0.1em; +} +.empty-title { + font-size: 18px; + font-weight: 600; + color: var(--text); + margin-bottom: 4px; +} +.empty-sub { + font-size: 13px; +} +.empty-sub code { + background: var(--bg-subtle); + padding: 1px 6px; + border-radius: 4px; + font-family: var(--font-mono); + font-size: 12px; +} + +.msg { + max-width: 780px; + margin: 0 auto 18px; + font-size: 14.5px; + line-height: 1.66; +} + +.msg-user { + display: flex; + justify-content: flex-end; +} +.msg-user .bubble { + background: transparent; + padding: 0; + border-radius: 0; + max-width: 85%; + white-space: pre-wrap; + word-wrap: break-word; + color: var(--text); + font-weight: 500; +} + +.msg-assistant { + color: var(--text); +} +.assistant-response { + padding: 0; + color: var(--text); +} + +.msg-system { + color: var(--text-faint); + font-size: 12px; + text-align: left; + padding: 6px 10px; + font-family: var(--font-mono); + white-space: pre-wrap; +} + +.msg-error { + color: var(--err); + background: rgba(220, 38, 38, 0.06); + border-left: 3px solid var(--err); + padding: 8px 14px; + border-radius: 4px; + font-family: var(--font-mono); + font-size: 12px; + white-space: pre-wrap; +} + +/* Turn (collapsible segment of assistant reply) */ +.turn { + margin: 6px 0 10px; + border: 0; + border-radius: var(--radius-sm); + overflow: hidden; + background: transparent; +} +.msg-assistant .turn[data-kind="agent_message_chunk"] { + border: 0; + background: transparent; +} +.turn-header { + width: max-content; + max-width: 100%; + padding: 4px 8px; + border-radius: 999px; + background: var(--bg-subtle); + border: 1px solid var(--border); + font-size: 12px; + color: var(--text-muted); + cursor: pointer; + user-select: none; + display: flex; + align-items: center; + gap: 6px; + font-family: var(--font); + overflow: hidden; + white-space: nowrap; +} +.turn-header:hover { background: var(--bg-hover); } +.turn-caret { + display: inline-block; + transition: transform 0.15s; + font-size: 10px; +} +.turn.collapsed .turn-caret { transform: rotate(-90deg); } +.turn.collapsed .turn-body { display: none; } + +.turn-body { + padding: 8px 0 0 18px; + color: var(--text-muted); +} + +.turn-tag { + text-transform: uppercase; + font-size: 10px; + letter-spacing: 0.08em; + color: var(--text-faint); + font-weight: 600; + flex-shrink: 0; +} + +.turn-status { + font-size: 11px; + color: var(--text-muted); + margin-left: auto; +} +.tool-detail-turn { + margin: 0 0 8px; + border: 1px solid var(--border-subtle); + border-radius: var(--radius-sm); + background: color-mix(in srgb, var(--surface-raised) 82%, transparent); +} +.tool-detail-header { + min-height: 28px; + padding: 5px 8px; +} +.tool-detail-body { + padding: 8px; +} +.tool-detail-body pre { + margin: 0; + max-height: 240px; + overflow: auto; +} +.turn-rendered-md:empty { display: none; } + +/* Markdown content */ +.md { + line-height: 1.72; + letter-spacing: -0.006em; +} +.md p { margin: 0 0 10px; } +.md p:last-child { margin-bottom: 0; } +.md h1, .md h2, .md h3 { margin: 16px 0 8px; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; } +.md h1 { font-size: 18px; } +.md h2 { font-size: 16px; } +.md h3 { font-size: 14px; } +.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } +.md li { margin: 2px 0; } +.md code { + font-family: var(--font-mono); + font-size: 12.5px; + background: var(--code-bg); + padding: 1px 5px; + border-radius: 3px; +} +.md pre { + background: var(--code-bg); + padding: 10px 12px; + border-radius: var(--radius-sm); + overflow-x: auto; + margin: 8px 0; + border: 1px solid var(--border); +} +.md pre code { + background: transparent; + padding: 0; + color: var(--code-text); + font-size: 12.5px; + line-height: 1.5; +} +.md blockquote { + border-left: 3px solid var(--border-strong); + padding-left: 12px; + color: var(--text-muted); + margin: 8px 0; +} +.md a { color: var(--text); text-decoration: underline; } +.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; } +.md table { border-collapse: collapse; margin: 8px 0; } +.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; font-size: 12.5px; } + +/* Streaming cursor */ +.cursor { + display: inline-block; + width: 6px; + height: 1em; + background: var(--text-muted); + vertical-align: text-bottom; + margin-left: 2px; + animation: blink 1s steps(2) infinite; +} +@keyframes blink { 50% { opacity: 0; } } + +/* ─── Composer ─────────────────────────────────────────────────────────── */ +#composer-wrap { + padding: 8px 20px 16px; + background: var(--bg); +} + +#composer { + max-width: 780px; + margin: 0 auto; + background: var(--bg); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + box-shadow: var(--shadow); + transition: border-color 0.15s, box-shadow 0.15s; +} +#composer:focus-within { + border-color: var(--accent); + box-shadow: var(--shadow-strong); +} + +#input { + width: 100%; + border: 0; + outline: 0; + resize: none; + padding: 12px 14px 4px; + background: transparent; + color: var(--text); + font-family: var(--font); + font-size: 14px; + line-height: 1.5; + max-height: 200px; +} +#input::placeholder { color: var(--text-faint); } + +/* Image previews in composer */ +.image-previews { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + gap: 8px; + padding: 8px 12px 0; +} +.image-previews:empty { display: none; } +.image-preview-item { + position: relative; + width: 64px; + height: 64px; + border-radius: 6px; + overflow: hidden; + border: 1px solid var(--border); +} +.image-preview-item img { + width: 100%; + height: 100%; + object-fit: cover; +} +.image-preview-item .remove-img { + position: absolute; + top: 2px; + right: 2px; + width: 18px; + height: 18px; + border-radius: 50%; + background: rgba(0,0,0,0.6); + color: #fff; + border: 0; + font-size: 12px; + line-height: 18px; + text-align: center; + cursor: pointer; + padding: 0; + display: flex; + align-items: center; + justify-content: center; +} +.image-preview-item .remove-img:hover { + background: rgba(0,0,0,0.85); +} + +/* User message image thumbnails */ +.user-images { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin-bottom: 6px; + justify-content: flex-end; +} +.user-msg-thumb { + width: 80px; + height: 80px; + object-fit: cover; + border-radius: 6px; + border: 1px solid var(--border); +} + +.composer-bottom { + display: flex; + align-items: center; + justify-content: space-between; + padding: 4px 8px 8px 14px; +} + +.composer-hints { + display: flex; + align-items: center; + gap: 4px; +} +.composer-hints .icon-btn.ghost { + font-size: 11px; + padding: 3px 7px; + gap: 4px; +} +.hint-label { + font-size: 11px; + color: var(--text-muted); +} + +.send-btn { + width: 30px; height: 30px; + border: 0; + border-radius: 6px; + background: var(--accent); + color: var(--accent-text); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition: opacity 0.15s, transform 0.1s; +} +.send-btn:hover { opacity: 0.85; } +.send-btn:active { transform: scale(0.96); } +.send-btn:disabled { opacity: 0.4; cursor: not-allowed; } +.send-btn.stop { background: var(--err); } + +/* ─── Buttons ──────────────────────────────────────────────────────────── */ +.icon-btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 6px; + padding: 6px 10px; + background: var(--bg); + color: var(--text); + border: 1px solid var(--border-strong); + border-radius: var(--radius-sm); + cursor: pointer; + font-size: 13px; + font-family: var(--font); + transition: background 0.15s; +} +.icon-btn:hover { background: var(--bg-hover); } +.icon-btn.ghost { + border: 0; + background: transparent; + color: var(--text-muted); +} +.icon-btn.ghost:hover { background: var(--bg-hover); color: var(--text); } +.icon-btn.full { width: 100%; justify-content: flex-start; } + +.btn { + padding: 7px 14px; + border: 1px solid var(--border-strong); + background: var(--bg); + color: var(--text); + border-radius: var(--radius-sm); + font-size: 13px; + cursor: pointer; + font-family: var(--font); +} +.btn:hover { background: var(--bg-hover); } +.btn.primary { + background: var(--accent); + color: var(--accent-text); + border-color: var(--accent); +} +.btn.primary:hover { opacity: 0.88; } +.btn.ghost { border: 0; background: transparent; } + +.hidden { display: none !important; } + +/* ─── Modal ────────────────────────────────────────────────────────────── */ +.modal { + position: fixed; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: 100; +} +.modal-backdrop { + position: absolute; + inset: 0; + background: rgba(0, 0, 0, 0.25); + backdrop-filter: blur(2px); +} +.modal-body { + position: relative; + background: var(--bg); + border-radius: var(--radius); + box-shadow: var(--shadow-strong); + width: 460px; + max-width: 90vw; + max-height: 88vh; + display: flex; + flex-direction: column; +} +.modal-header { + padding: 14px 18px; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid var(--border); +} +.modal-header h2 { margin: 0; font-size: 15px; font-weight: 600; } +.modal-content { padding: 16px 18px; overflow-y: auto; } +.modal-footer { + padding: 12px 18px; + border-top: 1px solid var(--border); + display: flex; + justify-content: flex-end; + gap: 8px; +} + +.form-row { + margin-bottom: 14px; + display: flex; + flex-direction: column; + gap: 6px; +} +.form-row label { + font-size: 12px; + font-weight: 500; + color: var(--text); +} +.form-row input, .form-row select { + padding: 7px 10px; + background: var(--bg-subtle); + border: 1px solid var(--border); + border-radius: var(--radius-sm); + color: var(--text); + font-family: var(--font); + font-size: 13px; + outline: 0; + transition: border-color 0.15s; +} +.form-row input:focus, .form-row select:focus { + border-color: var(--border-strong); +} +.form-row small { + color: var(--text-faint); + font-size: 11px; +} +.form-row small code { + font-family: var(--font-mono); + font-size: 11px; + background: var(--bg-subtle); + padding: 1px 4px; + border-radius: 3px; +} +.input-row { + display: flex; + gap: 8px; + align-items: center; +} +.input-row input { min-width: 0; } +.input-row .btn { flex: 0 0 auto; } +.btn-row { display: flex; gap: 8px; } + + +/* ─── Diagnostics panel ────────────────────────────────────────────────── */ +.diagnostics-panel { + position: fixed; + top: 56px; + right: 16px; + width: min(520px, calc(100vw - 32px)); + max-height: calc(100vh - 88px); + background: var(--bg); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + box-shadow: var(--shadow-strong); + z-index: 60; + display: flex; + flex-direction: column; +} +.diagnostics-header { + padding: 12px 14px; + border-bottom: 1px solid var(--border); + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; +} +.diagnostics-header h2 { margin: 0; font-size: 14px; font-weight: 600; } +.diagnostics-header p { margin: 3px 0 0; color: var(--text-faint); font-size: 11px; } +.diagnostics-log { + margin: 0; + padding: 12px 14px; + min-height: 180px; + overflow: auto; + white-space: pre-wrap; + word-break: break-word; + background: var(--code-bg); + color: var(--code-text); + font-family: var(--font-mono); + font-size: 11px; + line-height: 1.45; +} +.diagnostics-footer { + padding: 10px 12px; + border-top: 1px solid var(--border); + display: flex; + justify-content: flex-end; + gap: 8px; +} + +/* ─── Error banner ─────────────────────────────────────────────────────── */ +.error-banner { + position: fixed; + top: 56px; + right: 16px; + max-width: 420px; + background: var(--bg); + border: 1px solid var(--err); + border-left: 3px solid var(--err); + border-radius: var(--radius-sm); + padding: 10px 14px; + display: flex; + align-items: center; + gap: 10px; + font-size: 12.5px; + box-shadow: var(--shadow-strong); + z-index: 50; +} + +/* Scrollbars (WebKit) */ +::-webkit-scrollbar { width: 10px; height: 10px; } +::-webkit-scrollbar-track { background: transparent; } +::-webkit-scrollbar-thumb { + background: var(--border-strong); + border-radius: 5px; + border: 2px solid var(--bg); +} +::-webkit-scrollbar-thumb:hover { background: var(--text-faint); } + + +/* Structured GA action cards */ +.structured-turn { margin: 8px 0; } +.structured-turn .turn-header { width: fit-content; max-width: min(100%, 760px); background: rgba(248, 248, 250, 0.92); } +.turn-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 12px; } +.structured-turn .turn-body { margin-top: 6px; padding: 10px 12px; border-left: 2px solid var(--border); color: var(--text); } + +.task-elapsed { display: block; width: max-content; color: var(--accent); font-size: 12px; font-weight: 600; margin: 0 0 6px 0; } +.tool-detail-turn { margin: 8px 0 0 16px; border-left: 2px solid var(--accent); padding-left: 8px; } +.tool-detail-body .tool-args-code { margin: 6px 0 0; white-space: pre-wrap; } + +.summary-hint { font-style: italic; color: var(--text-muted, #888); opacity: 0.7; margin-bottom: 4px; font-size: 0.9em; } +.think-hint { font-style: italic; color: var(--text-muted, #888); opacity: 0.6; margin-bottom: 4px; font-size: 0.85em; } + + +/* ─── Copy Button for code blocks / pre blocks ─── */ +pre { position: relative; } +pre .copy-btn { + position: absolute; top: 6px; right: 6px; + background: rgba(128,128,128,0.15); border: 1px solid rgba(128,128,128,0.25); + border-radius: 4px; padding: 2px 8px; font-size: 12px; + color: var(--text-muted, #888); cursor: pointer; + opacity: 0; transition: opacity 0.2s; + z-index: 2; user-select: none; +} +pre:hover .copy-btn { opacity: 1; } +pre .copy-btn:hover { background: rgba(128,128,128,0.3); color: var(--text, #333); } +pre .copy-btn.copied { color: #4caf50; border-color: #4caf50; opacity: 1; } + +/* ─── Search Bar ─────────────────────────────────────────────────────── */ +#search-bar { + display: none; position: fixed; top: 40px; right: 16px; + background: var(--bg, #fff); border: 1px solid var(--border, #ddd); + border-radius: 8px; padding: 6px 10px; gap: 6px; align-items: center; + box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 9999; + font-size: 13px; +} +#search-bar.visible { display: flex; } +#search-input { + border: 1px solid var(--border, #ccc); border-radius: 4px; + padding: 4px 8px; font-size: 13px; width: 200px; + background: var(--input-bg, #fff); color: var(--text, #333); + outline: none; +} +#search-input:focus { border-color: var(--accent, #4a9eff); } +#search-count { min-width: 40px; text-align: center; color: var(--text-muted, #888); font-size: 12px; } +#search-bar button { + background: none; border: none; cursor: pointer; font-size: 16px; + color: var(--text, #333); padding: 2px 6px; border-radius: 4px; +} +#search-bar button:hover { background: rgba(128,128,128,0.15); } +mark.search-highlight { background: #ffeb3b; color: #000; border-radius: 2px; padding: 0 1px; } +mark.search-highlight.active { background: #ff9800; color: #fff; } + +/* ─── Tab Drag ───────────────────────────────────────────────────────── */ +.tab-btn.drag-over-left { box-shadow: inset 3px 0 0 var(--accent, #4a9eff); } +.tab-btn.drag-over-right { box-shadow: inset -3px 0 0 var(--accent, #4a9eff); } diff --git a/frontends/desktop/static/vendor/marked.min.js b/frontends/desktop/static/vendor/marked.min.js new file mode 100644 index 00000000..4052d1b4 --- /dev/null +++ b/frontends/desktop/static/vendor/marked.min.js @@ -0,0 +1,6 @@ +/** + * marked v15.0.7 - a markdown parser + * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s={exec:()=>null};function r(e,t=""){let n="string"==typeof e?e:e.source;const s={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(i.caret,"$1"),n=n.replace(e,r),s},getRegex:()=>new RegExp(n,t)};return s}const i={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,o=/(?:[*+-]|\d{1,9}[.)])/,a=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,c=r(a).replace(/bull/g,o).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),h=r(a).replace(/bull/g,o).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),p=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,u=/(?!\s*\])(?:\\.|[^\[\]\\])+/,g=r(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",u).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),k=r(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,o).getRegex(),d="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",f=/|$))/,x=r("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",f).replace("tag",d).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),b=r(p).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",d).getRegex(),w={blockquote:r(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",b).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:g,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:l,html:x,lheading:c,list:k,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:b,table:s,text:/^[^\n]+/},m=r("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",d).getRegex(),y={...w,lheading:h,table:m,paragraph:r(p).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",d).getRegex()},$={...w,html:r("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",f).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:r(p).replace("hr",l).replace("heading"," *#{1,6} *[^\n]").replace("lheading",c).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},R=/^( {2,}|\\)\n(?!\s*$)/,S=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,z=/[^\s\p{P}\p{S}]/u,A=r(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,T).getRegex(),_=/(?!~)[\p{P}\p{S}]/u,P=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,I=r(P,"u").replace(/punct/g,S).getRegex(),L=r(P,"u").replace(/punct/g,_).getRegex(),B="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",C=r(B,"gu").replace(/notPunctSpace/g,z).replace(/punctSpace/g,T).replace(/punct/g,S).getRegex(),q=r(B,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,_).getRegex(),E=r("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,z).replace(/punctSpace/g,T).replace(/punct/g,S).getRegex(),Z=r(/\\(punct)/,"gu").replace(/punct/g,S).getRegex(),v=r(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),D=r(f).replace("(?:--\x3e|$)","--\x3e").getRegex(),M=r("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",D).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),O=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Q=r(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",O).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),j=r(/^!?\[(label)\]\[(ref)\]/).replace("label",O).replace("ref",u).getRegex(),N=r(/^!?\[(ref)\](?:\[\])?/).replace("ref",u).getRegex(),G={_backpedal:s,anyPunctuation:Z,autolink:v,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:R,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:s,emStrongLDelim:I,emStrongRDelimAst:C,emStrongRDelimUnd:E,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Q,nolink:N,punctuation:A,reflink:j,reflinkSearch:r("reflink|nolink(?!\\()","g").replace("reflink",j).replace("nolink",N).getRegex(),tag:M,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},V=e=>K[e];function W(e,t){if(t){if(i.escapeTest.test(e))return e.replace(i.escapeReplace,V)}else if(i.escapeTestNoEncode.test(e))return e.replace(i.escapeReplaceNoEncode,V);return e}function Y(e){try{e=encodeURI(e).replace(i.percentDecode,"%")}catch{return null}return e}function ee(e,t){const n=e.replace(i.findPipe,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(i.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:te(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(null===s)return t;const r=s[1];return t.split("\n").map((e=>{const t=e.match(n.other.beginningSpace);if(null===t)return e;const[s]=t;return s.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=te(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:te(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=te(t[0],"\n").split("\n"),n="",s="";const r=[];for(;e.length>0;){let t=!1;const i=[];let l;for(l=0;l1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let l=!1;for(;e;){let n=!1,s="",o="";if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=!a.trim(),p=0;if(this.options.pedantic?(p=2,o=a.trimStart()):h?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,o=a.slice(p),p+=t[1].length),h&&this.rules.other.blankLine.test(c)&&(s+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),r=this.rules.other.fencesBeginRegex(p),i=this.rules.other.headingBeginRegex(p),l=this.rules.other.htmlBeginRegex(p);for(;e;){const u=e.split("\n",1)[0];let g;if(c=u,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),g=c):g=c.replace(this.rules.other.tabCharGlobal," "),r.test(c))break;if(i.test(c))break;if(l.test(c))break;if(t.test(c))break;if(n.test(c))break;if(g.search(this.rules.other.nonSpaceChar)>=p||!c.trim())o+="\n"+g.slice(p);else{if(h)break;if(a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(r.test(a))break;if(i.test(a))break;if(n.test(a))break;o+="\n"+c}h||c.trim()||(h=!0),s+=u+"\n",e=e.substring(u.length+1),a=g.slice(p)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(s)&&(l=!0));let u,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:s,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=s}const o=r.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=te(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ne(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return ne(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...s[0]][0].length,a=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){const e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}const c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(e),s=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&s&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class re{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:i,block:U.normal,inline:J.normal};this.options.pedantic?(n.block=U.pedantic,n.inline=J.pedantic):this.options.gfm&&(n.block=U.gfm,this.options.breaks?n.inline=J.breaks:n.inline=J.gfm),this.tokenizer.rules=n}static get rules(){return{block:U,inline:J}}static lex(e,t){return new re(t).lex(e)}static lexInline(e,t){return new re(t).inlineTokens(e)}lex(e){e=e.replace(i.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const n=t.at(-1);1===s.raw.length&&void 0!==n?n.raw+="\n":t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.at(-1).src=n.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let r=e;if(this.options.extensions?.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){const i=t.at(-1);n&&"paragraph"===i?.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length)}else if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r=!1,i="";for(;e;){let s;if(r||(i=""),r=!1,this.options.extensions?.inline?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===s.type&&"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,n,i)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}let l=e;if(this.options.extensions?.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(l=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(l)){e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(i=s.raw.slice(-1)),r=!0;const n=t.at(-1);"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class ie{options;parser;constructor(t){this.options=t||e.defaults}space(e){return""}code({text:e,lang:t,escaped:n}){const s=(t||"").match(i.notSpaceStart)?.[0],r=e.replace(i.endingNewline,"")+"\n";return s?'
'+(n?r:W(r,!0))+"
\n":"
"+(n?r:W(r,!0))+"
\n"}blockquote({tokens:e}){return`
\n${this.parser.parse(e)}
\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
\n"}list(e){const t=e.ordered,n=e.start;let s="";for(let t=0;t\n"+s+"\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+W(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",n="";for(let t=0;t${s}`),"\n\n"+t+"\n"+s+"
    \n"}tablerow({text:e}){return`\n${e}\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`\n`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${W(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),r=Y(e);if(null===r)return s;let i='
    ",i}image({href:e,title:t,text:n}){const s=Y(e);if(null===s)return W(n);let r=`${n}{const r=e[s].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new ie(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const s=n,r=e.renderer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new se(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,r=e.tokenizer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new ae;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const s=n,r=e.hooks[s],i=t[s];ae.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>i.call(t,e)));const n=r.call(t,e);return i.call(t,n)}:t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return re.lex(e,t??this.defaults)}parser(e,t){return oe.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{const s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(!0===this.defaults.async&&!1===s.async)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return i(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const l=r.hooks?r.hooks.provideLexer():e?re.lex:re.lexInline,o=r.hooks?r.hooks.provideParser():e?oe.parse:oe.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then((e=>l(e,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>o(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let e=l(t,r);r.hooks&&(e=r.hooks.processAllTokens(e)),r.walkTokens&&this.walkTokens(e,r.walkTokens);let n=o(e,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return i(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+W(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const he=new ce;function pe(e,t){return he.parse(e,t)}pe.options=pe.setOptions=function(e){return he.setOptions(e),pe.defaults=he.defaults,n(pe.defaults),pe},pe.getDefaults=t,pe.defaults=e.defaults,pe.use=function(...e){return he.use(...e),pe.defaults=he.defaults,n(pe.defaults),pe},pe.walkTokens=function(e,t){return he.walkTokens(e,t)},pe.parseInline=he.parseInline,pe.Parser=oe,pe.parser=oe.parse,pe.Renderer=ie,pe.TextRenderer=le,pe.Lexer=re,pe.lexer=re.lex,pe.Tokenizer=se,pe.Hooks=ae,pe.parse=pe;const ue=pe.options,ge=pe.setOptions,ke=pe.use,de=pe.walkTokens,fe=pe.parseInline,xe=pe,be=oe.parse,we=re.lex;e.Hooks=ae,e.Lexer=re,e.Marked=ce,e.Parser=oe,e.Renderer=ie,e.TextRenderer=le,e.Tokenizer=se,e.getDefaults=t,e.lexer=we,e.marked=pe,e.options=ue,e.parse=xe,e.parseInline=fe,e.parser=be,e.setOptions=ge,e.use=ke,e.walkTokens=de})); diff --git a/frontends/desktop_bridge.py b/frontends/desktop_bridge.py new file mode 100644 index 00000000..37771c9f --- /dev/null +++ b/frontends/desktop_bridge.py @@ -0,0 +1,616 @@ +#!/usr/bin/env python3 +""" +GenericAgent Web2 Bridge. + +Clear split: +1) AgentManager: owns GenericAgent instances, sessions and histories. +2) Transport: HTTP is the command/data channel; WebSocket only pushes small + session-state notifications. + +HTTP API: + GET /status + GET /config + POST /config + GET /model-profiles + GET /sessions + POST /session/new + GET /session/{sid} + DELETE /session/{sid} + POST /session/{sid}/prompt + GET /session/{sid}/messages?after=0&limit=200 + POST /session/{sid}/cancel + +WS API: + GET /ws -> events only, e.g. + {"type":"session-state","sessionId":"sess-...","state":"running","seq":3,"updatedAt":...} +""" +from __future__ import annotations + +import asyncio +import contextlib +import importlib +import json +import os +import sys +import threading +import time +import traceback +import uuid +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any, Dict, List, Optional, Set + +from aiohttp import web, WSMsgType + +APP_DIR = Path(__file__).resolve().parent + + +def find_default_ga_root() -> Path: + """Find GenericAgent root near this bridge. + + Probe, in order: + ../ + ../../ + ../GenericAgent + ../../GenericAgent + and return the first directory containing agentmain.py. + """ + candidates = [ + APP_DIR / "..", + APP_DIR / ".." / "..", + APP_DIR / ".." / "GenericAgent", + APP_DIR / ".." / ".." / "GenericAgent", + ] + for p in candidates: + root = p.resolve() + if (root / "agentmain.py").exists(): + return root + return APP_DIR.parent.parent.resolve() + + +DEFAULT_GA_ROOT = find_default_ga_root() + +for _s in (sys.stdout, sys.stderr): + with contextlib.suppress(Exception): + _s.reconfigure(encoding="utf-8", errors="replace") + + +# --------------------------------------------------------------------------- +# Agent management layer +# --------------------------------------------------------------------------- + +@dataclass +class Session: + id: str + title: str = "New chat" + cwd: str = "" + created_at: float = field(default_factory=time.time) + updated_at: float = field(default_factory=time.time) + messages: List[dict] = field(default_factory=list) + msg_seq: int = 0 + partial: Optional[dict] = None + status: str = "idle" # idle|running|error|cancelled + agent: Any = None + thread: Optional[threading.Thread] = None + cancel_requested: bool = False + last_error: str = "" + + +class AgentManager: + def __init__(self): + self.lock = threading.RLock() + self.ga_root = str(DEFAULT_GA_ROOT) + self.config: Dict[str, Any] = {} + self.sessions: Dict[str, Session] = {} + self.active_session_id: Optional[str] = None + + @property + def mykey_path(self) -> str: + return str(Path(self.ga_root) / "mykey.txt") + + def ensure_ga_import_path(self) -> Path: + root = Path(self.ga_root).resolve() + if str(root) not in sys.path: + sys.path.insert(0, str(root)) + return root + + def make_agent(self, sess: Session): + root = self.ensure_ga_import_path() + old_cwd = os.getcwd() + try: + os.chdir(sess.cwd or str(root)) + agentmain = importlib.import_module("agentmain") + GA = getattr(agentmain, "GenericAgent") + agent = GA() + agent.inc_out = True + agent.verbose = True + threading.Thread(target=agent.run, daemon=True, name=f"GA-{sess.id}").start() + return agent + finally: + with contextlib.suppress(Exception): + os.chdir(old_cwd) + + def list_model_profiles(self): + self.ensure_ga_import_path() + try: + agentmain = importlib.import_module("agentmain") + agent = agentmain.GenericAgent() + if hasattr(agent, "list_llms"): + return [{"id": i, "name": name, "active": active} for i, name, active in agent.list_llms()] + except Exception as e: + print(f"get model profiles failed: {e}", file=sys.stderr) + return [] + + def snapshot(self, sess: Session, include_messages: bool = True) -> dict: + out = { + "sessionId": sess.id, + "id": sess.id, + "title": sess.title, + "cwd": sess.cwd, + "status": sess.status, + "createdAt": sess.created_at, + "updatedAt": sess.updated_at, + "lastError": sess.last_error, + "msgSeq": sess.msg_seq, + } + if include_messages: + out["messages"] = list(sess.messages) + out["partial"] = dict(sess.partial) if sess.partial else None + return out + + def add_message(self, sess: Session, role: str, content: str, **extra) -> dict: + sess.msg_seq += 1 + msg = {"id": sess.msg_seq, "role": role, "content": content, "ts": time.time()} + msg.update(extra) + sess.messages.append(msg) + sess.updated_at = time.time() + if role == "user" and content.strip() and sess.title == "New chat": + sess.title = content.strip().replace("\n", " ")[:40] + return msg + + def create_session(self, cwd: Optional[str] = None) -> Session: + sid = "sess-" + uuid.uuid4().hex[:12] + sess = Session(id=sid, cwd=str(cwd or self.ga_root)) + with self.lock: + self.sessions[sid] = sess + self.active_session_id = sid + emit_session_state(sess, "created") + return sess + + def get_session(self, sid: str) -> Session: + with self.lock: + sess = self.sessions.get(sid) + if not sess: + raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json") + return sess + + def delete_session(self, sid: str) -> dict: + with self.lock: + sess = self.sessions.pop(sid, None) + if not sess: + raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json") + if self.active_session_id == sid: + self.active_session_id = next(iter(self.sessions), None) + if sess.agent and hasattr(sess.agent, "cancel"): + with contextlib.suppress(Exception): + sess.agent.cancel() + emit_session_state(sess, "closed") + return {"ok": True, "sessionId": sid} + + def submit_prompt(self, sid: str, prompt: Any, images: Optional[list] = None) -> dict: + prompt, image_ids = normalize_prompt(prompt, images) + with self.lock: + sess = self.sessions.get(sid) + if not sess: + raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json") + if sess.status == "running": + raise web.HTTPConflict(text=json.dumps({"error": "session is already running"}, ensure_ascii=False), content_type="application/json") + extra = {} + if image_ids: + extra["image_ids"] = image_ids + user_msg = self.add_message(sess, "user", prompt, **extra) + sess.status = "running" + sess.cancel_requested = False + sess.last_error = "" + sess.partial = {"id": sess.msg_seq + 1, "role": "assistant", "content": "", "ts": time.time(), "partial": True} + t = threading.Thread(target=self.run_agent_turn, args=(sess, prompt, None), daemon=True, name=f"Turn-{sid}") + sess.thread = t + t.start() + seq = sess.msg_seq + emit_session_state(sess, "running") + return {"ok": True, "sessionId": sid, "accepted": True, "userMessageId": user_msg["id"], "seq": seq} + + def run_agent_turn(self, sess: Session, prompt: str, images: Optional[list] = None): + try: + if sess.agent is None: + sess.agent = self.make_agent(sess) + agent = sess.agent + full = "" + if hasattr(agent, "put_task"): + display_q = agent.put_task(prompt, images=images or []) + pieces = [] + while True: + item = display_q.get() + if isinstance(item, dict): + if item.get("next"): + text = str(item["next"]) + pieces.append(text) + with self.lock: + if sess.partial is not None: + sess.partial["content"] = "".join(pieces) if getattr(agent, "inc_out", False) else text + sess.partial["ts"] = time.time() + sess.updated_at = time.time() + if "done" in item: + full = str(item.get("done") or "") + break + else: + pieces.append(str(item)) + if not full and pieces: + full = pieces[-1] if not getattr(agent, "inc_out", False) else "".join(pieces) + elif hasattr(agent, "run"): + ret = agent.run(prompt) + if isinstance(ret, str): + full = ret + else: + full = "GenericAgent object has no put_task/run method" + if not full: + full = "(completed)" + with self.lock: + sess.partial = None + # Strip trailing [Info] Final response to user. marker + import re as _re + full = _re.sub(r'\n*`{5}\n*\[Info\] Final response to user\.\n*`{5}\s*$', '', full) + self.add_message(sess, "assistant", full) + sess.status = "idle" + sess.last_error = "" + emit_session_state(sess, "idle") + except Exception as e: + tb = traceback.format_exc() + with self.lock: + sess.partial = None + sess.status = "error" + sess.last_error = str(e) + self.add_message(sess, "error", str(e)) + print(tb, file=sys.stderr) + emit_session_state(sess, "error") + + def messages(self, sid: str, after: int = 0, limit: int = 200) -> dict: + with self.lock: + sess = self.sessions.get(sid) + if not sess: + raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json") + msgs = [m for m in sess.messages if int(m.get("id", 0)) > after] + if limit > 0: + msgs = msgs[-limit:] + return { + "sessionId": sid, + "status": sess.status, + "messages": msgs, + "partial": dict(sess.partial) if sess.partial else None, + "msgSeq": sess.msg_seq, + "updatedAt": sess.updated_at, + "lastError": sess.last_error, + } + + def cancel(self, sid: str) -> dict: + with self.lock: + sess = self.sessions.get(sid) + if not sess: + raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json") + sess.cancel_requested = True + if sess.agent and hasattr(sess.agent, "cancel"): + with contextlib.suppress(Exception): + sess.agent.cancel() + sess.status = "cancelled" + sess.partial = None + sess.updated_at = time.time() + emit_session_state(sess, "cancelled") + return {"ok": True, "sessionId": sid} + + +import base64 +import tempfile + +# Shared temp dir for image uploads (persists for process lifetime) +_UPLOAD_DIR = Path(tempfile.gettempdir()) / "ga_web2_uploads" +_UPLOAD_DIR.mkdir(parents=True, exist_ok=True) + + +def _save_image_data(data_url: str, img_id: str) -> str: + """Save a data URL to disk, return absolute path.""" + # data:image/png;base64,xxxxx + if "," in data_url: + header, b64 = data_url.split(",", 1) + else: + b64 = data_url + header = "" + ext = "png" + if "jpeg" in header or "jpg" in header: + ext = "jpg" + elif "webp" in header: + ext = "webp" + elif "gif" in header: + ext = "gif" + fpath = _UPLOAD_DIR / f"{img_id}.{ext}" + fpath.write_bytes(base64.b64decode(b64)) + return str(fpath) + + +def normalize_prompt(prompt: Any, images: Optional[list] = None): + """Normalize prompt and images. + + images: list of dicts {"id": "img-xxx", "dataUrl": "data:..."} or plain data URLs. + Returns: (prompt_text_with_image_tags, image_ids_list) + """ + images = list(images or []) + if isinstance(prompt, list): + text_parts = [] + for part in prompt: + if isinstance(part, str): + text_parts.append(part) + elif isinstance(part, dict): + if part.get("type") in ("text", "input_text"): + text_parts.append(str(part.get("text") or part.get("content") or "")) + elif part.get("type") in ("image", "input_image"): + url = part.get("image_url") or part.get("url") or part.get("data") + if isinstance(url, dict): + url = url.get("url") + if url: + images.append(url) + prompt = "\n".join([p for p in text_parts if p]) + + # Process images: save to disk, build [image:path] tags + image_ids = [] + image_tags = [] + for img in images: + if isinstance(img, dict): + img_id = img.get("id") or f"img-{uuid.uuid4().hex[:8]}" + data_url = img.get("dataUrl") or img.get("data_url") or "" + else: + # Plain data URL string + img_id = f"img-{uuid.uuid4().hex[:8]}" + data_url = str(img) + if data_url: + path = _save_image_data(data_url, img_id) + image_tags.append(f"[image:{path}]") + image_ids.append(img_id) + + # Append image tags to prompt + final_prompt = str(prompt or "") + if image_tags: + final_prompt = final_prompt + "\n" + "\n".join(image_tags) + + return final_prompt, image_ids + + +manager = AgentManager() + + +# --------------------------------------------------------------------------- +# Transport layer: WS notification only +# --------------------------------------------------------------------------- + +class WsHub: + def __init__(self): + self.websockets: Set[web.WebSocketResponse] = set() + self.loop: Optional[asyncio.AbstractEventLoop] = None + + def emit(self, obj: dict): + if self.loop and self.loop.is_running(): + asyncio.run_coroutine_threadsafe(self._broadcast(obj), self.loop) + + async def _broadcast(self, obj: dict): + data = json.dumps(obj, ensure_ascii=False, default=str) + dead = set() + for ws in list(self.websockets): + try: + await ws.send_str(data) + except Exception: + dead.add(ws) + self.websockets.difference_update(dead) + + +hub = WsHub() + + +def emit_session_state(sess: Session, state_name: str): + hub.emit({ + "type": "session-state", + "sessionId": sess.id, + "state": state_name, + "status": sess.status, + "seq": sess.msg_seq, + "updatedAt": sess.updated_at, + "title": sess.title, + }) + + +async def ws_handler(request): + ws = web.WebSocketResponse(heartbeat=30) + await ws.prepare(request) + hub.websockets.add(ws) + await ws.send_str(json.dumps({ + "type": "bridge-ready", + "gaRoot": manager.ga_root, + "mykeyPath": manager.mykey_path, + "http": True, + "wsEventsOnly": True, + }, ensure_ascii=False)) + async for msg in ws: + if msg.type == WSMsgType.TEXT: + # WS is intentionally not a data/command channel anymore. + with contextlib.suppress(Exception): + data = json.loads(msg.data) + if data.get("action") == "ping": + await ws.send_str(json.dumps({"type": "pong", "ts": time.time()}, ensure_ascii=False)) + hub.websockets.discard(ws) + return ws + + +# --------------------------------------------------------------------------- +# Transport layer: HTTP command/data API +# --------------------------------------------------------------------------- + +def cors_headers(): + return { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET,POST,DELETE,OPTIONS", + "Access-Control-Allow-Headers": "Content-Type", + } + + +@web.middleware +async def cors_middleware(request, handler): + if request.method == "OPTIONS": + return web.Response(status=204, headers=cors_headers()) + resp = await handler(request) + for k, v in cors_headers().items(): + resp.headers[k] = v + return resp + + +def json_ok(data: dict, status: int = 200): + return web.json_response(data, status=status, headers=cors_headers(), dumps=lambda x: json.dumps(x, ensure_ascii=False, default=str)) + + +async def read_json(request) -> dict: + if request.can_read_body: + try: + data = await request.json() + return data if isinstance(data, dict) else {} + except Exception: + return {} + return {} + + +async def status_handler(request): + return json_ok({ + "ok": True, + "running": True, + "ready": True, + "gaRoot": manager.ga_root, + "mykeyPath": manager.mykey_path, + "sessionCount": len(manager.sessions), + "activeSessionId": manager.active_session_id, + "ws": "/ws", + "transport": {"http": True, "wsEventsOnly": True}, + }) + + +async def get_config_handler(request): + return json_ok({"gaRoot": manager.ga_root, "mykeyPath": manager.mykey_path, "config": manager.config}) + + +async def save_config_handler(request): + data = await read_json(request) + cfg = data.get("config", data) + if isinstance(cfg, dict): + manager.config.update(cfg) + return json_ok({"ok": True, "gaRoot": manager.ga_root, "mykeyPath": manager.mykey_path, "config": manager.config}) + + +async def model_profiles_handler(request): + return json_ok({"profiles": manager.list_model_profiles()}) + + +async def list_sessions_handler(request): + with manager.lock: + sessions = [manager.snapshot(s, include_messages=False) for s in manager.sessions.values()] + return json_ok({"sessions": sessions, "activeSessionId": manager.active_session_id}) + + +async def new_session_handler(request): + data = await read_json(request) + sess = manager.create_session(cwd=data.get("cwd") or data.get("path")) + return json_ok({"ok": True, "sessionId": sess.id, "session": manager.snapshot(sess)}, status=201) + + +async def get_session_handler(request): + sid = request.match_info["sid"] + sess = manager.get_session(sid) + return json_ok({"sessionId": sid, "session": manager.snapshot(sess), "messages": list(sess.messages), "partial": sess.partial}) + + +async def delete_session_handler(request): + sid = request.match_info["sid"] + return json_ok(manager.delete_session(sid)) + + +async def prompt_handler(request): + sid = request.match_info["sid"] + data = await read_json(request) + prompt = data.get("prompt", data.get("content", data.get("message", ""))) + images = data.get("images") or [] + return json_ok(manager.submit_prompt(sid, prompt, images)) + + +async def messages_handler(request): + sid = request.match_info["sid"] + after = int(request.query.get("after") or request.query.get("afterId") or 0) + limit = int(request.query.get("limit") or 200) + return json_ok(manager.messages(sid, after=after, limit=limit)) + + +async def cancel_handler(request): + sid = request.match_info["sid"] + return json_ok(manager.cancel(sid)) + + +async def path_open_handler(request): + data = await read_json(request) + kind = data.get("kind", "") + if kind == "mykey": + target = Path(manager.ga_root) / "mykey.py" + else: + target = Path(data.get("path") or data.get("target") or manager.ga_root) + target = target.resolve() + if not target.exists(): + return json_ok({"ok": False, "error": f"File not found: {target}"}) + # Actually open the file with the system default editor + import subprocess, platform + if platform.system() == "Windows": + os.startfile(str(target)) + elif platform.system() == "Darwin": + subprocess.Popen(["open", str(target)]) + else: + subprocess.Popen(["xdg-open", str(target)]) + return json_ok({"ok": True, "path": str(target)}) + + +def create_app(): + app = web.Application(middlewares=[cors_middleware]) + app.router.add_get("/ws", ws_handler) + app.router.add_get("/status", status_handler) + app.router.add_get("/config", get_config_handler) + app.router.add_post("/config", save_config_handler) + app.router.add_get("/model-profiles", model_profiles_handler) + app.router.add_get("/sessions", list_sessions_handler) + app.router.add_post("/session/new", new_session_handler) + app.router.add_get("/session/{sid}", get_session_handler) + app.router.add_delete("/session/{sid}", delete_session_handler) + app.router.add_post("/session/{sid}/prompt", prompt_handler) + app.router.add_get("/session/{sid}/messages", messages_handler) + app.router.add_post("/session/{sid}/cancel", cancel_handler) + app.router.add_post("/path/open", path_open_handler) + + # Serve static frontend (desktop/static/) + static_dir = APP_DIR / "desktop" / "static" + + async def index_handler(request): + return web.FileResponse(static_dir / "index.html") + + app.router.add_get("/", index_handler) + app.router.add_static("/", static_dir, show_index=False) + + async def on_startup(app): + hub.loop = asyncio.get_running_loop() + + app.on_startup.append(on_startup) + return app + + +if __name__ == "__main__": + host = os.environ.get("BRIDGE_HOST", "127.0.0.1") + port = int(os.environ.get("BRIDGE_PORT", "14168")) + print(f"GenericAgent Web2 bridge: http://{host}:{port} ws://{host}:{port}/ws", file=sys.stderr) + web.run_app(create_app(), host=host, port=port, print=None)