import { type CompletionResult, type ExtensionRef, type FlagValues, type ManagedLifecycleHandoff, type ParsedArgs } from "@cotal-ai/core"; import { type OutputWarning } from "@cotal-ai/workspace"; import { type ManagerRequestIntent, type ManagerRequestReceipt } from "../lib/control.js"; import { type UserBundle } from "./meshes-add.js"; export declare function enrollmentInput(env?: NodeJS.ProcessEnv): string | undefined; export declare function scrubEnrollmentEnv(env: Record | undefined): void; export interface EnrollmentBundle extends RemoteAgentMaterial { space: string; brokerAccess: { kind: string; [key: string]: unknown; }; authServiceUrl: string; idp: { url: string; issuer: string; audience: string; }; server?: string; tlsRequired?: boolean; userAuth?: unknown; policy?: unknown; } export declare function checkEnrollmentBundle(raw: unknown, actor: string): { bundle: EnrollmentBundle; stock?: UserBundle; }; /** Map a parsed handoff onto the redeem consumer's shapes. Pure. */ export declare function handoffEnrollmentBundle(h: ManagedLifecycleHandoff): { bundle: EnrollmentBundle; stock: UserBundle; }; /** Completion for `cotal spawn` — `--space ` lists the running meshes, and the first positional * is a persona from the mesh this spawn would target. Resolved OFFLINE (registry + `current`, no * probe — a must stay cheap and never open the network), so it lists the *target* mesh's * personas, not the cwd's. */ export declare function spawnComplete(argv: string[]): CompletionResult; export { spawnPersona } from "../lib/spawn-defaults.js"; /** `cotal spawn`'s grammar: managed launch/attach by default, explicit native foreground, * and one positional persona or explicit persona file. Declared `as const` so the values cast * below is compile-checked against exactly these specs. Foreground and detached parse the SAME * flags — the old `spawn` vs `start` ability drift is structurally gone. */ export declare const spawnFlags: readonly [{ readonly name: "space"; readonly short: "s"; readonly type: "string"; readonly value: ""; readonly description: "target space (default: the resolved mesh)"; }, { readonly name: "server"; readonly type: "string"; readonly value: ""; readonly description: "broker URL (overrides the mesh registry entry)"; }, { readonly description: "control-caller creds for an off-registry manager (managed launch only, not --foreground)"; readonly name: "creds"; readonly type: "string"; readonly value: ""; }, { readonly name: "name"; readonly short: "n"; readonly type: "string"; readonly value: ""; readonly description: "presence name override; does not choose the persona"; }, { readonly name: "config"; readonly type: "string"; readonly value: ""; readonly description: "persona catalog name or file path; defaults from COTAL_DEFAULT_PERSONA"; }, { readonly name: "agent"; readonly type: "string"; readonly value: ""; readonly description: "connector type (claude, opencode, hermes \u2026); defaults from COTAL_DEFAULT_AGENT"; }, { readonly name: "role"; readonly type: "string"; readonly value: ""; readonly description: "role override (wins over the agent file's role:)"; }, { readonly name: "model"; readonly short: "m"; readonly type: "string"; readonly value: ""; readonly description: "model override (wins over the agent file's model:)"; }, { readonly name: "variant"; readonly type: "string"; readonly value: ""; readonly description: "model variant override (connector-defined; wins over the agent file's variant:)"; }, { readonly name: "opt"; readonly type: "string"; readonly multiple: true; readonly value: ""; readonly description: "connector-specific launch option (repeatable); wins per-key over the agent file's launchOptions:"; }, { readonly name: "cwd"; readonly short: "C"; readonly type: "string"; readonly value: ""; readonly description: "working directory to root the agent at"; }, { readonly name: "prompt"; readonly short: "p"; readonly type: "string"; readonly value: ""; readonly description: "initial prompt auto-submitted at start"; }, { readonly name: "resume"; readonly type: "string"; readonly value: ""; readonly description: "fork an existing session id into the mesh (only where the connector declares resume support; detached: pair with --cwd)"; }, { readonly name: "events"; readonly type: "boolean"; readonly description: "force the session's AG-UI event plane on (already the default where supported)"; }, { readonly name: "no-events"; readonly type: "boolean"; readonly description: "opt out of the session's AG-UI event plane"; }, { readonly name: "share-tools"; readonly type: "string"; readonly value: ""; readonly description: "share named operator MCP servers with the agent"; }, { readonly name: "subscribe"; readonly type: "string"; readonly value: ""; readonly description: "channel read set override"; }, { readonly name: "allow-subscribe"; readonly type: "string"; readonly value: ""; readonly description: "read ACL override"; }, { readonly name: "allow-publish"; readonly type: "string"; readonly value: ""; readonly description: "post ACL override"; }, { readonly name: "harness"; readonly short: "H"; readonly type: "string"; readonly value: ""; readonly description: "application connector; an explicit flag wins over persona and saved defaults"; }, { readonly name: "foreground"; readonly type: "boolean"; readonly description: "run the native application directly; terminal exit may end it"; }, { readonly name: "restarts"; readonly type: "string"; readonly value: ""; readonly description: "maximum manager-supervised restarts in the selected restart window"; }, { readonly name: "restart-window"; readonly type: "string"; readonly value: ""; readonly description: "time window for --restarts; both flags are required together"; }, { readonly name: "json"; readonly short: "j"; readonly type: "boolean"; readonly description: "structured output on stdout"; }, { readonly name: "plain"; readonly type: "boolean"; readonly description: "plain line-oriented output"; }, { readonly name: "detach"; readonly type: "boolean"; readonly short: "d"; readonly description: "launch through the manager, await readiness and return without attaching"; }, { readonly name: "live-only"; readonly type: "boolean"; readonly description: "foreground only: skip the durable backstop (no read-ACL row; messages missed while disconnected are not replayed)"; }, { readonly name: "file"; readonly type: "string"; readonly short: "f"; readonly value: ""; readonly description: "persona file on the execution host; never a manifest deploy or implicit upload"; }, { readonly name: "dry-run"; readonly type: "boolean"; readonly description: "preview the launch without allocation, provisioning or starting an application"; }, { readonly name: "enrollment-file"; readonly type: "string"; readonly value: ""; readonly description: "with --foreground: protected file holding this one seat's enrollment URL; never print or forward it"; }, { readonly name: "allow-stale"; readonly type: "string"; readonly value: ""; readonly description: "refused: a manifest deployment option; use cotal team deploy "; }, { readonly name: "runtime"; readonly type: "string"; readonly value: ""; readonly description: "refused: a manifest deployment option; use cotal team deploy "; }, { readonly name: "on"; readonly type: "string"; readonly value: ""; readonly description: "managed launch only: launch through one manager instance, by the id `ps` prints, in a space with several managers; by default any one takes it"; }, { readonly name: "expect-owner"; readonly type: "string"; readonly value: ""; readonly description: "with COTAL_MANAGED_HANDOFF_FILE: the owner the managed handoff must carry"; }, { readonly name: "expect-lifecycle-uid"; readonly type: "string"; readonly value: ""; readonly description: "with COTAL_MANAGED_HANDOFF_FILE: the lifecycle UID the managed handoff must carry"; }]; /** Check the public mode and spelling before catalog preparation or identity allocation. */ export declare function validateSpawnArguments(args: ParsedArgs): void; /** Foreground `cotal spawn` resolves its `--agent` connector from the registry (spawn.ts below); on * the published binary nothing static-imports connectors, so the resolved one is materialized as a * required extension (seeded or `ext add`ed), failing loud if absent. The `-f` manifest launch * preflights every type via `preflightConnectors`, and `--detach` resolves the connector * manager-side, so both skip this. * * #869: the persona file's `agent:` pin participates — flag > file > COTAL_DEFAULT_AGENT > default * — but the pin is only knowable from the TARGET mesh's root, which `resolveTargetOrExit` owns and * this pre-parse hook cannot reach without duplicating the five-tier target precedence. An earlier * revision read the persona from the cwd walk here; that made a spawn from a cwd outside the * target pre-materialize the WRONG connector, and a wrong pre-materialization hard-aborts the * command (materializeExtension throws on an uninstalled extension) before the body ever loads * the correct persona. The materialization is therefore DEFERRED into the spawn body, immediately * after the authoritative persona load and before registry.resolve — one resolver, one root, and * the hook stays root-free exactly as it was before #869. */ export declare function spawnRequiredExtensions(_args: ParsedArgs): readonly ExtensionRef[]; export interface ManagedLaunchResult { kind: "managed-launch"; name: string; id: string; lifecycleUid: string; space: string; managerInstanceId: string; harness: string; runtime: string; role: string | null; request: ManagerRequestReceipt | null; intent: ManagerRequestIntent | null; readiness: "joined"; requestedModel: string | null; detached: boolean; } export interface ManagedLaunchObserver { /** A native joined receipt, not task completion. A composite command owns its one envelope. */ ready(result: ManagedLaunchResult, warnings: readonly OutputWarning[]): void; } /** Shared managed launch. The manager resolves its persona and returns real readiness before * any view opens. Detach changes terminal attachment, not the launch or caller authority. */ export declare function launchManagedPersona(values: FlagValues, positionals: string[], events: boolean | undefined, launchOptions: Record | undefined, observer?: ManagedLaunchObserver): Promise; /** * `cotal spawn [] [--file ]` launches through the manager and attaches * to its allocated incarnation. `--detach` returns after readiness; `--foreground` explicitly * runs the native application in this terminal. File validation belongs to that execution host. * * The launch recipe is the connector's `buildLaunch` (the single source of truth, * shared with the manager); only *how the spec runs* differs — foreground exec * here vs. a supervised runtime in the manager. The connector is resolved from * the registry by agent type, composed at the root. * * The mesh it joins — creds and personas together — is resolved by {@link resolveMeshTarget}, so a * bare `cotal spawn ` from any directory finds the running mesh (one up, or the `current` * default) instead of mistaking `~/.cotal` for a space. */ export declare function spawn(args: ParsedArgs): Promise; /** What a remote mesh's agent-provisioning endpoint returns (U6 §2). The client validates every * field it uses: this arrives over the network from a deployment, so a missing or wrong-typed * piece must be a named refusal here, never an `undefined` written into a 0600 file. */ interface RemoteAgentMaterial { actor: string; owner: string; lifecycleUid: string; actorToken: string; sentinelCreds: string; subscribe?: string[]; allowSubscribe?: string[]; allowPublish?: string[]; } /** Run the one-shot bearer proof with an explicit credential-scrubbed environment. The enrollment * path removes the variables from the parent before any child, and this boundary independently * refuses to inherit them if another caller reaches it with ambient enrollment input. */ export declare function runBearerPreflight(bearerCmd: string[], env?: NodeJS.ProcessEnv): Promise; //# sourceMappingURL=spawn.d.ts.map