Skip to content

core/missions/missions.ts ​

Generated from the exports of core/missions/missions.ts · npm run docs:gen

Missions (PLAN-V2 §3.3, lot M): an agent sent with written instructions, out on the map, back with its answer. The timer shows the real time elapsed (and an estimate drawn from past durations), never an artificial wait. These are the shared types and the request validator; the server side (server/missions/) and the client feature (client/features/missions/) belong to lot M. The text travels by stdin to openclaw agent (executor agent.message).

Standards that cite this file: Missions (sending an agent)

Exports ​

MISSION_AGENTS const ​

ts
const MISSION_AGENTS = ["daemon", "architect", "operator", "reviewer", "guardian"] as const

MissionAgent type ​

ts
type MissionAgent = (typeof MISSION_AGENTS)[number];

MissionState type ​

ts
type MissionState = "out" | "ok" | "failed";

MissionRequest interface ​

POST /api/missions

ts
interface MissionRequest { agent: MissionAgent; text: string; quest?: string; step?: string; target?: string }

Mission interface ​

ts
interface Mission {
  id: string;
  agent: MissionAgent;
  state: MissionState;
  quest?: string;
  step?: string;
  /** The step key ("uid/step" or "uid@period/step") this mission proves, when sent from a step. */
  key?: string;
  target?: string;
  sentAt: string;
  backAt?: string;
  durationMs?: number;
  /** The agent's answer, at most MAX_REPLY characters. */
  reply?: string;
  error?: string;
  archived?: boolean;
}

MAX_TEXT const ​

ts
const MAX_TEXT = 4000

MAX_REPLY const ​

ts
const MAX_REPLY = 8000

MISSION_TIMEOUT_MS const ​

How long the server waits for an agent before the mission fails.

ts
const MISSION_TIMEOUT_MS = 10 * 60 * 1000

agentArg const ​

The server names the main agent "main".

ts
const agentArg = (a: MissionAgent) => …

checkMissionRequest function ​

Problems of a mission request (empty = it can be sent).

ts
function checkMissionRequest(r: unknown): string[]

estimate function ​

An estimate of the next mission's duration: the median of the last ones by this agent, or null.

ts
function estimate(past: Mission[], agent: MissionAgent): number | null

missionsByKey function ​

Missions by step key, as evaluate() reads them (Context.missions): the latest one wins.

ts
function missionsByKey(list: Mission[]): Record<string, MissionState>

Alta OS is open source (MIT).