import { Node, Pod, Pack, Namespace, PriorityClass, ClusterConfig, ClusterStats, ClusterHealth, RuntimeType, NodeStatus, RegisterNodeInput, UpdateNodeInput, AllocatableResources, Labels, Taint, LabelSelector, PodStatus, CreatePodInput, Capability, UpdatePodInput, ResourceRequirements, PodAction, PodHistoryEntry, RuntimeTag, RegisterPackInput, UpdatePackInput, PackVersionSummary, Secret, SecretType, SecretListItem, PackMetadata, PackListItem, Annotations, Toleration, PodSchedulingConfig, PodListItem, NodeCapabilities, NodeHeartbeat, NodeListItem, User, UserRole, UpdateUserInput, CreateUserInput, UserSession, NamespacePhase, ResourceQuota, LimitRange, ResourceUsage, ResourceQuotaHard, ResourceLimitValue, UpdateNamespaceInput, NamespaceListItem, CreateNamespaceInput, Service, ServiceStatus, ServiceListItem, CreateServiceInput, SecretInjection, CreateSecretInput, UpdateSecretInput, PodSecretPayload } from '@stark-o/shared'; export * from '@stark-o/shared'; import { Ref, ComputedRef } from '@vue/reactivity'; export { ComputedRef, Ref, ShallowRef, UnwrapRef, WatchCallback, WatchOptions, computed, isProxy, isReactive, isRef, reactive, ref, shallowReactive, shallowRef, toRef, toRefs, watch } from '@vue/reactivity'; /** * Reactive cluster state store using Vue reactivity * @module @stark-o/core/stores/cluster-store */ /** * Cluster state interface */ interface ClusterState { /** All registered nodes by ID */ nodes: Map; /** All active pods by ID */ pods: Map; /** All registered packs by ID */ packs: Map; /** All namespaces by name */ namespaces: Map; /** Priority classes by name */ priorityClasses: Map; /** Cluster configuration */ config: ClusterConfig; /** Whether the cluster is initialized */ initialized: boolean; /** Last sync timestamp */ lastSyncAt: Date | null; } /** * Cluster store instance */ declare const clusterState: ClusterState; /** * Loading state for async operations */ declare const isLoading: Ref; /** * Error state for async operations */ declare const lastError: Ref; /** * List of all nodes */ declare const nodesList: ComputedRef; /** * List of healthy nodes */ declare const healthyNodes: ComputedRef; /** * List of unhealthy nodes */ declare const unhealthyNodes: ComputedRef; /** * List of schedulable nodes (online and not unschedulable) */ declare const schedulableNodes: ComputedRef; /** * Node.js nodes */ declare const nodeJsNodes: ComputedRef; /** * Browser nodes */ declare const browserNodes: ComputedRef; /** * List of all pods */ declare const podsList: ComputedRef; /** * List of running pods */ declare const runningPods: ComputedRef; /** * List of pending pods */ declare const pendingPods: ComputedRef; /** * List of failed pods */ declare const failedPods: ComputedRef; /** * List of all packs */ declare const packsList: ComputedRef; /** * List of all namespaces */ declare const namespacesList: ComputedRef; /** * Cluster statistics */ declare const clusterStats: ComputedRef; /** * Cluster health status */ declare const clusterHealth: ComputedRef; /** * Initialize the cluster state */ declare function initializeCluster(config?: Partial): void; /** * Reset the cluster state */ declare function resetCluster(): void; /** * Update cluster configuration */ declare function updateClusterConfig(updates: Partial): void; /** * Set loading state */ declare function setLoading(loading: boolean): void; /** * Set error state */ declare function setError(error: Error | null): void; /** * Clear error state */ declare function clearError(): void; /** * Get a node by ID */ declare function getNode(id: string): Node | undefined; /** * Get a pod by ID */ declare function getPod(id: string): Pod | undefined; /** * Get a pack by ID */ declare function getPack(id: string): Pack | undefined; /** * Get a namespace by name */ declare function getNamespace(name: string): Namespace | undefined; /** * Get pods on a specific node */ declare function getPodsOnNode(nodeId: string): Pod[]; /** * Get pods in a namespace */ declare function getPodsInNamespace(namespace: string): Pod[]; /** * Get pods for a specific pack */ declare function getPodsForPack(packId: string): Pod[]; /** * Get priority class by name */ declare function getPriorityClass(name: string): PriorityClass | undefined; /** * Check if cluster is healthy */ declare function isClusterHealthy(): boolean; /** * Reset cluster state to initial empty state (for testing) */ declare function resetClusterState(): void; /** * Reactive node registry store using Vue reactivity * @module @stark-o/core/stores/node-store */ /** * Internal node update input that includes allocated resources */ interface InternalNodeUpdate extends UpdateNodeInput { allocated?: Partial; } /** * Total node count */ declare const nodeCount: ComputedRef; /** * Online node count */ declare const onlineNodeCount: ComputedRef; /** * Nodes grouped by runtime type */ declare const nodesByRuntime: ComputedRef>; /** * Nodes grouped by status */ declare const nodesByStatus: ComputedRef>; /** * Add a new node to the registry */ declare function addNode(input: RegisterNodeInput & { id?: string; registeredBy?: string; }): Node; /** * Update an existing node */ declare function updateNode(id: string, updates: InternalNodeUpdate): Node | undefined; /** * Remove a node from the registry */ declare function removeNode(id: string): boolean; /** * Update node status */ declare function setNodeStatus(id: string, status: NodeStatus): Node | undefined; /** * Process node heartbeat */ declare function processHeartbeat(id: string): Node | undefined; /** * Mark node as unhealthy (missed heartbeats) */ declare function markNodeUnhealthy(id: string): Node | undefined; /** * Mark node as offline */ declare function markNodeOffline(id: string): Node | undefined; /** * Set node as draining (no new pods) */ declare function drainNode(id: string): Node | undefined; /** * Set node as under maintenance */ declare function setNodeMaintenance(id: string): Node | undefined; /** * Make node schedulable again */ declare function uncordonNode(id: string): Node | undefined; /** * Update node labels */ declare function setNodeLabels(id: string, labels: Labels): Node | undefined; /** * Add a label to a node */ declare function addNodeLabel(id: string, key: string, value: string): Node | undefined; /** * Remove a label from a node */ declare function removeNodeLabel(id: string, key: string): Node | undefined; /** * Update node taints */ declare function setNodeTaints(id: string, taints: Taint[]): Node | undefined; /** * Add a taint to a node */ declare function addNodeTaint(id: string, taint: Taint): Node | undefined; /** * Remove a taint from a node */ declare function removeNodeTaint(id: string, key: string, effect?: string): Node | undefined; /** * Allocate resources on a node */ declare function allocateResources(id: string, cpu: number, memory: number): Node | undefined; /** * Release resources on a node */ declare function releaseResources(id: string, cpu: number, memory: number): Node | undefined; /** * Find node by name */ declare function findNodeByName(name: string): Node | undefined; /** * Find nodes matching a label selector */ declare function findNodesBySelector(selector: LabelSelector): Node[]; /** * Find nodes by runtime type */ declare function findNodesByRuntime(runtimeType: RuntimeType): Node[]; /** * Get all schedulable nodes for a runtime type */ declare function getSchedulableNodesForRuntime(runtimeType: RuntimeType): Node[]; /** * Check if any nodes are available */ declare function hasAvailableNodes(): boolean; /** * Get nodes that need heartbeat check * Returns nodes whose last heartbeat is older than the threshold * @param thresholdMs - Threshold in milliseconds (default: 30000ms) */ declare function getStaleNodes(thresholdMs?: number): Node[]; /** * Reactive pods state store using Vue reactivity * @module @stark-o/core/stores/pod-store */ /** * Extended create pod input with internal fields */ interface InternalCreatePodInput extends CreatePodInput { id?: string; priority?: number; createdBy?: string; grantedCapabilities?: Capability[]; } /** * Internal pod update input that includes resource updates */ interface InternalPodUpdate extends UpdatePodInput { resourceRequests?: Partial; resourceLimits?: Partial; } /** * Total pod count */ declare const podCount: ComputedRef; /** * Running pod count */ declare const runningPodCount: ComputedRef; /** * Pending pod count */ declare const pendingPodCount: ComputedRef; /** * Pods grouped by status */ declare const podsByStatus: ComputedRef>; /** * Pods grouped by namespace */ declare const podsByNamespace: ComputedRef>; /** * Pods grouped by node */ declare const podsByNode: ComputedRef>; /** * Create a new pod */ declare function createPod(input: InternalCreatePodInput): Pod; /** * Update an existing pod */ declare function updatePod(id: string, updates: InternalPodUpdate): Pod | undefined; /** * Remove a pod from the store */ declare function removePod(id: string): boolean; /** * Schedule a pod to a node */ declare function schedulePod(id: string, nodeId: string): Pod | undefined; /** * Mark pod as starting */ declare function startPod(id: string): Pod | undefined; /** * Mark pod as running */ declare function setPodRunning(id: string): Pod | undefined; /** * Mark pod as stopping */ declare function stopPod(id: string): Pod | undefined; /** * Mark pod as stopped */ declare function setPodStopped(id: string): Pod | undefined; /** * Mark pod as failed */ declare function setPodFailed(id: string, message?: string): Pod | undefined; /** * Mark pod as evicted */ declare function evictPod(id: string, reason?: string): Pod | undefined; /** * Update pod status */ declare function setPodStatus(id: string, status: PodStatus, message?: string): Pod | undefined; /** * Update pod labels */ declare function setPodLabels(id: string, labels: Labels): Pod | undefined; /** * Add a label to a pod */ declare function addPodLabel(id: string, key: string, value: string): Pod | undefined; /** * Remove a label from a pod */ declare function removePodLabel(id: string, key: string): Pod | undefined; /** * Add a history entry for a pod */ declare function addHistoryEntry(podId: string, action: PodAction, actorId?: string, metadata?: Record): PodHistoryEntry; /** * Get history for a pod */ declare function getPodHistory(podId: string): PodHistoryEntry[]; /** * Clear history for a pod */ declare function clearPodHistory(podId: string): void; /** * Find pods matching a label selector */ declare function findPodsBySelector(selector: LabelSelector): Pod[]; /** * Find pods by pack ID */ declare function findPodsByPack(packId: string): Pod[]; /** * Find pods by node ID */ declare function findPodsByNode(nodeId: string): Pod[]; /** * Find pods by namespace */ declare function findPodsByNamespace(namespace: string): Pod[]; /** * Find pods by status */ declare function findPodsByStatus(status: PodStatus): Pod[]; /** * Find pending pods sorted by priority (highest first) */ declare function getPendingPodsByPriority(): Pod[]; /** * Find evictable pods on a node (sorted by priority, lowest first) */ declare function getEvictablePodsOnNode(nodeId: string): Pod[]; /** * Check if a node can accept more pods */ declare function canNodeAcceptPods(nodeId: string): boolean; /** * Count active pods in namespace */ declare function countActivePodsInNamespace(namespace: string): number; /** * Reactive pack registry state store using Vue reactivity * @module @stark-o/core/stores/pack-store */ /** * Total pack count */ declare const packCount: ComputedRef; /** * Unique pack names (not counting versions) */ declare const uniquePackNames: ComputedRef>; /** * Unique pack count (not counting versions) */ declare const uniquePackCount: ComputedRef; /** * Packs grouped by name */ declare const packsByName: ComputedRef>; /** * Packs grouped by runtime tag */ declare const packsByRuntime: ComputedRef>; /** * Packs grouped by owner */ declare const packsByOwner: ComputedRef>; /** * Register a new pack */ declare function registerPack(input: RegisterPackInput & { id?: string; ownerId: string; bundlePath: string; grantedCapabilities?: Capability[]; }): Pack; /** * Update an existing pack */ declare function updatePack(id: string, updates: UpdatePackInput): Pack | undefined; /** * Remove a pack from the registry */ declare function removePack(id: string): boolean; /** * Remove all versions of a pack by name */ declare function removePackByName(name: string): number; /** * Find pack by ID */ declare function findPackById(id: string): Pack | undefined; /** * Find pack by name and version */ declare function findPackByNameVersion(name: string, version: string): Pack | undefined; /** * Find all versions of a pack */ declare function findPackVersions(name: string): Pack[]; /** * Get version summaries for a pack */ declare function getPackVersionSummaries(name: string): PackVersionSummary[]; /** * Get latest version of a pack */ declare function getLatestPackVersion(name: string): Pack | undefined; /** * Find packs by owner */ declare function findPacksByOwner(ownerId: string): Pack[]; /** * Find packs by runtime tag */ declare function findPacksByRuntime(runtimeTag: RuntimeTag): Pack[]; /** * Find packs compatible with a runtime type */ declare function findPacksCompatibleWith(runtimeType: 'node' | 'browser'): Pack[]; /** * Search packs by name (partial match) */ declare function searchPacksByName(query: string): Pack[]; /** * Check if a pack version exists */ declare function packVersionExists(name: string, version: string): boolean; /** * Check if any version of a pack exists */ declare function packExists(name: string): boolean; /** * Validate semantic version format */ declare function isValidVersion(version: string): boolean; /** * Get next patch version */ declare function getNextPatchVersion(version: string): string; /** * Get next minor version */ declare function getNextMinorVersion(version: string): string; /** * Get next major version */ declare function getNextMajorVersion(version: string): string; /** * Reactive secret store using Vue reactivity * * Secrets are stored in a dedicated Map, separate from the cluster state, * to enforce isolation. The store never exposes decrypted data — only * encrypted blobs and metadata. * * @module @stark-o/core/stores/secret-store */ /** Total secret count */ declare const secretCount: ComputedRef; /** All secrets as a list (metadata only — encrypted data is present but opaque) */ declare const secretsList: ComputedRef; /** Secrets grouped by namespace */ declare const secretsByNamespace: ComputedRef>; /** Secrets grouped by type */ declare const secretsByType: ComputedRef>; /** * Add a secret to the store. * The secret must already be encrypted before calling this. */ declare function addSecret(secret: Secret): void; /** * Update a secret in the store. * Replaces the existing secret entirely (new encrypted data, bumped version). */ declare function updateSecret(id: string, updates: Partial): Secret | null; /** * Remove a secret from the store by ID. * Returns the removed secret (for cleanup) or null. */ declare function removeSecret(id: string): Secret | null; /** * Remove a secret from the store by name and namespace. */ declare function removeSecretByName(name: string, namespace?: string): Secret | null; /** * Find a secret by ID */ declare function findSecretById(id: string): Secret | null; /** * Find a secret by name within a namespace */ declare function findSecretByName(name: string, namespace?: string): Secret | null; /** * Find all secrets by namespace */ declare function findSecretsByNamespace(namespace: string): Secret[]; /** * Find all secrets by type */ declare function findSecretsByType(type: SecretType): Secret[]; /** * Check if a secret exists by name and namespace */ declare function secretExists(name: string, namespace?: string): boolean; /** * Resolve multiple secret names to their Secret objects. * Returns only found secrets and a list of missing names. */ declare function resolveSecretNames(names: string[], namespace?: string): { found: Secret[]; missing: string[]; }; /** * Get a safe listing view (no encrypted data exposed) */ declare function getSecretListItems(namespace?: string): SecretListItem[]; /** * Convert a Secret to a SecretListItem (safe for API responses) */ declare function toSecretListItem(secret: Secret): SecretListItem; /** * Reset all secret state (for testing) */ declare function resetSecretStore(): void; /** * Pack reactive model with validation * @module @stark-o/core/models/pack */ /** * Result of pack registration */ interface PackRegistrationResult { pack: Pack; uploadUrl: string; } /** * Pack list response with pagination */ interface PackListResponse { packs: Pack[]; total: number; page: number; pageSize: number; } /** * Pack list filters */ interface PackListFilters { /** Filter by pack name (partial match) */ name?: string; /** Filter by runtime tag */ runtimeTag?: RuntimeTag; /** Filter by owner ID */ ownerId?: string; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Reactive Pack model wrapper * Provides reactive access to pack data with computed properties */ declare class PackModel { private readonly _pack; constructor(pack: Pack); /** * Get the raw pack data */ get data(): Pack; /** * Pack ID */ get id(): string; /** * Pack name */ get name(): string; /** * Pack version */ get version(): string; /** * Runtime tag */ get runtimeTag(): RuntimeTag; /** * Owner ID */ get ownerId(): string; /** * Bundle path in storage */ get bundlePath(): string; /** * Description */ get description(): string | undefined; /** * Metadata */ get metadata(): PackMetadata; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Full pack identifier (name@version) */ get fullId(): string; /** * Check if pack is compatible with a node runtime */ isCompatibleWith(nodeRuntime: 'node' | 'browser'): boolean; /** * Update pack metadata */ update(updates: UpdatePackInput): void; /** * Convert to version summary */ toVersionSummary(): PackVersionSummary; /** * Convert to list item */ toListItem(versionCount?: number): PackListItem; /** * Create a new Pack from input */ static create(input: RegisterPackInput, ownerId: string, bundlePath: string, id?: string, grantedCapabilities?: Capability[]): PackModel; /** * Validate pack registration input */ static validate(input: unknown): { valid: boolean; errors: Array<{ field: string; message: string; code: string; }>; }; /** * Sort packs by version (newest first) */ static sortByVersion(packs: Pack[]): Pack[]; /** * Get the latest version from a list of packs */ static getLatest(packs: Pack[]): Pack | undefined; /** * Generate bundle path for storage */ static generateBundlePath(name: string, version: string): string; /** * Generate upload URL placeholder (actual URL comes from storage service) */ static generateUploadUrlPlaceholder(bundlePath: string): string; } /** * Create a reactive computed pack list item */ declare function createReactivePackListItem(pack: Pack, versionCount: ComputedRef): ComputedRef; /** * Pod reactive model * @module @stark-o/core/models/pod */ /** * Pod creation result */ interface PodCreationResult { pod: Pod; } /** * Pod list response with pagination */ interface PodListResponse { pods: Pod[]; total: number; page: number; pageSize: number; } /** * Pod list filters */ interface PodListFilters { /** Filter by pack ID */ packId?: string; /** Filter by node ID */ nodeId?: string; /** Filter by namespace */ namespace?: string; /** Filter by status */ status?: PodStatus; /** Filter by label selector */ labelSelector?: Record; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Reactive Pod model wrapper * Provides reactive access to pod data with computed properties */ declare class PodModel { private readonly _pod; private readonly _history; constructor(pod: Pod, history?: PodHistoryEntry[]); /** * Get the raw pod data */ get data(): Pod; /** * Pod ID */ get id(): string; /** * Pack ID */ get packId(): string; /** * Pack version */ get packVersion(): string; /** * Node ID (null if not scheduled) */ get nodeId(): string | null; /** * Current status */ get status(): PodStatus; /** * Status message */ get statusMessage(): string | undefined; /** * Namespace */ get namespace(): string; /** * Labels */ get labels(): Labels; /** * Annotations */ get annotations(): Annotations; /** * Priority */ get priority(): number; /** * Priority class name */ get priorityClassName(): string | undefined; /** * Tolerations */ get tolerations(): Toleration[]; /** * Resource requests */ get resourceRequests(): ResourceRequirements; /** * Resource limits */ get resourceLimits(): ResourceRequirements; /** * Scheduling configuration */ get scheduling(): PodSchedulingConfig | undefined; /** * Creator user ID */ get createdBy(): string; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Started at timestamp */ get startedAt(): Date | undefined; /** * Stopped at timestamp */ get stoppedAt(): Date | undefined; /** * Scheduled at timestamp */ get scheduledAt(): Date | undefined; /** * Pod history */ get history(): PodHistoryEntry[]; /** * Check if pod is active */ get isActive(): boolean; /** * Check if pod is running */ get isRunning(): boolean; /** * Check if pod is terminated */ get isTerminated(): boolean; /** * Check if pod can be scheduled */ get isSchedulable(): boolean; /** * Update pod status */ updateStatus(status: PodStatus, message?: string, actorId?: string): void; /** * Assign to a node */ assignToNode(nodeId: string, actorId?: string): void; /** * Update pod metadata */ update(updates: UpdatePodInput): void; /** * Add history entry */ addHistoryEntry(action: PodAction, actorId?: string, previousStatus?: PodStatus, newStatus?: PodStatus, previousVersion?: string, newVersion?: string, previousNodeId?: string, newNodeId?: string, reason?: string, message?: string): PodHistoryEntry; /** * Convert to list item */ toListItem(): PodListItem; /** * Create a new Pod from input */ static create(input: CreatePodInput, packVersion: string, createdBy: string, priority?: number, id?: string, grantedCapabilities?: Capability[]): PodModel; /** * Validate pod creation input */ static validate(input: unknown): { valid: boolean; errors: Array<{ field: string; message: string; code: string; }>; }; } /** * Create a reactive computed pod list item */ declare function createReactivePodListItem(pod: Pod): ComputedRef; /** * Node reactive model with status and capabilities * @module @stark-o/core/models/node */ /** * Node registration result */ interface NodeRegistrationResult { node: Node; } /** * Node list response with pagination */ interface NodeListResponse { nodes: Node[]; total: number; page: number; pageSize: number; } /** * Node list filters */ interface NodeListFilters { /** Filter by runtime type */ runtimeType?: RuntimeType; /** Filter by status */ status?: NodeStatus; /** Filter by label selector */ labelSelector?: Record; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Heartbeat timeout in milliseconds (30 seconds) */ declare const HEARTBEAT_TIMEOUT_MS = 30000; /** * Reactive Node model wrapper * Provides reactive access to node data with computed properties */ declare class NodeModel { private readonly _node; constructor(node: Node); /** * Get the raw node data */ get data(): Node; /** * Node ID */ get id(): string; /** * Node name */ get name(): string; /** * Runtime type */ get runtimeType(): RuntimeType; /** * Current status */ get status(): NodeStatus; /** * Last heartbeat timestamp */ get lastHeartbeat(): Date | undefined; /** * Node capabilities */ get capabilities(): NodeCapabilities; /** * User who registered the node */ get registeredBy(): string | undefined; /** * WebSocket connection ID */ get connectionId(): string | undefined; /** * IP address */ get ipAddress(): string | undefined; /** * User agent string */ get userAgent(): string | undefined; /** * Total allocatable resources */ get allocatable(): AllocatableResources; /** * Currently allocated resources */ get allocated(): AllocatableResources; /** * Labels for organization and selection */ get labels(): Labels; /** * Annotations for metadata */ get annotations(): Annotations; /** * Taints to repel pods */ get taints(): Taint[]; /** * Whether node is unschedulable */ get unschedulable(): boolean; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Check if node can accept new pods */ get isSchedulable(): boolean; /** * Check if node is online */ get isOnline(): boolean; /** * Check if node is healthy (online and within heartbeat timeout) */ get isHealthy(): boolean; /** * Check if heartbeat has timed out */ get hasHeartbeatTimeout(): boolean; /** * Get available resources (allocatable - allocated) */ get availableResources(): AllocatableResources; /** * Get current pod count */ get podCount(): number; /** * Update node status */ updateStatus(status: NodeStatus): void; /** * Process heartbeat from node */ processHeartbeat(heartbeat: NodeHeartbeat): void; /** * Mark node as unhealthy due to heartbeat timeout */ markUnhealthy(): void; /** * Mark node as offline (disconnected) */ markOffline(): void; /** * Set connection ID when node connects via WebSocket */ setConnectionId(connectionId: string): void; /** * Update node metadata */ update(updates: UpdateNodeInput): void; /** * Allocate resources on the node */ allocateResources(resources: Partial): boolean; /** * Release resources on the node */ releaseResources(resources: Partial): void; /** * Check if node is compatible with a runtime tag */ isCompatibleWith(runtimeTag: 'node' | 'browser' | 'universal'): boolean; /** * Check if node has sufficient resources */ hasSufficientResources(required: Partial): boolean; /** * Convert to list item */ toListItem(): NodeListItem; /** * Create a new Node from input */ static create(input: RegisterNodeInput, registeredBy: string, connectionId?: string, ipAddress?: string, userAgent?: string, id?: string): NodeModel; /** * Validate node registration input */ static validate(input: unknown): { valid: boolean; errors: Array<{ field: string; message: string; code: string; }>; }; /** * Sort nodes by status priority (online first, then by name) */ static sortByStatusAndName(nodes: Node[]): Node[]; /** * Filter schedulable nodes */ static filterSchedulable(nodes: Node[]): Node[]; /** * Find nodes with sufficient resources */ static filterByResources(nodes: Node[], required: Partial): Node[]; /** * Find nodes by runtime type */ static filterByRuntimeType(nodes: Node[], runtimeType: RuntimeType): Node[]; /** * Find nodes matching label selector */ static filterByLabels(nodes: Node[], selector: Record): Node[]; } /** * Create a reactive computed node list item */ declare function createReactiveNodeListItem(node: Node): ComputedRef; /** * User reactive model with roles * @module @stark-o/core/models/user */ /** * User registration result */ interface UserRegistrationResult { user: User; session?: UserSession; } /** * User login result */ interface UserLoginResult { user: User; session: UserSession; } /** * User list response with pagination */ interface UserListResponse { users: User[]; total: number; page: number; pageSize: number; } /** * User list filters */ interface UserListFilters { /** Filter by email (partial match) */ email?: string; /** Filter by role */ role?: UserRole; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Authentication credentials */ interface AuthCredentials { email: string; password: string; } /** * Reactive User model wrapper * Provides reactive access to user data with computed properties */ declare class UserModel { private readonly _user; constructor(user: User); /** * Get the raw user data */ get data(): User; /** * User ID */ get id(): string; /** * User email */ get email(): string; /** * User display name */ get displayName(): string | undefined; /** * User roles */ get roles(): UserRole[]; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Computed: Check if user is an admin */ get isAdmin(): ComputedRef; /** * Computed: Check if user is a node agent */ get isNode(): ComputedRef; /** * Computed: Check if user is a viewer only */ get isViewerOnly(): ComputedRef; /** * Computed: Check if user can manage resources (admin only) */ get canManageResources(): ComputedRef; /** * Computed: Check if user is a node agent */ get isNodeAgent(): ComputedRef; /** * Computed: Formatted display name or email */ get displayNameOrEmail(): ComputedRef; /** * Computed: Primary role (first role in list) */ get primaryRole(): ComputedRef; /** * Computed: Role display string */ get roleDisplay(): ComputedRef; /** * Check if user has a specific role * @param role - The role to check */ hasRole(role: UserRole): boolean; /** * Check if user has any of the specified roles * @param roles - The roles to check */ hasAnyRole(roles: UserRole[]): boolean; /** * Check if user has all of the specified roles * @param roles - The roles to check */ hasAllRoles(roles: UserRole[]): boolean; /** * Update user properties * @param input - Properties to update */ update(input: UpdateUserInput): void; /** * Add a role to the user * @param role - The role to add */ addRole(role: UserRole): void; /** * Remove a role from the user * @param role - The role to remove */ removeRole(role: UserRole): void; /** * Convert to plain object */ toJSON(): User; /** * Create a UserModel from CreateUserInput * @param input - User creation input * @param id - Generated user ID */ static fromInput(input: CreateUserInput, id: string): UserModel; } /** * Create a reactive user list item for display * @param user - User data */ declare function createReactiveUserListItem(user: User): { id: string; email: string; displayName: ComputedRef; roles: ComputedRef; isNodeAgent: ComputedRef; canManageResources: ComputedRef; }; /** * Session timeout in milliseconds (1 hour default) */ declare const SESSION_TIMEOUT_MS: number; /** * Session refresh threshold (refresh when 15 mins left) */ declare const SESSION_REFRESH_THRESHOLD_MS: number; /** * Reactive UserSession model wrapper * Provides reactive access to session data with expiration tracking */ declare class UserSessionModel { private readonly _session; private readonly _userModel; constructor(session: UserSession); /** * Get the raw session data */ get data(): UserSession; /** * Get the user model */ get user(): UserModel; /** * Access token */ get accessToken(): string; /** * Refresh token */ get refreshToken(): string | undefined; /** * Session expiration timestamp */ get expiresAt(): Date; /** * Computed: Check if session is expired */ get isExpired(): ComputedRef; /** * Computed: Check if session should be refreshed */ get shouldRefresh(): ComputedRef; /** * Computed: Time remaining until expiration in milliseconds */ get timeRemaining(): ComputedRef; /** * Update session tokens (after refresh) * @param accessToken - New access token * @param refreshToken - New refresh token (optional) * @param expiresAt - New expiration time */ updateTokens(accessToken: string, expiresAt: Date, refreshToken?: string): void; /** * Convert to plain object */ toJSON(): UserSession; } /** * Namespace reactive model * @module @stark-o/core/models/namespace */ /** * Namespace creation result */ interface NamespaceCreationResult { namespace: Namespace; } /** * Namespace list response with pagination */ interface NamespaceListResponse { namespaces: Namespace[]; total: number; page: number; pageSize: number; } /** * Namespace list filters */ interface NamespaceListFilters { /** Filter by phase */ phase?: NamespacePhase; /** Filter by label selector */ labelSelector?: Record; /** Filter namespaces with quotas only */ hasQuota?: boolean; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Resource allocation request for quota checking */ interface ResourceAllocationRequest { pods?: number; cpu?: number; memory?: number; storage?: number; } /** * Reactive Namespace model wrapper * Provides reactive access to namespace data with computed properties */ declare class NamespaceModel { private readonly _namespace; constructor(namespace: Namespace); /** * Get the raw namespace data */ get data(): Namespace; /** * Namespace ID */ get id(): string; /** * Namespace name */ get name(): string; /** * Lifecycle phase */ get phase(): NamespacePhase; /** * Labels for organization */ get labels(): Labels; /** * Annotations for metadata */ get annotations(): Annotations; /** * Resource quota (optional) */ get resourceQuota(): ResourceQuota | undefined; /** * Limit range for pods (optional) */ get limitRange(): LimitRange | undefined; /** * Current resource usage */ get resourceUsage(): ResourceUsage; /** * User who created the namespace */ get createdBy(): string | undefined; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Check if namespace is active */ get isActive(): boolean; /** * Check if namespace is terminating */ get isTerminating(): boolean; /** * Check if namespace has a resource quota */ get hasQuota(): boolean; /** * Check if namespace has a limit range */ get hasLimitRange(): boolean; /** * Check if namespace is reserved (cannot be deleted by users) */ get isReserved(): boolean; /** * Get remaining quota (null if no quota) */ get remainingQuota(): ResourceQuotaHard | null; /** * Check if resources can be allocated within quota */ canAllocate(required: ResourceAllocationRequest): boolean; /** * Apply limit range defaults to resource requests/limits */ applyDefaults(requests?: { cpu?: number; memory?: number; }, limits?: { cpu?: number; memory?: number; }): { requests: ResourceLimitValue; limits: ResourceLimitValue; }; /** * Validate resources against limit range */ validateResources(requests: { cpu?: number; memory?: number; }, limits: { cpu?: number; memory?: number; }): { valid: boolean; errors: string[]; }; /** * Update namespace phase */ updatePhase(phase: NamespacePhase): void; /** * Mark namespace as terminating */ markTerminating(): void; /** * Update namespace metadata */ update(updates: UpdateNamespaceInput): void; /** * Update resource usage */ updateResourceUsage(usage: Partial): void; /** * Allocate resources (increase usage) */ allocateResources(resources: ResourceAllocationRequest): boolean; /** * Release resources (decrease usage) */ releaseResources(resources: ResourceAllocationRequest): void; /** * Convert to list item */ toListItem(): NamespaceListItem; /** * Create a new Namespace from input */ static create(input: CreateNamespaceInput, createdBy?: string, id?: string): NamespaceModel; /** * Create the default namespace */ static createDefault(id?: string): NamespaceModel; /** * Create system namespace */ static createSystem(id?: string): NamespaceModel; /** * Create public namespace */ static createPublic(id?: string): NamespaceModel; /** * Validate namespace creation input */ static validateCreate(input: unknown): { valid: boolean; errors: Array<{ field: string; message: string; code: string; }>; }; /** * Validate namespace update input */ static validateUpdate(input: unknown): { valid: boolean; errors: Array<{ field: string; message: string; code: string; }>; }; /** * Sort namespaces by phase priority (active first, then by name) */ static sortByPhaseAndName(namespaces: Namespace[]): Namespace[]; /** * Filter active namespaces */ static filterActive(namespaces: Namespace[]): Namespace[]; /** * Filter namespaces with quotas */ static filterWithQuota(namespaces: Namespace[]): Namespace[]; /** * Filter namespaces by labels */ static filterByLabels(namespaces: Namespace[], selector: Record): Namespace[]; /** * Find namespace by name */ static findByName(namespaces: Namespace[], name: string): Namespace | undefined; /** * Check if a namespace with the given name exists */ static nameExists(namespaces: Namespace[], name: string): boolean; /** * Get total resource usage across all namespaces */ static getTotalUsage(namespaces: Namespace[]): ResourceUsage; } /** * Create a reactive computed namespace list item */ declare function createReactiveNamespaceListItem(namespace: Namespace): ComputedRef; /** * Service reactive model * @module @stark-o/core/models/service */ /** * Service creation result */ interface ServiceCreationResult { service: Service; } /** * Service list response with pagination */ interface ServiceListResponse { services: Service[]; total: number; page: number; pageSize: number; } /** * Service list filters */ interface ServiceListFilters { /** Filter by pack ID */ packId?: string; /** Filter by namespace */ namespace?: string; /** Filter by status */ status?: ServiceStatus; /** Filter by label selector */ labelSelector?: Record; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Reactive Service model wrapper * Provides reactive access to service data with computed properties */ declare class ServiceModel { private readonly _service; constructor(service: Service); /** * Get the raw service data */ get data(): Service; /** * Service ID */ get id(): string; /** * Service name */ get name(): string; /** * Pack ID */ get packId(): string; /** * Pack version */ get packVersion(): string; /** * Namespace */ get namespace(): string; /** * Desired replicas (0 = DaemonSet mode) */ get replicas(): number; /** * Current status */ get status(): ServiceStatus; /** * Status message */ get statusMessage(): string | undefined; /** * Labels */ get labels(): Labels; /** * Annotations */ get annotations(): Annotations; /** * Pod labels (applied to created pods) */ get podLabels(): Labels; /** * Pod annotations (applied to created pods) */ get podAnnotations(): Annotations; /** * Priority class name */ get priorityClassName(): string | undefined; /** * Priority value */ get priority(): number; /** * Tolerations */ get tolerations(): Toleration[]; /** * Resource requests */ get resourceRequests(): ResourceRequirements; /** * Resource limits */ get resourceLimits(): ResourceRequirements; /** * Scheduling configuration */ get scheduling(): PodSchedulingConfig | undefined; /** * Observed generation */ get observedGeneration(): number; /** * Ready replicas count */ get readyReplicas(): number; /** * Available replicas count */ get availableReplicas(): number; /** * Updated replicas count */ get updatedReplicas(): number; /** * Creator user ID */ get createdBy(): string; /** * Creation timestamp */ get createdAt(): Date; /** * Last update timestamp */ get updatedAt(): Date; /** * Check if service is active */ get isActive(): boolean; /** * Check if service is a DaemonSet (replicas = 0) */ get isDaemonSet(): boolean; /** * Check if service has reached desired state */ get isReady(): boolean; /** * Update service status */ updateStatus(status: ServiceStatus, message?: string): void; /** * Update replica counts */ updateReplicaCounts(ready: number, available: number, updated: number): void; /** * Update replicas */ setReplicas(replicas: number): void; /** * Update pack version (for rollouts) */ setPackVersion(version: string): void; /** * Pause service */ pause(): void; /** * Resume service */ resume(): void; /** * Convert to list item format */ toListItem(): ServiceListItem; /** * Create from input */ static fromInput(input: CreateServiceInput, packId: string, packVersion: string, createdBy: string): ServiceModel; } /** * Create a reactive service list item */ declare function createReactiveServiceListItem(item: ServiceListItem): ServiceListItem; /** * Secret reactive model * * Provides a reactive wrapper around the Secret resource, * following the same patterns as ServiceModel, PodModel, etc. * * @module @stark-o/core/models/secret */ /** * Secret creation result */ interface SecretCreationResult { secret: Secret; } /** * Secret list response with pagination */ interface SecretListResponse { secrets: SecretListItem[]; total: number; page: number; pageSize: number; } /** * Secret list filters */ interface SecretListFilters { /** Filter by namespace */ namespace?: string; /** Filter by type */ type?: SecretType; /** Page number (1-based) */ page?: number; /** Page size */ pageSize?: number; } /** * Reactive Secret model wrapper * Provides reactive access to secret metadata with computed properties. * * IMPORTANT: This model intentionally does NOT expose decrypted data. * All data access goes through SecretManager which handles encryption. */ declare class SecretModel { private readonly _secret; constructor(secret: Secret); /** Raw secret data (with encrypted payload — never plaintext) */ get data(): Secret; get id(): string; get name(): string; get namespace(): string; get type(): SecretType; get injection(): SecretInjection; get version(): number; get createdBy(): string; get createdAt(): Date; get updatedAt(): Date; /** Whether this secret injects as environment variables */ get isEnvInjection(): boolean; /** Whether this secret injects as a volume mount */ get isVolumeInjection(): boolean; /** Volume mount path (only meaningful for volume injection) */ get mountPath(): string | undefined; /** Env prefix (only meaningful for env injection) */ get envPrefix(): string | undefined; /** * Convert to safe list item (no secret data) */ toListItem(keyCount?: number): SecretListItem; /** * Create a SecretModel from a creation input (validation + defaults). * Does NOT perform encryption — that's done by SecretManager. */ static validate(input: CreateSecretInput): { valid: boolean; errors: Array<{ field: string; message: string; }>; }; } /** * Create a reactive SecretListItem for UI display */ declare function createReactiveSecretListItem(secret: Secret, keyCount?: number): SecretListItem; /** * Pack registry service * Handles pack registration, versioning, and listing * @module @stark-o/core/services/pack-registry */ /** * Pack registration options */ interface PackRegistrationOptions { /** Generate upload URL for bundle */ generateUploadUrl?: (packId: string, packName: string, version: string) => string; /** Validate bundle path */ validateBundlePath?: boolean; } /** * Pack operation result */ interface PackOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Pack Registry Service * Manages pack lifecycle: registration, versioning, listing, and deletion */ declare class PackRegistry { private readonly generateUploadUrl; constructor(options?: PackRegistrationOptions); /** * Total number of packs (all versions) */ get totalPacks(): ComputedRef; /** * Total number of unique packs (by name) */ get uniquePacks(): ComputedRef; /** * Packs grouped by name */ get byName(): ComputedRef>; /** * Packs grouped by runtime tag */ get byRuntime(): ComputedRef>; /** * Packs grouped by owner */ get byOwner(): ComputedRef>; /** * Register a new pack * @param input - Pack registration input * @param ownerId - Owner user ID * @returns Registration result with pack and upload URL */ register(input: RegisterPackInput, ownerId: string): PackOperationResult; /** * Generate bundle path for a pack */ private generateBundlePath; /** * Update pack metadata * @param packId - Pack ID * @param updates - Update input * @param requesterId - User requesting the update (for authorization) * @returns Updated pack or error */ update(packId: string, updates: UpdatePackInput, requesterId: string): PackOperationResult; /** * Delete a specific pack version * @param packId - Pack ID * @param requesterId - User requesting deletion (for authorization) * @returns Success or error */ delete(packId: string, requesterId: string): PackOperationResult; /** * Delete all versions of a pack * @param packName - Pack name * @param requesterId - User requesting deletion (for authorization) * @returns Number of versions deleted or error */ deleteAllVersions(packName: string, requesterId: string): PackOperationResult<{ deletedCount: number; }>; /** * Get pack by ID */ getById(packId: string): PackOperationResult; /** * Get pack by name and version */ getByNameVersion(name: string, version: string): PackOperationResult; /** * Get latest version of a pack */ getLatest(packName: string): PackOperationResult; /** * Get all versions of a pack */ getVersions(packName: string): PackOperationResult; /** * List packs with filtering and pagination */ list(filters?: PackListFilters): PackOperationResult; /** * Search packs by name */ search(query: string): PackOperationResult; /** * Find packs by owner */ findByOwner(ownerId: string): PackOperationResult; /** * Find packs by runtime tag */ findByRuntime(runtimeTag: RuntimeTag): PackOperationResult; /** * Find packs compatible with a runtime type */ findCompatibleWith(runtimeType: 'node' | 'browser'): PackOperationResult; /** * Check if a specific version exists */ versionExists(packName: string, version: string): boolean; /** * Check if any version of a pack exists */ exists(packName: string): boolean; /** * Check runtime compatibility */ isCompatible(pack: Pack, nodeRuntime: 'node' | 'browser'): boolean; /** * Create a reactive PackModel from a pack */ createModel(pack: Pack): PackModel; /** * Create a list item from a pack */ toListItem(pack: Pack): PackListItem; } /** * Default pack registry instance */ declare const packRegistry: PackRegistry; /** * Create a pack registry with custom options */ declare function createPackRegistry(options?: PackRegistrationOptions): PackRegistry; /** * Pod scheduler service * Handles pod orchestration, scheduling, and runtime compatibility checking * @module @stark-o/core/services/pod-scheduler */ /** * Pod scheduler options */ interface PodSchedulerOptions { /** Maximum retries for scheduling */ maxRetries?: number; /** Default priority for pods */ defaultPriority?: number; /** Enable preemption */ enablePreemption?: boolean; /** Scheduling policy */ schedulingPolicy?: 'spread' | 'binpack' | 'random' | 'affinity' | 'least_loaded'; } /** * Pod operation result */ interface PodOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Scheduling result */ interface SchedulingResult { podId: string; nodeId: string; scheduled: boolean; message?: string; } /** * Pod scheduler error codes */ declare const PodSchedulerErrorCodes: { readonly VALIDATION_ERROR: "VALIDATION_ERROR"; readonly PACK_NOT_FOUND: "PACK_NOT_FOUND"; readonly NAMESPACE_NOT_FOUND: "NAMESPACE_NOT_FOUND"; readonly NAMESPACE_QUOTA_EXCEEDED: "NAMESPACE_QUOTA_EXCEEDED"; readonly NO_COMPATIBLE_NODES: "NO_COMPATIBLE_NODES"; readonly INSUFFICIENT_RESOURCES: "INSUFFICIENT_RESOURCES"; readonly SCHEDULING_FAILED: "SCHEDULING_FAILED"; readonly POD_NOT_FOUND: "POD_NOT_FOUND"; readonly INVALID_STATUS_TRANSITION: "INVALID_STATUS_TRANSITION"; readonly RUNTIME_MISMATCH: "RUNTIME_MISMATCH"; readonly NODE_VERSION_MISMATCH: "NODE_VERSION_MISMATCH"; readonly TAINT_NOT_TOLERATED: "TAINT_NOT_TOLERATED"; readonly AFFINITY_NOT_SATISFIED: "AFFINITY_NOT_SATISFIED"; readonly NODE_NOT_SCHEDULABLE: "NODE_NOT_SCHEDULABLE"; readonly PREEMPTION_FAILED: "PREEMPTION_FAILED"; readonly VERSION_NOT_FOUND: "VERSION_NOT_FOUND"; readonly SAME_VERSION: "SAME_VERSION"; readonly INVALID_STATE: "INVALID_STATE"; }; /** * Rollback result */ interface RollbackResult { podId: string; previousVersion: string; newVersion: string; packId: string; packName: string; } /** * Pod Scheduler Service * Manages pod lifecycle: creation, scheduling, status updates, and termination */ declare class PodScheduler { readonly maxRetries: number; private readonly defaultPriority; private readonly enablePreemption; private readonly schedulingPolicy; constructor(options?: PodSchedulerOptions); /** * Total number of pods */ get totalPods(): ComputedRef; /** * Number of running pods */ get runningPods(): ComputedRef; /** * Number of pending pods */ get pendingPods(): ComputedRef; /** * Pods grouped by status */ get byStatus(): ComputedRef>; /** * Pods grouped by namespace */ get byNamespace(): ComputedRef>; /** * Pods grouped by node */ get byNode(): ComputedRef>; /** * Create a new pod * @param input - Pod creation input * @param createdBy - User ID who created the pod * @returns Operation result with created pod */ create(input: CreatePodInput, createdBy: string): PodOperationResult; /** * Create and immediately attempt to schedule a pod * @param input - Pod creation input * @param createdBy - User ID who created the pod * @returns Operation result with pod and scheduling result */ createAndSchedule(input: CreatePodInput, createdBy: string): PodOperationResult<{ pod: Pod; scheduling: SchedulingResult; }>; /** * Schedule a pending pod to an appropriate node * @param podId - Pod ID to schedule * @returns Scheduling result */ schedule(podId: string): PodOperationResult; /** * Schedule all pending pods * @returns Array of scheduling results */ scheduleAll(): SchedulingResult[]; /** * Check if a pack is compatible with a node's runtime * @param packRuntimeTag - Pack's runtime tag * @param nodeRuntimeType - Node's runtime type * @returns true if compatible */ checkRuntimeCompatibility(packRuntimeTag: RuntimeTag, nodeRuntimeType: RuntimeType): boolean; /** * Get the compatible runtime type for a pack * For universal packs, prefer 'node' runtime * @param runtimeTag - Pack's runtime tag * @returns Preferred runtime type */ private getCompatibleRuntimeType; /** * Filter nodes that can accept the pod */ private filterSchedulableNodes; /** * Score nodes for pod placement */ private scoreNodes; /** * Calculate pod affinity/anti-affinity score for a node */ private calculatePodAffinityScore; /** * Select the best node from scored nodes */ private selectNode; /** * Check if a pod is allowed to preempt other pods based on its priority class preemption policy. * @param pod - The pod that wants to preempt * @returns true if the pod can preempt, false if it has 'Never' preemption policy */ private canPodPreempt; /** * Attempt to preempt lower-priority pods to make room for a higher-priority pod */ private attemptPreemption; /** * Resolve priority from priority class name */ private resolvePriority; /** * Start a scheduled pod * @param podId - Pod ID * @returns Updated pod */ start(podId: string): PodOperationResult; /** * Mark pod as running * @param podId - Pod ID * @returns Updated pod */ setRunning(podId: string): PodOperationResult; /** * Stop a running pod * @param podId - Pod ID * @returns Updated pod */ stop(podId: string): PodOperationResult; /** * Mark pod as stopped * @param podId - Pod ID * @returns Updated pod */ setStopped(podId: string): PodOperationResult; /** * Mark pod as failed * @param podId - Pod ID * @param reason - Failure reason * @returns Updated pod */ fail(podId: string, reason?: string): PodOperationResult; /** * Evict a pod * @param podId - Pod ID * @param reason - Eviction reason * @returns Updated pod */ evict(podId: string, reason?: string): PodOperationResult; /** * Fail all active pods on a node * Used when a node goes offline, becomes unhealthy, or is deleted * @param nodeId - The node ID * @param reason - Reason for failing the pods (e.g., 'Node went offline') * @returns Result with count of pods failed and their IDs */ failPodsOnNode(nodeId: string, reason: string): PodOperationResult<{ failedCount: number; podIds: string[]; }>; /** * Rollback a pod to a different version of the same pack * @param podId - Pod ID * @param targetVersion - Target pack version to rollback to * @returns Rollback result with previous and new versions */ rollback(podId: string, targetVersion: string): PodOperationResult; /** * Delete a pod * @param podId - Pod ID * @returns true if deleted */ delete(podId: string): PodOperationResult; /** * Get a pod by ID * @param podId - Pod ID * @returns Pod or undefined */ get(podId: string): Pod | undefined; /** * Get a pod model by ID * @param podId - Pod ID * @returns PodModel or undefined */ getModel(podId: string): PodModel | undefined; /** * List pods with optional filters * @param filters - Optional filters * @returns Paginated pod list */ list(filters?: PodListFilters): PodListResponse; /** * Find pods by pack ID * @param packId - Pack ID * @returns Array of pods */ findByPack(packId: string): Pod[]; /** * Find pods by node ID * @param nodeId - Node ID * @returns Array of pods */ findByNode(nodeId: string): Pod[]; /** * Find pods by namespace * @param namespace - Namespace * @returns Array of pods */ findByNamespace(namespace: string): Pod[]; /** * Find pods by status * @param status - Pod status * @returns Array of pods */ findByStatus(status: PodStatus): Pod[]; /** * Get pending pods sorted by priority * @returns Array of pending pods */ getPendingByPriority(): Pod[]; /** * Get pod history * @param podId - Pod ID * @returns Array of history entries */ getHistory(podId: string): PodHistoryEntry[]; } /** * Default pod scheduler instance */ declare const podScheduler: PodScheduler; /** * Create a new pod scheduler with custom options */ declare function createPodScheduler(options?: PodSchedulerOptions): PodScheduler; /** * Node manager service * Handles node registration, heartbeat processing, and health status * @module @stark-o/core/services/node-manager */ /** * Callback when a node becomes unhealthy */ type OnNodeUnhealthyCallback = (nodeId: string, nodeName: string) => void | Promise; /** * Node manager options */ interface NodeManagerOptions { /** Heartbeat timeout in milliseconds (default: 30000) */ heartbeatTimeoutMs?: number; /** Heartbeat check interval in milliseconds (default: 10000) */ heartbeatCheckIntervalMs?: number; /** Enable automatic heartbeat monitoring */ enableHeartbeatMonitoring?: boolean; /** Callback when a node becomes unhealthy (e.g., to fail pods) */ onNodeUnhealthy?: OnNodeUnhealthyCallback; } /** * Node operation result */ interface NodeOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Node connection info for WebSocket registration */ interface NodeConnectionInfo { connectionId?: string; ipAddress?: string; userAgent?: string; } /** * Heartbeat check result */ interface HeartbeatCheckResult { /** Number of nodes checked */ checked: number; /** Number of nodes marked unhealthy */ markedUnhealthy: number; /** IDs of nodes marked unhealthy */ unhealthyNodeIds: string[]; } /** * Node manager error codes */ declare const NodeManagerErrorCodes: { readonly VALIDATION_ERROR: "VALIDATION_ERROR"; readonly NODE_EXISTS: "NODE_EXISTS"; readonly NODE_NOT_FOUND: "NODE_NOT_FOUND"; readonly INVALID_STATUS_TRANSITION: "INVALID_STATUS_TRANSITION"; readonly HEARTBEAT_TIMEOUT: "HEARTBEAT_TIMEOUT"; readonly CONNECTION_REQUIRED: "CONNECTION_REQUIRED"; readonly UNAUTHORIZED: "UNAUTHORIZED"; }; /** * Node Manager Service * Manages node lifecycle: registration, heartbeat processing, health status, and deregistration */ declare class NodeManager { private readonly heartbeatTimeoutMs; private readonly heartbeatCheckIntervalMs; private readonly enableHeartbeatMonitoring; private readonly onNodeUnhealthy?; private heartbeatCheckTimer; constructor(options?: NodeManagerOptions); /** * Total number of nodes */ get totalNodes(): ComputedRef; /** * Number of online nodes */ get onlineNodes(): ComputedRef; /** * Nodes grouped by runtime type */ get byRuntime(): ComputedRef>; /** * Nodes grouped by status */ get byStatus(): ComputedRef>; /** * Register a new node * @param input - Node registration input * @param registeredBy - User ID who is registering the node * @param connectionInfo - Optional WebSocket connection info * @returns Registration result with node data */ register(input: RegisterNodeInput, registeredBy: string, connectionInfo?: NodeConnectionInfo): NodeOperationResult; /** * Re-register an existing node (reconnection scenario) * Updates connection info and sets status to online */ reconnect(nodeId: string, connectionInfo: NodeConnectionInfo): NodeOperationResult<{ node: Node; }>; /** * Process a heartbeat from a node * @param heartbeat - Heartbeat payload * @returns Updated node or error */ processHeartbeat(heartbeat: NodeHeartbeat): NodeOperationResult<{ node: Node; }>; /** * Check all nodes for heartbeat timeout and mark stale nodes as unhealthy * @returns Result with count of nodes marked unhealthy */ checkHeartbeats(): HeartbeatCheckResult; /** * Start automatic heartbeat monitoring */ startHeartbeatMonitoring(): void; /** * Stop automatic heartbeat monitoring */ stopHeartbeatMonitoring(): void; /** * Get a node by ID */ getNode(nodeId: string): NodeOperationResult<{ node: Node; }>; /** * Get a node by name */ getNodeByName(name: string): NodeOperationResult<{ node: Node; }>; /** * Update node status */ updateStatus(nodeId: string, status: NodeStatus): NodeOperationResult<{ node: Node; }>; /** * Mark node as offline (disconnected) */ disconnect(nodeId: string): NodeOperationResult<{ node: Node; }>; /** * Drain a node (prevent new pods, prepare for maintenance) */ drain(nodeId: string): NodeOperationResult<{ node: Node; }>; /** * Put node in maintenance mode */ setMaintenance(nodeId: string): NodeOperationResult<{ node: Node; }>; /** * Make node schedulable again (uncordon) */ uncordon(nodeId: string): NodeOperationResult<{ node: Node; }>; /** * Update node labels */ updateLabels(nodeId: string, labels: Labels): NodeOperationResult<{ node: Node; }>; /** * Set all labels on a node (replaces existing labels) */ setLabels(nodeId: string, labels: Labels): NodeOperationResult<{ node: Node; }>; /** * Add a label to a node */ addLabel(nodeId: string, key: string, value: string): NodeOperationResult<{ node: Node; }>; /** * Remove a label from a node */ removeLabel(nodeId: string, key: string): NodeOperationResult<{ node: Node; }>; /** * Update node taints */ updateTaints(nodeId: string, taints: Taint[]): NodeOperationResult<{ node: Node; }>; /** * Add a taint to a node */ addTaint(nodeId: string, taint: Taint): NodeOperationResult<{ node: Node; }>; /** * Remove a taint from a node */ removeTaint(nodeId: string, key: string, effect?: string): NodeOperationResult<{ node: Node; }>; /** * Allocate resources on a node */ allocateResources(nodeId: string, cpu: number, memory: number): NodeOperationResult<{ node: Node; }>; /** * Release resources on a node */ releaseResources(nodeId: string, cpu: number, memory: number): NodeOperationResult<{ node: Node; }>; /** * List nodes with optional filters */ list(filters?: NodeListFilters): NodeListResponse; /** * Find nodes by label selector */ findBySelector(selector: LabelSelector): NodeOperationResult<{ nodes: Node[]; }>; /** * Find nodes by runtime type */ findByRuntime(runtimeType: RuntimeType): Node[]; /** * Get schedulable nodes for a runtime type */ getSchedulableNodes(runtimeType: RuntimeType): Node[]; /** * Check if any nodes are available */ hasAvailableNodes(): boolean; /** * Deregister (remove) a node */ deregister(nodeId: string, requesterId?: string): NodeOperationResult<{ removed: boolean; }>; /** * Stop all background processes and clean up */ dispose(): void; } /** * Default node manager instance */ declare const nodeManager: NodeManager; /** * Create a new node manager instance with custom options */ declare function createNodeManager(options?: NodeManagerOptions): NodeManager; /** * Auth service wrapping Supabase Auth * Handles user authentication, session management, and authorization * @module @stark-o/core/services/auth */ /** * Auth provider interface for dependency injection * This allows the core package to remain isomorphic while the server * provides the actual Supabase implementation */ interface AuthProvider { /** Register a new user */ registerUser(input: RegisterAuthInput): Promise>; /** Login an existing user */ loginUser(credentials: LoginAuthInput): Promise>; /** Logout the current user */ logoutUser(accessToken: string): Promise>; /** Refresh the session token */ refreshSession(refreshToken: string): Promise>; /** Get user by ID */ getUserById(userId: string): Promise>; /** Verify an access token */ verifyToken(accessToken: string): Promise>; /** Update user profile */ updateUser(userId: string, updates: UpdateAuthInput): Promise>; /** Delete user account */ deleteUser(userId: string): Promise>; } /** * Auth provider result */ interface AuthProviderResult { data: T | null; error: AuthProviderError | null; } /** * Auth provider error */ interface AuthProviderError { code: string; message: string; details?: Record; } /** * Registration input for auth provider */ interface RegisterAuthInput { email: string; password: string; displayName?: string; roles?: UserRole[]; } /** * Login input for auth provider */ interface LoginAuthInput { email: string; password: string; } /** * Update user input for auth provider */ interface UpdateAuthInput { displayName?: string; roles?: UserRole[]; } /** * Auth service options */ interface AuthServiceOptions { /** Auth provider (Supabase implementation) */ provider?: AuthProvider; /** Session timeout in milliseconds */ sessionTimeoutMs?: number; /** Session refresh threshold in milliseconds */ sessionRefreshThresholdMs?: number; /** Enable automatic session refresh */ enableAutoRefresh?: boolean; /** Auto refresh interval in milliseconds */ autoRefreshIntervalMs?: number; } /** * Auth operation result */ interface AuthOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Session state for tracking current user */ interface SessionState { /** Current session model */ session: UserSessionModel | null; /** Whether user is authenticated */ isAuthenticated: boolean; /** Whether session is being refreshed */ isRefreshing: boolean; /** Last activity timestamp */ lastActivity: Date | null; } /** * Auth service error codes */ declare const AuthServiceErrorCodes: { readonly VALIDATION_ERROR: "VALIDATION_ERROR"; readonly USER_ALREADY_EXISTS: "USER_ALREADY_EXISTS"; readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS"; readonly USER_NOT_FOUND: "USER_NOT_FOUND"; readonly SESSION_EXPIRED: "SESSION_EXPIRED"; readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND"; readonly REFRESH_FAILED: "REFRESH_FAILED"; readonly PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED"; readonly UNAUTHORIZED: "UNAUTHORIZED"; readonly FORBIDDEN: "FORBIDDEN"; readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED"; readonly ACCOUNT_LOCKED: "ACCOUNT_LOCKED"; readonly INTERNAL_ERROR: "INTERNAL_ERROR"; }; /** * Password validation requirements */ interface PasswordRequirements { minLength: number; requireUppercase: boolean; requireLowercase: boolean; requireDigit: boolean; requireSpecialChar: boolean; } /** * Default password requirements */ declare const DEFAULT_PASSWORD_REQUIREMENTS: PasswordRequirements; /** * Validation error detail */ interface ValidationErrorDetail { code: string; message: string; } /** * Validation result */ interface ValidationResult { valid: boolean; errors: Record; } /** * Validate email format */ declare function validateEmail(email: unknown): ValidationErrorDetail | null; /** * Validate password against requirements */ declare function validatePassword(password: unknown, requirements?: PasswordRequirements): ValidationErrorDetail | null; /** * Validate display name */ declare function validateDisplayName(displayName: unknown): ValidationErrorDetail | null; /** * Validate registration input */ declare function validateRegisterInput(input: unknown): ValidationResult; /** * Validate login input */ declare function validateLoginInput(input: unknown): ValidationResult; /** * Normalize email (trim, lowercase) */ declare function normalizeEmail(email: string): string; /** * Auth Service * Manages user authentication, session lifecycle, and authorization */ declare class AuthService { private provider; private readonly enableAutoRefresh; private readonly autoRefreshIntervalMs; private autoRefreshTimer; private readonly _currentSession; private readonly _isRefreshing; private readonly _lastActivity; constructor(options?: AuthServiceOptions); /** * Current session (reactive) */ get currentSession(): ComputedRef; /** * Current user (reactive) */ get currentUser(): ComputedRef; /** * Whether user is authenticated (reactive) */ get isAuthenticated(): ComputedRef; /** * Whether session is being refreshed (reactive) */ get isRefreshing(): ComputedRef; /** * Whether session should be refreshed soon (reactive) */ get shouldRefreshSession(): ComputedRef; /** * Time remaining until session expires in milliseconds (reactive) */ get sessionTimeRemaining(): ComputedRef; /** * Current user ID (reactive) */ get currentUserId(): ComputedRef; /** * Current user roles (reactive) */ get currentUserRoles(): ComputedRef; /** * Whether current user is admin (reactive) */ get isAdmin(): ComputedRef; /** * Whether current user can manage resources (reactive) */ get canManageResources(): ComputedRef; /** * Whether current user is a node agent (reactive) */ get isNodeAgent(): ComputedRef; /** * Set the auth provider * @param provider - The auth provider implementation */ setProvider(provider: AuthProvider): void; /** * Check if provider is configured */ hasProvider(): boolean; /** * Register a new user * @param input - Registration input (email, password, displayName) * @returns Registration result with session */ register(input: RegisterAuthInput): Promise>; /** * Login an existing user * @param credentials - Login credentials (email, password) * @returns Login result with session */ login(credentials: LoginAuthInput): Promise>; /** * Logout the current user * @returns Logout result */ logout(): Promise>; /** * Refresh the current session * @returns Refresh result */ refreshSession(): Promise>; /** * Initialize session from stored tokens * @param session - Stored session data * @returns Whether session was restored successfully */ restoreSession(session: UserSession): boolean; /** * Clear the current session without calling provider */ clearSession(): void; /** * Get user by ID * @param userId - User ID * @returns User or error */ getUser(userId: string): Promise>; /** * Verify an access token * @param accessToken - Access token to verify * @returns User from token or error */ verifyToken(accessToken: string): Promise>; /** * Check if current user has a specific role * @param role - Role to check */ hasRole(role: UserRole): boolean; /** * Check if current user has any of the specified roles * @param roles - Roles to check */ hasAnyRole(roles: UserRole[]): boolean; /** * Assert that user is authenticated * @throws AuthOperationResult with error if not authenticated */ requireAuthentication(): AuthOperationResult; /** * Assert that user has required role * @param role - Required role */ requireRole(role: UserRole): AuthOperationResult; /** * Assert that user has any of the required roles * @param roles - Required roles (any) */ requireAnyRole(roles: UserRole[]): AuthOperationResult; /** * Record user activity (extends session) */ recordActivity(): void; /** * Get last activity timestamp */ getLastActivity(): Date | null; /** * Start automatic session refresh */ private startAutoRefresh; /** * Stop automatic session refresh */ private stopAutoRefresh; /** * Map provider error to operation result */ private mapProviderError; /** * Destroy the auth service and clean up resources */ destroy(): void; } /** * Default auth service instance */ declare const authService: AuthService; /** * Create a new auth service with custom options */ declare function createAuthService(options?: AuthServiceOptions): AuthService; /** * Namespace manager service * Handles namespace CRUD, quota enforcement, and resource management * @module @stark-o/core/services/namespace-manager */ /** * Namespace manager options */ interface NamespaceManagerOptions { /** Initialize default namespaces on startup */ initializeDefaults?: boolean; } /** * Namespace operation result */ interface NamespaceOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Quota check result */ interface QuotaCheckResult { allowed: boolean; namespace: string; requested: ResourceAllocationRequest; remaining: ResourceQuotaHard | null; exceededResources?: string[]; } /** * Namespace manager error codes */ declare const NamespaceManagerErrorCodes: { readonly VALIDATION_ERROR: "VALIDATION_ERROR"; readonly NAMESPACE_EXISTS: "NAMESPACE_EXISTS"; readonly NAMESPACE_NOT_FOUND: "NAMESPACE_NOT_FOUND"; readonly RESERVED_NAMESPACE: "RESERVED_NAMESPACE"; readonly NAMESPACE_TERMINATING: "NAMESPACE_TERMINATING"; readonly QUOTA_EXCEEDED: "QUOTA_EXCEEDED"; readonly NAMESPACE_NOT_EMPTY: "NAMESPACE_NOT_EMPTY"; readonly CANNOT_DELETE_DEFAULT: "CANNOT_DELETE_DEFAULT"; readonly INVALID_PHASE_TRANSITION: "INVALID_PHASE_TRANSITION"; }; /** * Total number of namespaces */ declare const namespaceCount: ComputedRef; /** * Number of active namespaces */ declare const activeNamespaceCount: ComputedRef; /** * Namespaces grouped by phase */ declare const namespacesByPhase: ComputedRef>; /** * Namespaces with quotas */ declare const namespacesWithQuota: ComputedRef; /** * Total resource usage across all namespaces */ declare const totalResourceUsage: ComputedRef; /** * Find namespace by name */ declare function findNamespaceByName(name: string): Namespace | undefined; /** * Find namespaces by label selector */ declare function findNamespacesBySelector(selector: Labels): Namespace[]; /** * Find namespaces by phase */ declare function findNamespacesByPhase(phase: NamespacePhase): Namespace[]; /** * Check if a namespace exists */ declare function namespaceExists(name: string): boolean; /** * Namespace Manager Service * Manages namespace lifecycle: creation, update, deletion, and quota enforcement */ declare class NamespaceManager { private readonly initializeDefaults; private initialized; constructor(options?: NamespaceManagerOptions); /** * Total number of namespaces */ get total(): ComputedRef; /** * Number of active namespaces */ get activeCount(): ComputedRef; /** * Namespaces grouped by phase */ get byPhase(): ComputedRef>; /** * Namespaces with quotas */ get withQuota(): ComputedRef; /** * Total resource usage */ get totalUsage(): ComputedRef; /** * Initialize the namespace manager * Creates default namespaces if configured */ initialize(): void; /** * Ensure default namespaces exist */ ensureDefaultNamespaces(): void; /** * Create a new namespace * @param input - Namespace creation input * @param createdBy - User ID who is creating the namespace * @returns Creation result with namespace data */ create(input: CreateNamespaceInput, createdBy?: string): NamespaceOperationResult; /** * Get a namespace by name * @param name - Namespace name * @returns Namespace or error */ get(name: string): NamespaceOperationResult<{ namespace: Namespace; }>; /** * List namespaces with optional filtering * @param filters - Optional filters * @returns List of namespaces with pagination */ list(filters?: NamespaceListFilters): NamespaceListResponse; /** * Update a namespace * @param name - Namespace name * @param input - Update input * @returns Updated namespace or error */ update(name: string, input: UpdateNamespaceInput): NamespaceOperationResult<{ namespace: Namespace; }>; /** * Delete a namespace * @param name - Namespace name * @param force - Force deletion even if not empty * @returns Success or error */ delete(name: string, force?: boolean): NamespaceOperationResult<{ name: string; }>; /** * Mark a namespace as terminating (soft delete) * @param name - Namespace name * @returns Success or error */ markTerminating(name: string): NamespaceOperationResult<{ namespace: Namespace; }>; /** * Check if resources can be allocated within namespace quota * @param namespaceName - Namespace name * @param required - Required resources * @returns Quota check result */ checkQuota(namespaceName: string, required: ResourceAllocationRequest): NamespaceOperationResult; /** * Allocate resources in a namespace * Increases resource usage counters * @param namespaceName - Namespace name * @param resources - Resources to allocate * @returns Success or quota exceeded error */ allocateResources(namespaceName: string, resources: ResourceAllocationRequest): NamespaceOperationResult<{ namespace: Namespace; }>; /** * Release resources in a namespace * Decreases resource usage counters * @param namespaceName - Namespace name * @param resources - Resources to release * @returns Updated namespace */ releaseResources(namespaceName: string, resources: ResourceAllocationRequest): NamespaceOperationResult<{ namespace: Namespace; }>; /** * Get remaining quota for a namespace * @param namespaceName - Namespace name * @returns Remaining quota or null if no quota */ getRemainingQuota(namespaceName: string): NamespaceOperationResult<{ remaining: ResourceQuotaHard | null; }>; /** * Update resource usage for a namespace * Directly sets resource usage values (for syncing with actual state) * @param namespaceName - Namespace name * @param usage - New usage values * @returns Updated namespace */ updateResourceUsage(namespaceName: string, usage: Partial): NamespaceOperationResult<{ namespace: Namespace; }>; /** * Get limit range for a namespace * @param namespaceName - Namespace name * @returns Limit range or undefined */ getLimitRange(namespaceName: string): NamespaceOperationResult<{ limitRange: LimitRange | undefined; }>; /** * Apply limit range defaults to pod resources * @param namespaceName - Namespace name * @param requests - Pod resource requests * @param limits - Pod resource limits * @returns Resolved requests and limits */ applyLimitRangeDefaults(namespaceName: string, requests?: { cpu?: number; memory?: number; }, limits?: { cpu?: number; memory?: number; }): NamespaceOperationResult<{ requests: { cpu?: number; memory?: number; }; limits: { cpu?: number; memory?: number; }; }>; /** * Validate pod resources against namespace limit range * @param namespaceName - Namespace name * @param requests - Pod resource requests * @param limits - Pod resource limits * @returns Validation result */ validateLimitRange(namespaceName: string, requests: { cpu?: number; memory?: number; }, limits: { cpu?: number; memory?: number; }): NamespaceOperationResult<{ valid: boolean; errors: string[]; }>; /** * Find namespaces by label selector * @param selector - Label selector * @returns Matching namespaces */ findBySelector(selector: Labels): Namespace[]; /** * Find namespaces by phase * @param phase - Phase to filter by * @returns Matching namespaces */ findByPhase(phase: NamespacePhase): Namespace[]; /** * Check if a namespace exists * @param name - Namespace name * @returns True if exists */ exists(name: string): boolean; /** * Get the default namespace * @returns Default namespace or undefined */ getDefault(): Namespace | undefined; /** * Get namespace or default * Returns the specified namespace, or 'default' if not found * @param name - Namespace name (optional) * @returns Namespace */ getOrDefault(name?: string): Namespace | undefined; } /** * Default namespace manager instance */ declare const namespaceManager: NamespaceManager; /** * Create a new namespace manager with custom options */ declare function createNamespaceManager(options?: NamespaceManagerOptions): NamespaceManager; /** * Secret Manager Service * * Orchestrates secret lifecycle: creation, update, deletion, rotation, * and pod injection. This is the single authority for secrets — all * access goes through here. * * Security invariants enforced: * - Plaintext data is never stored; always encrypted at rest. * - Plaintext is never returned in operation results. * - Plaintext is never logged. * - Resolved material is short-lived and wiped after use. * - Mount path conflicts are validated before pod scheduling. * * @module @stark-o/core/services/secret-manager */ /** * Operation result following the same pattern as other Stark services */ interface SecretOperationResult { success: boolean; data?: T; error?: { code: string; message: string; details?: Record; }; } /** * Secret manager options */ interface SecretManagerOptions { /** Master encryption key (if not set, reads from env or generates ephemeral) */ masterKey?: string; /** Default namespace for secrets */ defaultNamespace?: string; } /** * Error codes for secret operations */ declare const SecretManagerErrorCodes: { readonly VALIDATION_FAILED: "VALIDATION_FAILED"; readonly SECRET_EXISTS: "SECRET_EXISTS"; readonly SECRET_NOT_FOUND: "SECRET_NOT_FOUND"; readonly DECRYPTION_FAILED: "DECRYPTION_FAILED"; readonly MOUNT_PATH_CONFLICT: "MOUNT_PATH_CONFLICT"; readonly MISSING_SECRETS: "MISSING_SECRETS"; readonly INTERNAL_ERROR: "INTERNAL_ERROR"; }; declare class SecretManager { private readonly defaultNamespace; constructor(options?: SecretManagerOptions); /** * Create a new secret. * * 1. Validates input (name, type, data shape, injection config) * 2. Checks for name uniqueness within namespace * 3. Encrypts plaintext data with AES-256-GCM * 4. Stores the encrypted resource * 5. Returns metadata only (no plaintext) */ create(input: CreateSecretInput, createdBy?: string): SecretOperationResult; /** * Update an existing secret's data and/or injection configuration. * * When data is updated: * - Version is bumped * - New data is re-encrypted with a fresh IV * - Returns updated metadata * * The caller (scheduler) is responsible for triggering pod rotation * after a successful data update. */ update(nameOrId: string, input: UpdateSecretInput, namespace?: string): SecretOperationResult; /** * Delete a secret. * Returns true if deleted, false if not found. */ delete(nameOrId: string, namespace?: string): SecretOperationResult; /** * Get a secret's metadata (safe — no plaintext). */ get(nameOrId: string, namespace?: string): SecretOperationResult; /** * List secrets (safe — no plaintext). */ list(namespace?: string): SecretOperationResult; /** * Resolve secrets for a pod. * * Given a list of secret names (from service spec), this method: * 1. Validates all names exist in the namespace * 2. Checks for mount path conflicts among volume-mode secrets * 3. Decrypts each secret * 4. Computes environment variables and volume mounts * 5. Returns a PodSecretPayload ready for injection * * The returned payload is TRANSIENT — the caller must discard it * after injecting into the pod process. * * @param secretNames — list of secret names from service spec * @param namespace — pod namespace * @returns Resolved env vars and volume mounts, or an error */ resolveForPod(secretNames: string[], namespace?: string): SecretOperationResult; /** * Find a secret by name or ID, optionally scoped to a namespace. */ private findSecret; /** * Build a PodSecretPayload from resolved materials. */ private buildPayload; } /** * Default singleton instance. * Initialize with `createSecretManager()` for custom options. */ declare let secretManager: SecretManager; /** * Create and replace the singleton SecretManager. */ declare function createSecretManager(options?: SecretManagerOptions): SecretManager; /** * Reset secret manager and store (for testing). */ declare function resetSecretManager(): void; /** * Secret encryption utilities for Stark Orchestrator * * Provides AES-256-GCM encryption/decryption for secret data at rest. * Uses Node.js built-in crypto module (isomorphic via webcrypto in browsers). * * Security design: * - AES-256-GCM authenticated encryption (confidentiality + integrity) * - Random 96-bit IV per encryption operation (never reused) * - Master key derived from environment variable or generated on first use * - Plaintext is wiped from buffers after use where practical * * Future: The master key strategy can be swapped for KMS, Vault, or * hardware-backed key stores without changing the encryption interface. * * @module @stark-o/core/services/secret-crypto */ /** * Encryption result */ interface EncryptionResult { /** Base64-encoded ciphertext */ ciphertext: string; /** Base64-encoded initialization vector */ iv: string; /** Base64-encoded authentication tag */ authTag: string; } /** * Initialize the master encryption key. * * Call once at orchestrator startup. The key can come from: * - Environment variable STARK_MASTER_KEY * - A file on disk (future) * - A KMS call (future) * * If no key is provided, generates a random one (ephemeral — secrets * won't survive restarts; suitable for development). * * @param key — raw master key string. If omitted, reads STARK_MASTER_KEY * from environment or generates a random ephemeral key. */ declare function initMasterKey(key?: string): void; /** * Reset the master key (for testing purposes only). * @internal */ declare function resetMasterKey(): void; /** * Encrypt a plaintext Record to a sealed blob. * * @param data — plaintext key-value pairs * @returns EncryptionResult with ciphertext, iv, and authTag (all base64) */ declare function encryptSecretData(data: Record): EncryptionResult; /** * Decrypt sealed secret data back to plaintext key-value pairs. * * @param ciphertext — base64-encoded ciphertext * @param iv — base64-encoded initialization vector * @param authTag — base64-encoded authentication tag * @returns Decrypted plaintext data * @throws Error if decryption fails (tampered data, wrong key, etc.) */ declare function decryptSecretData(ciphertext: string, iv: string, authTag: string): Record; /** * Wipe a resolved secret material object from memory. * Overwrites string values with empty strings. * * Note: JavaScript string immutability means we can't truly zero * the original strings, but we can remove all references so GC * can reclaim the memory. This is the best-effort approach in JS. * * @param material — object with a `data` field to wipe */ declare function wipeSecretMaterial(material: { data: Record; }): void; /** * Node Query Functions * * Provides query functions for nodes that can be used by chaos scenarios * and other services. These wrap the reactive store functions. * @module @stark-o/core/queries/node-queries */ /** * Get a node by ID */ declare function getNodeById(nodeId: string): Promise; /** * Get a node by name */ declare function getNodeByName(name: string): Promise; /** * List all nodes with optional filters */ declare function listNodes(options?: { limit?: number; status?: string; runtime?: string; }): Promise; /** * Find nodes by label selector */ declare function findNodesByLabelSelector(selector: Partial): Promise; /** * Find nodes by runtime */ declare function findNodesByRuntimeType(runtime: RuntimeType): Promise; /** * Get schedulable nodes for a runtime */ declare function getSchedulableNodes(runtime: RuntimeType): Promise; /** * Check if any nodes are available */ declare function hasAvailable(): Promise; /** * Get stale nodes (not heartbeating) */ declare function getStale(thresholdMs?: number): Promise; /** * Consolidated node queries export */ declare const nodeQueries: { getNodeById: typeof getNodeById; getNodeByName: typeof getNodeByName; listNodes: typeof listNodes; findBySelector: typeof findNodesByLabelSelector; findByRuntime: typeof findNodesByRuntimeType; getSchedulableNodes: typeof getSchedulableNodes; hasAvailable: typeof hasAvailable; getStale: typeof getStale; }; /** * Pod Query Functions * * Provides query functions for pods that can be used by chaos scenarios * and other services. These wrap the reactive store functions. * @module @stark-o/core/queries/pod-queries */ /** * Get a pod by ID */ declare function getPodById(podId: string): Promise; /** * List pods with optional filters */ declare function listPods(options?: { limit?: number; status?: PodStatus; namespace?: string; nodeId?: string; serviceId?: string; }): Promise; /** * Find pods by label selector */ declare function findPodsByLabelSelector(selector: LabelSelector): Promise; /** * Find pods by pack */ declare function findByPack(packId: string): Promise; /** * Find pods by node */ declare function findByNode(nodeId: string): Promise; /** * Find pods by namespace */ declare function findByNamespace(namespace: string): Promise; /** * Find pods by status */ declare function findByStatus(status: PodStatus): Promise; /** * Get pending pods sorted by priority */ declare function getPendingByPriority(): Promise; /** * Get evictable pods on a node */ declare function getEvictableOnNode(nodeId: string): Promise; /** * Create a new pod from a specification */ declare function createPodFromSpec(podSpec: { packId: string; name?: string; namespace?: string; resourceRequests?: { cpu?: number; memory?: number; }; labels?: Record; }): Promise; /** * Update pod status */ declare function updatePodStatus(podId: string, status: PodStatus, details?: { terminatedAt?: Date; terminationReason?: string; terminationMessage?: string; }): Promise; /** * Remove a pod */ declare function deletePod(podId: string): Promise; /** * Consolidated pod queries export */ declare const podQueries: { getPodById: typeof getPodById; listPods: typeof listPods; findBySelector: typeof findPodsByLabelSelector; findByPack: typeof findByPack; findByNode: typeof findByNode; findByNamespace: typeof findByNamespace; findByStatus: typeof findByStatus; getPendingByPriority: typeof getPendingByPriority; getEvictableOnNode: typeof getEvictableOnNode; createPod: typeof createPodFromSpec; updatePodStatus: typeof updatePodStatus; deletePod: typeof deletePod; }; /** * Pack Query Functions * * Provides query functions for packs that can be used by chaos scenarios * and other services. These wrap the reactive store functions. * @module @stark-o/core/queries/pack-queries */ /** * Get a pack by ID */ declare function getPackById(packId: string): Promise; /** * List packs with optional filters */ declare function listPacks(options?: { limit?: number; ownerId?: string; runtime?: string; }): Promise; /** * Find pack by name and version */ declare function findByNameVersion(name: string, version: string): Promise; /** * Get all versions of a pack */ declare function getVersions(packName: string): Promise; /** * Get version summaries for a pack */ declare function getVersionSummaries(packName: string): Promise>; /** * Get the latest version of a pack */ declare function getLatestVersion(packName: string): Promise; /** * Find packs by owner */ declare function findByOwner(ownerId: string): Promise; /** * Find packs by runtime */ declare function findPacksByRuntimeTag(runtime: RuntimeTag): Promise; /** * Find packs compatible with a runtime type */ declare function findCompatibleWith(runtimeType: 'node' | 'browser'): Promise; /** * Search packs by name */ declare function searchByName(query: string): Promise; /** * Check if a pack version exists */ declare function versionExists(name: string, version: string): Promise; /** * Check if a pack exists */ declare function exists(name: string): Promise; /** * Consolidated pack queries export */ declare const packQueries: { getPackById: typeof getPackById; listPacks: typeof listPacks; findByNameVersion: typeof findByNameVersion; getVersions: typeof getVersions; getVersionSummaries: typeof getVersionSummaries; getLatestVersion: typeof getLatestVersion; findByOwner: typeof findByOwner; findByRuntime: typeof findPacksByRuntimeTag; findCompatibleWith: typeof findCompatibleWith; searchByName: typeof searchByName; versionExists: typeof versionExists; exists: typeof exists; }; /** * Service Query Functions * * Provides query functions for services that can be used by chaos scenarios * and other services. * @module @stark-o/core/queries/service-queries */ /** * Chaos service status type (extended for testing scenarios) * This extends the shared ServiceStatus with additional states for chaos testing */ type ChaosServiceStatus = ServiceStatus | 'pending' | 'progressing' | 'available' | 'failed'; /** * Extended service info */ interface ServiceInfo { id: string; name: string; namespace: string; packId: string; replicas: number; availableReplicas: number; status: ChaosServiceStatus; createdAt: Date; updatedAt: Date; } /** * Get a service by ID */ declare function getServiceById(serviceId: string): Promise; /** * List services with optional filters */ declare function listServices(options?: { limit?: number; namespace?: string; status?: ChaosServiceStatus; }): Promise; /** * Create a new service */ declare function createService(spec: { name: string; packId: string; namespace?: string; replicas?: number; }): Promise; /** * Update a service */ declare function updateService(serviceId: string, updates: Partial<{ packId: string; replicas: number; status: ChaosServiceStatus; }>): Promise; /** * Delete a service */ declare function deleteService(serviceId: string): Promise; /** * Get pods for a service */ declare function getServicePods(serviceId: string): Promise; /** * Consolidated service queries export */ declare const serviceQueries: { getServiceById: typeof getServiceById; listServices: typeof listServices; createService: typeof createService; updateService: typeof updateService; deleteService: typeof deleteService; getServicePods: typeof getServicePods; }; /** * Cluster Query Functions * * Provides query functions for cluster-wide operations. * @module @stark-o/core/queries/cluster-queries */ /** * Get cluster statistics */ declare function getClusterStats(): Promise; /** * Get cluster health */ declare function getClusterHealth(): Promise; /** * Check if cluster is healthy */ declare function checkClusterHealthy(): Promise; /** * Get a node by ID */ declare function getClusterNodeById(nodeId: string): Promise; /** * Get a pod by ID */ declare function getClusterPodById(podId: string): Promise; /** * Get a pack by ID */ declare function getClusterPackById(packId: string): Promise; /** * Get a namespace by name */ declare function getNamespaceByName(name: string): Promise; /** * Get pods on a node */ declare function getPodsOnNodeById(nodeId: string): Promise; /** * Get pods in a namespace */ declare function getPodsInNamespaceByName(namespace: string): Promise; /** * Get pods for a pack */ declare function getPodsForPackById(packId: string): Promise; /** * Consolidated cluster queries export */ declare const clusterQueries: { getClusterStats: typeof getClusterStats; getClusterHealth: typeof getClusterHealth; checkClusterHealthy: typeof checkClusterHealthy; getNodeById: typeof getClusterNodeById; getPodById: typeof getClusterPodById; getPackById: typeof getClusterPackById; getNamespaceByName: typeof getNamespaceByName; getPodsOnNodeById: typeof getPodsOnNodeById; getPodsInNamespaceByName: typeof getPodsInNamespaceByName; getPodsForPackById: typeof getPodsForPackById; }; export { type AuthCredentials, type AuthOperationResult, type AuthProvider, type AuthProviderError, type AuthProviderResult, AuthService, AuthServiceErrorCodes, type AuthServiceOptions, type ChaosServiceStatus, type ClusterState, DEFAULT_PASSWORD_REQUIREMENTS, type EncryptionResult, HEARTBEAT_TIMEOUT_MS, type HeartbeatCheckResult, type LoginAuthInput, type NamespaceCreationResult, type NamespaceListFilters, type NamespaceListResponse, NamespaceManager, NamespaceManagerErrorCodes, type NamespaceManagerOptions, NamespaceModel, type NamespaceOperationResult, type NodeConnectionInfo, type NodeListFilters, type NodeListResponse, NodeManager, NodeManagerErrorCodes, type NodeManagerOptions, NodeModel, type NodeOperationResult, nodeQueries as NodeQueries, type NodeRegistrationResult, type OnNodeUnhealthyCallback, type PackListFilters, type PackListResponse, PackModel, type PackOperationResult, packQueries as PackQueries, type PackRegistrationOptions, type PackRegistrationResult, PackRegistry, type PasswordRequirements, type PodCreationResult, type PodListFilters, type PodListResponse, PodModel, podQueries as PodQueries, PodScheduler, PodSchedulerErrorCodes, type PodOperationResult as PodSchedulerOperationResult, type PodSchedulerOptions, type QuotaCheckResult, type RegisterAuthInput, type ResourceAllocationRequest, SESSION_REFRESH_THRESHOLD_MS, SESSION_TIMEOUT_MS, type SchedulingResult, type SecretCreationResult, type SecretListFilters, type SecretListResponse, SecretManager, SecretManagerErrorCodes, type SecretManagerOptions, SecretModel, type SecretOperationResult, type ServiceCreationResult, type ServiceInfo, type ServiceListFilters, type ServiceListResponse, ServiceModel, type SessionState, type UpdateAuthInput, type UserListFilters, type UserListResponse, type UserLoginResult, UserModel, type UserRegistrationResult, UserSessionModel, activeNamespaceCount, addHistoryEntry, addNode, addNodeLabel, addNodeTaint, addPodLabel, addSecret, allocateResources, authService, browserNodes, canNodeAcceptPods, checkClusterHealthy, clearError, clearPodHistory, clusterHealth, clusterQueries, clusterState, clusterStats, countActivePodsInNamespace, createAuthService, createNamespaceManager, createNodeManager, createPackRegistry, createPod, createPodFromSpec, createPodScheduler, createReactiveNamespaceListItem, createReactiveNodeListItem, createReactivePackListItem, createReactivePodListItem, createReactiveSecretListItem, createReactiveServiceListItem, createReactiveUserListItem, createSecretManager, createService, decryptSecretData, deletePod, deleteService, drainNode, encryptSecretData, evictPod, exists, failedPods, findByNameVersion, findByNamespace, findByNode, findByOwner, findByPack, findByStatus, findCompatibleWith, findNamespaceByName, findNamespacesByPhase, findNamespacesBySelector, findNodeByName, findNodesByLabelSelector, findNodesByRuntime, findNodesByRuntimeType, findNodesBySelector, findPackById, findPackByNameVersion, findPackVersions, findPacksByOwner, findPacksByRuntime, findPacksByRuntimeTag, findPacksCompatibleWith, findPodsByLabelSelector, findPodsByNamespace, findPodsByNode, findPodsByPack, findPodsBySelector, findPodsByStatus, findSecretById, findSecretByName, findSecretsByNamespace, findSecretsByType, getClusterHealth, getClusterNodeById, getClusterPackById, getClusterPodById, getClusterStats, getEvictableOnNode, getEvictablePodsOnNode, getLatestPackVersion, getLatestVersion, getNamespace, getNamespaceByName, getNextMajorVersion, getNextMinorVersion, getNextPatchVersion, getNode, getNodeById, getNodeByName, getPack, getPackById, getPackVersionSummaries, getPendingByPriority, getPendingPodsByPriority, getPod, getPodById, getPodHistory, getPodsForPack, getPodsForPackById, getPodsInNamespace, getPodsInNamespaceByName, getPodsOnNode, getPodsOnNodeById, getPriorityClass, getSchedulableNodes, getSchedulableNodesForRuntime, getSecretListItems, getServiceById, getServicePods, getStale, getStaleNodes, getVersionSummaries, getVersions, hasAvailable, hasAvailableNodes, healthyNodes, initMasterKey, initializeCluster, isClusterHealthy, isLoading, isValidVersion, lastError, listNodes, listPacks, listPods, listServices, markNodeOffline, markNodeUnhealthy, namespaceCount, namespaceExists, namespaceManager, namespacesByPhase, namespacesList, namespacesWithQuota, nodeCount, nodeJsNodes, nodeManager, nodeQueries, nodesByRuntime, nodesByStatus, nodesList, normalizeEmail, onlineNodeCount, packCount, packExists, packQueries, packRegistry, packVersionExists, packsByName, packsByOwner, packsByRuntime, packsList, pendingPodCount, pendingPods, podCount, podQueries, podScheduler, podsByNamespace, podsByNode, podsByStatus, podsList, processHeartbeat, registerPack, releaseResources, removeNode, removeNodeLabel, removeNodeTaint, removePack, removePackByName, removePod, removePodLabel, removeSecret, removeSecretByName, resetCluster, resetClusterState, resetMasterKey, resetSecretManager, resetSecretStore, resolveSecretNames, runningPodCount, runningPods, schedulableNodes, schedulePod, searchByName, searchPacksByName, secretCount, secretExists, secretManager, secretsByNamespace, secretsByType, secretsList, serviceQueries, setError, setLoading, setNodeLabels, setNodeMaintenance, setNodeStatus, setNodeTaints, setPodFailed, setPodLabels, setPodRunning, setPodStatus, setPodStopped, startPod, stopPod, toSecretListItem, totalResourceUsage, uncordonNode, unhealthyNodes, uniquePackCount, uniquePackNames, updateClusterConfig, updateNode, updatePack, updatePod, updatePodStatus, updateSecret, updateService, validateDisplayName, validateEmail, validateLoginInput, validatePassword, validateRegisterInput, versionExists, wipeSecretMaterial };