moon run examples/insertion_sort > insertion-sort.html
moon run examples/union_find > union-find.html
moon run examples/pathfinding_trace > pathfinding.html
# 原有教学示例仍可运行
moon run examples/maze_bfs
moon run examples/weighted_astar
moon run examples/compare
FrontierLab records algorithm semantics and complete visual scenes in MoonBit. An algorithm emits events such as Compare, Swap, Union, or Relax and snapshots a sequence, set, graph, or grid. The same trace can then become an offline interactive HTML player, deterministic SVG frames, or portable JSON.
The original pathfinding APIs remain compatible. BFS, Dijkstra, and A* now serve as a flagship adapter alongside insertion sort and Union-Find.
moon check --target all --deny-warn
moon build --target all --deny-warn
moon fmt --check
moon info
git diff --exit-code
moon test --target all --deny-warn
moon fmt --deny-warn and moon info --deny-warn are not valid MoonBit commands in the current documented toolchain. CI therefore uses moon fmt --check and moon info && git diff --exit-code as the reviewable equivalents.
The repository includes CI, generated interfaces, executable examples, an offline trace playground, a Pages deployment workflow, schema fixtures, an MIT license, contribution guidance, and mooncakes publishing metadata.
FrontierLab
A semantic time-travel debugger for MoonBit algorithms and AI-generated traces.
中文 · English · Live demo · Playground · GitHub · Gitlink · Trace schema
中文
FrontierLab 不是另一个算法合集,也不是通用绘图库。它为 MoonBit 算法提供统一的语义事件 + 场景快照协议,并在其上提供时间旅行调试:算法记录
Compare、Swap、Visit、Union、Relax等事件;开发者或 AI Agent 可以设置语义断点、比较相邻场景、执行过程 contract、定位第一次分歧并导出最小反例。为什么值得用
analyze()可在渲染前统计事件、目标引用、对象规模和完成状态。diff()、语义断点和 trace slice 可定位某个逻辑实体第一次发生异常的步骤。五分钟体验
无需安装即可打开在线 Playground,拖入或粘贴 schema-v1 JSON,完成校验、质量诊断、分析、回放和 SVG 导出。所有处理均在浏览器本地完成。
浏览器直接打开生成的 HTML,即可使用播放、暂停、时间轴、速度控制以及左右方向键。
把任意算法接入可视化
完整接入方式见 docs/INTEGRATION.md。
渲染前分析 trace
验证 AI 生成的算法过程
内置能力
AlgorithmTrace/AlgorithmTraceStep:版本化 trace 文档与不可变步骤快照。TargetRef:使用对象 ID + 可选实体 ID,消除跨对象同名实体歧义。encode_json/decode_json/validate:稳定 schema-v1 双向协议与完整验证。TraceEvent:初始化、比较、交换、访问、更新、合并、松弛、完成及自定义事件。SceneObject:Sequence、Sets、Graph、Grid。Highlight/Annotation:统一视觉角色、教学说明和伪代码行号。render_trace_html:自包含、响应式、支持深浅主题的交互播放器。render_trace_playground:自包含的 trace 导入、校验、分析、回放与 SVG 导出工作台。TraceFrameDiff/TraceBreakpoint/TraceCounterexample:场景差异、语义断点和最小反例。TraceContract/ContractReport:可扩展过程验证与机器可读诊断。first_divergence:定位参考 trace 与实际 trace 第一次事件或场景分歧。render_trace_svg/render_trace_svg_frames:单帧与批量确定性 SVG。TraceStats/EventCount/ObjectUsage/TargetUsage:事件统计、对象规模和目标引用分析。insertion_sort_trace/union_find_trace:可复用算法适配器,不只是内置 demo。search_trace_to_algorithm_trace:原有路径搜索 trace 的兼容适配器。旗舰示例
与相邻项目的区别
AlgorithmTraceJSON 可继续接入课程、IDE、评测平台或视频生成工具。English
FrontierLab records algorithm semantics and complete visual scenes in MoonBit. An algorithm emits events such as
Compare,Swap,Union, orRelaxand snapshots a sequence, set, graph, or grid. The same trace can then become an offline interactive HTML player, deterministic SVG frames, or portable JSON.The original pathfinding APIs remain compatible. BFS, Dijkstra, and A* now serve as a flagship adapter alongside insertion sort and Union-Find.
Public API map
TraceBuilder::new,record,finishAlgorithmTrace,TraceEvent,Scene,SceneObjectSequenceState,SetState,GraphState,GridStateHighlight,HighlightRole,Annotationrender_trace_html,render_trace_svg,render_trace_svg_framesrender_trace_playgroundAlgorithmTrace::diff,breakpoint_hits,slice,first_divergenceTraceContract::check,sequence_transition_contract,insertion_sort_int_contract,grid_path_contractAlgorithmTrace::analyze,summary_report,event_counts,target_usageinsertion_sort_trace,union_find_trace,search_trace_to_algorithm_traceDevelopment and release readiness
moon fmt --deny-warnandmoon info --deny-warnare not valid MoonBit commands in the current documented toolchain. CI therefore usesmoon fmt --checkandmoon info && git diff --exit-codeas the reviewable equivalents.The repository includes CI, generated interfaces, executable examples, an offline trace playground, a Pages deployment workflow, schema fixtures, an MIT license, contribution guidance, and mooncakes publishing metadata.
Documentation
License
MIT