@xynehq/jaf
Version:
Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools
62 lines • 2.08 kB
TypeScript
import { RunId, TraceId, ApprovalValue } from '../core/types';
import { Result } from './types';
/**
* Approval storage interface for managing tool approval states
* Extends the memory provider concept to handle approvals with persistence
*/
export interface ApprovalStorage {
/**
* Store approval decision for a tool call
*/
readonly storeApproval: (runId: RunId, toolCallId: string, approval: ApprovalValue, metadata?: {
traceId?: TraceId;
[key: string]: any;
}) => Promise<Result<void>>;
/**
* Retrieve approval for a specific tool call
*/
readonly getApproval: (runId: RunId, toolCallId: string) => Promise<Result<ApprovalValue | null>>;
/**
* Get all approvals for a run
*/
readonly getRunApprovals: (runId: RunId) => Promise<Result<ReadonlyMap<string, ApprovalValue>>>;
/**
* Update existing approval with additional context
*/
readonly updateApproval: (runId: RunId, toolCallId: string, updates: Partial<ApprovalValue>) => Promise<Result<void>>;
/**
* Delete approval for a tool call
*/
readonly deleteApproval: (runId: RunId, toolCallId: string) => Promise<Result<boolean>>;
/**
* Clear all approvals for a run
*/
readonly clearRunApprovals: (runId: RunId) => Promise<Result<number>>;
/**
* Get approval statistics
*/
readonly getStats: () => Promise<Result<{
totalApprovals: number;
approvedCount: number;
rejectedCount: number;
runsWithApprovals: number;
}>>;
/**
* Health check for the approval storage
*/
readonly healthCheck: () => Promise<Result<{
healthy: boolean;
latencyMs?: number;
error?: string;
}>>;
/**
* Close/cleanup the storage
*/
readonly close: () => Promise<Result<void>>;
}
/**
* In-memory implementation of ApprovalStorage
* Non-persistent, good for development and testing
*/
export declare function createInMemoryApprovalStorage(): ApprovalStorage;
//# sourceMappingURL=approval-storage.d.ts.map