rdev/internal/port/preview.go
jordan 7249575dea
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat(sessions): add command execution endpoint and activity tracking
- Add POST /sessions/:id/exec endpoint for executing commands in sessions
- Add session activity tracking (last_activity_at timestamp)
- Add database migration 024 for session activity column
- Add comprehensive tests for session handlers and service layer
- Add wildcard TLS certificate for preview.threesix.ai subdomain
- Add infrastructure mocks for testing preview service
- Refactor preview cleanup logic to remove unused methods
- Add AIOS core documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-13 08:41:05 -07:00

30 lines
953 B
Go

// Package port defines interfaces (ports) for external dependencies.
package port
import "context"
// PreviewManager manages ephemeral preview URLs via K8s Service + Ingress.
type PreviewManager interface {
// CreatePreview creates a K8s Service + Ingress for the session preview.
// The service routes traffic to the target pod on the specified port.
CreatePreview(ctx context.Context, opts PreviewOptions) error
// DeletePreview removes the K8s Service + Ingress for a session preview.
DeletePreview(ctx context.Context, sessionID string) error
}
// PreviewOptions configures an ephemeral preview.
type PreviewOptions struct {
// SessionID is used as the resource name prefix (e.g., "session-{id}").
SessionID string
// PodName is the target pod to route traffic to.
PodName string
// Host is the preview hostname (e.g., "abc123.preview.threesix.ai").
Host string
// Port is the target port on the pod (default: 8080).
Port int
}