restore gitignore
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user