import { TelemetryConfiguration, TelemetryLevel } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry"; import type { SessionConfigPropertySchema, SessionConfigSchema } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/commands"; /** * A schema property with a phantom TypeScript type and a precomputed * runtime validator. * * The `` type parameter is the developer's assertion about the * property's runtime shape; the validator derived from `protocol` * (`type`, `enum`, `items`, `properties`, `required`) enforces it at * runtime. */ export interface ISchemaProperty { readonly protocol: SessionConfigPropertySchema; /** * Returns `true` iff `value` conforms to {@link protocol}. Narrows * the type to `T` for callers. The boolean form is preferred for * control flow; use {@link assertValid} when you want a descriptive * error for the offending path. */ validate(value: unknown): value is T; /** * Throws a {@link ProtocolError} with `JsonRpcErrorCodes.InvalidParams` * describing the offending path (e.g. `'permissions.allow[2]'`) when * `value` does not conform to {@link protocol}. Otherwise returns and * narrows the type to `T`. * * @param path Dotted path prefix to embed in error messages. Defaults * to empty (the value itself). */ assertValid(value: unknown, path?: string): asserts value is T; } /** * Defines a strongly-typed schema property whose runtime validator is * derived from the supplied JSON-schema descriptor. */ export declare function schemaProperty(protocol: SessionConfigPropertySchema): ISchemaProperty; export type SchemaDefinition = Record>; export type SchemaValue

= P extends ISchemaProperty ? T : never; export type SchemaValues = { [K in keyof D]?: SchemaValue; }; /** * A bundle of named schema properties plus helpers for serializing to the * protocol shape, validating a values bag at write sites, and validating * a single key at read sites. */ export interface ISchema { readonly definition: D; /** Returns the protocol-serializable schema for this bundle. */ toProtocol(): SessionConfigSchema; /** * Validates each known key in `values` against its schema and returns * a new plain record. Throws a {@link ProtocolError} with a path like * `'permissions.allow[2]'` when any supplied value fails validation. * Unknown keys are passed through untouched for forward-compatibility. */ values(values: SchemaValues): Record; /** * Returns `true` iff `value` validates against the schema for `key`. * Unknown keys return `false`. */ validate(key: K, value: unknown): value is SchemaValue; /** * Throws a {@link ProtocolError} describing the offending path when * `value` does not validate against the schema for `key`, or when * `key` is not defined in the schema. */ assertValid(key: K, value: unknown): asserts value is SchemaValue; /** * Returns a fully-typed values bag by validating each key of the * schema against `values` and falling back to the default when * the incoming value is missing or fails validation. * * Semantics: for every key declared in the schema `definition`: * - if `values[key]` validates, it is kept; * - else if `key` is present in `defaults`, the default is used; * - else the key is omitted from the result. * * This means callers MAY supply defaults for only a subset of the * schema — keys not present in `defaults` are simply left unset * when the incoming value is missing or invalid. This is useful * when some properties (e.g. per-session `permissions`) should be * inherited from a higher scope rather than materialized on every * new session. * * Intended for sanitizing untrusted input at protocol boundaries * (e.g. `resolveSessionConfig`). Keys that fail validation are * silently replaced with their default or dropped; use * {@link values} or {@link assertValid} when you want a descriptive * {@link ProtocolError} instead. */ validateOrDefault; }>>(values: { [K in keyof T]?: unknown; } | undefined, defaults: T): T; } export declare function createSchema(definition: D): ISchema; export type AutoApproveLevel = "default" | "autoApprove" | "autopilot"; export type SessionMode = "interactive" | "plan"; export interface IPermissionsValue { readonly allow: readonly string[]; readonly deny: readonly string[]; } /** * Session-config properties owned by the platform itself — i.e. consumed * by the agent host rather than by any particular agent. * * Agents extend this schema by spreading `platformSessionSchema.definition` * into their own {@link createSchema} call together with any * provider-specific properties. */ export declare const platformSessionSchema: ISchema<{ autoApprove: ISchemaProperty; permissions: ISchemaProperty; mode: ISchemaProperty; }>; /** * Root (agent host) config properties owned by the platform itself. * * Root config acts as the baseline that applies to every session: * * - {@link SessionConfigKey.Permissions} — host-wide allow/deny lists * unioned with each session's own permissions when evaluating tool * auto-approval. See `SessionPermissionManager` for the evaluation * rules. */ export declare const AgentHostTelemetryLevelConfigKey = "telemetryLevel"; export declare function telemetryLevelToAgentHostConfigValue(telemetryLevel: TelemetryLevel): TelemetryConfiguration; export declare function agentHostConfigValueToTelemetryLevel(value: unknown): TelemetryLevel | undefined; export declare const platformRootSchema: ISchema<{ permissions: ISchemaProperty; telemetryLevel: ISchemaProperty; }>;