import { type AutomaticAnalysisHooks, type AutomaticAnalysisResult } from "./automatic-analysis-completion.js"; import { type RunLabProvenance } from "./run-status.js"; import { type CuaActorDescriptor } from "./actor-registry.js"; import { type CuaLaneSpec, type LaneRunOutcome } from "./cua-actor-lab.js"; import { type LabActorLane, type LabConfig } from "./lab-config.js"; import { type ObserverResult } from "./observer.js"; import { type SharedWorldLabHooks } from "./shared-world-lab.js"; import { type RunBundle, type RunScorerProvenance, type RunSubjectProvenance, type SharedWorldStateSnapshot } from "./run.js"; export declare const CONCURRENT_SHARED_WORLD_LAB_SCHEMA = "humanish.concurrent-shared-world-lab-result.v1"; export declare const CONCURRENT_SHARED_WORLD_PROVIDER_METADATA: { readonly mode: "concurrent-shared-world-lab"; readonly tool: "humanish"; }; export declare const CONCURRENT_ATTRIBUTION_LIMITS: readonly ["concurrent", "best-effort-causal-attribution", "non-deterministic-shared-state", "window-and-snapshot-granularity", "contention-observed-not-proven-safe", "state-change-not-isolated-to-actors"]; export interface RunConcurrentSharedWorldLabOptions { automaticAnalysis?: AutomaticAnalysisHooks; /** Which manifest produced this run (#455); threaded into the status record + bundle. */ lab?: RunLabProvenance; cwd: string; config: LabConfig; /** Resolved upstream (scenario.mode + CLI override); defaults safe (dry-run). */ dryRun: boolean; open?: boolean; runId?: string; onObserverReady?: (observer: ObserverResult & { ok: true; }) => Promise | void; hooks?: SharedWorldLabHooks; /** Present only when the browser-route scorer hooks were CONFIG-DECLARED and loaded by the CLI * (#316); core-stamped onto the bundle as evidence. Absent for library callers. */ scorerProvenance?: RunScorerProvenance; } export type ConcurrentSharedWorldLabErrorCode = "HUMANISH_LAB_ANALYSIS_INVALID" | "HUMANISH_LAB_TASKS_UNSUPPORTED" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_FAILED" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_ACTOR_UNSUPPORTED" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_INVALID" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_KEYS_MISSING" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_SUBJECT_ENV_MISSING" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_GETHOST_UNAVAILABLE" | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_HANDOFF_TIMEOUT" /** A declared adopter-hosted comms catch (#328) did not answer as a humanish catch — fail closed * BEFORE any actor spend, since the funnel would silently collect nothing. */ | "HUMANISH_CONCURRENT_SHARED_WORLD_LAB_COMMS_CATCH_UNREACHABLE"; /** The two plane classes of the concurrent shared-world route (#164 phase 2). */ export type ConcurrentSharedWorldPlaneClass = "provisioned-getHost" | "external-public"; export declare const EXTERNAL_PUBLIC_ATTRIBUTION_LIMITS: readonly ["concurrent", "best-effort-causal-attribution", "non-deterministic-shared-state", "window-and-snapshot-granularity", "contention-observed-not-proven-safe", "state-change-not-isolated-to-actors", "external-public-plane", "operator-attested-target-not-harness-controlled", "no-synthetic-attestation", "no-authoritative-shared-state-proof", "concurrency-by-temporal-co-occupancy-only"]; /** * The lobby-trivia (and general "/lobby/CODE") shared-session URL matcher. A code is exactly 6 chars of * the [A-Z2-9] class; a locale prefix (/en/lobby/…) and a query/hash suffix are tolerated. RUNTIME-ONLY * input (a live location.href); only the extracted CODE is used, and it lands only as a digest. */ export declare const LOBBY_CODE_PATTERN: RegExp; /** Extract the shared-session CODE from a (runtime-only) observed URL, or undefined. Exported for the * handoff regex table test — pure, no side effects, never persists its input. */ export declare function extractLobbyCode(url: string | undefined): string | undefined; export declare function extractLobbyCodeFromNarration(text: string | undefined): string | undefined; /** Pull the assistant's plain text out of an OpenAI Responses API body (`output_text` convenience * field, else the concatenated `output[].content[].text`). Tolerant of shape drift; pure. */ export declare function extractResponsesOutputText(parsed: unknown): string | undefined; /** Parse a vision reply into a lobby CODE. PRECISION-FIRST: accept ONLY when the whole reply IS the * six-character code, or when it echoes an explicit /lobby/CODE — never a bare 6-letter token buried in * prose (e.g. "I see a home SCREEN"), because a wrong latch fails the entire run, whereas a miss just * retries on the next frame while the host keeps waiting. NONE (the instructed "no code" reply) is * rejected. Pure. */ export declare function parseLobbyCodeReply(reply: string | undefined): string | undefined; export interface ReadLobbyCodeOptions { model?: string; endpoint?: string; fetchFn?: typeof fetch; signal?: AbortSignal; } /** * Vision-read a lobby CODE straight off a host waiting-room FRAME (the robust, CDP-independent handoff * relay). Fail-soft: any network/HTTP/parse problem returns undefined so the caller simply retries on * the next frame. The frame is runtime-only; only the extracted code is used (as a digest downstream). */ export declare function readLobbyCodeFromFrame(frame: Buffer, apiKey: string, options?: ReadLobbyCodeOptions): Promise; /** One persona's OUTCOME against the contended world (the "M of N" headline). */ export interface ConcurrentSharedWorldRoleResult { id: string; index: number; persona: string; status: string; ok: boolean; /** The harness-clocked [start,end] window the orchestrator measured (live). */ window?: { startedAt: number; endedAt: number; }; session?: { status: string; completionReason: string; reason: string; screenshots: number; }; /** The actor sandbox lifecycle proof (the getHost/key value is never surfaced here). */ sandbox?: { sandboxId: string; killed: boolean; }; error?: { code: ConcurrentSharedWorldLabErrorCode; message: string; }; } export interface ConcurrentSharedWorldLabResult extends AutomaticAnalysisResult { schema: typeof CONCURRENT_SHARED_WORLD_LAB_SCHEMA; ok: boolean; cwd: string; labId: string; actor: string; topology: "shared-world"; topologyMode: "concurrent"; /** The DECLARED number of persona seats. */ roleCount: number; /** Effective in-flight bound (execution.concurrency). */ concurrency: number; dryRun: boolean; runId: string; /** The harness-minted getHost URL the actors drove (tokenless; live only). */ host?: string; /** The ONE subject sandbox lifecycle proof. */ subjectSandbox?: { sandboxId: string; killed: boolean; }; /** Whether ≥2 actor windows overlapped in time (proven concurrency; live only). */ overlapProven?: boolean; /** Max lanes observed live at the same instant (live only) — the honest simultaneity number; a * 6-lane run capped at 3 reports 3 here, never 6 (#350). */ maxSimultaneousLanes?: number; /** Subject provenance (invariant 5): the ONE shared plane. */ subject?: RunSubjectProvenance; roles: ConcurrentSharedWorldRoleResult[]; observer?: ObserverResult; warnings: string[]; error?: { code: ConcurrentSharedWorldLabErrorCode; message: string; }; } /** One actor lane's measured run (internal). */ interface ActorLaneResult { spec: CuaLaneSpec; outcome: LaneRunOutcome; startedAt: number; endedAt: number; route: 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 runConcurrentSharedWorld(options: RunConcurrentSharedWorldLabOptions): Promise; /** Project the concurrent run into a humanish.run-bundle.v1 with the CONCURRENT shared-world block. */ export declare function buildConcurrentSharedWorldBundle(args: { /** Lab provenance for the bundle\'s own `lab` field (#455). */ lab?: RunLabProvenance; config: LabConfig; descriptor: CuaActorDescriptor; createdAt: string; dryRun: boolean; inProgress?: boolean; runId: string; source: RunBundle["source"]; roles: LabActorLane[]; actorSpecs: CuaLaneSpec[]; actorResults: ActorLaneResult[]; stateSnapshots: SharedWorldStateSnapshot[]; subject: RunSubjectProvenance; seedDigest: string; subjectCommit?: string; hostDigest?: string; /** Run-level digest-only comms-thread evidence path (humanish.comms-thread.v1), when a comms lab * captured mail into the subject sandbox's catch. Registered on the first persona stream (it is a * property of the ONE shared app, not of any single persona). */ commsArtifactPath?: string; /** #164 phase 2: the plane-class discriminator (default provisioned-getHost, byte-stable). */ planeClass?: ConcurrentSharedWorldPlaneClass; /** external-public only: sha256-16 of the OBSERVED origin the seats converged on (the convergence * proof — what the seats actually reached, tolerant of a declared->observed redirect). */ publicOriginDigest?: string; /** external-public only: sha256-16 of the operator-DECLARED plane origin (evidence/reference only; * NOT asserted equal to the observed origin — a cross-origin redirect is normal and expected). */ declaredOriginDigest?: string; /** external-public only: sha256-16 of the shared /lobby/CODE path all seats converged on. */ lobbyConvergenceDigest?: string; runError?: string; }): RunBundle; export {};