claude-flow-novice 2.14.35 → 2.14.37
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/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/.claude/commands/cfn-loop-cli.md +491 -456
- package/.claude/commands/switch-api.md +1 -1
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
- package/.claude/skills/cfn-loop-validation/config.json +2 -2
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
- package/claude-assets/agents/README-AGENT_LIFECYCLE.md +37 -10
- package/claude-assets/agents/README-VALIDATION.md +0 -8
- package/claude-assets/agents/cfn-dev-team/README.md +0 -8
- package/claude-assets/agents/cfn-dev-team/coordinators/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/developers/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +0 -8
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +0 -10
- package/claude-assets/agents/cfn-dev-team/reviewers/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +0 -10
- package/claude-assets/agents/cfn-dev-team/test-agent.md +0 -10
- package/claude-assets/agents/cfn-dev-team/testers/README.md +1 -9
- package/claude-assets/agents/csuite/cto-agent.md +0 -10
- package/claude-assets/agents/custom/cfn-system-expert.md +1 -128
- package/claude-assets/agents/custom/claude-code-expert.md +151 -2
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +39 -3
- package/claude-assets/agents/docker-team/csuite/c-suite-template.md +1 -5
- package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +1 -5
- package/claude-assets/agents/marketing_hybrid/cost_tracker.md +0 -10
- package/claude-assets/agents/marketing_hybrid/docker_deployer.md +0 -10
- package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +0 -10
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/claude-assets/commands/cfn-loop-cli.md +491 -456
- package/claude-assets/commands/switch-api.md +1 -1
- package/claude-assets/skills/cfn-error-logging/SKILL.md +339 -0
- package/claude-assets/skills/cfn-error-logging/cleanup-error-logs.sh +334 -0
- package/claude-assets/skills/cfn-error-logging/integrate-cli.sh +232 -0
- package/claude-assets/skills/cfn-error-logging/integrate-docker.sh +294 -0
- package/claude-assets/skills/cfn-error-logging/invoke-error-logging.sh +839 -0
- package/claude-assets/skills/cfn-error-logging/test-error-logging.sh +475 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
- package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +326 -322
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
- package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +224 -181
- package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +235 -271
- package/dist/agents/agent-loader.js +467 -133
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/hello.js +27 -3
- package/dist/hello.js.map +1 -1
- package/dist/server.js +194 -0
- package/dist/server.js.map +1 -0
- package/dist/server.test.js +207 -0
- package/dist/server.test.js.map +1 -0
- package/package.json +2 -1
- package/scripts/docker-build-mcp.sh +155 -0
- package/scripts/docker-test-mcp.sh +260 -0
- package/scripts/mcp-health-check.sh +123 -0
|
@@ -1,12 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Dynamic Agent Loader - Reads agent definitions from .claude/agents/ directory
|
|
3
4
|
* Single source of truth for agent types in the system
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
*/ var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) {
|
|
7
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
8
|
+
resolve(value);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
12
|
+
function fulfilled(value) {
|
|
13
|
+
try {
|
|
14
|
+
step(generator.next(value));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
reject(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function rejected(value) {
|
|
20
|
+
try {
|
|
21
|
+
step(generator["throw"](value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function step(result) {
|
|
27
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
28
|
+
}
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
33
|
+
var _ = {
|
|
34
|
+
label: 0,
|
|
35
|
+
sent: function() {
|
|
36
|
+
if (t[0] & 1) throw t[1];
|
|
37
|
+
return t[1];
|
|
38
|
+
},
|
|
39
|
+
trys: [],
|
|
40
|
+
ops: []
|
|
41
|
+
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
42
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
43
|
+
return this;
|
|
44
|
+
}), g;
|
|
45
|
+
function verb(n) {
|
|
46
|
+
return function(v) {
|
|
47
|
+
return step([
|
|
48
|
+
n,
|
|
49
|
+
v
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function step(op) {
|
|
54
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
56
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
+
if (y = 0, t) op = [
|
|
58
|
+
op[0] & 2,
|
|
59
|
+
t.value
|
|
60
|
+
];
|
|
61
|
+
switch(op[0]){
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [
|
|
76
|
+
0
|
|
77
|
+
];
|
|
78
|
+
continue;
|
|
79
|
+
case 7:
|
|
80
|
+
op = _.ops.pop();
|
|
81
|
+
_.trys.pop();
|
|
82
|
+
continue;
|
|
83
|
+
default:
|
|
84
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
85
|
+
_ = 0;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
89
|
+
_.label = op[1];
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
93
|
+
_.label = t[1];
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (t && _.label < t[2]) {
|
|
98
|
+
_.label = t[2];
|
|
99
|
+
_.ops.push(op);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
if (t[2]) _.ops.pop();
|
|
103
|
+
_.trys.pop();
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
op = body.call(thisArg, _);
|
|
107
|
+
} catch (e) {
|
|
108
|
+
op = [
|
|
109
|
+
6,
|
|
110
|
+
e
|
|
111
|
+
];
|
|
112
|
+
y = 0;
|
|
113
|
+
} finally{
|
|
114
|
+
f = t = 0;
|
|
115
|
+
}
|
|
116
|
+
if (op[0] & 5) throw op[1];
|
|
117
|
+
return {
|
|
118
|
+
value: op[0] ? op[1] : void 0,
|
|
119
|
+
done: true
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var __spreadArray = this && this.__spreadArray || function(to, from, pack) {
|
|
124
|
+
if (pack || arguments.length === 2) for(var i = 0, l = from.length, ar; i < l; i++){
|
|
125
|
+
if (ar || !(i in from)) {
|
|
126
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
127
|
+
ar[i] = from[i];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
131
|
+
};
|
|
132
|
+
Object.defineProperty(exports, "__esModule", {
|
|
133
|
+
value: true
|
|
134
|
+
});
|
|
135
|
+
exports.refreshAgents = exports.getAgentsByCategory = exports.isValidAgentType = exports.searchAgents = exports.getAgentCategories = exports.getAllAgents = exports.getAgent = exports.getAvailableAgentTypes = exports.agentLoader = exports.AgentLoader = void 0;
|
|
136
|
+
exports.resolveLegacyAgentType = resolveLegacyAgentType;
|
|
137
|
+
var node_fs_1 = require("node:fs");
|
|
138
|
+
var glob_1 = require("glob");
|
|
139
|
+
var node_path_1 = require("node:path");
|
|
140
|
+
var yaml_1 = require("yaml");
|
|
8
141
|
// Legacy agent type mapping for backward compatibility
|
|
9
|
-
|
|
142
|
+
var LEGACY_AGENT_MAPPING = {
|
|
10
143
|
analyst: 'code-analyzer',
|
|
11
144
|
coordinator: 'hierarchical-coordinator',
|
|
12
145
|
optimizer: 'perf-analyzer',
|
|
@@ -17,38 +150,40 @@ const LEGACY_AGENT_MAPPING = {
|
|
|
17
150
|
};
|
|
18
151
|
/**
|
|
19
152
|
* Resolve legacy agent types to current equivalents
|
|
20
|
-
*/
|
|
153
|
+
*/ function resolveLegacyAgentType(legacyType) {
|
|
21
154
|
return LEGACY_AGENT_MAPPING[legacyType] || legacyType;
|
|
22
155
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
156
|
+
var AgentLoader = /** @class */ function() {
|
|
157
|
+
function AgentLoader() {
|
|
158
|
+
this.agentCache = new Map();
|
|
159
|
+
this.categoriesCache = [];
|
|
160
|
+
this.lastLoadTime = 0;
|
|
161
|
+
this.CACHE_EXPIRY = 60000; // 1 minute cache
|
|
162
|
+
}
|
|
163
|
+
AgentLoader.prototype.getAgentsDirectory = function() {
|
|
164
|
+
var currentDir = process.cwd();
|
|
30
165
|
while(currentDir !== '/'){
|
|
31
|
-
|
|
32
|
-
if (existsSync(claudeAgentsPath)) {
|
|
166
|
+
var claudeAgentsPath = (0, node_path_1.resolve)(currentDir, '.claude', 'agents');
|
|
167
|
+
if ((0, node_fs_1.existsSync)(claudeAgentsPath)) {
|
|
33
168
|
return claudeAgentsPath;
|
|
34
169
|
}
|
|
35
|
-
currentDir = dirname(currentDir);
|
|
170
|
+
currentDir = (0, node_path_1.dirname)(currentDir);
|
|
36
171
|
}
|
|
37
|
-
return resolve(process.cwd(), '.claude', 'agents');
|
|
38
|
-
}
|
|
39
|
-
parseAgentFile(filePath) {
|
|
172
|
+
return (0, node_path_1.resolve)(process.cwd(), '.claude', 'agents');
|
|
173
|
+
};
|
|
174
|
+
AgentLoader.prototype.parseAgentFile = function(filePath) {
|
|
40
175
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
176
|
+
var content = (0, node_fs_1.readFileSync)(filePath, 'utf-8');
|
|
177
|
+
var frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
43
178
|
if (!frontmatterMatch) {
|
|
44
|
-
console.warn(
|
|
179
|
+
console.warn("No frontmatter found in ".concat(filePath));
|
|
45
180
|
return null;
|
|
46
181
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
182
|
+
var yamlContent = frontmatterMatch[1], markdownContent = frontmatterMatch[2];
|
|
183
|
+
var frontmatter = (0, yaml_1.parse)(yamlContent);
|
|
184
|
+
var description = frontmatter.description;
|
|
50
185
|
if (!frontmatter.name || !description) {
|
|
51
|
-
console.warn(
|
|
186
|
+
console.warn("Missing required fields (name, description) in ".concat(filePath));
|
|
52
187
|
return null;
|
|
53
188
|
}
|
|
54
189
|
return {
|
|
@@ -69,126 +204,325 @@ export class AgentLoader {
|
|
|
69
204
|
content: markdownContent.trim()
|
|
70
205
|
};
|
|
71
206
|
} catch (error) {
|
|
72
|
-
console.error(
|
|
207
|
+
console.error("Error parsing agent file ".concat(filePath, ":"), error);
|
|
73
208
|
return null;
|
|
74
209
|
}
|
|
75
|
-
}
|
|
76
|
-
parseTools(frontmatter) {
|
|
77
|
-
|
|
210
|
+
};
|
|
211
|
+
AgentLoader.prototype.parseTools = function(frontmatter) {
|
|
212
|
+
var extractTools = function(input) {
|
|
78
213
|
if (Array.isArray(input)) return input.map(String);
|
|
79
214
|
if (typeof input === 'string') {
|
|
80
|
-
return input.split(/[,\s]+/).map((t)
|
|
215
|
+
return input.split(/[,\s]+/).map(function(t) {
|
|
216
|
+
return t.trim();
|
|
217
|
+
}).filter(function(t) {
|
|
218
|
+
return t.length > 0;
|
|
219
|
+
});
|
|
81
220
|
}
|
|
82
221
|
return [];
|
|
83
222
|
};
|
|
84
223
|
// Safely handle tools and capabilities.tools
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
224
|
+
var toolsFromFrontmatter = frontmatter.tools ? extractTools(frontmatter.tools) : [];
|
|
225
|
+
var toolsFromCapabilities = frontmatter.capabilities && typeof frontmatter.capabilities === 'object' ? extractTools(Object(frontmatter.capabilities).tools) : [];
|
|
226
|
+
return __spreadArray(__spreadArray([], toolsFromFrontmatter, true), toolsFromCapabilities, true);
|
|
227
|
+
};
|
|
228
|
+
AgentLoader.prototype.loadAgents = function() {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
230
|
+
var agentsDir, agentFiles, categoryMap, _i, agentFiles_1, filePath, agent, relativePath, pathParts, category;
|
|
231
|
+
return __generator(this, function(_a) {
|
|
232
|
+
switch(_a.label){
|
|
233
|
+
case 0:
|
|
234
|
+
agentsDir = this.getAgentsDirectory();
|
|
235
|
+
if (!(0, node_fs_1.existsSync)(agentsDir)) {
|
|
236
|
+
console.warn("Agents directory not found: ".concat(agentsDir));
|
|
237
|
+
return [
|
|
238
|
+
2 /*return*/
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
return [
|
|
242
|
+
4 /*yield*/ ,
|
|
243
|
+
new Promise(function(resolve, reject) {
|
|
244
|
+
(0, glob_1.glob)('**/*.md', {
|
|
245
|
+
cwd: agentsDir,
|
|
246
|
+
ignore: [
|
|
247
|
+
'**/README.md',
|
|
248
|
+
'**/MIGRATION_SUMMARY.md'
|
|
249
|
+
],
|
|
250
|
+
absolute: true
|
|
251
|
+
}, function(err, matches) {
|
|
252
|
+
if (err) reject(err);
|
|
253
|
+
else resolve(matches);
|
|
254
|
+
});
|
|
255
|
+
})
|
|
256
|
+
];
|
|
257
|
+
case 1:
|
|
258
|
+
agentFiles = _a.sent();
|
|
259
|
+
this.agentCache.clear();
|
|
260
|
+
this.categoriesCache = [];
|
|
261
|
+
categoryMap = new Map();
|
|
262
|
+
for(_i = 0, agentFiles_1 = agentFiles; _i < agentFiles_1.length; _i++){
|
|
263
|
+
filePath = agentFiles_1[_i];
|
|
264
|
+
agent = this.parseAgentFile(filePath);
|
|
265
|
+
if (agent) {
|
|
266
|
+
this.agentCache.set(agent.name, agent);
|
|
267
|
+
relativePath = filePath.replace(agentsDir, '');
|
|
268
|
+
pathParts = relativePath.split('/');
|
|
269
|
+
category = pathParts[1] || 'uncategorized';
|
|
270
|
+
if (!categoryMap.has(category)) {
|
|
271
|
+
categoryMap.set(category, []);
|
|
272
|
+
}
|
|
273
|
+
categoryMap.get(category).push(agent);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
this.categoriesCache = Array.from(categoryMap.entries()).map(function(_a) {
|
|
277
|
+
var name = _a[0], agents = _a[1];
|
|
278
|
+
return {
|
|
279
|
+
name: name,
|
|
280
|
+
agents: agents.sort(function(a, b) {
|
|
281
|
+
return a.name.localeCompare(b.name);
|
|
282
|
+
})
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
this.lastLoadTime = Date.now();
|
|
286
|
+
return [
|
|
287
|
+
2 /*return*/
|
|
288
|
+
];
|
|
289
|
+
}
|
|
109
290
|
});
|
|
110
291
|
});
|
|
111
|
-
|
|
112
|
-
this.categoriesCache = [];
|
|
113
|
-
const categoryMap = new Map();
|
|
114
|
-
for (const filePath of agentFiles){
|
|
115
|
-
const agent = this.parseAgentFile(filePath);
|
|
116
|
-
if (agent) {
|
|
117
|
-
this.agentCache.set(agent.name, agent);
|
|
118
|
-
const relativePath = filePath.replace(agentsDir, '');
|
|
119
|
-
const pathParts = relativePath.split('/');
|
|
120
|
-
const category = pathParts[1] || 'uncategorized';
|
|
121
|
-
if (!categoryMap.has(category)) {
|
|
122
|
-
categoryMap.set(category, []);
|
|
123
|
-
}
|
|
124
|
-
categoryMap.get(category).push(agent);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
this.categoriesCache = Array.from(categoryMap.entries()).map(([name, agents])=>({
|
|
128
|
-
name,
|
|
129
|
-
agents: agents.sort((a, b)=>a.name.localeCompare(b.name))
|
|
130
|
-
}));
|
|
131
|
-
this.lastLoadTime = Date.now();
|
|
132
|
-
}
|
|
292
|
+
};
|
|
133
293
|
// Rest of the methods remain similar to the original implementation
|
|
134
|
-
needsRefresh() {
|
|
294
|
+
AgentLoader.prototype.needsRefresh = function() {
|
|
135
295
|
return Date.now() - this.lastLoadTime > this.CACHE_EXPIRY;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
296
|
+
};
|
|
297
|
+
AgentLoader.prototype.ensureLoaded = function() {
|
|
298
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
299
|
+
return __generator(this, function(_a) {
|
|
300
|
+
switch(_a.label){
|
|
301
|
+
case 0:
|
|
302
|
+
if (!(this.agentCache.size === 0 || this.needsRefresh())) return [
|
|
303
|
+
3 /*break*/ ,
|
|
304
|
+
2
|
|
305
|
+
];
|
|
306
|
+
return [
|
|
307
|
+
4 /*yield*/ ,
|
|
308
|
+
this.loadAgents()
|
|
309
|
+
];
|
|
310
|
+
case 1:
|
|
311
|
+
_a.sent();
|
|
312
|
+
_a.label = 2;
|
|
313
|
+
case 2:
|
|
314
|
+
return [
|
|
315
|
+
2 /*return*/
|
|
316
|
+
];
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
AgentLoader.prototype.getAvailableAgentTypes = function() {
|
|
322
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
323
|
+
var currentTypes, legacyTypes;
|
|
324
|
+
return __generator(this, function(_a) {
|
|
325
|
+
switch(_a.label){
|
|
326
|
+
case 0:
|
|
327
|
+
return [
|
|
328
|
+
4 /*yield*/ ,
|
|
329
|
+
this.ensureLoaded()
|
|
330
|
+
];
|
|
331
|
+
case 1:
|
|
332
|
+
_a.sent();
|
|
333
|
+
currentTypes = Array.from(this.agentCache.keys());
|
|
334
|
+
legacyTypes = Object.keys(LEGACY_AGENT_MAPPING);
|
|
335
|
+
return [
|
|
336
|
+
2 /*return*/ ,
|
|
337
|
+
Array.from(new Set(__spreadArray(__spreadArray([], currentTypes, true), legacyTypes, true))).sort()
|
|
338
|
+
];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
AgentLoader.prototype.getAgent = function(name) {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
345
|
+
return __generator(this, function(_a) {
|
|
346
|
+
switch(_a.label){
|
|
347
|
+
case 0:
|
|
348
|
+
return [
|
|
349
|
+
4 /*yield*/ ,
|
|
350
|
+
this.ensureLoaded()
|
|
351
|
+
];
|
|
352
|
+
case 1:
|
|
353
|
+
_a.sent();
|
|
354
|
+
return [
|
|
355
|
+
2 /*return*/ ,
|
|
356
|
+
this.agentCache.get(name) || this.agentCache.get(resolveLegacyAgentType(name)) || null
|
|
357
|
+
];
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
AgentLoader.prototype.getAllAgents = function() {
|
|
363
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
364
|
+
return __generator(this, function(_a) {
|
|
365
|
+
switch(_a.label){
|
|
366
|
+
case 0:
|
|
367
|
+
return [
|
|
368
|
+
4 /*yield*/ ,
|
|
369
|
+
this.ensureLoaded()
|
|
370
|
+
];
|
|
371
|
+
case 1:
|
|
372
|
+
_a.sent();
|
|
373
|
+
return [
|
|
374
|
+
2 /*return*/ ,
|
|
375
|
+
Array.from(this.agentCache.values()).sort(function(a, b) {
|
|
376
|
+
return a.name.localeCompare(b.name);
|
|
377
|
+
})
|
|
378
|
+
];
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
AgentLoader.prototype.getAgentCategories = function() {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
385
|
+
return __generator(this, function(_a) {
|
|
386
|
+
switch(_a.label){
|
|
387
|
+
case 0:
|
|
388
|
+
return [
|
|
389
|
+
4 /*yield*/ ,
|
|
390
|
+
this.ensureLoaded()
|
|
391
|
+
];
|
|
392
|
+
case 1:
|
|
393
|
+
_a.sent();
|
|
394
|
+
return [
|
|
395
|
+
2 /*return*/ ,
|
|
396
|
+
this.categoriesCache
|
|
397
|
+
];
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
AgentLoader.prototype.searchAgents = function(query) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
404
|
+
var lowerQuery;
|
|
405
|
+
return __generator(this, function(_a) {
|
|
406
|
+
switch(_a.label){
|
|
407
|
+
case 0:
|
|
408
|
+
return [
|
|
409
|
+
4 /*yield*/ ,
|
|
410
|
+
this.ensureLoaded()
|
|
411
|
+
];
|
|
412
|
+
case 1:
|
|
413
|
+
_a.sent();
|
|
414
|
+
lowerQuery = query.toLowerCase();
|
|
415
|
+
return [
|
|
416
|
+
2 /*return*/ ,
|
|
417
|
+
Array.from(this.agentCache.values()).filter(function(agent) {
|
|
418
|
+
var _a;
|
|
419
|
+
return agent.name.toLowerCase().includes(lowerQuery) || agent.description.toLowerCase().includes(lowerQuery) || ((_a = agent.capabilities) === null || _a === void 0 ? void 0 : _a.some(function(cap) {
|
|
420
|
+
return cap.toLowerCase().includes(lowerQuery);
|
|
421
|
+
}));
|
|
422
|
+
})
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
};
|
|
428
|
+
AgentLoader.prototype.isValidAgentType = function(name) {
|
|
429
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
430
|
+
return __generator(this, function(_a) {
|
|
431
|
+
switch(_a.label){
|
|
432
|
+
case 0:
|
|
433
|
+
return [
|
|
434
|
+
4 /*yield*/ ,
|
|
435
|
+
this.ensureLoaded()
|
|
436
|
+
];
|
|
437
|
+
case 1:
|
|
438
|
+
_a.sent();
|
|
439
|
+
return [
|
|
440
|
+
2 /*return*/ ,
|
|
441
|
+
this.agentCache.has(name) || this.agentCache.has(resolveLegacyAgentType(name))
|
|
442
|
+
];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
AgentLoader.prototype.getAgentsByCategory = function(category) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
449
|
+
var categories, found;
|
|
450
|
+
return __generator(this, function(_a) {
|
|
451
|
+
switch(_a.label){
|
|
452
|
+
case 0:
|
|
453
|
+
return [
|
|
454
|
+
4 /*yield*/ ,
|
|
455
|
+
this.getAgentCategories()
|
|
456
|
+
];
|
|
457
|
+
case 1:
|
|
458
|
+
categories = _a.sent();
|
|
459
|
+
found = categories.find(function(cat) {
|
|
460
|
+
return cat.name === category;
|
|
461
|
+
});
|
|
462
|
+
return [
|
|
463
|
+
2 /*return*/ ,
|
|
464
|
+
(found === null || found === void 0 ? void 0 : found.agents) || []
|
|
465
|
+
];
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
AgentLoader.prototype.refresh = function() {
|
|
471
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
472
|
+
return __generator(this, function(_a) {
|
|
473
|
+
switch(_a.label){
|
|
474
|
+
case 0:
|
|
475
|
+
this.lastLoadTime = 0;
|
|
476
|
+
return [
|
|
477
|
+
4 /*yield*/ ,
|
|
478
|
+
this.loadAgents()
|
|
479
|
+
];
|
|
480
|
+
case 1:
|
|
481
|
+
_a.sent();
|
|
482
|
+
return [
|
|
483
|
+
2 /*return*/
|
|
484
|
+
];
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
return AgentLoader;
|
|
490
|
+
}();
|
|
491
|
+
exports.AgentLoader = AgentLoader;
|
|
182
492
|
// Singleton instance
|
|
183
|
-
|
|
493
|
+
exports.agentLoader = new AgentLoader();
|
|
184
494
|
// Convenience exports for use in other modules
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
495
|
+
var getAvailableAgentTypes = function() {
|
|
496
|
+
return exports.agentLoader.getAvailableAgentTypes();
|
|
497
|
+
};
|
|
498
|
+
exports.getAvailableAgentTypes = getAvailableAgentTypes;
|
|
499
|
+
var getAgent = function(name) {
|
|
500
|
+
return exports.agentLoader.getAgent(name);
|
|
501
|
+
};
|
|
502
|
+
exports.getAgent = getAgent;
|
|
503
|
+
var getAllAgents = function() {
|
|
504
|
+
return exports.agentLoader.getAllAgents();
|
|
505
|
+
};
|
|
506
|
+
exports.getAllAgents = getAllAgents;
|
|
507
|
+
var getAgentCategories = function() {
|
|
508
|
+
return exports.agentLoader.getAgentCategories();
|
|
509
|
+
};
|
|
510
|
+
exports.getAgentCategories = getAgentCategories;
|
|
511
|
+
var searchAgents = function(query) {
|
|
512
|
+
return exports.agentLoader.searchAgents(query);
|
|
513
|
+
};
|
|
514
|
+
exports.searchAgents = searchAgents;
|
|
515
|
+
var isValidAgentType = function(name) {
|
|
516
|
+
return exports.agentLoader.isValidAgentType(name);
|
|
517
|
+
};
|
|
518
|
+
exports.isValidAgentType = isValidAgentType;
|
|
519
|
+
var getAgentsByCategory = function(category) {
|
|
520
|
+
return exports.agentLoader.getAgentsByCategory(category);
|
|
521
|
+
};
|
|
522
|
+
exports.getAgentsByCategory = getAgentsByCategory;
|
|
523
|
+
var refreshAgents = function() {
|
|
524
|
+
return exports.agentLoader.refresh();
|
|
525
|
+
};
|
|
526
|
+
exports.refreshAgents = refreshAgents;
|
|
193
527
|
|
|
194
528
|
//# sourceMappingURL=agent-loader.js.map
|