opencode-agents 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +30 -6
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/discover.ts +14 -9
- package/src/core/installer.ts +3 -1
- package/src/core/parser.ts +33 -2
package/dist/index.js
CHANGED
|
@@ -26230,8 +26230,30 @@ import { mkdtempSync } from "fs";
|
|
|
26230
26230
|
|
|
26231
26231
|
// src/core/parser.ts
|
|
26232
26232
|
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
26233
|
+
var AGENT_SPECIFIC_FIELDS = [
|
|
26234
|
+
"mode",
|
|
26235
|
+
"model",
|
|
26236
|
+
"temperature",
|
|
26237
|
+
"maxSteps",
|
|
26238
|
+
"color",
|
|
26239
|
+
"trigger",
|
|
26240
|
+
"tools",
|
|
26241
|
+
"permission",
|
|
26242
|
+
"mcp"
|
|
26243
|
+
];
|
|
26244
|
+
function isAgentContent(content) {
|
|
26245
|
+
try {
|
|
26246
|
+
const { data } = (0, import_gray_matter.default)(content);
|
|
26247
|
+
return AGENT_SPECIFIC_FIELDS.some((field) => field in data);
|
|
26248
|
+
} catch {
|
|
26249
|
+
return false;
|
|
26250
|
+
}
|
|
26251
|
+
}
|
|
26233
26252
|
function parseAgentFile(content, path) {
|
|
26234
26253
|
const { data, content: body } = (0, import_gray_matter.default)(content);
|
|
26254
|
+
if (!isAgentContent(content)) {
|
|
26255
|
+
return null;
|
|
26256
|
+
}
|
|
26235
26257
|
if (!data.description) {
|
|
26236
26258
|
throw new Error(`Agent at ${path} is missing required "description" field in frontmatter`);
|
|
26237
26259
|
}
|
|
@@ -26386,7 +26408,6 @@ var SEARCH_DIRECTORIES = [
|
|
|
26386
26408
|
];
|
|
26387
26409
|
var PRIORITY_FILES = [
|
|
26388
26410
|
"AGENTS.md",
|
|
26389
|
-
"SKILL.md",
|
|
26390
26411
|
"AGENT.md"
|
|
26391
26412
|
];
|
|
26392
26413
|
async function discoverFromDirectory(dir) {
|
|
@@ -26401,8 +26422,9 @@ async function discoverFromDirectory(dir) {
|
|
|
26401
26422
|
if (fileName === "README.md") continue;
|
|
26402
26423
|
try {
|
|
26403
26424
|
const content = readFileSync2(file, "utf-8");
|
|
26404
|
-
const
|
|
26405
|
-
|
|
26425
|
+
const result = parseAgentFile(content, file);
|
|
26426
|
+
if (result === null) continue;
|
|
26427
|
+
agents.push(result);
|
|
26406
26428
|
} catch (err) {
|
|
26407
26429
|
continue;
|
|
26408
26430
|
}
|
|
@@ -26413,10 +26435,11 @@ async function discoverFromDirectory(dir) {
|
|
|
26413
26435
|
if (existsSync2(priorityFile)) {
|
|
26414
26436
|
try {
|
|
26415
26437
|
const content = readFileSync2(priorityFile, "utf-8");
|
|
26416
|
-
const
|
|
26417
|
-
|
|
26438
|
+
const result = parseAgentFile(content, priorityFile);
|
|
26439
|
+
if (result === null) continue;
|
|
26440
|
+
const exists = agents.some((a) => a.path === result.path);
|
|
26418
26441
|
if (!exists) {
|
|
26419
|
-
agents.unshift(
|
|
26442
|
+
agents.unshift(result);
|
|
26420
26443
|
}
|
|
26421
26444
|
} catch (err) {
|
|
26422
26445
|
continue;
|
|
@@ -27026,6 +27049,7 @@ function listInstalledAgents(platform, global2) {
|
|
|
27026
27049
|
try {
|
|
27027
27050
|
const content = readFileSync3(file, "utf-8");
|
|
27028
27051
|
const agentFile = parseAgentFile(content, file);
|
|
27052
|
+
if (agentFile === null) continue;
|
|
27029
27053
|
agents.push(agentFile);
|
|
27030
27054
|
} catch (err) {
|
|
27031
27055
|
continue;
|