harbor run -t openthoughts/tasktrove-mix-baseline-uniform-v2-mix-baseline-uniform-2822harbor download openthoughts/tasktrove-mix-baseline-uniform-v2-mix-baseline-uniform-2822Implement a memory-query and status-reporting component that answers natural-language style queries about objects in the agent's memory and about the agent's current activities and position. Place the implementation at /app/ (for example /app/memory_queries.py). The test suite expects an API that the agent/interpreter can call to obtain textual answers for commands such as "what is where I am looking", "what is to the left of X", "what are you doing", "what are you building", "where are you going", "where are you", "how many X are there", "how many blocks are in the Y", and queries about object dimensions.
Summary of required functionality
API and required class / function signatures
Implement a class MemoryQueryHandler with the following methods (signatures described — you may adapt names but keep semantics):
class MemoryQueryHandler: def init(self, agent): """ agent: the agent instance whose memory and state will be inspected. The handler will use agent.memory and other agent attributes to compute answers. """
def name_of_looked_at(self) -> str:
"""
Return a short textual answer describing the name (or identifying information)
of the object the agent is currently looking at. If the looked-at item has
a stored 'has_name' triple, use that; otherwise fall back to a shape/type
description (or an identifier).
"""
def left_of(self, reference_memid: str) -> str:
"""
Given the memory id of a reference object, return a short description
of the object that is to the left of that reference object (if any).
Use the agent's stored block coordinates of objects and a consistent
interpretation of 'left' relative to world axes or the object's orientation.
"""
def closest_to(self, reference: str = "you") -> str:
"""
Return a description of the single object closest to the specified reference.
`reference` is typically "you" (agent itself) or "me" (the speaker) — the handler
should support both and compute nearest object(s) accordingly.
"""
def current_activities(self) -> str:
"""
Return a short description of what the agent is currently doing.
Possible activities include building (with the target shape), moving (with destination),
dancing, or idle. If multiple activities are in progress, prefer the most relevant/active one
(e.g., building should be reported when a build job is ongoing).
"""
def what_are_you_building(self) -> str:
"""
If the agent is executing a build job, return a short description of what is being built
(e.g., 'a cube', 'a small cube', etc.). If nothing is being built, return a sensible
message indicating that.
"""
def movement_target(self) -> str:
"""
Return a short description of where the agent is moving to (coordinates), if a move is in progress.
"""
def current_location(self) -> str:
"""
Return the agent's current location as a readable coordinate tuple (string).
"""
def count_entities(self, memory_type: str = None, colour: str = None) -> int:
"""
Count memory entities that match optional filters:
- memory_type: type/name such as 'cube', 'sphere', etc.
- colour: filter by stored colour triple.
Return an integer count (not a printed string). The caller may format the count.
"""
def blocks_in_entity(self, reference_memid: str) -> int:
"""
Given an entity memory id (or other way to identify an entity in memory),
return the total number of blocks that entity occupies (its block count).
This should be derived from the entity's shape specification and/or the actual
stored blocks collection for that entity.
"""
def shape_dimension(self, reference_memid: str, dimension: str) -> int:
"""
Return an integer representing a requested dimension of an entity that has a shape.
Valid `dimension` values include 'height', 'width', 'tall', 'wide' (map synonyms).
For example, a cube of size 3 returns 3 for height/width, a sphere will map
its radius/diameter appropriately according to a reasonable interpretation.
"""
Implement at least one helper function for converting shapes into block counts/dimensions if shape objects are used in your environment. This helper should accept known shape descriptors (cube with size, sphere with radius, triangle, etc.) and compute block counts and sizes consistently.
Expectations about agent/memory object interface
Behavioral details and examples (do not hard-code test phrases)
Output types
Implementation notes
Deliverables
This component will be used by the interpreter/agent to answer natural-language "get memory" style queries; implement it so that the interpreter can call its methods to obtain proper textual responses and numeric values for counts and dimensions.