httpapi

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router gin.IRouter, handlers *Handlers)

RegisterRoutes registers the shared Compozy API routes on the supplied Gin router.

func RegisterSurfaceRoutes

func RegisterSurfaceRoutes(router gin.IRouter, handlers *Handlers, surfaceSet SurfaceSet)

RegisterSurfaceRoutes constructs one physical route matrix for the listener.

Types

type AppAccessPolicy

type AppAccessPolicy func(method, route string) bool

AppAccessPolicy resolves a physical route to its canonical operation decisions.

type ExtensionService

type ExtensionService = core.ExtensionService

ExtensionService exposes daemon-backed extension management to the HTTP API.

type Handlers

type Handlers struct {
	*core.BaseHandlers

	Extensions ExtensionService
	// contains filtered or unexported fields
}

Handlers expose request/response and SSE endpoints for the Compozy API.

type Option

type Option func(*Server)

Option customizes HTTP server construction.

func WithAgentCatalog

func WithAgentCatalog(catalog core.AgentCatalog) Option

WithAgentCatalog injects the projected resource-backed agent catalog.

func WithAgentContext

func WithAgentContext(service core.AgentContextService) Option

WithAgentContext injects the bounded agent situation context service.

func WithAgentDefinitionSync

func WithAgentDefinitionSync(syncer core.AgentDefinitionSync) Option

WithAgentDefinitionSync injects the daemon convergence seam used after authored mutations.

func WithAgentHistoryPurgers

func WithAgentHistoryPurgers(soulPurger core.SoulHistoryPurger, heartbeatPurger core.HeartbeatHistoryPurger) Option

WithAgentHistoryPurgers injects scoped soul and heartbeat revision cleanup.

func WithAgentLoader

func WithAgentLoader(loader core.AgentLoader) Option

WithAgentLoader overrides agent definition loading.

func WithAppTokenAuth

func WithAppTokenAuth(auth gateway.AppTokenAuthenticator, policy AppAccessPolicy) Option

func WithAppTokenAuthLimiter

func WithAppTokenAuthLimiter(limiter *gateway.AuthFailureLimiter) Option

func WithAppTokenManager

func WithAppTokenManager(manager core.AppTokenManager) Option

func WithApprovalCoordinator

func WithApprovalCoordinator(coordinator toolspkg.ApprovalCoordinator) Option

WithApprovalCoordinator injects the asynchronous tool-approval coordinator.

func WithAutomation

func WithAutomation(manager core.AutomationManager) Option

WithAutomation injects the daemon-owned automation manager.

func WithClarifyBroker

func WithClarifyBroker(broker toolspkg.ClarifyBroker) Option

WithClarifyBroker injects the boot-scoped clarification authority.

func WithCmdPalette

func WithCmdPalette(registry cmdpalette.Registry) Option

WithCmdPalette injects the command-palette registry into the HTTP server.

func WithConfig

func WithConfig(cfg *compozyconfig.Config) Option

WithConfig overrides the runtime configuration used by the server.

func WithContextWindowResolver

func WithContextWindowResolver(resolver core.ContextWindowResolver) Option

func WithCoordinatorRole

func WithCoordinatorRole(resolver core.CoordinatorRoleResolver) Option

WithCoordinatorRole injects the resolved coordinator policy reader.

func WithDaemonDrainController

func WithDaemonDrainController(controller core.DaemonDrainController) Option

WithDaemonDrainController injects daemon-global admission control.

func WithDeadEntitySource

func WithDeadEntitySource(source doctor.DeadEntitySource) Option

WithDeadEntitySource injects durable runtime-reliability diagnostics.

func WithDeviceAuth

func WithDeviceAuth(auth gateway.DeviceAuthenticator) Option

WithDeviceAuth installs the device credential authority for tier listeners.

func WithEngine

func WithEngine(engine *gin.Engine) Option

WithEngine overrides the Gin engine used by the server, mainly for tests.

func WithExtensionService

func WithExtensionService(service ExtensionService) Option

WithExtensionService injects daemon-backed extension management handlers.

func WithGatewayAdmission

func WithGatewayAdmission(admission gateway.AdmissionController) Option

WithGatewayAdmission installs the fail-closed request gate for tier listeners.

func WithGatewayAuthLimiter

func WithGatewayAuthLimiter(limiter *gateway.AuthFailureLimiter) Option

WithGatewayAuthLimiter overrides failed-auth throttling, primarily for deterministic tests.

func WithGatewayChallenge

func WithGatewayChallenge(tier gateway.Tier, resolver gateway.ChallengeResolver) Option

WithGatewayChallenge mounts the nonce-only verification route on one tier listener.

func WithGatewayIngressLimiter

func WithGatewayIngressLimiter(limiter *gateway.IngressRateLimiter) Option

WithGatewayIngressLimiter overrides public ingress throttling, primarily for deterministic tests.

func WithGatewayService

func WithGatewayService(service core.GatewayService) Option

WithGatewayService installs gateway management handlers.

func WithHeartbeatAuthoring

func WithHeartbeatAuthoring(service core.HeartbeatAuthoringService) Option

WithHeartbeatAuthoring injects the managed Heartbeat authoring surface.

func WithHeartbeatStatus

func WithHeartbeatStatus(service core.HeartbeatStatusService) Option

WithHeartbeatStatus injects the Heartbeat status/read surface.

func WithHeartbeatWake

func WithHeartbeatWake(service core.HeartbeatWakeService) Option

WithHeartbeatWake injects the manual Heartbeat wake surface.

func WithHeartbeatWakeEventReader

func WithHeartbeatWakeEventReader(reader core.HeartbeatWakeEventReader) Option

WithHeartbeatWakeEventReader injects the retained Heartbeat wake audit reader.

func WithHomePaths

func WithHomePaths(homePaths compozyconfig.HomePaths) Option

WithHomePaths overrides the resolved Compozy home layout.

func WithHost

func WithHost(host string) Option

WithHost overrides the HTTP bind host.

func WithHostLoadSnapshotSource

func WithHostLoadSnapshotSource(source doctor.HostLoadSnapshotSource) Option

WithHostLoadSnapshotSource injects host CPU pressure observations from load-aware admission.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger injects the server logger.

func WithLoopService

func WithLoopService(service core.LoopService) Option

WithLoopService injects the daemon-owned Loop public API facade.

func WithMarketplaceCatalogService

func WithMarketplaceCatalogService(service core.MarketplaceCatalogService) Option

WithMarketplaceCatalogService injects the daemon-owned curated marketplace service.

func WithModelCatalogService

func WithModelCatalogService(service core.ModelCatalogService) Option

WithModelCatalogService injects the daemon-owned provider model catalog service.

func WithNow

func WithNow(now func() time.Time) Option

WithNow overrides the server clock, mainly for tests.

func WithObserver

func WithObserver(observer core.Observer) Option

WithObserver injects the runtime observer.

func WithOnboardingStore

func WithOnboardingStore(store core.OnboardingStore) Option

WithOnboardingStore injects the first-run onboarding completion store.

func WithOpenAPIDocument

func WithOpenAPIDocument(document *core.OpenAPIDocument) Option

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval overrides the SSE poll cadence.

func WithPort

func WithPort(port int) Option

WithPort overrides the HTTP bind port.

func WithProfileService

func WithProfileService(service core.ProfileService) Option

WithProfileService injects the daemon-owned profile lifecycle service.

func WithProviderAuthSuccess

func WithProviderAuthSuccess(callback func()) Option

WithProviderAuthSuccess observes a successful live authentication probe.

func WithProviderUsageService

func WithProviderUsageService(service core.ProviderUsageService) Option

WithProviderUsageService injects profile-scoped provider usage.

func WithResourceOperatorAuth

func WithResourceOperatorAuth(middleware ...gin.HandlerFunc) Option

WithResourceOperatorAuth gates HTTP resource routes behind explicit operator auth middleware.

func WithResourceService

func WithResourceService(service core.ResourceService) Option

WithResourceService injects the shared operator-facing desired-state resource service.

func WithRolesStatusProvider

func WithRolesStatusProvider(provider core.RolesStatusProvider) Option

WithRolesStatusProvider injects the effective role configuration reader.

func WithRuntimeMemorySnapshotSource

func WithRuntimeMemorySnapshotSource(source doctor.RuntimeMemorySnapshotSource) Option

WithRuntimeMemorySnapshotSource injects daemon process-memory observations.

func WithSchemaStreamStatusReader

func WithSchemaStreamStatusReader(reader core.SchemaStreamStatusReader) Option

WithSchemaStreamStatusReader injects daemon-global migration status diagnostics.

func WithSessionAttachmentStore

func WithSessionAttachmentStore(store core.SessionAttachmentStore) Option

WithSessionAttachmentStore injects durable session attachment storage.

func WithSessionCatalog

func WithSessionCatalog(catalog core.SessionCatalog) Option

WithSessionCatalog injects the daemon-owned session catalog.

func WithSessionFileSearcher

func WithSessionFileSearcher(searcher core.SessionFileSearcher) Option

WithSessionFileSearcher injects the session file search index.

func WithSessionHealthReader

func WithSessionHealthReader(reader core.SessionHealthReader) Option

WithSessionHealthReader injects the metadata-only session health reader.

func WithSessionManager

func WithSessionManager(manager core.SessionManager) Option

WithSessionManager injects the runtime session manager.

func WithSessionMonitorService

func WithSessionMonitorService(service core.SessionMonitorService) Option

WithSessionMonitorService exposes the daemon-owned session monitors.

func WithSettingsRestartController

func WithSettingsRestartController(controller core.SettingsRestartController) Option

WithSettingsRestartController injects the daemon-owned restart action surface for settings handlers.

func WithSettingsService

func WithSettingsService(service core.SettingsService) Option

WithSettingsService injects the daemon-owned settings service.

func WithSettingsUpdateController

func WithSettingsUpdateController(controller core.SettingsUpdateController) Option

WithSettingsUpdateController injects the daemon-owned update status surface for settings handlers.

func WithSkillExposureStore

func WithSkillExposureStore(repository store.SkillExposureRepository, events store.EventSummaryStore) Option

WithSkillExposureStore injects the durable skill exposure projection and ledger.

func WithSkillResourceSyncer

func WithSkillResourceSyncer(syncer core.SkillResourceSyncer) Option

WithSkillResourceSyncer injects the resource-backed skill syncer surfaced by the daemon.

func WithSkillsRegistry

func WithSkillsRegistry(registry core.SkillsRegistry) Option

WithSkillsRegistry injects the skills registry surfaced by the daemon.

func WithSoulAuthoring

func WithSoulAuthoring(service core.SoulAuthoringService) Option

WithSoulAuthoring injects the managed Soul authoring surface.

func WithSoulRefresher

func WithSoulRefresher(service core.SoulRefresher) Option

WithSoulRefresher injects the session Soul refresh surface.

func WithStartedAt

func WithStartedAt(startedAt time.Time) Option

WithStartedAt overrides the daemon start time reported by the API.

func WithSubagentService

func WithSubagentService(service session.SubagentService) Option

func WithSupportBundleService

func WithSupportBundleService(service core.SupportBundleService) Option

WithSupportBundleService injects the daemon-owned support bundle operation service.

func WithSurfaceSet

func WithSurfaceSet(surfaceSet SurfaceSet) Option

WithSurfaceSet fixes the listener's route inventory without trusting request metadata.

func WithTaskDesignationStore

func WithTaskDesignationStore(value core.TaskDesignationStore) Option

WithTaskDesignationStore injects persisted task fan-out summaries.

func WithTaskService

func WithTaskService(service core.TaskService) Option

WithTaskService injects the daemon-owned task service.

func WithTerminalProvider

func WithTerminalProvider(provider core.TerminalProvider) Option

WithTerminalProvider injects the per-profile terminal managers.

func WithToolApprovalGrantService

func WithToolApprovalGrantService(service core.ToolApprovalGrantService) Option

WithToolApprovalGrantService injects durable native-tool approval management.

func WithToolApprovalIssuer

func WithToolApprovalIssuer(issuer core.ToolApprovalIssuer) Option

WithToolApprovalIssuer injects the local approval-token issuer.

func WithToolArtifactStore

func WithToolArtifactStore(store toolspkg.ToolArtifactStore) Option

WithToolArtifactStore injects retained oversized result storage.

func WithToolRegistry

func WithToolRegistry(registry core.ToolRegistry) Option

WithToolRegistry injects the executable tool registry.

func WithToolsetRegistry

func WithToolsetRegistry(registry core.ToolsetRegistry) Option

WithToolsetRegistry injects the named toolset projection registry.

func WithVaultService

func WithVaultService(service core.VaultService) Option

WithVaultService injects the daemon-owned vault control surface.

func WithWindowManagerProvider

func WithWindowManagerProvider(provider core.WindowManagerProvider) Option

WithWindowManagerProvider injects the per-profile window managers.

func WithWorkspaceAccessPolicy

func WithWorkspaceAccessPolicy(policy workspaceaccess.Policy) Option

WithWorkspaceAccessPolicy injects the cross-workspace decision policy.

func WithWorkspaceResolver

func WithWorkspaceResolver(workspaces core.WorkspaceService) Option

WithWorkspaceResolver injects the runtime workspace resolver/service.

func WithWorktreeService

func WithWorktreeService(worktrees core.WorktreeService) Option

WithWorktreeService injects the workspace-scoped worktree service.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server exposes the daemon API over TCP HTTP.

func New

func New(opts ...Option) (*Server, error)

New constructs an HTTP API server.

func (*Server) Port

func (s *Server) Port() int

Port reports the effective HTTP port.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown stops accepting new requests and drains active ones.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start begins serving the API over the configured TCP address.

type SurfaceSet

type SurfaceSet string

SurfaceSet identifies the route inventory fixed at listener construction.

const (
	SurfaceSetLocal          SurfaceSet = "local"
	SurfaceSetPrivate        SurfaceSet = "private"
	SurfaceSetPublicIngress  SurfaceSet = "public_ingress"
	SurfaceSetPublicOperator SurfaceSet = "public_operator"
	SurfaceSetPublicCombined SurfaceSet = "public_combined"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL