UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

35 lines (34 loc) • 1.86 kB
/** The three words a leg can wear on its wiring manifest. */ export declare const TEAM_ROLES: readonly ["lead", "teammate", "none"]; export type TeamRole = (typeof TEAM_ROLES)[number]; /** * THE role derivation, one rule from two facts: a top-level leg leads its own tree; a delegated child * spawned with an explicit `Agent({name})` is a teammate of that tree; an unnamed delegation is neither * (it is not addressable as a member). */ export declare function teamRoleOf(facts: { isDelegatedChild: boolean; spawnName?: string; }): TeamRole; /** What a recipient may conclude about a sender's standing over it. */ export declare const DIRECTION_RELATIONS: readonly ["lead", "peer", "stranger"]; export type DirectionRelation = (typeof DIRECTION_RELATIONS)[number]; /** * @contract team.direction_is_never_user_consent — `mayDirect` answers only WHO a sender is to this * session (its tree's lead, a member of the same tree, or a stranger), from the typed record's * `fromSession` / `fromRoot` against this leg's own root; it grants nothing. Whatever the relation, a * message that arrived through the inbox is tasking context: it never constitutes the user's intent, * consent or approval for a pending decision, and it cannot change permission settings — the * discipline block on every delivered frame says so, and no relation loosens it. * * The rule: the ROOT session speaking to a member of its tree is `lead`; any other sender stamped * with this tree's root is `peer`; everything else — including a sender that claims nothing — is * `stranger`. A root leg's own teammates are its peers on this axis (a teammate never directs its lead). */ export declare function mayDirect(sender: { fromSession?: string; fromRoot?: string; }, self: { sessionId: string; rootSessionId?: string; }): DirectionRelation;