import { type NolGneProfilePlan, type NolGneProfileResult } from "./gne-profile.js"; import { type NolExportPlan } from "../_types/schemas/nol-assets.js"; import { type NolExportContext } from "./export-service.js"; import { type NolVllmActionRequest } from "./vllm-actions.js"; import type { NolVllmProfileContext } from "./vllm-profile.js"; import { type NolModelActionRequest } from "./model-actions.js"; import type { NolSandboxContext } from "./model-serving.js"; import type { NolNeuronaryCatalogEntry, NolNeuronaryCatalogReview } from "./neuronary-catalog.js"; import type { NolCoordinator, NolFrozenExperimentInput } from "../_types/orchestrator/nol/coordinator.js"; import type { NolJob, NolStore } from "../_types/orchestrator/nol/store.js"; export type NolFacadePermission = "inspect" | "sync" | "create" | "run" | "resume" | "cancel" | "export" | "register" | "promote" | "rollback"; export type NolCallerSurface = "local_cli" | "local_tui" | "daemon" | "gateway" | "agent_tool" | "telegram_public"; declare const callerBrand: unique symbol; /** Opaque process-local authority. A JSON object can never represent this token. */ export type NolCaller = Readonly<{ [callerBrand]: true; }>; export interface NolHostCallerGrant { actorId: string; surface: NolCallerSurface; authenticated: boolean; daemonScope?: "read" | "run" | "admin"; ownedProjectRoots: readonly string[]; permissions: readonly NolFacadePermission[]; } export declare class NolFacadeError extends Error { readonly code: string; readonly status: number; constructor(code: string, status: number, message: string); } /** Kept by trusted ingress code, never exposed to command bodies or tools. * Ingress derives grants from the local operator or authenticated middleware; * request fields such as actor, role, scope, and project owner are not proof. * Roots must already be canonicalized/authorized by the host project registry. */ export declare class NolHostAuthority { private readonly grants; issue(grant: NolHostCallerGrant): NolCaller; revoke(caller: NolCaller): void; /** Only tokens issued by this exact host authority instance are recognized. */ inspect(caller: unknown): Readonly | undefined; } export type NolFacadeRequest = NolModelActionRequest | NolVllmActionRequest | { action: "capabilities" | "recipes" | "jobs"; } | { action: "recipes.sync"; } | { action: "recipes.review"; reference: string; jobId?: string; } | { action: "experiment.create"; input: NolFrozenExperimentInput; } | { action: "conformance.create"; input: NolGneProfilePlan; } | { action: "conformance.show" | "conformance.run" | "conformance.recover"; jobId: string; } | { action: "experiment.show" | "experiment.run" | "experiment.resume" | "compare"; jobId: string; } | { action: "cancel"; jobId: string; reason?: string; } | { action: "export.create"; input: NolExportPlan; } | { action: "export.run" | "export.show"; jobId: string; } | { action: "export" | "register" | "promote" | "rollback"; jobId: string; }; export interface NolFacadeReply { action: NolFacadeRequest["action"]; projectRoot: string; data: unknown; } export interface NolFacadeServices { vllm?: { dispatch(request: NolVllmActionRequest, context: NolVllmProfileContext): Promise; }; models?: { dispatch(request: NolModelActionRequest, context: NolSandboxContext): Promise; cancel(jobId: string, actorId: string, reason?: string): NolJob; }; exports?: { create(input: NolExportPlan, context: NolExportContext): NolJob; run(jobId: string, context: NolExportContext): Promise; show(jobId: string, context: NolExportContext): Promise; cancel(jobId: string, actorId: string, reason?: string): NolJob; }; catalog?: { list(): Promise; review(reference: string, jobId?: string): Promise; cancel(jobId: string, actorId: string, reason?: string): NolJob; }; conformance?: { create(input: unknown): NolJob | Promise; run(jobId: string): Promise; recover(jobId: string): Promise; }; /** Read-only upstream synchronization. This must not publish recipes upstream, * install dependencies, load a model, or authorize a promotion. */ syncRecipes?(context: { projectRoot: string; actorId: string; assertAuthorized(): void; }): Promise; } /** A single caller's metadata admission; releasing it never affects another caller. */ export interface NolPreparedRun { assertCurrent(): void; release(): void; } export interface NolFacadeOptions { /** Canonical identity resolved by trusted host project discovery. */ projectRoot: string; authority: NolHostAuthority; coordinator: Pick & { /** Host metadata/proof resolution only; no CUDA or model loading. */ prepareRun?(jobId: string): Promise; }; store: NolStore; services?: NolFacadeServices; closeStoreOnShutdown?: boolean; } /** One project-scoped facade for local/daemon ingress. Construction performs no * storage access, dependency installation, worker startup, or model selection. */ export declare class NolFacade { private readonly options; readonly projectRoot: string; private readonly active; private readonly failures; private closing; private shutdownPromise; constructor(options: NolFacadeOptions); private authorize; private job; private conformanceJob; dispatch(caller: unknown, raw: unknown): Promise; /** Close owned storage only after the coordinator proves physical settlement. */ shutdown(): Promise; } export {};