Commit Graph

321 Commits

Author SHA1 Message Date
Acbox cb5d2c5fab fix: send message in group failed 2026-02-20 22:47:02 +08:00
Acbox 1a78ba3f53 feat: add platform metadata in contacts 2026-02-20 22:19:15 +08:00
Acbox 82cc9c357f feat: support attachment send to tool send 2026-02-20 22:04:00 +08:00
Acbox 6b7c3db952 refactor: process user header in go side 2026-02-20 21:40:13 +08:00
Acbox 4278675799 refactor(channel): add get_contacts tools and remove lookup_channel_user 2026-02-20 16:12:40 +08:00
Acbox ab84e29dde fix: change memory message role from system to user caused by the imcompatibility of anthropic messages api 2026-02-20 15:19:24 +08:00
BBQ 4fc0ca5110 fix(container): propagate host timezone to all containers
Replace TZ env var with /etc/localtime bind-mount in docker-compose
and inject timezone spec opts into containerd bot containers.
2026-02-20 03:22:31 +08:00
Acbox 5e1de4fe7b fix: include system tokens in max tokens compute 2026-02-19 18:28:29 +08:00
Acbox a65c741e28 fix(agent): missing user header in message store 2026-02-19 17:19:39 +08:00
Ringo.Typowriter 53f080503c fix(telegram): aggregate media_group inbound and preserve ordering with (#69)
attachment fallback query
2026-02-19 17:14:12 +08:00
BBQ bc374fe8cd refactor: content-addressed assets, cross-channel multimodal, infra simplification (#63)
* refactor(attachment): multimodal attachment refactor with snapshot schema and storage layer

- Add snapshot schema migration (0008) and update init/versions/snapshots
- Add internal/attachment and internal/channel normalize for unified attachment handling
- Move containerfs provider from internal/media to internal/storage
- Update agent types, channel adapters (Telegram/Feishu), inbound and handlers
- Add containerd snapshot lineage and local_channel tests
- Regenerate sqlc, swagger and SDK

* refactor(media): content-addressed asset system with unified naming

- Replace asset_id foreign key with content_hash as sole identifier
  for bot_history_message_assets (pure soft-link model)
- Remove mime, size_bytes, storage_key from DB; derive at read time
  via media.Resolve from actual storage
- Merge migrations 0008/0009 into single 0008; keep 0001 as canonical schema
- Add Docker initdb script for deterministic migration execution order
- Fix cross-channel real-time image display (Telegram → WebUI SSE)
- Fix message disappearing on refresh (null assets fallback)
- Fix file icon instead of image preview (mime derivation from storage)
- Unify AssetID → ContentHash naming across Go, Agent, and Frontend
- Change storage key prefix from 4-char to 2-char for directory sharding
- Add server-entrypoint.sh for Docker deployment migration handling

* refactor(infra): embedded migrations, Docker simplification, and config consolidation

- Embed SQL migrations into Go binary, removing shell-based migration scripts
- Consolidate config files into conf/ directory (app.example.toml, app.docker.toml, app.dev.toml)
- Simplify Docker setup: remove initdb.d scripts, streamline nginx config and entrypoint
- Remove legacy CLI, feishu-echo commands, and obsolete incremental migration files
- Update install script and docs to require sudo for one-click install
- Add mise tasks for dev environment orchestration

* chore: recover migrations

---------

Co-authored-by: Acbox <acbox0328@gmail.com>
2026-02-19 00:20:27 +08:00
BBQ 740f620fe4 Merge pull request #66 from chiyuki0325/fix/mcp-tool-name
fix(mcp): replace dot with underscore in tool name to meet ai sdk's need
2026-02-18 22:28:36 +08:00
Ringo.Typowriter 1bd080c155 fix(flow): drop leading orphan tool messages after token trimming (#68) 2026-02-18 22:27:38 +08:00
Kirikaze Chiyuki b69d355383 fix(mcp): replace dot with underscore in tool name to meet ai sdk's need 2026-02-18 21:24:08 +08:00
Acbox 1294b4cf75 feat: connection test of provider 2026-02-18 18:52:26 +08:00
Acbox d6c47472b2 refactor: move client_type key from provider to model 2026-02-18 18:30:27 +08:00
Acbox 77e9f585a1 feat: max context tokens 2026-02-18 17:20:22 +08:00
Acbox 7d72f86152 Revert "refactor(agent): move user identity headers to system prompt and sanitize input (#64)"
This reverts commit c9d4ee2a60.
2026-02-18 06:29:25 +08:00
tommy0103 c9d4ee2a60 refactor(agent): move user identity headers to system prompt and sanitize input (#64)
* refactor(agent): move user identity headers to system prompt and sanitize input

- Relocate user-context headers from User Prompt to System Prompt for better instruction adherence.
- Implement soft-sanitization to strip header-like patterns from user input to prevent prompt injection.
- Update resolver logic in Go to support the new prompt structure.

* refactor(agent): move user identity headers to system prompt and sanitize input
- Relocate user-context headers from User Prompt to System Prompt for better instruction adherence.
- Implement soft-sanitization to strip header-like patterns from user input to prevent prompt injection.
- Update resolver logic in Go to support the new prompt structure.

* chore: remove same process in go side

---------

Co-authored-by: Acbox <acbox0328@gmail.com>
2026-02-18 05:36:50 +08:00
Ringo.Typowriter daed9d2d95 fix(models): guard bot memory model type and fallback for memory LLM (#61) 2026-02-17 20:14:44 +08:00
斬風千雪 cd8cb59236 improvement(telegram): add ellipsis and "typing" action in streamed message (#59) 2026-02-17 19:13:55 +08:00
BBQ df7876a30c feat: add media asset system, channel lifecycle refactor, and chat attachments (#54) 2026-02-17 19:06:46 +08:00
斬風千雪 0bdc31311c improvement(mcp): make CNI binary & data path configurable (#55) 2026-02-17 17:57:13 +08:00
Ringo.Typowriter 3aea635e44 fix: skill normalize (#57) 2026-02-17 17:55:07 +08:00
Ringo.Typowriter f9c613b4f9 fix: password placeholder (#53) 2026-02-16 19:48:50 +08:00
BBQ b8a6a85fbb fix(containerd): re-apply CNI network after server restart for running MCP tasks
Server container restart drops cni0 bridge, veth and iptables masquerade
in its network namespace while MCP tasks keep running in containerd.
Reconcile and ensureContainerAndTask now re-run SetupNetwork for already-
running tasks so outbound connectivity is restored.
2026-02-16 16:45:38 +08:00
BBQ 75904022c0 fix(settings): search_provider_id NULL scan failure
The ::text cast on search_providers.id prevented sqlc from inferring
nullability via LEFT JOIN, generating a non-nullable string field that
crashes when the bot has no search provider bound.
2026-02-16 02:11:16 +08:00
Acbox 961ecbb96d feat: search provider 2026-02-16 01:22:15 +08:00
Acbox 38753ef054 refactor: channel tools 2026-02-15 17:48:20 +08:00
Acbox 37360ad8e4 fix: schedule run failed 2026-02-15 16:12:53 +08:00
Acbox c014fd3095 chore: change tool names of schedule 2026-02-15 15:09:03 +08:00
Acbox 3d575e031e feat: run memory extraction in the background 2026-02-15 14:15:55 +08:00
Ran 399c6eb4f1 Merge branch 'pr/46' 2026-02-15 03:49:23 +08:00
Fodesu 6f5ee013e6 fix(models): models id change can not be save (#49) 2026-02-14 23:40:47 +08:00
Ran 7817ec8147 fix(web): channel switch failure
Also add webui memory page
2026-02-14 07:30:21 +08:00
Fodesu fc42e717a7 chore: fix typos 2026-02-13 22:06:56 +08:00
BBQ f3ea18a2da feat(telegram): add processing reaction and fix reply-to-bot trigger
Add ProcessingStatusNotifier implementation: show 👀 reaction while
processing, remove on completion/failure. Fix isReplyToBot to match
only the current bot (bot.Self.ID) instead of any bot, preventing
multiple bots from responding to the same reply. Add rune-safe text
truncation for Telegram message length limit.
2026-02-13 20:45:14 +08:00
BBQ 14a1f9cad3 chore(db): remove obsolete text.go, text_test.go and uuid.go
These files were superseded by internal/db/utils.go.
2026-02-13 20:42:00 +08:00
BBQ b3c869f0ff fix(telegram): sanitize text to valid UTF-8 before sending to API
Strip invalid UTF-8 byte sequences in sendTelegramTextReturnMessage and
editTelegramMessageText to prevent "text must be encoded in UTF-8" errors
that abort the stream mid-response.
2026-02-13 20:26:27 +08:00
BBQ 670698090f fix(route): handle concurrent route creation race condition
Catch unique constraint violation (SQLSTATE 23505) during route creation
in ResolveConversation and fall back to Find, preventing duplicate key
errors when concurrent inbound messages hit the same chat simultaneously.
Add shared IsUniqueViolation helper to internal/db.
2026-02-13 20:26:22 +08:00
BBQ f1d53e1c2c fix(telegram): improve stream edit throttle and 429 rate limit handling
Increase edit throttle from 250ms to 1500ms to respect Telegram per-chat limits,
remove newline bypass that effectively disabled throttling, add dedicated
editStreamMessageFinal with retry for final message delivery, and simplify
editTelegramMessageText by removing blocking sleep in favor of caller-level retry.
2026-02-13 20:21:10 +08:00
BBQ c46f284556 fix(telegram): handle stream edit errors and 429 rate limit
- Treat 400 "message is not modified" as success to avoid user-facing error
- On 429: sleep retry_after and retry once in editTelegramMessageText;
  stream backs off lastEditedAt and returns nil
- Require error code 400 for message-not-modified check; add production
  error string to unit tests
- Lower base throttle to 250ms; add test hooks and tests for 429 retry
  and stream backoff
2026-02-13 19:52:22 +08:00
BBQ faaadf14c5 feat(channel): pass conversation type through to agent gateway and persist in route
Propagate conversation type (direct/group/thread) from channel adapters
all the way to the agent prompt. Store conversation_type on bot_channel_routes
so the bot knows whether a message originates from a p2p chat, group, or thread.

Schema changes are folded into the 0001 init migration (destructive update).
2026-02-13 06:22:24 +08:00
Ran 0406f42e86 feat: memory search/compact/rebuild api 2026-02-13 06:14:57 +08:00
BBQ 76dbae2844 feat(bots): per-key parallel health checks with MCP connection probing
- Refactor RuntimeChecker interface: CheckKeys() + RunCheck() for
  individual check dispatch instead of batch-all
- Add GET /bots/:id/checks/keys to list all available check keys
- Add GET /bots/:id/checks/run/:key to evaluate a single check
- MCP ConnectionChecker probes each active connection independently
  via tools/list with 8s timeout
- Keep container checks (init/record/task/data_path) as fast builtins
- Graceful network setup failure in containerd handler (log warning
  instead of killing task) for containerd-in-docker compatibility
2026-02-13 02:43:23 +08:00
BBQ 1d1586186c feat(bots): add MCP connection runtime health checks
- Add RuntimeChecker interface for extensible bot health checks
- Implement MCP ConnectionChecker: probes active connections via tools/list
- Show MCP server status (healthy/unreachable/no tools) in bot checks
- Register checker in main.go alongside container lifecycle
2026-02-13 02:13:52 +08:00
BBQ fddacbb86d fix(containerd): keep task running when network setup fails
In containerd-in-docker mode, SetupNetwork fails because netns is
unavailable. Previously this killed the task, making stdio MCP tools
unusable. Now the task continues running with a warning log, since
stdio MCP communication does not require networking.
2026-02-13 01:50:59 +08:00
BBQ c7d66f89ab feat(bots): MCP add/import merge, batch select and batch delete/export 2026-02-13 01:11:40 +08:00
BBQ 3a1aa31611 fix(mcp): move import/export routes to /mcp-ops to avoid /:id conflict
Echo router treats /mcp/import and /mcp/export as /mcp/:id matches.
Move to /bots/:bot_id/mcp-ops/import and /mcp-ops/export.
2026-02-13 00:47:44 +08:00
BBQ 9dd7135820 refactor(mcp): standard mcpServers input format with type inference
- Accept standard mcpServers item format (command/args/env/url/headers)
- Auto-infer connection type: command -> stdio, url -> http/sse
- Add PUT /bots/:bot_id/mcp/import for batch import from mcpServers dict
- Add GET /bots/:bot_id/mcp/export for standard format export
- Add UpsertMCPConnectionByName SQL for import upsert by name
- Preserve is_active state on import upsert
2026-02-13 00:25:42 +08:00