@sema-agent/core
Version:
Stateless, task-oriented AI agent core
36 lines (35 loc) • 3.2 kB
TypeScript
/**
* What a delegation's two auto-mode classifications put on its result when one gave no ruling or ruled against the work:
* the hand-back lead line (the flag, else the reference's no-ruling note), the sub-agent's label for the notice sentence, and
* the result's {@link DelegationUnreviewed} record. Pure text and record builders; the classification itself is read by
* `readDelegationReview` (core) and asked by the delegation tool.
*/
import type { AutoModeClassifierRound, AutoModeFallbackCause } from "../core/auto-mode.js";
import type { DelegationUnreviewed } from "../core/classifier-unavailable-arm.js";
/** The reference's conditional hand-back note (cli321.js:288740) "when reviewing this subagent's work", for a classification
* that did not rule: the subject is the classifier model when the decider can vouch for its name, the form follows the
* cause. Separate from the report's unconditional "Verify this result" line — this one appears only then. */
export declare function handbackNoRulingNote(cause: AutoModeFallbackCause, attribution: AutoModeClassifierRound | undefined): string;
/** What the hand-back classification produced: the FLAG (`warning`, a block ruling), or — no ruling — its cause
* (`noRuling`) and the note the report carries for it (`note`). Never both; neither = nothing to say. */
export interface HandbackReview {
readonly warning?: string;
readonly noRuling?: AutoModeFallbackCause;
readonly note?: string;
}
export declare const HANDBACK_REVIEW_SILENT: HandbackReview;
/** A reason spliced into a sentence that closes it itself: its own closing period is dropped (no ".." when the reason is a
* whole sentence, as the parse-failure sentence is). */
export declare const sentenceBody: (reason: string) => string;
/** The sub-agent as the user knows it, for a `classifier.unavailable` sentence: the first non-blank of what the site knows it
* by (an Agent call: its explicit name, the description it was given, its type; a workflow agent: its script label) —
* redacted and cut by the report's own helper, folded and defused by the one inline escape; absent when none is known. */
export declare function reviewSubjectOf(...candidates: readonly unknown[]): string | undefined;
/** The line the hand-back classification puts at the head of the report: the flag, else the no-ruling note, else none. */
export declare const handbackLeadOf: (review: HandbackReview) => string | undefined;
/** Attach the hand-back lead line ({@link handbackLeadOf}) to a BACKGROUND child's output text. The durable row and the
* notification frame are two consumers of one value — derived here once, so a flagged (or unreviewed) child can never read
* one way on the row and another in the notification. No lead ⇒ the text is untouched. */
export declare function withHandbackLead(review: HandbackReview, result: string | undefined): string | undefined;
/** The result's {@link DelegationUnreviewed} record from the two no-ruling causes; absent when neither slot is filled. */
export declare function unreviewedOf(spawn: AutoModeFallbackCause | undefined, handback: AutoModeFallbackCause | undefined): DelegationUnreviewed | undefined;