Files
openclaw/src/agents/tools/agents-wait-tool.test-support.ts
T
Peter Steinberger ccb147518c feat(agents): Swarm core — collector spawn, agents_wait, structured output, caps (gated) (#110932)
* 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
2026-07-18 23:30:11 -07:00

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;