Files
goclaw/internal/store/custom_tool_store.go
T
Viet Tran 6895e369f6 refactor: remove standalone mode, consolidate to managed-only (PostgreSQL) (#70)
- Remove standalone mode code: file-based stores, standalone gateway,
  heartbeat service, SQLite memory, standalone docker-compose
- Rename docker-compose.managed.yml → docker-compose.postgres.yml
- Clean up ~130 Go comments referencing "managed mode" qualifier
- Simplify docker-compose.yml env vars (providers/channels via web UI)
- Update .env.example to essential vars only (token + encryption key)
- Add setup wizard UI (provider → agent → channel bootstrap flow)
- Add logs.tail WebSocket handler for live log streaming
- Add cursor-pointer to interactive UI components
- Clean up config page (remove standalone-only sections)
- Update README and docs for managed-only architecture
2026-03-06 18:51:11 +07:00

45 lines
1.6 KiB
Go

package store
import (
"context"
"encoding/json"
"github.com/google/uuid"
)
// CustomToolDef represents a custom tool definition in the database.
type CustomToolDef struct {
BaseModel
Name string `json:"name"`
Description string `json:"description"`
Parameters json.RawMessage `json:"parameters"`
Command string `json:"command"`
WorkingDir string `json:"working_dir,omitempty"`
TimeoutSeconds int `json:"timeout_seconds"`
Env []byte `json:"-"` // encrypted JSONB — never serialized to API
AgentID *uuid.UUID `json:"agent_id,omitempty"`
Enabled bool `json:"enabled"`
CreatedBy string `json:"created_by"`
}
// CustomToolListOpts configures custom tool listing with optional pagination and filtering.
type CustomToolListOpts struct {
AgentID *uuid.UUID
Search string
Limit int
Offset int
}
// CustomToolStore manages custom tool definitions.
type CustomToolStore interface {
Create(ctx context.Context, def *CustomToolDef) error
Get(ctx context.Context, id uuid.UUID) (*CustomToolDef, error)
Update(ctx context.Context, id uuid.UUID, updates map[string]any) error
Delete(ctx context.Context, id uuid.UUID) error
ListGlobal(ctx context.Context) ([]CustomToolDef, error)
ListByAgent(ctx context.Context, agentID uuid.UUID) ([]CustomToolDef, error)
ListAll(ctx context.Context) ([]CustomToolDef, error)
ListPaged(ctx context.Context, opts CustomToolListOpts) ([]CustomToolDef, error)
CountTools(ctx context.Context, opts CustomToolListOpts) (int, error)
}