@octocodeai/octocode-tools-core 17.0.2 → 18.0.1
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 +48 -38
- package/dist/direct.js +52 -35
- package/dist/github/canonicalRepo.d.ts +14 -0
- package/dist/github/codeSearch/matchPositions.d.ts +11 -0
- package/dist/github/codeSearch.d.ts +2 -1
- package/dist/github/compare.d.ts +42 -0
- package/dist/github/dateWindow.d.ts +4 -0
- package/dist/github/discussions.d.ts +45 -0
- package/dist/github/githubAPI.d.ts +7 -13
- package/dist/github/history/commitFiles.d.ts +39 -0
- package/dist/github/history.d.ts +1 -0
- package/dist/github/issues/types.d.ts +8 -8
- package/dist/github/prTransformation.d.ts +24 -25
- package/dist/github/queryBuilders/base.d.ts +0 -1
- package/dist/github/queryBuilders/issues.d.ts +0 -6
- package/dist/github/releases.d.ts +9 -1
- package/dist/github/responseHeaders.d.ts +6 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +56 -39
- package/dist/providers/github/githubPullRequests.d.ts +9 -0
- package/dist/providers/github/paginationMetadata.d.ts +6 -5
- package/dist/providers/providerQueries.d.ts +11 -6
- package/dist/providers/providerResults.d.ts +9 -1
- package/dist/schema.d.ts +0 -1
- package/dist/schema.js +1 -2
- package/dist/scheme/pagination.d.ts +5 -13
- package/dist/scheme/responseEnvelope.d.ts +28 -22
- package/dist/security/bridge.d.ts +3 -2
- package/dist/shared/config/index.d.ts +0 -1
- package/dist/shared/config/index.js +1 -1
- package/dist/shared/languageSelectors/classify.d.ts +2 -2
- package/dist/shared/languageSelectors/data.d.ts +4 -4
- package/dist/shared/languageSelectors.d.ts +1 -1
- package/dist/shared/paths.d.ts +1 -4
- package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +10 -11
- package/dist/tools/directToolCatalog/toolCatalogFormatters.d.ts +12 -0
- package/dist/tools/directToolCatalog.meta.d.ts +1 -0
- package/dist/tools/github_clone_repo/contentSize.d.ts +9 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +26 -96
- package/dist/tools/github_fetch_content/finalizer/types.d.ts +2 -3
- package/dist/tools/github_fetch_content/scheme.d.ts +92 -140
- package/dist/tools/github_fetch_content/types.d.ts +2 -1
- package/dist/tools/github_search_code/scheme.d.ts +39 -87
- package/dist/tools/github_search_discussions/execution.d.ts +15 -0
- package/dist/tools/github_search_discussions/scheme.d.ts +16 -0
- package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +2 -16
- package/dist/tools/github_search_pull_requests/scheme.d.ts +97 -119
- package/dist/tools/github_search_pull_requests/splitExecutions.d.ts +8 -0
- package/dist/tools/github_search_pull_requests/splitSchemes.d.ts +216 -0
- package/dist/tools/github_search_pull_requests/types.d.ts +28 -29
- package/dist/tools/github_search_repos/execution.d.ts +0 -2
- package/dist/tools/github_search_repos/scheme.d.ts +36 -64
- package/dist/tools/github_view_repo_structure/scheme.d.ts +37 -66
- package/dist/tools/local_dead_code/deadCodeScan.d.ts +26 -0
- package/dist/tools/local_dead_code/entrypoints.d.ts +16 -0
- package/dist/tools/local_dead_code/execution.d.ts +4 -0
- package/dist/tools/local_dead_code/graphBuilder.d.ts +43 -0
- package/dist/tools/local_dead_code/importResolver.d.ts +6 -0
- package/dist/tools/local_dead_code/local_dead_code.d.ts +5 -0
- package/dist/tools/local_dead_code/reachability.d.ts +21 -0
- package/dist/tools/local_dead_code/retention.d.ts +22 -0
- package/dist/tools/local_dead_code/scheme.d.ts +51 -0
- package/dist/tools/local_dead_code/types.d.ts +56 -0
- package/dist/tools/local_fetch_content/execution.d.ts +0 -1
- package/dist/tools/local_fetch_content/fetchContent/extraction.d.ts +6 -0
- package/dist/tools/local_fetch_content/fetchContent/validation.d.ts +9 -1
- package/dist/tools/local_fetch_content/fetchContent.d.ts +0 -1
- package/dist/tools/local_fetch_content/scheme.d.ts +28 -90
- package/dist/tools/local_find_files/execution.d.ts +0 -1
- package/dist/tools/local_find_files/findFiles.d.ts +0 -3
- package/dist/tools/local_find_files/findFilesNext.d.ts +26 -0
- package/dist/tools/local_find_files/pathPatternBraces.d.ts +20 -0
- package/dist/tools/local_find_files/scheme.d.ts +19 -81
- package/dist/tools/local_ripgrep/captureBudget.d.ts +25 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingProfiles.d.ts +1 -0
- package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +1 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +1 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +89 -190
- package/dist/tools/local_view_structure/execution.d.ts +0 -1
- package/dist/tools/local_view_structure/local_view_structure.d.ts +0 -1
- package/dist/tools/local_view_structure/scheme.d.ts +34 -87
- package/dist/tools/local_view_structure/structureFilters.d.ts +2 -4
- package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
- package/dist/tools/local_view_structure/viewStructureNext.d.ts +25 -0
- package/dist/tools/lsp/semantic_content/index.d.ts +2 -1
- package/dist/tools/lsp/semantic_content/scheme.d.ts +167 -642
- package/dist/tools/lsp/semantic_content/semanticAnchored.d.ts +8 -2
- package/dist/tools/lsp/semantic_content/semanticEnvelopes/locationEnvelopes.d.ts +2 -1
- package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +17 -1
- package/dist/tools/lsp/semantic_content/semanticNext.d.ts +2 -0
- package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +1 -1
- package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +14 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +14 -1
- package/dist/tools/package_search/execution.d.ts +9 -6
- package/dist/tools/package_search/queryHelpers.d.ts +8 -0
- package/dist/tools/package_search/scheme.d.ts +30 -86
- package/dist/tools/providerMappers/codeSearch.d.ts +0 -1
- package/dist/tools/providerMappers/pullRequests.d.ts +0 -13
- package/dist/tools/providerMappers/repoSearch.d.ts +1 -5
- package/dist/tools/providerMappers/repoStructure.d.ts +4 -0
- package/dist/tools/toolCatalogFactory.d.ts +25 -0
- package/dist/tools/toolConfig.d.ts +9 -24
- package/dist/tools/toolNames.d.ts +2 -2
- package/dist/tools/toolSchemaImports.d.ts +3 -1
- package/dist/types/execution.d.ts +1 -0
- package/dist/types/toolOutput.d.ts +38 -0
- package/dist/utils/contextUtils.d.ts +6 -0
- package/dist/utils/core/types.d.ts +4 -0
- package/dist/utils/jsSymbolNames.d.ts +6 -0
- package/package.json +4 -8
- package/dist/oql/adapters/compile.d.ts +0 -25
- package/dist/oql/adapters/github/execute.d.ts +0 -16
- package/dist/oql/adapters/github/provider-diagnostics.d.ts +0 -14
- package/dist/oql/adapters/github/shared.d.ts +0 -75
- package/dist/oql/adapters/github.d.ts +0 -14
- package/dist/oql/adapters/graphProof.d.ts +0 -6
- package/dist/oql/adapters/graphView/filters.d.ts +0 -25
- package/dist/oql/adapters/graphView/nativeEdges.d.ts +0 -5
- package/dist/oql/adapters/graphView.d.ts +0 -29
- package/dist/oql/adapters/local/code.d.ts +0 -3
- package/dist/oql/adapters/local/codeBoolean.d.ts +0 -3
- package/dist/oql/adapters/local/fileRowOps.d.ts +0 -11
- package/dist/oql/adapters/local/files.d.ts +0 -3
- package/dist/oql/adapters/local/filesBoolean.d.ts +0 -10
- package/dist/oql/adapters/local/filesContentLeaf.d.ts +0 -12
- package/dist/oql/adapters/local/filesUniverse.d.ts +0 -6
- package/dist/oql/adapters/local/findToolType.d.ts +0 -10
- package/dist/oql/adapters/local/predicates.d.ts +0 -18
- package/dist/oql/adapters/local/scope.d.ts +0 -14
- package/dist/oql/adapters/local/searchToolType.d.ts +0 -7
- package/dist/oql/adapters/local/structureContent.d.ts +0 -6
- package/dist/oql/adapters/local/types.d.ts +0 -34
- package/dist/oql/adapters/local.d.ts +0 -4
- package/dist/oql/adapters/materialize.d.ts +0 -11
- package/dist/oql/adapters/pagination.d.ts +0 -21
- package/dist/oql/adapters/researchTargets/diff.d.ts +0 -16
- package/dist/oql/adapters/researchTargets/graph.d.ts +0 -3
- package/dist/oql/adapters/researchTargets/history.d.ts +0 -20
- package/dist/oql/adapters/researchTargets/pagination.d.ts +0 -54
- package/dist/oql/adapters/researchTargets/repositories.d.ts +0 -4
- package/dist/oql/adapters/researchTargets/research.d.ts +0 -3
- package/dist/oql/adapters/researchTargets/rows.d.ts +0 -16
- package/dist/oql/adapters/researchTargets/semantics.d.ts +0 -3
- package/dist/oql/adapters/researchTargets/shared.d.ts +0 -11
- package/dist/oql/adapters/researchTargets.d.ts +0 -8
- package/dist/oql/adapters/resultMap.d.ts +0 -27
- package/dist/oql/adapters/ruleYaml.d.ts +0 -11
- package/dist/oql/adapters/runner.d.ts +0 -21
- package/dist/oql/capabilities.d.ts +0 -31
- package/dist/oql/defaults.d.ts +0 -26
- package/dist/oql/diagnostics.d.ts +0 -25
- package/dist/oql/diffLanes.d.ts +0 -29
- package/dist/oql/envelope.d.ts +0 -21
- package/dist/oql/features.d.ts +0 -7
- package/dist/oql/index.d.ts +0 -27
- package/dist/oql/index.js +0 -47
- package/dist/oql/normalize/batch.d.ts +0 -2
- package/dist/oql/normalize/materialize.d.ts +0 -2
- package/dist/oql/normalize/params.d.ts +0 -2
- package/dist/oql/normalize/query.d.ts +0 -2
- package/dist/oql/normalize/scope.d.ts +0 -2
- package/dist/oql/normalize/shared.d.ts +0 -7
- package/dist/oql/normalize/source.d.ts +0 -2
- package/dist/oql/normalize/where.d.ts +0 -2
- package/dist/oql/normalize.d.ts +0 -20
- package/dist/oql/planner/planDiagnostics.d.ts +0 -13
- package/dist/oql/planner/predicateRouting.d.ts +0 -35
- package/dist/oql/planner.d.ts +0 -7
- package/dist/oql/predicateUtils.d.ts +0 -3
- package/dist/oql/research/analyze/manifest-scan.d.ts +0 -4
- package/dist/oql/research/analyze/source-graph.d.ts +0 -7
- package/dist/oql/research/analyze/symbol-scoring.d.ts +0 -4
- package/dist/oql/research/analyze/types.d.ts +0 -163
- package/dist/oql/research/analyze/utils.d.ts +0 -16
- package/dist/oql/research/analyze.d.ts +0 -3
- package/dist/oql/research/packets/builders.d.ts +0 -4
- package/dist/oql/research/packets/types.d.ts +0 -91
- package/dist/oql/research/packets.d.ts +0 -21
- package/dist/oql/run/batch.d.ts +0 -3
- package/dist/oql/run/continuations/records.d.ts +0 -19
- package/dist/oql/run/continuations/registry.d.ts +0 -22
- package/dist/oql/run/continuations/semantics.d.ts +0 -3
- package/dist/oql/run/continuations/types.d.ts +0 -12
- package/dist/oql/run/dryRun.d.ts +0 -11
- package/dist/oql/run/paths.d.ts +0 -15
- package/dist/oql/run/proofGrades.d.ts +0 -8
- package/dist/oql/run/select.d.ts +0 -10
- package/dist/oql/run/single.d.ts +0 -22
- package/dist/oql/run.d.ts +0 -5
- package/dist/oql/schema/predicates.d.ts +0 -12
- package/dist/oql/schema.d.ts +0 -1049
- package/dist/oql/schemeText.d.ts +0 -152
- package/dist/oql/shorthand/predicates.d.ts +0 -15
- package/dist/oql/shorthand/query-controls.d.ts +0 -18
- package/dist/oql/shorthand/target-params.d.ts +0 -9
- package/dist/oql/shorthand/types.d.ts +0 -159
- package/dist/oql/shorthand/utils.d.ts +0 -7
- package/dist/oql/shorthand.d.ts +0 -8
- package/dist/oql/targetParams.d.ts +0 -7
- package/dist/oql/transformers/contract.d.ts +0 -19
- package/dist/oql/transformers/github/code.d.ts +0 -9
- package/dist/oql/transformers/github/common.d.ts +0 -14
- package/dist/oql/transformers/language.d.ts +0 -1
- package/dist/oql/transformers/registry.d.ts +0 -16
- package/dist/oql/transformers/types.d.ts +0 -11
- package/dist/oql/types/diagnostics.d.ts +0 -22
- package/dist/oql/types/envelope.d.ts +0 -78
- package/dist/oql/types/guards.d.ts +0 -9
- package/dist/oql/types/planner.d.ts +0 -46
- package/dist/oql/types/predicates.d.ts +0 -93
- package/dist/oql/types/query.d.ts +0 -143
- package/dist/oql/types/recordData.d.ts +0 -127
- package/dist/oql/types/recordRows.d.ts +0 -48
- package/dist/oql/types/results.d.ts +0 -118
- package/dist/oql/types/targets.d.ts +0 -22
- package/dist/oql/types.d.ts +0 -27
- package/dist/tools/oql_search/execution.d.ts +0 -7
- package/dist/tools/toolMetadata/descriptionOverrides.d.ts +0 -4
|
@@ -9,6 +9,12 @@ export interface ExtractionState {
|
|
|
9
9
|
start: number;
|
|
10
10
|
end: number;
|
|
11
11
|
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Exact matched-line numbers (as opposed to `matchRanges`, which are
|
|
14
|
+
* ±contextLines windows around them) — previously only readable by parsing
|
|
15
|
+
* the "Found ... on line N" prose in `warnings`.
|
|
16
|
+
*/
|
|
17
|
+
matchedLines?: number[];
|
|
12
18
|
warnings?: string[];
|
|
13
19
|
earlyResult?: LocalGetFileContentToolResult;
|
|
14
20
|
}
|
|
@@ -15,7 +15,15 @@ export declare function getFileStatsOrError(query: FetchContentQuery, absolutePa
|
|
|
15
15
|
fileStats?: FileStats;
|
|
16
16
|
errorResult?: LocalGetFileContentToolResult;
|
|
17
17
|
}>;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The effective minify mode a read will use, resolved the same way
|
|
20
|
+
* `fetchContent` resolves it: an explicit `minify` always wins; otherwise
|
|
21
|
+
* `fullContent`/a line range defaults to `'none'` (verbatim), and every other
|
|
22
|
+
* read defaults to `'standard'`. Exposed so the large-file gate can be
|
|
23
|
+
* computed from the *actual* read mode instead of duplicating this ternary.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveMinifyMode(query: FetchContentQuery): 'none' | 'standard' | 'symbols';
|
|
26
|
+
export declare function shouldFailForLargeFile(query: FetchContentQuery, fileSizeKB: number, minifyMode: 'none' | 'standard' | 'symbols'): boolean;
|
|
19
27
|
export declare function createLargeFileErrorResult(query: FetchContentQuery, absolutePath: string, fileSizeKB: number): LocalGetFileContentToolResult;
|
|
20
28
|
export declare function createBinaryFileErrorResult(query: FetchContentQuery, absolutePath: string): LocalGetFileContentToolResult;
|
|
21
29
|
export declare function isLikelyBinaryFile(filePath: string): Promise<boolean>;
|
|
@@ -3,4 +3,3 @@ import type { FetchContentQuery } from './scheme.js';
|
|
|
3
3
|
import { type ContentView } from './fetchContent/pagination.js';
|
|
4
4
|
export type { ContentView };
|
|
5
5
|
export declare function fetchContent(query: FetchContentQuery): Promise<LocalGetFileContentToolResult>;
|
|
6
|
-
export declare function finalizeFetchContentResult(result: LocalGetFileContentToolResult, _query: FetchContentQuery, _totalLines: number): LocalGetFileContentToolResult;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type MinifyMode } from '../../scheme/fields.js';
|
|
3
|
+
import type { CharPagination, ItemPagination, ToolContinuation } from '../../scheme/pagination.js';
|
|
4
|
+
import type { BulkToolOutput } from '../../types/toolOutput.js';
|
|
3
5
|
export declare const LocalFetchContentQuerySchema: z.ZodObject<{
|
|
4
6
|
path: z.ZodString;
|
|
5
7
|
fullContent: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -29,93 +31,29 @@ export declare const LocalFetchContentBulkQuerySchema: z.ZodObject<{
|
|
|
29
31
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
30
32
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
31
33
|
}, z.core.$strip>;
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
charOffset: z.ZodNumber;
|
|
59
|
-
charLength: z.ZodNumber;
|
|
60
|
-
totalChars: z.ZodNumber;
|
|
61
|
-
hasMore: z.ZodBoolean;
|
|
62
|
-
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
63
|
-
currentPage: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
totalPages: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
chunkMode: z.ZodOptional<z.ZodEnum<{
|
|
66
|
-
semantic: "semantic";
|
|
67
|
-
"char-limit": "char-limit";
|
|
68
|
-
}>>;
|
|
69
|
-
nextBlockChar: z.ZodOptional<z.ZodNumber>;
|
|
70
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
-
currentPage: z.ZodNumber;
|
|
72
|
-
totalPages: z.ZodNumber;
|
|
73
|
-
hasMore: z.ZodBoolean;
|
|
74
|
-
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
75
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
returned: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
81
|
-
reportedTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
82
|
-
reachableTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
83
|
-
totalMatchesKind: z.ZodOptional<z.ZodEnum<{
|
|
84
|
-
exact: "exact";
|
|
85
|
-
reported: "reported";
|
|
86
|
-
lowerBound: "lowerBound";
|
|
87
|
-
}>>;
|
|
88
|
-
totalMatchesCapped: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
-
totalResults: z.ZodOptional<z.ZodNumber>;
|
|
90
|
-
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
}, z.core.$strip>]>>;
|
|
92
|
-
next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
93
|
-
tool: z.ZodString;
|
|
94
|
-
query: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
95
|
-
why: z.ZodOptional<z.ZodString>;
|
|
96
|
-
confidence: z.ZodOptional<z.ZodEnum<{
|
|
97
|
-
exact: "exact";
|
|
98
|
-
heuristic: "heuristic";
|
|
99
|
-
}>>;
|
|
100
|
-
}, z.core.$strip>>>;
|
|
101
|
-
modified: z.ZodOptional<z.ZodString>;
|
|
102
|
-
lastModified: z.ZodOptional<z.ZodString>;
|
|
103
|
-
lastModifiedBy: z.ZodOptional<z.ZodString>;
|
|
104
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
-
matchNotFound: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
-
searchedFor: z.ZodOptional<z.ZodString>;
|
|
107
|
-
}, z.core.$strip>;
|
|
108
|
-
}, z.core.$strip>>;
|
|
109
|
-
base: z.ZodOptional<z.ZodString>;
|
|
110
|
-
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
111
|
-
responsePagination: z.ZodOptional<z.ZodObject<{
|
|
112
|
-
currentPage: z.ZodNumber;
|
|
113
|
-
totalPages: z.ZodNumber;
|
|
114
|
-
hasMore: z.ZodBoolean;
|
|
115
|
-
charOffset: z.ZodNumber;
|
|
116
|
-
charLength: z.ZodNumber;
|
|
117
|
-
totalChars: z.ZodNumber;
|
|
118
|
-
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
119
|
-
}, z.core.$strip>>;
|
|
120
|
-
}, z.core.$strip>;
|
|
121
|
-
export type LocalGetFileContentOutput = z.infer<typeof LocalGetFileContentOutputSchema>;
|
|
34
|
+
export interface FileContentMatchRange {
|
|
35
|
+
start: number;
|
|
36
|
+
end: number;
|
|
37
|
+
}
|
|
38
|
+
export interface LocalGetFileContentData {
|
|
39
|
+
path?: string;
|
|
40
|
+
content?: string;
|
|
41
|
+
contentView?: 'none' | 'standard' | 'symbols';
|
|
42
|
+
totalLines?: number;
|
|
43
|
+
sourceChars?: number;
|
|
44
|
+
sourceBytes?: number;
|
|
45
|
+
returnedChars?: number;
|
|
46
|
+
startLine?: number;
|
|
47
|
+
endLine?: number;
|
|
48
|
+
isPartial?: boolean;
|
|
49
|
+
matchRanges?: FileContentMatchRange[];
|
|
50
|
+
pagination?: (CharPagination & {
|
|
51
|
+
nextBlockChar?: number;
|
|
52
|
+
}) | ItemPagination;
|
|
53
|
+
next?: Record<string, ToolContinuation>;
|
|
54
|
+
modified?: string;
|
|
55
|
+
warnings?: string[];
|
|
56
|
+
matchNotFound?: boolean;
|
|
57
|
+
searchedFor?: string;
|
|
58
|
+
}
|
|
59
|
+
export type LocalGetFileContentOutput = BulkToolOutput<LocalGetFileContentData>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { type FindFilesQuery } from './scheme.js';
|
|
3
3
|
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
4
|
-
export { finalizeFindFilesResult } from './findFiles.js';
|
|
5
4
|
export declare function executeFindFiles(args: ToolExecutionArgs<FindFilesQuery>): Promise<CallToolResult>;
|
|
@@ -5,7 +5,4 @@ type UpstreamFindFilesQuery = z.infer<typeof FindFilesQuerySchema>;
|
|
|
5
5
|
import type { WithOptionalMeta } from '../../types/execution.js';
|
|
6
6
|
type FindFilesQuery = WithOptionalMeta<UpstreamFindFilesQuery>;
|
|
7
7
|
export declare function findFiles(query: FindFilesQuery): Promise<LocalFindFilesToolResult>;
|
|
8
|
-
export declare function finalizeFindFilesResult(result: LocalFindFilesToolResult, _query: FindFilesQuery, _totals: {
|
|
9
|
-
totalFiles: number;
|
|
10
|
-
}): LocalFindFilesToolResult;
|
|
11
8
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LocalFindFilesEntry } from '@octocodeai/octocode-core/types';
|
|
2
|
+
type FindFilesNextCall = {
|
|
3
|
+
tool: 'localGetFileContent' | 'localViewStructure';
|
|
4
|
+
query: Record<string, unknown>;
|
|
5
|
+
why: string;
|
|
6
|
+
confidence?: 'exact' | 'high' | 'medium' | 'low';
|
|
7
|
+
};
|
|
8
|
+
export type FindFilesNextMap = {
|
|
9
|
+
fetch?: FindFilesNextCall;
|
|
10
|
+
viewStructure?: FindFilesNextCall;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Build per-result continuation hints for a localFindFiles response: point the
|
|
14
|
+
* agent at exact content for the first matched file, or into the first matched
|
|
15
|
+
* directory when the page is all directories. `nextPage` (pagination) is added
|
|
16
|
+
* separately by the caller.
|
|
17
|
+
*
|
|
18
|
+
* The queries carry the entry's absolute path, which the response
|
|
19
|
+
* path-relativizer deliberately leaves untouched inside `next` (see
|
|
20
|
+
* SKIP_TRAVERSAL_KEYS in utils/response/pathRelativize.ts), so the hint stays
|
|
21
|
+
* directly callable with no manual path conversion. Meta-free by construction:
|
|
22
|
+
* queries are built from the entry path alone, never spread from the caller
|
|
23
|
+
* query, so no auto-filled id/researchGoal/reasoning can leak in.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildFindFilesNextMap(files: readonly LocalFindFilesEntry[]): FindFilesNextMap | undefined;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FileSystemQueryResult } from '../../utils/contextUtils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Expand shell-style brace alternation (`{a,b,c}`) in a glob pattern into the
|
|
4
|
+
* cartesian product of concrete patterns. The native glob compiler (a
|
|
5
|
+
* hand-rolled glob-to-regex translator, see `octocode-engine`'s `fs_query.rs`)
|
|
6
|
+
* has no brace support — a pattern like `packages/{react,react-reconciler}/**`
|
|
7
|
+
* previously compiled to a regex that silently matched nothing, with no error.
|
|
8
|
+
* Returns the input unchanged as a single-element array when it has no brace
|
|
9
|
+
* groups, so patterns without braces see no behavior change.
|
|
10
|
+
*/
|
|
11
|
+
export declare function expandBracePattern(pattern: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Merge multiple native `queryFileSystem` results (one per expanded brace
|
|
14
|
+
* alternative) into a single result shape, deduping entries that matched more
|
|
15
|
+
* than one alternative. `totalDiscovered`/`skipped`/`permissionDenied` are
|
|
16
|
+
* summed per-walk (not deduped) — each expanded pattern walks the tree
|
|
17
|
+
* independently, so this is an upper bound on true unique discovery, not an
|
|
18
|
+
* exact count; `wasCapped` is true if any alternative hit its cap.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeFileSystemQueryResults(results: readonly FileSystemQueryResult[]): FileSystemQueryResult;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { FindFilesQuerySchema as CoreFindFilesQuerySchema } from '@octocodeai/octocode-core/schemas';
|
|
3
|
+
import type { LocalItemPagination, ToolContinuation } from '../../scheme/pagination.js';
|
|
4
|
+
import type { BulkToolOutput } from '../../types/toolOutput.js';
|
|
3
5
|
export type FindFilesQuery = Omit<z.infer<typeof CoreFindFilesQuerySchema>, 'regexType'>;
|
|
4
6
|
export declare const LocalFindFilesQuerySchema: z.ZodType<FindFilesQuery>;
|
|
5
7
|
export declare const LocalFindFilesBulkQuerySchema: z.ZodObject<{
|
|
@@ -7,84 +9,20 @@ export declare const LocalFindFilesBulkQuerySchema: z.ZodObject<{
|
|
|
7
9
|
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
8
10
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
9
11
|
}, z.core.$strip>;
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
symlink: "symlink";
|
|
28
|
-
}>>;
|
|
29
|
-
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
30
|
-
sizeFormatted: z.ZodOptional<z.ZodString>;
|
|
31
|
-
modified: z.ZodOptional<z.ZodString>;
|
|
32
|
-
accessed: z.ZodOptional<z.ZodString>;
|
|
33
|
-
created: z.ZodOptional<z.ZodString>;
|
|
34
|
-
permissions: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, z.core.$strip>>>;
|
|
36
|
-
summary: z.ZodOptional<z.ZodString>;
|
|
37
|
-
pagination: z.ZodOptional<z.ZodObject<{
|
|
38
|
-
currentPage: z.ZodNumber;
|
|
39
|
-
totalPages: z.ZodNumber;
|
|
40
|
-
hasMore: z.ZodBoolean;
|
|
41
|
-
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
42
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
43
|
-
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
44
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
45
|
-
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
returned: z.ZodOptional<z.ZodNumber>;
|
|
47
|
-
reportedTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
reachableTotalMatches: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
totalMatchesKind: z.ZodOptional<z.ZodEnum<{
|
|
50
|
-
exact: "exact";
|
|
51
|
-
reported: "reported";
|
|
52
|
-
lowerBound: "lowerBound";
|
|
53
|
-
}>>;
|
|
54
|
-
totalMatchesCapped: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
totalResults: z.ZodOptional<z.ZodNumber>;
|
|
56
|
-
itemsPerPage: z.ZodOptional<z.ZodNumber>;
|
|
57
|
-
filesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
58
|
-
entriesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
59
|
-
matchesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
60
|
-
totalFiles: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
62
|
-
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
63
|
-
totalFilesFound: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
nextMatchPage: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
}, z.core.$strip>>;
|
|
66
|
-
next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
67
|
-
tool: z.ZodString;
|
|
68
|
-
query: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
69
|
-
why: z.ZodOptional<z.ZodString>;
|
|
70
|
-
confidence: z.ZodOptional<z.ZodEnum<{
|
|
71
|
-
exact: "exact";
|
|
72
|
-
heuristic: "heuristic";
|
|
73
|
-
}>>;
|
|
74
|
-
}, z.core.$strip>>>;
|
|
75
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
-
}, z.core.$strip>;
|
|
77
|
-
}, z.core.$strip>>;
|
|
78
|
-
base: z.ZodOptional<z.ZodString>;
|
|
79
|
-
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
80
|
-
responsePagination: z.ZodOptional<z.ZodObject<{
|
|
81
|
-
currentPage: z.ZodNumber;
|
|
82
|
-
totalPages: z.ZodNumber;
|
|
83
|
-
hasMore: z.ZodBoolean;
|
|
84
|
-
charOffset: z.ZodNumber;
|
|
85
|
-
charLength: z.ZodNumber;
|
|
86
|
-
totalChars: z.ZodNumber;
|
|
87
|
-
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
88
|
-
}, z.core.$strip>>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
export type LocalFindFilesOutput = z.infer<typeof LocalFindFilesOutputSchema>;
|
|
12
|
+
export interface LocalFindFilesEntryOutput {
|
|
13
|
+
name?: string;
|
|
14
|
+
path?: string;
|
|
15
|
+
type?: 'file' | 'dir' | 'directory' | 'link' | 'symlink';
|
|
16
|
+
size?: number | string;
|
|
17
|
+
sizeFormatted?: string;
|
|
18
|
+
modified?: string;
|
|
19
|
+
permissions?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LocalFindFilesData {
|
|
22
|
+
path?: string;
|
|
23
|
+
files?: LocalFindFilesEntryOutput[];
|
|
24
|
+
summary?: string;
|
|
25
|
+
pagination?: LocalItemPagination;
|
|
26
|
+
next?: Record<string, ToolContinuation>;
|
|
27
|
+
}
|
|
28
|
+
export type LocalFindFilesOutput = BulkToolOutput<LocalFindFilesData>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type MetavarRange = {
|
|
2
|
+
text: string;
|
|
3
|
+
line: number;
|
|
4
|
+
column: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
endColumn: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Apply the default capture budget to one match's metavar payload.
|
|
10
|
+
*
|
|
11
|
+
* `$$$` list captures (bodies, argument lists) serialize every statement
|
|
12
|
+
* TWICE (metavars text + metavarRanges text) — for a handful of function
|
|
13
|
+
* matches that is tens of KB of duplicated source an agent almost never
|
|
14
|
+
* needs: the ranges are the useful part (LSP anchors). Default policy:
|
|
15
|
+
* - `metavars`: keep single-entry captures (cheap, high-value anchors like
|
|
16
|
+
* `$NAME`), drop multi-entry list captures entirely.
|
|
17
|
+
* - `metavarRanges`: always keep (they are the anchors), but prune
|
|
18
|
+
* comment-only entries from list captures and truncate each entry's text
|
|
19
|
+
* to CAPTURE_TEXT_BUDGET chars (marked with `…`).
|
|
20
|
+
* `captureText:true` restores the verbatim engine payload.
|
|
21
|
+
*/
|
|
22
|
+
export declare function budgetCaptures(metavars: Record<string, string[]> | undefined | null, metavarRanges: Record<string, MetavarRange[]> | undefined | null, captureText: boolean): {
|
|
23
|
+
metavars?: Record<string, string[]>;
|
|
24
|
+
metavarRanges?: Record<string, MetavarRange[]>;
|
|
25
|
+
};
|
|
@@ -32,6 +32,7 @@ export declare const RANK_WEIGHTS: {
|
|
|
32
32
|
readonly extMatchesLangType: 2;
|
|
33
33
|
readonly sourceDir: 1.5;
|
|
34
34
|
readonly lowSignalPathPenalty: -5;
|
|
35
|
+
readonly testPathPenalty: -3.5;
|
|
35
36
|
readonly rareQueryTokenScale: 2;
|
|
36
37
|
readonly rareQueryTokenCap: 3;
|
|
37
38
|
readonly matchCountScale: 1.5;
|
|
@@ -27,6 +27,7 @@ export interface RankResult {
|
|
|
27
27
|
export declare function rankFiles(files: LocalSearchCodeFile[], sort: RankSort, ctx: RankContext, opts?: {
|
|
28
28
|
debug?: boolean;
|
|
29
29
|
candidateCap?: number;
|
|
30
|
+
sortReverse?: boolean;
|
|
30
31
|
}): RankResult;
|
|
31
32
|
export declare function matchesAny(patterns: readonly RegExp[], line: string): boolean;
|
|
32
33
|
export declare function escapeRegex(s: string): string;
|
|
@@ -2,7 +2,7 @@ import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
|
|
|
2
2
|
import type { RipgrepQuery } from '../scheme.js';
|
|
3
3
|
import type { LocalSearchEngine } from './buildResult.js';
|
|
4
4
|
type NextToolName = 'localGetFileContent' | 'lspGetSemantics' | 'localSearchCode';
|
|
5
|
-
type NextConfidence = 'exact' | '
|
|
5
|
+
type NextConfidence = 'exact' | 'low';
|
|
6
6
|
type SearchNextCall = {
|
|
7
7
|
tool: NextToolName;
|
|
8
8
|
query: Record<string, unknown>;
|