Download src/agents/subagents/spawn/subagent-capabilities.test.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/subagents/spawn/subagent-capabilities.test.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/agents/subagents/spawn/subagent-capabilities.test.ts
-
curl -L -o subagent-capabilities.test.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/subagents/spawn/subagent-capabilities.test.ts
1.23 kB
| /** | |
| * Regression coverage for depth-derived subagent capabilities. | |
| * Verifies main/orchestrator/leaf role and control-scope decisions. | |
| */ | |
| import { describe, expect, it } from "vitest"; | |
| import { resolveSubagentCapabilities } from "./subagent-capabilities.js"; | |
| describe("resolveSubagentCapabilities", () => { | |
| it("returns normalized depth for non-finite direct inputs", () => { | |
| expect( | |
| resolveSubagentCapabilities({ | |
| depth: Number.NaN, | |
| maxSpawnDepth: Number.POSITIVE_INFINITY, | |
| }), | |
| ).toEqual({ | |
| depth: 0, | |
| role: "main", | |
| controlScope: "children", | |
| canSpawn: true, | |
| canControlChildren: true, | |
| }); | |
| }); | |
| it("floors finite depth and max depth consistently", () => { | |
| expect(resolveSubagentCapabilities({ depth: 1.9, maxSpawnDepth: 1.2 })).toEqual({ | |
| depth: 1, | |
| role: "leaf", | |
| controlScope: "none", | |
| canSpawn: false, | |
| canControlChildren: false, | |
| }); | |
| }); | |
| it("makes children at the default recursion boundary leaves", () => { | |
| expect(resolveSubagentCapabilities({ depth: 1_000 })).toEqual({ | |
| depth: 1_000, | |
| role: "leaf", | |
| controlScope: "none", | |
| canSpawn: false, | |
| canControlChildren: false, | |
| }); | |
| }); | |
| }); | |