snow-flow 2.0.4 → 2.0.5

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.
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Snow-Flow Memory Operations
3
+ * High-level operations for agent coordination and data management
4
+ */
5
+ import { SwarmMemory, AgentCoordination, ServiceNowArtifactRecord, AgentMessage, SharedContext, DeploymentHistory, AgentDependency, PerformanceMetric } from './swarm-memory.js';
6
+ export interface AgentCoordinationUpdate {
7
+ status?: AgentCoordination['status'];
8
+ progress_percentage?: number;
9
+ current_tool?: string;
10
+ error_state?: string;
11
+ assigned_tasks?: string;
12
+ }
13
+ export interface ArtifactSearchOptions {
14
+ session_id?: string;
15
+ artifact_type?: ServiceNowArtifactRecord['artifact_type'];
16
+ deployment_status?: ServiceNowArtifactRecord['deployment_status'];
17
+ created_by_agent?: string;
18
+ limit?: number;
19
+ }
20
+ export interface MessageSearchOptions {
21
+ session_id?: string;
22
+ to_agent?: string;
23
+ from_agent?: string;
24
+ message_type?: AgentMessage['message_type'];
25
+ processed?: boolean;
26
+ limit?: number;
27
+ }
28
+ export interface PerformanceQuery {
29
+ session_id?: string;
30
+ agent_id?: string;
31
+ operation_name?: string;
32
+ success?: boolean;
33
+ start_time?: Date;
34
+ end_time?: Date;
35
+ limit?: number;
36
+ }
37
+ export declare class MemoryOperations {
38
+ private memory;
39
+ private logger;
40
+ constructor(memory: SwarmMemory);
41
+ /**
42
+ * Register a new agent in the coordination system
43
+ */
44
+ registerAgent(session_id: string, agent_id: string, agent_type: string, assigned_tasks?: string[]): Promise<void>;
45
+ /**
46
+ * Update agent status and progress
47
+ */
48
+ updateAgentStatus(session_id: string, agent_id: string, updates: AgentCoordinationUpdate): Promise<void>;
49
+ /**
50
+ * Get all active agents for a session
51
+ */
52
+ getActiveAgents(session_id: string): Promise<AgentCoordination[]>;
53
+ /**
54
+ * Get agent coordination status
55
+ */
56
+ getAgentStatus(session_id: string, agent_id: string): Promise<AgentCoordination | null>;
57
+ /**
58
+ * Store a ServiceNow artifact
59
+ */
60
+ storeArtifact(artifact: Omit<ServiceNowArtifactRecord, 'created_at' | 'updated_at'>): Promise<void>;
61
+ /**
62
+ * Update artifact deployment status
63
+ */
64
+ updateArtifactStatus(sys_id: string, deployment_status: ServiceNowArtifactRecord['deployment_status']): Promise<void>;
65
+ /**
66
+ * Search for artifacts
67
+ */
68
+ searchArtifacts(options?: ArtifactSearchOptions): Promise<ServiceNowArtifactRecord[]>;
69
+ /**
70
+ * Get artifact by sys_id
71
+ */
72
+ getArtifact(sys_id: string): Promise<ServiceNowArtifactRecord | null>;
73
+ /**
74
+ * Send a message between agents
75
+ */
76
+ sendMessage(session_id: string, from_agent: string, to_agent: string, message_type: AgentMessage['message_type'], content: any, artifact_reference?: string): Promise<string>;
77
+ /**
78
+ * Get unprocessed messages for an agent
79
+ */
80
+ getUnprocessedMessages(to_agent: string, session_id?: string): Promise<AgentMessage[]>;
81
+ /**
82
+ * Mark message as processed
83
+ */
84
+ markMessageProcessed(message_id: string): Promise<void>;
85
+ /**
86
+ * Search messages
87
+ */
88
+ searchMessages(options?: MessageSearchOptions): Promise<AgentMessage[]>;
89
+ /**
90
+ * Create agent-specific namespaced key for memory isolation
91
+ * This prevents agents from overwriting each other's memory within the same session
92
+ */
93
+ private createNamespacedKey;
94
+ /**
95
+ * Parse namespaced key to extract original key and agent ID
96
+ */
97
+ private parseNamespacedKey;
98
+ /**
99
+ * Store shared context with agent isolation
100
+ */
101
+ setContext(session_id: string, context_key: string, context_value: any, created_by_agent: string, expires_at?: Date, access_permissions?: string[]): Promise<void>;
102
+ /**
103
+ * Get shared context with agent isolation support
104
+ */
105
+ getContext(session_id: string, context_key: string, requesting_agent?: string): Promise<SharedContext | null>;
106
+ /**
107
+ * Get all context for a session
108
+ */
109
+ getSessionContext(session_id: string): Promise<SharedContext[]>;
110
+ /**
111
+ * Record deployment event
112
+ */
113
+ recordDeployment(session_id: string, artifact_sys_id: string, deployment_type: DeploymentHistory['deployment_type'], agent_id: string, success: boolean, error_details?: string, rollback_available?: boolean): Promise<string>;
114
+ /**
115
+ * Get deployment history for an artifact
116
+ */
117
+ getDeploymentHistory(artifact_sys_id: string): Promise<DeploymentHistory[]>;
118
+ /**
119
+ * Get latest deployment for an artifact
120
+ */
121
+ getLatestDeployment(artifact_sys_id: string): Promise<DeploymentHistory | null>;
122
+ /**
123
+ * Add agent dependency
124
+ */
125
+ addDependency(session_id: string, agent_id: string, depends_on_agent: string, dependency_type: AgentDependency['dependency_type'], artifact_reference?: string): Promise<void>;
126
+ /**
127
+ * Mark dependency as satisfied
128
+ */
129
+ satisfyDependency(session_id: string, agent_id: string, depends_on_agent: string): Promise<void>;
130
+ /**
131
+ * Get pending dependencies for an agent
132
+ */
133
+ getPendingDependencies(session_id: string, agent_id: string): Promise<AgentDependency[]>;
134
+ /**
135
+ * Check if all dependencies are satisfied
136
+ */
137
+ checkDependenciesSatisfied(session_id: string, agent_id: string): Promise<boolean>;
138
+ /**
139
+ * Start performance tracking
140
+ */
141
+ startPerformanceTracking(session_id: string, agent_id: string, operation_name: string): {
142
+ id: string;
143
+ startTime: number;
144
+ };
145
+ /**
146
+ * Complete performance tracking
147
+ */
148
+ completePerformanceTracking(tracking: {
149
+ id: string;
150
+ startTime: number;
151
+ }, session_id: string, agent_id: string, operation_name: string, success: boolean, error_message?: string, metadata?: any): Promise<void>;
152
+ /**
153
+ * Query performance metrics
154
+ */
155
+ queryPerformanceMetrics(query?: PerformanceQuery): Promise<PerformanceMetric[]>;
156
+ /**
157
+ * Get average performance for an operation
158
+ */
159
+ getAveragePerformance(operation_name: string, session_id?: string): Promise<{
160
+ avg_duration_ms: number;
161
+ success_rate: number;
162
+ total_operations: number;
163
+ } | null>;
164
+ /**
165
+ * Get complete session state
166
+ */
167
+ getSessionState(session_id: string): Promise<{
168
+ agents: AgentCoordination[];
169
+ artifacts: ServiceNowArtifactRecord[];
170
+ pendingMessages: number;
171
+ activeContext: SharedContext[];
172
+ performanceSummary: any;
173
+ }>;
174
+ /**
175
+ * Clean up session data
176
+ */
177
+ cleanupSession(session_id: string): Promise<void>;
178
+ }
179
+ //# sourceMappingURL=memory-operations.d.ts.map