@idlekit/core 0.3.1 → 0.4.1
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 +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/scenario/compile.js +1 -0
- package/dist/scenario/compile.js.map +1 -1
- package/dist/scenario/scenarioContract.d.ts +32 -2
- package/dist/scenario/scenarioContract.js +37 -2
- package/dist/scenario/scenarioContract.js.map +1 -1
- package/dist/sim/advance.d.ts +198 -0
- package/dist/sim/advance.js +609 -0
- package/dist/sim/advance.js.map +1 -0
- package/dist/sim/analysis/checks.d.ts +260 -0
- package/dist/sim/analysis/checks.js +1442 -0
- package/dist/sim/analysis/checks.js.map +1 -0
- package/dist/sim/analysis/flow.d.ts +169 -0
- package/dist/sim/analysis/flow.js +1359 -0
- package/dist/sim/analysis/flow.js.map +1 -0
- package/dist/sim/analysis/jevAdvisory.d.ts +113 -0
- package/dist/sim/analysis/jevAdvisory.js +846 -0
- package/dist/sim/analysis/jevAdvisory.js.map +1 -0
- package/dist/sim/analysis/judge.d.ts +145 -0
- package/dist/sim/analysis/judge.js +1451 -0
- package/dist/sim/analysis/judge.js.map +1 -0
- package/dist/sim/analysis/registry.d.ts +9 -6
- package/dist/sim/analysis/registry.js +15 -2
- package/dist/sim/analysis/registry.js.map +1 -1
- package/dist/sim/executionBackend.d.ts +165 -0
- package/dist/sim/executionBackend.js +521 -0
- package/dist/sim/executionBackend.js.map +1 -0
- package/dist/sim/integrationMatrix.d.ts +52 -0
- package/dist/sim/integrationMatrix.js +68 -0
- package/dist/sim/integrationMatrix.js.map +1 -0
- package/dist/sim/observation.d.ts +11 -0
- package/dist/sim/observation.js +12 -0
- package/dist/sim/observation.js.map +1 -1
- package/dist/sim/offline.d.ts +2 -0
- package/dist/sim/offline.js +68 -1
- package/dist/sim/offline.js.map +1 -1
- package/dist/sim/simulator.d.ts +2 -0
- package/dist/sim/simulator.js +71 -1
- package/dist/sim/simulator.js.map +1 -1
- package/dist/sim/step.d.ts +10 -0
- package/dist/sim/step.js +10 -0
- package/dist/sim/step.js.map +1 -1
- package/dist/sim/types.d.ts +11 -0
- package/package.json +3 -3
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import typia, { type IValidation } from "typia";
|
|
2
|
+
export type CheckOperator = "lt" | "lte" | "gt" | "gte" | "eq" | "between";
|
|
3
|
+
export type CheckSeverity = "error" | "warn";
|
|
4
|
+
export type MissingPolicy = "inconclusive" | "fail" | "unsupported";
|
|
5
|
+
export type CheckVerdict = "pass" | "fail" | "inconclusive" | "unsupported";
|
|
6
|
+
export type ObservationStatus = "measured" | "censored" | "missing" | "unknown" | "unsupported";
|
|
7
|
+
export type FailOnToken = "error" | "warn" | "inconclusive" | "unsupported";
|
|
8
|
+
export type BalanceIdentityV1 = Readonly<{
|
|
9
|
+
metricId: string;
|
|
10
|
+
definition: string;
|
|
11
|
+
method: string;
|
|
12
|
+
scenarioVersion: string;
|
|
13
|
+
specVersion: string;
|
|
14
|
+
engineId: string;
|
|
15
|
+
pluginVersion: string;
|
|
16
|
+
seed: string;
|
|
17
|
+
unit: string;
|
|
18
|
+
algorithmVersion: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type BalanceObservationV1 = Readonly<{
|
|
21
|
+
identity: BalanceIdentityV1;
|
|
22
|
+
status: ObservationStatus;
|
|
23
|
+
value: number | null;
|
|
24
|
+
lower: number | null;
|
|
25
|
+
upper: number | null;
|
|
26
|
+
}>;
|
|
27
|
+
export type BalanceCheckV1 = Readonly<{
|
|
28
|
+
id: string;
|
|
29
|
+
metricId: string;
|
|
30
|
+
operator: CheckOperator;
|
|
31
|
+
threshold: number;
|
|
32
|
+
upperThreshold: number | null;
|
|
33
|
+
unit: string;
|
|
34
|
+
severity: CheckSeverity;
|
|
35
|
+
missingPolicy: MissingPolicy;
|
|
36
|
+
definition: string;
|
|
37
|
+
method: string;
|
|
38
|
+
scenarioVersion: string | null;
|
|
39
|
+
specVersion: string | null;
|
|
40
|
+
engineId: string | null;
|
|
41
|
+
pluginVersion: string | null;
|
|
42
|
+
seed: string | null;
|
|
43
|
+
algorithmVersion: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
export type BalanceCheckRequestV1 = Readonly<{
|
|
46
|
+
schemaVersion: 1;
|
|
47
|
+
contract: "idlekit.balance-checks.v1";
|
|
48
|
+
failOn: readonly FailOnToken[];
|
|
49
|
+
checks: readonly BalanceCheckV1[];
|
|
50
|
+
observations: readonly BalanceObservationV1[];
|
|
51
|
+
advisory: string | null;
|
|
52
|
+
}>;
|
|
53
|
+
export type BalanceEvidenceV1 = Readonly<{
|
|
54
|
+
status: ObservationStatus | "absent";
|
|
55
|
+
value: number | null;
|
|
56
|
+
lower: number | null;
|
|
57
|
+
upper: number | null;
|
|
58
|
+
operator: CheckOperator;
|
|
59
|
+
threshold: number;
|
|
60
|
+
upperThreshold: number | null;
|
|
61
|
+
unit: string;
|
|
62
|
+
}>;
|
|
63
|
+
export type BalanceCheckResultV1 = Readonly<{
|
|
64
|
+
id: string;
|
|
65
|
+
metricId: string;
|
|
66
|
+
severity: CheckSeverity;
|
|
67
|
+
verdict: CheckVerdict;
|
|
68
|
+
reason: string;
|
|
69
|
+
mismatches: readonly string[];
|
|
70
|
+
evidence: BalanceEvidenceV1;
|
|
71
|
+
}>;
|
|
72
|
+
export type BalanceCheckReportV1 = Readonly<{
|
|
73
|
+
schemaVersion: 1;
|
|
74
|
+
contract: "idlekit.balance-checks.v1";
|
|
75
|
+
algorithmVersion: "balance-checks-1";
|
|
76
|
+
failOn: readonly FailOnToken[];
|
|
77
|
+
pass: boolean;
|
|
78
|
+
exitCode: 0 | 2;
|
|
79
|
+
results: readonly BalanceCheckResultV1[];
|
|
80
|
+
advisory: string | null;
|
|
81
|
+
baselineRewrite: false;
|
|
82
|
+
externalProvider: false;
|
|
83
|
+
}>;
|
|
84
|
+
export type BalanceCheckErrorV1 = Readonly<{
|
|
85
|
+
schemaVersion: 1;
|
|
86
|
+
contract: "idlekit.balance-checks.v1";
|
|
87
|
+
kind: "balance-check-error";
|
|
88
|
+
exitCode: 2;
|
|
89
|
+
failed: readonly BalanceCheckResultV1[];
|
|
90
|
+
advisory: string | null;
|
|
91
|
+
baselineRewrite: false;
|
|
92
|
+
externalProvider: false;
|
|
93
|
+
}>;
|
|
94
|
+
export type BalanceCheckDocumentV1 = BalanceCheckReportV1 | BalanceCheckErrorV1;
|
|
95
|
+
/**
|
|
96
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-check-spec A check names a registered metric, operator, threshold, unit, severity, and missing policy.
|
|
97
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-check-spec #d7f7211 Re-read the section: the default path is a data spec, not an arbitrary expression.
|
|
98
|
+
*/
|
|
99
|
+
export declare const balanceCheckSpec: "registered-check-spec";
|
|
100
|
+
/**
|
|
101
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-verdict-bounds Pass and fail come only from a measured point or a bound that decides the comparison.
|
|
102
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-verdict-bounds #7c48cdf Re-read the section: a missing or unknown value is not zero, and a censored lower bound can fail.
|
|
103
|
+
*/
|
|
104
|
+
export declare const balanceVerdictBounds: "bounds-not-zero";
|
|
105
|
+
/**
|
|
106
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-identity-mismatch A different definition, method, version, seed, engine, or unit is a mismatch and is not rewritten.
|
|
107
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-identity-mismatch #b9af2a2 Re-read the section: mismatch stays inconclusive and baselineRewrite stays false.
|
|
108
|
+
*/
|
|
109
|
+
export declare const balanceIdentityMismatch: "mismatch-not-rewritten";
|
|
110
|
+
/**
|
|
111
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-kpi-adapter The existing a/b horizon report is mapped into this engine.
|
|
112
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-kpi-adapter #9f228f6 Re-read the section: identical fixture rows pass and a lower worth fails.
|
|
113
|
+
*/
|
|
114
|
+
export declare const balanceKpiAdapter: "kpi-adapter";
|
|
115
|
+
/**
|
|
116
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-assertion-grammar Scenario assertions are declaration-only. The supported grammar is the safe comparison term.
|
|
117
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-assertion-grammar #2ad185e Re-read the section: an unsafe expression is unsupported and is not executed.
|
|
118
|
+
*/
|
|
119
|
+
export declare const balanceAssertionGrammar: "declaration-only";
|
|
120
|
+
/**
|
|
121
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-numeric-advisory The numeric verdict and the advisory text are separate, and the default path does not fetch.
|
|
122
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-numeric-advisory #80bc2bf Re-read the section: advisory text cannot turn a fail into a pass.
|
|
123
|
+
*/
|
|
124
|
+
export declare const balanceNumericAdvisory: "numeric-not-advisory";
|
|
125
|
+
/**
|
|
126
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-failure-report A blocking result exits 2 and the error document validates.
|
|
127
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-failure-report #fd8c2d1 Re-read the section: unsupported, error, and missing do not become pass.
|
|
128
|
+
*/
|
|
129
|
+
export declare const balanceFailureReport: "failure-exit-two";
|
|
130
|
+
/**
|
|
131
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-failure-report The published validator is createValidate of the balance document.
|
|
132
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-failure-report #fd8c2d1 Re-read the section: the error kind validates with the report.
|
|
133
|
+
*/
|
|
134
|
+
export declare const validateBalanceCheckReport: (input: unknown) => IValidation<BalanceCheckDocumentV1>;
|
|
135
|
+
declare function buildBalanceChecksJsonSchema(): typia.IJsonSchemaUnit.IV3_1<BalanceCheckDocumentV1>;
|
|
136
|
+
/**
|
|
137
|
+
* @evidence docs/requirements/active/balance-checks.md#req-pr17-failure-report The structural schema is OpenAPI 3.1 from typia.
|
|
138
|
+
* @evidenceReview docs/requirements/active/balance-checks.md#req-pr17-failure-report #fd8c2d1 Re-read the section: schema version is 3.1 and the contract id is idlekit.balance-checks.v1.
|
|
139
|
+
*/
|
|
140
|
+
export declare function balanceChecksJsonSchema(): ReturnType<typeof buildBalanceChecksJsonSchema>;
|
|
141
|
+
export declare function balanceChecksSchemaId(): "https://idlekit.dev/schemas/balance-checks.v1.schema.json";
|
|
142
|
+
export declare function balanceChecksAlgorithmVersion(): "balance-checks-1";
|
|
143
|
+
export declare function parseFailOn(raw: string): readonly FailOnToken[] | null;
|
|
144
|
+
export declare function parseBalanceCheckRequest(input: unknown): {
|
|
145
|
+
ok: true;
|
|
146
|
+
request: BalanceCheckRequestV1;
|
|
147
|
+
} | {
|
|
148
|
+
ok: false;
|
|
149
|
+
issues: readonly string[];
|
|
150
|
+
};
|
|
151
|
+
type AssertionOp = "<" | "<=" | "==" | "!=" | ">=" | ">";
|
|
152
|
+
export type AssertionTerm = Readonly<{
|
|
153
|
+
path: string;
|
|
154
|
+
op: AssertionOp;
|
|
155
|
+
value: string;
|
|
156
|
+
}>;
|
|
157
|
+
export declare function classifyAssertionExpr(expr: string): {
|
|
158
|
+
status: "supported";
|
|
159
|
+
terms: readonly (readonly AssertionTerm[])[];
|
|
160
|
+
} | {
|
|
161
|
+
status: "unsupported";
|
|
162
|
+
reason: string;
|
|
163
|
+
};
|
|
164
|
+
export declare function evaluateBalanceChecks(request: BalanceCheckRequestV1): BalanceCheckReportV1;
|
|
165
|
+
export declare function toBalanceCheckError(report: BalanceCheckReportV1): BalanceCheckErrorV1;
|
|
166
|
+
export declare function renderBalanceCheckMarkdown(report: BalanceCheckReportV1 | BalanceCheckErrorV1): string;
|
|
167
|
+
type KpiSide = "a" | "b";
|
|
168
|
+
type KpiHorizon = "at7d" | "at30d" | "at90d";
|
|
169
|
+
export type KpiRegressionInput = Readonly<{
|
|
170
|
+
baseline: unknown;
|
|
171
|
+
current: unknown;
|
|
172
|
+
baselinePath: string;
|
|
173
|
+
currentPath: string;
|
|
174
|
+
generatedAt: string;
|
|
175
|
+
minWorthRatio: number;
|
|
176
|
+
maxStallDelta: number;
|
|
177
|
+
maxDroppedDelta: number;
|
|
178
|
+
minVisibleProgressRatio: number;
|
|
179
|
+
maxNoRewardGapDelta: number;
|
|
180
|
+
}>;
|
|
181
|
+
export declare function adaptKpiRegression(input: KpiRegressionInput): {
|
|
182
|
+
baselinePath: string;
|
|
183
|
+
currentPath: string;
|
|
184
|
+
generatedAt: string;
|
|
185
|
+
thresholds: {
|
|
186
|
+
minWorthRatio: number;
|
|
187
|
+
maxStallDelta: number;
|
|
188
|
+
maxDroppedDelta: number;
|
|
189
|
+
minVisibleProgressRatio: number;
|
|
190
|
+
maxNoRewardGapDelta: number;
|
|
191
|
+
};
|
|
192
|
+
pass: boolean;
|
|
193
|
+
checks: {
|
|
194
|
+
side: KpiSide;
|
|
195
|
+
horizon: KpiHorizon;
|
|
196
|
+
baseline: {
|
|
197
|
+
endNetWorth: string;
|
|
198
|
+
stallRatio: number;
|
|
199
|
+
droppedRate: number;
|
|
200
|
+
};
|
|
201
|
+
current: {
|
|
202
|
+
endNetWorth: string;
|
|
203
|
+
stallRatio: number;
|
|
204
|
+
droppedRate: number;
|
|
205
|
+
};
|
|
206
|
+
deltas: {
|
|
207
|
+
endWorthLog10: number;
|
|
208
|
+
stallRatio: number;
|
|
209
|
+
droppedRate: number;
|
|
210
|
+
};
|
|
211
|
+
thresholds: {
|
|
212
|
+
minWorthLog10Delta: number;
|
|
213
|
+
maxStallDelta: number;
|
|
214
|
+
maxDroppedDelta: number;
|
|
215
|
+
};
|
|
216
|
+
pass: {
|
|
217
|
+
worth: boolean;
|
|
218
|
+
stallRatio: boolean;
|
|
219
|
+
droppedRate: boolean;
|
|
220
|
+
overall: boolean;
|
|
221
|
+
};
|
|
222
|
+
}[];
|
|
223
|
+
experienceChecks: {
|
|
224
|
+
side: KpiSide;
|
|
225
|
+
baseline: {
|
|
226
|
+
visibleChangesPerMinute: number;
|
|
227
|
+
maxNoRewardGapSec: number;
|
|
228
|
+
};
|
|
229
|
+
current: {
|
|
230
|
+
visibleChangesPerMinute: number;
|
|
231
|
+
maxNoRewardGapSec: number;
|
|
232
|
+
};
|
|
233
|
+
deltas: {
|
|
234
|
+
visibleRatio: number;
|
|
235
|
+
noRewardGapSec: number;
|
|
236
|
+
};
|
|
237
|
+
thresholds: {
|
|
238
|
+
minVisibleProgressRatio: number;
|
|
239
|
+
maxNoRewardGapDelta: number;
|
|
240
|
+
};
|
|
241
|
+
pass: {
|
|
242
|
+
visibleProgress: boolean;
|
|
243
|
+
noRewardGap: boolean;
|
|
244
|
+
overall: boolean;
|
|
245
|
+
};
|
|
246
|
+
}[];
|
|
247
|
+
balanceChecks: Readonly<{
|
|
248
|
+
schemaVersion: 1;
|
|
249
|
+
contract: "idlekit.balance-checks.v1";
|
|
250
|
+
algorithmVersion: "balance-checks-1";
|
|
251
|
+
failOn: readonly FailOnToken[];
|
|
252
|
+
pass: boolean;
|
|
253
|
+
exitCode: 0 | 2;
|
|
254
|
+
results: readonly BalanceCheckResultV1[];
|
|
255
|
+
advisory: string | null;
|
|
256
|
+
baselineRewrite: false;
|
|
257
|
+
externalProvider: false;
|
|
258
|
+
}>;
|
|
259
|
+
};
|
|
260
|
+
export {};
|