From c910820cdb13f100dc0fadee8116de8e05a6b9df Mon Sep 17 00:00:00 2001 From: Kenny Date: Sat, 17 Jan 2026 12:52:07 -0500 Subject: [PATCH] restore gitignore --- .gitignore | 4 -- src/agents/sisyphus-junior.ts | 63 +-------------------------- src/plugin-handlers/config-handler.ts | 9 ++++ src/tools/delegate-task/tools.test.ts | 45 +++++++++++++++++++ 4 files changed, 55 insertions(+), 66 deletions(-) diff --git a/.gitignore b/.gitignore index 614bb35f..e913cc4b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,6 @@ node_modules/ # Build output dist/ -# Build artifacts in src (should go to dist/) -src/**/*.js -src/**/*.js.map - # Platform binaries (built, not committed) packages/*/bin/oh-my-opencode packages/*/bin/oh-my-opencode.exe diff --git a/src/agents/sisyphus-junior.ts b/src/agents/sisyphus-junior.ts index 4401533b..45b4102d 100644 --- a/src/agents/sisyphus-junior.ts +++ b/src/agents/sisyphus-junior.ts @@ -1,6 +1,6 @@ import type { AgentConfig } from "@opencode-ai/sdk" import { isGptModel } from "./types" -import type { AgentOverrideConfig, CategoryConfig } from "../config/schema" +import type { AgentOverrideConfig } from "../config/schema" import { createAgentToolRestrictions, type PermissionValue, @@ -132,64 +132,3 @@ export function createSisyphusJuniorAgentWithOverrides( thinking: { type: "enabled", budgetTokens: 32000 }, } as AgentConfig } - -export function createSisyphusJuniorAgent( - categoryConfig: CategoryConfig, - promptAppend?: string -): AgentConfig { - const prompt = buildSisyphusJuniorPrompt(promptAppend) - const model = categoryConfig.model ?? SISYPHUS_JUNIOR_DEFAULTS.model - const baseRestrictions = createAgentToolRestrictions(BLOCKED_TOOLS) - const categoryPermission = categoryConfig.tools - ? Object.fromEntries( - Object.entries(categoryConfig.tools).map(([k, v]) => [ - k, - v ? ("allow" as const) : ("deny" as const), - ]) - ) - : {} - const mergedPermission = { - ...categoryPermission, - ...baseRestrictions.permission, - } - - - const base: AgentConfig = { - description: - "Sisyphus-Junior - Focused task executor. Same discipline, no delegation.", - mode: "subagent" as const, - model, - maxTokens: categoryConfig.maxTokens ?? 64000, - prompt, - color: "#20B2AA", - permission: mergedPermission, - } - - if (categoryConfig.temperature !== undefined) { - base.temperature = categoryConfig.temperature - } - if (categoryConfig.top_p !== undefined) { - base.top_p = categoryConfig.top_p - } - - if (categoryConfig.thinking) { - return { ...base, thinking: categoryConfig.thinking } as AgentConfig - } - - if (categoryConfig.reasoningEffort) { - return { - ...base, - reasoningEffort: categoryConfig.reasoningEffort, - textVerbosity: categoryConfig.textVerbosity, - } as AgentConfig - } - - if (isGptModel(model)) { - return { ...base, reasoningEffort: "medium" } as AgentConfig - } - - return { - ...base, - thinking: { type: "enabled", budgetTokens: 32000 }, - } as AgentConfig -} diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index 626f288c..bbef7fd0 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -99,6 +99,15 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { log(`Plugin load errors`, { errors: pluginComponents.errors }); } + if (!(config.model as string | undefined)?.trim()) { + throw new Error( + 'oh-my-opencode requires a default model to be configured.\n' + + 'Please set one in OpenCode:\n' + + ' opencode config set model "provider/model-name"\n' + + 'Example: opencode config set model "anthropic/claude-sonnet-4-5"' + ) + } + const builtinAgents = createBuiltinAgents( pluginConfig.disabled_agents, pluginConfig.agents, diff --git a/src/tools/delegate-task/tools.test.ts b/src/tools/delegate-task/tools.test.ts index fced53a1..423c5029 100644 --- a/src/tools/delegate-task/tools.test.ts +++ b/src/tools/delegate-task/tools.test.ts @@ -84,6 +84,51 @@ describe("sisyphus-task", () => { }) }) + describe("category delegation config validation", () => { + test("returns error when systemDefaultModel is not configured", async () => { + // #given a mock client with no model in config + const { createDelegateTask } = require("./tools") + + const mockManager = { launch: async () => ({}) } + const mockClient = { + app: { agents: async () => ({ data: [] }) }, + config: { get: async () => ({}) }, // No model configured + session: { + create: async () => ({ data: { id: "test-session" } }), + prompt: async () => ({ data: {} }), + messages: async () => ({ data: [] }), + }, + } + + const tool = createDelegateTask({ + manager: mockManager, + client: mockClient, + }) + + const toolContext = { + sessionID: "parent-session", + messageID: "parent-message", + agent: "Sisyphus", + abort: new AbortController().signal, + } + + // #when delegating with a category + const result = await tool.execute( + { + description: "Test task", + prompt: "Do something", + category: "ultrabrain", + run_in_background: false, + skills: [], + }, + toolContext + ) + + // #then returns descriptive error message + expect(result).toContain("No default model configured") + }) + }) + describe("resolveCategoryConfig", () => { test("returns null for unknown category without user config", () => { // #given