2 Commits
Author SHA1 Message Date
nanobot aabad78df9 fix(deploy): bypass proxy in health checks
Test Suite / Detect changes (push) Canceled after 0s
Test Suite / webui (push) Canceled after 0s
Test Suite / Terminal UI (Windows) (push) Canceled after 0s
Test Suite / Terminal UI (push) Canceled after 0s
Test Suite / docker (push) Canceled after 0s
Test Suite / Python (Windows, 3.14) (push) Canceled after 0s
Test Suite / Python (minimum, 3.11) (push) Canceled after 0s
Test Suite / Python (latest, 3.14 + coverage) (push) Canceled after 0s
Loopback health checks inherited http_proxy from /etc/environment and
were routed through v2rayA, failing spuriously (2026-08-28 incident).
2026-09-03 09:30:02 +08:00
nanobot 4176122d26 feat: add deploy/rollback supervisor script
Git-checkout-based deployment with health checks and automatic rollback.
Usage: deploy.sh <commit> | deploy.sh rollback | deploy.sh status
2026-09-03 09:30:02 +08:00
2428 changed files with 94650 additions and 337020 deletions

No files matched your search

-37
View File
@@ -1,37 +0,0 @@
# Writing interface copy
Read this when writing or revising user-facing labels, descriptions, buttons, hints, errors, or localized strings. Follow the task's explicit scope and language requirements.
## Keep copy work within scope
A request to rewrite existing copy authorizes replacing existing string values. It does not authorize new locale keys, new explanations, exposing previously hidden help, or changing components, styles, layout, accessibility behavior, or runtime behavior. Keep those changes out of a copy-only PR unless separately requested.
Read the owning code and nearby copy before renaming a feature. Preserve what the feature does, when it applies, and the consequences of the action. Ask about unresolved meaning before changing the affected copy; continue with independently understood strings.
## Make the next action clear
Use [Steve Krug's *Don't Make Me Think* principles](https://ptgmedia.pearsoncmg.com/imprint_downloads/peachpit/peachpit/promo/Dont_Make_Me_Tipsheet.pdf): people scan interfaces, so a label should make its purpose evident without a tutorial. Prefer familiar words, concrete nouns for features, and verbs that name the action for buttons.
Apply [Robin Williams's *The Non-Designer's Design Book* principles](https://www.peachpit.com/content/images/9780133966152/samplepages/9780133966152.pdf) to wording: repeat the same name for the same concept, use parallel phrasing for equivalent controls, keep related explanations together, and distinguish names, summaries, and detailed rules. These principles guide copy decisions; they do not expand permission to redesign the UI.
- Keep the established product voice calm and direct. Remove filler, internal implementation language, and clever expressions that obscure the action.
- Preserve familiar technical terms and product names such as API, MCP, SSH, OAuth, and model names. Do not invent translations just to shorten them.
- For Chinese, target 2–4 character feature names and introductory descriptions of at most 20 characters. Preserve technical names and necessary units even when they exceed the name target. Use natural, concise phrasing in other languages rather than applying Chinese character limits.
- Shortening must preserve conditions, limits, defaults, units, permission boundaries, and destructive consequences. A short label must not imply broader capabilities or weaker restrictions.
- Keep existing detailed rules in their existing description or help strings. When the task permits separating them, use those existing locations or a separate column in the review table; do not add UI or duplicate the original description merely to achieve a short summary.
- Match visible labels, tooltips, confirmations, and accessible names where they describe the same action. Errors should state a supported recovery step; do not invent actions the product cannot perform.
## Complete localization together
Unless the task explicitly limits languages, review every supported locale for each changed copy key in the same change. Keep already-clear translations when appropriate; do not use English fallback as a substitute for completing the localized copy.
For WebUI, use [`supportedLocales`](../webui/src/i18n/config.ts) as the locale inventory. Check both `webui/src/i18n/locales/<locale>/common.json` and channel-owned `nanobot/channels/<channel>/webui/locales/<locale>.json`; common bundles do not contain all interface text. Inspect the owning client for other copy surfaces.
Preserve locale keys, interpolation variables and their occurrences, formatting tokens, configuration values, command identifiers, and preset prompts. Prompts that are sent to the model affect behavior and are not ordinary interface copy. Keep intentionally localized display names and existing optional-key conventions.
## Verify the final change
- Review an original-copy → new-copy table. List existing detailed rules separately when useful, and identify any unresolved meaning instead of guessing.
- Compare against the PR base: a copy-only change should contain existing string replacements and necessary updates to existing test selectors or copy assertions. Confirm that no locale keys or UI behavior were added or removed.
- Check the supported locale inventory, key structure, interpolation occurrences, and preserved prompts. Review semantics as well as structural parity.
- Update tests that look for changed labels without weakening their behavior assertions or changing unrelated fixture text. Run the relevant existing localization and interface tests, lint, and build checks for the affected surface. Follow [test selection guidance](simplify.md) and [verification evidence guidance](workflow.md); do not add tests solely to prove that words changed.
+14 -18
View File
@@ -1,41 +1,37 @@
# Design Constraints
Consult this document when changing ownership boundaries, extension points, abstractions, or dynamic types. These constraints apply to implementation choices on those paths.
These rules govern architectural decisions. When adding a feature or fixing a bug, prefer paths that respect these boundaries.
## Core stays small; extend at the edges
New capabilities should be added via `channels/`, `tools/`, skills, or MCP servers. The files `agent/loop.py` and `agent/runner.py` form the critical core path; changes there should be minimal and justified. If a feature can live in a channel adapter, a tool, or an external MCP server, it should not be inlined into the agent loop.
Runtime state fan-out follows the same boundary. `MessageBus.publish` awaits local subscribers for turn/run/model/goal state changes; `MessageBus.publish_event` queues routed channel delivery without waiting for network sends. Both carry `AgentEvent` values. Runner hooks publish typed output through the turn's scoped `EventSink`; direct-call callbacks are adapted at the execution boundary. WebUI/WebSocket wire details, title refreshes, and goal-state sync belong in `nanobot.session.webui_turns.WebuiTurnCoordinator` or the relevant channel adapter. `nanobot.webui.outbound_delivery.WebUIOutboundDelivery` owns WebUI outbound projection, stream buffers, transcript policy and delivery-turn completion; the WebSocket transport only snapshots recipients and queues its public frames, retaining connection ordering, backpressure and drain accounting.
Runtime state fan-out follows the same boundary. `AgentLoop` may publish generic runtime events from `nanobot.bus.runtime_events` for turn/run/model/goal state changes, but WebUI/WebSocket wire details such as `_turn_end`, `_goal_status`, title refreshes, and goal-state sync belong in `nanobot.session.webui_turns.WebuiTurnCoordinator` or the relevant channel adapter.
Tools and channels own their configuration, metadata, and activation behavior. Tool configuration models live beside their implementations in `agent/tools/*_config.py`; channel descriptors and configuration stay in their channel packages. The root schema in `config/schema.py` assembles these contracts without importing their runtime implementations. Tool classes expose their configuration through `config_key` and `config_cls()`.
## Less structure, more intelligence
Generic recovery checkpoints belong in `session/recovery.py`; WebUI recovery and turn coordination belong in `webui/recovery.py` and `session/webui_turns.py`. Gateway startup supplies WebUI turn policy. Channels own the pure address contract in `channels/notification_routes.py`, which core turn delivery consumes for default replies and durable notifications without loading channel runtime implementations.
## Executable import boundaries
Core execution, session storage, and security primitives stay independent of API, channel, CLI, and WebUI adapter implementations. Core may consume channel-owned pure address contracts, which must stay independent of runtime implementations. Shared client contracts stay independent of UI implementations, and client initialization dependencies must be acyclic.
Python rules live in [scripts/check_import_boundaries.py](../scripts/check_import_boundaries.py); run `python -m scripts.check_import_boundaries` from the repository root. Client rules live in [scripts/check_client_import_boundaries.mjs](../scripts/check_client_import_boundaries.mjs); run `bun run check:imports` and `bun run test:imports` from `webui/` or `tui/` for that project. These scripts are the source of truth for checked modules, dependency rules, and exceptions.
The checks cover selected direct imports and client initialization dependencies. They do not establish a complete runtime dependency graph; execution, state ownership, and security contracts still require behavioral verification.
## Keep a change locally understandable
Group code by the behavior it owns, not a target file length. A useful extraction owns its state, subscriptions, and cleanup behind a narrow typed interface; moving helpers while exposing the original component's entire state does not create a boundary. Keep collaborating logic together when separating it would require more context to understand the same change. Preserve cross-owner tests and point task navigation at the new owner when one moves.
Prefer simple, readable code over new framework layers and indirection. Add structure only when it removes real complexity, protects an important boundary, or matches an established local pattern. The best fix is often a smaller prompt, a tighter tool contract, a channel-local change, or one focused regression test.
## Prefer duplication over premature abstraction
Channels and providers are allowed to repeat similar logic (send retries, media handling, message splitting). Do not introduce complex base classes or shared helpers just to eliminate duplication across channel files. Each channel file should remain self-contained and readable on its own. The same applies to provider implementations.
## Minimal change that solves the real problem
Fix bugs by changing only what is necessary. Do not bundle unrelated refactors or clean-ups into a feature or bugfix PR. If a refactor is genuinely required, it should be a separate, clearly scoped PR.
## Keep PRs reviewable
A bugfix should make the protected invariant clear, change the smallest surface that enforces it, and add only the closest regression test. If a diff starts changing ownership boundaries or mixing behavior changes with clean-up, split it before it becomes hard to review.
## Type dynamic boundaries at the edge
Wire payloads, persisted records, and third-party SDK objects are untrusted dynamic boundaries. Prefer a parser or small normalizer at the owning edge, and use `TypedDict` for stable dictionary shapes, so validation happens once and internal code receives a concrete type. Do not spread raw dynamic dictionaries or SDK objects through the core.
Stable first-party dependencies must be typed where they are stored or passed. Do not declare an internal service, context field, or callback result as `Any` and then recover its real type with consumer-side casts. Use the concrete type or a narrow `Protocol`; reserve `Any` for genuinely dynamic boundaries.
Every new cast must be supported by a boundary check or an invariant established by construction and control flow. Do not add redundant checks inside a validated path or use `cast` only to silence BasedPyright.
`typing.cast` performs no runtime validation. Every new cast must be supported by a runtime check on the same path or by an explicit invariant that is clear from construction and control flow (and documented locally when it is not obvious). If input can violate the claimed type, handle that invalid case before casting; never use `cast` only to silence BasedPyright.
## Explicit over magical
Provider auto-detection must remain traceable from the factory to the concrete provider class.
Configuration must be declared explicitly in `config/schema.py` Pydantic models. Error handling should raise clear exceptions rather than silently correcting bad input. Provider auto-detection exists, but every resolution path must be traceable from the factory to the concrete provider class.
+14 -18
View File
@@ -1,33 +1,31 @@
# Common Gotchas
## Channel dependencies for strict type checking
## Do not use `ruff format`
Channel dependencies come from channel package manifests, outside the main extras. Reproduce CI's setup with `uv sync --all-extras --dev`, then `uv run --no-sync python -m scripts.install_channel_dependencies --all-channels`. Keep `--no-sync` on subsequent `uv run` commands so syncing does not remove those dependencies. See `.github/workflows/ci.yml` for checks.
## Channel-owned UI and WebUI transport
Channels can own frontend code in `nanobot/channels/*/webui/` and tests in `nanobot/channels/*/tests/`, including `tests/webui/`. The WebUI's lint and test configurations include those frontend paths. Do not assume all channel tests live under the root `tests/` or all frontend code lives under `webui/`.
Vite proxies `/api`, `/webui`, and `/auth`; the application's WebSocket connects directly to the gateway. `NANOBOT_API_URL` sets the HTTP proxy target, whose default is `http://127.0.0.1:8765`. See `webui/vite.config.ts`.
`CONTRIBUTING.md` mentions `ruff format`, but **do not run it** — it destroys git blame history. Only `ruff check` should be used.
## Config `${VAR}` References
`nanobot/config/loader.py` loads and validates the config; `resolve_config_env_vars` resolves `${VAR}` references before runtime use. This is not shell-like default-value syntax. Missing referenced variables raise `ConfigLoadError` with field locations; invalid existing config files also raise `ConfigLoadError`. Defaults are created when the config file is absent, not as recovery from an invalid file.
`config/loader.py` resolves `${VAR}` patterns in `config.json` at load time. This is **not** a shell-like default-value syntax. If the environment variable is missing, `load_config` raises `ValueError` and the agent falls back to default configuration.
Example valid usage:
```json
{ "providers": { "openrouter": { "apiKey": "${OPENROUTER_KEY}" } } }
```
## Windows Compatibility
nanobot explicitly supports Windows. Key differences to keep in mind:
- `ExecTool` defaults to PowerShell on Windows (`pwsh` when available, otherwise Windows PowerShell); pass `shell="cmd"` for cmd.exe syntax or cmd built-ins (`shell.py`).
- `nanobot/cli/entry.py` configures Windows console output as UTF-8 before dispatch to handle emoji and multilingual input.
- `cli/commands.py` forces `sys.stdout`/`stderr` to UTF-8 on startup to handle emoji and multilingual input.
- MCP stdio server commands are normalized for Windows path separators (`mcp.py`).
- Always use `pathlib.Path` for path manipulation; do not assume `/` separators.
## Prompt Templates
Agent system prompts and scenario-specific instructions live in `nanobot/templates/`, including `agent/identity.md` and `agent/platform_policy.md`; workspace defaults include `AGENTS.md`, `HEARTBEAT.md`, and `SOUL.md`. Prompt rendering is handled by `nanobot/utils/prompt_templates.py`. Changing these files alters agent behavior as directly as changing Python code.
Agent system prompts and scenario-specific instructions live in `nanobot/templates/` as Jinja2 markdown files (`identity.md`, `platform_policy.md`, `HEARTBEAT.md`, `SOUL.md`, etc.). Changing these files alters agent behavior as directly as changing Python code. They are loaded by `utils/prompt_templates.py`.
The repository's root `AGENTS.md` guides coding agents; `nanobot/templates/AGENTS.md` is a default for nanobot workspaces. `nanobot/agent/context.py` loads project `AGENTS.md` and global `SOUL.md`/`USER.md`, skipping unchanged bundled `AGENTS.md` and `USER.md` defaults. It does not implement Codex's ancestor-directory instruction chain.
Tool descriptions, skills, and replayed session history also shape model behavior. Treat changes to those surfaces like runtime code: keep them focused, verify the affected contract, and avoid teaching the model to repeat internal markers, local paths, or tool-call text. Add a regression test when it proves a reachable failure that existing coverage does not address.
Tool descriptions, skills, and replayed session history also shape model behavior. Treat changes to those surfaces like runtime code: keep them narrow, add a focused regression test when possible, and avoid teaching the model to repeat internal markers, local paths, or tool-call text.
## Context Pollution Persists
@@ -37,8 +35,6 @@ Anything written into memory, session history, or prompt inputs can be replayed
Built-in skills live in `nanobot/skills/` (markdown + YAML frontmatter format). Agent capabilities that are "know-how" rather than code should be added as skills, not hardcoded into the agent loop. External skills can be published to and installed from ClawHub.
## Persistence and durability
## Atomic Session Writes
`nanobot/agent/memory.py` owns the memory journal `memory/history.jsonl`; ordinary entries are appended under a lock, without explicit fsync. Full journal rewrites use `atomic_write_lines` with its default file and directory fsync. Preserve that atomic replacement path rather than truncating the live journal in place.
Conversation history is stored in `sessions.sqlite3`. `SessionState` (`nanobot/session/state.py`) owns runtime access; `SqliteSessionStore` (`nanobot/session/sqlite_store.py`) commits changes in SQLite transactions using WAL and `PRAGMA synchronous = FULL` on every connection. `SessionManager.save()` is for offline administrative snapshots and has no per-save fsync option. Keep runtime mutations behind the async owner and preserve transaction boundaries and stale-generation checks.
`agent/memory.py` writes `history.jsonl` atomically (temp file + fsync + rename + directory fsync). This guarantees durability across crashes. Do not replace this with a plain `open(..., "w")` write.
-36
View File
@@ -1,36 +0,0 @@
# Find the owning code
Choose the affected behavior below, then read its owner and existing tests. Follow only the relevant links; this is a task index, not a required reading list. Search the selected area for the user-visible operation before expanding to callers and shared contracts.
| Change | Start here | Existing coverage |
| --- | --- | --- |
| Browser input, pairing, navigation, history, or settings | [WebUI change map](../webui/README.md#change-a-behavior) | The map pairs each behavior with component and browser tests |
| Terminal input, menus, or rendering | [TUI source layout](../tui/README.md#source-layout) | Colocated tests; application interactions in [`tui/src/app/`](../tui/src/app/) |
| A chat channel or its setup UI | [Channel package guide](../docs/channel-package-guide.md), then its package in [`nanobot/channels/`](../nanobot/channels/) | The channel's own `tests/`, including `tests/webui/`; shared contracts in [`tests/channels/`](../tests/channels/) |
| Provider selection or model requests | [Provider extension guide](../docs/development.md#adding-an-llm-provider), [`providers/routing.py`](../nanobot/providers/routing.py), then the selected adapter | [`tests/providers/`](../tests/providers/) |
| A tool's arguments or execution | The implementation and adjacent configuration in [`agent/tools/`](../nanobot/agent/tools/); [`base.py`](../nanobot/agent/tools/base.py) for the shared contract | [`tests/tools/`](../tests/tools/); runtime/session tools in [`tests/agent/tools/`](../tests/agent/tools/) |
| Shell process launch or cleanup | [`execution/processes.py`](../nanobot/execution/processes.py) owns native process trees; [`agent/tools/exec_session.py`](../nanobot/agent/tools/exec_session.py) owns session state and output | [`test_exec_platform.py`](../tests/tools/test_exec_platform.py), [`test_shell_reap.py`](../tests/tools/test_shell_reap.py), [`test_shell_execution_budgets.py`](../tests/tools/test_shell_execution_budgets.py) |
| Outbound HTTP redirects for fetched content | [`execution/http.py`](../nanobot/execution/http.py) owns the GET and response lifetime; [`security/network.py`](../nanobot/security/network.py) owns URL policy and DNS validation | [`test_web_fetch_security.py`](../tests/tools/test_web_fetch_security.py), [`test_image_generation_security.py`](../tests/providers/test_image_generation_security.py) |
| Slash commands or command dispatch | [`command/router.py`](../nanobot/command/router.py), [`command/builtin.py`](../nanobot/command/builtin.py) | [`tests/command/`](../tests/command/) |
| Turn scheduling, cancellation, or delivery | [`agent/loop.py`](../nanobot/agent/loop.py), [`agent/turn_delivery.py`](../nanobot/agent/turn_delivery.py) | [`test_loop_concurrency.py`](../tests/agent/test_loop_concurrency.py), [`test_task_cancel.py`](../tests/agent/test_task_cancel.py), [`test_turn_delivery.py`](../tests/agent/test_turn_delivery.py) |
| Model/tool iterations, retry, or injected input | [`agent/runner.py`](../nanobot/agent/runner.py); [`agent/pending_inputs.py`](../nanobot/agent/pending_inputs.py) owns run-local input batches and terminal waits, while `AgentLoop` prepares each input | [`test_runner_core.py`](../tests/agent/test_runner_core.py), [`test_runner_fallback.py`](../tests/agent/test_runner_fallback.py), [`test_runner_injections.py`](../tests/agent/test_runner_injections.py) |
| Prompt assembly, skills, or context limits | [`agent/context.py`](../nanobot/agent/context.py), [`agent/context_governance.py`](../nanobot/agent/context_governance.py); [prompt cautions](gotchas.md#prompt-templates) | [`test_context_builder.py`](../tests/agent/test_context_builder.py), [`test_skills_loader.py`](../tests/agent/test_skills_loader.py), [`test_context_governance.py`](../tests/agent/test_context_governance.py) |
| Session persistence or recovery | [`session/state.py`](../nanobot/session/state.py), [`session/sqlite_store.py`](../nanobot/session/sqlite_store.py), [`session/recovery.py`](../nanobot/session/recovery.py) | [`tests/session/`](../tests/session/), [`test_loop_recovery.py`](../tests/agent/test_loop_recovery.py) |
| WebUI/TUI wire events or displayed history | [`webui/outbound_delivery.py`](../nanobot/webui/outbound_delivery.py), [`webui/transcript.py`](../nanobot/webui/transcript.py); [client compatibility](review-guide.md) | [`tests/webui/`](../tests/webui/), [`WebSocket tests`](../nanobot/channels/websocket/tests/), and affected client tests |
| Workspace access or sandbox enforcement | [`security/workspace_access.py`](../nanobot/security/workspace_access.py), [`execution/files.py`](../nanobot/execution/files.py), [`execution/sandbox.py`](../nanobot/execution/sandbox.py); [security rules](security.md) | [`tests/security/`](../tests/security/), [`test_workspace_scope.py`](../tests/agent/test_workspace_scope.py), [`test_sandbox.py`](../tests/tools/test_sandbox.py) |
| Gateway startup, shutdown, or launchers | [`gateway/`](../nanobot/gateway/), [`cli/gateway_runtime.py`](../nanobot/cli/gateway_runtime.py) | [`tests/gateway/`](../tests/gateway/), the matching launcher tests in [`tests/cli/`](../tests/cli/) |
For the end-to-end runtime flow, expand to [Architecture](../docs/architecture.md). For ownership changes, read [Design Constraints](design.md); directory proximity does not permit crossing those boundaries.
## Find the smallest useful check
Start with an existing test that exercises the changed operation and its relevant failure or lifecycle edge. File names above are entry points, not an exhaustive acceptance list. Keep integration coverage when the change crosses owners.
| Surface | Focused command | Setup and full checks |
| --- | --- | --- |
| Python | From the root: `uv run --no-sync python -m pytest tests/path/test_feature.py` | [Contribution setup](../CONTRIBUTING.md#development-setup), including channel dependencies for strict checking |
| WebUI | From `webui/`: `bun run test src/tests/feature.test.tsx` | [WebUI checks](../webui/README.md#test); channel UI tests are included by the same configuration |
| Browser | From `webui/`: `bun run test:browser browser/feature.spec.ts` | [WebUI checks](../webui/README.md#test) and the existing fixture for the affected interaction |
| TUI | From `tui/`: `bun test src/feature/feature.test.ts` | [TUI checks](../tui/README.md); terminal behavior still needs its real terminal path |
The command paths in this table are placeholders: substitute the selected existing file. Respect the task's local/remote verification boundary. Focused checks shorten feedback; they do not replace the required CI checks selected by [the workflow](../.github/workflows/ci.yml) and [its path rules](../scripts/ci_scope.py).
-35
View File
@@ -1,35 +0,0 @@
# Review guide: WebUI clients and hosts
Apply this checklist to changes to WebUI HTTP, WebSocket events/mutations, bootstrap, capabilities, host switching, and persisted browser state. Read this alongside the design and security constraints, not instead of them.
## Compatibility and deployment
- WebUI/gateway support and test coverage are limited to same-version combinations, including remote hosts. Cross-version combinations may work but have no compatibility guarantee, even when protocol checks pass. Align versions first when troubleshooting; do not reject connections solely because package versions differ.
- The local installation owns executable WebUI assets. A remote host supplies authenticated data, events, and media, never replacement JavaScript or CSS.
- Declare the WebUI protocol in `webui/client_contract.py`. The pre-existing terminal `protocolVersion` is a separate contract; do not overload it.
- Use named capabilities for optional features and gate their controls and requests at their owning interface. Do not add compatibility fallbacks or negotiation solely to support older gateways.
- Missing/malformed metadata means **compatibility unconfirmed**, not “old server,” “bad SSH key,” or “network error.” A matching package version alone does not validate the contract. An unconfirmed core contract cannot authorize mutations.
- A package update being available is not proof of incompatibility. Optional update notices must use verified release data, be dismissible, and never interrupt an otherwise compatible session.
## Required proof for a changed contract
- Verify the current client with a same-version host. Cross-version compatibility fixtures or fallback behavior are not required.
- For changes to contract validation, test unknown, missing, malformed and future metadata; overlapping and disjoint protocol ranges; unknown optional capabilities; and missing required capability.
- Assert the actual public bootstrap/read/mutation/event behavior, not only a version-comparison helper.
- Reconnect after a host restart or upgrade. Previously issued credentials and stale cached compatibility must not bypass a changed host contract.
- Prove local HTML/JS/CSS are used even when remote static files are missing or different. Missing local assets fail locally, never fall back to remote code.
- HTTP reads, streamed messages, upload/download, cancellation, multiple tabs, and a response arriving after switching hosts remain scoped to their host.
- Preserve drafts/preferences without mixing authentication, model choices, conversation history, file paths, or command execution across host origins.
## Update UX and operator safety
- Report the local version, host version (or “not reported”), compatibility, and which machine needs updating without presenting a passing protocol check as a guarantee of cross-version functionality.
- Show missing optional capabilities at the affected control. Block unsupported core sessions or operations.
- Reuse the application's settings rows, menus and dialogs. Do not introduce a second settings drawer or a persistent global warning for an optional update.
- Explain that updating this computer does not update its hosts. Use the installation environment that owns the running process: installer/uv/pipx/pip, checkout, container, and service-managed deployments are not interchangeable.
- Never silently install, restart, downgrade, revoke credentials, or reset configuration. Back up configuration/data and consider active tasks before an explicitly requested update. Verify the running process after restart, not merely whichever `nanobot` executable happens to be on PATH.
- Update user documentation with the change. Do not present planned support or fixture-only tests as a completed real-server acceptance test.
## Current baseline
WebUI protocol **1** with capability **`webui.core.v1`** is the initial explicit client/host contract. It covers the existing authenticated WebUI read, mutation, event, and media interfaces. Hosts predating this declaration are unconfirmed; local-client mode requires a gateway that declares a supported protocol and the required capabilities. Their independent server WebUI remains a separate way to use that installation. This is an intentional prerequisite for local-client mode, not a blanket claim that legacy nanobot installations no longer function.
+6 -6
View File
@@ -1,22 +1,22 @@
# Security Boundaries
Consult this document when changing path access, outbound HTTP/MCP, or shell execution. The agent operates with filesystem, shell, and network access; preserve the guards below on every affected path.
The agent operates with significant power (file system, shell, web). The following guards must not be bypassed when modifying related code.
## Workspace Restriction
Filesystem tools and native file search use scoped operations in `nanobot/execution/files.py`. Those operations apply `nanobot/security/workspace_policy.py` to the effective request workspace before opening a file, listing a directory, or writing a patch. Edit activity snapshots use the same authorized write target, not a path from tool arguments. The media upload directory is an internal extra read root while restricted. These are application-level checks, not OS confinement against a process that can concurrently replace ancestor directories.
Filesystem tools (`read_file`, `write_file`, `edit_file`, `list_dir`, `apply_patch`) resolve paths through the workspace path resolver (`agent/tools/filesystem.py` / `agent/tools/path_utils.py`), which enforces that the resolved path must lie under the active workspace when workspace restriction is enabled. The media upload directory is always an internal extra read root while restricted.
Additional filesystem roots must be capability-specific. `extra_allowed_dirs` is a legacy read-only alias. Use `extra_read_allowed_dirs` for read-only roots, `extra_write_allowed_dirs` only when a write-capable tool is intentionally allowed to modify an extra directory, and exact file allowlists when a tool may modify only specific files.
Shell execution (`ExecTool`, `agent/tools/shell.py`) also respects `restrict_to_workspace` as an application-level guard: if enabled and `working_dir` is outside the workspace, the command is rejected before execution, and command text is checked for obvious workspace escapes. This is not process-level isolation; use an exec sandbox backend for that.
**Rule**: File tool adapters should request a scoped file operation; do not add direct path authorization or filesystem effects in those adapters. When traversing a directory, authorize discovered file targets before reading them. Subprocess-backed search follows the shell rules below.
**Rule**: Any new path-handling logic must go through the workspace path resolver or perform an equivalent containment check with explicit read/write capability semantics.
## SSRF Protection
All outbound HTTP requests from agent tools must pass through the shared URL guards in `security/network.py` (`validate_url_target` or `resolve_url_target`). By default they block loopback, RFC1918 private addresses, CGNAT ranges, link-local ranges, and cloud metadata endpoints (including `169.254.169.254`).
For direct requests, the only escape hatch is `configure_ssrf_whitelist(cidrs)`, which reads from `config.tools.ssrf_whitelist` at load time. The shared `network.proxy` address enabled by `providers.<name>.useProxy` is a separate user-authorized trust boundary for provider requests and provider-returned image URL downloads. Those downloads still reject malformed URLs and locally identifiable private/internal targets on every redirect, but hostnames unavailable to local DNS are delegated to the trusted proxy. The user-selected proxy owns final DNS resolution and network egress policy.
For direct requests, the only escape hatch is `configure_ssrf_whitelist(cidrs)`, which reads from `config.tools.ssrf_whitelist` at load time. An explicitly configured `providers.<name>.proxy` is a separate user-authorized trust boundary for provider requests and provider-returned image URL downloads. Those downloads still reject malformed URLs and locally identifiable private/internal targets on every redirect, but hostnames unavailable to local DNS are delegated to the trusted proxy. The user-selected proxy owns final DNS resolution and network egress policy.
HTTP/SSE MCP transports are part of this boundary: validate configured MCP URLs before probing or constructing clients, and validate each outgoing HTTP request before redirects are followed. Local/private HTTP MCP endpoints are allowed only through the explicit SSRF whitelist. Stdio MCP servers are not part of the HTTP SSRF path.
@@ -24,6 +24,6 @@ HTTP/SSE MCP transports are part of this boundary: validate configured MCP URLs
## Shell Sandbox
`execution/sandbox.py` builds the sandbox argument vector for both shell execution and the settings probe. `security/sandbox_launcher.py` resolves the trusted host launcher. Backends are `bwrap` (bubblewrap) on Linux and `seatbelt` (`sandbox-exec`) on macOS. Seatbelt must not expose shared host temporary directories; scratch stays in the workspace. On Windows a configured backend warns and leaves only the application guard. On Unix a configured backend that cannot start must fail, not silently execute without isolation.
`tools/sandbox.py` provides optional command wrapping. The only backend currently shipped is `bwrap` (bubblewrap), intended for containerized deployments. On Windows and bare-metal Linux without `bwrap`, commands run in the native shell with workspace restriction as an application-level guard only.
**Rule**: If adding a sandbox backend, match the backend callable contract in `nanobot/execution/sandbox.py` and register it in `_BACKENDS`. Preserve read/write root handling and the configured backend's failure behavior.
**Rule**: If adding a new sandbox backend, implement `_wrap_<name>(command, workspace, cwd) -> str` and register it in `_BACKENDS`.
-26
View File
@@ -1,26 +0,0 @@
# Simplify with judgment
Use this guidance when cleaning up code, choosing between a patch and a refactor, or deciding whether a test earns its maintenance cost.
## Think before extending the code
Work out the required behavior, the facts available at the boundary, who owns each piece of state, and what actually causes the failure. Then choose the simplest coherent implementation. Do not begin by asking where another condition can be inserted into the current code.
Use your judgment. You are expected to understand the problem, not merely keep the current code limping along. If a solution needs another fallback, ask which broken contract it hides. If a helper needs more modes, ask whether it owns too many responsibilities. If the implementation is hard to explain, reconsider the design before adding another layer.
## Refactor when the structure is the problem
Refactor the owning path when it removes the cause: duplicated state, contradictory ownership, tangled control flow, or an abstraction that no longer fits its callers. Keep that refactor tied to the requested behavior and preserve unaffected contracts. A small diff is not a success if it leaves the defect embedded in the design.
Remove redundant checks inside trusted, validated paths. Validate untrusted input at its boundary and let internal code use that contract. Keep fallbacks only for supported, reachable failure modes with a defined result. Do not silently recover from broken internal invariants, retain speculative compatibility paths, or introduce frameworks for hypothetical future requirements. Preserve deliberate security checks and documented recovery contracts.
## Tests must earn their place
Prefer evidence for the supported user path and the important reachable regression. Reuse existing coverage when it already proves the contract.
- Do not add defensive cases for impossible internal states, unsupported combinations, or hypothetical failures without a reachable path and a material consequence.
- Avoid exhaustive mock permutations, assertions that mirror private implementation steps, and tests that merely prove old text or symbols disappeared.
- A prose edit, mechanical cleanup, or low-impact reversible change does not automatically need new tests. Use focused existing checks when sufficient.
- Test invalid input where a real untrusted boundary accepts it, security properties where a real capability exposes them, and recovery where the product promises it. These are supported contracts, not an invitation to test every imagined failure.
Choose each test because it could detect a meaningful contract failure. Once the relevant evidence is sufficient, stop adding cases.
-5
View File
@@ -1,5 +0,0 @@
# Reusing verification evidence
After a content or base change, rerun checks whose supporting assumptions changed or whose relevance is uncertain. Unrelated changes do not require repeating all verification or review. Carry evidence forward with the intervening diff, the contract it proved, and the reason that contract is unaffected. Consider shared dependencies and configuration, not just overlapping files.
Evaluate PR review and required CI against the current remote head. Inherited evidence retains its original identity and an explanation of its applicability; it is not a fresh execution. Keep raw verification artifacts outside tracked source files.
+1 -3
View File
@@ -1,4 +1,2 @@
# Ensure shell scripts always use LF line endings (Docker/Linux compat)
*.sh text eol=lf
# The public Sigstore fixture is signed over exact bytes, including newlines.
tests/fixtures/sigstore/bundle_v3.txt -text
+42 -31
View File
@@ -53,62 +53,73 @@ body:
validations:
required: true
- type: input
- type: dropdown
id: python_version
attributes:
label: Python Version
description: Python version running the nanobot gateway.
placeholder: e.g., 3.12.10
description: What Python version are you using?
options:
- "3.11"
- "3.12"
- "3.13"
- Other (specify below)
validations:
required: true
- type: input
- type: dropdown
id: os
attributes:
label: Operating System
description: Operating system running the nanobot gateway (including container OS).
placeholder: e.g., Windows, macOS, Linux, Docker
options:
- Windows
- macOS
- Linux
- Docker
- Other (specify below)
validations:
required: true
- type: input
- type: dropdown
id: channel
attributes:
label: Channel / Platform
description: Which messaging platform are you using?
placeholder: e.g., WebSocket, Telegram, Feishu (Lark)
options:
- Weixin (Personal WeChat)
- WeCom (Enterprise WeChat)
- Feishu (Lark)
- DingTalk
- Telegram
- Discord
- Slack
- QQ
- WhatsApp
- Email
- MS Teams
- Matrix
- WebSocket
- API Server
- Other (specify below)
validations:
required: true
- type: input
- type: dropdown
id: llm_provider
attributes:
label: LLM Provider
description: Configured default provider. Edit if the affected conversation uses another provider.
placeholder: e.g., openai, openai_codex, anthropic, deepseek
description: Which LLM provider are you using?
options:
- OpenAI
- Anthropic (Claude)
- DeepSeek
- Google (Gemini)
- Ollama (Local)
- OpenRouter
- Azure OpenAI
- Other (specify below)
validations:
required: true
- type: input
id: model
attributes:
label: Model
description: Configured default model. Edit if the affected conversation uses another model.
placeholder: e.g., openai/gpt-4o
- type: input
id: browser
attributes:
label: Browser
description: Browser version or user agent, for WebUI issues.
- type: input
id: connection
attributes:
label: Connection
description: How the WebUI connects to the gateway.
placeholder: e.g., Local host, Remote host, Direct WebUI
- type: textarea
id: config
attributes:
@@ -42,6 +42,7 @@ body:
- Skills / Plugins
- Configuration
- CLI
- API Server
- Documentation
- Other
validations:
-3
View File
@@ -1,3 +0,0 @@
# This isolated signing job never installs nanobot or candidate dependencies.
sigstore==4.5.0
packaging==26.3
-615
View File
@@ -1,615 +0,0 @@
annotated-types==0.8.0 \
--hash=sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7 \
--hash=sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0
# via pydantic
certifi==2026.7.22 \
--hash=sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775 \
--hash=sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55
# via requests
cffi==2.1.1 \
--hash=sha256:046bfc24911b37851ee1b51aab8bffe713d89c68c6a057b09484ce9fd5f69b4e \
--hash=sha256:06c72bb76605a4b0cd0aad6930b69d4baf7dd5d806cfc409b824191099700e66 \
--hash=sha256:0beceaabe56af686895136a2de78db54ecd8e4046b236b8fd6d6cb61389e9bf2 \
--hash=sha256:154852545011f779917b11c78db2358d095da62a9a172b78ad0a583ee5adc0d0 \
--hash=sha256:194cffa889098ced9976c3fc6340305e43f6303657d298da55366907c05c22d6 \
--hash=sha256:19ee6127ee34de7d83ce3d371ebc5ed91addbdcc39f9ab15ce4eb35a4e534971 \
--hash=sha256:1a18a57b58cfb21fc28d72e876acf10eaed67a1ed96226f92af4df681d571c4c \
--hash=sha256:1aa5645c30469b09530c4ebca77ebf8f17618293c58f8549cb1a543a50236e7d \
--hash=sha256:1dea0e4d7d4f11f619fe8c1d76caf49e24405b4b5743c0e3be16a500ecd930c9 \
--hash=sha256:208f941bb9d18e768138677f0a6d2ce01f590df56043dda1df1535ac57c88517 \
--hash=sha256:210019b6c7cf07f081b4c54635c8cf744377001350e29cc0f81c4377b4797735 \
--hash=sha256:246fa40ce8645a614ff682e0b70f37134e460eaf93a775e0cbe3cca585a67a80 \
--hash=sha256:25792eac27877609e7bb06d42ff88278a6624fff2ba9bbb523c09616b117e80f \
--hash=sha256:27350daa11d4f10c540e6e89dada4c54feb7256ad03e9a4dc075ebad7ba360d1 \
--hash=sha256:28907ab9bfb6aa13184cfc17c6b8e1023c5ab6fd7076d8c20a35e59fe04f8f29 \
--hash=sha256:2ae64be792b8966f2c69538199728b290e34726562896df1e5dc8ffd8d8188e8 \
--hash=sha256:31348097ff5bbe827ccc41795d4dd099d9f0625e7def00ee653c137a490c2a6c \
--hash=sha256:3143d81e29e1e20a9ce10901ec369012947876596f75a222235965f2b7ae832e \
--hash=sha256:3222ba5d678f80a030e6afbcc33dc1ae5cb45facabb61cee2c7016b8432fde48 \
--hash=sha256:3311ed60d36f83378794e1009ac6258bafbf81f7888b4caa7b35a521e3f95813 \
--hash=sha256:334644fbac4eff73d985a17a91226df55d0f394160c4cfb880e084c8f7161cac \
--hash=sha256:34e261f78cb6ceaaa36f42f2613f4380d94d9c759a9c73c769ee6e0247364632 \
--hash=sha256:363e05fa78e15116c3c32c210ee36884fd6b9afa6d440e47112c3bd511d64cb6 \
--hash=sha256:398aff33cee2767e3e781d2554c54bd0dff386bb437581e0d8011fde1a942ec1 \
--hash=sha256:3d22a20b1fb1632cc72c22f95f7b0d2961c3e1c235f245ba4c606c4771035659 \
--hash=sha256:42a494cee34437f05546455144f2b5d9ac09b1face62bcfce597d2e521066688 \
--hash=sha256:42e2f76b9455f5a9a844f770bf3e200ed3da0e15f5df3db9c31fe80b04b3d004 \
--hash=sha256:42f6930c31dc7f50732c9ae793c2786c7b6b044195967bbdde40bb9be81c4cc0 \
--hash=sha256:456a61fa52d579ebf9df2e9552ead5129855dbaff6c1e5a9b1bc408809bdc062 \
--hash=sha256:471cee653ae88de62096552e6d24ccb4a5adb8c8c9f10b5054d0122c15bf2779 \
--hash=sha256:49cbc70e6542d4ccccb936558d1064a8012541e78f821f955cff24e357776c94 \
--hash=sha256:4a7c934f7360e8cd64fe9efadcbd10c7c6364f531e432b9a4bf5ccbc9e0e8b50 \
--hash=sha256:4be96343e422f2dfcd12ab5c9f5aebe03f82f737c6bffeca6830b3875cb44aab \
--hash=sha256:4f42141fc14250de6dde5ee7ea4432be017252d91f19c5ad043c084cea629cac \
--hash=sha256:507a24c282e0f42f8ed737cf048572cbf580468da5555764a8331735e9c736b6 \
--hash=sha256:51b31d1c98274844cfd7838ce00bfc27c7423a4dc00fc0772fc3331c2cc90676 \
--hash=sha256:58acb8ab8e295e6c5ea12f888cbb13cf21511ef2a3303a23f4325c29d17fe5c1 \
--hash=sha256:5a59cc1c4442bc3d5c703bf720b51138d0bfc173618807c9ee2490a7541dd3d9 \
--hash=sha256:5bb4e7ea95dcd6a014a6fef62e62467d67d8e582326443f3d68e71d6320a9fcf \
--hash=sha256:5c58fe613dc5e5336357eff555824a314d8e43282600435c8d1cb6a7a2fedd13 \
--hash=sha256:5e7cecbaadb83884793e05828cee59b210b24583b9c7425d0ba6a754fe22eb4e \
--hash=sha256:616f097f2fe415bc92a247f02e11f634e1f9e9a83d327e3c915c15089c87869e \
--hash=sha256:63bbfd5ded17c4840ac07cd8f1c21ba9d9708141f840b324f422f41b207e3973 \
--hash=sha256:64faea20f4e2613363a1a9b9c7dd73058f3ecd00133a511e72ad7c511658f527 \
--hash=sha256:661c298b4821edebead0c91edd2b00374d67ad7c5a1f7a91d4442633b79d6a72 \
--hash=sha256:68e62fe11f30d5ca8289242866f0a5291402d8529ca2178ab8afc5c9694ae890 \
--hash=sha256:6a8dddef476fab96d066d578fc88526767b836ab5ab21754e1d5bf3879c31c7c \
--hash=sha256:6e192623c49c94421616a5778fba35cf0d5a8d000650c1967ef4448ee5cdd990 \
--hash=sha256:7225e4514edb64eb6740324353e0da0711954fd8d7da4576755b1c6e09b697cd \
--hash=sha256:75f80557d1389eddbd0de2681f6a390a0c5338c31ddaa821381c203fc3fd50d9 \
--hash=sha256:770de9db11e84213beec501cfcaa013b019820ca881e03344dea5844f7876d94 \
--hash=sha256:7750c6449dff7864bb9bb27ddfb0267756189201a3afc911d82b3caacd70dfc3 \
--hash=sha256:7bde5e4cc5c10140859842b9d383af292b22639a4dffb725314baf45968cef80 \
--hash=sha256:7ce713ace7c0e4520535b42b77eaa742c16dab813978064913e5a3cf82973b41 \
--hash=sha256:7da0c5eff80f0197f3b3d1232ec5a682a9325f4ae9016a78f5f5ca35f9ced1f5 \
--hash=sha256:7dbb61fe3a7699468030f71bbe5f8a0e326a151daa91beb11a6fc1f980c55e1c \
--hash=sha256:811bd1e21d32de12efca32393a0ab3f5133b54fce9bd44b8bd77ab07da14bf6a \
--hash=sha256:8ef53b2de9bcb9197d31854256575d59dbac0cba72ac627bb291ef5eceb74be4 \
--hash=sha256:937c0052c05a31ca1daf18de3158eed4dbfcb9cc107adbea227728d647be701e \
--hash=sha256:9d2055050ea716bd38b7f7f1579c275386646b4894c155a3e2f3cd62ed41b7c6 \
--hash=sha256:9f8d177621de5cb38ee3e731eda45d421db093ec0739f46a5594babda7987a98 \
--hash=sha256:a2d7755bef5a12ed488f4ef1f1b69ee9191d7396083b755a5d2295f6edb4768b \
--hash=sha256:a48d62ab9d6f4f98c983223a547af44be6ca3691074c31cecced6facd3ba2dc1 \
--hash=sha256:a4f00aa42f75d6e4595e8866e748cc1705adc0cddfeb2ca86d0d03993d63ba03 \
--hash=sha256:a6e721d4b0e45d5b65e87534470e67b18dcd092c83f68fba09f152b9cbc061af \
--hash=sha256:a730a083190634c65cca36ba5f489531576ebd79bcd5c8e172130f6453127231 \
--hash=sha256:a931079504ecc49efed7744c476a5c343a92fabf66dec2db95edb1b2fdc770e2 \
--hash=sha256:aa9511c62d14da7aacc9b4bf51f3f697a621e83b2d6919008243c3aad168eea3 \
--hash=sha256:ab36d55f9ed2d067327667c2fea18dda018eb628dd6347aa01dda6cf1f5d3836 \
--hash=sha256:ad2c86c495b899d862ea0f4b42891b8713a3bd45dd4105c7fd51c2a72f39f3a5 \
--hash=sha256:aeae0e330c9f6acd681f647d46cefd30c29f93e3392882e792e82080c9691399 \
--hash=sha256:b0431303acaea1089ad4b3e9ce4e6518193def1118d4073ca848635ee4ea2e96 \
--hash=sha256:b5bdfd1c873d4e093aabc0ca84c4ca6dbc4f752afb5c86f146d9742580c9da2e \
--hash=sha256:baed1e86cc735622097354b9d1281406caf42ff42a886d29faa8e8d1630333be \
--hash=sha256:c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf \
--hash=sha256:c26608d2222fb1e94487e4a387d85f13eb55d5ed725cb25a0c589ac4ee60e7bc \
--hash=sha256:c7659f22557c5a0bc4855cd635f55edec690cc008a40768527762cb9fb263455 \
--hash=sha256:c8c69575568085ba0b1b10c0249d779a214aea6f6522e949a0fc9fb0fcb449d0 \
--hash=sha256:c8d2c9fd1f2d16f780d15127abb050d13d1a76c03a4bd87d7e4980e45e511e12 \
--hash=sha256:ca82be1a1d406ecfe1d25dc16cb33488e5a16bf4438c9fb590484ea29d92478b \
--hash=sha256:cc572dace3f60ef98d7b12ff411d20f5362feb31a0439eab0085bbfd349982d7 \
--hash=sha256:d18e5ac0f2f03f4f518d3e23db0f0cad7faa1da8620e9c09461d443bbf6e6692 \
--hash=sha256:d28630f5854ab07ab1fd4aba756de52326c82e6be15d414b12793f1975048b54 \
--hash=sha256:d9c275eaacd24aa73f94ffd6de08fc3f932424d8b6c376f4bed7cde376fe7bc3 \
--hash=sha256:da0e573f9f97159390c89d9f1a9e41908b66d408cc5b58d08cf3847d844c531b \
--hash=sha256:dd31f52ea1086513bb9df30f8fcee9b8918323ae067a3d5b78bc826a000712be \
--hash=sha256:dddad92b554513a31f272570678ba307fb9f618f05e3d4a5eacafff9eae03e1d \
--hash=sha256:df423d40ee8654634421812bc3b196da3f9bd7d32929da813f8394c4348a5358 \
--hash=sha256:df913725b79db7bcf03448f36b7bf8815363417d5b58deecf9305e3e30f0f21a \
--hash=sha256:e0bcb7e0f677f543555d2adff3bf19c05f66cdb4796e5ff602442ab2fe3c4ef7 \
--hash=sha256:e2d65b31f36619cda3999b78b2aa9632e76b78448e7a56fc4240824200e7c4fc \
--hash=sha256:e6e8cff14d6fb0be70a09c0bdc58096f501952d04624ebf867e0e56da2df8960 \
--hash=sha256:f16c709686a78c727bbbf059f92b0bf41c6fc60deec706d2dc19f529175a6125 \
--hash=sha256:f24fb43132a4c6b4cb4eb029492919b2db645be6808d738f244fd146c03c32cb \
--hash=sha256:f53e442b08449d42821fa4a4fba000095af9f62742a500f978a9f557ec44339a \
--hash=sha256:f5cfbc5fe74540d335175b656c725d74d90e3730c626d92575eea35029d9afaa \
--hash=sha256:f81b3b8f3d4e343550fa4baa0e479bba9f2d29ce9c2e9b51d1ce1718d7442fcf \
--hash=sha256:f8ec5e643a9a937f64e1999eb9f75d072263751912dc5cd06d3c85f8f44be7c3 \
--hash=sha256:fb92203a88b3d3053034db775110081c49d28be6551923805e039924093761e4 \
--hash=sha256:fcd22650c908d7b7da162bbfaab594a1227a15d1643a98c68b122ac642fa2264
# via cryptography
charset-normalizer==3.5.2 \
--hash=sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e \
--hash=sha256:01b0c0d2262a9e28e8484a278c7e1b5d650e3ac8cf2683d2967e25899f208bdf \
--hash=sha256:04851f73ae72b8413dddadb16a49dfee95263553741fd42d546f7d66907e6be5 \
--hash=sha256:0521c5665880b33d603717defa76c094048900010897909952397feb3039da56 \
--hash=sha256:0774bf9bf620249fee3e0b8b9fd3065de213be30f3aa94ce2494b3b638949e26 \
--hash=sha256:0891b9d3903c5571c03771ca669a4b0ec5618ca722a5c957d3d29cd4e5062848 \
--hash=sha256:0c951d5e6dd9c2ff60609476752bee49da4206adde960ebc247766937f72e718 \
--hash=sha256:0fed1d06615f022ee3b13caf5e8b180cfea32bb2c5aded8a9d44277afc040f93 \
--hash=sha256:114e4d0c92d618409ed82a99e22b5c5e768fe995f2973f78265f4524f49d4640 \
--hash=sha256:11912e4bb14baae7c5d8791aa55ba0a3a03ec6729073307b0f57270abaa713d3 \
--hash=sha256:11a4d68a6ecda3292cb1e50239e111543ba5d709bb62a6b4ea1afcfa729d8875 \
--hash=sha256:124fbf1a8ff966d87ae05bb8bd45a71f966055ed8bba320d0c7cf450bc5f4d0e \
--hash=sha256:1461ac396c4fdb983a675f20aa555624f0ee18ac83d832b9244ffff3d8055275 \
--hash=sha256:1503bccbeb36d5527790c3930327704c39af22de3112f1b1666a9f3ce15ee204 \
--hash=sha256:15bb4005af6320d259dc7593ca84a38d7fe06a421dbcf7b910ae23979101e787 \
--hash=sha256:15c44f7edfd477b06f517a5cc317fc1707edb9de2c865f43d4b6513907473234 \
--hash=sha256:16fa0eccf81304b79c5cd87f9271c3b85dd9dd99245e4422ae9c0dd45e0f99d3 \
--hash=sha256:183b88127acdb4fabe59d951ab424faf1af7b63cdbb5f776186c1ea2ffcaed98 \
--hash=sha256:195c26fb65950f8fce54e26349852b7bdd7c5f120aeefbcc440b8a20faaed4a3 \
--hash=sha256:1afb975bd5d68d5ce9f6b6d44fdf2f7e34b895a35e95708a7a91b20a3b51d187 \
--hash=sha256:1b4cbc7c3491ccb4aa17fcd8165649d01cf39f76de1696da8631b5f71b85401d \
--hash=sha256:1bc0baf5ef96b6ede57d47f4b8fe4d9d84019c3bfcbeb20a41edc6a6ee341f1f \
--hash=sha256:1c50fe28bbc2ced33386f298650d91218076c05420e6cbd790b913adc41659e7 \
--hash=sha256:1db38f4c5496827c1a501846d64d14c3b80c7e6714e406cd7dc36a9899fa1011 \
--hash=sha256:211d5a3eb6af8f513b8d4ca19a8c1b7accab1b5f0d3175f9826b03c1a920dc1f \
--hash=sha256:23851fb4e1b85ed3f6c2a27b777cdfe2e19fb5b38429a8faf38c7542b7665869 \
--hash=sha256:254eb48b9fa5ee9898a3c445825a1f340fe53712a098904b39b0bddba8ea3cb1 \
--hash=sha256:2625388c6c754520c37abaf3b41eb34d1cc4a373f457898f08606c8e362b891d \
--hash=sha256:281cb91036248400f4cc957495cccd44c275c2e0c5854f7e45ac5cf7dc193847 \
--hash=sha256:28a15fdad492a99b6eccfaaed66ef3f74050680545ea61ec8b2f4c538f1f1320 \
--hash=sha256:28b4f0d66fb834ff90f28209ac7bce77868c45d8c93e26f906709d9b7c2e1af9 \
--hash=sha256:2a925889534b3748302dae5dead07cc13480de1dac3aea80a941b729b471ef93 \
--hash=sha256:2b7b3bbfb4fe8ef40600792d762fbaa9057559f9d3fad209525b7a22b99e91fd \
--hash=sha256:2c9ad19a6cfcd5ea5c0d41161d22f9df1dcc277e9bef2751391334546a314c00 \
--hash=sha256:2cc961b171b3f3440f410489ab3573e86aea8736134ebbb40ea1338b7f0831bc \
--hash=sha256:2ce45c6627b22c47e390bc91a41c3d13032192e699fa0bea96e9671b373d69b0 \
--hash=sha256:2e06a3a98f916dd41d27f3105e02e7a40181c98c94b9158733d03a6f80506c09 \
--hash=sha256:304d5463e65a35d7bb0850550e0780395395f6fcf452f04db7d5ca7cecc425ac \
--hash=sha256:304d8e4d493af723536393eee0c689eb7813f4a474c8b479dee63f1fdd98f621 \
--hash=sha256:30fcd120b732aa79317f08dee04d7de0847822e4cf7ee0e9f445bb958832252c \
--hash=sha256:31f3930700408d211f13378ccbe1c40845d8da54bd0681fac3a9b5aae81c7aa8 \
--hash=sha256:34276fd796040bf0993ab33a369aa572e6979c7aab225a88893667ad8eac8f7a \
--hash=sha256:355ad8011081dec5412240c087a9a0c9d4d5039f3ed11a3f13e18c2b29b56c51 \
--hash=sha256:38a873987f3be698494da8b2e3085e29da02da7b633dce73e79c699a113d7bf0 \
--hash=sha256:39de2a259fc954455c57274dc94c79d5842774e1247a016aff30bc0efed0f4ef \
--hash=sha256:3d14b50de6bf4d0edf857a9386836846f982b8f524e188e2e68b96d702bcf4aa \
--hash=sha256:3d21b8b13c7592db2ac5e544a6d83187b995257472b0c9e8351b6d507ae37ed6 \
--hash=sha256:3d31298449090ab8d47b7b1b2a555ff73cac7ed438a08b7ac160980c7ebed649 \
--hash=sha256:3ddacd27458c45bdacd6bd6db644bfb730efbf9e830310186e3045c9c5be8fb2 \
--hash=sha256:3df041de8887954562c9b261cba85ca0e9ded74048daf125f45edcfaa4832229 \
--hash=sha256:40ab6bffa02ae10a0581e6c198be7d2d8ca5c2a0c64e4ed3465d766df457573e \
--hash=sha256:4275811936e2f06feff5e598fb42a1b7ae852da8e39605211892b56b81a34efd \
--hash=sha256:443eae2bf318abeaf6f15d785138f71fd6de770e99a92158b8b814265e079115 \
--hash=sha256:447441e76ec720b15e64418d32e092297340387053047c7c694f579efb0ee1d9 \
--hash=sha256:4495c5002a7b28557e7e222e77e0b661183e432b7d6d2e788101e3f240e05b8c \
--hash=sha256:44bd4fbb29dfbeba60e7d2bd000c59e4b21ddb3cc53912b14048d37092706d7c \
--hash=sha256:4685902cf26edf013ed7a3da0f426ebba7a00ebb9541386d835afbf002c11cab \
--hash=sha256:498dc3188ca05a68231ac3fdbfc7f57eb67e1343c30e0fea17f8218c1599b253 \
--hash=sha256:4c2b5031f63e331e3839b40aed2dd6f191e9c07edbde303e7876846ea1946995 \
--hash=sha256:4d48f2d08b9de5864e2c8744d4461b862fb149a18274abc8b698c45975573438 \
--hash=sha256:4f87960d57feabfb618e4e0af6e7371645fa26a277860739d6e5d6e0012c92f0 \
--hash=sha256:50e3adfb96fc189eb27b1cf62d3b598b89b4bb0420d93a3d3e42e137409011be \
--hash=sha256:51cf45226a9b588d0d2b4880c62d686934b63ab0bd79ca23ab0e9762eb27441b \
--hash=sha256:52aa6992700996af31f375de0c6bacd402b0097fe40b53c426b9f51a90ebabc7 \
--hash=sha256:55ea99acb17b9325618de155a0cd6a2e8f5d10be008113e1d433bbb58db543b2 \
--hash=sha256:56bc200a365efb37383b7852e4cc5898d3b2da5987289b543956cf8cad71018a \
--hash=sha256:588461c2e8384d309bd63e5826019b6977bc66d629b99ac8737bb795d7b2cb5a \
--hash=sha256:58ca3755ee7ff7f59b57789ec9833c9de9ea275405cdd240eda1f193112e398a \
--hash=sha256:58f361dcbab699cf8f42db3f47c8e7fd1036f138c23a5d08de9fde5f425a730c \
--hash=sha256:598a11a2c7ebaa5334bf698bf29568c9c390abac6a154d8170fedecd1cea38c5 \
--hash=sha256:59f63901b0031c3136cf64704dcb21de0bbae62ce2c9529bc39d27665463de37 \
--hash=sha256:5cde776b7cc66e4f6c99612cea4aa7269aa65863f7a15841b2c264f103822f4e \
--hash=sha256:5e2b6b57e9733d39f0c9fd3185efa6b8e29652c4cd8fe94180272cf6ed9a78c4 \
--hash=sha256:5fb29fb8cd1a46c27a1bf9613ad5ec2599310d46b4025d9556404a6b6a292800 \
--hash=sha256:6045373d5a89a5ec71afde535db987ca28e76dfa276c2d4c818265b375d4b055 \
--hash=sha256:619799369eeef6366ed3e8755a5670f4f2f0fb6b30a0fd7264dc0fdc2357058e \
--hash=sha256:62588a277bfb59def052abd940703fa35107152bf479781a878617d60faf8fb5 \
--hash=sha256:62603db9a7caa0802eaa28c1c46fecd7b3a263a774069c24c3c28c302448721c \
--hash=sha256:65cd72beeeca9d3aaea1201e5923859f308f952f9c71de93f06063c79f0f7a3b \
--hash=sha256:68eb192d85ab8e5f6ec69c2bc6ac0179fbf04a5ac1569d12fbef74883fe102d0 \
--hash=sha256:6bd128f206a7752ae1f2ab6c61bf8a24ba28913a10df8b14c2637b973ff97a80 \
--hash=sha256:6be488a102b8cf28d0391d8c4ba7748938ae28b78ad901f8585520fca33ead1a \
--hash=sha256:7218e8f32b0956cfcd048fd42d9d5779809745ca1d86113ca56f66e7ae1549c4 \
--hash=sha256:7441d755b7ab94f8d4eb3e43ec05482d760842fd263d003a99102d742cd835e2 \
--hash=sha256:749e97e1b32313717a565abbe321bc2190bc8b35f1a67e4cdbc7c56c8d8ffe58 \
--hash=sha256:75a3ceed0724d625d64b86ca20aba182e4df462e04c2414fc941c0f523f06aac \
--hash=sha256:780fbe7cab297b81dad9fb8dc5eb003c0468ffb0d9e5f65068c53a34661a96bc \
--hash=sha256:78456a747de8dc58360ffa581f30a002baf5aa28cb262536545e91f113ed7639 \
--hash=sha256:7967d08cf06dee78443b874f98c98036f624f3a4e73e11f9f64f5be4d25393cf \
--hash=sha256:7a881931aa470808df94a8c380eed2bbbc76cd9dc622310f99665658c821eb6d \
--hash=sha256:7dcd882da75ef9adf94903b1e3b9419e8aa8fb4c7396822b834b9ef7fb96954f \
--hash=sha256:7e841fb9010836c992c9f12fcbd43a831de93a5f726fc1ccd8ca1d0268c5014c \
--hash=sha256:7fdde2c9fd9e3eca40631e024664cf2584272cc8f96308cbe5fdfc930f51d8bc \
--hash=sha256:8024d00c3faf3fc0c16e07a69f4405e8eac7cc0ab15f65fe6cf43827c4cf72b4 \
--hash=sha256:80d02b6f04e92601a081dd97b23d3128033098bff5d35d392ddcc0476ea11253 \
--hash=sha256:838dcc90063569a0448120554591a1d6c4a4ffe11babf048908793154ab86ade \
--hash=sha256:849df64e889b2e17230d58410a03dba311a65b163508fd33679b2b737d4b7858 \
--hash=sha256:87475fabc8d9996fd9c27debb395e642e8c838d78a00b6e932227a0e06b81e26 \
--hash=sha256:87e50a3e7cb90af586b6c5faf23e302a970415ac73bd7bd90a515a04b427ef96 \
--hash=sha256:89b53f3cda69831909888e0494f4fa0bcd3537e3e138dabeb620bd6ad946bae8 \
--hash=sha256:8a893cc101149f80a653f82062ebc95b34525a2614382e1da5458fe7c6997249 \
--hash=sha256:8b2bfab86aa71ae13aa41a6a26aab338e0db2b8bc75434b05aea89e011ff35a4 \
--hash=sha256:8d86d6fc60743dc916eb79e2eb1ec4818e21e427731543af40a3021851174a13 \
--hash=sha256:915563965d418f986e7e145accc592eae9e1a1be3566ff98a05d7a9ec42a76e1 \
--hash=sha256:92888bb3187c5ba50500b00b3b310c9f2c651709d28036077680cb5255450a03 \
--hash=sha256:93223adc95033dd47133a46ccfc316a0139176fd79085762e27202ec56018f03 \
--hash=sha256:9373ad13ef0d2c0fb761e04e55bfdee5a08b52cef2c882c8fbe9935b1517152e \
--hash=sha256:9409a8bf35cf78353942504b24a57de3d75b708997a1e4bd8db71ac8633ce364 \
--hash=sha256:9b7f416ff0978e2f2249330527f0ad6fa02f4932e6199692d3b52da2048c19e4 \
--hash=sha256:9bde855991b7e362c146535e3136a50bfaffc0487d38b33ca7e5edefc6e23849 \
--hash=sha256:9cae88599c7219005d879f98e5ed53341e9a122af585e1091200358a3003d2a0 \
--hash=sha256:9cf9b1a857e25c4baceeb3624e92a56df3668f398c4acba74e174d81fb4d1d3a \
--hash=sha256:9f56f72050826f63dcee7a7f55b0a77168cb3bfc553fd405e7f8f9ece75a4036 \
--hash=sha256:a090bb2c68df85450502e3e20d665e3a5af9c65a84d6508ed477badd49166fd3 \
--hash=sha256:a192e2c40070d92c3ccf777e3a5c4ff515573cd2bb7ed0c537fdadbbec5bbf21 \
--hash=sha256:a19a731138fc27d5682277d3b9df22855cea1239bce7fcec5f78f42ef2d1f3c3 \
--hash=sha256:a66c3bc5ab1f0ff2164fc9965ddd611ff0802173f4b9d24554c563f6ab7e1d6e \
--hash=sha256:a815775b6c38d4e0ff7bcffbeba67feded90202bb6a226b8dd35f1c855217413 \
--hash=sha256:a89012d6d5476ee112d20d998570ed58df2260a852afb1758809cd6900411d21 \
--hash=sha256:ae4f5fea5b8b8ccff88238cc8569303e5ee95efae67fa62922a311397a71f346 \
--hash=sha256:b6856554c4f44d79fc2307d5768854310a8f0096e501c75637542c82292b0429 \
--hash=sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685 \
--hash=sha256:b736353c0a625bbd5fcec108576e2385db3496f4f771f785ff32e108d3c3bc45 \
--hash=sha256:b7fd005a73d9e657273b7a10dc71a9e03c8fb9ee6999798d6918ce095b81ac7f \
--hash=sha256:b91363207bd9dc966a691e959bb47f64b30f7ac4b072be9968b366982f7db77c \
--hash=sha256:ba0b1d2620edf869789c3879223f52bf2afc5d31b3cb47cc57b3a12c05e2aa9d \
--hash=sha256:bbbfc8e28816f19d7c0f1816664980c0a9875d01b27cdf8eedddb639d9e108ad \
--hash=sha256:bd16aabe4a02a297c23417aa17ac6299dbd8c49f673bcd645b4929b11f5a4400 \
--hash=sha256:c0afc6800ba57ccc350374c5bd6150419915d95ce93cdbab2d783d75eaf30ecb \
--hash=sha256:c6708715abcf3c73b99508253e961a9967f02fe536532834149574eda6de0d1c \
--hash=sha256:c7c9ab723cde841fefb34efbad91e87f00a674b1fe1cd0784fde742bf2c154dc \
--hash=sha256:c8f3d67aeaf55f017982b73683f0e7342ba2f6635a78f69ce89ebb26aa411e5c \
--hash=sha256:c9790464842f85f437dbbb54417eda1e0e6bfc52dd8d22d6fd1c994b73b2dc74 \
--hash=sha256:ca403d7e4798f525fdfc78e258820419cbbd0f0ecbab9de7840e3c017cf6b8cf \
--hash=sha256:d008d90a7f2471519aef0c90dfbe73b3e6e4d5e66ac48e19154c17e89e98b604 \
--hash=sha256:d19fbd981a488e22cd04883659ca6b08f50b5974f9fd7c95655ef6a043e5893f \
--hash=sha256:d1befeed746d247c81127bb14de9dc3d30edb6e5976d34f83f86ed262b1d9105 \
--hash=sha256:d2374b62878abb00cd8309b32af6c0b715cd02dec0ca74ef12e5069bdc64144a \
--hash=sha256:d376bbd28b3a8999db1a103b3b388aee6f1ddeb3e51bc2172993efdcd86e064d \
--hash=sha256:d4a7319f304a774bed22115bc891618e45f85065ab44ea6acd07d274e750519a \
--hash=sha256:d6734d2ef8a50fbf8445c139477da401f50d62a0606bf00e20ec6d87773fefb1 \
--hash=sha256:d760fe2a4d7c3b226cb9026d6a842868d52a7901bd98420e1baf14e80da85cf5 \
--hash=sha256:d913de495d90407cd859d263bee2e5d1a4ed3eb6573c04e70d9ec619a7cbed7f \
--hash=sha256:db19d07e2e0129e974a0e65d0064fc222a446cd5122c2fd4184d2af9fc734a9e \
--hash=sha256:dca9ab98072a5a54ebacebdc45f53e645336b320c667410b061be1ca588ae709 \
--hash=sha256:ddc7dacc8ece3a182e7f15cb862d1fd616b46d076cb1ae9dd232b2c38b655874 \
--hash=sha256:ddf19c062bea7a0cc80f519243d2c01dd091be0cf952a0750d4ad576709559f5 \
--hash=sha256:def79fa35ef0cef8d2accec024f4fdc7ead3012ff02f5215c783f39f03ef8cfc \
--hash=sha256:df29a0a7107f7011e77f4eebdddec4c7331e24d787a0b21a46d63bdf7445da95 \
--hash=sha256:e09a3942ecbdee5cce73ea9d42da82b81b72ac1bf031ce069b93b5adf4eac8cd \
--hash=sha256:e242bb1c5e76e97dfa9e7f209a71e93a01d7f19ffdd5cfbb2e2d55b4f08f8ab0 \
--hash=sha256:e243bd13217235fc7290c621941c3f5cc8b66e4872495be821d7436ba2fb838d \
--hash=sha256:e2af3aad578aa6bd1384bcf4750fc285e5a9de53f40b7d41e5a0bf748edeb2b3 \
--hash=sha256:e4e81e09c1578b8df602e3db08b0b3ea0a6947ad612f52bf8dc5ea8d47691f0c \
--hash=sha256:e54da4baf05720032d527874d40b65fa4d7e5c6c6a43d0c3adbeffcaf275a2b3 \
--hash=sha256:e80e6c2f55656b4824d72065abb4ddd6a525c74bd78a0aab5d9fc2cf4fb5af50 \
--hash=sha256:ed2a239c0ea213acc1908150a3037257083c7c083128f1a4cec2ec4b97dca491 \
--hash=sha256:ed905975ab14056a2e5eb1c376cb2e1ebc5396baf84163939c518556fccde9f5 \
--hash=sha256:ee21e28f0430bd6dc9086c6e525d5e818a44a5ad19720c8a0ef766792f3eb5e5 \
--hash=sha256:ee43c17b173d46a3212baa6ead3ae258eeabdae48c263a01ccf0218c366dd655 \
--hash=sha256:ef4fcbf3327382cd4c9f540babd61248208af7b93eec4de397b4d5f58a09e288 \
--hash=sha256:eff0ac9dbe711a4aee69bf04a83896aa9b85f19641264053a9f6d48573abb7dd \
--hash=sha256:f0aa869112ef88429ae17820d99c3dd9504c9e9c671d3c246f3d7442cb051084 \
--hash=sha256:f3c96f633825733f735c5a9cf21d21a257d8e1edf0b1cee0a064b9c424ca0f7d \
--hash=sha256:f5833ad231be5eb6553de524a70f48d71b2c8563101750531e0b80184e175cd4 \
--hash=sha256:f5ec61164adcec446f8969a3358ec3f9b26bbda3b9213e5586d219afa8df2915 \
--hash=sha256:f7d486c83842422badd511868fd8a9a20e9407ace71564b6af47ce7e60a336c1 \
--hash=sha256:fb9e68df06293761f9fe66ade60a9bc6d0f5e42b8acf2939a9158af86ab0e5bd \
--hash=sha256:fc14a032f813bf5fe624d991960ea83e9715adc27e4c1830a2361eb1d02ac341 \
--hash=sha256:fcff63213e8e6e47770541a4607175404f47cbb3ebea7b6058cc82d524a0e424 \
--hash=sha256:fd1fbe0f116b6e55da77aca2c6ddcddcfac2186cbf78bdebf40fc156efca389d \
--hash=sha256:fe9753dfee015c570d73df76f899f18444d41388bffcde097deba51c4fadbb9f
# via requests
cryptography==50.0.2 \
--hash=sha256:0ddc924c04591c2811ca024d62ecad4f7f6f08af8939c211438f48a16bd23602 \
--hash=sha256:0ec5f09541743261e66e291b4a0cbf0fb2997aeaab6d9e9c740b9dba1b58d1c2 \
--hash=sha256:0ecbc5652bdb6fc9eaf89a7d196e20941adfe812f43bc4ca05d9150496821047 \
--hash=sha256:1981f1db4630889b9ef7803fadef12b056f428cb6b85c27ba57b774793b6093c \
--hash=sha256:1ba34f04897fcdaa73f74145c25f3ec146fbd56593853e88adc2e811303c5f42 \
--hash=sha256:241449bf940a5d27309bd317e6f9a2af6932113818bb2b8f5c59ddc7ef16da18 \
--hash=sha256:25784ce8b9621c90c643efb9e1e2162ab3b0224cae446ad5e70e7fcb1ce18b51 \
--hash=sha256:3dc4fd8058cea1644971207d530e1a03a184a805ffc8ebdddf0599d78a331b81 \
--hash=sha256:4061c0079120205fb760c58acab6443e217307dcf05e3702cf970e0689972856 \
--hash=sha256:4a20ce1e5cb4284a86692fdcba7cb8754185c6b2e5c56fcef3751cf451d3cdc2 \
--hash=sha256:4e81d95e5bafc2d6e34e4bed780e53e4d5b9a2f928573428aa4d35fbec1eb0de \
--hash=sha256:58a0c478eeca76fe5e07993c5a0703def34a6dc6a0cda4f5564639b33112ffe7 \
--hash=sha256:58ddb5a8e3179d12f19e4ea34d2d32e9d63a4baa142c875c1eb59f41b7243acd \
--hash=sha256:630ebfea3bf689d075f82316324ff7433dc447fe6bc1bfc76524b74b4a9567d2 \
--hash=sha256:6f8700550aa1474a91e5dc07049c46f98b423b5b1ddd0483e0b51362eeeaf5be \
--hash=sha256:78198641e5be9521beea5aa782bb551a58068d10e6eb04c9c680c1b69f2e7d45 \
--hash=sha256:79def8d059362e7831389ed3be0ecdf58a89386e1271e35dd9f5af84e81bffd0 \
--hash=sha256:7a8701d6b584d76e909e3d305b7d126b41439876a5aaf76cddc67fc230eafa2e \
--hash=sha256:7afa5a6602a9f29af1f3a2965f831bae7c9d5d597b7cbb716d41ab3b7d89879c \
--hash=sha256:7b46165bb56eb4704e2eaaf86f3c940d19154535d9b0ca7d6d590b04060e00d5 \
--hash=sha256:7b75de3c8b3be1cdb1052747c929440c3eea46c1bc2cb8a6e3a48388e9b7b452 \
--hash=sha256:7c6d0330c472d96f6a6afe24d80dfdf15176c33096f0a4397ae4c60f3dd3be48 \
--hash=sha256:828d49b0ff5a0e3975865571c5d91dbbdd0d38d8289b249a163e9425413a5e05 \
--hash=sha256:84f964e537f916e2cc85199e5a88742e964939b575ac8598b3f9d6cc416cdaf1 \
--hash=sha256:85d0d9a31b9098e98534226d5686b47264b95e62ce459dc2e62fdfc809f9fe93 \
--hash=sha256:87e9ce85beb6b328ba370cc6e6aea483c92617b4c95b1d33a49297eb662bfb04 \
--hash=sha256:8c71ba2cd31fc93748c38e1b613200ff1c2665cbfd5341fe3a61cfde35a1430e \
--hash=sha256:92e665960f25fcdc73725b9cec7a3824f279ba97a98653afe9ffac2e43668f67 \
--hash=sha256:94e5e9f108ee10471288214d3d233fbfbb492840a8457eb85178d643ddeb32c7 \
--hash=sha256:9c8402a82ea0dc4ceeab793db05f0fafa8ca139ca34fcde5df0f596103c74107 \
--hash=sha256:9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079 \
--hash=sha256:a582ab2ae1d34f67112cadc86702774c9ea4374df6bca6afe672817203c99134 \
--hash=sha256:a6557e5f38e065ca9fbdaf7cfc7435ecb1d113aa81a022d1b51921ee7432e227 \
--hash=sha256:a9f7355e6fab51f6c369b86fb7571cffa05edee2c2121e0380a37fb9ac1cd5c1 \
--hash=sha256:ab50ee449bf968271e820086f10a33d101dd060370abc10bcd22279be2656539 \
--hash=sha256:ac9ed99d81760c62fe89d5f0815cdfa1ba9a35141cf30f1c2d044f04b4803d2e \
--hash=sha256:b13478603dcd0a2479ff8e87e2c19a7d525734686fe3c49542472293a204212d \
--hash=sha256:c423ab384a46c4dff7217b2ea5ba2e11cffdeab6441acd04cf65a369caf0366c \
--hash=sha256:c5e67125c7dca78d199ec4e116aa93dbb83494808ecbb8211a2cb09b1bf41dbd \
--hash=sha256:c71be1cbfa5cd9a41ee452acf1eccd82b2c05950358b106ec8ceb83411d1a020 \
--hash=sha256:cbc8738fd8526d80f35cb3a40d41f41a2e7030bb3b18b09a6778ef63d291c2fd \
--hash=sha256:ce47f66801c20ec6c6632453bb5960fe38939e9306970b48b3a5a26de7745d94 \
--hash=sha256:d370b8d1dfcdf7130178137f6fbee6140774a1acc6cacefc4b42643ec11d0a3a \
--hash=sha256:d38cdff612d06fa6a32840d5e1b1f7a27cee4a349aa9085d94a67789d6bfd408 \
--hash=sha256:d8947001be83df1394050758ce0e745dd74fb134eef0a4b5124208dfc3a68c37 \
--hash=sha256:deb9fde5c60e437ee4821bc9bc39ff31b42135c27e1dc61ef0a629389c1de62e \
--hash=sha256:dfe9763530994147d9af1def057a5b9658b00e8f8fe8743d144d1e0911c2e454 \
--hash=sha256:e105ab60406787da31fccc883fc0f733af1efd78f0136a4599692c4083a73d0c \
--hash=sha256:e275096ea1e60cc595cda2836fd4a6c725d1125108b868be17f53684d164e2cc \
--hash=sha256:edc3342adf8f697fc5f59c887a304356f147b397809440ed64e2fa6af2f50f37 \
--hash=sha256:ee247f5c245c9a2fe7c8e2214e295918838e44e00a45a6718451e4004219e767 \
--hash=sha256:eef4c2f3423810b3070ab391f85436d2f8bbfcb286ac15cbc73190b3563b1f1a \
--hash=sha256:f21e8a22c8605750c7af886bab299a363721264061b4ac0a30efb73cfd58efc5 \
--hash=sha256:f265528741e048bce55c3463ed721fb0aa45a5888d8add8cfeccb3035451bbdc \
--hash=sha256:f2f9bd7f90c64fe89253f0a2c05e3c4856072660429ce8831b4235bf29403a67 \
--hash=sha256:f785f6161f202ab04d8ca194158968798e480ca058943907972da5f12e2881e8 \
--hash=sha256:f9f6143a8c75945eb960d9eb98905a441394abfa24afaae239d514ffb2586480 \
--hash=sha256:fa8f5efb344d6908a1ce62f4a24e2e5780f825d6f53f5f50ec5ffacac72936cb \
--hash=sha256:fdd28f912fccfec1846a94e2e1e8f9b0012f557f0c46fe4f3eb0d7a87afcf90b
# via
# pyopenssl
# rfc3161-client
# sigstore
dnspython==2.9.0 \
--hash=sha256:9a4aedb833c3c1b49214d04d44d3032ab7a9135f7c1d29a549b4ff78fd82fda9 \
--hash=sha256:b44dc6b18f07a8b1c56676a19fbfdb5209415b046a9cece286baafa87ff3f7f1
# via email-validator
email-validator==2.3.0 \
--hash=sha256:80f13f623413e6b197ae73bb10bf4eb0908faf509ad8362c5edeb0be7fd450b4 \
--hash=sha256:9fc05c37f2f6cf439ff414f8fc46d917929974a82244c20eb10231ba60c54426
# via pydantic
id==1.6.1 \
--hash=sha256:d0732d624fb46fd4e7bc4e5152f00214450953b9e772c182c1c22964def1a069 \
--hash=sha256:f5ec41ed2629a508f5d0988eda142e190c9c6da971100612c4de9ad9f9b237ca
# via sigstore
idna==3.20 \
--hash=sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44 \
--hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c
# via
# email-validator
# requests
markdown-it-py==4.2.0 \
--hash=sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49 \
--hash=sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a
# via rich
mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
# via markdown-it-py
packaging==26.3 \
--hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \
--hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c
# via -r .github/release-signing-requirements.in
platformdirs==4.13.3 \
--hash=sha256:5e567f664eb087ab8521c0179cd8d1bd60857d271136567a39719e28e2d383ce \
--hash=sha256:f6ad7f447f24f8a3b82cce5976387428bff894a0eca6c3488f4a17f153c130c4
# via sigstore
pyasn1==0.6.4 \
--hash=sha256:9c447d8431c947fe4c8febc4ed9e760bc29011a5b01e5c74b67025bd9fb8ce81 \
--hash=sha256:deda9277cfd454080ec40b207fb6df82206a3a2688735233cdcd8d3d565f088b
# via sigstore
pycparser==3.11 \
--hash=sha256:51d5a8ba2be0bbe440b99d2112604c95bbbc3c2748a64260186c541e1729cd80 \
--hash=sha256:d875f09c3507d00e1aba0eecc6dcadc1352f30fff09dc6bff2f1c2935e97c2bc
# via cffi
pydantic==2.14.1 \
--hash=sha256:9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454 \
--hash=sha256:94f478203dd03404682a1ada216965651dd74b1d2d5ffd62e00e0837caab5c26
# via
# sigstore
# sigstore-models
# sigstore-rekor-types
pydantic-core==2.50.1 \
--hash=sha256:0036473f5583e6a60e50b8b21651511564277a3f05cc5dab8cf579f552cd5f6c \
--hash=sha256:0048b6dddc8ef4b64fccaad878bd143b0c3882ea9936279dc11d613f6b7dd1bc \
--hash=sha256:009634b83993777ddcd69cad0ffcace43dabde692109528e35f0fde91e386a8b \
--hash=sha256:028e2f212273d4a39b1ec1e0de8166b1165a65fc0f1111452a9d94fc7c625c63 \
--hash=sha256:062e891facce5ca296a1c37098e5e466780457f86413894b399f0cf22934f769 \
--hash=sha256:06e01fbbfdb9be777b316a71b6c49efaf4a08b615d0a98d678cda3023f79d019 \
--hash=sha256:06ead20d39ffd6f2f6f2a8f8a6de67ff8bb1b4f14a8a30e058502514ee2ac685 \
--hash=sha256:0b3a6f334c6a2345ca15318ff894502a90012536404b37c844a976c76c846e0b \
--hash=sha256:0c003c3b7f49debb893d2d85ae099ac5959c9839e2f330fadb1fcdf7a6594482 \
--hash=sha256:131059670f1d2444269b8585cb888963994871932447c08b39ac6a51fcfef658 \
--hash=sha256:132529c83901437ff642f585216831bf5fd7a91df66829907e155192ead62498 \
--hash=sha256:17e722e156d0444ecaefbe640bdb60928752bf2013e2b7a11cdb099aaae19bec \
--hash=sha256:1a9006395dece0e32e704c315eff8a00bede494f6108546cfc5539c89fef4f9a \
--hash=sha256:1c8632d4ac04e6f91128fca584b3a8a507d81604c24eeaaad00d4be42765c32b \
--hash=sha256:1c96fd793b73d1b92e65570132505498fe7b21eaef73cdf74e67e5dfba7ac9e4 \
--hash=sha256:1cf41f1ae3fa155cf167a72689ad044bcc1e3c97e064123677149bdfb5dafc4a \
--hash=sha256:1deeacb112d14d3f4fcb16b165f7dbaf76c70ba6e82f37ba042bdab51970a0b8 \
--hash=sha256:1ef800dd7d85bcdadf4c3076e4c94e43939493558a3b69a1ea830c706d4617bb \
--hash=sha256:1fa4c8bc12c1354c5550c0c35c1852c8c1901e89e06561724e03f8d0342e1f87 \
--hash=sha256:2005207aafe1231315718bf6ed5d064a7300fb4772754af35ee72fc68159492e \
--hash=sha256:23923ab9292c40da026330b1ecf4dc2618c8e86e0422e5d1fbf50d94d64ca4f8 \
--hash=sha256:23edad659e8dbd8ca7e4e877fe6c81573abbdf215bd25a68b53e1272f58b80c7 \
--hash=sha256:2ab756b72bd5054e4c7ef3ded331b35786cbd3cf931531a508f79a9537517064 \
--hash=sha256:2cbd1b75b09e976ed0d6b6ca297675632ca35df86130088457cdc60ef36970ae \
--hash=sha256:2cf91809d0721ab81592ba67bea7694821679c10b1a2e3c3460082b286c1918a \
--hash=sha256:2df1ff41884de2bc4b307bafd7c40a691094fad2ff8e767e5b45a319257bcf4e \
--hash=sha256:2eb75304506894a281d346220a4f7481a1b8729577c5ed2a05395991966a8396 \
--hash=sha256:2eedf82ee4753cdab8e50044c6bd569577eebc3859b11fecf4eb9223761ff966 \
--hash=sha256:30ddf019d082c117b5d309e5b86710c2a78909907ec1a9381feec3eec02eca0b \
--hash=sha256:325c23f3e35cfbf0fe3486fa5f7260d1e45885173002d30a28ca019994124255 \
--hash=sha256:32fad3a91e51b6d2039c572db04a5a873260b399f6bd62c3552671fa7a4a2899 \
--hash=sha256:36c426eac0af8d1529ff8467e612b933346caec1fdc0d774f78f67a1a11e16c1 \
--hash=sha256:3a5fce22f1e87d181e924e12da7d81cfe031fb3881a5ddf26ad28f141756ca43 \
--hash=sha256:3aa9de446b793de2beb6fa2d9d0961803126c4e2a99c2f25ab59b9fd6ea125c0 \
--hash=sha256:3e46a9eb0a0901dd6275e6b06ac3a464885ef350ec4121fe486869de8053e4bb \
--hash=sha256:3fde4fdc6487a58d944ca87cf5adc95d5f266e872c19599f5f4c0a8a1b1f9f9f \
--hash=sha256:409e0ea40ec30d9158f33574fd758e689f6045a0f2596701828c27816ca9687d \
--hash=sha256:40f523349960fa30f3ea51404308ff50f9997a90df639590f47a057c1f32b415 \
--hash=sha256:41bc8237121bd8dc8d888dfd6279fc166ffc88c1f1bf3a8bf00869680533ca4c \
--hash=sha256:42b54c2c90ad348b5e3a85e03e715d572c1fde357ef104cdfe3b03b697a404ea \
--hash=sha256:455a773617b5913bf5c20d0692e5787b119e52c4d40ea644ca31f5758fd31be2 \
--hash=sha256:45b11cac094aa25725581d9304eee93c9028516b9ea80dd9e175e13a5a2c840e \
--hash=sha256:45c6266d071c241f2a168d45bf8c54344f0effce35e7e6b73afdec11f3687568 \
--hash=sha256:46b3301d3b5c886f77de7546e47274a5842c622ea2020b8c6524c6b66913b4a6 \
--hash=sha256:476f6ed8e43cd1e0b460920e23571700872b284e77331cb30c4faf459cf48a4b \
--hash=sha256:48569b0ade9edfbe065cad1d700175546592aebbb42f02adcebcc26e75b896fe \
--hash=sha256:49c2cbb2397fe4d0987e84606e691af6cb87bc0ee1bd3e7b737f7e10b4c142f9 \
--hash=sha256:4a53d13cdfbedbfa87f08b83c1a0a5efcc767d785a4b41934fa9cb672670493a \
--hash=sha256:4be846f55c9477f5f3ddde8f2ce941137e16862a56d018ed885d422bb6ae02f2 \
--hash=sha256:4df197990c15b5a37c5a277d131d9f2c67de6133f2e5dafd80d9bba4b99f46f9 \
--hash=sha256:4e834f6a8e4ff772dcc34f58ef5504147a3ea5b0f4eeb13b0f8eb2ca75ac57f1 \
--hash=sha256:57f51b31ff826e2859120cf4737c5a758a48d96f3e97da40ccee1796d58078ff \
--hash=sha256:5958c72adb417c39b12ac87525ac60b0d73315fcdc59e21f44ee4a5e2512c9ef \
--hash=sha256:5dfe41f232befddb9c4377f6cfc702b51595e2d78ed082672adf8758d2c4619f \
--hash=sha256:5f3cae32fc46121f787cb2486de9cf95a8bf72aec5cc78f64c606fa1735a6ef5 \
--hash=sha256:64f6047f62a6c5ae08d0a6afb035667aa2d97c3d20d69762e034c5ea144d92a5 \
--hash=sha256:6a733778df2f7087ec1100ed0b41533e4f3001976e99570fa34f57c66e7f8e3e \
--hash=sha256:6b20a4bffabdad0db2927ac034ae3b8a681b1f7a0182f3e60b479ad2fde21ebb \
--hash=sha256:6dbcbee53bf17196a7f745aa9bf5a9603953a1e365b1f020be3207c676a3e7c4 \
--hash=sha256:6ed4f3cef55164b026fefb41341b7754cc6b624c75dfe7142d2ecceb5ad21c87 \
--hash=sha256:704075d10b74f2f3c6e15407c696d88701df35fc8953f434a431add0d0074db0 \
--hash=sha256:739dc730e6be3bd5ec2f4ab5cfc7eb047cc45fc1497b3bafec74ff2ed07df597 \
--hash=sha256:7456d699b13954e9c0164dcb267250a10ae0dfb03e6e26d6796ab0d46e189c84 \
--hash=sha256:756d669f04e62ec4148ecfe22be6a4484d9b1181a6ef32e205ebfd200540858b \
--hash=sha256:7689580e72a642ab5ec64d5f55b2e33636fa43b4ebe63c0c2c965ef307c7d1aa \
--hash=sha256:76e2e83fa6ec8cdc972d438dafc2522b3a47bee4ec0ae668b29cfb1977ab5242 \
--hash=sha256:7816e98acc08119dc0f340ab167048ecc54126316330c1f0caf7c6756c88e28f \
--hash=sha256:79490e33c4c0fcb933bbbcfc3a62184d8803b99f535863dfbb925e1bcb6945ad \
--hash=sha256:7f476456ac2bb0d937f75191494a09c83a30765fea4f70f3b404942fe25f6cdf \
--hash=sha256:844b869f118e22a41a091bdcedda8a71bc1b0f62c38d1a0c3211cece47e1d8fc \
--hash=sha256:84bc765b282a9d5b7fe0348b8648904f25a6a04b2139da52b1dd30c8ac3a2c8f \
--hash=sha256:84f34323a61a365b4e9295de6028474754829aaddd59c7bf1a040e7487ef8f3c \
--hash=sha256:8812592c85d0edf423f10eadcef42716d71e8219085ad9e85b775057b7306133 \
--hash=sha256:88e492e8b9d0312e7dc13667c30222abf284dc3b79b5302b3607b41a5784ce61 \
--hash=sha256:8a6791afa2245e6c6b180122d105941644f5bd410bb18623b408808cc41a3102 \
--hash=sha256:8b4c3df25bd323bf1d36a648d563cf1fc69d717451569927151bdad7cad07a77 \
--hash=sha256:8daa7ee75245d43ad7d747e5c9ecc1b1d06552f72b14887e9276f787d57375f4 \
--hash=sha256:93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e \
--hash=sha256:94845ff54dc5193f228cab81b2662a04bfbb892e95bdc15edf7399000ce57d54 \
--hash=sha256:94be440c03fede26969a5ce75468e0e6a9927a1b46d9b679ee8adc1b057b0350 \
--hash=sha256:9572c1369e9c9da2d64a7b7992c786d90ff295abc93964cfe3125e4290768070 \
--hash=sha256:983a662de2571cb2502fc8ff47b6770b03d025d2eb314c92f77b3f07c74720ed \
--hash=sha256:992c3514ec891fa7858099183e4d64e6bd5a5d4ff452fae29df22faa77a006bb \
--hash=sha256:99ba9bc2b8062ea0c326a990f7f00e6530c23579de66dd246e72c4cafef950a5 \
--hash=sha256:9d1bed94af6a63835461f3cf7502058eb166c58c4778e11d0f433cfb1bd69e19 \
--hash=sha256:9e4472072de0137ee0d8e72d6620e85939c271d2f90f6bbb4b15c24638b79f92 \
--hash=sha256:a27c09d86600f1bf2fe3f37e1ae697faf3143931c09322cd799da94deee923b5 \
--hash=sha256:a29a061fec0b4e2d714f277e70a3a18125ecff803f2fea6eade2f2e53711d112 \
--hash=sha256:a3cda0e538208e5d722bbf3698b24f19c0a7d05bc8d5f8a7f9b121ea7fa243d9 \
--hash=sha256:a44101320cfe99432db74237545a63057dc7a88dfe792cbcad0647f2af56cb81 \
--hash=sha256:a4aaaa791bdae1c972a7e81765f4f3571c926b8e0b9b6e47346499fb80079665 \
--hash=sha256:a51eee75939cf811ac09b278745a6cee7dc873ccfbc8b9af3cc88fe4b7ce25b5 \
--hash=sha256:a7c58106de36ac6a56314182958de20db8d3a29dfd5db527192cc754e4f8e7fb \
--hash=sha256:aa8224f10880d9bf1b5993988ba153d42a8b4f3f4f511f93b1f09c93ff613c72 \
--hash=sha256:acbf31f37c53a5ac0c34706c80b4f5107ba20b05fdd3816124bf236ef0c57dd2 \
--hash=sha256:adc06d218a1cadfd2ec4628424d7d79ce4eba69c2965e7e7b55106f0da5208c8 \
--hash=sha256:ae28183297fb0d2b8dc46a1f01d51f5e45825fc5afe76a835a6cb7fb34821295 \
--hash=sha256:b0135bcdcaa0f23573f286e4cb5e0fd2962700964ed13df085b85f2b97aeab9e \
--hash=sha256:b087b1c5be7ac687cf22eabfe4b6b608d40df23610651e93611e1f49118baf84 \
--hash=sha256:b0d955195bbbe489ad343fcc956eacea9357b79cb22192c66cacdefcbc14b32f \
--hash=sha256:b281a3b0f0822618fe5e3e0d8a2048b6356b14388505dc9374ccffeb69989713 \
--hash=sha256:b6d0c2183008c188e19f4906d426b293bdc4f67ab17df8e180fe16cda208fa71 \
--hash=sha256:bbce99252ba3167b2b6277f1829d5bf4b43b754524bddf7f944707c3db7d2253 \
--hash=sha256:bc1f08f68dac9f9e83845a8039880aba2ab553eb9b2259c3243a313182c253fe \
--hash=sha256:bc94f474417604bd383d2cd445d071b07dd55fedceed3ce33407bf1fcc107290 \
--hash=sha256:bed5163e03b98bc1fa2eb05d74c63d9c5c95d8ed6254985481640fbf5e237dea \
--hash=sha256:c17799a62c142d61b8a3c51752a7cbc87fe2ad4ccfab10e628a77b405075c662 \
--hash=sha256:c18db21573bd2c6489f9a544b7499f0df2853958c568e5e783536ee1f690af41 \
--hash=sha256:c3ede305158e75510be50869b319550ab072008c13d64d4ab1e094fb286b6f44 \
--hash=sha256:c516cc5367ca3448995d42cb994bf3f4c9002d2a7c22eac9622551269ad1b807 \
--hash=sha256:c531166c42ea7bdfecc8c50049581f05dd1993b09cc7c52bb36a14e96deaec7d \
--hash=sha256:c73622ef819328873b53109ee4f77ceb598bffedd02daf916102be3228866b78 \
--hash=sha256:c8dce1f1e0e5358b682a6ad3fa5e31b31d4560997b8e61417e9217c8d60f8a0c \
--hash=sha256:cb57f304525a5e3c13333b772bf9a473f36326e9c821b2e8e1b2fd36f80ae2c3 \
--hash=sha256:ce8c25ca38cc0e3d7753ba180808de2c0c8cb24eae0df64491e40921454e9831 \
--hash=sha256:ceff0acc940be2715bd6ad17b24c0e5304abf44f6efd0f81ee8499e640f9dc86 \
--hash=sha256:cf356f70551d40374eaffb1aa63f1eb6d2006681cbd7a9faea173ce0f4dd7cd2 \
--hash=sha256:d2d82aa62521c55ddfb000ae70f88cdd8de974078f6024e821dfe5addd0c818f \
--hash=sha256:d32f3acc081cc3923386d88f422cde8892335e95f034e0104bb4cf9310d9915f \
--hash=sha256:d4193206b6587047437f6f11d7e776df23e1c1e23af2a54d9347275614791e10 \
--hash=sha256:d5c0e32fdbce7f1e8ef4d11f655694bf5f4175c757a9f1dc2be09b8864e5bcf5 \
--hash=sha256:d5e062c01286d861fd6a1c4ff6e063547b3e713067f2df033c0ff97ac2ca006b \
--hash=sha256:d8f9e8a6c4ab04b78d61f78627370d834eb004b2869dcb28cfffa647b4ea1980 \
--hash=sha256:d939de9c82e2126f7f48a7e658f8a85ed46d57662d53f44c49b8895fe94a3eb7 \
--hash=sha256:de531ce1e2a3364e8767878b58f4ff728a434b4fde089781fe30b1e08e2396e0 \
--hash=sha256:e50d7b94baac6c7d09927fa5ca5800a0c7ee5015c7fcff65beb3a1931b5a6e09 \
--hash=sha256:e5faeaee74a57d32b3ab3aebad2e348f06d3ba946fc5d28c1728455f00a3d13a \
--hash=sha256:e6f0cc1bb9900dc558960894adeb30b0c083366fc1d69b856209fb2ca5c36fe5 \
--hash=sha256:e8e1d6ce820aa23317e8209a86bd65a540973c12dc7552b48a4f6c8e9926815e \
--hash=sha256:ed1e728b39a383c81035b2459cfcb35d99dfb01f7d6ebe3a913bc1cc5b81e459 \
--hash=sha256:ee6db2fbed51a7991302e8fac498cd67e336246026d0dfa84cf5166ce1412760 \
--hash=sha256:efbecf43d321f7b9281441f1f213f7c21c66988b0e06c2730ba13ed47a46bb08 \
--hash=sha256:f2c634642694e6a0dad2ab1d375589fa671fd442edd5caf7d9737b8f6ca22906 \
--hash=sha256:f3377c8c2b3ce898423c5e5dd94c7982e30aa7717a7e6ab2470b9de364963709 \
--hash=sha256:f5187624823423e1d1b82b1072ac41dc837389e18d3d0572cc19bbee46cd550a \
--hash=sha256:f77ac30b19221cd9bd3fcfa3d4614eff93140d0572ab730cded17b64adca05f3 \
--hash=sha256:fe90228920fd8ff2be62622b6bb8a2b11acd65046d50c6b130614b5879605a20
# via pydantic
pygments==2.21.0 \
--hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \
--hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c
# via rich
pyjwt==2.15.1 \
--hash=sha256:42d59d631f7768a1028a64c7ff581a9bf7519804daf91fc5b6c56e30eec5e193 \
--hash=sha256:4f259e80cdfb6b3fc18a7de51fd1ef9ec79652f25019bae68975ca2468a34df8
# via sigstore
pyopenssl==26.4.0 \
--hash=sha256:28dfcce0162b9211413e26dfbfdf1d24317fbeba18fc93c12400a1856b2a0bc7 \
--hash=sha256:f0eb0cb2d581d3ad2b9c489468485e7f2ab6727d08401bcf9d824c3caddf3c1c
# via sigstore
requests==2.34.2 \
--hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \
--hash=sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed
# via sigstore
rfc3161-client==1.0.9 \
--hash=sha256:03be7ac7919c7f4c566076b07773b81b1f1b28d447fa91c6960fb5f82fac5bc1 \
--hash=sha256:0ac247d5aa22f3514d1e284bdc547d2ad5f101e1e5d7f6db25db2ab3a0c59f06 \
--hash=sha256:4d33f5aaec2974239e1c62a79a6fcf32506b09095482377a8b5be3a00fa67dfb \
--hash=sha256:5e619d7e28ffa3a46685923e6d6ba4ce2e74cb09a41c77995a0702cc1a533bc4 \
--hash=sha256:614da494c6f8850c5d6d98c23bc291a4e4dbf2c3c9082d9907fa156f9e4a75c6 \
--hash=sha256:66997415086d2c6e5d57a2d315157b32a9c3f4f1312877ca8eb55e2e0ddf8ce4 \
--hash=sha256:7b703b233dbee7228d117d5f1c118363c61d523fa6f018c9217c79e3c6684f86 \
--hash=sha256:8208999e94e1252e3f5f748f5efe59d3b9c308d04c7626be1becfbf3236c9de4 \
--hash=sha256:908f6a775da4bdce1d39f825a4431f389542696078ef3e4ed911a068bcaf1792 \
--hash=sha256:a7004edfbf1bb7ec7801978a39fa7a7fe385ca59673df90d7578079b6eba3b24 \
--hash=sha256:d3cbf1991b6f3457efcb25e1d31179cac556112e6d3e65ec9e0fd70c6e9af90d \
--hash=sha256:d4cf92f0e784ff02ff5ea1c574f8521f30953dc178092424126dbd8348034f93 \
--hash=sha256:fac3f440a507555e684dc5daba75e33dc08f0f45fdefa48448f19001233a6b21
# via sigstore
rfc8785==0.1.4 \
--hash=sha256:520d690b448ecf0703691c76e1a34a24ddcd4fc5bc41d589cb7c58ec651bcd48 \
--hash=sha256:e545841329fe0eee4f6a3b44e7034343100c12b4ec566dc06ca9735681deb4da
# via sigstore
rich==15.0.0 \
--hash=sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb \
--hash=sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36
# via sigstore
securesystemslib==1.5.1 \
--hash=sha256:4b8d00abd93707ead10b69eb2b8582376a1364de3b0a71077de534c2ef4985e0 \
--hash=sha256:ada8bdf817da29ece4ba91654f6a162ce7cfbadbc3ae3f840f7313f9d22675de
# via tuf
sigstore==4.5.0 \
--hash=sha256:020d3e07f622b2916bf453e66ff6ff0711e1fdc5ab69e8bd8902f71d9fcb316f \
--hash=sha256:f045b207f2e12605cf775ec38e89c5eda625d71ffa7830477db65e47ec2bc8b2
# via -r .github/release-signing-requirements.in
sigstore-models==0.0.6 \
--hash=sha256:5201a68f4d7d0f8bec1e2f4378eb646b084c52609a4e31db8c385095fff68b2e \
--hash=sha256:c766c09470c2a7e8a4a333c893f07e2001c56a3ff1757b1a246119f53169a849
# via sigstore
sigstore-rekor-types==0.0.18 \
--hash=sha256:19aef25433218ebf9975a1e8b523cc84aaf3cd395ad39a30523b083ea7917ec5 \
--hash=sha256:b62bf38c5b1a62bc0d7fe0ee51a0709e49311d137c7880c329882a8f4b2d1d78
# via sigstore
tuf==7.0.1 \
--hash=sha256:5ada1db78da3518fa851e28588f4b2249b8662a28ae528f54afa2a1de541fb31 \
--hash=sha256:d30434bda6e079ab303fb30d1b3006d939a10ca34783b1573d61cd9b802fa45c
# via sigstore
typing-extensions==4.16.0 \
--hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8 \
--hash=sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5
# via
# pydantic
# pydantic-core
# pyopenssl
# sigstore-models
# typing-inspection
typing-inspection==0.4.4 \
--hash=sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47 \
--hash=sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147
# via pydantic
urllib3==2.8.0 \
--hash=sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3 \
--hash=sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63
# via
# id
# requests
# tuf
+59 -404
View File
@@ -1,15 +1,35 @@
name: Test Suite
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- docs/**
- .agent/**
- .github/ISSUE_TEMPLATE/**
- AGENTS.md
- CLAUDE.md
- COMMUNICATION.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
- webui/README.md
pull_request:
branches: [main]
paths-ignore:
- docs/**
- .agent/**
- .github/ISSUE_TEMPLATE/**
- AGENTS.md
- CLAUDE.md
- COMMUNICATION.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
- webui/README.md
concurrency:
# Re-runs retain their original SHA; only checks of the same revision may supersede each other.
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
@@ -21,37 +41,43 @@ jobs:
runs-on: ubuntu-latest
outputs:
python_required: ${{ steps.paths.outputs.python_required }}
webui_required: ${{ steps.paths.outputs.webui_required }}
tui_required: ${{ steps.paths.outputs.tui_required }}
docker_required: ${{ steps.paths.outputs.docker_required }}
native_required: ${{ steps.paths.outputs.native_required }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Select checks by affected contracts
- name: Detect Python-relevant changes
id: paths
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
run: >-
python scripts/ci_scope.py --event "$EVENT_NAME"
--base "$BASE_SHA" --head "$HEAD_SHA"
run: |
python_required=true
if [[ "$EVENT_NAME" == "pull_request" ]]; then
diff_range="${BASE_SHA}...${HEAD_SHA}"
else
diff_range="${BASE_SHA}..${HEAD_SHA}"
fi
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null &&
changed_files="$(git diff --name-only --no-renames "$diff_range")" &&
[[ -n "$changed_files" ]] &&
! grep -qvE '^(webui/|nanobot/channels/[^/]+/webui/|docs/)' <<< "$changed_files"; then
python_required=false
fi
echo "python_required=$python_required" >> "$GITHUB_OUTPUT"
test:
name: Python (${{ matrix.name }})
needs: changes
if: needs.changes.outputs.python_required == 'true'
runs-on: ${{ matrix.os }}
# Windows runs real isolated update jobs before the complete compatibility
# suite; that suite was still progressing at the former 20-minute job cap.
timeout-minutes: ${{ matrix.os == 'windows-latest' && 30 || 20 }}
env:
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
@@ -60,23 +86,19 @@ jobs:
os: ubuntu-latest
python-version: "3.11"
coverage: false
# Keep exact Rich output and real prompt_toolkit pipes in a fresh
# CLI process: long-lived workers can exceed select()'s fd limit.
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
pytest_args: ""
- name: latest, 3.14 + coverage
os: ubuntu-latest
python-version: "3.14"
coverage: true
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
pytest_args: ""
- name: Windows, 3.14
os: windows-latest
python-version: "3.14"
coverage: false
# Process identities run serially; isolated update jobs use case-level
# scheduling below so one file cannot serialize all real venv work.
# Bound real persistence contention: six workers can delay session
# startup beyond its watchdog. Keep every assertion and test enabled.
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py --ignore=tests/test_install_scripts.py --ignore=tests/test_update_jobs.py --ignore=tests/test_update_profiles.py --ignore=tests/test_update_stop.py"
# Real PowerShell/process-tree tests run serially below. Keep
# them out of xdist so workers never share a Windows console.
pytest_args: "-n 2 --dist loadfile --ignore=tests/tools/test_exec_platform.py"
steps:
- uses: actions/checkout@v4
@@ -86,15 +108,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Check Python import boundaries
if: matrix.coverage
run: python -m scripts.check_import_boundaries
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
@@ -103,81 +118,27 @@ jobs:
- name: Install dependencies
run: uv sync --all-extras --dev
# Feishu selects websockets<16. Check the default transport before the
# all-channel suite exercises the older compatible resolution.
- name: Test default WebSocket transport
run: >-
uv run --no-sync python -m pytest -q
nanobot/channels/websocket/tests/test_handshake_disconnect.py
nanobot/channels/websocket/tests/test_binary_http.py
- name: Install channel dependencies
run: uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
- name: Verify dependency consistency
run: uv pip check
- name: Install pipx for offline installer checks
if: runner.os == 'Linux'
shell: bash
run: |
uv tool install pipx==1.17.12
uv tool dir --bin >> "$GITHUB_PATH"
# Channel requirements live in manifests rather than uv.lock. Avoid a
# later uv run sync pruning the packages installed by the previous step.
- name: Lint with ruff
if: matrix.coverage
run: uv run --no-sync ruff check nanobot tests conftest.py scripts/check_import_boundaries.py scripts/pytest_timing.py scripts/ci_scope.py scripts/ci_gate.py scripts/native_acceptance_input.py scripts/verify_packaged_update.py
run: uv run --no-sync ruff check nanobot tests conftest.py
- name: Type check with BasedPyright (strict)
if: matrix.coverage
run: uv run --no-sync basedpyright
- name: Check Windows update coordination before the full suite
if: runner.os == 'Windows'
# Real gateway startup/stop must not compete with the parallel package
# and session-index fixtures. Keep its startup and lease assertions intact.
run: >-
uv run --no-sync python -m pytest
tests/test_installation_lock.py
tests/test_update_profiles.py
tests/test_update_stop.py
tests/utils/test_helpers.py::test_atomic_record_reader_does_not_block_concurrent_replacement
tests/gateway/test_runtime.py::test_runtime_state_publish_keeps_existing_snapshot_readable
tests/gateway/test_runtime.py::test_runtime_state_reader_does_not_block_publish_while_decoding
-q --junitxml=test-results/coordination.xml --timing-report=test-results/coordination.json
# Each update job owns its venv, HOME, profile and lock directory. Preserve
# the real installation/restore checks, but avoid a loadfile straggler and
# disk contention with timing-sensitive runtime-registration checks.
# Three concurrent offline pip fixture installs exceeded their 60s bounds.
# Reduce startup contention; keep every command deadline and lease assertion.
- name: Run Windows isolated update jobs
if: runner.os == 'Windows' && github.event_name != 'push' && needs.changes.outputs.native_required == 'true'
run: >-
uv run --no-sync python -m pytest tests/test_update_jobs.py
-n 2 --dist load -vv --durations=25 --durations-min=1.0
--junitxml=test-results/update-jobs.xml --timing-report=test-results/update-jobs.json
- name: Run tests with coverage
if: matrix.coverage
run: >-
uv run --no-sync python -m pytest
${{ matrix.pytest_args }}
--cov=nanobot --cov-report=term-missing:skip-covered
-o faulthandler_timeout=60
--junitxml=test-results/main.xml --timing-report=test-results/main.json
--durations=25 --durations-min=1.0
- name: Run serial CLI input and command tests with coverage
if: matrix.coverage
run: >-
uv run --no-sync python -m pytest
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
--cov=nanobot --cov-append --cov-report=term-missing:skip-covered
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
--durations=25 --durations-min=1.0
- name: Run compatibility tests
@@ -185,125 +146,16 @@ jobs:
run: >-
uv run --no-sync python -m pytest
${{ matrix.pytest_args }}
-o faulthandler_timeout=60
--junitxml=test-results/main.xml --timing-report=test-results/main.json
--durations=25 --durations-min=1.0
- name: Run serial CLI input and command compatibility tests
if: ${{ !matrix.coverage }}
run: >-
uv run --no-sync python -m pytest
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
--durations=25 --durations-min=1.0
- name: Upload Python test timings
if: always()
uses: actions/upload-artifact@v4
with:
name: python-timings-${{ matrix.os }}-${{ matrix.python-version }}
path: test-results/
retention-days: 7
windows_process:
name: Python (Windows process compatibility)
env:
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
needs: changes
if: needs.changes.outputs.python_required == 'true'
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
# Keep this focused job on the affected pre-3.14 ctypes runtime family;
# the full Windows suite above continues to cover the latest Python.
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Install channel dependencies
run: uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
- name: Verify dependency consistency
run: uv pip check
- name: Run Windows process compatibility tests
if: runner.os == 'Windows'
run: >-
uv run --no-sync python -m pytest
tests/tools/test_exec_platform.py
tests/cli/test_wsl_browser.py
tests/gateway/test_runtime.py
--junitxml=test-results/process.xml --timing-report=test-results/process.json
--durations=25 --durations-min=1.0
- name: Upload Windows process test timings
if: always()
uses: actions/upload-artifact@v4
with:
name: python-timings-windows-process
path: test-results/
retention-days: 7
windows_installers:
name: Python (Windows installer compatibility)
needs: changes
if: github.event_name != 'push' && needs.changes.outputs.python_required == 'true' && needs.changes.outputs.native_required == 'true'
runs-on: windows-latest
# Two installer workers retain the per-command 90s deadline without four
# concurrent PowerShell/venv cold starts competing on the same Windows VM.
timeout-minutes: 40
env:
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Install pipx for offline installer checks
shell: bash
run: |
uv tool install pipx==1.17.12
uv tool dir --bin >> "$GITHUB_PATH"
# Each case owns an isolated manager/config root. Four concurrent starts
# exceeded the command deadlines; reduce contention, not test coverage.
- name: Run Windows installer checks
run: >-
uv run --no-sync python -m pytest tests/test_install_scripts.py
-n 2 --dist load -x -vv --durations=10
--junitxml=test-results/installers.xml --timing-report=test-results/installers.json
- name: Upload Windows process test timings
if: always()
uses: actions/upload-artifact@v4
with:
name: python-timings-windows-installers
path: test-results/
retention-days: 7
webui_checks:
name: WebUI static checks
needs: changes
if: needs.changes.outputs.webui_required == 'true'
webui:
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -313,7 +165,7 @@ jobs:
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
bun-version: 1.3.6
- name: Verify npm lockfile
working-directory: webui
@@ -323,148 +175,19 @@ jobs:
working-directory: webui
run: bun install --frozen-lockfile
- name: Check WebUI import boundaries
working-directory: webui
run: bun run check:imports
- name: Test client import checker with WebUI dependencies
working-directory: webui
run: bun run test:imports
- name: Test CI shard planning and failure gates
working-directory: webui
run: bun run test:ci
- name: Lint WebUI
working-directory: webui
run: bun run lint
- name: Type check WebUI and unit tests
- name: Test WebUI
working-directory: webui
run: bun run typecheck
run: bun run test:coverage
- name: Type check browser tests and fixtures
working-directory: webui
run: bun run typecheck:browser
webui_build:
name: WebUI production build
needs: changes
if: needs.changes.outputs.webui_required == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install WebUI dependencies
working-directory: webui
run: bun install --frozen-lockfile
- name: Type check production sources and build WebUI
- name: Build WebUI
working-directory: webui
run: bun run build
webui_unit:
name: WebUI unit and coverage
needs: changes
if: needs.changes.outputs.webui_required == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install WebUI dependencies
working-directory: webui
run: bun install --frozen-lockfile
# Vitest 2's Istanbul blob merge can mark an unhit inner branch covered
# using another shard's outer range. Keep the original full V8 coverage gate.
- name: Run all unit tests with original coverage thresholds
working-directory: webui
run: bun run test:coverage --reporter=default --reporter=json --outputFile.json=test-results/unit/results.json
- name: Retain unit and coverage results
if: always()
uses: actions/upload-artifact@v4
with:
name: webui-unit-coverage
path: |
webui/test-results/unit/results.json
webui/coverage/coverage-summary.json
if-no-files-found: error
overwrite: true
retention-days: 7
webui_browser:
name: WebUI browser (${{ matrix.shard }}/4)
needs: changes
if: needs.changes.outputs.webui_required == 'true'
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install WebUI dependencies
working-directory: webui
run: bun install --frozen-lockfile
- name: Install browser for layout regressions
working-directory: webui
run: bun x playwright install --with-deps chromium
- name: Test full-suite browser shard with real layout and motion
working-directory: webui
run: bun run test:browser:shard --shard=${{ matrix.shard }}/4
- name: Retain browser timings and failure details
if: always()
uses: actions/upload-artifact@v4
with:
name: browser-results-${{ matrix.shard }}
path: |
webui/test-results/browser/results-*.json
webui/test-results/browser/**/trace.zip
webui/test-results/browser/**/test-failed-*.png
webui/test-results/browser/**/error-context.md
if-no-files-found: error
overwrite: true
retention-days: 7
webui:
needs: [changes, webui_checks, webui_build, webui_unit, webui_browser]
if: always() && needs.changes.outputs.webui_required == 'true'
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Require every full-suite WebUI lane to pass
env:
CHECK_RESULTS: ${{ toJSON(needs) }}
run: |
python - <<'PY'
import json
import os
failed = {name: job["result"] for name, job in json.loads(os.environ["CHECK_RESULTS"]).items()
if job["result"] != "success"}
if failed:
raise SystemExit(f"WebUI checks did not all pass: {failed}")
PY
tui:
needs: changes
if: needs.changes.outputs.tui_required == 'true'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
@@ -484,21 +207,11 @@ jobs:
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
# Build with baseline Bun directly: its Windows cross-target extractor is unreliable.
bun-download-url: ${{ runner.os == 'Windows' && 'https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/bun-windows-x64-baseline.zip' || '' }}
- name: Install TUI dependencies
working-directory: tui
run: bun install --frozen-lockfile
- name: Check TUI import boundaries
working-directory: tui
run: bun run check:imports
- name: Test client import checker with TUI dependencies
working-directory: tui
run: bun run test:imports
- name: Check TUI
working-directory: tui
run: bun run check
@@ -512,10 +225,11 @@ jobs:
working-directory: tui
run: python3 scripts/pty_smoke.py
- name: Set up Python for native package acceptance
- name: Set up Python for ConPTY smoke test
if: runner.os == 'Windows'
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'
- name: Test TUI in a real ConPTY terminal
if: runner.os == 'Windows'
@@ -529,15 +243,6 @@ jobs:
working-directory: tui
run: bun run build
- name: Retain compiled TUI size evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: tui-size-${{ runner.os }}
path: tui/dist/*.size.json
if-no-files-found: ignore
retention-days: 7
- name: Verify licensed Linux release archive
if: runner.os == 'Linux'
working-directory: tui
@@ -553,17 +258,9 @@ jobs:
bun scripts/release-notices.ts win32-x64
python scripts/package-release.py win32-x64
native:
name: Native package acceptance
needs: changes
if: github.event_name != 'push' && needs.changes.outputs.native_required == 'true'
uses: ./.github/workflows/native-acceptance.yml
docker:
needs: changes
if: needs.changes.outputs.docker_required == 'true'
runs-on: ubuntu-latest
timeout-minutes: 35
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -571,32 +268,6 @@ jobs:
- name: Build image with default channel dependencies
run: docker build -t nanobot:test .
- name: Verify first-boot gateway and WebUI
run: python scripts/docker_compose_smoke.py --image nanobot:test
- name: Check out the real previous release for retained-volume acceptance
uses: actions/checkout@v4
with:
ref: 1bb712d3488915ca4ed9ccc1a93067ff722f5ab9 # v0.3.5
path: .docker-baseline
persist-credentials: false
- name: Verify old-image upgrade without replacing user data
run: |
docker build -t nanobot:baseline .docker-baseline
python scripts/docker_upgrade_smoke.py --baseline-image nanobot:baseline \
--image nanobot:test --version "$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" \
--source-commit "$GITHUB_SHA" \
--output "$RUNNER_TEMP/docker-upgrade-report.json"
- name: Retain Docker upgrade acceptance report
uses: actions/upload-artifact@v4
with:
name: docker-upgrade-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/docker-upgrade-report.json
if-no-files-found: error
retention-days: 7
- name: Verify Docker Compose startup and privilege boundary
env:
HOME: ${{ runner.temp }}
@@ -629,7 +300,7 @@ jobs:
from pathlib import Path
config = json.loads(Path(os.environ["RUNNER_TEMP"], "bwrap-compose.json").read_text())
for service_name in ("nanobot-gateway", "nanobot-cli"):
for service_name in ("nanobot-gateway", "nanobot-api", "nanobot-cli"):
service = config["services"][service_name]
assert {"CHOWN", "SETGID", "SETUID", "SYS_ADMIN"} <= set(service["cap_add"])
assert "no-new-privileges:true" in service["security_opt"]
@@ -643,19 +314,3 @@ jobs:
docker run --rm --user 1000:1000 --entrypoint sh nanobot:test -c
'test -w /app/.venv && test ! -w /app && test ! -w /app/nanobot &&
python -m scripts.install_channel_dependencies discord && python -c "import discord"'
required:
name: CI required
needs: [changes, test, windows_process, windows_installers, webui_checks, webui_build, webui_unit, webui_browser, webui, tui, docker, native]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Require every selected check
env:
CHECK_RESULTS: ${{ toJSON(needs) }}
EVENT_NAME: ${{ github.event_name }}
run: python scripts/ci_gate.py
-149
View File
@@ -1,149 +0,0 @@
name: Native package acceptance
on:
workflow_call:
inputs:
candidate:
description: Download exact candidate wheels instead of building PR test packages
type: boolean
default: false
candidate_commit:
type: string
default: ''
manifest_sha256:
type: string
default: ''
candidate_artifact_id:
type: string
default: ''
platforms:
description: Native runner and wheel pairs; ordinary PRs keep the two-platform budget
type: string
default: '[{"os":"ubuntu-latest","target":"linux-x64","wheel_tag":"manylinux_2_17_x86_64"},{"os":"windows-latest","target":"win32-x64","wheel_tag":"win_amd64"}]'
permissions:
contents: read
jobs:
native:
name: Native acceptance (${{ matrix.target }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(inputs.platforms) }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: oven-sh/setup-bun@v2
if: ${{ !inputs.candidate }}
with:
bun-version: 1.3.13
bun-download-url: ${{ runner.os == 'Windows' && 'https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/bun-windows-x64-baseline.zip' || '' }}
- name: Build native test bundle
if: ${{ !inputs.candidate }}
working-directory: tui
run: |
bun install --frozen-lockfile
bun run build
bun scripts/release-notices.ts "${{ matrix.target }}"
python scripts/package-release.py "${{ matrix.target }}"
- name: Build native test wheel
if: ${{ !inputs.candidate }}
run: |
python -m pip install --disable-pip-version-check build
python -m build --outdir "$RUNNER_TEMP/python-dist"
# The archive verifier imports the installed launcher's dependency stack.
python -m pip install --disable-pip-version-check "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)"
python -m scripts.build_tui_wheels \
--wheel "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)" \
--tui-dir tui/dist --target "${{ matrix.target }}" --out-dir "$RUNNER_TEMP/native-wheel"
- name: Download exact candidate wheel and manifest
if: inputs.candidate
uses: actions/download-artifact@v4
with:
# Producer IDs survive a failed-jobs-only retry without rebuilding bytes.
artifact-ids: ${{ inputs.candidate_artifact_id }}
merge-multiple: true
path: ${{ runner.temp }}/native-wheel
- name: Verify acceptance input identity
env:
CANDIDATE: ${{ inputs.candidate }}
EXPECTED_COMMIT: ${{ inputs.candidate_commit }}
EXPECTED_MANIFEST: ${{ inputs.manifest_sha256 }}
WHEEL_TAG: ${{ matrix.wheel_tag }}
run: python scripts/native_acceptance_input.py
- name: Install acceptance controller dependencies
run: python -m pip install --disable-pip-version-check "$ACCEPTANCE_WHEEL"
- name: Exercise default Windows path policy
if: runner.os == 'Windows'
shell: pwsh
run: |
$key = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
Set-ItemProperty -Path $key -Name LongPathsEnabled -Value 0
if ((Get-ItemPropertyValue -Path $key -Name LongPathsEnabled) -ne 0) {
throw 'Native update acceptance requires LongPathsEnabled=0'
}
- name: Verify clean public installation and startup
run: |
python -I scripts/verify_installed_release.py \
--install-wheel "$ACCEPTANCE_WHEEL" --version "$ACCEPTANCE_VERSION" \
--commit "$ACCEPTANCE_COMMIT" --gateway \
--report "$RUNNER_TEMP/native-install-report.json"
- name: Install ConPTY acceptance driver
if: runner.os == 'Windows'
run: python -m pip install --disable-pip-version-check pywinpty==3.0.5
- name: Install Linux CJK diagram fonts
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y fonts-noto-cjk
- name: Verify packaged terminal interaction and native render latency
run: |
python tui/scripts/native_smoke.py --wheel "$ACCEPTANCE_WHEEL" \
--report "$RUNNER_TEMP/native-tui-report.json"
- name: Verify packaged upgrades and automatic service recovery
run: |
python -I scripts/verify_packaged_update.py \
--wheel "$ACCEPTANCE_WHEEL" --commit "$ACCEPTANCE_COMMIT" \
--output "$RUNNER_TEMP/packaged-update" --workers 2
# Raw acceptance logs contain disposable credentials. Export only structured evidence.
- name: Retain native acceptance evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: native-acceptance-${{ matrix.target }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/native-input.json
${{ runner.temp }}/native-install-report.json
${{ runner.temp }}/native-tui-report.json
${{ runner.temp }}/packaged-update/packaged-update-report.json
${{ runner.temp }}/packaged-update/packaged-update-timings.json
${{ runner.temp }}/packaged-update/*/result.json
${{ runner.temp }}/packaged-update/*/phase-failure.json
${{ runner.temp }}/packaged-update/lane-*/run/*/result.json
${{ runner.temp }}/packaged-update/lane-*/run/*/phase-failure.json
if-no-files-found: error
retention-days: 3
-173
View File
@@ -1,173 +0,0 @@
name: Publish accepted release to PyPI
on:
workflow_run:
workflows: [Validate published release for PyPI]
types: [completed]
workflow_dispatch:
inputs:
version:
description: Published stable release version (without v)
required: true
type: string
destination:
description: Package index
required: true
type: choice
default: testpypi
options:
- testpypi
- pypi
permissions: {}
concurrency:
group: publish-pypi-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || format('v{0}', inputs.version) }}
cancel-in-progress: false
jobs:
verify:
if: >-
github.repository == 'HKUDS/nanobot' && github.ref == 'refs/heads/main' &&
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'release' &&
github.event.workflow_run.head_repository.full_name == github.repository &&
(github.event.workflow_run.path == '.github/workflows/trigger-pypi.yml' ||
startsWith(github.event.workflow_run.path, '.github/workflows/trigger-pypi.yml@'))))
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
actions: read
outputs:
artifact_id: ${{ steps.staged.outputs.artifact-id }}
upload_required: ${{ steps.reconcile.outputs.upload_required }}
release_version: ${{ steps.release.outputs.release_version }}
destination: ${{ steps.release.outputs.destination }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.11'
- name: Install locked verification dependencies
run: |
python -m pip install --require-hashes --only-binary=:all: -r .github/release-signing-requirements.txt
- name: Match the public release to the accepted candidate
id: release
env:
GH_TOKEN: ${{ github.token }}
VERSION_INPUT: ${{ inputs.version }}
DESTINATION_INPUT: ${{ inputs.destination }}
UPSTREAM_TAG: ${{ github.event.workflow_run.head_branch }}
UPSTREAM_SHA: ${{ github.event.workflow_run.head_sha }}
shell: bash
run: |
set -euo pipefail
if [[ "$GITHUB_EVENT_NAME" == workflow_run ]]; then
[[ "$UPSTREAM_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Invalid release tag.' >&2; exit 1; }
VERSION="${UPSTREAM_TAG#v}"
destination=pypi
else
VERSION="$VERSION_INPUT"
destination="$DESTINATION_INPUT"
fi
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Expected a final X.Y.Z version.' >&2; exit 1; }
[[ "$destination" == pypi || "$destination" == testpypi ]] || { echo 'Invalid destination.' >&2; exit 1; }
tag="v$VERSION"
gh release view "$tag" --repo HKUDS/nanobot --json tagName,isDraft,isPrerelease \
| jq -e --arg tag "$tag" '.tagName == $tag and .isDraft == false and .isPrerelease == false' >/dev/null
git fetch --no-tags origin "refs/tags/$tag:refs/tags/$tag"
commit="$(git rev-parse "refs/tags/$tag^{commit}")"
if [[ "$GITHUB_EVENT_NAME" == workflow_run ]]; then
[[ "$UPSTREAM_SHA" == "$commit" ]] || { echo 'Release tag no longer matches the trigger.' >&2; exit 1; }
fi
gh release download "$tag" --repo HKUDS/nanobot --dir "$RUNNER_TEMP/release" \
--pattern 'release-manifest.json' \
--pattern 'nanobot_ai-*.whl' --pattern 'nanobot_ai-*.tar.gz' \
--pattern 'nanobot-tui-*.zip' --pattern 'nanobot-tui-*.zip.sha256'
# The build report alone isn't acceptance: require the final gate from the same attempt.
gh api --paginate --method GET 'repos/HKUDS/nanobot/actions/workflows/release-candidate.yml/runs' \
-f head_sha="$commit" -f branch=main -f event=workflow_dispatch -f status=success -F per_page=100 \
--jq '.workflow_runs[] | select(.head_repository.full_name == "HKUDS/nanobot") | [.id, .run_number, .run_attempt] | @tsv' \
> "$RUNNER_TEMP/candidate-runs"
while IFS=$'\t' read -r run number attempt; do
accepted="$(gh api "repos/HKUDS/nanobot/actions/runs/$run/attempts/$attempt/jobs?per_page=100" \
--jq 'any(.jobs[]; .name == "Candidate required" and .conclusion == "success")')"
[[ "$accepted" == true ]] || continue
report="candidate-report-$number-$attempt"
if ! gh run download "$run" --repo HKUDS/nanobot --name "$report" --dir "$RUNNER_TEMP/$report"; then
continue
fi
manifest="$RUNNER_TEMP/$report/release-artifacts/release-manifest.json"
cmp -s "$manifest" "$RUNNER_TEMP/release/release-manifest.json" || continue
python -m scripts.prepare_pypi_release --release-dir "$RUNNER_TEMP/release" \
--accepted-manifest "$manifest" --output "$RUNNER_TEMP/pypi" --version "$VERSION" --tag-commit "$commit"
echo "release_version=$VERSION" >> "$GITHUB_OUTPUT"
echo "destination=$destination" >> "$GITHUB_OUTPUT"
exit 0
done < "$RUNNER_TEMP/candidate-runs"
echo 'No matching accepted main candidate report. Check the original run, tag and manifest before retrying.' >&2
exit 1
- name: Check for an interrupted upload
id: reconcile
env:
VERSION: ${{ steps.release.outputs.release_version }}
DESTINATION: ${{ steps.release.outputs.destination }}
shell: bash
run: |
set -euo pipefail
python -m scripts.reconcile_pypi_release --directory "$RUNNER_TEMP/pypi" \
--version "$VERSION" --destination "$DESTINATION"
if [[ -n "$(find "$RUNNER_TEMP/pypi" -type f -print -quit)" ]]; then
echo 'upload_required=true' >> "$GITHUB_OUTPUT"
else
echo 'upload_required=false' >> "$GITHUB_OUTPUT"
echo 'The complete release is already present with matching hashes.'
fi
- name: Transfer verified PyPI files
if: steps.reconcile.outputs.upload_required == 'true'
id: staged
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: verified-pypi-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/pypi/*
if-no-files-found: error
retention-days: 1
publish:
needs: verify
if: needs.verify.outputs.upload_required == 'true'
runs-on: ubuntu-latest
environment: ${{ needs.verify.outputs.destination }}
timeout-minutes: 20
permissions:
id-token: write
steps:
- name: Require a fresh run
shell: bash
run: |
# Reruns can reuse previous staging outputs instead of reconciling the current index.
[[ "$GITHUB_RUN_ATTEMPT" == 1 ]] || { echo 'To retry, start a new workflow run for the same version and destination.' >&2; exit 1; }
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
artifact-ids: ${{ needs.verify.outputs.artifact_id }}
path: dist
merge-multiple: true
- name: Publish with PyPI Trusted Publishing
if: needs.verify.outputs.destination == 'pypi'
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
- name: Publish to TestPyPI
if: needs.verify.outputs.destination == 'testpypi'
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Show safe retry instructions
if: failure()
shell: bash
run: |
message='To resume, use "Run workflow" on main with the same version and destination. Do not rerun the old run. Preserve the original approved release files.'
echo "::notice title=Retry the complete publication workflow::$message"
printf '### Resume publication\n\n%s\n' "$message" >> "$GITHUB_STEP_SUMMARY"
-87
View File
@@ -1,87 +0,0 @@
name: Approve Exact Release
# No schedule, release trigger or PR token. Repository administrators must first
# protect main and release-approval, then explicitly enable the repository var.
# This produces a signature only: it never uploads release assets or writes a feed.
on:
workflow_dispatch:
inputs:
version:
description: Exact previously tested version (without v)
required: true
type: string
manifest_sha256:
description: SHA-256 from the independently reviewed candidate evidence
required: true
type: string
source_commit:
description: Reviewed full source SHA
required: true
type: string
candidate_commit:
description: Tested full candidate SHA
required: true
type: string
permissions: {}
concurrency:
group: release-approval
cancel-in-progress: false
jobs:
approve:
if: >-
github.repository == 'HKUDS/nanobot' && github.ref == 'refs/heads/main' &&
vars.NANOBOT_RELEASE_SIGNING_ENABLED == 'true'
environment: release-approval
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
env:
RELEASE_VERSION: ${{ inputs.version }}
MANIFEST_SHA256: ${{ inputs.manifest_sha256 }}
SOURCE_COMMIT: ${{ inputs.source_commit }}
CANDIDATE_COMMIT: ${{ inputs.candidate_commit }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.11'
- name: Install hash-locked signing tools, not the candidate
run: |
python -m pip install --require-hashes --only-binary=:all: -r .github/release-signing-requirements.txt
- name: Fetch only the proposed manifest
env:
GH_TOKEN: ${{ github.token }}
run: |
[[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+|\.post[0-9]+)?$ ]]
gh release download "v$RELEASE_VERSION" --repo "$GITHUB_REPOSITORY" \
--pattern release-manifest.json --dir "$RUNNER_TEMP/approval"
- name: Bind the signature to reviewed evidence
run: |
python -m scripts.verify_release_approval \
--manifest "$RUNNER_TEMP/approval/release-manifest.json" \
--sha256 "$MANIFEST_SHA256" --version "$RELEASE_VERSION" \
--source-commit "$SOURCE_COMMIT" --candidate-commit "$CANDIDATE_COMMIT"
- name: Sign and verify the exact manifest
run: |
python -m sigstore sign --no-default-files \
--bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \
"$RUNNER_TEMP/approval/release-manifest.json"
python -m sigstore verify identity \
--cert-identity 'https://github.com/HKUDS/nanobot/.github/workflows/release-approve.yml@refs/heads/main' \
--cert-oidc-issuer 'https://token.actions.githubusercontent.com' \
--bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \
"$RUNNER_TEMP/approval/release-manifest.json"
- name: Retain small approval proof for the separate publication handoff
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: release-approval-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/approval/*
if-no-files-found: error
retention-days: 3
-368
View File
@@ -1,368 +0,0 @@
name: Verify Release Candidate
run-name: >-
${{ github.event_name == 'schedule' && vars.NANOBOT_DAILY_CANDIDATES_ENABLED != 'true' &&
'Disabled daily candidate' || format('Candidate {0} {1} from {2}',
inputs.channel || 'preview', inputs.next_stable || vars.NANOBOT_PREVIEW_BASE, github.sha) }}
# Preparation only: no tags, GitHub Releases, PyPI or channel-feed writes.
# Daily preparation is opt-in and remains disabled until maintainers enable the variable.
on:
schedule:
- cron: '17 0 * * *'
workflow_dispatch:
inputs:
next_stable:
description: Stable version/base (for example 0.4.0); must not have a stable tag
required: true
type: string
channel:
description: Preview makes a version-only commit; stable keeps the ref's exact final version
required: true
default: preview
type: choice
options:
- preview
- stable
retain_installable:
description: Retain this exact installable candidate and source for 1 day (~400 MB); not publication
required: false
default: false
type: boolean
permissions:
contents: read
concurrency:
# A daily tick must not replace a maintainer's pending manual run.
group: release-candidate-${{ github.event_name }}
cancel-in-progress: false
jobs:
plan:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.repository == 'HKUDS/nanobot' && github.ref == 'refs/heads/main' &&
vars.NANOBOT_DAILY_CANDIDATES_ENABLED == 'true')
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
actions: read
outputs:
prepare: ${{ steps.plan.outputs.prepare }}
base: ${{ steps.plan.outputs.base }}
channel: ${{ steps.plan.outputs.channel }}
notes_artifact_id: ${{ steps.notes.outputs.artifact-id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install planning tools
run: python -m pip install 'pydantic>=2,<3' packaging
- name: Select an exact candidate and generate draft notes
id: plan
env:
GH_TOKEN: ${{ github.token }}
SOURCE_COMMIT: ${{ github.sha }}
NEXT_STABLE: ${{ inputs.next_stable || vars.NANOBOT_PREVIEW_BASE }}
CANDIDATE_CHANNEL: ${{ inputs.channel || 'preview' }}
PREVIEW_SEQUENCE: ${{ github.run_number }}
run: |
args=()
if [ "$GITHUB_EVENT_NAME" = schedule ]; then args+=(--scheduled); fi
python -m scripts.release_plan --source-commit "$SOURCE_COMMIT" \
--base "$NEXT_STABLE" --channel "$CANDIDATE_CHANNEL" \
--sequence "$PREVIEW_SEQUENCE" --output "$RUNNER_TEMP/release-plan" \
--github-output "$GITHUB_OUTPUT" "${args[@]}"
- name: Retain draft notes for the same candidate
id: notes
if: steps.plan.outputs.prepare == 'true'
uses: actions/upload-artifact@v4
with:
name: candidate-notes-${{ github.run_number }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/release-plan
if-no-files-found: error
retention-days: 3
- name: Report unchanged source
if: steps.plan.outputs.prepare == 'false'
run: echo 'This source and Preview base already passed candidate acceptance. No new build or publication.' >> "$GITHUB_STEP_SUMMARY"
candidate:
needs: plan
if: needs.plan.outputs.prepare == 'true'
runs-on: ubuntu-latest
timeout-minutes: 45
outputs:
candidate_commit: ${{ steps.identity.outputs.candidate_commit }}
manifest_sha256: ${{ steps.identity.outputs.manifest_sha256 }}
candidate_artifact_id: ${{ steps.native_input.outputs.artifact-id }}
prepared_artifact_id: ${{ steps.prepared.outputs.artifact-id }}
env:
SOURCE_COMMIT: ${{ github.sha }}
NEXT_STABLE: ${{ needs.plan.outputs.base }}
PREVIEW_SEQUENCE: ${{ github.run_number }}
CANDIDATE_CHANNEL: ${{ needs.plan.outputs.channel }}
steps:
- name: Set candidate directory
run: echo "CANDIDATE_DIR=$RUNNER_TEMP/candidate" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: astral-sh/setup-uv@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Restore the planned notes by producer ID
uses: actions/download-artifact@v4
with:
artifact-ids: ${{ needs.plan.outputs.notes_artifact_id }}
merge-multiple: true
path: ${{ runner.temp }}/release-plan
- name: Install isolated build and verification tools
run: |
uv venv "$RUNNER_TEMP/release-tools"
uv pip install --python "$RUNNER_TEMP/release-tools/bin/python" -e '.[dev]' build twine
echo "$RUNNER_TEMP/release-tools/bin" >> "$GITHUB_PATH"
- name: Prepare an exact, separate candidate
run: |
case "$CANDIDATE_CHANNEL" in
stable)
python -m scripts.release_candidate prepare-stable \
--source-commit "$SOURCE_COMMIT" --version "$NEXT_STABLE" \
--output "$CANDIDATE_DIR" > "$RUNNER_TEMP/candidate.json"
;;
preview)
python -m scripts.release_candidate prepare \
--source-commit "$SOURCE_COMMIT" --base "$NEXT_STABLE" \
--sequence "$PREVIEW_SEQUENCE" --output "$CANDIDATE_DIR" \
> "$RUNNER_TEMP/candidate.json"
;;
*) exit 1 ;;
esac
python -c 'import json, os; print("CANDIDATE_VERSION=" + json.load(open(os.environ["RUNNER_TEMP"] + "/candidate.json"))["version"])' >> "$GITHUB_ENV"
- name: Verify packaging and selection contracts
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m pytest tests/test_release_candidate.py tests/test_releases.py \
tests/test_release_install_guide.py tests/test_installed_release_probe.py tests/cli/test_tui_wheels.py \
tests/cli/test_tui_release_packaging.py -q
- name: Check WebUI and build Python distributions
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
cd webui
bun install --frozen-lockfile
bun run lint
bun run test
cd ..
uv build --out-dir "$RUNNER_TEMP/python-dist"
- name: Check and cross-build the five native targets
working-directory: ${{ env.CANDIDATE_DIR }}/tui
run: |
bun install --frozen-lockfile
bun run check
bun run test
for target in darwin-arm64 darwin-x64 linux-arm64 linux-x64 win32-x64; do
bun scripts/prepare-target.ts "$target"
bun run build -- "$target"
done
- name: Ad-hoc sign macOS arm64
uses: indygreg/apple-code-sign-action@44d0985b7f4363198e80b6fea63ac3e9dd3e9957
with:
input_path: ${{ env.CANDIDATE_DIR }}/tui/dist/nanobot-tui-darwin-arm64
rcodesign_version: 0.29.0
- name: Ad-hoc sign macOS x64
uses: indygreg/apple-code-sign-action@44d0985b7f4363198e80b6fea63ac3e9dd3e9957
with:
input_path: ${{ env.CANDIDATE_DIR }}/tui/dist/nanobot-tui-darwin-x64
rcodesign_version: 0.29.0
- name: Package licensed native archives
working-directory: ${{ env.CANDIDATE_DIR }}/tui
run: |
for target in darwin-arm64 darwin-x64 linux-arm64 linux-x64 win32-x64; do
bun scripts/prepare-target.ts "$target"
bun scripts/release-notices.ts "$target"
python scripts/package-release.py "$target"
done
- name: Assemble and verify the complete candidate
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
version="$CANDIDATE_VERSION"
python -m scripts.release_candidate assemble --source-commit "$SOURCE_COMMIT" \
--wheel "$RUNNER_TEMP/python-dist/nanobot_ai-${version}-py3-none-any.whl" \
--sdist "$RUNNER_TEMP/python-dist/nanobot_ai-${version}.tar.gz" \
--tui-dir tui/dist --output "$RUNNER_TEMP/release-artifacts"
python -m twine check "$RUNNER_TEMP/release-artifacts/"*.whl \
"$RUNNER_TEMP/release-artifacts/"*.tar.gz
- name: Record exact acceptance identity
id: identity
env:
MANIFEST: ${{ runner.temp }}/release-artifacts/release-manifest.json
run: |
python - <<'PY'
import hashlib, json, os
from pathlib import Path
payload = Path(os.environ['MANIFEST']).read_bytes()
manifest = json.loads(payload)
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
output.write(f"candidate_commit={manifest['candidate_commit']}\n")
output.write(f"manifest_sha256={hashlib.sha256(payload).hexdigest()}\n")
PY
# Temporary same-run inputs, not approved release handoffs. Do not rebuild on consumers.
- name: Transfer exact native acceptance inputs
id: native_input
uses: actions/upload-artifact@v4
with:
name: candidate-native-wheels-${{ github.run_number }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/release-artifacts/*.whl
${{ runner.temp }}/release-artifacts/release-manifest.json
if-no-files-found: error
retention-days: 1
compression-level: 0
- name: Generate the exact candidate installation handoff
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m scripts.release_candidate instructions --source-commit "$SOURCE_COMMIT" \
--artifacts "$RUNNER_TEMP/release-artifacts" \
--output "$RUNNER_TEMP/install-candidate.md"
# These reports are neither native acceptance nor publication approval.
- name: Retain candidate identity and structural reports
uses: actions/upload-artifact@v4
with:
name: candidate-report-${{ github.run_number }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/candidate.json
${{ runner.temp }}/release-artifacts/release-manifest.json
${{ runner.temp }}/install-candidate.md
${{ runner.temp }}/release-plan/release-notes.md
if-no-files-found: error
retention-days: 3
# Explicit, short-lived release handoff only. This is the documented
# exception to report-only preflight. Schedules do not retain installable files.
- name: Preserve the verified bytes and independent candidate source
if: ${{ inputs.retain_installable }}
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m scripts.release_candidate retain --source-commit "$SOURCE_COMMIT" \
--artifacts "$RUNNER_TEMP/release-artifacts" \
--output "$RUNNER_TEMP/retained-candidate"
cp "$RUNNER_TEMP/release-plan/release-notes.md" "$RUNNER_TEMP/retained-candidate/release-notes.md"
- name: Transfer prepared candidate pending native acceptance
id: prepared
if: ${{ inputs.retain_installable }}
uses: actions/upload-artifact@v4
with:
name: prepared-candidate-${{ github.run_number }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/retained-candidate
if-no-files-found: error
compression-level: 0
retention-days: 1
native:
name: Candidate native acceptance
needs: candidate
uses: ./.github/workflows/native-acceptance.yml
with:
candidate: true
candidate_commit: ${{ needs.candidate.outputs.candidate_commit }}
manifest_sha256: ${{ needs.candidate.outputs.manifest_sha256 }}
candidate_artifact_id: ${{ needs.candidate.outputs.candidate_artifact_id }}
platforms: >-
[{"os":"ubuntu-latest","target":"linux-x64","wheel_tag":"manylinux_2_17_x86_64"},
{"os":"ubuntu-24.04-arm","target":"linux-arm64","wheel_tag":"manylinux_2_17_aarch64"},
{"os":"windows-latest","target":"win32-x64","wheel_tag":"win_amd64"},
{"os":"macos-15","target":"darwin-arm64","wheel_tag":"macosx_13_0_arm64"},
{"os":"macos-15-intel","target":"darwin-x64","wheel_tag":"macosx_13_0_x86_64"}]
verified:
name: Candidate required
needs: [plan, candidate, native]
if: always() && needs.plan.result == 'success' && needs.plan.outputs.prepare == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Require build and every native acceptance job
env:
BUILD_RESULT: ${{ needs.candidate.result }}
NATIVE_RESULT: ${{ needs.native.result }}
run: test "$BUILD_RESULT" = success && test "$NATIVE_RESULT" = success
- name: Restore the exact retained candidate after acceptance
if: inputs.retain_installable
uses: actions/download-artifact@v4
with:
artifact-ids: ${{ needs.candidate.outputs.prepared_artifact_id }}
merge-multiple: true
path: ${{ runner.temp }}/retained-candidate
- name: Verify the downloaded handoff before retaining accepted bytes
if: inputs.retain_installable
env:
HANDOFF: ${{ runner.temp }}/retained-candidate
CANDIDATE_COMMIT: ${{ needs.candidate.outputs.candidate_commit }}
MANIFEST_SHA256: ${{ needs.candidate.outputs.manifest_sha256 }}
run: |
git --git-dir="$HANDOFF/source.git" fsck --full
test "$(git --git-dir="$HANDOFF/source.git" rev-parse HEAD)" = "$CANDIDATE_COMMIT"
python - <<'PY'
import hashlib, json, os
from pathlib import Path
root = Path(os.environ["HANDOFF"])
manifest = (root / "artifacts/release-manifest.json").read_bytes()
assert hashlib.sha256(manifest).hexdigest() == os.environ["MANIFEST_SHA256"]
handoff = json.loads((root / "handoff.json").read_text())
assert handoff["candidate_commit"] == os.environ["CANDIDATE_COMMIT"]
assert handoff["manifest_sha256"] == os.environ["MANIFEST_SHA256"]
for artifact in json.loads(manifest)["artifacts"]:
payload = (root / "artifacts" / artifact["filename"]).read_bytes()
assert len(payload) == artifact["size"]
assert hashlib.sha256(payload).hexdigest() == artifact["sha256"]
PY
- name: Retain accepted installable candidate for separate approval
if: inputs.retain_installable
uses: actions/upload-artifact@v4
with:
name: installable-candidate-${{ github.run_number }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/retained-candidate
if-no-files-found: error
compression-level: 0
retention-days: 1
- name: Record accepted identity
env:
CANDIDATE_COMMIT: ${{ needs.candidate.outputs.candidate_commit }}
MANIFEST_SHA256: ${{ needs.candidate.outputs.manifest_sha256 }}
run: |
printf 'Candidate: `%s`\n\nManifest SHA-256: `%s`\n\nAll five native targets passed installation and update/recovery acceptance. Publication requires separate approval.\n' \
"$CANDIDATE_COMMIT" "$MANIFEST_SHA256" >> "$GITHUB_STEP_SUMMARY"
-22
View File
@@ -1,22 +0,0 @@
name: Validate published release for PyPI
on:
release:
types: [published]
permissions: {}
jobs:
release:
if: github.repository == 'HKUDS/nanobot' && !github.event.release.prerelease
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Validate the stable release tag
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
shell: bash
run: |
set -euo pipefail
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Expected a final vX.Y.Z tag.' >&2; exit 1; }
echo 'The main-branch publisher will match the release to its accepted candidate before uploading.' >> "$GITHUB_STEP_SUMMARY"
+2 -1
View File
@@ -92,4 +92,5 @@ jobs:
if [[ "$TARGET" == win32-* ]]; then asset="${asset}.exe"; fi
gh release upload "$TAG" \
"tui/dist/${asset}.zip" \
"tui/dist/${asset}.zip.sha256"
"tui/dist/${asset}.zip.sha256" \
--clobber
+14 -5
View File
@@ -1,3 +1,4 @@
# Project-specific
.worktrees/
.worktree/
.assets
@@ -6,9 +7,11 @@
.web
.orion
# Claude / AI assistant artifacts
docs/superpowers/
docs/plans/
# webui (monorepo frontend)
webui/node_modules/
webui/dist/
webui/coverage/
@@ -17,6 +20,7 @@ tui/node_modules/
tui/dist/
*.tsbuildinfo
# Python bytecode & caches
*.pyc
*.pyo
*.pyd
@@ -37,6 +41,7 @@ dmypy.json
.nox/
.hypothesis/
# Build & packaging
dist/
build/
*.manifest
@@ -44,27 +49,34 @@ build/
pip-wheel-metadata/
share/python-wheels/
# Test & coverage
.coverage
.coverage.*
htmlcov/
coverage.xml
*.cover
# Lock files (project policy)
poetry.lock
uv.lock
# Jupyter
.ipynb_checkpoints/
# macOS
.DS_Store
.AppleDouble
.LSOverride
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
# Linux
.directory
# Editors & IDEs (local workspace / user settings)
.vscode/
.cursor/
.idea/
@@ -77,9 +89,11 @@ Desktop.ini
*~
nano.*.save
# Environment & secrets (keep examples tracked if needed)
.env.*
!.env.example
# Logs & temp
*.log
logs/
tmp/
@@ -89,8 +103,3 @@ exp/
.playwright-mcp/
bridge/node_modules/
webui/.verify-*
.playwright-cli/
nanobot/_build_commit.txt
nanobot/skills/nanobot-document/references/
+80 -21
View File
@@ -1,27 +1,86 @@
# Working on nanobot
This file provides guidance to AI coding agents working with this repository.
The Python gateway owns agent execution, sessions, tools, memory, and security policy. WebUI and TUI share that runtime; keep execution and policy out of the clients.
## Project Overview
WebUI/gateway support and test coverage are limited to same-version combinations, including remote gateways. Cross-version combinations may work but have no compatibility guarantee, even when protocol checks pass; align versions first when troubleshooting. Do not reject connections solely because package versions differ, or add compatibility fallbacks or negotiation solely to support older gateways.
nanobot is a lightweight, open-source AI agent framework written in Python with a React/TypeScript WebUI. It centers around a small agent loop that receives messages from chat channels, invokes an LLM provider, executes tools, and manages session memory.
## Task-specific guidance
## Development Commands
| When working on | Read |
| --- | --- |
| Finding the owning code and focused tests | [`.agent/navigation.md`](.agent/navigation.md) |
| Core boundaries, extensions, or internal types | [`.agent/design.md`](.agent/design.md) |
| Refactoring, fallbacks, or test selection | [`.agent/simplify.md`](.agent/simplify.md) |
| User-facing copy, feature naming, or localization | [`.agent/copywriting.md`](.agent/copywriting.md) |
| Path permissions, HTTP/MCP, or shell isolation | [`.agent/security.md`](.agent/security.md) |
| Dependency setup, WebUI transport, config, Windows, prompts, or persistence | [`.agent/gotchas.md`](.agent/gotchas.md) |
| Reusing verification evidence | [`.agent/workflow.md`](.agent/workflow.md) |
| WebUI/host compatibility | [`.agent/review-guide.md`](.agent/review-guide.md) |
| Contribution or publication | [`CONTRIBUTING.md`](CONTRIBUTING.md), [`docs/releasing.md`](docs/releasing.md) |
```bash
# Python: run single test / lint
pytest tests/test_openai_api.py::test_function -v
ruff check nanobot/
## Development constraints
# Strict type checking (matches CI)
uv sync --all-extras --dev
uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
uv run --no-sync basedpyright
- Analyze the required behavior, state ownership, and root cause before extending existing code. Refactor when the structure causes the problem; a smaller diff does not justify another fallback.
- Do not add defensive tests for hypothetical internal states or unsupported combinations. Each new test needs a reachable path and a meaningful contract to protect.
- Do not add tests merely to prove that nonexistent behavior, removed code, or obsolete symbols are absent. Negative assertions must exercise a concrete, reachable risk and protect an observable behavioral contract; prefer testing supported actions and their results.
- Do not run `ruff format`; mechanical formatting obscures git blame and creates unrelated diffs. This constraint takes precedence over the optional touched-file formatting in `CONTRIBUTING.md`.
- Do not manually wrap prose in Markdown files. Keep each paragraph on one source line; use line breaks only for Markdown structure.
# WebUI: dev server (proxies API/WS to gateway :8765), build, test
# Build outputs to ../nanobot/web/dist (bundled into the Python wheel)
cd webui && bun run dev # or NANOBOT_API_URL=... bun run dev
cd webui && bun run build
cd webui && bun run test
# Gateway
nanobot gateway
```
## High-Level Architecture
### Core Data Flow
Messages flow through an async `MessageBus` (`nanobot/bus/queue.py`) that decouples chat channels from the agent core:
1. **Channels** (`nanobot/channels/`) receive messages from external platforms and publish `InboundMessage` events to the bus.
2. **`AgentLoop`** (`nanobot/agent/loop.py`) consumes inbound messages, builds context, and coordinates the turn.
3. **`AgentRunner`** (`nanobot/agent/runner.py`) handles the actual LLM conversation loop: send messages to the provider, receive tool calls, execute tools, and stream responses.
4. Responses are published as `OutboundMessage` events back to the appropriate channel.
### Key Subsystems
- **Agent Loop** (`nanobot/agent/loop.py`, `runner.py`): The core processing engine. `AgentLoop` manages session keys, hooks, and context building. `AgentRunner` executes the multi-turn LLM conversation with tool execution.
- **LLM Providers** (`nanobot/providers/`): Provider implementations (Anthropic, OpenAI-compatible, OpenAI Responses API, Azure, Bedrock, GitHub Copilot, OpenAI Codex, etc.) built on a common base (`base.py`). Includes image generation (`image_generation.py`) and audio transcription (`transcription.py`). `factory.py` and `registry.py` handle instantiation and model discovery.
- **Channels** (`nanobot/channels/`): Platform integrations (Telegram, Discord, Slack, Feishu, Matrix, WhatsApp, QQ, WeChat, WeCom, DingTalk, Email, MoChat, MS Teams, WebSocket, Mattermost). `manager.py` discovers and coordinates them. Channels are self-contained packages auto-discovered via `pkgutil` scanning.
- **Tools** (`nanobot/agent/tools/`): Agent capabilities exposed to the LLM: filesystem (read/write/edit/list), shell execution (with sandbox backends), web search/fetch, MCP servers, cron, notebook editing, subagent spawning, long-running tasks / sustained goals (`long_task.py`), image generation, and self-modification. Tools are auto-discovered via `pkgutil` scan + entry-point plugins.
- **Memory** (`nanobot/agent/memory.py`): Session history persistence with Dream two-phase memory consolidation. Uses atomic writes with fsync for durability.
- **Session Management** (`nanobot/session/`): Per-session history, context compaction, TTL-based auto-compaction (`manager.py`), and sustained goal state tracking (`goal_state.py`).
- **Config** (`nanobot/config/schema.py`, `loader.py`): Pydantic-based configuration loaded from `~/.nanobot/config.json`. Supports camelCase aliases for JSON compatibility.
- **WebUI** (`webui/`): Vite-based React SPA that talks to the gateway over a WebSocket multiplex protocol. The dev server proxies `/api`, `/webui`, `/auth`, and WebSocket traffic to the gateway.
- **API Server** (`nanobot/api/server.py`): OpenAI-compatible HTTP API (`/v1/chat/completions`, `/v1/models`) for programmatic access.
- **Command Router** (`nanobot/command/`): Slash command routing and built-in command handlers.
- **Heartbeat** (`nanobot/templates/HEARTBEAT.md`): Periodic task list checked via `cron` jobs (legacy dedicated service removed).
- **Pairing** (`nanobot/pairing/`): DM sender approval store with persistent pairing codes per channel.
- **Skills** (`nanobot/skills/`): Built-in skill definitions (cron, github, image-generation, etc.) loaded into agent context.
- **Security** (`nanobot/security/`): PTH file guard and other security measures activated at CLI entry.
### Entry Points
- **CLI**: `nanobot/cli/commands.py`
- **Python SDK**: `nanobot/nanobot.py`
## Project-Specific Notes
- Architecture constraints: [`.agent/design.md`](.agent/design.md)
- Security boundaries: [`.agent/security.md`](.agent/security.md)
- Common gotchas: [`.agent/gotchas.md`](.agent/gotchas.md)
## Contribution Flow
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for contribution flow and PR guidelines.
## Code Style
- Python 3.11+, asyncio throughout.
- Line length: 100.
- Linting: `ruff` with rules E, F, I, N, W (E501 ignored).
- pytest with `asyncio_mode = "auto"`.
## Common File Locations
- Config schema: `nanobot/config/schema.py`
- Provider base / new provider template: `nanobot/providers/base.py`
- Channel base / new channel template: `nanobot/channels/base.py`
- Tool registry: `nanobot/agent/tools/registry.py`
- WebUI dev proxy config: `webui/vite.config.ts`
- Tests mirror the `nanobot/` package structure.
+1
View File
@@ -0,0 +1 @@
@AGENTS.md
+2 -20
View File
@@ -1,23 +1,5 @@
# Community
## WeChat
**nanobot 微信交流群(2 群)** · 交流使用心得、分享作品、讨论开发。
用微信扫描下方二维码加入。手机上可点击图片查看原图,保存后在微信「扫一扫」中从相册选择。
Scan with WeChat to join group 2 of the Chinese-speaking nanobot community. Tap the image for the full-size version.
<a href="./images/wechat-group-2026-11-14.png"><img src="./images/wechat-group-2026-11-14.png" alt="nanobot 微信交流群 2 群二维码,2026 年 11 月 21 日前有效 / nanobot WeChat group 2 QR code, valid before November 21, 2026" width="400"/></a>
**有效期:2026 年 11 月 21 日前。** 群码失效或群已满时,请在[社区欢迎帖](https://github.com/HKUDS/nanobot/discussions/50)留言。
**Valid before November 21, 2026.** If the code expires or the group is full, leave a comment in our [welcome discussion](https://github.com/HKUDS/nanobot/discussions/50).
## HKUDS community
The broader HKUDS discussion groups are available on **WeChat** and **Feishu**.
We provide QR codes for joining the HKUDS discussion groups on **WeChat** and **Feishu**.
You can join by scanning the QR codes below:
<img src="https://github.com/HKUDS/.github/blob/main/profile/QR.png" alt="HKUDS WeChat and Feishu community QR codes" width="400"/>
<img src="https://github.com/HKUDS/.github/blob/main/profile/QR.png" alt="WeChat QR Code" width="400"/>
+47 -43
View File
@@ -2,9 +2,13 @@
Thank you for being here.
nanobot is built with a simple belief: good tools should feel calm, clear, and humane. We care deeply about useful features, but we also believe in achieving more with less: solutions should be powerful without becoming heavy, and ambitious without becoming needlessly complicated.
nanobot is built with a simple belief: good tools should feel calm, clear, and humane.
We care deeply about useful features, but we also believe in achieving more with less:
solutions should be powerful without becoming heavy, and ambitious without becoming
needlessly complicated.
This guide is not only about how to open a PR. It is also about how we hope to build software together: with care, clarity, and respect for the next person reading the code.
This guide is not only about how to open a PR. It is also about how we hope to build
software together: with care, clarity, and respect for the next person reading the code.
## Maintainers
@@ -17,23 +21,9 @@ Maintainers are community stewards who help review, organize, and maintain the p
## Contribution Flow
### Discuss the Problem First
### What Should I Open a PR For?
We currently accept pull requests only from repository collaborators. [Issues](https://github.com/HKUDS/nanobot/issues) remain open to everyone: bug reports, clear reproduction steps, feature suggestions, and design discussions are all welcome.
Generating code is becoming easier, but understanding changes, verifying correctness, and maintaining them still take substantial effort. Please start by discussing the problem, use case, and requirements in an issue before moving to implementation.
### Recognition and Collaborator Invitations
Contributing is not limited to submitting code. Finding a bug we missed, providing a key reproduction, or describing a valuable real-world use case all deserve acknowledgement.
For accepted issues, the issue author will also be credited as a co-author of the corresponding PR when it is merged.
Through these discussions and contributions, we hope to get to know people interested in long-term involvement and gradually invite them to become collaborators.
### Pull Requests from Collaborators
Collaborators can open PRs for:
PRs are welcome for:
- New features or functionality
- Bug fixes with no behavior changes
@@ -42,9 +32,8 @@ Collaborators can open PRs for:
- Refactoring that is clearly scoped and easy to review
- Changes to APIs or configuration, when the impact is documented
For riskier or larger changes, collaborators are encouraged to open a draft PR early after discussing the scope and approach in an issue.
WebUI and remote-host interface changes must follow the [client/host compatibility review checklist](.agent/review-guide.md), including the same-version support policy, host isolation, and actionable update guidance.
For riskier or larger changes, please open an issue or draft PR early so the
shape of the work can be discussed before the implementation grows too large.
### Starting Work
@@ -57,14 +46,15 @@ git pull --ff-only upstream main
git switch -c your-topic-branch
```
Use your primary HKUDS/nanobot remote in place of `upstream` if your checkout uses a different remote name.
Use your primary HKUDS/nanobot remote in place of `upstream` if your checkout
uses a different remote name.
Keep unrelated local changes out of the topic branch. If your checkout already has work in progress, use a separate worktree or finish that work before starting a new branch.
Keep unrelated local changes out of the topic branch. If your checkout already has
work in progress, use a separate worktree or finish that work before starting a
new branch.
## Development Setup
For React/TypeScript work, follow the [WebUI development guide](webui/README.md) for HMR, source layout, and frontend checks. Channel-owned frontend code lives beside its channel; the guide covers those tests too.
Keep setup boring and reliable. The goal is to get you into the code quickly:
```bash
@@ -90,7 +80,8 @@ ruff format <files-you-changed>
### Strict Type Checking
Strict type checking covers optional providers and channels. Reproduce the CI environment with the same dependency sources and commands:
Strict type checking covers optional providers and channels. Reproduce the CI environment
with the same dependency sources and commands:
```bash
uv sync --all-extras --dev
@@ -98,11 +89,13 @@ uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
uv run --no-sync basedpyright
```
Keep `--no-sync` on the final commands: channel dependencies come from their package manifests and are installed explicitly by the setup step.
Keep `--no-sync` on the final commands: channel dependencies come from their package
manifests and are installed explicitly by the setup step.
## Contribution License
By submitting a contribution, you confirm that you have the right to submit it and agree that it will be licensed under the project's MIT License.
By submitting a contribution, you confirm that you have the right to submit it
and agree that it will be licensed under the project's MIT License.
## Code Style
@@ -124,36 +117,47 @@ In practice:
- Async: uses `asyncio` throughout; pytest with `asyncio_mode = "auto"`
- Prefer readable code over magical code
- Prefer focused patches over broad rewrites
- Do not mix mechanical formatting, line wrapping, import sorting, or quote churn into a feature or bugfix PR. If formatting cleanup is needed, make it a separate formatting-only PR.
- Do not mix mechanical formatting, line wrapping, import sorting, or quote churn
into a feature or bugfix PR. If formatting cleanup is needed, make it a
separate formatting-only PR.
- If a new abstraction is introduced, it should clearly reduce complexity rather than move it around
## Modifying CI Workflows
If your PR touches `.github/workflows/`, please keep the CI within GitHub Actions' free tier:
If your PR touches `.github/workflows/`, please keep the CI within
GitHub Actions' free tier:
- Use only standard GitHub-hosted runners (`ubuntu-latest`, `windows-latest`)
- Avoid macOS runners, larger runners (`*-cores`, `*-xlarge`, `*-gpu`), and self-hosted runners
- Avoid macOS runners, larger runners (`*-cores`, `*-xlarge`, `*-gpu`),
and self-hosted runners
- Avoid uploading large artifacts or using long retention
- Avoid paid Marketplace actions
If your change genuinely needs to step outside this, please call it out explicitly in the PR description so it can be discussed before merge.
If your change genuinely needs to step outside this, please call it out
explicitly in the PR description so it can be discussed before merge.
## Release Packaging Contract
Use the [release checklist](./docs/releasing.md) for candidate preparation, package checks, documentation coordination, and the final publication handoff.
A stable install must never combine Python from one version with a TUI from another. Publish in
this order:
Stable feature releases and Stable patches are manual and share the same package workflow. Patches use generated change notes and update only affected documentation; they do not require a full wiki or promotional refresh. The Preview/dev line is intended for daily workflow delivery. The current first step supports opt-in daily candidate preparation only; publication remains separate and daily preparation is disabled by default. See the checklist for its activation boundary and remaining publication work.
1. Set the package version and publish the matching GitHub release tag (`vX.Y.Z`).
2. Review the pinned Bun/OpenTUI licenses, source offer, and relinking materials for that tag.
3. Manually run **Publish Terminal UI** for the exact tag and confirm the compliance review input.
4. Wait for every platform archive and checksum to appear on the release, then publish the same
`X.Y.Z` package to PyPI.
A stable install must never combine Python from one version with a TUI from another. Publish in this order:
The wheel contains the built WebUI. The native TUI stays a platform-specific release sidecar so
users download only the archive for their machine. Each archive must contain the executable,
target-specific third-party notices, project and runtime licenses, corresponding application
source, a written source offer, relinking instructions, and a checksum manifest. Never upload a
naked TUI executable. Source checkouts use an editable Python install, run `tui/` with Bun, and
rebuild stale `webui/` assets locally.
1. Before pushing a tag, set the package version, verify the exact candidate, build the source distribution, all five platform wheels and TUI archives, and review licenses, source offer, and relinking materials. Obtain the maintainer's source-offer commitment before publication.
2. Merge the release preparation, verify that its packaged sources match the checked candidate, then publish the matching GitHub release tag (`vX.Y.Z`). Recheck any changed sources first.
3. Attach the preverified TUI archives and checksums to the matching GitHub Release. Alternatively, manually run **Publish Terminal UI** for the exact tag with the compliance review confirmed; reverify its outputs, since a rebuild does not preserve the preflight artifact hashes.
4. Verify every platform archive and checksum is publicly downloadable for fallback/source-built installations, then publish the same `X.Y.Z` source distribution and five platform wheels to PyPI.
Each platform wheel contains the built WebUI and the matching native TUI. Pip chooses the wheel for the user's machine; launching the installed TUI must work without a GitHub download or Bun. The universal wheel produced by `uv build` is only an intermediate: use `scripts/build_tui_wheels.py` as described in the checklist, and do not upload that intermediate. The source distribution remains platform-neutral and does not bundle native binaries. Keep the platform-specific release archives for fallback/source-built installations. Both the wheel's `nanobot/tui/bin/` bundle and its matching archive must contain the executable, target-specific third-party notices, project and runtime licenses, corresponding application source, a written source offer, relinking instructions, and a checksum manifest. Never upload a naked TUI executable. Review the minimum OS, libc, architecture and runtime CPU requirements when changing Bun/OpenTUI; never apply portable platform tags without checking their binaries. Source checkouts use an editable Python install, run `tui/` with Bun, and rebuild stale `webui/` assets locally.
The confirmation is an operational commitment, not a cosmetic checkbox. Before accepting it, verify that the exact Bun/WebKit revisions remain retrievable and that the project can honor the archive's corresponding-source offer for its full stated period. Preserve published archives and their source materials.
The confirmation is an operational commitment, not a cosmetic checkbox. Before accepting it,
verify that the exact Bun/WebKit revisions remain retrievable and that the project can honor the
archive's corresponding-source offer for its full stated period. Preserve published archives and
their source materials.
## Questions?
+19 -12
View File
@@ -5,14 +5,12 @@ COPY webui/package.json webui/package-lock.json ./webui/
WORKDIR /app/webui
RUN npm ci
COPY webui/ ./
COPY packages/client-events/ /app/packages/client-events/
COPY nanobot/channels/ /app/nanobot/channels/
RUN mkdir -p /app/nanobot/web && npm run build
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl git bubblewrap openssh-client libmagic1 && \
apt-get install -y --no-install-recommends ca-certificates git bubblewrap openssh-client libmagic1 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
@@ -23,21 +21,28 @@ ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
RUN uv venv --seed "$VIRTUAL_ENV"
# Install Python dependencies first (cached layer). Hatch reads the custom build
# hook from hatch_build.py even for this metadata-only install.
ARG NANOBOT_EXTRAS=
COPY pyproject.toml ./
RUN set -- && \
for extra in $(printf '%s' "$NANOBOT_EXTRAS" | tr ',' ' '); do \
set -- "$@" --extra "$extra"; \
done && \
uv pip install --python "$VIRTUAL_ENV/bin/python" --no-cache -r pyproject.toml "$@"
COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
RUN mkdir -p nanobot && touch nanobot/__init__.py && \
if [ -n "$NANOBOT_EXTRAS" ]; then \
NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install \
--python "$VIRTUAL_ENV/bin/python" --no-cache ".[${NANOBOT_EXTRAS}]"; \
else \
NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install \
--python "$VIRTUAL_ENV/bin/python" --no-cache .; \
fi && \
rm -rf nanobot
COPY README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
COPY docs/ docs/
# Copy the full source and install
COPY nanobot/ nanobot/
COPY scripts/install_channel_dependencies.py scripts/
COPY --from=webui-builder /app/nanobot/web/dist/ nanobot/web/dist/
RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --python "$VIRTUAL_ENV/bin/python" --no-cache --no-deps .
RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --python "$VIRTUAL_ENV/bin/python" --no-cache .
# Preinstall selected channel dependencies from their manifests. A comma-separated
# list keeps the image configurable while preserving WhatsApp in the default image.
ARG NANOBOT_CHANNELS=whatsapp
RUN for channel in $(printf '%s' "$NANOBOT_CHANNELS" | tr ',' ' '); do \
python -m scripts.install_channel_dependencies "$channel"; \
@@ -49,6 +54,7 @@ RUN for channel in $(printf '%s' "$NANOBOT_CHANNELS" | tr ',' ' '); do \
# won't shadow it. Only used when RENDER=true; ignored by local runs.
COPY render-config.json ./
# Create the non-root user and hand ownership of the writable virtualenv to it.
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
mkdir -p /home/nanobot/.nanobot && \
chown -R nanobot:nanobot /home/nanobot /app/.venv
@@ -67,6 +73,7 @@ ENV HOME=/home/nanobot
# non-graceful exit).
ENV PYTHONUNBUFFERED=1 PYTHONFAULTHANDLER=1
# Gateway health endpoint and optional WebUI/WebSocket channel ports
EXPOSE 18790 8765
ENTRYPOINT ["entrypoint.sh"]
+196 -196
View File
@@ -28,173 +28,163 @@
<p>
<a href="https://discord.gg/MnCvHqpUGB">Discord</a> ·
<a href="https://x.com/nanobot_project">X</a> ·
<a href="./COMMUNICATION.md#wechat">WeChat 微信交流群</a> ·
<a href="./COMMUNICATION.md#hkuds-community">Feishu</a>
<a href="./COMMUNICATION.md">WeChat / Feishu</a>
</p>
</div>
# nanobot
🐈 **nanobot** is a lightweight, open-source, self-hosted personal AI agent written in Python. Chat with it from your browser, terminal, or favorite chat app to work with files, remember preferences, use tools, and run scheduled tasks—powered by any supported cloud or local AI model.
## 💡 Why nanobot
- **Lightweight & low footprint:** Small Python core with fast startup and low memory usage—runs comfortably on a personal laptop or a modest VPS without heavyweight infrastructure.
- **Polished WebUI & native TUI out of the box:** Includes a clean, responsive browser workbench (multi-pane topics, live tool activity, inline file diffs, context usage, themes, and custom backgrounds) plus a matching terminal UI—no separate frontend build needed.
- **Works where you already chat:** Connect seamlessly to 15+ chat apps including Telegram, Discord, Slack, Feishu, WeChat, WhatsApp, Email, Mattermost, and Linear.
- **Real tools, memory & automations:** Reads images, PDFs, and Office files (`.docx`, `.xlsx`, `.pptx`), edits files, connects to MCP servers and plugins, builds long-term memory with [Dream](./docs/memory.md), and runs [scheduled tasks, local triggers, and sustained goals](./docs/automations.md).
- **Model freedom & full control:** Use any cloud API (OpenRouter, Anthropic, OpenAI, Gemini, DeepSeek), OAuth subscription (OpenAI Codex, GitHub Copilot, xAI Grok), or local server (Ollama, vLLM, LM Studio)—self-hosted on your own machine.
🐈 **nanobot** is an ultra-lightweight, open-source, self-hosted personal AI agent framework written in Python. It runs in a WebUI, terminal, or chat apps and combines tools, long-term memory, MCP integrations, model routing, multi-agent delegation, scheduled automation, and an OpenAI-compatible API in a small, readable core.
## Start Here
| What you want to do | Where to go |
| You want to... | Go to |
|---|---|
| Install nanobot with no terminal or config experience | [Start Without Technical Background](./docs/start-without-technical-background.md) |
| Install quickly and get your first reply | [Install](#-install) → [Quick Start](#-quick-start) |
| Explore the browser workbench | [WebUI](#-webui) |
| Connect Telegram, Discord, Slack, Feishu, WeChat, Email, Linear, or others | [Chat Apps Guide](./docs/guides/chat-app-ai-agent.md) |
| Configure models, MCP tools, memory, or security | [Documentation](./docs/README.md) · [Configuration](./docs/configuration.md) |
| Run nanobot continuously or on a server | [Deploy](#-deploy) · [Deployment Guide](./docs/deployment.md) |
| Embed nanobot in Python | [Python SDK](./docs/python-sdk.md) |
| Contribute or extend nanobot | [Architecture](./docs/architecture.md) · [Contributing](./CONTRIBUTING.md) |
| Install nanobot with no terminal/config background | [Start Without Technical Background](./docs/start-without-technical-background.md) |
| Install quickly and get one CLI reply | [Install](#-install) and [Quick Start](#-quick-start) |
| Open the bundled browser UI | [WebUI](#-webui) |
| Connect Telegram, Discord, WeChat, Slack, Email, Mattermost, or another chat app | [Chat Apps](./docs/chat-apps.md) |
| Configure providers, fallback models, Langfuse, MCP, web tools, or security | [Docs](./docs/README.md) and [Configuration](./docs/configuration.md) |
| Understand or extend the internals | [Architecture](./docs/architecture.md) and [Development](./docs/development.md) |
| Deploy to the cloud or keep nanobot running as a service | [Deployment](./docs/deployment.md) |
## What can nanobot do?
nanobot is a self-hosted personal AI agent runtime. It can:
- run in a browser WebUI or terminal
- connect to Telegram, Discord, Slack, WeChat, Email, Mattermost, and other chat apps
- use tools such as files, shell, web search, web fetch, MCP, cron, image generation, and subagents
- keep session history and long-term memory through Dream
- run long-horizon goals and scheduled automations
- expose a Python SDK and OpenAI-compatible API for integrations
- deploy as a long-running local or server-side agent gateway
## 💡 Why nanobot
- **Persistent workflows**: goals, memory, tools, and chat context survive long-running work.
- **Chat-native reach**: WebUI, API, Telegram, Feishu, Slack, Discord, Teams, email, and Mattermost.
- **Model freedom**: OpenAI-compatible APIs, local LLMs, image generation, search, and fallbacks.
- **Small core**: readable internals with MCP, memory, deployment, and automation built in.
- **Own your stack**: inspect, customize, self-host, and extend without a giant platform.
## 📦 Install
Requires **Python 3.11 or newer** and an account on a [supported AI provider or local model server](./docs/providers.md). Packaged installs include both the WebUI and terminal UI—no frontend build tools required.
> [!IMPORTANT]
> If you want the newest features and experiments, install from source.
>
> If you want the most stable day-to-day experience, install from PyPI or with `uv`.
> [!NOTE]
> This README tracks the latest development branch; the installer below installs the latest stable release. For published release docs, visit [nanobot.wiki](https://nanobot.wiki/docs/latest/getting-started/nanobot-overview).
Pick **one** install method:
**Recommended: one-command installer** (installs into an isolated environment and opens the WebUI automatically on desktop)
| Track | Install with | Update with | What runs |
|---|---|---|---|
| Stable | installer, `uv`, or pip | the same package tool | one released Python/WebUI/TUI version |
| Current source | editable Git checkout | `git pull --ff-only` + editable dependency sync | Python, WebUI, and TUI from that checkout |
**macOS / Linux**
Prerequisites: Python 3.11 or newer. Git and [Bun](https://bun.sh/) are only needed for a source install. Published packages include the WebUI and fetch a checksummed, version-matched TUI archive—with its licenses, notices, corresponding application source, source offer, and relinking instructions—on first use.
If terminals, API keys, or config files are new to you, use the guided zero-background walkthrough in [Start Without Technical Background](./docs/start-without-technical-background.md) instead of this compact README path.
**One-command setup**
macOS / Linux:
```bash
curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | sh
```
**Windows PowerShell**
Windows PowerShell:
```powershell
irm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1 | iex
```
<details>
<summary>Preview the installer or inspect the scripts first</summary>
The default command installs or upgrades `nanobot-ai` from PyPI. On a fresh local desktop, it then starts `nanobot webui` so you can configure the first provider and model in **Settings → Models**. SSH, headless, existing-config, and older-release paths keep the terminal setup wizard. The installer avoids system-wide pip installs by using an active virtual environment, `uv`, `pipx`, or a managed venv under `~/.nanobot/venv`. It also prints the exact command it used to run nanobot; reuse that full command below if `nanobot` is not on `PATH`.
Preview what the installer will do without changing anything:
To preview the plan without changing your environment, pass `--dry-run`.
```bash
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | sh -s -- --dry-run
```
```powershell
# Windows PowerShell
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1))) --dry-run
```
Or read [`scripts/install.sh`](./scripts/install.sh) and [`scripts/install.ps1`](./scripts/install.ps1) directly.
If you prefer to inspect the script first, open [`scripts/install.sh`](./scripts/install.sh) or [`scripts/install.ps1`](./scripts/install.ps1).
</details>
<details>
<summary>Other install methods: uv, pip, or from source</summary>
**uv**
**Install with `uv`**
```bash
uv tool install nanobot-ai
nanobot webui
```
**pip (inside a virtual environment)**
**Install from PyPI with pip**
```bash
python -m pip install nanobot-ai
nanobot webui
```
**From source (latest `main`, requires Git)**
If pip reports `externally-managed-environment` on macOS or Linux, use the one-command installer, `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or install inside a virtual environment.
**Install from source**
Clone the repository and install it in editable mode. Bun is required because the source
checkout runs the matching TUI directly instead of downloading an older release binary.
```bash
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
python3 -m venv .venv
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install -e .
nanobot webui
python -m venv .venv
```
For full install options, troubleshooting `nanobot: command not found`, or updating an existing install, see [Install and Quick Start](./docs/quick-start.md) and [Updating nanobot](./docs/updating.md).
Activate it with `source .venv/bin/activate` on macOS/Linux or
`.venv\Scripts\Activate.ps1` in Windows PowerShell, then run:
</details>
```bash
python -m pip install -e .
```
After that, the normal commands are identical to a stable install. `nanobot` runs the TUI
from this checkout, and `nanobot webui` rebuilds stale frontend assets automatically. A later
`git pull --ff-only` updates the Python, TUI, and WebUI source together; rerun
`python -m pip install -e .` when Python dependencies change. Contributors should also read
[`CONTRIBUTING.md`](./CONTRIBUTING.md).
Verify the install:
```bash
nanobot --version
```
If `nanobot` is not on `PATH`, invoke it through the method that installed it: reuse the recommended installer's command, use `uv tool run --from nanobot-ai nanobot ...` or `pipx run --spec nanobot-ai nanobot ...`, or use the Python executable from the environment where pip installed the package.
## 🚀 Quick Start
If the installer already opened the WebUI in your browser, continue right there. Otherwise run:
**Open nanobot in your browser**
```bash
nanobot webui
```
**Your first three steps:**
This is the recommended first run. The launcher creates the config and workspace when needed, safely enables the local WebSocket channel after confirmation, starts or joins the shared local gateway, and opens [`http://127.0.0.1:8765`](http://127.0.0.1:8765). A fresh install can open before a model is configured, so setup continues in the browser instead of beginning in a JSON file. The first-run WebUI binds to localhost by default and is not exposed to your LAN.
1. Open **Settings → Models**, create a preset, and add your provider API key (or sign in with OAuth). See [Configure Your Model](./docs/quick-start.md#2-configure-your-model).
2. Start a new topic and send `Hello!` to verify your model connection.
3. Try a file task: pick a practice folder with **Restricted** access and ask *"Read notes.txt and write a short summary to summary.md."* See [Your first file task](./docs/start-without-technical-background.md#your-first-file-task).
**Your first three steps**
Once that works, you can ask nanobot right in chat to help configure your next feature—for example: *"I am using the WebUI. Help me connect Telegram and allow only my account."* (See [Continue with nanobot](./docs/quick-start.md#continue-with-nanobot).)
1. Open **Settings → Models** and choose a provider, credential, and model.
2. Start a new topic and send `Hello!` to verify the connection.
3. Before project work, choose the intended workspace and access mode from the composer.
<details>
<summary>Terminal-only setup and interactive TUI</summary>
Any normal reply means the provider, model, workspace, and browser gateway are working together.
Configure a model without a browser:
```bash
nanobot onboard --wizard
```
Send a single test message or launch the interactive terminal UI (shares history and gateway with the WebUI):
```bash
nanobot agent -m "Hello!"
nanobot
```
Useful TUI shortcuts: type `/` for commands, `@` for apps/topics, `$` for skills, `Ctrl+V` / `Alt+V` to paste images, `/diff` to view edits, `/context` to inspect usage, and `/detach` to keep the gateway running in the background after closing the TUI. See [CLI Reference](./docs/cli-reference.md#agent-cli).
</details>
<details>
<summary>Open a remote server's WebUI over SSH</summary>
On the remote server:
```bash
nanobot webui --no-open
```
On your computer, forward port `8765`:
```bash
ssh -N -L 127.0.0.1:8765:127.0.0.1:8765 user@SERVER
```
Then open the **complete login link** printed on the server (including everything after `#`) in your local browser. You can also connect to existing remote servers directly from your local WebUI via **Manage connections…**—see [Connect to an Existing Remote nanobot](./docs/guides/remote-instances.md).
</details>
<details>
<summary>Keep nanobot running in the background</summary>
With the official installer, nanobot already stays running in the background after you close the browser or terminal. For other installs, run:
**Keep nanobot running after you close the terminal**
```bash
nanobot gateway --background
```
Manage the background gateway anytime:
This is the only command that promotes the shared gateway to persistent background mode. It leaves channels and automations running after every local TUI and WebUI launcher exits. Complete first-time model setup with `nanobot webui` before switching to background mode; open the same localhost WebUI again afterward.
```bash
nanobot gateway status
@@ -203,98 +193,131 @@ nanobot gateway restart
nanobot gateway stop
```
For automatic startup across reboots, see [Deployment](./docs/deployment.md).
**Prefer a gateway-first workflow?**
</details>
```bash
nanobot gateway
```
If nanobot is helpful to you, giving the repo a star on GitHub is the simplest way to support the project!
This skips WebUI setup and browser opening, then runs the same complete gateway in the current terminal. It is the familiar entry point if you are coming from OpenClaw or already operate agents as long-lived services. The WebUI remains available when its channel is configured; open it manually when needed.
Use `nanobot gateway --background` for the same direct entry point without keeping the terminal attached. For automatic startup and supervision by the operating system, see [Deployment](./docs/deployment.md).
**Prefer to work entirely in the terminal?**
```bash
nanobot
```
This opens the native terminal client with the launch directory as its workspace. It shares saved conversations and the local gateway with the WebUI. The explicit `nanobot agent` form remains available for compatibility.
- Type `/` to discover commands, `/sessions` to switch conversations, or `@` to mention an app, MCP server, or saved session.
- Press `Enter` to send. While nanobot is working, `Enter` sends now and `Tab` sends after the current response. Press `Shift+Enter` to add a newline (`Ctrl+J` works in terminals that cannot distinguish modified Enter keys).
- Use `/detach` to leave the current task running, or start with `nanobot gateway --background` when nanobot should stay online after all local clients exit.
Each launch starts a new session by default. Use `--session` to resume one and `--workspace` to choose another workspace. See the [CLI reference](./docs/cli-reference.md#agent-cli) for session branching, diffs, history, shortcuts, gateway lifecycle, and compatibility options.
For one request and an immediate exit, use:
```bash
nanobot -m "Hello!"
```
The one-shot form is useful for a quick provider check, shell scripts, and local automation. If you have not configured a model yet, run `nanobot webui` and open **Settings → Models** first.
Need manual JSON, another device on your LAN, or help with provider/model matching? Continue with [Install and Quick Start](./docs/quick-start.md), [WebUI](./docs/webui.md), or [Troubleshooting](./docs/troubleshooting.md).
If nanobot worked for you, a star on GitHub is the simplest way to support the project.
- Want a pasteable provider setup? See [Provider Cookbook](./docs/provider-cookbook.md)
- Want to understand provider/model matching? See [Providers and Models](./docs/providers.md)
- Want web search, MCP, security settings, or more config options? See [Configuration](./docs/configuration.md)
- Want to run locally? See [Ollama](./docs/providers.md#ollama), [vLLM or another local OpenAI-compatible server](./docs/providers.md#vllm-or-other-local-openai-compatible-server), and the full [provider reference](./docs/configuration.md#providers).
- Want to run nanobot in chat apps like Telegram, Discord, WeChat or Feishu? See [Chat Apps](./docs/chat-apps.md)
- Want Docker or Linux service deployment? See [Deployment](./docs/deployment.md)
<a id="deploy-to-render"></a>
## ☁️ Deploy
**One-click on Render**
**Render — one click**
Deploy the gateway and bundled WebUI with persistent storage (requires a paid Render Starter plan for the persistent disk):
Deploy nanobot's gateway and bundled WebUI from the repository's ready-to-use Blueprint:
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/HKUDS/nanobot)
Render will ask for `ANTHROPIC_API_KEY` and a private `NANOBOT_WEB_TOKEN`, then provision persistent storage for sessions, memory, and WebUI history. Persistent disks require a paid Render service.
**Self-host**
See the [Deployment Guide](./docs/deployment.md) for Docker Compose, Docker, Linux `systemd`, and macOS LaunchAgent setup.
Prefer your own infrastructure? Follow the [deployment guide](./docs/deployment.md) for Docker, Docker Compose, Linux services, and macOS LaunchAgent setup.
## 🌐 WebUI
The WebUI is included out of the box—just run `nanobot webui`.
The WebUI ships **inside the published wheel** with no separate frontend build. It is the browser workbench for persistent topics, temporary chats, visible agent activity, workspace controls, Apps, Skills, Automations, and settings.
<p align="center">
<img src="./images/nanobot-workbench.png" alt="Three conversations in one WebUI workbench" width="900">
<img src="images/nanobot_webui.png" alt="nanobot webui preview" width="900">
</p>
<details>
<summary>Mobile WebUI · dark theme</summary>
Use it to:
<p align="center">
<img src="./images/nanobot-mobile.png" alt="Mobile WebUI in dark theme" width="390">
</p>
- keep separate topics for different tasks and projects;
- use temporary chats when a conversation should not be saved to history or memory;
- inspect reasoning, tool calls, file edits, diffs, command output, and generated artifacts;
- switch models and workspaces without leaving the conversation;
- configure providers and chat channels, connect Apps, discover Skills, and manage Automations from one place.
</details>
See the [WebUI guide](./docs/webui.md) for LAN access, background operation, workspace controls, and the full feature tour. Working on the frontend itself? Use [`webui/README.md`](./webui/README.md).
### Keep related work side by side
Group up to four topics in resizable panes, fork any conversation from an earlier reply, or mention another topic with `@` to pull in its context. Pick a project folder and access mode per topic—and use [Temporary chats](./docs/webui.md#temporary-chats) for throwaway questions outside saved history and memory. [Explore topics and panes →](./docs/webui.md#conversation-groups-and-panes)
### Inspect every step and token
Expand agent activity to inspect reasoning, tool calls, inline file diffs, and read-only file previews. Click the context indicator to review token usage, cache reuse, and the file graph across turns.
<p align="center">
<img src="./images/nanobot-context.png" alt="Expanded file-edit diff and context usage chart" width="900">
</p>
[Explore activity and context →](./docs/webui.md#activity-and-context-usage)
### Connect tools, skills, and chat apps
Use **Apps** to add MCP servers (with built-in OAuth and keyless presets), Agent Plugins, and CLI Apps, then attach them in chat with `@`. Manage built-in and marketplace skills in **Skills**, and connect chat platforms with guided setup in **Channels**.
<p align="center">
<img src="./images/nanobot-apps.png" alt="The Apps MCP catalog with searchable integration presets" width="900">
</p>
[Explore Apps →](./docs/webui.md#apps) · [Discover Skills →](./docs/webui.md#skills) · [Connect chat apps →](./docs/guides/chat-app-ai-agent.md)
### Automate recurring work
Ask nanobot in any topic to schedule reminders or recurring reports, or create local triggers (`/trigger`) for scripts and CI jobs. Manage everything from **Automations** with list and calendar views.
<p align="center">
<img src="./images/nanobot-automations.png" alt="The Automations calendar view" width="900">
</p>
[Explore Automations →](./docs/automations.md) · [Full WebUI Guide →](./docs/webui.md)
## Architecture
## 🏗️ Architecture
<p align="center">
<img src="images/nanobot_arch.png" alt="nanobot architecture" width="800">
</p>
A single Python gateway powers the WebUI, terminal UI, and all chat apps—handling sessions, tools, memory, automations, and security policy in one place. Use the [Python SDK](./docs/python-sdk.md) to embed nanobot in your own Python applications, or read [Architecture](./docs/architecture.md) for source-level details.
🐈 nanobot stays lightweight by centering everything around a small agent loop: messages come in from chat apps, the LLM decides when tools are needed, and memory or skills are pulled in only as context instead of becoming a heavy orchestration layer. That keeps the core path readable and easy to extend, while still letting you add channels, tools, memory, and deployment options without turning the system into a monolith.
## Docs
## 📚 Docs
Browse the [documentation index](./docs/README.md) (or [nanobot.wiki](https://nanobot.wiki/docs/latest/getting-started/nanobot-overview) for the latest stable release):
Browse the [repo docs](./docs/README.md) for the latest features and GitHub development version, or visit [nanobot.wiki](https://nanobot.wiki/docs/latest/getting-started/nanobot-overview) for the stable release documentation.
- **Get started:** [Beginner walkthrough](./docs/start-without-technical-background.md) · [Install and Quick Start](./docs/quick-start.md)
- **Models & providers:** [Providers and Models](./docs/providers.md) · [Provider Cookbook](./docs/provider-cookbook.md)
- **Chat apps & tools:** [Chat Apps Guide](./docs/guides/chat-app-ai-agent.md) · [MCP Presets](./docs/mcp-presets.md) · [Image Generation](./docs/image-generation.md)
- **Memory & automations:** [Memory](./docs/memory.md) · [Automations](./docs/automations.md) · [Deployment](./docs/deployment.md)
- **Reference & help:** [Concepts](./docs/concepts.md) · [Configuration](./docs/configuration.md) · [Troubleshooting](./docs/troubleshooting.md) · [Task Guides](./docs/guides/README.md)
- Use task-oriented guides: [Guides](./docs/guides/README.md)
- Start with no technical background: [Start Without Technical Background](./docs/start-without-technical-background.md)
- Start from zero with developer basics: [Install and Quick Start](./docs/quick-start.md)
- Understand the runtime model: [Concepts](./docs/concepts.md)
- Read the source-level map: [Architecture](./docs/architecture.md)
- Choose a provider/model: [Providers and Models](./docs/providers.md)
- Copy provider setup recipes: [Provider Cookbook](./docs/provider-cookbook.md)
- Debug setup and runtime failures: [Troubleshooting](./docs/troubleshooting.md)
- Talk to your nanobot with familiar chat apps: [Chat App AI Agent](./docs/guides/chat-app-ai-agent.md) · [Chat Apps](./docs/chat-apps.md)
- Schedule or trigger agent work: [Automations](./docs/automations.md)
- Configure providers, web search, MCP, and runtime behavior: [Configuration](./docs/configuration.md)
- Integrate nanobot with local tools and automations: [OpenAI-Compatible API](./docs/openai-api.md) · [Python SDK](./docs/python-sdk.md)
- Run nanobot with Docker or as a Linux service: [Deployment](./docs/deployment.md)
## Releases
**Latest release: [v0.4.1](https://github.com/HKUDS/nanobot/releases/tag/v0.4.1)** — improves workspace permissions, sandboxed commands, connection recovery, file-context previews, and navigation. See [release notes](https://github.com/HKUDS/nanobot/releases/tag/v0.4.1), [Updating nanobot](./docs/updating.md), and the [release archive](./docs/release-archive.md).
**Latest release: [v0.3.0 - The Agency Release](https://github.com/HKUDS/nanobot/releases/tag/v0.3.0)**
The Agency Release turns nanobot from a durable workbench into an agent runtime that can coordinate helpers, switch models per session, and carry authorized work through to completion.
- Consult inline subagents without leaving the current task
- Switch model presets per session directly from the composer
- Start from a guided WebUI setup with clearer execution controls
- Apply configuration changes live across a more reliable provider, channel, and tool runtime
[Read the v0.3.0 release notes](https://github.com/HKUDS/nanobot/releases/tag/v0.3.0)
## Recent Updates
- **2026-07-24** Guided first-run setup, inline subagents, and model switching from the composer.
- **2026-07-23** Grok OAuth with hosted X Search, live image settings, and clearer fallback models.
- **2026-07-22** Parallel Search, live configuration reloads, richer app discovery, and a smoother mobile WebUI.
- **2026-07-21** Codex fast mode, visible skill references, safer configuration saves, and sturdier task cleanup.
- **2026-07-20** Cleaner code blocks and copy actions, self-contained channels, and steadier QQ reconnects.
For older updates, see the [release archive](./docs/release-archive.md) or [GitHub releases](https://github.com/HKUDS/nanobot/releases).
## Open Source Partners
@@ -305,14 +328,18 @@ Browse the [documentation index](./docs/README.md) (or [nanobot.wiki](https://na
## 🤝 Contribute
Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues) with a bug, reproduction, use case, or suggestion. Discuss the problem first; pull requests are currently limited to repository collaborators. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the contribution process and recognition.
Use nanobot for a real task, report what broke, and then pick a focused improvement.
- Read [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow.
- Browse [open issues](https://github.com/HKUDS/nanobot/issues) for problems to investigate.
- Open a [pull request](https://github.com/HKUDS/nanobot/pulls) for a focused fix or integration.
## Maintainers
<table>
<tr>
<td align="center"><a href="https://github.com/re-bin"><img src="https://avatars.githubusercontent.com/u/52506698?v=4&s=80" width="80" height="80" alt="Xubin Ren"><br><strong>Xubin Ren</strong></a><br><a href="https://x.com/xubinrencs"><img src="https://img.shields.io/badge/@xubinrencs-000000?style=flat&logo=x&logoColor=white" alt="Xubin Ren on X"></a></td>
<td align="center"><a href="https://github.com/chengyongru"><img src="https://avatars.githubusercontent.com/u/61816729?v=4&s=80" width="80" height="80" alt="Yongru Cheng"><br><strong>Yongru Cheng</strong></a><br><a href="https://x.com/chengyongru"><img src="https://img.shields.io/badge/@chengyongru-000000?style=flat&logo=x&logoColor=white" alt="Yongru Cheng on X"></a></td>
<td align="center"><a href="https://github.com/chengyongru"><img src="https://avatars.githubusercontent.com/u/61816729?v=4&s=80" width="80" height="80" alt="Yongru Chen"><br><strong>Yongru Chen</strong></a><br><a href="https://x.com/chengyongru"><img src="https://img.shields.io/badge/@chengyongru-000000?style=flat&logo=x&logoColor=white" alt="Yongru Chen on X"></a></td>
</tr>
</table>
@@ -323,11 +350,10 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/Athemis"><img src="https://avatars.githubusercontent.com/u/552653?v=4&s=48" width="48" height="48" alt="Athemis"></a>
<a href="https://github.com/axelray-dev"><img src="https://avatars.githubusercontent.com/u/110029405?v=4&s=48" width="48" height="48" alt="axelray-dev"></a>
<a href="https://github.com/yorkhellen"><img src="https://avatars.githubusercontent.com/u/8706550?v=4&s=48" width="48" height="48" alt="yorkhellen"></a>
<a href="https://github.com/yu-xin-c"><img src="https://avatars.githubusercontent.com/u/175149126?v=4&s=48" width="48" height="48" alt="yu-xin-c"></a>
<a href="https://github.com/04cb"><img src="https://avatars.githubusercontent.com/u/111667698?v=4&s=48" width="48" height="48" alt="04cb"></a>
<a href="https://github.com/santhreal"><img src="https://avatars.githubusercontent.com/u/64453045?v=4&s=48" width="48" height="48" alt="santhreal"></a>
<a href="https://github.com/yu-xin-c"><img src="https://avatars.githubusercontent.com/u/175149126?v=4&s=48" width="48" height="48" alt="yu-xin-c"></a>
<a href="https://github.com/xcosmosbox"><img src="https://avatars.githubusercontent.com/u/56502269?v=4&s=48" width="48" height="48" alt="xcosmosbox"></a>
<a href="https://github.com/KDB-Wind"><img src="https://avatars.githubusercontent.com/u/271925278?v=4&s=48" width="48" height="48" alt="KDB-Wind"></a>
<a href="https://github.com/kunalk16"><img src="https://avatars.githubusercontent.com/u/5303824?v=4&s=48" width="48" height="48" alt="kunalk16"></a>
<a href="https://github.com/chaohuang-ai"><img src="https://avatars.githubusercontent.com/u/204865953?v=4&s=48" width="48" height="48" alt="chaohuang-ai"></a>
<a href="https://github.com/zayfod"><img src="https://avatars.githubusercontent.com/u/1811339?v=4&s=48" width="48" height="48" alt="zayfod"></a>
@@ -336,10 +362,11 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/flobo3"><img src="https://avatars.githubusercontent.com/u/268352850?v=4&s=48" width="48" height="48" alt="flobo3"></a>
<a href="https://github.com/hamb1y"><img src="https://avatars.githubusercontent.com/u/88080063?v=4&s=48" width="48" height="48" alt="hamb1y"></a>
<a href="https://github.com/SergioSV96"><img src="https://avatars.githubusercontent.com/u/20419761?v=4&s=48" width="48" height="48" alt="SergioSV96"></a>
<a href="https://github.com/KDB-Wind"><img src="https://avatars.githubusercontent.com/u/271925278?v=4&s=48" width="48" height="48" alt="KDB-Wind"></a>
<a href="https://github.com/morandot"><img src="https://avatars.githubusercontent.com/u/274257964?v=4&s=48" width="48" height="48" alt="morandot"></a>
<a href="https://github.com/michaelxer"><img src="https://avatars.githubusercontent.com/u/52305679?v=4&s=48" width="48" height="48" alt="michaelxer"></a>
<a href="https://github.com/coldxiangyu163"><img src="https://avatars.githubusercontent.com/u/134986317?v=4&s=48" width="48" height="48" alt="coldxiangyu163"></a>
<a href="https://github.com/boogieLing"><img src="https://avatars.githubusercontent.com/u/64551706?v=4&s=48" width="48" height="48" alt="boogieLing"></a>
<a href="https://github.com/michaelxer"><img src="https://avatars.githubusercontent.com/u/52305679?v=4&s=48" width="48" height="48" alt="michaelxer"></a>
<a href="https://github.com/aiguozhi123456"><img src="https://avatars.githubusercontent.com/u/126325311?v=4&s=48" width="48" height="48" alt="aiguozhi123456"></a>
<a href="https://github.com/pinhua33"><img src="https://avatars.githubusercontent.com/u/251483507?v=4&s=48" width="48" height="48" alt="pinhua33"></a>
<a href="https://github.com/pixan-ai"><img src="https://avatars.githubusercontent.com/u/218441143?v=4&s=48" width="48" height="48" alt="pixan-ai"></a>
@@ -349,7 +376,6 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/IlyaGusev"><img src="https://avatars.githubusercontent.com/u/2670295?v=4&s=48" width="48" height="48" alt="IlyaGusev"></a>
<a href="https://github.com/T3chC0wb0y"><img src="https://avatars.githubusercontent.com/u/68530847?v=4&s=48" width="48" height="48" alt="T3chC0wb0y"></a>
<a href="https://github.com/VITOHJL"><img src="https://avatars.githubusercontent.com/u/166518988?v=4&s=48" width="48" height="48" alt="VITOHJL"></a>
<a href="https://github.com/KailBug"><img src="https://avatars.githubusercontent.com/u/66873219?v=4&s=48" width="48" height="48" alt="KailBug"></a>
<a href="https://github.com/macroadster"><img src="https://avatars.githubusercontent.com/u/328366?v=4&s=48" width="48" height="48" alt="macroadster"></a>
<a href="https://github.com/Hinotoi-agent"><img src="https://avatars.githubusercontent.com/u/275430060?v=4&s=48" width="48" height="48" alt="Hinotoi-agent"></a>
<a href="https://github.com/kingassune"><img src="https://avatars.githubusercontent.com/u/6126851?v=4&s=48" width="48" height="48" alt="kingassune"></a>
@@ -368,24 +394,20 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/HaisamAbbas"><img src="https://avatars.githubusercontent.com/u/95044189?v=4&s=48" width="48" height="48" alt="HaisamAbbas"></a>
<a href="https://github.com/anunay999"><img src="https://avatars.githubusercontent.com/u/16853513?v=4&s=48" width="48" height="48" alt="anunay999"></a>
<a href="https://github.com/flaviovs"><img src="https://avatars.githubusercontent.com/u/1832699?v=4&s=48" width="48" height="48" alt="flaviovs"></a>
<a href="https://github.com/dajiaohuang"><img src="https://avatars.githubusercontent.com/u/108231307?v=4&s=48" width="48" height="48" alt="dajiaohuang"></a>
<a href="https://github.com/C-Li"><img src="https://avatars.githubusercontent.com/u/20661667?v=4&s=48" width="48" height="48" alt="C-Li"></a>
<a href="https://github.com/Ho1yShif"><img src="https://avatars.githubusercontent.com/u/75815862?v=4&s=48" width="48" height="48" alt="Ho1yShif"></a>
<a href="https://github.com/pjhoberman"><img src="https://avatars.githubusercontent.com/u/37924?v=4&s=48" width="48" height="48" alt="pjhoberman"></a>
<a href="https://github.com/nghiahsgs"><img src="https://avatars.githubusercontent.com/u/24955327?v=4&s=48" width="48" height="48" alt="nghiahsgs"></a>
<a href="https://github.com/Bahtya"><img src="https://avatars.githubusercontent.com/u/34988899?v=4&s=48" width="48" height="48" alt="Bahtya"></a>
<a href="https://github.com/ZhouJ-sh"><img src="https://avatars.githubusercontent.com/u/9983860?v=4&s=48" width="48" height="48" alt="ZhouJ-sh"></a>
<a href="https://github.com/bingqilinweimaotai"><img src="https://avatars.githubusercontent.com/u/111987281?v=4&s=48" width="48" height="48" alt="bingqilinweimaotai"></a>
<a href="https://github.com/Shizoqua"><img src="https://avatars.githubusercontent.com/u/136805224?v=4&s=48" width="48" height="48" alt="Shizoqua"></a>
<a href="https://github.com/tangtaizong666"><img src="https://avatars.githubusercontent.com/u/212687958?v=4&s=48" width="48" height="48" alt="tangtaizong666"></a>
<a href="https://github.com/XJPeng12"><img src="https://avatars.githubusercontent.com/u/50786186?v=4&s=48" width="48" height="48" alt="XJPeng12"></a>
<a href="https://github.com/yanghan-cyber"><img src="https://avatars.githubusercontent.com/u/188783428?v=4&s=48" width="48" height="48" alt="yanghan-cyber"></a>
<a href="https://github.com/ZhouJ-sh"><img src="https://avatars.githubusercontent.com/u/9983860?v=4&s=48" width="48" height="48" alt="ZhouJ-sh"></a>
<a href="https://github.com/Yuxin-Lou"><img src="https://avatars.githubusercontent.com/u/117000057?v=4&s=48" width="48" height="48" alt="Yuxin-Lou"></a>
<a href="https://github.com/LeoFYH"><img src="https://avatars.githubusercontent.com/u/184173704?v=4&s=48" width="48" height="48" alt="LeoFYH"></a>
<a href="https://github.com/claude"><img src="https://avatars.githubusercontent.com/u/81847?v=4&s=48" width="48" height="48" alt="claude"></a>
<a href="https://github.com/chris-alexander"><img src="https://avatars.githubusercontent.com/u/2815297?v=4&s=48" width="48" height="48" alt="chris-alexander"></a>
<a href="https://github.com/benlenarts"><img src="https://avatars.githubusercontent.com/u/131161?v=4&s=48" width="48" height="48" alt="benlenarts"></a>
<a href="https://github.com/wzrayyy"><img src="https://avatars.githubusercontent.com/u/143233939?v=4&s=48" width="48" height="48" alt="wzrayyy"></a>
<a href="https://github.com/outlook84"><img src="https://avatars.githubusercontent.com/u/96007761?v=4&s=48" width="48" height="48" alt="outlook84"></a>
<a href="https://github.com/Mrart"><img src="https://avatars.githubusercontent.com/u/5235758?v=4&s=48" width="48" height="48" alt="Mrart"></a>
<a href="https://github.com/ramonpaolo"><img src="https://avatars.githubusercontent.com/u/53312850?v=4&s=48" width="48" height="48" alt="ramonpaolo"></a>
@@ -393,6 +415,7 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/tangjiabin"><img src="https://avatars.githubusercontent.com/u/21021242?v=4&s=48" width="48" height="48" alt="tangjiabin"></a>
<a href="https://github.com/yeyitech"><img src="https://avatars.githubusercontent.com/u/231244789?v=4&s=48" width="48" height="48" alt="yeyitech"></a>
<a href="https://github.com/Flinn-X"><img src="https://avatars.githubusercontent.com/u/54433526?v=4&s=48" width="48" height="48" alt="Flinn-X"></a>
<a href="https://github.com/bingqilinweimaotai"><img src="https://avatars.githubusercontent.com/u/111987281?v=4&s=48" width="48" height="48" alt="bingqilinweimaotai"></a>
<a href="https://github.com/Qinnnnnn"><img src="https://avatars.githubusercontent.com/u/14584068?v=4&s=48" width="48" height="48" alt="Qinnnnnn"></a>
<a href="https://github.com/HengWeiBin"><img src="https://avatars.githubusercontent.com/u/45145821?v=4&s=48" width="48" height="48" alt="HengWeiBin"></a>
<a href="https://github.com/waelantar"><img src="https://avatars.githubusercontent.com/u/70063334?v=4&s=48" width="48" height="48" alt="waelantar"></a>
@@ -401,6 +424,7 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/masterlyj"><img src="https://avatars.githubusercontent.com/u/167326996?v=4&s=48" width="48" height="48" alt="masterlyj"></a>
<a href="https://github.com/xgzlucario"><img src="https://avatars.githubusercontent.com/u/48748794?v=4&s=48" width="48" height="48" alt="xgzlucario"></a>
<a href="https://github.com/dzydzydzy7"><img src="https://avatars.githubusercontent.com/u/32220064?v=4&s=48" width="48" height="48" alt="dzydzydzy7"></a>
<a href="https://github.com/dajiaohuang"><img src="https://avatars.githubusercontent.com/u/108231307?v=4&s=48" width="48" height="48" alt="dajiaohuang"></a>
<a href="https://github.com/concertypin"><img src="https://avatars.githubusercontent.com/u/55056558?v=4&s=48" width="48" height="48" alt="concertypin"></a>
<a href="https://github.com/WangCheng0116"><img src="https://avatars.githubusercontent.com/u/111694270?v=4&s=48" width="48" height="48" alt="WangCheng0116"></a>
<a href="https://github.com/yarikoptic"><img src="https://avatars.githubusercontent.com/u/39889?v=4&s=48" width="48" height="48" alt="yarikoptic"></a>
@@ -408,8 +432,6 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/gongpx20069"><img src="https://avatars.githubusercontent.com/u/21985921?v=4&s=48" width="48" height="48" alt="gongpx20069"></a>
<a href="https://github.com/tobrien"><img src="https://avatars.githubusercontent.com/u/36787?v=4&s=48" width="48" height="48" alt="tobrien"></a>
<a href="https://github.com/Shiniese"><img src="https://avatars.githubusercontent.com/u/135589327?v=4&s=48" width="48" height="48" alt="Shiniese"></a>
<a href="https://github.com/zpljd258"><img src="https://avatars.githubusercontent.com/u/11162658?v=4&s=48" width="48" height="48" alt="zpljd258"></a>
<a href="https://github.com/FanouZeng-TT"><img src="https://avatars.githubusercontent.com/u/124567600?v=4&s=48" width="48" height="48" alt="FanouZeng-TT"></a>
<a href="https://github.com/shawnWXN"><img src="https://avatars.githubusercontent.com/u/47786182?v=4&s=48" width="48" height="48" alt="shawnWXN"></a>
<a href="https://github.com/sbyinin"><img src="https://avatars.githubusercontent.com/u/2064038?v=4&s=48" width="48" height="48" alt="sbyinin"></a>
<a href="https://github.com/nne998"><img src="https://avatars.githubusercontent.com/u/148901?v=4&s=48" width="48" height="48" alt="nne998"></a>
@@ -421,11 +443,13 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/who96"><img src="https://avatars.githubusercontent.com/u/44131846?v=4&s=48" width="48" height="48" alt="who96"></a>
<a href="https://github.com/cyzlmh"><img src="https://avatars.githubusercontent.com/u/24603258?v=4&s=48" width="48" height="48" alt="cyzlmh"></a>
<a href="https://github.com/zhuzhh"><img src="https://avatars.githubusercontent.com/u/41102272?v=4&s=48" width="48" height="48" alt="zhuzhh"></a>
<a href="https://github.com/zpljd258"><img src="https://avatars.githubusercontent.com/u/11162658?v=4&s=48" width="48" height="48" alt="zpljd258"></a>
<a href="https://github.com/cms19859230182-lang"><img src="https://avatars.githubusercontent.com/u/276597748?v=4&s=48" width="48" height="48" alt="cms19859230182-lang"></a>
<a href="https://github.com/amplifierplus"><img src="https://avatars.githubusercontent.com/u/160200579?v=4&s=48" width="48" height="48" alt="amplifierplus"></a>
<a href="https://github.com/LZDQ"><img src="https://avatars.githubusercontent.com/u/45907809?v=4&s=48" width="48" height="48" alt="LZDQ"></a>
<a href="https://github.com/wb213"><img src="https://avatars.githubusercontent.com/u/488412?v=4&s=48" width="48" height="48" alt="wb213"></a>
<a href="https://github.com/shaun0927"><img src="https://avatars.githubusercontent.com/u/70629228?v=4&s=48" width="48" height="48" alt="shaun0927"></a>
<a href="https://github.com/wzrayyy"><img src="https://avatars.githubusercontent.com/u/143233939?v=4&s=48" width="48" height="48" alt="wzrayyy"></a>
<a href="https://github.com/LHMQ878"><img src="https://avatars.githubusercontent.com/u/205284459?v=4&s=48" width="48" height="48" alt="LHMQ878"></a>
<a href="https://github.com/Michael-lhh"><img src="https://avatars.githubusercontent.com/u/41994684?v=4&s=48" width="48" height="48" alt="Michael-lhh"></a>
<a href="https://github.com/Mizarka"><img src="https://avatars.githubusercontent.com/u/253529828?v=4&s=48" width="48" height="48" alt="Mizarka"></a>
@@ -440,9 +464,6 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/chtangwin"><img src="https://avatars.githubusercontent.com/u/8316617?v=4&s=48" width="48" height="48" alt="chtangwin"></a>
<a href="https://github.com/dxtime"><img src="https://avatars.githubusercontent.com/u/8173810?v=4&s=48" width="48" height="48" alt="dxtime"></a>
<a href="https://github.com/ethanclaw"><img src="https://avatars.githubusercontent.com/u/262543029?v=4&s=48" width="48" height="48" alt="ethanclaw"></a>
<a href="https://github.com/Naster17"><img src="https://avatars.githubusercontent.com/u/62520991?v=4&s=48" width="48" height="48" alt="Naster17"></a>
<a href="https://github.com/L4XB"><img src="https://avatars.githubusercontent.com/u/103962359?v=4&s=48" width="48" height="48" alt="L4XB"></a>
<a href="https://github.com/Oxygen56"><img src="https://avatars.githubusercontent.com/u/100782273?v=4&s=48" width="48" height="48" alt="Oxygen56"></a>
<a href="https://github.com/WufeiHalf"><img src="https://avatars.githubusercontent.com/u/103879607?v=4&s=48" width="48" height="48" alt="WufeiHalf"></a>
<a href="https://github.com/stutiredboy"><img src="https://avatars.githubusercontent.com/u/345208?v=4&s=48" width="48" height="48" alt="stutiredboy"></a>
<a href="https://github.com/stupidloud"><img src="https://avatars.githubusercontent.com/u/56048681?v=4&s=48" width="48" height="48" alt="stupidloud"></a>
@@ -471,6 +492,7 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/honjiaxuan"><img src="https://avatars.githubusercontent.com/u/13818528?v=4&s=48" width="48" height="48" alt="honjiaxuan"></a>
<a href="https://github.com/DeeJ4yNg"><img src="https://avatars.githubusercontent.com/u/99658722?v=4&s=48" width="48" height="48" alt="DeeJ4yNg"></a>
<a href="https://github.com/danielphang"><img src="https://avatars.githubusercontent.com/u/1204069?v=4&s=48" width="48" height="48" alt="danielphang"></a>
<a href="https://github.com/yanalialiuk"><img src="https://avatars.githubusercontent.com/u/193742981?v=4&s=48" width="48" height="48" alt="yanalialiuk"></a>
<a href="https://github.com/zhouzhuojie"><img src="https://avatars.githubusercontent.com/u/658840?v=4&s=48" width="48" height="48" alt="zhouzhuojie"></a>
<a href="https://github.com/zerone0x"><img src="https://avatars.githubusercontent.com/u/39543393?v=4&s=48" width="48" height="48" alt="zerone0x"></a>
<a href="https://github.com/yrk111222"><img src="https://avatars.githubusercontent.com/u/185151020?v=4&s=48" width="48" height="48" alt="yrk111222"></a>
@@ -478,6 +500,8 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/suger-m"><img src="https://avatars.githubusercontent.com/u/240725677?v=4&s=48" width="48" height="48" alt="suger-m"></a>
<a href="https://github.com/mengyhang"><img src="https://avatars.githubusercontent.com/u/148381938?v=4&s=48" width="48" height="48" alt="mengyhang"></a>
<a href="https://github.com/Liwx1014"><img src="https://avatars.githubusercontent.com/u/186271593?v=4&s=48" width="48" height="48" alt="Liwx1014"></a>
<a href="https://github.com/Shizoqua"><img src="https://avatars.githubusercontent.com/u/136805224?v=4&s=48" width="48" height="48" alt="Shizoqua"></a>
<a href="https://github.com/KailBug"><img src="https://avatars.githubusercontent.com/u/66873219?v=4&s=48" width="48" height="48" alt="KailBug"></a>
<a href="https://github.com/19emtuck"><img src="https://avatars.githubusercontent.com/u/956861?v=4&s=48" width="48" height="48" alt="19emtuck"></a>
<a href="https://github.com/tsubasakong"><img src="https://avatars.githubusercontent.com/u/97429702?v=4&s=48" width="48" height="48" alt="tsubasakong"></a>
<a href="https://github.com/wseng"><img src="https://avatars.githubusercontent.com/u/6572161?v=4&s=48" width="48" height="48" alt="wseng"></a>
@@ -510,14 +534,6 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/pjbakker"><img src="https://avatars.githubusercontent.com/u/1267780?v=4&s=48" width="48" height="48" alt="pjbakker"></a>
<a href="https://github.com/luojiaaoo"><img src="https://avatars.githubusercontent.com/u/62821977?v=4&s=48" width="48" height="48" alt="luojiaaoo"></a>
<a href="https://github.com/NearlCrews"><img src="https://avatars.githubusercontent.com/u/23341701?v=4&s=48" width="48" height="48" alt="NearlCrews"></a>
<a href="https://github.com/Krislu1221"><img src="https://avatars.githubusercontent.com/u/258380416?v=4&s=48" width="48" height="48" alt="Krislu1221"></a>
<a href="https://github.com/beemines"><img src="https://avatars.githubusercontent.com/u/182060364?v=4&s=48" width="48" height="48" alt="beemines"></a>
<a href="https://github.com/Wsp030914"><img src="https://avatars.githubusercontent.com/u/134924516?v=4&s=48" width="48" height="48" alt="Wsp030914"></a>
<a href="https://github.com/pengpengyi92"><img src="https://avatars.githubusercontent.com/u/74917296?v=4&s=48" width="48" height="48" alt="pengpengyi92"></a>
<a href="https://github.com/LuckTerence"><img src="https://avatars.githubusercontent.com/u/156219145?v=4&s=48" width="48" height="48" alt="LuckTerence"></a>
<a href="https://github.com/yankeguo"><img src="https://avatars.githubusercontent.com/u/52509957?v=4&s=48" width="48" height="48" alt="yankeguo"></a>
<a href="https://github.com/nolanchic"><img src="https://avatars.githubusercontent.com/u/14110199?v=4&s=48" width="48" height="48" alt="nolanchic"></a>
<a href="https://github.com/yanalialiuk"><img src="https://avatars.githubusercontent.com/u/193742981?v=4&s=48" width="48" height="48" alt="yanalialiuk"></a>
<a href="https://github.com/yongPhone"><img src="https://avatars.githubusercontent.com/u/29919651?v=4&s=48" width="48" height="48" alt="yongPhone"></a>
<a href="https://github.com/ZXGERIC"><img src="https://avatars.githubusercontent.com/u/25354180?v=4&s=48" width="48" height="48" alt="ZXGERIC"></a>
<a href="https://github.com/erikmackinnon"><img src="https://avatars.githubusercontent.com/u/40612473?v=4&s=48" width="48" height="48" alt="erikmackinnon"></a>
@@ -625,6 +641,7 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/kamalakarrao"><img src="https://avatars.githubusercontent.com/u/15045455?v=4&s=48" width="48" height="48" alt="kamalakarrao"></a>
<a href="https://github.com/KEEPSLAMDUNK"><img src="https://avatars.githubusercontent.com/u/155275575?v=4&s=48" width="48" height="48" alt="KEEPSLAMDUNK"></a>
<a href="https://github.com/krisLu"><img src="https://avatars.githubusercontent.com/u/92515202?v=4&s=48" width="48" height="48" alt="krisLu"></a>
<a href="https://github.com/Krislu1221"><img src="https://avatars.githubusercontent.com/u/258380416?v=4&s=48" width="48" height="48" alt="Krislu1221"></a>
<a href="https://github.com/kyya"><img src="https://avatars.githubusercontent.com/u/13448248?v=4&s=48" width="48" height="48" alt="kyya"></a>
<a href="https://github.com/rreben"><img src="https://avatars.githubusercontent.com/u/4026131?v=4&s=48" width="48" height="48" alt="rreben"></a>
<a href="https://github.com/ATECHPCS"><img src="https://avatars.githubusercontent.com/u/125108010?v=4&s=48" width="48" height="48" alt="ATECHPCS"></a>
@@ -695,23 +712,6 @@ Everyone is welcome to [open an issue](https://github.com/HKUDS/nanobot/issues)
<a href="https://github.com/RohitDayanand"><img src="https://avatars.githubusercontent.com/u/66650100?v=4&s=48" width="48" height="48" alt="RohitDayanand"></a>
<a href="https://github.com/katafractari"><img src="https://avatars.githubusercontent.com/u/1299228?v=4&s=48" width="48" height="48" alt="katafractari"></a>
<a href="https://github.com/rudy-of-the-corner"><img src="https://avatars.githubusercontent.com/u/188991374?v=4&s=48" width="48" height="48" alt="rudy-of-the-corner"></a>
<a href="https://github.com/fszcd"><img src="https://avatars.githubusercontent.com/u/198843689?v=4&s=48" width="48" height="48" alt="fszcd"></a>
<a href="https://github.com/kkkhoo"><img src="https://avatars.githubusercontent.com/u/128304090?v=4&s=48" width="48" height="48" alt="kkkhoo"></a>
<a href="https://github.com/chrischen-coder"><img src="https://avatars.githubusercontent.com/u/199752684?v=4&s=48" width="48" height="48" alt="chrischen-coder"></a>
<a href="https://github.com/cleverLucky"><img src="https://avatars.githubusercontent.com/u/109461752?v=4&s=48" width="48" height="48" alt="cleverLucky"></a>
<a href="https://github.com/n1uz1"><img src="https://avatars.githubusercontent.com/u/149388665?v=4&s=48" width="48" height="48" alt="n1uz1"></a>
<a href="https://github.com/shakewingo"><img src="https://avatars.githubusercontent.com/u/42901821?v=4&s=48" width="48" height="48" alt="shakewingo"></a>
<a href="https://github.com/Kuang-xianxin"><img src="https://avatars.githubusercontent.com/u/243476082?v=4&s=48" width="48" height="48" alt="Kuang-xianxin"></a>
<a href="https://github.com/0717lee"><img src="https://avatars.githubusercontent.com/u/185926419?v=4&s=48" width="48" height="48" alt="0717lee"></a>
<a href="https://github.com/loseintwilight"><img src="https://avatars.githubusercontent.com/u/247379972?v=4&s=48" width="48" height="48" alt="loseintwilight"></a>
<a href="https://github.com/AlfredChaos"><img src="https://avatars.githubusercontent.com/u/48818977?v=4&s=48" width="48" height="48" alt="AlfredChaos"></a>
<a href="https://github.com/BenWituka"><img src="https://avatars.githubusercontent.com/u/325817656?v=4&s=48" width="48" height="48" alt="BenWituka"></a>
<a href="https://github.com/gary23w"><img src="https://avatars.githubusercontent.com/u/61893883?v=4&s=48" width="48" height="48" alt="gary23w"></a>
<a href="https://github.com/tilladam"><img src="https://avatars.githubusercontent.com/u/555247?v=4&s=48" width="48" height="48" alt="tilladam"></a>
<a href="https://github.com/DannyYTL"><img src="https://avatars.githubusercontent.com/u/125264206?v=4&s=48" width="48" height="48" alt="DannyYTL"></a>
<a href="https://github.com/yaoruiquan"><img src="https://avatars.githubusercontent.com/u/179358755?v=4&s=48" width="48" height="48" alt="yaoruiquan"></a>
<a href="https://github.com/GUTYL"><img src="https://avatars.githubusercontent.com/u/35319275?v=4&s=48" width="48" height="48" alt="GUTYL"></a>
<a href="https://github.com/ZedingZhang"><img src="https://avatars.githubusercontent.com/u/50742926?v=4&s=48" width="48" height="48" alt="ZedingZhang"></a>
</p>
<!-- contributors:end -->
+14 -21
View File
@@ -60,16 +60,16 @@ chmod 600 ~/.nanobot/config.json
```
**Security Notes:**
- An empty `allowFrom` denies all access by default (or uses DM pairing where supported). Set `["*"]` only if you intentionally want public access.
- Get your Telegram user ID from `@userinfobot`.
- Use WhatsApp sender IDs as full phone numbers with country code and no leading `+`.
- Review access logs regularly for unauthorized access attempts.
- In `v0.1.4.post3` and earlier, an empty `allowFrom` allowed all users. Since `v0.1.4.post4`, empty `allowFrom` denies all access by default — set `["*"]` to explicitly allow everyone.
- Get your Telegram user ID from `@userinfobot`
- Use WhatsApp sender IDs as full phone numbers with country code and no leading `+`
- Review access logs regularly for unauthorized access attempts
### 3. Shell Command Execution
The `exec` tool can execute shell commands. While dangerous command patterns are blocked, you should:
- ✅ **Enable the exec sandbox** (`"tools.exec.sandbox": "bwrap"` on Linux, `"seatbelt"` on macOS) for kernel-level isolation
- ✅ **Enable the bwrap sandbox** (`"tools.exec.sandbox": "bwrap"`) for kernel-level isolation (Linux only)
- ✅ Review all tool usage in agent logs
- ✅ Understand what commands the agent is running
- ✅ Use a dedicated user account with limited privileges
@@ -77,25 +77,18 @@ The `exec` tool can execute shell commands. While dangerous command patterns are
- ❌ Don't disable security checks
- ❌ Don't run on systems with sensitive data without careful review
**Exec sandbox (bwrap on Linux, seatbelt on macOS):**
**Exec sandbox (bwrap):**
Set `"tools.exec.sandbox"` to wrap every shell command in an OS sandbox. Both backends restrict filesystem access:
On Linux, set `"tools.exec.sandbox": "bwrap"` to wrap every shell command in a [bubblewrap](https://github.com/containers/bubblewrap) sandbox. This uses Linux kernel namespaces to restrict what the process can see:
- Workspace directory → **read-write** (agent works normally)
- Media directory → **read-only** (can read uploaded attachments)
- System directories (`/usr`, `/bin`, `/lib`) → **read-only** (commands still work)
- The workspace's parent, which holds `~/.nanobot/config.json` in the default layout → **denied**, except for explicitly exposed roots
- Unlisted paths, including `~/.ssh` in the default layout → **denied**
- Config files and API keys (`~/.nanobot/config.json`) → **hidden** (masked by tmpfs)
| Backend | Value | Platform | Requires |
|---------|-------|----------|----------|
| [bubblewrap](https://github.com/containers/bubblewrap) | `"bwrap"` | Linux | `bwrap` (`apt install bubblewrap`). Pre-installed in the official Docker image. |
| Seatbelt | `"seatbelt"` | macOS | `sandbox-exec(1)`, shipped with macOS. |
Requires `bwrap` installed (`apt install bubblewrap`). Pre-installed in the official Docker image. **Not available on macOS or Windows** — bubblewrap depends on Linux kernel namespaces.
**Windows has no OS shell sandbox:** nanobot logs a warning and runs commands unsandboxed (disable shell execution if workspace guards are not enough).
> [!NOTE]
> The OS sandbox isolates the filesystem (not network access) and automatically enables `restrictToWorkspace` for file tools. Keep `~/.nanobot/config.json` and secrets outside your workspace, and use narrow `sandboxRoBinds` / `sandboxRwBinds` only when a tool needs extra paths. On macOS Seatbelt, `HOME` and `TMPDIR` point inside the workspace.
Enabling the sandbox also automatically activates `restrictToWorkspace` for file tools.
**Blocked patterns:**
- `rm -rf /` - Root filesystem deletion
@@ -119,12 +112,12 @@ File operations have path traversal protection, but:
**API Calls:**
- All external API calls use HTTPS by default
- Timeouts are configured to prevent hanging requests
- The OpenAI-compatible API server must set `api.api_key` when binding to `0.0.0.0` or `::`; otherwise startup fails to prevent unauthenticated network access
- Consider using a firewall to restrict outbound connections if needed
**WhatsApp:**
- Keep the neonize session database under `~/.nanobot/whatsapp-auth` secure (mode 0700).
- Use `nanobot channels login whatsapp --force` to remove and recreate the local session database when rotating linked devices.
- The separate `whatsapp_agent` channel authenticates with a per-agent API token. Treat it as a secret, prefer `${WA_AGENT_TOKEN}` over a literal value in `config.json`, and regenerate it in WhatsApp when it may have leaked. Its poll cursor holds no token material.
### 6. Dependency Security
@@ -140,9 +133,9 @@ pip install --upgrade nanobot-ai
```
**Important Notes:**
- Keep `nanobot-ai` and its dependencies up to date for security fixes.
- Run `pip-audit` regularly after enabling chat channels in production.
- Subscribe to security advisories for nanobot and its dependencies.
- Keep `litellm` updated to the latest version for security fixes
- Run `pip-audit` regularly after enabling the channels used in production; their manifest-declared dependencies are installed into the same environment
- Subscribe to security advisories for nanobot and its dependencies
### 7. Production Deployment
+6 -681
View File
@@ -1,6 +1,11 @@
# Third-Party Notices
The following third-party components are redistributed as part of the packaged nanobot Python distribution (`pip install nanobot-ai`). Native TUI executables are distributed separately in per-platform release archives. Each TUI archive carries its generated `THIRD_PARTY_NOTICES.txt`, project and runtime licenses, corresponding application source, written source offer, and relinking instructions; those target-specific notices are generated by `tui/scripts/release-notices.ts` and are not duplicated below.
The following third-party components are redistributed as part of the packaged
nanobot Python distribution (`pip install nanobot-ai`). Native TUI executables are distributed
separately in per-platform release archives. Each TUI archive carries its generated
`THIRD_PARTY_NOTICES.txt`, project and runtime licenses, corresponding application source,
written source offer, and relinking instructions; those target-specific notices are generated by
`tui/scripts/release-notices.ts` and are not duplicated below.
---
@@ -172,683 +177,3 @@ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
```
---
## loading.dev Blocks and Ring — loading animations (MIT)
- **Source**: https://github.com/jakubkrehel/loading/tree/48ff9a1cd5f0446901ff1a8a3d5d5f906d3e36ff
- **Adapted**: the diagonal Blocks sweep in `webui/src/components/thread/ThreadHistoryStatus.tsx` and `webui/src/globals.css`, and the circular Ring in `webui/src/components/ui/loading-ring.tsx` and `webui/src/globals.css`.
- **Bundled**: `nanobot/web/dist/assets/index-*.{js,css}`
```
MIT License
Copyright (c) 2026 Jakub Krehel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
---
## Motion — history-boundary springs (MIT)
- **Source**: https://github.com/motiondivision/motion
- **Components**: `motion`, `framer-motion`, and `motion-dom` 14.4.0; `motion-utils` 14.1.1.
- **Bundled**: `nanobot/web/dist/assets/ThreadShell-*.js`
```
The MIT License (MIT)
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
Copyright (c) 2018 Framer B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
---
## Pierre Diffs and Highlights — code highlighting and read-only diffs (Apache-2.0 and MIT dependencies)
- **Source**: https://github.com/pierrecomputer/pierre
- **Components**: `@pierre/diffs` 1.6.4, `@pierre/highlights` 0.4.0, `@pierre/theme` 2.0.0, and `@pierre/theming` 1.0.2; Shiki 4.6.0 and the dependencies identified below.
- **Bundled**: `nanobot/web/dist/assets/*.{js,wasm}`
The following license texts and upstream notices are retained from the distributed packages.
### `@pierre/diffs 1.6.4`, `@pierre/highlights 0.4.0`, `@pierre/theme 2.0.0`, `@pierre/theming 1.0.2`
```text
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the
copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other
entities that control, are controlled by, or are under common control with
that entity. For the purposes of this definition, "control" means (i) the
power, direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
(50%) or more of the outstanding shares, or (iii) beneficial ownership of
such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation source, and
configuration files.
"Object" form shall mean any form resulting from mechanical transformation
or translation of a Source form, including but not limited to compiled
object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form,
made available under the License, as indicated by a copyright notice that is
included in or attached to the work (an example is provided in the Appendix
below).
"Derivative Works" shall mean any work, whether in Source or Object form,
that is based on (or derived from) the Work and for which the editorial
revisions, annotations, elaborations, or other modifications represent, as a
whole, an original work of authorship. For the purposes of this License,
Derivative Works shall not include works that remain separable from, or
merely link (or bind by name) to the interfaces of, the Work and Derivative
Works thereof.
"Contribution" shall mean any work of authorship, including the original
version of the Work and any modifications or additions to that Work or
Derivative Works thereof, that is intentionally submitted to Licensor for
inclusion in the Work by the copyright owner or by an individual or Legal
Entity authorized to submit on behalf of the copyright owner. For the
purposes of this definition, "submitted" means any form of electronic,
verbal, or written communication sent to the Licensor or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the Licensor for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously
marked or otherwise designated in writing by the copyright owner as "Not a
Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on
behalf of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
reproduce, prepare Derivative Works of, publicly display, publicly perform,
sublicense, and distribute the Work and such Derivative Works in Source or
Object form.
3. Grant of Patent License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
this section) patent license to make, have made, use, offer to sell, sell,
import, and otherwise transfer the Work, where such license applies only to
those patent claims licensable by such Contributor that are necessarily
infringed by their Contribution(s) alone or by combination of their
Contribution(s) with the Work to which such Contribution(s) was submitted.
If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this
License for that Work shall terminate as of the date such litigation is
filed.
4. Redistribution. You may reproduce and distribute copies of the Work or
Derivative Works thereof in any medium, with or without modifications, and
in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a
copy of this License; and
(b) You must cause any modified files to carry prominent notices stating
that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You
distribute, all copyright, patent, trademark, and attribution notices from
the Source form of the Work, excluding those notices that do not pertain to
any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution,
then any Derivative Works that You distribute must include a readable copy
of the attribution notices contained within such NOTICE file, excluding
those notices that do not pertain to any part of the Derivative Works, in at
least one of the following places: within a NOTICE text file distributed as
part of the Derivative Works; within the Source form or documentation, if
provided along with the Derivative Works; or, within a display generated by
the Derivative Works, if and wherever such third-party notices normally
appear. The contents of the NOTICE file are for informational purposes only
and do not modify the License. You may add Your own attribution notices
within Derivative Works that You distribute, alongside or as an addendum to
the NOTICE text from the Work, provided that such additional attribution
notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may
provide additional or different license terms and conditions for use,
reproduction, or distribution of Your modifications, or for any such
Derivative Works as a whole, provided Your use, reproduction, and
distribution of the Work otherwise complies with the conditions stated in
this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any
Contribution intentionally submitted for inclusion in the Work by You to the
Licensor shall be under the terms and conditions of this License, without
any additional terms or conditions. Notwithstanding the above, nothing
herein shall supersede or modify the terms of any separate license agreement
you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names,
trademarks, service marks, or product names of the Licensor, except as
required for reasonable and customary use in describing the origin of the
Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
writing, Licensor provides the Work (and each Contributor provides its
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied, including, without limitation, any
warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
the appropriateness of using or redistributing the Work and assume any risks
associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in
tort (including negligence), contract, or otherwise, unless required by
applicable law (such as deliberate and grossly negligent acts) or agreed to
in writing, shall any Contributor be liable to You for damages, including
any direct, indirect, special, incidental, or consequential damages of any
character arising as a result of this License or out of the use or inability
to use the Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all other
commercial damages or losses), even if such Contributor has been advised of
the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or
Derivative Works thereof, You may choose to offer, and charge a fee for,
acceptance of support, warranty, indemnity, or other liability obligations
and/or rights consistent with this License. However, in accepting such
obligations, You may act only on Your own behalf and on Your sole
responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any
liability incurred by, or claims asserted against, such Contributor by
reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2025 Pierre Computer Company
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
```
### `@shikijs/core 4.6.0`, `@shikijs/engine-javascript 4.6.0`, `@shikijs/engine-oniguruma 4.6.0`, `@shikijs/langs 4.6.0`, `@shikijs/primitive 4.6.0`, `@shikijs/themes 4.6.0`, `@shikijs/types 4.6.0`, `shiki 4.6.0`
```text
MIT License
Copyright (c) 2021 Pine Wu
Copyright (c) 2023 Anthony Fu <https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `@shikijs/vscode-textmate 10.1.0`
```text
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `hast-util-to-html 9.0.5` and `9.0.6`
```text
(The MIT License)
Copyright (c) Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
### `lru_map 0.4.1`
```text
MIT license
Copyright (c) 2010-2016 Rasmus Andersson <https://rsms.me/>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
### `oniguruma-parser 0.12.2`
```text
MIT License
Copyright (c) 2025-2026 Steven Levithan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `oniguruma-to-es 4.3.6`
```text
MIT License
Copyright (c) 2024-2026 Steven Levithan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `regex 6.1.0`, `regex-recursion 6.0.2`
```text
MIT License
Copyright (c) 2025 Steven Levithan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### `regex-utilities 2.3.0`
```text
MIT License
Copyright (c) 2024 Steven Levithan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### Upstream NOTICE: `@pierre/highlights`
````text
# Bundled theme licenses
Community themes are pruned copies of pinned Zed theme files or conversions of
the pinned Shiki TextMate files listed below. Theme names and appearances are
normalized to Shiki's catalog.
## Sources
Terminal palettes use the same pinned sources as the themes below. Exceptions:
- Horizon's original repository is unavailable. Its palette comes from the
[Zed Horizon 0.0.1 archive](https://api.zed.dev/extensions/horizon/0.0.1/download).
- Andromeeda's two null black entries and both Horizon themes' four null black
and white entries use their inherited
[Zed defaults at `ce48461`](https://github.com/zed-industries/zed/blob/ce48461eaadd16c65c31f835511ab96bd3b6e746/crates/theme/src/default_colors.rs).
- LaserWave leaves ten terminal colors undefined; Slack Dark leaves all 16
undefined. These entries use the dark palette in
[VS Code at `3623f17`](https://github.com/microsoft/vscode/blob/3623f170559712f7ee16f59dfbd87c885b6a2b31/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts).
- Pierre's palettes come from
[its Zed theme](https://github.com/pierrecomputer/pierre/blob/861ce3c61e1cfeaf283d83e95a3767479e75bfee/packages/theme/zed/themes/pierre.json).
The vibrant variants preserve the Display P3 values in
[Pierre Dark Vibrant](https://github.com/pierrecomputer/pierre/blob/861ce3c61e1cfeaf283d83e95a3767479e75bfee/packages/theme/themes/pierre-dark-vibrant.json)
and
[Pierre Light Vibrant](https://github.com/pierrecomputer/pierre/blob/861ce3c61e1cfeaf283d83e95a3767479e75bfee/packages/theme/themes/pierre-light-vibrant.json).
Dracula's `ffffffff` bright white value is normalized to `#ffffffff`.
The Zed version is the extension version published in the
[Zed registry](https://github.com/zed-industries/extensions) at
`ab756766c27fca3de3d275149f6937105f464dec`. "Built in" means the theme ships
with Zed itself. GitHub-only sources have no marketplace version.
| Highlights themes | Pinned source | Zed version |
| -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| `andromeeda` | [ChocolateNao/andromeda-zed `23f6768`](https://github.com/ChocolateNao/andromeda-zed/blob/23f67684252059f46b508ae71964ad6085df552a/themes/andromeda.json) | `andromeda` 0.1.2 |
| `aurora-x` | [iamrajjoshi/aurora `83477d4`](https://github.com/iamrajjoshi/aurora/blob/83477d4b4abc4aeca9465d9b1b56409e2cd6da97/themes/aurora.json) | `aurora-theme` 0.0.1 |
| `ayu-dark`, `ayu-light`, `ayu-mirage` | [Zed Ayu `ce48461`](https://github.com/zed-industries/zed/blob/ce48461eaadd16c65c31f835511ab96bd3b6e746/assets/themes/ayu/ayu.json) | Built in |
| `catppuccin-*` | [catppuccin/zed `b54cb81`](https://github.com/catppuccin/zed/blob/b54cb81708d06912d50e6bb9fd2fd2103b9dda25/themes/catppuccin-mauve.json) | `catppuccin` 0.2.25 |
| `dark-plus`, `light-plus`, `monokai`, `red`, `solarized-*` | [alanisme/vscode-themes-for-zed `ea65e4d`](https://github.com/alanisme/vscode-themes-for-zed/tree/ea65e4df055035888b6bd0b0c68c6986c3ce4699/themes) | `vscode-classic-themes` 0.4.1 |
| `dracula` | [dracula/zed `92f4605`](https://github.com/dracula/zed/blob/92f46057151693648bd3acac1e0c138696f34433/themes/dracula.json) | `dracula` 1.1.2 |
| `everforest-dark`, `everforest-light` | [albertsko/zed-everforest `1f1c84e`](https://github.com/albertsko/zed-everforest/blob/1f1c84e081f6dcaaac7105812032086608ca7a44/themes/everforest-regular.json) | `everforest` 0.2.0 |
| `github-dark`, `github-light` | [meocoder31099/Github-Classic-Theme-Zed `751146a`](https://github.com/meocoder31099/Github-Classic-Theme-Zed/blob/751146a4387066dd4e2fb7ee4ff91ab089d7c7dd/themes/github-classic.json) | `github-classic` 0.0.3 |
| `github-dark-default` | [MordFustang21/zed-github-dark `dbbd661`](https://github.com/MordFustang21/zed-github-dark/blob/dbbd66167753686ff3ff627208e15f7e27a9b1f9/themes/dark-default.json) | `github-dark-default` 1.0.10 |
| `github-dark-dimmed`, `github-light-default`, and both `github-*-high-contrast` themes | [PyaeSoneAungRgn/github-zed-theme `89ae5f9`](https://github.com/PyaeSoneAungRgn/github-zed-theme/blob/89ae5f92ca0bc5b96b721b69e41db83aa482cfd6/themes/github_theme.json) | `github-theme` 0.1.8 |
| `gruvbox-*` | [Zed Gruvbox `ce48461`](https://github.com/zed-industries/zed/blob/ce48461eaadd16c65c31f835511ab96bd3b6e746/assets/themes/gruvbox/gruvbox.json) | Built in |
| `horizon`, `horizon-bright` | [ayn2op/zed-horizon `b3cf502`](https://github.com/ayn2op/zed-horizon/blob/b3cf5022a583455f2e815c4c58996ce6dc3082f5/themes/horizon.json) | `horizon` 0.0.1 |
| `houston` | [rudolfjs/houston-zed `2830d5c`](https://github.com/rudolfjs/houston-zed/blob/2830d5c55d80b2c2bce44b184f2370f814509f1f/themes/houston.json) | GitHub only; manifest 0.2.0 |
| `kanagawa-*` | [ethangilmore/zed-kanagawa `45b4295`](https://github.com/ethangilmore/zed-kanagawa/blob/45b4295e708a5720d75514013a20a00917d50cc5/themes/Kanagawa.json) | `kanagawa-themes` 0.1.2 |
| `material-theme*` | [Codextor/zed-material-theme `e4145b6`](https://github.com/Codextor/zed-material-theme/blob/e4145b69351b773ba8c9c8b0c44e7d89faacbfee/themes/material-theme.json) | `material-theme` 0.0.1 |
| `min-dark`, `min-light` | [phibr0/zed-min-theme `0efe9ac`](https://github.com/phibr0/zed-min-theme/blob/0efe9ac439bd27ceb19d6506ed4986d9f348e216/themes/min-theme.json) | `min-theme` 0.2.2 |
| `night-owl`, `night-owl-light` | [elGusto/night-owlz `29b5fed`](https://github.com/elGusto/night-owlz/blob/29b5fedfee923b2598d97520962215d26d51d67d/themes/NightOwl.json) | `night-owlz` 0.0.5 |
| `nord` | [mikasius/zed-nord-theme `d0b459c`](https://github.com/mikasius/zed-nord-theme/blob/d0b459c49797aec598622bed992537e4a83688da/themes/nord.json) | `nord` 0.1.7 |
| `one-dark-pro` | [hadez8877/one-dark-pro-enhanced `0411a00`](https://github.com/hadez8877/one-dark-pro-enhanced/blob/0411a00f702b609746a29c49e2796d6993e9f461/themes/oneDark-Pro.json) | `one-dark-pro-enhanced` 0.0.12 |
| `one-light` | [Stelath/zed-atom-one-theme `ed0513f`](https://github.com/Stelath/zed-atom-one-theme/blob/ed0513f0655ec72ffcfd33e87e31fb0a06c28948/themes/one-light.json) | `atom-one-theme` 0.1.0 |
| `plastic` | [ibnuh/zed-plastic-theme `98c34dc`](https://github.com/ibnuh/zed-plastic-theme/blob/98c34dc4b59c65d64a9410aa25e4f66be0918cf8/themes/plastic.json) | `plastic-theme` 1.0.0 |
| `rose-pine*` | [rose-pine/zed `2c7b4ee`](https://github.com/rose-pine/zed/tree/2c7b4ee61c78334f8f1e9960d1d9e44d447ee9ef/themes) | `rose-pine-theme` 1.5.0 |
| `snazzy-light` | [seyhajin/zed-snazzy-light `1d54608`](https://github.com/seyhajin/zed-snazzy-light/blob/1d54608af795053e47d4151612c56b49aff6ed9b/themes/snazzy-light.json) | `snazzy-light` 0.1.0 |
| `synthwave-84` | [hydepwns/synthwave84-zed `332a002`](https://github.com/hydepwns/synthwave84-zed/blob/332a002eb64bece661585607fd59d3f9b4250acf/themes/synthwave84.json) | `synthwave84` 0.2.0 |
| `tokyo-night` | [ssaunderss/zed-tokyo-night `6d731d0`](https://github.com/ssaunderss/zed-tokyo-night/blob/6d731d0724a6fa487f9031cbb4f8db0b80769568/themes/tokyo-night.json) | `tokyo-night` 0.8.0 |
| `vesper` | [bdsqqq/vesper-zed `4ae700c`](https://github.com/bdsqqq/vesper-zed/blob/4ae700c4a2a279c722bdd6c63409a701b4a3236e/themes/vesper-dark.json) | `vesper` 0.0.2 |
| `vitesse-black`, `vitesse-dark`, `vitesse-light` | [colinlienard/zed-vitesse-theme-refined `a2b193e`](https://github.com/colinlienard/zed-vitesse-theme-refined/blob/a2b193ec9e5d36a05de4385b127c94597b025b46/themes/vitesse-theme-refined.json) | `vitesse-theme-refined` 0.5.0 |
No suitable licensed Zed port was available for `dracula-soft`, `laserwave`,
`poimandres`, `slack-dark`, or `slack-ochin`. Those files use the corresponding
sources from
[`tm-themes@1.12.10`](https://github.com/shikijs/textmate-grammars-themes/blob/950dad95387e73a8b2ae36aed2ef19b8a4419f10/packages/tm-themes/index.js),
converted with
[Zed's scope mapping](https://github.com/zed-industries/zed/blob/ce48461eaadd16c65c31f835511ab96bd3b6e746/crates/theme_importer/src/vscode/syntax.rs).
Missing syntax captures in the other community ports are supplemented from their
corresponding TextMate themes at the same `tm-themes@1.12.10` pin. Existing Zed
palette choices are retained. Pierre and the Aurora substitute use colors from
their own palettes for missing captures.
The Zed registry's `aurora-theme` is an MIT-licensed substitute, not an Aurora X
port. The original Aurora X source is GPL-3.0-only; bundling it would require
GPL-3.0 distribution terms, contrary to this package's Apache-2.0-only policy.
## MIT themes
Copyright notices retained from the sources:
- Andromeda: Copyright (c) 2017 <eliverlara@gmail.com>; Zed port Copyright (c)
2025 Andrey L.
- Aurora: Copyright (c) 2026 Raj Joshi
- Ayu: Copyright (c) 2016 Ike Ku
- Catppuccin: Copyright (c) 2021 Catppuccin
- Dracula: Copyright (c) 2016 Dracula Theme; Zed port Copyright (c) 2023 Dracula
Theme
- Everforest: Copyright (c) 2020 sainnhe; Zed port Copyright (c) 2025 Albert
Skonieczny
- GitHub Classic: Copyright (c) 2020 Primer; Zed port Copyright (c) 2021
Catppuccin
- GitHub Theme: Copyright (c) 2020 Primer; Zed port Copyright (c) 2025 Pyae Sone
Aung
- Gruvbox: the original palette is by Pavel Pertsev. Zed's theme-local MIT
license contains the unfilled line `Copyright (c) <YEAR> <COPYRIGHT HOLDER>`
- Horizon: Copyright (c) 2018 Jonathan Olaleye; Zed port Copyright (c) 2024
Ayyan
- Houston: Copyright (c) 2022 The Astro Technology Company; Copyright (c) 2026
github.com/rudolfjs
- Kanagawa: Copyright (c) 2021 Tommaso Laurenzi; Zed port Copyright (c) 2024
Ethan Gilmore
- LaserWave: Copyright (c) 2019 Jared Jones
- Min: Copyright (c) 2018-2021 Miguel Solorio; Zed port Copyright (c) 2024
Phillip
- Night Owl: Copyright (c) 2018 Sarah Drasner
- Nord: Copyright (c) 2016-present Sven Greb <development@svengreb.de>
(https://www.svengreb.de); Zed port Copyright (c) 2025 Sergei Metlenkin
- One Dark Pro: Copyright (c) 2013-2022 Binaryify; Zed port Copyright (c) 2025
/devs/hadez
- One Light: Copyright (c) 2015 Mahmoud Ali; Zed port Copyright (c) 2026 Alex
- Plastic: Copyright (c) 2017-present, Will Stone; Zed port Copyright (c) 2026
Ibnuh
- Poimandres: Copyright (c) 2023 drcmda
- Rosé Pine: Copyright (c) Rosé Pine
- Slack: Copyright (c) 2017 Felipe Mendes
- Snazzy Light: Copyright (c) 2020 Florian Reuschel; Zed port Copyright (c) 2026
Christophe TES
- Synthwave84: Copyright (c) 2019 Robb Owen; Zed port Copyright (c) 2025 DROO
- TextMate theme collection: Copyright (c) 2021 Pine Wu; Copyright (c) 2023
Anthony Fu
- Tokyo Night: Copyright (c) 2018-present Enkia; Zed port Copyright (c) 2024
Austin Saunders
- Vesper: Copyright (c) 2023 Rauno Freiberg; Zed port Copyright (c) 2024 Igor
Bedesqui
- Vitesse: Copyright (c) 2020 Primer; Copyright (c) 2021 Anthony Fu; Zed port
Copyright (c) 2024 Colin Lienard
- VS Code Classics: Copyright (c) 2015 - present Microsoft Corporation; Zed port
Copyright (c) 2026 alanisme
```text
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
## Apache-2.0 themes
`github-dark-default` and the Material themes are Apache-2.0. The Material
themes retain Copyright 2017 Mattia Astorino. `github-dark-default` also derives
from the MIT-licensed GitHub/Primer theme credited above. Highlights extracts
individual themes and prunes unused Zed style properties. The full Apache-2.0
text is included in the package's [`LICENSE.md`](./LICENSE.md).
````
### Upstream NOTICE: `@pierre/theme`
```text
This theme was built on top of
[GitHub's Visual Studio Code Theme](https://github.com/primer/github-vscode-theme),
reusing its technique and build tooling, which we have since iterated on for
more specific language tokens.
`@pierre/theme` is licensed under Apache-2.0 (see `LICENSE`). The original MIT
license for `primer/github-vscode-theme` is included below for attribution.
Original license for `primer/github-vscode-theme`:
```
MIT License
Copyright (c) 2020 Primer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
```
+20 -175
View File
@@ -1,31 +1,18 @@
"""Cross-suite test infrastructure."""
from __future__ import annotations
import os
import ssl
import sys
from collections.abc import Callable, Iterator
from collections.abc import Iterator
from pathlib import Path
from threading import Thread
from uuid import uuid4
import certifi
import pytest
from loguru import logger
@pytest.fixture(autouse=True)
def _isolate_tokenizer_warmup(monkeypatch: pytest.MonkeyPatch) -> None:
"""Keep tests deterministic and out of the user's tokenizer cache and network."""
monkeypatch.setattr("nanobot.utils.token_encoding._encoding", None)
monkeypatch.setattr("nanobot.utils.token_encoding._warmup_thread", Thread())
@pytest.fixture(autouse=True)
def _isolate_tool_entry_points(monkeypatch: pytest.MonkeyPatch) -> None:
"""Only load external tool plugins explicitly provided by the test."""
monkeypatch.setattr("nanobot.agent.tools.loader.entry_points", lambda **_kwargs: ())
@pytest.fixture(autouse=True)
def _isolate_nanobot_log_activation() -> Iterator[None]:
"""Keep CLI log settings from leaking into later tests in the same process."""
@@ -37,41 +24,29 @@ def _isolate_nanobot_log_activation() -> Iterator[None]:
@pytest.fixture(autouse=True)
def _isolate_runtime_stores(
tmp_path_factory: pytest.TempPathFactory, monkeypatch: pytest.MonkeyPatch,
) -> Iterator[None]:
"""Isolate writable stores without making a directory for pure tests."""
import nanobot.llm_usage.service as llm_usage
import nanobot.pairing.store as pairing_store
import nanobot.session.location as session_location
from nanobot.webui import star_prompt
def _isolate_sessions_root(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
"""Redirect session storage away from the real active config data directory.
# A sibling of tmp_path stays outside any test's agent workspace. mkdir is
# deferred until a store is used and remains safe for concurrent callers.
data_root = tmp_path_factory.getbasetemp() / "runtime-data" / uuid4().hex
def data_dir() -> Path:
data_root.mkdir(parents=True, exist_ok=True)
return data_root
Session storage lives under the active runtime data root (outside the workspace,
per ADR-0001), so without redirection tests would write into the real home.
"""
runtime_root = tmp_path.parent / f"{tmp_path.name}-runtime-root"
legacy_root = tmp_path.parent / f"{tmp_path.name}-legacy-sessions-root"
def runtime_subdir(name: str) -> Path:
path = data_root / name
path = runtime_root / name
path.mkdir(parents=True, exist_ok=True)
return path
monkeypatch.setattr(session_location, "get_runtime_subdir", runtime_subdir)
monkeypatch.setattr("nanobot.session.image_attachments.get_data_dir", data_dir)
monkeypatch.setattr("nanobot.webui.history.get_webui_dir", lambda: runtime_subdir("webui"))
monkeypatch.setattr(star_prompt, "get_webui_dir", lambda: runtime_subdir("webui"))
monkeypatch.setattr(pairing_store, "_store_path", lambda: data_dir() / "pairing.json")
monkeypatch.setattr(llm_usage, "get_data_dir", data_dir)
stores: dict[Path, llm_usage.LLMUsageStore] = {}
monkeypatch.setattr(llm_usage, "_STORES", stores)
try:
yield
finally:
for store in stores.values():
store.close()
monkeypatch.setattr(
"nanobot.session.manager.get_runtime_subdir",
runtime_subdir,
)
monkeypatch.setattr(
"nanobot.session.manager.get_legacy_sessions_dir",
lambda: legacy_root,
)
yield
@pytest.fixture(scope="session", autouse=True)
@@ -112,133 +87,3 @@ def _use_windows_system_ca_for_default_http_clients() -> Iterator[None]:
yield
finally:
ssl.create_default_context = original
@pytest.fixture(scope="session")
def create_integration_env(tmp_path_factory: pytest.TempPathFactory) -> Callable[[Path], Path]:
"""Seed each stdlib-created prefix from private, offline pip images."""
import ensurepip
import venv
from importlib.resources import files
from virtualenv import session_via_cli
seed = tmp_path_factory.mktemp("integration-env-seed")
wheels = seed / "wheels"
wheels.mkdir()
versions = {}
# Keep the stdlib seed versions, including setuptools on Python 3.11,
# rather than silently selecting virtualenv's newer bundled pip.
for wheel in files("ensurepip").joinpath("_bundled").iterdir():
if wheel.name.endswith(".whl"):
name, version, _ = wheel.name.split("-", 2)
versions[name] = version
(wheels / wheel.name).write_bytes(wheel.read_bytes())
assert versions["pip"] == ensurepip.version()
env = {key: value for key, value in os.environ.items() if not key.startswith(("VIRTUALENV_", "PIP_"))}
env.update({
"VIRTUALENV_CONFIG_FILE": os.devnull,
"VIRTUALENV_OVERRIDE_APP_DATA": str(seed / "app-data"),
"PIP_CONFIG_FILE": os.devnull,
"PIP_NO_INDEX": "1",
})
options = [
"--python", sys.executable,
"--creator", "venv",
"--seeder", "app-data",
"--no-download",
"--no-periodic-update",
"--pip", versions["pip"],
"--setuptools", versions.get("setuptools", "none"),
"--extra-search-dir", str(wheels),
]
def create(environment: Path) -> Path:
# Keep stdlib creation semantics; use virtualenv only for copied seed
# packages and prefix-specific launchers, not its runtime import hooks.
# Do not request creator --copies: Homebrew disallows copying its Python,
# and this creator is never run. The app-data seeder copies by default.
venv.EnvBuilder(with_pip=False).create(environment)
with session_via_cli([str(environment), *options], setup_logging=False, env=env) as session:
session.seeder.run(session.creator)
return environment / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
return create
@pytest.fixture
def create_symlink():
"""Create real symlinks, skipping only Windows' missing-privilege error."""
def create(link: Path, target: Path, *, target_is_directory: bool = False) -> None:
try:
link.symlink_to(target, target_is_directory=target_is_directory)
except OSError as exc:
if sys.platform == "win32" and getattr(exc, "winerror", None) == 1314:
pytest.skip("Windows symlink creation requires Developer Mode or privilege")
raise
return create
class DisplayHistoryFixture:
"""Explicit offline setup plus snapshot reads for history projection tests."""
def __init__(self, workspace: Path) -> None:
from nanobot.session.manager import SessionManager
self.sessions = SessionManager(workspace)
async def metadata(self, chat_id, metadata=None):
from nanobot.session.display_history import HISTORY_GENERATION_METADATA_KEY
session = await self.sessions.state.get_header(f"websocket:{chat_id}")
return {**(metadata or {}), HISTORY_GENERATION_METADATA_KEY: session.generation}
async def message(self, **kwargs):
from nanobot.bus.events import OutboundMessage
kwargs["metadata"] = await self.metadata(kwargs["chat_id"], kwargs.get("metadata"))
return OutboundMessage(**kwargs)
async def stream(self, channel, method, chat_id, *args, **kwargs):
kwargs["metadata"] = await self.metadata(chat_id, kwargs.get("metadata"))
await getattr(channel, method)(chat_id, *args, **kwargs)
def append(self, key, record):
from nanobot.webui.transcript import append_transcript_object
append_transcript_object(key, record, sessions=self.sessions)
def _project(self, name, key, *args, **kwargs):
from nanobot.webui import transcript
return self.sessions.project_history(key, lambda snapshot: getattr(transcript, name)(
key, *args, history=snapshot, **kwargs,
))
def read(self, key):
return self._project("read_transcript_lines", key)
def build(self, key, **kwargs):
return self._project("build_webui_thread_response", key, **kwargs)
def trace(self, key, detail_ref):
return self._project("build_webui_trace_detail_response", key, detail_ref)
def revision(self, key, **kwargs):
return self._project("webui_transcript_revision", key, **kwargs)
def prompts(self, key, **kwargs):
return self._project("build_prompt_index", key, **kwargs)
def prompt_response(self, key, previous_revision, **kwargs):
return self._project("prompt_index_response", key, previous_revision, **kwargs)
@pytest.fixture
async def history(tmp_path: Path):
fixture = DisplayHistoryFixture(tmp_path)
yield fixture
if fixture.sessions._state is not None:
await fixture.sessions.state.aclose()
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")" || exit 1
count_top_level_py_lines() {
local dir="$1"
if [ ! -d "$dir" ]; then
echo 0
return
fi
find "$dir" -maxdepth 1 -type f -name "*.py" -print0 | xargs -0 cat 2>/dev/null | wc -l | tr -d ' '
}
count_recursive_py_lines() {
local dir="$1"
if [ ! -d "$dir" ]; then
echo 0
return
fi
find "$dir" -type f -name "*.py" -print0 | xargs -0 cat 2>/dev/null | wc -l | tr -d ' '
}
count_skill_lines() {
local dir="$1"
if [ ! -d "$dir" ]; then
echo 0
return
fi
find "$dir" -type f \( -name "*.md" -o -name "*.py" -o -name "*.sh" \) -print0 | xargs -0 cat 2>/dev/null | wc -l | tr -d ' '
}
print_row() {
local label="$1"
local count="$2"
printf " %-16s %6s lines\n" "$label" "$count"
}
echo "nanobot line count"
echo "=================="
echo ""
echo "Core runtime"
echo "------------"
core_agent=$(count_top_level_py_lines "nanobot/agent")
core_bus=$(count_top_level_py_lines "nanobot/bus")
core_config=$(count_top_level_py_lines "nanobot/config")
core_cron=$(count_top_level_py_lines "nanobot/cron")
core_session=$(count_top_level_py_lines "nanobot/session")
print_row "agent/" "$core_agent"
print_row "bus/" "$core_bus"
print_row "config/" "$core_config"
print_row "cron/" "$core_cron"
print_row "session/" "$core_session"
core_total=$((core_agent + core_bus + core_config + core_cron + core_session))
echo ""
echo "Separate buckets"
echo "----------------"
extra_tools=$(count_recursive_py_lines "nanobot/agent/tools")
extra_skills=$(count_skill_lines "nanobot/skills")
extra_api=$(count_recursive_py_lines "nanobot/api")
extra_cli=$(count_recursive_py_lines "nanobot/cli")
extra_channels=$(count_recursive_py_lines "nanobot/channels")
extra_utils=$(count_recursive_py_lines "nanobot/utils")
print_row "tools/" "$extra_tools"
print_row "skills/" "$extra_skills"
print_row "api/" "$extra_api"
print_row "cli/" "$extra_cli"
print_row "channels/" "$extra_channels"
print_row "utils/" "$extra_utils"
extra_total=$((extra_tools + extra_skills + extra_api + extra_cli + extra_channels + extra_utils))
echo ""
echo "Totals"
echo "------"
print_row "core total" "$core_total"
print_row "extra total" "$extra_total"
echo ""
echo "Notes"
echo "-----"
echo " - agent/ only counts top-level Python files under nanobot/agent"
echo " - tools/ is counted separately from nanobot/agent/tools"
echo " - skills/ counts .md, .py, and .sh files"
echo " - not included here: command/, providers/, security/, templates/, nanobot.py, root files"
+3
View File
@@ -9,5 +9,8 @@ services:
nanobot-gateway:
<<: *bwrap-security
nanobot-api:
<<: *bwrap-security
nanobot-cli:
<<: *bwrap-security
+17 -3
View File
@@ -4,9 +4,6 @@ x-common-config: &common-config
dockerfile: Dockerfile
args:
NANOBOT_CHANNELS: ${NANOBOT_CHANNELS:-whatsapp}
environment:
NANOBOT_DOCKER_BOOTSTRAP: "1"
NANOBOT_WEB_TOKEN: ${NANOBOT_WEB_TOKEN:-}
volumes:
- ~/.nanobot:/home/nanobot/.nanobot
cap_drop:
@@ -39,6 +36,23 @@ services:
cpus: "0.25"
memory: 256M
nanobot-api:
container_name: nanobot-api
<<: *common-config
command:
["serve", "--host", "0.0.0.0", "-w", "/home/nanobot/.nanobot/api-workspace"]
restart: unless-stopped
ports:
- 127.0.0.1:8900:8900
deploy:
resources:
limits:
cpus: "1"
memory: 1G
reservations:
cpus: "0.25"
memory: 256M
nanobot-cli:
<<: *common-config
profiles:
+24 -32
View File
@@ -1,51 +1,46 @@
# nanobot Documentation
Get nanobot running and answering your first message first. Once that works, you can ask nanobot to help you set up the next feature or follow a guide below.
Use these docs to get a working agent first, then open a task guide only when you need the next capability. Source-level design and extension details are kept in the contributor section.
> [!NOTE]
> These docs follow the latest development version. For the latest published release, visit [nanobot.wiki](https://nanobot.wiki/docs/latest/getting-started/nanobot-overview).
When a setting is available in the WebUI, follow the graphical steps first. Expand **Manual configuration** when you manage `config.json` directly or run nanobot on a headless server.
Repository docs follow the current source tree and can be newer than the latest package release. For published release docs, visit [nanobot.wiki](https://nanobot.wiki/docs/latest/getting-started/nanobot-overview).
## Start Here
| Your situation | Read this | Done when... |
| Your situation | Read this | You are done when... |
|---|---|---|
| Terminals, Python, or API keys are new to you | [Start Without Technical Background](./start-without-technical-background.md) | You send `Hello!` in your browser and get a reply |
| You are comfortable running terminal commands | [Install and Quick Start](./quick-start.md) | `nanobot status` passes and you get a reply in the WebUI or terminal |
| nanobot will not start | [Installation Problems](./troubleshooting.md#installation-problems) | nanobot starts, or you know what to fix next |
| nanobot opens, but does not reply | [Provider & Model](./troubleshooting.md#provider-and-model-problems), [WebUI](./troubleshooting.md#webui-problems), or [Chat Apps](./troubleshooting.md#chat-app-problems) | You get a reply or a clear next step |
| Terminals, Python, or API keys are new to you | [Beginner walkthrough](./start-without-technical-background.md) | The browser can send `Hello!` and receive a reply |
| You are comfortable running commands | [Install and Quick Start](./quick-start.md) | `nanobot status` is healthy and the WebUI or CLI can get one reply |
| Something already failed | [Troubleshooting](./troubleshooting.md) | You have isolated the problem to install, config, model, gateway, channel, or tool access |
The fastest first-run path:
The recommended first-run path is:
1. Install nanobot.
2. Let the installer open the WebUI in your browser.
3. Add a provider and model in **Settings → Models**.
2. Let the installer open `nanobot webui` on a fresh local desktop.
3. Configure a provider and model in **Settings → Models**.
4. Send `Hello!` before configuring anything else.
You do not need to edit JSON to get started. Use **Settings** for models and built-in capabilities, **Channels** for chat apps, and **Apps** for plugins, CLI apps, and MCP tools. On servers without a browser, use `nanobot onboard --wizard` instead.
## After the First Reply
Once nanobot replies, you can ask it directly in chat to help configure your next feature—when the built-in `nanobot-document` skill is enabled, it reads the bundled docs for your version. See [Continue with nanobot](./quick-start.md#continue-with-nanobot) for examples, or pick a guide below.
Most people do not need to edit JSON for the first run. The WebUI handles the initial provider, model, and local browser settings. SSH, headless, existing-config, and older-release installs retain `nanobot onboard --wizard` as a terminal fallback. After the WebUI opens, use **Settings** for models and built-in capabilities, **Settings → Channels** for chat apps, and **Apps** for Agent Plugins, CLI Apps, and MCP integrations.
## Add One Capability
Pick the row that matches what you want to accomplish next:
| Goal | Guide |
|---|---|
| Learn the browser workbench | [WebUI](./webui.md) |
| Connect Telegram, Discord, Slack, Feishu, WeChat, Email, or another chat app | [Chat Apps](./chat-apps.md) |
| Set up a hosted, OAuth, company, or local model | [Provider Cookbook](./provider-cookbook.md) |
| Choose a hosted, OAuth, company, or local model | [Provider Cookbook](./provider-cookbook.md) |
| Add model fallbacks | [Configure Model Fallback](./guides/configure-model-fallback.md) |
| Enable web search | [Configure Web Search](./guides/configure-web-search.md) |
| Manage Agent Plugins, CLI Apps, or MCP integrations | [WebUI Apps](./webui.md#apps) |
| Add an MCP tool server | [Configure MCP Tools](./guides/configure-mcp-tools.md) |
| Generate images | [Image Generation](./image-generation.md) |
| Schedule recurring tasks or local triggers | [Automations](./automations.md) |
| Schedule work or create a local trigger | [Automations](./automations.md) |
| Understand and manage long-term memory | [Memory](./memory.md) |
| Run nanobot continuously | [Deployment](./deployment.md) |
| Run separate bots or workspaces | [Multiple Instances](./multiple-instances.md) |
| Call nanobot from Python | [Python SDK](./python-sdk.md) |
| Expose an OpenAI-compatible endpoint | [OpenAI-Compatible API](./openai-api.md) |
For shorter, outcome-focused walkthroughs, browse the [task guide index](./guides/README.md).
@@ -54,32 +49,31 @@ For shorter, outcome-focused walkthroughs, browse the [task guide index](./guide
| Need | Read |
|---|---|
| Commands and flags | [CLI Reference](./cli-reference.md) |
| Update nanobot or recover a failed update | [Updating nanobot](./updating.md) |
| In-chat slash commands | [In-Chat Commands](./chat-commands.md) |
| Plain-language overview of how nanobot works | [Concepts](./concepts.md) |
| Provider and model matching | [Providers and Models](./providers.md) |
| Diagnose setup or runtime problems | [Troubleshooting](./troubleshooting.md) |
| Config, workspace, gateway, sessions, tools, and memory in plain language | [Concepts](./concepts.md) |
| Provider/model matching and selection | [Providers and Models](./providers.md) |
| Setup and runtime diagnosis | [Troubleshooting](./troubleshooting.md) |
| Older development highlights | [Release Archive](./release-archive.md) |
## Reference
Use these pages when you need exact config keys, defaults, or API details:
Use reference pages to look up an exact option after you know what you are trying to configure:
| Area | Reference |
|---|---|
| Configuration fields and defaults | [Configuration](./configuration.md) |
| Every configuration field and default | [Configuration](./configuration.md) |
| Provider and model behavior | [Providers and Models](./providers.md) |
| Chat channel prerequisites and manual JSON | [Chat Apps](./chat-apps.md) |
| WebSocket authentication and wire protocol | [WebSocket](./websocket.md) |
| Python SDK classes, events, sessions, and hooks | [Python SDK](./python-sdk.md) |
| OpenAI-compatible HTTP routes and payloads | [OpenAI-Compatible API](./openai-api.md) |
| Runtime self-inspection and tuning | [My Tool](./my-tool.md) |
> [!TIP]
> JSON examples in these docs are usually snippets to merge into `~/.nanobot/config.json`, not complete files. Never share real API keys, bot tokens, or passwords in issues or logs.
Configuration examples are usually snippets to merge into `~/.nanobot/config.json`, not complete replacement files. The docs use camelCase because nanobot writes config that way. Keep real API keys, bot tokens, and passwords out of issues and public logs.
## Extend or Contribute
You do not need these pages to install or use nanobot.
These pages explain implementation and extension points. You do not need them to install or operate nanobot.
| Goal | Read |
|---|---|
@@ -87,7 +81,5 @@ You do not need these pages to install or use nanobot.
| Set up a development environment | [Development](./development.md) and [CONTRIBUTING.md](../CONTRIBUTING.md) |
| Add a channel package | [Channel Package Guide](./channel-package-guide.md) |
| Build the WebUI source | [WebUI Development](../webui/README.md) |
| Change update APIs or execution | [Update protocol](./update-protocol.md) |
| Prepare and publish a release | [Release checklist](./releasing.md) |
If a command or screen no longer matches these docs, please [open an issue](https://github.com/HKUDS/nanobot/issues) with your nanobot version, operating system, and the page that needs updating.
If a command or screen no longer matches these docs, please [open an issue](https://github.com/HKUDS/nanobot/issues) with your nanobot version, operating system, and the page that needs correction.
+39 -15
View File
@@ -1,21 +1,35 @@
# Agent Social Network
An agent social network lets a nanobot instance join an external agent community or chat network as a bot identity. After joining, nanobot can receive messages through that network, answer with its normal agent runtime, and use the same workspace, tools, memory, and channel access controls that apply elsewhere.
An agent social network lets a nanobot instance join an external agent community
or chat network as a bot identity. After joining, nanobot can receive messages
through that network, answer with its normal agent runtime, and use the same
workspace, tools, memory, and channel access controls that apply elsewhere.
This page describes the current entry points and the safety model. Treat each network as an external integration: only join networks you trust, keep owner approval narrow, and review the skill instructions before asking nanobot to follow them.
This page describes the current entry points and the safety model. Treat each
network as an external integration: only join networks you trust, keep owner
approval narrow, and review the skill instructions before asking nanobot to
follow them.
## What is an agent social network?
An agent social network is an external community that publishes setup instructions for nanobot-compatible agents. Those instructions usually live in a remote `skill.md` file. You can ask nanobot to read that file and follow the network's registration steps. Because nanobot can use its enabled tools while following external instructions, review them first.
In nanobot docs, an agent social network is an external community that publishes
setup instructions for nanobot-compatible agents. The setup usually lives in a
remote `skill.md` file. You send nanobot a message asking it to read that file
and follow the network's registration flow.
The external network is separate from nanobot. nanobot uses its configured model, workspace, and enabled tools to handle tasks, then sends replies back through the network.
The external network is not part of nanobot core. nanobot provides the runtime:
model calls, tools, memory, sessions, and channel delivery.
> [!WARNING]
> Remote `skill.md` files are external instructions. Review them before asking nanobot to follow them, especially when file, shell, network, or chat-delivery tools are enabled. Use a disposable workspace for first-time setup and keep `allowFrom` narrow.
> Remote `skill.md` files are external instructions. Review them before asking
> nanobot to follow them, especially when file, shell, network, or chat-delivery
> tools are enabled. Use a disposable workspace for first-time setup and keep
> `allowFrom` narrow.
## What nanobot can do after joining
After setup, the exact behavior depends on the network, but the normal pattern is:
After setup, the exact behavior depends on the network, but the normal pattern
is:
- receive direct messages or community messages addressed to the bot
- reply through the configured network channel
@@ -30,15 +44,22 @@ After setup, the exact behavior depends on the network, but the normal pattern i
| [Moltbook](https://www.moltbook.com/) | `Read https://moltbook.com/skill.md and follow the instructions to join Moltbook` |
| [ClawdChat](https://clawdchat.ai/) | `Read https://clawdchat.ai/skill.md and follow the instructions to join ClawdChat` |
Send the message from the CLI, WebUI, or an already configured chat channel. nanobot will read the public setup instructions and perform the requested setup using its available tools.
Send the message from the CLI, WebUI, or an already configured chat channel.
nanobot will read the public setup instructions and perform the requested setup
using its available tools.
## Security model
- The remote setup instructions are external content. Read them yourself before running the join prompt if the bot has file, shell, or network tools enabled.
- Keep `allowFrom` narrow on the channel you use for setup so only trusted users can issue registration commands.
- Keep `tools.restrictToWorkspace` enabled unless the network setup explicitly needs another path.
- Avoid `allowFrom: ["*"]` during setup unless the bot is isolated in a test workspace.
- Store network tokens through environment variables when the integration supports secrets.
- The remote setup instructions are external content. Read them yourself before
running the join prompt if the bot has file, shell, or network tools enabled.
- Keep `allowFrom` narrow on the channel you use for setup so only trusted users
can issue registration commands.
- Keep `tools.restrictToWorkspace` enabled unless the network setup explicitly
needs another path.
- Avoid `allowFrom: ["*"]` during setup unless the bot is isolated in a test
workspace.
- Store network tokens through environment variables when the integration
supports secrets.
## Example workflow
@@ -58,14 +79,17 @@ nanobot agent -m "Hello!"
nanobot gateway
```
5. Send a test message through the external network and confirm the session is routed to the expected workspace and model.
5. Send a test message through the external network and confirm the session is
routed to the expected workspace and model.
## Limitations
- Network features, identity, and moderation rules are controlled by the external network.
- Network features, identity, and moderation rules are controlled by the
external network.
- Availability depends on the remote setup instructions remaining reachable.
- nanobot does not automatically audit remote skills for you.
- Some networks may require public callbacks, tokens, or channel-specific account setup.
- Some networks may require public callbacks, tokens, or channel-specific
account setup.
## Related docs
+16 -27
View File
@@ -51,16 +51,15 @@ Main files:
- feeds tool results back into the model;
- stops when a final answer is produced or runtime limits are hit.
MCP connections are application-owned infrastructure. Composition roots create an `MCPProvider`, share its `ToolRegistry` with `AgentLoop`, await `connect()` before use, and guarantee `aclose()` during shutdown; the loop does not manage that lifecycle. `AgentLoop.from_config()` therefore requires a caller-owned `ToolRegistry`; callers using MCP share it with their application-owned `MCPProvider`.
MCP connections are application-owned infrastructure. Composition roots create
an `MCPProvider`, share its `ToolRegistry` with `AgentLoop`, await `connect()`
before use, and guarantee `aclose()` during shutdown; the loop does not manage
that lifecycle. `AgentLoop.from_config()` therefore requires a caller-owned
`ToolRegistry`; callers using MCP share it with their application-owned
`MCPProvider`.
Keep this split in mind when debugging. If a problem is about channel routing, session keys, workspace selection, or outbound delivery, start in `agent/loop.py`. If it is about provider calls, tool calls, streaming, or iteration limits, start in `agent/runner.py`.
After a terminal tool-iteration limit, the next ordinary turn receives a short runtime-context note to follow the current request and resume unfinished work only when asked. `session/turn_continuation.py` owns this budget-stop context; a queued Goal continuation is not a terminal stop. The note is stored with that input for stable model-history replay but is hidden from display history. Tool calls and results remain intact. New or forked histories do not inherit the pending note. This is model guidance, not a tool-execution ban or a fix for sudo authentication.
## Context Budgets
When file reads make a request exceed the context budget, the runner first summarizes history that the model has already received. If the new file results still do not fit, it replaces only the necessary unread text results with a budget error that asks the model to read a smaller range. It saves that same error for replay; it does not restore the oversized result on the next turn. Source files, accepted history, tool call IDs, and tool schemas stay unchanged. This recovery does not bypass the budget limit or offload `read_file` results to more files.
## Providers
Provider metadata is centralized in `nanobot/providers/registry.py`. Configuration fields live in `nanobot/config/schema.py`.
@@ -75,10 +74,6 @@ Provider selection uses:
Provider implementations live in `nanobot/providers/`. Most hosted providers use the OpenAI-compatible implementation, while Anthropic, Azure OpenAI, AWS Bedrock, OpenAI Codex, and GitHub Copilot have specialized paths.
Responses API paths share `nanobot/providers/openai_responses/backend.py`. The backend constructs protocol input, dispatches SDK or HTTP/SSE requests, owns WebSocket sessions, and advances replay and compaction state. SDK, SSE, and WebSocket events use the same parser in `openai_responses/parsing.py`.
Provider adapters supply authentication, endpoint and model rules, supported request fields, hosted tools, and error mapping. Codex enables WebSocket with its beta header; other adapters retain their existing HTTP transports. Protocol compatibility alone does not enable WebSocket or persistent continuation. OpenAI's `extraBody.store` override controls server storage; automatic response-ID continuation currently uses the active WebSocket connection. Full replay state remains local and scoped to the provider endpoint and model.
Useful docs:
- [`providers.md`](./providers.md) for practical setup;
@@ -144,8 +139,6 @@ Important files:
Tool behavior is part of the model contract. Keep user-visible tool names, schemas, and error messages stable unless a change is intentional.
Before tool execution, arguments are validated against JSON Schema without coercion. Numeric strings and serialized nested objects or arrays are rejected when their JSON types do not match the schema; actionable tool errors let the model correct the call. MCP validation uses the server's original input schema, independently of provider-facing adaptations. Validation defaults to draft 2020-12, honors supported explicit dialects, and does not retrieve external references. The original tool-call arguments in history remain unchanged. JSON Schema integers include numbers such as 2.0; built-in tools adapt these validated values to Python integers where an index is required.
## Config and Paths
The config schema lives in `nanobot/config/schema.py`. Loading and saving live in `nanobot/config/loader.py`. Runtime path helpers live in `nanobot/config/paths.py`.
@@ -156,7 +149,7 @@ Defaults:
|---|---|
| Config | `~/.nanobot/config.json` |
| Workspace | `~/.nanobot/workspace/` |
| Sessions | `<config-dir>/sessions/<workspace-id>/sessions.sqlite3` (default: `~/.nanobot/sessions/...`) |
| Sessions | `<config-dir>/sessions/<workspace-id>/*.jsonl` (default: `~/.nanobot/sessions/...`) |
| Memory | `<workspace>/memory/` |
| Cron store | `<workspace>/cron/jobs.json` |
| WebUI/media/log runtime data | config directory subdirectories such as `webui/`, `media/`, and `logs/` |
@@ -165,7 +158,9 @@ The schema accepts both camelCase and snake_case keys, but saves config with cam
### Agent-Owned State vs Effective Project Context
Runtime code distinguishes the configured agent workspace from the effective project workspace carried by a session scope. They are often the same path, but a WebUI chat may select a separate project:
Runtime code distinguishes the configured agent workspace from the effective
project workspace carried by a session scope. They are often the same path, but
a WebUI chat may select a separate project:
| Concern | Path owner |
|---|---|
@@ -173,25 +168,19 @@ Runtime code distinguishes the configured agent workspace from the effective pro
| Project `AGENTS.md`, relative tool paths, and shell working directory | Effective project workspace |
| Workspace access mode and project metadata | Session workspace scope |
`ContextBuilder` combines project instructions with agent-owned profile and memory. Filesystem and search tools use the project as their ordinary boundary and receive only capability-specific read access to built-in/agent skills and the exact agent history file. Keep those cross-root capabilities read-only and explicit; do not treat the entire agent workspace as an allowed root.
`ContextBuilder` combines project instructions with agent-owned profile and
memory. Filesystem and search tools use the project as their ordinary boundary
and receive only capability-specific read access to built-in/agent skills and
the exact agent history file. Keep those cross-root capabilities read-only and
explicit; do not treat the entire agent workspace as an allowed root.
## Memory and Sessions
Session history is the near-term conversation replay. Memory is the longer-term workspace state.
`nanobot/session/history.py` reads full persisted model history for `search_sessions` and `read_session`, including messages before summary checkpoints. Tool results contain public user and assistant text with indexes into the original session messages. Display facts are stored separately from those messages in the same SQLite database; they never become provider context or session-tool history.
`SessionState` owns both logical histories. `history_entries` stores transport-neutral inputs, completed answer/reasoning segments, activity, historical file diffs, response sources, and completion statistics/outcomes; `history_turns` and `history_heads` provide bounded paging and revision/sidebar projections. WebUI converts these facts into its existing transcript protocol inside an owner-managed read snapshot. Delta frames remain transient. A turn may commit facts as it progresses; this is not a transaction held across a model request or network delivery.
Every append carries the generation admitted before execution, including the display destination when an internal turn reports to a different chat. A missing or replaced session rejects the append instead of creating a new row. Delete/reset cascades through both logical histories; fork copies its canonical and display prefixes in one SQLite transaction. Future in-place history replacement should use that same owner transaction rather than file journals or replay-cache writes.
`nanobot/webui/history.py` resolves legacy `<stem>.jsonl` files and numbered JSONL files inside `<stem>.segments/` directories, then imports them through `SessionState` before recovery or transport admission. Recorded chat identities determine the target session; histories without a recorded identity require an unambiguous existing canonical session. Display-only histories with a recorded identity are imported into the starting workspace namespace. Histories owned by exactly one other namespace are deferred to that namespace; duplicate owners and malformed records fail startup.
`SqliteSessionStore.migrate_history()` commits the imported facts and completion markers in one transaction. Per-session ownership receipts in `storage_meta` survive session deletion, so another namespace cannot restore deleted chats by reimporting the unchanged legacy backups.
| Store | File area |
|---|---|
| SQLite conversation state | `<config-dir>/sessions/<workspace-id>/sessions.sqlite3` |
| Session JSONL files | `<config-dir>/sessions/<workspace-id>/` |
| Long-term memory | `<workspace>/memory/MEMORY.md` |
| Consolidation source history | `<workspace>/memory/history.jsonl` |
| Bootstrap identity files | `<workspace>/SOUL.md`, `<workspace>/USER.md`, templates under `nanobot/templates/` |
+135 -56
View File
@@ -2,121 +2,200 @@
<!-- Meta description: Create, run, and manage nanobot scheduled automations, local triggers, and heartbeat-backed background checks. -->
Automations let nanobot run tasks on its own—reminders, daily summaries, CI follow-ups, local script reports, or quiet background checks.
Automations are agent turns that run later in a linked topic. Use them
when nanobot should do work without someone actively typing: reminders,
recurring checks, nightly summaries, CI follow-ups, local script reports, or
webhook-driven events.
Always create an automation from the WebUI topic or chat channel where you want its replies to appear. Keep `nanobot gateway` running (your WebUI or TUI already runs one; use `nanobot gateway --background` to keep it alive after closing the terminal).
Create automations from the chat channel or WebUI topic where the
result should appear. That lets nanobot keep the right session history,
workspace, and reply target.
## Choose an Automation Type
| Type | Starts from | Best for | How to create |
| Type | Starts from | Best for | Created with |
|---|---|---|---|
| **Scheduled automation** | A time, interval, or cron schedule | Reminders, daily reports, one-time future tasks | Ask nanobot in the target chat |
| **Local trigger** | Running `nanobot trigger ...` from a script or webhook | CI failures, local scripts, external event alerts | Send `/trigger <name>` in the target chat |
| **Heartbeat** | Built-in periodic check | Quiet background monitoring that only messages you when action is needed | Edit `<workspace>/HEARTBEAT.md` |
| Scheduled automation | Time, interval, or cron expression | Recurring reminders, scheduled summaries, one-time future tasks | Ask nanobot in the target topic to schedule it with the `cron` tool |
| Local trigger | A local `nanobot trigger ...` command | CI jobs, webhooks, shell scripts, generated reports | `/trigger <name>` in the target topic |
| Heartbeat | Protected system schedule | Quiet recurring checks that should only report useful results | Edit `<workspace>/HEARTBEAT.md` |
The two user-created automation types are scheduled automations and local
triggers. Heartbeat uses the same background service but is system-managed and
protected from normal automation edits.
## Before You Create One
Keep `nanobot gateway` running. The gateway owns background delivery for chat
apps, WebUI topics, scheduled automations, local triggers, heartbeat, and
Dream jobs.
Use the same workspace and config for the gateway and any process that sends
local trigger messages. If you run multiple nanobot instances, pass the matching
`--config` or `--workspace` option to `nanobot trigger`.
Create each automation from the target topic. An automation without a linked
topic cannot be enabled or run from the WebUI because nanobot would not know
where to deliver the turn.
## Scheduled Automations
To create a scheduled task, just ask nanobot in the chat where you want the results delivered:
Scheduled automations are created by the agent's `cron` tool. In practice, ask
nanobot from the target chat or WebUI topic:
```text
Every weekday at 9am, check open pull requests and summarize blockers here.
```
or:
```text
Tomorrow at 4pm, remind me to send the release notes.
```
- **Schedules:** Supports one-time dates, recurring intervals, and cron expressions (with optional IANA timezones like `America/Vancouver`).
- **Delivery:** By default, nanobot sends the final reply back to the chat where the task was created—you do not need to mention a chat ID or channel name. If you want a task to send to additional chats or recipients, say so explicitly in the instructions.
- **Edit, pause, or inspect runs:** You can manage tasks right in chat—for example, *"Move my daily report from 9am to 10am"*, *"Pause my daily report"*, or *"Show the last five runs of my daily report"*—or use the WebUI **Automations** view.
The cron tool supports interval schedules, cron expressions, and one-time
scheduled tasks. Cron expressions can include an IANA timezone such as
`America/Vancouver`; otherwise nanobot uses the runtime default timezone.
### Change the chat for a scheduled task
Scheduled automations normally deliver the result back to the session where they
were created. Use them for work that should run on a predictable schedule and
report each run.
To move a scheduled task to a different chat:
1. Open the task in WebUI **Automations**.
2. Pick a new destination under **Run and reply in** (chat-app destinations appear once their channel is running and nanobot has received a message there).
3. Review the task instructions—click **Edit instructions** if you need to update any hardcoded destination text.
4. Click **Confirm change** (or **Save and change**).
Future runs will use the new chat's history and reply there. Previous messages stay in the original chat. Note that members of the new chat will see future results, and moving a task does not isolate workspace files or shared memory.
For background checks that should stay quiet unless there is something useful to
report, use heartbeat instead of a user-created scheduled automation.
## Local Triggers
Local triggers let a shell script, CI job, or external webhook wake nanobot inside a specific chat.
Local triggers let a local script or external service send a message into a
specific nanobot session later.
1. In the target chat or WebUI topic, create a trigger:
Create the trigger from the chat or WebUI topic where future messages should
arrive:
```text
/trigger PR review
```
2. nanobot replies with a trigger ID and ready-to-use command:
nanobot replies with a trigger ID and a command shaped like:
```bash
nanobot trigger trg_8K4P2Q9X "Review PR #4502"
```
3. Run that command whenever an event happens, or pipe longer output through stdin:
Replace the quoted text with the message nanobot should receive. For generated
or longer content, pipe stdin:
```bash
generate-report | nanobot trigger trg_8K4P2Q9X
```
If you run multiple nanobot instances, pass the same `--config` or `--workspace` (your configured agent workspace) used by that gateway:
For multiple instances, use the same config or workspace selector as the
gateway:
```bash
nanobot trigger --config ./bot-a/config.json trg_8K4P2Q9X "Nightly report"
nanobot trigger --workspace ./bot-a/workspace trg_8K4P2Q9X "Nightly report"
```
> [!NOTE]
> nanobot does not expose a public webhook server for local triggers. To connect GitHub, CI, or another external service, have your own small webhook receiver call `nanobot trigger`.
nanobot does not provide a built-in public webhook receiver for local triggers.
If GitHub, CI, or another external system should wake nanobot, run your own
small webhook service and have it call `nanobot trigger` after it builds the
final message.
## Heartbeat
Use **Heartbeat** for recurring checks that should stay silent unless something needs your attention—for example, watching a repo for failures or scanning an inbox for urgent messages. (Use a scheduled automation instead when you want a reminder at a specific time every day.)
Heartbeat is for recurring workspace checks that should usually stay quiet. It
reads `<workspace>/HEARTBEAT.md`, executes active tasks, and sends only useful or
actionable results to the most recently active chat target.
Edit `~/.nanobot/workspace/HEARTBEAT.md` (or ask nanobot to add a periodic check):
Use heartbeat for checks such as "watch this repo for important failures" or
"periodically inspect this workspace and only tell me when action is needed." Use
a scheduled automation instead when every run should produce a visible reminder
or report.
```markdown
## Active Tasks
Heartbeat is enabled by default when `nanobot gateway` starts. Configure it in
[`configuration.md#gateway-heartbeat`](./configuration.md#gateway-heartbeat).
- Check weather forecast and notify me only if storms are expected
- Scan inbox for urgent emails and notify me if any are found
```
## Manage Automations
Heartbeat is enabled by default while `nanobot gateway` is running and sends actionable results to your most recently active chat. Configure its interval or disable it in [`configuration.md#gateway-heartbeat`](./configuration.md#gateway-heartbeat).
Use the WebUI Automations view to:
## Manage Automations in WebUI
- filter by all, active, paused, needs-attention, or system jobs;
- search by task name, message, trigger command, linked topic, schedule, or
status;
- sort by next run, last run, updated time, or name;
- run scheduled automations now;
- pause or resume, rename, or delete user-created automations;
- copy the CLI command for local triggers;
- inspect protected system automations without changing them.
Open **Automations** in the WebUI to:
- Filter by all, active, paused, needs-attention, or system jobs.
- Search by name, instructions, chat, schedule, or status (e.g. `chat:WeChat`, `status:paused`).
- Run a scheduled automation immediately, pause/resume it, rename it, or delete it.
- Copy the `nanobot trigger ...` command for a local trigger.
Protected system jobs (such as Heartbeat and Dream) appear as read-only.
Local triggers do not have a WebUI "Run now" action because each run needs a
message. Copy the `nanobot trigger ...` command from the WebUI and replace
`"message"` with the content that should be delivered.
## Delivery and Reliability
Keep these behaviors in mind when relying on automations:
Automation delivery is workspace-local. Scheduled jobs and local trigger
deliveries use the same workspace as the gateway.
- **Missed schedules after downtime:** If the gateway was stopped during a scheduled time, nanobot does **not** replay missed runs when it restarts. Recurring schedules simply wait for their next future run; one-time tasks in the past will not run automatically.
- **Exact clock times:** Use a cron expression (not an interval) when exact wall-clock timing matters, since intervals recalculate after a run finishes.
- **Retry on channel failure:** If a chat app is temporarily unreachable before a scheduled reply is sent, the gateway automatically retries for up to one hour (without re-running the model). If a send times out mid-flight, nanobot will not auto-retry to avoid duplicate messages—check the destination first.
- **Local triggers:** Trigger messages wait in a durable workspace queue if the gateway is offline or if the target chat is busy. Delivery is **at-least-once** (a restart mid-run can replay a trigger), so external scripts should tolerate duplicate messages safely.
Local trigger messages are written to a durable queue. If the gateway is not
running yet, the message waits in that workspace. If the linked topic is
already running a turn, the trigger waits until the session becomes idle instead
of being injected into the active turn.
The local trigger queue is at-least-once, not exactly-once. If the gateway exits
after claiming a delivery but before the linked turn completes, the next gateway
start requeues that delivery. External scripts should make repeated trigger
messages safe. If the delivery reaches the agent and the turn fails, the
delivery is marked failed instead of retrying forever.
Each local trigger delivery writes an audit record under
`<workspace>/triggers/runs`. Run one gateway consumer per workspace; the local
queue is not a distributed multi-consumer queue.
## Common Patterns
For a nightly report, ask from the target topic:
```text
Every night at 9pm, review today's workspace changes and summarize anything I should handle tomorrow.
```
For a CI follow-up, create a trigger once:
```text
/trigger CI follow-up
```
Then have your CI or webhook adapter call:
```bash
nanobot trigger <trigger-id> "Build failed on main. Inspect the logs and suggest the next fix."
```
For a local report script:
```bash
generate-report | nanobot trigger <trigger-id>
```
## Troubleshooting
- **Automation never runs:** Confirm `nanobot gateway` is running, the automation is enabled, and it is linked to a chat.
- **Local trigger sits waiting:** Make sure `nanobot trigger` uses the same `--config` or `--workspace` as the running gateway.
- **Scheduled message did not arrive:** Check the task's run history in **Automations** and `nanobot gateway logs` for channel errors.
If an automation does not run, check that `nanobot gateway` is running, the
automation is enabled, and it was created from a linked topic.
If a local trigger waits forever, confirm the command uses the same workspace or
config as the gateway.
If a trigger message appears twice after a restart, treat it as expected
at-least-once delivery and make the external message idempotent.
If you need to edit, pause, resume, rename, delete, or inspect automations, use
the WebUI Automations view.
## Related Docs
- [WebUI Automations](./webui.md#automations)
- [In-Chat Commands: Local Triggers](./chat-commands.md#local-triggers)
- [CLI Reference: Local Triggers](./cli-reference.md#local-triggers)
- [Configuration: Heartbeat](./configuration.md#gateway-heartbeat)
- [Long-Running AI Agent Guide](./guides/long-running-ai-agent.md)
- [`webui.md#automations`](./webui.md#automations) for the browser management view
- [`chat-commands.md#local-triggers`](./chat-commands.md#local-triggers) for `/trigger`
- [`cli-reference.md#local-triggers`](./cli-reference.md#local-triggers) for `nanobot trigger`
- [`configuration.md#gateway-heartbeat`](./configuration.md#gateway-heartbeat) for heartbeat settings
- [`guides/long-running-ai-agent.md`](./guides/long-running-ai-agent.md) for long-running agent work
+7 -35
View File
@@ -1,6 +1,8 @@
# Channel Package Guide
Use this guide to add a self-contained channel package to the nanobot repository. Each channel lives at `nanobot/channels/<channel>/` and owns its manifest, runtime, tests, and optional WebUI contribution.
Use this guide to add a self-contained channel package to the nanobot repository. A channel is part of nanobot when its package lives at `nanobot/channels/<channel>/`; there is no separate external channel-plugin path.
> **Breaking change:** nanobot no longer discovers the `nanobot.channels` Python entry-point group. Move an entry-point implementation into `nanobot/channels/<channel>/` with a package-owned manifest, runtime, tests, and optional WebUI contribution.
## How It Works
@@ -339,34 +341,6 @@ A normal return from `send()` means either the visible payload was accepted by t
`send()` may run as soon as `is_running` becomes true. If a channel sets `_running` before its transport is ready, it must keep raising until delivery can be attempted safely. Small platform-specific retries are fine, but the final failure must still reach the manager.
### Optional shared proxy
Existing `__init__(config, bus)` constructors remain valid. `BaseChannel.uses_shared_proxy` defaults to `False`; only runtimes that explicitly set this class capability to `True` receive the instance-scoped top-level `NetworkConfig` as the keyword-only `network` argument. This capability is not a user setting.
To support the shared proxy, declare `use_proxy: bool = False` on your channel's config model and expose `"useProxy": ChannelFieldSpec(kind="bool", default=False)` in its setup fields. Opt in on the runtime class and forward `network` to the base constructor:
```python
from typing import Any
from nanobot.bus.queue import MessageBus
from nanobot.channels.base import BaseChannel
from nanobot.config.network import NetworkConfig
class WebhookChannel(BaseChannel):
uses_shared_proxy = True
def __init__(
self, config: Any, bus: MessageBus, *, network: NetworkConfig | None = None,
):
if isinstance(config, dict):
config = WebhookConfig(**config)
super().__init__(config, bus, network=network)
self._proxy = self.network.resolve_proxy(self.config.use_proxy)
```
Pass the resolved address to your platform clients. `useProxy: false` keeps the channel direct even when `network.proxy` is configured; `true` requires a shared proxy address and fails rather than silently connecting directly. Setup validators receive the same settings through `context.network`. Do not load global config or persist a proxy address in the channel config.
### Interactive Login
If your channel requires interactive authentication (e.g. QR code scan), override `login(force=False)`:
@@ -511,7 +485,7 @@ class OutboundMessage:
event: object | None # typed runtime/UI event; usually inspect with isinstance()
```
Runtime/UI semantics live on `msg.event`. Use `outbound_message_for_event()` from `nanobot.bus.outbound_events` to build outbound messages with the appropriate typed event. Keep `metadata` for channel routing context, such as message and thread IDs, and optional `OUTBOUND_META_AGENT_UI` payloads.
Runtime/UI semantics live on `msg.event`. Plugin-authored outbound messages should use typed events instead of legacy metadata flags such as `_progress`, `_stream_delta`, `_stream_end`, `_reasoning_delta`, `_turn_end`, or `_goal_status`. nanobot still accepts those old flags as a compatibility bridge for existing in-process extensions, but new plugin code should not add fresh dependencies on them.
## Streaming Support
@@ -550,7 +524,7 @@ async def send_delta(
# delta contains a small chunk of text (a few tokens)
```
Streaming state is passed through keyword-only arguments. Use `stream_id` to key any per-stream buffers; fall back to `chat_id` when it is missing.
Streaming state is passed through keyword-only arguments, not `_stream_delta` or `_stream_end` metadata flags. Use `stream_id` to key any per-stream buffers; fall back to `chat_id` when it is missing.
### Example: Webhook with Streaming
@@ -623,7 +597,7 @@ Besides normal assistant text, nanobot can emit low-emphasis trace blocks. These
### Progress and Tool Hints
Generic progress and tool activity arrive through `send(msg)`. Tool activity carries a `ProgressEvent` with structured `tool_events`; its core `content` is empty. Each item retains its call ID, tool name, arguments, lifecycle phase, and terminal result or error. Before queuing delivery, `prepare_tool_events(msg)` projects the activity for this channel. Its default implementation formats starts as concise text in a channel-local message copy, so text-only adapters can keep their normal formatting and thread handling:
Progress and tool hints arrive through the normal `send(msg)` path. Check `msg.event` before rendering:
```python
from nanobot.bus.outbound_events import ProgressEvent
@@ -644,9 +618,7 @@ async def send(self, msg: OutboundMessage) -> None:
await self._send_message(msg.chat_id, msg.content, media=msg.media)
```
Override `prepare_tool_events(msg)` to return the original message when the platform consumes structured activity directly, or return your own display projection. Keep this hook free of network sends: it runs once before delivery and its returned envelope is reused across retries. In `send(msg)`, consume `msg.event.tool_events` for native activity, grouping, buffering, or card updates; retain destination/thread metadata and handle start/end/error by call ID. Do not assume a preformatted hint is present or route a rendered copy back into the message bus. The default text formatter uses `self.tool_hint_max_length`, initialized from `agents.defaults.toolHintMaxLength`. Direct-call `on_progress` callbacks that display tools must accept the `tool_events` keyword and render those events themselves; `nanobot.utils.tool_hints.format_tool_event_hints()` is available for text consumers.
Tool starts are controlled by `sendToolHints`; terminal tool events retain the existing `sendProgress` policy. Tool hints are on by default. Users can disable them globally or per channel:
Tool hints are on by default. Users can disable them globally or per channel:
```json
{
+60 -114
View File
@@ -1,6 +1,8 @@
# Chat Apps for Self-Hosted AI Agents
Connect nanobot to Telegram, Discord, Slack, WeChat, Email, Mattermost, Linear, and other chat platforms. This page is the full chat-channel reference. If you want a focused setup path for one platform, start with a guide:
Connect nanobot to Telegram, Discord, Slack, WeChat, Email, Mattermost, and
other chat platforms. This page is the full chat-channel reference. If you want
a focused setup path for one platform, start with a guide:
| Platform | Guide |
|---|---|
@@ -9,12 +11,10 @@ Connect nanobot to Telegram, Discord, Slack, WeChat, Email, Mattermost, Linear,
| Slack | [Build a Slack AI Agent with nanobot](./guides/slack-ai-agent.md) |
| Feishu | [Build a Feishu AI Agent with nanobot](./guides/feishu-ai-agent.md) |
| WhatsApp | [Build a WhatsApp AI Agent with nanobot](./guides/whatsapp-ai-agent.md) |
| WhatsApp Agent Platform | [Connect nanobot to WhatsApp Agent Platform](./guides/whatsapp-agent-platform.md) |
| WeChat | [Build a WeChat AI Agent with nanobot](./guides/wechat-ai-agent.md) |
| QQ | [Build a QQ AI Agent with nanobot](./guides/qq-ai-agent.md) |
| Email | [Build an Email AI Agent with nanobot](./guides/email-ai-agent.md) |
| Mattermost | [Build a Mattermost AI Agent with nanobot](./guides/mattermost-ai-agent.md) |
| Linear | [Use nanobot as a native Linear agent](./guides/linear-agent.md) |
Want to build your own channel? See the [Channel Package Guide](./channel-package-guide.md).
@@ -31,41 +31,44 @@ If that fails, fix installation, config, provider, or model setup first with [`q
For normal local setup, let the WebUI write and validate the channel config:
1. Run `nanobot webui`.
2. Open **Channels**.
2. Open **Settings → Channels**.
3. Search for the platform and open its setup panel.
4. Follow the credential fields or QR flow. The screen tells you which platform-side token, permission, account, or URL it needs.
5. Let nanobot install the optional channel support when prompted.
6. Restart from the WebUI if it reports that a restart is required.
7. Send a private test message. If the channel returns a pairing code, approve the pending request in the WebUI and send the message again.
If your installed stable release does not show **Channels**, continue with the [manual setup pattern](#manual-setup-pattern) below or install current source.
If your installed stable release does not show **Settings → Channels**, continue with the [manual setup pattern](#manual-setup-pattern) below or install current source.
Optional package installation is available to a same-machine WebUI by default. Remote browser clients cannot change the Python environment unless an administrator explicitly enables that capability. Run `nanobot plugins enable <channel>` locally when the guided install is unavailable.
The sections below explain what each chat platform requires and provide manual config for deployments that manage `config.json` directly.
> [!NOTE]
> If you are upgrading from a version where chat app SDKs were installed by default, enable the channel in the same Python environment so nanobot installs its manifest-declared dependencies:
> If you are upgrading from a version where chat app SDKs were installed by default,
> enable the channel in the same Python environment so nanobot installs its
> manifest-declared dependencies:
>
> ```bash
> nanobot plugins enable <channel>
> ```
>
> Replace `<channel>` with names such as `telegram`, `slack`, `feishu`, `dingtalk`, `matrix`, `qq`, `napcat`, `weixin`, `wecom`, `msteams`, or `whatsapp_agent`. To turn a channel off later, run `nanobot plugins disable <channel>`. nanobot keeps the saved settings, but stops loading that channel after the next restart.
> Replace `<channel>` with names such as `telegram`, `slack`, `feishu`,
> `dingtalk`, `matrix`, `qq`, `napcat`, `weixin`, `wecom`, or `msteams`.
> To turn a channel off later, run `nanobot plugins disable <channel>`.
> nanobot keeps the saved settings, but stops loading that channel after the
> next restart.
## Manual Setup Pattern
<details>
<summary>Manual configuration</summary>
Most examples below are snippets to merge into `~/.nanobot/config.json`. When a snippet includes `allowFrom`, it is showing a static allowlist. For pairing-based access on channels with a common sender allowlist, omit `allowFrom`. Slack and Mattermost instead use `dm.policy: "allowlist"` with an empty `dm.allowFrom` for DM pairing; their group policies are independent of DM approval.
Most examples below are snippets to merge into `~/.nanobot/config.json`. When a snippet includes `allowFrom`, it is showing a static allowlist. For pairing-based access on supported channels, omit `allowFrom`; Slack and Mattermost also need `dm.policy` set to `"allowlist"` for DMs to issue pairing codes.
Every chat app uses the same shape:
1. Create or prepare the bot/account in the chat platform.
2. Copy the token, secret, QR login state, webhook URL, or account ID that platform gives you.
3. Merge that platform's JSON snippet into `~/.nanobot/config.json`.
4. For DM pairing, use the channel-specific policy described above, let the first DM receive a pairing code, then approve it with `/pairing approve <code>`.
4. Prefer pairing for DM-capable channels: omit `allowFrom`, let the first DM receive a pairing code, then approve it with `/pairing approve <code>`.
5. For channels without pairing, such as Email, keep access narrow with `allowFrom` or the platform-specific allow list.
6. Check that nanobot can see the configured channel:
@@ -90,35 +93,18 @@ If `nanobot channels status` does not show the channel as enabled, the config sn
| **Telegram** | Bot token from @BotFather |
| **Discord** | Bot token + Message Content intent |
| **WhatsApp** | QR code scan (`nanobot channels login whatsapp`) |
| **WhatsApp Agent Platform** | Agent API token from WhatsApp → Settings → Agents |
| **WeChat (Weixin)** | QR code scan (`nanobot channels login weixin`) |
| **Feishu** | QR code scan (`nanobot channels login feishu`) or App ID + App Secret |
| **DingTalk** | App Key + App Secret |
| **Slack** | Bot token + App-Level token |
| **Matrix** | Homeserver URL + Access token |
| **Email** | IMAP/SMTP credentials |
| **QQ** | QR code scan (`nanobot channels login qq`) or App ID + App Secret |
| **QQ** | App ID + App Secret |
| **Napcat (QQ)** | Napcat Forward WebSocket URL + access token |
| **Wecom** | Bot ID + Bot Secret |
| **Microsoft Teams** | App ID + App Password + public HTTPS endpoint |
| **Mochat** | Claw token (auto-setup available) |
| **Signal** | signal-cli daemon + phone number |
| **Linear** | Private OAuth app + public HTTPS callback and webhook URLs |
</details>
<details id="linear">
<summary><b>Linear</b></summary>
Linear is a native Agent channel rather than a comment bot. A user starts a task by explicitly mentioning the installed nanobot app in an issue. Follow-up prompts inside that Agent Session continue the same nanobot session without another mention. Ordinary issue comments do not invoke nanobot.
The native Agent API is webhook-based. Linear must reach a public HTTPS URL. An HTTPS tunnel can forward requests to nanobot's local listener without a public IP; a publicly reachable server can use a reverse proxy. Use a fixed hostname for ongoing use. Temporary tunnels also work for testing, but a hostname change requires updating nanobot's public URL and the app's callback and webhook URLs.
The recommended setup is **Channels → Linear**. Enter the public URL and wait for automatic saving, select **Create prefilled Linear app**, create the app, then copy its Client ID, Client Secret, and Webhook Signing Secret back into nanobot. Leave each secret field to save it. Once the settings are saved, choose **Connect Linear**. OAuth requests only `read`, `write`, and `app:mentionable`; it deliberately does not request `app:assignable` so a new task must begin with an @mention.
See the [native Linear agent guide](./guides/linear-agent.md) for the complete setup, tunnel examples, security model, and troubleshooting.
</details>
<details>
<summary><b>Telegram</b></summary>
@@ -126,13 +112,17 @@ See the [native Linear agent guide](./guides/linear-agent.md) for the complete s
**Recommended WebUI setup**
1. Create a bot with `@BotFather` and copy its token.
2. Run `nanobot webui`, then open **Channels → Telegram**.
3. Paste the token. If the gateway cannot reach Telegram directly, set the address in **Settings → Advanced → Shared proxy**, then enable **Use proxy** in Telegram's advanced options.
2. Run `nanobot webui`, then open **Settings → Channels → Telegram**.
3. Paste the token. If the gateway cannot reach Telegram directly, expand
**Advanced** and add an HTTP or SOCKS proxy.
4. Save and enable Telegram, then send the bot a direct message.
The configuration badge means nanobot found a saved token. The live connection check is separate, so a temporary Telegram or proxy outage does not make an existing configuration disappear. Saved tokens and proxy URLs remain masked.
The configuration badge means nanobot found a saved token. The live connection
check is separate, so a temporary Telegram or proxy outage does not make an
existing configuration disappear. Saved tokens and proxy URLs remain masked.
See the [step-by-step Telegram guide](./guides/telegram-ai-agent.md) for pairing and troubleshooting.
See the [step-by-step Telegram guide](./guides/telegram-ai-agent.md) for pairing
and troubleshooting.
**Manual setup**
@@ -161,20 +151,20 @@ nanobot plugins enable telegram
}
```
If the gateway cannot reach Telegram directly, set the shared address and enable it for Telegram:
If the gateway cannot reach Telegram directly, add a proxy to the same section:
```json
{
"network": { "proxy": "http://127.0.0.1:7890" },
"channels": {
"telegram": {
"useProxy": true
"proxy": "http://127.0.0.1:7890"
}
}
}
```
HTTP, HTTPS, SOCKS5, and SOCKS5H proxy URLs are accepted. Treat a proxy URL containing a username or password as a secret.
HTTP, HTTPS, SOCKS5, and SOCKS5H proxy URLs are accepted. Treat a proxy URL
containing a username or password as a secret.
> You can find your **User ID** in Telegram settings. It is shown as `@yourUserId`. Copy this value **without the `@` symbol** and paste it into the config file.
>
@@ -308,19 +298,19 @@ If you prefer to configure manually, add the following to `~/.nanobot/config.jso
"allowFrom": ["YOUR_USER_ID"],
"allowChannels": [],
"groupPolicy": "mention",
"streaming": true,
"replyToMessage": false
"streaming": true
}
}
}
```
> `groupPolicy` controls how the bot responds in group channels:
> - `"mention"` (default) — Reply only when someone @mentions the bot.
> - `"open"` — Reply to all messages in group channels.
> - In direct messages, the bot replies only when the sender is listed in `allowFrom`.
>
> For open group policy, create a private thread and @mention the bot to start a session there. Otherwise, the bot starts a session in both the thread and the channel where you created it. `allowChannels` restricts the bot to specific Discord channel IDs. The default empty list allows every channel the bot can see. Example: `["1234567890", "0987654321"]`. The `allowFrom` and `allowChannels` filters both apply. Threads under an allowed channel are also allowed; for Forum channels, allowing the parent Forum channel allows all its threads and posts. `streaming` defaults to `true`; disable it only if you want non-streaming replies. `replyToMessage` defaults to `false`; enable it to use Discord's native reply UI for responses.
> - `"mention"` (default) — Only respond when @mentioned
> - `"open"` — Respond to all messages
> DMs always respond when the sender is in `allowFrom`.
> - If you set group policy to open create new threads as private threads and then @ the bot into it. Otherwise the thread itself and the channel in which you spawned it will spawn a bot session.
> `allowChannels` restricts the bot to specific Discord channel IDs. Empty (default) means respond in every channel the bot can see. Example: `["1234567890", "0987654321"]`. The filter applies after `allowFrom`, so both must pass. Discord threads under an allowed parent channel are also allowed; for Forum channels, allowing the parent Forum channel allows all threads/posts in that forum.
> `streaming` defaults to `true`. Disable it only if you explicitly want non-streaming replies.
**5. Invite the bot**
- OAuth2 → URL Generator
@@ -376,7 +366,6 @@ nanobot plugins enable matrix
"allowFrom": ["@your_user:matrix.org"],
"groupPolicy": "open",
"groupAllowFrom": [],
"groupPolicyOverrides": {},
"allowRoomMentions": false,
"maxMediaBytes": 20971520
}
@@ -389,17 +378,13 @@ nanobot plugins enable matrix
| Option | Description |
|--------|-------------|
| `allowFrom` | User IDs allowed to interact. Empty denies all; use `["*"]` to allow everyone. |
| `groupPolicy` | `open` (default), `mention`, `allowlist`, or `listen`. |
| `groupPolicy` | `open` (default), `mention`, or `allowlist`. |
| `groupAllowFrom` | Room allowlist (used when policy is `allowlist`). |
| `groupPolicyOverrides` | Optional per-room overrides for `groupPolicy`, keyed by Matrix room ID (for example, `"!abc123:matrix.org"`). Values mirror `groupPolicy`: `"open"`, `"mention"`, or `"allowlist"` (an `allowlist` override is checked against `groupAllowFrom`). Rooms not listed fall back to `groupPolicy`. |
| `allowRoomMentions` | Accept `@room` mentions in mention mode. |
| `replyToMessage` | Quote the user's message in non-threaded replies (default `true`). Set `false` to send without quotes; thread replies are unchanged. |
| `e2eeEnabled` | E2EE support (default `true`). Set `false` for plaintext-only. |
| `sasVerification` | Complete Element-initiated SAS device verification for allowed users (default `false`). This does not add cross-signing, clear Element's cross-signing trust warning, or let the bot initiate verification. |
| `sasVerification` | Auto-complete SAS device verification requests from allowed users (default `false`). Useful for Element X, which does not expose manual trust for third-party devices. |
| `maxMediaBytes` | Max attachment size (default `20MB`). Set `0` to block all media. |
In `listen` mode the bot reads every message from allowed senders in the room but replies only when mentioned (same mention semantics as `mention`, including `allowRoomMentions`). Unheard messages are kept in a bounded per-room buffer and attached as context to the next mention-triggered reply, so the answer reflects the conversation since its last response. The buffer clears once used, and nothing is ever replied to unheard messages. The buffer is in-memory only — if the bot restarts it starts empty (the bot does not announce the gap). When the buffer cap evicts older messages, the context block notes how many were dropped.
@@ -440,7 +425,9 @@ nanobot channels login whatsapp
}
```
For groups, `allowFrom` can contain either a participant sender ID/LID or a group JID/bare group ID. A participant entry allows that sender wherever the bot can see them; a group entry allows replies in that group.
For groups, `allowFrom` can contain either a participant sender ID/LID or a
group JID/bare group ID. A participant entry allows that sender wherever the bot
can see them; a group entry allows replies in that group.
Optional session database path:
@@ -468,7 +455,10 @@ nanobot gateway
**Optional: static LID mappings**
Modern WhatsApp can deliver a sender's LID instead of their phone number. nanobot learns LID to phone mappings at runtime when both identifiers are present, but you can also seed mappings up front so the phone number resolves from the very first message:
Modern WhatsApp can deliver a sender's LID instead of their phone number. nanobot
learns LID to phone mappings at runtime when both identifiers are present, but you
can also seed mappings up front so the phone number resolves from the
very first message:
```json
{
@@ -484,47 +474,6 @@ Modern WhatsApp can deliver a sender's LID instead of their phone number. nanobo
</details>
<details>
<summary><b>WhatsApp Agent Platform</b></summary>
Connects nanobot through the **official** WhatsApp Agent Platform API. The agent appears as its own chat in WhatsApp and can only talk to you, its creator. No QR pairing, no linked device, and no optional Python dependencies.
This is a different channel from `whatsapp`. nanobot is an independent third-party project, not a WhatsApp product. See the [WhatsApp Agent Platform guide](./guides/whatsapp-agent-platform.md) for the full comparison and walkthrough.
**1. Create the agent in WhatsApp**
Open WhatsApp → **Settings → Agents → Create an agent**, then copy the key from the agent's chat → **Chat info → API key**. This feature is available only in limited countries and might not be in your account yet.
**2. Configure**
```json
{
"channels": {
"whatsapp_agent": {
"enabled": true,
"token": "${WA_AGENT_TOKEN}"
}
}
}
```
`allowFrom` is optional. The platform already restricts the chat to the agent's creator; leave `allowFrom` empty to require pairing approval instead of a static list.
**3. Run**
```bash
nanobot gateway
```
**Notes**
- At most one gateway may poll a given agent token. A second one causes `409` and is logged as a duplicate-poller error.
- Agent conversations are not end-to-end encrypted. nanobot and your configured model provider process these messages; your other WhatsApp chats are unaffected. Review the [third-party agent terms](https://www.whatsapp.com/legal/third-party-agents-terms) before connecting.
- Replies are split at 4096 characters. Progress and tool-hint messages are off by default because every send spends the same 12-per-minute budget.
- Ambiguous send outcomes (HTTP `500`, read timeouts) are not retried by default, because a duplicate is worse than a miss. Set `retryAmbiguousSends: true` to opt in.
</details>
<details>
<summary><b>Feishu</b></summary>
@@ -579,7 +528,14 @@ If QR login is unavailable for your account, use manual setup below.
}
```
> `streaming` defaults to `true`. Use `false` if your app does not have **`cardkit:card:write`** (see permissions above). `encryptKey` and `verificationToken` are optional for Long Connection mode. `allowFrom`: Add your open_id (find it in nanobot logs when you message the bot). Use `["*"]` to allow all users. `groupPolicy`: `"mention"` (default — respond only when @mentioned), `"open"` (respond to all group messages). Private chats always respond. `reactEmoji`: Emoji for "processing" status (default: `OnIt`). See [available emojis](https://open.larkoffice.com/document/server-docs/im-v1/message-reaction/emojis-introduce). `doneEmoji`: Optional emoji for "completed" status (e.g., `DONE`, `OK`, `HEART`). When set, bot adds this reaction after removing `reactEmoji`. `toolHintPrefix`: Prefix for inline tool hints in streaming cards (default: `🔧`). `domain`: `"feishu"` (default) for China (open.feishu.cn), `"lark"` for international Lark (open.larksuite.com).
> `streaming` defaults to `true`. Use `false` if your app does not have **`cardkit:card:write`** (see permissions above).
> `encryptKey` and `verificationToken` are optional for Long Connection mode.
> `allowFrom`: Add your open_id (find it in nanobot logs when you message the bot). Use `["*"]` to allow all users.
> `groupPolicy`: `"mention"` (default — respond only when @mentioned), `"open"` (respond to all group messages). Private chats always respond.
> `reactEmoji`: Emoji for "processing" status (default: `OnIt`). See [available emojis](https://open.larkoffice.com/document/server-docs/im-v1/message-reaction/emojis-introduce).
> `doneEmoji`: Optional emoji for "completed" status (e.g., `DONE`, `OK`, `HEART`). When set, bot adds this reaction after removing `reactEmoji`.
> `toolHintPrefix`: Prefix for inline tool hints in streaming cards (default: `🔧`).
> `domain`: `"feishu"` (default) for China (open.feishu.cn), `"lark"` for international Lark (open.larksuite.com).
**3. Run**
@@ -615,14 +571,6 @@ nanobot plugins enable qq
**3. Configure**
Run the QR login and scan with mobile QQ to save the AppID and AppSecret automatically. Scanning again replaces the App Secret and stops the previous secret from working:
```bash
nanobot channels login qq
```
To enter them yourself, copy **AppID** and **AppSecret** from **开发设置 (Developer Settings)** into `channels.qq`:
> - `allowFrom`: Add your openid (find it in nanobot logs when you message the bot). Use `["*"]` for public access.
> - `msgFormat`: Optional. Use `"plain"` (default) for maximum compatibility with legacy QQ clients, or `"markdown"` for richer formatting on newer clients.
> - For production: submit a review in the bot console and publish. See [QQ Bot Docs](https://bot.q.qq.com/wiki/) for the full publishing flow.
@@ -782,10 +730,7 @@ nanobot plugins enable slack
"enabled": true,
"botToken": "xoxb-...",
"appToken": "xapp-...",
"dm": {
"policy": "allowlist",
"allowFrom": ["YOUR_SLACK_USER_ID"]
},
"allowFrom": ["YOUR_SLACK_USER_ID"],
"groupPolicy": "mention"
}
}
@@ -798,7 +743,7 @@ nanobot plugins enable slack
nanobot gateway
```
The listed Slack user can DM the bot directly. Other DM senders receive a pairing code. Group access is independent: with `groupPolicy: "mention"`, any member can invoke the bot by mentioning it in a channel it can see. For DM-only access, set `groupPolicy` to `"allowlist"` and leave `groupAllowFrom` empty.
DM the bot directly or @mention it in a channel — it should respond!
> [!TIP]
> - `groupPolicy`: `"mention"` (default — respond only when @mentioned), `"open"` (respond to all channel messages), or `"allowlist"` (restrict to specific channels via `groupAllowFrom`).
@@ -822,10 +767,10 @@ Give nanobot its own email account. It polls **IMAP** for incoming mail and repl
> - `consentGranted` must be `true` to allow mailbox access. This is a safety gate — set `false` to fully disable.
> - `allowFrom`: Add your email address. Use `["*"]` to accept emails from anyone.
> - `trustedAuthservIds`: Exact `authserv-id` values added by the receiving mail service. Required while `verifyDkim` or `verifySpf` is enabled. Gmail normally uses `mx.google.com`; inspect a received message's raw headers for other services. The service must prepend one consolidated result and remove inbound headers that claim the same identity; duplicate trusted results are rejected. Existing installations must follow the [v0.3.5 upgrade instructions](guides/email-ai-agent.md#upgrading-to-v035) before re-enabling verified email polling.
> - `smtpUseTls` and `smtpUseSsl` default to `true` / `false` respectively, which is correct for Gmail (port 587 + STARTTLS). No need to set them explicitly.
> - Set `"autoReplyEnabled": false` if you only want to read/analyze emails without sending automatic replies.
> - `postAction`: Optional post-processing for processed emails: `"delete"` or `"move"` (default `null`). This runs only after an accepted email is successfully delivered to the AI pipeline.
> - `postAction`: Optional post-processing for processed emails: `"delete"` or `"move"` (default `null`).
> This runs only after an accepted email is successfully delivered to the AI pipeline.
> - `postActionMoveMailbox`: Destination mailbox used when `postAction` is `"move"` (for example `"Processed"` or `"[Gmail]/Trash"`).
> - `postActionIgnoreSkipped`: If `true` (default), skipped emails are ignored for post-action and not moved/deleted.
> - `postActionExpunge`: When `true`, the channel allows a full-mailbox `EXPUNGE` fallback if UID-scoped expunge is unavailable or fails (default `false`). Enable only on very old IMAP servers that lack modern UIDPLUS support. Note that this fallback will expunge **all** messages marked as deleted in the mailbox, including ones not handled by the agent. Leaving this off is safe for all modern IMAP servers.
@@ -849,7 +794,6 @@ Give nanobot its own email account. It polls **IMAP** for incoming mail and repl
"smtpPassword": "your-app-password",
"fromAddress": "my-nanobot@gmail.com",
"allowFrom": ["your-real-email@gmail.com"],
"trustedAuthservIds": ["mx.google.com"],
"postAction": "move",
"postActionMoveMailbox": "[Gmail]/Trash",
"postActionIgnoreSkipped": true,
@@ -962,7 +906,8 @@ nanobot gateway
<details>
<summary><b>Microsoft Teams</b> (MVP — DM only)</summary>
> Direct-message text in/out, tenant-aware OAuth, conversation reference persistence. Uses a public HTTPS webhook — no WebSocket; you need a tunnel or reverse proxy.
> Direct-message text in/out, tenant-aware OAuth, conversation reference persistence.
> Uses a public HTTPS webhook — no WebSocket; you need a tunnel or reverse proxy.
**1. Enable Microsoft Teams support**
@@ -1077,6 +1022,7 @@ nanobot gateway
```
> [!TIP]
> The channel automatically reconnects to the signal-cli daemon with exponential backoff if the connection drops. Markdown in bot replies is automatically converted to Signal text styles (bold, italic, code, etc.).
> The channel automatically reconnects to the signal-cli daemon with exponential backoff if the connection drops.
> Markdown in bot replies is automatically converted to Signal text styles (bold, italic, code, etc.).
</details>
+93 -34
View File
@@ -1,53 +1,55 @@
# In-Chat Commands
Use these slash commands inside the WebUI, terminal chat, or connected chat apps:
These commands work inside chat channels and interactive agent sessions:
| Command | Description |
|---------|-------------|
| `/new` | Stop the current task and start a new conversation |
| `/compact` | Summarize the current conversation context while keeping saved chat history |
| `/stop` | Stop the current task without cancelling its saved goal |
| `/goal <task>` | Start a sustained goal for this conversation |
| `/cancel_goal` | Cancel the active or blocked goal (also stops work on an active goal) |
| `/new` | Stop current task and start a new conversation |
| `/stop` | Stop the current task |
| `/restart` | Restart the bot |
| `/status` | Show bot status |
| `/model` | Show the current model and available model presets |
| `/model <preset>` | Switch and save the model preset for this conversation |
| `/model <preset>` | Switch and persist the model preset for the current session |
| `/dream` | Run Dream memory consolidation now |
| `/dream-log` | Show the latest Dream memory change |
| `/dream-log <sha>` | Show a specific Dream memory change |
| `/dream-restore` | List recent Dream memory versions |
| `/dream-restore <sha>` | Restore memory to the state before a specific change |
| `/dream-prompt` | Show how Dream is guided for memory |
| `/dream-prompt init` | Create an editable Dream guide at `prompts/dream.md` |
| `/dream-prompt` | Show how Dream is being guided for memory |
| `/dream-prompt init` | Create an editable Dream memory guide at `prompts/dream.md` |
| `/skill` | List enabled skills and their descriptions |
| `/trigger <name>` | Create a named local trigger for the current chat |
| `/trigger` | Show local trigger usage |
| `/trigger <name>` | Create a named local trigger for the current chat/session |
| `/pairing` | List pending pairing requests |
| `/pairing approve <code>` | Approve a pairing code |
| `/pairing deny <code>` | Deny a pending pairing request |
| `/pairing revoke <user_id>` | Revoke an approved user on the current channel |
| `/pairing revoke <channel> <user_id>` | Revoke an approved user on a specific channel |
| `/help` | Show available commands |
## Commands and File Paths
Only recognized command names (case-insensitive) are handled as commands. Anything else—including file paths like `/tmp` or `/Users/alice/report.md`—is sent to the agent normally. If a folder happens to match a command name (like `/new`), add a trailing slash (`/new/`) or write it in a sentence (`Look at /new`).
In the WebUI, recognized commands run immediately even while a reply is in progress (so `/stop` does not wait in the queue).
| `/pairing revoke <user_id>` | Revoke a previously approved user on the current channel |
| `/pairing revoke <channel> <user_id>` | Revoke a previously approved user on a specific channel |
| `/help` | Show available in-chat commands |
## Pairing
When an unapproved user sends a DM on a pairing-enabled chat app, nanobot replies with a short **pairing code** (such as `ABCD-EFGH`) that expires in 10 minutes. Approve them from any authorized chat or in the WebUI:
When someone sends a DM to the bot and isn't on the allowlist — whether it's a new user or an existing user on a new channel — nanobot automatically replies with a **pairing code** (like `ABCD-EFGH`) that expires in 10 minutes. To grant them access:
```text
/pairing approve ABCD-EFGH
```
Use `/pairing` to see pending requests and `/pairing revoke <user_id>` to remove access later. See [Configuration: Pairing](./configuration.md#pairing) for setup options.
To see who's waiting, use `/pairing`. To remove someone later, use `/pairing revoke <user_id>` — you can find user IDs in the `/pairing list` output.
See [Configuration: Pairing](./configuration.md#pairing) for the full setup guide.
## Model Presets
Run `/model` to see your active model and available presets, or switch presets for the current conversation:
Use `/model` to inspect the current runtime model:
```text
/model
```
The response shows the current session's model and preset, plus the available preset names. Each key under the top-level `modelPresets` config is the preset's canonical name everywhere nanobot displays or references it. `default` is always available and represents the model settings from direct `agents.defaults.*` fields.
To switch presets for future turns:
```text
/model fast
@@ -55,37 +57,77 @@ Run `/model` to see your active model and available presets, or switch presets f
/model default
```
Switching persists for future turns in this conversation (even across restarts) without affecting other conversations or interrupting a reply in progress. To add presets, open **Settings → Models** or see [Configuration: Model presets](./configuration.md#model-presets).
Preset names come from the top-level `modelPresets` config. Switching affects only the current session and persists the selection in that session, so later turns keep using it across process restarts. It does not rewrite `config.json`, does not change other sessions, and does not alter an in-progress turn's captured model. Sessions without a saved selection follow `agents.defaults.modelPreset` (or the implicit `default` preset when it is omitted). See [Configuration: Model presets](./configuration.md#model-presets) for setup details.
## Goals
## Local triggers
Use `/goal <task>` to start a sustained goal. Only you can cancel a goal—either run `/cancel_goal` or expand the goal in the WebUI and click **Cancel goal**. Cancelling an active goal stops its work while keeping chat history; cancelling a blocked goal leaves unrelated replies running.
Use `/trigger <name>` when a local script or another service should be able to
send a message into the current chat/session later. A name is required; plain
`/trigger` only shows the usage hint.
## Local Triggers
Create a local trigger inside the chat where future messages should appear:
Create the trigger from the chat where future messages should arrive:
```text
/trigger PR review
```
nanobot replies with a trigger ID and CLI command:
nanobot replies with a trigger ID and a command shaped like:
```bash
nanobot trigger trg_8K4P2Q9X "Review PR #4502"
```
You can also pipe longer content from a script:
Replace `"Review PR #4502"` with the message you want nanobot to receive. The
trigger is bound to the session where it was created, so the message goes back
to that same chat. Keep `nanobot gateway` running so trigger messages can be
delivered. The trigger message starts an automation turn recorded in that
session with the message you passed to the CLI; it is not treated as a normal
user message. If that session is already running a turn, the trigger waits
until the session is idle instead of being injected into the active turn.
Trigger deliveries are stored in the workspace until their linked agent turn
finishes successfully. If the gateway exits after claiming a delivery but before
the turn completes, the next gateway start requeues that delivery. This is an
at-least-once local queue: a delivery may run more than once if the process
exits at the wrong time, so external scripts should make repeated trigger
messages safe. If the delivery reaches the agent and the agent turn fails, the
delivery is marked failed in Automations instead of retrying forever.
For longer or generated content, omit the message argument and pipe stdin:
```bash
printf '%s\n' "Review the latest failed CI job" | nanobot trigger trg_8K4P2Q9X
```
For multiple instances, pass the same `--config` or `--workspace` used by the running gateway. Keep `nanobot gateway` running so trigger messages can be delivered. Manage existing triggers in the WebUI **Automations** view, and see [Automations](./automations.md) for delivery behavior and examples.
If an external webhook should wake nanobot up, run your own small webhook
service and have it call the trigger command after it builds the final message:
## Periodic Tasks (Heartbeat)
```bash
nanobot trigger <trigger-id> "<message>"
```
Heartbeat runs quiet background checks from `~/.nanobot/workspace/HEARTBEAT.md` every 30 minutes while `nanobot gateway` is running, and only messages you when something needs attention. Add tasks under `## Active Tasks` (or ask nanobot to add one for you):
If you run multiple nanobot instances, pass the same config or workspace
selector used by the gateway:
```bash
nanobot trigger --config ./bot-a/config.json trg_8K4P2Q9X "Nightly report"
nanobot trigger --workspace ./bot-a/workspace trg_8K4P2Q9X "Nightly report"
```
Manage triggers from the WebUI Automations view. You can search, pause/resume,
rename, delete, and copy the trigger command there. A session may have multiple
triggers, just like it may have multiple scheduled automations.
See [Automations](./automations.md) for how local triggers fit with scheduled
automations, heartbeat, and gateway delivery.
## Periodic Tasks
Periodic background checks are driven by `HEARTBEAT.md` in your workspace (`~/.nanobot/workspace/HEARTBEAT.md`). When `nanobot gateway` starts, it registers a protected heartbeat cron job by default. Every 30 minutes, that job checks the file; if it finds tasks under `## Active Tasks`, the agent executes them and delivers only results that pass the notification gate to your most recently active chat channel. If there are no active tasks, or the result is routine with nothing useful to report, the heartbeat is skipped silently.
Use heartbeat for recurring checks that should usually stay quiet. User-created cron jobs are different: they run as scheduled turns in the chat/session where they were created and normally deliver the result back to that channel.
**Setup:** edit `~/.nanobot/workspace/HEARTBEAT.md` (created automatically by `nanobot onboard`):
```markdown
## Active Tasks
@@ -94,4 +136,21 @@ Heartbeat runs quiet background checks from `~/.nanobot/workspace/HEARTBEAT.md`
- Scan inbox for urgent emails and notify me if any are found
```
Remove completed tasks from the file when they are no longer needed. To change the interval or disable heartbeat, see [Configuration: Heartbeat](./configuration.md#gateway-heartbeat).
The agent can also manage this file itself - ask it to "add a periodic background check" or "check this periodically but only notify me if something changes" and it will update `HEARTBEAT.md` for you. Completed tasks should be deleted from the file, not moved to another section.
You can change the interval or disable the built-in heartbeat in `~/.nanobot/config.json`:
```json
{
"gateway": {
"heartbeat": {
"enabled": true,
"intervalS": 1800
}
}
}
```
The heartbeat job is visible in `cron(action="list")` as `heartbeat`, but it is system-managed and cannot be removed with the `cron` tool. To stop it, set `gateway.heartbeat.enabled` to `false` and restart the gateway.
> **Note:** The gateway must be running (`nanobot gateway`) and you must have chatted with the bot at least once so it knows which channel to deliver to.
-27
View File
@@ -1,27 +0,0 @@
# CI execution boundaries
Code validation and release acceptance have different owners. `Test Suite` validates PRs and the merged `main` tree. `Verify Release Candidate` builds an explicit candidate and validates its exact installable bytes. Neither workflow publishes releases, signs manifests or advances `release-index`; that branch is a release catalogue, not a product source branch.
## Code validation
`scripts/ci_scope.py` owns the ordered path rules and explains each decision in the run summary. PR selection uses the merge-base diff; pushes use the complete before/after range, including all commits in the push. Renames consider both old and new paths. Missing revisions, failed or empty diffs, unknown paths and manual dispatch select the full validation set. Ordinary documentation changes still produce the stable `CI required` result without scheduling product jobs.
Python retains its Linux minimum/latest and Windows compatibility matrix. WebUI changes retain lint, types, unit coverage, build, browser regression and Docker checks. TUI functionality retains both platforms' checks, tests, terminal smoke, build and archive verification. Shared backend client contracts select the consuming clients as well. Docker continues checking installed assets, startup, dependencies and container privilege boundaries; frontend changes are not assumed irrelevant to the image.
Native packaging, installation and update lifecycle changes additionally select Linux and Windows native acceptance on PRs. Windows isolated update jobs and installer checks use the same high-risk selection. The installer matrix has its own bounded job, separate from process-identity checks; an 18-minute installer run must not consume the process job's timeout or hide its result. Pushes to `main` run the selected code checks but do not repeat those specialized installer/update journeys or full native acceptance. A manual `Test Suite` dispatch requests all checks. Scope changes must keep new shared contracts and lifecycle dependencies classified; directory names alone do not establish the dependency graph.
`CI required` checks the selected job results, including matrix and reusable-workflow results. Failure, cancellation, an unexpected skip or a missing selector output fails the gate. Only an intentional unselected skip is accepted. Administrators should require this stable check in branch protection/rulesets; defining the job does not enable repository protection or remove any existing required check.
## Candidate acceptance
The candidate producer builds five platform bundles and records the candidate commit and manifest SHA-256. It transfers only the Linux x64 and Windows x64 wheels and the manifest to parallel native consumers. Consumers download by immutable producer artifact IDs, including when only failed jobs are retried, and verify the build-output manifest hash, candidate commit, wheel size/hash and embedded commit before installing or executing the wheel. They never rebuild candidate packages. The same reusable native acceptance workflow also builds private test packages for high-risk PRs.
Each native consumer runs the clean public installer, installed startup/assets probes, and all nine packaged upgrade/recovery scenarios, including subsequent successful updates after restoration. Windows acceptance retains the default short-path policy. Scenarios remain serial within their private environment: sharing that installation across parallel scenarios would invalidate the test. These controlled version/fault fixtures do not replace real supported historical baselines, public-download acceptance, other native platforms, or interactive UI acceptance; see [the release checklist](releasing.md).
`Candidate required` requires both the producer and the complete native matrix. Only after success may an explicitly requested prepared source/installation handoff be promoted to `installable-candidate`. Temporary same-run wheel transfers expire after one day, even when no installable handoff was requested. Reports are retained for three days; an explicitly requested installable handoff expires after one day. Preserve accepted bytes and evidence before expiry. The final gate is not publication approval: the existing separate approval, public artifact verification and serialized catalogue advancement remain mandatory.
## Timing and evidence
Packaged acceptance writes `packaged-update-timings.json` incrementally, including failed phases and completed scenarios. It measures environment setup, initial dependencies, fixture generation, baseline installation, each preparation/worker/verification journey, cleanup and scenario totals. Scenario totals overlap their phases and must not be added to them. Completed checkpoints are diagnostic evidence, not an overall pass.
Upload only the explicit structured reports. Private acceptance logs, configuration, sessions, backups and live test environments can contain credentials and are not upload sets. Do not remove hash checks or durable production writes merely to reduce CI time. Compare wall time and raw runner-minutes separately, with the same scenario coverage and exact source/produced package identity; moving work out of daily CI does not prove that the specialized acceptance itself became faster.
+99 -70
View File
@@ -7,7 +7,6 @@ Use this page when you know what you want to run and need the command shape. For
| Goal | Command | Notes |
|---|---|---|
| Check the install | `nanobot --version` | If this fails, try `python -m nanobot --version` |
| Update an ordinary Python venv | `nanobot update` | Latest stable PyPI release; use the [installation-specific route](./updating.md#installation-owners) for other methods |
| Create or refresh config | `nanobot onboard` | Creates `~/.nanobot/config.json` and `~/.nanobot/workspace/` |
| Refresh config non-interactively | `nanobot onboard --refresh` | Preserves existing values and adds missing default fields without prompting |
| Use guided setup | `nanobot onboard --wizard` | Best when you prefer prompts over hand-editing JSON |
@@ -17,6 +16,7 @@ Use this page when you know what you want to run and need the command shape. For
| Chat in the terminal | `nanobot` | Interactive local chat; `nanobot agent` remains an explicit alias |
| Run the gateway directly | `nanobot gateway` | Service/ops command for WebUI, chat apps, cron, and heartbeat |
| Deliver a local trigger | `nanobot trigger <id> "message"` | Created first with `/trigger <name>` in the target chat/session |
| Serve an OpenAI-compatible API | `nanobot serve` | Starts `/v1/chat/completions`, `/v1/models`, and `/health` |
| Check chat channel setup | `nanobot channels status` | Useful before starting `nanobot gateway` |
| Manage optional features | `nanobot plugins list` | Shows channels and optional capabilities you can turn on |
| Log in to QR/OAuth-style channels | `nanobot channels login <channel>` | Used by channels such as WhatsApp and WeChat |
@@ -27,66 +27,32 @@ Use this page when you know what you want to run and need the command shape. For
```bash
nanobot --help
nanobot --version
nanobot --home ~/.nanobot-work onboard
python -m nanobot --help
python -m nanobot --version
```
`python -m nanobot ...` is useful when the package is installed but the `nanobot` script is not on `PATH`.
`--home <directory>` is a global option; place it before the subcommand. It selects `<directory>/config.json` and the default `<directory>/workspace/`. Explicit `--config` and workspace settings still apply. See [Multiple Instances](./multiple-instances.md) for runtime data locations and port selection. `-h` and `--help` display help.
### Coexisting with Nanobot Desktop
The Python package and Nanobot Desktop keep separate runtimes, configuration, workspaces, and state. When a running Desktop release publishes its private terminal-access descriptor, an interactive bare `nanobot` or `nanobot webui` asks which installation to use after authenticating a ready Desktop target. Use `Up`/`Down` to highlight an installation and `Enter` to confirm. `Ctrl+C` cancels with exit code 130 without attaching to Desktop or starting a Python backend. If Desktop is absent, busy, unavailable, or cannot be authenticated, the command reports the current Python executable and continues normally. A virtual environment's executable is shown without resolving it to its base interpreter.
Choosing Desktop for `nanobot webui` opens its already-running browser workbench and exits; closing the browser never stops the Desktop gateway. Choosing Desktop for bare `nanobot` opens the terminal UI against that same running backend when the Desktop host, gateway and terminal client support terminal protocol 1. Older versions fail explicitly with update guidance. Use explicit `nanobot agent` for the original Python terminal UI. After Desktop is selected, a disconnect or incompatible reply ends that invocation with an error; it never silently switches to Python or launches a replacement. On macOS, browser URLs are delivered through native Launch Services rather than command-line arguments. A failed native handoff does not fall back to `open` or a `BROWSER` command, keeping bootstrap credentials out of launcher arguments.
On Windows, the shared browser launcher uses a private HTML redirect rather than passing a credential-bearing URL to a browser command. A short-lived, windowless Python helper receives the URL over an anonymous pipe, opens the redirect through the system's HTTP association, and attempts file cleanup after two minutes. The calling CLI can exit immediately after the launch acknowledgement; this helper does not start, stop, or keep a gateway alive. It does not honor `BROWSER` overrides. Redirects are stored in the current user's Windows Local AppData known folder, under `NanobotBrowserHandoff-v1`, with an explicit current-user-only protected ACL. An ACL-enforcing local filesystem and a non-reparse storage path are required; unsafe existing storage or failed browser handoff fails without raw-URL fallback. Abnormal termination can leave a private redirect behind. Later invocations retry cleanup of verified redirect files older than ten minutes, excluding active files; cleanup is not a guarantee of physical erasure or secrecy from same-user programs or administrators. No Python/Desktop settings, credentials, or history are imported between installations.
Any explicit subcommand or option—including `nanobot agent`, `nanobot webui --no-open`, config/workspace selectors, help, version, completion, and gateway lifecycle commands—keeps its existing Python meaning and never opens the Desktop picker. Target choices are not remembered, and Desktop settings are not copied into the Python installation.
Desktop terminal credentials are short-lived WebSocket/API tokens obtained through the authenticated current-user rendezvous. The TUI receives them through a bounded anonymous pipe, not command arguments, environment variables or temporary files. Its environment contains only a trusted resolver command and public instance IDs. The resolver verifies the selected Desktop and gateway again for every credential refresh. The gateway identity is also checked before any WebSocket mutation. This mode does not acquire a gateway lifecycle lease: client exit leaves Desktop running, and disconnect never automatically reconnects or replays an uncertain task.
Desktop-only distributions use the narrow `nanobot-desktop-tui` entrypoint inside their existing private runtime; it is not a replacement for the full Python CLI. They must ship this engine entrypoint and a matching terminal client together. The client cache can be kept inside Desktop's data root without reading or writing the separate Python installation's config. No additional system Python is needed.
## Common Patterns
### Updating
```bash
nanobot update --check # Check the latest stable PyPI release; do not install
nanobot update # Install it in an ordinary Python venv
nanobot update --dev # Update source and prepare its matching interfaces
nanobot update --plan # Save an exact review; do not install or restart
```
The first two commands target stable PyPI releases, not the saved Preview subscription. `--dev` (`--update-dev`) selects source, not Preview. `--plan --channel stable` or `--plan --channel preview` inspects that channel without changing the subscription; `--channel` requires `--plan`. Saved plans are not executed by `nanobot update`.
Before an in-place update, back up configuration, workspace files and chat history, then stop all processes sharing that Python environment. New versions may migrate stored data. Use the original [installation-specific route](./updating.md#installation-owners) for uv, pipx, containers, system packages and Desktop; do not overwrite a manager-owned environment with pip. Already-satisfying dependencies remain installed.
Source updates require Git. Existing editable checkouts fast-forward their current branch to its upstream; resolve local changes, detached HEADs and divergence manually. Updating a package with `--dev` creates an editable checkout under `~/.nanobot/src/` on the official `main` branch. nanobot downloads its pinned Bun when needed; Node is not required. To return to a release, install it in a separate environment and launch outside the checkout; in-place source-to-release switching is refused.
After installation, restart nanobot and verify the **running** gateway's version and behavior. The CLI checks the installation, not the live process. Downgrading requires `--allow-downgrade` and compatible data; back up before using it.
In-place CLI updates have no automatic rollback. A failed or interrupted installation leaves an incomplete-update marker under `~/.nanobot/run/`. Stop nanobot and retry the same update from that environment. On Windows, stop processes holding installation files and retry with that environment's `python -m nanobot update` (add `--dev` for source).
The WebUI's **Settings → About** uses a separate reviewed update-and-restart flow for supported installations and shows owner-specific instructions for others. See [Updating nanobot](./updating.md) for Preview selection, recovery and permission limits. Source updates remain CLI-only. To inspect a saved WebUI job, use `nanobot update --job <plan-id>`; [explicit handoff retry](./updating.md#explicit-recovery-before-package-mutation) requires additional consent and an intact installation, not a post-install repair.
Most day-to-day commands use the default config and workspace. Advanced or multi-instance runs usually pass both paths explicitly:
```bash
nanobot agent --config ./bot-a/config.json --workspace ./bot-a/workspace -m "Hello"
nanobot gateway --config ./bot-a/config.json --workspace ./bot-a/workspace
nanobot serve --config ./bot-a/config.json --workspace ./bot-a/workspace
```
Use `--verbose` on long-running processes when you need startup or runtime logs:
```bash
nanobot gateway --verbose
nanobot serve --verbose
```
Long-running commands keep working until you stop them. Press `Ctrl+C` in that terminal to stop a foreground `nanobot gateway`. If you started the gateway with `--background`, use `nanobot gateway stop`.
Long-running commands keep working until you stop them. Press `Ctrl+C` in that terminal
to stop foreground `nanobot gateway` or `nanobot serve`. If you started the gateway
with `--background`, use `nanobot gateway stop`.
## Setup
@@ -112,7 +78,9 @@ Default paths:
| `nanobot status --config <path>` | Check a specific config file |
| `nanobot status --workspace <path>` | Show status with a workspace override |
Status does not send a model request. On success, run the printed `nanobot agent -m "Hello!"` command to verify network access and credentials. On failure, follow the printed WebUI **Settings → Models** or `nanobot onboard --wizard` route.
Status does not send a model request. On success, run the printed
`nanobot agent -m "Hello!"` command to verify network access and credentials. On failure,
follow the printed WebUI **Settings → Models** or `nanobot onboard --wizard` route.
## Agent CLI
@@ -128,19 +96,32 @@ Status does not send a model request. On success, run the printed `nanobot agent
| `nanobot --no-markdown` | Use the classic prompt and print plain text instead of Markdown |
| `nanobot --logs` | Use the classic prompt and show runtime logs while chatting |
Inside the native TUI, `/sessions` switches saved conversations, `/new-chat` starts another saved conversation, and `/context` explains the compacted summary and raw session suffix available to the next agent turn. `/branch` forks a saved conversation from a completed reply, and `/diff` opens the latest turn's file changes as a full-screen unified diff. `PageUp` loads older transcript pages when you reach the top. By default, each launch starts a new session using the launch directory as its workspace. `--session` selects a specific existing session, and `--workspace` overrides the launch directory. When the TUI exits, it prints a ready-to-run `nanobot agent --session ...` command for the current session.
Inside the native TUI, `/sessions` switches saved conversations, `/new-chat` starts another saved
conversation, and `/context` explains the compacted summary and raw session suffix available to
the next agent turn. `/branch` forks a saved conversation from a completed reply, and `/diff`
opens the latest turn's file changes as a full-screen unified diff.
`PageUp` loads older transcript pages when you reach the top. By default, each launch starts a
new session using the launch directory as its workspace. `--session` selects a specific existing
session, and `--workspace` overrides the launch directory. When the TUI exits, it prints a
ready-to-run `nanobot agent --session ...` command for the current session.
## Session Storage
## Session Storage and Rollback
Session state lives in `<config-dir>/sessions/<workspace-id>/sessions.sqlite3`, outside the agent-readable workspace. Existing JSONL conversations are imported on the first startup. JSONL migration is available from 0.3.6 through 0.4.x and is removed in **0.5.0**; installations with only JSONL data must upgrade through that window before using 0.5.0.
Session JSONL files live under `<config-dir>/sessions/<workspace-id>/`, outside the
agent-readable workspace. On the first upgraded start, nanobot safely migrates existing
`<workspace>/sessions/*.jsonl` files after verifying an atomic copy. Stop every old nanobot
process that uses the workspace before upgrading; old and new binaries must not write the
same session concurrently.
After a successful import, JSONL files and their checkpoints from `<workspace>/sessions/` move to `<config-dir>/sessions/<workspace-id>/jsonl-backup/`, preserving their contents outside the agent-readable workspace. JSONL files already in the private session directory remain there. An interrupted migration resumes on startup before nanobot serves conversations; failed imports leave their source files unchanged.
To prepare a downgrade, stop nanobot and copy the current sessions back to the path understood
by older releases:
WebUI chat history is saved in the same session database. The gateway automatically imports old `<config-dir>/webui/*.jsonl` files and numbered JSONL files inside `<config-dir>/webui/*.segments/` directories. If old history is damaged or cannot be matched to one conversation, startup stops with an error; resolve the reported problem before restarting.
```bash
nanobot sessions restore-workspace --config ./bot-a/config.json --workspace ./bot-a/workspace
```
The old WebUI history files remain unchanged as backups. Imported chats deleted after the upgrade stay deleted on restart. Keep the `webui` directory: it still contains sidebar preferences and other saved WebUI state.
Before changing versions, stop all nanobot instances using the same config directory and back up that entire directory and the workspace together. Copying only `sessions.sqlite3` while nanobot is running can miss recent messages. To downgrade, restore a complete pre-upgrade backup compatible with the older release. Older releases cannot read newly saved WebUI history; do not combine the current session database with old WebUI history files.
The command never deletes the external store and refuses to overwrite a different existing
workspace file. Back up both the config directory and workspace before changing versions.
Interactive mode uses nanobot's native TypeScript terminal UI. It talks to the same local gateway as the WebUI, so streaming, tool progress, and WebSocket sessions share one protocol instead of maintaining a second agent loop. If no gateway is running, either client starts it on demand. The TUI paints immediately while the local gateway starts, then obtains fresh bootstrap credentials and connects in the background. Exiting one TUI or WebUI launcher releases only that client; the last interactive launcher stops the on-demand gateway. A small gateway watchdog also reclaims an on-demand process if its last client crashes. `/detach` promotes the shared gateway to persistent background mode before closing the TUI, so active agent work continues without a connected client. An explicit `nanobot gateway --background` starts or promotes the gateway the same way before opening a client. `nanobot gateway restart` restarts a detached gateway without changing that lifetime; restart an attached foreground gateway in its owning terminal. `nanobot gateway stop` ends either mode.
@@ -148,9 +129,7 @@ The default `--theme auto` mode paints first with the terminal's default backgro
`Enter` sends the current message. While nanobot is working, `Enter` sends immediately, `Tab` waits until the current response is finished, and `Option+Up` on macOS (`Alt+Up` on Windows/Linux) returns the latest waiting message to the composer. Press `Shift+Enter` to add a newline; `Ctrl+J` is the universal fallback when a terminal cannot distinguish modified Enter keys. `Alt+Enter` and `Ctrl+Enter` are also accepted when distinguishable. Use `Up`/`Down` at the composer edge to recall prompts from the current saved session. Large pastes appear as a compact placeholder in the composer but are sent unchanged. Type `/` to discover nanobot commands and terminal navigation in one palette, or type `@` to complete installed apps, configured MCP servers, and saved sessions. Use the arrow keys to choose an item and `Tab` to complete it. `/sessions` opens a searchable conversation picker, `/new-chat` preserves the current conversation and starts another one, and `/branch` forks from a completed reply. `/diff` opens a read-only unified diff for the newest turn; use `Left`/`Right` to switch edits and `Esc` to close it. The core `/new` command retains its cross-channel behavior and resets the current chat. `Ctrl+C` copies a selection, stops a running turn, clears a non-empty composer, or exits when idle. Use `PageUp`/`PageDown` to scroll, `Ctrl+Home`/`Ctrl+End` to jump to the transcript edges, and `Ctrl+O` to expand or collapse long tool traces. When you leave the bottom, the TUI shows a scrollbar and a `Ctrl+End` hint until you return. The footer reports provider token/cache usage when available. Selections copy through OSC 52 when the terminal supports it. The transcript reflows when the terminal is resized, and exiting restores the previous screen.
Platform wheels bundle the matching native terminal executable for macOS 13+ (Apple Silicon and Intel), glibc 2.17+ Linux (x64 and ARM64), and Windows x64. The x64 runtime requires SSE4.2. Its licenses, third-party notices, source offer, relinking instructions, and corresponding TUI source are installed alongside it in `nanobot/tui/bin/`. The launcher uses this bundled executable without downloading from GitHub or requiring Bun.
Source-distribution builds do not contain a native executable; where supported, their launcher can still fetch the version-matched GitHub release archive. `NANOBOT_TUI_NO_DOWNLOAD=1` disables that fallback, not the bundled TUI. Use `--classic` to explicitly select the Python prompt. Windows ARM64 and musl-based Linux (such as Alpine) do not have a supported native TUI wheel; use the classic prompt or WebUI. In particular, Windows ARM64 cannot run OpenTUI because Bun disables the required FFI there. A local editable source install requires Bun and runs its own `tui/` source while the original checkout remains available; it never silently falls back to a release binary.
Packaged releases fetch a version-matched, checksummed terminal archive for macOS (Apple Silicon and Intel), Linux (x64 and ARM64), or Windows x64 on first use. The cache keeps the executable together with its licenses, third-party notices, source offer, relinking instructions, and corresponding TUI source. Windows ARM64 currently falls back to the classic prompt because the Bun runtime disables the FFI required by OpenTUI on that platform. Set `NANOBOT_TUI_NO_DOWNLOAD=1` or pass `--classic` to keep the Python-only path. A local source install requires Bun and runs its own `tui/` source while the original checkout remains available; it never silently falls back to a release binary.
Non-interactive input/output, `--logs`, and `--no-markdown` automatically retain the classic prompt so existing scripts and diagnostic workflows do not acquire terminal control sequences or silently ignore their options.
@@ -160,19 +139,22 @@ Interactive mode exits with `exit`, `quit`, `/exit`, `/quit`, `:q`, or `Ctrl+D`.
| Command | Description |
|---|---|
| `nanobot webui` | Prepare local WebUI settings and open the browser; installer-managed environments launch persistently, other installations remain attached and follow gateway logs |
| `nanobot webui --detach` | Explicitly start or join a persistent gateway, open the browser and return control to the terminal |
| `nanobot webui` | Create config/workspace if needed, enable the local WebUI channel after confirmation, start the gateway, open `http://127.0.0.1:8765`, and follow new gateway logs |
| `nanobot webui --background` | Deprecated; prints the equivalent explicit `nanobot gateway --background` command and exits |
| `nanobot webui --dev` | Start the gateway and Vite together at `http://127.0.0.1:5173`, with live frontend updates |
| `nanobot webui --no-open` | Prepare and start the WebUI without opening a browser |
| `nanobot webui --no-dock` | Suppress the macOS Dock icon; detached mode remembers this choice until the next WebUI launch |
| `nanobot webui --port <port>` | Set the WebUI/WebSocket port |
| `nanobot webui --gateway-port <port>` | Override the gateway health port |
| `nanobot webui --yes` | Apply safe localhost WebUI defaults without confirmation; configure provider credentials in **Settings → Models** |
First-run WebUI setup binds to `127.0.0.1` by default. Use manual configuration and a WebUI password before exposing the WebSocket channel beyond localhost.
`--dev` is a foreground source-checkout workflow and cannot be combined with `--detach`. It installs frontend dependencies when `webui/node_modules` is missing, proxies to the configured WebSocket channel port, and stops Vite when the launcher exits. The shared on-demand gateway stops only when no other interactive client still holds it. Installer-managed normal WebUI launches and explicit `--detach` use the gateway's persistent lifecycle; manage that same instance with the `gateway` commands below. The old `webui --background` spelling remains deprecated and prints migration guidance.
`--dev` is a foreground source-checkout workflow. Persistent gateway lifecycle is deliberately
owned only by `nanobot gateway --background`; `nanobot webui --background` prints migration
guidance instead of silently changing process ownership.
It installs frontend dependencies when `webui/node_modules` is missing, proxies to the configured
WebSocket channel port, and stops Vite when the launcher exits. The shared on-demand gateway stops
only when no other interactive client still holds it.
## Gateway
@@ -195,9 +177,7 @@ First-run WebUI setup binds to `127.0.0.1` by default. Use manual configuration
| `nanobot gateway install-service --dry-run` | Preview the generated service file and system commands |
| `nanobot gateway uninstall-service` | Remove the installed system service |
On Windows, `gateway stop` waits up to `--timeout` seconds (default: 20) for the gateway to stop normally. If a forced stop is needed, the command displays a warning. Forced stops can interrupt active work.
For custom instances, pass the same selector flags after the management subcommand, as shown below. `--config` and `--workspace` before a management subcommand are rejected with a usage error; they are not inherited.
For custom instances, pass the same selector flags to management commands:
```bash
nanobot gateway --background --config ./bot-a/config.json --workspace ./bot-a/workspace
@@ -206,7 +186,10 @@ nanobot gateway stop --config ./bot-a/config.json --workspace ./bot-a/workspace
nanobot gateway install-service --config ./bot-a/config.json --workspace ./bot-a/workspace --name bot-a
```
`--background` is a lightweight detached process. `install-service` is for login/startup integration: Linux uses a systemd user service; macOS uses a LaunchAgent plist. System services run the foreground gateway under the OS supervisor rather than nesting another background process.
`--background` is a lightweight detached process. `install-service` is for
login/startup integration: Linux uses a systemd user service; macOS uses a
LaunchAgent plist. System services run the foreground gateway under the OS
supervisor rather than nesting another background process.
Default health endpoint:
@@ -218,15 +201,27 @@ The bundled WebUI is served by the WebSocket channel, usually on port `8765`, no
## Local Triggers
`nanobot trigger` delivers one local message to a trigger that was created from a chat/session with `/trigger <name>`.
`nanobot trigger` delivers one local message to a trigger that was created from
a chat/session with `/trigger <name>`.
```bash
nanobot trigger trg_8K4P2Q9X "Review PR #4502"
```
Keep `nanobot gateway` running so the message can be delivered to the linked chat/session. The message is recorded as an automation turn in that session, not as a normal chat message typed by the user.
Keep `nanobot gateway` running so the message can be delivered to the linked
chat/session. The message is recorded as an automation turn in that session,
not as a normal chat message typed by the user.
The command writes to a workspace-local durable queue. If `nanobot gateway` is not running yet, the message waits in that workspace. If the target session is already running a turn, the trigger waits for that session to become idle. If the gateway exits after claiming a delivery but before the linked turn completes, the next gateway start requeues that delivery. The queue is at-least-once, not exactly-once, so the same message can be delivered again after an interrupted process. If the agent receives the delivery and the turn fails, the delivery is marked failed instead of retried indefinitely. Each delivery also writes an audit record under `<workspace>/triggers/runs`. Run one gateway consumer per workspace; this local queue is not a distributed multi-consumer queue.
The command writes to a workspace-local durable queue. If `nanobot gateway` is
not running yet, the message waits in that workspace. If the target session is
already running a turn, the trigger waits for that session to become idle. If the
gateway exits after claiming a delivery but before the linked turn completes,
the next gateway start requeues that delivery. The queue is at-least-once, not
exactly-once, so the same message can be delivered again after an interrupted
process. If the agent receives the delivery and the turn fails, the delivery is
marked failed instead of retried indefinitely. Each delivery also writes an
audit record under `<workspace>/triggers/runs`. Run one gateway consumer per
workspace; this local queue is not a distributed multi-consumer queue.
Use stdin when another local process generates the message:
@@ -243,11 +238,37 @@ Options:
| `nanobot trigger --config <path> <id> "message"` | Use the workspace from a specific config |
| `nanobot trigger --workspace <path> <id> "message"` | Use a specific workspace |
Triggers are managed in the WebUI Automations view instead of through separate `list`, `revoke`, or `delete` CLI subcommands. From there you can pause/resume, rename, delete, search, and copy the command for each trigger.
Triggers are managed in the WebUI Automations view instead of through separate
`list`, `revoke`, or `delete` CLI subcommands. From there you can pause/resume,
rename, delete, search, and copy the command for each trigger.
For webhooks or other external systems, run your own small service and have it call this CLI after it decides what message nanobot should receive.
For webhooks or other external systems, run your own small service and have it
call this CLI after it decides what message nanobot should receive.
See [Automations](./automations.md) for the broader automation model, WebUI management, and delivery behavior.
See [Automations](./automations.md) for the broader automation model, WebUI
management, and delivery behavior.
## OpenAI-Compatible API
| Command | Description |
|---|---|
| `nanobot serve` | Start `/v1/chat/completions`, `/v1/models`, and `/health` |
| `nanobot serve --host <host>` | Override API bind host |
| `nanobot serve --port <port>` | Override API port |
| `nanobot serve --timeout <seconds>` | Override per-request timeout |
| `nanobot serve --verbose` | Show runtime logs |
| `nanobot serve --workspace <path>` | Override workspace |
| `nanobot serve --config <path>` | Use a specific config file |
Default API endpoint:
```text
http://127.0.0.1:8900
```
Public binds (`0.0.0.0` or `::`) require `api.apiKey`; send it as a Bearer token on API routes.
See [`openai-api.md`](./openai-api.md) for request examples.
## Status
@@ -286,15 +307,21 @@ See [`chat-apps.md`](./chat-apps.md) for channel-specific setup.
## Optional Features
Use these commands when you want nanobot to add or remove a built-in capability without hand-editing JSON. Enabling may install the support package first. Disabling is for channels such as Telegram, Matrix, or Slack; it keeps your saved settings and turns the channel off.
Use these commands when you want nanobot to add or remove a built-in capability
without hand-editing JSON. Enabling may install the support package first.
Disabling is for channels such as Telegram, Matrix, or Slack; it keeps your
saved settings and turns the channel off.
The `plugins` command name is retained for compatibility, but these entries are nanobot runtime support packages, not the user-invokable tools shown in WebUI Apps. They cannot be attached to a chat turn with `@`.
The `plugins` command name is retained for compatibility, but these entries are
nanobot runtime support packages, not the user-invokable tools shown in WebUI
Apps. They cannot be attached to a chat turn with `@`.
| Feature name | What it enables |
|---|---|
| `api` | Dependencies required by the OpenAI-compatible `nanobot serve` process |
| `azure` | Azure identity support for Azure-hosted models |
| `bedrock` | AWS Bedrock model provider support |
| `langfuse` | Langfuse tracing support for OpenAI-compatible providers and the Codex OAuth provider |
| `langfuse` | Langfuse tracing support for OpenAI-compatible providers |
| `olostep` | Olostep web search provider support |
| A channel name such as `telegram` or `slack` | The connector package and saved channel enablement |
@@ -308,7 +335,9 @@ The `plugins` command name is retained for compatibility, but these entries are
| `nanobot plugins enable <name> --config <path>` | Update a specific config file |
| `nanobot plugins disable <channel> --config <path>` | Turn off a channel in a specific config file |
Document and PDF reading are included in the standard installation. The old `nanobot plugins enable documents` and `nanobot plugins enable pdf` commands remain accepted as no-op compatibility aliases.
Document and PDF reading are included in the standard installation. The old
`nanobot plugins enable documents` and `nanobot plugins enable pdf` commands
remain accepted as no-op compatibility aliases.
## Provider OAuth
+138 -84
View File
@@ -1,75 +1,100 @@
# Concepts
This page explains how nanobot's main pieces fit together in plain language, so you can configure models, workspaces, memory, and automations with confidence.
Use this page when you want to understand nanobot before changing advanced settings. It explains the moving parts without requiring you to read the source first.
For source-code structure and contributor details, see [Architecture](./architecture.md).
If you want source-file ownership and extension points, read [`architecture.md`](./architecture.md) after this page.
## Main Building Blocks
## Runtime Shape
```mermaid
flowchart LR
U["WebUI / Terminal / Chat Apps"] --> G["Gateway"]
G --> A["Agent"]
A --> P["AI Provider"]
A --> T["Tools (Files, Shell, Web, MCP)"]
A --> M["Workspace & Memory"]
```
nanobot has one small core loop and several ways to enter it:
| Part | What it does |
|---|---|
| Agent | Reads your message and conversation context, runs enabled tools when needed, and writes the reply |
| Providers | AI services or local servers (OpenRouter, Anthropic, OpenAI, Bedrock, Ollama, vLLM, and more) |
| Channels | Ways to talk to nanobot: WebUI, terminal (CLI/TUI), Telegram, Discord, Slack, Feishu, WeChat, Email, Mattermost, Linear, and others |
| Tools | Capabilities the agent can use, such as files, shell commands, web search, MCP servers, image generation, automations, and subagents |
| Memory | Saved conversation history and long-term workspace notes that carry context forward |
| Gateway | The background service that keeps the WebUI, chat apps, and automations running |
| Agent loop | Builds context, selects the session, calls the provider, runs tools, and publishes replies |
| Providers | LLM backends such as OpenRouter, Anthropic, OpenAI, Bedrock, Ollama, vLLM, and other OpenAI-compatible APIs |
| Channels | User-facing transports such as CLI, WebUI/WebSocket, Telegram, Discord, Slack, Feishu, WeChat, Email, Mattermost, and others |
| Tools | Capabilities the model may call, including files, shell, web search/fetch, MCP, cron, image generation, and subagents |
| Memory | Workspace files and session history that keep useful context across turns |
| Gateway | Long-running process that connects enabled channels and serves the health endpoint |
To send a single test message, run `nanobot agent -m "Hello!"`. For everyday use with the WebUI, chat apps, or scheduled tasks, nanobot runs the gateway in the background.
The simplest path is `nanobot agent -m "Hello!"`: one inbound message goes through the agent loop and prints the reply in your terminal. The long-running path is `nanobot gateway`: channels receive messages from chat apps or the WebUI, publish them to the same agent loop, and send replies back to the originating channel.
## Config vs Workspace
By default, everything lives under `~/.nanobot/`:
The default instance lives under `~/.nanobot/`:
| Path | What it stores |
| Path | Meaning |
|---|---|
| `~/.nanobot/config.json` | Settings: providers, model presets, channels, tools, and security options |
| `~/.nanobot/workspace/` | Agent state: long-term memory, skills, `HEARTBEAT.md`, automations, and generated files |
| `~/.nanobot/sessions/` | Saved conversation history (stored separately from the workspace) |
| `~/.nanobot/config.json` | Instance configuration: providers, model defaults, channels, tools, gateway, API, and runtime options |
| `~/.nanobot/workspace/` | Agent workspace: memory, heartbeat tasks, cron jobs, skills, and generated artifacts |
| `~/.nanobot/sessions/<workspace-id>/` | Session history stored outside the agent-accessible workspace; the opaque ID follows workspace moves |
The **config file** controls what nanobot is allowed to use. The **workspace** holds the agent's durable state. You can point commands at a different config or workspace with `--config` and `--workspace` (or `--home`; see [Multiple Instances](./multiple-instances.md)).
You can override both with command flags:
```bash
nanobot onboard --config ./bot-a/config.json --workspace ./bot-a/workspace
nanobot agent --config ./bot-a/config.json --workspace ./bot-a/workspace -m "Hello"
nanobot gateway --config ./bot-a/config.json --workspace ./bot-a/workspace
```
The config file controls what nanobot may use. The workspace is where nanobot keeps state for that instance.
### Agent Workspace and Project Workspace
Your configured workspace is the **agent workspace**. In the WebUI, you can also pick a different **project workspace** (such as a code repository) for a specific topic without changing your agent's identity or memory:
The configured workspace is the **agent workspace**. A WebUI chat can also select
a different **project workspace** for repository-specific work without moving the
agent's identity or durable state.
| What | Comes from |
| Resource | Owner when a project is selected |
|---|---|
| Project instructions (`AGENTS.md`) | The selected project folder |
| Agent personality and user profile (`SOUL.md`, `USER.md`) | The agent workspace |
| Long-term memory and custom skills (`memory/`, `skills/`) | The agent workspace |
| Relative file paths and shell commands | The selected project folder |
| Project instructions | `AGENTS.md` from the selected project; there is no fallback to the agent workspace's `AGENTS.md` |
| Agent profile | `SOUL.md` and `USER.md` from the agent workspace; project-local files with those names are ignored |
| Memory and custom skills | `memory/` and `skills/` from the agent workspace |
| Relative file paths and shell working directory | The selected project workspace |
When you do not pick a separate project, both roles use the same directory. Picking a project changes where the agent works for that topic; it does not create a separate agent or separate memory.
When no separate project is selected, one directory normally serves both roles.
Selecting a project changes the working context for that chat; it does not create
a second agent or relocate the configured agent workspace.
## Entry Points: CLI, WebUI, and Gateway
## Config Format
| Entry point | Command | Best for |
`config.json` accepts both camelCase and snake_case keys. The docs use camelCase because nanobot writes config back to disk with camelCase aliases, for example `apiKey`, `modelPresets`, `intervalS`, and `maxToolResultChars`.
Most examples are partial snippets. Merge them into the existing file created by `nanobot onboard`; do not replace the whole file unless you want to reset the instance.
## One Agent Turn
A normal turn follows this flow:
1. A channel receives a user message and publishes it to the message bus.
2. The agent loop chooses a session key and builds context from the effective project workspace, agent-owned profile/skills/memory, recent messages, channel metadata, and runtime settings.
3. The provider receives the model request.
4. If the model asks for tools, the runner executes them and feeds results back to the model.
5. The final reply is saved to the session and sent back through the channel.
That flow is the same whether the message starts in the CLI, WebUI, Telegram, Discord, or another channel.
## CLI, Gateway, API, and WebUI
| Entry point | Command | Use it for |
|---|---|---|
| One-shot CLI | `nanobot agent -m "..."` | Quick checks, scripts, and troubleshooting |
| Interactive CLI / TUI | `nanobot` (or `nanobot agent`) | Terminal chat with saved session history |
| WebUI | `nanobot webui` | Everyday browser workbench (starts the gateway automatically) |
| Gateway | `nanobot gateway` | Headless servers, chat apps, and background automations |
| CLI one-shot | `nanobot agent -m "..."` | First-run checks, scripts, and quick local questions |
| CLI interactive | `nanobot agent` | Terminal chat with persistent session history |
| Gateway | `nanobot gateway` | Chat apps, WebUI, heartbeat, Dream, and long-running service mode |
| OpenAI-compatible API | `nanobot serve` | Programmatic access through `/v1/chat/completions` |
| WebUI | `nanobot webui` | Prepare the local WebUI, start the gateway, and open the browser workbench |
The WebUI runs on port `8765` by default (`http://127.0.0.1:8765`). The gateway health check runs on port `18790` (`http://127.0.0.1:18790/health`).
The WebUI launcher is the normal browser entry point. Underneath, the gateway keeps the WebSocket channel and other long-running services alive. The gateway health endpoint is on `gateway.port` (`18790` by default); the browser WebUI is served on `8765` by default, not by the health endpoint.
## Providers and Model Presets
## Provider and Model Selection
Configure your providers and models in **Settings → Models**, then pick a preset from the chat composer.
The active model should normally come from a named `modelPresets` entry selected by `agents.defaults.modelPreset`. Direct `agents.defaults.provider` and `agents.defaults.model` still form the implicit `default` preset for older or minimal configs. The active provider is resolved in this order:
A **model preset** pairs a provider with a model ID (and optional settings). Pinning the provider explicitly inside each preset is the easiest way to avoid setup mistakes. OAuth providers (such as OpenAI Codex, xAI Grok, and GitHub Copilot) require signing in first and selecting that provider in your preset.
1. If the active preset provider or implicit default provider is not `"auto"`, nanobot uses that provider.
2. If provider is `"auto"`, nanobot tries to infer the provider from the model name, configured API keys, local provider base URLs, or gateway providers.
3. OAuth providers such as OpenAI Codex and GitHub Copilot require explicit login and explicit provider/model selection inside the active preset.
<details>
<summary>Manual configuration example</summary>
Pin the provider inside the preset when setting up for the first time. It is easier to debug:
```json
{
@@ -87,70 +112,99 @@ A **model preset** pairs a provider with a model ID (and optional settings). Pin
}
```
</details>
See [`providers.md`](./providers.md) for practical examples and [`configuration.md#providers`](./configuration.md#providers) for the full provider reference.
See [Providers and Models](./providers.md) and the [Provider Cookbook](./provider-cookbook.md) for provider-specific setup.
## Channels and Sessions
## Sessions, Memory, and Dream
Each channel maps inbound messages to a session key. That lets independent conversations keep separate history. The WebUI also supports multiple chats and workspace-scoped metadata for project workspaces.
nanobot separates short-term chat history from long-term memory:
`agents.defaults.unifiedSession` can intentionally share one session across channels for a single-user multi-device setup. Leave it off if you expect separate people, groups, channels, or projects to keep separate context.
- **Sessions** keep the messages of each conversation. By default, each WebUI topic and each chat-app thread has its own session.
- **Long-term memory** lives in your agent workspace (`SOUL.md`, `USER.md`, `memory/MEMORY.md`, and optional `memory/wiki/` pages).
- **Dream** is a periodic background job that reviews summarized conversations and updates your long-term memory so important preferences and facts carry across topics.
## Memory, Sessions, and Dream
See [Memory](./memory.md) for how memory works and how to inspect or restore it.
nanobot uses two related stores:
## Apps, Plugins, and Skills
| Store | Location | Purpose |
|---|---|---|
| Sessions | `<config-dir>/sessions/<workspace-id>/*.jsonl` | Recent conversation turns replayed into context |
| Memory | `<workspace>/memory/MEMORY.md` and `<workspace>/memory/history.jsonl` | Long-term facts and consolidated history |
You can extend nanobot from the **Apps** and **Skills** pages in the WebUI:
Dream is a periodic consolidation job. It reads accumulated history and updates workspace memory so useful context can survive beyond short session replay.
| Concept | What it does |
The configured workspace contains a `.nanobot/workspace-id` file. It contains only an
opaque random identifier—never conversation content or credentials. Keep it with workspace
backups: it lets nanobot find the same external session namespace after the workspace is
renamed, moved, or restored. A live copy opened alongside the original receives a new ID so
the two workspaces do not share conversations accidentally.
See [`memory.md`](./memory.md) for the detailed design.
## Apps and Agent Plugins
Agent Plugins are nanobot's common package and activation boundary for
installable capabilities. They organize existing extension types instead of
replacing them:
| Part | Role |
|---|---|
| Agent Plugin | An installable package that bundles skills, MCP servers, or both |
| Skill | Reusable instructions loaded when relevant or invoked with `$skill-name` |
| MCP server | External tools exposed to the agent over Model Context Protocol |
| CLI App | A local command-line tool adapter managed from **Apps** |
| Agent Plugin | Installable package that can bundle skills, MCP servers, or both |
| Skill | Workflow guidance loaded progressively or invoked with `$skill-name` |
| MCP server | Runtime tools exposed to the agent |
| CLI App | Locally managed executable whose adapter is packaged and activated like a plugin |
| Apps | WebUI surface for reviewing and managing these capabilities |
See [WebUI Apps](./webui.md#apps) and [Skills](./webui.md#skills) to manage them.
Native providers, channels, built-in tools, standalone workspace skills, and
directly configured MCP servers keep their existing extension paths. See
[`webui.md#apps`](./webui.md#apps) for the user-facing flow and
[`configuration.md#agent-plugins-v1`](./configuration.md#agent-plugins-v1) for
the package contract.
## Tools and Safety
nanobot includes built-in tools for files, shell commands, web search/fetch, image generation, automations, and subagents, plus any tools added through **Apps**.
Tools are discovered automatically from built-in modules and plugin entry points. Common tool groups include:
- In the WebUI, use **Restricted** mode to keep file and shell work inside the selected workspace.
- For chat apps, use pairing or `allowFrom` allowlists so only people you approve can talk to your bot.
- For tighter restrictions, sandboxing, and network rules, see [Configuration: Security](./configuration.md#security).
- file read/write/edit and patching;
- shell execution with configurable sandboxing;
- web search and web fetch with SSRF checks;
- MCP servers;
- cron reminders, local triggers, and heartbeat tasks;
- image generation;
- subagents and runtime self-inspection.
## Subagents
Security-sensitive controls live in [`configuration.md#security`](./configuration.md#security). For production or shared chat apps, also configure channel access controls such as `allowFrom`, pairing, or WebSocket tokens.
nanobot can delegate parts of a complex request to subagents while staying responsible for your final answer. Inside the same conversation, you can ask it to check progress, send follow-up instructions, wait for results, or cancel a specific subtask.
## Background Jobs
- Background subtasks report back to the conversation that started them.
- `/stop` stops the current session and its subagents without affecting other sessions (it does not undo file changes already made).
- Subagents belong to their parent conversation: deleting that conversation stops and removes them, and forking does not copy them.
- If the gateway restarts while a subtask is running, unfinished subtasks are marked interrupted with any partial results saved; ask nanobot to start a new task if you want to continue.
- Subagents are not available in WebUI temporary chats.
When `nanobot gateway` starts, it runs workspace-scoped automations and
registers system jobs:
See [Delegated work](./webui.md#delegated-work) for viewing subtasks in the WebUI.
- `dream`, when `agents.defaults.dream.enabled` is true;
- `heartbeat`, when `gateway.heartbeat.enabled` is true.
## Automations and Background Jobs
Heartbeat reads `<workspace>/HEARTBEAT.md`. If the file has tasks under `## Active Tasks`, nanobot executes them and sends only useful/actionable results to the most recently active chat target. Routine "nothing changed" results are suppressed.
While the gateway is running, nanobot can act on its own in three ways:
User-created reminders use the same cron service but are not the same as the
protected heartbeat system job. They run as scheduled turns in their origin
chat/session and normally deliver the result back to that channel.
- **Scheduled automations:** Tasks you ask nanobot to run at a specific time or on a schedule, replying back in the same chat.
- **Local triggers:** Created with `/trigger <name>` so a local script or webhook can wake nanobot in that chat with `nanobot trigger <id> "<message>"`.
- **Heartbeat:** A quiet periodic check driven by `<workspace>/HEARTBEAT.md` that only messages you when something needs attention.
See [Automations](./automations.md) for the full guide.
Local triggers are also session-bound, but they do not have their own
schedule. Create one from the target chat with `/trigger <name>`, then call
`nanobot trigger <id> "<message>"` when a local script or external service wants
nanobot to respond in that session. Webhook servers, third-party auth, and
event-to-message formatting stay outside nanobot. Trigger deliveries are stored
in the workspace until the linked agent turn finishes successfully. If the
target session is busy, the trigger waits until that session is idle instead of
being injected into the active turn. The message is recorded as an automation
turn in that session. Delivery is at-least-once, so external systems should
tolerate repeated trigger messages; a delivery that reaches the agent but fails
is marked failed rather than retried forever.
## Where to Go Next
| Need | Read |
|---|---|
| First working install | [Install and Quick Start](./quick-start.md) |
| Browser workbench | [WebUI](./webui.md) |
| Provider and model setup | [Providers and Models](./providers.md) |
| Chat app setup | [Chat Apps](./chat-apps.md) |
| Complete config reference | [Configuration](./configuration.md) |
| Runtime debugging | [Troubleshooting](./troubleshooting.md) |
| First working install | [`quick-start.md`](./quick-start.md) |
| Provider/model setup | [`providers.md`](./providers.md) |
| Chat app setup | [`chat-apps.md`](./chat-apps.md) |
| Complete config reference | [`configuration.md`](./configuration.md) |
| Runtime debugging | [`troubleshooting.md`](./troubleshooting.md) |
+288 -580
View File
File diff suppressed because it is too large. Load diff
+229 -96
View File
@@ -1,105 +1,100 @@
# Deployment
Use this page to keep nanobot running reliably in the background—on a hosted platform, in Docker, or as a Linux/macOS system service.
Use this page after `nanobot agent -m "Hello!"` works locally. Deployment keeps long-running surfaces online: WebUI, chat apps, heartbeat, Dream, cron jobs, and channel connections.
## Before You Deploy
Confirm these basics first (for a new container host, check them inside the container after setup):
Check these once before Render, Docker, systemd, or LaunchAgent:
- **Local setup works:** `nanobot status` shows the right config and workspace, and `nanobot agent -m "Hello!"` returns a reply.
- **Secrets are protected:** Keep API keys, bot tokens, and WebUI passwords in environment variables or private config files.
- **Data persists:** Keep your config directory (including `sessions/`) and workspace on persistent storage.
- **Access is locked down:** Configure pairing, `allowFrom`, or a WebUI password (`tokenIssueSecret`) before exposing nanobot beyond localhost.
- **Restart after edits:** Long-running services read `config.json` at startup—restart the service after config changes.
| Check | Why it matters |
|---|---|
| `nanobot status` shows the expected config and workspace | Confirms the process will read the instance you meant to run |
| `nanobot agent -m "Hello!"` works | Proves install, config, provider, model, and workspace writes before adding a service layer |
| Secrets are in environment variables or protected config files | API keys, bot tokens, OAuth state, and chat credentials should not be world-readable |
| The active config directory (including `sessions/`) and workspace are persistent | Sessions follow `--config`; memory, generated artifacts, and the workspace identity marker follow the workspace |
| Channel access control is intentional | Use `allowFrom`, pairing, WebSocket `token`/`tokenIssueSecret`, or private test channels before exposing the bot |
| Ports are planned | Gateway health defaults to local-only `127.0.0.1:18790`; WebUI/WebSocket defaults to `8765`; `nanobot serve` defaults to `8900` |
| Logs are easy to reach | Use `docker compose logs`, `journalctl`, LaunchAgent log files, or `nanobot gateway --verbose` while diagnosing startup |
## Choose a Deployment Option
Restart the deployed process after editing `config.json`. Long-running processes read config at startup.
| Option | Best for | Where data lives |
|---|---|---|
| [Render](#render) | One-click hosted gateway + WebUI without managing a server | Render persistent disk (`/home/nanobot/.nanobot`) |
| [Docker Compose](#docker-compose) | Linux servers and repeatable container deployments | Bind mount `~/.nanobot` → `/home/nanobot/.nanobot` |
| [Linux Service](#linux-service) | Always-on gateway on a Linux machine (systemd) | Host `~/.nanobot` |
| [macOS LaunchAgent](#macos-launchagent) | Always-on gateway after login on a Mac | Host `~/.nanobot` |
## Choose a Runtime
| Runtime | Use it for | State location | Useful first command |
|---|---|---|---|
| Render | One-click hosted gateway and WebUI | Persistent disk at `/home/nanobot/.nanobot` | [Deploy to Render](#render) |
| Docker Compose | Repeatable container runs on Linux servers or workstations | Bind-mount `~/.nanobot` to `/home/nanobot/.nanobot` | `docker compose run --rm nanobot-cli agent -m "Hello!"` |
| Docker CLI | Manual container testing or small one-off hosts | Bind-mount `~/.nanobot` to `/home/nanobot/.nanobot` | `docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot status` |
| systemd user service | Linux user-level gateway that restarts automatically | Host user's `~/.nanobot` unless you pass explicit paths | `systemctl --user status nanobot-gateway` |
| macOS LaunchAgent | macOS gateway that starts after login | Host user's `~/.nanobot` unless the plist passes explicit paths | `launchctl list | grep ai.nanobot.gateway` |
## Render
Deploy the gateway and bundled WebUI together on Render with a persistent disk so your config, sessions, memory, and automations survive restarts.
Run nanobot online without managing a server. The blueprint deploys the gateway and bundled WebUI together, with a persistent disk so sessions, memory, and chat history survive restarts.
> [!IMPORTANT]
> Requires a paid Render Starter plan because persistent disks are not available on the free tier. Have your `ANTHROPIC_API_KEY` ready, and generate a strong private password for `NANOBOT_WEB_TOKEN` (for example with `openssl rand -hex 32`).
> This setup requires a paid Render service because persistent disks are not available on the free tier. During setup, provide `ANTHROPIC_API_KEY` and set `NANOBOT_WEB_TOKEN` to a strong private password (for example, generate one with `openssl rand -hex 32`).
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/HKUDS/nanobot) · [Review blueprint](../render.yaml)
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/HKUDS/nanobot)
1. Click **Deploy to Render**, sign in, and review the blueprint (one Starter web service + 1 GB persistent disk).
2. Enter your `ANTHROPIC_API_KEY` and set `NANOBOT_WEB_TOKEN` to a strong random password (save it in your password manager).
3. Create the blueprint and wait for the status to reach **Live** (the first build takes a few minutes).
4. Open your `onrender.com` URL and sign in with `NANOBOT_WEB_TOKEN`.
[Review the deployment blueprint](../render.yaml)
Automatic deploys are disabled by default so upstream changes do not unexpectedly restart your bot. To update later, open the Render Dashboard and click **Manual Deploy → Deploy latest commit**.
### First Deployment
## Docker Compose
1. Click **Deploy to Render**, sign in, and review the Blueprint. It creates one Starter web service and a 1 GB persistent disk.
2. Enter your `ANTHROPIC_API_KEY`. Set `NANOBOT_WEB_TOKEN` to a new random value and save it in your password manager; this is the password for the public WebUI.
3. Create the Blueprint and wait for the service status to become **Live**. The first build can take several minutes.
4. Open the generated `onrender.com` URL. The **Authentication required** page means the gateway is running: enter the same `NANOBOT_WEB_TOKEN` value to open the WebUI.
On a Linux host with Git and Docker Compose installed (no host Python required):
The model API key is used by nanobot to call Anthropic. The Web token only protects access to this deployment; do not share it in issues, screenshots, or chat.
```bash
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
docker compose up -d
docker compose logs
```
### Updates and Data
On first boot, Compose creates `~/.nanobot/config.json` with container network settings and a random WebUI password printed in the logs. Open `http://<your-host>:8765`, enter that password, and configure your provider and model in **Settings → Models**.
The Blueprint disables automatic deploys so upstream repository changes do not unexpectedly restart your agent. To update, open the service in the Render Dashboard and choose **Manual Deploy → Deploy latest commit**.
- **Set your own password:** Export `NANOBOT_WEB_TOKEN="your-secret"` before running `docker compose up -d` for the first time.
- **Common commands:**
The persistent disk keeps `config.json`, sessions, memory, WebUI history, cron state, media, and logs across restarts and updates. The deployment initializes `config.json` only when it does not already exist, so settings changed later in the WebUI are not replaced on every boot.
```bash
docker compose run --rm nanobot-cli agent -m "Hello!" # test CLI
docker compose logs -f nanobot-gateway # follow logs
curl --fail http://127.0.0.1:18790/health # health check
docker compose down # stop
```
If deployment fails, open the service **Logs** page first. A missing model key fails provider requests after startup, while an incorrect Web token leaves you on the authentication page.
- **Preinstall chat channels into the image** (recommended when the container has slow or no PyPI access):
## Docker
```bash
NANOBOT_CHANNELS=telegram,slack docker compose build
```
> [!TIP]
> The `-v ~/.nanobot:/home/nanobot/.nanobot` flag mounts your local config directory into the container, so your config and workspace persist across container restarts.
> The container runs as the non-root user `nanobot` (UID 1000) and reads config from `/home/nanobot/.nanobot`. Always mount your host config directory to `/home/nanobot/.nanobot`, not `/root/.nanobot`.
> If you get **Permission denied**, fix ownership on the host first: `sudo chown -R 1000:1000 ~/.nanobot`, or pass `--user $(id -u):$(id -g)` to match your host UID. Podman users can use `--userns=keep-id` instead.
>
> [!IMPORTANT]
> Official Docker usage currently means building from this repository with the included `Dockerfile`. Docker Hub images under third-party namespaces are not maintained or verified by HKUDS/nanobot; do not mount API keys or bot tokens into them unless you trust the publisher.
- **Remote access tip:** For a remote server, either restrict port `8765` with a firewall or connect over an SSH tunnel (`ssh -L 8765:127.0.0.1:8765 user@HOST`) and open `http://127.0.0.1:8765` locally.
> [!IMPORTANT]
> The gateway and WebSocket channel default to `host: "127.0.0.1"` in `config.json` (set in `nanobot/config/schema.py`). Docker `-p` port forwarding cannot reach a container's loopback interface, so for the host or LAN to reach the exposed ports you must set both binds to `0.0.0.0` in `~/.nanobot/config.json` before starting the container. To serve the bundled WebUI from Docker, bind the WebSocket channel externally and protect bootstrap with `tokenIssueSecret`:
>
> ```json
> {
> "gateway": { "host": "0.0.0.0" },
> "channels": {
> "websocket": {
> "host": "0.0.0.0",
> "port": 8765,
> "tokenIssueSecret": "your-secret-here"
> }
> }
> }
> ```
>
> When the WebSocket `host` is `0.0.0.0`, the channel refuses to start unless `token`, `tokenIssueSecret`, or a fully configured `trustedProxyAuth` is also configured. See [`webui.md#lan-access`](./webui.md#lan-access) for details.
> The gateway health route itself is intentionally minimal and unauthenticated. When the
> container binds it to `0.0.0.0`, publish port `18790` to host loopback only; place any
> remotely monitored health endpoint behind a firewall or reverse proxy. If another host
> must probe it directly, replace `127.0.0.1` in the port mapping with a trusted host
> interface and restrict inbound traffic to the monitoring system.
<details>
<summary>Reusing an existing config, permissions, manual Docker CLI, and bwrap sandbox</summary>
### Cloudflare Tunnel + Cloudflare Access
- **Reusing an existing `config.json`:** Docker port forwarding cannot reach `127.0.0.1` inside a container. Set both `gateway.host` and `channels.websocket.host` to `"0.0.0.0"` and configure `channels.websocket.tokenIssueSecret` (see [LAN Access](./webui.md#lan-access)). Keep port `18790` (health check) bound to `127.0.0.1` on the host.
- **File permissions:** The container runs as UID `1000` (`nanobot`) and mounts `~/.nanobot` to `/home/nanobot/.nanobot`. If you see **Permission denied**, run `sudo chown -R 1000:1000 ~/.nanobot` on the host (or pass `--user $(id -u):$(id -g)` / Podman `--userns=keep-id`).
- **Official image note:** Build from this repository's `Dockerfile`; third-party images on Docker Hub are not maintained by HKUDS/nanobot.
- **Linux `bwrap` shell sandbox:** If you enable `"tools.exec.sandbox": "bwrap"`, start Compose with the bwrap override file so bubblewrap can create nested namespaces (requires host unprivileged user namespaces):
```bash
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml up -d nanobot-gateway
```
- **Manual Docker CLI:**
```bash
docker build -t nanobot .
docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot onboard
docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot agent -m "Hello!"
docker run \
--cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID \
--security-opt no-new-privileges:true \
-v ~/.nanobot:/home/nanobot/.nanobot \
-p 127.0.0.1:18790:18790 -p 8765:8765 \
nanobot gateway
```
</details>
<details>
<summary>Cloudflare Tunnel + Cloudflare Access</summary>
If you place a local `cloudflared` tunnel with Cloudflare Access in front of nanobot, you can let Cloudflare Access handle browser authentication instead of a WebUI password:
For a local `cloudflared` process in front of nanobot, Cloudflare Access can
authenticate the user before forwarding the request and add
`Cf-Access-Jwt-Assertion`. Opt in to trusted-proxy no-token mode only when the
direct TCP peer is the tunnel process and the assertion is non-empty:
```json
{
@@ -118,27 +113,136 @@ If you place a local `cloudflared` tunnel with Cloudflare Access in front of nan
}
```
nanobot requires both a direct loopback connection and a non-empty `Cf-Access-Jwt-Assertion` header (standard proxy headers like `X-Forwarded-*` are rejected). Because nanobot trusts the tunnel rather than cryptographically validating the JWT, never expose port `8765` directly to untrusted networks.
This is two-part authorization: a trusted direct loopback peer **and** a
non-empty Cloudflare Access assertion. A trusted CIDR alone is not a bypass.
For this flow `/webui/bootstrap` returns connection metadata without a
bootstrap token or REST API token; the proxy assertion authorizes the WebSocket
handshake and REST requests directly.
</details>
Set `publicWsUrl` to the browser-facing `wss://` endpoint when the tunnel sends
the origin host header (such as `127.0.0.1:8765`); otherwise the WebUI could
attempt to open its WebSocket directly against the loopback address.
The assertion header must be generated
by Cloudflare Access after authentication; routing/client metadata headers such
as `Host`, `Forwarded`, `X-Forwarded-*`, `X-Real-IP`, and `CF-Connecting-IP`
are rejected as `assertionHeader` values. Nanobot trusts the assertion but does
not cryptographically validate the JWT, so configure the tunnel and Access
policy carefully and do not expose the nanobot listener directly to untrusted
clients. Forwarded client headers do not establish proxy trust.
## Switch an Existing Gateway to a Service
### Docker Compose
Before installing a Linux or macOS service, stop any manually running gateway so the ports do not conflict:
The default image preinstalls WhatsApp dependencies. To bake other enabled
channels into an image (recommended for deployments without PyPI access), pass
a comma-separated `NANOBOT_CHANNELS` build argument:
- Close WebUI/TUI windows that might restart the gateway.
- Run `nanobot gateway stop` (or press `Ctrl+C` in a foreground terminal). Pass the same `--config` and `--workspace` if you use a custom instance.
```bash
NANOBOT_CHANNELS=telegram,slack docker compose build
```
The image keeps nanobot in a virtual environment owned by its built-in non-root
runtime user (UID 1000). If an enabled channel was not preinstalled, gateway
startup can therefore install its manifest-declared dependencies. Rebuilding
with `NANOBOT_CHANNELS` keeps that installation reproducible instead of relying
on the container's writable layer. If you override the container with a
different `--user`, bake every enabled channel into the image because that UID
is not guaranteed write access to the virtual environment.
```bash
docker compose run --rm nanobot-cli onboard # first-time setup
vim ~/.nanobot/config.json # add API keys
docker compose up -d nanobot-gateway # start gateway
```
```bash
docker compose run --rm nanobot-cli agent -m "Hello!" # run CLI
docker compose logs -f nanobot-gateway # view logs
docker compose down # stop
```
The default Compose file drops all Linux capabilities except `CHOWN`, `SETUID`, and
`SETGID`, which the root entrypoint needs to fix bind-mount ownership and become UID
1000. It also enables `no-new-privileges`, so the non-root process cannot regain those
bootstrap capabilities through setuid binaries or file capabilities. Docker's default
AppArmor/seccomp profiles remain enabled. If you explicitly set
`"tools.exec.sandbox": "bwrap"` in `~/.nanobot/config.json`, add the bwrap
override file when starting containers:
```bash
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml up -d nanobot-gateway
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml run --rm nanobot-cli agent -m "Hello!"
```
The override adds `CAP_SYS_ADMIN` and disables AppArmor/seccomp confinement for the
container so bubblewrap can create its nested namespaces. It preserves
`no-new-privileges`. The host must also allow unprivileged user namespaces; the
override cannot bypass a host-level namespace restriction. Use it only when the
bwrap sandbox is enabled.
### Docker
```bash
# Build the image
docker build -t nanobot .
# Or preinstall a regular Python extra such as Bedrock support
docker build --build-arg NANOBOT_EXTRAS=bedrock -t nanobot .
# Or preinstall dependencies for a specific set of channels
docker build --build-arg NANOBOT_CHANNELS=telegram,slack -t nanobot .
# Initialize config (first time only)
docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot onboard
# Edit config on host to add API keys
vim ~/.nanobot/config.json
# Run gateway (connects to enabled channels, e.g. Telegram/Discord/Mochat).
# `-p 8765:8765` exposes the WebSocket channel / WebUI alongside the gateway
# health endpoint on 18790.
docker run \
--cap-drop ALL \
--cap-add CHOWN --cap-add SETGID --cap-add SETUID \
--security-opt no-new-privileges:true \
-v ~/.nanobot:/home/nanobot/.nanobot \
-p 18790:18790 -p 8765:8765 \
nanobot gateway
# If `tools.exec.sandbox: "bwrap"` is enabled, run with the extra permissions
# bubblewrap needs for nested namespaces. Without them, `bwrap` may exit with
# `clone3: Operation not permitted`.
docker run \
--cap-drop ALL \
--cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add SYS_ADMIN \
--security-opt no-new-privileges:true \
--security-opt apparmor=unconfined \
--security-opt seccomp=unconfined \
-v ~/.nanobot:/home/nanobot/.nanobot \
-p 127.0.0.1:18790:18790 -p 8765:8765 \
nanobot gateway
# Or run a single command
docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot agent -m "Hello!"
docker run -v ~/.nanobot:/home/nanobot/.nanobot --rm nanobot status
```
## Linux Service
Run the gateway as a `systemd` user service so it starts automatically and restarts on failure:
Run the gateway as a systemd user service so it starts automatically and restarts on failure.
Preview the generated unit first:
```bash
nanobot gateway install-service --manager systemd --dry-run # preview
nanobot gateway install-service --manager systemd # install & start
nanobot gateway install-service --manager systemd --dry-run
```
For a custom instance, pass `--name`, `--config`, and `--workspace`:
Install, enable, and start it:
```bash
nanobot gateway install-service --manager systemd
```
For a custom instance, pass the same config/workspace selector you use to run the gateway:
```bash
nanobot gateway install-service \
@@ -148,28 +252,53 @@ nanobot gateway install-service \
--workspace ~/.nanobot-telegram/workspace
```
Common commands:
Common operations:
```bash
systemctl --user status nanobot-gateway
systemctl --user restart nanobot-gateway
journalctl --user -u nanobot-gateway -f
systemctl --user status nanobot-gateway # check status
systemctl --user restart nanobot-gateway # restart after config changes
journalctl --user -u nanobot-gateway -f # follow logs
nanobot gateway uninstall-service --manager systemd
```
> [!TIP]
> To keep a user service running after you log out of Linux, enable lingering: `loginctl enable-linger $USER`.
The installer writes `~/.config/systemd/user/nanobot-gateway.service`, runs
`systemctl --user daemon-reload`, enables the unit, and restarts it. It uses the
current Python executable with `python -m nanobot gateway --foreground`, so the
service runs in the same environment you used to install nanobot.
> **Note:** User services only run while you are logged in. To keep the gateway running after logout, enable lingering:
>
> ```bash
> loginctl enable-linger $USER
> ```
## macOS LaunchAgent
Run the gateway automatically after you log in on macOS without keeping a terminal open:
Use a LaunchAgent when you want `nanobot gateway` to stay online after you log in, without keeping a terminal open.
Preview the generated plist first:
```bash
nanobot gateway install-service --manager launchd --dry-run # preview
nanobot gateway install-service --manager launchd # install & start
nanobot gateway install-service --manager launchd --dry-run
```
Common commands:
Install, load, enable, and start it:
```bash
nanobot gateway install-service --manager launchd
```
For a custom instance:
```bash
nanobot gateway install-service \
--manager launchd \
--name nanobot-telegram \
--config ~/.nanobot-telegram/config.json \
--workspace ~/.nanobot-telegram/workspace
```
Common operations:
```bash
launchctl list | grep ai.nanobot.gateway
@@ -177,4 +306,8 @@ launchctl kickstart -k gui/$(id -u)/ai.nanobot.gateway
nanobot gateway uninstall-service --manager launchd
```
Logs are written under `~/.nanobot/logs/`. If startup fails with "address already in use", stop any manually started gateway first.
The installer writes `~/Library/LaunchAgents/ai.nanobot.gateway.plist`, uses the
current Python executable with `python -m nanobot gateway --foreground`, and
writes LaunchAgent logs under `~/.nanobot/logs/`.
> **Note:** if startup fails with "address already in use", stop the manually started `nanobot gateway` process first.
-35
View File
@@ -2,8 +2,6 @@
This page collects contributor-facing notes for extending nanobot. User-facing setup and runtime options live in [`configuration.md`](./configuration.md).
For source and test entry points by task, start with the [development navigation](../.agent/navigation.md). For browser interface changes, use the [WebUI change map](../webui/README.md#change-a-behavior). For Python setup and contribution checks, see [CONTRIBUTING.md](../CONTRIBUTING.md). The sections below cover provider extensions.
## Adding an LLM Provider
nanobot uses the provider registry in `nanobot/providers/registry.py` as the source of truth for LLM provider metadata. Most OpenAI-compatible providers need only two changes.
@@ -15,7 +13,6 @@ ProviderSpec(
name="myprovider",
keywords=("myprovider", "mymodel"),
env_key="MYPROVIDER_API_KEY",
request_apis=("chat_completions", "responses"),
display_name="My Provider",
default_api_base="https://api.myprovider.com/v1",
)
@@ -31,8 +28,6 @@ class ProvidersConfig(BaseModel):
Environment variables, config matching, provider status, and WebUI credential display derive from those two entries.
Every `ProviderSpec` must declare `request_apis`. This lists request formats implemented by the adapter; endpoint and model support are configured separately through connection and preset API declarations. Use `anthropic_messages` for native Anthropic adapters, `bedrock_converse` for Bedrock, and `transcription` for transcription-only providers.
Useful `ProviderSpec` options:
| Field | Description |
@@ -45,37 +40,8 @@ Useful `ProviderSpec` options:
| `detect_by_base_keyword` | Match configured gateways by API base URL. |
| `strip_model_prefix` | Strip `provider/` before sending the model to the upstream API. |
| `supports_max_completion_tokens` | Use `max_completion_tokens` instead of `max_tokens`. |
| `responses` | `ResponsesCapabilities` with automatic model rules, reasoning replay, and fallback policy. |
| `is_transcription_only` | Provider has credentials but cannot serve chat completions. |
### Request API routing
`resolve_provider_route` in `nanobot/providers/routing.py` validates connection and preset declarations and selects the adapter. Built-in OpenAI connection declarations set an overridable default; custom connection declarations also limit the preset's allowed APIs.
`ProviderSpec.default_model_api` resolves automatic model rules from the registry. Copilot uses the account's last successfully discovered `supported_endpoints` when available. The WebUI preview calls `resolve_automatic_model_api` without probing endpoints or consulting circuit-breaker state; it reports a preference, not a guarantee of remote support.
Custom presets selecting `anthropic_messages` use the Anthropic adapter for history, tools, thinking, and streaming. They retain the connection's credentials, base URL, headers, query parameters, body additions, proxy, and model-prefix rules. Reasoning replay and native compaction remain provider-owned; a Responses declaration alone does not enable OpenAI-native compaction on a custom gateway.
### Python API migration
Provider integrations must supply `ProviderSpec.request_apis`. Replace the former `responses_models` argument with `responses=ResponsesCapabilities(models=(...))`. Use `models` for rules shared by an endpoint and its proxies. For a rule tied to a specific endpoint, use `endpoint_models`:
```python
ResponsesCapabilities(
endpoint_models=(("https://api.myprovider.com/v1", ("mymodel",)),),
)
```
Endpoint rules compare the URL origin and path, treating an optional trailing `/v1` as equivalent. Explicit preset API declarations override automatic rules.
Replace `OpenAICompatProvider(api_type=...)` with `OpenAICompatProvider(model_api=...)`. Omitting `model_api` preserves automatic selection. To require Responses, pass:
```python
ModelAPICapabilities(supported_apis=("responses",), preferred_api="responses")
```
API types and automatic selection rules are defined in `nanobot.providers.model_api`. The registry owns `ProviderSpec`, model metadata, and provider declarations; it also re-exports the API types. JSON configuration and Settings inputs use the `api` object; the old `apiType` field no longer selects a request API.
## Adding a Transcription Provider
Transcription is intentionally split into two layers:
@@ -102,7 +68,6 @@ ProviderSpec(
name="my_stt",
keywords=("my_stt",),
env_key="MY_STT_API_KEY",
request_apis=("transcription",),
display_name="My STT",
default_api_base="https://api.example.com/v1",
is_transcription_only=True,
+2 -6
View File
@@ -2,8 +2,6 @@
Start with [Install and Quick Start](../quick-start.md) and get one reply before using a guide below. Each guide targets one outcome; linked reference pages hold the complete option tables and edge cases.
You can ask nanobot to guide your next task using the built-in `nanobot-document` skill, or read a guide yourself. See [Continue with nanobot](../quick-start.md#continue-with-nanobot) for availability and examples. Each task guide describes its starting requirements, setup steps, and how to check the result; use the parts that match your current instance.
## Start and Use
| Goal | Guide |
@@ -11,13 +9,12 @@ You can ask nanobot to guide your next task using the built-in `nanobot-document
| Build a personal AI agent | [Build a personal AI agent](./build-a-personal-ai-agent.md) |
| Use the browser workbench | [AI agent WebUI](./ai-agent-webui.md) |
| Run a self-hosted AI agent | [Self-hosted AI agent](./self-hosted-ai-agent.md) |
| Connect to a remote nanobot from your local WebUI | [Connect to an existing remote nanobot](./remote-instances.md) |
| Run a sustained goal | [Long-running AI agent](./long-running-ai-agent.md) |
| Add long-term memory | [AI agent memory](./ai-agent-memory.md) |
## Connect a Chat App
Use **Channels** in the WebUI for guided setup. These guides explain the account, bot, token, permission, and test-message steps on each platform.
Use **Settings → Channels** in the WebUI for guided setup. These guides explain the account, bot, token, permission, and test-message steps on each platform.
| Goal | Guide |
|---|---|
@@ -27,18 +24,17 @@ Use **Channels** in the WebUI for guided setup. These guides explain the account
| Connect Slack | [Slack AI agent](./slack-ai-agent.md) |
| Connect Feishu | [Feishu AI agent](./feishu-ai-agent.md) |
| Connect WhatsApp | [WhatsApp AI agent](./whatsapp-ai-agent.md) |
| Connect through WhatsApp Agent Platform | [WhatsApp Agent Platform](./whatsapp-agent-platform.md) |
| Connect WeChat | [WeChat AI agent](./wechat-ai-agent.md) |
| Connect QQ | [QQ AI agent](./qq-ai-agent.md) |
| Connect Email | [Email AI agent](./email-ai-agent.md) |
| Connect Mattermost | [Mattermost AI agent](./mattermost-ai-agent.md) |
| Connect Linear | [Native Linear agent](./linear-agent.md) |
## Integrate from Code
| Goal | Guide |
|---|---|
| Run from Python | [Python AI agent SDK](./python-ai-agent-sdk.md) |
| Expose `/v1/chat/completions` | [OpenAI-compatible agent API](./openai-compatible-agent-api.md) |
## Configure and Operate
+28 -16
View File
@@ -1,6 +1,8 @@
# How AI Agent Memory Works in nanobot
This guide explains how to use nanobot's long-term AI agent memory: session history, compressed archives, durable memory files, Dream consolidation, and Git-backed memory changes.
This guide explains how to use nanobot's long-term AI agent memory: session
history, compressed archives, durable memory files, Dream consolidation, and
Git-backed memory changes.
## What you will build
@@ -11,31 +13,39 @@ This guide explains how to use nanobot's long-term AI agent memory: session hist
## When to use this
Use memory when an agent should remember stable preferences, project facts, decisions, and recurring context across sessions. Do not use memory as a dumping ground for every raw transcript; nanobot separates short-term messages from curated durable knowledge.
Use memory when an agent should remember stable preferences, project facts,
decisions, and recurring context across sessions. Do not use memory as a dumping
ground for every raw transcript; nanobot separates short-term messages from
curated durable knowledge.
## Before you start
## Install
Use an installation with a configured model that has already returned a reply. If this is your first setup, follow [Quick Start](../quick-start.md), then return here. Existing WebUI users can continue in the current instance.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
## Minimal working example
In a chat with write access to the agent workspace, say “Remember that for Acme release notes I prefer concise bullet points.” Ask which memory file the agent updated, then check the saved preference in a new chat.
To curate recent conversations with Dream instead, send these commands one at a time, waiting for each to finish:
Ask the agent to remember a stable fact in a normal session, then run Dream:
```text
/compact
/dream
```
Inspect recent memory changes:
```text
/dream-log
```
Compaction puts recent conversation into the archive Dream reads. Inspect the changes to see what Dream saved. For corrections and restoration, follow [Save and Check a Preference](../memory.md#save-and-check-a-preference).
The files live in the configured agent workspace, normally `~/.nanobot/workspace/`. Selecting a project or starting a new topic does not move or isolate this memory.
The exact files live in the active workspace, usually under
`~/.nanobot/workspace/`.
## Production notes
- Use separate configured instances when projects or clients need separate memory.
- Use one workspace per project or personal context.
- Keep durable facts concise; old session details belong in `history.jsonl`.
- Use `/dream-prompt init` when a workspace needs custom memory guidance.
- Review Git-backed memory changes when memory affects important workflows.
@@ -43,14 +53,16 @@ The files live in the configured agent workspace, normally `~/.nanobot/workspace
## Security notes
- Memory files may contain sensitive user or project facts.
- Avoid sharing workspaces without reviewing `SOUL.md`, `USER.md`, and `memory/MEMORY.md`.
- Avoid sharing workspaces without reviewing `SOUL.md`, `USER.md`, and
`memory/MEMORY.md`.
- Use separate workspaces for personal and team contexts.
## Troubleshooting
- If a recent preference is missing, run `/compact`, wait for completion, then run `/dream` and inspect `/dream-log`.
- If memory changed incorrectly, use `/dream-restore` to inspect and restore previous versions.
- If a new session lacks context, confirm the fact was saved and it uses the same configured agent workspace.
- If memory feels stale, run `/dream` and inspect `/dream-log`.
- If memory changed incorrectly, use `/dream-restore` to inspect and restore
previous versions.
- If a new session lacks context, confirm it uses the same workspace.
## Related nanobot docs
+31 -23
View File
@@ -1,6 +1,8 @@
# How to Use an AI Agent WebUI with nanobot
nanobot includes a browser WebUI for persistent chat sessions, visible agent activity, workspace controls, Apps, MCP presets, Skills, settings, and Automations.
nanobot includes a browser WebUI for persistent chat sessions, visible agent
activity, workspace controls, Apps, MCP presets, Skills, settings, and
Automations.
## What you will build
@@ -11,13 +13,20 @@ nanobot includes a browser WebUI for persistent chat sessions, visible agent act
## When to use this
Use the WebUI when you want a local AI agent interface that is easier to operate than a terminal, especially for project work, file attachments, model switching, workspace selection, Apps, Skills, and scheduled automations.
Use the WebUI when you want a local AI agent interface that is easier to operate
than a terminal, especially for project work, file attachments, model switching,
workspace selection, Apps, Skills, and scheduled automations.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
The published wheel already includes the WebUI bundle. You only need the `webui/` source directory when changing the frontend.
The published wheel already includes the WebUI bundle. You only need the
`webui/` source directory when changing the frontend.
## Minimal working example
@@ -25,38 +34,37 @@ The published wheel already includes the WebUI bundle. You only need the `webui/
nanobot webui
```
The launcher checks setup, enables the local WebSocket channel after confirmation, starts the gateway, and opens the browser.
The launcher checks setup, enables the local WebSocket channel after
confirmation, starts the gateway, and opens the browser.
When nanobot edits a file, the WebUI activity timeline can show the changed line counts, a unified diff, and an **Open file** action for a read-only preview. File previews use the chat's current workspace access mode: restricted access stays inside the selected workspace, while Full Access can preview files outside the workspace when the gateway allows it.
## Browser notifications
When the WebUI is in the background, browser notifications tell you when a task finishes, fails, or needs attention. Click a notification to return to its chat.
1. Open **Settings → Notifications**.
2. Turn on **Browser notifications** and allow the browser's permission request.
3. Select **Test notification** to try it. If nothing appears, check the browser's site permissions, system notification settings, and Do Not Disturb.
4. Enable **Completion sound** separately if you want a page chime.
Keep the page open and connected, and use HTTPS or localhost. On iPhone or iPad, open the web app from the Home Screen. If your browser cannot enable notifications, follow the guidance shown in Settings.
When nanobot edits a file, the WebUI activity timeline can show the changed
line counts, a unified diff, and an **Open file** action for a read-only
preview. File previews use the chat's current workspace access mode: restricted
access stays inside the selected workspace, while Full Access can preview files
outside the workspace when the gateway allows it.
## Production notes
- Use `nanobot gateway --background` when you do not want to keep a terminal open, then open the configured WebUI URL in a browser.
- Use `nanobot gateway status`, `logs`, `restart`, and `stop` to manage a background gateway.
- If you expose the WebUI beyond localhost, set a token issue secret and review workspace/tool access.
- Use `nanobot gateway --background` when you do not want to keep a terminal open, then open the
configured WebUI URL in a browser.
- Use `nanobot gateway status`, `logs`, `restart`, and `stop` to manage a
background gateway.
- If you expose the WebUI beyond localhost, set a token issue secret and review
workspace/tool access.
## Security notes
- The first-run WebUI path binds to `127.0.0.1` by default.
- Do not expose the WebUI on a LAN or public host without an intentional access model.
- Do not expose the WebUI on a LAN or public host without an intentional access
model.
- Keep file and shell tools scoped to the workspace before inviting other users.
## Troubleshooting
- The WebUI is served by the WebSocket channel on port `8765` by default.
- The gateway health endpoint is separate from the browser UI.
- If the page opens but messages fail, check provider setup with `nanobot agent -m "Hello!"`.
- If the page opens but messages fail, check provider setup with
`nanobot agent -m "Hello!"`.
## Related nanobot docs
+45 -12
View File
@@ -1,6 +1,8 @@
# How to Build a Personal AI Agent with nanobot
This guide builds a personal AI agent you can run locally, talk to from the terminal or browser, and later connect to chat apps, memory, tools, and automations.
This guide builds a personal AI agent you can run locally, talk to from the
terminal or browser, and later connect to chat apps, memory, tools, and
automations.
## What you will build
@@ -11,35 +13,66 @@ This guide builds a personal AI agent you can run locally, talk to from the term
## When to use this
Use this when you want a personal AI agent that you control rather than a hosted chat-only interface. nanobot is useful when the agent needs local workspace access, tool calls, session history, memory, scheduled work, or chat app delivery.
Use this when you want a personal AI agent that you control rather than a hosted
chat-only interface. nanobot is useful when the agent needs local workspace
access, tool calls, session history, memory, scheduled work, or chat app
delivery.
## Install
Follow [Quick Start](../quick-start.md) to install nanobot using the recommended method for your operating system and configure one model. Return here after you receive the first reply. If terminals and config files are new to you, use [Start Without Technical Background](../start-without-technical-background.md) instead.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
The wizard creates `~/.nanobot/config.json` and helps you choose a provider and
model. If terminals and config files are new to you, use
[Start Without Technical Background](../start-without-technical-background.md)
instead.
## Minimal working example
Continue in the WebUI from Quick Start. Start a new topic, select a practice folder and **Restricted** access, and ask nanobot to summarize a file there. See [Your first file task](../start-without-technical-background.md#your-first-file-task) for a complete example. Reopen the same instance with `nanobot webui` if it is not running; the launcher starts or joins its gateway.
First prove the runtime can answer:
```bash
nanobot agent -m "Hello!"
```
Then open the browser workbench:
```bash
nanobot webui
```
The WebUI starts the local gateway, opens a browser, and keeps persistent chat
sessions for longer work.
## Production notes
- Choose a project folder for file work. Use [separate instances](../multiple-instances.md) when identity or long-term memory must be isolated.
- Use `modelPresets` when you want stable names for fast, deep, local, or fallback models.
- Keep `nanobot gateway` running for WebUI, chat apps, automations, and the WebSocket channel.
- Use the Python SDK when a Python application should call the agent.
- Keep one workspace per project or personal context.
- Use `modelPresets` when you want stable names for fast, deep, local, or
fallback models.
- Keep `nanobot gateway` running for WebUI, chat apps, automations, and the
WebSocket channel.
- Use the Python SDK or OpenAI-compatible API when another program should call
the agent.
## Security notes
- Do not store API keys directly in shared files; use environment variables.
- Prefer chat app pairing for first setup. Use `allowFrom` only for static allowlists, and keep those lists narrow.
- Enable workspace restriction before exposing file or shell tools to other users.
- Prefer chat app pairing for first setup. Use `allowFrom` only for static
allowlists, and keep those lists narrow.
- Enable workspace restriction before exposing file or shell tools to other
users.
- Use a separate workspace for experiments that can modify files.
## Troubleshooting
- `nanobot status` shows the config path, workspace path, and active model.
- If the model cannot reply, use **Settings → Models** to correct its connection before adding chat apps.
- If the WebUI opens but does not answer, check gateway logs and provider credentials.
- If `nanobot agent -m "Hello!"` fails, fix provider setup before opening the
WebUI or chat apps.
- If the WebUI opens but does not answer, check gateway logs and provider
credentials.
## Related nanobot docs
+21 -10
View File
@@ -1,6 +1,8 @@
# How to Connect an AI Agent to Chat Apps with nanobot
nanobot can run as a self-hosted chatbot or AI agent in Telegram, Discord, Slack, WeChat, Email, Mattermost, and other chat apps. The gateway receives chat messages, runs the agent, and sends replies back to the same channel.
nanobot can run as a self-hosted chatbot or AI agent in Telegram, Discord,
Slack, WeChat, Email, Mattermost, and other chat apps. The gateway receives chat
messages, runs the agent, and sends replies back to the same channel.
## What you will build
@@ -11,11 +13,16 @@ nanobot can run as a self-hosted chatbot or AI agent in Telegram, Discord, Slack
## When to use this
Use chat apps when the agent should live where users already communicate: private DMs, team channels, group chats, email threads, or bot workspaces.
Use chat apps when the agent should live where users already communicate:
private DMs, team channels, group chats, email threads, or bot workspaces.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot webui
```
Send `Hello!` in the WebUI before adding a channel. Then choose one platform guide for the bot/account prerequisites:
@@ -34,14 +41,14 @@ Send `Hello!` in the WebUI before adding a channel. Then choose one platform gui
Use the guided channel setup:
1. Get the platform token, login state, webhook, or mailbox credentials.
2. Open **Channels** in the WebUI.
2. Open **Settings → Channels** in the WebUI.
3. Choose the platform and open its setup panel.
4. Complete the credential or QR flow and install optional support if prompted.
5. Restart when the WebUI requests it.
6. Send a private test message.
7. Approve the pairing request in the WebUI when a DM-capable channel asks for one.
If your installed release does not show **Channels**, use the full [Chat Apps reference](../chat-apps.md#manual-setup-pattern) to configure the channel manually.
If your installed release does not show **Settings → Channels**, use the full [Chat Apps reference](../chat-apps.md#manual-setup-pattern) to configure the channel manually.
Check status from the terminal when you need a lower-level confirmation:
@@ -62,19 +69,23 @@ Use the full [Chat Apps reference](../chat-apps.md) when you manage `config.json
- Keep the gateway running as a service for always-on chat apps.
- Use mention-only group policies before opening a bot to busy channels.
- Use one channel at a time while debugging.
- Prefer DMs for first tests; pairing only works in DMs, and group chats add permissions and routing behavior.
- Prefer DMs for first tests; pairing only works in DMs, and group chats add
permissions and routing behavior.
## Security notes
- Prefer pairing or explicit allowlists; do not use `allowFrom: ["*"]` outside an intentional sandbox.
- Prefer pairing or explicit allowlists; do not use `allowFrom: ["*"]` outside
an intentional sandbox.
- Rotate bot tokens if they are pasted into logs or shared files.
- Review file, shell, and web tool access before inviting other users.
## Troubleshooting
- If `nanobot channels status` does not show the channel, the config key or optional dependency is likely missing.
- If `nanobot channels status` does not show the channel, the config key or
optional dependency is likely missing.
- If the first DM returns a pairing code, approve the pending request in the WebUI or use `/pairing approve <code>` from an authorized chat.
- If messages do not arrive, inspect the running gateway logs and compare platform credentials, event permissions, and allow lists. Use `--verbose` when restarting that gateway for diagnosis.
- If messages do not arrive, run `nanobot gateway --verbose` and compare
platform credentials, event permissions, and allow lists.
- If group replies are unexpected, review that channel's group policy.
## Related nanobot docs
@@ -1,6 +1,7 @@
# How to Configure Langfuse Observability for nanobot
nanobot can trace supported OpenAI-compatible provider calls through Langfuse's OpenAI SDK wrapper, and Codex OAuth provider calls through Langfuse's native Python SDK.
nanobot can trace supported OpenAI-compatible provider calls through Langfuse's
OpenAI SDK wrapper.
## What you will build
@@ -10,11 +11,18 @@ nanobot can trace supported OpenAI-compatible provider calls through Langfuse's
## When to use this
Use Langfuse when you need observability for model requests, latency, errors, cost, or prompt behavior during development or production operation.
Use Langfuse when you need observability for model requests, latency, errors,
cost, or prompt behavior during development or production operation.
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. Continue with the same working instance.
Install nanobot and prove the agent works:
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
Install Langfuse:
@@ -22,8 +30,6 @@ Install Langfuse:
nanobot plugins enable langfuse
```
nanobot uses Langfuse Python SDK 4.7 or later in the 4.x series. Tracing supports Langfuse Cloud and self-hosted Langfuse 3.63.0 or later. The SDK enables real-time ingestion on Langfuse v4 automatically; see [Langfuse compatibility](https://langfuse.com/docs/compatibility).
## Minimal working example
Set credentials before starting nanobot:
@@ -49,18 +55,21 @@ nanobot agent -m "Hello!"
- Langfuse is configured with environment variables, not `config.json`.
- Start services from an environment that exports the same variables.
- Add tracing after the provider works; it should not be the first setup step.
- Native providers other than Codex OAuth that do not use the OpenAI-compatible client path may not produce Langfuse traces.
- Native providers that do not use the OpenAI-compatible client path may not
produce Langfuse OpenAI-wrapper traces.
## Security notes
- Treat Langfuse projects as observability stores for sensitive prompts and outputs.
- Treat Langfuse projects as observability stores for sensitive prompts and
outputs.
- Use separate projects for personal, staging, and production traffic.
- Keep Langfuse keys out of committed service files.
## Troubleshooting
- If no traces appear, confirm the service process sees the environment variables.
- Confirm the provider path is OpenAI-compatible or the Codex OAuth provider.
- If no traces appear, confirm the service process sees the environment
variables.
- Confirm the provider path is OpenAI-compatible.
- Run one local `nanobot agent -m "Hello!"` call before debugging service logs.
## Related nanobot docs
+26 -16
View File
@@ -1,6 +1,7 @@
# How to Configure MCP Tools in nanobot
This guide adds an MCP server to nanobot so the agent can use external tools through the Model Context Protocol.
This guide adds an MCP server to nanobot so the agent can use external tools
through the Model Context Protocol.
## What you will build
@@ -10,27 +11,35 @@ This guide adds an MCP server to nanobot so the agent can use external tools thr
## When to use this
Use MCP when the capability you need already exists as an MCP server, or when you want external tools to be managed outside nanobot core.
Use MCP when the capability you need already exists as an MCP server, or when
you want external tools to be managed outside nanobot core.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
Choose a connection type first: use **stdio** for a tool that nanobot starts as a local process (you must install its runtime, such as `npx` or `uvx`); use **HTTP** or **SSE** for a tool available at a remote URL. If the remote server requires sign-in, configure OAuth in Apps and connect it in the browser.
Install the MCP server runtime separately. Many examples use `npx`, `uvx`, or a
remote HTTP endpoint.
## Minimal working example
For local interactive setup:
1. Run `nanobot webui` and open **Apps**.
2. Choose a known MCP server preset, or add a custom stdio, HTTP, or SSE server. For a custom OAuth server, choose **OAuth** under **Authentication**, save it, and click **Connect**. Presets such as Xmind, Notion, and Linear go straight to **Connect**. Approve access in the browser window. HTTPS and localhost WebUIs return automatically. From a remote plain-HTTP WebUI, copy the complete localhost callback URL from the browser address bar and paste it into nanobot.
2. Choose a known MCP server preset, or add a custom stdio, HTTP, or SSE server.
For a custom OAuth server, choose **OAuth** under **Authentication**, save it,
and click **Connect**. Presets such as Xmind, Notion, and Linear go straight to
**Connect**. Approve access in the browser window. HTTPS and localhost WebUIs
return automatically. From a remote plain-HTTP WebUI, copy the complete
localhost callback URL from the browser address bar and paste it into nanobot.
3. Limit the enabled tools when the server exposes more than the task needs.
4. Save and restart when prompted.
5. Mention the connected MCP server with `@` in the next message and ask for a small test action.
<details>
<summary>Manual configuration</summary>
For manual or deployment-managed config, add this to `~/.nanobot/config.json`:
```json
@@ -49,33 +58,34 @@ For manual or deployment-managed config, add this to `~/.nanobot/config.json`:
Restart nanobot and ask a question that requires the MCP tool.
</details>
## Production notes
- Prefer `enabledTools` over exposing every tool by default.
- Use `toolTimeout` for slow MCP operations.
- Use HTTP MCP only for endpoints you trust.
- For deployment-managed OAuth servers, set `auth` to `oauth` and complete the browser connection from **Apps → MCP**.
- For deployment-managed OAuth servers, set `auth` to `oauth` and complete the
browser connection from **Apps → MCP**.
- Keep MCP server commands stable and versioned in deployment docs or scripts.
## Security notes
- Stdio MCP starts a local process; review the command before enabling it.
- HTTP/SSE connections are checked to prevent nanobot from reaching private or internal network addresses. This check also applies during OAuth sign-in and redirects.
- HTTP/SSE MCP uses nanobot's SSRF guard, including OAuth discovery, registration,
token exchange, and redirects.
- OAuth credentials live in the nanobot data directory, not in `config.json`.
- Allow private HTTP MCP hosts only with narrow `tools.ssrfWhitelist` CIDRs.
- Do not place secrets in command arguments when environment variables or headers can be used.
- Do not place secrets in command arguments when environment variables or
headers can be used.
## Troubleshooting
- Run the MCP command outside nanobot first.
- Start `nanobot gateway --verbose` and inspect tool registration logs.
- If an HTTP MCP URL is blocked, check whether it points to loopback or a private address that needs explicit allowlisting.
- If an HTTP MCP URL is blocked, check whether it points to loopback or a
private address that needs explicit allowlisting.
## Related nanobot docs
- [MCP service presets](../mcp-presets.md)
- [MCP tools for AI agents](./mcp-tools-for-ai-agents.md)
- [Configuration: MCP](../configuration.md#mcp-model-context-protocol)
- [Security](../configuration.md#security)
+24 -18
View File
@@ -1,6 +1,7 @@
# How to Configure Model Fallback in nanobot
Model fallback lets nanobot try a primary model first, then fall back to one or more named presets when the primary provider fails or rate-limits.
Model fallback lets nanobot try a primary model first, then fall back to one or
more named presets when the primary provider fails or rate-limits.
## What you will build
@@ -10,22 +11,23 @@ Model fallback lets nanobot try a primary model first, then fall back to one or
## When to use this
Use fallback when you want better reliability across rate limits, provider outages, local model downtime, or cost-sensitive routing.
Use fallback when you want better reliability across rate limits, provider
outages, local model downtime, or cost-sensitive routing.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
Verify each provider works before adding it as a fallback.
## Minimal working example
In **Settings → Models**, create the primary and backup presets, then use **Enable preset** and arrange their order. The first enabled preset is primary; later entries are tried as fallbacks. Save and test each preset before relying on the chain.
<details>
<summary>Manual configuration</summary>
Merge this shape into `~/.nanobot/config.json` and replace provider/model names with ones you control:
Merge this shape into `~/.nanobot/config.json` and replace provider/model names
with ones you control:
```json
{
@@ -54,14 +56,15 @@ Merge this shape into `~/.nanobot/config.json` and replace provider/model names
}
```
String entries in `fallbackModels` are preset names, not raw model IDs. Replace the placeholder model IDs with currently supported model IDs from your provider. The [Provider Cookbook](../provider-cookbook.md) has concrete recipes for common providers.
</details>
String entries in `fallbackModels` are preset names, not raw model IDs.
Replace the placeholder model IDs with currently supported model IDs from your
provider. The [Provider Cookbook](../provider-cookbook.md) has concrete recipes
for common providers.
## Production notes
- In the WebUI, a reply produced by a named fallback preset shows its provider logo and preset name next to the reply timestamp. Hover, focus, or click the badge for an explanation. The composer still shows your selected preset; primary replies have no fallback badge. Saved replies retain the name used for that invocation, even after a preset is renamed or deleted. Older replies without recorded attribution and unnamed inline fallback objects are not labeled.
- Keep fallback context windows realistic; smaller fallback windows constrain how much context can fit.
- Keep fallback context windows realistic; smaller fallback windows constrain
how much context can fit.
- Put cheaper or faster fallbacks before expensive ones when acceptable.
- Use `/model <preset>` for runtime switching without editing config.
- Keep preset names human-readable; the same name appears in the WebUI and `/model`.
@@ -74,9 +77,12 @@ String entries in `fallbackModels` are preset names, not raw model IDs. Replace
## Troubleshooting
- If a fallback never triggers, confirm the primary error is treated as retryable/fallbackable.
- If startup fails, check that each fallback string matches a key under `modelPresets`.
- If output is truncated after fallback, review `maxTokens` and `contextWindowTokens`.
- If a fallback never triggers, confirm the primary error is treated as
retryable/fallbackable.
- If startup fails, check that each fallback string matches a key under
`modelPresets`.
- If output is truncated after fallback, review `maxTokens` and
`contextWindowTokens`.
## Related nanobot docs
+54 -41
View File
@@ -1,8 +1,14 @@
# Reuse Ollama Prompt Cache to Reduce Repeated Processing
# How to Improve Ollama Tool-Calling Prompt Cache Reuse in nanobot
Ollama can reuse work from an earlier prompt when the beginning of the prompt stays the same. Some model templates move or remove tool instructions as a conversation switches between user, assistant, and tool messages, so Ollama must process much of the prompt again. On slower local hardware, this can add tens of seconds to a tool-using turn.
Some Ollama model templates move or remove tool definitions as a conversation
switches between user, assistant, and tool messages. nanobot can send a correct
append-only chat request while the model template still renders a different token
prefix. On slower local hardware, re-evaluating that prefix can add tens of seconds
to an otherwise simple tool-using turn.
This guide shows how to diagnose that specific pattern and create a derived `llama3.1:8b` tag with a prefix-stable tool template. It does not modify nanobot or overwrite the original Ollama model.
This guide shows how to diagnose that specific pattern and create a derived
`llama3.1:8b` tag with a prefix-stable tool template. It does not modify nanobot or
overwrite the original Ollama model.
## What you will build
@@ -16,14 +22,18 @@ Use this guide when all of the following are true:
- direct Ollama responses are reasonably fast;
- nanobot becomes slow after the model calls a tool;
- Ollama logs show a long main prompt, a much shorter tool follow-up, and low initial cache reuse on the next main prompt;
- the model is `llama3.1:8b` with a template that renders concrete tools only for the final user message.
- Ollama logs show a long main prompt, a much shorter tool follow-up, and low
initial cache reuse on the next main prompt;
- the model is `llama3.1:8b` with a template that renders concrete tools only for
the final user message.
Do not apply this template to another model family without checking that model's tool-call format first.
Do not apply this template to another model family without checking that model's
tool-call format first.
## Diagnose the rendered prompt
Stop any existing Ollama process, then start a single-slot debug server. A single slot makes the cache sequence easier to read.
Stop any existing Ollama process, then start a single-slot debug server. A single
slot makes the cache sequence easier to read.
**macOS or Linux**
@@ -43,7 +53,8 @@ $env:OLLAMA_DEBUG = "1"
ollama serve
```
In another terminal, use a fresh session and explicitly request a tool so both turns exercise the agent loop:
In another terminal, use a fresh session and explicitly request a tool so both
turns exercise the agent loop:
```bash
nanobot agent --session cli:ollama-cache-check \
@@ -52,7 +63,9 @@ nanobot agent --session cli:ollama-cache-check \
--message "Use the exec tool to calculate 4+7, then answer"
```
In the Ollama output, find each `new prompt` line and the first `cached n_tokens` line that follows it. Later increasing `cached n_tokens` lines are prompt-evaluation progress, not additional initial cache hits.
In the Ollama output, find each `new prompt` line and the first
`cached n_tokens` line that follows it. Later increasing `cached n_tokens` lines
are prompt-evaluation progress, not additional initial cache hits.
A cache-unfriendly tool template may produce a pattern like this:
@@ -62,13 +75,18 @@ turn 1 tool follow-up: 3713 / 3758 initially cached
turn 2 main: 3767 / 8519 initially cached
```
The cache is working, but the next main request can reuse only the shorter prompt. Hardware throughput determines how expensive the remaining evaluation is.
The cache is working, but the next main request can reuse only the shorter prompt.
Hardware throughput determines how expensive the remaining evaluation is.
To inspect the API request bodies as well, add `OLLAMA_DEBUG_LOG_REQUESTS=1` before starting Ollama. These logs can contain system prompts, workspace context, and user messages. Keep them local and disable request logging after diagnosis.
To inspect the API request bodies as well, add
`OLLAMA_DEBUG_LOG_REQUESTS=1` before starting Ollama. These logs can contain system
prompts, workspace context, and user messages. Keep them local and disable request
logging after diagnosis.
## Why the default template can limit cache reuse
## Why this happens with the stock template
The tested `llama3.1:8b` template conditionally expands the tool definitions inside a user message:
The tested `llama3.1:8b` template conditionally expands the tool definitions inside
a user message:
```gotemplate
{{- if and $.Tools $last }}
@@ -76,13 +94,19 @@ The tested `llama3.1:8b` template conditionally expands the tool definitions ins
{{- end }}
```
The first request ends with a user message, so the tools are rendered there. After nanobot appends an assistant tool call and its result, that user message is no longer last, so the same API request history renders without the concrete tool block. On the next user turn, the tools reappear at a new position.
The first request ends with a user message, so the tools are rendered there. After
nanobot appends an assistant tool call and its result, that user message is no
longer last, so the same API request history renders without the concrete tool
block. On the next user turn, the tools reappear at a new position.
This is a model-template behavior. At the API boundary, nanobot continues to append the assistant tool call and tool result and sends the same tool definitions.
This is a model-template behavior. At the API boundary, nanobot continues to append
the assistant tool call and tool result and sends the same tool definitions.
## Create a prefix-stable derived model
Create `PrefixStable.Modelfile` with the content below. The template keeps concrete tool definitions in the system block, where they remain in the same position across user and tool messages.
Create `PrefixStable.Modelfile` with the content below. The template keeps concrete
tool definitions in the system block, where they remain in the same position across
user and tool messages.
```dockerfile
FROM llama3.1:8b
@@ -140,18 +164,12 @@ ollama create llama3.1:8b-prefix-stable-v1 -f PrefixStable.Modelfile
ollama list
```
Ollama reuses the existing model layers. The new tag adds a small template and manifest instead of copying the base weights.
Ollama reuses the existing model layers. The new tag adds a small template and
manifest instead of copying the base weights.
## Select the derived model in nanobot
Open **Settings → Models → New preset**, select your Ollama connection, enter the derived model name, and save. Use **Enable preset** if it is disabled, then drag it to the first enabled position, marked **Primary**. This saves the default model used by sessions without their own model selection, including the fresh CLI session below.
Run the CLI commands with the same nanobot home as the WebUI. If the WebUI uses a custom home, add `--home <path>` before each subcommand.
<details>
<summary>Manual configuration</summary>
Merge this preset into your instance's `config.json` to make it the default:
Merge this preset into `~/.nanobot/config.json` and select it:
```json
{
@@ -177,9 +195,7 @@ Merge this preset into your instance's `config.json` to make it the default:
}
```
</details>
Run `nanobot status` and confirm that **Model** shows `llama3.1:8b-prefix-stable-v1`, then repeat the two-turn check. If `cli:ollama-stable-check` already exists with a saved model selection, use a new session name for both turns.
Verify the selected model and repeat the two-turn check:
```bash
nanobot status
@@ -189,20 +205,15 @@ nanobot agent --session cli:ollama-stable-check \
--message "Use the exec tool to calculate 4+7, then answer"
```
In one controlled test with Ollama 0.32.1, `llama3.1:8b`, and one slot, the second main request improved from `3767 / 8519` initially cached (44.22%) to `8505 / 8520` (99.82%). The number of re-evaluated tokens fell from 4752 to 15. Treat these numbers as a diagnostic example, not a performance guarantee.
In one controlled test with Ollama 0.32.1, `llama3.1:8b`, and one slot, the second
main request improved from `3767 / 8519` initially cached (44.22%) to
`8505 / 8520` (99.82%). The number of re-evaluated tokens fell from 4752 to 15.
Treat these numbers as a diagnostic example, not a performance guarantee.
## Roll back
In **Settings → Models**, move the original preset back to the first enabled position and disable the derived preset. For conversations with a saved model selection, select the original preset in the composer as well.
<details>
<summary>Manual configuration</summary>
Set `agents.defaults.modelPreset` back to the original preset in your instance's `config.json`.
</details>
When no configuration or session uses the derived tag, remove it with:
Switch `agents.defaults.modelPreset` back to the original preset. When no config
uses the derived tag, remove it with:
```bash
ollama rm llama3.1:8b-prefix-stable-v1
@@ -214,8 +225,10 @@ Removing the derived tag does not remove `llama3.1:8b`.
- The template above is specific to the tested `llama3.1:8b` tool-call format.
- Ollama or the model publisher may update the stock template in a later release.
- Validate multiple tool calls, tool errors, parallel calls, and long conversations before using a custom template for unattended workloads.
- A higher cache ratio reduces prompt evaluation, but model generation, tool execution, process startup, and storage can still dominate end-to-end latency.
- Validate multiple tool calls, tool errors, parallel calls, and long conversations
before using a custom template for unattended workloads.
- A higher cache ratio reduces prompt evaluation, but model generation, tool
execution, process startup, and storage can still dominate end-to-end latency.
- Multiple Ollama slots change cache scheduling and may produce different results.
## Related nanobot docs
@@ -1,6 +1,7 @@
# How to Configure an OpenAI-Compatible Provider in nanobot
nanobot can call OpenAI-compatible model providers by configuring an `apiBase`, optional `apiKey`, and a model preset that references that provider name.
nanobot can call OpenAI-compatible model providers by configuring an `apiBase`,
optional `apiKey`, and a model preset that references that provider name.
## What you will build
@@ -10,11 +11,16 @@ nanobot can call OpenAI-compatible model providers by configuring an `apiBase`,
## When to use this
Use this for local or hosted services that expose OpenAI-compatible endpoints, including internal gateways, local model servers, and provider proxies that are not already named in nanobot.
Use this for local or hosted services that expose OpenAI-compatible endpoints,
including internal gateways, local model servers, and provider proxies that are
not already named in nanobot.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
Verify the endpoint responds before debugging nanobot:
@@ -24,14 +30,6 @@ curl -sS https://api.example.com/v1/models
## Minimal working example
1. Open **Settings → Models → New preset**.
2. In **Provider**, choose **Add provider** and create a custom connection with your endpoint URL and credential.
3. Select the model served by that endpoint, name the preset, and save.
4. Select the preset in the chat composer and send `Hello!`.
<details>
<summary>Manual configuration</summary>
Merge this into `~/.nanobot/config.json`:
```json
@@ -59,17 +57,19 @@ Merge this into `~/.nanobot/config.json`:
}
```
</details>
Then run:
Verify in the WebUI with the new preset selected. For the manual snippet above, which sets the global default, you can instead run `nanobot agent -m "Hello!"` from the same instance. A different CLI session does not inherit a WebUI topic's model selection.
```bash
nanobot agent -m "Hello!"
```
## Production notes
- Include the version path in `apiBase` when the service expects `/v1`.
- Use separate provider names for separate endpoints.
- Use a placeholder key such as `EMPTY` only when the endpoint requires a non-empty key but does not validate it.
- Leave the preset's API selection on Auto for ordinary Chat Completions services.
- If the service requires Responses or Anthropic Messages, set its supported APIs and default in the connection's **Advanced options**. To choose an API for an individual model, use **Settings → Models → a preset → Advanced options → API connection**. See [connection settings](../configuration.md#custom-connection-apis) and [preset settings](../configuration.md#preset-request-api) for JSON examples.
- Use a placeholder key such as `EMPTY` only when the endpoint requires a
non-empty key but does not validate it.
- Leave `apiType` unset for OpenAI-compatible custom endpoints.
## Security notes
@@ -80,10 +80,13 @@ Verify in the WebUI with the new preset selected. For the manual snippet above,
## Troubleshooting
- If `curl /models` fails, fix the provider endpoint before changing nanobot.
- If nanobot says the model is unknown, check the model ID expected by the provider.
- If auth fails, confirm whether the provider wants Bearer auth and whether the key is present in the environment that starts nanobot.
- If nanobot says the model is unknown, check the model ID expected by the
provider.
- If auth fails, confirm whether the provider wants Bearer auth and whether the
key is present in the environment that starts nanobot.
## Related nanobot docs
- [Provider Cookbook: Custom OpenAI-Compatible Provider](../provider-cookbook.md#recipe-custom-openai-compatible-provider)
- [Providers: Custom OpenAI-Compatible Endpoint](../providers.md#custom-openai-compatible-endpoint)
- [OpenAI-Compatible Agent API](./openai-compatible-agent-api.md)
+26 -16
View File
@@ -1,6 +1,8 @@
# How to Configure Web Search for a nanobot AI Agent
nanobot includes built-in web search and web fetch tools. Search uses DuckDuckGo by default and can be configured for API-backed or self-hosted providers.
nanobot includes built-in web search and web fetch tools. Search uses
DuckDuckGo by default and can be configured for API-backed or self-hosted
providers.
## What you will build
@@ -10,27 +12,30 @@ nanobot includes built-in web search and web fetch tools. Search uses DuckDuckGo
## When to use this
Configure web search when the agent needs current information, public web research, source discovery, or page fetching during a task.
Configure web search when the agent needs current information, public web
research, source discovery, or page fetching during a task.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
Web tools are enabled by default. Configure them only when you want a specific provider, API key, proxy, fetch behavior, or SSRF allowlist.
Web tools are enabled by default. Configure them only when you want a specific
provider, API key, proxy, fetch behavior, or SSRF allowlist.
## Minimal working example
For local interactive setup:
1. Run `nanobot webui`.
2. Open **Settings → Capabilities → Web access**.
2. Open **Settings → Web**.
3. Enable web search, choose a provider, and enter its API key if required.
4. Save and restart when prompted.
5. Ask a question that requires current information and inspect the cited sources.
<details>
<summary>Manual configuration</summary>
For manual or deployment-managed config, use the default search provider:
```json
@@ -61,9 +66,8 @@ Or use an API-backed provider:
}
```
Ask a question that requires current information and inspect the tool activity in the WebUI or logs.
</details>
Ask a question that requires current information and inspect the tool activity
in the WebUI or logs.
## Production notes
@@ -74,10 +78,16 @@ Ask a question that requires current information and inspect the tool activity i
## Security notes
- Web fetch and HTTP MCP share an address check that prevents requests to private or internal network locations. Private, loopback, link-local, and cloud metadata addresses are blocked by default.
- With `useJinaReader` enabled (the default), fetched URLs are disclosed to the remote reader service. Credential-bearing URLs (userinfo or token/signature query parameters) are fetched locally instead; path-embedded secrets cannot be detected, so disable the remote reader when URLs must stay local.
- Add `tools.ssrfWhitelist` only for narrow trusted CIDRs. This setting exempts those address ranges from the private-address block; use the smallest range needed.
- Do not give public chat users unrestricted web and shell access without review.
- Web fetch and HTTP MCP share an SSRF guard.
- Private, loopback, link-local, and cloud metadata addresses are blocked by
default.
- With `useJinaReader` enabled (the default), fetched URLs are disclosed to the
remote reader service. Credential-bearing URLs (userinfo or token/signature
query parameters) are fetched locally instead; path-embedded secrets cannot
be detected, so disable the remote reader when URLs must stay local.
- Add `tools.ssrfWhitelist` only for narrow trusted CIDRs.
- Do not give public chat users unrestricted web and shell access without
review.
## Troubleshooting
+39 -28
View File
@@ -1,20 +1,40 @@
# How to Deploy a Long-Running nanobot AI Agent Gateway
The nanobot gateway is the long-running self-hosted AI agent process that keeps WebUI sessions, chat apps, automations, local triggers, heartbeat jobs, Dream, and WebSocket delivery online.
The nanobot gateway is the long-running self-hosted AI agent process that keeps
WebUI sessions, chat apps, automations, local triggers, heartbeat jobs, Dream,
and WebSocket delivery online.
## What you will build
- a verified nanobot config
- a gateway process
- a service or container deployment path with Docker, systemd, or macOS LaunchAgent
- a service or container deployment path with Docker, systemd, or macOS
LaunchAgent
## When to use this
Use this when nanobot should keep running after a single CLI turn. Chat apps, browser sessions, background automations, local triggers, and server-side integrations all depend on a live gateway.
Use this when nanobot should keep running after a single CLI turn. Chat apps,
browser sessions, background automations, local triggers, and server-side
integrations all depend on a live gateway.
## Start from your current setup
## Install
If nanobot already replies in the WebUI, its gateway is already running. To keep it alive after closing the launcher, close the foreground launcher and start the same instance in background mode:
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot status
nanobot agent -m "Hello!"
```
## Minimal working example
Run the gateway in the foreground:
```bash
nanobot gateway
```
For WebUI background usage:
```bash
nanobot gateway --background
@@ -22,43 +42,34 @@ nanobot gateway status
nanobot gateway logs
```
Run `nanobot webui` when you need to return to the browser; it attaches to the running gateway. Do not run a second foreground gateway for the same instance.
For a new host, choose one setup path:
- **Docker:** follow [container initialization and verification](../deployment.md#docker-compose). It creates the config and checks the model inside the container; a host nanobot installation is unnecessary.
- **Host installation:** follow the [quick start](../quick-start.md). On a headless machine, use `nanobot onboard --wizard`, then `nanobot agent -m "Hello!"` to check the selected model.
## Keep the gateway running
Background mode keeps the current process alive; for automatic startup after reboot and restart on failure, choose [Docker Compose](../deployment.md#docker-compose), a [systemd user service](../deployment.md#linux-service), or a [macOS LaunchAgent](../deployment.md#macos-launchagent). Use the same config and workspace as the successful model check. Stop a manually managed gateway before starting a service for that instance.
For foreground diagnosis only:
```bash
nanobot gateway --verbose
```
Open the configured WebUI URL in a browser, or run `nanobot webui` as a foreground client.
## Production notes
- Docker Compose is the most repeatable Linux container path.
- systemd user services are useful for Linux user-level gateway deployments.
- macOS LaunchAgent keeps the gateway alive after login.
- Persist the active config directory's `sessions/` folder together with the workspace (including `.nanobot/workspace-id`), memory files, channel login state, and generated artifacts.
- Persist the active config directory's `sessions/` folder together with the workspace
(including `.nanobot/workspace-id`), memory files, channel login state, and generated artifacts.
- Restart the gateway after editing `config.json`.
## Security notes
- Plan ports before exposing services. Gateway health defaults to `18790`, and WebUI/WebSocket defaults to `8765`.
- Protect shared WebUI access with a WebSocket token. The health endpoint has no authentication; keep its published port on loopback or behind a restricted monitoring interface.
- Plan ports before exposing services. Gateway health defaults to `18790`,
WebUI/WebSocket defaults to `8765`, and `nanobot serve` defaults to `8900`.
- Bind externally only when you have configured tokens or API keys.
- Keep chat access control intentional before deploying.
- Use Docker or Linux sandboxing when shell tools are enabled for unattended work.
- Use Docker or Linux sandboxing when shell tools are enabled for unattended
work.
## Troubleshooting
- Use the same `--config` and `--workspace` flags for status checks and service startup.
- Check logs with `docker compose logs`, `journalctl`, LaunchAgent logs, or `nanobot gateway --verbose`.
- If Docker port publishing does not work, confirm the service is not bound only to container loopback.
- Use the same `--config` and `--workspace` flags for status checks and service
startup.
- Check logs with `docker compose logs`, `journalctl`, LaunchAgent logs, or
`nanobot gateway --verbose`.
- If Docker port publishing does not work, confirm the service is not bound only
to container loopback.
## Related nanobot docs
+28 -35
View File
@@ -1,6 +1,7 @@
# Build a Discord AI Agent with nanobot
This guide connects nanobot to Discord so a Discord user or server channel can talk to your self-hosted AI agent through the nanobot gateway.
This guide connects nanobot to Discord so a Discord user or server channel can
talk to your self-hosted AI agent through the nanobot gateway.
## What this guide builds
@@ -11,31 +12,32 @@ This guide connects nanobot to Discord so a Discord user or server channel can t
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- Access to the Discord Developer Portal.
- A Discord server where you can invite a bot.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the Discord channel
Create a Discord application and bot, enable **Message Content Intent**, and invite it with permission to read history and send messages. In **Channels → Discord**, enter the bot token, enable the channel, and save. Use **Advanced** for allowed channels and reply behavior; follow any restart prompt.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
nanobot plugins enable discord
```
Create a Discord application, add a bot, copy the token, and enable `MESSAGE CONTENT INTENT` in the bot settings.
Create a Discord application, add a bot, copy the token, and enable
`MESSAGE CONTENT INTENT` in the bot settings.
Merge this snippet into `~/.nanobot/config.json`:
@@ -47,44 +49,33 @@ Merge this snippet into `~/.nanobot/config.json`:
"token": "YOUR_BOT_TOKEN",
"allowChannels": [],
"groupPolicy": "mention",
"streaming": true,
"replyToMessage": false
"streaming": true
}
}
}
```
Omitting `allowFrom` enables pairing-only mode. A new user should DM the bot first, get a pairing code, and be approved before using the bot in servers.
Omitting `allowFrom` enables pairing-only mode. A new user should DM the bot
first, get a pairing code, and be approved before using the bot in servers.
Invite the bot with permissions to read history and send messages.
Set `replyToMessage` to `true` to make responses use Discord's native reply UI. It defaults to `false`, preserving the existing behavior.
## Run nanobot gateway
</details>
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
Send the bot a DM first. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
Send the bot a DM first. It should return a pairing code. Approve it from a
trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
After approval, mention it in an allowed server channel:
```text
@@ -95,7 +86,8 @@ After approval, mention it in an allowed server channel:
- Keep `groupPolicy` as `mention` for first deployment.
- Use `allowChannels` for server channels where the bot should operate.
- Prefer pairing-only mode for user access; add `allowFrom` only when you want a static allowlist.
- Prefer pairing-only mode for user access; add `allowFrom` only when you want a
static allowlist.
- Avoid open group behavior in busy channels until session routing is clear.
- Review tool access before inviting the bot into shared servers.
@@ -103,7 +95,8 @@ After approval, mention it in an allowed server channel:
- If no messages arrive, confirm Message Content intent is enabled.
- If a DM returns a pairing code, approve it before testing normal replies.
- If server messages are ignored, check pairing approval, `allowChannels`, and whether the bot was mentioned.
- If server messages are ignored, check pairing approval, `allowChannels`, and
whether the bot was mentioned.
- If the bot cannot reply, confirm the invite permissions and channel overrides.
## Next: memory, automations, MCP tools
+30 -57
View File
@@ -1,6 +1,7 @@
# Build an Email AI Agent with nanobot
This guide turns nanobot into an email AI agent that polls IMAP for accepted messages and replies through SMTP.
This guide turns nanobot into an email AI agent that polls IMAP for accepted
messages and replies through SMTP.
## What this guide builds
@@ -11,25 +12,27 @@ This guide turns nanobot into an email AI agent that polls IMAP for accepted mes
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A mailbox for the bot.
- IMAP and SMTP access. For Gmail, use an app password rather than your account password.
- IMAP and SMTP access. For Gmail, use an app password rather than your account
password.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the Email channel
Prepare a dedicated mailbox and app password. In **Channels → Email**, grant mailbox access, enter IMAP and SMTP settings, and restrict allowed senders. Use **Advanced** for trusted authentication services and other mailbox options. Enable the channel, save, and follow any restart prompt.
<details>
<summary>Manual configuration</summary>
Merge this snippet into `~/.nanobot/config.json` and replace the addresses and passwords:
Merge this snippet into `~/.nanobot/config.json` and replace the addresses and
passwords:
```json
{
@@ -47,74 +50,44 @@ Merge this snippet into `~/.nanobot/config.json` and replace the addresses and p
"smtpPassword": "your-app-password",
"fromAddress": "my-nanobot@gmail.com",
"allowFrom": ["your-real-email@gmail.com"],
"trustedAuthservIds": ["mx.google.com"],
"autoReplyEnabled": true
}
}
}
```
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
Send an email from an address in `allowFrom` to the bot mailbox. Keep the gateway running long enough for the polling interval to receive it.
Send an email from an address in `allowFrom` to the bot mailbox. Keep the
gateway running long enough for the polling interval to receive it.
## Security notes
- Use a dedicated mailbox, not your primary personal inbox.
- Set `consentGranted` to `false` to fully disable mailbox access.
- Email does not use DM pairing. Keep `allowFrom` narrow; `["*"]` accepts mail from anyone.
- Keep SPF/DKIM verification enabled and set `trustedAuthservIds` to the exact `authserv-id` added by your receiving mail service. For Gmail this is normally `mx.google.com`. The service must prepend one consolidated `Authentication-Results` header and remove inbound headers claiming the same identity. nanobot rejects authenticated email when this trust anchor is missing or appears more than once.
- Email does not use DM pairing. Keep `allowFrom` narrow; `["*"]` accepts mail
from anyone.
- Use environment variables for mailbox passwords.
- Enable attachment types only when the agent needs them.
## Upgrading to v0.3.5
Email authentication now requires an explicit receiving-service trust anchor. This is a security-related configuration change: an existing email channel with `verifySpf` or `verifyDkim` enabled will not start without `trustedAuthservIds`. Other channels, mailbox credentials, stored messages, and `allowFrom` do not need to be migrated. Existing values are not automatically rewritten.
1. Back up your configuration and temporarily disable the Email channel while configuring the receiver. Do not turn off SPF/DKIM verification as an upgrade workaround.
2. Confirm with your receiving mail service or administrator which exact `authserv-id` it adds, and that it strips externally supplied headers claiming that identity. It must provide one consolidated `Authentication-Results` header. A name visible in a received email is not, by itself, proof of trust; do not infer it from your IMAP hostname or copy it from an arbitrary message.
3. In **Channels → Email**, open **Advanced** and set **Trusted authentication services** to your confirmed receiver identity. Keep SPF/DKIM verification enabled.
<details>
<summary>Manual configuration</summary>
Merge these fields into `channels.email` in your existing config:
```json
{
"verifySpf": true,
"verifyDkim": true,
"trustedAuthservIds": ["mx.google.com"]
}
```
The example is for a receiver using `mx.google.com`; use your confirmed receiver identity instead. JSON uses a list; the WebUI accepts comma-separated values. Wildcards and URLs are not accepted. Multiple configured identities are alternatives, not permission to combine multiple trusted result headers.
</details>
4. Check the IMAP/SMTP connection, re-enable Email, and restart the gateway after editing a configuration file. Send one ordinary message from an allowed address and confirm receipt and reply. A successful connection check verifies credentials and configuration, not your mail service's header-stripping policy.
Each enabled verification method must pass and identify the visible sender's domain, or a parent/subdomain of it. DKIM uses `header.d` when present, otherwise the domain of the receiver-reported `header.i`. This is not a full DMARC policy implementation, and domain authentication does not independently authenticate the mailbox local part. Forwarders, mailing lists, or receivers that emit separate SPF and DKIM result headers may need mail-service changes. Keep Email disabled if the receiver cannot meet the trust contract.
Authentication failures remain skipped messages. Keep the default `postActionIgnoreSkipped: true` while checking the migration; setting it to `false` allows your configured move/delete action to affect skipped mail too. If the migration cannot be completed, disable Email rather than reverting to an older authentication policy.
## Troubleshooting
- If login fails, confirm IMAP/SMTP access and app-password setup.
- If Email will not start and reports `trusted_authserv_ids` as missing, complete the upgrade steps above. A configured receiver still needs to emit compatible, aligned authentication results for each enabled verification method.
- If the bot reads but does not reply, check `autoReplyEnabled`, SMTP settings, and allowed sender addresses.
- If attachments are missing, review `allowedAttachmentTypes`, size limits, and gateway logs.
- If the bot reads but does not reply, check `autoReplyEnabled`, SMTP settings,
and allowed sender addresses.
- If attachments are missing, review `allowedAttachmentTypes`, size limits, and
gateway logs.
## Next: memory, automations, MCP tools
- [Chat Apps reference](../chat-apps.md)
- [Secure local AI agent](./secure-local-ai-agent.md)
- [AI Agent Memory](./ai-agent-memory.md)
- [OpenAI-compatible agent API](./openai-compatible-agent-api.md)
+39 -41
View File
@@ -1,6 +1,8 @@
# Build a Feishu AI Agent with nanobot
This guide connects nanobot to Feishu or Lark through the `feishu` channel. The channel uses a WebSocket long connection, so the first setup does not require a public webhook URL.
This guide connects nanobot to Feishu or Lark through the `feishu` channel. The
channel uses a WebSocket long connection, so the first setup does not require a
public webhook URL.
## What this guide builds
@@ -11,24 +13,24 @@ This guide connects nanobot to Feishu or Lark through the `feishu` channel. The
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A Feishu or Lark account that can create or approve bot apps.
- Permission to run `nanobot gateway` continuously.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the Feishu channel
Open **Channels → Feishu** and follow the QR connection flow. Install support if prompted, then open the authorization link or scan the code. If using an existing app, enter its App ID and App Secret in the setup panel. Enable the channel, save, and follow any restart prompt.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
@@ -41,11 +43,11 @@ The easiest path is QR login:
nanobot channels login feishu
```
Open the printed URL or scan the QR code. nanobot writes the generated `appId`, `appSecret`, `domain`, and `enabled` fields into the active config.
Open the printed URL or scan the QR code. nanobot writes the generated `appId`,
`appSecret`, `domain`, and `enabled` fields into the active config.
In WebUI, open **Channels → Feishu** and choose **Connect** for the first bot, or **Add another assistant** below your existing assistants. Each new assistant has its own settings and sender approvals; adding one does not replace an existing bot. Cancel the QR flow to stop an unfinished authorization.
If QR login is unavailable, create a Feishu/Lark app manually and merge this shape into `~/.nanobot/config.json`:
If QR login is unavailable, create a Feishu/Lark app manually and merge this
shape into `~/.nanobot/config.json`:
```json
{
@@ -62,35 +64,29 @@ If QR login is unavailable, create a Feishu/Lark app manually and merge this sha
}
```
Omitting `allowFrom` enables pairing-only mode. A new user should DM the bot, get a pairing code, and be approved before using the bot normally.
Omitting `allowFrom` enables pairing-only mode. A new user should DM the bot,
get a pairing code, and be approved before using the bot normally.
For manual apps, enable the Bot capability, receive-message events, and Long Connection mode. If your app cannot get the `cardkit:card:write` permission, set `"streaming": false`.
For manual apps, enable the Bot capability, receive-message events, and Long
Connection mode. If your app cannot get the `cardkit:card:write` permission,
set `"streaming": false`.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
DM the bot first. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
DM the bot first. It should return a pairing code. Approve it from a trusted
local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
After approval, DM the bot again or mention it in a group chat:
```text
@@ -99,20 +95,22 @@ After approval, DM the bot again or mention it in a group chat:
## Security notes
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a static allowlist.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a
static allowlist.
- Keep `groupPolicy` as `"mention"` before inviting the bot into busy groups.
- Store app secrets through environment variables for deployed services.
- Review file, shell, and web tool access before adding more users.
## Troubleshooting
- If QR login is unavailable, use manual app setup from the full chat-apps reference.
- If streaming cards fail, confirm `cardkit:card:write` or set `"streaming": false`.
- If no messages arrive, check Feishu/Lark event permissions, Long Connection mode, and `nanobot gateway --verbose`.
- If a first DM returns a pairing code, approve it before testing normal replies.
- If WebUI cannot approve a pending code, check the reported error and select **Retry**. You do not need another code while the current one is valid.
- If WebUI reports that the pairing code could not be sent, the DM reached nanobot but its reply failed. Check the gateway log for the Feishu error and request ID, check that the app has permission to send messages as a bot (`im:message:send_as_bot`), and publish any permission changes. Then send another private message to retry; nanobot reuses the unexpired code. Pairing replies use plain text and do not need streaming-card permissions.
- If neither a code nor a pairing request appears, check the running gateway, the app's receive-message subscription, and which assistant you messaged. A saved App ID and App Secret mean **Configured**, not that message delivery has been tested. Do not set `allowFrom` to `*` to work around pairing failures.
- If QR login is unavailable, use manual app setup from the full chat-apps
reference.
- If streaming cards fail, confirm `cardkit:card:write` or set
`"streaming": false`.
- If no messages arrive, check Feishu/Lark event permissions, Long Connection
mode, and `nanobot gateway --verbose`.
- If a first DM returns a pairing code, approve it before testing normal
replies.
## Next: memory, automations, MCP tools
-43
View File
@@ -1,43 +0,0 @@
# iOS PWA top-edge rendering
[Issue #5772](https://github.com/HKUDS/nanobot/issues/5772) tracks washed-out controls at the top of an installed iOS PWA. This is separate from the mobile sidebar focus and double-tap fixes in #5839.
## Compatibility surface
The initial HTML includes one empty, non-interactive `.pwa-status-bar-surface` outside React's root. It only renders in standalone mode on engines supporting `-webkit-touch-callout` and text background clipping. Normal browser tabs and Chromium PWAs keep it `display: none`.
The pinned WebKit [fixed-container sampling implementation](https://github.com/WebKit/WebKit/blob/d620932d8ce37cf83f60d5c50dace2d50fed4f80/Source/WebCore/page/LocalFrameView.cpp#L2088) looks for fixed/sticky elements near the viewport edge, covering at least 90% of its width. A primary background must exceed the 10px thin-border threshold and must not be hidden or nearly transparent. Sampling can ignore `pointer-events`. Nanobot's relative/absolute header and small button backgrounds do not provide that full-width surface. This supports the candidate mechanism; it does not prove which WebKit revision ships on an affected device or establish the reported root cause. The CSS capability check is not an iOS version check: older compatible standalone WebKit engines also receive the surface.
The surface is 11px high, viewport-fixed, full-width, and above the application layers. It inherits the body's background color, including startup and live theme changes. Clipping that background to empty text prevents it from painting over controls while retaining the background style for WebKit's sampler. It has no focusable content and cannot intercept taps. It does not add padding, move the header, change viewport fitting, or animate an artificial overlay.
This is a compatibility workaround, **not a supported Apple status-bar API**. First-person device experiments describing the same mechanism:
- [Empty-text fixed surface on iOS 27](https://qiita.com/na-trium-144/items/0add98a80ca2391e3f17)
- [iOS PWA blur experiments, CSS-only update](https://tips.ojapp.app/en/ios-27-pwa-top-blur-workaround-2/)
Keep `viewport-fit=auto` and the existing status-bar metadata. Do not replace this with a guessed safe-area inset or claim that a desktop screenshot verifies iOS system compositing.
## What the evidence establishes
| Evidence | Establishes | Does not establish |
| --- | --- | --- |
| Pinned WebKit source | A fixed surface can satisfy edge-sampling checks, including the >10px background threshold | The exact device build uses the same algorithm or removes its system blur |
| External device experiments | This workaround has worked in other installed PWAs | It fixes nanobot on the reporter's device |
| DOM/CSS contract tests | The surface is empty, outside the React root, conditionally enabled, and retains its sampling styles | Browser layout, hit testing, or system compositing |
| Desktop browser probe with platform conditions bypassed | Layout, paint, click-through and theme behavior under the tested conditions | Native iOS capability detection or standalone-shell rendering |
Do not make the surface invisible with `opacity: 0`, `visibility: hidden`, or a transparent background: those remove the background the sampler is intended to find. Empty-text clipping keeps the background style without painting a strip.
## Device acceptance gate
HTML/CSS contract tests and desktop layout checks verify scoping, color inheritance, non-interference and safe-area preservation. They cannot prove the reported iOS system blur is gone. Before marking the issue resolved, record the actual device, full iOS version, nanobot commit and served frontend asset version, then compare the same device before/after. Confirm the pre-fix version reproduces the issue:
1. Completely quit and relaunch the installed PWA; verify the latest HTML is served.
2. Check sidebar/theme controls on new and existing chats, before and after scrolling and switching chats. A related [WebKit navigation regression](https://bugs.webkit.org/show_bug.cgi?id=305546) shows why a correct first frame is not sufficient; it is not confirmation of this report's root cause.
3. Switch light/dark themes, rotate portrait/landscape, and open/close the keyboard.
4. Open and close the sidebar and settings; verify top controls and one-tap navigation.
5. Compare an ordinary Safari tab and, when available, an unaffected older iOS PWA to rule out added space, painted strips, blocked input or zoom regressions.
Record results as **pass**, **fail**, or **not tested**, with before/after screenshots. If the old build does not reproduce, report that explicitly rather than attributing the absence of blur to this patch. Do not clear site data or reinstall the PWA just to obtain fresh assets; preserve user preferences and local state.
If the workaround stops matching WebKit behavior, re-check the upstream sampling implementation and device results rather than increasing padding or layer sizes. The separately reported portrait `@` selection failure is not addressed here.
-308
View File
@@ -1,308 +0,0 @@
# Connect nanobot as a Native Linear Agent
This guide takes you from an empty Linear channel configuration to a working @mention or delegated issue. The recommended path uses the nanobot WebUI and a pre-filled Linear app manifest. Review the generated URLs and subscriptions, and confirm that webhook delivery is enabled before testing a task.
> [!NOTE]
> Linear's Agent APIs are currently a Developer Preview. Their schema may change. Keep nanobot current when you use this channel.
## What this channel does
- A new task starts when someone explicitly @mentions the installed app or delegates an issue to it.
- An ordinary issue comment does not invoke nanobot.
- A follow-up inside the existing Agent Session continues the same nanobot session without another @mention.
- Linear's stop control asks nanobot to cancel the active turn. The sender must have access, just as for other requests. An activity already delivered to Linear cannot be recalled.
- nanobot reports its acknowledgement, tool activity, reasoning, and final answer as native Linear Agent Activities.
- Button choices are sent as Linear selection activities, and local outbound files are uploaded to Linear before they are linked in the response.
- Private `uploads.linear.app` links in the session prompt are downloaded with the workspace OAuth token and passed to nanobot as inbound media after access checks. A prompt can import up to 10 attachments and 40 MB in total; skipped or unavailable files are called out in the prompt instead of failing silently.
The OAuth request includes `app:mentionable` and `app:assignable`, in addition to `read` and `write`. Existing workspace installations must be reconnected to grant `app:assignable`.
The native channel owns Agent Session transport. Connect the Linear MCP app when the agent also needs tools for searching or changing Linear issues; OAuth scopes on the channel do not expose those actions as nanobot tools. MCP does not replace the channel's OAuth installation, webhook, or Agent Session transport.
## Before you start
There are two separate decisions: **connect a workspace**, then **choose who can use nanobot**. The administrator sets up the app once; teammates do not need to create their own apps, paste credentials, or scan a code.
```text
Prepare HTTPS → Create the Linear app → Save credentials in nanobot
→ Authorize a workspace → Enable members → Try an @mention
```
The HTTPS address receives Linear events. OAuth installs the app in a workspace. Member access controls who may ask your nanobot to do work. These steps serve different purposes; authorizing a workspace does not automatically approve all its members.
Prepare these four things:
| Requirement | What you need |
|---|---|
| Working nanobot | `nanobot agent -m "Hello"` returns a response |
| Linear access | Permission to create a private OAuth app; a workspace admin must approve its installation |
| Public HTTPS origin | A reachable address such as `https://nanobot.example.com`; use a fixed hostname for ongoing use |
| Local route | The public address forwards to nanobot's Linear listener, which defaults to port `3979` |
The public address is an **origin**, not a complete endpoint. Enter `https://nanobot.example.com`, not `https://nanobot.example.com/linear/webhook`.
The four network fields have different jobs:
| nanobot field | Who uses it | Recommended value |
|---|---|---|
| **Public HTTPS URL** | Linear calls this address over the internet | Your stable HTTPS origin |
| **Listen host** | nanobot binds this local interface | `127.0.0.1` for a same-machine proxy; `0.0.0.0` when a container or another host must reach it |
| **Listen port** | The proxy or tunnel forwards to this local port | Keep `3979` unless it conflicts with another service |
| **Webhook/OAuth paths** | nanobot distinguishes webhook delivery from OAuth callbacks | Keep the defaults unless your proxy requires different paths |
### Webhook and networking requirements
OAuth connects and authorizes the Linear workspace. A webhook sends new Linear tasks to nanobot; this integration does not poll for tasks. Both the OAuth return address and webhook must reach the same nanobot instance.
You do **not** need a public IP address when using an HTTPS tunnel such as Cloudflare Tunnel or Tailscale Funnel. On a publicly reachable server, Caddy, nginx, or another reverse proxy can provide HTTPS and forward requests to `127.0.0.1:3979`. Use a stable hostname for normal use: if the hostname changes, update **Public HTTPS URL** in nanobot and both registered URLs in the Linear app.
Choose the simplest option that matches your deployment:
| Your deployment | Recommended route |
|---|---|
| Home server, laptop, or a network behind NAT | A named HTTPS tunnel with a fixed hostname |
| VPS with a domain and existing HTTPS proxy | Add a reverse-proxy route to `127.0.0.1:3979` |
| Docker or Kubernetes | Route the ingress or proxy to the container's port `3979`; keep the public URL on the ingress |
| Short local test | A temporary HTTPS tunnel works; update nanobot's public URL and the app's callback and webhook URLs whenever its hostname changes |
With the default paths, the route must preserve these two requests:
```text
https://nanobot.example.com/linear/oauth/callback -> 127.0.0.1:3979
https://nanobot.example.com/linear/webhook -> 127.0.0.1:3979
```
If the proxy or tunnel runs on the same machine, set the advanced **Listen host** field to `127.0.0.1` so the listener is not exposed directly on the local network. Containers and separate reverse-proxy hosts may require `0.0.0.0`. The Linear listener serves plain HTTP locally; terminate HTTPS at the proxy or tunnel instead of exposing port `3979` directly to the internet.
Only the callback and webhook need public routes. Keep the nanobot WebUI and admin API private, for example behind a VPN or SSH tunnel. Do not point your public hostname at the WebUI port. An HTTPS endpoint is not an invitation to run the agent: webhooks must pass signature checks, and senders must pass access checks.
### Temporary HTTPS for a local test
Install [cloudflared](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/), then run it in a separate terminal:
```bash
cloudflared tunnel --url http://127.0.0.1:3979
```
Use the printed `https://<random-name>.trycloudflare.com` origin as **Public HTTPS URL** in the setup below. Keep the tunnel running throughout authorization and testing. The listener starts when you select **Connect Linear**, so a 502 before that step can mean the local listener has not started yet.
[Quick Tunnels](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/trycloudflare/) are intended for testing and generate a new hostname on restart. Update the nanobot public URL and the Linear app's Redirect URI and Webhook URL before continuing with a new hostname.
These settings must be updated together:
| Setting | Value with the new tunnel hostname |
|---|---|
| nanobot **Public HTTPS URL** | `https://<new-hostname>.trycloudflare.com` |
| Linear **Redirect URIs** | `https://<new-hostname>.trycloudflare.com/linear/oauth/callback` |
| Linear **Webhooks → URL** | `https://<new-hostname>.trycloudflare.com/linear/webhook` |
Updating only the Redirect URI allows OAuth to succeed but leaves task events pointing at the old tunnel. After updating the Webhook URL, also check its **Delivery status**; a correct URL does not enable delivery by itself.
## Recommended setup in the WebUI
Keep `nanobot webui` running throughout the setup.
### 1. Enter the public address
1. Open **Channels → Linear**.
2. Enter your public origin in **Public HTTPS URL**, for example `https://nanobot.example.com`.
3. Leave the three credential fields empty for now.
4. Wait for **Settings saved.**, then select **Create Linear app**. Selecting it before entering an address shows a prompt and returns focus to the URL field.
Saving a partial configuration at this point is expected. You will create the credentials in the next step.
### 2. Create the Linear app
1. Select **Create Linear app**. Sign in to the Linear workspace in which you want to create the app.
2. Review the pre-filled form. It should describe a **private** app and contain:
```text
Redirect URI: https://nanobot.example.com/linear/oauth/callback
Webhook URL: https://nanobot.example.com/linear/webhook
Webhook types: AgentSessionEvent, PermissionChange, OAuthAuthorization
```
3. Choose a short, recognizable app name and icon if you want to customize how nanobot appears in Linear.
4. Create the app.
5. In the app's **Webhooks** section, check **Delivery status**. If it is **Disabled**, use the adjacent **…** menu to enable delivery. Confirm the URL points to the current public origin and that **Events** includes **Agent session events** (`AgentSessionEvent`).
> [!IMPORTANT]
> OAuth authorization and webhook delivery are separate. Authorization can succeed while webhook delivery is disabled. In that state, Linear can create an Agent Session, but nanobot receives no task and Linear may report **Agent didn't start** or **nanobot failed to start**.
Do not add a `Comment` webhook subscription. Linear delivers new @mentions and Agent Session follow-ups through `AgentSessionEvent`; subscribing to comments would add events that this channel intentionally ignores.
### 3. Copy the three credentials into nanobot
In the new Linear app's settings, copy these values:
| Linear value | nanobot field |
|---|---|
| Client ID | **OAuth client ID** |
| Client Secret | **OAuth client secret** |
| Webhook signing secret | **Webhook signing secret** |
Return to **Channels → Linear** and paste all three values. Ordinary fields save automatically after a short pause. For each secret, select **Save** beside that field and wait for its **Saved** status. **Connect Linear** becomes available once the required settings are saved. Listener settings, callback paths, and allowed users are in **Advanced**; setup guides are in the dialog's **Help** menu.
A masked value with **Saved** means this instance already has the secret; it is not an empty input. To change it, select **Replace**, enter the new secret, then **Save**. **Cancel** or Escape leaves the saved secret unchanged. Leaving the field or showing the newly typed value does not save it. A failed save retains the draft for retry; the old secret is never sent back to the browser.
Closing the dialog waits for in-flight saves, but does not save an unsubmitted secret draft. Save each secret explicitly before continuing.
Treat the Client Secret and Webhook signing secret like passwords. They belong only in the nanobot configuration and the Linear application settings.
### 4. Authorize the workspace
1. Select **Connect Linear**.
2. Select **Continue in Linear** to open authorization in your browser. There is no QR step.
3. Choose the workspace, review the app's permissions and team access, and approve the installation as a workspace admin.
4. Return to nanobot and wait for the **Channel running** badge. The **Authorized workspaces** section lists the workspace separately.
nanobot enables the channel automatically after authorization. The gateway must remain running so Linear can deliver webhooks. Reopening the panel shows the running channel and its authorized workspaces without another authorization attempt. Use **… → Remove workspace** on a workspace to revoke its Linear OAuth tokens and remove the local installation; see the lifecycle controls below for what is kept.
The pre-filled manifest creates a private app for the current workspace. A distributable OAuth app can authorize additional workspaces; nanobot stores and refreshes each workspace installation separately.
### 5. Choose who can use nanobot
Under the workspace card, expand **Member access**, find yourself, and turn on your switch. Do the same for any teammates you want to invite. Wait for **Saved** beside each member; they can then use the agent without a pairing code.
You manage two levels here: **workspace → members**. A Linear team groups issues and has its own workflow; it is not another installation to configure in nanobot. The app can only work within the teams authorized in Linear. A member switch does not expand that team access or grant access to the nanobot admin UI.
Pairing codes remain available as an alternative: a member without an explicit switch setting can send a first prompt, have an administrator approve the code, and repeat the prompt. An explicit **off** switch overrides pairing approval; turn the switch on again to restore access.
### 6. Test the first task
1. Open an issue in the connected Linear workspace.
2. Add a comment that @mentions the app and includes a request, for example:
```text
@nanobot summarize the likely cause and suggest the next diagnostic step
```
You can instead delegate the issue to the app to start the Agent Session.
3. Open the Agent Session. You should first see a starting acknowledgement, followed by agent activity and a final response.
4. Send a follow-up inside that Agent Session. You do not need to @mention the app again there.
### Member access details
The list contains active human members of teams this app can access. It does not grant access to additional Linear teams or to the nanobot admin UI. Names are for display; permissions use stable user IDs scoped to the OAuth client and workspace. Profile images come from Linear's `avatarUrl` field and load directly from its `public.linear.app` or `uploads.linear.app` CDN without a referrer. Missing, unsupported or failed images fall back to initials; no extra account linking is needed. Workspace logos use Linear's optional `Organization.logoUrl` field with the same CDN restrictions. They load independently of the workspace and member lists; a missing or unavailable logo falls back to a workspace icon. Existing installations do not need to authorize again to retrieve a logo. Use **Refresh members** to refresh the directory and effective permission state. The UI prefetches on hover or keyboard focus and keeps visited lists in memory, scoped to this gateway, admin login, app configuration and workspace. Lists older than one minute stay visible while refreshing. This display cache is not used to authorize agent requests. Workspace cards are also cached for one minute within the current gateway, admin login and app configuration. Refreshing keeps existing cards visible, and a slow logo request never blocks member access controls. Expand **Advanced** to inspect OAuth scopes; authorization problems remain visible on the workspace card.
Each switch changes only after the server confirms the save; other members remain editable while it saves. A failed save may have an uncertain outcome (for example, after a timeout), so refresh before editing that member again. Failed refreshes keep the last confirmed list visible and show an error, rather than an empty directory.
New members are off by default. Existing pairing approvals and **Advanced → Allowed Linear users** remain valid until explicitly overridden by a member switch. An explicit **off** wins over both legacy approvals and `*`, even if a new pairing code is subsequently approved. Use the switch to enable that member again. If you keep `*`, new members will still be allowed automatically; the UI displays a warning. Remove `*` to require approval for new members.
Pairing remains a fallback for members without an explicit switch setting: approve their pending request in the WebUI pairing dialog, then repeat the prompt in the same Agent Session. You may also keep a static list of IDs in **Allowed Linear users**. Other channels' pairing behavior is unchanged.
At request admission nanobot checks current team membership through the app's Linear API authorization, including active status and excluding app accounts. Directory/API failure does not authorize a task; transient failures use the channel's bounded webhook retry path. This adds API requests and latency, rather than relying on stale cached permissions. Turning a member off blocks new requests (including stop requests); it does not cancel already admitted/running tasks or recall replies. Administrators should stop ongoing tasks separately.
By default, reasoning is posted as Linear thought activities. Turn off **Show reasoning** under **Advanced** for a quieter session. Use **Configure Linear MCP**, to the left of **Create Linear app**, to open Linear MCP's connection settings when prompts need to search, edit, or transition issues. Pairing and access guidance is available in the dialog's **Help** menu.
## Connect, remove, or reset workspaces
Each nanobot instance uses one configured Linear OAuth app, which may have multiple workspace installations. A **private** app can only be installed in its own workspace. To use the same app in another workspace, its distribution must allow that installation in Linear; changing a nanobot field cannot bypass this.
- **Connect workspace** uses the current app and opens the same browser authorization flow. Choose the other workspace in Linear, review team access, and authorize. You do not need another HTTPS address or another set of app credentials for the same app. Review member access in the new workspace.
- **… → Reauthorize** on a workspace updates its connection, without creating a duplicate or clearing its member choices. Use it to renew authorization or grant missing scopes. Cancelling authorization leaves existing connections alone.
- **… → Remove workspace** revokes that workspace's tokens and clears its local installation and member switches. Other workspaces are unaffected. Removing the last workspace also stops the channel. App credentials remain available for connecting again.
- **Advanced → Reset Linear connection** removes all installations for the current app, stops the channel, and clears this instance's Linear app settings, including its saved credentials. Use this when starting over or switching apps. If a step fails, the UI reports an incomplete reset; removed workspaces stay removed, and you can retry the remaining steps.
If authorization changes while a member refresh or removal is in progress, nanobot discards the stale result instead of restoring a removed connection or overwriting a new authorization. Refresh the workspace/member list and retry the action against the current connection.
Neither removal nor reset deletes the Linear workspace, app, issues or comments, nor nanobot conversation history or pairing approvals. Deleting the app itself is a separate action in Linear. After removing and reconnecting a workspace, member switches start fresh, but retained pairing approvals or an `allowFrom` entry can still grant access. **Reset is not a wipe of all authorization history.**
## Updating a remote installation
Member management includes both Python channel code and WebUI assets. A local branch does not update an already running remote gateway, and the browser UI served by that remote gateway is not replaced by installing a local client.
1. Develop and test in a separate checkout with test-only config/state. Do not copy production OAuth tokens, model keys, or pairing state into a development profile, or run a second gateway against the production webhook installation.
2. After review and deployment approval, back up the remote config, pairing file, and Linear SQLite state consistently (stop the gateway or use SQLite backup; copying just the database while WAL writes are active is not sufficient).
3. Update the remote source and dependencies to the reviewed revision, build the WebUI from that same revision, and restart the gateway. Preserve remote credentials and state. Existing OAuth scopes and webhook routes need not change.
4. Verify member listing, the existing owner's access, enable/disable behavior, and that the admin UI remains private. Grant teammate access only deliberately.
Member switches are stored in the instance's `linear/state.sqlite3`, separately from legacy pairing and config. Older code ignores those overrides: **do not blindly roll back after revoking access with a switch**, because old code could re-enable a member through a retained pairing approval or wildcard. Keep the channel disabled during rollback until the older allowlist/pairing configuration has been reconciled. Ordinary restarts and reconnecting the same OAuth app keep the saved member choices.
## Verify the setup
The setup is complete when all of these checks pass:
- **Channels → Linear** shows the channel as on with no runtime error.
- The Linear app's **Webhooks → Delivery status** is enabled, its URL uses the current public origin, and **Events** includes **Agent session events**.
- While the channel is running, opening `http://127.0.0.1:3979/linear/health` on the nanobot machine returns `{"ok":true}`. Use your configured host and port if you changed them.
- If your proxy also forwards `/linear/health`, its public URL returns `{"ok":true}`. This is optional: a proxy exposing only the callback and webhook can correctly return 404 for public health. Use successful OAuth and webhook delivery to verify those two routes; do not expose the admin UI for this check.
- A new comment with an explicit @mention creates an Agent Session and receives a response.
- Delegating an issue to the app creates an Agent Session and receives a response.
- A normal issue comment without an @mention does nothing.
- A follow-up inside the Agent Session receives a response without another @mention.
## Manual configuration
<details>
<summary>Manual configuration</summary>
Use this path when deployment tooling manages `~/.nanobot/config.json` directly. The WebUI path above is easier because it generates the Linear app definition and completes OAuth for you.
Merge this section into `~/.nanobot/config.json`:
```json
{
"channels": {
"linear": {
"enabled": true,
"clientId": "YOUR_LINEAR_CLIENT_ID",
"clientSecret": "YOUR_LINEAR_CLIENT_SECRET",
"webhookSigningSecret": "YOUR_LINEAR_WEBHOOK_SIGNING_SECRET",
"publicBaseUrl": "https://nanobot.example.com",
"host": "127.0.0.1",
"port": 3979,
"webhookPath": "/linear/webhook",
"oauthCallbackPath": "/linear/oauth/callback",
"allowFrom": ["YOUR_LINEAR_USER_ID"],
"showReasoning": true
}
}
}
```
Register these exact URLs in the Linear OAuth app:
```text
OAuth callback: https://nanobot.example.com/linear/oauth/callback
Webhook: https://nanobot.example.com/linear/webhook
```
Subscribe the webhook to exactly `AgentSessionEvent`, `PermissionChange`, and `OAuthAuthorization` and enable webhook delivery in the Linear app's settings. Do not subscribe to `Comment`. The OAuth connection step in the WebUI is still required: it installs the app and stores the workspace-scoped access and refresh tokens.
</details>
## Security and reliability
- OAuth uses authorization code flow, PKCE, a short-lived CSRF state, and the Linear app actor.
- Webhooks are verified against `Linear-Signature` using the raw request body before JSON parsing. nanobot also checks the delivery timestamp and configured OAuth Client ID.
- `Linear-Delivery` IDs are deduplicated.
- Verified events are committed to a local SQLite queue before nanobot returns HTTP 200. Queued webhook deliveries that have not yet been dispatched are retried after a restart. This does not guarantee resumption of an interrupted agent turn.
- Access and rotating refresh tokens are stored in the Linear channel state database, not in `config.json` or the browser.
- OAuth revocation removes the affected workspace installation locally.
Back up the nanobot instance data directory as carefully as other credentials. Do not publish `linear/state.sqlite3`, the Client Secret, or the Webhook signing secret.
## Troubleshooting
| Symptom | What to check |
|---|---|
| **Create Linear app** asks for a public address or waits for saving | Enter only the public HTTPS origin in **Public HTTPS URL** and wait for automatic saving to finish. If saving fails, correct the address or select **Retry**. |
| Linear rejects the callback or webhook URL | Use a public `https://` hostname. Do not use HTTP, localhost, a private IP, or a path in **Public HTTPS URL**. |
| `Invalid redirect_uri parameter for the application` | In the Linear app matching nanobot's Client ID, set **Redirect URIs** to the current public origin plus `/linear/oauth/callback` (or your configured OAuth path). It must match the authorization request's `redirect_uri`. Save, cancel the pending authorization in nanobot, and start **Connect Linear** again. |
| The tunnel URL changed | Update **Public HTTPS URL** in nanobot and the Redirect URI and Webhook URL in the Linear app, then start **Connect Linear** again. |
| Public health returns 502 | Start **Connect Linear** or enable the connected channel. Check local health first, then confirm the tunnel or proxy targets the same listener port. |
| OAuth opens but cannot finish | Keep `nanobot webui` running. Confirm the proxy forwards `/linear/oauth/callback` to the configured listen host and port. Then start **Connect Linear** again. |
| OAuth finishes in Linear but nanobot keeps waiting | Keep the nanobot connection dialog open. Confirm the Redirect URI reaches the same nanobot process, and inspect gateway logs for callback or token exchange errors. |
| A secret shows **Saved**, but no readable value | This is expected. The secret is stored on this instance and not returned to the browser. Use **Replace → Save** only when changing it. |
| Another workspace is unavailable during authorization | Check the current app's distribution and your installation permissions in Linear. A private app only works in its own workspace. **Connect workspace** does not create a new app. |
| The local health URL does not load | Start **Connect Linear** or enable the connected channel, then check the configured listen host and port. |
| **Agent didn't start**, **nanobot failed to start**, or a session stays on **Thinking…** without a response | First check **Webhooks → Delivery status** in the Linear app. If **Disabled**, enable it from **…**. Confirm the current Webhook URL and `AgentSessionEvent` subscription, then select **Retry** in the Linear session. OAuth success and a working `/linear/health` endpoint do not prove that Linear is sending events. |
| An @mention still gets no response with delivery enabled | Inspect **Webhook delivery failures** in the Linear app and run `nanobot gateway logs`. A 404 points to the webhook path; a 502 points to the listener or tunnel; a 401 can indicate a signing-secret mismatch or stale event timestamp. Confirm the Client ID and signing secret belong to the same app and the workspace authorization has not been revoked. |
| The first @mention returns a pairing code | Enable the member under the workspace's **Member access**, or approve the code in the WebUI pairing dialog, then repeat the prompt. An explicit off switch must be changed in **Member access**; pairing or allowlist changes do not override it. |
| Normal comments do nothing | This is intentional. Start a task by @mentioning the app, or continue inside an existing Agent Session. |
| Delegating an issue does not start a session | Reconnect the workspace so the installation grants `app:assignable`, then confirm the app can be selected as the issue delegate. |
| The agent can discuss an issue but cannot search or change it | Connect the Linear MCP app from **Configure Linear MCP**. The native channel transports the conversation but does not add issue-management tools. |
| Authorization reports missing scopes | Reconnect from nanobot. Do not reuse an authorization URL that omits `read`, `write`, `app:mentionable`, or `app:assignable`. |
For Linear's platform-side behavior, see the official [Agents guide](https://linear.app/developers/agents), [OAuth app manifest reference](https://linear.app/developers/oauth-app-manifests), [OAuth guide](https://linear.app/developers/oauth-2-0-authentication), and [webhook reference](https://linear.app/developers/webhooks).
+28 -19
View File
@@ -1,6 +1,8 @@
# How to Run a Long-Running AI Agent with nanobot
nanobot supports sustained goals, persistent sessions, scheduled automations, and local triggers for work that needs more than a single answer.
nanobot can keep agent work alive across turns through sustained goals,
persistent sessions, scheduled automations, local triggers, and a gateway
process that stays running.
## What you will build
@@ -11,36 +13,41 @@ nanobot supports sustained goals, persistent sessions, scheduled automations, an
## When to use this
Use this when the task is not a one-shot answer: project work, recurring checks, scheduled summaries, file maintenance, multi-step research, or local triggers from scripts and build jobs.
Use this when the task is not a one-shot answer: project work, recurring checks,
scheduled summaries, file maintenance, multi-step research, or local triggers
from scripts and build jobs.
## Before you start
## Install
Use an installation with a configured model that has already returned a reply. If this is your first setup, follow [Quick Start](../quick-start.md), then return here. Existing WebUI users can continue in the current instance.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
## Minimal working example
Your running WebUI or TUI already uses a gateway. In that chat, start a sustained goal:
Start a gateway:
```bash
nanobot gateway
```
From the WebUI or a chat session, start a sustained goal:
```text
/goal Review this workspace, identify missing tests, and propose the smallest next fix.
```
For scheduled or trigger-based runs, create the automation from the target chat so nanobot can link it to the correct session and project context.
To keep work running after closing the interactive launcher, promote the existing gateway from a terminal:
```bash
nanobot gateway --background
nanobot gateway status
```
Use the same `--config` and explicit `--workspace` selectors as your instance. In the TUI, `/detach` also keeps the gateway running while closing the client. A background gateway does not survive a machine shutdown by itself; see [Deployment](../deployment.md) for service management. Review [schedule restart behavior](../automations.md#delivery-and-reliability) before relying on a timed task.
For scheduled or trigger-based runs, create the automation from the target chat
so nanobot can link it to the correct session and workspace.
## Production notes
- Keep the gateway running for chat apps, WebUI sessions, automations, and local triggers.
- Keep the gateway running for chat apps, WebUI sessions, automations, and local
triggers.
- Use stable session keys or chat sessions for work that should preserve context.
- Keep goals bounded and explicit about done-ness. Active goals can exceed the ordinary iteration limit and consume more model tokens. Use `/stop` to interrupt work while keeping the goal, or `/cancel_goal` to cancel it; see [Goal controls](../chat-commands.md#goals).
- Keep goals bounded and explicit about done-ness.
- Review Automations in the WebUI before relying on a schedule.
## Security notes
@@ -52,8 +59,10 @@ Use the same `--config` and explicit `--workspace` selectors as your instance. I
## Troubleshooting
- If a goal appears stuck, inspect the active session and gateway logs.
- If an automation does not run, check that it is linked to a chat/session and that the gateway is still running.
- If a local trigger fails, check the command copied from the WebUI Automations view.
- If an automation does not run, check that it is linked to a chat/session and
that the gateway is still running.
- If a local trigger fails, check the command copied from the WebUI Automations
view.
## Related nanobot docs
+37 -35
View File
@@ -1,6 +1,7 @@
# Build a Mattermost AI Agent with nanobot
This guide connects nanobot to Mattermost through the built-in Mattermost channel, using WebSocket events and the Mattermost REST API.
This guide connects nanobot to Mattermost through the built-in Mattermost
channel, using WebSocket events and the Mattermost REST API.
## What this guide builds
@@ -11,26 +12,24 @@ This guide connects nanobot to Mattermost through the built-in Mattermost channe
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A Mattermost server URL.
- A bot token or personal access token for the bot account.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the Mattermost channel
Prepare the Mattermost bot token and team ID. In **Channels → Mattermost**, enter the server URL, token, and team ID. Use **Advanced** for group and thread policies; for DM pairing, choose **Allowlist** with an empty DM allowlist. Enable the channel, save, and follow any restart prompt.
DM approval does not restrict group access. With the mention policy below, any member can invoke the bot in a channel it can see. For DM-only access, set the group policy to **Allowlist** and leave the group allowlist empty. To allow selected channels, add their IDs; all members of those channels can then use the bot under the configured mention/thread rules.
<details>
<summary>Manual configuration</summary>
Merge this snippet into `~/.nanobot/config.json`:
```json
@@ -52,37 +51,37 @@ Merge this snippet into `~/.nanobot/config.json`:
}
```
`teamId` scopes the channel to a Mattermost team. Keep `groupPolicy` as `mention` for the first test. `groupPolicyInThread` can be `"mention"`, `"open"`, or `"allowlist"` and controls messages that reply inside a thread. If it is omitted, it inherits `groupPolicy`, preserving the behavior of existing configurations. Set it to `"open"` explicitly when follow-up messages in threads should not require another @mention.
`teamId` scopes the channel to a Mattermost team. Keep `groupPolicy` as
`mention` for the first test. `groupPolicyInThread` can be `"mention"`,
`"open"`, or `"allowlist"` and controls messages that reply inside a
thread. If it is omitted, it inherits `groupPolicy`, preserving the behavior
of existing configurations. Set it to `"open"` explicitly when follow-up
messages in threads should not require another @mention.
When `groupPolicy` is `"allowlist"`, `groupAllowFrom` remains the outer channel boundary for root posts and thread replies. A thread policy cannot open a channel that is not on that allowlist.
When `groupPolicy` is `"allowlist"`, `groupAllowFrom` remains the outer
channel boundary for root posts and thread replies. A thread policy cannot open
a channel that is not on that allowlist.
Mattermost DMs are open by default. Setting `dm.policy` to `"allowlist"` with no `dm.allowFrom` entries makes new DM senders receive a pairing code. Approve the code before using the bot normally.
Mattermost DMs are open by default. Setting `dm.policy` to `"allowlist"` with no
`dm.allowFrom` entries makes new DM senders receive a pairing code. Approve the
code before using the bot normally.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
DM the bot account. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
DM the bot account. It should return a pairing code. Approve it from a trusted
local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Then DM the bot again, or mention it in a channel where the bot has access:
```text
@@ -98,10 +97,13 @@ Then DM the bot again, or mention it in a channel where the bot has access:
## Troubleshooting
- If startup logs say `serverUrl and token must be configured`, check the camelCase config keys.
- If startup logs say `serverUrl and token must be configured`, check the
camelCase config keys.
- If DMs are ignored, review the `dm` policy and pairing approval state.
- If channel messages are ignored, confirm the bot is mentioned and belongs to the team/channel.
- If thread replies are surprising, review `groupPolicyInThread`, `replyInThread`, and `includeThreadContext`.
- If channel messages are ignored, confirm the bot is mentioned and belongs to
the team/channel.
- If thread replies are surprising, review `groupPolicyInThread`,
`replyInThread`, and `includeThreadContext`.
## Next: memory, automations, MCP tools
+19 -16
View File
@@ -1,30 +1,33 @@
# How to Add MCP Tools to an AI Agent with nanobot
nanobot can connect MCP servers and expose their tools to the agent alongside built-in file, shell, web, cron, image generation, and subagent tools.
nanobot can connect MCP servers and expose their tools to the agent alongside
built-in file, shell, web, cron, image generation, and subagent tools.
## What you will build
- a working nanobot agent
- one MCP server connected through **Apps → MCP**
- one MCP server configured in `config.json`
- a restricted set of tools available to the model
## When to use this
Use MCP when a tool already exists as an MCP server, when another application publishes an MCP adapter, or when you want a clean boundary between nanobot and external tool logic.
Use MCP when a tool already exists as an MCP server, when another application
publishes an MCP adapter, or when you want a clean boundary between nanobot and
external tool logic.
## Before you start
## Install
Complete [Quick Start](../quick-start.md) if nanobot is not installed or cannot reply yet. If you already have a working WebUI or CLI session, continue here using that instance; no reinstall or second gateway is needed.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
Install the MCP server's own runtime separately. For example, many local MCP servers use `npx` or `uvx`.
Install the MCP server's own runtime separately. For example, many local MCP
servers use `npx` or `uvx`.
## Minimal working example
Open **Apps → MCP**, choose a preset or add a custom server, configure its command or endpoint, limit its enabled tools, and save. Follow any connection or restart prompt, then mention the integration with `@` in chat and request a small test action.
<details>
<summary>Manual configuration</summary>
Add a stdio MCP server to `~/.nanobot/config.json`:
```json
@@ -41,8 +44,6 @@ Add a stdio MCP server to `~/.nanobot/config.json`:
}
```
</details>
Restart nanobot, then ask a question that needs the MCP tool.
## Production notes
@@ -57,13 +58,15 @@ Restart nanobot, then ask a question that needs the MCP tool.
- HTTP/SSE MCP URLs use the same SSRF guard as web fetch.
- Local/private HTTP endpoints require an explicit `tools.ssrfWhitelist` entry.
- Stdio MCP servers run local processes; review their command and arguments.
- Do not pass secrets in command-line args when environment variables or headers are available.
- Do not pass secrets in command-line args when environment variables or headers
are available.
## Troubleshooting
- Check MCP startup logs on the running gateway; use `--verbose` when restarting it for diagnosis.
- Start `nanobot gateway --verbose` and check MCP startup logs.
- Confirm the MCP command works by itself before debugging nanobot.
- If an HTTP MCP server is blocked, review the SSRF whitelist and use a narrow host CIDR.
- If an HTTP MCP server is blocked, review the SSRF whitelist and use a narrow
host CIDR.
## Related nanobot docs
@@ -0,0 +1,74 @@
# How to Run an OpenAI-Compatible Agent API with nanobot
nanobot can expose a local OpenAI-compatible endpoint behind
`/v1/chat/completions`. This lets existing OpenAI-style clients talk to a
tool-using nanobot agent instead of a raw model.
## What you will build
- a working nanobot agent
- a local API server on `127.0.0.1:8900`
- a `/v1/chat/completions` request
- optional session isolation with `session_id`
## When to use this
Use this when an existing client, another language, or a separate process
already knows how to call an OpenAI-compatible API. Use the Python SDK when you
want in-process access to sessions, memory, runtime helpers, and hooks.
## Install
```bash
python -m pip install nanobot-ai
nanobot plugins enable api
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
## Minimal working example
Start the API server:
```bash
nanobot serve
```
Call the chat endpoint:
```bash
curl http://127.0.0.1:8900/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "hi"}],
"session_id": "demo"
}'
```
## Production notes
- Pass `session_id` to isolate users, jobs, or workflows.
- Streaming uses Server-Sent Events when `stream` is `true`.
- `/v1/models` reports the fixed model surface expected by compatible clients.
- File uploads are supported through JSON base64 or multipart form data.
## Security notes
- Local `127.0.0.1` usage does not require an API key.
- If `api.host` is `0.0.0.0` or `::`, configure `api.apiKey` before startup.
- Treat the API as agent access, not just model access: tools and workspace
permissions still matter.
## Troubleshooting
- If `/v1/chat/completions` fails, test `nanobot agent -m "Hello!"` first.
- If remote clients cannot connect, check `api.host`, `api.port`, firewall, and
API key configuration.
- If sessions mix together, pass unique `session_id` values.
## Related nanobot docs
- [Nanobot OpenAI-Compatible API](../openai-api.md)
- [Python SDK](../python-sdk.md)
- [Configuration](../configuration.md)
- [Deployment](../deployment.md)
+24 -9
View File
@@ -1,6 +1,9 @@
# Nanobot Python SDK: Run an AI Agent from Python
This guide shows when to use the Nanobot Python SDK instead of calling a model directly. The SDK runs the same agent runtime used by the CLI: model routing, tools, workspace access, session history, memory, streaming events, and runtime helpers.
This guide shows when to use the Nanobot Python SDK instead of calling a model
directly. The SDK runs the same agent runtime used by the CLI: model routing,
tools, workspace access, session history, memory, streaming events, and runtime
helpers.
## What you will build
@@ -10,11 +13,20 @@ This guide shows when to use the Nanobot Python SDK instead of calling a model d
## When to use this
Use the Python SDK for notebooks, evals, product backends, local scripts, workflow runners, and integrations that need direct access to agent sessions, memory, hooks, runtime state, or structured run results.
Use the Python SDK for notebooks, evals, product backends, local scripts,
workflow runners, and integrations that need direct access to agent sessions,
memory, hooks, runtime state, or structured run results.
## Before you start
Use the OpenAI-compatible API instead when another language or process should
call nanobot over HTTP.
Use an installation with a configured model that has already returned a reply. If this is your first setup, follow [Quick Start](../quick-start.md), then return here. Existing WebUI users can continue in the current instance.
## Install
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
## Minimal working example
@@ -36,10 +48,10 @@ asyncio.run(main())
## Production notes
- Reuse one `Nanobot` instance for related work.
- Pass `session_key` when a job or eval case needs persistent history. Different keys share workspace files and long-term memory.
- Use `bot.stream(...)` when the caller needs live text, tool, or failure events.
- Pass `session_key` when a user, job, or eval case needs persistent history.
- Use `bot.stream(...)` when the caller needs live text, tool, or failure
events.
- Use hooks for audit logs or custom observability.
- For short-lived scripts, see [Persist memory](../python-sdk.md#persist-memory-in-a-short-lived-script): closing the SDK does not run Dream.
## Security notes
@@ -49,12 +61,15 @@ asyncio.run(main())
## Troubleshooting
- If SDK code fails, first run `nanobot agent -m "Hello!"` in the same environment.
- Print `bot.runtime.workspace` and `bot.runtime.model` to confirm the expected config loaded.
- If SDK code fails, first run `nanobot agent -m "Hello!"` in the same
environment.
- Print `bot.runtime.workspace` and `bot.runtime.model` to confirm the expected
config loaded.
- Use explicit `config_path` and `workspace` when scripts run from services.
## Related nanobot docs
- [Nanobot Python SDK](../python-sdk.md)
- [OpenAI-Compatible API](../openai-api.md)
- [Configuration](../configuration.md)
- [Concepts](../concepts.md)
+34 -35
View File
@@ -1,6 +1,9 @@
# Build a QQ AI Agent with nanobot
This guide connects nanobot to QQ through the official `qq` channel. The official channel uses the botpy SDK and currently focuses on private messages. For QQ group chat and OneBot v11 workflows, use the Napcat section in the full chat-apps reference.
This guide connects nanobot to QQ through the official `qq` channel. The
official channel uses the botpy SDK and currently focuses on private messages.
For QQ group chat and OneBot v11 workflows, use the Napcat section in the full
chat-apps reference.
## What this guide builds
@@ -11,33 +14,33 @@ This guide connects nanobot to QQ through the official `qq` channel. The officia
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- Access to the QQ Open Platform.
- A QQ account added to the bot sandbox for testing.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the QQ channel
In **Channels → QQ**, scan the QR code with mobile QQ. nanobot saves the AppID and Secret automatically, enables the channel, and follows any installation or restart prompt.
Choose **Enter credentials manually** to use existing credentials. **Rebind bot** may interrupt other apps using this QQ bot. If the App Secret is reset, the old secret becomes invalid and those apps need the new secret.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
nanobot plugins enable qq
```
In the QQ Open Platform, create a bot application and copy the AppID and AppSecret. Add your QQ account to the sandbox test members, then merge this snippet into `~/.nanobot/config.json`:
In the QQ Open Platform, create a bot application and copy the AppID and
AppSecret. Add your QQ account to the sandbox test members, then merge this
snippet into `~/.nanobot/config.json`:
```json
{
@@ -52,47 +55,43 @@ In the QQ Open Platform, create a bot application and copy the AppID and AppSecr
}
```
Omitting `allowFrom` enables pairing-only mode. A new private sender should get a pairing code before normal agent access.
Omitting `allowFrom` enables pairing-only mode. A new private sender should get
a pairing code before normal agent access.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
Send the QQ bot a private message from a sandbox account. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
Send the QQ bot a private message from a sandbox account. It should return a
pairing code. Approve it from a trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Send the message again after approval.
## Security notes
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a static allowlist.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a
static allowlist.
- Keep sandbox testing separate from production publishing.
- Store QQ AppSecret through environment variables for deployed services.
- Use Napcat only when you intentionally need a QQ account bridge and group chat features.
- Use Napcat only when you intentionally need a QQ account bridge and group chat
features.
## Troubleshooting
- If private messages do not arrive, confirm the sender is in the QQ bot sandbox and the gateway is running.
- If private messages do not arrive, confirm the sender is in the QQ bot sandbox
and the gateway is running.
- If output formatting is unreliable, keep `msgFormat` as `"plain"`.
- If a first private message returns a pairing code, approve it before testing normal replies.
- If a first private message returns a pairing code, approve it before testing
normal replies.
- If you need QQ groups, see the Napcat section in the full chat-apps reference.
## Next: memory, automations, MCP tools
-71
View File
@@ -1,71 +0,0 @@
# Connect to an Existing Remote nanobot
Use your local nanobot WebUI to connect directly to a nanobot instance already running on a remote Linux server—without manually setting up SSH port forwarding or exposing a public admin port.
Open your local WebUI, click the host name (**Local**) at the bottom of the sidebar, and choose **Manage connections…**. From there, pick one of two ways to connect:
- **Quick pairing (recommended for Linux servers):** Copy one command, run it on the server, and click the return link—no SSH key setup or config path needed.
- **Existing SSH settings:** Connect using an SSH address (like `ubuntu@your-server`) or an alias from your local `~/.ssh/config`.
> [!NOTE]
> This connects to a nanobot instance **already running on your server**. It does not install nanobot, copy workspaces, or move conversations.
## Quick Pairing (Recommended)
For a Linux server with nanobot already installed:
1. In your local WebUI, open **Manage connections… → Connect to remote nanobot** and click **Copy command**.
2. Open your server's terminal (for example, your cloud provider's web console or SSH) and run the copied command in the environment where nanobot is installed.
3. Follow the prompts to pick the nanobot configuration (if there are multiple), confirm the server address if asked, and approve **full nanobot access** for this computer.
4. Click the **Return to nanobot** link printed in the terminal (on the same computer and browser), review the server details, and click **Connect**.
If your terminal cannot open links, choose **Other ways → Use a connection code instead** in the WebUI and paste the `nbpc1.…` code from the terminal.
- **Security:** The invitation expires in 10 minutes, the server's SSH host key is pinned automatically, and the dedicated device key expires after 90 days. No relay server or public WebUI port is used.
- **Requirements:** Linux server with OpenSSH (`restrict` and `expiry-time` support), `/usr/bin/python3`, and an Ed25519 host key. Windows servers and containers are not supported by quick pairing—use existing SSH settings instead.
> [!CAUTION]
> A paired connection grants **full access to nanobot** on that server, including its tools and files. Never import a connection code from someone you do not trust.
## Connect with Existing SSH Settings
Choose **Other ways → Use existing SSH settings** if you already have SSH key access to the server (including Docker or non-systemd setups):
1. Enter an SSH address (such as `ubuntu@your-server`), pick a suggested host from your `~/.ssh/config`, or paste a simple SSH command like `ssh -p 2222 -i ~/.ssh/key ubuntu@your-server`.
2. Expand **Connection options** if you need a custom port, SSH config file, private key path, remote config path, or service account.
3. Click **Connect**. On first connection, verify the server's SSH fingerprint before continuing.
After SSH connects, nanobot looks for your server's config and `nanobot*.service` systemd units automatically. If it cannot find one (for example, in Docker or a custom path), enter the server's config path manually.
**Prerequisites for existing SSH:**
- Your local WebUI runs on localhost with the system OpenSSH client available.
- Your SSH key already works for that server (encrypted keys should be unlocked in your SSH agent; interactive SSH passwords are not supported).
- Python 3 (`python3` or `python`) is available on the server, and the remote nanobot has `tokenIssueSecret` (or `token`) set in its `config.json`.
## Switching, Disconnecting, and Revoking
- **Switch hosts:** Click the host name at the bottom of the sidebar to switch between **Local** and saved servers (up to four connected at once). Each host keeps its own chat view and draft while connected.
- **Disconnect:** Closes the local SSH tunnel without stopping the remote nanobot.
- **Forget server:** Removes the saved entry and local pairing keys from this computer. It does not touch remote conversations or files.
- **Revoke a paired device:** Forgetting a server locally does not revoke its server-side key. To revoke access on the server, run the command shown in the server's **Connection details**:
```bash
nanobot remote revoke DEVICE_ID --ssh-user LOGIN_ACCOUNT
```
### Versions and updating the right machine
Open a server's **… → Version & compatibility** in **Manage connections…** to check whether your local WebUI and remote gateway are compatible. Same-version local and remote installs are recommended—align versions first when troubleshooting.
- **Update this server:** Update nanobot on the remote machine using its original install method, restart it, and reconnect.
- **Update this computer:** Update your local nanobot installation and reconnect.
See [Updating nanobot](../updating.md) for update steps.
## Troubleshooting
- **SSH works in terminal but not in WebUI:** Make sure nanobot was started in an environment that can reach your SSH agent, and check **Connection options** for the right key or SSH config file.
- **Paired device rejected after expiry or revocation:** Re-run **Quick pairing** to issue a fresh device key.
- **Remote WebUI password or port changed:** Re-pair the server (or update the connection settings) so nanobot picks up the new config.
- **Backing up local remote-connection settings:** Stop your local gateway and back up the `webui/` folder beside your local `config.json` (preserving private file permissions). Do not copy it to an untrusted computer, as it grants access to your paired remote servers.
+27 -20
View File
@@ -1,6 +1,7 @@
# How to Secure a Local AI Agent with nanobot
This guide covers the practical controls to review before letting a nanobot agent access files, shell commands, web fetch, chat apps, or remote users.
This guide covers the practical controls to review before letting a nanobot
agent access files, shell commands, web fetch, chat apps, or remote users.
## What you will build
@@ -11,19 +12,19 @@ This guide covers the practical controls to review before letting a nanobot agen
## When to use this
Use this before exposing nanobot to teammates, chat apps, public networks, broad web access, or unattended automations.
Use this before exposing nanobot to teammates, chat apps, public networks, broad
web access, or unattended automations.
## Before you start
## Install
If nanobot is already open, continue in that WebUI. Otherwise follow the [first-run guide](../start-without-technical-background.md) to install it, configure a model, and send a test message.
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
## Minimal working example
Open **Settings → Advanced**. Enable workspace restriction, then choose the shell sandbox supported by your host (`bwrap` on Linux or `seatbelt` on macOS). Disable shell execution when the agent does not need it. Follow any restart prompt.
<details>
<summary>Manual configuration</summary>
Start with workspace restriction:
```json
@@ -38,30 +39,36 @@ Start with workspace restriction:
}
```
`bwrap` is Linux-only and requires bubblewrap. On macOS, use `"sandbox": "seatbelt"`. Windows has no supported OS shell sandbox; disable shell execution if the application-level workspace guard is insufficient.
</details>
`bwrap` is Linux-only and requires bubblewrap. On macOS or Windows, keep
`restrictToWorkspace` enabled and review shell access carefully.
## Production notes
- Use environment variables for provider keys, bot tokens, and mailbox passwords.
- Use [separate instances and workspaces](../multiple-instances.md) for data that must not share memory. Project selection inside one instance does not isolate memory. Use separate OS accounts or containers for mutually untrusted users.
- Prefer [pairing](../configuration.md#pairing) for DM-capable chat apps. Slack and Mattermost DMs default to open access: set `dm.policy` to `"allowlist"` to require approval. Configure group access separately; mention-only controls when the bot responds, not who is trusted.
- Bind WebUI and WebSocket listeners to localhost unless remote access is intentional. Share [WebUI access](../webui.md#sharing-access) only with trusted administrators; it has no per-user roles or private topic ownership.
- Use environment variables for provider keys, bot tokens, and mailbox
passwords.
- Keep one workspace per trust boundary.
- Prefer pairing for DM-capable chat apps, use narrow `allowFrom` lists only
when static allowlists are intentional, and keep group policy mention-only at
first.
- Bind WebUI, WebSocket, and API services to localhost unless remote access is
intentional.
## Security notes
- `restrictToWorkspace` is an application-level guard, not an OS sandbox.
- `tools.exec.enable: false` removes shell execution entirely.
- HTTP web fetch and HTTP MCP use SSRF protections by default. Shell commands and stdio MCP processes are outside this guard. Neither shell sandbox blocks network access; use host or container egress controls for an offline deployment.
- HTTP web fetch and HTTP MCP use SSRF protections by default.
- Adding broad `tools.ssrfWhitelist` ranges increases exposure.
- On channels using the common sender allowlist, `allowFrom: ["*"]` bypasses pairing and allows every sender. Slack and Mattermost use the DM and group policies described above.
- `allowFrom: ["*"]` bypasses pairing and means anyone who can reach that
channel can talk to the bot.
## Troubleshooting
- If a needed file cannot be read, confirm the active workspace path.
- If a shell command fails under `bwrap`, check whether the command needs files outside the sandbox.
- If local HTTP tools are blocked, review the SSRF whitelist and use a narrow CIDR.
- If a shell command fails under `bwrap`, check whether the command needs files
outside the sandbox.
- If local HTTP tools are blocked, review the SSRF whitelist and use a narrow
CIDR.
## Related nanobot docs
+47 -18
View File
@@ -1,50 +1,78 @@
# How to Run a Self-Hosted AI Agent with nanobot
This guide sets up nanobot as a self-hosted AI agent runtime on your own machine or server. The result is a gateway process for the WebUI, chat apps, and automations.
This guide sets up nanobot as a self-hosted AI agent runtime on your own
machine or server. The result is a gateway process that can serve the WebUI,
chat apps, automations, and API integrations.
## What you will build
- a nanobot config and workspace under your control
- a model provider connected through `config.json`
- a long-running `nanobot gateway`
- optional browser and chat app access
- optional browser, chat app, and API access
## When to use this
Use this path when you want local or server-side ownership of the agent process, workspace files, memory files, and provider keys. It is also the right path when the agent must keep running after one terminal command finishes.
Use this path when you want local or server-side ownership of the agent process,
workspace files, memory files, and provider keys. It is also the right path when
the agent must keep running after one terminal command finishes.
## Choose your starting point
## Install
**Already chatting in the WebUI:** you already have a self-hosted agent and a running gateway. Open **Channels** to connect a chat platform; use the same running gateway. If you want it to survive closing the launcher, follow [long-running gateway setup](./deploy-nanobot-gateway.md).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
```
**New desktop installation:** follow the [quick start](../quick-start.md), configure a model in **Settings → Models**, and send `Hello!`. A normal browser reply confirms the setup; no additional CLI test or second gateway is required.
Complete the CLI check before deploying the gateway. A deployment problem is
much easier to debug after the provider and model are known to work.
**New headless server:** follow the [Docker setup](../deployment.md#docker-compose), or install on the host using the [quick start's terminal setup](../quick-start.md). Verify the selected provider before installing a persistent service.
## Minimal working example
Self-hosting keeps the agent runtime and its state on your machine. A hosted model provider still receives prompts and any file content included in them. For local model inference, use the [Ollama setup](../provider-cookbook.md#recipe-ollama-local-model); local inference alone does not disable network-capable tools.
For chat apps, automations, and WebSocket delivery, start the gateway:
## Confirm the result
```bash
nanobot gateway
```
Send a message through the interface you intend to use. Check that it replies, then confirm the chosen gateway or service stays running after you close the setup terminal. Browser, chat channels, and automations use the gateway.
For the browser surface, use the WebUI launcher instead. It can start and manage
the local gateway for you:
```bash
nanobot webui
```
Or connect a channel in `~/.nanobot/config.json`, then keep the same gateway
process running for messages.
## Production notes
- Use Docker, systemd, or a macOS LaunchAgent when the process should survive terminal exits.
- Give every deployed instance a distinct config path, workspace path, and port set.
- Keep secrets in environment variables and start the service from the same environment.
- Use gateway health checks alongside chat app delivery.
- Use Docker, systemd, or a macOS LaunchAgent when the process should survive
terminal exits.
- Give every deployed instance a distinct config path, workspace path, and port
set.
- Keep secrets in environment variables and start the service from the same
environment.
- Use health checks against the gateway or API process, not chat app delivery as
the only signal.
## Security notes
- Bind local-only services to `127.0.0.1` unless you intentionally expose them.
- Prefer pairing for DM-capable chat apps, and keep any static `allowFrom` allowlists strict.
- Enable `tools.restrictToWorkspace`; on Linux, use the bubblewrap sandbox for shell execution.
- Set an API key before binding the OpenAI-compatible API to a public interface.
- Prefer pairing for DM-capable chat apps, and keep any static `allowFrom`
allowlists strict.
- Enable `tools.restrictToWorkspace`; on Linux, use the bubblewrap sandbox for
shell execution.
## Troubleshooting
- Run `nanobot status` with the same `--config` and `--workspace` flags used by the service.
- Run `nanobot status` with the same `--config` and `--workspace` flags used by
the service.
- Run `nanobot gateway --verbose` while debugging channel startup.
- Check port conflicts if the WebUI or gateway health endpoint fails to bind.
- Check port conflicts if the WebUI, WebSocket channel, or API endpoint fails to
bind.
## Related nanobot docs
@@ -52,3 +80,4 @@ Send a message through the interface you intend to use. Check that it replies, t
- [Multiple Instances](../multiple-instances.md)
- [Configuration](../configuration.md)
- [Chat Apps](../chat-apps.md)
- [OpenAI-Compatible API](../openai-api.md)
+31 -34
View File
@@ -1,6 +1,7 @@
# Build a Slack AI Agent with nanobot
This guide connects nanobot to Slack through Socket Mode. No public webhook URL is required for the first working setup.
This guide connects nanobot to Slack through Socket Mode. No public webhook URL
is required for the first working setup.
## What this guide builds
@@ -11,32 +12,32 @@ This guide connects nanobot to Slack through Socket Mode. No public webhook URL
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- Permission to create a Slack app in a workspace.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the Slack channel
Create a Slack app with Socket Mode, a bot token, an app-level token with `connections:write`, and the required event subscriptions. In **Channels → Slack**, enter those tokens, enable the channel, and save. For pairing, expand **Advanced**, set the DM policy to **Allowlist**, and leave its allowlist empty; follow any restart prompt.
DM approval does not restrict group access. With the mention policy below, any member can invoke the bot in a channel it can see. For DM-only access, set the group policy to **Allowlist** and leave the group allowlist empty. To allow selected channels, add their IDs; all members of those channels can then use the bot under the configured mention/thread rules.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
nanobot plugins enable slack
```
In Slack, create an app, enable Socket Mode, create an app-level token with `connections:write`, add bot scopes, subscribe to bot events, and install the app to your workspace.
In Slack, create an app, enable Socket Mode, create an app-level token with
`connections:write`, add bot scopes, subscribe to bot events, and install the
app to your workspace.
Merge this snippet into `~/.nanobot/config.json`:
@@ -56,33 +57,26 @@ Merge this snippet into `~/.nanobot/config.json`:
}
```
Slack DMs are open by default. Setting `dm.policy` to `"allowlist"` with no `dm.allowFrom` entries makes new DM senders receive a pairing code. Approve the code before using the bot normally.
Slack DMs are open by default. Setting `dm.policy` to `"allowlist"` with no
`dm.allowFrom` entries makes new DM senders receive a pairing code. Approve the
code before using the bot normally.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
DM the Slack bot directly. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
DM the Slack bot directly. It should return a pairing code. Approve it from a
trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Then DM the bot again, or mention it in a channel:
```text
@@ -91,7 +85,8 @@ Then DM the bot again, or mention it in a channel:
## Security notes
- Keep `groupPolicy` as `mention` unless the bot is intentionally listening to every channel message.
- Keep `groupPolicy` as `mention` unless the bot is intentionally listening to
every channel message.
- Keep `dm.policy` as `"allowlist"` when you want pairing-based approval.
- Use `groupAllowFrom` with allowlist mode for approved channels.
- Reinstall the Slack app after changing scopes.
@@ -100,8 +95,10 @@ Then DM the bot again, or mention it in a channel:
## Troubleshooting
- If Socket Mode fails, confirm the app-level token starts with `xapp-`.
- If the bot cannot send files, add `files:write`, reinstall the app, and restart nanobot.
- If a DM responds normally without pairing, check that `dm.policy` is `"allowlist"`.
- If the bot cannot send files, add `files:write`, reinstall the app, and
restart nanobot.
- If a DM responds normally without pairing, check that `dm.policy` is
`"allowlist"`.
- If channel messages are ignored, check event subscriptions and group policy.
## Next: memory, automations, MCP tools
+60 -43
View File
@@ -1,6 +1,7 @@
# Connect Telegram to nanobot
This guide connects one Telegram bot to nanobot. Messages sent to that bot use your normal nanobot model, tools, memory, and workspace.
This guide connects one Telegram bot to nanobot. Messages sent to that bot use
your normal nanobot model, tools, memory, and workspace.
## What this guide builds
@@ -11,35 +12,49 @@ This guide connects one Telegram bot to nanobot. Messages sent to that bot use y
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working nanobot CLI reply:
```bash
nanobot agent -m "Hello!"
```
- A Telegram account.
- A bot token: open Telegram, find `@BotFather`, send `/newbot`, follow its name/username prompts, and copy the returned token. Keep the token private.
- A bot token from `@BotFather`.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Connect Telegram in the WebUI
Open **Channels → Telegram**:
Start the WebUI:
1. If Telegram support is not installed, turn on its switch and confirm the installation.
```bash
nanobot webui
```
Open **Settings → Channels → Telegram**:
1. If Telegram support is not installed, turn on its switch and confirm the
installation.
2. Paste the token from BotFather.
3. If the gateway cannot reach Telegram directly, set an address such as `http://127.0.0.1:7890` in **Settings → Advanced → Shared proxy**, then enable **Use proxy** in Telegram's advanced options.
4. Save and enable Telegram. For a first private setup, leave the sender allowlist empty: new senders must pair before they can use the agent. Do not set it to `*`.
3. If the gateway cannot reach Telegram directly, expand **Advanced** and enter
an HTTP or SOCKS proxy such as `http://127.0.0.1:7890`.
4. Save and enable Telegram.
The configuration badge appears as soon as a bot token is saved. A connection check is separate: if Telegram is temporarily unreachable, the saved configuration remains valid and the bot can continue working in environments where the gateway has network access.
The configuration badge appears as soon as a bot token is saved. A connection
check is separate: if Telegram is temporarily unreachable, the saved
configuration remains valid and the bot can continue working in environments
where the gateway has network access.
Saved tokens and proxy URLs are masked. **Use proxy** applies the shared address to both the connection check and normal Telegram traffic.
Saved tokens and proxy URLs are masked. A proxy entered here is used both for
the connection check and for normal Telegram traffic.
## Manual setup
<details>
<summary>Manual configuration</summary>
For a headless installation, install Telegram support:
```bash
@@ -50,30 +65,32 @@ Then merge this snippet into `~/.nanobot/config.json`:
```json
{
"network": { "proxy": "http://127.0.0.1:7890" },
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"useProxy": true
"proxy": "http://127.0.0.1:7890"
}
}
}
```
Leave `useProxy` off when the gateway can reach Telegram directly.
Omit `proxy` when the gateway can reach Telegram directly.
Omitting `allowFrom` enables pairing-only mode. The first DM from a new user gets a pairing code instead of agent access.
Omitting `allowFrom` enables pairing-only mode. The first DM from a new user
gets a pairing code instead of agent access.
Telegram uses long polling by default. Webhook mode is available for public HTTPS deployments; start with long polling for the first test.
Telegram uses long polling by default. Webhook mode is available for public
HTTPS deployments; start with long polling for the first test.
</details>
## Run nanobot gateway
## Apply the settings
```bash
nanobot channels status
nanobot gateway
```
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
Leave the gateway running while you test messages.
## Test a message
@@ -83,37 +100,37 @@ Open Telegram, DM the bot, and send:
Hello from Telegram
```
The bot should reply with a pairing code. Return to the WebUI pairing prompt and enter the code from your own Telegram private chat. Do not approve codes from other people. An unapproved sender receives a code, not an agent reply.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
The bot should reply with a pairing code. Approve it from an already trusted
surface, such as the local CLI:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Send the message again after approval. Confirm that your private chat now receives a normal agent reply.
Send the message again after approval. The reply should use the same model and
workspace as your local CLI check.
## Security notes
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a static allowlist instead of code approval.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a
static allowlist instead of code approval.
- Do not use `allowFrom: ["*"]` unless the bot is isolated or intentionally public.
- Rotate the BotFather token if it is pasted into logs or shared files.
- Review tool access before adding group chats or more users.
## Troubleshooting
- If the channel is not listed, run `nanobot plugins enable telegram` again in the same Python environment.
- If the WebUI shows a saved configuration but the live check cannot reach Telegram, the token is still saved. Confirm the gateway can reach `api.telegram.org`, or configure **Settings → Advanced → Shared proxy** and turn on Telegram's **Use proxy** switch.
- If Telegram rejects the token, copy the current token from BotFather or regenerate it.
- If messages do not arrive, check the Telegram runtime status in **Channels** and the logs of the running gateway. Confirm it is enabled and can reach Telegram; do not start a second gateway to diagnose the first.
- If a first DM returns a pairing code, that is expected. Approve the code before testing normal agent replies.
- If the channel is not listed, run `nanobot plugins enable telegram` again in
the same Python environment.
- If the WebUI shows a saved configuration but the live check cannot reach Telegram,
the token is still saved. Confirm the gateway can reach `api.telegram.org`,
or open **Advanced → Network proxy** and enter a proxy.
- If Telegram rejects the token, copy the current token from BotFather or
regenerate it.
- If messages do not arrive, run `nanobot gateway --verbose` and confirm the
Telegram channel is enabled.
- If a first DM returns a pairing code, that is expected. Approve the code before
testing normal agent replies.
- If Telegram Web shows unsupported rich messages, keep `richMessages` disabled.
## Next: memory, automations, MCP tools
+33 -34
View File
@@ -1,6 +1,7 @@
# Build a WeChat AI Agent with nanobot
This guide connects nanobot to WeChat through the `weixin` channel. The channel uses HTTP long polling with QR-code login through the supported upstream API.
This guide connects nanobot to WeChat through the `weixin` channel. The channel
uses HTTP long polling with QR-code login through the supported upstream API.
## What this guide builds
@@ -11,23 +12,23 @@ This guide connects nanobot to WeChat through the `weixin` channel. The channel
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A WeChat account that can complete QR-code login.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the WeChat channel
Open **Channels → WeChat (Weixin)**, install support if prompted, and follow the QR connection flow using your WeChat account. Enable the channel, save, and follow any restart prompt. New private senders receive a pairing code until approved.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
@@ -46,7 +47,8 @@ Merge this snippet into `~/.nanobot/config.json`:
}
```
Omitting `allowFrom` enables pairing-only mode. The first private WeChat message from a new sender gets a pairing code instead of agent access.
Omitting `allowFrom` enables pairing-only mode. The first private WeChat message
from a new sender gets a pairing code instead of agent access.
Log in:
@@ -56,45 +58,42 @@ nanobot channels login weixin
Use `--force` if you need to discard saved login state and authenticate again.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
Send a private WeChat message to the bot. It should reply with a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
Send a private WeChat message to the bot. It should reply with a pairing code.
Approve it from a trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Send the message again after approval and watch gateway logs for the sender ID and reply.
Send the message again after approval and watch gateway logs for the sender ID
and reply.
## Security notes
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a static allowlist.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a
static allowlist.
- Treat saved login state as sensitive account access.
- Avoid connecting personal accounts to untrusted workspaces or broad tool permissions.
- Avoid connecting personal accounts to untrusted workspaces or broad tool
permissions.
## Troubleshooting
- If login fails, rerun `nanobot channels login weixin --force`.
- If a first private message returns a pairing code, that is expected. Approve the code before testing normal agent replies.
- If messages are denied without a pairing code, check gateway logs for whether WeChat provided the context token required for nanobot to reply.
- If polling disconnects, restart the gateway and check network reachability to the upstream service.
- If a first private message returns a pairing code, that is expected. Approve
the code before testing normal agent replies.
- If messages are denied without a pairing code, check gateway logs for whether
WeChat provided the context token required for nanobot to reply.
- If polling disconnects, restart the gateway and check network reachability to
the upstream service.
## Next: memory, automations, MCP tools
-178
View File
@@ -1,178 +0,0 @@
# Connect nanobot to WhatsApp Agent Platform
This guide connects nanobot to WhatsApp through the `whatsapp_agent` channel, which uses the **official WhatsApp Agent Platform** API. The agent appears as its own chat inside WhatsApp and talks only to you.
nanobot is an independent third-party project, not a WhatsApp product. Using this API does not imply endorsement by WhatsApp.
**Before connecting:** agent chats are not end-to-end encrypted. nanobot and your configured model provider process these messages. Review the [WhatsApp third-party agent terms](https://www.whatsapp.com/legal/third-party-agents-terms) and your provider's data policies before sharing sensitive information.
This is a different product from the [`whatsapp`](./whatsapp-ai-agent.md) channel.
## Which WhatsApp channel should I use?
| | `whatsapp_agent` (this guide) | `whatsapp` |
|---|---|---|
| How it connects | An official agent API token | A linked WhatsApp device (QR) |
| API | `https://api.whatsapp.com/agent/v1` | Neonize device session |
| Who it can talk to | Only you, the agent's creator | Chats and groups the linked device can see |
| Groups | Not supported | Supported |
| Message transport | Long-polling `GET /updates` | Device connection |
| End-to-end encryption | **No** — Meta manages agent chats | Yes, like a linked device |
| Availability | Limited countries, per account | Wherever WhatsApp can link a device |
| Account risk | Officially supported interface | Uses an unofficial linked-device protocol |
Choose `whatsapp_agent` when you want to connect your own nanobot through WhatsApp's agent API and do not need group access. This limits which WhatsApp chats the channel can access; it does not sandbox nanobot's tools. Keep `whatsapp` when you need groups, media breadth, or availability in a country where the Agent Platform has not rolled out.
Both channels can be enabled at once with different names and different access rules.
## What this guide builds
- the `whatsapp_agent` channel enabled in `config.json`
- a WhatsApp agent created from WhatsApp Settings
- the agent's API token stored in nanobot
- one approved sender
## Prerequisites
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A WhatsApp account with **Settings → Agents** available. This experience is available only in limited countries and might not appear in your account yet.
- A machine that can keep `nanobot gateway` running. Outbound connections are enough; no inbound webhook or public URL is required.
## Step 1: Create the agent in WhatsApp
1. Open WhatsApp and go to **Settings → Agents → Create an agent**.
2. Set a display name and avatar.
3. Open the agent's chat, then **Chat info → API key**.
4. Copy the key. This is the agent's API token.
You can connect up to five agents to one WhatsApp account. The token is shown again only if you regenerate it, and rotating it invalidates the previous value immediately. If you uninstall WhatsApp, regenerate the token.
## Step 2: Enable the channel
The channel uses only nanobot core dependencies, so no optional install is required:
```bash
nanobot plugins enable whatsapp_agent
```
Or edit `~/.nanobot/config.json` directly:
```json
{
"channels": {
"whatsapp_agent": {
"enabled": true,
"token": "<AGENT_API_TOKEN>"
}
}
}
```
Keep the token in an environment variable instead of the file when you can, and reference it:
```json
{
"channels": {
"whatsapp_agent": {
"enabled": true,
"token": "${WA_AGENT_TOKEN}"
}
}
}
```
## Step 3: Run and test
```bash
nanobot gateway
```
Open the agent's chat in WhatsApp and send a message. The agent replies in the same chat using the same model, workspace, memory, and tools as the CLI and WebUI.
## Access control
The Agent Platform already restricts the conversation to you, the agent's creator. `allowFrom` is a second, local check and is optional.
When `allowFrom` is empty, an unapproved sender receives a pairing code. Approve it from a trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
The sender identifier has the form `user:<id>`. Treat it as opaque, never share it, and prefer pairing over hardcoding it, because the identifier can change if you change your phone number or re-register your account. nanobot stores the most recent identifier and uses it for replies.
## Configuration reference
| Key | Default | Meaning |
|---|---|---|
| `enabled` | `false` | Load the channel at gateway start. |
| `token` | — | The agent's API token. Required. |
| `allowFrom` | `[]` | Extra local allowlist of `user:<id>` values, or `["*"]`. Empty means pairing-only. |
| `stateDir` | `~/.nanobot/whatsapp-agent` | Where the durable poll cursor and dedup state are stored. |
| `pollTimeout` | `25` | Long-poll hold time in seconds (0–25). |
| `markRead` | `true` | Send read receipts for inbound messages. |
| `typingIndicator` | `true` | Show "typing…" while the agent works. |
| `downloadMedia` | `true` | Download inbound image, audio, video, document, and sticker media. |
| `deleteMediaAfterDownload` | `false` | Delete the server copy once downloaded. |
| `maxMediaMb` | `16` | Local cap on inbound and outbound media, in MB. |
| `retryAmbiguousSends` | `false` | Retry sends whose outcome is unknown (HTTP 500, read timeouts). See "Delivery semantics". |
| `sendProgress` | `false` | Send agent progress messages. Off because each one spends the send budget. |
| `sendToolHints` | `false` | Send tool-call hints. Off for the same reason. |
## Media
Inbound media is downloaded, verified against the digest WhatsApp reports, then stored under the channel's media directory and passed to the agent like media from any other channel.
- Images: JPEG, PNG — 5 MB.
- Stickers: WebP — 500 KB.
- Video, audio, documents, generic files — 16 MB.
- Voice notes are transcribed when a transcription provider is configured; the audio file stays attached.
Outbound media is uploaded first, then sent as the matching message type. Files over the configured limit or the platform's type limit are skipped with an error in the log instead of failing the whole reply. Formats outside the platform's supported list are sent as generic file attachments.
Note that audio the agent sends arrives as a normal file attachment, not as a WhatsApp voice-note bubble.
Reactions are receive-only on this platform: the API rejects sending them. nanobot reads an inbound reaction (including an empty emoji, which means the reaction was removed) but does not forward it as a turn, so a reaction never triggers a reply. Media on both sides expires 30 days after it is stored; nanobot holds downloaded files locally and can delete the server copy with `deleteMediaAfterDownload`.
## Delivery semantics
The platform's send result determines whether a retry is safe:
- **Rate limit or "not accepted for delivery"** (`429`, `503`): the message was not sent, so nanobot retries with backoff.
- **A plain `500`, a dropped connection, or a read timeout**: WhatsApp cannot say whether the message was delivered. nanobot does **not** retry by default, because a duplicate is more disruptive than a missed reply. Set `retryAmbiguousSends` to `true` if you prefer a chance of duplicates over a chance of loss.
Replies longer than 4096 characters are split into multiple messages and sent in order. The first chunk quotes the message being answered. During a retry, nanobot resumes at the failed chunk or attachment; it does not send earlier accepted parts again. This progress is kept in memory for the current delivery, not as a persistent outbound queue.
At most one poller may run per agent token. If you start a second gateway against the same token, the older poll fails with `409`; nanobot logs this clearly and backs off. Run one gateway instance per agent.
## Operational notes
- **Rate limits.** WhatsApp allows 12 sends, 12 read receipts, 15 polls, and 12 media requests per minute per agent. nanobot paces each method below its own limit and counts retries against the same budget, which is why progress messages are off by default.
- **Durable cursor.** nanobot records message ids before handling them and saves the server cursor after each batch. A restart deduplicates recorded ids. A crash between recording and dispatch can lose that message; this is not exactly-once delivery. If state cannot be saved, the channel stops instead of acknowledging more traffic.
- **Retention.** WhatsApp keeps updates for 30 days. On first run, nanobot saves the current time and reads from `offset=0`, discarding messages older than that time or without a timestamp. This avoids gaps after empty polls. Keep the gateway clock synchronized. Timestamps have one-second precision, so messages from the startup second are included. Reading a large backlog can delay the first reply. Restarts retain the original boundary and cursor; changing the token starts a new boundary.
- **Invalid token.** If WhatsApp rejects the token, the channel stops and logs an actionable message instead of retrying forever.
- **Scheduled results.** A result that reaches the channel before it connects or learns the creator identifier remains in the gateway's pending-delivery queue. After connection, the gateway can send the saved result without running the task again. A connection loss after any part is sent is recorded as an unknown outcome and is not automatically replayed.
- **Privacy.** Agent conversations are not end-to-end encrypted. nanobot processes these messages and sends them to your configured model provider. Downloaded attachments and session history may remain on the nanobot host. Your other WhatsApp chats are unaffected. Do not use this channel for data that requires end-to-end encryption.
## Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| `Settings → Agents` is missing | The feature is not available in your country or account | Use the `whatsapp` channel instead |
| "API token was rejected" | Token rotated, revoked, or mistyped | Regenerate it in the agent's chat info and update the config |
| `409` in the logs | Two gateways share one agent token | Run a single gateway per agent |
| Agent never replies | No inbound message has arrived yet, so no recipient is known | Send the agent a message first |
| Media messages show a placeholder | Download failed, digest mismatch, or the file exceeded the limit | Check the log; re-send the file |
| Replies arrive late | The turn is longer than the 25-second typing window | This is expected; the reply still arrives |
## Next steps
- [Chat Apps reference](../chat-apps.md)
- [Pairing](../configuration.md#pairing)
- [Official WhatsApp agent help](https://faq.whatsapp.com/1050934623978152)
- [Secure local AI agent](./secure-local-ai-agent.md)
+33 -37
View File
@@ -1,9 +1,8 @@
# Build a WhatsApp AI Agent with nanobot
This guide connects nanobot to WhatsApp through the `whatsapp` channel. The channel links as a WhatsApp device and uses the same nanobot agent runtime, tools, memory, and workspace as the CLI and WebUI.
> [!NOTE]
> WhatsApp also offers an official Agent Platform where the agent appears as its own chat and talks only to you. That is a separate channel with different tradeoffs — no group support, no end-to-end encryption, and limited country availability, but an officially supported interface that does not rely on a linked device. See [Connect nanobot to WhatsApp Agent Platform](./whatsapp-agent-platform.md) to compare them.
This guide connects nanobot to WhatsApp through the `whatsapp` channel. The
channel links as a WhatsApp device and uses the same nanobot agent runtime,
tools, memory, and workspace as the CLI and WebUI.
## What this guide builds
@@ -14,24 +13,24 @@ This guide connects nanobot to WhatsApp through the `whatsapp` channel. The chan
## Prerequisites
- A normal reply in your existing nanobot WebUI or CLI. If you have not reached that point, complete [Quick Start](../quick-start.md) first.
- A working local nanobot reply:
```bash
nanobot agent -m "Hello!"
```
- A WhatsApp account that can link a new device.
- A machine that can keep `nanobot gateway` running.
## Continue from your running instance
## Install nanobot
If you are already chatting in the WebUI, keep it open and continue below. It has already started the gateway. To reopen it later, use the same installation's `nanobot webui` command; there is no need to install nanobot again.
For terminal or server setup, use the manual configuration section below. Reuse the config/home and executable from your working instance. Docker users should use the [container commands](../deployment.md#docker-compose).
```bash
python -m pip install nanobot-ai
nanobot onboard --wizard
```
## Enable the WhatsApp channel
Open **Channels → WhatsApp**, install support if prompted, and follow the QR connection flow. Scan the code from **WhatsApp → Settings → Linked Devices**. Enable the channel and save; choose mention-only group replies under **Advanced** for a first deployment. Follow any restart prompt.
<details>
<summary>Manual configuration</summary>
Install the optional channel dependency:
```bash
@@ -59,49 +58,46 @@ Merge this snippet into `~/.nanobot/config.json`:
}
```
Omitting `allowFrom` enables pairing-only mode for private chats. `groupPolicy` defaults to `"open"` in the channel, but `"mention"` is safer for a first deployment.
Omitting `allowFrom` enables pairing-only mode for private chats. `groupPolicy`
defaults to `"open"` in the channel, but `"mention"` is safer for a first
deployment.
</details>
## Run nanobot gateway
## Apply the settings
In the WebUI, follow any restart prompt and keep the launcher running for the first test. You do not need to start another gateway. For unattended operation afterward, use [background or service mode](../cli-reference.md#gateway).
For manual config changes, restart the existing gateway through its owning terminal, `nanobot gateway restart` for background mode, or its service/container supervisor. If none is running, start `nanobot gateway` and leave it running. Run diagnostic CLI commands in a separate terminal using the same installation and config.
```bash
nanobot channels status
nanobot gateway
```
## Test a message
Send the bot a private WhatsApp message. It should return a pairing code. Return to the WebUI pairing prompt and enter the code from your own private chat. Only a matching pending code is approved; do not enter another person's code. Then send your message again.
<details>
<summary>Terminal-only pairing</summary>
In a separate local terminal, using the same instance:
Send the bot a private WhatsApp message. It should return a pairing code.
Approve it from a trusted local surface:
```bash
nanobot agent -m "/pairing approve ABCD-EFGH"
```
Replace the example code with your actual code.
</details>
Send the message again after approval. Confirm that your private chat now receives a normal agent reply.
Send the message again after approval. The reply should use the same model and
workspace as your local CLI check.
## Security notes
- Treat the WhatsApp session database as account access.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a static allowlist.
- Prefer pairing-only mode for first setup. Add `allowFrom` only when you want a
static allowlist.
- Keep `groupPolicy` as `"mention"` before adding the bot to groups.
- Avoid `allowFrom: ["*"]` unless the bot is intentionally public or isolated.
## Troubleshooting
- If WhatsApp cannot load `libmagic`, install it with `brew install libmagic` on macOS or `sudo apt install libmagic1` on Debian/Ubuntu. On Windows, check the `python-magic-bin` installation and Python architecture.
- If QR linking fails, rerun `nanobot channels login whatsapp`.
- If you are migrating from the old bridge, remove `bridgeUrl` and `bridgeToken`, then re-login.
- If a sender appears as a LID instead of a phone number, let nanobot learn the mapping at runtime or use `lidMappings` in the full reference.
- If a first private message returns a pairing code, approve it before testing normal replies.
- If you are migrating from the old bridge, remove `bridgeUrl` and
`bridgeToken`, then re-login.
- If a sender appears as a LID instead of a phone number, let nanobot learn the
mapping at runtime or use `lidMappings` in the full reference.
- If a first private message returns a pairing code, approve it before testing
normal replies.
## Next: memory, automations, MCP tools
+157 -102
View File
@@ -1,20 +1,21 @@
# Image Generation
nanobot can generate new images and edit existing ones directly in chat. Image generation is off by default—enable it in Settings, then describe the image you want in plain language.
nanobot can generate and edit images through the `generate_image` tool. Enable the tool in WebUI Settings, then ask for an image normally in chat; the agent decides when to call it and can keep iterating on generated images in the same conversation.
The feature is disabled by default. Open **Settings → Image**, choose a configured provider and model, enable image generation, and save. The running gateway applies the change immediately. If that screen is not available in your installed version, use the manual config below.
## Quick Setup
**In the WebUI:**
**WebUI**
1. Make sure your image provider is added under **Settings → Models → Provider → Add provider**.
2. Open **Settings → Capabilities → Image generation**.
3. Choose the provider and image model, turn on **Image generation**, and click **Save**.
4. Ask nanobot for a test image in chat (if the WebUI asks for a restart, restart first).
1. Add the image provider credential under **Settings → Models** if it is not already configured.
2. Open **Settings → Image**.
3. Select the provider and image model, then enable image generation.
4. Save and ask for a simple test image. If the gateway cannot apply the change live, WebUI will prompt you to restart it.
<details>
<summary>Manual configuration</summary>
**Manual config**
Merge this snippet into `~/.nanobot/config.json`, replacing `provider` and `model` with any supported image provider and model you use:
This snippet uses the current built-in image-generation default so the JSON has concrete names. It is not a provider recommendation; replace `provider` and `model` with any supported image provider and model you intend to use.
```json
{
@@ -33,47 +34,53 @@ Merge this snippet into `~/.nanobot/config.json`, replacing `provider` and `mode
}
```
</details>
See [Provider Notes](#provider-notes) for Custom, AIHubMix, MiniMax, Gemini, Ollama, StepFun, Zhipu, and ModelScope configuration examples.
> [!TIP]
> Prefer environment variables like `${OPENROUTER_API_KEY}` instead of pasting raw API keys into `config.json`.
> Prefer environment variables for API keys. nanobot resolves `${VAR_NAME}` values from the environment at startup.
## Using Image Generation in Chat
## WebUI Usage
1. Describe the image you want—include aspect ratio or size if you want something other than the default.
2. Attach a reference image when you want to edit an existing picture (with a provider/model that supports editing).
3. Ask for follow-up tweaks in the same chat—such as *"make it warmer"*, *"change the background"*, or *"try a 16:9 version"*—and nanobot will build on the previous image automatically.
1. Open Settings and enable **Image Generation** with a configured provider and model.
2. Describe the image or edit you want in chat.
3. Include an aspect ratio or size in the request when the configured defaults are not suitable.
4. Attach reference images when editing an existing image.
Generated images are saved locally under `~/.nanobot/media/generated/YYYY-MM-DD/`.
Generated images are rendered as assistant media in the chat. Follow-up prompts such as "make it warmer", "change the background", or "try a 16:9 version" can reuse the most recent generated artifact.
The WebUI hides provider storage details from the user. The agent sees the saved artifact path internally and can pass it back to `generate_image` as `reference_images` for iterative edits.
## Configuration Reference
| Option | Default | Description |
|---|---|---|
| `tools.imageGeneration.enabled` | `false` | Enable or disable image generation |
| `tools.imageGeneration.provider` | `"openrouter"` | Provider name (`openrouter`, `openai`, `openai_codex`, `custom`, `aihubmix`, `minimax`, `gemini`, `ollama`, `stepfun`, `zhipu`, `modelscope`, or a named custom connection) |
| `tools.imageGeneration.model` | `"openai/gpt-5.4-image-2"` | Image model ID |
| `tools.imageGeneration.defaultAspectRatio` | `"1:1"` | Default aspect ratio when not specified in chat |
| `tools.imageGeneration.defaultImageSize` | `"1K"` | Default size hint (e.g. `1K`, `2K`, `4K`, or `1024x1024`) |
| `tools.imageGeneration.maxImagesPerTurn` | `4` | Maximum images per request (`1`–`8`) |
| `tools.imageGeneration.saveDir` | `"generated"` | Subfolder inside nanobot's media directory for saved images |
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `tools.imageGeneration.enabled` | boolean | `false` | Register the `generate_image` tool |
| `tools.imageGeneration.provider` | string | `"openrouter"` | Current built-in image provider default. Supported values: `openrouter`, `openai`, `openai_codex`, `custom`, `aihubmix`, `minimax`, `gemini`, `ollama`, `stepfun`, `zhipu`, `modelscope` |
| `tools.imageGeneration.model` | string | `"openai/gpt-5.4-image-2"` | Provider model name |
| `tools.imageGeneration.defaultAspectRatio` | string | `"1:1"` | Default ratio when the prompt/tool call does not specify one |
| `tools.imageGeneration.defaultImageSize` | string | `"1K"` | Default size hint, for example `1K`, `2K`, `4K`, or `1024x1024` |
| `tools.imageGeneration.maxImagesPerTurn` | number | `4` | Maximum `count` accepted by one tool call. Valid range: `1` to `8` |
| `tools.imageGeneration.saveDir` | string | `"generated"` | Relative directory under nanobot's media directory for generated artifacts |
### Custom connections and advanced options
Provider settings reuse normal provider config fields:
You can reuse any custom connection created in **Settings → Models → Manage providers** as long as its endpoint supports the OpenAI Images API (`/images/generations`).
| Option | Description |
|--------|-------------|
| `providers.<name>.apiKey` | Provider API key. Prefer `${ENV_VAR}` |
| `providers.<name>.apiBase` | Optional custom base URL |
| `providers.<name>.extraHeaders` | Headers merged into provider requests |
| `providers.<name>.extraBody` | Extra JSON fields merged into provider request bodies |
| `providers.<name>.proxy` | Explicit trusted HTTP proxy for provider requests and returned image URL downloads |
For image-only request differences (such as provider-specific quality or watermark parameters), use **Advanced options → Headers / Body parameters** in Image generation settings (or `tools.imageGeneration.extraHeaders` and `extraBody` in JSON). Switching image providers in the WebUI clears those overrides automatically so settings do not leak to another service.
For providers that return image URLs, direct downloads use DNS pinning. When an explicit provider `proxy` is configured, nanobot rejects malformed URLs and locally identifiable private/internal targets on the initial URL and every redirect. Hostnames unavailable to local DNS are delegated to that trusted proxy, which owns final DNS resolution and network egress. Process-wide proxy environment variables are not used for these downloads.
Both camelCase and snake_case config keys are accepted, but docs use camelCase to match `config.json`.
## Provider Notes
For all providers below, configure the connection in **Settings → Models** and select it under **Settings → Capabilities → Image generation**. Expand **Manual configuration** if you edit `config.json` directly.
### OpenRouter
Use any OpenRouter model that supports image output (and image editing if you want reference-image edits).
<details>
<summary>Manual configuration</summary>
OpenRouter uses a chat-completions style image response. Configure:
```json
{
@@ -87,35 +94,19 @@ Use any OpenRouter model that supports image output (and image editing if you wa
}
```
</details>
### OpenAI Codex
Sign in with `nanobot provider login openai-codex`, then choose **OpenAI Codex** and `gpt-image-2` in image settings. Supports both generation and reference-image edits using your Codex subscription.
<details>
<summary>Manual configuration</summary>
```json
{
"tools": {
"imageGeneration": {
"enabled": true,
"provider": "openai_codex",
"model": "gpt-image-2"
}
}
}
```
</details>
Use a model that supports image generation and image editing if you want reference-image edits.
### Custom (OpenAI-compatible)
Works with services implementing `POST /v1/images/generations` (returning `b64_json` or `url`). Requires `apiBase`; `apiKey` is optional for local servers. Reference-image edits are not supported by the generic `custom` provider.
The `custom` image provider fits services that implement the synchronous OpenAI Images API:
<details>
<summary>Manual configuration</summary>
```text
POST /v1/images/generations
```
The response must include generated images in `data[].b64_json` or `data[].url`. Native prediction APIs, such as Replicate's `/v1/models/{owner}/{model}/predictions`, are not directly compatible unless you put an OpenAI-compatible gateway in front of them.
Configure:
```json
{
@@ -135,16 +126,25 @@ Works with services implementing `POST /v1/images/generations` (returning `b64_j
}
```
Use `extraBody` for provider-specific options—for example, `"response_format": "url"` (Agnes AI), `"response_format": "base64"` (Together AI), or explicit `size` values (Volcengine Ark Seedream).
The `apiBase` is required. The provider sends requests to `{apiBase}/images/generations` using the OpenAI Images API format with `response_format: "b64_json"`. The `apiKey` is optional for local or unauthenticated endpoints. Reference-image edits are not supported by the generic `custom` provider.
</details>
`extraBody` can adapt provider-specific quirks because it is merged last into the request body. Examples:
- Agnes AI documents URL responses, so use `"extraBody": {"response_format": "url"}`.
- Together AI documents `"response_format": "base64"`, so override the default.
- Volcengine Ark Seedream models may require size hints such as `"2K"`, `"3K"`, `"4K"`, or explicit dimensions. Set `tools.imageGeneration.defaultImageSize` or `providers.custom.extraBody.size` to a value supported by the selected model.
For compatibility with the default nanobot setting, custom maps `defaultImageSize: "1K"` to `1024x1024`. Other explicit size hints are passed through unchanged.
### AIHubMix
Supports `gpt-image-2-free`. Optional `extraBody: {"quality": "low"}` can make free generations faster and less likely to time out.
AIHubMix `gpt-image-2-free` is supported through AIHubMix's unified predictions API. Internally nanobot calls:
<details>
<summary>Manual configuration</summary>
```text
/v1/models/openai/gpt-image-2-free/predictions
```
Configure:
```json
{
@@ -166,14 +166,11 @@ Supports `gpt-image-2-free`. Optional `extraBody: {"quality": "low"}` can make f
}
```
</details>
`quality: low` is optional. It can make free image models faster and less likely to time out, but it is not required for correctness.
### MiniMax
Supports text-to-image and editing (up to 16 reference images) with `MiniMax-H3-Image` and `MiniMax-H3-Image-Highspeed`, plus legacy `image-01`. Accepts `1K`, `2K`, `4K`, or explicit dimensions like `2720x1536`. See [MiniMax's image docs](https://platform.minimax.io/docs/guides/image-generation) for size limits and pricing. Note that a timed-out H3 request may still complete and be billed.
<details>
<summary>Manual configuration</summary>
MiniMax `image-01` supports text-to-image and reference-image (subject reference) edits. Supported aspect ratios are `1:1`, `16:9`, `4:3`, `3:2`, `2:3`, `3:4`, `9:16`, and `21:9`.
```json
{
@@ -186,21 +183,23 @@ Supports text-to-image and editing (up to 16 reference images) with `MiniMax-H3-
"imageGeneration": {
"enabled": true,
"provider": "minimax",
"model": "MiniMax-H3-Image",
"model": "image-01",
"defaultAspectRatio": "1:1"
}
}
}
```
</details>
### Gemini
Supports `gemini-2.5-flash-image` (supports reference-image edits) and `imagen-4.0-generate-001` (text-to-image only; supports `1:1`, `9:16`, `16:9`, `3:4`, `4:3`). Sizing is controlled by `defaultAspectRatio` (`defaultImageSize` is ignored).
nanobot supports two Gemini image generation model families via Google's Generative Language API:
<details>
<summary>Manual configuration</summary>
| Model | Endpoint | Reference images |
|-------|----------|-----------------|
| `imagen-4.0-generate-001` | `:predict` | Not supported by this integration |
| `gemini-2.5-flash-image` | `:generateContent` | Supported |
For reference-image edits, use a Gemini Flash image model:
```json
{
@@ -219,14 +218,11 @@ Supports `gemini-2.5-flash-image` (supports reference-image edits) and `imagen-4
}
```
</details>
Imagen 4 supports the aspect ratios `1:1`, `9:16`, `16:9`, `3:4`, and `4:3`. Unsupported ratios are ignored and the model uses its default. The `defaultImageSize` setting has no effect on Gemini models; sizing is controlled by `defaultAspectRatio` only. Reference images passed with an Imagen model are ignored (with a warning logged).
### Ollama
Works with local Ollama (`http://localhost:11434/api`, no API key needed) and hosted `https://ollama.com/api` (requires API key). Reference images are not supported.
<details>
<summary>Manual configuration</summary>
Ollama's experimental native image generation API works with local servers and hosted ollama.com models. Local access at `http://localhost:11434/api` does not require an API key; set `providers.ollama.apiKey` only when targeting `https://ollama.com/api`.
```json
{
@@ -247,14 +243,13 @@ Works with local Ollama (`http://localhost:11434/api`, no API key needed) and ho
}
```
</details>
Ollama maps `defaultAspectRatio` and `defaultImageSize` to native `width` and `height` values. Reference images are not supported by this integration.
### StepFun
Supports `step-image-edit-2` (text-to-image) and `step-1x-medium` (adds style-reference edits). Shares `providers.stepfun.apiKey` with StepFun chat models. For StepPlan subscriptions, set `apiBase` to `https://api.stepfun.ai/step_plan/v1`.
StepFun (阶跃星辰) `step-image-edit-2` supports text-to-image generation. The `step-1x-medium` variant additionally supports **style-reference** image edits, where a reference image guides the visual style of the output.
<details>
<summary>Manual configuration</summary>
Supported aspect ratios: `1:1`, `16:9`, `9:16`, `3:4`, `4:3`. Sizes are specified as `WIDTHxHEIGHT` (e.g. `1024x1024`, `1280x800`, `800x1280`).
```json
{
@@ -273,14 +268,40 @@ Supports `step-image-edit-2` (text-to-image) and `step-1x-medium` (adds style-re
}
```
</details>
> [!NOTE]
> The StepFun provider reuses the existing `providers.stepfun` config block (the same one used for StepFun's LLM API). Set `providers.stepfun.apiKey` once and it is shared between text and image generation.
>
> When `step-image-edit-2` is used, `reference_images` are ignored (the model does not support style reference). Switch to `step-1x-medium` to use reference-image-guided generation.
#### StepPlan (Subscription)
StepPlan is StepFun's subscription tier and uses a different API base URL. The image generation endpoint path is the same — just override `apiBase`:
```json
{
"providers": {
"stepfun": {
"apiKey": "${STEPFUN_API_KEY}",
"apiBase": "https://api.stepfun.ai/step_plan/v1"
}
},
"tools": {
"imageGeneration": {
"enabled": true,
"provider": "stepfun",
"model": "step-image-edit-2"
}
}
}
```
`apiBase` takes precedence over the registry default, so with the StepPlan base URL configured, image requests are sent to `https://api.stepfun.ai/step_plan/v1/images/generations` — the same path prefix used for LLM calls. The API key is shared with the standard StepFun provider.
### Zhipu
Supports `glm-image`, `cogview-4`, `cogview-4-250304`, and `cogview-3-flash` (text-to-image only). Supported aspect ratios: `1:1`, `16:9`, `9:16`, `3:4`, `4:3`, or explicit `WIDTHxHEIGHT`.
Zhipu (智谱) `glm-image` model supports text-to-image generation. The API returns temporary image URLs (valid for 30 days); nanobot downloads and re-encodes them as base64 data URLs.
<details>
<summary>Manual configuration</summary>
Supported aspect ratios: `1:1`, `16:9`, `9:16`, `3:4`, `4:3`. Sizes can be specified as `WIDTHxHEIGHT` (e.g. `1280x1280`, `1728x960`) or using aspect ratio presets.
```json
{
@@ -299,14 +320,13 @@ Supports `glm-image`, `cogview-4`, `cogview-4-250304`, and `cogview-3-flash` (te
}
```
</details>
Other supported models: `cogview-4`, `cogview-4-250304`, `cogview-3-flash`. Reference images are not supported by this integration.
### ModelScope
Supports text-to-image and image editing (e.g. `Qwen/Qwen-Image-2512`). Supported aspect ratios: `1:1`, `16:9`, `9:16`, `3:4`, `4:3`, or explicit `WIDTHxHEIGHT`.
ModelScope (魔搭社区) API-Inference supports text-to-image generation and image editing via an async task pattern.
<details>
<summary>Manual configuration</summary>
Supported aspect ratios: `1:1`, `16:9`, `9:16`, `3:4`, `4:3`. Sizes can be specified as `WIDTHxHEIGHT` (e.g. `1024x1024`, `1664x928`) or using aspect ratio presets.
```json
{
@@ -325,26 +345,61 @@ Supports text-to-image and image editing (e.g. `Qwen/Qwen-Image-2512`). Supporte
}
```
</details>
## Artifacts
## Prompting Tips
Generated images are stored under the active nanobot instance's media directory:
For better results, include the subject, composition, style/mood/lighting, any exact quoted text, and what should stay unchanged when editing:
```text
~/.nanobot/media/generated/YYYY-MM-DD/img_<id>.<ext>
~/.nanobot/media/generated/YYYY-MM-DD/img_<id>.json
```
For non-default config locations, the media directory is relative to the active config file's directory.
The JSON sidecar stores:
| Field | Meaning |
|-------|---------|
| `id` | Short generated image id, such as `img_ab12cd34ef56` |
| `path` | Local image path used internally for follow-up edits |
| `mime` | Detected image MIME type |
| `prompt` | Prompt used for the generation |
| `model` | Provider model |
| `provider` | Provider name |
| `source_images` | Reference image paths used for edits |
| `created_at` | Creation timestamp |
Do not paste base64 image payloads into chat. The agent should keep local artifact paths internal unless the user explicitly asks for debugging details.
## Prompting
Good image prompts include:
- Subject and scene.
- Composition, camera, or layout.
- Style, mood, lighting, and color palette.
- Exact text that must appear in the image, quoted.
- Constraints such as "keep the same character" or "preserve the logo".
Example:
```text
A minimal app icon for nanobot: friendly robot head, rounded square, soft blue and white palette, clean vector style, no text
```
For edits, describe what should change and what must stay fixed:
```text
Use the reference image. Keep the same robot and composition, change the palette to warm orange, and add a subtle sunrise background.
```
## Troubleshooting
| Symptom | Fix |
|---|---|
| Image generation is unavailable | Enable it in **Settings → Capabilities → Image generation** and save (restart the gateway after manual JSON edits) |
| Missing API key | Configure the provider's API key; if using `${VAR_NAME}`, confirm the variable is set before starting nanobot |
| Unsupported image provider | Use one of the supported providers listed above or a saved custom connection |
| Generation times out | Try a smaller size, set `extraBody.quality: "low"` on AIHubMix, or retry later |
| Reference image rejected | Confirm the file is a valid image inside your workspace or nanobot media directory |
| Symptom | Check |
|---------|-------|
| `generate_image` is not available | Enable image generation in **Settings → Image** and save. For manual config changes, restart the gateway |
| Missing API key error | Configure `providers.<provider>.apiKey`; if using `${VAR_NAME}`, confirm the environment variable is visible to the gateway process |
| `unsupported image generation provider` | Use `openrouter`, `openai`, `openai_codex`, `custom`, `aihubmix`, `minimax`, `gemini`, `ollama`, `stepfun`, `zhipu`, or `modelscope` |
| AIHubMix says `Incorrect model ID` | Use `model: "gpt-image-2-free"`; nanobot expands it to the required `openai/gpt-image-2-free` model path internally |
| Generation times out | Try a smaller/default image size, set AIHubMix `extraBody.quality` to `"low"`, or retry later |
| Reference image rejected | Reference image paths must be inside the workspace or nanobot media directory and must be valid image files |
-170
View File
@@ -1,170 +0,0 @@
# MCP Service Presets
Open **Apps → MCP** in the WebUI to pick a built-in service preset, enter its credentials (or sign in through your browser), and click **Connect**. Each service still requires your own account and permissions.
> [!TIP]
> If a remote HTTP/SSE service needs a proxy, configure **Settings → Advanced → Shared proxy** first, then enable **Use proxy** in that service's connection dialog before clicking **Connect**.
## Hosted Services
Browser OAuth presets open your provider's sign-in page directly. API-key presets ask for your token and attach it automatically.
| Service | Authentication | Setup |
| --- | --- | --- |
| Browserbase | API key | [Official guide](https://docs.browserbase.com/integrations/mcp/setup) |
| Firecrawl | None (keyless preset) | [Official guide](https://docs.firecrawl.dev/use-cases/developers-mcp) |
| Parallel Search | None (anonymous access) | [Official guide](https://docs.parallel.ai/integrations/mcp/search-mcp) |
| Exa | None | [Official guide](https://exa.ai/mcp) |
| Microsoft Learn | None (public documentation) | [Official guide](https://learn.microsoft.com/en-us/training/support/mcp) |
| Xmind | Browser OAuth | [Official guide](https://xmind.com/user-guide/xmind-mcp) |
| Notion | Browser OAuth | [Official guide](https://developers.notion.com/guides/mcp/get-started-with-mcp) |
| Linear | Browser OAuth | [Official guide](https://linear.app/docs/mcp) |
| Stripe | Browser OAuth | [Official guide](https://docs.stripe.com/mcp) |
| monday.com | Browser OAuth | [Official guide](https://developer.monday.com/api-reference/docs/mcp-dynamic-client-registration) |
| ClickUp | Browser OAuth | [Official guide](https://developer.clickup.com/docs/connect-an-ai-assistant-to-clickups-mcp-server) |
| Todoist | Browser OAuth | [Official guide](https://developer.todoist.com/api/v1/) |
| Airtable | Browser OAuth | [Official guide](https://support.airtable.com/articles/9897799762-using-the-airtable-mcp-server) |
| Miro | Browser OAuth | [Official guide](https://developers.miro.com/docs/connecting-to-miro-mcp) |
| Whimsical | Browser OAuth | [Official guide](https://whimsical.com/learn/integrations/mcp) |
| Supabase (remote) | Browser OAuth | [Official guide](https://supabase.com/docs/guides/ai-tools/mcp) |
| Neon | Browser OAuth | [Official guide](https://neon.com/docs/ai/neon-mcp-server) |
| Vercel | Browser OAuth | [Official guide](https://vercel.com/docs/agent-resources/vercel-mcp) |
| Render | API key or token | [Official guide](https://render.com/docs/mcp-server) |
| Railway | Browser OAuth | [Official guide](https://docs.railway.com/ai/mcp-server) |
| WordPress.com | Browser OAuth | [Official guide](https://developer.wordpress.com/docs/mcp/connect-custom-mcp-client/) |
| Webflow | Browser OAuth | [Official guide](https://developers.webflow.com/mcp/reference/getting-started) |
| Wix | Browser OAuth | [Official guide](https://dev.wix.com/docs/overview/ai-the-wix-platform/the-wix-mcp) |
| Granola | Browser OAuth | [Official guide](https://help.granola.ai/article/granola-mcp) |
| Fireflies | Browser OAuth | [Official guide](https://guide.fireflies.ai/articles/8272956938-learn-about-the-fireflies-mcp-server-model-context-protocol) |
| Otter.ai | Browser OAuth | [Official guide](https://help.otter.ai/hc/en-us/articles/35287607569687-Otter-MCP-Server) |
| Plaud | Browser OAuth | [Official guide](https://support.plaud.ai/hc/en-us/articles/57751078986265-Plaud-MCP) |
| Read AI | Browser OAuth | [Official guide](https://support.read.ai/hc/en-us/articles/49381158409491-MCP-Server) |
| Superhuman Mail | Browser OAuth | [Official guide](https://help.superhuman.com/hc/en-us/articles/46005696690317-Superhuman-Mail-MCP-Server) |
| Calendly | Browser OAuth | [Official guide](https://developer.calendly.com/docs/mcp/calendly-mcp-server) |
| Attio | Browser OAuth | [Official guide](https://attio.com/help/reference/how-to-guides/attio-mcp-prompts-and-best-practices) |
| Close | Browser OAuth | [Official guide](https://developer.close.com/mcp) |
| Apollo.io | Browser OAuth | [Official guide](https://docs.apollo.io/docs/apollo-mcp) |
| Ashby | Browser OAuth | [Official guide](https://docs.ashbyhq.com/ashby-mcp-server-beta) |
| Gusto | Browser OAuth | [Official guide](https://gusto.com/product/integrations/gusto_mcp) |
| Ramp | Browser OAuth | [Official guide](https://support.ramp.com/ramp-mcp) |
| Mercury | Browser OAuth | [Official guide](https://docs.mercury.com/docs/connecting-mercury-mcp) |
| Higgsfield | Browser OAuth | [Official guide](https://higgsfield.ai/creator-hub/help-center/integrations/what-is-higgsfield-mcp) |
| OpenArt | Browser OAuth | [Official guide](https://openart.ai/mcp/) |
| Runway | Browser OAuth | [Official guide](https://help.runwayml.com/hc/en-us/articles/51931843164691-Connecting-to-Runway-MCP) |
| PostHog | Browser OAuth | [Official guide](https://posthog.com/docs/model-context-protocol/codex) |
| Amplitude | Browser OAuth | [Official guide](https://amplitude.com/docs/amplitude-ai/amplitude-mcp) |
| Statsig | Browser OAuth | [Official guide](https://docs.statsig.com/integrations/mcp/manual-setup) |
| Hex | Browser OAuth | [Official guide](https://learn.hex.tech/docs/api-integrations/mcp-server) |
| MotherDuck | Browser OAuth | [Official guide](https://motherduck.com/docs/key-tasks/ai-and-motherduck/mcp-setup/) |
| Consensus | Browser OAuth | [Official guide](https://docs.consensus.app/consensus-mcp) |
| Scite | Browser OAuth | [Official guide](https://scite.ai/mcp) |
| Tavily | Browser OAuth | [Official guide](https://docs.tavily.com/documentation/mcp) |
| Atlassian | Browser OAuth | [Official guide](https://support.atlassian.com/atlassian-ai-gateway/docs/get-started-with-the-atlassian-remote-mcp-server/) |
| Trello | Browser OAuth | [Official guide](https://support.atlassian.com/trello/docs/connect-trello-to-ai-assistants-with-trello-mcp/) |
| Readwise | Browser OAuth | [Official guide](https://readwise.io/mcp) |
| GitHub (remote) | API key or token | [Official guide](https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md) |
| Coda | API key or token | [Official guide](https://help.coda.io/hc/en-us/articles/44722661982989-Connect-to-the-Coda-MCP) |
| Deepnote | API key or token | [Official guide](https://deepnote.com/docs/deepnote-mcp) |
| Hunter | API key or token | [Official guide](https://hunter.io/api-documentation) |
| Ahrefs | API key or token | [Official guide](https://docs.ahrefs.com/en/mcp/docs/copilot-studio) |
| AgentMail | API key or token | [Official guide](https://docs.agentmail.to/integrations/mcp) |
| Similarweb | API key or token | [Official guide](https://developers.similarweb.com/docs/copilot-mcp-integration) |
| Instacart | API key or token | [Official guide](https://docs.instacart.com/developer_platform_api/guide/tutorials/mcp/) |
| Datadog | API key or token; service MCP URL required | [Official guide](https://docs.datadoghq.com/mcp_server/setup/) |
| DigitalOcean | API key or token; service MCP URL required | [Official guide](https://docs.digitalocean.com/reference/mcp/configure-mcp/) |
| Metabase | Browser OAuth; service MCP URL required | [Official guide](https://www.metabase.com/docs/latest/ai/mcp) |
| Sigma | Browser OAuth; service MCP URL required | [Official guide](https://help.sigmacomputing.com/docs/use-sigma-mcp-server) |
| Descript | Browser OAuth; service MCP URL required | [Official guide](https://help.descript.com/api-and-mcp/mcp) |
| Hugging Face | Optional Hugging Face token | [Official guide](https://huggingface.co/docs/hub/agents-mcp) |
| Wolfram | None | [Official guide](https://support.wolfram.com/75237) |
| OpenAI Developers | None | [Official guide](https://developers.openai.com/learn/docs-mcp) |
| Redis Docs | None | [Official guide](https://redis.io/docs/latest/develop/setup/build-with-an-agent/) |
| Klaviyo | Browser OAuth | [Official guide](https://developers.klaviyo.com/en/docs/connect_to_the_klaviyo_mcp_server) |
| Windsor.ai | Browser OAuth | [Official guide](https://windsor.ai/mcp/) |
| Gong | Browser OAuth | [Official guide](https://help.gong.io/docs/create-an-integration-to-connect-to-the-mcp-server) |
| MagicPath | Browser OAuth | [Official guide](https://github.com/MagicPathAI/magicpath-agent-plugin) |
| WisdomAI | Browser OAuth | [Official guide](https://docs.wisdom.ai/integrations/mcp-server/MCP-Server) |
| Mixpanel | Browser OAuth | [Official guide](https://docs.mixpanel.com/docs/mcp) |
| HeyGen | Browser OAuth | [Official guide](https://www.heygen.com/model-context-protocol) |
| TinyFish | Browser OAuth | [Official guide](https://docs.tinyfish.ai/mcp-integration/index) |
| Vanta | Browser OAuth | [Official guide](https://developer.vanta.com/docs/vanta-mcp) |
| Omni | Browser OAuth | [Official guide](https://docs.omni.co/ai/mcp/authentication) |
| Metricool | Browser OAuth | [Official guide](https://help.metricool.com/how-to-connect-metricools-mcp-eqp9h) |
| Supermetrics | Browser OAuth | [Official guide](https://docs.supermetrics.com/docs/supermetrics-mcp-server) |
| Resend | Browser OAuth | [Official guide](https://github.com/resend/resend-mcp) |
| Smartsheet | API token | [Official guide](https://developers.smartsheet.com/ai-mcp/smartsheet/install-the-smartsheet-mcp-server) |
| Lusha | API key | [Official guide](https://docs.lusha.com/mcp/overview) |
| Semrush | API key | [Official guide](https://developer.semrush.com/api/v3/introduction/semrush-mcp/) |
| Blockscout | PRO API key | [Official guide](https://github.com/blockscout/mcp-server) |
| Snowflake | Programmatic access token; service MCP URL required | [Official guide](https://www.snowflake.com/en/developers/guides/getting-started-with-snowflake-mcp-server/) |
| Parallel Task | API key | [Official guide](https://docs.parallel.ai/integrations/mcp/task-mcp) |
| Zoho CRM | Browser OAuth; service MCP URL required | [Official guide](https://www.zoho.com/crm/developer/docs/mcp/setup/claude.html) |
| Wispr Flow | Browser OAuth | [Official guide](https://github.com/Wispr-AI/wispr-flow-plugin) |
| GitBook | Browser OAuth | [Official guide](https://gitbook.com/docs/documentation/docs-as-code/gitbook-mcp) |
| Floot | Browser OAuth | [Official guide](https://floot.com/docs/integrations/other-mcp-clients) |
| Clay | Browser OAuth | [Official guide](https://university.clay.com/docs/connect-to-clay-mcp) |
| WPWriter | Browser OAuth | [Official guide](https://www.wpwriter.com/html/abg_wp12.html) |
| WPVibe | Browser OAuth | [Official guide](https://wpvibe.ai/connect/) |
| vidIQ | Browser OAuth | [Official guide](https://support.vidiq.com/en/articles/15082430-vidiq-mcp) |
| Caliber | Browser OAuth | [Official guide](https://caliberstrong.freshdesk.com/support/solutions/articles/48001282391-mcp-server-instructions) |
| COROS | Browser OAuth | [Official guide](https://github.com/coroslab/COROS-MCP) |
| Namecheap | Browser OAuth | [Official guide](https://www.namecheap.com/support/knowledgebase/article.aspx/10824/34/namecheap-mcp/) |
| GoDaddy | None | [Official guide](https://developer.godaddy.com/en/docs/api-users/mcp) |
| ThoughtSpot Developer | None | [Official guide](https://developers.thoughtspot.com/docs/SpotterCode) |
| Hostinger Mail | API key or token | [Official guide](https://api.mail.hostinger.com/) |
| GSC Wizard | API key or token | [Official guide](https://mcp.gscwizard.com/docs) |
| Pocket AI | API key or token | [Official guide](https://docs.heypocketai.com/docs/mcp) |
| Legal Data Hunter | Browser OAuth | [Official guide](https://legaldatahunter.com/llms.txt) |
| RingCentral Phone | Browser OAuth | [Official guide](https://developers.ringcentral.com/mcp/servers/ringex-phone-setup/) |
| Ubersuggest | Browser OAuth | [Official guide](https://ubersuggest-mcp.neilpatelapi.com/docs) |
| Talarion Acumen | API key or token | [Official guide](https://docs.talarion.com/installation) |
| Databricks Genie | API key or token; service MCP URL required | [Official guide](https://docs.databricks.com/aws/en/agents/mcp-tools/authentication-networking) |
| TickTick | Browser OAuth | [Server metadata](https://mcp.ticktick.com/.well-known/oauth-protected-resource) |
## Local Servers
Local servers run on the gateway computer. Make sure the listed runtime (such as Node.js/`npx`, `uvx`, or Docker) is installed first.
| Service | Requirements | Setup |
| --- | --- | --- |
| Playwright | Node.js and npx | [Server guide](https://playwright.dev/docs/getting-started-mcp) |
| Context7 | Node.js and npx; API key optional | [Server guide](https://context7.com/docs/resources/all-clients) |
| AWS Documentation | uvx | [Server guide](https://awslabs.github.io/mcp/servers/aws-documentation-mcp-server/) |
| Brave Search | Node.js, npx, and Brave Search API key | [Server guide](https://www.npmjs.com/package/@brave/brave-search-mcp-server) |
| Postman | Node.js, npx, and Postman API key | [Server guide](https://learning.postman.com/docs/developer/postman-api/postman-mcp-server/postman-mcp-local-server) |
| Figma | Figma desktop app with MCP enabled | [Server guide](https://help.figma.com/hc/en-us/articles/32132100833559-Guide-to-the-Figma-MCP-server) |
| GitHub | Docker and GitHub token | [Server guide](https://github.com/github/github-mcp-server) |
| Supabase | Node.js, npx, and Supabase access token | [Server guide](https://supabase.com/docs/guides/ai-tools/mcp) |
| Firebase | Node.js, npx, and Firebase CLI sign-in | [Server guide](https://firebase.google.com/docs/ai-assistance/mcp-server) |
| MongoDB | Node.js, npx, and MongoDB connection string | [Server guide](https://www.mongodb.com/docs/mcp-server/local-mcp/security-best-practices/) |
| ClickHouse | uvx and ClickHouse connection credentials | [Server guide](https://github.com/ClickHouse/mcp-clickhouse) |
| Redis | uvx and Redis connection URL | [Server guide](https://github.com/redis/mcp-redis) |
| dbt | uvx and dbt account with a static subdomain | [Server guide](https://docs.getdbt.com/docs/dbt-ai/setup-local-mcp) |
| Google Workspace | uvx and Google Cloud OAuth app with required APIs enabled | [Server guide](https://github.com/taylorwilsdon/google_workspace_mcp) |
| Microsoft 365 | Node.js, npx, and Microsoft work or school account | [Server guide](https://github.com/Softeria/ms-365-mcp-server) |
| Adobe Express Developer | Node.js and npx | [Server guide](https://developer.adobe.com/express/add-ons/docs/guides/getting-started/local-development/mcp-server) |
| Azure | Node.js, npx, Azure CLI, and Azure sign-in | [Server guide](https://github.com/microsoft/mcp/tree/main/servers/Azure.Mcp.Server) |
| Tableau | Node.js 22.7.5+ and npx; Tableau personal access token | [Server guide](https://github.com/tableau/tableau-mcp) |
| BigQuery | Node.js, npx, Google Application Default Credentials | [Server guide](https://docs.cloud.google.com/bigquery/docs/pre-built-tools-with-mcp-toolbox) |
| Salesforce DX | Node.js, npx, Salesforce CLI, and default target org | [Server guide](https://developer.salesforce.com/docs/platform/sfdx-dev/guide/sfdx-dev-mcp-server.html) |
| Shopify Developer | Node.js 18+ and npx | [Server guide](https://shopify.dev/docs/apps/build/ai-toolkit) |
| AWS | uvx, AWS CLI, configured IAM credentials | [Server guide](https://docs.aws.amazon.com/agent-toolkit/latest/userguide/getting-started-aws-mcp-server.html) |
| Alation | uvx and Alation service-account integration | [Server guide](https://github.com/Alation/alation-ai-agent-sdk/tree/main/python/dist-mcp) |
| Expedia Travel Recommendations | uvx and Expedia API key | [Server guide](https://github.com/ExpediaGroup/expedia-travel-recommendations-mcp) |
## Service-Specific Notes
<details>
<summary>Setup notes for specific presets (Datadog, Google Workspace, Microsoft 365, databases, admin-gated services)</summary>
- **Local vs. remote pairs:** **Supabase** runs locally in read-only mode while **Supabase (remote)** uses browser OAuth. **GitHub** runs locally via Docker while **GitHub (remote)** uses a personal access token. **Figma** connects to the local Figma desktop app.
- **Custom endpoint URLs:** Datadog, DigitalOcean, Metabase, Sigma (**Profile → Integrations**), Descript (**Settings → Descript MCP**), Snowflake, and Zoho CRM require copying your organization's MCP URL from their setup guide.
- **Google Workspace & Microsoft 365:** Google Workspace uses the community `workspace-mcp` server (create a Google Cloud OAuth app and enable the APIs you need). Microsoft 365 targets work/school accounts and may require tenant admin approval (personal Outlook accounts can use a custom MCP config without `--org-mode`).
- **Databases:** MongoDB and ClickHouse default to read-only queries. Redis expects a connection URL such as `rediss://default:password@your-host:6379/0`.
- **Admin approval required:** Gong, Vanta, Omni, and Clay require an organization admin to enable MCP integration first.
- **Documentation-only presets:** OpenAI Developers, Redis Docs, Adobe Express Developer, Shopify Developer, and ThoughtSpot Developer expose developer documentation rather than private account administration.
- **Services needing a custom MCP connection:** Services that require fixed OAuth clients or custom app registration (such as Asana, HubSpot, Slack, Canva, Dropbox, Box, Docusign, Zoom, and QuickBooks Online) are not built-in presets—add them through **Apps → Add MCP server** after completing their setup guide.
</details>
Test any newly saved connection from **Apps** to inspect the tools it exposes. For advanced options like tool allowlists and timeouts, see [Configuration: MCP](./configuration.md#mcp-model-context-protocol).
+154 -64
View File
@@ -1,111 +1,188 @@
# AI Agent Memory in nanobot
nanobot keeps recent chat history separate from long-term memory like your preferences, background, and ongoing project knowledge. You can inspect, edit, and restore long-term memory at any time.
This page explains how nanobot implements long-term AI agent memory: session
history, compressed archives, durable knowledge files, Dream consolidation, and
Git-backed memory changes.
> [!NOTE]
> An agent replying "Got it, I'll remember that" does not automatically guarantee a preference was written to long-term memory. You can verify or update it directly using the steps below.
nanobot's memory is built on a simple belief: memory should feel alive, but it should not feel chaotic.
## How Memory Works
Good memory is not a pile of notes. It is a quiet system of attention. It notices what is worth keeping, lets go of what no longer needs the spotlight, and turns lived experience into something calm, durable, and useful.
```mermaid
flowchart LR
C["Active Chat"] -->|"/compact or auto-summarize"| H["Summaries (history.jsonl)"]
H -->|"/dream or periodic schedule"| R["Long-Term Memory (SOUL, USER, MEMORY, wiki/)"]
C -->|"Direct 'Remember...' request"| R
That is the shape of memory in nanobot.
## The Design
nanobot does not treat memory as one giant file.
It separates memory into layers, because different kinds of remembering deserve different tools:
- `session.messages` holds the living short-term conversation.
- `memory/history.jsonl` is the running archive of compressed past turns.
- `SOUL.md`, `USER.md`, and `memory/MEMORY.md` are the durable knowledge files.
- `GitStore` records how those durable files change over time.
This keeps the system light in the moment, but reflective over time.
## The Flow
Memory moves through nanobot in two stages.
### Stage 1: Consolidator
When a conversation grows large, the `Consolidator` summarizes older turns and appends the result to `memory/history.jsonl`, while keeping recent conversation available. Each summary preserves useful long-term facts and a short handoff for active work.
This file is:
- append-only
- cursor-based
- optimized for machine consumption first, human inspection second
Each line is a JSON object:
```json
{"cursor": 42, "timestamp": "2026-04-03 00:02", "content": "- User prefers dark mode\n- Decided to use PostgreSQL"}
```
nanobot organizes memory into four layers so conversations stay fast while useful knowledge builds up over time:
It is not the final memory. It is the material from which final memory is shaped.
| Layer | Where it lives | What it holds |
|---|---|---|
| Active conversation | Session history | Recent messages in the current topic or chat |
| Conversation summaries | `memory/history.jsonl` | Compact summaries of older turns created when a chat grows long or when you run `/compact` |
| Resident memory | `SOUL.md`, `USER.md`, `memory/MEMORY.md` | Core personality, user preferences, and key facts loaded into every conversation |
| Knowledge wiki | `memory/wiki/` | Detailed Markdown notes read on demand when relevant to a task |
### Stage 2: Dream
Long-term memory updates in two ways:
`Dream` is the slower, more thoughtful layer. It runs on a cron schedule by default and can also be triggered manually.
1. **Direct updates:** When you ask nanobot to remember something (or share a lasting preference) in a chat with write access, it can update the relevant memory file right away.
2. **Compaction + Dream:** As conversations grow long (or after idle time, or when you run `/compact`), nanobot summarizes older messages and saves the summary to `memory/history.jsonl`. Periodically (or when you run `/dream`), **Dream** reviews new summaries and makes focused edits to your resident memory files and `memory/wiki/`.
Dream reads:
Every Dream update is versioned with Git in your agent workspace, so you can inspect what changed and roll back if needed.
- new entries from `memory/history.jsonl`
- the current `SOUL.md`
- the current `USER.md`
- the current `memory/MEMORY.md`
## Where Memory Files Live
Then it edits the long-term files surgically in a single pass — not by rewriting everything, but by making the smallest honest change that keeps memory coherent.
All memory files belong to your **agent workspace** (`~/.nanobot/workspace/` by default):
This is why nanobot's memory is not just archival. It is interpretive.
## The Files
In this page, `workspace` means the configured **agent workspace** (the default
is `~/.nanobot/workspace/`, or the path passed with `--workspace`). Selecting a
different project in the WebUI changes that chat's project context and tool
working directory; it does not relocate the files below.
```text
workspace/
├── SOUL.md # Agent voice and communication style
├── USER.md # Stable preferences and facts about you
├── SOUL.md # The bot's long-term voice and communication style
├── USER.md # Stable knowledge about the user
├── prompts/
│ └── dream.md # Optional custom instructions for Dream
│ ├── README.md # Notes for memory guidance files
│ └── dream.md # Optional instructions for how Dream organizes memory
└── memory/
├── MEMORY.md # Core facts and links to wiki pages
├── wiki/ # Optional detailed Markdown notes
│ └── index.md # Topic index read on demand
└── history.jsonl # Recent conversation summaries
├── MEMORY.md # Project facts, decisions, and durable context
├── history.jsonl # Append-only history summaries
├── .cursor # Consolidator write cursor
├── .dream_cursor # Dream consumption cursor
└── .git/ # Version history for long-term memory files
```
Picking a different **project workspace** in the WebUI changes where the agent works on files, not where its memory lives. That means one agent keeps continuous memory across projects and topics.
A selected project may provide its own `AGENTS.md`, but project-local `SOUL.md`,
`USER.md`, and `memory/` do not replace the agent-owned files above. This keeps
one agent's profile and memory continuous while it works across projects. Use a
separate configured agent workspace when identity or memory must be isolated.
> [!IMPORTANT]
> Starting a new topic or choosing a different project does **not** isolate long-term memory. If you need separate memory for different clients or users, run [Multiple Instances](./multiple-instances.md).
These files play different roles:
## Save and Check a Preference
- `SOUL.md` remembers how nanobot should sound.
- `USER.md` remembers who the user is and what they prefer.
- `MEMORY.md` remembers what remains true about the work itself.
- `history.jsonl` remembers what happened on the way there.
In any WebUI or terminal chat, state a clear preference:
## Why `history.jsonl`
```text
Remember that for Acme release notes I prefer concise bullet points and British spelling.
The old `HISTORY.md` format was pleasant for casual reading, but it was too fragile as an operational substrate.
`history.jsonl` gives nanobot:
- stable incremental cursors
- safer machine parsing
- easier batching
- cleaner migration and compaction
- a better boundary between raw history and curated knowledge
You can still search it with familiar tools:
```bash
# grep
grep -i "keyword" memory/history.jsonl
# jq
cat memory/history.jsonl | jq -r 'select(.content | test("keyword"; "i")) | .content' | tail -20
# Python
python -c "import json; [print(json.loads(l).get('content','')) for l in open('memory/history.jsonl','r',encoding='utf-8') if l.strip() and 'keyword' in l.lower()][-20:]"
```
- If the chat has write access to your agent workspace, nanobot can save it right away. Ask which file it updated, then verify in a new topic.
- If you are in a **Restricted** chat inside a different project folder, nanobot can read `memory/wiki/` but cannot write to your agent memory files. Switch to the agent workspace, edit the file yourself, or run `/compact` followed by `/dream` to consolidate recent chats.
The difference is philosophical as much as technical:
## Memory Commands
- `history.jsonl` is for structure
- `SOUL.md`, `USER.md`, and `MEMORY.md` are for meaning
Use these slash commands in chat to inspect, run, or restore memory:
## Commands
Memory is not hidden behind the curtain. Users can inspect and guide it.
| Command | What it does |
|---|---|
| `/compact` | Summarize the current conversation now (full chat history remains visible) |
| `/dream` | Run Dream consolidation now |
|---------|--------------|
| `/dream` | Run Dream immediately |
| `/dream-log` | Show the latest Dream memory change |
| `/dream-log <sha>` | Show a specific Dream memory change |
| `/dream-log <sha>` | Show a specific Dream change |
| `/dream-restore` | List recent Dream memory versions |
| `/dream-restore <sha>` | Restore memory files and wiki pages to the state before that change |
| `/dream-prompt` | Show the current instructions guiding Dream |
| `/dream-prompt init` | Create an editable `prompts/dream.md` guide for this workspace |
| `/dream-restore <sha>` | Restore memory to the state before a specific change |
| `/dream-prompt` | Show how Dream is being guided for memory |
| `/dream-prompt init` | Create an editable Dream memory guide at `prompts/dream.md` |
> [!NOTE]
> `/dream-restore <sha>` restores all managed memory files and wiki pages together (not a single page). If you have uncommitted manual edits in memory files, commit or revert them before restoring.
These commands exist for a reason: automatic memory is powerful, but users should always retain the right to inspect, understand, and restore it.
## Versioned Memory
After Dream changes long-term memory files, nanobot can record that change with `GitStore`.
This gives memory a history of its own:
- you can inspect what changed
- you can compare versions
- you can restore a previous state
That turns memory from a silent mutation into an auditable process.
## Guiding Dream
Most users can leave Dream's built-in instructions as they are. To customize how Dream organizes memory for one workspace, run:
Dream decides what to keep, update, or forget using nanobot's built-in memory instructions. Most users can leave this alone.
If one workspace needs a different memory style, create an editable guide:
```text
/dream-prompt init
```
Edit `workspace/prompts/dream.md` in plain Markdown. Dream follows your guide automatically before reviewing new summaries. Delete or empty the file to return to nanobot's defaults.
This creates:
```text
workspace/prompts/dream.md
```
Edit that file in plain Markdown. When it has content, Dream follows it for this workspace before reading the latest conversation history. You do not need to paste history into the file; Dream adds the current `## Conversation History` block automatically.
To return to nanobot's default behavior, delete `prompts/dream.md` or leave it empty.
Each workspace has its own guide. Changing this file does not affect other nanobot workspaces.
## Configuration
Turn Dream on or off in **Settings → Capabilities → Memory consolidation**. Dream runs automatically while `nanobot gateway` is running.
To change how often Dream runs or pick a dedicated model preset for it, configure `agents.defaults.dream` in `~/.nanobot/config.json`:
<details>
<summary>Manual configuration</summary>
Dream is configured under `agents.defaults.dream`:
```json
{
"agents": {
"defaults": {
"dream": {
"enabled": true,
"intervalH": 2,
"modelOverride": null
}
@@ -115,12 +192,25 @@ To change how often Dream runs or pick a dedicated model preset for it, configur
```
| Field | Meaning |
|---|---|
| `enabled` | Turn periodic Dream consolidation on or off |
|-------|---------|
| `intervalH` | How often Dream runs, in hours |
| `cron` | Optional cron expression override (takes precedence over `intervalH`, e.g. `"0 */4 * * *"`) |
| `modelOverride` | Optional named model preset from `modelPresets` to use for Dream |
| `cron` | Cron expression override (takes precedence over `intervalH`) |
| `modelOverride` | Optional model preset name used for Dream |
To adjust automatic idle compaction, see [Auto Compact](./configuration.md#auto-compact). To show automatic compaction notices in chat apps (hidden by default; manual `/compact` always shows feedback), set `channels.showCompactionNotices: true`.
In practical terms:
</details>
- `intervalH` is the normal way to configure Dream frequency. Internally it runs as an `every` schedule.
- `cron` overrides `intervalH` when set, allowing precise cron expressions (e.g. `0 */4 * * *`).
- `modelOverride` selects a named entry from `model_presets` for Dream. It accepts preset names only; raw model identifiers are not supported. If omitted, Dream uses the main agent's selected runtime.
## In Practice
What this means in daily use is simple:
- conversations can stay fast without carrying infinite context
- durable facts can become clearer over time instead of noisier
- the user can inspect and restore memory when needed
Memory should not feel like a dump. It should feel like continuity.
That is what this design is trying to protect.
+107 -29
View File
@@ -1,54 +1,132 @@
# Multiple Instances
Run separate nanobot instances whenever you want completely independent settings, chat bots, and long-term memory—for example, separating personal and work agents or isolating different clients.
> [!NOTE]
> Starting a new topic or picking a different project folder inside one instance does **not** separate long-term memory. Use separate instances when data must not mix.
>
> Separate instances separate nanobot data, not OS permissions. For mutually untrusted users, run them under separate OS accounts or containers and configure [tool restrictions](./configuration.md#security).
Run multiple nanobot instances simultaneously with separate configs and runtime data. Use `--config` as the main entrypoint. Optionally pass `--workspace` during `onboard` when you want to initialize or update the saved workspace for a specific instance.
## Quick Start
Pass `--home <directory>` before the subcommand (without it, nanobot uses `~/.nanobot`). Give each running instance its own WebUI and gateway ports:
If you want each instance to have its own dedicated workspace from the start, pass both `--config` and `--workspace` during onboarding.
**Initialize instances:**
```bash
nanobot --home ~/.nanobot-work onboard
nanobot --home ~/.nanobot-work webui --port 8766 --gateway-port 18791
# Create separate instance configs and workspaces
nanobot onboard --config ~/.nanobot-telegram/config.json --workspace ~/.nanobot-telegram/workspace
nanobot onboard --config ~/.nanobot-discord/config.json --workspace ~/.nanobot-discord/workspace
nanobot onboard --config ~/.nanobot-feishu/config.json --workspace ~/.nanobot-feishu/workspace
```
Configure this instance's models in **Settings → Models** and chat apps in **Channels**. Use the same `--home` flag for any other command targeting this instance:
**Configure each instance:**
Edit `~/.nanobot-telegram/config.json`, `~/.nanobot-discord/config.json`, etc. with different channel settings. The workspace you passed during `onboard` is saved into each config as that instance's default workspace.
**Run instances:**
```bash
nanobot --home ~/.nanobot-work status
nanobot --home ~/.nanobot-work agent
nanobot --home ~/.nanobot-work gateway --port 18791
# Check one instance before starting it
nanobot status --config ~/.nanobot-telegram/config.json
# Instance A - Telegram bot
nanobot gateway --config ~/.nanobot-telegram/config.json
# Instance B - Discord bot
nanobot gateway --config ~/.nanobot-discord/config.json
# Instance C - Feishu bot with custom port
nanobot gateway --config ~/.nanobot-feishu/config.json --port 18792
```
Each concurrent instance needs distinct `--port` (WebUI, default `8765`) and `--gateway-port` (gateway health, default `18790`) values, plus its own chat-bot tokens. You can also save those ports in each instance's `config.json`.
## Path Resolution
## Where Each Instance Stores Data
When using `--config`, nanobot derives its runtime data directory from the config file location. The workspace still comes from `agents.defaults.workspace` unless you override it with `--workspace`.
| Data | Location |
|---|---|
| Config | `<home>/config.json` (or explicit `--config`) |
| Workspace (memory, skills, automations) | `<home>/workspace/` by default (or explicit `--workspace`) |
| Sessions, media, logs, and CLI history | Inside `<home>/` (or the directory of `--config`) |
Verify which paths an instance will use at any time with:
To open a CLI session against one of these instances locally:
```bash
nanobot --home ~/.nanobot-work status
nanobot agent -c ~/.nanobot-telegram/config.json -m "Hello from Telegram instance"
nanobot agent -c ~/.nanobot-discord/config.json -m "Hello from Discord instance"
# Open the browser workbench for a specific instance
nanobot webui -c ~/.nanobot-telegram/config.json
# Optional one-off workspace override
nanobot agent -c ~/.nanobot-telegram/config.json -w /tmp/nanobot-telegram-test
```
If you prefer custom directories instead of `--home`, pass `--config` and `--workspace` directly:
> Interactive `nanobot agent` and `nanobot webui` commands with the same `--config` and explicit `--workspace` selectors share one gateway instance. Different selectors produce isolated runtime state and processes. The one-shot and `--classic` agent paths remain direct local executions.
| Component | Resolved From | Example |
|-----------|---------------|---------|
| **Config** | `--config` path | `~/.nanobot-A/config.json` |
| **Workspace** | `--workspace` or config | `~/.nanobot-A/workspace/` |
| **Sessions** | config directory + workspace ID | `~/.nanobot-A/sessions/<workspace-id>/` |
| **Cron Jobs** | workspace directory | `~/.nanobot-A/workspace/cron/` |
| **Media / runtime state** | config directory | `~/.nanobot-A/media/` |
## How It Works
- `--config` selects which config file to load
- By default, the workspace comes from `agents.defaults.workspace` in that config
- If you pass `--workspace`, it overrides the workspace from the config file
## Minimal Setup
1. Copy your base config into a new instance directory.
2. Set a different `agents.defaults.workspace` for that instance.
3. Start the instance with `--config`.
Example config fragment:
```json
{
"agents": {
"defaults": {
"workspace": "~/.nanobot-telegram/workspace"
}
},
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_TELEGRAM_BOT_TOKEN"
}
},
"gateway": {
"host": "127.0.0.1",
"port": 18790
}
}
```
The copied base config can keep using the same `modelPresets` and `agents.defaults.modelPreset`. If this instance needs a different model, add another preset and set `agents.defaults.modelPreset` to that preset name.
Start separate instances:
```bash
nanobot onboard --config ~/bots/work/config.json --workspace ~/work-agent
nanobot webui --config ~/bots/work/config.json --port 8766 --gateway-port 18791
nanobot status --config ~/.nanobot-telegram/config.json
nanobot gateway --config ~/.nanobot-telegram/config.json
nanobot gateway --config ~/.nanobot-discord/config.json
```
Keep each instance's config file in its own directory and outside its workspace so sessions and runtime files stay cleanly separated.
Each gateway instance also exposes a lightweight HTTP health endpoint on `gateway.host:gateway.port`. By default, the gateway binds to `127.0.0.1`, so the endpoint stays local unless you explicitly set `gateway.host` to a public or LAN-facing address.
## Health Check
- `GET /health` returns `{"status":"ok"}`
- Other paths return `404`
Each gateway exposes `GET /health` on `127.0.0.1:<gateway-port>` (`18790` by default), returning HTTP `200` when the gateway and WebSocket channel are ready (or `503` if WebSocket is enabled but not ready). See [CLI Reference: Gateway](./cli-reference.md#gateway) for service management commands.
Override workspace for one-off runs when needed:
```bash
nanobot gateway --config ~/.nanobot-telegram/config.json --workspace /tmp/nanobot-telegram-test
```
## Common Use Cases
- Run separate bots for Telegram, Discord, Feishu, and other platforms
- Keep testing and production instances isolated
- Use different models or providers for different teams
- Serve multiple tenants with separate configs and runtime data
## Notes
- Each instance must use a different port if they run at the same time
- Session data follows the active config directory; use a different workspace per instance to isolate memory, skills, and the stable session namespace ID
- `--workspace` overrides the workspace defined in the config file
- Cron jobs are stored in the active workspace; runtime media/state is derived from the config directory
+191 -34
View File
@@ -1,53 +1,210 @@
# My Tool
The `my` tool lets nanobot inspect its own runtime state—such as which model, workspace, or iteration limit it is using—and optionally adjust safe runtime settings without editing `config.json`.
Let the agent sense and adjust its own runtime state — like asking a coworker "are you busy? can you switch to a bigger monitor?"
## What It Lets the Agent Do
## Why You Need It
- **Self-inspection (on by default):** Answer questions like *"What model are you using?"*, *"Which project folder is active?"*, *"Is web search enabled?"*, or *"What is your iteration limit?"*.
- **Runtime tuning (opt-in):** Switch the current session's model preset, raise or lower the per-turn iteration limit (`1`–`100`), or keep temporary scratchpad notes across turns.
Normal tools let the agent operate on the outside world (read/write files, search code). But the agent knows nothing about itself — it doesn't know which model it's running on, which workspace it can access, or which runtime limits apply.
My tool fills this gap. With it, the agent can:
- **Know who it is**: What model am I using? Where is my workspace? What is my per-turn iteration limit?
- **Adapt on the fly**: Complex task? Expand the context window. Simple chat? Switch to a faster model.
- **Remember across turns**: Store notes in your scratchpad that persist into the next conversation turn.
## Configuration
The `my` tool is enabled in **read-only** mode by default. To let the agent adjust allowed runtime settings, merge this into `~/.nanobot/config.json`:
Enabled by default (read-only mode). The agent can check its state but not set it.
```json
{
"tools": {
"my": {
"enable": true,
"allowSet": false
}
}
}
```yaml
tools:
my:
enable: true # default: true
allow_set: false # default: false (read-only)
```
Set `"allowSet": true` to allow runtime adjustments.
To allow the agent to set its configuration (e.g. switch models, adjust parameters), set `tools.my.allow_set: true`.
## What Persists and What Resets
Legacy `tools.myEnabled` / `tools.mySet` keys are auto-migrated on load, and rewritten in-place the next time `nanobot onboard` refreshes the config.
| Change | Persists across turns? | Persists across gateway restart? |
|---|---|---|
| Switching `model_preset` | Yes (current session) | Yes (saved with the session) |
| Adjusting `max_iterations` | Yes (in memory) | No (resets to `config.json`) |
| Scratchpad notes | Yes (shared across turns in memory) | No (cleared on restart) |
Most modifications are held in memory only. `model_preset` is the exception: it is
stored in the current session so the selection survives a restart.
> [!NOTE]
> The `my` tool **never** modifies `config.json` on disk. Do not store sensitive secrets or durable user preferences in scratchpad notes—use [Memory](./memory.md) for preferences that should last.
---
## Common Examples
## check — Check "my" current state
You do not need to call the tool manually—just ask nanobot in plain language:
Without parameters, returns a key config overview:
- *"What model and workspace are you using right now?"*
- *"Why didn't you search the web?"* (nanobot can check whether web search is enabled)
- *"Switch this conversation to my `deep` preset."* (when `allowSet` is enabled)
- *"Give yourself up to 80 iterations for this refactoring task."* (when `allowSet` is enabled)
```text
my(action="check")
# → max_iterations: 40
# context_window_tokens: 200000
# model: 'anthropic/claude-sonnet-4-6'
# workspace: PosixPath('/tmp/workspace')
# provider_retry_mode: 'standard'
# max_tool_result_chars: 16000
# _last_usage: {'prompt_tokens': 45000, 'completion_tokens': 8000}
# Note: prompt_tokens is cumulative across all turns, not current context window occupancy.
```
Note that `context_window_tokens` reports the configured window capacity, not live token usage. To see live context usage and per-round stats, use the [WebUI context indicator](./webui.md#activity-and-context-usage).
With a key parameter, drill into a specific config:
## Safety Boundaries
```text
my(action="check", key="_last_usage.prompt_tokens")
# → How many prompt tokens I've used so far
- **Never accessible:** Secrets (`apiKey`, `token`, `password`, `secret`, etc.), internal system objects, and channel credentials are always hidden and blocked from both reading and writing.
- **Read-only:** Workspace security restrictions, shell sandbox settings, and web configuration can be inspected for self-diagnosis, but the agent cannot weaken or modify them.
- **Validated limits:** Writable settings like `max_iterations` (`1`–`100`) and `model_preset` (must be an existing configured preset) are strictly validated.
my(action="check", key="model")
# → What model I'm currently running on
my(action="check", key="web_config.enable")
# → Whether web search is enabled
```
### What you can do with it
| Scenario | How |
|----------|-----|
| "What model are you using?" | `check("model")` |
| "Which model preset is active?" | `check("model_preset")` |
| "What is the per-turn iteration limit?" | `check("max_iterations")` |
| "How many tokens has this conversation used?" | `check("_last_usage")` — cumulative across all turns |
| "Where is your working directory?" | `check("workspace")` |
| "Show me your full config" | `check()` |
| "Are there any subagents running?" | `check("subagents")` — shows phase, iteration, elapsed time, tool events |
---
## set — Runtime tuning
Changes do not require a restart. `model_preset` is saved for the current session and
applies to its next turn; other writable runtime tuning takes effect immediately.
Direct `model` and `context_window_tokens` writes are rejected during an active session
because those setters change the shared instance default. Configure a named preset for
model or context-window changes instead.
```text
my(action="set", key="max_iterations", value=80)
# → Bump iteration limit from 40 to 80
my(action="set", key="model_preset", value="fast")
# → Use a configured model preset for this session's next turn
```
You can also store custom state in your scratchpad:
```text
my(action="set", key="current_project", value="nanobot")
my(action="set", key="user_style_preference", value="concise")
my(action="set", key="task_complexity", value="high")
# → These values persist into the next conversation turn
```
### Protected parameters
These parameters have type and range validation — invalid values are rejected:
| Parameter | Type | Range | Purpose |
|-----------|------|-------|---------|
| `max_iterations` | int | 1–100 | Max tool calls per conversation turn |
| `context_window_tokens` | int | 4,096–1,000,000 | Instance default; during a session, select through a preset |
| `model` | str | non-empty | Instance default; during a session, select through a preset |
| `model_preset` | str | configured preset name | Current session's preset for its next turn |
Other parameters (e.g. `workspace`, `provider_retry_mode`, `max_tool_result_chars`) can be set freely, as long as the value is JSON-safe.
---
## Practical Scenarios
### "This task is complex, I need more room"
```text
Agent: This codebase is large, let me switch this session to the configured deep preset.
→ my(action="set", key="model_preset", value="deep")
```
### "Simple question, don't waste compute"
```text
Agent: This is a straightforward question, let me switch to the fast preset.
→ my(action="set", key="model_preset", value="fast")
```
### "Remember user preferences across turns"
```text
Turn 1: my(action="set", key="user_prefers_concise", value=True)
Turn 2: my(action="check", key="user_prefers_concise")
# → True (still remembers the user likes concise replies)
```
### "Self-diagnosis"
```text
User: "Why aren't you searching the web?"
Agent: Let me check my web config.
→ my(action="check", key="web_config.enable")
# → False
Agent: Web search is disabled — please set web.enable: true in your config.
```
### "Token budget management"
```text
Agent: Let me check how much budget I have left.
→ my(action="check", key="_last_usage")
# → {"prompt_tokens": 45000, "completion_tokens": 8000}
Agent: I've used ~53k tokens total so far. I'll keep my remaining replies concise.
```
### "Subagent monitoring"
```text
Agent: Let me check on the background tasks.
→ my(action="check", key="subagents")
# → 2 subagent(s):
# [task-1] 'Code review'
# phase: running, iteration: 5, elapsed: 12.3s
# tools: read(✓), grep(✓)
# usage: {'prompt_tokens': 8000, 'completion_tokens': 1200}
# [task-2] 'Write tests'
# phase: pending, iteration: 0, elapsed: 0.2s
# tools: none
Agent: The code review is progressing well. The test task hasn't started yet.
```
---
## Safety Mechanisms
Core design principle: **The tool does not rewrite `config.json`.** Instance-wide
changes live in memory only, while `model_preset` persists only as the current
session's selector.
### Off-limits (BLOCKED)
Cannot be checked or modified — fully hidden:
| Category | Attributes | Reason |
|----------|-----------|--------|
| Core infrastructure | `bus`, `provider`, `_running` | Changes would crash the system |
| Tool registry | `tools` | Must not remove its own tools |
| Subsystems | `runner`, `sessions`, `consolidator`, etc. | Affects other users/sessions |
| Sensitive data | `_mcp_servers`, `_pending_queues`, etc. | Contains credentials and message routing |
| Security boundaries | `restrict_to_workspace`, `channels_config` | Bypassing would violate isolation |
| Python internals | `__class__`, `__dict__`, etc. | Prevents sandbox escape |
### Read-only (check only)
Can be checked but not set:
| Category | Attributes | Reason |
|----------|-----------|--------|
| Subagent manager | `subagents` | Observable, but replacing breaks the system |
| Execution config | `exec_config` | Can check sandbox/enable status, cannot change it |
| Web config | `web_config` | Can check enable status, cannot change it |
### Sensitive field protection
Sub-fields matching sensitive names (`api_key`, `password`, `secret`, `token`, etc.) are blocked from both check and set, regardless of parent path. This prevents credential leaks via dot-path traversal (e.g. `web_config.search.api_key`).
+150
View File
@@ -0,0 +1,150 @@
# Nanobot OpenAI-Compatible API: Run a Local Agent Behind /v1/chat/completions
nanobot can expose a minimal OpenAI-compatible endpoint for local integrations:
```bash
nanobot plugins enable api
nanobot agent -m "Hello!"
nanobot serve
```
Run the CLI check first. If `nanobot agent -m "Hello!"` fails, fix provider or config setup before debugging the API server. By default, the API binds to `127.0.0.1:8900`. You can change this in `config.json`.
For setup help, see [`quick-start.md`](./quick-start.md), [`providers.md`](./providers.md), and [`troubleshooting.md`](./troubleshooting.md).
## Authentication
Local-only `127.0.0.1` usage does not require an API key. If you bind the API
server to all interfaces with `api.host: "0.0.0.0"` or `"::"`, nanobot requires
`api.apiKey`; otherwise startup fails to avoid exposing an unauthenticated agent
endpoint on the network.
```json
{
"api": {
"host": "0.0.0.0",
"port": 8900,
"apiKey": "${NANOBOT_API_KEY}"
}
}
```
When `api.apiKey` is set, send it as a Bearer token on API routes. The health
endpoint remains unauthenticated so local probes and load balancers can still
check process health.
```bash
curl http://127.0.0.1:8900/v1/models \
-H "Authorization: Bearer $NANOBOT_API_KEY"
```
## Behavior
- Session isolation: pass `"session_id"` in the request body to isolate conversations; omit for a shared default session (`api:default`)
- Single-message input: each request must contain exactly one `user` message
- Fixed model: omit `model`, or pass the same model shown by `/v1/models`
- Streaming: set `stream=true` to receive Server-Sent Events (`text/event-stream`) with OpenAI-compatible delta chunks, terminated by `data: [DONE]`; omit or set `stream=false` for a single JSON response
- **File uploads**: supports images, PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx) via JSON base64 or `multipart/form-data` (max 10MB per file)
- API requests run in the synthetic `api` channel, so the `message` tool does **not** automatically deliver to Telegram/Discord/etc. To proactively send to another chat, call `message` with an explicit `channel` and `chat_id` for an enabled channel.
Example tool call for cross-channel delivery from an API session:
```json
{
"content": "Build finished successfully.",
"channel": "telegram",
"chat_id": "123456789"
}
```
If `channel` points to a channel that is not enabled in your config, nanobot will queue the outbound event but no platform delivery will occur.
## Endpoints
- `GET /health`
- `GET /v1/models`
- `POST /v1/chat/completions`
## curl
```bash
curl http://127.0.0.1:8900/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "hi"}],
"session_id": "my-session"
}'
```
## File Upload (JSON base64)
Send images inline using the OpenAI multimodal content format:
```bash
curl http://127.0.0.1:8900/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Describe this image"},
{"type": "image_url", "image_url": {"url": "data:image/png;base64,iVBOR..."}}
]}]
}'
```
## File Upload (multipart/form-data)
Upload any supported file type (images, PDF, Word, Excel, PPT) via multipart:
```bash
# Single file
curl http://127.0.0.1:8900/v1/chat/completions \
-F "message=Summarize this report" \
-F "files=@report.docx"
# Multiple files with session isolation
curl http://127.0.0.1:8900/v1/chat/completions \
-F "message=Compare these files" \
-F "files=@chart.png" \
-F "files=@data.xlsx" \
-F "session_id=my-session"
```
Supported file types:
- **Images**: PNG, JPEG, GIF, WebP (sent to AI as base64 for vision analysis)
- **Documents**: PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx) (text extracted and sent to AI)
- **Text**: TXT, Markdown, CSV, JSON, etc. (read directly)
## Python (`requests`)
```python
import requests
resp = requests.post(
"http://127.0.0.1:8900/v1/chat/completions",
json={
"messages": [{"role": "user", "content": "hi"}],
"session_id": "my-session", # optional: isolate conversation
},
timeout=120,
)
resp.raise_for_status()
print(resp.json()["choices"][0]["message"]["content"])
```
## Python (`openai`)
```python
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8900/v1",
api_key="dummy",
)
resp = client.chat.completions.create(
model="MiniMax-M2.7",
messages=[{"role": "user", "content": "hi"}],
extra_body={"session_id": "my-session"}, # optional: isolate conversation
)
print(resp.choices[0].message.content)
```
+31 -114
View File
@@ -4,7 +4,7 @@ This page is for cases where you already know what you want to connect and need
If this is your first install and terminal commands are new to you, start with [`start-without-technical-background.md`](./start-without-technical-background.md). If you want the field-by-field explanation, read [`providers.md`](./providers.md) and then [`configuration.md#providers`](./configuration.md#providers).
Use **Settings → Models** for the recipes below. The collapsed **Manual configuration** examples are snippets for headless deployments or configuration managed as code. Keep existing config sections when merging a snippet, and keep real credentials on your own machine.
Most examples below are snippets to merge into `~/.nanobot/config.json`. Keep any existing sections you still need, and replace placeholder keys such as `${OPENROUTER_API_KEY}` with environment-variable references or real values only on your own machine.
Recipes are examples, not rankings. Pick the recipe that matches the credential, endpoint, and model ID you already intend to use.
@@ -27,14 +27,12 @@ Match the recipe to the credential or endpoint you already have:
## How to Use a Recipe
1. Install nanobot and open `nanobot webui`.
2. Open **Settings → Models → New preset**. If **Convert to presets** appears, choose it first.
3. Select the recipe's provider from **Provider**, or choose **Add provider** and save its credentials and endpoint.
4. Select a model available to your account. Expand **Advanced options** if you need generation settings or an explicit request API.
5. Save the preset and select it in the chat composer.
6. Send `Hello!` and confirm a normal reply before connecting a chat app.
For fallback recipes, create each preset first, then use **Enable preset** and arrange the order in **Settings → Models**. The first enabled preset is the primary; the others are fallbacks.
1. Install nanobot and run `nanobot onboard` once so `~/.nanobot/config.json` exists. Use `nanobot onboard --wizard` if you prefer prompts over hand-editing JSON.
2. Put secrets in environment variables when possible.
3. Merge the recipe snippet into `~/.nanobot/config.json`.
4. Run `nanobot status`.
5. Run `nanobot agent -m "Hello!"`.
6. If the CLI works, then connect WebUI, gateway, or chat apps.
The active model should normally come from `agents.defaults.modelPreset`, and that name should point to an entry in `modelPresets`. Direct `agents.defaults.provider` and `agents.defaults.model` still work for older configs, but presets are easier to switch and easier to reuse as fallbacks.
@@ -62,13 +60,8 @@ Environment variables set this way apply only to the current terminal. For long-
## Recipe: OpenRouter Gateway
Select OpenRouter in **Settings → Models → New preset**, add its API key through **Provider → Add provider** if needed, and choose a model available to your account. Save and select the preset in chat.
This recipe applies when one API key routes many hosted model families.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -93,8 +86,6 @@ This recipe applies when one API key routes many hosted model families.
}
```
</details>
Verify:
```bash
@@ -106,15 +97,12 @@ If this fails with `401` or `unauthorized`, check that `OPENROUTER_API_KEY` is v
## Recipe: OpenCode Zen or Go
In **Settings → Models → New preset**, choose OpenCode Zen or OpenCode Go to match your account, add its credential, select a model from that endpoint, and save. Select the preset in chat.
This recipe applies when your credential comes from OpenCode Zen or OpenCode Go. Both providers use `OPENCODE_API_KEY`; pick the provider block that matches the subscription or balance you want to use.
This recipe applies when your credential comes from OpenCode Zen or OpenCode Go.
Both providers use `OPENCODE_API_KEY`; pick the provider block that matches the
subscription or balance you want to use.
OpenCode Zen:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -139,13 +127,8 @@ OpenCode Zen:
}
```
</details>
OpenCode Go:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -170,8 +153,6 @@ OpenCode Go:
}
```
</details>
Verify:
```bash
@@ -179,17 +160,16 @@ nanobot status
nanobot agent -m "Hello!"
```
OpenCode's docs list models across multiple endpoint types. The `opencode_zen` and `opencode_go` providers in nanobot use the OpenAI-compatible `chat/completions` path. If a model fails with `model not found` or an endpoint shape error, choose a model that OpenCode lists under `chat/completions` for the matching Zen or Go endpoint.
OpenCode's docs list models across multiple endpoint types. The `opencode_zen`
and `opencode_go` providers in nanobot use the OpenAI-compatible
`chat/completions` path. If a model fails with `model not found` or an endpoint
shape error, choose a model that OpenCode lists under `chat/completions` for the
matching Zen or Go endpoint.
## Recipe: OpenAI Direct
In **Settings → Models → New preset**, select OpenAI, add its API key, choose a model available to your account, and save. Leave request API selection on Auto unless your endpoint requires an explicit choice.
This recipe applies when you have an OpenAI API key and want to call OpenAI directly instead of through a gateway.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -214,25 +194,18 @@ This recipe applies when you have an OpenAI API key and want to call OpenAI dire
}
```
</details>
Verify:
```bash
OPENAI_API_KEY="sk-..." nanobot agent -m "Hello!"
```
If your shell cannot use inline environment variables, set `OPENAI_API_KEY` first and then run `nanobot agent -m "Hello!"`. Leave API selection on Auto unless you need a specific API in the preset's **Advanced options**; see [preset API settings](./configuration.md#preset-request-api).
If your shell cannot use inline environment variables, set `OPENAI_API_KEY` first and then run `nanobot agent -m "Hello!"`. If the provider rejects `apiType`, remove `apiType` unless you are using a documented OpenAI-specific mode.
## Recipe: Anthropic Direct
In **Settings → Models → New preset**, select Anthropic, add its API key, choose a Claude model available to your account, and save. Select the preset in chat.
This recipe applies when your key comes from Anthropic and your model name is an Anthropic model ID, not an OpenRouter model path.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -257,8 +230,6 @@ This recipe applies when your key comes from Anthropic and your model name is an
}
```
</details>
Verify:
```bash
@@ -269,9 +240,6 @@ If you copied a model name such as `anthropic/claude-sonnet-4.5`, that is a gate
If you use an Anthropic-compatible proxy, keep the preset provider as `anthropic` and set `providers.anthropic.apiBase`:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -297,19 +265,12 @@ If you use an Anthropic-compatible proxy, keep the preset provider as `anthropic
}
```
</details>
Do not configure Anthropic-compatible endpoints as arbitrary custom provider names; named custom providers use the OpenAI-compatible request format.
## Recipe: Kimi Coding Plan
In **Settings → Models → New preset**, select Kimi Coding, add your Coding Plan key, choose `kimi-for-coding`, and save. Select the preset in chat.
This recipe applies when your key comes from Kimi's Coding Plan endpoint. Nanobot uses a dedicated `kimi_coding` provider for this Anthropic Messages API endpoint; do not configure it as a generic `custom` provider.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -333,8 +294,6 @@ This recipe applies when your key comes from Kimi's Coding Plan endpoint. Nanobo
}
```
</details>
Verify:
```bash
@@ -346,13 +305,8 @@ The default base URL is `https://api.kimi.com/coding/v1`. This endpoint requires
## Recipe: Custom OpenAI-Compatible Provider
In **Settings → Models → New preset → Provider → Add provider**, create a custom connection with the endpoint URL and any required key. Select its served model, save the preset, and select it in chat.
This recipe applies to an OpenAI-compatible service that is not a named nanobot provider.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -378,8 +332,6 @@ This recipe applies to an OpenAI-compatible service that is not a named nanobot
}
```
</details>
Verify the endpoint before blaming nanobot:
```bash
@@ -391,9 +343,6 @@ nanobot agent -m "Hello!"
For multiple custom endpoints, do not overload the single `custom` block. Name each endpoint under `providers` and reference that same name from the preset:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -429,26 +378,17 @@ For multiple custom endpoints, do not overload the single `custom` block. Name e
}
```
</details>
These custom names define direct connections: `apiBase` is required and `apiKey` is optional when the endpoint allows anonymous or placeholder credentials. Declare accepted protocols and a default with [`providers.<name>.api`](./configuration.md#custom-connection-apis). An Anthropic-compatible endpoint uses `supportedApis: ["anthropic_messages"]`; model presets can select any protocol within the connection declaration.
These custom names behave like direct OpenAI-compatible providers: `apiBase` is required, `apiKey` is optional when the endpoint allows anonymous or placeholder credentials, and `apiType` should be left unset. They do not support Anthropic-compatible endpoints; use the `anthropic` provider with `apiBase` for that case.
## Recipe: Ollama Local Model
Follow the server preparation below, then open **Settings → Models → New preset**, select or add an Ollama connection at `http://localhost:11434/v1`, choose the downloaded model, and save. Select the preset in chat. If nanobot runs in a container or on another computer, `localhost` refers to that host; use an address reachable from nanobot.
If Ollama is not installed, follow its [official quickstart](https://docs.ollama.com/quickstart) ([Linux setup](https://docs.ollama.com/linux)). Keep the Ollama app or service running. If no service is running, start `ollama serve` in a terminal and leave it open; do not start a second server when the app or system service already owns the port. In a separate terminal, download a model and confirm it is listed:
This recipe applies when Ollama is already installed and the model has been pulled locally.
```bash
ollama serve
ollama pull llama3.2
ollama list
```
Use that exact model name in nanobot. Downloading requires internet access and disk space; model inference then runs on the machine hosting Ollama.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -473,31 +413,25 @@ Use that exact model name in nanobot. Downloading requires internet access and d
}
```
</details>
Verify:
```bash
curl -sS http://localhost:11434/v1/models
nanobot agent -m "Hello!"
```
Send `Hello!` in the WebUI with the local preset selected. A CLI test uses its own session/default selection; to make the local preset the global primary, enable it and move it first in **Settings → Models**.
Local inference does not disable network tools. For local-only document work, turn off **Web access**, avoid cloud fallbacks and remote integrations, and review shell access. Shell commands can still use the network even with a sandbox; a strict offline policy needs host/container network controls. See [local tool security](./guides/secure-local-ai-agent.md).
If you see `connection refused`, Ollama is not running or `apiBase` points to the wrong port. If every response is slow, try a smaller local model or lower `contextWindowTokens`.
If direct Ollama responses are fast but tool-using nanobot turns repeatedly evaluate thousands of prompt tokens, the model's chat template may be moving its tool definitions between requests. See [Improve Ollama Tool-Calling Prompt Cache Reuse](./guides/configure-ollama-prompt-cache.md) for a diagnostic procedure and an optional model-specific workaround.
If direct Ollama responses are fast but tool-using nanobot turns repeatedly evaluate
thousands of prompt tokens, the model's chat template may be moving its tool
definitions between requests. See
[Improve Ollama Tool-Calling Prompt Cache Reuse](./guides/configure-ollama-prompt-cache.md)
for a diagnostic procedure and an optional model-specific workaround.
## Recipe: vLLM or LM Studio
Start your local model server, then use **Settings → Models → New preset** to add its connection with the local `/v1` endpoint and any required key. Enter the served model name, save, and select the preset in chat.
This recipe applies when a local server exposes an OpenAI-compatible `/v1` API.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -523,13 +457,8 @@ This recipe applies when a local server exposes an OpenAI-compatible `/v1` API.
}
```
</details>
For LM Studio, use its local base URL and provider name:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -553,19 +482,12 @@ For LM Studio, use its local base URL and provider name:
}
```
</details>
The config key can be `lmStudio` or `lm_studio`, but the preset provider should use the registry name `lm_studio`.
## Recipe: Fallback Presets
Create each preset in **Settings → Models**, use **Enable preset**, and arrange the primary first with backups after it. Test each preset in chat before relying on the fallback order.
This recipe applies when one provider sometimes rate-limits, one model is expensive, or you want a local backup.
<details>
<summary>Manual configuration</summary>
```json
{
"modelPresets": {
@@ -600,15 +522,13 @@ This recipe applies when one provider sometimes rate-limits, one model is expens
}
```
</details>
`fallbackModels` belongs under `agents.defaults`. String entries are preset names, not raw model names. nanobot tries the active preset first, then the fallback presets in order.
Keep fallback candidates realistic. If the local fallback has a smaller context window, nanobot must build context that fits the smallest window in the active chain.
## Recipe: Langfuse Tracing
This recipe applies after the agent works and you want observability for OpenAI-compatible provider calls, or for the Codex OAuth provider.
This recipe applies after the agent works and you want observability for OpenAI-compatible provider calls.
Install the optional package in the same Python environment that runs nanobot:
@@ -634,15 +554,12 @@ $env:LANGFUSE_BASE_URL = "https://cloud.langfuse.com"
nanobot agent -m "Hello!"
```
Langfuse is not a model provider in `config.json`. It is configured through environment variables and traces supported OpenAI-compatible provider calls, plus Codex OAuth provider calls via Langfuse's native SDK. Other native providers that do not use either path may not produce Langfuse traces.
Langfuse is not a model provider in `config.json`. It is configured through environment variables and traces supported OpenAI-compatible provider calls. Native providers that do not use that client path may not produce Langfuse OpenAI-wrapper traces.
## Recipe: Switch Models at Runtime
Use this after you have more than one preset and are chatting through a supported channel.
<details>
<summary>Manual configuration</summary>
```json
{
"modelPresets": {
@@ -667,8 +584,6 @@ Use this after you have more than one preset and are chatting through a supporte
}
```
</details>
In chat:
```text
@@ -677,7 +592,9 @@ In chat:
/model fast
```
`/model` stores the selection in the current session without rewriting `config.json`. The selection survives restarts, does not affect other sessions, and an in-progress turn keeps using the model it started with.
`/model` stores the selection in the current session without rewriting `config.json`.
The selection survives restarts, does not affect other sessions, and an in-progress
turn keeps using the model it started with.
## Quick Failure Map
@@ -687,7 +604,7 @@ In chat:
| `model not found` | The model ID does not belong to the selected provider or gateway | Compare `modelPresets.<name>.provider` and `modelPresets.<name>.model` |
| `connection refused` | Local server is not running or `apiBase` has the wrong port/path | Run `curl <apiBase>/models` |
| `provider not found` | Provider name is misspelled or uses the config key instead of registry name | Use names such as `openrouter`, `openai`, `anthropic`, `ollama`, `vllm`, `lm_studio` |
| Langfuse shows no traces | Env vars are missing, `langfuse` is not installed in the active Python environment, or the provider path is a native provider other than Codex OAuth | Run `python -m pip show langfuse` and restart nanobot from the same environment |
| Langfuse shows no traces | Env vars are missing, `langfuse` is not installed in the active Python environment, or the provider path is native | Run `python -m pip show langfuse` and restart nanobot from the same environment |
## Next References
+81 -158
View File
@@ -2,18 +2,15 @@
Use this page when the first reply fails because of provider/model mismatch, or when you want to adapt the concrete setup example to a different provider. If you already know which provider you want and only need a pasteable setup, use [`provider-cookbook.md`](./provider-cookbook.md).
For normal local setup, open **Settings → Models → New preset**, select your provider (or click **Add provider**), and pick a model. Expand **Manual configuration** below if you manage `config.json` directly or deploy headlessly.
For normal local setup, open **Settings → Models** in the WebUI to add provider credentials, create a model preset, and select the active model. Use the JSON below for manual deployments, local endpoints, provider-specific fields, or diagnosis.
> [!NOTE]
> For OAuth providers (OpenAI Codex, xAI Grok, and GitHub Copilot), the model picker fetches available models from your signed-in account. If your session expires, click **Sign in again**; if a fallback model handles a reply, a banner above the composer lets you know.
For every setup, answer three questions:
For every setup, make sure three things match:
1. Which provider owns the credential or endpoint?
2. What model name does that provider expect?
3. Does the provider need `apiKey`, `apiBase`, OAuth login, cloud credentials, or only a local server URL?
1. Which provider owns the credential or endpoint.
2. Which exact model ID that provider expects.
3. What authentication it uses (API key, OAuth sign-in, cloud credentials, or a local server URL).
Prefer creating a named preset in **Settings → Models** and pinning its `provider` explicitly—it makes `/model` switching and fallbacks much easier to manage.
Prefer a named `modelPresets` entry for the model/provider pair, then select it with `agents.defaults.modelPreset`. Direct `agents.defaults.provider` and `agents.defaults.model` still work for existing configs, but presets make runtime `/model` switching and fallback chains clearer. Pin `provider` inside the preset while setting up; you can switch back to `"auto"` later.
## Choose a Provider Without Guessing
@@ -25,16 +22,11 @@ The docs show concrete provider names so the JSON is copyable, not because nanob
| An OpenCode Zen or Go key | `providers.opencodeZen.apiKey` or `providers.opencodeGo.apiKey`, then a preset with `provider: "opencode_zen"` or `provider: "opencode_go"`. |
| A company proxy or regional endpoint | The matching provider block plus `apiBase` if the proxy gives you a URL. |
| A local OpenAI-compatible server | A local provider block such as `ollama`, `vllm`, `lmStudio`, or `custom`, usually with `apiBase`. |
| An OAuth-based account | Choose the provider in **Settings → Models**, complete its sign-in flow, and select it explicitly in a preset. |
| No provider yet | Follow [Prepare your model details](./start-without-technical-background.md#2-prepare-your-model-details) for an API account example, or the [Ollama recipe](./provider-cookbook.md#recipe-ollama-local-model) for local models. Check account access, pricing, regional availability, and privacy requirements before choosing. |
| An OAuth-based account | Run the matching `nanobot provider login ...` command, then select that provider explicitly in a preset. |
| No provider yet | Pick one outside nanobot based on account access, pricing, regional availability, privacy requirements, and the model IDs you need. Then come back with its key and model ID. |
## Minimal Shape
Create and select a preset through **Settings → Models** as described above. The JSON alternative shows where those values are stored.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -59,8 +51,6 @@ Create and select a preset through **Settings → Models** as described above. T
}
```
</details>
The provider config gives nanobot credentials and endpoint details. The model preset names the provider/model pair. The agent defaults choose which named preset to use for normal turns. Replace the example provider and model together; mixing an API key from one provider with a model ID from another is the most common first-run failure.
## Provider, Model, API Key, and Base URL
@@ -73,15 +63,11 @@ These fields answer different questions:
| `model` | `modelPresets.<name>.model` | The model ID expected by that provider or gateway. |
| `apiKey` | `providers.<provider>.apiKey` | Credential for that provider. Use `${ENV_VAR}` for secrets. |
| `apiBase` | `providers.<provider>.apiBase` | HTTP base URL of the provider endpoint. |
| `use_proxy` | `providers.<provider>.useProxy` | Use the shared `network.proxy` address for this provider. Supported for OpenAI-compatible providers, Anthropic Messages, OpenAI Codex, and xAI OAuth. |
| `proxy` | `providers.<provider>.proxy` | Optional HTTP proxy for this provider only. Supported for OpenAI-compatible providers, OpenAI Codex, and xAI OAuth. |
You usually omit `apiBase` for hosted built-in providers such as OpenRouter, Anthropic direct, OpenAI direct, Groq, or Bedrock because nanobot knows their default endpoints. Set `apiBase` for `custom`, local OpenAI-compatible servers, provider proxies, regional endpoints, or subscription endpoints. Include the API version path when the endpoint requires it, for example `https://api.example.com/v1` or `http://localhost:11434/v1`.
Use `proxy` when one provider must send HTTP traffic through a proxy without changing process-wide `HTTP_PROXY` / `HTTPS_PROXY`. Supported providers include `openai`, `custom`, named custom providers, OpenRouter-style gateways, local OpenAI-compatible servers, Anthropic Messages, `openai_codex`, and `xai_grok`. For OAuth providers, this also covers exchanging and refreshing tokens. `bedrock`, `azure_openai`, and `github_copilot` reject `proxy`; use their endpoint-specific configuration instead.
Tool calling requires a model and endpoint that return structured tool calls (if replies show raw `<tool_call>` or `<function=...>` text, enable your server's tool-call parser or switch to a tool-capable model).
Large image attachments are automatically resized/compressed as needed before sending to your model provider while keeping your original files untouched.
Use `proxy` when one provider must send HTTP traffic through a proxy without changing process-wide `HTTP_PROXY` / `HTTPS_PROXY`. This is supported for providers that use nanobot's OpenAI-compatible client, including `openai`, `custom`, named custom providers, OpenRouter-style gateways, local OpenAI-compatible servers, and similar registry entries. It is also supported for `openai_codex` and `xai_grok`, including OAuth token exchange/refresh and model requests. Native provider backends such as `anthropic`, `bedrock`, `azure_openai`, and `github_copilot` reject `proxy`; use their endpoint-specific configuration instead.
## Common Provider Patterns
@@ -89,9 +75,6 @@ Large image attachments are automatically resized/compressed as needed before se
Gateway-style setup for model IDs served through OpenRouter.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -115,15 +98,10 @@ Gateway-style setup for model IDs served through OpenRouter.
}
```
</details>
Use the model ID exactly as OpenRouter lists it.
To opt into OpenRouter server-managed search and fetch, add:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -139,16 +117,16 @@ To opt into OpenRouter server-managed search and fetch, add:
}
```
</details>
Chat Completions-compatible OpenRouter [server tools](https://openrouter.ai/docs/guides/features/server-tools), such as those above, are appended to nanobot's generated functions. This keeps unrelated local tools such as `write_file` available in the same request. Responses-only server tools require an API surface that the OpenRouter provider does not currently enable.
Chat Completions-compatible OpenRouter
[server tools](https://openrouter.ai/docs/guides/features/server-tools), such as those above, are
appended to nanobot's generated functions. This keeps unrelated local tools such as `write_file`
available in the same request. Responses-only server tools require an API surface that the
OpenRouter provider does not currently enable.
### OrcaRouter Gateway
[OrcaRouter](https://www.orcarouter.ai) is an OpenAI-compatible model routing gateway. Configure the built-in `orcarouter` provider and use a model ID from OrcaRouter's catalog:
<details>
<summary>Manual configuration</summary>
[OrcaRouter](https://www.orcarouter.ai) is an OpenAI-compatible model routing gateway. Configure
the built-in `orcarouter` provider and use a model ID from OrcaRouter's catalog:
```json
{
@@ -173,16 +151,17 @@ Chat Completions-compatible OpenRouter [server tools](https://openrouter.ai/docs
}
```
</details>
Use the model ID exactly as OrcaRouter lists it. `orcarouter/auto` routes to a suitable upstream automatically; explicit IDs such as `anthropic/claude-sonnet-4.6` or `openai/gpt-5` are also accepted. OrcaRouter API keys start with `sk-orca-`. The WebUI can load the account's model catalog after the API key is saved under **Settings → Models**.
Use the model ID exactly as OrcaRouter lists it. `orcarouter/auto` routes to a
suitable upstream automatically; explicit IDs such as
`anthropic/claude-sonnet-4.6` or `openai/gpt-5` are also accepted. OrcaRouter API keys start with
`sk-orca-`. The WebUI can load the account's model catalog after the API key is saved under
**Settings → Models**.
### Eden AI Gateway
Eden AI exposes an OpenAI-compatible chat-completions endpoint at `https://api.edenai.run/v3`. Configure the built-in `edenai` provider and use the full `provider/model` identifier listed by Eden AI:
<details>
<summary>Manual configuration</summary>
Eden AI exposes an OpenAI-compatible chat-completions endpoint at
`https://api.edenai.run/v3`. Configure the built-in `edenai` provider and use
the full `provider/model` identifier listed by Eden AI:
```json
{
@@ -206,16 +185,16 @@ Eden AI exposes an OpenAI-compatible chat-completions endpoint at `https://api.e
}
```
</details>
Nanobot sends the model ID unchanged, including its provider prefix. Use Eden AI's [model listing](https://www.edenai.co/docs/v3/llms/listing-models) to choose a currently available model. The WebUI can also load that catalog after the Eden AI API key is saved under **Settings → Models**.
Nanobot sends the model ID unchanged, including its provider prefix. Use
Eden AI's [model listing](https://www.edenai.co/docs/v3/llms/listing-models)
to choose a currently available model. The WebUI can also load that catalog
after the Eden AI API key is saved under **Settings → Models**.
### OpenCode Zen and Go
OpenCode Zen and OpenCode Go are OpenCode-managed gateways for coding-agent models. They share `OPENCODE_API_KEY`, but use separate provider config keys and default base URLs in nanobot.
<details>
<summary>Manual configuration</summary>
OpenCode Zen and OpenCode Go are OpenCode-managed gateways for coding-agent models.
They share `OPENCODE_API_KEY`, but use separate provider config keys and default base
URLs in nanobot.
```json
{
@@ -240,13 +219,8 @@ OpenCode Zen and OpenCode Go are OpenCode-managed gateways for coding-agent mode
}
```
</details>
For OpenCode Go, switch the provider block and preset:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -265,17 +239,15 @@ For OpenCode Go, switch the provider block and preset:
}
```
</details>
OpenCode documents model IDs with `opencode/<model-id>` for Zen and `opencode-go/<model-id>` for Go. nanobot accepts those prefixes and strips them before sending the request to OpenCode. Choose a model served through Chat Completions or Responses by the matching Zen or Go service; models that require Anthropic Messages or another provider-specific API are not supported by these connections.
Leave API selection on **Auto** for OpenCode Go's `muse-spark-1.2-contributor` and `muse-spark-1.3-contributor`; these models use Responses automatically. Other models use Chat Completions by default. If another model requires Responses, select it in the preset's **Advanced options** only when the service supports it. See [preset API settings](./configuration.md#preset-request-api).
OpenCode documents model IDs with `opencode/<model-id>` for Zen and
`opencode-go/<model-id>` for Go. nanobot accepts those prefixes and strips them
before sending the request to OpenCode. Use model IDs that OpenCode lists under
the `chat/completions` endpoint; models listed only under `responses`,
`messages`, or provider-specific endpoints are not handled by this
OpenAI-compatible provider path.
### Anthropic Direct
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -299,15 +271,10 @@ Leave API selection on **Auto** for OpenCode Go's `muse-spark-1.2-contributor` a
}
```
</details>
Anthropic direct uses the native Anthropic provider. Do not use an OpenRouter model ID unless the provider is OpenRouter.
If you use an Anthropic-compatible proxy, keep the provider as `anthropic` and override `apiBase`:
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -325,15 +292,10 @@ If you use an Anthropic-compatible proxy, keep the provider as `anthropic` and o
}
```
</details>
For a named custom provider serving Anthropic Messages, set `providers.<name>.api.supportedApis` to `["anthropic_messages"]`. Auto presets then use Messages with that connection's credentials and endpoint.
Arbitrary custom provider names are OpenAI-compatible only; they do not use the Anthropic Messages API request format.
### OpenAI Direct
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -357,27 +319,14 @@ For a named custom provider serving Anthropic Messages, set `providers.<name>.ap
}
```
</details>
`providers.openai.apiType` may be set when you need to force a specific OpenAI API surface. Other providers reject `apiType`; leave it unset outside `providers.openai`. Replace the model with a model ID available to your OpenAI account. Direct OpenAI Responses, OpenAI Codex, Azure OpenAI Responses, and eligible GitHub Copilot models share [opaque Responses state retention](./configuration.md#responses-state-and-compaction); native compaction is enabled only where the backend supports it. The WebUI exposes provider-native switches for OpenAI web search, Codex Fast mode, DeepSeek web search, and Grok X Search. These switches write the corresponding raw provider request fields under `extraBody`.
Replace the model with a model ID available to your account. Leave API selection on Auto unless you need to choose Chat Completions or Responses in the preset's **Advanced options**. See [preset API settings](./configuration.md#preset-request-api) for WebUI and JSON configuration. `providers.openai.api` sets the connection default; explicit presets override it.
### DeepSeek
Select **DeepSeek** in **Settings → Models**. Use `deepseek-flash` for text and image input, or `deepseek-v4-pro` for text-only input. The official service also accepts `deepseek-v4-flash` and `deepseek-v4-flash-vision-exp` as Flash aliases; see [current model details](https://api-docs.deepseek.com/quick_start/pricing) for availability.
Known Flash and Pro models offer `none`, `low`, `high`, and `max` reasoning settings. Leave reasoning effort empty to follow the provider default (currently thinking enabled at `high`), or choose `none` to disable thinking. The output budget covers both reasoning and the final answer.
**Auto** uses Responses for these models at the official endpoint (`https://api.deepseek.com`, with or without `/v1`). With a proxy, keep the model ID it documents: `deepseek-flash` defaults to Chat Completions on other endpoints, while the V4 names above default to Responses. Select Responses explicitly for `deepseek-flash` only if your proxy supports it; see [preset API settings](./configuration.md#preset-request-api).
For web search, configure nanobot's [web search tool](./guides/configure-web-search.md). Selecting a DeepSeek model does not enable DeepSeek-hosted search.
DeepSeek is the model-level exception in the OpenAI-compatible provider: `deepseek-v4-flash` and `deepseek-v4-pro` automatically use DeepSeek's native Responses API. Its native `web_search` tool is enabled by default and shows its lifecycle in WebUI chat activity; set `providers.deepseek.extraBody.tools` to `[]` to disable it.
### Custom OpenAI-Compatible Endpoint
The `custom` provider fits one OpenAI-compatible endpoint that is not represented by a named provider.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -402,15 +351,10 @@ The `custom` provider fits one OpenAI-compatible endpoint that is not represente
}
```
</details>
`custom` does not infer a default base URL. Set `apiBase`.
If you have more than one custom OpenAI-compatible endpoint, give each endpoint its own provider key under `providers` and use that same key in the model preset. The key can be a name that makes sense in your environment, such as `companyProxy`, `tenant-a`, or `dev-local`.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -444,21 +388,18 @@ If you have more than one custom OpenAI-compatible endpoint, give each endpoint
}
```
</details>
Custom provider keys define direct connections. Without an API declaration, they use OpenAI-compatible Chat Completions. `apiBase` is required because nanobot cannot know the endpoint URL. `apiKey` is optional for local servers or private proxies that do not require one. Choose a name that does not conflict with a built-in provider name or alias, such as `openai`, `openai-codex`, `github-copilot`, or `lm-studio`. Declare the accepted protocols under `api` as described in [connection request APIs](./configuration.md#custom-connection-apis).
Custom provider keys are treated as direct OpenAI-compatible providers. `apiBase` is required because nanobot cannot know the endpoint URL. `apiKey` is optional for local servers or private proxies that do not require one. Choose a name that does not conflict with a built-in provider name or alias, such as `openai`, `openai-codex`, `github-copilot`, or `lm-studio`. Do not set `apiType` on custom provider keys; `apiType` is only for `providers.openai`.
If your custom endpoint documents a nonstandard thinking toggle, set `providers.<name>.thinkingStyle` to `thinking_type`, `enable_thinking`, or `reasoning_split`; nanobot then maps `reasoningEffort` onto that provider-specific request body. Leave it unset for ordinary OpenAI-compatible endpoints.
This named custom provider path is not for Anthropic-compatible endpoints. For Anthropic-compatible proxies, use `providers.anthropic.apiBase` and set the preset provider to `anthropic`.
### ModelScope
ModelScope (魔搭社区) exposes an OpenAI-compatible LLM endpoint plus a separate async image generation API. Both are covered by the built-in `modelscope` provider.
Create a ModelScope [access token](https://modelscope.cn/my/myaccesstoken), then choose a model whose page exposes API-Inference. The example below uses [`Qwen/Qwen3-32B`](https://modelscope.cn/models/Qwen/Qwen3-32B); hosted availability and quotas are controlled by ModelScope. See the official [API-Inference guide](https://modelscope.cn/docs/model-service/API-Inference/intro) for current service details.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -482,15 +423,10 @@ Create a ModelScope [access token](https://modelscope.cn/my/myaccesstoken), then
}
```
</details>
Use an inference-enabled model ID exactly as ModelScope publishes it (usually `Namespace/model-name`). The default base URL is `https://api-inference.modelscope.cn/v1`; override `providers.modelscope.apiBase` only if your account routes through a different host. Chat model IDs may optionally be prefixed with `modelscope/`; nanobot strips that routing prefix before sending the request.
ModelScope image generation reuses the same provider key but is configured under `tools.imageGeneration`, not in a model preset:
<details>
<summary>Manual configuration</summary>
```json
{
"tools": {
@@ -503,16 +439,11 @@ ModelScope image generation reuses the same provider key but is configured under
}
```
</details>
Use the image model's exact ModelScope ID without a leading `modelscope/`; the image client sends this value unchanged and handles ModelScope's async submit/poll flow. The example uses [`Qwen/Qwen-Image-2512`](https://modelscope.cn/models/Qwen/Qwen-Image-2512). See [Image Generation](./image-generation.md#modelscope) for supported sizes, aspect ratios, and the complete provider configuration.
### Ollama
Prepare Ollama using the [local model recipe](./provider-cookbook.md#recipe-ollama-local-model), then point nanobot at its OpenAI-compatible endpoint.
<details>
<summary>Manual configuration</summary>
Start Ollama separately, then point nanobot at the OpenAI-compatible endpoint.
```json
{
@@ -537,17 +468,17 @@ Prepare Ollama using the [local model recipe](./provider-cookbook.md#recipe-olla
}
```
</details>
Most Ollama setups do not require an API key.
Ollama renders the OpenAI-compatible messages and tools through each model's chat template. If ordinary model responses are fast but tool-using turns show low prompt cache reuse, diagnose the rendered template before changing nanobot's context or memory settings. The [Ollama prompt-cache guide](./guides/configure-ollama-prompt-cache.md) explains the log pattern and a tested `llama3.1:8b` workaround.
Ollama renders the OpenAI-compatible messages and tools through each model's chat
template. If ordinary model responses are fast but tool-using turns show low prompt
cache reuse, diagnose the rendered template before changing nanobot's context or
memory settings. The
[Ollama prompt-cache guide](./guides/configure-ollama-prompt-cache.md) explains the
log pattern and a tested `llama3.1:8b` workaround.
### vLLM or Other Local OpenAI-Compatible Server
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -572,15 +503,10 @@ Ollama renders the OpenAI-compatible messages and tools through each model's cha
}
```
</details>
Some OpenAI-compatible local servers require any non-empty API key even when they do not validate it.
### LM Studio
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -604,17 +530,12 @@ Some OpenAI-compatible local servers require any non-empty API key even when the
}
```
</details>
Config keys may be camelCase or snake_case. Provider names in model presets should use the registry name, such as `lm_studio`.
### AWS Bedrock
Bedrock can use the AWS credential chain, profile, region, or Bedrock bearer token depending on your AWS setup.
<details>
<summary>Manual configuration</summary>
```json
{
"providers": {
@@ -639,37 +560,58 @@ Bedrock can use the AWS credential chain, profile, region, or Bedrock bearer tok
}
```
</details>
See [`configuration.md#providers`](./configuration.md#providers) for Bedrock-specific notes.
### OAuth Providers
These providers use account sign-in instead of API keys in `config.json`. You can sign in through **Settings → Models** in the WebUI or from the terminal:
Some providers do not use API keys in `config.json`.
**OpenAI Codex**
For OpenAI Codex:
```bash
nanobot provider login openai-codex --set-main
```
**xAI Grok (requires an eligible X Premium / Grok subscription)**
The WebUI reads the account's Codex model catalog online, including current
context-window and reasoning-effort metadata. A small compatible catalog remains
available when the service cannot be reached.
For an eligible X Premium / Grok subscription:
```bash
nanobot provider login xai-grok --set-main
```
Hosted X Search is enabled by default for supported Grok models and can be turned off in WebUI model settings (or via `providers.xaiGrok.extraBody.tools: []`). Credentials are stored in `~/.nanobot/auth/xai.json`.
This selects `xai-grok/grok-4.6`. The WebUI model selector reads xAI's online
model catalog, so newly available subscription models appear without a nanobot
release. Online metadata is cached and enriched with nanobot's curated labels;
if xAI is temporarily unavailable, nanobot uses the last successful catalog or
a small built-in fallback instead of emptying the selector. The same catalog
controls whether the provider exposes the hosted `x_search` tool; models that do
not advertise support continue without hosted X Search.
When enabled, Grok can search current X posts and return inline source links
without invoking a local nanobot tool. Credentials are stored under the
active instance's `auth/xai.json` (normally `~/.nanobot/auth/xai.json`), not in
`config.json` and not in Grok Build's credential file.
Hosted X Search remains enabled by default and can be disabled with the WebUI
switch or `providers.xaiGrok.extraBody.tools: []`.
**GitHub Copilot**
The login is xAI subscription OAuth, not X Developer OAuth. It follows the
public client contract documented and implemented by
[Grok Build](https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/02-authentication.md);
xAI may change that upstream contract independently of nanobot.
Sign in from **Settings → Models** using the device-code flow (copy the code, click **Open GitHub**, and approve—works from remote browsers too), or from the terminal:
For GitHub Copilot:
```bash
nanobot provider login github-copilot --set-main
```
Each `--set-main` command signs in and sets that provider's default model as active. See [Provider and Model Problems](./troubleshooting.md#provider-and-model-problems) if you need proxy or headless-server login steps.
The WebUI reads the models enabled for the signed-in Copilot account. nanobot
lists entries that support its current Copilot chat-completions or Responses
transport and hides models that it cannot route safely.
Each command authenticates the selected provider and makes its current default model active. OpenAI Codex and eligible GitHub Copilot models participate in [Responses state retention](./configuration.md#responses-state-and-compaction), while native compaction remains provider-capability-specific. OAuth providers are not valid automatic fallbacks. See [`troubleshooting.md`](./troubleshooting.md#provider-and-model-problems) for proxy, headless-login, model-name, and config-key errors.
## Provider Resolution
@@ -699,13 +641,6 @@ Pin `provider` in presets when using gateway catalog IDs such as `anthropic/clau
Model presets are the recommended model configuration surface. Use them when you want named model choices, runtime `/model` switching, or reusable fallback targets.
When available, the selected provider's model catalog supplies reasoning-effort suggestions; you can still enter a custom value. Choosing a catalog model for a new preset can initialize its context window. Existing presets and manually entered context values are preserved, and catalog output limits do not raise the preset's output budget. See [preset fields](./configuration.md#model-presets) for configuration details.
Direct OpenAI Responses, OpenAI Codex, Azure OpenAI Responses, and eligible GitHub Copilot models can retain server-provided conversation state; [native context compaction](./configuration.md#responses-state-and-compaction) depends on provider support. The WebUI offers switches for OpenAI web search, Codex Fast mode, and Grok X Search.
<details>
<summary>Manual configuration</summary>
```json
{
"modelPresets": {
@@ -732,17 +667,12 @@ Direct OpenAI Responses, OpenAI Codex, Azure OpenAI Responses, and eligible GitH
}
```
</details>
The preset name `default` is reserved for the implicit `agents.defaults` settings. Do not define `modelPresets.default`; use `/model default` to return to the direct `agents.defaults.*` fields in older configs.
## Fallback Models
Fallbacks are useful for transient provider failures, rate limits, or model availability issues. Keep fallbacks compatible with the task size and tool use. Prefer fallback presets so each candidate has a name and a complete provider, model, generation, and context-window configuration.
<details>
<summary>Manual configuration</summary>
```json
{
"modelPresets": {
@@ -777,15 +707,10 @@ Fallbacks are useful for transient provider failures, rate limits, or model avai
}
```
</details>
String entries in `fallbackModels` are preset names, not raw model names. nanobot tries them in order after the active preset. Each fallback preset uses its own `provider`, `model`, `maxTokens`, `contextWindowTokens`, `temperature`, and optional `reasoningEffort`.
Use inline fallback objects only when a model is not worth naming as a preset:
<details>
<summary>Manual configuration</summary>
```json
{
"modelPresets": {
@@ -812,8 +737,6 @@ Use inline fallback objects only when a model is not worth naming as a preset:
}
```
</details>
`fallbackModels` belongs under `agents.defaults`, not inside each preset. If fallback candidates use smaller context windows, nanobot builds context using the smallest window in the active chain so every candidate can receive the same prompt. See [`configuration.md#model-fallbacks`](./configuration.md#model-fallbacks) for failure conditions.
## Quick Checks
+145 -74
View File
@@ -1,13 +1,16 @@
# Nanobot Python SDK: Run an AI Agent from Python
Use nanobot as a Python library. The SDK gives you the same agent runtime used by the CLI, but from code: model routing, tools, workspace access, conversation history, memory, streaming events, and runtime helpers.
Use nanobot as a Python library. The SDK gives you the same agent runtime used
by the CLI, but from code: model routing, tools, workspace access, conversation
history, memory, streaming events, and runtime helpers.
If you have used the OpenAI SDK before, the most important difference is this:
- OpenAI SDK calls a model.
- nanobot SDK runs an agent around a model.
That means one SDK call can read files, call tools, keep session history, use memory, stream progress, and return structured runtime information.
That means one SDK call can read files, call tools, keep session history, use
memory, stream progress, and return structured runtime information.
```text
your Python code
@@ -22,15 +25,36 @@ your Python code
## Before You Start
Install and configure nanobot first. If you have not done that yet, follow the [Quick Start](quick-start.md) and complete the setup wizard. For SDK-only Python environments, install the package with:
Install and configure nanobot first. If you have not done that yet, follow the
[Quick Start](quick-start.md) and complete the setup wizard. For SDK-only Python
environments, install the package with:
```bash
python -m pip install nanobot-ai
```
`Nanobot.from_config()` reuses your normal `~/.nanobot/config.json` and `~/.nanobot/workspace/`. Provider, model, tools, memory, and session behavior match the CLI unless you override them. For the difference between config and workspace, see [Concepts: Config vs Workspace](concepts.md#config-vs-workspace).
`Nanobot.from_config()` reuses your normal `~/.nanobot/config.json` and
`~/.nanobot/workspace/`. Provider, model, tools, memory, and session behavior
match the CLI unless you override them. For the difference between config and
workspace, see [Concepts: Config vs Workspace](concepts.md#config-vs-workspace).
If you have already received a normal reply in the WebUI, use that saved configuration directly. For a separate Python environment, `nanobot status` shows which config, workspace, and model the SDK will load.
Before writing SDK code, run the same first-run checks from the main
[Install and Quick Start](quick-start.md):
```bash
nanobot status
```
`nanobot status` should show the config path, workspace path, active model or
preset, and provider summary. Then send one real message:
```bash
nanobot agent -m "Hello!"
```
A normal assistant reply means install, config, provider/model selection, and
workspace access are all usable. Once that works, the SDK should see the same
runtime.
## 5-Minute Quick Start
@@ -51,20 +75,14 @@ async def main() -> None:
asyncio.run(main())
```
Use `async with` when possible so tool connections and background cleanup are closed before the event loop exits. If you manage the instance manually, call `await bot.aclose()` in a `finally` block.
Use `async with` when possible so tool connections and background cleanup are
closed before the event loop exits. If you manage the instance manually, call
`await bot.aclose()` in a `finally` block.
The SDK is async-first because agent runs may stream tokens, execute tools, and wait on external services. In a normal Python script, wrap your async function with `asyncio.run(...)` as shown above. In a notebook or another async app, call `await bot.run(...)` directly from your existing event loop.
The default agent workspace comes from config, not the notebook's current directory. For a notebook that should use its current folder as both file workspace and agent state, choose it explicitly:
```python
from pathlib import Path
async with Nanobot.from_config(workspace=Path.cwd()) as bot:
result = await bot.run("List the files in this workspace.")
```
This also places memory and skills in that workspace. Use a separate configured instance when notebook experiments must not share existing agent state.
The SDK is async-first because agent runs may stream tokens, execute tools, and
wait on external services. In a normal Python script, wrap your async function
with `asyncio.run(...)` as shown above. In a notebook or another async app, call
`await bot.run(...)` directly from your existing event loop.
### Inspect What Happened
@@ -81,7 +99,8 @@ print(result.stop_reason) # why the run stopped
### Continue A Conversation
Use a `session_key` when you want history to carry across turns. Different session keys keep separate conversation histories:
Use a `session_key` when you want history to carry across turns. Different
session keys are isolated from each other:
```python
await bot.run("My name is Alice.", session_key="user:alice")
@@ -90,7 +109,8 @@ result = await bot.run("What is my name?", session_key="user:alice")
print(result.content)
```
This gives each task or workflow its own conversation thread. Keys do not isolate workspace files, tools, credentials, or long-term memory: sessions in one agent workspace share `USER.md`, `SOUL.md`, and `memory/MEMORY.md`. For separate users or tenants, use separate configured instances and appropriate process/file permissions; see [Multiple Instances](multiple-instances.md).
This is the SDK equivalent of giving each user, task, eval case, or workflow
its own conversation thread.
### Stream A Long Answer
@@ -104,11 +124,12 @@ async for event in bot.stream("Write a migration plan"):
print(event.delta, end="", flush=True)
```
Streaming returns structured events, so you can also observe tool calls, reasoning chunks, completion, and failures.
Streaming returns structured events, so you can also observe tool calls,
reasoning chunks, completion, and failures.
## Complete Starter Script
Save this as `sdk_demo.py` after your configured model has returned a normal reply:
Save this as `sdk_demo.py` after `nanobot agent -m "Hello!"` works:
```python
import asyncio
@@ -160,7 +181,9 @@ Run it:
python sdk_demo.py "List the top-level files in the current workspace."
```
You should see the configured model, workspace path, streamed assistant text, and final run metadata. The exact answer depends on your config and workspace, but a file-listing prompt may look like this:
You should see the configured model, workspace path, streamed assistant text,
and final run metadata. The exact answer depends on your config and workspace,
but a file-listing prompt may look like this:
```text
model: openai/gpt-4.1-mini
@@ -174,7 +197,9 @@ tools_used: ['list_dir']
usage: {'prompt_tokens': ..., 'completion_tokens': ..., 'total_tokens': ...}
```
This script shows the usual production shape: create one `Nanobot`, choose a stable `session_key`, stream events, keep the final `RunResult`, and let `async with` close runtime resources.
This script shows the usual production shape: create one `Nanobot`, choose a
stable `session_key`, stream events, keep the final `RunResult`, and let
`async with` close runtime resources.
## Core Concepts
@@ -197,6 +222,22 @@ For most users, the mental model is:
4. Read `RunResult` or stream events.
5. Use session/memory/runtime helpers only when you need more control.
## SDK Or OpenAI-Compatible API?
nanobot has two programming surfaces:
| Use | Choose | Why |
|-----|--------|-----|
| Python code running in the same process as nanobot | Python SDK | Direct access to `RunResult`, sessions, memory, runtime helpers, hooks, and stream events. |
| Existing OpenAI-compatible clients, another language, or a separate process | [OpenAI-Compatible API](openai-api.md) | HTTP `/v1/chat/completions` compatibility with familiar client libraries. |
The Python SDK is best when you are writing evals, notebooks, benchmark
runners, product backends, local scripts, or integrations that should control
nanobot directly.
The OpenAI-compatible API is best when you already have an HTTP client, want
process isolation, or need to call nanobot from a non-Python service.
## Common Patterns
### Use a specific config or workspace
@@ -210,7 +251,8 @@ async with Nanobot.from_config(workspace="/my/project") as bot:
result = await bot.run("Explain the project structure")
```
Use a custom config when you run multiple nanobot instances or test an isolated setup:
Use a custom config when you run multiple nanobot instances or test an isolated
setup:
```python
async with Nanobot.from_config(
@@ -220,7 +262,9 @@ async with Nanobot.from_config(
result = await bot.run("Hello from bot A")
```
The config controls what nanobot may use. The workspace is where nanobot keeps state for that instance. See [multiple-instances.md](multiple-instances.md) for multi-instance CLI and gateway examples.
The config controls what nanobot may use. The workspace is where nanobot keeps
state for that instance. See [multiple-instances.md](multiple-instances.md) for
multi-instance CLI and gateway examples.
### Choose a default or per-run model
@@ -246,7 +290,12 @@ result = await bot.run("Think deeply about this bug", model_preset="reasoning")
`model` and `model_preset` are mutually exclusive.
For first setup, create named presets in **Settings → Models**; the SDK reads those saved presets from `config.json`. Mixing an API key from one provider with a model ID from another is the most common first-run failure. For the exact difference between `provider`, `model`, `apiKey`, and `apiBase`, see [Providers: Provider, Model, API Key, and Base URL](providers.md#provider-model-api-key-and-base-url). If a run fails before the SDK does anything interesting, confirm the same provider and model work with `nanobot agent -m "Hello!"` first.
For first setup, prefer named presets in `config.json`. Mixing an API key from
one provider with a model ID from another is the most common first-run failure.
For the exact difference between `provider`, `model`, `apiKey`, and `apiBase`,
see [Providers: Provider, Model, API Key, and Base URL](providers.md#provider-model-api-key-and-base-url).
If a run fails before the SDK does anything interesting, confirm the same
provider and model work with `nanobot agent -m "Hello!"` first.
### Isolate conversations with `session_key`
@@ -264,11 +313,15 @@ session_key = f"user:{user_id}"
result = await bot.run(user_message, session_key=session_key)
```
Avoid using the default `"sdk:default"` for multiple users or unrelated workflows. It is convenient for local experiments, but stable product code should choose explicit keys such as `user:<id>`, `project:<id>`, or `eval:<case-id>`.
Avoid using the default `"sdk:default"` for multiple users or unrelated
workflows. It is convenient for local experiments, but stable product code
should choose explicit keys such as `user:<id>`, `project:<id>`, or
`eval:<case-id>`.
### Handle failures
For a normal non-streamed run, catch exceptions around `bot.run(...)` and inspect `RunResult.error` when the runtime returns a structured failure:
For a normal non-streamed run, catch exceptions around `bot.run(...)` and inspect
`RunResult.error` when the runtime returns a structured failure:
```python
try:
@@ -294,11 +347,13 @@ finally:
await run.aclose()
```
Use `await run.cancel()` when the user presses a stop button or leaves the page before the stream finishes.
Use `await run.cancel()` when the user presses a stop button or leaves the page
before the stream finishes.
### Stream long-running output
Use `bot.stream()` when you want Cursor/OpenAI-style live events instead of waiting for the final `RunResult`:
Use `bot.stream()` when you want Cursor/OpenAI-style live events instead of
waiting for the final `RunResult`:
```python
from nanobot import (
@@ -330,13 +385,18 @@ async for event in run.stream_events():
result = await run.wait()
```
Always either consume the stream, call `await run.wait()` / `await run.text()`, or close it with `await run.cancel()` / `await run.aclose()`. Exiting `stream_events()` or `bot.stream()` early cancels the underlying run so a half-consumed stream cannot leave a background task stuck behind backpressure.
Always either consume the stream, call `await run.wait()` / `await run.text()`,
or close it with `await run.cancel()` / `await run.aclose()`. Exiting
`stream_events()` or `bot.stream()` early cancels the underlying run so a
half-consumed stream cannot leave a background task stuck behind backpressure.
### Import an existing transcript
This is useful for evals, benchmark runners, migrations, and tests.
Use `bot.sessions.ingest()` when you already have a transcript and want it to become nanobot session history. Ingesting a transcript does not call the model, execute tools, update memory, or compact automatically.
Use `bot.sessions.ingest()` when you already have a transcript and want it to
become nanobot session history. Ingesting a transcript does not call the model,
execute tools, update memory, or compact automatically.
```python
await bot.sessions.ingest(
@@ -367,26 +427,10 @@ result = await bot.run(
print(result.content)
```
### Persist memory in a short-lived script
Saved session history and curated long-term memory are different. The SDK does not start the gateway scheduler, so creating or closing `Nanobot` does not schedule Dream. Compaction archives a conversation into `memory/history.jsonl`; it does not itself update `USER.md` or `memory/MEMORY.md`.
Before closing a script that should contribute material to Dream:
```python
async with Nanobot.from_config() as bot:
await bot.run("For release notes, use concise bullet points.", session_key="sdk:notes")
await bot.runtime.compact_session("sdk:notes")
print(bot.memory.read_history(session_key="sdk:notes"))
```
Then use `/dream` in a running WebUI or TUI connected to the same configured agent workspace, wait for completion, and inspect `/dream-log`. Scheduled Dream also processes this archive while the matching gateway runs and Dream is enabled. `await bot.run("/dream")` only returns the command acknowledgement; it is not an awaited Dream-completion API for short-lived scripts.
For application-owned durable text, `bot.memory.write(text)` writes `memory/MEMORY.md` directly and `bot.memory.read()` reads it back. Writing replaces the whole file; it does not merge preferences or create a Dream audit entry. See [Memory](memory.md) for review and correction workflows.
### Attach hooks for observability
Hooks are an advanced escape hatch. Use them when you want custom logging, metrics, tracing, or output post-processing without modifying nanobot internals:
Hooks are an advanced escape hatch. Use them when you want custom logging,
metrics, tracing, or output post-processing without modifying nanobot internals:
```python
from nanobot.agent import AgentHook, AgentHookContext
@@ -403,7 +447,8 @@ result = await bot.run("Review this change", hooks=[AuditHook()])
## Where To Go Next
The SDK page is the programming entry point. The fuller conceptual and configuration docs remain the source of truth for the runtime around it:
The SDK page is the programming entry point. The fuller conceptual and
configuration docs remain the source of truth for the runtime around it:
| Need | Read |
|------|------|
@@ -413,6 +458,7 @@ The SDK page is the programming entry point. The fuller conceptual and configura
| Pasteable provider recipes | [Provider Cookbook](provider-cookbook.md) |
| Complete configuration reference | [Configuration](configuration.md) |
| Long-term memory design | [Memory](memory.md) |
| HTTP API instead of Python SDK | [OpenAI-Compatible API](openai-api.md) |
| Debugging install, config, provider, or runtime failures | [Troubleshooting](troubleshooting.md) |
## API Reference
@@ -428,7 +474,8 @@ Create a `Nanobot` instance from a config file.
| `model` | `str \| None` | `None` | Override the instance default model. |
| `model_preset` | `str \| None` | `None` | Override the instance default model preset from `config.json`. |
Raises `FileNotFoundError` if an explicit config path does not exist. Raises `ValueError` if both `model` and `model_preset` are provided.
Raises `FileNotFoundError` if an explicit config path does not exist.
Raises `ValueError` if both `model` and `model_preset` are provided.
### `await bot.run(...)`
@@ -448,11 +495,15 @@ Run the agent once and return a `RunResult`.
| `model` | `str \| None` | `None` | Override the model for this run only. |
| `model_preset` | `str \| None` | `None` | Override the model preset for this run only. |
Without an override, a run uses the preset saved in its session, or the configured default when that session has no saved selection. `model` and `model_preset` are mutually exclusive per-run overrides; they do not change the saved session selection or `bot.runtime.model` after the run completes.
Without an override, a run uses the preset saved in its session, or the configured
default when that session has no saved selection. `model` and `model_preset` are
mutually exclusive per-run overrides; they do not change the saved session selection
or `bot.runtime.model` after the run completes.
### `await bot.run_streamed(...)`
Start a streamed agent turn and return a `RunStream`. It accepts the same parameters as `bot.run(...)`.
Start a streamed agent turn and return a `RunStream`. It accepts the same
parameters as `bot.run(...)`.
```python
run = await bot.run_streamed("Generate a long answer")
@@ -465,7 +516,8 @@ result = await run.wait()
### `bot.stream(...)`
Convenience wrapper around `run_streamed()` for direct event iteration. It accepts the same parameters as `bot.run(...)`.
Convenience wrapper around `run_streamed()` for direct event iteration. It
accepts the same parameters as `bot.run(...)`.
```python
async for event in bot.stream("Generate a long answer"):
@@ -482,7 +534,9 @@ async for event in bot.stream("Generate a long answer"):
| `await cancel()` | Cancel the run and release stream resources. |
| `await aclose()` | Close the stream; equivalent cleanup primitive for `async with` / manual lifecycle code. |
SDK runs with different session keys may overlap, including runs with per-run `model` or `model_preset` overrides. Each run receives an immutable runtime without mutating the instance default. Runs sharing one session key remain serialized.
SDK runs with different session keys may overlap, including runs with per-run
`model` or `model_preset` overrides. Each run receives an immutable runtime without
mutating the instance default. Runs sharing one session key remain serialized.
### `StreamEvent`
@@ -545,19 +599,23 @@ async with Nanobot.from_config() as bot:
| Method | Description |
|--------|-------------|
| `await ingest(session_key, messages, metadata=None, source=None)` | Import existing transcript messages without running the model. |
| `await get(session_key)` | Return a `SessionSnapshot`, or `None` if missing. |
| `await list()` | Return compact `SessionInfo` rows. |
| `await export(session_key)` | Return a trusted full `SessionSnapshot`, including model-only runtime context, suitable for JSON serialization. |
| `await restore(snapshot, session_key=None)` | Restore a trusted exported snapshot into an empty session; the returned snapshot is display-safe. |
| `await clear(session_key)` | Clear and persist one session. |
| `await delete(session_key)` | Delete one session from disk and cache. |
| `await ingest(session_key, messages, metadata=None, source=None, save=True)` | Import existing transcript messages without running the model. |
| `get(session_key)` | Return a `SessionSnapshot`, or `None` if missing. |
| `list()` | Return compact `SessionInfo` rows. |
| `export(session_key)` | Return a trusted full `SessionSnapshot`, including model-only runtime context, suitable for JSON serialization. |
| `await restore(snapshot, session_key=None, save=True)` | Restore a trusted exported snapshot into an empty session; the returned snapshot is display-safe. |
| `clear(session_key)` | Clear and persist one session. |
| `delete(session_key)` | Delete one session from disk and cache. |
| `flush()` | Flush cached sessions to durable storage. |
Session writes commit before returning. Returned snapshots are detached; changing a snapshot does not save it. See [Session storage](cli-reference.md#session-storage) for upgrade and backup instructions.
Ingested messages must include `role` and `content`. Roles may be `user`,
`assistant`, `tool`, or `system`. Other fields, such as `timestamp`,
`source_session_id`, or `source_date`, are persisted as message metadata.
Ingested messages must include `role` and `content`. Roles may be `user`, `assistant`, `tool`, or `system`. Other fields, such as `timestamp`, `source_session_id`, or `source_date`, are persisted as message metadata.
`get()` and snapshots returned by ordinary SDK operations are display-safe and omit model-only runtime context. `export()` is an explicit backup boundary and includes that internal context so `restore()` can preserve the exact model-visible history. Do not expose exported snapshots directly to chat users.
`get()` and snapshots returned by ordinary SDK operations are display-safe and omit
model-only runtime context. `export()` is an explicit backup boundary and includes
that internal context so `restore()` can preserve the exact model-visible history.
Do not expose exported snapshots directly to chat users.
### `bot.memory`
@@ -579,13 +637,23 @@ Ingested messages must include `role` and `content`. Roles may be `user`, `assis
| `await compact_session(session_key)` | Run token-based consolidation for a session. |
| `await compact_idle_session(session_key, max_suffix=8)` | Run idle-session compaction and return its summary. |
Both compaction methods serialize with turns for the same session key. Call them after `bot.run()` returns, or from a separate task that can wait for the active turn to finish.
### Host integration context and persisted-turn callbacks
Host applications can attach external context without copying or modifying the nanobot agent loop. A context provider receives a `RequestContext` before each model turn and may return one or more `RuntimeContextBlock` values. Use `attributes` for caller-owned routing data; nanobot keeps it separate from trusted channel metadata and does not persist it in session messages.
Host applications can attach external context without copying or modifying the
nanobot agent loop. A context provider receives a `RequestContext` before each
model turn and may return one or more `RuntimeContextBlock` values. Use
`attributes` for caller-owned routing data; nanobot keeps it separate from
trusted channel metadata and does not persist it in session messages.
`on_session_turn_persisted()` invokes its callback after a non-ephemeral turn has been saved. The callback receives `SessionTurnPersisted` and may read the completed transcript through `bot.sessions`. Callbacks run in registration order, and async callbacks are awaited before the run continues. They are observational: callback exceptions are logged and suppressed so the completed local turn remains successful. Durable external synchronization must catch failures and persist retry work before the callback returns. During SDK runs, callbacks execute while the session is still serialized. Schedule `bot.run()`, `bot.runtime.compact_session()`, or `bot.runtime.compact_idle_session()` for the same session after the callback returns.
`on_session_turn_persisted()` invokes its callback after a non-ephemeral turn
has been saved. The callback receives `SessionTurnPersisted` and may read the
completed transcript through `bot.sessions`. Callbacks run in registration
order, and async callbacks are awaited before the run continues. They are
observational: callback exceptions are logged and suppressed so the completed
local turn remains successful. Durable external synchronization must catch
failures and persist retry work before the callback returns. During SDK runs,
callbacks execute while the session is still serialized and must not re-enter
`bot.run()` for the same session.
```python
import json
@@ -626,7 +694,7 @@ async def run_with_external_memory(external_memory, enqueue_retry) -> None:
return external_context_block(text)
async def sync_saved_turn(event: SessionTurnPersisted):
snapshot = await bot.sessions.get(event.context.session_key)
snapshot = bot.sessions.get(event.context.session_key)
if snapshot is not None:
try:
await external_memory.sync(
@@ -649,7 +717,10 @@ async def run_with_external_memory(external_memory, enqueue_retry) -> None:
remove_context()
```
Context providers are trusted host extensions, and `RuntimeContextBlock.content` is appended verbatim to model-visible context. Apply equivalent bounding, encoding, and delimiter escaping to untrusted external content. Persisted-turn callbacks are not invoked for `ephemeral=True` runs.
Context providers are trusted host extensions, and `RuntimeContextBlock.content`
is appended verbatim to model-visible context. Apply equivalent bounding,
encoding, and delimiter escaping to untrusted external content.
Persisted-turn callbacks are not invoked for `ephemeral=True` runs.
## Hooks
+109 -97
View File
@@ -1,23 +1,22 @@
# Install and Quick Start
Get your first reply from nanobot in a few minutes. Skip chat apps, MCP servers, and deployment until this basic setup works.
This guide has one goal: get a normal nanobot reply in your browser. Do not add chat apps, MCP servers, fallback models, or deployment until this path works.
If terminals, Python, or API keys are new to you, start with the [beginner walkthrough](./start-without-technical-background.md) instead.
If terminals, Python, or API keys are unfamiliar, use the [beginner walkthrough](./start-without-technical-background.md), which explains each term and screen.
> [!NOTE]
> These docs follow the latest development branch, while the installer below installs the latest stable release. If a screen looks different, check `nanobot --version` and see the [matching release guide](https://nanobot.wiki/docs/latest/getting-started/quick-start).
These repository docs follow current `main`. The recommended installer uses the stable package, so a newly documented WebUI screen may not appear until the next release. Each advanced guide also provides a CLI or manual config path.
## What You Need
- Python 3.11 or newer.
- Access to a supported AI provider, company endpoint, or local model server (such as Ollama).
- The API key (or sign-in) and model ID for that service.
- Access to one supported AI provider, company endpoint, or local model server.
- The credential, endpoint URL, and model ID required by that service. Local providers such as Ollama may not require a key.
Packaged releases include the WebUI and native terminal UI (TUI) for macOS, Linux, and Windows—no Node.js or frontend build tools are needed.
Git and [Bun](https://bun.sh/) are only needed for a source install. The published package already contains the WebUI and fetches a checksummed, version-matched TUI archive with its licenses, notices, corresponding application source, source offer, and relinking instructions on first use.
## 1. Install nanobot
The official installer sets up nanobot in its own isolated environment and automatically opens the WebUI on a local desktop.
The recommended installer keeps nanobot out of the system Python environment. On a fresh local desktop, it starts the WebUI when installation finishes.
**macOS / Linux**
@@ -31,116 +30,112 @@ curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.
irm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1 | iex
```
You can inspect [`install.sh`](../scripts/install.sh) or [`install.ps1`](../scripts/install.ps1) before running them. If `nanobot` is not on your `PATH` afterward, use the full command printed at the end of the installer output.
The installer chooses an active virtual environment, `uv`, `pipx`, or a managed environment under `~/.nanobot/venv`. It installs the stable PyPI release. At the end it prints the exact command it used to run nanobot; if `nanobot` is not on `PATH`, reuse that full command in the examples below.
If you prefer to inspect the scripts first, open [`install.sh`](../scripts/install.sh) or [`install.ps1`](../scripts/install.ps1).
## 2. Configure Your Model
When the WebUI opens in your browser, go to **Settings → Models**:
Keep the installer terminal open. The browser opens the local WebUI; go to **Settings → Models** and:
1. Click **New preset** and give it a name (if **Convert to presets** appears, click it first).
2. Open **Provider** and select your provider—or click **Add provider** to enter its API key / sign in.
3. Select a model from the list or enter a model ID available to your account.
4. Click **Save**.
1. Choose the provider or endpoint that owns your credential.
2. Enter its API key or base URL when required.
3. Create or select a model preset using a model ID that provider can run.
4. Save the configuration.
If the browser did not open automatically, run:
The WebUI launcher creates or updates:
| Path | Purpose |
|---|---|
| `~/.nanobot/config.json` | Provider, model, WebUI, channel, tool, and runtime settings |
| `~/.nanobot/workspace/` | Memory, skills, automations, and generated files |
| `~/.nanobot/sessions/<workspace-id>/` | Recent session history stored outside the workspace; the ID remains stable across workspace moves |
If the installer did not open the browser, run:
```bash
nanobot webui
```
On a headless server or over SSH, use the terminal wizard instead:
SSH, headless, existing-config, and older-release installs retain the terminal setup path:
```bash
nanobot onboard --wizard
```
By default, nanobot stores its files under `~/.nanobot/`:
| Path | Purpose |
|---|---|
| `~/.nanobot/config.json` | Providers, models, channels, tools, and runtime settings |
| `~/.nanobot/workspace/` | Memory, skills, automations, and generated files |
| `~/.nanobot/sessions/` | Saved conversation history |
## 3. Check the Setup
Verify your local configuration without making a model request:
```bash
nanobot status
```
Confirm that **Config** and **Workspace** show a check mark, your chosen model/preset is listed, and its provider is configured. Unused providers showing `not set` is normal.
You want:
- a check mark for **Config** and **Workspace**;
- the model or preset you selected;
- a configured state for the provider used by that model.
Most other providers can say `not set`. This command validates local setup but does not call the model.
## 4. Get the First Reply
In the WebUI (running locally on `http://127.0.0.1:8765`, reachable only from your machine), send:
If the installer-started WebUI is no longer running, run `nanobot webui` again. Leave that launcher open; the first-run WebUI is bound to localhost, so other devices on your network cannot reach it.
Send:
```text
Hello!
```
Any normal reply confirms that your config, provider, workspace, and WebUI are all working.
Any normal assistant answer is success. It proves that nanobot can load the config, reach the selected model, use the workspace, and serve the browser UI.
### Managing the background gateway
With the official installer, nanobot runs a background gateway so closing the browser or terminal does not stop it. You can manage it anytime:
Interactive WebUI and TUI launchers share one on-demand gateway. Closing one launcher leaves it running for the others; closing the last launcher stops it. If you prefer a persistent background process, press `Ctrl+C`, then run:
```bash
nanobot gateway --background
nanobot gateway status
nanobot gateway logs
nanobot gateway restart
nanobot gateway stop
```
If you installed nanobot another way (such as `uv` or `pip`), `nanobot webui` stops when you close the terminal unless you start it with `nanobot webui --detach` or `nanobot gateway --background`.
Use `nanobot gateway logs`, `restart`, and `stop` to manage that background gateway.
## Terminal-Only Check
To test without a browser, send a single message from the terminal:
If you do not want the browser or need to isolate a WebUI problem, send one message directly:
```bash
nanobot agent -m "Hello!"
nanobot -m "Hello!"
```
Or open an interactive terminal chat:
Then start an interactive terminal chat with:
```bash
nanobot
```
In interactive mode, `Enter` sends and `Shift+Enter` (or `Ctrl+J`) inserts a newline. While nanobot is replying, `Enter` sends immediately, `Tab` queues your message for after the reply, and `Option+Up` (macOS) / `Alt+Up` (Windows/Linux) edits your queued message. Exit with `exit`, `/exit`, `:q`, or `Ctrl+D`.
In interactive mode, `Enter` sends and `Shift+Enter` inserts a newline (`Ctrl+J` is the
universal fallback). While nanobot is working, `Enter` sends immediately, `Tab` waits until the
current response is finished, and `Option+Up` on macOS (`Alt+Up` on Windows/Linux) edits the
latest waiting message. Exit
with `exit`, `/exit`, `:q`, or `Ctrl+D`.
## Continue with nanobot
## Choose One Next Step
Once you have your first reply, you can ask nanobot directly in chat to guide your next setup step. When the built-in `nanobot-document` skill is enabled (under **Skills → Installed**), nanobot reads the documentation bundled with your installation. For example:
- *"I am already using the WebUI. Help me connect Telegram and allow only my account."*
- *"Explain what is shared when I start a new topic or choose a different project."*
- *"My second model preset returns an authentication error. Help me find which setting to check."*
To invoke the documentation skill explicitly:
```text
$nanobot-document Explain how sessions, workspaces, and memory relate in this installation.
```
Or read the guides yourself—add one capability and test it before moving on:
After the first reply works, add one capability and test again:
| Goal | Recommended path |
|---|---|
| Learn topics, workspaces, tools, and access modes | [WebUI guide](./webui.md) |
| Connect a chat app | Open **Channels**, then check [Chat Apps](./chat-apps.md) for platform steps |
| Change or add a model | Open **Settings → Models** or browse the [Provider Cookbook](./provider-cookbook.md) |
| Add web search, voice, or image generation | Open **Settings → Capabilities** (see [Configuration](./configuration.md) for advanced options) |
| Add a plugin, CLI App, or MCP server | Open **Apps** or follow [Configure MCP Tools](./guides/configure-mcp-tools.md) |
| Schedule tasks or triggers | Read [Automations](./automations.md) |
| Learn sessions, workspaces, tools, and access modes | [WebUI guide](./webui.md) |
| Connect a chat platform | Open **Settings → Channels**, then use [Chat Apps](./chat-apps.md) for platform prerequisites |
| Change or add a model | Open **Settings → Models**; use the [Provider Cookbook](./provider-cookbook.md) for a recipe |
| Add web search, voice, or image generation | Use the matching WebUI Settings page, then consult [Configuration](./configuration.md) for advanced fields |
| Add an App or MCP integration | Open **Apps** or follow [Configure MCP Tools](./guides/configure-mcp-tools.md) |
| Schedule agent work | Read [Automations](./automations.md) |
| Run continuously or remotely | Read [Deployment](./deployment.md) |
| Integrate from Python | Use the [Python SDK](./python-sdk.md) |
| Integrate from code | Use the [Python SDK](./python-sdk.md) or [OpenAI-Compatible API](./openai-api.md) |
## Other Install Methods
Pick one method below, then continue at [Configure Your Model](#2-configure-your-model).
Use one method, then continue at [Configure Your Model](#2-configure-your-model).
**uv**
@@ -149,52 +144,55 @@ uv tool install nanobot-ai
nanobot webui
```
**pip (inside a virtual environment)**
**pip in a virtual environment**
```bash
python -m pip install nanobot-ai
nanobot webui
```
If pip reports `externally-managed-environment`, use the official installer, `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or a virtual environment instead of forcing a system-wide install.
If pip reports `externally-managed-environment`, use the recommended installer, `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or create a virtual environment. Do not force a system-wide install.
**From source (latest `main`)**
**Current source**
Requires Git. nanobot downloads the matching Bun runtime automatically for the TUI; Node.js is not required.
Clone the repository and install it in editable mode. Bun is required so the checkout can run
its matching native TUI instead of mixing current Python with an older release binary.
```bash
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
python3 -m venv .venv
python -m venv .venv
```
On Windows, use `py -3 -m venv .venv`. Activate the environment (`source .venv/bin/activate` on macOS/Linux or `.venv\Scripts\Activate.ps1` in PowerShell), then run:
Activate it with `source .venv/bin/activate` on macOS/Linux or
`.venv\Scripts\Activate.ps1` in Windows PowerShell, then run:
```bash
python -m pip install -e .
nanobot webui
```
For contributor details, see [`CONTRIBUTING.md`](../CONTRIBUTING.md).
The source path follows current `main` and can be newer than the published package. The editable
install keeps Python pointed at the checkout; `nanobot` runs `tui/` with Bun, and
`nanobot webui` automatically rebuilds `webui/` when its bundled assets are stale. All normal
commands remain the same as a stable install. For development details, follow
[`../CONTRIBUTING.md`](../CONTRIBUTING.md).
<details>
<summary>If the <code>nanobot</code> command is not found</summary>
If the package is installed but the shell cannot find `nanobot`, use the runner that owns the installation. The recommended installer prints the exact command to reuse. Common forms are:
Reuse the full command printed by the official installer, or call Python directly from its dedicated environment:
```bash
uv tool run --from nanobot-ai nanobot --version
pipx run --spec nanobot-ai nanobot --version
~/.nanobot/venv/bin/python -m nanobot --version
```
- **macOS / Linux:** `~/.nanobot/venv/bin/python -I -m nanobot --version`
- **Windows PowerShell:** `& "$HOME\.nanobot\venv\Scripts\python.exe" -I -m nanobot --version`
Replace `--version` with `webui`, `status`, or any other subcommand. For `uv` or `pipx` installs, use the same package manager's environment.
</details>
On Windows, the managed-environment form is `& "$HOME\.nanobot\venv\Scripts\python.exe" -m nanobot --version`. Replace `--version` with `webui`, `onboard --wizard`, or any other arguments you need. Use plain `python -m nanobot` only when that Python executable belongs to the environment where nanobot was installed.
## Manual Configuration Fallback
<details>
<summary>Manual configuration</summary>
Use this only when the wizard is unavailable or you intentionally manage JSON. First run `nanobot onboard`, then merge a provider and a named model preset into `~/.nanobot/config.json`.
Use this only when the WebUI and terminal wizard are unavailable or you manage `config.json` directly. Run `nanobot onboard` first, then merge a provider and named model preset into `~/.nanobot/config.json`:
A generic OpenAI-compatible setup has this shape:
```json
{
@@ -218,24 +216,38 @@ Use this only when the WebUI and terminal wizard are unavailable or you manage `
}
```
Keep the provider, endpoint URL, and model ID matched to the same service. See [Provider Cookbook](./provider-cookbook.md) for provider-specific examples and [Configuration](./configuration.md) for all fields.
</details>
Replace the provider, endpoint, and model together. Do not pair a credential from one service with a model ID from another. See [Provider Cookbook](./provider-cookbook.md) for hosted, OAuth, company, and local examples, and [Configuration](./configuration.md) for exact fields.
## Updating
Open **Settings → About → Update** in the WebUI. Supported installations update and restart in place; others display instructions for their package manager. See [Updating nanobot](./updating.md) for preview releases, backups, and recovery.
For standard Python virtual environments, you can also update from the CLI:
Upgrade with the same method you used to install:
```bash
nanobot update --check
nanobot update
# Recommended installer
curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | sh
# Or one of these
uv tool upgrade nanobot-ai
pipx upgrade nanobot-ai
python -m pip install -U nanobot-ai
```
For a source checkout:
```bash
git pull --ff-only
python -m pip install -e .
```
Because the install is editable, normal source changes are visible immediately. Re-running the
install synchronizes any changed Python dependencies; the TUI and WebUI refresh their own
dependencies/assets when launched. Then check `nanobot --version`. Run
`nanobot onboard --refresh` when you want to add newly introduced default fields while preserving
existing settings.
## If the First Reply Fails
Change one thing at a time. Start with:
Do not change several settings at once. Start with:
```bash
nanobot --version
@@ -245,11 +257,11 @@ nanobot agent -m "Hello!"
| Symptom | First check |
|---|---|
| `nanobot: command not found` | Reuse the full command printed by the installer (see [Other Install Methods](#other-install-methods)) |
| JSON parse error | Check commas and braces; remember that doc examples are snippets to merge |
| `401` or invalid API key | Confirm the key belongs to the selected provider and has no extra spaces |
| Model not found | Use a model ID available to your account on the selected provider |
| CLI works, but WebUI does not open | Open port `8765`, not the gateway health port `18790` |
| WebUI works, but a chat app does not | Check **Channels** in WebUI, then run `nanobot channels status` |
| `nanobot: command not found` | Reuse the installer command or method-specific runner described under [Other Install Methods](#other-install-methods) |
| JSON parse error | Check commas and braces; remember that docs examples are usually snippets |
| `401` or invalid API key | Verify the selected provider owns that key and remove accidental spaces |
| Model not found | Use a model ID available from the provider selected in the active preset |
| CLI works but WebUI does not open | Use port `8765`, not gateway health port `18790` |
| WebUI works but a chat app does not | Check **Settings → Channels**, then run `nanobot channels status` |
Continue with [Troubleshooting](./troubleshooting.md) if the cause is still unclear.
Continue with the ordered [Troubleshooting guide](./troubleshooting.md) if the cause is still unclear.
+1 -97
View File
@@ -6,100 +6,6 @@ For tagged releases, see [GitHub Releases](https://github.com/HKUDS/nanobot/rele
## Highlights
- **2026-10-28** 🚀 Released [v0.4.0](https://github.com/HKUDS/nanobot/releases/tag/v0.4.0), with remote WebUI connections, SQLite conversation storage, richer attachments and diagrams, and expanded channel support.
- **2026-10-27** 🗂️ Batch topic archiving and clearer WebUI mentions; reply text streamed before model failures is retained for later context.
- **2026-10-26** 🧰 WebUI `!` shell-command completion and literal output; delegated tasks and their details stay within reach.
- **2026-10-25** ⏰ Agent tools can edit, enable or disable scheduled tasks and inspect recent runs; Ctrl+K searches loaded message text and session handles.
- **2026-10-24** ⚡ Smaller target-specific terminal builds, Kimi K3.1 Pro parameter support, and corrected API session routing.
- **2026-10-23** 🧭 Compact WebUI workspace toolbar, MiniMax-M3.1-Flash support, and corrected DeepSeek Responses reasoning replay.
- **2026-10-22** 📎 Local-file attachments and video playback in WebUI, shared proxy settings for remote MCP, and UI controls for idle-compaction timing.
- **2026-10-21** 🔄 WebUI history joins the shared SQLite store; About adds update review and installation-owner guidance, with in-app installation gated on verified release approval.
- **2026-10-20** 🖼️ Mermaid diagrams as terminal images, QQ QR-code setup, and WebUI reading-size preferences.
- **2026-10-19** 🔍 DeepSeek Search, WebUI Mermaid diagrams, and Docker Compose first-run onboarding without a preconfigured model.
- **2026-10-18** 📬 WhatsApp Agent Platform channel, complete prompt-history navigation, and Markdown file previews with a source toggle.
- **2026-10-17** 📬 Scheduled channel results gain bounded retry after confirmed pre-send failures; context compaction considers provider-reported token usage.
- **2026-10-16** 🗃️ SQLite-backed session state with legacy JSONL import, separate shell wait/inactivity/runtime limits, and more reliable WebUI reconnection and queued prompts.
- **2026-10-15** 🔐 Plugin skills load from approved content snapshots, and context compaction is serialized with turns in the same session.
- **2026-10-14** 🔌 Expanded MCP service presets, streamed bounded file-diff previews, and correct handling of supported Kimi K3 reasoning efforts.
- **2026-10-13** 📚 Bundled documentation helps nanobot answer usage and setup questions, and PPTX extraction retains empty table columns.
- **2026-10-12** ⚙️ Per-preset request overrides, plus reusable named custom connections and separate headers/body settings for image generation.
- **2026-10-11** 🧭 Model/provider setup is integrated into preset editing, and model requests receive current workspace-access context.
- **2026-10-10** ⚙️ Explicit request API choices for presets and custom providers, plus `--home` to select an instance directory.
- **2026-10-09** 💬 QQ quoted-message context, slash-prefixed paths kept in normal chat, and simpler interface wording across locales.
- **2026-10-08** 🗂️ WebUI host directory picker, binary HTTP attachment uploads, and Codex Responses WebSocket continuation.
- **2026-10-07** ⏰ Scheduled-task chat changes can be reviewed before saving, and run history links to the conversation used for each run.
- **2026-10-06** 🐛 Improved layouts for wide equations, plus source-commit links and prefilled bug-report diagnostics in About.
- **2026-10-05** 🤝 Session-owned subtask messaging and cancellation, plus XLSX reads beyond incorrect declared dimensions.
- **2026-10-04** 📱 Touch-keyboard Enter inserts a newline, send-button guidance can interject into active replies, and mobile composer menus stay within the viewport.
- **2026-10-03** 📝 File creation preserves supplied newlines, Telegram links retain their URLs, and shell hard timeouts are enforced without polling.
- **2026-10-02** 🌐 Connect the WebUI to existing remote nanobot instances, with host identity, pairing, connection management and recovery.
- **2026-09-30** 🔔 Global context-compaction notice settings with per-channel overrides, and configured provider fallbacks for insufficient-credit errors.
- **2026-09-29** 🖥️ Terminal-default colors keep unknown themes readable, and keyboard navigation reaches overflow choices in pickers.
- **2026-09-28** 🔎 File search uses ripgrep when installed, terminal history restores from canonical events, and WebUI Codex title generation is restored.
- **2026-09-27** 📜 Earlier WebUI history loading gains retry states, and Responses streams stop on terminal events.
- **2026-09-26** 🔌 Linear member access management and browser authorization improvements, plus complete paginated MCP tool discovery.
- **2026-09-25** 💬 WebUI restores text drafts in saved chats across navigation and reloads, and localizes agent activity.
- **2026-09-24** 🔔 Opt-in completion sounds, custom context-window budgets, and restored session-scoped file previews in WebUI.
- **2026-09-23** 🔗 Linear acknowledges sessions before downloading attachments; file searches stay scoped and resumable, and BOM-marked text is decoded correctly.
- **2026-09-22** 🔗 Clickable Markdown links in the terminal, contextual WebUI message controls, and wrapping Markdown table content.
- **2026-09-21** 💬 Temporary chats retain state during WebUI navigation, fallback replies are labeled, and Copilot device sign-in completes in the browser.
- **2026-09-20** 💬 WebUI replies identify the fallback preset used; stopped follow-ups stay canceled after restarts, and local context-tail truncation is removed.
- **2026-09-19** 🔌 Native Linear agent channel support, searchable provider setup, and consistent provider and channel identities across the WebUI.
- **2026-09-18** ♻️ Explicit recovery continuations, Discord reply-context support, and clearer channel setup before model configuration is complete.
- **2026-09-17** 📬 Per-session inbox serialization preserves message order and queued-turn completion; stale compaction continuations and canceled automations no longer leak into later work.
- **2026-09-16** 📦 Platform wheels bundle the version-matched native terminal UI, terminal input stays responsive during output, and release checks verify TUI compliance materials before tagging.
- **2026-09-15** 🚀 Released [v0.3.5](https://github.com/HKUDS/nanobot/releases/tag/v0.3.5), bringing a shared terminal workbench, multi-pane WebUI, visible context continuity, and stronger session, provider, and channel reliability.
- **2026-09-14** ⏰ Automation edits preserve pending runs, remote projects use host paths, and chat controls adapt to narrower layouts.
- **2026-09-13** 📱 Automation calendar and per-run reply workflows, simpler mobile composer and settings interactions, and consistent app identities in mentions.
- **2026-09-12** ⚡ Large history replay is bounded, cached, and deferred; Responses history drops provider-owned item identifiers before reuse.
- **2026-09-11** 🧭 Guided chat-channel setup, simpler automation management, and in-place context-compaction notices across Telegram and Discord.
- **2026-09-10** ⚙️ Expanded autosaving settings, automatic MCP OAuth token refresh, and a macOS Seatbelt sandbox backend with tighter boundaries.
- **2026-09-09** 📊 Terminal `/usage` context and token charts, bounded WebUI history rendering, and fresher skill suggestions.
- **2026-09-08** 💬 Rich Telegram streaming, AnySearch web search, attach-only Desktop terminal targets, and recursive glob filters for file searches.
- **2026-09-07** 🔌 WeCom media uploads use the SDK API; CI runs tests in parallel and skips unrelated jobs.
- **2026-09-06** 📊 Context-window usage in the terminal footer and consistent runtime notifications across clients.
- **2026-09-05** 🧠 Visible context-compaction progress in the WebUI, terminal, and chat channels.
- **2026-09-04** 📊 WebUI context usage and cache reuse shown by conversation round.
- **2026-09-03** 🔐 Matrix SAS verification fixes, fallback handling for raised provider errors, and recovery from stale WebUI stream state after reconnects.
- **2026-09-02** 🧙 First-run model setup in the WebUI, improved preset creation and activation, and cleanup of unsaved pane sessions.
- **2026-09-01** 📝 Terminal drafts typed after submission are preserved; Dream avoids duplicate profile context and gateway listener checks handle platform differences.
- **2026-08-31** 💬 Rich Telegram streaming previews, cumulative memory summaries, and simpler terminal headers.
- **2026-08-30** 📬 Email fetches headers before message bodies, DingTalk drains inbound work on shutdown, and reasoning streams close on cancellation.
- **2026-08-29** 🖥️ The `nanobot` command opens the native terminal agent; OAuth model catalogs are discovered online, with Grok 4.6 subscription support.
- **2026-08-28** 🖥️ The full terminal UI remains available inside Herdr panes.
- **2026-08-27** 📎 Clipboard image attachments in the native terminal, smoother paged history, and a model-picker shortcut to settings.
- **2026-08-26** 🔌 MCP readiness retries before turns, stable Codex prompt-cache routing, and detection of rapid same-size file rewrites.
- **2026-08-25** 🧰 Skill-reference completion in the terminal, document retrieval on demand, and waiting for shell sessions without repeated polling.
- **2026-08-24** 🔄 Visible session activity and recovery controls in the terminal, preserved shell state after Ctrl+C, and ordered WebUI follow-ups.
- **2026-08-23** 🖥️ Named nanobot processes, separate WebUI answer and reasoning sections, and refreshed maintainer and contributor credits.
- **2026-08-22** 💬 Unified WebUI turn activity, LaTeX rendered as Unicode in the terminal, and retirement of disabled Dream and heartbeat jobs.
- **2026-08-21** 🧠 DeepSeek V4 vision, terminal `/detach` to keep work running, and retries before switching to a fallback provider.
- **2026-08-20** 🖥️ New terminal chats use the launch workspace, exit prints a resume command, and standard SOCKS5 proxies are supported.
- **2026-08-19** 🔗 Session mentions let agents read and message other saved conversations, with fixes for transcript retention and invalid compaction summaries.
- **2026-08-18** ⚡ Faster terminal startup, refreshed expired gateway credentials, and recovery from stalled Telegram polling.
- **2026-08-17** 🖥️ Native terminal UI with a shared gateway, session navigation, slash commands, and queued follow-ups.
- **2026-08-16** 🔌 OrcaRouter gateway support, atomic model-preset renames, and ordered WebUI mutation replay after reconnects.
- **2026-08-15** ⏰ Cron persistence-failure recovery and replay guards, grouped-tab range selection, and clearer model-preset names.
- **2026-08-14** 🗂️ Dragging topics into and out of pane groups, a native workspace folder picker, and session-file concurrency fixes.
- **2026-08-13** 🔌 DeepSeek V4 Pro Responses support, Gemini tool-history compatibility across model switches, and persisted Weixin QR-login credentials.
- **2026-08-12** 🖥️ A WebUI workbench with grouped conversation panes and adjustable layouts.
- **2026-08-11** 📱 Mobile home-screen installation through PWA support, portable Agent Plugins, and visible MCP connection failures.
- **2026-08-10** 🔑 Browser OAuth for remote MCP servers, forced Weixin QR-login fixes, and improved WebUI recovery states.
- **2026-08-09** 🎙️ WebUI guidance for voice input's HTTPS requirement and expanded user-path test coverage.
- **2026-08-08** ⏳ Temporary chats in the WebUI, with explicit expiry guidance and cleanup of session-owned shell processes.
- **2026-08-07** 🎛️ Responsive model-preset details, clearer preset deletion controls, and Weixin login and streaming fixes.
- **2026-08-06** 📝 Drag sessions into composer mentions, save sidebar ordering, and load the WebUI with a smaller initial payload.
- **2026-08-05** ⚙️ Provider-native request switches, separate Mattermost thread/channel policies, and outbound WhatsApp media detection.
- **2026-08-04** 🔐 Trusted-proxy authentication, public WebSocket URL configuration, and linked session references.
- **2026-08-03** 🔌 Eden AI gateway support, faster saved-session loading, and fixes for IME input and local-trigger message display.
- **2026-08-01** 🔌 DeepSeek Responses API support, Weixin recovery after session expiry, and explicit provider namespace handling.
- **2026-07-31** 💬 Slack thread opener isolation, WebUI scroll-position preservation, and timezone data on all platforms.
- **2026-07-30** 🧩 Skills marketplace with SkillHub, remote Codex OAuth login, and preserved reasoning state for Responses providers.
- **2026-07-29** 📬 WebUI message-delivery status, media references in memory consolidation, and UTF-8 input handling on PowerShell 5.
- **2026-07-28** 🧰 Actionable startup diagnostics and WebUI recovery, SDK host integration hooks, and improved streaming scroll behavior.
- **2026-07-27** 🧠 Dream model preset overrides and history-integrity fixes; DingTalk sender mentions and an option to disable private chats.
- **2026-07-26** 🖥️ Fresh desktop installs open the WebUI; channel tool hints are enabled by default, with mobile overflow and file-diff display fixes.
- **2026-07-25** 🚀 Released [v0.3.0 — The Agency Release](https://github.com/HKUDS/nanobot/releases/tag/v0.3.0), with guided WebUI setup, inline subagents, per-session model presets, and live configuration reloads.
- **2026-07-24** 🧭 Guided first-run setup, inline subagents, and model switching from the composer.
- **2026-07-23** 🔎 Grok OAuth with hosted X Search, live image settings, and clearer fallback models.
- **2026-07-22** 🔌 Parallel Search, live configuration reloads, richer app discovery, and a smoother mobile WebUI.
@@ -129,7 +35,6 @@ For tagged releases, see [GitHub Releases](https://github.com/HKUDS/nanobot/rele
- **2026-06-27** 🔒 Collision-safe sessions, safer shells, Neonize WhatsApp.
- **2026-06-25** 🎛️ Thinking controls, MiMo voice input, opt-in Telegram rich messages.
- **2026-06-24** 🌙 Kimi Coding and OpenCode, steadier reasoning and Anthropic tool calls.
- **2026-06-23** 🚀 Added v0.2.2 release news and aligned release announcement dates.
- **2026-06-22** 🚀 Released **v0.2.2** — **The Durability Release** makes nanobot sturdier for daily agent work: segmented WebUI transcripts, first-class Python SDK runtime controls, automation management, richer search/STT providers, and stronger gateway/session/provider reliability. Please see [release notes](https://github.com/HKUDS/nanobot/releases/tag/v0.2.2) for details.
- **2026-06-21** 🧰 Python SDK runtime controls, optional Keenable key, cleaner run hooks.
- **2026-06-20** 💬 Telegram rich messages, safer SDK concurrency, smoother Quick Start.
@@ -140,19 +45,18 @@ For tagged releases, see [GitHub Releases](https://github.com/HKUDS/nanobot/rele
- **2026-06-15** 📱 Mobile WebUI polish, optional file tools, real API usage.
- **2026-06-14** 🖼️ Themed cover, partner links, stronger Codex image streaming.
- **2026-06-13** 🗓️ Session-bound automations, sturdier WhatsApp, faster WebUI startup.
- **2026-06-12** 💬 Slack allowlisted channels can require mentions.
- **2026-06-11** ✂️ Fenced-code message splitting.
- **2026-06-10** 📜 Segmented transcripts, Exa/Bocha search, StepFun/SiliconFlow ASR.
- **2026-06-09** 🎙️ Shared voice input, more STT providers, TeX and email polish.
- **2026-06-08** 🧮 Token heatmap fix, safer MCP HTTP probing, docs cleanup.
- **2026-06-07** 💬 WhatsApp recognizes group mentions that use LID identifiers.
- **2026-06-06** 🧰 SDK MCP cleanup, removable OpenAI image defaults.
- **2026-06-05** 🖼️ Azure AAD, custom image providers, `/skill`, steadier pairing.
- **2026-06-04** 🔌 MCP reconnects, `uv pip` install fallback, QQ pairing.
- **2026-06-03** 🧠 Hidden-history recovery, quieter email progress handling.
- **2026-06-02** 📬 Email attachments, Napcat QQ, Volcengine search, simpler Dream.
- **2026-06-01** 🚀 Released **v0.2.1** — **The Workbench Release** turns the packaged WebUI into a daily agent workbench: clearer Thought/response timelines, live file-edit activity, project workspaces, model and context controls, steadier sustained goals, CLI Apps + MCP extensions, and broader provider/channel support. Please see [release notes](https://github.com/HKUDS/nanobot/releases/tag/v0.2.1) for details.
- **2026-05-31** ⏰ Heartbeat skips empty or completed-only task lists; Matrix SAS verification and WebUI code-block language fallback fixes.
- **2026-05-30** 🔐 Safer Matrix verification, bounded media downloads, clearer WebUI model timeline.
- **2026-05-29** 🧩 Extension registry, context-window tuning, document extraction controls.
- **2026-05-28** 🗂️ Project workspaces, access controls, steadier goals and streaming.
-73
View File
@@ -1,73 +0,0 @@
# nanobot 0.4.0 — release notes draft
This release is being prepared; it has not been published. These notes cover changes already merged since v0.3.5. Final candidate checks, package acceptance and maintainer approval are still required. Do not use an unreleased version number as an installation instruction.
## Highlights
### Updates with explicit confirmation and recovery
Settings → About brings stable and opt-in Preview updates into one flow. Supported official-installer and POSIX uv environments can review an exact version, confirm installation and restart, and reconnect to the updated gateway. Other installation methods receive instructions for their original package manager or deployment owner.
The obsolete bundled `update-setup` wizard has been removed. Existing user-workspace skills are not deleted; review any saved upgrade commands against the current installation-owner instructions before using them.
Installer-managed environments can repair a failed installation and, when safe, restore the original program. Recovery does not overwrite current configuration or conversations with an old backup. Package verification, stopped writers and protected-data checks remain required; automatic recovery does not cover every interruption or installation method. Public in-app installation additionally depends on the signed release and complete public update assets, not just this code being merged. See [Updating nanobot](../updating.md).
### One durable store for conversation history
The gateway now owns model history and WebUI display history in SQLite. Existing JSONL conversations and display segments are imported on startup, with retained source backups. History loading, live output reconciliation, queued follow-ups and `/goal` continuation have received reliability fixes. Model text already streamed before a connection failure is retained for subsequent context without changing the failed request into a success.
### A more usable workbench
- Connect the WebUI to existing remote nanobot instances, with explicit host identity, pairing and connection recovery.
- Navigate complete prompt history with bounded loading, search loaded message text and session handles, rename topics inline, and archive topics in batches.
- Keep delegated tasks and their details within reach, with shared sidebar/Composer run state and clearer retry and completion feedback.
- Use local-file and video attachments, image thumbnails, file cards, and Markdown previews with a source view. Arbitrary website embedding has been removed; external links open in the browser.
- Adjust reading sizes, use smoother theme transitions, and work with improved mobile layouts and touch interactions.
- Run literal shell commands from the Composer with the existing permission boundary; command output remains distinguishable from an agent reply.
### Terminal, models and integrations
- Native terminal packages include Mermaid image rendering and smaller standalone builds with target-specific native dependencies. Platform wheels include the matching TUI and built WebUI; supported wheel installations do not need Bun or a first-launch TUI download.
- On macOS, diagram rendering uses installed Heiti SC fonts with readable outlines. It does not depend on private PingFang UI font files or require a font download.
- The TUI SVG parser is updated to the maintained `@xmldom/xmldom` 0.8.15 patch release. Restricted image rendering and isolated rendering workers remain in place.
- PDF and image readers and the memory Git backend use updated pypdf, Pillow and Dulwich releases. Compatibility extras such as `nanobot-ai[pdf]` select the same supported reader versions as the base installation.
- Model setup includes searchable providers, explicit API choices and per-preset request overrides. Shared proxy settings can be selected independently by supported providers, web tools and MCP connections.
- Native Linear and WhatsApp Agent Platform channels, QQ QR setup, DeepSeek Search, and further provider/channel compatibility improvements are included.
- Scheduled jobs can be updated, enabled and disabled in place, and their recent run history can be inspected. Restart and delivery fixes preserve pending work without treating an unknown delivery result as permission to replay it.
- Windows process-status polling reuses native type and API bindings, fixing idle memory growth on Python versions before 3.14 while retaining live process-identity checks and handle cleanup.
## Before upgrading from v0.3.5
1. Use the original installation method on the gateway computer, under its original OS account. v0.3.5 does not contain this new in-app updater; the first upgrade must use the installer, package manager or deployment's existing route. Existing environments are not silently converted into official-installer environments.
2. Finish active work and stop every nanobot process sharing the environment or data. Back up the entire selected configuration directory and workspace together while writers are stopped, including authentication, session data and WebUI state. Do not copy only a live SQLite database file.
3. After publication, select the final 0.4.0 package through the [installation-owner instructions](../updating.md#installation-owners), preserving extras, constraints and custom options. Containers must keep their existing data volumes; do not install packages into a running container as an upgrade strategy.
4. Start the same instance through its original launcher. Confirm the running version in Settings → About, open older conversations, send a new message and check that the saved state remains available after another restart. An installer exit code alone does not verify the running gateway.
5. Reconnect or reload clients after the gateway upgrade. For remote use, update the intended gateway rather than the browser computer, and follow any client/host compatibility guidance shown by the application.
### Data and configuration compatibility
JSONL import remains supported throughout 0.4.x. Installations with only legacy JSONL data must pass through an import-capable release before 0.5.0. Imported source files are retained as backups; do not delete the old WebUI directory, which also holds preferences. A corrupt or ambiguous import stops startup with an actionable error instead of silently skipping history. See [Session Storage](../cli-reference.md#session-storage).
Older versions cannot read newly saved SQLite display history. A downgrade is not an in-place recovery shortcut: stop all writers and follow the documented pre-upgrade-backup restoration procedure, explicitly accounting for newer messages that the old backup does not contain. The managed updater never performs this data rollback automatically.
Legacy proxy configuration migration remains supported in 0.4.x and is removed in 0.5.0. Review the migrated shared proxy and per-service choices before saving; a browser's proxy settings are separate from the gateway's. See [Configuration](../configuration.md).
v0.4.0 and v0.4.1 include the temporary OpenAI `apiType` / `api_type` → `api` conversion. Save configurations that use an explicit old selection in the current `api` format before upgrading beyond v0.4.1; update launcher environment variables separately. The old `auto` default needs no action. This compatibility window is separate from the 0.4.x JSONL/proxy window.
### Installation and platform boundaries
Fresh official-installer environments use a dedicated venv and launch the normal WebUI persistently in the background. Existing unrecorded installs retain their original lifecycle. Use the same instance selectors with `nanobot gateway stop` to stop a persistent instance; closing its terminal or browser does not stop it. On a local macOS desktop the WebUI can show a Dock icon; `--no-dock` suppresses it. See [WebUI](../cli-reference.md#webui).
Python 3.11+ remains required. Native wheels target macOS 13+ (arm64/x64), glibc 2.17+ Linux (arm64/x64) and Windows x64; x64 requires SSE4.2. There is no native wheel for Windows ARM64 or musl Linux. Classic Python and WebUI routes remain distinct from native TUI support. Cross-built packages are not proof of native execution on every platform.
Preview remains off by default. Selecting a channel is not permission to install, stop tasks or restart a gateway. Turning Preview off does not downgrade a newer installed version. A missing or unverifiable public release must not be offered as a successful automatic install.
## Release scope and remaining checks
These notes describe the current preparation base, not open PRs or a promise that all known issues are fixed. In particular, preventing new `/goal` event-sequence collisions does not repair already conflicting legacy history. The separate Dock window-reuse and retry-redesign work is not included in this release scope. Reconcile these limitations with the final merged range before publishing.
The release PR tracks the final CI/review, package hashes, native installation and upgrade/recovery matrix, historical-baseline coverage, source-offer commitment and documentation handoff. The [release checklist](../releasing.md) remains authoritative. Merge preparation before creating a tag, then compare the merged sources with the accepted candidate and reverify any changes. Tag that exact verified commit, not a later untested `main` tip. No tag, GitHub Release, PyPI upload, signing switch, update-feed advancement or website deployment is performed by this preparation PR.
## Acknowledgements and changelog
Thank you to everyone who reported issues, supplied reproductions, tested changes and contributed fixes. The immutable [preparation-base changelog](https://github.com/HKUDS/nanobot/compare/v0.3.5...32ee2810a1ae563a3c3430e979f9b8e34129a85c) records the included changes and their authors. Replace this draft's base comparison with the final release comparison and reconcile contributor acknowledgements before publication; commit counts must not be described as merged-PR counts.
-296
View File
@@ -1,296 +0,0 @@
# Release checklist
Use this checklist with the [Release Packaging Contract](../CONTRIBUTING.md#release-packaging-contract). Preparation does not authorize publication. Pushing tags, publishing GitHub Releases, uploading to PyPI and deploying documentation are separate operations.
## Release cadence
Stable is the default feed; Preview is opt-in. Both use one update flow and require confirmation before installation. Neither a faster cadence nor a subscription permits stopping tasks or restarting a gateway automatically. See [Updating nanobot](./updating.md) for user instructions.
| Release | Trigger | Public destination | Documentation |
| --- | --- | --- | --- |
| Stable feature release | Manual, when needed | Final GitHub Release and PyPI; also index its manifest for Preview subscribers | Full version documentation and any planned announcement |
| Stable patch | Manual, when a reviewed fix is ready; do not wait for a feature milestone | Same stable destinations and checks | Generated change notes and necessary upgrade instructions; update only affected documentation |
| Preview / dev | Daily workflow, after maintainers enable it | GitHub prerelease and protected `release-index` catalogue; not PyPI | Generated change notes; no new documentation edition for each build |
These are three publication lines, not three build systems. Feature and patch releases both use `channel=stable`; dev uses the existing `preview` channel. A patch does not require a Preview first or a complete wiki and promotional refresh. Preserve necessary tests and release checks, and reuse unaffected evidence under the [verification guidance](../.agent/workflow.md).
Implementation status: **Verify Release Candidate** supports manual preparation and opt-in daily Preview preparation. It generates draft notes and reuses the same five-platform build and acceptance jobs. It does not publish. Automatic prerelease upload, signing handoff and catalogue advancement are not connected yet; PyPI publication requires a separate manual workflow after its trusted publisher is configured. Daily preparation is disabled by default. Do not describe this first step as an available daily public release channel.
Record the requested channel, exact source and candidate identity. Unchanged source, failed checks, missing assets, incomplete acceptance or absent approval leaves the last verified release in place. Scheduled execution can be delayed; there is no promise of a new release every day. Acceptance must cover the supported stable baseline and an earlier Preview, including skipped previews, not just the previous build.
### Shared preparation entry
Run **Verify Release Candidate** at the chosen source ref with the existing `next_stable`, `channel` and optional `retain_installable` inputs. Both Stable release sizes use the same entry. The workflow generates `release-notes.md` from commit subjects and includes it in candidate reports and an explicitly retained installable handoff. Review necessary upgrade instructions and security wording before publication. These notes are local artifacts, not a GitHub Release, including a draft Release.
Stable notes start at the preceding final release on the selected source line, ignoring Preview tags. Preview notes can start at the preceding Preview's source. Neither uses an unrelated branch's newest tag. The planned source is the event SHA throughout the run; preparation does not follow a moving branch.
For daily preparation, maintainers can later set `NANOBOT_PREVIEW_BASE` to the next unreleased final version and explicitly enable `NANOBOT_DAILY_CANDIDATES_ENABLED=true`. The schedule is currently 00:17 UTC. Only the official repository's `main` can use it. It requires successful latest push CI for that exact SHA and skips a source/base already accepted by this workflow. Failed candidates can run again; manual dispatch remains available to retain a new handoff. Both paths share the existing workflow run number for `.devN`. Update the base after its final release; an already tagged base is refused.
Daily runs retain small reports only, not the optional installable handoff. They still use the existing five native runners and temporary wheel transfers, so review the runner and storage cost before enabling the variable. This is a preparation switch, not permission to sign or publish. No repository variable or protection setting is changed by adding this workflow code.
### Stable patch procedure
1. Select the supported stable baseline and reviewed fixes. If `main` contains unfinished features, branch from that baseline and backport only the required fixes. Do not relabel an unverified Preview as stable.
2. Allocate an unused final version, update both version declarations, and follow **Prepare a candidate**. Patches require the same packaging, licensing, native startup, data-preservation and update/recovery gates as feature releases.
3. Publish approved immutable files in order: GitHub, PyPI, public-download checks, then the catalogue's `stable` pointer. Preserve `preview` and withdrawal history. A stable patch older than an installed Preview must not be offered as a downgrade.
4. Publish concise fix notes and required operator actions. Users without this updater need their original installation method for the first upgrade; external package/deployment owners retain their route.
### Preview procedure
1. Select an exact reviewed `main` commit with passing required CI; skip it if its source SHA matches the last accepted candidate. Record the next unreleased stable base and an unused increasing Preview sequence.
2. Use **Verify Release Candidate** for that ref and base, manually or through enabled daily preparation. It prepares a version-only candidate, builds the WebUI and five native TUI bundles once, and runs macOS arm64/x64, Linux arm64/x64 and Windows x64 clean-install and packaged update/recovery acceptance against the exact manifest-bound wheels without publication. Ordinary PR CI keeps its Linux x64/Windows x64 matrix; candidate preparation uses all five native runners. Require the **Candidate required** check to pass; build-only reports are insufficient. Users receive built packages, not a checkout requiring Bun.
3. Select `retain_installable` and preserve the accepted `installable-candidate` handoff before expiry. Temporary `candidate-native` inputs and `prepared-candidate` artifacts are not accepted handoffs. Complete real historical-baseline and interactive acceptance against those exact bytes; the automated fault-injection fixtures do not establish compatibility with a previously published version or interactive desktop behavior. Keep candidate SHA, manifest hash, coverage, known issues and source-offer approval together; CI reports alone are neither installable artifacts nor publication consent.
4. With separate approval, publish immutable `v<version>` at the **candidate** commit and a GitHub prerelease, never the latest stable release. Upload the complete verified set, manifest and notes; make the pinned installer source publicly reachable.
5. Verify all public sizes/hashes and clean public install/update acceptance before advancing `preview` with a new catalogue generation. Validate against the latest catalogue, preserve `stable` and withdrawals, and serialize stable, Preview and withdrawal writes. A stale publisher must reread and revalidate.
6. After partial upload, leave the feed unchanged and resume only from the original verified files. Lost or changed bytes require a new version and repeated acceptance. Withdraw unsafe candidates with a reason and offer a newer fix; never rewind the feed or restore user data.
Use Python version ordering: `0.3.6.dev42 < 0.3.6.dev43 < 0.3.6 < 0.3.7.dev1` (illustrative versions). Once a final base ships, previews need a later base; allocate it after accounting for stable patches. The workflow uses `github.run_number` for `N` in `X.Y.Z.devN`; do not reset the sequence without checking published versions. Reruns cannot replace published bytes. Rebuild and test final releases under their final identity; never rename `.devN` wheels.
### Launch gates and automation boundary
Before offering public Preview, obtain approval for index ownership/protection, publication credentials, source retention and exact packaged/public-download acceptance. Candidate preparation does not activate a public channel, schedule, protected publisher or PyPI upload. Preserve approved release bytes and source outside expiring CI storage for their required lifetime.
Stable releases remain manual. Daily Preview preparation requires the explicit opt-in above; automatic publication needs a separate reviewed implementation and activation. Keep builds read-only and publication permissions in the protected stage. Keep one serialized catalogue writer. Announce Preview availability only after verifying its public feed. Any discovery hint must be dismissible; do not show an update badge for an unavailable channel or enroll users merely because they check.
## Prepare a candidate
1. Choose the previous release and exact candidate commit. Use a clean worktree without local configuration, sessions, credentials or unrelated changes.
2. Update `project.version` in `pyproject.toml` and the final source-only fallback in `nanobot/__init__.py`. Private WebUI/TUI versions are not the Python release version.
3. Review the generated change notes and add required upgrade/rollback instructions. Feature releases can add highlights and acknowledgements; ordinary patches do not need a full announcement. Verify counts: commits are not merged PRs. Coordinate security disclosures separately.
4. Run Python, WebUI and TUI CI checks against the final commit, not an earlier PR head. Review installation, configuration, session and API changes.
5. Run `uv build --out-dir <artifact-directory>` in a clean output directory without `NANOBOT_SKIP_WEBUI_BUILD`. The build hook bundles WebUI in sdist and wheel; the wheel is built from the sdist.
6. Run `twine check` on intermediates, inspect contents and record SHA-256 hashes. Test installation in an isolated environment outside the checkout and upgrade from previous stable with disposable configuration/sessions, never a maintainer's live workspace.
7. For feature releases, prepare the version documentation in `Re-bin/nanobot-web` under its `MAINTAINING.md`. For patches, update only affected instructions and translations; do not require a new complete manual or promotional page when the existing documentation still applies. Preserve existing URLs and previous versions, and verify affected site routes. Pin source references where applicable and never advertise an unpublished package. Preview notes cover development changes without creating a documentation edition each day.
8. Review pinned Bun/OpenTUI licenses, corresponding source and relinking instructions. Check upstream revision availability and runtime/lockfile/notice agreement. Obtain the maintainer's commitment to the [source offer](../tui/SOURCE_OFFER.md) for its full stated period, at least three years after release; tests cannot grant it.
9. Build all five native targets with publication scripts, ad-hoc signing macOS before packaging.
- Verify archive checksums, manifests, architecture, licenses/notices and embedded source, including checkout-matching bytes for `tui/scripts/targets.ts` and `tui/scripts/target-bindings.ts`. Run supported native smoke tests, record coverage and exact-head CI evidence, and label cross-compiled-only targets.
- Build platform wheels below, check them with `twine check`, validate RECORDs/tags/permissions and test pip selection on all five platforms.
- Test first launch with an empty cache and `NANOBOT_TUI_NO_DOWNLOAD=1`; the executable must come from `site-packages/nanobot/tui/bin/`, not checkout or cache.
10. Merge release preparation only after current checks/reviews pass. Compare the merged source tree with the tested candidate; rebuild/recheck changes. Reconcile changelog and documentation links, then tag the verified commit, not an unchecked later `main` tip.
### Protected updater handoff compatibility
Restart-capable packages include `nanobot/update_contract.json`: schema version 1, with `handoff_protocols` listing positive integer protocol IDs. Protocol 1's request, protected startup and activation requirements are defined in the [update protocol](./update-protocol.md), independently of package and WebUI versions.
Before advertising protocol 1, run preparation, frozen-worker and actual-gateway restart tests against packaged code; verify the declaration is in both sdist and wheel. Retain an ID only while its entire contract is supported; incompatible request, startup or activation behavior needs a new ID. Older updaters may install a future package only if protocols overlap. Missing, malformed or non-overlapping declarations must be refused before shutdown and require the installation owner's external update route.
### Legacy history and proxy compatibility window
Retain legacy model JSONL, WebUI JSONL / segments and per-feature proxy migration throughout **0.4.x**. Removing them before the next minor release would prevent older installations from migrating through a 0.4.x patch release.
**TODO(0.5.0):** Remove the legacy importers, proxy conversion, startup hooks and migration-specific tests; update upgrade fixtures and current documentation for SQLite history and `network.proxy` / `useProxy` only. Preserve SQLite schema upgrades and current-format behavior. The OpenAI API selector has its own compatibility window below.
### OpenAI API selector compatibility window
v0.4.0 and v0.4.1 included automatic conversion of `providers.openai.apiType` / `api_type`. The first release without conversion must note in its release notes that users can save old configuration with v0.4.1 and must update launcher environment variables separately.
### TUI preflight without a release tag
Use Bun 1.3.13 and a clean checkout; no tag or GitHub Release is required. Use the same `<target>` for preparation, compilation and notice generation. Run targets sequentially because preparation updates shared `node_modules`:
```bash
cd tui
bun install --frozen-lockfile
bun scripts/prepare-target.ts <target>
bun run build -- <target>
# For darwin-* only: ad-hoc sign dist/nanobot-tui-<target> before the next steps.
bun scripts/release-notices.ts <target>
python3 scripts/package-release.py <target>
```
Repeat for `darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64` and `win32-x64`. On macOS, run `codesign --force --sign - <binary>` and verify it; the publication workflow uses pinned `rcodesign` on Linux. Keep the ten `.zip`/`.zip.sha256` files with Python intermediates and provenance manifest in a candidate-specific directory, excluding configuration, backups and test environments from upload selections.
Candidate builds bundle minified JavaScript and the standalone Bun runtime with the additional precompiled bytecode cache disabled. Linux targets include both GNU and musl native variants, and x64 retains Bun's baseline CPU variant. Builds enforce a 135 MiB executable budget on Windows/Linux x64; other targets retain the existing 150 MiB ceiling until measured. The `dist/<executable>.size.json` report identifies the compiled, pre-signing executable and expected native packages; final archive manifests identify signed release bytes.
Before release, measure TUI first-screen and Mermaid render latency on each supported target, including first and warm renders. Verify cancellation and worker restart. Retain latency distributions and record executable, ZIP and final platform-wheel sizes separately. Cross-compilation and startup probes do not replace native interactive acceptance.
Native acceptance runs `tui/scripts/native_smoke.py` against the exact input wheel. It reuses the PTY/ConPTY input, resize and terminal-restoration checks, records five first-frame samples and cold/warm Mermaid samples with system font discovery, then terminates a submitted render and verifies a fresh worker. Its small report includes wheel/executable identities and sizes; obtain ZIP sizes from that candidate's manifest. This is automated native terminal interaction with an unavailable fixture gateway, not connected-model E2E or controlled cold-OS-cache timing. The `DiagramJobs` integration tests separately cover UI-side cancellation and subsequent-job completion.
The native render fixture includes Chinese C4 labels and generated Latin punctuation. Linux acceptance installs the supported `fonts-noto-cjk` system dependency; macOS and Windows use their installed fonts. This setup does not bundle fonts in the wheel or prove Chinese rendering on a host without suitable fonts. Keep the glyph checks enabled and retain the source-view fallback for users whose fonts are unavailable.
### Build the PyPI platform wheels
After `uv build` and native archive checks, from the exact release checkout:
```bash
uv run python -m scripts.build_tui_wheels \
--wheel <intermediates>/nanobot_ai-X.Y.Z-py3-none-any.whl \
--tui-dir <verified-tui-archives> \
--out-dir <final-wheels>
```
The script checks Python version/RECORD and native checksums, architecture, notices and source against the checkout, then writes five bundled wheels with regenerated RECORDs. It refuses existing candidates; `--target <target>` selects one platform. Minimum tags are macOS 13, manylinux glibc 2.17 and Windows x64; x64 uses Bun's baseline SSE4.2 runtime, not AVX2. Recheck Bun/OpenTUI requirements when upgrading either. There are no musl or Windows ARM64 wheels; tags do not substitute for native execution.
PyPI receives **five platform wheels and one sdist**, not the intermediate universal wheel or native ZIPs. Keep the same build's platform-neutral sdist for Python/classic and WebUI on other platforms. Record source commit, version, files, hashes, checks and remaining gates; source changes require rebuilding and rechecking.
Final releases also require `release-manifest.json` for `stable`. Run `scripts.release_candidate assemble` as shown below from the clean final-version checkout, using that final commit as `--source-commit` without Preview preparation. GitHub receives the same wheels/sdist, ten archive/checksum files and manifest; PyPI receives only wheels/sdist. Verify final source and public bytes before catalogue advancement. A TUI-only GitHub Release cannot deliver the final release to Preview subscribers.
For same-build candidate acceptance on all five native targets, run **Verify Release Candidate** at the exact final-version ref with `channel=stable`, `next_stable` equal to that declared version and `retain_installable=true`. Stable preparation copies the exact commit without changing version declarations or creating a Preview commit; it rejects mismatched versions and existing stable tags. The default `channel=preview` retains the version-only Preview preparation. Both modes are read-only preparation, require **Candidate required** and retain accepted files for one day; neither publishes a tag, release, PyPI package or feed. Download and independently preserve the accepted handoff before expiry, then complete remaining interactive and real historical-owner acceptance against that same manifest.
## Publish a stable package
One maintainer publishes the GitHub Release. GitHub Actions verifies and uploads the accepted distributions to PyPI via Trusted Publishing. Publishing installable packages does not enable application-managed updates.
1. Complete candidate acceptance on `main`. Preserve the original files and their manifest, and use the accepted commit for `vX.Y.Z`. Never move or reuse a published tag.
2. Create a draft with the five platform wheels, sdist, five TUI archives, their checksums and the original `release-manifest.json`. Use the artifact set that passed acceptance, without rebuilding any files under that release identity. If using **Publish Terminal UI** to rebuild, assemble new matching wheels and manifests and repeat candidate acceptance before publishing.
3. Click **Publish release**. A stable publication starts **Validate published release for PyPI**, which starts **Publish accepted release to PyPI** on `main`. The publisher requires a matching CI manifest from a successful **Verify Release Candidate** run and a successful **Candidate required** job for that same attempt. It checks the tag, all public artifacts and the package index, then uploads only the five wheels and sdist. Prereleases and tag pushes alone do not publish Python packages.
4. Verify clean installation from public PyPI, bundled WebUI and download-free TUI startup. Add the dated [Release Archive](./release-archive.md) entry and record the publication result. Only after GitHub and PyPI assets are public and verified should the wiki PR be merged; check affected localized routes. An update catalogue change is separate and requires the signature described below.
### Configure Trusted Publishing
Protect `main` and the publication workflows. In the `nanobot-ai` PyPI project's **Publishing** settings, bind `HKUDS/nanobot`, `publish-pypi.yml` and the `pypi` environment. Keep that GitHub environment restricted to `main`; the single-click path does not require an environment reviewer. During rollout, verify the publishing path with a separately configured TestPyPI trusted publisher (the same repository and workflow, environment `testpypi`) before removing a production reviewer requirement. Production does not use a long-lived token. The separate `release-approval` environment retains independent review.
To rehearse or resume, use **Run workflow** on `main` with the already-published version and destination `testpypi` or `pypi`. If the human GitHub publication did not dispatch the upload, use the same manual workflow entry point. Use a new run, not **Re-run jobs**: a new run checks the index and uploads only missing files. If the original CI report has expired, automatic publication stops. Preserve the accepted bytes and their verification record; use the existing manual upload route for those same verified files when necessary. Never replace a published file or move its tag.
### Release approval proof
Both Stable and Preview automatic installs require `release-manifest.json.sigstore.json` beside the manifest on the exact GitHub release. Clients verify Sigstore's production certificate chain/transparency proof and accept only `HKUDS/nanobot`'s manual `release-approve.yml` on `main`. The signed manifest must match version, wheel size/digest and, for Preview, catalogue commit/manifest binding. Verification runs before download and before shutdown, with no unsigned fallback. Unsigned historical releases remain discoverable but cannot be automatically installed; existing installations keep running.
Before setting the repository variable `NANOBOT_RELEASE_SIGNING_ENABLED=true`, an administrator must protect `main` and the `release-approval` environment: require independent review, prevent self-review, allow deployment only from `main`, and restrict bypass and changes to the workflow/signing requirements. Signing is disabled without that variable. No long-lived signing key or Apple Developer ID is required.
After candidate tests and dependency review, take version, manifest SHA-256, source SHA and candidate SHA from retained acceptance evidence, not public downloads. Upload the proposed manifest through the separately authorized release handoff, then manually run **Approve Exact Release** from `main` with those values and obtain environment review. The hash-locked job checks/signs the exact manifest without installing candidate code or writing releases, PyPI or the catalogue. Separately authorize attaching its proof, verify the public proof before advancing either channel, and preserve it with candidate evidence before its three-day CI expiry.
Regenerate the signing lock only in a reviewed dependency update:
```bash
uv pip compile .github/release-signing-requirements.in --python-version 3.11 \
--python-platform x86_64-manylinux_2_17 --generate-hashes --no-header \
--output-file .github/release-signing-requirements.txt
```
Review resolved dependencies; hashes are not malware review. Before the first release, prove a supported real old updater can install the signed candidate and that the candidate can install the next signed version. Private packaged recovery fixtures substitute publication authority and are not signature evidence.
The proof authenticates release approval, not reproducible builds or harmless code. Compromised authorized workflows/reviewers, malicious source that passes review and compromised runtime dependencies remain risks. The signing lock does not lock runtime resolution, which retains the installation owner's policy. A reviewed runtime dependency inventory, public signed upgrade continuity and verified repository protection settings remain security-release gates; do not claim comprehensive supply-chain protection without them. The first installer and checksum source also need a trusted distribution channel.
Only after the signature, matching public release files and applicable public update checks are verified may the maintainer advance `stable` or `preview`. Preserve the other channel and withdrawals, and check discovery for both subscriptions. A package published without this proof remains available for manual installation, not application-managed updates.
## If a gate fails
Do not publish to PyPI with missing TUI artifacts or verification. Keep public documentation's `latest` on the usable stable version. Correct published packages with a new version, never replacement code behind an existing tag. Before downgrading a migrated installation, stop all old processes and follow the documented session rollback procedure.
## Installer identity checks
Fresh base-package installs use the official installer's dedicated venv regardless of optional managers on PATH. `nanobot-install.json` is written before venv/download work so failed first installs retain their owner; it is not readiness proof. Existing venv/uv/pipx installations are not adopted or moved. The receipt records extras for update planning and opts `webui` into persistent background launch; unrecorded installs retain their lifecycle. Include this distinction and the instance-specific stop command in release notes.
Linux/Windows native CI builds a platform wheel and runs the public installer in a private home without Bun/Node/Git on PATH, then checks the managed receipt, installed WebUI, native TUI and gateway. Python/WebUI changes also require these jobs. CI retains small reports, not candidate binaries. Startup probes and offline installer fixtures do not replace packaged upgrade/recovery or public-download acceptance.
Run `pytest tests/test_install_scripts.py` with `uv` and `pipx` available. It uses private homes, offline fixture wheels and real managers, without a gateway or real application install: `install.sh` on Unix and Windows PowerShell with `install.ps1` on Windows. CI provisions pipx outside application dependencies. Verify these owner-preservation requirements:
- Launch the selected persistent environment's isolated Python, not `pipx run`, disposable tools or an arbitrary PATH executable. Existing recognized installations take priority over newly available managers; multiple recognized installs require explicit choice. An ordinary active venv is explicit; uv/pipx environments must use their manager.
- Preserve uv constraints. Generic pipx upgrades can drop constraints/options; the installer must refuse pipx records with those settings, lock workflows or unconfirmed sources. The owner must review and preserve them. Exact wheels may replace a wheel source, not registry constraints/options; pipx upgrades must retain requested extras and refuse wheels missing recorded extras.
- A failed selected manager must not fall through to another installation, even on first install. Verify the exact persistent package version before onboarding: a successful pinned/locked skip is not target installation. Restarted gateway identity is a separate check.
Verify the exact-handoff options against the pinned installer, not an older script: `install.sh --wheel <path> --sha256 <published-hash>` / `install.ps1 -Wheel <path> -Sha256 <published-hash>`, or `install.sh --release <version> --manifest-sha256 <trusted-manifest-hash>` / `install.ps1 -Release <version> -ManifestSha256 <trusted-manifest-hash>`. Wheel mode verifies checksum/package/version; release mode selects one of five native tags for the target Python and verifies size/hash/identity before invoking the original owner. No frontend toolchain or extra selector package is installed; the manager still checks Python/dependencies. Hashes must come from trusted metadata, not an unknown publisher.
Release downloads use official GitHub HTTPS hosts and configured HTTPS proxy; retain wheel sources at their recorded paths, including `~/.nanobot/downloads/releases` or `NANOBOT_RELEASE_CACHE`. Failed partial downloads are removed. Wheel-mode `--dry-run` / `-DryRun` verifies without installation/setup; release-mode dry-run checks only the manifest, creating no wheel/cache/environment/setup and proving neither wheel bytes nor dependency resolution.
These exact-version handoffs do not discover Preview, change subscriptions, stop gateways or back up data. Require stopped writers and backup first. Review extras and recorded options for plain pip, suffixed/custom installs and external owners; see the [user guide](./updating.md) and [update protocol](./update-protocol.md). Installer fixtures alone do not establish live maintenance, backup or restart safety.
### Packaged upgrade and recovery acceptance
Linux/Windows native CI runs `scripts/verify_packaged_update.py` against its wheel; manual candidate preparation tests each of the five assembled platform wheels on a matching native runner. Run macOS acceptance against the candidate's macOS wheel:
```bash
<build-tools-python> -I scripts/verify_packaged_update.py \
--wheel <exact-native-wheel> --commit <candidate-commit> \
--output <new-private-acceptance-directory>
```
Build tools need project Python dependencies. The probe creates disposable venv/account/configuration/workspace and loopback gateways, without maintainer data, models or credentials. It records the unchanged healthy target's SHA-256 and candidate commit; faulted private wheels must never be uploaded.
On a local macOS desktop, add `--dock` to verify the real AppKit helper alongside these journeys. The managed receipt must make `nanobot webui --yes --no-open` detach automatically; each applicable running version must have one helper, preserve desktop intent through upgrade/recovery and a second start, and remove its helper on stop. Historical packages without Dock support gain the icon only after their first healthy upgrade and an explicit WebUI launch. This is process/lifecycle acceptance, not a visual Dock-click test; do not enable it on headless CI or claim native Windows/Linux icon coverage.
Require normal and consecutive upgrades, skipped Preview, import/startup failure, backup failure after shutdown, worker termination, partial metadata loss and interruption between program-restoration renames. Each successful journey must show the expected version in a new gateway run, a retained verified backup, authenticated history reads, continued writes and a second ordinary start. Each recovered service must then update to the healthy target with the same account/conversations. Faults affect the first job; backup failure must survive its automatic retry, while a separately confirmed next update can make a healthy backup. The instrumented intermediate Preview's second hop installs the unchanged final wheel.
Compare configuration, retained legacy-source bytes, canonical SQLite records, WebUI transcripts and pending `delivery/outbox.sqlite3` records separately. Cover canonical-only, display-only and mixed history without inventing canonical records for display-only chats; SQLite checkpoint byte changes alone are not data loss. Retain the protocol-1 parked-gateway regression across old/new protected-store inventories: no outbox initialization, migration or writes outside the old grant before activation. See the [update protocol](./update-protocol.md) for scope and lease requirements.
Default baselines are labelled target-derived fixtures, not historical compatibility evidence. For release acceptance, add `--baseline-wheel <previously-accepted-wheel>` and repeat with supported stable and older Preview packages, including skipped Preview. Baseline feed transport is instrumented; the healthy target is unchanged. Include a retained pre-SQLite updater to check JSONL migration's canonical message bodies separately from display history. If recovery restores JSONL code, mark SQLite checks not applicable, not passed. Packages without this updater need separately recorded installation-owner bootstrap acceptance.
Exercise consecutive updates in the same disposable account with existing conversations through each applicable owner: official installer, uv tool, pipx, ordinary pip venv and source. Check recorded constraints/options before/after, execute the offered command, verify the restarted gateway, append a message and start again. Policy refusal must leave installation unchanged; custom owner-reviewed updates do not prove automatic recovery. Container replacement requires a real engine and retained data volumes, not a mocked marker.
For installer-owned background recovery, verify one exact-target repair, then original-program restoration only before activation and only with unchanged protected data, including restart/health verification without browser or terminal intervention. Data changes, activation, live owners or changed installation ownership must prevent unsafe rollback. Other owners retain their repair route. Never delete jobs/fences or automatically restore old configuration/chat data. Exercise native Windows locks/renames. Loss of both supervisor and worker, permanent storage damage and incompatible data writes are not automatically recoverable; retain these limits in release notes and the operator guide.
Keep private evidence until review; it can contain program generations/backups and is not an upload set. CI retains small reports, including completed cases after a later failure; only all selected journeys passing produces aggregate success. Partial reports or a timeout are not an overall pass. Record actual native OS/CPU coverage separately from installer/startup fixtures: Linux x64, Windows x64 and macOS arm64 do not establish macOS x64 or Linux arm64 coverage. Controlled release transport and fault injection prove neither public downloads nor interactive UI; complete those gates before claiming them.
## Stable and Preview subscriptions
Use [Updating nanobot](./updating.md) for Settings → About and CLI instructions. Release acceptance must preserve opt-in consent: Preview is off even on development builds; switching saves/checks a feed, not installation approval. Require separate exact-version confirmation and a Preview risk warning. Profiles sharing an environment/account share its subscription; other installations/accounts do not. Environment replacement may require reselection; browser storage is not authoritative.
| Current install / requested channel | Required acceptance result |
| --- | --- |
| Stable → Preview, a newer verified preview exists | Offer that exact preview; install only after confirmation. |
| Preview → Preview | Offer only a higher verified version, including a final release. |
| Preview → Stable, stable is newer | Offer the final release; keep Stable selected. |
| Preview → Stable, stable is older | Save Stable and wait for a newer final release; keep running the preview. |
| Preview subscriber installs a final release | Keep Preview selected for the next development cycle. |
| Current preview was withdrawn | Warn even without a safe newer replacement; never silently downgrade. |
| Feed offline, incomplete, missing or incompatible | Return non-success; retain subscription and allow rechecking. |
Stable checking/planning requires complete PyPI wheels/sdist. Preview uses `release-index/catalogue.json` and exact GitHub manifests, never PyPI `--pre` or arbitrary branches. Validate targets against the gateway interpreter/platform, not the browser. Index final releases for Preview subscribers too; advance only after verifying all referenced public assets.
Versions, tags and manifest hashes are immutable. Increment generation; never rewind or clear published pointers, remove withdrawals or reuse bad versions. To stop offering a version, retain its pointer and withdraw it. Serialize writers and validate `ReleaseCatalogue.validate_successor(previous)` against the latest catalogue. Clients reject rewrites relative to their last accepted catalogue; that check is not cryptographic signing.
Acceptance must invalidate reviews on every channel change, including Stable → Preview → Stable; cancel inactive staged work through normal stop checks and retain diagnostics. Active preparation, committed shutdown, admitted installation or failed mutation blocks switching until settled/recovered. Reject stale-tab writes and reread after lost responses, never automatically retry installation. Detailed transaction rules belong in the [update protocol](./update-protocol.md).
Discovery grants no installation authority. Only the official managed venv and supported POSIX uv transactions support the reviewed stop/install/restart flow; pipx, source, container, system-managed, unsupported uv/platform and desktop distributions retain their owner/distributor route. Remote browsers without package-install permission may read status but not change subscription. Older clients must get actionable failures for unrepresentable statuses, never false “up to date.” Verify these boundaries before announcing a public channel.
## Non-publishing preview preflight
**Verify Release Candidate** is read-only preparation, either manually requested or explicitly enabled for daily Preview: no tags/releases, PyPI or catalogue writes. It builds/checks five platform wheels, sdist and licensed fallback archives. Cross-compilation is neither native execution nor release approval.
Default retention is small identity/manifest/probe reports and installation guide for **three days**, without installable binaries. `retain_installable` preserves those exact checked artifacts plus a self-contained shallow Git repository for **one day** (about 400 MB). Keep this storage exception off for routine preflight or schedules; assess storage and call it out explicitly in workflow-change PRs before merge. Preserve approved handoffs before expiry; rebuilding expired files cannot reuse their verification. The source contains only candidate/source-parent history, not configuration or untracked files. `handoff.json` is written only after copied artifacts verify; interruption is not an accepted handoff.
After assembly, the workflow transfers all five manifest-bound wheels by immutable artifact ID; each matching native runner installs its wheel and binary dependencies into a separate venv without Bun/Node/Git on the install PATH. Isolated Python checks version/commit/import identity, all Vite-manifest assets including lazy chunks through the installed handler, and bundled TUI `--desktop-protocol` with downloads disabled and empty private HOME. With `--gateway`, it starts a private foreground CLI gateway with no provider/MCP configuration, disabled heartbeat and two loopback ports, then checks readiness, protected version identity, HTML and process/listener cleanup. Unix shutdown must be graceful; Windows termination is labelled, not graceful-shutdown evidence. No model task or external channel is exercised.
On another supported platform, check a disposable native installation without changing its package:
```bash
<installed-venv-python> -I scripts/verify_installed_release.py \
--version <candidate-version> --commit <candidate-commit> \
--gateway --report <new-report-path>
```
Use the candidate commit, not its parent. The probe rejects checkout imports/unisolated invocation and avoids user configuration/credentials. Omit `--gateway` for assets/TUI only. Reports identify OS/CPU/probes and are success-only, never overwritten; failure cleans up children and prints a bounded redacted log tail. This is package/startup evidence, not interactive UI, managed restart, migration, public-download or five-platform E2E acceptance.
For local preparation, use a full source SHA and new output outside the checkout (illustrative base/sequence):
```bash
python -m scripts.release_candidate prepare \
--source-commit <full-commit-sha> --base 0.3.6 --sequence 42 \
--output <new-candidate-directory>
```
Preparation leaves the checkout untouched and deterministically creates a version-only commit for identical inputs. Build Python distributions and all native targets from it, then run from the candidate:
```bash
python -m scripts.release_candidate assemble --source-commit <original-source-sha> \
--wheel <intermediates>/nanobot_ai-0.3.6.dev42-py3-none-any.whl \
--sdist <intermediates>/nanobot_ai-0.3.6.dev42.tar.gz \
--tui-dir tui/dist --output <new-artifact-directory>
```
Assembly refuses existing output and emits the manifest only after complete-set, version/commit, WebUI, RECORD, native/source and permissions checks. It compares sdist sources/resources against tracked candidate files with packaging exclusions, and all wheels' application/WebUI bytes against the sdist. Commit markers and RECORDs alone are insufficient; these comparisons do not prove reproducible frontend/native compilation. Recheck with `python -m scripts.release_candidate verify --source-commit <original-source-sha> --artifacts <artifact-directory>`; it may reuse an identical manifest, never replace different bytes.
Generate the handoff from the same candidate:
```bash
python -m scripts.release_candidate instructions --source-commit <original-source-sha> \
--artifacts <artifact-directory> --output <new-install-guide-path.md>
```
The generator rechecks artifacts/manifest and writes a non-overwriting guide outside the immutable upload directory. When both installers match the supported implementation, commands fetch the exact candidate's installer with the retained manifest hash for automatic platform selection; older candidates keep manual commands, never mutable `main` or assumed flags. Publication must make pinned installer source reachable.
The guide records version, source/candidate commits, five hash-bound wheel URLs and separate new/existing base-package commands for uv, pipx and pip venv. Commands verify local size/SHA-256 with the standard library before manager invocation; URL hash fragments alone are insufficient for the tested uv commands. Retain wheel paths recorded by managers. Manual commands move to an advanced section when automatic entry is supported; no new manifest schema or installer executable is introduced.
Before offering the guide, publish/verify exact public files and add release changes, native coverage, migration/recovery instructions and stop/backup prerequisites. Review extras and locked/suffixed/external-owner options; independently verify installed version and restarted gateway. Manager fixtures do not prove restart/migration, and the guide is neither publication approval nor channel selection.
The candidate clone borrows source Git objects; preserve its source repository until retained in an approved permanent ref. Partial assembly has no accepted manifest and must not be uploaded. Source-offer commitment, native launch, clean install, upgrade/recovery and publication gates still apply. Missing public assets must be recovered from original verified files, never overwritten by rebuilds.
Retain an exact local handoff outside temporary build storage:
```bash
python -m scripts.release_candidate retain --source-commit <original-source-sha> \
--artifacts <verified-artifact-directory> --output <new-retained-directory>
```
Only `artifacts/` is the upload set; `source.git/`, `install.md` and `handoff.json` are maintenance evidence, not PyPI packages. Restore with `git clone --no-local <retained>/source.git <new-checkout>`, check HEAD against `handoff.json`, and rerun `release_candidate verify` on retained artifacts before separately approved publication. Keep native reports and release notes alongside them; retention adds no native, migration, interactive UI or public-download evidence.
+76 -78
View File
@@ -1,64 +1,62 @@
# Start Without Technical Background
This walkthrough is for people who have not used a terminal, API key, or config file before. The goal is simple: get your first reply from nanobot in a web browser. You do not need to edit any code or config files by hand.
This walkthrough is for people who have not used a terminal, API key, or JSON config file before. The goal is only to get one reply in a browser. You do not need to understand nanobot's architecture or edit its config by hand.
## What You Will Need
- A Windows, macOS, or Linux computer.
- Python 3.11 or newer.
- An AI model service (such as OpenRouter, OpenAI, Anthropic, or a local model like Ollama) and its login or API key.
- An account or endpoint that can run an AI model.
- The API key, login, endpoint, and model name required by that service. A local model such as Ollama may not require an API key.
> [!CAUTION]
> Treat an API key like a password. Never paste it into screenshots, chats, or public support requests.
An API key is password-like. Do not post it in an issue, screenshot, chat, or public config file.
## A Few Useful Words
| Word | What it means |
| Word | Meaning |
|---|---|
| Terminal | A text window where you paste a command and press Enter |
| Command | One line of instructions you run in the terminal |
| Provider | The AI service (or local app like Ollama) that runs the model |
| Model ID | The exact model name your provider expects |
| API key | A secret key that lets nanobot connect to your provider |
| WebUI | The browser page where you chat with and configure nanobot |
| Command | One instruction typed into the terminal |
| Provider | The service or local server that runs the AI model |
| Model ID | The exact model name expected by that provider |
| API key | A secret credential that lets software call the provider |
| Wizard | A question-and-answer setup menu |
| WebUI | The local browser page where you use nanobot |
## 1. Install Python
If you do not already have Python 3.11 or newer, download it from [python.org](https://www.python.org/downloads/). On Windows, check the box labeled **Add python.exe to PATH** during installation so your terminal can find Python automatically.
Download Python from [python.org](https://www.python.org/downloads/) if you do not already have version 3.11 or newer. On Windows, enable **Add python.exe to PATH** if the installer shows that option.
Open your terminal:
Open a terminal:
| System | How to open |
| System | How |
|---|---|
| Windows | Press `Win`, type `PowerShell`, and open **Windows PowerShell** |
| Windows | Press `Win`, type `PowerShell`, and open Windows PowerShell |
| macOS | Press `Command+Space`, type `Terminal`, and press Enter |
| Linux | Open your app menu and search for **Terminal** |
| Linux | Open your application menu and search for Terminal |
Type this command and press Enter:
Check Python:
```bash
python --version
```
You should see something like `Python 3.12.x` (any version `3.11` or higher works). If you get an error saying `python` is not recognized, close and reopen the terminal, or try `python3 --version` (macOS/Linux) or `py --version` (Windows).
The result should start with `Python 3.11` or a newer number. If the command is not found, close and reopen the terminal. You can also try `python3 --version` on macOS/Linux or `py --version` on Windows.
## 2. Prepare Your Model Details
Having a regular chat website subscription (like ChatGPT Plus or Claude Pro) does not automatically give you API access. Before continuing, make sure you have an AI provider ready.
nanobot does not create an AI provider account for you. Before setup, have these details nearby:
If you do not have a provider yet, [OpenRouter](https://openrouter.ai/) is a simple starting point (any supported provider works):
1. The provider or company endpoint name.
2. Its API key, if it requires one.
3. Its base URL, if its documentation gives you one.
4. A model ID your account can use.
1. Create an account at [OpenRouter](https://openrouter.ai/).
2. Open [API Keys](https://openrouter.ai/settings/keys) and create a key. Keep it somewhere private for Step 4.
3. Pick a model from the [model catalog](https://openrouter.ai/models) and copy its model ID. Pick a model that supports tools (often labeled **Tools**) if you want nanobot to read files or run actions for you.
If you prefer a model that runs locally on your own computer with no API key, see the [Ollama recipe](./provider-cookbook.md#recipe-ollama-local-model). If you are using a company-managed AI service, ask your administrator for the endpoint URL, key, and model ID.
Whatever provider you choose, make sure the **provider, key, and model ID all belong to the same service**.
The provider, credential, endpoint, and model must belong together. For example, an API key from one provider usually cannot call a model name copied from a different provider.
## 3. Install nanobot
Copy the command for your system, paste it into the terminal, and press Enter:
Copy the command for your system, paste it into the terminal, and press Enter. Copy only the text inside the code block.
**macOS / Linux**
@@ -72,80 +70,68 @@ curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.
irm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1 | iex
```
The installer sets up nanobot in its own dedicated folder and automatically opens the WebUI in your browser when finished. This first setup can take a few minutes.
The installer downloads the stable nanobot package into an isolated Python environment. On a fresh local desktop, it then starts the WebUI and opens your browser. This can take a few minutes on the first run. Keep the terminal open. It prints the exact command used to run nanobot; if `nanobot` is not found later, reuse that whole command instead of switching to a different Python command.
> [!TIP]
> If your terminal says `nanobot` is not found later, reuse the full command printed at the end of the installer output. If your network or company blocks downloaded install scripts, see [Other Install Methods](./quick-start.md#other-install-methods).
If your organization blocks downloaded install scripts, use the [alternative install methods](./quick-start.md#other-install-methods) or ask your administrator to review the scripts first.
## 4. Configure Your Model in the WebUI
Once the WebUI opens in your browser, go to **Settings → Models**:
In the browser, open **Settings → Models**. Then:
1. Click **New preset** and give it a name (if you see **Convert to presets**, click that first).
2. Open **Provider** and choose your provider. To add a new one, choose **Add provider**, enter your API key (or complete sign-in), and save.
3. Pick a model from the list or paste your model ID.
4. Click **Save**.
1. Choose your provider.
2. Enter its API key and base URL when required.
3. Create or select a model preset.
4. Enter a model ID available to your provider account.
5. Save the configuration.
If the browser did not open automatically after installation, run:
Treat every API key like a password. Do not include it in screenshots or support requests.
If the installer finishes without opening the browser and `nanobot` is available, run:
```bash
nanobot webui
```
On a server without a browser (such as over SSH), the installer opens a terminal setup wizard instead—choose **Quick Start** and follow the prompts.
If the terminal cannot find `nanobot`, take the exact command printed by the installer and replace its final arguments with `webui`. That command may begin with `uv tool run`, `pipx run`, or the full path to nanobot's private Python environment.
On SSH, a computer without a desktop, an existing configuration, or an older nanobot release, the installer may open the terminal wizard instead. Choose **Quick Start** there and follow its prompts.
## 5. Get the First Reply
If your browser still did not open automatically, copy the **entire login link** printed in the terminal (including the `#...` part at the end) and paste it into your browser's address bar. Keep that link private because it signs your browser in.
Leave the WebUI terminal open. If the browser did not open automatically, visit `http://127.0.0.1:8765`.
Type this in the chat box and send it:
Send this message:
```text
Hello!
```
Any normal reply means nanobot is set up and working. By default, nanobot only runs locally on your computer and cannot be reached by other devices on your network.
A normal assistant reply means setup is complete. The exact reply does not matter.
The first-run address is local to your computer. It is not automatically available to other computers on your network.
## 6. Add One Thing at a Time
Now that nanobot replies, you can ask it in chat to guide you through your next goal—for example: *"I am using the WebUI. Help me connect Telegram and allow only my account."*
Do not configure every feature immediately. Choose one next goal:
You can also explore one feature at a time in the WebUI:
| What you want to do | Where to go |
| Goal | What to do |
|---|---|
| Change your AI model or add a provider | **Settings → Models** |
| Connect Telegram, Discord, Slack, Feishu, WeChat, or another chat app | **Channels** (see [Chat Apps](./chat-apps.md) for platform steps) |
| Add tools, plugins, or MCP integrations | **Apps** |
| Set a reminder or recurring task | Ask nanobot in chat, then manage it in **Automations** |
| Work with files on your computer | Try [Your first file task](#your-first-file-task) below |
| Change the AI model | Open **Settings → Models** |
| Add a provider credential | Open **Settings → Models**, then find the provider |
| Connect Telegram, Discord, Slack, Feishu, WeChat, or another chat app | Open **Settings → Channels**, choose the platform, and follow its connection steps |
| Add a tool integration | Open **Apps** and choose an App or MCP integration |
| Schedule a reminder or recurring task | Ask nanobot in the target chat, then manage it in **Automations** |
| Work with project files | Start a new chat, choose the project workspace, and review the access setting before sending the task |
If a setting asks you to restart nanobot, click the **Restart** button shown in the WebUI (or run `nanobot gateway restart` in the terminal).
Repository docs show the current development version. If your stable package does not yet show **Settings → Channels**, use the [Chat Apps guide](./chat-apps.md) or update to a release that includes it.
## Your First File Task
Some runtime changes ask you to restart nanobot. Use the restart action shown by the WebUI, or return to the terminal, press `Ctrl+C`, and run `nanobot webui` again.
1. Create a practice folder (for example `Documents/nanobot-practice`) and copy a short text file into it so your originals stay safe.
2. Start a new topic in the WebUI, click the folder selector, pick that practice folder, and click **Confirm**. Leave access set to **Restricted** (this keeps nanobot safely inside your chosen folder so it cannot touch files elsewhere on your computer).
3. Send: *"Read notes.txt and write a short summary to summary.md in this folder."* (Replace `notes.txt` with your file's name.)
Open your practice folder—you should see a new `summary.md` file there.
> [!NOTE]
> Choosing a workspace folder sets where nanobot reads and writes files. Attaching a file only shares that file with the chat. Also, starting a new topic or choosing a different folder does not separate long-term memory—if you need completely separate memory (for example, for different clients), see [Multiple Instances](./multiple-instances.md).
## Open nanobot Later
Whenever you want to open the WebUI again, run:
```bash
nanobot webui
```
With the official installer, nanobot stays running in the background even after you close the browser or terminal. You can check or stop it anytime with `nanobot gateway status`, `nanobot gateway restart`, or `nanobot gateway stop`.
For a chat platform's account, bot, token, or permission prerequisites, use the [Chat Apps guide](./chat-apps.md). For local models and provider-specific recipes, use the [Provider Cookbook](./provider-cookbook.md).
## If Something Fails
Run these commands one by one to narrow down the issue:
Run these commands one at a time:
```bash
nanobot --version
@@ -153,13 +139,25 @@ nanobot status
nanobot agent -m "Hello!"
```
| What you see | What to check |
| What you see | What it usually means |
|---|---|
| `nanobot: command not found` | Reuse the full command printed by the installer |
| `401`, unauthorized, or invalid API key | Check that the key is complete, active, and belongs to the selected provider |
| Model not found | Double-check the spelling of the model ID and confirm your account can use it |
| Browser does not open | Copy the complete login link from the terminal (including everything after `#`) |
| Browser opens, but messages fail | Run `nanobot agent -m "Hello!"` to check whether the problem is the model or the browser |
| Saved a setting, but nothing changed | Restart nanobot so the new setting takes effect |
| `nanobot: command not found` | Reuse the exact nanobot command printed by the installer; it points to the isolated environment that contains the package |
| `401`, unauthorized, or invalid API key | The key is wrong, expired, or belongs to a different provider |
| Model not found | The model ID is misspelled or unavailable to your provider account |
| Browser does not open | Open `http://127.0.0.1:8765` yourself and keep the terminal running |
| Browser opens but messages fail | Test `nanobot agent -m "Hello!"` to separate a model problem from a WebUI problem |
| A change was saved but nothing changed | Restart nanobot so the running process reloads the config |
If you ask for help, share your operating system, `nanobot --version`, `nanobot status`, and the exact error—with all API keys, tokens, and passwords removed. For step-by-step diagnosis, see [Troubleshooting](./troubleshooting.md).
If you ask for help, include your operating system, `nanobot --version`, `nanobot status`, the exact command, and the exact error. Remove every API key, bot token, password, OAuth token, and private account ID first.
Continue with the full [Troubleshooting guide](./troubleshooting.md) for an ordered diagnosis.
## Open nanobot Later
Run:
```bash
nanobot webui
```
Leave that launcher open while you use nanobot. Pressing `Ctrl+C` disconnects it; the shared gateway stops when it was the last local WebUI or TUI client. After the normal foreground start and model setup work, use `nanobot gateway --background` when you want the gateway to stay online with no clients; then manage it with `nanobot gateway status`, `logs`, `restart`, and `stop`.
+268 -82
View File
@@ -1,16 +1,45 @@
# Troubleshooting
Start at the top and follow the first step that matches your problem. This isolates installation or model errors before you debug the browser or a chat app.
Use this page to isolate where a failure lives. Start with the smallest surface that proves the most: local CLI first, then gateway, then WebUI or chat apps.
## Fast Diagnosis Order
1. **`nanobot` is not found or will not start:** Run `nanobot --version` and see [Installation Problems](#installation-problems).
2. **nanobot starts, but setup looks incomplete:** Run `nanobot status`. It checks your config, workspace, and active provider locally without calling a model.
3. **`nanobot status` looks healthy, but replies fail:** Run `nanobot agent -m "Hello!"`. If that fails, fix [Provider and Model Problems](#provider-and-model-problems) before testing the WebUI or chat apps.
4. **CLI replies work, but the browser or chat app does not:** Start `nanobot gateway` and check [Gateway Problems](#gateway-problems), [WebUI Problems](#webui-problems), or [Chat App Problems](#chat-app-problems).
Run these in order:
```bash
nanobot --version
nanobot status
nanobot agent -m "Hello!"
```
Then, only if the CLI works:
```bash
nanobot gateway
```
This separates failures into layers:
| Layer | What it proves |
|---|---|
| `nanobot --version` | Install and shell command discovery |
| `nanobot status` | Config path, workspace, environment references, and active provider/model configuration |
| `nanobot agent -m "Hello!"` | Config loading, provider/model access, workspace writes, and agent loop |
| `nanobot gateway` | Channel startup, cron system jobs, heartbeat, WebUI/WebSocket, and health endpoint |
If `nanobot agent -m "Hello!"` fails, fix that before debugging WebUI, Telegram, Discord, Docker, systemd, or any chat app.
`nanobot status` does not call the model. If provider/model setup is incomplete, it points to
WebUI **Settings → Models** or the CLI setup wizard, then prints the command to check again.
## How to Read `nanobot status`
`nanobot status` does not call a model. It checks the selected config and workspace,
resolves environment references, and validates the local settings required by the active
provider/model without constructing a provider client.
The output has this shape:
```text
nanobot Status
@@ -20,96 +49,238 @@ Model: provider/model-name (preset: primary)
Agent: ✓ provider/model configuration is ready
Provider A: not set
Provider B: ✓
Local Provider: ✓ http://localhost:11434/v1
OAuth Provider: ✓ (OAuth)
```
| Line | What you want | If it looks wrong |
Read it like this:
| Line | Good sign | What to do if it looks wrong |
|---|---|---|
| `Config` | Points to your expected config file with `✓` | Run `nanobot onboard`, or pass `--config` when using multiple instances |
| `Workspace` | Points to your expected workspace with `✓` | Run `nanobot onboard`, check folder permissions, or pass `--workspace` |
| `Model` | Shows your expected model or preset | Update it in **Settings → Models** or check `/model` in chat |
| `Agent` | Says `provider/model configuration is ready` | Follow the printed setup instructions, then re-run `nanobot status` |
| Providers | Your active provider shows `✓`, OAuth, or a local URL | Unused providers showing `not set` is normal |
| `Config` | It points to the config file you meant to use and shows `✓`. | Run `nanobot onboard`, or pass `--config` to `nanobot agent`, `gateway`, or `serve` when testing a non-default instance. |
| `Workspace` | It points to the workspace you meant to use and shows `✓`. | Run `nanobot onboard`, create the folder, fix permissions, or pass `--workspace` on commands that support it. |
| `Model` | It shows the active model or the preset name you expect. | Set `agents.defaults.modelPreset` to the intended preset, or check `/model` if you changed models during a chat session. |
| `Agent` | It says `provider/model configuration is ready`. | Follow the printed WebUI or CLI setup route, then run `nanobot status` again. |
| Provider rows | The provider used by the active preset shows `✓`, an OAuth marker, or a local URL. | Configure only the active provider first. It is normal for unused providers to say `not set`. |
If `nanobot status` looks right but `nanobot agent -m "Hello!"` fails, the install and config paths are probably fine. Continue with [Provider and Model Problems](#provider-and-model-problems).
## Installation Problems
| Symptom | Fix |
Use the same Python command for install checks and module fallback. On macOS/Linux that may be `python3`; on Windows it may be `python` or `py`.
| Symptom | Check |
|---|---|
| `python: command not found` | Try `python3 --version` (macOS/Linux) or `py --version` (Windows), and use that command consistently |
| `curl` or `irm` not found, or GitHub blocked | Install directly from PyPI with `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or `pip` inside a virtual environment |
| `nanobot: command not found` | Reuse the full command printed at the end of the official installer output; for `uv`/`pipx`/`pip`, run from that same environment |
| `No module named nanobot` | You are using a different Python than the one where nanobot was installed—check with `python -m pip show nanobot-ai` |
| `externally-managed-environment` | Use the official installer, `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or a virtual environment (do not force a system-wide install) |
| Installer picked the wrong Python | Set `PYTHON` first: `PYTHON=python3` on macOS/Linux or `$env:PYTHON="py"` in PowerShell |
| WebUI build tools missing | Packaged installs already include the WebUI; build tools are only needed for frontend development |
| `python: command not found` | Try `python3 --version` on macOS/Linux or `py --version` on Windows. Then replace `python` in docs commands with the command that worked. |
| `curl: command not found` | The macOS/Linux one-command installer could not download the script. Install curl, or use a manual isolated install such as `uv tool install nanobot-ai` or `pipx install nanobot-ai`. |
| `irm` is not recognized | PowerShell could not run the download helper. Use manual install: `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or `py -m pip install nanobot-ai` inside an environment you control. |
| Could not download `raw.githubusercontent.com` | Your network, proxy, or firewall blocked the installer script download. Use manual install from PyPI, or configure your proxy and rerun the command. |
| `nanobot: command not found` | Use the module form, for example `python -m nanobot ...`, `python3 -m nanobot ...`, or `py -m nanobot ...`. Reinstall with the same Python command, or add that Python's scripts directory to `PATH`. |
| `No module named nanobot` | You are running a different Python than the one used for installation. Run `python -m pip show nanobot-ai`, `python3 -m pip show nanobot-ai`, or `py -m pip show nanobot-ai`, matching the command that installed nanobot. |
| `pip is not available` | When the installer uses a virtual environment, it tries `python -m ensurepip --upgrade`. If that fails, install pip for that Python, or use a Python installer/distribution that includes pip. |
| `externally-managed-environment` | Your system Python blocks global pip installs. Use the one-command installer, `uv tool install nanobot-ai`, `pipx install nanobot-ai`, or create a virtual environment; do not add `--break-system-packages` for nanobot. |
| Installer chose the wrong Python | Set `PYTHON` before running the installer, such as `curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | PYTHON=python3 sh` or `$env:PYTHON="py"` before the PowerShell command. |
| Editable source install does not update | From the repo root, run `python -m pip install -e .` again with the Python command used for development, then check `python -m nanobot --version` or `nanobot --version`. |
| WebUI build tools missing | They are only needed for WebUI development. Packaged installs already include the WebUI bundle. |
## Config Problems
Default locations: `~/.nanobot/config.json` and `~/.nanobot/workspace/`. If you run multiple instances, pass the same `--home` (or `--config` and `--workspace`) to every command.
Default config path:
| Symptom | Fix |
```text
~/.nanobot/config.json
```
Default workspace path:
```text
~/.nanobot/workspace/
```
`nanobot status` reads the default config unless you pass explicit paths. Use the same `--config` and `--workspace` across status checks and runtime commands when debugging multiple instances:
```bash
nanobot status --config ./bot-a/config.json --workspace ./bot-a/workspace
nanobot agent --config ./bot-a/config.json --workspace ./bot-a/workspace -m "Hello"
nanobot gateway --config ./bot-a/config.json --workspace ./bot-a/workspace
```
Common config mistakes:
| Symptom | Check |
|---|---|
| JSON parse error | Check commas, quotes, and braces—most doc examples are snippets to merge into `config.json` |
| Unknown or missing provider | Use a built-in provider name (`openrouter`, `anthropic`, `openai`, `ollama`, `vllm`, `lm_studio`, etc.) or match the exact custom provider key you defined |
| Environment variable error | `${VAR_NAME}` values are resolved at startup—set the variable before launching nanobot |
| Config changes had no effect | Restart `nanobot gateway` (long-running processes read config at startup) |
| Missing new default fields | Run `nanobot onboard --refresh` to add missing defaults without overwriting existing settings |
| JSON parse error | Validate commas, braces, and quotes. Most docs examples are partial snippets to merge. |
| Unknown or missing provider | Use provider registry names such as `openrouter`, `anthropic`, `openai`, `ollama`, `vllm`, `lm_studio`, or define a custom OpenAI-compatible provider key under `providers` and reference that exact key from the active preset. |
| snake_case vs camelCase confusion | Both are accepted, but docs use camelCase because nanobot writes config with aliases such as `apiKey`, `modelPresets`, `intervalS`. |
| Environment variable error | `${VAR_NAME}` references are resolved at startup. Set the variable before running nanobot. |
| Edited config but behavior did not change | Restart `nanobot gateway`; long-running processes read config at startup. |
After editing config, check the shortest path to an Agent reply:
```bash
nanobot status
```
To refresh missing defaults without overwriting existing settings, run:
```bash
nanobot onboard --refresh
```
For an interactive choice between resetting and refreshing, run `nanobot onboard` and choose the option that keeps current values and merges missing defaults.
## Provider and Model Problems
Test in the terminal first:
First prove the provider in the CLI:
```bash
nanobot agent -m "Hello!"
```
Compare your setup against [Providers and Models](./providers.md) or grab a working recipe from the [Provider Cookbook](./provider-cookbook.md).
Then compare your config against [`providers.md`](./providers.md).
| Symptom | Likely cause and fix |
If you need a known-good snippet instead of diagnosis, use [`provider-cookbook.md`](./provider-cookbook.md).
| Symptom | Likely cause |
|---|---|
| `401`, unauthorized, or invalid API key | Key is missing, expired, has extra whitespace, or belongs to a different provider |
| Model not found | Model ID is misspelled or unavailable on the selected provider |
| Provider cannot be inferred | Pin the provider explicitly inside your model preset instead of leaving it on `"auto"` |
| Local model connection refused | Start Ollama, vLLM, or LM Studio first and verify `apiBase` points to the right port |
| Bedrock validation error | Verify AWS region, credentials, model access, and that the model supports Converse |
| OAuth login fails | Run `nanobot provider login openai-codex`, `xai-grok`, or `github-copilot` (usually with `--set-main`) |
| OAuth login on a remote/headless machine | Sign in in your local browser; when the `localhost` redirect fails to load, copy the full URL from your browser's address bar and paste it into the WebUI dialog or CLI prompt |
| OAuth login in Docker | Start the container interactively with `docker run -it` |
| Codex or xAI needs a proxy | Set **Settings → Advanced → Shared proxy** (`network.proxy`) and enable **Use proxy** on that provider before signing in |
| Codex rejects an `openai/...` model | Use provider `openai_codex` with a Codex model (e.g. `openai-codex/gpt-5.6-sol`), not a direct API `openai/...` model |
| xAI returns `403` / access denied | Confirm your account has an active X Premium / Grok subscription, then sign in again with `nanobot provider login xai-grok` |
| Codex TLS / certificate error | Check the host's system clock and corporate proxy certificate chain; if your organization uses a private CA, set `SSL_CERT_FILE` (or `SSL_CERT_DIR`) in the gateway environment and restart |
| 401, unauthorized, invalid API key | Key is missing, expired, pasted with whitespace, or under the wrong provider key. |
| Model not found | The model ID belongs to a different provider or gateway. |
| Provider cannot be inferred | Pin `modelPresets.<name>.provider` in the active preset instead of using `"auto"`. For legacy direct configs, pin `agents.defaults.provider`. |
| Local model connection refused | Ollama, vLLM, LM Studio, or another local server is not running, or `apiBase` points to the wrong port. |
| Bedrock validation error | Check AWS region, credentials, model access, model ID, and whether the model supports Converse. |
| OAuth provider fails | Run the matching login command: `openai-codex`, `xai-grok`, or `github-copilot`, normally with `--set-main`. |
| Codex OAuth needs a proxy | Set `providers.openaiCodex.proxy` before running the login command. The proxy applies to login, token refresh, and Codex API requests. |
| Codex login runs on a remote/headless machine | In the WebUI, open ChatGPT in your local browser; when the localhost callback page cannot load, copy the full `http://localhost:1455/auth/callback?...` URL from the address bar and paste it into the WebUI dialog. From the CLI, open the printed URL locally and paste the same callback URL back into the terminal. |
| Codex login runs in Docker | Start the container with `docker run -it` so the OAuth flow has an interactive terminal. |
| Codex says a model is not supported with a ChatGPT account | Use provider `openai_codex` with a Codex model such as `openai-codex/gpt-5.6-sol`. Do not use the direct-API `openai/...` prefix with Codex OAuth. |
| Config says `providers.openai_codex` conflicts with the built-in provider | Under `providers`, keep only the canonical `openaiCodex` settings key and remove a duplicate `openai_codex` key. A model preset's `provider` value remains `openai_codex`. |
| xAI OAuth needs a proxy | Set `providers.xaiGrok.proxy` before login. It applies to OAuth discovery, token exchange/refresh, and Grok subscription requests. |
| xAI login runs on a remote/headless machine | In the WebUI, finish sign-in in your local browser; if the loopback redirect cannot reach the server, copy the final URL from the address bar into the WebUI dialog. From the CLI, run `nanobot provider login xai-grok` interactively, open the printed URL elsewhere, and paste the final callback URL or authorization code when prompted. |
| xAI returns 403 or subscription access denied | Confirm the signed-in account has an eligible X Premium / Grok subscription, then run `nanobot provider login xai-grok` again. This provider does not use an xAI API key or X Developer OAuth. |
| xAI returns 400 `invalid-argument` | Read the bounded `Response body` appended to the provider error. Hosted `x_search` is sent only when xAI's model catalog advertises `supportsBackendSearch`; the model ID `grok-4.5` itself is valid. |
| xAI model or X Search stops working after an upstream release | The integration follows Grok Build's public OAuth/proxy client contract. Update nanobot if xAI changes that contract. |
## Langfuse Problems
Langfuse tracing is optional and controlled by environment variables.
| Symptom | Check |
|---|---|
| `LANGFUSE_SECRET_KEY is set but langfuse is not installed` | Install `langfuse` in the same Python environment that runs nanobot, then restart the process. |
| No traces appear | Set `LANGFUSE_SECRET_KEY`, `LANGFUSE_PUBLIC_KEY`, and `LANGFUSE_BASE_URL` before starting nanobot. |
| Wrong Langfuse project or region | Check that the key pair and `LANGFUSE_BASE_URL` come from the same Langfuse project/region. |
| Only some providers trace | Langfuse tracing applies to OpenAI-compatible provider calls; native providers may not use that client path. |
See [`configuration.md#langfuse-observability`](./configuration.md#langfuse-observability) for setup commands.
## Gateway Problems
`nanobot gateway` powers the WebUI, chat apps, automations, heartbeat, and Dream. Run `nanobot gateway --verbose` to inspect live logs.
`nanobot gateway` is required for WebUI, chat apps, heartbeat, Dream, and long-running channel connections.
Default ports: **WebUI** `http://127.0.0.1:8765` · **Gateway health** `http://127.0.0.1:18790/health`.
Default ports:
| Symptom | Fix |
| Surface | Default |
|---|---|
| Port already in use | Change `gateway.port`, `channels.websocket.port`, or pass `--port` |
| Port `18790` shows no WebUI | Open port `8765`—`18790` is only the health endpoint |
| Config changes ignored | Restart the gateway (`nanobot gateway restart`) |
| Startup pauses at `Installing optional feature` | An enabled chat channel is installing its missing Python dependencies; if PyPI is slow, set `PIP_INDEX_URL` to a trusted mirror |
| Heartbeat never runs | Keep the gateway running, add tasks under `## Active Tasks` in `<workspace>/HEARTBEAT.md`, and verify `gateway.heartbeat.enabled` is `true` |
| Scheduled jobs missing after switching workspaces | Automations are stored per workspace—confirm you are running the intended workspace |
| Gateway health endpoint | `http://127.0.0.1:18790/health` |
| WebUI/WebSocket channel | `http://127.0.0.1:8765` |
| OpenAI-compatible API (`nanobot serve`) | `http://127.0.0.1:8900` |
Common gateway checks:
```bash
nanobot gateway --verbose
```
| Symptom | Check |
|---|---|
| Port already in use | Change `gateway.port`, `channels.websocket.port`, or the `--port` CLI flag for the relevant command. |
| WebUI opened on `18790` but shows nothing useful | Open `8765`; `18790` is the health endpoint. |
| Config changes ignored | Restart the gateway. |
| Startup pauses at `Installing optional feature` | An enabled channel is missing its Python dependencies. See [Slow Optional Channel Dependency Installation](#slow-optional-channel-dependency-installation). |
| Heartbeat never runs | Keep the gateway running, add tasks under `<workspace>/HEARTBEAT.md` -> `## Active Tasks`, and make sure `gateway.heartbeat.enabled` is true. |
| Cron jobs disappeared after switching workspaces | Cron jobs are workspace-scoped at `<workspace>/cron/jobs.json`; check you are using the intended workspace. |
### Slow Optional Channel Dependency Installation
Before loading enabled channels, the gateway checks the dependencies declared by their
channel manifests. The CLI and WebUI normally install these dependencies when a channel is
enabled. Installation during startup is a recovery path for an enabled config whose Python
environment no longer has the required packages, for example after manually editing the
config, upgrading nanobot, or recreating an isolated `uv tool`/`pipx` environment. The
gateway waits for the install so an enabled channel is not silently skipped; later starts
skip the installation once the dependencies are present.
If access to PyPI is slow in your region, configure pip to use a trusted package index. The
installer honors the standard `PIP_INDEX_URL` environment variable, including when nanobot
itself was installed with `uv tool`:
```bash
PIP_INDEX_URL=https://your-trusted-mirror.example/simple nanobot gateway
```
For the systemd user service created by `nanobot gateway install-service`, add a drop-in:
```bash
systemctl --user edit nanobot-gateway.service
```
```ini
[Service]
Environment="PIP_INDEX_URL=https://your-trusted-mirror.example/simple"
```
Then reload and restart the service:
```bash
systemctl --user daemon-reload
systemctl --user restart nanobot-gateway.service
```
For a system-level or custom service, use `sudo systemctl edit <unit>` instead. Prefer an
HTTPS index operated by an organization you trust, and do not put index credentials in
commands or logs.
## WebUI Problems
Run `nanobot webui` to start the gateway and open your browser.
The packaged WebUI is served by the WebSocket channel.
| Symptom | Fix |
Minimal config:
```json
{
"channels": {
"websocket": {
"enabled": true
}
}
}
```
Then run:
```bash
nanobot gateway
```
Open:
```text
http://127.0.0.1:8765
```
If accessing from another device, bind the WebSocket channel to `0.0.0.0` and set `token` or `tokenIssueSecret`. The WebSocket channel refuses public binds without a token or token issue secret.
| Symptom | Check |
|---|---|
| Browser does not sign in | Copy the **complete login link** printed by `nanobot webui` (including everything after `#`)—the bare `http://127.0.0.1:8765` URL will not sign a new browser in |
| Cannot open from another device on LAN | Bind WebSocket `host` to `"0.0.0.0"` and set `tokenIssueSecret` (or `token`); see [LAN Access](./webui.md#lan-access) |
| Temporary chat disappeared after reload | Expected—temporary chats are not saved and end on reload or disconnect; use a regular topic for work you want to keep |
| Settings stay disabled after a restart | Reload the affected browser tab |
| `skills.sh` says `npx` is required | Install Node.js (which includes `npx`) on the gateway machine, or use SkillHub skills instead |
| Remote browser says installs are disabled | Install optional packages or skills from a local WebUI, or explicitly enable `tools.webuiAllowRemotePackageInstall` on trusted private deployments |
| A temporary chat disappeared after a reload or reconnect | This is expected. Temporary chats exist only for the current WebUI connection and are not saved to history or memory. Use a regular topic for anything you need to retain. |
| A skills.sh install says that `npx` is required | Install Node.js with `npx` on the gateway machine, or choose a SkillHub skill that does not require `npx`. |
| A remote browser says skill installation is disabled | Install from a same-machine WebUI. For a private deployment where every authenticated user is trusted to install third-party skill instructions or scripts, explicitly enable `tools.webuiAllowRemotePackageInstall`. |
See [`webui.md#lan-access`](./webui.md#lan-access) for LAN setup and [`../webui/README.md`](../webui/README.md) for frontend development.
## Chat App Problems
First confirm the CLI works and check channel status:
Before debugging a chat app:
```bash
nanobot agent -m "Hello!"
@@ -117,38 +288,53 @@ nanobot channels status
nanobot gateway
```
| Symptom | Fix |
Then check:
| Symptom | Check |
|---|---|
| Bot never replies | Confirm the gateway is running, the channel is enabled, and the bot token/credentials are valid |
| Unknown sender ignored | Approve their pairing code (`/pairing approve <code>`) or add them to `allowFrom` |
| Telegram saves token but live check fails | Confirm the gateway can reach `api.telegram.org`, or configure a shared proxy and enable **Use proxy** in Telegram settings |
| Discord replies missing | Enable **Message Content Intent** in the Discord Developer Portal and verify bot permissions |
| WhatsApp or WeChat login expired | Re-run `nanobot channels login whatsapp` or `nanobot channels login weixin` |
| Bot never replies | Gateway is not running, the channel is not enabled, or the bot/app token is wrong. |
| Unknown sender ignored | Configure `allowFrom`, pairing, or the channel-specific allow list. |
| Telegram shows a saved configuration but cannot complete a live check | The token is saved. Confirm the gateway can reach `api.telegram.org`, or open **Settings → Channels → Telegram → Advanced → Network proxy** and enter an HTTP or SOCKS proxy. |
| Telegram rejects the token | Copy the current token from BotFather or regenerate it. |
| Telegram receives no messages | Confirm the channel is enabled, the gateway is running, and the sender is paired or listed in `allowFrom`. |
| Discord replies missing | Enable Message Content intent and invite the bot with the required permissions. |
| WhatsApp or WeChat login expired | Re-run `nanobot channels login whatsapp` or `nanobot channels login weixin`. |
| Chat app works but WebUI does not | The provider and gateway are likely fine; debug the WebSocket channel separately. |
See [Chat Apps](./chat-apps.md) for platform-specific setup.
See [`chat-apps.md`](./chat-apps.md) for channel-specific setup.
## Tools, Workspace, and Memory Problems
## Tool and Workspace Problems
| Symptom | Fix |
| Symptom | Check |
|---|---|
| File access denied | Check whether the topic is in **Restricted** mode and the file is inside the active workspace |
| Shell commands fail in Docker | Sandbox mode may need extra container capabilities; see [Deployment](./deployment.md) |
| Web fetch blocked | Built-in SSRF protection blocks private/internal URLs; add trusted private hosts to `tools.ssrfWhitelist` only if intended |
| MCP tools missing | Check **Apps → MCP** (or `tools.mcpServers`), startup commands, and required environment variables |
| Memory does not update right away | Dream runs periodically (or when you run `/dream`); recent turns stay in session history until compacted |
| Startup reports session storage overlaps the workspace | Keep `config.json` and `sessions/` outside the workspace folder (e.g. `bot/config.json`, `bot/sessions/`, `bot/workspace/`), stop nanobot, back up both directories, and move config + sessions out of the workspace |
| Sessions disappeared after moving config or workspace | Keep `sessions/` alongside your config directory and keep `.nanobot/workspace-id` inside your workspace when moving or backing up |
| File access denied | Check `tools.restrictToWorkspace` and whether the target path is inside the active workspace. |
| Shell commands fail in Docker | Sandbox settings may need Linux capabilities; see [`deployment.md`](./deployment.md). |
| Web fetch blocked | SSRF protection blocks unsafe targets; use `tools.ssrfWhitelist` only for trusted private networks. |
| MCP tools missing | Check `tools.mcpServers`, server startup command, environment variables, and tool allow list. |
| Generated artifacts are missing | Check the active workspace and channel media directory. |
## Memory and Session Problems
| Symptom | Check |
|---|---|
| Conversation context seems wrong | Confirm the active workspace and session. WebUI chats and chat app threads may use different sessions. |
| Memory does not update immediately | Dream consolidation is periodic; recent turns still live in session history. |
| Sessions disappear after changing `--config` | Sessions follow the config directory at `<config-dir>/sessions/<workspace-id>/`; use the original config path or copy that `sessions/` directory into the new config directory while nanobot is stopped. |
| Sessions disappear after moving a workspace | Keep the workspace's `.nanobot/workspace-id` file with the move or backup. If it was lost, restore that marker from backup before starting nanobot. |
| You want one shared session across devices | Set `agents.defaults.unifiedSession` intentionally; otherwise keep separate sessions. |
## Collect Useful Evidence
When opening an issue or asking for help, include:
- Your OS, Python version, install method, and `nanobot --version`.
- The exact command you ran and the exact error message.
- `nanobot status` output and whether `nanobot agent -m "Hello!"` works.
- Relevant `nanobot gateway --verbose` logs and sanitized config snippets.
- install method and `nanobot --version`;
- operating system and Python version;
- the command you ran;
- relevant `nanobot status` output;
- sanitized config snippets, especially provider, model, channel, and tool settings;
- gateway logs from `nanobot gateway --verbose`;
- whether `nanobot agent -m "Hello!"` works.
> [!CAUTION]
> Always remove real API keys, bot tokens, OAuth tokens, passwords, and private chat IDs before posting logs or configs.
Never paste real API keys, bot tokens, OAuth tokens, or private chat IDs into public issues.
Found a doc error or confusing step? Please [open an issue](https://github.com/HKUDS/nanobot/issues).
If you find a docs mistake, outdated command, or confusing step, please open an issue: <https://github.com/HKUDS/nanobot/issues>.
-88
View File
@@ -1,88 +0,0 @@
# Update protocol
This document is for gateway, client and updater maintainers. For installation choices, WebUI steps and recovery commands, see the [user update guide](updating.md). Release approval, catalogue and artifact schemas belong to the [release contract](releasing.md).
## Ownership and approval boundaries
The gateway owns policy, installation inspection and durable update state; clients present reviews and explicit consent. Reviewing a release, preparing files, approving shutdown, admitting package mutation and activating a gateway are separate decisions. None can be inferred from another's progress, a lost response or elapsed time.
An [immutable plan](../nanobot/update_plan.py) binds an exact release artifact to the interpreter/environment snapshot, ownership receipts, extras, channel revision and known gateway profiles. Its lifetime is at most fifteen minutes. Preparation and shutdown preflight revalidate that target, never substitute a new latest version. Changed environment metadata, ownership, profiles, channel revision, expiry or release eligibility blocks progress. Planning and preflight share the installation's `releases` history: catalogue rollback or changed contents under the same generation must not become acceptable through a fresh per-job cache. A network failure is not a fresh successful check. See [release discovery](../nanobot/release_feed.py) and the [release contract](releasing.md) for approval and download rules.
[Manager policy](../nanobot/update_manager.py) comes from the owner's receipt, not dependency-based guesses. Its hash binds the complete private settings; the review uses a credential-free summary of extras, constraints, source, pins/locks and additional package names. An absent `owner_restriction` is not execution eligibility. Supported pipx receipt schemas are `0.5` and `0.12`; reading them does not enable pipx execution or newer manager flags. The native uv transaction is limited to compatible POSIX uv `0.11.16` registry tools and preserves receipt policy. Unfrozen external resolver policy requires the owner's workflow. A plain-venv transaction requires explicit extras, including `[]` for the base package; installer- or manager-recorded extras cannot be replaced by a client.
## Client interface
Capabilities are optional additions to the [WebUI contract](../nanobot/webui/client_contract.py), not package-version comparisons or a higher protocol floor. Action names below have the prefix `settings.nanobot.update.`; read paths have the prefix `/api/settings/nanobot-update/`.
| Capability | Interface |
| --- | --- |
| `webui.update-plans.v1` | `plan`; `GET plan?id=<id>` |
| `webui.update-jobs.read.v1` | `GET job?id=<id>` |
| `webui.update-jobs.prepare.v1` | `prepare`, `settle` for interrupted preparation |
| `webui.update-jobs.execute.v1` | `execute` |
| `webui.update-jobs.retry-handoff.v1` | `retry` |
| `webui.update-jobs.settle-handoff.v1` | `settle` also retires inactive, uncommitted handoffs |
| `webui.update-channels.v1` | `channel` with the saved revision |
| `webui.update-flow.v1` | Client flow using review, preparation, execution and reconnection |
All routes require authentication. Actions require an authenticated WebSocket; plain HTTP cannot create plans or mutate jobs. Preparation, settlement, execution, retry and channel changes also require the existing local-browser or explicit remote package-install permission and runtime admission checks. Review does not require installation permission. Desktop's native surface retains its distributor's updater. [Transport routing](../nanobot/webui/settings_routes.py) and the [settings handler](../nanobot/webui/settings_system.py) own these checks; update responses are `no-store`.
`plan` accepts only `channel`, `restart_running` (default `false`) and optional `extras`. The default channel is the installation preference, or Stable when absent. It cannot accept a download URL, command, environment path or caller-supplied plan. `restart_running=true` selects known running background gateways with explicit lifetime and cooperative shutdown support, not stopped profiles or unknown supervisors. Inline eligibility requires the requesting gateway and every running peer in the reviewed stop/restart selection, with no unconfirmed owner.
The review separates `installation_allowed` (caller policy) from `execution_available` and `execution_blocked_reason` (exact-plan eligibility). Neither authorizes execution. `validity` is a local snapshot result: `current`, `expired`, `installation_changed`, `profiles_changed` or `channel_changed`. Reading a saved review can inspect the current installation and profiles, but does not contact the release feed or choose another target.
Job actions use `id`; execution additionally requires `confirm_restart: true`, and retry requires `previous_confirmation_id`. A job read returns durable facts including `recorded_phase`, `attempt`, `mutation_started`, `updated_at` and `execution_confirmation_id`, not worker liveness or permission to retry. Missing jobs return 404, invalid identifiers 400, and corrupt or misbound records 409. Reads do not start the installation's Python, contact release services or take its runtime lease; an active writer or incomplete-install marker does not hide history. Environment-path scoping can retain history after a reinstall, but does not authorize resuming the predecessor's job. Raw logs, resolver credentials and diagnostic messages are not exposed. Recovery flags distinguish automatic recovery selection, supervisor ownership and restored service. A returned recovery command is display-only.
[Record publication](../nanobot/utils/atomic_file.py) is atomic, never delete-then-copy. Windows snapshot readers share deletion so polling can coexist with POSIX-style replacement on supported filesystems. Sharing and permission failures remain errors, not permission to publish partial records.
Channel changes use revision checks, invalidate old reviews and retire only safely settled inactive jobs. They never install, downgrade or discard active work. Consumers recover lost preparation/execution responses by reading the same job; a missing journal or transport timeout alone is not authority to submit a replacement operation.
## Preparation leases and settlement
[Preparation](../nanobot/update_jobs.py) saves the immutable plan and a preparation journal before native inspection or resolution. It compares fresh environment metadata before and after staging, verifies the exact nanobot wheel and stages the resolved dependency transaction without changing installed files. Pip preparation retains its configured package-source trust policy; credential-bearing resolver files remain private and temporary. There is no source-build or global-manager fallback. For uv, a sealed private preparation cache and recorded dependency versions bind the offline transaction without rewriting the shared cache or saved policy.
The frozen worker and helpers are standard-library-only and stored outside the installation. [Preparation children](../nanobot/update_process.py) start with `-I -S`, acquire their own runtime and native-preparation leases, validate the preparation generation, then initialize the target's site. Those leases cover `.pth`/site hooks, the actual probe or pip command and `atexit` cleanup, even if the parent disappears. Python commands run in the lease-owning process on POSIX and Windows. Native uv uses POSIX `exec` with retained descriptors; inherited handles do not transfer Windows byte-range lock ownership. Failed `exec` restores descriptor inheritance flags. These leases do not contain arbitrary descendants spawned by custom hooks.
Cancellation does not release preparation ownership until native work actually returns. An orphan native child blocks another preparation and coordinated shutdown. A `preparing` record alone proves neither liveness nor completion. Settlement requires both parent and native preparation leases, revokes that generation and records `preparation_failed`; it neither deletes staging nor starts an install. Late children from the revoked generation cannot run. Older parent-only lease records cannot establish this proof. Retrying preparation must retain the same immutable plan; changed consent needs a new ID.
The immutable `request.json`, written after inputs and initial status are flushed, is the preparation commit record. A `ready` journal alone is insufficient. Preparation grants no package-mutation authority.
## Confirmation generations and offline execution
The [job service](../nanobot/update_service.py) persists execution confirmation before launching a detached owner. Each confirmation may claim the operation once. Replaying execute, repeating a retry or presenting a stale predecessor returns history, not another attempt. Explicit retry replaces exactly `previous_confirmation_id` while worker and preflight leases are free; delayed launchers with the replaced confirmation cannot start. The original target, artifacts, plan expiry, release checks and selected runtime identities still apply. Retry cannot extend the review or repair mutation.
Confirmation identity and expiry are separate checks. Launch consent is short-lived and bound to the immutable request. Under its lease, the supervisor validates that identity before publishing even its first journal or launching work. Completion and bounded recovery, including restoration, retain the same identity without reapplying the launch-window expiry. Fresh local repair can renew approval only for an already admitted exact job, not prepared files alone; it rechecks inputs and environment, preserves and verifies the original backup once created, and never resolves or downloads a release.
The [offline worker](../nanobot/update_worker.py) uses the base Python with `-I -S`. Its actual installer child owns exclusive installation/data leases before target site initialization and rechecks ownership, environment, inputs and approval before mutation. Pip's CLI runs in that same single-use Python process on both POSIX and Windows, retaining locks through exit cleanup. It accepts only staged wheels with network resolution, builds and destination/configuration overrides disabled. Native uv retains its leases through POSIX `exec` and applies the sealed transaction offline.
A pending-install fence and data reservation survive interrupted mutation. Repair cannot overwrite unrelated package changes or a different target installed by another updater. Restart-phase recovery retries restart, not installation. Installed-package verification uses a separately lease-owning child and a completion checkpoint: the target must import from the correct environment, application files including bundled assets must match the wheel, and dependency checks must pass. Without restart participants the result is `installed`, not a verified running gateway.
## Shutdown and maintenance
[Installation leases](../nanobot/installation_lock.py) are account-scoped by the real environment path, independent of profile home and symlink aliases. Cooperating runtimes hold shared OS locks; mutation needs exclusive access. Lock files must never be removed or replaced: a PID file is not ownership. Ordinary startup refuses an active updater or pending-install fence. These leases do not discover older runtimes, arbitrary imports, other accounts or external supervisors.
The detached owner's [old-runtime preflight](../nanobot/update_handoff.py) owns a shared lease before application imports, revalidates the exact release using shared release history, closes the release client and requests [cooperative shutdown](../nanobot/update_stop.py). Every selected gateway must hold its idle admission gate before any stop is committed. Refusal before commit reopens intake; a durable commit is irrevocable and is not undone by a later failure. The owner waits for actual gateway and preflight process exit, not inactive receipts, before acquiring exclusive installation/data leases and admitting installation. Shutdown consent alone is not mutation approval.
[Runtime admission](../nanobot/runtime_admission.py) accounts for accepted and detached work through cleanup without cancelling active tasks. Channel setup and provider sign-in owners must stay busy until native workers, callbacks and cleanup actually exit; cancelling an awaiter, expiring a flow or returning a QR/browser response does not establish idle. Failed cleanup retains ownership for retry. See the [connector lifecycle](../nanobot/channels/connect.py) and [sign-in registry](../nanobot/webui/settings_services.py). A loaded connector without that lifecycle cannot claim coordinated-update idleness.
Handoff settlement requires free worker, preflight and stop-coordinator leases and refuses committed shutdown, installation admission or mutation. It records `cancelled` without deleting saved files or launching work; repeated settlement is safe. An uncertain response is resolved by reading the old job.
## Data protection and protected restart
[Profile receipts](../nanobot/update_profiles.py) preserve known stopped profiles for backup and retain original launch selectors, paths and process/run identities, not configuration contents or arbitrary environment variables. A PID alone is not liveness. A new run, changed inventory or unconfirmed owner invalidates review; inventory does not authorize stopping a supervisor or starting a previously stopped profile.
[Data leases](../nanobot/data_access.py) protect overlapping named stores even across cooperating Python installations. Reservations bind the exact job and scope across crashes. [Backups](../nanobot/update_backup.py) cover recorded nanobot stores and required receipts, not entire homes, arbitrary projects or external services. Redirected paths, symlinks/reparse points, special files, changing data or insufficient space block backup. The original backup is verified and retained across retries, never replaced by post-mutation data. Automatic data rollback is unavailable.
[Protected restart](../nanobot/update_restart.py) launches only reviewed participants through lease-owning frozen entrypoints using their saved selectors. A startup grant permits initialization of one participant's exact reserved data scope, not agent/tool/scheduler work or broader paths; its bearer is removed before normal runtime configuration. Grants cannot expand an older updater's reservation. For protocol-1 grants predating the lazy delivery store, that store takes an ordinary lease and cannot initialize, migrate or write before activation.
Gateways remain in maintenance until their actual run identities, target versions and readiness are verified. Durable activation names those exact runs; a generic HTTP success or receipt is insufficient. Verification after intake opens precedes fence/reservation cleanup and `succeeded`. A crash during finalization resumes cleanup only, not reinstall or activation. Clients additionally require authenticated reconnection to the target-running gateway before reporting update completion.
The optional macOS Dock helper belongs to the gateway, starts only after activation and exits when its owner stops. It holds no installation/data lease and is not loaded by the frozen updater or recovery supervisor. Its instance-scoped visibility intent survives reviewed restart/recovery; the helper does not own update execution or completion.
## Recovery and compatibility limits
For installer-owned dedicated venvs with selected background participants, [automatic recovery](../nanobot/update_fallback.py) preserves a verified sibling program/dependency snapshot before mutation. An independent supervisor can try the already admitted exact target once, then restore only the original program before candidate activation and only if protected user-file contents still match the original backup. Backup failure before mutation can restart the intact original program. Restoration uses journaled same-filesystem renames, retains the failed generation and replays one transient filesystem failure; duplicate launches do not gain another recovery budget.
Restored service is not update success: the wire result remains `failed` for older clients and adds `service_restored`. Successful upgrades may remove their redundant program snapshot but retain the data backup. Changed data or durable activation forbids older-program restoration; only same-target completion remains safe. Corrupt snapshots, changed ownership, persistent filesystem faults, missing base Python or loss of both supervisor and worker can require operator recovery. This is neither malware remediation nor an OS boot-time recovery service.
Compatibility is explicit, not inferred from versions. Protocol 1 covers worker request schema 4, frozen `-I -S` startup with child-owned installation leases, scoped data-startup grants and activation bound to the exact restarted run. The target must declare a supported protected-handoff contract; see [release compatibility](releasing.md#protected-updater-handoff-compatibility) for its schema and publication requirements. External managers, unsupported layouts and older jobs are not silently adopted. Hosts without settlement/retry capabilities retain their existing status/recovery route rather than accepting unsupported actions. The [standalone launcher](../nanobot/update_recovery.py) uses the saved worker and original base Python independently of a broken application environment; user commands and operational limits remain in the [update guide](updating.md).
-111
View File
@@ -1,111 +0,0 @@
# Updating nanobot
Always update nanobot using the same method you used to install it. Do not switch package managers to work around an error.
## Update from the WebUI
1. Click the update notice in the sidebar, or open **Settings → About → Update** (opening the dialog only checks for updates—it does not install or restart anything).
2. Review the target version and affected gateways. Active tasks must finish before shutdown.
3. Click **Update & restart**. nanobot downloads and verifies the release, backs up affected profiles, installs the update, and restarts your background gateways (not your computer or browser).
4. Wait for **Update complete**, then click **Done** to reload the interface.
In-app updates work for official-installer environments and supported `uv` tool installations running a background gateway. Other install methods display exact copy-and-run update commands in the dialog. Remote browsers require explicit package-install permission on the gateway.
> [!NOTE]
> Automatic updates verify official release checksums before installing. If verification fails, stay on your current version, retry later, and report persistent errors rather than bypassing verification.
## Stable and Preview
**Settings → About → Receive preview updates** is off by default. Turn it on if you want early access to new features (with a higher risk of bugs). It never downloads or installs updates automatically.
Turning it back off returns you to stable updates without downgrading—if your Preview build is newer than the latest stable release, nanobot stays on it until a newer stable release arrives.
## Installation Owners
When in-app updating is unavailable, update on the **gateway computer** using the original installation method:
| Installation method | How to update |
|---|---|
| Official installer | Use WebUI **Update & restart** |
| `uv` tool | Use WebUI **Update & restart**, or run `uv tool upgrade nanobot-ai` in the original environment |
| `pipx` | Run `pipx upgrade nanobot-ai` (preserve any custom options or injected packages) |
| Python virtual environment (`pip`) | Run `nanobot update` or `<venv-python> -m pip install --upgrade nanobot-ai` (include any extras you originally installed) |
| Source checkout | Pull the latest branch in Git, preserve local changes, and follow [`CONTRIBUTING.md`](../CONTRIBUTING.md) |
| Docker / Compose | Pull or rebuild the image and recreate the service with your existing data volumes |
For manual updates: stop nanobot, back up your config and workspace, run the update, restart, and verify the running version in **Settings → About** or `nanobot --version`.
## Recover an Interrupted Update
Closing or refreshing your browser does not stop an in-progress update. If your connection drops, wait for it to reconnect and check status with **Check again**—do not start a second update while one is already running.
For official-installer environments, nanobot keeps a backup of the previous program before modifying packages. If installation fails, automatic recovery retries once or restores the previous version (without touching your config or conversations) and reports **Previous version restored**.
### Standalone recovery
If automatic recovery fails, the WebUI displays a repair command with the saved job ID. Run it on the **gateway computer** as the original user (it only requires your base Python 3.11+):
**macOS / Linux**
```sh
python3 -I -S ~/.nanobot/updates/recover.py <job-id>
python3 -I -S ~/.nanobot/updates/recover.py <job-id> --repair
```
**Windows PowerShell**
```powershell
python -I -S "$env:USERPROFILE\.nanobot\updates\recover.py" <job-id>
python -I -S "$env:USERPROFILE\.nanobot\updates\recover.py" <job-id> --repair
```
The first command inspects the saved job; `--repair` verifies the files and asks for confirmation before repairing (add `--yes` to skip the prompt).
### Explicit recovery before package mutation
<details>
<summary>CLI plan inspection and pre-install retry</summary>
To inspect an update plan from the CLI without installing anything (plans expire after 15 minutes):
```bash
nanobot update --plan
nanobot update --plan --channel preview
```
If an update failed during shutdown **before** packages were modified, you can inspect and retry the saved job:
```bash
nanobot update --job <plan-id>
nanobot update --job <plan-id> --retry-handoff \
--previous-confirmation <execution-confirmation-id> --confirm-restart
```
If packages were already partially changed, use [Standalone recovery](#standalone-recovery) instead.
</details>
## Version Migration Notes
<details>
<summary>Upgrading from older JSONL installations (pre-0.4)</summary>
0.4.x releases automatically import legacy JSONL chat history and per-feature proxy settings; these importers are scheduled for removal in 0.5.0.
1. Stop nanobot and back up your complete config directory and workspace.
2. Upgrade to 0.4.x using your original installation method.
3. Start nanobot, verify your conversations and shared proxy settings, and confirm a restart works cleanly before eventually upgrading to 0.5.0.
</details>
### Standalone API service removal
<details>
<summary>Notes if you previously used <code>nanobot serve</code> or shared sessions</summary>
- **`nanobot serve` removed:** The standalone OpenAI-compatible `/v1` HTTP server (`nanobot serve` and the `nanobot-api` Compose service) has been removed. The Gateway, WebUI, Python SDK, and OpenAI-compatible model connections remain supported. Stop any old `nanobot serve` process or `nanobot-api` container before upgrading. Old `api` config blocks are ignored, and old API sessions (`api:...`) remain readable via [the Python SDK](./python-sdk.md#botsessions).
- **Shared sessions removed:** `agents.defaults.unifiedSession` is no longer supported and is ignored.
</details>
For contributor details on the update protocol, see [Update protocol](./update-protocol.md).
+60 -104
View File
@@ -16,9 +16,8 @@ Nanobot can act as a WebSocket server, allowing external clients (web apps, CLIs
### 1. Configure
For normal browser setup, run `nanobot webui`; the launcher prepares the local channel and opens the WebUI. Configure models in **Settings → Models**. The listener and protocol fields below are for custom clients and deployments and have no graphical editor.
The WebSocket channel is enabled by default. Add only the fields you want to override under `channels.websocket`:
The WebSocket channel is enabled by default. Add only the fields you want to
override under `channels.websocket`:
```json
{
@@ -27,7 +26,6 @@ The WebSocket channel is enabled by default. Add only the fields you want to ove
"host": "127.0.0.1",
"port": 8765,
"path": "/",
"tokenIssuePath": "/auth/token",
"tokenIssueSecret": "your-webui-password",
"websocketRequiresToken": true,
"allowFrom": ["*"],
@@ -37,58 +35,34 @@ The WebSocket channel is enabled by default. Add only the fields you want to ove
}
```
### 2. Apply the configuration
Replace `your-webui-password` with a private secret before using the configuration. Restart the gateway that owns this config if it is already running. If none is running, start it with the same installation and config:
### 2. Start nanobot
```bash
nanobot gateway
```
Keep it running while connecting clients from another terminal.
You should see:
### 3. Obtain a token and connect
The secret above authorizes token issuance; it is not itself an issued connection token. Each WebSocket connection needs a new single-use token. Choose either client below. Both use the `/auth/token` path configured in step 1.
With `curl` and `websocat` installed:
```bash
# Replace the example secret with the value saved in your config.
curl --fail -H "Authorization: Bearer your-webui-password" http://127.0.0.1:8765/auth/token
# Copy the returned token into the URL; keep the whole URL quoted.
websocat "ws://127.0.0.1:8765/?client_id=alice&token=TOKEN_FROM_RESPONSE"
```text
WebSocket server listening on ws://127.0.0.1:8765/
```
After the `ready` event, send `{"content":"Hello nanobot!"}`. Obtain another token before reconnecting. Do not share the secret or the token URL.
### 3. Connect a client
Alternatively, save and run this Python example in an environment with `websockets` installed. It asks for the configured secret, obtains its own token, and prints server events until you press Ctrl+C:
```python
import asyncio
import json
from getpass import getpass
from urllib.parse import urlencode
from urllib.request import Request, urlopen
import websockets
request = Request(
"http://127.0.0.1:8765/auth/token",
headers={"Authorization": "Bearer " + getpass("WebSocket token-issue secret: ")},
)
with urlopen(request, timeout=10) as response:
token = json.load(response)["token"]
```bash
# Using websocat
websocat ws://127.0.0.1:8765/?client_id=alice
# Using Python
import asyncio, json, websockets
async def main():
query = urlencode({"client_id": "alice", "token": token})
async with websockets.connect("ws://127.0.0.1:8765/?" + query) as ws:
print(json.loads(await ws.recv())) # ready event
async with websockets.connect("ws://127.0.0.1:8765/?client_id=alice") as ws:
ready = json.loads(await ws.recv())
print(ready) # {"event": "ready", "chat_id": "...", "client_id": "alice"}
await ws.send(json.dumps({"content": "Hello nanobot!"}))
async for frame in ws:
print(json.loads(frame))
reply = json.loads(await ws.recv())
print(reply["text"])
asyncio.run(main())
```
@@ -178,7 +152,8 @@ All frames are JSON text. Each message has an `event` field.
Reasoning frames only flow when the channel's `showReasoning` is `true` (default) and the model returns reasoning content (DeepSeek-R1 / Kimi / MiMo / OpenAI reasoning models, Anthropic extended thinking, or inline `<think>` / `<thought>` tags). Models without reasoning produce zero `reasoning_delta` frames.
**`runtime_model_updated`** — broadcast when the gateway default runtime changes or when a config reload requires clients to refresh their model catalog:
**`runtime_model_updated`** — broadcast when the gateway default runtime changes or
when a config reload requires clients to refresh their model catalog:
```json
{
@@ -188,17 +163,12 @@ Reasoning frames only flow when the channel's `showReasoning` is `true` (default
}
```
`model_preset` is omitted when no named preset is active. WebUI clients use this event to refresh model settings after default-runtime and config changes. `/model <preset>` is session-scoped; its selection is reflected through `session_updated` and the session row's `model_preset` field instead of this global event.
`model_preset` is omitted when no named preset is active. WebUI clients use this event
to refresh model settings after default-runtime and config changes. `/model <preset>`
is session-scoped; its selection is reflected through `session_updated` and the
session row's `model_preset` field instead of this global event.
**`pairing_changed`** — sent only to authenticated WebUI connections after an in-process pairing change:
```json
{"event":"pairing_changed"}
```
The event contains no pairing codes or account data. Read the current state from `GET /api/settings/pairing`; notifications are not replayed, so read a fresh snapshot on initial connection and reconnect. Existing polling continues to discover changes made by another process and expired requests. Approval, denial and authentication checks are unchanged.
**`attached`** — confirmation for `new_chat`, `new_temporary_chat`, `fork_chat`, or `attach` inbound envelopes (see [Multi-chat multiplexing](#multi-chat-multiplexing)):
**`attached`** — confirmation for `new_chat` / `attach` inbound envelopes (see [Multi-chat multiplexing](#multi-chat-multiplexing)):
```json
{"event": "attached", "chat_id": "uuid-v4"}
@@ -228,50 +198,15 @@ Recognized fields: `content`, `text`, `message` (checked in that order). Invalid
| `type` | Fields | Effect |
|--------|--------|--------|
| `new_chat` | Optional `workspace_scope`, `request_id` | Server mints a new `chat_id`, subscribes this connection, replies with `attached`. |
| `new_temporary_chat` | Optional `request_id` | Authenticated WebUI only; creates a connection-owned temporary chat and replies with `attached` and `temporary: true`. |
| `fork_chat` | `source_chat_id`, `before_user_index`; optional `title`, `request_id` | Creates and attaches a non-destructive fork before the selected user message. |
| `new_chat` | — | Server mints a new `chat_id`, subscribes this connection, replies with `attached`. |
| `attach` | `chat_id` | Subscribe to an existing `chat_id` (e.g. after a page reload). Replies with `attached`. |
| `message` | `chat_id`, `content` | Send `content` on `chat_id`. First use auto-attaches; no explicit `attach` needed. |
See [Multi-chat multiplexing](#multi-chat-multiplexing) for the full flow.
### Chat-request correlation
WebUI sends a `request_id` with every `new_chat`, `new_temporary_chat`, and `fork_chat`; the gateway echoes it on `attached` and expected `error` responses. IDs must match `[A-Za-z0-9._:-]{1,128}`; malformed IDs are rejected before creation. The shared WebSocket API also accepts requests without IDs for callers such as the TUI; those responses have no `request_id`.
Clients must correlate tagged responses by ID, not by arrival order or the temporary-chat flag. Ordinary `attach` replies cannot complete a creation request. IDs provide correlation, not deduplication: a sent request that times out has an unknown outcome and must not be automatically replayed. Expired unsent requests must be removed before reconnecting.
For authenticated WebUI `attach` requests, `attached.live_turn_ids` lists all named owners in the session that are still queued or running when the gateway acknowledges the subscription. An empty list explicitly reports no named owners. It can retire previously observed owners after reconnect, but does not confirm a new submission, report a turn outcome, or say that the paginated transcript is complete.
A timeout ends the client's pending request, allowing a new user-initiated request with a different ID. A late response cannot complete that newer request. Late temporary-chat creations are discarded rather than selected.
Support and testing cover same-version WebUI/gateway combinations. Cross-version combinations may work, but a passing protocol check does not guarantee all features work; align versions first when troubleshooting. See [Versions and updating the right machine](guides/remote-instances.md#versions-and-updating-the-right-machine).
### Binary attachments (WebUI and TUI)
The gateway advertises `webui.attachments.binary.v1`. WebUI protocol 1 and the terminal protocol are unchanged. Bundled clients and their gateway use HTTP on the same listener for attachment uploads. After an authorized handshake, `ready` includes an `upload` object with `path: "/api/attachments"` and an opaque `token`. This token is a short-lived capability tied to that live connection, not the one-time handshake token, API token, or client-selected `client_id`.
1. `POST` the raw file bytes to the advertised path with `Authorization: Bearer <upload token>`, the file's `Content-Type`, and an exact `Content-Length`. `X-Attachment-Name` may contain a percent-encoded display filename. Compressed request bodies and chunked transfer encoding are rejected.
2. The response is `201 {"reference": "<opaque reference>"}`. Use it in a small WebSocket envelope, for example:
```json
{"type":"message","chat_id":"chat-id","content":"Inspect this","webui":true,"turn_id":"unique-turn-id","media":[{"reference":"opaque-reference","name":"report.pdf"}]}
```
3. Retain the draft and local preview until `message_accepted` confirms the turn. A connection close before confirmation means delivery is uncertain, not that the draft should be discarded. Reconnect obtains a new upload capability; old uncommitted references cannot be used by the new connection. A repeated accepted `(chat_id, turn_id)` is acknowledged without another dispatch within the gateway's bounded ten-minute in-memory retry window.
The upload path accepts the existing image, document, and video MIME whitelist. Existing file/count/total limits still apply independently of `maxMessageBytes`. Uploads time out after five minutes, or after 30 seconds without receiving more data. Uploads are not resumable, so a retry sends the whole file.
Update WebUI and TUI together with the gateway. Existing messages and attachments remain available without a history migration. Clients must use HTTP uploads; `media.data_url` message uploads are no longer accepted. Local previews and the separate audio transcription protocol are unchanged.
Reverse proxies must forward `POST /api/attachments` (including its authorization header) to the gateway and permit the configured file sizes. Same-origin browser uploads include origin cookies for edge authentication; cross-origin uploads do not send cookies. Do not enable public CORS for this capability endpoint.
For a remote host opened through the local WebUI, update the local installation and the remote gateway together to use binary attachments. An older host's text chats and HTTP reads remain available.
## Configuration Reference
All fields go under `channels.websocket` in `config.json`. Unrecognized options retain the existing behavior: they are ignored without preventing startup. Active options below remain validated.
All fields go under `channels.websocket` in `config.json`.
### Connection
@@ -282,7 +217,7 @@ All fields go under `channels.websocket` in `config.json`. Unrecognized options
| `port` | int | `8765` | Listen port. |
| `path` | string | `"/"` | WebSocket upgrade path. Trailing slashes are normalized (root `/` is preserved). |
| `publicWsUrl` | string | `""` | Exact public `ws://` or `wss://` endpoint returned by `/webui/bootstrap`. Set this when a reverse proxy forwards requests with an origin `Host` header (for example, `wss://claw.example.com/`); its path must match `path`. |
| `maxMessageBytes` | int | `37748736` | Maximum inbound WebSocket frame size in bytes (1 KB – 40 MB). The existing 36 MB default is retained. HTTP binary attachments do not count toward this limit; a legacy 1 MB setting no longer prevents larger attachments from being sent. |
| `maxMessageBytes` | int | `37748736` | Maximum inbound message size in bytes (1 KB – 40 MB). Default (36 MB) is sized to accept up to 4 base64-encoded image attachments at 8 MB each; lower it if the channel only carries text. |
### Authentication
@@ -339,17 +274,37 @@ For production deployments where `websocketRequiresToken: true`, use short-lived
3. Client opens WebSocket with `?token=nbwt_aBcDeFg...&client_id=...`.
4. The token is consumed (single use) and cannot be reused.
The embedded WebUI's `/webui/bootstrap` route returns a WebSocket token and REST `api_token` for local or secret-authenticated requests. When `trustedProxyAuth` authenticates the direct proxy peer, it returns connection metadata only: no bootstrap token, no REST API token, and no token query parameter is required for the WebSocket handshake or subsequent REST requests.
The embedded WebUI's `/webui/bootstrap` route returns a WebSocket token and
REST `api_token` for local or secret-authenticated requests. When
`trustedProxyAuth` authenticates the direct proxy peer, it returns connection
metadata only: no bootstrap token, no REST API token, and no token query
parameter is required for the WebSocket handshake or subsequent REST requests.
### Trusted proxy no-token bootstrap
`trustedProxyAuth` is an opt-in alternative for deployments where an identity-aware reverse proxy authenticates the user before connecting to nanobot. The proxy assertion becomes the authentication boundary for the entire WebUI surface: `/webui/bootstrap`, the WebSocket handshake, and REST API routes. Bootstrap is accepted only when **both** the direct TCP peer matches one of `trustedPeerCidrs` and the configured assertion header is present and non-empty. A trusted address by itself is never sufficient.
`trustedProxyAuth` is an opt-in alternative for deployments where an
identity-aware reverse proxy authenticates the user before connecting to nanobot.
The proxy assertion becomes the authentication boundary for the entire WebUI
surface: `/webui/bootstrap`, the WebSocket handshake, and REST API routes.
Bootstrap is accepted only when **both** the direct TCP peer matches one of
`trustedPeerCidrs` and the configured assertion header is present and non-empty.
A trusted address by itself is never sufficient.
Nanobot deliberately uses only `connection.remote_address` for the peer check. It never uses `X-Forwarded-For`, `Forwarded`, `X-Real-IP`, `CF-Connecting-IP`, or `X-Forwarded-Host` to decide whether the proxy is trusted. Nanobot trusts the assertion supplied by the explicitly trusted peer, but does not cryptographically validate or interpret the JWT/assertion contents. Do not enable this option if untrusted clients can connect directly to the nanobot listener.
Nanobot deliberately uses only `connection.remote_address` for the peer check.
It never uses `X-Forwarded-For`, `Forwarded`, `X-Real-IP`, `CF-Connecting-IP`,
or `X-Forwarded-Host` to decide whether the proxy is trusted. Nanobot trusts the
assertion supplied by the explicitly trusted peer, but does not cryptographically
validate or interpret the JWT/assertion contents. Do not enable this option if
untrusted clients can connect directly to the nanobot listener.
The configured assertion header must be a proxy-generated authentication assertion, not a routing or client metadata header. Headers such as `Host`, `Forwarded`, `X-Forwarded-*`, `X-Real-IP`, and `CF-Connecting-IP` are rejected by configuration; use the identity provider's post-authentication assertion header instead (for example, `Cf-Access-Jwt-Assertion`).
The configured assertion header must be a proxy-generated authentication
assertion, not a routing or client metadata header. Headers such as `Host`,
`Forwarded`, `X-Forwarded-*`, `X-Real-IP`, and `CF-Connecting-IP` are rejected
by configuration; use the identity provider's post-authentication assertion
header instead (for example, `Cf-Access-Jwt-Assertion`).
For example, a local Cloudflare Tunnel with Cloudflare Access can validate the user at the edge and forward the resulting `Cf-Access-Jwt-Assertion`:
For example, a local Cloudflare Tunnel with Cloudflare Access can validate the
user at the edge and forward the resulting `Cf-Access-Jwt-Assertion`:
```json
{
@@ -366,7 +321,10 @@ For example, a local Cloudflare Tunnel with Cloudflare Access can validate the u
}
```
This works only when the directly connected `cloudflared` process reaches nanobot over the configured loopback address and supplies a non-empty assertion. Keep nanobot firewalled from untrusted clients; this configuration is not a CIDR-based bootstrap bypass.
This works only when the directly connected `cloudflared` process reaches
nanobot over the configured loopback address and supplies a non-empty assertion.
Keep nanobot firewalled from untrusted clients; this configuration is not a
CIDR-based bootstrap bypass.
### Example setup
@@ -443,7 +401,7 @@ Legacy clients that only send plain text or `{"content": ...}` keep working unch
### Security boundary
`chat_id` is a *capability*: anyone holding a valid WebSocket auth credential and the chat_id can attach to that conversation and see its output. This is safe for nanobot's local, single-user model. Namespacing chat IDs alone does not enforce ownership. An application serving multiple users must authorize access before forwarding requests; separate instances and appropriate host permissions are needed when workspace files, memory, and tools must also be isolated. Nanobot does not provide per-user WebSocket authorization.
`chat_id` is a *capability*: anyone holding a valid WebSocket auth credential and the chat_id can attach to that conversation and see its output. This is safe for nanobot's local, single-user model. Multi-tenant deployments should namespace chat_ids per user (or introduce a per-tenant auth gate) — nanobot does not do this today.
## Security Notes
@@ -451,7 +409,7 @@ Legacy clients that only send plain text or `{"content": ...}` keep working unch
- **Defense in depth**: `allowFrom` is checked at both the HTTP handshake level and the message level.
- **chat_id as capability**: see [Multi-chat multiplexing](#multi-chat-multiplexing). Auth on the WebSocket handshake is the single line of defense; callers who pass it can attach to any chat_id they know.
- **TLS enforcement**: When SSL is enabled, TLSv1.2 is the minimum allowed version.
- **Default-secure**: `websocketRequiresToken` defaults to `true`. Use `false` only for deliberate loopback-only development without authentication, as shown below.
- **Default-secure**: `websocketRequiresToken` defaults to `true`. Explicitly set it to `false` only on trusted networks.
## Media Files
@@ -462,15 +420,13 @@ Outbound `message` events may include a `media` field containing local filesyste
## Common Patterns
### Loopback-only development (no auth)
Use this only for local clients on the same trusted machine, without forwarding the port. Remove any existing static token, token-issue secret, or trusted-proxy authentication settings if deliberately switching to this mode. Binding all interfaces (`0.0.0.0` or `::`) requires configured authentication and is rejected without it.
### Trusted local network (no auth)
```json
{
"channels": {
"websocket": {
"host": "127.0.0.1",
"host": "0.0.0.0",
"port": 8765,
"websocketRequiresToken": false,
"allowFrom": ["*"],
+288 -116
View File
@@ -2,26 +2,48 @@
<!-- Meta description: Run nanobot from a browser WebUI with persistent and temporary chats, visible tool activity, workspace controls, Apps, skill discovery, settings, and Automations. -->
The WebUI is nanobot's browser workbench. It is included with `nanobot-ai` and shares the same gateway, settings, and saved conversations as the terminal UI (TUI).
The WebUI is nanobot's browser workbench for persistent topics, temporary
chats, visible agent activity, workspace controls, Apps, skill discovery,
settings, and Automations in one place.
For a visual tour, see the [README feature gallery](../README.md#-webui).
The published `nanobot-ai` wheel already includes the WebUI bundle. You only need
the `webui/` source directory when you are changing the frontend itself.
## Open the WebUI
Use the launcher:
```bash
nanobot webui
```
On a fresh install, nanobot creates your config and workspace, starts the local gateway, and opens a signed-in browser window at `http://127.0.0.1:8765` (accessible only from your computer). Before your first chat, add a provider and model in **Settings → Models** (see [Configure Your Model](./quick-start.md#2-configure-your-model)).
`nanobot webui` creates the config/workspace when needed, enables the local
WebSocket channel after confirmation, generates a WebUI bootstrap secret when
one is missing, starts or joins the same on-demand gateway used by the native
TUI, and opens the browser. With a fresh config,
it can open before a model is configured so you can finish setup in **Settings
→ Models**. The first-run path binds the WebUI to `127.0.0.1` by default, so
it is not available from other devices on your LAN. While the launcher remains
attached, it mirrors new log output from that exact gateway instance in the
terminal without replaying older logs.
With the official installer, the gateway stays running in the background after you close the browser or terminal. Manage it with `nanobot gateway status`, `logs`, `restart`, and `stop`. For other install methods (such as `uv` or `pip`), use `nanobot webui --detach` or `nanobot gateway --background` to keep it running in the background.
After model setup, explicitly promote the shared gateway when you do not want to keep a client open:
To sign in from another browser on the same machine, copy the **complete login link** printed in the terminal (shaped like `http://127.0.0.1:8765/#...`, including everything after `#`)—the bare address without the `#...` token will not sign a new browser in. Keep that link private. Use `nanobot webui --no-open` to print the link without launching a browser.
```bash
nanobot gateway --background
```
<details>
<summary>Manual configuration for the local WebUI</summary>
`nanobot webui --background` is retained only to print migration guidance. This keeps one
unambiguous owner for persistent process lifecycle.
Localhost access does not require a browser password by default. To require a password or allow access from other devices, set `tokenIssueSecret` in `~/.nanobot/config.json`:
Each foreground WebUI or TUI launcher releases only its own client. The last
interactive launcher stops an on-demand gateway. `nanobot gateway --background` makes the
gateway persistent; manage it with `nanobot gateway status`, `nanobot gateway
logs`, `nanobot gateway restart`, and `nanobot gateway stop`.
Manual config still works. Same-machine localhost WebUI access can run without
a browser password. Set `tokenIssueSecret` when you intentionally expose the
WebUI beyond localhost or want a browser password:
```json
{
@@ -36,163 +58,275 @@ Localhost access does not require a browser password by default. To require a pa
}
```
</details>
The WebUI is served by the WebSocket channel on port `8765` by default. The
gateway health endpoint, `18790` by default, is not the browser UI.
### macOS Dock icon
## First 10 Minutes
On a local macOS desktop, `nanobot webui` adds a Dock shortcut to your running WebUI (`--no-dock` disables it). Quitting or hiding the Dock icon only hides the shortcut; it does not stop the gateway or running tasks.
Use the WebUI as the primary setup surface:
## Overview
1. Open **Settings → Models** and configure a provider, credential, and active model preset.
2. Send `Hello!` in a new topic to prove the selected model works.
3. Start a separate topic before project work, then choose the intended workspace and access mode.
4. Add only one capability next: a chat channel in **Settings → Channels**, a web/voice/image provider in **Settings**, or an App/MCP integration in **Apps**.
5. Restart when the WebUI shows a restart requirement, then test that capability with the smallest possible request.
| Area | What you can do |
This path avoids hand-editing `config.json` for normal setup. Use the reference docs when you need an option the WebUI does not expose or when you manage config as code.
## What It Is For
| Area | Use it for |
|---|---|
| Topics | Start persistent topics or temporary chats; search, reorder, rename, archive, fork, or delete topics |
| Conversation groups | Work in up to four topics side by side with resizable panes |
| Activity & context | Inspect reasoning, tool calls, file diffs, token/cache usage, and the file graph |
| Workspace & Access | Pick a project folder and choose **Restricted** or **Full Access** |
| Composer | Send text, images, files, videos, voice input, `!` shell commands, `/` commands, and `@` mentions |
| Channels | Connect Telegram, Discord, Slack, Feishu, WeChat, Linear, and more with guided setup |
| Apps | Manage Agent Plugins, CLI Apps, and MCP servers |
| Skills | Inspect installed skills or discover new ones from skills.sh and SkillHub |
| Automations | Review, run, pause, edit, and delete scheduled tasks and local triggers |
| Settings | Configure models, providers, capabilities, appearance, and updates |
| Topics | Start persistent topics or temporary chats; switch, search, reorder, fork, or delete persistent topics |
| Agent activity | See thinking, tool calls, file edits with diffs, command output, and generated artifacts in context |
| Workspace | Pick the project workspace before asking for file or shell work |
| Access | Choose the access mode for local capabilities allowed by your gateway configuration |
| Composer | Send text, images, voice input, slash commands, and `@` mentions for topics, Apps, or MCP presets |
| Channels | Connect and validate chat platforms, install their optional support, and manage saved channel setup |
| Apps | Install, test, update, and use local CLI App adapters and MCP presets |
| Skills | Inspect and manage installed skills, or discover skills from supported marketplaces |
| Automations | Review, search, run, pause, edit, and delete scheduled and local-trigger agent turns |
| Settings | Adjust models, providers, image generation, voice, web tools, runtime, and safety options |
## Topics and Panes
## Topic Workspace
Each topic in the sidebar keeps its own history, title, project folder, and linked automations. Use **New topic** for a fresh context, or **Fork** to branch off an existing conversation without changing the original.
The sidebar is the topic switcher. Each topic keeps its own history, title,
workspace selection, and linked automations. Use a new topic when you want a
separate context; use fork when you want to continue from an existing point
without changing the original thread.
- **Organize:** Drag topics to reorder them, or use **Rename** to edit a title inline.
- **Bulk actions:** Choose **Select** in a topic's menu to archive or delete multiple topics at once (press `Esc` to exit selection mode). Archived topics stay saved and can be restored from **Show archived**.
- **Delete with undo:** Deleting a topic hides it with an 8-second **Undo** window. Topics with linked automations pause for confirmation in the toast before starting the undo countdown.
- **Navigate long conversations:** Use the message rail on wide screens or prompt-summary search in the header to jump directly to earlier messages. Scroll past the top (or pull down on touch devices) to load older history.
Drag a topic within its current sidebar group to keep frequently used work in
your preferred order. Drag a topic from the sidebar into the composer when you
want to reference it in the next message instead of switching to it.
### Conversation groups and panes
The message timeline shows both user-visible replies and agent activity. Long
tool or reasoning sections can be expanded when you need the details.
Open a topic's menu and choose **Create group** to arrange up to four topics side by side. Use **Add pane** in the header to start another topic alongside it, or drag an existing topic into the group.
When the agent writes or edits files, the activity item shows the target path,
status, changed line counts, and, when available, a unified diff. Use **View
diff** to expand the change; large diffs may hide unchanged lines or truncate the
inline preview. Use **Open file** from a file edit to open the read-only file
preview panel.
Selecting a pane targets the composer at that topic. Grouping only arranges panes—it does not merge topic histories. To pull context from another topic, mention it with `@`.
File previews follow the active topic's access mode. Restricted workspace access
previews only files under the selected workspace. Full Access can preview files
outside the workspace when that access mode is allowed by the gateway.
### Model options for a topic
## Temporary Chats
Open the model preset menu beside the composer to adjust **Reasoning effort** (and **Fast** / **Ultrafast** speed boosts on supported Codex models) for the current topic without changing the shared preset. Switching presets resets these per-topic overrides.
Use a temporary chat for a conversation that should not be added to nanobot's
topic history or long-term memory:
## Composer
1. Select **New topic**.
2. Select the **Temporary chat** control in the page header.
3. Send the first message.
The composer supports text, images, documents, videos, voice input, slash commands, and `@` mentions.
You can keep more than one temporary chat open and switch between them under
**Temporary chats** in the sidebar while the current WebUI connection remains
open. Reloading or closing the page, restarting the gateway, or losing the
WebSocket connection ends all of them. They cannot be recovered afterward.
- **Sending:** On desktop, `Enter` sends and `Shift+Enter` adds a newline. On touch devices, `Enter` adds a newline and the send button submits.
- **Queuing while busy:** While nanobot is replying on desktop, pressing `Enter` adds to a waiting message that sends automatically when the reply finishes. Use **Send now** (or press `Enter` on an empty box) to send it immediately as guidance—a dashed border shows when a follow-up is waiting for the model, returning to normal once the model picks it up.
- **Attachments:** Drop or select images, PDFs, Office documents, or videos (MP4/WebM/MOV, one per message up to 20 MiB; videos play in the WebUI, though the agent cannot analyze video contents yet).
- **Attach host files by path:** Paste a file path on the nanobot host on its own line to reference it without uploading or copying (respects the topic's workspace permissions).
- **Direct shell commands:** Start a message with `!` (such as `!git status`) to run a command directly in the topic's workspace without calling the model.
- **Mention other topics:** Type `@` (or drag a topic from the sidebar) to reference up to eight topics in one message—for example, *"Summarize @luma"* or *"Send this update to @luma."*
- **Voice input:** When voice transcription is enabled in Settings, the empty composer shows a microphone button.
- **Image generation:** Enable image generation in Settings to create and edit images in chat (see [Image Generation](./image-generation.md)).
Temporary does not mean consequence-free. Requests still go to the configured
model provider, and tools can still change files, run commands, or affect
external services. Temporary chats always use the default workspace in
Restricted mode; the project picker and Full Access are unavailable. Commands
and tools that create durable goals, automations, or subagent work are also
unavailable. Use a regular topic when you need reusable context, scheduled work,
or a result you must retain.
## Workspace and Access
Click the workspace picker when starting a new topic to browse folders on the nanobot host, jump to recent or starred projects, or enter a path directly (`Cmd/Ctrl+Shift+G`). Changes apply when you click **Confirm**. Saved topics keep their project folder fixed; start a new topic to work in a different project.
Use the workspace picker before starting project-specific work. This gives the
agent the right project context for file paths, shell commands, and topic
metadata. A locally hosted WebUI opens the operating system's folder chooser
when one is available; remote deployments keep the manual absolute path entry.
Selecting a project folder sets the working directory for files and shell commands without changing your agent's identity or memory:
Selecting a project does not replace the configured agent workspace. The two
paths have different responsibilities:
| Selected project provides | Agent workspace continues to provide |
|---|---|
| Project `AGENTS.md` | `SOUL.md` and `USER.md` |
| Relative file paths and shell working directory | Long-term memory (`memory/`) |
| The read/write boundary in **Restricted** mode | Custom skills (`skills/`) and instance state |
| Relative file paths and shell working directory | Long-term memory and history |
| The normal read/write boundary in Restricted mode | Custom skills and instance state |
> [!NOTE]
> Starting a new topic or selecting a different project does not create separate long-term memory. If you need strict separation between clients or users, use [Multiple Instances](./multiple-instances.md).
Project-local `SOUL.md` and `USER.md` files are ignored, and the agent workspace's
`AGENTS.md` is not inherited by a separately selected project. When the selected
project is the configured agent workspace, both roles naturally use the same
directory.
Use the access control in the composer to choose between **Restricted** (file and shell work stays inside the selected project, with narrow read-only access to skills and agent memory wiki) and **Full Access** (when allowed by your gateway config). You can switch access mode while a topic is idle.
The access control in the composer controls the local capability level for the
chat. It does not bypass your gateway, provider, shell sandbox, or operating
system configuration; it only selects among the capabilities that are already
available to the current topic.
## Activity, Previews, and Subtasks
In Restricted mode, ordinary file and shell work stays inside the selected
project. To preserve agent continuity, filesystem/search tools receive narrow,
read-only access to built-in skills, custom skills in the agent workspace, and
the exact agent `memory/history.jsonl` file. This does not grant access to
neighboring memory or profile files, and it does not allow writes outside the
selected project. These tool exceptions do not broaden the browser's file
preview boundary.
### Activity and context usage
Remote WebUI connections may reduce access for the current workspace. Selecting a
different workspace or enabling Full Access remains limited to local and native
clients.
While nanobot works, **Working for** shows its live step and timer; click it to view full reasoning and tool calls (or set **Settings → Appearance → Activity details** to **Expanded**). After a turn finishes, expand **Worked for** to inspect the full trace.
## Composer
Tasks in persistent topics keep running even if your browser disconnects; status and completed replies sync when you reconnect.
The composer supports plain messages, image attachments, voice input when
transcription is configured, slash commands, and `@` mentions for installed Apps,
MCP presets, or persisted topics. Topics have short, pronounceable handles such as
`@luma`; titles are display text rather than addresses. Select a topic
from the menu, or drag it from the sidebar, to attach its structured reference.
Typing the same text without selecting it remains plain text.
Click the context indicator beside the model badge to inspect:
The agent can inspect an attached topic with `read_session`. It can discover other
persisted topics with `list_sessions` and send asynchronous messages with
`send_session_message`; topic messaging is not limited by workspace scope.
The model badge shows the current model or preset and links to model settings when
setup is incomplete.
- **Context usage & recent rounds:** Estimated token usage, generation time, and cache hits (estimates only, not a billing statement).
- **File graph:** Files read since the last compaction and local Markdown links between them. Click any node to inspect its estimated size or preview the file, and scrub the usage bar to replay earlier rounds.
When a conversation grows long, nanobot summarizes earlier turns while keeping your full chat history visible. You can also run `/compact` anytime (see [Memory](./memory.md)).
### File and diagram previews
File edits show the path and changed line counts. Change **Settings → Appearance → File edit display** between **Summary**, inline **Diff**, and **Collapsed diff**. Click any filename to open a read-only preview tab (text previews up to 384 KiB; PNG/JPEG/GIF/WebP images up to 8 MiB; Markdown renders with a **Source** toggle; Mermaid diagrams render automatically). Right-click a file reference or tab to copy its path.
### Model failures
If a model call fails after automatic retries stop, any partial reply is preserved and the WebUI shows why it failed. Click **Continue** to resume from the saved conversation, or open model settings to fix credentials or switch models. Review completed tool calls before continuing, as the model may re-run tools if needed.
### Delegated work
When nanobot delegates work to subagents, a **Subtasks** bar appears above the composer while tasks are active. Open it to watch live progress, inspect a subtask's read-only trace, or stop an individual subtask. Finished subtasks appear inline beside the message that started them. See [Subagents](./concepts.md#subagents) for cancellation and restart behavior.
## Temporary Chats
Choose **New topic → Temporary chat** when you want a throwaway conversation that does not use your agent profile or long-term memory and is never saved to history.
- You can keep multiple temporary chats open in the sidebar during one browser session.
- Reloading the page, closing the tab, losing the connection, or restarting the gateway permanently deletes all temporary chats.
- Temporary chats always run in the default workspace in **Restricted** mode and cannot create goals, automations, or subagents.
> [!WARNING]
> Temporary does not mean consequence-free. Prompts still go to your AI provider, and tools can still edit files, run commands, or call external services. Files created by tools are not automatically deleted when the chat closes.
For image generation, configure an image provider first and then use the WebUI
image mode from the composer. See [`image-generation.md`](./image-generation.md)
for provider setup and output behavior.
## Channels
Open **Channels** to connect Telegram, Discord, Slack, Feishu, WeChat, Linear, and other platforms with credential forms or QR codes. On a local WebUI, nanobot can install missing channel packages for you and prompt to restart if needed.
Open **Settings → Channels** to connect chat apps without assembling JSON by hand. Search for a platform, open its setup panel, and follow the fields or QR flow shown for that channel. The guided setup can:
Test each new channel with a direct message—if the channel replies with a pairing code, approve it right inside the WebUI. For platform-side setup steps (creating bots, tokens, or permissions), see [Chat Apps](./chat-apps.md).
- install missing optional channel support when the WebUI is running locally;
- collect platform credentials while preserving previously saved values;
- handle supported QR-based login flows;
- validate the connection and show actionable setup errors;
- tell you when the gateway needs to restart.
The platform itself may still require you to create a bot, enable event permissions, copy a token, or configure a webhook. Use [`chat-apps.md`](./chat-apps.md) for those platform-side prerequisites and for manual JSON/reference options.
Test a new channel with a private DM. When a supported channel sends a pairing code, the WebUI surfaces the pending request so you can approve the sender. Keep access narrow; do not use a wildcard allowlist unless public access is intentional.
## Apps
Open **Apps → Ready** and filter by **Agent Plugins**, **CLI Apps**, or **MCP**:
Open Apps from the sidebar to review and manage installable capabilities. The
default **Ready** view shows only capabilities that can be used immediately:
- **Agent Plugins:** Local packages under `<workspace>/plugins/` that bundle skills, MCP servers, or both. Enable them in **Apps** to activate them.
- **CLI Apps:** Local command-line tool adapters on the nanobot host (run in a limited environment without your provider API keys).
- **MCP:** Add stdio, HTTP, or SSE Model Context Protocol servers, or pick from built-in presets (including OAuth presets like Notion, Linear, and Xmind, and keyless search presets like Firecrawl and Parallel Search).
- **Agent Plugins** are local packages that can bundle skills, MCP servers, or
both. A package under `<workspace>/plugins/` is installed but remains inactive
until you enable it in Apps.
- **CLI Apps** are local command-line adapters that nanobot runs on your
machine. Their installer manages the executable and exposes its adapter
through the same plugin activation model. Installing an adapter does not
modify the native desktop or web app it connects to.
- **MCP** lists Model Context Protocol servers. Presets provide known
configurations, and the **Add MCP server** panel accepts stdio, HTTP, and SSE
servers. Custom HTTP/SSE servers can use no authentication, OAuth, or request
headers. After saving an OAuth server, choose **Connect** to open its sign-in
page. Presets such as Xmind, Notion, and Linear already use OAuth. HTTPS and
localhost WebUIs return automatically; a remote plain-HTTP WebUI shows one
field for pasting the complete localhost callback URL.
Once enabled, mention a CLI App or MCP server with `@` in the composer to use it in your next message, or invoke plugin skills with `$skill-name`.
Apps intentionally does not list nanobot runtime support packages such as
`api` or `bedrock`. Those packages enable providers, servers, or channels; they
are not tools that can be attached to a turn with `@`. Manage them from
**System**, **Models**, or **Web**. PDF and common Office document readers are
included in nanobot and activate automatically when a file is attached. The
equivalent CLI for optional integrations remains `nanobot plugins`. See
[`cli-reference.md`](./cli-reference.md#optional-features).
That command manages nanobot runtime extras, not Agent Plugin packages.
Some MCP presets connect to hosted keyless endpoints. For example, the Firecrawl
preset uses Firecrawl's hosted MCP endpoint for search, scrape, crawl, and
extraction tools without requiring an API key. This does not replace nanobot's
built-in web search provider; mention the Firecrawl MCP preset with `@` when a
turn needs Firecrawl's richer web data tools.
The Parallel Search preset connects to the free, anonymous Parallel Search MCP
endpoint and exposes `web_search` and `web_fetch` without requiring an API key.
It is an optional integration and does not replace nanobot's built-in web search
provider; mention `@parallel-search` when a turn should use it.
After a CLI App or MCP server is available, mention it from the composer with
`@` to attach that tool to the next message. Plugin-provided skills participate
in normal skill discovery and can be invoked with `$skill-name`.
## Skills
- **Skills → Installed:** Search, inspect, enable/disable, or delete built-in and workspace skills.
- **Skills → Discover:** Browse and install skills from **skills.sh** (requires Node.js / `npx`) and **SkillHub** (no `npx` needed).
Open **Skills → Installed** to review built-in and workspace-provided skills.
You can search and filter them, inspect their instructions and setup
requirements, enable or disable them, and delete workspace skills you no longer
want.
> [!CAUTION]
> Marketplace skills are third-party instructions and may include scripts. Review them before installing, and only enable skills you trust with your workspace and tools.
Open **Skills → Discover** to browse or search skills from skills.sh and
SkillHub. A marketplace skill is copied into the active agent workspace after
you confirm the installation. skills.sh installation requires Node.js with
`npx`; SkillHub installation does not.
Marketplace skills are third-party instructions and may include executable
scripts. Review the source and instructions before installing one, and enable
only skills you trust with the same files, tools, and credentials available to
your agent.
## Automations
The **Automations** view lets you search, filter, run, pause, edit, and delete scheduled tasks and local triggers. Search supports plain text and filters like `name:backup`, `chat:WeChat`, `schedule:09:30`, `trigger`, and `status:paused`.
Automations are agent turns that run later in a linked topic. Create them from
the topic or channel where they are supposed to run so nanobot keeps the
correct target context. When an automation runs, it normally delivers the
result back to that topic.
Create automations from the topic where you want replies delivered. Local triggers need a message each time they run, so copy their `nanobot trigger ...` command instead of using "Run now". See [Automations](./automations.md) for the complete guide.
For the full automation model, creation flow, trigger CLI usage, and delivery
semantics, see [`automations.md`](./automations.md).
## Settings and Updates
There are two user-facing automation types:
Settings that require a gateway restart are clearly marked in the WebUI.
- Scheduled automations, created by the agent's cron tool, run at a time,
interval, or cron expression.
- Local triggers, created with `/trigger <name>`, run when you call a local
command such as `nanobot trigger trg_8K4P2Q9X "Review PR #4502"`.
- **Appearance:** Choose **System**, **Light**, or **Dark** theme, pick a reading text size (Small, Standard, Large, or custom 14–28 px), choose how much activity/diff detail to show, or set a custom background image (**Settings → Appearance → Background**—PNG, JPEG, or WebP up to 6 MiB, with adjustable blur and fade).
- **Notifications:** Open **Settings → Notifications** to turn on **Browser notifications** (alerts you when a background task finishes or needs attention; click **Test notification** to verify) and **Completion sound**. Works on localhost or HTTPS (on iPhone/iPad, open from the Home Screen).
- **Check for updates:** Open **Settings → About** to check for updates. nanobot does not run automatic background version checks or auto-install updates without your confirmation. See [Updating nanobot](./updating.md).
For recurring background checks that should stay quiet unless there is something
useful to report, use the protected heartbeat job by editing `HEARTBEAT.md`
instead of creating a chat automation.
## Sharing Access
Use the Automations view to:
The WebUI is an admin workbench for one nanobot instance. Everyone signed in to the WebUI shares all topics and administrative controls—there are no per-user accounts or private topics.
- Filter by all, active, paused, needs-attention, or system jobs.
- Search by task name, message, trigger command, linked topic, schedule, or status.
- Sort by next run, last run, updated time, or name.
- Run scheduled automations now.
- Pause or resume, rename, or delete user-created automations.
- Copy the CLI command for local triggers.
- Inspect protected system automations without changing them.
- Only share WebUI access with people you trust to administer the same agent.
- To let others chat without admin access, connect a [chat app](./chat-apps.md) and approve them via pairing or allowlists.
- To isolate memory and data between different users or clients, run [separate instances](./multiple-instances.md).
Search accepts plain text and field filters such as `name:backup`,
`chat:WeChat`, `schedule:09:30`, `cron:"0 23 * * *"`, `trigger`, and
`status:paused`.
An automation without a linked topic cannot be enabled or run from the WebUI,
because nanobot would not know where to deliver the scheduled turn. Recreate it
from the target topic or channel so the automation has complete context.
Local triggers do not have a WebUI "Run now" action because each run needs a
message. Use the copied `nanobot trigger ...` command and replace `"message"`
with the content that should be delivered.
## Settings
Settings is the control surface for browser-local and gateway-backed
runtime configuration. Use it to review or adjust model presets, providers,
image generation, voice transcription, web tools, chat channels, Apps,
Automations, Skills, runtime identity, and advanced safety controls.
Some settings take effect immediately. Runtime settings that affect the gateway
or agent process may require a restart; the WebUI shows that requirement next to
the relevant control.
Browser-only display preferences, such as file edit display mode, take effect
immediately for the current browser and do not change gateway configuration.
## LAN Access
To access the WebUI from another device on your local network, bind it to `0.0.0.0` and set a password (`tokenIssueSecret`):
To open the WebUI from another device on the same network, bind the WebSocket
channel to all interfaces and set a token or token issue secret:
```json
{
@@ -206,19 +340,57 @@ To access the WebUI from another device on your local network, bind it to `0.0.0
}
```
The gateway refuses to bind to `0.0.0.0` without `token` or `tokenIssueSecret`. After restarting, open `http://<your-ip>:8765` on the other device and sign in with your secret.
The gateway refuses to start with `host` set to `"0.0.0.0"` unless `token` or
`tokenIssueSecret` is configured. After the gateway starts, open
`http://<your-ip>:8765` from the other device and enter the secret in the login
form.
- **Voice input on LAN:** Browsers require HTTPS for microphone access on non-localhost addresses. Configure [TLS/SSL](./websocket.md#tlsssl) or put an HTTPS reverse proxy in front of the WebUI.
- **Remote installs:** By default, remote browsers cannot install optional packages or marketplace skills. Only enable `tools.webuiAllowRemotePackageInstall: true` on private deployments where every WebUI user is trusted to install packages and scripts on the host.
Plain HTTP is enough for basic WebUI access, but browsers expose microphone
capture only in secure contexts. Voice input works on same-machine localhost;
from another device, serve the WebUI over HTTPS with a certificate that device
trusts. Configure [`sslCertfile` and `sslKeyfile`](./websocket.md#tlsssl) on the
WebSocket channel and open `https://<your-host>:8765`, or terminate HTTPS at a
reverse proxy and use that proxy's HTTPS URL.
Remote WebUI clients with a valid token can view and use Apps and installed
skills. Actions that install missing nanobot support packages or third-party
marketplace skills are blocked by default. To let trusted remote administrators
perform those installations through the WebUI, opt in explicitly:
```json
{
"tools": {
"webuiAllowRemotePackageInstall": true
}
}
```
Use this only for a private deployment where every authenticated WebUI user is
trusted to change nanobot's Python environment and install workspace skill
instructions or scripts. If you publish the WebUI through Nginx, Caddy,
Cloudflare Tunnel, or a similar service, treat it as remote access and leave
package and skill installs disabled unless that is intentional.
Optional feature installs use pip's configured package index, including
`PIP_INDEX_URL`. skills.sh marketplace installs use `npx` instead.
Leave remote package installs disabled when the WebUI is exposed beyond a
private, trusted network.
## Troubleshooting
If the WebUI will not open, check these in order:
If the page does not open, check these in order:
1. `nanobot agent -m "Hello!"` works in the same Python environment.
2. `channels.websocket.enabled` is not set to `false` in `~/.nanobot/config.json`.
3. `nanobot gateway` is running.
4. You are opening port `8765` (WebUI), not `18790` (gateway health check).
5. For LAN access, `host` is `"0.0.0.0"` and `tokenIssueSecret` (or `token`) is set.
2. `~/.nanobot/config.json` does not explicitly set `channels.websocket.enabled` to `false`.
3. `nanobot gateway` is still running.
4. You are opening port `8765`, not the gateway health port.
5. LAN access uses `host: "0.0.0.0"` and a token or token issue secret.
For more help, see [WebUI Problems](./troubleshooting.md#webui-problems).
If voice input asks for a secure connection, use HTTPS with a certificate the
device trusts. Browsers do not expose microphone capture to
`http://<your-ip>` origins.
For detailed diagnostics, see
[`troubleshooting.md#webui-problems`](./troubleshooting.md#webui-problems).
For frontend development, see [`../webui/README.md`](../webui/README.md).
+24 -28
View File
@@ -1,6 +1,28 @@
#!/bin/sh
dir="$HOME/.nanobot"
# Render deploy path (see render.yaml + render-config.json). Gated on Render's
# automatic RENDER=true env var so local Docker/podman usage is unaffected.
# Initializes the on-disk config from the committed template (wiring secrets via
# ${VAR} env vars, keeping runtime data on the persistent disk) and appends the
# --config flag. Logs each decision so a failed start is diagnosable in Render's
# logs. Privilege dropping is handled below, for every root start (not just here).
if [ "$RENDER" = "true" ]; then
echo "[entrypoint] Render deploy — starting as $(id)"
mkdir -p "$dir" || echo "[entrypoint] warning: mkdir $dir failed"
config="$dir/config.json"
# Initialize config only when it does not already exist, so WebUI/provider
# settings edited at runtime survive restarts. The disk persists config.json
# across deploys; overwriting it every boot would discard those changes.
if [ ! -f "$config" ]; then
echo "[entrypoint] initializing $config from render-config.json"
cp /app/render-config.json "$config" || echo "[entrypoint] warning: cp config failed"
else
echo "[entrypoint] existing $config found — leaving it in place"
fi
set -- "$@" --config "$config"
fi
# Drop privileges whenever the container starts as root. Render mounts the
# persistent disk root-owned, and a plain `docker run` also defaults to root now,
# so this covers both. Chown the data dir so the non-root user can write it, then
@@ -10,12 +32,13 @@ if [ "$(id -u)" = "0" ]; then
chown -R nanobot:nanobot "$dir" 2>/dev/null || echo "[entrypoint] warning: chown $dir failed"
if setpriv --reuid=nanobot --regid=nanobot --init-groups true 2>/dev/null; then
echo "[entrypoint] dropping privileges to nanobot via setpriv"
exec setpriv --reuid=nanobot --regid=nanobot --init-groups "$0" "$@"
exec setpriv --reuid=nanobot --regid=nanobot --init-groups nanobot "$@"
fi
echo "[entrypoint] error: started as root but setpriv privilege drop failed — refusing to run as root" >&2
exit 1
fi
# Already non-root: make sure the data dir is writable before starting.
if [ -d "$dir" ] && [ ! -w "$dir" ]; then
owner_uid=$(stat -c %u "$dir" 2>/dev/null || stat -f %u "$dir" 2>/dev/null)
cat >&2 <<EOF
@@ -29,31 +52,4 @@ EOF
exit 1
fi
# Render keeps environment references in its deployment template. Local
# Compose generates and validates its initial config through Python instead.
if [ "$RENDER" = "true" ]; then
config="$dir/config.json"
mkdir -p "$dir" || exit 1
if [ ! -f "$config" ]; then
echo "[entrypoint] initializing $config from render-config.json"
cp /app/render-config.json "$config" || exit 1
else
echo "[entrypoint] existing $config found — leaving it in place"
fi
set -- "$@" --config "$config"
elif [ "$NANOBOT_DOCKER_BOOTSTRAP" = "1" ] && [ "$1" = "gateway" ]; then
# Explicit config selectors belong to the CLI; bootstrap only the default instance.
initialize_default=1
for argument in "$@"; do
case "$argument" in
--config|--config=*|-c*) initialize_default=0; break ;;
esac
done
if [ "$initialize_default" = "1" ]; then
config="$dir/config.json"
python -m nanobot.cli.docker_bootstrap "$config" || exit 1
set -- "$@" --config "$config"
fi
fi
exec nanobot "$@"
+6 -37
View File
@@ -1,11 +1,10 @@
"""Hatch build hook that bundles the WebUI and nanobot skill documentation.
"""Hatch build hook that bundles the webui (Vite) into nanobot/web/dist.
Triggered automatically by `python -m build` (and any other hatch-driven build)
so published wheels and sdists ship a fresh webui without requiring developers
to remember `cd webui && bun run build` beforehand. Documentation from docs/ is
copied into the nanobot-document skill on every build, including editable installs.
to remember `cd webui && bun run build` beforehand.
WebUI behavior:
Behavior:
- Skips for editable installs (`pip install -e .`). Editable mode is for Python
development; webui contributors use `cd webui && bun run dev` (Vite HMR) and
@@ -15,14 +14,13 @@ WebUI behavior:
- Skips when `NANOBOT_SKIP_WEBUI_BUILD=1` is set.
- Reuses `nanobot/web/dist/` only when it is already fresh, unless
`NANOBOT_FORCE_WEBUI_BUILD=1` is set.
- Uses `bun` when available, otherwise falls back to `npm`, or provisions Bun
when neither is available. Bun builds use `--bun` so Node is not required.
- Uses `bun` when available, otherwise falls back to `npm`. The chosen tool
performs `install` followed by `run build`.
"""
from __future__ import annotations
import os
import shutil
import sys
from pathlib import Path
from types import ModuleType
@@ -43,29 +41,8 @@ def _load_webui_build_module() -> ModuleType:
class WebUIBuildHook(BuildHookInterface):
PLUGIN_NAME = "webui-build"
def initialize(self, version: str, build_data: dict) -> None:
def initialize(self, version: str, build_data: dict) -> None: # noqa: D401
root = Path(self.root)
docs_dir = root / "docs"
references_dir = root / "nanobot" / "skills" / "nanobot-document" / "references"
if not (docs_dir / "README.md").is_file():
raise RuntimeError("[nanobot-document] docs/README.md is required to bundle documentation")
# Refresh generated files without removing directories that Windows
# editors or file watchers may hold open during editable installs.
current_docs: set[Path] = set()
for source in docs_dir.rglob("*.md"):
relative = source.relative_to(docs_dir)
if relative.parts[0] in {"plans", "superpowers"}:
continue
current_docs.add(relative)
destination = references_dir / relative
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source, destination)
for generated in references_dir.rglob("*.md"):
if generated.relative_to(references_dir) not in current_docs:
generated.unlink()
build_data.setdefault("artifacts", []).append(
"nanobot/skills/nanobot-document/references/**/*.md"
)
webui_dir = root / "webui"
package_json = webui_dir / "package.json"
dist_dir = root / "nanobot" / "web" / "dist"
@@ -81,14 +58,6 @@ class WebUIBuildHook(BuildHookInterface):
)
return
from nanobot.build_info import read_commit
commit = read_commit(root)
if commit:
commit_file = root / "nanobot" / "_build_commit.txt"
commit_file.write_text(commit + "\n", encoding="utf-8")
build_data.setdefault("force_include", {})[str(commit_file)] = "nanobot/_build_commit.txt"
if os.environ.get("NANOBOT_SKIP_WEBUI_BUILD") == "1":
self.app.display_info("[webui-build] skipped via NANOBOT_SKIP_WEBUI_BUILD=1")
return
Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Loaded 100 of 2428 files, more files were not shown because too many files have changed in this diff. Show more