mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
refactor(agents): hide subagent outcome helpers
This commit is contained in:
@@ -55,23 +55,23 @@ describe("emitSubagentEndedHookOnce", () => {
|
||||
|
||||
it("treats timing differences as different only after both outcomes have timing", () => {
|
||||
expect(
|
||||
mod.runOutcomesEqual(
|
||||
mod.shouldUpdateRunOutcome(
|
||||
{ status: "timeout", startedAt: 1_000, endedAt: 2_000, elapsedMs: 1_000 },
|
||||
{ status: "timeout", startedAt: 1_000, endedAt: 2_500, elapsedMs: 1_500 },
|
||||
),
|
||||
).toBe(false);
|
||||
).toBe(true);
|
||||
expect(
|
||||
mod.runOutcomesEqual(
|
||||
mod.shouldUpdateRunOutcome(
|
||||
{ status: "error", error: "boom", startedAt: 1_000, endedAt: 2_000, elapsedMs: 1_000 },
|
||||
{ status: "error", error: "boom", startedAt: 1_000, endedAt: 2_000, elapsedMs: 1_000 },
|
||||
),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(
|
||||
mod.runOutcomesEqual(
|
||||
mod.shouldUpdateRunOutcome(
|
||||
{ status: "ok", startedAt: 1_000, endedAt: 2_000, elapsedMs: 1_000 },
|
||||
{ status: "ok" },
|
||||
),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(
|
||||
mod.shouldUpdateRunOutcome(
|
||||
{ status: "ok" },
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { SubagentRunRecord } from "./subagent-registry.types.js";
|
||||
const log = createSubsystemLogger("agents/subagent-registry-completion");
|
||||
|
||||
/** Compares subagent run outcomes, treating missing timing as compatible. */
|
||||
export function runOutcomesEqual(
|
||||
function runOutcomesEqual(
|
||||
a: SubagentRunOutcome | undefined,
|
||||
b: SubagentRunOutcome | undefined,
|
||||
): boolean {
|
||||
@@ -44,7 +44,7 @@ export function runOutcomesEqual(
|
||||
}
|
||||
|
||||
/** Returns true when an outcome carries timing fields. */
|
||||
export function runOutcomeHasTiming(outcome: SubagentRunOutcome | undefined): boolean {
|
||||
function runOutcomeHasTiming(outcome: SubagentRunOutcome | undefined): boolean {
|
||||
return (
|
||||
Number.isFinite(outcome?.startedAt) ||
|
||||
Number.isFinite(outcome?.endedAt) ||
|
||||
|
||||
Reference in New Issue
Block a user