@bitcobblers/wod-wiki-lang 0.11.43 → 0.35.2115
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/dist/{browserRuntimeNow-je1Vb5bU.d.cts → browserRuntimeNow-CoR7dCNU.d.cts} +146 -134
- package/dist/{browserRuntimeNow-je1Vb5bU.d.ts → browserRuntimeNow-CoR7dCNU.d.ts} +146 -134
- package/dist/index.cjs +632 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -42
- package/dist/index.d.ts +194 -42
- package/dist/index.mjs +626 -106
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +16 -21
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.mjs +16 -21
- package/dist/react.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IMetric, MetricContainer, MetricOrigin, MetricType, IDialect, ICodeStatement, DialectAnalysis, ParsedCodeStatement, IOutputStatement, OutputStatementType, BlockKey, ScriptBlock, FenceDialect, Segment, AnalyticsGroup, StoredOutputStatement, OutputStatement } from '@bitcobblers/wod-wiki-core';
|
|
2
2
|
export { ParseError } from '@bitcobblers/wod-wiki-core';
|
|
3
3
|
import { Tree } from '@lezer/common';
|
|
4
|
-
import { W as WhiteboardScript, I as
|
|
5
|
-
export {
|
|
4
|
+
import { W as WhiteboardScript, I as IEffortResolver, a as IEffortRegistry, E as EffortResolverOptions, b as IEffort, c as EffortResolutionOptions, R as ResolvedEffort, d as EffortRegistrySource, e as EffortStorageAdapter, f as IRuntimeActionable, g as IEventBus, h as IRuntimeStack, i as IRuntimeClock, j as IJitCompiler, k as INowProvider, l as RuntimeStackOptions, m as RuntimeError, A as AnalyticsContext, n as IEvent, o as IRuntimeAction, O as OutputListener, U as Unsubscribe, p as IAnalyticsEngine, q as IRuntimeBlock, r as IBehaviorContext, B as BehaviorEventType, s as BehaviorEventListener, S as SubscribeOptions, t as Unsubscribe$1, u as OutputOptions, M as MemoryTag, v as IMemoryLocation, w as IRuntimeBehavior, x as IBlockContext, y as MetricVisibility, z as BlockLifecycleOptions, C as CompletionDecision, T as TimeSpan, D as IRuntimeMemory, F as TypedMemoryReference, G as MemorySearchCriteria, H as IMemoryReference, J as RuntimeStackLogger, K as StackObserver, L as StackSnapshot, N as StackListener, P as MemoryTypeEnum, Q as IAnchorValue, V as ButtonConfig, X as IEventHandler, Y as HandlerScope, Z as IScriptRuntime, _ as TestableBlockConfig, $ as IRuntimeOptions, a0 as ScriptRuntime, a1 as EventHandlerOptions, a2 as EventCallback, a3 as TimerState, a4 as IRealtimeProcessor, a5 as ISummaryProcessor, a6 as ProjectionResult } from './browserRuntimeNow-CoR7dCNU.js';
|
|
5
|
+
export { a7 as ButtonVariant, a8 as ButtonsState, a9 as ChildrenStatusState, aa as CompletionState, ab as DEFAULT_RESOLVER_OPTIONS, ac as DEFAULT_RUNTIME_OPTIONS, ad as DISCIPLINE_FACTORS, ae as DisplayState, af as EFFORT_DISCIPLINES, ag as EFFORT_REGISTRY_ORIGINS, ah as EffortBaseAttributes, ai as EffortDerivation, aj as EffortDiscipline, ak as EffortResolvedFrom, al as FenceDialect, am as FragmentDisplayState, an as FragmentState, ao as IAnalyticsProcessorDescriptor, ap as INTENSITY_TIERS, aq as IScript, ar as IntensityTier, as as InterceptMode, at as MemoryLocation, au as MemoryType, av as MemoryTypeMap, aw as MemoryValueOf, ax as RoundState, ay as RuntimeState, az as ScriptRuntimeDependencies, aA as StackEvent, aB as TimerDirection, aC as VISIBILITY_ICONS, aD as VISIBILITY_LABELS, aE as createBrowserRuntimeNow, aF as disciplineFactorFor, aG as filterTagsByVisibility, aH as frozenNow, aI as getMetricVisibility, aJ as getRuntimeNowMs, aK as isEffortDiscipline, aL as isFragmentTag, aM as wallClockNow } from './browserRuntimeNow-CoR7dCNU.js';
|
|
6
6
|
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
|
7
7
|
import { LRParser } from '@lezer/lr';
|
|
8
8
|
|
|
@@ -126,8 +126,8 @@ interface MetricBearing {
|
|
|
126
126
|
rawMetrics?: IMetric[];
|
|
127
127
|
metrics?: MetricContainer | IMetric[];
|
|
128
128
|
}
|
|
129
|
-
/** Create a single hint metric. */
|
|
130
|
-
declare function hintMetric(hint: string, origin?: MetricOrigin): IMetric;
|
|
129
|
+
/** Create a single hint metric. `icon` opts the hint into display: icon-only chip, hint text on hover. */
|
|
130
|
+
declare function hintMetric(hint: string, origin?: MetricOrigin, icon?: string): IMetric;
|
|
131
131
|
/**
|
|
132
132
|
* Build (or extend) a {@link MetricContainer} of hint metrics from a list of
|
|
133
133
|
* hint strings. Duplicate hint strings are collapsed.
|
|
@@ -587,7 +587,7 @@ interface SyntaxMeta {
|
|
|
587
587
|
raw: string;
|
|
588
588
|
}
|
|
589
589
|
interface BasePrimitive {
|
|
590
|
-
kind: 'lap' | 'duration' | 'rounds' | 'action' | 'text' | 'heading' | 'quantity' | 'effort' | 'property' | 'metric_object';
|
|
590
|
+
kind: 'lap' | 'duration' | 'rounds' | 'round_scheme' | 'action' | 'text' | 'heading' | 'quantity' | 'effort' | 'property' | 'metric_object';
|
|
591
591
|
raw: string;
|
|
592
592
|
meta: SyntaxMeta;
|
|
593
593
|
}
|
|
@@ -613,6 +613,15 @@ interface RoundsPrimitive extends BasePrimitive {
|
|
|
613
613
|
sequence?: number[];
|
|
614
614
|
label?: string;
|
|
615
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Inline NxM rounds scheme — `5x5` or `5 x 5` — lexed as one token so a bare
|
|
618
|
+
* `x` inside effort words is never stolen. N rounds x M reps per round.
|
|
619
|
+
*/
|
|
620
|
+
interface RoundSchemePrimitive extends BasePrimitive {
|
|
621
|
+
kind: 'round_scheme';
|
|
622
|
+
rounds: number;
|
|
623
|
+
reps: number;
|
|
624
|
+
}
|
|
616
625
|
interface ActionPrimitive extends BasePrimitive {
|
|
617
626
|
kind: 'action';
|
|
618
627
|
hasColonPrefix: boolean;
|
|
@@ -645,7 +654,7 @@ interface PropertyPrimitive extends BasePrimitive {
|
|
|
645
654
|
valueRaw: string;
|
|
646
655
|
value: string | number | boolean | null;
|
|
647
656
|
}
|
|
648
|
-
type SyntaxPrimitive = LapPrimitive | DurationPrimitive | RoundsPrimitive | ActionPrimitive | TextPrimitive | HeadingPrimitive | QuantityPrimitive | EffortPrimitive | PropertyPrimitive | MetricObjectPrimitive;
|
|
657
|
+
type SyntaxPrimitive = LapPrimitive | DurationPrimitive | RoundsPrimitive | RoundSchemePrimitive | ActionPrimitive | TextPrimitive | HeadingPrimitive | QuantityPrimitive | EffortPrimitive | PropertyPrimitive | MetricObjectPrimitive;
|
|
649
658
|
interface SyntaxStatement {
|
|
650
659
|
id: number;
|
|
651
660
|
line: number;
|
|
@@ -690,8 +699,11 @@ type SourceInput = string | {
|
|
|
690
699
|
* Extract statements WITHOUT running the Dialect Stack.
|
|
691
700
|
*
|
|
692
701
|
* Used by the parser test harness (which applies its own Dialect set) and by
|
|
693
|
-
* any consumer that needs the
|
|
702
|
+
* any consumer that needs the classified statements without Dialect
|
|
694
703
|
* processing. Production consumers should use {@link extractStatements}.
|
|
704
|
+
*
|
|
705
|
+
* Inline rounds normalization still runs here so every parser entrypoint —
|
|
706
|
+
* with or without dialects — produces the same deterministic Statement tree.
|
|
695
707
|
*/
|
|
696
708
|
declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree): ICodeStatement[];
|
|
697
709
|
/**
|
|
@@ -731,12 +743,12 @@ declare class MdTimerRuntime {
|
|
|
731
743
|
*
|
|
732
744
|
* @param sport - The block's `:sport` fence suffix (` ```log:climbing `).
|
|
733
745
|
*/
|
|
734
|
-
read(inputText: string, sport?: string):
|
|
746
|
+
read(inputText: string, sport?: string): WhiteboardScript;
|
|
735
747
|
/**
|
|
736
748
|
* Parse without running the Dialect Stack. Used by the parser test harness
|
|
737
749
|
* which applies its own Dialect set. Production consumers should use {@link read}.
|
|
738
750
|
*/
|
|
739
|
-
readWithoutDialects(inputText: string):
|
|
751
|
+
readWithoutDialects(inputText: string): WhiteboardScript;
|
|
740
752
|
}
|
|
741
753
|
|
|
742
754
|
declare function createParser(): MdTimerRuntime;
|
|
@@ -791,14 +803,55 @@ declare class EffortResolver implements IEffortResolver {
|
|
|
791
803
|
declare class InMemoryEffortRegistry implements IEffortRegistry {
|
|
792
804
|
private efforts;
|
|
793
805
|
private sourceFilter;
|
|
806
|
+
private initialized;
|
|
794
807
|
constructor(sourceFilter?: EffortRegistrySource);
|
|
795
808
|
/** Seed with bundled efforts */
|
|
796
809
|
loadBundled(): Promise<void>;
|
|
810
|
+
isInitialized(): boolean;
|
|
797
811
|
/** Seed with arbitrary efforts (useful for tests) */
|
|
798
812
|
seed(efforts: readonly IEffort[]): void;
|
|
799
813
|
/** Clear all efforts */
|
|
800
814
|
clear(): void;
|
|
801
815
|
resolve(slug: string): IEffort | null;
|
|
816
|
+
resolveByAlias(label: string): IEffort | null;
|
|
817
|
+
list(): readonly IEffort[];
|
|
818
|
+
listByOrigin(origin: EffortRegistrySource): readonly IEffort[];
|
|
819
|
+
upsert(effort: IEffort): Promise<void>;
|
|
820
|
+
delete(slug: string): Promise<void>;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
interface CompositeEffortRegistryOptions {
|
|
824
|
+
/** Custom bundled efforts to seed the read-only tier (defaults to built-in bundled efforts). */
|
|
825
|
+
bundled?: Iterable<IEffort>;
|
|
826
|
+
/** Optional persistence adapter for user-defined efforts. */
|
|
827
|
+
storage?: EffortStorageAdapter;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Composite Effort Registry — Two-Tier Lookup
|
|
831
|
+
*
|
|
832
|
+
* 1. User tier: loaded from storage adapter into memory
|
|
833
|
+
* 2. Bundled tier: shipped as read-only seed
|
|
834
|
+
*
|
|
835
|
+
* Lookup order: user wins over bundled.
|
|
836
|
+
* All lookups are O(1) in-memory after initialization.
|
|
837
|
+
*/
|
|
838
|
+
declare class CompositeEffortRegistry implements IEffortRegistry {
|
|
839
|
+
private readonly userEfforts;
|
|
840
|
+
private readonly bundledEfforts;
|
|
841
|
+
private initialized;
|
|
842
|
+
private readonly initialBundled?;
|
|
843
|
+
private readonly storage?;
|
|
844
|
+
constructor(options?: CompositeEffortRegistryOptions);
|
|
845
|
+
/**
|
|
846
|
+
* Initialize the registry:
|
|
847
|
+
* 1. Load bundled efforts into memory
|
|
848
|
+
* 2. Load user efforts from storage adapter into memory
|
|
849
|
+
*/
|
|
850
|
+
loadBundled(customBundled?: Iterable<IEffort>): Promise<void>;
|
|
851
|
+
/** True after loadBundled() has resolved */
|
|
852
|
+
isInitialized(): boolean;
|
|
853
|
+
resolve(slug: string): IEffort | null;
|
|
854
|
+
resolveByAlias(label: string): IEffort | null;
|
|
802
855
|
list(): readonly IEffort[];
|
|
803
856
|
listByOrigin(origin: EffortRegistrySource): readonly IEffort[];
|
|
804
857
|
upsert(effort: IEffort): Promise<void>;
|
|
@@ -867,6 +920,18 @@ declare const bundledEfforts: readonly IEffort[];
|
|
|
867
920
|
/** Number of bundled efforts */
|
|
868
921
|
declare const BUNDLED_EFFORT_COUNT: number;
|
|
869
922
|
|
|
923
|
+
/**
|
|
924
|
+
* Add an alias to an existing effort.
|
|
925
|
+
*
|
|
926
|
+
* If the effort is bundled, clones it into a user-tier override record with
|
|
927
|
+
* the same slug and derivation from the bundled parent, then adds the alias.
|
|
928
|
+
* If the effort is already a user record, appends the alias and updates it.
|
|
929
|
+
*
|
|
930
|
+
* Idempotent: if the alias is already present (by normalized comparison),
|
|
931
|
+
* returns the existing record without mutation.
|
|
932
|
+
*/
|
|
933
|
+
declare function addAliasToEffort(registry: IEffortRegistry, targetSlug: string, newAlias: string): Promise<IEffort>;
|
|
934
|
+
|
|
870
935
|
/**
|
|
871
936
|
* IRuntimeContext — what the execution world (actions, blocks, behaviors)
|
|
872
937
|
* receives. The runtime's collaborators (the "bag") plus the verbs to enqueue
|
|
@@ -1105,6 +1170,9 @@ declare class OutputEmitter {
|
|
|
1105
1170
|
* Reads the attached clock and stack count; only the block crosses the seam.
|
|
1106
1171
|
*/
|
|
1107
1172
|
emitCompilerBlock(block: IRuntimeBlock): void;
|
|
1173
|
+
/** Options-built outputs carry only sourceStatementId — copy the source
|
|
1174
|
+
* statement's line/text/dialect so persisted logs stay joinable by line. */
|
|
1175
|
+
private _propagateSourceLine;
|
|
1108
1176
|
}
|
|
1109
1177
|
|
|
1110
1178
|
/**
|
|
@@ -1319,7 +1387,7 @@ declare class RuntimeBlock implements IRuntimeBlock {
|
|
|
1319
1387
|
/**
|
|
1320
1388
|
* Gets a specific behavior by type from the behaviors array.
|
|
1321
1389
|
*/
|
|
1322
|
-
getBehavior<T extends IRuntimeBehavior>(behaviorType: new (...args:
|
|
1390
|
+
getBehavior<T extends IRuntimeBehavior>(behaviorType: new (...args: unknown[]) => T): T | undefined;
|
|
1323
1391
|
/**
|
|
1324
1392
|
* Emit a system output for next lifecycle event.
|
|
1325
1393
|
* Called directly from next() to ensure accurate timing.
|
|
@@ -1467,6 +1535,7 @@ interface RuntimeLogEntry {
|
|
|
1467
1535
|
data?: Record<string, unknown>;
|
|
1468
1536
|
}
|
|
1469
1537
|
declare class RuntimeLoggerImpl {
|
|
1538
|
+
private readonly _console;
|
|
1470
1539
|
private _enabled;
|
|
1471
1540
|
private _history;
|
|
1472
1541
|
private _maxHistory;
|
|
@@ -1501,8 +1570,19 @@ declare class RuntimeLoggerImpl {
|
|
|
1501
1570
|
* Log action execution (verbose, under a group)
|
|
1502
1571
|
*/
|
|
1503
1572
|
logAction(action: IRuntimeAction, depth: number): void;
|
|
1573
|
+
/**
|
|
1574
|
+
* General-purpose message log for runtime consumers.
|
|
1575
|
+
* Gates on _enabled; writes to the console sink and history.
|
|
1576
|
+
*/
|
|
1577
|
+
logMessage(level: LogLevel, category: string, message: string, data?: Record<string, unknown>): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* Always-on variant of `logMessage`. Use sparingly for errors/warnings that
|
|
1580
|
+
* must be visible even when debug logging is disabled.
|
|
1581
|
+
*/
|
|
1582
|
+
logAlways(level: LogLevel, category: string, message: string, data?: Record<string, unknown>): void;
|
|
1504
1583
|
private getBehaviorNames;
|
|
1505
1584
|
private summarizeObject;
|
|
1585
|
+
private styleFor;
|
|
1506
1586
|
private addToHistory;
|
|
1507
1587
|
}
|
|
1508
1588
|
declare const RuntimeLogger: RuntimeLoggerImpl;
|
|
@@ -1568,6 +1648,8 @@ declare class RuntimeMemory implements IRuntimeMemory {
|
|
|
1568
1648
|
*/
|
|
1569
1649
|
declare class RuntimeObservers {
|
|
1570
1650
|
private readonly _stackObservers;
|
|
1651
|
+
private readonly _logger?;
|
|
1652
|
+
constructor(logger?: RuntimeStackLogger);
|
|
1571
1653
|
/**
|
|
1572
1654
|
* Subscribe to stack snapshots. The collaborator does NOT emit an
|
|
1573
1655
|
* `'initial'` snapshot automatically — the calling adapter is
|
|
@@ -2231,6 +2313,15 @@ interface RepeaterConfig {
|
|
|
2231
2313
|
addCompletion?: boolean;
|
|
2232
2314
|
}
|
|
2233
2315
|
|
|
2316
|
+
/**
|
|
2317
|
+
* Constructor capture for behavior lookups. `any[]` is the TS idiom that both
|
|
2318
|
+
* accepts class constructors of any arity and infers the concrete behavior
|
|
2319
|
+
* from the argument (callers read concrete members, e.g.
|
|
2320
|
+
* ChildrenStrategy accesses `countdown.config`); `unknown[]` would lose that
|
|
2321
|
+
* inference. The storage map is keyed by `behavior.constructor`, so its key
|
|
2322
|
+
* type is simply `Function`.
|
|
2323
|
+
*/
|
|
2324
|
+
type BehaviorConstructor<T extends IRuntimeBehavior> = new (...args: any[]) => T;
|
|
2234
2325
|
declare class BlockBuilder {
|
|
2235
2326
|
private runtime;
|
|
2236
2327
|
private behaviors;
|
|
@@ -2273,7 +2364,7 @@ declare class BlockBuilder {
|
|
|
2273
2364
|
* directly — see §2.3 of docs/architectural-cleanup-tier-2-consolidations.md.
|
|
2274
2365
|
*/
|
|
2275
2366
|
private moveBehaviorLast;
|
|
2276
|
-
hasBehavior<T extends IRuntimeBehavior>(type:
|
|
2367
|
+
hasBehavior<T extends IRuntimeBehavior>(type: BehaviorConstructor<T>): boolean;
|
|
2277
2368
|
/**
|
|
2278
2369
|
* Declare the block's exit intent. Strategies call this instead of adding
|
|
2279
2370
|
* or removing ExitBehavior across each other. 'deferred' supersedes
|
|
@@ -2283,7 +2374,7 @@ declare class BlockBuilder {
|
|
|
2283
2374
|
declareExit(mode: 'immediate' | 'deferred'): BlockBuilder;
|
|
2284
2375
|
/** The declared exit intent (resolved into a single ExitBehavior in build). */
|
|
2285
2376
|
get exitMode(): 'immediate' | 'deferred' | undefined;
|
|
2286
|
-
getBehavior<T extends IRuntimeBehavior>(type:
|
|
2377
|
+
getBehavior<T extends IRuntimeBehavior>(type: BehaviorConstructor<T>): T | undefined;
|
|
2287
2378
|
setContext(context: IBlockContext): BlockBuilder;
|
|
2288
2379
|
setKey(key: BlockKey): BlockBuilder;
|
|
2289
2380
|
setLabel(label: string): BlockBuilder;
|
|
@@ -3911,7 +4002,7 @@ type BlockStatus = 'pending' | 'active' | 'running' | 'complete' | 'error';
|
|
|
3911
4002
|
type MemoryType = 'metric' | 'timer-state' | 'loop-state' | 'group-state' | 'handler' | 'span' | 'unknown';
|
|
3912
4003
|
type MemoryGrouping = 'owner' | 'type' | 'none';
|
|
3913
4004
|
interface MetricValue {
|
|
3914
|
-
value:
|
|
4005
|
+
value: unknown;
|
|
3915
4006
|
unit?: string;
|
|
3916
4007
|
formatted: string;
|
|
3917
4008
|
}
|
|
@@ -3958,7 +4049,7 @@ interface MemoryEntry {
|
|
|
3958
4049
|
ownerId: string;
|
|
3959
4050
|
ownerLabel?: string;
|
|
3960
4051
|
type: MemoryType;
|
|
3961
|
-
value:
|
|
4052
|
+
value: unknown;
|
|
3962
4053
|
valueFormatted: string;
|
|
3963
4054
|
label: string;
|
|
3964
4055
|
groupLabel?: string;
|
|
@@ -4004,9 +4095,9 @@ interface ExecutionSnapshot {
|
|
|
4004
4095
|
* Converts ScriptRuntime state to ExecutionSnapshot
|
|
4005
4096
|
*/
|
|
4006
4097
|
interface IRuntimeAdapter {
|
|
4007
|
-
createSnapshot(runtime:
|
|
4008
|
-
extractStackBlocks(runtime:
|
|
4009
|
-
extractMemoryEntries(runtime:
|
|
4098
|
+
createSnapshot(runtime: IScriptRuntime): ExecutionSnapshot;
|
|
4099
|
+
extractStackBlocks(runtime: IScriptRuntime): RuntimeStackBlock[];
|
|
4100
|
+
extractMemoryEntries(runtime: IScriptRuntime): MemoryEntry[];
|
|
4010
4101
|
groupMemoryEntries(entries: MemoryEntry[], groupBy: MemoryGrouping): Map<string, MemoryEntry[]>;
|
|
4011
4102
|
}
|
|
4012
4103
|
|
|
@@ -4375,7 +4466,7 @@ interface SegmentWithMetadata extends Segment {
|
|
|
4375
4466
|
metrics?: MetricContainer;
|
|
4376
4467
|
tags?: string[];
|
|
4377
4468
|
spanType?: string;
|
|
4378
|
-
context?: Record<string,
|
|
4469
|
+
context?: Record<string, unknown>;
|
|
4379
4470
|
}
|
|
4380
4471
|
/**
|
|
4381
4472
|
* AnalyticsTransformer - Transforms OutputStatements into UI-ready analytics data.
|
|
@@ -4423,21 +4514,16 @@ interface AnalyticsResult {
|
|
|
4423
4514
|
*/
|
|
4424
4515
|
declare function getAnalyticsFromRuntime(runtime: IScriptRuntime | null): AnalyticsResult;
|
|
4425
4516
|
/**
|
|
4426
|
-
* Derive analytics segments from a
|
|
4517
|
+
* Derive analytics segments from a statement stream.
|
|
4427
4518
|
*
|
|
4428
4519
|
* This is the **canonical read path** for all analytics derived from a
|
|
4429
|
-
* completed workout.
|
|
4430
|
-
* the
|
|
4431
|
-
*
|
|
4432
|
-
*
|
|
4433
|
-
*
|
|
4434
|
-
*
|
|
4435
|
-
*
|
|
4436
|
-
* They are NOT required for any current display feature. If they disagree
|
|
4437
|
-
* with logs, logs win. Use this function — not the analytics store — to
|
|
4438
|
-
* obtain segment data for display.
|
|
4439
|
-
*
|
|
4440
|
-
* @param outputs - StoredOutputStatement[] from WorkoutResult.data.logs
|
|
4520
|
+
* completed workout. Under V21 the statement stream is reconstructed from
|
|
4521
|
+
* the session's event rows (`eventsToStoredLogs`); the live runtime passes
|
|
4522
|
+
* its in-memory stream directly. Call this function to obtain Segment[] for
|
|
4523
|
+
* display, review grids, or trend summaries.
|
|
4524
|
+
*
|
|
4525
|
+
* @param outputs - StoredOutputStatement[] (runtime stream, or event rows
|
|
4526
|
+
* reconstructed via `eventsToStoredLogs`)
|
|
4441
4527
|
* @param workoutStartTime - Optional workout start timestamp (ms). Used to
|
|
4442
4528
|
* anchor relative timing in the segment timeline.
|
|
4443
4529
|
* @param now - Optional clock provider; defaults to wall-clock.
|
|
@@ -5125,16 +5211,82 @@ declare function computeWorkloadRollups(loads: ReadonlyMap<number, number>, thro
|
|
|
5125
5211
|
declare function toStoredOutputStatement(output: IOutputStatement | OutputStatement): StoredOutputStatement;
|
|
5126
5212
|
|
|
5127
5213
|
/**
|
|
5128
|
-
*
|
|
5129
|
-
*
|
|
5214
|
+
* Metric-line DSL parser for parser fixture files (spec: wayfinder
|
|
5215
|
+
* test-validation-harness asset 001).
|
|
5216
|
+
*
|
|
5217
|
+
* Grammar: `- <Type> <value> [@<origin>]`
|
|
5218
|
+
* - Type: PascalCase or kebab-case; canonicalized to kebab.
|
|
5219
|
+
* - Value literals: time (`5:00` → ms), number, quoted string, bare token,
|
|
5220
|
+
* amount+unit sugar (`225 lb`), object tails (`raw:V5 system:v-scale`).
|
|
5221
|
+
* - `@origin` pins the metric origin; omitted means any origin.
|
|
5222
|
+
*/
|
|
5223
|
+
type LiteralKind = 'number' | 'string' | 'amountUnit' | 'object' | 'undefined';
|
|
5224
|
+
interface MetricLine {
|
|
5225
|
+
/** Canonical kebab-case metric type. */
|
|
5226
|
+
type: string;
|
|
5227
|
+
kind: LiteralKind;
|
|
5228
|
+
/** number/string literal value. */
|
|
5229
|
+
value?: number | string;
|
|
5230
|
+
/** amountUnit sugar assertions. */
|
|
5231
|
+
amount?: number;
|
|
5232
|
+
unit?: string;
|
|
5233
|
+
/** object tails: asserted fields of an object-valued metric. */
|
|
5234
|
+
fields?: Record<string, string | number>;
|
|
5235
|
+
/** Raw line text, for diagnostics. */
|
|
5236
|
+
source: string;
|
|
5237
|
+
origin?: string;
|
|
5238
|
+
}
|
|
5239
|
+
declare class FixtureSyntaxError extends Error {
|
|
5240
|
+
constructor(message: string);
|
|
5241
|
+
}
|
|
5242
|
+
/** `ClimbSendType` → `climb-send-type`; kebab input passes through. */
|
|
5243
|
+
declare function canonicalizeType(token: string): string;
|
|
5244
|
+
/**
|
|
5245
|
+
* Parse one `- …` expectation line.
|
|
5246
|
+
* @param where file name + line for diagnostics.
|
|
5130
5247
|
*/
|
|
5131
|
-
declare
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5248
|
+
declare function parseMetricLine(line: string, file: string, lineNo: number): MetricLine;
|
|
5249
|
+
|
|
5250
|
+
/**
|
|
5251
|
+
* Semantic comparator for parser fixtures (spec: wayfinder
|
|
5252
|
+
* test-validation-harness asset 001).
|
|
5253
|
+
*
|
|
5254
|
+
* Match rules per metric line: canonical kebab type equality, literal check
|
|
5255
|
+
* (number / string / amount+unit sugar / object tails), origin pinned only
|
|
5256
|
+
* when written. Always ignored: timestamp, sourceBlockKey, image, name,
|
|
5257
|
+
* metadata, action.
|
|
5258
|
+
*
|
|
5259
|
+
* Modes: `closed` = exact multiset (extra actual metric fails);
|
|
5260
|
+
* `subset` = every expectation matches, extras pass. When an expectation
|
|
5261
|
+
* fails to match, its diff already names what the statement carries, so
|
|
5262
|
+
* leftover actuals are only reported when every expectation matched.
|
|
5263
|
+
*
|
|
5264
|
+
* Consumed by the vitest fixture catalog and the Storybook parser-test
|
|
5265
|
+
* builder/runner (`apps/storybook/src/parser-tests`).
|
|
5266
|
+
*/
|
|
5267
|
+
|
|
5268
|
+
type MatchMode = 'closed' | 'subset';
|
|
5269
|
+
/** Render an actual metric in DSL-like form for readable diagnostics. */
|
|
5270
|
+
declare function renderMetric(m: IMetric): string;
|
|
5271
|
+
/**
|
|
5272
|
+
* Structured one-statement diff: which expectations matched which actual
|
|
5273
|
+
* metrics, which expectations found no match, and which actual metrics
|
|
5274
|
+
* remain unmatched (extras — failures only in `closed` mode).
|
|
5275
|
+
*/
|
|
5276
|
+
interface StatementMetricDiff {
|
|
5277
|
+
matched: Array<{
|
|
5278
|
+
expected: MetricLine;
|
|
5279
|
+
actual: IMetric;
|
|
5280
|
+
}>;
|
|
5281
|
+
missingExpected: MetricLine[];
|
|
5282
|
+
extraActual: IMetric[];
|
|
5283
|
+
}
|
|
5284
|
+
/** Pair expectations against actual metrics (greedy first-match consumption). */
|
|
5285
|
+
declare function diffStatement(expected: MetricLine[], actual: readonly IMetric[]): StatementMetricDiff;
|
|
5286
|
+
/**
|
|
5287
|
+
* Compare one statement's expectations against its actual metrics.
|
|
5288
|
+
* Returns human-readable diffs (empty = pass).
|
|
5289
|
+
*/
|
|
5290
|
+
declare function compareStatement(expectations: MetricLine[], actual: readonly IMetric[], mode: MatchMode): string[];
|
|
5139
5291
|
|
|
5140
|
-
export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer,
|
|
5292
|
+
export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, type CalculationDefinition$1 as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcEvalError, type CalcLine, type CalcNode, type CalcOrigin, CalcParseError, CalcRegistrationError, type CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, type CalcVariant, type CalculationDefinition as CalculateBlockDefinition, type CalculateBlockParseError, type CalculateBlockParseResult, CalculateBlockProcessor, type CalculationDefinition$1 as CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, CompositeEffortRegistry, type CompositeEffortRegistryOptions, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, type DayRollup, DialectStack, type DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, type ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, type ParseOptions, PlaySoundAction, PopBlockAction, type PredefinedSoundName, ProjectionResult, type PromotionRule, type PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, type SoundBehaviorConfig, type SoundCue, SoundCueBehavior, type SoundCueConfig, type SoundCueState, type SoundState, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addAliasToEffort, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, dimEquals, evaluate, evaluateCalculateDefinitions, extractEffortData, extractMetrics, extractStatements, extractStatementsRaw, extractSyntaxFacts, findBestFuzzyMatch, findUnresolvedChoices, fixtureBackSquat, fixtureBurpee, fixturePlank, fixtureRowing, fixtureRunning, fixtureUserCustom, fixtureUserOverride, formatDim, formatDuration, metricsToLabel as fragmentsToLabel, fullFixtureSet, fuseUnits, fuseUnitsInMetrics, getAnalyticsFromLogs, getAnalyticsFromRuntime, getHints, getUnit, hasHint, hintMetric, hintsToContainer, inferDim, isCastSubscription, isChoiceResolved, isDimensionless, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, mutateTimerSpans, normalizeForFuzzy, num, openSpan, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
|