@bitcobblers/wod-wiki-engine 0.44.2159 → 0.45.2166

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,9 +1,9 @@
1
1
  import { IDialect, EventRecord, Note, BlockRevision, BlockIndexRow, Session, AnalyticsDataPoint, StoredOutputStatement, WorkoutResults, ICodeStatement, NoteBlock, BlockEffort, BlockEquipment } from '@bitcobblers/wod-wiki-core';
2
2
  export * from '@bitcobblers/wod-wiki-core';
3
3
  import { IRealtimeProcessor, ISummaryProcessor, IEffort, IScript } from '@bitcobblers/wod-wiki-lang';
4
- export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, AnalyticsProfileContext, AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, CATALOG_PRECEDENCE_RANK, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcDefinition, CalcEngine, CalcOrigin, CalcScope, CalculateBlockProcessor, CalculationDefinition, CalculationRegistry, CardioDialect, CatalogPrecedenceTier, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CompletionDecision, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, DimVector, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortBaseAttributes, EffortDerivation, EffortFallbackStrategy, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, ErrorAction, EventBus, EventCallback, EventHandlerOptions, ExecutionContext, ExecutionStatus, ExitBehavior, ExprNode, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, IAnalyticsEngine, IAnalyticsProcessorDescriptor, IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, ILookupTable, IMemoryLocation, IMemoryReference, IMetricPresentationPolicy, INTENSITY_TIERS, INowProvider, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, IRuntimeBlockStrategy, IRuntimeClock, IRuntimeEventProvider, IRuntimeFactory, IRuntimeMemory, IRuntimeStack, IRuntimeSubscription, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntensityTier, InterceptMode, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LineFormScope, LiteralKind, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MatchMode, MdTimerRuntime, MemoryEntry, MemoryLocation, MemoryTag, MemoryTypeEnum, MetricLine, MetricPresentationSurface, MetricPresentationToken, MetricRenderKind, MetricTone, MetricVisibility, MockClock, NextEvent, OutputEmitter, OutputListener, PRODUCTION_STRATEGIES, PopBlockAction, ProjectionResult, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, ResolvedEffort, ResolvedEffortData, ResolvedTagContributions, RoundState, RoundsMetric, RuntimeAdapter, RuntimeBlock, RuntimeBlockOptions, RuntimeClock, RuntimeController, RuntimeError, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, RuntimeStackOptions, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, ScriptRuntimeDependencies, SegmentWithMetadata, SessionRootStrategy, SnapshotClock, SoundProfile, SoundProfileBehavior, SoundRule, SoundStrategy, SoundTriggerAnchor, SoundTriggerPoint, StackEvent, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, StartSessionOptions, StartWorkoutAction, StatementMetricDiff, SubscribeOptions, SubscriptionManager, TAG_MARKER_PREFIX, TestableBlockConfig, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, VISIBILITY_ICONS, VISIBILITY_LABELS, Val, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
4
+ export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, AnalyticsProfileContext, AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcDefinition, CalcEngine, CalcOrigin, CalcScope, CalculateBlockProcessor, CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CompletionDecision, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, DimVector, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortBaseAttributes, EffortDerivation, EffortFallbackStrategy, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, ErrorAction, EventBus, EventCallback, EventHandlerOptions, ExecutionContext, ExecutionStatus, ExitBehavior, ExprNode, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, IAnalyticsEngine, IAnalyticsProcessorDescriptor, IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, ILookupTable, IMemoryLocation, IMemoryReference, IMetricPresentationPolicy, INTENSITY_TIERS, INowProvider, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, IRuntimeBlockStrategy, IRuntimeClock, IRuntimeEventProvider, IRuntimeFactory, IRuntimeMemory, IRuntimeStack, IRuntimeSubscription, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntensityTier, InterceptMode, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LineFormScope, LiteralKind, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MatchMode, MdTimerRuntime, MemoryEntry, MemoryLocation, MemoryTag, MemoryTypeEnum, MetricLine, MetricPresentationSurface, MetricPresentationToken, MetricRenderKind, MetricTone, MetricVisibility, MockClock, NextEvent, OutputEmitter, OutputListener, PRODUCTION_STRATEGIES, PopBlockAction, ProjectionResult, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, ResolvedEffort, ResolvedEffortData, ResolvedTagContributions, RoundState, RoundsMetric, RuntimeAdapter, RuntimeBlock, RuntimeBlockOptions, RuntimeClock, RuntimeController, RuntimeError, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, RuntimeStackOptions, SEED_PRECEDENCE_RANK, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, ScriptRuntimeDependencies, SeedPrecedenceTier, SegmentWithMetadata, SessionRootStrategy, SnapshotClock, SoundProfile, SoundProfileBehavior, SoundRule, SoundStrategy, SoundTriggerAnchor, SoundTriggerPoint, StackEvent, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, StartSessionOptions, StartWorkoutAction, StatementMetricDiff, SubscribeOptions, SubscriptionManager, TAG_MARKER_PREFIX, TestableBlockConfig, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, VISIBILITY_ICONS, VISIBILITY_LABELS, Val, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
5
5
  import { EventStore } from '@bitcobblers/wod-wiki-wql';
6
- export { Aggregator, AnyParsedQuery, BlockQueryStore, ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, DashboardDocument, DashboardMeta, DashboardToken, DashboardWidget, DefaultNotebookSlug, EffortQueryStore, EventStore, FindOptions, FindPredicate, FindQueryResult, MetricPredicate, NoteQueryStore, NotebookId, PLANNED_WIDGET_TYPES, ParsedAggregateQuery, ParsedFindQuery, ParsedPipelineQuery, ParsedRowsQuery, PipelineSink, PipelineSource, QueryOptions, QueryResult, QueryService, QueryServiceStores, QueryWidgetSuffix, QueryWindow, RowsQueryResult, RowsRun, Series, SeriesPoint, TagFilter, TagValue, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, WqlChartHead, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
6
+ export { Aggregator, AnyParsedQuery, BlockQueryStore, ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, DashboardDocument, DashboardMeta, DashboardToken, DashboardWidget, DefaultNotebookSlug, EffortQueryStore, EventStore, FindOptions, FindPredicate, FindQueryResult, MetricPredicate, NoteQueryStore, NotebookId, PLANNED_WIDGET_TYPES, ParsedAggregateQuery, ParsedFindQuery, ParsedPipelineQuery, ParsedRowsQuery, PipelineSink, PipelineSource, QueryOptions, QueryResult, QueryService, QueryServiceStores, QueryWidgetSuffix, QueryWindow, RowsQueryResult, RowsRun, Series, SeriesPoint, TagFilter, TagValue, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_TYPED_TAG_KEYS, WQL_VIRTUAL_DIMS, WqlChartHead, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
7
7
  import { Session as Session$1, Note as Note$1, IStorage } from '@bitcobblers/wod-wiki-storage';
8
8
 
9
9
  /**
@@ -211,13 +211,13 @@ declare function csvToSessionRows(csv: string): SessionImportRows;
211
211
  * Auto-generated build version metadata.
212
212
  * Do not edit directly; updated by scripts/stamp-version.ts
213
213
  */
214
- declare const VERSION = "0.44.2159";
215
- declare const GIT_SHA = "30e43c7";
216
- declare const BUILD_TIME = "2026-10-24T23:07:22.311Z";
214
+ declare const VERSION = "0.45.2166";
215
+ declare const GIT_SHA = "32bda10";
216
+ declare const BUILD_TIME = "2026-10-26T20:01:09.868Z";
217
217
  declare const SEMVER: {
218
- readonly version: "0.44.2159";
219
- readonly gitSha: "30e43c7";
220
- readonly buildTime: "2026-10-24T23:07:22.311Z";
218
+ readonly version: "0.45.2166";
219
+ readonly gitSha: "32bda10";
220
+ readonly buildTime: "2026-10-26T20:01:09.868Z";
221
221
  };
222
222
 
223
223
  declare const SEED_SCHEMA = 9;
@@ -279,7 +279,6 @@ interface SeedManifest {
279
279
  notebooks?: NotebookIndex[];
280
280
  }
281
281
  type SeedPrecedenceTier = 'core' | 'community' | 'imported' | 'user';
282
- declare const SEED_PRECEDENCE_RANK: Readonly<Record<SeedPrecedenceTier, number>>;
283
282
  declare function seedSourceTier(sourceIdOrMetaKey?: string | null, explicitTier?: SeedPrecedenceTier): SeedPrecedenceTier;
284
283
  declare function seedPrecedenceRank(sourceIdOrMetaKey?: string | null, explicitTier?: SeedPrecedenceTier): number;
285
284
  interface SeedMetaRecord {
@@ -303,10 +302,19 @@ declare const EFFORTS_CHUNK_ID = "efforts";
303
302
  declare const EQUIPMENT_CHUNK_ID = "equipment";
304
303
  declare const CANVAS_CHUNK_ID = "canvas";
305
304
  declare const DASHBOARDS_CHUNK_ID = "dashboards";
306
- declare const TEMPLATE_CHUNK_ID = "template";
307
305
  declare function seedMetaKey(sourceId: string): string;
306
+ /**
307
+ * The feed identifier a checkpoint key names — the key's source id. The
308
+ * checkpoint key keeps its seed spelling (`seed:<id>`, a persisted wire
309
+ * format) and the broadcast channel keeps its own, so a feed's checkpoint
310
+ * IS the checkpoint its id writes.
311
+ */
312
+ declare function feedIdOfMetaKey(metaKey: string): string;
308
313
  declare function emptySeedMeta(key: string): SeedMetaRecord;
309
- declare function catalogForChunkId(chunkId: string): string | undefined;
314
+ /** The notebook slug a notebook chunk id names — `notebook.<slug>`; the
315
+ * `_root` landing (a file directly under `markdown/notebooks/`) names no
316
+ * notebook. */
317
+ declare function notebookSlugForChunkId(chunkId: string): string | undefined;
310
318
  declare function canvasRouteSlug(content: string): string | null;
311
319
  declare function seedNoteSourceId(path: string, content: string, chunkId: string): string | undefined;
312
320
 
@@ -331,9 +339,43 @@ interface SeedChunkResult {
331
339
  updatedNotes: number;
332
340
  }
333
341
  declare function applySeedChunk(storage: IStorage, write: SeedChunkWrite): Promise<SeedChunkResult>;
342
+ /**
343
+ * Stamp feed provenance on notes imported before the feed stamp existed.
344
+ *
345
+ * The checkpoint metadata is the source of truth: every `seed:<sourceId>`
346
+ * checkpoint records the notes its chunks delivered, so the feed that
347
+ * delivered a note is the checkpoint that owns it — no republication and no
348
+ * read-time derivation from the seed stamps.
349
+ *
350
+ * - A note the user owns (`seedOrigin: 'user'`) is never stamped: the
351
+ * user's copy stays the user's.
352
+ * - Content is never rewritten — only the provenance and the revision move.
353
+ * - The stamp advances the note's revision, because the provenance is part
354
+ * of the note: an unchanged revision would let a peer keep its older,
355
+ * unstamped copy (equal revisions merge by arrival order, not by
356
+ * content).
357
+ * - A stamped note is never stamped again: the repair is idempotent.
358
+ *
359
+ * Returns the number of notes stamped.
360
+ */
361
+ declare function backfillFeedProvenance(storage: IStorage): Promise<number>;
362
+ /**
363
+ * One-time migration of the retired collection/feed wire identities to the
364
+ * notebook vocabulary (ticket 12): checkpoint chunk keys, note rows, and the
365
+ * block projections/effort/equipment links that carry source identities.
366
+ *
367
+ * Pure rewrites via the shared `notebookVocabulary` helpers — content is
368
+ * never touched, only addressing. Idempotent: already-migrated rows pass
369
+ * `hasLegacyIdentity`, so a re-run writes nothing. Must run BEFORE the first
370
+ * sync against a notebook-vocabulary manifest: the new chunk ids
371
+ * (`notebook.<slug>`) claim the same notes the old ids (`collection.<slug>`
372
+ * / `feed.<slug>`) delivered, and the checkpoint membership is how ownership
373
+ * is proven. Returns the number of rows rewritten.
374
+ */
375
+ declare function migrateNotebookVocabulary(storage: IStorage): Promise<number>;
334
376
 
335
377
  declare function assertSeedManifest(value: unknown): SeedManifest;
336
378
  declare function assertSeedRows(value: unknown): SeedRow[];
337
379
  declare function assertSeedRow(value: unknown): SeedRow;
338
380
 
339
- export { BUILD_TIME, CANVAS_CHUNK_ID, type ChunkKind, type CorpusIRData, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, type ExecutionLog, GIT_SHA, type IrKind, type LanguagePack, type LanguagePackIdentity, type LanguagePackLangSlice, type LanguagePackUiSlice, type ManifestChunk, type MetricNode, NOTE_ID_FRONTMATTER_KEY, type NoteIdentity, type NotebookIndex, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_PRECEDENCE_RANK, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, type SeedChunkResult, type SeedChunkWrite, type SeedManifest, type SeedMetaRecord, type SeedPrecedenceTier, type SeedRecordRef, type SeedRow, type SessionImportRows, type StatementNode, TEMPLATE_CHUNK_ID, type TypedTagItem, VERSION, type WodWikiIRFile, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, buildStatementTree, canvasRouteSlug, catalogForChunkId, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
381
+ export { BUILD_TIME, CANVAS_CHUNK_ID, type ChunkKind, type CorpusIRData, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, type ExecutionLog, GIT_SHA, type IrKind, type LanguagePack, type LanguagePackIdentity, type LanguagePackLangSlice, type LanguagePackUiSlice, type ManifestChunk, type MetricNode, NOTE_ID_FRONTMATTER_KEY, type NoteIdentity, type NotebookIndex, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, type SeedChunkResult, type SeedChunkWrite, type SeedManifest, type SeedMetaRecord, type SeedRecordRef, type SeedRow, type SessionImportRows, type StatementNode, type TypedTagItem, VERSION, type WodWikiIRFile, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, backfillFeedProvenance, buildStatementTree, canvasRouteSlug, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, feedIdOfMetaKey, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, migrateNotebookVocabulary, notebookSlugForChunkId, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { IDialect, EventRecord, Note, BlockRevision, BlockIndexRow, Session, AnalyticsDataPoint, StoredOutputStatement, WorkoutResults, ICodeStatement, NoteBlock, BlockEffort, BlockEquipment } from '@bitcobblers/wod-wiki-core';
2
2
  export * from '@bitcobblers/wod-wiki-core';
3
3
  import { IRealtimeProcessor, ISummaryProcessor, IEffort, IScript } from '@bitcobblers/wod-wiki-lang';
4
- export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, AnalyticsProfileContext, AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, CATALOG_PRECEDENCE_RANK, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcDefinition, CalcEngine, CalcOrigin, CalcScope, CalculateBlockProcessor, CalculationDefinition, CalculationRegistry, CardioDialect, CatalogPrecedenceTier, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CompletionDecision, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, DimVector, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortBaseAttributes, EffortDerivation, EffortFallbackStrategy, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, ErrorAction, EventBus, EventCallback, EventHandlerOptions, ExecutionContext, ExecutionStatus, ExitBehavior, ExprNode, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, IAnalyticsEngine, IAnalyticsProcessorDescriptor, IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, ILookupTable, IMemoryLocation, IMemoryReference, IMetricPresentationPolicy, INTENSITY_TIERS, INowProvider, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, IRuntimeBlockStrategy, IRuntimeClock, IRuntimeEventProvider, IRuntimeFactory, IRuntimeMemory, IRuntimeStack, IRuntimeSubscription, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntensityTier, InterceptMode, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LineFormScope, LiteralKind, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MatchMode, MdTimerRuntime, MemoryEntry, MemoryLocation, MemoryTag, MemoryTypeEnum, MetricLine, MetricPresentationSurface, MetricPresentationToken, MetricRenderKind, MetricTone, MetricVisibility, MockClock, NextEvent, OutputEmitter, OutputListener, PRODUCTION_STRATEGIES, PopBlockAction, ProjectionResult, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, ResolvedEffort, ResolvedEffortData, ResolvedTagContributions, RoundState, RoundsMetric, RuntimeAdapter, RuntimeBlock, RuntimeBlockOptions, RuntimeClock, RuntimeController, RuntimeError, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, RuntimeStackOptions, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, ScriptRuntimeDependencies, SegmentWithMetadata, SessionRootStrategy, SnapshotClock, SoundProfile, SoundProfileBehavior, SoundRule, SoundStrategy, SoundTriggerAnchor, SoundTriggerPoint, StackEvent, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, StartSessionOptions, StartWorkoutAction, StatementMetricDiff, SubscribeOptions, SubscriptionManager, TAG_MARKER_PREFIX, TestableBlockConfig, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, VISIBILITY_ICONS, VISIBILITY_LABELS, Val, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
4
+ export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsContext, AnalyticsEngine, AnalyticsProfileContext, AnalyticsResult, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BehaviorEventListener, BehaviorEventType, BlockBuilder, BlockContext, BlockLifecycleOptions, ButtonBehavior, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcDefinition, CalcEngine, CalcOrigin, CalcScope, CalculateBlockProcessor, CalculationDefinition, CalculationRegistry, CardioDialect, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CompletionDecision, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, DimVector, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortBaseAttributes, EffortDerivation, EffortFallbackStrategy, EffortRegistrySource, EffortResolutionOptions, EffortResolver, EffortResolverOptions, ErrorAction, EventBus, EventCallback, EventHandlerOptions, ExecutionContext, ExecutionStatus, ExitBehavior, ExprNode, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, IAnalyticsEngine, IAnalyticsProcessorDescriptor, IAnalyticsProfile, IAnchorValue, IBehaviorContext, IBlockContext, ICastSubscription, IEffort, IEffortRegistry, IEffortResolver, IEvent, IEventBus, IEventHandler, IJitCompiler, ILookupTable, IMemoryLocation, IMemoryReference, IMetricPresentationPolicy, INTENSITY_TIERS, INowProvider, IRealtimeProcessor, IRuntimeAction, IRuntimeActionable, IRuntimeBehavior, IRuntimeBlock, IRuntimeBlockStrategy, IRuntimeClock, IRuntimeEventProvider, IRuntimeFactory, IRuntimeMemory, IRuntimeStack, IRuntimeSubscription, IScript, IScriptRuntime, ISummaryProcessor, InMemoryEffortRegistry, IntensityTier, InterceptMode, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LineFormScope, LiteralKind, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MatchMode, MdTimerRuntime, MemoryEntry, MemoryLocation, MemoryTag, MemoryTypeEnum, MetricLine, MetricPresentationSurface, MetricPresentationToken, MetricRenderKind, MetricTone, MetricVisibility, MockClock, NextEvent, OutputEmitter, OutputListener, PRODUCTION_STRATEGIES, PopBlockAction, ProjectionResult, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, ResolvedEffort, ResolvedEffortData, ResolvedTagContributions, RoundState, RoundsMetric, RuntimeAdapter, RuntimeBlock, RuntimeBlockOptions, RuntimeClock, RuntimeController, RuntimeError, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, RuntimeStackOptions, SEED_PRECEDENCE_RANK, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, ScriptRuntimeDependencies, SeedPrecedenceTier, SegmentWithMetadata, SessionRootStrategy, SnapshotClock, SoundProfile, SoundProfileBehavior, SoundRule, SoundStrategy, SoundTriggerAnchor, SoundTriggerPoint, StackEvent, StackListener, StackObserver, StackSnapshot, StandardAnalyticsProfile, StartSessionAction, StartSessionOptions, StartWorkoutAction, StatementMetricDiff, SubscribeOptions, SubscriptionManager, TAG_MARKER_PREFIX, TestableBlockConfig, TimeSpan, TimerState, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, Unsubscribe, VISIBILITY_ICONS, VISIBILITY_LABELS, Val, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
5
5
  import { EventStore } from '@bitcobblers/wod-wiki-wql';
6
- export { Aggregator, AnyParsedQuery, BlockQueryStore, ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, DashboardDocument, DashboardMeta, DashboardToken, DashboardWidget, DefaultNotebookSlug, EffortQueryStore, EventStore, FindOptions, FindPredicate, FindQueryResult, MetricPredicate, NoteQueryStore, NotebookId, PLANNED_WIDGET_TYPES, ParsedAggregateQuery, ParsedFindQuery, ParsedPipelineQuery, ParsedRowsQuery, PipelineSink, PipelineSource, QueryOptions, QueryResult, QueryService, QueryServiceStores, QueryWidgetSuffix, QueryWindow, RowsQueryResult, RowsRun, Series, SeriesPoint, TagFilter, TagValue, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, WqlChartHead, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
6
+ export { Aggregator, AnyParsedQuery, BlockQueryStore, ComparisonOp, DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, DashboardDocument, DashboardMeta, DashboardToken, DashboardWidget, DefaultNotebookSlug, EffortQueryStore, EventStore, FindOptions, FindPredicate, FindQueryResult, MetricPredicate, NoteQueryStore, NotebookId, PLANNED_WIDGET_TYPES, ParsedAggregateQuery, ParsedFindQuery, ParsedPipelineQuery, ParsedRowsQuery, PipelineSink, PipelineSource, QueryOptions, QueryResult, QueryService, QueryServiceStores, QueryWidgetSuffix, QueryWindow, RowsQueryResult, RowsRun, Series, SeriesPoint, TagFilter, TagValue, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_TYPED_TAG_KEYS, WQL_VIRTUAL_DIMS, WqlChartHead, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
7
7
  import { Session as Session$1, Note as Note$1, IStorage } from '@bitcobblers/wod-wiki-storage';
8
8
 
9
9
  /**
@@ -211,13 +211,13 @@ declare function csvToSessionRows(csv: string): SessionImportRows;
211
211
  * Auto-generated build version metadata.
212
212
  * Do not edit directly; updated by scripts/stamp-version.ts
213
213
  */
214
- declare const VERSION = "0.44.2159";
215
- declare const GIT_SHA = "30e43c7";
216
- declare const BUILD_TIME = "2026-10-24T23:07:22.311Z";
214
+ declare const VERSION = "0.45.2166";
215
+ declare const GIT_SHA = "32bda10";
216
+ declare const BUILD_TIME = "2026-10-26T20:01:09.868Z";
217
217
  declare const SEMVER: {
218
- readonly version: "0.44.2159";
219
- readonly gitSha: "30e43c7";
220
- readonly buildTime: "2026-10-24T23:07:22.311Z";
218
+ readonly version: "0.45.2166";
219
+ readonly gitSha: "32bda10";
220
+ readonly buildTime: "2026-10-26T20:01:09.868Z";
221
221
  };
222
222
 
223
223
  declare const SEED_SCHEMA = 9;
@@ -279,7 +279,6 @@ interface SeedManifest {
279
279
  notebooks?: NotebookIndex[];
280
280
  }
281
281
  type SeedPrecedenceTier = 'core' | 'community' | 'imported' | 'user';
282
- declare const SEED_PRECEDENCE_RANK: Readonly<Record<SeedPrecedenceTier, number>>;
283
282
  declare function seedSourceTier(sourceIdOrMetaKey?: string | null, explicitTier?: SeedPrecedenceTier): SeedPrecedenceTier;
284
283
  declare function seedPrecedenceRank(sourceIdOrMetaKey?: string | null, explicitTier?: SeedPrecedenceTier): number;
285
284
  interface SeedMetaRecord {
@@ -303,10 +302,19 @@ declare const EFFORTS_CHUNK_ID = "efforts";
303
302
  declare const EQUIPMENT_CHUNK_ID = "equipment";
304
303
  declare const CANVAS_CHUNK_ID = "canvas";
305
304
  declare const DASHBOARDS_CHUNK_ID = "dashboards";
306
- declare const TEMPLATE_CHUNK_ID = "template";
307
305
  declare function seedMetaKey(sourceId: string): string;
306
+ /**
307
+ * The feed identifier a checkpoint key names — the key's source id. The
308
+ * checkpoint key keeps its seed spelling (`seed:<id>`, a persisted wire
309
+ * format) and the broadcast channel keeps its own, so a feed's checkpoint
310
+ * IS the checkpoint its id writes.
311
+ */
312
+ declare function feedIdOfMetaKey(metaKey: string): string;
308
313
  declare function emptySeedMeta(key: string): SeedMetaRecord;
309
- declare function catalogForChunkId(chunkId: string): string | undefined;
314
+ /** The notebook slug a notebook chunk id names — `notebook.<slug>`; the
315
+ * `_root` landing (a file directly under `markdown/notebooks/`) names no
316
+ * notebook. */
317
+ declare function notebookSlugForChunkId(chunkId: string): string | undefined;
310
318
  declare function canvasRouteSlug(content: string): string | null;
311
319
  declare function seedNoteSourceId(path: string, content: string, chunkId: string): string | undefined;
312
320
 
@@ -331,9 +339,43 @@ interface SeedChunkResult {
331
339
  updatedNotes: number;
332
340
  }
333
341
  declare function applySeedChunk(storage: IStorage, write: SeedChunkWrite): Promise<SeedChunkResult>;
342
+ /**
343
+ * Stamp feed provenance on notes imported before the feed stamp existed.
344
+ *
345
+ * The checkpoint metadata is the source of truth: every `seed:<sourceId>`
346
+ * checkpoint records the notes its chunks delivered, so the feed that
347
+ * delivered a note is the checkpoint that owns it — no republication and no
348
+ * read-time derivation from the seed stamps.
349
+ *
350
+ * - A note the user owns (`seedOrigin: 'user'`) is never stamped: the
351
+ * user's copy stays the user's.
352
+ * - Content is never rewritten — only the provenance and the revision move.
353
+ * - The stamp advances the note's revision, because the provenance is part
354
+ * of the note: an unchanged revision would let a peer keep its older,
355
+ * unstamped copy (equal revisions merge by arrival order, not by
356
+ * content).
357
+ * - A stamped note is never stamped again: the repair is idempotent.
358
+ *
359
+ * Returns the number of notes stamped.
360
+ */
361
+ declare function backfillFeedProvenance(storage: IStorage): Promise<number>;
362
+ /**
363
+ * One-time migration of the retired collection/feed wire identities to the
364
+ * notebook vocabulary (ticket 12): checkpoint chunk keys, note rows, and the
365
+ * block projections/effort/equipment links that carry source identities.
366
+ *
367
+ * Pure rewrites via the shared `notebookVocabulary` helpers — content is
368
+ * never touched, only addressing. Idempotent: already-migrated rows pass
369
+ * `hasLegacyIdentity`, so a re-run writes nothing. Must run BEFORE the first
370
+ * sync against a notebook-vocabulary manifest: the new chunk ids
371
+ * (`notebook.<slug>`) claim the same notes the old ids (`collection.<slug>`
372
+ * / `feed.<slug>`) delivered, and the checkpoint membership is how ownership
373
+ * is proven. Returns the number of rows rewritten.
374
+ */
375
+ declare function migrateNotebookVocabulary(storage: IStorage): Promise<number>;
334
376
 
335
377
  declare function assertSeedManifest(value: unknown): SeedManifest;
336
378
  declare function assertSeedRows(value: unknown): SeedRow[];
337
379
  declare function assertSeedRow(value: unknown): SeedRow;
338
380
 
339
- export { BUILD_TIME, CANVAS_CHUNK_ID, type ChunkKind, type CorpusIRData, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, type ExecutionLog, GIT_SHA, type IrKind, type LanguagePack, type LanguagePackIdentity, type LanguagePackLangSlice, type LanguagePackUiSlice, type ManifestChunk, type MetricNode, NOTE_ID_FRONTMATTER_KEY, type NoteIdentity, type NotebookIndex, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_PRECEDENCE_RANK, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, type SeedChunkResult, type SeedChunkWrite, type SeedManifest, type SeedMetaRecord, type SeedPrecedenceTier, type SeedRecordRef, type SeedRow, type SessionImportRows, type StatementNode, TEMPLATE_CHUNK_ID, type TypedTagItem, VERSION, type WodWikiIRFile, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, buildStatementTree, canvasRouteSlug, catalogForChunkId, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
381
+ export { BUILD_TIME, CANVAS_CHUNK_ID, type ChunkKind, type CorpusIRData, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, type ExecutionLog, GIT_SHA, type IrKind, type LanguagePack, type LanguagePackIdentity, type LanguagePackLangSlice, type LanguagePackUiSlice, type ManifestChunk, type MetricNode, NOTE_ID_FRONTMATTER_KEY, type NoteIdentity, type NotebookIndex, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, type SeedChunkResult, type SeedChunkWrite, type SeedManifest, type SeedMetaRecord, type SeedRecordRef, type SeedRow, type SessionImportRows, type StatementNode, type TypedTagItem, VERSION, type WodWikiIRFile, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, backfillFeedProvenance, buildStatementTree, canvasRouteSlug, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, feedIdOfMetaKey, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, migrateNotebookVocabulary, notebookSlugForChunkId, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { KNOWN_SECTION_WIDGETS, MetricType, validateNoteBlocks, parseDocumentSections, blockContentId, reconcileNoteBlocks, mapNoteBlockChanges } from '@bitcobblers/wod-wiki-core';
2
2
  export * from '@bitcobblers/wod-wiki-core';
3
3
  import { dialectRegistry, realtimeProcessorRegistry, summaryProcessorRegistry, getHints, parseEffortFile, parseEquipmentFile } from '@bitcobblers/wod-wiki-lang';
4
- export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsEngine, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BlockBuilder, ButtonBehavior, CATALOG_PRECEDENCE_RANK, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcEngine, CalculationRegistry, CardioDialect, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortFallbackStrategy, EffortResolver, ErrorAction, EventBus, ExecutionContext, ExitBehavior, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, INTENSITY_TIERS, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MdTimerRuntime, MemoryLocation, MemoryTypeEnum, NextEvent, OutputEmitter, PRODUCTION_STRATEGIES, PopBlockAction, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, RoundsMetric, RuntimeAdapter, RuntimeClock, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, SessionRootStrategy, SnapshotClock, SoundProfileBehavior, SoundStrategy, StandardAnalyticsProfile, StartSessionAction, StartWorkoutAction, SubscriptionManager, TAG_MARKER_PREFIX, TimeSpan, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, VISIBILITY_ICONS, VISIBILITY_LABELS, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
5
- import { WQL_TYPED_TAG_KEYS } from '@bitcobblers/wod-wiki-wql';
6
- export { DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, PLANNED_WIDGET_TYPES, QueryService, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_VIRTUAL_DIMS, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
4
+ export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AmrapLogicStrategy, AnalyticsEngine, AnalyticsTransformer, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BlockBuilder, BlockContext, ButtonBehavior, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcEngine, CalculationRegistry, CardioDialect, ChildSelectionBehavior, ChildrenStrategy, ChoiceGroupMetric, ClimbDialect, ClimbMetricType, CountdownTimerBehavior, CountupTimerBehavior, CrossFitDialect, DEFAULT_RESOLVER_OPTIONS, DEFAULT_RUNTIME_OPTIONS, DEFAULT_SOUND_PROFILE, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DialectStack, EFFORT_DATA_METRIC_TYPE, EFFORT_REGISTRY_ORIGINS, EffortFallbackStrategy, EffortResolver, ErrorAction, EventBus, ExecutionContext, ExitBehavior, FixtureSyntaxError, GenericGroupStrategy, GenericLoopStrategy, GenericTimerStrategy, HabitsDialect, INTENSITY_TIERS, InMemoryEffortRegistry, IntervalLogicStrategy, JitCompiler, LabelingBehavior, LocalRuntimeSubscription, LookupRegistry, MAX_TAG_CONTRIBUTION_DEPTH, MdTimerRuntime, MemoryLocation, MemoryTypeEnum, NextEvent, OutputEmitter, PRODUCTION_STRATEGIES, PopBlockAction, PushBlockAction, RegisterEventHandlerAction, Registry, ReportOutputBehavior, ReportOutputStrategy, RoundsMetric, RuntimeAdapter, RuntimeClock, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, SEED_PRECEDENCE_RANK, SOUND_PLAY_EVENT, SOUND_PROFILE_METRIC, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, SessionRootStrategy, SnapshotClock, SoundProfileBehavior, SoundStrategy, StandardAnalyticsProfile, StartSessionAction, StartWorkoutAction, SubscriptionManager, TAG_MARKER_PREFIX, TimeSpan, TypedMemoryReference, UNITS, UnitsDialect, UnregisterEventHandlerAction, VISIBILITY_ICONS, VISIBILITY_LABELS, WhiteboardScript, WodDialect, YogaDialect, buildTooltip, bundledEfforts, calculateElapsed, canonicalizeType, collapseUnresolvedChoices, compareStatement, compileLineForm, compoundName, computeColumnLabel, computeLabel, createAnalyticsEngineForBlock, createCalcEngine, createCompiler, createDialectStack, createMetricPresentationPolicy, createMockClock, createParser, dedupeEntitiesByPrecedence, dialectRegistry, dialectStack, diffStatement, evaluate, evaluateCalculateDefinitions, extractMetrics, extractStatements, findBestFuzzyMatch, findTagContributionCycles, findUnresolvedChoices, formatSoundTrigger, frozenNow, getAnalyticsFromLogs, getHints, getMetricVisibility, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, isCastSubscription, isChoiceResolved, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, normalizeForFuzzy, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseMetricLine, parseScript, parseSoundTrigger, realtimeProcessorRegistry, renderMetric, resolveEntityRank, resolveEntityTier, resolveProfileRules, resolveSoundProfile, resolveSourceRank, resolveSourceTier, resolveTagContributions, strategyRegistry, summaryProcessorRegistry, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, toStoredOutputStatement, truthy, wallClockNow, whiteboardParser, whiteboardScript, whiteboardScriptLanguage, writeChoiceSelection } from '@bitcobblers/wod-wiki-lang';
5
+ import { WQL_TYPED_TAG_KEYS, migrateLegacyChunkId, hasLegacyIdentity, migrateLegacyRow } from '@bitcobblers/wod-wiki-wql';
6
+ export { DASHBOARD_GRID_MAX_COLS, DASHBOARD_WIDGET_TYPES, DEFAULT_DASHBOARD_TITLE, DEFAULT_NOTEBOOK_SLUGS, PLANNED_WIDGET_TYPES, QueryService, WQL_AGGREGATORS, WQL_CALC_TARGETS, WQL_CHART_HEADS, WQL_COMPARISON_OPS, WQL_CONTENT_FILTER_KEYS, WQL_DISPLAY_UNITS, WQL_FIND_TARGETS, WQL_FUNCTION_HEADS, WQL_GRAINS, WQL_INTENSITY_TIERS, WQL_KEYWORDS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_RESULT_PLANES, WQL_ROLLUP_PERIODS, WQL_SOURCES, WQL_SOURCE_HEADS, WQL_SOURCE_VALUES, WQL_STANDARD_DATASETS, WQL_TAG_KEYS, WQL_TYPED_TAG_KEYS, WQL_VIRTUAL_DIMS, buildDashboardDocument, buildDashboardScaffold, dashboardSlug, defaultTokenValues, extractDashboardTokens, isAggregateQuery, isDashboardMeta, isDashboardWidgetType, isFindQuery, isNoteEditable, isPipelineQuery, normalizeWql, notebookOfItem, notebookSlugFromId, parseQuery, parseQueryWidgetSuffix, parseWqlSuffixes, resolveWidgetType, serialize, splitAtWhere, substituteTokens, toNotebookId, unknownTokensMessage, unknownWidgetTypeMessage, wql, wqlLanguage, wqlParser, wqlTerms } from '@bitcobblers/wod-wiki-wql';
7
7
  import { userDeletedSeedNoteId } from '@bitcobblers/wod-wiki-storage';
8
8
 
9
9
  // src/index.ts
@@ -618,13 +618,13 @@ function csvToSessionRows(csv) {
618
618
  }
619
619
 
620
620
  // src/version.ts
621
- var VERSION = "0.44.2159";
622
- var GIT_SHA = "30e43c7";
623
- var BUILD_TIME = "2026-10-24T23:07:22.311Z";
621
+ var VERSION = "0.45.2166";
622
+ var GIT_SHA = "32bda10";
623
+ var BUILD_TIME = "2026-10-26T20:01:09.868Z";
624
624
  var SEMVER = {
625
- version: "0.44.2159",
626
- gitSha: "30e43c7",
627
- buildTime: "2026-10-24T23:07:22.311Z"
625
+ version: "0.45.2166",
626
+ gitSha: "32bda10",
627
+ buildTime: "2026-10-26T20:01:09.868Z"
628
628
  };
629
629
  var SEED_SCHEMA = 9;
630
630
  var SEED_REGISTERED_WIDGETS = KNOWN_SECTION_WIDGETS;
@@ -652,15 +652,17 @@ var EFFORTS_CHUNK_ID = "efforts";
652
652
  var EQUIPMENT_CHUNK_ID = "equipment";
653
653
  var CANVAS_CHUNK_ID = "canvas";
654
654
  var DASHBOARDS_CHUNK_ID = "dashboards";
655
- var TEMPLATE_CHUNK_ID = "template";
656
655
  function seedMetaKey(sourceId) {
657
656
  return `seed:${sourceId}`;
658
657
  }
658
+ function feedIdOfMetaKey(metaKey) {
659
+ return metaKey.startsWith("seed:") ? metaKey.slice(5) : metaKey;
660
+ }
659
661
  function emptySeedMeta(key) {
660
662
  return { key, schema: SEED_SCHEMA, seedVersion: 0, builtAt: "", importedAt: 0, chunks: {}, claim: null };
661
663
  }
662
- function catalogForChunkId(chunkId) {
663
- const value = /^(?:collection|feed)\.(.+)$/.exec(chunkId)?.[1];
664
+ function notebookSlugForChunkId(chunkId) {
665
+ const value = /^notebook\.(.+)$/.exec(chunkId)?.[1];
664
666
  return value && value !== "_root" ? value : void 0;
665
667
  }
666
668
  function canvasRouteSlug(content) {
@@ -676,12 +678,10 @@ function seedNoteSourceId(path, content, chunkId) {
676
678
  if (chunkId === DASHBOARDS_CHUNK_ID) return "dashboards";
677
679
  if (chunkId === EFFORTS_CHUNK_ID) return "efforts";
678
680
  if (chunkId === EQUIPMENT_CHUNK_ID) return "equipment";
679
- if (chunkId === TEMPLATE_CHUNK_ID) return "playground";
680
- if (chunkId.startsWith("collection.")) {
681
- const catalog = catalogForChunkId(chunkId);
682
- return !catalog ? "collection:_root" : stem.toLowerCase() === "readme" ? `collection:${catalog}` : `collection:${catalog}/${stem}`;
681
+ if (chunkId.startsWith("notebook.")) {
682
+ const slug = notebookSlugForChunkId(chunkId);
683
+ return !slug ? "notebook:_root" : stem.toLowerCase() === "readme" ? `notebook:${slug}` : `notebook:${under}`;
683
684
  }
684
- if (chunkId.startsWith("feed.")) return `feed:feeds/${under}`;
685
685
  return void 0;
686
686
  }
687
687
  function object(value) {
@@ -808,11 +808,12 @@ async function applyDefinitionChunk(defStore, noteStore, parse, family, seedSour
808
808
  return max;
809
809
  };
810
810
  const projections = [];
811
+ const feedSourceId = seedSource;
811
812
  for (const [i, row] of rows.entries()) {
812
813
  if (!owned.has(ids[i])) continue;
813
814
  const parsed = parse(row.content);
814
815
  if (!parsed) continue;
815
- projections.push({ ...parsed, registrySource: "bundled", ownerNoteId: ids[i], sourceId: seedSource, sourcePath: row.path });
816
+ projections.push({ ...parsed, registrySource: "bundled", ownerNoteId: ids[i], sourceId: feedSourceId, sourcePath: row.path });
816
817
  }
817
818
  const prior = await defStore.getMany(projections.map((p) => p.slug));
818
819
  const changed = projections.filter((p, i) => {
@@ -917,6 +918,7 @@ async function applySeedChunk(storage, write) {
917
918
  const stored = await noteStore.getMany(allIds);
918
919
  const existingById = new Map(allIds.map((id, i) => [id, stored[i]]));
919
920
  const seedSource = write.meta.key.startsWith("seed:") ? write.meta.key.slice(5) : write.meta.key;
921
+ const feedSourceId = feedIdOfMetaKey(write.meta.key);
920
922
  const incomingRank = seedPrecedenceRank(write.meta.key, write.meta.tier);
921
923
  const otherCheckpoints = [];
922
924
  for (const row of await metaStore.getAll()) {
@@ -1005,7 +1007,7 @@ async function applySeedChunk(storage, write) {
1005
1007
  date = ts;
1006
1008
  }
1007
1009
  const seedCommit = row.commit ?? write.manifest.commit;
1008
- const note = { ...existing, id, title, rawContent: row.content, sourceRevision, blocks: map, createdAt: write.manifest.version, ...date === void 0 ? {} : { date }, type: write.chunkId === DASHBOARDS_CHUNK_ID ? "dashboard" : "note", sourceId, catalog: catalogForChunkId(write.chunkId ?? ""), seedOrigin: "seed", seedVersion: write.manifest.version, seedChunkId: write.chunkId ?? void 0, sourcePath: row.path, ...seedCommit ? { seedCommit } : {} };
1010
+ const note = { ...existing, id, title, rawContent: row.content, sourceRevision, blocks: map, createdAt: write.manifest.version, ...date === void 0 ? {} : { date }, type: write.chunkId === DASHBOARDS_CHUNK_ID ? "dashboard" : "note", sourceId, seedOrigin: "seed", seedVersion: write.manifest.version, seedChunkId: write.chunkId ?? void 0, feedOrigin: "feed", feedSourceId, sourcePath: row.path, ...seedCommit ? { seedCommit } : {} };
1009
1011
  if (date === void 0) delete note.date;
1010
1012
  if (!equal(note, existing)) changedNotes.push(note);
1011
1013
  const byRange = new Map(Object.values(map).map((b) => [`${b.from}:${b.to}`, b]));
@@ -1092,7 +1094,91 @@ async function applySeedChunk(storage, write) {
1092
1094
  return result;
1093
1095
  });
1094
1096
  }
1097
+ function owningFeed(claims, note) {
1098
+ const byChunk = note.seedChunkId ? claims.filter((claim) => claim.chunkId === note.seedChunkId) : [];
1099
+ const pool = byChunk.length > 0 ? byChunk : claims;
1100
+ return [...pool].sort((a, b) => b.rank - a.rank || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))[0];
1101
+ }
1102
+ async function backfillFeedProvenance(storage) {
1103
+ return await storage.transaction(["meta", "notes", "block_index"], "readwrite", async (tx) => {
1104
+ const metaStore = tx.readwrite("meta");
1105
+ const claims = /* @__PURE__ */ new Map();
1106
+ for (const row of await metaStore.getAll()) {
1107
+ const meta = row;
1108
+ if (!meta || typeof meta.key !== "string" || !meta.key.startsWith("seed:")) continue;
1109
+ const sourceId = meta.key.slice("seed:".length);
1110
+ const rank = seedPrecedenceRank(meta.key, meta.tier);
1111
+ for (const [chunkId, chunk] of Object.entries(meta.chunks ?? {})) {
1112
+ for (const noteId of chunk.noteIds ?? []) {
1113
+ const list = claims.get(noteId) ?? [];
1114
+ list.push({ sourceId, chunkId, rank, key: meta.key });
1115
+ claims.set(noteId, list);
1116
+ }
1117
+ }
1118
+ }
1119
+ if (claims.size === 0) return 0;
1120
+ const noteStore = tx.readwrite("notes");
1121
+ const indexStore = tx.readwrite("block_index");
1122
+ const ids = [...claims.keys()];
1123
+ const stored = await noteStore.getMany(ids);
1124
+ const repaired = [];
1125
+ for (let i = 0; i < ids.length; i++) {
1126
+ const id = ids[i];
1127
+ const note = stored[i];
1128
+ if (!note || note.seedOrigin !== "seed" || note.feedSourceId) continue;
1129
+ const owner = owningFeed(claims.get(id), note);
1130
+ const sourceRevision = note.sourceRevision + 1;
1131
+ const blocks = Object.fromEntries(
1132
+ Object.entries(note.blocks).map(([blockId, block]) => [blockId, { ...block, sourceRevision }])
1133
+ );
1134
+ await noteStore.put({ ...note, blocks, sourceRevision, feedOrigin: "feed", feedSourceId: owner.sourceId });
1135
+ repaired.push({ id, sourceRevision });
1136
+ }
1137
+ if (repaired.length > 0) {
1138
+ const revisions = new Map(repaired.map((entry) => [entry.id, entry.sourceRevision]));
1139
+ const projections = await indexStore.getAllFromIndexMany("by-note", repaired.map((entry) => entry.id));
1140
+ const changed = projections.flatMap((rows) => rows.flatMap((row) => {
1141
+ const revision = revisions.get(row.noteId);
1142
+ return revision !== void 0 && row.sourceRevision !== revision ? [{ ...row, sourceRevision: revision }] : [];
1143
+ }));
1144
+ if (changed.length > 0) await indexStore.putMany(changed);
1145
+ }
1146
+ return repaired.length;
1147
+ });
1148
+ }
1149
+ async function migrateNotebookVocabulary(storage) {
1150
+ return await storage.transaction(["meta", "notes", "block_index", "block_efforts", "block_equipment"], "readwrite", async (tx) => {
1151
+ let migrated = 0;
1152
+ const metaStore = tx.readwrite("meta");
1153
+ for (const row of await metaStore.getAll()) {
1154
+ const meta = row;
1155
+ if (!meta || typeof meta.key !== "string" || !meta.key.startsWith("seed:")) continue;
1156
+ const chunks = meta.chunks ?? {};
1157
+ let renamed = false;
1158
+ const next = {};
1159
+ for (const [chunkId, chunk] of Object.entries(chunks)) {
1160
+ const id = migrateLegacyChunkId(chunkId);
1161
+ if (id !== chunkId) renamed = true;
1162
+ next[id] = next[id] && next[id] !== chunk ? { ...next[id], noteIds: [.../* @__PURE__ */ new Set([...next[id].noteIds ?? [], ...chunk.noteIds ?? []])] } : chunk;
1163
+ }
1164
+ if (renamed) {
1165
+ await metaStore.put({ ...meta, chunks: next });
1166
+ migrated++;
1167
+ }
1168
+ }
1169
+ for (const storeName of ["notes", "block_index", "block_efforts", "block_equipment"]) {
1170
+ const store = tx.readwrite(storeName);
1171
+ for (const row of await store.getAll()) {
1172
+ const record = row;
1173
+ if (!hasLegacyIdentity(record)) continue;
1174
+ await store.put(migrateLegacyRow(record));
1175
+ migrated++;
1176
+ }
1177
+ }
1178
+ return migrated;
1179
+ });
1180
+ }
1095
1181
 
1096
- export { BUILD_TIME, CANVAS_CHUNK_ID, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, GIT_SHA, NOTE_ID_FRONTMATTER_KEY, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_PRECEDENCE_RANK, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, TEMPLATE_CHUNK_ID, VERSION, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, buildStatementTree, canvasRouteSlug, catalogForChunkId, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
1182
+ export { BUILD_TIME, CANVAS_CHUNK_ID, DASHBOARDS_CHUNK_ID, EFFORTS_CHUNK_ID, EQUIPMENT_CHUNK_ID, GIT_SHA, NOTE_ID_FRONTMATTER_KEY, SEED_BROADCAST_CHANNEL, SEED_NAMESPACE, SEED_REGISTERED_WIDGETS, SEED_SCHEMA, SEMVER, SESSION_CSV_HEADER, VERSION, applySeedChunk, assertSeedManifest, assertSeedRow, assertSeedRows, backfillFeedProvenance, buildStatementTree, canvasRouteSlug, composeNoteMarkdown, createIRFile, csvToEquipmentLabels, csvToSessionRows, defineLanguagePack, effortToMarkdown, emptySeedMeta, equipmentToCsv, equipmentToMarkdown, extractNoteIdentity, extractTypedTags, feedIdOfMetaKey, getRegisteredLanguagePacks, inMemoryEventStore, injectIdentityFrontmatter, isIRFile, listLanguagePacks, migrateNotebookVocabulary, notebookSlugForChunkId, parseCsvLine, readFrontmatterMeta, registerLanguagePack, seedMetaKey, seedNoteId, seedNoteSourceId, seedPrecedenceRank, seedSourceTier, sessionToCsv, splitCsvRecords, statementToNode, unregisterLanguagePack };
1097
1183
  //# sourceMappingURL=index.mjs.map
1098
1184
  //# sourceMappingURL=index.mjs.map