@bitcobblers/wod-wiki-lang 0.1.3 → 0.1.6
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.cjs +351 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +156 -7
- package/dist/index.d.ts +156 -7
- package/dist/index.mjs +351 -7
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +8 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +8 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11598,6 +11598,350 @@ var PlaySoundAction = class {
|
|
|
11598
11598
|
return runtime.eventBus.dispatch(event, runtime);
|
|
11599
11599
|
}
|
|
11600
11600
|
};
|
|
11601
|
+
|
|
11602
|
+
// src/runtime/utils/MemoryUtils.ts
|
|
11603
|
+
function searchStackMemory(runtime, criteria) {
|
|
11604
|
+
const results = [];
|
|
11605
|
+
if (!runtime.stack || !runtime.stack.blocks) {
|
|
11606
|
+
return results;
|
|
11607
|
+
}
|
|
11608
|
+
for (const block of runtime.stack.blocks) {
|
|
11609
|
+
if (!block.context || !block.context.references) {
|
|
11610
|
+
continue;
|
|
11611
|
+
}
|
|
11612
|
+
const matches = block.context.references.filter((ref) => {
|
|
11613
|
+
if (criteria.id !== void 0 && criteria.id !== null && ref.id !== criteria.id) return false;
|
|
11614
|
+
if (criteria.ownerId !== void 0 && criteria.ownerId !== null && ref.ownerId !== criteria.ownerId) return false;
|
|
11615
|
+
if (criteria.type !== void 0 && criteria.type !== null && ref.type !== criteria.type) return false;
|
|
11616
|
+
if (criteria.visibility !== void 0 && criteria.visibility !== null && ref.visibility !== criteria.visibility) return false;
|
|
11617
|
+
return true;
|
|
11618
|
+
});
|
|
11619
|
+
results.push(...matches);
|
|
11620
|
+
}
|
|
11621
|
+
return results;
|
|
11622
|
+
}
|
|
11623
|
+
|
|
11624
|
+
// src/runtime/adapters/RuntimeAdapter.ts
|
|
11625
|
+
var RuntimeAdapter = class {
|
|
11626
|
+
/**
|
|
11627
|
+
* Creates immutable snapshot of runtime state for UI rendering
|
|
11628
|
+
*/
|
|
11629
|
+
createSnapshot(runtime) {
|
|
11630
|
+
const stackBlocks = this.extractStackBlocks(runtime);
|
|
11631
|
+
const memoryEntries = this.extractMemoryEntries(runtime);
|
|
11632
|
+
const activeIndex = stackBlocks.findIndex((block) => block.isActive);
|
|
11633
|
+
const groupedByOwner = this.groupMemoryEntries(memoryEntries, "owner");
|
|
11634
|
+
const groupedByType = this.groupMemoryEntries(memoryEntries, "type");
|
|
11635
|
+
const status = this.determineExecutionStatus(stackBlocks);
|
|
11636
|
+
return {
|
|
11637
|
+
stack: {
|
|
11638
|
+
blocks: stackBlocks,
|
|
11639
|
+
activeIndex: activeIndex >= 0 ? activeIndex : 0,
|
|
11640
|
+
depth: stackBlocks.length,
|
|
11641
|
+
rootBlockKey: stackBlocks.length > 0 ? stackBlocks[0].key : void 0
|
|
11642
|
+
},
|
|
11643
|
+
memory: {
|
|
11644
|
+
entries: memoryEntries,
|
|
11645
|
+
groupedByOwner,
|
|
11646
|
+
groupedByType,
|
|
11647
|
+
totalEntries: memoryEntries.length
|
|
11648
|
+
},
|
|
11649
|
+
status,
|
|
11650
|
+
metadata: {
|
|
11651
|
+
stepCount: 0,
|
|
11652
|
+
// TODO: Track actual step count
|
|
11653
|
+
elapsedTime: 0,
|
|
11654
|
+
// TODO: Track actual elapsed time
|
|
11655
|
+
lastEvent: void 0,
|
|
11656
|
+
lastEventTime: void 0
|
|
11657
|
+
},
|
|
11658
|
+
timestamp: Date.now()
|
|
11659
|
+
};
|
|
11660
|
+
}
|
|
11661
|
+
/**
|
|
11662
|
+
* Extracts RuntimeStackBlocks from runtime stack
|
|
11663
|
+
*/
|
|
11664
|
+
extractStackBlocks(runtime) {
|
|
11665
|
+
const blocks = runtime.stack.blocks;
|
|
11666
|
+
return blocks.map((block, index) => {
|
|
11667
|
+
const blockType = this.mapBlockType(block);
|
|
11668
|
+
const isActive = index === blocks.length - 1;
|
|
11669
|
+
const status = this.determineBlockStatus(isActive);
|
|
11670
|
+
const metrics = this.extractBlockFragments(runtime, block);
|
|
11671
|
+
const displayLocs = block.getMemoryByTag("metric:display");
|
|
11672
|
+
const metricGroups = displayLocs.length > 1 ? displayLocs.map((loc) => wodWikiCore.MetricContainer.from([...loc.metrics])) : void 0;
|
|
11673
|
+
return {
|
|
11674
|
+
key: block.key.toString(),
|
|
11675
|
+
blockType,
|
|
11676
|
+
parentKey: this.findParentKey(blocks, index),
|
|
11677
|
+
children: this.findChildrenKeys(blocks, block.key.toString()),
|
|
11678
|
+
depth: index,
|
|
11679
|
+
label: block.label || this.generateBlockLabel(blockType),
|
|
11680
|
+
color: this.getBlockColor(blockType),
|
|
11681
|
+
icon: this.getBlockIcon(blockType),
|
|
11682
|
+
isActive,
|
|
11683
|
+
isComplete: status === "complete",
|
|
11684
|
+
status,
|
|
11685
|
+
metric: {},
|
|
11686
|
+
// TODO: Extract actual metrics
|
|
11687
|
+
metrics,
|
|
11688
|
+
metricGroups,
|
|
11689
|
+
sourceIds: block.sourceIds,
|
|
11690
|
+
lineNumber: block.sourceIds.length > 0 ? block.sourceIds[0] : void 0,
|
|
11691
|
+
metadata: {
|
|
11692
|
+
mountTime: void 0,
|
|
11693
|
+
executionTime: void 0,
|
|
11694
|
+
iterationCount: void 0
|
|
11695
|
+
}
|
|
11696
|
+
};
|
|
11697
|
+
});
|
|
11698
|
+
}
|
|
11699
|
+
/**
|
|
11700
|
+
* Extracts metrics from block's source statements for unified visualization
|
|
11701
|
+
*/
|
|
11702
|
+
extractBlockFragments(_runtime, block) {
|
|
11703
|
+
if (!block.sourceIds || block.sourceIds.length === 0) {
|
|
11704
|
+
return void 0;
|
|
11705
|
+
}
|
|
11706
|
+
return void 0;
|
|
11707
|
+
}
|
|
11708
|
+
/**
|
|
11709
|
+
* Extracts MemoryEntries from runtime memory
|
|
11710
|
+
*/
|
|
11711
|
+
extractMemoryEntries(runtime) {
|
|
11712
|
+
const entries = [];
|
|
11713
|
+
const ownerLineMap = /* @__PURE__ */ new Map();
|
|
11714
|
+
const ownerLabelMap = /* @__PURE__ */ new Map();
|
|
11715
|
+
runtime.stack.blocks.forEach((block) => {
|
|
11716
|
+
const key = block.key.toString();
|
|
11717
|
+
if (block.sourceIds && block.sourceIds.length > 0) {
|
|
11718
|
+
ownerLineMap.set(key, block.sourceIds[0]);
|
|
11719
|
+
}
|
|
11720
|
+
ownerLabelMap.set(key, block.label);
|
|
11721
|
+
});
|
|
11722
|
+
for (const block of runtime.stack.blocks) {
|
|
11723
|
+
const blockKey = block.key.toString();
|
|
11724
|
+
const locations = block.getAllMemory();
|
|
11725
|
+
for (const loc of locations) {
|
|
11726
|
+
const tag = loc.tag;
|
|
11727
|
+
const value = loc.metrics.length > 0 ? loc.metrics[0].value : void 0;
|
|
11728
|
+
const memoryType = this.mapMemoryType(tag);
|
|
11729
|
+
const entryId = `${blockKey}-${tag}`;
|
|
11730
|
+
entries.push({
|
|
11731
|
+
id: entryId,
|
|
11732
|
+
ownerId: blockKey,
|
|
11733
|
+
ownerLabel: ownerLabelMap.get(blockKey) ?? blockKey,
|
|
11734
|
+
type: memoryType,
|
|
11735
|
+
value,
|
|
11736
|
+
valueFormatted: this.formatValue(value),
|
|
11737
|
+
label: this.generateMemoryLabelFromType(tag, memoryType),
|
|
11738
|
+
groupLabel: this.generateGroupLabel(memoryType),
|
|
11739
|
+
icon: this.getMemoryIcon(memoryType),
|
|
11740
|
+
lineNumber: ownerLineMap.get(blockKey),
|
|
11741
|
+
isValid: value !== void 0,
|
|
11742
|
+
isHighlighted: false,
|
|
11743
|
+
metadata: {
|
|
11744
|
+
createdAt: void 0,
|
|
11745
|
+
lastModified: void 0,
|
|
11746
|
+
accessCount: void 0
|
|
11747
|
+
},
|
|
11748
|
+
references: [],
|
|
11749
|
+
referencedBy: []
|
|
11750
|
+
});
|
|
11751
|
+
}
|
|
11752
|
+
}
|
|
11753
|
+
const references = searchStackMemory(runtime, {});
|
|
11754
|
+
for (const ref of references) {
|
|
11755
|
+
const existingId = `${ref.ownerId}-${ref.type}`;
|
|
11756
|
+
if (entries.some((e) => e.id === existingId)) {
|
|
11757
|
+
continue;
|
|
11758
|
+
}
|
|
11759
|
+
const value = ref.value();
|
|
11760
|
+
const memoryType = this.mapMemoryType(ref.type);
|
|
11761
|
+
entries.push({
|
|
11762
|
+
id: ref.id,
|
|
11763
|
+
ownerId: ref.ownerId,
|
|
11764
|
+
ownerLabel: ownerLabelMap.get(ref.ownerId) ?? this.generateOwnerLabel(ref.ownerId),
|
|
11765
|
+
type: memoryType,
|
|
11766
|
+
value,
|
|
11767
|
+
valueFormatted: this.formatValue(value),
|
|
11768
|
+
label: this.generateMemoryLabel(ref, memoryType),
|
|
11769
|
+
groupLabel: this.generateGroupLabel(memoryType),
|
|
11770
|
+
icon: this.getMemoryIcon(memoryType),
|
|
11771
|
+
lineNumber: ownerLineMap.get(ref.ownerId),
|
|
11772
|
+
isValid: value !== void 0,
|
|
11773
|
+
isHighlighted: false,
|
|
11774
|
+
metadata: {
|
|
11775
|
+
createdAt: void 0,
|
|
11776
|
+
lastModified: void 0,
|
|
11777
|
+
accessCount: void 0
|
|
11778
|
+
},
|
|
11779
|
+
references: [],
|
|
11780
|
+
referencedBy: []
|
|
11781
|
+
});
|
|
11782
|
+
}
|
|
11783
|
+
return entries;
|
|
11784
|
+
}
|
|
11785
|
+
/**
|
|
11786
|
+
* Generates a label for a memory entry from its type
|
|
11787
|
+
*/
|
|
11788
|
+
generateMemoryLabelFromType(rawType, _displayType) {
|
|
11789
|
+
const typeStr = rawType.toString();
|
|
11790
|
+
return typeStr.charAt(0).toUpperCase() + typeStr.slice(1).replace(/-/g, " ");
|
|
11791
|
+
}
|
|
11792
|
+
/**
|
|
11793
|
+
* Groups memory entries by specified grouping strategy
|
|
11794
|
+
*/
|
|
11795
|
+
groupMemoryEntries(entries, groupBy) {
|
|
11796
|
+
const groups = /* @__PURE__ */ new Map();
|
|
11797
|
+
if (groupBy === "none") {
|
|
11798
|
+
groups.set("All Entries", entries);
|
|
11799
|
+
return groups;
|
|
11800
|
+
}
|
|
11801
|
+
for (const entry of entries) {
|
|
11802
|
+
let groupKey;
|
|
11803
|
+
switch (groupBy) {
|
|
11804
|
+
case "owner":
|
|
11805
|
+
groupKey = entry.ownerLabel || entry.ownerId;
|
|
11806
|
+
break;
|
|
11807
|
+
case "type":
|
|
11808
|
+
groupKey = entry.type;
|
|
11809
|
+
break;
|
|
11810
|
+
default:
|
|
11811
|
+
groupKey = "Unknown";
|
|
11812
|
+
}
|
|
11813
|
+
if (!groups.has(groupKey)) {
|
|
11814
|
+
groups.set(groupKey, []);
|
|
11815
|
+
}
|
|
11816
|
+
groups.get(groupKey).push(entry);
|
|
11817
|
+
}
|
|
11818
|
+
return groups;
|
|
11819
|
+
}
|
|
11820
|
+
// Helper methods
|
|
11821
|
+
determineExecutionStatus(stackBlocks) {
|
|
11822
|
+
if (stackBlocks.length === 0) {
|
|
11823
|
+
return "idle";
|
|
11824
|
+
}
|
|
11825
|
+
const hasActiveBlock = stackBlocks.some((block) => block.isActive);
|
|
11826
|
+
if (hasActiveBlock) {
|
|
11827
|
+
return "executing";
|
|
11828
|
+
}
|
|
11829
|
+
return "idle";
|
|
11830
|
+
}
|
|
11831
|
+
mapBlockType(block) {
|
|
11832
|
+
const blockType = block.blockType?.toLowerCase();
|
|
11833
|
+
switch (blockType) {
|
|
11834
|
+
case "workout":
|
|
11835
|
+
return "workout";
|
|
11836
|
+
case "group":
|
|
11837
|
+
return "group";
|
|
11838
|
+
case "timer":
|
|
11839
|
+
return "timer";
|
|
11840
|
+
case "rounds":
|
|
11841
|
+
return "rounds";
|
|
11842
|
+
case "effort":
|
|
11843
|
+
return "effort";
|
|
11844
|
+
case "exercise":
|
|
11845
|
+
return "exercise";
|
|
11846
|
+
default:
|
|
11847
|
+
return "custom";
|
|
11848
|
+
}
|
|
11849
|
+
}
|
|
11850
|
+
determineBlockStatus(isActive) {
|
|
11851
|
+
if (isActive) {
|
|
11852
|
+
return "active";
|
|
11853
|
+
}
|
|
11854
|
+
return "pending";
|
|
11855
|
+
}
|
|
11856
|
+
findParentKey(blocks, currentIndex) {
|
|
11857
|
+
if (currentIndex === 0) return void 0;
|
|
11858
|
+
return blocks[currentIndex - 1].key.toString();
|
|
11859
|
+
}
|
|
11860
|
+
findChildrenKeys(_blocks, _parentKey) {
|
|
11861
|
+
return [];
|
|
11862
|
+
}
|
|
11863
|
+
generateBlockLabel(blockType) {
|
|
11864
|
+
return `${blockType.charAt(0).toUpperCase() + blockType.slice(1)} Block`;
|
|
11865
|
+
}
|
|
11866
|
+
getBlockColor(blockType) {
|
|
11867
|
+
const colors = {
|
|
11868
|
+
workout: "#3B82F6",
|
|
11869
|
+
// blue
|
|
11870
|
+
group: "#10B981",
|
|
11871
|
+
// green
|
|
11872
|
+
timer: "#F59E0B",
|
|
11873
|
+
// yellow
|
|
11874
|
+
rounds: "#8B5CF6",
|
|
11875
|
+
// purple
|
|
11876
|
+
effort: "#EF4444",
|
|
11877
|
+
// red
|
|
11878
|
+
exercise: "#06B6D4",
|
|
11879
|
+
// cyan
|
|
11880
|
+
custom: "#6B7280"
|
|
11881
|
+
// gray
|
|
11882
|
+
};
|
|
11883
|
+
return colors[blockType];
|
|
11884
|
+
}
|
|
11885
|
+
getBlockIcon(blockType) {
|
|
11886
|
+
const icons = {
|
|
11887
|
+
workout: "\u{1F3CB}\uFE0F",
|
|
11888
|
+
timer: "\u23F1\uFE0F",
|
|
11889
|
+
rounds: "\u{1F504}",
|
|
11890
|
+
exercise: "\u{1F4AA}"
|
|
11891
|
+
};
|
|
11892
|
+
return icons[blockType];
|
|
11893
|
+
}
|
|
11894
|
+
mapMemoryType(type) {
|
|
11895
|
+
if (!type) return "unknown";
|
|
11896
|
+
const lowerType = type.toLowerCase();
|
|
11897
|
+
if (lowerType.includes("metric")) return "metric";
|
|
11898
|
+
if (lowerType.includes("timer")) return "timer-state";
|
|
11899
|
+
if (lowerType.includes("loop")) return "loop-state";
|
|
11900
|
+
if (lowerType.includes("group")) return "group-state";
|
|
11901
|
+
if (lowerType.includes("handler")) return "handler";
|
|
11902
|
+
if (lowerType.includes("span")) return "span";
|
|
11903
|
+
return "unknown";
|
|
11904
|
+
}
|
|
11905
|
+
generateOwnerLabel(ownerId) {
|
|
11906
|
+
return ownerId;
|
|
11907
|
+
}
|
|
11908
|
+
formatValue(value) {
|
|
11909
|
+
if (value === void 0 || value === null) {
|
|
11910
|
+
return "undefined";
|
|
11911
|
+
}
|
|
11912
|
+
if (typeof value === "string") {
|
|
11913
|
+
return `"${value}"`;
|
|
11914
|
+
}
|
|
11915
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
11916
|
+
return value.toString();
|
|
11917
|
+
}
|
|
11918
|
+
if (Array.isArray(value)) {
|
|
11919
|
+
return `Array(${value.length})`;
|
|
11920
|
+
}
|
|
11921
|
+
if (typeof value === "object") {
|
|
11922
|
+
return `{${Object.keys(value).length} properties}`;
|
|
11923
|
+
}
|
|
11924
|
+
return typeof value;
|
|
11925
|
+
}
|
|
11926
|
+
generateMemoryLabel(ref, memoryType) {
|
|
11927
|
+
return `${memoryType}: ${ref.id}`;
|
|
11928
|
+
}
|
|
11929
|
+
generateGroupLabel(memoryType) {
|
|
11930
|
+
return memoryType;
|
|
11931
|
+
}
|
|
11932
|
+
getMemoryIcon(memoryType) {
|
|
11933
|
+
const icons = {
|
|
11934
|
+
metric: "\u{1F4CA}",
|
|
11935
|
+
"timer-state": "\u23F1\uFE0F",
|
|
11936
|
+
"loop-state": "\u{1F504}",
|
|
11937
|
+
"group-state": "\u{1F4C1}",
|
|
11938
|
+
handler: "\u2699\uFE0F",
|
|
11939
|
+
span: "\u{1F4CF}",
|
|
11940
|
+
unknown: "\u2753"
|
|
11941
|
+
};
|
|
11942
|
+
return icons[memoryType];
|
|
11943
|
+
}
|
|
11944
|
+
};
|
|
11601
11945
|
function formatMetricLabel(key) {
|
|
11602
11946
|
return key.charAt(0).toUpperCase() + key.slice(1).replace(/_/g, " ");
|
|
11603
11947
|
}
|
|
@@ -12766,13 +13110,13 @@ function toStoredOutputStatement(output) {
|
|
|
12766
13110
|
}
|
|
12767
13111
|
|
|
12768
13112
|
// src/version.ts
|
|
12769
|
-
var VERSION = "0.1.
|
|
12770
|
-
var GIT_SHA = "
|
|
12771
|
-
var BUILD_TIME = "2026-08-18T18:
|
|
13113
|
+
var VERSION = "0.1.6";
|
|
13114
|
+
var GIT_SHA = "9c5467d";
|
|
13115
|
+
var BUILD_TIME = "2026-08-18T18:12:54.408Z";
|
|
12772
13116
|
var SEMVER = {
|
|
12773
|
-
version: "0.1.
|
|
12774
|
-
gitSha: "
|
|
12775
|
-
buildTime: "2026-08-18T18:
|
|
13117
|
+
version: "0.1.6",
|
|
13118
|
+
gitSha: "9c5467d",
|
|
13119
|
+
buildTime: "2026-08-18T18:12:54.408Z"
|
|
12776
13120
|
};
|
|
12777
13121
|
|
|
12778
13122
|
exports.AbortSessionAction = AbortSessionAction;
|
|
@@ -12835,6 +13179,7 @@ exports.PushRestBlockAction = PushRestBlockAction;
|
|
|
12835
13179
|
exports.RegisterEventHandlerAction = RegisterEventHandlerAction;
|
|
12836
13180
|
exports.Registry = Registry;
|
|
12837
13181
|
exports.RestBlock = RestBlock;
|
|
13182
|
+
exports.RuntimeAdapter = RuntimeAdapter;
|
|
12838
13183
|
exports.RuntimeBlock = RuntimeBlock;
|
|
12839
13184
|
exports.RuntimeBuilder = RuntimeBuilder;
|
|
12840
13185
|
exports.RuntimeClock = RuntimeClock;
|