@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
@@ -2,8 +2,8 @@ import { z } from 'zod';
2
2
  export declare const LspGetSemanticsQueryDisplaySchema: z.ZodObject<{
3
3
  uri: z.ZodString;
4
4
  type: z.ZodDefault<z.ZodEnum<{
5
- references: "references";
6
5
  definition: "definition";
6
+ references: "references";
7
7
  callers: "callers";
8
8
  callees: "callees";
9
9
  callHierarchy: "callHierarchy";
@@ -34,8 +34,8 @@ export declare const LspGetSemanticsQueryDisplaySchema: z.ZodObject<{
34
34
  export declare const LspGetSemanticsQuerySchema: z.ZodObject<{
35
35
  uri: z.ZodString;
36
36
  type: z.ZodDefault<z.ZodEnum<{
37
- references: "references";
38
37
  definition: "definition";
38
+ references: "references";
39
39
  callers: "callers";
40
40
  callees: "callees";
41
41
  callHierarchy: "callHierarchy";
@@ -64,14 +64,13 @@ export declare const LspGetSemanticsQuerySchema: z.ZodObject<{
64
64
  reasoning: z.ZodOptional<z.ZodString>;
65
65
  }, z.core.$strip>;
66
66
  export declare const BulkLspGetSemanticsQuerySchema: z.ZodObject<{
67
- responseCharOffset: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
68
- responseCharLength: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
67
+ responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
68
+ responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
69
69
  queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
70
70
  }, z.core.$strip>;
71
71
  export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
72
72
  base: z.ZodOptional<z.ZodString>;
73
73
  shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
74
- hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
74
  results: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
76
75
  id: z.ZodString;
77
76
  status: z.ZodLiteral<"empty">;
@@ -283,7 +282,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
283
282
  }, z.core.$strip>>;
284
283
  summary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
285
284
  warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
286
- hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
287
285
  }, z.core.$strip>;
288
286
  }, z.core.$strip>, z.ZodObject<{
289
287
  id: z.ZodString;
@@ -291,7 +289,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
291
289
  data: z.ZodObject<{
292
290
  id: z.ZodOptional<z.ZodString>;
293
291
  error: z.ZodString;
294
- hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
295
292
  }, z.core.$strip>;
296
293
  }, z.core.$strip>, z.ZodObject<{
297
294
  id: z.ZodString;
@@ -503,7 +500,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
503
500
  }, z.core.$strip>>;
504
501
  summary: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
505
502
  warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
506
- hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
507
503
  }, z.core.$strip>;
508
504
  }, z.core.$strip>]>>;
509
505
  }, z.core.$strip>;
@@ -1,5 +1,5 @@
1
- import type { LSPClient } from 'octocode-lsp/client';
2
- import type { CallHierarchyItem, IncomingCall, OutgoingCall } from 'octocode-lsp/types';
1
+ import type { LSPClient } from '@octocodeai/octocode-engine/lsp/client';
2
+ import type { CallHierarchyItem, IncomingCall, OutgoingCall } from '@octocodeai/octocode-engine/lsp/types';
3
3
  export type TraversalResult<T> = {
4
4
  calls: T[];
5
5
  truncatedByDepth: boolean;
@@ -1,4 +1,4 @@
1
- import type { ExactPosition, LSPRange } from 'octocode-lsp/types';
1
+ import type { ExactPosition, LSPRange } from '@octocodeai/octocode-engine/lsp/types';
2
2
  export declare const LSP_GET_SEMANTIC_CONTENT_TOOL_NAME = "lspGetSemantics";
3
3
  export declare const SEMANTIC_CONTENT_TYPES: readonly ["definition", "references", "callers", "callees", "callHierarchy", "hover", "documentSymbols", "typeDefinition", "implementation"];
4
4
  export type SemanticContentType = (typeof SEMANTIC_CONTENT_TYPES)[number];
@@ -58,6 +58,7 @@ export type CompactLocation = {
58
58
  export declare function compactLocation(snippet: {
59
59
  uri: string;
60
60
  content?: string;
61
+ range?: LSPRange;
61
62
  displayRange?: {
62
63
  startLine: number;
63
64
  endLine: number;
@@ -8,8 +8,8 @@ export declare const NpmSearchQueryLocalSchema: z.ZodObject<{
8
8
  reasoning: z.ZodOptional<z.ZodString>;
9
9
  }, z.core.$strip>;
10
10
  export declare const NpmSearchBulkQueryLocalSchema: z.ZodObject<{
11
- responseCharOffset: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
12
- responseCharLength: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
11
+ responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
12
+ responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
13
13
  queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
14
14
  }, z.core.$strip>;
15
15
  export declare const NpmSearchOutputLocalSchema: z.ZodObject<{
@@ -21,9 +21,10 @@ export declare const NpmSearchOutputLocalSchema: z.ZodObject<{
21
21
  version: z.ZodOptional<z.ZodString>;
22
22
  description: z.ZodOptional<z.ZodString>;
23
23
  license: z.ZodOptional<z.ZodString>;
24
- weeklyDownloads: z.ZodOptional<z.ZodNumber>;
24
+ downloads: z.ZodOptional<z.ZodNumber>;
25
25
  repository: z.ZodOptional<z.ZodString>;
26
26
  repositoryDirectory: z.ZodOptional<z.ZodString>;
27
+ next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
28
  }, z.core.$loose>>>;
28
29
  pagination: z.ZodOptional<z.ZodObject<{
29
30
  currentPage: z.ZodNumber;
@@ -32,14 +33,15 @@ export declare const NpmSearchOutputLocalSchema: z.ZodObject<{
32
33
  totalFound: z.ZodNumber;
33
34
  returned: z.ZodNumber;
34
35
  hasMore: z.ZodBoolean;
36
+ nextPage: z.ZodOptional<z.ZodNumber>;
35
37
  }, z.core.$strip>>;
36
38
  }, z.core.$loose>>;
37
39
  status: z.ZodOptional<z.ZodString>;
38
40
  }, z.core.$loose>>>;
39
- readonly hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
- readonly base: z.ZodOptional<z.ZodString>;
41
- readonly shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
42
- readonly responsePagination: z.ZodOptional<z.ZodObject<{
41
+ hints: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ base: z.ZodOptional<z.ZodString>;
43
+ shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
44
+ responsePagination: z.ZodOptional<z.ZodObject<{
43
45
  currentPage: z.ZodNumber;
44
46
  totalPages: z.ZodNumber;
45
47
  hasMore: z.ZodBoolean;
@@ -9,6 +9,13 @@ type GitHubCodeSearchQuery = z.infer<typeof GitHubCodeSearchQuerySchema>;
9
9
  type LocalFileContentQuery = z.infer<typeof FileContentQueryLocalSchema> & {
10
10
  minify: import('../scheme/fields.js').MinifyMode;
11
11
  };
12
+ /**
13
+ * Char-boundary truncation mirroring the Rust engine's `truncate_unicode`:
14
+ * keeps at most `maxChars` Unicode scalars and appends `...` when it cuts.
15
+ * Never slices UTF-8 mid-codepoint or mid-token — the single data-layer bound
16
+ * for GitHub code-search match fragments (the render layer must not re-trim).
17
+ */
18
+ export declare function truncateSnippetChars(value: string, maxChars?: number): string;
12
19
  type GitHubPullRequestSearchQuery = z.infer<typeof GitHubPullRequestSearchQueryLocalSchema>;
13
20
  type GitHubReposSearchSingleQuery = z.infer<typeof GitHubReposSearchSingleQuerySchema>;
14
21
  type GitHubViewRepoStructureQuery = z.infer<typeof GitHubViewRepoStructureQuerySchema>;
@@ -70,12 +77,14 @@ export interface CodeSearchPagination {
70
77
  totalMatchesKind?: 'exact' | 'reported' | 'lowerBound';
71
78
  totalMatchesCapped?: boolean;
72
79
  hasMore: boolean;
80
+ nextPage?: number;
73
81
  uniqueFileCount?: number;
74
82
  }
75
83
  export interface CodeSearchFlatResult {
76
84
  results: CodeSearchGroupedResult[];
77
85
  pagination?: CodeSearchPagination;
78
86
  nonExistentScope?: boolean;
87
+ incompleteResults?: boolean;
79
88
  }
80
89
  export declare function mapCodeSearchProviderResult(data: CodeSearchResult, query: WithOptionalMeta<GitHubCodeSearchQuery>): CodeSearchFlatResult;
81
90
  export declare function mapRepoSearchToolQuery(query: WithOptionalMeta<GitHubReposSearchSingleQuery>): {
@@ -130,6 +139,14 @@ export declare function mapPullRequestToolQuery(query: PartialPRQuery): {
130
139
  interactions: string;
131
140
  draft: boolean;
132
141
  match: ("comments" | "title" | "body")[];
142
+ milestone: string;
143
+ language: string;
144
+ checks: "pending" | "success" | "failure";
145
+ review: "none" | "required" | "approved" | "changes_requested";
146
+ locked: boolean;
147
+ visibility: "public" | "private";
148
+ teamMentions: string;
149
+ project: string;
133
150
  archived: boolean | undefined;
134
151
  content: unknown;
135
152
  reviewMode: "summary" | "full";
@@ -230,6 +247,7 @@ export declare function mapPullRequestProviderResultData(data: ProviderPullReque
230
247
  }[];
231
248
  resultData: Record<string, unknown>;
232
249
  pagination: {
250
+ nextPage?: number;
233
251
  hasMore: boolean;
234
252
  uniqueFileCount?: number;
235
253
  totalMatchesCapped?: boolean;
@@ -251,6 +269,7 @@ export declare function mapFileContentToolQuery(query: LocalFileContentQuery): {
251
269
  matchString: string;
252
270
  contextLines: number;
253
271
  fullContent: boolean;
272
+ forceRefresh: boolean;
254
273
  charOffset: number;
255
274
  charLength: number;
256
275
  minify: "none" | "standard" | "symbols";
@@ -2,9 +2,3 @@ export { TOOL_NAMES } from './names.js';
2
2
  export { DESCRIPTIONS } from './descriptions.js';
3
3
  export { isToolInMetadata } from './metadataPresence.js';
4
4
  export { BASE_SCHEMA } from './baseSchema.js';
5
- type HintsMap = Record<string, readonly string[]>;
6
- export declare const TOOL_HINTS: Record<string, HintsMap>;
7
- export declare const GENERIC_ERROR_HINTS: readonly string[];
8
- export declare function getToolHintsSync(toolName: string, status: string): readonly string[];
9
- export declare function getDynamicHints(toolName: string, key: string): readonly string[];
10
- export declare function getGenericErrorHintsSync(): readonly string[];
@@ -1,20 +1,16 @@
1
1
  import type { ToolErrorResult, ToolSuccessResult, ToolInvocationCallback } from '../types/toolResults.js';
2
- import type { HintContext } from '../types/metadata.js';
3
2
  import type { ProviderResponse } from '../providers/types.js';
4
- import { createErrorResult } from '../utils/response/error.js';
5
- export { createErrorResult };
3
+ import { createErrorResult, safeParseOrError } from '../utils/response/error.js';
4
+ export { createErrorResult, safeParseOrError };
6
5
  export declare function invokeCallbackSafely(callback: ToolInvocationCallback | undefined, toolName: string, queries: unknown[]): Promise<void>;
7
6
  interface SuccessResultOptions {
8
- hintContext?: HintContext;
9
- prefixHints?: string[];
10
- extraHints?: string[];
11
7
  rawResponse?: unknown;
12
8
  }
13
9
  export declare function createSuccessResult<T extends object>(_query: {
14
10
  mainResearchGoal?: string;
15
11
  researchGoal?: string;
16
12
  reasoning?: string;
17
- }, data: T, hasContent: boolean, toolName: string, options?: SuccessResultOptions): ToolSuccessResult & T;
13
+ }, data: T, hasContent: boolean, _toolName: string, options?: SuccessResultOptions): ToolSuccessResult & T;
18
14
  export declare function handleProviderError(apiResult: ProviderResponse<unknown>, query: {
19
15
  mainResearchGoal?: string;
20
16
  researchGoal?: string;
@@ -26,7 +26,6 @@ export interface ResponsePaginationInfo {
26
26
  export interface BulkResponseConfig<TQuery = object, TOutput extends Record<string, unknown> = Record<string, unknown>> {
27
27
  toolName: string;
28
28
  keysPriority?: string[];
29
- peerHints?: boolean;
30
29
  concurrency?: number;
31
30
  minQueryTimeoutMs?: number;
32
31
  responsePagination?: BulkResponsePagination;
@@ -34,7 +33,6 @@ export interface BulkResponseConfig<TQuery = object, TOutput extends Record<stri
34
33
  }
35
34
  export interface BulkToolResponse {
36
35
  results: FlatQueryResult[];
37
- hints?: string[];
38
36
  base?: string;
39
37
  shared?: Record<string, string | number | boolean>;
40
38
  responsePagination?: ResponsePaginationInfo;
@@ -1,5 +1,4 @@
1
1
  import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
2
- import type { HintContext } from './metadata.js';
3
2
  export type WithOptionalMeta<T> = Partial<T>;
4
3
  export interface ToolExecutionArgs<TQuery> {
5
4
  queries: TQuery[];
@@ -7,5 +6,5 @@ export interface ToolExecutionArgs<TQuery> {
7
6
  responseCharLength?: number;
8
7
  authInfo?: AuthInfo;
9
8
  sessionId?: string;
10
- hintContext?: HintContext;
9
+ hintContext?: Record<string, unknown>;
11
10
  }
@@ -2,7 +2,6 @@ import type { GitHubAPIError } from '../github/githubAPI.js';
2
2
  export type QueryStatus = 'empty' | 'error';
3
3
  interface ToolResult {
4
4
  status?: QueryStatus;
5
- hints?: string[];
6
5
  [key: string]: unknown;
7
6
  }
8
7
  export interface ToolErrorResult extends ToolResult {
@@ -16,6 +15,8 @@ export interface PaginationInfo {
16
15
  currentPage: number;
17
16
  totalPages: number;
18
17
  hasMore: boolean;
18
+ nextPage?: number;
19
+ nextMatchPage?: number;
19
20
  charOffset?: number;
20
21
  charLength?: number;
21
22
  totalChars?: number;
@@ -41,7 +42,6 @@ export interface ProcessedBulkResult {
41
42
  data?: Record<string, unknown>;
42
43
  error?: string | GitHubAPIError;
43
44
  status?: QueryStatus;
44
- hints?: readonly string[] | string[];
45
45
  [key: string]: unknown;
46
46
  }
47
47
  export interface FlatQueryResult {
@@ -55,7 +55,6 @@ export interface QueryError {
55
55
  }
56
56
  export interface StructuredToolResponse {
57
57
  data?: unknown;
58
- hints?: string[];
59
58
  instructions?: string;
60
59
  [key: string]: unknown;
61
60
  }
@@ -1,5 +1,5 @@
1
- import type * as NativeContextUtils from '@octocodeai/octocode-context-utils';
2
- export type { ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-context-utils';
1
+ import type * as NativeContextUtils from '@octocodeai/octocode-engine';
2
+ export type { BinaryInspectInfo, BinaryStrings, ExtractMatchingLinesOptions, ExtractMatchingLinesResult, FilterPatchOptions, FileSystemEntry, FileSystemQueryOptions, FileSystemQueryResult, MinifyResult, JsonInput, RipgrepParseOptions, RipgrepParseResult, RipgrepSearchOptions, SliceContentOptions, SliceContentResult, StructuralMatch, YamlConversionConfig, } from '@octocodeai/octocode-engine';
3
3
  type NativeContextUtilsModule = typeof NativeContextUtils;
4
4
  type NativeLoader = () => NativeContextUtilsModule;
5
5
  export declare class ContextUtilsLoadError extends Error {
@@ -16,10 +16,43 @@ export declare const contextUtils: {
16
16
  minifyContentResult(content: string, filePath: string): NativeContextUtils.MinifyResult;
17
17
  minifyMarkdownCore(content: string): string;
18
18
  extractSignatures(content: string, filePath: string): string | null;
19
+ /**
20
+ * Native JS/TS document symbols as a JSON `DocumentSymbol[]` string, or null
21
+ * when oxc declines the input (non-JS/TS, oversized, hard parse failure, or
22
+ * no symbols). Server-free, syntax-only — no type inference.
23
+ */
24
+ extractJsSymbols(content: string, filePath: string): string | null;
25
+ /**
26
+ * Native in-file references as a JSON `Range[]` (declaration first), or null
27
+ * when oxc declines the input or the cursor is not on a resolvable binding.
28
+ * Same-file only, syntax-only — no type inference, no cross-file resolution.
29
+ */
30
+ findInFileReferences(content: string, filePath: string, line: number, character: number): string | null;
31
+ /**
32
+ * Canonical lowercase extensions (no leading dot) the native oxc JS/TS path
33
+ * handles. Source of truth lives in the engine — gate native dispatch on this.
34
+ */
35
+ getSupportedJsTsExtensions(): string[];
19
36
  structuralSearch(content: string, filePath: string, pattern?: string | null, rule?: string | null): NativeContextUtils.StructuralMatch[];
37
+ structuralSearchFiles(options: NativeContextUtils.StructuralSearchFilesOptions): NativeContextUtils.StructuralSearchFilesResult;
38
+ getSupportedStructuralExtensions(): string[];
39
+ /**
40
+ * Native binary inspection (format lane). Parses an executable / object /
41
+ * archive and returns identity + symbols/imports/exports/sections/deps.
42
+ * Degrades to magic-byte identity on malformed input; only unreadable or
43
+ * oversized files throw.
44
+ */
45
+ inspectBinaryNative(path: string): NativeContextUtils.BinaryInspectInfo;
46
+ /**
47
+ * Native strings extraction — printable ASCII + UTF-16 (LE/BE) runs of at
48
+ * least `minLength`, longest-first, optionally hex offset-prefixed.
49
+ */
50
+ extractBinaryStringsNative(path: string, minLength: number, includeOffsets: boolean, scanOffset?: number): NativeContextUtils.BinaryStrings;
51
+ validateRipgrepPattern(pattern: string, fixedString?: boolean | null, perlRegex?: boolean | null): NativeContextUtils.RipgrepPatternValidationResult;
20
52
  getSemanticBoundaryOffsets(content: string, filePath: string): number[];
21
53
  jsonToYamlString(jsonObject: NativeContextUtils.JsonInput, config?: NativeContextUtils.YamlConversionConfig | null): string;
22
54
  parseRipgrepJson(stdout: string, options?: NativeContextUtils.RipgrepParseOptions | null): NativeContextUtils.RipgrepParseResult;
55
+ searchRipgrep(options: NativeContextUtils.RipgrepSearchOptions): Promise<NativeContextUtils.RipgrepParseResult>;
23
56
  queryFileSystem(options: NativeContextUtils.FileSystemQueryOptions): NativeContextUtils.FileSystemQueryResult;
24
57
  extractMatchingLines(content: string, pattern: string, options?: NativeContextUtils.ExtractMatchingLinesOptions | null): NativeContextUtils.ExtractMatchingLinesResult;
25
58
  filterPatch(patch: string, options?: NativeContextUtils.FilterPatchOptions | null): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Split `content` into its text lines, handling LF and CRLF endings.
3
+ *
4
+ * A line is a maximal run of characters terminated by a newline or by EOF. A
5
+ * single trailing newline terminates the last line; it does not start a new
6
+ * empty one, so `"a\nb\n"` yields `["a", "b"]`, not `["a", "b", ""]`. A plain
7
+ * `split('\n')` gets this wrong by emitting a trailing empty segment for
8
+ * newline-terminated text. A genuine blank final line (`"a\n\n"`) is preserved
9
+ * — only the single terminator is dropped.
10
+ */
11
+ export declare function splitLines(content: string): string[];
12
+ /**
13
+ * Number of text lines in `content`. Equals `splitLines(content).length`; see
14
+ * {@link splitLines} for how trailing newlines are handled.
15
+ */
16
+ export declare function countLines(content: string): number;
@@ -3,6 +3,8 @@ export interface ExecResult {
3
3
  stdout: string;
4
4
  stderr: string;
5
5
  success: boolean;
6
+ /** True when output hit maxOutputSize and stdout is the partial prefix. */
7
+ truncated?: boolean;
6
8
  }
7
9
  export interface ExecOptions {
8
10
  cwd?: string;
@@ -10,11 +12,19 @@ export interface ExecOptions {
10
12
  env?: Record<string, string>;
11
13
  maxOutputSize?: number;
12
14
  toolName?: string;
15
+ /**
16
+ * When true, an output-size overflow returns the partial stdout flagged
17
+ * `truncated` instead of throwing. For commands (e.g. `strings` on a huge
18
+ * binary) where a bounded prefix is still useful.
19
+ */
20
+ tolerateOutputLimit?: boolean;
13
21
  }
14
22
  export interface PaginationInfo {
15
23
  currentPage: number;
16
24
  totalPages: number;
17
25
  hasMore: boolean;
26
+ nextPage?: number;
27
+ nextMatchPage?: number;
18
28
  charOffset?: number;
19
29
  charLength?: number;
20
30
  totalChars?: number;
@@ -1,11 +1,2 @@
1
- export declare const IGNORED_FOLDER_NAMES: string[];
2
- export declare const IGNORED_FILE_NAMES: string[];
3
- export declare const IGNORED_FILE_EXTENSIONS: string[];
4
- export declare function shouldIgnoreDir(folderName: string): boolean;
5
- export declare function shouldIgnoreFile(filePath: string): boolean;
6
- interface GetExtensionOptions {
7
- lowercase?: boolean;
8
- fallback?: string;
9
- }
10
- export declare function getExtension(filePath: string, options?: GetExtensionOptions): string;
11
- export {};
1
+ export { DISCOVERY_IGNORED_FILE_EXTENSIONS as IGNORED_FILE_EXTENSIONS, DISCOVERY_IGNORED_FILE_NAMES as IGNORED_FILE_NAMES, DISCOVERY_IGNORED_FOLDER_NAMES as IGNORED_FOLDER_NAMES, getDiscoveryExtension as getExtension, shouldIgnoreDiscoveryDir as shouldIgnoreDir, shouldIgnoreDiscoveryFile as shouldIgnoreFile, } from '@octocodeai/octocode-engine/security';
2
+ export type { DiscoveryExtensionOptions as GetExtensionOptions } from '@octocodeai/octocode-engine/security';
@@ -1,2 +1,20 @@
1
+ /** Max diff lines carried in a {@link DiffPreview} before the rest are summarized. */
2
+ export declare const DIFF_PREVIEW_MAX_LINES = 20;
3
+ /**
4
+ * A render-ready slice of a patch: the first {@link DIFF_PREVIEW_MAX_LINES}
5
+ * lines plus a count of how many were withheld. Consumers (e.g. the CLI) only
6
+ * colorize `lines` and print `moreCount` — they do no splitting or counting, so
7
+ * the trailing-newline off-by-one lives in exactly one place.
8
+ */
9
+ export interface DiffPreview {
10
+ lines: string[];
11
+ moreCount: number;
12
+ }
13
+ /**
14
+ * Build a {@link DiffPreview} from a raw patch string. Splitting is newline-safe
15
+ * via {@link splitLines}, so a patch that ends in a newline neither inflates
16
+ * `moreCount` nor surfaces a phantom blank line.
17
+ */
18
+ export declare function buildDiffPreview(patch: string | undefined, maxLines?: number): DiffPreview;
1
19
  export declare function filterPatch(patch: string, additions?: number[], deletions?: number[]): string;
2
20
  export declare function trimDiffContext(patch: string): string;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Tier 2 — cross-source evidence fusion for code-research results.
3
+ *
4
+ * Raw LSP, structural-search, and code-search scores are not comparable. This
5
+ * layer normalizes hits into `EvidenceItem`s, merges them into `EvidenceBundle`s
6
+ * (one per useful target), fuses incomparable per-source ranks with weighted
7
+ * Reciprocal Rank Fusion, reranks by task intent, diversifies, budgets for
8
+ * tokens, and explains every result. See `.octocode/RANKING-ARCHITECTURE.md`.
9
+ *
10
+ * Determinism: no clock, no randomness. Sort is total via explicit
11
+ * tie-breakers. Weak evidence is penalized but never silently dropped.
12
+ */
13
+ export interface Range {
14
+ startLine: number;
15
+ endLine?: number;
16
+ }
17
+ export type EvidenceSource = 'lsp' | 'structural' | 'codeSearch' | 'fileGraph' | 'signature' | 'contentView' | 'recentEdit' | 'testSignal' | 'diagnostic';
18
+ export type EvidenceStatus = 'ok' | 'partial' | 'fallback' | 'ambiguous' | 'unsupported' | 'parserFailed' | 'truncated' | 'stale';
19
+ export type EvidenceIntent = 'definition' | 'reference' | 'callsite' | 'declaration' | 'implementation' | 'test' | 'config' | 'doc' | 'schema' | 'route' | 'error' | 'unknown';
20
+ export type EvidenceConfidence = 'high' | 'medium' | 'low';
21
+ /** A measurement that can be mapped to a source weight (e.g. LSP fallback kind). */
22
+ export type EvidenceQuality = 'exact' | 'detailed' | 'nearLineFallback' | 'wholeFileFallback' | 'partialAst' | 'fallbackText' | 'comment' | 'broadRegex';
23
+ export interface EvidenceItem {
24
+ id: string;
25
+ source: EvidenceSource;
26
+ /** 1-based rank within this item's own source list (for RRF). */
27
+ sourceRank: number;
28
+ sourceScore?: number;
29
+ status: EvidenceStatus;
30
+ confidence: EvidenceConfidence;
31
+ intent: EvidenceIntent;
32
+ quality?: EvidenceQuality;
33
+ path: string;
34
+ range?: Range;
35
+ symbol?: string;
36
+ languageId?: string;
37
+ textPreview?: string;
38
+ tokenCost?: number;
39
+ reasons: string[];
40
+ }
41
+ export interface EvidenceBundle {
42
+ id: string;
43
+ target: {
44
+ path: string;
45
+ range?: Range;
46
+ symbol?: string;
47
+ languageId?: string;
48
+ };
49
+ primaryIntent: EvidenceIntent;
50
+ contributors: EvidenceItem[];
51
+ fusedScore: number;
52
+ finalScore: number;
53
+ confidence: EvidenceConfidence;
54
+ status: EvidenceStatus;
55
+ tokenCost: number;
56
+ reasons: string[];
57
+ warnings: string[];
58
+ }
59
+ export interface RankedEvidenceGroups {
60
+ mustRead: EvidenceBundle[];
61
+ supporting: EvidenceBundle[];
62
+ maybe: EvidenceBundle[];
63
+ weakOrSkipped: EvidenceBundle[];
64
+ }
65
+ export type RankTask = 'definition' | 'references' | 'edit' | 'explain' | 'security' | 'test' | 'generic';
66
+ export interface RankEvidenceOptions {
67
+ task: RankTask;
68
+ seed?: {
69
+ path?: string;
70
+ range?: Range;
71
+ symbol?: string;
72
+ query?: string;
73
+ };
74
+ tokenBudget?: number;
75
+ maxBundles?: number;
76
+ includeWeak?: boolean;
77
+ }
78
+ export interface RankEvidenceResult {
79
+ groups: RankedEvidenceGroups;
80
+ allBundles: EvidenceBundle[];
81
+ scorerVersion: string;
82
+ }
83
+ export declare const SCORER_VERSION = "tier2-rrf-1";
84
+ export declare function bundleEvidence(items: EvidenceItem[]): EvidenceBundle[];
85
+ /** Rank a flat list of normalized evidence items into explained groups. */
86
+ export declare function rankEvidence(items: EvidenceItem[], options: RankEvidenceOptions): RankEvidenceResult;
@@ -5,16 +5,50 @@ export interface UnifiedErrorResult {
5
5
  status: 'error';
6
6
  error?: string | GitHubAPIError;
7
7
  errorCode?: string;
8
- hints?: string[];
9
8
  [key: string]: unknown;
10
9
  }
11
10
  interface CreateErrorResultOptions {
12
11
  toolName?: string;
13
- hintContext?: Record<string, unknown>;
14
12
  extra?: Record<string, unknown>;
15
- customHints?: string[];
16
- hintSourceError?: GitHubAPIError;
17
13
  rawResponse?: unknown;
18
14
  }
19
15
  export declare function createErrorResult(error: unknown, _query: PartialBaseQuery, options?: CreateErrorResultOptions): UnifiedErrorResult;
16
+ /**
17
+ * Minimal shape of the parts of a Zod schema this helper relies on, kept
18
+ * version-agnostic so it does not couple to a specific Zod release.
19
+ */
20
+ interface SafeParseableSchema<T> {
21
+ safeParse(input: unknown): {
22
+ success: true;
23
+ data: T;
24
+ error?: never;
25
+ } | {
26
+ success: false;
27
+ data?: never;
28
+ error: {
29
+ issues: Array<{
30
+ message: string;
31
+ }>;
32
+ };
33
+ };
34
+ }
35
+ export type SafeParseOutcome<T> = {
36
+ ok: true;
37
+ data: T;
38
+ } | {
39
+ ok: false;
40
+ error: UnifiedErrorResult;
41
+ };
42
+ /**
43
+ * Validate `input` against `schema`, returning either the parsed data or a
44
+ * structured {@link UnifiedErrorResult} built via {@link createErrorResult}.
45
+ *
46
+ * Replaces the per-tool `safeParse → issues.map(...).join('; ') →
47
+ * createErrorResult('Validation error: …')` block. Pass `prefix: false` to
48
+ * omit the "Validation error: " prefix (github_fetch_content parity).
49
+ */
50
+ export declare function safeParseOrError<T>(schema: SafeParseableSchema<T>, query: PartialBaseQuery, options?: {
51
+ toolName?: string;
52
+ prefix?: boolean;
53
+ }): SafeParseOutcome<T>;
20
54
  export {};
@@ -27,11 +27,9 @@ export declare function paginateGroupsCharWindow<TGroup, TItem>({ groups, getIte
27
27
  groups: TGroup[];
28
28
  pagination: CharPagination;
29
29
  };
30
- export declare function dedupeHints(hints: readonly string[]): string[];
31
30
  export declare function collectFlatErrors(results: readonly FlatQueryResult[]): Array<{
32
31
  id: string;
33
32
  error: string;
34
- hints?: string[];
35
33
  }>;
36
34
  export declare function formatFinalizedResponse<T extends Record<string, unknown>>(responseData: T, keysPriority: readonly string[], isError?: boolean): BulkFinalizerOutput<T>;
37
35
  export {};