@gmickel/gno 1.22.0 → 1.23.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 +16 -1
- package/assets/skill/SKILL.md +15 -0
- package/package.json +1 -1
- package/spec/cli.md +36 -20
- package/spec/evals-agentic.md +35 -0
- package/spec/evals.md +6 -0
- package/spec/mcp.md +18 -0
- package/spec/output-schemas/query-diagnose-v1.schema.json +123 -0
- package/spec/output-schemas/query-diagnose.schema.json +89 -2
- package/src/app/context-runtime-types.ts +3 -0
- package/src/app/context-runtime.ts +1 -0
- package/src/app/context-surface.ts +4 -2
- package/src/cli/commands/ask.ts +31 -20
- package/src/cli/commands/context-build.ts +17 -7
- package/src/cli/commands/query.ts +58 -37
- package/src/cli/commands/search.ts +29 -19
- package/src/cli/commands/vsearch.ts +31 -22
- package/src/cli/options.ts +39 -0
- package/src/cli/program.ts +48 -0
- package/src/config/defaults.ts +10 -1
- package/src/config/types.ts +71 -0
- package/src/core/project-affinity-surface.ts +114 -0
- package/src/core/project-affinity.ts +330 -0
- package/src/core/validation.ts +20 -1
- package/src/mcp/tools/ask.ts +10 -1
- package/src/mcp/tools/context.ts +18 -0
- package/src/mcp/tools/index.ts +13 -2
- package/src/mcp/tools/query.ts +12 -0
- package/src/mcp/tools/search.ts +7 -0
- package/src/mcp/tools/vsearch.ts +7 -0
- package/src/pipeline/diagnose.ts +48 -3
- package/src/pipeline/explain.ts +54 -13
- package/src/pipeline/hybrid.ts +100 -59
- package/src/pipeline/project-affinity.ts +162 -0
- package/src/pipeline/search.ts +76 -10
- package/src/pipeline/types.ts +9 -0
- package/src/pipeline/vsearch.ts +117 -91
- package/src/sdk/client.ts +80 -20
- package/src/sdk/index.ts +2 -0
- package/src/sdk/types.ts +20 -7
- package/src/serve/context-capsule.ts +18 -1
- package/src/serve/routes/api.ts +69 -0
package/src/serve/routes/api.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
ModelPreset,
|
|
18
18
|
} from "../../config/types";
|
|
19
19
|
import type { JobManager } from "../../core/job-manager";
|
|
20
|
+
import type { ProjectAffinityScoringInput } from "../../pipeline/project-affinity";
|
|
20
21
|
import type {
|
|
21
22
|
AskResult,
|
|
22
23
|
Citation,
|
|
@@ -95,6 +96,10 @@ import {
|
|
|
95
96
|
resolveNotePreset,
|
|
96
97
|
type NotePresetId,
|
|
97
98
|
} from "../../core/note-presets";
|
|
99
|
+
import {
|
|
100
|
+
ProjectAffinityInputError,
|
|
101
|
+
resolveRemoteProjectAffinity,
|
|
102
|
+
} from "../../core/project-affinity-surface";
|
|
98
103
|
import {
|
|
99
104
|
retrievalTraceFilters,
|
|
100
105
|
startRetrievalTraceRequest,
|
|
@@ -231,6 +236,7 @@ const DEFAULT_CONNECTOR_ROUTE_DEPS: ConnectorRouteDeps = {
|
|
|
231
236
|
|
|
232
237
|
export interface SearchRequestBody {
|
|
233
238
|
query: string;
|
|
239
|
+
projectHints?: string[];
|
|
234
240
|
// Only BM25 supported in web UI (vector/hybrid require LLM deps)
|
|
235
241
|
limit?: number;
|
|
236
242
|
minScore?: number;
|
|
@@ -250,6 +256,7 @@ export interface SearchRequestBody {
|
|
|
250
256
|
|
|
251
257
|
export interface QueryRequestBody {
|
|
252
258
|
query: string;
|
|
259
|
+
projectHints?: string[];
|
|
253
260
|
limit?: number;
|
|
254
261
|
minScore?: number;
|
|
255
262
|
collection?: string;
|
|
@@ -279,6 +286,7 @@ export interface QueryDiagnoseRequestBody extends QueryRequestBody {
|
|
|
279
286
|
|
|
280
287
|
export interface AskRequestBody {
|
|
281
288
|
query: string;
|
|
289
|
+
projectHints?: string[];
|
|
282
290
|
limit?: number;
|
|
283
291
|
collection?: string;
|
|
284
292
|
lang?: string;
|
|
@@ -308,6 +316,7 @@ export interface AskRequestBody {
|
|
|
308
316
|
|
|
309
317
|
const ASK_REQUEST_KEYS = new Set<keyof AskRequestBody>([
|
|
310
318
|
"query",
|
|
319
|
+
"projectHints",
|
|
311
320
|
"limit",
|
|
312
321
|
"collection",
|
|
313
322
|
"lang",
|
|
@@ -3630,6 +3639,19 @@ export async function handleSearch(
|
|
|
3630
3639
|
? parseCommaSeparatedValues(body.exclude)
|
|
3631
3640
|
: undefined;
|
|
3632
3641
|
const author = body.author?.trim() || undefined;
|
|
3642
|
+
let projectAffinity: ProjectAffinityScoringInput | undefined;
|
|
3643
|
+
try {
|
|
3644
|
+
projectAffinity = context
|
|
3645
|
+
? await resolveRemoteProjectAffinity(context.config, body.projectHints)
|
|
3646
|
+
: undefined;
|
|
3647
|
+
} catch (error) {
|
|
3648
|
+
return errorResponse(
|
|
3649
|
+
"VALIDATION",
|
|
3650
|
+
error instanceof ProjectAffinityInputError
|
|
3651
|
+
? error.message
|
|
3652
|
+
: "Invalid project hints"
|
|
3653
|
+
);
|
|
3654
|
+
}
|
|
3633
3655
|
|
|
3634
3656
|
// Only BM25 supported in web UI (vector/hybrid require LLM ports)
|
|
3635
3657
|
const options: SearchOptions = {
|
|
@@ -3644,6 +3666,7 @@ export async function handleSearch(
|
|
|
3644
3666
|
until: body.until,
|
|
3645
3667
|
categories,
|
|
3646
3668
|
author,
|
|
3669
|
+
projectAffinity,
|
|
3647
3670
|
};
|
|
3648
3671
|
|
|
3649
3672
|
const trace = context
|
|
@@ -3802,6 +3825,20 @@ export async function handleQuery(
|
|
|
3802
3825
|
? parseCommaSeparatedValues(body.exclude)
|
|
3803
3826
|
: undefined;
|
|
3804
3827
|
const author = body.author?.trim() || undefined;
|
|
3828
|
+
let projectAffinity: ProjectAffinityScoringInput | undefined;
|
|
3829
|
+
try {
|
|
3830
|
+
projectAffinity = await resolveRemoteProjectAffinity(
|
|
3831
|
+
ctx.config,
|
|
3832
|
+
body.projectHints
|
|
3833
|
+
);
|
|
3834
|
+
} catch (error) {
|
|
3835
|
+
return errorResponse(
|
|
3836
|
+
"VALIDATION",
|
|
3837
|
+
error instanceof ProjectAffinityInputError
|
|
3838
|
+
? error.message
|
|
3839
|
+
: "Invalid project hints"
|
|
3840
|
+
);
|
|
3841
|
+
}
|
|
3805
3842
|
|
|
3806
3843
|
const queryOptions = {
|
|
3807
3844
|
limit: Math.min(body.limit ?? 20, 50),
|
|
@@ -3825,6 +3862,7 @@ export async function handleQuery(
|
|
|
3825
3862
|
until: body.until,
|
|
3826
3863
|
categories,
|
|
3827
3864
|
author,
|
|
3865
|
+
projectAffinity,
|
|
3828
3866
|
};
|
|
3829
3867
|
const trace = await startRestTrace(ctx, {
|
|
3830
3868
|
query: normalizedQuery,
|
|
@@ -4004,6 +4042,20 @@ export async function handleQueryDiagnose(
|
|
|
4004
4042
|
const contentTypeRules = normalizeContentTypes(
|
|
4005
4043
|
ctx.config.contentTypes ?? []
|
|
4006
4044
|
).rules;
|
|
4045
|
+
let projectAffinity: ProjectAffinityScoringInput | undefined;
|
|
4046
|
+
try {
|
|
4047
|
+
projectAffinity = await resolveRemoteProjectAffinity(
|
|
4048
|
+
ctx.config,
|
|
4049
|
+
body.projectHints
|
|
4050
|
+
);
|
|
4051
|
+
} catch (error) {
|
|
4052
|
+
return errorResponse(
|
|
4053
|
+
"VALIDATION",
|
|
4054
|
+
error instanceof ProjectAffinityInputError
|
|
4055
|
+
? error.message
|
|
4056
|
+
: "Invalid project hints"
|
|
4057
|
+
);
|
|
4058
|
+
}
|
|
4007
4059
|
|
|
4008
4060
|
const result = await diagnoseQueryTarget(
|
|
4009
4061
|
{
|
|
@@ -4038,6 +4090,7 @@ export async function handleQueryDiagnose(
|
|
|
4038
4090
|
until: body.until,
|
|
4039
4091
|
categories,
|
|
4040
4092
|
author,
|
|
4093
|
+
projectAffinity,
|
|
4041
4094
|
contentTypeRules,
|
|
4042
4095
|
contentTypeRulesFingerprint:
|
|
4043
4096
|
fingerprintContentTypeRules(contentTypeRules),
|
|
@@ -4229,6 +4282,20 @@ export async function handleAsk(
|
|
|
4229
4282
|
? parseCommaSeparatedValues(body.exclude)
|
|
4230
4283
|
: undefined;
|
|
4231
4284
|
const author = body.author?.trim() || undefined;
|
|
4285
|
+
let projectAffinity: ProjectAffinityScoringInput | undefined;
|
|
4286
|
+
try {
|
|
4287
|
+
projectAffinity = await resolveRemoteProjectAffinity(
|
|
4288
|
+
ctx.config,
|
|
4289
|
+
body.projectHints
|
|
4290
|
+
);
|
|
4291
|
+
} catch (error) {
|
|
4292
|
+
return errorResponse(
|
|
4293
|
+
"VALIDATION",
|
|
4294
|
+
error instanceof ProjectAffinityInputError
|
|
4295
|
+
? error.message
|
|
4296
|
+
: "Invalid project hints"
|
|
4297
|
+
);
|
|
4298
|
+
}
|
|
4232
4299
|
|
|
4233
4300
|
const limit = Math.min(body.limit ?? 5, 20);
|
|
4234
4301
|
const askOptions = {
|
|
@@ -4257,6 +4324,7 @@ export async function handleAsk(
|
|
|
4257
4324
|
contextBudgetTokens: body.contextBudgetTokens,
|
|
4258
4325
|
contextBudgetBytes: body.contextBudgetBytes,
|
|
4259
4326
|
maxAnswerTokens: body.maxAnswerTokens,
|
|
4327
|
+
projectAffinity,
|
|
4260
4328
|
};
|
|
4261
4329
|
const trace = await startRestTrace(ctx, {
|
|
4262
4330
|
query: normalizedQuery,
|
|
@@ -4307,6 +4375,7 @@ export async function handleAsk(
|
|
|
4307
4375
|
embedPort: ctx.embedPort,
|
|
4308
4376
|
rerankPort: ctx.rerankPort,
|
|
4309
4377
|
genPort: ctx.answerPort,
|
|
4378
|
+
projectAffinity,
|
|
4310
4379
|
traceSession: trace.session ?? undefined,
|
|
4311
4380
|
});
|
|
4312
4381
|
return finishRestTrace(
|