Skip to content
SegmentStream/ Docs

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu

@segmentstream/ontology/review

8 public exports from @segmentstream/ontology/review.

Public exports

DEFAULT_REVIEW

The key of the review for everyone no role matches.

const DEFAULT_REVIEW = "default"
REVIEW_MODES

Reply review's policy (`docs/agent.md`, "Reply review"): who sends the agent's replies, by the roles of the person a reply answers. The agent declares it in `review` of `agent/segmentstream.json`; the agent SDK validates it and judges replies, and the ontology service applies it with the roles the person holds when the reply is proposed. Both read it here, so a reply is reviewed by one rule wherever it is decided. - `never`: the reply is sent as written; - `always`: every reply waits for a member to approve, edit or reject it; - `whenUnsure`: the reply is sent when the decision model gives at least `minConfidence` that staff would send it as written, and held otherwise. What staff check a reply for, the criteria, stays with the agent: this policy is only the modes and thresholds.

const REVIEW_MODES: readonly [
    "never",
    "always",
    "whenUnsure"
]
Review

One review: a mode, and for `whenUnsure` the confidence a reply needs to be sent.

type Review = {
    readonly mode: "never";
} | {
    readonly mode: "always";
} | {
    readonly mode: "whenUnsure";
    readonly minConfidence: number;
};
ReviewMode
type ReviewMode = (typeof REVIEW_MODES)[number];
ReviewSettings

The review per role of the person a reply answers, and the review of everyone else.

interface ReviewSettings<Entry extends Review = Review> {
    readonly byRole: Readonly<Record<string, Entry>>;
    readonly default: Entry;
}
SEND_REPLIES

Without `review`: replies are sent as written.

const SEND_REPLIES: {
    readonly mode: "never";
}
reviewFor

The review for a person with `roles`: the first `byRole` entry they hold, or the default.

function reviewFor<Entry extends Review>(settings: ReviewSettings<Entry> | undefined, roles: ReadonlyArray<string>): Entry | typeof SEND_REPLIES;
reviewPasses

Whether a reply under `review` is sent as written: always under `never`, never under `always`, and under `whenUnsure` only with a `confidence` of at least `minConfidence`. A reply nobody judged, `null` or `undefined`, is held: a missing judgment never sends a reply unreviewed.

function reviewPasses(review: Review, confidence: number | null | undefined): boolean;