From fe120442bd86a6617d279c75a18a66272c024012 Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Sat, 4 Jul 2026 19:12:33 +0530 Subject: [PATCH] feat: Define base entity model (closes #3) --- cli/src/index.ts | 17 +++++++++++++++-- docs/note1.md | 7 +++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 docs/note1.md diff --git a/cli/src/index.ts b/cli/src/index.ts index 5ac5ac5..4b50b48 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -44,7 +44,7 @@ export class Attribute { this.visibility = AttributeVisibility.PRIVATE; } - grandAccess(objectId: string) { + grantAccess(objectId: string) { if (this.visibility === AttributeVisibility.PRIVATE) { this.allowedEntities.add(objectId); } @@ -79,11 +79,18 @@ export abstract class AttributableObject implements IAttribute { addAttribute( name: string, value: string, - visibility: AttributeVisibility, + visibility: AttributeVisibility = AttributeVisibility.PRIVATE, + allowedEntities: Set | null = null, ): void { if (this.attributes.has(name)) throw Error(`Attribute ${name} already exists`); + this.attributes.set(name, new Attribute(name, value, visibility)); + if (visibility === AttributeVisibility.PRIVATE && allowedEntities != null) { + for (const entity of allowedEntities) { + this.attributes.get(name)?.grantAccess(entity); + } + } } removeAttribute(name: string): void { @@ -98,3 +105,9 @@ export abstract class AttributableObject implements IAttribute { ); } } + +export class Entity extends AttributableObject { + constructor(name: string) { + super(); + } +} diff --git a/docs/note1.md b/docs/note1.md new file mode 100644 index 0000000..91c1598 --- /dev/null +++ b/docs/note1.md @@ -0,0 +1,7 @@ +# Names and LLMs + +- While redesigning ../packages/core/index.ts a fundamental issue came up. Something as simple as name is set to private. Because by common sense, an entity's name isn't common knowledge. You don't instantly know another person's name. +- So, although the internal system can identify an entity by it's id (which is defined in the lower level AttributableObject by default), UUIds aren't very helpful for something like LLMs be it the NPC Agent or the Architect Agent. +- An extension of this problem is unnamed entities. How does the architect orchestrate changes for such an entity when it doesn't even have a name? +- Also, if we fixate on NPC agents using identifiers like, "the hooded man", there is nothing stopping them from using other identifiers like "the shadowey man" in the next action or even make up names due to the inherent nature of LLMs. +- This just becomes a nightmare to deal with when parsing LLM responses to find out involved entities.