@gmickel/gno 1.17.0 → 1.19.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 (167) hide show
  1. package/README.md +18 -4
  2. package/assets/skill/SKILL.md +44 -1
  3. package/assets/skill/mcp-reference.md +21 -0
  4. package/package.json +3 -2
  5. package/spec/AGENTS.md +83 -0
  6. package/spec/CLAUDE.md +83 -0
  7. package/spec/bench-fixture.schema.json +137 -0
  8. package/spec/cli.md +2894 -0
  9. package/spec/db/schema.sql +442 -0
  10. package/spec/evals-agentic.md +510 -0
  11. package/spec/evals.md +1106 -0
  12. package/spec/mcp.md +2229 -0
  13. package/spec/output-schemas/activation-verification.schema.json +515 -0
  14. package/spec/output-schemas/ask.schema.json +366 -0
  15. package/spec/output-schemas/backlinks.schema.json +131 -0
  16. package/spec/output-schemas/bench-result.schema.json +120 -0
  17. package/spec/output-schemas/capture-receipt.schema.json +143 -0
  18. package/spec/output-schemas/collection-list.schema.json +45 -0
  19. package/spec/output-schemas/context-capsule-v1.schema.json +691 -0
  20. package/spec/output-schemas/context-capsule-verification.schema.json +1338 -0
  21. package/spec/output-schemas/context-list.schema.json +21 -0
  22. package/spec/output-schemas/doctor.schema.json +313 -0
  23. package/spec/output-schemas/error.schema.json +30 -0
  24. package/spec/output-schemas/expansion.schema.json +37 -0
  25. package/spec/output-schemas/get.schema.json +140 -0
  26. package/spec/output-schemas/graph-query.schema.json +99 -0
  27. package/spec/output-schemas/graph.schema.json +371 -0
  28. package/spec/output-schemas/links-list.schema.json +186 -0
  29. package/spec/output-schemas/mcp-add-collection-result.schema.json +23 -0
  30. package/spec/output-schemas/mcp-capture-result.schema.json +152 -0
  31. package/spec/output-schemas/mcp-http-error.schema.json +30 -0
  32. package/spec/output-schemas/mcp-job-list.schema.json +58 -0
  33. package/spec/output-schemas/mcp-job-status.schema.json +224 -0
  34. package/spec/output-schemas/mcp-remove-result.schema.json +39 -0
  35. package/spec/output-schemas/mcp-sync-result.schema.json +41 -0
  36. package/spec/output-schemas/mcp-tag-result.schema.json +33 -0
  37. package/spec/output-schemas/models-list.schema.json +93 -0
  38. package/spec/output-schemas/multi-get.schema.json +103 -0
  39. package/spec/output-schemas/process-status.schema.json +119 -0
  40. package/spec/output-schemas/query-diagnose.schema.json +123 -0
  41. package/spec/output-schemas/resident-status.schema.json +154 -0
  42. package/spec/output-schemas/retrieval-trace-common.schema.json +492 -0
  43. package/spec/output-schemas/retrieval-trace-delete.schema.json +16 -0
  44. package/spec/output-schemas/retrieval-trace-export.schema.json +61 -0
  45. package/spec/output-schemas/retrieval-trace-filters.schema.json +139 -0
  46. package/spec/output-schemas/retrieval-trace-judgment.schema.json +15 -0
  47. package/spec/output-schemas/retrieval-trace-list.schema.json +18 -0
  48. package/spec/output-schemas/retrieval-trace-payloads.schema.json +178 -0
  49. package/spec/output-schemas/retrieval-trace-purge.schema.json +31 -0
  50. package/spec/output-schemas/retrieval-trace-qrels.schema.json +303 -0
  51. package/spec/output-schemas/retrieval-trace-replay.schema.json +286 -0
  52. package/spec/output-schemas/retrieval-trace-show.schema.json +69 -0
  53. package/spec/output-schemas/retrieval-trace-summary.schema.json +65 -0
  54. package/spec/output-schemas/search-result.schema.json +154 -0
  55. package/spec/output-schemas/search-results.schema.json +338 -0
  56. package/spec/output-schemas/similar.schema.json +84 -0
  57. package/spec/output-schemas/status.schema.json +676 -0
  58. package/spec/output-schemas/tags-list.schema.json +48 -0
  59. package/src/app/context-runtime-types.ts +3 -0
  60. package/src/app/context-runtime.ts +15 -1
  61. package/src/cli/commands/ask.ts +106 -36
  62. package/src/cli/commands/context-build.ts +56 -9
  63. package/src/cli/commands/daemon.ts +69 -2
  64. package/src/cli/commands/get.ts +64 -3
  65. package/src/cli/commands/models/pull.ts +13 -3
  66. package/src/cli/commands/query.ts +62 -23
  67. package/src/cli/commands/replay.ts +140 -0
  68. package/src/cli/commands/search.ts +48 -3
  69. package/src/cli/commands/shared.ts +3 -1
  70. package/src/cli/commands/status.ts +2 -0
  71. package/src/cli/commands/trace.ts +200 -0
  72. package/src/cli/commands/vsearch.ts +75 -53
  73. package/src/cli/detach.ts +37 -20
  74. package/src/cli/program.ts +329 -27
  75. package/src/config/index.ts +12 -0
  76. package/src/config/retrieval-traces.ts +56 -0
  77. package/src/config/types.ts +41 -0
  78. package/src/core/context-compiler.ts +11 -4
  79. package/src/core/job-manager.ts +19 -0
  80. package/src/core/mutation-generations.ts +33 -0
  81. package/src/core/retrieval-qrels.ts +405 -0
  82. package/src/core/retrieval-replay-candidate.ts +368 -0
  83. package/src/core/retrieval-replay-types.ts +109 -0
  84. package/src/core/retrieval-replay-validation.ts +89 -0
  85. package/src/core/retrieval-replay.ts +441 -0
  86. package/src/core/retrieval-trace-evidence-origin.ts +175 -0
  87. package/src/core/retrieval-trace-export.ts +113 -0
  88. package/src/core/retrieval-trace-filter-normalization.ts +27 -0
  89. package/src/core/retrieval-trace-filters.ts +19 -0
  90. package/src/core/retrieval-trace-management-helpers.ts +247 -0
  91. package/src/core/retrieval-trace-management-types.ts +132 -0
  92. package/src/core/retrieval-trace-management.ts +422 -0
  93. package/src/core/retrieval-trace-request.ts +141 -0
  94. package/src/core/retrieval-trace-session.ts +494 -0
  95. package/src/core/retrieval-trace.ts +472 -0
  96. package/src/llm/cache.ts +13 -3
  97. package/src/llm/nodeLlamaCpp/adapter.ts +10 -1
  98. package/src/llm/nodeLlamaCpp/lifecycle.ts +71 -0
  99. package/src/mcp/context.ts +161 -0
  100. package/src/mcp/http-security.ts +477 -0
  101. package/src/mcp/http-session.ts +272 -0
  102. package/src/mcp/http-transport.ts +370 -0
  103. package/src/mcp/resources/index.ts +141 -134
  104. package/src/mcp/server.ts +19 -79
  105. package/src/mcp/tools/add-collection.ts +3 -1
  106. package/src/mcp/tools/capture.ts +3 -0
  107. package/src/mcp/tools/clear-collection-embeddings.ts +2 -0
  108. package/src/mcp/tools/context.ts +68 -16
  109. package/src/mcp/tools/embed.ts +62 -52
  110. package/src/mcp/tools/get.ts +35 -1
  111. package/src/mcp/tools/index-cmd.ts +88 -74
  112. package/src/mcp/tools/index.ts +96 -2
  113. package/src/mcp/tools/query.ts +95 -64
  114. package/src/mcp/tools/remove-collection.ts +2 -0
  115. package/src/mcp/tools/search.ts +36 -13
  116. package/src/mcp/tools/status.ts +11 -0
  117. package/src/mcp/tools/sync.ts +16 -14
  118. package/src/mcp/tools/trace.ts +143 -0
  119. package/src/mcp/tools/vsearch.ts +71 -38
  120. package/src/mcp/tools/workspace-write.ts +7 -3
  121. package/src/pipeline/answer.ts +167 -26
  122. package/src/pipeline/graph-retrieval.ts +15 -1
  123. package/src/pipeline/hybrid.ts +151 -43
  124. package/src/pipeline/search.ts +36 -3
  125. package/src/pipeline/trace-metadata.ts +47 -0
  126. package/src/pipeline/types.ts +43 -0
  127. package/src/pipeline/vsearch.ts +101 -38
  128. package/src/sdk/client.ts +380 -71
  129. package/src/sdk/documents.ts +48 -1
  130. package/src/sdk/index.ts +17 -0
  131. package/src/sdk/types.ts +28 -0
  132. package/src/serve/background-runtime.ts +12 -212
  133. package/src/serve/context-capsule.ts +67 -8
  134. package/src/serve/embed-scheduler.ts +74 -43
  135. package/src/serve/index.ts +9 -0
  136. package/src/serve/jobs.ts +78 -80
  137. package/src/serve/public/app.tsx +12 -1
  138. package/src/serve/public/components/HealthCenter.tsx +74 -1
  139. package/src/serve/public/globals.built.css +1 -1
  140. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  141. package/src/serve/public/pages/Dashboard.tsx +11 -0
  142. package/src/serve/public/pages/TraceHistory.tsx +478 -0
  143. package/src/serve/public/pages/trace-history-detail.tsx +224 -0
  144. package/src/serve/resident-admission.ts +159 -0
  145. package/src/serve/resident-background-work.ts +39 -0
  146. package/src/serve/resident-request.ts +55 -0
  147. package/src/serve/resident-runtime.ts +490 -0
  148. package/src/serve/resident-status.ts +96 -0
  149. package/src/serve/retrieval-trace.ts +28 -0
  150. package/src/serve/routes/api.ts +629 -239
  151. package/src/serve/routes/mcp.ts +69 -0
  152. package/src/serve/routes/traces.ts +156 -0
  153. package/src/serve/server.ts +276 -37
  154. package/src/serve/status-model.ts +51 -0
  155. package/src/serve/status.ts +5 -0
  156. package/src/store/index.ts +31 -0
  157. package/src/store/migrations/014-retrieval-traces.ts +303 -0
  158. package/src/store/migrations/index.ts +2 -0
  159. package/src/store/retrieval-trace-codec.ts +384 -0
  160. package/src/store/sqlite/adapter.ts +179 -10
  161. package/src/store/sqlite/retrieval-trace-management-store.ts +341 -0
  162. package/src/store/sqlite/retrieval-trace-retention.ts +349 -0
  163. package/src/store/sqlite/retrieval-trace-rows.ts +267 -0
  164. package/src/store/sqlite/retrieval-trace-store.ts +515 -0
  165. package/src/store/types.ts +297 -0
  166. package/src/store/vector/sqlite-vec.ts +76 -1
  167. package/src/store/vector/types.ts +1 -1
@@ -0,0 +1,691 @@
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
+ "queryModes": {
200
+ "type": "array",
201
+ "maxItems": 128,
202
+ "items": { "$ref": "#/definitions/queryMode" }
203
+ },
204
+ "limit": { "type": "integer", "minimum": 1 },
205
+ "candidateLimit": { "type": "integer", "minimum": 1 },
206
+ "graphRequested": { "type": "boolean" }
207
+ }
208
+ },
209
+ "capabilityStates": {
210
+ "type": "object",
211
+ "additionalProperties": false,
212
+ "required": ["semanticSearch", "reranking", "graphExpansion"],
213
+ "properties": {
214
+ "semanticSearch": { "$ref": "#/definitions/capabilityState" },
215
+ "reranking": { "$ref": "#/definitions/capabilityState" },
216
+ "graphExpansion": { "$ref": "#/definitions/capabilityState" }
217
+ }
218
+ },
219
+ "indexSnapshot": { "$ref": "#/definitions/indexSnapshot" }
220
+ }
221
+ },
222
+ "fingerprints": {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "required": [
226
+ "config",
227
+ "retrieval",
228
+ "embeddingModel",
229
+ "rerankModel",
230
+ "tokenizer"
231
+ ],
232
+ "properties": {
233
+ "config": { "$ref": "#/definitions/sha256" },
234
+ "retrieval": { "$ref": "#/definitions/sha256" },
235
+ "embeddingModel": { "$ref": "#/definitions/nullableSha256" },
236
+ "rerankModel": { "$ref": "#/definitions/nullableSha256" },
237
+ "tokenizer": { "$ref": "#/definitions/nullableSha256" }
238
+ }
239
+ },
240
+ "capabilities": {
241
+ "type": "object",
242
+ "additionalProperties": false,
243
+ "required": [
244
+ "lexicalSearch",
245
+ "semanticSearch",
246
+ "reranking",
247
+ "graphExpansion",
248
+ "exactTokenCount",
249
+ "configuredContext",
250
+ "egressPolicy"
251
+ ],
252
+ "properties": {
253
+ "lexicalSearch": { "const": true },
254
+ "semanticSearch": { "type": "boolean" },
255
+ "reranking": { "type": "boolean" },
256
+ "graphExpansion": { "type": "boolean" },
257
+ "exactTokenCount": { "type": "boolean" },
258
+ "configuredContext": { "type": "boolean" },
259
+ "egressPolicy": { "type": "boolean" }
260
+ }
261
+ },
262
+ "fallbacks": {
263
+ "type": "array",
264
+ "maxItems": 16,
265
+ "items": { "$ref": "#/definitions/fallback" }
266
+ },
267
+ "guidance": {
268
+ "type": "object",
269
+ "additionalProperties": false,
270
+ "required": [
271
+ "extractiveOnly",
272
+ "evidenceTrust",
273
+ "instructionBoundary",
274
+ "configuredContexts"
275
+ ],
276
+ "properties": {
277
+ "extractiveOnly": { "const": true },
278
+ "evidenceTrust": { "const": "untrusted_data" },
279
+ "instructionBoundary": { "const": "hard_delimited" },
280
+ "configuredContexts": {
281
+ "type": "array",
282
+ "maxItems": 128,
283
+ "items": { "$ref": "#/definitions/configuredContext" }
284
+ }
285
+ }
286
+ },
287
+ "evidence": {
288
+ "type": "array",
289
+ "minItems": 1,
290
+ "items": { "$ref": "#/definitions/evidence" }
291
+ },
292
+ "coverage": { "$ref": "#/definitions/coverage" },
293
+ "omissions": { "$ref": "#/definitions/omissions" },
294
+ "truncated": { "type": "boolean" },
295
+ "warnings": {
296
+ "type": "array",
297
+ "maxItems": 32,
298
+ "items": {
299
+ "type": "object",
300
+ "additionalProperties": false,
301
+ "required": ["code"],
302
+ "properties": {
303
+ "code": {
304
+ "enum": [
305
+ "incomplete_coverage",
306
+ "omissions_truncated",
307
+ "token_estimate_used"
308
+ ]
309
+ }
310
+ }
311
+ }
312
+ }
313
+ },
314
+ "definitions": {
315
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
316
+ "nullableSha256": {
317
+ "oneOf": [{ "$ref": "#/definitions/sha256" }, { "type": "null" }]
318
+ },
319
+ "nullableDate": {
320
+ "oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
321
+ },
322
+ "gnoUri": {
323
+ "type": "string",
324
+ "maxLength": 2048,
325
+ "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})+)?$"
326
+ },
327
+ "gnoPrefixUri": {
328
+ "type": "string",
329
+ "maxLength": 2048,
330
+ "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})+)?$"
331
+ },
332
+ "docid": { "type": "string", "pattern": "^#[a-f0-9]{6,}$" },
333
+ "collection": {
334
+ "type": "string",
335
+ "minLength": 1,
336
+ "maxLength": 64,
337
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
338
+ },
339
+ "filterValues": {
340
+ "type": "array",
341
+ "maxItems": 128,
342
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
343
+ },
344
+ "facets": {
345
+ "type": "array",
346
+ "maxItems": 128,
347
+ "items": { "type": "string", "minLength": 1, "maxLength": 512 }
348
+ },
349
+ "queryMode": {
350
+ "type": "object",
351
+ "additionalProperties": false,
352
+ "required": ["mode", "text"],
353
+ "properties": {
354
+ "mode": { "enum": ["term", "intent", "hyde"] },
355
+ "text": { "type": "string", "minLength": 1, "maxLength": 4096 }
356
+ }
357
+ },
358
+ "capabilityState": {
359
+ "type": "object",
360
+ "additionalProperties": false,
361
+ "required": ["requested", "attempted", "outcome", "fallbackReasons"],
362
+ "properties": {
363
+ "requested": { "type": "boolean" },
364
+ "attempted": { "type": "boolean" },
365
+ "outcome": {
366
+ "enum": ["not_requested", "not_attempted", "used", "unavailable"]
367
+ },
368
+ "fallbackReasons": {
369
+ "type": "array",
370
+ "maxItems": 32,
371
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
372
+ }
373
+ },
374
+ "allOf": [
375
+ {
376
+ "if": { "properties": { "outcome": { "const": "not_requested" } } },
377
+ "then": {
378
+ "properties": {
379
+ "requested": { "const": false },
380
+ "attempted": { "const": false },
381
+ "fallbackReasons": { "type": "array", "maxItems": 0 }
382
+ }
383
+ }
384
+ },
385
+ {
386
+ "if": { "properties": { "outcome": { "const": "not_attempted" } } },
387
+ "then": {
388
+ "properties": {
389
+ "requested": { "const": true },
390
+ "attempted": { "const": false }
391
+ }
392
+ }
393
+ },
394
+ {
395
+ "if": { "properties": { "outcome": { "const": "used" } } },
396
+ "then": {
397
+ "properties": {
398
+ "requested": { "const": true },
399
+ "attempted": { "const": true }
400
+ }
401
+ }
402
+ },
403
+ {
404
+ "if": { "properties": { "outcome": { "const": "unavailable" } } },
405
+ "then": {
406
+ "properties": {
407
+ "requested": { "const": true },
408
+ "attempted": { "const": true },
409
+ "fallbackReasons": { "type": "array", "minItems": 1 }
410
+ }
411
+ }
412
+ }
413
+ ]
414
+ },
415
+ "indexSnapshot": {
416
+ "type": "object",
417
+ "additionalProperties": false,
418
+ "required": ["before", "after", "stable"],
419
+ "properties": {
420
+ "before": { "$ref": "#/definitions/sha256" },
421
+ "after": { "$ref": "#/definitions/sha256" },
422
+ "stable": { "const": true }
423
+ }
424
+ },
425
+ "fallback": {
426
+ "type": "object",
427
+ "additionalProperties": false,
428
+ "required": ["code", "capability"],
429
+ "properties": {
430
+ "code": {
431
+ "enum": [
432
+ "embedding_unavailable",
433
+ "reranking_unavailable",
434
+ "graph_unavailable",
435
+ "tokenizer_unavailable",
436
+ "egress_policy_unavailable"
437
+ ]
438
+ },
439
+ "capability": {
440
+ "enum": [
441
+ "semantic_search",
442
+ "reranking",
443
+ "graph_expansion",
444
+ "token_count",
445
+ "egress_policy"
446
+ ]
447
+ }
448
+ }
449
+ },
450
+ "configuredContext": {
451
+ "type": "object",
452
+ "additionalProperties": false,
453
+ "required": ["contextId", "scopeType", "scopeKey", "text"],
454
+ "properties": {
455
+ "contextId": { "$ref": "#/definitions/sha256" },
456
+ "scopeType": { "enum": ["global", "collection", "prefix"] },
457
+ "scopeKey": { "type": "string", "minLength": 1, "maxLength": 2048 },
458
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384 }
459
+ },
460
+ "allOf": [
461
+ {
462
+ "if": { "properties": { "scopeType": { "const": "global" } } },
463
+ "then": { "properties": { "scopeKey": { "const": "/" } } }
464
+ },
465
+ {
466
+ "if": { "properties": { "scopeType": { "const": "collection" } } },
467
+ "then": {
468
+ "properties": {
469
+ "scopeKey": {
470
+ "type": "string",
471
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}:$"
472
+ }
473
+ }
474
+ }
475
+ },
476
+ {
477
+ "if": { "properties": { "scopeType": { "const": "prefix" } } },
478
+ "then": {
479
+ "properties": {
480
+ "scopeKey": { "$ref": "#/definitions/gnoPrefixUri" }
481
+ }
482
+ }
483
+ }
484
+ ]
485
+ },
486
+ "evidence": {
487
+ "type": "object",
488
+ "additionalProperties": false,
489
+ "required": [
490
+ "evidenceId",
491
+ "uri",
492
+ "docid",
493
+ "collection",
494
+ "title",
495
+ "heading",
496
+ "startLine",
497
+ "endLine",
498
+ "text",
499
+ "sourceHash",
500
+ "mirrorHash",
501
+ "passageHash",
502
+ "modifiedAt",
503
+ "documentDate",
504
+ "observedAt",
505
+ "contextIds",
506
+ "retrievalRank",
507
+ "selectionRank",
508
+ "facets",
509
+ "trust",
510
+ "egress"
511
+ ],
512
+ "properties": {
513
+ "evidenceId": { "$ref": "#/definitions/sha256" },
514
+ "uri": { "$ref": "#/definitions/gnoUri" },
515
+ "docid": { "$ref": "#/definitions/docid" },
516
+ "collection": { "$ref": "#/definitions/collection" },
517
+ "title": { "type": ["string", "null"], "maxLength": 2048 },
518
+ "heading": { "type": ["string", "null"], "maxLength": 2048 },
519
+ "startLine": { "type": "integer", "minimum": 1 },
520
+ "endLine": { "type": "integer", "minimum": 1 },
521
+ "text": { "type": "string", "minLength": 1 },
522
+ "sourceHash": { "$ref": "#/definitions/sha256" },
523
+ "mirrorHash": { "$ref": "#/definitions/sha256" },
524
+ "passageHash": { "$ref": "#/definitions/sha256" },
525
+ "modifiedAt": { "$ref": "#/definitions/nullableDate" },
526
+ "documentDate": {
527
+ "oneOf": [
528
+ { "type": "string", "format": "date" },
529
+ { "type": "string", "format": "date-time" },
530
+ { "type": "null" }
531
+ ]
532
+ },
533
+ "observedAt": { "$ref": "#/definitions/nullableDate" },
534
+ "contextIds": {
535
+ "type": "array",
536
+ "maxItems": 128,
537
+ "items": { "$ref": "#/definitions/sha256" }
538
+ },
539
+ "retrievalRank": { "type": "integer", "minimum": 1 },
540
+ "selectionRank": { "type": "integer", "minimum": 1 },
541
+ "facets": { "$ref": "#/definitions/facets" },
542
+ "trust": { "const": "untrusted" },
543
+ "egress": {
544
+ "enum": ["local_only", "lan", "remote", "unclassified", "unavailable"]
545
+ }
546
+ }
547
+ },
548
+ "coverage": {
549
+ "type": "object",
550
+ "additionalProperties": false,
551
+ "required": [
552
+ "complete",
553
+ "requestedFacets",
554
+ "coveredFacets",
555
+ "unresolvedFacets",
556
+ "gaps"
557
+ ],
558
+ "properties": {
559
+ "complete": { "type": "boolean" },
560
+ "requestedFacets": { "$ref": "#/definitions/facets" },
561
+ "coveredFacets": {
562
+ "type": "array",
563
+ "maxItems": 128,
564
+ "items": {
565
+ "type": "object",
566
+ "additionalProperties": false,
567
+ "required": ["facet", "evidenceIds"],
568
+ "properties": {
569
+ "facet": { "type": "string", "minLength": 1, "maxLength": 512 },
570
+ "evidenceIds": {
571
+ "type": "array",
572
+ "minItems": 1,
573
+ "maxItems": 256,
574
+ "items": { "$ref": "#/definitions/sha256" }
575
+ }
576
+ }
577
+ }
578
+ },
579
+ "unresolvedFacets": { "$ref": "#/definitions/facets" },
580
+ "gaps": {
581
+ "type": "array",
582
+ "maxItems": 128,
583
+ "items": {
584
+ "type": "object",
585
+ "additionalProperties": false,
586
+ "required": ["facet", "code"],
587
+ "properties": {
588
+ "facet": { "type": "string", "minLength": 1, "maxLength": 512 },
589
+ "code": {
590
+ "enum": [
591
+ "facet_not_found",
592
+ "global_budget_exhausted",
593
+ "capability_unavailable",
594
+ "filtered_by_scope"
595
+ ]
596
+ }
597
+ }
598
+ }
599
+ }
600
+ }
601
+ },
602
+ "omission": {
603
+ "type": "object",
604
+ "additionalProperties": false,
605
+ "required": [
606
+ "candidateId",
607
+ "uri",
608
+ "docid",
609
+ "startLine",
610
+ "endLine",
611
+ "passageHash",
612
+ "sourceHash",
613
+ "mirrorHash",
614
+ "reason"
615
+ ],
616
+ "properties": {
617
+ "candidateId": { "$ref": "#/definitions/sha256" },
618
+ "uri": { "$ref": "#/definitions/gnoUri" },
619
+ "docid": { "$ref": "#/definitions/docid" },
620
+ "startLine": { "type": ["integer", "null"], "minimum": 1 },
621
+ "endLine": { "type": ["integer", "null"], "minimum": 1 },
622
+ "passageHash": { "$ref": "#/definitions/nullableSha256" },
623
+ "sourceHash": { "$ref": "#/definitions/sha256" },
624
+ "mirrorHash": { "$ref": "#/definitions/sha256" },
625
+ "reason": {
626
+ "enum": [
627
+ "duplicate",
628
+ "overlap",
629
+ "global_budget",
630
+ "redundant_coverage",
631
+ "document_share_cap",
632
+ "filtered_by_scope",
633
+ "invalid_coordinates"
634
+ ]
635
+ }
636
+ },
637
+ "oneOf": [
638
+ {
639
+ "properties": {
640
+ "startLine": { "type": "null" },
641
+ "endLine": { "type": "null" },
642
+ "passageHash": { "type": "null" }
643
+ }
644
+ },
645
+ {
646
+ "properties": {
647
+ "startLine": { "type": "integer", "minimum": 1 },
648
+ "endLine": { "type": "integer", "minimum": 1 },
649
+ "passageHash": { "$ref": "#/definitions/sha256" }
650
+ }
651
+ }
652
+ ]
653
+ },
654
+ "omissions": {
655
+ "type": "object",
656
+ "additionalProperties": false,
657
+ "required": ["total", "items", "reasonCounts", "truncated"],
658
+ "properties": {
659
+ "total": { "type": "integer", "minimum": 0 },
660
+ "items": {
661
+ "type": "array",
662
+ "maxItems": 100,
663
+ "items": { "$ref": "#/definitions/omission" }
664
+ },
665
+ "reasonCounts": {
666
+ "type": "object",
667
+ "additionalProperties": false,
668
+ "required": [
669
+ "duplicate",
670
+ "overlap",
671
+ "global_budget",
672
+ "redundant_coverage",
673
+ "document_share_cap",
674
+ "filtered_by_scope",
675
+ "invalid_coordinates"
676
+ ],
677
+ "properties": {
678
+ "duplicate": { "type": "integer", "minimum": 0 },
679
+ "overlap": { "type": "integer", "minimum": 0 },
680
+ "global_budget": { "type": "integer", "minimum": 0 },
681
+ "redundant_coverage": { "type": "integer", "minimum": 0 },
682
+ "document_share_cap": { "type": "integer", "minimum": 0 },
683
+ "filtered_by_scope": { "type": "integer", "minimum": 0 },
684
+ "invalid_coordinates": { "type": "integer", "minimum": 0 }
685
+ }
686
+ },
687
+ "truncated": { "type": "boolean" }
688
+ }
689
+ }
690
+ }
691
+ }