import * as plugins from './plugins.js'; export type TAuthSwitchRequest = plugins.authswitch.TAuthSwitchServiceRequest; export type TAuthSwitchOperation = plugins.authswitch.IAuthSwitchServiceOperation; export type TAuthSwitchAccounts = plugins.authswitch.IAccountList; export type TAuthSwitchUsageWindow = plugins.authswitch.IHarnessUsageWindow; export type TAuthSwitchMutation = plugins.authswitch.TAuthSwitchMutation; export type TControllerAuthSwitchLimitsContext = | { available: true; harnessId: 'opencode'; slotId: string } | { available: true; harnessId: 'codex'; profileId: string } | { available: false; reason: 'remote_codex_profile' | 'codex_runtime_account_unresolved' | 'flex_account_unavailable' | 'opencode_provider_unresolved'; message: string }; /** * What a credential switch means for one harness, so a view never has to map harness ids to * behaviour. `liveSwap` is the adapter's own declaration, read off the harness instances the * controller runs; the restart is AGL's own doing, and only the runtime AGL manages for a harness * is stopped and restarted by it. */ export interface IControllerAuthSwitchHarness { id: string; /** Running instances pick a swapped login up on their next request, so nothing is restarted. */ liveSwap: boolean; /** AGL restarts the runtime it manages for this harness once its active work is idle. */ restartsManagedRuntime: boolean; /** Owner-supplied reason this harness cannot report subscription renewal dates. */ renewalUnavailableReason?: string; } export interface IReq_ControllerAuthSwitch extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_ControllerAuthSwitch > { method: 'controller.authswitch.request'; request: TAuthSwitchRequest; response: { operation: TAuthSwitchOperation; /** Every harness the controller offers, in the order the account list reports them. */ harnesses: IControllerAuthSwitchHarness[]; }; } /** Owner-authenticated CLI bridge; deliberately not registered as an agent MCP tool. */ export interface IReq_ControllerMcpAuthSwitch extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_ControllerMcpAuthSwitch > { method: 'agl.mcp.authswitch.request'; request: TAuthSwitchRequest; response: { operation: TAuthSwitchOperation }; }