@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 21 lines 771 Bytes
Raw
1 import type { OrchestrationV2Subagent } from "@t3tools/contracts";
2 import * as DateTime from "effect/DateTime";
3
4 const ACTIVE_SUBAGENT_STATUSES = new Set<OrchestrationV2Subagent["status"]>([
5 "pending",
6 "running",
7 "waiting",
8 ]);
9
10 /** Claude can reuse resumed agent ids. Active agents supersede outcomes; settled agents must start after notification. */
11 export function subagentResumedSince(
12 agent: Pick<OrchestrationV2Subagent, "status" | "startedAt">,
13 notifiedAt: string,
14 ): boolean {
15 if (ACTIVE_SUBAGENT_STATUSES.has(agent.status)) return true;
16 if (agent.startedAt === null) return false;
17 const notifiedAtMillis = Date.parse(notifiedAt);
18 return (
19 !Number.isNaN(notifiedAtMillis) && DateTime.toEpochMillis(agent.startedAt) > notifiedAtMillis
20 );
21 }