Log inGet started
Package

dotbotRun.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

dotbotRun Module

A DotBot run driven from a boot rather than from the DotBot panel.

Purpose

start_instance { world, prompt } (the engine's --agent dotbot --agent-prompt <text>) hands the prompt to DotBot, the agent the engine ships in its DotBot panel, as the first message of a fresh conversation. resume (--agent-resume) sends a message into the conversation this world's run already holds. The editor starts the run as it comes up; a browser or Android engine is handed it by the proxy once the engine answers, and a run that names no world is for the engine's world: the world it is bound to, else the world its boot names.

DotBot is a plugin inside the engine, so a run is the plugin's own surface used in order:

  1. wait for the engine to bind a world when the run was handed before it had (DotBot acts through the agent endpoint the engine publishes as it binds), then for the plugin to load, and on a boot whose host hands DotBot its own Claude accounts (--agent-accounts-seeded, the seeded option; the development proxy does for every engine it starts), wait for them to reach DotBot;
  2. find the DotBot agent the boot named (dotbot is DotBot on its first Claude account, dotbot-chatgpt on its first ChatGPT account) and check an account is connected to it. A boot that names an account (--agent-account, the account option) runs on the agent of that provider holding it (dotbot-claude~2 for the second connected Claude account). An account is named by its agent, its account key (anthropic-claude~2), the name it carries in the DotBot panel, or its email; an account the host provides is held as dotbot-claude~<id> and is named by the host's id for it too (the id claude_usage reports). A resume continues the recorded conversation on the account it names, else on the agent the conversation last ran on;
  3. open a new conversation (/new), set the model and thinking level the boot asked for. DotBot keeps what it is set to as the model and thinking level it runs that account on from then on, its panel included, and a boot that names no model runs the one it already holds. A resume puts the recorded conversation on the model and thinking level the boot names (--agent-model, --agent-effort), and for one it leaves unnamed, on a resume onto another account of the provider the conversation last ran on, on the one the conversation ran on there: DotBot starts a conversation new to an account on that account's own model and level;
  4. send the prompt.

The prompt the page hands over

In a browser, the page hosting the engine can hand the editor's agent its first prompt: origozero.ai's /create posts the idea a person typed as { type: "agent_prompt", prompt, world } on the engine's worker channel (docs/engine-launch-spec.md). The editor serves it (watchHanded, started with the editor) as a run of its own: once the plugin has loaded and an account is connected to it, it goes to the agent the person's own first message in the DotBot panel would (their default account when it is usable, else the first DotBot agent with an account connected whose sign-in has not run out, on a browser engine the agent included with OrigoZero) as the first message of a new conversation of the world, and the page is told sent, or refused with the reason. A prompt for a world other than the one the engine is bound to is refused. The browser keeps that the world's prompt was sent, so a reload or a second tab sends it no second time.

The idea the engine's own screens hand over

On every platform the world chooser's create screen makes a world from an idea (launcher.makeFromIdea), and the trusted VM keeps the idea as a claim on that world in the preferences the device keeps for the account (src/lua/trusted/agent_prompt.luau). watchHanded takes it (trusted.call("agentPrompt.take")) once the engine is bound to that world, the same way as the page's: the first message of a new conversation on the agent the person's panel message goes to, answered back to the trusted VM (agentPrompt.answer). A claim is sent once: a sent claim stays recorded, a claim the engine ended holding is taken again by the next engine bound to the world, and a refused one keeps the idea for the next time the world is opened in the editor.

What a run records

  • The conversation, in this machine's agent-session store under (world guid, dock slot 1), with harness naming the DotBot agent, once the first event of the prompt's turn names it. A resume reads it and records it again, as this engine's run of the slot, with harness naming the agent the conversation now runs on.
  • The account the run spends, on its prompt and launch entries (account: who it is and the key DotBot holds it under), which agent_run_report names.
  • Every prompt and every turn event of that conversation (streamed text fragments aside: a turn's done carries the whole answer), one JSON line each, through agentSessions.record, at <config dir>/agent-transcripts/<agent>_<conversation>.jsonl, named after the address the conversation was opened under, so a resumed run, on any account, adds to the same transcript. agent_run_report reads it: turns, tokens, tool calls with their timings, failures, the skills opened and the guides read.
  • The agents the run's turns started (start_agents), in the same transcript as subagent entries, each naming the agent (run, name) and its own conversation: a status entry with DotBot's own figures for it (its state, tool calls, tokens, start and end) whenever its state, its conversation or its end moves, and every event of its conversation as a turn event is kept. An agent is the run's when DotBot's status of it names the run's conversation, or that of an agent the run started, as the conversation that started it, so an agent another conversation started is left out. agent_run_report counts each agent's turns, tokens, tool calls and failures by its name, beside the run's own.
  • Its state: the last entry recorded is the in-engine agent's state in GET /engine/status (agent.run), which instance_health prints, with the run as a whole beside it (agent.run.state, dotbotRun.runState): the engine's tools as the model was offered them (their count, or the reason DotBot gave for offering none), and the turn the run is on, working or ended with how it ended, and refused when the model's provider refused it because a usage window of the account is spent, with the window and when it opens again. A turn DotBot continues on its own (one a spent usage window stopped, or one the platform cut off) names when DotBot sends the conversation on by itself.

When a run cannot start

It is refused, sends nothing, and records the reason as its state:

  • the engine is bound to no world and its boot names none (DotBot acts through the live agent endpoint a world-bound engine publishes);
  • the engine had not bound a world after five minutes;
  • the plugin did not load, or had not after five minutes;
  • the host's Claude accounts did not reach DotBot, or had not after five minutes;
  • no account is connected to the DotBot agent named. An account is connected once on a machine, in the DotBot panel, and every later run uses it. A run asPanel waits up to five minutes for one to connect;
  • the account the boot named is not one DotBot holds connected, or names more than one (the refusal lists the accounts connected to the agent, and says why a host account whose sign-in lapsed is not connected);
  • DotBot refused the model or the thinking level the boot named;
  • a resume found no DotBot conversation recorded for the world and slot.

Functions

  • dotbotRun.start(opts): start a run in the background. opts is { agent, worldGuid?, slot?, prompt?, resume?, model?, effort?, account?, seeded?, asPanel? }; worldGuid is the engine's world when left out: the world it is bound to, else the world its boot names. asPanel runs on the agent a person's panel message would, in place of agent and account. One run per engine.
  • dotbotRun.watchHanded(): serve the prompts the page hosting this engine hands over, once per engine.
  • dotbotRun.serveHanded(deps): serve one waiting prompt over the caller's deps, for tests.
  • dotbotRun.panelAgent(agents): the agent a person's panel message starts a conversation on, from DotBot's agents answer.
  • dotbotRun.startArmed(): start the run this boot's settings arm, if any.
  • dotbotRun.engineWorld(): the world a run that names none is for, the world the engine is bound to, else the world its boot names.
  • dotbotRun.worldOf(bound, named): the same choice from the two readings, bound when it names a world, else named.
  • dotbotRun.agentFor(name): the DotBot agent id an agent name runs.
  • dotbotRun.new(deps): a run over a transport of the caller's, for tests.
  • dotbotRun.runState(state, entry): the run's state after an entry it records, from the state before it.