Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIScientists Dev WorldSeed frontend display helpers

From Leeroopedia
Knowledge Sources
Domains Frontend, Formatting
Last Updated 2026-10-26 18:00 GMT

Overview

Concrete pure helper functions for display formatting, noise filtering, perception summarization, and raw log HTML building, provided by the WorldSeed frontend.

Description

The helpers module provides pure utility functions: `humanize` replaces underscores with spaces; `esc` escapes HTML via DOM textContent; `formatVal` formats any value for display (arrays, objects, booleans); `formatTime` formats timestamps; `isNoise` detects agent chat noise (hook markers, security notices, heartbeats, prompt injection text); `summarizePerception`/`summarizeActResult` extract human-readable summaries from JSON perception/act results; `buildRawLogHtml` constructs a full HTML chat feed from message arrays, classifying tool calls, thinking blocks, and text bubbles with expandable sections.

Usage

Import these helpers from components that need to format values, filter noise, or render agent session logs — e.g., AgentView uses `buildRawLogHtml` and `summarizePerception`.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: frontend/src/lib/helpers.ts

Signature

export function humanize(s: string): string;
export function esc(s: any): string;
export function formatVal(v: any): string;
export function formatTime(ts: any): string;
export function isNoise(text: string): boolean;
export function summarizePerception(jsonStr: string): string;
export function summarizeActResult(jsonStr: string): string;
export function buildRawLogHtml(messages: any[]): string;

Import

import { humanize, esc, formatVal, isNoise, summarizePerception, buildRawLogHtml } from '@/lib/helpers';

I/O Contract

Inputs

Name Type Required Description
s/v string/any Yes │ Value to format or check
messages any[] Yes (buildRawLogHtml) │ Agent session messages
jsonStr string Yes (summarize) │ JSON string to parse and summarize

Outputs

Name Type Description
formatVal returns string │ Display-formatted value
isNoise returns boolean │ Whether text is agent noise
buildRawLogHtml returns string │ HTML string for chat feed

Usage Examples

import { formatVal, isNoise, buildRawLogHtml } from '@/lib/helpers';

// Format a property value for display
formatVal({ gold: 100, health: 50 });
// "gold: 100, health: 50"

// Filter noise from agent text
if (!isNoise(message)) show(message);

// Build agent session log HTML
const html = buildRawLogHtml(sessionMessages);
container.innerHTML = html;

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment