Skip to main content

Module dream_runner

Module dream_runner 

Source
Expand description

One Dreams pass, from a queued dream to a proposal waiting for review (SPEC_DREAMS §2, §8).

The runner takes what the pass read (the caller’s job: files from the store, session text from the history), builds the prompt (dream_prompt), makes the one model call through a function the caller supplies, checks the answer (dream_proposal) and records the proposal and what the pass cost. It never writes a memory file: a proposal waits in the record until a person applies it, and applying is a later step.

The model call is a parameter, so the runner has no account, no CLI and no spend of its own; a test passes a fake. The one real call site is the next step, with the account decision (§2.4, D5).

How a pass ends, so a dream never stays running:

  • ready: the answer was the schema; its operations (possibly none) are recorded;
  • held: nothing was sent because a rule said wait (there is nothing to read), so the dream can be queued again;
  • failed: the prompt could not be built, the call failed, or the answer was not the schema. What the call cost is recorded either way, because the spend happened.

Structs§

CallFailed
A model call that failed. When the call was made and billed before it failed (a timeout after the reply started, a refused reply), spent carries what it used, so the entry still shows the spend; its text is ignored.
ModelAnswer
What the model call returned.
Pass
What the pass reads and the limits it works under.

Enums§

End
Where the dream is when run returns.

Functions§

run
Run one queued dream. call receives the prompt and makes the model call; it is not called when a rule holds the pass back. An Err is a store failure the caller should log: the dream is moved to failed on a best effort, so it does not stay running (nothing moves a running dream back to the queue).