mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
ccb147518c
* docs: add Swarm implementation spec * feat(agents): Swarm core — collector spawn, agents_wait, structured output, fastMode, caps Implements docs/plan/swarms.md §4-6: tools.swarm config gate (default off), collector-mode sessions_spawn (collect/outputSchema/fastMode/groupId), fail-closed child approvals, agents_wait race-semantics tool, per-group FIFO scheduler with maxConcurrent/maxChildrenPerGroup/maxTotalPerGroup caps, additive registry and state-schema columns (no schema-version bump), and colocated tests. Part of #110325 * fix(agents): rebase reconciliation — preserve swarm state columns * fix(agents): O(1) collector session index, cheap-first preflight, collector start lifecycle hooks Autoreview findings: replace the per-request full registry scan with an index-maintaining run map and gate the persisted-store fallback behind isSubagentSessionKey; emit subagent_progress/subagent_spawned from the swarm scheduler start callback so collector children produce balanced plugin lifecycle events. * chore(protocol): regenerate Swift gateway models for swarm fields * fix(agents): lint cleanup — typed catch, explicit microtask flush, no executor return * fix(agents): knip/test-support/max-lines cleanup for swarm surfaces * fix(agents): keep tool-catalog ui-safe — callers pass prepared swarmEnabled fact resolveSwarmConfig value-import in tool-catalog dragged the server graph into the Control UI bundle via tool-policy-shared (UNLOADABLE_DEPENDENCY on subpath aliases). Catalog stays pure; the gateway tools-catalog handler resolves the gate and passes the boolean. * fix(agents): reconcile swarm spawn pipeline * fix(agents): refresh swarm tool metadata * fix(apps): sync swarm tool localization * style(agents): compact tool display metadata * fix(plugin-sdk): account for swarm config surface
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import type { SubagentRunRecord } from "../subagent-registry.types.js";
|
|
import "./agents-wait-tool.js";
|
|
|
|
type WaitError = { runId: string; error: "not_found" | "not_owner" };
|
|
type WaitTarget = { runId: string; entry: SubagentRunRecord };
|
|
type AgentsWaitToolTestApi = {
|
|
testing: {
|
|
ownsRun(entry: SubagentRunRecord, currentSessionKeys: ReadonlySet<string>): boolean;
|
|
readResolvedWaitState(targets: readonly WaitTarget[], errors: readonly WaitError[]): unknown;
|
|
readWaitState(ids: readonly string[], currentSessionKeys: ReadonlySet<string>): unknown;
|
|
resolveWaitTargets(
|
|
ids: readonly string[],
|
|
currentSessionKeys: ReadonlySet<string>,
|
|
): { targets: WaitTarget[]; errors: WaitError[] };
|
|
waitForCollector(params: {
|
|
ids: readonly string[];
|
|
currentSessionKeys: ReadonlySet<string>;
|
|
timeoutMs: number;
|
|
signal?: AbortSignal;
|
|
}): Promise<unknown>;
|
|
};
|
|
};
|
|
|
|
function getTestApi(): AgentsWaitToolTestApi {
|
|
return (globalThis as Record<PropertyKey, unknown>)[
|
|
Symbol.for("openclaw.agentsWaitToolTestApi")
|
|
] as AgentsWaitToolTestApi;
|
|
}
|
|
|
|
export const testing = getTestApi().testing;
|