81 lines
2.8 KiB
TypeScript
81 lines
2.8 KiB
TypeScript
import type { CandidateDiscriminatorProbe } from "./candidate-contrast-packet.ts";
|
|
import type { CandidateScoreRow, CandidateSeparation } from "./candidate-separation.ts";
|
|
import {
|
|
decideRectification,
|
|
offerSessionKinds as offerKindsFromDecision,
|
|
sessionKindFromNextAction as sessionKindFromDecision,
|
|
type DecisionSessionOutcome,
|
|
type HoldoutValidationStatus,
|
|
type RectificationNextActionType,
|
|
} from "./rectification-decision.ts";
|
|
|
|
export type {
|
|
HoldoutValidationStatus,
|
|
RectificationNextActionType,
|
|
} from "./rectification-decision.ts";
|
|
|
|
export type DecideNextActionInput = Readonly<{
|
|
methodCoverageAll: boolean;
|
|
proposeAllowed?: boolean;
|
|
confirmationAllowed?: boolean;
|
|
userStopped?: boolean;
|
|
selectionAllowed?: boolean;
|
|
snapshotCurrent?: boolean;
|
|
trainingGateOpen?: boolean;
|
|
candidateScores: readonly CandidateScoreRow[];
|
|
discriminatorProbe?: CandidateDiscriminatorProbe | null;
|
|
holdoutValidation?: HoldoutValidationStatus;
|
|
accepted?: boolean;
|
|
inferenceCredibleRange?: readonly [string, string] | null;
|
|
inferenceRounds?: number;
|
|
effectiveAnswerCount?: number;
|
|
plateauRounds?: number;
|
|
}>;
|
|
|
|
export type RectificationNextAction = Readonly<{
|
|
type: RectificationNextActionType;
|
|
separation: CandidateSeparation;
|
|
probe: CandidateDiscriminatorProbe | null;
|
|
}>;
|
|
|
|
/**
|
|
* Training coverage unlocks discrimination when a renderable probe exists.
|
|
* Incomplete method layers (family/occupation) must not block that step,
|
|
* and must not grant adoption.
|
|
* Exact-minute confirmation stays fail-closed; a range completion is allowed.
|
|
*/
|
|
export function decideNextAction(input: DecideNextActionInput): RectificationNextAction {
|
|
const decision = decideRectification({
|
|
methodCoverageAll: input.methodCoverageAll,
|
|
confirmationAllowed: input.confirmationAllowed,
|
|
userStopped: input.userStopped,
|
|
snapshotCurrent: input.snapshotCurrent,
|
|
trainingGateOpen: input.trainingGateOpen,
|
|
candidateScores: input.candidateScores,
|
|
discriminatorProbe: input.discriminatorProbe,
|
|
holdoutValidation: input.holdoutValidation,
|
|
accepted: input.accepted,
|
|
inferenceCredibleRange: input.inferenceCredibleRange,
|
|
engineCeiling: {
|
|
acceptanceAllowed: input.selectionAllowed === true,
|
|
selectionAllowed: input.selectionAllowed === true,
|
|
proposeAllowed: input.proposeAllowed === true,
|
|
confirmationAllowed: input.confirmationAllowed === true,
|
|
},
|
|
inferenceRounds: input.inferenceRounds,
|
|
effectiveAnswerCount: input.effectiveAnswerCount,
|
|
plateauRounds: input.plateauRounds,
|
|
});
|
|
return { type: decision.nextAction, separation: decision.separation, probe: decision.probe };
|
|
}
|
|
|
|
export function sessionKindFromNextAction(
|
|
type: RectificationNextActionType,
|
|
): DecisionSessionOutcome {
|
|
return sessionKindFromDecision(type);
|
|
}
|
|
|
|
export function offerSessionKinds(): readonly string[] {
|
|
return offerKindsFromDecision();
|
|
}
|