@sema-agent/core
Version:
Stateless, task-oriented AI agent core
438 lines (437 loc) • 33.6 kB
TypeScript
/**
* The person's persisted rules as ONE run reads them.
*
* ## One read per judgment of a call's bytes
*
* A call's bytes are judged against ONE read of the store, pinned to its `toolCallId` ({@link PersonPathRows.pin}): whichever
* of the consumers judging those bytes asks first — the read station's judgment, the org layer, the personal rule lane —
* takes the read, the others are handed the same answer, and the tables the call's tool judges with when it executes are
* compiled from it ({@link PathTablesFacade.forCall}). Judging other bytes of the same call (an approved edit) is another
* judgment: it takes a new read, which the call then holds — a rule written while a person decided binds their edit. A call is an attempt the leg's occurrence table holds; the pin is released when the
* table no longer holds that attempt. A judgment that is no call of the leg (a visibility probe's fixed id, a gate with no
* leg) keeps nothing: its rule lanes take a read of their own, its read station the run's latest tables.
*
* ## One read per request
*
* A model request's view of the tool table stands on one read per request ({@link PersonPathRows.forRequest}), asked when the
* request is sent: a read asked earlier may have been asked before a tool the request follows wrote a rule (a call's read
* always is; a visibility probe's may be — a changed-files scan outlives its turn's boundary). Two reads stand for a request
* instead, and ask the store nothing new: the prepare read, for the first request while no read has started after it (no
* call has been judged before it); and the newest read the store has left unanswered past its bound, asked since the
* previous request, while no read started after it has been answered — its verdict is the failure law's, the one a new read
* of the silent store would give. A store that answers slowly, or not at all, so costs a request at most one bound beyond its
* calls' own reads.
*
* ## The run's unit, one entry per partition
*
* Every read's outcome lands in the run's unit, per personal partition (the durable one — its user and project rows — and
* the session one), and only where it is newer, by the order the reads STARTED: a read that answers late never replaces
* a later one. The prepare read is the unit's first write. A reader that is not a call (the compaction's kept-tail
* normalizer, the user-attachment seat's reader (the compaction restore's too), the Artifact tool's local read, a read root's grant eligibility, the classifier's table, a language server's session read)
* reads the unit's newest tables: while the rows the unit last took are compiling it waits for them (within
* {@link PATH_TABLES_READY_BOUND_MS}), and a read of tables still compiling, or that could not be compiled, refuses —
* never the tables of rows the unit has since replaced.
*
* ## One failure law, every consumer
*
* A partition a read could not read (it failed, or the whole read failed or did not answer in time) contributes the deny
* and ask rows of the run's last successful read of that partition, and none of its allow rows (a `Read(//dir/**)` read
* directory among them): what could not be read widens nothing, and what was read before still protects. A partition the
* read did read contributes its rows as read, both directions. The cost: a deny row the person just removed keeps
* refusing while its partition cannot be read — the run's one notice says so. The same law holds row by row: a row whose identity
* read and only bookkeeping did not is among the rows read (as written); beside the rows of a read that has rows whose identity it could
* not read (`EffectivePermissionRules.unreadableRows`), the partition keeps the deny and ask rows it
* stood on before that read (one it holds already counts once), so they stay until a read reads every row; the rows it could not
* read are carried as rows are — the read's own, or the last success's while its partition cannot be read — and, while one whose
* reach is every call stands, a judgment that is no call refuses as for a partition that could not be read: the tables cannot
* hold a row nobody can read.
*
* ## One table facade
*
* The read deny table, the write deny table and the read directories are compiled from the rows a read stands on, once
* per distinct content (row text and stored fields × scope, which fixes the anchors; the directories), and held behind one facade whose
* every reader takes the call's tables or the unit's latest.
*/
import type { EffectivePermissionRules, PermissionRuleStoreProvider, PersonRowsRead } from "../permission-rule-provider.js";
import type { RuleOwner } from "../rule-owner.js";
import { type OrgRuleResolution } from "../permission-rule-org.js";
import { type PathRuleBases } from "../permission-rule-model.js";
import { type BoundPathRule, type HeadLeads } from "../path-rule-binding.js";
import { type RuleStoreFault } from "../rule-store-fault.js";
import type { RunnerDeps } from "../runner-deps.js";
import { type JudgedPathRow, type PathRuleDenyRow, type ReadDenyBuiltinConfig, type ReadDenyEntry, type ReadDenyRootAnswer, type ReadDenySeat, type WriteDenyMatcher } from "../../tools/fs/read-deny.js";
import { type HomeViewSource, type PlacedReadDenyMatcher } from "../../tools/fs/read-deny-home.js";
import { type ReadStationMember } from "../../tools/fs/file-read-check.js";
import { type ShellReadCheck } from "../../tools/fs/shell-read-check.js";
import type { ReadAskRow } from "../../tools/fs/shell-read-judge.js";
import type { ConfinedDenyRows } from "../shell-read-silence.js";
import { type SessionPermissionRules } from "../session-policy-store.js";
import type { SkillGrantRecord } from "../skill-grant.js";
import type { AgentTool, ExecutionEnv } from "../../internal/harness-types.js";
/**
* How long a read waits for the store before its call is judged by the failure law: one second inside the rule lanes' own
* wait (`ORG_ADJUDICATION_TIMEOUT_MS`, the gate's bound on each lane), so the law's answer — the deny and ask rows last
* read — reaches a lane before the lane's wait ends and reads its absence as no rule at all.
*/
export declare const PERSON_READ_BOUND_MS: number;
/** The one bound on path tables becoming ready: a compile settles or fails within it, and a reader waits for its tables at
* most this long (a call's own, or the unit's newest) before it reads them — and is refused if they are not ready. */
export declare const PATH_TABLES_READY_BOUND_MS = 30000;
/** The person's rows a run's path tables take: their face-keyed path deny rows, bound at their anchors, the
* directories of their `Read(//dir/**)` allow rows (lexical, absolute), and their other path rows for the READ face
* (`readFaceRows`). */
export interface PersonTableRows {
readonly denyRows: readonly BoundPathRule[];
readonly readDirectories: readonly string[];
/** Their path allows whose face column holds the read face (a `Read(<path>)` that is no directory row, any `Edit(<path>)`:
* an edit allowed is a read allowed) and their `Read(<path>)` ask rows, bound at their anchors — the shell read boundary's
* member (`ShellReadBoundary.readRuleRows`). A boundary takes the allows only while no seat beyond it stands over the read
* face ({@link PersonPathRows.boundaryRows}), on a leg that honors the person's rows ({@link boundaryRowsOver}). PRESENT-IFF a
* row of either. */
readonly readFaceRows?: PersonReadFaceRows<BoundPathRule>;
/** Their path ask rows whose face column holds the WRITE face (an `Edit(<path>)` ask), bound at their anchors — the shell read
* boundary's member of its own (`ShellReadBoundary.writeAskRows`), never joined to the read-face rows. A row this leg cannot
* anchor is not a member. PRESENT-IFF such a row. */
readonly writeAskRows?: readonly BoundPathRule[];
/** Their write-face ask rows this leg cannot anchor (the base words each needs). PRESENT-IFF such a row. */
readonly writeAskUnanchored?: readonly WriteAskUnanchored[];
}
/** A write-face ask row a leg cannot anchor: its text and the base words it needs ({@link PathTables.writeAskUnanchored}). */
export interface WriteAskUnanchored {
readonly rule: string;
readonly needs: readonly string[];
}
/** {@link PersonTableRows.readFaceRows}. */
export interface PersonReadFaceRows<R extends JudgedPathRow = JudgedPathRow> {
readonly allow: readonly R[];
readonly ask: readonly R[];
}
/**
* The seats BEYOND the shell read boundary — a closed set, each holding rows over the READ face that the boundary does not take:
* `org`, the org partition (its layer reads the shell's command grammar alone, so a `Read(…)` / `Edit(…)` row is one it cannot
* read); `session_rules`, the operator's stored rules of this task's session; `ancestor_session_rules`, those of each ancestor's
* session this leg enforces; `skill_grants`, the active skills' rows (one activated mid-run included). Each is read at the
* judgment, as it stands then. While one holds a deny or ask row standing over the read face, or cannot be read, a person's
* path allow admits no shell read ({@link PersonPathRows.boundaryRows}): the station is then as it was before the person's path
* allows joined its boundary — those rows ask or refuse the file tools, and the allow would otherwise read past them on the
* shell. It gives them no reading of their own on the shell; a person's directory rule (a read root) reads as it did before too.
*/
export declare const READ_FACE_SEATS_BEYOND: readonly ["org", "session_rules", "ancestor_session_rules", "skill_grants"];
export type ReadFaceSeatBeyond = (typeof READ_FACE_SEATS_BEYOND)[number];
/** One seat beyond the boundary as a judgment reads it ({@link READ_FACE_SEATS_BEYOND}). */
export type SeatBeyondReading = {
readonly seat: Extract<ReadFaceSeatBeyond, "org">;
readonly org: OrgRuleResolution;
} | {
readonly seat: Extract<ReadFaceSeatBeyond, "session_rules" | "ancestor_session_rules">;
readonly rules: SessionPermissionRules;
readonly unread?: boolean;
} | {
readonly seat: Extract<ReadFaceSeatBeyond, "skill_grants">;
readonly records: readonly SkillGrantRecord[];
};
/** Does one seat beyond the boundary stand over the read face: a deny or ask row over it, a session allowlist that does not admit
* the read face's tool whole (it refuses the reads it does not name), or rules the seat cannot read — a session layer whose last
* read could not read its store (`unread`: it enforces the rows it last read, unseen) among them? */
export declare function seatStandsOverReads(s: SeatBeyondReading): boolean;
/** The seats beyond the boundary other than the org partition (which rides each read of the person's rows), each read when a
* judgment asks: this task's session rules as its layer enforces them and whether its last read could read them (absent: no
* layer), each ancestor's, the active skills' rows. */
export type SeatsBeyondNow = {
readonly session_rules: () => {
readonly rules: SessionPermissionRules;
readonly unread: boolean;
} | undefined;
readonly ancestor_session_rules: () => ReadonlyArray<{
readonly rules: SessionPermissionRules;
readonly unread: boolean;
}>;
readonly skill_grants: () => readonly SkillGrantRecord[];
};
/** A run's path tables, compiled over one set of the person's rows beside the leg's own. */
export interface PathTables {
/** The read deny table, placed at its homes. */
readonly readDeny: PlacedReadDenyMatcher;
/** The table the structured Read tool judges with where the leg's request released built-in rows
* (`TaskSpec.readDenyBuiltinExclude`): {@link readDeny} without those rows, placed at the same homes. Every other reader —
* the shell, the search tools, the carriers of a file — keeps {@link readDeny}. PRESENT-IFF the leg released a row. */
readonly structuredReadDeny?: PlacedReadDenyMatcher;
/** The write deny table, with the read table's home views. */
readonly writeDeny: WriteDenyMatcher & {
readonly homeViews: HomeViewSource;
};
/** The person's read directories, canonical. */
readonly readDirectories: readonly string[];
/** The read-face path rows beside the deny table, the shell read boundary's member: the person's path allows, and the ask rows
* of the leg's policies (marked `policy`) and of the person, also where their heads lead. PRESENT-IFF a row of either. */
readonly readFaceRows?: {
readonly allow: readonly JudgedPathRow[];
readonly ask: readonly ReadAskRow[];
};
/** The write-face ask rows — the leg's policies' (marked `policy`) and the person's ({@link PersonTableRows.writeAskRows}) — AS
* BOUND: the shell read boundary's member of its own. Where their heads lead is not looked up with the tables (no mode that leaves
* them uncounted pays for it or fails on it): {@link writeAskRowsLed} does, once, when a reader that counts them asks.
* PRESENT-IFF such a row. */
readonly writeAskRows?: readonly ReadAskRow[];
/** {@link writeAskRows} also where their heads lead — looked up on the first call, then the same answer; rejects when the lookup
* fails or passes {@link PATH_TABLES_READY_BOUND_MS} (that judgment then fails: the station's own fail-closed answer).
* PRESENT-IFF {@link writeAskRows}. */
readonly writeAskRowsLed?: () => Promise<readonly ReadAskRow[]>;
/** The write-face ask rows the leg cannot anchor (the person's and its policies'): no member, said by the reader that counts
* such a row. PRESENT-IFF such a row. */
readonly writeAskUnanchored?: readonly WriteAskUnanchored[];
/** The rule rows both tables were compiled over (the leg's own and the person's, as bound — before their twins where
* their heads lead): what the tables say they guard. */
readonly ruleRows: readonly PathRuleDenyRow[];
}
/** A read-root set read per judgment, and the one a call judges with (`forCall`: its pinned read's, or the latest); `ready`
* settles once the set a reader that is no call takes is compiled ({@link PersonPathRows.tablesReady}). */
export type ReadRootsSeat = (() => readonly string[]) & {
forCall(toolCallId: string | undefined): () => readonly string[];
ready(signal?: AbortSignal): Promise<void>;
};
/** The read-root seat of a leg with no read face: no roots, ready. */
export declare const EMPTY_READ_ROOTS: ReadRootsSeat;
/** The tables, a call's or the unit's newest: `forCall(undefined)` and a call holding no pinned read take the newest — a
* read of them while they compile, or after they could not be compiled, throws (the check refuses). */
export interface PathTablesFacade {
/** The tables ONE call judges with: its pinned read's, or the unit's newest (an unknown or released call). */
forCall(toolCallId: string | undefined): PathTables;
/** The read deny table: each judgment reads the unit's latest; `forCall` hands a call its own. */
readonly readDeny: PlacedReadDenyMatcher & {
forCall(toolCallId: string | undefined): PlacedReadDenyMatcher;
};
/** The structured Read tool's table ({@link PathTables.structuredReadDeny}, else {@link readDeny}), the same way. */
readonly structuredReadDeny: PlacedReadDenyMatcher & {
forCall(toolCallId: string | undefined): PlacedReadDenyMatcher;
};
/** The write deny table, the same way. */
readonly writeDeny: WriteDenyMatcher & {
readonly homeViews: HomeViewSource;
forCall(toolCallId: string | undefined): WriteDenyMatcher & {
readonly homeViews: HomeViewSource;
};
};
/** The person's read directories (canonical), a call's or the unit's latest. */
readDirectories(toolCallId?: string): readonly string[];
/** The rule rows of the unit's latest tables ({@link PathTables.ruleRows}). */
ruleRows(): readonly PathRuleDenyRow[];
}
/** The one reader of a run's person's store. */
export interface PersonPathRows {
/** Whether the run has a person whose rows a read could carry (a durable partition, and an owner). */
readonly holdsPersonRows: boolean;
/** The owner a session rule written NOW for this run is written as — present exactly when such a rule would be READ BACK by
* this run and by the next run of its session, and could be written without taking anything new: the one predicate a card
* asks before it offers a session-long grant, and the write asks again before it takes the writer. The person's rows are held
* ({@link holdsPersonRows}: a durable partition, a principal or the declared local owner), the deployment has a session
* partition, the run has a session id, and the owner's store already holds its write face (`holdsRuleWriter`: asked without
* acquiring it — a session rule never takes the rule store's writer for itself). The last can move during a run (a host
* takes or releases its writer), so every ask reads it afresh. Absent ⇒ a grant lasts the run. */
sessionRowOwner(): RuleOwner | undefined;
/** The prepare read — the unit's first write. `undefined`, synchronously, when there is no person's rows to read. */
prime(): Promise<void> | undefined;
/** The rows of a call's one read of the bytes it judges (`judged`) — a call the leg's occurrence table holds: taken by its
* first consumer, handed to every other that judges the same bytes (or names none) until the table no longer holds that
* attempt; a judgment of OTHER bytes of the call (an approved edit, its outlet form) takes a new read, which the call then
* holds — a judgment reads the store, as the session rules' does. Any other judgment (no leg, or an id the table does not
* hold — a visibility probe) takes a read of its own, kept by nobody. Bounded ({@link PERSON_READ_BOUND_MS}); never rejects. */
pin(toolCallId: string, judged?: unknown): Promise<PersonRowsRead>;
/** The read one model request's view of the tool table stands on, which the request then holds: a read asked now — or,
* asking the store nothing new, the prepare read for the first request, and the newest read asked since the previous
* request that the store has left unanswered past its bound. Bounded ({@link PERSON_READ_BOUND_MS}); never rejects. */
forRequest(): Promise<PersonRowsRead>;
/** Settles once the tables a reader takes are compiled and the scopes of the bad rows of the read they stand on are judged (or
* their judgment ran out of time): a pinned call's own; any other reader's (no id, or a call holding no pin), the unit's newest —
* through every change that lands meanwhile, within {@link PATH_TABLES_READY_BOUND_MS} —
* or at `signal` or the run's cut ({@link PersonPathRowsConfig.signal}). Never rejects: a reader whose wait was cut
* checks its own signal and refuses; tables still compiling, or that could not be compiled, refuse at the read
* ({@link PathTablesFacade.forCall}). */
tablesReady(toolCallId?: string, signal?: AbortSignal): Promise<void>;
/** Whether `toolCallId` is a call of the leg (an attempt its occurrence table holds): the judgments that read a call's
* one read. A read station's judgment that is no call reads the run's latest tables and takes no read. */
holds(toolCallId: string): boolean;
/** Whether a partition of the rows a judgment stands on could not be read, or a row of them that reaches every call
* (`EffectivePermissionRules.unreadableRows`) — a pinned call's read's, or the run's latest read of each partition: there "no
* row forbids this" cannot be told from "a row it cannot see does" (`false` for a run with no person's rows). */
unreadFor(toolCallId?: string): boolean;
/** The tables over the unit's latest and every call's read, compiled by `compile` (the leg's own rows beside the
* person's): compiled now from the unit's latest. */
attachTables(compile: (person: PersonTableRows) => Promise<PathTables>): Promise<PathTablesFacade>;
/** The read-face rows a shell read boundary takes from a judgment's tables: as compiled, the person's path allows held out
* while a seat beyond the boundary stands over the read face ({@link READ_FACE_SEATS_BEYOND}) — the org partition as the
* judgment's read answered it (a read that failed: the last answer's), every other seat as it stands now. */
boundaryRows(tables: PathTables, toolCallId?: string): PathTables["readFaceRows"];
}
export interface PersonPathRowsConfig {
provider: PermissionRuleStoreProvider | undefined;
localOwnerDeclared: boolean;
principal: string | undefined;
/** The session whose session-scoped rows are read; `undefined` ⇒ none. */
sessionId: string | undefined;
/** The leg's own root: which project rows apply (either spelling of it — {@link projectScopeIdentity}); `undefined` ⇒ none. */
root: string | undefined;
rootCanonical: string | undefined;
/** The leg's resolution of locations (a project row's scope root, where it leads). */
leads: HeadLeads;
/** The anchors of the global / session rows and of `~/`: the chain's top leg's root and home. */
chainTop: PathRuleBases;
/** The leg's calls: a call is pinned to its attempt here, and released when the table no longer holds that attempt. */
occurrences?: {
get(toolCallId: string): unknown;
};
/** An engine defect the run must hear of beyond its trace (a table that could not be compiled). */
onDefect?: (err: Error) => void;
/** The operator's line for each read the store could not answer, each disclosure line a read carries, each row a table
* could not anchor. */
onDisclosure: (message: string) => void;
/** The notice for a store that could not be read (`ruleStoreUnreadableNotice`, rule-store-unreadable-notice.ts), with why: told once per
* session per fault set — or, `rows` given, for that many rows whose identity could not be read (the calls they reach take the store form). */
onUnread: (at: "prepare" | "call", faults: readonly RuleStoreFault[], rows?: number) => void;
/** The run's one notice for rows left out, and for deny and ask rows that could not be read whole ({@link ruleRowsDroppedNotice}). */
onRowsDropped: (rows: EffectivePermissionRules["droppedRows"], unreadable?: EffectivePermissionRules["unreadableRows"]) => void;
/** The run's cut: a read it interrupts is abandoned quietly — a cancelled wait is no fact about the store — and every wait
* on the tables ends at it. */
signal?: AbortSignal;
/** The seats beyond the shell read boundary that do not ride a read ({@link SeatsBeyondNow}); absent ⇒ none. */
seatsBeyond?: SeatsBeyondNow;
}
export declare function createPersonPathRows(cfg: PersonPathRowsConfig): PersonPathRows;
/** The compile of a run's path tables over the leg's own rows beside one set of the person's: every row also judged where
* its head leads in this environment; the home-anchored and rooted rows placed at their homes and where they lead (the
* leg's declared configuration roots and its caller's homes among them); the write face over the same rows with the read
* table's home views; the person's read directories canonicalized by `canonicalize` (the leg's admission of a declared read root). */
export declare function pathTablesCompile(seats: {
readonly env: ExecutionEnv;
readonly additions: readonly ReadDenyEntry[];
readonly builtin: ReadDenyBuiltinConfig;
/** The built-in configuration of the structured Read tool's table ({@link PathTables.structuredReadDeny}): present where the
* leg's request released rows, compiled over the same rows and placement as the read table. */
readonly builtinStructuredRead?: ReadDenyBuiltinConfig;
readonly legRows: readonly PathRuleDenyRow[];
/** The leg's own read-face ask rows (its policies' `Read(<path>)` asks), beside the person's. */
readonly legReadAskRows: readonly JudgedPathRow[];
/** The leg's own write-face ask rows (its policies' `Edit(<path>)` asks), beside the person's — one marked `unanchored` is no member;
* absent ⇒ none. */
readonly legWriteAskRows?: readonly (JudgedPathRow & {
readonly unanchored?: readonly string[];
})[];
readonly leads: HeadLeads;
/** Where the write-face ask rows' heads lead, where a location the environment did not answer for is no answer — never "no twin",
* never its parent's spelling (the judgment that asked fails; the next asks again — `createHeadLeads`' `unansweredRejects`). */
readonly writeAskLeads: HeadLeads;
readonly configRoots: readonly string[];
readonly callerHomes: readonly string[];
/** The task's workspace root (canonical): an `ExecutionEnv.otherHomeDirs` entry inside it places no row. */
readonly workspaceRoot?: string;
readonly canonicalize: (dirs: readonly string[]) => Promise<readonly string[]>;
}): (person: PersonTableRows) => Promise<PathTables>;
/** Whether a leg takes the person's rows as admitting reads: `honored` (the person's `Read(//dir/**)` allow rows widen the roots,
* their path allows join the shell read boundary), or `set_aside` (a leg that refuses reads outside its declared directories —
* `TaskSpec.blockReadsOutsideRoots` — reads its own roots alone, whatever the person's rows say: no directory of theirs widens a
* root ({@link readRootsOver}), no path allow of theirs admits a shell read ({@link boundaryRowsOver}); their ask rows still ask). */
export type PersonDirectories = "honored" | "set_aside";
/** The read-face rows a leg's shell read boundaries take: {@link PersonPathRows.boundaryRows}, or — on a leg that sets the
* person's rows aside ({@link PersonDirectories}) — the ask rows alone. */
export declare function boundaryRowsOver(rows: Pick<PersonPathRows, "boundaryRows">, personDirectories: PersonDirectories): PersonPathRows["boundaryRows"];
/** The read face's root set over the leg's own roots (`own`, read per judgment) and the person's read directories — a
* call's own (`forCall`) or the run's latest, both through one composition (`personDirectories` is read there, so neither
* reading can take a directory the other sets aside). A person's directory that admits any part of the local artifact store
* (`store`, once known) is no read root: the store rule an in-flight grant meets; `onHeld` hears each such directory once. */
export declare function readRootsOver(seats: {
readonly own: () => readonly string[];
readonly tables: PathTablesFacade;
readonly ready: PersonPathRows["tablesReady"];
readonly store: () => string | undefined;
readonly onHeld: (dir: string, store: string) => void;
readonly personDirectories: PersonDirectories;
}): ReadRootsSeat;
/** The deny seats a shell read boundary carries for one compiled table pair, through the ONE adapter every face mounting a
* deny table uses (`readDenySeat`: zero entries is no judge), resolved once per table. */
type WriteDenySeat = {
readonly writeDenyMatch?: (p: string) => string | null;
readonly writeDenyGuardsReads?: (pattern: string) => boolean;
readonly writeDenyUnder?: (p: string) => ReadDenyRootAnswer;
readonly writeDenyAtOrBelow?: (p: string) => string | null;
readonly writeDenyNamed?: {
readonly rows: readonly string[];
readonly ledBy: (entryName: string) => string | null;
};
};
export declare function denySeatsOf(t: PathTables): {
readonly read: ReadDenySeat;
readonly write: WriteDenySeat;
};
/** The deny rows ONE call may meet, as a confined Runner's mode point reads them (`ConfinedDenyRows`): on the call's own tables
* (`forCall(toolCallId)`, the read its judgment started with) or on the ones in force now (`forCall(undefined)`), by the presence
* rules the station's boundary is built with ({@link denySeatsOf}). Rows that could not be read (`unreadFor`), no tables (a leg
* without hands) or tables that could not be handed over (a throw) count as both kinds of row. */
export declare function confinedDenyRowsOf(tables: Pick<PathTablesFacade, "forCall"> | undefined, unreadFor: (toolCallId: string | undefined) => boolean, toolCallId: string): ConfinedDenyRows;
/**
* The leg's read stations as ONE gate input, each judgment on its call's pinned read of the person's rules: the station in
* the fold judges ahead of the rule lanes, so it takes the call's read before it judges — the read every later consumer of
* the call is handed — and judges with that read's tables (a judgment of the same call ahead of the fold, where an inherited
* station settles an ancestor's question, takes no read: {@link onNewestRead}). A
* judgment that is no call of the leg (no id, or one the leg does not hold) takes no read and judges with the run's
* newest tables once they are ready, as every reader that is no call does; a judged call the station finds nothing to
* read in is vouched for, as it would have been. (A partition of those rows that could not be read reaches the station on
* the boundary it judges with — {@link PersonPathRows.unreadFor} — where it vouches for nothing.)
*/
export declare function onPinnedRead(rows: PersonPathRows, stations: ReadonlyArray<ReadStationMember>): ShellReadCheck | undefined;
/**
* One read station judged ahead of the gate's fold — where an inherited station settles an ancestor's question about a call
* before the call reaches the station's own seat: the run's newest tables, once they are ready, and no read taken (a call's
* pinned read belongs to the bytes its fold judges, and the bytes judged here may still be rewritten before that). A
* judgment the station finds nothing to read in is vouched for.
*/
export declare function onNewestRead(rows: PersonPathRows, station: {
readonly check: ShellReadCheck;
readonly tools: ReadonlySet<string>;
}): ShellReadCheck;
/** A tool that holds the run's tables, run once the tables it reads are compiled (or the call is cancelled) — the tool
* reads its call's own (`seatForCall`) at the start of its execution; a call no gate consumer pinned reads the run's
* newest. The wait is bounded ({@link PATH_TABLES_READY_BOUND_MS}). */
export declare function afterCallTables(rows: PersonPathRows, tool: AgentTool): AgentTool;
/** A reader for one task's prepare: the deployment's store and owner, its notices on the run's one notice seats (`notices`,
* minted once per run: every reader of the run tells through them), its lines on the run's trace, cut by `signals` (the
* run's own; none for the judgment asked after the run has ended), released with the leg's calls. */
export declare function personPathRowsOfTask(t: {
readonly deps: Pick<RunnerDeps, "permissionRuleStore" | "localOwnerRules" | "tracer" | "onError">;
readonly notices: Pick<PersonPathRowsConfig, "onUnread" | "onRowsDropped">;
readonly principal: string | undefined;
readonly ruleSessionId: string;
readonly ids: {
readonly sessionId: string;
readonly runId: string;
readonly taskId: string;
};
readonly root: string;
readonly rootCanonical: string | undefined;
readonly leads: HeadLeads;
readonly chainTop: PathRuleBases;
readonly occurrences: {
get(toolCallId: string): unknown;
};
readonly signals: readonly AbortSignal[];
readonly seatsBeyond: SeatsBeyondNow;
}): PersonPathRows;
/**
* The run's ONE notice of stored rule rows (`config.entries_not_applied`, kind `stored_rule_row`; before 7.70.0 the code
* `permission.rule_row_dropped`; audience user): the person's store served rows that take no part in the
* checks (`EffectivePermissionRules.droppedRows`) — project-scoped rows whose scope root is not a complete absolute path, allow rows
* not written the way a rule is stored or a part of which could not be read, and (for host-supplied views only) `element` entries —
* or rows it could not read whole (`EffectivePermissionRules.unreadableRows`, either personal partition's): deny/ask rows whose
* identity read (they apply as written), deny/ask rows whose identity did not read (strictest reading), and rows whose behavior word
* could not be read (`member: "behavior"`, strictest reading, without claiming `behavior: "ask"` on the notice entry); minted by
* whichever read met them first, once per run. The sentence names no path and one clause per kind of row present
* ({@link DROPPED_ROW_SENTENCE}, then {@link UNREADABLE_ROW_SENTENCE}); the rows ride the detail's `entries` (the left-out rows first,
* `entriesNotAppliedDetail`): `entry` is the rule text as the store served it, through the one reading ({@link noticeRuleText}) every
* kind's `entry` uses, `reason` the row's word, `scopeRoot` on a scope row neutralized and bounded, `member` on a row a part of which
* could not be read, `behavior` on a deny or ask row whose behavior word read, and `element` on a host-supplied element entry; `count`
* is every row of both, `identity` their whole set. The trace keeps every read's line.
*/
export declare function ruleRowsDroppedNotice(onNotice: RunnerDeps["onNotice"], ids: {
readonly sessionId: string;
readonly runId: string;
}): (dropped: EffectivePermissionRules["droppedRows"], unreadable?: EffectivePermissionRules["unreadableRows"]) => void;
export {};