The Big One #43

Merged
k.marinus merged 93 commits from feat/reset-experiment-and-phase into dev 2026-01-26 19:20:45 +00:00
3 changed files with 25 additions and 14 deletions
Showing only changes of commit 4e113c2d5c - Show all commits

View File

@@ -318,7 +318,7 @@ class BDICoreAgent(BaseAgent):
self.bdi_agent.call( self.bdi_agent.call(
agentspeak.Trigger.addition, agentspeak.Trigger.addition,
agentspeak.GoalType.belief, agentspeak.GoalType.belief,
agentspeak.Literal("force_norm", (agentspeak.Literal(agentspeak.asl_repr(name)),)), agentspeak.Literal(f"force_{name}"),
agentspeak.runtime.Intention(), agentspeak.runtime.Intention(),
) )

View File

@@ -1,6 +1,13 @@
norms(""). norm("Be friendly").
+user_said(Message) : norms(Norms) <- +!reply
.notify_user_said(Message); : user_said(Message)
-user_said(Message); <- .findall(Norm, norm(Norm), Norms);
.reply(Message, Norms). .reply(Message, Norms).
+user_said(Message)
<- .notify_user_said(Message);
!reply.
+!transition_phase <- true.
+!check_triggers <- true.

View File

@@ -7,7 +7,7 @@ from control_backend.agents import BaseAgent
from control_backend.agents.bdi.agentspeak_generator import AgentSpeakGenerator from control_backend.agents.bdi.agentspeak_generator import AgentSpeakGenerator
from control_backend.core.agent_system import InternalMessage from control_backend.core.agent_system import InternalMessage
from control_backend.core.config import settings from control_backend.core.config import settings
from control_backend.schemas.program import BasicNorm, Program from control_backend.schemas.program import ConditionalNorm, Program
from control_backend.schemas.ri_message import GestureCommand, RIEndpoint, SpeechCommand from control_backend.schemas.ri_message import GestureCommand, RIEndpoint, SpeechCommand
@@ -82,6 +82,8 @@ class UserInterruptAgent(BaseAgent):
self.logger.error("Received invalid JSON payload on topic %s", topic) self.logger.error("Received invalid JSON payload on topic %s", topic)
continue continue
self.logger.debug("Received event type %s", event_type)
if event_type == "speech": if event_type == "speech":
await self._send_to_speech_agent(event_context) await self._send_to_speech_agent(event_context)
self.logger.info( self.logger.info(
@@ -108,6 +110,8 @@ class UserInterruptAgent(BaseAgent):
"Forwarded button press (override) with context '%s' to BDIProgramManager.", "Forwarded button press (override) with context '%s' to BDIProgramManager.",
event_context, event_context,
) )
else:
self.logger.warning("Could not determine which element to override.")
else: else:
self.logger.warning( self.logger.warning(
"Received button press with unknown type '%s' (context: '%s').", "Received button press with unknown type '%s' (context: '%s').",
@@ -203,13 +207,15 @@ class UserInterruptAgent(BaseAgent):
self.logger.debug(f"Goal mapping: UI ID {goal} -> {id}") self.logger.debug(f"Goal mapping: UI ID {goal} -> {id}")
for norm in phase.norms: for norm in phase.norms:
if not isinstance(norm, BasicNorm): if isinstance(norm, ConditionalNorm):
asl_slug = AgentSpeakGenerator.slugify(norm) asl_slug = AgentSpeakGenerator.slugify(norm)
belief_id = str(norm.condition.id) norm_id = str(norm.id)
self._cond_norm_map[belief_id] = asl_slug self._cond_norm_map[norm_id] = asl_slug
self._cond_norm_reverse_map[asl_slug] = belief_id self._cond_norm_reverse_map[asl_slug] = norm_id
self._cond_norm_reverse_map[asl_slug] = norm_id
self.logger.debug("Added conditional norm %s", asl_slug)
self.logger.info( self.logger.info(
f"Mapped {len(self._trigger_map)} triggers and {len(self._goal_map)} goals " f"Mapped {len(self._trigger_map)} triggers and {len(self._goal_map)} goals "
@@ -262,8 +268,6 @@ class UserInterruptAgent(BaseAgent):
async def _send_to_bdi(self, thread: str, body: str): async def _send_to_bdi(self, thread: str, body: str):
"""Send slug of trigger to BDI""" """Send slug of trigger to BDI"""
msg = InternalMessage( msg = InternalMessage(to=settings.agent_settings.bdi_core_name, thread=thread, body=body)
to=settings.agent_settings.bdi_core_name, sender=self.name, thread=thread, body=body
)
await self.send(msg) await self.send(msg)
self.logger.info(f"Directly forced {thread} in BDI: {body}") self.logger.info(f"Directly forced {thread} in BDI: {body}")