@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,726 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "gno://schemas/context-capsule-v1@1.0",
4
+ "title": "GNO Context Capsule V1",
5
+ "description": "Deterministic, extractive evidence compiled under one canonical JSON budget.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "coordinateSpace",
11
+ "goal",
12
+ "query",
13
+ "scope",
14
+ "budget",
15
+ "retrieval",
16
+ "fingerprints",
17
+ "capabilities",
18
+ "fallbacks",
19
+ "guidance",
20
+ "evidence",
21
+ "coverage",
22
+ "omissions",
23
+ "truncated",
24
+ "warnings",
25
+ "capsuleId"
26
+ ],
27
+ "allOf": [
28
+ {
29
+ "if": {
30
+ "properties": {
31
+ "budget": {
32
+ "type": "object",
33
+ "properties": { "estimator": { "const": "active_tokenizer" } },
34
+ "required": ["estimator"]
35
+ }
36
+ },
37
+ "required": ["budget"]
38
+ },
39
+ "then": {
40
+ "properties": {
41
+ "budget": {
42
+ "type": "object",
43
+ "properties": {
44
+ "tokenizerFingerprint": { "$ref": "#/definitions/sha256" }
45
+ }
46
+ },
47
+ "fingerprints": {
48
+ "type": "object",
49
+ "properties": { "tokenizer": { "$ref": "#/definitions/sha256" } }
50
+ },
51
+ "capabilities": {
52
+ "type": "object",
53
+ "properties": { "exactTokenCount": { "const": true } }
54
+ }
55
+ }
56
+ },
57
+ "else": {
58
+ "properties": {
59
+ "budget": {
60
+ "type": "object",
61
+ "properties": { "tokenizerFingerprint": { "type": "null" } }
62
+ },
63
+ "fingerprints": {
64
+ "type": "object",
65
+ "properties": { "tokenizer": { "type": "null" } }
66
+ },
67
+ "capabilities": {
68
+ "type": "object",
69
+ "properties": { "exactTokenCount": { "const": false } }
70
+ },
71
+ "fallbacks": {
72
+ "type": "array",
73
+ "contains": {
74
+ "type": "object",
75
+ "properties": {
76
+ "code": { "const": "tokenizer_unavailable" },
77
+ "capability": { "const": "token_count" }
78
+ },
79
+ "required": ["code", "capability"]
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ],
86
+ "properties": {
87
+ "schemaVersion": { "const": "1.0" },
88
+ "coordinateSpace": { "const": "canonical_mirror" },
89
+ "capsuleId": { "$ref": "#/definitions/sha256" },
90
+ "goal": { "type": "string", "minLength": 1, "maxLength": 16384 },
91
+ "query": { "type": "string", "minLength": 1, "maxLength": 16384 },
92
+ "scope": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "indexName",
97
+ "collections",
98
+ "uriPrefix",
99
+ "tagsAll",
100
+ "tagsAny",
101
+ "categories",
102
+ "since",
103
+ "until"
104
+ ],
105
+ "properties": {
106
+ "indexName": { "type": "string", "minLength": 1, "maxLength": 64 },
107
+ "collections": {
108
+ "type": "array",
109
+ "maxItems": 128,
110
+ "items": { "$ref": "#/definitions/collection" }
111
+ },
112
+ "uriPrefix": {
113
+ "oneOf": [
114
+ { "$ref": "#/definitions/gnoPrefixUri" },
115
+ { "type": "null" }
116
+ ]
117
+ },
118
+ "tagsAll": { "$ref": "#/definitions/filterValues" },
119
+ "tagsAny": { "$ref": "#/definitions/filterValues" },
120
+ "categories": { "$ref": "#/definitions/filterValues" },
121
+ "since": { "$ref": "#/definitions/nullableDate" },
122
+ "until": { "$ref": "#/definitions/nullableDate" }
123
+ }
124
+ },
125
+ "budget": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "required": [
129
+ "authority",
130
+ "requestedTokens",
131
+ "requestedBytes",
132
+ "safetyMarginTokens",
133
+ "safetyMarginBytes",
134
+ "usedTokens",
135
+ "usedBytes",
136
+ "estimator",
137
+ "tokenizerFingerprint"
138
+ ],
139
+ "properties": {
140
+ "authority": { "const": "canonical_json" },
141
+ "requestedTokens": { "type": "integer", "minimum": 1 },
142
+ "requestedBytes": { "type": "integer", "minimum": 1 },
143
+ "safetyMarginTokens": { "type": "integer", "minimum": 0 },
144
+ "safetyMarginBytes": { "type": "integer", "minimum": 0 },
145
+ "usedTokens": { "type": "integer", "minimum": 1 },
146
+ "usedBytes": { "type": "integer", "minimum": 0 },
147
+ "estimator": {
148
+ "enum": ["active_tokenizer", "unicode_conservative"]
149
+ },
150
+ "tokenizerFingerprint": { "$ref": "#/definitions/nullableSha256" }
151
+ }
152
+ },
153
+ "retrieval": {
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "required": [
157
+ "depthPolicy",
158
+ "facets",
159
+ "queryVariants",
160
+ "expansionPolicy",
161
+ "request",
162
+ "capabilityStates",
163
+ "indexSnapshot"
164
+ ],
165
+ "properties": {
166
+ "depthPolicy": { "enum": ["fast", "balanced", "thorough"] },
167
+ "facets": { "$ref": "#/definitions/facets" },
168
+ "queryVariants": {
169
+ "type": "array",
170
+ "minItems": 1,
171
+ "maxItems": 128,
172
+ "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
173
+ },
174
+ "expansionPolicy": { "const": "deterministic_only" },
175
+ "request": {
176
+ "type": "object",
177
+ "additionalProperties": false,
178
+ "required": [
179
+ "author",
180
+ "lang",
181
+ "queryModes",
182
+ "limit",
183
+ "candidateLimit",
184
+ "graphRequested"
185
+ ],
186
+ "properties": {
187
+ "author": {
188
+ "oneOf": [
189
+ { "type": "string", "minLength": 1, "maxLength": 256 },
190
+ { "type": "null" }
191
+ ]
192
+ },
193
+ "lang": {
194
+ "oneOf": [
195
+ { "type": "string", "minLength": 1, "maxLength": 64 },
196
+ { "type": "null" }
197
+ ]
198
+ },
199
+ "intent": {
200
+ "oneOf": [
201
+ { "type": "string", "minLength": 1, "maxLength": 16384 },
202
+ { "type": "null" }
203
+ ]
204
+ },
205
+ "exclude": {
206
+ "type": "array",
207
+ "maxItems": 128,
208
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
209
+ },
210
+ "minScore": {
211
+ "oneOf": [
212
+ { "type": "number", "minimum": 0, "maximum": 1 },
213
+ { "type": "null" }
214
+ ]
215
+ },
216
+ "queryModes": {
217
+ "type": "array",
218
+ "maxItems": 128,
219
+ "items": { "$ref": "#/definitions/queryMode" }
220
+ },
221
+ "limit": { "type": "integer", "minimum": 1 },
222
+ "candidateLimit": { "type": "integer", "minimum": 1 },
223
+ "graphRequested": { "type": "boolean" },
224
+ "rerankRequested": { "type": "boolean" }
225
+ }
226
+ },
227
+ "capabilityStates": {
228
+ "type": "object",
229
+ "additionalProperties": false,
230
+ "required": ["semanticSearch", "reranking", "graphExpansion"],
231
+ "properties": {
232
+ "semanticSearch": { "$ref": "#/definitions/capabilityState" },
233
+ "reranking": { "$ref": "#/definitions/capabilityState" },
234
+ "graphExpansion": { "$ref": "#/definitions/capabilityState" }
235
+ }
236
+ },
237
+ "indexSnapshot": { "$ref": "#/definitions/indexSnapshot" }
238
+ }
239
+ },
240
+ "fingerprints": {
241
+ "type": "object",
242
+ "additionalProperties": false,
243
+ "required": [
244
+ "config",
245
+ "retrieval",
246
+ "embeddingModel",
247
+ "rerankModel",
248
+ "tokenizer"
249
+ ],
250
+ "properties": {
251
+ "config": { "$ref": "#/definitions/sha256" },
252
+ "retrieval": { "$ref": "#/definitions/sha256" },
253
+ "embeddingModel": { "$ref": "#/definitions/nullableSha256" },
254
+ "rerankModel": { "$ref": "#/definitions/nullableSha256" },
255
+ "tokenizer": { "$ref": "#/definitions/nullableSha256" }
256
+ }
257
+ },
258
+ "capabilities": {
259
+ "type": "object",
260
+ "additionalProperties": false,
261
+ "required": [
262
+ "lexicalSearch",
263
+ "semanticSearch",
264
+ "reranking",
265
+ "graphExpansion",
266
+ "exactTokenCount",
267
+ "configuredContext",
268
+ "egressPolicy"
269
+ ],
270
+ "properties": {
271
+ "lexicalSearch": { "const": true },
272
+ "semanticSearch": { "type": "boolean" },
273
+ "reranking": { "type": "boolean" },
274
+ "graphExpansion": { "type": "boolean" },
275
+ "exactTokenCount": { "type": "boolean" },
276
+ "configuredContext": { "type": "boolean" },
277
+ "egressPolicy": { "type": "boolean" }
278
+ }
279
+ },
280
+ "fallbacks": {
281
+ "type": "array",
282
+ "maxItems": 16,
283
+ "items": { "$ref": "#/definitions/fallback" }
284
+ },
285
+ "guidance": {
286
+ "type": "object",
287
+ "additionalProperties": false,
288
+ "required": [
289
+ "extractiveOnly",
290
+ "evidenceTrust",
291
+ "instructionBoundary",
292
+ "configuredContexts"
293
+ ],
294
+ "properties": {
295
+ "extractiveOnly": { "const": true },
296
+ "evidenceTrust": { "const": "untrusted_data" },
297
+ "instructionBoundary": { "const": "hard_delimited" },
298
+ "configuredContexts": {
299
+ "type": "array",
300
+ "maxItems": 128,
301
+ "items": { "$ref": "#/definitions/configuredContext" }
302
+ }
303
+ }
304
+ },
305
+ "evidence": {
306
+ "type": "array",
307
+ "minItems": 1,
308
+ "items": { "$ref": "#/definitions/evidence" }
309
+ },
310
+ "coverage": { "$ref": "#/definitions/coverage" },
311
+ "omissions": { "$ref": "#/definitions/omissions" },
312
+ "truncated": { "type": "boolean" },
313
+ "warnings": {
314
+ "type": "array",
315
+ "maxItems": 32,
316
+ "items": {
317
+ "type": "object",
318
+ "additionalProperties": false,
319
+ "required": ["code"],
320
+ "properties": {
321
+ "code": {
322
+ "enum": [
323
+ "incomplete_coverage",
324
+ "omissions_truncated",
325
+ "token_estimate_used"
326
+ ]
327
+ }
328
+ }
329
+ }
330
+ }
331
+ },
332
+ "definitions": {
333
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
334
+ "nullableSha256": {
335
+ "oneOf": [{ "$ref": "#/definitions/sha256" }, { "type": "null" }]
336
+ },
337
+ "nullableDate": {
338
+ "oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
339
+ },
340
+ "gnoUri": {
341
+ "type": "string",
342
+ "maxLength": 2048,
343
+ "pattern": "^gno://[a-z0-9][a-z0-9_-]{0,63}/(?!.*%2F)(?:[A-Za-z0-9_.!~*'()/\\-]|%[0-9A-F]{2})+(?:\\?index=(?:[A-Za-z0-9_.!~*'()\\-]|%[0-9A-F]{2})+)?$"
344
+ },
345
+ "gnoPrefixUri": {
346
+ "type": "string",
347
+ "maxLength": 2048,
348
+ "pattern": "^gno://[a-z0-9][a-z0-9_-]{0,63}/(?!.*%2F)(?:[A-Za-z0-9_.!~*'()/\\-]|%[0-9A-F]{2})*(?:\\?index=(?:[A-Za-z0-9_.!~*'()\\-]|%[0-9A-F]{2})+)?$"
349
+ },
350
+ "docid": { "type": "string", "pattern": "^#[a-f0-9]{6,}$" },
351
+ "collection": {
352
+ "type": "string",
353
+ "minLength": 1,
354
+ "maxLength": 64,
355
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
356
+ },
357
+ "filterValues": {
358
+ "type": "array",
359
+ "maxItems": 128,
360
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
361
+ },
362
+ "facets": {
363
+ "type": "array",
364
+ "maxItems": 128,
365
+ "items": { "type": "string", "minLength": 1, "maxLength": 512 }
366
+ },
367
+ "queryMode": {
368
+ "type": "object",
369
+ "additionalProperties": false,
370
+ "required": ["mode", "text"],
371
+ "properties": {
372
+ "mode": { "enum": ["term", "intent", "hyde"] },
373
+ "text": { "type": "string", "minLength": 1, "maxLength": 4096 }
374
+ }
375
+ },
376
+ "capabilityState": {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": ["requested", "attempted", "outcome", "fallbackReasons"],
380
+ "properties": {
381
+ "requested": { "type": "boolean" },
382
+ "attempted": { "type": "boolean" },
383
+ "outcome": {
384
+ "enum": ["not_requested", "not_attempted", "used", "unavailable"]
385
+ },
386
+ "fallbackReasons": {
387
+ "type": "array",
388
+ "maxItems": 32,
389
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
390
+ }
391
+ },
392
+ "allOf": [
393
+ {
394
+ "if": { "properties": { "outcome": { "const": "not_requested" } } },
395
+ "then": {
396
+ "properties": {
397
+ "requested": { "const": false },
398
+ "attempted": { "const": false },
399
+ "fallbackReasons": { "type": "array", "maxItems": 0 }
400
+ }
401
+ }
402
+ },
403
+ {
404
+ "if": { "properties": { "outcome": { "const": "not_attempted" } } },
405
+ "then": {
406
+ "properties": {
407
+ "requested": { "const": true },
408
+ "attempted": { "const": false }
409
+ }
410
+ }
411
+ },
412
+ {
413
+ "if": { "properties": { "outcome": { "const": "used" } } },
414
+ "then": {
415
+ "properties": {
416
+ "requested": { "const": true },
417
+ "attempted": { "const": true }
418
+ }
419
+ }
420
+ },
421
+ {
422
+ "if": { "properties": { "outcome": { "const": "unavailable" } } },
423
+ "then": {
424
+ "properties": {
425
+ "requested": { "const": true },
426
+ "attempted": { "const": true },
427
+ "fallbackReasons": { "type": "array", "minItems": 1 }
428
+ }
429
+ }
430
+ }
431
+ ]
432
+ },
433
+ "indexSnapshot": {
434
+ "type": "object",
435
+ "additionalProperties": false,
436
+ "required": ["before", "after", "stable"],
437
+ "properties": {
438
+ "before": { "$ref": "#/definitions/sha256" },
439
+ "after": { "$ref": "#/definitions/sha256" },
440
+ "stable": { "const": true }
441
+ }
442
+ },
443
+ "fallback": {
444
+ "type": "object",
445
+ "additionalProperties": false,
446
+ "required": ["code", "capability"],
447
+ "properties": {
448
+ "code": {
449
+ "enum": [
450
+ "embedding_unavailable",
451
+ "reranking_unavailable",
452
+ "graph_unavailable",
453
+ "tokenizer_unavailable",
454
+ "egress_policy_unavailable"
455
+ ]
456
+ },
457
+ "capability": {
458
+ "enum": [
459
+ "semantic_search",
460
+ "reranking",
461
+ "graph_expansion",
462
+ "token_count",
463
+ "egress_policy"
464
+ ]
465
+ }
466
+ }
467
+ },
468
+ "configuredContext": {
469
+ "type": "object",
470
+ "additionalProperties": false,
471
+ "required": ["contextId", "scopeType", "scopeKey", "text"],
472
+ "properties": {
473
+ "contextId": { "$ref": "#/definitions/sha256" },
474
+ "scopeType": { "enum": ["global", "collection", "prefix"] },
475
+ "scopeKey": { "type": "string", "minLength": 1, "maxLength": 2048 },
476
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384 }
477
+ },
478
+ "allOf": [
479
+ {
480
+ "if": { "properties": { "scopeType": { "const": "global" } } },
481
+ "then": { "properties": { "scopeKey": { "const": "/" } } }
482
+ },
483
+ {
484
+ "if": { "properties": { "scopeType": { "const": "collection" } } },
485
+ "then": {
486
+ "properties": {
487
+ "scopeKey": {
488
+ "type": "string",
489
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}:$"
490
+ }
491
+ }
492
+ }
493
+ },
494
+ {
495
+ "if": { "properties": { "scopeType": { "const": "prefix" } } },
496
+ "then": {
497
+ "properties": {
498
+ "scopeKey": { "$ref": "#/definitions/gnoPrefixUri" }
499
+ }
500
+ }
501
+ }
502
+ ]
503
+ },
504
+ "evidence": {
505
+ "type": "object",
506
+ "additionalProperties": false,
507
+ "required": [
508
+ "evidenceId",
509
+ "uri",
510
+ "docid",
511
+ "collection",
512
+ "title",
513
+ "heading",
514
+ "startLine",
515
+ "endLine",
516
+ "text",
517
+ "sourceHash",
518
+ "mirrorHash",
519
+ "passageHash",
520
+ "modifiedAt",
521
+ "documentDate",
522
+ "observedAt",
523
+ "contextIds",
524
+ "retrievalRank",
525
+ "selectionRank",
526
+ "facets",
527
+ "trust",
528
+ "egress"
529
+ ],
530
+ "properties": {
531
+ "evidenceId": { "$ref": "#/definitions/sha256" },
532
+ "uri": { "$ref": "#/definitions/gnoUri" },
533
+ "docid": { "$ref": "#/definitions/docid" },
534
+ "collection": { "$ref": "#/definitions/collection" },
535
+ "title": { "type": ["string", "null"], "maxLength": 2048 },
536
+ "heading": { "type": ["string", "null"], "maxLength": 2048 },
537
+ "startLine": { "type": "integer", "minimum": 1 },
538
+ "endLine": { "type": "integer", "minimum": 1 },
539
+ "text": { "type": "string", "minLength": 1 },
540
+ "sourceHash": { "$ref": "#/definitions/sha256" },
541
+ "mirrorHash": { "$ref": "#/definitions/sha256" },
542
+ "passageHash": { "$ref": "#/definitions/sha256" },
543
+ "modifiedAt": { "$ref": "#/definitions/nullableDate" },
544
+ "documentDate": {
545
+ "oneOf": [
546
+ { "type": "string", "format": "date" },
547
+ { "type": "string", "format": "date-time" },
548
+ { "type": "null" }
549
+ ]
550
+ },
551
+ "observedAt": { "$ref": "#/definitions/nullableDate" },
552
+ "contextIds": {
553
+ "type": "array",
554
+ "maxItems": 128,
555
+ "items": { "$ref": "#/definitions/sha256" }
556
+ },
557
+ "retrievalRank": { "type": "integer", "minimum": 1 },
558
+ "selectionRank": { "type": "integer", "minimum": 1 },
559
+ "retrievalSources": {
560
+ "type": "array",
561
+ "minItems": 1,
562
+ "maxItems": 6,
563
+ "uniqueItems": true,
564
+ "items": {
565
+ "enum": [
566
+ "bm25",
567
+ "vector",
568
+ "bm25_variant",
569
+ "vector_variant",
570
+ "hyde",
571
+ "graph"
572
+ ]
573
+ }
574
+ },
575
+ "graphExpanded": { "type": "boolean" },
576
+ "facets": { "$ref": "#/definitions/facets" },
577
+ "trust": { "const": "untrusted" },
578
+ "egress": {
579
+ "enum": ["local_only", "lan", "remote", "unclassified", "unavailable"]
580
+ }
581
+ }
582
+ },
583
+ "coverage": {
584
+ "type": "object",
585
+ "additionalProperties": false,
586
+ "required": [
587
+ "complete",
588
+ "requestedFacets",
589
+ "coveredFacets",
590
+ "unresolvedFacets",
591
+ "gaps"
592
+ ],
593
+ "properties": {
594
+ "complete": { "type": "boolean" },
595
+ "requestedFacets": { "$ref": "#/definitions/facets" },
596
+ "coveredFacets": {
597
+ "type": "array",
598
+ "maxItems": 128,
599
+ "items": {
600
+ "type": "object",
601
+ "additionalProperties": false,
602
+ "required": ["facet", "evidenceIds"],
603
+ "properties": {
604
+ "facet": { "type": "string", "minLength": 1, "maxLength": 512 },
605
+ "evidenceIds": {
606
+ "type": "array",
607
+ "minItems": 1,
608
+ "maxItems": 256,
609
+ "items": { "$ref": "#/definitions/sha256" }
610
+ }
611
+ }
612
+ }
613
+ },
614
+ "unresolvedFacets": { "$ref": "#/definitions/facets" },
615
+ "gaps": {
616
+ "type": "array",
617
+ "maxItems": 128,
618
+ "items": {
619
+ "type": "object",
620
+ "additionalProperties": false,
621
+ "required": ["facet", "code"],
622
+ "properties": {
623
+ "facet": { "type": "string", "minLength": 1, "maxLength": 512 },
624
+ "code": {
625
+ "enum": [
626
+ "facet_not_found",
627
+ "global_budget_exhausted",
628
+ "capability_unavailable",
629
+ "filtered_by_scope"
630
+ ]
631
+ }
632
+ }
633
+ }
634
+ }
635
+ }
636
+ },
637
+ "omission": {
638
+ "type": "object",
639
+ "additionalProperties": false,
640
+ "required": [
641
+ "candidateId",
642
+ "uri",
643
+ "docid",
644
+ "startLine",
645
+ "endLine",
646
+ "passageHash",
647
+ "sourceHash",
648
+ "mirrorHash",
649
+ "reason"
650
+ ],
651
+ "properties": {
652
+ "candidateId": { "$ref": "#/definitions/sha256" },
653
+ "uri": { "$ref": "#/definitions/gnoUri" },
654
+ "docid": { "$ref": "#/definitions/docid" },
655
+ "startLine": { "type": ["integer", "null"], "minimum": 1 },
656
+ "endLine": { "type": ["integer", "null"], "minimum": 1 },
657
+ "passageHash": { "$ref": "#/definitions/nullableSha256" },
658
+ "sourceHash": { "$ref": "#/definitions/sha256" },
659
+ "mirrorHash": { "$ref": "#/definitions/sha256" },
660
+ "reason": {
661
+ "enum": [
662
+ "duplicate",
663
+ "overlap",
664
+ "global_budget",
665
+ "redundant_coverage",
666
+ "document_share_cap",
667
+ "filtered_by_scope",
668
+ "invalid_coordinates"
669
+ ]
670
+ }
671
+ },
672
+ "oneOf": [
673
+ {
674
+ "properties": {
675
+ "startLine": { "type": "null" },
676
+ "endLine": { "type": "null" },
677
+ "passageHash": { "type": "null" }
678
+ }
679
+ },
680
+ {
681
+ "properties": {
682
+ "startLine": { "type": "integer", "minimum": 1 },
683
+ "endLine": { "type": "integer", "minimum": 1 },
684
+ "passageHash": { "$ref": "#/definitions/sha256" }
685
+ }
686
+ }
687
+ ]
688
+ },
689
+ "omissions": {
690
+ "type": "object",
691
+ "additionalProperties": false,
692
+ "required": ["total", "items", "reasonCounts", "truncated"],
693
+ "properties": {
694
+ "total": { "type": "integer", "minimum": 0 },
695
+ "items": {
696
+ "type": "array",
697
+ "maxItems": 100,
698
+ "items": { "$ref": "#/definitions/omission" }
699
+ },
700
+ "reasonCounts": {
701
+ "type": "object",
702
+ "additionalProperties": false,
703
+ "required": [
704
+ "duplicate",
705
+ "overlap",
706
+ "global_budget",
707
+ "redundant_coverage",
708
+ "document_share_cap",
709
+ "filtered_by_scope",
710
+ "invalid_coordinates"
711
+ ],
712
+ "properties": {
713
+ "duplicate": { "type": "integer", "minimum": 0 },
714
+ "overlap": { "type": "integer", "minimum": 0 },
715
+ "global_budget": { "type": "integer", "minimum": 0 },
716
+ "redundant_coverage": { "type": "integer", "minimum": 0 },
717
+ "document_share_cap": { "type": "integer", "minimum": 0 },
718
+ "filtered_by_scope": { "type": "integer", "minimum": 0 },
719
+ "invalid_coordinates": { "type": "integer", "minimum": 0 }
720
+ }
721
+ },
722
+ "truncated": { "type": "boolean" }
723
+ }
724
+ }
725
+ }
726
+ }