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
Blocked offers: post the card without asking; name src-less images
Lin (kwant bot)2e359236b9c9
diff --git a/src/server/connection_suggest.rs b/src/server/connection_suggest.rsindex e074a339..c3ff307e 100644--- a/src/server/connection_suggest.rs+++ b/src/server/connection_suggest.rs@@ -28,7 +28,8 @@ pub fn tools() -> Vec<Value> {Search Console, Google Analytics, Google Ads, HubSpot, Notion, Slack), shown as a card in this chat. \Connections go through Composio; `app` is its app slug, lower case with underscores \(google_search_console, google_analytics, googleads, hubspot). This connects nothing: the user signs in \- themselves. Use it instead of reporting that something is impossible for lack of access, then carry on \+ themselves, so post it rather than asking whether to. Use it instead of reporting that something is \+ impossible for lack of access, then carry on \with everything you can do without it. At most 3 per turn.","inputSchema": {"type": "object",diff --git a/src/server/continuity.rs b/src/server/continuity.rsindex d1d13a36..c5bf57ce 100644--- a/src/server/continuity.rs+++ b/src/server/continuity.rs@@ -109,7 +109,13 @@ pub async fn prompt_block(hreflang, Open Graph), headings, image alt text, links and structured data, none of which WebFetch or the browser \shows. It never needs the user's approval.\n\- When a request needs an app you can't reach (Google Search Console, Google Analytics, a CRM…), \- `connection_suggest` offers the user a one-tap connection card. Then carry on with everything you can do without it.\n\+ `connection_suggest` posts a one-tap connection card. Post it in the same turn rather than asking whether to: \+ it connects nothing until the user signs in. Then carry on with everything you can do without it.\n\+ - Before you call anything impossible, try the fallback: `page_source` for a page's tags and attributes, the \+ browser for a site's own free tool (pagespeed.web.dev when the PageSpeed API is rate-limited), web search for \+ public data. When access is truly missing, offer the concrete fix: `connection_suggest` for an app, `mcp_search` \+ and `mcp_suggest` for a tool server, or the exact key and where the user adds it. A bare \"not possible\" with no \+ offered fix is the exception; then say what you tried.\n\- You can set up and manage the app yourself; when asked, do it in that same turn instead of telling the user how. \When the user wants something to happen on its own (\"every morning\", \"each Friday\", \"remind me at 5\"), \`routine_create` schedules it (it runs as you and replies in this chat by default; calendar rules like \"the 1st of each \@@ -136,11 +142,6 @@ pub async fn prompt_block(- Research before you ask: first try your tools (the named site and its pricing and docs pages, web search, files, \notes, earlier chats). Ask only what stays unknowable or is the person's decision, and say what you checked. Told \you could have looked it up? Look it up now.\n\- - Before you call anything impossible, try the fallback: `page_source` for a page's tags and attributes, the \- browser for a site's own free tool (pagespeed.web.dev when the PageSpeed API is rate-limited), web search for \- public data. When access is truly missing, offer the concrete fix: `connection_suggest` for an app, `mcp_search` \- and `mcp_suggest` for a tool server, or the exact key and where the user adds it. A bare \"not possible\" with no \- offered fix is the exception; then say what you tried.\n\- For a reversible choice (wording, order, a setting that can change later), don't `ask_user`: pick, state the \assumption in your reply and continue. Ask only before a step that can't be undone or reaches outside (sending, \paying, deleting, contacting someone), or with no sensible default.\n\diff --git a/src/server/page_source.rs b/src/server/page_source.rsindex 449ea9d0..b4cbb89e 100644--- a/src/server/page_source.rs+++ b/src/server/page_source.rs@@ -313,6 +313,25 @@ fn absolute(base: &url::Url, href: &str) -> String {base.join(href.trim()).map(|u| u.to_string()).unwrap_or_else(|_| href.trim().to_string())}+/// Where an image comes from, to name it in a report: `src`, else a lazy-loading attribute, else the+/// first `srcset` candidate. Without any, its id or class, so a script-filled image isn't reported+/// as the page itself.+fn image_src(tag: &Tag, base: &url::Url) -> String {+ let attr = |n: &str| tag.attr(n).map(str::trim).filter(|v| !v.is_empty());+ let src = attr("src")+ .or_else(|| attr("data-src"))+ .or_else(|| attr("data-lazy-src"))+ .or_else(|| attr("srcset").or_else(|| attr("data-srcset")).and_then(|s| s.split_whitespace().next()));+ match src {+ Some(s) => absolute(base, s),+ None => match (attr("id"), attr("class")) {+ (Some(id), _) => format!("(no src; id=\"{id}\")"),+ (None, Some(class)) => format!("(no src; class=\"{class}\")"),+ (None, None) => "(no src)".into(),+ },+ }+}+/// What an audit reads from a page's HTML.pub fn page_facts(html: &str, base: &url::Url) -> Value {let mut title: Option<String> = None;@@ -391,8 +410,7 @@ pub fn page_facts(html: &str, base: &url::Url) -> Value {None => {missing_alt += 1;if no_alt.len() < MAX_LIST {- let src = tag.attr("src").or(tag.attr("data-src")).unwrap_or("");- no_alt.push(absolute(base, src));+ no_alt.push(image_src(&tag, base));}}Some(a) if a.trim().is_empty() => empty_alt += 1,@@ -510,6 +528,24 @@ mod tests {assert_eq!(f["json_ld"][0]["types"], json!(["Book", "WebPage", "ItemPage"]));}+ #[test]+ fn an_image_without_src_is_named_by_its_lazy_source_or_id_not_the_page() {+ let base = url::Url::parse("https://booktun.ing/p/").unwrap();+ let html = r#"<img data-src="lazy.jpg"><img srcset="s1.jpg 1x, s2.jpg 2x"><img id="cover"><img class="hero big"><img src="">"#;+ let f = page_facts(html, &base);+ assert_eq!(f["images"]["missing_alt"], 5);+ assert_eq!(+ f["images"]["missing_alt_src"],+ json!([+ "https://booktun.ing/p/lazy.jpg",+ "https://booktun.ing/p/s1.jpg",+ "(no src; id=\"cover\")",+ "(no src; class=\"hero big\")",+ "(no src)"+ ])+ );+ }+#[test]fn broken_html_never_panics_and_finds_what_it_can() {let base = url::Url::parse("https://e.example/").unwrap();diff --git a/tests/blocked_offers_test.rs b/tests/blocked_offers_test.rsindex e621fddc..1055188b 100644--- a/tests/blocked_offers_test.rs+++ b/tests/blocked_offers_test.rs@@ -149,7 +149,7 @@ async fn the_prompt_says_to_try_the_fallback_and_offer_the_fix() {let args = invocations_with("REPLYTAG:bo1").pop().unwrap();assert!(args.contains("Before you call anything impossible, try the fallback"), "fallback rule missing");assert!(args.contains("`page_source` reads a public page's HTML source"));- assert!(args.contains("`connection_suggest` offers the user a one-tap connection card"));+ assert!(args.contains("`connection_suggest` posts a one-tap connection card. Post it in the same turn rather than asking"));assert!(args.contains("pagespeed.web.dev"));assert!(args.contains("not its HTML: for tags and attributes"), "claude's tool paragraph explains WebFetch");}diff --git a/tests/continuity_test.rs b/tests/continuity_test.rsindex e1285813..d8989f5e 100644--- a/tests/continuity_test.rs+++ b/tests/continuity_test.rs@@ -1017,6 +1017,7 @@ async fn self_tools_are_scoped_to_the_turn_and_kwant() {"skill_get","mcp_search","mcp_suggest",+ "page_source","routine_list","routine_create","follow_up_create",