@gmickel/gno 1.18.0 → 1.20.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.
Files changed (153) hide show
  1. package/README.md +14 -7
  2. package/assets/skill/SKILL.md +54 -12
  3. package/assets/skill/mcp-reference.md +7 -2
  4. package/assets/skill/recipes/citation-and-provenance.md +32 -9
  5. package/package.json +2 -1
  6. package/spec/AGENTS.md +83 -0
  7. package/spec/CLAUDE.md +83 -0
  8. package/spec/bench-fixture.schema.json +137 -0
  9. package/spec/cli.md +2919 -0
  10. package/spec/db/schema.sql +442 -0
  11. package/spec/evals-agentic.md +592 -0
  12. package/spec/evals.md +1106 -0
  13. package/spec/mcp.md +2279 -0
  14. package/spec/output-schemas/activation-verification.schema.json +515 -0
  15. package/spec/output-schemas/ask.schema.json +564 -0
  16. package/spec/output-schemas/backlinks.schema.json +131 -0
  17. package/spec/output-schemas/bench-result.schema.json +120 -0
  18. package/spec/output-schemas/capture-receipt.schema.json +143 -0
  19. package/spec/output-schemas/claim-verification.schema.json +291 -0
  20. package/spec/output-schemas/collection-list.schema.json +45 -0
  21. package/spec/output-schemas/context-capsule-v1.schema.json +726 -0
  22. package/spec/output-schemas/context-capsule-verification.schema.json +1338 -0
  23. package/spec/output-schemas/context-list.schema.json +21 -0
  24. package/spec/output-schemas/doctor.schema.json +313 -0
  25. package/spec/output-schemas/error.schema.json +30 -0
  26. package/spec/output-schemas/expansion.schema.json +37 -0
  27. package/spec/output-schemas/get.schema.json +140 -0
  28. package/spec/output-schemas/graph-query.schema.json +99 -0
  29. package/spec/output-schemas/graph.schema.json +371 -0
  30. package/spec/output-schemas/links-list.schema.json +186 -0
  31. package/spec/output-schemas/mcp-add-collection-result.schema.json +23 -0
  32. package/spec/output-schemas/mcp-capture-result.schema.json +152 -0
  33. package/spec/output-schemas/mcp-http-error.schema.json +30 -0
  34. package/spec/output-schemas/mcp-job-list.schema.json +58 -0
  35. package/spec/output-schemas/mcp-job-status.schema.json +224 -0
  36. package/spec/output-schemas/mcp-remove-result.schema.json +39 -0
  37. package/spec/output-schemas/mcp-sync-result.schema.json +41 -0
  38. package/spec/output-schemas/mcp-tag-result.schema.json +33 -0
  39. package/spec/output-schemas/models-list.schema.json +93 -0
  40. package/spec/output-schemas/multi-get.schema.json +103 -0
  41. package/spec/output-schemas/process-status.schema.json +119 -0
  42. package/spec/output-schemas/query-diagnose.schema.json +123 -0
  43. package/spec/output-schemas/resident-status.schema.json +154 -0
  44. package/spec/output-schemas/retrieval-trace-common.schema.json +492 -0
  45. package/spec/output-schemas/retrieval-trace-delete.schema.json +16 -0
  46. package/spec/output-schemas/retrieval-trace-export.schema.json +61 -0
  47. package/spec/output-schemas/retrieval-trace-filters.schema.json +139 -0
  48. package/spec/output-schemas/retrieval-trace-judgment.schema.json +15 -0
  49. package/spec/output-schemas/retrieval-trace-list.schema.json +18 -0
  50. package/spec/output-schemas/retrieval-trace-payloads.schema.json +178 -0
  51. package/spec/output-schemas/retrieval-trace-purge.schema.json +31 -0
  52. package/spec/output-schemas/retrieval-trace-qrels.schema.json +303 -0
  53. package/spec/output-schemas/retrieval-trace-replay.schema.json +286 -0
  54. package/spec/output-schemas/retrieval-trace-show.schema.json +69 -0
  55. package/spec/output-schemas/retrieval-trace-summary.schema.json +65 -0
  56. package/spec/output-schemas/search-result.schema.json +154 -0
  57. package/spec/output-schemas/search-results.schema.json +338 -0
  58. package/spec/output-schemas/similar.schema.json +84 -0
  59. package/spec/output-schemas/status.schema.json +676 -0
  60. package/spec/output-schemas/tags-list.schema.json +48 -0
  61. package/src/app/context-runtime-contract.ts +10 -5
  62. package/src/app/context-runtime-input.ts +29 -1
  63. package/src/app/context-runtime-types.ts +7 -0
  64. package/src/app/context-runtime.ts +20 -2
  65. package/src/app/context-surface.ts +4 -0
  66. package/src/app/verified-ask.ts +291 -0
  67. package/src/cli/commands/ask-format.ts +255 -0
  68. package/src/cli/commands/ask.ts +144 -183
  69. package/src/cli/commands/context-build.ts +56 -9
  70. package/src/cli/commands/get.ts +64 -3
  71. package/src/cli/commands/query.ts +62 -23
  72. package/src/cli/commands/replay.ts +140 -0
  73. package/src/cli/commands/search.ts +48 -3
  74. package/src/cli/commands/shared.ts +3 -1
  75. package/src/cli/commands/trace.ts +200 -0
  76. package/src/cli/commands/vsearch.ts +75 -53
  77. package/src/cli/program.ts +287 -1
  78. package/src/config/index.ts +9 -0
  79. package/src/config/retrieval-traces.ts +56 -0
  80. package/src/config/types.ts +4 -0
  81. package/src/core/context-budget.ts +6 -0
  82. package/src/core/context-capsule-retrieval-schema.ts +4 -0
  83. package/src/core/context-capsule-schema.ts +17 -0
  84. package/src/core/context-capsule-validation.ts +3 -2
  85. package/src/core/context-capsule.ts +18 -0
  86. package/src/core/context-compiler.ts +44 -25
  87. package/src/core/context-evidence.ts +6 -0
  88. package/src/core/retrieval-qrels.ts +405 -0
  89. package/src/core/retrieval-replay-candidate.ts +368 -0
  90. package/src/core/retrieval-replay-types.ts +109 -0
  91. package/src/core/retrieval-replay-validation.ts +89 -0
  92. package/src/core/retrieval-replay.ts +441 -0
  93. package/src/core/retrieval-trace-evidence-origin.ts +178 -0
  94. package/src/core/retrieval-trace-export.ts +113 -0
  95. package/src/core/retrieval-trace-filter-normalization.ts +27 -0
  96. package/src/core/retrieval-trace-filters.ts +19 -0
  97. package/src/core/retrieval-trace-management-helpers.ts +247 -0
  98. package/src/core/retrieval-trace-management-types.ts +132 -0
  99. package/src/core/retrieval-trace-management.ts +422 -0
  100. package/src/core/retrieval-trace-request.ts +141 -0
  101. package/src/core/retrieval-trace-session.ts +507 -0
  102. package/src/core/retrieval-trace.ts +472 -0
  103. package/src/llm/errors.ts +10 -1
  104. package/src/llm/httpGeneration.ts +11 -1
  105. package/src/llm/nodeLlamaCpp/generation.ts +54 -10
  106. package/src/llm/types.ts +6 -0
  107. package/src/mcp/tools/ask.ts +228 -0
  108. package/src/mcp/tools/context.ts +87 -15
  109. package/src/mcp/tools/get.ts +35 -1
  110. package/src/mcp/tools/index.ts +83 -0
  111. package/src/mcp/tools/query.ts +95 -64
  112. package/src/mcp/tools/search.ts +36 -13
  113. package/src/mcp/tools/trace.ts +143 -0
  114. package/src/mcp/tools/vsearch.ts +71 -38
  115. package/src/pipeline/answer.ts +167 -26
  116. package/src/pipeline/claim-verification-schema.ts +235 -0
  117. package/src/pipeline/claim-verification.ts +487 -0
  118. package/src/pipeline/claim-verifier.ts +474 -0
  119. package/src/pipeline/graph-retrieval.ts +15 -1
  120. package/src/pipeline/hybrid.ts +151 -43
  121. package/src/pipeline/search.ts +36 -3
  122. package/src/pipeline/trace-metadata.ts +47 -0
  123. package/src/pipeline/types.ts +68 -0
  124. package/src/pipeline/vsearch.ts +101 -38
  125. package/src/sdk/client.ts +415 -73
  126. package/src/sdk/documents.ts +48 -1
  127. package/src/sdk/index.ts +17 -0
  128. package/src/sdk/types.ts +28 -0
  129. package/src/serve/context-capsule.ts +67 -8
  130. package/src/serve/public/app.tsx +12 -1
  131. package/src/serve/public/components/AskVerificationPanel.tsx +189 -0
  132. package/src/serve/public/globals.built.css +1 -1
  133. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  134. package/src/serve/public/pages/Ask.tsx +42 -4
  135. package/src/serve/public/pages/Dashboard.tsx +10 -0
  136. package/src/serve/public/pages/TraceHistory.tsx +478 -0
  137. package/src/serve/public/pages/trace-history-detail.tsx +224 -0
  138. package/src/serve/retrieval-trace.ts +28 -0
  139. package/src/serve/routes/api.ts +508 -68
  140. package/src/serve/routes/traces.ts +156 -0
  141. package/src/serve/server.ts +87 -2
  142. package/src/store/index.ts +31 -0
  143. package/src/store/migrations/014-retrieval-traces.ts +303 -0
  144. package/src/store/migrations/index.ts +2 -0
  145. package/src/store/retrieval-trace-codec.ts +384 -0
  146. package/src/store/sqlite/adapter.ts +153 -1
  147. package/src/store/sqlite/retrieval-trace-management-store.ts +341 -0
  148. package/src/store/sqlite/retrieval-trace-retention.ts +349 -0
  149. package/src/store/sqlite/retrieval-trace-rows.ts +267 -0
  150. package/src/store/sqlite/retrieval-trace-store.ts +515 -0
  151. package/src/store/types.ts +297 -0
  152. package/src/store/vector/sqlite-vec.ts +76 -1
  153. package/src/store/vector/types.ts +1 -1
@@ -0,0 +1,564 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "gno://schemas/ask@1.0",
4
+ "title": "GNO Ask Response",
5
+ "description": "Response from gno ask command",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["query", "mode", "results", "meta"],
9
+ "allOf": [
10
+ {
11
+ "if": {
12
+ "properties": { "verification": {} },
13
+ "required": ["verification"]
14
+ },
15
+ "then": {
16
+ "required": ["answer", "citations"],
17
+ "properties": {
18
+ "answer": {},
19
+ "citations": {
20
+ "type": "array",
21
+ "items": {
22
+ "type": "object",
23
+ "properties": { "evidenceId": {} },
24
+ "required": ["evidenceId"]
25
+ }
26
+ },
27
+ "meta": {
28
+ "type": "object",
29
+ "required": ["verificationRequested", "abstained"],
30
+ "properties": {
31
+ "verificationRequested": { "const": true },
32
+ "abstained": {}
33
+ }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "if": {
40
+ "properties": {
41
+ "meta": {
42
+ "type": "object",
43
+ "required": ["verificationRequested"],
44
+ "properties": { "verificationRequested": { "const": true } }
45
+ }
46
+ },
47
+ "required": ["meta"]
48
+ },
49
+ "then": {
50
+ "properties": { "verification": {} },
51
+ "required": ["verification"]
52
+ }
53
+ },
54
+ {
55
+ "if": {
56
+ "properties": {
57
+ "verification": {
58
+ "type": "object",
59
+ "properties": {
60
+ "claims": {
61
+ "type": "object",
62
+ "properties": { "answerStatus": { "const": "abstained" } },
63
+ "required": ["answerStatus"]
64
+ }
65
+ },
66
+ "required": ["claims"]
67
+ }
68
+ },
69
+ "required": ["verification"]
70
+ },
71
+ "then": {
72
+ "properties": {
73
+ "citations": { "type": "array", "maxItems": 0 },
74
+ "meta": {
75
+ "type": "object",
76
+ "properties": { "abstained": { "const": true } }
77
+ }
78
+ }
79
+ },
80
+ "else": {
81
+ "if": {
82
+ "properties": { "verification": {} },
83
+ "required": ["verification"]
84
+ },
85
+ "then": {
86
+ "properties": {
87
+ "citations": { "type": "array", "minItems": 1 },
88
+ "meta": {
89
+ "type": "object",
90
+ "properties": { "abstained": { "const": false } }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ],
97
+ "$defs": {
98
+ "searchResult": {
99
+ "type": "object",
100
+ "required": ["docid", "score", "uri", "snippet", "source"],
101
+ "properties": {
102
+ "docid": {
103
+ "type": "string",
104
+ "description": "Document ID (short hash of source)",
105
+ "pattern": "^#[a-f0-9]{6,8}$"
106
+ },
107
+ "score": {
108
+ "type": "number",
109
+ "description": "Relevance score (0-1 normalized)",
110
+ "minimum": 0,
111
+ "maximum": 1
112
+ },
113
+ "uri": {
114
+ "type": "string",
115
+ "description": "Document URI (gno://collection/path)",
116
+ "pattern": "^gno://[^/]+/.+"
117
+ },
118
+ "title": {
119
+ "type": "string",
120
+ "description": "Extracted document title (optional)"
121
+ },
122
+ "snippetLanguage": {
123
+ "type": "string",
124
+ "description": "Language of snippet content (BCP-47 or 'und')"
125
+ },
126
+ "context": {
127
+ "type": "string",
128
+ "description": "Resolved user-configured retrieval guidance, ordered from global to collection to matching path prefixes"
129
+ },
130
+ "snippet": {
131
+ "type": "string",
132
+ "description": "Matching text snippet from document mirror"
133
+ },
134
+ "snippetRange": {
135
+ "type": "object",
136
+ "description": "Line range of snippet in mirror content",
137
+ "properties": {
138
+ "startLine": {
139
+ "type": "integer",
140
+ "description": "Start line (1-indexed)",
141
+ "minimum": 1
142
+ },
143
+ "endLine": {
144
+ "type": "integer",
145
+ "description": "End line (1-indexed, inclusive)",
146
+ "minimum": 1
147
+ }
148
+ },
149
+ "required": ["startLine", "endLine"]
150
+ },
151
+ "source": {
152
+ "type": "object",
153
+ "description": "Source file metadata",
154
+ "required": ["relPath", "mime", "ext"],
155
+ "properties": {
156
+ "absPath": {
157
+ "type": "string",
158
+ "description": "Absolute path (included with --source or in MCP)"
159
+ },
160
+ "relPath": {
161
+ "type": "string",
162
+ "description": "Path relative to collection root"
163
+ },
164
+ "mime": {
165
+ "type": "string",
166
+ "description": "MIME type of source file"
167
+ },
168
+ "ext": {
169
+ "type": "string",
170
+ "description": "File extension (including dot)",
171
+ "pattern": "^\\.[a-zA-Z0-9]+$"
172
+ },
173
+ "modifiedAt": {
174
+ "type": "string",
175
+ "description": "Last modification time (ISO 8601)",
176
+ "format": "date-time"
177
+ },
178
+ "sizeBytes": {
179
+ "type": "integer",
180
+ "description": "File size in bytes",
181
+ "minimum": 0
182
+ },
183
+ "sourceHash": {
184
+ "type": "string",
185
+ "description": "SHA-256 hash of source file"
186
+ }
187
+ }
188
+ },
189
+ "conversion": {
190
+ "type": "object",
191
+ "description": "Conversion metadata",
192
+ "properties": {
193
+ "converterId": {
194
+ "type": "string",
195
+ "description": "Converter identifier (e.g., 'adapter/markitdown-js')"
196
+ },
197
+ "converterVersion": {
198
+ "type": "string",
199
+ "description": "Converter version"
200
+ },
201
+ "mirrorHash": {
202
+ "type": "string",
203
+ "description": "SHA-256 hash of mirror content"
204
+ },
205
+ "warnings": {
206
+ "type": "array",
207
+ "description": "Conversion warnings",
208
+ "items": {
209
+ "type": "object",
210
+ "properties": {
211
+ "code": {
212
+ "type": "string",
213
+ "enum": [
214
+ "LOSSY",
215
+ "TRUNCATED",
216
+ "PARTIAL",
217
+ "UNSUPPORTED_FEATURE",
218
+ "LOW_CONFIDENCE"
219
+ ]
220
+ },
221
+ "message": {
222
+ "type": "string"
223
+ }
224
+ },
225
+ "required": ["code", "message"]
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ },
233
+ "properties": {
234
+ "query": {
235
+ "type": "string",
236
+ "description": "Original query"
237
+ },
238
+ "mode": {
239
+ "type": "string",
240
+ "description": "Retrieval mode used",
241
+ "enum": ["hybrid", "bm25_only"]
242
+ },
243
+ "queryLanguage": {
244
+ "type": "string",
245
+ "description": "Detected or specified query language",
246
+ "default": "auto"
247
+ },
248
+ "answer": {
249
+ "type": "string",
250
+ "description": "Grounded answer (present only if --answer and generation available)"
251
+ },
252
+ "citations": {
253
+ "type": "array",
254
+ "description": "Citations for the answer",
255
+ "items": {
256
+ "type": "object",
257
+ "additionalProperties": false,
258
+ "required": ["docid", "uri"],
259
+ "properties": {
260
+ "evidenceId": {
261
+ "type": "string",
262
+ "pattern": "^[a-f0-9]{64}$"
263
+ },
264
+ "docid": {
265
+ "type": "string",
266
+ "description": "Document ID",
267
+ "pattern": "^#[a-f0-9]{6,8}$"
268
+ },
269
+ "uri": {
270
+ "type": "string",
271
+ "description": "Document URI",
272
+ "pattern": "^gno://[^/]+/.+"
273
+ },
274
+ "startLine": {
275
+ "type": "integer",
276
+ "description": "Citation start line",
277
+ "minimum": 1
278
+ },
279
+ "endLine": {
280
+ "type": "integer",
281
+ "description": "Citation end line",
282
+ "minimum": 1
283
+ }
284
+ }
285
+ }
286
+ },
287
+ "results": {
288
+ "type": "array",
289
+ "description": "Search results (same shape as query results)",
290
+ "items": {
291
+ "$ref": "#/$defs/searchResult"
292
+ }
293
+ },
294
+ "verification": {
295
+ "type": "object",
296
+ "additionalProperties": false,
297
+ "required": [
298
+ "schemaVersion",
299
+ "mode",
300
+ "capsule",
301
+ "freshness",
302
+ "claims",
303
+ "semantic"
304
+ ],
305
+ "properties": {
306
+ "schemaVersion": { "const": "1.0" },
307
+ "mode": { "const": "closed_capsule" },
308
+ "capsule": {
309
+ "$ref": "gno://schemas/context-capsule-v1@1.0"
310
+ },
311
+ "freshness": {
312
+ "$ref": "gno://schemas/context-capsule-verification@1.0"
313
+ },
314
+ "claims": {
315
+ "$ref": "gno://schemas/claim-verification@1.0"
316
+ },
317
+ "semantic": {
318
+ "type": "object",
319
+ "additionalProperties": false,
320
+ "required": [
321
+ "status",
322
+ "reason",
323
+ "schemaRequested",
324
+ "schemaEnforced",
325
+ "modelFingerprint",
326
+ "configFingerprint",
327
+ "verifierFingerprint",
328
+ "candidateClaims",
329
+ "verifiedClaims",
330
+ "unresolvedClaims",
331
+ "modelCalls",
332
+ "durationMs"
333
+ ],
334
+ "properties": {
335
+ "status": {
336
+ "enum": ["completed", "unavailable", "failed"]
337
+ },
338
+ "reason": {
339
+ "enum": [
340
+ "verified",
341
+ "no_candidates",
342
+ "verifier_unavailable",
343
+ "structured_output_unavailable",
344
+ "input_limit_exceeded",
345
+ "generation_failed",
346
+ "invalid_output"
347
+ ]
348
+ },
349
+ "schemaRequested": { "type": "boolean" },
350
+ "schemaEnforced": { "type": "boolean" },
351
+ "modelFingerprint": {
352
+ "oneOf": [
353
+ {
354
+ "type": "string",
355
+ "pattern": "^[a-f0-9]{64}$"
356
+ },
357
+ { "type": "null" }
358
+ ]
359
+ },
360
+ "configFingerprint": {
361
+ "type": "string",
362
+ "pattern": "^[a-f0-9]{64}$"
363
+ },
364
+ "verifierFingerprint": {
365
+ "oneOf": [
366
+ {
367
+ "type": "string",
368
+ "pattern": "^[a-f0-9]{64}$"
369
+ },
370
+ { "type": "null" }
371
+ ]
372
+ },
373
+ "candidateClaims": {
374
+ "type": "integer",
375
+ "minimum": 0
376
+ },
377
+ "verifiedClaims": {
378
+ "type": "integer",
379
+ "minimum": 0
380
+ },
381
+ "unresolvedClaims": {
382
+ "type": "integer",
383
+ "minimum": 0
384
+ },
385
+ "modelCalls": { "enum": [0, 1] },
386
+ "durationMs": { "type": "number", "minimum": 0 }
387
+ }
388
+ }
389
+ }
390
+ },
391
+ "meta": {
392
+ "type": "object",
393
+ "additionalProperties": false,
394
+ "description": "Retrieval metadata",
395
+ "required": ["expanded", "reranked", "vectorsUsed"],
396
+ "properties": {
397
+ "expanded": {
398
+ "type": "boolean",
399
+ "description": "Whether query expansion was used"
400
+ },
401
+ "reranked": {
402
+ "type": "boolean",
403
+ "description": "Whether reranking was applied"
404
+ },
405
+ "vectorsUsed": {
406
+ "type": "boolean",
407
+ "description": "Whether vector search was used"
408
+ },
409
+ "intent": {
410
+ "type": "string",
411
+ "description": "Disambiguating context used to steer retrieval without being searched directly"
412
+ },
413
+ "candidateLimit": {
414
+ "type": "integer",
415
+ "description": "Max candidates sent to reranking (if applicable)",
416
+ "minimum": 1
417
+ },
418
+ "exclude": {
419
+ "type": "array",
420
+ "description": "Explicit exclusion terms applied",
421
+ "items": { "type": "string" }
422
+ },
423
+ "queryModes": {
424
+ "type": "object",
425
+ "description": "Summary of structured query modes applied",
426
+ "required": ["term", "intent", "hyde"],
427
+ "properties": {
428
+ "term": {
429
+ "type": "integer",
430
+ "minimum": 0
431
+ },
432
+ "intent": {
433
+ "type": "integer",
434
+ "minimum": 0
435
+ },
436
+ "hyde": {
437
+ "type": "boolean"
438
+ }
439
+ }
440
+ },
441
+ "answerGenerated": {
442
+ "type": "boolean",
443
+ "description": "Whether an answer was generated"
444
+ },
445
+ "verificationRequested": {
446
+ "type": "boolean"
447
+ },
448
+ "abstained": {
449
+ "type": "boolean"
450
+ },
451
+ "totalResults": {
452
+ "type": "integer",
453
+ "description": "Number of results returned",
454
+ "minimum": 0
455
+ },
456
+ "answerContext": {
457
+ "type": "object",
458
+ "description": "Answer context selection explain payload",
459
+ "required": [
460
+ "strategy",
461
+ "targetSources",
462
+ "facets",
463
+ "selected",
464
+ "dropped"
465
+ ],
466
+ "properties": {
467
+ "strategy": {
468
+ "type": "string",
469
+ "enum": ["adaptive_coverage_v1"]
470
+ },
471
+ "targetSources": {
472
+ "type": "integer",
473
+ "minimum": 0
474
+ },
475
+ "facets": {
476
+ "type": "array",
477
+ "items": { "type": "string" }
478
+ },
479
+ "selected": {
480
+ "type": "array",
481
+ "items": {
482
+ "type": "object",
483
+ "required": [
484
+ "docid",
485
+ "uri",
486
+ "score",
487
+ "queryTokenHits",
488
+ "facetHits",
489
+ "reason"
490
+ ],
491
+ "properties": {
492
+ "docid": {
493
+ "type": "string",
494
+ "pattern": "^#[a-f0-9]{6,8}$"
495
+ },
496
+ "uri": {
497
+ "type": "string",
498
+ "pattern": "^gno://[^/]+/.+"
499
+ },
500
+ "score": {
501
+ "type": "number",
502
+ "minimum": 0,
503
+ "maximum": 1
504
+ },
505
+ "queryTokenHits": {
506
+ "type": "integer",
507
+ "minimum": 0
508
+ },
509
+ "facetHits": {
510
+ "type": "integer",
511
+ "minimum": 0
512
+ },
513
+ "reason": {
514
+ "type": "string"
515
+ }
516
+ }
517
+ }
518
+ },
519
+ "dropped": {
520
+ "type": "array",
521
+ "items": {
522
+ "type": "object",
523
+ "required": [
524
+ "docid",
525
+ "uri",
526
+ "score",
527
+ "queryTokenHits",
528
+ "facetHits",
529
+ "reason"
530
+ ],
531
+ "properties": {
532
+ "docid": {
533
+ "type": "string",
534
+ "pattern": "^#[a-f0-9]{6,8}$"
535
+ },
536
+ "uri": {
537
+ "type": "string",
538
+ "pattern": "^gno://[^/]+/.+"
539
+ },
540
+ "score": {
541
+ "type": "number",
542
+ "minimum": 0,
543
+ "maximum": 1
544
+ },
545
+ "queryTokenHits": {
546
+ "type": "integer",
547
+ "minimum": 0
548
+ },
549
+ "facetHits": {
550
+ "type": "integer",
551
+ "minimum": 0
552
+ },
553
+ "reason": {
554
+ "type": "string"
555
+ }
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
562
+ }
563
+ }
564
+ }
@@ -0,0 +1,131 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "gno://schemas/backlinks@1.0",
4
+ "title": "GNO Backlinks",
5
+ "description": "List of documents linking to a target document",
6
+ "type": "object",
7
+ "required": ["backlinks", "meta"],
8
+ "properties": {
9
+ "backlinks": {
10
+ "type": "array",
11
+ "description": "List of documents linking to this one",
12
+ "items": {
13
+ "oneOf": [
14
+ {
15
+ "type": "object",
16
+ "required": ["sourceDocid", "sourceUri", "startLine", "startCol"],
17
+ "additionalProperties": false,
18
+ "properties": {
19
+ "sourceDocid": {
20
+ "type": "string",
21
+ "description": "Source document ID"
22
+ },
23
+ "sourceUri": {
24
+ "type": "string",
25
+ "description": "Source document URI"
26
+ },
27
+ "sourceTitle": {
28
+ "type": "string",
29
+ "description": "Source document title"
30
+ },
31
+ "linkText": {
32
+ "type": "string",
33
+ "description": "Link display text"
34
+ },
35
+ "startLine": {
36
+ "type": "integer",
37
+ "description": "1-based line number in source",
38
+ "minimum": 1
39
+ },
40
+ "startCol": {
41
+ "type": "integer",
42
+ "description": "1-based column in source",
43
+ "minimum": 1
44
+ }
45
+ }
46
+ },
47
+ {
48
+ "type": "object",
49
+ "required": [
50
+ "sourceDocid",
51
+ "sourceUri",
52
+ "edgeType",
53
+ "confidence",
54
+ "edgeSource"
55
+ ],
56
+ "additionalProperties": false,
57
+ "properties": {
58
+ "sourceDocid": {
59
+ "type": "string",
60
+ "description": "Source document ID"
61
+ },
62
+ "sourceUri": {
63
+ "type": "string",
64
+ "description": "Source document URI"
65
+ },
66
+ "sourceTitle": {
67
+ "type": "string",
68
+ "description": "Source document title"
69
+ },
70
+ "edgeType": {
71
+ "type": "string",
72
+ "description": "Semantic relationship type"
73
+ },
74
+ "relationType": {
75
+ "type": "string",
76
+ "description": "Alias of edgeType"
77
+ },
78
+ "confidence": {
79
+ "type": "string",
80
+ "enum": ["parsed", "configured", "manual", "inferred"]
81
+ },
82
+ "edgeSource": {
83
+ "type": "string",
84
+ "enum": ["wikilink", "markdown-link", "frontmatter-relation"]
85
+ }
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ "meta": {
92
+ "type": "object",
93
+ "required": ["docid", "totalBacklinks"],
94
+ "properties": {
95
+ "docid": {
96
+ "type": "string",
97
+ "description": "Target document ID"
98
+ },
99
+ "uri": {
100
+ "type": "string",
101
+ "description": "Target document URI"
102
+ },
103
+ "title": {
104
+ "type": "string",
105
+ "description": "Target document title"
106
+ },
107
+ "totalBacklinks": {
108
+ "type": "integer",
109
+ "description": "Total number of backlinks",
110
+ "minimum": 0
111
+ },
112
+ "collection": {
113
+ "type": "string",
114
+ "description": "Collection filter applied"
115
+ },
116
+ "edgeTypeFilter": {
117
+ "type": "string",
118
+ "description": "Semantic edge-type filter applied"
119
+ },
120
+ "relationFilter": {
121
+ "type": "string",
122
+ "description": "Semantic relation filter applied"
123
+ },
124
+ "semantic": {
125
+ "type": "boolean",
126
+ "description": "Whether backlinks came from the semantic edge layer"
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }