scientific-protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/generated/contracts.d.ts +31442 -0
  4. package/dist/generated/contracts.js +10623 -0
  5. package/dist/sdk/client.d.ts +376 -0
  6. package/dist/sdk/client.js +427 -0
  7. package/dist/sdk/index.d.ts +8 -0
  8. package/dist/sdk/index.js +7 -0
  9. package/dist/sdk/rewards.d.ts +42 -0
  10. package/dist/sdk/rewards.js +84 -0
  11. package/dist/sdk/types.d.ts +300 -0
  12. package/dist/sdk/types.js +1 -0
  13. package/dist/shared/agent-request-envelope.d.ts +40 -0
  14. package/dist/shared/agent-request-envelope.js +51 -0
  15. package/dist/shared/artifact-storage-attestations.d.ts +64 -0
  16. package/dist/shared/artifact-storage-attestations.js +104 -0
  17. package/dist/shared/artifact-storage-bundles.d.ts +44 -0
  18. package/dist/shared/artifact-storage-bundles.js +124 -0
  19. package/dist/shared/artifact-storage-policy.d.ts +38 -0
  20. package/dist/shared/artifact-storage-policy.js +47 -0
  21. package/dist/shared/contracts.d.ts +30 -0
  22. package/dist/shared/contracts.js +46 -0
  23. package/dist/shared/deployment.d.ts +52 -0
  24. package/dist/shared/deployment.js +156 -0
  25. package/dist/shared/secrets.d.ts +6 -0
  26. package/dist/shared/secrets.js +30 -0
  27. package/dist/shared/sha256.d.ts +2 -0
  28. package/dist/shared/sha256.js +4 -0
  29. package/package.json +103 -0
  30. package/schemas/artifact-storage-attestation.schema.json +116 -0
  31. package/schemas/artifact-storage-bundle.schema.json +107 -0
  32. package/schemas/claim.schema.json +83 -0
  33. package/schemas/evaluation.schema.json +96 -0
  34. package/schemas/replication.schema.json +103 -0
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scientific-protocol.local/schemas/artifact-storage-attestation.schema.json",
4
+ "title": "ArtifactStorageAttestation",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["kind", "version", "envelope", "signature"],
8
+ "properties": {
9
+ "kind": {
10
+ "const": "scientific.artifact-storage-attestation"
11
+ },
12
+ "version": {
13
+ "const": 1
14
+ },
15
+ "envelope": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": [
19
+ "actionType",
20
+ "artifactKey",
21
+ "attestorAddress",
22
+ "chainId",
23
+ "cid",
24
+ "commitmentKind",
25
+ "evidenceRef",
26
+ "issuedAt",
27
+ "nodeId",
28
+ "provider",
29
+ "providerMetadata",
30
+ "requestNonce",
31
+ "retentionUntil",
32
+ "retrievalUrl",
33
+ "scopeKey",
34
+ "storageClass",
35
+ "storageStartedAt"
36
+ ],
37
+ "properties": {
38
+ "actionType": {
39
+ "const": "artifact_storage_attestation"
40
+ },
41
+ "artifactKey": {
42
+ "type": "string",
43
+ "minLength": 1
44
+ },
45
+ "attestorAddress": {
46
+ "type": "string",
47
+ "pattern": "^0x[a-fA-F0-9]{40}$"
48
+ },
49
+ "chainId": {
50
+ "type": "integer",
51
+ "minimum": 1
52
+ },
53
+ "cid": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "commitmentKind": {
58
+ "type": "string",
59
+ "enum": ["filecoin", "hot", "institutional", "mirror", "provider", "temporary"]
60
+ },
61
+ "evidenceRef": {
62
+ "type": ["string", "null"]
63
+ },
64
+ "issuedAt": {
65
+ "type": "string",
66
+ "format": "date-time"
67
+ },
68
+ "nodeId": {
69
+ "type": ["string", "null"]
70
+ },
71
+ "provider": {
72
+ "type": "string",
73
+ "minLength": 1
74
+ },
75
+ "providerMetadata": {
76
+ "type": "object"
77
+ },
78
+ "requestNonce": {
79
+ "type": "string",
80
+ "minLength": 1
81
+ },
82
+ "retentionUntil": {
83
+ "type": ["string", "null"],
84
+ "format": "date-time"
85
+ },
86
+ "retrievalUrl": {
87
+ "type": ["string", "null"]
88
+ },
89
+ "scopeKey": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ },
93
+ "storageClass": {
94
+ "type": "string",
95
+ "enum": ["A", "B", "C", "D"]
96
+ },
97
+ "storageStartedAt": {
98
+ "type": "string",
99
+ "format": "date-time"
100
+ }
101
+ }
102
+ },
103
+ "signature": {
104
+ "type": "string",
105
+ "pattern": "^0x[a-fA-F0-9]+$"
106
+ },
107
+ "signedPayloadHash": {
108
+ "type": "string",
109
+ "pattern": "^0x[a-fA-F0-9]{64}$"
110
+ },
111
+ "recoveredAddress": {
112
+ "type": "string",
113
+ "pattern": "^0x[a-fA-F0-9]{40}$"
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scientific-protocol.local/schemas/artifact-storage-bundle.schema.json",
4
+ "title": "ArtifactStorageBundleManifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "kind",
9
+ "version",
10
+ "bundleKey",
11
+ "bundleCid",
12
+ "bundleUri",
13
+ "storageRail",
14
+ "generatedAt",
15
+ "manifestDigest",
16
+ "metadata",
17
+ "artifacts"
18
+ ],
19
+ "properties": {
20
+ "kind": {
21
+ "const": "scientific.artifact-storage-bundle"
22
+ },
23
+ "version": {
24
+ "const": 1
25
+ },
26
+ "bundleKey": {
27
+ "type": "string",
28
+ "minLength": 1
29
+ },
30
+ "bundleCid": {
31
+ "type": ["string", "null"]
32
+ },
33
+ "bundleUri": {
34
+ "type": ["string", "null"]
35
+ },
36
+ "storageRail": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "generatedAt": {
41
+ "type": "string",
42
+ "format": "date-time"
43
+ },
44
+ "manifestDigest": {
45
+ "type": "string",
46
+ "pattern": "^sha256:[a-f0-9]{64}$"
47
+ },
48
+ "metadata": {
49
+ "type": "object"
50
+ },
51
+ "artifacts": {
52
+ "type": "array",
53
+ "minItems": 1,
54
+ "items": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": [
58
+ "artifactKey",
59
+ "byteLength",
60
+ "cid",
61
+ "contentType",
62
+ "durabilityClass",
63
+ "memberPath",
64
+ "metadata",
65
+ "sha256",
66
+ "sourceUri"
67
+ ],
68
+ "properties": {
69
+ "artifactKey": {
70
+ "type": "string",
71
+ "minLength": 1
72
+ },
73
+ "byteLength": {
74
+ "type": "integer",
75
+ "minimum": 0
76
+ },
77
+ "cid": {
78
+ "type": "string",
79
+ "minLength": 1
80
+ },
81
+ "contentType": {
82
+ "type": "string",
83
+ "minLength": 1
84
+ },
85
+ "durabilityClass": {
86
+ "type": "string",
87
+ "enum": ["A", "B", "C", "D"]
88
+ },
89
+ "memberPath": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ },
93
+ "metadata": {
94
+ "type": "object"
95
+ },
96
+ "sha256": {
97
+ "type": "string",
98
+ "pattern": "^[a-f0-9]{64}$"
99
+ },
100
+ "sourceUri": {
101
+ "type": ["string", "null"]
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scientific-protocol.local/schemas/claim.schema.json",
4
+ "title": "ClaimPayload",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "claimId",
10
+ "domainId",
11
+ "author",
12
+ "statementHash",
13
+ "methodologyHash",
14
+ "scopeHash",
15
+ "metadataHash",
16
+ "predictionHooksHash",
17
+ "status",
18
+ "resolutionModule",
19
+ "createdAt"
20
+ ],
21
+ "properties": {
22
+ "schemaVersion": {
23
+ "type": "string"
24
+ },
25
+ "claimId": {
26
+ "type": "integer",
27
+ "minimum": 1
28
+ },
29
+ "domainId": {
30
+ "type": "integer",
31
+ "minimum": 0
32
+ },
33
+ "author": {
34
+ "type": "string",
35
+ "pattern": "^0x[a-fA-F0-9]{40}$"
36
+ },
37
+ "statementHash": {
38
+ "type": "string",
39
+ "pattern": "^0x[a-fA-F0-9]{64}$"
40
+ },
41
+ "methodologyHash": {
42
+ "type": "string",
43
+ "pattern": "^0x[a-fA-F0-9]{64}$"
44
+ },
45
+ "scopeHash": {
46
+ "type": "string",
47
+ "pattern": "^0x[a-fA-F0-9]{64}$"
48
+ },
49
+ "metadataHash": {
50
+ "type": "string",
51
+ "pattern": "^0x[a-fA-F0-9]{64}$"
52
+ },
53
+ "predictionHooksHash": {
54
+ "type": "string",
55
+ "pattern": "^0x[a-fA-F0-9]{64}$"
56
+ },
57
+ "status": {
58
+ "type": "string",
59
+ "enum": [
60
+ "Draft",
61
+ "Published",
62
+ "UnderReplication",
63
+ "ProvisionallySupported",
64
+ "Qualified",
65
+ "Refuted",
66
+ "Fraudulent",
67
+ "Deprecated"
68
+ ]
69
+ },
70
+ "resolutionModule": {
71
+ "type": "string",
72
+ "pattern": "^0x[a-fA-F0-9]{40}$"
73
+ },
74
+ "createdAt": {
75
+ "type": "string",
76
+ "format": "date-time"
77
+ },
78
+ "revisionOfClaimId": {
79
+ "type": ["integer", "null"],
80
+ "minimum": 1
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scientific-protocol.local/schemas/evaluation.schema.json",
4
+ "title": "EvaluationCheckpointPayload",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "domainId", "subject", "scores", "payloadHash", "createdAt"],
8
+ "properties": {
9
+ "schemaVersion": {
10
+ "type": "string"
11
+ },
12
+ "domainId": {
13
+ "type": "integer",
14
+ "minimum": 0
15
+ },
16
+ "subject": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["subjectType"],
20
+ "properties": {
21
+ "subjectType": {
22
+ "type": "string",
23
+ "enum": ["actor", "claim", "actorClaimPair", "agent", "module"]
24
+ },
25
+ "actor": {
26
+ "type": ["string", "null"],
27
+ "pattern": "^0x[a-fA-F0-9]{40}$"
28
+ },
29
+ "claimId": {
30
+ "type": ["integer", "null"],
31
+ "minimum": 1
32
+ },
33
+ "agentId": {
34
+ "type": ["integer", "null"],
35
+ "minimum": 1
36
+ },
37
+ "module": {
38
+ "type": ["string", "null"],
39
+ "pattern": "^0x[a-fA-F0-9]{40}$"
40
+ }
41
+ }
42
+ },
43
+ "scores": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": [
47
+ "reproducibility",
48
+ "robustness",
49
+ "calibration",
50
+ "externalValidity",
51
+ "reuse",
52
+ "misconductRisk"
53
+ ],
54
+ "properties": {
55
+ "reproducibility": {
56
+ "type": "number",
57
+ "minimum": 0
58
+ },
59
+ "robustness": {
60
+ "type": "number",
61
+ "minimum": 0
62
+ },
63
+ "calibration": {
64
+ "type": "number",
65
+ "minimum": 0
66
+ },
67
+ "externalValidity": {
68
+ "type": "number",
69
+ "minimum": 0
70
+ },
71
+ "reuse": {
72
+ "type": "number",
73
+ "minimum": 0
74
+ },
75
+ "misconductRisk": {
76
+ "type": "number",
77
+ "minimum": 0
78
+ }
79
+ }
80
+ },
81
+ "payloadHash": {
82
+ "type": "string",
83
+ "pattern": "^0x[a-fA-F0-9]{64}$"
84
+ },
85
+ "uri": {
86
+ "type": ["string", "null"]
87
+ },
88
+ "createdAt": {
89
+ "type": "string",
90
+ "format": "date-time"
91
+ },
92
+ "producer": {
93
+ "type": ["string", "null"]
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scientific-protocol.local/schemas/replication.schema.json",
4
+ "title": "ReplicationPayload",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "replicationId",
10
+ "claimId",
11
+ "replicator",
12
+ "environmentHash",
13
+ "resultHash",
14
+ "evidenceHash",
15
+ "outcome",
16
+ "resolutionStatus",
17
+ "submittedAt"
18
+ ],
19
+ "properties": {
20
+ "schemaVersion": {
21
+ "type": "string"
22
+ },
23
+ "replicationId": {
24
+ "type": "integer",
25
+ "minimum": 1
26
+ },
27
+ "claimId": {
28
+ "type": "integer",
29
+ "minimum": 1
30
+ },
31
+ "replicator": {
32
+ "type": "string",
33
+ "pattern": "^0x[a-fA-F0-9]{40}$"
34
+ },
35
+ "agentId": {
36
+ "type": ["integer", "null"],
37
+ "minimum": 1
38
+ },
39
+ "environmentHash": {
40
+ "type": "string",
41
+ "pattern": "^0x[a-fA-F0-9]{64}$"
42
+ },
43
+ "resultHash": {
44
+ "type": "string",
45
+ "pattern": "^0x[a-fA-F0-9]{64}$"
46
+ },
47
+ "evidenceHash": {
48
+ "type": "string",
49
+ "pattern": "^0x[a-fA-F0-9]{64}$"
50
+ },
51
+ "outcome": {
52
+ "type": "string",
53
+ "enum": [
54
+ "Pending",
55
+ "Supports",
56
+ "PartiallySupports",
57
+ "Inconclusive",
58
+ "FailsToSupport",
59
+ "InvalidSubmission",
60
+ "FraudSignal"
61
+ ]
62
+ },
63
+ "resolutionStatus": {
64
+ "type": "string",
65
+ "enum": [
66
+ "Pending",
67
+ "Supported",
68
+ "Qualified",
69
+ "Inconclusive",
70
+ "Refuted",
71
+ "FraudSignal",
72
+ "Escalated"
73
+ ]
74
+ },
75
+ "confidenceBps": {
76
+ "type": ["integer", "null"],
77
+ "minimum": 0,
78
+ "maximum": 10000
79
+ },
80
+ "resolverType": {
81
+ "type": ["string", "null"]
82
+ },
83
+ "resolutionHash": {
84
+ "type": ["string", "null"],
85
+ "pattern": "^0x[a-fA-F0-9]{64}$"
86
+ },
87
+ "resolutionEvidenceHash": {
88
+ "type": ["string", "null"],
89
+ "pattern": "^0x[a-fA-F0-9]{64}$"
90
+ },
91
+ "resolutionEvidenceURI": {
92
+ "type": ["string", "null"]
93
+ },
94
+ "submittedAt": {
95
+ "type": "string",
96
+ "format": "date-time"
97
+ },
98
+ "resolvedAt": {
99
+ "type": ["string", "null"],
100
+ "format": "date-time"
101
+ }
102
+ }
103
+ }