@octocodeai/octocode-tools-core 16.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/dist/commands/BaseCommandBuilder.d.ts +14 -0
- package/dist/commands/FindCommandBuilder.d.ts +23 -0
- package/dist/commands/LsCommandBuilder.d.ts +15 -0
- package/dist/commands/RipgrepCommandBuilder.d.ts +27 -0
- package/dist/config.d.ts +16 -0
- package/dist/direct.d.ts +3 -0
- package/dist/direct.js +53 -0
- package/dist/errors/ToolError.d.ts +21 -0
- package/dist/errors/domainErrors.d.ts +310 -0
- package/dist/errors/errorFactories.d.ts +12 -0
- package/dist/errors/localToolErrors.d.ts +29 -0
- package/dist/errors/pathUtils.d.ts +1 -0
- package/dist/github/client.d.ts +12 -0
- package/dist/github/codeSearch.d.ts +8 -0
- package/dist/github/directoryFetch.d.ts +5 -0
- package/dist/github/errorConstants.d.ts +81 -0
- package/dist/github/errors.d.ts +3 -0
- package/dist/github/fileContent.d.ts +4 -0
- package/dist/github/fileContentProcess.d.ts +11 -0
- package/dist/github/fileContentRaw.d.ts +12 -0
- package/dist/github/githubAPI.d.ts +237 -0
- package/dist/github/history.d.ts +16 -0
- package/dist/github/prByNumber.d.ts +5 -0
- package/dist/github/prContentFetcher.d.ts +5 -0
- package/dist/github/prTransformation.d.ts +109 -0
- package/dist/github/pullRequestSearch.d.ts +4 -0
- package/dist/github/queryBuilders.d.ts +12 -0
- package/dist/github/repoSearch.d.ts +25 -0
- package/dist/github/repoStructure.d.ts +7 -0
- package/dist/github/repoStructurePagination.d.ts +6 -0
- package/dist/github/repoStructureRecursive.d.ts +3 -0
- package/dist/github/responseHeaders.d.ts +1 -0
- package/dist/hints/dynamic.d.ts +6 -0
- package/dist/hints/index.d.ts +2 -0
- package/dist/hints/types.d.ts +1 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +64 -0
- package/dist/providers/capabilities.d.ts +2 -0
- package/dist/providers/factory.d.ts +9 -0
- package/dist/providers/github/GitHubProvider.d.ts +14 -0
- package/dist/providers/github/githubContent.d.ts +9 -0
- package/dist/providers/github/githubPullRequests.d.ts +12 -0
- package/dist/providers/github/githubSearch.d.ts +12 -0
- package/dist/providers/github/githubStructure.d.ts +9 -0
- package/dist/providers/github/utils.d.ts +10 -0
- package/dist/providers/providerQueries.d.ts +111 -0
- package/dist/providers/providerResults.d.ts +175 -0
- package/dist/providers/types.d.ts +48 -0
- package/dist/responses.d.ts +47 -0
- package/dist/scheme/coreSchemas.d.ts +10 -0
- package/dist/scheme/fields.d.ts +13 -0
- package/dist/scheme/responseEnvelope.d.ts +16 -0
- package/dist/security/bridge.d.ts +10 -0
- package/dist/serverConfig.d.ts +23 -0
- package/dist/session.d.ts +25 -0
- package/dist/tools/directToolCatalog.d.ts +56 -0
- package/dist/tools/executionGuard.d.ts +14 -0
- package/dist/tools/github_clone_repo/cache.d.ts +21 -0
- package/dist/tools/github_clone_repo/cloneRepo.d.ts +6 -0
- package/dist/tools/github_clone_repo/execution.d.ts +8 -0
- package/dist/tools/github_clone_repo/hints.d.ts +2 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +50 -0
- package/dist/tools/github_clone_repo/types.d.ts +19 -0
- package/dist/tools/github_fetch_content/execution.d.ts +7 -0
- package/dist/tools/github_fetch_content/finalizer.d.ts +10 -0
- package/dist/tools/github_fetch_content/hints.d.ts +2 -0
- package/dist/tools/github_fetch_content/scheme.d.ts +120 -0
- package/dist/tools/github_fetch_content/types.d.ts +66 -0
- package/dist/tools/github_search_code/execution.d.ts +8 -0
- package/dist/tools/github_search_code/finalizer.d.ts +6 -0
- package/dist/tools/github_search_code/hints.d.ts +2 -0
- package/dist/tools/github_search_code/scheme.d.ts +88 -0
- package/dist/tools/github_search_pull_requests/contentRequest.d.ts +52 -0
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +18 -0
- package/dist/tools/github_search_pull_requests/execution.d.ts +17 -0
- package/dist/tools/github_search_pull_requests/hints.d.ts +2 -0
- package/dist/tools/github_search_pull_requests/scheme.d.ts +224 -0
- package/dist/tools/github_search_pull_requests/types.d.ts +120 -0
- package/dist/tools/github_search_repos/execution.d.ts +17 -0
- package/dist/tools/github_search_repos/hints.d.ts +2 -0
- package/dist/tools/github_search_repos/scheme.d.ts +96 -0
- package/dist/tools/github_view_repo_structure/constants.d.ts +4 -0
- package/dist/tools/github_view_repo_structure/execution.d.ts +20 -0
- package/dist/tools/github_view_repo_structure/hints.d.ts +2 -0
- package/dist/tools/github_view_repo_structure/scheme.d.ts +81 -0
- package/dist/tools/github_view_repo_structure/types.d.ts +39 -0
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +22 -0
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +49 -0
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +18 -0
- package/dist/tools/local_binary_inspect/decompressOps.d.ts +16 -0
- package/dist/tools/local_binary_inspect/execution.d.ts +4 -0
- package/dist/tools/local_binary_inspect/scheme.d.ts +44 -0
- package/dist/tools/local_fetch_content/contentExtractor.d.ts +9 -0
- package/dist/tools/local_fetch_content/execution.d.ts +5 -0
- package/dist/tools/local_fetch_content/fetchContent.d.ts +4 -0
- package/dist/tools/local_fetch_content/hints.d.ts +2 -0
- package/dist/tools/local_fetch_content/scheme.d.ts +31 -0
- package/dist/tools/local_find_files/execution.d.ts +5 -0
- package/dist/tools/local_find_files/findFiles.d.ts +11 -0
- package/dist/tools/local_find_files/hints.d.ts +2 -0
- package/dist/tools/local_find_files/scheme.d.ts +9 -0
- package/dist/tools/local_ripgrep/execution.d.ts +5 -0
- package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +3 -0
- package/dist/tools/local_ripgrep/hints.d.ts +2 -0
- package/dist/tools/local_ripgrep/patternValidation.d.ts +12 -0
- package/dist/tools/local_ripgrep/ripgrepExecutor.d.ts +3 -0
- package/dist/tools/local_ripgrep/ripgrepParser.d.ts +9 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +9 -0
- package/dist/tools/local_ripgrep/scheme.d.ts +55 -0
- package/dist/tools/local_ripgrep/searchContentRipgrep.d.ts +5 -0
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +9 -0
- package/dist/tools/local_view_structure/execution.d.ts +5 -0
- package/dist/tools/local_view_structure/hints.d.ts +2 -0
- package/dist/tools/local_view_structure/local_view_structure.d.ts +7 -0
- package/dist/tools/local_view_structure/scheme.d.ts +33 -0
- package/dist/tools/local_view_structure/structureFilters.d.ts +33 -0
- package/dist/tools/local_view_structure/structureParser.d.ts +3 -0
- package/dist/tools/local_view_structure/structureResponse.d.ts +32 -0
- package/dist/tools/local_view_structure/structureWalker.d.ts +24 -0
- package/dist/tools/lsp/semantic_content/execution.d.ts +4 -0
- package/dist/tools/lsp/semantic_content/hints.d.ts +4 -0
- package/dist/tools/lsp/semantic_content/index.d.ts +2 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +509 -0
- package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +11 -0
- package/dist/tools/lsp/shared/resolveSymbolAnchor.d.ts +20 -0
- package/dist/tools/lsp/shared/semanticTypes.d.ts +134 -0
- package/dist/tools/package_search/execution.d.ts +7 -0
- package/dist/tools/package_search/hints.d.ts +2 -0
- package/dist/tools/package_search/scheme.d.ts +51 -0
- package/dist/tools/providerExecution.d.ts +51 -0
- package/dist/tools/providerMappers.d.ts +277 -0
- package/dist/tools/toolConfig.d.ts +41 -0
- package/dist/tools/toolMetadata/baseSchema.d.ts +2 -0
- package/dist/tools/toolMetadata/descriptions.d.ts +1 -0
- package/dist/tools/toolMetadata/gateway.d.ts +7 -0
- package/dist/tools/toolMetadata/metadataPresence.d.ts +1 -0
- package/dist/tools/toolMetadata/names.d.ts +2 -0
- package/dist/tools/toolMetadata/proxies.d.ts +10 -0
- package/dist/tools/toolMetadata/state.d.ts +5 -0
- package/dist/tools/toolMetadata/types.d.ts +2 -0
- package/dist/tools/toolNames.d.ts +2 -0
- package/dist/tools/utils.d.ts +27 -0
- package/dist/types/bulk.d.ts +41 -0
- package/dist/types/execution.d.ts +11 -0
- package/dist/types/metadata.d.ts +69 -0
- package/dist/types/promise.d.ts +12 -0
- package/dist/types/responseTypes.d.ts +57 -0
- package/dist/types/server.d.ts +15 -0
- package/dist/types/session.d.ts +29 -0
- package/dist/types/toolResults.d.ts +62 -0
- package/dist/utils/contextUtils.d.ts +31 -0
- package/dist/utils/core/bestEffort.d.ts +2 -0
- package/dist/utils/core/compare.d.ts +1 -0
- package/dist/utils/core/constants.d.ts +47 -0
- package/dist/utils/core/promise.d.ts +2 -0
- package/dist/utils/core/safeRegex.d.ts +5 -0
- package/dist/utils/core/types.d.ts +50 -0
- package/dist/utils/environment/environmentDetection.d.ts +5 -0
- package/dist/utils/exec/commandAvailability.d.ts +19 -0
- package/dist/utils/exec/npm.d.ts +16 -0
- package/dist/utils/exec/ripgrepBinary.d.ts +3 -0
- package/dist/utils/exec/safe.d.ts +2 -0
- package/dist/utils/exec/spawn.d.ts +34 -0
- package/dist/utils/file/byteOffset.d.ts +12 -0
- package/dist/utils/file/filters.d.ts +11 -0
- package/dist/utils/file/size.d.ts +2 -0
- package/dist/utils/file/toolHelpers.d.ts +28 -0
- package/dist/utils/http/cache.d.ts +16 -0
- package/dist/utils/http/circuitBreaker.d.ts +17 -0
- package/dist/utils/http/fetch.d.ts +13 -0
- package/dist/utils/package/common.d.ts +5 -0
- package/dist/utils/package/npm.d.ts +8 -0
- package/dist/utils/package/schemas.d.ts +60 -0
- package/dist/utils/package/types.d.ts +55 -0
- package/dist/utils/pagination/boundary.d.ts +11 -0
- package/dist/utils/pagination/charLimit.d.ts +3 -0
- package/dist/utils/pagination/core.d.ts +15 -0
- package/dist/utils/pagination/hints.d.ts +3 -0
- package/dist/utils/pagination/outputSizeLimit.d.ts +16 -0
- package/dist/utils/pagination/types.d.ts +43 -0
- package/dist/utils/parsers/diff.d.ts +2 -0
- package/dist/utils/parsers/ripgrep.d.ts +11 -0
- package/dist/utils/parsers/schemas.d.ts +72 -0
- package/dist/utils/response/bulk.d.ts +5 -0
- package/dist/utils/response/callToolResult.d.ts +3 -0
- package/dist/utils/response/charSavings.d.ts +3 -0
- package/dist/utils/response/error.d.ts +20 -0
- package/dist/utils/response/groupedFinalizer.d.ts +37 -0
- package/dist/utils/response/pathRelativize.d.ts +9 -0
- package/dist/utils/response/structuredPagination.d.ts +9 -0
- package/dist/zod.d.ts +1 -0
- package/dist/zod.js +8 -0
- package/package.json +66 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ICodeHostProvider, ProviderType, ProviderConfig } from './types.js';
|
|
2
|
+
export declare function getProvider(type?: ProviderType, config?: ProviderConfig): ICodeHostProvider;
|
|
3
|
+
export declare function clearProviderCache(): void;
|
|
4
|
+
export interface ProviderDiagnostic {
|
|
5
|
+
provider: string;
|
|
6
|
+
ok: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function initializeProviders(): Promise<ProviderDiagnostic[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICodeHostProvider, ProviderConfig, ProviderResponse, CodeSearchQuery, CodeSearchResult, FileContentQuery, FileContentResult, RepoSearchQuery, RepoSearchResult, PullRequestQuery, PullRequestSearchResult, RepoStructureQuery, RepoStructureResult } from '../types.js';
|
|
2
|
+
export declare class GitHubProvider implements ICodeHostProvider {
|
|
3
|
+
readonly type: "github";
|
|
4
|
+
readonly capabilities: import("../types.js").ProviderCapabilities;
|
|
5
|
+
private authInfo?;
|
|
6
|
+
constructor(config?: ProviderConfig);
|
|
7
|
+
searchCode(query: CodeSearchQuery): Promise<ProviderResponse<CodeSearchResult>>;
|
|
8
|
+
getFileContent(query: FileContentQuery): Promise<ProviderResponse<FileContentResult>>;
|
|
9
|
+
searchRepos(query: RepoSearchQuery): Promise<ProviderResponse<RepoSearchResult>>;
|
|
10
|
+
searchPullRequests(query: PullRequestQuery): Promise<ProviderResponse<PullRequestSearchResult>>;
|
|
11
|
+
getRepoStructure(query: RepoStructureQuery): Promise<ProviderResponse<RepoStructureResult>>;
|
|
12
|
+
resolveDefaultBranch(projectId: string): Promise<string>;
|
|
13
|
+
private handleError;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
|
+
import type { ProviderResponse, FileContentQuery, FileContentResult } from '../types.js';
|
|
3
|
+
import type { GitHubFileContentApiData } from '../../tools/github_fetch_content/types.js';
|
|
4
|
+
export { parseGitHubProjectId } from './utils.js';
|
|
5
|
+
export declare function transformFileContentResult(data: GitHubFileContentApiData, query: FileContentQuery): FileContentResult;
|
|
6
|
+
export declare function getFileContent(query: FileContentQuery, authInfo?: AuthInfo, parseProjectId?: (projectId?: string) => {
|
|
7
|
+
owner?: string;
|
|
8
|
+
repo?: string;
|
|
9
|
+
}): Promise<ProviderResponse<FileContentResult>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
|
+
import type { ProviderResponse, PullRequestQuery, PullRequestSearchResult } from '../types.js';
|
|
3
|
+
import type { GitHubPullRequestSearchApiData } from '../../tools/github_search_pull_requests/types.js';
|
|
4
|
+
export { parseGitHubProjectId } from './utils.js';
|
|
5
|
+
export declare function transformPullRequestResult(data: GitHubPullRequestSearchApiData, query: PullRequestQuery, parseProjectId?: (projectId?: string) => {
|
|
6
|
+
owner?: string;
|
|
7
|
+
repo?: string;
|
|
8
|
+
}): PullRequestSearchResult;
|
|
9
|
+
export declare function searchPullRequests(query: PullRequestQuery, authInfo?: AuthInfo, parseProjectId?: (projectId?: string) => {
|
|
10
|
+
owner?: string;
|
|
11
|
+
repo?: string;
|
|
12
|
+
}): Promise<ProviderResponse<PullRequestSearchResult>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
|
+
import type { ProviderResponse, CodeSearchQuery, CodeSearchResult, RepoSearchQuery, RepoSearchResult } from '../types.js';
|
|
3
|
+
import type { GitHubSearchRepositoriesData } from '@octocodeai/octocode-core/extra-types';
|
|
4
|
+
import type { OptimizedCodeSearchResult } from '../../github/githubAPI.js';
|
|
5
|
+
export { parseGitHubProjectId } from './utils.js';
|
|
6
|
+
export declare function transformCodeSearchResult(data: OptimizedCodeSearchResult): CodeSearchResult;
|
|
7
|
+
export declare function transformRepoSearchResult(data: GitHubSearchRepositoriesData): RepoSearchResult;
|
|
8
|
+
export declare function searchCode(query: CodeSearchQuery, authInfo?: AuthInfo, parseProjectId?: (projectId?: string) => {
|
|
9
|
+
owner?: string;
|
|
10
|
+
repo?: string;
|
|
11
|
+
}): Promise<ProviderResponse<CodeSearchResult>>;
|
|
12
|
+
export declare function searchRepos(query: RepoSearchQuery, authInfo?: AuthInfo): Promise<ProviderResponse<RepoSearchResult>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
|
+
import type { ProviderResponse, RepoStructureQuery, RepoStructureResult } from '../types.js';
|
|
3
|
+
import type { GitHubRepositoryStructureResult } from '../../tools/github_view_repo_structure/types.js';
|
|
4
|
+
export { parseGitHubProjectId } from './utils.js';
|
|
5
|
+
export declare function transformRepoStructureResult(data: GitHubRepositoryStructureResult): RepoStructureResult;
|
|
6
|
+
export declare function getRepoStructure(query: RepoStructureQuery, authInfo?: AuthInfo, parseProjectId?: (projectId?: string) => {
|
|
7
|
+
owner?: string;
|
|
8
|
+
repo?: string;
|
|
9
|
+
}): Promise<ProviderResponse<RepoStructureResult>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GitHubAPIError } from '../../github/githubAPI.js';
|
|
2
|
+
import type { ProviderResponse } from '../types.js';
|
|
3
|
+
type GitHubProviderErrorSource = Pick<GitHubAPIError, 'error'> & Partial<Pick<GitHubAPIError, 'status' | 'hints' | 'rateLimitRemaining' | 'rateLimitReset' | 'retryAfter'>>;
|
|
4
|
+
export declare function parseGitHubProjectId(projectId?: string): {
|
|
5
|
+
owner?: string;
|
|
6
|
+
repo?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function createGitHubProviderError(apiError: GitHubProviderErrorSource): ProviderResponse<never>;
|
|
9
|
+
export declare function createGitHubProviderErrorFromResult(result: unknown): ProviderResponse<never> | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
type ProviderType = 'github';
|
|
2
|
+
interface BaseProviderQuery {
|
|
3
|
+
provider?: ProviderType;
|
|
4
|
+
id?: string;
|
|
5
|
+
mainResearchGoal?: string;
|
|
6
|
+
researchGoal?: string;
|
|
7
|
+
reasoning?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CodeSearchQuery extends BaseProviderQuery {
|
|
10
|
+
keywords: string[];
|
|
11
|
+
projectId?: string;
|
|
12
|
+
owner?: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
filename?: string;
|
|
15
|
+
extension?: string;
|
|
16
|
+
language?: string;
|
|
17
|
+
match?: 'file' | 'path';
|
|
18
|
+
limit?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface FileContentQuery extends BaseProviderQuery {
|
|
22
|
+
projectId: string;
|
|
23
|
+
path: string;
|
|
24
|
+
ref?: string;
|
|
25
|
+
startLine?: number;
|
|
26
|
+
endLine?: number;
|
|
27
|
+
matchString?: string;
|
|
28
|
+
contextLines?: number;
|
|
29
|
+
matchStringIsRegex?: boolean;
|
|
30
|
+
matchStringCaseSensitive?: boolean;
|
|
31
|
+
charOffset?: number;
|
|
32
|
+
charLength?: number;
|
|
33
|
+
fullContent?: boolean;
|
|
34
|
+
minify: 'none' | 'standard' | 'symbols';
|
|
35
|
+
}
|
|
36
|
+
export interface RepoSearchQuery extends BaseProviderQuery {
|
|
37
|
+
keywords?: string[];
|
|
38
|
+
topics?: string[];
|
|
39
|
+
owner?: string;
|
|
40
|
+
minStars?: number;
|
|
41
|
+
stars?: string;
|
|
42
|
+
size?: string;
|
|
43
|
+
created?: string;
|
|
44
|
+
updated?: string;
|
|
45
|
+
language?: string;
|
|
46
|
+
match?: Array<'name' | 'description' | 'readme'>;
|
|
47
|
+
archived?: boolean;
|
|
48
|
+
visibility?: 'public' | 'private';
|
|
49
|
+
forks?: string;
|
|
50
|
+
license?: string;
|
|
51
|
+
goodFirstIssues?: string;
|
|
52
|
+
sort?: 'stars' | 'forks' | 'updated' | 'created' | 'best-match';
|
|
53
|
+
order?: 'asc' | 'desc';
|
|
54
|
+
limit?: number;
|
|
55
|
+
page?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface PullRequestQuery extends BaseProviderQuery {
|
|
58
|
+
projectId?: string;
|
|
59
|
+
owner?: string;
|
|
60
|
+
repo?: string;
|
|
61
|
+
query?: string;
|
|
62
|
+
number?: number;
|
|
63
|
+
state?: 'open' | 'closed' | 'merged' | 'all';
|
|
64
|
+
author?: string;
|
|
65
|
+
assignee?: string;
|
|
66
|
+
commenter?: string;
|
|
67
|
+
involves?: string;
|
|
68
|
+
mentions?: string;
|
|
69
|
+
reviewRequested?: string;
|
|
70
|
+
reviewedBy?: string;
|
|
71
|
+
labels?: string[];
|
|
72
|
+
noLabel?: boolean;
|
|
73
|
+
noMilestone?: boolean;
|
|
74
|
+
noProject?: boolean;
|
|
75
|
+
noAssignee?: boolean;
|
|
76
|
+
baseBranch?: string;
|
|
77
|
+
headBranch?: string;
|
|
78
|
+
created?: string;
|
|
79
|
+
updated?: string;
|
|
80
|
+
closed?: string;
|
|
81
|
+
mergedAt?: string;
|
|
82
|
+
comments?: number | string;
|
|
83
|
+
reactions?: number | string;
|
|
84
|
+
interactions?: number | string;
|
|
85
|
+
draft?: boolean;
|
|
86
|
+
match?: Array<'title' | 'body' | 'comments'>;
|
|
87
|
+
archived?: boolean;
|
|
88
|
+
content?: unknown;
|
|
89
|
+
reviewMode?: 'summary' | 'full';
|
|
90
|
+
filePage?: number;
|
|
91
|
+
commentPage?: number;
|
|
92
|
+
commitPage?: number;
|
|
93
|
+
itemsPerPage?: number;
|
|
94
|
+
sort?: 'created' | 'updated' | 'best-match' | 'comments' | 'reactions';
|
|
95
|
+
order?: 'asc' | 'desc';
|
|
96
|
+
limit?: number;
|
|
97
|
+
page?: number;
|
|
98
|
+
charOffset?: number;
|
|
99
|
+
charLength?: number;
|
|
100
|
+
}
|
|
101
|
+
export interface RepoStructureQuery extends BaseProviderQuery {
|
|
102
|
+
projectId: string;
|
|
103
|
+
ref?: string;
|
|
104
|
+
path?: string;
|
|
105
|
+
depth?: number;
|
|
106
|
+
recursive?: boolean;
|
|
107
|
+
itemsPerPage?: number;
|
|
108
|
+
page?: number;
|
|
109
|
+
includeSizes?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { PaginationInfo } from '../types/toolResults.js';
|
|
2
|
+
export interface UnifiedRepository {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
fullPath: string;
|
|
6
|
+
description: string | null;
|
|
7
|
+
url: string;
|
|
8
|
+
cloneUrl: string;
|
|
9
|
+
defaultBranch: string;
|
|
10
|
+
stars: number;
|
|
11
|
+
forks: number;
|
|
12
|
+
visibility: 'public' | 'private' | 'internal';
|
|
13
|
+
topics: string[];
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
lastActivityAt: string;
|
|
17
|
+
openIssuesCount?: number;
|
|
18
|
+
archived?: boolean;
|
|
19
|
+
language?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CodeSearchItem {
|
|
22
|
+
path: string;
|
|
23
|
+
matches: Array<{
|
|
24
|
+
context: string;
|
|
25
|
+
positions: [number, number][];
|
|
26
|
+
}>;
|
|
27
|
+
url: string;
|
|
28
|
+
repository: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
url: string;
|
|
32
|
+
};
|
|
33
|
+
lastModifiedAt?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CodeSearchResult {
|
|
36
|
+
items: CodeSearchItem[];
|
|
37
|
+
totalCount: number;
|
|
38
|
+
pagination: PaginationInfo;
|
|
39
|
+
repositoryContext?: {
|
|
40
|
+
owner: string;
|
|
41
|
+
repo: string;
|
|
42
|
+
branch?: string;
|
|
43
|
+
};
|
|
44
|
+
nonExistentScope?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface FileContentResult {
|
|
47
|
+
path: string;
|
|
48
|
+
content: string;
|
|
49
|
+
encoding: 'utf-8' | 'base64';
|
|
50
|
+
size: number;
|
|
51
|
+
totalLines?: number;
|
|
52
|
+
sourceChars?: number;
|
|
53
|
+
sourceBytes?: number;
|
|
54
|
+
contentView?: 'none' | 'standard' | 'symbols';
|
|
55
|
+
isSkeleton?: boolean;
|
|
56
|
+
ref: string;
|
|
57
|
+
lastModified?: string;
|
|
58
|
+
lastModifiedBy?: string;
|
|
59
|
+
lastCommitSha?: string;
|
|
60
|
+
pagination?: PaginationInfo;
|
|
61
|
+
isPartial?: boolean;
|
|
62
|
+
startLine?: number;
|
|
63
|
+
endLine?: number;
|
|
64
|
+
matchRanges?: Array<{
|
|
65
|
+
start: number;
|
|
66
|
+
end: number;
|
|
67
|
+
}>;
|
|
68
|
+
warnings?: string[];
|
|
69
|
+
matchNotFound?: boolean;
|
|
70
|
+
searchedFor?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface RepoSearchResult {
|
|
73
|
+
repositories: UnifiedRepository[];
|
|
74
|
+
totalCount: number;
|
|
75
|
+
pagination: PaginationInfo;
|
|
76
|
+
nonExistentScope?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface PullRequestItem {
|
|
79
|
+
number: number;
|
|
80
|
+
title: string;
|
|
81
|
+
body: string | null;
|
|
82
|
+
bodyPagination?: {
|
|
83
|
+
charOffset: number;
|
|
84
|
+
charLength: number;
|
|
85
|
+
totalChars: number;
|
|
86
|
+
hasMore: boolean;
|
|
87
|
+
nextCharOffset?: number;
|
|
88
|
+
};
|
|
89
|
+
url: string;
|
|
90
|
+
state: 'open' | 'closed' | 'merged';
|
|
91
|
+
draft: boolean;
|
|
92
|
+
author: string;
|
|
93
|
+
assignees: string[];
|
|
94
|
+
labels: string[];
|
|
95
|
+
sourceBranch: string;
|
|
96
|
+
targetBranch: string;
|
|
97
|
+
sourceSha?: string;
|
|
98
|
+
targetSha?: string;
|
|
99
|
+
createdAt: string;
|
|
100
|
+
updatedAt: string;
|
|
101
|
+
closedAt?: string;
|
|
102
|
+
mergedAt?: string;
|
|
103
|
+
commentsCount?: number;
|
|
104
|
+
changedFilesCount?: number;
|
|
105
|
+
additions?: number;
|
|
106
|
+
deletions?: number;
|
|
107
|
+
comments?: Array<{
|
|
108
|
+
id: string;
|
|
109
|
+
author: string;
|
|
110
|
+
body: string;
|
|
111
|
+
createdAt: string;
|
|
112
|
+
updatedAt: string;
|
|
113
|
+
bodyPagination?: {
|
|
114
|
+
charOffset: number;
|
|
115
|
+
charLength: number;
|
|
116
|
+
totalChars: number;
|
|
117
|
+
hasMore: boolean;
|
|
118
|
+
nextCharOffset?: number;
|
|
119
|
+
};
|
|
120
|
+
commentType?: 'discussion' | 'review_inline';
|
|
121
|
+
path?: string;
|
|
122
|
+
line?: number;
|
|
123
|
+
in_reply_to_id?: number;
|
|
124
|
+
}>;
|
|
125
|
+
reviews?: Array<{
|
|
126
|
+
id: string;
|
|
127
|
+
user: string;
|
|
128
|
+
state: string;
|
|
129
|
+
body: string;
|
|
130
|
+
submittedAt?: string;
|
|
131
|
+
commitId?: string;
|
|
132
|
+
}>;
|
|
133
|
+
commits?: Array<{
|
|
134
|
+
sha: string;
|
|
135
|
+
message: string;
|
|
136
|
+
author: string;
|
|
137
|
+
date: string;
|
|
138
|
+
}>;
|
|
139
|
+
fileChanges?: Array<{
|
|
140
|
+
path: string;
|
|
141
|
+
status: string;
|
|
142
|
+
additions: number;
|
|
143
|
+
deletions: number;
|
|
144
|
+
patch?: string;
|
|
145
|
+
}>;
|
|
146
|
+
sanitizationWarnings?: string[];
|
|
147
|
+
}
|
|
148
|
+
export interface PullRequestSearchResult {
|
|
149
|
+
items: PullRequestItem[];
|
|
150
|
+
totalCount: number;
|
|
151
|
+
pagination: PaginationInfo;
|
|
152
|
+
repositoryContext?: {
|
|
153
|
+
owner: string;
|
|
154
|
+
repo: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export interface DirectoryEntry {
|
|
158
|
+
files: string[];
|
|
159
|
+
folders: string[];
|
|
160
|
+
}
|
|
161
|
+
export interface RepoStructureResult {
|
|
162
|
+
projectPath: string;
|
|
163
|
+
branch: string;
|
|
164
|
+
defaultBranch?: string;
|
|
165
|
+
path: string;
|
|
166
|
+
structure: Record<string, DirectoryEntry>;
|
|
167
|
+
fileSizeMap?: Record<string, Record<string, number>>;
|
|
168
|
+
summary: {
|
|
169
|
+
totalFiles: number;
|
|
170
|
+
totalFolders: number;
|
|
171
|
+
truncated: boolean;
|
|
172
|
+
};
|
|
173
|
+
pagination?: PaginationInfo;
|
|
174
|
+
hints?: string[];
|
|
175
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
|
+
export type { CodeSearchQuery, FileContentQuery, RepoSearchQuery, PullRequestQuery, RepoStructureQuery, } from './providerQueries.js';
|
|
3
|
+
export type { UnifiedRepository, CodeSearchItem, CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestItem, PullRequestSearchResult, DirectoryEntry, RepoStructureResult, } from './providerResults.js';
|
|
4
|
+
import type { CodeSearchQuery, FileContentQuery, RepoSearchQuery, PullRequestQuery, RepoStructureQuery } from './providerQueries.js';
|
|
5
|
+
import type { CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestSearchResult, RepoStructureResult } from './providerResults.js';
|
|
6
|
+
export type ProviderType = 'github';
|
|
7
|
+
export interface ProviderConfig {
|
|
8
|
+
type: ProviderType;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
token?: string;
|
|
11
|
+
authInfo?: AuthInfo;
|
|
12
|
+
}
|
|
13
|
+
export interface ProviderCapabilities {
|
|
14
|
+
cloneRepo: boolean;
|
|
15
|
+
fetchDirectoryToDisk: boolean;
|
|
16
|
+
requiresScopedCodeSearch: boolean;
|
|
17
|
+
supportsMergedState: boolean;
|
|
18
|
+
supportsMultiTopicSearch: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ProviderResponse<T> {
|
|
21
|
+
data?: T;
|
|
22
|
+
error?: string;
|
|
23
|
+
status: number;
|
|
24
|
+
provider: ProviderType;
|
|
25
|
+
hints?: string[];
|
|
26
|
+
rateLimit?: {
|
|
27
|
+
remaining: number;
|
|
28
|
+
reset: number;
|
|
29
|
+
retryAfter?: number;
|
|
30
|
+
};
|
|
31
|
+
rawResponseChars?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ICodeHostProvider {
|
|
34
|
+
readonly type: ProviderType;
|
|
35
|
+
readonly capabilities: ProviderCapabilities;
|
|
36
|
+
searchCode(query: CodeSearchQuery): Promise<ProviderResponse<CodeSearchResult>>;
|
|
37
|
+
getFileContent(query: FileContentQuery): Promise<ProviderResponse<FileContentResult>>;
|
|
38
|
+
searchRepos(query: RepoSearchQuery): Promise<ProviderResponse<RepoSearchResult>>;
|
|
39
|
+
searchPullRequests(query: PullRequestQuery): Promise<ProviderResponse<PullRequestSearchResult>>;
|
|
40
|
+
getRepoStructure(query: RepoStructureQuery): Promise<ProviderResponse<RepoStructureResult>>;
|
|
41
|
+
resolveDefaultBranch(projectId: string): Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
export declare function isProviderSuccess<T>(response: ProviderResponse<T>): response is ProviderResponse<T> & {
|
|
44
|
+
data: T;
|
|
45
|
+
};
|
|
46
|
+
export declare function isProviderError<T>(response: ProviderResponse<T>): response is ProviderResponse<T> & {
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types';
|
|
2
|
+
import type { BulkToolResponse } from './types/bulk.js';
|
|
3
|
+
import type { StructuredToolResponse } from './types/toolResults.js';
|
|
4
|
+
import type { RoleContentBlock, RoleBasedResultOptions } from './types/responseTypes.js';
|
|
5
|
+
export { StatusEmojis } from './types/responseTypes.js';
|
|
6
|
+
export type { ContentRole, RoleContentBlock, RoleBasedResultOptions, RoleAnnotations, } from './types/responseTypes.js';
|
|
7
|
+
export type CallToolResultOutputMode = 'text' | 'json';
|
|
8
|
+
export declare function createResult(options: {
|
|
9
|
+
data: unknown;
|
|
10
|
+
instructions?: string;
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
}): CallToolResult;
|
|
13
|
+
export declare const ContentBuilder: {
|
|
14
|
+
system(text: string, priority?: number): RoleContentBlock;
|
|
15
|
+
assistant(text: string, priority?: number): RoleContentBlock;
|
|
16
|
+
user(text: string, priority?: number): RoleContentBlock;
|
|
17
|
+
data(data: unknown, format?: "yaml" | "json"): RoleContentBlock;
|
|
18
|
+
};
|
|
19
|
+
export declare const StatusEmoji: {
|
|
20
|
+
readonly success: "✅";
|
|
21
|
+
readonly empty: "📭";
|
|
22
|
+
readonly error: "❌";
|
|
23
|
+
readonly partial: "⚠️";
|
|
24
|
+
readonly searching: "🔍";
|
|
25
|
+
readonly loading: "⏳";
|
|
26
|
+
readonly info: "ℹ️";
|
|
27
|
+
readonly file: "📄";
|
|
28
|
+
readonly folder: "📁";
|
|
29
|
+
readonly page: "📃";
|
|
30
|
+
readonly definition: "🎯";
|
|
31
|
+
readonly reference: "🔗";
|
|
32
|
+
readonly call: "📞";
|
|
33
|
+
};
|
|
34
|
+
export declare function createRoleBasedResult(options: RoleBasedResultOptions): CallToolResult;
|
|
35
|
+
export declare const QuickResult: {
|
|
36
|
+
success(summary: string, data: unknown, hints?: string[]): CallToolResult;
|
|
37
|
+
empty(message: string, hints?: string[]): CallToolResult;
|
|
38
|
+
error(error: string, details?: unknown): CallToolResult;
|
|
39
|
+
paginated(summary: string, data: unknown, pagination: {
|
|
40
|
+
page: number;
|
|
41
|
+
total: number;
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
}, hints?: string[]): CallToolResult;
|
|
44
|
+
};
|
|
45
|
+
export declare function sanitizeStructuredContent(obj: unknown): unknown;
|
|
46
|
+
export declare function formatCallToolResultForOutput(result: Pick<CallToolResult, 'content' | 'structuredContent' | 'isError'>, outputMode: CallToolResultOutputMode): string;
|
|
47
|
+
export declare function createResponseFormat(responseData: StructuredToolResponse | BulkToolResponse, keysPriority?: string[]): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
type AnyZodObject = z.ZodObject<z.ZodRawShape>;
|
|
3
|
+
export type QueryShape = Record<string, z.ZodTypeAny>;
|
|
4
|
+
export declare function describeQuerySchema<T extends AnyZodObject>(coreSchema: T, overrides?: QueryShape, options?: {
|
|
5
|
+
strict?: boolean;
|
|
6
|
+
}): T;
|
|
7
|
+
export declare function createQueryShapeSchema<T extends AnyZodObject>(coreSchema: T, overrides?: QueryShape, options?: {
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
}): AnyZodObject;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare function clampedInt(min: number, max: number): z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>;
|
|
3
|
+
export type MinifyMode = 'none' | 'standard' | 'symbols';
|
|
4
|
+
export declare const relaxedPageNumberField: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
|
|
5
|
+
export declare const contextLinesField: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
|
|
6
|
+
export declare const lineNumberField: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
|
|
7
|
+
export declare function createRelaxedBulkQuerySchema(querySchema: z.ZodTypeAny, options?: {
|
|
8
|
+
maxQueries?: number;
|
|
9
|
+
}): z.ZodObject<{
|
|
10
|
+
responseCharOffset: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
|
|
11
|
+
responseCharLength: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
|
|
12
|
+
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const responseEnvelopeFields: {
|
|
3
|
+
readonly hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4
|
+
readonly base: z.ZodOptional<z.ZodString>;
|
|
5
|
+
readonly shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
6
|
+
readonly responsePagination: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
currentPage: z.ZodNumber;
|
|
8
|
+
totalPages: z.ZodNumber;
|
|
9
|
+
hasMore: z.ZodBoolean;
|
|
10
|
+
charOffset: z.ZodNumber;
|
|
11
|
+
charLength: z.ZodNumber;
|
|
12
|
+
totalChars: z.ZodNumber;
|
|
13
|
+
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
};
|
|
16
|
+
export declare function withResponseEnvelope<S extends z.ZodObject>(schema: S): S;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
3
|
+
export declare function withSecurityValidation<T extends Record<string, unknown>>(toolName: string, toolHandler: (sanitizedArgs: T, authInfo?: AuthInfo, sessionId?: string) => Promise<CallToolResult>): (args: unknown, extra: {
|
|
4
|
+
authInfo?: AuthInfo;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}) => Promise<CallToolResult>;
|
|
8
|
+
export declare function withBasicSecurityValidation<T extends object>(toolHandler: (sanitizedArgs: T) => Promise<CallToolResult>, toolName?: string): (args: unknown, extra?: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}) => Promise<CallToolResult>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProviderType } from './providers/types.js';
|
|
2
|
+
import { resolveTokenFull } from 'octocode-shared';
|
|
3
|
+
import type { ServerConfig, TokenSourceType } from './types/server.js';
|
|
4
|
+
type ResolveTokenFullFn = typeof resolveTokenFull;
|
|
5
|
+
export declare function _setTokenResolvers(resolvers: {
|
|
6
|
+
resolveTokenFull?: ResolveTokenFullFn;
|
|
7
|
+
}): void;
|
|
8
|
+
export declare function _resetTokenResolvers(): void;
|
|
9
|
+
export declare function initialize(): Promise<void>;
|
|
10
|
+
export declare function cleanup(): void;
|
|
11
|
+
export declare function getServerConfig(): ServerConfig;
|
|
12
|
+
export declare function getGitHubToken(): Promise<string | null>;
|
|
13
|
+
export declare function isLocalEnabled(): boolean;
|
|
14
|
+
export declare function isCloneEnabled(): boolean;
|
|
15
|
+
export declare function isLoggingEnabled(): boolean;
|
|
16
|
+
export declare function getTokenSource(): Promise<TokenSourceType>;
|
|
17
|
+
export declare function getActiveProvider(): ProviderType;
|
|
18
|
+
export declare function getActiveProviderConfig(): {
|
|
19
|
+
provider: ProviderType;
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
token?: string;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PersistedSession } from 'octocode-shared';
|
|
2
|
+
import type { RateLimitData } from './types/session.js';
|
|
3
|
+
declare class SessionManager {
|
|
4
|
+
private session;
|
|
5
|
+
private readonly logEndpoint;
|
|
6
|
+
constructor();
|
|
7
|
+
getSessionId(): string;
|
|
8
|
+
getSession(): PersistedSession;
|
|
9
|
+
logInit(): Promise<void>;
|
|
10
|
+
logToolCall(toolName: string, repos: string[], _mainResearchGoal?: string, _researchGoal?: string, _reasoning?: string): Promise<void>;
|
|
11
|
+
logError(toolName: string, errorCode: string): Promise<void>;
|
|
12
|
+
logRateLimit(data: RateLimitData): Promise<void>;
|
|
13
|
+
logPackageRegistryFailure(registry: string): void;
|
|
14
|
+
private sendLog;
|
|
15
|
+
}
|
|
16
|
+
export declare function initializeSession(): SessionManager;
|
|
17
|
+
export declare function getSessionManager(): SessionManager | null;
|
|
18
|
+
export declare function logSessionInit(): Promise<void>;
|
|
19
|
+
export declare function logToolCall(toolName: string, repos: string[], mainResearchGoal?: string, researchGoal?: string, reasoning?: string): Promise<void>;
|
|
20
|
+
export declare function logPromptCall(promptName: string): Promise<void>;
|
|
21
|
+
export declare function logSessionError(toolName: string, errorCode: string): Promise<void>;
|
|
22
|
+
export declare function logRateLimit(data: RateLimitData): Promise<void>;
|
|
23
|
+
export declare function logPackageRegistryFailure(registry: string): void;
|
|
24
|
+
export declare function resetSessionManager(): void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type DirectToolInput = Record<string, unknown> & {
|
|
4
|
+
queries: unknown[];
|
|
5
|
+
};
|
|
6
|
+
export interface DirectToolDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
schema: z.ZodType;
|
|
9
|
+
inputSchema: z.ZodType;
|
|
10
|
+
}
|
|
11
|
+
export type DirectToolCategory = 'GitHub' | 'Local' | 'LSP' | 'Package' | 'Other';
|
|
12
|
+
export declare const DIRECT_TOOL_CATEGORIES: readonly DirectToolCategory[];
|
|
13
|
+
export interface DirectToolDisplayField {
|
|
14
|
+
name: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
type: string;
|
|
17
|
+
/** Numeric bounds and default, e.g. "1-100, default 30" — surfaced inline so
|
|
18
|
+
* agents see the full constraint without fetching the raw JSON schema. */
|
|
19
|
+
constraints?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DirectToolOutputField {
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
optional?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface DirectToolMetadata {
|
|
28
|
+
tools?: Record<string, {
|
|
29
|
+
description?: string;
|
|
30
|
+
schema?: Record<string, string>;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface PrepareDirectToolInputOptions {
|
|
34
|
+
sourceLabel?: string;
|
|
35
|
+
onUnknownFields?: (unknownFields: string[], queryIndex: number) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare class DirectToolInputError extends Error {
|
|
38
|
+
readonly details: string[];
|
|
39
|
+
constructor(message: string, details?: string[]);
|
|
40
|
+
}
|
|
41
|
+
export declare const DIRECT_TOOL_DEFINITIONS: DirectToolDefinition[];
|
|
42
|
+
export declare function findDirectToolDefinition(name: string): DirectToolDefinition | undefined;
|
|
43
|
+
export declare function getDirectToolCategory(toolName: string): DirectToolCategory;
|
|
44
|
+
export declare function sortDirectToolNames(toolNames: string[]): string[];
|
|
45
|
+
export declare function formatDirectToolSchemaText(toolName: string): string;
|
|
46
|
+
export declare function formatDirectToolMetadataSchemaText(schema: Record<string, string> | undefined): string;
|
|
47
|
+
export declare function getDirectToolAutoFilledFields(toolName: string): string[];
|
|
48
|
+
export declare function getDirectToolOutputFields(): DirectToolOutputField[];
|
|
49
|
+
export declare function formatDirectToolOutputSchemaText(): string;
|
|
50
|
+
export declare function getDirectToolDescription(toolName: string, metadata?: DirectToolMetadata | null): string;
|
|
51
|
+
export declare function getDirectToolDisplayFields(toolName: string): DirectToolDisplayField[];
|
|
52
|
+
export declare function buildDirectToolExampleQuery(toolName: string): Record<string, unknown>;
|
|
53
|
+
export declare function prepareDirectToolInputFromJsonText(toolName: string, inputText: string | undefined, options?: PrepareDirectToolInputOptions): DirectToolInput | null;
|
|
54
|
+
export declare function prepareDirectToolInput(toolName: string, rawPayload: unknown, options?: PrepareDirectToolInputOptions): DirectToolInput;
|
|
55
|
+
export declare function formatDirectToolValidationIssues(error: z.ZodError): string[];
|
|
56
|
+
export declare function executeDirectTool(name: string, input: unknown): Promise<CallToolResult>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ProcessedBulkResult } from '../types/toolResults.js';
|
|
2
|
+
interface GuardableQuery {
|
|
3
|
+
mainResearchGoal?: string;
|
|
4
|
+
researchGoal?: string;
|
|
5
|
+
reasoning?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ExecutionGuardOptions<TQuery extends GuardableQuery> {
|
|
8
|
+
toolName: string;
|
|
9
|
+
query: TQuery;
|
|
10
|
+
execute: () => Promise<ProcessedBulkResult>;
|
|
11
|
+
contextMessage?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function executeWithToolBoundary<TQuery extends GuardableQuery>({ toolName, query, execute, contextMessage, }: ExecutionGuardOptions<TQuery>): Promise<ProcessedBulkResult>;
|
|
14
|
+
export {};
|