Commit graph

2470 commits

Author SHA1 Message Date
rcourtman
252db2b720 ci: use git pull --rebase in helm-pages.yml to avoid push conflicts 2026-01-20 20:07:51 +00:00
rcourtman
9571f3ed0a ci: add PULSE_DATA_DIR to build-and-test.yml for Go unit tests 2026-01-20 20:06:42 +00:00
rcourtman
2798f89cf6 ci: increase helm smoke test timeout and add debug info 2026-01-20 19:53:22 +00:00
rcourtman
16afc93473 ci: improve demo server update robustness with pipefail and version check 2026-01-20 19:34:35 +00:00
rcourtman
b1f2f28a8d Auto-update Helm chart version to 5.0.17 2026-01-20 19:34:24 +00:00
rcourtman
68da7b5c11 Auto-update Helm chart documentation 2026-01-20 19:34:23 +00:00
rcourtman
7ce1355bba fix(test): disable email in TestSendResolvedAlert to avoid retry delays 2026-01-20 18:29:29 +00:00
rcourtman
9b8a79df93 fix(test): add graceful shutdown wait to TestRunServer_WebSocket 2026-01-20 18:20:37 +00:00
rcourtman
eec4bcf33e fix(test): update API test expectations for status codes and response format 2026-01-20 18:12:58 +00:00
rcourtman
8eb42f6b31 ci: set PULSE_DATA_DIR in test step to prevent /etc/pulse fallback 2026-01-20 18:00:07 +00:00
rcourtman
a383f06848 fix(test): add stateFileDir to TestRun_Legacy test setup 2026-01-20 17:43:58 +00:00
rcourtman
040685ba58 fix(lint): resolve eslint errors in AI chat components 2026-01-20 17:33:40 +00:00
rcourtman
e5eb4517db fix: remove duplicate else in trigger-release.sh 2026-01-20 17:26:26 +00:00
rcourtman
f993b14e73 Prepare v5.0.17 release 2026-01-20 17:24:39 +00:00
rcourtman
36622d2c17 Hide unavailable AI tools 2026-01-20 17:19:47 +00:00
rcourtman
ecc31730f6 Remove OpenCode references 2026-01-20 16:56:41 +00:00
rcourtman
3b836387e9 fix(alerts): Preserve backup/snapshot fields when saving threshold edits. Related to #1126
The saveEdit function was not preserving backup and snapshot fields from
existing overrides when saving threshold changes. This caused custom
backup age thresholds to reset to 0 after any edit.

Changes:
- Added existingOverrideCheck lookup before creating new override
- Include backup/snapshot in hasStateOnlyOverride check to prevent
  accidental removal of backup-only overrides
- Preserve both fields when creating/updating overrides
2026-01-20 16:40:01 +00:00
rcourtman
b57b4a7c3c Tighten AI chat routing and context display 2026-01-20 16:30:55 +00:00
rcourtman
0248f0de5a fix(alerts): Prevent RAID check/scrub from triggering rebuild alerts. Related to #1125
DSM data scrubbing causes RAID arrays to enter a 'check' state with
RebuildPercent > 0, which was incorrectly triggering rebuild warnings.

Now distinguishes between:
- 'check' state: scheduled data scrubbing (no alert)
- 'recover'/'resync' state: actual rebuild (warning alert)
- 'clean' state with RebuildPercent: scrub in progress (no alert)
2026-01-20 16:13:58 +00:00
rcourtman
a541aeed2b fix(frontend): allow storage usage progress bar to fill column width 2026-01-20 16:10:52 +00:00
rcourtman
a444de453a fix(ui): Fix Proxmox settings tab selection not updating visually. Related to #1127
SolidJS requires reactive comparisons inside For loops to use getter
functions. Changed isActive from a static value to a getter function
in both SettingsSectionNav.tsx and Settings.tsx mobile tabs.
2026-01-20 16:08:26 +00:00
rcourtman
a6413b7346 refactor(frontend): streamline AI integration & fix table layouts
- AI Cleanup: Remove legacy AI Chat components and context indicators
- Table Layouts: Implement fixed table layout for Dashboard and Docker tables
- Styles: Fix column shifting and add explicit width support
2026-01-20 15:55:45 +00:00
rcourtman
96b7370f7b test: improve coverage for API, AI, Alerts, and Frontend Utils
- Add comprehensive tests for internal/api/config_handlers.go (Phases 1-3)
- Improve test coverage for AI tools, chat service, and session management
- Enhance alert and notification tests (ResolvedAlert, Webhook)
- Add frontend unit tests for utils (searchHistory, tagColors, temperature, url)
- Add proximity client API tests
2026-01-20 15:52:39 +00:00
rcourtman
2c561cbea7 fix(ui): improve NodeSummaryTable column width balance
- Constrain count columns (Temp, VMs, CTs, Storage, Disks, Backups) to fixed widths
- Make CPU/Memory/Disk columns flexible with min-width 140px and max-width 180px
- Fix Uptime column to 80px to give more space to Node column
- Use table-layout: fixed for consistent column sizing

This prevents the count columns from expanding unnecessarily and
gives more space to the Node name and metric progress bars.
2026-01-20 15:43:00 +00:00
rcourtman
9b07568195 Improve hosts disk display and column sizing 2026-01-20 10:15:58 +00:00
rcourtman
ee63d438cc docs: standardize markdown syntax and remove deprecated sensor-proxy docs 2026-01-20 09:43:49 +00:00
rcourtman
39d647c947 fix: show node summary table in kiosk mode
The UnifiedNodeSelector is the main dashboard content that users want
to display on wall-mounted screens. Only the filter/search UI should
be hidden in kiosk mode, not the actual data tables.
2026-01-19 23:19:24 +00:00
rcourtman
f70884b6b9 fix: kiosk mode now hides all navigation and filter UI
- Hide header branding (logo/title) in kiosk mode
- Hide navigation tabs in kiosk mode
- Hide footer in kiosk mode
- Make Dashboard/Docker/Hosts filter panels reactive to kiosk toggle
- Hide UnifiedNodeSelector in kiosk mode on Dashboard

The kiosk toggle button now properly hides all chrome for clean
dashboard display on wall-mounted screens. Related to #917
2026-01-19 23:17:46 +00:00
rcourtman
72e119a87b feat: add kiosk mode toggle button to header
Closes #1122

Adds a kiosk mode toggle button in the header next to the logout button.
Previously, users had to manually add ?kiosk=1 to the URL to enable
kiosk mode (which hides navigation and filters for wall displays).

Now users can:
- Click the toggle button to enter/exit kiosk mode instantly
- Button shows maximize icon when off, minimize icon when on
- Hover reveals 'Kiosk' or 'Exit' label
- Blue highlight when active for clear visual feedback
- State persists in sessionStorage like the URL param method

Implementation:
- Added setKioskMode() and subscribeToKioskMode() to url.ts for
  programmatic control and reactive state tracking
- Added toggle button in AppLayout header with lucide icons
- Uses same sessionStorage key as URL param approach for compatibility
2026-01-19 22:31:24 +00:00
rcourtman
1c22688d9b fix: standardize API version format and guest key separators
Closes #1115 (discussion feedback)

Two API consistency issues reported by @FabienD74:

1. Version format mismatch in /api/version:
   - currentVersion: "5.0.16" (no prefix)
   - latestVersion: "v5.0.16" (with prefix)

   Fixed: LatestVersion now strips the "v" prefix to match CurrentVersion format.

2. Guest ID separator inconsistency:
   - Some code used colons: "instance:node:vmid"
   - BuildGuestKey used dashes: "instance-node-vmid"

   Fixed: BuildGuestKey now uses colon separator matching the canonical
   format used by makeGuestID in the monitoring package. The existing
   legacy migration in GetWithLegacyMigration handles old dash-format
   entries in guest_metadata.json.
2026-01-19 22:20:18 +00:00
rcourtman
6e22dad57f chore: Add Air hot-reload configuration
Adds .air.toml for air-verse/air hot-reload during development:
- Watches Go files in cmd/, internal/, pkg/
- Excludes tests, vendor, node_modules, frontend
- Automatically rebuilds on file changes
- Supports Pro build detection via HOT_DEV_USE_PRO env var
- Kill delay and graceful shutdown configured
2026-01-19 19:26:50 +00:00
rcourtman
a6a8efaa65 test: Add comprehensive test coverage across packages
New test files with expanded coverage:

API tests:
- ai_handler_test.go: AI handler unit tests with mocking
- agent_profiles_tools_test.go: Profile management tests
- alerts_endpoints_test.go: Alert API endpoint tests
- alerts_test.go: Updated for interface changes
- audit_handlers_test.go: Audit handler tests
- frontend_embed_test.go: Frontend embedding tests
- metadata_handlers_test.go, metadata_provider_test.go: Metadata tests
- notifications_test.go: Updated for interface changes
- profile_suggestions_test.go: Profile suggestion tests
- saml_service_test.go: SAML authentication tests
- sensor_proxy_gate_test.go: Sensor proxy tests
- updates_test.go: Updated for interface changes

Agent tests:
- dockeragent/signature_test.go: Docker agent signature tests
- hostagent/agent_metrics_test.go: Host agent metrics tests
- hostagent/commands_test.go: Command execution tests
- hostagent/network_helpers_test.go: Network helper tests
- hostagent/proxmox_setup_test.go: Updated setup tests
- kubernetesagent/*_test.go: Kubernetes agent tests

Core package tests:
- monitoring/kubernetes_agents_test.go, reload_test.go
- remoteconfig/client_test.go, signature_test.go
- sensors/collector_test.go
- updates/adapter_installsh_*_test.go: Install adapter tests
- updates/manager_*_test.go: Update manager tests
- websocket/hub_*_test.go: WebSocket hub tests

Library tests:
- pkg/audit/export_test.go: Audit export tests
- pkg/metrics/store_test.go: Metrics store tests
- pkg/proxmox/*_test.go: Proxmox client tests
- pkg/reporting/reporting_test.go: Reporting tests
- pkg/server/*_test.go: Server tests
- pkg/tlsutil/extra_test.go: TLS utility tests

Total: ~8000 lines of new test code
2026-01-19 19:26:18 +00:00
rcourtman
d06ed2edb3 refactor: Add testability improvements to core packages
hostagent/commands.go:
- Extract execCommandContext as mockable variable

hostagent/proxmox_setup.go:
- Convert stateFilePath constants to variables (testable)
- Extract runCommand and lookPath as mockable functions
- Add duplicate comment (minor cleanup needed)

notifications/notifications.go:
- Add GetQueueStats() method for interface compliance
- Used by NotificationMonitor interface

updates/manager.go:
- Add AddSSEClient, RemoveSSEClient, GetSSECachedStatus methods
- Enables interface-based SSE client management

pkg/audit/export.go:
- Minor testability improvements

go.mod/go.sum:
- Add stretchr/objx v0.5.2 (test mocking dependency)
2026-01-19 19:25:38 +00:00
rcourtman
dc16c94766 fix: Add robustness improvements to approval, auth, and server
approval/store.go:
- Make Approve() idempotent - return success if already approved
- Handles double-clicks and race conditions gracefully

auth.go:
- Add dev mode admin bypass (disabled by default)
- When ALLOW_ADMIN_BYPASS=1, sets X-Authenticated-User header

server.go:
- Call router.StopOpenCodeAI() during shutdown
- Ensures AI service stops cleanly on server termination
2026-01-19 19:24:45 +00:00
rcourtman
fe3857f6ec chore(scripts): Remove OpenCode sidecar references from dev scripts
dev-check.sh:
- Remove OpenCode process detection and kill commands
- Remove MCP connection status checks
- OpenCode sidecar no longer used

hot-dev.sh:
- Remove pulse-sensor-proxy socket detection (deprecated)
- Remove OpenCode sidecar cleanup commands
- Remove PULSE_USE_OPENCODE environment variable
- Add self-restart check for script changes
- Simplify startup by removing sidecar dependencies

The native chat service (internal/ai/chat) handles AI directly
without needing an external OpenCode subprocess.
2026-01-19 19:22:25 +00:00
rcourtman
f478046696 refactor(api): Add interfaces to handlers for testability
Extract interfaces from concrete monitor type dependencies:

alerts.go:
- Add AlertManager, ConfigPersistence, AlertMonitor interfaces
- Change AlertHandlers to accept AlertMonitor interface

notifications.go:
- Add NotificationManager, NotificationConfigPersistence interfaces
- Add NotificationMonitor interface
- Change NotificationHandlers to accept NotificationMonitor interface

updates.go:
- Add UpdatesMonitor interface
- Change UpdatesHandlers to accept interface

audit_handlers.go:
- Update to use interface-based injection

profile_suggestions.go:
- Minor interface alignment

Benefits:
- Handlers can now be tested with mock implementations
- Decouples handlers from concrete monitoring.Monitor type
- Works with monitor_wrappers.go added in previous commit
2026-01-19 19:21:46 +00:00
rcourtman
5dc0177ec2 refactor(ai): Rename findings adapter and add chat patrol alias
- Rename findings_mcp_adapter.go -> findings_tools_adapter.go
- Update imports from mcp to tools package
- Add findings_tools_adapter_test.go with basic tests
- Add SetChatPatrol method as alias for SetOpenCodePatrol
  (maintains API compatibility during transition)
2026-01-19 19:20:49 +00:00
rcourtman
ffb8928dbf refactor(api): Update handlers for native AI chat service
Adapts API handlers to use the new native chat service:

ai_handler.go:
- Replace opencode.Service with chat.Service
- Add AIService interface for testability
- Add factory function for service creation (mockable)
- Update provider wiring to use tools package types

ai_handlers.go:
- Add Notable field to model list response
- Simplify command approval - execution handled by agentic loop
- Remove inline command execution from approval endpoint

router.go:
- Update imports: mcp -> tools, opencode -> chat
- Add monitor wrapper types for cleaner dependency injection
- Update patrol wiring for new chat service

agent_profiles:
- Rename agent_profiles_mcp.go -> agent_profiles_tools.go
- Update imports for tools package

monitor_wrappers.go:
- New file with wrapper types for alert/notification monitors
- Enables interface-based dependency injection
2026-01-19 19:20:00 +00:00
rcourtman
3cdc5ec6c5 feat(frontend): Update AI chat for native streaming architecture
Adapts frontend to work with the new native chat service:

Model selector improvements:
- Extract ModelSelector to reusable component
- Add notable model filtering (shows recent models by default)
- Add "Show older models" toggle for legacy model access
- Add notable badge indicator for recommended models

Chat flow changes:
- Simplify approval handling - backend agentic loop executes commands
- Tool results now come via stream events, not approval response
- Session model selection preserved when switching sessions

Type updates:
- Add 'notable' field to ModelInfo interface
- Add 'notable' to API response types
2026-01-19 19:19:13 +00:00
rcourtman
0f5807d0f9 refactor(ai): Remove deprecated opencode sidecar package
The opencode package implemented the old architecture where:
- Pulse ran an OpenCode subprocess as a sidecar
- AI messages were proxied through OpenCode
- OpenCode connected back to Pulse's MCP server for tool access

This is now replaced by the native chat service (internal/ai/chat)
which calls AI providers directly and executes tools inline.

Removed files:
- sidecar.go: OpenCode process management
- service.go: Message proxying and session management
- client.go: HTTP client for OpenCode API
- bridge.go: MCP tool bridging
- patrol.go: Patrol context extraction
- *_test.go: Associated tests

Benefits of new architecture:
- No external subprocess dependency
- Direct streaming from AI providers
- Lower latency (no proxy hop)
- Simpler deployment
2026-01-19 19:18:14 +00:00
rcourtman
17ca31a557 refactor(ai): Replace mcp package with tools package for direct tool execution
This refactoring removes the MCP (Model Context Protocol) server layer and
converts AI tools to be called directly by the chat service.

Key changes:
- Rename package from internal/ai/mcp to internal/ai/tools
- Remove server.go - tools no longer exposed via MCP server
- Tools are now called directly by the chat service via ExecuteTool()

New tools added:
- Kubernetes: clusters, nodes, pods, deployments (4 tools)
- PMG: mail gateway status, mail stats, queues, spam stats (4 tools)
- Infrastructure: snapshots, PBS jobs, backup tasks, network stats,
  disk I/O, cluster status, swarm, services, tasks, recent tasks,
  physical disks, RAID status, host Ceph, resource disks (14 tools)
- Patrol: connection health, resolved alerts (2 tools)

Test coverage:
- Added comprehensive test files for adapters, infrastructure,
  patrol, profiles, and query tools

Total tools: 50 (was ~25)
2026-01-19 19:17:24 +00:00
rcourtman
5ff4f97a0d feat(ai): Add native chat service with streaming and tool execution
Replace the OpenCode sidecar with a native chat service that handles:
- Real-time streaming responses from AI providers
- Multi-turn conversation sessions with history
- Tool execution with automatic function calling
- Agentic workflows for autonomous task completion
- Patrol integration for automated health analysis

The chat service directly communicates with AI providers using the
new StreamingProvider interface, eliminating the need for an external
sidecar process. Sessions are managed in-memory with configurable
history limits.

Key components:
- service.go: Main chat service with provider integration
- session.go: Session management and message history
- agentic.go: Agentic loop for autonomous tool execution
- patrol.go: Patrol-specific chat context and analysis
- tools.go: Tool execution bridge to tools package
- types.go: Chat message and event type definitions
2026-01-19 19:12:04 +00:00
rcourtman
4fe3d7df77 feat(ai): Add streaming support and notable models to AI providers
- Add ChatStream method to all providers (Anthropic, OpenAI, Gemini, Ollama)
  for real-time streaming of AI responses with tool call support
- Add StreamingProvider interface with StreamEvent types for content,
  thinking, tool_start, tool_end, done, and error events
- Add notable models feature that fetches model metadata from models.dev
  to identify recent/recommended models (within last 3 months)
- Add Notable field to ModelInfo struct to flag "latest and greatest" models
- Add SupportsThinking method to check for extended reasoning capability

The streaming support enables real-time AI chat responses instead of
waiting for complete responses. The notable models feature helps users
identify which models are current and recommended.
2026-01-19 19:10:58 +00:00
rcourtman
17dec929a0 feat: Add mention support for webhook alerts. Related to #1118
Adds a Mention field to webhook configurations that allows users to tag
individuals or groups when alerts are sent. This works with:

- Discord: @everyone, <@USER_ID>, <@&ROLE_ID>
- Microsoft Teams: @General, user email
- Mattermost: @channel, @all, @username

The mention is included in the webhook payload via the {{.Mention}} template
variable. Built-in templates for Discord, Slack, and Teams now conditionally
include mentions when configured.

Backend changes:
- Add Mention field to WebhookConfig struct
- Add Mention field to WebhookPayloadData for template access
- Pass mention through sendGroupedWebhook

Frontend changes:
- Add mention field to Webhook interface
- Add Mention input to webhook configuration form
- Show service-specific help text for mention formats
2026-01-18 15:16:37 +00:00
rcourtman
71bcc570ad fix: Add nil checks in findDuplicate() to prevent crash. Related to #1119
When a resource exists in the hostname or IP index but has been removed from
the main resources map, looking up and accessing .Type would cause a nil
pointer dereference panic.

The MachineID lookup already had this check, but hostname and IP lookups
were missing it. This adds consistent nil checking across all three lookup
paths.
2026-01-18 13:41:00 +00:00
rcourtman
7d2e002caa fix: add sudo to mv command in deploy 2026-01-18 09:46:50 +00:00
rcourtman
a40be03963 fix: use sudo for systemctl commands in deploy 2026-01-18 09:43:47 +00:00
rcourtman
3114775aa9 fix: clean up stale files before deploy 2026-01-18 09:40:42 +00:00
rcourtman
bfe621eeb9 fix: use FRONTEND_PORT env var for health check port 2026-01-18 09:37:45 +00:00
rcourtman
4fbc08daba fix: use SSH key secret for demo server deployment 2026-01-18 09:32:19 +00:00