import type { AutomationPort } from '../ports/automation-port'; import type { Logger } from '../ports/logger-port'; import type { SegmentReaderPort } from '../ports/segment-reader-port'; import type { AutomatedInbox } from '../types/automation'; /** * One sweep of one automated inbox: reconciles the records whose run is over, reads new candidates, * and reports both to the orchestrator in a single sync. */ export default class InboxPoll { private readonly automationPort; private readonly segmentReaderPort; private readonly logger; constructor(params: { automationPort: AutomationPort; segmentReaderPort: SegmentReaderPort; logger: Logger; }); poll(inbox: AutomatedInbox): Promise; /** * A record whose run is over is only treated once it has left the segment. Reading the assignment * state alone is not enough: a record reported still in the segment while its run is going would * be judged untreated before the run had a chance to take it out. */ private reconcileClosed; /** * Runs one of the two segment reads. A failure yields an empty list rather than ending the poll, * so the other read and the sync still happen — but it is reported as a failure, because "read * nothing" and "could not read" must not look alike to the caller. */ private tryRead; /** * Asks the agent for records the orchestrator has no assignment for. Excluding them in the query * is what keeps the page at the run cap: a record already treated but still in the segment stays * there for good, and left in the page it would take a slot on every poll from then on. */ private readCandidates; private readPaddedCandidates; /** * A sort field renamed or out of the service account's reach must not stop the inbox from * dispatching. Used on the not_in read and the first padded page only: a refused sort is refused * on the first page already. The order is dropped for the rest of the candidate read only once the * read without it succeeds, since a read failing both ways says nothing against the sort. */ private readWithInboxSort; private paddedPageReason; } //# sourceMappingURL=inbox-poll.d.ts.map