diff --git a/.github/plugin-sdk-host-only.txt b/.github/plugin-sdk-host-only.txt index 5fb59049..c8b7cf8d 100644 --- a/.github/plugin-sdk-host-only.txt +++ b/.github/plugin-sdk-host-only.txt @@ -13,3 +13,4 @@ a8c6206be3e56e692e709c36f92c4245e5b632a8 function interface declarations are par 1ecbfc9bbb489b5d7b289a39ea85e1e6c56d3cd1 check_declared_interfaces is a test helper for plugin tests 2c172d8a6871ca3ca3d56847a97652ed1f618501 read_to_end is an additive helper that no published plugin calls, so their builds behave the same 7d76e1b7e1c085de28892e6fda25faeb8efa18af the native file_size error code only affects unit tests, not WASM builds +6b92ab9c80b28d1795aa6d28c264c88816d82f42 clipboard.writeImage is provided by the host at runtime; plugin packages do not bundle the UI SDK diff --git a/Cargo.lock b/Cargo.lock index 5ead1dbc..f414d6fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -561,6 +561,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -689,7 +695,7 @@ dependencies = [ "arrayvec", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.4.2", "cpufeatures 0.3.1", ] @@ -970,6 +976,68 @@ dependencies = [ "serde_core", ] +[[package]] +name = "candle-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11c8be87cfbaef9ebb62fb3f850d1fc8e00cc1d11d393fdbe55a4d5c2cdb325" +dependencies = [ + "byteorder", + "float8", + "gemm", + "half", + "libc", + "libm", + "memmap2", + "num-traits", + "num_cpus", + "parking_lot", + "rand 0.9.5", + "rand_distr 0.5.1", + "rayon", + "safetensors", + "thiserror 2.0.20", + "tokenizers", + "yoke", + "zerocopy", + "zip 9.9.0", +] + +[[package]] +name = "candle-nn" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "437fabe77547c2447c7bdf3cc946e19db29a2832440176b419f77c80b0a9a05e" +dependencies = [ + "candle-core", + "half", + "libc", + "num-traits", + "rayon", + "safetensors", + "serde", + "thiserror 2.0.20", +] + +[[package]] +name = "candle-transformers" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b1e1abeac23d7df4f94e8a3852b3dbb661d332e37c3bef479507bac867187b2" +dependencies = [ + "byteorder", + "candle-core", + "candle-nn", + "fancy-regex 0.19.2", + "num-traits", + "rand 0.9.5", + "rayon", + "serde", + "serde_json", + "serde_plain", + "tracing", +] + [[package]] name = "cap-primitives" version = "4.0.3" @@ -1021,6 +1089,15 @@ dependencies = [ "toml 0.9.12+spec-1.1.0", ] +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cbc" version = "0.1.2" @@ -1262,6 +1339,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "compact_str" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "serde", + "static_assertions", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1309,6 +1401,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" +[[package]] +name = "constant_time_eq" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144e7f1de087984240b7816d47f698b414979faa6f40839c5b86d6bd47db57b7" +dependencies = [ + "rustversion", +] + [[package]] name = "cookie" version = "0.18.2" @@ -1789,6 +1890,12 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "daachorse" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5614204febbc33cc07a2806aa6440b904ac012b68eecc37f4493ea4a76455a3d" + [[package]] name = "darling" version = "0.20.11" @@ -1858,6 +1965,15 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "dary_heap" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1e3a325bc115f096c8b77bbf027a7c2592230e70be2d985be950d3d5e60ebe" +dependencies = [ + "serde", +] + [[package]] name = "data-encoding" version = "2.11.1" @@ -2234,6 +2350,22 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fdab65db9274e0168143841eb8f864a0a21f8b1b8d2ba6812bbe6024346e99e" +[[package]] +name = "dyn-stack" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8" +dependencies = [ + "bytemuck", + "dyn-stack-macros", +] + +[[package]] +name = "dyn-stack-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9" + [[package]] name = "ecb" version = "0.1.2" @@ -2379,6 +2511,18 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -2433,6 +2577,12 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" +[[package]] +name = "esaxx-rs" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d817e038c30374a4bcb22f94d0a8a0e216958d4c3dcde369b1439fec4bdda6e6" + [[package]] name = "euclid" version = "0.22.14" @@ -2480,6 +2630,17 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +[[package]] +name = "fancy-regex" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72cf461f865c862bb7dc573f643dd6a2b6842f7c30b07882b56bd148cc2761b8" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax", +] + [[package]] name = "fancy-regex" version = "0.19.2" @@ -2605,6 +2766,18 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" +[[package]] +name = "float8" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d1f04709a8ac06e8e8042875a3c466cc4832d3c1a18dbcb9dba3c6e83046bc" +dependencies = [ + "half", + "num-traits", + "rand 0.9.5", + "rand_distr 0.5.1", +] + [[package]] name = "fluent-uri" version = "0.4.1" @@ -2950,6 +3123,125 @@ dependencies = [ "x11", ] +[[package]] +name = "gemm" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb" +dependencies = [ + "dyn-stack", + "gemm-c32", + "gemm-c64", + "gemm-common", + "gemm-f16", + "gemm-f32", + "gemm-f64", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-common" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e" +dependencies = [ + "bytemuck", + "dyn-stack", + "half", + "libm", + "num-complex", + "num-traits", + "once_cell", + "paste", + "pulp", + "raw-cpuid", + "rayon", + "seq-macro", + "sysctl", +] + +[[package]] +name = "gemm-f16" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e" +dependencies = [ + "dyn-stack", + "gemm-common", + "gemm-f32", + "half", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "rayon", + "seq-macro", +] + +[[package]] +name = "gemm-f32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-f64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -3280,9 +3572,12 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ + "bytemuck", "cfg-if", "crunchy", "num-traits", + "rand 0.9.5", + "rand_distr 0.5.1", "zerocopy", ] @@ -3313,7 +3608,11 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.2.0", + "serde", + "serde_core", ] [[package]] @@ -4302,7 +4601,7 @@ dependencies = [ "bytecount", "data-encoding", "email_address", - "fancy-regex", + "fancy-regex 0.19.2", "fraction", "getrandom 0.3.4", "idna", @@ -4339,7 +4638,7 @@ version = "0.58.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf3ebe067f2c25a981a7d1b2f696fc213e10dbf80ba5fe997f7dc2e4fe261f26" dependencies = [ - "fancy-regex", + "fancy-regex 0.19.2", "indexmap 2.14.2", "jsonschema-regex", "percent-encoding", @@ -4833,6 +5132,22 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "macro_rules_attribute" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ae8f6d608c795738406608304d30a2dfbdc8e58e44f7ba43236da5208ded3c" +dependencies = [ + "macro_rules_attribute-proc_macro", + "pastey", +] + +[[package]] +name = "macro_rules_attribute-proc_macro" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc04a4c58212d57930a24bf47d3fa87485264a3a054e9c10e042eb373573ad3c" + [[package]] name = "maplit" version = "1.0.2" @@ -4908,6 +5223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" dependencies = [ "libc", + "stable_deref_trait", ] [[package]] @@ -4925,6 +5241,23 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mermaid-rs-renderer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb5b469222ce6b9896edf0a969cf68464f5a028ef394fd6643f00bd943df117" +dependencies = [ + "anyhow", + "fontdb", + "json5", + "once_cell", + "regex", + "serde", + "serde_json", + "thiserror 2.0.20", + "ttf-parser", +] + [[package]] name = "micromap" version = "0.3.0" @@ -5039,6 +5372,28 @@ dependencies = [ "uuid", ] +[[package]] +name = "monostate" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67" +dependencies = [ + "monostate-impl", + "serde", + "serde_core", +] + +[[package]] +name = "monostate-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "moxcms" version = "0.8.1" @@ -5344,6 +5699,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ + "bytemuck", "num-traits", ] @@ -5404,6 +5760,16 @@ dependencies = [ "libm", ] +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.7.6" @@ -6502,6 +6868,15 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" +[[package]] +name = "pulldown-latex" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cf850381ae0dbb131f36e31d6090f55363d079ab3e518ad0323b9cb6a96d115" +dependencies = [ + "bumpalo", +] + [[package]] name = "pulley-interpreter" version = "49.0.3" @@ -6525,6 +6900,29 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "pulp" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "paste", + "pulp-wasm-simd-flag", + "raw-cpuid", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp-wasm-simd-flag" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" + [[package]] name = "pxfm" version = "0.1.30" @@ -6665,6 +7063,16 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "rand_distr" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" +dependencies = [ + "num-traits", + "rand 0.9.5", +] + [[package]] name = "rand_distr" version = "0.6.0" @@ -6681,6 +7089,15 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d" +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags 2.13.2", +] + [[package]] name = "raw-window-handle" version = "0.6.2" @@ -6703,6 +7120,17 @@ dependencies = [ "rayon-core", ] +[[package]] +name = "rayon-cond" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964d0cf57a3e7a06e8183d14a8b527195c706b7983549cd5462d5aa3747438f" +dependencies = [ + "either", + "itertools 0.14.0", + "rayon", +] + [[package]] name = "rayon-core" version = "1.13.0" @@ -6737,6 +7165,12 @@ dependencies = [ "font-types", ] +[[package]] +name = "reborrow" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" + [[package]] name = "redox_syscall" version = "0.5.18" @@ -7251,6 +7685,19 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "safetensors" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b079b829cb27a1c3c374341345ed2e8b2c0c839034522cee576c140bd7f846" +dependencies = [ + "hashbrown 0.16.1", + "libc", + "serde", + "serde_json", + "tempfile", +] + [[package]] name = "same-file" version = "1.0.6" @@ -7531,6 +7978,15 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + [[package]] name = "serde_repr" version = "0.1.21" @@ -7973,6 +8429,18 @@ dependencies = [ "der", ] +[[package]] +name = "spm_precompiled" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326" +dependencies = [ + "base64 0.13.1", + "nom 7.1.3", + "serde", + "unicode-segmentation", +] + [[package]] name = "sponge-cursor" version = "0.1.0" @@ -8058,6 +8526,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strength_reduce" version = "0.2.4" @@ -8276,6 +8750,20 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "sysctl" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "enum-as-inner", + "libc", + "thiserror 1.0.69", + "walkdir", +] + [[package]] name = "sysinfo" version = "0.39.6" @@ -9242,6 +9730,18 @@ dependencies = [ "tf-plugin-guest", ] +[[package]] +name = "tfm-domain-lookup" +version = "0.1.0" +dependencies = [ + "idna", + "serde", + "serde_json", + "tf-plugin-api", + "tf-plugin-guest", + "tiny_http", +] + [[package]] name = "tfm-domain-toolbox" version = "0.1.0" @@ -9851,7 +10351,9 @@ dependencies = [ name = "tfm-markdown-editor" version = "0.1.0" dependencies = [ + "mermaid-rs-renderer", "pulldown-cmark", + "pulldown-latex", "serde", "serde_json", "tf-plugin-api", @@ -10232,7 +10734,7 @@ dependencies = [ name = "tfm-regex" version = "0.1.0" dependencies = [ - "fancy-regex", + "fancy-regex 0.19.2", "serde", "serde_json", "tf-plugin-api", @@ -10727,6 +11229,18 @@ dependencies = [ "tf-plugin-guest", ] +[[package]] +name = "tfp-ai-writer" +version = "0.1.0" +dependencies = [ + "candle-core", + "candle-transformers", + "fancy-regex 0.19.2", + "serde", + "serde_json", + "tf-plugin-api", +] + [[package]] name = "tfp-archive" version = "0.1.0" @@ -11212,6 +11726,39 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" +[[package]] +name = "tokenizers" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7afbf6e88718afcc138bad01d6ccc3051dbbc3b2ce9793d8b8a3aeb610969cfc" +dependencies = [ + "ahash", + "compact_str", + "daachorse", + "dary_heap", + "derive_builder", + "esaxx-rs", + "fancy-regex 0.17.0", + "getrandom 0.3.4", + "itertools 0.14.0", + "log", + "macro_rules_attribute", + "monostate", + "paste", + "rand 0.9.5", + "rayon", + "rayon-cond", + "regex", + "regex-syntax", + "serde", + "serde_json", + "spm_precompiled", + "thiserror 2.0.20", + "unicode-normalization-alignments", + "unicode-segmentation", + "unicode_categories", +] + [[package]] name = "tokio" version = "1.53.1" @@ -11408,6 +11955,7 @@ dependencies = [ "tf-package", "tf-plugin-api", "tf-wasm", + "tfp-ai-writer", "tfp-archive", "tfp-background-remover", "tfp-barcode", @@ -11680,7 +12228,7 @@ dependencies = [ "getrandom 0.4.3", "log", "rand 0.10.3", - "rand_distr", + "rand_distr 0.6.0", "rustfft", "tract-extra", "tract-nnef", @@ -11821,6 +12369,12 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" name = "typed-path" version = "0.12.3" +[[package]] +name = "typed-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" + [[package]] name = "typeid" version = "1.0.3" @@ -11955,6 +12509,15 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-normalization-alignments" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f613e4fa046e69818dd287fdc4bc78175ff20331479dab6e1b0f98d57062de" +dependencies = [ + "smallvec", +] + [[package]] name = "unicode-properties" version = "0.1.4" @@ -14000,7 +14563,7 @@ checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" dependencies = [ "aes 0.9.3", "bzip2", - "constant_time_eq", + "constant_time_eq 0.4.2", "crc32fast", "deflate64", "flate2", @@ -14011,11 +14574,29 @@ dependencies = [ "memchr", "pbkdf2 0.13.0", "sha1 0.11.0", - "typed-path", + "typed-path 0.12.3", "zeroize", "zopfli", ] +[[package]] +name = "zip" +version = "9.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07db37dec4a7c468df4723fba4cadb4822d1d0f10dbea367100b6a6881b2a9c9" +dependencies = [ + "constant_time_eq 0.6.2", + "crc32fast", + "getrandom 0.4.3", + "indexmap 2.14.2", + "libc", + "memchr", + "nix", + "typed-path 0.13.0", + "windows-sys 0.61.2", + "zeroize", +] + [[package]] name = "zlib-rs" version = "0.6.8" diff --git a/Cargo.toml b/Cargo.toml index cdfabd88..588fc1d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ tf-plugin-api = { path = "crates/tf-plugin-api" } tf-net = { path = "crates/tf-net" } tf-package = { path = "crates/tf-package" } tf-wasm = { path = "crates/tf-wasm" } +tfp-ai-writer = { path = "plugins/ai-writer/backend" } tfp-archive = { path = "plugins/archive/backend" } tfp-background-remover = { path = "plugins/background-remover/backend" } tfp-barcode = { path = "plugins/barcode/backend" } @@ -88,6 +89,21 @@ opt-level = 3 opt-level = 3 [profile.dev.package.tract-onnx-opl] opt-level = 3 +# 本地语言模型推理(candle 与 gemm) +[profile.dev.package.candle-core] +opt-level = 3 +[profile.dev.package.candle-nn] +opt-level = 3 +[profile.dev.package.candle-transformers] +opt-level = 3 +[profile.dev.package.gemm] +opt-level = 3 +[profile.dev.package.gemm-common] +opt-level = 3 +[profile.dev.package.gemm-f32] +opt-level = 3 +[profile.dev.package.gemm-f16] +opt-level = 3 [profile.dev.package.image] opt-level = 3 [profile.dev.package.png] @@ -117,6 +133,21 @@ opt-level = 3 opt-level = 3 [profile.release.package.tract-onnx-opl] opt-level = 3 +# 本地语言模型推理(candle 与 gemm) +[profile.release.package.candle-core] +opt-level = 3 +[profile.release.package.candle-nn] +opt-level = 3 +[profile.release.package.candle-transformers] +opt-level = 3 +[profile.release.package.gemm] +opt-level = 3 +[profile.release.package.gemm-common] +opt-level = 3 +[profile.release.package.gemm-f32] +opt-level = 3 +[profile.release.package.gemm-f16] +opt-level = 3 [profile.release.package.image] opt-level = 3 [profile.release.package.png] diff --git a/README.md b/README.md index 65265d8d..6b92d4db 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ and the modern interface supports light / dark themes, Chinese and English, and | **Barcode** | Generate EAN-13, EAN-8, UPC-A, ITF-14, Code 128, Code 39, Code 93, Codabar, Data Matrix, PDF417 and Aztec codes; retail check digits are added or verified automatically, EAN/UPC are drawn with guard bars and grouped digits; save as SVG or PNG, and read every barcode in an image or a clipboard screenshot | | **Background Remover** | Remove image backgrounds with a local AI model (U²-Net lite or IS-Net) running in Rust; models download on first use with resume and SHA-256 verification; transparent PNG or a solid color | | **OCR** | Extract Chinese and English text from images, screenshots and PDFs with PaddleOCR PP-OCRv4 models running in Rust (about 15 MB, downloaded on first use); paste screenshots with ⌘V, see recognized boxes and copy lines; PDFs are rendered and recognized page by page (up to 200 pages) | +| **AI Writing Assistant** | Polish, proofread, rewrite, shorten, expand, summarize, translate or apply your own instruction with Qwen2.5 Instruct (0.5B or 1.5B, GGUF) running locally in Rust; models download on first use with resume and SHA-256 verification, output streams as it is written, and text never leaves your computer | | **WebSocket Client** | Connect to ws:// and wss:// servers with custom headers and subprotocols, watch every received and sent frame live, format JSON, and send text, hex / base64 binary or pings with saved snippets | | **DNS Lookup** | A / AAAA / CNAME / MX / TXT / NS / SOA / SRV / CAA / PTR records from the system resolver or public DNS, compared side by side with timings; flags proxy fake IPs | | **Port Manager** | See which process listens on each TCP / UDP port (with user, memory and command line), search, stop the process, and check remote ports in parallel with latency and failure reasons | diff --git a/README.zh-CN.md b/README.zh-CN.md index 89ca5ffb..d33e2ccb 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -50,6 +50,7 @@ | **条形码** | 生成 EAN-13、EAN-8、UPC-A、ITF-14、Code 128、Code 39、Code 93、Codabar 以及 Data Matrix、PDF417、Aztec,商品码自动补全或核对校验位,EAN/UPC 按标准绘制护线与分组数字;保存为 SVG 或 PNG,可识别图片或剪贴板截图中的所有条码 | | **去除背景** | 使用本地 AI 模型(U²-Net 轻量版或 IS-Net)在 Rust 中抠图;模型首次使用时下载,支持续传与 SHA-256 校验;输出透明 PNG 或纯色背景 | | **文字识别** | 使用 PaddleOCR PP-OCRv4 模型在 Rust 中离线识别图片、截图与 PDF 中的中英文文字(首次使用下载约 15 MB 模型);支持 ⌘V 粘贴截图,显示文字框并可点击复制单行;PDF 逐页渲染识别(最多 200 页) | +| **AI 写作助手** | 在 Rust 中本地运行 Qwen2.5 Instruct(0.5B 或 1.5B,GGUF 量化)润色、纠错、改写、精简、扩写、摘要、翻译或按自定义指令处理文本;模型首次使用时下载,支持续传与 SHA-256 校验,结果边生成边显示,文本不离开本机 | | **WebSocket 客户端** | 连接 ws:// 与 wss:// 服务,可设置请求头与子协议,实时查看收发的每一帧并格式化 JSON,发送文本、十六进制 / Base64 二进制或 Ping,支持保存常用片段 | | **DNS 查询** | 通过系统解析器或公共 DNS 查询 A / AAAA / CNAME / MX / TXT / NS / SOA / SRV / CAA / PTR 记录,并排对比结果与耗时;识别代理的 fake-ip | | **端口管理** | 查看每个 TCP / UDP 端口被哪个进程占用(含用户、内存与命令行),支持搜索与结束进程;并行检查远程端口是否可达并显示延迟与失败原因 | diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index fd9c37dd..9e22b8e3 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -37,6 +37,7 @@ httpdate = "1" tf-wasm.workspace = true tf-plugin-api.workspace = true tfp-archive.workspace = true +tfp-ai-writer.workspace = true tfp-background-remover.workspace = true tfp-barcode.workspace = true tfp-batch-rename.workspace = true diff --git a/apps/desktop/src-tauri/src/commands.rs b/apps/desktop/src-tauri/src/commands.rs index 8f3eca0b..dd22963e 100644 --- a/apps/desktop/src-tauri/src/commands.rs +++ b/apps/desktop/src-tauri/src/commands.rs @@ -237,6 +237,35 @@ pub async fn fs_read_text(path: String) -> AppResult { .map_err(|e| AppError::new("fs.io").with("detail", e.to_string()))? } +/// 解码要写入剪贴板的 PNG;损坏或不是 PNG 时返回可翻译的错误码 +pub fn png_image(bytes: &[u8]) -> AppResult> { + tauri::image::Image::from_bytes(bytes) + .map(|image| image.to_owned()) + .map_err(|e| AppError::new("clipboard.bad_image").with("detail", e.to_string())) +} + +/// 把 PNG 图片写入剪贴板(插件导出长图等)。请求体直接是 PNG 字节: +/// 几 MB 的图片若作为 JSON 数组参数传递,序列化本身就要数秒 +#[tauri::command] +pub async fn clipboard_write_png( + app: tauri::AppHandle, + request: tauri::ipc::Request<'_>, +) -> AppResult<()> { + use tauri_plugin_clipboard_manager::ClipboardExt; + let tauri::ipc::InvokeBody::Raw(bytes) = request.body() else { + return Err(AppError::new("clipboard.bad_image").with("detail", "expected raw PNG bytes")); + }; + let bytes = bytes.clone(); + tauri::async_runtime::spawn_blocking(move || { + let image = png_image(&bytes)?; + app.clipboard() + .write_image(&image) + .map_err(|e| AppError::new("clipboard.write_failed").with("detail", e.to_string())) + }) + .await + .map_err(|e| AppError::new("clipboard.write_failed").with("detail", e.to_string()))? +} + /// 写入用户通过保存对话框选择的文件 #[tauri::command] pub async fn fs_write_text(path: String, text: String) -> AppResult<()> { @@ -244,3 +273,7 @@ pub async fn fs_write_text(path: String, text: String) -> AppResult<()> { .await .map_err(|e| AppError::new("fs.io").with("detail", e.to_string()))? } + +#[cfg(test)] +#[path = "commands_test.rs"] +mod tests; diff --git a/apps/desktop/src-tauri/src/commands_test.rs b/apps/desktop/src-tauri/src/commands_test.rs new file mode 100644 index 00000000..621e288c --- /dev/null +++ b/apps/desktop/src-tauri/src/commands_test.rs @@ -0,0 +1,23 @@ +use super::*; + +/// 1×1 的红色 PNG +const PIXEL: &[u8] = &[ + 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, + 0, 0, 31, 21, 196, 137, 0, 0, 0, 13, 73, 68, 65, 84, 120, 218, 99, 252, 207, 192, 240, 31, 0, + 5, 5, 2, 0, 95, 200, 241, 210, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130, +]; + +#[test] +fn png_bytes_decode_to_an_image() { + let image = png_image(PIXEL).unwrap(); + assert_eq!((image.width(), image.height()), (1, 1)); + assert_eq!(image.rgba().len(), 4); +} + +#[test] +fn broken_images_report_a_translatable_code() { + let error = png_image(b"not a png").unwrap_err(); + assert_eq!(error.code, "clipboard.bad_image"); + let truncated = png_image(&PIXEL[..PIXEL.len() / 2]).unwrap_err(); + assert_eq!(truncated.code, "clipboard.bad_image"); +} diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index aed8cb66..d01f2ef9 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -175,6 +175,7 @@ pub fn run() { commands::plugin_state_set, commands::fs_read_text, commands::fs_write_text, + commands::clipboard_write_png, tasks::task_start, tasks::task_cancel, tasks::task_list, diff --git a/apps/desktop/src-tauri/src/plugins.rs b/apps/desktop/src-tauri/src/plugins.rs index 16b4c0b3..8737545c 100644 --- a/apps/desktop/src-tauri/src/plugins.rs +++ b/apps/desktop/src-tauri/src/plugins.rs @@ -47,6 +47,7 @@ pub fn builtin_for(os: &str) -> PluginRegistry { registry.register_for(Arc::new(tfp_doc_converter::DocConverter::default()), os); registry.register_for(Arc::new(tfp_context_menu::ContextMenu::default()), os); registry.register_for(Arc::new(tfp_input_stats::InputStats::default()), os); + registry.register_for(Arc::new(tfp_ai_writer::AiWriter::default()), os); registry } diff --git a/apps/desktop/src/layout/Sidebar.tsx b/apps/desktop/src/layout/Sidebar.tsx index 3b99ab55..0539dc7d 100644 --- a/apps/desktop/src/layout/Sidebar.tsx +++ b/apps/desktop/src/layout/Sidebar.tsx @@ -62,12 +62,22 @@ export function Sidebar() { const openTool = useApp((s) => s.openTool) const collapsed = usePrefs((s) => s.collapsed) const toggleCategory = usePrefs((s) => s.toggleCategory) + const sidebarHidden = usePrefs((s) => s.sidebarHidden) const is = (view: Route['view']) => route.view === view const activeTool = route.view === 'tool' ? route.pluginId : null return ( -