Commit Graph

455 Commits

Author SHA1 Message Date
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
alexma233 e681eed3f3 feat(script): support more pm in containerd install 2026-02-12 16:58:25 +08:00
AlexMa233 81be665cc4 docs: fix manual deployment
Use steps in deploy.sh to replace wrong steps.
2026-02-12 16:46:45 +08:00
BBQ 30281742ef 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
2026-02-12 16:42:44 +08:00
Ran 818a48b406 Revert "docs(deploy): simplify deployment guide and update docker compose"
This reverts commit 86d53818a8.
2026-02-12 15:37:17 +08:00
晨苒 5b05f13f1a Merge pull request #36 from ix64/refactor/fx
refactor: using fx
2026-02-12 15:35:01 +08:00
BBQ ca5c6a1866 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
2026-02-12 15:34:40 +08:00
zenhouke 86d53818a8 docs(deploy): simplify deployment guide and update docker compose 2026-02-12 15:32:41 +08:00
BBQ 75e2ef0467 merge(github): merge github/main, resolve index.ts URL conflict
Keep our defensive absolute-URL check in createAuthFetcher.
2026-02-12 14:45:49 +08:00
Ran 01cb6c85db fix(deploy): many docker compose bug 2026-02-12 08:23:25 +08:00
BBQ d99ba38b7d merge(github): merge github/main, keep our code and docs/spec 2026-02-12 05:20:18 +08:00
Ran 35ce7d169d fix: some toolkit update 2026-02-12 04:02:00 +08:00
zenhouke 057e95cb9a refactor(deploy): consolidate configuration and reorganize docker files 2026-02-12 02:16:41 +08:00
晨苒 4de579b57b Merge pull request #39 from confuseder/main
fix: mistakes in agent's Dockerfile
2026-02-12 01:29:58 +08:00
盼兮 f4ff56bfcf fix: mistakes in agent's Dokcerfile 2026-02-12 01:10:53 +08:00
zenhouke 56ab5d3758 fix(deploy): remove example config and env setup from deployment 2026-02-12 00:08:16 +08:00
zenhouke 6ab2a6d6b5 fix(docker): update web service port mapping 2026-02-11 23:26:46 +08:00
Acbox a7544f85ae docs(fix): wrong markdown 2026-02-11 23:12:50 +08:00
Acbox d4d2015784 docs: update README 2026-02-11 23:11:16 +08:00
zenhouke d45487433c feat: add Docker Compose deployment support (#38)
- Add Docker Compose configuration for one-click deployment
- Add Dockerfiles for server, agent, and web services
- Add deployment script (deploy.sh) with automatic setup
- Add comprehensive deployment documentation (DEPLOYMENT.md)
- Use host Docker socket instead of DinD for better performance
- Add Nginx configuration for web frontend
- Add Makefile for common operations
- Update README with Docker deployment quick start

Features:
- One-command deployment with ./deploy.sh
- Automatic JWT secret generation
- Health checks for all services
- Data persistence with Docker volumes
- Support for Bot container management via host Docker
- Production-ready configuration examples

Co-authored-by: root <root@DESKTOP-OU6H3GS.localdomain>
2026-02-11 22:58:05 +08:00
BBQ 860e20fe70 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
2026-02-11 22:13:27 +08:00
Fodesu f8cd244d25 chore: add typos for spell check (#37) 2026-02-11 21:54:17 +08:00
Ran 065aa303e9 chore: update README.md 2026-02-11 20:00:07 +08:00