/** * Memory Journal MCP Server - Resource Shared Types & Helpers * * Shared types, helpers, and utilities used by all resource group modules. */ import type { IDatabaseAdapter } from '../../database/core/interfaces.js'; import type { VectorSearchManager } from '../../vector/vector-search-manager/index.js'; import type { ToolFilterConfig } from '../../filtering/tool-filter.js'; import type { McpIcon, ProjectRegistryEntry } from '../../types/index.js'; import type { GitHubIntegration } from '../../github/github-integration/index.js'; import type { Scheduler } from '../../server/scheduler.js'; import type { ServerRuntime } from '../../utils/maintenance-lock.js'; /** Successful result from resolveGitHubRepo */ export interface GitHubRepoResolved { owner: string; repo: string; branch: string | null; lastModified: string; /** Narrowed non-null reference — safe to use without `!` after guard */ github: GitHubIntegration; } /** * Resolve GitHub owner/repo or return a ResourceResult error. * * Encapsulates the three-step guard pattern used by all GitHub resource * handlers: check github integration → getRepoInfo → validate owner/repo. * * @param github - The default GitHub integration instance * @param config - The briefing configuration containing project registry * @param targetRepo - Optional target repository name to dynamically resolve * @returns Resolved repo info, or a ResourceResult error to return directly */ export declare function resolveGitHubRepo(github: GitHubIntegration | null | undefined, config?: BriefingConfig, targetRepo?: string, runtime?: ServerRuntime): Promise; /** * Type guard: returns true if the result is a ResourceResult error. */ export declare function isResourceError(result: GitHubRepoResolved | ResourceResult): result is ResourceResult; /** * Configuration for the memory://briefing resource. * All values have sensible defaults — users opt-in via env vars or CLI flags. */ export interface BriefingConfig { /** Number of recent commits to include in git history (default: 3) */ commitCount: number; /** Number of recent journal entries to include (default: 3) */ entryCount: number; /** Number of recent session summaries to display (default: 1) */ summaryCount?: number; /** Include team DB entries in briefing preview (default: false) */ includeTeam: boolean; /** Number of open issues to list with titles; 0 = count only (default: 0) */ issueCount: number; /** Number of PRs to list with titles; 0 = count only (default: 0) */ prCount: number; /** Show PR status breakdown (open/merged/closed) instead of simple count (default: false) */ prStatusBreakdown: boolean; /** Number of milestones to list in briefing; 0 = hide (default: 3) */ milestoneCount?: number; /** Path to the user's rules file (e.g., .gemini/GEMINI.md) for awareness in briefing */ rulesFilePath?: string; /** Path to the user's skills directory for awareness in briefing */ skillsDirPath?: string; /** Number of recent workflow runs to list; 0 = latest-only status (default: 0) */ workflowCount: number; /** Show workflow run status breakdown (passing/failing/pending) (default: false) */ workflowStatusBreakdown: boolean; /** Aggregate Copilot review state across recent PRs in briefing (default: false) */ copilotReviews: boolean; /** Workflow summary string for the memory://workflows resource (env: MEMORY_JOURNAL_WORKFLOW_SUMMARY) */ workflowSummary?: string; /** Default GitHub Project number for Kanban resources and issue tools (env: DEFAULT_PROJECT_NUMBER) */ defaultProjectNumber?: number; /** Default workspace ID for isolating journal entries */ defaultWorkspaceId?: string; /** Project registry mapping dynamic repo IDs to local paths and kanban boards */ projectRegistry?: Record; /** Allowlisted directory roots for strict filesystem jailing of agent read access */ allowedIoRoots?: string[]; /** Minimum significance score for entries to be included in the briefing (default: 0.3) */ briefingImportanceThreshold?: number; } /** Default briefing configuration — preserves pre-existing behavior */ export declare const DEFAULT_BRIEFING_CONFIG: BriefingConfig; /** * Resource context for handlers that need extended access */ export interface ResourceContext { db: IDatabaseAdapter; teamDb?: IDatabaseAdapter; vectorManager?: VectorSearchManager; filterConfig?: ToolFilterConfig | null; github?: GitHubIntegration | null; scheduler?: Scheduler | null; briefingConfig?: BriefingConfig; runtime?: ServerRuntime; resourceCount?: number; } /** * Resource handler result with optional annotations for MCP 2025-11-25 */ export interface ResourceResult { data: unknown; annotations?: { lastModified?: string; }; } /** * Internal resource definition with db handler */ export interface InternalResourceDef { uri: string; name: string; title: string; description: string; mimeType: string; icons?: McpIcon[]; annotations?: { audience?: ('user' | 'assistant')[]; priority?: number; lastModified?: string; autoRead?: boolean; sessionInit?: boolean; }; capabilities?: { requiresTeamScope?: boolean; requiresAdminScope?: boolean; requiresAuditScope?: boolean; }; handler: (uri: string, context: ResourceContext) => unknown; } /** * Calculate milestone completion percentage from open/closed issue counts. * Shared helper to avoid duplicated logic across resource handlers. */ export declare function milestoneCompletionPct(openIssues: number, closedIssues: number): number; //# sourceMappingURL=shared.d.ts.map