type MeshRuntimeMode = 'process' | 'podman'; type MeshServiceType = 'frontend' | 'backend' | 'worker' | 'router'; type MeshServiceStrategy = 'round-robin' | 'session-affinity' | 'least-connections'; type MeshInstanceStatus = 'starting' | 'running' | 'draining' | 'stopped' | 'failed' | 'expired' | 'unknown'; type MeshTlsMinVersion = 'TLSv1' | 'TLSv1.1' | 'TLSv1.2' | 'TLSv1.3'; type MeshHsmRouteMode = 'canonical' | 'backend' | 'both'; interface MeshHsmSchemaRouteIndexEntry { readonly stateId: string; readonly pattern?: string; readonly canonicalPattern?: string; readonly kind?: string; readonly isAlias?: boolean; readonly redirectToCanonical?: boolean; readonly priority?: number; readonly score?: number; } interface MeshHsmSchemaStateIndexEntry { readonly id: string; readonly key?: string; readonly parentId?: string | null; readonly depth?: number; readonly tags?: readonly string[]; readonly backend?: { readonly routes?: readonly string[]; readonly methods?: readonly string[]; readonly meta?: Record; }; } interface MeshHsmSchemaLike { readonly kind?: string; readonly id?: string; readonly version?: string; readonly index?: { readonly states?: readonly MeshHsmSchemaStateIndexEntry[]; readonly routes?: readonly MeshHsmSchemaRouteIndexEntry[]; readonly tags?: readonly string[]; }; } interface MeshHsmServiceBinding { readonly states?: readonly string[]; readonly tags?: readonly string[]; readonly includeCanonicalRoutes?: boolean; readonly includeBackendRoutes?: boolean; readonly routePrefix?: string; readonly stripPrefix?: string; readonly methods?: readonly string[]; } interface MeshHsmServiceMapping extends MeshHsmServiceBinding { readonly service: string; } interface MeshHsmBridgeConfig { /** Inline compiled HSM schema object. */ readonly schema?: MeshHsmSchemaLike; /** Path to a JSON/TS/JS module exporting a compiled HSM schema. Resolved relative to mesh.config.*. */ readonly schemaPath?: string; readonly routeMode?: MeshHsmRouteMode; readonly strict?: boolean; readonly mappings?: readonly MeshHsmServiceMapping[]; } interface MeshHsmMappedRoute { readonly service: string; readonly route: string; readonly source: 'hsm:canonical' | 'hsm:backend'; readonly stateId: string; readonly originalPattern: string; readonly methods?: readonly string[]; } interface NormalizedMeshHsmBridgeConfig { readonly enabled: boolean; readonly schema?: MeshHsmSchemaLike; readonly schemaPath?: string; readonly routeMode: MeshHsmRouteMode; readonly strict: boolean; readonly routes: readonly MeshHsmMappedRoute[]; } interface MeshPortRange { readonly from: number; readonly to: number; } interface MeshRouterConfig { readonly enabled?: boolean; readonly host?: string; readonly port?: number; readonly sessionAffinity?: boolean; readonly cookieName?: string; readonly secret?: string; readonly requestTimeoutMs?: number; readonly secureCookies?: boolean; readonly drainTimeoutMs?: number; readonly socketDrainTimeoutMs?: number; readonly tls?: MeshRouterTlsConfig; } interface MeshRouterTlsConfig { readonly enabled?: boolean; readonly certPath?: string; readonly keyPath?: string; readonly caPath?: string; readonly passphraseEnv?: string; readonly minVersion?: MeshTlsMinVersion; readonly additionalPorts?: readonly number[]; } type MeshRegistryType = 'file' | 'redis'; type MeshStreamTransport = 'memory' | 'redis'; type MeshCoordinationBackend = 'memory' | 'redis'; interface MeshCoordinationLocksConfig { readonly enabled?: boolean; readonly backend?: MeshCoordinationBackend; readonly url?: string; readonly ttlMs?: number; readonly waitMs?: number; } interface MeshCoordinationLeaderConfig { readonly enabled?: boolean; readonly ttlMs?: number; readonly renewEveryMs?: number; } interface MeshCoordinationCleanupConfig { readonly enabled?: boolean; } interface MeshCoordinationConfig { readonly enabled?: boolean; readonly backend?: MeshCoordinationBackend; readonly url?: string; readonly keyPrefix?: string; readonly connectTimeoutMs?: number; readonly locks?: MeshCoordinationLocksConfig; readonly leader?: MeshCoordinationLeaderConfig; readonly cleanup?: MeshCoordinationCleanupConfig; } interface MeshRegistryConfig { readonly type?: MeshRegistryType; readonly url?: string; readonly keyPrefix?: string; readonly secret?: string; readonly requireSignature?: boolean; readonly heartbeatIntervalMs?: number; readonly ttlMs?: number; readonly connectTimeoutMs?: number; } interface MeshPodmanRedisConfig { readonly enabled?: boolean; readonly image?: string; readonly containerName?: string; readonly port?: number; readonly volume?: string; } interface MeshPodmanQuadletConfig { readonly outputDir?: string; readonly user?: boolean; readonly installCommand?: boolean; readonly configSourceDir?: string; readonly configTargetDir?: string; } interface MeshPodmanRuntimeConfig { readonly podmanPath?: string; readonly network?: string; readonly createNetwork?: boolean; readonly containerPrefix?: string; readonly routerImage?: string; readonly routerContainerPort?: number; readonly publishHost?: string; readonly replace?: boolean; readonly pull?: 'never' | 'missing' | 'always'; readonly quadlet?: MeshPodmanQuadletConfig; readonly redis?: MeshPodmanRedisConfig; } interface MeshServicePodmanConfig { readonly image?: string; readonly command?: string | readonly string[]; readonly entrypoint?: string | readonly string[]; readonly containerPort?: number; readonly publish?: readonly string[]; readonly volumes?: readonly string[]; readonly labels?: Record; readonly env?: Record; readonly user?: string; readonly workdir?: string; readonly restartPolicy?: string; readonly networkAliases?: readonly string[]; readonly extraArgs?: readonly string[]; } interface MeshObservabilityConfig { readonly enabled?: boolean; readonly path?: string; readonly refreshIntervalMs?: number; readonly logLines?: number; readonly includeLogs?: boolean; } interface MeshStreamingConfig { readonly enabled?: boolean; readonly transport?: MeshStreamTransport; readonly url?: string; readonly keyPrefix?: string; readonly logs?: boolean; readonly events?: boolean; readonly maxLogChunkBytes?: number; readonly connectTimeoutMs?: number; } interface MeshRuntimeConfig { readonly mode?: MeshRuntimeMode; readonly podman?: MeshPodmanRuntimeConfig; readonly stateDir?: string; readonly logsDir?: string; readonly defaultWatch?: boolean; readonly portRange?: MeshPortRange; readonly drainTimeoutMs?: number; readonly shutdownTimeoutMs?: number; readonly killTimeoutMs?: number; } interface MeshServiceConfig { readonly type?: MeshServiceType; readonly command: string | readonly string[]; readonly image?: string; readonly podman?: MeshServicePodmanConfig; readonly cwd?: string; readonly instances?: number; readonly port?: number; readonly portRange?: MeshPortRange; readonly route?: string | readonly string[]; readonly healthPath?: string; readonly strategy?: MeshServiceStrategy; readonly hsm?: MeshHsmServiceBinding; readonly watch?: boolean; readonly env?: Record; readonly autoRestart?: boolean; readonly drainTimeoutMs?: number; readonly shutdownTimeoutMs?: number; } interface MeshTestConfig { readonly command: string | readonly string[]; readonly cwd?: string; readonly env?: Record; } interface MeshConfig { readonly app: string; readonly router?: MeshRouterConfig; readonly observability?: MeshObservabilityConfig; readonly runtime?: MeshRuntimeConfig; readonly registry?: MeshRegistryConfig; readonly hsm?: MeshHsmBridgeConfig; readonly streaming?: MeshStreamingConfig; readonly coordination?: MeshCoordinationConfig; readonly ci?: MeshCiConfig; readonly tests?: Record; readonly services: Record; } interface NormalizedMeshCoordinationLocksConfig { readonly enabled: boolean; readonly backend: MeshCoordinationBackend; readonly url: string; readonly ttlMs: number; readonly waitMs: number; } interface NormalizedMeshCoordinationLeaderConfig { readonly enabled: boolean; readonly ttlMs: number; readonly renewEveryMs: number; } interface NormalizedMeshCoordinationCleanupConfig { readonly enabled: boolean; } interface NormalizedMeshCoordinationConfig { readonly enabled: boolean; readonly backend: MeshCoordinationBackend; readonly url: string; readonly keyPrefix: string; readonly connectTimeoutMs: number; readonly locks: NormalizedMeshCoordinationLocksConfig; readonly leader: NormalizedMeshCoordinationLeaderConfig; readonly cleanup: NormalizedMeshCoordinationCleanupConfig; } interface NormalizedMeshObservabilityConfig { readonly enabled: boolean; readonly path: string; readonly refreshIntervalMs: number; readonly logLines: number; readonly includeLogs: boolean; } interface NormalizedMeshStreamingConfig { readonly enabled: boolean; readonly transport: MeshStreamTransport; readonly url: string; readonly keyPrefix: string; readonly logs: boolean; readonly events: boolean; readonly maxLogChunkBytes: number; readonly connectTimeoutMs: number; } interface NormalizedMeshRouterConfig { readonly enabled: boolean; readonly host: string; readonly port: number; readonly sessionAffinity: boolean; readonly cookieName: string; readonly secret: string; readonly requestTimeoutMs: number; readonly secureCookies: boolean; readonly drainTimeoutMs: number; readonly socketDrainTimeoutMs: number; readonly protocol: 'http' | 'https'; readonly publicOrigin: string; readonly publicOrigins: readonly string[]; readonly tls: NormalizedMeshRouterTlsConfig; } interface NormalizedMeshRouterTlsConfig { readonly enabled: boolean; readonly certPath?: string; readonly keyPath?: string; readonly caPath?: string; readonly passphraseEnv?: string; readonly minVersion?: MeshTlsMinVersion; readonly additionalPorts: readonly number[]; } interface NormalizedMeshRegistryConfig { readonly type: MeshRegistryType; readonly url: string; readonly keyPrefix?: string; readonly secret?: string; readonly requireSignature: boolean; readonly heartbeatIntervalMs: number; readonly ttlMs: number; readonly connectTimeoutMs: number; } interface NormalizedMeshPodmanRuntimeConfig { readonly podmanPath: string; readonly network: string; readonly createNetwork: boolean; readonly containerPrefix: string; readonly routerImage: string; readonly routerContainerPort: number; readonly publishHost: string; readonly replace: boolean; readonly pull: 'never' | 'missing' | 'always'; readonly quadlet: Required; readonly redis: Required; } interface NormalizedMeshRuntimeConfig { readonly mode: MeshRuntimeMode; readonly podman: NormalizedMeshPodmanRuntimeConfig; readonly stateDir: string; readonly logsDir: string; readonly defaultWatch: boolean; readonly portRange: MeshPortRange; readonly drainTimeoutMs: number; readonly shutdownTimeoutMs: number; readonly killTimeoutMs: number; } interface NormalizedMeshServiceConfig { readonly name: string; readonly type: MeshServiceType; readonly command: readonly string[]; readonly image?: string; readonly podman: Required> & { readonly image?: string; readonly command?: readonly string[]; readonly entrypoint?: readonly string[]; }; readonly shell: boolean; readonly cwd: string; readonly instances: number; readonly port?: number; readonly portRange: MeshPortRange; readonly routes: readonly string[]; readonly hsmRoutes: readonly MeshHsmMappedRoute[]; readonly healthPath?: string; readonly strategy: MeshServiceStrategy; readonly watch: boolean; readonly env: Record; readonly autoRestart: boolean; readonly drainTimeoutMs: number; readonly shutdownTimeoutMs: number; } interface NormalizedMeshTestConfig { readonly name: string; readonly command: string; readonly cwd: string; readonly env: Record; } interface NormalizedMeshConfig { readonly app: string; readonly projectRoot: string; readonly configPath: string; readonly router: NormalizedMeshRouterConfig; readonly observability: NormalizedMeshObservabilityConfig; readonly streaming: NormalizedMeshStreamingConfig; readonly coordination: NormalizedMeshCoordinationConfig; readonly runtime: NormalizedMeshRuntimeConfig; readonly registry: NormalizedMeshRegistryConfig; readonly hsm: NormalizedMeshHsmBridgeConfig; readonly ci: NormalizedMeshCiConfig; readonly tests: ReadonlyMap; readonly services: ReadonlyMap; } interface MeshConnectionCounters { readonly http: number; readonly sockets: number; readonly total: number; } interface MeshInstanceRecord { readonly id: string; readonly service: string; readonly serviceType: MeshServiceType; readonly status: MeshInstanceStatus; readonly pid: number | null; readonly port: number | null; readonly host: string; readonly url: string | null; readonly command: readonly string[]; readonly cwd: string; readonly logFile: string; readonly startedAt: string; readonly lastSeenAt?: string; readonly expiresAt?: string; readonly stoppedAt?: string; readonly exitCode?: number | null; readonly signal?: NodeJS.Signals | null; readonly metadata?: Record; } interface MeshStateFile { readonly version: 1; readonly app: string; readonly updatedAt: string; readonly instances: readonly MeshInstanceRecord[]; } interface MeshPodmanGenerateOptions { readonly outputDir?: string; readonly force?: boolean; readonly print?: boolean; } interface MeshPodmanPlanOptions { readonly json?: boolean; } interface MeshHsmPlanOptions { readonly json?: boolean; } type MeshCiFrontendStrategy = 'rsync' | 'image'; type MeshCiBackendStrategy = 'podman' | 'quadlet' | 'mesh'; /** * CI configuration for the frontend service. * * `strategy: 'rsync'` (default) — classic static-build + rsync + nginx reload. * `strategy: 'image'` — Docker image build → GHCR push → podman pull on server. * * `buildArgs` lists the VITE_* (or other) env-var names that are pulled from * GitHub Actions secrets and injected as Docker build-args or Vite env at build time. */ interface MeshCiFrontendConfig { readonly strategy?: MeshCiFrontendStrategy; readonly buildArgs?: readonly string[]; } /** * CI configuration for backend (api + worker) services. * * `strategy: 'podman'` (default) — Docker image build → GHCR push → SSH → * podman stop/rm/pull/run + health-check. * `strategy: 'quadlet'` — same image push, then mesh quadlet generate + * systemd unit reload via SSH. * `strategy: 'mesh'` — same image push, then upload a generated mesh runtime * bundle and keep the backend alive under a long-lived mesh process. * * `envSecrets` lists the env-var names to pull from GitHub Actions secrets * and write to the server's `.panom.env` file. Defaults to every key found * in the api/worker service env map. */ interface MeshCiBackendConfig { readonly strategy?: MeshCiBackendStrategy; readonly envSecrets?: readonly string[]; } interface MeshCiDrsConfig { readonly enabled?: boolean; } /** * Top-level `ci:` block inside `mesh.config.ts`. * Used by `mesh ci:generate` to produce per-repo GitHub Actions workflows. */ interface MeshCiConfig { /** Branch that triggers deployment. Default: `'main'` */ readonly branch?: string; readonly frontend?: MeshCiFrontendConfig; readonly backend?: MeshCiBackendConfig; readonly drs?: MeshCiDrsConfig; } interface NormalizedMeshCiFrontendConfig { readonly strategy: MeshCiFrontendStrategy; readonly buildArgs: readonly string[]; } interface NormalizedMeshCiBackendConfig { readonly strategy: MeshCiBackendStrategy; readonly envSecrets: readonly string[]; } interface NormalizedMeshCiDrsConfig { readonly enabled: boolean; } interface NormalizedMeshCiConfig { readonly enabled: boolean; readonly branch: string; readonly frontend: NormalizedMeshCiFrontendConfig; readonly backend: NormalizedMeshCiBackendConfig; readonly drs: NormalizedMeshCiDrsConfig; } interface MeshCiGenerateOptions { /** Only generate for this service name (optional, generates all when omitted). */ readonly service?: string | undefined; /** Print generated YAML to stdout without writing files. */ readonly print?: boolean; } interface MeshRunOptions { readonly services?: readonly string[]; readonly all?: boolean; readonly instances?: number; readonly watch?: boolean; readonly detach?: boolean; readonly router?: boolean; readonly cliPath?: string; } interface MeshPsOptions { readonly json?: boolean; } interface MeshWatchOptions { readonly lines?: number; readonly stream?: boolean; } interface MeshStopOptions { readonly drainTimeoutMs?: number; readonly shutdownTimeoutMs?: number; readonly killTimeoutMs?: number; readonly force?: boolean; } export type { MeshRunOptions as A, MeshRuntimeConfig as B, MeshServiceConfig as C, MeshServiceStrategy as D, MeshServiceType as E, MeshStateFile as F, MeshStopOptions as G, MeshStreamTransport as H, MeshStreamingConfig as I, MeshWatchOptions as J, NormalizedMeshCiConfig as K, NormalizedMeshCiDrsConfig as L, MeshCiBackendConfig as M, NormalizedMeshCiBackendConfig as N, NormalizedMeshCiFrontendConfig as O, NormalizedMeshConfig as P, NormalizedMeshCoordinationConfig as Q, NormalizedMeshHsmBridgeConfig as R, NormalizedMeshObservabilityConfig as S, NormalizedMeshRegistryConfig as T, NormalizedMeshRouterConfig as U, NormalizedMeshRouterTlsConfig as V, NormalizedMeshServiceConfig as W, NormalizedMeshStreamingConfig as X, MeshCiBackendStrategy as a, MeshCiConfig as b, MeshCiDrsConfig as c, MeshCiFrontendConfig as d, MeshCiFrontendStrategy as e, MeshCiGenerateOptions as f, MeshConfig as g, MeshConnectionCounters as h, MeshCoordinationConfig as i, MeshHsmBridgeConfig as j, MeshHsmMappedRoute as k, MeshHsmPlanOptions as l, MeshHsmRouteMode as m, MeshHsmSchemaLike as n, MeshHsmServiceBinding as o, MeshHsmServiceMapping as p, MeshInstanceRecord as q, MeshInstanceStatus as r, MeshObservabilityConfig as s, MeshPodmanGenerateOptions as t, MeshPodmanPlanOptions as u, MeshPsOptions as v, MeshRegistryConfig as w, MeshRegistryType as x, MeshRouterConfig as y, MeshRouterTlsConfig as z };