refactor: lazy load cron subagent followup runtime
parent
9919e978ca
commit
cc57bcfe2f
@ -0,0 +1,46 @@
|
||||
const SUBAGENT_FOLLOWUP_HINTS = [
|
||||
"subagent spawned",
|
||||
"spawned a subagent",
|
||||
"auto-announce when done",
|
||||
"both subagents are running",
|
||||
"wait for them to report back",
|
||||
] as const;
|
||||
|
||||
const INTERIM_CRON_HINTS = [
|
||||
"on it",
|
||||
"pulling everything together",
|
||||
"give me a few",
|
||||
"give me a few min",
|
||||
"few minutes",
|
||||
"let me compile",
|
||||
"i'll gather",
|
||||
"i will gather",
|
||||
"working on it",
|
||||
"retrying now",
|
||||
"should be about",
|
||||
"should have your summary",
|
||||
"it'll auto-announce when done",
|
||||
"it will auto-announce when done",
|
||||
...SUBAGENT_FOLLOWUP_HINTS,
|
||||
] as const;
|
||||
|
||||
function normalizeHintText(value: string): string {
|
||||
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
||||
}
|
||||
|
||||
export function isLikelyInterimCronMessage(value: string): boolean {
|
||||
const normalized = normalizeHintText(value);
|
||||
if (!normalized) {
|
||||
// Empty text after payload filtering means the agent either returned
|
||||
// NO_REPLY (deliberately silent) or produced no deliverable content.
|
||||
// Do not treat this as an interim acknowledgement that needs a rerun.
|
||||
return false;
|
||||
}
|
||||
const words = normalized.split(" ").filter(Boolean).length;
|
||||
return words <= 45 && INTERIM_CRON_HINTS.some((hint) => normalized.includes(hint));
|
||||
}
|
||||
|
||||
export function expectsSubagentFollowup(value: string): boolean {
|
||||
const normalized = normalizeHintText(value);
|
||||
return Boolean(normalized && SUBAGENT_FOLLOWUP_HINTS.some((hint) => normalized.includes(hint)));
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
export {
|
||||
readDescendantSubagentFallbackReply,
|
||||
waitForDescendantSubagentSummary,
|
||||
} from "./subagent-followup.js";
|
||||
Loading…
Reference in New Issue