@octocodeai/octocode-tools-core 16.5.1 → 16.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -95
- package/dist/direct.js +38 -33
- package/dist/github/githubAPI.d.ts +22 -0
- package/dist/github/history.d.ts +3 -0
- package/dist/github/prTransformation.d.ts +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.js +45 -40
- package/dist/oql/adapters/compile.d.ts +25 -0
- package/dist/oql/adapters/github.d.ts +3 -0
- package/dist/oql/adapters/local.d.ts +7 -0
- package/dist/oql/adapters/materialize.d.ts +11 -0
- package/dist/oql/adapters/pagination.d.ts +21 -0
- package/dist/oql/adapters/researchTargets.d.ts +50 -0
- package/dist/oql/adapters/resultMap.d.ts +20 -0
- package/dist/oql/adapters/ruleYaml.d.ts +11 -0
- package/dist/oql/adapters/runner.d.ts +14 -0
- package/dist/oql/adapters/v2.d.ts +32 -0
- package/dist/oql/capabilities.d.ts +31 -0
- package/dist/oql/defaults.d.ts +26 -0
- package/dist/oql/diagnostics.d.ts +25 -0
- package/dist/oql/diffLanes.d.ts +29 -0
- package/dist/oql/envelope.d.ts +19 -0
- package/dist/oql/features.d.ts +7 -0
- package/dist/oql/index.d.ts +26 -0
- package/dist/oql/index.js +49 -0
- package/dist/oql/normalize.d.ts +5 -0
- package/dist/oql/planner.d.ts +7 -0
- package/dist/oql/research/analyze.d.ts +134 -0
- package/dist/oql/research/packets.d.ts +80 -0
- package/dist/oql/run.d.ts +32 -0
- package/dist/oql/schema.d.ts +1018 -0
- package/dist/oql/schemeText.d.ts +138 -0
- package/dist/oql/shorthand.d.ts +177 -0
- package/dist/oql/targetParams.d.ts +20 -0
- package/dist/oql/transformers/contract.d.ts +19 -0
- package/dist/oql/transformers/github/code.d.ts +17 -0
- package/dist/oql/transformers/github/common.d.ts +8 -0
- package/dist/oql/transformers/language.d.ts +1 -0
- package/dist/oql/transformers/registry.d.ts +16 -0
- package/dist/oql/transformers/types.d.ts +11 -0
- package/dist/oql/types.d.ts +633 -0
- package/dist/oql/v2params.d.ts +22 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/schema.d.ts +13 -0
- package/dist/schema.js +8 -0
- package/dist/serverConfig.d.ts +0 -1
- package/dist/session.d.ts +2 -24
- package/dist/shared/config/defaults.d.ts +1 -2
- package/dist/shared/config/index.d.ts +2 -3
- package/dist/shared/config/index.js +2 -3
- package/dist/shared/config/resolverSections.d.ts +1 -3
- package/dist/shared/config/runtimeSurface.d.ts +2 -2
- package/dist/shared/config/schemas.d.ts +0 -1
- package/dist/shared/config/types.d.ts +0 -8
- package/dist/shared/credentials/index.js +1 -2
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/languageSelectors.d.ts +23 -0
- package/dist/shared/paths.d.ts +0 -2
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -2
- package/dist/tools/directToolCatalog.d.ts +15 -56
- package/dist/tools/directToolCatalog.exec.d.ts +11 -0
- package/dist/tools/directToolCatalog.meta.d.ts +82 -0
- package/dist/tools/github_clone_repo/cache.d.ts +1 -1
- package/dist/tools/github_clone_repo/types.d.ts +2 -0
- package/dist/tools/github_fetch_content/scheme.d.ts +104 -0
- package/dist/tools/github_fetch_content/types.d.ts +27 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +170 -2
- package/dist/tools/lsp/shared/resolveSymbolAnchor.d.ts +2 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +34 -5
- package/dist/tools/oql_search/execution.d.ts +7 -0
- package/dist/tools/package_search/execution.d.ts +10 -0
- package/dist/tools/providerMappers.d.ts +7 -7
- package/dist/tools/toolConfig.d.ts +1 -0
- package/dist/tools/toolNames.d.ts +2 -0
- package/dist/types/server.d.ts +0 -1
- package/dist/types/session.d.ts +0 -19
- package/dist/utils/contextUtils.d.ts +15 -1
- package/dist/utils/core/types.d.ts +2 -1
- package/dist/utils/markdownOutline.d.ts +10 -0
- package/dist/utils/response/groupedFinalizer.d.ts +0 -23
- package/package.json +11 -3
- package/dist/commands/BaseCommandBuilder.d.ts +0 -14
- package/dist/commands/FindCommandBuilder.d.ts +0 -23
- package/dist/commands/LsCommandBuilder.d.ts +0 -15
- package/dist/shared/logger/index.d.ts +0 -2
- package/dist/shared/logger/logger.d.ts +0 -17
- package/dist/utils/pagination/outputSizeLimit.d.ts +0 -16
- package/dist/utils/ranking/evidenceRanker.d.ts +0 -86
- package/dist/utils/response/structuredPagination.d.ts +0 -9
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Octocode Query Language (OQL) — canonical type definitions.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the contract in
|
|
5
|
+
* docs/octocode-language/OCTOCODE_QUERY_LANGUAGE.md. OQL is a typed research
|
|
6
|
+
* query object that compiles into existing Octocode tool runners; it is not a
|
|
7
|
+
* raw string DSL. Schemas/descriptions co-locate here for now (tools-core) and
|
|
8
|
+
* may migrate to `@octocodeai/octocode-core/oql` once a second consumer needs
|
|
9
|
+
* OQL validation without the rest of tools-core.
|
|
10
|
+
*/
|
|
11
|
+
export type OqlActiveTarget = 'code' | 'content' | 'structure' | 'files' | 'semantics' | 'repositories' | 'packages' | 'pullRequests' | 'commits' | 'artifacts' | 'diff' | 'research' | 'graph' | 'materialize';
|
|
12
|
+
export type OqlReservedTarget = 'fixes' | 'dataflow';
|
|
13
|
+
export type OqlTarget = OqlActiveTarget | OqlReservedTarget;
|
|
14
|
+
export declare const ACTIVE_TARGETS: readonly OqlActiveTarget[];
|
|
15
|
+
export declare const RESERVED_TARGETS: readonly OqlReservedTarget[];
|
|
16
|
+
/** Targets that do not need a code corpus (provider/registry discovery). */
|
|
17
|
+
export declare const CORPUS_OPTIONAL_TARGETS: readonly OqlActiveTarget[];
|
|
18
|
+
export type PredicateId = string;
|
|
19
|
+
export type QuerySource = {
|
|
20
|
+
kind: 'local';
|
|
21
|
+
path: string;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'github';
|
|
24
|
+
repo?: string;
|
|
25
|
+
owner?: string;
|
|
26
|
+
ref?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'materialized';
|
|
29
|
+
localPath: string;
|
|
30
|
+
source?: QuerySource;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'npm';
|
|
33
|
+
};
|
|
34
|
+
export interface QueryScope {
|
|
35
|
+
path?: string | string[];
|
|
36
|
+
language?: string | string[];
|
|
37
|
+
include?: string[];
|
|
38
|
+
exclude?: string[];
|
|
39
|
+
excludeDir?: string[];
|
|
40
|
+
hidden?: boolean;
|
|
41
|
+
noIgnore?: boolean;
|
|
42
|
+
minDepth?: number;
|
|
43
|
+
maxDepth?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface TextPredicate {
|
|
46
|
+
id?: PredicateId;
|
|
47
|
+
kind: 'text';
|
|
48
|
+
value: string;
|
|
49
|
+
case?: 'smart' | 'sensitive' | 'insensitive';
|
|
50
|
+
wholeWord?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface RegexPredicate {
|
|
53
|
+
id?: PredicateId;
|
|
54
|
+
kind: 'regex';
|
|
55
|
+
value: string;
|
|
56
|
+
dialect?: 'rust' | 'pcre2' | 'provider';
|
|
57
|
+
case?: 'smart' | 'sensitive' | 'insensitive';
|
|
58
|
+
wholeWord?: boolean;
|
|
59
|
+
multiline?: boolean;
|
|
60
|
+
dotAll?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface StructuralRule {
|
|
63
|
+
pattern?: string;
|
|
64
|
+
kind?: string;
|
|
65
|
+
inside?: StructuralRule;
|
|
66
|
+
has?: StructuralRule;
|
|
67
|
+
not?: StructuralRule;
|
|
68
|
+
all?: StructuralRule[];
|
|
69
|
+
any?: StructuralRule[];
|
|
70
|
+
stopBy?: 'end';
|
|
71
|
+
}
|
|
72
|
+
export type StructuralRuleInput = StructuralRule | string;
|
|
73
|
+
export interface StructuralPredicate {
|
|
74
|
+
id?: PredicateId;
|
|
75
|
+
kind: 'structural';
|
|
76
|
+
lang: string;
|
|
77
|
+
pattern?: string;
|
|
78
|
+
rule?: StructuralRuleInput;
|
|
79
|
+
}
|
|
80
|
+
export type FieldName = 'path' | 'basename' | 'extension' | 'size' | 'modified' | 'accessed' | 'empty' | 'permissions' | 'executable' | 'readable' | 'writable' | 'entryType';
|
|
81
|
+
export type FieldOp = '=' | '!=' | 'in' | 'exists' | 'glob' | 'regex' | '>' | '>=' | '<' | '<=' | 'within' | 'before';
|
|
82
|
+
export interface FieldPredicate {
|
|
83
|
+
id?: PredicateId;
|
|
84
|
+
kind: 'field';
|
|
85
|
+
field: FieldName;
|
|
86
|
+
op: FieldOp;
|
|
87
|
+
value?: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface AllPredicate {
|
|
90
|
+
kind: 'all';
|
|
91
|
+
id?: PredicateId;
|
|
92
|
+
of: Predicate[];
|
|
93
|
+
}
|
|
94
|
+
export interface AnyPredicate {
|
|
95
|
+
kind: 'any';
|
|
96
|
+
id?: PredicateId;
|
|
97
|
+
of: Predicate[];
|
|
98
|
+
}
|
|
99
|
+
export interface NotPredicate {
|
|
100
|
+
kind: 'not';
|
|
101
|
+
id?: PredicateId;
|
|
102
|
+
predicate: Predicate;
|
|
103
|
+
}
|
|
104
|
+
export type LeafPredicate = TextPredicate | RegexPredicate | StructuralPredicate | FieldPredicate;
|
|
105
|
+
export type Predicate = AllPredicate | AnyPredicate | NotPredicate | LeafPredicate;
|
|
106
|
+
export interface MaterializePolicy {
|
|
107
|
+
mode: 'never' | 'auto' | 'required';
|
|
108
|
+
strategy?: 'file' | 'tree' | 'subtree' | 'repo';
|
|
109
|
+
allowFullRepo?: boolean;
|
|
110
|
+
forceRefresh?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface FetchInstructions {
|
|
113
|
+
content?: {
|
|
114
|
+
range?: {
|
|
115
|
+
startLine?: number;
|
|
116
|
+
endLine?: number;
|
|
117
|
+
contextLines?: number;
|
|
118
|
+
};
|
|
119
|
+
match?: {
|
|
120
|
+
text: string;
|
|
121
|
+
regex?: boolean;
|
|
122
|
+
caseSensitive?: boolean;
|
|
123
|
+
};
|
|
124
|
+
contentView?: 'exact' | 'compact' | 'symbols';
|
|
125
|
+
charOffset?: number;
|
|
126
|
+
charLength?: number;
|
|
127
|
+
fullContent?: boolean;
|
|
128
|
+
};
|
|
129
|
+
tree?: {
|
|
130
|
+
maxDepth?: number;
|
|
131
|
+
pattern?: string;
|
|
132
|
+
includeSizes?: boolean;
|
|
133
|
+
extensions?: string[];
|
|
134
|
+
filesOnly?: boolean;
|
|
135
|
+
directoriesOnly?: boolean;
|
|
136
|
+
sortBy?: 'name' | 'size' | 'time' | 'extension';
|
|
137
|
+
reverse?: boolean;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export interface QueryControls {
|
|
141
|
+
search?: {
|
|
142
|
+
countLinesPerFile?: boolean;
|
|
143
|
+
countMatchesPerFile?: boolean;
|
|
144
|
+
onlyMatching?: boolean;
|
|
145
|
+
unique?: boolean;
|
|
146
|
+
countUnique?: boolean;
|
|
147
|
+
contextLines?: number;
|
|
148
|
+
invertMatch?: boolean;
|
|
149
|
+
matchWindow?: number;
|
|
150
|
+
matchContentLength?: number;
|
|
151
|
+
maxMatchesPerFile?: number;
|
|
152
|
+
matchPage?: number;
|
|
153
|
+
sort?: 'relevance' | 'matchCount' | 'path' | 'modified' | 'accessed' | 'created';
|
|
154
|
+
sortReverse?: boolean;
|
|
155
|
+
rankingProfile?: string;
|
|
156
|
+
debugRanking?: boolean;
|
|
157
|
+
};
|
|
158
|
+
budget?: {
|
|
159
|
+
maxFiles?: number;
|
|
160
|
+
maxCandidates?: number;
|
|
161
|
+
maxBytes?: number;
|
|
162
|
+
maxMaterializedBytes?: number;
|
|
163
|
+
maxPlanNodes?: number;
|
|
164
|
+
maxBooleanExpansion?: number;
|
|
165
|
+
timeoutMs?: number;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export type SelectField = string;
|
|
169
|
+
export type QueryView = 'discovery' | 'paginated' | 'detailed';
|
|
170
|
+
export interface OqlQuery {
|
|
171
|
+
schema: 'oql';
|
|
172
|
+
id?: string;
|
|
173
|
+
target: OqlActiveTarget;
|
|
174
|
+
from?: QuerySource;
|
|
175
|
+
scope?: QueryScope;
|
|
176
|
+
where?: Predicate;
|
|
177
|
+
materialize?: MaterializePolicy;
|
|
178
|
+
fetch?: FetchInstructions;
|
|
179
|
+
select?: SelectField[];
|
|
180
|
+
view?: QueryView;
|
|
181
|
+
controls?: QueryControls;
|
|
182
|
+
limit?: number;
|
|
183
|
+
page?: number;
|
|
184
|
+
itemsPerPage?: number;
|
|
185
|
+
/**
|
|
186
|
+
* Target-specific parameter bag. The backing tool's schema remains the
|
|
187
|
+
* exhaustive validator; OQL validates the documented common fields early.
|
|
188
|
+
*/
|
|
189
|
+
params?: Record<string, unknown>;
|
|
190
|
+
explain?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface OqlBatch {
|
|
193
|
+
schema: 'oql';
|
|
194
|
+
id?: string;
|
|
195
|
+
queries: OqlQuery[];
|
|
196
|
+
combine?: 'independent' | 'merge';
|
|
197
|
+
limit?: number;
|
|
198
|
+
page?: number;
|
|
199
|
+
itemsPerPage?: number;
|
|
200
|
+
explain?: boolean;
|
|
201
|
+
}
|
|
202
|
+
export type OqlCanonicalInput = OqlQuery | OqlBatch;
|
|
203
|
+
export interface OqlInputQuery {
|
|
204
|
+
schema?: 'oql';
|
|
205
|
+
id?: string;
|
|
206
|
+
target: OqlTarget;
|
|
207
|
+
from?: QuerySource;
|
|
208
|
+
scope?: QueryScope;
|
|
209
|
+
where?: Predicate;
|
|
210
|
+
materialize?: MaterializePolicy | 'never' | 'auto' | 'required';
|
|
211
|
+
fetch?: FetchInstructions;
|
|
212
|
+
select?: SelectField[];
|
|
213
|
+
view?: QueryView;
|
|
214
|
+
controls?: QueryControls;
|
|
215
|
+
limit?: number;
|
|
216
|
+
page?: number;
|
|
217
|
+
itemsPerPage?: number;
|
|
218
|
+
explain?: boolean;
|
|
219
|
+
repo?: string;
|
|
220
|
+
owner?: string;
|
|
221
|
+
ref?: string;
|
|
222
|
+
path?: string | string[];
|
|
223
|
+
text?: string;
|
|
224
|
+
regex?: string;
|
|
225
|
+
pattern?: string;
|
|
226
|
+
rule?: StructuralRule;
|
|
227
|
+
lang?: string;
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
export interface OqlInputBatch {
|
|
231
|
+
schema?: 'oql';
|
|
232
|
+
id?: string;
|
|
233
|
+
queries: OqlInputQuery[];
|
|
234
|
+
combine?: 'independent' | 'merge';
|
|
235
|
+
limit?: number;
|
|
236
|
+
page?: number;
|
|
237
|
+
itemsPerPage?: number;
|
|
238
|
+
explain?: boolean;
|
|
239
|
+
}
|
|
240
|
+
export type OqlSearchInput = OqlInputQuery | OqlInputBatch;
|
|
241
|
+
export type DiagnosticCode = 'invalidQuery' | 'ambiguousSugar' | 'unknownField' | 'unsupportedTarget' | 'unsupportedPredicate' | 'unsupportedBoolean' | 'unsupportedScope' | 'negativeUniverseRequired' | 'residualNotExact' | 'fieldTypeMismatch' | 'requiresMaterialization' | 'vendorNoEquivalent' | 'lossyTransform' | 'unsupportedVendorPredicate' | 'responseShapeMismatch' | 'materializationNotAllowed' | 'materializationFailed' | 'providerUnindexed' | 'providerSemanticsApproximate' | 'partialResult' | 'contentTruncated' | 'matchTruncated' | 'planTruncated' | 'budgetExhausted' | 'parserFailed' | 'partialParse' | 'signatureUnsupported' | 'lspUnavailable' | 'staleCache' | 'sanitized' | 'rateLimited' | 'zeroMatches';
|
|
242
|
+
export interface OqlDiagnostic {
|
|
243
|
+
code: DiagnosticCode;
|
|
244
|
+
severity: 'info' | 'warning' | 'error';
|
|
245
|
+
queryPath?: string;
|
|
246
|
+
predicateId?: string;
|
|
247
|
+
backend?: string;
|
|
248
|
+
message: string;
|
|
249
|
+
blocksAnswer: boolean;
|
|
250
|
+
repair?: {
|
|
251
|
+
message: string;
|
|
252
|
+
suggestedQuery?: OqlSearchInput;
|
|
253
|
+
};
|
|
254
|
+
continuation?: OqlContinuation;
|
|
255
|
+
}
|
|
256
|
+
export type PlanRoute = 'PUSHDOWN' | 'RESIDUAL' | 'ROUTE' | 'UNSUPPORTED';
|
|
257
|
+
export interface OqlPlanNode {
|
|
258
|
+
predicateId: PredicateId;
|
|
259
|
+
path: string;
|
|
260
|
+
route: PlanRoute;
|
|
261
|
+
backend?: string;
|
|
262
|
+
reason: string;
|
|
263
|
+
}
|
|
264
|
+
export interface OqlBackendCall {
|
|
265
|
+
backend: string;
|
|
266
|
+
source?: QuerySource;
|
|
267
|
+
operation: string;
|
|
268
|
+
exact: boolean;
|
|
269
|
+
}
|
|
270
|
+
export interface OqlTransformerTrace {
|
|
271
|
+
id: string;
|
|
272
|
+
status: string;
|
|
273
|
+
sourceKinds: readonly string[];
|
|
274
|
+
target: string;
|
|
275
|
+
backends: readonly Pick<OqlBackendCall, 'backend' | 'operation' | 'exact'>[];
|
|
276
|
+
}
|
|
277
|
+
export interface OqlExplainPlan {
|
|
278
|
+
input: unknown;
|
|
279
|
+
normalized: OqlCanonicalInput;
|
|
280
|
+
defaults: Record<string, unknown>;
|
|
281
|
+
nodes: OqlPlanNode[];
|
|
282
|
+
backendCalls: OqlBackendCall[];
|
|
283
|
+
transformers?: readonly OqlTransformerTrace[];
|
|
284
|
+
materialization?: MaterializePolicy & {
|
|
285
|
+
required: boolean;
|
|
286
|
+
reason: string;
|
|
287
|
+
};
|
|
288
|
+
budgets: QueryControls['budget'];
|
|
289
|
+
truncated?: boolean;
|
|
290
|
+
diagnostics: OqlDiagnostic[];
|
|
291
|
+
next?: Record<string, OqlContinuation>;
|
|
292
|
+
}
|
|
293
|
+
export type OqlProofGrade = 'candidate' | 'text' | 'structural' | 'semantic' | 'graph' | 'missing';
|
|
294
|
+
interface OqlProofGradedRow {
|
|
295
|
+
/**
|
|
296
|
+
* Mandatory on rows emitted by `runOqlSearch`; adapters may omit it while the
|
|
297
|
+
* runner computes the final proof grade from query semantics and row shape.
|
|
298
|
+
*/
|
|
299
|
+
proofGrade?: OqlProofGrade;
|
|
300
|
+
}
|
|
301
|
+
export interface OqlCodeResultRow extends OqlProofGradedRow {
|
|
302
|
+
kind: 'code';
|
|
303
|
+
source?: QuerySource;
|
|
304
|
+
path: string;
|
|
305
|
+
/**
|
|
306
|
+
* 1-based match line. Optional because some providers (GitHub code search)
|
|
307
|
+
* return path-level matches with no line — never fabricate one.
|
|
308
|
+
*/
|
|
309
|
+
line?: number;
|
|
310
|
+
endLine?: number;
|
|
311
|
+
column?: number;
|
|
312
|
+
snippet?: string;
|
|
313
|
+
/** File-level count payloads from local search count modes. */
|
|
314
|
+
totalMatchedLines?: number;
|
|
315
|
+
totalOccurrences?: number;
|
|
316
|
+
/** Provider snippet offsets when available, e.g. GitHub code search indices. */
|
|
317
|
+
matchIndices?: Array<{
|
|
318
|
+
start: number;
|
|
319
|
+
end: number;
|
|
320
|
+
lineOffset?: number;
|
|
321
|
+
}>;
|
|
322
|
+
/** Row-level provider/context metadata that is useful but not identity. */
|
|
323
|
+
metadata?: Record<string, unknown>;
|
|
324
|
+
/**
|
|
325
|
+
* Structural (AST) metavariable captures. `$X` → single-element list; `$$$X`
|
|
326
|
+
* → node list. Keyed by bare metavar name. Present only for structural
|
|
327
|
+
* matches that captured; never fabricated.
|
|
328
|
+
*/
|
|
329
|
+
metavars?: Record<string, string[]>;
|
|
330
|
+
/** Per-capture source ranges (uri+line ready for lspGetSemantics handoff). */
|
|
331
|
+
metavarRanges?: Record<string, {
|
|
332
|
+
text: string;
|
|
333
|
+
line: number;
|
|
334
|
+
column: number;
|
|
335
|
+
endLine: number;
|
|
336
|
+
endColumn: number;
|
|
337
|
+
}[]>;
|
|
338
|
+
/**
|
|
339
|
+
* Executable follow-up continuations. Keys are dotted *domain names*
|
|
340
|
+
* (`next.<domain>`, e.g. `next.fetch`, `next.semantic`, `next.charRange`),
|
|
341
|
+
* NOT nested object paths — the registry in run.ts owns the key set.
|
|
342
|
+
*/
|
|
343
|
+
next?: Record<string, OqlContinuation>;
|
|
344
|
+
}
|
|
345
|
+
export interface OqlFileResultRow extends OqlProofGradedRow {
|
|
346
|
+
kind: 'file';
|
|
347
|
+
source?: QuerySource;
|
|
348
|
+
path: string;
|
|
349
|
+
entryType: 'file' | 'directory';
|
|
350
|
+
size?: number;
|
|
351
|
+
modified?: string;
|
|
352
|
+
next?: Record<string, OqlContinuation>;
|
|
353
|
+
}
|
|
354
|
+
export interface OqlTreeResultRow extends OqlProofGradedRow {
|
|
355
|
+
kind: 'tree';
|
|
356
|
+
source?: QuerySource;
|
|
357
|
+
path: string;
|
|
358
|
+
entryType: 'file' | 'directory';
|
|
359
|
+
depth: number;
|
|
360
|
+
size?: number;
|
|
361
|
+
children?: OqlTreeResultRow[];
|
|
362
|
+
next?: Record<string, OqlContinuation>;
|
|
363
|
+
}
|
|
364
|
+
export interface OqlContentResultRow extends OqlProofGradedRow {
|
|
365
|
+
kind: 'content';
|
|
366
|
+
source?: QuerySource;
|
|
367
|
+
path: string;
|
|
368
|
+
content: string;
|
|
369
|
+
range?: {
|
|
370
|
+
startLine?: number;
|
|
371
|
+
endLine?: number;
|
|
372
|
+
charOffset?: number;
|
|
373
|
+
charLength?: number;
|
|
374
|
+
};
|
|
375
|
+
contentView: 'exact' | 'compact' | 'symbols';
|
|
376
|
+
next?: Record<string, OqlContinuation>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Generic record row for targets whose payload is a typed research object
|
|
380
|
+
* (repository, package, PR, commit, symbol/location, artifact, diff, packet).
|
|
381
|
+
* `recordType` names the family; `data` is the row payload.
|
|
382
|
+
*/
|
|
383
|
+
export interface OqlRecordResultRow extends OqlProofGradedRow {
|
|
384
|
+
kind: 'record';
|
|
385
|
+
recordType: 'semantics' | 'repository' | 'package' | 'pullRequest' | 'commit' | 'artifact' | 'diff' | 'research' | 'graph' | 'materialized';
|
|
386
|
+
/** Stable, citeable identity (repo, name@version, #PR, SHA, path, uri). */
|
|
387
|
+
id?: string;
|
|
388
|
+
source?: QuerySource;
|
|
389
|
+
/** Parent/query metadata preserved from the backing tool payload. */
|
|
390
|
+
metadata?: Record<string, unknown>;
|
|
391
|
+
data: Record<string, unknown>;
|
|
392
|
+
next?: Record<string, OqlContinuation>;
|
|
393
|
+
}
|
|
394
|
+
export interface OqlRepositoryData {
|
|
395
|
+
fullName?: string;
|
|
396
|
+
owner?: string;
|
|
397
|
+
repo?: string;
|
|
398
|
+
description?: string;
|
|
399
|
+
stars?: number;
|
|
400
|
+
forks?: number;
|
|
401
|
+
language?: string;
|
|
402
|
+
topics?: string[];
|
|
403
|
+
pushedAt?: string;
|
|
404
|
+
url?: string;
|
|
405
|
+
[k: string]: unknown;
|
|
406
|
+
}
|
|
407
|
+
export interface OqlPackageData {
|
|
408
|
+
name?: string;
|
|
409
|
+
version?: string;
|
|
410
|
+
description?: string;
|
|
411
|
+
downloads?: number;
|
|
412
|
+
repository?: string;
|
|
413
|
+
[k: string]: unknown;
|
|
414
|
+
}
|
|
415
|
+
export interface OqlPullRequestData {
|
|
416
|
+
number?: number;
|
|
417
|
+
title?: string;
|
|
418
|
+
state?: string;
|
|
419
|
+
author?: string;
|
|
420
|
+
createdAt?: string;
|
|
421
|
+
mergedAt?: string;
|
|
422
|
+
changedFiles?: number;
|
|
423
|
+
url?: string;
|
|
424
|
+
[k: string]: unknown;
|
|
425
|
+
}
|
|
426
|
+
export interface OqlCommitData {
|
|
427
|
+
sha?: string;
|
|
428
|
+
oid?: string;
|
|
429
|
+
message?: string;
|
|
430
|
+
title?: string;
|
|
431
|
+
author?: string;
|
|
432
|
+
date?: string;
|
|
433
|
+
[k: string]: unknown;
|
|
434
|
+
}
|
|
435
|
+
export interface OqlArtifactData {
|
|
436
|
+
mode?: string;
|
|
437
|
+
format?: string;
|
|
438
|
+
/** Set when extract/decompress/unpack produced a derived local path. */
|
|
439
|
+
localPath?: string;
|
|
440
|
+
entries?: unknown[];
|
|
441
|
+
strings?: unknown[];
|
|
442
|
+
symbols?: unknown[];
|
|
443
|
+
nextScanOffset?: number;
|
|
444
|
+
[k: string]: unknown;
|
|
445
|
+
}
|
|
446
|
+
export interface OqlDiffData {
|
|
447
|
+
path?: string;
|
|
448
|
+
baseRef?: string;
|
|
449
|
+
headRef?: string;
|
|
450
|
+
additions?: number;
|
|
451
|
+
deletions?: number;
|
|
452
|
+
unchanged?: number;
|
|
453
|
+
patch?: string;
|
|
454
|
+
[k: string]: unknown;
|
|
455
|
+
}
|
|
456
|
+
export interface OqlSemanticsData {
|
|
457
|
+
uri?: string;
|
|
458
|
+
line?: number;
|
|
459
|
+
startLine?: number;
|
|
460
|
+
symbol?: string;
|
|
461
|
+
kind?: string;
|
|
462
|
+
[k: string]: unknown;
|
|
463
|
+
}
|
|
464
|
+
export interface OqlMaterializedData {
|
|
465
|
+
localPath: string;
|
|
466
|
+
repoRoot?: string;
|
|
467
|
+
ref?: string;
|
|
468
|
+
cache?: 'hit' | 'miss';
|
|
469
|
+
complete?: boolean;
|
|
470
|
+
[k: string]: unknown;
|
|
471
|
+
}
|
|
472
|
+
export interface OqlResearchData {
|
|
473
|
+
kind?: 'researchFlow';
|
|
474
|
+
goal?: string;
|
|
475
|
+
intent?: string;
|
|
476
|
+
facets?: readonly string[];
|
|
477
|
+
mode?: 'plan' | 'analyze' | 'prove';
|
|
478
|
+
summary?: Record<string, unknown>;
|
|
479
|
+
flow?: readonly unknown[];
|
|
480
|
+
nativeGraphSummary?: Record<string, unknown>;
|
|
481
|
+
graphSummary?: Record<string, unknown>;
|
|
482
|
+
packetPage?: Pagination;
|
|
483
|
+
packets?: unknown[];
|
|
484
|
+
/** Present only in detailed view — a windowed slice (see `manifestsPage`). */
|
|
485
|
+
manifests?: unknown[];
|
|
486
|
+
manifestsPage?: Pagination;
|
|
487
|
+
/** Present only in detailed view — a windowed slice (see `filesPage`). */
|
|
488
|
+
files?: unknown[];
|
|
489
|
+
filesPage?: Pagination;
|
|
490
|
+
/** Present only in detailed view — a windowed slice (see `dependenciesPage`). */
|
|
491
|
+
dependencies?: unknown[];
|
|
492
|
+
dependenciesPage?: Pagination;
|
|
493
|
+
/** Present only in detailed view — a windowed slice (see `symbolsPage`). */
|
|
494
|
+
symbols?: unknown[];
|
|
495
|
+
symbolsPage?: Pagination;
|
|
496
|
+
/** Present only in detailed view — a windowed slice (see `graphFactsPage`). */
|
|
497
|
+
graphFacts?: unknown[];
|
|
498
|
+
graphFactsPage?: Pagination;
|
|
499
|
+
caveats?: string[];
|
|
500
|
+
[k: string]: unknown;
|
|
501
|
+
}
|
|
502
|
+
export interface OqlGraphData {
|
|
503
|
+
kind?: 'relationshipGraph';
|
|
504
|
+
goal?: string;
|
|
505
|
+
intent?: string;
|
|
506
|
+
facets?: readonly string[];
|
|
507
|
+
mode?: 'plan' | 'analyze' | 'prove';
|
|
508
|
+
root?: string;
|
|
509
|
+
filters?: Record<string, unknown>;
|
|
510
|
+
summary?: Record<string, unknown>;
|
|
511
|
+
flow?: readonly unknown[];
|
|
512
|
+
nativeGraphSummary?: Record<string, unknown>;
|
|
513
|
+
graphSummary?: unknown;
|
|
514
|
+
packetPage?: Pagination;
|
|
515
|
+
nodes?: unknown[];
|
|
516
|
+
edges?: unknown[];
|
|
517
|
+
facts?: unknown[];
|
|
518
|
+
packets?: unknown[];
|
|
519
|
+
missingProof?: unknown[];
|
|
520
|
+
caveats?: string[];
|
|
521
|
+
[k: string]: unknown;
|
|
522
|
+
}
|
|
523
|
+
/** Typed row aliases — a record row whose `data` matches its `recordType`. */
|
|
524
|
+
export type OqlRepositoryRow = OqlRecordResultRow & {
|
|
525
|
+
recordType: 'repository';
|
|
526
|
+
data: OqlRepositoryData;
|
|
527
|
+
};
|
|
528
|
+
export type OqlPackageRow = OqlRecordResultRow & {
|
|
529
|
+
recordType: 'package';
|
|
530
|
+
data: OqlPackageData;
|
|
531
|
+
};
|
|
532
|
+
export type OqlPullRequestRow = OqlRecordResultRow & {
|
|
533
|
+
recordType: 'pullRequest';
|
|
534
|
+
data: OqlPullRequestData;
|
|
535
|
+
};
|
|
536
|
+
export type OqlCommitRow = OqlRecordResultRow & {
|
|
537
|
+
recordType: 'commit';
|
|
538
|
+
data: OqlCommitData;
|
|
539
|
+
};
|
|
540
|
+
export type OqlArtifactRow = OqlRecordResultRow & {
|
|
541
|
+
recordType: 'artifact';
|
|
542
|
+
data: OqlArtifactData;
|
|
543
|
+
};
|
|
544
|
+
export type OqlDiffRow = OqlRecordResultRow & {
|
|
545
|
+
recordType: 'diff';
|
|
546
|
+
data: OqlDiffData;
|
|
547
|
+
};
|
|
548
|
+
export type OqlSemanticsRow = OqlRecordResultRow & {
|
|
549
|
+
recordType: 'semantics';
|
|
550
|
+
data: OqlSemanticsData;
|
|
551
|
+
};
|
|
552
|
+
export type OqlMaterializedRow = OqlRecordResultRow & {
|
|
553
|
+
recordType: 'materialized';
|
|
554
|
+
data: OqlMaterializedData;
|
|
555
|
+
};
|
|
556
|
+
export type OqlResearchRow = OqlRecordResultRow & {
|
|
557
|
+
recordType: 'research';
|
|
558
|
+
data: OqlResearchData;
|
|
559
|
+
};
|
|
560
|
+
export type OqlGraphRow = OqlRecordResultRow & {
|
|
561
|
+
recordType: 'graph';
|
|
562
|
+
data: OqlGraphData;
|
|
563
|
+
};
|
|
564
|
+
export type OqlResultRow = OqlCodeResultRow | OqlFileResultRow | OqlTreeResultRow | OqlContentResultRow | OqlRecordResultRow;
|
|
565
|
+
export type OqlProofGradedResultRow = OqlResultRow & {
|
|
566
|
+
proofGrade: OqlProofGrade;
|
|
567
|
+
};
|
|
568
|
+
export interface Pagination {
|
|
569
|
+
currentPage?: number;
|
|
570
|
+
totalPages?: number;
|
|
571
|
+
nextPage?: number;
|
|
572
|
+
itemsPerPage?: number;
|
|
573
|
+
totalItems?: number;
|
|
574
|
+
reportedTotalItems?: number;
|
|
575
|
+
reachableTotalItems?: number;
|
|
576
|
+
totalItemsKind?: string;
|
|
577
|
+
itemUnit?: string;
|
|
578
|
+
rowCount?: number;
|
|
579
|
+
reportedRowCount?: number;
|
|
580
|
+
totalItemsCapped?: boolean;
|
|
581
|
+
uniqueFileCount?: number;
|
|
582
|
+
hasMore: boolean;
|
|
583
|
+
next?: OqlContinuation;
|
|
584
|
+
}
|
|
585
|
+
export interface OqlProvenance {
|
|
586
|
+
backend: string;
|
|
587
|
+
source?: QuerySource;
|
|
588
|
+
predicateIds?: string[];
|
|
589
|
+
pushed?: string[];
|
|
590
|
+
residual?: string[];
|
|
591
|
+
routed?: string[];
|
|
592
|
+
materializedPath?: string;
|
|
593
|
+
cache?: 'hit' | 'miss' | 'refresh' | 'stale';
|
|
594
|
+
}
|
|
595
|
+
export interface OqlContinuation {
|
|
596
|
+
query: OqlCanonicalInput;
|
|
597
|
+
baseQueryId?: string;
|
|
598
|
+
queryIndex?: number;
|
|
599
|
+
why: string;
|
|
600
|
+
confidence: 'exact' | 'heuristic';
|
|
601
|
+
}
|
|
602
|
+
export type EvidenceKind = 'proof' | 'partial' | 'candidate' | 'unsupported';
|
|
603
|
+
export interface OqlResultEnvelope {
|
|
604
|
+
queryId?: string;
|
|
605
|
+
queryIndex?: number;
|
|
606
|
+
results: OqlProofGradedResultRow[];
|
|
607
|
+
pagination?: Pagination;
|
|
608
|
+
next?: Record<string, OqlContinuation>;
|
|
609
|
+
diagnostics: OqlDiagnostic[];
|
|
610
|
+
provenance: OqlProvenance[];
|
|
611
|
+
evidence: {
|
|
612
|
+
answerReady: boolean;
|
|
613
|
+
complete: boolean;
|
|
614
|
+
kind: EvidenceKind;
|
|
615
|
+
};
|
|
616
|
+
plan?: OqlExplainPlan;
|
|
617
|
+
}
|
|
618
|
+
export interface OqlBatchResultEnvelope {
|
|
619
|
+
batchId?: string;
|
|
620
|
+
mode: 'independent' | 'merge';
|
|
621
|
+
children: Array<{
|
|
622
|
+
queryId: string;
|
|
623
|
+
queryIndex: number;
|
|
624
|
+
envelope: OqlResultEnvelope;
|
|
625
|
+
}>;
|
|
626
|
+
merged?: OqlResultEnvelope;
|
|
627
|
+
diagnostics: OqlDiagnostic[];
|
|
628
|
+
}
|
|
629
|
+
export type OqlRunResult = OqlResultEnvelope | OqlBatchResultEnvelope;
|
|
630
|
+
export declare function isBatchInput(input: OqlSearchInput): input is OqlInputBatch;
|
|
631
|
+
export declare function isCanonicalBatch(input: OqlCanonicalInput): input is OqlBatch;
|
|
632
|
+
export declare function isBatchEnvelope(result: OqlRunResult): result is OqlBatchResultEnvelope;
|
|
633
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed V2-target `params` schemas.
|
|
3
|
+
*
|
|
4
|
+
* V2 research targets (semantics/repositories/packages/pullRequests/commits/
|
|
5
|
+
* artifacts/diff/research) carry a `params` bag that the backing tool validates
|
|
6
|
+
* exhaustively. These schemas type the *documented, commonly-used* fields so a
|
|
7
|
+
* type mistake (e.g. `prNumber:"abc"`) is caught at the OQL layer with a clear
|
|
8
|
+
* `invalidQuery` instead of failing opaquely at the tool — while `.passthrough()`
|
|
9
|
+
* keeps the backing tool the exhaustive source of truth for the rest.
|
|
10
|
+
*
|
|
11
|
+
* This is the typed-contract layer for OCTOCODE_SEARCH_PARITY_CHECKLIST gap #3.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import type { OqlActiveTarget } from './types.js';
|
|
15
|
+
/** Per-target params schema; targets without a `params` bag are absent. */
|
|
16
|
+
export declare const V2_PARAM_SCHEMAS: Partial<Record<OqlActiveTarget, z.ZodTypeAny>>;
|
|
17
|
+
/**
|
|
18
|
+
* Validate a target's `params` bag against its typed schema. Returns `null` when
|
|
19
|
+
* valid (or no schema applies), or a Zod-style error message string the caller
|
|
20
|
+
* raises as `invalidQuery`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateV2Params(target: OqlActiveTarget, params: unknown): string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
2
2
|
export type { CodeSearchQuery, FileContentQuery, RepoSearchQuery, PullRequestQuery, RepoStructureQuery, } from './providerQueries.js';
|
|
3
|
-
export type { UnifiedRepository, CodeSearchItem, CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestItem, PullRequestSearchResult,
|
|
3
|
+
export type { UnifiedRepository, CodeSearchItem, CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestItem, PullRequestSearchResult, RepoStructureResult, } from './providerResults.js';
|
|
4
4
|
import type { CodeSearchQuery, FileContentQuery, RepoSearchQuery, PullRequestQuery, RepoStructureQuery } from './providerQueries.js';
|
|
5
5
|
import type { CodeSearchResult, FileContentResult, RepoSearchResult, PullRequestSearchResult, RepoStructureResult } from './providerResults.js';
|
|
6
6
|
export type ProviderType = 'github';
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@octocodeai/octocode-tools-core/schema` — the engine-FREE direct-tool schema
|
|
3
|
+
* surface (P3). Re-exports only the metadata/schema-text/display/input-prep API
|
|
4
|
+
* from `directToolCatalog.meta.ts`, with NO transitive `@octocodeai/octocode-engine`
|
|
5
|
+
* import. Importing this never loads the native `.node` addon, so consumers that
|
|
6
|
+
* only need `--scheme` / help / `context` (e.g. the CLI on engine-less runtimes
|
|
7
|
+
* like Codex.app Node) can read schemas without the engine.
|
|
8
|
+
*
|
|
9
|
+
* For execution, import `executeDirectTool` from `@octocodeai/octocode-tools-core/direct`.
|
|
10
|
+
*/
|
|
11
|
+
export * from './tools/directToolCatalog.meta.js';
|
|
12
|
+
export { oqlSchemaText, OQL_SCHEMA_DOC } from './oql/schemeText.js';
|
|
13
|
+
export { loadToolContent } from './tools/toolMetadata/state.js';
|