refactor(agents): hide subagent outcome helpers

This commit is contained in:
Vincent Koc
2026-06-17 10:13:46 +08:00
parent e209a56d0b
commit a588a33ffa
2 changed files with 8 additions and 8 deletions
@@ -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" },
+2 -2
View File
@@ -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) ||