/** * Who an agent status report wakes (specs/2026-10-01-orc-status-wakes.md). * * Every `report-status` line used to be queued for the orchestrator. On * 2026-09-29 that was 134 full-context orchestrator turns, almost all of them * team members' [DONE] lines about work their own team lead owns and reviews. * Now the report goes to whoever is responsible: * * | Report | Goes to | * |---|---| * | [IN_PROGRESS] [ACTIVE] [READY] [WORKING] [IDLE] … | recorded only | * | [DONE] that a pending owner delivery is waiting for | orchestrator | * | [DONE] on work the orchestrator delegated | orchestrator | * | [DONE] on anyone else's work item | recorded (the lead's review path takes it) | * | [DONE] with no work item | digest (actionable only without a lead) | * | [BLOCKED] [FAILED] [ERROR] | the sender's lead; orchestrator when there is none or the lead sent it | * | [MILESTONE] | orchestrator (it forwards milestones to the owner) | * | other markers | digest (actionable only on orchestrator work or without a lead) | * | no marker (an answer someone waits for) | orchestrator, as before | * * Pure functions only; {@link OrcStatusRouterService} carries out the plan. * * @module services/orc/orc-status-routing */ import type { WorkItem } from '../../types/v2/work-item.types.js'; /** Why the orchestrator is woken (the hourly counter's categories). */ export type OrcWakeCategory = 'owner' | 'delegated-done' | 'escalation' | 'digest' | 'other'; /** What happens to one status report. */ export type OrcStatusRoute = /** Status store / UI / ticket log only */ { action: 'record'; reason: string; } /** Wake the orchestrator now */ | { action: 'orc'; category: Exclude; reason: string; } /** Hand it to the sender's team lead */ | { action: 'team-lead'; lead: string; reason: string; } /** Hold for the next digest; only actionable entries make a digest go out */ | { action: 'digest'; actionable: boolean; reason: string; }; /** Inputs of {@link planOrcStatusRoute}. */ export interface OrcStatusRouteInput { /** The report text (`[DONE] Agent x: …`) */ content: string; /** Reporting agent session */ sender: string; /** The work item the report is about, when known */ workItem: WorkItem | null; /** The sender's lead (parent member, else team lead), never the sender itself */ lead: string | null; /** True when the sender leads its own team (reason text only; a lead with a parent still reports up) */ senderIsLead: boolean; /** True when the owner is waiting on the orchestrator to deliver this (OrcDeliveryEnforcer tracked it) */ deliveryOwed: boolean; /** Orchestrator check for a session / name */ isOrchestrator: (name: string) => boolean; } /** * The bracketed marker a report starts with, upper-cased. * * @param content - Report text * @returns e.g. `DONE`, or null when the text has no leading marker */ export declare function statusMarkerOf(content: string): string | null; /** * Whether the orchestrator delegated (or created) a work item: its owner is * the orchestrator, or the orchestrator stamped itself as the delegator. * * @param wi - Work item * @param isOrchestrator - Orchestrator check * @returns True for orchestrator work */ export declare function isOrcDelegated(wi: WorkItem, isOrchestrator: (name: string) => boolean): boolean; /** * The work item a report is about: the one it names; else the sender's * running/accepted item (newest); else the sender's most recently finished * item, when it finished within {@link ORC_WAKE_CONSTANTS.RECENT_COMPLETION_MS}. * * `report-status` posts the line BEFORE it completes the item, so the * running item is normally the answer. * * @param items - Pool items * @param sender - Reporting agent * @param workItemId - Id the report named, if any * @param now - Clock (epoch ms) * @returns The item, or null */ export declare function findStatusWorkItem(items: readonly WorkItem[], sender: string, workItemId: string | undefined, now: number): WorkItem | null; /** * Decide where one agent status report goes. * * @param input - Report, sender, its work item and lead * @returns The route */ export declare function planOrcStatusRoute(input: OrcStatusRouteInput): OrcStatusRoute; //# sourceMappingURL=orc-status-routing.d.ts.map