File size: 4,145 Bytes
1d3f990
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Receipt Schema",
  "description": "Execution receipt with cryptographic sealing",
  "type": "object",
  "required": [
    "schema_version",
    "sequence_number",
    "receipt_id",
    "previous_receipt_hash",
    "agent_id",
    "capability_id",
    "instruction_hash",
    "action",
    "input_hash",
    "output_hash",
    "runtime_identity",
    "runtime_version",
    "source_commit",
    "environment_hash",
    "timestamp",
    "monotonic_counter",
    "status",
    "signature"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "enum": ["1.0"],
      "description": "Receipt schema version"
    },
    "sequence_number": {
      "type": "integer",
      "description": "Monotonic sequence in receipt chain",
      "minimum": 0
    },
    "receipt_id": {
      "type": "string",
      "description": "Unique receipt identifier",
      "minLength": 32,
      "maxLength": 64
    },
    "receipt_hash": {
      "type": "string",
      "description": "SHA-256 hash of this receipt",
      "pattern": "^[a-f0-9]{64}$"
    },
    "previous_receipt_hash": {
      "type": "string",
      "description": "Hash of previous receipt in chain (or zeros for first)",
      "pattern": "^[a-f0-9]{64}$"
    },
    "agent_id": {
      "type": "string",
      "description": "Agent that executed this action",
      "minLength": 1,
      "maxLength": 50
    },
    "capability_id": {
      "type": "string",
      "description": "Capability under which this action was performed",
      "minLength": 32
    },
    "instruction_hash": {
      "type": "string",
      "description": "SHA-256 hash of the instruction executed",
      "pattern": "^[a-f0-9]{64}$"
    },
    "action": {
      "type": "string",
      "description": "Action performed (dispatch, verify, execute, etc.)",
      "minLength": 1,
      "maxLength": 50
    },
    "input_hash": {
      "type": "string",
      "description": "SHA-256 hash of input to this action",
      "pattern": "^[a-f0-9]{64}$"
    },
    "output_hash": {
      "type": "string",
      "description": "SHA-256 hash of output from this action",
      "pattern": "^[a-f0-9]{64}$"
    },
    "runtime_identity": {
      "type": "string",
      "description": "Identity of the runtime that executed this",
      "minLength": 1,
      "maxLength": 50
    },
    "runtime_version": {
      "type": "string",
      "description": "Version string of runtime",
      "pattern": "^\\d+\\.\\d+\\.\\d+.*$"
    },
    "source_commit": {
      "type": "string",
      "description": "Git commit hash of source code",
      "pattern": "^[a-f0-9]{40}$"
    },
    "environment_hash": {
      "type": "string",
      "description": "Hash of environment variables and config at execution time",
      "pattern": "^[a-f0-9]{64}$"
    },
    "timestamp": {
      "type": "integer",
      "description": "Unix timestamp of execution",
      "minimum": 0
    },
    "monotonic_counter": {
      "type": "integer",
      "description": "System monotonic counter (for causality)",
      "minimum": 0
    },
    "status": {
      "type": "string",
      "enum": ["success", "failure", "pending", "cancelled"],
      "description": "Execution status"
    },
    "error_message": {
      "type": ["string", "null"],
      "description": "Error message if status is failure"
    },
    "performance_metrics": {
      "type": "object",
      "description": "Optional performance data",
      "properties": {
        "wall_time_ms": { "type": "number" },
        "cpu_time_ms": { "type": "number" },
        "memory_peak_bytes": { "type": "integer" }
      }
    },
    "signature": {
      "type": "string",
      "description": "Ed25519 signature of receipt",
      "minLength": 128,
      "maxLength": 128,
      "pattern": "^[a-f0-9]{128}$"
    },
    "sealed": {
      "type": "boolean",
      "description": "Whether this receipt is WORM-sealed"
    }
  },
  "additionalProperties": false
}