@octocodeai/octocode-tools-core 16.3.0 → 16.5.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.
Files changed (127) hide show
  1. package/README.md +546 -0
  2. package/dist/config.d.ts +7 -0
  3. package/dist/direct.js +34 -41
  4. package/dist/errors/pathUtils.d.ts +1 -1
  5. package/dist/github/directoryFetch.d.ts +2 -1
  6. package/dist/github/githubAPI.d.ts +10 -1
  7. package/dist/github/repoStructureRecursive.d.ts +6 -0
  8. package/dist/index.d.ts +15 -27
  9. package/dist/index.js +41 -48
  10. package/dist/providers/providerQueries.d.ts +9 -0
  11. package/dist/providers/providerResults.d.ts +2 -0
  12. package/dist/scheme/coreSchemas.d.ts +5 -5
  13. package/dist/scheme/fields.d.ts +6 -6
  14. package/dist/serverConfig.d.ts +1 -1
  15. package/dist/session.d.ts +1 -1
  16. package/dist/shared/config/defaults.d.ts +15 -0
  17. package/dist/shared/config/index.d.ts +10 -0
  18. package/dist/shared/config/index.js +10 -0
  19. package/dist/shared/config/loader.d.ts +7 -0
  20. package/dist/shared/config/resolver.d.ts +2 -0
  21. package/dist/shared/config/resolverCache.d.ts +12 -0
  22. package/dist/shared/config/resolverSections.d.ts +12 -0
  23. package/dist/shared/config/runtimeSurface.d.ts +21 -0
  24. package/dist/shared/config/schemas.d.ts +12 -0
  25. package/dist/shared/config/types.d.ts +100 -0
  26. package/dist/shared/config/validator.d.ts +2 -0
  27. package/dist/shared/credentials/constants.d.ts +2 -0
  28. package/dist/shared/credentials/credentialCache.d.ts +13 -0
  29. package/dist/shared/credentials/credentialEncryption.d.ts +10 -0
  30. package/dist/shared/credentials/credentialUtils.d.ts +4 -0
  31. package/dist/shared/credentials/envTokens.d.ts +9 -0
  32. package/dist/shared/credentials/ghCli.d.ts +1 -0
  33. package/dist/shared/credentials/index.d.ts +3 -0
  34. package/dist/shared/credentials/index.js +9 -0
  35. package/dist/shared/credentials/schemas.d.ts +22 -0
  36. package/dist/shared/credentials/storage.d.ts +30 -0
  37. package/dist/shared/credentials/testing.d.ts +2 -0
  38. package/dist/shared/credentials/testing.js +8 -0
  39. package/dist/shared/credentials/tokenRefresh.d.ts +24 -0
  40. package/dist/shared/credentials/tokenResolution.d.ts +30 -0
  41. package/dist/shared/credentials/types.d.ts +28 -0
  42. package/dist/shared/fs-utils.d.ts +2 -0
  43. package/dist/shared/fs-utils.js +8 -0
  44. package/dist/shared/index.d.ts +7 -0
  45. package/dist/shared/logger/index.d.ts +2 -0
  46. package/dist/shared/logger/logger.d.ts +17 -0
  47. package/dist/shared/paths.d.ts +33 -0
  48. package/dist/shared/paths.js +8 -0
  49. package/dist/shared/platform/index.d.ts +1 -0
  50. package/dist/shared/platform/index.js +8 -0
  51. package/dist/shared/platform/platform.d.ts +8 -0
  52. package/dist/shared/session/index.d.ts +5 -0
  53. package/dist/shared/session/index.js +9 -0
  54. package/dist/shared/session/schemas.d.ts +103 -0
  55. package/dist/shared/session/sessionCache.d.ts +9 -0
  56. package/dist/shared/session/sessionDiskIO.d.ts +6 -0
  57. package/dist/shared/session/statsDefaults.d.ts +4 -0
  58. package/dist/shared/session/storage.d.ts +20 -0
  59. package/dist/shared/session/types.d.ts +53 -0
  60. package/dist/tools/github_clone_repo/cache.d.ts +4 -0
  61. package/dist/tools/github_clone_repo/scheme.d.ts +56 -9
  62. package/dist/tools/github_clone_repo/types.d.ts +1 -1
  63. package/dist/tools/github_fetch_content/scheme.d.ts +8 -4
  64. package/dist/tools/github_fetch_content/types.d.ts +12 -0
  65. package/dist/tools/github_search_code/scheme.d.ts +6 -6
  66. package/dist/tools/github_search_pull_requests/contentResponse.d.ts +0 -1
  67. package/dist/tools/github_search_pull_requests/execution.d.ts +1 -11
  68. package/dist/tools/github_search_pull_requests/scheme.d.ts +6 -2
  69. package/dist/tools/github_search_repos/scheme.d.ts +7 -6
  70. package/dist/tools/github_view_repo_structure/execution.d.ts +0 -9
  71. package/dist/tools/github_view_repo_structure/scheme.d.ts +10 -6
  72. package/dist/tools/local_binary_inspect/archiveOps.d.ts +2 -0
  73. package/dist/tools/local_binary_inspect/binaryInspector.d.ts +48 -7
  74. package/dist/tools/local_binary_inspect/binaryOps.d.ts +16 -7
  75. package/dist/tools/local_binary_inspect/scheme.d.ts +10 -7
  76. package/dist/tools/local_fetch_content/scheme.d.ts +2 -2
  77. package/dist/tools/local_find_files/scheme.d.ts +2 -2
  78. package/dist/tools/local_ripgrep/lspBoost.d.ts +54 -0
  79. package/dist/tools/local_ripgrep/rankingProfile.d.ts +113 -0
  80. package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +10 -1
  81. package/dist/tools/local_ripgrep/scheme.d.ts +29 -4
  82. package/dist/tools/local_ripgrep/structuralSearch.d.ts +3 -4
  83. package/dist/tools/local_view_structure/scheme.d.ts +2 -2
  84. package/dist/tools/local_view_structure/structureFilters.d.ts +1 -3
  85. package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
  86. package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -8
  87. package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +2 -2
  88. package/dist/tools/lsp/shared/semanticTypes.d.ts +2 -1
  89. package/dist/tools/package_search/scheme.d.ts +9 -7
  90. package/dist/tools/providerMappers.d.ts +19 -0
  91. package/dist/tools/toolMetadata/proxies.d.ts +0 -6
  92. package/dist/tools/utils.d.ts +3 -7
  93. package/dist/types/bulk.d.ts +0 -2
  94. package/dist/types/execution.d.ts +1 -2
  95. package/dist/types/toolResults.d.ts +2 -3
  96. package/dist/utils/contextUtils.d.ts +35 -2
  97. package/dist/utils/core/lines.d.ts +16 -0
  98. package/dist/utils/core/types.d.ts +10 -0
  99. package/dist/utils/file/filters.d.ts +2 -11
  100. package/dist/utils/parsers/diff.d.ts +18 -0
  101. package/dist/utils/ranking/evidenceRanker.d.ts +86 -0
  102. package/dist/utils/response/error.d.ts +38 -4
  103. package/dist/utils/response/groupedFinalizer.d.ts +0 -2
  104. package/package.json +43 -14
  105. package/dist/commands/RipgrepCommandBuilder.d.ts +0 -27
  106. package/dist/hints/dynamic.d.ts +0 -6
  107. package/dist/hints/index.d.ts +0 -2
  108. package/dist/hints/types.d.ts +0 -1
  109. package/dist/tools/github_clone_repo/hints.d.ts +0 -2
  110. package/dist/tools/github_fetch_content/hints.d.ts +0 -2
  111. package/dist/tools/github_search_code/hints.d.ts +0 -2
  112. package/dist/tools/github_search_pull_requests/hints.d.ts +0 -2
  113. package/dist/tools/github_search_repos/hints.d.ts +0 -2
  114. package/dist/tools/github_view_repo_structure/hints.d.ts +0 -2
  115. package/dist/tools/local_fetch_content/hints.d.ts +0 -2
  116. package/dist/tools/local_find_files/hints.d.ts +0 -2
  117. package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +0 -3
  118. package/dist/tools/local_ripgrep/hints.d.ts +0 -2
  119. package/dist/tools/local_ripgrep/ripgrepParser.d.ts +0 -9
  120. package/dist/tools/local_view_structure/hints.d.ts +0 -2
  121. package/dist/tools/local_view_structure/structureParser.d.ts +0 -3
  122. package/dist/tools/local_view_structure/structureWalker.d.ts +0 -24
  123. package/dist/tools/lsp/semantic_content/hints.d.ts +0 -4
  124. package/dist/tools/package_search/hints.d.ts +0 -2
  125. package/dist/types/metadata.d.ts +0 -69
  126. package/dist/utils/exec/commandAvailability.d.ts +0 -19
  127. package/dist/utils/exec/ripgrepBinary.d.ts +0 -3
@@ -1 +1 @@
1
- export { redactPath } from 'octocode-security/pathUtils';
1
+ export { redactPath } from '@octocodeai/octocode-engine/pathUtils';
@@ -1,5 +1,6 @@
1
1
  import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
2
- import type { DirectoryFetchResult } from '../tools/github_fetch_content/types.js';
2
+ import type { DirectoryFetchResult, FileMaterializationResult } from '../tools/github_fetch_content/types.js';
3
3
  export declare const MAX_DIRECTORY_FILES = 50;
4
4
  export declare const MAX_TOTAL_SIZE: number;
5
5
  export declare function fetchDirectoryContents(owner: string, repo: string, path: string, branch: string, authInfo?: AuthInfo, forceRefresh?: boolean): Promise<DirectoryFetchResult>;
6
+ export declare function fetchFileContentToDisk(owner: string, repo: string, path: string, branch: string, authInfo?: AuthInfo, forceRefresh?: boolean): Promise<FileMaterializationResult>;
@@ -1,5 +1,6 @@
1
1
  import type { components } from '@octokit/openapi-types';
2
2
  import type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
3
+ import type { DiffPreview } from '../utils/parsers/diff.js';
3
4
  export type Repository = components['schemas']['full-repository'];
4
5
  export type ContentDirectoryEntry = components['schemas']['content-directory'][number];
5
6
  export type CodeSearchResultItem = components['schemas']['code-search-result-item'];
@@ -38,6 +39,7 @@ export interface HistoryCommitFile {
38
39
  additions: number;
39
40
  deletions: number;
40
41
  patch?: string;
42
+ diff?: DiffPreview;
41
43
  previousFilename?: string;
42
44
  }
43
45
  export interface HistoryCommit {
@@ -60,6 +62,7 @@ export interface HistoryCommit {
60
62
  deletions?: number;
61
63
  status?: string;
62
64
  patch?: string;
65
+ diff?: DiffPreview;
63
66
  previousFilename?: string;
64
67
  files?: HistoryCommitFile[];
65
68
  }
@@ -70,7 +73,7 @@ export interface HistoryResult {
70
73
  path?: string;
71
74
  commits: HistoryCommit[];
72
75
  pagination: {
73
- page: number;
76
+ currentPage: number;
74
77
  perPage: number;
75
78
  hasMore: boolean;
76
79
  nextPage?: number;
@@ -144,6 +147,12 @@ export type OptimizedCodeSearchResult = {
144
147
  uniqueFileCount?: number;
145
148
  };
146
149
  nonExistentScope?: boolean;
150
+ /**
151
+ * GitHub returned `incomplete_results: true` (the search index timed out or
152
+ * could not fully complete). Empty or partial `items` may be a FALSE NEGATIVE
153
+ * — distinct from a genuine no-match. Surfaced so callers aren't blind.
154
+ */
155
+ incompleteResults?: boolean;
147
156
  };
148
157
  export interface PRCommentItem {
149
158
  id: string;
@@ -1,3 +1,9 @@
1
1
  import type { GitHubApiFileItem } from '../tools/github_view_repo_structure/types.js';
2
2
  import { OctokitWithThrottling } from './client.js';
3
+ /**
4
+ * Number of subtrees that failed to fetch (non-propagating errors) while
5
+ * building this recursive listing. Lets callers surface a "partial tree"
6
+ * warning instead of presenting a partial tree as complete.
7
+ */
8
+ export declare function getRecursiveFetchFailureCount(value: unknown): number;
3
9
  export declare function fetchDirectoryContentsRecursivelyAPI(octokit: InstanceType<typeof OctokitWithThrottling>, owner: string, repo: string, branch: string, path: string, currentDepth: number, maxDepth: number, visitedPaths?: Set<string>): Promise<GitHubApiFileItem[]>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './security/bridge.js';
2
2
  export * from './commands/BaseCommandBuilder.js';
3
- export * from './commands/RipgrepCommandBuilder.js';
4
3
  export * from './config.js';
5
4
  export * from './errors/domainErrors.js';
6
5
  export * from './errors/errorFactories.js';
@@ -26,7 +25,6 @@ export * from './github/repoStructure.js';
26
25
  export * from './github/repoStructurePagination.js';
27
26
  export * from './github/repoStructureRecursive.js';
28
27
  export * from './github/responseHeaders.js';
29
- export * from './hints/types.js';
30
28
  export * from './providers/capabilities.js';
31
29
  export * from './providers/factory.js';
32
30
  export * from './providers/github/githubContent.js';
@@ -75,10 +73,8 @@ export * from './tools/local_find_files/execution.js';
75
73
  export * from './tools/local_find_files/findFiles.js';
76
74
  export * from './tools/local_find_files/scheme.js';
77
75
  export * from './tools/local_ripgrep/execution.js';
78
- export * from './tools/local_ripgrep/grepFallbackExecutor.js';
79
76
  export * from './tools/local_ripgrep/patternValidation.js';
80
77
  export * from './tools/local_ripgrep/ripgrepExecutor.js';
81
- export * from './tools/local_ripgrep/ripgrepParser.js';
82
78
  export * from './tools/local_ripgrep/ripgrepResultBuilder.js';
83
79
  export * from './tools/local_ripgrep/scheme.js';
84
80
  export * from './tools/local_ripgrep/searchContentRipgrep.js';
@@ -110,7 +106,6 @@ export * from './tools/toolNames.js';
110
106
  export * from './tools/utils.js';
111
107
  export * from './types/bulk.js';
112
108
  export * from './types/execution.js';
113
- export * from './types/metadata.js';
114
109
  export * from './types/promise.js';
115
110
  export * from './types/responseTypes.js';
116
111
  export * from './types/server.js';
@@ -119,12 +114,11 @@ export * from './types/toolResults.js';
119
114
  export * from './utils/core/bestEffort.js';
120
115
  export * from './utils/core/compare.js';
121
116
  export * from './utils/core/constants.js';
117
+ export * from './utils/core/lines.js';
122
118
  export * from './utils/core/promise.js';
123
119
  export * from './utils/core/safeRegex.js';
124
120
  export * from './utils/environment/environmentDetection.js';
125
- export * from './utils/exec/commandAvailability.js';
126
121
  export * from './utils/exec/npm.js';
127
- export * from './utils/exec/ripgrepBinary.js';
128
122
  export * from './utils/exec/safe.js';
129
123
  export * from './utils/exec/spawn.js';
130
124
  export * from './utils/file/byteOffset.js';
@@ -161,27 +155,21 @@ export type { CodeSearchQuery, FileContentQuery, RepoSearchQuery, PullRequestQue
161
155
  export type { UnifiedRepository, CodeSearchItem, CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestSearchResult, RepoStructureResult, } from './providers/types.js';
162
156
  export { isProviderSuccess, isProviderError } from './providers/types.js';
163
157
  export type { GitHubAPIError, GitHubAPISuccess, OptimizedCodeSearchResult, DiffEntry, PullRequestSimple, GitHubPullRequestsSearchParams, ContentDirectoryEntry, CodeSearchResultItem, RepoSearchResultItem, IssueSearchResultItem, IssueComment, PRReviewInfo, CommitFileInfo, CommitInfo, PRCommentItem, GetContentParameters, SearchCodeParameters, SearchCodeResponse, SearchReposParameters, GitHubAPIResponse, } from './github/githubAPI.js';
164
- export { HINTS, hasDynamicHints } from './hints/dynamic.js';
165
158
  export { summarizeEntries, paginateEntries, buildEntryPaginationHints, buildWalkWarnings, } from './tools/local_view_structure/structureResponse.js';
166
159
  export type { ExecResult } from './utils/core/types.js';
167
- export { getHints } from './hints/index.js';
168
- export { hints as ghSearchCodeHints } from './tools/github_search_code/hints.js';
169
- export { hints as githubFetchContentHints } from './tools/github_fetch_content/hints.js';
170
- export { hints as ghViewRepoStructureHints } from './tools/github_view_repo_structure/hints.js';
171
- export { hints as githubSearchReposHints } from './tools/github_search_repos/hints.js';
172
- export { hints as ghSearchPRsHints } from './tools/github_search_pull_requests/hints.js';
173
- export { hints as ghCloneRepoHints } from './tools/github_clone_repo/hints.js';
174
- export { hints as localRipgrepHints } from './tools/local_ripgrep/hints.js';
175
- export { hints as localViewStructureHints } from './tools/local_view_structure/hints.js';
176
- export { hints as localFindFilesHints } from './tools/local_find_files/hints.js';
177
- export { hints as localFetchContentHints } from './tools/local_fetch_content/hints.js';
178
- export { hints as lspSemanticContentHints } from './tools/lsp/semantic_content/hints.js';
179
- export { hints as npmSearchHints } from './tools/package_search/hints.js';
180
- export { getDynamicHints as getDynamicToolHints } from './hints/dynamic.js';
181
- export { securityRegistry, ContentSanitizer } from 'octocode-security';
182
- export { maskSensitiveData } from 'octocode-security/mask';
183
- export { configureSecurity } from 'octocode-security/withSecurityValidation';
184
- export { getOctocodeDir, paths, getDirectorySizeBytes, formatBytes, isWindows, isMac, HOME, getAppDataPath, storeCredentials, getCredentials, getCredentialsSync, deleteCredentials, isTokenExpired, isRefreshTokenExpired, getCredentialsFilePath, getEnvTokenSource, hasEnvToken, resolveTokenFull, refreshAuthToken, getTokenWithRefresh, getGhCliToken, } from 'octocode-shared';
185
- export type { OAuthToken, StoredCredentials } from 'octocode-shared';
160
+ export { securityRegistry, ContentSanitizer, } from '@octocodeai/octocode-engine/security';
161
+ export { maskSensitiveData } from '@octocodeai/octocode-engine/mask';
162
+ export { configureSecurity } from '@octocodeai/octocode-engine/withSecurityValidation';
163
+ export type { OAuthToken, StoredCredentials, StoreResult, DeleteResult, CredentialsStore, TokenSource, GetCredentialsOptions, ResolvedToken, TokenWithRefreshResult, ResolvedTokenWithRefresh, RefreshResult, FullTokenResolution, GhCliTokenGetter, } from './shared/credentials/index.js';
164
+ export { storeCredentials, getCredentials, getCredentialsSync, deleteCredentials, updateToken, invalidateCredentialsCache, getToken, getTokenSync, resolveToken, getTokenWithRefresh, resolveTokenWithRefresh, refreshAuthToken, resolveTokenFull, resetTokenResolution, listStoredHosts, listStoredHostsSync, hasCredentials, hasCredentialsSync, isTokenExpired, isRefreshTokenExpired, getCredentialsFilePath, readCredentialsStore, encrypt, decrypt, ensureOctocodeDir, OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, ENV_TOKEN_VARS, getTokenFromEnv, getEnvTokenSource, hasEnvToken, getGhCliToken, } from './shared/credentials/index.js';
165
+ export { isWindows, isMac, isLinux, HOME, getAppDataPath, getLocalAppDataPath, getPlatformName, getArchitecture, } from './shared/platform/index.js';
166
+ export type { ToolCharSavingsStats, GitHubCacheHitStats, StatsCounterMap, SessionTotalUsageStats, SessionStats, PersistedSession, PersistedStats, SessionUpdateResult, SessionOptions, } from './shared/session/index.js';
167
+ export { SESSION_FILE, STATS_FILE, getSessionId, getOrCreateSession, updateSessionStats, resetSessionStats, flushSession, flushSessionSync, deleteSession, incrementToolCalls, incrementErrors, incrementRateLimits, incrementRateLimitByProvider, incrementGitHubCacheHits, incrementGitHubCacheRateLimits, incrementPackageRegistryFailures, incrementToolCharSavings, _resetSessionState, } from './shared/session/index.js';
168
+ export type { OctocodeConfig, ResolvedConfig, ValidationResult, LoadConfigResult, GitHubConfigOptions, LocalConfigOptions, ToolsConfigOptions, NetworkConfigOptions, TelemetryConfigOptions, LspConfigOptions, OutputConfigOptions, OutputPaginationConfigOptions, RequiredGitHubConfig, RequiredLocalConfig, RequiredToolsConfig, RequiredNetworkConfig, RequiredTelemetryConfig, RequiredLspConfig, RequiredOutputConfig, RequiredOutputPaginationConfig, } from './shared/config/index.js';
169
+ export { CONFIG_SCHEMA_VERSION, CONFIG_FILE_NAME, DEFAULT_CONFIG, DEFAULT_GITHUB_CONFIG, DEFAULT_LOCAL_CONFIG, DEFAULT_TOOLS_CONFIG, DEFAULT_NETWORK_CONFIG, DEFAULT_TELEMETRY_CONFIG, DEFAULT_LSP_CONFIG, DEFAULT_OUTPUT_CONFIG, MIN_TIMEOUT, MAX_TIMEOUT, MIN_RETRIES, MAX_RETRIES, MIN_OUTPUT_DEFAULT_CHAR_LENGTH, MAX_OUTPUT_DEFAULT_CHAR_LENGTH, CONFIG_FILE_PATH, loadConfig, loadConfigSync, configExists, getConfigPath, getOctocodeDir, validateConfig, getConfig, getConfigSync, reloadConfig, resolveConfig, resolveConfigSync, invalidateConfigCache, getConfigValue, _resetConfigCache, _getCacheState, parseLoggingEnv, OctocodeConfigSchema, } from './shared/config/index.js';
170
+ export { createLogger, setLogHandler, _getLogHandler, } from './shared/logger/index.js';
171
+ export type { LogLevel, LogEntry } from './shared/logger/index.js';
172
+ export { OCTOCODE_HOME, getDefaultOctocodeHome, paths, ensureHome, ensureTmp, ensureClone, ensureRepos, ensureLogs, ensureTree, ensureBinary, ensureUnzip, } from './shared/paths.js';
173
+ export { getDirectorySizeBytes, formatBytes } from './shared/fs-utils.js';
186
174
  export { completeMetadata } from '@octocodeai/octocode-core';
187
175
  export { z } from 'zod';