包含 extensions、skills、prompts、settings、auth、models、mcp 等配置。 排除 node_modules、npm 缓存、sessions 等运行时数据。
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
import type { ConsentManager } from "./consent-manager.ts";
|
|
import type { McpLifecycleManager } from "./lifecycle.ts";
|
|
import type { McpServerManager } from "./server-manager.ts";
|
|
import type { ToolMetadata, McpConfig, UiSessionMessages, UiStreamSummary } from "./types.ts";
|
|
import type { UiResourceHandler } from "./ui-resource-handler.ts";
|
|
import type { UiServerHandle } from "./ui-server.ts";
|
|
|
|
export interface CompletedUiSession {
|
|
serverName: string;
|
|
toolName: string;
|
|
completedAt: Date;
|
|
reason: string;
|
|
messages: UiSessionMessages;
|
|
stream?: UiStreamSummary;
|
|
}
|
|
|
|
export type SendMessageFn = (
|
|
message: {
|
|
customType: string;
|
|
content: Array<{ type: "text"; text: string }>;
|
|
display?: string;
|
|
details?: unknown;
|
|
},
|
|
options?: { triggerTurn?: boolean }
|
|
) => void;
|
|
|
|
export interface McpExtensionState {
|
|
manager: McpServerManager;
|
|
lifecycle: McpLifecycleManager;
|
|
toolMetadata: Map<string, ToolMetadata[]>;
|
|
config: McpConfig;
|
|
failureTracker: Map<string, number>;
|
|
uiResourceHandler: UiResourceHandler;
|
|
consentManager: ConsentManager;
|
|
uiServer: UiServerHandle | null;
|
|
completedUiSessions: CompletedUiSession[];
|
|
openBrowser: (url: string) => Promise<void>;
|
|
ui?: ExtensionContext["ui"];
|
|
sendMessage?: SendMessageFn;
|
|
}
|