@a5c-ai/agent-catalog 5.0.1-staging.c9bb2c61
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 +117 -0
- package/dist/assets.d.ts +4 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +76 -0
- package/dist/cli.d.ts +168 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +336 -0
- package/dist/data.d.ts +54 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +636 -0
- package/dist/discovery-snapshot.json +319345 -0
- package/dist/discovery.d.ts +143 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +728 -0
- package/dist/evidence-projection.d.ts +4 -0
- package/dist/evidence-projection.d.ts.map +1 -0
- package/dist/evidence-projection.js +34 -0
- package/dist/evidence.d.ts +13 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +227 -0
- package/dist/graph.d.ts +20 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +194 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/models.d.ts +559 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/sdk.d.ts +48 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +902 -0
- package/dist/transport-mux-cutover.d.ts +9 -0
- package/dist/transport-mux-cutover.d.ts.map +1 -0
- package/dist/transport-mux-cutover.js +158 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +8 -0
- package/docs/ontology-evidence.md +82 -0
- package/evidence/ontology-evidence/claims/catalog-processes-and-packaging.json +89 -0
- package/evidence/ontology-evidence/claims/plugins-hooks-discovery.json +136 -0
- package/evidence/ontology-evidence/claims/runtime-core.json +113 -0
- package/evidence/ontology-evidence/claims/vendor-web.json +977 -0
- package/evidence/ontology-evidence/evidence-sources/catalog-processes-and-packaging.json +48 -0
- package/evidence/ontology-evidence/evidence-sources/plugins-hooks-discovery.json +88 -0
- package/evidence/ontology-evidence/evidence-sources/runtime-core.json +78 -0
- package/evidence/ontology-evidence/evidence-sources/vendor-web.json +918 -0
- package/evidence/ontology-evidence/manifest.json +56 -0
- package/graph/agent-catalog.graph.yaml +43 -0
- package/graph/edges/relations/agent-runtime/babysitter-agent.yaml +31 -0
- package/graph/edges/relations/agent-runtime/discovery-and-paths.yaml +433 -0
- package/graph/edges/relations/agent-runtime/session-and-lifecycle.yaml +137 -0
- package/graph/edges/relations/agent-runtime/transports-and-modalities.yaml +387 -0
- package/graph/edges/relations/capabilities/babysitter-agent-links.yaml +46 -0
- package/graph/edges/relations/capabilities/capability-vocabulary-links-agents.yaml +478 -0
- package/graph/edges/relations/capabilities/capability-vocabulary-links-providers.yaml +40 -0
- package/graph/edges/relations/capabilities/capability-vocabulary-links-transports.yaml +70 -0
- package/graph/edges/relations/capabilities/support-record-links-agents.yaml +478 -0
- package/graph/edges/relations/capabilities/support-record-links-providers.yaml +40 -0
- package/graph/edges/relations/capabilities/support-record-links-transports.yaml +70 -0
- package/graph/edges/relations/evolution.yaml +16 -0
- package/graph/edges/relations/hooks-and-plugins.yaml +462 -0
- package/graph/edges/relations/identity-babysitter-agent.yaml +11 -0
- package/graph/edges/relations/identity.yaml +218 -0
- package/graph/edges/relations/processes-and-packages.yaml +71 -0
- package/graph/edges/relations/provenance/babysitter-agent-and-claude-web.yaml +102 -0
- package/graph/edges/relations/provenance/catalog-core-agents.yaml +370 -0
- package/graph/edges/relations/provenance/catalog-core-models.yaml +88 -0
- package/graph/edges/relations/provenance/catalog-core-providers.yaml +220 -0
- package/graph/edges/relations/provenance/evidence-sources.yaml +136 -0
- package/graph/edges/relations/provenance/hooks-plugins-and-discovery-discovery.yaml +124 -0
- package/graph/edges/relations/provenance/hooks-plugins-and-discovery-hooks.yaml +244 -0
- package/graph/edges/relations/provenance/hooks-plugins-and-discovery-plugins.yaml +166 -0
- package/graph/edges/relations/provenance/processes-packages-and-paths.yaml +490 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capability.yaml +202 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-claude.yaml +210 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-codex.yaml +302 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-copilot.yaml +170 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-cursor.yaml +146 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-gemini.yaml +143 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-omp.yaml +76 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-openclaw.yaml +112 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-opencode.yaml +139 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-agents-pi.yaml +40 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-providers.yaml +112 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-capabilitySupport-transports.yaml +190 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-modality.yaml +88 -0
- package/graph/edges/relations/provenance/runtime-and-capabilities-transport.yaml +172 -0
- package/graph/nodes/agents/babysitter-agent.yaml +43 -0
- package/graph/nodes/agents/products.yaml +163 -0
- package/graph/nodes/agents/versions.yaml +282 -0
- package/graph/nodes/capabilities/capabilities.yaml +234 -0
- package/graph/nodes/capabilities/modalities.yaml +74 -0
- package/graph/nodes/capabilities/supports/agents/babysitter-agent.yaml +46 -0
- package/graph/nodes/capabilities/supports/agents/claude.yaml +166 -0
- package/graph/nodes/capabilities/supports/agents/codex.yaml +190 -0
- package/graph/nodes/capabilities/supports/agents/copilot.yaml +121 -0
- package/graph/nodes/capabilities/supports/agents/cursor.yaml +104 -0
- package/graph/nodes/capabilities/supports/agents/gemini.yaml +104 -0
- package/graph/nodes/capabilities/supports/agents/omp.yaml +74 -0
- package/graph/nodes/capabilities/supports/agents/openclaw.yaml +67 -0
- package/graph/nodes/capabilities/supports/agents/opencode.yaml +103 -0
- package/graph/nodes/capabilities/supports/agents/pi.yaml +65 -0
- package/graph/nodes/capabilities/supports/provider-versions.yaml +73 -0
- package/graph/nodes/capabilities/supports/transport-runtimes.yaml +122 -0
- package/graph/nodes/evidence/babysitter-agent-and-claude-web.yaml +83 -0
- package/graph/nodes/evidence/claims.yaml +315 -0
- package/graph/nodes/evidence/claude-code-capability-claims.yaml +170 -0
- package/graph/nodes/evidence/claude-code-docs-core.yaml +103 -0
- package/graph/nodes/evidence/claude-code-docs-extensions.yaml +114 -0
- package/graph/nodes/evidence/codex-web.yaml +155 -0
- package/graph/nodes/evidence/copilot-web.yaml +213 -0
- package/graph/nodes/evidence/cursor-web.yaml +191 -0
- package/graph/nodes/evidence/evidence-sources.yaml +206 -0
- package/graph/nodes/evidence/gemini-cli-web.yaml +177 -0
- package/graph/nodes/evidence/omp-web.yaml +129 -0
- package/graph/nodes/evidence/opencode-web.yaml +144 -0
- package/graph/nodes/hooks-and-plugins/hook-mappings.yaml +399 -0
- package/graph/nodes/hooks-and-plugins/hook-surfaces.yaml +160 -0
- package/graph/nodes/hooks-and-plugins/plugin-artifacts.yaml +229 -0
- package/graph/nodes/hooks-and-plugins/plugin-targets.yaml +330 -0
- package/graph/nodes/models.yaml +103 -0
- package/graph/nodes/processes-and-packages/ci-surfaces.yaml +45 -0
- package/graph/nodes/processes-and-packages/packages.yaml +89 -0
- package/graph/nodes/processes-and-packages/processes.yaml +44 -0
- package/graph/nodes/providers/products.yaml +102 -0
- package/graph/nodes/providers/versions.yaml +108 -0
- package/graph/nodes/runtime-semantics/discovery-signals-hooks.yaml +185 -0
- package/graph/nodes/runtime-semantics/discovery-signals-host.yaml +254 -0
- package/graph/nodes/runtime-semantics/lifecycle-semantics.yaml +151 -0
- package/graph/nodes/runtime-semantics/paths.yaml +289 -0
- package/graph/nodes/runtime-semantics/session-semantics.yaml +214 -0
- package/graph/nodes/transports.yaml +202 -0
- package/graph/schema/ontology-schema.yaml +529 -0
- package/package.json +65 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.clearCatalogDiscoveryCache = clearCatalogDiscoveryCache;
|
|
7
|
+
exports.getCatalogDiscoverySnapshot = getCatalogDiscoverySnapshot;
|
|
8
|
+
exports.refreshCatalogDiscoverySnapshot = refreshCatalogDiscoverySnapshot;
|
|
9
|
+
exports.listCatalogProcesses = listCatalogProcesses;
|
|
10
|
+
exports.getCatalogProcessById = getCatalogProcessById;
|
|
11
|
+
exports.listCatalogSkills = listCatalogSkills;
|
|
12
|
+
exports.getCatalogSkillBySlug = getCatalogSkillBySlug;
|
|
13
|
+
exports.listCatalogAgents = listCatalogAgents;
|
|
14
|
+
exports.listCatalogDomains = listCatalogDomains;
|
|
15
|
+
exports.getCatalogDomainByName = getCatalogDomainByName;
|
|
16
|
+
exports.listCatalogSpecializations = listCatalogSpecializations;
|
|
17
|
+
exports.getCatalogSpecializationByName = getCatalogSpecializationByName;
|
|
18
|
+
exports.searchCatalogDiscovery = searchCatalogDiscovery;
|
|
19
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
20
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
21
|
+
const yaml_1 = require("yaml");
|
|
22
|
+
const PROCESS_EXTENSIONS = new Set([".js", ".mjs", ".ts"]);
|
|
23
|
+
let cachedSnapshot;
|
|
24
|
+
function clone(value) {
|
|
25
|
+
return JSON.parse(JSON.stringify(value));
|
|
26
|
+
}
|
|
27
|
+
function packageRoot() {
|
|
28
|
+
return node_path_1.default.resolve(__dirname, "..");
|
|
29
|
+
}
|
|
30
|
+
function repoRoot() {
|
|
31
|
+
return node_path_1.default.resolve(packageRoot(), "..", "..");
|
|
32
|
+
}
|
|
33
|
+
function libraryRoot() {
|
|
34
|
+
return node_path_1.default.join(repoRoot(), "library");
|
|
35
|
+
}
|
|
36
|
+
function packagedSnapshotPath() {
|
|
37
|
+
return node_path_1.default.join(packageRoot(), "dist", "discovery-snapshot.json");
|
|
38
|
+
}
|
|
39
|
+
function normalizePath(value) {
|
|
40
|
+
return value.replace(/\\/g, "/");
|
|
41
|
+
}
|
|
42
|
+
function toRepoRelative(filePath) {
|
|
43
|
+
return normalizePath(node_path_1.default.relative(repoRoot(), filePath));
|
|
44
|
+
}
|
|
45
|
+
function toLibraryRelative(filePath) {
|
|
46
|
+
return normalizePath(node_path_1.default.relative(libraryRoot(), filePath));
|
|
47
|
+
}
|
|
48
|
+
function readDirNames(dirPath) {
|
|
49
|
+
try {
|
|
50
|
+
return node_fs_1.default.readdirSync(dirPath);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function safeStat(filePath) {
|
|
57
|
+
try {
|
|
58
|
+
return node_fs_1.default.statSync(filePath);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function isoTimestamp(value) {
|
|
65
|
+
if (!value || Number.isNaN(value.getTime())) {
|
|
66
|
+
return new Date(0).toISOString();
|
|
67
|
+
}
|
|
68
|
+
return value.toISOString();
|
|
69
|
+
}
|
|
70
|
+
function createdAtFor(stats) {
|
|
71
|
+
const birthtime = stats?.birthtime;
|
|
72
|
+
if (birthtime && !Number.isNaN(birthtime.getTime()) && birthtime.getTime() > 0) {
|
|
73
|
+
return birthtime.toISOString();
|
|
74
|
+
}
|
|
75
|
+
return isoTimestamp(stats?.mtime);
|
|
76
|
+
}
|
|
77
|
+
function updatedAtFor(stats) {
|
|
78
|
+
return isoTimestamp(stats?.mtime);
|
|
79
|
+
}
|
|
80
|
+
function fileSize(filePath) {
|
|
81
|
+
return safeStat(filePath)?.size ?? 0;
|
|
82
|
+
}
|
|
83
|
+
function readFile(filePath) {
|
|
84
|
+
return node_fs_1.default.readFileSync(filePath, "utf8");
|
|
85
|
+
}
|
|
86
|
+
function isDirectory(filePath) {
|
|
87
|
+
return safeStat(filePath)?.isDirectory() ?? false;
|
|
88
|
+
}
|
|
89
|
+
function listFilesRecursively(dirPath, predicate) {
|
|
90
|
+
const results = [];
|
|
91
|
+
const walk = (currentPath) => {
|
|
92
|
+
for (const entry of readDirNames(currentPath)) {
|
|
93
|
+
if (entry.startsWith(".")) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const entryPath = node_path_1.default.join(currentPath, entry);
|
|
97
|
+
if (isDirectory(entryPath)) {
|
|
98
|
+
walk(entryPath);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (predicate(entryPath)) {
|
|
102
|
+
results.push(entryPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
walk(dirPath);
|
|
107
|
+
return results.sort((left, right) => normalizePath(left).localeCompare(normalizePath(right)));
|
|
108
|
+
}
|
|
109
|
+
function fileExists(filePath) {
|
|
110
|
+
return safeStat(filePath)?.isFile() ?? false;
|
|
111
|
+
}
|
|
112
|
+
function parseFrontmatter(content) {
|
|
113
|
+
const match = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---\s*\r?\n?/);
|
|
114
|
+
if (!match) {
|
|
115
|
+
return { frontmatter: {}, content };
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const frontmatter = (0, yaml_1.parse)(match[1] ?? "");
|
|
119
|
+
return {
|
|
120
|
+
frontmatter: frontmatter && typeof frontmatter === "object" ? frontmatter : {},
|
|
121
|
+
content: content.slice(match[0].length),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return { frontmatter: {}, content: content.slice(match[0].length) };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function firstMarkdownParagraph(content) {
|
|
129
|
+
const lines = content
|
|
130
|
+
.split(/\r?\n/)
|
|
131
|
+
.map((line) => line.trim())
|
|
132
|
+
.filter((line) => line.length > 0 && !line.startsWith("#") && !line.startsWith("```"));
|
|
133
|
+
return lines[0] ?? "";
|
|
134
|
+
}
|
|
135
|
+
function stringValue(value) {
|
|
136
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
137
|
+
}
|
|
138
|
+
function stringArray(value) {
|
|
139
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.length > 0) : [];
|
|
140
|
+
}
|
|
141
|
+
function asRecord(value) {
|
|
142
|
+
return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {};
|
|
143
|
+
}
|
|
144
|
+
function extractDomainFromPath(filePath) {
|
|
145
|
+
const normalized = normalizePath(filePath);
|
|
146
|
+
const match = normalized.match(/\/specializations\/domains\/([^/]+)/);
|
|
147
|
+
return match?.[1] ?? null;
|
|
148
|
+
}
|
|
149
|
+
function extractSpecializationFromPath(filePath) {
|
|
150
|
+
const normalized = normalizePath(filePath);
|
|
151
|
+
const domainMatch = normalized.match(/\/specializations\/domains\/[^/]+\/([^/]+)/);
|
|
152
|
+
if (domainMatch?.[1] && domainMatch[1] !== "agents" && domainMatch[1] !== "skills") {
|
|
153
|
+
return domainMatch[1];
|
|
154
|
+
}
|
|
155
|
+
const specMatch = normalized.match(/\/specializations\/([^/]+)/);
|
|
156
|
+
if (specMatch?.[1] && specMatch[1] !== "domains") {
|
|
157
|
+
return specMatch[1];
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
function parseMarkdownEntity(filePath) {
|
|
162
|
+
const raw = readFile(filePath);
|
|
163
|
+
const parsed = parseFrontmatter(raw);
|
|
164
|
+
const metadata = asRecord(parsed.frontmatter.metadata);
|
|
165
|
+
const name = stringValue(parsed.frontmatter.name) ?? node_path_1.default.basename(node_path_1.default.dirname(filePath));
|
|
166
|
+
const description = stringValue(parsed.frontmatter.description) ??
|
|
167
|
+
firstMarkdownParagraph(parsed.content) ??
|
|
168
|
+
"";
|
|
169
|
+
return {
|
|
170
|
+
name,
|
|
171
|
+
description,
|
|
172
|
+
content: parsed.content,
|
|
173
|
+
frontmatter: parsed.frontmatter,
|
|
174
|
+
metadata,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function findPrimaryDocPaths(baseDir) {
|
|
178
|
+
const readmePath = node_path_1.default.join(baseDir, "README.md");
|
|
179
|
+
const referencesPath = node_path_1.default.join(baseDir, "references.md");
|
|
180
|
+
return {
|
|
181
|
+
readmePath: node_fs_1.default.existsSync(readmePath) ? toRepoRelative(readmePath) : null,
|
|
182
|
+
referencesPath: node_fs_1.default.existsSync(referencesPath) ? toRepoRelative(referencesPath) : null,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function parseProcessIo(definition, includeRequired) {
|
|
186
|
+
if (!definition) {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
const cleaned = definition.trim();
|
|
190
|
+
if (!cleaned.startsWith("{") || !cleaned.endsWith("}")) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
const body = cleaned.slice(1, -1).trim();
|
|
194
|
+
if (!body) {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
const result = [];
|
|
198
|
+
let current = "";
|
|
199
|
+
let depth = 0;
|
|
200
|
+
for (const char of body) {
|
|
201
|
+
if (char === "{" || char === "[" || char === "(") {
|
|
202
|
+
depth += 1;
|
|
203
|
+
current += char;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (char === "}" || char === "]" || char === ")") {
|
|
207
|
+
depth -= 1;
|
|
208
|
+
current += char;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (char === "," && depth === 0) {
|
|
212
|
+
const entry = current.trim();
|
|
213
|
+
if (entry) {
|
|
214
|
+
const colonIndex = entry.indexOf(":");
|
|
215
|
+
if (colonIndex > 0) {
|
|
216
|
+
let name = entry.slice(0, colonIndex).trim();
|
|
217
|
+
const type = entry.slice(colonIndex + 1).trim();
|
|
218
|
+
const required = !name.endsWith("?");
|
|
219
|
+
if (!required) {
|
|
220
|
+
name = name.slice(0, -1);
|
|
221
|
+
}
|
|
222
|
+
result.push(includeRequired ? { name, type, required } : { name, type });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
current = "";
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
current += char;
|
|
229
|
+
}
|
|
230
|
+
const trailing = current.trim();
|
|
231
|
+
if (trailing) {
|
|
232
|
+
const colonIndex = trailing.indexOf(":");
|
|
233
|
+
if (colonIndex > 0) {
|
|
234
|
+
let name = trailing.slice(0, colonIndex).trim();
|
|
235
|
+
const type = trailing.slice(colonIndex + 1).trim();
|
|
236
|
+
const required = !name.endsWith("?");
|
|
237
|
+
if (!required) {
|
|
238
|
+
name = name.slice(0, -1);
|
|
239
|
+
}
|
|
240
|
+
result.push(includeRequired ? { name, type, required } : { name, type });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
function parseProcessFile(filePath) {
|
|
246
|
+
const content = readFile(filePath);
|
|
247
|
+
const jsdocMatch = content.match(/\/\*\*[\s\S]*?\*\//);
|
|
248
|
+
if (!jsdocMatch) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
const jsdoc = jsdocMatch[0]
|
|
252
|
+
.replace(/\/\*\*/, "")
|
|
253
|
+
.replace(/\*\//, "")
|
|
254
|
+
.split(/\r?\n/)
|
|
255
|
+
.map((line) => line.replace(/^\s*\*\s?/, ""))
|
|
256
|
+
.join("\n");
|
|
257
|
+
const processId = jsdoc.match(/@process\s+([^\n]+)/)?.[1]?.trim();
|
|
258
|
+
if (!processId) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
const description = jsdoc.match(/@description\s+([\s\S]*?)(?=@\w|$)/)?.[1]?.trim() ?? "";
|
|
262
|
+
const rawInputs = jsdoc.match(/@inputs\s+(\{[\s\S]*?\})/)?.[1];
|
|
263
|
+
const rawOutputs = jsdoc.match(/@outputs\s+(\{[\s\S]*?\})/)?.[1];
|
|
264
|
+
const taskMatches = Array.from(content.matchAll(/defineTask\(\s*["'`]([^"'`]+)["'`]/g));
|
|
265
|
+
const tasks = taskMatches.map((match) => {
|
|
266
|
+
const taskId = match[1] ?? "task";
|
|
267
|
+
const window = content.slice(match.index ?? 0, (match.index ?? 0) + 400);
|
|
268
|
+
const taskType = window.match(/kind:\s*["'`]([^"'`]+)["'`]/)?.[1] ?? "task";
|
|
269
|
+
return { id: taskId, type: taskType };
|
|
270
|
+
});
|
|
271
|
+
const frontmatter = {};
|
|
272
|
+
const version = jsdoc.match(/@version\s+([^\n]+)/)?.[1]?.trim();
|
|
273
|
+
const since = jsdoc.match(/@since\s+([^\n]+)/)?.[1]?.trim();
|
|
274
|
+
const author = jsdoc.match(/@author\s+([^\n]+)/)?.[1]?.trim();
|
|
275
|
+
if (author)
|
|
276
|
+
frontmatter.author = author;
|
|
277
|
+
if (version)
|
|
278
|
+
frontmatter.version = version;
|
|
279
|
+
if (since)
|
|
280
|
+
frontmatter.since = since;
|
|
281
|
+
const category = processId.includes("/")
|
|
282
|
+
? processId.split("/")[0] ?? null
|
|
283
|
+
: extractSpecializationFromPath(filePath) ?? extractDomainFromPath(filePath);
|
|
284
|
+
return {
|
|
285
|
+
processId,
|
|
286
|
+
description,
|
|
287
|
+
category,
|
|
288
|
+
filePath: toRepoRelative(filePath),
|
|
289
|
+
inputs: parseProcessIo(rawInputs, true),
|
|
290
|
+
outputs: parseProcessIo(rawOutputs, false),
|
|
291
|
+
tasks,
|
|
292
|
+
frontmatter,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function catalogSkillSlugFor(filePath) {
|
|
296
|
+
return toLibraryRelative(node_path_1.default.dirname(filePath)).replace(/\//g, "--");
|
|
297
|
+
}
|
|
298
|
+
function parseSkillFile(filePath) {
|
|
299
|
+
const parsed = parseMarkdownEntity(filePath);
|
|
300
|
+
const stats = safeStat(filePath);
|
|
301
|
+
const domainName = stringValue(parsed.metadata.domain) ?? extractDomainFromPath(filePath);
|
|
302
|
+
const specializationName = stringValue(parsed.metadata.specialization) ?? extractSpecializationFromPath(filePath);
|
|
303
|
+
return {
|
|
304
|
+
slug: catalogSkillSlugFor(filePath),
|
|
305
|
+
name: parsed.name,
|
|
306
|
+
description: parsed.description,
|
|
307
|
+
filePath: toRepoRelative(filePath),
|
|
308
|
+
directory: toRepoRelative(node_path_1.default.dirname(filePath)),
|
|
309
|
+
specializationName,
|
|
310
|
+
domainName,
|
|
311
|
+
allowedTools: stringArray(parsed.frontmatter["allowed-tools"]),
|
|
312
|
+
createdAt: createdAtFor(stats),
|
|
313
|
+
updatedAt: updatedAtFor(stats),
|
|
314
|
+
content: parsed.content,
|
|
315
|
+
frontmatter: parsed.frontmatter,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function parseAgentFile(filePath) {
|
|
319
|
+
const parsed = parseMarkdownEntity(filePath);
|
|
320
|
+
const stats = safeStat(filePath);
|
|
321
|
+
const domainName = stringValue(parsed.metadata.domain) ?? extractDomainFromPath(filePath);
|
|
322
|
+
const specializationName = stringValue(parsed.metadata.specialization) ?? extractSpecializationFromPath(filePath);
|
|
323
|
+
return {
|
|
324
|
+
name: parsed.name,
|
|
325
|
+
description: parsed.description,
|
|
326
|
+
filePath: toRepoRelative(filePath),
|
|
327
|
+
directory: toRepoRelative(node_path_1.default.dirname(filePath)),
|
|
328
|
+
role: stringValue(parsed.frontmatter.role) ?? null,
|
|
329
|
+
expertise: stringArray(parsed.frontmatter.expertise),
|
|
330
|
+
specializationName,
|
|
331
|
+
domainName,
|
|
332
|
+
createdAt: createdAtFor(stats),
|
|
333
|
+
updatedAt: updatedAtFor(stats),
|
|
334
|
+
content: parsed.content,
|
|
335
|
+
frontmatter: parsed.frontmatter,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function assignStableIds(items, keyFor) {
|
|
339
|
+
return items
|
|
340
|
+
.slice()
|
|
341
|
+
.sort((left, right) => keyFor(left).localeCompare(keyFor(right)))
|
|
342
|
+
.map((item, index) => ({ ...item, id: index + 1 }));
|
|
343
|
+
}
|
|
344
|
+
function buildSnapshotFromLibrary(libraryDir) {
|
|
345
|
+
const methodologiesDir = node_path_1.default.join(libraryDir, "methodologies");
|
|
346
|
+
const specializationsDir = node_path_1.default.join(libraryDir, "specializations");
|
|
347
|
+
const domainsDir = node_path_1.default.join(specializationsDir, "domains");
|
|
348
|
+
const processFiles = [
|
|
349
|
+
...listFilesRecursively(methodologiesDir, (filePath) => PROCESS_EXTENSIONS.has(node_path_1.default.extname(filePath))),
|
|
350
|
+
...listFilesRecursively(specializationsDir, (filePath) => PROCESS_EXTENSIONS.has(node_path_1.default.extname(filePath)) &&
|
|
351
|
+
!normalizePath(filePath).includes("/skills/") &&
|
|
352
|
+
!normalizePath(filePath).includes("/agents/")),
|
|
353
|
+
];
|
|
354
|
+
const skillFiles = listFilesRecursively(libraryDir, (filePath) => normalizePath(filePath).endsWith("/SKILL.md"));
|
|
355
|
+
const agentFiles = listFilesRecursively(libraryDir, (filePath) => normalizePath(filePath).endsWith("/AGENT.md"));
|
|
356
|
+
const processes = assignStableIds(processFiles
|
|
357
|
+
.map((filePath) => {
|
|
358
|
+
const parsed = parseProcessFile(filePath);
|
|
359
|
+
if (!parsed) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
const stats = safeStat(filePath);
|
|
363
|
+
return {
|
|
364
|
+
...parsed,
|
|
365
|
+
createdAt: createdAtFor(stats),
|
|
366
|
+
updatedAt: updatedAtFor(stats),
|
|
367
|
+
};
|
|
368
|
+
})
|
|
369
|
+
.filter((process) => Boolean(process)), (item) => item.processId);
|
|
370
|
+
const skills = assignStableIds(skillFiles.map((filePath) => parseSkillFile(filePath)), (item) => `${item.name}:${item.filePath}`);
|
|
371
|
+
const agents = assignStableIds(agentFiles.map((filePath) => parseAgentFile(filePath)), (item) => `${item.name}:${item.filePath}`);
|
|
372
|
+
const skillNamesBySpecialization = new Map();
|
|
373
|
+
const agentNamesBySpecialization = new Map();
|
|
374
|
+
for (const skill of skills) {
|
|
375
|
+
if (skill.specializationName) {
|
|
376
|
+
const bucket = skillNamesBySpecialization.get(skill.specializationName) ?? [];
|
|
377
|
+
bucket.push(skill);
|
|
378
|
+
skillNamesBySpecialization.set(skill.specializationName, bucket);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
for (const agent of agents) {
|
|
382
|
+
if (agent.specializationName) {
|
|
383
|
+
const bucket = agentNamesBySpecialization.get(agent.specializationName) ?? [];
|
|
384
|
+
bucket.push(agent);
|
|
385
|
+
agentNamesBySpecialization.set(agent.specializationName, bucket);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const specializations = [];
|
|
389
|
+
for (const filePath of readDirNames(specializationsDir)) {
|
|
390
|
+
if (filePath === "domains" || filePath.startsWith(".")) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const absolutePath = node_path_1.default.join(specializationsDir, filePath);
|
|
394
|
+
if (!isDirectory(absolutePath)) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
const stats = safeStat(absolutePath);
|
|
398
|
+
const docs = findPrimaryDocPaths(absolutePath);
|
|
399
|
+
const specializationSkills = (skillNamesBySpecialization.get(filePath) ?? [])
|
|
400
|
+
.filter((skill) => skill.domainName === null)
|
|
401
|
+
.slice()
|
|
402
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
403
|
+
const specializationAgents = (agentNamesBySpecialization.get(filePath) ?? [])
|
|
404
|
+
.filter((agent) => agent.domainName === null)
|
|
405
|
+
.slice()
|
|
406
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
407
|
+
specializations.push({
|
|
408
|
+
id: 0,
|
|
409
|
+
name: filePath,
|
|
410
|
+
path: toRepoRelative(absolutePath),
|
|
411
|
+
domainName: null,
|
|
412
|
+
agentCount: specializationAgents.length,
|
|
413
|
+
skillCount: specializationSkills.length,
|
|
414
|
+
createdAt: createdAtFor(stats),
|
|
415
|
+
updatedAt: updatedAtFor(stats),
|
|
416
|
+
readmePath: docs.readmePath,
|
|
417
|
+
referencesPath: docs.referencesPath,
|
|
418
|
+
agents: specializationAgents.map((agent) => ({
|
|
419
|
+
id: agent.id,
|
|
420
|
+
name: agent.name,
|
|
421
|
+
description: agent.description,
|
|
422
|
+
role: agent.role,
|
|
423
|
+
})),
|
|
424
|
+
skills: specializationSkills.map((skill) => ({
|
|
425
|
+
id: skill.id,
|
|
426
|
+
slug: skill.slug,
|
|
427
|
+
name: skill.name,
|
|
428
|
+
description: skill.description,
|
|
429
|
+
})),
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
for (const domainName of readDirNames(domainsDir)) {
|
|
433
|
+
if (domainName.startsWith(".")) {
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
const domainPath = node_path_1.default.join(domainsDir, domainName);
|
|
437
|
+
if (!isDirectory(domainPath)) {
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
for (const specializationName of readDirNames(domainPath)) {
|
|
441
|
+
if (["agents", "skills", "README.md", "references.md"].includes(specializationName) || specializationName.startsWith(".")) {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
const specializationPath = node_path_1.default.join(domainPath, specializationName);
|
|
445
|
+
if (!isDirectory(specializationPath)) {
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
const stats = safeStat(specializationPath);
|
|
449
|
+
const docs = findPrimaryDocPaths(specializationPath);
|
|
450
|
+
const specializationSkills = (skillNamesBySpecialization.get(specializationName) ?? [])
|
|
451
|
+
.filter((skill) => skill.domainName === domainName)
|
|
452
|
+
.slice()
|
|
453
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
454
|
+
const specializationAgents = (agentNamesBySpecialization.get(specializationName) ?? [])
|
|
455
|
+
.filter((agent) => agent.domainName === domainName)
|
|
456
|
+
.slice()
|
|
457
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
458
|
+
specializations.push({
|
|
459
|
+
id: 0,
|
|
460
|
+
name: specializationName,
|
|
461
|
+
path: toRepoRelative(specializationPath),
|
|
462
|
+
domainName,
|
|
463
|
+
agentCount: specializationAgents.length,
|
|
464
|
+
skillCount: specializationSkills.length,
|
|
465
|
+
createdAt: createdAtFor(stats),
|
|
466
|
+
updatedAt: updatedAtFor(stats),
|
|
467
|
+
readmePath: docs.readmePath,
|
|
468
|
+
referencesPath: docs.referencesPath,
|
|
469
|
+
agents: specializationAgents.map((agent) => ({
|
|
470
|
+
id: agent.id,
|
|
471
|
+
name: agent.name,
|
|
472
|
+
description: agent.description,
|
|
473
|
+
role: agent.role,
|
|
474
|
+
})),
|
|
475
|
+
skills: specializationSkills.map((skill) => ({
|
|
476
|
+
id: skill.id,
|
|
477
|
+
slug: skill.slug,
|
|
478
|
+
name: skill.name,
|
|
479
|
+
description: skill.description,
|
|
480
|
+
})),
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const finalizedSpecializations = assignStableIds(specializations, (item) => `${item.domainName ?? ""}:${item.name}:${item.path}`);
|
|
485
|
+
const domains = [];
|
|
486
|
+
for (const domainName of readDirNames(domainsDir)) {
|
|
487
|
+
if (domainName.startsWith(".")) {
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
const domainPath = node_path_1.default.join(domainsDir, domainName);
|
|
491
|
+
if (!isDirectory(domainPath)) {
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
const stats = safeStat(domainPath);
|
|
495
|
+
const docs = findPrimaryDocPaths(domainPath);
|
|
496
|
+
const childSpecializations = finalizedSpecializations
|
|
497
|
+
.filter((specialization) => specialization.domainName === domainName)
|
|
498
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
499
|
+
const domainSkills = skills.filter((skill) => skill.domainName === domainName);
|
|
500
|
+
const domainAgents = agents.filter((agent) => agent.domainName === domainName);
|
|
501
|
+
domains.push({
|
|
502
|
+
id: 0,
|
|
503
|
+
name: domainName,
|
|
504
|
+
path: toRepoRelative(domainPath),
|
|
505
|
+
category: domainName,
|
|
506
|
+
specializationCount: childSpecializations.length,
|
|
507
|
+
agentCount: domainAgents.length,
|
|
508
|
+
skillCount: domainSkills.length,
|
|
509
|
+
createdAt: createdAtFor(stats),
|
|
510
|
+
updatedAt: updatedAtFor(stats),
|
|
511
|
+
readmePath: docs.readmePath,
|
|
512
|
+
referencesPath: docs.referencesPath,
|
|
513
|
+
specializations: childSpecializations.map((specialization) => ({
|
|
514
|
+
id: specialization.id,
|
|
515
|
+
name: specialization.name,
|
|
516
|
+
path: specialization.path,
|
|
517
|
+
agentCount: specialization.agentCount,
|
|
518
|
+
skillCount: specialization.skillCount,
|
|
519
|
+
})),
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
const finalizedDomains = assignStableIds(domains, (item) => item.name);
|
|
523
|
+
const databaseSize = processFiles.reduce((sum, filePath) => sum + fileSize(filePath), 0) +
|
|
524
|
+
skillFiles.reduce((sum, filePath) => sum + fileSize(filePath), 0) +
|
|
525
|
+
agentFiles.reduce((sum, filePath) => sum + fileSize(filePath), 0);
|
|
526
|
+
const generatedAt = new Date().toISOString();
|
|
527
|
+
return {
|
|
528
|
+
generatedAt,
|
|
529
|
+
databaseSize,
|
|
530
|
+
counts: {
|
|
531
|
+
domains: finalizedDomains.length,
|
|
532
|
+
specializations: finalizedSpecializations.length,
|
|
533
|
+
agents: agents.length,
|
|
534
|
+
skills: skills.length,
|
|
535
|
+
processes: processes.length,
|
|
536
|
+
},
|
|
537
|
+
processes,
|
|
538
|
+
skills,
|
|
539
|
+
agents,
|
|
540
|
+
domains: finalizedDomains,
|
|
541
|
+
specializations: finalizedSpecializations,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function loadPackagedSnapshot(snapshotPath) {
|
|
545
|
+
try {
|
|
546
|
+
return JSON.parse(readFile(snapshotPath));
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
550
|
+
throw new Error(`Failed to load packaged discovery snapshot at ${snapshotPath}: ${message}`);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function buildSnapshot() {
|
|
554
|
+
const libraryDir = libraryRoot();
|
|
555
|
+
if (isDirectory(libraryDir)) {
|
|
556
|
+
return buildSnapshotFromLibrary(libraryDir);
|
|
557
|
+
}
|
|
558
|
+
const snapshotPath = packagedSnapshotPath();
|
|
559
|
+
if (fileExists(snapshotPath)) {
|
|
560
|
+
return loadPackagedSnapshot(snapshotPath);
|
|
561
|
+
}
|
|
562
|
+
throw new Error(`Discovery assets unavailable for @a5c-ai/agent-catalog. Expected either repo library at ${libraryDir} or packaged snapshot at ${snapshotPath}.`);
|
|
563
|
+
}
|
|
564
|
+
function clearCatalogDiscoveryCache() {
|
|
565
|
+
cachedSnapshot = undefined;
|
|
566
|
+
}
|
|
567
|
+
function getCatalogDiscoverySnapshot() {
|
|
568
|
+
if (!cachedSnapshot) {
|
|
569
|
+
cachedSnapshot = buildSnapshot();
|
|
570
|
+
}
|
|
571
|
+
return clone(cachedSnapshot);
|
|
572
|
+
}
|
|
573
|
+
function refreshCatalogDiscoverySnapshot() {
|
|
574
|
+
clearCatalogDiscoveryCache();
|
|
575
|
+
return getCatalogDiscoverySnapshot();
|
|
576
|
+
}
|
|
577
|
+
function listCatalogProcesses() {
|
|
578
|
+
return getCatalogDiscoverySnapshot().processes;
|
|
579
|
+
}
|
|
580
|
+
function getCatalogProcessById(id) {
|
|
581
|
+
return getCatalogDiscoverySnapshot().processes.find((process) => process.id === id);
|
|
582
|
+
}
|
|
583
|
+
function listCatalogSkills() {
|
|
584
|
+
return getCatalogDiscoverySnapshot().skills;
|
|
585
|
+
}
|
|
586
|
+
function getCatalogSkillBySlug(slug) {
|
|
587
|
+
return getCatalogDiscoverySnapshot().skills.find((skill) => skill.slug === slug);
|
|
588
|
+
}
|
|
589
|
+
function listCatalogAgents() {
|
|
590
|
+
return getCatalogDiscoverySnapshot().agents;
|
|
591
|
+
}
|
|
592
|
+
function listCatalogDomains() {
|
|
593
|
+
return getCatalogDiscoverySnapshot().domains;
|
|
594
|
+
}
|
|
595
|
+
function getCatalogDomainByName(name) {
|
|
596
|
+
return getCatalogDiscoverySnapshot().domains.find((domain) => domain.name === name);
|
|
597
|
+
}
|
|
598
|
+
function listCatalogSpecializations() {
|
|
599
|
+
return getCatalogDiscoverySnapshot().specializations;
|
|
600
|
+
}
|
|
601
|
+
function getCatalogSpecializationByName(name) {
|
|
602
|
+
return getCatalogDiscoverySnapshot().specializations.find((specialization) => specialization.name === name);
|
|
603
|
+
}
|
|
604
|
+
function scoreMatch(query, ...values) {
|
|
605
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
606
|
+
if (!normalizedQuery) {
|
|
607
|
+
return 0;
|
|
608
|
+
}
|
|
609
|
+
let bestScore = 0;
|
|
610
|
+
for (const value of values) {
|
|
611
|
+
const normalizedValue = value?.toLowerCase() ?? "";
|
|
612
|
+
if (!normalizedValue) {
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
if (normalizedValue === normalizedQuery) {
|
|
616
|
+
bestScore = Math.max(bestScore, 100);
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
if (normalizedValue.startsWith(normalizedQuery)) {
|
|
620
|
+
bestScore = Math.max(bestScore, 80);
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (normalizedValue.includes(normalizedQuery)) {
|
|
624
|
+
bestScore = Math.max(bestScore, 60);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return bestScore;
|
|
628
|
+
}
|
|
629
|
+
function searchCatalogDiscovery(query, types) {
|
|
630
|
+
const snapshot = getCatalogDiscoverySnapshot();
|
|
631
|
+
const allowedTypes = new Set(types ?? [
|
|
632
|
+
"agent",
|
|
633
|
+
"skill",
|
|
634
|
+
"process",
|
|
635
|
+
"domain",
|
|
636
|
+
"specialization",
|
|
637
|
+
]);
|
|
638
|
+
const results = [];
|
|
639
|
+
if (allowedTypes.has("agent")) {
|
|
640
|
+
for (const agent of snapshot.agents) {
|
|
641
|
+
const score = scoreMatch(query, agent.name, agent.description, agent.role, agent.expertise.join(" "));
|
|
642
|
+
if (score > 0) {
|
|
643
|
+
results.push({
|
|
644
|
+
type: "agent",
|
|
645
|
+
id: agent.id,
|
|
646
|
+
name: agent.name,
|
|
647
|
+
description: agent.description,
|
|
648
|
+
path: agent.filePath,
|
|
649
|
+
score,
|
|
650
|
+
updatedAt: agent.updatedAt,
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (allowedTypes.has("skill")) {
|
|
656
|
+
for (const skill of snapshot.skills) {
|
|
657
|
+
const score = scoreMatch(query, skill.name, skill.description, skill.domainName, skill.specializationName);
|
|
658
|
+
if (score > 0) {
|
|
659
|
+
results.push({
|
|
660
|
+
type: "skill",
|
|
661
|
+
id: skill.id,
|
|
662
|
+
name: skill.name,
|
|
663
|
+
description: skill.description,
|
|
664
|
+
path: skill.filePath,
|
|
665
|
+
slug: skill.slug,
|
|
666
|
+
score,
|
|
667
|
+
updatedAt: skill.updatedAt,
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (allowedTypes.has("process")) {
|
|
673
|
+
for (const process of snapshot.processes) {
|
|
674
|
+
const score = scoreMatch(query, process.processId, process.description, process.category);
|
|
675
|
+
if (score > 0) {
|
|
676
|
+
results.push({
|
|
677
|
+
type: "process",
|
|
678
|
+
id: process.id,
|
|
679
|
+
name: process.processId,
|
|
680
|
+
description: process.description,
|
|
681
|
+
path: process.filePath,
|
|
682
|
+
score,
|
|
683
|
+
updatedAt: process.updatedAt,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
if (allowedTypes.has("domain")) {
|
|
689
|
+
for (const domain of snapshot.domains) {
|
|
690
|
+
const score = scoreMatch(query, domain.name, domain.category);
|
|
691
|
+
if (score > 0) {
|
|
692
|
+
results.push({
|
|
693
|
+
type: "domain",
|
|
694
|
+
id: domain.id,
|
|
695
|
+
name: domain.name,
|
|
696
|
+
description: domain.category ?? domain.name,
|
|
697
|
+
path: domain.path,
|
|
698
|
+
score,
|
|
699
|
+
updatedAt: domain.updatedAt,
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (allowedTypes.has("specialization")) {
|
|
705
|
+
for (const specialization of snapshot.specializations) {
|
|
706
|
+
const score = scoreMatch(query, specialization.name, specialization.domainName);
|
|
707
|
+
if (score > 0) {
|
|
708
|
+
results.push({
|
|
709
|
+
type: "specialization",
|
|
710
|
+
id: specialization.id,
|
|
711
|
+
name: specialization.name,
|
|
712
|
+
description: specialization.domainName
|
|
713
|
+
? `${specialization.name} specialization in ${specialization.domainName}`
|
|
714
|
+
: `${specialization.name} specialization`,
|
|
715
|
+
path: specialization.path,
|
|
716
|
+
score,
|
|
717
|
+
updatedAt: specialization.updatedAt,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return results.sort((left, right) => {
|
|
723
|
+
if (right.score !== left.score) {
|
|
724
|
+
return right.score - left.score;
|
|
725
|
+
}
|
|
726
|
+
return right.updatedAt.localeCompare(left.updatedAt);
|
|
727
|
+
});
|
|
728
|
+
}
|