UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

41 lines (40 loc) • 3.38 kB
/** * The rows of the person's partitions (durable and session) the store could not hand over whole and that are no allow * (`EffectivePermissionRules.unreadableRows`), as the run's readers judge them. A row whose identity read stands in the read's rules as * written (`as_read`): these readers pass it by. A row whose identity did not read stands at its strictest reading over the calls it may * reach — the partition's own failure law, scoped to the row (a call it reaches in its scope takes the answer a call takes while a * partition cannot be read; a row reaching every call in its scope makes every path check that is no call refuse — the scope first, by * {@link unreadableRowsInScope}, for every reader). */ import type { EffectivePermissionRules } from "../permission-rule-provider.js"; import { type ScopeRootIdentity } from "../permission-rule-model.js"; import type { RuleStoreFault } from "../rule-store-fault.js"; import type { ToolCallRequest } from "../tool-policy.js"; import type { PersistedRuleHit, PersistedRuleUnreadable } from "../hooks.js"; /** One such row. */ export type UnreadablePersonRow = NonNullable<EffectivePermissionRules["unreadableRows"]>[number]; /** Is the row one whose identity could not be read — one these readers judge (the other kind stands in the rules as written)? */ export declare const identityUnread: (row: UnreadablePersonRow) => boolean; /** Does the row reach every call — and so every judgment the path tables make? */ export declare const reachesEveryCall: (row: UnreadablePersonRow) => boolean; /** The rows that may reach a call: what a readable row of the row's tool would be read for — one of the call's tightening words * (`words`), a whole-tool reach, and, its match unread, every call judged on a path for a path tool's row (`judgesPath`) — or every call. */ export declare function unreadableRowsReaching(rows: readonly UnreadablePersonRow[] | undefined, call: { readonly req: ToolCallRequest; readonly words: readonly string[]; readonly judgesPath: boolean; }): UnreadablePersonRow[]; /** Of those rows, the ones in whose scope the call is, as the gate's own deny and ask rows apply (everywhere when a row's scope could not * be read). */ export declare function unreadableRowsInScope(rows: readonly UnreadablePersonRow[], tool: string, at: { readonly cwd: string | undefined; readonly sessionId?: string | undefined; readonly scopeIdentity?: ScopeRootIdentity; }): UnreadablePersonRow[]; /** Why such rows make a call unanswerable, in a partition's words: `damaged` over the sources their scopes name (`global` the user's, * `project` the project's, `session` the session's; the user's and the project's when a row's scope could not be read). None for none. */ export declare function unreadableRowFaultsOf(rows: readonly UnreadablePersonRow[]): RuleStoreFault[]; /** The store form's answer — the call is put to a person, with why the rows could not be read (the question's sentence names it): a * partition's own faults, and such rows' ({@link unreadableRowFaultsOf}). A readable ask row reaching the call too rides beside it * (`ask`): the call carries both questions. */ export declare function storeFormAnswer(partitionFaults: readonly RuleStoreFault[] | undefined, rows: readonly UnreadablePersonRow[], ask?: PersistedRuleHit): PersistedRuleUnreadable;