agent-protocols 0.9.0 → 0.10.1

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.
@@ -0,0 +1,1187 @@
1
+ /** Bundled normative structure; kept in sync by knowledge-conformance.test.ts. */
2
+ export const KNOWLEDGE_SCHEMA = {
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "$id": "https://agent-protocols.dev/schemas/agent-knowledge/1.0.schema.json",
5
+ "title": "Agent Knowledge Protocol 1.0",
6
+ "description": "Structural definitions for signed Knowledge events, read requests and service responses. Signature verification, canonical encodings, strict JSON, parsed URLs, profile-digest uniqueness, same-origin discovery, text term rules, timestamp comparisons, cursor binding, complete enumeration, batch partitions, dependency resolution, target rules, lifecycle views and acceptance remain semantic checks. Profile data conformance is separate from core validity. Recommended service limits are not protocol validity limits.",
7
+ "$ref": "#/$defs/signedEnvelope",
8
+ "$defs": {
9
+ "agentId": {
10
+ "type": "string",
11
+ "pattern": "^did:agent:[A-Za-z0-9_-]{43}$(?![\\s\\S])"
12
+ },
13
+ "eventHash": {
14
+ "type": "string",
15
+ "pattern": "^[A-Za-z0-9_-]{43}$(?![\\s\\S])"
16
+ },
17
+ "signature": {
18
+ "type": "string",
19
+ "pattern": "^[A-Za-z0-9_-]{86}$(?![\\s\\S])"
20
+ },
21
+ "timestampMs": {
22
+ "type": "integer",
23
+ "minimum": 0,
24
+ "maximum": 9007199254740991
25
+ },
26
+ "nonce": {
27
+ "type": "integer",
28
+ "minimum": 1,
29
+ "maximum": 9007199254740991
30
+ },
31
+ "nonNegativeInteger": {
32
+ "type": "integer",
33
+ "minimum": 0,
34
+ "maximum": 9007199254740991
35
+ },
36
+ "nonEmptyString": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "httpsUrl": {
41
+ "type": "string",
42
+ "format": "uri",
43
+ "pattern": "^https://[^/?#@]+(?:[/?#].*)?$(?![\\s\\S])",
44
+ "description": "Absolute HTTPS URL with host and no userinfo. Full URL parsing remains required."
45
+ },
46
+ "endpointUrl": {
47
+ "type": "string",
48
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$(?![\\s\\S])"
49
+ },
50
+ "httpsOrigin": {
51
+ "type": "string",
52
+ "pattern": "^https://[^/?#@\\s]+$(?![\\s\\S])",
53
+ "not": {
54
+ "pattern": ":443$(?![\\s\\S])"
55
+ },
56
+ "description": "Coarse HTTPS-origin shape that permits WHATWG host punctuation. Full canonical origin validation from Agent Identity remains required."
57
+ },
58
+ "extra": {
59
+ "type": "object",
60
+ "additionalProperties": true
61
+ },
62
+ "tag": {
63
+ "type": "string",
64
+ "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$(?![\\s\\S])"
65
+ },
66
+ "eventType": {
67
+ "enum": [
68
+ "knowledge.publish",
69
+ "knowledge.assess",
70
+ "knowledge.retract"
71
+ ]
72
+ },
73
+ "kind": {
74
+ "enum": [
75
+ "question",
76
+ "hypothesis",
77
+ "definition",
78
+ "observation",
79
+ "inference",
80
+ "procedure",
81
+ "resource",
82
+ "negative_result",
83
+ "synthesis",
84
+ "collection"
85
+ ]
86
+ },
87
+ "relationKind": {
88
+ "enum": [
89
+ "derived_from",
90
+ "addresses",
91
+ "tests",
92
+ "extends",
93
+ "supports",
94
+ "contradicts",
95
+ "supersedes",
96
+ "contains"
97
+ ]
98
+ },
99
+ "verdict": {
100
+ "enum": [
101
+ "supports",
102
+ "challenges",
103
+ "reproduced",
104
+ "not_reproduced",
105
+ "applied",
106
+ "inconclusive"
107
+ ]
108
+ },
109
+ "context": {
110
+ "type": "object",
111
+ "required": [
112
+ "scope",
113
+ "conditions",
114
+ "limitations"
115
+ ],
116
+ "properties": {
117
+ "scope": {
118
+ "$ref": "#/$defs/nonEmptyString"
119
+ },
120
+ "conditions": {
121
+ "type": "array",
122
+ "items": {
123
+ "$ref": "#/$defs/nonEmptyString"
124
+ },
125
+ "minItems": 0,
126
+ "uniqueItems": true
127
+ },
128
+ "limitations": {
129
+ "type": "array",
130
+ "items": {
131
+ "$ref": "#/$defs/nonEmptyString"
132
+ },
133
+ "minItems": 0,
134
+ "uniqueItems": true
135
+ }
136
+ },
137
+ "additionalProperties": false
138
+ },
139
+ "reproduction": {
140
+ "type": "object",
141
+ "required": [
142
+ "environment",
143
+ "steps",
144
+ "expected"
145
+ ],
146
+ "properties": {
147
+ "environment": {
148
+ "$ref": "#/$defs/nonEmptyString"
149
+ },
150
+ "steps": {
151
+ "type": "array",
152
+ "items": {
153
+ "$ref": "#/$defs/nonEmptyString"
154
+ },
155
+ "minItems": 1,
156
+ "uniqueItems": false
157
+ },
158
+ "expected": {
159
+ "$ref": "#/$defs/nonEmptyString"
160
+ },
161
+ "observed": {
162
+ "$ref": "#/$defs/nonEmptyString"
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "evidence": {
168
+ "type": "object",
169
+ "required": [
170
+ "url",
171
+ "description"
172
+ ],
173
+ "properties": {
174
+ "url": {
175
+ "$ref": "#/$defs/httpsUrl"
176
+ },
177
+ "description": {
178
+ "$ref": "#/$defs/nonEmptyString"
179
+ },
180
+ "digest": {
181
+ "$ref": "#/$defs/eventHash"
182
+ },
183
+ "media_type": {
184
+ "$ref": "#/$defs/nonEmptyString"
185
+ },
186
+ "role": {
187
+ "enum": [
188
+ "source",
189
+ "input",
190
+ "output",
191
+ "environment",
192
+ "validation"
193
+ ]
194
+ }
195
+ },
196
+ "additionalProperties": false,
197
+ "allOf": [
198
+ {
199
+ "if": {
200
+ "properties": {
201
+ "role": {
202
+ "const": "output"
203
+ }
204
+ },
205
+ "required": [
206
+ "role"
207
+ ]
208
+ },
209
+ "then": {
210
+ "required": [
211
+ "digest"
212
+ ]
213
+ }
214
+ }
215
+ ]
216
+ },
217
+ "relation": {
218
+ "type": "object",
219
+ "required": [
220
+ "relation",
221
+ "target"
222
+ ],
223
+ "properties": {
224
+ "relation": {
225
+ "$ref": "#/$defs/relationKind"
226
+ },
227
+ "target": {
228
+ "$ref": "#/$defs/eventHash"
229
+ }
230
+ },
231
+ "additionalProperties": false
232
+ },
233
+ "publishPayload": {
234
+ "type": "object",
235
+ "required": [
236
+ "license",
237
+ "kind",
238
+ "title",
239
+ "statement",
240
+ "language",
241
+ "context",
242
+ "basis"
243
+ ],
244
+ "properties": {
245
+ "license": {
246
+ "$ref": "#/$defs/httpsUrl"
247
+ },
248
+ "kind": {
249
+ "$ref": "#/$defs/kind"
250
+ },
251
+ "title": {
252
+ "$ref": "#/$defs/nonEmptyString"
253
+ },
254
+ "statement": {
255
+ "$ref": "#/$defs/nonEmptyString"
256
+ },
257
+ "language": {
258
+ "$ref": "#/$defs/language"
259
+ },
260
+ "context": {
261
+ "$ref": "#/$defs/context"
262
+ },
263
+ "basis": {
264
+ "$ref": "#/$defs/nonEmptyString"
265
+ },
266
+ "evidence": {
267
+ "type": "array",
268
+ "items": {
269
+ "$ref": "#/$defs/evidence"
270
+ },
271
+ "minItems": 0,
272
+ "uniqueItems": true
273
+ },
274
+ "reproduction": {
275
+ "$ref": "#/$defs/reproduction"
276
+ },
277
+ "relations": {
278
+ "type": "array",
279
+ "items": {
280
+ "$ref": "#/$defs/relation"
281
+ },
282
+ "minItems": 0,
283
+ "uniqueItems": true
284
+ },
285
+ "tags": {
286
+ "type": "array",
287
+ "items": {
288
+ "$ref": "#/$defs/tag"
289
+ },
290
+ "minItems": 0,
291
+ "uniqueItems": true
292
+ },
293
+ "extra": {
294
+ "$ref": "#/$defs/extra"
295
+ },
296
+ "profiles": {
297
+ "$ref": "#/$defs/profiles"
298
+ }
299
+ },
300
+ "additionalProperties": false,
301
+ "allOf": [
302
+ {
303
+ "if": {
304
+ "properties": {
305
+ "kind": {
306
+ "const": "resource"
307
+ }
308
+ },
309
+ "required": [
310
+ "kind"
311
+ ]
312
+ },
313
+ "then": {
314
+ "required": [
315
+ "evidence"
316
+ ],
317
+ "properties": {
318
+ "evidence": {
319
+ "contains": {
320
+ "properties": {
321
+ "role": {
322
+ "const": "output"
323
+ }
324
+ },
325
+ "required": [
326
+ "role",
327
+ "digest"
328
+ ]
329
+ }
330
+ }
331
+ }
332
+ }
333
+ },
334
+ {
335
+ "if": {
336
+ "properties": {
337
+ "kind": {
338
+ "const": "collection"
339
+ }
340
+ },
341
+ "required": [
342
+ "kind"
343
+ ]
344
+ },
345
+ "then": {
346
+ "required": [
347
+ "relations"
348
+ ],
349
+ "properties": {
350
+ "relations": {
351
+ "contains": {
352
+ "properties": {
353
+ "relation": {
354
+ "const": "contains"
355
+ }
356
+ },
357
+ "required": [
358
+ "relation"
359
+ ]
360
+ }
361
+ }
362
+ }
363
+ }
364
+ },
365
+ {
366
+ "if": {
367
+ "properties": {
368
+ "relations": {
369
+ "contains": {
370
+ "properties": {
371
+ "relation": {
372
+ "const": "contains"
373
+ }
374
+ },
375
+ "required": [
376
+ "relation"
377
+ ]
378
+ }
379
+ }
380
+ },
381
+ "required": [
382
+ "relations"
383
+ ]
384
+ },
385
+ "then": {
386
+ "properties": {
387
+ "kind": {
388
+ "const": "collection"
389
+ }
390
+ }
391
+ }
392
+ }
393
+ ]
394
+ },
395
+ "assessPayload": {
396
+ "type": "object",
397
+ "required": [
398
+ "license",
399
+ "target",
400
+ "verdict",
401
+ "summary",
402
+ "context",
403
+ "basis"
404
+ ],
405
+ "properties": {
406
+ "license": {
407
+ "$ref": "#/$defs/httpsUrl"
408
+ },
409
+ "target": {
410
+ "$ref": "#/$defs/eventHash"
411
+ },
412
+ "verdict": {
413
+ "$ref": "#/$defs/verdict"
414
+ },
415
+ "summary": {
416
+ "$ref": "#/$defs/nonEmptyString"
417
+ },
418
+ "context": {
419
+ "$ref": "#/$defs/context"
420
+ },
421
+ "basis": {
422
+ "$ref": "#/$defs/nonEmptyString"
423
+ },
424
+ "evidence": {
425
+ "type": "array",
426
+ "items": {
427
+ "$ref": "#/$defs/evidence"
428
+ },
429
+ "minItems": 0,
430
+ "uniqueItems": true
431
+ },
432
+ "reproduction": {
433
+ "$ref": "#/$defs/reproduction"
434
+ },
435
+ "extra": {
436
+ "$ref": "#/$defs/extra"
437
+ },
438
+ "profiles": {
439
+ "$ref": "#/$defs/profiles"
440
+ }
441
+ },
442
+ "additionalProperties": false,
443
+ "allOf": [
444
+ {
445
+ "if": {
446
+ "properties": {
447
+ "verdict": {
448
+ "enum": [
449
+ "reproduced",
450
+ "not_reproduced",
451
+ "applied"
452
+ ]
453
+ }
454
+ },
455
+ "required": [
456
+ "verdict"
457
+ ]
458
+ },
459
+ "then": {
460
+ "required": [
461
+ "reproduction"
462
+ ],
463
+ "properties": {
464
+ "reproduction": {
465
+ "required": [
466
+ "observed"
467
+ ]
468
+ }
469
+ }
470
+ }
471
+ }
472
+ ]
473
+ },
474
+ "retractPayload": {
475
+ "type": "object",
476
+ "required": [
477
+ "license",
478
+ "target",
479
+ "reason"
480
+ ],
481
+ "properties": {
482
+ "license": {
483
+ "$ref": "#/$defs/httpsUrl"
484
+ },
485
+ "target": {
486
+ "$ref": "#/$defs/eventHash"
487
+ },
488
+ "reason": {
489
+ "$ref": "#/$defs/nonEmptyString"
490
+ },
491
+ "extra": {
492
+ "$ref": "#/$defs/extra"
493
+ }
494
+ },
495
+ "additionalProperties": false
496
+ },
497
+ "publishEvent": {
498
+ "type": "object",
499
+ "required": [
500
+ "protocol",
501
+ "type",
502
+ "actor",
503
+ "created_at",
504
+ "nonce",
505
+ "payload"
506
+ ],
507
+ "properties": {
508
+ "protocol": {
509
+ "const": "agent-knowledge/1.0"
510
+ },
511
+ "type": {
512
+ "const": "knowledge.publish"
513
+ },
514
+ "actor": {
515
+ "$ref": "#/$defs/agentId"
516
+ },
517
+ "created_at": {
518
+ "$ref": "#/$defs/timestampMs"
519
+ },
520
+ "nonce": {
521
+ "$ref": "#/$defs/nonce"
522
+ },
523
+ "payload": {
524
+ "$ref": "#/$defs/publishPayload"
525
+ }
526
+ },
527
+ "additionalProperties": false
528
+ },
529
+ "assessEvent": {
530
+ "type": "object",
531
+ "required": [
532
+ "protocol",
533
+ "type",
534
+ "actor",
535
+ "created_at",
536
+ "nonce",
537
+ "payload"
538
+ ],
539
+ "properties": {
540
+ "protocol": {
541
+ "const": "agent-knowledge/1.0"
542
+ },
543
+ "type": {
544
+ "const": "knowledge.assess"
545
+ },
546
+ "actor": {
547
+ "$ref": "#/$defs/agentId"
548
+ },
549
+ "created_at": {
550
+ "$ref": "#/$defs/timestampMs"
551
+ },
552
+ "nonce": {
553
+ "$ref": "#/$defs/nonce"
554
+ },
555
+ "payload": {
556
+ "$ref": "#/$defs/assessPayload"
557
+ }
558
+ },
559
+ "additionalProperties": false
560
+ },
561
+ "retractEvent": {
562
+ "type": "object",
563
+ "required": [
564
+ "protocol",
565
+ "type",
566
+ "actor",
567
+ "created_at",
568
+ "nonce",
569
+ "payload"
570
+ ],
571
+ "properties": {
572
+ "protocol": {
573
+ "const": "agent-knowledge/1.0"
574
+ },
575
+ "type": {
576
+ "const": "knowledge.retract"
577
+ },
578
+ "actor": {
579
+ "$ref": "#/$defs/agentId"
580
+ },
581
+ "created_at": {
582
+ "$ref": "#/$defs/timestampMs"
583
+ },
584
+ "nonce": {
585
+ "$ref": "#/$defs/nonce"
586
+ },
587
+ "payload": {
588
+ "$ref": "#/$defs/retractPayload"
589
+ }
590
+ },
591
+ "additionalProperties": false
592
+ },
593
+ "knowledgeEvent": {
594
+ "oneOf": [
595
+ {
596
+ "$ref": "#/$defs/publishEvent"
597
+ },
598
+ {
599
+ "$ref": "#/$defs/assessEvent"
600
+ },
601
+ {
602
+ "$ref": "#/$defs/retractEvent"
603
+ }
604
+ ]
605
+ },
606
+ "signedEnvelope": {
607
+ "type": "object",
608
+ "required": [
609
+ "hash",
610
+ "event",
611
+ "signature"
612
+ ],
613
+ "properties": {
614
+ "hash": {
615
+ "$ref": "#/$defs/eventHash"
616
+ },
617
+ "event": {
618
+ "$ref": "#/$defs/knowledgeEvent"
619
+ },
620
+ "signature": {
621
+ "$ref": "#/$defs/signature"
622
+ }
623
+ },
624
+ "additionalProperties": false
625
+ },
626
+ "acceptanceRecord": {
627
+ "type": "object",
628
+ "required": [
629
+ "envelope",
630
+ "accepted_at",
631
+ "seq"
632
+ ],
633
+ "properties": {
634
+ "envelope": {
635
+ "$ref": "#/$defs/signedEnvelope"
636
+ },
637
+ "accepted_at": {
638
+ "$ref": "#/$defs/timestampMs"
639
+ },
640
+ "seq": {
641
+ "$ref": "#/$defs/nonce"
642
+ }
643
+ },
644
+ "additionalProperties": true
645
+ },
646
+ "discoveryDocument": {
647
+ "type": "object",
648
+ "required": [
649
+ "protocol",
650
+ "service"
651
+ ],
652
+ "properties": {
653
+ "protocol": {
654
+ "const": "agent-knowledge/1.0"
655
+ },
656
+ "service": {
657
+ "$ref": "#/$defs/httpsOrigin"
658
+ },
659
+ "endpoints": {
660
+ "type": "object",
661
+ "properties": {
662
+ "events": {
663
+ "$ref": "#/$defs/endpointUrl"
664
+ },
665
+ "query": {
666
+ "$ref": "#/$defs/endpointUrl"
667
+ },
668
+ "batch": {
669
+ "$ref": "#/$defs/endpointUrl"
670
+ },
671
+ "search": {
672
+ "$ref": "#/$defs/endpointUrl"
673
+ }
674
+ },
675
+ "additionalProperties": true
676
+ },
677
+ "features": {
678
+ "type": "array",
679
+ "items": {
680
+ "$ref": "#/$defs/nonEmptyString"
681
+ },
682
+ "minItems": 0,
683
+ "uniqueItems": true
684
+ },
685
+ "limits": {
686
+ "type": "object",
687
+ "additionalProperties": {
688
+ "$ref": "#/$defs/nonce"
689
+ }
690
+ },
691
+ "search_modes": {
692
+ "type": "array",
693
+ "items": {
694
+ "$ref": "#/$defs/nonEmptyString"
695
+ },
696
+ "minItems": 1,
697
+ "uniqueItems": true,
698
+ "contains": {
699
+ "const": "lexical"
700
+ }
701
+ },
702
+ "peers": {
703
+ "type": "array",
704
+ "items": {
705
+ "$ref": "#/$defs/httpsOrigin"
706
+ },
707
+ "maxItems": 32,
708
+ "uniqueItems": true
709
+ }
710
+ },
711
+ "additionalProperties": true,
712
+ "allOf": [
713
+ {
714
+ "if": {
715
+ "required": [
716
+ "features"
717
+ ],
718
+ "properties": {
719
+ "features": {
720
+ "contains": {
721
+ "const": "ranked-search"
722
+ }
723
+ }
724
+ }
725
+ },
726
+ "then": {
727
+ "required": [
728
+ "endpoints",
729
+ "search_modes"
730
+ ],
731
+ "properties": {
732
+ "endpoints": {
733
+ "required": [
734
+ "search"
735
+ ]
736
+ }
737
+ }
738
+ },
739
+ "else": {
740
+ "not": {
741
+ "required": [
742
+ "search_modes"
743
+ ]
744
+ },
745
+ "properties": {
746
+ "endpoints": {
747
+ "not": {
748
+ "required": [
749
+ "search"
750
+ ]
751
+ }
752
+ }
753
+ }
754
+ }
755
+ }
756
+ ]
757
+ },
758
+ "profileReference": {
759
+ "type": "object",
760
+ "required": [
761
+ "url",
762
+ "digest"
763
+ ],
764
+ "properties": {
765
+ "url": {
766
+ "$ref": "#/$defs/httpsUrl"
767
+ },
768
+ "digest": {
769
+ "$ref": "#/$defs/eventHash"
770
+ }
771
+ },
772
+ "additionalProperties": false
773
+ },
774
+ "profileBinding": {
775
+ "type": "object",
776
+ "required": [
777
+ "profile",
778
+ "data"
779
+ ],
780
+ "properties": {
781
+ "profile": {
782
+ "$ref": "#/$defs/profileReference"
783
+ },
784
+ "data": {
785
+ "type": "object",
786
+ "additionalProperties": true
787
+ }
788
+ },
789
+ "additionalProperties": false
790
+ },
791
+ "profiles": {
792
+ "type": "array",
793
+ "items": {
794
+ "$ref": "#/$defs/profileBinding"
795
+ },
796
+ "minItems": 0,
797
+ "uniqueItems": true,
798
+ "description": "Bindings must additionally be unique by profile.digest (semantic check). Unknown profile data is preserved, not evaluated by this schema. Arrays within data may repeat."
799
+ },
800
+ "language": {
801
+ "type": "string",
802
+ "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$(?![\\s\\S])"
803
+ },
804
+ "queryText": {
805
+ "type": "string",
806
+ "minLength": 1,
807
+ "maxLength": 1024,
808
+ "description": "Unicode scalar count, ASCII-whitespace tokenization and 1..16 lexical terms require semantic validation."
809
+ },
810
+ "searchMode": {
811
+ "enum": [
812
+ "lexical",
813
+ "semantic",
814
+ "hybrid"
815
+ ]
816
+ },
817
+ "searchFilters": {
818
+ "type": "object",
819
+ "required": [],
820
+ "properties": {
821
+ "actor": {
822
+ "$ref": "#/$defs/agentId"
823
+ },
824
+ "type": {
825
+ "$ref": "#/$defs/eventType"
826
+ },
827
+ "kind": {
828
+ "$ref": "#/$defs/kind"
829
+ },
830
+ "target": {
831
+ "$ref": "#/$defs/eventHash"
832
+ },
833
+ "relation": {
834
+ "$ref": "#/$defs/relationKind"
835
+ },
836
+ "tag": {
837
+ "$ref": "#/$defs/tag"
838
+ },
839
+ "profile": {
840
+ "$ref": "#/$defs/eventHash"
841
+ },
842
+ "language": {
843
+ "$ref": "#/$defs/language"
844
+ },
845
+ "verdict": {
846
+ "$ref": "#/$defs/verdict"
847
+ },
848
+ "created_from": {
849
+ "$ref": "#/$defs/timestampMs"
850
+ },
851
+ "created_before": {
852
+ "$ref": "#/$defs/timestampMs"
853
+ }
854
+ },
855
+ "additionalProperties": false
856
+ },
857
+ "queryRequest": {
858
+ "type": "object",
859
+ "required": [],
860
+ "properties": {
861
+ "actor": {
862
+ "$ref": "#/$defs/agentId"
863
+ },
864
+ "type": {
865
+ "$ref": "#/$defs/eventType"
866
+ },
867
+ "kind": {
868
+ "$ref": "#/$defs/kind"
869
+ },
870
+ "target": {
871
+ "$ref": "#/$defs/eventHash"
872
+ },
873
+ "relation": {
874
+ "$ref": "#/$defs/relationKind"
875
+ },
876
+ "tag": {
877
+ "$ref": "#/$defs/tag"
878
+ },
879
+ "profile": {
880
+ "$ref": "#/$defs/eventHash"
881
+ },
882
+ "language": {
883
+ "$ref": "#/$defs/language"
884
+ },
885
+ "verdict": {
886
+ "$ref": "#/$defs/verdict"
887
+ },
888
+ "created_from": {
889
+ "$ref": "#/$defs/timestampMs"
890
+ },
891
+ "created_before": {
892
+ "$ref": "#/$defs/timestampMs"
893
+ },
894
+ "after_seq": {
895
+ "$ref": "#/$defs/nonNegativeInteger"
896
+ },
897
+ "q": {
898
+ "$ref": "#/$defs/queryText"
899
+ },
900
+ "limit": {
901
+ "type": "integer",
902
+ "minimum": 1,
903
+ "maximum": 1000,
904
+ "default": 100
905
+ },
906
+ "cursor": {
907
+ "$ref": "#/$defs/nonEmptyString"
908
+ }
909
+ },
910
+ "additionalProperties": false,
911
+ "description": "Parsed core query; HTTP integers must first be parsed from decimal digits and duplicate parameters rejected. Timestamp ordering, text rules and cursor binding are additional checks."
912
+ },
913
+ "queryResponse": {
914
+ "type": "object",
915
+ "required": [
916
+ "result",
917
+ "service",
918
+ "checkpoint",
919
+ "as_of"
920
+ ],
921
+ "properties": {
922
+ "result": {
923
+ "type": "array",
924
+ "items": {
925
+ "$ref": "#/$defs/acceptanceRecord"
926
+ },
927
+ "maxItems": 1000
928
+ },
929
+ "service": {
930
+ "$ref": "#/$defs/httpsOrigin"
931
+ },
932
+ "checkpoint": {
933
+ "$ref": "#/$defs/nonNegativeInteger"
934
+ },
935
+ "as_of": {
936
+ "$ref": "#/$defs/timestampMs"
937
+ },
938
+ "next_cursor": {
939
+ "$ref": "#/$defs/nonEmptyString"
940
+ }
941
+ },
942
+ "additionalProperties": true
943
+ },
944
+ "batchRequest": {
945
+ "type": "object",
946
+ "required": [
947
+ "hashes"
948
+ ],
949
+ "properties": {
950
+ "hashes": {
951
+ "type": "array",
952
+ "items": {
953
+ "$ref": "#/$defs/eventHash"
954
+ },
955
+ "minItems": 1,
956
+ "maxItems": 100,
957
+ "uniqueItems": true
958
+ }
959
+ },
960
+ "additionalProperties": false
961
+ },
962
+ "batchResponse": {
963
+ "type": "object",
964
+ "required": [
965
+ "result",
966
+ "missing",
967
+ "service",
968
+ "checkpoint",
969
+ "as_of"
970
+ ],
971
+ "properties": {
972
+ "result": {
973
+ "type": "array",
974
+ "items": {
975
+ "$ref": "#/$defs/acceptanceRecord"
976
+ },
977
+ "maxItems": 100
978
+ },
979
+ "missing": {
980
+ "type": "array",
981
+ "items": {
982
+ "$ref": "#/$defs/eventHash"
983
+ },
984
+ "maxItems": 100,
985
+ "uniqueItems": true
986
+ },
987
+ "service": {
988
+ "$ref": "#/$defs/httpsOrigin"
989
+ },
990
+ "checkpoint": {
991
+ "$ref": "#/$defs/nonNegativeInteger"
992
+ },
993
+ "as_of": {
994
+ "$ref": "#/$defs/timestampMs"
995
+ }
996
+ },
997
+ "additionalProperties": true,
998
+ "not": {
999
+ "required": [
1000
+ "next_cursor"
1001
+ ]
1002
+ }
1003
+ },
1004
+ "searchRequest": {
1005
+ "type": "object",
1006
+ "required": [
1007
+ "text",
1008
+ "mode"
1009
+ ],
1010
+ "properties": {
1011
+ "text": {
1012
+ "$ref": "#/$defs/queryText"
1013
+ },
1014
+ "mode": {
1015
+ "$ref": "#/$defs/searchMode"
1016
+ },
1017
+ "filters": {
1018
+ "$ref": "#/$defs/searchFilters"
1019
+ },
1020
+ "limit": {
1021
+ "type": "integer",
1022
+ "minimum": 1,
1023
+ "maximum": 100,
1024
+ "default": 20
1025
+ }
1026
+ },
1027
+ "additionalProperties": false
1028
+ },
1029
+ "searchHit": {
1030
+ "type": "object",
1031
+ "required": [
1032
+ "record"
1033
+ ],
1034
+ "properties": {
1035
+ "record": {
1036
+ "$ref": "#/$defs/acceptanceRecord"
1037
+ },
1038
+ "explanation": {
1039
+ "$ref": "#/$defs/nonEmptyString"
1040
+ }
1041
+ },
1042
+ "additionalProperties": true
1043
+ },
1044
+ "ranking": {
1045
+ "type": "object",
1046
+ "required": [
1047
+ "mode",
1048
+ "id"
1049
+ ],
1050
+ "properties": {
1051
+ "mode": {
1052
+ "$ref": "#/$defs/searchMode"
1053
+ },
1054
+ "id": {
1055
+ "$ref": "#/$defs/nonEmptyString"
1056
+ }
1057
+ },
1058
+ "additionalProperties": true
1059
+ },
1060
+ "coverage": {
1061
+ "type": "object",
1062
+ "required": [
1063
+ "exhaustive",
1064
+ "reasons"
1065
+ ],
1066
+ "properties": {
1067
+ "exhaustive": {
1068
+ "type": "boolean"
1069
+ },
1070
+ "reasons": {
1071
+ "type": "array",
1072
+ "uniqueItems": true,
1073
+ "items": {
1074
+ "enum": [
1075
+ "candidate_limit",
1076
+ "index_lag",
1077
+ "approximate",
1078
+ "timeout"
1079
+ ]
1080
+ }
1081
+ }
1082
+ },
1083
+ "additionalProperties": true,
1084
+ "allOf": [
1085
+ {
1086
+ "if": {
1087
+ "properties": {
1088
+ "exhaustive": {
1089
+ "const": true
1090
+ }
1091
+ }
1092
+ },
1093
+ "then": {
1094
+ "properties": {
1095
+ "reasons": {
1096
+ "maxItems": 0
1097
+ }
1098
+ }
1099
+ },
1100
+ "else": {
1101
+ "properties": {
1102
+ "reasons": {
1103
+ "minItems": 1
1104
+ }
1105
+ }
1106
+ }
1107
+ }
1108
+ ]
1109
+ },
1110
+ "searchResponse": {
1111
+ "type": "object",
1112
+ "required": [
1113
+ "result",
1114
+ "service",
1115
+ "checkpoint",
1116
+ "as_of",
1117
+ "ranking",
1118
+ "coverage"
1119
+ ],
1120
+ "properties": {
1121
+ "result": {
1122
+ "type": "array",
1123
+ "items": {
1124
+ "$ref": "#/$defs/searchHit"
1125
+ },
1126
+ "maxItems": 100
1127
+ },
1128
+ "service": {
1129
+ "$ref": "#/$defs/httpsOrigin"
1130
+ },
1131
+ "checkpoint": {
1132
+ "$ref": "#/$defs/nonNegativeInteger"
1133
+ },
1134
+ "as_of": {
1135
+ "$ref": "#/$defs/timestampMs"
1136
+ },
1137
+ "ranking": {
1138
+ "$ref": "#/$defs/ranking"
1139
+ },
1140
+ "coverage": {
1141
+ "$ref": "#/$defs/coverage"
1142
+ }
1143
+ },
1144
+ "additionalProperties": true,
1145
+ "allOf": [
1146
+ {
1147
+ "if": {
1148
+ "properties": {
1149
+ "ranking": {
1150
+ "properties": {
1151
+ "mode": {
1152
+ "enum": [
1153
+ "semantic",
1154
+ "hybrid"
1155
+ ]
1156
+ }
1157
+ }
1158
+ }
1159
+ }
1160
+ },
1161
+ "then": {
1162
+ "properties": {
1163
+ "coverage": {
1164
+ "properties": {
1165
+ "exhaustive": {
1166
+ "const": false
1167
+ },
1168
+ "reasons": {
1169
+ "contains": {
1170
+ "const": "approximate"
1171
+ }
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+ }
1177
+ }
1178
+ ],
1179
+ "not": {
1180
+ "required": [
1181
+ "next_cursor"
1182
+ ]
1183
+ }
1184
+ }
1185
+ }
1186
+ };
1187
+ //# sourceMappingURL=knowledge-schema.js.map