import { IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { IAgentConnection } from "../../../../platform/agentHost/common/agentService.js"; import { ILocalModelStatusV1, ILocalModelConsent } from "../../../../platform/agentHost/common/localModel.js"; import { URI } from "../../../../sessions/sessions.web.main.internal.js"; import { ILocalModelInteractionHandler, LocalModelSendCheck } from "./localModelService.js"; export declare const ILocalModelService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; /** * The workbench side of on-device models. Status is held per Agent Host connection, so a host that doesn't publish it * reads as `undefined` and the local host's state never bleeds into another target; actions go to the connection the * status came from. Boolean results are `true` when the request was sent. */ export interface ILocalModelService { readonly _serviceBrand: undefined; /** The status published by `connection`'s host, validated. */ getStatus(connection: IAgentConnection): IObservable; /** Registers the confirmation UI. Only one handler is active; the last registration wins. */ registerInteractionHandler(handler: ILocalModelInteractionHandler): IDisposable; /** Sends `setUp` with the consent the user gave on the family's detail page, computed from the status that page showed. */ setUp(connection: IAgentConnection, familyId: string, consent: ILocalModelConsent): boolean; /** Sends `makeActive` without asking: the host unloads the active model after its running responses finish, then loads this one. */ makeActive(connection: IAgentConnection, familyId: string): boolean; cancel(connection: IAgentConnection, operationId: string): boolean; pause(connection: IAgentConnection, operationId: string): boolean; resume(connection: IAgentConnection, operationId: string): boolean; retry(connection: IAgentConnection, operationId: string): boolean; start(connection: IAgentConnection): boolean; /** Stops the active model's server; pending, as {@link getLocalModelServerStopId}, until its state changes. */ stop(connection: IAgentConnection): boolean; /** Asks first, then cancels the running responses of a drain. */ stopNow(connection: IAgentConnection): Promise; /** * Stops sent but not yet reflected in `connection`'s status, so every surface can acknowledge the click at once: * operation ids, {@link getLocalModelStopNowId} and {@link getLocalModelServerStopId} keys. Each stops being pending * once the state it should change changes, or after a few seconds. */ getPendingStops(connection: IAgentConnection): IObservable>; update(connection: IAgentConnection, familyId: string): boolean; /** Asks first (with usage counts), then `remove`. */ remove(connection: IAgentConnection, familyId: string): Promise; stopPrevious(connection: IAgentConnection): boolean; refreshCatalog(connection: IAgentConnection): boolean; /** Sends `setContextSize` with one of the installed family's context options; the host reloads a loaded model once its running responses finish. */ setContextSize(connection: IAgentConnection, familyId: string, tokens: number): boolean; /** Writes `chat.copilot.localModel.useInAuto` (the picker's inline toggle). */ setUseInAuto(value: boolean): Promise; /** Pre-send guard for a chat on `connection` whose selected model is `selectedModelId` (the agent-host row id, not a vendor-qualified id). */ checkBeforeSend(connection: IAgentConnection, sessionResource: URI, selectedModelId: string | undefined): Promise; }