Skip to content

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(teamhub-cli): search the web and read pages with teamhub web

LeoXingdae34a7be955
diff --git a/apps/teamhub-cli/README.md b/apps/teamhub-cli/README.md
index 092b1f58..deb62129 100644
--- a/apps/teamhub-cli/README.md
+++ b/apps/teamhub-cli/README.md
@@ -65,7 +65,7 @@ Connected application commands may have their own file options. For those option
## Connected applications
Eight applications have dedicated commands: Gmail, Outlook, Slack, Google Calendar, Notion, Google Drive, Figma and GitHub, with 50 Connector leaf commands. `teamhub gmail --help` and `teamhub gdrive --help` discover them offline, and each command keeps its own help, examples and Composio support boundary.
-Choose an account with `--account <connection ID|full label>`; labels match case-insensitively, connection IDs exactly. A connection ID that no longer matches a delegated account returns `account_ambiguous` with the delegated candidates instead of switching accounts. Without a delegation, the command asks the user in an allowed chat to click an authorization card that names the requested label; run the original command again after authorization.
+Choose an account with `--account <connection ID|full label>`; labels match case-insensitively, connection IDs exactly. A connection ID that no longer matches a delegated account returns `account_ambiguous` with the delegated candidates instead of switching accounts. Without a delegation, the command posts an authorization card in an allowed chat that names the requested label and exits with `authorization_required`; the Agent ends its turn, and the card's result wakes it to run the original command again.
Mail `--markdown` is converted to HTML by TeamHub; only `--attach` adds attachments.
GitHub reads the connected account, its repositories, issues and pull requests at once; `github comment` and `github create-issue` wait for the sponsor's confirmation card.
@@ -73,3 +73,19 @@ GitHub reads the connected account, its repositories, issues and pull requests a
Other Connected Apps (such as Canva or Linear) have no dedicated commands and are called through `teamhub apps search/execute`. TeamHub runs the tools it knows as reads at once, including Linear's list, get and search tools and a `LINEAR_RUN_QUERY_OR_MUTATION` document that declares only queries; every other call waits for the sponsor's confirmation card.
`teamhub apps connect <app-key>` asks for access to any Connected App that supports Agent tools; without an authorized account it posts an authorization card in the current chat. `teamhub apps auto-reminders list|set` lists or toggles automatic reminders for the Sponsor's own connections.
+
+## Web search
+
+`teamhub web` searches the web and reads pages through providers whose API keys are saved once for the whole deployment, in TeamHub; keys never reach the Computer.
+
+```bash
+teamhub web search 'postgres 19 features' --recency month --site postgresql.org
+teamhub web open https://www.postgresql.org/about/ --output ./about.md
+teamhub web list
+teamhub web connect tavily
+```
+
+- `web search <query>` runs on Tavily, Brave Search, Firecrawl or You.com (`--backend`), with `--limit 1-20`, `--recency day|week|month|year` and repeatable `--site <domain>`. Without `--backend` it uses the default backend the user chose, else the first ready backend in that order, else You.com's free trial, which is limited and lower quality. Results carry title, URL, snippet and an optional date, never the backend.
+- `web open <url>` fetches the page from this computer by default (`--backend direct`) and converts its main content to Markdown; `--backend tavily|firecrawl|you` reads it through the provider instead, which helps with pages that need JavaScript or block plain requests. The Markdown is cut at 20,000 characters with `truncated: true`, and `--output <file>` saves it to a new file and never overwrites one.
+- `web list` shows each backend's commands, filters, readiness and live quota; `web connect <backend>` posts a key card unless that backend is ready.
+- A backend never falls back to another one. When the requested backend, or the default one, has no key, a rejected key or a used-up free trial, TeamHub posts a key card in the chat and the command exits 4 with `search_key_requested`, the backend and the card in `details`. The Agent ends its turn: a key saved from the card reruns the request and wakes the Agent with its results. A used-up quota (`search_quota_exhausted`) or rate limit (`provider_rate_limited`) lists `ready_backends` to choose from.
diff --git a/apps/teamhub-cli/package.json b/apps/teamhub-cli/package.json
index 6d9f1f3a..52770566 100644
--- a/apps/teamhub-cli/package.json
+++ b/apps/teamhub-cli/package.json
@@ -32,6 +32,9 @@
"@types/yazl": "3.3.1",
"remark-gfm": "^4.0.1",
"remark-parse": "^11.0.0",
+ "remark-stringify": "^11.0.0",
+ "rehype-parse": "9.0.1",
+ "rehype-remark": "10.0.1",
"unified": "^11.0.5",
"tsx": "4.22.4"
},
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.snap
index 7b9a17ab..6b09c8a3 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
@@ -3206,6 +3206,91 @@ LEARN MORE
",
"schema": "exit 0
{"command":["video-gen"],"description":"Start a video generation job, look up model prices, or check a job and save its result.","read_only":false,"input_schema":{"type":"object","additionalProperties":false,"properties":{"provider":{"enum":["fal","higgsfield"]},"type":{"enum":["image","video"]},"mode":{"enum":["generate","price","job"]},"model":{"type":"string","minLength":1},"parameters":{"type":"object","additionalProperties":true},"files":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"field":{"type":"string","minLength":1},"path":{"type":"string","minLength":1}},"required":["field","path"]}},"jobIds":{"type":"array","items":{"type":"string","minLength":1}},"output":{"type":"string","minLength":1},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20},"cursor":{"type":"string","minLength":1},"account":{"type":"string","minLength":1,"maxLength":240}},"required":["provider","type","mode"]},"output_schema":{"anyOf":[{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"account":{"type":"object","additionalProperties":false,"properties":{"connectionId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"displayName":{"type":"string"},"identityLabel":{"type":"string"}},"required":["connectionId","name","displayName","identityLabel"]},"models":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"modelId":{"type":"string","minLength":1},"name":{"type":"string"},"outputType":{"enum":["image","video"]},"description":{"type":"string"},"price":{"type":"object","additionalProperties":false,"properties":{"unitPrice":{"type":"number","minimum":0},"unit":{"type":"string"},"currency":{"type":"string"}},"required":["unitPrice"]},"inputs":{"type":"array","items":{"type":"object","additionalProperties":true}},"outputs":{"type":"array","items":{"type":"object","additionalProperties":true}},"parameters":{"type":"array","items":{"type":"object","additionalProperties":true}},"medias":{"type":"array","items":{"type":"object","additionalProperties":true}},"aspectRatios":{"type":"array","items":{}},"durations":{"type":"array","items":{}},"durationRange":{"type":"object","additionalProperties":true},"supportsUnlimited":{"type":"boolean"},"docsUrl":{"type":"string"}},"required":["modelId","outputType"]}},"hasMore":{"type":"boolean"},"nextCursor":{"type":"string","minLength":1},"pricingStatus":{"enum":["available","partial","unavailable"]},"warning":{"type":"string"}},"required":["account","models","hasMore","pricingStatus"]},{"type":"object","additionalProperties":false,"properties":{"account":{"type":"object","additionalProperties":false,"properties":{"connectionId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"displayName":{"type":"string"},"identityLabel":{"type":"string"}},"required":["connectionId","name","displayName","identityLabel"]},"requestId":{"type":"string","minLength":1},"model":{"type":"string","minLength":1},"status":{"enum":["queued","running","completed","failed"]},"queuePosition":{"type":"integer","minimum":0},"error":{"type":"string"},"outputs":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","minLength":1},"contentType":{"type":"string"},"fileName":{"type":"string"},"sizeBytes":{"type":"integer"}},"required":["url"]}},"result":{"type":"object","additionalProperties":true},"files":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","minLength":1},"path":{"type":"string","minLength":1},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"warning":{"type":"string"}},"required":["url","path","sizeBytes","sha256"]}},"nextCommand":{"type":"string"},"warning":{"type":"string"}},"required":["account","requestId","model","status"]},{"type":"object","additionalProperties":false,"properties":{"account":{"type":"object","additionalProperties":false,"properties":{"connectionId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"displayName":{"type":"string"},"identityLabel":{"type":"string"}},"required":["connectionId","name","displayName","identityLabel"]},"jobs":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"jobId":{"type":"string","minLength":1},"type":{"type":"string"},"model":{"type":"string"},"status":{"enum":["queued","running","completed","failed"]},"error":{"type":"string"},"url":{"type":"string"},"thumbnailUrl":{"type":"string"}},"required":["jobId","status"]}},"rejected":{"type":"object","additionalProperties":false,"properties":{"error":{"type":"string"},"reason":{"type":"string"},"recoveryTool":{"type":"string"}},"required":[]},"unlimitedChoice":{},"inputs":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","minLength":1},"mediaId":{"type":"string","minLength":1}},"required":["source","mediaId"]}},"adjustments":{"type":"object","additionalProperties":true},"warning":{"type":"string"},"files":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"url":{"type":"string","minLength":1},"path":{"type":"string","minLength":1},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"warning":{"type":"string"}},"required":["url","path","sizeBytes","sha256"]}},"nextCommand":{"type":"string"}},"required":["account","jobs"]}]},{"type":"object","additionalProperties":false,"properties":{"account":{"type":"object","additionalProperties":false,"properties":{"connectionId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"displayName":{"type":"string"},"identityLabel":{"type":"string"}},"required":["connectionId","name","displayName","identityLabel"]},"result":{"type":"object","additionalProperties":false,"properties":{"action":{"const":"confirmation_requested"},"confirmation":{"type":"object","additionalProperties":false,"properties":{"status":{"const":"pending"},"interactionId":{"type":"string","minLength":1},"messageId":{"type":"string","minLength":1},"roomId":{"type":"string","minLength":1}},"required":["status","interactionId","messageId","roomId"]}},"required":["action","confirmation"]}},"required":["account","result"]}]},"cli":{"usage":["teamhub video-gen --provider <provider> --model <model-id> --prompt <text> [flags]","teamhub video-gen --provider <provider> --price [--model <model-id>] [flags]","teamhub video-gen --provider <provider> --model <model-id> --job <job-id> [flags]"],"arguments":[],"options":{"--provider":{"description":"fal or higgsfield; required."},"--model":{"description":"Provider model ID; required for generation and job lookup."},"--prompt":{"description":"What to generate; required for generation."},"--price":{"description":"Read model prices without starting a job; --model selects one model and its parameters.","boolean":true},"--job":{"description":"Check an existing job once without submitting again; repeatable for Higgsfield.","repeatable":true},"--set":{"description":"Model parameter as field=value; repeatable. JSON values keep their types.","repeatable":true},"--file":{"description":"Reference input as field=local-path; repeatable. Use a fal input field or a Higgsfield media role.","repeatable":true},"--output":{"description":"Where finished results are saved: one to a new file, several to a new directory. Saved by the --job check that finds the job finished; never overwrites."},"--limit":{"description":"Price-list page size, 1-100, default 20."},"--cursor":{"description":"Continue the previous price-list page with the same provider and account."},"--account":{"description":"Select a connection ID or complete account label; when authorization is missing, an authorization card is shown in the chat."},"--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},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":["Generation spends the selected connected account's balance. --price returns fal unit prices; Higgsfield reports pricingStatus=unavailable because its model catalog exposes no price table. No estimate is substituted and no job starts.","Generation returns as soon as the provider accepts the job; it does not wait for the result. Run the returned nextCommand later to check the job once; it saves to --output when the job has finished. Never repeat a paid submission after an unknown outcome.","--price --model also shows model-specific parameters and reference inputs. Pass those parameters with --set and local reference files with --file.","A single result is saved as delivered under the requested name. A warning reports a mismatched file extension; no conversion is performed.","Help and schema are available offline; TeamHub checks current access at execution time."]}}
+",
+ },
+ "web connect": {
+ "help": "exit 0
+teamhub web connect <tavily|brave|firecrawl|you>
+Ask the user for a web search backend's API key: posts a key card in this chat unless the backend is already ready.
+
+Arguments:
+ <backend> tavily, brave, firecrawl or you.
+
+Options:
+ --json Return machine-readable JSON.
+ --help Show this offline command reference.
+ -h Show help.
+ --schema Show offline input and output schemas.
+When it posts the card, end your turn. The card's result wakes you when the user adds a key or declines. Never ask for an API key in a message.
+",
+ "schema": "exit 0
+{"command":["web","connect"],"description":"Ask the user for a web search backend's API key: posts a key card in this chat unless the backend is already ready.","read_only":true,"input_schema":{"type":"object","properties":{"backend":{"enum":["tavily","brave","firecrawl","you"]}},"required":["backend"],"additionalProperties":false},"output_schema":{"type":"object","properties":{"status":{"enum":["ready","connection_requested"]},"backend":{"type":"object"},"message_id":{"type":"string"},"interaction_id":{"type":"string"}},"required":["status"]},"cli":{"usage":["teamhub web connect <tavily|brave|firecrawl|you>"],"arguments":["<backend> tavily, brave, firecrawl or you."],"options":{"--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":["When it posts the card, end your turn. The card's result wakes you when the user adds a key or declines. Never ask for an API key in a message."]}}
+",
+ },
+ "web list": {
+ "help": "exit 0
+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.
+ --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":[]}}
+",
+ },
+ "web open": {
+ "help": "exit 0
+teamhub web open <url> [--backend direct|tavily|firecrawl|you] [--output <file>]
+Read one web page as Markdown, from this computer or through a provider.
+
+Arguments:
+ <url> An absolute http or https URL.
+
+Options:
+ --backend <value> direct (default) fetches the page from this computer; tavily, firecrawl or you read it through the provider, which helps with pages that need JavaScript or block plain requests.
+ --output <value> Save the Markdown to this new file instead of printing it; never overwrites.
+ --json Return machine-readable JSON.
+ --help Show this offline command reference.
+ -h Show help.
+ --schema Show offline input and output schemas.
+The Markdown is cut at 20,000 characters; truncated says when it was.
+Examples:
+teamhub web open https://www.postgresql.org/about/news/
+teamhub web open https://example.com/report --backend firecrawl --output report.md
+",
+ "schema": "exit 0
+{"command":["web","open"],"description":"Read one web page as Markdown, from this computer or through a provider.","read_only":true,"input_schema":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2048},"backend":{"enum":["tavily","firecrawl","you","direct"]},"output":{"type":"string"}},"required":["url"],"additionalProperties":false},"output_schema":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"markdown":{"type":"string","description":"The page as Markdown; absent when saved with --output."},"path":{"type":"string","description":"The file written with --output."},"truncated":{"type":"boolean","description":"True when the page was longer than 20,000 characters."}},"required":["url","truncated"]},"cli":{"usage":["teamhub web open <url> [--backend direct|tavily|firecrawl|you] [--output <file>]"],"arguments":["<url> An absolute http or https URL."],"options":{"--backend":{"description":"direct (default) fetches the page from this computer; tavily, firecrawl or you read it through the provider, which helps with pages that need JavaScript or block plain requests."},"--output":{"description":"Save the Markdown to this new file instead of printing it; never overwrites."},"--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":["The Markdown is cut at 20,000 characters; truncated says when it was."]}}
+",
+ },
+ "web search": {
+ "help": "exit 0
+teamhub web search <query> [--backend tavily|brave|firecrawl|you] [--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.
+ --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.
+ --help Show this offline command reference.
+ -h Show help.
+ --schema Show offline input and output schemas.
+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.
+Examples:
+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."]}}
",
},
}
@@ -3241,6 +3326,7 @@ Commands:
task
tracking-items
video-gen
+ web
help
Run teamhub <command> --help for command options. Help and schema are offline; TeamHub checks current resource access.
@@ -4390,6 +4476,24 @@ EXAMPLES
LEARN MORE
teamhub --help
teamhub video-gen --schema --json
+",
+ "web": "exit 0
+web common operations.
+
+USAGE
+ teamhub web <command> [flags]
+
+COMMANDS
+ search Search the web through a provider with the deployment's saved API key.
+ open Read one web page as Markdown, from this computer or through a provider.
+ list List the web search backends with what each supports, whether it is ready, and its quota.
+ connect Ask the user for a web search backend's API key: posts a key card in this chat unless the backend is already ready.
+
+INHERITED FLAGS
+ -h, --help Show help
+
+EXAMPLES
+ teamhub web search --help
",
}
`;
diff --git a/apps/teamhub-cli/src/cli.openapi.test.ts b/apps/teamhub-cli/src/cli.openapi.test.ts
index 4b704181..990f514e 100644
--- a/apps/teamhub-cli/src/cli.openapi.test.ts
+++ b/apps/teamhub-cli/src/cli.openapi.test.ts
@@ -499,6 +499,53 @@ async function respond(request: Request): Promise<Response> {
sha256: digest(new Uint8Array(await request.arrayBuffer())),
replayed: false,
});
+ if (endpoint.endsWith("/web/search"))
+ return Response.json({
+ results: [
+ {
+ title: "Rust 2026",
+ url: "https://blog.rust-lang.org/2026",
+ snippet: "The edition ships.",
+ },
+ ],
+ });
+ if (endpoint.endsWith("/web/open"))
+ return Response.json({
+ url: "https://example.com/page",
+ title: "Page",
+ markdown: "# Page",
+ truncated: false,
+ });
+ if (endpoint.endsWith("/web/backends/query"))
+ return Response.json({
+ default_search: "you",
+ default_open: "direct",
+ can_save_keys: true,
+ backends: [
+ {
+ id: "you",
+ name: "You.com",
+ tier: "free_trial",
+ tier_text: "Free trial - limited and lower quality.",
+ commands: ["search", "open"],
+ filters: ["recency"],
+ max_limit: 20,
+ max_sites: 0,
+ keyless: true,
+ official_key_check: true,
+ status: "ready",
+ key_state: "none",
+ quota: { from: "unavailable", reason: "not_reported" },
+ },
+ ],
+ });
+ if (endpoint.endsWith("/web/connect"))
+ return Response.json({
+ status: "connection_requested",
+ room_id: "room_one",
+ message_id: "message_card",
+ interaction_id: "interaction_one",
+ });
throw new Error(`Missing response fixture: ${request.method} ${endpoint}`);
}
diff --git a/apps/teamhub-cli/src/command-errors.ts b/apps/teamhub-cli/src/command-errors.ts
index e33ba41a..1789440f 100644
--- a/apps/teamhub-cli/src/command-errors.ts
+++ b/apps/teamhub-cli/src/command-errors.ts
@@ -12,7 +12,7 @@ export interface CommandError {
const singleLine = (value: string) => value.replace(/\p{Cc}/gu, " ");
const templates: Record<string, string> = {
authorization_required:
- "Complete the account authorization card in the chat, then run this command again.",
+ "Waiting for the user to authorize the account; an authorization card is in the chat. End your turn: the card's result wakes you, then run this command again. If the user declines, don't retry.",
provider_key_required:
"The user has not set up Composio, which every connected app needs. A card asking them to add a Composio API key was posted in this chat; run this command again after they add it.",
account_ambiguous:
@@ -87,6 +87,11 @@ export function formatCommandError(
"candidates",
"draft_id",
"partial_receipts",
+ "backend",
+ "origin",
+ "reason",
+ "ready_backends",
+ "retry_after_seconds",
]
.filter((name) => Object.hasOwn(error.details, name))
.map((name) => [name, error.details[name]]),
@@ -131,6 +136,10 @@ export function renderCommandError(error: CommandError): string {
typeof error.details?.draft_id === "string"
? `Draft: ${singleLine(error.details.draft_id)}`
: undefined,
+ Array.isArray(error.details?.ready_backends) &&
+ error.details.ready_backends.length
+ ? `Ready backends: ${error.details.ready_backends.map((item) => singleLine(displayText(item))).join(", ")}`
+ : "",
...(Array.isArray(error.details?.partial_receipts)
? error.details.partial_receipts
: []
@@ -177,6 +186,7 @@ export function errorExitCode(failure: CliError): number {
unsupported_combination: 2,
authorization_required: 4,
provider_key_required: 4,
+ search_key_requested: 4,
unauthenticated: 4,
conflict: 3,
ambiguous_name: 2,
diff --git a/apps/teamhub-cli/src/connector-runtime.ts b/apps/teamhub-cli/src/connector-runtime.ts
index cfcc6e9c..e44d1b36 100644
--- a/apps/teamhub-cli/src/connector-runtime.ts
+++ b/apps/teamhub-cli/src/connector-runtime.ts
@@ -156,7 +156,7 @@ export async function resolveConnectorAccount(
function authorizationCard(resolution: Json): never {
throw new ConnectorError(
"authorization_required",
- "Complete the account authorization card in the chat, then run this command again.",
+ "Waiting for the user to authorize the account; an authorization card is in the chat. End your turn: the card's result wakes you, then run this command again. If the user declines, don't retry.",
{ ...resolution, operation_rejected: true },
);
}
diff --git a/apps/teamhub-cli/src/domain-commands.ts b/apps/teamhub-cli/src/domain-commands.ts
index c9446925..d8910329 100644
--- a/apps/teamhub-cli/src/domain-commands.ts
+++ b/apps/teamhub-cli/src/domain-commands.ts
@@ -22,6 +22,7 @@ import { businessCommandDefinitions } from "./business-commands.js";
import { mailCommandDefinitions } from "./connector-mail.js";
import { gmailCanvasCommandDefinitions } from "./connector-gmail-canvas.js";
import { calendarCommandDefinitions } from "./connector-calendar.js";
+import { webCommandDefinitions } from "./web-commands.js";
import { publicBusinessSchemas } from "./business-schemas.js";
import { CliError } from "./errors.js";
@@ -39,6 +40,7 @@ export const commandDefinitions: readonly CommandDefinition[] = [
...notionCommandDefinitions,
...slackCommandDefinitions,
...calendarCommandDefinitions,
+ ...webCommandDefinitions,
];
export interface DomainCommand {
readonly route: "commands" | "schema" | "help";
@@ -119,6 +121,7 @@ export function domainHelp(prefix: readonly string[] = []): string {
"github",
"fal",
"higgsfield",
+ "web",
].includes(prefix[0]!)
) {
const children = new Map<string, string>();
diff --git a/apps/teamhub-cli/src/test-support/command-examples.ts b/apps/teamhub-cli/src/test-support/command-examples.ts
index 973b6559..b71a8841 100644
--- a/apps/teamhub-cli/src/test-support/command-examples.ts
+++ b/apps/teamhub-cli/src/test-support/command-examples.ts
@@ -128,6 +128,10 @@ export const commandExamples: Record<string, string[]> = {
list_connected_apps: [],
connect_app: ["notion"],
request_browser_connection: [],
+ web_search: ["rust edition", "--limit", "3", "--recency", "month"],
+ web_open: ["https://example.com/page", "--backend", "tavily"],
+ list_web_backends: ["--backend", "you"],
+ connect_web_backend: ["tavily"],
read_computer_permissions: [],
request_computer_permission: ["--permissions", "screen_recording"],
list_auto_reminders: [],
diff --git a/apps/teamhub-cli/src/web-commands.test.ts b/apps/teamhub-cli/src/web-commands.test.ts
new file mode 100644
index 00000000..a9399a8d
--- /dev/null
+++ b/apps/teamhub-cli/src/web-commands.test.ts
@@ -0,0 +1,397 @@
+import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { runCli } from "./cli.js";
+import { displayText } from "./display-text.js";
+import { requestUrlText } from "./test-support/fetch-text.js";
+import { htmlToMarkdown } from "./web-page.js";
+
+const roots: string[] = [];
+afterEach(async () => {
+ await Promise.all(
+ roots.splice(0).map((root) => rm(root, { recursive: true, force: true })),
+ );
+});
+
+async function fixture(respond: (url: string, body: unknown) => Response) {
+ const cwd = await mkdtemp(path.join(tmpdir(), "teamhub-web-"));
+ roots.push(cwd);
+ const calls: { url: string; body: unknown }[] = [];
+ const output: string[] = [],
+ errors: string[] = [];
+ const fetcher = vi.fn<typeof fetch>(async (url, init) => {
+ const body = init?.body ? JSON.parse(displayText(init.body)) : undefined;
+ calls.push({ url: requestUrlText(url), body });
+ return respond(requestUrlText(url), body);
+ });
+ const run = (args: string[]) =>
+ runCli(args, {
+ cwd,
+ env: {
+ TEAMHUB_URL: "https://teamhub.example",
+ TEAMHUB_TOKEN: "th_agent_fixture",
+ },
+ fetch: fetcher,
+ stdout: (s: string) => void output.push(s),
+ stderr: (s: string) => void errors.push(s),
+ });
+ return { cwd, calls, output, errors, run };
+}
+const teamHubError = (
+ status: number,
+ code: string,
+ details: Record<string, unknown>,
+) =>
+ Response.json(
+ {
+ error: {
+ code,
+ message: "Provider prose that must not reach the Agent.",
+ request_id: "request_one",
+ details,
+ },
+ },
+ { status },
+ );
+const page = (html: string, type = "text/html; charset=utf-8") =>
+ new Response(html, { headers: { "content-type": type } });
+
+describe("teamhub web search", () => {
+ it("sends the query and filters and prints results without a backend", async () => {
+ const f = await fixture(() =>
+ Response.json({
+ results: [
+ {
+ title: "Rust 2026",
+ url: "https://blog.rust-lang.org/2026",
+ snippet: "The edition ships.",
+ published_at: "2026-10-01",
+ },
+ ],
+ }),
+ );
+ expect(
+ await f.run([
+ "web",
+ "search",
+ "rust",
+ "edition",
+ "--backend",
+ "brave",
+ "--limit",
+ "3",
+ "--recency",
+ "month",
+ "--site",
+ "rust-lang.org",
+ ]),
+ ).toBe(0);
+ expect(f.calls).toEqual([
+ {
+ url: "https://teamhub.example/api/agent/v1/web/search",
+ body: {
+ query: "rust edition",
+ backend: "brave",
+ limit: 3,
+ recency: "month",
+ sites: ["rust-lang.org"],
+ },
+ },
+ ]);
+ const text = f.output.join("");
+ expect(text).toContain("1. Rust 2026\n https://blog.rust-lang.org/2026");
+ expect(text).toContain("The edition ships.");
+ expect(text).not.toContain("brave");
+ });
+ it.each([
+ [["web", "search"]],
+ [["web", "search", "q", "--limit", "21"]],
+ [["web", "search", "q", "--backend", "direct"]],
+ [["web", "search", "q", "--recency", "hour"]],
+ ])("rejects %j before any request", async (args) => {
+ const f = await fixture(() => Response.json({}));
+ expect(await f.run(args)).toBe(2);
+ expect(f.calls).toEqual([]);
+ });
+ it("waits for the key card with authored text and exits 4", async () => {
+ const f = await fixture(() =>
+ teamHubError(409, "SEARCH_KEY_REQUESTED", {
+ backend: "tavily",
+ origin: "suggested",
+ reason: "missing",
+ room_id: "room_one",
+ message_id: "message_card",
+ interaction_id: "interaction_one",
+ }),
+ );
+ expect(await f.run(["web", "search", "q", "--json"])).toBe(4);
+ const failure = JSON.parse(f.errors.join("")).error;
+ expect(failure).toEqual({
+ code: "SEARCH_KEY_REQUESTED",
+ message:
+ "Waiting for the user to add a Tavily API key; a card asking for it is in the chat. End your turn: the card's result wakes you with the results or what to run next. If the user declines, don't retry.",
+ command: "web search",
+ details: {
+ http_status: 409,
+ request_id: "request_one",
+ room_id: "room_one",
+ message_id: "message_card",
+ interaction_id: "interaction_one",
+ backend: "tavily",
+ origin: "suggested",
+ reason: "missing",
+ },
+ });
+ });
+ it("names a rejected key and the used-up trial", async () => {
+ const reasons = ["rejected", "free_limit"];
+ const f = await fixture(() =>
+ teamHubError(409, "SEARCH_KEY_REQUESTED", {
+ backend: "brave",
+ origin: "requested",
+ reason: reasons.shift(),
+ message_id: "message_card",
+ }),
+ );
+ await f.run(["web", "search", "q"]);
+ await f.run(["web", "search", "q"]);
+ const text = f.errors.join("");
+ expect(text).toContain(
+ "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;",
+ );
+ expect(text).not.toContain("Provider prose");
+ });
+ it("lists the ready backends when the quota is used up", async () => {
+ const f = await fixture(() =>
+ teamHubError(402, "SEARCH_QUOTA_EXHAUSTED", {
+ backend: "tavily",
+ ready_backends: ["brave", "you"],
+ }),
+ );
+ expect(await f.run(["web", "search", "q"])).toBe(1);
+ const text = f.errors.join("");
+ expect(text).toContain(
+ "The Tavily account has no credit or quota left. Run again with --backend set to a ready backend (brave, you), or tell the user.",
+ );
+ expect(text).toContain("Ready backends: brave, you");
+ });
+});
+
+describe("teamhub web open", () => {
+ it("opens a page from this computer and converts its main content", async () => {
+ const f = await fixture((url) =>
+ url === "https://news.example/a"
+ ? page(
+ `<!doctype html><html><head><title>Launch notes</title><style>p{}</style></head><body><nav>Home</nav><main><h1>Launch</h1><p>Read <a href="/b">more</a>.</p><script>x()</script><ul><li>One</li></ul></main><footer>Footer</footer></body></html>`,
+ )
+ : Response.json({}, { status: 500 }),
+ );
+ expect(
+ await f.run(["web", "open", "https://news.example/a", "--json"]),
+ ).toBe(0);
+ expect(f.calls.map((call) => call.url)).toEqual(["https://news.example/a"]);
+ expect(JSON.parse(f.output.join(""))).toEqual({
+ url: "https://news.example/a",
+ title: "Launch notes",
+ truncated: false,
+ markdown: "# Launch\n\nRead [more](https://news.example/b).\n\n- One",
+ });
+ });
+ it("cuts long pages and saves to a new file without overwriting", async () => {
+ const f = await fixture(() =>
+ page("x".repeat(25000), "text/plain; charset=utf-8"),
+ );
+ expect(
+ await f.run([
+ "web",
+ "open",
+ "https://files.example/log.txt",
+ "--output",
+ "log.md",
+ "--json",
+ ]),
+ ).toBe(0);
+ const result = JSON.parse(f.output.join(""));
+ expect(result).toEqual({
+ url: "https://files.example/log.txt",
+ truncated: true,
+ path: path.join(f.cwd, "log.md"),
+ });
+ expect((await readFile(path.join(f.cwd, "log.md"), "utf8")).length).toBe(
+ 20000,
+ );
+ await writeFile(path.join(f.cwd, "taken.md"), "keep");
+ f.calls.length = 0;
+ expect(
+ await f.run([
+ "web",
+ "open",
+ "https://files.example/log.txt",
+ "--output",
+ "taken.md",
+ ]),
+ ).toBe(2);
+ expect(f.calls).toEqual([]);
+ expect(await readFile(path.join(f.cwd, "taken.md"), "utf8")).toBe("keep");
+ });
+ it("reads through a provider backend when one is named", async () => {
+ const f = await fixture(() =>
+ Response.json({
+ url: "https://spa.example/",
+ title: "App",
+ markdown: "# App",
+ truncated: false,
+ }),
+ );
+ expect(
+ await f.run(["web", "open", "https://spa.example/", "--backend", "you"]),
+ ).toBe(0);
+ expect(f.calls).toEqual([
+ {
+ url: "https://teamhub.example/api/agent/v1/web/open",
+ body: { url: "https://spa.example/", backend: "you" },
+ },
+ ]);
+ expect(f.output.join("")).toBe(
+ "URL: https://spa.example/\nTitle: App\n\n# App\n",
+ );
+ });
+ it("explains a page this computer cannot read", async () => {
+ const f = await fixture(() => new Response("no", { status: 403 }));
+ expect(await f.run(["web", "open", "https://blocked.example/"])).toBe(1);
+ expect(f.errors.join("")).toContain(
+ "page_unreadable: The site answered HTTP 403. Try a provider backend with --backend",
+ );
+ });
+});
+
+describe("teamhub web list and connect", () => {
+ it("lists backends with readiness, free trial and quota", async () => {
+ const f = await fixture(() =>
+ Response.json({
+ default_search: "tavily",
+ chosen_default_search: "tavily",
+ default_open: "direct",
+ can_save_keys: true,
+ backends: [
+ {
+ id: "tavily",
+ name: "Tavily",
+ tier: "key",
+ commands: ["search", "open"],
+ filters: ["recency", "site"],
+ max_limit: 20,
+ max_sites: 10,
+ keyless: false,
+ official_key_check: true,
+ status: "ready",
+ key_state: "verified",
+ quota: {
+ from: "provider",
+ remaining: 900,
+ limit: 1000,
+ unit: "credits",
+ },
+ },
+ {
+ id: "you",
+ name: "You.com",
+ tier: "free_trial",
+ tier_text: "Free trial - limited and lower quality.",
+ commands: ["search", "open"],
+ filters: ["recency"],
+ max_limit: 20,
+ max_sites: 0,
+ keyless: true,
+ official_key_check: true,
+ status: "ready",
+ key_state: "none",
+ quota: { from: "unavailable", reason: "not_reported" },
+ },
+ {
+ id: "brave",
+ name: "Brave Search",
+ tier: "key",
+ commands: ["search"],
+ filters: [],
+ max_limit: 20,
+ max_sites: 1,
+ keyless: false,
+ official_key_check: false,
+ free_tier: "Free monthly credits.",
+ status: "key_required",
+ key_state: "none",
+ },
+ ],
+ }),
+ );
+ expect(await f.run(["web", "list", "--backend", "tavily"])).toBe(0);
+ expect(f.calls[0]).toEqual({
+ url: "https://teamhub.example/api/agent/v1/web/backends/query",
+ body: { backend: "tavily" },
+ });
+ const text = f.output.join("");
+ expect(text).toContain(
+ "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 tier: Free monthly credits.");
+ expect(text).toContain("run teamhub web connect <backend>");
+ });
+ it("posts the key card and tells the Agent to end its turn", async () => {
+ const f = await fixture(() =>
+ Response.json({
+ status: "connection_requested",
+ room_id: "room_one",
+ message_id: "message_card",
+ interaction_id: "interaction_one",
+ }),
+ );
+ expect(await f.run(["web", "connect", "firecrawl"])).toBe(0);
+ expect(f.calls[0]!.body).toEqual({ backend: "firecrawl" });
+ expect(f.output.join("")).toContain(
+ "Key card posted (message_card). End your turn now;",
+ );
+ expect(await f.run(["web", "connect", "direct"])).toBe(2);
+ });
+});
+
+describe("HTML to Markdown", () => {
+ it("turns layout tables into blocks and keeps the inner data table", async () => {
+ const converted = await htmlToMarkdown(
+ `<body><table><tr><td><a href="/vote"><span></span></a><a href="/">Site</a></td></tr><tr><td><table><tr><th>Rank</th><th>Story</th></tr><tr><td>1.</td><td><a href="/s">Story</a></td></tr></table></td></tr></table></body>`,
+ "https://t.example/",
+ );
+ expect(converted.markdown).toBe(
+ "[Site](https://t.example/)\n\n| Rank | Story |\n| - | - |\n| 1. | [Story](https://t.example/s) |",
+ );
+ });
+ it("drops link lists inside the main element", async () => {
+ const converted = await htmlToMarkdown(
+ `<main><div><ul><li><a href="/l0">Language 0</a></li><li><a href="/l1">Language 1</a></li><li><a href="/l2">Language 2</a></li><li><a href="/l3">Language 3</a></li><li><a href="/l4">Language 4</a></li><li><a href="/l5">Language 5</a></li><li><a href="/l6">Language 6</a></li><li><a href="/l7">Language 7</a></li><li><a href="/l8">Language 8</a></li><li><a href="/l9">Language 9</a></li><li><a href="/l10">Language 10</a></li><li><a href="/l11">Language 11</a></li></ul></div><p>Body text.</p></main>`,
+ "https://t.example/",
+ );
+ expect(converted.markdown).toBe("Body text.");
+ });
+ it("keeps highlighted code text and the text of links without a target", async () => {
+ const converted = await htmlToMarkdown(
+ `<main><h2><a href="#about">About</a></h2><pre><code><span>const </span><button>server</button><script>x()</script></code></pre></main>`,
+ "https://t.example/",
+ );
+ expect(converted.markdown).toBe("## About\n\n```\nconst server\n```");
+ });
+ it("drops site chrome only without a main element and keeps tables", async () => {
+ const converted = await htmlToMarkdown(
+ `<body><header>Site</header><p hidden>Gone</p><table><tr><th>A</th></tr><tr><td>1</td></tr></table><img src="data:image/png;base64,AA"></body>`,
+ "https://t.example/",
+ );
+ expect(converted).toEqual({ markdown: "| A |\n| - |\n| 1 |" });
+ });
+});
diff --git a/apps/teamhub-cli/src/web-commands.ts b/apps/teamhub-cli/src/web-commands.ts
new file mode 100644
index 00000000..d3ad8cbe
--- /dev/null
+++ b/apps/teamhub-cli/src/web-commands.ts
@@ -0,0 +1,519 @@
+import type {
+ CommandDefinition,
+ CommandExecutionContext,
+ CommandOption,
+} from "./command-definition.js";
+import { assertPositionals, option, values } from "./command-input.js";
+import { displayText } from "./display-text.js";
+import { CliError, ConnectorError } from "./errors.js";
+import { teamHubData } from "./http-client.js";
+
+type Json = Record<string, unknown>;
+const keyBackends = ["tavily", "brave", "firecrawl", "you"] as const;
+const openBackends = ["tavily", "firecrawl", "you", "direct"] as const;
+const recencies = ["day", "week", "month", "year"] as const;
+const names: Record<string, string> = {
+ tavily: "Tavily",
+ brave: "Brave Search",
+ firecrawl: "Firecrawl",
+ you: "You.com",
+ direct: "Direct",
+};
+const nameOf = (backend: unknown) =>
+ names[String(backend)] ?? "The web search backend";
+const line = (value: unknown) =>
+ displayText(value ?? "")
+ .replace(/\s+/gu, " ")
+ .trim();
+const flag = (description: string, repeatable = false): CommandOption => ({
+ description,
+ ...(repeatable ? { repeatable: true } : {}),
+});
+function usage(message: string): never {
+ throw new CliError("usage", message);
+}
+function choice<T extends string>(
+ value: string | undefined,
+ allowed: readonly T[],
+ name: string,
+): T | undefined {
+ if (value === undefined) return undefined;
+ if (!(allowed as readonly string[]).includes(value))
+ usage(`${name} must be one of ${allowed.join(", ")}.`);
+ return value as T;
+}
+const wait =
+ "a card asking for it is in the chat. End your turn: the card's result wakes you with the results or what to run next. If the user declines, don't retry.";
+const readyHint = (details: Json) => {
+ const ready = Array.isArray(details.ready_backends)
+ ? details.ready_backends.filter((item) => typeof item === "string")
+ : [];
+ return ready.length
+ ? `Run again with --backend set to a ready backend (${ready.join(", ")}), or tell the user.`
+ : "No other backend is ready; tell the user.";
+};
+
+/**
+ * Rewrites a TeamHub web search failure into authored text from its code and
+ * structured details; TeamHub's own prose is never shown.
+ */
+function webFailure(error: unknown): never {
+ if (!(error instanceof CliError) || error.trustedMessage) throw error;
+ const details = error.details;
+ const name = nameOf(details.backend);
+ const authored = (message: string) =>
+ new ConnectorError(error.code, message, details);
+ switch (error.code.toLowerCase()) {
+ 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}`
+ : 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}`,
+ );
+ case "search_quota_exhausted":
+ throw authored(
+ `The ${name} account has no credit or quota left. ${readyHint(details)}`,
+ );
+ case "provider_rate_limited":
+ throw authored(
+ `${name} is rate limiting web search. ${
+ typeof details.retry_after_seconds === "number"
+ ? `Wait ${details.retry_after_seconds} seconds and retry, or use another backend.`
+ : readyHint(details)
+ }`,
+ );
+ case "tool_execution_failed":
+ throw authored(
+ `${name} could not read this page. Run again without --backend to open it from this computer, or try another backend.`,
+ );
+ case "dependency_unavailable":
+ if (details.backend !== undefined)
+ throw authored(
+ `${name} could not be reached. Try again later or use another backend; teamhub web list shows the ready ones.`,
+ );
+ throw error;
+ case "invalid_input":
+ if (details.backend !== undefined)
+ throw authored(
+ `${name} cannot run this command with these filters. Run teamhub web list to see what each backend supports.`,
+ );
+ throw error;
+ default:
+ throw error;
+ }
+}
+async function call<T extends Json>(request: Promise<{ data?: T }>) {
+ try {
+ return (await teamHubData(request)) as Json;
+ } catch (error) {
+ webFailure(error);
+ }
+}
+
+const backendSchema = (allowed: readonly string[]) => ({
+ enum: [...allowed],
+});
+const searchResultSchema = {
+ type: "object",
+ properties: {
+ title: { type: "string" },
+ url: { type: "string" },
+ snippet: { type: "string" },
+ published_at: { type: "string" },
+ },
+ required: ["title", "url", "snippet"],
+};
+const pageSchema = {
+ type: "object",
+ properties: {
+ url: { type: "string" },
+ title: { type: "string" },
+ markdown: {
+ type: "string",
+ description: "The page as Markdown; absent when saved with --output.",
+ },
+ path: {
+ type: "string",
+ description: "The file written with --output.",
+ },
+ truncated: {
+ type: "boolean",
+ description: "True when the page was longer than 20,000 characters.",
+ },
+ },
+ required: ["url", "truncated"],
+};
+
+const webSearch: CommandDefinition = {
+ command: ["web", "search"],
+ toolName: "web_search",
+ operationId: false,
+ description:
+ "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>]...",
+ ],
+ 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.",
+ ),
+ "--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).",
+ 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.",
+ ],
+ examples: [
+ 'teamhub web search "rust 2026 edition release date"',
+ 'teamhub web search "postgres 19 features" --recency month --site postgresql.org',
+ ],
+ inputSchema: {
+ type: "object",
+ properties: {
+ query: { type: "string", minLength: 1, maxLength: 400 },
+ backend: backendSchema(keyBackends),
+ limit: { type: "integer", minimum: 1, maximum: 20 },
+ recency: { enum: [...recencies] },
+ sites: {
+ type: "array",
+ maxItems: 10,
+ items: { type: "string", minLength: 3, maxLength: 253 },
+ },
+ },
+ required: ["query"],
+ additionalProperties: false,
+ },
+ outputSchema: {
+ type: "object",
+ properties: { results: { type: "array", items: searchResultSchema } },
+ required: ["results"],
+ },
+ normalize: async (args) => {
+ 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 recency = choice(option(args, "--recency"), recencies, "--recency");
+ const limitText = option(args, "--limit");
+ const limit = limitText === undefined ? undefined : Number(limitText);
+ if (
+ limit !== undefined &&
+ (!/^\d+$/u.test(limitText!) || limit < 1 || limit > 20)
+ )
+ usage("--limit must be an integer from 1 to 20.");
+ const sites = values(args, "--site").map((site) => site.trim());
+ if (
+ sites.length > 10 ||
+ new Set(sites).size !== sites.length ||
+ sites.some(
+ (site) => site.length < 3 || site.length > 253 || /\s/u.test(site),
+ )
+ )
+ usage("--site takes up to 10 distinct domains of 3-253 characters.");
+ return {
+ input: {
+ query,
+ ...(backend ? { backend } : {}),
+ ...(limit !== undefined ? { limit } : {}),
+ ...(recency ? { recency } : {}),
+ ...(sites.length ? { sites } : {}),
+ },
+ };
+ },
+ execute: async (input, context) => {
+ const result = await call(
+ context.client.api.POST("/api/agent/v1/web/search", {
+ body: input as never,
+ }),
+ );
+ return { results: Array.isArray(result.results) ? result.results : [] };
+ },
+ render: (result) => {
+ const results = result.results as Json[];
+ if (!results.length) return "No results.";
+ return results
+ .map((item, index) =>
+ [
+ `${index + 1}. ${line(item.title) || line(item.url)}`,
+ ` ${line(item.url)}`,
+ ...(item.published_at
+ ? [` Published: ${line(item.published_at)}`]
+ : []),
+ ...(line(item.snippet) ? [` ${line(item.snippet)}`] : []),
+ ].join("\n"),
+ )
+ .join("\n\n");
+ },
+};
+
+const webOpen: CommandDefinition = {
+ command: ["web", "open"],
+ toolName: "web_open",
+ operationId: false,
+ description:
+ "Read one web page as Markdown, from this computer or through a provider.",
+ readOnly: true,
+ usage: [
+ "teamhub web open <url> [--backend direct|tavily|firecrawl|you] [--output <file>]",
+ ],
+ arguments: ["<url> An absolute http or https URL."],
+ options: {
+ "--backend": flag(
+ "direct (default) fetches the page from this computer; tavily, firecrawl or you read it through the provider, which helps with pages that need JavaScript or block plain requests.",
+ ),
+ "--output": flag(
+ "Save the Markdown to this new file instead of printing it; never overwrites.",
+ ),
+ },
+ notes: [
+ "The Markdown is cut at 20,000 characters; truncated says when it was.",
+ ],
+ examples: [
+ "teamhub web open https://www.postgresql.org/about/news/",
+ "teamhub web open https://example.com/report --backend firecrawl --output report.md",
+ ],
+ inputSchema: {
+ type: "object",
+ properties: {
+ url: { type: "string", minLength: 1, maxLength: 2048 },
+ backend: backendSchema(openBackends),
+ output: { type: "string" },
+ },
+ required: ["url"],
+ additionalProperties: false,
+ },
+ outputSchema: pageSchema,
+ normalize: async (args, reader) => {
+ assertPositionals(args, 1);
+ const { webURL } = await import("./web-page.js");
+ const url = args.positionals[0]!.trim();
+ if (!webURL(url))
+ usage("Provide an absolute http or https URL of at most 2048 bytes.");
+ const backend = choice(
+ option(args, "--backend"),
+ openBackends,
+ "--backend",
+ );
+ const output = option(args, "--output");
+ if (output !== undefined && (!output.trim() || output === "-"))
+ usage("--output requires a local file path.");
+ return {
+ input: {
+ url,
+ ...(backend && backend !== "direct" ? { backend } : {}),
+ ...(output !== undefined ? { output: reader.localPath(output) } : {}),
+ },
+ };
+ },
+ execute: async (input, context) => {
+ const output = input.output as string | undefined;
+ const { assertNewOutput, saveConnectorBytes } =
+ await import("./connector-files.js");
+ if (output !== undefined) await assertNewOutput(output, context.cwd);
+ const page = input.backend
+ ? await call(
+ context.client.api.POST("/api/agent/v1/web/open", {
+ body: { url: input.url, backend: input.backend } as never,
+ }),
+ )
+ : await openDirectPage(String(input.url), context);
+ const result: Json = {
+ url: page.url,
+ ...(page.title ? { title: page.title } : {}),
+ truncated: page.truncated === true,
+ };
+ if (output === undefined) return { ...result, markdown: page.markdown };
+ const saved = await saveConnectorBytes(
+ Buffer.from(displayText(page.markdown ?? ""), "utf8"),
+ output,
+ context,
+ );
+ return { ...result, path: saved.path };
+ },
+ render: (result) =>
+ [
+ `URL: ${line(result.url)}`,
+ ...(result.title ? [`Title: ${line(result.title)}`] : []),
+ ...(result.truncated
+ ? ["Truncated: the page is longer than the 20,000 characters shown."]
+ : []),
+ ...(typeof result.path === "string"
+ ? [`Saved: ${line(result.path)}`]
+ : ["", displayText(result.markdown ?? "")]),
+ ].join("\n"),
+};
+async function openDirectPage(
+ url: string,
+ context: CommandExecutionContext,
+): Promise<Json> {
+ const { openDirect } = await import("./web-page.js");
+ return { ...(await openDirect(url, context)) };
+}
+
+const quotaText = (quota: Json | undefined): string => {
+ if (!quota || quota.from === "unavailable") return "";
+ const unit = quota.unit ? ` ${line(quota.unit)}` : "";
+ const amount =
+ typeof quota.remaining === "number"
+ ? typeof quota.limit === "number"
+ ? `${quota.remaining} of ${quota.limit}${unit} left`
+ : `${quota.remaining}${unit} left`
+ : "";
+ return [
+ amount,
+ quota.plan ? `plan ${line(quota.plan)}` : "",
+ quota.resets_at ? `resets ${line(quota.resets_at)}` : "",
+ ]
+ .filter(Boolean)
+ .join(", ");
+};
+const webList: CommandDefinition = {
+ command: ["web", "list"],
+ toolName: "list_web_backends",
+ operationId: false,
+ description:
+ "List the web search backends with what each supports, whether it is ready, and its quota.",
+ readOnly: true,
+ usage: ["teamhub web list [--backend <backend>]"],
+ options: {
+ "--backend": flag(
+ "Show only this backend: tavily, brave, firecrawl, you or direct.",
+ ),
+ },
+ inputSchema: {
+ type: "object",
+ properties: {
+ backend: backendSchema([...keyBackends, "direct"]),
+ },
+ additionalProperties: false,
+ },
+ outputSchema: {
+ 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"],
+ },
+ normalize: async (args) => {
+ assertPositionals(args, 0);
+ const backend = choice(
+ option(args, "--backend"),
+ [...keyBackends, "direct"],
+ "--backend",
+ );
+ return { input: backend ? { backend } : {} };
+ },
+ execute: async (input, context) =>
+ call(
+ context.client.api.POST("/api/agent/v1/web/backends/query", {
+ body: input as never,
+ }),
+ ),
+ render: (result) => {
+ const backends = Array.isArray(result.backends)
+ ? (result.backends as Json[])
+ : [];
+ const rows = backends.map((item) => {
+ const status = line(item.status);
+ const parts = [
+ `${line(item.id).padEnd(10)} ${status.padEnd(13)} ${(item.commands as unknown[]).map(line).join(", ")}`,
+ 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)}` : "",
+ quotaText(item.quota as Json | undefined),
+ status !== "ready" && item.free_tier
+ ? `free tier: ${line(item.free_tier)}`
+ : "",
+ ];
+ return parts.filter(Boolean).join(" | ");
+ });
+ const chosen = result.chosen_default_search ? " (chosen by the user)" : "";
+ return [
+ `Default search: ${line(result.default_search)}${chosen}. Default open: ${line(result.default_open)}.`,
+ ...rows,
+ ...(backends.some((item) => item.status !== "ready")
+ ? [
+ "A backend that is not ready needs an API key: run teamhub web connect <backend> to ask the user for it.",
+ ]
+ : []),
+ ].join("\n");
+ },
+};
+
+const webConnect: CommandDefinition = {
+ command: ["web", "connect"],
+ toolName: "connect_web_backend",
+ operationId: false,
+ description:
+ "Ask the user for a web search backend's API key: posts a key card in this chat unless the backend is already ready.",
+ // Like apps connect it only requests a card; TeamHub reuses a pending one,
+ // so a repeated call needs no receipt.
+ readOnly: true,
+ usage: ["teamhub web connect <tavily|brave|firecrawl|you>"],
+ arguments: ["<backend> tavily, brave, firecrawl or you."],
+ options: {},
+ notes: [
+ "When it posts the card, end your turn. The card's result wakes you when the user adds a key or declines. Never ask for an API key in a message.",
+ ],
+ inputSchema: {
+ type: "object",
+ properties: { backend: backendSchema(keyBackends) },
+ required: ["backend"],
+ additionalProperties: false,
+ },
+ outputSchema: {
+ type: "object",
+ properties: {
+ status: { enum: ["ready", "connection_requested"] },
+ backend: { type: "object" },
+ message_id: { type: "string" },
+ interaction_id: { type: "string" },
+ },
+ required: ["status"],
+ },
+ normalize: async (args) => {
+ assertPositionals(args, 1);
+ return {
+ input: { backend: choice(args.positionals[0], keyBackends, "<backend>") },
+ };
+ },
+ execute: async (input, context) => {
+ const result = await call(
+ context.client.api.POST("/api/agent/v1/web/connect", {
+ body: input as never,
+ }),
+ );
+ if (result.status !== "ready" && result.status !== "connection_requested")
+ throw new CliError(
+ "invalid_response",
+ "TeamHub did not answer the web search key request.",
+ );
+ return result;
+ },
+ render: (result) => {
+ const backend = result.backend as Json | undefined;
+ return result.status === "ready"
+ ? `${nameOf(backend?.id)} is ready. Run your web command again.`
+ : `Key card posted (${line(result.message_id)}). End your turn now; the card's result wakes you when the user adds a key or declines.`;
+ },
+};
+
+export const webCommandDefinitions: readonly CommandDefinition[] = [
+ webSearch,
+ webOpen,
+ webList,
+ webConnect,
+];
diff --git a/apps/teamhub-cli/src/web-page.ts b/apps/teamhub-cli/src/web-page.ts
new file mode 100644
index 00000000..e40b3a50
--- /dev/null
+++ b/apps/teamhub-cli/src/web-page.ts
@@ -0,0 +1,350 @@
+import rehypeParse from "rehype-parse";
+import rehypeRemark from "rehype-remark";
+import remarkGfm from "remark-gfm";
+import remarkStringify from "remark-stringify";
+import { unified } from "unified";
+import type { CommandExecutionContext } from "./command-definition.js";
+import { ConnectorError } from "./errors.js";
+
+/** The same cut TeamHub applies to a page a provider opened. */
+export const maxMarkdownCharacters = 20000;
+const maxTitleCharacters = 300;
+const maxURLBytes = 2048;
+// Pages are read whole before conversion; past this the rest is dropped and
+// the page is reported truncated.
+const maxPageBytes = 5 * 1024 * 1024;
+const fetchTimeoutMs = 30000;
+
+export interface WebPage {
+ url: string;
+ title?: string;
+ markdown: string;
+ truncated: boolean;
+}
+
+interface HastNode {
+ type: string;
+ tagName?: string;
+ value?: string;
+ properties?: Record<string, unknown>;
+ children?: HastNode[];
+}
+
+const alwaysDropped = new Set([
+ "script",
+ "style",
+ "noscript",
+ "template",
+ "svg",
+ "canvas",
+ "iframe",
+ "object",
+ "embed",
+ "form",
+ "button",
+ "input",
+ "select",
+ "textarea",
+ "dialog",
+ "nav",
+ "link",
+ "meta",
+]);
+// Never page text, even inside code.
+const codeDropped = new Set(["script", "style", "template", "noscript"]);
+// Site chrome around the page's text; dropped only when the page marks no
+// main or article element, since an article's own header holds its title.
+const chrome = new Set(["header", "footer", "aside"]);
+// Landmarks and widgets that are never the page's text.
+const droppedRoles = new Set([
+ "navigation",
+ "search",
+ "menu",
+ "menubar",
+ "toolbar",
+ "tablist",
+ "dialog",
+]);
+
+const unreadable = (message: string) =>
+ new ConnectorError("page_unreadable", message);
+
+/** True for an absolute http or https URL within the contract's bound. */
+export function webURL(value: string): boolean {
+ if (!value || Buffer.byteLength(value) > maxURLBytes) return false;
+ try {
+ const url = new URL(value);
+ return url.protocol === "http:" || url.protocol === "https:";
+ } catch {
+ return false;
+ }
+}
+
+/**
+ * Opens a page from this computer, so it reaches what the user's own browser
+ * reaches, and converts HTML to Markdown cut at the same length TeamHub uses.
+ */
+export async function openDirect(
+ url: string,
+ context: Pick<CommandExecutionContext, "fetch">,
+): Promise<WebPage> {
+ let response: Response;
+ try {
+ response = await (context.fetch ?? globalThis.fetch)(url, {
+ redirect: "follow",
+ signal: AbortSignal.timeout(fetchTimeoutMs),
+ headers: {
+ accept:
+ "text/html,application/xhtml+xml,text/plain;q=0.9,text/markdown;q=0.9,*/*;q=0.1",
+ "user-agent": "Mozilla/5.0 (compatible; teamhub-cli)",
+ },
+ });
+ } catch {
+ throw unreadable(
+ "The page could not be reached from this computer. Check the URL, or try a provider backend with --backend (teamhub web list shows the ready ones).",
+ );
+ }
+ if (!response.ok) {
+ await response.body?.cancel().catch(() => undefined);
+ throw unreadable(
+ `The site answered HTTP ${response.status}. Try a provider backend with --backend (teamhub web list shows the ready ones).`,
+ );
+ }
+ const contentType = (response.headers.get("content-type") ?? "")
+ .toLowerCase()
+ .trim();
+ const mediaType = contentType.split(";", 1)[0]!.trim();
+ const html =
+ mediaType === "text/html" || mediaType === "application/xhtml+xml";
+ if (
+ !html &&
+ !mediaType.startsWith("text/") &&
+ mediaType !== "application/json" &&
+ mediaType !== ""
+ ) {
+ await response.body?.cancel().catch(() => undefined);
+ throw unreadable(
+ `The page is ${mediaType}, not HTML or text. Try a provider backend with --backend; some read documents such as PDFs.`,
+ );
+ }
+ const { bytes, cut } = await readPage(response);
+ const text = decode(bytes, contentType, html || mediaType === "");
+ const finalURL = webURL(response.url) ? response.url : url;
+ const page =
+ html || (mediaType === "" && /^\s*<(?:!doctype|html)/iu.test(text))
+ ? await htmlToMarkdown(text, finalURL)
+ : { markdown: text.trim() };
+ if (!page.markdown)
+ throw unreadable(
+ "The page has no readable text; it may need JavaScript. Try a provider backend with --backend.",
+ );
+ const characters = Array.from(page.markdown);
+ return {
+ url: finalURL,
+ ...(page.title ? { title: page.title } : {}),
+ markdown:
+ characters.length > maxMarkdownCharacters
+ ? characters.slice(0, maxMarkdownCharacters).join("")
+ : page.markdown,
+ truncated: cut || characters.length > maxMarkdownCharacters,
+ };
+}
+
+async function readPage(
+ response: Response,
+): Promise<{ bytes: Buffer; cut: boolean }> {
+ if (!response.body) return { bytes: Buffer.alloc(0), cut: false };
+ const reader = response.body.getReader();
+ const chunks: Uint8Array[] = [];
+ let size = 0;
+ try {
+ for (;;) {
+ const next = await reader.read();
+ if (next.done) return { bytes: Buffer.concat(chunks, size), cut: false };
+ const room = maxPageBytes - size;
+ if (next.value.byteLength >= room) {
+ chunks.push(next.value.subarray(0, room));
+ return { bytes: Buffer.concat(chunks, maxPageBytes), cut: true };
+ }
+ chunks.push(next.value);
+ size += next.value.byteLength;
+ }
+ } catch {
+ throw unreadable(
+ "The page stopped loading before it finished. Run the command again, or try a provider backend with --backend.",
+ );
+ } finally {
+ await reader.cancel().catch(() => undefined);
+ reader.releaseLock();
+ }
+}
+
+/** Decodes with the served charset, else an HTML meta charset, else UTF-8. */
+function decode(bytes: Buffer, contentType: string, sniff: boolean): string {
+ let label = /charset\s*=\s*"?([\w.:-]+)/iu.exec(contentType)?.[1];
+ if (!label && sniff)
+ label = /<meta[^>]+charset\s*=\s*["']?([\w.:-]+)/iu.exec(
+ bytes.subarray(0, 4096).toString("latin1"),
+ )?.[1];
+ try {
+ return new TextDecoder(label ?? "utf-8").decode(bytes);
+ } catch {
+ return new TextDecoder("utf-8").decode(bytes);
+ }
+}
+
+/** Converts a page's main content to GitHub-flavored Markdown. */
+export async function htmlToMarkdown(
+ html: string,
+ pageURL: string,
+): Promise<{ title?: string; markdown: string }> {
+ const tree = unified().use(rehypeParse).parse(html) as unknown as HastNode;
+ const title = plainText(textOf(find(tree, "title")))
+ .slice(0, maxTitleCharacters)
+ .trim();
+ // A lone article is the page's text; several are a feed inside main.
+ const articles = findAll(tree, "article");
+ const content =
+ (articles.length === 1 ? articles[0] : undefined) ??
+ find(tree, "main") ??
+ articles[0] ??
+ find(tree, "body") ??
+ tree;
+ prune(content, content.tagName === "body" || content === tree, pageURL);
+ const root = { type: "root", children: [content] };
+ const mdast = await unified()
+ .use(rehypeRemark)
+ .run(root as never);
+ const markdown = unified()
+ .use(remarkGfm, { tablePipeAlign: false })
+ .use(remarkStringify, { bullet: "-", fences: true, rule: "-" })
+ .stringify(mdast);
+ return {
+ ...(title ? { title } : {}),
+ markdown: markdown.replace(/\n{3,}/gu, "\n\n").trim(),
+ };
+}
+
+function find(node: HastNode, tagName: string): HastNode | undefined {
+ if (node.tagName === tagName) return node;
+ for (const child of node.children ?? []) {
+ const found = find(child, tagName);
+ if (found) return found;
+ }
+ return undefined;
+}
+
+function findAll(node: HastNode, tagName: string): HastNode[] {
+ if (node.tagName === tagName) return [node];
+ return (node.children ?? []).flatMap((child) => findAll(child, tagName));
+}
+
+function textOf(node: HastNode | undefined): string {
+ if (!node) return "";
+ if (node.type === "text") return node.value ?? "";
+ return (node.children ?? []).map(textOf).join("");
+}
+
+const plainText = (value: string) => value.replace(/\s+/gu, " ").trim();
+
+const listContainers = new Set(["div", "ul", "ol", "section", "menu"]);
+/**
+ * A block that is almost only links, such as a language picker, table of
+ * contents or site menu inside the main element; it would crowd the page's
+ * text out of the 20,000 characters.
+ */
+function linkList(node: HastNode): boolean {
+ if (!listContainers.has(node.tagName ?? "")) return false;
+ let links = 0;
+ let linkText = 0;
+ const count = (item: HastNode) => {
+ if (item.tagName === "a") {
+ links++;
+ linkText += plainText(textOf(item)).length;
+ return;
+ }
+ item.children?.forEach(count);
+ };
+ count(node);
+ const text = plainText(textOf(node)).length;
+ return links >= 10 && text > 0 && linkText / text >= 0.8;
+}
+
+/**
+ * Drops markup that is not page text and makes link targets absolute. Inside
+ * code every element but scripts and styles keeps its text, since highlighters
+ * wrap identifiers in buttons; a link without a usable target keeps its text.
+ */
+function prune(
+ node: HastNode,
+ dropChrome: boolean,
+ pageURL: string,
+ inCode = false,
+): void {
+ if (!node.children) return;
+ node.children = node.children.flatMap((child): HastNode[] => {
+ if (child.type === "comment" || child.type === "doctype") return [];
+ if (child.type !== "element") return [child];
+ const tag = child.tagName ?? "";
+ const properties = child.properties ?? {};
+ const code = inCode || tag === "pre" || tag === "code";
+ if (
+ (properties.hidden !== undefined && properties.hidden !== false) ||
+ properties.ariaHidden === true ||
+ properties.ariaHidden === "true" ||
+ (dropChrome && chrome.has(tag)) ||
+ (typeof properties.role === "string" &&
+ droppedRoles.has(properties.role)) ||
+ (alwaysDropped.has(tag) && (!code || codeDropped.has(tag))) ||
+ (!code && linkList(child))
+ )
+ return [];
+ if (tag === "table" && !code && layoutTable(child)) toBlocks(child);
+ let unwrap = alwaysDropped.has(tag);
+ for (const name of ["href", "src"] as const) {
+ const value = properties[name];
+ if (typeof value !== "string") continue;
+ const absolute = resolve(value, pageURL);
+ if (absolute) properties[name] = absolute;
+ else if (tag === "img") return [];
+ else unwrap = true;
+ }
+ prune(child, dropChrome, pageURL, code);
+ // An icon link with nothing left to show is only noise.
+ if (tag === "a" && !plainText(textOf(child)) && !find(child, "img"))
+ return [];
+ return unwrap ? (child.children ?? []) : [child];
+ });
+}
+
+// A table holding another table lays the page out; Markdown cannot nest
+// tables, so its cells become plain blocks.
+const layoutTable = (table: HastNode) =>
+ (table.children ?? []).some((child) => find(child, "table") !== undefined);
+const tableParts = new Set([
+ "table",
+ "thead",
+ "tbody",
+ "tfoot",
+ "tr",
+ "td",
+ "th",
+]);
+function toBlocks(node: HastNode): void {
+ node.tagName = "div";
+ for (const child of node.children ?? [])
+ if (child.tagName !== "table" && tableParts.has(child.tagName ?? ""))
+ toBlocks(child);
+}
+
+function resolve(value: string, base: string): string | undefined {
+ if (value.startsWith("#")) return undefined;
+ try {
+ const url = new URL(value, base);
+ return ["http:", "https:", "mailto:"].includes(url.protocol)
+ ? url.href
+ : undefined;
+ } catch {
+ return undefined;
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 542034c5..44bfbf3c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -385,12 +385,21 @@ importers:
openapi-fetch:
specifier: 0.17.0
version: 0.17.0
+ rehype-parse:
+ specifier: 9.0.1
+ version: 9.0.1
+ rehype-remark:
+ specifier: 10.0.1
+ version: 10.0.1
remark-gfm:
specifier: ^4.0.1
version: 4.0.1
remark-parse:
specifier: ^11.0.0
version: 11.0.0
+ remark-stringify:
+ specifier: ^11.0.0
+ version: 11.0.0
tsx:
specifier: 4.22.4
version: 4.22.4
@@ -3848,6 +3857,9 @@ packages:
resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ resolution: {integrity: sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==}
+
resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==}
@@ -4853,12 +4865,51 @@ packages:
resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA==}
+
+ resolution: {integrity: sha512-873p9AuH93gBnATbH8rU3YvjTKxyrIeWd/M9tiLMzn3G82Os0xhQurctfnbYUSrDXoyjbJGpJ2qmTpefMw7ZaQ==}
+
+ resolution: {integrity: sha512-Yq7XlXor0Cpb71sI2E0zpv8QxQ5a6rfhDEETk4bcgrFX2SvJAY2PHocWwFtL6U9qyfiyByW3wZ6sZEfP2kW81g==}
+
+ resolution: {integrity: sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==}
+
+ resolution: {integrity: sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ==}
+
+ resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==}
+
+ resolution: {integrity: sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw==}
+
+ resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==}
+
+ resolution: {integrity: sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ==}
+
+ resolution: {integrity: sha512-HYNDA3qdnzUPitY/LcQm1nWs8z0cWFNH1Nz09jdI/tXifAqF7h3+jrLl4S/b9Mi4VSjn0Dsn54ctuTV6zhBthA==}
+
resolution: {integrity: sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==}
+ resolution: {integrity: sha512-8Qc3IBGvw+tvOCi606vYSvizX89hxW22GEuXnqSGq0m3cXotDaNo6LUEIuCjIL+kmrCaMeBTtu+aiJ71HoyE7Q==}
+
+ resolution: {integrity: sha512-5yrlWOvGFs6CqHriUpSsNrjzT/Tdo+IOQudbznxOn8K5qblp18MJyzOg8IgDOKQ8MYgQcJA7SusuCjSpDr8mSA==}
+
resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}
+ resolution: {integrity: sha512-1ALZXSmCGmW3h8AMz4R4+QKSKFi7sNgXLVwmwB8FYVtl1CwQ3WDkSAEY/d5tp1g/vbQgq2s1WlHgfO3jbw1TsA==}
+
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
@@ -4904,6 +4955,9 @@ packages:
resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}
+ resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
+
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
@@ -5660,9 +5714,6 @@ packages:
'@types/mdast':
optional: true
- resolution: {integrity: sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==}
-
resolution: {integrity: sha512-2Jn/ADrHFFyyniBMi0bncTbJqU78K3/TEYvzvwrWWzD9MYPUa/Gm4r3nOeKFQg/PDM5BsbDYdc8ackW4NTY6NA==}
@@ -6687,6 +6738,15 @@ packages:
resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-Zk0pyQ06A3Lyxhe9vGtOtzz3Z0+qZ5+7icZ/PL/2x1SHPbKao5oB/g/rlc6BCTajqBb33JcOe71Ye1oFsuYbnw==}
+
+ resolution: {integrity: sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==}
+
+ resolution: {integrity: sha512-EmDndlb5NVwXGfUa4c9GPK+lXeItTilLhE6ADSaQuHr4JUlKw9MidzGzx4HpqZrNCt6vnHmEifXQiiA+CEnjYQ==}
+
resolution: {integrity: sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ==}
@@ -7198,6 +7258,9 @@ packages:
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
+ resolution: {integrity: sha512-5UR5Biq4VlVOtzqkm2AZlgvSlDJtME46uV0br0gENbwN4l5+mMKT4b9gJKqWtuL2zAIqajGJGuvbCbcAJUZqBg==}
+
resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==}
@@ -7408,6 +7471,9 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
+ resolution: {integrity: sha512-vEvxatYZCIpNvzGk2UD+u4I/sZkSKoOsdRCbkOIsN73QpJbriJ1qvvBAL1PeI0y55Leoqf7pORbaSPpG/smmOg==}
+
resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}
@@ -7527,6 +7593,9 @@ packages:
resolution: {integrity: sha512-zonE+xlIIYtxPy++L24ow0hAD8CICb4+FgPyROd3buyXIqsJvUEDkBgfCCoXOd1Hu3DUr0GOfnPIdcGV+YpNaA==}
+ resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
+
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
engines: {node: '>= 8'}
@@ -11080,6 +11149,8 @@ snapshots:
dependencies:
convert-to-spaces: 2.0.1
+
@@ -12229,6 +12300,77 @@ snapshots:
dependencies:
function-bind: 1.1.2
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-is-element: 3.0.0
+
+ dependencies:
+ '@types/hast': 3.0.4
+ devlop: 1.1.0
+ hast-util-from-parse5: 8.0.4
+ parse5: 8.0.1
+ vfile: 6.0.3
+ vfile-message: 4.0.3
+
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/unist': 3.0.3
+ devlop: 1.1.0
+ hastscript: 9.0.3
+ property-information: 7.2.0
+ vfile: 6.0.3
+ vfile-location: 5.0.4
+ web-namespaces: 2.0.1
+
+ dependencies:
+ '@types/hast': 3.0.4
+
+ dependencies:
+ '@types/hast': 3.0.4
+
+ dependencies:
+ '@types/hast': 3.0.4
+
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-embedded: 3.0.0
+ hast-util-is-element: 3.0.0
+ hast-util-whitespace: 3.0.0
+ unist-util-is: 6.0.1
+
+ dependencies:
+ '@types/hast': 3.0.4
+
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-embedded: 3.0.0
+ hast-util-has-property: 3.0.0
+ hast-util-is-body-ok-link: 3.0.1
+ hast-util-is-element: 3.0.0
+
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/unist': 3.0.3
+ ccount: 2.0.1
+ comma-separated-tokens: 2.0.3
+ hast-util-whitespace: 3.0.0
+ html-void-elements: 3.0.0
+ mdast-util-to-hast: 13.2.1
+ property-information: 7.2.0
+ space-separated-tokens: 2.0.2
+ stringify-entities: 4.0.4
+ zwitch: 2.0.4
+
dependencies:
'@types/estree': 1.0.9
@@ -12249,10 +12391,40 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/mdast': 4.0.4
+ '@ungap/structured-clone': 1.3.3
+ collapse-white-space: 2.1.0
+ hast-util-phrasing: 3.0.1
+ hast-util-to-html: 9.0.7
+ hast-util-to-text: 4.0.3
+ hast-util-whitespace: 3.0.0
+ mdast-util-phrasing: 4.1.0
+ mdast-util-to-hast: 13.2.1
+ mdast-util-to-string: 4.0.0
+ rehype-minify-whitespace: 6.0.2
+ trim-trailing-lines: 2.1.0
+ unist-util-position: 5.0.0
+ unist-util-visit: 5.1.0
+
+ dependencies:
+ '@types/hast': 3.0.4
+
dependencies:
'@types/hast': 3.0.4
+ dependencies:
+ '@types/hast': 3.0.4
+ comma-separated-tokens: 2.0.3
+ hast-util-parse-selector: 4.0.0
+ property-information: 7.2.0
+ space-separated-tokens: 2.0.2
+
@@ -12293,6 +12465,8 @@ snapshots:
+
dependencies:
domelementtype: 2.3.0
@@ -13078,7 +13252,7 @@ snapshots:
'@types/mdast': 4.0.4
devlop: 1.1.0
mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
+ mdast-util-to-markdown: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13091,7 +13265,7 @@ snapshots:
ccount: 2.0.1
devlop: 1.1.0
mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
+ mdast-util-to-markdown: 2.2.0
parse-entities: 4.0.2
stringify-entities: 4.0.4
unist-util-stringify-position: 4.0.0
@@ -13106,7 +13280,7 @@ snapshots:
'@types/mdast': 4.0.4
devlop: 1.1.0
mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
+ mdast-util-to-markdown: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13144,18 +13318,6 @@ snapshots:
transitivePeerDependencies:
- micromark-util-types
- dependencies:
- '@types/mdast': 4.0.4
- '@types/unist': 3.0.3
- longest-streak: 3.1.0
- mdast-util-phrasing: 4.1.0
- mdast-util-to-string: 4.0.0
- micromark-util-classify-character: 2.0.1
- micromark-util-decode-string: 2.0.1
- unist-util-visit: 5.1.0
- zwitch: 2.0.4
-
dependencies:
'@types/mdast': 4.0.4
@@ -14414,6 +14576,25 @@ snapshots:
gopd: 1.2.0
set-function-name: 2.0.2
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-minify-whitespace: 1.0.1
+
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-from-html: 2.1.0
+ unified: 11.0.5
+
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/mdast': 4.0.4
+ hast-util-to-mdast: 10.1.3
+ unified: 11.0.5
+ vfile: 6.0.3
+
dependencies:
'@types/mdast': 4.0.4
@@ -14462,7 +14643,7 @@ snapshots:
dependencies:
'@types/mdast': 4.0.4
- mdast-util-to-markdown: 2.1.2
+ mdast-util-to-markdown: 2.2.0
unified: 11.0.5
@@ -15048,6 +15229,8 @@ snapshots:
+
@@ -15253,6 +15436,11 @@ snapshots:
+ dependencies:
+ '@types/unist': 3.0.3
+ vfile: 6.0.3
+
dependencies:
'@types/unist': 3.0.3
@@ -15343,6 +15531,8 @@ snapshots:
+