File size: 3,028 Bytes
1e3bc19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "scenario-run.schema.json",
  "title": "ScenarioRunV1",
  "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.",
  "type": "object",
  "additionalProperties": false,
  "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"],
  "properties": {
    "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" },
    "run_id": { "$ref": "common.schema.json#/$defs/id" },
    "request_id": { "$ref": "common.schema.json#/$defs/id" },
    "question_id": { "type": ["string", "null"], "pattern": "^[a-z0-9]{1,16}(-[a-z0-9]{1,16}){1,3}$" },
    "tool_id": { "$ref": "common.schema.json#/$defs/id" },
    "tool_version": { "$ref": "common.schema.json#/$defs/id" },
    "domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
    "method": { "type": "string", "minLength": 1, "maxLength": 300 },
    "inputs": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/quantity" } },
    "outputs": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/quantity" } },
    "assumptions": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 300 } },
    "limitations": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1, "maxLength": 300 } },
    "source_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "common.schema.json#/$defs/id" } },
    "as_of": { "$ref": "common.schema.json#/$defs/utc" },
    "seed": { "type": ["integer", "null"], "minimum": 0, "maximum": 9007199254740991 },
    "computed_at": { "$ref": "common.schema.json#/$defs/utc" },
    "expires_at": { "$ref": "common.schema.json#/$defs/utc" },
    "principal_scope": { "$ref": "common.schema.json#/$defs/principal_scope" },
    "tool_receipt_id": { "$ref": "common.schema.json#/$defs/id" },
    "side_effects": { "const": "none" },
    "status": { "enum": ["complete", "error"] }
  },
  "$defs": {
    "quantity": {
      "description": "A named value with its unit; a unitless count says so ('count', 'binary', 'points').",
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "value", "unit"],
      "properties": {
        "name": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
        "value": { "type": ["number", "string", "boolean", "null"] },
        "unit": { "type": "string", "minLength": 1, "maxLength": 40 }
      }
    }
  }
}