import type { FactoryRuleBoardClosure, FactoryRulePhaseContext } from '../rules/types.js'; import type { WorkItemRow } from '../storage/domains/work-items/base.js'; import type { BoardEventIntegration, BoardEventRules, BoardPhaseKind, BoardToolResultRuleHandler } from './define-board.js'; import type { BoardRegistry } from './registry.js'; export interface PhaseSemantics { readonly kind: BoardPhaseKind; /** Seat that carries a working phase; absent for resting and terminal phases. */ readonly role?: string; } /** * Board that owns a work item. Rows created before boards were persisted carry no `board`; * they belong to Review when they track a pull request and to Work otherwise, matching the * legacy assignment the transition service performs on their next move. */ export declare function boardForWorkItem(item: Pick): string; /** * What the installed board says `phase` means. Returns undefined when the board is not * installed or does not declare the phase; callers must fail closed on undefined rather * than guess from the phase name. */ export declare function resolvePhaseSemantics(boards: BoardRegistry, boardId: string, phase: string): PhaseSemantics | undefined; /** * Tool-result rule the installed board declares for `toolName`. Undefined when the board is * not installed or declares no rule for the tool; callers must run nothing in that case. */ export declare function resolveBoardToolRule(boards: BoardRegistry, boardId: string, toolName: string): BoardToolResultRuleHandler | undefined; /** * Integration event handlers the installed board declares for cards on it, or undefined when the * card is unbound, the board is not installed, or it declares none for this integration. Within the * map, `null` means the board switched that event off for its cards. */ export declare function boardEventHandlers(boards: Pick, boardId: string | undefined, integration: I): BoardEventRules[I] | undefined; /** * Board whose event handlers answer an integration evaluation: the bound card's board, except on * the evaluation that files a pull request's own Review card, which is about a card that does * not exist yet. */ export declare function eventBoardId(context: { readonly item?: unknown; readonly board?: string; readonly pullRequestIntake?: boolean; }): string | undefined; /** What a card's single current phase means on its installed board, for integration rule contexts. */ export declare function rulePhaseContext(boards: Pick, item: Pick): FactoryRulePhaseContext | undefined; /** * Whether a persisted card has finished, judged by the board it sits on: the installed * board's phase kind first, then the built-in Work and Review names for rows whose board is * not installed. Unknown boards or phases are never terminal, so a card is only ever * released from ownership on the board's own say-so. */ export declare function isTerminalWorkItem(boards: BoardRegistry, item: Pick): boolean; /** Semantics of the single stage a work item currently occupies; undefined for multi-stage rows. */ export declare function workItemPhaseSemantics(boards: BoardRegistry, item: Pick): PhaseSemantics | undefined; /** * Where source-closed rules send a persisted card: the `sourceClosed` mapping its installed * board declares, plus whether the card already sits in a terminal phase. Undefined when the * board is not installed or declares no mapping, so closing the source leaves the card alone. */ export declare function resolveBoardClosure(boards: BoardRegistry, item: Pick): FactoryRuleBoardClosure | undefined; /** Rule-context fragment carrying the card's `boardClosure`, empty when the board declares none. */ export declare function withBoardClosure(boards: BoardRegistry, item: Pick): { boardClosure?: FactoryRuleBoardClosure; }; /** `{ phase }` for spreading into an integration rule context, or `{}` when the phase is unknown. */ export declare function rulePhaseField(boards: Pick, item: Pick): { readonly phase?: FactoryRulePhaseContext; }; //# sourceMappingURL=semantics.d.ts.map