Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

chore: remove internal planning doc, add gitignore patterns

rcourtmana7de907c359d
diff --git a/.gitignore b/.gitignore
index 288fec15ab..49df51a0d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,6 +127,9 @@ tmp/
# Master plan documents (local only)
PULSE_V4_ISSUES_MASTER_PLAN.md
FIX_SUMMARY_*.md
+docs/*_PLAN.md
+docs/*_ROADMAP.md
+docs/*IMPLEMENTATION*.md
# Development documentation
TYPING_*.md
diff --git a/docs/AGENTS_AI_SCOPE_PLAN.md b/docs/AGENTS_AI_SCOPE_PLAN.md
deleted file mode 100644
index 99ce053f19..0000000000
--- a/docs/AGENTS_AI_SCOPE_PLAN.md
+++ /dev/null
@@ -1,149 +0,0 @@
-AGENTS AI SCOPE PROFILE PLAN
-
-Context
-- Agent profiles exist today and are managed via AgentProfilesAPI.
-- Current UI copy implied AI could auto-create profiles, but that flow does not exist.
-- Goal: add AI-assisted suggestions that are always reviewed and explicitly created by the user.
-
-Goals
-- Provide an AI "Suggest profile" flow that drafts a scope profile and explains the rationale.
-- Keep user in control: no auto-creation, no auto-assignment, no silent changes.
-- Integrate with existing profile CRUD (AgentProfilesAPI.createProfile / assignProfile).
-
-Non-Goals
-- No background or automatic profile creation.
-- No automatic assignment to agents.
-- No backend changes to agent config schema in this phase.
-
-Proposed UX
-Entry points
-- Agent Profiles page: "Suggest profile" button next to "New Profile".
-- Optional: Unified Agents table row action "Suggest profile from this agent" to seed context.
-
-Flow
-1) User clicks "Suggest profile".
-2) Modal opens with:
- - Prompt text area (optional) + default prompt template.
- - Scope of inputs toggles (agent telemetry, current profile examples, etc.).
-3) AI returns a draft:
- - name
- - description (why this profile exists)
- - config JSON
- - rationale bullets (what signals led to the configuration)
-4) User reviews and can edit name/description/config.
-5) User clicks "Create profile".
-6) Optional follow-up: "Assign to agents" (separate explicit action).
-
-UX requirements
-- Clear labels: "Suggest" or "Draft", never "Auto-create".
-- Show JSON in a code editor-style area with validation errors.
-- "Create profile" disabled until JSON validates.
-- Provide copy/export for the config JSON.
-
-Data inputs (minimal viable)
-- User prompt text.
-- Selected agent IDs (if starting from an agent).
-- Basic agent metadata: hostname, platform, versions, tags, types (host/docker/k8s).
-
-Data inputs (nice to have)
-- Recent health signals: last seen, status, error flags.
-- Existing profile list to avoid duplicates and suggest edits.
-- Links to the agent config schema (so suggestions are valid).
-
-AI output contract (server side)
-- A stable JSON envelope with:
- - name: string
- - description: string
- - config: object
- - rationale: string[]
-- If model returns invalid JSON, backend should retry once and then return a friendly error.
-
-API proposal
-- POST /api/admin/profiles/suggestions
- - body: { prompt, agentIds?: string[], includeTelemetry?: boolean }
- - response: { name, description, config, rationale }
-- This endpoint can be a thin wrapper around the internal LLM service.
-- If not licensed, return 402 and the UI should show the Pro gating.
-
-Frontend plan
-1) Add "Suggest profile" button to AgentProfilesPanel.
-2) Create SuggestProfileModal component:
- - prompt input
- - loading state
- - response preview (name, description, rationale)
- - editable config text area with validation
-3) On "Create profile", call AgentProfilesAPI.createProfile.
-4) On success, refresh profile list and show toast.
-5) Optional: allow "Assign to selected agents" step.
-
-Backend plan (minimal)
-1) Add suggestion endpoint that:
- - Gathers agent context (if agentIds provided).
- - Calls LLM with template.
- - Returns validated JSON.
-2) Ensure prompt redaction of secrets/tokens.
-3) Log prompt usage for auditing (excluding secrets).
-
-Safety and product constraints
-- Never apply changes without a user click.
-- Show a "This is a draft" warning.
-- Document that AI outputs are suggestions and may need adjustments.
-- Respect licensing (Pro feature) and return 402 if unlicensed.
-
-Testing
-- Unit: modal renders, validation errors, createProfile call.
-- Unit: suggestion endpoint response mapping.
-- Integration: suggestion -> create profile -> list refresh.
-- Regression: no auto-assignment when suggestion is created.
-
-Open questions
-- Which telemetry fields are safe/useful to include by default?
-- Should suggestions be limited to host agents only?
-- Do we need a schema-aware editor to reduce invalid configs?
-
----
-
-## Implementation Summary (Completed)
-
-### Backend Changes
-1. **New file**: `internal/api/profile_suggestions.go`
- - `ProfileSuggestionHandler` - handles AI-assisted profile suggestions
- - `SuggestionRequest` / `ProfileSuggestion` types for API contract
- - Prompt template includes available config keys and their types
- - Parses LLM JSON response and validates config
-
-2. **Modified file**: `internal/api/config_profiles.go`
- - Added `suggestionHandler` field to `ConfigProfileHandler`
- - Added `SetAIHandler()` method to inject AI capability
- - Added routing for `POST /suggestions` in `ServeHTTP()`
-
-3. **Modified file**: `internal/api/router.go`
- - Wired AI handler to profile handler: `r.configProfileHandler.SetAIHandler(r.aiHandler)`
-
-### Frontend Changes
-1. **Modified file**: `frontend-modern/src/api/agentProfiles.ts`
- - Added `ProfileSuggestionRequest` and `ProfileSuggestion` interfaces
- - Added `suggestProfile()` method to `AgentProfilesAPI`
-
-2. **New file**: `frontend-modern/src/components/Settings/SuggestProfileModal.tsx`
- - Modal with prompt input and example prompts
- - Loading state during AI call
- - Preview of suggested profile with name, description, config JSON, and rationale
- - "Draft" warning banner
- - "Use This Profile" button to accept suggestion
-
-3. **Modified file**: `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`
- - Added "Suggest Profile" button (purple, with Sparkles icon) next to "New Profile"
- - Added `showSuggestModal` state
- - Added `handleSuggest()` and `handleSuggestionAccepted()` handlers
- - When suggestion is accepted, pre-fills the create profile form
-
-### UX Flow
-1. User clicks "Suggest Profile" button
-2. Modal opens with prompt input and example prompts
-3. User describes what they need
-4. AI generates a profile suggestion
-5. User reviews name, description, config JSON, and rationale
-6. User clicks "Use This Profile"
-7. Modal closes, create profile form opens pre-filled with suggestion
-8. User can edit and then click "Create Profile"
diff --git a/internal/ai/mcp/tools.go b/internal/ai/mcp/tools.go
index 88afa08386..7ab08cb9f7 100644
--- a/internal/ai/mcp/tools.go
+++ b/internal/ai/mcp/tools.go
@@ -32,22 +32,6 @@ type AgentServer interface {
ExecuteCommand(ctx context.Context, agentID string, cmd agentexec.ExecuteCommandPayload) (*agentexec.CommandResultPayload, error)
}
-// AgentProfileManager manages centralized agent profiles and assignments.
-type AgentProfileManager interface {
- ApplyAgentScope(ctx context.Context, agentID, agentLabel string, settings map[string]interface{}) (profileID, profileName string, created bool, err error)
- AssignProfile(ctx context.Context, agentID, profileID string) (profileName string, err error)
- GetAgentScope(ctx context.Context, agentID string) (*AgentScope, error)
-}
-
-// AgentScope summarizes profile scope applied to an agent.
-type AgentScope struct {
- AgentID string
- ProfileID string
- ProfileName string
- ProfileVersion int
- Settings map[string]interface{}
-}
-
// MetadataUpdater updates resource metadata
type MetadataUpdater interface {
SetResourceURL(resourceType, resourceID, url string) error
@@ -320,6 +304,23 @@ func (e *PulseToolExecutor) SetContext(targetType, targetID string, autonomous b
// ListTools returns the list of available tools
func (e *PulseToolExecutor) ListTools() []Tool {
tools := []Tool{
+ {
+ Name: "get_agent_scope",
+ Description: "Get the current unified agent scope (profile assignment and settings).",
+ InputSchema: InputSchema{
+ Type: "object",
+ Properties: map[string]PropertySchema{
+ "agent_id": {
+ Type: "string",
+ Description: "Unified agent ID (preferred if known)",
+ },
+ "hostname": {
+ Type: "string",
+ Description: "Hostname or display name to resolve the agent ID",
+ },
+ },
+ },
+ },
{
Name: "pulse_get_agent_scope",
Description: "Get the current unified agent scope (profile assignment and settings).",
@@ -612,6 +613,50 @@ func (e *PulseToolExecutor) ListTools() []Tool {
Required: []string{"container", "action"},
},
},
+ {
+ Name: "apply_agent_scope",
+ Description: "Create or update a scope profile for an agent using settings, then assign it.",
+ InputSchema: InputSchema{
+ Type: "object",
+ Properties: map[string]PropertySchema{
+ "agent_id": {
+ Type: "string",
+ Description: "Unified agent ID (preferred if known)",
+ },
+ "hostname": {
+ Type: "string",
+ Description: "Hostname or display name to resolve the agent ID",
+ },
+ "settings": {
+ Type: "object",
+ Description: "Profile settings (e.g., enable_host, enable_docker, enable_kubernetes, enable_proxmox, proxmox_type, docker_runtime, disable_auto_update, disable_docker_update_checks, kube_include_all_pods, kube_include_all_deployments, log_level, interval, report_ip, disable_ceph)",
+ },
+ },
+ Required: []string{"settings"},
+ },
+ },
+ {
+ Name: "assign_agent_profile",
+ Description: "Assign an existing profile to a unified agent.",
+ InputSchema: InputSchema{
+ Type: "object",
+ Properties: map[string]PropertySchema{
+ "agent_id": {
+ Type: "string",
+ Description: "Unified agent ID (preferred if known)",
+ },
+ "hostname": {
+ Type: "string",
+ Description: "Hostname or display name to resolve the agent ID",
+ },
+ "profile_id": {
+ Type: "string",
+ Description: "Profile ID to assign to the agent",
+ },
+ },
+ Required: []string{"profile_id"},
+ },
+ },
{
Name: "pulse_set_agent_scope",
Description: "Update a unified agent's scope via safe profile settings. Use this instead of running raw commands to enable/disable modules like Docker, Kubernetes, or Proxmox.",
@@ -658,6 +703,8 @@ func (e *PulseToolExecutor) ExecuteTool(ctx context.Context, name string, args m
return e.executeFetchURL(ctx, args)
case "pulse_get_infrastructure_state":
return e.executeGetInfrastructureState(ctx)
+ case "get_agent_scope":
+ return e.executeGetAgentScope(ctx, args)
case "pulse_get_agent_scope":
return e.executeGetAgentScope(ctx, args)
case "pulse_set_resource_url":
@@ -688,6 +735,10 @@ func (e *PulseToolExecutor) ExecuteTool(ctx context.Context, name string, args m
return e.executeControlGuest(ctx, args)
case "pulse_control_docker":
return e.executeControlDocker(ctx, args)
+ case "apply_agent_scope":
+ return e.executeApplyAgentScope(ctx, args)
+ case "assign_agent_profile":
+ return e.executeAssignAgentProfile(ctx, args)
case "pulse_set_agent_scope":
return e.executeSetAgentScope(ctx, args)
default:
@@ -766,6 +817,31 @@ func (e *PulseToolExecutor) executeRunCommand(ctx context.Context, args map[stri
return NewTextResult(output), nil
}
+func (e *PulseToolExecutor) executeApplyAgentScope(ctx context.Context, args map[string]interface{}) (CallToolResult, error) {
+ if profileID, _ := args["profile_id"].(string); strings.TrimSpace(profileID) != "" {
+ return NewErrorResult(fmt.Errorf("profile_id is not supported for apply_agent_scope")), nil
+ }
+
+ return e.executeSetAgentScope(ctx, args)
+}
+
+func (e *PulseToolExecutor) executeAssignAgentProfile(ctx context.Context, args map[string]interface{}) (CallToolResult, error) {
+ profileID, _ := args["profile_id"].(string)
+ if strings.TrimSpace(profileID) == "" {
+ return NewErrorResult(fmt.Errorf("profile_id is required")), nil
+ }
+
+ if rawSettings, ok := args["settings"].(map[string]interface{}); ok {
+ for _, value := range rawSettings {
+ if value != nil {
+ return NewErrorResult(fmt.Errorf("settings are not supported for assign_agent_profile")), nil
+ }
+ }
+ }
+
+ return e.executeSetAgentScope(ctx, args)
+}
+
func (e *PulseToolExecutor) executeSetAgentScope(ctx context.Context, args map[string]interface{}) (CallToolResult, error) {
if e.agentProfileManager == nil {
return NewTextResult("Agent scope management is not available."), nil