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 stream format

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

Overview

Concrete stream record formatting module defining hidden kind sets, display group mappings, free-text extraction, effect formatting, and CSS class assignment, provided by the WorldSeed frontend.

Description

The stream-format module is the single source of truth for stream record presentation. `HIDDEN_KINDS`/`DIGEST_HIDDEN_KINDS`/`STORY_HIDDEN_KINDS` define which record kinds are filtered per view mode. `KIND_DISPLAY` maps raw kinds to display groups for filter chips (e.g. `dm_call`→`dm`, `whisper`→`user`). `hasFreeText`/`extractFreeText` check and extract `free_text` params from action definitions, driving dialogue vs compact rendering. `formatParams` formats action params compactly, skipping free_text. `formatEffect` renders effect operators as human-readable strings. `recClass` assigns CSS classes per record kind for stream panel styling.

Usage

Import this module from StreamPanel, the stream store, and subtitle-classifier to format records, filter by view mode, and determine rendering style.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: frontend/src/lib/stream-format.ts

Signature

export const HIDDEN_KINDS: Set<string>;
export const DIGEST_HIDDEN_KINDS: Set<string>;
export const STORY_HIDDEN_KINDS: Set<string>;
export const KIND_DISPLAY: Record<string, string>;
export function hasFreeText(actionDefs: Record<string, any>, actionType: string): boolean;
export function extractFreeText(actionDefs: Record<string, any>, actionType: string, params: Record<string, unknown>): string | null;
export function formatParams(params: any, actionDefs?: Record<string, any>, actionType?: string): string;
export function formatEffect(eff: any): string;
export function recClass(rec: any): string;

Import

import { HIDDEN_KINDS, KIND_DISPLAY, hasFreeText, formatParams, formatEffect, recClass } from '@/lib/stream-format';

I/O Contract

Inputs

Name Type Required Description
actionDefs Record<string, any> Yes │ Action definitions from world store
actionType string Yes │ Action type to look up
params Record Yes (formatParams) │ Action parameters
rec any Yes (recClass) │ Stream record

Outputs

Name Type Description
hasFreeText returns boolean │ Whether action has a free_text param
recClass returns string │ CSS class string for the record
formatEffect returns string │ Human-readable effect summary

Usage Examples

import { recClass, hasFreeText, formatParams } from '@/lib/stream-format';

// Get CSS class for a stream record
const cls = recClass({ kind: 'action', agent_id: 'old_chen' });
// 'stream-record stream-action'

// Check if an action has free text (dialogue vs compact)
const isDialogue = hasFreeText(actionDefs, 'say');

// Format action params compactly
const params = formatParams({ to: 'hallway', message: 'hello' }, actionDefs, 'say');
// 'to: hallway'  (message skipped as free_text)

Related Pages

Implements Principle

Requires Environment

Page Connections

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