@idlekit/core 0.7.0 → 0.9.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/README.md +35 -0
- package/dist/adapters/runtime.d.ts +51 -0
- package/dist/adapters/runtime.js +16 -0
- package/dist/adapters/runtime.js.map +1 -0
- package/dist/engine/breakEternity.d.ts +11 -0
- package/dist/engine/breakEternity.js +11 -0
- package/dist/engine/breakEternity.js.map +1 -1
- package/dist/engine/breakInfinity.d.ts +7 -0
- package/dist/engine/breakInfinity.js +7 -0
- package/dist/engine/breakInfinity.js.map +1 -1
- package/dist/engine/types.d.ts +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/ltv/telemetryLoop.d.ts +203 -0
- package/dist/ltv/telemetryLoop.js +389 -0
- package/dist/ltv/telemetryLoop.js.map +1 -0
- package/dist/models/exponential.d.ts +95 -0
- package/dist/models/exponential.js +200 -0
- package/dist/models/exponential.js.map +1 -0
- package/dist/models/index.d.ts +12 -0
- package/dist/models/index.js +18 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/jsonSchema.d.ts +13 -0
- package/dist/models/jsonSchema.js +30 -0
- package/dist/models/jsonSchema.js.map +1 -0
- package/dist/models/ledger.d.ts +26 -0
- package/dist/models/ledger.js +63 -0
- package/dist/models/ledger.js.map +1 -0
- package/dist/models/multiCurrency.d.ts +70 -0
- package/dist/models/multiCurrency.js +343 -0
- package/dist/models/multiCurrency.js.map +1 -0
- package/dist/models/prestige.d.ts +123 -0
- package/dist/models/prestige.js +183 -0
- package/dist/models/prestige.js.map +1 -0
- package/dist/models/productionChain.d.ts +114 -0
- package/dist/models/productionChain.js +447 -0
- package/dist/models/productionChain.js.map +1 -0
- package/dist/models/shared.d.ts +59 -0
- package/dist/models/shared.js +144 -0
- package/dist/models/shared.js.map +1 -0
- package/dist/money/types.d.ts +7 -0
- package/dist/notation/formatMoney.d.ts +7 -0
- package/dist/notation/formatMoney.js +7 -0
- package/dist/notation/formatMoney.js.map +1 -1
- package/dist/notation/parseMoney.d.ts +7 -0
- package/dist/notation/parseMoney.js +7 -0
- package/dist/notation/parseMoney.js.map +1 -1
- package/dist/notation/suffixer.d.ts +7 -0
- package/dist/notation/suffixer.js +7 -0
- package/dist/notation/suffixer.js.map +1 -1
- package/dist/notation/visibilityTracker.d.ts +7 -0
- package/dist/notation/visibilityTracker.js +7 -0
- package/dist/notation/visibilityTracker.js.map +1 -1
- package/dist/policy/emitter.d.ts +7 -0
- package/dist/policy/emitter.js +7 -0
- package/dist/policy/emitter.js.map +1 -1
- package/dist/policy/tickMoney.d.ts +7 -0
- package/dist/policy/tickMoney.js +7 -0
- package/dist/policy/tickMoney.js.map +1 -1
- package/dist/policy/types.d.ts +7 -0
- package/dist/report/chart.d.ts +196 -0
- package/dist/report/chart.js +275 -0
- package/dist/report/chart.js.map +1 -0
- package/dist/report/chartSvg.d.ts +9 -0
- package/dist/report/chartSvg.js +465 -0
- package/dist/report/chartSvg.js.map +1 -0
- package/dist/serde/moneyState.d.ts +7 -0
- package/dist/serde/moneyState.js +7 -0
- package/dist/serde/moneyState.js.map +1 -1
- package/dist/sim/analysis/designSpace.d.ts +23 -0
- package/dist/sim/analysis/designSpace.js +66 -0
- package/dist/sim/analysis/designSpace.js.map +1 -0
- package/dist/sim/analysis/globalSensitivity.d.ts +70 -0
- package/dist/sim/analysis/globalSensitivity.js +207 -0
- package/dist/sim/analysis/globalSensitivity.js.map +1 -0
- package/dist/sim/analysis/parameterSearch.d.ts +44 -0
- package/dist/sim/analysis/parameterSearch.js +172 -0
- package/dist/sim/analysis/parameterSearch.js.map +1 -0
- package/dist/sim/analysis/prestigeCycle.d.ts +1 -1
- package/dist/sim/analysis/prestigeCycle.js +7 -1
- package/dist/sim/analysis/prestigeCycle.js.map +1 -1
- package/dist/sim/analysis/resetInsights.d.ts +68 -0
- package/dist/sim/analysis/resetInsights.js +129 -0
- package/dist/sim/analysis/resetInsights.js.map +1 -0
- package/dist/sim/analysis/sampleStats.d.ts +34 -0
- package/dist/sim/analysis/sampleStats.js +97 -0
- package/dist/sim/analysis/sampleStats.js.map +1 -0
- package/dist/sim/monteCarlo.d.ts +7 -1
- package/dist/sim/monteCarlo.js +8 -0
- package/dist/sim/monteCarlo.js.map +1 -1
- package/dist/sim/random.d.ts +9 -0
- package/dist/sim/random.js +10 -1
- package/dist/sim/random.js.map +1 -1
- package/dist/sim/session.d.ts +2 -0
- package/dist/sim/session.js +15 -4
- package/dist/sim/session.js.map +1 -1
- package/dist/sim/sessionOffline.d.ts +4 -0
- package/dist/sim/sessionOffline.js +1 -0
- package/dist/sim/sessionOffline.js.map +1 -1
- package/dist/sim/stochastic.d.ts +82 -0
- package/dist/sim/stochastic.js +174 -0
- package/dist/sim/stochastic.js.map +1 -0
- package/dist/sim/timedWork.d.ts +10 -0
- package/dist/sim/timedWork.js +25 -0
- package/dist/sim/timedWork.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { zodStandardSchema } from "../scenario/validate";
|
|
3
|
+
/*
|
|
4
|
+
* Helpers shared by the built-in models. Not exported from the package barrel.
|
|
5
|
+
*/
|
|
6
|
+
const DECIMAL = /^[+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
7
|
+
/** A non-negative decimal or scientific amount, kept as a string so a big-number engine reads it exactly. */
|
|
8
|
+
export const nonNegativeAmount = z
|
|
9
|
+
.string()
|
|
10
|
+
.trim()
|
|
11
|
+
.regex(DECIMAL, "must be a non-negative decimal or scientific amount, for example '12' or '1.5e30'");
|
|
12
|
+
/** A positive finite number such as a growth factor. */
|
|
13
|
+
export const growthFactor = z.number().finite().min(1);
|
|
14
|
+
/** An identifier used in an action id or a vars key. */
|
|
15
|
+
export const modelKey = z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^[a-z][a-z0-9_-]{0,47}$/, "must start with a lowercase letter and use only a-z, 0-9, '_' or '-'");
|
|
18
|
+
export class BuiltinModelRangeError extends RangeError {
|
|
19
|
+
constructor(modelId, label) {
|
|
20
|
+
super(`${modelId} ${label} exceeds the selected engine's finite range. Use a big-number engine such as breakInfinity, or reduce the inputs.`);
|
|
21
|
+
this.name = "BuiltinModelRangeError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function finiteAmount(E, value, modelId, label) {
|
|
25
|
+
if (!E.isFinite(value))
|
|
26
|
+
throw new BuiltinModelRangeError(modelId, label);
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
/** Parse a validated amount string in the engine. */
|
|
30
|
+
export function amountOf(E, raw, modelId, label) {
|
|
31
|
+
return finiteAmount(E, E.from(raw), modelId, label);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 10^exponent in the engine without passing Infinity to `E.from`.
|
|
35
|
+
* A number engine rejects an exponent above its range through `finiteAmount` at the caller.
|
|
36
|
+
*/
|
|
37
|
+
export function pow10(E, exponent) {
|
|
38
|
+
if (!Number.isFinite(exponent))
|
|
39
|
+
return E.from(exponent > 0 ? "1e400" : "0");
|
|
40
|
+
if (Math.abs(exponent) < 300)
|
|
41
|
+
return E.from(Math.pow(10, exponent));
|
|
42
|
+
const whole = Math.floor(exponent);
|
|
43
|
+
const mantissa = Math.pow(10, exponent - whole);
|
|
44
|
+
return E.from(`${mantissa}e${whole}`);
|
|
45
|
+
}
|
|
46
|
+
/** Compute g^n and 1+g+...+g^(n-1) in O(log n), without overflowing a Number first. */
|
|
47
|
+
function geometricFactors(E, growth, count) {
|
|
48
|
+
let power = E.from(1);
|
|
49
|
+
let sum = E.zero();
|
|
50
|
+
let blockPower = E.from(growth);
|
|
51
|
+
let blockSum = E.from(1);
|
|
52
|
+
for (let remaining = count; remaining > 0; remaining = Math.floor(remaining / 2)) {
|
|
53
|
+
if (remaining % 2 === 1) {
|
|
54
|
+
sum = E.add(sum, E.mulN(power, blockSum));
|
|
55
|
+
power = E.mulN(power, blockPower);
|
|
56
|
+
}
|
|
57
|
+
if (remaining > 1) {
|
|
58
|
+
blockSum = E.add(blockSum, E.mulN(blockPower, blockSum));
|
|
59
|
+
blockPower = E.mulN(blockPower, blockPower);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { power, sum };
|
|
63
|
+
}
|
|
64
|
+
/** growth^start in the engine. */
|
|
65
|
+
export function geometricPower(E, growth, start) {
|
|
66
|
+
if (start <= 0)
|
|
67
|
+
return E.from(1);
|
|
68
|
+
const direct = Math.pow(growth, start);
|
|
69
|
+
return Number.isFinite(direct) ? E.from(direct) : geometricFactors(E, growth, start).power;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* base * (growth^start + ... + growth^(start+count-1)): the price of `count` purchases after `start` owned.
|
|
73
|
+
* `growth === 1` is the flat price `base * count`.
|
|
74
|
+
*/
|
|
75
|
+
export function geometricSeries(E, base, growth, start, count) {
|
|
76
|
+
if (count <= 0)
|
|
77
|
+
return E.zero();
|
|
78
|
+
if (growth === 1)
|
|
79
|
+
return E.mul(base, count);
|
|
80
|
+
const sumNumber = (Math.pow(growth, count) - 1) / (growth - 1);
|
|
81
|
+
const sumFactor = Number.isFinite(sumNumber) ? E.from(sumNumber) : geometricFactors(E, growth, count).sum;
|
|
82
|
+
const direct = E.mulN(E.mulN(base, geometricPower(E, growth, start)), sumFactor);
|
|
83
|
+
const logBase = E.absLog10(base);
|
|
84
|
+
if (E.isFinite(direct) || !Number.isFinite(logBase))
|
|
85
|
+
return direct;
|
|
86
|
+
// An intermediate power or sum can overflow a Number engine while the scaled price fits.
|
|
87
|
+
// Combine the factors in log10 space so only the final amount has to be representable.
|
|
88
|
+
const logGrowth = Math.log10(growth);
|
|
89
|
+
const logSum = Number.isFinite(sumNumber) ? Math.log10(sumNumber) : count * logGrowth - Math.log10(growth - 1);
|
|
90
|
+
return pow10(E, logBase + start * logGrowth + logSum);
|
|
91
|
+
}
|
|
92
|
+
/** A non-negative integer count from vars. A missing or malformed value is 0. */
|
|
93
|
+
export function countOf(value) {
|
|
94
|
+
const n = Number(value ?? 0);
|
|
95
|
+
return Number.isInteger(n) && n > 0 ? n : 0;
|
|
96
|
+
}
|
|
97
|
+
/** Engine amount from a vars string. A missing value is zero. */
|
|
98
|
+
export function stockOf(E, raw) {
|
|
99
|
+
if (typeof raw === "string" && raw.length > 0)
|
|
100
|
+
return E.from(raw);
|
|
101
|
+
if (typeof raw === "number" && Number.isFinite(raw))
|
|
102
|
+
return E.from(raw);
|
|
103
|
+
return E.zero();
|
|
104
|
+
}
|
|
105
|
+
export function minAmount(E, a, b) {
|
|
106
|
+
return E.cmp(a, b) <= 0 ? a : b;
|
|
107
|
+
}
|
|
108
|
+
export function maxAmount(E, a, b) {
|
|
109
|
+
return E.cmp(a, b) >= 0 ? a : b;
|
|
110
|
+
}
|
|
111
|
+
/** Bulk sizes offered by built-in buy actions, clipped to the levels left under a cap. */
|
|
112
|
+
export function bulkSizes(remaining) {
|
|
113
|
+
return [1, 10, 25, 100].filter((size) => size <= remaining);
|
|
114
|
+
}
|
|
115
|
+
export const softCapSchema = z.object({
|
|
116
|
+
kind: z.enum(["pow", "sqrt", "log"]).default("pow"),
|
|
117
|
+
startsAt: nonNegativeAmount.refine((value) => Number(value) > 0, "softCap.startsAt must be > 0"),
|
|
118
|
+
strength: z.number().finite().positive().max(1).optional(),
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* Income above `startsAt` is compressed. Below or at the start, income is unchanged.
|
|
122
|
+
* - pow: S * (x/S)^strength (default strength 0.5)
|
|
123
|
+
* - sqrt: S * (x/S)^0.5
|
|
124
|
+
* - log: S * (1 + strength * ln(x/S)) (default strength 1)
|
|
125
|
+
* The ratio is read in log10 space, so a big-number engine keeps a value beyond the Number range.
|
|
126
|
+
*/
|
|
127
|
+
export function applySoftCap(E, raw, cap, startsAt) {
|
|
128
|
+
if (!cap || startsAt === undefined)
|
|
129
|
+
return raw;
|
|
130
|
+
if (E.cmp(raw, startsAt) <= 0)
|
|
131
|
+
return raw;
|
|
132
|
+
const ratioLog10 = E.absLog10(raw) - E.absLog10(startsAt);
|
|
133
|
+
if (cap.kind === "log") {
|
|
134
|
+
const strength = cap.strength ?? 1;
|
|
135
|
+
return E.mul(startsAt, 1 + strength * ratioLog10 * Math.LN10);
|
|
136
|
+
}
|
|
137
|
+
const exponent = cap.kind === "sqrt" ? 0.5 : (cap.strength ?? 0.5);
|
|
138
|
+
return E.mulN(startsAt, pow10(E, exponent * ratioLog10));
|
|
139
|
+
}
|
|
140
|
+
/** A Standard Schema that reads a missing params or vars object as `{}`, the way `create` does. */
|
|
141
|
+
export function optionalObjectSchema(schema) {
|
|
142
|
+
return zodStandardSchema(z.preprocess((value) => value ?? {}, schema));
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/models/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AAEH,MAAM,OAAO,GAAG,gDAAgD,CAAC;AAEjE,6GAA6G;AAC7G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,OAAO,EAAE,mFAAmF,CAAC,CAAC;AAEvG,wDAAwD;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEvD,wDAAwD;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,KAAK,CAAC,yBAAyB,EAAE,sEAAsE,CAAC,CAAC;AAE5G,MAAM,OAAO,sBAAuB,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;IAC1D,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;QACnC,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;IACnE,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,oBAAoB,CAAI,MAAoB;IAC1D,OAAO,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,EAAE,MAAM,CAA4B,CAAC,CAAC;AACpG,CAAC"}
|
package/dist/money/types.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export type { Money, MoneyState, Unit } from "@idlekit/money";
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { formatMoney, type FormatMoneyOptions } from "@idlekit/money";
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { formatMoney } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=formatMoney.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatMoney.js","sourceRoot":"","sources":["../../src/notation/formatMoney.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"formatMoney.js","sourceRoot":"","sources":["../../src/notation/formatMoney.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAA2B,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { parseMoney, type ParseMoneyOptions } from "@idlekit/money";
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { parseMoney } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=parseMoney.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseMoney.js","sourceRoot":"","sources":["../../src/notation/parseMoney.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"parseMoney.js","sourceRoot":"","sources":["../../src/notation/parseMoney.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAA0B,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { alphaInfiniteIndex, alphaInfiniteSuffix, type Suffixer } from "@idlekit/money";
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { alphaInfiniteIndex, alphaInfiniteSuffix } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=suffixer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suffixer.js","sourceRoot":"","sources":["../../src/notation/suffixer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"suffixer.js","sourceRoot":"","sources":["../../src/notation/suffixer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { VisibilityTracker, type VisibilityChange } from "@idlekit/money";
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { VisibilityTracker } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=visibilityTracker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibilityTracker.js","sourceRoot":"","sources":["../../src/notation/visibilityTracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"visibilityTracker.js","sourceRoot":"","sources":["../../src/notation/visibilityTracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAyB,MAAM,gBAAgB,CAAC"}
|
package/dist/policy/emitter.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { composeEmitters, onType, type Emitter } from "@idlekit/money";
|
package/dist/policy/emitter.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { composeEmitters, onType } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=emitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/policy/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAgB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/policy/emitter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,EAAgB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { tickMoney } from "@idlekit/money";
|
package/dist/policy/tickMoney.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export { tickMoney } from "@idlekit/money";
|
|
2
9
|
//# sourceMappingURL=tickMoney.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tickMoney.js","sourceRoot":"","sources":["../../src/policy/tickMoney.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"tickMoney.js","sourceRoot":"","sources":["../../src/policy/tickMoney.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/policy/types.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility re-export from `@idlekit/money`; the implementation lives there.
|
|
3
|
+
* `@idlekit/money` is the canonical import path for money primitives. New code
|
|
4
|
+
* that only needs money primitives should import from `@idlekit/money` directly.
|
|
5
|
+
* These re-exports are kept for the v1 compatibility contract and are scheduled
|
|
6
|
+
* for deprecation; they will not be removed within v1.
|
|
7
|
+
*/
|
|
1
8
|
export type { CoreOptions, MoneyEvent, TickFactCounts, TickPolicy, TickResult, TickStatus } from "@idlekit/money";
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart data contract and helpers shared by the SVG renderer and the JSON export.
|
|
3
|
+
*
|
|
4
|
+
* The data is plain JSON: numbers for coordinates, decimal strings for engine amounts.
|
|
5
|
+
* Nothing here reads a clock, a random source, or the locale, so the same input gives the same bytes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CHART_DATA_CONTRACT: "idlekit.chart-data.v1";
|
|
8
|
+
export declare const CHART_DATA_SCHEMA_REF: "docs/schemas/chart-data.v1.schema.json";
|
|
9
|
+
/** Default number of points kept per series after downsampling. */
|
|
10
|
+
export declare const DEFAULT_CHART_MAX_POINTS = 512;
|
|
11
|
+
/** Upper bound accepted for `maxPoints`. A chart does not need more and the SVG stays small. */
|
|
12
|
+
export declare const MAX_CHART_MAX_POINTS = 10000;
|
|
13
|
+
/** Lower bound accepted for `maxPoints`. LTTB keeps the first and the last point. */
|
|
14
|
+
export declare const MIN_CHART_MAX_POINTS = 3;
|
|
15
|
+
export type ChartPoint = Readonly<{
|
|
16
|
+
/** Seconds since the start of the plotted run. */
|
|
17
|
+
t: number;
|
|
18
|
+
/** Plotted coordinate. `null` marks a value that cannot be plotted (zero on a log axis, non-finite). */
|
|
19
|
+
y: number | null;
|
|
20
|
+
/** Exact engine value as text, when the series plots an amount. */
|
|
21
|
+
value?: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type ChartSeriesId = "money" | "netWorth" | "growthRate";
|
|
24
|
+
export type ChartSeries = Readonly<{
|
|
25
|
+
id: ChartSeriesId | string;
|
|
26
|
+
label: string;
|
|
27
|
+
/** `log10` means `y` is log10 of the absolute amount. `linear` means `y` is the value. */
|
|
28
|
+
yScale: "log10" | "linear";
|
|
29
|
+
unit: string;
|
|
30
|
+
points: readonly ChartPoint[];
|
|
31
|
+
}>;
|
|
32
|
+
export type ChartMilestone = Readonly<{
|
|
33
|
+
key: string;
|
|
34
|
+
/** Seconds since the start of the plotted run. */
|
|
35
|
+
t: number;
|
|
36
|
+
source: string;
|
|
37
|
+
}>;
|
|
38
|
+
export type ChartSampling = Readonly<{
|
|
39
|
+
method: "lttb" | "none";
|
|
40
|
+
maxPoints: number;
|
|
41
|
+
/** Points offered to the downsampler, per series. */
|
|
42
|
+
sourcePoints: number;
|
|
43
|
+
/** Points kept, per series. */
|
|
44
|
+
retainedPoints: number;
|
|
45
|
+
/** Runner trace interval in steps. `null` when the trace came from another source. */
|
|
46
|
+
traceEverySteps: number | null;
|
|
47
|
+
}>;
|
|
48
|
+
export type ProgressionChartData = Readonly<{
|
|
49
|
+
xUnit: "sec";
|
|
50
|
+
/** The series whose slope is the growth-rate series. */
|
|
51
|
+
primarySeries: "money" | "netWorth";
|
|
52
|
+
series: readonly ChartSeries[];
|
|
53
|
+
milestones: readonly ChartMilestone[];
|
|
54
|
+
/** Milestones left out of the chart because the milestone sample was capped. */
|
|
55
|
+
droppedMilestones: number;
|
|
56
|
+
sampling: ChartSampling;
|
|
57
|
+
}>;
|
|
58
|
+
export type CompareKpiRow = Readonly<{
|
|
59
|
+
metric: string;
|
|
60
|
+
a: string | null;
|
|
61
|
+
b: string | null;
|
|
62
|
+
preference: "higher" | "lower" | "n/a";
|
|
63
|
+
better: "a" | "b" | "tie" | "undetermined";
|
|
64
|
+
/** (B - A) / |A| in percent. `null` when either side is missing, non-finite, or A is zero. */
|
|
65
|
+
relativeChangePct: number | null;
|
|
66
|
+
/** log10(B) - log10(A) for amounts too large for a ratio. `null` when unavailable. */
|
|
67
|
+
log10Delta: number | null;
|
|
68
|
+
}>;
|
|
69
|
+
export type CompareChartData = Readonly<{
|
|
70
|
+
labels: Readonly<{
|
|
71
|
+
a: string;
|
|
72
|
+
b: string;
|
|
73
|
+
}>;
|
|
74
|
+
kpis: readonly CompareKpiRow[];
|
|
75
|
+
/** Net-worth (or money) progression of the A and B economy runs, when traced. */
|
|
76
|
+
progression?: Readonly<{
|
|
77
|
+
a: ProgressionChartData;
|
|
78
|
+
b: ProgressionChartData;
|
|
79
|
+
}>;
|
|
80
|
+
}>;
|
|
81
|
+
export type SensitivityCell = Readonly<{
|
|
82
|
+
dimensionId: string;
|
|
83
|
+
candidateId: string;
|
|
84
|
+
metricId: string;
|
|
85
|
+
status: "observed" | "unavailable";
|
|
86
|
+
/** Elasticity as plotted. `null` when unavailable or outside the double range. */
|
|
87
|
+
elasticity: number | null;
|
|
88
|
+
/** Exact elasticity text from the experiment artifact. */
|
|
89
|
+
elasticityText: string | null;
|
|
90
|
+
direction: "higher" | "lower" | "flat" | "unavailable";
|
|
91
|
+
}>;
|
|
92
|
+
export type SensitivityChartData = Readonly<{
|
|
93
|
+
method: "one-at-a-time-local";
|
|
94
|
+
globalSensitivity: false;
|
|
95
|
+
sobol: false;
|
|
96
|
+
rows: readonly Readonly<{
|
|
97
|
+
dimensionId: string;
|
|
98
|
+
candidateId: string;
|
|
99
|
+
}>[];
|
|
100
|
+
columns: readonly string[];
|
|
101
|
+
cells: readonly SensitivityCell[];
|
|
102
|
+
}>;
|
|
103
|
+
export type ChartSource = Readonly<{
|
|
104
|
+
command: string;
|
|
105
|
+
scenario?: string | readonly string[];
|
|
106
|
+
seed?: number;
|
|
107
|
+
runId?: string;
|
|
108
|
+
}>;
|
|
109
|
+
export type ChartDataV1 = Readonly<{
|
|
110
|
+
contract: typeof CHART_DATA_CONTRACT;
|
|
111
|
+
schemaVersion: 1;
|
|
112
|
+
kind: "progression" | "compare" | "sensitivity";
|
|
113
|
+
title: string;
|
|
114
|
+
source: ChartSource;
|
|
115
|
+
progression?: ProgressionChartData;
|
|
116
|
+
compare?: CompareChartData;
|
|
117
|
+
sensitivity?: SensitivityChartData;
|
|
118
|
+
}>;
|
|
119
|
+
/** Check a requested point budget. Throws a RangeError outside [MIN_CHART_MAX_POINTS, MAX_CHART_MAX_POINTS]. */
|
|
120
|
+
export declare function resolveChartMaxPoints(requested: number | undefined): number;
|
|
121
|
+
/**
|
|
122
|
+
* Runner trace interval that keeps about `oversample * maxPoints` states for a run of `totalSteps`.
|
|
123
|
+
* The downsampler then picks `maxPoints` of them, so memory stays bounded for long runs.
|
|
124
|
+
*/
|
|
125
|
+
export declare function chartTraceEverySteps(args: Readonly<{
|
|
126
|
+
totalSteps: number | undefined;
|
|
127
|
+
maxPoints: number;
|
|
128
|
+
oversample?: number;
|
|
129
|
+
}>): number;
|
|
130
|
+
/**
|
|
131
|
+
* log10 of the absolute value of a decimal string, without going through a double for the exponent.
|
|
132
|
+
* Returns `null` for zero, empty, or non-decimal text such as `unreachable`.
|
|
133
|
+
*/
|
|
134
|
+
export declare function decimalLog10(text: string): number | null;
|
|
135
|
+
/**
|
|
136
|
+
* Largest-Triangle-Three-Buckets downsampling. Deterministic: ties keep the earlier point.
|
|
137
|
+
* Points whose `y` is null stay out of the triangle areas but count as candidates with area 0,
|
|
138
|
+
* so a gap is kept only when a bucket holds nothing else.
|
|
139
|
+
*/
|
|
140
|
+
export declare function downsampleLttb(points: readonly ChartPoint[], maxPoints: number): ChartPoint[];
|
|
141
|
+
/**
|
|
142
|
+
* Growth-rate series: average log10 change per second between consecutive retained points.
|
|
143
|
+
* Each value is plotted at the later point. A prestige reset shows as a negative rate.
|
|
144
|
+
*/
|
|
145
|
+
export declare function growthRateSeries(points: readonly ChartPoint[]): ChartPoint[];
|
|
146
|
+
/** A state sample read by the caller. Amounts are already turned into text and log10. */
|
|
147
|
+
export type ProgressionSample = Readonly<{
|
|
148
|
+
t: number;
|
|
149
|
+
money: Readonly<{
|
|
150
|
+
text: string;
|
|
151
|
+
log10: number;
|
|
152
|
+
}>;
|
|
153
|
+
netWorth?: Readonly<{
|
|
154
|
+
text: string;
|
|
155
|
+
log10: number;
|
|
156
|
+
}>;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Build progression chart data from samples taken in time order.
|
|
160
|
+
* Each amount series is downsampled with LTTB on its own; growth rate reads the primary series after downsampling.
|
|
161
|
+
*/
|
|
162
|
+
export declare function buildProgressionChartData(args: Readonly<{
|
|
163
|
+
samples: readonly ProgressionSample[];
|
|
164
|
+
/** Absolute t of the run start. Every x is `t - startT`. */
|
|
165
|
+
startT: number;
|
|
166
|
+
unit: string;
|
|
167
|
+
primarySeries: "money" | "netWorth";
|
|
168
|
+
milestones?: readonly Readonly<{
|
|
169
|
+
key: string;
|
|
170
|
+
t: number;
|
|
171
|
+
source: string;
|
|
172
|
+
}>[];
|
|
173
|
+
droppedMilestones?: number;
|
|
174
|
+
maxPoints?: number;
|
|
175
|
+
traceEverySteps?: number | null;
|
|
176
|
+
}>): ProgressionChartData;
|
|
177
|
+
export declare function compareMetricPreference(metric: string): "higher" | "lower" | "n/a";
|
|
178
|
+
/** KPI rows of a compare result list. Values stay as measured text; the change columns are derived. */
|
|
179
|
+
export declare function buildCompareKpiRows(results: readonly Readonly<Record<string, unknown>>[]): CompareKpiRow[];
|
|
180
|
+
/** Heatmap data from experiment elasticity rows. Row and column order follow first appearance. */
|
|
181
|
+
export declare function buildSensitivityChartData(elasticities: readonly Readonly<{
|
|
182
|
+
dimensionId: string;
|
|
183
|
+
candidateId: string;
|
|
184
|
+
metricId: string;
|
|
185
|
+
status: "observed" | "unavailable";
|
|
186
|
+
elasticity: string | null;
|
|
187
|
+
direction: "higher" | "lower" | "flat" | "unavailable";
|
|
188
|
+
}>[]): SensitivityChartData;
|
|
189
|
+
export declare function createChartData(args: Readonly<{
|
|
190
|
+
kind: ChartDataV1["kind"];
|
|
191
|
+
title: string;
|
|
192
|
+
source: ChartSource;
|
|
193
|
+
progression?: ProgressionChartData;
|
|
194
|
+
compare?: CompareChartData;
|
|
195
|
+
sensitivity?: SensitivityChartData;
|
|
196
|
+
}>): ChartDataV1;
|