@idlekit/core 0.3.0 → 0.4.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.js +7 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/scenario/compile.d.ts +2 -2
  6. package/dist/scenario/compile.js +19 -14
  7. package/dist/scenario/compile.js.map +1 -1
  8. package/dist/scenario/scenarioContract.d.ts +30 -0
  9. package/dist/scenario/scenarioContract.js +35 -0
  10. package/dist/scenario/scenarioContract.js.map +1 -1
  11. package/dist/sim/advance.d.ts +198 -0
  12. package/dist/sim/advance.js +609 -0
  13. package/dist/sim/advance.js.map +1 -0
  14. package/dist/sim/analysis/checks.d.ts +260 -0
  15. package/dist/sim/analysis/checks.js +1442 -0
  16. package/dist/sim/analysis/checks.js.map +1 -0
  17. package/dist/sim/analysis/contracts.js +4 -0
  18. package/dist/sim/analysis/contracts.js.map +1 -1
  19. package/dist/sim/analysis/flow.d.ts +169 -0
  20. package/dist/sim/analysis/flow.js +1359 -0
  21. package/dist/sim/analysis/flow.js.map +1 -0
  22. package/dist/sim/analysis/jevAdvisory.d.ts +113 -0
  23. package/dist/sim/analysis/jevAdvisory.js +846 -0
  24. package/dist/sim/analysis/jevAdvisory.js.map +1 -0
  25. package/dist/sim/analysis/judge.d.ts +145 -0
  26. package/dist/sim/analysis/judge.js +1451 -0
  27. package/dist/sim/analysis/judge.js.map +1 -0
  28. package/dist/sim/analysis/registry.d.ts +9 -6
  29. package/dist/sim/analysis/registry.js +15 -2
  30. package/dist/sim/analysis/registry.js.map +1 -1
  31. package/dist/sim/analysis/resetCycle.js +30 -6
  32. package/dist/sim/analysis/resetCycle.js.map +1 -1
  33. package/dist/sim/executionBackend.d.ts +165 -0
  34. package/dist/sim/executionBackend.js +521 -0
  35. package/dist/sim/executionBackend.js.map +1 -0
  36. package/dist/sim/integrationMatrix.d.ts +52 -0
  37. package/dist/sim/integrationMatrix.js +68 -0
  38. package/dist/sim/integrationMatrix.js.map +1 -0
  39. package/dist/sim/observation.d.ts +11 -0
  40. package/dist/sim/observation.js +12 -0
  41. package/dist/sim/observation.js.map +1 -1
  42. package/dist/sim/offline.d.ts +2 -0
  43. package/dist/sim/offline.js +68 -1
  44. package/dist/sim/offline.js.map +1 -1
  45. package/dist/sim/simulator.d.ts +2 -0
  46. package/dist/sim/simulator.js +71 -1
  47. package/dist/sim/simulator.js.map +1 -1
  48. package/dist/sim/step.d.ts +10 -0
  49. package/dist/sim/step.js +22 -8
  50. package/dist/sim/step.js.map +1 -1
  51. package/dist/sim/types.d.ts +11 -0
  52. package/package.json +2 -2
@@ -0,0 +1,609 @@
1
+ import * as _isTypeUint64_1 from "typia/lib/internal/_isTypeUint64";
2
+ import * as _validateReport_1 from "typia/lib/internal/_validateReport";
3
+ import * as _createStandardSchema_1 from "typia/lib/internal/_createStandardSchema";
4
+ import typia, {} from "typia";
5
+ import { exactAmountSign } from "./step";
6
+ import { nextBoundary, stepContext } from "./timeBoundary";
7
+ /**
8
+ * Opt-in analytic advance. Fixed-step stays the reference.
9
+ * An unclear evolve, purchase, reset, seed, buff, or capacity boundary refuses the chunk.
10
+ */
11
+ const ADVANCE_SCHEMA_ID = "https://idlekit.dev/schemas/advance.v1.schema.json";
12
+ const ADVANCE_ALGORITHM_VERSION = "guarded-advance-1";
13
+ /**
14
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The published schema id is the advance report.
15
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: the id is the advance v1 schema.
16
+ */
17
+ export function advanceSchemaId() {
18
+ return ADVANCE_SCHEMA_ID;
19
+ }
20
+ /**
21
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The algorithm version is guarded-advance-1.
22
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: the version string is guarded-advance-1.
23
+ */
24
+ export function advanceAlgorithmVersion() {
25
+ return ADVANCE_ALGORITHM_VERSION;
26
+ }
27
+ /**
28
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback An unclear boundary stays on fixed-step.
29
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: evolve, purchase, strategy, reset, milestone, capacity, session clock, emit, and a non-empty bucket refuse the chunk.
30
+ */
31
+ export const advanceGuardedFallback = "unclear-boundary-uses-fixed-step";
32
+ /**
33
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match Constant income matches the reference wallet, goal time, and counters.
34
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match #eaace6d Re-read the section: chunk size does not change the reference result.
35
+ */
36
+ export const advanceExactMatch = "constant-income-matches-reference";
37
+ /**
38
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-policy-boundary A tick threshold is not treated as one large delta.
39
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-policy-boundary #fe9aa0a Re-read the section: drop and accumulate thresholds fall back.
40
+ */
41
+ export const advancePolicyThreshold = "threshold-is-not-composed";
42
+ /**
43
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-stochastic A seeded model does not advance without a capability.
44
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-stochastic #63e1126 Re-read the section: a seed stays on fixed-step.
45
+ */
46
+ export const advanceStochasticSeed = "seed-without-capability-stays-fixed";
47
+ /**
48
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-observation-facts Fast event omission still keeps money facts.
49
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-observation-facts #7eaece6 Re-read the section: omitted events are not stored as measured zeros.
50
+ */
51
+ export const advanceFactsKept = "fast-events-keep-observation-facts";
52
+ /**
53
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-measured-bench A horizon is timed before any speedup is stated.
54
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-measured-bench #993ad19 Re-read the section: 30d and 90d are measured, and memory is recorded.
55
+ */
56
+ export const advanceMeasuredBench = "no-unmeasured-speedup";
57
+ /*
58
+ * typia runs on first call, not at module load. A plugin that the bundled CLI loads
59
+ * imports core source without the transform, and a module-load call would throw there.
60
+ */
61
+ let validateAdvanceReportValidator;
62
+ /**
63
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The published validator is createValidate of the advance report.
64
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: the structural document is AdvanceReportV1.
65
+ */
66
+ export const validateAdvanceReport = (input) => (validateAdvanceReportValidator ??= (() => {
67
+ const _ve0 = "Readonly<{ schemaVersion: 1; contract: \"idlekit.advance.v1\"; algorithmVersion: \"guarded-advance-1\"; capability: \"statically-known\" | \"unknown\" | \"unsupported\"; requested: \"approximation\" | \"exact\"; ... 8 more ...; externalProvider: false; }>";
68
+ const _io0 = input => 1 === input.schemaVersion && "idlekit.advance.v1" === input.contract && "guarded-advance-1" === input.algorithmVersion && ("statically-known" === input.capability || "unknown" === input.capability || "unsupported" === input.capability) && ("approximation" === input.requested || "exact" === input.requested) && ("exact" === input.status || "fallback" === input.status) && "string" === typeof input.reason && (null === input.tolerance || "string" === typeof input.tolerance) && ("number" === typeof input.exactSteps && _isTypeUint64_1._isTypeUint64(input.exactSteps)) && ("number" === typeof input.fallbackSteps && _isTypeUint64_1._isTypeUint64(input.fallbackSteps)) && ("number" === typeof input.chunks && _isTypeUint64_1._isTypeUint64(input.chunks)) && ("degraded" === input.observation || "equivalent" === input.observation) && "unchanged" === input.seedSchedule && false === input.externalProvider;
69
+ const _vo0 = (input, _path, _exceptionable = true) => [1 === input.schemaVersion || _report(_exceptionable, {
70
+ path: _path + ".schemaVersion",
71
+ expected: "1",
72
+ value: input.schemaVersion
73
+ }), "idlekit.advance.v1" === input.contract || _report(_exceptionable, {
74
+ path: _path + ".contract",
75
+ expected: "\"idlekit.advance.v1\"",
76
+ value: input.contract
77
+ }), "guarded-advance-1" === input.algorithmVersion || _report(_exceptionable, {
78
+ path: _path + ".algorithmVersion",
79
+ expected: "\"guarded-advance-1\"",
80
+ value: input.algorithmVersion
81
+ }), "statically-known" === input.capability || "unknown" === input.capability || "unsupported" === input.capability || _report(_exceptionable, {
82
+ path: _path + ".capability",
83
+ expected: "(\"statically-known\" | \"unknown\" | \"unsupported\")",
84
+ value: input.capability
85
+ }), "approximation" === input.requested || "exact" === input.requested || _report(_exceptionable, {
86
+ path: _path + ".requested",
87
+ expected: "(\"approximation\" | \"exact\")",
88
+ value: input.requested
89
+ }), "exact" === input.status || "fallback" === input.status || _report(_exceptionable, {
90
+ path: _path + ".status",
91
+ expected: "(\"exact\" | \"fallback\")",
92
+ value: input.status
93
+ }), "string" === typeof input.reason || _report(_exceptionable, {
94
+ path: _path + ".reason",
95
+ expected: "string",
96
+ value: input.reason
97
+ }), null === input.tolerance || "string" === typeof input.tolerance || _report(_exceptionable, {
98
+ path: _path + ".tolerance",
99
+ expected: "(null | string)",
100
+ value: input.tolerance
101
+ }), "number" === typeof input.exactSteps && (_isTypeUint64_1._isTypeUint64(input.exactSteps) || _report(_exceptionable, {
102
+ path: _path + ".exactSteps",
103
+ expected: "number & Type<\"uint64\">",
104
+ value: input.exactSteps
105
+ })) || _report(_exceptionable, {
106
+ path: _path + ".exactSteps",
107
+ expected: "(number & Type<\"uint64\">)",
108
+ value: input.exactSteps
109
+ }), "number" === typeof input.fallbackSteps && (_isTypeUint64_1._isTypeUint64(input.fallbackSteps) || _report(_exceptionable, {
110
+ path: _path + ".fallbackSteps",
111
+ expected: "number & Type<\"uint64\">",
112
+ value: input.fallbackSteps
113
+ })) || _report(_exceptionable, {
114
+ path: _path + ".fallbackSteps",
115
+ expected: "(number & Type<\"uint64\">)",
116
+ value: input.fallbackSteps
117
+ }), "number" === typeof input.chunks && (_isTypeUint64_1._isTypeUint64(input.chunks) || _report(_exceptionable, {
118
+ path: _path + ".chunks",
119
+ expected: "number & Type<\"uint64\">",
120
+ value: input.chunks
121
+ })) || _report(_exceptionable, {
122
+ path: _path + ".chunks",
123
+ expected: "(number & Type<\"uint64\">)",
124
+ value: input.chunks
125
+ }), "degraded" === input.observation || "equivalent" === input.observation || _report(_exceptionable, {
126
+ path: _path + ".observation",
127
+ expected: "(\"degraded\" | \"equivalent\")",
128
+ value: input.observation
129
+ }), "unchanged" === input.seedSchedule || _report(_exceptionable, {
130
+ path: _path + ".seedSchedule",
131
+ expected: "\"unchanged\"",
132
+ value: input.seedSchedule
133
+ }), false === input.externalProvider || _report(_exceptionable, {
134
+ path: _path + ".externalProvider",
135
+ expected: "false",
136
+ value: input.externalProvider
137
+ })].every(flag => flag);
138
+ const __is = input => "object" === typeof input && null !== input && _io0(input);
139
+ let errors;
140
+ let _report;
141
+ return _createStandardSchema_1._createStandardSchema(input => {
142
+ if (false === __is(input)) {
143
+ errors = [];
144
+ _report = _validateReport_1._validateReport(errors);
145
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
146
+ path: _path + "",
147
+ expected: _ve0,
148
+ value: input
149
+ })) && _vo0(input, _path + "", true) || _report(true, {
150
+ path: _path + "",
151
+ expected: _ve0,
152
+ value: input
153
+ }))(input, "$input", true);
154
+ const success = 0 === errors.length;
155
+ return success ? {
156
+ success,
157
+ data: input
158
+ } : {
159
+ success,
160
+ errors,
161
+ data: input
162
+ };
163
+ }
164
+ return {
165
+ success: true,
166
+ data: input
167
+ };
168
+ });
169
+ })())(input);
170
+ function buildAdvanceJsonSchema() {
171
+ return {
172
+ components: {
173
+ schemas: {
174
+ "ReadonlyschemaVersion1contractidlekit_x2E_advance_x2E_v1algorithmVersionguarded-advance-1capabilitystatically-knownunknownunsupportedrequestedapproximationexact---8more---externalProviderfalse-xA833F4041B857456": {
175
+ type: "object",
176
+ properties: {
177
+ schemaVersion: {
178
+ "const": 1
179
+ },
180
+ contract: {
181
+ "const": "idlekit.advance.v1"
182
+ },
183
+ algorithmVersion: {
184
+ "const": "guarded-advance-1"
185
+ },
186
+ capability: {
187
+ oneOf: [
188
+ {
189
+ "const": "statically-known"
190
+ },
191
+ {
192
+ "const": "unknown"
193
+ },
194
+ {
195
+ "const": "unsupported"
196
+ }
197
+ ]
198
+ },
199
+ requested: {
200
+ oneOf: [
201
+ {
202
+ "const": "approximation"
203
+ },
204
+ {
205
+ "const": "exact"
206
+ }
207
+ ]
208
+ },
209
+ status: {
210
+ oneOf: [
211
+ {
212
+ "const": "exact"
213
+ },
214
+ {
215
+ "const": "fallback"
216
+ }
217
+ ]
218
+ },
219
+ reason: {
220
+ type: "string"
221
+ },
222
+ tolerance: {
223
+ oneOf: [
224
+ {
225
+ type: "null"
226
+ },
227
+ {
228
+ type: "string"
229
+ }
230
+ ]
231
+ },
232
+ exactSteps: {
233
+ type: "integer",
234
+ minimum: 0
235
+ },
236
+ fallbackSteps: {
237
+ type: "integer",
238
+ minimum: 0
239
+ },
240
+ chunks: {
241
+ type: "integer",
242
+ minimum: 0
243
+ },
244
+ observation: {
245
+ oneOf: [
246
+ {
247
+ "const": "degraded"
248
+ },
249
+ {
250
+ "const": "equivalent"
251
+ }
252
+ ]
253
+ },
254
+ seedSchedule: {
255
+ "const": "unchanged"
256
+ },
257
+ externalProvider: {
258
+ "const": false
259
+ }
260
+ },
261
+ required: [
262
+ "schemaVersion",
263
+ "contract",
264
+ "algorithmVersion",
265
+ "capability",
266
+ "requested",
267
+ "status",
268
+ "reason",
269
+ "tolerance",
270
+ "exactSteps",
271
+ "fallbackSteps",
272
+ "chunks",
273
+ "observation",
274
+ "seedSchedule",
275
+ "externalProvider"
276
+ ],
277
+ additionalProperties: false
278
+ }
279
+ }
280
+ },
281
+ schema: {
282
+ type: "object",
283
+ properties: {
284
+ schemaVersion: {
285
+ "const": 1
286
+ },
287
+ contract: {
288
+ "const": "idlekit.advance.v1"
289
+ },
290
+ algorithmVersion: {
291
+ "const": "guarded-advance-1"
292
+ },
293
+ capability: {
294
+ oneOf: [
295
+ {
296
+ "const": "statically-known"
297
+ },
298
+ {
299
+ "const": "unknown"
300
+ },
301
+ {
302
+ "const": "unsupported"
303
+ }
304
+ ]
305
+ },
306
+ requested: {
307
+ oneOf: [
308
+ {
309
+ "const": "approximation"
310
+ },
311
+ {
312
+ "const": "exact"
313
+ }
314
+ ]
315
+ },
316
+ status: {
317
+ oneOf: [
318
+ {
319
+ "const": "exact"
320
+ },
321
+ {
322
+ "const": "fallback"
323
+ }
324
+ ]
325
+ },
326
+ reason: {
327
+ type: "string"
328
+ },
329
+ tolerance: {
330
+ oneOf: [
331
+ {
332
+ type: "null"
333
+ },
334
+ {
335
+ type: "string"
336
+ }
337
+ ]
338
+ },
339
+ exactSteps: {
340
+ type: "integer",
341
+ minimum: 0
342
+ },
343
+ fallbackSteps: {
344
+ type: "integer",
345
+ minimum: 0
346
+ },
347
+ chunks: {
348
+ type: "integer",
349
+ minimum: 0
350
+ },
351
+ observation: {
352
+ oneOf: [
353
+ {
354
+ "const": "degraded"
355
+ },
356
+ {
357
+ "const": "equivalent"
358
+ }
359
+ ]
360
+ },
361
+ seedSchedule: {
362
+ "const": "unchanged"
363
+ },
364
+ externalProvider: {
365
+ "const": false
366
+ }
367
+ },
368
+ required: [
369
+ "schemaVersion",
370
+ "contract",
371
+ "algorithmVersion",
372
+ "capability",
373
+ "requested",
374
+ "status",
375
+ "reason",
376
+ "tolerance",
377
+ "exactSteps",
378
+ "fallbackSteps",
379
+ "chunks",
380
+ "observation",
381
+ "seedSchedule",
382
+ "externalProvider"
383
+ ],
384
+ additionalProperties: false
385
+ },
386
+ version: "3.1"
387
+ };
388
+ }
389
+ let advanceJsonSchemaUnit;
390
+ /**
391
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The structural schema is OpenAPI 3.1 from typia.
392
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: schema version is 3.1 and the contract id is idlekit.advance.v1.
393
+ */
394
+ export function advanceJsonSchema() {
395
+ advanceJsonSchemaUnit ??= buildAdvanceJsonSchema();
396
+ return advanceJsonSchemaUnit;
397
+ }
398
+ /**
399
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The ledger counts exact steps and fallback steps separately.
400
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: an approximation request is not applied.
401
+ */
402
+ export function createAdvanceLedger(requested, tolerance) {
403
+ return { requested, tolerance, exactSteps: 0, fallbackSteps: 0, chunks: 0, reasons: [] };
404
+ }
405
+ /**
406
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The report separates an exact chunk from a fixed-step fallback.
407
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: a fallback reason is kept, and the seed schedule is unchanged.
408
+ */
409
+ export function finishAdvanceReport(ledger, capability) {
410
+ const unique = [...new Set(ledger.reasons)];
411
+ const exact = ledger.fallbackSteps === 0 && ledger.exactSteps > 0 && ledger.requested === "exact";
412
+ return {
413
+ schemaVersion: 1,
414
+ contract: "idlekit.advance.v1",
415
+ algorithmVersion: ADVANCE_ALGORITHM_VERSION,
416
+ capability,
417
+ requested: ledger.requested,
418
+ status: exact ? "exact" : "fallback",
419
+ reason: exact ? "constant income matched the reference step" : unique[0] ?? "fixed-step reference",
420
+ tolerance: ledger.requested === "approximation" ? ledger.tolerance : null,
421
+ exactSteps: ledger.exactSteps,
422
+ fallbackSteps: ledger.fallbackSteps,
423
+ chunks: ledger.chunks,
424
+ observation: ledger.requested === "approximation" ? "degraded" : "equivalent",
425
+ seedSchedule: "unchanged",
426
+ externalProvider: false,
427
+ };
428
+ }
429
+ /**
430
+ * What the report says the model can do, read once from the start state.
431
+ *
432
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback The report names the advance capability next to the fallback reason.
433
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-guarded-fallback #5b4bffc Re-read the section: the report contract is idlekit.advance.v1, and it carries this capability beside the fallback reason.
434
+ */
435
+ export function advanceCapabilityOf(model, ctx, state) {
436
+ if (!model.analytic)
437
+ return "unsupported";
438
+ const hint = model.analytic(ctx, state);
439
+ if (!hint)
440
+ return "unknown";
441
+ return hint.incomeKind === "constant" ? "statically-known" : "unsupported";
442
+ }
443
+ /**
444
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-policy-boundary Refusal names the boundary that fixed-step must keep.
445
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-policy-boundary #fe9aa0a Re-read the section: a threshold, a seed, or a session clock refuses the chunk.
446
+ */
447
+ export function refusalForAdvance(args) {
448
+ return certifyAdvance(args).reason;
449
+ }
450
+ /** The guard behind `refusalForAdvance`. */
451
+ function certifyAdvance(args) {
452
+ const reason = (text) => ({ reason: text });
453
+ if (args.requested === "approximation")
454
+ return reason("approximation is not applied");
455
+ if (args.ctx.seed !== undefined)
456
+ return reason("seeded model has no advance capability");
457
+ if (args.ctx.clocks !== undefined)
458
+ return reason("scheduled session boundary");
459
+ if (args.ctx.tickPolicy.maxLogGap !== undefined)
460
+ return reason("tick policy threshold is not compositionally equivalent");
461
+ if (args.ctx.emit)
462
+ return reason("event emitter receives each tick");
463
+ if (args.model.evolve)
464
+ return reason("evolve is not in the exact interval");
465
+ if (args.model.prestige)
466
+ return reason("reset is not in the exact interval");
467
+ if (args.model.milestones)
468
+ return reason("milestone boundary is not in the exact interval");
469
+ if (args.strategy)
470
+ return reason("purchase strategy is not in the exact interval");
471
+ if (!args.model.analytic)
472
+ return reason("advance capability is unsupported");
473
+ const hint = args.model.analytic(args.ctx, args.state);
474
+ if (!hint)
475
+ return reason("advance capability is unknown");
476
+ if (hint.incomeKind !== "constant")
477
+ return reason("income kind is not constant");
478
+ if (hint.softcap)
479
+ return reason("capacity boundary is not in the exact interval");
480
+ if (args.model.actions(args.ctx, args.state).length > 0)
481
+ return reason("purchase is available");
482
+ // `cmp` calls an epsilon-sized bucket empty. A fixed-step tick would still flush it.
483
+ if (exactAmountSign(args.ctx.E, args.state.wallet.bucket) !== 0)
484
+ return reason("money bucket is not empty");
485
+ const income = args.model.income(args.ctx, args.state);
486
+ if (income.unit.code !== args.state.wallet.money.unit.code)
487
+ return reason("income unit does not match the wallet");
488
+ const next = applyExactIncome(args.ctx.E, args.state, income.amount, args.dt, args.ctx.tickPolicy.mode);
489
+ const nextIncome = args.model.income(args.ctx, next);
490
+ if (args.ctx.E.cmp(nextIncome.amount, income.amount) !== 0)
491
+ return reason("income changed inside the interval");
492
+ return { reason: null, income, next };
493
+ }
494
+ /**
495
+ * The amount one tick applies, as the tick policy without `maxLogGap` applies it: drop adds the scaled income,
496
+ * and accumulate adds the bucket plus that income.
497
+ */
498
+ function appliedDelta(E, bucket, incomePerSec, dt, mode) {
499
+ const scaled = E.mul(incomePerSec, dt);
500
+ return mode === "accumulate" ? E.add(bucket, scaled) : scaled;
501
+ }
502
+ /**
503
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match Constant income is added with the engine, not a narrowed number.
504
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match #eaace6d Re-read the section: wallet and max money use the engine add.
505
+ */
506
+ export function applyExactIncome(E, state, incomePerSec, dt, mode = "drop") {
507
+ const amount = E.add(state.wallet.money.amount, appliedDelta(E, state.wallet.bucket, incomePerSec, dt, mode));
508
+ const money = { unit: state.wallet.money.unit, amount };
509
+ // An applied tick leaves an empty bucket under either policy.
510
+ const next = {
511
+ ...state,
512
+ wallet: { money, bucket: E.zero() },
513
+ t: state.t + dt,
514
+ };
515
+ if (E.cmp(amount, state.maxMoneyEver.amount) > 0) {
516
+ return { ...next, maxMoneyEver: money };
517
+ }
518
+ return next;
519
+ }
520
+ /**
521
+ * Take whole reference steps while each one is certified, up to `chunkSec` of them.
522
+ * Each step comes from `nextBoundary` on the runner's summed clock, so the dt grid, the horizon epsilon, the goal,
523
+ * and the step budget are the fixed-step ones. A chunk always takes its first step, so a `chunkSec` below one step
524
+ * is one step. The runner's own boundary check stops or throws after the chunk, as it would after that step.
525
+ * Each step is handed to `onStep` as it is taken and is not retained, so chunk memory does not grow with `chunkSec`.
526
+ * Each step applies the income its own guard read, after the callbacks for the previous step have run.
527
+ *
528
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match An exact chunk uses the reference step grid.
529
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-exact-match #eaace6d Re-read the section: the chunk takes whole reference steps from nextBoundary on the summed clock, stops on until, the horizon, and the step budget, hands each step to onStep without holding it, and applies the income its own guard read without carrying it to the next step.
530
+ */
531
+ export function consumeExactChunk(args) {
532
+ if (!(args.chunkSec > 0) || !Number.isFinite(args.chunkSec)) {
533
+ return { ok: false, reason: "chunkSec must be a finite number > 0" };
534
+ }
535
+ const { E } = args.ctx;
536
+ let taken = 0;
537
+ let cursor = args.state;
538
+ let elapsedSec = args.elapsedSec;
539
+ let steps = args.steps;
540
+ let consumedSec = 0;
541
+ let dt = args.firstDt;
542
+ for (;;) {
543
+ if (taken > 0) {
544
+ // The runner owns stop callbacks. Return after one tick so a stateful until is
545
+ // read once per reference boundary, including when a chunk or a guard ends.
546
+ if (args.until)
547
+ break;
548
+ const decision = nextBoundary({
549
+ elapsedSec,
550
+ steps,
551
+ stepSec: args.stepSec,
552
+ durationSec: args.durationSec,
553
+ untilMet: false,
554
+ hasUntil: false,
555
+ maxSteps: args.maxSteps,
556
+ });
557
+ if (decision.kind !== "step")
558
+ break;
559
+ dt = decision.dt;
560
+ if (consumedSec + dt > args.chunkSec)
561
+ break;
562
+ }
563
+ const ctx = stepContext(args.ctx, dt);
564
+ const certified = certifyAdvance({
565
+ ctx,
566
+ model: args.model,
567
+ state: cursor,
568
+ dt,
569
+ requested: args.requested,
570
+ strategy: args.strategy,
571
+ });
572
+ if (certified.reason !== null) {
573
+ if (taken === 0)
574
+ return { ok: false, reason: certified.reason };
575
+ break;
576
+ }
577
+ const { next } = certified;
578
+ const delta = appliedDelta(E, cursor.wallet.bucket, certified.income.amount, dt, ctx.tickPolicy.mode);
579
+ args.onStep({
580
+ t0: cursor.t,
581
+ t1: next.t,
582
+ dt,
583
+ state: next,
584
+ // The fixed-step reward test: an exactly positive applied amount.
585
+ rewarded: exactAmountSign(E, delta) === 1,
586
+ });
587
+ taken += 1;
588
+ cursor = next;
589
+ elapsedSec += dt;
590
+ steps += 1;
591
+ consumedSec += dt;
592
+ }
593
+ return { ok: true, state: cursor, steps: taken };
594
+ }
595
+ /**
596
+ * @evidence docs/requirements/active/guarded-analytic-advance.md#req-pr16-measured-bench The bench returns measured durations and rss.
597
+ * @evidenceReview docs/requirements/active/guarded-analytic-advance.md#req-pr16-measured-bench #993ad19 Re-read the section: the function does not invent a speedup multiple.
598
+ */
599
+ export function measureAdvanceRow(row) {
600
+ return {
601
+ horizonSec: row.horizonSec,
602
+ stepSec: row.stepSec,
603
+ fixedMs: row.fixedMs,
604
+ exactMs: row.exactMs,
605
+ rssBytes: row.rssBytes ?? process.memoryUsage().rss,
606
+ walletMatch: row.walletMatch,
607
+ };
608
+ }
609
+ //# sourceMappingURL=advance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advance.js","sourceRoot":"","sources":["../../src/sim/advance.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI3D;;;GAGG;AAEH,MAAM,iBAAiB,GAAG,oDAA6D,CAAC;AACxF,MA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