Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
409a6f93b2 | ||
|
|
55c294c013 | ||
|
|
70db372466 | ||
|
|
8cc427daba | ||
|
|
8fde772957 | ||
|
|
d8dc23bde9 | ||
|
|
1c83ef75a2 | ||
|
|
95e410db88 |
@@ -1,4 +1,6 @@
|
||||
---
|
||||
model: openai/gpt-5
|
||||
reasoningEffort: medium
|
||||
description: ALWAYS use this when writing docs
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode/cloud-core",
|
||||
"version": "0.0.0",
|
||||
"version": "0.4.6",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@opencode/cloud-function",
|
||||
"version": "0.3.130",
|
||||
"version": "0.4.6",
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@opencode/cloud-web",
|
||||
"version": "0.0.0",
|
||||
"version": "0.4.6",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@opencode/function",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"name": "opencode",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
|
||||
@@ -39,6 +39,11 @@ for (const [os, arch] of targets) {
|
||||
"../tui",
|
||||
)
|
||||
await $`bun build --define OPENCODE_TUI_PATH="'../../../dist/${name}/bin/tui'" --define OPENCODE_VERSION="'${version}'" --compile --target=bun-${os}-${arch} --outfile=dist/${name}/bin/opencode ./src/index.ts`
|
||||
// Run the binary only if it matches current OS/arch
|
||||
if ((process.platform === (os === "windows" ? "win32" : os)) && (process.arch === arch || (process.arch === "x64" && arch === "x64-baseline"))) {
|
||||
console.log(`smoke test: running dist/${name}/bin/opencode --version`)
|
||||
await $`./dist/${name}/bin/opencode --version`
|
||||
}
|
||||
await $`rm -rf ./dist/${name}/bin/tui`
|
||||
await Bun.file(`dist/${name}/package.json`).write(
|
||||
JSON.stringify(
|
||||
|
||||
@@ -14,7 +14,6 @@ export namespace Agent {
|
||||
mode: z.union([z.literal("subagent"), z.literal("primary"), z.literal("all")]),
|
||||
topP: z.number().optional(),
|
||||
temperature: z.number().optional(),
|
||||
options: z.record(z.any()),
|
||||
model: z
|
||||
.object({
|
||||
modelID: z.string(),
|
||||
@@ -23,6 +22,7 @@ export namespace Agent {
|
||||
.optional(),
|
||||
prompt: z.string().optional(),
|
||||
tools: z.record(z.boolean()),
|
||||
options: z.record(z.string(), z.any()),
|
||||
})
|
||||
.openapi({
|
||||
ref: "Agent",
|
||||
@@ -73,6 +73,11 @@ export namespace Agent {
|
||||
options: {},
|
||||
tools: {},
|
||||
}
|
||||
const { model, prompt, tools, description, temperature, top_p, mode, ...extra } = value
|
||||
item.options = {
|
||||
...item.options,
|
||||
...extra,
|
||||
}
|
||||
if (value.model) item.model = Provider.parseModel(value.model)
|
||||
if (value.prompt) item.prompt = value.prompt
|
||||
if (value.tools)
|
||||
@@ -84,11 +89,6 @@ export namespace Agent {
|
||||
if (value.temperature != undefined) item.temperature = value.temperature
|
||||
if (value.top_p != undefined) item.topP = value.top_p
|
||||
if (value.mode) item.mode = value.mode
|
||||
if (value.options)
|
||||
item.options = {
|
||||
...item.options,
|
||||
...value.options,
|
||||
}
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
@@ -39,7 +39,7 @@ const AgentCreateCommand = cmd({
|
||||
const query = await prompts.text({
|
||||
message: "Description",
|
||||
placeholder: "What should this agent do?",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(query)) throw new UI.CancelledError()
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ export const AuthLoginCommand = cmd({
|
||||
if (provider === "other") {
|
||||
provider = await prompts.text({
|
||||
message: "Enter provider id",
|
||||
validate: (x) => x && (x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
|
||||
validate: (x) => (x && x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
|
||||
})
|
||||
if (prompts.isCancel(provider)) throw new UI.CancelledError()
|
||||
provider = provider.replace(/^@ai-sdk\//, "")
|
||||
@@ -193,7 +193,7 @@ export const AuthLoginCommand = cmd({
|
||||
|
||||
const code = await prompts.text({
|
||||
message: "Paste the authorization code here: ",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(code)) throw new UI.CancelledError()
|
||||
|
||||
@@ -229,7 +229,7 @@ export const AuthLoginCommand = cmd({
|
||||
|
||||
const code = await prompts.text({
|
||||
message: "Paste the authorization code here: ",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(code)) throw new UI.CancelledError()
|
||||
|
||||
@@ -302,7 +302,7 @@ export const AuthLoginCommand = cmd({
|
||||
|
||||
const key = await prompts.password({
|
||||
message: "Enter your API key",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(key)) throw new UI.CancelledError()
|
||||
await Auth.set(provider, {
|
||||
|
||||
@@ -19,7 +19,7 @@ export const McpAddCommand = cmd({
|
||||
|
||||
const name = await prompts.text({
|
||||
message: "Enter MCP server name",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(name)) throw new UI.CancelledError()
|
||||
|
||||
@@ -44,7 +44,7 @@ export const McpAddCommand = cmd({
|
||||
const command = await prompts.text({
|
||||
message: "Enter command to run",
|
||||
placeholder: "e.g., opencode x @modelcontextprotocol/server-filesystem",
|
||||
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
|
||||
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
|
||||
})
|
||||
if (prompts.isCancel(command)) throw new UI.CancelledError()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Log } from "../../util/log"
|
||||
import { FileWatcher } from "../../file/watch"
|
||||
import { Ide } from "../../ide"
|
||||
import { Agent } from "../../agent/agent"
|
||||
import { Flag } from "../../flag/flag"
|
||||
|
||||
declare global {
|
||||
const OPENCODE_TUI_PATH: string
|
||||
@@ -126,7 +127,7 @@ export const TuiCommand = cmd({
|
||||
if (Installation.isDev()) return
|
||||
if (Installation.isSnapshot()) return
|
||||
const config = await Config.global()
|
||||
if (config.autoupdate === false) return
|
||||
if (config.autoupdate === false || Flag.OPENCODE_DISABLE_AUTOUPDATE) return
|
||||
const latest = await Installation.latest().catch(() => {})
|
||||
if (!latest) return
|
||||
if (Installation.VERSION === latest) return
|
||||
|
||||
@@ -173,9 +173,9 @@ export namespace Config {
|
||||
tools: z.record(z.string(), z.boolean()).optional(),
|
||||
disable: z.boolean().optional(),
|
||||
description: z.string().optional().describe("Description of when to use the agent"),
|
||||
options: z.record(z.string(), z.any()).optional().describe("Additional model options passed through to provider"),
|
||||
mode: z.union([z.literal("subagent"), z.literal("primary"), z.literal("all")]).optional(),
|
||||
})
|
||||
.catchall(z.any())
|
||||
.openapi({
|
||||
ref: "AgentConfig",
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ export namespace Flag {
|
||||
export const OPENCODE_AUTO_SHARE = truthy("OPENCODE_AUTO_SHARE")
|
||||
export const OPENCODE_DISABLE_WATCHER = truthy("OPENCODE_DISABLE_WATCHER")
|
||||
export const OPENCODE_CONFIG = process.env["OPENCODE_CONFIG"]
|
||||
export const OPENCODE_DISABLE_AUTOUPDATE = truthy("OPENCODE_DISABLE_AUTOUPDATE")
|
||||
|
||||
function truthy(key: string) {
|
||||
const value = process.env[key]?.toLowerCase()
|
||||
|
||||
@@ -4,8 +4,7 @@ import { Config } from "../config/config"
|
||||
import { Bus } from "../bus"
|
||||
import { Log } from "../util/log"
|
||||
import { createOpencodeClient } from "@opencode-ai/sdk"
|
||||
// Lazy import to avoid circular dependency with session/tool registry
|
||||
// import { Server } from "../server/server"
|
||||
import { Server } from "../server/server"
|
||||
import { BunProc } from "../bun"
|
||||
|
||||
export namespace Plugin {
|
||||
@@ -14,7 +13,7 @@ export namespace Plugin {
|
||||
const state = App.state("plugin", async (app) => {
|
||||
const client = createOpencodeClient({
|
||||
baseUrl: "http://localhost:4096",
|
||||
fetch: async (...args) => (await import("../server/server")).Server.app().fetch(...args),
|
||||
fetch: async (...args) => Server.app().fetch(...args),
|
||||
})
|
||||
const config = await Config.get()
|
||||
const hooks = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode-ai/plugin",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode-ai/sdk",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
|
||||
@@ -182,6 +182,9 @@ export type Part =
|
||||
| ({
|
||||
type: "text"
|
||||
} & TextPart)
|
||||
| ({
|
||||
type: "reasoning"
|
||||
} & ReasoningPart)
|
||||
| ({
|
||||
type: "file"
|
||||
} & FilePart)
|
||||
@@ -217,6 +220,21 @@ export type TextPart = {
|
||||
}
|
||||
}
|
||||
|
||||
export type ReasoningPart = {
|
||||
id: string
|
||||
sessionID: string
|
||||
messageID: string
|
||||
type: string
|
||||
text: string
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
time: {
|
||||
start: number
|
||||
end?: number
|
||||
}
|
||||
}
|
||||
|
||||
export type FilePart = {
|
||||
id: string
|
||||
sessionID: string
|
||||
@@ -691,6 +709,7 @@ export type Config = {
|
||||
| {
|
||||
[key: string]: string
|
||||
}
|
||||
webfetch?: string
|
||||
}
|
||||
experimental?: {
|
||||
hook?: {
|
||||
@@ -889,6 +908,16 @@ export type AgentConfig = {
|
||||
*/
|
||||
description?: string
|
||||
mode?: string
|
||||
[key: string]:
|
||||
| unknown
|
||||
| string
|
||||
| number
|
||||
| {
|
||||
[key: string]: boolean
|
||||
}
|
||||
| boolean
|
||||
| string
|
||||
| undefined
|
||||
}
|
||||
|
||||
export type Provider = {
|
||||
@@ -1036,6 +1065,9 @@ export type Agent = {
|
||||
tools: {
|
||||
[key: string]: boolean
|
||||
}
|
||||
options: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSubscribeData = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@opencode/web",
|
||||
"type": "module",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"dev:remote": "sst shell --stage=dev --target=Web astro dev",
|
||||
|
||||
@@ -360,6 +360,41 @@ The `mode` option can be set to `primary`, `subagent`, or `all`. If no `mode` is
|
||||
|
||||
---
|
||||
|
||||
### Additional options
|
||||
|
||||
Any other options you specify in your agent configuration will be passed through directly to the provider as model options. This allows you to use provider-specific features and parameters.
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"agent": {
|
||||
"reasoning": {
|
||||
"model": "openai/gpt-5-turbo",
|
||||
"reasoningEffort": "high",
|
||||
"textVerbosity": "medium"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For example, with OpenAI's reasoning models, you can control the reasoning effort:
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"agent": {
|
||||
"deep-thinker": {
|
||||
"description": "Agent that uses high reasoning effort for complex problems",
|
||||
"model": "openai/gpt-5-turbo",
|
||||
"reasoningEffort": "high",
|
||||
"textVerbosity": "low"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These additional options are model and provider-specific. Check your provider's documentation for available parameters.
|
||||
|
||||
---
|
||||
|
||||
## Create agents
|
||||
|
||||
You can create new agents using the following command:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "opencode",
|
||||
"displayName": "opencode",
|
||||
"description": "opencode for VS Code",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.6",
|
||||
"publisher": "sst-dev",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in New Issue
Block a user