Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(web-search): search DuckDuckGo without a key by default
LeoXing866473e88983
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.mdindex 3c2b075f..bcd3dea8 100644--- a/apps/computer/local-daemon/README.md+++ b/apps/computer/local-daemon/README.md@@ -507,7 +507,8 @@ Web tools depend on where the Runtime's model is served. On a subscription,Claude Code keeps `WebSearch` and `WebFetch`, deferred behind `ToolSearch`, soits developer instructions name them and how to load them; Codex keeps its own`web_search`. Both are also told that `teamhub web search` and `teamhub web open`-search and read through the search providers the user set up. A Runtime whose+search and read through the search providers the user set up, or DuckDuckGo+without a key. A Runtime whoseprofile is a localmodels-managed gateway profile (local models or BYOK, see`localmodels.GatewayRuntime`) cannot run provider-hosted search: Codex launcheswith `web_search="disabled"` after every user override, Claude's `--tools` leavesdiff --git a/apps/computer/local-daemon/internal/linger/context/resolver.go b/apps/computer/local-daemon/internal/linger/context/resolver.goindex 44481136..12cfcdf4 100644--- a/apps/computer/local-daemon/internal/linger/context/resolver.go+++ b/apps/computer/local-daemon/internal/linger/context/resolver.go@@ -54,7 +54,7 @@ type RegistrationBinding struct {const claudeWebToolGuide = `Web tools: WebSearch searches the web and WebFetch reads one page. They are loaded on demand: before the first call, load them with ToolSearch (query "select:WebSearch,WebFetch").`// teamHubWebSupplement follows a subscription Runtime's own web tools.-const teamHubWebSupplement = "`teamhub web search <query>` and `teamhub web open <url>` also search the web and read pages, through the search providers the user set up."+const teamHubWebSupplement = "`teamhub web search <query>` and `teamhub web open <url>` also search the web and read pages, through the search providers the user set up, or DuckDuckGo without a key."// teamHubWebToolGuide is the only web access of Pi and of a Runtime on local// models or BYOK.diff --git a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snapindex 6b09c8a3..06cdaaff 100644--- a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap+++ b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap@@ -3233,14 +3233,14 @@ teamhub web list [--backend <backend>]List the web search backends with what each supports, whether it is ready, and its quota.Options:- --backend <value> Show only this backend: tavily, brave, firecrawl, you or direct.+ --backend <value> Show only this backend: tavily, brave, firecrawl, you, duckduckgo or direct.--json Return machine-readable JSON.--help Show this offline command reference.-h Show help.--schema Show offline input and output schemas.","schema": "exit 0-{"command":["web","list"],"description":"List the web search backends with what each supports, whether it is ready, and its quota.","read_only":true,"input_schema":{"type":"object","properties":{"backend":{"enum":["tavily","brave","firecrawl","you","direct"]}},"additionalProperties":false},"output_schema":{"type":"object","properties":{"default_search":{"type":"string"},"chosen_default_search":{"type":"string"},"default_open":{"type":"string"},"can_save_keys":{"type":"boolean"},"backends":{"type":"array","items":{"type":"object"}}},"required":["default_search","default_open","backends"]},"cli":{"usage":["teamhub web list [--backend <backend>]"],"arguments":[],"options":{"--backend":{"description":"Show only this backend: tavily, brave, firecrawl, you or direct."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}+{"command":["web","list"],"description":"List the web search backends with what each supports, whether it is ready, and its quota.","read_only":true,"input_schema":{"type":"object","properties":{"backend":{"enum":["tavily","brave","firecrawl","you","duckduckgo","direct"]}},"additionalProperties":false},"output_schema":{"type":"object","properties":{"default_search":{"type":"string"},"chosen_default_search":{"type":"string"},"default_open":{"type":"string"},"can_save_keys":{"type":"boolean"},"backends":{"type":"array","items":{"type":"object"}}},"required":["default_search","default_open","backends"]},"cli":{"usage":["teamhub web list [--backend <backend>]"],"arguments":[],"options":{"--backend":{"description":"Show only this backend: tavily, brave, firecrawl, you, duckduckgo or direct."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}",},"web open": {@@ -3269,15 +3269,15 @@ teamhub web open https://example.com/report --backend firecrawl --output report.},"web search": {"help": "exit 0-teamhub web search <query> [--backend tavily|brave|firecrawl|you] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]...+teamhub web search <query> [--backend tavily|brave|firecrawl|you|duckduckgo] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]...Search the web through a provider with the deployment's saved API key.Arguments:<query> What to search for; 1-400 characters.Options:- --backend <value> tavily, brave, firecrawl or you. Without it the user's default runs, else the first ready backend.- --limit <value> Results to return; 1-20, default 5.+ --backend <value> tavily, brave, firecrawl, you or duckduckgo. Without it the user's default runs, else the first backend with a key, else duckduckgo, which needs none.+ --limit <value> Results to return; 1-20 up to the backend's max_limit, default 10.--recency <value> Only results from the past day, week, month or year.--site <value> Only results from this domain; repeat up to the backend's max_sites (teamhub web list).--json Return machine-readable JSON.@@ -3290,7 +3290,7 @@ teamhub web search "rust 2026 edition release date"teamhub web search "postgres 19 features" --recency month --site postgresql.org","schema": "exit 0-{"command":["web","search"],"description":"Search the web through a provider with the deployment's saved API key.","read_only":true,"input_schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":400},"backend":{"enum":["tavily","brave","firecrawl","you"]},"limit":{"type":"integer","minimum":1,"maximum":20},"recency":{"enum":["day","week","month","year"]},"sites":{"type":"array","maxItems":10,"items":{"type":"string","minLength":3,"maxLength":253}}},"required":["query"],"additionalProperties":false},"output_schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"},"snippet":{"type":"string"},"published_at":{"type":"string"}},"required":["title","url","snippet"]}}},"required":["results"]},"cli":{"usage":["teamhub web search <query> [--backend tavily|brave|firecrawl|you] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]..."],"arguments":["<query> What to search for; 1-400 characters."],"options":{"--backend":{"description":"tavily, brave, firecrawl or you. Without it the user's default runs, else the first ready backend."},"--limit":{"description":"Results to return; 1-20, default 5."},"--recency":{"description":"Only results from the past day, week, month or year."},"--site":{"description":"Only results from this domain; repeat up to the backend's max_sites (teamhub web list).","repeatable":true},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":["A backend never falls back to another one. When it needs an API key, TeamHub posts a card asking the user for it; end your turn and the card's result wakes you with the results."]}}+{"command":["web","search"],"description":"Search the web through a provider with the deployment's saved API key.","read_only":true,"input_schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":400},"backend":{"enum":["tavily","brave","firecrawl","you","duckduckgo"]},"limit":{"type":"integer","minimum":1,"maximum":20},"recency":{"enum":["day","week","month","year"]},"sites":{"type":"array","maxItems":10,"items":{"type":"string","minLength":3,"maxLength":253}}},"required":["query"],"additionalProperties":false},"output_schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"},"snippet":{"type":"string"},"published_at":{"type":"string"}},"required":["title","url","snippet"]}}},"required":["results"]},"cli":{"usage":["teamhub web search <query> [--backend tavily|brave|firecrawl|you|duckduckgo] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]..."],"arguments":["<query> What to search for; 1-400 characters."],"options":{"--backend":{"description":"tavily, brave, firecrawl, you or duckduckgo. Without it the user's default runs, else the first backend with a key, else duckduckgo, which needs none."},"--limit":{"description":"Results to return; 1-20 up to the backend's max_limit, default 10."},"--recency":{"description":"Only results from the past day, week, month or year."},"--site":{"description":"Only results from this domain; repeat up to the backend's max_sites (teamhub web list).","repeatable":true},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":["A backend never falls back to another one. When it needs an API key, TeamHub posts a card asking the user for it; end your turn and the card's result wakes you with the results."]}}",},}diff --git a/apps/teamhub-cli/src/cli.openapi.test.ts b/apps/teamhub-cli/src/cli.openapi.test.tsindex 990f514e..0708ee41 100644--- a/apps/teamhub-cli/src/cli.openapi.test.ts+++ b/apps/teamhub-cli/src/cli.openapi.test.ts@@ -525,8 +525,8 @@ async function respond(request: Request): Promise<Response> {{id: "you",name: "You.com",- tier: "free_trial",- tier_text: "Free trial - limited and lower quality.",+ tier: "free",+ tier_text: "Free without a key: limited, lower quality.",commands: ["search", "open"],filters: ["recency"],max_limit: 20,diff --git a/apps/teamhub-cli/src/web-commands.test.ts b/apps/teamhub-cli/src/web-commands.test.tsindex a9399a8d..db0ef8ac 100644--- a/apps/teamhub-cli/src/web-commands.test.ts+++ b/apps/teamhub-cli/src/web-commands.test.ts@@ -144,13 +144,15 @@ describe("teamhub web search", () => {},});});- it("names a rejected key and the used-up trial", async () => {- const reasons = ["rejected", "free_limit"];+ it("names a rejected key and the used-up free searches", async () => {+ const cases = [+ { backend: "brave", reason: "rejected" },+ { backend: "you", reason: "free_limit" },+ ];const f = await fixture(() =>teamHubError(409, "SEARCH_KEY_REQUESTED", {- backend: "brave",+ ...cases.shift(),origin: "requested",- reason: reasons.shift(),message_id: "message_card",}),);@@ -161,7 +163,7 @@ describe("teamhub web search", () => {"Waiting for the user to replace the Brave Search API key, which Brave Search no longer accepts;",);expect(text).toContain(- "The free web search trial is used up. Waiting for the user to add a web search API key;",+ "You.com's free searches without a key are used up. Waiting for the user to add a You.com API key;",);expect(text).not.toContain("Provider prose");});@@ -300,8 +302,8 @@ describe("teamhub web list and connect", () => {{id: "you",name: "You.com",- tier: "free_trial",- tier_text: "Free trial - limited and lower quality.",+ tier: "free",+ tier_text: "Free without a key: limited, lower quality.",commands: ["search", "open"],filters: ["recency"],max_limit: 20,@@ -339,9 +341,7 @@ describe("teamhub web list and connect", () => {"Default search: tavily (chosen by the user). Default open: direct.",);expect(text).toContain("900 of 1000 credits left");- expect(text).toContain(- "free trial: Free trial - limited and lower quality.",- );+ expect(text).toContain("free: Free without a key: limited, lower quality.");expect(text).toContain("free tier: Free monthly credits.");expect(text).toContain("run teamhub web connect <backend>");});diff --git a/apps/teamhub-cli/src/web-commands.ts b/apps/teamhub-cli/src/web-commands.tsindex d3ad8cbe..d515de51 100644--- a/apps/teamhub-cli/src/web-commands.ts+++ b/apps/teamhub-cli/src/web-commands.ts@@ -10,6 +10,7 @@ import { teamHubData } from "./http-client.js";type Json = Record<string, unknown>;const keyBackends = ["tavily", "brave", "firecrawl", "you"] as const;+const searchBackends = [...keyBackends, "duckduckgo"] as const;const openBackends = ["tavily", "firecrawl", "you", "direct"] as const;const recencies = ["day", "week", "month", "year"] as const;const names: Record<string, string> = {@@ -17,6 +18,7 @@ const names: Record<string, string> = {brave: "Brave Search",firecrawl: "Firecrawl",you: "You.com",+ duckduckgo: "DuckDuckGo",direct: "Direct",};const nameOf = (backend: unknown) =>@@ -67,7 +69,7 @@ function webFailure(error: unknown): never {case "search_key_requested":throw authored(details.reason === "free_limit"- ? `The free web search trial is used up. Waiting for the user to add a web search API key; ${wait}`+ ? `${name}'s free searches without a key are used up. Waiting for the user to add a ${name} API key; ${wait}`: details.reason === "rejected"? `Waiting for the user to replace the ${name} API key, which ${name} no longer accepts; ${wait}`: `Waiting for the user to add a ${name} API key; ${wait}`,@@ -154,14 +156,16 @@ const webSearch: CommandDefinition = {"Search the web through a provider with the deployment's saved API key.",readOnly: true,usage: [- "teamhub web search <query> [--backend tavily|brave|firecrawl|you] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]...",+ "teamhub web search <query> [--backend tavily|brave|firecrawl|you|duckduckgo] [--limit 1-20] [--recency day|week|month|year] [--site <domain>]...",],arguments: ["<query> What to search for; 1-400 characters."],options: {"--backend": flag(- "tavily, brave, firecrawl or you. Without it the user's default runs, else the first ready backend.",+ "tavily, brave, firecrawl, you or duckduckgo. Without it the user's default runs, else the first backend with a key, else duckduckgo, which needs none.",+ ),+ "--limit": flag(+ "Results to return; 1-20 up to the backend's max_limit, default 10.",),- "--limit": flag("Results to return; 1-20, default 5."),"--recency": flag("Only results from the past day, week, month or year."),"--site": flag("Only results from this domain; repeat up to the backend's max_sites (teamhub web list).",@@ -179,7 +183,7 @@ const webSearch: CommandDefinition = {type: "object",properties: {query: { type: "string", minLength: 1, maxLength: 400 },- backend: backendSchema(keyBackends),+ backend: backendSchema(searchBackends),limit: { type: "integer", minimum: 1, maximum: 20 },recency: { enum: [...recencies] },sites: {@@ -200,7 +204,11 @@ const webSearch: CommandDefinition = {const query = args.positionals.join(" ").trim();if (!query || [...query].length > 400)usage("Provide a search query of 1-400 characters.");- const backend = choice(option(args, "--backend"), keyBackends, "--backend");+ const backend = choice(+ option(args, "--backend"),+ searchBackends,+ "--backend",+ );const recency = choice(option(args, "--recency"), recencies, "--recency");const limitText = option(args, "--limit");const limit = limitText === undefined ? undefined : Number(limitText);@@ -385,13 +393,13 @@ const webList: CommandDefinition = {usage: ["teamhub web list [--backend <backend>]"],options: {"--backend": flag(- "Show only this backend: tavily, brave, firecrawl, you or direct.",+ "Show only this backend: tavily, brave, firecrawl, you, duckduckgo or direct.",),},inputSchema: {type: "object",properties: {- backend: backendSchema([...keyBackends, "direct"]),+ backend: backendSchema([...searchBackends, "direct"]),},additionalProperties: false,},@@ -410,7 +418,7 @@ const webList: CommandDefinition = {assertPositionals(args, 0);const backend = choice(option(args, "--backend"),- [...keyBackends, "direct"],+ [...searchBackends, "direct"],"--backend",);return { input: backend ? { backend } : {} };@@ -432,7 +440,7 @@ const webList: CommandDefinition = {Array.isArray(item.filters) && item.filters.length? `filters: ${item.filters.map(line).join(", ")}${typeof item.max_sites === "number" && item.max_sites ? ` (up to ${item.max_sites} sites)` : ""}`: "",- item.tier === "free_trial" ? `free trial: ${line(item.tier_text)}` : "",+ item.tier === "free" ? `free: ${line(item.tier_text)}` : "",quotaText(item.quota as Json | undefined),status !== "ready" && item.free_tier? `free tier: ${line(item.free_tier)}`diff --git a/apps/teamhub/internal/app/feature_web_search.go b/apps/teamhub/internal/app/feature_web_search.goindex 239f5d49..d11072a9 100644--- a/apps/teamhub/internal/app/feature_web_search.go+++ b/apps/teamhub/internal/app/feature_web_search.go@@ -18,7 +18,7 @@ const maxReplayResultBytes = 24000// registerWebSearch builds web search over the keys saved in the product,// sealed with TEAMHUB_SECRET_ENCRYPTION_KEY. Without that key nothing can be-// saved and only You.com's keyless trial and direct work.+// saved and only DuckDuckGo, You.com without a key and direct work.func (a *App) registerWebSearch(cfg config.Config, deps Deps) error {box, err := secretBox(cfg.ExternalApps.SecretEncryptionKey)if err != nil {@@ -154,7 +154,7 @@ func (a *App) deleteWebSearchKey(c *gin.Context) {func (a *App) setWebSearchDefault(c *gin.Context) {var request httpapi.SetWebSearchDefaultRequest- if decodeJSON(c, &request) != nil || !websearch.KeyBackend(websearch.Backend(request.Backend)) {+ if decodeJSON(c, &request) != nil || !websearch.SearchBackend(websearch.Backend(request.Backend)) {a.writeError(c, http.StatusBadRequest, "INVALID_REQUEST", "Web search default request is invalid")return}diff --git a/apps/teamhub/internal/websearch/duckduckgo.go b/apps/teamhub/internal/websearch/duckduckgo.gonew file mode 100644index 00000000..0fb7ac61--- /dev/null+++ b/apps/teamhub/internal/websearch/duckduckgo.go@@ -0,0 +1,129 @@+package websearch++import (+ "bytes"+ "context"+ "io"+ "net/http"+ "net/url"+ "slices"+ "strings"++ "golang.org/x/net/html"+)++// duckDuckGoRecency maps the contract's recency to DuckDuckGo's df values.+var duckDuckGoRecency = map[string]string{"day": "d", "week": "w", "month": "m", "year": "y"}++// duckDuckGoSearch posts the query to DuckDuckGo's HTML results page, which+// needs no key. DuckDuckGo answers a GET from a script, and a POST that comes+// too soon after the last, with a 202 challenge page instead of results;+// that is a rate limit.+func (p *providers) duckDuckGoSearch(ctx context.Context, request Request) (Outcome, error) {+ query := request.Query+ if len(request.Sites) == 1 {+ query += " site:" + request.Sites[0]+ }+ form := url.Values{"q": {query}, "kl": {"wt-wt"}}+ if df := duckDuckGoRecency[request.Recency]; df != "" {+ form.Set("df", df)+ }+ ctx, cancel := context.WithTimeout(ctx, searchTimeout)+ defer cancel()+ call, err := http.NewRequestWithContext(ctx, http.MethodPost, p.endpoints.DuckDuckGo+"/html/", strings.NewReader(form.Encode()))+ if err != nil {+ return Outcome{}, &Failure{Code: CodeProviderUnavailable}+ }+ call.Header.Set("Content-Type", "application/x-www-form-urlencoded")+ call.Header.Set("Accept", "text/html")+ response, err := p.client.Do(call)+ if err != nil {+ return Outcome{}, &Failure{Code: CodeProviderUnavailable}+ }+ defer response.Body.Close()+ body, err := io.ReadAll(io.LimitReader(response.Body, maxResponseBody))+ if err != nil {+ return Outcome{}, &Failure{Code: CodeProviderUnavailable}+ }+ switch {+ case response.StatusCode == http.StatusAccepted || response.StatusCode == http.StatusTooManyRequests:+ return Outcome{}, &Failure{Code: CodeRateLimited, RetryAfter: retryAfter(response.Header)}+ case response.StatusCode != http.StatusOK:+ return Outcome{}, &Failure{Code: CodeProviderUnavailable}+ }+ results, challenged, err := duckDuckGoResults(body)+ switch {+ case err != nil:+ return Outcome{}, &Failure{Code: CodeProviderUnavailable}+ case challenged:+ return Outcome{}, &Failure{Code: CodeRateLimited}+ }+ return Outcome{Results: limitResults(results, request.Limit)}, nil+}++// duckDuckGoResults reads the organic results of a results page, skipping+// ads. challenged reports the bot challenge DuckDuckGo sometimes serves with+// 200.+func duckDuckGoResults(page []byte) (results []Result, challenged bool, err error) {+ root, err := html.Parse(bytes.NewReader(page))+ if err != nil {+ return nil, false, err+ }+ for node := range root.Descendants() {+ if node.Type != html.ElementNode {+ continue+ }+ if node.Data == "form" && attribute(node, "id") == "challenge-form" {+ return nil, true, nil+ }+ classes := strings.Fields(attribute(node, "class"))+ if node.Data != "div" || !slices.Contains(classes, "result") || slices.Contains(classes, "result--ad") {+ continue+ }+ var title, link, snippet string+ for inner := range node.Descendants() {+ if inner.Type != html.ElementNode || inner.Data != "a" {+ continue+ }+ switch innerClasses := strings.Fields(attribute(inner, "class")); {+ case slices.Contains(innerClasses, "result__a"):+ title, link = textOf(inner), duckDuckGoLink(attribute(inner, "href"))+ case slices.Contains(innerClasses, "result__snippet"):+ snippet = textOf(inner)+ }+ }+ results = appendResult(results, title, link, snippet, "")+ }+ return results, false, nil+}++// duckDuckGoLink unwraps the redirect link DuckDuckGo uses for some results.+func duckDuckGoLink(href string) string {+ parsed, err := url.Parse(href)+ if err != nil {+ return ""+ }+ if strings.HasSuffix(parsed.Host, "duckduckgo.com") && parsed.Path == "/l/" {+ return parsed.Query().Get("uddg")+ }+ return href+}++func attribute(node *html.Node, name string) string {+ for _, attr := range node.Attr {+ if attr.Key == name {+ return attr.Val+ }+ }+ return ""+}++func textOf(node *html.Node) string {+ var text strings.Builder+ for inner := range node.Descendants() {+ if inner.Type == html.TextNode {+ text.WriteString(inner.Data)+ }+ }+ return text.String()+}diff --git a/apps/teamhub/internal/websearch/duckduckgo_test.go b/apps/teamhub/internal/websearch/duckduckgo_test.gonew file mode 100644index 00000000..1e8fd021--- /dev/null+++ b/apps/teamhub/internal/websearch/duckduckgo_test.go@@ -0,0 +1,125 @@+package websearch++import (+ "errors"+ "net/http"+ "slices"+ "testing"+)++const duckDuckGoPage = `<html><body><div id="links" class="results">+<div class="result results_links result--ad"><a class="result__a" href="https://ads.example/buy">Sponsored</a>+<a class="result__snippet" href="https://ads.example/buy">buy now</a></div>+<div class="result results_links results_links_deep web-result">+<h2 class="result__title"><a rel="nofollow" class="result__a" href="https://www.postgresql.org/docs/release/">Release <b>Notes</b> & more</a></h2>+<a class="result__snippet" href="https://www.postgresql.org/docs/release/">Every <b>release</b> of PostgreSQL.</a></div>+<div class="result results_links web-result">+<h2 class="result__title"><a class="result__a" href="//duckduckgo.com/l/?uddg=https%3A%2F%2Fwiki.example%2Fpg%3Fa%3D1&rut=x">Wiki</a></h2>+<a class="result__snippet">From the wiki.</a></div>+<div class="result results_links web-result"><a class="result__a" href="javascript:alert(1)">bad</a></div>+</div></body></html>`++func TestDuckDuckGoSearchPostsTheQueryAndReadsOrganicResults(t *testing.T) {+ fake := newFakeProviders(t, func(w http.ResponseWriter, r seen) {+ if r.method != http.MethodPost || r.path != "/ddg/html/" || r.query != "" {+ t.Errorf("request = %s %s?%s", r.method, r.path, r.query)+ }+ _, _ = w.Write([]byte(duckDuckGoPage))+ })+ s, _ := newTestService(t, fake)+ request, err := Normalize(Request{Command: CommandSearch, Backend: DuckDuckGo, Query: "release notes", Recency: "month",+ Sites: []string{"PostgreSQL.org"}})+ if err != nil {+ t.Fatal(err)+ }+ outcome, err := s.Run(t.Context(), request)+ if err != nil || outcome.Backend != DuckDuckGo {+ t.Fatalf("Run = %+v, %v", outcome, err)+ }+ want := []Result{+ {Title: "Release Notes & more", URL: "https://www.postgresql.org/docs/release/", Snippet: "Every release of PostgreSQL."},+ {Title: "Wiki", URL: "https://wiki.example/pg?a=1", Snippet: "From the wiki."},+ }+ if !slices.Equal(outcome.Results, want) {+ t.Fatalf("results = %+v", outcome.Results)+ }+ form := fake.seen()[0].form+ if form.Get("q") != "release notes site:postgresql.org" || form.Get("df") != "m" || form.Get("kl") != "wt-wt" {+ t.Fatalf("form = %v", form)+ }+}++func TestDuckDuckGoIsTheDefaultWithoutAKey(t *testing.T) {+ fake := newFakeProviders(t, func(w http.ResponseWriter, r seen) {+ if r.path != "/ddg/html/" {+ t.Errorf("unexpected %s", r.path)+ }+ _, _ = w.Write([]byte(duckDuckGoPage))+ })+ s, keys := newTestService(t, fake)+ outcome, err := s.Run(t.Context(), search("pg"))+ if err != nil || outcome.Backend != DuckDuckGo || len(outcome.Results) != 2 {+ t.Fatalf("Run without keys = %+v, %v", outcome, err)+ }+ saveRaw(t, s, keys, Tavily, "provider-secret", "verified")+ if list, err := s.List(t.Context(), false); err != nil || list.DefaultSearch != Tavily {+ t.Fatalf("default with a Tavily key = %q, %v", list.DefaultSearch, err)+ }+ chosen, err := s.SetDefault(t.Context(), DuckDuckGo)+ if err != nil || chosen.DefaultSearch != DuckDuckGo || chosen.ChosenDefault != DuckDuckGo {+ t.Fatalf("SetDefault = %+v, %v", chosen, err)+ }+ if err := s.RemoveKey(t.Context(), DuckDuckGo); !errors.Is(err, ErrInvalid) {+ t.Fatalf("RemoveKey = %v", err)+ }+ if _, err := s.SaveKey(t.Context(), DuckDuckGo, "provider-secret"); !errors.Is(err, ErrInvalid) {+ t.Fatalf("SaveKey = %v", err)+ }+}++func TestDuckDuckGoChallengeIsARateLimit(t *testing.T) {+ for _, tc := range []struct {+ name string+ status int+ body string+ }{+ {"202 challenge", http.StatusAccepted, `<form id="challenge-form" method="POST"></form>`},+ {"200 challenge", http.StatusOK, `<html><form id="challenge-form"></form></html>`},+ } {+ t.Run(tc.name, func(t *testing.T) {+ fake := newFakeProviders(t, func(w http.ResponseWriter, r seen) {+ w.WriteHeader(tc.status)+ _, _ = w.Write([]byte(tc.body))+ })+ s, _ := newTestService(t, fake)+ request := search("pg")+ request.Backend = DuckDuckGo+ _, err := s.Run(t.Context(), request)+ var failure *Failure+ if !errors.As(err, &failure) || failure.Code != CodeRateLimited || failure.Backend != DuckDuckGo ||+ !slices.Equal(failure.Ready, []Backend{You}) {+ t.Fatalf("Run = %#v", err)+ }+ })+ }+}++func TestDuckDuckGoRefusesWhatItsPageCannotHonor(t *testing.T) {+ fake := newFakeProviders(t, func(w http.ResponseWriter, r seen) {+ t.Errorf("unexpected %s", r.path)+ })+ s, _ := newTestService(t, fake)+ for _, request := range []Request{+ {Command: CommandSearch, Backend: DuckDuckGo, Query: "pg", Limit: 11},+ {Command: CommandSearch, Backend: DuckDuckGo, Query: "pg", Sites: []string{"a.example", "b.example"}},+ } {+ normalized, err := Normalize(request)+ if err != nil {+ t.Fatal(err)+ }+ var failure *Failure+ if _, err := s.Run(t.Context(), normalized); !errors.As(err, &failure) || failure.Code != CodeUnsupported {+ t.Fatalf("Run(%+v) = %v", request, err)+ }+ }+}diff --git a/apps/teamhub/internal/websearch/providers.go b/apps/teamhub/internal/websearch/providers.goindex 16067e1f..5454cbc5 100644--- a/apps/teamhub/internal/websearch/providers.go+++ b/apps/teamhub/internal/websearch/providers.go@@ -25,6 +25,7 @@ const (DefaultYouAPIURL = "https://api.you.com"DefaultYouIndexURL = "https://ydc-index.io"DefaultYouMCPURL = "https://api.you.com/mcp/free"+ DefaultDuckDuckGo = "https://html.duckduckgo.com")// Call budgets. A page read waits longer because the provider fetches and@@ -40,8 +41,8 @@ const (// API. Client replaces the default client, which never follows a redirect so// a key never reaches another host.type Endpoints struct {- Tavily, Brave, Firecrawl, YouAPI, YouIndex, YouMCP string- Client *http.Client+ Tavily, Brave, Firecrawl, YouAPI, YouIndex, YouMCP, DuckDuckGo string+ Client *http.Client}type providers struct {@@ -57,6 +58,7 @@ func newProviders(endpoints Endpoints) *providers {{&endpoints.Tavily, DefaultTavilyURL}, {&endpoints.Brave, DefaultBraveURL},{&endpoints.Firecrawl, DefaultFirecrawlURL}, {&endpoints.YouAPI, DefaultYouAPIURL},{&endpoints.YouIndex, DefaultYouIndexURL}, {&endpoints.YouMCP, DefaultYouMCPURL},+ {&endpoints.DuckDuckGo, DefaultDuckDuckGo},} {if *field.value == "" {*field.value = field.fallbackdiff --git a/apps/teamhub/internal/websearch/websearch.go b/apps/teamhub/internal/websearch/websearch.goindex 4586870b..3d735eb5 100644--- a/apps/teamhub/internal/websearch/websearch.go+++ b/apps/teamhub/internal/websearch/websearch.go@@ -3,7 +3,8 @@// secret box. A key serves the whole deployment and is read from the// database at each call, so a save applies on every replica at once. TeamHub// calls only the providers' fixed API hosts: it never requests a page URL-// itself, and the direct backend is fetched by the Agent CLI.+// itself, and the direct backend is fetched by the Agent CLI. DuckDuckGo's+// HTML results page needs no key.package websearchimport (@@ -29,20 +30,27 @@ type Backend string// The backends. Direct opens pages on the Agent's computer and never reaches// TeamHub's calls.const (- Tavily Backend = "tavily"- Brave Backend = "brave"- Firecrawl Backend = "firecrawl"- You Backend = "you"- Direct Backend = "direct"+ Tavily Backend = "tavily"+ Brave Backend = "brave"+ Firecrawl Backend = "firecrawl"+ You Backend = "you"+ DuckDuckGo Backend = "duckduckgo"+ Direct Backend = "direct")// keyOrder is TeamHub's default order: a search without a backend uses the-// first one with a usable key, then You.com's keyless trial.+// first one with a usable key, then DuckDuckGo.var keyOrder = []Backend{Tavily, Brave, Firecrawl, You}+// searchOrder is every backend that searches, in the order lists show them.+var searchOrder = append(slices.Clone(keyOrder), DuckDuckGo)+// KeyBackend reports whether b takes an API key saved in the product.func KeyBackend(b Backend) bool { return slices.Contains(keyOrder, b) }+// SearchBackend reports whether b runs searches.+func SearchBackend(b Backend) bool { return slices.Contains(searchOrder, b) }+// DisplayName is the provider's name as people know it.func DisplayName(b Backend) string { return definitions[b].name }@@ -56,9 +64,9 @@ const (// The tiers a backend runs at now.const (- TierKey = "key"- TierFreeTrial = "free_trial"- TierNone = "none"+ TierKey = "key"+ TierFree = "free"+ TierNone = "none")// Bounds of the commands; the contract states the same.@@ -103,12 +111,18 @@ var definitions = map[Backend]definition{freeTier: "1,000 free credits every month.", keyURL: "https://www.firecrawl.dev/app/api-keys"},You: {name: "You.com", commands: []string{CommandSearch, CommandOpen}, filters: []string{FilterRecency},maxLimit: 20, keyless: true, officialCheck: true,- freeTier: "Works without a key as a limited free trial; a key gives full quality and higher limits.", keyURL: "https://you.com/platform"},+ freeTier: "Works without a key, limited; a key gives full quality and higher limits.", keyURL: "https://you.com/platform"},+ // DuckDuckGo's results page holds about ten results and takes one site.+ DuckDuckGo: {name: "DuckDuckGo", commands: []string{CommandSearch}, filters: []string{FilterRecency, FilterSite},+ maxLimit: 10, maxSites: 1, keyless: true},Direct: {name: "Direct", commands: []string{CommandOpen}, keyless: true},}-// freeTrialText describes You.com without a key, where TeamHub counts nothing.-const freeTrialText = "Free trial without a key: limited searches with lower quality results."+// The free tier lines; TeamHub counts nothing for either.+const (+ youFreeText = "Free without a key: limited searches with lower quality results."+ duckDuckGoFreeText = "Free, no key: DuckDuckGo blocks searches for a while when they come too often."+)// Save and settings refusals; the handlers map each to an error code.var (@@ -299,7 +313,7 @@ func (k keyring) usable(b Backend) bool {func (k keyring) status(b Backend) string {saved, ok := k[b]switch {- case b == Direct, k.usable(b):+ case b == Direct, b == DuckDuckGo, k.usable(b):return "ready"case ok && !saved.unusable && saved.state == "rejected":return "key_rejected"@@ -361,7 +375,7 @@ func (s *Service) chosenDefault(ctx context.Context) (Backend, error) {// defaultSearch is the backend a search without one uses now: the chosen// default even when its key stopped working, so its failure asks for that// key instead of silently moving on; else the first backend with a usable-// key, else You.com's keyless trial.+// key, else DuckDuckGo. You.com runs without a key only when named or chosen.func defaultSearch(ring keyring, chosen Backend) Backend {if chosen != "" {return chosen@@ -371,7 +385,7 @@ func defaultSearch(ring keyring, chosen Backend) Backend {return b}}- return You+ return DuckDuckGo}// List returns every backend, with its live quota when withQuota is set;@@ -385,7 +399,7 @@ func (s *Service) List(ctx context.Context, withQuota bool) (List, error) {if err != nil {return List{}, err}- order := append(slices.Clone(keyOrder), Direct)+ order := append(slices.Clone(searchOrder), Direct)views := make([]BackendView, len(order))var wg sync.WaitGroupquotaCtx, cancel := context.WithTimeout(ctx, quotaTimeout)@@ -431,8 +445,10 @@ func (s *Service) view(ring keyring, b Backend) BackendView {switch {case b == Direct:view.Tier, view.Quota.Reason = TierNone, "not_reported"+ case b == DuckDuckGo:+ view.Tier, view.TierText, view.Quota.Reason = TierFree, duckDuckGoFreeText, "not_reported"case b == You && !ring.usable(You) && view.Status == "ready":- view.Tier, view.TierText, view.Quota.Reason = TierFreeTrial, freeTrialText, "not_reported"+ view.Tier, view.TierText, view.Quota.Reason = TierFree, youFreeText, "not_reported"case view.KeyState == "rejected":view.Quota.Reason = "key_rejected"case b == Brave && ring.usable(Brave):@@ -593,7 +609,7 @@ func (s *Service) RemoveKey(ctx context.Context, b Backend) error {// SetDefault makes b the backend a search without one uses; b must be ready.func (s *Service) SetDefault(ctx context.Context, b Backend) (Default, error) {- if !KeyBackend(b) {+ if !SearchBackend(b) {return Default{}, ErrInvalid}ring, err := s.keys(ctx)@@ -630,7 +646,7 @@ func Normalize(request Request) (Request, error) {switch request.Command {case CommandSearch:if request.Query == "" || len([]rune(request.Query)) > MaxQueryRunes || request.URL != "" ||- request.Backend != "" && !KeyBackend(request.Backend) || request.Limit < 0 || request.Limit > MaxLimit ||+ request.Backend != "" && !SearchBackend(request.Backend) || request.Limit < 0 || request.Limit > MaxLimit ||len(request.Sites) > 10 {return Request{}, ErrInvalid}@@ -694,7 +710,7 @@ func (s *Service) Run(ctx context.Context, request Request) (Outcome, error) {if !supports(b, request) {return Outcome{}, &Failure{Code: CodeUnsupported, Backend: b}}- keyless := b == You && !ring.usable(You) && (suggested || ring.status(You) == "ready")+ keyless := b == DuckDuckGo || b == You && !ring.usable(You) && ring.status(You) == "ready"if !keyless && !ring.usable(b) {code := CodeKeyRequiredif ring.status(b) == "key_rejected" {@@ -704,9 +720,12 @@ func (s *Service) Run(ctx context.Context, request Request) (Outcome, error) {}var outcome Outcomevar observed *Quota- if keyless {+ switch {+ case b == DuckDuckGo:+ outcome, err = s.providers.duckDuckGoSearch(ctx, request)+ case keyless:outcome, err = s.providers.runKeyless(ctx, request)- } else {+ default:outcome, observed, err = s.providers.run(ctx, b, ring[b].key, request)}var failure *Failure@@ -726,11 +745,6 @@ func (s *Service) Run(ctx context.Context, request Request) (Outcome, error) {}); markErr != nil {return Outcome{}, markErr}- case failure.Code == CodeFreeLimit && suggested:- // The command named no backend: the card suggests the first- // backend in TeamHub's order that still needs a key.- failure.Backend, failure.Suggested = firstNeedingKey(ring), true- return Outcome{}, failurecase failure.Code == CodeQuotaExhausted || failure.Code == CodeRateLimited:if !keyless {s.recordAnswer(ctx, ring[b], b, observed)@@ -741,20 +755,11 @@ func (s *Service) Run(ctx context.Context, request Request) (Outcome, error) {return Outcome{}, failure}-func firstNeedingKey(ring keyring) Backend {- for _, b := range keyOrder {- if !ring.usable(b) {- return b- }- }- return Tavily-}-// readyOthers lists the backends other than failed that could run command// now, in TeamHub's order.func readyOthers(ring keyring, failed Backend, command string) []Backend {ready := []Backend{}- for _, b := range keyOrder {+ for _, b := range searchOrder {if b != failed && ring.status(b) == "ready" && slices.Contains(definitions[b].commands, command) {ready = append(ready, b)}diff --git a/apps/teamhub/internal/websearch/websearch_test.go b/apps/teamhub/internal/websearch/websearch_test.goindex 5376a179..62237917 100644--- a/apps/teamhub/internal/websearch/websearch_test.go+++ b/apps/teamhub/internal/websearch/websearch_test.go@@ -9,6 +9,8 @@ import ("io""net/http""net/http/httptest"+ "net/url"+ "slices""strings""sync""testing"@@ -119,6 +121,7 @@ func testBox(t *testing.T) *secretbox.Box {type seen struct {method, path, query, auth, apiKey, token stringbody map[string]any+ form url.Values}// fakeProviders serves every provider from one server; handle answers each@@ -137,6 +140,9 @@ func newFakeProviders(t *testing.T, handle func(w http.ResponseWriter, r seen))request := seen{method: r.Method, path: r.URL.Path, query: r.URL.RawQuery, auth: r.Header.Get("Authorization"),apiKey: r.Header.Get("X-API-Key"), token: r.Header.Get("X-Subscription-Token")}_ = json.Unmarshal(raw, &request.body)+ if r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" {+ request.form, _ = url.ParseQuery(string(raw))+ }fake.mu.Lock()fake.requests = append(fake.requests, request)fake.mu.Unlock()@@ -148,7 +154,8 @@ func newFakeProviders(t *testing.T, handle func(w http.ResponseWriter, r seen))func (f *fakeProviders) endpoints() Endpoints {return Endpoints{Tavily: f.server.URL + "/tavily", Brave: f.server.URL + "/brave", Firecrawl: f.server.URL + "/firecrawl",- YouAPI: f.server.URL + "/youapi", YouIndex: f.server.URL + "/youindex", YouMCP: f.server.URL + "/mcp/free", Client: f.server.Client()}+ YouAPI: f.server.URL + "/youapi", YouIndex: f.server.URL + "/youindex", YouMCP: f.server.URL + "/mcp/free",+ DuckDuckGo: f.server.URL + "/ddg", Client: f.server.Client()}}func (f *fakeProviders) seen() []seen {@@ -309,14 +316,14 @@ func TestRunClassifiesProviderRefusals(t *testing.T) {t.Fatalf("state = %q", keys.rows[string(tc.backend)].State)}if tc.code == CodeQuotaExhausted || tc.code == CodeRateLimited {- wantReady := []Backend{Firecrawl, You}+ wantReady := []Backend{Firecrawl, You, DuckDuckGo}switch tc.backend {case Firecrawl:- wantReady = []Backend{You}+ wantReady = []Backend{You, DuckDuckGo}case You:- wantReady = []Backend{Firecrawl}+ wantReady = []Backend{Firecrawl, DuckDuckGo}}- if len(failure.Ready) != len(wantReady) || failure.Ready[0] != wantReady[0] {+ if !slices.Equal(failure.Ready, wantReady) {t.Fatalf("ready = %v, want %v", failure.Ready, wantReady)}}@@ -374,7 +381,7 @@ func keylessMCP(t *testing.T, call func(w http.ResponseWriter, r seen)) func(w h}}-func TestSearchWithoutKeysUsesTheKeylessTrial(t *testing.T) {+func TestYouWithoutAKeyUsesTheFreeMCP(t *testing.T) {fake := newFakeProviders(t, keylessMCP(t, func(w http.ResponseWriter, r seen) {params := r.body["params"].(map[string]any)if params["name"] != "you-search" || params["arguments"].(map[string]any)["query"] != "q" {@@ -385,7 +392,9 @@ func TestSearchWithoutKeysUsesTheKeylessTrial(t *testing.T) {"data: {\"jsonrpc\":\"2.0\",\"id\":2,\"result\":{\"structuredContent\":{\"results\":{\"web\":[{\"title\":\"K\",\"url\":\"https://k.example\",\"description\":\"keyless\"}]}}}}\n\n"))}))s, _ := newTestService(t, fake)- outcome, err := s.Run(t.Context(), search("q"))+ request := search("q")+ request.Backend = You+ outcome, err := s.Run(t.Context(), request)if err != nil || outcome.Backend != You || len(outcome.Results) != 1 || outcome.Results[0].Snippet != "keyless" {t.Fatalf("Run = %+v, %v", outcome, err)}@@ -398,16 +407,12 @@ func TestSearchWithoutKeysUsesTheKeylessTrial(t *testing.T) {func TestKeylessFreeLimitAsksForAKey(t *testing.T) {fake := newFakeProviders(t, keylessMCP(t, func(w http.ResponseWriter, _ seen) { writeJSON(w, 429, `{}`) }))s, _ := newTestService(t, fake)- _, err := s.Run(t.Context(), search("q"))- var failure *Failure- if !errors.As(err, &failure) || failure.Code != CodeFreeLimit || failure.Backend != Tavily || !failure.Suggested || !failure.KeyFailure() {- t.Fatalf("implicit Run = %#v", err)- }request := search("q")request.Backend = You- _, err = s.Run(t.Context(), request)- if !errors.As(err, &failure) || failure.Code != CodeFreeLimit || failure.Backend != You || failure.Suggested {- t.Fatalf("explicit Run = %#v", err)+ _, err := s.Run(t.Context(), request)+ var failure *Failure+ if !errors.As(err, &failure) || failure.Code != CodeFreeLimit || failure.Backend != You || failure.Suggested || !failure.KeyFailure() {+ t.Fatalf("Run = %#v", err)}}@@ -639,7 +644,7 @@ func TestListReportsTiersStatesAndLiveQuota(t *testing.T) {saveRaw(t, s, keys, Tavily, "provider-secret", "rejected")saveRaw(t, s, keys, Brave, "provider-secret", "unverified")list, err := s.List(t.Context(), true)- if err != nil || list.DefaultSearch != Brave || list.DefaultOpen != Direct || !list.CanSaveKeys || len(list.Backends) != 5 {+ if err != nil || list.DefaultSearch != Brave || list.DefaultOpen != Direct || !list.CanSaveKeys || len(list.Backends) != 6 {t.Fatalf("List = %+v, %v", list, err)}byID := map[Backend]BackendView{}@@ -653,9 +658,13 @@ func TestListReportsTiersStatesAndLiveQuota(t *testing.T) {v.Quota.ResetsAt == nil || len(v.Filters) != 1 || v.MaxSites != 0 {t.Fatalf("firecrawl = %+v", v)}- if v := byID[You]; v.Status != "ready" || v.Tier != TierFreeTrial || v.TierText == "" || v.Quota.From != "unavailable" || v.Quota.Reason != "not_reported" {+ if v := byID[You]; v.Status != "ready" || v.Tier != TierFree || v.TierText == "" || v.Quota.From != "unavailable" || v.Quota.Reason != "not_reported" {t.Fatalf("you = %+v", v)}+ if v := byID[DuckDuckGo]; v.Status != "ready" || v.Tier != TierFree || v.TierText == "" || v.KeyState != "none" ||+ v.MaxLimit != 10 || v.MaxSites != 1 || len(v.Commands) != 1 || v.Commands[0] != CommandSearch {+ t.Fatalf("duckduckgo = %+v", v)+ }if v := byID[Direct]; v.Tier != TierNone || v.Status != "ready" || len(v.Commands) != 1 || v.Commands[0] != CommandOpen {t.Fatalf("direct = %+v", v)}@@ -681,7 +690,7 @@ func TestListWithoutQuotaCallsNoProvider(t *testing.T) {saveRaw(t, s, keys, You, "provider-secret", "verified")saveRaw(t, s, keys, Tavily, "provider-secret", "verified")list, err := s.List(t.Context(), false)- if err != nil || len(list.Backends) != 5 || len(fake.seen()) != 0 {+ if err != nil || len(list.Backends) != 6 || len(fake.seen()) != 0 {t.Fatalf("List = %+v, %v, calls %d", list, err, len(fake.seen()))}for _, view := range list.Backends {diff --git a/apps/teamhub/tests/integration/web_search_test.go b/apps/teamhub/tests/integration/web_search_test.goindex fc2f18a3..968eed17 100644--- a/apps/teamhub/tests/integration/web_search_test.go+++ b/apps/teamhub/tests/integration/web_search_test.go@@ -15,8 +15,8 @@ import ("github.com/simplexai-labs/linger/apps/teamhub/internal/websearch")-// fakeSearchProviders serves You.com's keyless MCP server (its trial used-// up), Brave's search API and Tavily's usage endpoint.+// fakeSearchProviders serves You.com's keyless MCP server (its free searches+// used up), Brave's search API and Tavily's usage endpoint.func fakeSearchProviders(t *testing.T) *httptest.Server {t.Helper()server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {@@ -84,7 +84,8 @@ func TestWebSearchAsksForAKeyAndReplaysTheSearchWithIt(t *testing.T) {cfg.ExternalApps.SecretEncryptionKey = base64.StdEncoding.EncodeToString(bytes.Repeat([]byte{5}, 32))}), withDeps(func(deps *app.Deps) {deps.WebSearch = websearch.Endpoints{- Tavily: providers.URL + "/tavily", Brave: providers.URL + "/brave", YouMCP: providers.URL + "/mcp/free", Client: providers.Client(),+ Tavily: providers.URL + "/tavily", Brave: providers.URL + "/brave", YouMCP: providers.URL + "/mcp/free",+ DuckDuckGo: providers.URL + "/ddg", Client: providers.Client(),}}))search := func(body map[string]any) (int, []byte) {@@ -92,13 +93,13 @@ func TestWebSearchAsksForAKeyAndReplaysTheSearchWithIt(t *testing.T) {return postAgentInRoom(t, env, issued.AccessToken, roomID, "/api/agent/v1/web/search", body)}- status, body := search(map[string]any{"query": "rust news"})+ status, body := search(map[string]any{"query": "rust news", "backend": "you"})var failure agentSearchFailuredecode(t, body, &failure)details := failure.Error.Details- if status != http.StatusConflict || failure.Error.Code != "search_key_requested" || details.Backend != "tavily" ||- details.Origin != "suggested" || details.Reason != "free_limit" || details.InteractionID == "" {- t.Fatalf("search after the free trial: %d %s", status, body)+ if status != http.StatusConflict || failure.Error.Code != "search_key_requested" || details.Backend != "you" ||+ details.Origin != "requested" || details.Reason != "free_limit" || details.InteractionID == "" {+ t.Fatalf("search after the free searches: %d %s", status, body)}cardID, cardMessage := details.InteractionID, details.MessageID@@ -118,12 +119,12 @@ func TestWebSearchAsksForAKeyAndReplaysTheSearchWithIt(t *testing.T) {code, _, listed := env.request(alice, http.MethodGet, "/v0/web-search/backends", nil, "")var list websearch.Listdecode(t, listed, &list)- if code != http.StatusOK || list.DefaultSearch != websearch.You || !list.CanSaveKeys || len(list.Backends) != 5 ||- list.Backends[3].ID != websearch.You || list.Backends[3].Tier != websearch.TierFreeTrial {+ if code != http.StatusOK || list.DefaultSearch != websearch.DuckDuckGo || !list.CanSaveKeys || len(list.Backends) != 6 ||+ list.Backends[3].ID != websearch.You || list.Backends[3].Tier != websearch.TierFree {t.Fatalf("backends: %d %s", code, listed)}code, _, listed = env.request(alice, http.MethodGet, "/v0/web-search/backends?include_quota=false", nil, "")- if code != http.StatusOK || strings.Contains(string(listed), `"quota"`) || !strings.Contains(string(listed), `"free_trial"`) {+ if code != http.StatusOK || strings.Contains(string(listed), `"quota"`) || !strings.Contains(string(listed), `"tier":"free"`) {t.Fatalf("backends without quota: %d %s", code, listed)}diff --git a/apps/web/src/features/apps/connected-apps-page.tsx b/apps/web/src/features/apps/connected-apps-page.tsxindex 530c270e..7f2b69a0 100644--- a/apps/web/src/features/apps/connected-apps-page.tsx+++ b/apps/web/src/features/apps/connected-apps-page.tsx@@ -34,7 +34,8 @@ import {} from "./connected-apps-queries";import { ConnectAppStatus, useConnectAppFlow } from "./connect-app-flow";import {- savedWebSearchBackends,+ connectedWebSearchBackends,+ shownWebSearchBackends,WEB_SEARCH_FILTER,WebSearchSection,} from "./web-search-connectors";@@ -85,13 +86,11 @@ export function ConnectedAppsPage() {: groupApps;const allSearchBackends = webSearch.data?.backends ?? [];const searchBackends = connectedOnly- ? savedWebSearchBackends(allSearchBackends)- : allSearchBackends;+ ? connectedWebSearchBackends(allSearchBackends)+ : shownWebSearchBackends(allSearchBackends);const searchFilter = filter === WEB_SEARCH_FILTER.id;- // With Connected only, a section without a saved key is left out.- const showSearch =- (filter === "all" || searchFilter) &&- (!connectedOnly || !webSearch.isSuccess || searchBackends.length > 0);+ // DuckDuckGo needs no key, so Connected only always keeps the section.+ const showSearch = filter === "all" || searchFilter;const showApps =!searchFilter && (!showSearch || !filteredApps || filteredApps.length > 0);@@ -221,8 +220,6 @@ export function ConnectedAppsPage() {heading={!searchFilter}list={webSearch}/>- ) : searchFilter ? (- <PageMessage>No web search keys yet.</PageMessage>) : null}</>)}diff --git a/apps/web/src/features/apps/web-search-connectors.test.tsx b/apps/web/src/features/apps/web-search-connectors.test.tsxindex 19ba30e6..876f485c 100644--- a/apps/web/src/features/apps/web-search-connectors.test.tsx+++ b/apps/web/src/features/apps/web-search-connectors.test.tsx@@ -20,23 +20,28 @@ describe("Web search connectors", () => {renderPage(runtime);const section = await screen.findByRole("region", { name: "Web search" });+ // Direct only opens pages and has nothing to set up.expect(cardNames(section)).toEqual(["You.com","Tavily","Brave Search","Firecrawl",- "Direct",+ "DuckDuckGo",]);- expect(card(section, "You.com")).toHaveTextContent("Default");+ expect(card(section, "DuckDuckGo")).toHaveTextContent("Default");+ expect(card(section, "DuckDuckGo")).toHaveTextContent(+ "Search · No key needed",+ );+ expect(card(section, "DuckDuckGo")).toHaveTextContent("Free, limited");+ // You.com works without a key and still takes one.+ expect(card(section, "You.com")).toHaveTextContent("Free, limited");expect(card(section, "You.com")).toHaveTextContent(- "Limited and lower quality results",+ "Search · 100 searches a day without a key",);- expect(card(section, "You.com")).toHaveTextContent("Free trial");expect(card(section, "Tavily")).toHaveTextContent("Not set");expect(card(section, "Tavily")).toHaveTextContent("Search · Read pages · 1,000 credits a month",);- expect(card(section, "Direct")).toHaveTextContent("Built in");fireEvent.click(within(@@ -223,7 +228,7 @@ describe("Web search connectors", () => {expect(card(section, "Tavily")).toHaveTextContent("Not set");});- it("keeps only backends with a saved key under Connected only", async () => {+ it("keeps backends with a saved key or a free tier under Connected only", async () => {const runtime = createTestTeamHubRuntime();setBackends(runtime, {firecrawl: saved({ key_state: "rejected", status: "key_rejected" }),@@ -240,22 +245,7 @@ describe("Web search connectors", () => {).toEqual(["Gmail"]);expect(cardNames(screen.getByRole("region", { name: "Web search" })),- ).toEqual(["Tavily", "Firecrawl"]);- });-- it("says when no backend has a key under Connected only", async () => {- const runtime = createTestTeamHubRuntime();- renderPage(runtime);-- await screen.findByRole("region", { name: "Web search" });- fireEvent.click(screen.getByRole("button", { name: "Connected only" }));- expect(screen.queryByRole("region", { name: "Web search" })).toBeNull();- fireEvent.click(- within(- screen.getByRole("tablist", { name: "Connector categories" }),- ).getByRole("tab", { name: "Web search" }),- );- expect(screen.getByText("No web search keys yet.")).toBeVisible();+ ).toEqual(["You.com", "Tavily", "Firecrawl", "DuckDuckGo"]);});it("explains a server that cannot store keys instead of showing a field", async () => {diff --git a/apps/web/src/features/apps/web-search-connectors.tsx b/apps/web/src/features/apps/web-search-connectors.tsxindex ebdd8dd5..b2540b42 100644--- a/apps/web/src/features/apps/web-search-connectors.tsx+++ b/apps/web/src/features/apps/web-search-connectors.tsx@@ -16,8 +16,10 @@ import type {TeamHubWebSearchBackend,TeamHubWebSearchBackendList,TeamHubWebSearchKeyBackend,+ TeamHubWebSearchSearchBackend,} from "@/features/teamhub/teamhub-types";import {+ isWebSearchKeyBackend,webSearchBackendSummary,webSearchQueryKey,} from "@/features/web-search/web-search-backends";@@ -32,13 +34,34 @@ import { AppLogo } from "./app-logo";/** The Connectors tab for web search, beside the Composio app groups. */export const WEB_SEARCH_FILTER = { id: "web-search", label: "Web search" };-/** Backends with a saved key, which Connected only keeps. */-export function savedWebSearchBackends(+/**+ * The backends Connectors shows: the ones that search. Direct only opens+ * pages and has nothing to set up.+ */+export function shownWebSearchBackends(+ backends: readonly TeamHubWebSearchBackend[],+) {+ return backends.filter(+ (backend): backend is SearchBackend => backend.id !== "direct",+ );+}++/**+ * The backends Connected only keeps: a saved key, or a free tier that works+ * without one.+ */+export function connectedWebSearchBackends(backends: readonly TeamHubWebSearchBackend[],) {- return backends.filter((backend) => backend.key_state !== "none");+ return shownWebSearchBackends(backends).filter(+ (backend) => backend.key_state !== "none" || backend.tier === "free",+ );}+type SearchBackend = TeamHubWebSearchBackend & {+ id: TeamHubWebSearchSearchBackend;+};+/*** The web search backends as Connectors cards. They need no Composio key:* each provider's own key is saved in TeamHub, and the list loads and fails@@ -51,13 +74,13 @@ export function WebSearchSection({list,}: {/** The backends to show, narrowed by Connected only. */- backends: readonly TeamHubWebSearchBackend[];+ backends: readonly SearchBackend[];className?: string;heading: boolean;list: UseQueryResult<TeamHubWebSearchBackendList>;}) {const [openID, setOpenID] = useState<string | null>(null);- const opened = list.data?.backends.find((backend) => backend.id === openID);+ const opened = backends.find((backend) => backend.id === openID);const headingId = "connector-group-web-search";return (<section@@ -112,7 +135,7 @@ function WebSearchBackendCard({isDefault,onOpen,}: {- backend: TeamHubWebSearchBackend;+ backend: SearchBackend;isDefault: boolean;onOpen: () => void;}) {@@ -156,7 +179,7 @@ function WebSearchBackendDialog({list,onClose,}: {- backend: TeamHubWebSearchBackend;+ backend: SearchBackend;list: TeamHubWebSearchBackendList;onClose: () => void;}) {@@ -176,31 +199,24 @@ function WebSearchBackendDialog({<Fact label="Free tier">{backend.free_tier}</Fact>) : null}{backend.tier_text ? (- <Fact label="Without a key">{backend.tier_text}</Fact>+ <Fact label="Free use">{backend.tier_text}</Fact>) : null}{usage ? <Fact label="Usage">{usage}</Fact> : null}</dl>- {backend.id === "direct" ? null : (- <KeySection- backend={backend as KeyBackend}- canSave={list.can_save_keys}- />- )}- {backend.id === "direct" ? null : (- <DefaultSection backend={backend as KeyBackend} list={list} />- )}+ {isWebSearchKeyBackend(backend) ? (+ <KeySection backend={backend} canSave={list.can_save_keys} />+ ) : null}+ <DefaultSection backend={backend} list={list} /></div></ModalDialog>);}-type KeyBackend = TeamHubWebSearchBackend & { id: TeamHubWebSearchKeyBackend };-function KeySection({backend,canSave,}: {- backend: KeyBackend;+ backend: TeamHubWebSearchBackend & { id: TeamHubWebSearchKeyBackend };canSave: boolean;}) {const { client } = useTeamHubRuntime();@@ -251,7 +267,7 @@ function DefaultSection({backend,list,}: {- backend: KeyBackend;+ backend: SearchBackend;list: TeamHubWebSearchBackendList;}) {const { client } = useTeamHubRuntime();@@ -337,18 +353,15 @@ function backendStatus(backend: TeamHubWebSearchBackend): {label: string;tone: "danger" | "neutral" | "success";} {- if (backend.id === "direct") return { label: "Built in", tone: "neutral" };if (backend.key_state === "rejected" || backend.status === "key_rejected")return { label: "Key rejected", tone: "danger" };if (backend.key_state !== "none") return { label: "Active", tone: "success" };- if (backend.tier === "free_trial")- return { label: "Free trial", tone: "neutral" };+ if (backend.tier === "free")+ return { label: "Free, limited", tone: "success" };return { label: "Not set", tone: "neutral" };}function backendDescription(backend: TeamHubWebSearchBackend): string {- if (backend.id === "direct")- return "Reads pages from your Agent's computer. No account needed.";return backend.commands.includes("open")? "Searches the web and reads pages for your Agents.": "Searches the web for your Agents.";@@ -382,9 +395,7 @@ function usageLine(backend: TeamHubWebSearchBackend): string | null {case "provider_unavailable":return "Usage unavailable right now";default:- return backend.tier === "free_trial"- ? (backend.tier_text ?? null)- : null;+ return null;}}if (quota.remaining === undefined) return null;diff --git a/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx b/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsxindex 329b5bd4..1595d69c 100644--- a/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx+++ b/apps/web/src/features/rooms/cards/decision-search-key-view.test.tsx@@ -130,7 +130,8 @@ describe("Web search key card", () => {.map((item) => within(item).getByRole("button", { name: "Save key" })),).toHaveLength(3);const you = within(others).getByText("You.com").closest("li")!;- expect(you).toHaveTextContent("Working without a key");+ expect(you).toHaveTextContent("Free, limited");+ expect(within(others).queryByText("DuckDuckGo")).toBeNull();expect(within(others).queryByText("Tavily")).toBeNull();const brave = within(others).getByText("Brave Search").closest("li")!;diff --git a/apps/web/src/features/rooms/cards/decision-search-key-view.tsx b/apps/web/src/features/rooms/cards/decision-search-key-view.tsxindex 9c21bc60..0f607357 100644--- a/apps/web/src/features/rooms/cards/decision-search-key-view.tsx+++ b/apps/web/src/features/rooms/cards/decision-search-key-view.tsx@@ -17,6 +17,7 @@ import type {TeamHubWebSearchKeyBackend,} from "@/features/teamhub/teamhub-types";import {+ isWebSearchKeyBackend,webSearchBackendInfoQueryOptions,webSearchBackendName,webSearchBackendSummary,@@ -71,9 +72,7 @@ export function SearchKeyDecision({if (!view) return null;const owner = currentActorId === card.decision_owner.id;const pending = card.status === "pending";- const keyBackends = (list.data?.backends ?? []).filter(- (backend): backend is KeyBackend => backend.id !== "direct",- );+ const keyBackends = (list.data?.backends ?? []).filter(isWebSearchKeyBackend);const shownID =!pending && card.answer?.backend ? card.answer.backend : view.backend;const shown = keyBackends.find((backend) => backend.id === shownID);@@ -222,10 +221,8 @@ function OtherProviders({<div className="min-w-0 flex-1"><p className="flex min-w-0 items-center gap-1.5 text-sm text-app-ink"><span className="truncate">{backend.name}</span>- {backend.tier === "free_trial" ? (- <StatusPill tone="success">- Working without a key- </StatusPill>+ {backend.tier === "free" ? (+ <StatusPill tone="success">Free, limited</StatusPill>) : null}</p><p className="truncate text-xs text-app-muted">diff --git a/apps/web/src/features/teamhub/teamhub-types.ts b/apps/web/src/features/teamhub/teamhub-types.tsindex 6daac7f9..f1b909f5 100644--- a/apps/web/src/features/teamhub/teamhub-types.ts+++ b/apps/web/src/features/teamhub/teamhub-types.ts@@ -99,6 +99,8 @@ export type TeamHubExternalApp = components["schemas"]["ExternalApp"];export type TeamHubWebSearchBackend = components["schemas"]["WebSearchBackend"];export type TeamHubWebSearchKeyBackend =components["schemas"]["WebSearchKeyBackend"];+export type TeamHubWebSearchSearchBackend =+ components["schemas"]["WebSearchSearchBackend"];export type TeamHubWebSearchBackendList =components["schemas"]["WebSearchBackendList"];export type TeamHubExternalAppKey = components["schemas"]["ExternalAppKey"];diff --git a/apps/web/src/features/web-search/logos/duckduckgo.svg b/apps/web/src/features/web-search/logos/duckduckgo.svgnew file mode 100644index 00000000..30ec9a40--- /dev/null+++ b/apps/web/src/features/web-search/logos/duckduckgo.svg@@ -0,0 +1,35 @@+<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">+ <defs>+ <clipPath id="a">+ <circle cx="127.33" cy="78.97" r="52"/>+ </clipPath>+ <linearGradient id="b" gradientUnits="userSpaceOnUse" x1="1893.32" y1="-2381.98" x2="1901.89" y2="-2381.98" gradientTransform="matrix(1 0 0 -1 -1788 -2321)">+ <stop offset=".01" stop-color="#6176b9"/>+ <stop offset=".69" stop-color="#394a9f"/>+ </linearGradient>+ <linearGradient id="c" gradientUnits="userSpaceOnUse" x1="1920.27" y1="-2379.37" x2="1928.08" y2="-2379.37" gradientTransform="matrix(1 0 0 -1 -1788 -2321)">+ <stop offset=".01" stop-color="#6176b9"/>+ <stop offset=".69" stop-color="#394a9f"/>+ </linearGradient>+ </defs>+ <circle stroke="#DE5833" stroke-width="5" cx="60" cy="60" r="57.5" fill="#DE5833"/>+ <g transform="translate(-67.33 -18.97)">+ <g clip-path="url(#a)">+ <path d="M138.46 132.53c-2.51-4.88-4.91-9.37-6.4-12.34-3.96-7.93-7.94-19.11-6.13-26.32.33-1.31-3.73-48.51-6.6-50.03-3.19-1.7-10.12-3.94-13.71-4.54-2.5-.4-3.07.3-4.12.46.99.1 5.7 2.42 6.61 2.55-.91.62-3.6-.02-5.32.74-.87.4-1.52 1.88-1.5 2.58 4.9-.5 12.56-.01 17.1 2-3.61.41-9.09.87-11.45 2.11-6.84 3.6-9.86 12.03-8.06 22.13 1.79 10.08 9.72 46.85 12.25 59.13 2.52 12.27 31.51 9.7 27.32 1.53z" fill="#D5D7D8"/>+ <path d="M142.1 133.72c-3.01-5.97-6.08-11.68-7.86-15.22-3.97-7.94-7.93-19.11-6.13-26.32.34-1.31.34-6.67 1.43-7.38 8.41-5.5 7.81-.19 11.19-2.65 1.74-1.27 3.13-2.8 3.74-4.9 2.16-7.58-3-20.77-8.78-26.54-1.88-1.88-4.76-3.06-8.02-3.68-1.25-1.72-3.27-3.36-6.13-4.89a28.86 28.86 0 0 0-18.27-2.88c1 .1 3.26 2.14 4.17 2.27-1.38.94-5.05.82-5.03 2.9 4.92-.5 10.3.28 14.84 2.3-3.6.4-6.96 1.3-9.31 2.54-6.86 3.6-8.66 10.81-6.86 20.91 1.81 10.1 9.74 46.88 12.26 59.13 2.53 12.26 32.5 11.8 28.77 4.41z" fill="#FFF"/>+ </g>+ <circle r="3.79" cx="112.8" cy="70.69" fill="#2D4F8E"/>+ <circle r=".98" cx="114.49" cy="69.43" fill="#FFF"/>+ <circle r="3.25" cx="138.12" cy="68.44" fill="#2D4F8E"/>+ <circle r=".84" cx="139.57" cy="67.36" fill="#FFF"/>+ <path fill="url(#b)" d="M113.89 59.72s-2.86-1.3-5.63.45c-2.77 1.74-2.67 3.52-2.67 3.52s-1.47-3.28 2.45-4.89c3.93-1.6 5.85.92 5.85.92z"/>+ <path fill="url(#c)" d="M140.08 59.46s-2.05-1.17-3.65-1.15c-3.27.04-4.16 1.48-4.16 1.48s.55-3.44 4.73-2.75a4.2 4.2 0 0 1 3.08 2.42z"/>+ <path fill="#FDD20A" d="M124.4 85.3c.38-2.3 6.3-6.63 10.5-6.9 4.2-.26 5.5-.2 9-1.04 3.51-.83 12.54-3.08 15.03-4.24 2.5-1.15 13.1.57 5.63 4.74-3.23 1.81-11.94 5.13-18.17 6.99-6.22 1.86-9.99-1.78-12.06 1.28-1.64 2.43-.33 5.76 7.1 6.45 10.04.93 19.66-4.52 20.72-1.62 1.06 2.9-8.62 6.5-14.52 6.62-5.9.11-17.78-3.9-19.56-5.14-1.79-1.23-4.16-4.13-3.67-7.14z"/>+ <g>+ <path fill="#65BC46" d="M128.94 115.6s-14.1-7.53-14.33-4.48c-.24 3.06 0 15.51 1.64 16.45 1.65.94 13.4-6.1 13.4-6.1l-.7-5.88zm5.4-.48s9.64-7.29 11.76-6.82c2.11.48 2.58 15.51.7 16.23-1.88.7-12.9-3.81-12.9-3.81l.45-5.6z"/>+ <path fill="#43A244" d="M125.53 116.39c0 4.93-.71 7.05 1.4 7.52 2.12.47 6.11 0 7.53-.94 1.4-.94.23-7.28-.24-8.46-.47-1.18-8.7-.24-8.7 1.88z"/>+ <path fill="#65BC46" d="M126.43 115.3c0 4.93-.71 7.04 1.4 7.51 2.11.48 6.1 0 7.52-.94 1.41-.94.24-7.28-.23-8.46-.47-1.18-8.7-.23-8.7 1.88z"/>+ </g>+ </g>+ <circle cx="60" cy="60" r="53.1" fill="none" stroke="#FFF" stroke-width="3.85"/>+</svg>\ No newline at end of filediff --git a/apps/web/src/features/web-search/web-search-backends.ts b/apps/web/src/features/web-search/web-search-backends.tsindex 5afe2c02..14825baa 100644--- a/apps/web/src/features/web-search/web-search-backends.ts+++ b/apps/web/src/features/web-search/web-search-backends.ts@@ -56,14 +56,29 @@ export function webSearchBackendName(id: TeamHubWebSearchKeyBackend): string {return names[id];}-/** What the backend does and its free allowance, as one line. */+/** Whether the backend takes an API key saved in the product. */+export function isWebSearchKeyBackend<T extends { id: string }>(+ backend: T,+): backend is T & { id: TeamHubWebSearchKeyBackend } {+ return backend.id in names;+}++/**+ * What the backend does and, after it, its free allowance; a backend that+ * never takes a key says none is needed.+ */export function webSearchBackendSummary(backend: TeamHubWebSearchBackend,): string {const commands = backend.commands.map((command) =>command === "search" ? "Search" : "Read pages",);- return [...commands, backend.free_tier].filter(Boolean).join(" · ");+ const allowance = isWebSearchKeyBackend(backend)+ ? backend.free_tier+ : backend.tier === "free"+ ? "No key needed"+ : undefined;+ return [...commands, allowance].filter(Boolean).join(" · ");}/** The key page as a short label: host and path without `www.`. */diff --git a/apps/web/src/features/web-search/web-search-logos.ts b/apps/web/src/features/web-search/web-search-logos.tsindex a6f5088c..6c5eb21c 100644--- a/apps/web/src/features/web-search/web-search-logos.ts+++ b/apps/web/src/features/web-search/web-search-logos.ts@@ -1,20 +1,22 @@-import type { TeamHubWebSearchKeyBackend } from "@/features/teamhub/teamhub-types";+import type { TeamHubWebSearchSearchBackend } from "@/features/teamhub/teamhub-types";import braveLogo from "./logos/brave.svg";+import duckDuckGoLogo from "./logos/duckduckgo.svg";import firecrawlLogo from "./logos/firecrawl.svg";import tavilyLogo from "./logos/tavily.svg";import youLogo from "./logos/you.svg";// Kept apart from the backend names so the chat's settled-card notices,// which load with every Room, do not bundle the logos.-const logos: Record<TeamHubWebSearchKeyBackend, string> = {+const logos: Record<TeamHubWebSearchSearchBackend, string> = {brave: braveLogo,+ duckduckgo: duckDuckGoLogo,firecrawl: firecrawlLogo,tavily: tavilyLogo,you: youLogo,};-/** The bundled logo of a backend that takes a key; direct has none. */+/** The bundled logo of a backend that searches; direct has none. */export function webSearchBackendLogo(id: string): string | undefined {- return logos[id as TeamHubWebSearchKeyBackend];+ return logos[id as TeamHubWebSearchSearchBackend];}diff --git a/apps/web/src/test/teamhub-seed.ts b/apps/web/src/test/teamhub-seed.tsindex 9cf6d588..681e032d 100644--- a/apps/web/src/test/teamhub-seed.ts+++ b/apps/web/src/test/teamhub-seed.ts@@ -1749,8 +1749,8 @@ export function createExternalSourceSeed() {}/**- * The web search backends TeamHub lists before any key is saved: keyless- * You.com is the default, and direct opens pages.+ * The web search backends TeamHub lists before any key is saved: DuckDuckGo+ * is the default, You.com also works without a key, and direct opens pages.*/export function createWebSearchSeed(): TeamHubWebSearchBackendList {const keyed: Omit<TeamHubWebSearchBackend, "id" | "name"> = {@@ -1777,7 +1777,7 @@ export function createWebSearchSeed(): TeamHubWebSearchBackendList {name: "You.com",quota: { from: "unavailable", reason: "not_reported" },status: "ready",- tier: "free_trial",+ tier: "free",tier_text: "Limited and lower quality results",},{@@ -1803,6 +1803,20 @@ export function createWebSearchSeed(): TeamHubWebSearchBackendList {key_url: "https://www.firecrawl.dev/app/api-keys",name: "Firecrawl",},+ {+ ...keyed,+ commands: ["search"],+ id: "duckduckgo",+ keyless: true,+ max_limit: 10,+ max_sites: 1,+ name: "DuckDuckGo",+ official_key_check: false,+ quota: { from: "unavailable", reason: "not_reported" },+ status: "ready",+ tier: "free",+ tier_text: "Free, no key: blocks searches that come too often",+ },{...keyed,commands: ["open"],@@ -1820,6 +1834,6 @@ export function createWebSearchSeed(): TeamHubWebSearchBackendList {],can_save_keys: true,default_open: "direct",- default_search: "you",+ default_search: "duckduckgo",};}diff --git a/contracts/generated/go/teamhubagentapi/openapi.gen.go b/contracts/generated/go/teamhubagentapi/openapi.gen.goindex 9e9ade46..a379d5fe 100644--- a/contracts/generated/go/teamhubagentapi/openapi.gen.go+++ b/contracts/generated/go/teamhubagentapi/openapi.gen.go@@ -1270,15 +1270,15 @@ func (e WebSearchBackendStatus) Valid() bool {// Defines values for WebSearchBackendTier.const (- WebSearchBackendTierFreeTrial WebSearchBackendTier = "free_trial"- WebSearchBackendTierKey WebSearchBackendTier = "key"- WebSearchBackendTierNone WebSearchBackendTier = "none"+ WebSearchBackendTierFree WebSearchBackendTier = "free"+ WebSearchBackendTierKey WebSearchBackendTier = "key"+ WebSearchBackendTierNone WebSearchBackendTier = "none")// Valid indicates whether the value is a known member of the WebSearchBackendTier enum.func (e WebSearchBackendTier) Valid() bool {switch e {- case WebSearchBackendTierFreeTrial:+ case WebSearchBackendTierFree:return truecase WebSearchBackendTierKey:return true@@ -1291,11 +1291,12 @@ func (e WebSearchBackendTier) Valid() bool {// Defines values for WebSearchBackendId.const (- WebSearchBackendIdBrave WebSearchBackendId = "brave"- WebSearchBackendIdDirect WebSearchBackendId = "direct"- WebSearchBackendIdFirecrawl WebSearchBackendId = "firecrawl"- WebSearchBackendIdTavily WebSearchBackendId = "tavily"- WebSearchBackendIdYou WebSearchBackendId = "you"+ WebSearchBackendIdBrave WebSearchBackendId = "brave"+ WebSearchBackendIdDirect WebSearchBackendId = "direct"+ WebSearchBackendIdDuckduckgo WebSearchBackendId = "duckduckgo"+ WebSearchBackendIdFirecrawl WebSearchBackendId = "firecrawl"+ WebSearchBackendIdTavily WebSearchBackendId = "tavily"+ WebSearchBackendIdYou WebSearchBackendId = "you")// Valid indicates whether the value is a known member of the WebSearchBackendId enum.@@ -1305,6 +1306,8 @@ func (e WebSearchBackendId) Valid() bool {return truecase WebSearchBackendIdDirect:return true+ case WebSearchBackendIdDuckduckgo:+ return truecase WebSearchBackendIdFirecrawl:return truecase WebSearchBackendIdTavily:@@ -1469,6 +1472,33 @@ func (e WebSearchRecency) Valid() bool {}}+// Defines values for WebSearchSearchBackend.+const (+ WebSearchSearchBackendBrave WebSearchSearchBackend = "brave"+ WebSearchSearchBackendDuckduckgo WebSearchSearchBackend = "duckduckgo"+ WebSearchSearchBackendFirecrawl WebSearchSearchBackend = "firecrawl"+ WebSearchSearchBackendTavily WebSearchSearchBackend = "tavily"+ WebSearchSearchBackendYou WebSearchSearchBackend = "you"+)++// Valid indicates whether the value is a known member of the WebSearchSearchBackend enum.+func (e WebSearchSearchBackend) Valid() bool {+ switch e {+ case WebSearchSearchBackendBrave:+ return true+ case WebSearchSearchBackendDuckduckgo:+ return true+ case WebSearchSearchBackendFirecrawl:+ return true+ case WebSearchSearchBackendTavily:+ return true+ case WebSearchSearchBackendYou:+ return true+ default:+ return false+ }+}+// Defines values for ResolveConnectorAccount200JSONResponseBodyStatus.const (ResolveConnectorAccount200JSONResponseBodyStatusAccountAmbiguous ResolveConnectorAccount200JSONResponseBodyStatus = "account_ambiguous"@@ -3408,7 +3438,7 @@ type TrackingItemVersion struct {// WebBackendsQuery defines model for WebBackendsQuery.type WebBackendsQuery struct {- // Backend A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ // Backend A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.Backend *WebSearchBackendId `json:"backend,omitempty"`}@@ -3420,7 +3450,7 @@ type WebConnectRequest struct {// WebConnectResponse defines model for WebConnectResponse.type WebConnectResponse struct {- // Backend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: direct always, You.com also without a key, the others with a key that is not rejected.+ // Backend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: DuckDuckGo and direct always, You.com also without a key, the others with a key that is not rejected.Backend *WebSearchBackend `json:"backend,omitempty"`InteractionId *string `json:"interaction_id,omitempty"`MessageId *string `json:"message_id,omitempty"`@@ -3453,7 +3483,7 @@ type WebOpenResponse struct {Url string `json:"url"`}-// WebSearchBackend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: direct always, You.com also without a key, the others with a key that is not rejected.+// WebSearchBackend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: DuckDuckGo and direct always, You.com also without a key, the others with a key that is not rejected.type WebSearchBackend struct {Commands []WebSearchCommand `json:"commands"`@@ -3463,7 +3493,7 @@ type WebSearchBackend struct {// FreeTier The provider's free allowance, for display.FreeTier *string `json:"free_tier,omitempty"`- // Id A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ // Id A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.Id WebSearchBackendId `json:"id"`KeyState WebSearchBackendKeyState `json:"key_state"`@@ -3487,10 +3517,10 @@ type WebSearchBackend struct {Quota *WebSearchQuota `json:"quota,omitempty"`Status WebSearchBackendStatus `json:"status"`- // Tier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+ // Tier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.Tier WebSearchBackendTier `json:"tier"`- // TierText A short display line for the tier, set for free_trial.+ // TierText A short display line for the tier, set for free.TierText *string `json:"tier_text,omitempty"`}@@ -3500,25 +3530,25 @@ type WebSearchBackendKeyState string// WebSearchBackendStatus defines model for WebSearchBackend.Status.type WebSearchBackendStatus string-// WebSearchBackendTier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+// WebSearchBackendTier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.type WebSearchBackendTier string-// WebSearchBackendId A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+// WebSearchBackendId A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.type WebSearchBackendId string-// WebSearchBackendList Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first ready backend in that order.+// WebSearchBackendList Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first backend with a usable key in that order, else duckduckgo.type WebSearchBackendList struct {Backends []WebSearchBackend `json:"backends"`// CanSaveKeys False when the deployment has no TEAMHUB_SECRET_ENCRYPTION_KEY to seal keys with.CanSaveKeys bool `json:"can_save_keys"`- // ChosenDefaultSearch A backend that takes an API key saved in the product.- ChosenDefaultSearch *WebSearchKeyBackend `json:"chosen_default_search,omitempty"`- DefaultOpen string `json:"default_open"`+ // ChosenDefaultSearch A backend that runs searches.+ ChosenDefaultSearch *WebSearchSearchBackend `json:"chosen_default_search,omitempty"`+ DefaultOpen string `json:"default_open"`- // DefaultSearch A backend that takes an API key saved in the product.- DefaultSearch WebSearchKeyBackend `json:"default_search"`+ // DefaultSearch A backend that runs searches.+ DefaultSearch WebSearchSearchBackend `json:"default_search"`}// WebSearchCommand defines model for WebSearchCommand.@@ -3564,8 +3594,8 @@ type WebSearchRecency string// WebSearchRequest defines model for WebSearchRequest.type WebSearchRequest struct {- // Backend A backend that takes an API key saved in the product.- Backend *WebSearchKeyBackend `json:"backend,omitempty"`+ // Backend A backend that runs searches.+ Backend *WebSearchSearchBackend `json:"backend,omitempty"`// Limit Defaults to 10.Limit *int `json:"limit,omitempty"`@@ -3590,6 +3620,9 @@ type WebSearchResult struct {Url string `json:"url"`}+// WebSearchSearchBackend A backend that runs searches.+type WebSearchSearchBackend string+// CLIFileDocumentId defines model for CLIFileDocumentId.type CLIFileDocumentId = stringdiff --git a/contracts/generated/go/teamhubpublic/openapi.gen.go b/contracts/generated/go/teamhubpublic/openapi.gen.goindex 4aa94a95..cf64b81d 100644--- a/contracts/generated/go/teamhubpublic/openapi.gen.go+++ b/contracts/generated/go/teamhubpublic/openapi.gen.go@@ -4135,15 +4135,15 @@ func (e WebSearchBackendStatus) Valid() bool {// Defines values for WebSearchBackendTier.const (- WebSearchBackendTierFreeTrial WebSearchBackendTier = "free_trial"- WebSearchBackendTierKey WebSearchBackendTier = "key"- WebSearchBackendTierNone WebSearchBackendTier = "none"+ WebSearchBackendTierFree WebSearchBackendTier = "free"+ WebSearchBackendTierKey WebSearchBackendTier = "key"+ WebSearchBackendTierNone WebSearchBackendTier = "none")// Valid indicates whether the value is a known member of the WebSearchBackendTier enum.func (e WebSearchBackendTier) Valid() bool {switch e {- case WebSearchBackendTierFreeTrial:+ case WebSearchBackendTierFree:return truecase WebSearchBackendTierKey:return true@@ -4156,11 +4156,12 @@ func (e WebSearchBackendTier) Valid() bool {// Defines values for WebSearchBackendId.const (- WebSearchBackendIdBrave WebSearchBackendId = "brave"- WebSearchBackendIdDirect WebSearchBackendId = "direct"- WebSearchBackendIdFirecrawl WebSearchBackendId = "firecrawl"- WebSearchBackendIdTavily WebSearchBackendId = "tavily"- WebSearchBackendIdYou WebSearchBackendId = "you"+ WebSearchBackendIdBrave WebSearchBackendId = "brave"+ WebSearchBackendIdDirect WebSearchBackendId = "direct"+ WebSearchBackendIdDuckduckgo WebSearchBackendId = "duckduckgo"+ WebSearchBackendIdFirecrawl WebSearchBackendId = "firecrawl"+ WebSearchBackendIdTavily WebSearchBackendId = "tavily"+ WebSearchBackendIdYou WebSearchBackendId = "you")// Valid indicates whether the value is a known member of the WebSearchBackendId enum.@@ -4170,6 +4171,8 @@ func (e WebSearchBackendId) Valid() bool {return truecase WebSearchBackendIdDirect:return true+ case WebSearchBackendIdDuckduckgo:+ return truecase WebSearchBackendIdFirecrawl:return truecase WebSearchBackendIdTavily:@@ -4310,6 +4313,33 @@ func (e WebSearchQuotaUnit) Valid() bool {}}+// Defines values for WebSearchSearchBackend.+const (+ WebSearchSearchBackendBrave WebSearchSearchBackend = "brave"+ WebSearchSearchBackendDuckduckgo WebSearchSearchBackend = "duckduckgo"+ WebSearchSearchBackendFirecrawl WebSearchSearchBackend = "firecrawl"+ WebSearchSearchBackendTavily WebSearchSearchBackend = "tavily"+ WebSearchSearchBackendYou WebSearchSearchBackend = "you"+)++// Valid indicates whether the value is a known member of the WebSearchSearchBackend enum.+func (e WebSearchSearchBackend) Valid() bool {+ switch e {+ case WebSearchSearchBackendBrave:+ return true+ case WebSearchSearchBackendDuckduckgo:+ return true+ case WebSearchSearchBackendFirecrawl:+ return true+ case WebSearchSearchBackendTavily:+ return true+ case WebSearchSearchBackendYou:+ return true+ default:+ return false+ }+}+// Defines values for WorkItemActivityKind.const (WorkItemActivityKindAccessGrantAdded WorkItemActivityKind = "access_grant_added"@@ -8781,8 +8811,8 @@ type SetExternalConnectionAutoRemindersRequest struct {// SetWebSearchDefaultRequest defines model for SetWebSearchDefaultRequest.type SetWebSearchDefaultRequest struct {- // Backend A backend that takes an API key saved in the product.- Backend WebSearchKeyBackend `json:"backend"`+ // Backend A backend that runs searches.+ Backend WebSearchSearchBackend `json:"backend"`}// Sha256 defines model for Sha256.@@ -9589,7 +9619,7 @@ type VoiceTranscriptEventPage struct {PartialTranscript *string `json:"partial_transcript,omitempty"`}-// WebSearchBackend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: direct always, You.com also without a key, the others with a key that is not rejected.+// WebSearchBackend One backend with the static text a client shows for it and its live state. status is ready when a call would run now: DuckDuckGo and direct always, You.com also without a key, the others with a key that is not rejected.type WebSearchBackend struct {Commands []WebSearchCommand `json:"commands"`@@ -9599,7 +9629,7 @@ type WebSearchBackend struct {// FreeTier The provider's free allowance, for display.FreeTier *string `json:"free_tier,omitempty"`- // Id A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ // Id A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.Id WebSearchBackendId `json:"id"`KeyState WebSearchBackendKeyState `json:"key_state"`@@ -9623,10 +9653,10 @@ type WebSearchBackend struct {Quota *WebSearchQuota `json:"quota,omitempty"`Status WebSearchBackendStatus `json:"status"`- // Tier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+ // Tier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.Tier WebSearchBackendTier `json:"tier"`- // TierText A short display line for the tier, set for free_trial.+ // TierText A short display line for the tier, set for free.TierText *string `json:"tier_text,omitempty"`}@@ -9636,25 +9666,25 @@ type WebSearchBackendKeyState string// WebSearchBackendStatus defines model for WebSearchBackend.Status.type WebSearchBackendStatus string-// WebSearchBackendTier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+// WebSearchBackendTier How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.type WebSearchBackendTier string-// WebSearchBackendId A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+// WebSearchBackendId A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.type WebSearchBackendId string-// WebSearchBackendList Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first ready backend in that order.+// WebSearchBackendList Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first backend with a usable key in that order, else duckduckgo.type WebSearchBackendList struct {Backends []WebSearchBackend `json:"backends"`// CanSaveKeys False when the deployment has no TEAMHUB_SECRET_ENCRYPTION_KEY to seal keys with.CanSaveKeys bool `json:"can_save_keys"`- // ChosenDefaultSearch A backend that takes an API key saved in the product.- ChosenDefaultSearch *WebSearchKeyBackend `json:"chosen_default_search,omitempty"`- DefaultOpen string `json:"default_open"`+ // ChosenDefaultSearch A backend that runs searches.+ ChosenDefaultSearch *WebSearchSearchBackend `json:"chosen_default_search,omitempty"`+ DefaultOpen string `json:"default_open"`- // DefaultSearch A backend that takes an API key saved in the product.- DefaultSearch WebSearchKeyBackend `json:"default_search"`+ // DefaultSearch A backend that runs searches.+ DefaultSearch WebSearchSearchBackend `json:"default_search"`}// WebSearchCommand defines model for WebSearchCommand.@@ -9662,11 +9692,11 @@ type WebSearchCommand string// WebSearchDefault defines model for WebSearchDefault.type WebSearchDefault struct {- // ChosenDefaultSearch A backend that takes an API key saved in the product.- ChosenDefaultSearch *WebSearchKeyBackend `json:"chosen_default_search,omitempty"`+ // ChosenDefaultSearch A backend that runs searches.+ ChosenDefaultSearch *WebSearchSearchBackend `json:"chosen_default_search,omitempty"`- // DefaultSearch A backend that takes an API key saved in the product.- DefaultSearch WebSearchKeyBackend `json:"default_search"`+ // DefaultSearch A backend that runs searches.+ DefaultSearch WebSearchSearchBackend `json:"default_search"`}// WebSearchFilter defines model for WebSearchFilter.@@ -9704,6 +9734,9 @@ type WebSearchQuotaReason string// WebSearchQuotaUnit defines model for WebSearchQuota.Unit.type WebSearchQuotaUnit string+// WebSearchSearchBackend A backend that runs searches.+type WebSearchSearchBackend string+// WorkItem defines model for WorkItem.type WorkItem struct {// ArchivedAt UTC timestamp in RFC 3339 format with an explicit offset.diff --git a/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts b/contracts/generated/typescript/src/generated/teamhub-agent-api/types.tsindex a9493a88..ec26b1e8 100644--- a/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts+++ b/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts@@ -860,7 +860,7 @@ export interface paths {put?: never;/*** Search the web through one backend with the deployment's saved key.- * @description Without backend, TeamHub uses the default a Human chose exactly as if the request named it, even when its key stopped working; without a chosen default it uses the first ready backend in the order tavily, brave, firecrawl, you (with a key), then You.com's keyless free tier, and details.origin is suggested. A filter the backend cannot honor is refused before any call. There is no automatic fallback to another backend. When the backend needs a key the deployment lacks, or the provider refused the saved one, or the keyless You.com searches are used up, TeamHub posts (or reuses) a search_key card in the chat and answers 409 search_key_requested; details names the card and the backend it shows. Saving any web search key answers the card and wakes the Agent with the backend to use.+ * @description Without backend, TeamHub uses the default a Human chose exactly as if the request named it, even when its key stopped working; without a chosen default it uses the first ready backend in the order tavily, brave, firecrawl, you (with a key), then DuckDuckGo, which needs no key, and details.origin is suggested. You.com without a key runs only when named or chosen. A filter the backend cannot honor is refused before any call. There is no automatic fallback to another backend. When the backend needs a key the deployment lacks, or the provider refused the saved one, or the keyless You.com searches are used up, TeamHub posts (or reuses) a search_key card in the chat and answers 409 search_key_requested; details names the card and the backend it shows. Saving any web search key answers the card and wakes the Agent with the backend to use.*/post: operations["searchAgentWeb"];delete?: never;@@ -2697,15 +2697,20 @@ export interface components {message_id: components["schemas"]["Id"];};/**- * @description A backend that takes an API key saved in the product.+ * @description A backend that runs searches.* @enum {string}*/- WebSearchKeyBackend: "tavily" | "brave" | "firecrawl" | "you";+ WebSearchSearchBackend:+ | "tavily"+ | "brave"+ | "firecrawl"+ | "you"+ | "duckduckgo";/** @enum {string} */WebSearchRecency: "day" | "week" | "month" | "year";WebSearchRequest: {query: string;- backend?: components["schemas"]["WebSearchKeyBackend"];+ backend?: components["schemas"]["WebSearchSearchBackend"];/** @description Defaults to 10. */limit?: number;recency?: components["schemas"]["WebSearchRecency"];@@ -2744,10 +2749,16 @@ export interface components {truncated: boolean;};/**- * @description A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ * @description A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.* @enum {string}*/- WebSearchBackendId: "tavily" | "brave" | "firecrawl" | "you" | "direct";+ WebSearchBackendId:+ | "tavily"+ | "brave"+ | "firecrawl"+ | "you"+ | "duckduckgo"+ | "direct";WebBackendsQuery: {backend?: components["schemas"]["WebSearchBackendId"];};@@ -2778,16 +2789,16 @@ export interface components {| "key_rejected"| "provider_unavailable";};- /** @description One backend with the static text a client shows for it and its live state. status is ready when a call would run now: direct always, You.com also without a key, the others with a key that is not rejected. */+ /** @description One backend with the static text a client shows for it and its live state. status is ready when a call would run now: DuckDuckGo and direct always, You.com also without a key, the others with a key that is not rejected. */WebSearchBackend: {id: components["schemas"]["WebSearchBackendId"];name: string;/**- * @description How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+ * @description How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.* @enum {string}*/- tier: "key" | "free_trial" | "none";- /** @description A short display line for the tier, set for free_trial. */+ tier: "key" | "free" | "none";+ /** @description A short display line for the tier, set for free. */tier_text?: string;commands: components["schemas"]["WebSearchCommand"][];/** @description The search filters the backend honors; any other is refused before a call. */@@ -2814,16 +2825,21 @@ export interface components {/** @description Left out when the caller asked for the list without quota. */quota?: components["schemas"]["WebSearchQuota"];};- /** @description Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first ready backend in that order. */+ /** @description Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first backend with a usable key in that order, else duckduckgo. */WebSearchBackendList: {- default_search: components["schemas"]["WebSearchKeyBackend"];- chosen_default_search?: components["schemas"]["WebSearchKeyBackend"];+ default_search: components["schemas"]["WebSearchSearchBackend"];+ chosen_default_search?: components["schemas"]["WebSearchSearchBackend"];/** @constant */default_open: "direct";/** @description False when the deployment has no TEAMHUB_SECRET_ENCRYPTION_KEY to seal keys with. */can_save_keys: boolean;backends: components["schemas"]["WebSearchBackend"][];};+ /**+ * @description A backend that takes an API key saved in the product.+ * @enum {string}+ */+ WebSearchKeyBackend: "tavily" | "brave" | "firecrawl" | "you";WebConnectRequest: {backend: components["schemas"]["WebSearchKeyBackend"];};diff --git a/contracts/generated/typescript/src/generated/teamhub-public/types.ts b/contracts/generated/typescript/src/generated/teamhub-public/types.tsindex 808b056b..5e928cc0 100644--- a/contracts/generated/typescript/src/generated/teamhub-public/types.ts+++ b/contracts/generated/typescript/src/generated/teamhub-public/types.ts@@ -7404,10 +7404,26 @@ export interface components {content: string;};/**- * @description A web search backend. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ * @description A backend that runs searches.* @enum {string}*/- WebSearchBackendId: "tavily" | "brave" | "firecrawl" | "you" | "direct";+ WebSearchSearchBackend:+ | "tavily"+ | "brave"+ | "firecrawl"+ | "you"+ | "duckduckgo";+ /**+ * @description A web search backend. duckduckgo searches without a key. direct opens pages only and is fetched by the Agent CLI on the Agent's computer; TeamHub never fetches a page itself.+ * @enum {string}+ */+ WebSearchBackendId:+ | "tavily"+ | "brave"+ | "firecrawl"+ | "you"+ | "duckduckgo"+ | "direct";/** @enum {string} */WebSearchCommand: "search" | "open";/** @enum {string} */@@ -7435,16 +7451,16 @@ export interface components {| "key_rejected"| "provider_unavailable";};- /** @description One backend with the static text a client shows for it and its live state. status is ready when a call would run now: direct always, You.com also without a key, the others with a key that is not rejected. */+ /** @description One backend with the static text a client shows for it and its live state. status is ready when a call would run now: DuckDuckGo and direct always, You.com also without a key, the others with a key that is not rejected. */WebSearchBackend: {id: components["schemas"]["WebSearchBackendId"];name: string;/**- * @description How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free_trial: You.com without a key, a limited trial with lower quality results that TeamHub does not count; none: direct, which needs no account.+ * @description How a call to the backend runs now. key: with an API key saved in the product (or one it still needs); free: without a key, on a free service with limits that TeamHub does not count (DuckDuckGo, and You.com without a key); none: direct, which needs no account.* @enum {string}*/- tier: "key" | "free_trial" | "none";- /** @description A short display line for the tier, set for free_trial. */+ tier: "key" | "free" | "none";+ /** @description A short display line for the tier, set for free. */tier_text?: string;commands: components["schemas"]["WebSearchCommand"][];/** @description The search filters the backend honors; any other is refused before a call. */@@ -7471,10 +7487,10 @@ export interface components {/** @description Left out when the caller asked for the list without quota. */quota?: components["schemas"]["WebSearchQuota"];};- /** @description Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first ready backend in that order. */+ /** @description Every backend in TeamHub's default order. default_search is the backend a search without one uses now: the default a Human saved (chosen_default_search) even when its key stopped working, else the first backend with a usable key in that order, else duckduckgo. */WebSearchBackendList: {- default_search: components["schemas"]["WebSearchKeyBackend"];- chosen_default_search?: components["schemas"]["WebSearchKeyBackend"];+ default_search: components["schemas"]["WebSearchSearchBackend"];+ chosen_default_search?: components["schemas"]["WebSearchSearchBackend"];/** @constant */default_open: "direct";/** @description False when the deployment has no TEAMHUB_SECRET_ENCRYPTION_KEY to seal keys with. */@@ -7487,11 +7503,11 @@ export interface components {decision_id?: string;};SetWebSearchDefaultRequest: {- backend: components["schemas"]["WebSearchKeyBackend"];+ backend: components["schemas"]["WebSearchSearchBackend"];};WebSearchDefault: {- default_search: components["schemas"]["WebSearchKeyBackend"];- chosen_default_search?: components["schemas"]["WebSearchKeyBackend"];+ default_search: components["schemas"]["WebSearchSearchBackend"];+ chosen_default_search?: components["schemas"]["WebSearchSearchBackend"];};DocumentMetadataUpdateRequest: {title: string;diff --git a/contracts/openapi/components/web-search.yaml b/contracts/openapi/components/web-search.yamlindex 495ac0ad..38282ac1 100644--- a/contracts/openapi/components/web-search.yaml+++ b/contracts/openapi/components/web-search.yaml@@ -3,15 +3,17 @@ components:WebSearchBackendId:type: stringdescription: >-- A web search backend. direct opens pages only and is fetched by the- Agent CLI on the Agent's computer; TeamHub never fetches a page itself.- enum: [tavily, brave, firecrawl, you, direct]+ A web search backend. duckduckgo searches without a key. direct opens+ pages only and is fetched by the Agent CLI on the Agent's computer;+ TeamHub never fetches a page itself.+ enum: [tavily, brave, firecrawl, you, duckduckgo, direct]x-enum-varnames:[WebSearchBackendIdTavily,WebSearchBackendIdBrave,WebSearchBackendIdFirecrawl,WebSearchBackendIdYou,+ WebSearchBackendIdDuckduckgo,WebSearchBackendIdDirect,]WebSearchKeyBackend:@@ -25,6 +27,18 @@ components:WebSearchKeyBackendFirecrawl,WebSearchKeyBackendYou,]+ WebSearchSearchBackend:+ type: string+ description: A backend that runs searches.+ enum: [tavily, brave, firecrawl, you, duckduckgo]+ x-enum-varnames:+ [+ WebSearchSearchBackendTavily,+ WebSearchSearchBackendBrave,+ WebSearchSearchBackendFirecrawl,+ WebSearchSearchBackendYou,+ WebSearchSearchBackendDuckduckgo,+ ]WebSearchCommand:type: stringenum: [search, open]@@ -114,8 +128,9 @@ components:additionalProperties: falsedescription: >-One backend with the static text a client shows for it and its live- state. status is ready when a call would run now: direct always, You.com- also without a key, the others with a key that is not rejected.+ state. status is ready when a call would run now: DuckDuckGo and direct+ always, You.com also without a key, the others with a key that is not+ rejected.required:[id,@@ -139,22 +154,22 @@ components:maxLength: 80tier:type: string- enum: [key, free_trial, none]+ enum: [key, free, none]x-enum-varnames:[WebSearchBackendTierKey,- WebSearchBackendTierFreeTrial,+ WebSearchBackendTierFree,WebSearchBackendTierNone,]description: >-How a call to the backend runs now. key: with an API key saved in- the product (or one it still needs); free_trial: You.com without a- key, a limited trial with lower quality results that TeamHub does- not count; none: direct, which needs no account.+ the product (or one it still needs); free: without a key, on a free+ service with limits that TeamHub does not count (DuckDuckGo, and+ You.com without a key); none: direct, which needs no account.tier_text:type: stringmaxLength: 300- description: A short display line for the tier, set for free_trial.+ description: A short display line for the tier, set for free.commands:type: arrayminItems: 1@@ -225,13 +240,13 @@ components:Every backend in TeamHub's default order. default_search is thebackend a search without one uses now: the default a Human saved(chosen_default_search) even when its key stopped working, else the- first ready backend in that order.+ first backend with a usable key in that order, else duckduckgo.required: [default_search, default_open, can_save_keys, backends]properties:default_search:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"chosen_default_search:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"default_open:type: stringconst: direct@@ -267,16 +282,16 @@ components:required: [backend]properties:backend:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"WebSearchDefault:type: objectadditionalProperties: falserequired: [default_search]properties:default_search:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"chosen_default_search:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"WebSearchRequest:type: objectadditionalProperties: false@@ -287,7 +302,7 @@ components:minLength: 1maxLength: 400backend:- $ref: "#/components/schemas/WebSearchKeyBackend"+ $ref: "#/components/schemas/WebSearchSearchBackend"limit:type: integerminimum: 1diff --git a/contracts/openapi/paths/agent-web-search.yaml b/contracts/openapi/paths/agent-web-search.yamlindex 81d52434..041bb656 100644--- a/contracts/openapi/paths/agent-web-search.yaml+++ b/contracts/openapi/paths/agent-web-search.yaml@@ -8,8 +8,9 @@ search:Without backend, TeamHub uses the default a Human chose exactly as ifthe request named it, even when its key stopped working; without achosen default it uses the first ready backend in the order tavily,- brave, firecrawl, you (with a key), then You.com's keyless free tier,- and details.origin is suggested. A filter the backend cannot honor is+ brave, firecrawl, you (with a key), then DuckDuckGo, which needs no key,+ and details.origin is suggested. You.com without a key runs only when+ named or chosen. A filter the backend cannot honor isrefused before any call. There is no automatic fallback to anotherbackend. When the backend needs a key the deployment lacks, or theprovider refused the saved one, or the keyless You.com searches are useddiff --git a/docs/local-inference.md b/docs/local-inference.mdindex 4bf32360..f3a2bced 100644--- a/docs/local-inference.md+++ b/docs/local-inference.md@@ -48,9 +48,11 @@ On Subscription, Claude Code and Codex keep their own web search. On Localmodel and BYOK the gateway cannot run that provider-hosted search, so thecomputer turns it off and agents search and read pages with `teamhub web search`and `teamhub web open`, as Pi always does. Those commands use the web search-providers set up on the server (Tavily, Brave Search, Firecrawl or You.com,-whose limited free trial needs no key); pages are read from this computer by-default. When a provider needs a key, a card in the chat asks for it.+providers set up on the server (Tavily, Brave Search, Firecrawl or You.com).+Without any key they search DuckDuckGo, which is free but blocks searches that+come too often; You.com also works without a key, with lower quality. Pages are+read from this computer by default. When a provider needs a key, a card in the+chat asks for it.## Background Memory and Wiki