@bitcobblers/wod-wiki-lang 0.37.2137 → 0.37.2140

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/index.d.cts 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
+ import { R as ReferenceIndex, a as ReferenceResolutionDefaults, W as WhiteboardScript, I as IEquipment, b as IEffort, c as IEffortResolver, d as IEffortRegistry, E as EffortResolverOptions, e as EffortResolutionOptions, f as ResolvedEffort, g as EffortRegistrySource, h as EffortStorageAdapter, i as IRuntimeActionable, j as IEventBus, k as IRuntimeStack, l as IRuntimeClock, m as IJitCompiler, n as INowProvider, o as RuntimeStackOptions, p as RuntimeError, A as AnalyticsContext, q as IEvent, r as IRuntimeAction, O as OutputListener, U as Unsubscribe, s as IAnalyticsEngine, t as IRuntimeBlock, u as IBehaviorContext, B as BehaviorEventType, v as BehaviorEventListener, S as SubscribeOptions, w as Unsubscribe$1, x as OutputOptions, M as MemoryTag, y as IMemoryLocation, z as IRuntimeBehavior, C as IBlockContext, D as MetricVisibility, F as BlockLifecycleOptions, G as CompletionDecision, T as TimeSpan, H as IRuntimeMemory, J as TypedMemoryReference, K as MemorySearchCriteria, L as IMemoryReference, N as RuntimeStackLogger, P as StackObserver, Q as StackSnapshot, V as StackListener, X as MemoryTypeEnum, Y as IAnchorValue, Z as ButtonConfig, _ as IEventHandler, $ as HandlerScope, a0 as IScriptRuntime, a1 as TestableBlockConfig, a2 as IRuntimeOptions, a3 as ScriptRuntime, a4 as EventHandlerOptions, a5 as EventCallback, a6 as TimerState, a7 as IRealtimeProcessor, a8 as ISummaryProcessor, a9 as ProjectionResult } from './browserRuntimeNow-M4hQ_DTl.cjs';
4
+ export { aa as ButtonVariant, ab as ButtonsState, ac as CATALOG_PRECEDENCE_RANK, ad as CatalogPrecedenceTier, ae as ChildrenStatusState, af as CompletionState, ag as DEFAULT_RESOLVER_OPTIONS, ah as DEFAULT_RUNTIME_OPTIONS, ai as DISCIPLINE_FACTORS, aj as DisplayState, ak as EFFORT_DISCIPLINES, al as EFFORT_REGISTRY_ORIGINS, am as EffortBaseAttributes, an as EffortDerivation, ao as EffortDiscipline, ap as EffortMaterializer, aq as EffortResolvedFrom, ar as EquipmentStorageAdapter, as as FenceDialect, at as FragmentDisplayState, au as FragmentState, av as IAnalyticsProcessorDescriptor, aw as IEquipmentRegistry, ax as INTENSITY_TIERS, ay as IScript, az as IntensityTier, aA as InterceptMode, aB as MemoryLocation, aC as MemoryType, aD as MemoryTypeMap, aE as MemoryValueOf, aF as ReferenceCatalog, aG as ResolvedReferences, aH as RoundState, aI as RuntimeState, aJ as ScriptRuntimeDependencies, aK as StackEvent, aL as TimerDirection, aM as VISIBILITY_ICONS, aN as VISIBILITY_LABELS, aO as createBrowserRuntimeNow, aP as createReferenceIndex, aQ as dedupeEntitiesByPrecedence, aR as disciplineFactorFor, aS as extractStatementRefs, aT as filterTagsByVisibility, aU as frozenNow, aV as getMetricVisibility, aW as getRuntimeNowMs, aX as isEffortDiscipline, aY as isFragmentTag, aZ as resolveEntityRank, a_ as resolveEntityTier, a$ as resolveSourceRank, b0 as resolveSourceTier, b1 as slugifyRefLabel, b2 as wallClockNow } from './browserRuntimeNow-M4hQ_DTl.cjs';
3
5
  import { Tree } from '@lezer/common';
4
- import { W as WhiteboardScript, I as IEffortResolver, a as IEffortRegistry, E as EffortResolverOptions, b as IEffort, c as EffortResolutionOptions, R as ResolvedEffort, d as EffortRegistrySource, e as EffortStorageAdapter, f as IRuntimeActionable, g as IEventBus, h as IRuntimeStack, i as IRuntimeClock, j as IJitCompiler, k as INowProvider, l as RuntimeStackOptions, m as RuntimeError, A as AnalyticsContext, n as IEvent, o as IRuntimeAction, O as OutputListener, U as Unsubscribe, p as IAnalyticsEngine, q as IRuntimeBlock, r as IBehaviorContext, B as BehaviorEventType, s as BehaviorEventListener, S as SubscribeOptions, t as Unsubscribe$1, u as OutputOptions, M as MemoryTag, v as IMemoryLocation, w as IRuntimeBehavior, x as IBlockContext, y as MetricVisibility, z as BlockLifecycleOptions, C as CompletionDecision, T as TimeSpan, D as IRuntimeMemory, F as TypedMemoryReference, G as MemorySearchCriteria, H as IMemoryReference, J as RuntimeStackLogger, K as StackObserver, L as StackSnapshot, N as StackListener, P as MemoryTypeEnum, Q as IAnchorValue, V as ButtonConfig, X as IEventHandler, Y as HandlerScope, Z as IScriptRuntime, _ as TestableBlockConfig, $ as IRuntimeOptions, a0 as ScriptRuntime, a1 as EventHandlerOptions, a2 as EventCallback, a3 as TimerState, a4 as IRealtimeProcessor, a5 as ISummaryProcessor, a6 as ProjectionResult } from './browserRuntimeNow-CoR7dCNU.cjs';
5
- export { a7 as ButtonVariant, a8 as ButtonsState, a9 as ChildrenStatusState, aa as CompletionState, ab as DEFAULT_RESOLVER_OPTIONS, ac as DEFAULT_RUNTIME_OPTIONS, ad as DISCIPLINE_FACTORS, ae as DisplayState, af as EFFORT_DISCIPLINES, ag as EFFORT_REGISTRY_ORIGINS, ah as EffortBaseAttributes, ai as EffortDerivation, aj as EffortDiscipline, ak as EffortResolvedFrom, al as FenceDialect, am as FragmentDisplayState, an as FragmentState, ao as IAnalyticsProcessorDescriptor, ap as INTENSITY_TIERS, aq as IScript, ar as IntensityTier, as as InterceptMode, at as MemoryLocation, au as MemoryType, av as MemoryTypeMap, aw as MemoryValueOf, ax as RoundState, ay as RuntimeState, az as ScriptRuntimeDependencies, aA as StackEvent, aB as TimerDirection, aC as VISIBILITY_ICONS, aD as VISIBILITY_LABELS, aE as createBrowserRuntimeNow, aF as disciplineFactorFor, aG as filterTagsByVisibility, aH as frozenNow, aI as getMetricVisibility, aJ as getRuntimeNowMs, aK as isEffortDiscipline, aL as isFragmentTag, aM as wallClockNow } from './browserRuntimeNow-CoR7dCNU.cjs';
6
6
  import { LanguageSupport, LRLanguage } from '@codemirror/language';
7
7
  import { LRParser } from '@lezer/lr';
8
8
 
@@ -595,7 +595,7 @@ interface MetricObjectPrimitive extends BasePrimitive {
595
595
  kind: 'metric_object';
596
596
  pairs: Array<{
597
597
  key: string;
598
- value: string | number | boolean | null;
598
+ value: string | number | boolean | null | string[];
599
599
  }>;
600
600
  }
601
601
  interface LapPrimitive extends BasePrimitive {
@@ -668,7 +668,12 @@ interface SyntaxFacts {
668
668
  statements: SyntaxStatement[];
669
669
  }
670
670
 
671
- declare function classifyStatements(facts: SyntaxFacts): ParsedCodeStatement[];
671
+ /** Parser-level reference configuration: shared index + note-level defaults. */
672
+ interface ParseReferences {
673
+ index: ReferenceIndex;
674
+ defaults?: ReferenceResolutionDefaults;
675
+ }
676
+ declare function classifyStatements(facts: SyntaxFacts, references?: ParseReferences): ParsedCodeStatement[];
672
677
 
673
678
  /** Helper to compute line and column numbers from offset without EditorState */
674
679
  interface LineLocator {
@@ -705,7 +710,7 @@ type SourceInput = string | {
705
710
  * Inline rounds normalization still runs here so every parser entrypoint —
706
711
  * with or without dialects — produces the same deterministic Statement tree.
707
712
  */
708
- declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree): ICodeStatement[];
713
+ declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree, references?: ParseReferences): ICodeStatement[];
709
714
  /**
710
715
  * Extracts WhiteboardScript statements from source or Lezer tree.
711
716
  *
@@ -716,13 +721,17 @@ declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree)
716
721
  * @param sport - The block's `:sport` fence suffix (` ```log:climbing `).
717
722
  * Omitted → the full registry stack runs. See {@link DialectStack.dialectsFor}.
718
723
  */
719
- declare function extractStatements(sourceOrTree: SourceInput, sportOrTree?: string | Tree, sportArg?: string): ICodeStatement[];
724
+ declare function extractStatements(sourceOrTree: SourceInput, sportOrTree?: string | Tree, sportArg?: string, references?: ParseReferences): ICodeStatement[];
720
725
 
721
726
  interface ParseOptions {
722
727
  dialect?: string;
723
728
  sport?: string;
724
729
  strict?: boolean;
725
730
  withoutDialects?: boolean;
731
+ /** Shared reference index (createReferenceIndex output) — canonical effort/equipment refs at parse time. */
732
+ references?: ReferenceIndex;
733
+ /** Note-level `metrics.*` defaults applied by the resolver. */
734
+ defaults?: ReferenceResolutionDefaults;
726
735
  }
727
736
  /**
728
737
  * Parses Whiteboard Script source directly into a WhiteboardScript AST
@@ -733,10 +742,17 @@ interface ParseOptions {
733
742
  */
734
743
  declare function parseScript(inputText: string, options?: ParseOptions): WhiteboardScript;
735
744
 
745
+ /** Parser construction config: shared reference index + note-level defaults. */
746
+ interface ParserConfig {
747
+ references?: ReferenceIndex;
748
+ defaults?: ReferenceResolutionDefaults;
749
+ }
736
750
  /**
737
751
  * Headless parser facade using the Lezer parser with 0 DOM / EditorState overhead.
738
752
  */
739
753
  declare class MdTimerRuntime {
754
+ private readonly config?;
755
+ constructor(config?: ParserConfig);
740
756
  /**
741
757
  * Parse WhiteboardScript source into a {@link WhiteboardScript}, running the
742
758
  * Dialect Stack on every statement.
@@ -751,17 +767,102 @@ declare class MdTimerRuntime {
751
767
  readWithoutDialects(inputText: string): WhiteboardScript;
752
768
  }
753
769
 
754
- declare function createParser(): MdTimerRuntime;
755
770
  /**
756
- * @deprecated Use createParser() instead.
771
+ * Create a parser instance. Pass `{ references: createReferenceIndex(catalog), defaults }`
772
+ * to resolve canonical effort/equipment refs at parse time.
757
773
  */
758
- declare const sharedParser: MdTimerRuntime;
774
+ declare function createParser(config?: ParserConfig): MdTimerRuntime;
759
775
 
760
776
  declare const whiteboardScriptLanguage: LRLanguage;
761
777
  declare function whiteboardScript(): LanguageSupport;
762
778
 
763
779
  declare const parser: LRParser;
764
780
 
781
+ /**
782
+ * Definition markdown — the shared effort/equipment document format.
783
+ *
784
+ * A definition document is YAML frontmatter + a markdown body. Efforts use
785
+ * the nested canonical shape (`baseAttributes`, optional `hints`/`derivation`,
786
+ * optional `equipment` slug list); equipment documents carry `type: equipment`
787
+ * plus identity fields. This module is the single home of the format — both
788
+ * the seed/CLI parse direction and the app edit conversion (`documentToEffort`
789
+ * diagnostics + `effortToDocument` serialization) — so hosts cannot drift.
790
+ *
791
+ * Unknown top-level frontmatter fields are deliberately NOT carried on the
792
+ * effort record: the note's raw source stays their home (saves commit raw
793
+ * content verbatim); smuggling them through the projection resurfaces
794
+ * persistence fields as user YAML. Single-property edits use the source-
795
+ * preserving core `patchFrontmatterProperty` instead.
796
+ *
797
+ * ponytail: hand-rolled subset YAML (flat scalars, block lists, two nested
798
+ * levels) instead of a real YAML dependency — same ceiling as the app/engine
799
+ * parsers this replaces; upgrade path is one shared micro-parser here.
800
+ */
801
+
802
+ /**
803
+ * Read a nested (`key:` followed by indented entries) section from frontmatter
804
+ * lines. Two levels are supported (`derivation.coefficients.*`).
805
+ *
806
+ * Boundary rule: the block ends at the next non-indented (top-level) line.
807
+ */
808
+ declare function readNestedSection(lines: string[], key: string): Record<string, unknown> | undefined;
809
+ /**
810
+ * Parse a bundled effort markdown file into an IEffort (null when malformed).
811
+ *
812
+ * Rejects: missing frontmatter, missing/invalid id-slug-label identity,
813
+ * a `baseAttributes.met` that is not finite and positive, a `type`
814
+ * discriminator other than `effort` (equipment definitions are not efforts),
815
+ * and malformed `aliases`/`equipment` arrays — malformed never silently
816
+ * becomes empty.
817
+ */
818
+ declare function parseEffortFile(raw: string): IEffort | null;
819
+ /**
820
+ * Parse an equipment definition markdown file into an IEquipment (null when
821
+ * malformed). Requires the `type: equipment` discriminator plus valid identity
822
+ * (`id`, canonical `slug`, non-blank `label`); effort fields are neither
823
+ * required nor rejected.
824
+ */
825
+ declare function parseEquipmentFile(raw: string): IEquipment | null;
826
+ interface ParseResult {
827
+ effort: IEffort;
828
+ errors: string[];
829
+ }
830
+ /**
831
+ * Parse a YAML-frontmatter markdown document back into an IEffort with
832
+ * per-field diagnostics (the editor's invalid-draft path — callers show
833
+ * `errors` and must not persist while it is non-empty).
834
+ *
835
+ * Falls back to `baseEffort` for edit-mode fields the document leaves absent
836
+ * (id, registrySource, met, equipment, hints). An explicit `equipment: []`
837
+ * clears the relation instead of falling back. Met must be a finite positive
838
+ * number — including when it arrives via the fallback.
839
+ */
840
+ declare function documentToEffort(doc: string, baseEffort?: IEffort): ParseResult;
841
+ /**
842
+ * Convert an IEffort into a YAML-frontmatter markdown document. Emits exactly
843
+ * the document-format fields — persistence/ownership fields on the record
844
+ * (createdAt-style owner note/source ids) are never serialized as YAML.
845
+ */
846
+ declare function effortToDocument(effort: IEffort): string;
847
+ interface EquipmentParseResult {
848
+ equipment: IEquipment;
849
+ errors: string[];
850
+ }
851
+ /**
852
+ * Parse a YAML-frontmatter equipment document back into an IEquipment with
853
+ * per-field diagnostics (callers show `errors` and must not persist while
854
+ * non-empty). Requires the `type: equipment` discriminator, canonical-slug
855
+ * identity and well-formed `aliases`; unknown top-level fields stay in the
856
+ * raw source (never carried on the record).
857
+ */
858
+ declare function documentToEquipment(doc: string, baseEquipment?: IEquipment): EquipmentParseResult;
859
+ /**
860
+ * Convert an IEquipment into a YAML-frontmatter markdown document. Emits
861
+ * exactly the document-format fields — ownership fields (ownerNoteId/
862
+ * sourceId/sourcePath) are never serialized as YAML.
863
+ */
864
+ declare function equipmentToDocument(equipment: IEquipment): string;
865
+
765
866
  /**
766
867
  * Effort Resolver — Analytics Boundary
767
868
  *
@@ -846,6 +947,13 @@ declare class CompositeEffortRegistry implements IEffortRegistry {
846
947
  * Initialize the registry:
847
948
  * 1. Load bundled efforts into memory
848
949
  * 2. Load user efforts from storage adapter into memory
950
+ *
951
+ * An explicit `customBundled` REPLACES the bundled tier — passing an empty
952
+ * set clears it — so a seed source removal never leaves stale bundled
953
+ * efforts cached. The no-argument call keeps the constructor/default set.
954
+ * Both tiers rebuild only AFTER a successful adapter load: a failed load
955
+ * propagates (readiness must never report over stale data), and deleted
956
+ * custom rows disappear because the user map is cleared too.
849
957
  */
850
958
  loadBundled(customBundled?: Iterable<IEffort>): Promise<void>;
851
959
  /** True after loadBundled() has resolved */
@@ -4569,6 +4677,8 @@ interface CreateAnalyticsEngineResult {
4569
4677
  }
4570
4678
  interface CreateAnalyticsEngineOptions {
4571
4679
  effortResolver?: IEffortResolver;
4680
+ /** Shared reference index — canonical effort/equipment resolution for enrichment. */
4681
+ references?: ReferenceIndex;
4572
4682
  userProfile?: {
4573
4683
  vo2max?: number;
4574
4684
  };
@@ -5289,4 +5399,4 @@ declare function diffStatement(expected: MetricLine[], actual: readonly IMetric[
5289
5399
  */
5290
5400
  declare function compareStatement(expectations: MetricLine[], actual: readonly IMetric[], mode: MatchMode): string[];
5291
5401
 
5292
- export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, type CalculationDefinition$1 as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcEvalError, type CalcLine, type CalcNode, type CalcOrigin, CalcParseError, CalcRegistrationError, type CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, type CalcVariant, type CalculationDefinition as CalculateBlockDefinition, type CalculateBlockParseError, type CalculateBlockParseResult, CalculateBlockProcessor, type CalculationDefinition$1 as CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, CompositeEffortRegistry, type CompositeEffortRegistryOptions, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, type DayRollup, DialectStack, type DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, type ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, type ParseOptions, PlaySoundAction, PopBlockAction, type PredefinedSoundName, ProjectionResult, type PromotionRule, type PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, type SoundBehaviorConfig, type SoundCue, SoundCueBehavior, type SoundCueConfig, type SoundCueState, type SoundState, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addAliasToEffort, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, dimEquals, evaluate, evaluateCalculateDefinitions, extractEffortData, extractMetrics, extractStatements, extractStatementsRaw, extractSyntaxFacts, findBestFuzzyMatch, findUnresolvedChoices, fixtureBackSquat, fixtureBurpee, fixturePlank, fixtureRowing, fixtureRunning, fixtureUserCustom, fixtureUserOverride, formatDim, formatDuration, metricsToLabel as fragmentsToLabel, fullFixtureSet, fuseUnits, fuseUnitsInMetrics, getAnalyticsFromLogs, getAnalyticsFromRuntime, getHints, getUnit, hasHint, hintMetric, hintsToContainer, inferDim, isCastSubscription, isChoiceResolved, isDimensionless, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, mutateTimerSpans, normalizeForFuzzy, num, openSpan, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
5402
+ export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, type CalculationDefinition$1 as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcEvalError, type CalcLine, type CalcNode, type CalcOrigin, CalcParseError, CalcRegistrationError, type CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, type CalcVariant, type CalculationDefinition as CalculateBlockDefinition, type CalculateBlockParseError, type CalculateBlockParseResult, CalculateBlockProcessor, type CalculationDefinition$1 as CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, CompositeEffortRegistry, type CompositeEffortRegistryOptions, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, type DayRollup, DialectStack, type DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, type EquipmentParseResult, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEquipment, IEvent, IEventBus, IEventHandler, IJitCompiler, type ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, type ParseOptions, type ParseReferences, type ParseResult, type ParserConfig, PlaySoundAction, PopBlockAction, type PredefinedSoundName, ProjectionResult, type PromotionRule, type PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, ReferenceIndex, ReferenceResolutionDefaults, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, type SoundBehaviorConfig, type SoundCue, SoundCueBehavior, type SoundCueConfig, type SoundCueState, type SoundState, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addAliasToEffort, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, dimEquals, documentToEffort, documentToEquipment, effortToDocument, equipmentToDocument, 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, parseEffortFile, parseEquipmentFile, parseExpression, parseMetricLine, parseScript, printCalculation, readNestedSection, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
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
+ import { R as ReferenceIndex, a as ReferenceResolutionDefaults, W as WhiteboardScript, I as IEquipment, b as IEffort, c as IEffortResolver, d as IEffortRegistry, E as EffortResolverOptions, e as EffortResolutionOptions, f as ResolvedEffort, g as EffortRegistrySource, h as EffortStorageAdapter, i as IRuntimeActionable, j as IEventBus, k as IRuntimeStack, l as IRuntimeClock, m as IJitCompiler, n as INowProvider, o as RuntimeStackOptions, p as RuntimeError, A as AnalyticsContext, q as IEvent, r as IRuntimeAction, O as OutputListener, U as Unsubscribe, s as IAnalyticsEngine, t as IRuntimeBlock, u as IBehaviorContext, B as BehaviorEventType, v as BehaviorEventListener, S as SubscribeOptions, w as Unsubscribe$1, x as OutputOptions, M as MemoryTag, y as IMemoryLocation, z as IRuntimeBehavior, C as IBlockContext, D as MetricVisibility, F as BlockLifecycleOptions, G as CompletionDecision, T as TimeSpan, H as IRuntimeMemory, J as TypedMemoryReference, K as MemorySearchCriteria, L as IMemoryReference, N as RuntimeStackLogger, P as StackObserver, Q as StackSnapshot, V as StackListener, X as MemoryTypeEnum, Y as IAnchorValue, Z as ButtonConfig, _ as IEventHandler, $ as HandlerScope, a0 as IScriptRuntime, a1 as TestableBlockConfig, a2 as IRuntimeOptions, a3 as ScriptRuntime, a4 as EventHandlerOptions, a5 as EventCallback, a6 as TimerState, a7 as IRealtimeProcessor, a8 as ISummaryProcessor, a9 as ProjectionResult } from './browserRuntimeNow-M4hQ_DTl.js';
4
+ export { aa as ButtonVariant, ab as ButtonsState, ac as CATALOG_PRECEDENCE_RANK, ad as CatalogPrecedenceTier, ae as ChildrenStatusState, af as CompletionState, ag as DEFAULT_RESOLVER_OPTIONS, ah as DEFAULT_RUNTIME_OPTIONS, ai as DISCIPLINE_FACTORS, aj as DisplayState, ak as EFFORT_DISCIPLINES, al as EFFORT_REGISTRY_ORIGINS, am as EffortBaseAttributes, an as EffortDerivation, ao as EffortDiscipline, ap as EffortMaterializer, aq as EffortResolvedFrom, ar as EquipmentStorageAdapter, as as FenceDialect, at as FragmentDisplayState, au as FragmentState, av as IAnalyticsProcessorDescriptor, aw as IEquipmentRegistry, ax as INTENSITY_TIERS, ay as IScript, az as IntensityTier, aA as InterceptMode, aB as MemoryLocation, aC as MemoryType, aD as MemoryTypeMap, aE as MemoryValueOf, aF as ReferenceCatalog, aG as ResolvedReferences, aH as RoundState, aI as RuntimeState, aJ as ScriptRuntimeDependencies, aK as StackEvent, aL as TimerDirection, aM as VISIBILITY_ICONS, aN as VISIBILITY_LABELS, aO as createBrowserRuntimeNow, aP as createReferenceIndex, aQ as dedupeEntitiesByPrecedence, aR as disciplineFactorFor, aS as extractStatementRefs, aT as filterTagsByVisibility, aU as frozenNow, aV as getMetricVisibility, aW as getRuntimeNowMs, aX as isEffortDiscipline, aY as isFragmentTag, aZ as resolveEntityRank, a_ as resolveEntityTier, a$ as resolveSourceRank, b0 as resolveSourceTier, b1 as slugifyRefLabel, b2 as wallClockNow } from './browserRuntimeNow-M4hQ_DTl.js';
3
5
  import { Tree } from '@lezer/common';
4
- import { W as WhiteboardScript, I as IEffortResolver, a as IEffortRegistry, E as EffortResolverOptions, b as IEffort, c as EffortResolutionOptions, R as ResolvedEffort, d as EffortRegistrySource, e as EffortStorageAdapter, f as IRuntimeActionable, g as IEventBus, h as IRuntimeStack, i as IRuntimeClock, j as IJitCompiler, k as INowProvider, l as RuntimeStackOptions, m as RuntimeError, A as AnalyticsContext, n as IEvent, o as IRuntimeAction, O as OutputListener, U as Unsubscribe, p as IAnalyticsEngine, q as IRuntimeBlock, r as IBehaviorContext, B as BehaviorEventType, s as BehaviorEventListener, S as SubscribeOptions, t as Unsubscribe$1, u as OutputOptions, M as MemoryTag, v as IMemoryLocation, w as IRuntimeBehavior, x as IBlockContext, y as MetricVisibility, z as BlockLifecycleOptions, C as CompletionDecision, T as TimeSpan, D as IRuntimeMemory, F as TypedMemoryReference, G as MemorySearchCriteria, H as IMemoryReference, J as RuntimeStackLogger, K as StackObserver, L as StackSnapshot, N as StackListener, P as MemoryTypeEnum, Q as IAnchorValue, V as ButtonConfig, X as IEventHandler, Y as HandlerScope, Z as IScriptRuntime, _ as TestableBlockConfig, $ as IRuntimeOptions, a0 as ScriptRuntime, a1 as EventHandlerOptions, a2 as EventCallback, a3 as TimerState, a4 as IRealtimeProcessor, a5 as ISummaryProcessor, a6 as ProjectionResult } from './browserRuntimeNow-CoR7dCNU.js';
5
- export { a7 as ButtonVariant, a8 as ButtonsState, a9 as ChildrenStatusState, aa as CompletionState, ab as DEFAULT_RESOLVER_OPTIONS, ac as DEFAULT_RUNTIME_OPTIONS, ad as DISCIPLINE_FACTORS, ae as DisplayState, af as EFFORT_DISCIPLINES, ag as EFFORT_REGISTRY_ORIGINS, ah as EffortBaseAttributes, ai as EffortDerivation, aj as EffortDiscipline, ak as EffortResolvedFrom, al as FenceDialect, am as FragmentDisplayState, an as FragmentState, ao as IAnalyticsProcessorDescriptor, ap as INTENSITY_TIERS, aq as IScript, ar as IntensityTier, as as InterceptMode, at as MemoryLocation, au as MemoryType, av as MemoryTypeMap, aw as MemoryValueOf, ax as RoundState, ay as RuntimeState, az as ScriptRuntimeDependencies, aA as StackEvent, aB as TimerDirection, aC as VISIBILITY_ICONS, aD as VISIBILITY_LABELS, aE as createBrowserRuntimeNow, aF as disciplineFactorFor, aG as filterTagsByVisibility, aH as frozenNow, aI as getMetricVisibility, aJ as getRuntimeNowMs, aK as isEffortDiscipline, aL as isFragmentTag, aM as wallClockNow } from './browserRuntimeNow-CoR7dCNU.js';
6
6
  import { LanguageSupport, LRLanguage } from '@codemirror/language';
7
7
  import { LRParser } from '@lezer/lr';
8
8
 
@@ -595,7 +595,7 @@ interface MetricObjectPrimitive extends BasePrimitive {
595
595
  kind: 'metric_object';
596
596
  pairs: Array<{
597
597
  key: string;
598
- value: string | number | boolean | null;
598
+ value: string | number | boolean | null | string[];
599
599
  }>;
600
600
  }
601
601
  interface LapPrimitive extends BasePrimitive {
@@ -668,7 +668,12 @@ interface SyntaxFacts {
668
668
  statements: SyntaxStatement[];
669
669
  }
670
670
 
671
- declare function classifyStatements(facts: SyntaxFacts): ParsedCodeStatement[];
671
+ /** Parser-level reference configuration: shared index + note-level defaults. */
672
+ interface ParseReferences {
673
+ index: ReferenceIndex;
674
+ defaults?: ReferenceResolutionDefaults;
675
+ }
676
+ declare function classifyStatements(facts: SyntaxFacts, references?: ParseReferences): ParsedCodeStatement[];
672
677
 
673
678
  /** Helper to compute line and column numbers from offset without EditorState */
674
679
  interface LineLocator {
@@ -705,7 +710,7 @@ type SourceInput = string | {
705
710
  * Inline rounds normalization still runs here so every parser entrypoint —
706
711
  * with or without dialects — produces the same deterministic Statement tree.
707
712
  */
708
- declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree): ICodeStatement[];
713
+ declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree, references?: ParseReferences): ICodeStatement[];
709
714
  /**
710
715
  * Extracts WhiteboardScript statements from source or Lezer tree.
711
716
  *
@@ -716,13 +721,17 @@ declare function extractStatementsRaw(sourceOrTree: SourceInput, treeArg?: Tree)
716
721
  * @param sport - The block's `:sport` fence suffix (` ```log:climbing `).
717
722
  * Omitted → the full registry stack runs. See {@link DialectStack.dialectsFor}.
718
723
  */
719
- declare function extractStatements(sourceOrTree: SourceInput, sportOrTree?: string | Tree, sportArg?: string): ICodeStatement[];
724
+ declare function extractStatements(sourceOrTree: SourceInput, sportOrTree?: string | Tree, sportArg?: string, references?: ParseReferences): ICodeStatement[];
720
725
 
721
726
  interface ParseOptions {
722
727
  dialect?: string;
723
728
  sport?: string;
724
729
  strict?: boolean;
725
730
  withoutDialects?: boolean;
731
+ /** Shared reference index (createReferenceIndex output) — canonical effort/equipment refs at parse time. */
732
+ references?: ReferenceIndex;
733
+ /** Note-level `metrics.*` defaults applied by the resolver. */
734
+ defaults?: ReferenceResolutionDefaults;
726
735
  }
727
736
  /**
728
737
  * Parses Whiteboard Script source directly into a WhiteboardScript AST
@@ -733,10 +742,17 @@ interface ParseOptions {
733
742
  */
734
743
  declare function parseScript(inputText: string, options?: ParseOptions): WhiteboardScript;
735
744
 
745
+ /** Parser construction config: shared reference index + note-level defaults. */
746
+ interface ParserConfig {
747
+ references?: ReferenceIndex;
748
+ defaults?: ReferenceResolutionDefaults;
749
+ }
736
750
  /**
737
751
  * Headless parser facade using the Lezer parser with 0 DOM / EditorState overhead.
738
752
  */
739
753
  declare class MdTimerRuntime {
754
+ private readonly config?;
755
+ constructor(config?: ParserConfig);
740
756
  /**
741
757
  * Parse WhiteboardScript source into a {@link WhiteboardScript}, running the
742
758
  * Dialect Stack on every statement.
@@ -751,17 +767,102 @@ declare class MdTimerRuntime {
751
767
  readWithoutDialects(inputText: string): WhiteboardScript;
752
768
  }
753
769
 
754
- declare function createParser(): MdTimerRuntime;
755
770
  /**
756
- * @deprecated Use createParser() instead.
771
+ * Create a parser instance. Pass `{ references: createReferenceIndex(catalog), defaults }`
772
+ * to resolve canonical effort/equipment refs at parse time.
757
773
  */
758
- declare const sharedParser: MdTimerRuntime;
774
+ declare function createParser(config?: ParserConfig): MdTimerRuntime;
759
775
 
760
776
  declare const whiteboardScriptLanguage: LRLanguage;
761
777
  declare function whiteboardScript(): LanguageSupport;
762
778
 
763
779
  declare const parser: LRParser;
764
780
 
781
+ /**
782
+ * Definition markdown — the shared effort/equipment document format.
783
+ *
784
+ * A definition document is YAML frontmatter + a markdown body. Efforts use
785
+ * the nested canonical shape (`baseAttributes`, optional `hints`/`derivation`,
786
+ * optional `equipment` slug list); equipment documents carry `type: equipment`
787
+ * plus identity fields. This module is the single home of the format — both
788
+ * the seed/CLI parse direction and the app edit conversion (`documentToEffort`
789
+ * diagnostics + `effortToDocument` serialization) — so hosts cannot drift.
790
+ *
791
+ * Unknown top-level frontmatter fields are deliberately NOT carried on the
792
+ * effort record: the note's raw source stays their home (saves commit raw
793
+ * content verbatim); smuggling them through the projection resurfaces
794
+ * persistence fields as user YAML. Single-property edits use the source-
795
+ * preserving core `patchFrontmatterProperty` instead.
796
+ *
797
+ * ponytail: hand-rolled subset YAML (flat scalars, block lists, two nested
798
+ * levels) instead of a real YAML dependency — same ceiling as the app/engine
799
+ * parsers this replaces; upgrade path is one shared micro-parser here.
800
+ */
801
+
802
+ /**
803
+ * Read a nested (`key:` followed by indented entries) section from frontmatter
804
+ * lines. Two levels are supported (`derivation.coefficients.*`).
805
+ *
806
+ * Boundary rule: the block ends at the next non-indented (top-level) line.
807
+ */
808
+ declare function readNestedSection(lines: string[], key: string): Record<string, unknown> | undefined;
809
+ /**
810
+ * Parse a bundled effort markdown file into an IEffort (null when malformed).
811
+ *
812
+ * Rejects: missing frontmatter, missing/invalid id-slug-label identity,
813
+ * a `baseAttributes.met` that is not finite and positive, a `type`
814
+ * discriminator other than `effort` (equipment definitions are not efforts),
815
+ * and malformed `aliases`/`equipment` arrays — malformed never silently
816
+ * becomes empty.
817
+ */
818
+ declare function parseEffortFile(raw: string): IEffort | null;
819
+ /**
820
+ * Parse an equipment definition markdown file into an IEquipment (null when
821
+ * malformed). Requires the `type: equipment` discriminator plus valid identity
822
+ * (`id`, canonical `slug`, non-blank `label`); effort fields are neither
823
+ * required nor rejected.
824
+ */
825
+ declare function parseEquipmentFile(raw: string): IEquipment | null;
826
+ interface ParseResult {
827
+ effort: IEffort;
828
+ errors: string[];
829
+ }
830
+ /**
831
+ * Parse a YAML-frontmatter markdown document back into an IEffort with
832
+ * per-field diagnostics (the editor's invalid-draft path — callers show
833
+ * `errors` and must not persist while it is non-empty).
834
+ *
835
+ * Falls back to `baseEffort` for edit-mode fields the document leaves absent
836
+ * (id, registrySource, met, equipment, hints). An explicit `equipment: []`
837
+ * clears the relation instead of falling back. Met must be a finite positive
838
+ * number — including when it arrives via the fallback.
839
+ */
840
+ declare function documentToEffort(doc: string, baseEffort?: IEffort): ParseResult;
841
+ /**
842
+ * Convert an IEffort into a YAML-frontmatter markdown document. Emits exactly
843
+ * the document-format fields — persistence/ownership fields on the record
844
+ * (createdAt-style owner note/source ids) are never serialized as YAML.
845
+ */
846
+ declare function effortToDocument(effort: IEffort): string;
847
+ interface EquipmentParseResult {
848
+ equipment: IEquipment;
849
+ errors: string[];
850
+ }
851
+ /**
852
+ * Parse a YAML-frontmatter equipment document back into an IEquipment with
853
+ * per-field diagnostics (callers show `errors` and must not persist while
854
+ * non-empty). Requires the `type: equipment` discriminator, canonical-slug
855
+ * identity and well-formed `aliases`; unknown top-level fields stay in the
856
+ * raw source (never carried on the record).
857
+ */
858
+ declare function documentToEquipment(doc: string, baseEquipment?: IEquipment): EquipmentParseResult;
859
+ /**
860
+ * Convert an IEquipment into a YAML-frontmatter markdown document. Emits
861
+ * exactly the document-format fields — ownership fields (ownerNoteId/
862
+ * sourceId/sourcePath) are never serialized as YAML.
863
+ */
864
+ declare function equipmentToDocument(equipment: IEquipment): string;
865
+
765
866
  /**
766
867
  * Effort Resolver — Analytics Boundary
767
868
  *
@@ -846,6 +947,13 @@ declare class CompositeEffortRegistry implements IEffortRegistry {
846
947
  * Initialize the registry:
847
948
  * 1. Load bundled efforts into memory
848
949
  * 2. Load user efforts from storage adapter into memory
950
+ *
951
+ * An explicit `customBundled` REPLACES the bundled tier — passing an empty
952
+ * set clears it — so a seed source removal never leaves stale bundled
953
+ * efforts cached. The no-argument call keeps the constructor/default set.
954
+ * Both tiers rebuild only AFTER a successful adapter load: a failed load
955
+ * propagates (readiness must never report over stale data), and deleted
956
+ * custom rows disappear because the user map is cleared too.
849
957
  */
850
958
  loadBundled(customBundled?: Iterable<IEffort>): Promise<void>;
851
959
  /** True after loadBundled() has resolved */
@@ -4569,6 +4677,8 @@ interface CreateAnalyticsEngineResult {
4569
4677
  }
4570
4678
  interface CreateAnalyticsEngineOptions {
4571
4679
  effortResolver?: IEffortResolver;
4680
+ /** Shared reference index — canonical effort/equipment resolution for enrichment. */
4681
+ references?: ReferenceIndex;
4572
4682
  userProfile?: {
4573
4683
  vo2max?: number;
4574
4684
  };
@@ -5289,4 +5399,4 @@ declare function diffStatement(expected: MetricLine[], actual: readonly IMetric[
5289
5399
  */
5290
5400
  declare function compareStatement(expectations: MetricLine[], actual: readonly IMetric[], mode: MatchMode): string[];
5291
5401
 
5292
- export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, type CalculationDefinition$1 as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcEvalError, type CalcLine, type CalcNode, type CalcOrigin, CalcParseError, CalcRegistrationError, type CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, type CalcVariant, type CalculationDefinition as CalculateBlockDefinition, type CalculateBlockParseError, type CalculateBlockParseResult, CalculateBlockProcessor, type CalculationDefinition$1 as CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, CompositeEffortRegistry, type CompositeEffortRegistryOptions, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, type DayRollup, DialectStack, type DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, type ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, type ParseOptions, PlaySoundAction, PopBlockAction, type PredefinedSoundName, ProjectionResult, type PromotionRule, type PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, type SoundBehaviorConfig, type SoundCue, SoundCueBehavior, type SoundCueConfig, type SoundCueState, type SoundState, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addAliasToEffort, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, dimEquals, evaluate, evaluateCalculateDefinitions, extractEffortData, extractMetrics, extractStatements, extractStatementsRaw, extractSyntaxFacts, findBestFuzzyMatch, findUnresolvedChoices, fixtureBackSquat, fixtureBurpee, fixturePlank, fixtureRowing, fixtureRunning, fixtureUserCustom, fixtureUserOverride, formatDim, formatDuration, metricsToLabel as fragmentsToLabel, fullFixtureSet, fuseUnits, fuseUnitsInMetrics, getAnalyticsFromLogs, getAnalyticsFromRuntime, getHints, getUnit, hasHint, hintMetric, hintsToContainer, inferDim, isCastSubscription, isChoiceResolved, isDimensionless, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, mutateTimerSpans, normalizeForFuzzy, num, openSpan, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };
5402
+ export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, type ActionDescriptor, type ActionPrimitive, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, type AnalyticsProfileContext, type AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, type BinaryOp, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, ButtonConfig, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, type CalcAnalysis, type CalculationDefinition$1 as CalcDefinition, type CalcDiagnostic, CalcEngine, type CalcEngineDeps, CalcEvalError, type CalcLine, type CalcNode, type CalcOrigin, CalcParseError, CalcRegistrationError, type CalcScope, type CalcStack, type CalcStackOptions, type UnitDef as CalcUnitDef, CalcUnitError, type CalcVariant, type CalculationDefinition as CalculateBlockDefinition, type CalculateBlockParseError, type CalculateBlockParseResult, CalculateBlockProcessor, type CalculationDefinition$1 as CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, type ChildSelectionConfig, type ChildSelectionLoopCondition, ChildrenStrategy, ChoiceGroupMetric, ClearChildrenAction, ClimbDialect, type ClimbGradeMetricValue, type ClimbGradeSystem, ClimbMetricType, CompileAndPushBlockAction, type CompiledLineForm, CompletionDecision, CompletionTimestampBehavior, CompositeEffortRegistry, type CompositeEffortRegistryOptions, type ControlsConfig, type CountdownMode, CountdownTimerBehavior, type CountdownTimerConfig, CountupTimerBehavior, type CountupTimerConfig, type CreateAnalyticsEngineOptions, type CreateAnalyticsEngineResult, CrossFitDialect, DAY, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, type DayRollup, DialectStack, type DimVector, type Dimension, type DurationPrimitive, EFFORT_DATA_METRIC_TYPE, EffortBlock, type EffortBlockConfig, EffortFallbackStrategy, type EffortPrimitive, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, EffortStorageAdapter, EmitEventAction, EmitSystemOutputAction, type EquipmentParseResult, ErrorAction, type EvalContext, EventBus, EventCallback, EventHandlerOptions, type EventHandlerRegistration, ExecutionContext, type ExecutionSnapshot, type ExecutionStatus, ExitBehavior, type ExitConfig, type ExprNode, FixtureSyntaxError, type FuzzyCandidate, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, type HeadingPrimitive, IAnalyticsEngine, type IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, type ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEquipment, IEvent, IEventBus, IEventHandler, IJitCompiler, type ILookupTable, IMemoryLocation, IMemoryReference, type IMetricPresentationPolicy, INowProvider, type IProfileSource, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, type IRuntimeBlockStrategy, IRuntimeClock, type IRuntimeEventProvider, type IRuntimeFactory, IRuntimeMemory, IRuntimeStack, type IRuntimeSubscription, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, type LabelingConfig, type LapPrimitive, type LineFormScope, type LineLocator, type LiteralKind, LocalEventProvider, LocalRuntimeSubscription, type LogLevel, type LookupFieldDef, type LookupLayer, LookupRegistry, type MatchMode, MdTimerRuntime, type MemoryEntry, MemoryTag, MemoryTypeEnum, type MetricLine, type MetricObjectPrimitive, type MetricPresentationSurface, type MetricPresentationToken, MetricPromotionBehavior, type MetricPromotionConfig, type MetricRenderKind, type MetricTone, MetricVisibility, type MockClock, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, OutputListener, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, type ParseOptions, type ParseReferences, type ParseResult, type ParserConfig, PlaySoundAction, PopBlockAction, type PredefinedSoundName, ProjectionResult, type PromotionRule, type PropertyPrimitive, PushBlockAction, PushRestBlockAction, type QuantityPrimitive, REST_EXCLUSION, RPE_LABELS, ReferenceIndex, ReferenceResolutionDefaults, RegisterEventHandlerAction, Registry, ReportOutputBehavior, type ReportOutputConfig, ReportOutputStrategy, ResolvedEffort, type ResolvedEffortData, RestBlock, type RestBlockConfig, type RoundSchemePrimitive, RoundsMetric, type RoundsPrimitive, RuntimeAdapter, RuntimeBlock, type RuntimeBlockOptions, RuntimeBuilder, type RuntimeButton, RuntimeClock, type RuntimeController, type RuntimeControls, RuntimeError, RuntimeFactory, type RuntimeLogEntry, RuntimeLogger, RuntimeMemory, type RuntimeMemoryLocation, RuntimeObservers, RuntimeStack, RuntimeStackOptions, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, type SegmentWithMetadata, SessionRootBlock, type SessionRootConfig, SessionRootStrategy, SnapshotClock, type SoundBehaviorConfig, type SoundCue, SoundCueBehavior, type SoundCueConfig, type SoundCueState, type SoundState, SoundStrategy, type SourceInput, type SpanList, SpanTrackingBehavior, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, type StartSessionOptions, StartWorkoutAction, type StartWorkoutOptions, type StatementMetricDiff, type StaticEnv, type StreamAtomDef, SubscribeOptions, SubscriptionManager, type SyntaxFacts, type SyntaxMeta, type SyntaxPrimitive, type SyntaxStatement, TestableBlockConfig, type TextPrimitive, ThrowError, ThrowErrorAction, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, type UnitDef$1 as UnitDef, type UnitMatch, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, UpdateNextPreviewAction, type Val, WaitingToStartBlock, WaitingToStartInjectorBehavior, WhiteboardScript, WodDialect, YogaDialect, addAliasToEffort, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, checkCalcLine, classifyStatements, closeCurrentSpan, collapseUnresolvedChoices, commonFixtureSet, compareStatement, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, diffStatement, dimEquals, documentToEffort, documentToEquipment, effortToDocument, equipmentToDocument, 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, parseEffortFile, parseEquipmentFile, parseExpression, parseMetricLine, parseScript, printCalculation, readNestedSection, readTimer, realtimeProcessorRegistry, renderMetric, resolveDominantOrigin, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection };