@lov3kaizen/agentsea-memory 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +450 -0
- package/dist/chunk-GACX3FPR.js +1402 -0
- package/dist/chunk-M44NB53O.js +1226 -0
- package/dist/chunk-MQDWBPZU.js +972 -0
- package/dist/chunk-TPC7MYWK.js +1495 -0
- package/dist/chunk-XD2CQGSD.js +1540 -0
- package/dist/chunk-YI7RPDEV.js +1215 -0
- package/dist/core.types-lkxKv-bW.d.cts +242 -0
- package/dist/core.types-lkxKv-bW.d.ts +242 -0
- package/dist/debug/index.cjs +1248 -0
- package/dist/debug/index.d.cts +3 -0
- package/dist/debug/index.d.ts +3 -0
- package/dist/debug/index.js +20 -0
- package/dist/index-7SsAJ4et.d.ts +525 -0
- package/dist/index-BGxYqpFb.d.cts +601 -0
- package/dist/index-BX62efZu.d.ts +565 -0
- package/dist/index-Bbc3COw0.d.cts +748 -0
- package/dist/index-Bczz1Eyk.d.ts +637 -0
- package/dist/index-C7pEiT8L.d.cts +637 -0
- package/dist/index-CHetLTb0.d.ts +389 -0
- package/dist/index-CloeiFyx.d.ts +748 -0
- package/dist/index-DNOhq-3y.d.cts +525 -0
- package/dist/index-Da-M8FOV.d.cts +389 -0
- package/dist/index-Dy8UjRFz.d.cts +565 -0
- package/dist/index-aVcITW0B.d.ts +601 -0
- package/dist/index.cjs +8554 -0
- package/dist/index.d.cts +293 -0
- package/dist/index.d.ts +293 -0
- package/dist/index.js +742 -0
- package/dist/processing/index.cjs +1575 -0
- package/dist/processing/index.d.cts +2 -0
- package/dist/processing/index.d.ts +2 -0
- package/dist/processing/index.js +24 -0
- package/dist/retrieval/index.cjs +1262 -0
- package/dist/retrieval/index.d.cts +2 -0
- package/dist/retrieval/index.d.ts +2 -0
- package/dist/retrieval/index.js +26 -0
- package/dist/sharing/index.cjs +1003 -0
- package/dist/sharing/index.d.cts +3 -0
- package/dist/sharing/index.d.ts +3 -0
- package/dist/sharing/index.js +16 -0
- package/dist/stores/index.cjs +1445 -0
- package/dist/stores/index.d.cts +2 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.js +20 -0
- package/dist/structures/index.cjs +1530 -0
- package/dist/structures/index.d.cts +3 -0
- package/dist/structures/index.d.ts +3 -0
- package/dist/structures/index.js +24 -0
- package/package.json +141 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { B as Breakpoint, m as DebugTrace, D as Debugger, o as DebuggerEvents, p as ExportFormat, q as ExportResult, f as Exporter, h as HealthIssue, H as HealthReport, r as ImportResult, i as InspectionResult, a as Inspector, M as MemoryStats, n as RetrievalDebugInfo, b as Timeline, j as TimelineEvent, l as TimelineMarker, k as TimelineSegment, e as createDebugger, g as createExporter, c as createInspector, d as createTimeline } from '../index-C7pEiT8L.cjs';
|
|
2
|
+
import '../core.types-lkxKv-bW.cjs';
|
|
3
|
+
import 'eventemitter3';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { B as Breakpoint, m as DebugTrace, D as Debugger, o as DebuggerEvents, p as ExportFormat, q as ExportResult, f as Exporter, h as HealthIssue, H as HealthReport, r as ImportResult, i as InspectionResult, a as Inspector, M as MemoryStats, n as RetrievalDebugInfo, b as Timeline, j as TimelineEvent, l as TimelineMarker, k as TimelineSegment, e as createDebugger, g as createExporter, c as createInspector, d as createTimeline } from '../index-Bczz1Eyk.js';
|
|
2
|
+
import '../core.types-lkxKv-bW.js';
|
|
3
|
+
import 'eventemitter3';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Debugger,
|
|
3
|
+
Exporter,
|
|
4
|
+
Inspector,
|
|
5
|
+
Timeline,
|
|
6
|
+
createDebugger,
|
|
7
|
+
createExporter,
|
|
8
|
+
createInspector,
|
|
9
|
+
createTimeline
|
|
10
|
+
} from "../chunk-YI7RPDEV.js";
|
|
11
|
+
export {
|
|
12
|
+
Debugger,
|
|
13
|
+
Exporter,
|
|
14
|
+
Inspector,
|
|
15
|
+
Timeline,
|
|
16
|
+
createDebugger,
|
|
17
|
+
createExporter,
|
|
18
|
+
createInspector,
|
|
19
|
+
createTimeline
|
|
20
|
+
};
|
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import { c as MemoryEntry, i as MemoryStoreInterface } from './core.types-lkxKv-bW.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sharing Types
|
|
6
|
+
*
|
|
7
|
+
* Types for multi-agent shared memory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Memory visibility
|
|
12
|
+
*/
|
|
13
|
+
type MemoryVisibility = 'public' | 'team' | 'private';
|
|
14
|
+
/**
|
|
15
|
+
* Access permission
|
|
16
|
+
*/
|
|
17
|
+
type AccessPermission = 'read' | 'write' | 'delete' | 'admin';
|
|
18
|
+
/**
|
|
19
|
+
* Sync strategy
|
|
20
|
+
*/
|
|
21
|
+
type SyncStrategy = 'strong' | 'eventual' | 'manual';
|
|
22
|
+
/**
|
|
23
|
+
* Conflict resolution strategy
|
|
24
|
+
*/
|
|
25
|
+
type ConflictResolution = 'last-write-wins' | 'first-write-wins' | 'merge' | 'manual';
|
|
26
|
+
/**
|
|
27
|
+
* Shared memory configuration
|
|
28
|
+
*/
|
|
29
|
+
interface SharedMemoryConfig {
|
|
30
|
+
conflictResolution?: ConflictResolution;
|
|
31
|
+
syncInterval?: number;
|
|
32
|
+
enableLocking?: boolean;
|
|
33
|
+
lockTimeout?: number;
|
|
34
|
+
maxSharedEntries?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sync manager configuration
|
|
38
|
+
*/
|
|
39
|
+
interface SyncManagerConfig {
|
|
40
|
+
strategy: SyncStrategy;
|
|
41
|
+
conflictResolution: ConflictResolution;
|
|
42
|
+
syncInterval?: number;
|
|
43
|
+
retryAttempts?: number;
|
|
44
|
+
retryDelay?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Access control configuration
|
|
48
|
+
*/
|
|
49
|
+
interface AccessControlConfig {
|
|
50
|
+
roles?: Record<string, AccessPermission[]>;
|
|
51
|
+
defaultRole?: string;
|
|
52
|
+
adminUsers?: string[];
|
|
53
|
+
defaultPermission?: AccessPermission;
|
|
54
|
+
enableAuditLog?: boolean;
|
|
55
|
+
strictMode?: boolean;
|
|
56
|
+
maxRulesPerAgent?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Namespace configuration
|
|
60
|
+
*/
|
|
61
|
+
interface NamespaceConfig {
|
|
62
|
+
name: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
visibility?: MemoryVisibility;
|
|
65
|
+
allowedAgents?: string[];
|
|
66
|
+
maxSize?: number;
|
|
67
|
+
retentionDays?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SharedMemory
|
|
72
|
+
*
|
|
73
|
+
* Shared memory system for multi-agent coordination.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Shared memory events
|
|
78
|
+
*/
|
|
79
|
+
interface SharedMemoryEvents {
|
|
80
|
+
write: (agentId: string, key: string, value: unknown) => void;
|
|
81
|
+
read: (agentId: string, key: string) => void;
|
|
82
|
+
delete: (agentId: string, key: string) => void;
|
|
83
|
+
sync: (agentId: string, entries: MemoryEntry[]) => void;
|
|
84
|
+
conflict: (key: string, agents: string[]) => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Shared value with metadata
|
|
88
|
+
*/
|
|
89
|
+
interface SharedValue<T = unknown> {
|
|
90
|
+
value: T;
|
|
91
|
+
writtenBy: string;
|
|
92
|
+
writtenAt: number;
|
|
93
|
+
version: number;
|
|
94
|
+
readers: Set<string>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sync result
|
|
98
|
+
*/
|
|
99
|
+
interface SyncResult {
|
|
100
|
+
added: number;
|
|
101
|
+
updated: number;
|
|
102
|
+
conflicts: number;
|
|
103
|
+
timestamp: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Shared memory for multi-agent systems
|
|
107
|
+
*/
|
|
108
|
+
declare class SharedMemory extends EventEmitter<SharedMemoryEvents> {
|
|
109
|
+
private store;
|
|
110
|
+
private config;
|
|
111
|
+
private sharedState;
|
|
112
|
+
private agentStates;
|
|
113
|
+
private subscriptions;
|
|
114
|
+
private lockManager;
|
|
115
|
+
constructor(store: MemoryStoreInterface, config?: SharedMemoryConfig);
|
|
116
|
+
/**
|
|
117
|
+
* Set a shared value
|
|
118
|
+
*/
|
|
119
|
+
set(agentId: string, key: string, value: unknown): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Get a shared value
|
|
122
|
+
*/
|
|
123
|
+
get<T = unknown>(agentId: string, key: string): Promise<T | undefined>;
|
|
124
|
+
/**
|
|
125
|
+
* Delete a shared value
|
|
126
|
+
*/
|
|
127
|
+
delete(agentId: string, key: string): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Set agent-specific state (not shared)
|
|
130
|
+
*/
|
|
131
|
+
setAgentState(agentId: string, key: string, value: unknown): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get agent-specific state
|
|
134
|
+
*/
|
|
135
|
+
getAgentState<T = unknown>(agentId: string, key: string): T | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Get all agent state
|
|
138
|
+
*/
|
|
139
|
+
getAllAgentState(agentId: string): Map<string, unknown>;
|
|
140
|
+
/**
|
|
141
|
+
* Subscribe to changes on a key
|
|
142
|
+
*/
|
|
143
|
+
subscribe(agentId: string, key: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Unsubscribe from changes
|
|
146
|
+
*/
|
|
147
|
+
unsubscribe(agentId: string, key: string): void;
|
|
148
|
+
/**
|
|
149
|
+
* Acquire a lock on a key
|
|
150
|
+
*/
|
|
151
|
+
acquireLock(agentId: string, key: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Release a lock
|
|
154
|
+
*/
|
|
155
|
+
releaseLock(agentId: string, key: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Check if key is locked
|
|
158
|
+
*/
|
|
159
|
+
isLocked(key: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Check if agent has lock
|
|
162
|
+
*/
|
|
163
|
+
hasLock(key: string, agentId: string): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Share memories from one agent to shared space
|
|
166
|
+
*/
|
|
167
|
+
shareMemories(agentId: string, entries: MemoryEntry[]): Promise<SyncResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Get shared memories
|
|
170
|
+
*/
|
|
171
|
+
getSharedMemories(_agentId: string): MemoryEntry[];
|
|
172
|
+
/**
|
|
173
|
+
* Sync with store
|
|
174
|
+
*/
|
|
175
|
+
sync(): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Get all shared keys
|
|
178
|
+
*/
|
|
179
|
+
getSharedKeys(): string[];
|
|
180
|
+
/**
|
|
181
|
+
* Get metadata for a shared value
|
|
182
|
+
*/
|
|
183
|
+
getMetadata(key: string): Omit<SharedValue, 'value'> | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Resolve conflict between values
|
|
186
|
+
*/
|
|
187
|
+
private resolveConflict;
|
|
188
|
+
/**
|
|
189
|
+
* Notify subscribers of changes
|
|
190
|
+
*/
|
|
191
|
+
private notifySubscribers;
|
|
192
|
+
/**
|
|
193
|
+
* Persist shared value to store
|
|
194
|
+
*/
|
|
195
|
+
private persistSharedValue;
|
|
196
|
+
/**
|
|
197
|
+
* Load shared value from store
|
|
198
|
+
*/
|
|
199
|
+
private loadSharedValue;
|
|
200
|
+
/**
|
|
201
|
+
* Get statistics
|
|
202
|
+
*/
|
|
203
|
+
getStats(): {
|
|
204
|
+
sharedEntries: number;
|
|
205
|
+
agentCount: number;
|
|
206
|
+
activeLocks: number;
|
|
207
|
+
totalSubscriptions: number;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Create shared memory instance
|
|
212
|
+
*/
|
|
213
|
+
declare function createSharedMemory(store: MemoryStoreInterface, config?: SharedMemoryConfig): SharedMemory;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Namespaces
|
|
217
|
+
*
|
|
218
|
+
* Namespace management for memory isolation and organization.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Namespace metadata
|
|
223
|
+
*/
|
|
224
|
+
interface NamespaceMetadata {
|
|
225
|
+
name: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
owner?: string;
|
|
228
|
+
createdAt: number;
|
|
229
|
+
updatedAt: number;
|
|
230
|
+
entryCount: number;
|
|
231
|
+
tags?: string[];
|
|
232
|
+
settings: NamespaceSettings;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Namespace settings
|
|
236
|
+
*/
|
|
237
|
+
interface NamespaceSettings {
|
|
238
|
+
maxEntries?: number;
|
|
239
|
+
ttl?: number;
|
|
240
|
+
accessLevel: 'public' | 'private' | 'restricted';
|
|
241
|
+
allowedAgents?: string[];
|
|
242
|
+
readOnly?: boolean;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Namespace events
|
|
246
|
+
*/
|
|
247
|
+
interface NamespaceEvents {
|
|
248
|
+
created: (namespace: NamespaceMetadata) => void;
|
|
249
|
+
deleted: (name: string) => void;
|
|
250
|
+
updated: (namespace: NamespaceMetadata) => void;
|
|
251
|
+
entryAdded: (namespace: string, entry: MemoryEntry) => void;
|
|
252
|
+
accessDenied: (namespace: string, agentId: string, action: string) => void;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Namespace manager
|
|
256
|
+
*/
|
|
257
|
+
declare class NamespaceManager extends EventEmitter<NamespaceEvents> {
|
|
258
|
+
private store;
|
|
259
|
+
private namespaces;
|
|
260
|
+
private defaultNamespace;
|
|
261
|
+
constructor(store: MemoryStoreInterface, _config?: NamespaceConfig);
|
|
262
|
+
/**
|
|
263
|
+
* Create a new namespace
|
|
264
|
+
*/
|
|
265
|
+
createNamespace(name: string, options?: {
|
|
266
|
+
description?: string;
|
|
267
|
+
owner?: string;
|
|
268
|
+
tags?: string[];
|
|
269
|
+
settings?: Partial<NamespaceSettings>;
|
|
270
|
+
}): NamespaceMetadata;
|
|
271
|
+
/**
|
|
272
|
+
* Delete a namespace
|
|
273
|
+
*/
|
|
274
|
+
deleteNamespace(name: string, deleteEntries?: boolean): Promise<boolean>;
|
|
275
|
+
/**
|
|
276
|
+
* Get namespace metadata
|
|
277
|
+
*/
|
|
278
|
+
getNamespace(name: string): NamespaceMetadata | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* List all namespaces
|
|
281
|
+
*/
|
|
282
|
+
listNamespaces(): NamespaceMetadata[];
|
|
283
|
+
/**
|
|
284
|
+
* Update namespace settings
|
|
285
|
+
*/
|
|
286
|
+
updateNamespace(name: string, updates: Partial<Omit<NamespaceMetadata, 'name' | 'createdAt'>>): NamespaceMetadata | null;
|
|
287
|
+
/**
|
|
288
|
+
* Check if agent can access namespace
|
|
289
|
+
*/
|
|
290
|
+
canAccess(name: string, agentId: string, action?: 'read' | 'write'): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Add entry to namespace
|
|
293
|
+
*/
|
|
294
|
+
addEntry(namespace: string, entry: Omit<MemoryEntry, 'metadata'> & {
|
|
295
|
+
metadata?: Record<string, unknown>;
|
|
296
|
+
}, agentId: string): Promise<string | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Query entries in namespace
|
|
299
|
+
*/
|
|
300
|
+
queryEntries(namespace: string, agentId: string, options?: {
|
|
301
|
+
query?: string;
|
|
302
|
+
limit?: number;
|
|
303
|
+
types?: string[];
|
|
304
|
+
}): Promise<MemoryEntry[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Delete entry from namespace
|
|
307
|
+
*/
|
|
308
|
+
deleteEntry(namespace: string, entryId: string, agentId: string): Promise<boolean>;
|
|
309
|
+
/**
|
|
310
|
+
* Move entries between namespaces
|
|
311
|
+
*/
|
|
312
|
+
moveEntries(fromNamespace: string, toNamespace: string, entryIds: string[], agentId: string): Promise<number>;
|
|
313
|
+
/**
|
|
314
|
+
* Copy entries between namespaces
|
|
315
|
+
*/
|
|
316
|
+
copyEntries(fromNamespace: string, toNamespace: string, entryIds: string[], agentId: string): Promise<number>;
|
|
317
|
+
/**
|
|
318
|
+
* Grant access to namespace
|
|
319
|
+
*/
|
|
320
|
+
grantAccess(namespace: string, agentId: string): boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Revoke access from namespace
|
|
323
|
+
*/
|
|
324
|
+
revokeAccess(namespace: string, agentId: string): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Set default namespace
|
|
327
|
+
*/
|
|
328
|
+
setDefaultNamespace(name: string): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Get default namespace
|
|
331
|
+
*/
|
|
332
|
+
getDefaultNamespace(): string;
|
|
333
|
+
/**
|
|
334
|
+
* Get namespace statistics
|
|
335
|
+
*/
|
|
336
|
+
getNamespaceStats(name: string): Promise<{
|
|
337
|
+
entryCount: number;
|
|
338
|
+
totalSize: number;
|
|
339
|
+
oldestEntry: number | null;
|
|
340
|
+
newestEntry: number | null;
|
|
341
|
+
typeDistribution: Record<string, number>;
|
|
342
|
+
} | null>;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Create namespace manager
|
|
346
|
+
*/
|
|
347
|
+
declare function createNamespaceManager(store: MemoryStoreInterface, config?: NamespaceConfig): NamespaceManager;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* AccessControl
|
|
351
|
+
*
|
|
352
|
+
* Permission and access control for multi-agent memory systems.
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Permission levels
|
|
357
|
+
*/
|
|
358
|
+
type Permission = 'none' | 'read' | 'write' | 'admin';
|
|
359
|
+
/**
|
|
360
|
+
* Permission rule
|
|
361
|
+
*/
|
|
362
|
+
interface PermissionRule {
|
|
363
|
+
id: string;
|
|
364
|
+
agentId: string;
|
|
365
|
+
resource: string;
|
|
366
|
+
permission: Permission;
|
|
367
|
+
conditions?: PermissionCondition[];
|
|
368
|
+
expiresAt?: number;
|
|
369
|
+
createdBy: string;
|
|
370
|
+
createdAt: number;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Permission condition
|
|
374
|
+
*/
|
|
375
|
+
interface PermissionCondition {
|
|
376
|
+
type: 'time-range' | 'entry-type' | 'importance' | 'custom';
|
|
377
|
+
value: unknown;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Access request
|
|
381
|
+
*/
|
|
382
|
+
interface AccessRequest {
|
|
383
|
+
agentId: string;
|
|
384
|
+
resource: string;
|
|
385
|
+
action: 'read' | 'write' | 'delete' | 'admin';
|
|
386
|
+
entry?: MemoryEntry;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Access result
|
|
390
|
+
*/
|
|
391
|
+
interface AccessResult {
|
|
392
|
+
allowed: boolean;
|
|
393
|
+
reason?: string;
|
|
394
|
+
matchedRule?: PermissionRule;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Access log entry
|
|
398
|
+
*/
|
|
399
|
+
interface AccessLogEntry {
|
|
400
|
+
timestamp: number;
|
|
401
|
+
agentId: string;
|
|
402
|
+
resource: string;
|
|
403
|
+
action: string;
|
|
404
|
+
allowed: boolean;
|
|
405
|
+
reason?: string;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Access control events
|
|
409
|
+
*/
|
|
410
|
+
interface AccessControlEvents {
|
|
411
|
+
accessGranted: (request: AccessRequest) => void;
|
|
412
|
+
accessDenied: (request: AccessRequest, reason: string) => void;
|
|
413
|
+
ruleAdded: (rule: PermissionRule) => void;
|
|
414
|
+
ruleRemoved: (ruleId: string) => void;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Access control manager
|
|
418
|
+
*/
|
|
419
|
+
declare class AccessControl extends EventEmitter<AccessControlEvents> {
|
|
420
|
+
private config;
|
|
421
|
+
private rules;
|
|
422
|
+
private accessLog;
|
|
423
|
+
private maxLogSize;
|
|
424
|
+
constructor(config?: AccessControlConfig);
|
|
425
|
+
/**
|
|
426
|
+
* Add a permission rule
|
|
427
|
+
*/
|
|
428
|
+
addRule(rule: PermissionRule): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Remove a permission rule
|
|
431
|
+
*/
|
|
432
|
+
removeRule(ruleId: string): boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Get rule by ID
|
|
435
|
+
*/
|
|
436
|
+
getRule(ruleId: string): PermissionRule | undefined;
|
|
437
|
+
/**
|
|
438
|
+
* Get all rules for an agent
|
|
439
|
+
*/
|
|
440
|
+
getAgentRules(agentId: string): PermissionRule[];
|
|
441
|
+
/**
|
|
442
|
+
* Check if access is allowed
|
|
443
|
+
*/
|
|
444
|
+
checkAccess(request: AccessRequest): AccessResult;
|
|
445
|
+
/**
|
|
446
|
+
* Grant permission to agent
|
|
447
|
+
*/
|
|
448
|
+
grantPermission(granterId: string, agentId: string, resource: string, permission: Permission, options?: {
|
|
449
|
+
conditions?: PermissionCondition[];
|
|
450
|
+
expiresAt?: number;
|
|
451
|
+
}): PermissionRule;
|
|
452
|
+
/**
|
|
453
|
+
* Revoke all permissions for agent on resource
|
|
454
|
+
*/
|
|
455
|
+
revokePermission(agentId: string, resource: string): number;
|
|
456
|
+
/**
|
|
457
|
+
* Check if agent has specific permission
|
|
458
|
+
*/
|
|
459
|
+
hasPermission(agentId: string, resource: string, action: 'read' | 'write' | 'delete' | 'admin'): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Get access log
|
|
462
|
+
*/
|
|
463
|
+
getAccessLog(options?: {
|
|
464
|
+
agentId?: string;
|
|
465
|
+
resource?: string;
|
|
466
|
+
startTime?: number;
|
|
467
|
+
endTime?: number;
|
|
468
|
+
limit?: number;
|
|
469
|
+
}): AccessLogEntry[];
|
|
470
|
+
/**
|
|
471
|
+
* Clear access log
|
|
472
|
+
*/
|
|
473
|
+
clearAccessLog(): void;
|
|
474
|
+
/**
|
|
475
|
+
* Find applicable rules for request
|
|
476
|
+
*/
|
|
477
|
+
private findApplicableRules;
|
|
478
|
+
/**
|
|
479
|
+
* Sort rules by specificity (most specific first)
|
|
480
|
+
*/
|
|
481
|
+
private sortRulesBySpecificity;
|
|
482
|
+
/**
|
|
483
|
+
* Check conditions
|
|
484
|
+
*/
|
|
485
|
+
private checkConditions;
|
|
486
|
+
/**
|
|
487
|
+
* Convert action to required permission level
|
|
488
|
+
*/
|
|
489
|
+
private actionToPermissionLevel;
|
|
490
|
+
/**
|
|
491
|
+
* Convert permission to level number
|
|
492
|
+
*/
|
|
493
|
+
private permissionToLevel;
|
|
494
|
+
/**
|
|
495
|
+
* Check if permission level is sufficient
|
|
496
|
+
*/
|
|
497
|
+
private hasPermissionLevel;
|
|
498
|
+
/**
|
|
499
|
+
* Log access attempt
|
|
500
|
+
*/
|
|
501
|
+
private logAccess;
|
|
502
|
+
/**
|
|
503
|
+
* Get statistics
|
|
504
|
+
*/
|
|
505
|
+
getStats(): {
|
|
506
|
+
totalRules: number;
|
|
507
|
+
agentCount: number;
|
|
508
|
+
accessGranted: number;
|
|
509
|
+
accessDenied: number;
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* Export rules
|
|
513
|
+
*/
|
|
514
|
+
exportRules(): PermissionRule[];
|
|
515
|
+
/**
|
|
516
|
+
* Import rules
|
|
517
|
+
*/
|
|
518
|
+
importRules(rules: PermissionRule[]): number;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Create access control manager
|
|
522
|
+
*/
|
|
523
|
+
declare function createAccessControl(config?: AccessControlConfig): AccessControl;
|
|
524
|
+
|
|
525
|
+
export { type AccessControlConfig as A, type NamespaceConfig as N, type Permission as P, type SharedMemoryConfig as S, type SyncManagerConfig as a, SharedMemory as b, createSharedMemory as c, NamespaceManager as d, createNamespaceManager as e, AccessControl as f, createAccessControl as g, type SharedMemoryEvents as h, type SharedValue as i, type SyncResult as j, type NamespaceMetadata as k, type NamespaceSettings as l, type NamespaceEvents as m, type PermissionRule as n, type PermissionCondition as o, type AccessRequest as p, type AccessResult as q, type AccessLogEntry as r, type AccessControlEvents as s };
|