import * as Cause from "effect/Cause"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import type { OutputFormat } from "./output-mode.js"; import type { AppError } from "../app-error/index.js"; import { type KnownFailure } from "../app-error/conversions.js"; import type { SkillSelectionCancelled } from "@agentxm/workspace/skills/lifecycle/application"; import type { SubagentSelectionCancelled } from "@agentxm/workspace/subagents/lifecycle/application"; import type { InstallSelectionCancelled } from "@agentxm/workspace/lifecycle"; /** * Structural shape of the workspace configuration feature's typed * initialization cancellation. The envelope dispatches on the tag alone, so * it does not import the feature package (the transitional residue may not * depend on features). */ export interface WorkspaceInitializationCancelled { readonly _tag: "WorkspaceInitializationCancelled"; readonly message: string; } import { CommandCompletion } from "./command-completion.js"; import { type TelemetryClientOptions, type TelemetryProperties } from "../telemetry/index.js"; import { type QuestionCancelled } from "../screen/index.js"; import { Verbosity, type VerbosityLevel } from "../cli-flags/index.js"; import { Screen } from "../screen/index.js"; export interface CliTelemetryConfig { readonly mode: TelemetryClientOptions["mode"]; readonly client: TelemetryClientOptions["client"]; /** Deliver while the repository's own test run executes. Off by default. */ readonly deliverInTest?: TelemetryClientOptions["deliverInTest"]; /** Where non-identifying operating-system facts come from. */ readonly host?: TelemetryClientOptions["host"]; readonly installationId?: TelemetryClientOptions["installationId"]; readonly eventIdFactory?: TelemetryClientOptions["eventIdFactory"]; } /** * Emit a defect (unhandled panic) to the appropriate channel. * * - text: human-readable message on stderr. * - json: NDJSON `error` event on stderr + structured envelope on stdout. * * Exported for tests; production callers route through `withCliErrorHandling`. */ export declare const writeDefect: (cause: Cause.Cause, format: OutputFormat) => Effect.Effect; export type ExpectedCliError = AppError | KnownFailure | QuestionCancelled | WorkspaceInitializationCancelled | SkillSelectionCancelled | SubagentSelectionCancelled | InstallSelectionCancelled; export type CliRuntimeFoundation = Screen | Verbosity; export declare const exitCodeForSemanticProperties: (properties: TelemetryProperties) => number | undefined; /** * Emit an expected (handled) CLI error. * * Rendering is delegated to `renderAppErrorChannels` — the single source of * truth shared with the outer `classifyError`/`handleError` path — so the two * error paths cannot diverge. Suggestions appear once per channel: a single * `Next:` block in text mode, and the stderr suggestion stream plus the * stdout envelope (distinct surfaces) in json mode. The earlier bug emitted a * second `Next:` block on the same stderr channel in text mode. * * Exported for tests; production callers route through `withCliErrorHandling`. */ export declare const writeExpectedCliError: (error: ExpectedCliError, format: OutputFormat) => Effect.Effect; /** * Build the foundation layer: Screen + Verbosity. * * The returned layer requires the global verbosity flag settings in its * context when no explicit verbosity level is supplied. */ export declare const makeFoundationLayer: (format: OutputFormat, options?: { readonly envVerbose?: boolean | undefined; readonly envDebug?: boolean | undefined; readonly verbosityLevel?: VerbosityLevel | undefined; }) => Layer.Layer; /** * Resolve the output format from the global flag + options. */ export declare const resolveCliFormat: Effect.Effect; /** * Wrap a pre-provided program in CLI error handling + telemetry. * * The program should already have all its service dependencies satisfied * except for TelemetryClient (provided via telemetryLayer internally) * and HttpClient (required by the telemetry layer). * Callers compose their own layers before passing the program here. */ export declare const withCliErrorHandling: (program: Effect.Effect, options: { readonly command?: string | undefined; readonly format: OutputFormat; readonly telemetryConfig: CliTelemetryConfig; }) => Effect.Effect, import("./operation-exit.js").OperationExit | import("../telemetry/client.ts").TelemetryClient | import("./telemetry.js").ProductActivity | import("./telemetry.js").CommandSemanticProperties>>; export interface WithCliRuntimeOptions { readonly command?: string | undefined; readonly telemetryConfig: CliTelemetryConfig; } export declare const withCliRuntime: (program: Effect.Effect, options: WithCliRuntimeOptions) => Effect.Effect, import("./operation-exit.js").OperationExit | import("../telemetry/client.ts").TelemetryClient | import("./telemetry.js").ProductActivity | import("./telemetry.js").CommandSemanticProperties>, import("../screen/streams.ts").OutputStreams | Verbosity | Screen>, import("effect/Scope").Scope>>; //# sourceMappingURL=runtime-envelope.d.ts.map