/** * Server capability probe (Issue #1925, design §4 D5 決定 1 / §10.6 / DR4-007). * * The CLI is routinely newer than the server it talks to: `npm i -g commandmate` * replaces the CLI without restarting a running daemon, and `api-responses.ts` * says so in two places. So a CLI that starts depending on a new endpoint has to * find out whether the server has it — and it cannot find that out from the * endpoint's own 404, because Next.js answers an unimplemented App Router path * with a bare 404 that is indistinguishable from "that worktree does not exist". * * The rule this module exists to enforce is the one that is easy to get wrong: * **anything other than a real 404 is not permission to resolve locally.** The * local path is a degraded resolver (design §4 D5 決定 1: it has no * primary-anchor stage), so quietly falling back on a 302-to-/login or on an * HTML error page from a reverse proxy would change where `send` and `respond` * land — and would do it precisely when something in the middle of the * connection is behaving unexpectedly. Those cases end the command instead. */ import { type ApiClient } from './api-client'; /** Path of the capability endpoint (`src/app/api/capabilities/route.ts`). */ export declare const CAPABILITIES_PATH = "/api/capabilities"; /** * Capability token declared by a server that can resolve session targets. * Mirrors SERVER_CAPABILITIES in the route; the CLI keeps its own copy of API * constants (see api-responses.ts) rather than importing across the boundary. */ export declare const RESOLVE_SESSION_TARGET_CAPABILITY = "resolve-session-target"; /** Outcome of the probe. Auth failures and undeterminable servers throw instead. */ export type ServerCapabilityProbe = { kind: 'supported'; serverVersion: string; capabilities: string[]; } /** A real 404: this server predates `/api/capabilities`. */ | { kind: 'legacy'; }; /** * Ask the server what it supports, once per client. * * @param client - API client aimed at the server * @returns Whether the server has the capability endpoint at all * @throws ApiError on 401/403, and on any response that cannot be classified */ export declare function probeServerCapabilities(client: ApiClient): Promise; /** Drop every memo. Exists for tests that reuse one client across scenarios. */ export declare function resetServerCapabilityProbe(): void; /** * Whether this server can resolve session targets for the CLI. * * @param client - API client aimed at the server * @returns true when the server declares {@link RESOLVE_SESSION_TARGET_CAPABILITY} * @throws ApiError on 401/403 and on an unclassifiable response */ export declare function serverResolvesSessionTargets(client: ApiClient): Promise; //# sourceMappingURL=server-capabilities.d.ts.map