/** * Variable types and interfaces for template resolution */ /** * Variable reference parsed from template * Example: $self:target_ip -> { type: 'self', path: 'target_ip', raw: '$self:target_ip' } */ export interface VariableReference { type: 'self' | 'system' | 'system_secret' | 'secret' | 'capability' | 'infra'; path: string; raw: string; } /** * Resolution context - provides data sources for variable resolution */ export interface ResolutionContext { moduleId: string; selfConfig: Record; systemConfig: Record; systemSecrets: Record; secrets: Record; capabilities: Record>; /** * The module's deployed systems, keyed by name, for `$infra:.` * resolution at generate time (openspec/specs/module-systems-addressing/spec.md). Each value * exposes the snake_cased fields a template can reference: `ipv4_address`, * `hostname`, `zone`, `vmid`, `cidr`. Optional only so the many test-stub * `ResolutionContext` literals need no churn — production (buildResolutionContext) * always populates it; the resolver treats undefined as the empty map. */ systems?: Record; } /** * The `$infra:.` fields a template can read for one deployed * system. `cidr` is derived (ipv4_address + the zone's prefix length). */ export interface InfraSystemFields { name: string; hostname: string; ipv4_address: string; zone: string; cidr: string; vmid: string; } /** * Variable resolution result */ export interface ResolveSuccess { success: true; value: string; } export interface ResolveError { success: false; variable: string; error: string; } export type ResolveResult = ResolveSuccess | ResolveError; /** * Template resolution result */ export interface TemplateResolveSuccess { success: true; content: string; } export interface TemplateResolveError { success: false; errors: Array<{ variable: string; error: string; }>; } export type TemplateResolveResult = TemplateResolveSuccess | TemplateResolveError;