Commit Graph

277 Commits

Author SHA1 Message Date
Acbox f964cbca69 fix (docker): missing web keys in docker config 2026-02-14 20:45:33 +08:00
Acbox 1c85e0106f fix(docker): Dockerfile.web 2026-02-14 20:43:08 +08:00
Acbox 94d1cea488 fix(docker): Dockerfile.agent 2026-02-14 20:39:49 +08:00
Acbox ac8f857e27 feat(agent): put time-now header to the end of system prompt to increase the cache rate 2026-02-14 20:22:18 +08:00
Acbox f967c07e0a fix(web): tsconfig 2026-02-14 19:56:44 +08:00
Acbox b771238576 chore: add required config key 2026-02-14 19:52:31 +08:00
Acbox 82e9f12b7f refactor(web): change old port (7003) and deploy port (80) to port 8082 2026-02-14 19:51:55 +08:00
Ran 7817ec8147 fix(web): channel switch failure
Also add webui memory page
2026-02-14 07:30:21 +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 33e10f3738 docs: align README_CN with EN, fix CONTRIBUTING links to .github/CONTRIBUTING.md 2026-02-13 18:41:38 +08:00
BBQ fbc2ab7593 docs: improve README, DEPLOYMENT and move CONTRIBUTING
- README: emphasize Docker requirement with get-started link, move silent
  install under one-click and de-emphasize
- DEPLOYMENT: clarify default config path and that only config file is mounted
- Move CONTRIBUTING.md to .github/CONTRIBUTING.md (git mv)
2026-02-13 18:38:51 +08:00
BBQ 33d7662798 Merge pull request #45 from memohai/feat/containerd-in-docker
feat: containerd-in-docker deployment with core refactoring and MCP management
2026-02-13 18:14:15 +08:00
BBQ 243ea6f034 feat(web): add all supported provider client types to model selector 2026-02-13 18:02:30 +08:00
BBQ b3775f57a2 merge: resolve conflicts with github/main
- Remove uppercase Sidebar/index.vue (keep lowercase sidebar/)
- Keep HEAD imports for user-chat and settings/user.vue
2026-02-13 17:51:48 +08:00
BBQ 7b6490ebcd chore: update install script and docs to reference main branch 2026-02-13 17:49:00 +08:00
BBQ c08e34cbcc fix(web): persist tool call messages across page refresh
Tool call messages disappeared after page refresh because messageToChat()
filtered out messages without text content. Added convertMessagesToChats()
to merge consecutive assistant(tool_calls) + tool(results) + assistant(text)
into a single ChatMessage with ToolCallBlocks.
2026-02-13 17:42:29 +08:00
killpanda 49fe355123 fix: correct store import path case (#42) 2026-02-13 17:04:58 +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 2614763547 feat(web): parallel health checks and MCP form UX improvements
- Bot overview: fetch check keys first, then parallel-request each key
  independently with per-item loading spinner
- Stable check ordering via key-indexed placeholder array
- MCP form: replace flat command/url fields with Stdio/Remote tab
  switcher for clear mode selection
- MCP type labels: "Stdio (Local)" / "Remote (HTTP/SSE)"
2026-02-13 02:43:31 +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 df142e8439 docs: add troubleshooting for MCP image update not taking effect 2026-02-13 02:15:09 +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 f9be6baa4e fix(containerd): add pid:host for CNI netns access and runtime deps to MCP image
- Add pid: host to containerd service so server can access MCP container
  network namespaces via /proc/PID/ns/net for CNI setup
- Add Node.js, npm, Python 3, uv to embedded MCP image rootfs so users
  can run npx/uvx MCP servers inside containers
2026-02-13 01:55:11 +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 7e5612d474 refactor(i18n): move generic keys to common 2026-02-13 01:11:06 +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 944461f031 feat(mcp): add Node.js and Python runtime to MCP container image
- Install nodejs + npm (provides npx for JS/TS MCP servers)
- Install python3 + uv (provides uvx for Python MCP servers)
- Add bash and curl as base utilities
2026-02-13 00:41:00 +08:00
BBQ 7942df6a32 feat(web): implement bot MCP management page and remove global MCP page
- Add bot-mcp.vue component with table, create/edit dialog, import/export
- Wire MCP tab into bot detail page
- Remove dead global MCP page, composable, and form component (/mcp route)
- Add i18n keys for import/export/copy and MCP CRUD messages
- Fix store/User.ts case sensitivity for Linux builds
2026-02-13 00:40:53 +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
BBQ 85251a2905 refactor(core): codebase quality cleanup
- Remove user-level model settings (chat_model_id, memory_model_id,
  embedding_model_id, max_context_load_time, language) from users table
- Merge migration 0002 into 0001, remove compatibility migrations
- Delete dead conversation/resolver.go (1177 lines, only flow/resolver.go used)
- Remove type aliases (Chat=Conversation, types_alias.go)
- Fix SQL: remove AND false stub, fix UpdateChatTitle model_id,
  reset model IDs in DeleteSettings, add preauth expiry filter,
  add ListMessages limit, remove 10 dead queries
- Extract shared handler helpers (RequireChannelIdentityID, AuthorizeBotAccess)
- Rename internal/router to internal/channel/inbound
- Fix identity confusion: remove UserID->ChannelIdentityID fallbacks
- Fix all _ = var patterns with proper error logging
- Fix error propagation: storeMessages, rescheduleJob, botContainerID
- Fix naming: ModelId->ModelID, active->is_active, Duration semantic fix
- Remove dead code: mcpService, ReplyTarget, callMCPServer, sshShellQuote,
  buildSessionMetadata, ChatRequest.Language, TriggerPayload.ChatID
- Fix code quality: errors.Is(), remove goto, CreateHuman deprecated
- Remove Enable model endpoint and user-level settings CLI commands
- Regenerate sqlc, swagger, SDK
2026-02-12 23:50:48 +08:00
BBQ 57dd75ff52 refactor(memory): fix naming, dead code, error handling and AgentID support
Normalize JSON tags to snake_case, remove dead fusion branches and unused
struct fields, add proper error logging for BM25 operations, wire AgentID
through filters/store/retrieval, and replace goto with structured control flow.
2026-02-12 23:50:48 +08:00
BBQ c53d35740e feat(deploy): self-contained containerd with embedded MCP image
- Add Dockerfile.containerd: multi-stage build that compiles MCP binary,
  assembles rootfs, creates Docker image tar, and bundles it with containerd
- Add containerd-entrypoint.sh: auto-imports MCP image on first start
- Fix MCP image reference: rename busybox_image to image in config,
  use fully-qualified docker.io/library/memoh-mcp:latest everywhere
- Make image ref configurable via config.toml instead of hardcoded
- Simplify deploy.sh: remove manual nerdctl/containerd-install steps
2026-02-12 23:50:48 +08:00
BBQ e63d335c7e feat(deploy): add containerd-in-docker support for docker compose
Run containerd as a sidecar container instead of requiring host
containerd installation. Server mounts shared docker volumes for
containerd socket, data and state.
2026-02-12 23:50:48 +08:00
Acbox 67120cb582 fix: mcp 2026-02-12 23:43:09 +08:00
Acbox b4797f8c52 fix: web, skills tools 2026-02-12 23:32:23 +08:00
Acbox 287b024887 chore(web): remove @memoh/shared 2026-02-12 22:13:24 +08:00
BBQ 40bb171d48 fix(web): remove duplicate User.ts conflicting with user.ts on case-insensitive fs 2026-02-12 21:54:30 +08:00
BBQ f8633b7501 fix(web): rename Sidebar directory to lowercase for consistency
Rename components/Sidebar to components/sidebar and update import path.
2026-02-12 21:19:56 +08:00
BBQ 4823d164c6 Merge remote-tracking branch 'github/main' into refactor/conversation-channel-gateway-20260212
# Conflicts:
#	internal/chat/types.go
#	internal/conversation/flow/service.go
#	internal/conversation/flow/service_presence_integration_test.go
#	packages/web/src/components/Sidebar/index.vue
#	packages/web/src/utils/request.ts
2026-02-12 21:02:39 +08:00
BBQ 1c15eb2146 refactor(core): restructure conversation/channel/message domains and modernize deployment
- Replace chat package with conversation flow architecture
- Add channel identity avatar support (migration 0002)
- Refactor channel adapters, identities, and message routing
- Update frontend: simplify composables, modernize UI components
- Improve Docker builds with cache mounts and version metadata
- Optimize healthchecks and simplify service dependencies
2026-02-12 20:55:03 +08:00
Ran efe294d5ed Merge branch 'pr/40' 2026-02-12 17:24:24 +08:00
Ran d061f7ac50 chore: update DEVELOPMENT.md 2026-02-12 17:16:10 +08:00
Ran 6acdd191c7 Squashed commit of the following:
commit bcdb026ae43e4f95d0b2c4f9bd440a2df9d6b514
Author: Ran <16112591+chen-ran@users.noreply.github.com>
Date:   Thu Feb 12 17:10:32 2026 +0800

    chore: update DEVELOPMENT.md

commit 30281742ef
Merge: ca5c6a1 5b05f13
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Thu Feb 12 15:49:17 2026 +0800

    merge(github/main): integrate fx dependency injection framework

    Merge upstream fx refactor and adapt all services to use go.uber.org/fx
    for dependency injection. Resolve conflicts in main.go, server.go,
    and service constructors while preserving our domain model changes.

    - Fix telegram adapter panic on shutdown (double close channel)
    - Fix feishu adapter processing messages after stop
    - Increase directory lookup timeout from 2s to 5s

commit ca5c6a1866
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Thu Feb 12 15:33:09 2026 +0800

    refactor(core): restructure conversation, channel and message domains

    - Rename chat module to conversation with flow-based architecture
    - Move channelidentities into channel/identities subpackage
    - Add channel/route for routing logic
    - Add message service with event hub
    - Add MCP providers: container, directory, schedule
    - Refactor Feishu/Telegram adapters with directory and stream support
    - Add platform management page and channel badges in web UI
    - Update database schema for conversations, messages and channel routes
    - Add @memoh/shared package for cross-package type definitions

commit 75e2ef0467
Merge: d99ba38 01cb6c8
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Thu Feb 12 14:45:49 2026 +0800

    merge(github): merge github/main, resolve index.ts URL conflict

    Keep our defensive absolute-URL check in createAuthFetcher.

commit d99ba38b7d
Merge: 860e20f 35ce7d1
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Thu Feb 12 05:20:18 2026 +0800

    merge(github): merge github/main, keep our code and docs/spec

commit 860e20fe70
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Wed Feb 11 22:13:27 2026 +0800

    docs(docs): add concepts and style guides for VitePress site

    - Add concepts: identity-and-binding, index (en/zh)
    - Add style: terminology (en/zh)
    - Update index and zh/index
    - Update .vitepress/config.ts

commit a75fdb8040
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Wed Feb 11 17:37:16 2026 +0800

    refactor(mcp): standardize unified tool gateway on go-sdk

    Split business executors from federation sources and migrate unified tool/federation transports to the official go-sdk for stricter MCP compliance and safer session lifecycle handling. Add targeted regression tests for accept compatibility, initialization retries, pending cleanup, and include updated swagger artifacts.

commit 02b33c8e85
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Wed Feb 11 15:42:21 2026 +0800

    refactor(core): finalize user-centric identity and policy cleanup

    Unify auth and chat identity semantics around user_id, enforce personal-bot owner-only authorization, and remove legacy compatibility branches in integration tests.

commit 06e8619a37
Author: BBQ <bbq@BBQdeMacBook-Air.local>
Date:   Wed Feb 11 14:47:03 2026 +0800

    refactor(core): migrate channel identity and binding across app

    Align channel identity and bind flow across backend and app-facing layers, including generated swagger artifacts and package lock updates while excluding docs content changes.
2026-02-12 17:13:03 +08:00