@rotifer/playground 0.16.0 → 0.18.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.
- package/CHANGELOG.md +22 -0
- package/dist/arena/invalidation-criteria.d.ts +3 -0
- package/dist/arena/invalidation-criteria.d.ts.map +1 -1
- package/dist/arena/invalidation-criteria.js +21 -2
- package/dist/arena/invalidation-criteria.js.map +1 -1
- package/dist/cloud/client.d.ts +36 -0
- package/dist/cloud/client.d.ts.map +1 -1
- package/dist/cloud/client.js +28 -0
- package/dist/cloud/client.js.map +1 -1
- package/dist/cloud/types.d.ts +9 -0
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/types.js.map +1 -1
- package/dist/commands/agent-create.d.ts.map +1 -1
- package/dist/commands/agent-create.js +3 -4
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/arena-list.js +85 -39
- package/dist/commands/arena-list.js.map +1 -1
- package/dist/commands/arena-submit.d.ts.map +1 -1
- package/dist/commands/arena-submit.js +30 -8
- package/dist/commands/arena-submit.js.map +1 -1
- package/dist/commands/arena-watch.d.ts.map +1 -1
- package/dist/commands/arena-watch.js +3 -4
- package/dist/commands/arena-watch.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +45 -5
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +17 -1
- package/dist/commands/run.js.map +1 -1
- package/dist/utils/fidelity-discount.d.ts +51 -0
- package/dist/utils/fidelity-discount.d.ts.map +1 -0
- package/dist/utils/fidelity-discount.js +47 -0
- package/dist/utils/fidelity-discount.js.map +1 -0
- package/package.json +9 -6
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ESTIMATED_BASE_FITNESS = void 0;
|
|
4
|
+
exports.fidelityDiscountFor = fidelityDiscountFor;
|
|
5
|
+
exports.applyFidelityDiscount = applyFidelityDiscount;
|
|
6
|
+
exports.estimateBaseFitness = estimateBaseFitness;
|
|
7
|
+
const phenotype_js_1 = require("../types/phenotype.js");
|
|
8
|
+
/**
|
|
9
|
+
* Look up the discount for a declared fidelity.
|
|
10
|
+
*
|
|
11
|
+
* An unrecognised fidelity gets the Wrapped discount, not the Native one:
|
|
12
|
+
* the tier that makes no claim about execution should not be mistaken for the
|
|
13
|
+
* tier that makes the strongest. Undeclared fidelity is treated as Wrapped for
|
|
14
|
+
* the same reason — that is also what `compile` reports for a gene with no
|
|
15
|
+
* source and no artifact.
|
|
16
|
+
*/
|
|
17
|
+
function fidelityDiscountFor(fidelity) {
|
|
18
|
+
const key = (fidelity ?? "").trim().toLowerCase();
|
|
19
|
+
return phenotype_js_1.FIDELITY_DISCOUNT[key] ?? phenotype_js_1.FIDELITY_DISCOUNT.wrapped;
|
|
20
|
+
}
|
|
21
|
+
/** Apply the discount and return all three numbers the ledger wants. */
|
|
22
|
+
function applyFidelityDiscount(baseFitness, fidelity) {
|
|
23
|
+
const fidelityDiscount = fidelityDiscountFor(fidelity);
|
|
24
|
+
return {
|
|
25
|
+
baseFitness,
|
|
26
|
+
fidelityDiscount,
|
|
27
|
+
fitness: baseFitness * fidelityDiscount,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The deterministic estimate used when nothing was actually run.
|
|
32
|
+
*
|
|
33
|
+
* This is the *base*, fidelity-agnostic by design: the fidelity penalty is
|
|
34
|
+
* the discount's job, applied afterwards, so that an estimated Native gene and
|
|
35
|
+
* an estimated Hybrid gene differ by exactly the protocol parameter and not by
|
|
36
|
+
* a second, invisible constant. 0.70 is kept as the Native-tier baseline the
|
|
37
|
+
* old code used, so Native estimates are numerically unchanged; Wrapped lands
|
|
38
|
+
* at 0.70 × 0.70 = 0.49, close to the old 0.45 but now derived rather than
|
|
39
|
+
* declared.
|
|
40
|
+
*/
|
|
41
|
+
exports.ESTIMATED_BASE_FITNESS = 0.7;
|
|
42
|
+
function estimateBaseFitness(geneId) {
|
|
43
|
+
const seed = parseInt(geneId.slice(0, 8), 16);
|
|
44
|
+
const variance = (seed % 250) / 1000;
|
|
45
|
+
return Math.min(exports.ESTIMATED_BASE_FITNESS + variance, 0.99);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fidelity-discount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fidelity-discount.js","sourceRoot":"","sources":["../../src/utils/fidelity-discount.ts"],"names":[],"mappings":";;;AAsCA,kDAGC;AAGD,sDAUC;AAeD,kDAIC;AAzED,wDAA0D;AA6B1D;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,QAAmC;IACrE,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAClD,OAAO,gCAAiB,CAAC,GAAG,CAAC,IAAI,gCAAiB,CAAC,OAAO,CAAC;AAC7D,CAAC;AAED,wEAAwE;AACxE,SAAgB,qBAAqB,CACnC,WAAmB,EACnB,QAAmC;IAEnC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvD,OAAO;QACL,WAAW;QACX,gBAAgB;QAChB,OAAO,EAAE,WAAW,GAAG,gBAAgB;KACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAE1C,SAAgB,mBAAmB,CAAC,MAAc;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,8BAAsB,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotifer/playground",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Rotifer Protocol Playground — local development environment for gene development, Arena competition, and protocol simulation",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Rotifer Protocol Contributors",
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"smoke-test": "npx tsx scripts/post-deploy-smoke-test.ts",
|
|
62
62
|
"postinstall": "node scripts/postinstall.js",
|
|
63
63
|
"prepublishOnly": "npm run verify:versions && npm run lint && npm run test && npm run build",
|
|
64
|
-
"prepack": "npm run build"
|
|
64
|
+
"prepack": "npm run build",
|
|
65
|
+
"test:mutation": "stryker run"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
68
|
"@clack/prompts": "^1.2.0",
|
|
@@ -72,6 +73,8 @@
|
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@napi-rs/cli": "^3.7.0",
|
|
76
|
+
"@stryker-mutator/core": "10.0.0",
|
|
77
|
+
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
75
78
|
"@supabase/supabase-js": "^2.105.4",
|
|
76
79
|
"@types/node": "^25.9.2",
|
|
77
80
|
"@vitest/coverage-v8": "^4.1.2",
|
|
@@ -84,10 +87,10 @@
|
|
|
84
87
|
},
|
|
85
88
|
"optionalDependencies": {
|
|
86
89
|
"@rolldown/binding-linux-x64-gnu": "1.1.1",
|
|
87
|
-
"@rotifer/playground-darwin-arm64": "0.
|
|
88
|
-
"@rotifer/playground-darwin-x64": "0.
|
|
89
|
-
"@rotifer/playground-linux-x64-gnu": "0.
|
|
90
|
-
"@rotifer/playground-win32-x64-msvc": "0.
|
|
90
|
+
"@rotifer/playground-darwin-arm64": "0.18.0",
|
|
91
|
+
"@rotifer/playground-darwin-x64": "0.18.0",
|
|
92
|
+
"@rotifer/playground-linux-x64-gnu": "0.18.0",
|
|
93
|
+
"@rotifer/playground-win32-x64-msvc": "0.18.0"
|
|
91
94
|
},
|
|
92
95
|
"engines": {
|
|
93
96
|
"node": ">=20.0.0"
|