import { T as Tool } from '../types-Ks98Z0E_.mjs'; import 'zod'; /** * Aeon Deploy Types — Configuration and result types for deployment */ interface DeployConfig { /** Directory containing the Aeon Flux app to deploy */ appDir: string; /** Process name (DNS-safe, lowercase alphanumeric + hyphens) */ name: string; /** Gateway URL for deployment API */ gatewayUrl: string; /** Owner DID (decentralized identifier) */ ownerDid: string; /** Optional custom domain (CNAME) */ cname?: string; /** Optional API key for authentication (falls back to EDGEWORK_API_KEY env var) */ apiKey?: string; /** Preferred execution tier */ tier?: 'browser' | 'peer' | 'edge'; /** Build options */ build?: { /** Skip build step (use existing dist/) */ skipBuild?: boolean; /** Additional build flags */ flags?: string[]; }; } interface DeployResult { /** Content-addressed identifier (SHA-256 of envelope) */ cid: string; /** Process name */ name: string; /** Public URL */ url: string; /** R2 storage key for the envelope */ r2Key: string; /** Whether this was an update to an existing deployment */ updated: boolean; /** ISO timestamp of deployment */ deployedAt?: string; /** Git commit hash of deployed code */ commitHash?: string; /** CI build ID */ buildId?: string; } type DeploymentState = 'spawn' | 'loading' | 'running' | 'migrating' | 'hibernated' | 'terminated'; interface DeploymentStatus { cid: string; name: string; ownerDid: string; state: DeploymentState; tier: 'browser' | 'peer' | 'edge'; url: string; createdAt: string; updatedAt: string; requestCount: number; tokensSpent: number; manifest: Record; } interface DeploymentMetrics { cid: string; requestCount: number; tokensSpent: number; state: DeploymentState; tier: string; uptimeMs: number; requestsPerMinute: string; } interface DeploymentLog { id: string; level: 'info' | 'warn' | 'error' | 'debug'; message: string; createdAt: string; } interface DeploymentListItem { cid: string; name: string; ownerDid: string; state: DeploymentState; tier: string; createdAt: string; updatedAt: string; requestCount: number; tokensSpent: number; } interface CnameRegistration { domain: string; processName: string; verified: boolean; instructions: string; } interface SeedConfig { /** Process name to seed data for */ name: string; /** Directory containing seed files */ fromDir: string; /** Gateway URL */ gatewayUrl: string; /** API key for authentication (falls back to EDGEWORK_API_KEY env var) */ apiKey?: string; } type AeonContainerRepoSourceType = 'github-public' | 'github-private' | 'local-import'; interface AeonContainerRepoSeedFile { path: string; content: string; language?: string; } interface AeonContainerRepoSeedConfig { containerId: string; endpointBaseUrl: string; sourceType?: AeonContainerRepoSourceType; repoUrl?: string; repoRef?: string; fromDir?: string; files?: AeonContainerRepoSeedFile[]; ucanToken?: string; apiKey?: string; } interface AeonContainerRepoSeedResult { ok: boolean; repo_id: string; container_id: string; source_type: AeonContainerRepoSourceType; total_files: number; indexed_files: number; symbols: number; } interface AeonContainerSnapshotConfig { containerId: string; endpointBaseUrl: string; ucanToken?: string; apiKey?: string; } interface AeonContainerSnapshotResult { snapshot_id: string; snapshot_key: string; files_count: number; manifest_hash: string; timestamp: number; } type ProcessStreamFormat = 'text' | 'metadata' | 'openai' | 'anthropic'; interface ProcessRequestOptions { /** Override process base URL (e.g. https://my-process.edgework.ai) */ processUrl?: string; /** Optional API key for auth headers */ apiKey?: string; /** Optional abort signal */ signal?: AbortSignal; } interface ProcessStreamRequest { /** Prompt text (alias: text/input/message) */ prompt?: string; text?: string; input?: string; message?: string; /** Stream format */ format?: ProcessStreamFormat; /** Model hint */ model?: string; /** Optional system instruction */ system?: string; /** Chunk size for text streaming */ chunkSize?: number; /** Generation controls */ maxTokens?: number; temperature?: number; } interface ProcessOpenAIChatRequest { model?: string; stream?: boolean; max_tokens?: number; temperature?: number; messages: Array<{ role: 'system' | 'user' | 'assistant' | 'developer'; content: string; }>; } interface ProcessAnthropicMessageRequest { model?: string; stream?: boolean; max_tokens?: number; temperature?: number; messages: Array<{ role: 'system' | 'user' | 'assistant' | 'developer'; content: string | Array<{ type: 'text'; text: string; }>; }>; } interface ProcessStreamEvent { event: string; data: string; json?: unknown; } interface SiteSmokeTestOptions extends ProcessRequestOptions { /** Request timeout in milliseconds */ timeoutMs?: number; } interface SiteSmokeTestResult { ok: boolean; url: string; status: number; contentType: string | null; legacyRedirectDetected: boolean; details?: string; } type QualityTargetSource = 'workspace' | 'gateway' | 'all' | 'workspace+gateway' | 'manual'; type QualityIssueSeverity = 'error' | 'warn'; type QualityIssueCode = 'missing-path-implementation' | 'missing-worker-route' | 'missing-client-root' | 'smoke-path-failed' | 'legacy-workers-redirect' | 'gateway-discovery-failed' | 'invalid-target'; interface QualityIssue { code: QualityIssueCode; severity: QualityIssueSeverity; message: string; path?: string; process?: string; appDir?: string; suggestion?: string; } interface QualityPathSpec { path: string; category: 'legal' | 'seo' | 'icon' | 'manifest' | 'agent' | 'well-known' | 'custom'; required: boolean; severityWhenMissing?: QualityIssueSeverity; } interface QualityTarget { name: string; source: QualityTargetSource; appDir?: string; configPath?: string; aeonPid?: string; cid?: string; state?: string; } interface GatewayQualityTarget extends QualityTarget { source: 'gateway'; } interface QualityPathStatus { path: string; category: QualityPathSpec['category']; required: boolean; linkedCount: number; exists: boolean; candidate?: string; worker: 'yes' | 'no' | 'n/a'; client: 'yes' | 'no' | 'n/a'; issues: QualityIssue[]; } interface QualityPathSmokeResult { path: string; url: string; ok: boolean; status: number; contentType: string | null; legacyRedirectDetected: boolean; details?: string; } interface SitePathSmokeTestOptions { apiKey?: string; timeoutMs?: number; signal?: AbortSignal; processUrlByName?: Record; } interface SitePathSmokeTestResult { process: string; baseUrl: string; paths: QualityPathSmokeResult[]; ok: boolean; failures: QualityPathSmokeResult[]; } interface SmokeCleanup { name: string; run: () => void | Promise; } interface SmokeStep$1 { name: string; run: (context: SmokeContext$1) => void | Promise; } interface SmokeStepResult$1 { name: string; ok: boolean; startedAt: string; finishedAt: string; durationMs: number; error?: string; } interface SmokeLiveRouteResult$1 { path: string; url: string; attempts: number; status: number; durationMs: number; } interface SmokeResult$1 { suite: string; baseUrl: string; runId: string; ok: boolean; startedAt: string; finishedAt: string; durationMs: number; liveRoute?: SmokeLiveRouteResult$1; steps: SmokeStepResult$1[]; cleanup: { attempted: number; failed: number; failures: string[]; }; metadata: Record; failedStep?: string; failureMessage?: string; } interface WaitForLiveRouteOptions$1 { path: string; init?: RequestInit; timeoutMs?: number; retryIntervalMs?: number; validate?: (response: Response, bodyText: string) => boolean; } interface McpSession { endpoint: string; sessionId: string; initializedAt: string; } interface McpCallResult$1 { id: string | number | null; sessionId: string; result: TResult; } interface SmokeFetchJsonResult$1 { response: Response; text: string; data: T; } interface SmokeContext$1 { baseUrl: string; runId: string; maxWaitMs: number; retryIntervalMs: number; metadata: Record; state: Map; onCleanup: (name: string, cleanup: () => void | Promise) => void; setMetadata: (key: string, value: unknown) => void; assert: (condition: unknown, message: string) => asserts condition; fail: (message: string) => never; resolveUrl: (pathOrUrl: string) => string; fetch: (pathOrUrl: string, init?: RequestInit) => Promise; fetchText: (pathOrUrl: string, init?: RequestInit) => Promise<{ response: Response; text: string; }>; fetchJson: (pathOrUrl: string, init?: RequestInit) => Promise>; probeHtml: (pathOrUrl: string, options?: { headers?: HeadersInit | undefined; }) => Promise<{ response: Response; text: string; }>; probeJson: (pathOrUrl: string, options?: { headers?: HeadersInit | undefined; }) => Promise>; probeExpectedStatus: (pathOrUrl: string, expectedStatus: number | number[], options?: { headers?: HeadersInit | undefined; }) => Promise; probeWellKnown: (pathOrUrl: string, options?: { headers?: HeadersInit | undefined; }) => Promise>; waitForLiveRoute: (options: WaitForLiveRouteOptions$1) => Promise; withRetry: (label: string, run: () => Promise, options?: { timeoutMs?: number; retryIntervalMs?: number; }) => Promise; mcpInitialize: (pathOrUrl?: string, params?: Record, init?: RequestInit) => Promise>; mcpListTools: (pathOrUrl?: string, init?: RequestInit) => Promise>; mcpListResources: (pathOrUrl?: string, init?: RequestInit) => Promise>; mcpCallTool: (name: string, args?: Record, pathOrUrl?: string, init?: RequestInit) => Promise>; mcpReadResource: (uri: string, pathOrUrl?: string, init?: RequestInit) => Promise>; } interface SmokeSuite$1 { name: string; baseUrl: string; waitFor?: WaitForLiveRouteOptions$1; steps: SmokeStep$1[]; reportPath?: string; runId?: string; maxWaitMs?: number; retryIntervalMs?: number; } interface QualitySmokeOptions extends SitePathSmokeTestOptions { paths?: string[]; } interface QualityTargetReport { target: QualityTarget; pathResults: QualityPathStatus[]; smoke?: SitePathSmokeTestResult; issues: QualityIssue[]; ok: boolean; } interface QualityAutopilotResolvedOptions { workspaceRoot: string; appsDir: string; source: QualityTargetSource; smoke: boolean; strict: boolean; targets: string[]; excludeTargets: string[]; pathSpecs: QualityPathSpec[]; } interface QualityAutopilotReport { generatedAt: string; options: QualityAutopilotResolvedOptions; targets: QualityTargetReport[]; summary: { targets: number; issues: number; errors: number; warnings: number; smokeFailures: number; }; ok: boolean; } interface QualityAutopilotOptions { workspaceRoot?: string; appsDir?: string; source?: 'workspace' | 'gateway' | 'all'; targets?: string; excludeTargets?: string; paths?: string; pathSpecs?: QualityPathSpec[]; smoke?: boolean; smokePaths?: string; smokeTimeoutMs?: number; strict?: boolean; gatewayUrl?: string; owner?: string; processUrlByName?: Record; apiKey?: string; signal?: AbortSignal; } interface FeatureToggles { analytics: boolean; sitemap: boolean; robots: boolean; metadata: boolean; esi: boolean; dashrelay: boolean; dash: boolean; neural: boolean; presence: boolean; ucan: boolean; zk: boolean; d1: boolean; r2: boolean; kv: boolean; mcp: boolean; } interface QualityPolicy { staticThreshold: number; interactiveThreshold: number; crawlFromSitemap: boolean; strict: boolean; ratchetToHundred: boolean; } interface AeonConfig { project: { name: string; runtime: 'cloudflare-worker'; deploymentTarget: string; }; preset: 'all' | 'core' | 'minimal' | 'mcp-server'; features: FeatureToggles; quality: QualityPolicy; integrations: { dashrelayChannels: string[]; analyticsId: string; observabilitySink: string; mcpServerCommand: string; }; storage: { d1Binding: string; kvBinding: string; r2Binding: string; migrationStrategy: 'safe'; }; security: { ucanIssuer: string; ucanAudience: string; zkVerificationMode: 'strict' | 'permissive'; }; performance: { esiMode: 'deep' | 'light'; prefetch: boolean; speculation: boolean; cacheControl: string; }; } interface ScaffoldOptions { targetDir: string; preset?: AeonConfig['preset']; configPath?: string; enable?: string[]; disable?: string[]; install?: boolean; serve?: boolean; quality?: boolean; } type SourceRefKind = 'url' | 'slug' | 'pid' | 'deployment-id' | 'cid'; interface SourceRef { input: string; kind: SourceRefKind; value: string; processName?: string; cid?: string; baseUrl?: string; } interface CloneOptions { source: string; targetDir: string; mode?: 'full'; install?: boolean; serve?: boolean; envTemplateOnly?: boolean; gatewayUrl?: string; apiKey?: string; } interface ScaffoldResult { targetDir: string; config: AeonConfig; filesWritten: string[]; installed: boolean; served: boolean; qualityReport?: { ok: boolean; issues: string[]; }; } interface CloneResult { targetDir: string; source: SourceRef; filesWritten: string[]; installed: boolean; served: boolean; downloadedPaths: string[]; } declare function scaffoldAeonFoundation(options: ScaffoldOptions): Promise; declare function scaffoldMcpServer(options: ScaffoldOptions): Promise; declare function cloneDeploymentToDirectory(options: CloneOptions): Promise; declare function detectFeatureKey(input: string): keyof FeatureToggles | null; declare function loadAeonConfigFromFile(configPath: string): Partial; declare function resolveAeonConfig(options: { projectName: string; preset?: AeonConfig['preset']; configPath?: string; enable?: string[]; disable?: string[]; }): AeonConfig; declare function serializeAeonToml(config: AeonConfig): string; declare function getDefaultQualityPathSpecs(): QualityPathSpec[]; declare function runQualityAutopilot(options?: QualityAutopilotOptions): Promise; declare function formatQualityAutopilotReport(report: QualityAutopilotReport): string; /** * MCP Tools for ForgoCD Deployment Engine */ declare function createForgoMCPTools(routerUrl?: string): Tool[]; type Awaitable = T | Promise; type SmokeHeaders = HeadersInit | undefined; interface SmokeStep { name: string; run: (context: SmokeContext) => Awaitable; } interface SmokeStepResult { name: string; ok: boolean; startedAt: string; finishedAt: string; durationMs: number; error?: string; } interface SmokeLiveRouteResult { path: string; url: string; attempts: number; status: number; durationMs: number; } interface SmokeResult { suite: string; baseUrl: string; runId: string; ok: boolean; startedAt: string; finishedAt: string; durationMs: number; liveRoute?: SmokeLiveRouteResult; steps: SmokeStepResult[]; cleanup: { attempted: number; failed: number; failures: string[]; }; metadata: Record; failedStep?: string; failureMessage?: string; } interface WaitForLiveRouteOptions { path: string; init?: RequestInit; timeoutMs?: number; retryIntervalMs?: number; validate?: (response: Response, bodyText: string) => boolean; } interface ProbeHtmlOptions { headers?: SmokeHeaders; } interface ProbeJsonOptions { headers?: SmokeHeaders; } interface ProbeExpectedStatusOptions { headers?: SmokeHeaders; } interface ProbeWellKnownOptions { headers?: SmokeHeaders; } interface SmokeSuite { name: string; baseUrl: string; waitFor?: WaitForLiveRouteOptions; steps: SmokeStep[]; reportPath?: string; runId?: string; maxWaitMs?: number; retryIntervalMs?: number; } interface McpCallResult { id: string | number | null; sessionId: string; result: TResult; } interface SmokeFetchJsonResult { response: Response; text: string; data: T; } interface SmokeContext { baseUrl: string; runId: string; maxWaitMs: number; retryIntervalMs: number; metadata: Record; state: Map; onCleanup: (name: string, cleanup: () => Awaitable) => void; setMetadata: (key: string, value: unknown) => void; assert: (condition: unknown, message: string) => asserts condition; fail: (message: string) => never; resolveUrl: (pathOrUrl: string) => string; fetch: (pathOrUrl: string, init?: RequestInit) => Promise; fetchText: (pathOrUrl: string, init?: RequestInit) => Promise<{ response: Response; text: string; }>; fetchJson: (pathOrUrl: string, init?: RequestInit) => Promise>; probeHtml: (pathOrUrl: string, options?: ProbeHtmlOptions) => Promise<{ response: Response; text: string; }>; probeJson: (pathOrUrl: string, options?: ProbeJsonOptions) => Promise>; probeExpectedStatus: (pathOrUrl: string, expectedStatus: number | number[], options?: ProbeExpectedStatusOptions) => Promise; probeWellKnown: (pathOrUrl: string, options?: ProbeWellKnownOptions) => Promise>; waitForLiveRoute: (options: WaitForLiveRouteOptions) => Promise; withRetry: (label: string, run: () => Promise, options?: { timeoutMs?: number; retryIntervalMs?: number; }) => Promise; mcpInitialize: (pathOrUrl?: string, params?: Record, init?: RequestInit) => Promise>; mcpListTools: (pathOrUrl?: string, init?: RequestInit) => Promise>; mcpListResources: (pathOrUrl?: string, init?: RequestInit) => Promise>; mcpCallTool: (name: string, args?: Record, pathOrUrl?: string, init?: RequestInit) => Promise>; mcpReadResource: (uri: string, pathOrUrl?: string, init?: RequestInit) => Promise>; } declare function resolveSmokeBaseUrl(defaultBaseUrl: string, specificEnvVar?: string): string; declare function resolveSmokeSuiteOptions(baseUrl: string, options?: Pick): { baseUrl: string; runId: string; maxWaitMs: number; retryIntervalMs: number; reportPath?: string; }; declare function withRetry(label: string, run: () => Promise, options?: { timeoutMs?: number; retryIntervalMs?: number; }): Promise; declare function runSmokeSuite(suite: SmokeSuite): Promise; declare function assertPreferencesRoundTrip(context: SmokeContext, options: { path?: string; headers?: SmokeHeaders; update: Record; verify?: (preferences: Record) => boolean; }): Promise>; declare function assertFlagsReadable(context: SmokeContext, options?: { path?: string; headers?: SmokeHeaders; minimumFlags?: number; }): Promise>; /** * Aeon Deploy — Dead simple deployment for Aeon Flux apps * * Usage: * import { deploy, getStatus, stop, start } from '@affectively/edgework-sdk/deploy'; * const result = await deploy({ appDir: './my-site', name: 'halos-agency', ... }); */ /** * Deploy an Aeon Flux app to the edge. * * @example * ```typescript * const result = await deploy({ * appDir: './my-site', * name: 'halos-agency', * gatewayUrl: 'https://api.edgework.ai', * // apiKey is optional if EDGEWORK_API_KEY is set * ownerDid: 'did:key:z...', * }); * console.log(`Deployed to ${result.url}`); * ``` */ declare function deploy(config: DeployConfig): Promise; /** * Get the status of a deployed process. */ declare function getStatus(cid: string, options?: { gatewayUrl?: string; apiKey?: string; }): Promise; /** * Fetch app content through AeonPID/CID proxy route. * Useful when process DNS is not propagated yet. */ declare function fetchAppByCid(cid: string, options?: { gatewayUrl?: string; apiKey?: string; path?: string; }): Promise; /** * Smoke test a deployed process host and fail if it redirects to workers.dev. */ declare function smokeTestSite(process: string, options?: SiteSmokeTestOptions): Promise; /** * Stop (hibernate) a deployed process. */ declare function stop(cid: string, options?: { gatewayUrl?: string; apiKey?: string; }): Promise<{ cid: string; state: string; }>; /** * Start (wake) a hibernated process. */ declare function start(cid: string, options?: { gatewayUrl?: string; apiKey?: string; }): Promise<{ cid: string; state: string; }>; /** * Migrate a process to a different execution tier. */ declare function migrate(cid: string, tier: 'browser' | 'peer' | 'edge', options?: { gatewayUrl?: string; apiKey?: string; }): Promise<{ cid: string; tier: string; state: string; }>; /** * Get process logs. */ declare function logs(cid: string, options?: { gatewayUrl?: string; apiKey?: string; limit?: number; level?: string; }): Promise<{ logs: DeploymentLog[]; count: number; }>; /** * Get process metrics. */ declare function metrics(cid: string, options?: { gatewayUrl?: string; apiKey?: string; }): Promise; /** * List all deployments. */ declare function list(options?: { gatewayUrl?: string; apiKey?: string; owner?: string; }): Promise<{ processes: DeploymentListItem[]; count: number; }>; /** * Register a custom domain (CNAME) for a process. */ declare function registerCname(cid: string, domain: string, options?: { gatewayUrl?: string; apiKey?: string; }): Promise; /** * Seed D1/KV data for a deployed process. */ declare function seed(config: SeedConfig): Promise<{ ok: boolean; }>; /** * Seed repository content into aeon-container D1 index. * This is the Dash -> D1 bridge for CLI-seeded workspaces. */ declare function seedContainerRepo(config: AeonContainerRepoSeedConfig): Promise; /** * Persist a workspace snapshot to D1-backed aeon-container metadata. */ declare function snapshotContainerWorkspace(config: AeonContainerSnapshotConfig): Promise; /** * Stream generic process SSE output from /stream. */ declare function streamProcess(process: string, request: ProcessStreamRequest, options?: ProcessRequestOptions): Promise>; /** * Stream OpenAI-compatible chat completions from a process host. */ declare function streamProcessOpenAIChat(process: string, request: ProcessOpenAIChatRequest, options?: ProcessRequestOptions): Promise>; /** * Stream Anthropic-compatible message events from a process host. */ declare function streamProcessAnthropicMessages(process: string, request: ProcessAnthropicMessageRequest, options?: ProcessRequestOptions): Promise>; interface RegisterAeonPidConfig { appName: string; env?: 'dev' | 'staging' | 'production'; gatewayUrl?: string; ownerDid?: string; apiKey?: string; appDir?: string; dryRun?: boolean; } interface RegisterAeonPidResult { cid: string; processName: string; siteHost: string; state: string; } /** * Register an app with the Edgework deploy gateway (AeonPID). * * This is the canonical programmatic entry point — CLI commands and scripts * are thin wrappers around this function. */ declare function registerAeonPid(config: RegisterAeonPidConfig): Promise; export { type AeonConfig, type AeonContainerRepoSeedConfig, type AeonContainerRepoSeedFile, type AeonContainerRepoSeedResult, type AeonContainerSnapshotConfig, type AeonContainerSnapshotResult, type CloneOptions, type CloneResult, type CnameRegistration, type DeployConfig, type DeployResult, type DeploymentListItem, type DeploymentLog, type DeploymentMetrics, type DeploymentStatus, type GatewayQualityTarget, type McpCallResult$1 as McpCallResult, type McpSession, type ProcessAnthropicMessageRequest, type ProcessOpenAIChatRequest, type ProcessRequestOptions, type ProcessStreamEvent, type ProcessStreamRequest, type QualityAutopilotOptions, type QualityAutopilotReport, type QualityAutopilotResolvedOptions, type QualityIssue, type QualityIssueCode, type QualityIssueSeverity, type QualityPathSmokeResult, type QualityPathSpec, type QualityPathStatus, type QualityPolicy, type QualitySmokeOptions, type QualityTarget, type QualityTargetReport, type QualityTargetSource, type RegisterAeonPidConfig, type RegisterAeonPidResult, type ScaffoldOptions, type ScaffoldResult, type SeedConfig, type SitePathSmokeTestOptions, type SitePathSmokeTestResult, type SiteSmokeTestOptions, type SiteSmokeTestResult, type SmokeCleanup, type SmokeContext$1 as SmokeContext, type SmokeFetchJsonResult$1 as SmokeFetchJsonResult, type SmokeLiveRouteResult$1 as SmokeLiveRouteResult, type SmokeResult$1 as SmokeResult, type SmokeStep$1 as SmokeStep, type SmokeStepResult$1 as SmokeStepResult, type SmokeSuite$1 as SmokeSuite, type SourceRef, type WaitForLiveRouteOptions$1 as WaitForLiveRouteOptions, assertFlagsReadable, assertPreferencesRoundTrip, cloneDeploymentToDirectory, createForgoMCPTools, deploy, detectFeatureKey, fetchAppByCid, formatQualityAutopilotReport, getDefaultQualityPathSpecs, getStatus, list, loadAeonConfigFromFile, logs, metrics, migrate, registerAeonPid, registerCname, resolveAeonConfig, resolveSmokeBaseUrl, resolveSmokeSuiteOptions, runQualityAutopilot, runSmokeSuite, scaffoldAeonFoundation, scaffoldMcpServer, seed, seedContainerRepo, serializeAeonToml, smokeTestSite, snapshotContainerWorkspace, start, stop, streamProcess, streamProcessAnthropicMessages, streamProcessOpenAIChat, withRetry };