Commit Graph

131 Commits

Author SHA1 Message Date
crispyberry
2fe81b8ee1 feat: add non-streaming LLM API, tool registry, and web_search tool
Replace SSE streaming with non-streaming JSON for Anthropic API.
Add llm_chat_tools() returning structured llm_response_t with text
and tool_use blocks. Implement tool registry with dispatch-by-name
and web_search tool via Brave Search API (direct + proxy support).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 00:37:36 +08:00
crispyberry
7a6609b722 docs: add memory write via tool use to TODO, mark proxy as done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 23:12:57 +08:00
crispyberry
37d645474a fix: heap-allocate memory_read buffer to prevent stack overflow
CLI task stack is 4KB; the 4096-byte stack buffer in cmd_memory_read
was overflowing and corrupting the heap. Use malloc instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 23:04:09 +08:00
crispyberry
9b8121c4ce docs: add Chinese README, update proxy commands and model name
- Add README_CN.md with proxy setup guide for users in China
- Add language switcher to both READMEs
- Add set_proxy/clear_proxy to More Commands section
- Update default model to claude-opus-4-6
- Add Nanobot to acknowledgments
- Update ARCHITECTURE.md: proxy module, stack sizes, NVS config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 23:01:05 +08:00
crispyberry
3822928e6d feat: add HTTP CONNECT proxy support for Telegram and Claude API
Enable ESP32-S3 to reach api.telegram.org and api.anthropic.com through
an HTTP CONNECT proxy (e.g. Clash Verge), required in regions where
these services are blocked.

- New proxy module (http_proxy.c/h): CONNECT tunnel + TLS via esp_tls
  with pre-connected socket injection (esp_tls_set_conn_sockfd)
- Telegram and LLM modules split into direct/proxy paths
- CLI commands: set_proxy <host> <port>, clear_proxy
- Proxy config persisted in NVS
- Fix TLS buffer: MBEDTLS_SSL_IN_CONTENT_LEN 4096 → 16384
- Increase task stacks for TLS overhead (poll 12KB, agent 12KB, outbound 8KB)
- Default model changed to claude-opus-4-6
- Capture raw error body for non-200 API responses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:40:28 +08:00
crispyberry
8b5213df87 fix: add TLS certificate bundle for HTTPS connections
All HTTP clients (Telegram, Claude API, OTA) were missing
crt_bundle_attach, causing TLS handshake failures. Add esp-tls
dependency to CMakeLists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 21:18:21 +08:00
crispyberry
5cab441035 docs: update How It Works with agent loop architecture diagram
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 20:35:15 +08:00
crispyberry
dd17c74eee docs: features 2026-02-06 18:55:11 +08:00
crispyberry
1b5f00bea5 feat: add app_update dependency and sdkconfig defaults
Add app_update component to CMakeLists REQUIRES for OTA version
reporting. Add sdkconfig.defaults scaffold and gitignore nanobot
reference repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:44:51 +08:00
crispyberry
3b53610bdf docs: rewrite README for general audience, move tech details to docs
Simplified language, plain diagrams, human-readable memory table.
Technical architecture stays in docs/ARCHITECTURE.md.
No Linux, inspired by OpenClaw.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 19:12:20 +08:00
crispyberry
bf772cb892 docs: add architecture design and feature gap tracker
ARCHITECTURE.md covers system diagram, data flow, module map,
task layout, memory budget, flash partitions, NVS config,
protocols, and nanobot reference mapping.
TODO.md tracks unimplemented features vs nanobot (P0/P1/P2).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:56:14 +08:00
crispyberry
40412c6dba feat: add SPIFFS default data (SOUL.md, USER.md, MEMORY.md)
Pre-built content for flashing to SPIFFS partition:
personality definition, user profile template, empty memory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:56:09 +08:00
crispyberry
fa4582bf70 feat: wire up app_main with all subsystems
Startup sequence: NVS → SPIFFS → bus → memory → WiFi → CLI →
Telegram → agent loop → WebSocket → outbound dispatch.
CMakeLists registers all source files and ESP-IDF dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:56:04 +08:00
crispyberry
0b9aef22a7 feat: add OTA firmware update from URL
Wraps esp_https_ota for over-the-air updates via HTTPS.
Dual OTA partitions enable safe rollback.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:59 +08:00
crispyberry
44790d016b feat: add serial CLI with 12 configuration commands
esp_console REPL over USB-JTAG: wifi_set, set_tg_token,
set_api_key, set_model, memory_read/write, session_list/clear,
heap_info, restart.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:54 +08:00
crispyberry
9435302063 feat: add WebSocket gateway on port 18789
JSON protocol server using esp_http_server with WS upgrade.
Supports up to 4 concurrent clients, auto-assigned chat_id,
routes messages through the agent via message bus.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:49 +08:00
crispyberry
3365db45b9 feat: add memory store and session manager
MEMORY.md for long-term memory, daily YYYY-MM-DD.md notes.
JSONL session files per chat_id with ring buffer history
(max 20 messages). All persisted on SPIFFS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:44 +08:00
crispyberry
0c517b734f feat: add agent loop and context builder
Agent loop runs on Core 1: pops inbound messages, builds system
prompt from bootstrap files + memory, calls Claude API, saves
session, pushes response to outbound queue. PSRAM-allocated buffers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:38 +08:00
crispyberry
cbd137c3fa feat: add Claude API proxy with SSE streaming parser
Anthropic Messages API integration with streaming response.
Parses content_block_delta SSE events, accumulates text tokens.
API key and model stored in NVS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:32 +08:00
crispyberry
44a82520e2 feat: add Telegram bot with long polling and message splitting
Direct HTTPS long polling against Telegram Bot API (getUpdates),
JSON parsing with cJSON, auto-split at 4096 chars, Markdown
with plain-text fallback.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:28 +08:00
crispyberry
efb3e09929 feat: add FreeRTOS message bus (inbound + outbound queues)
mimi_msg_t carries channel/chat_id/content between tasks.
Decouples input channels from agent loop and output dispatch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:23 +08:00
crispyberry
0ebd1ccb20 feat: add WiFi manager with NVS credentials and auto-reconnect
STA mode, reads SSID/password from NVS, exponential backoff
reconnect (1s-30s), EventGroup for connection state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:17 +08:00
crispyberry
db3a8b1202 feat: add sdkconfig defaults, partition table, and global config
16MB flash with custom partitions (2x2MB OTA + 12MB SPIFFS),
PSRAM/WiFi/TLS tuning, and centralized compile-time constants.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:55:12 +08:00
crispyberry
2d0660ab58 chore: add .gitignore and sdkconfig.defaults.esp32s3 2026-02-05 18:15:08 +08:00
crispyberry
2f1a7b6199 Merge remote-tracking branch 'origin/main' 2026-02-05 12:40:09 +08:00
crispyberry
e676abf2d2 feat: new project 2026-02-05 12:38:18 +08:00
crispyberry
7e87831f3f docs: big name, done 2026-02-04 23:40:18 +08:00
crispyberry
8cfd68e5c3 Add lobster pixel art banner to README
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:49:34 +08:00
crispyberry
1d1ac71369 Fix clone URL to correct repo address
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 12:40:36 +08:00
crispyberry
cf567b3585 Add project README with architecture, roadmap, and usage docs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 12:37:56 +08:00
crispyberry
52f5695b76 first commit 2026-02-04 12:27:23 +08:00