fix: update skill resolution to support disabled skills functionality
This commit is contained in:
parent
2236a940f8
commit
ba2a9a9051
@ -57,7 +57,8 @@ export function buildAgent(
|
|||||||
model: string,
|
model: string,
|
||||||
categories?: CategoriesConfig,
|
categories?: CategoriesConfig,
|
||||||
gitMasterConfig?: GitMasterConfig,
|
gitMasterConfig?: GitMasterConfig,
|
||||||
browserProvider?: BrowserAutomationProvider
|
browserProvider?: BrowserAutomationProvider,
|
||||||
|
disabledSkills?: Set<string>
|
||||||
): AgentConfig {
|
): AgentConfig {
|
||||||
const base = isFactory(source) ? source(model) : source
|
const base = isFactory(source) ? source(model) : source
|
||||||
const categoryConfigs: Record<string, CategoryConfig> = categories
|
const categoryConfigs: Record<string, CategoryConfig> = categories
|
||||||
@ -81,7 +82,7 @@ export function buildAgent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (agentWithCategory.skills?.length) {
|
if (agentWithCategory.skills?.length) {
|
||||||
const { resolved } = resolveMultipleSkills(agentWithCategory.skills, { gitMasterConfig, browserProvider })
|
const { resolved } = resolveMultipleSkills(agentWithCategory.skills, { gitMasterConfig, browserProvider, disabledSkills })
|
||||||
if (resolved.size > 0) {
|
if (resolved.size > 0) {
|
||||||
const skillContent = Array.from(resolved.values()).join("\n\n")
|
const skillContent = Array.from(resolved.values()).join("\n\n")
|
||||||
base.prompt = skillContent + (base.prompt ? "\n\n" + base.prompt : "")
|
base.prompt = skillContent + (base.prompt ? "\n\n" + base.prompt : "")
|
||||||
@ -311,7 +312,7 @@ export async function createBuiltinAgents(
|
|||||||
if (!resolution) continue
|
if (!resolution) continue
|
||||||
const { model, variant: resolvedVariant } = resolution
|
const { model, variant: resolvedVariant } = resolution
|
||||||
|
|
||||||
let config = buildAgent(source, model, mergedCategories, gitMasterConfig, browserProvider)
|
let config = buildAgent(source, model, mergedCategories, gitMasterConfig, browserProvider, disabledSkills)
|
||||||
|
|
||||||
// Apply resolved variant from model fallback chain
|
// Apply resolved variant from model fallback chain
|
||||||
if (resolvedVariant) {
|
if (resolvedVariant) {
|
||||||
|
|||||||
@ -386,6 +386,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
const lookAt = isMultimodalLookerEnabled ? createLookAt(ctx) : null;
|
const lookAt = isMultimodalLookerEnabled ? createLookAt(ctx) : null;
|
||||||
const browserProvider =
|
const browserProvider =
|
||||||
pluginConfig.browser_automation_engine?.provider ?? "playwright";
|
pluginConfig.browser_automation_engine?.provider ?? "playwright";
|
||||||
|
const disabledSkills = new Set<string>(pluginConfig.disabled_skills ?? []);
|
||||||
const delegateTask = createDelegateTask({
|
const delegateTask = createDelegateTask({
|
||||||
manager: backgroundManager,
|
manager: backgroundManager,
|
||||||
client: ctx.client,
|
client: ctx.client,
|
||||||
@ -394,6 +395,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
gitMasterConfig: pluginConfig.git_master,
|
gitMasterConfig: pluginConfig.git_master,
|
||||||
sisyphusJuniorModel: pluginConfig.agents?.["sisyphus-junior"]?.model,
|
sisyphusJuniorModel: pluginConfig.agents?.["sisyphus-junior"]?.model,
|
||||||
browserProvider,
|
browserProvider,
|
||||||
|
disabledSkills,
|
||||||
onSyncSessionCreated: async (event) => {
|
onSyncSessionCreated: async (event) => {
|
||||||
log("[index] onSyncSessionCreated callback", {
|
log("[index] onSyncSessionCreated callback", {
|
||||||
sessionID: event.sessionID,
|
sessionID: event.sessionID,
|
||||||
@ -412,7 +414,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const disabledSkills = new Set(pluginConfig.disabled_skills ?? []);
|
|
||||||
const systemMcpNames = getSystemMcpServerNames();
|
const systemMcpNames = getSystemMcpServerNames();
|
||||||
const builtinSkills = createBuiltinSkills({ browserProvider, disabledSkills }).filter((skill) => {
|
const builtinSkills = createBuiltinSkills({ browserProvider, disabledSkills }).filter((skill) => {
|
||||||
if (skill.mcpConfig) {
|
if (skill.mcpConfig) {
|
||||||
@ -446,6 +447,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
mcpManager: skillMcpManager,
|
mcpManager: skillMcpManager,
|
||||||
getSessionID: getSessionIDForMcp,
|
getSessionID: getSessionIDForMcp,
|
||||||
gitMasterConfig: pluginConfig.git_master,
|
gitMasterConfig: pluginConfig.git_master,
|
||||||
|
disabledSkills
|
||||||
});
|
});
|
||||||
const skillMcpTool = createSkillMcpTool({
|
const skillMcpTool = createSkillMcpTool({
|
||||||
manager: skillMcpManager,
|
manager: skillMcpManager,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ interface SessionMessage {
|
|||||||
|
|
||||||
export async function resolveSkillContent(
|
export async function resolveSkillContent(
|
||||||
skills: string[],
|
skills: string[],
|
||||||
options: { gitMasterConfig?: GitMasterConfig; browserProvider?: BrowserAutomationProvider }
|
options: { gitMasterConfig?: GitMasterConfig; browserProvider?: BrowserAutomationProvider, disabledSkills?: Set<string> }
|
||||||
): Promise<{ content: string | undefined; error: string | null }> {
|
): Promise<{ content: string | undefined; error: string | null }> {
|
||||||
if (skills.length === 0) {
|
if (skills.length === 0) {
|
||||||
return { content: undefined, error: null }
|
return { content: undefined, error: null }
|
||||||
|
|||||||
@ -83,6 +83,7 @@ Prompts MUST be in English.`
|
|||||||
const { content: skillContent, error: skillError } = await resolveSkillContent(args.load_skills, {
|
const { content: skillContent, error: skillError } = await resolveSkillContent(args.load_skills, {
|
||||||
gitMasterConfig: options.gitMasterConfig,
|
gitMasterConfig: options.gitMasterConfig,
|
||||||
browserProvider: options.browserProvider,
|
browserProvider: options.browserProvider,
|
||||||
|
disabledSkills: options.disabledSkills,
|
||||||
})
|
})
|
||||||
if (skillError) {
|
if (skillError) {
|
||||||
return skillError
|
return skillError
|
||||||
|
|||||||
@ -41,6 +41,7 @@ export interface DelegateTaskToolOptions {
|
|||||||
gitMasterConfig?: GitMasterConfig
|
gitMasterConfig?: GitMasterConfig
|
||||||
sisyphusJuniorModel?: string
|
sisyphusJuniorModel?: string
|
||||||
browserProvider?: BrowserAutomationProvider
|
browserProvider?: BrowserAutomationProvider
|
||||||
|
disabledSkills?: Set<string>
|
||||||
onSyncSessionCreated?: (event: SyncSessionCreatedEvent) => Promise<void>
|
onSyncSessionCreated?: (event: SyncSessionCreatedEvent) => Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,7 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
|
|||||||
const getSkills = async (): Promise<LoadedSkill[]> => {
|
const getSkills = async (): Promise<LoadedSkill[]> => {
|
||||||
if (options.skills) return options.skills
|
if (options.skills) return options.skills
|
||||||
if (cachedSkills) return cachedSkills
|
if (cachedSkills) return cachedSkills
|
||||||
cachedSkills = await getAllSkills()
|
cachedSkills = await getAllSkills({disabledSkills: options?.disabledSkills})
|
||||||
return cachedSkills
|
return cachedSkills
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,4 +28,5 @@ export interface SkillLoadOptions {
|
|||||||
getSessionID?: () => string
|
getSessionID?: () => string
|
||||||
/** Git master configuration for watermark/co-author settings */
|
/** Git master configuration for watermark/co-author settings */
|
||||||
gitMasterConfig?: GitMasterConfig
|
gitMasterConfig?: GitMasterConfig
|
||||||
|
disabledSkills?: Set<string>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user