#!/usr/bin/env bun import { type NodeKeyPair } from '@forgezero/runtime/identity'; import type { DeploymentVaultBindingsV3 } from '@forgezero/access/vault'; import { startAgent, type AgentOptions, type AttestationSource } from './socket'; import type { SecretCache } from './cache'; export declare function agentCommandArgs(args: readonly string[], command: string): string[]; import { type DeploymentCredentialSchema } from './credential-schema'; export { VERSION } from './version'; export { startAgent, handleRequest, handleApplicationRequest } from './socket'; export type { AgentOptions, AttestationSource, Request, Response } from './socket'; export { createSecretCache, CacheError } from './cache'; export type { SecretCache, CacheOptions } from './cache'; export { AGENT_CREDENTIAL_LOCATIONS, AGENT_CREDENTIAL_POLICY, METAL_SYSTEMD_CREDENTIALS, credentialBinding, deploymentCredentialSchema } from './credential-schema'; export type { AgentCredentialLocation, DeploymentCredentialBinding, DeploymentCredentialSchema } from './credential-schema'; export { createDeploymentManager, DeploymentError } from './deployment'; export type { DeploymentManager, DeploymentOptions, DeploymentRequest, DeploymentResult } from './deployment'; export { DeploymentInputError, resolveDeploymentInputs, resolveDeploymentTargets } from './deployment-targets'; export { DeploymentTopologyError, planDeploymentTopology, type DeploymentTopologyAssignment, type DeploymentTopologyPlacement, type DeploymentTopologyRole, type DeploymentTopologyTransport } from './deployment-topology'; export { DEFAULT_CONTROL_SOCKET, requestControl, startControlServer } from './control'; export { pullDeploymentOnce, startDeploymentPull } from './deployment-pull'; export type { DeploymentPullOptions, RemoteDeploymentClaim, PullResult } from './deployment-pull'; export { pullProvisioningOnce, startProvisioningPull } from './provisioning-pull'; export type { CreateRemoteProvisionClaim, ProvisioningPullOptions, RemoteProvisionClaim, GuestAccess, ProvisionPullResult, ProvisionRunner, ProvisionResult } from './provisioning-pull'; export { pullMigrationOnce, startMigrationPull } from './migration-pull'; export { executeMetalAdmission, executeSshBootstrap, pullMetalAdmissionOnce, pullSshBootstrapOnce, startMetalAdmissionPull, startSshBootstrapPull } from './ssh-bootstrap'; export type { MetalAdmissionProof, MetalAdmissionResult, RemoteMetalAdmissionClaim, RemoteSshBootstrapClaim, SshBootstrapPullOptions, SshBootstrapResult } from './ssh-bootstrap'; export type { MigrationAction, MigrationEvidence, MigrationNetwork, MigrationPullOptions, MigrationPullResult, RemoteMigrationClaim } from './migration-pull'; export { enrolGuestIdentity, loadGuestBinding } from './guest-enrolment'; export type { GuestBinding, GuestEnrolmentOptions } from './guest-enrolment'; export { createNodeVaultCache, deploymentVaultBinding, deploymentVaultCacheKey, startNodeVaultSync, realmNodeApiUrl } from './node-vault'; export type { NodeVaultOptions, NodeVaultSyncOptions } from './node-vault'; export type { InvitationHandoff } from './attended-platform-bootstrap'; export { activeLeaseDigest, agentRuntimeHandoff, reconcileAgentRuntimeHandoff } from './agent-handover'; export type { AgentHandoffAcknowledgement, AgentLeaseCoordinate, AgentRuntimeHandoff, VaultReplicationCursor } from './agent-handover'; export { PLATFORM_SECRET_AUTHORITY_DROP_IN, PLATFORM_SECRET_AUTHORITY_RECEIPT, applyPlatformSecretAuthority, readPlatformSecretAuthorityReceipt } from './platform-secret-authority'; export type { PlatformSecretAuthorityDirective, PlatformSecretAuthorityReceipt, PlatformSecretAuthorityState } from './platform-secret-authority'; export { allocateAddress, allocateCpuPool, cloudInit, guestNameFor, provisionMetalGuest, removeMetalGuest } from './metal-provision'; export { validateMetalProfile } from './metal-provision'; export type { GuestManifest, MetalCommandResult, MetalCpuPool, MetalExec, MetalProvisionProfile } from './metal-provision'; export { DEFAULT_METAL_HELPER_SOCKET, requestMetalProvision, startMetalHelper } from './metal-helper-socket'; export { DEFAULT_LIFECYCLE_HELPER_SOCKET, executeLifecycleAction, loadLifecycleProfile, requestLifecycleAction, startLifecycleHelper, validateLifecycleProfile } from './lifecycle-helper'; export type { LifecycleCommandResult, LifecycleExec, LifecycleProfile } from './lifecycle-helper'; export { materializeWarpMdm, renderWarpMdm } from './warp-config'; export { configureMeshConnector, readMeshConnectorCredential } from './mesh-connector'; export type { MeshConnectorCommandResult, MeshConnectorExec } from './mesh-connector'; export { compareVersions, restoreAgentRelease, selectAgentRelease, stageAgentRelease, validateAgentRelease, DEFAULT_AGENT_RELEASE_ROOT, DEFAULT_AGENT_UPDATE_SOCKET, MAX_AGENT_TARBALL_BYTES } from './agent-update'; export type { AgentRelease, StagedAgentRelease, UpdateCommand, UpdateCommandResult } from './agent-update'; export { activateAgentRelease, probeAgentSocket, readAgentUpdateReceipt, recoverInterruptedAgentUpdate, requestAgentUpdate, startAgentUpdateHelper, AGENT_UPDATE_GROUP, AGENT_UPDATE_HELPER_UNIT_PATH, AGENT_UPDATE_JOURNAL, AGENT_UPDATE_RECEIPT } from './agent-update-helper'; export type { AgentUpdateOutcome, AgentUpdateReceipt, AgentUpdateRequest, AgentUpdateResponse } from './agent-update-helper'; export { DEFAULT_SOFTWARE_HELPER_SOCKET, requestSoftware, startSoftwareHelper, SOFTWARE_HELPER_GROUP, SOFTWARE_HELPER_UNIT_PATH } from './software-helper'; export { countPaidManagedSoftware, ensureSoftwareRequirements, observeSoftwareHost, softwareBillingClass, validateSoftwareRequirements, OS_CATALOG, SOFTWARE_CATALOG } from './software'; export type { CatalogStatus, DeploymentChannel, OsCatalogEntry, SoftwareCatalogEntry, SoftwareCommandResult, SoftwareExec, SoftwareId, SoftwareObservation, SoftwareRequirement } from './software'; export { AGENT_EGRESS_TABLE, BLOCKED_IPV4, BLOCKED_IPV6, SYSTEMD_RESOLVED_ADDRESS, SYSTEMD_RESOLVED_STUB, applyAgentEgressPolicy, normalizeEgressTcpPorts, renderAgentEgressNft, superviseAgentEgressPolicy, systemdAgentEgressDirectives, verifyAgentEgressPolicy } from './egress-policy'; export type { EgressCommand, EgressCommandResult } from './egress-policy'; export type { LoopbackEgressGrant } from './egress-policy'; export { AGENT_TELEMETRY_EVENTS, AGENT_TELEMETRY_OPERATIONS, AGENT_TELEMETRY_OUTCOMES, createAgentTelemetry, resolveAgentTelemetryConfig } from './telemetry'; export type { AgentOperationObservation, AgentTelemetry, AgentTelemetryConfig, AgentTelemetryEvent, AgentTelemetryOperation, AgentTelemetryOutcome, AgentTelemetryState } from './telemetry'; export { heartbeatAgentOnce, observeAgentHost, startAgentHeartbeat } from './agent-heartbeat'; export type { AgentHeartbeatOptions, AgentHeartbeatResponse, AgentObservation } from './agent-heartbeat'; export { DEFAULT_DEPLOYMENT_RUNNER_SOCKET, requestDeploymentCommand, startDeploymentRunner } from './deployment-runner'; export { createSnpAttestationSource } from './snp-attestation'; export type { SnpAttestationOptions } from './snp-attestation'; export { attestNodeOnce, startNodeAttestation } from './attestation-client'; export type { NodeAttestationOptions } from './attestation-client'; export { applyMetalIsolation, metalGuestSliceUnit, metalHousekeepingDropIn } from './metal-isolation'; export { assertSupportedGuestImage, supportedGuestImage, SUPPORTED_GUEST_IMAGE, SUPPORTED_GUEST_IMAGES } from './ubuntu'; export { calibrateHttpConcurrency, localCalibrationEndpoint } from './capacity-calibration'; export type { CapacityCalibration, CapacityCalibrationOptions, CapacityStage } from './capacity-calibration'; /** * The node seed, on disk, owner-only. * * Generated on first run rather than shipped: a seed baked into an image is a * seed every guest from that image shares, and a fleet becomes one identity * wearing many hostnames. Losing the file loses the node's identity, which is * correct — re-enrolment is the recovery path, not a backup of the secret. */ export declare function loadOrCreateSeed(path: string): Uint8Array; export interface AgentConfig { socketPath?: string; /** systemd-owned listener fd; preserves the application endpoint across replacement. */ listenFd?: number; seedPath?: string; /** Explicit development-only permission to persist a seed file. */ allowFileSeed?: boolean; /** Prefer this already-unsealed systemd credential over a persistent file. */ seedCredential?: string; /** Injected by tests or an embedding process; never persisted by the agent. */ seed?: Uint8Array; /** As the platform knows this node. Absent before enrolment. */ nodeKey?: string; attestation?: AttestationSource; /** * Secrets cached in memory on this guest, if this node serves any. * * Never written to disk. That would hand an attacker with filesystem access * every secret the guest has ever read — precisely the file that does not * exist today, and the whole reason a node holds a signing key rather than a * `.env`. A restart re-fetches; that costs one round trip. */ cache?: SecretCache; record?: AgentOptions['record']; } /** * The path the agent LISTENS on, taken from the client that discovers it. * * Both ends declared this literal independently — `@forgezero/vault` as * `DEFAULT_SOCKET` because discovery is part of its published contract, and the * agent as its own constant because it is the thing that binds. Moving either * one leaves an agent listening where nothing looks, and the symptom is every * app silently falling back to an API key: strictly weaker, entirely working, * and invisible. * * The published client is the authority here rather than the other way round. * A tenant's application ships with `@forgezero/vault` and cannot be asked to * follow a path this repository moved. */ export declare const DEFAULT_SOCKET_PATH = "/run/forgezero/vault.sock"; export declare const DEFAULT_SEED_PATH = "/var/lib/forgezero/node.seed"; export declare const DEFAULT_SEED_CREDENTIAL = "agent-seed"; /** * Resolve identity custody without a silent production downgrade. A missing * systemd credential is an outage to fix, not permission to create plaintext * identity material under /var/lib. */ export declare function configuredAgentSeed(options: { credential?: string; path?: string; allowFileSeed?: boolean; }): Uint8Array; export declare const DEFAULT_ENROLMENT_STATE_PATH = "/var/lib/forgezero/enrolment.json"; /** Resolve the one descriptor systemd passes for the application Vault socket. */ export declare function systemdListenFd(environment?: Record, pid?: number): number | undefined; /** * Read a systemd credential made available only to this unit. * * `CREDENTIALS_DIRECTORY` is a private, read-only tmpfs populated by PID 1. * The encrypted blob remains host-bound on disk and this plaintext disappears * with the service. A configured credential never falls back to a disk file: * doing so would turn a missing security control into a silent downgrade. */ export declare function loadSeedCredential(name?: string, directory?: string | undefined): Uint8Array; /** Read one text credential from PID 1's private tmpfs, never from an env value. */ export declare function loadTextCredential(name: string, directory?: string | undefined): string; /** Explicit allow-list over systemd credentials exposed to checked-in pipeline steps. */ export declare function createSystemdDeploymentSecrets(names: string | undefined, directory?: string | undefined): { has(name: string): boolean; get(name: string): Promise; } | undefined; /** * Resolve deployment secrets from the requested-entry RAM Vault cache. * A same-name systemd credential is usable only during the platform's explicit * bootstrap/activation authority states. Tenant Agents and managed/recovery * platform Agents fail closed when Vault cannot answer. */ export type DeploymentSecretAuthorityState = 'bootstrap' | 'activating' | 'managed' | 'recovery'; export declare function deploymentSecretAuthorityState(realm: 'platform' | 'tenant', environment?: Record): DeploymentSecretAuthorityState; export declare function createDeploymentSecretResolver(schema: DeploymentCredentialSchema, primary: Pick | undefined, fallback: { has(name: string): boolean; get(name: string): Promise; } | undefined, authorityState?: DeploymentSecretAuthorityState): Pick | undefined; export type InitialVaultReplicaStatus = { state: 'ready'; loaded: number; failed: readonly string[]; } | { state: 'partial'; loaded: number; failed: readonly string[]; } | { state: 'unavailable'; loaded: 0; failed: readonly []; }; /** * Prepare the on-demand in-memory Vault cache without turning a locked or restarting * Vault into an Agent control-plane outage. Workloads requiring a missing value * remain blocked; the sync loop refreshes only entries local applications have * already requested once Vault is available again. */ export declare function initializeVaultReplica(cache: Pick): Promise; /** Keep the local signed/control plane alive while remote attestation retries. */ export declare function attemptInitialAttestation(attempt: () => Promise, onDeferred: (cause: unknown) => void): Promise<{ verified: true; result: T; } | { verified: false; }>; /** * Bring the agent up. * * Returns the keys alongside the server so an enrolment flow can read the public * halves without going through the socket — the same values it would get there, * from the process that already holds them. */ export declare function runAgent(config?: AgentConfig): { server: ReturnType; keys: NodeKeyPair; nodeKey: string; setVault(cache: SecretCache, vaultBindings: DeploymentVaultBindingsV3): void; };