/** * Compiler source validation + config build, the shared front half of the * Compiler tools. `prepareCompile` validates every source and credential and * builds the CompileConfig; `log10x_compile` then spawns it asynchronously * (see compile-run.ts) and `log10x_compile_status` polls it. The pure * validators here (docker-ref / helm-ref / artifactory shape, the stable output * key) are also exercised directly by the unit tests. * * The compile itself scans source code / binaries with the COMPILER-flavor * Compiler app (`tenx @apps/compiler`) and writes a symbol library, per-file * `.10x.json` units plus a linked `.10x.tar`, that the 10x runtime later uses * to assign hidden classes (TenXTemplates) to events. * * Sources, all combine freely: * - a local folder (`source_path`), * - GitHub repositories pulled via the GitHub REST API (`github_repos`, * token required, the engine refuses an empty token even for public * repos), * - docker/OCI images (`docker_images`), pulled DAEMONLESSLY by the podman * bundled in compiler-10x, no host docker socket; the tool adds * `--cap-add SYS_ADMIN` to the compile container automatically, and * registry creds are optional (public images pull anonymously), * - Helm charts (`helm_charts`), a meta-source: the engine renders the * chart and pulls the docker images + GitHub source repos it references. * OCI/URL chart refs resolve standalone; bare `repo/chart` names need a * matching `helm_repos` entry (added in a pre-step). * - Artifactory artifacts (`artifactory_instance` + `artifactory_repo`), * pulled via the Artifactory REST API, token required, no host privilege. * gomod pull is the one engine axis deliberately NOT exposed: it recurses the * full transitive dependency graph and floods the library with third-party * symbols. * * Backend: Docker-first. By default it runs the image log10x/compiler-10x * (which is compiler-flavor by construction); if the caller has a local * COMPILER-flavor `tenx` it can use that instead. Three flavors ship and two of * them are refused here: `runtime` (the native binary) and `runtime-jvm` (the * JVM-packaged runtime, the only runtime built for Windows) carry no `generate` * pipeline unit, cannot compile, and are refused with a clear remediation that * names which one the caller has. An engine built before the flavor rename * reports the compiler flavor as `cloud` and the runtime flavor as `edge`; both * vocabularies are read, so an existing install keeps working un-upgraded. */ import { z } from 'zod'; import { type StructuredOutput } from '../lib/output-types.js'; import { type CompileConfig, type HelmRepo } from '../lib/compile-runner.js'; export declare const compileSchema: { source_path: z.ZodOptional; github_repos: z.ZodOptional>; github_branch: z.ZodOptional; github_folders: z.ZodOptional>; github_token: z.ZodOptional; docker_images: z.ZodOptional>; docker_username: z.ZodOptional; docker_token: z.ZodOptional; helm_charts: z.ZodOptional>; helm_repos: z.ZodOptional>; helm_pull_images: z.ZodDefault; helm_pull_repos: z.ZodDefault; artifactory_instance: z.ZodOptional; artifactory_repo: z.ZodOptional; artifactory_files: z.ZodOptional>; artifactory_folders: z.ZodOptional>; artifactory_recursive: z.ZodDefault; artifactory_token: z.ZodOptional; output_path: z.ZodOptional; library_name: z.ZodDefault; mode: z.ZodDefault>; timeout_ms: z.ZodDefault; }; export interface CompileArgs { source_path?: string; github_repos?: string[]; github_branch?: string; github_folders?: string[]; github_token?: string; docker_images?: string[]; docker_username?: string; docker_token?: string; helm_charts?: string[]; helm_repos?: string[]; helm_pull_images: boolean; helm_pull_repos: boolean; artifactory_instance?: string; artifactory_repo?: string; artifactory_files?: string[]; artifactory_folders?: string[]; artifactory_recursive: boolean; artifactory_token?: string; output_path?: string; library_name: string; mode: 'auto' | 'docker' | 'local'; timeout_ms: number; } /** Pure predicate over a docker/OCI image ref, exported for unit tests. */ export declare function isValidDockerImageRef(ref: string): boolean; /** * Parse helm_repos "name=url" strings into {name,url}, validating the name * shape and the url scheme. Returns an error string on the first bad entry. * Exported for unit tests. */ export declare function parseHelmRepos(entries: string[]): { repos: HelmRepo[]; } | { error: string; }; /** * Classify a helm chart ref: 'standalone' (oci:// or http(s)://, resolves * with no repo add), {bareRepo} (a `repo/chart` short name that needs its repo * in helm_repos), or 'invalid' (empty, contains whitespace, an unsupported * scheme, or a bare single name). Exported for tests. */ export declare function classifyHelmChartRef(ref: string): 'standalone' | { bareRepo: string; } | 'invalid'; /** Human description of what the compile read, for headlines/summaries. */ export declare function describeSources(args: CompileArgs): string; export declare function sanitizeName(name: string): string; /** * Stable per-source cache key. Re-running the SAME compile must land in the * SAME output folder, that is what lets the engine's checksum-based unit * reuse fire (the old `${name}-${Date.now()}-${pid}` temp dir was unique every * run, so reuse never triggered and every compile was a cold scan, defeating * the "subsequent runs are near-instant" contract). Hashes only the inputs * that determine the symbols: the sources and the runtime name. Credentials, * timeout, and mode are excluded, they don't change the produced library. * * Pure (no I/O) so it is unit-testable. */ export declare function stableOutputKey(args: CompileArgs, runtimeName: string): string; /** * Validate every source + credential and build the CompileConfig the runner * consumes. Returns the built config on success, or a ready-to-return error / * not_configured envelope when validation fails, discriminate with * `'inputs' in result`. Single-sources all the gating so log10x_compile (which * spawns the config asynchronously) shares exactly the same checks. */ export declare function prepareCompile(args: CompileArgs): Promise;