From 598285d3d2379b4088451541bd9dff46ce62ec95 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 25 Dec 2025 07:55:22 +0000 Subject: [PATCH] feat: Agent reports CommandsEnabled status to server. Related to #903 - Add CommandsEnabled field to AgentInfo in pkg/agents/host/report.go - Agent now reports whether AI command execution is enabled - Server stores and exposes this via Host model - Frontend can now show which agents have commands enabled - This provides visibility before implementing remote configuration --- frontend-modern/src/types/api.ts | 1 + internal/hostagent/agent.go | 1 + internal/models/models.go | 1 + internal/monitoring/monitor.go | 1 + pkg/agents/host/report.go | 1 + 5 files changed, 5 insertions(+) diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts index ef4209a9a..ebd909a65 100644 --- a/frontend-modern/src/types/api.ts +++ b/frontend-modern/src/types/api.ts @@ -437,6 +437,7 @@ export interface Host { lastSeen: number; intervalSeconds?: number; agentVersion?: string; + commandsEnabled?: boolean; // Whether AI command execution is enabled on this agent tokenId?: string; tokenName?: string; tokenHint?: string; diff --git a/internal/hostagent/agent.go b/internal/hostagent/agent.go index afe0c2b8b..1a2373fab 100644 --- a/internal/hostagent/agent.go +++ b/internal/hostagent/agent.go @@ -360,6 +360,7 @@ func (a *Agent) buildReport(ctx context.Context) (agentshost.Report, error) { IntervalSeconds: int(a.interval / time.Second), Hostname: a.hostname, UpdatedFrom: a.updatedFrom, + CommandsEnabled: a.cfg.EnableCommands, }, Host: agentshost.HostInfo{ ID: a.machineID, diff --git a/internal/models/models.go b/internal/models/models.go index c076d6140..3e4211bb5 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -181,6 +181,7 @@ type Host struct { IntervalSeconds int `json:"intervalSeconds,omitempty"` LastSeen time.Time `json:"lastSeen"` AgentVersion string `json:"agentVersion,omitempty"` + CommandsEnabled bool `json:"commandsEnabled,omitempty"` // Whether AI command execution is enabled TokenID string `json:"tokenId,omitempty"` TokenName string `json:"tokenName,omitempty"` TokenHint string `json:"tokenHint,omitempty"` diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index f55529020..de403f8d5 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -2178,6 +2178,7 @@ func (m *Monitor) ApplyHostReport(report agentshost.Report, tokenRecord *config. IntervalSeconds: report.Agent.IntervalSeconds, LastSeen: timestamp, AgentVersion: strings.TrimSpace(report.Agent.Version), + CommandsEnabled: report.Agent.CommandsEnabled, Tags: append([]string(nil), report.Tags...), IsLegacy: isLegacyHostAgent(report.Agent.Type), } diff --git a/pkg/agents/host/report.go b/pkg/agents/host/report.go index 26e6fee61..d6111f449 100644 --- a/pkg/agents/host/report.go +++ b/pkg/agents/host/report.go @@ -26,6 +26,7 @@ type AgentInfo struct { IntervalSeconds int `json:"intervalSeconds,omitempty"` Hostname string `json:"hostname,omitempty"` UpdatedFrom string `json:"updatedFrom,omitempty"` // Previous version if recently auto-updated + CommandsEnabled bool `json:"commandsEnabled,omitempty"` // Whether AI command execution is enabled } // HostInfo contains platform and identification details about the monitored host.