@sema-agent/core
Version:
Stateless, task-oriented AI agent core
30 lines (29 loc) • 2.4 kB
TypeScript
/**
* Who may clear an ask that demands a person — the rule {@link import("./tool-policy.js").AskRequest.requiresRealApproval}
* states ("a person, not a configuration"), in one place for every station that settles such an ask. Two allows
* are a configuration: the blanket `onAsk: "allow"` seat, and an approver's allow it reports as the deployment's
* policy (`settledBy: "policy"` / `hostDecision.decidedBy: "policy"`). A person's allow clears the ask; the policy
* may still refuse it.
*/
import type { Checkpoint } from "./checkpoint-store.js";
import type { HostDecider } from "./gate-outcome.js";
import type { OrgGateVerdict } from "./hooks.js";
import type { AskRequest, PermissionResult, ResolverArmResult } from "./tool-policy.js";
/** The synchronous seat's refusal of a configuration's allow: one settlement word for both forms
* (`blanket_allow_refused`, nobody's — no person decided), a sentence that says which configuration it was. */
export declare function unjudgedAllowRefused(req: AskRequest, by: "blanket" | "policy"): Extract<ResolverArmResult, {
action: "deny";
}>;
/** A durable row demands a person when its gate carries the real-approval bit (the gate's own, which every resume
* check reads; the pending action's `requiresRealApproval` is its display twin). A plan-pause gate carries no bit, so
* the same predicate lets the deployment's policy decide a plan pause — and would refuse it the day a gate stamps one. */
export declare function rowDemandsAPerson(cp: Checkpoint): boolean;
/** A question a decide is held against, in each form a station holds one: the parked row, a policy's re-check of an
* approver's edit, the organization's CURRENT verdict about the call, and the request an approver was handed (the card a
* live door answers). */
export type HeldQuestion = Checkpoint | PermissionResult | OrgGateVerdict | AskRequest;
/** Whether a decide made by `decidedBy` cannot answer the held question: a question demanding a person is not
* the policy's to answer. One predicate for every station that holds a decide against such a question — the resume
* entry (the row, an edit's re-check, the org's current verdict), the execution belt (the last two, re-read) and a live
* door answering the request an approver was handed. */
export declare function policyCannotAnswer(question: HeldQuestion, decidedBy: HostDecider): boolean;