api

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const FlowSchema = `
# Astonish Agent Flow Schema

## Overview
An agent flow is defined in YAML with nodes (processing steps) and flow (edges connecting them).

## Basic Structure
` + "```yaml" + `
name: agent_name
description: What this agent does

nodes:
  - name: node_name
    type: llm|input|tool|output|update_state
    # type-specific fields...

flow:
  - from: START
    to: first_node
  - from: first_node
    to: second_node
  - from: last_node
    to: END
` + "```" + `

## Node Types

### 1. LLM Node (PREFERRED for tool usage)
AI processing with optional tool use.
- output_model: saves result to state for later nodes
- user_message: DISPLAY result to user (use this when user needs to see the response!)
` + "```yaml" + `
# LLM that shows answer to user (most common pattern)
- name: answer_question
  type: llm
  system: "You are a helpful assistant."
  prompt: "{user_question}"
  output_model:
    answer: str
  user_message:
    - answer  # This displays the LLM response to the user!

# LLM with tools
- name: search_and_summarize
  type: llm
  system: "You are a search assistant."
  prompt: "Search for: {query}"
  tools: true
  tools_selection:
    - tavily-search
  output_model:
    search_result: str
  user_message:
    - search_result  # Show the result to user
` + "```" + `

#### Advanced: Raw Tool Output (CONTEXT OPTIMIZATION)
**WARNING:** Only use this when explicitly requested by the user for large data handling.
This bypasses the LLM for tool output, storing it directly in state.
Useful for large datasets processed by subsequent nodes to save context/costs.

**CRITICAL:** do NOT use this unless the user specifically asks for 'raw output', 'direct state storage', or 'optimization for large data'. For normal flows, use ` + "`" + `output_model` + "`" + `.

When using ` + "`" + `raw_tool_output` + "`" + `, it is highly recommended to also use ` + "`" + `output_model` + "`" + ` to export a status field (e.g., ` + "`" + `<node_context>_status` + "`" + `) to confirm the operation's success/failure for subsequent nodes.

` + "```yaml" + `
- name: fetch_large_dataset
  type: llm
  prompt: "Fetch the data"
  tools: true
  tools_selection: [big_data_tool]
  # output_model is NOT used here because we use raw_tool_output
  raw_tool_output:
    my_large_variable: any  # Stores the raw tool result directly in 'my_large_variable'
` + "```" + `

### 2. Input Node
Collect user input. output_model is REQUIRED to store input in state.

**IMPORTANT: options behavior**
- WITHOUT options: User can type ANY text (free form input)
- WITH options: User can ONLY select from the listed options (no free text!)
` + "```yaml" + `
# Free text input - user can type anything
- name: get_question
  type: input
  prompt: "What is your question?"
  output_model:
    question: str

# Choice input - user can ONLY select from these options
- name: ask_continue
  type: input
  prompt: "Continue? (yes/no)"
  output_model:
    choice: str
  options:
    - "yes"
    - "no"

# DYNAMIC options from state variable (from previous node output)
# Use this when a previous LLM node outputs a list and you want user to select from it
- name: list_items
  type: llm
  prompt: "List all available items"
  output_model:
    items: list  # This outputs a list to state
  tools: true
  user_message:
    - items

- name: select_item
  type: input
  prompt: "Select an item from the list above:"
  output_model:
    selected_item: str
  options:
    - items  # Reference the state variable containing the list (NOT {items}!)
` + "```" + `
**CRITICAL for dynamic options:**
- Use ` + "`" + `options: [variable_name]` + "`" + ` to reference a list from state
- Do NOT use ` + "`" + `options: '{variable_name}'` + "`" + ` - this is WRONG!
- Do NOT use ` + "`" + `options: variable_name` + "`" + ` without brackets - this is WRONG!
- The variable must be a list type from a previous node's output_model

**DO NOT use options if you want the user to type free text!**

### 3. Tool Node (RARELY USED)
Execute a tool directly WITHOUT LLM intelligence. Only use when you need deterministic tool execution.
In most cases, prefer LLM node with tools: true instead.
` + "```yaml" + `
- name: run_fixed_command
  type: tool
  tools_selection:
    - shell_command
  args:
    command: "ls -la"
  output_model:
    shell_result: str
` + "```" + `

### 4. Output Node
Display messages to user. Use user_message array with strings and state variable names.
Note: LLM responses are shown automatically, so output nodes are mainly for formatting/labeling.
` + "```yaml" + `
- name: show_result
  type: output
  user_message:
    - "Answer:"
    - answer
` + "```" + `

### 5. Update State Node
**ONLY use for APPENDING to lists.** For overwriting values, use output_model on LLM/tool nodes instead.

The update_state node is specifically designed for accumulating data over iterations, such as:
- Building conversation history
- Collecting items across a loop
- Aggregating results from multiple iterations

**DO NOT use update_state just to copy or overwrite variables** - that's what output_model does automatically.

` + "```yaml" + `
# CORRECT: Append to a list (building history across loop iterations)
- name: update_history
  type: update_state
  source_variable: ai_message   # The variable to append
  action: append                # APPEND to the list
  output_model:
    history: list               # Target list that grows each iteration

# Example: Simple conversation loop with history
# 1. Get user input -> output_model: {user_message: str}
# 2. LLM generates response -> output_model: {ai_message: str} + user_message: [ai_message]
# 3. Append to history -> source_variable: ai_message, action: append, output_model: {history: list}
# 4. Loop back to step 1
` + "```" + `

**Anti-patterns - DO NOT DO:**
` + "```yaml" + `
# WRONG: Using update_state to overwrite - just use output_model on the LLM node instead!
- name: make_turn
  type: update_state
  action: overwrite        # Don't use update_state for overwrite!
  value:
    user: '{user_message}'
    assistant: '{ai_message}'
  output_model:
    last_turn: dict

# CORRECT: The LLM's output_model already saves variables to state automatically
# No extra node needed - output_model on LLM/tool nodes handles overwriting
` + "```" + `

## Flow Edges

### Simple Edge
` + "```yaml" + `
- from: node_a
  to: node_b
` + "```" + `

### Conditional Edges
` + "```yaml" + `
- from: decision_node
  edges:
    - to: yes_path
      condition: "lambda x: x['decision'] == 'yes'"
    - to: no_path
      condition: "lambda x: x['decision'] == 'no'"
` + "```" + `

### Loop (Back-edge)
IMPORTANT: Loops must point to actual nodes, NEVER to START!
` + "```yaml" + `
- from: ask_continue
  edges:
    - to: get_question  # Loop back to the actual node, NOT to START!
      condition: "lambda x: x['continue'] == 'yes'"
    - to: END
      condition: "lambda x: x['continue'] == 'no'"
` + "```" + `

## State & Templating
- Use {variable_name} to reference state (single braces, no spaces)
- Data flows through nodes via output_model which saves to state
- Access previous node outputs from state keys defined in output_model

## Patterns

### User Confirmation Pattern
Use INPUT node with options for reliable branching:
` + "```yaml" + `
- name: confirm
  type: input
  prompt: "Continue? (yes/no)"
  output_model:
    choice: str
  options:
    - "yes"
    - "no"
` + "```" + `
Then use in conditional edge: ` + "`" + `condition: "lambda x: x['choice'] == 'yes'"` + "`" + `

### Displaying LLM Response
Always add user_message when the user should see the output:
` + "```yaml" + `
- name: process
  type: llm
  prompt: "{user_input}"
  output_model:
    result: str
  user_message:
    - result  # This shows the response to the user
` + "```" + `

## Anti-Patterns (DO NOT DO)

❌ Using LLM to check yes/no conditions - unpredictable output breaks edges
❌ Creating "check_exit" or "check_quit" nodes - use input with options instead  
❌ Missing user_message on LLM nodes - user won't see the response
❌ Using LLM output in conditional edges - conditions may never match

## Rules
1. Flow must start from START and end at END
2. START and END are VIRTUAL nodes - they are NOT actual nodes you define
3. You can ONLY use "from: START" to begin the flow - NEVER use "to: START"
4. Loops must point to actual node names (e.g., "to: get_question"), NEVER to START
5. All node names must be unique
6. Use output_model to pass data between nodes
7. ALWAYS include user_message on LLM nodes when user should see output
8. For branching/loops, use INPUT with options - gives reliable condition values
9. NEVER use LLM output in conditional edges - it's unpredictable
`

FlowSchema contains the schema documentation for AI to understand flow structure

Variables

This section is empty.

Functions

func AIChatHandler

func AIChatHandler(w http.ResponseWriter, r *http.Request)

AIChatHandler handles AI chat requests

func AIToolSearchHandler added in v1.3.2

func AIToolSearchHandler(w http.ResponseWriter, r *http.Request)

AIToolSearchHandler handles POST /api/ai/tool-search Uses AI to semantically evaluate which store tools can fulfill the requirement

func AIToolSearchInternetHandler added in v1.3.2

func AIToolSearchInternetHandler(w http.ResponseWriter, r *http.Request)

AIToolSearchInternetHandler handles POST /api/ai/tool-search-internet

func AddServerToolsToCache added in v1.3.1

func AddServerToolsToCache(serverName string, newTools []ToolInfo)

AddServerToolsToCache adds tools from a specific server to the cache This is used for incremental updates when installing a new MCP server

func AddTapHandler added in v1.2.0

func AddTapHandler(w http.ResponseWriter, r *http.Request)

AddTapHandler handles POST /api/flow-store/taps

func CheckMCPDependenciesHandler added in v1.4.0

func CheckMCPDependenciesHandler(w http.ResponseWriter, r *http.Request)

CheckMCPDependenciesHandler handles POST /api/mcp-dependencies/check Checks which MCP servers from the dependency list are installed

func CollectToolsFromNodes added in v1.4.0

func CollectToolsFromNodes(nodes []config.Node) []string

CollectToolsFromNodes extracts all tools_selection from all nodes in an agent config.

func CopyAgentToLocalHandler added in v1.2.0

func CopyAgentToLocalHandler(w http.ResponseWriter, r *http.Request)

CopyAgentToLocalHandler handles POST /api/agents/{name}/copy-to-local Copies a store flow to the user's local agents directory for editing

func DeleteAgentHandler

func DeleteAgentHandler(w http.ResponseWriter, r *http.Request)

DeleteAgentHandler handles DELETE /api/agents/{name}

func ExtractMissingToolsFromResponse added in v1.3.2

func ExtractMissingToolsFromResponse(response string) []string

ExtractMissingToolsFromResponse parses the AI response to detect missing tools Returns a list of search queries for tools the AI says are missing

func FormatValidationErrors

func FormatValidationErrors(errors []string) string

FormatValidationErrors formats validation errors for LLM feedback

func GetAgentHandler

func GetAgentHandler(w http.ResponseWriter, r *http.Request)

GetAgentHandler handles GET /api/agents/{name}

func GetFlowSchema

func GetFlowSchema() string

GetFlowSchema returns the schema as a string for AI context

func GetMCPSettingsHandler

func GetMCPSettingsHandler(w http.ResponseWriter, r *http.Request)

GetMCPSettingsHandler handles GET /api/settings/mcp

func GetMCPStoreServerHandler added in v1.1.0

func GetMCPStoreServerHandler(w http.ResponseWriter, r *http.Request)

GetMCPStoreServerHandler handles GET /api/mcp-store/{id}

func GetMCPStoreTagsHandler added in v1.1.0

func GetMCPStoreTagsHandler(w http.ResponseWriter, r *http.Request)

GetMCPStoreTagsHandler handles GET /api/mcp-store/tags

func GetSettingsHandler

func GetSettingsHandler(w http.ResponseWriter, r *http.Request)

GetSettingsHandler handles GET /api/settings/config

func GetSetupStatusHandler added in v1.0.7

func GetSetupStatusHandler(w http.ResponseWriter, r *http.Request)

GetSetupStatusHandler handles GET /api/settings/status

func HandleChat

func HandleChat(w http.ResponseWriter, r *http.Request)

HandleChat handles the /api/chat endpoint with SSE streaming

func HandleSessionKeepalive added in v1.3.3

func HandleSessionKeepalive(w http.ResponseWriter, r *http.Request)

HandleSessionKeepalive handles POST /api/session/{id}/keepalive - extends session lifetime The UI should call this every 30 seconds while a flow is active to prevent timeout

func HandleStopSession added in v1.3.1

func HandleStopSession(w http.ResponseWriter, r *http.Request)

HandleStopSession handles POST /api/session/{id}/stop - cleans up session and MCP

func InitToolsCache

func InitToolsCache(ctx context.Context)

InitToolsCache initializes the tools cache at server startup It tries to load from persistent cache first for fast startup

func InstallFlowHandler added in v1.2.0

func InstallFlowHandler(w http.ResponseWriter, r *http.Request)

InstallFlowHandler handles POST /api/flow-store/{tap}/{flow}/install

func InstallInlineMCPServerHandler added in v1.4.0

func InstallInlineMCPServerHandler(w http.ResponseWriter, r *http.Request)

InstallInlineMCPServerHandler handles POST /api/mcp/install-inline Adds an inline MCP server configuration to the user's MCP config

func InstallMCPStoreServerHandler added in v1.1.0

func InstallMCPStoreServerHandler(w http.ResponseWriter, r *http.Request)

InstallMCPStoreServerHandler handles POST /api/mcp-store/{id}/install Adds the MCP server configuration to the user's MCP config

func InternetMCPInstallHandler added in v1.3.2

func InternetMCPInstallHandler(w http.ResponseWriter, r *http.Request)

InternetMCPInstallHandler handles POST /api/mcp-internet-install

func IsWebExtractConfigured added in v1.3.2

func IsWebExtractConfigured() (bool, string)

IsWebExtractConfigured checks if a web extract tool is configured in settings Returns (configured, serverName) The setting value format is "serverName:toolName" to uniquely identify tools

func IsWebSearchConfigured added in v1.3.2

func IsWebSearchConfigured() (bool, string)

IsWebSearchConfigured checks if a web search tool is configured in settings Returns (configured, serverName, toolName) The setting value format is "serverName:toolName" to uniquely identify tools

func ListAgentsHandler

func ListAgentsHandler(w http.ResponseWriter, r *http.Request)

ListAgentsHandler handles GET /api/agents

func ListFlowStoreHandler added in v1.2.0

func ListFlowStoreHandler(w http.ResponseWriter, r *http.Request)

ListFlowStoreHandler handles GET /api/flow-store Returns all taps and flows

func ListMCPStoreHandler added in v1.1.0

func ListMCPStoreHandler(w http.ResponseWriter, r *http.Request)

ListMCPStoreHandler handles GET /api/mcp-store Supports query parameters: - ?q=<search query> for text search - ?source=<source name> to filter by source (e.g., "official", tap name, or "all") Only returns servers with valid configs (installable) All MCPs come from tapped repos (including official tap)

func ListProviderModelsHandler

func ListProviderModelsHandler(w http.ResponseWriter, r *http.Request)

ListProviderModelsHandler handles GET /api/providers/{providerId}/models

func ListProviderModelsWithMetadataHandler added in v1.3.3

func ListProviderModelsWithMetadataHandler(w http.ResponseWriter, r *http.Request)

ListProviderModelsWithMetadataHandler handles GET /api/providers/{providerId}/models-metadata Returns enhanced model information with pricing for OpenRouter, basic info for others

func ListTapsHandler added in v1.2.0

func ListTapsHandler(w http.ResponseWriter, r *http.Request)

ListTapsHandler handles GET /api/flow-store/taps

func ListToolsHandler

func ListToolsHandler(w http.ResponseWriter, r *http.Request)

ListToolsHandler handles GET /api/tools

func OrderYamlKeys added in v1.3.1

func OrderYamlKeys(data map[string]interface{}) map[string]interface{}

OrderYamlKeys creates a new map with keys in a consistent order Order: name, description, model, nodes, flow, layout, then any remaining keys alphabetically

func RefreshToolsCache

func RefreshToolsCache(ctx context.Context)

RefreshToolsCache forces a refresh of the tools cache

func RegisterRoutes

func RegisterRoutes(router *mux.Router)

RegisterRoutes registers the API routes on a router

func RemoveServerToolsFromCache added in v1.3.1

func RemoveServerToolsFromCache(serverName string)

RemoveServerToolsFromCache removes all tools from a specific server This is used when uninstalling/deleting an MCP server

func RemoveTapHandler added in v1.2.0

func RemoveTapHandler(w http.ResponseWriter, r *http.Request)

RemoveTapHandler handles DELETE /api/flow-store/taps/{name}

func ResolveMCPDependencies added in v1.4.0

func ResolveMCPDependencies(toolsSelection []string, cachedTools []ToolInfo, storeServers []mcpstore.Server, existingDeps []config.MCPDependency) []config.MCPDependency

ResolveMCPDependencies analyzes tools used in a flow and resolves them to MCP server dependencies. It looks up each tool's source server and determines if it comes from: - store: official MCP store (or custom tap in the store) - tap: a tapped repository - inline: user's locally configured server (fallback) ResolveMCPDependencies analyzes tools used in a flow and resolves them to MCP server dependencies. It looks up each tool's source server and determines if it comes from: - store: official MCP store (or custom tap in the store) - tap: a tapped repository - inline: user's locally configured server (fallback)

func SaveAgentHandler

func SaveAgentHandler(w http.ResponseWriter, r *http.Request)

SaveAgentHandler handles PUT /api/agents/{name}

func SendErrorSSE

func SendErrorSSE(w io.Writer, flusher http.Flusher, msg string)

SendErrorSSE sends an error event

func SendSSE

func SendSSE(w io.Writer, flusher http.Flusher, eventType string, data interface{})

SendSSE sends a Server-Sent Event

func URLExtractHandler added in v1.3.2

func URLExtractHandler(w http.ResponseWriter, r *http.Request)

URLExtractHandler handles POST /api/ai/url-extract Uses tavily-extract or similar to extract MCP server info from a URL

func UninstallFlowHandler added in v1.2.0

func UninstallFlowHandler(w http.ResponseWriter, r *http.Request)

UninstallFlowHandler handles DELETE /api/flow-store/{tap}/{flow}

func UpdateFlowStoreHandler added in v1.2.0

func UpdateFlowStoreHandler(w http.ResponseWriter, r *http.Request)

UpdateFlowStoreHandler handles POST /api/flow-store/update Forces a refresh from remote, bypassing the cache

func UpdateMCPSettingsHandler

func UpdateMCPSettingsHandler(w http.ResponseWriter, r *http.Request)

UpdateMCPSettingsHandler handles PUT /api/settings/mcp

func UpdateSettingsHandler

func UpdateSettingsHandler(w http.ResponseWriter, r *http.Request)

UpdateSettingsHandler handles PUT /api/settings/config

func WebCapableToolsHandler added in v1.3.2

func WebCapableToolsHandler(w http.ResponseWriter, r *http.Request)

WebCapableToolsHandler returns tools containing "websearch" or "webextract" in their name GET /api/tools/web-capable

Types

type AIChatRequest

type AIChatRequest struct {
	Message       string        `json:"message"`
	Context       string        `json:"context"`       // "create_flow" | "modify_nodes" | "node_config"
	CurrentYAML   string        `json:"currentYaml"`   // Current flow state
	SelectedNodes []string      `json:"selectedNodes"` // For node operations
	History       []ChatMessage `json:"history"`       // Conversation history
}

AIChatRequest is the request body for AI chat

type AIChatResponse

type AIChatResponse struct {
	Message      string `json:"message"`      // AI response text
	ProposedYAML string `json:"proposedYaml"` // Generated/modified YAML (if any)
	Action       string `json:"action"`       // "preview" | "apply" | "info"
	Error        string `json:"error,omitempty"`
}

AIChatResponse is the response from AI chat

type AddTapRequest added in v1.2.0

type AddTapRequest struct {
	URL   string `json:"url"`   // e.g., "company" or "company/repo"
	Alias string `json:"alias"` // Optional custom name
}

AddTapRequest is the request for POST /api/flow-store/taps

type AgentDetailResponse

type AgentDetailResponse struct {
	Name   string              `json:"name"`
	Source string              `json:"source"`
	YAML   string              `json:"yaml"`
	Config *config.AgentConfig `json:"config,omitempty"`
}

AgentDetailResponse is the response for GET /api/agents/:name

type AgentListItem

type AgentListItem struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Source       string `json:"source"` // "system", "local", or "store"
	HasError     bool   `json:"hasError,omitempty"`
	ErrorMessage string `json:"errorMessage,omitempty"`
	IsReadOnly   bool   `json:"isReadOnly,omitempty"` // True for store flows
	TapName      string `json:"tapName,omitempty"`    // For store flows: which tap
}

AgentListItem represents an agent in the list response

type AgentListResponse

type AgentListResponse struct {
	Agents []AgentListItem `json:"agents"`
}

AgentListResponse is the response for GET /api/agents

type AppSettingsResponse

type AppSettingsResponse struct {
	General   GeneralSettings    `json:"general"`
	Providers []ProviderSettings `json:"providers"`
}

AppSettingsResponse is the response for GET /api/settings/config

type ChatMessage

type ChatMessage struct {
	Role    string `json:"role"` // "user" | "assistant"
	Content string `json:"content"`
}

ChatMessage represents a message in the conversation

type ChatRequest

type ChatRequest struct {
	AgentID   string `json:"agentId"`
	Message   string `json:"message"` // User input
	SessionID string `json:"sessionId"`
	Provider  string `json:"provider,omitempty"`
	Model     string `json:"model,omitempty"`
}

ChatRequest represents the request body for /api/chat

type CheckMCPDependenciesRequest added in v1.4.0

type CheckMCPDependenciesRequest struct {
	Dependencies []config.MCPDependency `json:"dependencies"`
}

CheckMCPDependenciesRequest is the request body for checking dependencies

type CheckMCPDependenciesResponse added in v1.4.0

type CheckMCPDependenciesResponse struct {
	Dependencies []MCPDependencyStatus `json:"dependencies"`
	AllInstalled bool                  `json:"all_installed"`
	Missing      int                   `json:"missing"`
}

CheckMCPDependenciesResponse is the response for the check endpoint

type FlowInfo added in v1.2.0

type FlowInfo struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
	TapName     string   `json:"tapName"`
	Installed   bool     `json:"installed"`
	FullName    string   `json:"fullName"` // tap/flow or just flow for official
}

FlowInfo represents a flow for the UI

type FlowStoreListResponse added in v1.2.0

type FlowStoreListResponse struct {
	Taps  []TapInfo  `json:"taps"`
	Flows []FlowInfo `json:"flows"`
}

FlowStoreListResponse is the response for GET /api/flow-store

type FlowValidationResult

type FlowValidationResult struct {
	Valid  bool
	Errors []string
}

FlowValidationResult contains the result of validating a flow YAML

func ValidateFlowYAML

func ValidateFlowYAML(yamlStr string, availableTools []ToolInfo) FlowValidationResult

ValidateFlowYAML validates the generated flow YAML against the schema rules

type GeneralSettings

type GeneralSettings struct {
	DefaultProvider            string `json:"default_provider"`
	DefaultProviderDisplayName string `json:"default_provider_display_name"`
	DefaultModel               string `json:"default_model"`
	WebSearchTool              string `json:"web_search_tool"`
	WebExtractTool             string `json:"web_extract_tool"`
}

GeneralSettings represents the general app settings

type InstallInlineMCPServerRequest added in v1.4.0

type InstallInlineMCPServerRequest struct {
	ServerName string                 `json:"serverName"`
	Config     config.MCPServerConfig `json:"config"`
}

InstallInlineMCPServerRequest is the request for POST /api/mcp/install-inline

type InternetMCPInstallRequest added in v1.3.2

type InternetMCPInstallRequest struct {
	Name    string            `json:"name"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`
}

type InternetMCPInstallResponse added in v1.3.2

type InternetMCPInstallResponse struct {
	Status      string `json:"status"`
	ToolsLoaded int    `json:"toolsLoaded,omitempty"`
	Error       string `json:"error,omitempty"`
}

InternetMCPInstallResponse is the response for /api/mcp-internet-install

type InternetMCPResult added in v1.3.2

type InternetMCPResult struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	URL         string            `json:"url"`
	InstallType string            `json:"installType"` // npx, github, etc
	Command     string            `json:"command"`
	Args        []string          `json:"args"`
	EnvVars     map[string]string `json:"envVars,omitempty"`
	Confidence  float64           `json:"confidence"`
	Source      string            `json:"source"` // tavily-search
}

InternetMCPResult represents an MCP server found via internet search

type InternetSearchRequest added in v1.3.2

type InternetSearchRequest struct {
	Requirement string `json:"requirement"`
}

InternetSearchRequest is the request for POST /api/ai/tool-search-internet

type InternetSearchResponse added in v1.3.2

type InternetSearchResponse struct {
	TavilyAvailable bool                `json:"tavilyAvailable"`
	Results         []InternetMCPResult `json:"results"`
	Message         string              `json:"message,omitempty"`
	ToolUsed        string              `json:"toolUsed,omitempty"`    // Name of the MCP tool used for search
	SearchQuery     string              `json:"searchQuery,omitempty"` // The query sent to the tool
}

InternetSearchResponse is the response for POST /api/ai/tool-search-internet

type MCPDependencyStatus added in v1.4.0

type MCPDependencyStatus struct {
	Server    string                  `json:"server"`
	Tools     []string                `json:"tools"`
	Source    string                  `json:"source"` // store, tap, inline
	StoreID   string                  `json:"store_id,omitempty"`
	Config    *config.MCPServerConfig `json:"config,omitempty"`
	Installed bool                    `json:"installed"`
}

MCPDependencyStatus represents the status of a single MCP dependency

type MCPStoreInstallRequest added in v1.1.0

type MCPStoreInstallRequest struct {
	ServerName string            `json:"serverName,omitempty"` // Optional: custom name for the server
	Env        map[string]string `json:"env,omitempty"`        // Optional: environment variable overrides
}

MCPStoreInstallRequest is the request for POST /api/mcp-store/:id/install

type MCPStoreListResponse added in v1.1.0

type MCPStoreListResponse struct {
	Servers []mcpstore.Server `json:"servers"`
	Sources []string          `json:"sources"` // Available sources for filtering
	Total   int               `json:"total"`
}

MCPStoreListResponse is the response for GET /api/mcp-store

type ProviderSettings

type ProviderSettings struct {
	Name        string            `json:"name"`
	DisplayName string            `json:"display_name"`
	Configured  bool              `json:"configured"`
	Fields      map[string]string `json:"fields"` // Masked values for display
}

ProviderSettings represents a provider's configuration (masked)

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

SessionManager manages active sessions

func GetSessionManager

func GetSessionManager() *SessionManager

GetSessionManager returns the singleton session manager

func (*SessionManager) CleanupSession added in v1.3.1

func (sm *SessionManager) CleanupSession(sessionID string)

CleanupSession removes a session and its MCP manager

func (*SessionManager) GetOrCreateMCPManager added in v1.3.1

func (sm *SessionManager) GetOrCreateMCPManager(ctx context.Context, sessionID string, requiredServers []string) (*mcp.Manager, []tool.Toolset)

GetOrCreateMCPManager returns the MCP manager for a session, creating if needed

func (*SessionManager) TouchSession added in v1.3.1

func (sm *SessionManager) TouchSession(sessionID string)

TouchSession updates the last activity time for a session

type SetupStatusResponse added in v1.0.7

type SetupStatusResponse struct {
	SetupRequired       bool     `json:"setupRequired"`
	HasDefaultProvider  bool     `json:"hasDefaultProvider"`
	HasDefaultModel     bool     `json:"hasDefaultModel"`
	ConfiguredProviders []string `json:"configuredProviders"`
}

SetupStatusResponse represents the setup status for the wizard

type TapInfo added in v1.2.0

type TapInfo struct {
	Name       string `json:"name"`
	URL        string `json:"url"`
	IsOfficial bool   `json:"isOfficial"`
}

TapInfo represents a tap for the UI

type ToolInfo

type ToolInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Source      string `json:"source"` // "internal" or MCP server name
}

ToolInfo represents a tool in the list response

func GetCachedTools

func GetCachedTools() []ToolInfo

GetCachedTools returns the cached tools list

type ToolSearchRequest added in v1.3.2

type ToolSearchRequest struct {
	Requirement string `json:"requirement"` // What the user needs (e.g., "take screenshots of websites")
}

ToolSearchRequest is the request for POST /api/ai/tool-search

type ToolSearchResponse added in v1.3.2

type ToolSearchResponse struct {
	Results []ToolSearchResult `json:"results"`
	Total   int                `json:"total"`
}

ToolSearchResponse is the response for POST /api/ai/tool-search

type ToolSearchResult added in v1.3.2

type ToolSearchResult struct {
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	Description    string            `json:"description"`
	Source         string            `json:"source"`
	Tags           []string          `json:"tags"`
	Installable    bool              `json:"installable"`
	Reason         string            `json:"reason,omitempty"`  // Why this tool matches the requirement
	RequiresApiKey bool              `json:"requiresApiKey"`    // Whether tool requires API key
	EnvVars        map[string]string `json:"envVars,omitempty"` // Required env vars (key -> placeholder value)
}

ToolSearchResult represents a matching tool from the store

type ToolsCache

type ToolsCache struct {
	// contains filtered or unexported fields
}

ToolsCache holds cached tool information to avoid re-initializing MCP on every request

type ToolsListResponse

type ToolsListResponse struct {
	Tools []ToolInfo `json:"tools"`
}

ToolsListResponse is the response for GET /api/tools

type URLExtractRequest added in v1.3.2

type URLExtractRequest struct {
	URL string `json:"url"`
}

URLExtractRequest is the request for POST /api/ai/url-extract

type URLExtractResponse added in v1.3.2

type URLExtractResponse struct {
	Found     bool               `json:"found"`
	MCPServer *InternetMCPResult `json:"mcpServer,omitempty"`
	Message   string             `json:"message,omitempty"`
	ToolUsed  string             `json:"toolUsed,omitempty"`
	URL       string             `json:"url"`
}

URLExtractResponse is the response for POST /api/ai/url-extract

type UpdateAppSettingsRequest

type UpdateAppSettingsRequest struct {
	General   *GeneralSettings             `json:"general,omitempty"`
	Providers map[string]map[string]string `json:"providers,omitempty"`
}

UpdateAppSettingsRequest is the request for PUT /api/settings/config

type WebCapableTool added in v1.3.2

type WebCapableTool struct {
	Name   string `json:"name"`   // Full tool name (e.g., "mcp_tavily_tavily-websearch")
	Source string `json:"source"` // MCP server source name
}

WebCapableTool represents a tool that can be used for web search or extract

type WebCapableToolsResponse added in v1.3.2

type WebCapableToolsResponse struct {
	WebSearch  []WebCapableTool `json:"webSearch"`
	WebExtract []WebCapableTool `json:"webExtract"`
}

WebCapableToolsResponse is the response for GET /api/tools/web-capable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL