/** * `/swarm`: several copies of one agent on one job, from inside pi. * * Every other command here decides who does what - `/run` walks a flow, * whose planner may write the split, and `/step` names the agent itself. A * swarm decides none of it: the members are told the same thing, handed a board * to talk on and, when the caller names what there is, a set of claims to take * work from. What they divide between them is theirs. * * It arrived last on purpose. The library ran first, from `examples/15-swarm.ts`, * and what those runs said is written into `docs/guide/swarm.md`: on work one * member could finish, a board earns nothing. The command exists because * watching one is how anybody decides whether their own job is that kind. * * **A swarm is a step of the chain**, recorded in the relay like `/step`'s own: * the answer is drawn in the transcript and stays out of the model's context, * `/quote` is the door into the conversation, and `/step --from` carries it on. * A board pasted into a session would turn the window into an orchestrator * nobody asked for, and it is long. */ import { type Agent, type Board, type Claims, type SwarmResult } from "../../src/index.ts"; import { type CommandCtx, type PiApi } from "../pi.ts"; import { type StepDeps } from "../deps.ts"; import { type RelayStep } from "../relay.ts"; /** The agent a swarm is made of when the command is not told otherwise. */ export declare const DEFAULT_MEMBER = "member"; /** How many copies stand on the board when the command is not told otherwise. */ export declare const DEFAULT_MEMBERS = 3; /** * How long one member's turn may take when `--timeout` does not say. * * The library picks no deadline, and a command has to: pi's agent loop has no * step cap, and a member can spend its turn reading a board nobody is posting * to. Measured with gemma-4-31b on a three-way debate: three runs with no * deadline went past twenty-five minutes, one of them past forty, and left * nothing to read, since a swarm exports its transcripts when it ends. Five * minutes is the bound `/interview` gives its turns, for the same reason. */ export declare const SWARM_TURN_MS = 300000; /** Registers `/swarm`. */ export default function registerSwarmCommand(pi: PiApi): void; /** * `/swarm [--members ] [--claim a,b,c] [--hold ] [--until agree] [--rounds ] [--agent [,…]] [--timeout ] [--model ] `. * * `--agent` names one agent, put on the board `--members` times, or several, * put on it once each. Copies of one agent share one brief, so a side to open * for can only be handed out on the board, and a member refused the side it * asked for has been seen taking no other. Several agents carry their sides in * their own files, which is where a debate's disagreement has to come from. * * `--claim` is what turns announcing into holding: named, the things are leased * one owner at a time and a second member is refused and told who has it. * Without it the members are on their honour, which a run showed is a race * whatever the prompt says. * * `--until agree` is the other thing a swarm can be finished by. Default, a run * is done when every named thing has been reported on, which is coverage and * suits a job that splits. A job that does not split has no coverage to reach: * put three members on one question and what ends it is the three of them * saying the same thing. The two compose, and a debate wants both - the claims * hand out the opening positions, agreement stops it. */ export declare function runSwarm(args: string, ctx: CommandCtx, injected: StepDeps): Promise; /** What the members produced, and what they said to each other while doing it. */ export declare function swarmAnswer(done: SwarmResult): string; /** One line on what happened: how it ended, what is worth knowing about it, and the folder it went to. */ export declare function swarmLine(id: string, done: SwarmResult, folder: string): string; /** What `--claim` named, in order, with the empty pieces of a trailing comma dropped. */ export declare function keysFrom(named: string | undefined): string[]; /** * Done when every named thing has been reported on, whoever did it. * * Without this a swarm spends every round it was given: measured in a real pi, * three members with three keys and three rounds posted six results, the last * three of them describing files that were already described. A round cap is a * bound on the worst case, not a plan. * * Reported on, not claimed: a key somebody took and never spoke about is not * done, and one described by a member that never held it is. */ export declare function everythingDescribed(keys: readonly string[]): (board: Board) => boolean; /** * The leases, when the caller asked for any. * * Named keys are the strong form: a key that is not on the list is refused with * the list, so two spellings of one thing cannot both be granted. `--hold` * alone still bounds how much one member may take, on keys taken as written. */ export declare function claimsFrom(keys: readonly string[], hold: number | undefined): Claims | undefined; /** * What the step is called in the chain: the agent's name when copies of one * stand on the board, `swarm` when several do, since no one of them is the * step and `/step --from` wants a word somebody can type. */ export declare function stepName(agents: readonly Agent[]): string; //# sourceMappingURL=swarm.d.ts.map