refactor: Remove serializer and polymorphed forms from AttributableObject AC in favor of generic helper function

1. Decoupled Attributes Serialization:
      • Removed all  serialize()  methods from  AttributableObject
(attribute.ts),  WorldState  (world.ts), and  Entity  (entity.ts).
      • Implemented a standalone, uncoupled function
serializeAttributes(attributes: Attribute[]): string  in attribute.ts.
This function receives an array of attributes and outputs their
formatted
      representation.
  2. System Objective Serializer:
      • Implemented  serializeObjectiveWorldState(worldState:
WorldState): string  in world.ts for system LLMs that need objective
reality dumps (e.g. validators and intent decoders). It manually
      retrieves and formats attributes using  serializeAttributes()
alongside class-specific fields like  locationId .
  3. System prompt updates:
      • Updated  LLMValidator  (llm-validator.ts),  TimeDeltaGenerator
(delta.ts), and  IntentDecoder  (intent-decoder.ts) to use the new
standalone  serializeObjectiveWorldState(worldState)  helper imported
      from  @omnia/core .
  4. Unit Tests (Tier 1):
      • Updated core.test.ts to verify  serializeAttributes  and
serializeObjectiveWorldState  utilities directly.
This commit is contained in:
2026-07-06 23:21:04 +05:30
parent f7177b619b
commit 7412ab48ea
8 changed files with 61 additions and 63 deletions

View File

@@ -1,4 +1,4 @@
import { WorldState } from "@omnia/core";
import { WorldState, serializeObjectiveWorldState } from "@omnia/core";
import { ILLMProvider } from "@omnia/llm";
import { IntentSequence, IntentSequenceSchema } from "./intent.js";
@@ -47,7 +47,7 @@ Rules:
${entityIds.length > 0 ? entityIds.join(", ") : "(No entities)"}
=== WORLD STATE ===
${worldState.serialize()}
${serializeObjectiveWorldState(worldState)}
=== ACTOR ===
Actor ID: ${actorId}