Rules act only on a direct order to Lumi, every path gated (hand reader, Command box); final exam round 5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 04:11:27 +09:00
co-authored by Claude Opus 5.5
parent 9456a1290f
commit 35dbb053e3
38 changed files with 2207 additions and 57 deletions
+20 -5
View File
@@ -1631,6 +1631,11 @@ class Lumi:
elif (FETCH_THANKS.search(text) and fetch.state().get("step") == "giving") or \
(RECEIVE_OK.search(text) and fetch.state().get("step") == "receiving: waiting for okay"):
safe(fetch.release_now) # the person has taken it
elif status == "holding" and not (brain_mod.direct_order(text) and not brain_mod.not_an_order(text)):
return False # "엄마가 내려놓을게", "put it on our list": no order to the hand
elif status == "holding" and (FETCH_GIVE.search(text) or FETCH_PLACE.search(text)) and (
brain_mod.FLOOR.search(text) or re.search(r"\bon (?:his|her|my|your|their|someone'?s) head\b|머리 ?위", text)):
self.fetch_say(*(brain_mod.REFUSE_FLOOR if brain_mod.FLOOR.search(text) else brain_mod.REFUSE_HEAD))
elif status == "holding" and not any(w in text.lower() for w in brain_mod.OBJECTS) and \
(FETCH_GIVE.search(text) or FETCH_BRING_IT.search(text)):
self.fetch_finish("give") # "bring it to me" while holding = hand it over
@@ -2557,7 +2562,9 @@ class Lumi:
self.act(head_["action"], head_["target"])
first = next(gen, None)
log(f" first sentence after {time.time() - t:.1f} s")
promise = brain_mod.promised(first) if head_["action"] == "none" else None
promise = brain_mod.promised(first) if head_["action"] == "none" and \
not (brain_mod.not_an_order(text, asked=False) and brain_mod.promised(first) == "wave") else None # not
# "만약 boss 오면 … wave 해" -> "오시면 흔들게요": no wave now
if promise == "sing" or promise == "wave" and not self.arm_off(): # the reply says it: Lumi does it
log(f" the reply promises {promise}: done")
if promise == "sing":
@@ -3001,12 +3008,16 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
from assistant import chain
if stop_order(text, markers):
return "stop", None
stuck = detour.recent() # right after a blocked drive: "try again", "go around it", "go back"
how = stuck and detour.read(text, markers, stuck["goal"])
hold = brain_mod.not_an_order(text) or not brain_mod.direct_order(text) # only a direct order to Lumi acts
stuck = detour.recent() # right after a blocked drive: "try again", "go around it", "go back";
how = stuck and detour.read(text, markers, stuck["goal"]) # only a direct order (detour.read), else the LLM
if how:
return "detour", how
hold = brain_mod.not_an_order(text) # "when the show starts, go to the stage", "Jake, wave", "can you wave?"
plan = chain_ok and not brain_mod.not_an_order(text, asked=False) and chain.plan(text, markers, NOT_A_STEP)
plan = chain_ok and not brain_mod.not_an_order(text, asked=False) and brain_mod.direct_order(text) and \
chain.plan(text, markers, NOT_A_STEP) # not "when the show starts, go to the stage", "Jake, wave"
if plan and any(k == "steps" and any(st.get("do") == "pick" for st in w) or k == "quick" and w[0] in ("pick", "move_object")
for k, _, w in plan) and (holding() if callable(holding) else holding):
plan = None # "그 cup 들고 wave 해" with a cup in the hand: no second pick; the LLM
if plan:
return "chain", plan
got = seen(text) if seen else None
@@ -3015,7 +3026,9 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
if status_question(text):
return "status", None
if hold:
rule = brain_mod.intent(text, markers) # weather / search are no motion: "Weather outside?"
return (("end", None) if talk_fate(text) == "end" else ("sing", None) if sing.asked(text, last) else
("quick", rule) if rule and rule[0] in ("weather", "search") else
(None, None)) # no motion from a keyword: the LLM reads it from the talk
cor = brain_mod.correction(text, b.history)
if cor:
@@ -3066,6 +3079,8 @@ def read_mission(text, markers):
return None # "come here, I need help": the old paths (rules, the LLM) answer it
if not got:
return None
if len(got) > 1 and all(st == got[0] for st in got) and got[0]["do"] in ("arm", "wave", "look", "lift"):
got = got[:1] # "reach out, reach out to me": one reach, said twice
plain = not steps.is_mission(got) and (len(got) == 1 or (brain_mod.intent(text, markers) or ("",))[0] == "fetch")
if not unread and (plain or (len(got) == 1 and got[0]["do"] in ("move", "turn", "arm"))): # "take the cup and put
return None # it on the chair": two steps, not a pick