@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,46 @@
1
+ /**
2
+ * OQL planner — the explain-plan shapes describing how a query's predicates
3
+ * were routed to backends (pushdown/residual/route/unsupported), the backend
4
+ * calls made, and transformer traces, surfaced when `explain:true`.
5
+ */
6
+ import type { PredicateId, QuerySource } from './predicates.js';
7
+ import type { MaterializePolicy, OqlCanonicalInput, QueryControls } from './query.js';
8
+ import type { OqlDiagnostic } from './diagnostics.js';
9
+ import type { OqlContinuation } from './envelope.js';
10
+ export type PlanRoute = 'PUSHDOWN' | 'RESIDUAL' | 'ROUTE' | 'UNSUPPORTED';
11
+ export interface OqlPlanNode {
12
+ predicateId: PredicateId;
13
+ path: string;
14
+ route: PlanRoute;
15
+ backend?: string;
16
+ reason: string;
17
+ }
18
+ export interface OqlBackendCall {
19
+ backend: string;
20
+ source?: QuerySource;
21
+ operation: string;
22
+ exact: boolean;
23
+ }
24
+ export interface OqlTransformerTrace {
25
+ id: string;
26
+ status: string;
27
+ sourceKinds: readonly string[];
28
+ target: string;
29
+ backends: readonly Pick<OqlBackendCall, 'backend' | 'operation' | 'exact'>[];
30
+ }
31
+ export interface OqlExplainPlan {
32
+ input: unknown;
33
+ normalized: OqlCanonicalInput;
34
+ defaults: Record<string, unknown>;
35
+ nodes: OqlPlanNode[];
36
+ backendCalls: OqlBackendCall[];
37
+ transformers?: readonly OqlTransformerTrace[];
38
+ materialization?: MaterializePolicy & {
39
+ required: boolean;
40
+ reason: string;
41
+ };
42
+ budgets: QueryControls['budget'];
43
+ truncated?: boolean;
44
+ diagnostics: OqlDiagnostic[];
45
+ next?: Record<string, OqlContinuation>;
46
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * OQL predicates — the boolean/leaf conditions a query's `where` clause is
3
+ * built from (text/regex/structural/field matches plus all/any/not
4
+ * composition), and the query source/scope shapes they operate over.
5
+ */
6
+ export type PredicateId = string;
7
+ export type QuerySource = {
8
+ kind: 'local';
9
+ path: string;
10
+ } | {
11
+ kind: 'github';
12
+ repo?: string;
13
+ owner?: string;
14
+ ref?: string;
15
+ } | {
16
+ kind: 'materialized';
17
+ localPath: string;
18
+ source?: QuerySource;
19
+ } | {
20
+ kind: 'npm';
21
+ };
22
+ export interface QueryScope {
23
+ path?: string | string[];
24
+ language?: string | string[];
25
+ include?: string[];
26
+ exclude?: string[];
27
+ excludeDir?: string[];
28
+ hidden?: boolean;
29
+ noIgnore?: boolean;
30
+ minDepth?: number;
31
+ maxDepth?: number;
32
+ }
33
+ export interface TextPredicate {
34
+ id?: PredicateId;
35
+ kind: 'text';
36
+ value: string;
37
+ case?: 'smart' | 'sensitive' | 'insensitive';
38
+ wholeWord?: boolean;
39
+ }
40
+ export interface RegexPredicate {
41
+ id?: PredicateId;
42
+ kind: 'regex';
43
+ value: string;
44
+ dialect?: 'rust' | 'pcre2' | 'provider';
45
+ case?: 'smart' | 'sensitive' | 'insensitive';
46
+ wholeWord?: boolean;
47
+ multiline?: boolean;
48
+ dotAll?: boolean;
49
+ }
50
+ export interface StructuralRule {
51
+ pattern?: string;
52
+ kind?: string;
53
+ inside?: StructuralRule;
54
+ has?: StructuralRule;
55
+ not?: StructuralRule;
56
+ all?: StructuralRule[];
57
+ any?: StructuralRule[];
58
+ stopBy?: 'end';
59
+ }
60
+ export type StructuralRuleInput = StructuralRule | string;
61
+ export interface StructuralPredicate {
62
+ id?: PredicateId;
63
+ kind: 'structural';
64
+ lang: string;
65
+ pattern?: string;
66
+ rule?: StructuralRuleInput;
67
+ }
68
+ export type FieldName = 'path' | 'basename' | 'extension' | 'size' | 'modified' | 'accessed' | 'empty' | 'permissions' | 'executable' | 'readable' | 'writable' | 'entryType';
69
+ export type FieldOp = '=' | '!=' | 'in' | 'exists' | 'glob' | 'regex' | '>' | '>=' | '<' | '<=' | 'within' | 'before';
70
+ export interface FieldPredicate {
71
+ id?: PredicateId;
72
+ kind: 'field';
73
+ field: FieldName;
74
+ op: FieldOp;
75
+ value?: unknown;
76
+ }
77
+ export interface AllPredicate {
78
+ kind: 'all';
79
+ id?: PredicateId;
80
+ of: Predicate[];
81
+ }
82
+ export interface AnyPredicate {
83
+ kind: 'any';
84
+ id?: PredicateId;
85
+ of: Predicate[];
86
+ }
87
+ export interface NotPredicate {
88
+ kind: 'not';
89
+ id?: PredicateId;
90
+ predicate: Predicate;
91
+ }
92
+ export type LeafPredicate = TextPredicate | RegexPredicate | StructuralPredicate | FieldPredicate;
93
+ export type Predicate = AllPredicate | AnyPredicate | NotPredicate | LeafPredicate;
@@ -0,0 +1,143 @@
1
+ /**
2
+ * OQL query/batch input shapes — the canonical `OqlQuery`/`OqlBatch` a query
3
+ * compiles to, plus the looser `OqlInputQuery`/`OqlInputBatch` edge shapes
4
+ * that accept sugar (repo/owner/ref/text/regex/... shorthand) before
5
+ * normalization.
6
+ */
7
+ import type { OqlActiveTarget, OqlTarget } from './targets.js';
8
+ import type { Predicate, QueryScope, QuerySource, StructuralRule } from './predicates.js';
9
+ export interface MaterializePolicy {
10
+ mode: 'never' | 'auto' | 'required';
11
+ strategy?: 'file' | 'tree' | 'subtree' | 'repo';
12
+ allowFullRepo?: boolean;
13
+ forceRefresh?: boolean;
14
+ }
15
+ export interface FetchInstructions {
16
+ content?: {
17
+ range?: {
18
+ startLine?: number;
19
+ endLine?: number;
20
+ contextLines?: number;
21
+ };
22
+ match?: {
23
+ text: string;
24
+ regex?: boolean;
25
+ caseSensitive?: boolean;
26
+ };
27
+ contentView?: 'none' | 'standard' | 'symbols';
28
+ charOffset?: number;
29
+ charLength?: number;
30
+ fullContent?: boolean;
31
+ };
32
+ tree?: {
33
+ maxDepth?: number;
34
+ pattern?: string;
35
+ includeSizes?: boolean;
36
+ extensions?: string[];
37
+ filesOnly?: boolean;
38
+ directoriesOnly?: boolean;
39
+ sortBy?: 'name' | 'size' | 'time' | 'extension';
40
+ reverse?: boolean;
41
+ };
42
+ }
43
+ export interface QueryControls {
44
+ search?: {
45
+ countLinesPerFile?: boolean;
46
+ countMatchesPerFile?: boolean;
47
+ onlyMatching?: boolean;
48
+ unique?: boolean;
49
+ countUnique?: boolean;
50
+ contextLines?: number;
51
+ invertMatch?: boolean;
52
+ matchWindow?: number;
53
+ matchContentLength?: number;
54
+ maxMatchesPerFile?: number;
55
+ matchPage?: number;
56
+ sort?: 'relevance' | 'matchCount' | 'path' | 'modified' | 'accessed' | 'created' | 'size' | 'name';
57
+ sortReverse?: boolean;
58
+ rankingProfile?: string;
59
+ debugRanking?: boolean;
60
+ };
61
+ budget?: {
62
+ maxFiles?: number;
63
+ maxCandidates?: number;
64
+ maxBytes?: number;
65
+ maxMaterializedBytes?: number;
66
+ maxPlanNodes?: number;
67
+ maxBooleanExpansion?: number;
68
+ timeoutMs?: number;
69
+ };
70
+ }
71
+ export type SelectField = string;
72
+ export type QueryView = 'discovery' | 'paginated' | 'detailed';
73
+ export interface OqlQuery {
74
+ schema: 'oql';
75
+ id?: string;
76
+ target: OqlActiveTarget;
77
+ from?: QuerySource;
78
+ scope?: QueryScope;
79
+ where?: Predicate;
80
+ materialize?: MaterializePolicy;
81
+ fetch?: FetchInstructions;
82
+ select?: SelectField[];
83
+ view?: QueryView;
84
+ controls?: QueryControls;
85
+ limit?: number;
86
+ page?: number;
87
+ itemsPerPage?: number;
88
+ /**
89
+ * Target-specific parameter bag. The backing tool's schema remains the
90
+ * exhaustive validator; OQL validates the documented common fields early.
91
+ */
92
+ params?: Record<string, unknown>;
93
+ explain?: boolean;
94
+ }
95
+ export interface OqlBatch {
96
+ schema: 'oql';
97
+ id?: string;
98
+ queries: OqlQuery[];
99
+ combine?: 'independent' | 'merge';
100
+ limit?: number;
101
+ page?: number;
102
+ itemsPerPage?: number;
103
+ explain?: boolean;
104
+ }
105
+ export type OqlCanonicalInput = OqlQuery | OqlBatch;
106
+ export interface OqlInputQuery {
107
+ schema?: 'oql';
108
+ id?: string;
109
+ target: OqlTarget;
110
+ from?: QuerySource;
111
+ scope?: QueryScope;
112
+ where?: Predicate;
113
+ materialize?: MaterializePolicy | 'never' | 'auto' | 'required';
114
+ fetch?: FetchInstructions;
115
+ select?: SelectField[];
116
+ view?: QueryView;
117
+ controls?: QueryControls;
118
+ limit?: number;
119
+ page?: number;
120
+ itemsPerPage?: number;
121
+ explain?: boolean;
122
+ repo?: string;
123
+ owner?: string;
124
+ ref?: string;
125
+ path?: string | string[];
126
+ text?: string;
127
+ regex?: string;
128
+ pattern?: string;
129
+ rule?: StructuralRule;
130
+ lang?: string;
131
+ [key: string]: unknown;
132
+ }
133
+ export interface OqlInputBatch {
134
+ schema?: 'oql';
135
+ id?: string;
136
+ queries: OqlInputQuery[];
137
+ combine?: 'independent' | 'merge';
138
+ limit?: number;
139
+ page?: number;
140
+ itemsPerPage?: number;
141
+ explain?: boolean;
142
+ }
143
+ export type OqlSearchInput = OqlInputQuery | OqlInputBatch;
@@ -0,0 +1,127 @@
1
+ /**
2
+ * OQL record `data` contracts — the documented payload shapes per
3
+ * `recordType` (repository, package, PR, commit, diff, semantics,
4
+ * materialized, research, graph). The backing tool owns the exhaustive
5
+ * payload; these name the fields agents rely on to cite + continue. All
6
+ * optional (backend-dependent); never fabricated.
7
+ */
8
+ import type { Pagination } from './envelope.js';
9
+ export interface OqlRepositoryData {
10
+ fullName?: string;
11
+ owner?: string;
12
+ repo?: string;
13
+ description?: string;
14
+ stars?: number;
15
+ forks?: number;
16
+ language?: string;
17
+ topics?: string[];
18
+ pushedAt?: string;
19
+ url?: string;
20
+ [k: string]: unknown;
21
+ }
22
+ export interface OqlPackageData {
23
+ name?: string;
24
+ version?: string;
25
+ description?: string;
26
+ downloads?: number;
27
+ repository?: string;
28
+ repositoryId?: string;
29
+ [k: string]: unknown;
30
+ }
31
+ export interface OqlPullRequestData {
32
+ number?: number;
33
+ title?: string;
34
+ state?: string;
35
+ author?: string;
36
+ createdAt?: string;
37
+ mergedAt?: string;
38
+ changedFiles?: number;
39
+ url?: string;
40
+ [k: string]: unknown;
41
+ }
42
+ export interface OqlCommitData {
43
+ sha?: string;
44
+ oid?: string;
45
+ message?: string;
46
+ title?: string;
47
+ author?: string;
48
+ date?: string;
49
+ [k: string]: unknown;
50
+ }
51
+ export interface OqlDiffData {
52
+ path?: string;
53
+ baseRef?: string;
54
+ headRef?: string;
55
+ additions?: number;
56
+ deletions?: number;
57
+ unchanged?: number;
58
+ patch?: string;
59
+ [k: string]: unknown;
60
+ }
61
+ export interface OqlSemanticsData {
62
+ uri?: string;
63
+ line?: number;
64
+ startLine?: number;
65
+ symbol?: string;
66
+ kind?: string;
67
+ [k: string]: unknown;
68
+ }
69
+ export interface OqlMaterializedData {
70
+ localPath: string;
71
+ repoRoot?: string;
72
+ ref?: string;
73
+ cache?: 'hit' | 'miss';
74
+ complete?: boolean;
75
+ [k: string]: unknown;
76
+ }
77
+ export interface OqlResearchData {
78
+ kind?: 'researchFlow';
79
+ goal?: string;
80
+ intent?: string;
81
+ facets?: readonly string[];
82
+ mode?: 'plan' | 'analyze' | 'prove';
83
+ summary?: Record<string, unknown>;
84
+ flow?: readonly unknown[];
85
+ nativeGraphSummary?: Record<string, unknown>;
86
+ graphSummary?: Record<string, unknown>;
87
+ packetPage?: Pagination;
88
+ packets?: unknown[];
89
+ /** Present only in detailed view — a windowed slice (see `manifestsPage`). */
90
+ manifests?: unknown[];
91
+ manifestsPage?: Pagination;
92
+ /** Present only in detailed view — a windowed slice (see `filesPage`). */
93
+ files?: unknown[];
94
+ filesPage?: Pagination;
95
+ /** Present only in detailed view — a windowed slice (see `dependenciesPage`). */
96
+ dependencies?: unknown[];
97
+ dependenciesPage?: Pagination;
98
+ /** Present only in detailed view — a windowed slice (see `symbolsPage`). */
99
+ symbols?: unknown[];
100
+ symbolsPage?: Pagination;
101
+ /** Present only in detailed view — a windowed slice (see `graphFactsPage`). */
102
+ graphFacts?: unknown[];
103
+ graphFactsPage?: Pagination;
104
+ caveats?: string[];
105
+ [k: string]: unknown;
106
+ }
107
+ export interface OqlGraphData {
108
+ kind?: 'relationshipGraph';
109
+ goal?: string;
110
+ intent?: string;
111
+ facets?: readonly string[];
112
+ mode?: 'plan' | 'analyze' | 'prove';
113
+ root?: string;
114
+ filters?: Record<string, unknown>;
115
+ summary?: Record<string, unknown>;
116
+ flow?: readonly unknown[];
117
+ nativeGraphSummary?: Record<string, unknown>;
118
+ graphSummary?: unknown;
119
+ packetPage?: Pagination;
120
+ nodes?: unknown[];
121
+ edges?: unknown[];
122
+ facts?: unknown[];
123
+ packets?: unknown[];
124
+ missingProof?: unknown[];
125
+ caveats?: string[];
126
+ [k: string]: unknown;
127
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * OQL typed record-row aliases — a record row narrowed to a specific
3
+ * `recordType` + matching `data` shape, plus the overall `OqlResultRow` union
4
+ * and its proof-graded variant.
5
+ */
6
+ import type { OqlCodeResultRow, OqlContentResultRow, OqlFileResultRow, OqlProofGrade, OqlRecordResultRow, OqlTreeResultRow } from './results.js';
7
+ import type { OqlCommitData, OqlDiffData, OqlGraphData, OqlMaterializedData, OqlPackageData, OqlPullRequestData, OqlRepositoryData, OqlResearchData, OqlSemanticsData } from './recordData.js';
8
+ /** Typed row aliases — a record row whose `data` matches its `recordType`. */
9
+ export type OqlRepositoryRow = OqlRecordResultRow & {
10
+ recordType: 'repository';
11
+ data: OqlRepositoryData;
12
+ };
13
+ export type OqlPackageRow = OqlRecordResultRow & {
14
+ recordType: 'package';
15
+ data: OqlPackageData;
16
+ };
17
+ export type OqlPullRequestRow = OqlRecordResultRow & {
18
+ recordType: 'pullRequest';
19
+ data: OqlPullRequestData;
20
+ };
21
+ export type OqlCommitRow = OqlRecordResultRow & {
22
+ recordType: 'commit';
23
+ data: OqlCommitData;
24
+ };
25
+ export type OqlDiffRow = OqlRecordResultRow & {
26
+ recordType: 'diff';
27
+ data: OqlDiffData;
28
+ };
29
+ export type OqlSemanticsRow = OqlRecordResultRow & {
30
+ recordType: 'semantics';
31
+ data: OqlSemanticsData;
32
+ };
33
+ export type OqlMaterializedRow = OqlRecordResultRow & {
34
+ recordType: 'materialized';
35
+ data: OqlMaterializedData;
36
+ };
37
+ export type OqlResearchRow = OqlRecordResultRow & {
38
+ recordType: 'research';
39
+ data: OqlResearchData;
40
+ };
41
+ export type OqlGraphRow = OqlRecordResultRow & {
42
+ recordType: 'graph';
43
+ data: OqlGraphData;
44
+ };
45
+ export type OqlResultRow = OqlCodeResultRow | OqlFileResultRow | OqlTreeResultRow | OqlContentResultRow | OqlRecordResultRow;
46
+ export type OqlProofGradedResultRow = OqlResultRow & {
47
+ proofGrade: OqlProofGrade;
48
+ };
@@ -0,0 +1,118 @@
1
+ /**
2
+ * OQL result rows — the per-kind row shapes a result envelope's `results[]`
3
+ * can hold (code/file/tree/content matches, and the generic `record` row
4
+ * used by typed research objects; see record-data.ts / record-rows.ts for
5
+ * the `recordType`-specific `data` payloads and aliases).
6
+ */
7
+ import type { QuerySource } from './predicates.js';
8
+ import type { OqlContinuation } from './envelope.js';
9
+ export type OqlProofGrade = 'candidate' | 'text' | 'structural' | 'semantic' | 'graph' | 'missing';
10
+ interface OqlProofGradedRow {
11
+ /**
12
+ * Mandatory on rows emitted by `runOqlSearch`; adapters may omit it while the
13
+ * runner computes the final proof grade from query semantics and row shape.
14
+ */
15
+ proofGrade?: OqlProofGrade;
16
+ }
17
+ export interface OqlCodeResultRow extends OqlProofGradedRow {
18
+ kind: 'code';
19
+ source?: QuerySource;
20
+ path: string;
21
+ /**
22
+ * 1-based match line. Optional because some providers (GitHub code search)
23
+ * return path-level matches with no line — never fabricate one.
24
+ */
25
+ line?: number;
26
+ endLine?: number;
27
+ column?: number;
28
+ snippet?: string;
29
+ /** File-level count payloads from local search count modes. */
30
+ totalMatchedLines?: number;
31
+ totalOccurrences?: number;
32
+ /** Provider snippet offsets when available, e.g. GitHub code search indices. */
33
+ matchIndices?: Array<{
34
+ start: number;
35
+ end: number;
36
+ lineOffset?: number;
37
+ }>;
38
+ /** Row-level provider/context metadata that is useful but not identity. */
39
+ metadata?: Record<string, unknown>;
40
+ /**
41
+ * Structural (AST) metavariable captures. `$X` → single-element list; `$$$X`
42
+ * → node list. Keyed by bare metavar name. Present only for structural
43
+ * matches that captured; never fabricated.
44
+ */
45
+ metavars?: Record<string, string[]>;
46
+ /** Per-capture source ranges (uri+line ready for lspGetSemantics handoff). */
47
+ metavarRanges?: Record<string, {
48
+ text: string;
49
+ line: number;
50
+ column: number;
51
+ endLine: number;
52
+ endColumn: number;
53
+ }[]>;
54
+ /**
55
+ * Deterministic AST match-kind label from the engine classifier
56
+ * (declaration|import|export|callsite|identifier|comment|string|…).
57
+ * Lexical coverage signal — not semantic identity.
58
+ */
59
+ matchKind?: string;
60
+ /** Fixed table derived from matchKind (0.0..1.0); not relevance ranking. */
61
+ scoreHint?: number;
62
+ /**
63
+ * Executable follow-up continuations. Keys are dotted *domain names*
64
+ * (`next.<domain>`, e.g. `next.fetch`, `next.semantic`, `next.charRange`),
65
+ * NOT nested object paths — the registry in run.ts owns the key set.
66
+ */
67
+ next?: Record<string, OqlContinuation>;
68
+ }
69
+ export interface OqlFileResultRow extends OqlProofGradedRow {
70
+ kind: 'file';
71
+ source?: QuerySource;
72
+ path: string;
73
+ entryType: 'file' | 'directory';
74
+ size?: number;
75
+ modified?: string;
76
+ next?: Record<string, OqlContinuation>;
77
+ }
78
+ export interface OqlTreeResultRow extends OqlProofGradedRow {
79
+ kind: 'tree';
80
+ source?: QuerySource;
81
+ path: string;
82
+ entryType: 'file' | 'directory';
83
+ depth: number;
84
+ size?: number;
85
+ children?: OqlTreeResultRow[];
86
+ next?: Record<string, OqlContinuation>;
87
+ }
88
+ export interface OqlContentResultRow extends OqlProofGradedRow {
89
+ kind: 'content';
90
+ source?: QuerySource;
91
+ path: string;
92
+ content: string;
93
+ range?: {
94
+ startLine?: number;
95
+ endLine?: number;
96
+ charOffset?: number;
97
+ charLength?: number;
98
+ };
99
+ contentView: 'none' | 'standard' | 'symbols';
100
+ next?: Record<string, OqlContinuation>;
101
+ }
102
+ /**
103
+ * Generic record row for targets whose payload is a typed research object
104
+ * (repository, package, PR, commit, symbol/location, diff, packet).
105
+ * `recordType` names the family; `data` is the row payload.
106
+ */
107
+ export interface OqlRecordResultRow extends OqlProofGradedRow {
108
+ kind: 'record';
109
+ recordType: 'semantics' | 'repository' | 'package' | 'pullRequest' | 'commit' | 'diff' | 'research' | 'graph' | 'materialized';
110
+ /** Stable, citeable identity (repo, name@version, #PR, SHA, path, uri). */
111
+ id?: string;
112
+ source?: QuerySource;
113
+ /** Parent/query metadata preserved from the backing tool payload. */
114
+ metadata?: Record<string, unknown>;
115
+ data: Record<string, unknown>;
116
+ next?: Record<string, OqlContinuation>;
117
+ }
118
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * OQL targets — the addressable "shapes" a query can search
3
+ * (code/content/structure/files/... ) plus reserved (not-yet-active) targets
4
+ * and the sort values each lane can execute.
5
+ */
6
+ export type OqlActiveTarget = 'code' | 'content' | 'structure' | 'files' | 'semantics' | 'repositories' | 'packages' | 'pullRequests' | 'commits' | 'diff' | 'research' | 'graph' | 'materialize';
7
+ export type OqlReservedTarget = 'fixes' | 'dataflow';
8
+ export type OqlTarget = OqlActiveTarget | OqlReservedTarget;
9
+ export declare const ACTIVE_TARGETS: readonly OqlActiveTarget[];
10
+ export declare const RESERVED_TARGETS: readonly OqlReservedTarget[];
11
+ /** Targets that do not need a code corpus (provider/registry discovery). */
12
+ export declare const CORPUS_OPTIONAL_TARGETS: readonly OqlActiveTarget[];
13
+ /**
14
+ * Which `controls.search.sort` values each lane can actually execute
15
+ * (files: localFindFiles sortBy; code: code-search ranking sorts). Single
16
+ * source for shorthand lowering and the planner's inapplicable-sort warning —
17
+ * a value outside the target's set is IGNORED by the backend, never an error.
18
+ */
19
+ export declare const SEARCH_SORTS_BY_TARGET: {
20
+ readonly code: readonly ["relevance", "matchCount", "path", "modified", "accessed", "created"];
21
+ readonly files: readonly ["size", "name", "path", "modified"];
22
+ };