diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker.yml similarity index 86% rename from .github/workflows/docker-publish.yml rename to .github/workflows/docker.yml index 829a87e3..43fd5f0c 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker.yml @@ -1,8 +1,13 @@ -name: Docker Publish +name: Docker on: push: + branches: [main] tags: ["v*.*.*"] + paths-ignore: + - "docs/**" + - "**.md" + - "devenv/**" pull_request: branches: [main] paths-ignore: @@ -46,6 +51,7 @@ jobs: memohai/${{ matrix.image }} ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} tags: | + type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, '-') }} type=ref,event=pr type=semver,pattern={{version}} @@ -58,20 +64,21 @@ jobs: org.opencontainers.image.vendor=memohai - name: Set up QEMU + if: startsWith(github.ref, 'refs/tags/') uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - if: startsWith(github.ref, 'refs/tags/') + if: github.event_name == 'push' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - if: startsWith(github.ref, 'refs/tags/') + if: github.event_name == 'push' uses: docker/login-action@v3 with: registry: ghcr.io @@ -83,7 +90,7 @@ jobs: with: context: . file: ${{ matrix.dockerfile }} - push: ${{ startsWith(github.ref, 'refs/tags/') }} + push: ${{ github.event_name == 'push' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} @@ -93,7 +100,7 @@ jobs: BUILD_TIME=${{ fromJson(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} VITE_API_URL=/api VITE_AGENT_URL=/agent - provenance: true - sbom: true + provenance: ${{ startsWith(github.ref, 'refs/tags/') }} + sbom: ${{ startsWith(github.ref, 'refs/tags/') }} cache-from: type=gha,scope=${{ matrix.image }} cache-to: type=gha,scope=${{ matrix.image }},mode=max diff --git a/.github/workflows/ci.yml b/.github/workflows/migrations.yml similarity index 96% rename from .github/workflows/ci.yml rename to .github/workflows/migrations.yml index 1810e3aa..7dae62ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/migrations.yml @@ -1,4 +1,4 @@ -name: CI +name: Migrations on: push: @@ -11,7 +11,7 @@ on: - "db/migrations/**" concurrency: - group: ci-${{ github.ref }} + group: migrations-${{ github.ref }} cancel-in-progress: true permissions: diff --git a/db/migrations/0001_init.up.sql b/db/migrations/0001_init.up.sql index 0fd77373..9271ddd2 100644 --- a/db/migrations/0001_init.up.sql +++ b/db/migrations/0001_init.up.sql @@ -346,6 +346,7 @@ CREATE TABLE IF NOT EXISTS subagents ( messages JSONB NOT NULL DEFAULT '[]'::jsonb, metadata JSONB NOT NULL DEFAULT '{}'::jsonb, skills JSONB NOT NULL DEFAULT '[]'::jsonb, + usage JSONB NOT NULL DEFAULT '{}'::jsonb, CONSTRAINT subagents_name_unique UNIQUE (bot_id, name) ); diff --git a/db/migrations/0012_subagent_usage.down.sql b/db/migrations/0012_subagent_usage.down.sql new file mode 100644 index 00000000..d55faa5f --- /dev/null +++ b/db/migrations/0012_subagent_usage.down.sql @@ -0,0 +1,5 @@ +-- 0012_subagent_usage (rollback) +-- Remove usage column from subagents table. + +ALTER TABLE subagents DROP COLUMN IF EXISTS usage; + diff --git a/db/migrations/0012_subagent_usage.up.sql b/db/migrations/0012_subagent_usage.up.sql new file mode 100644 index 00000000..717c97aa --- /dev/null +++ b/db/migrations/0012_subagent_usage.up.sql @@ -0,0 +1,5 @@ +-- 0012_subagent_usage +-- Add usage JSONB column to subagents table for tracking cumulative token usage. + +ALTER TABLE subagents ADD COLUMN IF NOT EXISTS usage JSONB NOT NULL DEFAULT '{}'::jsonb; + diff --git a/db/queries/subagents.sql b/db/queries/subagents.sql index 3a913334..979d3369 100644 --- a/db/queries/subagents.sql +++ b/db/queries/subagents.sql @@ -1,15 +1,20 @@ -- name: CreateSubagent :one INSERT INTO subagents (name, description, bot_id, messages, metadata, skills) VALUES ($1, $2, $3, $4, $5, $6) -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills; +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage; -- name: GetSubagentByID :one -SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage FROM subagents WHERE id = $1 AND deleted = false; +-- name: GetSubagentByBotAndName :one +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage +FROM subagents +WHERE bot_id = $1 AND name = $2 AND deleted = false; + -- name: ListSubagentsByBot :many -SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage FROM subagents WHERE bot_id = $1 AND deleted = false ORDER BY created_at DESC; @@ -21,21 +26,29 @@ SET name = $2, metadata = $4, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills; +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage; -- name: UpdateSubagentMessages :one UPDATE subagents SET messages = $2, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills; +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage; + +-- name: UpdateSubagentMessagesAndUsage :one +UPDATE subagents +SET messages = $2, + usage = $3, + updated_at = now() +WHERE id = $1 AND deleted = false +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage; -- name: UpdateSubagentSkills :one UPDATE subagents SET skills = $2, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills; +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage; -- name: SoftDeleteSubagent :exec UPDATE subagents @@ -43,4 +56,3 @@ SET deleted = true, deleted_at = now(), updated_at = now() WHERE id = $1 AND deleted = false; - diff --git a/internal/db/sqlc/models.go b/internal/db/sqlc/models.go index 02ecf3a1..f609b9b5 100644 --- a/internal/db/sqlc/models.go +++ b/internal/db/sqlc/models.go @@ -291,6 +291,7 @@ type Subagent struct { Messages []byte `json:"messages"` Metadata []byte `json:"metadata"` Skills []byte `json:"skills"` + Usage []byte `json:"usage"` } type User struct { diff --git a/internal/db/sqlc/subagents.sql.go b/internal/db/sqlc/subagents.sql.go index d49528b5..f2559a1f 100644 --- a/internal/db/sqlc/subagents.sql.go +++ b/internal/db/sqlc/subagents.sql.go @@ -14,7 +14,7 @@ import ( const createSubagent = `-- name: CreateSubagent :one INSERT INTO subagents (name, description, bot_id, messages, metadata, skills) VALUES ($1, $2, $3, $4, $5, $6) -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage ` type CreateSubagentParams struct { @@ -48,12 +48,44 @@ func (q *Queries) CreateSubagent(ctx context.Context, arg CreateSubagentParams) &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, + ) + return i, err +} + +const getSubagentByBotAndName = `-- name: GetSubagentByBotAndName :one +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage +FROM subagents +WHERE bot_id = $1 AND name = $2 AND deleted = false +` + +type GetSubagentByBotAndNameParams struct { + BotID pgtype.UUID `json:"bot_id"` + Name string `json:"name"` +} + +func (q *Queries) GetSubagentByBotAndName(ctx context.Context, arg GetSubagentByBotAndNameParams) (Subagent, error) { + row := q.db.QueryRow(ctx, getSubagentByBotAndName, arg.BotID, arg.Name) + var i Subagent + err := row.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.CreatedAt, + &i.UpdatedAt, + &i.Deleted, + &i.DeletedAt, + &i.BotID, + &i.Messages, + &i.Metadata, + &i.Skills, + &i.Usage, ) return i, err } const getSubagentByID = `-- name: GetSubagentByID :one -SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage FROM subagents WHERE id = $1 AND deleted = false ` @@ -73,12 +105,13 @@ func (q *Queries) GetSubagentByID(ctx context.Context, id pgtype.UUID) (Subagent &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, ) return i, err } const listSubagentsByBot = `-- name: ListSubagentsByBot :many -SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +SELECT id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage FROM subagents WHERE bot_id = $1 AND deleted = false ORDER BY created_at DESC @@ -105,6 +138,7 @@ func (q *Queries) ListSubagentsByBot(ctx context.Context, botID pgtype.UUID) ([] &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, ); err != nil { return nil, err } @@ -136,7 +170,7 @@ SET name = $2, metadata = $4, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage ` type UpdateSubagentParams struct { @@ -166,6 +200,7 @@ func (q *Queries) UpdateSubagent(ctx context.Context, arg UpdateSubagentParams) &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, ) return i, err } @@ -175,7 +210,7 @@ UPDATE subagents SET messages = $2, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage ` type UpdateSubagentMessagesParams struct { @@ -198,6 +233,42 @@ func (q *Queries) UpdateSubagentMessages(ctx context.Context, arg UpdateSubagent &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, + ) + return i, err +} + +const updateSubagentMessagesAndUsage = `-- name: UpdateSubagentMessagesAndUsage :one +UPDATE subagents +SET messages = $2, + usage = $3, + updated_at = now() +WHERE id = $1 AND deleted = false +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage +` + +type UpdateSubagentMessagesAndUsageParams struct { + ID pgtype.UUID `json:"id"` + Messages []byte `json:"messages"` + Usage []byte `json:"usage"` +} + +func (q *Queries) UpdateSubagentMessagesAndUsage(ctx context.Context, arg UpdateSubagentMessagesAndUsageParams) (Subagent, error) { + row := q.db.QueryRow(ctx, updateSubagentMessagesAndUsage, arg.ID, arg.Messages, arg.Usage) + var i Subagent + err := row.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.CreatedAt, + &i.UpdatedAt, + &i.Deleted, + &i.DeletedAt, + &i.BotID, + &i.Messages, + &i.Metadata, + &i.Skills, + &i.Usage, ) return i, err } @@ -207,7 +278,7 @@ UPDATE subagents SET skills = $2, updated_at = now() WHERE id = $1 AND deleted = false -RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills +RETURNING id, name, description, created_at, updated_at, deleted, deleted_at, bot_id, messages, metadata, skills, usage ` type UpdateSubagentSkillsParams struct { @@ -230,6 +301,7 @@ func (q *Queries) UpdateSubagentSkills(ctx context.Context, arg UpdateSubagentSk &i.Messages, &i.Metadata, &i.Skills, + &i.Usage, ) return i, err } diff --git a/internal/handlers/containerd.go b/internal/handlers/containerd.go index b21c58df..dc56ca94 100644 --- a/internal/handlers/containerd.go +++ b/internal/handlers/containerd.go @@ -132,6 +132,16 @@ func (h *ContainerdHandler) Register(e *echo.Echo) { group.GET("/skills", h.ListSkills) group.POST("/skills", h.UpsertSkills) group.DELETE("/skills", h.DeleteSkills) + // File manager routes + group.GET("/fs", h.FSStat) + group.GET("/fs/list", h.FSList) + group.GET("/fs/read", h.FSRead) + group.GET("/fs/download", h.FSDownload) + group.POST("/fs/write", h.FSWrite) + group.POST("/fs/upload", h.FSUpload) + group.POST("/fs/mkdir", h.FSMkdir) + group.POST("/fs/delete", h.FSDelete) + group.POST("/fs/rename", h.FSRename) root := e.Group("/bots/:bot_id") root.POST("/mcp-stdio", h.CreateMCPStdio) root.POST("/mcp-stdio/:connection_id", h.HandleMCPStdio) diff --git a/internal/handlers/filemanager.go b/internal/handlers/filemanager.go new file mode 100644 index 00000000..9789ebef --- /dev/null +++ b/internal/handlers/filemanager.go @@ -0,0 +1,729 @@ +package handlers + +import ( + "bytes" + "context" + "encoding/base64" + "fmt" + "io" + "mime" + "net/http" + "os" + "path/filepath" + "strings" + "time" + + "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/labstack/echo/v4" + + "github.com/memohai/memoh/internal/config" + ctr "github.com/memohai/memoh/internal/containerd" + "github.com/memohai/memoh/internal/db" + "github.com/memohai/memoh/internal/mcp" +) + +// ---------- request / response types ---------- + +// FSFileInfo describes a file or directory entry. +type FSFileInfo struct { + Name string `json:"name"` + Path string `json:"path"` + Size int64 `json:"size"` + Mode string `json:"mode"` + ModTime string `json:"modTime"` + IsDir bool `json:"isDir"` +} + +// FSListResponse is the response for a directory listing. +type FSListResponse struct { + Path string `json:"path"` + Entries []FSFileInfo `json:"entries"` +} + +// FSReadResponse is the response when reading text content. +type FSReadResponse struct { + Path string `json:"path"` + Content string `json:"content"` + Size int64 `json:"size"` +} + +// FSWriteRequest is the body for creating / overwriting a file. +type FSWriteRequest struct { + Path string `json:"path"` + Content string `json:"content"` +} + +// FSUploadResponse is returned after a successful upload. +type FSUploadResponse struct { + Path string `json:"path"` + Size int64 `json:"size"` +} + +// FSMkdirRequest is the body for creating a directory. +type FSMkdirRequest struct { + Path string `json:"path"` +} + +// FSDeleteRequest is the body for deleting a file or directory. +type FSDeleteRequest struct { + Path string `json:"path"` + Recursive bool `json:"recursive"` +} + +// FSRenameRequest is the body for renaming / moving an entry. +type FSRenameRequest struct { + OldPath string `json:"oldPath"` + NewPath string `json:"newPath"` +} + +type fsOpResponse struct { + OK bool `json:"ok"` +} + +// ---------- path resolution ---------- + +// fsPathContext holds the resolved host path for a container-relative path, +// or indicates that exec-based fallback is required. +type fsPathContext struct { + // containerPath is the cleaned absolute path inside the container. + containerPath string + // hostPath is set when the path lives under the data mount and can be + // served directly from the host filesystem. + hostPath string + // insideDataMount is true when containerPath is within the data mount. + insideDataMount bool +} + +// resolveContainerPath maps a container-internal path to a host path when +// possible (i.e. within the data mount), otherwise returns a context that +// tells the caller to use exec-based fallback. +func (h *ContainerdHandler) resolveContainerPath(botID, rawPath string) (fsPathContext, error) { + containerPath := filepath.Clean("/" + strings.TrimSpace(rawPath)) + if containerPath == "" { + containerPath = "/" + } + + dataMount := strings.TrimSpace(h.cfg.DataMount) + if dataMount == "" { + dataMount = config.DefaultDataMount + } + dataMount = filepath.Clean(dataMount) + + // Check whether the requested path falls under the data mount. + if containerPath == dataMount || strings.HasPrefix(containerPath, dataMount+"/") { + hostRoot, err := h.ensureBotDataRoot(botID) + if err != nil { + return fsPathContext{}, err + } + relPath := strings.TrimPrefix(containerPath, dataMount) + if relPath == "" { + relPath = "/" + } + hostPath := filepath.Join(hostRoot, filepath.FromSlash(relPath)) + + // Prevent path traversal: resolved path must stay under hostRoot. + hostPath = filepath.Clean(hostPath) + if !strings.HasPrefix(hostPath, hostRoot) { + return fsPathContext{}, fmt.Errorf("path traversal detected") + } + + return fsPathContext{ + containerPath: containerPath, + hostPath: hostPath, + insideDataMount: true, + }, nil + } + + // Outside data mount – exec fallback only. + return fsPathContext{ + containerPath: containerPath, + insideDataMount: false, + }, nil +} + +// resolveContainerID returns the containerd container ID for a given bot. +func (h *ContainerdHandler) resolveContainerIDForFS(botID string) string { + if h.queries != nil { + pgBotID, err := db.ParseUUID(botID) + if err == nil { + row, dbErr := h.queries.GetContainerByBotID(h.fsContext(), pgBotID) + if dbErr == nil && strings.TrimSpace(row.ContainerID) != "" { + return row.ContainerID + } + } + } + return mcp.ContainerPrefix + botID +} + +func (h *ContainerdHandler) fsContext() context.Context { + ctx := context.Background() + if strings.TrimSpace(h.namespace) != "" { + ctx = namespaces.WithNamespace(ctx, h.namespace) + } + return ctx +} + +// execRead runs a command inside the container and returns stdout as bytes. +func (h *ContainerdHandler) execRead(botID string, args []string) ([]byte, error) { + containerID := h.resolveContainerIDForFS(botID) + var stdout bytes.Buffer + var stderr bytes.Buffer + result, err := h.service.ExecTask(h.fsContext(), containerID, ctr.ExecTaskRequest{ + Args: args, + Stdout: &stdout, + Stderr: &stderr, + }) + if err != nil { + return nil, fmt.Errorf("exec failed: %w", err) + } + if result.ExitCode != 0 { + errMsg := strings.TrimSpace(stderr.String()) + if errMsg == "" { + errMsg = fmt.Sprintf("exit code %d", result.ExitCode) + } + return nil, fmt.Errorf("command failed: %s", errMsg) + } + return stdout.Bytes(), nil +} + +// ---------- handlers ---------- + +// FSStat godoc +// @Summary Get file or directory info +// @Description Returns metadata about a file or directory at the given container path +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param path query string true "Container path" +// @Success 200 {object} FSFileInfo +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs [get] +func (h *ContainerdHandler) FSStat(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + rawPath := c.QueryParam("path") + if strings.TrimSpace(rawPath) == "" { + rawPath = "/" + } + + pc, err := h.resolveContainerPath(botID, rawPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + + if pc.insideDataMount { + info, osErr := os.Stat(pc.hostPath) + if osErr != nil { + if os.IsNotExist(osErr) { + return echo.NewHTTPError(http.StatusNotFound, "not found") + } + return echo.NewHTTPError(http.StatusInternalServerError, osErr.Error()) + } + return c.JSON(http.StatusOK, osFileInfoToFS(pc.containerPath, info)) + } + + // Exec fallback. + out, err := h.execRead(botID, []string{"stat", "-c", `%n|%s|%a|%Y|%F`, pc.containerPath}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + fi, parseErr := parseStatLine(pc.containerPath, strings.TrimSpace(string(out))) + if parseErr != nil { + return echo.NewHTTPError(http.StatusInternalServerError, parseErr.Error()) + } + return c.JSON(http.StatusOK, fi) +} + +// FSList godoc +// @Summary List directory contents +// @Description Lists files and directories at the given container path +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param path query string true "Container directory path" +// @Success 200 {object} FSListResponse +// @Failure 400 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/list [get] +func (h *ContainerdHandler) FSList(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + rawPath := c.QueryParam("path") + if strings.TrimSpace(rawPath) == "" { + rawPath = "/" + } + + pc, err := h.resolveContainerPath(botID, rawPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + + if pc.insideDataMount { + dirEntries, osErr := os.ReadDir(pc.hostPath) + if osErr != nil { + if os.IsNotExist(osErr) { + return echo.NewHTTPError(http.StatusNotFound, "directory not found") + } + return echo.NewHTTPError(http.StatusInternalServerError, osErr.Error()) + } + entries := make([]FSFileInfo, 0, len(dirEntries)) + for _, de := range dirEntries { + info, infoErr := de.Info() + if infoErr != nil { + continue + } + childPath := filepath.Join(pc.containerPath, de.Name()) + entries = append(entries, osFileInfoToFS(childPath, info)) + } + return c.JSON(http.StatusOK, FSListResponse{Path: pc.containerPath, Entries: entries}) + } + + // Exec fallback. + out, err := h.execRead(botID, []string{"ls", "-1a", pc.containerPath}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + lines := strings.Split(strings.TrimSpace(string(out)), "\n") + entries := make([]FSFileInfo, 0, len(lines)) + for _, name := range lines { + name = strings.TrimSpace(name) + if name == "" || name == "." || name == ".." { + continue + } + childPath := filepath.Join(pc.containerPath, name) + // Try to stat each entry for richer info. + statOut, statErr := h.execRead(botID, []string{"stat", "-c", `%n|%s|%a|%Y|%F`, childPath}) + if statErr != nil { + // Best-effort: return name only. + entries = append(entries, FSFileInfo{ + Name: name, + Path: childPath, + }) + continue + } + fi, parseErr := parseStatLine(childPath, strings.TrimSpace(string(statOut))) + if parseErr != nil { + entries = append(entries, FSFileInfo{Name: name, Path: childPath}) + continue + } + entries = append(entries, fi) + } + return c.JSON(http.StatusOK, FSListResponse{Path: pc.containerPath, Entries: entries}) +} + +// FSRead godoc +// @Summary Read file content as text +// @Description Reads the content of a file and returns it as a JSON string +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param path query string true "Container file path" +// @Success 200 {object} FSReadResponse +// @Failure 400 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/read [get] +func (h *ContainerdHandler) FSRead(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + rawPath := c.QueryParam("path") + if strings.TrimSpace(rawPath) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + pc, err := h.resolveContainerPath(botID, rawPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + + if pc.insideDataMount { + data, osErr := os.ReadFile(pc.hostPath) + if osErr != nil { + if os.IsNotExist(osErr) { + return echo.NewHTTPError(http.StatusNotFound, "file not found") + } + return echo.NewHTTPError(http.StatusInternalServerError, osErr.Error()) + } + return c.JSON(http.StatusOK, FSReadResponse{ + Path: pc.containerPath, + Content: string(data), + Size: int64(len(data)), + }) + } + + // Exec fallback. + out, err := h.execRead(botID, []string{"cat", pc.containerPath}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + return c.JSON(http.StatusOK, FSReadResponse{ + Path: pc.containerPath, + Content: string(out), + Size: int64(len(out)), + }) +} + +// FSDownload godoc +// @Summary Download a file as binary stream +// @Description Downloads a file from the container with appropriate Content-Type +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param path query string true "Container file path" +// @Produce octet-stream +// @Success 200 {file} binary +// @Failure 400 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/download [get] +func (h *ContainerdHandler) FSDownload(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + rawPath := c.QueryParam("path") + if strings.TrimSpace(rawPath) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + pc, err := h.resolveContainerPath(botID, rawPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + + fileName := filepath.Base(pc.containerPath) + contentType := mime.TypeByExtension(filepath.Ext(fileName)) + if contentType == "" { + contentType = "application/octet-stream" + } + + if pc.insideDataMount { + info, osErr := os.Stat(pc.hostPath) + if osErr != nil { + if os.IsNotExist(osErr) { + return echo.NewHTTPError(http.StatusNotFound, "file not found") + } + return echo.NewHTTPError(http.StatusInternalServerError, osErr.Error()) + } + if info.IsDir() { + return echo.NewHTTPError(http.StatusBadRequest, "cannot download a directory") + } + c.Response().Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, fileName)) + return c.File(pc.hostPath) + } + + // Exec fallback: base64 encode inside container, decode on host. + out, err := h.execRead(botID, []string{"base64", pc.containerPath}) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + decoded, decErr := base64.StdEncoding.DecodeString(strings.TrimSpace(string(out))) + if decErr != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "failed to decode file content") + } + c.Response().Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, fileName)) + return c.Blob(http.StatusOK, contentType, decoded) +} + +// FSWrite godoc +// @Summary Write text content to a file +// @Description Creates or overwrites a file with the provided text content +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param payload body FSWriteRequest true "Write request" +// @Success 200 {object} fsOpResponse +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/write [post] +func (h *ContainerdHandler) FSWrite(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + var req FSWriteRequest + if err := c.Bind(&req); err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if strings.TrimSpace(req.Path) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + pc, err := h.resolveContainerPath(botID, req.Path) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if !pc.insideDataMount { + return echo.NewHTTPError(http.StatusForbidden, "write operations are only allowed within the data directory") + } + + dir := filepath.Dir(pc.hostPath) + if err := os.MkdirAll(dir, 0o755); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + if err := os.WriteFile(pc.hostPath, []byte(req.Content), 0o644); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + return c.JSON(http.StatusOK, fsOpResponse{OK: true}) +} + +// FSUpload godoc +// @Summary Upload a file via multipart form +// @Description Uploads a binary file to the given container path +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param path formData string true "Destination container path" +// @Param file formData file true "File to upload" +// @Accept multipart/form-data +// @Success 200 {object} FSUploadResponse +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/upload [post] +func (h *ContainerdHandler) FSUpload(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + destPath := strings.TrimSpace(c.FormValue("path")) + if destPath == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + file, err := c.FormFile("file") + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "file is required") + } + + pc, err := h.resolveContainerPath(botID, destPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if !pc.insideDataMount { + return echo.NewHTTPError(http.StatusForbidden, "upload operations are only allowed within the data directory") + } + + src, err := file.Open() + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + defer src.Close() + + dir := filepath.Dir(pc.hostPath) + if err := os.MkdirAll(dir, 0o755); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + + dst, err := os.Create(pc.hostPath) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + defer dst.Close() + + written, err := io.Copy(dst, src) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + + return c.JSON(http.StatusOK, FSUploadResponse{ + Path: pc.containerPath, + Size: written, + }) +} + +// FSMkdir godoc +// @Summary Create a directory +// @Description Creates a directory (and parents) at the given container path +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param payload body FSMkdirRequest true "Mkdir request" +// @Success 200 {object} fsOpResponse +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/mkdir [post] +func (h *ContainerdHandler) FSMkdir(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + var req FSMkdirRequest + if err := c.Bind(&req); err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if strings.TrimSpace(req.Path) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + pc, err := h.resolveContainerPath(botID, req.Path) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if !pc.insideDataMount { + return echo.NewHTTPError(http.StatusForbidden, "mkdir operations are only allowed within the data directory") + } + + if err := os.MkdirAll(pc.hostPath, 0o755); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + return c.JSON(http.StatusOK, fsOpResponse{OK: true}) +} + +// FSDelete godoc +// @Summary Delete a file or directory +// @Description Deletes a file or directory at the given container path +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param payload body FSDeleteRequest true "Delete request" +// @Success 200 {object} fsOpResponse +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/delete [post] +func (h *ContainerdHandler) FSDelete(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + var req FSDeleteRequest + if err := c.Bind(&req); err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if strings.TrimSpace(req.Path) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "path is required") + } + + pc, err := h.resolveContainerPath(botID, req.Path) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if !pc.insideDataMount { + return echo.NewHTTPError(http.StatusForbidden, "delete operations are only allowed within the data directory") + } + + // Prevent deleting the data mount root itself. + dataMount := strings.TrimSpace(h.cfg.DataMount) + if dataMount == "" { + dataMount = config.DefaultDataMount + } + if filepath.Clean(pc.containerPath) == filepath.Clean(dataMount) { + return echo.NewHTTPError(http.StatusForbidden, "cannot delete the data root directory") + } + + if _, statErr := os.Stat(pc.hostPath); os.IsNotExist(statErr) { + return echo.NewHTTPError(http.StatusNotFound, "not found") + } + + if req.Recursive { + if err := os.RemoveAll(pc.hostPath); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + } else { + if err := os.Remove(pc.hostPath); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + } + return c.JSON(http.StatusOK, fsOpResponse{OK: true}) +} + +// FSRename godoc +// @Summary Rename or move a file/directory +// @Description Renames or moves a file/directory from oldPath to newPath +// @Tags containerd +// @Param bot_id path string true "Bot ID" +// @Param payload body FSRenameRequest true "Rename request" +// @Success 200 {object} fsOpResponse +// @Failure 400 {object} ErrorResponse +// @Failure 403 {object} ErrorResponse +// @Failure 404 {object} ErrorResponse +// @Failure 500 {object} ErrorResponse +// @Router /bots/{bot_id}/container/fs/rename [post] +func (h *ContainerdHandler) FSRename(c echo.Context) error { + botID, err := h.requireBotAccess(c) + if err != nil { + return err + } + var req FSRenameRequest + if err := c.Bind(&req); err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if strings.TrimSpace(req.OldPath) == "" || strings.TrimSpace(req.NewPath) == "" { + return echo.NewHTTPError(http.StatusBadRequest, "oldPath and newPath are required") + } + + oldPC, err := h.resolveContainerPath(botID, req.OldPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + newPC, err := h.resolveContainerPath(botID, req.NewPath) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, err.Error()) + } + if !oldPC.insideDataMount || !newPC.insideDataMount { + return echo.NewHTTPError(http.StatusForbidden, "rename operations are only allowed within the data directory") + } + + if _, statErr := os.Stat(oldPC.hostPath); os.IsNotExist(statErr) { + return echo.NewHTTPError(http.StatusNotFound, "source not found") + } + + // Ensure the parent of the destination exists. + if err := os.MkdirAll(filepath.Dir(newPC.hostPath), 0o755); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + + if err := os.Rename(oldPC.hostPath, newPC.hostPath); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + return c.JSON(http.StatusOK, fsOpResponse{OK: true}) +} + +// ---------- helpers ---------- + +func osFileInfoToFS(containerPath string, info os.FileInfo) FSFileInfo { + return FSFileInfo{ + Name: info.Name(), + Path: containerPath, + Size: info.Size(), + Mode: fmt.Sprintf("%04o", info.Mode().Perm()), + ModTime: info.ModTime().UTC().Format(time.RFC3339), + IsDir: info.IsDir(), + } +} + +// parseStatLine parses output from: stat -c '%n|%s|%a|%Y|%F' /path +func parseStatLine(containerPath, line string) (FSFileInfo, error) { + parts := strings.SplitN(line, "|", 5) + if len(parts) < 5 { + return FSFileInfo{}, fmt.Errorf("unexpected stat output: %s", line) + } + var size int64 + fmt.Sscanf(parts[1], "%d", &size) + mode := strings.TrimSpace(parts[2]) + var epoch int64 + fmt.Sscanf(parts[3], "%d", &epoch) + modTime := time.Unix(epoch, 0).UTC().Format(time.RFC3339) + fileType := strings.TrimSpace(parts[4]) + isDir := strings.Contains(fileType, "directory") + name := filepath.Base(containerPath) + if containerPath == "/" { + name = "/" + } + + return FSFileInfo{ + Name: name, + Path: containerPath, + Size: size, + Mode: mode, + ModTime: modTime, + IsDir: isDir, + }, nil +} + diff --git a/internal/handlers/subagent.go b/internal/handlers/subagent.go index bd55c264..9067cef8 100644 --- a/internal/handlers/subagent.go +++ b/internal/handlers/subagent.go @@ -255,7 +255,7 @@ func (h *SubagentHandler) GetContext(c echo.Context) error { if _, err := h.authorizeBotAccess(c.Request().Context(), channelIdentityID, botID); err != nil { return err } - return c.JSON(http.StatusOK, subagent.ContextResponse{Messages: item.Messages}) + return c.JSON(http.StatusOK, subagent.ContextResponse{Messages: item.Messages, Usage: item.Usage}) } // UpdateContext godoc @@ -300,7 +300,7 @@ func (h *SubagentHandler) UpdateContext(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - return c.JSON(http.StatusOK, subagent.ContextResponse{Messages: updated.Messages}) + return c.JSON(http.StatusOK, subagent.ContextResponse{Messages: updated.Messages, Usage: updated.Usage}) } // GetSkills godoc diff --git a/internal/subagent/service.go b/internal/subagent/service.go index c9e5ce77..d0f20335 100644 --- a/internal/subagent/service.go +++ b/internal/subagent/service.go @@ -83,6 +83,32 @@ func (s *Service) Get(ctx context.Context, id string) (Subagent, error) { return toSubagent(row) } +func (s *Service) GetByBotAndName(ctx context.Context, botID string, name string) (Subagent, error) { + pgBotID, err := db.ParseUUID(botID) + if err != nil { + return Subagent{}, err + } + row, err := s.queries.GetSubagentByBotAndName(ctx, sqlc.GetSubagentByBotAndNameParams{ + BotID: pgBotID, + Name: strings.TrimSpace(name), + }) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return Subagent{}, fmt.Errorf("subagent not found") + } + return Subagent{}, err + } + return toSubagent(row) +} + +func (s *Service) GetOrCreate(ctx context.Context, botID string, req CreateRequest) (Subagent, error) { + existing, err := s.GetByBotAndName(ctx, botID, req.Name) + if err == nil { + return existing, nil + } + return s.Create(ctx, botID, req) +} + func (s *Service) List(ctx context.Context, botID string) ([]Subagent, error) { pgBotID, err := db.ParseUUID(botID) if err != nil { @@ -155,6 +181,21 @@ func (s *Service) UpdateContext(ctx context.Context, id string, req UpdateContex if err != nil { return Subagent{}, err } + if req.Usage != nil { + usagePayload, err := marshalUsage(req.Usage) + if err != nil { + return Subagent{}, err + } + row, err := s.queries.UpdateSubagentMessagesAndUsage(ctx, sqlc.UpdateSubagentMessagesAndUsageParams{ + ID: pgID, + Messages: messagesPayload, + Usage: usagePayload, + }) + if err != nil { + return Subagent{}, err + } + return toSubagent(row) + } row, err := s.queries.UpdateSubagentMessages(ctx, sqlc.UpdateSubagentMessagesParams{ ID: pgID, Messages: messagesPayload, @@ -229,6 +270,10 @@ func toSubagent(row sqlc.Subagent) (Subagent, error) { if err != nil { return Subagent{}, err } + usage, err := unmarshalUsage(row.Usage) + if err != nil { + return Subagent{}, err + } item := Subagent{ ID: row.ID.String(), Name: row.Name, @@ -237,6 +282,7 @@ func toSubagent(row sqlc.Subagent) (Subagent, error) { Messages: messages, Metadata: metadata, Skills: skills, + Usage: usage, Deleted: row.Deleted, } if row.CreatedAt.Valid { @@ -294,6 +340,27 @@ func unmarshalMetadata(payload []byte) (map[string]any, error) { return metadata, nil } +func marshalUsage(usage map[string]any) ([]byte, error) { + if usage == nil { + usage = map[string]any{} + } + return json.Marshal(usage) +} + +func unmarshalUsage(payload []byte) (map[string]any, error) { + if len(payload) == 0 { + return map[string]any{}, nil + } + var usage map[string]any + if err := json.Unmarshal(payload, &usage); err != nil { + return nil, err + } + if usage == nil { + usage = map[string]any{} + } + return usage, nil +} + func marshalSkills(skills []string) ([]byte, error) { return json.Marshal(normalizeSkills(skills)) } @@ -334,4 +401,3 @@ func mergeSkills(existing []string, incoming []string) []string { merged = append(merged, incoming...) return normalizeSkills(merged) } - diff --git a/internal/subagent/types.go b/internal/subagent/types.go index 38207e0d..90126be0 100644 --- a/internal/subagent/types.go +++ b/internal/subagent/types.go @@ -10,6 +10,7 @@ type Subagent struct { Messages []map[string]any `json:"messages"` Metadata map[string]any `json:"metadata"` Skills []string `json:"skills"` + Usage map[string]any `json:"usage"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Deleted bool `json:"deleted"` @@ -32,6 +33,7 @@ type UpdateRequest struct { type UpdateContextRequest struct { Messages []map[string]any `json:"messages"` + Usage map[string]any `json:"usage,omitempty"` } type UpdateSkillsRequest struct { @@ -48,6 +50,7 @@ type ListResponse struct { type ContextResponse struct { Messages []map[string]any `json:"messages"` + Usage map[string]any `json:"usage"` } type SkillsResponse struct { diff --git a/packages/agent/package.json b/packages/agent/package.json index 894d2a4b..684d1708 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -17,6 +17,8 @@ "@ai-sdk/mcp": "^1.0.6", "@ai-sdk/openai": "^3.0.7", "@mozilla/readability": "^0.6.0", + "@types/jsdom": "^27.0.0", + "@types/turndown": "^5.0.6", "ai": "^6.0.25", "jsdom": "^27.4.0", "toml": "^3.0.0", diff --git a/packages/agent/src/agent.ts b/packages/agent/src/agent.ts index 8ad2973b..69396e8f 100644 --- a/packages/agent/src/agent.ts +++ b/packages/agent/src/agent.ts @@ -31,6 +31,7 @@ import type { GatewayInputAttachment } from './types/attachment' import { getMCPTools } from './tools/mcp' import { getTools } from './tools' import { buildIdentityHeaders } from './utils/headers' +import { createFS } from './utils' const buildStepUsages = ( steps: { usage: LanguageModelUsage; response: { messages: unknown[] } }[], @@ -77,6 +78,7 @@ export const createAgent = ( ) => { const model = createModel(modelConfig) const enabledSkills: AgentSkill[] = [] + const fs = createFS({ fetch, botId: identity.botId }) const enableSkill = (skill: string) => { const agentSkill = skills.find((s) => s.name === skill) @@ -90,58 +92,12 @@ export const createAgent = ( } const loadSystemFiles = async () => { - if (!auth?.bearer || !identity.botId) { - return { - identityContent: '', - soulContent: '', - toolsContent: '', - } - } - const readViaMCP = async (path: string): Promise => { - const url = `${auth.baseUrl.replace(/\/$/, '')}/bots/${identity.botId}/tools` - const headers: Record = { - 'Content-Type': 'application/json', - Accept: 'application/json, text/event-stream', - Authorization: `Bearer ${auth.bearer}`, - } - if (identity.channelIdentityId) { - headers['X-Memoh-Channel-Identity-Id'] = identity.channelIdentityId - } - const body = JSON.stringify({ - jsonrpc: '2.0', - id: `read-${path}`, - method: 'tools/call', - params: { name: 'read', arguments: { path } }, - }) - const response = await fetch(url, { method: 'POST', headers, body }) - if (!response.ok) return '' - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const data = await response.json().catch(() => ({})) as any - const structured = - data?.result?.structuredContent ?? data?.result?.content?.[0]?.text - if (typeof structured === 'string') { - try { - const parsed = JSON.parse(structured) - return typeof parsed?.content === 'string' ? parsed.content : '' - } catch { - return structured - } - } - if (typeof structured === 'object' && structured?.content) { - return typeof structured.content === 'string' ? structured.content : '' - } - return '' - } const [identityContent, soulContent, toolsContent] = await Promise.all([ - readViaMCP('IDENTITY.md'), - readViaMCP('SOUL.md'), - readViaMCP('TOOLS.md'), + fs.readText('/data/IDENTITY.md'), + fs.readText('/data/SOUL.md'), + fs.readText('/data/TOOLS.md'), ]) - return { - identityContent, - soulContent, - toolsContent, - } + return { identityContent, soulContent, toolsContent } } const generateSystemPrompt = async () => { diff --git a/packages/agent/src/tools/subagent.ts b/packages/agent/src/tools/subagent.ts index 42c9ba02..c6237c82 100644 --- a/packages/agent/src/tools/subagent.ts +++ b/packages/agent/src/tools/subagent.ts @@ -1,9 +1,13 @@ -import { tool } from 'ai' +import { tool, type ModelMessage } from 'ai' import { z } from 'zod' import { createAgent } from '../agent' -import { ModelConfig, AgentAuthContext } from '../types' -import { AuthFetcher } from '../types' -import { AgentAction, IdentityContext } from '../types/agent' +import type { ModelConfig, AgentAuthContext, AuthFetcher } from '../types' +import { AgentAction, type IdentityContext } from '../types/agent' +import { + createSubagentClient, + toSubagentUsage, + addUsage, +} from '../utils/subagent' export interface SubagentToolParams { fetch: AuthFetcher @@ -14,7 +18,7 @@ export interface SubagentToolParams { export const getSubagentTools = ({ fetch, model, identity, auth }: SubagentToolParams) => { const botId = identity.botId.trim() - const base = `/bots/${botId}/subagents` + const client = createSubagentClient(fetch, botId) const listSubagents = tool({ description: 'List subagents for current user', @@ -23,27 +27,7 @@ export const getSubagentTools = ({ fetch, model, identity, auth }: SubagentToolP if (!botId) { throw new Error('bot_id is required') } - const response = await fetch(base, { method: 'GET' }) - return response.json() - }, - }) - - const createSubagent = tool({ - description: 'Create a new subagent', - inputSchema: z.object({ - name: z.string(), - description: z.string(), - }), - execute: async ({ name, description }) => { - if (!botId) { - throw new Error('bot_id is required') - } - const response = await fetch(base, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name, description }), - }) - return response.json() + return client.list() }, }) @@ -56,51 +40,56 @@ export const getSubagentTools = ({ fetch, model, identity, auth }: SubagentToolP if (!botId) { throw new Error('bot_id is required') } - const response = await fetch(`${base}/${id}`, { method: 'DELETE' }) - return response.status === 204 ? { success: true } : response.json() + return client.remove(id) }, }) const querySubagent = tool({ - description: 'Query a subagent', + description: 'Query a subagent. If the subagent does not exist it will be created automatically.', inputSchema: z.object({ - name: z.string(), + name: z.string().describe('The name of the subagent'), + description: z.string().describe('A short description of the subagent purpose (used when creating)'), query: z.string().describe('The prompt to ask the subagent to do.'), }), - execute: async ({ name, query }) => { + execute: async ({ name, description, query }) => { if (!botId) { throw new Error('bot_id is required') } - const listResponse = await fetch(base, { method: 'GET' }) - const listPayload = await listResponse.json() - const items = Array.isArray(listPayload?.items) ? listPayload.items : [] - const target = items.find((item: { name?: string }) => item?.name === name) - if (!target?.id) { - throw new Error(`subagent not found: ${name}`) - } - const contextResponse = await fetch(`${base}/${target.id}/context`, { method: 'GET' }) - const contextPayload = await contextResponse.json() - const contextMessages = Array.isArray(contextPayload?.messages) ? contextPayload.messages : [] + + // Get or create the subagent + const target = await client.getOrCreate({ name, description }) + + // Load persisted context (messages + usage) + const ctx = await client.getContext(target.id) + const contextMessages = (Array.isArray(ctx.messages) ? ctx.messages : []) as ModelMessage[] + const existingUsage = toSubagentUsage(ctx.usage) + + // Create a scoped agent instance for the subagent const { askAsSubagent } = createAgent({ model, - allowedActions: [ - AgentAction.Web, - ], + allowedActions: [AgentAction.Web], identity, auth, }, fetch) + const result = await askAsSubagent({ messages: contextMessages, input: query, name: target.name, description: target.description, }) + + // Accumulate usage + const newUsage = addUsage(existingUsage, result.usage) + + // Persist updated messages + usage const updatedMessages = [...contextMessages, ...result.messages] - await fetch(`${base}/${target.id}/context`, { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ messages: updatedMessages }), - }) + await client.updateContext( + target.id, + updatedMessages as Record[], + newUsage, + ) + return { success: true, result: result.messages[result.messages.length - 1].content, @@ -110,8 +99,7 @@ export const getSubagentTools = ({ fetch, model, identity, auth }: SubagentToolP return { 'list_subagents': listSubagents, - 'create_subagent': createSubagent, 'delete_subagent': deleteSubagent, 'query_subagent': querySubagent, } -} \ No newline at end of file +} diff --git a/packages/agent/src/utils/fs.ts b/packages/agent/src/utils/fs.ts new file mode 100644 index 00000000..0ab57080 --- /dev/null +++ b/packages/agent/src/utils/fs.ts @@ -0,0 +1,207 @@ +import type { AuthFetcher } from '../types' + +// ---------- types ---------- + +export interface FSFileInfo { + name: string + path: string + size: number + mode: string + modTime: string + isDir: boolean +} + +export interface FSListResponse { + path: string + entries: FSFileInfo[] +} + +export interface FSReadResponse { + path: string + content: string + size: number +} + +export interface FSWriteParams { + path: string + content: string +} + +export interface FSUploadResponse { + path: string + size: number +} + +export interface FSMkdirParams { + path: string +} + +export interface FSDeleteParams { + path: string + recursive?: boolean +} + +export interface FSRenameParams { + oldPath: string + newPath: string +} + +export interface FSOkResponse { + ok: boolean +} + +export interface FSClientOptions { + fetch: AuthFetcher + botId: string +} + +// ---------- helpers ---------- + +const encodeQuery = (path: string) => encodeURIComponent(path) + +const ensureOk = async (response: Response, action: string): Promise => { + if (!response.ok) { + const text = await response.text().catch(() => '') + throw new Error(`fs ${action} failed (${response.status}): ${text}`) + } +} + +// ---------- public API ---------- + +/** + * Creates a set of filesystem utility functions that operate on a bot's + * container via the REST file-manager API. + * + * All functions use `AuthFetcher` so auth headers are injected automatically. + */ +export const createFS = ({ fetch, botId }: FSClientOptions) => { + const base = `/bots/${botId}/container/fs` + + /** Get file or directory metadata. */ + const stat = async (path: string): Promise => { + const response = await fetch(`${base}?path=${encodeQuery(path)}`) + await ensureOk(response, 'stat') + return response.json() as Promise + } + + /** List directory contents. */ + const list = async (path: string): Promise => { + const response = await fetch(`${base}/list?path=${encodeQuery(path)}`) + await ensureOk(response, 'list') + return response.json() as Promise + } + + /** Read a file as text. */ + const read = async (path: string): Promise => { + const response = await fetch(`${base}/read?path=${encodeQuery(path)}`) + await ensureOk(response, 'read') + return response.json() as Promise + } + + /** Download a file as a binary `Response` (stream-ready). */ + const download = async (path: string): Promise => { + const response = await fetch(`${base}/download?path=${encodeQuery(path)}`) + await ensureOk(response, 'download') + return response + } + + /** Write text content to a file (creates parent dirs automatically). */ + const write = async (params: FSWriteParams): Promise => { + const response = await fetch(`${base}/write`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(params), + }) + await ensureOk(response, 'write') + return response.json() as Promise + } + + /** Upload a binary file via multipart/form-data. */ + const upload = async ( + path: string, + file: Blob | File, + fileName?: string, + ): Promise => { + const form = new FormData() + form.append('path', path) + form.append('file', file, fileName ?? (file instanceof File ? file.name : 'upload')) + const response = await fetch(`${base}/upload`, { + method: 'POST', + body: form, + }) + await ensureOk(response, 'upload') + return response.json() as Promise + } + + /** Create a directory (and parents). */ + const mkdir = async (params: FSMkdirParams): Promise => { + const response = await fetch(`${base}/mkdir`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(params), + }) + await ensureOk(response, 'mkdir') + return response.json() as Promise + } + + /** Delete a file or directory. */ + const remove = async (params: FSDeleteParams): Promise => { + const response = await fetch(`${base}/delete`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(params), + }) + await ensureOk(response, 'delete') + return response.json() as Promise + } + + /** Rename or move a file / directory. */ + const rename = async (params: FSRenameParams): Promise => { + const response = await fetch(`${base}/rename`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(params), + }) + await ensureOk(response, 'rename') + return response.json() as Promise + } + + /** Check whether a path exists. */ + const exists = async (path: string): Promise => { + try { + await stat(path) + return true + } catch { + return false + } + } + + /** Read a file and return only the text content string. */ + const readText = async (path: string): Promise => { + const result = await read(path) + return result.content + } + + /** Shorthand: write text content to a path. */ + const writeText = async (path: string, content: string): Promise => { + return write({ path, content }) + } + + return { + stat, + list, + read, + readText, + download, + write, + writeText, + upload, + mkdir, + remove, + rename, + exists, + } +} + +export type FSClient = ReturnType + diff --git a/packages/agent/src/utils/index.ts b/packages/agent/src/utils/index.ts index 48ff40e2..cb616254 100644 --- a/packages/agent/src/utils/index.ts +++ b/packages/agent/src/utils/index.ts @@ -1,2 +1,4 @@ export * from './attachments' -export * from './headers' \ No newline at end of file +export * from './fs' +export * from './headers' +export * from './subagent' diff --git a/packages/agent/src/utils/subagent.ts b/packages/agent/src/utils/subagent.ts new file mode 100644 index 00000000..3175bd15 --- /dev/null +++ b/packages/agent/src/utils/subagent.ts @@ -0,0 +1,131 @@ +import type { AuthFetcher } from '../types' +import type { LanguageModelUsage } from 'ai' + +// --------------------------------------------------------------------------- +// Types +// --------------------------------------------------------------------------- + +export interface SubagentItem { + id: string + name: string + description: string + bot_id: string + messages: Record[] + metadata: Record + skills: string[] + usage: SubagentUsage + created_at: string + updated_at: string + deleted: boolean + deleted_at?: string +} + +export interface SubagentUsage { + inputTokens: number + outputTokens: number + totalTokens: number +} + +export interface SubagentListResponse { + items: SubagentItem[] +} + +export interface SubagentContextResponse { + messages: Record[] + usage: SubagentUsage +} + +// --------------------------------------------------------------------------- +// Usage helpers +// --------------------------------------------------------------------------- + +const emptyUsage: SubagentUsage = { + inputTokens: 0, + outputTokens: 0, + totalTokens: 0, +} + +export const toSubagentUsage = (raw: unknown): SubagentUsage => { + if (!raw || typeof raw !== 'object') return { ...emptyUsage } + const obj = raw as Record + return { + inputTokens: typeof obj.inputTokens === 'number' ? obj.inputTokens : 0, + outputTokens: typeof obj.outputTokens === 'number' ? obj.outputTokens : 0, + totalTokens: typeof obj.totalTokens === 'number' ? obj.totalTokens : 0, + } +} + +export const addUsage = ( + existing: SubagentUsage, + delta: LanguageModelUsage, +): SubagentUsage => ({ + inputTokens: existing.inputTokens + (delta.inputTokens ?? 0), + outputTokens: existing.outputTokens + (delta.outputTokens ?? 0), + totalTokens: existing.totalTokens + (delta.totalTokens ?? 0), +}) + +// --------------------------------------------------------------------------- +// Client factory +// --------------------------------------------------------------------------- + +export const createSubagentClient = (fetch: AuthFetcher, botId: string) => { + const base = `/bots/${botId}/subagents` + + const list = async (): Promise => { + const res = await fetch(base, { method: 'GET' }) + return res.json() as Promise + } + + const create = async (params: { + name: string + description: string + }): Promise => { + const res = await fetch(base, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(params), + }) + return res.json() as Promise + } + + const get = async (id: string): Promise => { + const res = await fetch(`${base}/${id}`, { method: 'GET' }) + return res.json() as Promise + } + + const getContext = async (id: string): Promise => { + const res = await fetch(`${base}/${id}/context`, { method: 'GET' }) + return res.json() as Promise + } + + const updateContext = async ( + id: string, + messages: Record[], + usage: SubagentUsage, + ): Promise => { + const res = await fetch(`${base}/${id}/context`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ messages, usage }), + }) + return res.json() as Promise + } + + const getOrCreate = async (params: { + name: string + description: string + }): Promise => { + const { items } = await list() + const existing = items.find((item) => item.name === params.name) + if (existing) return existing + return create(params) + } + + const remove = async (id: string): Promise<{ success: boolean }> => { + const res = await fetch(`${base}/${id}`, { method: 'DELETE' }) + return res.status === 204 ? { success: true } : (res.json() as Promise<{ success: boolean }>) + } + + return { list, create, get, getContext, updateContext, getOrCreate, remove } +} + diff --git a/packages/sdk/src/@pinia/colada.gen.ts b/packages/sdk/src/@pinia/colada.gen.ts index 5e275111..2c1cc45a 100644 --- a/packages/sdk/src/@pinia/colada.gen.ts +++ b/packages/sdk/src/@pinia/colada.gen.ts @@ -4,8 +4,8 @@ import { type _JSONValue, defineQueryOptions, type UseMutationOptions } from '@p import { serializeQueryKeyValue } from '../client'; import { client } from '../client.gen'; -import { deleteBotsByBotIdContainer, deleteBotsByBotIdContainerSkills, deleteBotsByBotIdInboxById, deleteBotsByBotIdMcpById, deleteBotsByBotIdMemory, deleteBotsByBotIdMemoryById, deleteBotsByBotIdScheduleById, deleteBotsByBotIdSettings, deleteBotsByBotIdSubagentsById, deleteBotsById, deleteBotsByIdChannelByPlatform, deleteBotsByIdMembersByUserId, deleteModelsById, deleteModelsModelByModelId, deleteProvidersById, deleteSearchProvidersById, getBots, getBotsByBotIdContainer, getBotsByBotIdContainerSkills, getBotsByBotIdContainerSnapshots, getBotsByBotIdInbox, getBotsByBotIdInboxById, getBotsByBotIdInboxCount, getBotsByBotIdMcp, getBotsByBotIdMcpById, getBotsByBotIdMcpExport, getBotsByBotIdMemory, getBotsByBotIdMemoryUsage, getBotsByBotIdMessages, getBotsByBotIdSchedule, getBotsByBotIdScheduleById, getBotsByBotIdSettings, getBotsByBotIdSubagents, getBotsByBotIdSubagentsById, getBotsByBotIdSubagentsByIdContext, getBotsByBotIdSubagentsByIdSkills, getBotsById, getBotsByIdChannelByPlatform, getBotsByIdChecks, getBotsByIdMembers, getChannels, getChannelsByPlatform, getModels, getModelsById, getModelsCount, getModelsModelByModelId, getProviders, getProvidersById, getProvidersByIdModels, getProvidersCount, getProvidersNameByName, getSearchProviders, getSearchProvidersById, getSearchProvidersMeta, getUsers, getUsersById, getUsersMe, getUsersMeChannelsByPlatform, getUsersMeIdentities, type Options, patchBotsByIdChannelByPlatformStatus, postAuthLogin, postBots, postBotsByBotIdCliMessages, postBotsByBotIdContainer, postBotsByBotIdContainerSkills, postBotsByBotIdContainerSnapshots, postBotsByBotIdContainerStart, postBotsByBotIdContainerStop, postBotsByBotIdInbox, postBotsByBotIdInboxMarkRead, postBotsByBotIdMcp, postBotsByBotIdMcpOpsBatchDelete, postBotsByBotIdMcpStdio, postBotsByBotIdMcpStdioByConnectionId, postBotsByBotIdMemory, postBotsByBotIdMemoryCompact, postBotsByBotIdMemoryRebuild, postBotsByBotIdMemorySearch, postBotsByBotIdSchedule, postBotsByBotIdSettings, postBotsByBotIdSubagents, postBotsByBotIdSubagentsByIdSkills, postBotsByBotIdTools, postBotsByBotIdWebMessages, postBotsByIdChannelByPlatformSend, postBotsByIdChannelByPlatformSendChat, postEmbeddings, postModels, postProviders, postProvidersByIdTest, postSearchProviders, postUsers, putBotsByBotIdMcpById, putBotsByBotIdMcpImport, putBotsByBotIdScheduleById, putBotsByBotIdSettings, putBotsByBotIdSubagentsById, putBotsByBotIdSubagentsByIdContext, putBotsByBotIdSubagentsByIdSkills, putBotsById, putBotsByIdChannelByPlatform, putBotsByIdMembers, putBotsByIdOwner, putModelsById, putModelsModelByModelId, putProvidersById, putSearchProvidersById, putUsersById, putUsersByIdPassword, putUsersMe, putUsersMeChannelsByPlatform, putUsersMePassword } from '../sdk.gen'; -import type { DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerError, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsError, DeleteBotsByBotIdContainerSkillsResponse, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdError, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdError, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdError, DeleteBotsByBotIdMemoryByIdResponse, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryError, DeleteBotsByBotIdMemoryResponse, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdError, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsError, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdError, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformError, DeleteBotsByIdData, DeleteBotsByIdError, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdError, DeleteBotsByIdResponse, DeleteModelsByIdData, DeleteModelsByIdError, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdError, DeleteProvidersByIdData, DeleteProvidersByIdError, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdError, GetBotsByBotIdContainerData, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxData, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpData, GetBotsByBotIdMcpExportData, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMessagesData, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleData, GetBotsByBotIdSettingsData, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsData, GetBotsByIdChannelByPlatformData, GetBotsByIdChecksData, GetBotsByIdData, GetBotsByIdMembersData, GetBotsData, GetChannelsByPlatformData, GetChannelsData, GetModelsByIdData, GetModelsCountData, GetModelsData, GetModelsModelByModelIdData, GetProvidersByIdData, GetProvidersByIdModelsData, GetProvidersCountData, GetProvidersData, GetProvidersNameByNameData, GetSearchProvidersByIdData, GetSearchProvidersData, GetSearchProvidersMetaData, GetUsersByIdData, GetUsersData, GetUsersMeChannelsByPlatformData, GetUsersMeData, GetUsersMeIdentitiesData, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusError, PatchBotsByIdChannelByPlatformStatusResponse, PostAuthLoginData, PostAuthLoginError, PostAuthLoginResponse, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesError, PostBotsByBotIdCliMessagesResponse, PostBotsByBotIdContainerData, PostBotsByBotIdContainerError, PostBotsByBotIdContainerResponse, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsError, PostBotsByBotIdContainerSkillsResponse, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsError, PostBotsByBotIdContainerSnapshotsResponse, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartError, PostBotsByBotIdContainerStartResponse, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopError, PostBotsByBotIdContainerStopResponse, PostBotsByBotIdInboxData, PostBotsByBotIdInboxError, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadError, PostBotsByBotIdInboxResponse, PostBotsByBotIdMcpData, PostBotsByBotIdMcpError, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteError, PostBotsByBotIdMcpResponse, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdError, PostBotsByBotIdMcpStdioByConnectionIdResponse, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioError, PostBotsByBotIdMcpStdioResponse, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactError, PostBotsByBotIdMemoryCompactResponse, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryError, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildError, PostBotsByBotIdMemoryRebuildResponse, PostBotsByBotIdMemoryResponse, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchError, PostBotsByBotIdMemorySearchResponse, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleError, PostBotsByBotIdScheduleResponse, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsError, PostBotsByBotIdSettingsResponse, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsError, PostBotsByBotIdSubagentsByIdSkillsResponse, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsError, PostBotsByBotIdSubagentsResponse, PostBotsByBotIdToolsData, PostBotsByBotIdToolsError, PostBotsByBotIdToolsResponse, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesError, PostBotsByBotIdWebMessagesResponse, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatError, PostBotsByIdChannelByPlatformSendChatResponse, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendError, PostBotsByIdChannelByPlatformSendResponse, PostBotsData, PostBotsError, PostBotsResponse, PostEmbeddingsData, PostEmbeddingsError, PostEmbeddingsResponse, PostModelsData, PostModelsError, PostModelsResponse, PostProvidersByIdTestData, PostProvidersByIdTestError, PostProvidersByIdTestResponse, PostProvidersData, PostProvidersError, PostProvidersResponse, PostSearchProvidersData, PostSearchProvidersError, PostSearchProvidersResponse, PostUsersData, PostUsersError, PostUsersResponse, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdError, PutBotsByBotIdMcpByIdResponse, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportError, PutBotsByBotIdMcpImportResponse, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdError, PutBotsByBotIdScheduleByIdResponse, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsError, PutBotsByBotIdSettingsResponse, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextError, PutBotsByBotIdSubagentsByIdContextResponse, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdError, PutBotsByBotIdSubagentsByIdResponse, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsError, PutBotsByBotIdSubagentsByIdSkillsResponse, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformError, PutBotsByIdChannelByPlatformResponse, PutBotsByIdData, PutBotsByIdError, PutBotsByIdMembersData, PutBotsByIdMembersError, PutBotsByIdMembersResponse, PutBotsByIdOwnerData, PutBotsByIdOwnerError, PutBotsByIdOwnerResponse, PutBotsByIdResponse, PutModelsByIdData, PutModelsByIdError, PutModelsByIdResponse, PutModelsModelByModelIdData, PutModelsModelByModelIdError, PutModelsModelByModelIdResponse, PutProvidersByIdData, PutProvidersByIdError, PutProvidersByIdResponse, PutSearchProvidersByIdData, PutSearchProvidersByIdError, PutSearchProvidersByIdResponse, PutUsersByIdData, PutUsersByIdError, PutUsersByIdPasswordData, PutUsersByIdPasswordError, PutUsersByIdResponse, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformError, PutUsersMeChannelsByPlatformResponse, PutUsersMeData, PutUsersMeError, PutUsersMePasswordData, PutUsersMePasswordError, PutUsersMeResponse } from '../types.gen'; +import { deleteBotsByBotIdContainer, deleteBotsByBotIdContainerSkills, deleteBotsByBotIdInboxById, deleteBotsByBotIdMcpById, deleteBotsByBotIdMemory, deleteBotsByBotIdMemoryById, deleteBotsByBotIdScheduleById, deleteBotsByBotIdSettings, deleteBotsByBotIdSubagentsById, deleteBotsById, deleteBotsByIdChannelByPlatform, deleteBotsByIdMembersByUserId, deleteModelsById, deleteModelsModelByModelId, deleteProvidersById, deleteSearchProvidersById, getBots, getBotsByBotIdContainer, getBotsByBotIdContainerFs, getBotsByBotIdContainerFsDownload, getBotsByBotIdContainerFsList, getBotsByBotIdContainerFsRead, getBotsByBotIdContainerSkills, getBotsByBotIdContainerSnapshots, getBotsByBotIdInbox, getBotsByBotIdInboxById, getBotsByBotIdInboxCount, getBotsByBotIdMcp, getBotsByBotIdMcpById, getBotsByBotIdMcpExport, getBotsByBotIdMemory, getBotsByBotIdMemoryUsage, getBotsByBotIdMessages, getBotsByBotIdSchedule, getBotsByBotIdScheduleById, getBotsByBotIdSettings, getBotsByBotIdSubagents, getBotsByBotIdSubagentsById, getBotsByBotIdSubagentsByIdContext, getBotsByBotIdSubagentsByIdSkills, getBotsById, getBotsByIdChannelByPlatform, getBotsByIdChecks, getBotsByIdMembers, getChannels, getChannelsByPlatform, getModels, getModelsById, getModelsCount, getModelsModelByModelId, getProviders, getProvidersById, getProvidersByIdModels, getProvidersCount, getProvidersNameByName, getSearchProviders, getSearchProvidersById, getSearchProvidersMeta, getUsers, getUsersById, getUsersMe, getUsersMeChannelsByPlatform, getUsersMeIdentities, type Options, patchBotsByIdChannelByPlatformStatus, postAuthLogin, postBots, postBotsByBotIdCliMessages, postBotsByBotIdContainer, postBotsByBotIdContainerFsDelete, postBotsByBotIdContainerFsMkdir, postBotsByBotIdContainerFsRename, postBotsByBotIdContainerFsUpload, postBotsByBotIdContainerFsWrite, postBotsByBotIdContainerSkills, postBotsByBotIdContainerSnapshots, postBotsByBotIdContainerStart, postBotsByBotIdContainerStop, postBotsByBotIdInbox, postBotsByBotIdInboxMarkRead, postBotsByBotIdMcp, postBotsByBotIdMcpOpsBatchDelete, postBotsByBotIdMcpStdio, postBotsByBotIdMcpStdioByConnectionId, postBotsByBotIdMemory, postBotsByBotIdMemoryCompact, postBotsByBotIdMemoryRebuild, postBotsByBotIdMemorySearch, postBotsByBotIdSchedule, postBotsByBotIdSettings, postBotsByBotIdSubagents, postBotsByBotIdSubagentsByIdSkills, postBotsByBotIdTools, postBotsByBotIdWebMessages, postBotsByIdChannelByPlatformSend, postBotsByIdChannelByPlatformSendChat, postEmbeddings, postModels, postProviders, postProvidersByIdTest, postSearchProviders, postUsers, putBotsByBotIdMcpById, putBotsByBotIdMcpImport, putBotsByBotIdScheduleById, putBotsByBotIdSettings, putBotsByBotIdSubagentsById, putBotsByBotIdSubagentsByIdContext, putBotsByBotIdSubagentsByIdSkills, putBotsById, putBotsByIdChannelByPlatform, putBotsByIdMembers, putBotsByIdOwner, putModelsById, putModelsModelByModelId, putProvidersById, putSearchProvidersById, putUsersById, putUsersByIdPassword, putUsersMe, putUsersMeChannelsByPlatform, putUsersMePassword } from '../sdk.gen'; +import type { DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerError, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsError, DeleteBotsByBotIdContainerSkillsResponse, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdError, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdError, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdError, DeleteBotsByBotIdMemoryByIdResponse, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryError, DeleteBotsByBotIdMemoryResponse, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdError, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsError, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdError, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformError, DeleteBotsByIdData, DeleteBotsByIdError, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdError, DeleteBotsByIdResponse, DeleteModelsByIdData, DeleteModelsByIdError, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdError, DeleteProvidersByIdData, DeleteProvidersByIdError, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdError, GetBotsByBotIdContainerData, GetBotsByBotIdContainerFsData, GetBotsByBotIdContainerFsDownloadData, GetBotsByBotIdContainerFsListData, GetBotsByBotIdContainerFsReadData, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxData, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpData, GetBotsByBotIdMcpExportData, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMessagesData, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleData, GetBotsByBotIdSettingsData, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsData, GetBotsByIdChannelByPlatformData, GetBotsByIdChecksData, GetBotsByIdData, GetBotsByIdMembersData, GetBotsData, GetChannelsByPlatformData, GetChannelsData, GetModelsByIdData, GetModelsCountData, GetModelsData, GetModelsModelByModelIdData, GetProvidersByIdData, GetProvidersByIdModelsData, GetProvidersCountData, GetProvidersData, GetProvidersNameByNameData, GetSearchProvidersByIdData, GetSearchProvidersData, GetSearchProvidersMetaData, GetUsersByIdData, GetUsersData, GetUsersMeChannelsByPlatformData, GetUsersMeData, GetUsersMeIdentitiesData, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusError, PatchBotsByIdChannelByPlatformStatusResponse, PostAuthLoginData, PostAuthLoginError, PostAuthLoginResponse, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesError, PostBotsByBotIdCliMessagesResponse, PostBotsByBotIdContainerData, PostBotsByBotIdContainerError, PostBotsByBotIdContainerFsDeleteData, PostBotsByBotIdContainerFsDeleteError, PostBotsByBotIdContainerFsDeleteResponse, PostBotsByBotIdContainerFsMkdirData, PostBotsByBotIdContainerFsMkdirError, PostBotsByBotIdContainerFsMkdirResponse, PostBotsByBotIdContainerFsRenameData, PostBotsByBotIdContainerFsRenameError, PostBotsByBotIdContainerFsRenameResponse, PostBotsByBotIdContainerFsUploadData, PostBotsByBotIdContainerFsUploadError, PostBotsByBotIdContainerFsUploadResponse, PostBotsByBotIdContainerFsWriteData, PostBotsByBotIdContainerFsWriteError, PostBotsByBotIdContainerFsWriteResponse, PostBotsByBotIdContainerResponse, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsError, PostBotsByBotIdContainerSkillsResponse, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsError, PostBotsByBotIdContainerSnapshotsResponse, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartError, PostBotsByBotIdContainerStartResponse, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopError, PostBotsByBotIdContainerStopResponse, PostBotsByBotIdInboxData, PostBotsByBotIdInboxError, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadError, PostBotsByBotIdInboxResponse, PostBotsByBotIdMcpData, PostBotsByBotIdMcpError, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteError, PostBotsByBotIdMcpResponse, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdError, PostBotsByBotIdMcpStdioByConnectionIdResponse, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioError, PostBotsByBotIdMcpStdioResponse, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactError, PostBotsByBotIdMemoryCompactResponse, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryError, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildError, PostBotsByBotIdMemoryRebuildResponse, PostBotsByBotIdMemoryResponse, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchError, PostBotsByBotIdMemorySearchResponse, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleError, PostBotsByBotIdScheduleResponse, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsError, PostBotsByBotIdSettingsResponse, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsError, PostBotsByBotIdSubagentsByIdSkillsResponse, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsError, PostBotsByBotIdSubagentsResponse, PostBotsByBotIdToolsData, PostBotsByBotIdToolsError, PostBotsByBotIdToolsResponse, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesError, PostBotsByBotIdWebMessagesResponse, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatError, PostBotsByIdChannelByPlatformSendChatResponse, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendError, PostBotsByIdChannelByPlatformSendResponse, PostBotsData, PostBotsError, PostBotsResponse, PostEmbeddingsData, PostEmbeddingsError, PostEmbeddingsResponse, PostModelsData, PostModelsError, PostModelsResponse, PostProvidersByIdTestData, PostProvidersByIdTestError, PostProvidersByIdTestResponse, PostProvidersData, PostProvidersError, PostProvidersResponse, PostSearchProvidersData, PostSearchProvidersError, PostSearchProvidersResponse, PostUsersData, PostUsersError, PostUsersResponse, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdError, PutBotsByBotIdMcpByIdResponse, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportError, PutBotsByBotIdMcpImportResponse, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdError, PutBotsByBotIdScheduleByIdResponse, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsError, PutBotsByBotIdSettingsResponse, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextError, PutBotsByBotIdSubagentsByIdContextResponse, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdError, PutBotsByBotIdSubagentsByIdResponse, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsError, PutBotsByBotIdSubagentsByIdSkillsResponse, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformError, PutBotsByIdChannelByPlatformResponse, PutBotsByIdData, PutBotsByIdError, PutBotsByIdMembersData, PutBotsByIdMembersError, PutBotsByIdMembersResponse, PutBotsByIdOwnerData, PutBotsByIdOwnerError, PutBotsByIdOwnerResponse, PutBotsByIdResponse, PutModelsByIdData, PutModelsByIdError, PutModelsByIdResponse, PutModelsModelByModelIdData, PutModelsModelByModelIdError, PutModelsModelByModelIdResponse, PutProvidersByIdData, PutProvidersByIdError, PutProvidersByIdResponse, PutSearchProvidersByIdData, PutSearchProvidersByIdError, PutSearchProvidersByIdResponse, PutUsersByIdData, PutUsersByIdError, PutUsersByIdPasswordData, PutUsersByIdPasswordError, PutUsersByIdResponse, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformError, PutUsersMeChannelsByPlatformResponse, PutUsersMeData, PutUsersMeError, PutUsersMePasswordData, PutUsersMePasswordError, PutUsersMeResponse } from '../types.gen'; /** * Login @@ -154,6 +154,162 @@ export const postBotsByBotIdContainerMutation = (options?: Partial) => createQueryKey('getBotsByBotIdContainerFs', options); + +/** + * Get file or directory info + * + * Returns metadata about a file or directory at the given container path + */ +export const getBotsByBotIdContainerFsQuery = defineQueryOptions((options: Options) => ({ + key: getBotsByBotIdContainerFsQueryKey(options), + query: async (context) => { + const { data } = await getBotsByBotIdContainerFs({ + ...options, + ...context, + throwOnError: true + }); + return data; + } +})); + +/** + * Delete a file or directory + * + * Deletes a file or directory at the given container path + */ +export const postBotsByBotIdContainerFsDeleteMutation = (options?: Partial>): UseMutationOptions, PostBotsByBotIdContainerFsDeleteError> => ({ + mutation: async (vars) => { + const { data } = await postBotsByBotIdContainerFsDelete({ + ...options, + ...vars, + throwOnError: true + }); + return data; + } +}); + +export const getBotsByBotIdContainerFsDownloadQueryKey = (options: Options) => createQueryKey('getBotsByBotIdContainerFsDownload', options); + +/** + * Download a file as binary stream + * + * Downloads a file from the container with appropriate Content-Type + */ +export const getBotsByBotIdContainerFsDownloadQuery = defineQueryOptions((options: Options) => ({ + key: getBotsByBotIdContainerFsDownloadQueryKey(options), + query: async (context) => { + const { data } = await getBotsByBotIdContainerFsDownload({ + ...options, + ...context, + throwOnError: true + }); + return data; + } +})); + +export const getBotsByBotIdContainerFsListQueryKey = (options: Options) => createQueryKey('getBotsByBotIdContainerFsList', options); + +/** + * List directory contents + * + * Lists files and directories at the given container path + */ +export const getBotsByBotIdContainerFsListQuery = defineQueryOptions((options: Options) => ({ + key: getBotsByBotIdContainerFsListQueryKey(options), + query: async (context) => { + const { data } = await getBotsByBotIdContainerFsList({ + ...options, + ...context, + throwOnError: true + }); + return data; + } +})); + +/** + * Create a directory + * + * Creates a directory (and parents) at the given container path + */ +export const postBotsByBotIdContainerFsMkdirMutation = (options?: Partial>): UseMutationOptions, PostBotsByBotIdContainerFsMkdirError> => ({ + mutation: async (vars) => { + const { data } = await postBotsByBotIdContainerFsMkdir({ + ...options, + ...vars, + throwOnError: true + }); + return data; + } +}); + +export const getBotsByBotIdContainerFsReadQueryKey = (options: Options) => createQueryKey('getBotsByBotIdContainerFsRead', options); + +/** + * Read file content as text + * + * Reads the content of a file and returns it as a JSON string + */ +export const getBotsByBotIdContainerFsReadQuery = defineQueryOptions((options: Options) => ({ + key: getBotsByBotIdContainerFsReadQueryKey(options), + query: async (context) => { + const { data } = await getBotsByBotIdContainerFsRead({ + ...options, + ...context, + throwOnError: true + }); + return data; + } +})); + +/** + * Rename or move a file/directory + * + * Renames or moves a file/directory from oldPath to newPath + */ +export const postBotsByBotIdContainerFsRenameMutation = (options?: Partial>): UseMutationOptions, PostBotsByBotIdContainerFsRenameError> => ({ + mutation: async (vars) => { + const { data } = await postBotsByBotIdContainerFsRename({ + ...options, + ...vars, + throwOnError: true + }); + return data; + } +}); + +/** + * Upload a file via multipart form + * + * Uploads a binary file to the given container path + */ +export const postBotsByBotIdContainerFsUploadMutation = (options?: Partial>): UseMutationOptions, PostBotsByBotIdContainerFsUploadError> => ({ + mutation: async (vars) => { + const { data } = await postBotsByBotIdContainerFsUpload({ + ...options, + ...vars, + throwOnError: true + }); + return data; + } +}); + +/** + * Write text content to a file + * + * Creates or overwrites a file with the provided text content + */ +export const postBotsByBotIdContainerFsWriteMutation = (options?: Partial>): UseMutationOptions, PostBotsByBotIdContainerFsWriteError> => ({ + mutation: async (vars) => { + const { data } = await postBotsByBotIdContainerFsWrite({ + ...options, + ...vars, + throwOnError: true + }); + return data; + } +}); + /** * Delete skills from data directory */ diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts index 23c2afe0..5a3a338a 100644 --- a/packages/sdk/src/index.ts +++ b/packages/sdk/src/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { deleteBotsByBotIdContainer, deleteBotsByBotIdContainerSkills, deleteBotsByBotIdInboxById, deleteBotsByBotIdMcpById, deleteBotsByBotIdMemory, deleteBotsByBotIdMemoryById, deleteBotsByBotIdScheduleById, deleteBotsByBotIdSettings, deleteBotsByBotIdSubagentsById, deleteBotsById, deleteBotsByIdChannelByPlatform, deleteBotsByIdMembersByUserId, deleteModelsById, deleteModelsModelByModelId, deleteProvidersById, deleteSearchProvidersById, getBots, getBotsByBotIdCliStream, getBotsByBotIdContainer, getBotsByBotIdContainerSkills, getBotsByBotIdContainerSnapshots, getBotsByBotIdInbox, getBotsByBotIdInboxById, getBotsByBotIdInboxCount, getBotsByBotIdMcp, getBotsByBotIdMcpById, getBotsByBotIdMcpExport, getBotsByBotIdMemory, getBotsByBotIdMemoryUsage, getBotsByBotIdMessages, getBotsByBotIdSchedule, getBotsByBotIdScheduleById, getBotsByBotIdSettings, getBotsByBotIdSubagents, getBotsByBotIdSubagentsById, getBotsByBotIdSubagentsByIdContext, getBotsByBotIdSubagentsByIdSkills, getBotsByBotIdWebStream, getBotsById, getBotsByIdChannelByPlatform, getBotsByIdChecks, getBotsByIdMembers, getChannels, getChannelsByPlatform, getModels, getModelsById, getModelsCount, getModelsModelByModelId, getProviders, getProvidersById, getProvidersByIdModels, getProvidersCount, getProvidersNameByName, getSearchProviders, getSearchProvidersById, getSearchProvidersMeta, getUsers, getUsersById, getUsersMe, getUsersMeChannelsByPlatform, getUsersMeIdentities, type Options, patchBotsByIdChannelByPlatformStatus, postAuthLogin, postBots, postBotsByBotIdCliMessages, postBotsByBotIdContainer, postBotsByBotIdContainerSkills, postBotsByBotIdContainerSnapshots, postBotsByBotIdContainerStart, postBotsByBotIdContainerStop, postBotsByBotIdInbox, postBotsByBotIdInboxMarkRead, postBotsByBotIdMcp, postBotsByBotIdMcpOpsBatchDelete, postBotsByBotIdMcpStdio, postBotsByBotIdMcpStdioByConnectionId, postBotsByBotIdMemory, postBotsByBotIdMemoryCompact, postBotsByBotIdMemoryRebuild, postBotsByBotIdMemorySearch, postBotsByBotIdSchedule, postBotsByBotIdSettings, postBotsByBotIdSubagents, postBotsByBotIdSubagentsByIdSkills, postBotsByBotIdTools, postBotsByBotIdWebMessages, postBotsByIdChannelByPlatformSend, postBotsByIdChannelByPlatformSendChat, postEmbeddings, postModels, postProviders, postProvidersByIdTest, postSearchProviders, postUsers, putBotsByBotIdMcpById, putBotsByBotIdMcpImport, putBotsByBotIdScheduleById, putBotsByBotIdSettings, putBotsByBotIdSubagentsById, putBotsByBotIdSubagentsByIdContext, putBotsByBotIdSubagentsByIdSkills, putBotsById, putBotsByIdChannelByPlatform, putBotsByIdMembers, putBotsByIdOwner, putModelsById, putModelsModelByModelId, putProvidersById, putSearchProvidersById, putUsersById, putUsersByIdPassword, putUsersMe, putUsersMeChannelsByPlatform, putUsersMePassword } from './sdk.gen'; -export type { AccountsAccount, AccountsCreateAccountRequest, AccountsListAccountsResponse, AccountsResetPasswordRequest, AccountsUpdateAccountRequest, AccountsUpdatePasswordRequest, AccountsUpdateProfileRequest, BotsBot, BotsBotCheck, BotsBotMember, BotsCreateBotRequest, BotsListBotsResponse, BotsListChecksResponse, BotsListMembersResponse, BotsTransferBotRequest, BotsUpdateBotRequest, BotsUpsertMemberRequest, ChannelAction, ChannelAttachment, ChannelAttachmentType, ChannelChannelCapabilities, ChannelChannelConfig, ChannelChannelIdentityBinding, ChannelConfigSchema, ChannelFieldSchema, ChannelFieldType, ChannelMessage, ChannelMessageFormat, ChannelMessagePart, ChannelMessagePartType, ChannelMessageTextStyle, ChannelReplyRef, ChannelSendRequest, ChannelTargetHint, ChannelTargetSpec, ChannelThreadRef, ChannelUpdateChannelStatusRequest, ChannelUpsertChannelIdentityConfigRequest, ChannelUpsertConfigRequest, ClientOptions, DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerError, DeleteBotsByBotIdContainerErrors, DeleteBotsByBotIdContainerResponses, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsError, DeleteBotsByBotIdContainerSkillsErrors, DeleteBotsByBotIdContainerSkillsResponse, DeleteBotsByBotIdContainerSkillsResponses, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdError, DeleteBotsByBotIdInboxByIdErrors, DeleteBotsByBotIdInboxByIdResponses, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdError, DeleteBotsByBotIdMcpByIdErrors, DeleteBotsByBotIdMcpByIdResponses, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdError, DeleteBotsByBotIdMemoryByIdErrors, DeleteBotsByBotIdMemoryByIdResponse, DeleteBotsByBotIdMemoryByIdResponses, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryError, DeleteBotsByBotIdMemoryErrors, DeleteBotsByBotIdMemoryResponse, DeleteBotsByBotIdMemoryResponses, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdError, DeleteBotsByBotIdScheduleByIdErrors, DeleteBotsByBotIdScheduleByIdResponses, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsError, DeleteBotsByBotIdSettingsErrors, DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdError, DeleteBotsByBotIdSubagentsByIdErrors, DeleteBotsByBotIdSubagentsByIdResponses, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformError, DeleteBotsByIdChannelByPlatformErrors, DeleteBotsByIdChannelByPlatformResponses, DeleteBotsByIdData, DeleteBotsByIdError, DeleteBotsByIdErrors, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdError, DeleteBotsByIdMembersByUserIdErrors, DeleteBotsByIdMembersByUserIdResponses, DeleteBotsByIdResponse, DeleteBotsByIdResponses, DeleteModelsByIdData, DeleteModelsByIdError, DeleteModelsByIdErrors, DeleteModelsByIdResponses, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdError, DeleteModelsModelByModelIdErrors, DeleteModelsModelByModelIdResponses, DeleteProvidersByIdData, DeleteProvidersByIdError, DeleteProvidersByIdErrors, DeleteProvidersByIdResponses, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdError, DeleteSearchProvidersByIdErrors, DeleteSearchProvidersByIdResponses, GetBotsByBotIdCliStreamData, GetBotsByBotIdCliStreamError, GetBotsByBotIdCliStreamErrors, GetBotsByBotIdCliStreamResponse, GetBotsByBotIdCliStreamResponses, GetBotsByBotIdContainerData, GetBotsByBotIdContainerError, GetBotsByBotIdContainerErrors, GetBotsByBotIdContainerResponse, GetBotsByBotIdContainerResponses, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSkillsError, GetBotsByBotIdContainerSkillsErrors, GetBotsByBotIdContainerSkillsResponse, GetBotsByBotIdContainerSkillsResponses, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdContainerSnapshotsResponse, GetBotsByBotIdContainerSnapshotsResponses, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxByIdError, GetBotsByBotIdInboxByIdErrors, GetBotsByBotIdInboxByIdResponse, GetBotsByBotIdInboxByIdResponses, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxCountError, GetBotsByBotIdInboxCountErrors, GetBotsByBotIdInboxCountResponse, GetBotsByBotIdInboxCountResponses, GetBotsByBotIdInboxData, GetBotsByBotIdInboxError, GetBotsByBotIdInboxErrors, GetBotsByBotIdInboxResponse, GetBotsByBotIdInboxResponses, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpByIdError, GetBotsByBotIdMcpByIdErrors, GetBotsByBotIdMcpByIdResponse, GetBotsByBotIdMcpByIdResponses, GetBotsByBotIdMcpData, GetBotsByBotIdMcpError, GetBotsByBotIdMcpErrors, GetBotsByBotIdMcpExportData, GetBotsByBotIdMcpExportError, GetBotsByBotIdMcpExportErrors, GetBotsByBotIdMcpExportResponse, GetBotsByBotIdMcpExportResponses, GetBotsByBotIdMcpResponse, GetBotsByBotIdMcpResponses, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryError, GetBotsByBotIdMemoryErrors, GetBotsByBotIdMemoryResponse, GetBotsByBotIdMemoryResponses, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMemoryUsageError, GetBotsByBotIdMemoryUsageErrors, GetBotsByBotIdMemoryUsageResponse, GetBotsByBotIdMemoryUsageResponses, GetBotsByBotIdMessagesData, GetBotsByBotIdMessagesError, GetBotsByBotIdMessagesErrors, GetBotsByBotIdMessagesResponse, GetBotsByBotIdMessagesResponses, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleByIdError, GetBotsByBotIdScheduleByIdErrors, GetBotsByBotIdScheduleByIdResponse, GetBotsByBotIdScheduleByIdResponses, GetBotsByBotIdScheduleData, GetBotsByBotIdScheduleError, GetBotsByBotIdScheduleErrors, GetBotsByBotIdScheduleResponse, GetBotsByBotIdScheduleResponses, GetBotsByBotIdSettingsData, GetBotsByBotIdSettingsError, GetBotsByBotIdSettingsErrors, GetBotsByBotIdSettingsResponse, GetBotsByBotIdSettingsResponses, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdContextError, GetBotsByBotIdSubagentsByIdContextErrors, GetBotsByBotIdSubagentsByIdContextResponse, GetBotsByBotIdSubagentsByIdContextResponses, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdError, GetBotsByBotIdSubagentsByIdErrors, GetBotsByBotIdSubagentsByIdResponse, GetBotsByBotIdSubagentsByIdResponses, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsByIdSkillsError, GetBotsByBotIdSubagentsByIdSkillsErrors, GetBotsByBotIdSubagentsByIdSkillsResponse, GetBotsByBotIdSubagentsByIdSkillsResponses, GetBotsByBotIdSubagentsData, GetBotsByBotIdSubagentsError, GetBotsByBotIdSubagentsErrors, GetBotsByBotIdSubagentsResponse, GetBotsByBotIdSubagentsResponses, GetBotsByBotIdWebStreamData, GetBotsByBotIdWebStreamError, GetBotsByBotIdWebStreamErrors, GetBotsByBotIdWebStreamResponse, GetBotsByBotIdWebStreamResponses, GetBotsByIdChannelByPlatformData, GetBotsByIdChannelByPlatformError, GetBotsByIdChannelByPlatformErrors, GetBotsByIdChannelByPlatformResponse, GetBotsByIdChannelByPlatformResponses, GetBotsByIdChecksData, GetBotsByIdChecksError, GetBotsByIdChecksErrors, GetBotsByIdChecksResponse, GetBotsByIdChecksResponses, GetBotsByIdData, GetBotsByIdError, GetBotsByIdErrors, GetBotsByIdMembersData, GetBotsByIdMembersError, GetBotsByIdMembersErrors, GetBotsByIdMembersResponse, GetBotsByIdMembersResponses, GetBotsByIdResponse, GetBotsByIdResponses, GetBotsData, GetBotsError, GetBotsErrors, GetBotsResponse, GetBotsResponses, GetChannelsByPlatformData, GetChannelsByPlatformError, GetChannelsByPlatformErrors, GetChannelsByPlatformResponse, GetChannelsByPlatformResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetModelsByIdData, GetModelsByIdError, GetModelsByIdErrors, GetModelsByIdResponse, GetModelsByIdResponses, GetModelsCountData, GetModelsCountError, GetModelsCountErrors, GetModelsCountResponse, GetModelsCountResponses, GetModelsData, GetModelsError, GetModelsErrors, GetModelsModelByModelIdData, GetModelsModelByModelIdError, GetModelsModelByModelIdErrors, GetModelsModelByModelIdResponse, GetModelsModelByModelIdResponses, GetModelsResponse, GetModelsResponses, GetProvidersByIdData, GetProvidersByIdError, GetProvidersByIdErrors, GetProvidersByIdModelsData, GetProvidersByIdModelsError, GetProvidersByIdModelsErrors, GetProvidersByIdModelsResponse, GetProvidersByIdModelsResponses, GetProvidersByIdResponse, GetProvidersByIdResponses, GetProvidersCountData, GetProvidersCountError, GetProvidersCountErrors, GetProvidersCountResponse, GetProvidersCountResponses, GetProvidersData, GetProvidersError, GetProvidersErrors, GetProvidersNameByNameData, GetProvidersNameByNameError, GetProvidersNameByNameErrors, GetProvidersNameByNameResponse, GetProvidersNameByNameResponses, GetProvidersResponse, GetProvidersResponses, GetSearchProvidersByIdData, GetSearchProvidersByIdError, GetSearchProvidersByIdErrors, GetSearchProvidersByIdResponse, GetSearchProvidersByIdResponses, GetSearchProvidersData, GetSearchProvidersError, GetSearchProvidersErrors, GetSearchProvidersMetaData, GetSearchProvidersMetaResponse, GetSearchProvidersMetaResponses, GetSearchProvidersResponse, GetSearchProvidersResponses, GetUsersByIdData, GetUsersByIdError, GetUsersByIdErrors, GetUsersByIdResponse, GetUsersByIdResponses, GetUsersData, GetUsersError, GetUsersErrors, GetUsersMeChannelsByPlatformData, GetUsersMeChannelsByPlatformError, GetUsersMeChannelsByPlatformErrors, GetUsersMeChannelsByPlatformResponse, GetUsersMeChannelsByPlatformResponses, GetUsersMeData, GetUsersMeError, GetUsersMeErrors, GetUsersMeIdentitiesData, GetUsersMeIdentitiesError, GetUsersMeIdentitiesErrors, GetUsersMeIdentitiesResponse, GetUsersMeIdentitiesResponses, GetUsersMeResponse, GetUsersMeResponses, GetUsersResponse, GetUsersResponses, GithubComMemohaiMemohInternalMcpConnection, HandlersBatchDeleteRequest, HandlersChannelMeta, HandlersCreateContainerRequest, HandlersCreateContainerResponse, HandlersCreateSnapshotRequest, HandlersCreateSnapshotResponse, HandlersEmbeddingsInput, HandlersEmbeddingsRequest, HandlersEmbeddingsResponse, HandlersEmbeddingsUsage, HandlersErrorResponse, HandlersGetContainerResponse, HandlersListMyIdentitiesResponse, HandlersListSnapshotsResponse, HandlersLocalChannelMessageRequest, HandlersLoginRequest, HandlersLoginResponse, HandlersMarkReadRequest, HandlersMcpStdioRequest, HandlersMcpStdioResponse, HandlersMemoryAddPayload, HandlersMemoryCompactPayload, HandlersMemoryDeletePayload, HandlersMemorySearchPayload, HandlersSkillItem, HandlersSkillsDeleteRequest, HandlersSkillsOpResponse, HandlersSkillsResponse, HandlersSkillsUpsertRequest, HandlersSnapshotInfo, IdentitiesChannelIdentity, InboxCountResult, InboxCreateRequest, InboxItem, McpExportResponse, McpImportRequest, McpListResponse, McpMcpServerEntry, McpUpsertRequest, MemoryCdfPoint, MemoryCompactResult, MemoryDeleteResponse, MemoryMemoryItem, MemoryMessage, MemoryRebuildResult, MemorySearchResponse, MemoryTopKBucket, MemoryUsageResponse, MessageMessage, MessageMessageAsset, ModelsAddRequest, ModelsAddResponse, ModelsClientType, ModelsCountResponse, ModelsGetResponse, ModelsModelType, ModelsUpdateRequest, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusError, PatchBotsByIdChannelByPlatformStatusErrors, PatchBotsByIdChannelByPlatformStatusResponse, PatchBotsByIdChannelByPlatformStatusResponses, PostAuthLoginData, PostAuthLoginError, PostAuthLoginErrors, PostAuthLoginResponse, PostAuthLoginResponses, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesError, PostBotsByBotIdCliMessagesErrors, PostBotsByBotIdCliMessagesResponse, PostBotsByBotIdCliMessagesResponses, PostBotsByBotIdContainerData, PostBotsByBotIdContainerError, PostBotsByBotIdContainerErrors, PostBotsByBotIdContainerResponse, PostBotsByBotIdContainerResponses, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsError, PostBotsByBotIdContainerSkillsErrors, PostBotsByBotIdContainerSkillsResponse, PostBotsByBotIdContainerSkillsResponses, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsError, PostBotsByBotIdContainerSnapshotsErrors, PostBotsByBotIdContainerSnapshotsResponse, PostBotsByBotIdContainerSnapshotsResponses, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartError, PostBotsByBotIdContainerStartErrors, PostBotsByBotIdContainerStartResponse, PostBotsByBotIdContainerStartResponses, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopError, PostBotsByBotIdContainerStopErrors, PostBotsByBotIdContainerStopResponse, PostBotsByBotIdContainerStopResponses, PostBotsByBotIdInboxData, PostBotsByBotIdInboxError, PostBotsByBotIdInboxErrors, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadError, PostBotsByBotIdInboxMarkReadErrors, PostBotsByBotIdInboxMarkReadResponses, PostBotsByBotIdInboxResponse, PostBotsByBotIdInboxResponses, PostBotsByBotIdMcpData, PostBotsByBotIdMcpError, PostBotsByBotIdMcpErrors, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteError, PostBotsByBotIdMcpOpsBatchDeleteErrors, PostBotsByBotIdMcpOpsBatchDeleteResponses, PostBotsByBotIdMcpResponse, PostBotsByBotIdMcpResponses, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdError, PostBotsByBotIdMcpStdioByConnectionIdErrors, PostBotsByBotIdMcpStdioByConnectionIdResponse, PostBotsByBotIdMcpStdioByConnectionIdResponses, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioError, PostBotsByBotIdMcpStdioErrors, PostBotsByBotIdMcpStdioResponse, PostBotsByBotIdMcpStdioResponses, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactError, PostBotsByBotIdMemoryCompactErrors, PostBotsByBotIdMemoryCompactResponse, PostBotsByBotIdMemoryCompactResponses, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryError, PostBotsByBotIdMemoryErrors, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildError, PostBotsByBotIdMemoryRebuildErrors, PostBotsByBotIdMemoryRebuildResponse, PostBotsByBotIdMemoryRebuildResponses, PostBotsByBotIdMemoryResponse, PostBotsByBotIdMemoryResponses, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchError, PostBotsByBotIdMemorySearchErrors, PostBotsByBotIdMemorySearchResponse, PostBotsByBotIdMemorySearchResponses, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleError, PostBotsByBotIdScheduleErrors, PostBotsByBotIdScheduleResponse, PostBotsByBotIdScheduleResponses, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsError, PostBotsByBotIdSettingsErrors, PostBotsByBotIdSettingsResponse, PostBotsByBotIdSettingsResponses, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsError, PostBotsByBotIdSubagentsByIdSkillsErrors, PostBotsByBotIdSubagentsByIdSkillsResponse, PostBotsByBotIdSubagentsByIdSkillsResponses, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsError, PostBotsByBotIdSubagentsErrors, PostBotsByBotIdSubagentsResponse, PostBotsByBotIdSubagentsResponses, PostBotsByBotIdToolsData, PostBotsByBotIdToolsError, PostBotsByBotIdToolsErrors, PostBotsByBotIdToolsResponse, PostBotsByBotIdToolsResponses, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesError, PostBotsByBotIdWebMessagesErrors, PostBotsByBotIdWebMessagesResponse, PostBotsByBotIdWebMessagesResponses, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatError, PostBotsByIdChannelByPlatformSendChatErrors, PostBotsByIdChannelByPlatformSendChatResponse, PostBotsByIdChannelByPlatformSendChatResponses, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendError, PostBotsByIdChannelByPlatformSendErrors, PostBotsByIdChannelByPlatformSendResponse, PostBotsByIdChannelByPlatformSendResponses, PostBotsData, PostBotsError, PostBotsErrors, PostBotsResponse, PostBotsResponses, PostEmbeddingsData, PostEmbeddingsError, PostEmbeddingsErrors, PostEmbeddingsResponse, PostEmbeddingsResponses, PostModelsData, PostModelsError, PostModelsErrors, PostModelsResponse, PostModelsResponses, PostProvidersByIdTestData, PostProvidersByIdTestError, PostProvidersByIdTestErrors, PostProvidersByIdTestResponse, PostProvidersByIdTestResponses, PostProvidersData, PostProvidersError, PostProvidersErrors, PostProvidersResponse, PostProvidersResponses, PostSearchProvidersData, PostSearchProvidersError, PostSearchProvidersErrors, PostSearchProvidersResponse, PostSearchProvidersResponses, PostUsersData, PostUsersError, PostUsersErrors, PostUsersResponse, PostUsersResponses, ProvidersCheckResult, ProvidersCheckStatus, ProvidersCountResponse, ProvidersCreateRequest, ProvidersGetResponse, ProvidersTestResponse, ProvidersUpdateRequest, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdError, PutBotsByBotIdMcpByIdErrors, PutBotsByBotIdMcpByIdResponse, PutBotsByBotIdMcpByIdResponses, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportError, PutBotsByBotIdMcpImportErrors, PutBotsByBotIdMcpImportResponse, PutBotsByBotIdMcpImportResponses, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdError, PutBotsByBotIdScheduleByIdErrors, PutBotsByBotIdScheduleByIdResponse, PutBotsByBotIdScheduleByIdResponses, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsError, PutBotsByBotIdSettingsErrors, PutBotsByBotIdSettingsResponse, PutBotsByBotIdSettingsResponses, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextError, PutBotsByBotIdSubagentsByIdContextErrors, PutBotsByBotIdSubagentsByIdContextResponse, PutBotsByBotIdSubagentsByIdContextResponses, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdError, PutBotsByBotIdSubagentsByIdErrors, PutBotsByBotIdSubagentsByIdResponse, PutBotsByBotIdSubagentsByIdResponses, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsError, PutBotsByBotIdSubagentsByIdSkillsErrors, PutBotsByBotIdSubagentsByIdSkillsResponse, PutBotsByBotIdSubagentsByIdSkillsResponses, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformError, PutBotsByIdChannelByPlatformErrors, PutBotsByIdChannelByPlatformResponse, PutBotsByIdChannelByPlatformResponses, PutBotsByIdData, PutBotsByIdError, PutBotsByIdErrors, PutBotsByIdMembersData, PutBotsByIdMembersError, PutBotsByIdMembersErrors, PutBotsByIdMembersResponse, PutBotsByIdMembersResponses, PutBotsByIdOwnerData, PutBotsByIdOwnerError, PutBotsByIdOwnerErrors, PutBotsByIdOwnerResponse, PutBotsByIdOwnerResponses, PutBotsByIdResponse, PutBotsByIdResponses, PutModelsByIdData, PutModelsByIdError, PutModelsByIdErrors, PutModelsByIdResponse, PutModelsByIdResponses, PutModelsModelByModelIdData, PutModelsModelByModelIdError, PutModelsModelByModelIdErrors, PutModelsModelByModelIdResponse, PutModelsModelByModelIdResponses, PutProvidersByIdData, PutProvidersByIdError, PutProvidersByIdErrors, PutProvidersByIdResponse, PutProvidersByIdResponses, PutSearchProvidersByIdData, PutSearchProvidersByIdError, PutSearchProvidersByIdErrors, PutSearchProvidersByIdResponse, PutSearchProvidersByIdResponses, PutUsersByIdData, PutUsersByIdError, PutUsersByIdErrors, PutUsersByIdPasswordData, PutUsersByIdPasswordError, PutUsersByIdPasswordErrors, PutUsersByIdPasswordResponses, PutUsersByIdResponse, PutUsersByIdResponses, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformError, PutUsersMeChannelsByPlatformErrors, PutUsersMeChannelsByPlatformResponse, PutUsersMeChannelsByPlatformResponses, PutUsersMeData, PutUsersMeError, PutUsersMeErrors, PutUsersMePasswordData, PutUsersMePasswordError, PutUsersMePasswordErrors, PutUsersMePasswordResponses, PutUsersMeResponse, PutUsersMeResponses, ScheduleCreateRequest, ScheduleListResponse, ScheduleNullableInt, ScheduleSchedule, ScheduleUpdateRequest, SearchprovidersCreateRequest, SearchprovidersGetResponse, SearchprovidersProviderConfigSchema, SearchprovidersProviderFieldSchema, SearchprovidersProviderMeta, SearchprovidersProviderName, SearchprovidersUpdateRequest, SettingsSettings, SettingsUpsertRequest, SubagentAddSkillsRequest, SubagentContextResponse, SubagentCreateRequest, SubagentListResponse, SubagentSkillsResponse, SubagentSubagent, SubagentUpdateContextRequest, SubagentUpdateRequest, SubagentUpdateSkillsRequest } from './types.gen'; +export { deleteBotsByBotIdContainer, deleteBotsByBotIdContainerSkills, deleteBotsByBotIdInboxById, deleteBotsByBotIdMcpById, deleteBotsByBotIdMemory, deleteBotsByBotIdMemoryById, deleteBotsByBotIdScheduleById, deleteBotsByBotIdSettings, deleteBotsByBotIdSubagentsById, deleteBotsById, deleteBotsByIdChannelByPlatform, deleteBotsByIdMembersByUserId, deleteModelsById, deleteModelsModelByModelId, deleteProvidersById, deleteSearchProvidersById, getBots, getBotsByBotIdCliStream, getBotsByBotIdContainer, getBotsByBotIdContainerFs, getBotsByBotIdContainerFsDownload, getBotsByBotIdContainerFsList, getBotsByBotIdContainerFsRead, getBotsByBotIdContainerSkills, getBotsByBotIdContainerSnapshots, getBotsByBotIdInbox, getBotsByBotIdInboxById, getBotsByBotIdInboxCount, getBotsByBotIdMcp, getBotsByBotIdMcpById, getBotsByBotIdMcpExport, getBotsByBotIdMemory, getBotsByBotIdMemoryUsage, getBotsByBotIdMessages, getBotsByBotIdSchedule, getBotsByBotIdScheduleById, getBotsByBotIdSettings, getBotsByBotIdSubagents, getBotsByBotIdSubagentsById, getBotsByBotIdSubagentsByIdContext, getBotsByBotIdSubagentsByIdSkills, getBotsByBotIdWebStream, getBotsById, getBotsByIdChannelByPlatform, getBotsByIdChecks, getBotsByIdMembers, getChannels, getChannelsByPlatform, getModels, getModelsById, getModelsCount, getModelsModelByModelId, getProviders, getProvidersById, getProvidersByIdModels, getProvidersCount, getProvidersNameByName, getSearchProviders, getSearchProvidersById, getSearchProvidersMeta, getUsers, getUsersById, getUsersMe, getUsersMeChannelsByPlatform, getUsersMeIdentities, type Options, patchBotsByIdChannelByPlatformStatus, postAuthLogin, postBots, postBotsByBotIdCliMessages, postBotsByBotIdContainer, postBotsByBotIdContainerFsDelete, postBotsByBotIdContainerFsMkdir, postBotsByBotIdContainerFsRename, postBotsByBotIdContainerFsUpload, postBotsByBotIdContainerFsWrite, postBotsByBotIdContainerSkills, postBotsByBotIdContainerSnapshots, postBotsByBotIdContainerStart, postBotsByBotIdContainerStop, postBotsByBotIdInbox, postBotsByBotIdInboxMarkRead, postBotsByBotIdMcp, postBotsByBotIdMcpOpsBatchDelete, postBotsByBotIdMcpStdio, postBotsByBotIdMcpStdioByConnectionId, postBotsByBotIdMemory, postBotsByBotIdMemoryCompact, postBotsByBotIdMemoryRebuild, postBotsByBotIdMemorySearch, postBotsByBotIdSchedule, postBotsByBotIdSettings, postBotsByBotIdSubagents, postBotsByBotIdSubagentsByIdSkills, postBotsByBotIdTools, postBotsByBotIdWebMessages, postBotsByIdChannelByPlatformSend, postBotsByIdChannelByPlatformSendChat, postEmbeddings, postModels, postProviders, postProvidersByIdTest, postSearchProviders, postUsers, putBotsByBotIdMcpById, putBotsByBotIdMcpImport, putBotsByBotIdScheduleById, putBotsByBotIdSettings, putBotsByBotIdSubagentsById, putBotsByBotIdSubagentsByIdContext, putBotsByBotIdSubagentsByIdSkills, putBotsById, putBotsByIdChannelByPlatform, putBotsByIdMembers, putBotsByIdOwner, putModelsById, putModelsModelByModelId, putProvidersById, putSearchProvidersById, putUsersById, putUsersByIdPassword, putUsersMe, putUsersMeChannelsByPlatform, putUsersMePassword } from './sdk.gen'; +export type { AccountsAccount, AccountsCreateAccountRequest, AccountsListAccountsResponse, AccountsResetPasswordRequest, AccountsUpdateAccountRequest, AccountsUpdatePasswordRequest, AccountsUpdateProfileRequest, BotsBot, BotsBotCheck, BotsBotMember, BotsCreateBotRequest, BotsListBotsResponse, BotsListChecksResponse, BotsListMembersResponse, BotsTransferBotRequest, BotsUpdateBotRequest, BotsUpsertMemberRequest, ChannelAction, ChannelAttachment, ChannelAttachmentType, ChannelChannelCapabilities, ChannelChannelConfig, ChannelChannelIdentityBinding, ChannelConfigSchema, ChannelFieldSchema, ChannelFieldType, ChannelMessage, ChannelMessageFormat, ChannelMessagePart, ChannelMessagePartType, ChannelMessageTextStyle, ChannelReplyRef, ChannelSendRequest, ChannelTargetHint, ChannelTargetSpec, ChannelThreadRef, ChannelUpdateChannelStatusRequest, ChannelUpsertChannelIdentityConfigRequest, ChannelUpsertConfigRequest, ClientOptions, DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerError, DeleteBotsByBotIdContainerErrors, DeleteBotsByBotIdContainerResponses, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsError, DeleteBotsByBotIdContainerSkillsErrors, DeleteBotsByBotIdContainerSkillsResponse, DeleteBotsByBotIdContainerSkillsResponses, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdError, DeleteBotsByBotIdInboxByIdErrors, DeleteBotsByBotIdInboxByIdResponses, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdError, DeleteBotsByBotIdMcpByIdErrors, DeleteBotsByBotIdMcpByIdResponses, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdError, DeleteBotsByBotIdMemoryByIdErrors, DeleteBotsByBotIdMemoryByIdResponse, DeleteBotsByBotIdMemoryByIdResponses, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryError, DeleteBotsByBotIdMemoryErrors, DeleteBotsByBotIdMemoryResponse, DeleteBotsByBotIdMemoryResponses, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdError, DeleteBotsByBotIdScheduleByIdErrors, DeleteBotsByBotIdScheduleByIdResponses, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsError, DeleteBotsByBotIdSettingsErrors, DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdError, DeleteBotsByBotIdSubagentsByIdErrors, DeleteBotsByBotIdSubagentsByIdResponses, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformError, DeleteBotsByIdChannelByPlatformErrors, DeleteBotsByIdChannelByPlatformResponses, DeleteBotsByIdData, DeleteBotsByIdError, DeleteBotsByIdErrors, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdError, DeleteBotsByIdMembersByUserIdErrors, DeleteBotsByIdMembersByUserIdResponses, DeleteBotsByIdResponse, DeleteBotsByIdResponses, DeleteModelsByIdData, DeleteModelsByIdError, DeleteModelsByIdErrors, DeleteModelsByIdResponses, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdError, DeleteModelsModelByModelIdErrors, DeleteModelsModelByModelIdResponses, DeleteProvidersByIdData, DeleteProvidersByIdError, DeleteProvidersByIdErrors, DeleteProvidersByIdResponses, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdError, DeleteSearchProvidersByIdErrors, DeleteSearchProvidersByIdResponses, GetBotsByBotIdCliStreamData, GetBotsByBotIdCliStreamError, GetBotsByBotIdCliStreamErrors, GetBotsByBotIdCliStreamResponse, GetBotsByBotIdCliStreamResponses, GetBotsByBotIdContainerData, GetBotsByBotIdContainerError, GetBotsByBotIdContainerErrors, GetBotsByBotIdContainerFsData, GetBotsByBotIdContainerFsDownloadData, GetBotsByBotIdContainerFsDownloadError, GetBotsByBotIdContainerFsDownloadErrors, GetBotsByBotIdContainerFsDownloadResponses, GetBotsByBotIdContainerFsError, GetBotsByBotIdContainerFsErrors, GetBotsByBotIdContainerFsListData, GetBotsByBotIdContainerFsListError, GetBotsByBotIdContainerFsListErrors, GetBotsByBotIdContainerFsListResponse, GetBotsByBotIdContainerFsListResponses, GetBotsByBotIdContainerFsReadData, GetBotsByBotIdContainerFsReadError, GetBotsByBotIdContainerFsReadErrors, GetBotsByBotIdContainerFsReadResponse, GetBotsByBotIdContainerFsReadResponses, GetBotsByBotIdContainerFsResponse, GetBotsByBotIdContainerFsResponses, GetBotsByBotIdContainerResponse, GetBotsByBotIdContainerResponses, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSkillsError, GetBotsByBotIdContainerSkillsErrors, GetBotsByBotIdContainerSkillsResponse, GetBotsByBotIdContainerSkillsResponses, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdContainerSnapshotsResponse, GetBotsByBotIdContainerSnapshotsResponses, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxByIdError, GetBotsByBotIdInboxByIdErrors, GetBotsByBotIdInboxByIdResponse, GetBotsByBotIdInboxByIdResponses, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxCountError, GetBotsByBotIdInboxCountErrors, GetBotsByBotIdInboxCountResponse, GetBotsByBotIdInboxCountResponses, GetBotsByBotIdInboxData, GetBotsByBotIdInboxError, GetBotsByBotIdInboxErrors, GetBotsByBotIdInboxResponse, GetBotsByBotIdInboxResponses, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpByIdError, GetBotsByBotIdMcpByIdErrors, GetBotsByBotIdMcpByIdResponse, GetBotsByBotIdMcpByIdResponses, GetBotsByBotIdMcpData, GetBotsByBotIdMcpError, GetBotsByBotIdMcpErrors, GetBotsByBotIdMcpExportData, GetBotsByBotIdMcpExportError, GetBotsByBotIdMcpExportErrors, GetBotsByBotIdMcpExportResponse, GetBotsByBotIdMcpExportResponses, GetBotsByBotIdMcpResponse, GetBotsByBotIdMcpResponses, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryError, GetBotsByBotIdMemoryErrors, GetBotsByBotIdMemoryResponse, GetBotsByBotIdMemoryResponses, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMemoryUsageError, GetBotsByBotIdMemoryUsageErrors, GetBotsByBotIdMemoryUsageResponse, GetBotsByBotIdMemoryUsageResponses, GetBotsByBotIdMessagesData, GetBotsByBotIdMessagesError, GetBotsByBotIdMessagesErrors, GetBotsByBotIdMessagesResponse, GetBotsByBotIdMessagesResponses, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleByIdError, GetBotsByBotIdScheduleByIdErrors, GetBotsByBotIdScheduleByIdResponse, GetBotsByBotIdScheduleByIdResponses, GetBotsByBotIdScheduleData, GetBotsByBotIdScheduleError, GetBotsByBotIdScheduleErrors, GetBotsByBotIdScheduleResponse, GetBotsByBotIdScheduleResponses, GetBotsByBotIdSettingsData, GetBotsByBotIdSettingsError, GetBotsByBotIdSettingsErrors, GetBotsByBotIdSettingsResponse, GetBotsByBotIdSettingsResponses, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdContextError, GetBotsByBotIdSubagentsByIdContextErrors, GetBotsByBotIdSubagentsByIdContextResponse, GetBotsByBotIdSubagentsByIdContextResponses, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdError, GetBotsByBotIdSubagentsByIdErrors, GetBotsByBotIdSubagentsByIdResponse, GetBotsByBotIdSubagentsByIdResponses, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsByIdSkillsError, GetBotsByBotIdSubagentsByIdSkillsErrors, GetBotsByBotIdSubagentsByIdSkillsResponse, GetBotsByBotIdSubagentsByIdSkillsResponses, GetBotsByBotIdSubagentsData, GetBotsByBotIdSubagentsError, GetBotsByBotIdSubagentsErrors, GetBotsByBotIdSubagentsResponse, GetBotsByBotIdSubagentsResponses, GetBotsByBotIdWebStreamData, GetBotsByBotIdWebStreamError, GetBotsByBotIdWebStreamErrors, GetBotsByBotIdWebStreamResponse, GetBotsByBotIdWebStreamResponses, GetBotsByIdChannelByPlatformData, GetBotsByIdChannelByPlatformError, GetBotsByIdChannelByPlatformErrors, GetBotsByIdChannelByPlatformResponse, GetBotsByIdChannelByPlatformResponses, GetBotsByIdChecksData, GetBotsByIdChecksError, GetBotsByIdChecksErrors, GetBotsByIdChecksResponse, GetBotsByIdChecksResponses, GetBotsByIdData, GetBotsByIdError, GetBotsByIdErrors, GetBotsByIdMembersData, GetBotsByIdMembersError, GetBotsByIdMembersErrors, GetBotsByIdMembersResponse, GetBotsByIdMembersResponses, GetBotsByIdResponse, GetBotsByIdResponses, GetBotsData, GetBotsError, GetBotsErrors, GetBotsResponse, GetBotsResponses, GetChannelsByPlatformData, GetChannelsByPlatformError, GetChannelsByPlatformErrors, GetChannelsByPlatformResponse, GetChannelsByPlatformResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetModelsByIdData, GetModelsByIdError, GetModelsByIdErrors, GetModelsByIdResponse, GetModelsByIdResponses, GetModelsCountData, GetModelsCountError, GetModelsCountErrors, GetModelsCountResponse, GetModelsCountResponses, GetModelsData, GetModelsError, GetModelsErrors, GetModelsModelByModelIdData, GetModelsModelByModelIdError, GetModelsModelByModelIdErrors, GetModelsModelByModelIdResponse, GetModelsModelByModelIdResponses, GetModelsResponse, GetModelsResponses, GetProvidersByIdData, GetProvidersByIdError, GetProvidersByIdErrors, GetProvidersByIdModelsData, GetProvidersByIdModelsError, GetProvidersByIdModelsErrors, GetProvidersByIdModelsResponse, GetProvidersByIdModelsResponses, GetProvidersByIdResponse, GetProvidersByIdResponses, GetProvidersCountData, GetProvidersCountError, GetProvidersCountErrors, GetProvidersCountResponse, GetProvidersCountResponses, GetProvidersData, GetProvidersError, GetProvidersErrors, GetProvidersNameByNameData, GetProvidersNameByNameError, GetProvidersNameByNameErrors, GetProvidersNameByNameResponse, GetProvidersNameByNameResponses, GetProvidersResponse, GetProvidersResponses, GetSearchProvidersByIdData, GetSearchProvidersByIdError, GetSearchProvidersByIdErrors, GetSearchProvidersByIdResponse, GetSearchProvidersByIdResponses, GetSearchProvidersData, GetSearchProvidersError, GetSearchProvidersErrors, GetSearchProvidersMetaData, GetSearchProvidersMetaResponse, GetSearchProvidersMetaResponses, GetSearchProvidersResponse, GetSearchProvidersResponses, GetUsersByIdData, GetUsersByIdError, GetUsersByIdErrors, GetUsersByIdResponse, GetUsersByIdResponses, GetUsersData, GetUsersError, GetUsersErrors, GetUsersMeChannelsByPlatformData, GetUsersMeChannelsByPlatformError, GetUsersMeChannelsByPlatformErrors, GetUsersMeChannelsByPlatformResponse, GetUsersMeChannelsByPlatformResponses, GetUsersMeData, GetUsersMeError, GetUsersMeErrors, GetUsersMeIdentitiesData, GetUsersMeIdentitiesError, GetUsersMeIdentitiesErrors, GetUsersMeIdentitiesResponse, GetUsersMeIdentitiesResponses, GetUsersMeResponse, GetUsersMeResponses, GetUsersResponse, GetUsersResponses, GithubComMemohaiMemohInternalMcpConnection, HandlersBatchDeleteRequest, HandlersChannelMeta, HandlersCreateContainerRequest, HandlersCreateContainerResponse, HandlersCreateSnapshotRequest, HandlersCreateSnapshotResponse, HandlersEmbeddingsInput, HandlersEmbeddingsRequest, HandlersEmbeddingsResponse, HandlersEmbeddingsUsage, HandlersErrorResponse, HandlersFsDeleteRequest, HandlersFsFileInfo, HandlersFsListResponse, HandlersFsMkdirRequest, HandlersFsOpResponse, HandlersFsReadResponse, HandlersFsRenameRequest, HandlersFsUploadResponse, HandlersFsWriteRequest, HandlersGetContainerResponse, HandlersListMyIdentitiesResponse, HandlersListSnapshotsResponse, HandlersLocalChannelMessageRequest, HandlersLoginRequest, HandlersLoginResponse, HandlersMarkReadRequest, HandlersMcpStdioRequest, HandlersMcpStdioResponse, HandlersMemoryAddPayload, HandlersMemoryCompactPayload, HandlersMemoryDeletePayload, HandlersMemorySearchPayload, HandlersSkillItem, HandlersSkillsDeleteRequest, HandlersSkillsOpResponse, HandlersSkillsResponse, HandlersSkillsUpsertRequest, HandlersSnapshotInfo, IdentitiesChannelIdentity, InboxCountResult, InboxCreateRequest, InboxItem, McpExportResponse, McpImportRequest, McpListResponse, McpMcpServerEntry, McpUpsertRequest, MemoryCdfPoint, MemoryCompactResult, MemoryDeleteResponse, MemoryMemoryItem, MemoryMessage, MemoryRebuildResult, MemorySearchResponse, MemoryTopKBucket, MemoryUsageResponse, MessageMessage, MessageMessageAsset, ModelsAddRequest, ModelsAddResponse, ModelsClientType, ModelsCountResponse, ModelsGetResponse, ModelsModelType, ModelsUpdateRequest, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusError, PatchBotsByIdChannelByPlatformStatusErrors, PatchBotsByIdChannelByPlatformStatusResponse, PatchBotsByIdChannelByPlatformStatusResponses, PostAuthLoginData, PostAuthLoginError, PostAuthLoginErrors, PostAuthLoginResponse, PostAuthLoginResponses, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesError, PostBotsByBotIdCliMessagesErrors, PostBotsByBotIdCliMessagesResponse, PostBotsByBotIdCliMessagesResponses, PostBotsByBotIdContainerData, PostBotsByBotIdContainerError, PostBotsByBotIdContainerErrors, PostBotsByBotIdContainerFsDeleteData, PostBotsByBotIdContainerFsDeleteError, PostBotsByBotIdContainerFsDeleteErrors, PostBotsByBotIdContainerFsDeleteResponse, PostBotsByBotIdContainerFsDeleteResponses, PostBotsByBotIdContainerFsMkdirData, PostBotsByBotIdContainerFsMkdirError, PostBotsByBotIdContainerFsMkdirErrors, PostBotsByBotIdContainerFsMkdirResponse, PostBotsByBotIdContainerFsMkdirResponses, PostBotsByBotIdContainerFsRenameData, PostBotsByBotIdContainerFsRenameError, PostBotsByBotIdContainerFsRenameErrors, PostBotsByBotIdContainerFsRenameResponse, PostBotsByBotIdContainerFsRenameResponses, PostBotsByBotIdContainerFsUploadData, PostBotsByBotIdContainerFsUploadError, PostBotsByBotIdContainerFsUploadErrors, PostBotsByBotIdContainerFsUploadResponse, PostBotsByBotIdContainerFsUploadResponses, PostBotsByBotIdContainerFsWriteData, PostBotsByBotIdContainerFsWriteError, PostBotsByBotIdContainerFsWriteErrors, PostBotsByBotIdContainerFsWriteResponse, PostBotsByBotIdContainerFsWriteResponses, PostBotsByBotIdContainerResponse, PostBotsByBotIdContainerResponses, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsError, PostBotsByBotIdContainerSkillsErrors, PostBotsByBotIdContainerSkillsResponse, PostBotsByBotIdContainerSkillsResponses, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsError, PostBotsByBotIdContainerSnapshotsErrors, PostBotsByBotIdContainerSnapshotsResponse, PostBotsByBotIdContainerSnapshotsResponses, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartError, PostBotsByBotIdContainerStartErrors, PostBotsByBotIdContainerStartResponse, PostBotsByBotIdContainerStartResponses, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopError, PostBotsByBotIdContainerStopErrors, PostBotsByBotIdContainerStopResponse, PostBotsByBotIdContainerStopResponses, PostBotsByBotIdInboxData, PostBotsByBotIdInboxError, PostBotsByBotIdInboxErrors, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadError, PostBotsByBotIdInboxMarkReadErrors, PostBotsByBotIdInboxMarkReadResponses, PostBotsByBotIdInboxResponse, PostBotsByBotIdInboxResponses, PostBotsByBotIdMcpData, PostBotsByBotIdMcpError, PostBotsByBotIdMcpErrors, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteError, PostBotsByBotIdMcpOpsBatchDeleteErrors, PostBotsByBotIdMcpOpsBatchDeleteResponses, PostBotsByBotIdMcpResponse, PostBotsByBotIdMcpResponses, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdError, PostBotsByBotIdMcpStdioByConnectionIdErrors, PostBotsByBotIdMcpStdioByConnectionIdResponse, PostBotsByBotIdMcpStdioByConnectionIdResponses, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioError, PostBotsByBotIdMcpStdioErrors, PostBotsByBotIdMcpStdioResponse, PostBotsByBotIdMcpStdioResponses, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactError, PostBotsByBotIdMemoryCompactErrors, PostBotsByBotIdMemoryCompactResponse, PostBotsByBotIdMemoryCompactResponses, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryError, PostBotsByBotIdMemoryErrors, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildError, PostBotsByBotIdMemoryRebuildErrors, PostBotsByBotIdMemoryRebuildResponse, PostBotsByBotIdMemoryRebuildResponses, PostBotsByBotIdMemoryResponse, PostBotsByBotIdMemoryResponses, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchError, PostBotsByBotIdMemorySearchErrors, PostBotsByBotIdMemorySearchResponse, PostBotsByBotIdMemorySearchResponses, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleError, PostBotsByBotIdScheduleErrors, PostBotsByBotIdScheduleResponse, PostBotsByBotIdScheduleResponses, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsError, PostBotsByBotIdSettingsErrors, PostBotsByBotIdSettingsResponse, PostBotsByBotIdSettingsResponses, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsError, PostBotsByBotIdSubagentsByIdSkillsErrors, PostBotsByBotIdSubagentsByIdSkillsResponse, PostBotsByBotIdSubagentsByIdSkillsResponses, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsError, PostBotsByBotIdSubagentsErrors, PostBotsByBotIdSubagentsResponse, PostBotsByBotIdSubagentsResponses, PostBotsByBotIdToolsData, PostBotsByBotIdToolsError, PostBotsByBotIdToolsErrors, PostBotsByBotIdToolsResponse, PostBotsByBotIdToolsResponses, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesError, PostBotsByBotIdWebMessagesErrors, PostBotsByBotIdWebMessagesResponse, PostBotsByBotIdWebMessagesResponses, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatError, PostBotsByIdChannelByPlatformSendChatErrors, PostBotsByIdChannelByPlatformSendChatResponse, PostBotsByIdChannelByPlatformSendChatResponses, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendError, PostBotsByIdChannelByPlatformSendErrors, PostBotsByIdChannelByPlatformSendResponse, PostBotsByIdChannelByPlatformSendResponses, PostBotsData, PostBotsError, PostBotsErrors, PostBotsResponse, PostBotsResponses, PostEmbeddingsData, PostEmbeddingsError, PostEmbeddingsErrors, PostEmbeddingsResponse, PostEmbeddingsResponses, PostModelsData, PostModelsError, PostModelsErrors, PostModelsResponse, PostModelsResponses, PostProvidersByIdTestData, PostProvidersByIdTestError, PostProvidersByIdTestErrors, PostProvidersByIdTestResponse, PostProvidersByIdTestResponses, PostProvidersData, PostProvidersError, PostProvidersErrors, PostProvidersResponse, PostProvidersResponses, PostSearchProvidersData, PostSearchProvidersError, PostSearchProvidersErrors, PostSearchProvidersResponse, PostSearchProvidersResponses, PostUsersData, PostUsersError, PostUsersErrors, PostUsersResponse, PostUsersResponses, ProvidersCheckResult, ProvidersCheckStatus, ProvidersCountResponse, ProvidersCreateRequest, ProvidersGetResponse, ProvidersTestResponse, ProvidersUpdateRequest, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdError, PutBotsByBotIdMcpByIdErrors, PutBotsByBotIdMcpByIdResponse, PutBotsByBotIdMcpByIdResponses, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportError, PutBotsByBotIdMcpImportErrors, PutBotsByBotIdMcpImportResponse, PutBotsByBotIdMcpImportResponses, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdError, PutBotsByBotIdScheduleByIdErrors, PutBotsByBotIdScheduleByIdResponse, PutBotsByBotIdScheduleByIdResponses, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsError, PutBotsByBotIdSettingsErrors, PutBotsByBotIdSettingsResponse, PutBotsByBotIdSettingsResponses, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextError, PutBotsByBotIdSubagentsByIdContextErrors, PutBotsByBotIdSubagentsByIdContextResponse, PutBotsByBotIdSubagentsByIdContextResponses, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdError, PutBotsByBotIdSubagentsByIdErrors, PutBotsByBotIdSubagentsByIdResponse, PutBotsByBotIdSubagentsByIdResponses, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsError, PutBotsByBotIdSubagentsByIdSkillsErrors, PutBotsByBotIdSubagentsByIdSkillsResponse, PutBotsByBotIdSubagentsByIdSkillsResponses, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformError, PutBotsByIdChannelByPlatformErrors, PutBotsByIdChannelByPlatformResponse, PutBotsByIdChannelByPlatformResponses, PutBotsByIdData, PutBotsByIdError, PutBotsByIdErrors, PutBotsByIdMembersData, PutBotsByIdMembersError, PutBotsByIdMembersErrors, PutBotsByIdMembersResponse, PutBotsByIdMembersResponses, PutBotsByIdOwnerData, PutBotsByIdOwnerError, PutBotsByIdOwnerErrors, PutBotsByIdOwnerResponse, PutBotsByIdOwnerResponses, PutBotsByIdResponse, PutBotsByIdResponses, PutModelsByIdData, PutModelsByIdError, PutModelsByIdErrors, PutModelsByIdResponse, PutModelsByIdResponses, PutModelsModelByModelIdData, PutModelsModelByModelIdError, PutModelsModelByModelIdErrors, PutModelsModelByModelIdResponse, PutModelsModelByModelIdResponses, PutProvidersByIdData, PutProvidersByIdError, PutProvidersByIdErrors, PutProvidersByIdResponse, PutProvidersByIdResponses, PutSearchProvidersByIdData, PutSearchProvidersByIdError, PutSearchProvidersByIdErrors, PutSearchProvidersByIdResponse, PutSearchProvidersByIdResponses, PutUsersByIdData, PutUsersByIdError, PutUsersByIdErrors, PutUsersByIdPasswordData, PutUsersByIdPasswordError, PutUsersByIdPasswordErrors, PutUsersByIdPasswordResponses, PutUsersByIdResponse, PutUsersByIdResponses, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformError, PutUsersMeChannelsByPlatformErrors, PutUsersMeChannelsByPlatformResponse, PutUsersMeChannelsByPlatformResponses, PutUsersMeData, PutUsersMeError, PutUsersMeErrors, PutUsersMePasswordData, PutUsersMePasswordError, PutUsersMePasswordErrors, PutUsersMePasswordResponses, PutUsersMeResponse, PutUsersMeResponses, ScheduleCreateRequest, ScheduleListResponse, ScheduleNullableInt, ScheduleSchedule, ScheduleUpdateRequest, SearchprovidersCreateRequest, SearchprovidersGetResponse, SearchprovidersProviderConfigSchema, SearchprovidersProviderFieldSchema, SearchprovidersProviderMeta, SearchprovidersProviderName, SearchprovidersUpdateRequest, SettingsSettings, SettingsUpsertRequest, SubagentAddSkillsRequest, SubagentContextResponse, SubagentCreateRequest, SubagentListResponse, SubagentSkillsResponse, SubagentSubagent, SubagentUpdateContextRequest, SubagentUpdateRequest, SubagentUpdateSkillsRequest } from './types.gen'; diff --git a/packages/sdk/src/sdk.gen.ts b/packages/sdk/src/sdk.gen.ts index df268b98..a8918709 100644 --- a/packages/sdk/src/sdk.gen.ts +++ b/packages/sdk/src/sdk.gen.ts @@ -1,8 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Client, Options as Options2, TDataShape } from './client'; +import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape } from './client'; import { client } from './client.gen'; -import type { DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerErrors, DeleteBotsByBotIdContainerResponses, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsErrors, DeleteBotsByBotIdContainerSkillsResponses, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdErrors, DeleteBotsByBotIdInboxByIdResponses, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdErrors, DeleteBotsByBotIdMcpByIdResponses, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdErrors, DeleteBotsByBotIdMemoryByIdResponses, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryErrors, DeleteBotsByBotIdMemoryResponses, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdErrors, DeleteBotsByBotIdScheduleByIdResponses, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsErrors, DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdErrors, DeleteBotsByBotIdSubagentsByIdResponses, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformErrors, DeleteBotsByIdChannelByPlatformResponses, DeleteBotsByIdData, DeleteBotsByIdErrors, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdErrors, DeleteBotsByIdMembersByUserIdResponses, DeleteBotsByIdResponses, DeleteModelsByIdData, DeleteModelsByIdErrors, DeleteModelsByIdResponses, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdErrors, DeleteModelsModelByModelIdResponses, DeleteProvidersByIdData, DeleteProvidersByIdErrors, DeleteProvidersByIdResponses, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdErrors, DeleteSearchProvidersByIdResponses, GetBotsByBotIdCliStreamData, GetBotsByBotIdCliStreamErrors, GetBotsByBotIdCliStreamResponses, GetBotsByBotIdContainerData, GetBotsByBotIdContainerErrors, GetBotsByBotIdContainerResponses, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSkillsErrors, GetBotsByBotIdContainerSkillsResponses, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdContainerSnapshotsResponses, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxByIdErrors, GetBotsByBotIdInboxByIdResponses, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxCountErrors, GetBotsByBotIdInboxCountResponses, GetBotsByBotIdInboxData, GetBotsByBotIdInboxErrors, GetBotsByBotIdInboxResponses, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpByIdErrors, GetBotsByBotIdMcpByIdResponses, GetBotsByBotIdMcpData, GetBotsByBotIdMcpErrors, GetBotsByBotIdMcpExportData, GetBotsByBotIdMcpExportErrors, GetBotsByBotIdMcpExportResponses, GetBotsByBotIdMcpResponses, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryErrors, GetBotsByBotIdMemoryResponses, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMemoryUsageErrors, GetBotsByBotIdMemoryUsageResponses, GetBotsByBotIdMessagesData, GetBotsByBotIdMessagesErrors, GetBotsByBotIdMessagesResponses, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleByIdErrors, GetBotsByBotIdScheduleByIdResponses, GetBotsByBotIdScheduleData, GetBotsByBotIdScheduleErrors, GetBotsByBotIdScheduleResponses, GetBotsByBotIdSettingsData, GetBotsByBotIdSettingsErrors, GetBotsByBotIdSettingsResponses, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdContextErrors, GetBotsByBotIdSubagentsByIdContextResponses, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdErrors, GetBotsByBotIdSubagentsByIdResponses, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsByIdSkillsErrors, GetBotsByBotIdSubagentsByIdSkillsResponses, GetBotsByBotIdSubagentsData, GetBotsByBotIdSubagentsErrors, GetBotsByBotIdSubagentsResponses, GetBotsByBotIdWebStreamData, GetBotsByBotIdWebStreamErrors, GetBotsByBotIdWebStreamResponses, GetBotsByIdChannelByPlatformData, GetBotsByIdChannelByPlatformErrors, GetBotsByIdChannelByPlatformResponses, GetBotsByIdChecksData, GetBotsByIdChecksErrors, GetBotsByIdChecksResponses, GetBotsByIdData, GetBotsByIdErrors, GetBotsByIdMembersData, GetBotsByIdMembersErrors, GetBotsByIdMembersResponses, GetBotsByIdResponses, GetBotsData, GetBotsErrors, GetBotsResponses, GetChannelsByPlatformData, GetChannelsByPlatformErrors, GetChannelsByPlatformResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetModelsByIdData, GetModelsByIdErrors, GetModelsByIdResponses, GetModelsCountData, GetModelsCountErrors, GetModelsCountResponses, GetModelsData, GetModelsErrors, GetModelsModelByModelIdData, GetModelsModelByModelIdErrors, GetModelsModelByModelIdResponses, GetModelsResponses, GetProvidersByIdData, GetProvidersByIdErrors, GetProvidersByIdModelsData, GetProvidersByIdModelsErrors, GetProvidersByIdModelsResponses, GetProvidersByIdResponses, GetProvidersCountData, GetProvidersCountErrors, GetProvidersCountResponses, GetProvidersData, GetProvidersErrors, GetProvidersNameByNameData, GetProvidersNameByNameErrors, GetProvidersNameByNameResponses, GetProvidersResponses, GetSearchProvidersByIdData, GetSearchProvidersByIdErrors, GetSearchProvidersByIdResponses, GetSearchProvidersData, GetSearchProvidersErrors, GetSearchProvidersMetaData, GetSearchProvidersMetaResponses, GetSearchProvidersResponses, GetUsersByIdData, GetUsersByIdErrors, GetUsersByIdResponses, GetUsersData, GetUsersErrors, GetUsersMeChannelsByPlatformData, GetUsersMeChannelsByPlatformErrors, GetUsersMeChannelsByPlatformResponses, GetUsersMeData, GetUsersMeErrors, GetUsersMeIdentitiesData, GetUsersMeIdentitiesErrors, GetUsersMeIdentitiesResponses, GetUsersMeResponses, GetUsersResponses, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusErrors, PatchBotsByIdChannelByPlatformStatusResponses, PostAuthLoginData, PostAuthLoginErrors, PostAuthLoginResponses, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesErrors, PostBotsByBotIdCliMessagesResponses, PostBotsByBotIdContainerData, PostBotsByBotIdContainerErrors, PostBotsByBotIdContainerResponses, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsErrors, PostBotsByBotIdContainerSkillsResponses, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsErrors, PostBotsByBotIdContainerSnapshotsResponses, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartErrors, PostBotsByBotIdContainerStartResponses, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopErrors, PostBotsByBotIdContainerStopResponses, PostBotsByBotIdInboxData, PostBotsByBotIdInboxErrors, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadErrors, PostBotsByBotIdInboxMarkReadResponses, PostBotsByBotIdInboxResponses, PostBotsByBotIdMcpData, PostBotsByBotIdMcpErrors, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteErrors, PostBotsByBotIdMcpOpsBatchDeleteResponses, PostBotsByBotIdMcpResponses, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdErrors, PostBotsByBotIdMcpStdioByConnectionIdResponses, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioErrors, PostBotsByBotIdMcpStdioResponses, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactErrors, PostBotsByBotIdMemoryCompactResponses, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryErrors, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildErrors, PostBotsByBotIdMemoryRebuildResponses, PostBotsByBotIdMemoryResponses, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchErrors, PostBotsByBotIdMemorySearchResponses, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleErrors, PostBotsByBotIdScheduleResponses, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsErrors, PostBotsByBotIdSettingsResponses, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsErrors, PostBotsByBotIdSubagentsByIdSkillsResponses, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsErrors, PostBotsByBotIdSubagentsResponses, PostBotsByBotIdToolsData, PostBotsByBotIdToolsErrors, PostBotsByBotIdToolsResponses, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesErrors, PostBotsByBotIdWebMessagesResponses, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatErrors, PostBotsByIdChannelByPlatformSendChatResponses, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendErrors, PostBotsByIdChannelByPlatformSendResponses, PostBotsData, PostBotsErrors, PostBotsResponses, PostEmbeddingsData, PostEmbeddingsErrors, PostEmbeddingsResponses, PostModelsData, PostModelsErrors, PostModelsResponses, PostProvidersByIdTestData, PostProvidersByIdTestErrors, PostProvidersByIdTestResponses, PostProvidersData, PostProvidersErrors, PostProvidersResponses, PostSearchProvidersData, PostSearchProvidersErrors, PostSearchProvidersResponses, PostUsersData, PostUsersErrors, PostUsersResponses, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdErrors, PutBotsByBotIdMcpByIdResponses, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportErrors, PutBotsByBotIdMcpImportResponses, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdErrors, PutBotsByBotIdScheduleByIdResponses, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsErrors, PutBotsByBotIdSettingsResponses, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextErrors, PutBotsByBotIdSubagentsByIdContextResponses, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdErrors, PutBotsByBotIdSubagentsByIdResponses, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsErrors, PutBotsByBotIdSubagentsByIdSkillsResponses, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformErrors, PutBotsByIdChannelByPlatformResponses, PutBotsByIdData, PutBotsByIdErrors, PutBotsByIdMembersData, PutBotsByIdMembersErrors, PutBotsByIdMembersResponses, PutBotsByIdOwnerData, PutBotsByIdOwnerErrors, PutBotsByIdOwnerResponses, PutBotsByIdResponses, PutModelsByIdData, PutModelsByIdErrors, PutModelsByIdResponses, PutModelsModelByModelIdData, PutModelsModelByModelIdErrors, PutModelsModelByModelIdResponses, PutProvidersByIdData, PutProvidersByIdErrors, PutProvidersByIdResponses, PutSearchProvidersByIdData, PutSearchProvidersByIdErrors, PutSearchProvidersByIdResponses, PutUsersByIdData, PutUsersByIdErrors, PutUsersByIdPasswordData, PutUsersByIdPasswordErrors, PutUsersByIdPasswordResponses, PutUsersByIdResponses, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformErrors, PutUsersMeChannelsByPlatformResponses, PutUsersMeData, PutUsersMeErrors, PutUsersMePasswordData, PutUsersMePasswordErrors, PutUsersMePasswordResponses, PutUsersMeResponses } from './types.gen'; +import type { DeleteBotsByBotIdContainerData, DeleteBotsByBotIdContainerErrors, DeleteBotsByBotIdContainerResponses, DeleteBotsByBotIdContainerSkillsData, DeleteBotsByBotIdContainerSkillsErrors, DeleteBotsByBotIdContainerSkillsResponses, DeleteBotsByBotIdInboxByIdData, DeleteBotsByBotIdInboxByIdErrors, DeleteBotsByBotIdInboxByIdResponses, DeleteBotsByBotIdMcpByIdData, DeleteBotsByBotIdMcpByIdErrors, DeleteBotsByBotIdMcpByIdResponses, DeleteBotsByBotIdMemoryByIdData, DeleteBotsByBotIdMemoryByIdErrors, DeleteBotsByBotIdMemoryByIdResponses, DeleteBotsByBotIdMemoryData, DeleteBotsByBotIdMemoryErrors, DeleteBotsByBotIdMemoryResponses, DeleteBotsByBotIdScheduleByIdData, DeleteBotsByBotIdScheduleByIdErrors, DeleteBotsByBotIdScheduleByIdResponses, DeleteBotsByBotIdSettingsData, DeleteBotsByBotIdSettingsErrors, DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSubagentsByIdData, DeleteBotsByBotIdSubagentsByIdErrors, DeleteBotsByBotIdSubagentsByIdResponses, DeleteBotsByIdChannelByPlatformData, DeleteBotsByIdChannelByPlatformErrors, DeleteBotsByIdChannelByPlatformResponses, DeleteBotsByIdData, DeleteBotsByIdErrors, DeleteBotsByIdMembersByUserIdData, DeleteBotsByIdMembersByUserIdErrors, DeleteBotsByIdMembersByUserIdResponses, DeleteBotsByIdResponses, DeleteModelsByIdData, DeleteModelsByIdErrors, DeleteModelsByIdResponses, DeleteModelsModelByModelIdData, DeleteModelsModelByModelIdErrors, DeleteModelsModelByModelIdResponses, DeleteProvidersByIdData, DeleteProvidersByIdErrors, DeleteProvidersByIdResponses, DeleteSearchProvidersByIdData, DeleteSearchProvidersByIdErrors, DeleteSearchProvidersByIdResponses, GetBotsByBotIdCliStreamData, GetBotsByBotIdCliStreamErrors, GetBotsByBotIdCliStreamResponses, GetBotsByBotIdContainerData, GetBotsByBotIdContainerErrors, GetBotsByBotIdContainerFsData, GetBotsByBotIdContainerFsDownloadData, GetBotsByBotIdContainerFsDownloadErrors, GetBotsByBotIdContainerFsDownloadResponses, GetBotsByBotIdContainerFsErrors, GetBotsByBotIdContainerFsListData, GetBotsByBotIdContainerFsListErrors, GetBotsByBotIdContainerFsListResponses, GetBotsByBotIdContainerFsReadData, GetBotsByBotIdContainerFsReadErrors, GetBotsByBotIdContainerFsReadResponses, GetBotsByBotIdContainerFsResponses, GetBotsByBotIdContainerResponses, GetBotsByBotIdContainerSkillsData, GetBotsByBotIdContainerSkillsErrors, GetBotsByBotIdContainerSkillsResponses, GetBotsByBotIdContainerSnapshotsData, GetBotsByBotIdContainerSnapshotsResponses, GetBotsByBotIdInboxByIdData, GetBotsByBotIdInboxByIdErrors, GetBotsByBotIdInboxByIdResponses, GetBotsByBotIdInboxCountData, GetBotsByBotIdInboxCountErrors, GetBotsByBotIdInboxCountResponses, GetBotsByBotIdInboxData, GetBotsByBotIdInboxErrors, GetBotsByBotIdInboxResponses, GetBotsByBotIdMcpByIdData, GetBotsByBotIdMcpByIdErrors, GetBotsByBotIdMcpByIdResponses, GetBotsByBotIdMcpData, GetBotsByBotIdMcpErrors, GetBotsByBotIdMcpExportData, GetBotsByBotIdMcpExportErrors, GetBotsByBotIdMcpExportResponses, GetBotsByBotIdMcpResponses, GetBotsByBotIdMemoryData, GetBotsByBotIdMemoryErrors, GetBotsByBotIdMemoryResponses, GetBotsByBotIdMemoryUsageData, GetBotsByBotIdMemoryUsageErrors, GetBotsByBotIdMemoryUsageResponses, GetBotsByBotIdMessagesData, GetBotsByBotIdMessagesErrors, GetBotsByBotIdMessagesResponses, GetBotsByBotIdScheduleByIdData, GetBotsByBotIdScheduleByIdErrors, GetBotsByBotIdScheduleByIdResponses, GetBotsByBotIdScheduleData, GetBotsByBotIdScheduleErrors, GetBotsByBotIdScheduleResponses, GetBotsByBotIdSettingsData, GetBotsByBotIdSettingsErrors, GetBotsByBotIdSettingsResponses, GetBotsByBotIdSubagentsByIdContextData, GetBotsByBotIdSubagentsByIdContextErrors, GetBotsByBotIdSubagentsByIdContextResponses, GetBotsByBotIdSubagentsByIdData, GetBotsByBotIdSubagentsByIdErrors, GetBotsByBotIdSubagentsByIdResponses, GetBotsByBotIdSubagentsByIdSkillsData, GetBotsByBotIdSubagentsByIdSkillsErrors, GetBotsByBotIdSubagentsByIdSkillsResponses, GetBotsByBotIdSubagentsData, GetBotsByBotIdSubagentsErrors, GetBotsByBotIdSubagentsResponses, GetBotsByBotIdWebStreamData, GetBotsByBotIdWebStreamErrors, GetBotsByBotIdWebStreamResponses, GetBotsByIdChannelByPlatformData, GetBotsByIdChannelByPlatformErrors, GetBotsByIdChannelByPlatformResponses, GetBotsByIdChecksData, GetBotsByIdChecksErrors, GetBotsByIdChecksResponses, GetBotsByIdData, GetBotsByIdErrors, GetBotsByIdMembersData, GetBotsByIdMembersErrors, GetBotsByIdMembersResponses, GetBotsByIdResponses, GetBotsData, GetBotsErrors, GetBotsResponses, GetChannelsByPlatformData, GetChannelsByPlatformErrors, GetChannelsByPlatformResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetModelsByIdData, GetModelsByIdErrors, GetModelsByIdResponses, GetModelsCountData, GetModelsCountErrors, GetModelsCountResponses, GetModelsData, GetModelsErrors, GetModelsModelByModelIdData, GetModelsModelByModelIdErrors, GetModelsModelByModelIdResponses, GetModelsResponses, GetProvidersByIdData, GetProvidersByIdErrors, GetProvidersByIdModelsData, GetProvidersByIdModelsErrors, GetProvidersByIdModelsResponses, GetProvidersByIdResponses, GetProvidersCountData, GetProvidersCountErrors, GetProvidersCountResponses, GetProvidersData, GetProvidersErrors, GetProvidersNameByNameData, GetProvidersNameByNameErrors, GetProvidersNameByNameResponses, GetProvidersResponses, GetSearchProvidersByIdData, GetSearchProvidersByIdErrors, GetSearchProvidersByIdResponses, GetSearchProvidersData, GetSearchProvidersErrors, GetSearchProvidersMetaData, GetSearchProvidersMetaResponses, GetSearchProvidersResponses, GetUsersByIdData, GetUsersByIdErrors, GetUsersByIdResponses, GetUsersData, GetUsersErrors, GetUsersMeChannelsByPlatformData, GetUsersMeChannelsByPlatformErrors, GetUsersMeChannelsByPlatformResponses, GetUsersMeData, GetUsersMeErrors, GetUsersMeIdentitiesData, GetUsersMeIdentitiesErrors, GetUsersMeIdentitiesResponses, GetUsersMeResponses, GetUsersResponses, PatchBotsByIdChannelByPlatformStatusData, PatchBotsByIdChannelByPlatformStatusErrors, PatchBotsByIdChannelByPlatformStatusResponses, PostAuthLoginData, PostAuthLoginErrors, PostAuthLoginResponses, PostBotsByBotIdCliMessagesData, PostBotsByBotIdCliMessagesErrors, PostBotsByBotIdCliMessagesResponses, PostBotsByBotIdContainerData, PostBotsByBotIdContainerErrors, PostBotsByBotIdContainerFsDeleteData, PostBotsByBotIdContainerFsDeleteErrors, PostBotsByBotIdContainerFsDeleteResponses, PostBotsByBotIdContainerFsMkdirData, PostBotsByBotIdContainerFsMkdirErrors, PostBotsByBotIdContainerFsMkdirResponses, PostBotsByBotIdContainerFsRenameData, PostBotsByBotIdContainerFsRenameErrors, PostBotsByBotIdContainerFsRenameResponses, PostBotsByBotIdContainerFsUploadData, PostBotsByBotIdContainerFsUploadErrors, PostBotsByBotIdContainerFsUploadResponses, PostBotsByBotIdContainerFsWriteData, PostBotsByBotIdContainerFsWriteErrors, PostBotsByBotIdContainerFsWriteResponses, PostBotsByBotIdContainerResponses, PostBotsByBotIdContainerSkillsData, PostBotsByBotIdContainerSkillsErrors, PostBotsByBotIdContainerSkillsResponses, PostBotsByBotIdContainerSnapshotsData, PostBotsByBotIdContainerSnapshotsErrors, PostBotsByBotIdContainerSnapshotsResponses, PostBotsByBotIdContainerStartData, PostBotsByBotIdContainerStartErrors, PostBotsByBotIdContainerStartResponses, PostBotsByBotIdContainerStopData, PostBotsByBotIdContainerStopErrors, PostBotsByBotIdContainerStopResponses, PostBotsByBotIdInboxData, PostBotsByBotIdInboxErrors, PostBotsByBotIdInboxMarkReadData, PostBotsByBotIdInboxMarkReadErrors, PostBotsByBotIdInboxMarkReadResponses, PostBotsByBotIdInboxResponses, PostBotsByBotIdMcpData, PostBotsByBotIdMcpErrors, PostBotsByBotIdMcpOpsBatchDeleteData, PostBotsByBotIdMcpOpsBatchDeleteErrors, PostBotsByBotIdMcpOpsBatchDeleteResponses, PostBotsByBotIdMcpResponses, PostBotsByBotIdMcpStdioByConnectionIdData, PostBotsByBotIdMcpStdioByConnectionIdErrors, PostBotsByBotIdMcpStdioByConnectionIdResponses, PostBotsByBotIdMcpStdioData, PostBotsByBotIdMcpStdioErrors, PostBotsByBotIdMcpStdioResponses, PostBotsByBotIdMemoryCompactData, PostBotsByBotIdMemoryCompactErrors, PostBotsByBotIdMemoryCompactResponses, PostBotsByBotIdMemoryData, PostBotsByBotIdMemoryErrors, PostBotsByBotIdMemoryRebuildData, PostBotsByBotIdMemoryRebuildErrors, PostBotsByBotIdMemoryRebuildResponses, PostBotsByBotIdMemoryResponses, PostBotsByBotIdMemorySearchData, PostBotsByBotIdMemorySearchErrors, PostBotsByBotIdMemorySearchResponses, PostBotsByBotIdScheduleData, PostBotsByBotIdScheduleErrors, PostBotsByBotIdScheduleResponses, PostBotsByBotIdSettingsData, PostBotsByBotIdSettingsErrors, PostBotsByBotIdSettingsResponses, PostBotsByBotIdSubagentsByIdSkillsData, PostBotsByBotIdSubagentsByIdSkillsErrors, PostBotsByBotIdSubagentsByIdSkillsResponses, PostBotsByBotIdSubagentsData, PostBotsByBotIdSubagentsErrors, PostBotsByBotIdSubagentsResponses, PostBotsByBotIdToolsData, PostBotsByBotIdToolsErrors, PostBotsByBotIdToolsResponses, PostBotsByBotIdWebMessagesData, PostBotsByBotIdWebMessagesErrors, PostBotsByBotIdWebMessagesResponses, PostBotsByIdChannelByPlatformSendChatData, PostBotsByIdChannelByPlatformSendChatErrors, PostBotsByIdChannelByPlatformSendChatResponses, PostBotsByIdChannelByPlatformSendData, PostBotsByIdChannelByPlatformSendErrors, PostBotsByIdChannelByPlatformSendResponses, PostBotsData, PostBotsErrors, PostBotsResponses, PostEmbeddingsData, PostEmbeddingsErrors, PostEmbeddingsResponses, PostModelsData, PostModelsErrors, PostModelsResponses, PostProvidersByIdTestData, PostProvidersByIdTestErrors, PostProvidersByIdTestResponses, PostProvidersData, PostProvidersErrors, PostProvidersResponses, PostSearchProvidersData, PostSearchProvidersErrors, PostSearchProvidersResponses, PostUsersData, PostUsersErrors, PostUsersResponses, PutBotsByBotIdMcpByIdData, PutBotsByBotIdMcpByIdErrors, PutBotsByBotIdMcpByIdResponses, PutBotsByBotIdMcpImportData, PutBotsByBotIdMcpImportErrors, PutBotsByBotIdMcpImportResponses, PutBotsByBotIdScheduleByIdData, PutBotsByBotIdScheduleByIdErrors, PutBotsByBotIdScheduleByIdResponses, PutBotsByBotIdSettingsData, PutBotsByBotIdSettingsErrors, PutBotsByBotIdSettingsResponses, PutBotsByBotIdSubagentsByIdContextData, PutBotsByBotIdSubagentsByIdContextErrors, PutBotsByBotIdSubagentsByIdContextResponses, PutBotsByBotIdSubagentsByIdData, PutBotsByBotIdSubagentsByIdErrors, PutBotsByBotIdSubagentsByIdResponses, PutBotsByBotIdSubagentsByIdSkillsData, PutBotsByBotIdSubagentsByIdSkillsErrors, PutBotsByBotIdSubagentsByIdSkillsResponses, PutBotsByIdChannelByPlatformData, PutBotsByIdChannelByPlatformErrors, PutBotsByIdChannelByPlatformResponses, PutBotsByIdData, PutBotsByIdErrors, PutBotsByIdMembersData, PutBotsByIdMembersErrors, PutBotsByIdMembersResponses, PutBotsByIdOwnerData, PutBotsByIdOwnerErrors, PutBotsByIdOwnerResponses, PutBotsByIdResponses, PutModelsByIdData, PutModelsByIdErrors, PutModelsByIdResponses, PutModelsModelByModelIdData, PutModelsModelByModelIdErrors, PutModelsModelByModelIdResponses, PutProvidersByIdData, PutProvidersByIdErrors, PutProvidersByIdResponses, PutSearchProvidersByIdData, PutSearchProvidersByIdErrors, PutSearchProvidersByIdResponses, PutUsersByIdData, PutUsersByIdErrors, PutUsersByIdPasswordData, PutUsersByIdPasswordErrors, PutUsersByIdPasswordResponses, PutUsersByIdResponses, PutUsersMeChannelsByPlatformData, PutUsersMeChannelsByPlatformErrors, PutUsersMeChannelsByPlatformResponses, PutUsersMeData, PutUsersMeErrors, PutUsersMePasswordData, PutUsersMePasswordErrors, PutUsersMePasswordResponses, PutUsersMeResponses } from './types.gen'; export type Options = Options2 & { /** @@ -96,6 +96,105 @@ export const postBotsByBotIdContainer = (o } }); +/** + * Get file or directory info + * + * Returns metadata about a file or directory at the given container path + */ +export const getBotsByBotIdContainerFs = (options: Options) => (options.client ?? client).get({ url: '/bots/{bot_id}/container/fs', ...options }); + +/** + * Delete a file or directory + * + * Deletes a file or directory at the given container path + */ +export const postBotsByBotIdContainerFsDelete = (options: Options) => (options.client ?? client).post({ + url: '/bots/{bot_id}/container/fs/delete', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Download a file as binary stream + * + * Downloads a file from the container with appropriate Content-Type + */ +export const getBotsByBotIdContainerFsDownload = (options: Options) => (options.client ?? client).get({ url: '/bots/{bot_id}/container/fs/download', ...options }); + +/** + * List directory contents + * + * Lists files and directories at the given container path + */ +export const getBotsByBotIdContainerFsList = (options: Options) => (options.client ?? client).get({ url: '/bots/{bot_id}/container/fs/list', ...options }); + +/** + * Create a directory + * + * Creates a directory (and parents) at the given container path + */ +export const postBotsByBotIdContainerFsMkdir = (options: Options) => (options.client ?? client).post({ + url: '/bots/{bot_id}/container/fs/mkdir', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Read file content as text + * + * Reads the content of a file and returns it as a JSON string + */ +export const getBotsByBotIdContainerFsRead = (options: Options) => (options.client ?? client).get({ url: '/bots/{bot_id}/container/fs/read', ...options }); + +/** + * Rename or move a file/directory + * + * Renames or moves a file/directory from oldPath to newPath + */ +export const postBotsByBotIdContainerFsRename = (options: Options) => (options.client ?? client).post({ + url: '/bots/{bot_id}/container/fs/rename', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Upload a file via multipart form + * + * Uploads a binary file to the given container path + */ +export const postBotsByBotIdContainerFsUpload = (options: Options) => (options.client ?? client).post({ + ...formDataBodySerializer, + url: '/bots/{bot_id}/container/fs/upload', + ...options, + headers: { + 'Content-Type': null, + ...options.headers + } +}); + +/** + * Write text content to a file + * + * Creates or overwrites a file with the provided text content + */ +export const postBotsByBotIdContainerFsWrite = (options: Options) => (options.client ?? client).post({ + url: '/bots/{bot_id}/container/fs/write', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + /** * Delete skills from data directory */ diff --git a/packages/sdk/src/types.gen.ts b/packages/sdk/src/types.gen.ts index e89e62f0..3e24a6ab 100644 --- a/packages/sdk/src/types.gen.ts +++ b/packages/sdk/src/types.gen.ts @@ -397,6 +397,50 @@ export type HandlersErrorResponse = { message?: string; }; +export type HandlersFsDeleteRequest = { + path?: string; + recursive?: boolean; +}; + +export type HandlersFsFileInfo = { + isDir?: boolean; + modTime?: string; + mode?: string; + name?: string; + path?: string; + size?: number; +}; + +export type HandlersFsListResponse = { + entries?: Array; + path?: string; +}; + +export type HandlersFsMkdirRequest = { + path?: string; +}; + +export type HandlersFsReadResponse = { + content?: string; + path?: string; + size?: number; +}; + +export type HandlersFsRenameRequest = { + newPath?: string; + oldPath?: string; +}; + +export type HandlersFsUploadResponse = { + path?: string; + size?: number; +}; + +export type HandlersFsWriteRequest = { + content?: string; + path?: string; +}; + export type HandlersGetContainerResponse = { container_id?: string; container_path?: string; @@ -485,6 +529,10 @@ export type HandlersSnapshotInfo = { version?: number; }; +export type HandlersFsOpResponse = { + ok?: boolean; +}; + export type HandlersListMyIdentitiesResponse = { items?: Array; user_id?: string; @@ -945,6 +993,9 @@ export type SubagentContextResponse = { messages?: Array<{ [key: string]: unknown; }>; + usage?: { + [key: string]: unknown; + }; }; export type SubagentCreateRequest = { @@ -983,12 +1034,18 @@ export type SubagentSubagent = { name?: string; skills?: Array; updated_at?: string; + usage?: { + [key: string]: unknown; + }; }; export type SubagentUpdateContextRequest = { messages?: Array<{ [key: string]: unknown; }>; + usage?: { + [key: string]: unknown; + }; }; export type SubagentUpdateRequest = { @@ -1297,6 +1354,399 @@ export type PostBotsByBotIdContainerResponses = { export type PostBotsByBotIdContainerResponse = PostBotsByBotIdContainerResponses[keyof PostBotsByBotIdContainerResponses]; +export type GetBotsByBotIdContainerFsData = { + body?: never; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query: { + /** + * Container path + */ + path: string; + }; + url: '/bots/{bot_id}/container/fs'; +}; + +export type GetBotsByBotIdContainerFsErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type GetBotsByBotIdContainerFsError = GetBotsByBotIdContainerFsErrors[keyof GetBotsByBotIdContainerFsErrors]; + +export type GetBotsByBotIdContainerFsResponses = { + /** + * OK + */ + 200: HandlersFsFileInfo; +}; + +export type GetBotsByBotIdContainerFsResponse = GetBotsByBotIdContainerFsResponses[keyof GetBotsByBotIdContainerFsResponses]; + +export type PostBotsByBotIdContainerFsDeleteData = { + /** + * Delete request + */ + body: HandlersFsDeleteRequest; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query?: never; + url: '/bots/{bot_id}/container/fs/delete'; +}; + +export type PostBotsByBotIdContainerFsDeleteErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type PostBotsByBotIdContainerFsDeleteError = PostBotsByBotIdContainerFsDeleteErrors[keyof PostBotsByBotIdContainerFsDeleteErrors]; + +export type PostBotsByBotIdContainerFsDeleteResponses = { + /** + * OK + */ + 200: HandlersFsOpResponse; +}; + +export type PostBotsByBotIdContainerFsDeleteResponse = PostBotsByBotIdContainerFsDeleteResponses[keyof PostBotsByBotIdContainerFsDeleteResponses]; + +export type GetBotsByBotIdContainerFsDownloadData = { + body?: never; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query: { + /** + * Container file path + */ + path: string; + }; + url: '/bots/{bot_id}/container/fs/download'; +}; + +export type GetBotsByBotIdContainerFsDownloadErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type GetBotsByBotIdContainerFsDownloadError = GetBotsByBotIdContainerFsDownloadErrors[keyof GetBotsByBotIdContainerFsDownloadErrors]; + +export type GetBotsByBotIdContainerFsDownloadResponses = { + /** + * OK + */ + 200: unknown; +}; + +export type GetBotsByBotIdContainerFsListData = { + body?: never; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query: { + /** + * Container directory path + */ + path: string; + }; + url: '/bots/{bot_id}/container/fs/list'; +}; + +export type GetBotsByBotIdContainerFsListErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type GetBotsByBotIdContainerFsListError = GetBotsByBotIdContainerFsListErrors[keyof GetBotsByBotIdContainerFsListErrors]; + +export type GetBotsByBotIdContainerFsListResponses = { + /** + * OK + */ + 200: HandlersFsListResponse; +}; + +export type GetBotsByBotIdContainerFsListResponse = GetBotsByBotIdContainerFsListResponses[keyof GetBotsByBotIdContainerFsListResponses]; + +export type PostBotsByBotIdContainerFsMkdirData = { + /** + * Mkdir request + */ + body: HandlersFsMkdirRequest; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query?: never; + url: '/bots/{bot_id}/container/fs/mkdir'; +}; + +export type PostBotsByBotIdContainerFsMkdirErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type PostBotsByBotIdContainerFsMkdirError = PostBotsByBotIdContainerFsMkdirErrors[keyof PostBotsByBotIdContainerFsMkdirErrors]; + +export type PostBotsByBotIdContainerFsMkdirResponses = { + /** + * OK + */ + 200: HandlersFsOpResponse; +}; + +export type PostBotsByBotIdContainerFsMkdirResponse = PostBotsByBotIdContainerFsMkdirResponses[keyof PostBotsByBotIdContainerFsMkdirResponses]; + +export type GetBotsByBotIdContainerFsReadData = { + body?: never; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query: { + /** + * Container file path + */ + path: string; + }; + url: '/bots/{bot_id}/container/fs/read'; +}; + +export type GetBotsByBotIdContainerFsReadErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type GetBotsByBotIdContainerFsReadError = GetBotsByBotIdContainerFsReadErrors[keyof GetBotsByBotIdContainerFsReadErrors]; + +export type GetBotsByBotIdContainerFsReadResponses = { + /** + * OK + */ + 200: HandlersFsReadResponse; +}; + +export type GetBotsByBotIdContainerFsReadResponse = GetBotsByBotIdContainerFsReadResponses[keyof GetBotsByBotIdContainerFsReadResponses]; + +export type PostBotsByBotIdContainerFsRenameData = { + /** + * Rename request + */ + body: HandlersFsRenameRequest; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query?: never; + url: '/bots/{bot_id}/container/fs/rename'; +}; + +export type PostBotsByBotIdContainerFsRenameErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Not Found + */ + 404: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type PostBotsByBotIdContainerFsRenameError = PostBotsByBotIdContainerFsRenameErrors[keyof PostBotsByBotIdContainerFsRenameErrors]; + +export type PostBotsByBotIdContainerFsRenameResponses = { + /** + * OK + */ + 200: HandlersFsOpResponse; +}; + +export type PostBotsByBotIdContainerFsRenameResponse = PostBotsByBotIdContainerFsRenameResponses[keyof PostBotsByBotIdContainerFsRenameResponses]; + +export type PostBotsByBotIdContainerFsUploadData = { + body: { + /** + * Destination container path + */ + path: string; + /** + * File to upload + */ + file: Blob | File; + }; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query?: never; + url: '/bots/{bot_id}/container/fs/upload'; +}; + +export type PostBotsByBotIdContainerFsUploadErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type PostBotsByBotIdContainerFsUploadError = PostBotsByBotIdContainerFsUploadErrors[keyof PostBotsByBotIdContainerFsUploadErrors]; + +export type PostBotsByBotIdContainerFsUploadResponses = { + /** + * OK + */ + 200: HandlersFsUploadResponse; +}; + +export type PostBotsByBotIdContainerFsUploadResponse = PostBotsByBotIdContainerFsUploadResponses[keyof PostBotsByBotIdContainerFsUploadResponses]; + +export type PostBotsByBotIdContainerFsWriteData = { + /** + * Write request + */ + body: HandlersFsWriteRequest; + path: { + /** + * Bot ID + */ + bot_id: string; + }; + query?: never; + url: '/bots/{bot_id}/container/fs/write'; +}; + +export type PostBotsByBotIdContainerFsWriteErrors = { + /** + * Bad Request + */ + 400: HandlersErrorResponse; + /** + * Forbidden + */ + 403: HandlersErrorResponse; + /** + * Internal Server Error + */ + 500: HandlersErrorResponse; +}; + +export type PostBotsByBotIdContainerFsWriteError = PostBotsByBotIdContainerFsWriteErrors[keyof PostBotsByBotIdContainerFsWriteErrors]; + +export type PostBotsByBotIdContainerFsWriteResponses = { + /** + * OK + */ + 200: HandlersFsOpResponse; +}; + +export type PostBotsByBotIdContainerFsWriteResponse = PostBotsByBotIdContainerFsWriteResponses[keyof PostBotsByBotIdContainerFsWriteResponses]; + export type DeleteBotsByBotIdContainerSkillsData = { /** * Delete skills payload diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d62ca38..ade02e89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,6 +121,12 @@ importers: '@mozilla/readability': specifier: ^0.6.0 version: 0.6.0 + '@types/jsdom': + specifier: ^27.0.0 + version: 27.0.0 + '@types/turndown': + specifier: ^5.0.6 + version: 5.0.6 ai: specifier: ^6.0.25 version: 6.0.25(zod@4.3.6) diff --git a/spec/docs.go b/spec/docs.go index 0d9545f0..74db9303 100644 --- a/spec/docs.go +++ b/spec/docs.go @@ -370,6 +370,504 @@ const docTemplate = `{ } } }, + "/bots/{bot_id}/container/fs": { + "get": { + "description": "Returns metadata about a file or directory at the given container path", + "tags": [ + "containerd" + ], + "summary": "Get file or directory info", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container path", + "name": "path", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.FSFileInfo" + } + }, + "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/{bot_id}/container/fs/delete": { + "post": { + "description": "Deletes a file or directory at the given container path", + "tags": [ + "containerd" + ], + "summary": "Delete a file or directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Delete request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSDeleteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "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/{bot_id}/container/fs/download": { + "get": { + "description": "Downloads a file from the container with appropriate Content-Type", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "containerd" + ], + "summary": "Download a file as binary stream", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container file path", + "name": "path", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "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/list": { + "get": { + "description": "Lists files and directories at the given container path", + "tags": [ + "containerd" + ], + "summary": "List directory contents", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container directory path", + "name": "path", + "in": "query", + "required": true + } + ], + "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" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/mkdir": { + "post": { + "description": "Creates a directory (and parents) at the given container path", + "tags": [ + "containerd" + ], + "summary": "Create a directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Mkdir request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSMkdirRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/read": { + "get": { + "description": "Reads the content of a file and returns it as a JSON string", + "tags": [ + "containerd" + ], + "summary": "Read file content as text", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container 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" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/rename": { + "post": { + "description": "Renames or moves a file/directory from oldPath to newPath", + "tags": [ + "containerd" + ], + "summary": "Rename or move a file/directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Rename request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSRenameRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "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/{bot_id}/container/fs/upload": { + "post": { + "description": "Uploads a binary file to the given container path", + "consumes": [ + "multipart/form-data" + ], + "tags": [ + "containerd" + ], + "summary": "Upload a file via multipart form", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Destination container path", + "name": "path", + "in": "formData", + "required": true + }, + { + "type": "file", + "description": "File to upload", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.FSUploadResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/write": { + "post": { + "description": "Creates or overwrites a file with the provided text content", + "tags": [ + "containerd" + ], + "summary": "Write text content to a file", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Write request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSWriteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, "/bots/{bot_id}/container/skills": { "get": { "tags": [ @@ -6310,6 +6808,109 @@ const docTemplate = `{ } } }, + "handlers.FSDeleteRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "recursive": { + "type": "boolean" + } + } + }, + "handlers.FSFileInfo": { + "type": "object", + "properties": { + "isDir": { + "type": "boolean" + }, + "modTime": { + "type": "string" + }, + "mode": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSListResponse": { + "type": "object", + "properties": { + "entries": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.FSFileInfo" + } + }, + "path": { + "type": "string" + } + } + }, + "handlers.FSMkdirRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + } + }, + "handlers.FSReadResponse": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSRenameRequest": { + "type": "object", + "properties": { + "newPath": { + "type": "string" + }, + "oldPath": { + "type": "string" + } + } + }, + "handlers.FSUploadResponse": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSWriteRequest": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, "handlers.GetContainerResponse": { "type": "object", "properties": { @@ -6533,6 +7134,14 @@ const docTemplate = `{ } } }, + "handlers.fsOpResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + } + }, "handlers.listMyIdentitiesResponse": { "type": "object", "properties": { @@ -7660,6 +8269,10 @@ const docTemplate = `{ "type": "object", "additionalProperties": {} } + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, @@ -7756,6 +8369,10 @@ const docTemplate = `{ }, "updated_at": { "type": "string" + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, @@ -7768,6 +8385,10 @@ const docTemplate = `{ "type": "object", "additionalProperties": {} } + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, diff --git a/spec/swagger.json b/spec/swagger.json index 933fc957..f96e2d3b 100644 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -361,6 +361,504 @@ } } }, + "/bots/{bot_id}/container/fs": { + "get": { + "description": "Returns metadata about a file or directory at the given container path", + "tags": [ + "containerd" + ], + "summary": "Get file or directory info", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container path", + "name": "path", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.FSFileInfo" + } + }, + "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/{bot_id}/container/fs/delete": { + "post": { + "description": "Deletes a file or directory at the given container path", + "tags": [ + "containerd" + ], + "summary": "Delete a file or directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Delete request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSDeleteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "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/{bot_id}/container/fs/download": { + "get": { + "description": "Downloads a file from the container with appropriate Content-Type", + "produces": [ + "application/octet-stream" + ], + "tags": [ + "containerd" + ], + "summary": "Download a file as binary stream", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container file path", + "name": "path", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "file" + } + }, + "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/list": { + "get": { + "description": "Lists files and directories at the given container path", + "tags": [ + "containerd" + ], + "summary": "List directory contents", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container directory path", + "name": "path", + "in": "query", + "required": true + } + ], + "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" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/mkdir": { + "post": { + "description": "Creates a directory (and parents) at the given container path", + "tags": [ + "containerd" + ], + "summary": "Create a directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Mkdir request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSMkdirRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/read": { + "get": { + "description": "Reads the content of a file and returns it as a JSON string", + "tags": [ + "containerd" + ], + "summary": "Read file content as text", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Container 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" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/rename": { + "post": { + "description": "Renames or moves a file/directory from oldPath to newPath", + "tags": [ + "containerd" + ], + "summary": "Rename or move a file/directory", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Rename request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSRenameRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "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/{bot_id}/container/fs/upload": { + "post": { + "description": "Uploads a binary file to the given container path", + "consumes": [ + "multipart/form-data" + ], + "tags": [ + "containerd" + ], + "summary": "Upload a file via multipart form", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Destination container path", + "name": "path", + "in": "formData", + "required": true + }, + { + "type": "file", + "description": "File to upload", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.FSUploadResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, + "/bots/{bot_id}/container/fs/write": { + "post": { + "description": "Creates or overwrites a file with the provided text content", + "tags": [ + "containerd" + ], + "summary": "Write text content to a file", + "parameters": [ + { + "type": "string", + "description": "Bot ID", + "name": "bot_id", + "in": "path", + "required": true + }, + { + "description": "Write request", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.FSWriteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.fsOpResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/handlers.ErrorResponse" + } + } + } + } + }, "/bots/{bot_id}/container/skills": { "get": { "tags": [ @@ -6301,6 +6799,109 @@ } } }, + "handlers.FSDeleteRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "recursive": { + "type": "boolean" + } + } + }, + "handlers.FSFileInfo": { + "type": "object", + "properties": { + "isDir": { + "type": "boolean" + }, + "modTime": { + "type": "string" + }, + "mode": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSListResponse": { + "type": "object", + "properties": { + "entries": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.FSFileInfo" + } + }, + "path": { + "type": "string" + } + } + }, + "handlers.FSMkdirRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + } + }, + "handlers.FSReadResponse": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSRenameRequest": { + "type": "object", + "properties": { + "newPath": { + "type": "string" + }, + "oldPath": { + "type": "string" + } + } + }, + "handlers.FSUploadResponse": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "size": { + "type": "integer" + } + } + }, + "handlers.FSWriteRequest": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, "handlers.GetContainerResponse": { "type": "object", "properties": { @@ -6524,6 +7125,14 @@ } } }, + "handlers.fsOpResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + } + }, "handlers.listMyIdentitiesResponse": { "type": "object", "properties": { @@ -7651,6 +8260,10 @@ "type": "object", "additionalProperties": {} } + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, @@ -7747,6 +8360,10 @@ }, "updated_at": { "type": "string" + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, @@ -7759,6 +8376,10 @@ "type": "object", "additionalProperties": {} } + }, + "usage": { + "type": "object", + "additionalProperties": {} } } }, diff --git a/spec/swagger.yaml b/spec/swagger.yaml index 3407175c..e8d655f0 100644 --- a/spec/swagger.yaml +++ b/spec/swagger.yaml @@ -663,6 +663,72 @@ definitions: message: type: string type: object + handlers.FSDeleteRequest: + properties: + path: + type: string + recursive: + type: boolean + type: object + handlers.FSFileInfo: + properties: + isDir: + type: boolean + modTime: + type: string + mode: + type: string + name: + type: string + path: + type: string + size: + type: integer + type: object + handlers.FSListResponse: + properties: + entries: + items: + $ref: '#/definitions/handlers.FSFileInfo' + type: array + path: + type: string + type: object + handlers.FSMkdirRequest: + properties: + path: + type: string + type: object + handlers.FSReadResponse: + properties: + content: + type: string + path: + type: string + size: + type: integer + type: object + handlers.FSRenameRequest: + properties: + newPath: + type: string + oldPath: + type: string + type: object + handlers.FSUploadResponse: + properties: + path: + type: string + size: + type: integer + type: object + handlers.FSWriteRequest: + properties: + content: + type: string + path: + type: string + type: object handlers.GetContainerResponse: properties: container_id: @@ -808,6 +874,11 @@ definitions: version: type: integer type: object + handlers.fsOpResponse: + properties: + ok: + type: boolean + type: object handlers.listMyIdentitiesResponse: properties: items: @@ -1555,6 +1626,9 @@ definitions: additionalProperties: {} type: object type: array + usage: + additionalProperties: {} + type: object type: object subagent.CreateRequest: properties: @@ -1619,6 +1693,9 @@ definitions: type: array updated_at: type: string + usage: + additionalProperties: {} + type: object type: object subagent.UpdateContextRequest: properties: @@ -1627,6 +1704,9 @@ definitions: additionalProperties: {} type: object type: array + usage: + additionalProperties: {} + type: object type: object subagent.UpdateRequest: properties: @@ -1885,6 +1965,338 @@ paths: summary: Create and start MCP container for bot tags: - containerd + /bots/{bot_id}/container/fs: + get: + description: Returns metadata about a file or directory at the given container + path + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Container path + in: query + name: path + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.FSFileInfo' + "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: Get file or directory info + tags: + - containerd + /bots/{bot_id}/container/fs/delete: + post: + description: Deletes a file or directory at the given container path + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Delete request + in: body + name: payload + required: true + schema: + $ref: '#/definitions/handlers.FSDeleteRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.fsOpResponse' + "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: Delete a file or directory + tags: + - containerd + /bots/{bot_id}/container/fs/download: + get: + description: Downloads a file from the container with appropriate Content-Type + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Container file path + in: query + name: path + required: true + type: string + produces: + - application/octet-stream + responses: + "200": + description: OK + schema: + type: file + "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: Download a file as binary stream + tags: + - containerd + /bots/{bot_id}/container/fs/list: + get: + description: Lists files and directories at the given container path + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Container directory path + in: query + name: path + required: true + type: string + 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 directory contents + tags: + - containerd + /bots/{bot_id}/container/fs/mkdir: + post: + description: Creates a directory (and parents) at the given container path + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Mkdir request + in: body + name: payload + required: true + schema: + $ref: '#/definitions/handlers.FSMkdirRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.fsOpResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "403": + description: Forbidden + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/handlers.ErrorResponse' + summary: Create a directory + tags: + - containerd + /bots/{bot_id}/container/fs/read: + get: + description: Reads the content of a file and returns it as a JSON string + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Container 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 as text + tags: + - containerd + /bots/{bot_id}/container/fs/rename: + post: + description: Renames or moves a file/directory from oldPath to newPath + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Rename request + in: body + name: payload + required: true + schema: + $ref: '#/definitions/handlers.FSRenameRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.fsOpResponse' + "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: Rename or move a file/directory + tags: + - containerd + /bots/{bot_id}/container/fs/upload: + post: + consumes: + - multipart/form-data + description: Uploads a binary file to the given container path + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Destination container path + in: formData + name: path + required: true + type: string + - description: File to upload + in: formData + name: file + required: true + type: file + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.FSUploadResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "403": + description: Forbidden + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/handlers.ErrorResponse' + summary: Upload a file via multipart form + tags: + - containerd + /bots/{bot_id}/container/fs/write: + post: + description: Creates or overwrites a file with the provided text content + parameters: + - description: Bot ID + in: path + name: bot_id + required: true + type: string + - description: Write request + in: body + name: payload + required: true + schema: + $ref: '#/definitions/handlers.FSWriteRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/handlers.fsOpResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "403": + description: Forbidden + schema: + $ref: '#/definitions/handlers.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/handlers.ErrorResponse' + summary: Write text content to a file + tags: + - containerd /bots/{bot_id}/container/skills: delete: parameters: