Fixed Agent.getDefault imports and circular deps.
Some checks failed
format / format (push) Has been cancelled
test / test (push) Has been cancelled

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot] 2025-11-18 19:51:59 +00:00
parent 9c95d57143
commit 87402be70f
4 changed files with 18 additions and 3 deletions

View file

@ -34,6 +34,18 @@ import type { OpencodeClient } from "@opencode-ai/sdk"
export namespace ACP {
const log = Log.create({ service: "acp-agent" })
async function getDefaultAgent(): Promise<string> {
const cfg = await Config.get()
const defaultAgent = cfg.default_agent
if (defaultAgent) {
return defaultAgent
}
// Fallback to build agent
return "build"
}
export async function init({ sdk }: { sdk: OpencodeClient }) {
const model = await defaultModel({ sdk })
return {
@ -475,7 +487,7 @@ export namespace ACP {
description: agent.description,
}))
const defaultAgentName = await Agent.getDefault()
const defaultAgentName = await getDefaultAgent()
const currentModeId = availableModes.find((m) => m.name === defaultAgentName)?.id ?? availableModes[0].id
const mcpServers: Record<string, Config.Mcp> = {}
@ -578,7 +590,7 @@ export namespace ACP {
if (!current) {
this.sessionManager.setModel(session.id, model)
}
const agent = session.modeId ?? (await Agent.getDefault())
const agent = session.modeId ?? (await getDefaultAgent())
const parts: Array<
{ type: "text"; text: string } | { type: "file"; url: string; filename: string; mime: string }

View file

@ -10,6 +10,7 @@ import { select } from "@clack/prompts"
import { createOpencodeClient, type OpencodeClient } from "@opencode-ai/sdk"
import { Server } from "../../server/server"
import { Provider } from "../../provider/provider"
import { Agent } from "../../agent/agent"
const TOOL: Record<string, [string, string]> = {
todowrite: ["Todo", UI.Style.TEXT_WARNING_BOLD],

View file

@ -15,6 +15,7 @@ import { Log } from "../util/log"
import { ProviderTransform } from "@/provider/transform"
import { SessionProcessor } from "./processor"
import { fn } from "@/util/fn"
import { Agent } from "../agent/agent"
export namespace SessionCompaction {
const log = Log.create({ service: "session.compaction" })

View file

@ -1,12 +1,13 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "@opentui/solid",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": [],
"noUncheckedIndexedAccess": false,
"module": "ESNext",
"moduleResolution": "bundler",
"customConditions": ["browser"],
"paths": {
"@/*": ["./src/*"],