@loxia-labs/loxia-autopilot-one 1.0.1 → 1.0.3
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/README.md +44 -54
- package/bin/cli.js +1 -115
- package/bin/loxia-terminal-v2.js +3 -0
- package/bin/loxia-terminal.js +3 -0
- package/bin/start-with-terminal.js +3 -0
- package/package.json +14 -15
- package/scripts/install-scanners.js +1 -235
- package/src/analyzers/CSSAnalyzer.js +1 -297
- package/src/analyzers/ConfigValidator.js +1 -690
- package/src/analyzers/ESLintAnalyzer.js +1 -320
- package/src/analyzers/JavaScriptAnalyzer.js +1 -261
- package/src/analyzers/PrettierFormatter.js +1 -247
- package/src/analyzers/PythonAnalyzer.js +1 -266
- package/src/analyzers/SecurityAnalyzer.js +1 -729
- package/src/analyzers/TypeScriptAnalyzer.js +1 -247
- package/src/analyzers/codeCloneDetector/analyzer.js +1 -344
- package/src/analyzers/codeCloneDetector/detector.js +1 -203
- package/src/analyzers/codeCloneDetector/index.js +1 -160
- package/src/analyzers/codeCloneDetector/parser.js +1 -199
- package/src/analyzers/codeCloneDetector/reporter.js +1 -148
- package/src/analyzers/codeCloneDetector/scanner.js +1 -59
- package/src/core/agentPool.js +1 -1474
- package/src/core/agentScheduler.js +1 -2147
- package/src/core/contextManager.js +1 -709
- package/src/core/messageProcessor.js +1 -732
- package/src/core/orchestrator.js +1 -548
- package/src/core/stateManager.js +1 -877
- package/src/index.js +1 -631
- package/src/interfaces/cli.js +1 -549
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -0
- package/src/interfaces/terminal/api/apiClient.js +1 -0
- package/src/interfaces/terminal/api/messageRouter.js +1 -0
- package/src/interfaces/terminal/api/session.js +1 -0
- package/src/interfaces/terminal/api/websocket.js +1 -0
- package/src/interfaces/terminal/components/AgentCreator.js +1 -0
- package/src/interfaces/terminal/components/AgentEditor.js +1 -0
- package/src/interfaces/terminal/components/AgentSwitcher.js +1 -0
- package/src/interfaces/terminal/components/ErrorBoundary.js +1 -0
- package/src/interfaces/terminal/components/ErrorPanel.js +1 -0
- package/src/interfaces/terminal/components/Header.js +1 -0
- package/src/interfaces/terminal/components/HelpPanel.js +1 -0
- package/src/interfaces/terminal/components/InputBox.js +1 -0
- package/src/interfaces/terminal/components/Layout.js +1 -0
- package/src/interfaces/terminal/components/LoadingSpinner.js +1 -0
- package/src/interfaces/terminal/components/MessageList.js +1 -0
- package/src/interfaces/terminal/components/MultilineTextInput.js +1 -0
- package/src/interfaces/terminal/components/SearchPanel.js +1 -0
- package/src/interfaces/terminal/components/SettingsPanel.js +1 -0
- package/src/interfaces/terminal/components/StatusBar.js +1 -0
- package/src/interfaces/terminal/components/TextInput.js +1 -0
- package/src/interfaces/terminal/config/agentEditorConstants.js +1 -0
- package/src/interfaces/terminal/config/constants.js +1 -0
- package/src/interfaces/terminal/index.js +1 -0
- package/src/interfaces/terminal/state/useAgentControl.js +1 -0
- package/src/interfaces/terminal/state/useAgents.js +1 -0
- package/src/interfaces/terminal/state/useConnection.js +1 -0
- package/src/interfaces/terminal/state/useMessages.js +1 -0
- package/src/interfaces/terminal/state/useTools.js +1 -0
- package/src/interfaces/terminal/utils/debugLogger.js +1 -0
- package/src/interfaces/terminal/utils/settingsStorage.js +1 -0
- package/src/interfaces/terminal/utils/theme.js +1 -0
- package/src/interfaces/webServer.js +1 -2162
- package/src/modules/fileExplorer/controller.js +1 -280
- package/src/modules/fileExplorer/index.js +1 -37
- package/src/modules/fileExplorer/middleware.js +1 -92
- package/src/modules/fileExplorer/routes.js +1 -125
- package/src/modules/fileExplorer/types.js +1 -44
- package/src/services/aiService.js +1 -1232
- package/src/services/apiKeyManager.js +1 -164
- package/src/services/benchmarkService.js +1 -366
- package/src/services/budgetService.js +1 -539
- package/src/services/contextInjectionService.js +1 -247
- package/src/services/conversationCompactionService.js +1 -637
- package/src/services/errorHandler.js +1 -810
- package/src/services/fileAttachmentService.js +1 -544
- package/src/services/modelRouterService.js +1 -366
- package/src/services/modelsService.js +1 -322
- package/src/services/qualityInspector.js +1 -796
- package/src/services/tokenCountingService.js +1 -536
- package/src/tools/agentCommunicationTool.js +1 -1344
- package/src/tools/agentDelayTool.js +1 -485
- package/src/tools/asyncToolManager.js +1 -604
- package/src/tools/baseTool.js +1 -800
- package/src/tools/browserTool.js +1 -920
- package/src/tools/cloneDetectionTool.js +1 -621
- package/src/tools/dependencyResolverTool.js +1 -1215
- package/src/tools/fileContentReplaceTool.js +1 -875
- package/src/tools/fileSystemTool.js +1 -1107
- package/src/tools/fileTreeTool.js +1 -853
- package/src/tools/imageTool.js +1 -901
- package/src/tools/importAnalyzerTool.js +1 -1060
- package/src/tools/jobDoneTool.js +1 -248
- package/src/tools/seekTool.js +1 -956
- package/src/tools/staticAnalysisTool.js +1 -1778
- package/src/tools/taskManagerTool.js +1 -2873
- package/src/tools/terminalTool.js +1 -2304
- package/src/tools/webTool.js +1 -1430
- package/src/types/agent.js +1 -519
- package/src/types/contextReference.js +1 -972
- package/src/types/conversation.js +1 -730
- package/src/types/toolCommand.js +1 -747
- package/src/utilities/attachmentValidator.js +1 -292
- package/src/utilities/configManager.js +1 -582
- package/src/utilities/constants.js +1 -722
- package/src/utilities/directoryAccessManager.js +1 -535
- package/src/utilities/fileProcessor.js +1 -307
- package/src/utilities/logger.js +1 -436
- package/src/utilities/tagParser.js +1 -1246
- package/src/utilities/toolConstants.js +1 -317
- package/web-ui/build/index.html +2 -2
- package/web-ui/build/static/{index-Dy2bYbOa.css → index-CClD1090.css} +1 -1
- package/web-ui/build/static/{index-CjkkcnFA.js → index-lCBai6dX.js} +66 -67
package/src/types/agent.js
CHANGED
|
@@ -1,519 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Data Model - Type definitions and validation for AI agents
|
|
3
|
-
*
|
|
4
|
-
* Purpose:
|
|
5
|
-
* - Define the structure and properties of AI agents
|
|
6
|
-
* - Provide validation functions for agent data
|
|
7
|
-
* - Ensure data integrity and consistency
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { AGENT_STATUS, AGENT_TYPES, MODELS } from '../utilities/constants.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Agent data model
|
|
14
|
-
* @typedef {Object} Agent
|
|
15
|
-
* @property {string} id - Unique agent identifier
|
|
16
|
-
* @property {string} name - Human-readable agent name
|
|
17
|
-
* @property {string} type - Agent type (user-created, system-agent, agent-engineer)
|
|
18
|
-
* @property {string} status - Current agent status (active, idle, busy, suspended, paused)
|
|
19
|
-
* @property {string} currentModel - AI model being used
|
|
20
|
-
* @property {string} systemPrompt - System prompt defining agent behavior
|
|
21
|
-
* @property {AgentConfiguration} configuration - Agent configuration settings
|
|
22
|
-
* @property {AgentMetrics} metrics - Performance and usage metrics
|
|
23
|
-
* @property {AgentState} state - Current agent state information
|
|
24
|
-
* @property {string} createdAt - ISO timestamp of creation
|
|
25
|
-
* @property {string} updatedAt - ISO timestamp of last update
|
|
26
|
-
* @property {string} lastActivity - ISO timestamp of last activity
|
|
27
|
-
* @property {string|null} pausedUntil - ISO timestamp when pause expires (null if not paused)
|
|
28
|
-
* @property {string|null} pauseReason - Reason for current pause (null if not paused)
|
|
29
|
-
* @property {Object} metadata - Additional metadata and tags
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Agent configuration settings
|
|
34
|
-
* @typedef {Object} AgentConfiguration
|
|
35
|
-
* @property {number} maxContextLength - Maximum context length in tokens
|
|
36
|
-
* @property {number} temperature - Sampling temperature (0.0-1.0)
|
|
37
|
-
* @property {number} maxTokens - Maximum tokens per response
|
|
38
|
-
* @property {number} timeout - Request timeout in milliseconds
|
|
39
|
-
* @property {boolean} persistConversations - Whether to persist conversation history
|
|
40
|
-
* @property {string[]} enabledTools - List of enabled tool names
|
|
41
|
-
* @property {Object} toolConfigurations - Tool-specific configurations
|
|
42
|
-
* @property {boolean} autoRetry - Whether to automatically retry failed requests
|
|
43
|
-
* @property {number} maxRetries - Maximum number of retry attempts
|
|
44
|
-
* @property {Object} customSettings - Custom configuration properties
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Agent performance and usage metrics
|
|
49
|
-
* @typedef {Object} AgentMetrics
|
|
50
|
-
* @property {number} totalMessages - Total messages processed
|
|
51
|
-
* @property {number} totalTokensUsed - Total tokens consumed
|
|
52
|
-
* @property {number} totalCost - Total cost incurred (USD)
|
|
53
|
-
* @property {number} averageResponseTime - Average response time in milliseconds
|
|
54
|
-
* @property {number} successRate - Success rate (0.0-1.0)
|
|
55
|
-
* @property {number} errorCount - Total number of errors
|
|
56
|
-
* @property {number} toolExecutions - Number of tool executions
|
|
57
|
-
* @property {number} conversationsStarted - Number of conversations initiated
|
|
58
|
-
* @property {Object} dailyUsage - Daily usage statistics
|
|
59
|
-
* @property {Object} weeklyUsage - Weekly usage statistics
|
|
60
|
-
* @property {Object} monthlyUsage - Monthly usage statistics
|
|
61
|
-
* @property {string} lastMetricsUpdate - ISO timestamp of last metrics update
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Agent state information
|
|
66
|
-
* @typedef {Object} AgentState
|
|
67
|
-
* @property {string} currentConversationId - ID of current active conversation
|
|
68
|
-
* @property {number} messageCount - Number of messages in current conversation
|
|
69
|
-
* @property {Object} context - Current conversation context
|
|
70
|
-
* @property {string[]} activeTools - Currently executing tools
|
|
71
|
-
* @property {Object} pendingOperations - Pending asynchronous operations
|
|
72
|
-
* @property {Object} cache - Cached data and responses
|
|
73
|
-
* @property {boolean} isProcessing - Whether agent is currently processing
|
|
74
|
-
* @property {string|null} lastError - Last error encountered (null if none)
|
|
75
|
-
* @property {Object} sessionData - Session-specific data
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Agent creation parameters
|
|
80
|
-
* @typedef {Object} AgentCreationParams
|
|
81
|
-
* @property {string} name - Agent name (required)
|
|
82
|
-
* @property {string} [type=user-created] - Agent type
|
|
83
|
-
* @property {string} [model=anthropic-sonnet] - AI model to use
|
|
84
|
-
* @property {string} [systemPrompt=''] - System prompt
|
|
85
|
-
* @property {Partial<AgentConfiguration>} [configuration] - Initial configuration
|
|
86
|
-
* @property {Object} [metadata] - Initial metadata
|
|
87
|
-
* @property {string[]} [enabledTools] - Initial enabled tools
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Agent update parameters
|
|
92
|
-
* @typedef {Object} AgentUpdateParams
|
|
93
|
-
* @property {string} [name] - New agent name
|
|
94
|
-
* @property {string} [systemPrompt] - New system prompt
|
|
95
|
-
* @property {string} [currentModel] - New AI model
|
|
96
|
-
* @property {Partial<AgentConfiguration>} [configuration] - Configuration updates
|
|
97
|
-
* @property {Object} [metadata] - Metadata updates
|
|
98
|
-
* @property {string[]} [enabledTools] - Updated enabled tools list
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Agent validation functions
|
|
103
|
-
*/
|
|
104
|
-
export class AgentValidator {
|
|
105
|
-
/**
|
|
106
|
-
* Validate agent data structure
|
|
107
|
-
* @param {Object} agent - Agent data to validate
|
|
108
|
-
* @returns {Object} Validation result
|
|
109
|
-
*/
|
|
110
|
-
static validate(agent) {
|
|
111
|
-
const errors = [];
|
|
112
|
-
const warnings = [];
|
|
113
|
-
|
|
114
|
-
// Required fields
|
|
115
|
-
if (!agent.id || typeof agent.id !== 'string') {
|
|
116
|
-
errors.push('Agent ID is required and must be a string');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (!agent.name || typeof agent.name !== 'string') {
|
|
120
|
-
errors.push('Agent name is required and must be a string');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (agent.name && agent.name.length < 2) {
|
|
124
|
-
errors.push('Agent name must be at least 2 characters long');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (agent.name && agent.name.length > 100) {
|
|
128
|
-
errors.push('Agent name must be less than 100 characters');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Type validation
|
|
132
|
-
if (agent.type && !Object.values(AGENT_TYPES).includes(agent.type)) {
|
|
133
|
-
errors.push(`Invalid agent type: ${agent.type}`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Status validation
|
|
137
|
-
if (agent.status && !Object.values(AGENT_STATUS).includes(agent.status)) {
|
|
138
|
-
errors.push(`Invalid agent status: ${agent.status}`);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Model validation
|
|
142
|
-
if (agent.currentModel && !Object.values(MODELS).includes(agent.currentModel)) {
|
|
143
|
-
warnings.push(`Unknown AI model: ${agent.currentModel}`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// System prompt validation
|
|
147
|
-
if (agent.systemPrompt && typeof agent.systemPrompt !== 'string') {
|
|
148
|
-
errors.push('System prompt must be a string');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (agent.systemPrompt && agent.systemPrompt.length > 10000) {
|
|
152
|
-
warnings.push('System prompt is very long (>10000 characters)');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Configuration validation
|
|
156
|
-
if (agent.configuration) {
|
|
157
|
-
const configValidation = this.validateConfiguration(agent.configuration);
|
|
158
|
-
errors.push(...configValidation.errors);
|
|
159
|
-
warnings.push(...configValidation.warnings);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Timestamp validation
|
|
163
|
-
const timestampFields = ['createdAt', 'updatedAt', 'lastActivity', 'pausedUntil'];
|
|
164
|
-
timestampFields.forEach(field => {
|
|
165
|
-
if (agent[field] && !this.isValidTimestamp(agent[field])) {
|
|
166
|
-
errors.push(`Invalid timestamp for ${field}: ${agent[field]}`);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
isValid: errors.length === 0,
|
|
172
|
-
errors,
|
|
173
|
-
warnings
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Validate agent configuration
|
|
179
|
-
* @param {Object} configuration - Configuration to validate
|
|
180
|
-
* @returns {Object} Validation result
|
|
181
|
-
*/
|
|
182
|
-
static validateConfiguration(configuration) {
|
|
183
|
-
const errors = [];
|
|
184
|
-
const warnings = [];
|
|
185
|
-
|
|
186
|
-
if (configuration.maxContextLength && typeof configuration.maxContextLength !== 'number') {
|
|
187
|
-
errors.push('maxContextLength must be a number');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (configuration.maxContextLength && configuration.maxContextLength < 1000) {
|
|
191
|
-
warnings.push('maxContextLength is very low (<1000)');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (configuration.temperature !== undefined) {
|
|
195
|
-
if (typeof configuration.temperature !== 'number') {
|
|
196
|
-
errors.push('temperature must be a number');
|
|
197
|
-
} else if (configuration.temperature < 0 || configuration.temperature > 2) {
|
|
198
|
-
errors.push('temperature must be between 0 and 2');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (configuration.maxTokens && typeof configuration.maxTokens !== 'number') {
|
|
203
|
-
errors.push('maxTokens must be a number');
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (configuration.timeout && typeof configuration.timeout !== 'number') {
|
|
207
|
-
errors.push('timeout must be a number');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (configuration.timeout && configuration.timeout < 1000) {
|
|
211
|
-
warnings.push('timeout is very low (<1000ms)');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (configuration.maxRetries && typeof configuration.maxRetries !== 'number') {
|
|
215
|
-
errors.push('maxRetries must be a number');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (configuration.enabledTools && !Array.isArray(configuration.enabledTools)) {
|
|
219
|
-
errors.push('enabledTools must be an array');
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return { errors, warnings };
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Validate agent creation parameters
|
|
227
|
-
* @param {Object} params - Creation parameters to validate
|
|
228
|
-
* @returns {Object} Validation result
|
|
229
|
-
*/
|
|
230
|
-
static validateCreationParams(params) {
|
|
231
|
-
const errors = [];
|
|
232
|
-
const warnings = [];
|
|
233
|
-
|
|
234
|
-
if (!params.name || typeof params.name !== 'string') {
|
|
235
|
-
errors.push('Agent name is required and must be a string');
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (params.name && params.name.length < 2) {
|
|
239
|
-
errors.push('Agent name must be at least 2 characters long');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (params.type && !Object.values(AGENT_TYPES).includes(params.type)) {
|
|
243
|
-
errors.push(`Invalid agent type: ${params.type}`);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (params.model && !Object.values(MODELS).includes(params.model)) {
|
|
247
|
-
warnings.push(`Unknown AI model: ${params.model}`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (params.systemPrompt && typeof params.systemPrompt !== 'string') {
|
|
251
|
-
errors.push('System prompt must be a string');
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (params.enabledTools && !Array.isArray(params.enabledTools)) {
|
|
255
|
-
errors.push('enabledTools must be an array');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
isValid: errors.length === 0,
|
|
260
|
-
errors,
|
|
261
|
-
warnings
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Check if a timestamp is valid ISO string
|
|
267
|
-
* @param {string} timestamp - Timestamp to validate
|
|
268
|
-
* @returns {boolean} True if valid
|
|
269
|
-
*/
|
|
270
|
-
static isValidTimestamp(timestamp) {
|
|
271
|
-
if (typeof timestamp !== 'string') return false;
|
|
272
|
-
const date = new Date(timestamp);
|
|
273
|
-
return date instanceof Date && !isNaN(date.getTime());
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Agent factory functions
|
|
279
|
-
*/
|
|
280
|
-
export class AgentFactory {
|
|
281
|
-
/**
|
|
282
|
-
* Create a new agent with default values
|
|
283
|
-
* @param {AgentCreationParams} params - Creation parameters
|
|
284
|
-
* @returns {Agent} New agent object
|
|
285
|
-
*/
|
|
286
|
-
static create(params) {
|
|
287
|
-
// Validate parameters
|
|
288
|
-
const validation = AgentValidator.validateCreationParams(params);
|
|
289
|
-
if (!validation.isValid) {
|
|
290
|
-
throw new Error(`Invalid agent parameters: ${validation.errors.join(', ')}`);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const now = new Date().toISOString();
|
|
294
|
-
const agentId = this.generateAgentId();
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
id: agentId,
|
|
298
|
-
name: params.name,
|
|
299
|
-
type: params.type || AGENT_TYPES.USER_CREATED,
|
|
300
|
-
status: AGENT_STATUS.IDLE,
|
|
301
|
-
currentModel: params.model || MODELS.ANTHROPIC_SONNET,
|
|
302
|
-
systemPrompt: params.systemPrompt || '',
|
|
303
|
-
configuration: this.createDefaultConfiguration(params.configuration),
|
|
304
|
-
metrics: this.createDefaultMetrics(),
|
|
305
|
-
state: this.createDefaultState(),
|
|
306
|
-
createdAt: now,
|
|
307
|
-
updatedAt: now,
|
|
308
|
-
lastActivity: now,
|
|
309
|
-
pausedUntil: null,
|
|
310
|
-
pauseReason: null,
|
|
311
|
-
metadata: params.metadata || {}
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Create default agent configuration
|
|
317
|
-
* @param {Partial<AgentConfiguration>} overrides - Configuration overrides
|
|
318
|
-
* @returns {AgentConfiguration} Default configuration
|
|
319
|
-
*/
|
|
320
|
-
static createDefaultConfiguration(overrides = {}) {
|
|
321
|
-
return {
|
|
322
|
-
maxContextLength: 50000,
|
|
323
|
-
temperature: 0.7,
|
|
324
|
-
maxTokens: 4096,
|
|
325
|
-
timeout: 30000,
|
|
326
|
-
persistConversations: true,
|
|
327
|
-
enabledTools: ['terminal', 'filesys', 'editor'],
|
|
328
|
-
toolConfigurations: {},
|
|
329
|
-
autoRetry: true,
|
|
330
|
-
maxRetries: 3,
|
|
331
|
-
customSettings: {},
|
|
332
|
-
...overrides
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Create default agent metrics
|
|
338
|
-
* @returns {AgentMetrics} Default metrics
|
|
339
|
-
*/
|
|
340
|
-
static createDefaultMetrics() {
|
|
341
|
-
const now = new Date().toISOString();
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
totalMessages: 0,
|
|
345
|
-
totalTokensUsed: 0,
|
|
346
|
-
totalCost: 0,
|
|
347
|
-
averageResponseTime: 0,
|
|
348
|
-
successRate: 1.0,
|
|
349
|
-
errorCount: 0,
|
|
350
|
-
toolExecutions: 0,
|
|
351
|
-
conversationsStarted: 0,
|
|
352
|
-
dailyUsage: { tokens: 0, cost: 0, messages: 0 },
|
|
353
|
-
weeklyUsage: { tokens: 0, cost: 0, messages: 0 },
|
|
354
|
-
monthlyUsage: { tokens: 0, cost: 0, messages: 0 },
|
|
355
|
-
lastMetricsUpdate: now
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Create default agent state
|
|
361
|
-
* @returns {AgentState} Default state
|
|
362
|
-
*/
|
|
363
|
-
static createDefaultState() {
|
|
364
|
-
return {
|
|
365
|
-
currentConversationId: null,
|
|
366
|
-
messageCount: 0,
|
|
367
|
-
context: {},
|
|
368
|
-
activeTools: [],
|
|
369
|
-
pendingOperations: {},
|
|
370
|
-
cache: {},
|
|
371
|
-
isProcessing: false,
|
|
372
|
-
lastError: null,
|
|
373
|
-
sessionData: {}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Generate unique agent ID
|
|
379
|
-
* @returns {string} Unique agent ID
|
|
380
|
-
*/
|
|
381
|
-
static generateAgentId() {
|
|
382
|
-
const timestamp = Date.now().toString(36);
|
|
383
|
-
const random = Math.random().toString(36).substr(2, 9);
|
|
384
|
-
return `agent_${timestamp}_${random}`;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Clone an existing agent with new ID
|
|
389
|
-
* @param {Agent} agent - Agent to clone
|
|
390
|
-
* @param {string} newName - Name for cloned agent
|
|
391
|
-
* @returns {Agent} Cloned agent
|
|
392
|
-
*/
|
|
393
|
-
static clone(agent, newName) {
|
|
394
|
-
const cloned = { ...agent };
|
|
395
|
-
const now = new Date().toISOString();
|
|
396
|
-
|
|
397
|
-
cloned.id = this.generateAgentId();
|
|
398
|
-
cloned.name = newName;
|
|
399
|
-
cloned.status = AGENT_STATUS.IDLE;
|
|
400
|
-
cloned.createdAt = now;
|
|
401
|
-
cloned.updatedAt = now;
|
|
402
|
-
cloned.lastActivity = now;
|
|
403
|
-
cloned.pausedUntil = null;
|
|
404
|
-
cloned.pauseReason = null;
|
|
405
|
-
|
|
406
|
-
// Reset metrics and state
|
|
407
|
-
cloned.metrics = this.createDefaultMetrics();
|
|
408
|
-
cloned.state = this.createDefaultState();
|
|
409
|
-
|
|
410
|
-
return cloned;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Agent utility functions
|
|
416
|
-
*/
|
|
417
|
-
export class AgentUtils {
|
|
418
|
-
/**
|
|
419
|
-
* Check if agent is currently active
|
|
420
|
-
* @param {Agent} agent - Agent to check
|
|
421
|
-
* @returns {boolean} True if active
|
|
422
|
-
*/
|
|
423
|
-
static isActive(agent) {
|
|
424
|
-
return agent.status === AGENT_STATUS.ACTIVE || agent.status === AGENT_STATUS.BUSY;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Check if agent is paused
|
|
429
|
-
* @param {Agent} agent - Agent to check
|
|
430
|
-
* @returns {boolean} True if paused
|
|
431
|
-
*/
|
|
432
|
-
static isPaused(agent) {
|
|
433
|
-
if (agent.status !== AGENT_STATUS.PAUSED) return false;
|
|
434
|
-
|
|
435
|
-
if (agent.pausedUntil) {
|
|
436
|
-
const pauseExpiry = new Date(agent.pausedUntil);
|
|
437
|
-
return new Date() < pauseExpiry;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return true;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Get agent's effective status considering pause expiry
|
|
445
|
-
* @param {Agent} agent - Agent to check
|
|
446
|
-
* @returns {string} Effective status
|
|
447
|
-
*/
|
|
448
|
-
static getEffectiveStatus(agent) {
|
|
449
|
-
if (agent.status === AGENT_STATUS.PAUSED && agent.pausedUntil) {
|
|
450
|
-
const pauseExpiry = new Date(agent.pausedUntil);
|
|
451
|
-
if (new Date() >= pauseExpiry) {
|
|
452
|
-
return AGENT_STATUS.IDLE; // Pause has expired
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return agent.status;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Calculate time until pause expires
|
|
461
|
-
* @param {Agent} agent - Agent to check
|
|
462
|
-
* @returns {number|null} Milliseconds until pause expires, null if not paused
|
|
463
|
-
*/
|
|
464
|
-
static getTimeUntilPauseExpiry(agent) {
|
|
465
|
-
if (!this.isPaused(agent) || !agent.pausedUntil) {
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
const pauseExpiry = new Date(agent.pausedUntil);
|
|
470
|
-
const now = new Date();
|
|
471
|
-
|
|
472
|
-
return Math.max(0, pauseExpiry.getTime() - now.getTime());
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Format agent for display
|
|
477
|
-
* @param {Agent} agent - Agent to format
|
|
478
|
-
* @returns {Object} Formatted agent data
|
|
479
|
-
*/
|
|
480
|
-
static formatForDisplay(agent) {
|
|
481
|
-
return {
|
|
482
|
-
id: agent.id,
|
|
483
|
-
name: agent.name,
|
|
484
|
-
type: agent.type,
|
|
485
|
-
status: this.getEffectiveStatus(agent),
|
|
486
|
-
model: agent.currentModel,
|
|
487
|
-
messageCount: agent.metrics.totalMessages,
|
|
488
|
-
lastActivity: agent.lastActivity,
|
|
489
|
-
isPaused: this.isPaused(agent),
|
|
490
|
-
timeUntilPauseExpiry: this.getTimeUntilPauseExpiry(agent)
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Sanitize agent data for API responses
|
|
496
|
-
* @param {Agent} agent - Agent to sanitize
|
|
497
|
-
* @returns {Object} Sanitized agent data
|
|
498
|
-
*/
|
|
499
|
-
static sanitize(agent) {
|
|
500
|
-
const sanitized = { ...agent };
|
|
501
|
-
|
|
502
|
-
// Remove sensitive or internal data
|
|
503
|
-
delete sanitized.state.cache;
|
|
504
|
-
delete sanitized.state.sessionData;
|
|
505
|
-
|
|
506
|
-
// Truncate long system prompt for API responses
|
|
507
|
-
if (sanitized.systemPrompt && sanitized.systemPrompt.length > 500) {
|
|
508
|
-
sanitized.systemPrompt = sanitized.systemPrompt.substring(0, 500) + '...';
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return sanitized;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
export default {
|
|
516
|
-
AgentValidator,
|
|
517
|
-
AgentFactory,
|
|
518
|
-
AgentUtils
|
|
519
|
-
};
|
|
1
|
+
const a0_0x18f347=a0_0x1d47;(function(_0x36c4e2,_0x18e2e9){const _0x13dd30=a0_0x1d47,_0x54fb87=_0x36c4e2();while(!![]){try{const _0x3d159c=parseInt(_0x13dd30(0x17a))/0x1*(-parseInt(_0x13dd30(0x193))/0x2)+-parseInt(_0x13dd30(0x184))/0x3+-parseInt(_0x13dd30(0x15f))/0x4*(-parseInt(_0x13dd30(0x165))/0x5)+parseInt(_0x13dd30(0x186))/0x6+parseInt(_0x13dd30(0x15b))/0x7*(parseInt(_0x13dd30(0x197))/0x8)+parseInt(_0x13dd30(0x167))/0x9+-parseInt(_0x13dd30(0x19f))/0xa;if(_0x3d159c===_0x18e2e9)break;else _0x54fb87['push'](_0x54fb87['shift']());}catch(_0x458569){_0x54fb87['push'](_0x54fb87['shift']());}}}(a0_0x4aa8,0xa46b2));function a0_0x1d47(_0x561aac,_0x111277){_0x561aac=_0x561aac-0x159;const _0x4aa885=a0_0x4aa8();let _0x1d4774=_0x4aa885[_0x561aac];if(a0_0x1d47['rmBGgH']===undefined){var _0x260f99=function(_0x460141){const _0x235bcd='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x45164d='',_0x1fdfe2='';for(let _0x39f4e1=0x0,_0x743e3e,_0x32bb6b,_0x4eb4f2=0x0;_0x32bb6b=_0x460141['charAt'](_0x4eb4f2++);~_0x32bb6b&&(_0x743e3e=_0x39f4e1%0x4?_0x743e3e*0x40+_0x32bb6b:_0x32bb6b,_0x39f4e1++%0x4)?_0x45164d+=String['fromCharCode'](0xff&_0x743e3e>>(-0x2*_0x39f4e1&0x6)):0x0){_0x32bb6b=_0x235bcd['indexOf'](_0x32bb6b);}for(let _0x2b0d2f=0x0,_0x3dbf8b=_0x45164d['length'];_0x2b0d2f<_0x3dbf8b;_0x2b0d2f++){_0x1fdfe2+='%'+('00'+_0x45164d['charCodeAt'](_0x2b0d2f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1fdfe2);};a0_0x1d47['XncPLt']=_0x260f99,a0_0x1d47['apUIiY']={},a0_0x1d47['rmBGgH']=!![];}const _0x524bcf=_0x4aa885[0x0],_0x491dcd=_0x561aac+_0x524bcf,_0xdde781=a0_0x1d47['apUIiY'][_0x491dcd];return!_0xdde781?(_0x1d4774=a0_0x1d47['XncPLt'](_0x1d4774),a0_0x1d47['apUIiY'][_0x491dcd]=_0x1d4774):_0x1d4774=_0xdde781,_0x1d4774;}import{AGENT_STATUS,AGENT_TYPES,MODELS}from'../utilities/constants.js';export class AgentValidator{static['validate'](_0x45164d){const _0x40f7c7=a0_0x1d47,_0x1fdfe2=[],_0x39f4e1=[];(!_0x45164d['id']||typeof _0x45164d['id']!==_0x40f7c7(0x166))&&_0x1fdfe2['push']('Agent\x20ID\x20is\x20required\x20and\x20must\x20be\x20a\x20string');(!_0x45164d['name']||typeof _0x45164d[_0x40f7c7(0x18c)]!==_0x40f7c7(0x166))&&_0x1fdfe2['push'](_0x40f7c7(0x17b));_0x45164d[_0x40f7c7(0x18c)]&&_0x45164d[_0x40f7c7(0x18c)]['length']<0x2&&_0x1fdfe2[_0x40f7c7(0x178)](_0x40f7c7(0x15e));_0x45164d['name']&&_0x45164d['name']['length']>0x64&&_0x1fdfe2[_0x40f7c7(0x178)]('Agent\x20name\x20must\x20be\x20less\x20than\x20100\x20characters');_0x45164d[_0x40f7c7(0x170)]&&!Object[_0x40f7c7(0x16c)](AGENT_TYPES)[_0x40f7c7(0x174)](_0x45164d[_0x40f7c7(0x170)])&&_0x1fdfe2[_0x40f7c7(0x178)]('Invalid\x20agent\x20type:\x20'+_0x45164d['type']);_0x45164d['status']&&!Object[_0x40f7c7(0x16c)](AGENT_STATUS)['includes'](_0x45164d[_0x40f7c7(0x177)])&&_0x1fdfe2[_0x40f7c7(0x178)]('Invalid\x20agent\x20status:\x20'+_0x45164d[_0x40f7c7(0x177)]);_0x45164d['currentModel']&&!Object['values'](MODELS)['includes'](_0x45164d['currentModel'])&&_0x39f4e1[_0x40f7c7(0x178)]('Unknown\x20AI\x20model:\x20'+_0x45164d[_0x40f7c7(0x19c)]);_0x45164d[_0x40f7c7(0x190)]&&typeof _0x45164d[_0x40f7c7(0x190)]!=='string'&&_0x1fdfe2['push']('System\x20prompt\x20must\x20be\x20a\x20string');_0x45164d['systemPrompt']&&_0x45164d['systemPrompt']['length']>0x2710&&_0x39f4e1[_0x40f7c7(0x178)]('System\x20prompt\x20is\x20very\x20long\x20(>10000\x20characters)');if(_0x45164d['configuration']){const _0x32bb6b=this['validateConfiguration'](_0x45164d['configuration']);_0x1fdfe2['push'](..._0x32bb6b[_0x40f7c7(0x164)]),_0x39f4e1['push'](..._0x32bb6b[_0x40f7c7(0x179)]);}const _0x743e3e=['createdAt','updatedAt','lastActivity',_0x40f7c7(0x199)];return _0x743e3e['forEach'](_0x4eb4f2=>{_0x45164d[_0x4eb4f2]&&!this['isValidTimestamp'](_0x45164d[_0x4eb4f2])&&_0x1fdfe2['push']('Invalid\x20timestamp\x20for\x20'+_0x4eb4f2+':\x20'+_0x45164d[_0x4eb4f2]);}),{'isValid':_0x1fdfe2[_0x40f7c7(0x176)]===0x0,'errors':_0x1fdfe2,'warnings':_0x39f4e1};}static['validateConfiguration'](_0x2b0d2f){const _0x2b64e1=a0_0x1d47,_0x3dbf8b=[],_0x1fed50=[];_0x2b0d2f['maxContextLength']&&typeof _0x2b0d2f[_0x2b64e1(0x181)]!=='number'&&_0x3dbf8b['push'](_0x2b64e1(0x159));_0x2b0d2f['maxContextLength']&&_0x2b0d2f[_0x2b64e1(0x181)]<0x3e8&&_0x1fed50[_0x2b64e1(0x178)](_0x2b64e1(0x19b));if(_0x2b0d2f[_0x2b64e1(0x17e)]!==undefined){if(typeof _0x2b0d2f[_0x2b64e1(0x17e)]!==_0x2b64e1(0x15a))_0x3dbf8b['push']('temperature\x20must\x20be\x20a\x20number');else(_0x2b0d2f[_0x2b64e1(0x17e)]<0x0||_0x2b0d2f[_0x2b64e1(0x17e)]>0x2)&&_0x3dbf8b['push'](_0x2b64e1(0x18a));}return _0x2b0d2f[_0x2b64e1(0x183)]&&typeof _0x2b0d2f['maxTokens']!==_0x2b64e1(0x15a)&&_0x3dbf8b[_0x2b64e1(0x178)](_0x2b64e1(0x18f)),_0x2b0d2f['timeout']&&typeof _0x2b0d2f[_0x2b64e1(0x161)]!=='number'&&_0x3dbf8b['push']('timeout\x20must\x20be\x20a\x20number'),_0x2b0d2f[_0x2b64e1(0x161)]&&_0x2b0d2f[_0x2b64e1(0x161)]<0x3e8&&_0x1fed50['push'](_0x2b64e1(0x171)),_0x2b0d2f['maxRetries']&&typeof _0x2b0d2f['maxRetries']!=='number'&&_0x3dbf8b['push']('maxRetries\x20must\x20be\x20a\x20number'),_0x2b0d2f['enabledTools']&&!Array['isArray'](_0x2b0d2f['enabledTools'])&&_0x3dbf8b['push']('enabledTools\x20must\x20be\x20an\x20array'),{'errors':_0x3dbf8b,'warnings':_0x1fed50};}static['validateCreationParams'](_0x563ff3){const _0x3c35a2=a0_0x1d47,_0xaa048e=[],_0x24e535=[];return(!_0x563ff3['name']||typeof _0x563ff3[_0x3c35a2(0x18c)]!=='string')&&_0xaa048e[_0x3c35a2(0x178)]('Agent\x20name\x20is\x20required\x20and\x20must\x20be\x20a\x20string'),_0x563ff3[_0x3c35a2(0x18c)]&&_0x563ff3[_0x3c35a2(0x18c)]['length']<0x2&&_0xaa048e['push']('Agent\x20name\x20must\x20be\x20at\x20least\x202\x20characters\x20long'),_0x563ff3['type']&&!Object[_0x3c35a2(0x16c)](AGENT_TYPES)[_0x3c35a2(0x174)](_0x563ff3['type'])&&_0xaa048e[_0x3c35a2(0x178)](_0x3c35a2(0x198)+_0x563ff3['type']),_0x563ff3[_0x3c35a2(0x172)]&&!Object[_0x3c35a2(0x16c)](MODELS)[_0x3c35a2(0x174)](_0x563ff3[_0x3c35a2(0x172)])&&_0x24e535[_0x3c35a2(0x178)](_0x3c35a2(0x18e)+_0x563ff3['model']),_0x563ff3[_0x3c35a2(0x190)]&&typeof _0x563ff3['systemPrompt']!=='string'&&_0xaa048e['push'](_0x3c35a2(0x160)),_0x563ff3[_0x3c35a2(0x194)]&&!Array[_0x3c35a2(0x187)](_0x563ff3[_0x3c35a2(0x194)])&&_0xaa048e[_0x3c35a2(0x178)]('enabledTools\x20must\x20be\x20an\x20array'),{'isValid':_0xaa048e['length']===0x0,'errors':_0xaa048e,'warnings':_0x24e535};}static[a0_0x18f347(0x16b)](_0x937ff4){if(typeof _0x937ff4!=='string')return![];const _0xfdc305=new Date(_0x937ff4);return _0xfdc305 instanceof Date&&!isNaN(_0xfdc305['getTime']());}}export class AgentFactory{static[a0_0x18f347(0x18d)](_0x379222){const _0x4759bc=a0_0x18f347,_0xce978f=AgentValidator['validateCreationParams'](_0x379222);if(!_0xce978f['isValid'])throw new Error('Invalid\x20agent\x20parameters:\x20'+_0xce978f[_0x4759bc(0x164)]['join'](',\x20'));const _0x53f2cd=new Date()['toISOString'](),_0x1e16b6=this['generateAgentId']();return{'id':_0x1e16b6,'name':_0x379222[_0x4759bc(0x18c)],'type':_0x379222[_0x4759bc(0x170)]||AGENT_TYPES['USER_CREATED'],'status':AGENT_STATUS[_0x4759bc(0x188)],'currentModel':_0x379222[_0x4759bc(0x172)]||MODELS[_0x4759bc(0x16d)],'systemPrompt':_0x379222[_0x4759bc(0x190)]||'','configuration':this[_0x4759bc(0x17c)](_0x379222['configuration']),'metrics':this['createDefaultMetrics'](),'state':this['createDefaultState'](),'createdAt':_0x53f2cd,'updatedAt':_0x53f2cd,'lastActivity':_0x53f2cd,'pausedUntil':null,'pauseReason':null,'metadata':_0x379222[_0x4759bc(0x16e)]||{}};}static['createDefaultConfiguration'](_0x5cf6e5={}){const _0x5b8fe3=a0_0x18f347;return{'maxContextLength':0xc350,'temperature':0.7,'maxTokens':0x1000,'timeout':0x7530,'persistConversations':!![],'enabledTools':['terminal',_0x5b8fe3(0x168),'editor'],'toolConfigurations':{},'autoRetry':!![],'maxRetries':0x3,'customSettings':{},..._0x5cf6e5};}static['createDefaultMetrics'](){const _0x59bf51=new Date()['toISOString']();return{'totalMessages':0x0,'totalTokensUsed':0x0,'totalCost':0x0,'averageResponseTime':0x0,'successRate':0x1,'errorCount':0x0,'toolExecutions':0x0,'conversationsStarted':0x0,'dailyUsage':{'tokens':0x0,'cost':0x0,'messages':0x0},'weeklyUsage':{'tokens':0x0,'cost':0x0,'messages':0x0},'monthlyUsage':{'tokens':0x0,'cost':0x0,'messages':0x0},'lastMetricsUpdate':_0x59bf51};}static[a0_0x18f347(0x175)](){return{'currentConversationId':null,'messageCount':0x0,'context':{},'activeTools':[],'pendingOperations':{},'cache':{},'isProcessing':![],'lastError':null,'sessionData':{}};}static[a0_0x18f347(0x182)](){const _0x8a521b=a0_0x18f347,_0x2a4661=Date['now']()[_0x8a521b(0x16f)](0x24),_0x27965b=Math['random']()['toString'](0x24)[_0x8a521b(0x169)](0x2,0x9);return'agent_'+_0x2a4661+'_'+_0x27965b;}static[a0_0x18f347(0x196)](_0x112e7a,_0x508788){const _0x39c790=a0_0x18f347,_0xbca210={..._0x112e7a},_0x1fe7a6=new Date()[_0x39c790(0x180)]();return _0xbca210['id']=this['generateAgentId'](),_0xbca210[_0x39c790(0x18c)]=_0x508788,_0xbca210['status']=AGENT_STATUS['IDLE'],_0xbca210['createdAt']=_0x1fe7a6,_0xbca210['updatedAt']=_0x1fe7a6,_0xbca210[_0x39c790(0x192)]=_0x1fe7a6,_0xbca210['pausedUntil']=null,_0xbca210[_0x39c790(0x195)]=null,_0xbca210[_0x39c790(0x19a)]=this[_0x39c790(0x15c)](),_0xbca210[_0x39c790(0x17f)]=this['createDefaultState'](),_0xbca210;}}export class AgentUtils{static[a0_0x18f347(0x19d)](_0x5a808d){const _0x2505cb=a0_0x18f347;return _0x5a808d['status']===AGENT_STATUS[_0x2505cb(0x17d)]||_0x5a808d['status']===AGENT_STATUS['BUSY'];}static['isPaused'](_0x2a951c){const _0x3f0db0=a0_0x18f347;if(_0x2a951c['status']!==AGENT_STATUS[_0x3f0db0(0x189)])return![];if(_0x2a951c[_0x3f0db0(0x199)]){const _0x10b406=new Date(_0x2a951c[_0x3f0db0(0x199)]);return new Date()<_0x10b406;}return!![];}static[a0_0x18f347(0x163)](_0x12c3c4){const _0xd86388=a0_0x18f347;if(_0x12c3c4[_0xd86388(0x177)]===AGENT_STATUS[_0xd86388(0x189)]&&_0x12c3c4['pausedUntil']){const _0x5d5fef=new Date(_0x12c3c4['pausedUntil']);if(new Date()>=_0x5d5fef)return AGENT_STATUS['IDLE'];}return _0x12c3c4['status'];}static[a0_0x18f347(0x191)](_0x26eff5){const _0x1b7367=a0_0x18f347;if(!this['isPaused'](_0x26eff5)||!_0x26eff5[_0x1b7367(0x199)])return null;const _0x541e01=new Date(_0x26eff5[_0x1b7367(0x199)]),_0x13f0b5=new Date();return Math['max'](0x0,_0x541e01[_0x1b7367(0x19e)]()-_0x13f0b5['getTime']());}static['formatForDisplay'](_0x2ecc62){const _0x4064b7=a0_0x18f347;return{'id':_0x2ecc62['id'],'name':_0x2ecc62['name'],'type':_0x2ecc62['type'],'status':this[_0x4064b7(0x163)](_0x2ecc62),'model':_0x2ecc62[_0x4064b7(0x19c)],'messageCount':_0x2ecc62['metrics']['totalMessages'],'lastActivity':_0x2ecc62['lastActivity'],'isPaused':this[_0x4064b7(0x16a)](_0x2ecc62),'timeUntilPauseExpiry':this[_0x4064b7(0x191)](_0x2ecc62)};}static[a0_0x18f347(0x18b)](_0xc614c7){const _0x4fe177=a0_0x18f347,_0x13146c={..._0xc614c7};return delete _0x13146c[_0x4fe177(0x17f)][_0x4fe177(0x15d)],delete _0x13146c['state'][_0x4fe177(0x162)],_0x13146c[_0x4fe177(0x190)]&&_0x13146c['systemPrompt']['length']>0x1f4&&(_0x13146c[_0x4fe177(0x190)]=_0x13146c['systemPrompt'][_0x4fe177(0x173)](0x0,0x1f4)+_0x4fe177(0x185)),_0x13146c;}}export default{'AgentValidator':AgentValidator,'AgentFactory':AgentFactory,'AgentUtils':AgentUtils};function a0_0x4aa8(){const _0x1dc34e=['AxnbCNjHEq','surmrq','uefvu0ve','DgvTCgvYyxr1CMuGBxvZDcbIzsbIzxr3zwvUidaGyw5Kidi','C2fUAxrPEMu','BMfTzq','y3jLyxrL','vw5RBM93BIbbssbTB2rLBdOG','Bwf4vg9Rzw5Zig11C3qGyMuGysbUDw1Izxi','C3LZDgvTuhjVBxb0','z2v0vgLTzvvUDgLSugf1C2vfEhbPCNK','BgfZDefJDgL2Axr5','nta0DMrOt1L4','zw5HyMXLzfrVB2XZ','Cgf1C2vszwfZB24','y2XVBMu','nZy0mdC0nfLyzNDyua','sw52ywXPzcbHz2vUDcb0ExbLoIa','Cgf1C2vKvw50AwW','Bwv0CMLJCW','Bwf4q29UDgv4DeXLBMD0AcbPCYb2zxj5igXVDYaOpdeWmdaP','y3vYCMvUDe1VzgvS','Axnby3rPDMu','z2v0vgLTzq','mtC4mZa0mZbfsuPjANa','Bwf4q29UDgv4DeXLBMD0AcbTDxn0igjLigeGBNvTyMvY','BNvTyMvY','n3nLzePiDq','y3jLyxrLrgvMyxvSDe1LDhjPy3m','y2fJAgu','qwDLBNqGBMfTzsbTDxn0igjLigf0igXLyxn0idiGy2HHCMfJDgvYCYbSB25N','nfnorMjzrG','u3LZDgvTihbYB21WDcbTDxn0igjLigeGC3rYAw5N','DgLTzw91Da','C2vZC2LVBKrHDge','z2v0rwzMzwn0AxzLu3rHDhvZ','zxjYB3jZ','mty2nJe5mgPezeDVsW','C3rYAw5N','otGWodGZmerjBufHqq','zMLSzxn5CW','C3vIC3rY','AxnqyxvZzwq','AxnwywXPzfrPBwvZDgfTCa','DMfSDwvZ','qu5usfjpueLdx1nptK5fva','Bwv0ywrHDge','Dg9tDhjPBMC','DhLWzq','DgLTzw91DcbPCYb2zxj5igXVDYaOpdeWmdbTCYK','Bw9KzwW','C3vIC3rYAw5N','Aw5JBhvKzxm','y3jLyxrLrgvMyxvSDfn0yxrL','BgvUz3rO','C3rHDhvZ','ChvZAa','D2fYBMLUz3m','mJa5mKrOrhvTuG','qwDLBNqGBMfTzsbPCYbYzxf1AxjLzcbHBMqGBxvZDcbIzsbHihn0CMLUzW','y3jLyxrLrgvMyxvSDenVBMzPz3vYyxrPB24','qunusvzf','DgvTCgvYyxr1CMu','C3rHDgu','Dg9ju09tDhjPBMC','Bwf4q29UDgv4DeXLBMD0Aa','z2vUzxjHDgvbz2vUDeLK','Bwf4vg9Rzw5Z','nZC0ntK3uK1MsuL4','lI4U','nte4mJa5ofvsA0rMuq'];a0_0x4aa8=function(){return _0x1dc34e;};return a0_0x4aa8();}
|