chore: replace meval with expr-solver-lib, drop reqwest from runtimes, fix AUR deps
- owlry-core: swap meval → expr-solver-lib for calculator and Lua math API; add ln() alias for meval compatibility - owlry-lua: remove reqwest and meval (network features belong in plugins); add vendored feature flag so distro builds can link against system lua54 - owlry-rune: remove reqwest (same reason) - aur/owlry-rune: fix depends (gcc-libs only; owlry-core → optdepends) - aur/owlry-lua: fix depends (gcc-libs + lua54; owlry-core → optdepends) - aur/owlry: add chmod -R a+rX for example plugins - justfile: log aur-local-test output to build-logs/ - .gitignore: exclude build-logs/ and test-build-output files - README: minor improvements (SIGHUP reload hint, plugin_config example)
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -12,3 +12,8 @@ aur/*/*.tar.zst
|
||||
aur/*/*.tar.gz
|
||||
aur/*/*.tar.xz
|
||||
aur/*/*.pkg.tar.*
|
||||
|
||||
# Local AUR test build logs
|
||||
build-logs/
|
||||
test-build-output*.md
|
||||
test-build-output*.log
|
||||
|
||||
55
Cargo.lock
generated
55
Cargo.lock
generated
@@ -470,7 +470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||
dependencies = [
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
"unicode-width 0.1.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -479,6 +479,15 @@ version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "3.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.5.0"
|
||||
@@ -704,6 +713,17 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "expr-solver-lib"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da28c29743d589936ac69491e1d4596ec4bd05e5ecf9188a353fbb73dc294ccc"
|
||||
dependencies = [
|
||||
"colored",
|
||||
"thiserror 2.0.18",
|
||||
"unicode-width 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
@@ -737,12 +757,6 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[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"
|
||||
@@ -1920,16 +1934,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "meval"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f79496a5651c8d57cd033c5add8ca7ee4e3d5f7587a4777484640d9cb60392d9"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.1.1"
|
||||
@@ -2024,12 +2028,6 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "1.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "7.0.0"
|
||||
@@ -2353,12 +2351,12 @@ dependencies = [
|
||||
"chrono",
|
||||
"dirs",
|
||||
"env_logger",
|
||||
"expr-solver-lib",
|
||||
"freedesktop-desktop-entry",
|
||||
"fs2",
|
||||
"fuzzy-matcher",
|
||||
"libloading 0.8.9",
|
||||
"log",
|
||||
"meval",
|
||||
"mlua",
|
||||
"notify",
|
||||
"notify-debouncer-mini",
|
||||
@@ -2382,10 +2380,8 @@ dependencies = [
|
||||
"chrono",
|
||||
"dirs",
|
||||
"log",
|
||||
"meval",
|
||||
"mlua",
|
||||
"owlry-plugin-api",
|
||||
"reqwest",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2410,7 +2406,6 @@ dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"owlry-plugin-api",
|
||||
"reqwest",
|
||||
"rune",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -3587,6 +3582,12 @@ version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
|
||||
16
README.md
16
README.md
@@ -139,6 +139,13 @@ exec owlryd
|
||||
systemctl --user enable --now owlryd.service
|
||||
```
|
||||
|
||||
The daemon reloads its configuration on `SIGHUP` without restarting — useful when editing `config.toml` directly:
|
||||
|
||||
```bash
|
||||
systemctl --user reload owlryd.service
|
||||
# or: kill -HUP $(pidof owlryd)
|
||||
```
|
||||
|
||||
**3. Socket activation (auto-start on first use)**
|
||||
|
||||
```bash
|
||||
@@ -372,7 +379,6 @@ search_engine = "duckduckgo"
|
||||
|
||||
[plugins]
|
||||
# disabled_plugins = ["emoji", "pomodoro"] # Plugin IDs to disable
|
||||
# enabled_plugins = [] # Empty = all discovered plugins are loaded
|
||||
# registry_url = "https://..." # Custom plugin registry URL
|
||||
|
||||
# Sandboxing for Lua/Rune user plugins (~/.config/owlry/plugins/)
|
||||
@@ -382,6 +388,10 @@ search_engine = "duckduckgo"
|
||||
# allow_commands = false # Allow shell command execution
|
||||
# memory_limit = 67108864 # Lua memory cap in bytes (default: 64 MB)
|
||||
|
||||
# Per-plugin config (for plugins that expose configurable options)
|
||||
# [plugin_config.my-plugin]
|
||||
# option = "value"
|
||||
|
||||
# Profiles: named sets of modes
|
||||
[profiles.dev]
|
||||
modes = ["app", "cmd", "ssh"]
|
||||
@@ -420,7 +430,7 @@ owlry plugin enable emoji
|
||||
### Plugin Management CLI
|
||||
|
||||
```bash
|
||||
# List installed plugins
|
||||
# List installed plugins (shows both native .so plugins and user script plugins)
|
||||
owlry plugin list
|
||||
owlry plugin list --enabled # Only enabled
|
||||
owlry plugin list --available # Show registry plugins
|
||||
@@ -528,7 +538,7 @@ owlryd (daemon) owlry (GTK4 UI client)
|
||||
│ ├── /usr/lib/owlry/plugins/*.so
|
||||
│ ├── /usr/lib/owlry/runtimes/
|
||||
│ └── ~/.config/owlry/plugins/
|
||||
├── Frecency tracking
|
||||
├── Frecency tracking (auto-saved every 5 min; flushed on shutdown)
|
||||
└── IPC server (Unix socket)
|
||||
│
|
||||
└── $XDG_RUNTIME_DIR/owlry/owlry.sock
|
||||
|
||||
@@ -6,8 +6,9 @@ pkgbase = owlry-lua
|
||||
arch = x86_64
|
||||
license = GPL-3.0-or-later
|
||||
makedepends = cargo
|
||||
depends = owlry-core
|
||||
depends = openssl
|
||||
depends = gcc-libs
|
||||
depends = lua54
|
||||
optdepends = owlry-core: daemon that loads this runtime
|
||||
source = owlry-lua-1.1.3.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-lua-v1.1.3.tar.gz
|
||||
b2sums = 648171ce688761babb7ada9ec96cb248fab5563cc45599f660f21e166bfb4db689cff22b82f3a1f2ae256dd54fb3d3f4d5a8acaf6a728976d42ee511e1f25e5f
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ pkgdesc="Lua scripting runtime for Owlry — enables user-created Lua plugins"
|
||||
arch=('x86_64')
|
||||
url="https://somegit.dev/Owlibou/owlry"
|
||||
license=('GPL-3.0-or-later')
|
||||
depends=('owlry-core' 'openssl')
|
||||
depends=('gcc-libs' 'lua54')
|
||||
optdepends=('owlry-core: daemon that loads this runtime')
|
||||
makedepends=('cargo')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-lua-v$pkgver.tar.gz")
|
||||
b2sums=('648171ce688761babb7ada9ec96cb248fab5563cc45599f660f21e166bfb4db689cff22b82f3a1f2ae256dd54fb3d3f4d5a8acaf6a728976d42ee511e1f25e5f')
|
||||
@@ -23,14 +24,14 @@ build() {
|
||||
cd "owlry"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
export CARGO_TARGET_DIR=target
|
||||
cargo build -p $_cratename --frozen --release
|
||||
cargo build -p $_cratename --frozen --release --no-default-features
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "owlry"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
export CARGO_TARGET_DIR=target
|
||||
cargo test -p $_cratename --frozen --lib
|
||||
cargo test -p $_cratename --frozen --no-default-features --lib
|
||||
}
|
||||
|
||||
package() {
|
||||
|
||||
@@ -6,8 +6,8 @@ pkgbase = owlry-rune
|
||||
arch = x86_64
|
||||
license = GPL-3.0-or-later
|
||||
makedepends = cargo
|
||||
depends = owlry-core
|
||||
depends = openssl
|
||||
depends = gcc-libs
|
||||
optdepends = owlry-core: daemon that loads this runtime
|
||||
source = owlry-rune-1.1.4.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-rune-v1.1.4.tar.gz
|
||||
b2sums = 648171ce688761babb7ada9ec96cb248fab5563cc45599f660f21e166bfb4db689cff22b82f3a1f2ae256dd54fb3d3f4d5a8acaf6a728976d42ee511e1f25e5f
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ pkgdesc="Rune scripting runtime for Owlry — enables user-created Rune plugins"
|
||||
arch=('x86_64')
|
||||
url="https://somegit.dev/Owlibou/owlry"
|
||||
license=('GPL-3.0-or-later')
|
||||
depends=('owlry-core' 'openssl')
|
||||
depends=('gcc-libs')
|
||||
optdepends=('owlry-core: daemon that loads this runtime')
|
||||
makedepends=('cargo')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://somegit.dev/Owlibou/owlry/archive/owlry-rune-v$pkgver.tar.gz")
|
||||
b2sums=('648171ce688761babb7ada9ec96cb248fab5563cc45599f660f21e166bfb4db689cff22b82f3a1f2ae256dd54fb3d3f4d5a8acaf6a728976d42ee511e1f25e5f')
|
||||
|
||||
@@ -73,4 +73,5 @@ package() {
|
||||
# Example plugins (for user plugin development)
|
||||
install -d "$pkgdir/usr/share/$pkgname/examples/plugins"
|
||||
cp -r examples/plugins/* "$pkgdir/usr/share/$pkgname/examples/plugins/"
|
||||
chmod -R a+rX "$pkgdir/usr/share/$pkgname/examples/plugins/"
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ env_logger = "0.11"
|
||||
notify-rust = "4"
|
||||
|
||||
# Built-in providers
|
||||
meval = "0.2"
|
||||
expr-solver-lib = "1"
|
||||
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "json", "blocking"] }
|
||||
|
||||
# Optional: embedded Lua runtime
|
||||
|
||||
@@ -3,8 +3,17 @@
|
||||
//! Provides safe math expression evaluation:
|
||||
//! - `owlry.math.calculate(expression)` - Evaluate a math expression
|
||||
|
||||
use expr_solver::{SymTable, eval_with_table};
|
||||
use mlua::{Lua, Result as LuaResult, Table};
|
||||
|
||||
fn eval_math(expr: &str) -> Result<f64, String> {
|
||||
let mut table = SymTable::stdlib();
|
||||
table
|
||||
.add_func("ln", 1, false, |args| Ok(args[0].ln()), false)
|
||||
.expect("ln alias is valid");
|
||||
eval_with_table(expr, table)
|
||||
}
|
||||
|
||||
/// Register math APIs
|
||||
pub fn register_math_api(lua: &Lua, owlry: &Table) -> LuaResult<()> {
|
||||
let math_table = lua.create_table()?;
|
||||
@@ -16,7 +25,7 @@ pub fn register_math_api(lua: &Lua, owlry: &Table) -> LuaResult<()> {
|
||||
"calculate",
|
||||
lua.create_function(
|
||||
|_lua, expr: String| -> LuaResult<(Option<f64>, Option<String>)> {
|
||||
match meval::eval_str(&expr) {
|
||||
match eval_math(&expr) {
|
||||
Ok(result) => {
|
||||
if result.is_finite() {
|
||||
Ok((Some(result), None))
|
||||
@@ -24,7 +33,7 @@ pub fn register_math_api(lua: &Lua, owlry: &Table) -> LuaResult<()> {
|
||||
Ok((None, Some("Result is not a finite number".to_string())))
|
||||
}
|
||||
}
|
||||
Err(e) => Ok((None, Some(e.to_string()))),
|
||||
Err(e) => Ok((None, Some(e))),
|
||||
}
|
||||
},
|
||||
)?,
|
||||
@@ -35,7 +44,7 @@ pub fn register_math_api(lua: &Lua, owlry: &Table) -> LuaResult<()> {
|
||||
math_table.set(
|
||||
"calc",
|
||||
lua.create_function(|_lua, expr: String| {
|
||||
meval::eval_str(&expr)
|
||||
eval_math(&expr)
|
||||
.map_err(|e| mlua::Error::external(format!("Math error: {}", e)))
|
||||
.and_then(|r| {
|
||||
if r.is_finite() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use expr_solver::{SymTable, eval_with_table};
|
||||
|
||||
use super::{DynamicProvider, ItemSource, LaunchItem, ProviderType};
|
||||
|
||||
/// Built-in calculator provider. Evaluates mathematical expressions via `meval`.
|
||||
/// Built-in calculator provider. Evaluates mathematical expressions via `expr-solver-lib`.
|
||||
///
|
||||
/// Triggered by:
|
||||
/// - `= expr` / `=expr` / `calc expr` (explicit prefix)
|
||||
@@ -26,7 +28,7 @@ impl DynamicProvider for CalculatorProvider {
|
||||
_ => return Vec::new(),
|
||||
};
|
||||
|
||||
match meval::eval_str(expr) {
|
||||
match eval_math(expr) {
|
||||
Ok(result) => {
|
||||
let display = format_result(result);
|
||||
let copy_cmd = format!(
|
||||
@@ -50,6 +52,18 @@ impl DynamicProvider for CalculatorProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/// Evaluate a math expression string, returning the result as f64.
|
||||
///
|
||||
/// Extends the stdlib with `ln` as an alias for natural log (meval compat).
|
||||
/// In expr-solver-lib, `log(x)` is natural log and `log10(x)` is base-10.
|
||||
fn eval_math(expr: &str) -> Result<f64, String> {
|
||||
let mut table = SymTable::stdlib();
|
||||
table
|
||||
.add_func("ln", 1, false, |args| Ok(args[0].ln()), false)
|
||||
.expect("ln alias is valid");
|
||||
eval_with_table(expr, table)
|
||||
}
|
||||
|
||||
/// Extract the math expression from a query string.
|
||||
///
|
||||
/// Handles:
|
||||
@@ -76,7 +90,7 @@ fn extract_expression(query: &str) -> Option<&str> {
|
||||
}
|
||||
|
||||
// Auto-detect: only forward if the expression looks like math.
|
||||
// Plain words like "firefox" should not reach meval.
|
||||
// Plain words like "firefox" should not reach the evaluator.
|
||||
if looks_like_math(trimmed) {
|
||||
Some(trimmed)
|
||||
} else {
|
||||
|
||||
@@ -12,6 +12,13 @@ categories = ["development-tools"]
|
||||
[lib]
|
||||
crate-type = ["cdylib"] # Compile as dynamic library (.so)
|
||||
|
||||
[features]
|
||||
# Bundle Lua 5.4 from source (no system lua dep). Enabled by default for dev
|
||||
# and CI builds. Distribution packages should disable this and add lua54 as a
|
||||
# system dependency instead.
|
||||
default = ["vendored"]
|
||||
vendored = ["mlua/vendored"]
|
||||
|
||||
[dependencies]
|
||||
# Plugin API for owlry (shared types)
|
||||
owlry-plugin-api = { path = "../owlry-plugin-api" }
|
||||
@@ -20,7 +27,7 @@ owlry-plugin-api = { path = "../owlry-plugin-api" }
|
||||
abi_stable = "0.11"
|
||||
|
||||
# Lua runtime
|
||||
mlua = { version = "0.11", features = ["lua54", "vendored", "send", "serialize"] }
|
||||
mlua = { version = "0.11", features = ["lua54", "send", "serialize"] }
|
||||
|
||||
# Plugin manifest parsing
|
||||
toml = "0.8"
|
||||
@@ -33,11 +40,6 @@ semver = "1"
|
||||
# Logging
|
||||
log = "0.4"
|
||||
|
||||
# HTTP client for plugins
|
||||
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "blocking", "json"] }
|
||||
|
||||
# Math expression evaluation
|
||||
meval = "0.2"
|
||||
|
||||
# Date/time for os.date
|
||||
chrono = "0.4"
|
||||
|
||||
@@ -20,9 +20,6 @@ rune = "0.14"
|
||||
log = "0.4"
|
||||
env_logger = "0.11"
|
||||
|
||||
# HTTP client for network API
|
||||
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "json", "blocking"] }
|
||||
|
||||
# Serialization
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
||||
8
justfile
8
justfile
@@ -348,4 +348,10 @@ aur-test-pkg pkg:
|
||||
# just aur-local-test -c owlry-core owlry-rune
|
||||
# just aur-local-test --all --reset
|
||||
aur-local-test *args:
|
||||
scripts/aur-local-test {{args}}
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ts=$(date +%Y%m%d-%H%M%S)
|
||||
outfile="build-logs/aur-test-$ts.log"
|
||||
mkdir -p build-logs
|
||||
scripts/aur-local-test {{args}} 2>&1 | tee "$outfile"
|
||||
echo "⌁ Output saved to $outfile"
|
||||
|
||||
Reference in New Issue
Block a user