UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

64 lines • 3.63 kB
import type { Client } from "@modelcontextprotocol/sdk/client/index.js"; import type { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js"; import type { McpMrtrPresentation } from "../../../mcp-mrtr-presentations.ts"; import type { McpFormPresentation } from "../../../mcp-form-types.ts"; import type { ExtensionUIContext } from "../../types.ts"; import type { ServerConnection } from "./connection.ts"; declare const originOption: unique symbol; export declare const physicalMcpClient: (client: Client) => Client; export declare function registerMcpClientAlias(alias: Client, physical: Client): void; export interface McpRequestOrigin { readonly binding: object; readonly connection: ServerConnection; readonly signal: AbortSignal; readonly presentation?: McpMrtrPresentation; readonly privateForm?: McpFormPresentation; readonly privateFormsEnforced?: boolean; readonly serverLabel: string; readonly serverSource?: "user" | "project" | "plugin"; /** The execution scope whose call made this request, when its binding serves several (brain/hand S16c). */ readonly scope?: object; readonly elicitationUi?: () => Pick<ExtensionUIContext, "input" | "select"> | undefined; readonly isCurrent: () => boolean; readonly resolveAuthority: (signal: AbortSignal) => Promise<unknown>; } /** A request's origin, resolved for the context of the call that makes it (absent for prompts and resources). */ export type McpRequestOriginFor = (caller?: { readonly sessionManager?: object; }) => McpRequestOrigin | undefined; export declare function beginLegacyMcpOperation(client: Client, origin: McpRequestOrigin, caller?: AbortSignal): () => void; export declare function legacyMcpOperation(client: Client): "ambiguous" | { readonly origin: McpRequestOrigin; readonly signal: AbortSignal; } | undefined; /** Record a scoped tool call in flight on `client` until the returned function runs; an unscoped origin records none. */ export declare function beginScopedMcpCall(client: Client, origin: McpRequestOrigin, signal?: AbortSignal): () => void; /** * Whose UI a legacy form arriving on `client` belongs to: the one scope whose calls are in flight there, or * `"refuse"` when calls of different scopes share it. Without scoped calls the caller keeps its own provider. */ export declare function legacyMcpCallerUi(client: Client): "refuse" | { ui: Pick<ExtensionUIContext, "input" | "select"> | undefined; } | undefined; /** Issued by the binding-specific registration boundary, never from JSON/model arguments. */ export declare function createMcpRequestOrigin(origin: McpRequestOrigin): McpRequestOrigin; export declare function mcpRequestOptions(origin: McpRequestOrigin | undefined, options?: RequestOptions): RequestOptions & { [originOption]?: McpRequestOrigin; }; export declare function takeMcpRequestOrigin(options: RequestOptions | undefined, client: Client): { origin: McpRequestOrigin | undefined; sdkOptions: { relatedRequestId?: import("@modelcontextprotocol/sdk/types").RequestId; resumptionToken?: string; onresumptiontoken?: (token: string) => void; onprogress?: import("@modelcontextprotocol/sdk/shared/protocol.js").ProgressCallback; signal?: AbortSignal; timeout?: number; resetTimeoutOnProgress?: boolean; maxTotalTimeout?: number; task?: import("@modelcontextprotocol/sdk/types").TaskCreationParams; relatedTask?: import("@modelcontextprotocol/sdk/types").RelatedTaskMetadata; }; }; export {}; //# sourceMappingURL=request-origin.d.ts.map