import type { AgentSelection, ApprovalMode, FilesystemMode, FleetPermissionMode, MonitorInterrupt, MonitorMode, ResolvedRole, SessionBackendId, UnattendedMode } from './config.js'; import type { IsolationBackendId, NetworkMode, OnUnavailable } from './isolation/types.js'; /** * Operator-facing launch configuration captured at the launch boundary from * the exact ResolvedRole that was spawned. It is the single source for every * Fleet lifecycle/report surface (CLI and owner-channel/Messenger). * * Security boundary: this object is a strict whitelist. It must never carry * env, cwd or any local path, harness_options, session_options, owner_channel, * or auth_proxy content. Hashes are secondary provenance only, never the * primary description. */ export interface AgentLaunchConfiguration { version: 1; /** Agent template / launch definition label when one was selected. */ template?: string; role: SelectionOrigin; brain: SelectionOrigin; harness: string; session: SessionBackendId; /** * Model observed effective at launch. `null` reports runtime behavior — the * harness ran its own default — not whether the author wrote `model: null` * or omitted the field; effectiveRoleModel cannot distinguish those. */ model: string | null; effort?: string; /** Concise first-line mission label (or Cowork-role fallback), never the full mission. */ mission?: string; approval: ApprovalMode; filesystem: FilesystemMode; unattended: UnattendedMode; /** Portable policy plus the exact native runtime mode after harness_options. */ permissionMode: { fleetMode: FleetPermissionMode; nativeMode: string; }; monitor: { mode: MonitorMode; interrupt: MonitorInterrupt; }; /** Requested isolation policy only — never resolved runtime facts or host paths. */ isolation?: { requested: IsolationBackendId; on_unavailable?: OnUnavailable; network?: NetworkMode; read_mounts?: number; write_mounts?: number; }; /** Present only for temporary agents; prompt bodies are never presented. */ loops?: { source: 'agent-template' | 'cli' | 'omitted'; policy: 'skip-if-busy'; entries: Array<{ name: string; enabled: boolean; intervalMs: number; initialDelayMs: number; jitterMs: number; prompt: { bytes: number; sha256: string; }; }>; }; } /** Where a Brain/Role selection came from; labels are human, hashes secondary. */ export type SelectionOrigin = { kind: 'named'; ref: string; } | { kind: 'inline'; fingerprint?: string; } | { kind: 'unknown'; }; export declare const MISSION_LABEL_MAX = 80; /** * The inline fingerprint is always computed here from the canonical inline * body; provenance can never be an arbitrary caller string. */ export declare function selectionOrigin(selection: AgentSelection | undefined): SelectionOrigin; export declare function missionLabel(mission: string | undefined): string | undefined; /** * Build the presentation from the exact resolved launch state. `origins` * carries the authoring-time selections and template label because a merged * ResolvedRole no longer distinguishes preset references from inline bodies. * `permissionMode` is required at capture time: every supported harness * adapter reports it, and the managed-spawn receiver gets it over the wire * and must never re-resolve mutable configuration. */ export declare function summarizeResolvedLaunch(role: ResolvedRole, origins: { role: SelectionOrigin; brain: SelectionOrigin; template?: string; permissionMode: { fleetMode: FleetPermissionMode; nativeMode: string; }; /** Shown when the resolved role has no mission text (e.g. Cowork role name). */ missionFallback?: string; }): AgentLaunchConfiguration; /** * Component budget for one rendered agent line. The complete mandatory * rendering must always fit — that is a validity condition of a current-v1 * configuration, enforced by mandatoryConfigurationFits at the builder AND * the wire boundary — while optional components (monitor, isolation) are * dropped whole with a visible `…` marker past this budget. */ export declare const AGENT_LINE_MAX_CODE_POINTS = 1500; export declare const AGENT_LINE_MAX_BYTES = 5000; /** * Validity condition of a current-v1 configuration: its complete mandatory * rendering fits the per-line budget with the optional-omission suffix * reserved. Escaping and code-fence growth (a value made of backticks can * more than triple its code span) make this depend on rendered size, not raw * field lengths, so both summarizeResolvedLaunch and the wire validator call * this instead of trusting per-field caps. */ export declare function mandatoryConfigurationFits(configuration: AgentLaunchConfiguration): boolean; /** * Render one agent's configuration as a single escaped Markdown line segment. * This is the only escaping boundary: callers pass raw values and must not * escape the result again (it is safe as a markdownItems entry and inside * owner-channel lifecycle messages). Every mandatory component always * renders — mandatoryConfigurationFits guarantees the fit for every produced * or wire-accepted configuration; only optional components may be dropped, * whole (never splitting a Markdown span), with a visible `…`. */ export declare function renderAgentConfiguration(configuration: AgentLaunchConfiguration | undefined, fallback?: { role?: string; brain?: string; permissions?: string; }): string;