Pulse/internal/api
rcourtman c457358c63 fix(api): flush SSE headers immediately on patrol stream connect
Send an SSE comment immediately when a client connects to the patrol
stream endpoint. This flushes HTTP headers so clients receive the
200 response right away, rather than blocking until the first event.

This fixes eval tests where the stream connection would time out
waiting for headers while patrol was still initializing.
2026-01-29 08:20:25 +00:00
..
agent_profiles_tools.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
agent_profiles_tools_extra_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
agent_profiles_tools_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
ai_handler.go Update API handlers for AI and discovery endpoints 2026-01-28 16:51:35 +00:00
ai_handler_restart_test.go test: add stream, restart, and fallback tests for AI handlers and providers 2026-01-22 22:33:33 +00:00
ai_handler_test.go Update API handlers for AI and discovery endpoints 2026-01-28 16:51:35 +00:00
ai_handlers.go fix(api): flush SSE headers immediately on patrol stream connect 2026-01-29 08:20:25 +00:00
ai_handlers_cost_export_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_helpers_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_intelligence_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_investigation_additional_test.go refactor(ai): remove obsolete tool and chat files 2026-01-28 21:30:24 +00:00
ai_handlers_oauth_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_patrol_actions_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_patrol_test.go feat: add AI Intelligence system with investigation and forecasting 2026-01-24 22:41:43 +00:00
ai_handlers_setters_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_stream_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_handlers_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
ai_intelligence_handlers.go feat: add AI Intelligence system with investigation and forecasting 2026-01-24 22:41:43 +00:00
ai_intelligence_handlers_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_intelligence_handlers_data_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_intelligence_handlers_remediation_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_intelligence_handlers_test.go feat: add AI Intelligence system with investigation and forecasting 2026-01-24 22:41:43 +00:00
ai_intelligence_helpers_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
ai_patrol_handlers_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
alerts.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
alerts_endpoints_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
alerts_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
api_foundation_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
audit_handlers.go security: SSRF protection for webhook URLs 2026-01-22 00:42:23 +00:00
audit_handlers_test.go security: SSRF protection for webhook URLs 2026-01-22 00:42:23 +00:00
auth.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
auth_general_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
auth_helpers_test.go feat(license): add audit_logging, advanced_sso, advanced_reporting to Pro tier 2026-01-10 12:55:02 +00:00
auth_oidc_refresh_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
auth_scope_test.go feat(rbac): add OIDC group mapping tests and audit logging for RBAC actions 2026-01-09 19:25:33 +00:00
authorization.go feat: add multi-tenant isolation foundation (disabled by default) 2026-01-23 21:42:27 +00:00
authorization_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
authorization_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
bootstrap_token.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
bootstrap_token_test.go test: Add edge case for initializeBootstrapToken error path 2025-12-02 00:51:44 +00:00
charts_test.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
chat_service_adapter.go fix(api): flush SSE headers immediately on patrol stream connect 2026-01-29 08:20:25 +00:00
config_handlers.go fix: Support partial updates for PBS nodes. Related to #1105 2026-01-23 00:13:28 +00:00
config_handlers_add_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_admin_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_auto_reg_test.go test: Add edge cases for markAutoRegistered empty inputs 2025-12-01 23:50:10 +00:00
config_handlers_auto_register_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_cluster_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
config_handlers_cluster_test.go test: Improve coverage for cluster config handler functions 2025-12-01 14:46:00 +00:00
config_handlers_connection_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_delete_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_discovery_test.go test: improve coverage for API, AI, Alerts, and Frontend Utils 2026-01-20 15:52:39 +00:00
config_handlers_helpers_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
config_handlers_host_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
config_handlers_pve_user_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_sanitize_test.go test: Add tests for config handler utility functions 2025-12-01 14:09:35 +00:00
config_handlers_secure_auto_register_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
config_handlers_setup_code_test.go test: improve coverage for API, AI, Alerts, and Frontend Utils 2026-01-20 15:52:39 +00:00
config_handlers_setup_script_test.go refactor(api): remove sensor proxy config from API handlers 2026-01-21 12:02:46 +00:00
config_handlers_setup_url_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_temperature_ssh_test.go test: improve coverage for API, AI, Alerts, and Frontend Utils 2026-01-20 15:52:39 +00:00
config_handlers_transport_guard_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_handlers_update_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
config_profiles.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
config_profiles_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
config_profiles_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
csrf_store.go Show AI cost refresh errors and harden log redaction 2025-12-12 11:05:24 +00:00
csrf_store_test.go fix: Update runtime config when toggling Docker update actions setting 2026-01-03 11:14:17 +00:00
demo_middleware.go fix(demo): allow AI chat in read-only mode 2025-12-23 18:52:13 +00:00
demo_middleware_test.go test: Add edge case for DemoModeMiddleware WebSocket POST upgrade 2025-12-01 23:24:06 +00:00
diagnostics.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
diagnostics_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
diagnostics_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
discovery_handlers.go Update API handlers for AI and discovery endpoints 2026-01-28 16:51:35 +00:00
DO_NOT_EDIT_FRONTEND_HERE.md chore: Mac-compatible dev scripts 2026-01-22 00:30:15 +00:00
docker_agents.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
docker_agents_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
docker_agents_test.go ADA: Add normalizeCommandStatus helper with unit tests 2025-11-29 17:06:18 +00:00
docker_metadata.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
docker_metadata_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
export_test.go fix: Update TestPublicURLDetectionUsesForwardedHeaders for proxy hardening 2025-12-02 03:16:52 +00:00
frontend_embed.go Improve static asset caching for hashed files 2025-11-06 13:54:26 +00:00
frontend_embed_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
guest_metadata.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
guest_metadata_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
host_agents.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
host_agents_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
host_agents_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
host_metadata.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
http_metrics.go feat: comprehensive diagnostics and observability improvements 2025-10-21 12:37:39 +00:00
http_metrics_test.go Add unit tests for HTTP metrics utility functions 2025-11-30 02:48:05 +00:00
isolation_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
kubernetes_agents.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
kubernetes_agents_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
license_handlers.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
license_handlers_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
log_redact.go Show AI cost refresh errors and harden log redaction 2025-12-12 11:05:24 +00:00
metadata_handlers_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
metadata_provider.go feat(ai): Add URL discovery tool - AI can find and set resource URLs 2025-12-10 00:29:07 +00:00
metadata_provider_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
metrics_history_fallback_test.go test: add stream, restart, and fallback tests for AI handlers and providers 2026-01-22 22:33:33 +00:00
middleware.go style: fix whitespace in middleware.go 2025-11-27 08:34:31 +00:00
middleware_license.go feat: add multi-tenant isolation foundation (disabled by default) 2026-01-23 21:42:27 +00:00
middleware_tenant.go feat: add multi-tenant isolation foundation (disabled by default) 2026-01-23 21:42:27 +00:00
middleware_tenant_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
middleware_test.go test: Add edge case for writeErrorResponse encode failure 2025-12-01 23:52:21 +00:00
monitor_wrappers.go refactor(api): Update handlers for native AI chat service 2026-01-19 19:20:00 +00:00
multi_tenant_setters_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
notification_queue.go security: Add request body size limits to remaining API handlers 2025-12-02 16:47:13 +00:00
notification_queue_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
notifications.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
notifications_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
oidc_handlers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
oidc_handlers_additional_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
oidc_handlers_test.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
oidc_mapping_test.go feat(rbac): add OIDC group mapping tests and audit logging for RBAC actions 2026-01-09 19:25:33 +00:00
oidc_service.go feat(oidc): Add refresh token support for long-lived sessions 2025-12-20 10:45:46 +00:00
oidc_service_test.go test: Add invalid PEM data test for newOIDCHTTPClient 2025-12-02 01:00:06 +00:00
profile_suggestions.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
profile_suggestions_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
rate_limit_config.go refactor(api): remove sensor proxy config from API handlers 2026-01-21 12:02:46 +00:00
rate_limit_config_test.go refactor(api): remove sensor proxy config from API handlers 2026-01-21 12:02:46 +00:00
ratelimit.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
ratelimit_test.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
rbac_handlers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
rbac_handlers_test.go feat(rbac): implement RBAC UI, OIDC group mapping, and API standard auth 2026-01-09 19:16:34 +00:00
rbac_test.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
README.md chore: Mac-compatible dev scripts 2026-01-22 00:30:15 +00:00
recovery_tokens.go Show AI cost refresh errors and harden log redaction 2025-12-12 11:05:24 +00:00
recovery_tokens_test.go fix: Update runtime config when toggling Docker update actions setting 2026-01-03 11:14:17 +00:00
reporting_handlers.go feat(license): add audit_logging, advanced_sso, advanced_reporting to Pro tier 2026-01-10 12:55:02 +00:00
resource_handlers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
resource_handlers_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
router.go refactor(ai): update patrol and service to use chat service adapter 2026-01-28 21:24:34 +00:00
router_arch_test.go test: Add tests for API helper functions 2025-12-01 21:33:45 +00:00
router_download_test.go Fix #735: Allow HEAD requests for download endpoints and fix routing 2025-11-24 15:16:14 +00:00
router_general_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
router_helpers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
router_integration_test.go test: expand backend coverage 2026-01-25 21:08:44 +00:00
router_state_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
router_test.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
saml_handlers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
saml_service.go feat(sso): add SAML 2.0 and multi-provider SSO support 2026-01-12 15:19:59 +00:00
saml_service_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
security.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
security_oidc.go fix: mark unused parameters to satisfy unparam linter 2025-11-27 10:12:48 +00:00
security_oidc_response_test.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
security_setup_fix.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
security_setup_fix_test.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
security_test.go feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
security_tokens.go feat(api): security and metrics history improvements 2026-01-22 00:44:12 +00:00
security_tokens_test.go test: Add edge cases for normalizeRequestedScopes 2025-12-02 00:19:20 +00:00
session_oidc_test.go feat(license): add audit_logging, advanced_sso, advanced_reporting to Pro tier 2026-01-10 12:55:02 +00:00
session_store.go feat(sso): implement SAML session storage for Single Logout support 2026-01-12 16:37:07 +00:00
session_store_test.go feat(license): add audit_logging, advanced_sso, advanced_reporting to Pro tier 2026-01-10 12:55:02 +00:00
sso_handlers.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
sso_handlers_crud_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
sso_handlers_test.go feat(sso): add SAML 2.0 and multi-provider SSO support 2026-01-12 15:19:59 +00:00
storage_config_handler.go Update API handlers for AI and discovery endpoints 2026-01-28 16:51:35 +00:00
system_settings.go feat: add multi-tenancy foundation (directory-per-tenant) 2026-01-22 13:39:06 +00:00
system_settings_handlers_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
system_settings_ssh_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
system_settings_temperature_test.go Refactor: Multi-tenancy support for API and License handlers 2026-01-22 16:42:39 +00:00
system_settings_utils_test.go Add unit tests for system_settings.go map utility functions 2025-12-01 01:05:07 +00:00
system_settings_validate_test.go Show CPU core count on EnhancedCPUBar progress bar 2025-11-29 21:47:22 +00:00
types.go feat: AI integration, Docker metrics, RAID display, and infrastructure improvements 2025-12-09 09:29:27 +00:00
unified_agent.go fix(agent): add FreeBSD platform support to agent download and UI (#1051) 2026-01-11 23:51:12 +00:00
unified_agent_download_test.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
unified_agent_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00
update_detection.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
update_detection_test.go Enhance devcontainer and CI workflows 2026-01-01 22:29:15 +00:00
updates.go refactor(api): Add interfaces to handlers for testability 2026-01-19 19:21:46 +00:00
updates_test.go test: Add comprehensive test coverage across packages 2026-01-19 19:26:18 +00:00
websocket_isolation_test.go feat: enhance API router with multi-tenant authorization 2026-01-24 22:42:23 +00:00

Internal API Package

This directory contains the API server implementation for Pulse.

Important Note About frontend-modern/

The frontend-modern/ subdirectory that appears here is:

  • AUTO-GENERATED during builds
  • NOT the source code - just a build artifact
  • IN .gitignore - never committed
  • REQUIRED BY GO - The embed directive needs it here

Frontend Development Location

👉 Edit frontend files at: ${PULSE_REPOS_DIR}/pulse/frontend-modern/src/

Why This Structure?

Go's //go:embed directive has limitations:

  1. Cannot use ../ paths to access parent directories
  2. Cannot follow symbolic links
  3. Must embed files within the Go module

This is a known Go limitation and our structure works around it.