Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Telegram: Allow once never ships code, runs a command or allows a risky step (18b) (#667)
Oleksandr Ivanchenkoc43d9d0a6d42
diff --git a/src/server/glance.rs b/src/server/glance.rsindex 81e34fa0..a661b881 100644--- a/src/server/glance.rs+++ b/src/server/glance.rs@@ -133,8 +133,9 @@ const OUTWARD_NAMES: &[&str] = &["TRANSFER", "SUBMIT", "TWEET", "SHARE", "INVITE", "FORWARD", "UPLOAD", "WIPE", "TERMINATE", "REVOKE", "PURCHASE",];-const PUSHES: &str = "This pushes code, so it needs the full card.";-const RUNS: &str = "This runs a command, so it needs the full card.";+pub const PUSHES: &str = "This pushes code, so it needs the full card.";+pub const RUNS: &str = "This runs a command, so it needs the full card.";+pub const RISKY: &str = "kwant flagged this step as risky.";const OUTWARD: &str = "This acts outside kwant, so it needs the full card.";/// Every argument key and string value, at any depth, in document order (array items in turn).@@ -262,23 +263,13 @@ pub fn inline_refusal(details: &Value) -> Option<&'static str> {other => other,});}- let set = |k: &str| details.get(k).is_some_and(|v| !v.is_null() && v != false);- if set("smart_reason") {- return Some("kwant flagged this step as risky.");- }- if set("prepush_grant") || set("strict_ask") {- return Some(PUSHES);+ if let Some(why) = ships(details) {+ return Some(why);}let tool = details["tool"].as_str().unwrap_or_default();let server = details["server"].as_str().unwrap_or_default();let args = &details["arguments"];- if !super::dev::prepush::mcp_writes(tool, args).is_empty() {- return Some(PUSHES);- }let upper = tool.to_ascii_uppercase();- if PUSH_WORDS.iter().any(|w| upper.contains(w)) {- return Some(PUSHES);- }// 1. A push-family word wherever it hides: the name, a key, a value, an argv itemlet mut all = vec![tool];texts(args, &mut all);@@ -301,6 +292,57 @@ pub fn inline_refusal(details: &Value) -> Option<&'static str> {None}+/// A risky step or the push floor, from the details alone: a step smart approvals flagged+/// ([`RISKY`]); a prepush grant, a strict ask, a GitHub write [`mcp_writes`] sees, or a+/// [`PUSH_WORDS`] part in the tool name ([`PUSHES`]). The first layers of [`inline_refusal`], in its+/// order.+///+/// [`mcp_writes`]: super::dev::prepush::mcp_writes+fn ships(details: &Value) -> Option<&'static str> {+ let set = |k: &str| details.get(k).is_some_and(|v| !v.is_null() && v != false);+ if set("smart_reason") {+ return Some(RISKY);+ }+ if set("prepush_grant") || set("strict_ask") {+ return Some(PUSHES);+ }+ let tool = details["tool"].as_str().unwrap_or_default();+ if !super::dev::prepush::mcp_writes(tool, &details["arguments"]).is_empty() {+ return Some(PUSHES);+ }+ let upper = tool.to_ascii_uppercase();+ if PUSH_WORDS.iter().any(|w| upper.contains(w)) {+ return Some(PUSHES);+ }+ None+}++/// Argument keys (any depth, any case) that Telegram's floor reads as free text to run: the+/// brief's four, plus `sql` (the Postgres server's `query` tool takes `{"sql": …}`). Narrower than+/// [`is_run_key`] on purpose: `query`, `args` and `code` sit on many search and sign-in tools that+/// Telegram keeps allowable (18b).+const TELEGRAM_RUN_KEYS: &[&str] = &["command", "cmd", "argv", "script", "sql"];++/// What Telegram's Allow once adds to its own floor (18b, Rigel's push-floor advisory): a step+/// that ships code or runs a command, or one kwant flagged as risky. [`ships`], then a tool that+/// runs free text: a [`RUNS_TEXT_NAMES`] part in the server or tool name, or an argument key that+/// is exactly one of [`TELEGRAM_RUN_KEYS`] ([`RUNS`]). Whatever it refuses,+/// [`inline_refusal`] refuses too; the island's other layers (outward names, HTTP verbs, push words+/// inside values, the broad run keys) stay off Telegram on purpose, so an email that says+/// "press release" keeps Allow once there.+pub fn ships_or_runs(details: &Value) -> Option<&'static str> {+ if let Some(why) = ships(details) {+ return Some(why);+ }+ let tool = details["tool"].as_str().unwrap_or_default();+ let server = details["server"].as_str().unwrap_or_default();+ let names = format!("{} {}", server.to_ascii_uppercase(), tool.to_ascii_uppercase());+ if RUNS_TEXT_NAMES.iter().any(|w| names.contains(w)) || any_key(&details["arguments"], &|k, _| TELEGRAM_RUN_KEYS.iter().any(|r| k.eq_ignore_ascii_case(r))) {+ return Some(RUNS);+ }+ None+}+/// [`inline_refusal`], plus the space's production marks (as Telegram's [`link_only_in`]).////// [`link_only_in`]: super::telegram::link_only_in@@ -814,6 +856,34 @@ mod tests {}}+ // 18b: Telegram's floor is a subset of the island's, so the island never offers what+ // Telegram refuses+ #[test]+ fn whatever_telegram_s_floor_refuses_the_island_refuses_too() {+ let mut rows: Vec<Value> = risky_rows().into_iter().map(|(_, d)| d).collect();+ rows.extend(hardening_rows().into_iter().map(|(_, d, _)| d));+ rows.extend(realistic_rows().into_iter().map(|(_, d)| d));+ rows.push(mcp("postgres", "query", json!({"sql": "DROP TABLE users"})));+ rows.push(mcp("devtools", "run_command", json!({"cmd": "gh pr merge 12"})));+ rows.push(mcp("composio", "GITHUB_CREATE_A_RELEASE", json!({"tag_name": "v1"})));+ let mut refused = 0;+ for d in &rows {+ if let Some(why) = ships_or_runs(d) {+ refused += 1;+ assert!([PUSHES, RUNS, RISKY].contains(&why), "{why}");+ assert!(inline_refusal(d).is_some(), "{d}");+ }+ }+ assert!(refused >= 3, "the table has refused rows");+ // And the ordinary ones it keeps+ for d in [+ mcp("composio", "GMAIL_SEND_EMAIL", json!({"recipient_email": "[email protected]", "subject": "Our press release", "body": "The press release is attached."})),+ mcp("composio", "NOTION_SEARCH_NOTION_PAGE", json!({"query": "release notes"})),+ ] {+ assert_eq!(ships_or_runs(&d), None, "{d}");+ }+ }+#[test]fn avatars_are_the_saved_sprite_or_null() {let avatars: HashMap<String, String> = [("a".to_string(), "architect".to_string()), ("b".to_string(), " ".to_string())].into();diff --git a/src/server/telegram/bridge.rs b/src/server/telegram/bridge.rsindex 5b96d3a7..d23690ea 100644--- a/src/server/telegram/bridge.rs+++ b/src/server/telegram/bridge.rs@@ -365,7 +365,7 @@ async fn allow_once(state: &AppState, runner: &Runner, link: &TelegramLink, ask:let _ = runner.client.answer_callback(cb_id, Some(copy::ALREADY_ANSWERED)).await;return;}- let why = super::link_only_in(state, &runner.space, &details).await;+ let why = super::allow_refusal(state, &runner.space, &details).await;if !(ask.allow && link.allow_approvals && why.is_none() && same) {let _ = state.db.telegram_ask_link_only(&ask.id).await;let _ = runner.client.answer_callback(cb_id, Some(copy::APPROVE_IN_KWANT)).await;@@ -508,7 +508,7 @@ async fn on_approval(state: &AppState, id: &str, tool_name: &str, details: &Valubody.push_str(&format!(" on <code>{}</code>", text::escape(&clip(server, 60))));}body.push('.');- let why = super::link_only_in(state, &space, details).await;+ let why = super::allow_refusal(state, &space, details).await;let allow = link.allow_approvals && why.is_none();let ask_id = new_ask_id();let mut rows = Vec::new();@@ -691,7 +691,7 @@ async fn approval_details(state: &AppState, ask: &TelegramAsk) -> Value {async fn link_only(state: &AppState, r: &Runner, ask: &TelegramAsk, details: &Value) {let Ok(Some(link)) = state.db.telegram_link(&ask.space_id).await else { return };- let why = super::link_only_in(state, &ask.space_id, details).await;+ let why = super::allow_refusal(state, &ask.space_id, details).await;let html = format!("{}\n\n<i>{}</i>", ask.text, text::escape(&excluded_reason(why, link.allow_approvals)));let kwant = details["kwant_id"].as_str();edit(state, r, ask, html, open_markup(state, &link, &ask.space_id, kwant).await);diff --git a/src/server/telegram/mod.rs b/src/server/telegram/mod.rsindex 6718da80..2a2b7160 100644--- a/src/server/telegram/mod.rs+++ b/src/server/telegram/mod.rs@@ -173,6 +173,31 @@ pub async fn link_only_in(state: &AppState, space: &str, details: &Value) -> Optcrate::mcp::prod_floor::production_connection(server, tool, &details["arguments"], &names).map(|_| "This is a production connection.")}+/// Why Allow once may not show (or, on a tap, count) in Telegram: [`link_only_in`], else a step+/// that ships code, runs a command or that kwant flagged as risky ([`glance::ships_or_runs`], 18b).+/// The send, the tap and the link-only edit all ask this, so they agree. `link_only_in` stays as it+/// is: the island builds on it.+///+/// [`glance::ships_or_runs`]: crate::server::glance::ships_or_runs+pub async fn allow_refusal(state: &AppState, space: &str, details: &Value) -> Option<&'static str> {+ if let Some(why) = link_only_in(state, space, details).await {+ return Some(why);+ }+ floor_reason(details)+}++/// [`glance::ships_or_runs`] in Telegram's words; the line then ends "Approve it in kwant."+///+/// [`glance::ships_or_runs`]: crate::server::glance::ships_or_runs+pub fn floor_reason(details: &Value) -> Option<&'static str> {+ use crate::server::glance;+ glance::ships_or_runs(details).map(|why| match why {+ glance::PUSHES => copy::PUSHES_CODE,+ glance::RUNS => copy::RUNS_A_COMMAND,+ other => other,+ })+}+/// The text Telegram shows (design G, "Telegram copy"). Product copy is Mira's.pub mod copy {pub const UNPAIRED: &str = "Unpaired. Pair again from kwant › Connections.";@@ -182,6 +207,9 @@ pub mod copy {pub const TEXT_ONLY: &str = "Only text works here for now. Send files in kwant.";pub const NO_GENERAL: &str = "This space has no #general, so your message wasn't sent. Open kwant to add one.";pub const APPROVE_IN_KWANT: &str = "Approve it in kwant.";+ /// Why a step is link-only (18b); the line reads "This pushes code. Approve it in kwant."+ pub const PUSHES_CODE: &str = "This pushes code.";+ pub const RUNS_A_COMMAND: &str = "This runs a command.";pub const NO_LONGER_WAITING: &str = "No longer waiting";pub const OPEN_IN_KWANT: &str = "Open in kwant";pub const ALLOW_ONCE: &str = "Allow once";@@ -651,4 +679,71 @@ mod tests {assert_eq!(link_only_reason(&send), None);assert!(approvable(&send));}++ /// 18b: the calls Telegram's Allow once refuses on top of `link_only_reason`, with their+ /// line, and the ordinary ones it keeps (the brief's table).+ /// A refused row: its name, the details, Telegram's line.+ type Refused = (&'static str, Value, &'static str);++ fn floor_rows() -> (Vec<Refused>, Vec<(&'static str, Value)>) {+ let mcp = |server: &str, tool: &str, args: Value| json!({"source": "mcp", "server": server, "tool": tool, "arguments": args});+ let with = |k: &str, v: Value| {+ let mut d = mcp("files", "lookup", json!({"q": "x"}));+ d[k] = v;+ d+ };+ let refused = vec![+ ("run_command with gh pr merge", mcp("devtools", "run_command", json!({"cmd": "gh pr merge 12"})), "This runs a command."),+ ("ssh_exec", mcp("remote", "ssh_exec", json!({"host": "prod", "line": "uptime"})), "This runs a command."),+ ("a SQL tool by name", mcp("db", "execute_sql", json!({"statement": "DELETE FROM users"})), "This runs a command."),+ ("a SQL tool by its sql key", mcp("postgres", "query", json!({"sql": "DROP TABLE users"})), "This runs a command."),+ ("a command key on any tool", mcp("helper", "do_it", json!({"opts": {"Command": "rm -rf ~"}})), "This runs a command."),+ ("a script key", mcp("helper", "automate", json!({"script": "tell app"})), "This runs a command."),+ ("an argv key", mcp("helper", "launch", json!({"argv": ["git", "push"]})), "This runs a command."),+ ("GITHUB_MERGE_A_PULL_REQUEST", mcp("composio", "GITHUB_MERGE_A_PULL_REQUEST", json!({"owner": "o", "repo": "r", "pull_number": 12})), "This pushes code."),+ ("GITHUB_CREATE_A_RELEASE", mcp("composio", "GITHUB_CREATE_A_RELEASE", json!({"owner": "o", "repo": "r", "tag_name": "v1"})), "This pushes code."),+ (+ "a GitHub write mcp_writes sees",+ mcp("github", "create_or_update_file", json!({"owner": "o", "repo": "r", "path": "a.txt", "content": "x", "message": "m", "branch": "main"})),+ "This pushes code.",+ ),+ ("a prepush grant", with("prepush_grant", json!({"repo": "o/r"})), "This pushes code."),+ ("a strict ask", with("strict_ask", json!(true)), "This pushes code."),+ ("a risky step", with("smart_reason", json!("Deletes records")), "kwant flagged this step as risky."),+ (+ "a risky file write in the folder",+ json!({"source": "claude_builtin", "tool": "Write", "outside_folder": false, "smart_reason": "Overwrites a config"}),+ "kwant flagged this step as risky.",+ ),+ ];+ let allowed = vec![+ (+ "an email that says press release",+ mcp("composio", "GMAIL_SEND_EMAIL", json!({"recipient_email": "[email protected]", "subject": "Our press release", "body": "The press release is attached; we merge and push it Monday."})),+ ),+ ("a Notion search with query", mcp("composio", "NOTION_SEARCH_NOTION_PAGE", json!({"query": "release notes"}))),+ ("a plain lookup", mcp("files", "lookup", json!({"q": "x"}))),+ ("an issue", mcp("composio", "GITHUB_CREATE_ISSUE", json!({"owner": "o", "repo": "r", "title": "t"}))),+ ("a write in the folder", json!({"source": "claude_builtin", "tool": "Write", "outside_folder": false, "arguments": {"file_path": "a.md", "content": "git push"}})),+ ("false flags", json!({"source": "mcp", "server": "files", "tool": "lookup", "strict_ask": false, "smart_reason": null, "prepush_grant": null})),+ ];+ (refused, allowed)+ }++ #[test]+ fn allow_once_never_ships_code_runs_a_command_or_allows_a_risky_step() {+ let (refused, allowed) = floor_rows();+ for (name, d, why) in refused {+ // Not Telegram's older floor: the new one catches it+ assert_eq!(link_only_reason(&d), None, "{name}: {d}");+ assert_eq!(floor_reason(&d), Some(why), "{name}: {d}");+ }+ for (name, d) in allowed {+ assert_eq!(link_only_reason(&d), None, "{name}: {d}");+ assert_eq!(floor_reason(&d), None, "{name}: {d}");+ }+ // The older floor's own reasons come first and stay as they were+ let d = json!({"source": "mcp", "server": "composio", "tool": "COMPOSIO_REMOTE_BASH_TOOL", "arguments": {"command": "ls"}});+ assert_eq!(link_only_reason(&d), Some("This step runs other actions inside it."));+ }}diff --git a/tests/telegram_test.rs b/tests/telegram_test.rsindex bf7548df..defb2255 100644--- a/tests/telegram_test.rs+++ b/tests/telegram_test.rs@@ -634,6 +634,136 @@ async fn allow_once_is_taken_back_in_the_db_even_with_nothing_listening() {assert!(!a.allow && a.state == "closed", "a new bot");}+// --- 18b Allow once never ships code, runs a command or allows a risky step -----------------++fn mcp(server: &str, tool: &str, args: Value) -> Value {+ json!({"source": "mcp", "server": server, "tool": tool, "arguments": args})+}++fn flagged(k: &str, v: Value) -> Value {+ let mut d = mcp("files", "lookup", json!({"q": "x"}));+ d[k] = v;+ d+}++/// The brief's table: what Telegram's Allow once refuses on top of its older floor, with its line.+fn floor_refused() -> Vec<(&'static str, Value, &'static str)> {+ vec![+ ("run_command", mcp("devtools", "run_command", json!({"cmd": "gh pr merge 12"})), "This runs a command."),+ ("ssh_exec", mcp("remote", "ssh_exec", json!({"host": "prod"})), "This runs a command."),+ ("execute_sql", mcp("db", "execute_sql", json!({"statement": "DELETE FROM users"})), "This runs a command."),+ ("query", mcp("postgres", "query", json!({"sql": "DROP TABLE users"})), "This runs a command."),+ ("GITHUB_MERGE_A_PULL_REQUEST", mcp("composio", "GITHUB_MERGE_A_PULL_REQUEST", json!({"owner": "o", "repo": "r", "pull_number": 12})), "This pushes code."),+ ("GITHUB_CREATE_A_RELEASE", mcp("composio", "GITHUB_CREATE_A_RELEASE", json!({"owner": "o", "repo": "r", "tag_name": "v1"})), "This pushes code."),+ (+ "create_or_update_file",+ mcp("github", "create_or_update_file", json!({"owner": "o", "repo": "r", "path": "a.txt", "content": "x", "message": "m", "branch": "main"})),+ "This pushes code.",+ ),+ ("prepush_grant", flagged("prepush_grant", json!({"repo": "o/r"})), "This pushes code."),+ ("strict_ask", flagged("strict_ask", json!(true)), "This pushes code."),+ ("smart_reason", flagged("smart_reason", json!("Deletes records")), "kwant flagged this step as risky."),+ ]+}++/// What Telegram keeps allowable on purpose (the island's stricter layers stay off it).+fn floor_allowed() -> Vec<(&'static str, Value)> {+ vec![+ (+ "GMAIL_SEND_EMAIL",+ mcp("composio", "GMAIL_SEND_EMAIL", json!({"recipient_email": "[email protected]", "subject": "Our press release", "body": "The press release is attached."})),+ ),+ ("NOTION_SEARCH_NOTION_PAGE", mcp("composio", "NOTION_SEARCH_NOTION_PAGE", json!({"query": "release notes"}))),+ ]+}++#[tokio::test]+async fn telegram_s_allow_once_refuses_what_ships_or_runs_and_keeps_ordinary_tools() {+ let env = setup().await;+ let space = kwnt::db::spaces::SpaceId::default_space();+ for (name, d, why) in floor_refused() {+ assert_eq!(kwnt::server::telegram::link_only_in(&env.state, space.as_str(), &d).await, None, "{name}: the older floor let it through");+ assert_eq!(kwnt::server::telegram::allow_refusal(&env.state, space.as_str(), &d).await, Some(why), "{name}");+ }+ for (name, d) in floor_allowed() {+ assert_eq!(kwnt::server::telegram::allow_refusal(&env.state, space.as_str(), &d).await, None, "{name}");+ }+}++#[tokio::test]+async fn a_call_that_ships_or_runs_is_sent_without_allow_once() {+ let env = setup().await;+ let tg = mock_telegram::shared();+ let bot = paired(&env, tg, 60).await;+ let (s, _) = call(&env.app, "PATCH", BASE, Some(json!({"allow_approvals": true}))).await;+ assert_eq!(s, StatusCode::OK);++ let mut seen = Vec::new();+ for (name, d, why) in floor_refused() {+ // One at a time; rows that share a tool name are told apart by the messages already seen+ let tool = format!("<code>{}</code>", d["tool"].as_str().unwrap());+ let (id, _rx) = approval(&env, d).await;+ let sent = tg.wait_send(&bot, |c| c.text().contains(&tool) && c.body.get("__sent_id").is_some() && !seen.contains(&c.message_id())).await;+ seen.push(sent.message_id());+ assert!(sent.callbacks().is_empty(), "{name}: {:?}", sent.buttons());+ assert!(sent.text().ends_with(&format!("<i>{why} Approve it in kwant.</i>")), "{name}: {}", sent.text());+ assert!(!env.state.db.telegram_asks_for("approval", &id).await.unwrap()[0].allow, "{name}");+ }+ // Never the arguments+ assert!(tg.calls(&bot).iter().all(|c| !c.body.to_string().contains("gh pr merge")), "arguments never go to Telegram");+}++#[tokio::test]+async fn a_tap_on_an_older_message_now_refused_goes_link_only_and_an_ordinary_one_still_allows() {+ let env = setup().await;+ let tg = mock_telegram::shared();+ let bot = paired(&env, tg, 61).await;+ let (s, _) = call(&env.app, "PATCH", BASE, Some(json!({"allow_approvals": true}))).await;+ assert_eq!(s, StatusCode::OK);++ // A message sent armed before 18b (same parameters, Allow once on it), whose call the new+ // rule refuses: the tap re-checks, allows nothing and turns the message link-only+ let (id, _rx) = approval(&env, mcp("composio", "GITHUB_MERGE_A_PULL_REQUEST", json!({"owner": "o", "repo": "r", "pull_number": 12}))).await;+ let card = tg.wait_send(&bot, |c| c.text().contains("<code>GITHUB_MERGE_A_PULL_REQUEST</code>")).await;+ let db = &env.state.db;+ wait_for("its message id", || async { db.telegram_asks_for("approval", &id).await.unwrap()[0].message_id == Some(card.message_id()) }).await;+ let ask = db.telegram_asks_for("approval", &id).await.unwrap().remove(0);+ arm(&env, &ask.id).await;+ let tap = tg.tap(&bot, &PERSON, card.message_id(), &format!("a:{}", ask.id));+ tg.wait_call(&bot, "answerCallbackQuery", |c| c.body["callback_query_id"] == tap && c.body["text"] == "Approve it in kwant.").await;+ let edit = tg.wait_edit(&bot, |c| c.message_id() == card.message_id()).await;+ assert!(edit.callbacks().is_empty(), "{:?}", edit.buttons());+ assert!(edit.text().ends_with("<i>This pushes code. Approve it in kwant.</i>"), "{}", edit.text());+ assert_eq!(env.state.db.get_approval(&id).await.unwrap().unwrap().status, "pending", "the tap resolved nothing");+ let ask = env.state.db.telegram_ask(kwnt::db::spaces::SpaceId::default_space().as_str(), &ask.id).await.unwrap().unwrap();+ assert!(!ask.allow, "disarmed");++ // An ordinary call (an email that says "press release") still gets Allow once, and the tap+ // resolves via "telegram"+ let mut events = env.state.event_sender.subscribe();+ let (_, d) = floor_allowed().remove(0);+ let (id, rx) = approval(&env, d).await;+ let card = tg.wait_send(&bot, |c| c.text().contains("<code>GMAIL_SEND_EMAIL</code>")).await;+ assert_eq!(card.callbacks().len(), 1, "{:?}", card.buttons());+ tg.tap(&bot, &PERSON, card.message_id(), &card.callbacks()[0]);+ assert!(matches!(tokio::time::timeout(Duration::from_secs(20), rx).await.unwrap().unwrap(), ApprovalDecision::AllowOnce));+ assert_eq!(withdrawn(&mut events, &id).await, (Some("telegram".into()), Some("allowed_once".into())));+ let row = listed(&env, &id).await;+ assert_eq!((row["answered_via"].as_str(), row["status"].as_str()), (Some("telegram"), Some("allowed_once")), "{row}");+}++/// Marks a Telegram ask as sent with Allow once, as a message from before a rule change was.+async fn arm(env: &Env, ask: &str) {+ let pool = sqlx::sqlite::SqlitePoolOptions::new()+ .max_connections(1)+ .connect(&format!("sqlite://{}", env.state.config.data_dir.join("kwnt.db").display()))+ .await+ .unwrap();+ let n = sqlx::query("UPDATE telegram_asks SET allow = 1 WHERE id = ?").bind(ask).execute(&pool).await.unwrap().rows_affected();+ assert_eq!(n, 1);+ pool.close().await;+}+async fn sqlx_update_parameters(env: &Env, id: &str, params: Value) {let pool = sqlx::sqlite::SqlitePoolOptions::new().max_connections(1)