# uuid=c93261f5-b47c-4f61-b9db-df28bfc36f62
# version=1
#
# Technically # headers can contain whatever you want, but foo=bar
#  assignments will be parsed anywhere within them so beware.
# UUIDs assure that an upgrading module is actually the same module,
#  not an accidental name collision.  Without crypto sigs this is
#  almost more of a hazard than a benefit (copy-pasting a UUID = BAD!).
# May rethink this approach.  (Hierarchical namespaces are the more
#  usual solution here, which maybe I should stick with.  Always the
#  question is how to balance clarity with specificity.)

model  = 'dolphin24b'
llm    = PRIMOP{'Fllm', model}  -- Fllm(model, system, user) -> JSON -> Map
system = $'You are serving as a goal-oriented agent.  Your name is Miss Information.

          Goals are managed in a stack, like a procedural programming language.

          Your task is to handle just ONE step.

          Always reply in JSON ONLY, starting with a "reason" field containing
          your thoughts about the task, however long or short, followed by
          an "action" field which is one of the options listed in the user
          message.
          '$

print("LLM SYSTEM MESSAGE:
           {system}
       ")

def agent(msg):
    print("LLM USER MESSAGE:
               {msg}
           ")
    reply = llm(system, msg)
    print("LLM REPLY:")
    pprint(reply)
    return reply