refactor: update plugin handlers and shared utils
Minor updates to config handler, plugin detector, index entry, and builtin command templates. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
dda502a697
commit
ff92a4caa2
@ -275,8 +275,8 @@ For each generated file:
|
|||||||
Mode: {update | create-new}
|
Mode: {update | create-new}
|
||||||
|
|
||||||
Files:
|
Files:
|
||||||
✓ ./AGENTS.md (root, {N} lines)
|
[OK] ./AGENTS.md (root, {N} lines)
|
||||||
✓ ./src/hooks/AGENTS.md ({N} lines)
|
[OK] ./src/hooks/AGENTS.md ({N} lines)
|
||||||
|
|
||||||
Dirs Analyzed: {N}
|
Dirs Analyzed: {N}
|
||||||
AGENTS.md Created: {N}
|
AGENTS.md Created: {N}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export const START_WORK_TEMPLATE = `You are starting a Sisyphus work session.
|
|||||||
|
|
||||||
When listing plans for selection:
|
When listing plans for selection:
|
||||||
\`\`\`
|
\`\`\`
|
||||||
📋 Available Work Plans
|
Available Work Plans
|
||||||
|
|
||||||
Current Time: {ISO timestamp}
|
Current Time: {ISO timestamp}
|
||||||
Session ID: {current session id}
|
Session ID: {current session id}
|
||||||
@ -44,7 +44,7 @@ Which plan would you like to work on? (Enter number or plan name)
|
|||||||
|
|
||||||
When resuming existing work:
|
When resuming existing work:
|
||||||
\`\`\`
|
\`\`\`
|
||||||
🔄 Resuming Work Session
|
Resuming Work Session
|
||||||
|
|
||||||
Active Plan: {plan-name}
|
Active Plan: {plan-name}
|
||||||
Progress: {completed}/{total} tasks
|
Progress: {completed}/{total} tasks
|
||||||
@ -55,7 +55,7 @@ Reading plan and continuing from last incomplete task...
|
|||||||
|
|
||||||
When auto-selecting single plan:
|
When auto-selecting single plan:
|
||||||
\`\`\`
|
\`\`\`
|
||||||
🚀 Starting Work Session
|
Starting Work Session
|
||||||
|
|
||||||
Plan: {plan-name}
|
Plan: {plan-name}
|
||||||
Session ID: {session_id}
|
Session ID: {session_id}
|
||||||
|
|||||||
@ -288,7 +288,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const configHandler = createConfigHandler({
|
const configHandler = createConfigHandler({
|
||||||
ctx,
|
ctx: { directory: ctx.directory, client: ctx.client },
|
||||||
pluginConfig,
|
pluginConfig,
|
||||||
modelCacheState,
|
modelCacheState,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,6 +12,10 @@ import {
|
|||||||
loadProjectSkills,
|
loadProjectSkills,
|
||||||
loadOpencodeGlobalSkills,
|
loadOpencodeGlobalSkills,
|
||||||
loadOpencodeProjectSkills,
|
loadOpencodeProjectSkills,
|
||||||
|
discoverUserClaudeSkills,
|
||||||
|
discoverProjectClaudeSkills,
|
||||||
|
discoverOpencodeGlobalSkills,
|
||||||
|
discoverOpencodeProjectSkills,
|
||||||
} from "../features/opencode-skill-loader";
|
} from "../features/opencode-skill-loader";
|
||||||
import {
|
import {
|
||||||
loadUserAgents,
|
loadUserAgents,
|
||||||
@ -31,7 +35,7 @@ import type { ModelCacheState } from "../plugin-state";
|
|||||||
import type { CategoryConfig } from "../config/schema";
|
import type { CategoryConfig } from "../config/schema";
|
||||||
|
|
||||||
export interface ConfigHandlerDeps {
|
export interface ConfigHandlerDeps {
|
||||||
ctx: { directory: string };
|
ctx: { directory: string; client?: any };
|
||||||
pluginConfig: OhMyOpenCodeConfig;
|
pluginConfig: OhMyOpenCodeConfig;
|
||||||
modelCacheState: ModelCacheState;
|
modelCacheState: ModelCacheState;
|
||||||
}
|
}
|
||||||
@ -116,13 +120,35 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
return AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent
|
return AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent
|
||||||
}) as typeof pluginConfig.disabled_agents
|
}) as typeof pluginConfig.disabled_agents
|
||||||
|
|
||||||
const builtinAgents = createBuiltinAgents(
|
const includeClaudeSkillsForAwareness = pluginConfig.claude_code?.skills ?? true;
|
||||||
|
const [
|
||||||
|
discoveredUserSkills,
|
||||||
|
discoveredProjectSkills,
|
||||||
|
discoveredOpencodeGlobalSkills,
|
||||||
|
discoveredOpencodeProjectSkills,
|
||||||
|
] = await Promise.all([
|
||||||
|
includeClaudeSkillsForAwareness ? discoverUserClaudeSkills() : Promise.resolve([]),
|
||||||
|
includeClaudeSkillsForAwareness ? discoverProjectClaudeSkills() : Promise.resolve([]),
|
||||||
|
discoverOpencodeGlobalSkills(),
|
||||||
|
discoverOpencodeProjectSkills(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const allDiscoveredSkills = [
|
||||||
|
...discoveredOpencodeProjectSkills,
|
||||||
|
...discoveredProjectSkills,
|
||||||
|
...discoveredOpencodeGlobalSkills,
|
||||||
|
...discoveredUserSkills,
|
||||||
|
];
|
||||||
|
|
||||||
|
const builtinAgents = await createBuiltinAgents(
|
||||||
migratedDisabledAgents,
|
migratedDisabledAgents,
|
||||||
pluginConfig.agents,
|
pluginConfig.agents,
|
||||||
ctx.directory,
|
ctx.directory,
|
||||||
config.model as string | undefined,
|
config.model as string | undefined,
|
||||||
pluginConfig.categories,
|
pluginConfig.categories,
|
||||||
pluginConfig.git_master
|
pluginConfig.git_master,
|
||||||
|
allDiscoveredSkills,
|
||||||
|
ctx.client
|
||||||
);
|
);
|
||||||
|
|
||||||
// Claude Code agents: Do NOT apply permission migration
|
// Claude Code agents: Do NOT apply permission migration
|
||||||
|
|||||||
@ -121,7 +121,7 @@ export function detectExternalNotificationPlugin(directory: string): ExternalNot
|
|||||||
export function getNotificationConflictWarning(pluginName: string): string {
|
export function getNotificationConflictWarning(pluginName: string): string {
|
||||||
return `[oh-my-opencode] External notification plugin detected: ${pluginName}
|
return `[oh-my-opencode] External notification plugin detected: ${pluginName}
|
||||||
|
|
||||||
⚠️ Both oh-my-opencode and ${pluginName} listen to session.idle events.
|
Both oh-my-opencode and ${pluginName} listen to session.idle events.
|
||||||
Running both simultaneously can cause crashes on Windows.
|
Running both simultaneously can cause crashes on Windows.
|
||||||
|
|
||||||
oh-my-opencode's session-notification has been auto-disabled.
|
oh-my-opencode's session-notification has been auto-disabled.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user