import { SmrtObject } from '@happyvertical/smrt-core'; import { AgentSessionOptions, AgentSessionStatus } from '../types.js'; /** * Agent conversation session. Internal model — sessions must be created via * {@link ChatService.createAgentSession} and their security-relevant config * (`allowedTools` / `systemPrompt` / `chatRoomId` / `participantProfileId`) * mutated only via the owner-checked {@link ChatService.updateAgentSessionConfig} * (S5 #1392). The generated CRUD surface is read-only (`get`/`list`); * `create`/`update`/`delete` are NOT generated, otherwise a `PUT` could rewrite * the tool allow-list or system prompt and bypass the owner check. */ export declare class AgentSession extends SmrtObject { /** * Reserved `sessionContext` key that scopes a session's identity to a caller- * supplied conversation subject (e.g. a content id) (S5 #1392). * * `createAgentSession`'s reuse path keys on `(agentId, participantProfileId, * tenantId)`; without a discriminator a session opened for subject A would be * reused (and its context rewritten) for a request about subject B, returning * A's room/threads on B's route. Storing the key here lets the reuse lookup * require an exact match so distinct subjects get distinct sessions. */ static readonly SESSION_KEY_CONTEXT_FIELD = "__sessionKey"; tenantId: string | null; agentId: string; participantProfileId: string; chatRoomId: string | null; status: AgentSessionStatus; /** JSON array of tool names the consuming app has allowed for this session */ allowedTools: string; /** Conversation context/memory for multi-turn state (JSON string) */ sessionContext: string; /** System prompt override for this session */ systemPrompt: string; messageCount: number; totalTokensUsed: number; maxTokens: number; maxMessages: number; lastMessageAt: Date | null; expiresAt: Date | null; closedAt: Date | null; constructor(options?: AgentSessionOptions); getAllowedTools(): string[]; setAllowedTools(tools: string[]): void; /** * Fail-closed authorization check for an agent tool call (S5 #1392). * * A tool may only be invoked when it appears in this session's allow-list. * If the allow-list is empty or unparseable, NO tools are permitted. This is * deliberately conservative: an empty whitelist means "no tools", never * "all tools". */ isToolAllowed(toolName: string): boolean; isActive(): boolean; isExpired(): boolean; close(): Promise; expire(): Promise; getSessionContext(): Record; setSessionContext(ctx: Record): void; /** * Stable identity key that scopes this session to a conversation subject * (S5 #1392). Returns `null` when the session is not subject-scoped. Used by * the reuse lookup so a session opened for one subject is never reused for a * request about a different subject. */ getSessionKey(): string | null; updateSessionContext(updates: Record): Promise; recordMessage(tokensUsed?: number): Promise; } //# sourceMappingURL=AgentSession.d.ts.map