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
This commit is contained in:
BBQ
2026-02-12 15:33:09 +08:00
parent 75e2ef0467
commit ca5c6a1866
243 changed files with 21463 additions and 10485 deletions
+142 -657
View File
@@ -1,5 +1,5 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
// Package spec Code generated by swaggo/swag. DO NOT EDIT
package spec
import "github.com/swaggo/swag"
@@ -261,489 +261,6 @@ const docTemplate = `{
}
}
},
"/bots/{bot_id}/container/fs": {
"get": {
"description": "List entries under a relative path",
"tags": [
"fs"
],
"summary": "List files for a bot",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative directory path",
"name": "path",
"in": "query"
},
{
"type": "boolean",
"description": "Recursive listing",
"name": "recursive",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"tags": [
"fs"
],
"summary": "Delete a file or directory",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative path",
"name": "path",
"in": "query",
"required": true
},
{
"type": "boolean",
"description": "Recursive delete for directories",
"name": "recursive",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSDeleteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs-mcp": {
"post": {
"description": "Forwards MCP JSON-RPC requests to the MCP server inside the container.\nRequired:\n- container task is running\n- container has data mount (default /data) bound to \u003cdata_root\u003e/users/\u003cuser_id\u003e\n- container image contains the \"mcp\" binary\nAuth: Bearer JWT is used to determine user_id (sub or user_id).\nPaths must be relative (no leading slash) and must not contain \"..\".\n\nExample: tools/list\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}\n\nExample: tools/call (fs.read)\n{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"fs.read\",\"arguments\":{\"path\":\"notes.txt\"}}}",
"tags": [
"containerd"
],
"summary": "MCP filesystem tools (JSON-RPC)",
"parameters": [
{
"type": "string",
"description": "Bearer \u003ctoken\u003e",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "JSON-RPC request",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "JSON-RPC response: {jsonrpc,id,result|error}",
"schema": {
"type": "object"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/dir": {
"post": {
"tags": [
"fs"
],
"summary": "Create a directory",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "Directory payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.FSMkdirRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/file": {
"get": {
"tags": [
"fs"
],
"summary": "Read file content",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative file path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSReadResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"tags": [
"fs"
],
"summary": "Create or overwrite a file",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "File write payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.FSWriteRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/stat": {
"get": {
"tags": [
"fs"
],
"summary": "Get file or directory metadata",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSStatResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/upload": {
"post": {
"tags": [
"fs"
],
"summary": "Upload a file",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative file path or directory",
"name": "path",
"in": "query"
},
{
"type": "file",
"description": "File to upload",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/usage": {
"get": {
"tags": [
"fs"
],
"summary": "Get usage under a path",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative directory path",
"name": "path",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSUsageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/skills": {
"get": {
"tags": [
@@ -1180,7 +697,7 @@ const docTemplate = `{
}
}
},
"/bots/{bot_id}/mcp-stdio/{session_id}": {
"/bots/{bot_id}/mcp-stdio/{connection_id}": {
"post": {
"description": "Proxies MCP JSON-RPC requests to a stdio MCP process in the container.",
"tags": [
@@ -1197,8 +714,8 @@ const docTemplate = `{
},
{
"type": "string",
"description": "Session ID",
"name": "session_id",
"description": "Connection ID",
"name": "connection_id",
"in": "path",
"required": true
},
@@ -2327,8 +1844,14 @@ const docTemplate = `{
}
],
"responses": {
"204": {
"description": "No Content"
"202": {
"description": "Accepted",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
@@ -2616,6 +2139,56 @@ const docTemplate = `{
}
}
},
"/bots/{id}/checks": {
"get": {
"description": "Evaluate bot attached resource checks in runtime",
"tags": [
"bots"
],
"summary": "List bot runtime checks",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/bots.ListChecksResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{id}/members": {
"get": {
"description": "List members for a bot",
@@ -4366,6 +3939,12 @@ const docTemplate = `{
"avatar_url": {
"type": "string"
},
"check_issue_count": {
"type": "integer"
},
"check_state": {
"type": "string"
},
"created_at": {
"type": "string"
},
@@ -4385,6 +3964,9 @@ const docTemplate = `{
"owner_user_id": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
},
@@ -4393,6 +3975,27 @@ const docTemplate = `{
}
}
},
"bots.BotCheck": {
"type": "object",
"properties": {
"check_key": {
"type": "string"
},
"detail": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"status": {
"type": "string"
},
"summary": {
"type": "string"
}
}
},
"bots.BotMember": {
"type": "object",
"properties": {
@@ -4442,6 +4045,17 @@ const docTemplate = `{
}
}
},
"bots.ListChecksResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/bots.BotCheck"
}
}
}
},
"bots.ListMembersResponse": {
"type": "object",
"properties": {
@@ -4529,9 +4143,15 @@ const docTemplate = `{
"name": {
"type": "string"
},
"platform_key": {
"type": "string"
},
"size": {
"type": "integer"
},
"source_platform": {
"type": "string"
},
"thumbnail_url": {
"type": "string"
},
@@ -4954,36 +4574,6 @@ const docTemplate = `{
}
}
},
"channelidentities.ChannelIdentity": {
"type": "object",
"properties": {
"channel": {
"type": "string"
},
"channel_subject_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"display_name": {
"type": "string"
},
"id": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"github_com_memohai_memoh_internal_mcp.Connection": {
"type": "object",
"properties": {
@@ -5043,9 +4633,6 @@ const docTemplate = `{
"handlers.CreateContainerRequest": {
"type": "object",
"properties": {
"image": {
"type": "string"
},
"snapshotter": {
"type": "string"
}
@@ -5186,138 +4773,6 @@ const docTemplate = `{
}
}
},
"handlers.FSDeleteResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"handlers.FSListResponse": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.FSRestEntry"
}
},
"path": {
"type": "string"
}
}
},
"handlers.FSMkdirRequest": {
"type": "object",
"properties": {
"parents": {
"type": "boolean"
},
"path": {
"type": "string"
}
}
},
"handlers.FSReadResponse": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSRestEntry": {
"type": "object",
"properties": {
"is_dir": {
"type": "boolean"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSStatResponse": {
"type": "object",
"properties": {
"is_dir": {
"type": "boolean"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSUsageResponse": {
"type": "object",
"properties": {
"dir_count": {
"type": "integer"
},
"file_count": {
"type": "integer"
},
"path": {
"type": "string"
},
"total_bytes": {
"type": "integer"
}
}
},
"handlers.FSWriteRequest": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"overwrite": {
"type": "boolean"
},
"path": {
"type": "string"
}
}
},
"handlers.FSWriteResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"handlers.GetContainerResponse": {
"type": "object",
"properties": {
@@ -5430,7 +4885,7 @@ const docTemplate = `{
"handlers.MCPStdioResponse": {
"type": "object",
"properties": {
"session_id": {
"connection_id": {
"type": "string"
},
"tools": {
@@ -5530,7 +4985,7 @@ const docTemplate = `{
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/channelidentities.ChannelIdentity"
"$ref": "#/definitions/identities.ChannelIdentity"
}
},
"user_id": {
@@ -5546,6 +5001,36 @@ const docTemplate = `{
}
}
},
"identities.ChannelIdentity": {
"type": "object",
"properties": {
"channel": {
"type": "string"
},
"channel_subject_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"display_name": {
"type": "string"
},
"id": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"mcp.ListResponse": {
"type": "object",
"properties": {
+140 -655
View File
@@ -252,489 +252,6 @@
}
}
},
"/bots/{bot_id}/container/fs": {
"get": {
"description": "List entries under a relative path",
"tags": [
"fs"
],
"summary": "List files for a bot",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative directory path",
"name": "path",
"in": "query"
},
{
"type": "boolean",
"description": "Recursive listing",
"name": "recursive",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"tags": [
"fs"
],
"summary": "Delete a file or directory",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative path",
"name": "path",
"in": "query",
"required": true
},
{
"type": "boolean",
"description": "Recursive delete for directories",
"name": "recursive",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSDeleteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs-mcp": {
"post": {
"description": "Forwards MCP JSON-RPC requests to the MCP server inside the container.\nRequired:\n- container task is running\n- container has data mount (default /data) bound to \u003cdata_root\u003e/users/\u003cuser_id\u003e\n- container image contains the \"mcp\" binary\nAuth: Bearer JWT is used to determine user_id (sub or user_id).\nPaths must be relative (no leading slash) and must not contain \"..\".\n\nExample: tools/list\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}\n\nExample: tools/call (fs.read)\n{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"fs.read\",\"arguments\":{\"path\":\"notes.txt\"}}}",
"tags": [
"containerd"
],
"summary": "MCP filesystem tools (JSON-RPC)",
"parameters": [
{
"type": "string",
"description": "Bearer \u003ctoken\u003e",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "JSON-RPC request",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "JSON-RPC response: {jsonrpc,id,result|error}",
"schema": {
"type": "object"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/dir": {
"post": {
"tags": [
"fs"
],
"summary": "Create a directory",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "Directory payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.FSMkdirRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/file": {
"get": {
"tags": [
"fs"
],
"summary": "Read file content",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative file path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSReadResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"tags": [
"fs"
],
"summary": "Create or overwrite a file",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"description": "File write payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.FSWriteRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/stat": {
"get": {
"tags": [
"fs"
],
"summary": "Get file or directory metadata",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSStatResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/upload": {
"post": {
"tags": [
"fs"
],
"summary": "Upload a file",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative file path or directory",
"name": "path",
"in": "query"
},
{
"type": "file",
"description": "File to upload",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSWriteResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/fs/usage": {
"get": {
"tags": [
"fs"
],
"summary": "Get usage under a path",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Relative directory path",
"name": "path",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FSUsageResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/skills": {
"get": {
"tags": [
@@ -1171,7 +688,7 @@
}
}
},
"/bots/{bot_id}/mcp-stdio/{session_id}": {
"/bots/{bot_id}/mcp-stdio/{connection_id}": {
"post": {
"description": "Proxies MCP JSON-RPC requests to a stdio MCP process in the container.",
"tags": [
@@ -1188,8 +705,8 @@
},
{
"type": "string",
"description": "Session ID",
"name": "session_id",
"description": "Connection ID",
"name": "connection_id",
"in": "path",
"required": true
},
@@ -2318,8 +1835,14 @@
}
],
"responses": {
"204": {
"description": "No Content"
"202": {
"description": "Accepted",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
@@ -2607,6 +2130,56 @@
}
}
},
"/bots/{id}/checks": {
"get": {
"description": "Evaluate bot attached resource checks in runtime",
"tags": [
"bots"
],
"summary": "List bot runtime checks",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/bots.ListChecksResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{id}/members": {
"get": {
"description": "List members for a bot",
@@ -4357,6 +3930,12 @@
"avatar_url": {
"type": "string"
},
"check_issue_count": {
"type": "integer"
},
"check_state": {
"type": "string"
},
"created_at": {
"type": "string"
},
@@ -4376,6 +3955,9 @@
"owner_user_id": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
},
@@ -4384,6 +3966,27 @@
}
}
},
"bots.BotCheck": {
"type": "object",
"properties": {
"check_key": {
"type": "string"
},
"detail": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"status": {
"type": "string"
},
"summary": {
"type": "string"
}
}
},
"bots.BotMember": {
"type": "object",
"properties": {
@@ -4433,6 +4036,17 @@
}
}
},
"bots.ListChecksResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/bots.BotCheck"
}
}
}
},
"bots.ListMembersResponse": {
"type": "object",
"properties": {
@@ -4520,9 +4134,15 @@
"name": {
"type": "string"
},
"platform_key": {
"type": "string"
},
"size": {
"type": "integer"
},
"source_platform": {
"type": "string"
},
"thumbnail_url": {
"type": "string"
},
@@ -4945,36 +4565,6 @@
}
}
},
"channelidentities.ChannelIdentity": {
"type": "object",
"properties": {
"channel": {
"type": "string"
},
"channel_subject_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"display_name": {
"type": "string"
},
"id": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"github_com_memohai_memoh_internal_mcp.Connection": {
"type": "object",
"properties": {
@@ -5034,9 +4624,6 @@
"handlers.CreateContainerRequest": {
"type": "object",
"properties": {
"image": {
"type": "string"
},
"snapshotter": {
"type": "string"
}
@@ -5177,138 +4764,6 @@
}
}
},
"handlers.FSDeleteResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"handlers.FSListResponse": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.FSRestEntry"
}
},
"path": {
"type": "string"
}
}
},
"handlers.FSMkdirRequest": {
"type": "object",
"properties": {
"parents": {
"type": "boolean"
},
"path": {
"type": "string"
}
}
},
"handlers.FSReadResponse": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSRestEntry": {
"type": "object",
"properties": {
"is_dir": {
"type": "boolean"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSStatResponse": {
"type": "object",
"properties": {
"is_dir": {
"type": "boolean"
},
"mod_time": {
"type": "string"
},
"mode": {
"type": "integer"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"handlers.FSUsageResponse": {
"type": "object",
"properties": {
"dir_count": {
"type": "integer"
},
"file_count": {
"type": "integer"
},
"path": {
"type": "string"
},
"total_bytes": {
"type": "integer"
}
}
},
"handlers.FSWriteRequest": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"overwrite": {
"type": "boolean"
},
"path": {
"type": "string"
}
}
},
"handlers.FSWriteResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
},
"handlers.GetContainerResponse": {
"type": "object",
"properties": {
@@ -5421,7 +4876,7 @@
"handlers.MCPStdioResponse": {
"type": "object",
"properties": {
"session_id": {
"connection_id": {
"type": "string"
},
"tools": {
@@ -5521,7 +4976,7 @@
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/channelidentities.ChannelIdentity"
"$ref": "#/definitions/identities.ChannelIdentity"
}
},
"user_id": {
@@ -5537,6 +4992,36 @@
}
}
},
"identities.ChannelIdentity": {
"type": "object",
"properties": {
"channel": {
"type": "string"
},
"channel_subject_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"display_name": {
"type": "string"
},
"id": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"mcp.ListResponse": {
"type": "object",
"properties": {
+95 -446
View File
@@ -80,6 +80,10 @@ definitions:
properties:
avatar_url:
type: string
check_issue_count:
type: integer
check_state:
type: string
created_at:
type: string
display_name:
@@ -93,11 +97,27 @@ definitions:
type: object
owner_user_id:
type: string
status:
type: string
type:
type: string
updated_at:
type: string
type: object
bots.BotCheck:
properties:
check_key:
type: string
detail:
type: string
metadata:
additionalProperties: {}
type: object
status:
type: string
summary:
type: string
type: object
bots.BotMember:
properties:
bot_id:
@@ -130,6 +150,13 @@ definitions:
$ref: '#/definitions/bots.Bot'
type: array
type: object
bots.ListChecksResponse:
properties:
items:
items:
$ref: '#/definitions/bots.BotCheck'
type: array
type: object
bots.ListMembersResponse:
properties:
items:
@@ -187,8 +214,12 @@ definitions:
type: string
name:
type: string
platform_key:
type: string
size:
type: integer
source_platform:
type: string
thumbnail_url:
type: string
type:
@@ -481,26 +512,6 @@ definitions:
verified_at:
type: string
type: object
channelidentities.ChannelIdentity:
properties:
channel:
type: string
channel_subject_id:
type: string
created_at:
type: string
display_name:
type: string
id:
type: string
metadata:
additionalProperties: {}
type: object
updated_at:
type: string
user_id:
type: string
type: object
github_com_memohai_memoh_internal_mcp.Connection:
properties:
active:
@@ -540,8 +551,6 @@ definitions:
type: object
handlers.CreateContainerRequest:
properties:
image:
type: string
snapshotter:
type: string
type: object
@@ -632,91 +641,6 @@ definitions:
message:
type: string
type: object
handlers.FSDeleteResponse:
properties:
ok:
type: boolean
type: object
handlers.FSListResponse:
properties:
entries:
items:
$ref: '#/definitions/handlers.FSRestEntry'
type: array
path:
type: string
type: object
handlers.FSMkdirRequest:
properties:
parents:
type: boolean
path:
type: string
type: object
handlers.FSReadResponse:
properties:
content:
type: string
mod_time:
type: string
mode:
type: integer
path:
type: string
size:
type: integer
type: object
handlers.FSRestEntry:
properties:
is_dir:
type: boolean
mod_time:
type: string
mode:
type: integer
path:
type: string
size:
type: integer
type: object
handlers.FSStatResponse:
properties:
is_dir:
type: boolean
mod_time:
type: string
mode:
type: integer
path:
type: string
size:
type: integer
type: object
handlers.FSUsageResponse:
properties:
dir_count:
type: integer
file_count:
type: integer
path:
type: string
total_bytes:
type: integer
type: object
handlers.FSWriteRequest:
properties:
content:
type: string
overwrite:
type: boolean
path:
type: string
type: object
handlers.FSWriteResponse:
properties:
ok:
type: boolean
type: object
handlers.GetContainerResponse:
properties:
container_id:
@@ -790,7 +714,7 @@ definitions:
type: object
handlers.MCPStdioResponse:
properties:
session_id:
connection_id:
type: string
tools:
items:
@@ -855,7 +779,7 @@ definitions:
properties:
items:
items:
$ref: '#/definitions/channelidentities.ChannelIdentity'
$ref: '#/definitions/identities.ChannelIdentity'
type: array
user_id:
type: string
@@ -865,6 +789,26 @@ definitions:
ok:
type: boolean
type: object
identities.ChannelIdentity:
properties:
channel:
type: string
channel_subject_id:
type: string
created_at:
type: string
display_name:
type: string
id:
type: string
metadata:
additionalProperties: {}
type: object
updated_at:
type: string
user_id:
type: string
type: object
mcp.ListResponse:
properties:
items:
@@ -1402,338 +1346,6 @@ paths:
summary: Create and start MCP container for bot
tags:
- containerd
/bots/{bot_id}/container/fs:
delete:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative path
in: query
name: path
required: true
type: string
- description: Recursive delete for directories
in: query
name: recursive
type: boolean
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSDeleteResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Delete a file or directory
tags:
- fs
get:
description: List entries under a relative path
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative directory path
in: query
name: path
type: string
- description: Recursive listing
in: query
name: recursive
type: boolean
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSListResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List files for a bot
tags:
- fs
/bots/{bot_id}/container/fs-mcp:
post:
description: |-
Forwards MCP JSON-RPC requests to the MCP server inside the container.
Required:
- container task is running
- container has data mount (default /data) bound to <data_root>/users/<user_id>
- container image contains the "mcp" binary
Auth: Bearer JWT is used to determine user_id (sub or user_id).
Paths must be relative (no leading slash) and must not contain "..".
Example: tools/list
{"jsonrpc":"2.0","id":1,"method":"tools/list"}
Example: tools/call (fs.read)
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"fs.read","arguments":{"path":"notes.txt"}}}
parameters:
- description: Bearer <token>
in: header
name: Authorization
required: true
type: string
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: JSON-RPC request
in: body
name: payload
required: true
schema:
type: object
responses:
"200":
description: 'JSON-RPC response: {jsonrpc,id,result|error}'
schema:
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: MCP filesystem tools (JSON-RPC)
tags:
- containerd
/bots/{bot_id}/container/fs/dir:
post:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Directory payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/handlers.FSMkdirRequest'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSWriteResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Create a directory
tags:
- fs
/bots/{bot_id}/container/fs/file:
get:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative file path
in: query
name: path
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSReadResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Read file content
tags:
- fs
post:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: File write payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/handlers.FSWriteRequest'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSWriteResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"409":
description: Conflict
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Create or overwrite a file
tags:
- fs
/bots/{bot_id}/container/fs/stat:
get:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative path
in: query
name: path
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSStatResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get file or directory metadata
tags:
- fs
/bots/{bot_id}/container/fs/upload:
post:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative file path or directory
in: query
name: path
type: string
- description: File to upload
in: formData
name: file
required: true
type: file
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSWriteResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Upload a file
tags:
- fs
/bots/{bot_id}/container/fs/usage:
get:
parameters:
- description: Bot ID
in: path
name: bot_id
required: true
type: string
- description: Relative directory path
in: query
name: path
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FSUsageResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get usage under a path
tags:
- fs
/bots/{bot_id}/container/skills:
delete:
parameters:
@@ -2021,7 +1633,7 @@ paths:
summary: Create MCP stdio proxy
tags:
- containerd
/bots/{bot_id}/mcp-stdio/{session_id}:
/bots/{bot_id}/mcp-stdio/{connection_id}:
post:
description: Proxies MCP JSON-RPC requests to a stdio MCP process in the container.
parameters:
@@ -2030,9 +1642,9 @@ paths:
name: bot_id
required: true
type: string
- description: Session ID
- description: Connection ID
in: path
name: session_id
name: connection_id
required: true
type: string
- description: JSON-RPC request
@@ -2710,8 +2322,12 @@ paths:
required: true
type: string
responses:
"204":
description: No Content
"202":
description: Accepted
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
@@ -2974,6 +2590,39 @@ paths:
summary: Send message via bot channel session token
tags:
- bots
/bots/{id}/checks:
get:
description: Evaluate bot attached resource checks in runtime
parameters:
- description: Bot ID
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/bots.ListChecksResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List bot runtime checks
tags:
- bots
/bots/{id}/members:
get:
description: List members for a bot