Select the types of activity you want to include in your feed.
update logs, add mirror sync via api, try and fix agent mirror syncing to only happen on startup, and every 5min instead of every 30 seconds. add checks for available and lastseen to determine how to reconcile agent nodes
···67676868 // PIN operations
6969 hsmGroup.POST("/change-pin", s.proxyClient.ChangePIN)
7070+7171+ // Mirror operations
7272+ hsmGroup.POST("/mirror/sync", s.handleMirrorSync)
7073 }
71747275 // Health and info endpoints can stay local
+55
internal/api/server.go
···150150 s.sendResponse(c, http.StatusOK, "Health check completed", health)
151151}
152152153153+// MirrorTriggerInterface defines the interface for triggering mirror syncs
154154+type MirrorTriggerInterface interface {
155155+ TriggerMirror(reason, source string, force bool)
156156+}
157157+158158+// Global mirror trigger for API access
159159+var globalMirrorTrigger MirrorTriggerInterface
160160+161161+// SetMirrorTrigger sets the global mirror trigger for API access
162162+func SetMirrorTrigger(trigger MirrorTriggerInterface) {
163163+ globalMirrorTrigger = trigger
164164+}
165165+166166+// handleMirrorSync triggers a manual mirror synchronization
167167+func (s *Server) handleMirrorSync(c *gin.Context) {
168168+ // Parse request body for force flag
169169+ var req struct {
170170+ Force bool `json:"force,omitempty"`
171171+ }
172172+ if err := c.ShouldBindJSON(&req); err != nil && err.Error() != "EOF" {
173173+ s.sendError(c, http.StatusBadRequest, "invalid_request", "Invalid request body", map[string]any{
174174+ "error": err.Error(),
175175+ })
176176+ return
177177+ }
178178+179179+ // Get the global mirror trigger
180180+ if globalMirrorTrigger == nil {
181181+ s.sendError(c, http.StatusServiceUnavailable, "mirror_unavailable", "Mirror service not available", nil)
182182+ return
183183+ }
184184+185185+ // Trigger the mirror sync
186186+ reason := "manual_api"
187187+ source := "api_endpoint"
188188+ if req.Force {
189189+ reason = "manual_api_force"
190190+ }
191191+192192+ globalMirrorTrigger.TriggerMirror(reason, source, req.Force)
193193+194194+ s.logger.Info("Manual mirror sync triggered via API",
195195+ "force", req.Force,
196196+ "source", c.ClientIP())
197197+198198+ response := map[string]any{
199199+ "triggered": true,
200200+ "reason": reason,
201201+ "force": req.Force,
202202+ "message": "Mirror synchronization triggered successfully",
203203+ }
204204+205205+ s.sendResponse(c, http.StatusOK, "Mirror sync triggered", response)
206206+}
207207+153208// All HSM operations are now proxied to agents - no direct handlers needed
154209155210// sendResponse sends a successful API response