import { type RunLabProvenance } from "./run-status.js"; import type { ObserverResult } from "./observer.js"; import type { E2BSandboxInfo } from "./e2b-desktop-launch.js"; import type { RunBundle, RunSetupQualitySnapshot } from "./run.js"; export declare const OSS_META_LAB_SCHEMA = "humanish.oss-meta-lab-result.v1"; export interface OssMetaLabOptions { /** Which manifest produced this run (#455). */ lab?: RunLabProvenance; codexAppServer?: boolean; completionTimeoutMs?: number; count?: number; cwd: string; dryRun?: boolean; onObserverReady?: (observer: ObserverResult & { ok: true; }) => Promise | void; open?: boolean; redactRepoNames?: boolean; repos?: string[]; runId?: string; } export interface OssMetaLabLiveRefreshController { cleanup(): Promise; stop(): Promise; } export interface OssMetaLabAssignment { index: number; repo: string; scenarioId: string; simId: string; streamId: string; } export interface OssMetaLabCleanupResult { killed: number; matched?: number; remaining?: number; skipped: number; errors: string[]; } interface OssMetaLabActorEvidenceArtifacts { actorLastMessageTailPath?: string; actorLogTailPath?: string; appServerEventsPath?: string; appServerTracePath?: string; appServerTranscriptPath?: string; nestedEvidencePath?: string; setupQualityPath?: string; } interface OssMetaLabBootstrap { codexMode: "app-server-client" | "tui-attempted"; completionPath?: string; launcherPath?: string; logPath?: string; humanishPackageUploaded: boolean; nestedObserverPath?: string; status: "started" | "failed"; tail: string; terminalTitle?: string; } export type OssMetaLabCompletionStatus = "running" | "passed" | "failed" | "blocked" | "timed_out"; export type OssMetaLabAppStatus = "not_started" | "running" | "blocked" | "failed" | "missing" | "unknown"; export type OssMetaLabActorStatus = "not_started" | "running" | "passed" | "failed" | "blocked" | "timed_out" | "suspended" | "unknown"; export type OssMetaLabVisualStatus = "not_started" | "visible" | "blocked" | "unknown"; export interface OssMetaLabCompletion { appServerActorEvidence?: OssMetaLabAppServerActorEvidence; actorLogPath?: string; actorLogTail?: string; actorLastMessageTail?: string; actorPid?: number; actorStatus?: OssMetaLabActorStatus; appLogPath?: string; appPid?: number; appReason?: string; appStatus?: OssMetaLabAppStatus; appUrl?: string; checkedAt: string; exitCode?: number; logTail?: string; nestedObserverPresent?: boolean; nestedStepTraceSummary?: OssMetaLabNestedStepTraceSummary; nestedVerifyPassed?: boolean; reason: string; setupQuality?: RunSetupQualitySnapshot; status: OssMetaLabCompletionStatus; visualReason?: string; visualStatus?: OssMetaLabVisualStatus; visualWindowCount?: number; } export interface OssMetaLabNestedStepTraceSummary { schema: "humanish.oss-meta-nested-step-trace-summary.v1"; redaction: { status: "passed"; notes: string; }; counts: { blockedSteps: number; passedSteps: number; surfaces: number; totalSteps: number; traces: number; }; scenario?: { id: string; source?: string; sourceDigest?: string; stepCount?: number; title?: string; }; status: "passed" | "blocked" | "unknown"; surfaces: Array<{ id: string; label?: string; ok: boolean; reason: string; steps: Array<{ action: string; assertionStatuses?: string[]; id: string; label?: string; reason: string; status: "passed" | "blocked" | "unknown"; }>; }>; } export interface OssMetaLabAppServerActorEvidence { eventsPath: string; eventsText?: string; reason?: string; status?: string; traceJson?: unknown; tracePath: string; traceText?: string; transcriptPath: string; transcriptText?: string; } export interface OssMetaLabHostActorPlan { schema: "humanish.oss-host-actor-plan.v1"; generatedAt: string; personas: Array<{ id: string; name: string; intent: string; traits: string[]; }>; recommendedProof: string; repo: string; scenarios: Array<{ id: string; title: string; goal: string; steps: string[]; }>; source: "local-codex-exec"; status: "passed" | "failed" | "blocked"; summary: string; } export interface OssMetaLabActorAuthPreflight { ok: boolean; reason: string; status?: number; } export interface OssMetaLabRepoAccessPreflight { ok: boolean; reason: string; repo: string; streamId: string; tokenPresent: boolean; } export interface OssMetaLabScreenshot { capturedAt: string; observerUrl: string; path: string; } export interface OssMetaLabResult { schema: typeof OSS_META_LAB_SCHEMA; ok: boolean; assignments: OssMetaLabAssignment[]; count?: number; cwd: string; dryRun: boolean; error?: { code: "HUMANISH_LAB_ANALYSIS_INVALID" | "HUMANISH_LAB_ANALYSIS_UNSUPPORTED" | "HUMANISH_LAB_COMMS_UNSUPPORTED" | "HUMANISH_LAB_TASKS_UNSUPPORTED" | "HUMANISH_INVALID_OSS_COUNT" | "HUMANISH_INVALID_OSS_REPO" | "HUMANISH_OSS_META_LIVE_ISOLATION_REQUIRED" | "HUMANISH_META_RUN_FAILED"; message: string; }; liveRequested: boolean; observer?: ObserverResult; repos: string[]; runId?: string; sandboxes: Array<{ actorStatus?: OssMetaLabActorStatus; appStatus?: OssMetaLabAppStatus; bootstrapStatus?: "started" | "failed"; completionReason?: string; completionStatus?: OssMetaLabCompletionStatus; repo: string; screenshotPresent?: boolean; sandboxId?: string; streamId: string; urlPresent: boolean; visualStatus?: OssMetaLabVisualStatus; visualWindowCount?: number; }>; warnings: string[]; } interface ExecFileAsyncOptions { cwd?: string; env?: NodeJS.ProcessEnv; maxBuffer?: number; timeout?: number; } type ExecFileAsyncImpl = (file: string, args: readonly string[], options: ExecFileAsyncOptions) => Promise<{ stderr: string | Buffer; stdout: string | Buffer; }>; export declare function buildOssRepoAssignments(repos: string[], count: number): OssMetaLabAssignment[]; export declare function collectOssMetaLabRemoteEnv(env: NodeJS.ProcessEnv): Record; export declare function preflightOssMetaRepoAccess(args: { assignments: OssMetaLabAssignment[]; cwd: string; env: NodeJS.ProcessEnv; execFileImpl?: ExecFileAsyncImpl; redactRepoNames?: boolean; }): Promise; export declare function preflightOssMetaActorApiKey(args: { env: NodeJS.ProcessEnv; fetchImpl?: typeof fetch; }): Promise; export declare function normalizeHostActorRecommendedProof(value: unknown): string; /** * Wrapped so a DIRECT library caller gets the same status-record lifetime the CLI does: returning * from this function finalizes any record the run opened, whichever of its fail-closed exits it * took. `runLab` establishes a scope too and nesting is harmless — the inner scope owns what it * opened. Without this a test or an adopter calling the backend directly leaves the 5s cadence * ticking into a directory something else is deleting, which surfaces as an unrelated ENOTEMPTY. */ export declare function runOssMetaLab(options: OssMetaLabOptions): Promise; export declare function publicSafeOssMetaBundle(bundle: RunBundle): RunBundle; export declare function startOssMetaLabLiveRefresh(result: OssMetaLabResult, options?: { intervalMs?: number; screenshotIntervalMs?: number; timeoutMs?: number; }): OssMetaLabLiveRefreshController | null; export interface OssMetaLabProviderListRequest { metadata: Record; requestTimeoutMs: number; } export declare function cleanupStaleOssMetaLabSandboxes(options?: { killSandbox?: (sandboxId: string, requestTimeoutMs: number) => Promise; listSandboxes?: (request: OssMetaLabProviderListRequest) => Promise; requestTimeoutMs?: number; }): Promise; export declare function cleanupOssMetaLabSandboxesAndProviderMatches(result: Pick, options?: { killSandbox?: (sandboxId: string, requestTimeoutMs: number) => Promise; listSandboxes?: (request: OssMetaLabProviderListRequest) => Promise; requestTimeoutMs?: number; }): Promise; export declare function cleanupOssMetaLabSandboxes(result: Pick, _options?: { killSandbox?: (sandboxId: string, requestTimeoutMs: number) => Promise; redactIds?: boolean; requestTimeoutMs?: number; }): Promise; export declare function buildOssMetaBundleFixture(args: { assignments: OssMetaLabAssignment[]; createdAt: string; cwd: string; dryRun: boolean; lanes: Array<{ actorEvidence?: OssMetaLabActorEvidenceArtifacts; bootstrap?: OssMetaLabBootstrap; completion?: OssMetaLabCompletion; error?: string; hostActorPlan?: OssMetaLabHostActorPlan; hostActorPlanPath?: string; repo: string; screenshot?: OssMetaLabScreenshot; sandboxId?: string; simId: string; streamId: string; url?: string; }>; liveRequested: boolean; missingKeys: string[]; redactRepoNames?: boolean; runId: string; }): RunBundle; export declare function buildOssMetaBootstrapScriptFixture(): string; export {};