use serde_json::{Value, json};
use super::Verb;
use crate::envelope;
pub const FLEET: &str = "fleet";
const CAP: &str = "cap";
const PROJECT: &str = "project";
pub fn fleet(workspace: String, project: String, cap: u64) -> Value {
json!({ envelope::OP: FLEET, envelope::WORKSPACE: workspace, PROJECT: project, CAP: cap })
}
pub const DISBAND: Verb = Verb {
word: "disband",
params: &["workspace"],
flags: &[],
summary: "stop running a fleet in this workspace",
detail: "Removes the workspace's fleet setting. Nothing further is \
claimed, started or released; everything already running is \
untouched and keeps its ball. Its own verb rather than a cap of \
zero, which is an armed loop that spawns nothing and still reaps.",
};
pub const ARM: Verb = Verb {
word: "arm",
params: &["workspace", "model"],
flags: &[],
summary: "watch this workspace's agents with a cheap model",
detail: "Arms the alignment monitor on the named workspace, pinned to the \
model you name. From then on, whenever an agent commits, one \
small tool-less call reads its goal and the work since the last \
check and answers aligned, drifting or diverged with one \
sentence — recorded on the ops trail, which is the only thing it \
does by default. It costs money per check; `disarm` ends it. It \
is NOT the fleet loop: that is `fleet` and `disband`, and the two \
answer with the same receipt.",
};
pub const DISARM: Verb = Verb {
word: "disarm",
params: &["workspace"],
flags: &[],
summary: "stop watching this workspace",
detail: "Removes the workspace's monitor setting. No further checks are \
made and nothing further is charged; every verdict already \
recorded stays on the trail.",
};
pub const SCAN: Verb = Verb {
word: "scan",
params: &["workspace"],
flags: &[],
summary: "flush this workspace's inboxes now",
detail: "Delivers whatever is waiting in the workspace's conversations \
rather than waiting for the next beat to notice it. It answers \
with a captured run.",
};
pub const SCIENCE: Verb = Verb {
word: "science",
params: &["workspace"],
flags: &[],
summary: "every delivery attempt of this workspace, with what it cost",
detail: "One row per attempt — the ordinary claim and each fan candidate \
alike: the goal it was fired with, the documents frozen onto its \
dispatch commit, the config commit that governs it, both ends of \
its project diff, its tokens and wall seconds, what it last said, \
every message delivered into it, and how it ended. Everything is \
derived when you ask, so the same row a minute later is a \
statement about the world a minute later.",
};
pub const WORK_DIFF: Verb = Verb {
word: "work-diff",
params: &["workspace"],
flags: &[],
summary: "what this workspace's agents changed in their project",
detail: "For every ball the workspace holds, the changes on that ball's \
work branch that are not yet on the branch it delivers into — one \
row per changed file, with lines added and removed. A repository \
it cannot read, and a branch that is not there yet, are each said \
outright rather than shown as an empty list. The form that names \
a ball and a path and answers that one file's patch is not \
composed here.",
};
pub fn disband(workspace: String) -> Value {
DISBAND.built(vec![workspace], &[])
}
pub fn arm(workspace: String, model: String) -> Value {
ARM.built(vec![workspace, model], &[])
}
pub fn disarm(workspace: String) -> Value {
DISARM.built(vec![workspace], &[])
}
pub fn scan(workspace: String) -> Value {
SCAN.built(vec![workspace], &[])
}
pub fn science(workspace: String) -> Value {
SCIENCE.built(vec![workspace], &[])
}
pub fn work_diff(workspace: String) -> Value {
WORK_DIFF.built(vec![workspace], &[])
}
#[cfg(test)]
mod tests;