@bitcobblers/wod-wiki-lang 0.4.24 → 0.5.28
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-DCJ4w4o_.d.cts → browserRuntimeNow-je1Vb5bU.d.cts} +1 -1
- package/dist/{browserRuntimeNow-DCJ4w4o_.d.ts → browserRuntimeNow-je1Vb5bU.d.ts} +1 -1
- package/dist/index.cjs +388 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +702 -61
- package/dist/index.d.ts +702 -61
- package/dist/index.mjs +368 -368
- 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
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 IScript, a as IEffortResolver, b as IEffortRegistry, E as EffortResolverOptions, c as IEffort, d as EffortResolutionOptions, R as ResolvedEffort, e as EffortRegistrySource, 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 StackObserver, K as StackSnapshot, L as StackListener, N as MemoryTypeEnum, P as IAnchorValue, Q as
|
|
5
|
-
export {
|
|
4
|
+
import { W as WhiteboardScript, I as IScript, a as IEffortResolver, b as IEffortRegistry, E as EffortResolverOptions, c as IEffort, d as EffortResolutionOptions, R as ResolvedEffort, e as EffortRegistrySource, 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 StackObserver, K as StackSnapshot, L as StackListener, N as MemoryTypeEnum, P as IAnchorValue, Q as ButtonConfig, V as IEventHandler, X as HandlerScope, Y as IScriptRuntime, Z as TestableBlockConfig, _ as IRuntimeOptions, $ as ScriptRuntime, a0 as EventHandlerOptions, a1 as EventCallback, a2 as TimerState, a3 as IRealtimeProcessor, a4 as ISummaryProcessor, a5 as ProjectionResult } from './browserRuntimeNow-je1Vb5bU.js';
|
|
5
|
+
export { a6 as ButtonVariant, a7 as ButtonsState, a8 as ChildrenStatusState, a9 as CompletionState, aa as DEFAULT_RESOLVER_OPTIONS, ab as DEFAULT_RUNTIME_OPTIONS, ac as DISCIPLINE_FACTORS, ad as DisplayState, ae as EFFORT_DISCIPLINES, af as EFFORT_REGISTRY_ORIGINS, ag as EffortBaseAttributes, ah as EffortDerivation, ai as EffortDiscipline, aj as EffortResolvedFrom, ak as FenceDialect, al as FragmentDisplayState, am as FragmentState, an as IAnalyticsProcessorDescriptor, ao as INTENSITY_TIERS, ap as IntensityTier, aq as InterceptMode, ar as MemoryLocation, as as MemoryType, at as MemoryTypeMap, au as MemoryValueOf, av as RoundState, aw as RuntimeState, ax as ScriptRuntimeDependencies, ay as StackEvent, az as TimerDirection, aA as VISIBILITY_ICONS, aB as VISIBILITY_LABELS, aC as createBrowserRuntimeNow, aD as disciplineFactorFor, aE as filterTagsByVisibility, aF as frozenNow, aG as getMetricVisibility, aH as getRuntimeNowMs, aI as isEffortDiscipline, aJ as isFragmentTag, aK as wallClockNow } from './browserRuntimeNow-je1Vb5bU.js';
|
|
6
6
|
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
|
7
7
|
import { LRParser } from '@lezer/lr';
|
|
8
8
|
|
|
@@ -1686,6 +1686,48 @@ declare class NextAction implements IRuntimeAction {
|
|
|
1686
1686
|
private validateRuntimeState;
|
|
1687
1687
|
}
|
|
1688
1688
|
|
|
1689
|
+
/**
|
|
1690
|
+
* CompletionTimestampBehavior records when a block is marked as complete.
|
|
1691
|
+
*
|
|
1692
|
+
* ## Universal Invariant
|
|
1693
|
+
*
|
|
1694
|
+
* This behavior is automatically added to ALL blocks by BlockBuilder.
|
|
1695
|
+
* It records the completion timestamp when the block's isComplete flag is set to true.
|
|
1696
|
+
* The timestamp is stored in block memory under the 'completion' tag.
|
|
1697
|
+
*/
|
|
1698
|
+
declare class CompletionTimestampBehavior implements IRuntimeBehavior {
|
|
1699
|
+
private completionTime;
|
|
1700
|
+
private wasComplete;
|
|
1701
|
+
onMount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1702
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1703
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1704
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
1705
|
+
/**
|
|
1706
|
+
* Get the completion timestamp if the block has been completed.
|
|
1707
|
+
* @returns Completion timestamp or undefined
|
|
1708
|
+
*/
|
|
1709
|
+
getCompletionTime(): Date | undefined;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* SpanTrackingBehavior records the wall-clock time a block was active.
|
|
1714
|
+
*
|
|
1715
|
+
* ## Aspect: Time (Span-only)
|
|
1716
|
+
*
|
|
1717
|
+
* No tick subscription, no pause/resume, no completion signal.
|
|
1718
|
+
* Simply opens a TimeSpan on mount and closes it on unmount so the
|
|
1719
|
+
* block's execution window is captured in memory for history/reporting.
|
|
1720
|
+
*
|
|
1721
|
+
* Use this for blocks that need timing data but do NOT display a running
|
|
1722
|
+
* timer, e.g. effort leaves where elapsed is only needed for reports.
|
|
1723
|
+
*/
|
|
1724
|
+
declare class SpanTrackingBehavior implements IRuntimeBehavior {
|
|
1725
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1726
|
+
onNext(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1727
|
+
onUnmount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1728
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1689
1731
|
interface CountupTimerConfig {
|
|
1690
1732
|
/** Human-readable label shown in the display layer */
|
|
1691
1733
|
label?: string;
|
|
@@ -1777,6 +1819,186 @@ declare class CountdownTimerBehavior implements IRuntimeBehavior {
|
|
|
1777
1819
|
private createFragment;
|
|
1778
1820
|
}
|
|
1779
1821
|
|
|
1822
|
+
/**
|
|
1823
|
+
* Interface for behaviors that expose rep/metric configuration data.
|
|
1824
|
+
*
|
|
1825
|
+
* Rep source behaviors provide the target reps for the current round,
|
|
1826
|
+
* typically used in rep scheme workouts (e.g., 21-15-9).
|
|
1827
|
+
*
|
|
1828
|
+
* @example Implementations
|
|
1829
|
+
* - MetricPromotionBehavior: Maps rounds to rep counts from a scheme array
|
|
1830
|
+
*
|
|
1831
|
+
* @example Usage
|
|
1832
|
+
* ```typescript
|
|
1833
|
+
* const repSource = block.getBehavior<IRepSource>(MetricPromotionBehavior);
|
|
1834
|
+
* const targetReps = repSource?.getRepsForRound(currentRound) ?? 10;
|
|
1835
|
+
* ```
|
|
1836
|
+
*/
|
|
1837
|
+
interface IRepSource {
|
|
1838
|
+
/**
|
|
1839
|
+
* Gets the target rep count for a specific round.
|
|
1840
|
+
* @param round - The round number (1-based)
|
|
1841
|
+
* @returns The target reps for that round, or undefined if not applicable
|
|
1842
|
+
*/
|
|
1843
|
+
getRepsForRound(round: number): number | undefined;
|
|
1844
|
+
/**
|
|
1845
|
+
* Gets the target rep count for the current round.
|
|
1846
|
+
* @returns The target reps for the current round, or undefined if not applicable
|
|
1847
|
+
*/
|
|
1848
|
+
getRepsForCurrentRound?(): number | undefined;
|
|
1849
|
+
/**
|
|
1850
|
+
* Gets the full rep scheme array if available.
|
|
1851
|
+
* @returns The rep scheme array (e.g., [21, 15, 9]), or undefined
|
|
1852
|
+
*/
|
|
1853
|
+
readonly repScheme?: readonly number[];
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Interface for behaviors that provide dynamic metrics promotions to child blocks.
|
|
1858
|
+
*
|
|
1859
|
+
* During compilation of a child block, the JitCompiler queries the parent block's
|
|
1860
|
+
* behaviors for any IMetricPromoter. These promoters return metrics that
|
|
1861
|
+
* should be injected into the child block's statements.
|
|
1862
|
+
*
|
|
1863
|
+
* This enables "compiler-time" inheritance where the parent's state (e.g. current round,
|
|
1864
|
+
* rep scheme index) is used to decorate child blocks during their creation.
|
|
1865
|
+
*/
|
|
1866
|
+
interface IMetricPromoter {
|
|
1867
|
+
/**
|
|
1868
|
+
* Returns metrics to be promoted to child blocks.
|
|
1869
|
+
* @param runtime The current script runtime
|
|
1870
|
+
* @param parentBlock The parent block that is promoting metrics
|
|
1871
|
+
* @returns MetricContainer of metrics to inject into children
|
|
1872
|
+
*/
|
|
1873
|
+
getPromotedFragments(runtime: IRuntimeContext, parentBlock: IRuntimeBlock): MetricContainer;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
interface PromotionRule {
|
|
1877
|
+
metricType: MetricType;
|
|
1878
|
+
origin?: MetricOrigin;
|
|
1879
|
+
enableDynamicUpdates?: boolean;
|
|
1880
|
+
sourceTag?: MemoryTag;
|
|
1881
|
+
}
|
|
1882
|
+
interface MetricPromotionConfig {
|
|
1883
|
+
promotions: PromotionRule[];
|
|
1884
|
+
repScheme?: number[];
|
|
1885
|
+
}
|
|
1886
|
+
declare class MetricPromotionBehavior implements IRuntimeBehavior, IRepSource, IMetricPromoter {
|
|
1887
|
+
private readonly config;
|
|
1888
|
+
private readonly _repScheme;
|
|
1889
|
+
private _lastPromotedRound;
|
|
1890
|
+
constructor(config: MetricPromotionConfig);
|
|
1891
|
+
get repScheme(): readonly number[];
|
|
1892
|
+
getRepsForRound(round: number): number | undefined;
|
|
1893
|
+
getRepsForCurrentRound(): number | undefined;
|
|
1894
|
+
/**
|
|
1895
|
+
* Compiler-time promotion handler.
|
|
1896
|
+
*
|
|
1897
|
+
* Queries current state from parent block memory and returns the
|
|
1898
|
+
* correct metrics to be injected into child blocks during JIT
|
|
1899
|
+
* compilation. This ensures inheritance works even when a round
|
|
1900
|
+
* advances and children are compiled in the same runtime tick.
|
|
1901
|
+
*/
|
|
1902
|
+
getPromotedFragments(runtime: IRuntimeContext, parentBlock: IRuntimeBlock): MetricContainer;
|
|
1903
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1904
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1905
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1906
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
1907
|
+
private promoteFragments;
|
|
1908
|
+
private promoteRepScheme;
|
|
1909
|
+
private findSourceFragment;
|
|
1910
|
+
private findSourceFragmentInBlock;
|
|
1911
|
+
private upsertPromotedFragment;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
interface ExitConfig {
|
|
1915
|
+
/**
|
|
1916
|
+
* `immediate` — pop as soon as trigger fires (replaces LeafExitBehavior).
|
|
1917
|
+
* `deferred` — pop on next() only when block is already marked complete
|
|
1918
|
+
* (replaces CompletedBlockPopBehavior; used by container blocks
|
|
1919
|
+
* where a timer or event marks completion externally).
|
|
1920
|
+
*/
|
|
1921
|
+
mode: 'immediate' | 'deferred';
|
|
1922
|
+
/**
|
|
1923
|
+
* For `mode: 'immediate'` — pop when next() is called.
|
|
1924
|
+
* Defaults to `true` for immediate mode.
|
|
1925
|
+
*/
|
|
1926
|
+
onNext?: boolean;
|
|
1927
|
+
/**
|
|
1928
|
+
* For `mode: 'immediate'` — pop when any of these events fires.
|
|
1929
|
+
* Defaults to `[]`.
|
|
1930
|
+
*/
|
|
1931
|
+
onEvents?: string[];
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* ExitBehavior unifies the two completion-pop patterns into a single behavior.
|
|
1935
|
+
*
|
|
1936
|
+
* ## Modes
|
|
1937
|
+
*
|
|
1938
|
+
* ### `immediate`
|
|
1939
|
+
* Pops the block as soon as a trigger fires:
|
|
1940
|
+
* - `onNext: true` (default) — pops when the user calls next()
|
|
1941
|
+
* - `onEvents: ['timer:complete']` — pops when the event fires
|
|
1942
|
+
* Both can be active simultaneously.
|
|
1943
|
+
*
|
|
1944
|
+
* Replaces `LeafExitBehavior`.
|
|
1945
|
+
*
|
|
1946
|
+
* ### `deferred`
|
|
1947
|
+
* Pops the block on the next call to next() *only if* `block.isComplete`
|
|
1948
|
+
* is already true. Used on container blocks where an external trigger
|
|
1949
|
+
* (timer expiry, event) marks completion, but the block should only pop
|
|
1950
|
+
* once all in-flight children have had a chance to run.
|
|
1951
|
+
*
|
|
1952
|
+
* Replaces `CompletedBlockPopBehavior`.
|
|
1953
|
+
*
|
|
1954
|
+
* ## Migration
|
|
1955
|
+
*
|
|
1956
|
+
* ```typescript
|
|
1957
|
+
* // Before:
|
|
1958
|
+
* new LeafExitBehavior({ onNext: true })
|
|
1959
|
+
* new LeafExitBehavior({ onEvents: ['timer:complete'] })
|
|
1960
|
+
* new LeafExitBehavior({ onNext: true, onEvents: ['timer:start'] })
|
|
1961
|
+
* new CompletedBlockPopBehavior()
|
|
1962
|
+
*
|
|
1963
|
+
* // After:
|
|
1964
|
+
* new ExitBehavior({ mode: 'immediate' })
|
|
1965
|
+
* new ExitBehavior({ mode: 'immediate', onNext: false, onEvents: ['timer:complete'] })
|
|
1966
|
+
* new ExitBehavior({ mode: 'immediate', onNext: true, onEvents: ['timer:start'] })
|
|
1967
|
+
* new ExitBehavior({ mode: 'deferred' })
|
|
1968
|
+
* ```
|
|
1969
|
+
*/
|
|
1970
|
+
declare class ExitBehavior implements IRuntimeBehavior {
|
|
1971
|
+
private readonly config;
|
|
1972
|
+
private unsubscribers;
|
|
1973
|
+
constructor(config: ExitConfig);
|
|
1974
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1975
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1976
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1977
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
interface LabelingConfig {
|
|
1981
|
+
mode?: 'clock' | 'timer' | 'countdown' | 'hidden';
|
|
1982
|
+
label?: string;
|
|
1983
|
+
subtitle?: string;
|
|
1984
|
+
actionDisplay?: string;
|
|
1985
|
+
showRoundDisplay?: boolean;
|
|
1986
|
+
roundFormat?: (current: number, total?: number) => string;
|
|
1987
|
+
}
|
|
1988
|
+
declare class LabelingBehavior implements IRuntimeBehavior {
|
|
1989
|
+
private readonly config;
|
|
1990
|
+
constructor(config?: LabelingConfig);
|
|
1991
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1992
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
1993
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
1994
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
1995
|
+
private createStaticLabels;
|
|
1996
|
+
private createRoundLabel;
|
|
1997
|
+
private createTextMetric;
|
|
1998
|
+
private formatRound;
|
|
1999
|
+
private isRoundRoleFragment;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1780
2002
|
type ChildSelectionLoopCondition = 'always' | 'timer-active' | 'rounds-remaining';
|
|
1781
2003
|
interface ChildSelectionConfig {
|
|
1782
2004
|
/** Groups of statement indices to compile and dispatch */
|
|
@@ -1802,6 +2024,195 @@ interface ChildSelectionConfig {
|
|
|
1802
2024
|
*/
|
|
1803
2025
|
totalRounds?: number;
|
|
1804
2026
|
}
|
|
2027
|
+
declare class ChildSelectionBehavior implements IRuntimeBehavior {
|
|
2028
|
+
private readonly config;
|
|
2029
|
+
private static readonly DEFAULT_MIN_REST_MS;
|
|
2030
|
+
private childIndex;
|
|
2031
|
+
private dispatchedOnLastNext;
|
|
2032
|
+
private restState;
|
|
2033
|
+
constructor(config: ChildSelectionConfig);
|
|
2034
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2035
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2036
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2037
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
2038
|
+
get allChildrenExecuted(): boolean;
|
|
2039
|
+
get allChildrenCompleted(): boolean;
|
|
2040
|
+
get totalChildren(): number;
|
|
2041
|
+
private dispatchNext;
|
|
2042
|
+
private shouldLoop;
|
|
2043
|
+
private shouldInjectRest;
|
|
2044
|
+
private getRemainingCountdownMs;
|
|
2045
|
+
private writeChildrenStatus;
|
|
2046
|
+
/**
|
|
2047
|
+
* Advance the round counter in block memory and emit tracker action.
|
|
2048
|
+
*
|
|
2049
|
+
* Called by this behavior when a complete cycle of children finishes
|
|
2050
|
+
* and shouldLoop() returns true. This keeps round tracking
|
|
2051
|
+
* self-contained within ChildSelectionBehavior — no dependency on
|
|
2052
|
+
* ReEntryBehavior's onNext() or behavior execution ordering.
|
|
2053
|
+
*/
|
|
2054
|
+
private advanceRound;
|
|
2055
|
+
private createNextPreview;
|
|
2056
|
+
private isLoopEnabled;
|
|
2057
|
+
private getLoopCondition;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
interface ReportOutputConfig {
|
|
2061
|
+
label?: string;
|
|
2062
|
+
emitSegmentOnMount?: boolean;
|
|
2063
|
+
emitMilestones?: boolean;
|
|
2064
|
+
computeTimeResults?: boolean;
|
|
2065
|
+
}
|
|
2066
|
+
declare class ReportOutputBehavior implements IRuntimeBehavior {
|
|
2067
|
+
private readonly config;
|
|
2068
|
+
private readonly _now;
|
|
2069
|
+
private lastEmittedRound?;
|
|
2070
|
+
constructor(config?: ReportOutputConfig, _now?: INowProvider);
|
|
2071
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2072
|
+
onNext(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2073
|
+
onUnmount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2074
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
2075
|
+
private collectDisplayFragments;
|
|
2076
|
+
private collectStateFragments;
|
|
2077
|
+
private mergeFragments;
|
|
2078
|
+
private buildMilestoneFragments;
|
|
2079
|
+
private computeTimeResults;
|
|
2080
|
+
private computeSplitTimeResults;
|
|
2081
|
+
private writeResultMemory;
|
|
2082
|
+
private writeResultGroups;
|
|
2083
|
+
private formatLabel;
|
|
2084
|
+
private formatRoundLabel;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Trigger types for when a sound should play.
|
|
2089
|
+
*/
|
|
2090
|
+
type SoundTrigger = 'mount' | 'unmount' | 'countdown' | 'complete';
|
|
2091
|
+
|
|
2092
|
+
interface SoundCue$1 {
|
|
2093
|
+
/** Sound identifier or URL */
|
|
2094
|
+
sound: string;
|
|
2095
|
+
/** When to play: 'mount' | 'unmount' | 'countdown' | 'complete' */
|
|
2096
|
+
trigger: SoundTrigger;
|
|
2097
|
+
/** Countdown seconds (only for trigger: 'countdown') */
|
|
2098
|
+
atSeconds?: number[];
|
|
2099
|
+
}
|
|
2100
|
+
interface SoundCueConfig {
|
|
2101
|
+
/** Sound cues to play */
|
|
2102
|
+
cues: SoundCue$1[];
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* SoundCueBehavior emits sound cue outputs at specific lifecycle points.
|
|
2106
|
+
*
|
|
2107
|
+
* ## Aspect: Output (Audio)
|
|
2108
|
+
*
|
|
2109
|
+
* Emits 'system' outputs with SoundMetric that audio systems can observe.
|
|
2110
|
+
* Sound outputs are tracked as system events so they do not appear in the
|
|
2111
|
+
* user-facing review/logs page — only in the debug view.
|
|
2112
|
+
* This follows the principle that behaviors emit outputs, not events.
|
|
2113
|
+
*
|
|
2114
|
+
* ## Output Contract
|
|
2115
|
+
*
|
|
2116
|
+
* - **Mount**: Emits system output for 'mount' trigger sounds
|
|
2117
|
+
* - **Tick**: Emits system output for 'countdown' trigger sounds at specified seconds
|
|
2118
|
+
* - **Unmount**: Emits system output for 'unmount' and 'complete' trigger sounds
|
|
2119
|
+
*
|
|
2120
|
+
* ## Audio System Integration
|
|
2121
|
+
*
|
|
2122
|
+
* Audio systems should subscribe to outputs (via runtime output stream) and
|
|
2123
|
+
* filter for SoundMetric to play audio cues:
|
|
2124
|
+
*
|
|
2125
|
+
* ```typescript
|
|
2126
|
+
* runtime.outputs$.subscribe(output => {
|
|
2127
|
+
* const soundFragments = output.metrics.filter(f => f.metricType === MetricType.Sound);
|
|
2128
|
+
* for (const sf of soundFragments) {
|
|
2129
|
+
* audioPlayer.play(sf.value.sound);
|
|
2130
|
+
* }
|
|
2131
|
+
* });
|
|
2132
|
+
* ```
|
|
2133
|
+
*/
|
|
2134
|
+
declare class SoundCueBehavior implements IRuntimeBehavior {
|
|
2135
|
+
private config;
|
|
2136
|
+
constructor(config: SoundCueConfig);
|
|
2137
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2138
|
+
onNext(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2139
|
+
onUnmount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2140
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
interface ControlsConfig {
|
|
2144
|
+
/** Initial buttons to display */
|
|
2145
|
+
buttons: ButtonConfig[];
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* ButtonBehavior initializes control button state in memory.
|
|
2149
|
+
*
|
|
2150
|
+
* ## Aspect: Controls
|
|
2151
|
+
*
|
|
2152
|
+
* Sets up the button configurations in memory that the UI observes.
|
|
2153
|
+
* When buttons are clicked, the UI emits the corresponding `eventName`
|
|
2154
|
+
* as an external event that behaviors can subscribe to.
|
|
2155
|
+
*
|
|
2156
|
+
* ## Memory Contract
|
|
2157
|
+
*
|
|
2158
|
+
* - **Writes**: `controls` memory on mount
|
|
2159
|
+
* - **Clears**: `controls` memory on unmount (sets empty buttons array)
|
|
2160
|
+
*
|
|
2161
|
+
* ## UI Integration
|
|
2162
|
+
*
|
|
2163
|
+
* The UI should:
|
|
2164
|
+
* 1. Subscribe to `controls` memory changes
|
|
2165
|
+
* 2. Render buttons based on action metrics
|
|
2166
|
+
* 3. Emit `button.eventName` when user clicks a button
|
|
2167
|
+
*
|
|
2168
|
+
* @example
|
|
2169
|
+
* ```typescript
|
|
2170
|
+
* new ButtonBehavior({
|
|
2171
|
+
* buttons: [
|
|
2172
|
+
* { id: 'next', label: 'Next', variant: 'primary', visible: true, enabled: true, eventName: 'next' },
|
|
2173
|
+
* { id: 'pause', label: 'Pause', variant: 'secondary', visible: true, enabled: true, eventName: 'timer:pause' }
|
|
2174
|
+
* ]
|
|
2175
|
+
* })
|
|
2176
|
+
* ```
|
|
2177
|
+
*/
|
|
2178
|
+
declare class ButtonBehavior implements IRuntimeBehavior {
|
|
2179
|
+
private config;
|
|
2180
|
+
constructor(config: ControlsConfig);
|
|
2181
|
+
onMount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2182
|
+
onNext(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2183
|
+
onUnmount(ctx: IBehaviorContext): IRuntimeAction[];
|
|
2184
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
2185
|
+
/**
|
|
2186
|
+
* Update a specific button's state dynamically.
|
|
2187
|
+
* Call this from other behaviors to enable/disable buttons.
|
|
2188
|
+
*/
|
|
2189
|
+
static updateButton(ctx: IBehaviorContext, buttonId: string, updates: Partial<Pick<ButtonConfig, 'visible' | 'enabled' | 'label'>>): void;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* WaitingToStartInjectorBehavior pushes a WaitingToStartBlock on mount.
|
|
2194
|
+
*
|
|
2195
|
+
* This behavior is placed BEFORE ChildRunnerBehavior in the SessionRootBlock
|
|
2196
|
+
* behavior chain. On mount, it returns a PushBlockAction for a WaitingToStartBlock.
|
|
2197
|
+
* The WaitingToStartBlock acts as an idle gate — the user must click "Start"
|
|
2198
|
+
* to dismiss it, after which the parent's ChildRunnerBehavior takes over.
|
|
2199
|
+
*
|
|
2200
|
+
* ## Interaction with ChildRunnerBehavior
|
|
2201
|
+
*
|
|
2202
|
+
* When this behavior is present, ChildRunnerBehavior must be configured with
|
|
2203
|
+
* `skipOnMount: true` so it doesn't also push a child on mount.
|
|
2204
|
+
* When WaitingToStart pops (user clicks Start), PopBlockAction fires NextAction
|
|
2205
|
+
* on the parent, which triggers ChildRunnerBehavior.onNext() → pushes the
|
|
2206
|
+
* actual first child from childGroups[0].
|
|
2207
|
+
*/
|
|
2208
|
+
declare class WaitingToStartInjectorBehavior implements IRuntimeBehavior {
|
|
2209
|
+
private readonly runtime;
|
|
2210
|
+
constructor(runtime: IRuntimeContext);
|
|
2211
|
+
onMount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2212
|
+
onNext(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2213
|
+
onUnmount(_ctx: IBehaviorContext): IRuntimeAction[];
|
|
2214
|
+
onDispose(_ctx: IBehaviorContext): void;
|
|
2215
|
+
}
|
|
1805
2216
|
|
|
1806
2217
|
/** Legacy timer config shape — kept for call-site backward compatibility */
|
|
1807
2218
|
interface TimerConfig {
|
|
@@ -2846,6 +3257,288 @@ declare function writeChoiceSelection(stmt: ICodeStatement, alternatives: readon
|
|
|
2846
3257
|
*/
|
|
2847
3258
|
declare function collapseUnresolvedChoices(statements: readonly ICodeStatement[]): number;
|
|
2848
3259
|
|
|
3260
|
+
/**
|
|
3261
|
+
* Configuration for the session root block.
|
|
3262
|
+
*/
|
|
3263
|
+
interface SessionRootConfig {
|
|
3264
|
+
/** Session label (e.g., "Morning WOD") */
|
|
3265
|
+
label?: string;
|
|
3266
|
+
/** Child statement ID groups to execute */
|
|
3267
|
+
childGroups: number[][];
|
|
3268
|
+
/** Total rounds for the workout (default: 1) */
|
|
3269
|
+
totalRounds?: number;
|
|
3270
|
+
}
|
|
3271
|
+
/**
|
|
3272
|
+
* SessionRootBlock is the top-level container for a workout session.
|
|
3273
|
+
*
|
|
3274
|
+
* ## Lifecycle
|
|
3275
|
+
*
|
|
3276
|
+
* 1. Mount: Emits 'segment' output with session label, starts elapsed timer,
|
|
3277
|
+
* pushes WaitingToStart block as first child (index 0)
|
|
3278
|
+
* 2. First next(): WaitingToStart pops → ChildRunner pushes first workout block
|
|
3279
|
+
* 3. Subsequent next(): ChildRunner pushes remaining workout blocks in sequence
|
|
3280
|
+
* 4. Final next(): All children done → marks complete and pops
|
|
3281
|
+
* 5. Pop: emits a 'segment' output carrying the completion reason, records history
|
|
3282
|
+
*
|
|
3283
|
+
* ## Behavior Chain Order
|
|
3284
|
+
*
|
|
3285
|
+
* Behaviors are order-independent for correctness. ChildSelectionBehavior
|
|
3286
|
+
* handles round advancement internally, and RuntimeBlock.next() auto-pops
|
|
3287
|
+
* when any behavior marks the block complete.
|
|
3288
|
+
*
|
|
3289
|
+
* - CountupTimerBehavior (elapsed workout timer)
|
|
3290
|
+
* - ChildSelectionBehavior (child dispatch + round init + advancement + safety net)
|
|
3291
|
+
* - WaitingToStartInjectorBehavior (pushes WaitingToStart gate on mount)
|
|
3292
|
+
* - ReportOutputBehavior (output on mount/unmount)
|
|
3293
|
+
* - LabelingBehavior (display)
|
|
3294
|
+
* - ButtonBehavior (controls)
|
|
3295
|
+
*
|
|
3296
|
+
* History persistence is the responsibility of the workbench — all data
|
|
3297
|
+
* needed for history is available in the output stream (ReportOutputBehavior).
|
|
3298
|
+
*/
|
|
3299
|
+
declare class SessionRootBlock extends RuntimeBlock {
|
|
3300
|
+
constructor(runtime: IRuntimeContext, config: SessionRootConfig);
|
|
3301
|
+
/**
|
|
3302
|
+
* Builds the behavior list for a session root block.
|
|
3303
|
+
* @param config Session configuration
|
|
3304
|
+
* @param runtime Script runtime (needed for WaitingToStartInjectorBehavior)
|
|
3305
|
+
*/
|
|
3306
|
+
static buildBehaviors(config: SessionRootConfig, runtime: IRuntimeContext): IRuntimeBehavior[];
|
|
3307
|
+
mount(runtime: IRuntimeContext, options?: BlockLifecycleOptions): IRuntimeAction[];
|
|
3308
|
+
unmount(runtime: IRuntimeContext, options?: BlockLifecycleOptions): IRuntimeAction[];
|
|
3309
|
+
dispose(runtime: IRuntimeContext): void;
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
/**
|
|
3313
|
+
* SessionRootStrategy composes a SessionRootBlock for workout sessions.
|
|
3314
|
+
*
|
|
3315
|
+
* This is a direct-build strategy (match() returns false) — it is not
|
|
3316
|
+
* discovered by the JIT pipeline. Instead, it is invoked explicitly by
|
|
3317
|
+
* StartWorkoutAction or equivalent entry points.
|
|
3318
|
+
*
|
|
3319
|
+
* ## Responsibilities
|
|
3320
|
+
*
|
|
3321
|
+
* 1. Accept parsed CodeStatements representing a workout
|
|
3322
|
+
* 2. Extract section label from the first statement
|
|
3323
|
+
* 3. Build child groups from top-level statement IDs
|
|
3324
|
+
* 4. Create a SessionRootBlock that sequences:
|
|
3325
|
+
* - WaitingToStart (idle gate)
|
|
3326
|
+
* - Compiled child blocks (workout exercises)
|
|
3327
|
+
*
|
|
3328
|
+
* History persistence is delegated to the workbench layer — all data needed
|
|
3329
|
+
* is available in the output stream (ReportOutputBehavior completions).
|
|
3330
|
+
*
|
|
3331
|
+
* @see SessionRootBlock
|
|
3332
|
+
*/
|
|
3333
|
+
declare class SessionRootStrategy implements IRuntimeBlockStrategy {
|
|
3334
|
+
priority: number;
|
|
3335
|
+
readonly id = "session-root";
|
|
3336
|
+
/**
|
|
3337
|
+
* Root blocks are not matched from statements — they are created directly.
|
|
3338
|
+
*/
|
|
3339
|
+
match(_statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3340
|
+
/**
|
|
3341
|
+
* Composable apply — not used for root blocks.
|
|
3342
|
+
*/
|
|
3343
|
+
apply(_builder: BlockBuilder, _statements: ICodeStatement[], _runtime: IRuntimeContext): void;
|
|
3344
|
+
/**
|
|
3345
|
+
* Builds a SessionRootBlock from a configuration.
|
|
3346
|
+
*
|
|
3347
|
+
* @param runtime - The script runtime context
|
|
3348
|
+
* @param config - Session root configuration with child groups and optional label/rounds
|
|
3349
|
+
* @returns A fully composed SessionRootBlock
|
|
3350
|
+
*
|
|
3351
|
+
* @example
|
|
3352
|
+
* ```typescript
|
|
3353
|
+
* const strategy = new SessionRootStrategy();
|
|
3354
|
+
* const root = strategy.build(runtime, {
|
|
3355
|
+
* childGroups: [[1], [2], [3]],
|
|
3356
|
+
* label: 'Morning WOD',
|
|
3357
|
+
* totalRounds: 1
|
|
3358
|
+
* });
|
|
3359
|
+
* ```
|
|
3360
|
+
*/
|
|
3361
|
+
build(runtime: IRuntimeContext, config: SessionRootConfig): IRuntimeBlock;
|
|
3362
|
+
/**
|
|
3363
|
+
* Builds a SessionRootBlock from parsed workout statements.
|
|
3364
|
+
*
|
|
3365
|
+
* Convenience method that extracts child groups from top-level statements
|
|
3366
|
+
* and delegates to build().
|
|
3367
|
+
*
|
|
3368
|
+
* @param runtime - The script runtime context
|
|
3369
|
+
* @param statements - Parsed top-level workout statements
|
|
3370
|
+
* @param options - Optional overrides for label and total rounds
|
|
3371
|
+
* @returns A fully composed SessionRootBlock
|
|
3372
|
+
*
|
|
3373
|
+
* @example
|
|
3374
|
+
* ```typescript
|
|
3375
|
+
* const strategy = new SessionRootStrategy();
|
|
3376
|
+
* const root = strategy.buildFromStatements(runtime, statements, {
|
|
3377
|
+
* label: 'Grace',
|
|
3378
|
+
* totalRounds: 1
|
|
3379
|
+
* });
|
|
3380
|
+
* ```
|
|
3381
|
+
*/
|
|
3382
|
+
buildFromStatements(runtime: IRuntimeContext, statements: ICodeStatement[], options?: {
|
|
3383
|
+
label?: string;
|
|
3384
|
+
totalRounds?: number;
|
|
3385
|
+
}): IRuntimeBlock;
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
/**
|
|
3389
|
+
* AmrapLogicStrategy handles "As Many Rounds As Possible" blocks.
|
|
3390
|
+
*
|
|
3391
|
+
* Pattern: Timer (countdown) + Rounds (unbounded)
|
|
3392
|
+
*
|
|
3393
|
+
* Uses aspect composer methods:
|
|
3394
|
+
* - .asTimer() - Time tracking with countdown
|
|
3395
|
+
* - .asRepeater() - Unbounded rounds (no completion)
|
|
3396
|
+
* Plus specific behaviors for display, output, rest, and sound.
|
|
3397
|
+
*/
|
|
3398
|
+
declare class AmrapLogicStrategy implements IRuntimeBlockStrategy {
|
|
3399
|
+
priority: number;
|
|
3400
|
+
readonly id = "amrap-logic";
|
|
3401
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3402
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
/**
|
|
3406
|
+
* IntervalLogicStrategy handles EMOM (Every Minute On the Minute) blocks.
|
|
3407
|
+
*
|
|
3408
|
+
* Pattern: Repeating interval timer + Rounds
|
|
3409
|
+
* Each interval resets the timer.
|
|
3410
|
+
*
|
|
3411
|
+
* Uses aspect composer methods:
|
|
3412
|
+
* - .asTimer() - Countdown per interval (completesBlock: false)
|
|
3413
|
+
* - .asRepeater() - Fixed rounds with completion
|
|
3414
|
+
* Plus specific behaviors for display, output, rest, and sound.
|
|
3415
|
+
*/
|
|
3416
|
+
declare class IntervalLogicStrategy implements IRuntimeBlockStrategy {
|
|
3417
|
+
priority: number;
|
|
3418
|
+
readonly id = "interval-logic";
|
|
3419
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3420
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
/**
|
|
3424
|
+
* EffortFallbackStrategy handles simple leaf effort blocks (e.g., "10 Push-ups").
|
|
3425
|
+
*
|
|
3426
|
+
* These blocks have no timer, no rounds, and no children — they complete when
|
|
3427
|
+
* the user advances. They track elapsed time via a secondary countup timer so
|
|
3428
|
+
* the stack display can show how long each effort takes.
|
|
3429
|
+
*
|
|
3430
|
+
* Blocks WITH children are excluded from this strategy and handled by
|
|
3431
|
+
* GenericGroupStrategy + ChildrenStrategy instead, which properly push child
|
|
3432
|
+
* blocks onto the stack via ChildRunnerBehavior.
|
|
3433
|
+
*/
|
|
3434
|
+
declare class EffortFallbackStrategy implements IRuntimeBlockStrategy {
|
|
3435
|
+
priority: number;
|
|
3436
|
+
readonly id = "effort-fallback";
|
|
3437
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3438
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3441
|
+
/**
|
|
3442
|
+
* GenericGroupStrategy handles blocks with children but no timer/loop.
|
|
3443
|
+
*
|
|
3444
|
+
* Uses aspect-based behaviors:
|
|
3445
|
+
* - Display: DisplayInit
|
|
3446
|
+
* - Output: HistoryRecord
|
|
3447
|
+
*/
|
|
3448
|
+
declare class GenericGroupStrategy implements IRuntimeBlockStrategy {
|
|
3449
|
+
priority: number;
|
|
3450
|
+
readonly id = "generic-group";
|
|
3451
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3452
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
/**
|
|
3456
|
+
* GenericLoopStrategy handles blocks with round/iteration metrics.
|
|
3457
|
+
*
|
|
3458
|
+
* Uses aspect composer methods:
|
|
3459
|
+
* - .asRepeater() - Iteration/round management with completion
|
|
3460
|
+
* Plus specific behaviors for display, output, and history.
|
|
3461
|
+
*/
|
|
3462
|
+
declare class GenericLoopStrategy implements IRuntimeBlockStrategy {
|
|
3463
|
+
priority: number;
|
|
3464
|
+
readonly id = "generic-loop";
|
|
3465
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3466
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
/**
|
|
3470
|
+
* GenericTimerStrategy handles blocks with timer metrics.
|
|
3471
|
+
*
|
|
3472
|
+
* Uses aspect composer methods:
|
|
3473
|
+
* - .asTimer() - Time tracking (countdown or countup)
|
|
3474
|
+
* Plus specific behaviors for display, output, completion, and sound.
|
|
3475
|
+
*/
|
|
3476
|
+
declare class GenericTimerStrategy implements IRuntimeBlockStrategy {
|
|
3477
|
+
priority: number;
|
|
3478
|
+
readonly id = "generic-timer";
|
|
3479
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3480
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], runtime: IRuntimeContext): void;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
/**
|
|
3484
|
+
* ChildrenStrategy handles blocks with child statements.
|
|
3485
|
+
*
|
|
3486
|
+
* Uses aspect composer methods:
|
|
3487
|
+
* - .asRepeater() - Stores round config for ChildSelectionBehavior
|
|
3488
|
+
* - .asContainer() - Child execution with optional looping (consumes round config)
|
|
3489
|
+
* Plus ExitBehavior in deferred mode for container completion pop.
|
|
3490
|
+
*/
|
|
3491
|
+
declare class ChildrenStrategy implements IRuntimeBlockStrategy {
|
|
3492
|
+
priority: number;
|
|
3493
|
+
readonly id = "children";
|
|
3494
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3495
|
+
apply(builder: BlockBuilder, statements: ICodeStatement[], _runtime: IRuntimeContext): void;
|
|
3496
|
+
}
|
|
3497
|
+
|
|
3498
|
+
/**
|
|
3499
|
+
* ReportOutputStrategy adds output reporting behavior to blocks.
|
|
3500
|
+
*
|
|
3501
|
+
* Uses aspect-based behaviors:
|
|
3502
|
+
* - Output: ReportOutputBehavior
|
|
3503
|
+
*
|
|
3504
|
+
* This is a low-priority enhancement (Priority 15) that adds segment
|
|
3505
|
+
* and milestone reporting if not already added. By running with a low
|
|
3506
|
+
* priority, it ensures the behavior is added AFTER child selection and
|
|
3507
|
+
* round management behaviors, so that round advancement occurs before
|
|
3508
|
+
* milestone emission in the onNext chain.
|
|
3509
|
+
*/
|
|
3510
|
+
declare class ReportOutputStrategy implements IRuntimeBlockStrategy {
|
|
3511
|
+
priority: number;
|
|
3512
|
+
readonly id = "report-output";
|
|
3513
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3514
|
+
apply(builder: BlockBuilder, _statements: ICodeStatement[], _runtime: IRuntimeContext): void;
|
|
3515
|
+
}
|
|
3516
|
+
|
|
3517
|
+
/**
|
|
3518
|
+
* SoundStrategy adds sound cues to timer-based blocks.
|
|
3519
|
+
*
|
|
3520
|
+
* Uses aspect-based behaviors:
|
|
3521
|
+
* - Output: SoundCueBehavior
|
|
3522
|
+
*
|
|
3523
|
+
* This is a low-priority enhancement that adds sound cues
|
|
3524
|
+
* if not already added by a higher-priority strategy.
|
|
3525
|
+
*/
|
|
3526
|
+
declare class SoundStrategy implements IRuntimeBlockStrategy {
|
|
3527
|
+
priority: number;
|
|
3528
|
+
readonly id = "sound";
|
|
3529
|
+
match(statements: ICodeStatement[], _runtime: IRuntimeContext): boolean;
|
|
3530
|
+
apply(builder: BlockBuilder, _statements: ICodeStatement[], _runtime: IRuntimeContext): void;
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
declare class RoundsMetric implements IMetric {
|
|
3534
|
+
count: number | string;
|
|
3535
|
+
readonly value: number | string;
|
|
3536
|
+
readonly image: string;
|
|
3537
|
+
readonly origin: MetricOrigin;
|
|
3538
|
+
constructor(count: number | string);
|
|
3539
|
+
readonly type = MetricType.Rounds;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
2849
3542
|
type EventHandlerRegistration = {
|
|
2850
3543
|
handler: IEventHandler;
|
|
2851
3544
|
ownerId: string;
|
|
@@ -3070,58 +3763,6 @@ declare function mutateTimerSpans(ctx: IBehaviorContext, transform: (spans: Span
|
|
|
3070
3763
|
*/
|
|
3071
3764
|
declare function metricsToLabel(metrics: MetricContainer | IMetric[] | IMetric[][]): string;
|
|
3072
3765
|
|
|
3073
|
-
/**
|
|
3074
|
-
* Configuration for the session root block.
|
|
3075
|
-
*/
|
|
3076
|
-
interface SessionRootConfig {
|
|
3077
|
-
/** Session label (e.g., "Morning WOD") */
|
|
3078
|
-
label?: string;
|
|
3079
|
-
/** Child statement ID groups to execute */
|
|
3080
|
-
childGroups: number[][];
|
|
3081
|
-
/** Total rounds for the workout (default: 1) */
|
|
3082
|
-
totalRounds?: number;
|
|
3083
|
-
}
|
|
3084
|
-
/**
|
|
3085
|
-
* SessionRootBlock is the top-level container for a workout session.
|
|
3086
|
-
*
|
|
3087
|
-
* ## Lifecycle
|
|
3088
|
-
*
|
|
3089
|
-
* 1. Mount: Emits 'segment' output with session label, starts elapsed timer,
|
|
3090
|
-
* pushes WaitingToStart block as first child (index 0)
|
|
3091
|
-
* 2. First next(): WaitingToStart pops → ChildRunner pushes first workout block
|
|
3092
|
-
* 3. Subsequent next(): ChildRunner pushes remaining workout blocks in sequence
|
|
3093
|
-
* 4. Final next(): All children done → marks complete and pops
|
|
3094
|
-
* 5. Pop: emits a 'segment' output carrying the completion reason, records history
|
|
3095
|
-
*
|
|
3096
|
-
* ## Behavior Chain Order
|
|
3097
|
-
*
|
|
3098
|
-
* Behaviors are order-independent for correctness. ChildSelectionBehavior
|
|
3099
|
-
* handles round advancement internally, and RuntimeBlock.next() auto-pops
|
|
3100
|
-
* when any behavior marks the block complete.
|
|
3101
|
-
*
|
|
3102
|
-
* - CountupTimerBehavior (elapsed workout timer)
|
|
3103
|
-
* - ChildSelectionBehavior (child dispatch + round init + advancement + safety net)
|
|
3104
|
-
* - WaitingToStartInjectorBehavior (pushes WaitingToStart gate on mount)
|
|
3105
|
-
* - ReportOutputBehavior (output on mount/unmount)
|
|
3106
|
-
* - LabelingBehavior (display)
|
|
3107
|
-
* - ButtonBehavior (controls)
|
|
3108
|
-
*
|
|
3109
|
-
* History persistence is the responsibility of the workbench — all data
|
|
3110
|
-
* needed for history is available in the output stream (ReportOutputBehavior).
|
|
3111
|
-
*/
|
|
3112
|
-
declare class SessionRootBlock extends RuntimeBlock {
|
|
3113
|
-
constructor(runtime: IRuntimeContext, config: SessionRootConfig);
|
|
3114
|
-
/**
|
|
3115
|
-
* Builds the behavior list for a session root block.
|
|
3116
|
-
* @param config Session configuration
|
|
3117
|
-
* @param runtime Script runtime (needed for WaitingToStartInjectorBehavior)
|
|
3118
|
-
*/
|
|
3119
|
-
static buildBehaviors(config: SessionRootConfig, runtime: IRuntimeContext): IRuntimeBehavior[];
|
|
3120
|
-
mount(runtime: IRuntimeContext, options?: BlockLifecycleOptions): IRuntimeAction[];
|
|
3121
|
-
unmount(runtime: IRuntimeContext, options?: BlockLifecycleOptions): IRuntimeAction[];
|
|
3122
|
-
dispose(runtime: IRuntimeContext): void;
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
3766
|
/**
|
|
3126
3767
|
* EffortBlock Configuration
|
|
3127
3768
|
*/
|
|
@@ -4487,13 +5128,13 @@ declare function toStoredOutputStatement(output: IOutputStatement | OutputStatem
|
|
|
4487
5128
|
* Auto-generated build version metadata.
|
|
4488
5129
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
4489
5130
|
*/
|
|
4490
|
-
declare const VERSION = "0.
|
|
4491
|
-
declare const GIT_SHA = "
|
|
4492
|
-
declare const BUILD_TIME = "2026-08-18T20:
|
|
5131
|
+
declare const VERSION = "0.5.28";
|
|
5132
|
+
declare const GIT_SHA = "8aaaba1";
|
|
5133
|
+
declare const BUILD_TIME = "2026-08-18T20:49:38.789Z";
|
|
4493
5134
|
declare const SEMVER: {
|
|
4494
|
-
readonly version: "0.
|
|
4495
|
-
readonly gitSha: "
|
|
4496
|
-
readonly buildTime: "2026-08-18T20:
|
|
5135
|
+
readonly version: "0.5.28";
|
|
5136
|
+
readonly gitSha: "8aaaba1";
|
|
5137
|
+
readonly buildTime: "2026-08-18T20:49:38.789Z";
|
|
4497
5138
|
};
|
|
4498
5139
|
|
|
4499
|
-
export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILD_TIME, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, 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, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CountdownTimerBehavior, CountupTimerBehavior, 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, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EmitEventAction, EmitSystemOutputAction, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, type ExprNode, type FuzzyCandidate, GIT_SHA, 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, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, JitCompiler, type LapPrimitive, type LineFormScope, type LineLocator, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, 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 PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, RegisterEventHandlerAction, Registry, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, 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, SEMVER, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SnapshotClock, type SoundBehaviorConfig, type SoundCue, type SoundCueState, type SoundState, type SourceInput, type SpanList, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, 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, VERSION, type Val, WaitingToStartBlock, WhiteboardScript, WodDialect, YogaDialect, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, 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, 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, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
|
|
5140
|
+
export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILD_TIME, 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, 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, EmitEventAction, EmitSystemOutputAction, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, type FuzzyCandidate, GIT_SHA, 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, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, 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, 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, SEMVER, 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 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, VERSION, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, 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, 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, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
|