import 'dotenv/config'; import { IStaffEventEmitter, NoopEventEmitter, StaffEventInput, StaffEvent, buildStaffEvent } from '../lib/staffEventEmitter'; import { setStaffEventEmitter, getStaffEventEmitter, resetStaffEventEmitter } from '../lib/staffEventRegistry'; import type { WorkingMemoryBrief, AttendResult, SessionComplianceState, SessionSummary as AttendantSessionSummary, SessionCheckpointSummary as AttendantSessionCheckpointSummary, SessionOperatorState as AttendantSessionOperatorState } from '../attendant'; import { AttendantInstance } from '../attendant/registry'; import { RelatedEntity } from '../library/relationships'; import { AgentProfile, AgentRecord } from '../library/agent-registry'; import { IssueFactInput, IssueSeverity, IssueStatus } from '../lib/issueFacts'; import { MockConfig } from '../lib/providers/mock'; import { ProtocolEnforcementMode, ProtocolViolation, ProtocolViolationError } from '../lib/protocolEnforcement'; import { ArchivedReason, ResolutionOutcome, ResolutionState } from '../generated/prisma/client'; import { SessionLedgerEvent, SessionLedgerQuery } from '../lib/sessionLedger'; export interface IrantiConfig { connectionString?: string; llmProvider?: string; sessionLedgerSource?: string; sessionLedgerHost?: string | null; sessionLedgerAgentId?: string; dbApplicationName?: string; dbPoolMax?: number; protocolEnforcement?: ProtocolEnforcementMode; /** * Optional event emitter for observability integrations (e.g., the Iranti * Control Plane). Defaults to a no-op emitter if not provided. * The emitter MUST NOT throw — all errors must be caught internally. */ staffEventEmitter?: IStaffEventEmitter; } export interface WriteInput { entity: string; key: string; value: unknown; summary: string; confidence: number; source: string; agent: string; validFrom?: Date; validUntil?: Date | null; requestId?: string; properties?: Record; } export type { IssueStatus, IssueSeverity }; export interface WriteIssueInput extends Omit { status: IssueStatus; severity?: IssueSeverity; } export interface IngestInput { entity: string; content: string; source: string; confidence: number; agent: string; } export interface HandshakeInput { agent?: string; agentId?: string; task: string; recentMessages: string[]; postCompaction?: boolean; } export type SessionStatus = 'active' | 'interrupted' | 'completed' | 'abandoned'; export interface SessionCheckpointPayload { currentStep?: string; nextStep?: string; openRisks?: string[]; recentOutputs?: string[]; actions?: Array<{ kind: string; summary: string; status?: string; target?: string; detail?: string; }>; fileChanges?: Array<{ action: string; path: string; toPath?: string; purpose?: string; }>; entityTargets?: string[]; notes?: string; } export interface SessionCheckpointRecord { sessionId: string; task: string; taskFingerprint: string; status: SessionStatus; startedAt: string; lastHeartbeatAt: string; updatedAt: string; checkpoint: SessionCheckpointPayload; interruptedAt?: string; completedAt?: string; abandonedAt?: string; resumedAt?: string; } export interface SessionRecoveryInfo { available: boolean; sessionId: string; task: string; taskFingerprint: string; matchedCurrentTask: boolean; matchConfidence: number; recommendation: 'resume' | 'review' | 'ignore'; summary: string; lastHeartbeatAt: string; interruptedAt: string; checkpoint: SessionCheckpointPayload | null; } export interface SessionCheckpointInput { agent?: string; agentId?: string; task: string; recentMessages: string[]; checkpoint: SessionCheckpointPayload | string | Record; sessionId?: string; heartbeatAt?: string; } export interface SessionActionInput { agent?: string; agentId?: string; sessionId?: string; } export interface SessionInspectionInput { agent?: string; agentId?: string; task?: string; recentMessages?: string[]; } export type SessionListSort = 'operator' | 'updated_desc' | 'agent_asc'; export interface SessionListInput { agentId?: string; operatorState?: SessionOperatorState; staleOnly?: boolean; limit?: number; sort?: SessionListSort; } export interface SessionInspection { agentId: string; hasCheckpoint: boolean; sessionCheckpoint: SessionCheckpointRecord | null; sessionRecovery: SessionRecoveryInfo | null; persistedBriefGeneratedAt?: string; summary: SessionSummary; compliance: SessionComplianceState; } export interface SessionLedgerInput extends SessionLedgerQuery { } export type SessionOperatorState = AttendantSessionOperatorState; export interface SessionCheckpointSummary extends AttendantSessionCheckpointSummary { } export interface SessionSummary extends AttendantSessionSummary { } export interface TemporalQueryOptions { asOf?: Date; includeExpired?: boolean; includeContested?: boolean; } export interface QueryResult { found: boolean; value?: unknown; summary?: string; confidence?: number; source?: string; validFrom?: Date | null; validUntil?: Date | null; contested?: boolean; fromArchive?: boolean; archivedReason?: ArchivedReason | null; resolutionState?: ResolutionState | null; resolutionOutcome?: ResolutionOutcome | null; resolvedEntity?: string; inputEntity?: string; } export type { ProtocolEnforcementMode, ProtocolViolation }; export { ProtocolViolationError }; export interface HistoryEntry { value: unknown; summary: string; confidence: number; source: string; validFrom: Date; validUntil: Date | null; isCurrent: boolean; contested: boolean; archivedReason: ArchivedReason | null; resolutionState: ResolutionState | null; resolutionOutcome: ResolutionOutcome | null; } export interface HybridSearchInput { query: string; limit?: number; entityType?: string; entityId?: string; lexicalWeight?: number; vectorWeight?: number; minScore?: number; } export interface HybridSearchResult { id: number; entity: string; key: string; value: unknown; summary: string; confidence: number; source: string; validUntil?: Date | null; lexicalScore: number; vectorScore: number; score: number; } export interface WriteResult { action: 'created' | 'updated' | 'escalated' | 'rejected'; key: string; reason: string; resolvedEntity?: string; inputEntity?: string; } export interface IngestFactResult { action: WriteResult['action'] | 'failed'; key: string; reason: string; } export interface IngestResult { extractedCandidates: number; written: number; rejected: number; escalated: number; skippedMalformed: number; reason?: string; facts: IngestFactResult[]; } export interface ObserveInput { agent?: string; agentId?: string; currentContext: string; maxFacts?: number; entityHints?: string[]; } export type PendingToolCallName = 'Read' | 'Grep' | 'Glob' | 'Bash' | 'WebSearch' | 'WebFetch'; export interface PendingToolCall { name: PendingToolCallName; args?: Record; } export interface ToolResultPayload { toolName: PendingToolCallName; status: 'success' | 'error'; content: string; metadata?: { path?: string; url?: string; query?: string; command?: string; durationMs?: number; }; } export interface AttendInput extends ObserveInput { latestMessage?: string; forceInject?: boolean; suppressEvents?: boolean; phase?: 'pre-response' | 'post-response' | 'mid-turn'; pendingToolCall?: PendingToolCall; toolResult?: ToolResultPayload; findings?: string; } export declare class Iranti { private config; private sessionLedgerContext; private readonly protocolTracker; constructor(config?: IrantiConfig); private protocolMode; private protocolAgentId; private checkProtocol; private syncMemoryUseCompliance; private consumeDiscoveryBudget; setSessionLedgerContext(context: { source?: string | null; host?: string | null; agentId?: string | null; }): void; loadProtocolStateFromLedger(agentId: string, options?: { handshakeTtlMs?: number; attendTtlMs?: number; }): Promise<{ handshakeRestored: boolean; attendRestored: boolean; }>; private buildSessionLedgerContext; private emitLedgerEvent; private noteRediscoveryEvidence; write(input: WriteInput): Promise; writeIssue(input: WriteIssueInput): Promise; ingest(input: IngestInput): Promise; handshake(input: HandshakeInput): Promise; reconvene(agentId: string, input: Omit): Promise; checkpoint(input: SessionCheckpointInput): Promise; resumeSession(input: SessionActionInput): Promise; completeSession(input: SessionActionInput): Promise; abandonSession(input: SessionActionInput): Promise; inspectSession(input: SessionInspectionInput): Promise; listSessions(input?: SessionListInput): Promise; listSessionLedger(input?: SessionLedgerInput): Promise; getAttendant(agentId: string): AttendantInstance; query(entity: string, key: string, options?: TemporalQueryOptions): Promise; history(entity: string, key: string, options?: Omit): Promise; queryAll(entity: string): Promise>; search(input: HybridSearchInput): Promise; runMaintenance(): Promise<{ expiredArchived: number; lowConfidenceArchived: number; escalationsProcessed: number; errors: string[]; }>; relate(fromEntity: string, relationshipType: string, toEntity: string, options?: { createdBy: string; properties?: Record; }): Promise; getRelated(entity: string): Promise; getRelatedDeep(entity: string, depth?: number): Promise; registerAgent(profile: AgentProfile): Promise; getAgent(agentId: string): Promise; whoKnows(entity: string): Promise>; listAgents(): Promise; assignToTeam(agentId: string, teamId: string): Promise; observe(input: ObserveInput): Promise; attend(input: AttendInput): Promise; configureMock(config: Partial): void; } export default Iranti; export type { IStaffEventEmitter, StaffEventInput, StaffEvent }; export { NoopEventEmitter, buildStaffEvent }; export { setStaffEventEmitter, getStaffEventEmitter, resetStaffEventEmitter }; //# sourceMappingURL=index.d.ts.map