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
This commit is contained in:
rcourtman
2025-12-25 07:55:22 +00:00
parent 2b58722906
commit 598285d3d2
5 changed files with 5 additions and 0 deletions
+1
View File
@@ -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;
+1
View File
@@ -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,
+1
View File
@@ -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"`
+1
View File
@@ -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),
}
+1
View File
@@ -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.