anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
206 lines • 5.02 kB
TypeScript
/**
* Agent Activity Monitoring Types
*
* Defines the structure for tracking and auditing agent activities
*/
export declare enum ActivityType {
AUTHENTICATION = "authentication",
AUTHORIZATION = "authorization",
DATA_ACCESS = "data_access",
DATA_MODIFICATION = "data_modification",
SCOPE_USAGE = "scope_usage",
ERROR = "error",
REVOCATION = "revocation",
SESSION_START = "session_start",
SESSION_END = "session_end",
DELEGATION = "delegation",
COMMUNICATION = "communication"
}
export declare enum ActivityStatus {
SUCCESS = "success",
FAILED = "failed",
DENIED = "denied",
PARTIAL = "partial"
}
export interface ActivityDetails {
message?: string;
errorCode?: string;
errorMessage?: string;
presentationId?: string;
credentialIds?: string[];
challenge?: string;
scopesRequested?: string[];
scopesGranted?: string[];
scopesDenied?: string[];
resourceType?: string;
resourceId?: string;
operation?: string;
dataSize?: number;
metadata?: Record<string, any>;
}
export interface AgentActivity {
id: string;
agentDID: string;
parentDID: string;
timestamp: Date;
type: ActivityType;
serviceDID: string;
serviceEndpoint?: string;
scopes: string[];
status: ActivityStatus;
details: ActivityDetails;
ipfsHash?: string;
signature?: string;
checksum?: string;
duration?: number;
sessionId?: string;
}
export interface ActivityBatch {
id: string;
activities: AgentActivity[];
startTime: Date;
endTime: Date;
count: number;
agentDID: string;
parentDID: string;
batchHash?: string;
merkleRoot?: string;
}
export interface ActivitySummary {
agentDID: string;
parentDID: string;
period: {
start: Date;
end: Date;
type: 'hour' | 'day' | 'week' | 'month' | 'year';
};
totalActivities: number;
byType: Record<ActivityType, number>;
byStatus: Record<ActivityStatus, number>;
byService: Record<string, number>;
scopeUsage: Record<string, number>;
averageDuration: number;
errorRate: number;
peakHour?: string;
mostUsedService?: string;
mostUsedScope?: string;
}
export interface ActivityQuery {
agentDID?: string;
parentDID?: string;
serviceDID?: string;
types?: ActivityType[];
status?: ActivityStatus[];
scopes?: string[];
dateRange?: {
start: Date;
end: Date;
};
sessionId?: string;
limit?: number;
offset?: number;
sortBy?: 'timestamp' | 'type' | 'service';
sortOrder?: 'asc' | 'desc';
}
export interface ActivitySearchResult {
activities: AgentActivity[];
total: number;
offset: number;
limit: number;
hasMore: boolean;
}
export interface ActivitySubscription {
id: string;
agentDID?: string;
parentDID?: string;
types?: ActivityType[];
callback: (activity: AgentActivity) => void;
unsubscribe: () => void;
}
export interface ActivityLoggerConfig {
batchSize?: number;
batchInterval?: number;
enableRealtime?: boolean;
enableBatching?: boolean;
retentionDays?: number;
encryptionKey?: Uint8Array | undefined;
enableIPFS?: boolean;
ipfsUrl?: string;
enableRedundancy?: boolean;
ipfsNodes?: Array<{
url: string;
name: string;
priority: number;
active: boolean;
}>;
minReplicas?: number;
enableIndexing?: boolean;
enableStreaming?: boolean;
}
export interface ActivityHook {
type: ActivityType;
beforeActivity?: (activity: Partial<AgentActivity>) => Promise<boolean>;
afterActivity?: (activity: AgentActivity) => Promise<void>;
}
export declare const ACTIVITY_SCHEMA: {
$schema: string;
type: string;
properties: {
id: {
type: string;
format: string;
};
agentDID: {
type: string;
pattern: string;
};
parentDID: {
type: string;
pattern: string;
};
timestamp: {
type: string;
format: string;
};
type: {
type: string;
enum: ActivityType[];
};
serviceDID: {
type: string;
pattern: string;
};
serviceEndpoint: {
type: string;
format: string;
};
scopes: {
type: string;
items: {
type: string;
};
};
status: {
type: string;
enum: ActivityStatus[];
};
details: {
type: string;
};
ipfsHash: {
type: string;
};
signature: {
type: string;
};
duration: {
type: string;
minimum: number;
};
sessionId: {
type: string;
};
};
required: string[];
};
//# sourceMappingURL=types.d.ts.map