Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
feat: ov CLI support (#1916)
MaojiaSheng9dc98aa13316
diff --git a/Cargo.lock b/Cargo.lockindex 521a0cfe5..9f8b60a76 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -40,6 +40,24 @@ dependencies = ["memchr",]+[[package]]+name = "aligned"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"+dependencies = [+ "as-slice",+]++[[package]]+name = "aligned-vec"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"+dependencies = [+ "equator",+]+[[package]]name = "allocator-api2"version = "0.2.21"@@ -61,6 +79,15 @@ version = "0.1.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"+[[package]]+name = "ansi_colours"+version = "1.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "14eec43e0298190790f41679fe69ef7a829d2a2ddd78c8c00339e84710e435fe"+dependencies = [+ "rgb",+]+[[package]]name = "anstream"version = "0.6.21"@@ -126,6 +153,32 @@ dependencies = ["derive_arbitrary",]+[[package]]+name = "arg_enum_proc_macro"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "arrayvec"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"++[[package]]+name = "as-slice"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"+dependencies = [+ "stable_deref_trait",+]+[[package]]name = "async-trait"version = "0.1.89"@@ -158,6 +211,49 @@ version = "1.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"+[[package]]+name = "av-scenechange"+version = "0.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"+dependencies = [+ "aligned",+ "anyhow",+ "arg_enum_proc_macro",+ "arrayvec",+ "log",+ "num-rational",+ "num-traits",+ "pastey",+ "rayon",+ "thiserror 2.0.18",+ "v_frame",+ "y4m",+]++[[package]]+name = "av1-grain"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"+dependencies = [+ "anyhow",+ "arrayvec",+ "log",+ "nom",+ "num-rational",+ "v_frame",+]++[[package]]+name = "avif-serialize"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"+dependencies = [+ "arrayvec",+]+[[package]]name = "aws-config"version = "1.8.15"@@ -711,6 +807,12 @@ version = "1.8.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"+[[package]]+name = "bit_field"+version = "0.10.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"+[[package]]name = "bitflags"version = "2.11.0"@@ -720,6 +822,15 @@ dependencies = ["serde_core",]+[[package]]+name = "bitstream-io"+version = "4.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"+dependencies = [+ "no_std_io2",+]+[[package]]name = "block-buffer"version = "0.10.4"@@ -740,18 +851,36 @@ dependencies = ["serde",]+[[package]]+name = "built"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"+[[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 = "byteorder-lite"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"+[[package]]name = "bytes"version = "1.11.1"@@ -947,6 +1076,12 @@ dependencies = ["cc",]+[[package]]+name = "color_quant"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"+[[package]]name = "colorchoice"version = "1.0.4"@@ -986,6 +1121,18 @@ dependencies = ["crossbeam-utils",]+[[package]]+name = "console"+version = "0.15.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8"+dependencies = [+ "encode_unicode",+ "libc",+ "once_cell",+ "windows-sys 0.59.0",+]+[[package]]name = "console"version = "0.16.3"@@ -1528,6 +1675,26 @@ version = "0.1.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"+[[package]]+name = "equator"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"+dependencies = [+ "equator-macro",+]++[[package]]+name = "equator-macro"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]+[[package]]name = "equivalent"version = "1.0.2"@@ -1572,6 +1739,21 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "exr"+version = "1.74.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"+dependencies = [+ "bit_field",+ "half",+ "lebe",+ "miniz_oxide",+ "rayon-core",+ "smallvec",+ "zune-inflate",+]+[[package]]name = "fallible-iterator"version = "0.3.0"@@ -1590,6 +1772,12 @@ version = "2.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"+[[package]]+name = "fax"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"+[[package]]name = "fd-lock"version = "4.0.4"@@ -1601,6 +1789,15 @@ dependencies = ["windows-sys 0.59.0",]+[[package]]+name = "fdeflate"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"+dependencies = [+ "simd-adler32",+]+[[package]]name = "ff"version = "0.12.1"@@ -1814,6 +2011,16 @@ dependencies = ["wasip3",]+[[package]]+name = "gif"+version = "0.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"+dependencies = [+ "color_quant",+ "weezl",+]+[[package]]name = "globset"version = "0.4.18"@@ -2379,6 +2586,46 @@ dependencies = ["winapi-util",]+[[package]]+name = "image"+version = "0.25.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"+dependencies = [+ "bytemuck",+ "byteorder-lite",+ "color_quant",+ "exr",+ "gif",+ "image-webp",+ "moxcms",+ "num-traits",+ "png",+ "qoi",+ "ravif",+ "rayon",+ "rgb",+ "tiff",+ "zune-core",+ "zune-jpeg",+]++[[package]]+name = "image-webp"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"+dependencies = [+ "byteorder-lite",+ "quick-error",+]++[[package]]+name = "imgref"+version = "1.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "40fac9d56ed6437b198fddba683305e8e2d651aa42647f00f5ae542e7f5c94a2"+[[package]]name = "indexmap"version = "2.13.0"@@ -2397,7 +2644,7 @@ version = "0.18.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "25470f23803092da7d239834776d653104d551bc4d7eacaf31e6837854b8e9eb"dependencies = [- "console",+ "console 0.16.3","portable-atomic","unicode-width 0.2.0","unit-prefix",@@ -2435,6 +2682,17 @@ dependencies = ["syn",]+[[package]]+name = "interpolate_name"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]+[[package]]name = "ipnet"version = "2.12.0"@@ -2486,6 +2744,15 @@ dependencies = ["either",]+[[package]]+name = "itertools"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"+dependencies = [+ "either",+]+[[package]]name = "itoa"version = "1.0.17"@@ -2550,12 +2817,28 @@ version = "0.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"+[[package]]+name = "lebe"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"+[[package]]name = "libc"version = "0.2.183"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"+[[package]]+name = "libfuzzer-sys"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d"+dependencies = [+ "arbitrary",+ "cc",+]+[[package]]name = "libm"version = "0.2.16"@@ -2624,6 +2907,15 @@ version = "0.4.29"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"+[[package]]+name = "loop9"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"+dependencies = [+ "imgref",+]+[[package]]name = "lru"version = "0.12.5"@@ -2686,6 +2978,16 @@ version = "0.7.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"+[[package]]+name = "maybe-rayon"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"+dependencies = [+ "cfg-if",+ "rayon",+]+[[package]]name = "md-5"version = "0.10.6"@@ -2767,6 +3069,22 @@ dependencies = ["windows-sys 0.61.2",]+[[package]]+name = "moxcms"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"+dependencies = [+ "num-traits",+ "pxfm",+]++[[package]]+name = "new_debug_unreachable"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"+[[package]]name = "nibble_vec"version = "0.1.0"@@ -2788,6 +3106,30 @@ dependencies = ["libc",]+[[package]]+name = "no_std_io2"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"+dependencies = [+ "memchr",+]++[[package]]+name = "nom"+version = "8.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"+dependencies = [+ "memchr",+]++[[package]]+name = "noop_proc_macro"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"+[[package]]name = "nu-ansi-term"version = "0.50.3"@@ -2797,6 +3139,16 @@ dependencies = ["windows-sys 0.61.2",]+[[package]]+name = "num-bigint"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"+dependencies = [+ "num-integer",+ "num-traits",+]+[[package]]name = "num-bigint-dig"version = "0.8.6"@@ -2819,6 +3171,17 @@ version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"+[[package]]+name = "num-derive"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]+[[package]]name = "num-integer"version = "0.1.46"@@ -2839,6 +3202,17 @@ dependencies = ["num-traits",]+[[package]]+name = "num-rational"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"+dependencies = [+ "num-bigint",+ "num-integer",+ "num-traits",+]+[[package]]name = "num-traits"version = "0.2.19"@@ -2898,6 +3272,7 @@ dependencies = ["futures","getrandom 0.2.17","hex",+ "image","indicatif","machine-uid","mime_guess",@@ -2913,6 +3288,7 @@ dependencies = ["unicode-width 0.1.14","url","uuid",+ "viuer","walkdir","zip",]@@ -2963,6 +3339,12 @@ version = "1.0.15"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"+[[package]]+name = "pastey"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"+[[package]]name = "path-clean"version = "1.0.1"@@ -3077,6 +3459,19 @@ dependencies = ["plotters-backend",]+[[package]]+name = "png"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"+dependencies = [+ "bitflags",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide",+]+[[package]]name = "portable-atomic"version = "1.13.1"@@ -3126,6 +3521,31 @@ dependencies = ["unicode-ident",]+[[package]]+name = "profiling"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"+dependencies = [+ "profiling-procmacros",+]++[[package]]+name = "profiling-procmacros"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"+dependencies = [+ "quote",+ "syn",+]++[[package]]+name = "pxfm"+version = "0.1.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"+[[package]]name = "pyo3"version = "0.27.2"@@ -3187,6 +3607,21 @@ dependencies = ["syn",]+[[package]]+name = "qoi"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"+dependencies = [+ "bytemuck",+]++[[package]]+name = "quick-error"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"+[[package]]name = "quinn"version = "0.11.9"@@ -3402,6 +3837,56 @@ dependencies = ["unicode-width 0.2.0",]+[[package]]+name = "rav1e"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"+dependencies = [+ "aligned-vec",+ "arbitrary",+ "arg_enum_proc_macro",+ "arrayvec",+ "av-scenechange",+ "av1-grain",+ "bitstream-io",+ "built",+ "cfg-if",+ "interpolate_name",+ "itertools 0.14.0",+ "libc",+ "libfuzzer-sys",+ "log",+ "maybe-rayon",+ "new_debug_unreachable",+ "noop_proc_macro",+ "num-derive",+ "num-traits",+ "paste",+ "profiling",+ "rand 0.9.2",+ "rand_chacha 0.9.0",+ "simd_helpers",+ "thiserror 2.0.18",+ "v_frame",+ "wasm-bindgen",+]++[[package]]+name = "ravif"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"+dependencies = [+ "avif-serialize",+ "imgref",+ "loop9",+ "quick-error",+ "rav1e",+ "rayon",+ "rgb",+]+[[package]]name = "rayon"version = "1.11.0"@@ -3537,6 +4022,15 @@ dependencies = ["zeroize",]+[[package]]+name = "rgb"+version = "0.8.53"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"+dependencies = [+ "bytemuck",+]+[[package]]name = "ring"version = "0.17.14"@@ -3982,6 +4476,15 @@ version = "0.3.8"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"+[[package]]+name = "simd_helpers"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"+dependencies = [+ "quote",+]+[[package]]name = "slab"version = "0.4.12"@@ -4421,6 +4924,20 @@ dependencies = ["cfg-if",]+[[package]]+name = "tiff"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"+dependencies = [+ "fax",+ "flate2",+ "half",+ "quick-error",+ "weezl",+ "zune-jpeg",+]+[[package]]name = "time"version = "0.3.47"@@ -4842,6 +5359,17 @@ dependencies = ["wasm-bindgen",]+[[package]]+name = "v_frame"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"+dependencies = [+ "aligned-vec",+ "num-traits",+ "wasm-bindgen",+]+[[package]]name = "valuable"version = "0.1.1"@@ -4860,6 +5388,22 @@ version = "0.9.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"+[[package]]+name = "viuer"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "361c1fcf4a5a72e9ddebcf2caf14a74a19d667e52528a849084259932653ce21"+dependencies = [+ "ansi_colours",+ "base64",+ "console 0.15.11",+ "crossterm 0.28.1",+ "image",+ "lazy_static",+ "tempfile",+ "termcolor",+]+[[package]]name = "vsimd"version = "0.8.0"@@ -5037,6 +5581,12 @@ dependencies = ["rustls-pki-types",]+[[package]]+name = "weezl"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"+[[package]]name = "whoami"version = "1.6.1"@@ -5488,6 +6038,12 @@ dependencies = ["lzma-sys",]+[[package]]+name = "y4m"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"+[[package]]name = "yoke"version = "0.8.1"@@ -5680,3 +6236,27 @@ dependencies = ["cc","pkg-config",]++[[package]]+name = "zune-core"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"++[[package]]+name = "zune-inflate"+version = "0.2.54"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "zune-jpeg"+version = "0.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"+dependencies = [+ "zune-core",+]diff --git a/Makefile b/Makefileindex a74178c29..f0bc90ad3 100644--- a/Makefile+++ b/Makefile@@ -27,15 +27,17 @@ CLEAN_DIRS := \**/__pycache__/.PHONY: all build clean help check-pip check-deps+.PHONY: build-cliall: buildhelp:@echo "Available targets:"- @echo " build - Build ragfs-python and C++ extensions using setup.py"- @echo " clean - Remove build artifacts and temporary files"- @echo " check-deps - Check if required dependencies (Rust, CMake, etc.) are installed"- @echo " help - Show this help message"+ @echo " build - Build ragfs-python and C++ extensions using setup.py"+ @echo " build-cli - Build Rust CLI (ov) in development mode (fast) and copy to openviking/bin/"+ @echo " clean - Remove build artifacts and temporary files"+ @echo " check-deps - Check if required dependencies (Rust, CMake, etc.) are installed"+ @echo " help - Show this help message"check-pip:@if command -v uv > /dev/null 2>&1 && uv pip --help > /dev/null 2>&1; then \@@ -138,3 +140,13 @@ clean:@find . -name "*.pyc" -delete@find . -name "__pycache__" -type d -exec rm -rf {} +@echo "Cleanup completed."++# Rust CLI targets+build-cli:+ @echo "Building Rust CLI (ov) in development mode..."+ @cd $(OV_CLI_DIR) && cargo build+ @mkdir -p openviking/bin+ @cp target/debug/ov openviking/bin/ov+ @chmod +x openviking/bin/ov+ @echo " [OK] CLI built at target/debug/ov"+ @echo " [OK] CLI copied to openviking/bin/ov"diff --git a/README.md b/README.mdindex a43dc7111..ecef8960f 100644--- a/README.md+++ b/README.md@@ -504,9 +504,12 @@ set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"#### CLI/Client Configuration Examples+You can initialize the configuration of the CLI/client interactively through the `ov config setup-cli` command. If you have multiple openviking servers, you can also switch to other configurations using the `ov config switch` command.+👇 Expand to see the configuration example for your CLI/Client:+<details>+<summary><b>Example: ovcli.conf for visiting localhost server</b></summary>-Example: ovcli.conf for visiting localhost server```json{@@ -534,6 +537,7 @@ Command Prompt (cmd.exe):```batset "OPENVIKING_CLI_CONFIG_FILE=%USERPROFILE%\.openviking\ovcli.conf"```+</details>### 4. Run Your First Examplediff --git a/README_CN.md b/README_CN.mdindex 304f3ff8f..240e1eb71 100644--- a/README_CN.md+++ b/README_CN.md@@ -432,9 +432,12 @@ set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"#### CLI/客户端配置示例+你可以通过 `ov config setup-cli` 命令来以交互式方式初始化 CLI/客户端的配置。如果你有多个 openviking 服务器,你还可以通过 `ov config switch` 命令来切换到其他配置。+👇 展开查看您的 CLI/客户端的配置示例:-示例:用于访问本地服务器的 ovcli.conf+<details>+<summary><b>示例:用于访问本地服务器的 ovcli.conf</b></summary>```json{@@ -464,6 +467,8 @@ $env:OPENVIKING_CLI_CONFIG_FILE = "$HOME/.openviking/ovcli.conf"set "OPENVIKING_CLI_CONFIG_FILE=%USERPROFILE%\.openviking\ovcli.conf"```+</details>+### 4. 运行您的第一个示例> 📝 **前置条件**:确保您已完成上一步的配置(ov.conf 和 ovcli.conf)。diff --git a/crates/ov_cli/Cargo.toml b/crates/ov_cli/Cargo.tomlindex 3f153eacc..b04fb3c25 100644--- a/crates/ov_cli/Cargo.toml+++ b/crates/ov_cli/Cargo.toml@@ -38,3 +38,5 @@ hex = "0.4"getrandom = "0.2"indicatif = "0.18"bytes = "1.0"+viuer = "0.8"+image = "0.25"diff --git a/crates/ov_cli/src/base_client.rs b/crates/ov_cli/src/base_client.rsindex 2b0d73b03..6362914f9 100644--- a/crates/ov_cli/src/base_client.rs+++ b/crates/ov_cli/src/base_client.rs@@ -85,6 +85,24 @@ pub struct BaseClient {}impl BaseClient {+ /// Create a new BaseClient with minimal configuration for health probing+ pub fn new_simple(base_url: impl Into<String>, timeout_secs: f64) -> Self {+ let http = ReqwestClient::builder()+ .timeout(std::time::Duration::from_secs_f64(timeout_secs))+ .build()+ .expect("Failed to build HTTP client");++ Self {+ http,+ base_url: base_url.into().trim_end_matches('/').to_string(),+ api_key: None,+ account: None,+ user: None,+ agent_id: None,+ extra_headers: None,+ }+ }+pub fn new(base_url: impl Into<String>,api_key: Option<String>,diff --git a/crates/ov_cli/src/handlers.rs b/crates/ov_cli/src/handlers.rsindex a4864ccb9..2c44a0ea0 100644--- a/crates/ov_cli/src/handlers.rs+++ b/crates/ov_cli/src/handlers.rs@@ -478,6 +478,7 @@ pub async fn handle_privacy(cmd: PrivacyCommands, ctx: CliContext) -> Result<()>use crate::ConfigCommands;use crate::config::Config;+use crate::base_client::BaseClient;use crate::output;pub async fn handle_config(cmd: ConfigCommands, _ctx: CliContext) -> Result<()> {@@ -498,6 +499,247 @@ pub async fn handle_config(cmd: ConfigCommands, _ctx: CliContext) -> Result<()>}Err(e) => Err(Error::Config(e.to_string())),},+ ConfigCommands::SetupCli => {+ handle_setup_cli().await+ },+ ConfigCommands::Switch => {+ handle_config_switch().await+ },+ }+}++/// Interactive setup for CLI configuration+async fn handle_setup_cli() -> Result<()> {+ use rustyline::DefaultEditor;+ use colored::Colorize;++ println!("{}", "Welcome to OpenViking CLI Setup!".bold().green());+ println!();++ // Load existing config if available+ let mut config = match Config::load_default() {+ Ok(c) => c,+ Err(_) => Config::default(),+ };++ let mut rl = DefaultEditor::new().map_err(|e| Error::Config(format!("Failed to initialize input editor: {}", e)))?;++ // Step 1: Get server URL+ let default_url = config.url.clone();+ let prompt = format!("OpenViking Server URL [{}]: ", default_url);+ let url_input = rl.readline(&prompt).unwrap_or_default();+ let url = if url_input.trim().is_empty() {+ default_url+ } else {+ url_input.trim().to_string()+ };++ // Update config with URL immediately for probing+ config.url = url.clone();++ // Step 2: Probe health endpoint+ println!();+ println!("{}", "Probing server health...".blue());+ let probe_result = probe_health(&url, 5.0).await;++ let needs_api_key = match probe_result {+ Ok((healthy, auth_required)) => {+ if healthy {+ println!("{}", "✓ Server is healthy!".green());+ } else {+ println!("{}", "⚠ Server responded but reports unhealthy".yellow());+ }+ auth_required+ }+ Err(e) => {+ println!("{}", format!("⚠ Could not reach server: {}", e).yellow());+ // Default to asking for API key if we can't probe+ true+ }+ };++ // Step 3: Ask for API key if needed+ if needs_api_key {+ println!();+ let default_key = config.api_key.clone().unwrap_or_default();+ let prompt = if default_key.is_empty() {+ "API Key (optional, press Enter to skip): ".to_string()+ } else {+ format!("API Key [{}]: ", "*".repeat(default_key.len().min(8)))+ };+ let key_input = rl.readline(&prompt).unwrap_or_default();+ if !key_input.trim().is_empty() {+ config.api_key = Some(key_input.trim().to_string());+ } else if default_key.is_empty() {+ config.api_key = None;+ }+ }++ // Step 4: Save config+ println!();+ let config_path = crate::config::default_config_path()?;+ println!("{}", format!("Saving configuration to: {}", config_path.to_string_lossy()).blue());+ config.save_default()?;++ // Step 5: Optionally save a named backup+ println!();+ let prompt = "Name this configuration (optional, press Enter to skip): ";+ let name_input = rl.readline(prompt).unwrap_or_default();+ if !name_input.trim().is_empty() {+ let config_name = name_input.trim().to_string();+ if let Some(parent) = config_path.parent() {+ let backup_path = parent.join(format!("ovcli.conf.{}", config_name));+ std::fs::copy(&config_path, &backup_path).map_err(|e| Error::Config(format!("Failed to save configuration backup: {}", e)))?;+ println!("{}", format!("✓ Configuration saved as backup: {}", backup_path.to_string_lossy()).green());+ }+ }++ println!();+ println!("{}", "✓ Setup complete!".bold().green());+ println!("{}", "You can now use the 'ov' command to interact with OpenViking.".dimmed());+ println!("{}", "Use 'ov config switch' to switch between saved configurations.".dimmed());++ Ok(())+}++/// Probe health endpoint to check server status and auth requirement+async fn probe_health(base_url: &str, timeout_secs: f64) -> Result<(bool, bool)> {+ let client = BaseClient::new_simple(base_url, timeout_secs);++ // First try without API key+ let result: Result<serde_json::Value> = client.get("/health", &[]).await;++ match result {+ Ok(value) => {+ let healthy = value.get("healthy").and_then(|v| v.as_bool()).unwrap_or(false);+ Ok((healthy, false))+ }+ Err(Error::Api(msg)) => {+ // If we get auth-related errors, auth is required+ if msg.contains("401") || msg.contains("403") || msg.contains("unauthorized") || msg.contains("forbidden") || msg.contains("AuthenticationError") {+ Ok((false, true))+ } else {+ Ok((false, false))+ }+ }+ Err(_) => {+ Ok((false, true))+ }+ }+}++/// Interactive configuration switcher+async fn handle_config_switch() -> Result<()> {+ use colored::Colorize;++ // Step 1: Find all available configurations+ let config_path = crate::config::default_config_path()?;+ let config_dir = config_path.parent().ok_or_else(|| Error::Config("Could not determine config directory".to_string()))?;++ let mut configs = Vec::new();++ if let Ok(entries) = std::fs::read_dir(config_dir) {+ for entry in entries.flatten() {+ let path = entry.path();+ if let Some(filename) = path.file_name().and_then(|f| f.to_str()) {+ if filename.starts_with("ovcli.conf.") && filename != "ovcli.conf" {+ if let Some(name) = filename.strip_prefix("ovcli.conf.") {+ // Try to load the config to get its URL for display+ let url = if let Ok(cfg) = Config::from_file(&path.to_string_lossy()) {+ cfg.url.clone()+ } else {+ String::new()+ };+ configs.push((name.to_string(), path, url));+ }+ }+ }+ }+ }++ if configs.is_empty() {+ println!("{}", "No saved configurations found.".yellow());+ println!("{}", "Use 'ov config setup-cli' and save a named configuration first.".dimmed());+ return Ok(());+ }++ // Step 2: Interactive selection using simple numbered menu+ println!("{}", "Select a configuration to use:".bold());+ println!();++ for (i, (name, _, url)) in configs.iter().enumerate() {+ if url.is_empty() {+ println!(" {}. {}", i + 1, name.bold());+ } else {+ println!(" {}. {} ({})", i + 1, name.bold(), url.dimmed());+ }+ }++ println!();+ println!("{}", "Enter '<number>' to use a configuration (e.g. '2')".dimmed());+ println!("{}", "Or enter 'del<number>' to delete a configuration (e.g. 'del2')".dimmed());+ println!("{}", "Press Enter without input to cancel".dimmed());++ let mut rl = rustyline::DefaultEditor::new().map_err(|e| Error::Config(format!("Failed to initialize input editor: {}", e)))?;++ loop {+ let input = rl.readline("> ").unwrap_or_default();+ let input = input.trim();++ if input.is_empty() {+ println!();+ println!("{}", "Cancelled.".dimmed());+ return Ok(());+ }++ // Check for delete command+ if let Some(num_str) = input.strip_prefix("del").or_else(|| input.strip_prefix("Del")) {+ if let Ok(idx) = num_str.parse::<usize>() {+ if idx >= 1 && idx <= configs.len() {+ let idx = idx - 1;+ let (name, path, _) = &configs[idx];+ println!();+ println!("{}", format!("Are you sure you want to delete configuration '{}'? (y/N)", name).yellow());++ let confirm = rl.readline("> ").unwrap_or_default();+ if confirm.trim().eq_ignore_ascii_case("y") || confirm.trim().eq_ignore_ascii_case("yes") {+ std::fs::remove_file(path).map_err(|e| Error::Config(format!("Failed to delete configuration: {}", e)))?;+ println!("{}", format!("✓ Configuration '{}' deleted.", name).green());+ } else {+ println!("{}", "Deletion cancelled.".dimmed());+ }+ return Ok(());+ }+ }+ println!("{}", "Invalid selection. Please try again.".yellow());+ continue;+ }++ // Try to parse as selection number+ if let Ok(idx) = input.parse::<usize>() {+ if idx >= 1 && idx <= configs.len() {+ let idx = idx - 1;+ // Handle switching+ let (name, source_path, _) = &configs[idx];++ // First, backup current config as .bak+ if config_path.exists() {+ let backup_path = config_dir.join("ovcli.conf.bak");+ std::fs::copy(&config_path, &backup_path).map_err(|e| Error::Config(format!("Failed to backup current config: {}", e)))?;+ }++ // Copy selected config to main config+ std::fs::copy(source_path, &config_path).map_err(|e| Error::Config(format!("Failed to switch configuration: {}", e)))?;++ println!();+ println!("{}", format!("✓ Switched to configuration '{}'", name).bold().green());+ println!("{}", format!("Configuration saved to: {}", config_path.to_string_lossy()).dimmed());++ return Ok(());+ }+ }++ println!("{}", format!("Invalid selection. Please enter a number between 1 and {}.", configs.len()).yellow());}}@@ -838,5 +1080,27 @@ pub async fn handle_health(ctx: CliContext) -> Result<()> {pub async fn handle_tui(uri: String, ctx: CliContext) -> Result<()> {let client = ctx.get_client();++ // Probe health endpoint first with a short timeout+ println!("Connecting to {}...", ctx.config.url);+ match client.get::<serde_json::Value>("/health", &[]).await {+ Ok(value) => {+ let healthy = value.get("healthy").and_then(|v| v.as_bool()).unwrap_or(false);+ if !healthy {+ println!("Warning: Server reports unhealthy status");+ }+ }+ Err(e) => {+ println!("Error: Failed to connect to server at {}", ctx.config.url);+ println!("{}", e);+ println!("\nPlease check:");+ println!(" 1. The server is running");+ println!(" 2. The URL is correct");+ println!(" 3. Your API key is valid (if required)");+ println!("\nRun `ov config setup-cli` to reconfigure if needed.");+ std::process::exit(1);+ }+ }+tui::run_tui(client, &uri).await}diff --git a/crates/ov_cli/src/main.rs b/crates/ov_cli/src/main.rsindex ec3465478..c291f3bfa 100644--- a/crates/ov_cli/src/main.rs+++ b/crates/ov_cli/src/main.rs@@ -845,6 +845,10 @@ enum ConfigCommands {Show,/// Validate configuration fileValidate,+ /// Interactive setup to configure CLI+ SetupCli,+ /// Switch between saved configurations+ Switch,}fn find_command_index(args: &[OsString]) -> Option<usize> {diff --git a/crates/ov_cli/src/tui/app.rs b/crates/ov_cli/src/tui/app.rsindex 719ffb66c..25d1d72b1 100644--- a/crates/ov_cli/src/tui/app.rs+++ b/crates/ov_cli/src/tui/app.rs@@ -1,8 +1,11 @@use crate::client::HttpClient;use super::tree::TreeState;+use super::image_preview;use std::{pin::Pin, time::Instant};+use tempfile::NamedTempFile;+use std::io::Write;// Type alias for confirmation callbacktype ConfirmationCallback = Box<dyn for<'a> FnOnce(&'a mut App) -> Pin<Box<dyn Future<Output = ()> + 'a>>>;@@ -66,6 +69,9 @@ pub struct App {pub vector_state: VectorRecordsState,pub showing_vector_records: bool,pub current_uri: String,+ pub current_preview_image: Option<String>,+ pub temp_image_file: Option<NamedTempFile>,+ pub pending_image_uri: Option<(String, String)>, // (uri, filename)}impl App {@@ -88,6 +94,9 @@ impl App {vector_state: VectorRecordsState::new(),showing_vector_records: false,current_uri: "/".to_string(),+ current_preview_image: None,+ temp_image_file: None,+ pending_image_uri: None,}}@@ -106,6 +115,9 @@ impl App {self.content = "(nothing selected)".to_string();self.content_title = String::new();self.content_scroll = 0;+ self.current_preview_image = None;+ self.temp_image_file = None;+ self.pending_image_uri = None;return;}};@@ -114,6 +126,11 @@ impl App {self.content_title = uri.clone();self.content_scroll = 0;+ // Clear previous image preview+ self.current_preview_image = None;+ self.temp_image_file = None;+ self.pending_image_uri = None;+if is_dir {// For root-level scope URIs (e.g. viking://resources), show a// simple placeholder instead of calling abstract/overview which@@ -174,6 +191,19 @@ impl App {}async fn load_file_content(&mut self, uri: &str) {+ // Check if this is an image file+ let filename = uri.split('/').last().unwrap_or("");+ if image_preview::is_image_file(filename) {+ // Don't load image automatically - just show prompt+ self.pending_image_uri = Some((uri.to_string(), filename.to_string()));+ self.content = format!(+ "Image: {}\n\nPress '.' to load and preview the image.",+ filename+ );+ return;+ }++ // Regular text filematch self.client.read(uri).await {Ok(text) if !text.is_empty() => {self.content = text;@@ -187,6 +217,76 @@ impl App {}}+ async fn load_image_preview_content(&mut self, uri: &str, filename: &str) {+ // Show image info in the content area+ let mut info_text = format!("Image: {}\n\n", filename);++ info_text.push_str("Image preview is being displayed above.\n\n");++ // Try to get the image and save to temp file for preview+ match self.client.get_bytes(uri).await {+ Ok(bytes) if !bytes.is_empty() => {+ // Get file extension from filename, convert to lowercase+ let ext = std::path::Path::new(filename)+ .extension()+ .and_then(|e| e.to_str())+ .map(|e| e.to_lowercase())+ .unwrap_or("png".to_string());++ // Create temp file with proper extension+ match tempfile::Builder::new()+ .prefix("ov-tui-img-")+ .suffix(&format!(".{}", ext))+ .tempfile()+ {+ Ok(mut temp_file) => {+ match temp_file.write_all(&bytes) {+ Ok(_) => {+ match temp_file.flush() {+ Ok(_) => {+ let path = temp_file.path().to_str().map(|s| s.to_string());+ if let Some(path) = path {+ self.current_preview_image = Some(path);+ // Keep temp file alive+ self.temp_image_file = Some(temp_file);+ info_text.push_str(&format!("Size: {} bytes", bytes.len()));+ }+ }+ Err(e) => {+ info_text.push_str(&format!("(Could not write temp file: {})", e));+ }+ }+ }+ Err(e) => {+ info_text.push_str(&format!("(Could not write temp file: {})", e));+ }+ }+ }+ Err(e) => {+ info_text.push_str(&format!("(Could not create temp file for preview: {})", e));+ }+ }+ }+ Ok(_) => {+ info_text.push_str("(empty image)");+ }+ Err(e) => {+ info_text.push_str(&format!("(error reading image: {})", e));+ }+ }++ self.content = info_text;+ }++ /// Load and preview the pending image (if any)+ pub async fn load_pending_image(&mut self) -> bool {+ if let Some((uri, filename)) = self.pending_image_uri.take() {+ self.load_image_preview_content(&uri, &filename).await;+ return true;+ }+ false+ }+pub fn scroll_content_up(&mut self) {self.content_scroll = self.content_scroll.saturating_sub(1);}diff --git a/crates/ov_cli/src/tui/event.rs b/crates/ov_cli/src/tui/event.rsindex f760fd980..ac6dff1ca 100644--- a/crates/ov_cli/src/tui/event.rs+++ b/crates/ov_cli/src/tui/event.rs@@ -78,9 +78,13 @@ async fn handle_tree_key(app: &mut App, key: KeyEvent) {app.load_content_for_selected().await;}KeyCode::Char('.') => {- let client = app.client.clone();- app.tree.toggle_expand(&client).await;- app.load_content_for_selected().await;+ // First try to load pending image if any+ if !app.load_pending_image().await {+ // No pending image, toggle directory expand+ let client = app.client.clone();+ app.tree.toggle_expand(&client).await;+ app.load_content_for_selected().await;+ }}KeyCode::Char('d') => {// Delete currently selected URIdiff --git a/crates/ov_cli/src/tui/image_preview.rs b/crates/ov_cli/src/tui/image_preview.rsnew file mode 100644index 000000000..266f65223--- /dev/null+++ b/crates/ov_cli/src/tui/image_preview.rs@@ -0,0 +1,287 @@+use std::sync::{Arc, Mutex};+use std::path::Path;+use crossterm::{+ ExecutableCommand,+ cursor::MoveTo,+};++/// Preview area coordinates (in terminal cells)+#[derive(Debug, Clone, Copy)]+pub struct PreviewArea {+ pub x: u16,+ pub y: u16,+ pub width: u16,+ pub height: u16,+}++/// Check if a file is an image based on extension+pub fn is_image_file(filename: &str) -> bool {+ let path = Path::new(filename);+ let ext = path.extension().and_then(|e| e.to_str()).map(|e| e.to_lowercase());+ matches!(ext.as_deref(), Some("png" | "jpg" | "jpeg" | "gif" | "bmp" | "webp" | "tiff" | "tif"))+}++/// Image previewer using viuer (simpler, more reliable)+pub struct ImagePreviewer {+ current_image: Arc<Mutex<Option<String>>>,+ preview_area: Arc<Mutex<Option<PreviewArea>>>,+ debug_log: Option<Arc<Mutex<Vec<String>>>>,+}++impl ImagePreviewer {+ /// Create a new image previewer+ pub fn new() -> Self {+ Self {+ current_image: Arc::new(Mutex::new(None)),+ preview_area: Arc::new(Mutex::new(None)),+ debug_log: Some(Arc::new(Mutex::new(Vec::new()))),+ }+ }++ /// Add a debug log entry+ fn log(&self, message: &str) {+ if let Some(log) = &self.debug_log {+ log.lock().unwrap().push(message.to_string());+ }+ }++ /// Get debug logs+ pub fn get_debug_logs(&self) -> Vec<String> {+ if let Some(log) = &self.debug_log {+ log.lock().unwrap().clone()+ } else {+ Vec::new()+ }+ }++ /// Check if viuer is available (it always is, since it's a library)+ pub fn is_available() -> bool {+ true+ }++ /// Get installation instructions (not needed for viuer)+ pub fn installation_instructions() -> &'static str {+ "Image preview is available (using viuer)"+ }++ /// Initialize the image previewer (nothing to do for viuer)+ pub fn init(&mut self) -> Result<(), String> {+ self.log("Initialized viuer image previewer");+ Ok(())+ }++ /// Set the preview area coordinates+ pub fn set_preview_area(&mut self, area: PreviewArea) {+ self.log(&format!("Set preview area: {:?}", area));+ *self.preview_area.lock().unwrap() = Some(area);+ }++ /// Get the preview area+ pub fn preview_area(&self) -> Option<PreviewArea> {+ *self.preview_area.lock().unwrap()+ }++ /// Check if an image is currently displayed+ pub fn has_image_displayed(&self) -> bool {+ self.current_image.lock().unwrap().is_some()+ }++ /// Display an image at the last known preview area+ pub fn display_image(&mut self, image_path: &str) -> Result<(), String> {+ let preview_area = *self.preview_area.lock().unwrap();+ let preview_area = match preview_area {+ Some(area) => area,+ None => return Err("No preview area available".to_string()),+ };++ self.display_image_at(image_path, preview_area)+ }++ /// Display an image at the specified area+ pub fn display_image_at(+ &mut self,+ image_path: &str,+ area: PreviewArea,+ ) -> Result<(), String> {+ // Check if file exists first+ let path = std::path::Path::new(image_path);+ if !path.exists() {+ return Err(format!("Image file not found: {}", image_path));+ }+ if !path.is_file() {+ return Err(format!("Path is not a file: {}", image_path));+ }++ self.log(&format!("Displaying image: {}", image_path));+ self.log(&format!("Preview area: x={}, y={}, width={}, height={}", area.x, area.y, area.width, area.height));++ // Calculate dimensions - viuer uses half-blocks, so height is in characters+ // Each character cell can display 2x1 pixels (approximate)+ let max_width = Some(area.width.saturating_sub(2) as u32);+ let max_height = Some(area.height.saturating_sub(2) as u32);+ self.log(&format!("Target dimensions: width={:?}, height={:?}", max_width, max_height));++ // Try with multiple terminal protocols to find what works+ let configs = [+ // Try with kitty/iterm2 first with sizing+ viuer::Config {+ restore_cursor: true,+ transparent: true,+ truecolor: true,+ use_kitty: true,+ use_iterm: true,+ width: max_width,+ height: max_height,+ ..Default::default()+ },+ // Try with kitty/iterm2 with transparency disabled+ viuer::Config {+ restore_cursor: true,+ transparent: false,+ truecolor: true,+ use_kitty: true,+ use_iterm: true,+ width: max_width,+ height: max_height,+ ..Default::default()+ },+ // Then try without special protocols with sizing+ viuer::Config {+ restore_cursor: true,+ transparent: true,+ truecolor: true,+ use_kitty: false,+ use_iterm: false,+ width: max_width,+ height: max_height,+ ..Default::default()+ },+ // Try without special protocols with transparency disabled+ viuer::Config {+ restore_cursor: true,+ transparent: false,+ truecolor: true,+ use_kitty: false,+ use_iterm: false,+ width: max_width,+ height: max_height,+ ..Default::default()+ },+ // Try with just width specified+ viuer::Config {+ restore_cursor: true,+ transparent: true,+ truecolor: true,+ width: max_width,+ ..Default::default()+ },+ // Try with default settings (no sizing)+ viuer::Config {+ restore_cursor: true,+ transparent: true,+ truecolor: true,+ ..Default::default()+ },+ ];++ let mut displayed = false;+ let mut last_error_str = None;++ // First try using print_from_file (more reliable for different formats)+ self.log("Trying viuer::print_from_file");+ for (i, config) in configs.iter().enumerate() {+ self.log(&format!("Trying viuer config {} (print_from_file)", i + 1));+ self.log(&format!("Config details: width={:?}, height={:?}, use_kitty={}, use_iterm={}",+ config.width, config.height, config.use_kitty, config.use_iterm));++ // Move cursor to the preview area position+ self.log(&format!("Moving cursor to x={}, y={}", area.x, area.y));+ match std::io::stdout().execute(MoveTo(area.x, area.y)) {+ Ok(_) => {+ match viuer::print_from_file(image_path, config) {+ Ok(_) => {+ displayed = true;+ self.log(&format!("Success with config {} (print_from_file)", i + 1));+ break;+ }+ Err(e) => {+ self.log(&format!("Config {} failed (print_from_file): {}", i + 1, e));+ last_error_str = Some(format!("{}", e));+ }+ }+ }+ Err(e) => {+ self.log(&format!("Failed to move cursor: {}", e));+ last_error_str = Some(format!("Cursor move failed: {}", e));+ }+ }+ }++ // If print_from_file didn't work, try loading with image crate first+ if !displayed {+ self.log("print_from_file failed, trying with image crate");+ match image::open(image_path) {+ Ok(img) => {+ self.log(&format!("Image loaded: {}x{}", img.width(), img.height()));++ for (i, config) in configs.iter().enumerate() {+ self.log(&format!("Trying viuer config {} (image crate)", i + 1));++ // Move cursor to the preview area position+ match std::io::stdout().execute(MoveTo(area.x, area.y)) {+ Ok(_) => {+ match viuer::print(&img, config) {+ Ok(_) => {+ displayed = true;+ self.log(&format!("Success with config {} (image crate)", i + 1));+ break;+ }+ Err(e) => {+ self.log(&format!("Config {} failed (image crate): {}", i + 1, e));+ last_error_str = Some(format!("{}", e));+ }+ }+ }+ Err(e) => {+ self.log(&format!("Failed to move cursor: {}", e));+ last_error_str = Some(format!("Cursor move failed: {}", e));+ }+ }+ }+ }+ Err(e) => {+ self.log(&format!("Failed to load image: {}", e));+ last_error_str = Some(format!("Image load failed: {}", e));+ }+ }+ }++ if !displayed {+ return Err(format!("Failed to display image with all configs. Last error: {:?}", last_error_str));+ }++ *self.current_image.lock().unwrap() = Some(image_path.to_string());+ self.log("Image displayed successfully");+ Ok(())+ }++ /// Clear the currently displayed image+ pub fn clear_image(&mut self) -> Result<(), String> {+ // Clear the state - ratatui's next render will cover the image+ *self.current_image.lock().unwrap() = None;+ self.log("Image cleared");+ Ok(())+ }++ /// Cleanup resources+ pub fn cleanup(&mut self) {+ self.log("Cleaning up image previewer");+ let _ = self.clear_image();+ }+}++impl Default for ImagePreviewer {+ fn default() -> Self {+ Self::new()+ }+}diff --git a/crates/ov_cli/src/tui/mod.rs b/crates/ov_cli/src/tui/mod.rsindex b15fad7bc..d8b6facf1 100644--- a/crates/ov_cli/src/tui/mod.rs+++ b/crates/ov_cli/src/tui/mod.rs@@ -2,19 +2,23 @@ mod app;mod event;mod tree;mod ui;+mod image_preview;use std::io;use crossterm::{ExecutableCommand,- event::{self as ct_event, Event},+ event::{self as ct_event, Event, KeyCode},terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},};use ratatui::prelude::*;+use ratatui::text::Line;+use ratatui::widgets::{Paragraph, Block, Borders};use crate::client::HttpClient;use crate::error::Result;use app::App;+use image_preview::ImagePreviewer;pub async fn run_tui(client: HttpClient, uri: &str) -> Result<()> {// Set up panic hook to restore terminal@@ -45,6 +49,12 @@ async fn run_loop(client: HttpClient, uri: &str) -> Result<()> {let mut terminal = Terminal::new(backend)?;let mut app = App::new(client);+ let mut image_previewer = ImagePreviewer::new();+ let mut show_debug_logs = false;++ // Initialize viuer (always available)+ let _ = image_previewer.init();+app.init(uri).await;loop {@@ -63,12 +73,83 @@ async fn run_loop(client: HttpClient, uri: &str) -> Result<()> {// Update status message (clear after 3 seconds)app.update_messages();- terminal.draw(|frame| ui::render(frame, &app))?;+ // Store content area+ let mut captured_content_area = None;++ // Track if we had an image in the previous iteration+ static PREV_HAD_IMAGE: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);+ let had_image = PREV_HAD_IMAGE.load(std::sync::atomic::Ordering::Relaxed);+ let has_image = app.current_preview_image.is_some();++ // Clear image if we just transitioned away from an image+ if !show_debug_logs && had_image && !has_image {+ // Use ratatui terminal clear to properly reset+ let _ = terminal.clear();+ let _ = image_previewer.clear_image();+ }+ PREV_HAD_IMAGE.store(has_image, std::sync::atomic::Ordering::Relaxed);++ // Render TUI first+ terminal.draw(|frame| {+ if show_debug_logs {+ // Show debug logs+ let debug_logs = image_previewer.get_debug_logs();+ let text: Vec<Line> = debug_logs+ .iter()+ .rev()+ .take(usize::from(frame.area().height.saturating_sub(2)))+ .map(|s| Line::from(s.as_str()))+ .collect();+ let paragraph = Paragraph::new(text)+ .block(Block::default().borders(Borders::ALL).title(" Debug Logs (Press L to hide) "));+ frame.render_widget(paragraph, frame.area());+ } else {+ // Normal UI+ let areas = ui::render_with_content_area(frame, &app);+ // Save content area+ captured_content_area = Some(areas.1);+ }+ })?;++ // Update the preview area coordinates only if not showing debug logs+ if !show_debug_logs {+ if let Some(content_area) = captured_content_area {+ image_previewer.set_preview_area(image_preview::PreviewArea {+ x: content_area.x,+ y: content_area.y,+ width: content_area.width,+ height: content_area.height,+ });+ }++ // Update image display based on current file+ if let Some(image_path) = &app.current_preview_image {+ if let Err(e) = image_previewer.display_image(image_path) {+ // Show error in status bar+ if !app.status_message_locked {+ app.status_message = format!("Image preview error: {}", e);+ app.status_message_time = Some(std::time::Instant::now());+ }+ }+ }+ }if ct_event::poll(std::time::Duration::from_millis(100))? {if let Event::Key(key) = ct_event::read()? {if key.kind == crossterm::event::KeyEventKind::Press {- event::handle_key(&mut app, key).await;+ match key.code {+ KeyCode::Char('L') | KeyCode::Char('l') => {+ show_debug_logs = !show_debug_logs;+ if !show_debug_logs {+ let _ = image_previewer.clear_image();+ }+ }+ _ => {+ if !show_debug_logs {+ event::handle_key(&mut app, key).await;+ }+ }+ }}}}@@ -78,5 +159,8 @@ async fn run_loop(client: HttpClient, uri: &str) -> Result<()> {}}+ // Cleanup image previewer+ image_previewer.cleanup();+Ok(())}diff --git a/crates/ov_cli/src/tui/ui.rs b/crates/ov_cli/src/tui/ui.rsindex ac2f9c65b..51afb5513 100644--- a/crates/ov_cli/src/tui/ui.rs+++ b/crates/ov_cli/src/tui/ui.rs@@ -1,6 +1,6 @@use ratatui::{Frame,- layout::{Constraint, Direction, Layout},+ layout::{Constraint, Direction, Layout, Rect},style::{Color, Modifier, Style},text::{Line, Span},widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap},@@ -9,6 +9,11 @@ use ratatui::{use super::app::{App, Panel};pub fn render(frame: &mut Frame, app: &App) {+ let _ = render_with_content_area(frame, app);+}++/// Render the UI and return the content area rect for image preview+pub fn render_with_content_area(frame: &mut Frame, app: &App) -> (Rect, Rect) {let chunks = Layout::default().direction(Direction::Vertical).constraints([Constraint::Min(1), Constraint::Length(1)])@@ -23,8 +28,10 @@ pub fn render(frame: &mut Frame, app: &App) {.split(main_area);render_tree(frame, app, panels[0]);- render_content(frame, app, panels[1]);+ let content_area = render_content(frame, app, panels[1]);render_status_bar(frame, app, status_area);++ (main_area, content_area)}fn render_tree(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {@@ -101,10 +108,9 @@ fn render_tree(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {frame.render_stateful_widget(list, inner, &mut list_state);}-fn render_content(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {+fn render_content(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) -> Rect {if app.showing_vector_records {- render_vector_records(frame, app, area);- return;+ return render_vector_records(frame, app, area);}let focused = app.focus == Panel::Content;@@ -125,15 +131,19 @@ fn render_content(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {.borders(Borders::ALL).border_style(Style::default().fg(border_color));+ let inner_area = block.inner(area);+let paragraph = Paragraph::new(app.content.as_str()).block(block).wrap(Wrap { trim: false }).scroll((app.content_scroll, 0));frame.render_widget(paragraph, area);++ inner_area}-fn render_vector_records(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {+fn render_vector_records(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) -> Rect {let focused = app.focus == Panel::Content;let border_color = if focused {Color::Cyan@@ -170,7 +180,7 @@ fn render_vector_records(frame: &mut Frame, app: &App, area: ratatui::layout::Relet empty =Paragraph::new("(no vector records)").style(Style::default().fg(Color::DarkGray));frame.render_widget(empty, inner);- return;+ return inner;}let viewport_height = inner.height as usize;@@ -245,6 +255,8 @@ fn render_vector_records(frame: &mut Frame, app: &App, area: ratatui::layout::Re);frame.render_stateful_widget(list, inner, &mut list_state);++ inner}fn render_status_bar(frame: &mut Frame, app: &App, area: ratatui::layout::Rect) {