mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
Fixed Agent.getDefault imports and circular deps.
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
parent
9c95d57143
commit
87402be70f
4 changed files with 18 additions and 3 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -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" })
|
||||
|
|
|
|||
|
|
@ -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/*"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue