@octocodeai/octocode-tools-core 18.1.2 → 18.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -162
- package/dist/cacheMaintenance.d.ts +8 -0
- package/dist/direct.js +41 -51
- package/dist/github/client.d.ts +1 -1
- package/dist/github/codeSearch.d.ts +2 -2
- package/dist/github/commit.d.ts +48 -0
- package/dist/github/compare.d.ts +2 -2
- package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +1 -1
- package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +1 -1
- package/dist/github/directoryFetch/refResolution.d.ts +6 -0
- package/dist/github/fileContent.d.ts +1 -1
- package/dist/github/fileContentRaw/fetch.d.ts +2 -2
- package/dist/github/githubAPI.d.ts +1 -2
- package/dist/github/history/commitFiles.d.ts +5 -0
- package/dist/github/history.d.ts +1 -1
- package/dist/github/issues/fetchers.d.ts +1 -1
- package/dist/github/issues/orchestrator.d.ts +1 -1
- package/dist/github/issues/types.d.ts +5 -0
- package/dist/github/prByNumber.d.ts +1 -1
- package/dist/github/prContentFetcher/commits.d.ts +1 -1
- package/dist/github/prContentFetcher/transform.d.ts +1 -1
- package/dist/github/pullRequestSearch.d.ts +1 -1
- package/dist/github/queryBuilders/codeAndRepo.d.ts +1 -1
- package/dist/github/repoSearch.d.ts +2 -2
- package/dist/github/repoStructure/contentResolution.d.ts +1 -1
- package/dist/github/repoStructure/fetchOrchestration.d.ts +2 -2
- package/dist/github/repoStructurePagination.d.ts +1 -1
- package/dist/graph/advancedOperations.d.ts +22 -0
- package/dist/{tools/local_dead_code/graphBuilder.d.ts → graph/buildFileGraph.d.ts} +6 -5
- package/dist/graph/cycleOperations.d.ts +12 -0
- package/dist/{tools/local_dead_code → graph}/importResolver.d.ts +1 -1
- package/dist/graph/operations.d.ts +7 -0
- package/dist/{tools/local_dead_code → graph}/reachability.d.ts +1 -1
- package/dist/{tools/local_dead_code → graph}/types.d.ts +11 -0
- package/dist/graph/workspacePackageResolver.d.ts +2 -0
- package/dist/index.d.ts +11 -30
- package/dist/index.js +45 -55
- package/dist/providers/github/githubContent.d.ts +1 -1
- package/dist/providers/github/githubPullRequests.d.ts +1 -1
- package/dist/providers/github/githubSearch.d.ts +1 -1
- package/dist/providers/github/githubStructure.d.ts +1 -1
- package/dist/providers/github/paginationMetadata.d.ts +4 -5
- package/dist/providers/providerQueries.d.ts +1 -3
- package/dist/providers/providerResults.d.ts +4 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/responses.d.ts +1 -1
- package/dist/schema.d.ts +2 -0
- package/dist/schema.js +13 -1
- package/dist/scheme/conditionalSchemas.d.ts +12 -0
- package/dist/scheme/fields.d.ts +2 -1
- package/dist/security/bridge.d.ts +7 -10
- package/dist/shared/credentials/index.js +2 -2
- package/dist/shared/paths.d.ts +1 -0
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -1
- package/dist/toolContract/descriptions.d.ts +14 -0
- package/dist/toolContract/input/resources/global.d.ts +15 -0
- package/dist/toolContract/input/resources/toolRelations.d.ts +1 -0
- package/dist/toolContract/input/resources/toolVariants.d.ts +9 -0
- package/dist/toolContract/input/resources/tools/_toolkit.d.ts +75 -0
- package/dist/toolContract/input/resources/tools/ghCloneRepo.d.ts +12 -0
- package/dist/toolContract/input/resources/tools/ghGetFileContent.d.ts +30 -0
- package/dist/toolContract/input/resources/tools/ghSearch.d.ts +76 -0
- package/dist/toolContract/input/resources/tools/githubCodeOperation.d.ts +29 -0
- package/dist/toolContract/input/resources/tools/githubHistorySchema.d.ts +114 -0
- package/dist/toolContract/input/resources/tools/githubRepositoriesOperation.d.ts +54 -0
- package/dist/toolContract/input/resources/tools/githubTreeOperation.d.ts +26 -0
- package/dist/toolContract/input/resources/tools/historyCommitInput.d.ts +21 -0
- package/dist/toolContract/input/resources/tools/historyIssueInput.d.ts +59 -0
- package/dist/toolContract/input/resources/tools/historyPullRequestInput.d.ts +98 -0
- package/dist/toolContract/input/resources/tools/localAnalyzeGraph.d.ts +75 -0
- package/dist/toolContract/input/resources/tools/localFilesOperation.d.ts +70 -0
- package/dist/toolContract/input/resources/tools/localGetFileContent.d.ts +22 -0
- package/dist/toolContract/input/resources/tools/localSearch.d.ts +258 -0
- package/dist/toolContract/input/resources/tools/localTextOperation.d.ts +113 -0
- package/dist/toolContract/input/resources/tools/localTreeOperation.d.ts +44 -0
- package/dist/toolContract/input/resources/tools/lspGetSemantics.d.ts +37 -0
- package/dist/toolContract/input/resources/tools/npmSearch.d.ts +10 -0
- package/dist/toolContract/input/types/index.d.ts +24 -0
- package/dist/toolContract/metadata.d.ts +11 -0
- package/dist/toolContract/runtime.d.ts +11 -0
- package/dist/toolContract/schemas.d.ts +31 -0
- package/dist/toolContract/types.d.ts +11 -0
- package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +6 -16
- package/dist/tools/directToolCatalog/toolCatalogFormatters.d.ts +1 -1
- package/dist/tools/directToolCatalog/toolCommandPatternUnifiedSearchQueries.d.ts +6 -0
- package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +2 -2
- package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +10 -0
- package/dist/tools/directToolCatalog/toolSchemaRelations.d.ts +9 -0
- package/dist/tools/directToolCatalog/toolSpecifications.d.ts +13 -0
- package/dist/tools/directToolCatalog.exec.d.ts +1 -1
- package/dist/tools/directToolCatalog.meta.d.ts +1 -0
- package/dist/tools/executionGuard.d.ts +1 -2
- package/dist/tools/github_clone_repo/cache.d.ts +1 -2
- package/dist/tools/github_clone_repo/cacheArtifacts.d.ts +3 -0
- package/dist/tools/github_clone_repo/cachePaths.d.ts +1 -1
- package/dist/tools/github_clone_repo/cloneRepo.d.ts +1 -1
- package/dist/tools/github_clone_repo/execution.d.ts +1 -1
- package/dist/tools/github_clone_repo/scheme.d.ts +24 -24
- package/dist/tools/github_fetch_content/execution.d.ts +1 -1
- package/dist/tools/github_fetch_content/finalizer/types.d.ts +19 -16
- package/dist/tools/github_fetch_content/scheme.d.ts +19 -16
- package/dist/tools/github_fetch_content/types.d.ts +4 -3
- package/dist/tools/github_search/execution.d.ts +4 -0
- package/dist/tools/github_search/finalizer.d.ts +3 -0
- package/dist/tools/github_search/scheme.d.ts +79 -0
- package/dist/tools/github_search_code/execution.d.ts +4 -2
- package/dist/tools/github_search_code/finalizer/groups.d.ts +3 -3
- package/dist/tools/github_search_code/finalizer/ranking.d.ts +1 -2
- package/dist/tools/github_search_code/scheme.d.ts +10 -16
- package/dist/tools/github_search_pull_requests/contentRequest.d.ts +1 -4
- package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +8 -4
- package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +13 -10
- package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +3 -2
- package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +10 -3
- package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +2 -2
- package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +2 -2
- package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +1 -1
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -1
- package/dist/tools/github_search_pull_requests/historyContinuations.d.ts +15 -0
- package/dist/tools/github_search_pull_requests/historyExecutions.d.ts +6 -0
- package/dist/tools/github_search_pull_requests/historyPartialContinuations.d.ts +5 -0
- package/dist/tools/github_search_pull_requests/historySchemes.d.ts +58 -0
- package/dist/tools/github_search_pull_requests/historySearchPagination.d.ts +3 -0
- package/dist/tools/github_search_pull_requests/scheme.d.ts +14 -30
- package/dist/tools/github_search_pull_requests/splitExecutions.d.ts +1 -2
- package/dist/tools/github_search_pull_requests/splitSchemes.d.ts +197 -181
- package/dist/tools/github_search_repos/execution/pagination.d.ts +4 -4
- package/dist/tools/github_search_repos/execution/queryVariants.d.ts +3 -1
- package/dist/tools/github_search_repos/execution.d.ts +3 -1
- package/dist/tools/github_search_repos/scheme.d.ts +5 -7
- package/dist/tools/github_view_repo_structure/execution.d.ts +4 -2
- package/dist/tools/github_view_repo_structure/scheme.d.ts +2 -4
- package/dist/tools/github_view_repo_structure/types.d.ts +3 -0
- package/dist/tools/local_analyze_graph/analysisTypes.d.ts +46 -0
- package/dist/tools/local_analyze_graph/analyzeGraph.d.ts +3 -0
- package/dist/tools/{local_dead_code → local_analyze_graph}/deadCodeScan.d.ts +2 -1
- package/dist/tools/{local_dead_code → local_analyze_graph}/entrypoints.d.ts +1 -0
- package/dist/tools/local_analyze_graph/execution.d.ts +4 -0
- package/dist/tools/local_analyze_graph/pagination.d.ts +3 -0
- package/dist/tools/{local_dead_code → local_analyze_graph}/retention.d.ts +1 -1
- package/dist/tools/{local_dead_code → local_analyze_graph}/scheme.d.ts +31 -15
- package/dist/tools/local_fetch_content/execution.d.ts +1 -1
- package/dist/tools/local_fetch_content/scheme.d.ts +2 -4
- package/dist/tools/local_find_files/execution.d.ts +1 -1
- package/dist/tools/local_find_files/findFiles.d.ts +1 -1
- package/dist/tools/local_find_files/findFilesNext.d.ts +3 -3
- package/dist/tools/local_find_files/scheme.d.ts +6 -2
- package/dist/tools/local_ripgrep/captureBudget.d.ts +1 -0
- package/dist/tools/local_ripgrep/execution.d.ts +1 -1
- package/dist/tools/local_ripgrep/rankingProfile/rankingLexical.d.ts +20 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +1 -18
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +5 -4
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +4 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +9 -7
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +1 -1
- package/dist/tools/local_search/execution.d.ts +5 -0
- package/dist/tools/local_search/scheme.d.ts +260 -0
- package/dist/tools/local_view_structure/execution.d.ts +1 -1
- package/dist/tools/local_view_structure/scheme.d.ts +8 -5
- package/dist/tools/local_view_structure/viewStructureNext.d.ts +3 -3
- package/dist/tools/lsp/semantic_content/execution.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -42
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +1 -1
- package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +0 -1
- package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -3
- package/dist/tools/package_search/execution.d.ts +6 -13
- package/dist/tools/package_search/pagination.d.ts +21 -0
- package/dist/tools/package_search/queryHelpers.d.ts +3 -5
- package/dist/tools/package_search/scheme.d.ts +12 -7
- package/dist/tools/providerExecution.d.ts +3 -4
- package/dist/tools/providerMappers/codeSearch.d.ts +3 -4
- package/dist/tools/providerMappers/fileContent.d.ts +1 -2
- package/dist/tools/providerMappers/pullRequests.d.ts +6 -6
- package/dist/tools/providerMappers/repoSearch.d.ts +7 -4
- package/dist/tools/providerMappers/repoStructure.d.ts +2 -3
- package/dist/tools/toolCatalogFactory.d.ts +5 -6
- package/dist/tools/toolConfig.d.ts +6 -17
- package/dist/tools/toolMetadata/baseSchema.d.ts +1 -2
- package/dist/tools/toolMetadata/descriptions.d.ts +1 -1
- package/dist/tools/toolMetadata/names.d.ts +18 -2
- package/dist/tools/toolMetadata/state.d.ts +3 -3
- package/dist/tools/toolMetadata/types.d.ts +1 -1
- package/dist/tools/toolNames.d.ts +16 -3
- package/dist/tools/toolSchemaImports.d.ts +5 -4
- package/dist/tools/utils.d.ts +3 -6
- package/dist/types/bulk.d.ts +11 -1
- package/dist/types/execution.d.ts +6 -1
- package/dist/types/server.d.ts +0 -2
- package/dist/types/toolOutput.d.ts +10 -9
- package/dist/types/toolResults.d.ts +17 -1
- package/dist/utils/contextUtils.d.ts +4 -2
- package/dist/utils/file/toolHelpers.d.ts +1 -1
- package/dist/utils/http/cache/conditional.d.ts +9 -4
- package/dist/utils/http/cache/dataCache.d.ts +7 -2
- package/dist/utils/http/cache/diskStore.d.ts +30 -0
- package/dist/utils/http/cache/management.d.ts +5 -0
- package/dist/utils/http/cache/store.d.ts +1 -0
- package/dist/utils/http/cache/trace.d.ts +10 -0
- package/dist/utils/http/cache.d.ts +1 -0
- package/dist/utils/package/types.d.ts +5 -2
- package/dist/utils/pagination/charLimit.d.ts +0 -2
- package/dist/utils/response/bulk/pagination.d.ts +2 -1
- package/dist/utils/response/bulk/paginationDiagnostics.d.ts +2 -0
- package/dist/utils/response/bulk/queries.d.ts +0 -9
- package/dist/utils/response/bulk/response.d.ts +3 -2
- package/dist/utils/response/bulk.d.ts +1 -1
- package/dist/utils/response/callToolResult.d.ts +1 -1
- package/dist/utils/response/error.d.ts +3 -4
- package/dist/utils/response/groupedFinalizer.d.ts +2 -6
- package/dist/utils/response/normalizedError.d.ts +6 -0
- package/dist/utils/response/responseChannels.d.ts +4 -0
- package/package.json +7 -6
- package/dist/github/discussions.d.ts +0 -45
- package/dist/github/releases.d.ts +0 -45
- package/dist/scheme/responseEnvelope.d.ts +0 -88
- package/dist/tools/github_search_discussions/execution.d.ts +0 -15
- package/dist/tools/github_search_discussions/scheme.d.ts +0 -16
- package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +0 -4
- package/dist/tools/local_dead_code/execution.d.ts +0 -4
- package/dist/tools/local_dead_code/local_dead_code.d.ts +0 -5
- package/dist/tools/local_find_files/pathPatternBraces.d.ts +0 -20
- package/dist/tools/toolMetadata/gateway.d.ts +0 -7
|
@@ -27,12 +27,11 @@ export declare function mapPullRequestToolQuery(query: PartialPRQuery): {
|
|
|
27
27
|
comments: string;
|
|
28
28
|
reactions: string;
|
|
29
29
|
draft: boolean;
|
|
30
|
-
match: ("
|
|
31
|
-
checks: "success" | "
|
|
32
|
-
review: "none" | "
|
|
30
|
+
match: ("body" | "title" | "comments")[];
|
|
31
|
+
checks: "success" | "pending" | "failure";
|
|
32
|
+
review: "none" | "required" | "approved" | "changes_requested";
|
|
33
33
|
archived: boolean | undefined;
|
|
34
34
|
content: unknown;
|
|
35
|
-
reviewMode: "full" | "summary";
|
|
36
35
|
filePage: number;
|
|
37
36
|
commentPage: number;
|
|
38
37
|
commitPage: number;
|
|
@@ -43,8 +42,7 @@ export declare function mapPullRequestToolQuery(query: PartialPRQuery): {
|
|
|
43
42
|
page: number;
|
|
44
43
|
charOffset: number;
|
|
45
44
|
charLength: number;
|
|
46
|
-
|
|
47
|
-
researchGoal: string;
|
|
45
|
+
goal: string;
|
|
48
46
|
reasoning: string;
|
|
49
47
|
};
|
|
50
48
|
export declare function mapPullRequestProviderResultData(data: ProviderPullRequestSearchResult, options?: {
|
|
@@ -64,6 +62,8 @@ export declare function mapPullRequestProviderResultData(data: ProviderPullReque
|
|
|
64
62
|
inlineComments: number;
|
|
65
63
|
discussionComments: number;
|
|
66
64
|
commenters: string[];
|
|
65
|
+
commenterCount: number;
|
|
66
|
+
commentersTruncated?: true;
|
|
67
67
|
latestCommentAt?: string;
|
|
68
68
|
themes: string[];
|
|
69
69
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RepoSearchResult as ProviderRepoSearchResult } from '../../providers/types.js';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
import type { GitHubReposSearchSingleQuerySchema } from '
|
|
3
|
+
import type { GitHubReposSearchSingleQuerySchema } from '../../toolContract/schemas.js';
|
|
4
4
|
import type { GitHubRepositoryOutput } from '@octocodeai/octocode-core/extra-types';
|
|
5
5
|
import type { WithOptionalMeta } from '../../types/execution.js';
|
|
6
6
|
type GitHubReposSearchSingleQuery = z.infer<typeof GitHubReposSearchSingleQuerySchema>;
|
|
@@ -9,17 +9,20 @@ export declare function mapRepoSearchToolQuery(query: WithOptionalMeta<GitHubRep
|
|
|
9
9
|
topics: string[];
|
|
10
10
|
owner: string;
|
|
11
11
|
stars: string;
|
|
12
|
+
size: string | undefined;
|
|
13
|
+
created: string | undefined;
|
|
12
14
|
updated: string;
|
|
13
15
|
language: string;
|
|
14
16
|
archived: boolean | undefined;
|
|
15
17
|
visibility: "public" | "private" | undefined;
|
|
16
18
|
license: string | undefined;
|
|
17
|
-
|
|
19
|
+
forks: string | undefined;
|
|
20
|
+
goodFirstIssues: string | undefined;
|
|
21
|
+
match: ("name" | "description" | "readme")[];
|
|
18
22
|
sort: "updated" | "best-match" | "stars" | "forks" | "help-wanted-issues";
|
|
19
23
|
limit: number | undefined;
|
|
20
24
|
page: number;
|
|
21
|
-
|
|
22
|
-
researchGoal: string;
|
|
25
|
+
goal: string;
|
|
23
26
|
reasoning: string;
|
|
24
27
|
};
|
|
25
28
|
export declare function mapRepoSearchProviderRepositories(repositories: ProviderRepoSearchResult['repositories']): GitHubRepositoryOutput[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RepoStructureResult as ProviderRepoStructureResult } from '../../providers/types.js';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
import type { GitHubViewRepoStructureQuerySchema } from '
|
|
3
|
+
import type { GitHubViewRepoStructureQuerySchema } from '../../toolContract/schemas.js';
|
|
4
4
|
import type { WithOptionalMeta } from '../../types/execution.js';
|
|
5
5
|
type GitHubViewRepoStructureQuery = z.infer<typeof GitHubViewRepoStructureQuerySchema>;
|
|
6
6
|
type PartialRepoStructureQuery = WithOptionalMeta<GitHubViewRepoStructureQuery>;
|
|
@@ -16,8 +16,7 @@ export declare function mapRepoStructureToolQuery(query: PartialRepoStructureQue
|
|
|
16
16
|
includeContributors: boolean;
|
|
17
17
|
includeBranches: boolean;
|
|
18
18
|
includeTags: boolean;
|
|
19
|
-
|
|
20
|
-
researchGoal: string;
|
|
19
|
+
goal: string;
|
|
21
20
|
reasoning: string;
|
|
22
21
|
};
|
|
23
22
|
export declare function mapRepoStructureProviderResult(data: ProviderRepoStructureResult, _query: PartialRepoStructureQuery, filteredStructure: ProviderRepoStructureResult['structure'], resolvedBranch: string): Record<string, unknown>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ToolNames } from '@octocodeai/octocode-core/types';
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
3
2
|
import { type z } from 'zod';
|
|
4
|
-
import { type ToolMetadataGateway } from './toolMetadata/gateway.js';
|
|
5
3
|
export type ToolDirectSecurity = 'basic' | 'remote';
|
|
6
4
|
export interface ToolDirectExecutionConfig {
|
|
7
5
|
schema: z.ZodType;
|
|
@@ -10,16 +8,17 @@ export interface ToolDirectExecutionConfig {
|
|
|
10
8
|
security: ToolDirectSecurity;
|
|
11
9
|
requiresServerRuntime?: boolean;
|
|
12
10
|
requiresProviders?: boolean;
|
|
11
|
+
/** Outer security boundary for tools whose own bounded operation may exceed
|
|
12
|
+
* the shared 60-second default (for example a shallow repository clone). */
|
|
13
|
+
timeoutMs?: number;
|
|
13
14
|
}
|
|
14
15
|
export interface ToolConfig {
|
|
15
16
|
name: string;
|
|
17
|
+
title: string;
|
|
16
18
|
description: string;
|
|
17
19
|
isDefault: boolean;
|
|
18
20
|
isLocal: boolean;
|
|
19
21
|
isClone?: boolean;
|
|
20
22
|
type: 'search' | 'content' | 'history' | 'debug';
|
|
21
|
-
skipMetadataCheck?: boolean;
|
|
22
23
|
direct: ToolDirectExecutionConfig;
|
|
23
24
|
}
|
|
24
|
-
export declare const getDescription: (toolName: string, gateway?: Pick<ToolMetadataGateway, "getDescription">) => string;
|
|
25
|
-
export declare function createTool(gateway: ToolMetadataGateway, nameKey: keyof ToolNames, config: Omit<ToolConfig, 'name' | 'description'>): ToolConfig;
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getDescription, type ToolConfig, type ToolDirectExecutionConfig, type ToolDirectSecurity } from './toolCatalogFactory.js';
|
|
3
|
-
export type { ToolMetadataGateway };
|
|
4
|
-
export { DEFAULT_TOOL_METADATA_GATEWAY };
|
|
5
|
-
export { getDescription };
|
|
1
|
+
import { type ToolConfig, type ToolDirectExecutionConfig, type ToolDirectSecurity } from './toolCatalogFactory.js';
|
|
6
2
|
export type { ToolConfig, ToolDirectExecutionConfig, ToolDirectSecurity };
|
|
7
3
|
export type { ToolInvocationCallback } from '../types/toolResults.js';
|
|
8
|
-
export declare const
|
|
4
|
+
export declare const GITHUB_SEARCH: ToolConfig;
|
|
9
5
|
export declare const GITHUB_FETCH_CONTENT: ToolConfig;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const GITHUB_PULL_REQUESTS: ToolConfig;
|
|
13
|
-
export declare const GITHUB_ISSUES: ToolConfig;
|
|
14
|
-
export declare const GITHUB_COMMITS: ToolConfig;
|
|
15
|
-
export declare const GITHUB_RELEASES: ToolConfig;
|
|
16
|
-
export declare const GITHUB_DISCUSSIONS: ToolConfig;
|
|
6
|
+
export declare const GITHUB_SEARCH_HISTORY: ToolConfig;
|
|
7
|
+
export declare const GITHUB_GET_HISTORY_ITEM: ToolConfig;
|
|
17
8
|
export declare const PACKAGE_SEARCH: ToolConfig;
|
|
18
9
|
export declare const GITHUB_CLONE_REPO: ToolConfig;
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const LOCAL_FIND_FILES: ToolConfig;
|
|
22
|
-
export declare const LOCAL_FIND_DEAD_CODE: ToolConfig;
|
|
10
|
+
export declare const LOCAL_SEARCH: ToolConfig;
|
|
11
|
+
export declare const LOCAL_ANALYZE_GRAPH: ToolConfig;
|
|
23
12
|
export declare const LOCAL_FETCH_CONTENT: ToolConfig;
|
|
24
13
|
export declare const LSP_GET_SEMANTIC_CONTENT: ToolConfig;
|
|
25
14
|
export declare const ALL_TOOLS: ToolConfig[];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const BASE_SCHEMA: CompleteMetadata["baseSchema"];
|
|
1
|
+
export { baseSchemaDescriptions as BASE_SCHEMA } from '../../toolContract/schemas.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PUBLIC_TOOL_DESCRIPTIONS, PUBLIC_TOOL_DESCRIPTIONS as DESCRIPTIONS, } from '../../toolContract/descriptions.js';
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const TOOL_NAMES: {
|
|
2
|
+
readonly LOCAL_SEARCH: "localSearch";
|
|
3
|
+
readonly GITHUB_SEARCH_CODE: "github.code";
|
|
4
|
+
readonly GITHUB_VIEW_REPO_STRUCTURE: "github.tree";
|
|
5
|
+
readonly GITHUB_SEARCH_REPOSITORIES: "github.repositories";
|
|
6
|
+
readonly LOCAL_RIPGREP: "local.text";
|
|
7
|
+
readonly LOCAL_VIEW_STRUCTURE: "local.tree";
|
|
8
|
+
readonly LOCAL_FIND_FILES: "local.files";
|
|
9
|
+
readonly GITHUB_SEARCH: "ghSearch";
|
|
10
|
+
readonly GITHUB_FETCH_CONTENT: "ghGetFileContent";
|
|
11
|
+
readonly PACKAGE_SEARCH: "npmSearch";
|
|
12
|
+
readonly GITHUB_CLONE_REPO: "ghCloneRepo";
|
|
13
|
+
readonly LOCAL_FETCH_CONTENT: "localGetFileContent";
|
|
14
|
+
readonly LOCAL_ANALYZE_GRAPH: "localAnalyzeGraph";
|
|
15
|
+
readonly LSP_GET_SEMANTIC_CONTENT: "lspGetSemantics";
|
|
16
|
+
readonly GITHUB_SEARCH_HISTORY: "ghSearchHistory";
|
|
17
|
+
readonly GITHUB_GET_HISTORY_ITEM: "ghGetHistoryItem";
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function loadToolContent(): Promise<
|
|
1
|
+
import type { LocalCompleteMetadata } from '../../toolContract/types.js';
|
|
2
|
+
export declare function loadToolContent(): Promise<LocalCompleteMetadata>;
|
|
3
3
|
export declare function initializeToolMetadata(): Promise<void>;
|
|
4
|
-
export declare function getMetadataOrNull():
|
|
4
|
+
export declare function getMetadataOrNull(): LocalCompleteMetadata | null;
|
|
5
5
|
export declare function _resetMetadataState(): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ToolNames } from '
|
|
1
|
+
import type { ToolNames } from '../../toolContract/input/types/index.js';
|
|
2
2
|
export type ToolName = ToolNames[keyof ToolNames];
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const LOCAL_ANALYZE_GRAPH_TOOL_NAME: "localAnalyzeGraph";
|
|
2
|
+
export declare const LOCAL_SEARCH_TOOL_NAME = "localSearch";
|
|
3
|
+
export declare const GITHUB_SEARCH_TOOL_NAME: "ghSearch";
|
|
4
|
+
export declare const GITHUB_SEARCH_HISTORY_TOOL_NAME = "ghSearchHistory";
|
|
5
|
+
export declare const GITHUB_GET_HISTORY_ITEM_TOOL_NAME = "ghGetHistoryItem";
|
|
6
|
+
export declare const STATIC_TOOL_NAMES: {
|
|
7
|
+
readonly GITHUB_SEARCH: "ghSearch";
|
|
8
|
+
readonly GITHUB_FETCH_CONTENT: "ghGetFileContent";
|
|
9
|
+
readonly PACKAGE_SEARCH: "npmSearch";
|
|
10
|
+
readonly GITHUB_CLONE_REPO: "ghCloneRepo";
|
|
11
|
+
readonly LOCAL_FETCH_CONTENT: "localGetFileContent";
|
|
12
|
+
readonly LOCAL_ANALYZE_GRAPH: "localAnalyzeGraph";
|
|
13
|
+
readonly LSP_GET_SEMANTIC_CONTENT: "lspGetSemantics";
|
|
14
|
+
readonly GITHUB_SEARCH_HISTORY: "ghSearchHistory";
|
|
15
|
+
readonly GITHUB_GET_HISTORY_ITEM: "ghGetHistoryItem";
|
|
16
|
+
};
|
|
2
17
|
export declare const LSP_GET_SEMANTICS_TOOL_NAME: "lspGetSemantics";
|
|
3
|
-
export declare function isReleasesEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
4
|
-
export declare function isDiscussionsEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
5
18
|
export declare function isLocalTool(toolName: string): boolean;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
export { CloneRepoQueryLocalSchema, BulkCloneRepoLocalSchema, } from './github_clone_repo/scheme.js';
|
|
2
2
|
export { FileContentQueryLocalSchema, FileContentBulkQueryLocalSchema, } from './github_fetch_content/scheme.js';
|
|
3
|
+
export { GitHubSearchQuerySchema, GitHubSearchBulkQuerySchema, } from './github_search/scheme.js';
|
|
3
4
|
export { GitHubCodeSearchQueryLocalSchema, GitHubCodeSearchBulkQueryLocalSchema, } from './github_search_code/scheme.js';
|
|
4
5
|
export { GitHubPullRequestSearchQueryLocalSchema, GitHubPullRequestSearchBulkQueryLocalSchema, } from './github_search_pull_requests/scheme.js';
|
|
5
|
-
export {
|
|
6
|
-
export { SearchDiscussionsLocalSchema, SearchDiscussionsBulkLocalSchema, } from './github_search_discussions/scheme.js';
|
|
6
|
+
export { GitHubSearchHistoryQueryLocalSchema, GitHubSearchHistoryBulkQueryLocalSchema, GitHubGetHistoryItemQueryLocalSchema, GitHubGetHistoryItemBulkQueryLocalSchema, } from './github_search_pull_requests/historySchemes.js';
|
|
7
7
|
export { GitHubReposSearchSingleQueryLocalSchema, GitHubReposSearchBulkQueryLocalSchema, } from './github_search_repos/scheme.js';
|
|
8
8
|
export { GitHubViewRepoStructureQueryLocalSchema, GitHubViewRepoStructureBulkQueryLocalSchema, } from './github_view_repo_structure/scheme.js';
|
|
9
9
|
export { NpmSearchQueryLocalSchema, NpmSearchBulkQueryLocalSchema, } from './package_search/scheme.js';
|
|
10
10
|
export { LocalFetchContentQuerySchema, LocalFetchContentBulkQuerySchema, } from './local_fetch_content/scheme.js';
|
|
11
11
|
export { LocalFindFilesQuerySchema, LocalFindFilesBulkQuerySchema, } from './local_find_files/scheme.js';
|
|
12
|
-
export {
|
|
12
|
+
export { LocalAnalyzeGraphQuerySchema, LocalAnalyzeGraphBulkQuerySchema, } from './local_analyze_graph/scheme.js';
|
|
13
13
|
export { LocalRipgrepQuerySchema, LocalRipgrepBulkQuerySchema, } from './local_ripgrep/scheme.js';
|
|
14
14
|
export { LocalViewStructureQuerySchema, LocalViewStructureBulkQuerySchema, } from './local_view_structure/scheme.js';
|
|
15
|
-
export {
|
|
15
|
+
export { LocalSearchQuerySchema, LocalSearchBulkQuerySchema, } from './local_search/scheme.js';
|
|
16
|
+
export { BulkLspGetSemanticsQuerySchema, LspGetSemanticsQuerySchema, } from './lsp/semantic_content/scheme.js';
|
package/dist/tools/utils.d.ts
CHANGED
|
@@ -7,17 +7,14 @@ interface SuccessResultOptions {
|
|
|
7
7
|
rawResponse?: unknown;
|
|
8
8
|
}
|
|
9
9
|
export declare function createSuccessResult<T extends object>(_query: {
|
|
10
|
-
|
|
11
|
-
researchGoal?: string;
|
|
10
|
+
goal?: string;
|
|
12
11
|
reasoning?: string;
|
|
13
12
|
}, data: T, hasContent: boolean, _toolName: string, options?: SuccessResultOptions): ToolSuccessResult & T;
|
|
14
13
|
export declare function handleProviderError(apiResult: ProviderResponse<unknown>, query: {
|
|
15
|
-
|
|
16
|
-
researchGoal?: string;
|
|
14
|
+
goal?: string;
|
|
17
15
|
reasoning?: string;
|
|
18
16
|
}): ToolErrorResult;
|
|
19
17
|
export declare function handleCatchError(error: unknown, query: {
|
|
20
|
-
|
|
21
|
-
researchGoal?: string;
|
|
18
|
+
goal?: string;
|
|
22
19
|
reasoning?: string;
|
|
23
20
|
}, contextMessage?: string, toolName?: string): ToolErrorResult;
|
package/dist/types/bulk.d.ts
CHANGED
|
@@ -6,7 +6,12 @@ export interface BulkFinalizerInput<TQuery, TOutput extends Record<string, unkno
|
|
|
6
6
|
}
|
|
7
7
|
export interface BulkFinalizerOutput<TOutput extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
8
|
structuredContent: TOutput;
|
|
9
|
-
|
|
9
|
+
/** Rendering priority only. Text is derived once from finalized structured
|
|
10
|
+
* content so MCP and CLI cannot observe different semantic states. */
|
|
11
|
+
keysPriority?: readonly string[];
|
|
12
|
+
/** Optional presentation for copy-sensitive payloads. It receives the final,
|
|
13
|
+
* reconciled structured value and therefore cannot render stale metadata. */
|
|
14
|
+
renderText?: (structuredContent: Record<string, unknown>) => string;
|
|
10
15
|
isError?: boolean;
|
|
11
16
|
}
|
|
12
17
|
export type BulkFinalizer<TQuery, TOutput extends Record<string, unknown> = Record<string, unknown>> = (input: BulkFinalizerInput<TQuery, TOutput>) => BulkFinalizerOutput<TOutput>;
|
|
@@ -15,6 +20,7 @@ export interface BulkResponsePagination {
|
|
|
15
20
|
responseCharLength?: number;
|
|
16
21
|
}
|
|
17
22
|
export interface ResponsePaginationInfo {
|
|
23
|
+
scope: 'content.text';
|
|
18
24
|
currentPage: number;
|
|
19
25
|
totalPages: number;
|
|
20
26
|
hasMore: boolean;
|
|
@@ -22,6 +28,10 @@ export interface ResponsePaginationInfo {
|
|
|
22
28
|
charLength: number;
|
|
23
29
|
totalChars: number;
|
|
24
30
|
nextCharOffset?: number;
|
|
31
|
+
next?: {
|
|
32
|
+
tool: string;
|
|
33
|
+
query: Record<string, unknown>;
|
|
34
|
+
};
|
|
25
35
|
}
|
|
26
36
|
export interface BulkResponseConfig<TQuery = object, TOutput extends Record<string, unknown> = Record<string, unknown>> {
|
|
27
37
|
toolName: string;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { AuthInfo } from '@modelcontextprotocol/
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/server';
|
|
2
2
|
export type WithOptionalMeta<T> = Partial<T>;
|
|
3
|
+
export interface BaseQueryLocal {
|
|
4
|
+
goal?: string;
|
|
5
|
+
reasoning?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
}
|
|
3
8
|
export interface ToolExecutionArgs<TQuery> {
|
|
4
9
|
queries: TQuery[];
|
|
5
10
|
responseCharOffset?: number;
|
package/dist/types/server.d.ts
CHANGED
|
@@ -3,12 +3,10 @@ export interface ServerConfig {
|
|
|
3
3
|
version: string;
|
|
4
4
|
githubApiUrl: string;
|
|
5
5
|
toolsToRun?: string[];
|
|
6
|
-
enableTools?: string[];
|
|
7
6
|
disableTools?: string[];
|
|
8
7
|
timeout: number;
|
|
9
8
|
maxRetries: number;
|
|
10
9
|
enableLocal: boolean;
|
|
11
10
|
enableClone: boolean;
|
|
12
|
-
outputFormat: 'yaml' | 'json';
|
|
13
11
|
tokenSource: TokenSourceType;
|
|
14
12
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hand-written output TYPES for the direct tools.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* change to be made in twelve places. Tools keep a plain TypeScript output
|
|
8
|
-
* type instead — one shared envelope generic plus a per-tool `data` interface.
|
|
4
|
+
* Tools keep one shared TypeScript envelope generic plus a per-tool `data`
|
|
5
|
+
* interface. MCP advertises the matching broad runtime contract sourced from
|
|
6
|
+
* @octocodeai/octocode-core, avoiding per-interface schema duplication.
|
|
9
7
|
*
|
|
10
8
|
* INPUT/query schemas are unaffected: those are registered and parsed, so they
|
|
11
9
|
* stay as zod.
|
|
12
10
|
*/
|
|
13
|
-
import type {
|
|
11
|
+
import type { ToolResultMeta } from './toolResults.js';
|
|
14
12
|
/** Outermost char-window pagination wrapping a whole bulk response. */
|
|
15
13
|
export interface ResponsePaginationInfo {
|
|
14
|
+
scope: 'content.text';
|
|
16
15
|
currentPage: number;
|
|
17
16
|
totalPages: number;
|
|
18
17
|
hasMore: boolean;
|
|
@@ -23,10 +22,13 @@ export interface ResponsePaginationInfo {
|
|
|
23
22
|
}
|
|
24
23
|
/** One result row in a bulk tool response. */
|
|
25
24
|
export interface BulkToolResultRow<TData> {
|
|
26
|
-
|
|
25
|
+
/** Zero-based position of the originating query in the submitted batch. */
|
|
26
|
+
index: number;
|
|
27
27
|
status?: 'empty' | 'error';
|
|
28
|
+
/** Present only when the primary response payload was served from cache. */
|
|
29
|
+
cache?: 1;
|
|
30
|
+
meta?: ToolResultMeta;
|
|
28
31
|
data: TData;
|
|
29
|
-
next?: Record<string, ToolContinuation>;
|
|
30
32
|
}
|
|
31
33
|
/** The shared bulk envelope every direct tool returns, parameterized by its per-query `data` payload. */
|
|
32
34
|
export interface BulkToolOutput<TData> {
|
|
@@ -34,5 +36,4 @@ export interface BulkToolOutput<TData> {
|
|
|
34
36
|
base?: string;
|
|
35
37
|
shared?: Record<string, string | number | boolean>;
|
|
36
38
|
responsePagination?: ResponsePaginationInfo;
|
|
37
|
-
next?: Record<string, ToolContinuation>;
|
|
38
39
|
}
|
|
@@ -45,10 +45,26 @@ export interface ProcessedBulkResult {
|
|
|
45
45
|
[key: string]: unknown;
|
|
46
46
|
}
|
|
47
47
|
export interface FlatQueryResult {
|
|
48
|
-
|
|
48
|
+
/** Zero-based position of the originating query in the submitted batch. */
|
|
49
|
+
index: number;
|
|
50
|
+
/** Present only when this query's response was served from cache. */
|
|
51
|
+
cache?: 1;
|
|
49
52
|
status?: QueryStatus;
|
|
53
|
+
meta: ToolResultMeta;
|
|
50
54
|
data: Record<string, unknown>;
|
|
51
55
|
}
|
|
56
|
+
export type EvidenceKind = 'exact' | 'lexical' | 'structural' | 'syntactic' | 'semantic' | 'provider';
|
|
57
|
+
export interface ToolResultMeta {
|
|
58
|
+
evidence: {
|
|
59
|
+
kind: EvidenceKind;
|
|
60
|
+
confidence: 'high' | 'medium' | 'low';
|
|
61
|
+
};
|
|
62
|
+
diagnostics?: {
|
|
63
|
+
codes?: string[];
|
|
64
|
+
hints?: string[];
|
|
65
|
+
partial?: boolean;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
52
68
|
export interface QueryError {
|
|
53
69
|
queryIndex: number;
|
|
54
70
|
error: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as NativeContextUtils from '@octocodeai/octocode-engine';
|
|
2
|
-
export type { ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, GraphFactCapability, GraphFactCall, GraphFactDeclaration, GraphFactEdge, GraphFactExport, GraphFactImport, GraphFacts, LineDiffOp, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, RipgrepSearchOptions, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-engine';
|
|
2
|
+
export type { ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, GraphFactCapability, GraphFactCall, GraphFactDeclaration, GraphFactEdge, GraphFactExport, GraphFactImport, GraphFacts, GraphFactsScanEntry, GraphFactsScanOptions, GraphFactsScanResult, GraphReferenceCount, LineDiffOp, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, RipgrepSearchOptions, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-engine';
|
|
3
3
|
type NativeContextUtilsModule = typeof NativeContextUtils;
|
|
4
4
|
type NativeLoader = () => NativeContextUtilsModule;
|
|
5
5
|
export declare class ContextUtilsLoadError extends Error {
|
|
@@ -33,6 +33,8 @@ export declare const contextUtils: {
|
|
|
33
33
|
* declarations/imports/exports, containment, and direct call expressions.
|
|
34
34
|
*/
|
|
35
35
|
extractGraphFacts(content: string, filePath: string): string | null;
|
|
36
|
+
/** Walk, read, and extract graph facts on the native worker pool in one call. */
|
|
37
|
+
scanGraphFacts(options: NativeContextUtils.GraphFactsScanOptions): Promise<NativeContextUtils.GraphFactsScanResult>;
|
|
36
38
|
/**
|
|
37
39
|
* Canonical lowercase extensions (no leading dot) the native oxc JS/TS path
|
|
38
40
|
* handles. Source of truth lives in the engine — gate native dispatch on this.
|
|
@@ -61,7 +63,7 @@ export declare const contextUtils: {
|
|
|
61
63
|
jsonToYamlString(jsonObject: NativeContextUtils.JsonInput, config?: NativeContextUtils.YamlConversionConfig | null): string;
|
|
62
64
|
parseRipgrepJson(stdout: string, options?: NativeContextUtils.RipgrepParseOptions | null): NativeContextUtils.RipgrepParseResult;
|
|
63
65
|
searchRipgrep(options: NativeContextUtils.RipgrepSearchOptions): Promise<NativeContextUtils.RipgrepParseResult>;
|
|
64
|
-
queryFileSystem(options: NativeContextUtils.FileSystemQueryOptions): NativeContextUtils.FileSystemQueryResult
|
|
66
|
+
queryFileSystem(options: NativeContextUtils.FileSystemQueryOptions): Promise<NativeContextUtils.FileSystemQueryResult>;
|
|
65
67
|
extractMatchingLines(content: string, pattern: string, options?: NativeContextUtils.ExtractMatchingLinesOptions | null): NativeContextUtils.ExtractMatchingLinesResult;
|
|
66
68
|
filterPatch(patch: string, options?: NativeContextUtils.FilterPatchOptions | null): string;
|
|
67
69
|
computeLineDiff(oldText: string, newText: string): NativeContextUtils.LineDiffOp[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseQueryLocal } from '
|
|
1
|
+
import type { BaseQueryLocal } from '../../types/execution.js';
|
|
2
2
|
type PartialBaseQueryLocal = Partial<BaseQueryLocal>;
|
|
3
3
|
import { createErrorResult, type UnifiedErrorResult } from '../response/error.js';
|
|
4
4
|
type LocalErrorResult = UnifiedErrorResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NodeCache from 'node-cache';
|
|
2
|
+
import { type CacheRole } from './trace.js';
|
|
2
3
|
/**
|
|
3
4
|
* Soft ETag store: survives primary TTL so a miss can send If-None-Match and
|
|
4
5
|
* recover a 304 without paying a full body download (GitHub authorized 304s
|
|
@@ -11,11 +12,15 @@ export type ConditionalFetchResult<T> = {
|
|
|
11
12
|
/** True when the upstream responded 304 Not Modified. */
|
|
12
13
|
notModified?: boolean;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
-
ifNoneMatch?: string;
|
|
16
|
-
}) => Promise<ConditionalFetchResult<T>>, options?: {
|
|
15
|
+
interface ConditionalCacheOptions<T> {
|
|
17
16
|
ttl?: number;
|
|
18
17
|
skipCache?: boolean;
|
|
19
18
|
forceRefresh?: boolean;
|
|
20
19
|
shouldCache?: (value: T) => boolean;
|
|
21
|
-
|
|
20
|
+
/** Whether a hit supplies the tool response or only supporting metadata. */
|
|
21
|
+
cacheRole?: CacheRole;
|
|
22
|
+
}
|
|
23
|
+
export declare function withDataCacheConditional<T>(cacheKey: string, operation: (opts: {
|
|
24
|
+
ifNoneMatch?: string;
|
|
25
|
+
}) => Promise<ConditionalFetchResult<T>>, options?: ConditionalCacheOptions<T>): Promise<T>;
|
|
26
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { type CacheRole } from './trace.js';
|
|
2
|
+
interface DataCacheOptions<T> {
|
|
2
3
|
ttl?: number;
|
|
3
4
|
skipCache?: boolean;
|
|
4
5
|
forceRefresh?: boolean;
|
|
5
6
|
shouldCache?: (value: T) => boolean;
|
|
6
|
-
|
|
7
|
+
/** Whether a hit supplies the tool response or only supporting metadata. */
|
|
8
|
+
cacheRole?: CacheRole;
|
|
9
|
+
}
|
|
10
|
+
export declare function withDataCache<T>(cacheKey: string, operation: () => Promise<T>, options?: DataCacheOptions<T>): Promise<T>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface DiskCacheRead<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
etag?: string;
|
|
4
|
+
state: 'fresh' | 'stale';
|
|
5
|
+
expiresAt: number;
|
|
6
|
+
}
|
|
7
|
+
declare const diskStats: {
|
|
8
|
+
hits: number;
|
|
9
|
+
misses: number;
|
|
10
|
+
sets: number;
|
|
11
|
+
errors: number;
|
|
12
|
+
evictions: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function isDiskCacheEnabled(): boolean;
|
|
15
|
+
export declare function getDiskCacheRoot(octocodeHome?: string): string;
|
|
16
|
+
export declare function getDiskCacheEntryPath(key: string, octocodeHome?: string): string;
|
|
17
|
+
export declare function readDiskCache<T>(key: string, options?: {
|
|
18
|
+
allowStale?: boolean;
|
|
19
|
+
}): Promise<DiskCacheRead<T> | undefined>;
|
|
20
|
+
export declare function writeDiskCache<T>(key: string, value: T, ttlSeconds: number, options?: {
|
|
21
|
+
etag?: string;
|
|
22
|
+
staleTtlSeconds?: number;
|
|
23
|
+
}): Promise<boolean>;
|
|
24
|
+
export declare function sweepDiskCacheIfDue(octocodeHome?: string, now?: number): Promise<number>;
|
|
25
|
+
/** Full response-cache sweep for the already due-gated shared lifecycle. */
|
|
26
|
+
export declare function sweepDiskCacheNow(octocodeHome?: string, now?: number): Promise<number>;
|
|
27
|
+
export declare function clearDiskCache(octocodeHome?: string): Promise<void>;
|
|
28
|
+
export declare function getDiskCacheStats(): Readonly<typeof diskStats>;
|
|
29
|
+
export declare function resetDiskCacheStats(): void;
|
|
30
|
+
export {};
|
|
@@ -6,4 +6,9 @@ export declare function clearRemoteAPICache(): number;
|
|
|
6
6
|
export declare function getCacheStats(): CacheStats & {
|
|
7
7
|
hitRate: number;
|
|
8
8
|
cacheSize: number;
|
|
9
|
+
diskHits: number;
|
|
10
|
+
diskMisses: number;
|
|
11
|
+
diskSets: number;
|
|
12
|
+
diskErrors: number;
|
|
13
|
+
diskEvictions: number;
|
|
9
14
|
};
|
|
@@ -19,6 +19,7 @@ export declare const CACHE_TTL_CONFIG: {
|
|
|
19
19
|
export interface PendingRequest {
|
|
20
20
|
promise: Promise<unknown>;
|
|
21
21
|
startedAt: number;
|
|
22
|
+
requestId: symbol;
|
|
22
23
|
}
|
|
23
24
|
export declare const pendingRequests: Map<string, PendingRequest>;
|
|
24
25
|
export declare function extractCachePrefix(cacheKey: string): string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CacheRole = 'response' | 'helper';
|
|
2
|
+
/** Trace cache activity for one independently processed bulk query. */
|
|
3
|
+
export declare function traceResponseCache<T>(operation: () => Promise<T>): Promise<{
|
|
4
|
+
value: T;
|
|
5
|
+
cacheHit: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
/** Preserve cache nesting so helper-cache hits do not label a fresh response. */
|
|
8
|
+
export declare function runCacheLayer<T>(operation: () => Promise<T>, role?: CacheRole): Promise<T>;
|
|
9
|
+
/** Mark a direct hit or a query's outermost cache layer as its response source. */
|
|
10
|
+
export declare function markResponseCacheHit(): void;
|
|
@@ -2,8 +2,7 @@ export interface NpmSearchInput {
|
|
|
2
2
|
name: string;
|
|
3
3
|
itemsPerPage?: number;
|
|
4
4
|
page?: number;
|
|
5
|
-
|
|
6
|
-
researchGoal?: string;
|
|
5
|
+
goal?: string;
|
|
7
6
|
reasoning?: string;
|
|
8
7
|
}
|
|
9
8
|
export interface MinimalPackageResult {
|
|
@@ -24,7 +23,11 @@ export interface NpmPackageResult {
|
|
|
24
23
|
typeDefinitions?: string | null;
|
|
25
24
|
packageType?: 'module' | 'commonjs' | 'types-only' | 'unknown';
|
|
26
25
|
exports?: string[];
|
|
26
|
+
exportsTotal?: number;
|
|
27
|
+
exportsTruncated?: true;
|
|
27
28
|
bin?: string[];
|
|
29
|
+
binTotal?: number;
|
|
30
|
+
binTruncated?: true;
|
|
28
31
|
repositoryDirectory?: string;
|
|
29
32
|
lastPublished?: string;
|
|
30
33
|
owner?: string;
|
|
@@ -3,4 +3,5 @@ export declare function paginateBulkText(text: string, pagination?: BulkResponse
|
|
|
3
3
|
text: string;
|
|
4
4
|
pagination?: NonNullable<BulkToolResponse['responsePagination']>;
|
|
5
5
|
};
|
|
6
|
-
export declare function appendResponsePagination<T extends Record<string, unknown>>(structuredContent: T, pagination?: NonNullable<BulkToolResponse['responsePagination']>): T;
|
|
6
|
+
export declare function appendResponsePagination<T extends Record<string, unknown>>(structuredContent: T, pagination?: NonNullable<BulkToolResponse['responsePagination']>, next?: NonNullable<BulkToolResponse['responsePagination']>['next']): T;
|
|
7
|
+
export declare function buildResponsePaginationContinuation(toolName: string, queries: object[], request: BulkResponsePagination | undefined, pagination: NonNullable<BulkToolResponse['responsePagination']> | undefined): NonNullable<BulkToolResponse['responsePagination']>['next'] | undefined;
|
|
@@ -8,12 +8,3 @@ export declare function processBulkQueries<TQuery extends object>(queries: Array
|
|
|
8
8
|
}>;
|
|
9
9
|
errors: QueryError[];
|
|
10
10
|
}>;
|
|
11
|
-
export declare function resolveQueryId<TQuery extends object>(originalQuery: TQuery, queryIndex: number): string;
|
|
12
|
-
/**
|
|
13
|
-
* Resolve one id per query, guaranteed unique within the batch. Everything
|
|
14
|
-
* downstream (finalizer grouping, per-query pagination maps) keys off these
|
|
15
|
-
* ids, so two queries submitted with the same explicit `id` would otherwise
|
|
16
|
-
* silently merge and the second query's pagination would overwrite the first.
|
|
17
|
-
* Collisions get a `#2`, `#3`… suffix in submission order.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveUniqueQueryIds<TQuery extends object>(queries: readonly TQuery[]): string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CallToolResult } from '@modelcontextprotocol/
|
|
2
|
-
import type { ProcessedBulkResult } from '../../../types/toolResults.js';
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
|
+
import type { ProcessedBulkResult, FlatQueryResult } from '../../../types/toolResults.js';
|
|
3
3
|
import type { BulkResponseConfig, BulkResponsePagination } from '../../../types/bulk.js';
|
|
4
4
|
export declare function executeBulkOperation<TQuery extends object, TOutput extends Record<string, unknown> = Record<string, unknown>>(queries: Array<TQuery>, processor: (query: TQuery, index: number) => Promise<ProcessedBulkResult>, config: BulkResponseConfig<TQuery, TOutput>, pagination?: BulkResponsePagination): Promise<CallToolResult>;
|
|
5
|
+
export declare function buildToolResultMeta(toolName: string, query: object, data: Record<string, unknown>, status?: 'empty' | 'error'): FlatQueryResult['meta'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { computeQueryTimeout
|
|
1
|
+
export { computeQueryTimeout } from './bulk/queries.js';
|
|
2
2
|
export { executeBulkOperation } from './bulk/response.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
2
|
export declare function sanitizeCallToolResult(result: CallToolResult): CallToolResult;
|
|
3
3
|
export declare function buildToolErrorResult(toolName: string, error: unknown): CallToolResult;
|