mcauduro commited on
Commit
1e3bc19
·
verified ·
1 Parent(s): 2b3a4c5

DeepStack API v2 contracts, package 7726f3ef2d6c (CC-BY-4.0)

Browse files
Files changed (37) hide show
  1. LICENSE +396 -0
  2. README.md +43 -0
  3. examples/ai-stream/valid-meta.json +11 -0
  4. examples/api-key/valid-dogfood-key.json +39 -0
  5. examples/api-key/valid-rotated-in-grace.json +39 -0
  6. examples/evidence-pack-items/valid-two-items.json +52 -0
  7. examples/evidence-pack-ref/valid-pre-lock-pack.json +14 -0
  8. examples/grounded-answer/valid-abstains-before-lock.json +16 -0
  9. examples/grounded-answer/valid-cited.json +28 -0
  10. examples/grounded-answer/valid-mcp-v2-answer.json +30 -0
  11. examples/intelligence-request/valid-post-lock-chat.json +31 -0
  12. examples/intelligence-request/valid-pre-lock-chat.json +31 -0
  13. examples/model-execution-receipt/valid-fake-unknown-usage.json +21 -0
  14. examples/model-execution-receipt/valid-gateway-cost-latency-observed.json +31 -0
  15. examples/product-event/valid-account-measurement.json +14 -0
  16. examples/product-event/valid-machine-without-subject.json +14 -0
  17. examples/publication-record/valid-first-trackrecord.json +16 -0
  18. examples/publication-record/valid-mcp-v2-trackrecord.json +16 -0
  19. examples/publication-record/valid-second-version.json +16 -0
  20. examples/scenario-run/valid-mcp-v2-scenario.json +61 -0
  21. examples/scenario-run/valid-score-calculator.json +30 -0
  22. examples/search-result/valid-mcp-v2-search.json +174 -0
  23. examples/search-result/valid-page-with-counter-evidence.json +120 -0
  24. examples/search-result/valid-withheld-pre-lock.json +45 -0
  25. manifest.json +662 -0
  26. schemas/ai-stream.schema.json +327 -0
  27. schemas/api-key.schema.json +289 -0
  28. schemas/common.schema.json +139 -0
  29. schemas/evidence-pack-items.schema.json +66 -0
  30. schemas/evidence-pack-ref.schema.json +20 -0
  31. schemas/grounded-answer.schema.json +58 -0
  32. schemas/intelligence-request.schema.json +38 -0
  33. schemas/model-execution-receipt.schema.json +221 -0
  34. schemas/product-event.schema.json +95 -0
  35. schemas/publication-record.schema.json +81 -0
  36. schemas/scenario-run.schema.json +45 -0
  37. schemas/search-result.schema.json +157 -0
LICENSE ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Attribution 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution 4.0 International Public License
58
+
59
+ By exercising the Licensed Rights (defined below), You accept and agree
60
+ to be bound by the terms and conditions of this Creative Commons
61
+ Attribution 4.0 International Public License ("Public License"). To the
62
+ extent this Public License may be interpreted as a contract, You are
63
+ granted the Licensed Rights in consideration of Your acceptance of
64
+ these terms and conditions, and the Licensor grants You such rights in
65
+ consideration of benefits the Licensor receives from making the
66
+ Licensed Material available under these terms and conditions.
67
+
68
+
69
+ Section 1 -- Definitions.
70
+
71
+ a. Adapted Material means material subject to Copyright and Similar
72
+ Rights that is derived from or based upon the Licensed Material
73
+ and in which the Licensed Material is translated, altered,
74
+ arranged, transformed, or otherwise modified in a manner requiring
75
+ permission under the Copyright and Similar Rights held by the
76
+ Licensor. For purposes of this Public License, where the Licensed
77
+ Material is a musical work, performance, or sound recording,
78
+ Adapted Material is always produced where the Licensed Material is
79
+ synched in timed relation with a moving image.
80
+
81
+ b. Adapter's License means the license You apply to Your Copyright
82
+ and Similar Rights in Your contributions to Adapted Material in
83
+ accordance with the terms and conditions of this Public License.
84
+
85
+ c. Copyright and Similar Rights means copyright and/or similar rights
86
+ closely related to copyright including, without limitation,
87
+ performance, broadcast, sound recording, and Sui Generis Database
88
+ Rights, without regard to how the rights are labeled or
89
+ categorized. For purposes of this Public License, the rights
90
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
91
+ Rights.
92
+
93
+ d. Effective Technological Measures means those measures that, in the
94
+ absence of proper authority, may not be circumvented under laws
95
+ fulfilling obligations under Article 11 of the WIPO Copyright
96
+ Treaty adopted on December 20, 1996, and/or similar international
97
+ agreements.
98
+
99
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
100
+ any other exception or limitation to Copyright and Similar Rights
101
+ that applies to Your use of the Licensed Material.
102
+
103
+ f. Licensed Material means the artistic or literary work, database,
104
+ or other material to which the Licensor applied this Public
105
+ License.
106
+
107
+ g. Licensed Rights means the rights granted to You subject to the
108
+ terms and conditions of this Public License, which are limited to
109
+ all Copyright and Similar Rights that apply to Your use of the
110
+ Licensed Material and that the Licensor has authority to license.
111
+
112
+ h. Licensor means the individual(s) or entity(ies) granting rights
113
+ under this Public License.
114
+
115
+ i. Share means to provide material to the public by any means or
116
+ process that requires permission under the Licensed Rights, such
117
+ as reproduction, public display, public performance, distribution,
118
+ dissemination, communication, or importation, and to make material
119
+ available to the public including in ways that members of the
120
+ public may access the material from a place and at a time
121
+ individually chosen by them.
122
+
123
+ j. Sui Generis Database Rights means rights other than copyright
124
+ resulting from Directive 96/9/EC of the European Parliament and of
125
+ the Council of 11 March 1996 on the legal protection of databases,
126
+ as amended and/or succeeded, as well as other essentially
127
+ equivalent rights anywhere in the world.
128
+
129
+ k. You means the individual or entity exercising the Licensed Rights
130
+ under this Public License. Your has a corresponding meaning.
131
+
132
+
133
+ Section 2 -- Scope.
134
+
135
+ a. License grant.
136
+
137
+ 1. Subject to the terms and conditions of this Public License,
138
+ the Licensor hereby grants You a worldwide, royalty-free,
139
+ non-sublicensable, non-exclusive, irrevocable license to
140
+ exercise the Licensed Rights in the Licensed Material to:
141
+
142
+ a. reproduce and Share the Licensed Material, in whole or
143
+ in part; and
144
+
145
+ b. produce, reproduce, and Share Adapted Material.
146
+
147
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
148
+ Exceptions and Limitations apply to Your use, this Public
149
+ License does not apply, and You do not need to comply with
150
+ its terms and conditions.
151
+
152
+ 3. Term. The term of this Public License is specified in Section
153
+ 6(a).
154
+
155
+ 4. Media and formats; technical modifications allowed. The
156
+ Licensor authorizes You to exercise the Licensed Rights in
157
+ all media and formats whether now known or hereafter created,
158
+ and to make technical modifications necessary to do so. The
159
+ Licensor waives and/or agrees not to assert any right or
160
+ authority to forbid You from making technical modifications
161
+ necessary to exercise the Licensed Rights, including
162
+ technical modifications necessary to circumvent Effective
163
+ Technological Measures. For purposes of this Public License,
164
+ simply making modifications authorized by this Section 2(a)
165
+ (4) never produces Adapted Material.
166
+
167
+ 5. Downstream recipients.
168
+
169
+ a. Offer from the Licensor -- Licensed Material. Every
170
+ recipient of the Licensed Material automatically
171
+ receives an offer from the Licensor to exercise the
172
+ Licensed Rights under the terms and conditions of this
173
+ Public License.
174
+
175
+ b. No downstream restrictions. You may not offer or impose
176
+ any additional or different terms or conditions on, or
177
+ apply any Effective Technological Measures to, the
178
+ Licensed Material if doing so restricts exercise of the
179
+ Licensed Rights by any recipient of the Licensed
180
+ Material.
181
+
182
+ 6. No endorsement. Nothing in this Public License constitutes or
183
+ may be construed as permission to assert or imply that You
184
+ are, or that Your use of the Licensed Material is, connected
185
+ with, or sponsored, endorsed, or granted official status by,
186
+ the Licensor or others designated to receive attribution as
187
+ provided in Section 3(a)(1)(A)(i).
188
+
189
+ b. Other rights.
190
+
191
+ 1. Moral rights, such as the right of integrity, are not
192
+ licensed under this Public License, nor are publicity,
193
+ privacy, and/or other similar personality rights; however, to
194
+ the extent possible, the Licensor waives and/or agrees not to
195
+ assert any such rights held by the Licensor to the limited
196
+ extent necessary to allow You to exercise the Licensed
197
+ Rights, but not otherwise.
198
+
199
+ 2. Patent and trademark rights are not licensed under this
200
+ Public License.
201
+
202
+ 3. To the extent possible, the Licensor waives any right to
203
+ collect royalties from You for the exercise of the Licensed
204
+ Rights, whether directly or through a collecting society
205
+ under any voluntary or waivable statutory or compulsory
206
+ licensing scheme. In all other cases the Licensor expressly
207
+ reserves any right to collect such royalties.
208
+
209
+
210
+ Section 3 -- License Conditions.
211
+
212
+ Your exercise of the Licensed Rights is expressly made subject to the
213
+ following conditions.
214
+
215
+ a. Attribution.
216
+
217
+ 1. If You Share the Licensed Material (including in modified
218
+ form), You must:
219
+
220
+ a. retain the following if it is supplied by the Licensor
221
+ with the Licensed Material:
222
+
223
+ i. identification of the creator(s) of the Licensed
224
+ Material and any others designated to receive
225
+ attribution, in any reasonable manner requested by
226
+ the Licensor (including by pseudonym if
227
+ designated);
228
+
229
+ ii. a copyright notice;
230
+
231
+ iii. a notice that refers to this Public License;
232
+
233
+ iv. a notice that refers to the disclaimer of
234
+ warranties;
235
+
236
+ v. a URI or hyperlink to the Licensed Material to the
237
+ extent reasonably practicable;
238
+
239
+ b. indicate if You modified the Licensed Material and
240
+ retain an indication of any previous modifications; and
241
+
242
+ c. indicate the Licensed Material is licensed under this
243
+ Public License, and include the text of, or the URI or
244
+ hyperlink to, this Public License.
245
+
246
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
247
+ reasonable manner based on the medium, means, and context in
248
+ which You Share the Licensed Material. For example, it may be
249
+ reasonable to satisfy the conditions by providing a URI or
250
+ hyperlink to a resource that includes the required
251
+ information.
252
+
253
+ 3. If requested by the Licensor, You must remove any of the
254
+ information required by Section 3(a)(1)(A) to the extent
255
+ reasonably practicable.
256
+
257
+ 4. If You Share Adapted Material You produce, the Adapter's
258
+ License You apply must not prevent recipients of the Adapted
259
+ Material from complying with this Public License.
260
+
261
+
262
+ Section 4 -- Sui Generis Database Rights.
263
+
264
+ Where the Licensed Rights include Sui Generis Database Rights that
265
+ apply to Your use of the Licensed Material:
266
+
267
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
268
+ to extract, reuse, reproduce, and Share all or a substantial
269
+ portion of the contents of the database;
270
+
271
+ b. if You include all or a substantial portion of the database
272
+ contents in a database in which You have Sui Generis Database
273
+ Rights, then the database in which You have Sui Generis Database
274
+ Rights (but not its individual contents) is Adapted Material; and
275
+
276
+ c. You must comply with the conditions in Section 3(a) if You Share
277
+ all or a substantial portion of the contents of the database.
278
+
279
+ For the avoidance of doubt, this Section 4 supplements and does not
280
+ replace Your obligations under this Public License where the Licensed
281
+ Rights include other Copyright and Similar Rights.
282
+
283
+
284
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
285
+
286
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
287
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
288
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
289
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
290
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
291
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
292
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
293
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
294
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
295
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
296
+
297
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
298
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
299
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
300
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
301
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
302
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
303
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
304
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
305
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
306
+
307
+ c. The disclaimer of warranties and limitation of liability provided
308
+ above shall be interpreted in a manner that, to the extent
309
+ possible, most closely approximates an absolute disclaimer and
310
+ waiver of all liability.
311
+
312
+
313
+ Section 6 -- Term and Termination.
314
+
315
+ a. This Public License applies for the term of the Copyright and
316
+ Similar Rights licensed here. However, if You fail to comply with
317
+ this Public License, then Your rights under this Public License
318
+ terminate automatically.
319
+
320
+ b. Where Your right to use the Licensed Material has terminated under
321
+ Section 6(a), it reinstates:
322
+
323
+ 1. automatically as of the date the violation is cured, provided
324
+ it is cured within 30 days of Your discovery of the
325
+ violation; or
326
+
327
+ 2. upon express reinstatement by the Licensor.
328
+
329
+ For the avoidance of doubt, this Section 6(b) does not affect any
330
+ right the Licensor may have to seek remedies for Your violations
331
+ of this Public License.
332
+
333
+ c. For the avoidance of doubt, the Licensor may also offer the
334
+ Licensed Material under separate terms or conditions or stop
335
+ distributing the Licensed Material at any time; however, doing so
336
+ will not terminate this Public License.
337
+
338
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
339
+ License.
340
+
341
+
342
+ Section 7 -- Other Terms and Conditions.
343
+
344
+ a. The Licensor shall not be bound by any additional or different
345
+ terms or conditions communicated by You unless expressly agreed.
346
+
347
+ b. Any arrangements, understandings, or agreements regarding the
348
+ Licensed Material not stated herein are separate from and
349
+ independent of the terms and conditions of this Public License.
350
+
351
+
352
+ Section 8 -- Interpretation.
353
+
354
+ a. For the avoidance of doubt, this Public License does not, and
355
+ shall not be interpreted to, reduce, limit, restrict, or impose
356
+ conditions on any use of the Licensed Material that could lawfully
357
+ be made without permission under this Public License.
358
+
359
+ b. To the extent possible, if any provision of this Public License is
360
+ deemed unenforceable, it shall be automatically reformed to the
361
+ minimum extent necessary to make it enforceable. If the provision
362
+ cannot be reformed, it shall be severed from this Public License
363
+ without affecting the enforceability of the remaining terms and
364
+ conditions.
365
+
366
+ c. No term or condition of this Public License will be waived and no
367
+ failure to comply consented to unless expressly agreed to by the
368
+ Licensor.
369
+
370
+ d. Nothing in this Public License constitutes or may be interpreted
371
+ as a limitation upon, or waiver of, any privileges and immunities
372
+ that apply to the Licensor or You, including from the legal
373
+ processes of any jurisdiction or authority.
374
+
375
+
376
+ =======================================================================
377
+
378
+ Creative Commons is not a party to its public
379
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
380
+ its public licenses to material it publishes and in those instances
381
+ will be considered the “Licensor.” The text of the Creative Commons
382
+ public licenses is dedicated to the public domain under the CC0 Public
383
+ Domain Dedication. Except for the limited purpose of indicating that
384
+ material is shared under a Creative Commons public license or as
385
+ otherwise permitted by the Creative Commons policies published at
386
+ creativecommons.org/policies, Creative Commons does not authorize the
387
+ use of the trademark "Creative Commons" or any other trademark or logo
388
+ of Creative Commons without its prior written consent including,
389
+ without limitation, in connection with any unauthorized modifications
390
+ to any of its public licenses or any other arrangements,
391
+ understandings, or agreements concerning use of licensed material. For
392
+ the avoidance of doubt, this paragraph does not form part of the
393
+ public licenses.
394
+
395
+ Creative Commons may be contacted at creativecommons.org.
396
+
README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ pretty_name: DeepStack API v2 contracts
4
+ language:
5
+ - en
6
+ tags:
7
+ - json-schema
8
+ - api
9
+ - forecasting
10
+ - contracts
11
+ size_categories:
12
+ - n<1K
13
+ viewer: false
14
+ ---
15
+
16
+ # DeepStack API v2 contracts
17
+
18
+ The JSON Schemas of the DeepStack ML API v2 (`/v2/answers:stream`, `/v2/search`, `/v2/scenarios/runs`,
19
+ `/v2/trackrecord`) and valid examples of each. `/v2` serves the same contracts as `/v1`: a GroundedAnswer is a
20
+ GroundedAnswer, whoever asks.
21
+
22
+ - **Items:** 34 files (12 schemas, 22 examples), listed in `manifest.json` with sha256, size,
23
+ licence, source and rights per item.
24
+ - **Package id:** `7726f3ef2d6c89a351740d8ea2a96ce1dffe6b3c1a0e6e868895457fd4415d64` (sha256 of the canonical list of item paths and hashes).
25
+ - **Excluded:** 33 candidate files, each with its reason in `manifest.json` (negative fixtures are not
26
+ examples; nothing that cites another source, names a model provider or names an open question is distributed).
27
+ - **What it is not:** no reader data, no forecast of an open question, no passage of a paid or third-party source, no
28
+ key or secret. The examples are synthetic fixtures: their numbers and texts are illustrations of the shape, not
29
+ facts about any company.
30
+
31
+ ## Licence
32
+
33
+ Every item is DeepStack's own work, released under the **Creative Commons Attribution 4.0 International** licence
34
+ (`cc-by-4.0`). The full legal code is in `LICENSE`. You may share and adapt the material for any purpose, provided you
35
+ give appropriate credit:
36
+
37
+ > DeepStack API v2 contracts, by DeepStack, licensed under CC BY 4.0.
38
+
39
+ ## Verify
40
+
41
+ `manifest.json` lists the sha256 of every file; the package id is reproducible from it. The package is built by
42
+ `python -m deepstack_ml.publication.distribution` from the DeepStack repository, deterministically, and checked for
43
+ leaks before it is uploaded.
examples/ai-stream/valid-meta.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "req-a-1",
4
+ "seq": 0,
5
+ "event": "meta",
6
+ "data": {
7
+ "environment": "fake",
8
+ "phase": "pre_lock",
9
+ "origin": "ml"
10
+ }
11
+ }
examples/api-key/valid-dogfood-key.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "key_id": "key_0123456789abcdef",
4
+ "tenant_id": "tenant:deepstack-internal",
5
+ "label": "dogfood mcp v2",
6
+ "scopes": [
7
+ "answers:analyst",
8
+ "search:analyst",
9
+ "scenarios:analyst",
10
+ "trackrecord:read"
11
+ ],
12
+ "rights": {
13
+ "policy_version": "policy-r0",
14
+ "purposes": [
15
+ "read",
16
+ "process"
17
+ ]
18
+ },
19
+ "quota": {
20
+ "per_minute": 30,
21
+ "per_day": 2000,
22
+ "concurrency": 2
23
+ },
24
+ "status": "active",
25
+ "phase": "pre_lock",
26
+ "hash": {
27
+ "algorithm": "pbkdf2-hmac-sha256",
28
+ "iterations": 20000,
29
+ "salt": "00000000000000000000000000000000",
30
+ "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
31
+ },
32
+ "created_at": "2026-10-29T15:00:00Z",
33
+ "expires_at": null,
34
+ "rotated_from": null,
35
+ "rotated_to": null,
36
+ "grace_until": null,
37
+ "revoked_at": null,
38
+ "revoked_reason": null
39
+ }
examples/api-key/valid-rotated-in-grace.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "key_id": "key_fedcba9876543210",
4
+ "tenant_id": "tenant:deepstack-internal",
5
+ "label": "dogfood mcp v2",
6
+ "scopes": [
7
+ "answers:analyst",
8
+ "search:analyst",
9
+ "scenarios:analyst",
10
+ "trackrecord:read"
11
+ ],
12
+ "rights": {
13
+ "policy_version": "policy-r0",
14
+ "purposes": [
15
+ "read",
16
+ "process"
17
+ ]
18
+ },
19
+ "quota": {
20
+ "per_minute": 30,
21
+ "per_day": 2000,
22
+ "concurrency": 2
23
+ },
24
+ "status": "rotating",
25
+ "phase": "pre_lock",
26
+ "hash": {
27
+ "algorithm": "pbkdf2-hmac-sha256",
28
+ "iterations": 20000,
29
+ "salt": "00000000000000000000000000000000",
30
+ "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
31
+ },
32
+ "created_at": "2026-10-29T15:00:00Z",
33
+ "expires_at": null,
34
+ "rotated_from": null,
35
+ "rotated_to": "key_0123456789abcdef",
36
+ "grace_until": "2026-10-29T16:00:00Z",
37
+ "revoked_at": null,
38
+ "revoked_reason": null
39
+ }
examples/evidence-pack-items/valid-two-items.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "pack_id": "pack-r1-items-1",
4
+ "content_hash": "b2b28b814be5ec4f99347fa51df1eee6e056810df83b73ae33dcbab680f98588",
5
+ "as_of": "2026-10-28T23:00:00Z",
6
+ "policy_version": "policy-r1",
7
+ "phase": "pre_lock",
8
+ "items": [
9
+ {
10
+ "evidence_id": "ev-1",
11
+ "source_id": "src_a",
12
+ "source_url": "https://example.org/a",
13
+ "span": "HBM supply remains the binding constraint on accelerator shipments.",
14
+ "clocks": {
15
+ "available_at": "2026-10-01T00:00:00Z",
16
+ "published_at": "2026-10-01T00:00:00Z",
17
+ "captured_at": null
18
+ },
19
+ "rights_purposes": [
20
+ "read",
21
+ "process"
22
+ ],
23
+ "polarity": "bull",
24
+ "lang": "en",
25
+ "rank": 1,
26
+ "score": 0.0325,
27
+ "reasons": []
28
+ },
29
+ {
30
+ "evidence_id": "ev-2",
31
+ "source_id": "src_b",
32
+ "source_url": "https://example.org/b",
33
+ "span": "A third HBM supplier qualified and allocations exceed packaging slots.",
34
+ "clocks": {
35
+ "available_at": "2026-10-15",
36
+ "published_at": null,
37
+ "captured_at": null
38
+ },
39
+ "rights_purposes": [
40
+ "read",
41
+ "process"
42
+ ],
43
+ "polarity": "bear",
44
+ "lang": null,
45
+ "rank": 2,
46
+ "score": 0.0161,
47
+ "reasons": [
48
+ "counter_evidence"
49
+ ]
50
+ }
51
+ ]
52
+ }
examples/evidence-pack-ref/valid-pre-lock-pack.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "pack_id": "pack-r0-1",
4
+ "snapshot_id": "snap-r0-fixture",
5
+ "content_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
+ "policy_version": "policy-r0",
7
+ "as_of": "2026-10-28T23:00:00Z",
8
+ "phase": "pre_lock",
9
+ "allowed_evidence_ids": [
10
+ "ev-1",
11
+ "ev-2"
12
+ ],
13
+ "expires_at": "2026-10-28T23:15:00Z"
14
+ }
examples/grounded-answer/valid-abstains-before-lock.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "answer_id": "ans-1",
4
+ "request_id": "req-a-1",
5
+ "pack_id": "pack-r0-1",
6
+ "claim_refs": [],
7
+ "citation_refs": [],
8
+ "abstentions": [
9
+ {
10
+ "reason": "reserved_before_lock"
11
+ }
12
+ ],
13
+ "tool_receipt_ids": [],
14
+ "execution_receipt_id": "exec-1",
15
+ "status": "complete"
16
+ }
examples/grounded-answer/valid-cited.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "answer_id": "ans-1",
4
+ "request_id": "req-a-1",
5
+ "pack_id": "pack-r0-1",
6
+ "claim_refs": [
7
+ {
8
+ "claim_id": "c1",
9
+ "text": "Observed fact.",
10
+ "kind": "observed",
11
+ "citation_ids": [
12
+ "cit1"
13
+ ]
14
+ }
15
+ ],
16
+ "citation_refs": [
17
+ {
18
+ "citation_id": "cit1",
19
+ "evidence_id": "ev-1",
20
+ "source_url": "https://example.org/a",
21
+ "span": "fact"
22
+ }
23
+ ],
24
+ "abstentions": [],
25
+ "tool_receipt_ids": [],
26
+ "execution_receipt_id": "exec-1",
27
+ "status": "complete"
28
+ }
examples/grounded-answer/valid-mcp-v2-answer.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "answer_id": "ans-2a57cdd3b556e21d",
4
+ "request_id": "mcp-1a64e542c87342fbb0fa",
5
+ "pack_id": "pack-9539cb64c9b9d89de147",
6
+ "claim_refs": [
7
+ {
8
+ "claim_id": "c1",
9
+ "text": "FIXTURE: HBM supply remains the binding constraint on accelerator shipments; the vendor says it is sold out through 2026.",
10
+ "kind": "observed",
11
+ "citation_ids": [
12
+ "cit1"
13
+ ]
14
+ }
15
+ ],
16
+ "citation_refs": [
17
+ {
18
+ "citation_id": "cit1",
19
+ "evidence_id": "ev-fixture-bull-1",
20
+ "source_url": "https://example.org/deepstack-fixture/ev-fixture-bull-1",
21
+ "span": "FIXTURE: HBM supply remains the binding constraint on accelerator shipments; the vendor says it is sold out through 2026."
22
+ }
23
+ ],
24
+ "abstentions": [],
25
+ "tool_receipt_ids": [
26
+ "tool-030ca896004c4f7a971cdb48afffa76a"
27
+ ],
28
+ "execution_receipt_id": "exec-72ee36b453b445ba995415b0c3eaa550",
29
+ "status": "complete"
30
+ }
examples/intelligence-request/valid-post-lock-chat.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "req-a-1",
4
+ "trace_id": "trace-1",
5
+ "question_id": "th001-t41",
6
+ "event_version": 1,
7
+ "as_of": "2026-10-28T23:00:00Z",
8
+ "evidence_snapshot_id": "snap-r0-fixture",
9
+ "phase": "post_lock",
10
+ "purpose": "analyst",
11
+ "rights_scope": {
12
+ "policy_version": "policy-r0",
13
+ "purposes": [
14
+ "read",
15
+ "process"
16
+ ]
17
+ },
18
+ "principal_scope": {
19
+ "kind": "reader",
20
+ "subject_id": "sub_reader_aaaa1111",
21
+ "tenant_id": "public"
22
+ },
23
+ "recipe_id": "analyst-r0-fake",
24
+ "mode": "chat",
25
+ "messages": [
26
+ {
27
+ "role": "user",
28
+ "content": "What would push this up?"
29
+ }
30
+ ]
31
+ }
examples/intelligence-request/valid-pre-lock-chat.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "req-a-1",
4
+ "trace_id": "trace-1",
5
+ "question_id": "th001-t41",
6
+ "event_version": 1,
7
+ "as_of": "2026-10-28T23:00:00Z",
8
+ "evidence_snapshot_id": "snap-r0-fixture",
9
+ "phase": "pre_lock",
10
+ "purpose": "analyst",
11
+ "rights_scope": {
12
+ "policy_version": "policy-r0",
13
+ "purposes": [
14
+ "read",
15
+ "process"
16
+ ]
17
+ },
18
+ "principal_scope": {
19
+ "kind": "reader",
20
+ "subject_id": "sub_reader_bbbb2222",
21
+ "tenant_id": "public"
22
+ },
23
+ "recipe_id": "analyst-r0-fake",
24
+ "mode": "chat",
25
+ "messages": [
26
+ {
27
+ "role": "user",
28
+ "content": "What would push this up?"
29
+ }
30
+ ]
31
+ }
examples/model-execution-receipt/valid-fake-unknown-usage.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "execution_id": "exec-1",
4
+ "attempt_id": "att-1",
5
+ "environment": "fake",
6
+ "provider": "fake",
7
+ "model_id": "fake-analyst",
8
+ "revision": "unknown",
9
+ "prompt_hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
10
+ "template_hash": null,
11
+ "schema_hash": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
12
+ "adapter_hash": null,
13
+ "started_at": "2026-10-28T23:00:00Z",
14
+ "completed_at": "2026-10-28T23:00:02Z",
15
+ "attempts": 1,
16
+ "usage": {
17
+ "status": "unknown"
18
+ },
19
+ "output_hash": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
20
+ "error_class": null
21
+ }
examples/model-execution-receipt/valid-gateway-cost-latency-observed.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "execution_id": "exec-1",
4
+ "attempt_id": "att-1",
5
+ "environment": "local",
6
+ "provider": "hf_tei",
7
+ "model_id": "fake-analyst",
8
+ "revision": "unknown",
9
+ "prompt_hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
10
+ "template_hash": null,
11
+ "schema_hash": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
12
+ "adapter_hash": null,
13
+ "started_at": "2026-10-28T23:00:00Z",
14
+ "completed_at": "2026-10-28T23:00:02Z",
15
+ "attempts": 1,
16
+ "usage": {
17
+ "status": "known",
18
+ "hardware_seconds": 0.985
19
+ },
20
+ "output_hash": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
21
+ "error_class": null,
22
+ "cost": {
23
+ "usd": 0.200219,
24
+ "status": "upper_bound",
25
+ "basis": "(call 0.985 s + scale-to-zero window 900 s) x 0.8 USD/h",
26
+ "budget_ref": "endpoint:org/ds-granite-tei"
27
+ },
28
+ "latency_ms": 985.0,
29
+ "model_observed": "ibm-granite/granite-embedding-97m-multilingual-r2",
30
+ "revision_observed": "835ad140"
31
+ }
examples/product-event/valid-account-measurement.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "event_id": "ev_aaaaaaaaaaaaaaaaaaaaaaaa",
4
+ "kind": "analyst_completed",
5
+ "cohort": "account",
6
+ "subject_ref": "sp_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
7
+ "tenant_id": "public",
8
+ "consent": "measurement",
9
+ "occurred_at": "2026-10-29T15:00:00Z",
10
+ "object_id": "th001-t41",
11
+ "stage": "done",
12
+ "latency_bucket": "1_5s",
13
+ "version": "r4"
14
+ }
examples/product-event/valid-machine-without-subject.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "event_id": "ev_cccccccccccccccccccccccc",
4
+ "kind": "analyst_completed",
5
+ "cohort": "machine",
6
+ "subject_ref": null,
7
+ "tenant_id": "tenant:deepstack-internal",
8
+ "consent": "essential",
9
+ "occurred_at": "2026-10-29T15:00:00Z",
10
+ "object_id": "th001-t41",
11
+ "stage": "done",
12
+ "latency_bucket": "1_5s",
13
+ "version": "r4"
14
+ }
examples/publication-record/valid-first-trackrecord.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "publication_id": "pub_111111111111111111111111",
4
+ "kind": "trackrecord",
5
+ "version": 1,
6
+ "content_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
+ "artifact_key": "objects/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
8
+ "media_type": "application/json",
9
+ "size_bytes": 512,
10
+ "prev_publication_id": null,
11
+ "source_refs": [
12
+ "cohort-r0-local"
13
+ ],
14
+ "committed_at": "2026-10-29T15:00:00Z",
15
+ "environment": "local"
16
+ }
examples/publication-record/valid-mcp-v2-trackrecord.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_key": "objects/1b36e45a4022e82874667752698f7f86da619113953bf6fb6c59a8715c9633f7.json",
3
+ "committed_at": "2026-10-29T17:54:36Z",
4
+ "content_sha256": "1b36e45a4022e82874667752698f7f86da619113953bf6fb6c59a8715c9633f7",
5
+ "environment": "local",
6
+ "kind": "trackrecord",
7
+ "media_type": "application/json",
8
+ "prev_publication_id": null,
9
+ "publication_id": "pub_fe2bfbaf477f57848ff34f6e",
10
+ "schema_version": "ml.v1",
11
+ "size_bytes": 2485,
12
+ "source_refs": [
13
+ "c1"
14
+ ],
15
+ "version": 1
16
+ }
examples/publication-record/valid-second-version.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "publication_id": "pub_222222222222222222222222",
4
+ "kind": "trackrecord",
5
+ "version": 2,
6
+ "content_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
+ "artifact_key": "objects/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
8
+ "media_type": "application/json",
9
+ "size_bytes": 512,
10
+ "prev_publication_id": "pub_111111111111111111111111",
11
+ "source_refs": [
12
+ "cohort-r0-local"
13
+ ],
14
+ "committed_at": "2026-10-29T15:00:00Z",
15
+ "environment": "local"
16
+ }
examples/scenario-run/valid-mcp-v2-scenario.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "run_id": "scn-2073b35d48c44983b915609bb2059097",
4
+ "request_id": "mcp-7eb024132a5d4ec9a0c6",
5
+ "question_id": "th001-t41",
6
+ "tool_id": "score_calculator",
7
+ "tool_version": "1",
8
+ "domain": "scoring",
9
+ "method": "score = round_half_up(25 - 100 * (outcome - p/100)^2); p integer 1..99; outcome 0|1",
10
+ "inputs": [
11
+ {
12
+ "name": "p",
13
+ "value": 70,
14
+ "unit": "percent"
15
+ },
16
+ {
17
+ "name": "outcome",
18
+ "value": 1,
19
+ "unit": "binary"
20
+ }
21
+ ],
22
+ "outputs": [
23
+ {
24
+ "name": "score",
25
+ "value": 16,
26
+ "unit": "points"
27
+ },
28
+ {
29
+ "name": "score_if_yes",
30
+ "value": 16,
31
+ "unit": "points"
32
+ },
33
+ {
34
+ "name": "score_if_no",
35
+ "value": -24,
36
+ "unit": "points"
37
+ }
38
+ ],
39
+ "assumptions": [
40
+ "The question resolves to exactly one of yes/no.",
41
+ "The locked probability is the integer p."
42
+ ],
43
+ "limitations": [
44
+ "Deterministic restatement of the game's scoring rule; it does not estimate any probability.",
45
+ "p is bounded to 1..99 as the game locks it; the rule's extremes +25 and -75 need p=100 and p=0, which cannot be locked.",
46
+ "The result never touches a registered forecast, the lock or XP."
47
+ ],
48
+ "source_ids": [],
49
+ "as_of": "2026-10-29T17:54:37Z",
50
+ "seed": null,
51
+ "computed_at": "2026-10-29T17:54:37.738042Z",
52
+ "expires_at": "2026-10-30T17:54:37.738042Z",
53
+ "principal_scope": {
54
+ "kind": "service",
55
+ "subject_id": null,
56
+ "tenant_id": "tenant:deepstack-internal"
57
+ },
58
+ "tool_receipt_id": "tool-4495e0fc9de742fbae64a128f977d6a1",
59
+ "side_effects": "none",
60
+ "status": "complete"
61
+ }
examples/scenario-run/valid-score-calculator.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "run_id": "scn-r1-1",
4
+ "request_id": "req-scn-1",
5
+ "question_id": "th001-t41",
6
+ "tool_id": "score_calculator",
7
+ "tool_version": "1",
8
+ "domain": "scoring",
9
+ "method": "score = round_half_up(25 - 100 * (outcome - p/100)^2); p integer 1..99; outcome 0|1",
10
+ "inputs": [
11
+ {"name": "p", "value": 70, "unit": "percent"},
12
+ {"name": "outcome", "value": 1, "unit": "binary"}
13
+ ],
14
+ "outputs": [
15
+ {"name": "score", "value": 16, "unit": "points"},
16
+ {"name": "score_if_yes", "value": 16, "unit": "points"},
17
+ {"name": "score_if_no", "value": -24, "unit": "points"}
18
+ ],
19
+ "assumptions": ["The question resolves to exactly one of yes/no.", "The locked probability is the integer p."],
20
+ "limitations": ["Deterministic restatement of the game's scoring rule; it does not estimate any probability."],
21
+ "source_ids": [],
22
+ "as_of": "2026-10-28T23:00:00Z",
23
+ "seed": null,
24
+ "computed_at": "2026-10-28T23:00:01Z",
25
+ "expires_at": "2026-10-29T23:00:00Z",
26
+ "principal_scope": {"kind": "reader", "subject_id": "sub_reader_bbbb2222", "tenant_id": "public"},
27
+ "tool_receipt_id": "tool-r1-1",
28
+ "side_effects": "none",
29
+ "status": "complete"
30
+ }
examples/search-result/valid-mcp-v2-search.json ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "mcp-7a8c4d1b8f9849178b66",
4
+ "question_id": "th001-t01",
5
+ "phase": "pre_lock",
6
+ "as_of": "2026-10-29T17:54:37Z",
7
+ "environment": "local",
8
+ "query": {
9
+ "text": "HBM supply constraint accelerators",
10
+ "context": null
11
+ },
12
+ "generation": {
13
+ "generation_id": "gen-00f83e5974f0c218",
14
+ "content_hash": "00f83e5974f0c2185d257836326faece2d1fcb82ffe0e4afb2d300392ca0e7bc",
15
+ "snapshot_id": "snap-test-000000000000-1",
16
+ "encoder_generation_id": "fake-hash3gram:dim256:none:l2",
17
+ "dense": false
18
+ },
19
+ "status": "ok",
20
+ "reason": null,
21
+ "filters": {
22
+ "required_purposes": [
23
+ "read",
24
+ "process"
25
+ ],
26
+ "considered": 245,
27
+ "kept": 239,
28
+ "rejected_time": 0,
29
+ "rejected_rights": 6,
30
+ "rejected_invalid": 0
31
+ },
32
+ "items": [
33
+ {
34
+ "evidence_id": "hbm-bull",
35
+ "source_id": "src_northbank_notes",
36
+ "source_url": "https://fixtures.example.org/northbank_notes/hbm-bull",
37
+ "span": "HBM supply remains the binding constraint on accelerator shipments: memory makers are sold out through 2027 and contract prices for HBM3E rose again this quarter.",
38
+ "clocks": {
39
+ "available_at": "2026-10-01T12:00:00Z",
40
+ "published_at": null,
41
+ "captured_at": null
42
+ },
43
+ "rights_purposes": [
44
+ "external_provider",
45
+ "process",
46
+ "publish",
47
+ "read"
48
+ ],
49
+ "polarity": "bull",
50
+ "lang": "en",
51
+ "rank": 1,
52
+ "score": 0.01587302,
53
+ "role": "match",
54
+ "reasons": [],
55
+ "graph": []
56
+ },
57
+ {
58
+ "evidence_id": "hbm-dup",
59
+ "source_id": "src_northbank_notes",
60
+ "source_url": "https://fixtures.example.org/northbank_notes/hbm-dup",
61
+ "span": "HBM supply is still the binding constraint on accelerator shipments; memory makers are sold out through 2027 and contract prices for HBM3E rose again this quarter.",
62
+ "clocks": {
63
+ "available_at": "2026-10-01T18:00:00Z",
64
+ "published_at": null,
65
+ "captured_at": null
66
+ },
67
+ "rights_purposes": [
68
+ "external_provider",
69
+ "process",
70
+ "publish",
71
+ "read"
72
+ ],
73
+ "polarity": "bull",
74
+ "lang": "en",
75
+ "rank": 2,
76
+ "score": 0.015625,
77
+ "role": "match",
78
+ "reasons": [],
79
+ "graph": []
80
+ },
81
+ {
82
+ "evidence_id": "dc_leases-bear",
83
+ "source_id": "src_southside_letter",
84
+ "source_url": "https://fixtures.example.org/southside_letter/dc_leases-bear",
85
+ "span": "Data center rents are flattening: a wave of new supply arrived and tenants negotiated shorter terms with lower escalators.",
86
+ "clocks": {
87
+ "available_at": "2026-10-14T15:00:00Z",
88
+ "published_at": null,
89
+ "captured_at": null
90
+ },
91
+ "rights_purposes": [
92
+ "external_provider",
93
+ "process",
94
+ "publish",
95
+ "read"
96
+ ],
97
+ "polarity": "bear",
98
+ "lang": "en",
99
+ "rank": 3,
100
+ "score": 0.01538462,
101
+ "role": "match",
102
+ "reasons": [],
103
+ "graph": []
104
+ },
105
+ {
106
+ "evidence_id": "dram-bull",
107
+ "source_id": "src_northbank_notes",
108
+ "source_url": "https://fixtures.example.org/northbank_notes/dram-bull",
109
+ "span": "DRAM contract prices are rising on AI demand: server DRAM contracts rose double digits this quarter as HBM production crowded out conventional capacity.",
110
+ "clocks": {
111
+ "available_at": "2026-10-18T12:00:00Z",
112
+ "published_at": null,
113
+ "captured_at": null
114
+ },
115
+ "rights_purposes": [
116
+ "external_provider",
117
+ "process",
118
+ "publish",
119
+ "read"
120
+ ],
121
+ "polarity": "bull",
122
+ "lang": "en",
123
+ "rank": 4,
124
+ "score": 0.01515152,
125
+ "role": "match",
126
+ "reasons": [],
127
+ "graph": []
128
+ },
129
+ {
130
+ "evidence_id": "hbm-bear",
131
+ "source_id": "src_southside_letter",
132
+ "source_url": "https://fixtures.example.org/southside_letter/hbm-bear",
133
+ "span": "HBM is no longer the bottleneck: a third supplier qualified its HBM3E stack and accelerator vendors say memory allocations now exceed their packaging slots.",
134
+ "clocks": {
135
+ "available_at": "2026-10-02T15:00:00Z",
136
+ "published_at": null,
137
+ "captured_at": null
138
+ },
139
+ "rights_purposes": [
140
+ "external_provider",
141
+ "process",
142
+ "publish",
143
+ "read"
144
+ ],
145
+ "polarity": "bear",
146
+ "lang": "en",
147
+ "rank": 5,
148
+ "score": 0.01470588,
149
+ "role": "match",
150
+ "reasons": [],
151
+ "graph": []
152
+ }
153
+ ],
154
+ "counter_evidence": {
155
+ "status": "present",
156
+ "evidence_ids": [
157
+ "dc_leases-bear",
158
+ "hbm-bear"
159
+ ]
160
+ },
161
+ "withheld_before_lock": 2,
162
+ "degradations": [
163
+ {
164
+ "code": "dense_disabled",
165
+ "detail": "lexical only: no query encoder configured"
166
+ }
167
+ ],
168
+ "page": {
169
+ "size": 5,
170
+ "offset": 0,
171
+ "returned": 5,
172
+ "next_cursor": "eyJnIjoiZ2VuLTAwZjgzZTU5NzRmMGMyMTgiLCJiIjoiZDQ5ODkzMTlhZmQ4OTJkMDM2YTZkMmUzIiwibyI6NX0"
173
+ }
174
+ }
examples/search-result/valid-page-with-counter-evidence.json ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "req-fixture-1",
4
+ "question_id": "th001-t01",
5
+ "phase": "pre_lock",
6
+ "as_of": "2026-10-28T23:00:00Z",
7
+ "environment": "fake",
8
+ "query": {
9
+ "text": "HBM supply tight",
10
+ "context": {
11
+ "kind": "book",
12
+ "id": "hyperscaler-capex-outruns-cash",
13
+ "title": "Will capital spending at Microsoft, Alphabet, Amazon and Meta outrun the cash their businesses generate?"
14
+ }
15
+ },
16
+ "generation": {
17
+ "generation_id": "gen-efc5a77ec22dce87",
18
+ "content_hash": "efc5a77ec22dce87a71c404c5c699a88c5445ab02fe01c6c67779c1713c22f22",
19
+ "snapshot_id": "snap-test-000000000000-1",
20
+ "encoder_generation_id": "fake-hash3gram:dim256:none:l2",
21
+ "dense": true
22
+ },
23
+ "status": "ok",
24
+ "reason": null,
25
+ "filters": {
26
+ "required_purposes": [
27
+ "read",
28
+ "process"
29
+ ],
30
+ "considered": 9,
31
+ "kept": 9,
32
+ "rejected_time": 0,
33
+ "rejected_rights": 0,
34
+ "rejected_invalid": 0
35
+ },
36
+ "items": [
37
+ {
38
+ "evidence_id": "hbm-tight-00",
39
+ "source_id": "src_tight_0",
40
+ "source_url": "https://fixtures.example.org/r3/t0",
41
+ "span": "HBM supply is tight and sold out, report 0: prices rose again.",
42
+ "clocks": {
43
+ "available_at": "2026-10-01T00:00:00Z",
44
+ "published_at": null,
45
+ "captured_at": null
46
+ },
47
+ "rights_purposes": [
48
+ "process",
49
+ "read"
50
+ ],
51
+ "polarity": "bull",
52
+ "lang": "en",
53
+ "rank": 1,
54
+ "score": 0.01639344,
55
+ "role": "match",
56
+ "reasons": [],
57
+ "graph": []
58
+ },
59
+ {
60
+ "evidence_id": "hbm-tight-03",
61
+ "source_id": "src_tight_3",
62
+ "source_url": "https://fixtures.example.org/r3/t3",
63
+ "span": "HBM supply is tight and sold out, report 3: prices rose again.",
64
+ "clocks": {
65
+ "available_at": "2026-10-01T00:00:00Z",
66
+ "published_at": null,
67
+ "captured_at": null
68
+ },
69
+ "rights_purposes": [
70
+ "process",
71
+ "read"
72
+ ],
73
+ "polarity": "bull",
74
+ "lang": "en",
75
+ "rank": 2,
76
+ "score": 0.01612903,
77
+ "role": "match",
78
+ "reasons": [],
79
+ "graph": []
80
+ },
81
+ {
82
+ "evidence_id": "memory-glut",
83
+ "source_id": "src_glut",
84
+ "source_url": "https://fixtures.example.org/r3/glut",
85
+ "span": "A memory glut looms as new fabs come online next year.",
86
+ "clocks": {
87
+ "available_at": "2026-10-01T00:00:00Z",
88
+ "published_at": null,
89
+ "captured_at": null
90
+ },
91
+ "rights_purposes": [
92
+ "process",
93
+ "read"
94
+ ],
95
+ "polarity": "bear",
96
+ "lang": "en",
97
+ "rank": 3,
98
+ "score": 0.01449275,
99
+ "role": "counter_evidence",
100
+ "reasons": [
101
+ "counter_evidence"
102
+ ],
103
+ "graph": []
104
+ }
105
+ ],
106
+ "counter_evidence": {
107
+ "status": "present",
108
+ "evidence_ids": [
109
+ "memory-glut"
110
+ ]
111
+ },
112
+ "withheld_before_lock": 0,
113
+ "degradations": [],
114
+ "page": {
115
+ "size": 3,
116
+ "offset": 0,
117
+ "returned": 3,
118
+ "next_cursor": "eyJnIjoiZ2VuLWVmYzVhNzdlYzIyZGNlODciLCJiIjoiM2YzZmNmZjA1NTE3ODNmNzU2NTFjMTZlIiwibyI6M30"
119
+ }
120
+ }
examples/search-result/valid-withheld-pre-lock.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "request_id": "req-fixture-2",
4
+ "question_id": "th001-t01",
5
+ "phase": "pre_lock",
6
+ "as_of": "2026-10-28T23:00:00Z",
7
+ "environment": "fake",
8
+ "query": {
9
+ "text": "What is the machines' number?",
10
+ "context": null
11
+ },
12
+ "generation": {
13
+ "generation_id": "gen-efc5a77ec22dce87",
14
+ "content_hash": "efc5a77ec22dce87a71c404c5c699a88c5445ab02fe01c6c67779c1713c22f22",
15
+ "snapshot_id": "snap-test-000000000000-1",
16
+ "encoder_generation_id": "fake-hash3gram:dim256:none:l2",
17
+ "dense": true
18
+ },
19
+ "status": "withheld",
20
+ "reason": "reserved_before_lock",
21
+ "filters": {
22
+ "required_purposes": [
23
+ "read",
24
+ "process"
25
+ ],
26
+ "considered": 0,
27
+ "kept": 0,
28
+ "rejected_time": 0,
29
+ "rejected_rights": 0,
30
+ "rejected_invalid": 0
31
+ },
32
+ "items": [],
33
+ "counter_evidence": {
34
+ "status": "not_applicable",
35
+ "evidence_ids": []
36
+ },
37
+ "withheld_before_lock": 0,
38
+ "degradations": [],
39
+ "page": {
40
+ "size": 10,
41
+ "offset": 0,
42
+ "returned": 0,
43
+ "next_cursor": null
44
+ }
45
+ }
manifest.json ADDED
@@ -0,0 +1,662 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "attribution": "DeepStack",
3
+ "card": {
4
+ "path": "README.md",
5
+ "sha256": "0813beaba40785de7e216fe6ce12a9928b1a6ba9ce36d3090e4d180d9bbe8228",
6
+ "size_bytes": 1809
7
+ },
8
+ "excluded": [
9
+ {
10
+ "reason": "negative fixture (invalid on purpose): not an example",
11
+ "source": "contracts/ml/fixtures/v1/ai-stream/invalid-transport-name.json"
12
+ },
13
+ {
14
+ "reason": "negative fixture (invalid on purpose): not an example",
15
+ "source": "contracts/ml/fixtures/v1/api-key/invalid-machine-scope.json"
16
+ },
17
+ {
18
+ "reason": "negative fixture (invalid on purpose): not an example",
19
+ "source": "contracts/ml/fixtures/v1/api-key/invalid-plaintext-secret.json"
20
+ },
21
+ {
22
+ "reason": "negative fixture (invalid on purpose): not an example",
23
+ "source": "contracts/ml/fixtures/v1/api-key/invalid-post-lock.json"
24
+ },
25
+ {
26
+ "reason": "negative fixture (invalid on purpose): not an example",
27
+ "source": "contracts/ml/fixtures/v1/api-key/invalid-train-right.json"
28
+ },
29
+ {
30
+ "reason": "negative fixture (invalid on purpose): not an example",
31
+ "source": "contracts/ml/fixtures/v1/evidence-pack-items/invalid-http-source.json"
32
+ },
33
+ {
34
+ "reason": "negative fixture (invalid on purpose): not an example",
35
+ "source": "contracts/ml/fixtures/v1/evidence-pack-items/invalid-span-over-600.json"
36
+ },
37
+ {
38
+ "reason": "negative fixture (invalid on purpose): not an example",
39
+ "source": "contracts/ml/fixtures/v1/evidence-pack-ref/invalid-bad-hash.json"
40
+ },
41
+ {
42
+ "reason": "negative fixture (invalid on purpose): not an example",
43
+ "source": "contracts/ml/fixtures/v1/evidence-pack-ref/invalid-duplicate-evidence.json"
44
+ },
45
+ {
46
+ "reason": "negative fixture (invalid on purpose): not an example",
47
+ "source": "contracts/ml/fixtures/v1/grounded-answer/invalid-http-source.json"
48
+ },
49
+ {
50
+ "reason": "negative fixture (invalid on purpose): not an example",
51
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-bool-version.json"
52
+ },
53
+ {
54
+ "reason": "negative fixture (invalid on purpose): not an example",
55
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-constructor-key.json"
56
+ },
57
+ {
58
+ "reason": "negative fixture (invalid on purpose): not an example",
59
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-missing-authorization.json"
60
+ },
61
+ {
62
+ "reason": "negative fixture (invalid on purpose): not an example",
63
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-offset-clock.json"
64
+ },
65
+ {
66
+ "reason": "negative fixture (invalid on purpose): not an example",
67
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-prototype-key.json"
68
+ },
69
+ {
70
+ "reason": "negative fixture (invalid on purpose): not an example",
71
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-trailing-newline-clock.json"
72
+ },
73
+ {
74
+ "reason": "negative fixture (invalid on purpose): not an example",
75
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-trailing-newline-id.json"
76
+ },
77
+ {
78
+ "reason": "negative fixture (invalid on purpose): not an example",
79
+ "source": "contracts/ml/fixtures/v1/intelligence-request/invalid-unknown-purpose.json"
80
+ },
81
+ {
82
+ "reason": "negative fixture (invalid on purpose): not an example",
83
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/invalid-cost-status-free-word.json"
84
+ },
85
+ {
86
+ "reason": "negative fixture (invalid on purpose): not an example",
87
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/invalid-negative-latency.json"
88
+ },
89
+ {
90
+ "reason": "negative fixture (invalid on purpose): not an example",
91
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/invalid-unlabeled-environment.json"
92
+ },
93
+ {
94
+ "reason": "names a model provider: the analyst's provider is not public",
95
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/valid-gateway-unknown-cost.json"
96
+ },
97
+ {
98
+ "reason": "negative fixture (invalid on purpose): not an example",
99
+ "source": "contracts/ml/fixtures/v1/product-event/invalid-email-as-subject.json"
100
+ },
101
+ {
102
+ "reason": "negative fixture (invalid on purpose): not an example",
103
+ "source": "contracts/ml/fixtures/v1/product-event/invalid-free-text.json"
104
+ },
105
+ {
106
+ "reason": "negative fixture (invalid on purpose): not an example",
107
+ "source": "contracts/ml/fixtures/v1/product-event/invalid-unknown-cohort.json"
108
+ },
109
+ {
110
+ "reason": "negative fixture (invalid on purpose): not an example",
111
+ "source": "contracts/ml/fixtures/v1/publication-record/invalid-key-not-content-addressed.json"
112
+ },
113
+ {
114
+ "reason": "negative fixture (invalid on purpose): not an example",
115
+ "source": "contracts/ml/fixtures/v1/publication-record/invalid-version-zero.json"
116
+ },
117
+ {
118
+ "reason": "negative fixture (invalid on purpose): not an example",
119
+ "source": "contracts/ml/fixtures/v1/scenario-run/invalid-input-without-unit.json"
120
+ },
121
+ {
122
+ "reason": "negative fixture (invalid on purpose): not an example",
123
+ "source": "contracts/ml/fixtures/v1/scenario-run/invalid-writes-forecast.json"
124
+ },
125
+ {
126
+ "reason": "negative fixture (invalid on purpose): not an example",
127
+ "source": "contracts/ml/fixtures/v1/search-result/invalid-context-id-shape.json"
128
+ },
129
+ {
130
+ "reason": "negative fixture (invalid on purpose): not an example",
131
+ "source": "contracts/ml/fixtures/v1/search-result/invalid-dense-not-boolean.json"
132
+ },
133
+ {
134
+ "reason": "negative fixture (invalid on purpose): not an example",
135
+ "source": "contracts/ml/fixtures/v1/search-result/invalid-naive-as-of.json"
136
+ },
137
+ {
138
+ "reason": "negative fixture (invalid on purpose): not an example",
139
+ "source": "contracts/ml/fixtures/v1/search-result/invalid-unknown-role.json"
140
+ }
141
+ ],
142
+ "items": [
143
+ {
144
+ "kind": "example",
145
+ "licence": "cc-by-4.0",
146
+ "note": "",
147
+ "path": "examples/ai-stream/valid-meta.json",
148
+ "rights_purposes": [
149
+ "process",
150
+ "publish",
151
+ "read"
152
+ ],
153
+ "schema": "ai-stream",
154
+ "sha256": "77a48677071f33c7bfbdaef6349f458f55f54d5ba8ecc788b4f28ed9b96e3527",
155
+ "size_bytes": 166,
156
+ "source": "contracts/ml/fixtures/v1/ai-stream/valid-meta.json"
157
+ },
158
+ {
159
+ "kind": "example",
160
+ "licence": "cc-by-4.0",
161
+ "note": "chave do tenant interno: digest com sal, sem segredo, pre_lock",
162
+ "path": "examples/api-key/valid-dogfood-key.json",
163
+ "rights_purposes": [
164
+ "process",
165
+ "publish",
166
+ "read"
167
+ ],
168
+ "schema": "api-key",
169
+ "sha256": "03cd4f9ede606eee418c30b12d1466ffce087e00ed118371121152872abfd3f2",
170
+ "size_bytes": 822,
171
+ "source": "contracts/ml/fixtures/v1/api-key/valid-dogfood-key.json"
172
+ },
173
+ {
174
+ "kind": "example",
175
+ "licence": "cc-by-4.0",
176
+ "note": "chave em rotacao com janela de graca",
177
+ "path": "examples/api-key/valid-rotated-in-grace.json",
178
+ "rights_purposes": [
179
+ "process",
180
+ "publish",
181
+ "read"
182
+ ],
183
+ "schema": "api-key",
184
+ "sha256": "4da696e4f53942b7948545d477cabd77a4782d7d55796ee36407c74a99d39733",
185
+ "size_bytes": 860,
186
+ "source": "contracts/ml/fixtures/v1/api-key/valid-rotated-in-grace.json"
187
+ },
188
+ {
189
+ "kind": "example",
190
+ "licence": "cc-by-4.0",
191
+ "note": "itens presos ao content_hash do ref; disponibilidade com precisao de dia",
192
+ "path": "examples/evidence-pack-items/valid-two-items.json",
193
+ "rights_purposes": [
194
+ "process",
195
+ "publish",
196
+ "read"
197
+ ],
198
+ "schema": "evidence-pack-items",
199
+ "sha256": "5b2a34c80a333c5555f5b76281519ac23b913faa65a9a01158b88b5abb6a0c6f",
200
+ "size_bytes": 1321,
201
+ "source": "contracts/ml/fixtures/v1/evidence-pack-items/valid-two-items.json"
202
+ },
203
+ {
204
+ "kind": "example",
205
+ "licence": "cc-by-4.0",
206
+ "note": "",
207
+ "path": "examples/evidence-pack-ref/valid-pre-lock-pack.json",
208
+ "rights_purposes": [
209
+ "process",
210
+ "publish",
211
+ "read"
212
+ ],
213
+ "schema": "evidence-pack-ref",
214
+ "sha256": "1d6edfa32c1b2e0d4e63af443fbacd5655dafe941468aeb392b7fa399e2291df",
215
+ "size_bytes": 353,
216
+ "source": "contracts/ml/fixtures/v1/evidence-pack-ref/valid-pre-lock-pack.json"
217
+ },
218
+ {
219
+ "kind": "example",
220
+ "licence": "cc-by-4.0",
221
+ "note": "",
222
+ "path": "examples/grounded-answer/valid-abstains-before-lock.json",
223
+ "rights_purposes": [
224
+ "process",
225
+ "publish",
226
+ "read"
227
+ ],
228
+ "schema": "grounded-answer",
229
+ "sha256": "744e85f04341142eaa39227c2dcd946ebd409073758571a0bd35cf75a12d6e53",
230
+ "size_bytes": 295,
231
+ "source": "contracts/ml/fixtures/v1/grounded-answer/valid-abstains-before-lock.json"
232
+ },
233
+ {
234
+ "kind": "example",
235
+ "licence": "cc-by-4.0",
236
+ "note": "",
237
+ "path": "examples/grounded-answer/valid-cited.json",
238
+ "rights_purposes": [
239
+ "process",
240
+ "publish",
241
+ "read"
242
+ ],
243
+ "schema": "grounded-answer",
244
+ "sha256": "16d5ee21c956f76bb23d5bdbb764846acfe34d4750d6f2e3df86b9d726822c29",
245
+ "size_bytes": 491,
246
+ "source": "contracts/ml/fixtures/v1/grounded-answer/valid-cited.json"
247
+ },
248
+ {
249
+ "kind": "example",
250
+ "licence": "cc-by-4.0",
251
+ "note": "R4: resposta da tool answer do MCP v2 no ensaio local (mesmo contrato da API)",
252
+ "path": "examples/grounded-answer/valid-mcp-v2-answer.json",
253
+ "rights_purposes": [
254
+ "process",
255
+ "publish",
256
+ "read"
257
+ ],
258
+ "schema": "grounded-answer",
259
+ "sha256": "4c9108017fe739e5024b257527a5823767383f970178ff4429e54d8dd2236e60",
260
+ "size_bytes": 885,
261
+ "source": "contracts/ml/fixtures/v1/grounded-answer/valid-mcp-v2-answer.json"
262
+ },
263
+ {
264
+ "kind": "example",
265
+ "licence": "cc-by-4.0",
266
+ "note": "leitor com lock",
267
+ "path": "examples/intelligence-request/valid-post-lock-chat.json",
268
+ "rights_purposes": [
269
+ "process",
270
+ "publish",
271
+ "read"
272
+ ],
273
+ "schema": "intelligence-request",
274
+ "sha256": "8a34d314b485f237548a897bf0665088dbaa1650c5e1394eb0d1c12eba024913",
275
+ "size_bytes": 601,
276
+ "source": "contracts/ml/fixtures/v1/intelligence-request/valid-post-lock-chat.json"
277
+ },
278
+ {
279
+ "kind": "example",
280
+ "licence": "cc-by-4.0",
281
+ "note": "leitor sem lock",
282
+ "path": "examples/intelligence-request/valid-pre-lock-chat.json",
283
+ "rights_purposes": [
284
+ "process",
285
+ "publish",
286
+ "read"
287
+ ],
288
+ "schema": "intelligence-request",
289
+ "sha256": "eec90943f7a25293aeb59389c98a489bb81817483b7d114b31ca217ac8d4d7b6",
290
+ "size_bytes": 600,
291
+ "source": "contracts/ml/fixtures/v1/intelligence-request/valid-pre-lock-chat.json"
292
+ },
293
+ {
294
+ "kind": "example",
295
+ "licence": "cc-by-4.0",
296
+ "note": "uso desconhecido nao e zero",
297
+ "path": "examples/model-execution-receipt/valid-fake-unknown-usage.json",
298
+ "rights_purposes": [
299
+ "process",
300
+ "publish",
301
+ "read"
302
+ ],
303
+ "schema": "model-execution-receipt",
304
+ "sha256": "c91b1c06ddf6915452692c24342dfe1b4d71718f45cb77e0226da393837a39d7",
305
+ "size_bytes": 635,
306
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/valid-fake-unknown-usage.json"
307
+ },
308
+ {
309
+ "kind": "example",
310
+ "licence": "cc-by-4.0",
311
+ "note": "R4: o gateway e a fonte do recibo e acrescenta custo, latencia e modelo observado (campos opcionais)",
312
+ "path": "examples/model-execution-receipt/valid-gateway-cost-latency-observed.json",
313
+ "rights_purposes": [
314
+ "process",
315
+ "publish",
316
+ "read"
317
+ ],
318
+ "schema": "model-execution-receipt",
319
+ "sha256": "06e006f649026b10004b8f4a328f353b0745d26898bd1871f111d0bb63a4808c",
320
+ "size_bytes": 970,
321
+ "source": "contracts/ml/fixtures/v1/model-execution-receipt/valid-gateway-cost-latency-observed.json"
322
+ },
323
+ {
324
+ "kind": "example",
325
+ "licence": "cc-by-4.0",
326
+ "note": "evento de conta com consentimento de medicao",
327
+ "path": "examples/product-event/valid-account-measurement.json",
328
+ "rights_purposes": [
329
+ "process",
330
+ "publish",
331
+ "read"
332
+ ],
333
+ "schema": "product-event",
334
+ "sha256": "535ba72b3ee7b2653f034b58da50d3fbbaa704a68de6d037384d630533d50856",
335
+ "size_bytes": 363,
336
+ "source": "contracts/ml/fixtures/v1/product-event/valid-account-measurement.json"
337
+ },
338
+ {
339
+ "kind": "example",
340
+ "licence": "cc-by-4.0",
341
+ "note": "maquina sem sujeito",
342
+ "path": "examples/product-event/valid-machine-without-subject.json",
343
+ "rights_purposes": [
344
+ "process",
345
+ "publish",
346
+ "read"
347
+ ],
348
+ "schema": "product-event",
349
+ "sha256": "1852f561ef78552343e751bd4b34d84a30ce44f5586d41c9e57147199f794fb1",
350
+ "size_bytes": 347,
351
+ "source": "contracts/ml/fixtures/v1/product-event/valid-machine-without-subject.json"
352
+ },
353
+ {
354
+ "kind": "example",
355
+ "licence": "cc-by-4.0",
356
+ "note": "primeira publicacao do trackrecord",
357
+ "path": "examples/publication-record/valid-first-trackrecord.json",
358
+ "rights_purposes": [
359
+ "process",
360
+ "publish",
361
+ "read"
362
+ ],
363
+ "schema": "publication-record",
364
+ "sha256": "aee092c08e3147a07bf27d8d2dc9a1c1dfd75d51831f99b2414ff066cbb7e2bd",
365
+ "size_bytes": 499,
366
+ "source": "contracts/ml/fixtures/v1/publication-record/valid-first-trackrecord.json"
367
+ },
368
+ {
369
+ "kind": "example",
370
+ "licence": "cc-by-4.0",
371
+ "note": "R4: publicacao do trackrecord lida pela tool trackrecord do MCP v2",
372
+ "path": "examples/publication-record/valid-mcp-v2-trackrecord.json",
373
+ "rights_purposes": [
374
+ "process",
375
+ "publish",
376
+ "read"
377
+ ],
378
+ "schema": "publication-record",
379
+ "sha256": "2f6a6f2cdc8339b7b2d1d1f5403c49beb56ebdccf05fc61cf8361e0cbf95d8ec",
380
+ "size_bytes": 487,
381
+ "source": "contracts/ml/fixtures/v1/publication-record/valid-mcp-v2-trackrecord.json"
382
+ },
383
+ {
384
+ "kind": "example",
385
+ "licence": "cc-by-4.0",
386
+ "note": "versao 2 encadeada na 1",
387
+ "path": "examples/publication-record/valid-second-version.json",
388
+ "rights_purposes": [
389
+ "process",
390
+ "publish",
391
+ "read"
392
+ ],
393
+ "schema": "publication-record",
394
+ "sha256": "db53bac158f702c4f1438f567d18f181f1333bfbc10d88830a81bc6535f301f0",
395
+ "size_bytes": 525,
396
+ "source": "contracts/ml/fixtures/v1/publication-record/valid-second-version.json"
397
+ },
398
+ {
399
+ "kind": "example",
400
+ "licence": "cc-by-4.0",
401
+ "note": "R4: execucao da tool scenario do MCP v2 para o tenant interno",
402
+ "path": "examples/scenario-run/valid-mcp-v2-scenario.json",
403
+ "rights_purposes": [
404
+ "process",
405
+ "publish",
406
+ "read"
407
+ ],
408
+ "schema": "scenario-run",
409
+ "sha256": "dcfc527b7d8ee2f7feda101bb6cbd11756e23b3c44178e39a75588a4f746fe08",
410
+ "size_bytes": 1512,
411
+ "source": "contracts/ml/fixtures/v1/scenario-run/valid-mcp-v2-scenario.json"
412
+ },
413
+ {
414
+ "kind": "example",
415
+ "licence": "cc-by-4.0",
416
+ "note": "calculadora de score: inputs com unidade, sem escrita",
417
+ "path": "examples/scenario-run/valid-score-calculator.json",
418
+ "rights_purposes": [
419
+ "process",
420
+ "publish",
421
+ "read"
422
+ ],
423
+ "schema": "scenario-run",
424
+ "sha256": "be8bdc54194651167e4ad73576ef4612b2fa26d9b2a39196e7cabe4a40b5f2db",
425
+ "size_bytes": 1144,
426
+ "source": "contracts/ml/fixtures/v1/scenario-run/valid-score-calculator.json"
427
+ },
428
+ {
429
+ "kind": "example",
430
+ "licence": "cc-by-4.0",
431
+ "note": "R4: pagina da tool search do MCP v2, sem nada das maquinas antes do lock",
432
+ "path": "examples/search-result/valid-mcp-v2-search.json",
433
+ "rights_purposes": [
434
+ "process",
435
+ "publish",
436
+ "read"
437
+ ],
438
+ "schema": "search-result",
439
+ "sha256": "54ea77258af3a728960574fa7e9a20efa0234e38fd3fccecf1f011568506fb7e",
440
+ "size_bytes": 4500,
441
+ "source": "contracts/ml/fixtures/v1/search-result/valid-mcp-v2-search.json"
442
+ },
443
+ {
444
+ "kind": "example",
445
+ "licence": "cc-by-4.0",
446
+ "note": "primeira pagina com contraprova marcada no ultimo lugar, contexto de livro, cursor da geracao",
447
+ "path": "examples/search-result/valid-page-with-counter-evidence.json",
448
+ "rights_purposes": [
449
+ "process",
450
+ "publish",
451
+ "read"
452
+ ],
453
+ "schema": "search-result",
454
+ "sha256": "154a2350b7c88c96bcb686fc8b3975fd80784de6b1198800f10e4b27df325d50",
455
+ "size_bytes": 3069,
456
+ "source": "contracts/ml/fixtures/v1/search-result/valid-page-with-counter-evidence.json"
457
+ },
458
+ {
459
+ "kind": "example",
460
+ "licence": "cc-by-4.0",
461
+ "note": "pergunta pelo numero das maquinas antes do lock: nada, com a razao",
462
+ "path": "examples/search-result/valid-withheld-pre-lock.json",
463
+ "rights_purposes": [
464
+ "process",
465
+ "publish",
466
+ "read"
467
+ ],
468
+ "schema": "search-result",
469
+ "sha256": "0f239d0930b1288b68c1e1ced6e734c5e6bcd820a63e02aba5587689f9703cc6",
470
+ "size_bytes": 1043,
471
+ "source": "contracts/ml/fixtures/v1/search-result/valid-withheld-pre-lock.json"
472
+ },
473
+ {
474
+ "kind": "json_schema",
475
+ "licence": "cc-by-4.0",
476
+ "path": "schemas/ai-stream.schema.json",
477
+ "rights_purposes": [
478
+ "process",
479
+ "publish",
480
+ "read"
481
+ ],
482
+ "schema": "ai-stream",
483
+ "sha256": "b55f2a2d34f8d3b4540a3e926c1e3266c9f0bc88b2be8f4ecdb9e19237d58ebb",
484
+ "size_bytes": 9326,
485
+ "source": "contracts/ml/v1/ai-stream.schema.json"
486
+ },
487
+ {
488
+ "kind": "json_schema",
489
+ "licence": "cc-by-4.0",
490
+ "path": "schemas/api-key.schema.json",
491
+ "rights_purposes": [
492
+ "process",
493
+ "publish",
494
+ "read"
495
+ ],
496
+ "schema": "api-key",
497
+ "sha256": "91bf7a7db8c8a751b1534c988c7e9fa37240bfb5eb37a32b8ab88656dba0cc0e",
498
+ "size_bytes": 6871,
499
+ "source": "contracts/ml/v1/api-key.schema.json"
500
+ },
501
+ {
502
+ "kind": "json_schema",
503
+ "licence": "cc-by-4.0",
504
+ "path": "schemas/common.schema.json",
505
+ "rights_purposes": [
506
+ "process",
507
+ "publish",
508
+ "read"
509
+ ],
510
+ "schema": "common",
511
+ "sha256": "bc74bb308d64c6244aa89fa6d17a15c30d1c715d80837d64cdf03516a01f7ade",
512
+ "size_bytes": 3545,
513
+ "source": "contracts/ml/v1/common.schema.json"
514
+ },
515
+ {
516
+ "kind": "json_schema",
517
+ "licence": "cc-by-4.0",
518
+ "path": "schemas/evidence-pack-items.schema.json",
519
+ "rights_purposes": [
520
+ "process",
521
+ "publish",
522
+ "read"
523
+ ],
524
+ "schema": "evidence-pack-items",
525
+ "sha256": "3ffb4ea64b4e3eba1ba377074d7f1adeba4314c399846502af005ddc74b97d1a",
526
+ "size_bytes": 3362,
527
+ "source": "contracts/ml/v1/evidence-pack-items.schema.json"
528
+ },
529
+ {
530
+ "kind": "json_schema",
531
+ "licence": "cc-by-4.0",
532
+ "path": "schemas/evidence-pack-ref.schema.json",
533
+ "rights_purposes": [
534
+ "process",
535
+ "publish",
536
+ "read"
537
+ ],
538
+ "schema": "evidence-pack-ref",
539
+ "sha256": "ba558e87c9e49e85614fb8d5bfcaeca622323854da54636ee1d9d0335fa68ddc",
540
+ "size_bytes": 1207,
541
+ "source": "contracts/ml/v1/evidence-pack-ref.schema.json"
542
+ },
543
+ {
544
+ "kind": "json_schema",
545
+ "licence": "cc-by-4.0",
546
+ "path": "schemas/grounded-answer.schema.json",
547
+ "rights_purposes": [
548
+ "process",
549
+ "publish",
550
+ "read"
551
+ ],
552
+ "schema": "grounded-answer",
553
+ "sha256": "bea4315083a9ccd267a8895eecb460f7988992c88ac4089bb3635090755889b4",
554
+ "size_bytes": 2686,
555
+ "source": "contracts/ml/v1/grounded-answer.schema.json"
556
+ },
557
+ {
558
+ "kind": "json_schema",
559
+ "licence": "cc-by-4.0",
560
+ "path": "schemas/intelligence-request.schema.json",
561
+ "rights_purposes": [
562
+ "process",
563
+ "publish",
564
+ "read"
565
+ ],
566
+ "schema": "intelligence-request",
567
+ "sha256": "ac06ad5f396095e5fee2ab6944a8f769691fef0a1ff1fb309bbe38ccb5d08355",
568
+ "size_bytes": 2207,
569
+ "source": "contracts/ml/v1/intelligence-request.schema.json"
570
+ },
571
+ {
572
+ "kind": "json_schema",
573
+ "licence": "cc-by-4.0",
574
+ "path": "schemas/model-execution-receipt.schema.json",
575
+ "rights_purposes": [
576
+ "process",
577
+ "publish",
578
+ "read"
579
+ ],
580
+ "schema": "model-execution-receipt",
581
+ "sha256": "5651dddf0fe395e8369f1ec7c64e0139678f1c04edf22dd0aea3858ee76c2f3d",
582
+ "size_bytes": 5431,
583
+ "source": "contracts/ml/v1/model-execution-receipt.schema.json"
584
+ },
585
+ {
586
+ "kind": "json_schema",
587
+ "licence": "cc-by-4.0",
588
+ "path": "schemas/product-event.schema.json",
589
+ "rights_purposes": [
590
+ "process",
591
+ "publish",
592
+ "read"
593
+ ],
594
+ "schema": "product-event",
595
+ "sha256": "9753d3c3975c3a8b41adc9cb26977fcc846517e69ecf01216931f520f6f14b05",
596
+ "size_bytes": 2700,
597
+ "source": "contracts/ml/v1/product-event.schema.json"
598
+ },
599
+ {
600
+ "kind": "json_schema",
601
+ "licence": "cc-by-4.0",
602
+ "path": "schemas/publication-record.schema.json",
603
+ "rights_purposes": [
604
+ "process",
605
+ "publish",
606
+ "read"
607
+ ],
608
+ "schema": "publication-record",
609
+ "sha256": "257a49bf18fe643a3e8a777a9f01cf3c62994f0ab7091a1e22c5231fd19c1e15",
610
+ "size_bytes": 2180,
611
+ "source": "contracts/ml/v1/publication-record.schema.json"
612
+ },
613
+ {
614
+ "kind": "json_schema",
615
+ "licence": "cc-by-4.0",
616
+ "path": "schemas/scenario-run.schema.json",
617
+ "rights_purposes": [
618
+ "process",
619
+ "publish",
620
+ "read"
621
+ ],
622
+ "schema": "scenario-run",
623
+ "sha256": "8cf1d719b0dbdbefaf440e6b1241f82ceab7b7928b90cbef2ec801dc7df250bf",
624
+ "size_bytes": 3028,
625
+ "source": "contracts/ml/v1/scenario-run.schema.json"
626
+ },
627
+ {
628
+ "kind": "json_schema",
629
+ "licence": "cc-by-4.0",
630
+ "path": "schemas/search-result.schema.json",
631
+ "rights_purposes": [
632
+ "process",
633
+ "publish",
634
+ "read"
635
+ ],
636
+ "schema": "search-result",
637
+ "sha256": "4e99217dcf553219969aceaa40f0afd803e2fa9ba1d677b8197252fad6b07df9",
638
+ "size_bytes": 8326,
639
+ "source": "contracts/ml/v1/search-result.schema.json"
640
+ }
641
+ ],
642
+ "licence_decision": {
643
+ "dataset": "cc-by-4.0",
644
+ "dataset_visibility": "public",
645
+ "decided_by": "owner",
646
+ "decided_on": "2026-10-29",
647
+ "recorded_as": "evidence of the owner's decision, not a signature",
648
+ "space_code": "apache-2.0",
649
+ "space_visibility": "private"
650
+ },
651
+ "licence_default": "cc-by-4.0",
652
+ "license_file": {
653
+ "path": "LICENSE",
654
+ "sha256": "9ba9550ad48438d0836ddab3da480b3b69ffa0aac7b7878b5a0039e7ab429411",
655
+ "size_bytes": 18657
656
+ },
657
+ "name": "dataset-api-v2-contracts",
658
+ "package_id": "7726f3ef2d6c89a351740d8ea2a96ce1dffe6b3c1a0e6e868895457fd4415d64",
659
+ "repo": "deepstack-ml/deepstack-api-v2-contracts",
660
+ "schema": "deepstack.distribution.dataset/v1",
661
+ "visibility": "public"
662
+ }
schemas/ai-stream.schema.json ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "ai-stream.schema.json",
4
+ "title": "AiStreamEvent",
5
+ "description": "One event of the v2 answer stream, shared by the ML service, the edge and the app (POST /api/ai with Accept: text/event-stream). seq starts at 0 and grows by one; exactly one terminal event (done or error) closes the stream. claim_delta only carries a block whose references and checkable numbers were validated; error is never a finished answer. Transport-level names (token, chunk, complete) are internal and are translated, never exposed. The shape of `data` depends on `event` and is fixed by the $defs of the same name: the validators of both languages (semantic.check_stream / errors_of_stream_event in Python, stream.ts errorsOfStreamEvent in TypeScript) pick the $defs by `event` and check `data` against it, since the shared subset has no conditional keyword.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "request_id",
11
+ "seq",
12
+ "event",
13
+ "data"
14
+ ],
15
+ "properties": {
16
+ "schema_version": {
17
+ "$ref": "common.schema.json#/$defs/schema_version"
18
+ },
19
+ "request_id": {
20
+ "$ref": "common.schema.json#/$defs/id"
21
+ },
22
+ "seq": {
23
+ "type": "integer",
24
+ "minimum": 0,
25
+ "maximum": 9007199254740991
26
+ },
27
+ "event": {
28
+ "enum": [
29
+ "meta",
30
+ "status",
31
+ "evidence",
32
+ "claim_delta",
33
+ "tool_result",
34
+ "warning",
35
+ "done",
36
+ "error"
37
+ ]
38
+ },
39
+ "data": {
40
+ "type": "object"
41
+ }
42
+ },
43
+ "$defs": {
44
+ "code": {
45
+ "description": "A stable machine word: a warning or error code, a status word, a degradation code.",
46
+ "type": "string",
47
+ "pattern": "^[a-z][a-z0-9_]{0,63}$"
48
+ },
49
+ "meta": {
50
+ "description": "The first event. The phase is the server's; environment says where the answer really runs ('fake' is a fixture, never a real answer). The app's bridge sends its own meta (phase and origin 'app') when the service cannot be reached, so only the phase is required.",
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": [
54
+ "phase"
55
+ ],
56
+ "properties": {
57
+ "environment": {
58
+ "$ref": "common.schema.json#/$defs/environment"
59
+ },
60
+ "phase": {
61
+ "$ref": "common.schema.json#/$defs/phase"
62
+ },
63
+ "purpose": {
64
+ "$ref": "common.schema.json#/$defs/purpose"
65
+ },
66
+ "pack_id": {
67
+ "$ref": "common.schema.json#/$defs/id"
68
+ },
69
+ "question_id": {
70
+ "$ref": "common.schema.json#/$defs/question_id"
71
+ },
72
+ "origin": {
73
+ "description": "Who produced the stream: the ML service ('ml') or the app's bridge standing in for it ('app').",
74
+ "enum": [
75
+ "ml",
76
+ "app"
77
+ ]
78
+ }
79
+ }
80
+ },
81
+ "status": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "required": [
85
+ "state"
86
+ ],
87
+ "properties": {
88
+ "state": {
89
+ "$ref": "#/$defs/code"
90
+ }
91
+ }
92
+ },
93
+ "evidence": {
94
+ "description": "The pack the answer may cite and the items its content_hash binds (evidence-pack-items), exactly as the retrieval produced them; the only source of the app's sources drawer.",
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": [
98
+ "pack",
99
+ "items",
100
+ "degradations"
101
+ ],
102
+ "properties": {
103
+ "pack": {
104
+ "$ref": "evidence-pack-ref.schema.json"
105
+ },
106
+ "items": {
107
+ "type": "array",
108
+ "items": {
109
+ "$ref": "evidence-pack-items.schema.json#/$defs/item"
110
+ }
111
+ },
112
+ "degradations": {
113
+ "type": "array",
114
+ "items": {
115
+ "type": "object",
116
+ "additionalProperties": false,
117
+ "required": [
118
+ "code"
119
+ ],
120
+ "properties": {
121
+ "code": {
122
+ "$ref": "#/$defs/code"
123
+ },
124
+ "detail": {
125
+ "type": [
126
+ "string",
127
+ "null"
128
+ ],
129
+ "maxLength": 300
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ },
136
+ "claim_delta": {
137
+ "description": "One validated block: the claim as it will appear in the answer's claim_refs and the citations it points at (citation_refs of grounded-answer). validated is always true; an unvalidated block is never sent.",
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": [
141
+ "validated",
142
+ "claim",
143
+ "citations"
144
+ ],
145
+ "properties": {
146
+ "validated": {
147
+ "const": true
148
+ },
149
+ "claim": {
150
+ "$ref": "grounded-answer.schema.json#/properties/claim_refs/items"
151
+ },
152
+ "citations": {
153
+ "type": "array",
154
+ "items": {
155
+ "$ref": "grounded-answer.schema.json#/properties/citation_refs/items"
156
+ }
157
+ }
158
+ }
159
+ },
160
+ "tool_result": {
161
+ "description": "A tool the model called, by its receipt: id, status and error class. The output stays on the server; the full receipts travel in done.",
162
+ "type": "object",
163
+ "additionalProperties": false,
164
+ "required": [
165
+ "tool_receipt_id",
166
+ "tool_id",
167
+ "status",
168
+ "error_class"
169
+ ],
170
+ "properties": {
171
+ "tool_receipt_id": {
172
+ "$ref": "common.schema.json#/$defs/id"
173
+ },
174
+ "tool_id": {
175
+ "$ref": "common.schema.json#/$defs/id"
176
+ },
177
+ "status": {
178
+ "enum": [
179
+ "ok",
180
+ "error"
181
+ ]
182
+ },
183
+ "error_class": {
184
+ "type": [
185
+ "string",
186
+ "null"
187
+ ],
188
+ "pattern": "^[a-z][a-z0-9_]{0,63}$"
189
+ }
190
+ }
191
+ },
192
+ "warning": {
193
+ "type": "object",
194
+ "additionalProperties": false,
195
+ "required": [
196
+ "code"
197
+ ],
198
+ "properties": {
199
+ "code": {
200
+ "$ref": "#/$defs/code"
201
+ },
202
+ "reason": {
203
+ "$ref": "#/$defs/code"
204
+ },
205
+ "detail": {
206
+ "type": "string",
207
+ "maxLength": 600
208
+ }
209
+ }
210
+ },
211
+ "error": {
212
+ "description": "The terminal that is never an answer. code 'cancelled' (service) and 'interrupted' (bridge, browser) mean the reader or the connection stopped it; the rest are failures.",
213
+ "type": "object",
214
+ "additionalProperties": false,
215
+ "required": [
216
+ "code"
217
+ ],
218
+ "properties": {
219
+ "code": {
220
+ "$ref": "#/$defs/code"
221
+ },
222
+ "reason": {
223
+ "$ref": "#/$defs/code"
224
+ },
225
+ "detail": {
226
+ "type": "string",
227
+ "maxLength": 600
228
+ },
229
+ "environment": {
230
+ "$ref": "common.schema.json#/$defs/environment"
231
+ },
232
+ "execution_receipt_id": {
233
+ "type": [
234
+ "string",
235
+ "null"
236
+ ],
237
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
238
+ },
239
+ "execution_receipt": {
240
+ "$ref": "model-execution-receipt.schema.json"
241
+ },
242
+ "execution_receipt_ids": {
243
+ "type": "array",
244
+ "items": {
245
+ "$ref": "common.schema.json#/$defs/id"
246
+ }
247
+ }
248
+ }
249
+ },
250
+ "done": {
251
+ "description": "The finished answer (grounded-answer) with every receipt of the run and the claims the validation rejected, with their reasons.",
252
+ "type": "object",
253
+ "additionalProperties": false,
254
+ "required": [
255
+ "environment",
256
+ "answer",
257
+ "execution_receipts",
258
+ "tool_receipts",
259
+ "rejected"
260
+ ],
261
+ "properties": {
262
+ "environment": {
263
+ "$ref": "common.schema.json#/$defs/environment"
264
+ },
265
+ "answer": {
266
+ "$ref": "grounded-answer.schema.json"
267
+ },
268
+ "execution_receipts": {
269
+ "type": "array",
270
+ "items": {
271
+ "$ref": "model-execution-receipt.schema.json"
272
+ }
273
+ },
274
+ "tool_receipts": {
275
+ "type": "array",
276
+ "items": {
277
+ "type": "object",
278
+ "required": [
279
+ "receipt_id",
280
+ "tool_id",
281
+ "status"
282
+ ],
283
+ "properties": {
284
+ "receipt_id": {
285
+ "$ref": "common.schema.json#/$defs/id"
286
+ },
287
+ "tool_id": {
288
+ "$ref": "common.schema.json#/$defs/id"
289
+ },
290
+ "status": {
291
+ "enum": [
292
+ "ok",
293
+ "error"
294
+ ]
295
+ }
296
+ }
297
+ }
298
+ },
299
+ "rejected": {
300
+ "type": "array",
301
+ "items": {
302
+ "type": "object",
303
+ "additionalProperties": false,
304
+ "required": [
305
+ "claim_text",
306
+ "reason",
307
+ "detail"
308
+ ],
309
+ "properties": {
310
+ "claim_text": {
311
+ "type": "string",
312
+ "maxLength": 200
313
+ },
314
+ "reason": {
315
+ "$ref": "#/$defs/code"
316
+ },
317
+ "detail": {
318
+ "type": "string",
319
+ "maxLength": 600
320
+ }
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
schemas/api-key.schema.json ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "api-key.schema.json",
4
+ "title": "ApiKeyRecord",
5
+ "description": "One API key of a tenant as the server stores it (INT-007/APP-10, R4). The secret is never stored: only a salted PBKDF2-HMAC-SHA256 digest, with its own random salt. Scopes are 'route:purpose' pairs from a closed list; a key is never a forecasting machine, never trains, retains or publishes. rights is the ceiling of the rights_scope a request may claim. phase is always pre_lock: a key cannot attest a lock. The public view ($defs/public_view) is what /v2/keys/self answers and has no salt and no digest.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "key_id",
11
+ "tenant_id",
12
+ "label",
13
+ "scopes",
14
+ "rights",
15
+ "quota",
16
+ "status",
17
+ "phase",
18
+ "hash",
19
+ "created_at",
20
+ "expires_at",
21
+ "rotated_from",
22
+ "rotated_to",
23
+ "grace_until",
24
+ "revoked_at",
25
+ "revoked_reason"
26
+ ],
27
+ "properties": {
28
+ "schema_version": {
29
+ "$ref": "common.schema.json#/$defs/schema_version"
30
+ },
31
+ "key_id": {
32
+ "$ref": "#/$defs/key_id"
33
+ },
34
+ "tenant_id": {
35
+ "$ref": "#/$defs/tenant_id"
36
+ },
37
+ "label": {
38
+ "$ref": "#/$defs/label"
39
+ },
40
+ "scopes": {
41
+ "$ref": "#/$defs/scopes"
42
+ },
43
+ "rights": {
44
+ "$ref": "#/$defs/rights"
45
+ },
46
+ "quota": {
47
+ "$ref": "#/$defs/quota"
48
+ },
49
+ "status": {
50
+ "$ref": "#/$defs/status"
51
+ },
52
+ "phase": {
53
+ "const": "pre_lock"
54
+ },
55
+ "hash": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": [
59
+ "algorithm",
60
+ "iterations",
61
+ "salt",
62
+ "digest"
63
+ ],
64
+ "properties": {
65
+ "algorithm": {
66
+ "const": "pbkdf2-hmac-sha256"
67
+ },
68
+ "iterations": {
69
+ "type": "integer",
70
+ "minimum": 10000,
71
+ "maximum": 10000000
72
+ },
73
+ "salt": {
74
+ "type": "string",
75
+ "pattern": "^[0-9a-f]{32}$"
76
+ },
77
+ "digest": {
78
+ "$ref": "common.schema.json#/$defs/sha256"
79
+ }
80
+ }
81
+ },
82
+ "created_at": {
83
+ "$ref": "common.schema.json#/$defs/utc"
84
+ },
85
+ "expires_at": {
86
+ "type": [
87
+ "string",
88
+ "null"
89
+ ],
90
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
91
+ },
92
+ "rotated_from": {
93
+ "type": [
94
+ "string",
95
+ "null"
96
+ ],
97
+ "pattern": "^key_[0-9a-f]{16}$"
98
+ },
99
+ "rotated_to": {
100
+ "type": [
101
+ "string",
102
+ "null"
103
+ ],
104
+ "pattern": "^key_[0-9a-f]{16}$"
105
+ },
106
+ "grace_until": {
107
+ "type": [
108
+ "string",
109
+ "null"
110
+ ],
111
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
112
+ },
113
+ "revoked_at": {
114
+ "type": [
115
+ "string",
116
+ "null"
117
+ ],
118
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
119
+ },
120
+ "revoked_reason": {
121
+ "type": [
122
+ "string",
123
+ "null"
124
+ ],
125
+ "enum": [
126
+ null,
127
+ "owner_revoked",
128
+ "rotated",
129
+ "compromised",
130
+ "tenant_closed"
131
+ ]
132
+ }
133
+ },
134
+ "$defs": {
135
+ "key_id": {
136
+ "type": "string",
137
+ "pattern": "^key_[0-9a-f]{16}$"
138
+ },
139
+ "tenant_id": {
140
+ "description": "tenant:<slug>. Locally only tenant:deepstack-internal (dogfood) and, in tests, tenant:qa-*.",
141
+ "type": "string",
142
+ "pattern": "^tenant:[a-z0-9][a-z0-9-]{1,62}$"
143
+ },
144
+ "label": {
145
+ "type": "string",
146
+ "pattern": "^[a-z0-9][a-z0-9 ._-]{0,63}$"
147
+ },
148
+ "scopes": {
149
+ "type": "array",
150
+ "minItems": 1,
151
+ "maxItems": 8,
152
+ "uniqueItems": true,
153
+ "items": {
154
+ "enum": [
155
+ "answers:analyst",
156
+ "answers:resolution_explainer",
157
+ "search:analyst",
158
+ "scenarios:analyst",
159
+ "trackrecord:read"
160
+ ]
161
+ }
162
+ },
163
+ "rights": {
164
+ "type": "object",
165
+ "additionalProperties": false,
166
+ "required": [
167
+ "policy_version",
168
+ "purposes"
169
+ ],
170
+ "properties": {
171
+ "policy_version": {
172
+ "$ref": "common.schema.json#/$defs/id"
173
+ },
174
+ "purposes": {
175
+ "type": "array",
176
+ "minItems": 1,
177
+ "maxItems": 3,
178
+ "uniqueItems": true,
179
+ "items": {
180
+ "enum": [
181
+ "read",
182
+ "process",
183
+ "external_provider"
184
+ ]
185
+ }
186
+ }
187
+ }
188
+ },
189
+ "quota": {
190
+ "type": "object",
191
+ "additionalProperties": false,
192
+ "required": [
193
+ "per_minute",
194
+ "per_day",
195
+ "concurrency"
196
+ ],
197
+ "properties": {
198
+ "per_minute": {
199
+ "type": "integer",
200
+ "minimum": 1,
201
+ "maximum": 600
202
+ },
203
+ "per_day": {
204
+ "type": "integer",
205
+ "minimum": 1,
206
+ "maximum": 100000
207
+ },
208
+ "concurrency": {
209
+ "type": "integer",
210
+ "minimum": 1,
211
+ "maximum": 16
212
+ }
213
+ }
214
+ },
215
+ "status": {
216
+ "enum": [
217
+ "active",
218
+ "rotating",
219
+ "revoked",
220
+ "expired"
221
+ ]
222
+ },
223
+ "public_view": {
224
+ "description": "What a key holder may read about its own key: no salt, no digest, no other key of the tenant.",
225
+ "type": "object",
226
+ "additionalProperties": false,
227
+ "required": [
228
+ "schema_version",
229
+ "key_id",
230
+ "tenant_id",
231
+ "label",
232
+ "scopes",
233
+ "rights",
234
+ "quota",
235
+ "status",
236
+ "phase",
237
+ "principal_scope",
238
+ "expires_at",
239
+ "grace_until"
240
+ ],
241
+ "properties": {
242
+ "schema_version": {
243
+ "$ref": "common.schema.json#/$defs/schema_version"
244
+ },
245
+ "key_id": {
246
+ "$ref": "#/$defs/key_id"
247
+ },
248
+ "tenant_id": {
249
+ "$ref": "#/$defs/tenant_id"
250
+ },
251
+ "label": {
252
+ "$ref": "#/$defs/label"
253
+ },
254
+ "scopes": {
255
+ "$ref": "#/$defs/scopes"
256
+ },
257
+ "rights": {
258
+ "$ref": "#/$defs/rights"
259
+ },
260
+ "quota": {
261
+ "$ref": "#/$defs/quota"
262
+ },
263
+ "status": {
264
+ "$ref": "#/$defs/status"
265
+ },
266
+ "phase": {
267
+ "const": "pre_lock"
268
+ },
269
+ "principal_scope": {
270
+ "$ref": "common.schema.json#/$defs/principal_scope"
271
+ },
272
+ "expires_at": {
273
+ "type": [
274
+ "string",
275
+ "null"
276
+ ],
277
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
278
+ },
279
+ "grace_until": {
280
+ "type": [
281
+ "string",
282
+ "null"
283
+ ],
284
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
schemas/common.schema.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "common.schema.json",
4
+ "title": "Common definitions of the DeepStack ML contracts v1",
5
+ "description": "Shared definitions. Timestamps are UTC with an explicit Z or +00:00 offset; naive or non-UTC clocks are refused at the boundary.",
6
+ "$defs": {
7
+ "schema_version": {
8
+ "const": "ml.v1"
9
+ },
10
+ "utc": {
11
+ "type": "string",
12
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
13
+ },
14
+ "sha256": {
15
+ "type": "string",
16
+ "pattern": "^[0-9a-f]{64}$"
17
+ },
18
+ "id": {
19
+ "type": "string",
20
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
21
+ },
22
+ "question_id": {
23
+ "description": "Exactly the game's testId (pNN-tNN, thNNN-tNN). The pattern only bounds the shape; existence is checked against the catalog on the server.",
24
+ "type": "string",
25
+ "pattern": "^[a-z0-9]{1,16}(-[a-z0-9]{1,16}){1,3}$"
26
+ },
27
+ "event_version": {
28
+ "type": "integer",
29
+ "minimum": 1,
30
+ "maximum": 9007199254740991
31
+ },
32
+ "probability": {
33
+ "type": "number",
34
+ "minimum": 0,
35
+ "maximum": 1
36
+ },
37
+ "phase": {
38
+ "enum": [
39
+ "pre_lock",
40
+ "post_lock"
41
+ ]
42
+ },
43
+ "purpose": {
44
+ "enum": [
45
+ "analyst",
46
+ "forecast_component",
47
+ "forecast_pool",
48
+ "resolution_explainer",
49
+ "evaluation"
50
+ ]
51
+ },
52
+ "environment": {
53
+ "description": "Where an execution really ran. 'fake' marks test doubles and can never be presented as a real run.",
54
+ "enum": [
55
+ "fake",
56
+ "local",
57
+ "staging",
58
+ "production"
59
+ ]
60
+ },
61
+ "https_url": {
62
+ "type": "string",
63
+ "pattern": "^https://[^\\s@/]+(/[^\\s]*)?$"
64
+ },
65
+ "polarity": {
66
+ "description": "Stance of a passage towards the question (vocabulary of artifacts/polarity/vault-stance.jsonl).",
67
+ "enum": [
68
+ "bull",
69
+ "bear",
70
+ "neutral"
71
+ ]
72
+ },
73
+ "relation_kind": {
74
+ "description": "How a claim relates to its source (INT-002): the source states it, the source attributes a cause, or the graph inferred it.",
75
+ "enum": [
76
+ "observed",
77
+ "attributed_causal",
78
+ "inferred_hypothesis"
79
+ ]
80
+ },
81
+ "rights_scope": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "required": [
85
+ "policy_version",
86
+ "purposes"
87
+ ],
88
+ "properties": {
89
+ "policy_version": {
90
+ "$ref": "#/$defs/id"
91
+ },
92
+ "purposes": {
93
+ "type": "array",
94
+ "uniqueItems": true,
95
+ "items": {
96
+ "enum": [
97
+ "read",
98
+ "process",
99
+ "external_provider",
100
+ "train",
101
+ "retain",
102
+ "publish"
103
+ ]
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "principal_scope": {
109
+ "description": "Built by the server from a verified session. Never an email or a bearer.",
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": [
113
+ "kind",
114
+ "subject_id",
115
+ "tenant_id"
116
+ ],
117
+ "properties": {
118
+ "kind": {
119
+ "enum": [
120
+ "reader",
121
+ "guest",
122
+ "anonymous",
123
+ "service"
124
+ ]
125
+ },
126
+ "subject_id": {
127
+ "type": [
128
+ "string",
129
+ "null"
130
+ ],
131
+ "pattern": "^sub_[A-Za-z0-9_-]{8,64}$"
132
+ },
133
+ "tenant_id": {
134
+ "$ref": "#/$defs/id"
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
schemas/evidence-pack-items.schema.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "evidence-pack-items.schema.json",
4
+ "title": "EvidencePackItems",
5
+ "description": "The items an EvidencePackRef binds: content_hash is sha256 (ml-v1 canonical) of {as_of, policy_version, phase, items} exactly as listed here, so the record is verifiable against its ref without the search. Items travel beside the ref (the stream's evidence event, a cache), never inside it. Only what passed the time and rights filters is here; rank is the position after fusion and reranking.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "pack_id", "content_hash", "as_of", "policy_version", "phase", "items"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "pack_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "content_hash": { "$ref": "common.schema.json#/$defs/sha256" },
13
+ "as_of": { "$ref": "common.schema.json#/$defs/utc" },
14
+ "policy_version": { "$ref": "common.schema.json#/$defs/id" },
15
+ "phase": { "$ref": "common.schema.json#/$defs/phase" },
16
+ "items": {
17
+ "type": "array",
18
+ "items": { "$ref": "#/$defs/item" }
19
+ }
20
+ },
21
+ "$defs": {
22
+ "clock": {
23
+ "description": "An instant in UTC, or a day (the motor's availability clock has day precision; a day resolves to its END, 23:59:59.999999 UTC, so a point-in-time cut earlier that day excludes it).",
24
+ "type": "string",
25
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
26
+ },
27
+ "optional_clock": {
28
+ "type": ["string", "null"],
29
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
30
+ },
31
+ "item": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["evidence_id", "source_id", "source_url", "span", "clocks", "rights_purposes", "polarity", "lang", "rank", "score", "reasons"],
35
+ "properties": {
36
+ "evidence_id": { "$ref": "common.schema.json#/$defs/id" },
37
+ "source_id": { "$ref": "common.schema.json#/$defs/id" },
38
+ "source_url": { "$ref": "common.schema.json#/$defs/https_url" },
39
+ "span": { "type": "string", "minLength": 1, "maxLength": 600 },
40
+ "clocks": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["available_at", "published_at", "captured_at"],
44
+ "properties": {
45
+ "available_at": { "$ref": "#/$defs/clock" },
46
+ "published_at": { "$ref": "#/$defs/optional_clock" },
47
+ "captured_at": { "$ref": "#/$defs/optional_clock" }
48
+ }
49
+ },
50
+ "rights_purposes": {
51
+ "type": "array",
52
+ "uniqueItems": true,
53
+ "items": { "enum": ["read", "process", "external_provider", "train", "retain", "publish"] }
54
+ },
55
+ "polarity": {
56
+ "description": "common.schema.json#/$defs/polarity, or null when the passage carries no stance.",
57
+ "enum": ["bull", "bear", "neutral", null]
58
+ },
59
+ "lang": { "type": ["string", "null"], "pattern": "^[a-z]{2}$" },
60
+ "rank": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
61
+ "score": { "type": "number" },
62
+ "reasons": { "type": "array", "items": { "type": "string", "maxLength": 64 } }
63
+ }
64
+ }
65
+ }
66
+ }
schemas/evidence-pack-ref.schema.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "evidence-pack-ref.schema.json",
4
+ "title": "EvidencePackRef",
5
+ "description": "A frozen, hash-addressed pack of evidence a request may cite. The hash, phase and policy are part of every cache key; a change of rights or phase invalidates the pack before its next use.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "pack_id", "snapshot_id", "content_hash", "policy_version", "as_of", "phase", "allowed_evidence_ids", "expires_at"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "pack_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "snapshot_id": { "$ref": "common.schema.json#/$defs/id" },
13
+ "content_hash": { "$ref": "common.schema.json#/$defs/sha256" },
14
+ "policy_version": { "$ref": "common.schema.json#/$defs/id" },
15
+ "as_of": { "$ref": "common.schema.json#/$defs/utc" },
16
+ "phase": { "$ref": "common.schema.json#/$defs/phase" },
17
+ "allowed_evidence_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "common.schema.json#/$defs/id" } },
18
+ "expires_at": { "$ref": "common.schema.json#/$defs/utc" }
19
+ }
20
+ }
schemas/grounded-answer.schema.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "grounded-answer.schema.json",
4
+ "title": "GroundedAnswer",
5
+ "description": "An answer whose every claim points at citations inside the authorized pack. A valid id proves only that the reference exists in the pack, not that it supports the claim; semantic support is judged by evidence and evaluation.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "answer_id", "request_id", "pack_id", "claim_refs", "citation_refs", "abstentions", "tool_receipt_ids", "execution_receipt_id", "status"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "answer_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "request_id": { "$ref": "common.schema.json#/$defs/id" },
13
+ "pack_id": { "$ref": "common.schema.json#/$defs/id" },
14
+ "claim_refs": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["claim_id", "text", "kind", "citation_ids"],
20
+ "properties": {
21
+ "claim_id": { "$ref": "common.schema.json#/$defs/id" },
22
+ "text": { "type": "string", "minLength": 1, "maxLength": 1200 },
23
+ "kind": { "enum": ["observed", "interpretation", "scenario"] },
24
+ "citation_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "common.schema.json#/$defs/id" } }
25
+ }
26
+ }
27
+ },
28
+ "citation_refs": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": ["citation_id", "evidence_id", "source_url"],
34
+ "properties": {
35
+ "citation_id": { "$ref": "common.schema.json#/$defs/id" },
36
+ "evidence_id": { "$ref": "common.schema.json#/$defs/id" },
37
+ "source_url": { "$ref": "common.schema.json#/$defs/https_url" },
38
+ "span": { "type": "string", "maxLength": 600 }
39
+ }
40
+ }
41
+ },
42
+ "abstentions": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["reason"],
48
+ "properties": {
49
+ "reason": { "enum": ["insufficient_evidence", "reserved_before_lock", "rights_refused", "stale_source", "tool_failed", "out_of_scope"] },
50
+ "detail": { "type": "string", "maxLength": 300 }
51
+ }
52
+ }
53
+ },
54
+ "tool_receipt_ids": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/id" } },
55
+ "execution_receipt_id": { "type": ["string", "null"], "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" },
56
+ "status": { "enum": ["complete", "partial", "insufficient", "interrupted", "error"] }
57
+ }
58
+ }
schemas/intelligence-request.schema.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "intelligence-request.schema.json",
4
+ "title": "IntelligenceRequest",
5
+ "description": "What the edge asks of the ML service. phase, purpose, principal_scope and rights_scope are computed on the server from a verified session and lock; a value sent by the browser, the chat history or a tool result has no authority. The service checks phase, purpose and every field of principal_scope (kind, subject_id, tenant_id) against the capability that accompanies the request (P3-H) and refuses a divergence with 403 authority_mismatch naming the field.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "request_id", "question_id", "event_version", "as_of", "evidence_snapshot_id", "phase", "purpose", "rights_scope", "principal_scope", "recipe_id"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "request_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "trace_id": { "$ref": "common.schema.json#/$defs/id" },
13
+ "question_id": { "$ref": "common.schema.json#/$defs/question_id" },
14
+ "event_version": { "$ref": "common.schema.json#/$defs/event_version" },
15
+ "as_of": { "$ref": "common.schema.json#/$defs/utc" },
16
+ "evidence_snapshot_id": { "$ref": "common.schema.json#/$defs/id" },
17
+ "phase": { "$ref": "common.schema.json#/$defs/phase" },
18
+ "purpose": { "$ref": "common.schema.json#/$defs/purpose" },
19
+ "rights_scope": { "$ref": "common.schema.json#/$defs/rights_scope" },
20
+ "principal_scope": { "$ref": "common.schema.json#/$defs/principal_scope" },
21
+ "recipe_id": { "$ref": "common.schema.json#/$defs/id" },
22
+ "mode": { "enum": ["roast", "chat", "caption", "summary"] },
23
+ "messages": {
24
+ "description": "Untrusted conversation turns. Never a source of authorization or evidence.",
25
+ "type": "array",
26
+ "maxItems": 20,
27
+ "items": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["role", "content"],
31
+ "properties": {
32
+ "role": { "enum": ["user", "assistant"] },
33
+ "content": { "type": "string", "maxLength": 2000 }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
schemas/model-execution-receipt.schema.json ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "model-execution-receipt.schema.json",
4
+ "title": "ModelExecutionReceipt",
5
+ "description": "One physical execution of a model or deterministic component. A provider's model id does not prove the exact weights: an unobserved revision is 'unknown'. Unobserved usage is 'unknown', never zero. environment='fake' marks a test double. R4 (OPS request of R3, compatible): the gateway, which is the source of the receipt, may add cost (with its status: zero_fixture, known, upper_bound or unknown, and unknown is never zero, so its usd is null), latency_ms and what the provider SAID it ran (model_observed, revision_observed). A receipt without them is still valid; a reader that does not know them may ignore them.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "execution_id",
11
+ "attempt_id",
12
+ "environment",
13
+ "provider",
14
+ "model_id",
15
+ "revision",
16
+ "prompt_hash",
17
+ "template_hash",
18
+ "schema_hash",
19
+ "adapter_hash",
20
+ "started_at",
21
+ "completed_at",
22
+ "attempts",
23
+ "usage",
24
+ "output_hash",
25
+ "error_class"
26
+ ],
27
+ "properties": {
28
+ "schema_version": {
29
+ "$ref": "common.schema.json#/$defs/schema_version"
30
+ },
31
+ "execution_id": {
32
+ "$ref": "common.schema.json#/$defs/id"
33
+ },
34
+ "attempt_id": {
35
+ "type": [
36
+ "string",
37
+ "null"
38
+ ],
39
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
40
+ },
41
+ "environment": {
42
+ "$ref": "common.schema.json#/$defs/environment"
43
+ },
44
+ "provider": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "maxLength": 80
48
+ },
49
+ "model_id": {
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "maxLength": 200
53
+ },
54
+ "revision": {
55
+ "type": "string",
56
+ "pattern": "^(unknown|[0-9a-f]{7,64}|[A-Za-z0-9._-]{1,64})$"
57
+ },
58
+ "prompt_hash": {
59
+ "type": [
60
+ "string",
61
+ "null"
62
+ ],
63
+ "pattern": "^[0-9a-f]{64}$"
64
+ },
65
+ "template_hash": {
66
+ "type": [
67
+ "string",
68
+ "null"
69
+ ],
70
+ "pattern": "^[0-9a-f]{64}$"
71
+ },
72
+ "schema_hash": {
73
+ "type": [
74
+ "string",
75
+ "null"
76
+ ],
77
+ "pattern": "^[0-9a-f]{64}$"
78
+ },
79
+ "adapter_hash": {
80
+ "type": [
81
+ "string",
82
+ "null"
83
+ ],
84
+ "pattern": "^[0-9a-f]{64}$"
85
+ },
86
+ "started_at": {
87
+ "$ref": "common.schema.json#/$defs/utc"
88
+ },
89
+ "completed_at": {
90
+ "type": [
91
+ "string",
92
+ "null"
93
+ ],
94
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$"
95
+ },
96
+ "attempts": {
97
+ "type": "integer",
98
+ "minimum": 1,
99
+ "maximum": 9007199254740991
100
+ },
101
+ "usage": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": [
105
+ "status"
106
+ ],
107
+ "properties": {
108
+ "status": {
109
+ "enum": [
110
+ "known",
111
+ "unknown"
112
+ ]
113
+ },
114
+ "input_tokens": {
115
+ "type": "integer",
116
+ "minimum": 0,
117
+ "maximum": 9007199254740991
118
+ },
119
+ "output_tokens": {
120
+ "type": "integer",
121
+ "minimum": 0,
122
+ "maximum": 9007199254740991
123
+ },
124
+ "hardware_seconds": {
125
+ "type": "number",
126
+ "minimum": 0,
127
+ "maximum": 9007199254740991
128
+ }
129
+ }
130
+ },
131
+ "output_hash": {
132
+ "type": [
133
+ "string",
134
+ "null"
135
+ ],
136
+ "pattern": "^[0-9a-f]{64}$"
137
+ },
138
+ "error_class": {
139
+ "type": [
140
+ "string",
141
+ "null"
142
+ ],
143
+ "enum": [
144
+ null,
145
+ "timeout",
146
+ "rate_limited",
147
+ "provider_error",
148
+ "schema_refused",
149
+ "rights_refused",
150
+ "cancelled",
151
+ "late"
152
+ ]
153
+ },
154
+ "cost": {
155
+ "description": "What the attempt cost. unknown means no price or no usage was recorded and carries usd null; upper_bound is endpoint hot time x hourly price.",
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": [
159
+ "usd",
160
+ "status",
161
+ "basis"
162
+ ],
163
+ "properties": {
164
+ "usd": {
165
+ "type": [
166
+ "number",
167
+ "null"
168
+ ],
169
+ "minimum": 0,
170
+ "maximum": 1000000
171
+ },
172
+ "status": {
173
+ "enum": [
174
+ "zero_fixture",
175
+ "known",
176
+ "upper_bound",
177
+ "unknown"
178
+ ]
179
+ },
180
+ "basis": {
181
+ "type": "string",
182
+ "minLength": 1,
183
+ "maxLength": 300
184
+ },
185
+ "budget_ref": {
186
+ "type": [
187
+ "string",
188
+ "null"
189
+ ],
190
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,119}$"
191
+ }
192
+ }
193
+ },
194
+ "latency_ms": {
195
+ "description": "Wall time of the attempt as the gateway measured it.",
196
+ "type": [
197
+ "number",
198
+ "null"
199
+ ],
200
+ "minimum": 0,
201
+ "maximum": 86400000
202
+ },
203
+ "model_observed": {
204
+ "description": "The model id the provider said answered (a vendor id or an endpoint repository); null when it said nothing.",
205
+ "type": [
206
+ "string",
207
+ "null"
208
+ ],
209
+ "minLength": 1,
210
+ "maxLength": 200
211
+ },
212
+ "revision_observed": {
213
+ "description": "The revision the endpoint said it served; null when not reported.",
214
+ "type": [
215
+ "string",
216
+ "null"
217
+ ],
218
+ "pattern": "^[A-Za-z0-9._-]{1,64}$"
219
+ }
220
+ }
221
+ }
schemas/product-event.schema.json ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "product-event.schema.json",
4
+ "title": "ProductEvent",
5
+ "description": "One product event (REL-04, R4), measured without mixing records: cohort says whose it is (account, guest, machine, internal, qa) and every count is per cohort; machine, internal and qa never count as people. Only technical public ids, a stage, a latency bucket and an experiment/version: no question text, e-mail, passage, free URL or token, and the subject is a pseudonym (sp_ + HMAC), never the account id. A measurement event exists only with consent 'measurement'; 'essential' events are the ones the product needs to work. Erasure removes a pseudonym's events and stays in force after a restore (privacy/erasure.py).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "event_id",
11
+ "kind",
12
+ "cohort",
13
+ "subject_ref",
14
+ "tenant_id",
15
+ "consent",
16
+ "occurred_at"
17
+ ],
18
+ "properties": {
19
+ "schema_version": {
20
+ "$ref": "common.schema.json#/$defs/schema_version"
21
+ },
22
+ "event_id": {
23
+ "type": "string",
24
+ "pattern": "^ev_[0-9a-f]{24}$"
25
+ },
26
+ "kind": {
27
+ "enum": [
28
+ "context_ready",
29
+ "analyst_started",
30
+ "analyst_completed",
31
+ "analyst_cancelled",
32
+ "analyst_failed",
33
+ "citation_opened",
34
+ "evidence_opened",
35
+ "scenario_completed",
36
+ "first_lock_confirmed",
37
+ "result_viewed_revision",
38
+ "follows_changed"
39
+ ]
40
+ },
41
+ "cohort": {
42
+ "enum": [
43
+ "account",
44
+ "guest",
45
+ "machine",
46
+ "internal",
47
+ "qa"
48
+ ]
49
+ },
50
+ "subject_ref": {
51
+ "description": "Pseudonym of the subject (HMAC under a server key); null for a machine.",
52
+ "type": [
53
+ "string",
54
+ "null"
55
+ ],
56
+ "pattern": "^sp_[0-9a-f]{32}$"
57
+ },
58
+ "tenant_id": {
59
+ "$ref": "common.schema.json#/$defs/id"
60
+ },
61
+ "consent": {
62
+ "enum": [
63
+ "essential",
64
+ "measurement"
65
+ ]
66
+ },
67
+ "occurred_at": {
68
+ "$ref": "common.schema.json#/$defs/utc"
69
+ },
70
+ "object_id": {
71
+ "description": "A public technical id the event is about (testId, answer id, revision id).",
72
+ "$ref": "common.schema.json#/$defs/id"
73
+ },
74
+ "stage": {
75
+ "type": "string",
76
+ "pattern": "^[a-z][a-z0-9_]{0,31}$"
77
+ },
78
+ "latency_bucket": {
79
+ "enum": [
80
+ "lt_1s",
81
+ "1_5s",
82
+ "5_20s",
83
+ "gt_20s"
84
+ ]
85
+ },
86
+ "experiment": {
87
+ "type": "string",
88
+ "pattern": "^[a-z0-9][a-z0-9._-]{0,47}$"
89
+ },
90
+ "version": {
91
+ "type": "string",
92
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$"
93
+ }
94
+ }
95
+ }
schemas/publication-record.schema.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "publication-record.schema.json",
4
+ "title": "PublicationRecord",
5
+ "description": "One publication (INF-18, R4): a versioned, content-addressed artifact that a public projection reads. It is committed through an outbox: the artifact is written and read back first, then the commit event, then the pointer moves by compare-and-swap. Replaying the committed outbox rebuilds the same projection, byte for byte (projection_sha256). version grows by one per kind; prev_publication_id chains the versions; nothing is overwritten.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "publication_id",
11
+ "kind",
12
+ "version",
13
+ "content_sha256",
14
+ "artifact_key",
15
+ "media_type",
16
+ "size_bytes",
17
+ "prev_publication_id",
18
+ "source_refs",
19
+ "committed_at",
20
+ "environment"
21
+ ],
22
+ "properties": {
23
+ "schema_version": {
24
+ "$ref": "common.schema.json#/$defs/schema_version"
25
+ },
26
+ "publication_id": {
27
+ "type": "string",
28
+ "pattern": "^pub_[0-9a-f]{24}$"
29
+ },
30
+ "kind": {
31
+ "enum": [
32
+ "trackrecord",
33
+ "catalog",
34
+ "dataset_manifest",
35
+ "space_manifest",
36
+ "cohort_report"
37
+ ]
38
+ },
39
+ "version": {
40
+ "type": "integer",
41
+ "minimum": 1,
42
+ "maximum": 9007199254740991
43
+ },
44
+ "content_sha256": {
45
+ "$ref": "common.schema.json#/$defs/sha256"
46
+ },
47
+ "artifact_key": {
48
+ "type": "string",
49
+ "pattern": "^objects/[0-9a-f]{64}\\.json$"
50
+ },
51
+ "media_type": {
52
+ "const": "application/json"
53
+ },
54
+ "size_bytes": {
55
+ "type": "integer",
56
+ "minimum": 2,
57
+ "maximum": 67108864
58
+ },
59
+ "prev_publication_id": {
60
+ "type": [
61
+ "string",
62
+ "null"
63
+ ],
64
+ "pattern": "^pub_[0-9a-f]{24}$"
65
+ },
66
+ "source_refs": {
67
+ "type": "array",
68
+ "maxItems": 64,
69
+ "uniqueItems": true,
70
+ "items": {
71
+ "$ref": "common.schema.json#/$defs/id"
72
+ }
73
+ },
74
+ "committed_at": {
75
+ "$ref": "common.schema.json#/$defs/utc"
76
+ },
77
+ "environment": {
78
+ "$ref": "common.schema.json#/$defs/environment"
79
+ }
80
+ }
81
+ }
schemas/scenario-run.schema.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "scenario-run.schema.json",
4
+ "title": "ScenarioRunV1",
5
+ "description": "One run of an allowlisted, pure, read-only scenario tool (POST /v1/scenarios/runs). Inputs and outputs carry units; method, assumptions and limitations are the tool's; seed is null unless the tool is stochastic. A run never writes a forecast, the lock or XP (side_effects is always 'none') and is never a probability of the question: it restates a rule or a hypothesis for the principal it was computed for.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "run_id", "request_id", "question_id", "tool_id", "tool_version", "domain", "method", "inputs", "outputs", "assumptions", "limitations", "source_ids", "as_of", "seed", "computed_at", "expires_at", "principal_scope", "tool_receipt_id", "side_effects", "status"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "run_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "request_id": { "$ref": "common.schema.json#/$defs/id" },
13
+ "question_id": { "type": ["string", "null"], "pattern": "^[a-z0-9]{1,16}(-[a-z0-9]{1,16}){1,3}$" },
14
+ "tool_id": { "$ref": "common.schema.json#/$defs/id" },
15
+ "tool_version": { "$ref": "common.schema.json#/$defs/id" },
16
+ "domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
17
+ "method": { "type": "string", "minLength": 1, "maxLength": 300 },
18
+ "inputs": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/quantity" } },
19
+ "outputs": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/quantity" } },
20
+ "assumptions": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 300 } },
21
+ "limitations": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1, "maxLength": 300 } },
22
+ "source_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "common.schema.json#/$defs/id" } },
23
+ "as_of": { "$ref": "common.schema.json#/$defs/utc" },
24
+ "seed": { "type": ["integer", "null"], "minimum": 0, "maximum": 9007199254740991 },
25
+ "computed_at": { "$ref": "common.schema.json#/$defs/utc" },
26
+ "expires_at": { "$ref": "common.schema.json#/$defs/utc" },
27
+ "principal_scope": { "$ref": "common.schema.json#/$defs/principal_scope" },
28
+ "tool_receipt_id": { "$ref": "common.schema.json#/$defs/id" },
29
+ "side_effects": { "const": "none" },
30
+ "status": { "enum": ["complete", "error"] }
31
+ },
32
+ "$defs": {
33
+ "quantity": {
34
+ "description": "A named value with its unit; a unitless count says so ('count', 'binary', 'points').",
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["name", "value", "unit"],
38
+ "properties": {
39
+ "name": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
40
+ "value": { "type": ["number", "string", "boolean", "null"] },
41
+ "unit": { "type": "string", "minLength": 1, "maxLength": 40 }
42
+ }
43
+ }
44
+ }
45
+ }
schemas/search-result.schema.json ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "search-result.schema.json",
4
+ "title": "SearchResult",
5
+ "description": "One page of GET /v1/search (R3, backend of APP-04): a contextual search over the ACTIVE retrieval generation (INF-11), under the analyst capability. Phase and purpose come from the capability; time (as_of) and rights purposes are applied before any ranking; before the lock a query for the Call or the machines' numbers is withheld and items that name them or that a machine produced are never shown (counted in withheld_before_lock). Counter-evidence is mandatory when it exists: the first page carries the opposite polarity to the dominant one, marked role counter_evidence; none_available says no item of that side passed the filters, not_applicable that no item has a side or that the page is not the first (the counter-evidence of a result set is reported on its first page). Pages are cut by an opaque cursor bound to the generation (a cursor of another generation is refused with 409). Each item lists the claims of the bitemporal graph that cite it as of the cut. Evidence ids are the motor's own ids (they may carry underscores).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "request_id", "question_id", "phase", "as_of", "environment", "status", "reason", "query", "generation", "filters", "items", "counter_evidence", "withheld_before_lock", "degradations", "page"],
9
+ "properties": {
10
+ "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
11
+ "request_id": { "$ref": "common.schema.json#/$defs/id" },
12
+ "question_id": { "$ref": "common.schema.json#/$defs/question_id" },
13
+ "phase": { "$ref": "common.schema.json#/$defs/phase" },
14
+ "as_of": { "$ref": "common.schema.json#/$defs/utc" },
15
+ "environment": { "$ref": "common.schema.json#/$defs/environment" },
16
+ "status": { "enum": ["ok", "empty", "withheld"] },
17
+ "reason": {
18
+ "description": "Why a page has no items: nothing passed the filters, nothing matched, or the pre-lock refusal. null when there are items.",
19
+ "enum": ["nothing_available", "no_match", "reserved_before_lock", null]
20
+ },
21
+ "query": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["text", "context"],
25
+ "properties": {
26
+ "text": { "type": "string", "maxLength": 500 },
27
+ "context": {
28
+ "type": ["object", "null"],
29
+ "additionalProperties": false,
30
+ "required": ["kind", "id", "title"],
31
+ "properties": {
32
+ "kind": { "enum": ["question", "book", "part"] },
33
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,127}$" },
34
+ "title": { "type": "string", "maxLength": 300 }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "generation": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["generation_id", "content_hash", "snapshot_id", "encoder_generation_id", "dense"],
43
+ "properties": {
44
+ "generation_id": { "type": "string", "pattern": "^gen-[0-9a-f]{16}$" },
45
+ "content_hash": { "$ref": "common.schema.json#/$defs/sha256" },
46
+ "snapshot_id": { "$ref": "common.schema.json#/$defs/id" },
47
+ "encoder_generation_id": { "type": "string", "minLength": 1, "maxLength": 200 },
48
+ "dense": { "type": "boolean", "description": "false when the query encoder is not the generation's: the page is lexical only and degradations say why." }
49
+ }
50
+ },
51
+ "filters": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["required_purposes", "considered", "kept", "rejected_time", "rejected_rights", "rejected_invalid"],
55
+ "properties": {
56
+ "required_purposes": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "enum": ["read", "process", "external_provider", "publish"] } },
57
+ "considered": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
58
+ "kept": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
59
+ "rejected_time": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
60
+ "rejected_rights": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
61
+ "rejected_invalid": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
62
+ }
63
+ },
64
+ "items": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/item" } },
65
+ "counter_evidence": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["status", "evidence_ids"],
69
+ "properties": {
70
+ "status": { "enum": ["present", "none_available", "not_applicable"] },
71
+ "evidence_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/evidence_id" } }
72
+ }
73
+ },
74
+ "withheld_before_lock": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
75
+ "degradations": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["code", "detail"],
81
+ "properties": {
82
+ "code": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
83
+ "detail": { "type": "string", "maxLength": 300 }
84
+ }
85
+ }
86
+ },
87
+ "page": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["size", "offset", "returned", "next_cursor"],
91
+ "properties": {
92
+ "size": { "type": "integer", "minimum": 1, "maximum": 50 },
93
+ "offset": { "type": "integer", "minimum": 0, "maximum": 200 },
94
+ "returned": { "type": "integer", "minimum": 0, "maximum": 50 },
95
+ "next_cursor": { "type": ["string", "null"], "pattern": "^[A-Za-z0-9_-]{1,512}$" }
96
+ }
97
+ }
98
+ },
99
+ "$defs": {
100
+ "evidence_id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$" },
101
+ "clock": {
102
+ "type": "string",
103
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
104
+ },
105
+ "optional_clock": {
106
+ "type": ["string", "null"],
107
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00))?$"
108
+ },
109
+ "item": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["evidence_id", "source_id", "source_url", "span", "clocks", "rights_purposes", "polarity", "lang", "rank", "score", "role", "reasons", "graph"],
113
+ "properties": {
114
+ "evidence_id": { "$ref": "#/$defs/evidence_id" },
115
+ "source_id": { "$ref": "#/$defs/evidence_id" },
116
+ "source_url": { "$ref": "common.schema.json#/$defs/https_url" },
117
+ "span": { "type": "string", "minLength": 1, "maxLength": 600 },
118
+ "clocks": {
119
+ "type": "object",
120
+ "additionalProperties": false,
121
+ "required": ["available_at", "published_at", "captured_at"],
122
+ "properties": {
123
+ "available_at": { "$ref": "#/$defs/clock" },
124
+ "published_at": { "$ref": "#/$defs/optional_clock" },
125
+ "captured_at": { "$ref": "#/$defs/optional_clock" }
126
+ }
127
+ },
128
+ "rights_purposes": {
129
+ "type": "array",
130
+ "uniqueItems": true,
131
+ "items": { "enum": ["read", "process", "external_provider", "train", "retain", "publish"] }
132
+ },
133
+ "polarity": { "enum": ["bull", "bear", "neutral", null] },
134
+ "lang": { "type": ["string", "null"], "pattern": "^[a-z]{2}$" },
135
+ "rank": { "type": "integer", "minimum": 1, "maximum": 250 },
136
+ "score": { "type": "number" },
137
+ "role": { "enum": ["match", "counter_evidence"] },
138
+ "reasons": { "type": "array", "items": { "type": "string", "maxLength": 64 } },
139
+ "graph": {
140
+ "description": "Claims of the bitemporal graph that cite this item, as of the cut (at most 10).",
141
+ "type": "array",
142
+ "maxItems": 10,
143
+ "items": {
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "required": ["claim_id", "status", "relation_kind"],
147
+ "properties": {
148
+ "claim_id": { "type": "string", "pattern": "^clm_[a-z0-9_-]{2,80}$" },
149
+ "status": { "enum": ["current", "superseded", "refuted"] },
150
+ "relation_kind": { "enum": ["observed", "attributed_causal", "inferred_hypothesis", null] }
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }