@octocodeai/octocode-tools-core 16.6.3 → 17.0.2

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 (252) hide show
  1. package/README.md +22 -50
  2. package/dist/direct.js +33 -38
  3. package/dist/github/botFilter.d.ts +1 -0
  4. package/dist/github/client.d.ts +6 -0
  5. package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +3 -0
  6. package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +3 -0
  7. package/dist/github/directoryFetch/helpers.d.ts +35 -0
  8. package/dist/github/directoryFetch.d.ts +3 -6
  9. package/dist/github/fileContentPagination.d.ts +9 -0
  10. package/dist/github/fileContentProcess.d.ts +1 -8
  11. package/dist/github/fileContentRaw/fetch.d.ts +20 -0
  12. package/dist/github/fileContentRaw/pathSuggestions.d.ts +3 -0
  13. package/dist/github/fileContentRaw.d.ts +2 -12
  14. package/dist/github/githubAPI.d.ts +4 -1
  15. package/dist/github/history.d.ts +6 -2
  16. package/dist/github/issues/fetchers.d.ts +7 -0
  17. package/dist/github/issues/helpers.d.ts +32 -0
  18. package/dist/github/issues/orchestrator.d.ts +4 -0
  19. package/dist/github/issues/types.d.ts +72 -0
  20. package/dist/github/issues.d.ts +3 -0
  21. package/dist/github/prContentFetcher/comments.d.ts +11 -0
  22. package/dist/github/prContentFetcher/commits.d.ts +27 -0
  23. package/dist/github/prContentFetcher/flags.d.ts +21 -0
  24. package/dist/github/prContentFetcher/transform.d.ts +5 -0
  25. package/dist/github/prContentFetcher.d.ts +2 -5
  26. package/dist/github/pullRequestSearch/restSearch.d.ts +6 -0
  27. package/dist/github/pullRequestSearch.d.ts +1 -1
  28. package/dist/github/queryBuilders/base.d.ts +25 -0
  29. package/dist/github/queryBuilders/codeAndRepo.d.ts +20 -0
  30. package/dist/github/queryBuilders/issues.d.ts +42 -0
  31. package/dist/github/queryBuilders/pullRequests.d.ts +13 -0
  32. package/dist/github/queryBuilders.d.ts +4 -12
  33. package/dist/github/releases.d.ts +37 -0
  34. package/dist/github/repoStructure/contentResolution.d.ts +12 -0
  35. package/dist/github/repoStructure/fetchOrchestration.d.ts +7 -0
  36. package/dist/github/repoStructure/resultBuilder.d.ts +22 -0
  37. package/dist/github/repoStructure.d.ts +1 -7
  38. package/dist/github/repoStructureTree.d.ts +38 -0
  39. package/dist/github/responseHeaders.d.ts +2 -0
  40. package/dist/github/searchKeyword.d.ts +2 -0
  41. package/dist/index.d.ts +1 -4
  42. package/dist/index.js +35 -40
  43. package/dist/oql/adapters/github/execute.d.ts +16 -0
  44. package/dist/oql/adapters/github/provider-diagnostics.d.ts +14 -0
  45. package/dist/oql/adapters/github/shared.d.ts +75 -0
  46. package/dist/oql/adapters/github.d.ts +11 -0
  47. package/dist/oql/adapters/graphView/filters.d.ts +25 -0
  48. package/dist/oql/adapters/graphView/nativeEdges.d.ts +5 -0
  49. package/dist/oql/adapters/graphView.d.ts +17 -16
  50. package/dist/oql/adapters/local/code.d.ts +3 -0
  51. package/dist/oql/adapters/local/codeBoolean.d.ts +3 -0
  52. package/dist/oql/adapters/local/fileRowOps.d.ts +11 -0
  53. package/dist/oql/adapters/local/files.d.ts +3 -0
  54. package/dist/oql/adapters/local/filesBoolean.d.ts +10 -0
  55. package/dist/oql/adapters/local/filesContentLeaf.d.ts +12 -0
  56. package/dist/oql/adapters/local/filesUniverse.d.ts +6 -0
  57. package/dist/oql/adapters/local/findToolType.d.ts +10 -0
  58. package/dist/oql/adapters/local/predicates.d.ts +18 -0
  59. package/dist/oql/adapters/local/scope.d.ts +14 -0
  60. package/dist/oql/adapters/local/searchToolType.d.ts +7 -0
  61. package/dist/oql/adapters/local/structureContent.d.ts +6 -0
  62. package/dist/oql/adapters/local/types.d.ts +34 -0
  63. package/dist/oql/adapters/local.d.ts +3 -7
  64. package/dist/oql/adapters/researchTargets/diff.d.ts +16 -0
  65. package/dist/oql/adapters/researchTargets/graph.d.ts +3 -0
  66. package/dist/oql/adapters/researchTargets/history.d.ts +20 -0
  67. package/dist/oql/adapters/researchTargets/pagination.d.ts +54 -0
  68. package/dist/oql/adapters/researchTargets/repositories.d.ts +4 -0
  69. package/dist/oql/adapters/researchTargets/research.d.ts +3 -0
  70. package/dist/oql/adapters/researchTargets/rows.d.ts +16 -0
  71. package/dist/oql/adapters/researchTargets/semantics.d.ts +3 -0
  72. package/dist/oql/adapters/researchTargets/shared.d.ts +11 -0
  73. package/dist/oql/adapters/researchTargets.d.ts +4 -46
  74. package/dist/oql/defaults.d.ts +1 -1
  75. package/dist/oql/index.js +34 -39
  76. package/dist/oql/normalize/batch.d.ts +2 -0
  77. package/dist/oql/normalize/materialize.d.ts +2 -0
  78. package/dist/oql/normalize/params.d.ts +2 -0
  79. package/dist/oql/normalize/query.d.ts +2 -0
  80. package/dist/oql/normalize/scope.d.ts +2 -0
  81. package/dist/oql/normalize/shared.d.ts +7 -0
  82. package/dist/oql/normalize/source.d.ts +2 -0
  83. package/dist/oql/normalize/where.d.ts +2 -0
  84. package/dist/oql/normalize.d.ts +19 -4
  85. package/dist/oql/planner/planDiagnostics.d.ts +13 -0
  86. package/dist/oql/planner/predicateRouting.d.ts +35 -0
  87. package/dist/oql/predicateUtils.d.ts +3 -0
  88. package/dist/oql/research/analyze/manifest-scan.d.ts +4 -0
  89. package/dist/oql/research/analyze/source-graph.d.ts +7 -0
  90. package/dist/oql/research/analyze/symbol-scoring.d.ts +4 -0
  91. package/dist/oql/research/analyze/types.d.ts +163 -0
  92. package/dist/oql/research/analyze/utils.d.ts +16 -0
  93. package/dist/oql/research/analyze.d.ts +2 -133
  94. package/dist/oql/research/packets/builders.d.ts +4 -0
  95. package/dist/oql/research/packets/types.d.ts +91 -0
  96. package/dist/oql/research/packets.d.ts +21 -80
  97. package/dist/oql/run/batch.d.ts +3 -0
  98. package/dist/oql/run/continuations/records.d.ts +19 -0
  99. package/dist/oql/run/continuations/registry.d.ts +22 -0
  100. package/dist/oql/run/continuations/semantics.d.ts +3 -0
  101. package/dist/oql/run/continuations/types.d.ts +12 -0
  102. package/dist/oql/run/dryRun.d.ts +11 -0
  103. package/dist/oql/run/paths.d.ts +15 -0
  104. package/dist/oql/run/proofGrades.d.ts +8 -0
  105. package/dist/oql/run/select.d.ts +10 -0
  106. package/dist/oql/run/single.d.ts +22 -0
  107. package/dist/oql/run.d.ts +4 -31
  108. package/dist/oql/schema/predicates.d.ts +12 -0
  109. package/dist/oql/schema.d.ts +50 -35
  110. package/dist/oql/schemeText.d.ts +10 -13
  111. package/dist/oql/shorthand/predicates.d.ts +15 -0
  112. package/dist/oql/shorthand/query-controls.d.ts +18 -0
  113. package/dist/oql/shorthand/target-params.d.ts +9 -0
  114. package/dist/oql/shorthand/types.d.ts +159 -0
  115. package/dist/oql/shorthand/utils.d.ts +7 -0
  116. package/dist/oql/shorthand.d.ts +2 -171
  117. package/dist/oql/targetParams.d.ts +0 -13
  118. package/dist/oql/transformers/github/code.d.ts +1 -9
  119. package/dist/oql/types/diagnostics.d.ts +22 -0
  120. package/dist/oql/types/envelope.d.ts +78 -0
  121. package/dist/oql/types/guards.d.ts +9 -0
  122. package/dist/oql/types/planner.d.ts +46 -0
  123. package/dist/oql/types/predicates.d.ts +93 -0
  124. package/dist/oql/types/query.d.ts +143 -0
  125. package/dist/oql/types/recordData.d.ts +127 -0
  126. package/dist/oql/types/recordRows.d.ts +48 -0
  127. package/dist/oql/types/results.d.ts +118 -0
  128. package/dist/oql/types/targets.d.ts +22 -0
  129. package/dist/oql/types.d.ts +17 -640
  130. package/dist/providers/github/paginationMetadata.d.ts +12 -0
  131. package/dist/providers/providerResults.d.ts +0 -1
  132. package/dist/schema.js +2 -2
  133. package/dist/scheme/pagination.d.ts +65 -0
  134. package/dist/shared/config/index.js +1 -1
  135. package/dist/shared/credentials/index.js +2 -2
  136. package/dist/shared/credentials/testing.js +1 -1
  137. package/dist/shared/languageSelectors/classify.d.ts +15 -0
  138. package/dist/shared/languageSelectors/data.d.ts +12 -0
  139. package/dist/shared/languageSelectors.d.ts +3 -23
  140. package/dist/shared/paths.d.ts +0 -4
  141. package/dist/shared/paths.js +1 -1
  142. package/dist/shared/session/index.js +1 -1
  143. package/dist/shared/session/statsDefaults.d.ts +1 -2
  144. package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +68 -0
  145. package/dist/tools/directToolCatalog/toolCommandPatternQueries.d.ts +4 -0
  146. package/dist/tools/directToolCatalog/toolCommandPatterns.d.ts +4 -0
  147. package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +12 -0
  148. package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +19 -0
  149. package/dist/tools/directToolCatalog.meta.d.ts +10 -67
  150. package/dist/tools/github_clone_repo/cache.d.ts +1 -5
  151. package/dist/tools/github_clone_repo/cachePaths.d.ts +5 -0
  152. package/dist/tools/github_fetch_content/finalizer/entryParsers.d.ts +9 -0
  153. package/dist/tools/github_fetch_content/finalizer/types.d.ts +101 -0
  154. package/dist/tools/github_fetch_content/finalizer.d.ts +1 -7
  155. package/dist/tools/github_fetch_content/scheme.d.ts +42 -9
  156. package/dist/tools/github_fetch_content/types.d.ts +1 -2
  157. package/dist/tools/github_search_code/execution.d.ts +9 -0
  158. package/dist/tools/github_search_code/finalizer/build.d.ts +4 -0
  159. package/dist/tools/github_search_code/finalizer/groups.d.ts +23 -0
  160. package/dist/tools/github_search_code/finalizer/ranking.d.ts +12 -0
  161. package/dist/tools/github_search_code/finalizer.d.ts +2 -6
  162. package/dist/tools/github_search_code/scheme.d.ts +29 -2
  163. package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +68 -0
  164. package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +52 -0
  165. package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +17 -0
  166. package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +63 -0
  167. package/dist/tools/github_search_pull_requests/contentResponse.d.ts +1 -15
  168. package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +4 -0
  169. package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +4 -0
  170. package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +4 -0
  171. package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +4 -0
  172. package/dist/tools/github_search_pull_requests/execution/types.d.ts +6 -0
  173. package/dist/tools/github_search_pull_requests/execution.d.ts +1 -4
  174. package/dist/tools/github_search_pull_requests/scheme.d.ts +11 -1
  175. package/dist/tools/github_search_repos/execution/pagination.d.ts +39 -0
  176. package/dist/tools/github_search_repos/execution/queryVariants.d.ts +38 -0
  177. package/dist/tools/github_search_repos/execution/ranking.d.ts +4 -0
  178. package/dist/tools/github_search_repos/execution.d.ts +3 -71
  179. package/dist/tools/github_search_repos/scheme.d.ts +8 -0
  180. package/dist/tools/github_view_repo_structure/types.d.ts +2 -0
  181. package/dist/tools/local_fetch_content/fetchContent/extraction.d.ts +15 -0
  182. package/dist/tools/local_fetch_content/fetchContent/pagination.d.ts +38 -0
  183. package/dist/tools/local_fetch_content/fetchContent/validation.d.ts +26 -0
  184. package/dist/tools/local_fetch_content/fetchContent.d.ts +2 -0
  185. package/dist/tools/local_fetch_content/scheme.d.ts +25 -1
  186. package/dist/tools/local_find_files/scheme.d.ts +32 -0
  187. package/dist/tools/local_ripgrep/rankingProfile/rankingProfiles.d.ts +70 -0
  188. package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +47 -0
  189. package/dist/tools/local_ripgrep/rankingProfile/rankingScoring.d.ts +41 -0
  190. package/dist/tools/local_ripgrep/rankingProfile.d.ts +16 -95
  191. package/dist/tools/local_ripgrep/ripgrepResultBuilder/buildResult.d.ts +10 -0
  192. package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +46 -0
  193. package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +2 -18
  194. package/dist/tools/local_ripgrep/scheme.d.ts +95 -0
  195. package/dist/tools/local_view_structure/scheme.d.ts +31 -0
  196. package/dist/tools/lsp/semantic_content/scheme.d.ts +61 -0
  197. package/dist/tools/lsp/semantic_content/semanticAnchored.d.ts +7 -0
  198. package/dist/tools/lsp/semantic_content/semanticEnvelopes/callEnvelopes.d.ts +5 -0
  199. package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +20 -0
  200. package/dist/tools/lsp/semantic_content/semanticEnvelopes/locationEnvelopes.d.ts +13 -0
  201. package/dist/tools/lsp/semantic_content/semanticEnvelopes.d.ts +3 -0
  202. package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +24 -0
  203. package/dist/tools/lsp/semantic_content/semanticFileOps/documentSymbols.d.ts +27 -0
  204. package/dist/tools/lsp/semantic_content/semanticFileOps/workspaceSymbolsAndDiagnostics.d.ts +20 -0
  205. package/dist/tools/lsp/semantic_content/semanticFileOps.d.ts +8 -0
  206. package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +53 -0
  207. package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -0
  208. package/dist/tools/package_search/execution.d.ts +8 -0
  209. package/dist/tools/package_search/scheme.d.ts +43 -2
  210. package/dist/tools/providerMappers/codeSearch.d.ts +66 -0
  211. package/dist/tools/providerMappers/fileContent.d.ts +28 -0
  212. package/dist/tools/providerMappers/pullRequests.d.ts +158 -0
  213. package/dist/tools/providerMappers/repoSearch.d.ts +30 -0
  214. package/dist/tools/providerMappers/repoStructure.d.ts +20 -0
  215. package/dist/tools/providerMappers/shared.d.ts +23 -0
  216. package/dist/tools/providerMappers.d.ts +9 -294
  217. package/dist/tools/toolConfig.d.ts +0 -2
  218. package/dist/tools/toolMetadata/descriptionOverrides.d.ts +4 -0
  219. package/dist/tools/toolSchemaImports.d.ts +13 -0
  220. package/dist/utils/contextUtils.d.ts +5 -16
  221. package/dist/utils/core/types.d.ts +2 -24
  222. package/dist/utils/exec/spawn/env.d.ts +5 -0
  223. package/dist/utils/exec/spawn/wrappers.d.ts +29 -0
  224. package/dist/utils/exec/spawn.d.ts +2 -34
  225. package/dist/utils/file/toolHelpers.d.ts +12 -0
  226. package/dist/utils/http/cache/conditional.d.ts +21 -0
  227. package/dist/utils/http/cache/dataCache.d.ts +6 -0
  228. package/dist/utils/http/cache/key.d.ts +1 -0
  229. package/dist/utils/http/cache/management.d.ts +9 -0
  230. package/dist/utils/http/cache/store.d.ts +28 -0
  231. package/dist/utils/http/cache.d.ts +4 -16
  232. package/dist/utils/markdownOutline.d.ts +0 -2
  233. package/dist/utils/package/npm/npmDeprecation.d.ts +5 -0
  234. package/dist/utils/package/npm/npmDetailsFetchers.d.ts +15 -0
  235. package/dist/utils/package/npm/npmMappers.d.ts +12 -0
  236. package/dist/utils/package/npm/npmRegistry.d.ts +79 -0
  237. package/dist/utils/package/npm/npmSearchStrategies.d.ts +6 -0
  238. package/dist/utils/package/npm.d.ts +2 -8
  239. package/dist/utils/pagination/boundary.d.ts +5 -5
  240. package/dist/utils/response/bulk/pagination.d.ts +6 -0
  241. package/dist/utils/response/bulk/queries.d.ts +19 -0
  242. package/dist/utils/response/bulk/response.d.ts +4 -0
  243. package/dist/utils/response/bulk.d.ts +2 -6
  244. package/package.json +42 -35
  245. package/dist/tools/local_binary_inspect/archiveOps.d.ts +0 -24
  246. package/dist/tools/local_binary_inspect/binaryInspector.d.ts +0 -86
  247. package/dist/tools/local_binary_inspect/binaryOps.d.ts +0 -27
  248. package/dist/tools/local_binary_inspect/decompressOps.d.ts +0 -16
  249. package/dist/tools/local_binary_inspect/execution.d.ts +0 -4
  250. package/dist/tools/local_binary_inspect/scheme.d.ts +0 -144
  251. package/dist/tools/local_ripgrep/lspBoost.d.ts +0 -54
  252. package/dist/utils/parsers/ripgrep.d.ts +0 -11
@@ -0,0 +1,2 @@
1
+ import type { OqlBatch, OqlInputBatch } from '../types.js';
2
+ export declare function normalizeBatch(input: OqlInputBatch): OqlBatch;
@@ -0,0 +1,2 @@
1
+ import type { MaterializePolicy, OqlInputQuery, OqlQuery, Predicate, QuerySource } from '../types.js';
2
+ export declare function normalizeMaterialize(raw: OqlInputQuery, from: QuerySource | undefined, where: Predicate | undefined, target: OqlQuery['target']): MaterializePolicy | undefined;
@@ -0,0 +1,2 @@
1
+ import type { OqlInputQuery, OqlQuery } from '../types.js';
2
+ export declare function normalizeParams(raw: OqlInputQuery, target: OqlQuery['target']): Record<string, unknown> | undefined;
@@ -0,0 +1,2 @@
1
+ import { type OqlInputQuery, type OqlQuery } from '../types.js';
2
+ export declare function normalizeQuery(input: OqlInputQuery): OqlQuery;
@@ -0,0 +1,2 @@
1
+ import type { OqlInputQuery, QueryScope, QuerySource } from '../types.js';
2
+ export declare function normalizeScope(raw: OqlInputQuery, from: QuerySource | undefined): QueryScope | undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared helpers used across the normalize/* submodules: the `fail()`
3
+ * diagnostic-throw shorthand and zod-error formatting.
4
+ */
5
+ import { diagnostic } from '../diagnostics.js';
6
+ export declare function fail(...diagnostics: ReturnType<typeof diagnostic>[]): never;
7
+ export declare function formatZodError(error: unknown): string;
@@ -0,0 +1,2 @@
1
+ import { type OqlInputQuery, type OqlQuery, type QuerySource } from '../types.js';
2
+ export declare function normalizeSource(raw: OqlInputQuery, target: OqlQuery['target']): QuerySource | undefined;
@@ -0,0 +1,2 @@
1
+ import type { OqlInputQuery, OqlQuery, Predicate } from '../types.js';
2
+ export declare function normalizeWhere(raw: OqlInputQuery, target: OqlQuery['target']): Predicate | undefined;
@@ -1,5 +1,20 @@
1
- import { type OqlCanonicalInput, type OqlInputQuery, type OqlQuery, type OqlSearchInput } from './types.js';
2
- declare function asArray<T>(v: T | T[] | undefined): T[] | undefined;
1
+ /**
2
+ * OQL normalizer: raw sugar in, strict canonical OQL out.
3
+ *
4
+ * Rules (see OCTOCODE_QUERY_LANGUAGE.md §normalization):
5
+ * - sugar is accepted only when it has a deterministic rewrite;
6
+ * - ambiguous sugar fails with `ambiguousSugar`;
7
+ * - reserved targets fail with `unsupportedTarget`;
8
+ * - unknown fields fail with `unknownField`;
9
+ * - canonical output contains no shorthand fields.
10
+ *
11
+ * Predicate IDs are NOT injected here — the planner derives stable IDs from
12
+ * node position (or a user-provided `id`) so the canonical `where` stays clean.
13
+ *
14
+ * This file is a thin barrel/orchestrator: the actual per-clause
15
+ * normalization logic lives under ./normalize/* (source, scope, where,
16
+ * materialize, params, query orchestration, batch handling).
17
+ */
18
+ import type { OqlCanonicalInput, OqlSearchInput } from './types.js';
19
+ export { normalizeQuery } from './normalize/query.js';
3
20
  export declare function normalizeInput(input: OqlSearchInput): OqlCanonicalInput;
4
- export declare function normalizeQuery(input: OqlInputQuery): OqlQuery;
5
- export { asArray };
@@ -0,0 +1,13 @@
1
+ import type { MaterializePolicy, OqlDiagnostic, OqlPlanNode, OqlQuery } from '../types.js';
2
+ /**
3
+ * A `controls.search.sort` value outside the target lane's executable set is
4
+ * IGNORED by the backend (files: localFindFiles sortBy; code: search ranking).
5
+ * Warn instead of silently returning default ordering — non-blocking because
6
+ * ordering never changes WHICH rows exist, only their sequence.
7
+ */
8
+ export declare function sortApplicabilityDiagnostics(query: OqlQuery): OqlDiagnostic[];
9
+ export declare function adapterValidationDiagnostics(query: OqlQuery, nodes: OqlPlanNode[]): OqlDiagnostic[];
10
+ export declare function decideMaterialization(query: OqlQuery, diagnostics: OqlDiagnostic[]): (MaterializePolicy & {
11
+ required: boolean;
12
+ reason: string;
13
+ }) | undefined;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Predicate-tree walking + transformer routing for the OQL planner.
3
+ *
4
+ * Responsible for:
5
+ * - walking the predicate tree and routing every leaf/boolean node
6
+ * (invariant: pushed + residual + routed + unsupported == all predicate
7
+ * nodes);
8
+ * - recording backend calls and transformer traces as routing decisions are
9
+ * made, including the GitHub materialization fallback for multi-leaf
10
+ * booleans and unrouted `files`/`code` targets;
11
+ * - picking the transformer registry entry for a given query/source pair.
12
+ */
13
+ import { type CapabilityContext } from '../capabilities.js';
14
+ import type { TransformerRegistryEntry } from '../transformers/contract.js';
15
+ import type { OqlBackendCall, OqlDiagnostic, OqlExplainPlan, OqlPlanNode, OqlQuery, PlanRoute, Predicate, QuerySource } from '../types.js';
16
+ export interface WalkResult {
17
+ nodes: OqlPlanNode[];
18
+ diagnostics: OqlDiagnostic[];
19
+ backendCalls: OqlBackendCall[];
20
+ transformers: OqlExplainPlan['transformers'];
21
+ }
22
+ /**
23
+ * Walk the predicate tree, routing every leaf and recording a node per
24
+ * predicate (boolean nodes included). Boolean nodes are routed by composing
25
+ * child routes.
26
+ */
27
+ export declare function walkPredicate(query: OqlQuery, predicate: Predicate, path: string, ctx: CapabilityContext, out: WalkResult, inNegation?: boolean): PlanRoute;
28
+ export declare function addBackendCall(calls: OqlBackendCall[], call: OqlBackendCall): void;
29
+ export declare function addTransformerTrace(out: WalkResult, transformer: TransformerRegistryEntry | undefined): void;
30
+ export declare function addTransformerBackendCalls(out: WalkResult, transformer: TransformerRegistryEntry | undefined, source?: QuerySource): boolean;
31
+ export declare function addGithubFilesMaterializationCalls(out: WalkResult, source: QuerySource): boolean;
32
+ export declare function addGithubMaterializationCalls(out: WalkResult, source: QuerySource, target: OqlQuery['target'], localTransformer?: TransformerRegistryEntry | undefined): boolean;
33
+ export declare function containsStructuralPredicate(predicate: Predicate | undefined): boolean;
34
+ export declare function localTransformerForRoutedQuery(query: OqlQuery): TransformerRegistryEntry | undefined;
35
+ export declare function transformerForQuery(query: OqlQuery, source: QuerySource): TransformerRegistryEntry | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Predicate } from './types.js';
2
+ /** Counts all/any/not nodes plus their leaves — used for the boolean-expansion budget and plan diagnostics. */
3
+ export declare function countPredicateNodes(p: Predicate | undefined): number;
@@ -0,0 +1,4 @@
1
+ import { type Manifest, type ResearchDependencyIssue, type SourceFile } from './types.js';
2
+ export declare function walkFiles(root: string, maxFiles: number): Promise<string[]>;
3
+ export declare function readManifests(paths: readonly string[]): Promise<Manifest[]>;
4
+ export declare function collectDependencyIssues(root: string, manifests: readonly Manifest[], sourceFiles: readonly SourceFile[], workspacePackages: ReadonlySet<string>): readonly ResearchDependencyIssue[];
@@ -0,0 +1,7 @@
1
+ import { type GraphFactCapability } from '../../../utils/contextUtils.js';
2
+ import { type Manifest, type ResearchGraphCapabilitySummary, type ResearchGraphFactFile, type SourceFile } from './types.js';
3
+ export declare function readSourceFiles(root: string, files: readonly string[]): Promise<SourceFile[]>;
4
+ export declare function summarizeGraphCapabilities(sourceFiles: readonly SourceFile[], graphFacts: readonly ResearchGraphFactFile[], capabilities: readonly GraphFactCapability[]): ResearchGraphCapabilitySummary;
5
+ export declare function buildFileGraph(sourceFiles: readonly SourceFile[]): ReadonlyMap<string, readonly string[]>;
6
+ export declare function collectEntrypoints(root: string, manifests: readonly Manifest[], sourceFiles: readonly SourceFile[]): readonly string[];
7
+ export declare function reachableFiles(entrypoints: readonly string[], graph: ReadonlyMap<string, readonly string[]>): ReadonlySet<string>;
@@ -0,0 +1,4 @@
1
+ import type { ExportSymbol, ResearchSymbolRow, SourceFile } from './types.js';
2
+ export declare function collectExportSymbols(sourceFiles: readonly SourceFile[]): Promise<ExportSymbol[]>;
3
+ export declare function scoreSymbols(symbols: readonly ExportSymbol[], sourceFiles: readonly SourceFile[], reachable: ReadonlySet<string>): readonly ResearchSymbolRow[];
4
+ export declare function cacheTokens(sourceFiles: readonly SourceFile[]): Promise<void>;
@@ -0,0 +1,163 @@
1
+ export declare const FALLBACK_SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
2
+ export declare const MANIFEST_NAME = "package.json";
3
+ export declare const DEFAULT_EXCLUDE_DIRS: Set<string>;
4
+ export declare const NODE_BUILTINS: Set<string>;
5
+ export type ResearchIntent = 'general' | 'reachability' | 'dependencies' | 'symbols';
6
+ export type ResearchMode = 'plan' | 'analyze' | 'prove';
7
+ export type ResearchFlowStep = {
8
+ readonly id: string;
9
+ readonly purpose: string;
10
+ readonly tools: readonly string[];
11
+ readonly produces: readonly string[];
12
+ readonly evidence: 'heuristic' | 'proof';
13
+ };
14
+ export type ResearchSymbolVerdict = 'reachable' | 'candidate-unused-export' | 'transitive-dead' | 'unused-export' | 'unknown';
15
+ export type ResearchRetentionSource = 'ast' | 'ripgrep';
16
+ export type ResearchSymbolRow = {
17
+ readonly symbol: string;
18
+ readonly kind: string;
19
+ readonly file: string;
20
+ readonly line: number;
21
+ readonly evidenceSource: 'ast' | 'regex';
22
+ /** How cross-file retention was established. Prefer `ast`; `ripgrep` is lexical fallback only. */
23
+ readonly retentionSource: ResearchRetentionSource;
24
+ readonly directRefs: number;
25
+ readonly externalRefs: number;
26
+ readonly retainedBy: readonly string[];
27
+ readonly verdict: ResearchSymbolVerdict;
28
+ };
29
+ export type ResearchGraphFactFile = {
30
+ readonly file: string;
31
+ readonly source: 'native-ast';
32
+ readonly language: string;
33
+ readonly declarations: readonly {
34
+ readonly name: string;
35
+ readonly kind: string;
36
+ readonly line: number;
37
+ readonly exported: boolean;
38
+ readonly parent?: string;
39
+ }[];
40
+ readonly imports: readonly {
41
+ readonly specifier: string;
42
+ readonly line: number;
43
+ readonly importKind: string;
44
+ readonly localName?: string;
45
+ readonly importedName?: string;
46
+ }[];
47
+ readonly exports: readonly {
48
+ readonly name: string;
49
+ readonly line: number;
50
+ readonly exportKind: string;
51
+ readonly localName?: string;
52
+ readonly source?: string;
53
+ }[];
54
+ readonly calls: readonly {
55
+ readonly caller: string;
56
+ readonly callee: string;
57
+ readonly line: number;
58
+ readonly kind: string;
59
+ }[];
60
+ readonly edges: readonly {
61
+ readonly from: string;
62
+ readonly to: string;
63
+ readonly relation: string;
64
+ readonly source: string;
65
+ readonly line: number;
66
+ }[];
67
+ readonly diagnostics: readonly string[];
68
+ };
69
+ export type ResearchFileIssue = {
70
+ readonly kind: 'unusedFile';
71
+ readonly file: string;
72
+ readonly retainedBy: readonly string[];
73
+ readonly verdict: 'unused-file';
74
+ };
75
+ export type ResearchDependencyIssue = {
76
+ readonly kind: 'unlistedDependency' | 'unusedDependency' | 'duplicateDependency';
77
+ readonly packageName: string;
78
+ readonly manifest: string;
79
+ readonly usedBy: readonly string[];
80
+ readonly declaredIn: readonly string[];
81
+ readonly verdict: string;
82
+ };
83
+ export type ResearchManifestSummary = {
84
+ readonly manifest: string;
85
+ readonly name?: string;
86
+ readonly entrypoints: readonly string[];
87
+ readonly dependencyCount: number;
88
+ };
89
+ export type ResearchGraphCapabilitySummary = {
90
+ readonly graphFactExtensions: readonly string[];
91
+ readonly capabilityCount: number;
92
+ readonly factFamilies: readonly string[];
93
+ readonly sourceFilesByLanguage: Readonly<Record<string, number>>;
94
+ readonly graphFilesByLanguage: Readonly<Record<string, number>>;
95
+ readonly missingGraphFacts: readonly {
96
+ readonly extension: string;
97
+ readonly files: number;
98
+ readonly reason: string;
99
+ }[];
100
+ };
101
+ export type ResearchAnalysisResult = {
102
+ readonly kind: 'researchFlow';
103
+ readonly goal: string;
104
+ readonly intent: ResearchIntent;
105
+ readonly facets: readonly string[];
106
+ readonly mode: ResearchMode;
107
+ readonly root: string;
108
+ readonly flow: readonly ResearchFlowStep[];
109
+ readonly summary: {
110
+ readonly manifests: number;
111
+ readonly sourceFiles: number;
112
+ readonly entrypoints: number;
113
+ readonly reachableFiles: number;
114
+ readonly unusedFiles: number;
115
+ readonly unlistedDependencies: number;
116
+ readonly unusedDependencies: number;
117
+ readonly duplicateDependencies: number;
118
+ readonly exportedSymbols: number;
119
+ readonly candidateUnusedExports: number;
120
+ readonly transitiveDeadExports: number;
121
+ readonly nativeGraphFiles: number;
122
+ readonly nativeGraphDeclarations: number;
123
+ readonly nativeGraphCalls: number;
124
+ };
125
+ readonly manifests: readonly ResearchManifestSummary[];
126
+ readonly files: readonly ResearchFileIssue[];
127
+ readonly dependencies: readonly ResearchDependencyIssue[];
128
+ readonly symbols: readonly ResearchSymbolRow[];
129
+ readonly graphFacts: readonly ResearchGraphFactFile[];
130
+ readonly graphCapabilities: ResearchGraphCapabilitySummary;
131
+ readonly caveats: readonly string[];
132
+ };
133
+ export type AnalyzeResearchOptions = {
134
+ readonly root: string;
135
+ readonly goal?: string;
136
+ readonly intent?: string;
137
+ readonly facets?: readonly string[];
138
+ readonly mode?: ResearchMode;
139
+ readonly maxFiles?: number;
140
+ };
141
+ export type Manifest = {
142
+ readonly path: string;
143
+ readonly dir: string;
144
+ readonly name?: string;
145
+ readonly deps: ReadonlyMap<string, readonly string[]>;
146
+ readonly entrypoints: readonly string[];
147
+ };
148
+ export type SourceFile = {
149
+ readonly path: string;
150
+ readonly rel: string;
151
+ readonly extension: string;
152
+ readonly language: string;
153
+ readonly imports: readonly string[];
154
+ readonly externalPackages: readonly string[];
155
+ readonly graphFacts?: ResearchGraphFactFile;
156
+ };
157
+ export type ExportSymbol = {
158
+ readonly symbol: string;
159
+ readonly kind: string;
160
+ readonly file: string;
161
+ readonly line: number;
162
+ readonly evidenceSource: 'ast' | 'regex';
163
+ };
@@ -0,0 +1,16 @@
1
+ import { type GraphFactCapability } from '../../../utils/contextUtils.js';
2
+ export declare function sourceExtensions(): ReadonlySet<string>;
3
+ export declare function graphFactCapabilities(): readonly GraphFactCapability[];
4
+ export declare function countBy<T>(items: readonly T[], key: (item: T) => string): Readonly<Record<string, number>>;
5
+ export declare function resolveImport(dir: string, specifier: string, known: ReadonlySet<string>): string | undefined;
6
+ export declare function resolveExistingPath(base: string, known: ReadonlySet<string>): string | undefined;
7
+ export declare function isRelativeSpecifier(specifier: string): boolean;
8
+ export declare function packageNameFromSpecifier(specifier: string): string | undefined;
9
+ export declare function recordValue(value: unknown): Record<string, unknown> | undefined;
10
+ export declare function stringValue(value: unknown): string | undefined;
11
+ export declare function isNonEmptyString(value: string | undefined): value is string;
12
+ export declare function isString(value: unknown): value is string;
13
+ export declare function uniqueStrings(values: readonly string[]): readonly string[];
14
+ export declare function relative(root: string, file: string): string;
15
+ export declare function exportKind(line: string): string;
16
+ export declare function calleeRefersToSymbol(callee: string, symbol: string): boolean;
@@ -1,134 +1,3 @@
1
- export type ResearchIntent = 'general' | 'reachability' | 'dependencies' | 'symbols';
2
- export type ResearchMode = 'plan' | 'analyze' | 'prove';
3
- export type ResearchFlowStep = {
4
- readonly id: string;
5
- readonly purpose: string;
6
- readonly tools: readonly string[];
7
- readonly produces: readonly string[];
8
- readonly evidence: 'heuristic' | 'proof';
9
- };
10
- export type ResearchSymbolVerdict = 'reachable' | 'candidate-unused-export' | 'transitive-dead' | 'unused-export' | 'unknown';
11
- export type ResearchSymbolRow = {
12
- readonly symbol: string;
13
- readonly kind: string;
14
- readonly file: string;
15
- readonly line: number;
16
- readonly evidenceSource: 'ast' | 'regex';
17
- readonly directRefs: number;
18
- readonly externalRefs: number;
19
- readonly retainedBy: readonly string[];
20
- readonly verdict: ResearchSymbolVerdict;
21
- };
22
- export type ResearchGraphFactFile = {
23
- readonly file: string;
24
- readonly source: 'native-ast';
25
- readonly language: string;
26
- readonly declarations: readonly {
27
- readonly name: string;
28
- readonly kind: string;
29
- readonly line: number;
30
- readonly exported: boolean;
31
- readonly parent?: string;
32
- }[];
33
- readonly imports: readonly {
34
- readonly specifier: string;
35
- readonly line: number;
36
- readonly importKind: string;
37
- readonly localName?: string;
38
- readonly importedName?: string;
39
- }[];
40
- readonly exports: readonly {
41
- readonly name: string;
42
- readonly line: number;
43
- readonly exportKind: string;
44
- readonly localName?: string;
45
- readonly source?: string;
46
- }[];
47
- readonly calls: readonly {
48
- readonly caller: string;
49
- readonly callee: string;
50
- readonly line: number;
51
- readonly kind: string;
52
- }[];
53
- readonly edges: readonly {
54
- readonly from: string;
55
- readonly to: string;
56
- readonly relation: string;
57
- readonly source: string;
58
- readonly line: number;
59
- }[];
60
- readonly diagnostics: readonly string[];
61
- };
62
- export type ResearchFileIssue = {
63
- readonly kind: 'unusedFile';
64
- readonly file: string;
65
- readonly retainedBy: readonly string[];
66
- readonly verdict: 'unused-file';
67
- };
68
- export type ResearchDependencyIssue = {
69
- readonly kind: 'unlistedDependency' | 'unusedDependency' | 'duplicateDependency';
70
- readonly packageName: string;
71
- readonly manifest: string;
72
- readonly usedBy: readonly string[];
73
- readonly declaredIn: readonly string[];
74
- readonly verdict: string;
75
- };
76
- export type ResearchManifestSummary = {
77
- readonly manifest: string;
78
- readonly name?: string;
79
- readonly entrypoints: readonly string[];
80
- readonly dependencyCount: number;
81
- };
82
- export type ResearchGraphCapabilitySummary = {
83
- readonly graphFactExtensions: readonly string[];
84
- readonly capabilityCount: number;
85
- readonly factFamilies: readonly string[];
86
- readonly sourceFilesByLanguage: Readonly<Record<string, number>>;
87
- readonly graphFilesByLanguage: Readonly<Record<string, number>>;
88
- readonly missingGraphFacts: readonly {
89
- readonly extension: string;
90
- readonly files: number;
91
- readonly reason: string;
92
- }[];
93
- };
94
- export type ResearchAnalysisResult = {
95
- readonly kind: 'researchFlow';
96
- readonly goal: string;
97
- readonly intent: ResearchIntent;
98
- readonly facets: readonly string[];
99
- readonly mode: ResearchMode;
100
- readonly root: string;
101
- readonly flow: readonly ResearchFlowStep[];
102
- readonly summary: {
103
- readonly manifests: number;
104
- readonly sourceFiles: number;
105
- readonly entrypoints: number;
106
- readonly reachableFiles: number;
107
- readonly unusedFiles: number;
108
- readonly unlistedDependencies: number;
109
- readonly unusedDependencies: number;
110
- readonly duplicateDependencies: number;
111
- readonly exportedSymbols: number;
112
- readonly candidateUnusedExports: number;
113
- readonly transitiveDeadExports: number;
114
- readonly nativeGraphFiles: number;
115
- readonly nativeGraphDeclarations: number;
116
- readonly nativeGraphCalls: number;
117
- };
118
- readonly manifests: readonly ResearchManifestSummary[];
119
- readonly files: readonly ResearchFileIssue[];
120
- readonly dependencies: readonly ResearchDependencyIssue[];
121
- readonly symbols: readonly ResearchSymbolRow[];
122
- readonly graphFacts: readonly ResearchGraphFactFile[];
123
- readonly graphCapabilities: ResearchGraphCapabilitySummary;
124
- readonly caveats: readonly string[];
125
- };
126
- export type AnalyzeResearchOptions = {
127
- readonly root: string;
128
- readonly goal?: string;
129
- readonly intent?: string;
130
- readonly facets?: readonly string[];
131
- readonly mode?: ResearchMode;
132
- readonly maxFiles?: number;
133
- };
1
+ import type { AnalyzeResearchOptions, ResearchAnalysisResult } from './analyze/types.js';
2
+ export type { AnalyzeResearchOptions, ResearchAnalysisResult, ResearchDependencyIssue, ResearchFileIssue, ResearchFlowStep, ResearchGraphCapabilitySummary, ResearchGraphFactFile, ResearchIntent, ResearchManifestSummary, ResearchMode, ResearchRetentionSource, ResearchSymbolRow, ResearchSymbolVerdict, } from './analyze/types.js';
134
3
  export declare function analyzeResearchFlow(options: AnalyzeResearchOptions): Promise<ResearchAnalysisResult>;
@@ -0,0 +1,4 @@
1
+ import type { ResearchAnalysisResult } from '../analyze.js';
2
+ import type { ResearchEvidencePacket, ResearchGraphSummary, ResearchPacketBundle } from './types.js';
3
+ export declare function tallyPacketVerdicts(packets: readonly ResearchEvidencePacket[]): Pick<ResearchGraphSummary, 'byVerdict' | 'facts' | 'edges'>;
4
+ export declare function buildResearchPackets(analysis: ResearchAnalysisResult): ResearchPacketBundle;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Evidence model for research packets.
3
+ *
4
+ * Pure type/interface definitions describing the evidence graph — subjects,
5
+ * facts, edges, verdicts, and the `ResearchEvidencePacket` shape itself. No
6
+ * construction logic here; see `./builders.ts` for how `ResearchAnalysisResult`
7
+ * is turned into packets built from these types.
8
+ *
9
+ * HONESTY CONTRACT: this layer never invents proof. Native AST facts can prove
10
+ * syntax-level declarations/imports/exports, but cross-file references remain
11
+ * heuristic until LSP proof is attached by the graph adapter or followed via
12
+ * `next.semantic`.
13
+ */
14
+ import type { OqlContinuation } from '../../types.js';
15
+ export type EvidenceSource = 'ripgrep' | 'regex' | 'ast' | 'symbols' | 'lsp' | 'manifest' | 'graph' | 'exactRead';
16
+ export type EvidenceConfidence = 'exact' | 'heuristic' | 'partial';
17
+ export interface EvidenceLocation {
18
+ uri: string;
19
+ range?: {
20
+ start: {
21
+ line: number;
22
+ character?: number;
23
+ };
24
+ end?: {
25
+ line: number;
26
+ character?: number;
27
+ };
28
+ };
29
+ }
30
+ export interface EvidenceSubject extends EvidenceLocation {
31
+ id: string;
32
+ kind: 'file' | 'symbol' | 'function' | 'class' | 'method' | 'interface' | 'type' | 'dependency' | 'package' | 'entrypoint';
33
+ name?: string;
34
+ symbolKind?: number | string;
35
+ language?: string;
36
+ }
37
+ export type EvidenceClaim = 'defines' | 'declares' | 'exports' | 'imports' | 'references' | 'calls' | 'extends' | 'implements' | 'typeUses' | 'entrypoint' | 'unresolved' | 'textMatch' | 'structuralMatch';
38
+ export type EvidenceFlag = 'same-file' | 'external' | 'type-only' | 'test-only' | 'dynamic' | 'string-only' | 'unreachable' | 'generated' | 'declaration';
39
+ export interface EvidenceFact {
40
+ id: string;
41
+ subject: EvidenceSubject;
42
+ claim: EvidenceClaim;
43
+ source: EvidenceSource;
44
+ confidence: EvidenceConfidence;
45
+ flags?: EvidenceFlag[];
46
+ value?: unknown;
47
+ }
48
+ export type EvidenceRelation = 'contains' | 'defines' | 'exports' | 'imports' | 'references' | 'calls' | 'constructs' | 'extends' | 'implements' | 'typeUses' | 'retains' | 'reachableFrom' | 'declaresDependency' | 'usesDependency';
49
+ export interface EvidenceEdge {
50
+ id: string;
51
+ from: EvidenceSubject;
52
+ to: EvidenceSubject;
53
+ relation: EvidenceRelation;
54
+ source: EvidenceSource;
55
+ confidence: EvidenceConfidence;
56
+ flags?: EvidenceFlag[];
57
+ via?: EvidenceLocation;
58
+ }
59
+ export type PacketVerdict = 'reachable' | 'candidate-dead' | 'transitive-dead' | 'candidate-unused-file' | 'candidate-unused-dependency' | 'unknown';
60
+ export type PacketProofStatus = 'candidate' | 'confirmed-by-lsp' | 'confirmed-by-ast-and-lsp' | 'needs-framework-graph' | 'conflicting-evidence';
61
+ export type MissingProofKind = 'lsp-unavailable' | 'dynamic-import-unresolved' | 'framework-entrypoint-unknown' | 'tsconfig-paths-unresolved' | 'manifest-rule-missing' | 'parser-failed' | 'pagination-open';
62
+ export interface MissingProof {
63
+ kind: MissingProofKind;
64
+ severity: 'low' | 'medium' | 'high';
65
+ location?: EvidenceLocation;
66
+ }
67
+ export interface ResearchEvidencePacket {
68
+ subject: EvidenceSubject;
69
+ verdict: PacketVerdict;
70
+ proofStatus: PacketProofStatus;
71
+ why: EvidenceFact[];
72
+ retainedBy: EvidenceEdge[];
73
+ retains?: EvidenceEdge[];
74
+ missingProof: MissingProof[];
75
+ proof?: Record<string, unknown>;
76
+ risk: {
77
+ deleteRisk: 'low' | 'medium' | 'high' | 'unknown';
78
+ reason: string;
79
+ };
80
+ next: Record<string, OqlContinuation>;
81
+ }
82
+ export interface ResearchGraphSummary {
83
+ subjects: number;
84
+ facts: number;
85
+ edges: number;
86
+ byVerdict: Record<PacketVerdict, number>;
87
+ }
88
+ export interface ResearchPacketBundle {
89
+ packets: ResearchEvidencePacket[];
90
+ graphSummary: ResearchGraphSummary;
91
+ }