import { URI } from "../../../../../../base/common/uri.js"; import { ILogService } from "../../../../../../platform/log/common/log.service.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { ITelemetryService } from "../../../../../../platform/telemetry/common/telemetry.service.js"; import { IAgentConnection } from "../../../../../../platform/agentHost/common/agentService.js"; export declare function primeLegacyMigrationStartupSnapshot(configurationService: IConfigurationService): void; export declare function isLegacyMigrationEnabledAtStartup(configurationService: IConfigurationService): boolean; /** * How long an adoption probe may take before falling back to the legacy resource. * * Right after migration is enabled on a large catalogue the host is still busy * discovering thousands of sessions, so even an interactive open can hit a cold * host; a too-short bound makes it fall back to the read-only legacy session * instead of the migrated one. Restore is the fully-cold case (startup), so it * gets the larger budget. */ export declare const LEGACY_MIGRATION_TIMEOUT_MS = 30000; export declare const LEGACY_MIGRATION_RESTORE_TIMEOUT_MS = 60000; /** * Budget for an explicit, user-initiated open. Migration is invisible to the user, so we * prefer to wait for the adopted session to surface (shown under a subtle progress hint) * rather than fall back to the pre-migration view they did not ask for. A declined or * external session still resolves quickly via the error signal, so only a genuinely * still-warming host uses the full budget. */ export declare const LEGACY_MIGRATION_OPEN_TIMEOUT_MS = 60000; /** Where a probe was triggered from, so outcomes can be attributed per entry point. */ export type LegacyMigrationProbeSource = "open" | "restore"; /** * Redirects a legacy extension-host Copilot CLI resource to its agent-host twin, * adopting it on the way, or `undefined` to leave the caller's resource alone. * * Subscribing to the twin is what performs adoption: the host restores the * session, which runs its own provenance and working-directory checks. A session * that is not ours to adopt fails that subscribe and falls back to the legacy * resource, so an external session is never worse off than it is today. * * A failure is deliberately not remembered. The host maps every restore failure * to `SessionNotFound`, so a refusal is indistinguishable from a transient one * (host restarting, still starting up) — caching it would silently pin a session * to the legacy path for the rest of the window's life. Probes only happen on an * explicit open, so retrying costs little. */ export declare function adoptLegacyCopilotCliResource(connection: IAgentConnection | undefined, resource: URI, logService: ILogService, configurationService: IConfigurationService, telemetryService: ITelemetryService, source: LegacyMigrationProbeSource, timeoutMs?: number): Promise; /** * Which list row a migration open started from. An agent-host row carries the * exact backend session URI, so its report correlates with the host's event * however the host addresses the session. */ export type LegacyMigrationOpenRow = { readonly entry: "legacyRow"; } | { readonly entry: "agentHostRow"; readonly backendSession: URI; }; /** * Records whether an adopted session was opened as its migrated twin. Adoption * succeeding does not mean the caller could open it, and that fallback is the * failure this telemetry exists to catch. */ export declare function reportLegacyMigrationOpen(telemetryService: ITelemetryService, source: LegacyMigrationProbeSource, resource: URI, surfaced: boolean, error?: unknown, row?: LegacyMigrationOpenRow): void;