import type { RequestCredential } from "../token-scope";
import type { Viewer } from "~/lib/types";
/** Stateless revision: no sessions, `server/discover`, `subscriptions/listen`, multi round-trip requests. */
export const MODERN_VERSION = "2026-07-28";
/** Session-era revisions: `initialize`, `Mcp-Session-Id`, GET stream with `Last-Event-ID` resumption. */
export const LEGACY_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26"] as const;
export const SUPPORTED_VERSIONS: string[] = [MODERN_VERSION, ...LEGACY_VERSIONS];
export const SERVER_INFO = { name: "gitfor", title: "gitfor forge", version: "1.0.0" };
export const META = {
protocolVersion: "io.modelcontextprotocol/protocolVersion",
clientInfo: "io.modelcontextprotocol/clientInfo",
clientCapabilities: "io.modelcontextprotocol/clientCapabilities",
serverInfo: "io.modelcontextprotocol/serverInfo",
subscriptionId: "io.modelcontextprotocol/subscriptionId",
} as const;
export const RPC = {
parse: -32700,
invalidRequest: -32600,
methodNotFound: -32601,
invalidParams: -32602,
internal: -32603,
headerMismatch: -32020,
missingCapability: -32021,
unsupportedVersion: -32022,
} as const;
export const SERVER_INSTRUCTIONS = [
"gitfor is a git forge. Every tool call is limited by the repositories and scopes you were granted.",
"Before editing, claim the files you will touch with claim_files so concurrent agents see your intent;",
"release them when done. Work on a branch from create_workspace, commit with commit_files, then open_pull.",
"Subscribe to repository events with subscribe_events and poll_events (or resources/subscribe on",
"gitfor-events://{owner}/{repo}) to react to pushes, reviews and CI.",
].join(" ");
export type JsonRpcId = string | number;
export type JsonObject = Record<string, unknown>;