@bitcobblers/wod-wiki-lang 0.48.2171 → 0.48.2173
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-CqyFh_Jd.d.cts → browserRuntimeNow-DUJFkpUq.d.cts} +33 -21
- package/dist/{browserRuntimeNow-CqyFh_Jd.d.ts → browserRuntimeNow-DUJFkpUq.d.ts} +33 -21
- package/dist/index.cjs +151 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.mjs +151 -45
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +2 -2
|
@@ -800,6 +800,13 @@ declare function compoundName(d: DimVector): string | undefined;
|
|
|
800
800
|
|
|
801
801
|
type CalcOrigin = 'analyzed' | 'analyzed-estimated' | 'user';
|
|
802
802
|
type CalcScope = 'segment' | 'workout' | 'store';
|
|
803
|
+
/** A note summary that failed registration — surfaced, never silently dropped. */
|
|
804
|
+
interface CalcRegistrationDiagnostic {
|
|
805
|
+
/** The summary calc id that failed to register. */
|
|
806
|
+
id: string;
|
|
807
|
+
/** Why it was skipped (the registration error message). */
|
|
808
|
+
message: string;
|
|
809
|
+
}
|
|
803
810
|
interface CalcNode {
|
|
804
811
|
id: string;
|
|
805
812
|
kind: 'metric' | 'lookup' | 'builtin' | 'wql' | 'expr';
|
|
@@ -994,6 +1001,8 @@ interface ShakeOutQueueOptions {
|
|
|
994
1001
|
readonly sources: readonly PropertyRuleInput[];
|
|
995
1002
|
readonly lookups?: LookupRegistry;
|
|
996
1003
|
readonly lastEffortSlug?: string;
|
|
1004
|
+
/** Structural outputs may evaluate rules without surfacing diagnostics. */
|
|
1005
|
+
readonly emitDiagnostics?: boolean;
|
|
997
1006
|
}
|
|
998
1007
|
/**
|
|
999
1008
|
* Extract `metrics:` and `summaries:` maps from a parsed frontmatter record
|
|
@@ -1006,12 +1015,13 @@ declare function extractPropertyRulesFromMeta(meta: Readonly<Record<string, unkn
|
|
|
1006
1015
|
* `summaries.<key>` contributions on tags (including nested tags).
|
|
1007
1016
|
*/
|
|
1008
1017
|
declare function extractTagPropertyRules(tags: TagIndex | undefined, slugs: readonly string[]): PropertyRuleInput[];
|
|
1009
|
-
/**
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1018
|
+
/** Compiled note summaries plus the unresolved dependencies found while compiling. */
|
|
1019
|
+
interface CompiledPropertySummaries {
|
|
1020
|
+
defs: CalculationDefinition[];
|
|
1021
|
+
diagnostics: CalcRegistrationDiagnostic[];
|
|
1022
|
+
}
|
|
1014
1023
|
declare function compilePropertySummaryCalcs(sources: readonly PropertyRuleInput[]): CalculationDefinition[];
|
|
1024
|
+
declare function compilePropertySummaryCalcsWithDiagnostics(sources: readonly PropertyRuleInput[]): CompiledPropertySummaries;
|
|
1015
1025
|
/**
|
|
1016
1026
|
* Run the two-stage Metric Shake-Out Queue on a statement's MetricContainer.
|
|
1017
1027
|
*/
|
|
@@ -1541,6 +1551,21 @@ interface IBlockRef {
|
|
|
1541
1551
|
markComplete(reason?: string): void;
|
|
1542
1552
|
}
|
|
1543
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
* INowProvider — the only seam for "what time is it" in the runtime.
|
|
1556
|
+
* Events, actions, and behaviors that need a timestamp take a now-fn
|
|
1557
|
+
* in their constructor; the runtime passes its single provider down.
|
|
1558
|
+
* Tests pass a frozen clock so the timeline is deterministic.
|
|
1559
|
+
*/
|
|
1560
|
+
interface INowProvider {
|
|
1561
|
+
now(): Date;
|
|
1562
|
+
nowMs(): number;
|
|
1563
|
+
}
|
|
1564
|
+
/** Default provider: reads wall clock. */
|
|
1565
|
+
declare const wallClockNow: INowProvider;
|
|
1566
|
+
/** A provider that always returns the same Date (for tests). */
|
|
1567
|
+
declare function frozenNow(at: Date): INowProvider;
|
|
1568
|
+
|
|
1544
1569
|
/**
|
|
1545
1570
|
* TimeSpan represents a discrete segment of a block's **Time** — a single
|
|
1546
1571
|
* start/stop recording within the spans collection.
|
|
@@ -1580,21 +1605,6 @@ declare class TimeSpan implements TimeSpan$1 {
|
|
|
1580
1605
|
get endDate(): Date | undefined;
|
|
1581
1606
|
}
|
|
1582
1607
|
|
|
1583
|
-
/**
|
|
1584
|
-
* INowProvider — the only seam for "what time is it" in the runtime.
|
|
1585
|
-
* Events, actions, and behaviors that need a timestamp take a now-fn
|
|
1586
|
-
* in their constructor; the runtime passes its single provider down.
|
|
1587
|
-
* Tests pass a frozen clock so the timeline is deterministic.
|
|
1588
|
-
*/
|
|
1589
|
-
interface INowProvider {
|
|
1590
|
-
now(): Date;
|
|
1591
|
-
nowMs(): number;
|
|
1592
|
-
}
|
|
1593
|
-
/** Default provider: reads wall clock. */
|
|
1594
|
-
declare const wallClockNow: INowProvider;
|
|
1595
|
-
/** A provider that always returns the same Date (for tests). */
|
|
1596
|
-
declare function frozenNow(at: Date): INowProvider;
|
|
1597
|
-
|
|
1598
1608
|
/**
|
|
1599
1609
|
* IRuntimeClock provides time tracking for the runtime.
|
|
1600
1610
|
*
|
|
@@ -1877,6 +1887,8 @@ interface IBehaviorContext {
|
|
|
1877
1887
|
readonly block: IBlockRef;
|
|
1878
1888
|
/** Current runtime clock */
|
|
1879
1889
|
readonly clock: IRuntimeClock;
|
|
1890
|
+
/** Live wall-clock provider, independent of execution snapshots. */
|
|
1891
|
+
readonly nowProvider: INowProvider;
|
|
1880
1892
|
/**
|
|
1881
1893
|
* Current stack level (depth) of the block.
|
|
1882
1894
|
* 0 = root block, 1 = first child, etc.
|
|
@@ -2991,4 +3003,4 @@ declare function getRuntimeNowMs(): number;
|
|
|
2991
3003
|
/** Creates an INowProvider that reads the browser sender-clock when available. */
|
|
2992
3004
|
declare function createBrowserRuntimeNow(): INowProvider;
|
|
2993
3005
|
|
|
2994
|
-
export { type SoundProfile as $, type AnalyticsContext as A, type BehaviorEventType as B, type IMemoryLocation as C, type IRuntimeBehavior as D, type EffortResolverOptions as E, type IBlockContext as F, type MetricVisibility as G, type BlockLifecycleOptions as H, type IEquipment as I, type CompletionDecision as J, type IRuntimeMemory as K, TypedMemoryReference as L, type MemoryTag as M, type MemorySearchCriteria as N, type OutputListener as O, type IMemoryReference as P, type RuntimeStackLogger as Q, type ReferenceIndex as R, type SubscribeOptions as S, TimeSpan as T, type Unsubscribe as U, type StackObserver as V, WhiteboardScript as W, type StackSnapshot as X, type StackListener as Y, MemoryTypeEnum as Z, type IAnchorValue as _, type ReferenceResolutionDefaults as a, type
|
|
3006
|
+
export { type SoundProfile as $, type AnalyticsContext as A, type BehaviorEventType as B, type IMemoryLocation as C, type IRuntimeBehavior as D, type EffortResolverOptions as E, type IBlockContext as F, type MetricVisibility as G, type BlockLifecycleOptions as H, type IEquipment as I, type CompletionDecision as J, type IRuntimeMemory as K, TypedMemoryReference as L, type MemoryTag as M, type MemorySearchCriteria as N, type OutputListener as O, type IMemoryReference as P, type RuntimeStackLogger as Q, type ReferenceIndex as R, type SubscribeOptions as S, TimeSpan as T, type Unsubscribe as U, type StackObserver as V, WhiteboardScript as W, type StackSnapshot as X, type StackListener as Y, MemoryTypeEnum as Z, type IAnchorValue as _, type ReferenceResolutionDefaults as a, type MemoryType as a$, type ButtonConfig as a0, type IEventHandler as a1, type HandlerScope as a2, type IScriptRuntime as a3, type TestableBlockConfig as a4, type IRuntimeOptions as a5, ScriptRuntime as a6, type EventHandlerOptions as a7, type EventCallback as a8, type TimerState as a9, DIM_COUNT as aA, DIM_ENERGY as aB, DIM_LENGTH as aC, DIM_MASS as aD, DIM_TIME as aE, DIM_ZERO as aF, DISCIPLINE_FACTORS as aG, type DisplayState as aH, EFFORT_DISCIPLINES as aI, EFFORT_REGISTRY_ORIGINS as aJ, type EffortBaseAttributes as aK, type EffortDerivation as aL, type EffortDiscipline as aM, type EffortMaterializer as aN, type EffortResolvedFrom as aO, type EvalContext as aP, type FenceDialect as aQ, type FragmentDisplayState as aR, type FragmentState as aS, type IAnalyticsProcessorDescriptor as aT, INTENSITY_TIERS as aU, type IScript as aV, type IntensityTier as aW, type InterceptMode as aX, type LookupFieldDef as aY, type LookupLayer as aZ, MemoryLocation as a_, type CalculationDefinition as aa, type PropertyRuleInput as ab, type IRealtimeProcessor as ac, type ISummaryProcessor as ad, type DimVector as ae, type CalcLine as af, type ExprNode as ag, type CalcScope as ah, type ILookupTable as ai, LookupRegistry as aj, type CalcRegistrationDiagnostic as ak, type ProjectionResult as al, ABSENT as am, type BinaryOp as an, type ButtonVariant as ao, type ButtonsState as ap, CalcEvalError as aq, type CalcNode as ar, type CalcOrigin as as, type CalcVariant as at, type ChildrenStatusState as au, type CompiledPropertySummaries as av, type CompletionState as aw, DEFAULT_RESOLVER_OPTIONS as ax, DEFAULT_RUNTIME_OPTIONS as ay, DEFAULT_SOUND_PROFILE as az, type IEffort as b, type MemoryTypeMap as b0, type MemoryValueOf as b1, NAMED_COMPOUNDS as b2, type PropertySourceLayer as b3, type ReferenceCatalog as b4, type ResolvedReferences as b5, type RoundState as b6, type RuntimeState as b7, SEED_PRECEDENCE_RANK as b8, type ScriptRuntimeDependencies as b9, formatDim as bA, formatSoundTrigger as bB, frozenNow as bC, getMetricVisibility as bD, getRuntimeNowMs as bE, isDimensionless as bF, isEffortDiscipline as bG, isFragmentTag as bH, num as bI, parseSoundTrigger as bJ, resolveEntityRank as bK, resolveEntityTier as bL, resolveProfileRules as bM, resolveSourceRank as bN, resolveSourceTier as bO, runMetricShakeOutQueue as bP, slugifyRefLabel as bQ, str as bR, subDim as bS, truthy as bT, wallClockNow as bU, type SeedPrecedenceTier as ba, type ShakeOutQueueOptions as bb, type ShakeOutResult as bc, type SkippedDependencyDiagnostic as bd, type SoundRule as be, type SoundTriggerAnchor as bf, type SoundTriggerPoint as bg, type StackEvent as bh, type TimerDirection as bi, VISIBILITY_ICONS as bj, VISIBILITY_LABELS as bk, type Val as bl, addDim as bm, compilePropertySummaryCalcs as bn, compilePropertySummaryCalcsWithDiagnostics as bo, compoundName as bp, createBrowserRuntimeNow as bq, createReferenceIndex as br, dedupeEntitiesByPrecedence as bs, dimEquals as bt, disciplineFactorFor as bu, evaluate as bv, extractPropertyRulesFromMeta as bw, extractStatementRefs as bx, extractTagPropertyRules as by, filterTagsByVisibility as bz, type IEffortResolver as c, type IEffortRegistry as d, type EffortResolutionOptions as e, type ResolvedEffort as f, type EffortRegistrySource as g, type IEquipmentRegistry as h, type EquipmentStorageAdapter as i, type EffortStorageAdapter as j, type IRuntimeActionable as k, type IEventBus as l, type IRuntimeStack as m, type IRuntimeClock as n, type IJitCompiler as o, type INowProvider as p, type RuntimeStackOptions as q, type RuntimeError as r, type IEvent as s, type IRuntimeAction as t, type IAnalyticsEngine as u, type IRuntimeBlock as v, type IBehaviorContext as w, type BehaviorEventListener as x, type Unsubscribe$1 as y, type OutputOptions as z };
|
|
@@ -800,6 +800,13 @@ declare function compoundName(d: DimVector): string | undefined;
|
|
|
800
800
|
|
|
801
801
|
type CalcOrigin = 'analyzed' | 'analyzed-estimated' | 'user';
|
|
802
802
|
type CalcScope = 'segment' | 'workout' | 'store';
|
|
803
|
+
/** A note summary that failed registration — surfaced, never silently dropped. */
|
|
804
|
+
interface CalcRegistrationDiagnostic {
|
|
805
|
+
/** The summary calc id that failed to register. */
|
|
806
|
+
id: string;
|
|
807
|
+
/** Why it was skipped (the registration error message). */
|
|
808
|
+
message: string;
|
|
809
|
+
}
|
|
803
810
|
interface CalcNode {
|
|
804
811
|
id: string;
|
|
805
812
|
kind: 'metric' | 'lookup' | 'builtin' | 'wql' | 'expr';
|
|
@@ -994,6 +1001,8 @@ interface ShakeOutQueueOptions {
|
|
|
994
1001
|
readonly sources: readonly PropertyRuleInput[];
|
|
995
1002
|
readonly lookups?: LookupRegistry;
|
|
996
1003
|
readonly lastEffortSlug?: string;
|
|
1004
|
+
/** Structural outputs may evaluate rules without surfacing diagnostics. */
|
|
1005
|
+
readonly emitDiagnostics?: boolean;
|
|
997
1006
|
}
|
|
998
1007
|
/**
|
|
999
1008
|
* Extract `metrics:` and `summaries:` maps from a parsed frontmatter record
|
|
@@ -1006,12 +1015,13 @@ declare function extractPropertyRulesFromMeta(meta: Readonly<Record<string, unkn
|
|
|
1006
1015
|
* `summaries.<key>` contributions on tags (including nested tags).
|
|
1007
1016
|
*/
|
|
1008
1017
|
declare function extractTagPropertyRules(tags: TagIndex | undefined, slugs: readonly string[]): PropertyRuleInput[];
|
|
1009
|
-
/**
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1018
|
+
/** Compiled note summaries plus the unresolved dependencies found while compiling. */
|
|
1019
|
+
interface CompiledPropertySummaries {
|
|
1020
|
+
defs: CalculationDefinition[];
|
|
1021
|
+
diagnostics: CalcRegistrationDiagnostic[];
|
|
1022
|
+
}
|
|
1014
1023
|
declare function compilePropertySummaryCalcs(sources: readonly PropertyRuleInput[]): CalculationDefinition[];
|
|
1024
|
+
declare function compilePropertySummaryCalcsWithDiagnostics(sources: readonly PropertyRuleInput[]): CompiledPropertySummaries;
|
|
1015
1025
|
/**
|
|
1016
1026
|
* Run the two-stage Metric Shake-Out Queue on a statement's MetricContainer.
|
|
1017
1027
|
*/
|
|
@@ -1541,6 +1551,21 @@ interface IBlockRef {
|
|
|
1541
1551
|
markComplete(reason?: string): void;
|
|
1542
1552
|
}
|
|
1543
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
* INowProvider — the only seam for "what time is it" in the runtime.
|
|
1556
|
+
* Events, actions, and behaviors that need a timestamp take a now-fn
|
|
1557
|
+
* in their constructor; the runtime passes its single provider down.
|
|
1558
|
+
* Tests pass a frozen clock so the timeline is deterministic.
|
|
1559
|
+
*/
|
|
1560
|
+
interface INowProvider {
|
|
1561
|
+
now(): Date;
|
|
1562
|
+
nowMs(): number;
|
|
1563
|
+
}
|
|
1564
|
+
/** Default provider: reads wall clock. */
|
|
1565
|
+
declare const wallClockNow: INowProvider;
|
|
1566
|
+
/** A provider that always returns the same Date (for tests). */
|
|
1567
|
+
declare function frozenNow(at: Date): INowProvider;
|
|
1568
|
+
|
|
1544
1569
|
/**
|
|
1545
1570
|
* TimeSpan represents a discrete segment of a block's **Time** — a single
|
|
1546
1571
|
* start/stop recording within the spans collection.
|
|
@@ -1580,21 +1605,6 @@ declare class TimeSpan implements TimeSpan$1 {
|
|
|
1580
1605
|
get endDate(): Date | undefined;
|
|
1581
1606
|
}
|
|
1582
1607
|
|
|
1583
|
-
/**
|
|
1584
|
-
* INowProvider — the only seam for "what time is it" in the runtime.
|
|
1585
|
-
* Events, actions, and behaviors that need a timestamp take a now-fn
|
|
1586
|
-
* in their constructor; the runtime passes its single provider down.
|
|
1587
|
-
* Tests pass a frozen clock so the timeline is deterministic.
|
|
1588
|
-
*/
|
|
1589
|
-
interface INowProvider {
|
|
1590
|
-
now(): Date;
|
|
1591
|
-
nowMs(): number;
|
|
1592
|
-
}
|
|
1593
|
-
/** Default provider: reads wall clock. */
|
|
1594
|
-
declare const wallClockNow: INowProvider;
|
|
1595
|
-
/** A provider that always returns the same Date (for tests). */
|
|
1596
|
-
declare function frozenNow(at: Date): INowProvider;
|
|
1597
|
-
|
|
1598
1608
|
/**
|
|
1599
1609
|
* IRuntimeClock provides time tracking for the runtime.
|
|
1600
1610
|
*
|
|
@@ -1877,6 +1887,8 @@ interface IBehaviorContext {
|
|
|
1877
1887
|
readonly block: IBlockRef;
|
|
1878
1888
|
/** Current runtime clock */
|
|
1879
1889
|
readonly clock: IRuntimeClock;
|
|
1890
|
+
/** Live wall-clock provider, independent of execution snapshots. */
|
|
1891
|
+
readonly nowProvider: INowProvider;
|
|
1880
1892
|
/**
|
|
1881
1893
|
* Current stack level (depth) of the block.
|
|
1882
1894
|
* 0 = root block, 1 = first child, etc.
|
|
@@ -2991,4 +3003,4 @@ declare function getRuntimeNowMs(): number;
|
|
|
2991
3003
|
/** Creates an INowProvider that reads the browser sender-clock when available. */
|
|
2992
3004
|
declare function createBrowserRuntimeNow(): INowProvider;
|
|
2993
3005
|
|
|
2994
|
-
export { type SoundProfile as $, type AnalyticsContext as A, type BehaviorEventType as B, type IMemoryLocation as C, type IRuntimeBehavior as D, type EffortResolverOptions as E, type IBlockContext as F, type MetricVisibility as G, type BlockLifecycleOptions as H, type IEquipment as I, type CompletionDecision as J, type IRuntimeMemory as K, TypedMemoryReference as L, type MemoryTag as M, type MemorySearchCriteria as N, type OutputListener as O, type IMemoryReference as P, type RuntimeStackLogger as Q, type ReferenceIndex as R, type SubscribeOptions as S, TimeSpan as T, type Unsubscribe as U, type StackObserver as V, WhiteboardScript as W, type StackSnapshot as X, type StackListener as Y, MemoryTypeEnum as Z, type IAnchorValue as _, type ReferenceResolutionDefaults as a, type
|
|
3006
|
+
export { type SoundProfile as $, type AnalyticsContext as A, type BehaviorEventType as B, type IMemoryLocation as C, type IRuntimeBehavior as D, type EffortResolverOptions as E, type IBlockContext as F, type MetricVisibility as G, type BlockLifecycleOptions as H, type IEquipment as I, type CompletionDecision as J, type IRuntimeMemory as K, TypedMemoryReference as L, type MemoryTag as M, type MemorySearchCriteria as N, type OutputListener as O, type IMemoryReference as P, type RuntimeStackLogger as Q, type ReferenceIndex as R, type SubscribeOptions as S, TimeSpan as T, type Unsubscribe as U, type StackObserver as V, WhiteboardScript as W, type StackSnapshot as X, type StackListener as Y, MemoryTypeEnum as Z, type IAnchorValue as _, type ReferenceResolutionDefaults as a, type MemoryType as a$, type ButtonConfig as a0, type IEventHandler as a1, type HandlerScope as a2, type IScriptRuntime as a3, type TestableBlockConfig as a4, type IRuntimeOptions as a5, ScriptRuntime as a6, type EventHandlerOptions as a7, type EventCallback as a8, type TimerState as a9, DIM_COUNT as aA, DIM_ENERGY as aB, DIM_LENGTH as aC, DIM_MASS as aD, DIM_TIME as aE, DIM_ZERO as aF, DISCIPLINE_FACTORS as aG, type DisplayState as aH, EFFORT_DISCIPLINES as aI, EFFORT_REGISTRY_ORIGINS as aJ, type EffortBaseAttributes as aK, type EffortDerivation as aL, type EffortDiscipline as aM, type EffortMaterializer as aN, type EffortResolvedFrom as aO, type EvalContext as aP, type FenceDialect as aQ, type FragmentDisplayState as aR, type FragmentState as aS, type IAnalyticsProcessorDescriptor as aT, INTENSITY_TIERS as aU, type IScript as aV, type IntensityTier as aW, type InterceptMode as aX, type LookupFieldDef as aY, type LookupLayer as aZ, MemoryLocation as a_, type CalculationDefinition as aa, type PropertyRuleInput as ab, type IRealtimeProcessor as ac, type ISummaryProcessor as ad, type DimVector as ae, type CalcLine as af, type ExprNode as ag, type CalcScope as ah, type ILookupTable as ai, LookupRegistry as aj, type CalcRegistrationDiagnostic as ak, type ProjectionResult as al, ABSENT as am, type BinaryOp as an, type ButtonVariant as ao, type ButtonsState as ap, CalcEvalError as aq, type CalcNode as ar, type CalcOrigin as as, type CalcVariant as at, type ChildrenStatusState as au, type CompiledPropertySummaries as av, type CompletionState as aw, DEFAULT_RESOLVER_OPTIONS as ax, DEFAULT_RUNTIME_OPTIONS as ay, DEFAULT_SOUND_PROFILE as az, type IEffort as b, type MemoryTypeMap as b0, type MemoryValueOf as b1, NAMED_COMPOUNDS as b2, type PropertySourceLayer as b3, type ReferenceCatalog as b4, type ResolvedReferences as b5, type RoundState as b6, type RuntimeState as b7, SEED_PRECEDENCE_RANK as b8, type ScriptRuntimeDependencies as b9, formatDim as bA, formatSoundTrigger as bB, frozenNow as bC, getMetricVisibility as bD, getRuntimeNowMs as bE, isDimensionless as bF, isEffortDiscipline as bG, isFragmentTag as bH, num as bI, parseSoundTrigger as bJ, resolveEntityRank as bK, resolveEntityTier as bL, resolveProfileRules as bM, resolveSourceRank as bN, resolveSourceTier as bO, runMetricShakeOutQueue as bP, slugifyRefLabel as bQ, str as bR, subDim as bS, truthy as bT, wallClockNow as bU, type SeedPrecedenceTier as ba, type ShakeOutQueueOptions as bb, type ShakeOutResult as bc, type SkippedDependencyDiagnostic as bd, type SoundRule as be, type SoundTriggerAnchor as bf, type SoundTriggerPoint as bg, type StackEvent as bh, type TimerDirection as bi, VISIBILITY_ICONS as bj, VISIBILITY_LABELS as bk, type Val as bl, addDim as bm, compilePropertySummaryCalcs as bn, compilePropertySummaryCalcsWithDiagnostics as bo, compoundName as bp, createBrowserRuntimeNow as bq, createReferenceIndex as br, dedupeEntitiesByPrecedence as bs, dimEquals as bt, disciplineFactorFor as bu, evaluate as bv, extractPropertyRulesFromMeta as bw, extractStatementRefs as bx, extractTagPropertyRules as by, filterTagsByVisibility as bz, type IEffortResolver as c, type IEffortRegistry as d, type EffortResolutionOptions as e, type ResolvedEffort as f, type EffortRegistrySource as g, type IEquipmentRegistry as h, type EquipmentStorageAdapter as i, type EffortStorageAdapter as j, type IRuntimeActionable as k, type IEventBus as l, type IRuntimeStack as m, type IRuntimeClock as n, type IJitCompiler as o, type INowProvider as p, type RuntimeStackOptions as q, type RuntimeError as r, type IEvent as s, type IRuntimeAction as t, type IAnalyticsEngine as u, type IRuntimeBlock as v, type IBehaviorContext as w, type BehaviorEventListener as x, type Unsubscribe$1 as y, type OutputOptions as z };
|
package/dist/index.cjs
CHANGED
|
@@ -4609,7 +4609,7 @@ function tagToDocument(tag) {
|
|
|
4609
4609
|
lines.push(`# ${tag.label}`);
|
|
4610
4610
|
lines.push("");
|
|
4611
4611
|
lines.push("```query");
|
|
4612
|
-
lines.push(
|
|
4612
|
+
lines.push(`:note{${filterExpr}}`);
|
|
4613
4613
|
lines.push("```");
|
|
4614
4614
|
}
|
|
4615
4615
|
return lines.join("\n");
|
|
@@ -7115,6 +7115,9 @@ var BehaviorContext = class {
|
|
|
7115
7115
|
* capabilities.
|
|
7116
7116
|
*/
|
|
7117
7117
|
_capabilities;
|
|
7118
|
+
get nowProvider() {
|
|
7119
|
+
return this.runtime.nowProvider;
|
|
7120
|
+
}
|
|
7118
7121
|
// ============================================================================
|
|
7119
7122
|
// Event Subscription
|
|
7120
7123
|
// ============================================================================
|
|
@@ -8018,15 +8021,10 @@ var CountdownTimerBehavior = class {
|
|
|
8018
8021
|
}
|
|
8019
8022
|
this.subscriptions.push(
|
|
8020
8023
|
ctx.subscribe("tick", (_event, tickCtx) => {
|
|
8021
|
-
const timer = readTimer(tickCtx);
|
|
8022
|
-
if (!timer || timer.direction !== "down" || timer.durationMs === void 0) {
|
|
8023
|
-
return [];
|
|
8024
|
-
}
|
|
8025
8024
|
if (mode === "complete-block" && tickCtx.block.isComplete) {
|
|
8026
8025
|
return [];
|
|
8027
8026
|
}
|
|
8028
|
-
|
|
8029
|
-
if (elapsed < timer.durationMs) return [];
|
|
8027
|
+
if (!this.hasExpired(tickCtx)) return [];
|
|
8030
8028
|
this.handleExpiry(tickCtx, mode);
|
|
8031
8029
|
return [new ClearChildrenAction(tickCtx.block.key.toString())];
|
|
8032
8030
|
}, { scope: "bubble" })
|
|
@@ -8055,6 +8053,10 @@ var CountdownTimerBehavior = class {
|
|
|
8055
8053
|
return [];
|
|
8056
8054
|
}
|
|
8057
8055
|
onNext(ctx) {
|
|
8056
|
+
if ((this.config.mode ?? "complete-block") === "complete-block" && !ctx.block.isComplete && this.hasExpired(ctx)) {
|
|
8057
|
+
ctx.markComplete("timer-expired");
|
|
8058
|
+
return [new PopBlockAction(), new ClearChildrenAction(ctx.block.key.toString())];
|
|
8059
|
+
}
|
|
8058
8060
|
if (this.config.required && !ctx.block.isComplete) {
|
|
8059
8061
|
ctx.emitEvent({
|
|
8060
8062
|
name: "timer:skip-attempt",
|
|
@@ -8126,6 +8128,18 @@ var CountdownTimerBehavior = class {
|
|
|
8126
8128
|
}
|
|
8127
8129
|
}
|
|
8128
8130
|
}
|
|
8131
|
+
/**
|
|
8132
|
+
* True when the countdown has fully elapsed against the context's clock.
|
|
8133
|
+
* Single definition of "expired" shared by the tick subscription and the
|
|
8134
|
+
* Next-time reconcile, so display (spans) and runtime cannot diverge.
|
|
8135
|
+
*/
|
|
8136
|
+
hasExpired(ctx) {
|
|
8137
|
+
const timer = readTimer(ctx);
|
|
8138
|
+
if (!timer || timer.direction !== "down" || timer.durationMs === void 0) {
|
|
8139
|
+
return false;
|
|
8140
|
+
}
|
|
8141
|
+
return calculateElapsed(timer, ctx.nowProvider.nowMs()) >= timer.durationMs;
|
|
8142
|
+
}
|
|
8129
8143
|
getRemainingCountdownMs(ctx) {
|
|
8130
8144
|
const timer = readTimer(ctx);
|
|
8131
8145
|
if (!timer || timer.direction !== "down" || !timer.durationMs) {
|
|
@@ -8677,7 +8691,11 @@ var CalcUnitError = class extends Error {
|
|
|
8677
8691
|
}
|
|
8678
8692
|
};
|
|
8679
8693
|
function composeMulUnit(a, aDim, b, bDim, resultDim) {
|
|
8680
|
-
if (dimEquals(resultDim, DIM_ZERO))
|
|
8694
|
+
if (dimEquals(resultDim, DIM_ZERO)) {
|
|
8695
|
+
if (a && !b) return a;
|
|
8696
|
+
if (b && !a) return b;
|
|
8697
|
+
return dimEquals(aDim, bDim) ? a ?? b : void 0;
|
|
8698
|
+
}
|
|
8681
8699
|
const parts = [];
|
|
8682
8700
|
for (const [u, d] of [[a, aDim], [b, bDim]]) {
|
|
8683
8701
|
if (!u || dimEquals(d, DIM_ZERO)) continue;
|
|
@@ -9676,34 +9694,51 @@ function extractTagPropertyRules(tags2, slugs) {
|
|
|
9676
9694
|
for (const slug of slugs) {
|
|
9677
9695
|
const resolved = resolveTagContributions(tags2, slug);
|
|
9678
9696
|
if (resolved.metrics.length === 0) continue;
|
|
9679
|
-
const
|
|
9680
|
-
const
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9697
|
+
const tagMetrics = {};
|
|
9698
|
+
const tagSummaries = {};
|
|
9699
|
+
const categoryMetrics = {};
|
|
9700
|
+
const categorySummaries = {};
|
|
9701
|
+
for (const involvedSlug of resolved.tags) {
|
|
9702
|
+
const definition = tags2.resolve(involvedSlug);
|
|
9703
|
+
if (!definition) continue;
|
|
9704
|
+
const metrics = definition.isCategory ? categoryMetrics : tagMetrics;
|
|
9705
|
+
const summaries = definition.isCategory ? categorySummaries : tagSummaries;
|
|
9706
|
+
for (const m of definition.contributions) {
|
|
9707
|
+
if (m.kind !== "metric") continue;
|
|
9708
|
+
const key = m.type.trim();
|
|
9709
|
+
if (!key) continue;
|
|
9710
|
+
if (key.startsWith("summaries.")) {
|
|
9711
|
+
const subKey = key.slice("summaries.".length).trim();
|
|
9712
|
+
if (subKey && !(subKey in summaries)) {
|
|
9713
|
+
summaries[subKey] = String(m.value);
|
|
9714
|
+
}
|
|
9715
|
+
} else if (!(key in metrics)) {
|
|
9716
|
+
metrics[key] = m.unit ? `${String(m.value)} ${m.unit}` : m.value === null || typeof m.value === "boolean" ? String(m.value) : m.value;
|
|
9688
9717
|
}
|
|
9689
|
-
} else if (!(key in metrics)) {
|
|
9690
|
-
metrics[key] = m.unit ? `${String(m.value)} ${m.unit}` : m.value === null || typeof m.value === "boolean" ? String(m.value) : m.value;
|
|
9691
9718
|
}
|
|
9692
9719
|
}
|
|
9693
|
-
if (Object.keys(
|
|
9694
|
-
rules.push({
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
summaries
|
|
9699
|
-
});
|
|
9720
|
+
if (Object.keys(tagMetrics).length > 0 || Object.keys(tagSummaries).length > 0) {
|
|
9721
|
+
rules.push({ layer: "tag", sourceSlug: slug, metrics: tagMetrics, summaries: tagSummaries });
|
|
9722
|
+
}
|
|
9723
|
+
if (Object.keys(categoryMetrics).length > 0 || Object.keys(categorySummaries).length > 0) {
|
|
9724
|
+
rules.push({ layer: "category", sourceSlug: slug, metrics: categoryMetrics, summaries: categorySummaries });
|
|
9700
9725
|
}
|
|
9701
9726
|
}
|
|
9702
9727
|
return rules;
|
|
9703
9728
|
}
|
|
9729
|
+
var SUMMARY_LAYER_PRECEDENCE = {
|
|
9730
|
+
note: 6,
|
|
9731
|
+
tag: 5,
|
|
9732
|
+
effort: 4,
|
|
9733
|
+
equipment: 3,
|
|
9734
|
+
category: 1
|
|
9735
|
+
};
|
|
9704
9736
|
function compilePropertySummaryCalcs(sources) {
|
|
9737
|
+
return compilePropertySummaryCalcsWithDiagnostics(sources).defs;
|
|
9738
|
+
}
|
|
9739
|
+
function compilePropertySummaryCalcsWithDiagnostics(sources) {
|
|
9705
9740
|
const ordered = [...sources].sort(
|
|
9706
|
-
(a, b) =>
|
|
9741
|
+
(a, b) => SUMMARY_LAYER_PRECEDENCE[b.layer] - SUMMARY_LAYER_PRECEDENCE[a.layer]
|
|
9707
9742
|
);
|
|
9708
9743
|
const chosen = /* @__PURE__ */ new Map();
|
|
9709
9744
|
for (const source of ordered) {
|
|
@@ -9728,6 +9763,19 @@ function compilePropertySummaryCalcs(sources) {
|
|
|
9728
9763
|
}
|
|
9729
9764
|
}
|
|
9730
9765
|
}
|
|
9766
|
+
const diagnostics = [];
|
|
9767
|
+
for (const [key, expr2] of chosen) {
|
|
9768
|
+
try {
|
|
9769
|
+
const missing = [...collectRequiredRefs(parseCalcLine(`summary = ${expr2}`).expr)].filter((ref) => !customAtomsMap.has(ref) && STREAM_ATOMS[ref] === void 0 && CONTEXT_ATOMS[ref] === void 0);
|
|
9770
|
+
for (const ref of missing) {
|
|
9771
|
+
customAtomsMap.set(ref, DIM_ZERO);
|
|
9772
|
+
}
|
|
9773
|
+
if (missing.length > 0) {
|
|
9774
|
+
diagnostics.push({ id: key, message: `Summary ${key}: missing ${[...new Set(missing)].join(", ")}` });
|
|
9775
|
+
}
|
|
9776
|
+
} catch {
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9731
9779
|
const customAtoms = Object.fromEntries(customAtomsMap);
|
|
9732
9780
|
const defs = [];
|
|
9733
9781
|
for (const [key, expr2] of chosen) {
|
|
@@ -9751,7 +9799,7 @@ function compilePropertySummaryCalcs(sources) {
|
|
|
9751
9799
|
} catch {
|
|
9752
9800
|
}
|
|
9753
9801
|
}
|
|
9754
|
-
return defs;
|
|
9802
|
+
return { defs, diagnostics };
|
|
9755
9803
|
}
|
|
9756
9804
|
function collectRequiredRefs(node, into = /* @__PURE__ */ new Set()) {
|
|
9757
9805
|
if (!node) return into;
|
|
@@ -10006,6 +10054,7 @@ function runMetricShakeOutQueue(container, options) {
|
|
|
10006
10054
|
}
|
|
10007
10055
|
const unresolved = new Set(pendingEquations);
|
|
10008
10056
|
const notApplicable = /* @__PURE__ */ new Set();
|
|
10057
|
+
const unresolvable = /* @__PURE__ */ new Set();
|
|
10009
10058
|
const makeEvalContext = () => ({
|
|
10010
10059
|
resolveRef: (name2) => readContainerMetricAtom(container, name2, inferredDims, options.lastEffortSlug),
|
|
10011
10060
|
callFunction: (name2, args, rawArgs) => {
|
|
@@ -10029,7 +10078,12 @@ function runMetricShakeOutQueue(container, options) {
|
|
|
10029
10078
|
continue;
|
|
10030
10079
|
}
|
|
10031
10080
|
const val = evaluate(rule.ast, ctx);
|
|
10032
|
-
if (val.kind !== "number")
|
|
10081
|
+
if (val.kind !== "number") {
|
|
10082
|
+
unresolved.delete(rule);
|
|
10083
|
+
unresolvable.add(rule);
|
|
10084
|
+
progressed = true;
|
|
10085
|
+
continue;
|
|
10086
|
+
}
|
|
10033
10087
|
let dim = val.dim;
|
|
10034
10088
|
if (rule.unit && AUTHORITATIVE_CASTS[rule.unit]) {
|
|
10035
10089
|
dim = DIM_ZERO;
|
|
@@ -10061,14 +10115,8 @@ function runMetricShakeOutQueue(container, options) {
|
|
|
10061
10115
|
const deferredRuntime = [];
|
|
10062
10116
|
const diagnostics = [];
|
|
10063
10117
|
const finalCtx = makeEvalContext();
|
|
10064
|
-
|
|
10065
|
-
if (
|
|
10066
|
-
const missing = rule.dependencies.filter((dep) => finalCtx.resolveRef(dep).kind === "absent");
|
|
10067
|
-
if (missing.length === 0) continue;
|
|
10068
|
-
if (options.stage === "plan") {
|
|
10069
|
-
deferredRuntime.push(rule.key);
|
|
10070
|
-
continue;
|
|
10071
|
-
}
|
|
10118
|
+
const emitDiagnostic = (rule, missing) => {
|
|
10119
|
+
if (options.emitDiagnostics === false) return;
|
|
10072
10120
|
const diag = {
|
|
10073
10121
|
target: rule.key,
|
|
10074
10122
|
expression: rule.expression,
|
|
@@ -10080,8 +10128,8 @@ function runMetricShakeOutQueue(container, options) {
|
|
|
10080
10128
|
container.add({
|
|
10081
10129
|
type: wodWikiCore.MetricType.Diagnostic,
|
|
10082
10130
|
name: `diagnostic.${rule.key}`,
|
|
10083
|
-
value: `Skipped ${rule.key}: missing ${missing.join(", ")}`,
|
|
10084
|
-
image: `Skipped ${rule.key} (missing ${missing.join(", ")})`,
|
|
10131
|
+
value: `Skipped ${rule.key}: ${missing.length > 0 ? `missing ${missing.join(", ")}` : "expression could not be evaluated"}`,
|
|
10132
|
+
image: `Skipped ${rule.key} (${missing.length > 0 ? `missing ${missing.join(", ")}` : "expression could not be evaluated"})`,
|
|
10085
10133
|
origin: "diagnostic",
|
|
10086
10134
|
metadata: {
|
|
10087
10135
|
diagnostic: "skipped-dependency",
|
|
@@ -10092,6 +10140,23 @@ function runMetricShakeOutQueue(container, options) {
|
|
|
10092
10140
|
missing
|
|
10093
10141
|
}
|
|
10094
10142
|
});
|
|
10143
|
+
};
|
|
10144
|
+
for (const rule of unresolved) {
|
|
10145
|
+
if (notApplicable.has(rule)) continue;
|
|
10146
|
+
const missing = rule.dependencies.filter((dep) => finalCtx.resolveRef(dep).kind === "absent");
|
|
10147
|
+
if (missing.length === 0) continue;
|
|
10148
|
+
if (options.stage === "plan") {
|
|
10149
|
+
deferredRuntime.push(rule.key);
|
|
10150
|
+
continue;
|
|
10151
|
+
}
|
|
10152
|
+
emitDiagnostic(rule, missing);
|
|
10153
|
+
}
|
|
10154
|
+
for (const rule of unresolvable) {
|
|
10155
|
+
if (options.stage === "plan") {
|
|
10156
|
+
deferredRuntime.push(rule.key);
|
|
10157
|
+
continue;
|
|
10158
|
+
}
|
|
10159
|
+
emitDiagnostic(rule, []);
|
|
10095
10160
|
}
|
|
10096
10161
|
return {
|
|
10097
10162
|
resolved,
|
|
@@ -12438,6 +12503,8 @@ var CalcEngine = class {
|
|
|
12438
12503
|
activatedTags = /* @__PURE__ */ new Set();
|
|
12439
12504
|
/** The tags the run activates — a note-level bundle of attachments. */
|
|
12440
12505
|
runTags;
|
|
12506
|
+
/** Registration diagnostics are stamped once per workout, on the first leaf. */
|
|
12507
|
+
summaryDiagnosticsStamped = false;
|
|
12441
12508
|
/**
|
|
12442
12509
|
* Whether a calculation runs here.
|
|
12443
12510
|
*
|
|
@@ -12474,12 +12541,41 @@ var CalcEngine = class {
|
|
|
12474
12541
|
const appliedTags = this.appliedTags(output);
|
|
12475
12542
|
const tagSources = extractTagPropertyRules(this.deps.tags, appliedTags);
|
|
12476
12543
|
const allSources = [...tagSources, ...this.deps.propertySources ?? []];
|
|
12544
|
+
const hasExerciseStatement = output.metrics.rawMetrics.some((metric) => metric.type === wodWikiCore.MetricType.Effort && String(metric.value ?? metric.image ?? "").trim().toLowerCase() !== "rest");
|
|
12545
|
+
if (!this.summaryDiagnosticsStamped && (this.deps.summaryDiagnostics?.length ?? 0) > 0) {
|
|
12546
|
+
this.summaryDiagnosticsStamped = true;
|
|
12547
|
+
for (const diagnostic of this.deps.summaryDiagnostics ?? []) {
|
|
12548
|
+
output.metrics.add({
|
|
12549
|
+
type: wodWikiCore.MetricType.Diagnostic,
|
|
12550
|
+
name: `diagnostic.${diagnostic.id}`,
|
|
12551
|
+
value: diagnostic.message,
|
|
12552
|
+
image: diagnostic.message,
|
|
12553
|
+
origin: "diagnostic",
|
|
12554
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
12555
|
+
metadata: { diagnostic: "summary-registration", target: diagnostic.id }
|
|
12556
|
+
});
|
|
12557
|
+
}
|
|
12558
|
+
}
|
|
12477
12559
|
if (allSources.length > 0) {
|
|
12560
|
+
const spanMs = typeof output.timeSpan?.started === "number" && typeof output.timeSpan.ended === "number" ? output.timeSpan.ended - output.timeSpan.started : 0;
|
|
12561
|
+
const existingElapsed = output.metrics.rawMetrics.map((m) => m.type === wodWikiCore.MetricType.Elapsed && typeof m.value === "number" ? m.value : void 0).reduce((found, v) => v ?? found, void 0);
|
|
12562
|
+
if (spanMs > 0 && (existingElapsed === void 0 || existingElapsed === 0)) {
|
|
12563
|
+
output.metrics.add({
|
|
12564
|
+
type: wodWikiCore.MetricType.Elapsed,
|
|
12565
|
+
name: "elapsed",
|
|
12566
|
+
value: spanMs,
|
|
12567
|
+
unit: "ms",
|
|
12568
|
+
image: `${spanMs} ms`,
|
|
12569
|
+
origin: "analyzed",
|
|
12570
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
12571
|
+
});
|
|
12572
|
+
}
|
|
12478
12573
|
runMetricShakeOutQueue(output.metrics, {
|
|
12479
12574
|
stage: "log",
|
|
12480
12575
|
sources: allSources,
|
|
12481
12576
|
lookups: this.deps.lookups,
|
|
12482
|
-
lastEffortSlug: this.lastSegmentEffort
|
|
12577
|
+
lastEffortSlug: this.lastSegmentEffort,
|
|
12578
|
+
emitDiagnostics: hasExerciseStatement
|
|
12483
12579
|
});
|
|
12484
12580
|
}
|
|
12485
12581
|
const atoms = buildSegmentAtoms(output, this.lastSegmentEffort);
|
|
@@ -13718,12 +13814,21 @@ function createCalcStack(options) {
|
|
|
13718
13814
|
const allTagSlugs = (options.tags?.list() ?? []).map((t2) => t2.slug);
|
|
13719
13815
|
const tagRules = extractTagPropertyRules(options.tags, allTagSlugs);
|
|
13720
13816
|
const combinedSources = [...options.propertySources ?? [], ...tagRules];
|
|
13817
|
+
const diagnostics = [];
|
|
13721
13818
|
if (combinedSources.length > 0) {
|
|
13722
|
-
|
|
13723
|
-
|
|
13819
|
+
const compiled = compilePropertySummaryCalcsWithDiagnostics(combinedSources);
|
|
13820
|
+
diagnostics.push(...compiled.diagnostics);
|
|
13821
|
+
for (const def of compiled.defs) {
|
|
13822
|
+
try {
|
|
13823
|
+
registry.register(def);
|
|
13824
|
+
} catch (err) {
|
|
13825
|
+
const message = `Skipped summary ${def.id}: ${err instanceof Error ? err.message : String(err)}`;
|
|
13826
|
+
diagnostics.push({ id: def.id, message });
|
|
13827
|
+
console.error(`[createCalcStack] ${message}`);
|
|
13828
|
+
}
|
|
13724
13829
|
}
|
|
13725
13830
|
}
|
|
13726
|
-
return { lookups, registry };
|
|
13831
|
+
return { lookups, registry, diagnostics };
|
|
13727
13832
|
}
|
|
13728
13833
|
function createCalcEngine(dialect, options) {
|
|
13729
13834
|
const stack = createCalcStack(options);
|
|
@@ -13733,7 +13838,8 @@ function createCalcEngine(dialect, options) {
|
|
|
13733
13838
|
userProfile: options.userProfile,
|
|
13734
13839
|
tags: options.tags,
|
|
13735
13840
|
activeTags: options.activeTags,
|
|
13736
|
-
propertySources: options.propertySources
|
|
13841
|
+
propertySources: options.propertySources,
|
|
13842
|
+
summaryDiagnostics: stack.diagnostics
|
|
13737
13843
|
});
|
|
13738
13844
|
}
|
|
13739
13845
|
|
|
@@ -15994,6 +16100,7 @@ exports.commonFixtureSet = commonFixtureSet;
|
|
|
15994
16100
|
exports.compareStatement = compareStatement;
|
|
15995
16101
|
exports.compileLineForm = compileLineForm;
|
|
15996
16102
|
exports.compilePropertySummaryCalcs = compilePropertySummaryCalcs;
|
|
16103
|
+
exports.compilePropertySummaryCalcsWithDiagnostics = compilePropertySummaryCalcsWithDiagnostics;
|
|
15997
16104
|
exports.composeDivUnit = composeDivUnit;
|
|
15998
16105
|
exports.composeMulUnit = composeMulUnit;
|
|
15999
16106
|
exports.compoundName = compoundName;
|