@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.
Files changed (193) hide show
  1. package/dist/commands/BaseCommandBuilder.d.ts +14 -0
  2. package/dist/commands/FindCommandBuilder.d.ts +23 -0
  3. package/dist/commands/LsCommandBuilder.d.ts +15 -0
  4. package/dist/commands/RipgrepCommandBuilder.d.ts +27 -0
  5. package/dist/config.d.ts +16 -0
  6. package/dist/direct.d.ts +3 -0
  7. package/dist/direct.js +53 -0
  8. package/dist/errors/ToolError.d.ts +21 -0
  9. package/dist/errors/domainErrors.d.ts +310 -0
  10. package/dist/errors/errorFactories.d.ts +12 -0
  11. package/dist/errors/localToolErrors.d.ts +29 -0
  12. package/dist/errors/pathUtils.d.ts +1 -0
  13. package/dist/github/client.d.ts +12 -0
  14. package/dist/github/codeSearch.d.ts +8 -0
  15. package/dist/github/directoryFetch.d.ts +5 -0
  16. package/dist/github/errorConstants.d.ts +81 -0
  17. package/dist/github/errors.d.ts +3 -0
  18. package/dist/github/fileContent.d.ts +4 -0
  19. package/dist/github/fileContentProcess.d.ts +11 -0
  20. package/dist/github/fileContentRaw.d.ts +12 -0
  21. package/dist/github/githubAPI.d.ts +237 -0
  22. package/dist/github/history.d.ts +16 -0
  23. package/dist/github/prByNumber.d.ts +5 -0
  24. package/dist/github/prContentFetcher.d.ts +5 -0
  25. package/dist/github/prTransformation.d.ts +109 -0
  26. package/dist/github/pullRequestSearch.d.ts +4 -0
  27. package/dist/github/queryBuilders.d.ts +12 -0
  28. package/dist/github/repoSearch.d.ts +25 -0
  29. package/dist/github/repoStructure.d.ts +7 -0
  30. package/dist/github/repoStructurePagination.d.ts +6 -0
  31. package/dist/github/repoStructureRecursive.d.ts +3 -0
  32. package/dist/github/responseHeaders.d.ts +1 -0
  33. package/dist/hints/dynamic.d.ts +6 -0
  34. package/dist/hints/index.d.ts +2 -0
  35. package/dist/hints/types.d.ts +1 -0
  36. package/dist/index.d.ts +187 -0
  37. package/dist/index.js +64 -0
  38. package/dist/providers/capabilities.d.ts +2 -0
  39. package/dist/providers/factory.d.ts +9 -0
  40. package/dist/providers/github/GitHubProvider.d.ts +14 -0
  41. package/dist/providers/github/githubContent.d.ts +9 -0
  42. package/dist/providers/github/githubPullRequests.d.ts +12 -0
  43. package/dist/providers/github/githubSearch.d.ts +12 -0
  44. package/dist/providers/github/githubStructure.d.ts +9 -0
  45. package/dist/providers/github/utils.d.ts +10 -0
  46. package/dist/providers/providerQueries.d.ts +111 -0
  47. package/dist/providers/providerResults.d.ts +175 -0
  48. package/dist/providers/types.d.ts +48 -0
  49. package/dist/responses.d.ts +47 -0
  50. package/dist/scheme/coreSchemas.d.ts +10 -0
  51. package/dist/scheme/fields.d.ts +13 -0
  52. package/dist/scheme/responseEnvelope.d.ts +16 -0
  53. package/dist/security/bridge.d.ts +10 -0
  54. package/dist/serverConfig.d.ts +23 -0
  55. package/dist/session.d.ts +25 -0
  56. package/dist/tools/directToolCatalog.d.ts +56 -0
  57. package/dist/tools/executionGuard.d.ts +14 -0
  58. package/dist/tools/github_clone_repo/cache.d.ts +21 -0
  59. package/dist/tools/github_clone_repo/cloneRepo.d.ts +6 -0
  60. package/dist/tools/github_clone_repo/execution.d.ts +8 -0
  61. package/dist/tools/github_clone_repo/hints.d.ts +2 -0
  62. package/dist/tools/github_clone_repo/scheme.d.ts +50 -0
  63. package/dist/tools/github_clone_repo/types.d.ts +19 -0
  64. package/dist/tools/github_fetch_content/execution.d.ts +7 -0
  65. package/dist/tools/github_fetch_content/finalizer.d.ts +10 -0
  66. package/dist/tools/github_fetch_content/hints.d.ts +2 -0
  67. package/dist/tools/github_fetch_content/scheme.d.ts +120 -0
  68. package/dist/tools/github_fetch_content/types.d.ts +66 -0
  69. package/dist/tools/github_search_code/execution.d.ts +8 -0
  70. package/dist/tools/github_search_code/finalizer.d.ts +6 -0
  71. package/dist/tools/github_search_code/hints.d.ts +2 -0
  72. package/dist/tools/github_search_code/scheme.d.ts +88 -0
  73. package/dist/tools/github_search_pull_requests/contentRequest.d.ts +52 -0
  74. package/dist/tools/github_search_pull_requests/contentResponse.d.ts +18 -0
  75. package/dist/tools/github_search_pull_requests/execution.d.ts +17 -0
  76. package/dist/tools/github_search_pull_requests/hints.d.ts +2 -0
  77. package/dist/tools/github_search_pull_requests/scheme.d.ts +224 -0
  78. package/dist/tools/github_search_pull_requests/types.d.ts +120 -0
  79. package/dist/tools/github_search_repos/execution.d.ts +17 -0
  80. package/dist/tools/github_search_repos/hints.d.ts +2 -0
  81. package/dist/tools/github_search_repos/scheme.d.ts +96 -0
  82. package/dist/tools/github_view_repo_structure/constants.d.ts +4 -0
  83. package/dist/tools/github_view_repo_structure/execution.d.ts +20 -0
  84. package/dist/tools/github_view_repo_structure/hints.d.ts +2 -0
  85. package/dist/tools/github_view_repo_structure/scheme.d.ts +81 -0
  86. package/dist/tools/github_view_repo_structure/types.d.ts +39 -0
  87. package/dist/tools/local_binary_inspect/archiveOps.d.ts +22 -0
  88. package/dist/tools/local_binary_inspect/binaryInspector.d.ts +49 -0
  89. package/dist/tools/local_binary_inspect/binaryOps.d.ts +18 -0
  90. package/dist/tools/local_binary_inspect/decompressOps.d.ts +16 -0
  91. package/dist/tools/local_binary_inspect/execution.d.ts +4 -0
  92. package/dist/tools/local_binary_inspect/scheme.d.ts +44 -0
  93. package/dist/tools/local_fetch_content/contentExtractor.d.ts +9 -0
  94. package/dist/tools/local_fetch_content/execution.d.ts +5 -0
  95. package/dist/tools/local_fetch_content/fetchContent.d.ts +4 -0
  96. package/dist/tools/local_fetch_content/hints.d.ts +2 -0
  97. package/dist/tools/local_fetch_content/scheme.d.ts +31 -0
  98. package/dist/tools/local_find_files/execution.d.ts +5 -0
  99. package/dist/tools/local_find_files/findFiles.d.ts +11 -0
  100. package/dist/tools/local_find_files/hints.d.ts +2 -0
  101. package/dist/tools/local_find_files/scheme.d.ts +9 -0
  102. package/dist/tools/local_ripgrep/execution.d.ts +5 -0
  103. package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +3 -0
  104. package/dist/tools/local_ripgrep/hints.d.ts +2 -0
  105. package/dist/tools/local_ripgrep/patternValidation.d.ts +12 -0
  106. package/dist/tools/local_ripgrep/ripgrepExecutor.d.ts +3 -0
  107. package/dist/tools/local_ripgrep/ripgrepParser.d.ts +9 -0
  108. package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +9 -0
  109. package/dist/tools/local_ripgrep/scheme.d.ts +55 -0
  110. package/dist/tools/local_ripgrep/searchContentRipgrep.d.ts +5 -0
  111. package/dist/tools/local_ripgrep/structuralSearch.d.ts +9 -0
  112. package/dist/tools/local_view_structure/execution.d.ts +5 -0
  113. package/dist/tools/local_view_structure/hints.d.ts +2 -0
  114. package/dist/tools/local_view_structure/local_view_structure.d.ts +7 -0
  115. package/dist/tools/local_view_structure/scheme.d.ts +33 -0
  116. package/dist/tools/local_view_structure/structureFilters.d.ts +33 -0
  117. package/dist/tools/local_view_structure/structureParser.d.ts +3 -0
  118. package/dist/tools/local_view_structure/structureResponse.d.ts +32 -0
  119. package/dist/tools/local_view_structure/structureWalker.d.ts +24 -0
  120. package/dist/tools/lsp/semantic_content/execution.d.ts +4 -0
  121. package/dist/tools/lsp/semantic_content/hints.d.ts +4 -0
  122. package/dist/tools/lsp/semantic_content/index.d.ts +2 -0
  123. package/dist/tools/lsp/semantic_content/scheme.d.ts +509 -0
  124. package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +11 -0
  125. package/dist/tools/lsp/shared/resolveSymbolAnchor.d.ts +20 -0
  126. package/dist/tools/lsp/shared/semanticTypes.d.ts +134 -0
  127. package/dist/tools/package_search/execution.d.ts +7 -0
  128. package/dist/tools/package_search/hints.d.ts +2 -0
  129. package/dist/tools/package_search/scheme.d.ts +51 -0
  130. package/dist/tools/providerExecution.d.ts +51 -0
  131. package/dist/tools/providerMappers.d.ts +277 -0
  132. package/dist/tools/toolConfig.d.ts +41 -0
  133. package/dist/tools/toolMetadata/baseSchema.d.ts +2 -0
  134. package/dist/tools/toolMetadata/descriptions.d.ts +1 -0
  135. package/dist/tools/toolMetadata/gateway.d.ts +7 -0
  136. package/dist/tools/toolMetadata/metadataPresence.d.ts +1 -0
  137. package/dist/tools/toolMetadata/names.d.ts +2 -0
  138. package/dist/tools/toolMetadata/proxies.d.ts +10 -0
  139. package/dist/tools/toolMetadata/state.d.ts +5 -0
  140. package/dist/tools/toolMetadata/types.d.ts +2 -0
  141. package/dist/tools/toolNames.d.ts +2 -0
  142. package/dist/tools/utils.d.ts +27 -0
  143. package/dist/types/bulk.d.ts +41 -0
  144. package/dist/types/execution.d.ts +11 -0
  145. package/dist/types/metadata.d.ts +69 -0
  146. package/dist/types/promise.d.ts +12 -0
  147. package/dist/types/responseTypes.d.ts +57 -0
  148. package/dist/types/server.d.ts +15 -0
  149. package/dist/types/session.d.ts +29 -0
  150. package/dist/types/toolResults.d.ts +62 -0
  151. package/dist/utils/contextUtils.d.ts +31 -0
  152. package/dist/utils/core/bestEffort.d.ts +2 -0
  153. package/dist/utils/core/compare.d.ts +1 -0
  154. package/dist/utils/core/constants.d.ts +47 -0
  155. package/dist/utils/core/promise.d.ts +2 -0
  156. package/dist/utils/core/safeRegex.d.ts +5 -0
  157. package/dist/utils/core/types.d.ts +50 -0
  158. package/dist/utils/environment/environmentDetection.d.ts +5 -0
  159. package/dist/utils/exec/commandAvailability.d.ts +19 -0
  160. package/dist/utils/exec/npm.d.ts +16 -0
  161. package/dist/utils/exec/ripgrepBinary.d.ts +3 -0
  162. package/dist/utils/exec/safe.d.ts +2 -0
  163. package/dist/utils/exec/spawn.d.ts +34 -0
  164. package/dist/utils/file/byteOffset.d.ts +12 -0
  165. package/dist/utils/file/filters.d.ts +11 -0
  166. package/dist/utils/file/size.d.ts +2 -0
  167. package/dist/utils/file/toolHelpers.d.ts +28 -0
  168. package/dist/utils/http/cache.d.ts +16 -0
  169. package/dist/utils/http/circuitBreaker.d.ts +17 -0
  170. package/dist/utils/http/fetch.d.ts +13 -0
  171. package/dist/utils/package/common.d.ts +5 -0
  172. package/dist/utils/package/npm.d.ts +8 -0
  173. package/dist/utils/package/schemas.d.ts +60 -0
  174. package/dist/utils/package/types.d.ts +55 -0
  175. package/dist/utils/pagination/boundary.d.ts +11 -0
  176. package/dist/utils/pagination/charLimit.d.ts +3 -0
  177. package/dist/utils/pagination/core.d.ts +15 -0
  178. package/dist/utils/pagination/hints.d.ts +3 -0
  179. package/dist/utils/pagination/outputSizeLimit.d.ts +16 -0
  180. package/dist/utils/pagination/types.d.ts +43 -0
  181. package/dist/utils/parsers/diff.d.ts +2 -0
  182. package/dist/utils/parsers/ripgrep.d.ts +11 -0
  183. package/dist/utils/parsers/schemas.d.ts +72 -0
  184. package/dist/utils/response/bulk.d.ts +5 -0
  185. package/dist/utils/response/callToolResult.d.ts +3 -0
  186. package/dist/utils/response/charSavings.d.ts +3 -0
  187. package/dist/utils/response/error.d.ts +20 -0
  188. package/dist/utils/response/groupedFinalizer.d.ts +37 -0
  189. package/dist/utils/response/pathRelativize.d.ts +9 -0
  190. package/dist/utils/response/structuredPagination.d.ts +9 -0
  191. package/dist/zod.d.ts +1 -0
  192. package/dist/zod.js +8 -0
  193. package/package.json +66 -0
@@ -0,0 +1,11 @@
1
+ export declare function isMidBlockCut(paginatedContent: string): boolean;
2
+ export declare function findNextBlockBoundary(content: string, fromChar: number, filePath?: string): number | undefined;
3
+ export declare function buildBlockBoundaryHint(paginatedContent: string, fullContent: string, cutPos: number, currentCharLength: number, filePath?: string): {
4
+ nextBlockChar: number;
5
+ hint: string;
6
+ } | undefined;
7
+ export type ChunkMode = 'semantic' | 'char-limit';
8
+ export declare function snapToSemanticBoundary(content: string, charOffset: number, charLength: number, filePath?: string): {
9
+ length: number;
10
+ chunkMode: ChunkMode;
11
+ };
@@ -0,0 +1,3 @@
1
+ export declare function getOutputCharLimit(): number;
2
+ export declare const MAX_DEFAULT_OUTPUT_CHAR_LENGTH = 100000;
3
+ export declare function getBulkDefaultCharLength(queryCount: number): number;
@@ -0,0 +1,15 @@
1
+ import type { PaginationInfo } from '../../types/toolResults.js';
2
+ import type { PaginationMetadata, ApplyPaginationOptions } from './types.js';
3
+ export declare function applyPagination(content: string, offset?: number, length?: number, options?: ApplyPaginationOptions): PaginationMetadata;
4
+ export declare function serializeForPagination(data: unknown, pretty?: boolean): string;
5
+ export declare function createPaginationInfo(metadata: PaginationMetadata): PaginationInfo;
6
+ export interface SliceByCharResult {
7
+ sliced: string;
8
+ actualOffset: number;
9
+ actualLength: number;
10
+ hasMore: boolean;
11
+ lineCount: number;
12
+ totalChars: number;
13
+ nextOffset?: number;
14
+ }
15
+ export declare function sliceByCharRespectLines(text: string, charOffset: number, charLength: number): SliceByCharResult;
@@ -0,0 +1,3 @@
1
+ import type { PaginationMetadata, GeneratePaginationHintsOptions, StructurePaginationInfo, StructurePaginationHintContext } from './types.js';
2
+ export declare function generatePaginationHints(metadata: PaginationMetadata, options?: GeneratePaginationHintsOptions): string[];
3
+ export declare function generateStructurePaginationHints(pagination: StructurePaginationInfo, _context: StructurePaginationHintContext): string[];
@@ -0,0 +1,16 @@
1
+ import type { PaginationInfo } from '../../types/toolResults.js';
2
+ interface OutputSizeLimitOptions {
3
+ charOffset?: number;
4
+ charLength?: number;
5
+ maxOutputChars?: number;
6
+ recommendedCharLength?: number;
7
+ }
8
+ interface OutputSizeLimitResult {
9
+ content: string;
10
+ wasLimited: boolean;
11
+ pagination?: PaginationInfo;
12
+ warnings: string[];
13
+ paginationHints: string[];
14
+ }
15
+ export declare function applyOutputSizeLimit(content: string, options: OutputSizeLimitOptions): OutputSizeLimitResult;
16
+ export {};
@@ -0,0 +1,43 @@
1
+ export interface PaginationMetadata {
2
+ paginatedContent: string;
3
+ byteOffset: number;
4
+ byteLength: number;
5
+ totalBytes: number;
6
+ nextByteOffset?: number;
7
+ charOffset: number;
8
+ charLength: number;
9
+ totalChars: number;
10
+ nextCharOffset?: number;
11
+ hasMore: boolean;
12
+ estimatedTokens?: number;
13
+ currentPage: number;
14
+ totalPages: number;
15
+ }
16
+ export interface ApplyPaginationOptions {
17
+ actualOffset?: number;
18
+ mode?: 'characters' | 'bytes';
19
+ pageSize?: number;
20
+ }
21
+ export interface GeneratePaginationHintsOptions {
22
+ enableWarnings?: boolean;
23
+ customHints?: string[];
24
+ toolName?: string;
25
+ }
26
+ export interface StructurePaginationInfo {
27
+ currentPage: number;
28
+ totalPages: number;
29
+ hasMore: boolean;
30
+ entriesPerPage: number;
31
+ totalEntries: number;
32
+ }
33
+ export interface StructurePaginationHintContext {
34
+ owner: string;
35
+ repo: string;
36
+ branch: string;
37
+ path?: string;
38
+ depth?: number;
39
+ pageFiles: number;
40
+ pageFolders: number;
41
+ allFiles: number;
42
+ allFolders: number;
43
+ }
@@ -0,0 +1,2 @@
1
+ export declare function filterPatch(patch: string, additions?: number[], deletions?: number[]): string;
2
+ export declare function trimDiffContext(patch: string): string;
@@ -0,0 +1,11 @@
1
+ import type { LocalSearchCodeFile } from '@octocodeai/octocode-core/types';
2
+ import type { SearchStats } from '../core/types.js';
3
+ interface RipgrepParserQuery {
4
+ contextLines?: number;
5
+ matchContentLength?: number;
6
+ }
7
+ export declare function parseRipgrepJson(jsonOutput: string, query: RipgrepParserQuery): {
8
+ files: LocalSearchCodeFile[];
9
+ stats: SearchStats;
10
+ };
11
+ export {};
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ export declare const RipgrepJsonMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ type: z.ZodLiteral<"match">;
4
+ data: z.ZodObject<{
5
+ path: z.ZodObject<{
6
+ text: z.ZodString;
7
+ }, z.core.$strip>;
8
+ lines: z.ZodObject<{
9
+ text: z.ZodString;
10
+ }, z.core.$strip>;
11
+ line_number: z.ZodNumber;
12
+ absolute_offset: z.ZodNumber;
13
+ submatches: z.ZodArray<z.ZodObject<{
14
+ match: z.ZodOptional<z.ZodObject<{
15
+ text: z.ZodString;
16
+ }, z.core.$strip>>;
17
+ start: z.ZodNumber;
18
+ end: z.ZodNumber;
19
+ }, z.core.$strip>>;
20
+ }, z.core.$strip>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ type: z.ZodLiteral<"context">;
23
+ data: z.ZodObject<{
24
+ path: z.ZodObject<{
25
+ text: z.ZodString;
26
+ }, z.core.$strip>;
27
+ lines: z.ZodObject<{
28
+ text: z.ZodString;
29
+ }, z.core.$strip>;
30
+ line_number: z.ZodNumber;
31
+ absolute_offset: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ }, z.core.$strip>, z.ZodObject<{
34
+ type: z.ZodLiteral<"begin">;
35
+ data: z.ZodObject<{
36
+ path: z.ZodObject<{
37
+ text: z.ZodString;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ type: z.ZodLiteral<"end">;
42
+ data: z.ZodObject<{
43
+ path: z.ZodObject<{
44
+ text: z.ZodString;
45
+ }, z.core.$strip>;
46
+ stats: z.ZodOptional<z.ZodObject<{
47
+ elapsed: z.ZodObject<{
48
+ human: z.ZodString;
49
+ }, z.core.$strip>;
50
+ searches: z.ZodNumber;
51
+ searches_with_match: z.ZodNumber;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>;
54
+ }, z.core.$strip>, z.ZodObject<{
55
+ type: z.ZodLiteral<"summary">;
56
+ data: z.ZodObject<{
57
+ elapsed_total: z.ZodObject<{
58
+ human: z.ZodString;
59
+ }, z.core.$strip>;
60
+ stats: z.ZodObject<{
61
+ elapsed: z.ZodObject<{
62
+ human: z.ZodString;
63
+ }, z.core.$strip>;
64
+ searches: z.ZodNumber;
65
+ searches_with_match: z.ZodNumber;
66
+ bytes_searched: z.ZodNumber;
67
+ bytes_printed: z.ZodNumber;
68
+ matched_lines: z.ZodNumber;
69
+ matches: z.ZodNumber;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ }, z.core.$strip>], "type">;
@@ -0,0 +1,5 @@
1
+ import { CallToolResult } from '@modelcontextprotocol/sdk/types';
2
+ import type { ProcessedBulkResult } from '../../types/toolResults.js';
3
+ import type { BulkResponseConfig, BulkResponsePagination } from '../../types/bulk.js';
4
+ export declare function computeQueryTimeout(queryCount: number, concurrency: number, minTimeoutMs?: number): number;
5
+ 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>;
@@ -0,0 +1,3 @@
1
+ import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare function sanitizeCallToolResult(result: CallToolResult): CallToolResult;
3
+ export declare function buildToolErrorResult(toolName: string, error: unknown): CallToolResult;
@@ -0,0 +1,3 @@
1
+ export declare function countSerializedChars(value: unknown): number;
2
+ export declare function attachRawResponseChars<T extends object>(result: T, rawResponse: unknown): T;
3
+ export declare function getRawResponseChars(value: unknown): number | undefined;
@@ -0,0 +1,20 @@
1
+ import type { GitHubAPIError } from '../../github/githubAPI.js';
2
+ import type { BaseQueryLocal } from '@octocodeai/octocode-core/extra-types';
3
+ type PartialBaseQuery = Partial<BaseQueryLocal>;
4
+ export interface UnifiedErrorResult {
5
+ status: 'error';
6
+ error?: string | GitHubAPIError;
7
+ errorCode?: string;
8
+ hints?: string[];
9
+ [key: string]: unknown;
10
+ }
11
+ interface CreateErrorResultOptions {
12
+ toolName?: string;
13
+ hintContext?: Record<string, unknown>;
14
+ extra?: Record<string, unknown>;
15
+ customHints?: string[];
16
+ hintSourceError?: GitHubAPIError;
17
+ rawResponse?: unknown;
18
+ }
19
+ export declare function createErrorResult(error: unknown, _query: PartialBaseQuery, options?: CreateErrorResultOptions): UnifiedErrorResult;
20
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { BulkFinalizerOutput } from '../../types/bulk.js';
2
+ import type { FlatQueryResult } from '../../types/toolResults.js';
3
+ export type CharPagination = {
4
+ currentPage: number;
5
+ totalPages: number;
6
+ hasMore: boolean;
7
+ charOffset: number;
8
+ charLength: number;
9
+ totalChars: number;
10
+ };
11
+ export type QueryWithPagination = {
12
+ id?: unknown;
13
+ charLength?: unknown;
14
+ charOffset?: unknown;
15
+ };
16
+ type CharWindowConfig<TGroup, TItem> = {
17
+ groups: TGroup[];
18
+ getItems: (group: TGroup) => readonly TItem[];
19
+ setItems: (group: TGroup, items: TItem[]) => TGroup;
20
+ getItemText?: (item: TItem) => string | undefined;
21
+ setItemText?: (item: TItem, text: string) => TItem;
22
+ charOffset: number;
23
+ charLength: number;
24
+ maxItems?: number;
25
+ };
26
+ export declare function paginateGroupsCharWindow<TGroup, TItem>({ groups, getItems, setItems, getItemText, setItemText, charOffset, charLength, maxItems, }: CharWindowConfig<TGroup, TItem>): {
27
+ groups: TGroup[];
28
+ pagination: CharPagination;
29
+ };
30
+ export declare function dedupeHints(hints: readonly string[]): string[];
31
+ export declare function collectFlatErrors(results: readonly FlatQueryResult[]): Array<{
32
+ id: string;
33
+ error: string;
34
+ hints?: string[];
35
+ }>;
36
+ export declare function formatFinalizedResponse<T extends Record<string, unknown>>(responseData: T, keysPriority: readonly string[], isError?: boolean): BulkFinalizerOutput<T>;
37
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare function commonDirPrefix(paths: readonly string[]): string;
2
+ export declare function relativizeResultPaths(results: ReadonlyArray<{
3
+ data?: unknown;
4
+ } | null | undefined>): string | undefined;
5
+ type SharedValue = string | number | boolean;
6
+ export declare function hoistSharedFields(results: ReadonlyArray<{
7
+ data?: unknown;
8
+ } | null | undefined>): Record<string, SharedValue> | undefined;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { BulkToolResponse } from '../../types/bulk.js';
2
+ import type { FlatQueryResult } from '../../types/toolResults.js';
3
+ interface PaginationRequest {
4
+ offset?: number;
5
+ length?: number;
6
+ }
7
+ export declare function applyQueryOutputPagination(queryResult: FlatQueryResult, originalQuery: Record<string, unknown>, toolName: string): FlatQueryResult;
8
+ export declare function applyBulkResponsePagination(response: BulkToolResponse, request: PaginationRequest, toolName: string): BulkToolResponse;
9
+ export {};
package/dist/zod.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { z } from 'zod';
package/dist/zod.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __dirname_fn } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __dirname_fn(__filename);
8
+ import{z as e}from"zod";export{e as z};
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@octocodeai/octocode-tools-core",
3
+ "version": "16.2.0",
4
+ "description": "Core tool implementations for Octocode: GitHub, local filesystem, LSP, and package search tools.",
5
+ "author": "Guy Bary <bgauryy@octocodeai.com>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./direct": {
16
+ "types": "./dist/direct.d.ts",
17
+ "import": "./dist/direct.js"
18
+ },
19
+ "./zod": {
20
+ "types": "./dist/zod.d.ts",
21
+ "import": "./dist/zod.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20.0.0"
30
+ },
31
+ "scripts": {
32
+ "build": "yarn clean && node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
33
+ "build:dev": "node build.mjs && tsc --emitDeclarationOnly -p tsconfig.build.json",
34
+ "clean": "rm -rf dist/",
35
+ "lint": "eslint src",
36
+ "lint:fix": "eslint src --fix",
37
+ "test": "vitest run --coverage",
38
+ "test:quiet": "vitest run --reporter=dot --silent",
39
+ "typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json",
40
+ "verify": "yarn lint && yarn typecheck && yarn test"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.29.0",
44
+ "@octocodeai/octocode-context-utils": "^16.3.0",
45
+ "@octocodeai/octocode-core": "^16.2.0",
46
+ "@octokit/plugin-throttling": "^11.0.3",
47
+ "@vscode/ripgrep": "^1.18.0",
48
+ "node-cache": "^5.1.2",
49
+ "octocode-lsp": "^16.3.0",
50
+ "octocode-security": "^16.3.0",
51
+ "octocode-shared": "workspace:^",
52
+ "octokit": "^5.0.5",
53
+ "zod": "^4.3.6"
54
+ },
55
+ "devDependencies": {
56
+ "@octokit/core": "^7.0.6",
57
+ "@octokit/openapi-types": "^27.0.0",
58
+ "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
59
+ "@types/node": "^25.9.3",
60
+ "@vitest/coverage-v8": "^4.0.16",
61
+ "esbuild": "^0.28.1",
62
+ "eslint": "^9.18.0",
63
+ "typescript": "^5.9.3",
64
+ "vitest": "^4.0.16"
65
+ }
66
+ }