import { SmrtCollection, SmrtObject } from '@happyvertical/smrt-core'; /** * Return the canonical agent type identifier for storage and lookup. * * Uses the registry's qualified name when the class is registered and falls * back to the raw input for dynamically defined or unregistered classes. This * mirrors `getAgentTypeName()` in `@happyvertical/smrt-agents` without reaching * into that package's internal module — personas store the same canonical form * that `TenantAgent` does so the two layers line up. */ export declare function canonicalAgentClass(name: string): string; /** * Return the meaningful aliases for an agent class — the canonical qualified * name plus the simple class name — deduplicated. * * Lookups match against both so a persona persisted under a simple name (e.g. * `Praeco`, when written through the generated create API without * normalization) is still found when resolving under the canonical qualified * name, and vice versa. Mirrors `getAgentTypeAliases()` in * `@happyvertical/smrt-agents`. */ export declare function agentClassAliases(name: string): string[]; /** * AgentPersona SmrtObject — a tenant/context-scoped behavioral profile for an * agent class. */ export declare class AgentPersona extends SmrtObject { /** Owning tenant (required — personas are never global). */ tenantId: string; /** * Canonical qualified agent type this persona configures * (e.g. `@happyvertical/smrt-agents:Praeco`). Stored in canonical form so it * lines up with `TenantAgent.agentClass`. */ agentClass: string; /** * Human-readable persona name, unique per `(tenant, agentClass)` * (see `conflictColumns`). Inherited `name` from {@link SmrtObject} is the * conflict column; declared here for documentation and typing clarity. */ name: string; /** * Optional context dimension type this persona is scoped to * (e.g. `'site'`, `'property'`, `'chatRoom'`). `null` means the persona is a * tenant-wide default that applies to every context for its agent class. */ contextType: string | null; /** * Optional context dimension id. Only meaningful alongside `contextType`: * when set, the persona targets one specific context row; when `null` (with * a `contextType` set) it applies to every context of that type. */ contextId: string | null; /** System prompt / behavioral instructions layered onto the agent. */ instructions: string; /** * Allowed tool identifiers, stored as a JSON array string. Use * {@link getAllowedTools} / {@link setAllowedTools} rather than reading this * field directly. Empty array (`'[]'`) means "no persona-specific tools" * (the resolver then falls back to manifest defaults, capped by the * `TenantAgent` ceiling). */ allowedTools: string; /** * The user whose principal this persona runs as (cross-package reference to * `@happyvertical/smrt-users:User`). Required — a persona always runs as a * concrete principal. Stored as a plain id column; no DDL FK constraint is * emitted (cross-package). */ runAsUserId: string; /** * Optional `Bot` profile the persona acts as for identity/audit * (cross-package reference to `@happyvertical/smrt-profiles:Profile`). * `null` when the persona has no distinct acting identity. */ actsAsProfileId: string | null; /** * Memory scope key controlling how the agent's memory/reflection is * partitioned for this persona. Empty string means "use a resolver-derived * default". */ memoryScope: string; /** * Resolution priority — higher wins when several personas apply to the same * context at the same tenant level. Integer. */ priority: number; /** Whether this persona is active and eligible for resolution. */ enabled: boolean; /** * Allowed tool identifiers as an array. * * Tolerates malformed stored JSON by returning an empty array. */ getAllowedTools(): string[]; /** * Replace the allowed tool identifiers. */ setAllowedTools(tools: string[]): void; } /** * Collection for managing {@link AgentPersona} records. */ export declare class AgentPersonaCollection extends SmrtCollection { static readonly _itemClass: typeof AgentPersona; /** * List personas for a tenant + agent class, matching either the canonical * qualified name or the simple class name (see {@link agentClassAliases}). * * Ordered by descending priority then name. * * @param extraWhere - Additional equality filters merged into the query * (e.g. `{ enabled: true }`). */ private listForClass; /** * List every persona bound to a tenant + agent class. * * Ordered by descending priority then name so callers that don't need the * full resolver still get a deterministic, priority-first ordering. */ byTenantAndClass(tenantId: string, agentClass: string): Promise; /** * List the enabled personas for a tenant + agent class, filtered to those * applicable to a context. * * `enabled` is filtered in the query; the context predicate (tenant-wide vs * type-scoped vs exact) is applied in memory since it is an OR over several * columns. A persona is applicable when it is a tenant-wide default (no * `contextType`) or its context matches the requested one. Ordered by * descending priority then name. * * @param context - Optional `{ contextType, contextId }` to filter by. */ findActive(tenantId: string, agentClass: string, context?: { contextType?: string | null; contextId?: string | null; }): Promise; } /** * Whether a persona applies to a requested context. * * - No `contextType` on the persona → tenant-wide default, applies to all. * - `contextType` set, `contextId` null → type-scoped, applies when the * requested `contextType` matches. * - Both set → exact, applies when both match. */ export declare function personaAppliesToContext(persona: Pick, context: { contextType?: string | null; contextId?: string | null; }): boolean; /** * Context-specificity rank used for resolution ordering. * * - `2` exact `(contextType, contextId)` match * - `1` type-scoped match (`contextType` matches, persona `contextId` null) * - `0` tenant-wide default (persona has no `contextType`) */ export declare function personaContextRank(persona: Pick): number; export default AgentPersona; //# sourceMappingURL=agent-persona.d.ts.map