fix: skip invalid YAML skills and enable Planner-Sisyphus in Tab selector
- Skip skills with invalid YAML frontmatter using new parseError flag - Add mode: "primary" to Planner-Sisyphus agent config for visibility - Prevents silent failures when loading skills with malformed YAML 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -78,7 +78,9 @@ export async function loadSkillFromPathAsync(
|
|||||||
): Promise<LoadedSkill | null> {
|
): Promise<LoadedSkill | null> {
|
||||||
try {
|
try {
|
||||||
const content = await readFile(skillPath, "utf-8")
|
const content = await readFile(skillPath, "utf-8")
|
||||||
const { data, body } = parseFrontmatter<SkillMetadata>(content)
|
const { data, body, parseError } = parseFrontmatter<SkillMetadata>(content)
|
||||||
|
if (parseError) return null
|
||||||
|
|
||||||
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content)
|
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content)
|
||||||
const mcpJsonMcp = await loadMcpJsonFromDirAsync(resolvedPath)
|
const mcpJsonMcp = await loadMcpJsonFromDirAsync(resolvedPath)
|
||||||
const mcpConfig = mcpJsonMcp || frontmatterMcp
|
const mcpConfig = mcpJsonMcp || frontmatterMcp
|
||||||
|
|||||||
@@ -152,10 +152,13 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
if (builderEnabled) {
|
if (builderEnabled) {
|
||||||
const { name: _buildName, ...buildConfigWithoutName } =
|
const { name: _buildName, ...buildConfigWithoutName } =
|
||||||
configAgent?.build ?? {};
|
configAgent?.build ?? {};
|
||||||
|
const migratedBuildConfig = migrateAgentConfig(
|
||||||
|
buildConfigWithoutName as Record<string, unknown>
|
||||||
|
);
|
||||||
const openCodeBuilderOverride =
|
const openCodeBuilderOverride =
|
||||||
pluginConfig.agents?.["OpenCode-Builder"];
|
pluginConfig.agents?.["OpenCode-Builder"];
|
||||||
const openCodeBuilderBase = {
|
const openCodeBuilderBase = {
|
||||||
...buildConfigWithoutName,
|
...migratedBuildConfig,
|
||||||
description: `${configAgent?.build?.description ?? "Build agent"} (OpenCode default)`,
|
description: `${configAgent?.build?.description ?? "Build agent"} (OpenCode default)`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -167,10 +170,14 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
if (plannerEnabled) {
|
if (plannerEnabled) {
|
||||||
const { name: _planName, ...planConfigWithoutName } =
|
const { name: _planName, ...planConfigWithoutName } =
|
||||||
configAgent?.plan ?? {};
|
configAgent?.plan ?? {};
|
||||||
|
const migratedPlanConfig = migrateAgentConfig(
|
||||||
|
planConfigWithoutName as Record<string, unknown>
|
||||||
|
);
|
||||||
const plannerSisyphusOverride =
|
const plannerSisyphusOverride =
|
||||||
pluginConfig.agents?.["Planner-Sisyphus"];
|
pluginConfig.agents?.["Planner-Sisyphus"];
|
||||||
const plannerSisyphusBase = {
|
const plannerSisyphusBase = {
|
||||||
...planConfigWithoutName,
|
...migratedPlanConfig,
|
||||||
|
mode: "primary",
|
||||||
prompt: PLAN_SYSTEM_PROMPT,
|
prompt: PLAN_SYSTEM_PROMPT,
|
||||||
permission: PLAN_PERMISSION,
|
permission: PLAN_PERMISSION,
|
||||||
description: `${configAgent?.plan?.description ?? "Plan agent"} (OhMyOpenCode version)`,
|
description: `${configAgent?.plan?.description ?? "Plan agent"} (OhMyOpenCode version)`,
|
||||||
@@ -197,6 +204,25 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
)
|
)
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
|
const migratedBuild = configAgent?.build
|
||||||
|
? migrateAgentConfig(configAgent.build as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
const migratedPlan = configAgent?.plan
|
||||||
|
? migrateAgentConfig(configAgent.plan as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
|
||||||
|
const planDemoteConfig = replacePlan
|
||||||
|
? { disable: true }
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
log("DEBUG plan demotion", {
|
||||||
|
replacePlan,
|
||||||
|
plannerEnabled,
|
||||||
|
hasPlannerSisyphus: !!agentConfig["Planner-Sisyphus"],
|
||||||
|
planDemoteConfig,
|
||||||
|
configAgentPlan: configAgent?.plan,
|
||||||
|
});
|
||||||
|
|
||||||
config.agent = {
|
config.agent = {
|
||||||
...agentConfig,
|
...agentConfig,
|
||||||
...Object.fromEntries(
|
...Object.fromEntries(
|
||||||
@@ -206,10 +232,8 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
...projectAgents,
|
...projectAgents,
|
||||||
...pluginAgents,
|
...pluginAgents,
|
||||||
...filteredConfigAgents,
|
...filteredConfigAgents,
|
||||||
build: { ...configAgent?.build, mode: "subagent" },
|
build: { ...migratedBuild, mode: "subagent", hidden: true },
|
||||||
...(replacePlan
|
...(planDemoteConfig ? { plan: planDemoteConfig } : {}),
|
||||||
? { plan: { ...configAgent?.plan, mode: "subagent" } }
|
|
||||||
: {}),
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
config.agent = {
|
config.agent = {
|
||||||
|
|||||||
Reference in New Issue
Block a user