// tick-class.ts — the OFF-SCOPE CLASSIFICATION of every `[orch-tick: ]` // message (KEY: AUTOPILOT-120). ONE visible table answers the operator's rule: // // "Does DELIVERING this tick cause work to happen, or does it only report?" // // AUTOMATIC-ACTION — delivering it starts or demands work, so with autopilot // OFF it is SUPPRESSED: // dispatch — the capacity nudge ("a slot is free + queue has ready work → // dispatch it"): delivering it tells the orchestrator to start // workers. // intake — the buffer nudge ("approved buffer low → run a FULL intake // scan NOW"): delivering it tells the orchestrator to go find // new work. // recover — the auto-recovery lane's voice (re-dispatched / escalated / // held): it announces the PROACTIVE recovery lane. // INFORMATIONAL — it only reports what already happened, so with autopilot OFF // it is DELIVERED: // review — reviewer completion / verdict routing / stuck-review nudge. // failure — a run failed. // budget — a live run is near its wall-clock cap. // decision — a status move that happened (panel approval or harness flip). // harness — what the harness did / fleet degradation / sweep failure. // ship — the merge-finisher lane's result / a policy inquiry. // main-write — a MAIN-IMMUTABILITY violation. // config — an operator config change. // // The split is DELIBERATELY not a blanket on/off flag: the runner wraps its // ONE router choke point (every runner tick passes it) and the pi decision // panel gates its own delivery with the SAME predicate below. An UNKNOWN // reason classifies as INFORMATIONAL — silencing an unrecognised report is the // worse failure (the operator loses the event feed this item exists to keep); // a new work-causing reason must be added to the table above deliberately. // // AUTOPILOT-120 changes WHICH classes fire while OFF, never HOW a tick is // delivered: the router's cooldown / dedupe / premise-validation mechanics are // untouched. import { tickReasonFromMessage } from "./tick-telemetry.ts"; export type TickClass = "automatic-action" | "informational"; /** The reasons whose DELIVERY asks for / announces work — suppressed while OFF. * Every other reason is informational; `unknown` (a message with no * `[orch-tick: ]` prefix) is informational too. */ const AUTOMATIC_ACTION: ReadonlySet = new Set(["dispatch", "intake", "recover"]); export function tickClassOfReason(reason: string): TickClass { return AUTOMATIC_ACTION.has(reason) ? "automatic-action" : "informational"; } /** The class of a `[orch-tick: ]` MESSAGE, parsed with the SAME parser * the telemetry audit trail uses, so the two can never disagree. */ export function tickClassOfMessage(message: string): TickClass { return tickClassOfReason(tickReasonFromMessage(message)); } /** The ONE question both off-scope gates ask: may this tick still be delivered * with autopilot OFF? Only INFORMATIONAL ticks may. */ export function deliverableWhileOff(message: string): boolean { return tickClassOfMessage(message) === "informational"; }