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

DeepStack API v2 contracts, package 1be436ac1a7c (CC-BY-4.0), new version over 1e3bc19d329b

Browse files
README.md CHANGED
@@ -19,9 +19,9 @@ The JSON Schemas of the DeepStack ML API v2 (`/v2/answers:stream`, `/v2/search`,
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
 
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:** 35 files (12 schemas, 23 examples), listed in `manifest.json` with sha256, size,
23
  licence, source and rights per item.
24
+ - **Package id:** `1be436ac1a7c92861d710a9a25791aac329493fa2aad2cdff98fbd194335cc66` (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
examples/api-key/valid-dogfood-key.json CHANGED
@@ -2,6 +2,7 @@
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",
 
2
  "schema_version": "ml.v1",
3
  "key_id": "key_0123456789abcdef",
4
  "tenant_id": "tenant:deepstack-internal",
5
+ "workspace_id": null,
6
  "label": "dogfood mcp v2",
7
  "scopes": [
8
  "answers:analyst",
examples/api-key/valid-rotated-in-grace.json CHANGED
@@ -2,6 +2,7 @@
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",
 
2
  "schema_version": "ml.v1",
3
  "key_id": "key_fedcba9876543210",
4
  "tenant_id": "tenant:deepstack-internal",
5
+ "workspace_id": null,
6
  "label": "dogfood mcp v2",
7
  "scopes": [
8
  "answers:analyst",
examples/api-key/valid-workspace-key.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ml.v1",
3
+ "key_id": "key_1111222233334444",
4
+ "tenant_id": "tenant:deepstack-internal",
5
+ "workspace_id": "ws_0123456789abcdef0123",
6
+ "label": "FIXTURE desk key",
7
+ "scopes": [
8
+ "workspace:export.process",
9
+ "workspace:read"
10
+ ],
11
+ "rights": {
12
+ "policy_version": "policy-r0",
13
+ "purposes": [
14
+ "read",
15
+ "process"
16
+ ]
17
+ },
18
+ "quota": {
19
+ "per_minute": 30,
20
+ "per_day": 2000,
21
+ "concurrency": 2
22
+ },
23
+ "status": "active",
24
+ "phase": "pre_lock",
25
+ "hash": {
26
+ "algorithm": "pbkdf2-hmac-sha256",
27
+ "iterations": 20000,
28
+ "salt": "00000000000000000000000000000000",
29
+ "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
30
+ },
31
+ "created_at": "2026-10-29T15:00:00Z",
32
+ "expires_at": null,
33
+ "rotated_from": null,
34
+ "rotated_to": null,
35
+ "grace_until": null,
36
+ "revoked_at": null,
37
+ "revoked_reason": null
38
+ }
examples/product-event/valid-account-measurement.json CHANGED
@@ -4,7 +4,7 @@
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",
 
4
  "kind": "analyst_completed",
5
  "cohort": "account",
6
  "subject_ref": "sp_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
7
+ "tenant_id": "tenant:deepstack-public",
8
  "consent": "measurement",
9
  "occurred_at": "2026-10-29T15:00:00Z",
10
  "object_id": "th001-t41",
manifest.json CHANGED
@@ -2,7 +2,7 @@
2
  "attribution": "DeepStack",
3
  "card": {
4
  "path": "README.md",
5
- "sha256": "0813beaba40785de7e216fe6ce12a9928b1a6ba9ce36d3090e4d180d9bbe8228",
6
  "size_bytes": 1809
7
  },
8
  "excluded": [
@@ -166,8 +166,8 @@
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
  {
@@ -181,10 +181,25 @@
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",
@@ -331,8 +346,8 @@
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
  {
@@ -494,8 +509,8 @@
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
  {
@@ -655,7 +670,7 @@
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"
 
2
  "attribution": "DeepStack",
3
  "card": {
4
  "path": "README.md",
5
+ "sha256": "de3877753089805b605389f5f4cde1b9bba42935a0069ac929d114843081b0c3",
6
  "size_bytes": 1809
7
  },
8
  "excluded": [
 
166
  "read"
167
  ],
168
  "schema": "api-key",
169
+ "sha256": "c9da95dd1fcf75f18da4d8ef1e4fd23e033b094f46047d0a77b34a71488a846e",
170
+ "size_bytes": 845,
171
  "source": "contracts/ml/fixtures/v1/api-key/valid-dogfood-key.json"
172
  },
173
  {
 
181
  "read"
182
  ],
183
  "schema": "api-key",
184
+ "sha256": "d12c57b987c533fcf9c2c3e0685c2dce172d6a3a8c70c97ee262dd23356a386c",
185
+ "size_bytes": 883,
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": "R5: chave de workspace emitida pelo TenantStore, presa a um workspace, so scopes workspace:*",
192
+ "path": "examples/api-key/valid-workspace-key.json",
193
+ "rights_purposes": [
194
+ "process",
195
+ "publish",
196
+ "read"
197
+ ],
198
+ "schema": "api-key",
199
+ "sha256": "0efe43bd7547f07aeb35e67165e59a2d2de53fc308dea963c5972f40dddc5671",
200
+ "size_bytes": 832,
201
+ "source": "contracts/ml/fixtures/v1/api-key/valid-workspace-key.json"
202
+ },
203
  {
204
  "kind": "example",
205
  "licence": "cc-by-4.0",
 
346
  "read"
347
  ],
348
  "schema": "product-event",
349
+ "sha256": "e5b06b9b8621728794353623bf55ae33473d5995481a1d2cad0e6cfaa07988ab",
350
+ "size_bytes": 380,
351
  "source": "contracts/ml/fixtures/v1/product-event/valid-account-measurement.json"
352
  },
353
  {
 
509
  "read"
510
  ],
511
  "schema": "api-key",
512
+ "sha256": "a25a25f7b29abef81f4777b7b24b3be2f50909fca1afd05de2b614bec413312a",
513
+ "size_bytes": 7971,
514
  "source": "contracts/ml/v1/api-key.schema.json"
515
  },
516
  {
 
670
  "size_bytes": 18657
671
  },
672
  "name": "dataset-api-v2-contracts",
673
+ "package_id": "1be436ac1a7c92861d710a9a25791aac329493fa2aad2cdff98fbd194335cc66",
674
  "repo": "deepstack-ml/deepstack-api-v2-contracts",
675
  "schema": "deepstack.distribution.dataset/v1",
676
  "visibility": "public"
schemas/api-key.schema.json CHANGED
@@ -2,13 +2,14 @@
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",
@@ -34,6 +35,9 @@
34
  "tenant_id": {
35
  "$ref": "#/$defs/tenant_id"
36
  },
 
 
 
37
  "label": {
38
  "$ref": "#/$defs/label"
39
  },
@@ -127,7 +131,8 @@
127
  "owner_revoked",
128
  "rotated",
129
  "compromised",
130
- "tenant_closed"
 
131
  ]
132
  }
133
  },
@@ -137,13 +142,21 @@
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",
@@ -156,7 +169,11 @@
156
  "answers:resolution_explainer",
157
  "search:analyst",
158
  "scenarios:analyst",
159
- "trackrecord:read"
 
 
 
 
160
  ]
161
  }
162
  },
@@ -228,6 +245,7 @@
228
  "schema_version",
229
  "key_id",
230
  "tenant_id",
 
231
  "label",
232
  "scopes",
233
  "rights",
@@ -248,6 +266,9 @@
248
  "tenant_id": {
249
  "$ref": "#/$defs/tenant_id"
250
  },
 
 
 
251
  "label": {
252
  "$ref": "#/$defs/label"
253
  },
 
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
  "$id": "api-key.schema.json",
4
  "title": "ApiKeyRecord",
5
+ "description": "One API key as the server stores it (INT-007/APP-10, R4; R5: the single key system). The secret is never stored: only a salted PBKDF2-HMAC-SHA256 digest, with its own random salt. A key is either a /v2 key (workspace_id null; scopes 'route:purpose' from a closed list) or a workspace key (workspace_id set; workspace:* scopes only), never both. A key is never a forecasting machine, never trains, retains or publishes. rights is the ceiling of the rights a request may claim (and, on /v2/search, the purposes every item must carry). phase is always pre_lock: a key cannot attest a lock. Cross-field rules (semantic.check_api_key): a revoked key has revoked_at and revoked_reason, a live one has neither; expires_at is after created_at; a rotating key names rotated_to and grace_until; workspace scopes exactly when workspace_id. 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
+ "workspace_id",
13
  "label",
14
  "scopes",
15
  "rights",
 
35
  "tenant_id": {
36
  "$ref": "#/$defs/tenant_id"
37
  },
38
+ "workspace_id": {
39
+ "$ref": "#/$defs/workspace_id"
40
+ },
41
  "label": {
42
  "$ref": "#/$defs/label"
43
  },
 
131
  "owner_revoked",
132
  "rotated",
133
  "compromised",
134
+ "tenant_closed",
135
+ "workspace_archived"
136
  ]
137
  }
138
  },
 
142
  "pattern": "^key_[0-9a-f]{16}$"
143
  },
144
  "tenant_id": {
145
+ "description": "tenant:<slug>. Canonical: tenant:deepstack-public (every reader of the app) and tenant:deepstack-internal; keys exist locally only in tenant:deepstack-internal and, in tests, tenant:qa-*.",
146
  "type": "string",
147
  "pattern": "^tenant:[a-z0-9][a-z0-9-]{1,62}$"
148
  },
149
+ "workspace_id": {
150
+ "description": "The one workspace a workspace key is bound to; null for a /v2 key.",
151
+ "type": [
152
+ "string",
153
+ "null"
154
+ ],
155
+ "pattern": "^ws_[0-9A-Za-z]{4,64}$"
156
+ },
157
  "label": {
158
  "type": "string",
159
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]{0,63}$"
160
  },
161
  "scopes": {
162
  "type": "array",
 
169
  "answers:resolution_explainer",
170
  "search:analyst",
171
  "scenarios:analyst",
172
+ "trackrecord:read",
173
+ "workspace:read",
174
+ "workspace:collections.read",
175
+ "workspace:notes.read",
176
+ "workspace:export.process"
177
  ]
178
  }
179
  },
 
245
  "schema_version",
246
  "key_id",
247
  "tenant_id",
248
+ "workspace_id",
249
  "label",
250
  "scopes",
251
  "rights",
 
266
  "tenant_id": {
267
  "$ref": "#/$defs/tenant_id"
268
  },
269
+ "workspace_id": {
270
+ "$ref": "#/$defs/workspace_id"
271
+ },
272
  "label": {
273
  "$ref": "#/$defs/label"
274
  },