UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

40 lines (39 loc) • 2.99 kB
/** * The person's account of an allow rule auto mode does not use (`permission.allow_rule_not_used_in_auto`). * * In `auto` the allow layer stands down the entries that would let a call skip the classifier (`auto-strip.ts`, one judgment, * applied per call by every allow member). Without a word, a person who saved `Bash(npm run:*)` sees the rule listed and every * `npm run` asked anyway. This seat is the word: the strip hands it each entry it took from a call that entry speaks for, and * the notice is minted ONCE PER CONVERSATION PER RULE (attention `audit`) — the session's announced record (`tellOncePerSession`), keyed on where the * rule is kept and what it says, so a later call, a later run of the conversation and a forked leg that starts from the * conversation's record say nothing more. A delegated leg's notice is addressed through the leg's notice seat (`LegNotice`). */ import { type EngineNotice } from "../engine-notice.js"; import type { AutoStripReason } from "../auto-strip.js"; import type { PersonalRuleSource } from "../permission-rule-provider.js"; import type { AllowEntrySource } from "../allow-entry.js"; import type { ToolCallRequest } from "../tool-policy.js"; import type { LegNotice } from "../leg-identity.js"; import { type RunTimeAnnounced } from "./announce-once-ledger.js"; export declare const ALLOW_RULE_NOT_USED_IN_AUTO = "permission.allow_rule_not_used_in_auto"; /** Where the rule is kept: a stored row's source (the store's own words), or the list it was handed in on (the allow lists' words). * `request` is the list the task was handed (`TaskSpec.allowedTools`), said as that list and no more: the engine does not know which * settings file or layer the host wrote the rule in, so the sentence names none; a host that does know says it, looking the rule up by `detail.entry`. */ export type AutoStripSource = PersonalRuleSource | AllowEntrySource | "skill"; /** One entry the strip took from a call: the rule as written, where it is kept, why, and (a skill's) the skill. */ export interface AutoStrippedRule { readonly entry: string; readonly source: AutoStripSource; readonly reason: AutoStripReason; readonly skill?: string; } /** The notice for one rule. `detail.entry` is the rule string as the list member carried it (`noticeRuleText`: untouched up to its bound), the * key a host finds its own row by; the sentence spells it for a person and says no more of its source than {@link whereKept} knows. */ export declare function allowRuleNotUsedInAutoNotice(r: AutoStrippedRule, call: ToolCallRequest, address: LegNotice["route"]["address"], runId: string): EngineNotice; /** The leg's seat: the strip's listener, telling each rule once per conversation. */ export declare function createAutoStripNotice(input: { onNotice: ((notice: EngineNotice) => void) | undefined; legNotice: LegNotice; runId: string; announced: RunTimeAnnounced; }): (r: AutoStrippedRule, call: ToolCallRequest) => void;