Compare commits

..

14 Commits

Author SHA1 Message Date
opencode a2ab37c1b6 release: v0.15.25 2025-10-29 16:01:53 +00:00
Dax Raad 4d6e2d8efc autoupgrade latest major only 2025-10-29 11:53:25 -04:00
Aiden Cline 4407d5d96f fix: ensure tool inputs are zod validated 2025-10-29 10:46:57 -05:00
Adam 244945c0e7 fix: desktop error 2025-10-29 10:43:34 -05:00
opencode c652b2b4e8 release: v0.15.24 2025-10-29 15:38:55 +00:00
Dax Raad 12782fff14 remove log 2025-10-29 11:27:51 -04:00
Dax Raad ca463a2346 session diff only include modified files 2025-10-29 11:26:21 -04:00
Aiden Cline 7265cdf817 ignore: rm 2025-10-29 10:19:02 -05:00
Adam 5b86fa9109 wip: desktop work 2025-10-29 07:32:01 -05:00
Adam aa7e008fe1 wip: desktop work 2025-10-29 07:32:00 -05:00
GitHub Action 792664071c ignore: update download stats 2025-10-29 2025-10-29 12:04:57 +00:00
Aiden Cline a0541ba57a zen: fix models endpoint to be openai compatible 2025-10-28 22:48:57 -05:00
Aiden Cline 4994bf1b46 ignore: rename type 2025-10-28 22:39:57 -05:00
Tyler Gannon 1e24514d61 add OpenAPI annotations to tui.ts control endpoints (#3519) 2025-10-28 22:39:22 -05:00
30 changed files with 435 additions and 191 deletions
+1
View File
@@ -122,3 +122,4 @@
| 2025-10-26 | 584,409 (+5,482) | 521,179 (+5,050) | 1,105,588 (+10,532) |
| 2025-10-27 | 589,999 (+5,590) | 526,001 (+4,822) | 1,116,000 (+10,412) |
| 2025-10-28 | 595,776 (+5,777) | 532,438 (+6,437) | 1,128,214 (+12,214) |
| 2025-10-29 | 606,259 (+10,483) | 542,064 (+9,626) | 1,148,323 (+20,109) |
+11 -11
View File
@@ -37,7 +37,7 @@
},
"packages/console/core": {
"name": "@opencode-ai/console-core",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@aws-sdk/client-sts": "3.782.0",
"@jsx-email/render": "1.1.1",
@@ -64,7 +64,7 @@
},
"packages/console/function": {
"name": "@opencode-ai/console-function",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@ai-sdk/anthropic": "2.0.0",
"@ai-sdk/openai": "2.0.2",
@@ -88,7 +88,7 @@
},
"packages/console/mail": {
"name": "@opencode-ai/console-mail",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
@@ -109,7 +109,7 @@
},
"packages/desktop": {
"name": "@opencode-ai/desktop",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@kobalte/core": "catalog:",
"@opencode-ai/sdk": "workspace:*",
@@ -150,7 +150,7 @@
},
"packages/function": {
"name": "@opencode-ai/function",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@octokit/auth-app": "8.0.1",
"@octokit/rest": "22.0.0",
@@ -166,7 +166,7 @@
},
"packages/opencode": {
"name": "opencode",
"version": "0.15.23",
"version": "0.15.25",
"bin": {
"opencode": "./bin/opencode",
},
@@ -230,7 +230,7 @@
},
"packages/plugin": {
"name": "@opencode-ai/plugin",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@opencode-ai/sdk": "workspace:*",
"zod": "catalog:",
@@ -250,7 +250,7 @@
},
"packages/sdk/js": {
"name": "@opencode-ai/sdk",
"version": "0.15.23",
"version": "0.15.25",
"devDependencies": {
"@hey-api/openapi-ts": "0.81.0",
"@tsconfig/node22": "catalog:",
@@ -261,7 +261,7 @@
},
"packages/slack": {
"name": "@opencode-ai/slack",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@opencode-ai/sdk": "workspace:*",
"@slack/bolt": "^3.17.1",
@@ -274,7 +274,7 @@
},
"packages/ui": {
"name": "@opencode-ai/ui",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@kobalte/core": "catalog:",
"@pierre/precision-diffs": "catalog:",
@@ -297,7 +297,7 @@
},
"packages/web": {
"name": "@opencode-ai/web",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@astrojs/cloudflare": "12.6.3",
"@astrojs/markdown-remark": "6.3.1",
+1 -1
View File
@@ -7,7 +7,7 @@
"dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev",
"build": "vinxi build && ../../opencode/script/schema.ts ./.output/public/config.json",
"start": "vinxi start",
"version": "0.15.23"
"version": "0.15.25"
},
"dependencies": {
"@ibm/plex": "6.4.1",
@@ -25,8 +25,8 @@ export async function GET(input: APIEvent) {
object: "list",
data: Object.entries(zenData.models)
.filter(([id]) => !disabledModels.includes(id))
.map(([id, model]) => ({
id: `opencode/${id}`,
.map(([id, _model]) => ({
id,
object: "model",
created: Math.floor(Date.now() / 1000),
owned_by: "opencode",
@@ -50,7 +50,10 @@ export async function GET(input: APIEvent) {
})
.from(KeyTable)
.innerJoin(WorkspaceTable, eq(WorkspaceTable.id, KeyTable.workspaceID))
.leftJoin(ModelTable, and(eq(ModelTable.workspaceID, KeyTable.workspaceID), isNull(ModelTable.timeDeleted)))
.leftJoin(
ModelTable,
and(eq(ModelTable.workspaceID, KeyTable.workspaceID), isNull(ModelTable.timeDeleted)),
)
.where(and(eq(KeyTable.key, apiKey), isNull(KeyTable.timeDeleted)))
.then((rows) => rows.map((row) => row.model)),
)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/console-core",
"version": "0.15.23",
"version": "0.15.25",
"private": true,
"type": "module",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-function",
"version": "0.15.23",
"version": "0.15.25",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-mail",
"version": "0.15.23",
"version": "0.15.25",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/desktop",
"version": "0.15.23",
"version": "0.15.25",
"description": "",
"type": "module",
"scripts": {
@@ -1,4 +1,4 @@
import type { Part, AssistantMessage, ReasoningPart, TextPart, ToolPart } from "@opencode-ai/sdk"
import type { Part, AssistantMessage, ReasoningPart, TextPart, ToolPart, Message } from "@opencode-ai/sdk"
import { children, Component, createMemo, For, Match, Show, Switch, type JSX } from "solid-js"
import { Dynamic } from "solid-js/web"
import { Markdown } from "./markdown"
@@ -17,47 +17,36 @@ import type { WriteTool } from "opencode/tool/write"
import type { TodoWriteTool } from "opencode/tool/todo"
import { DiffChanges } from "./diff-changes"
export function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; lastToolOnly?: boolean }) {
export function AssistantMessage(props: { message: AssistantMessage; parts: Part[] }) {
const filteredParts = createMemo(() => {
let tool = false
return props.parts?.filter((x) => {
if (x.type === "tool" && props.lastToolOnly && tool) return false
if (x.type === "tool") tool = true
if (x.type === "reasoning") return false
return x.type !== "tool" || x.tool !== "todoread"
})
})
return (
<div class="w-full flex flex-col items-start gap-4">
<For each={filteredParts()}>
{(part) => {
const component = createMemo(() => PART_MAPPING[part.type as keyof typeof PART_MAPPING])
return (
<Show when={component()}>
<Dynamic component={component()} part={part as any} message={props.message} />
</Show>
)
}}
</For>
<For each={filteredParts()}>{(part) => <Part part={part} message={props.message} />}</For>
</div>
)
}
export function Part(props: { part: Part; message: Message; readonly?: boolean }) {
const component = createMemo(() => PART_MAPPING[props.part.type as keyof typeof PART_MAPPING])
return (
<Show when={component()}>
<Dynamic component={component()} part={props.part as any} message={props.message} readonly={props.readonly} />
</Show>
)
}
const PART_MAPPING = {
text: TextPart,
tool: ToolPart,
reasoning: ReasoningPart,
}
function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }) {
return null
// return (
// <Show when={props.part.text.trim()}>
// <div>{props.part.text}</div>
// </Show>
// )
}
function TextPart(props: { part: TextPart; message: AssistantMessage }) {
function ReasoningPart(props: { part: ReasoningPart; message: Message }) {
return (
<Show when={props.part.text.trim()}>
<Markdown text={props.part.text.trim()} />
@@ -65,17 +54,19 @@ function TextPart(props: { part: TextPart; message: AssistantMessage }) {
)
}
function ToolPart(props: { part: ToolPart; message: AssistantMessage }) {
// const sync = useSync()
function TextPart(props: { part: TextPart; message: Message }) {
return (
<Show when={props.part.text.trim()}>
<Markdown text={props.part.text.trim()} />
</Show>
)
}
function ToolPart(props: { part: ToolPart; message: Message; readonly?: boolean }) {
const component = createMemo(() => {
const render = ToolRegistry.render(props.part.tool) ?? GenericTool
const metadata = props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})
const input = props.part.state.status === "completed" ? props.part.state.input : {}
// const permissions = sync.data.permission[props.message.sessionID] ?? []
// const permissionIndex = permissions.findIndex((x) => x.callID === props.part.callID)
// const permission = permissions[permissionIndex]
return (
<Dynamic
@@ -83,8 +74,8 @@ function ToolPart(props: { part: ToolPart; message: AssistantMessage }) {
input={input}
tool={props.part.tool}
metadata={metadata}
// permission={permission?.metadata ?? {}}
output={props.part.state.status === "completed" ? props.part.state.output : undefined}
readonly={props.readonly}
/>
)
})
@@ -106,7 +97,12 @@ const isTriggerTitle = (val: any): val is TriggerTitle => {
return typeof val === "object" && val !== null && "title" in val && !(val instanceof Node)
}
function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX.Element; children?: JSX.Element }) {
function BasicTool(props: {
icon: IconProps["name"]
trigger: TriggerTitle | JSX.Element
children?: JSX.Element
readonly?: boolean
}) {
const resolved = children(() => props.children)
return (
<Collapsible>
@@ -161,13 +157,13 @@ function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX
</Switch>
</div>
</div>
<Show when={resolved()}>
<Show when={resolved() && !props.readonly}>
<Collapsible.Arrow />
</Show>
</div>
</Collapsible.Trigger>
<Show when={props.children}>
<Collapsible.Content>{props.children}</Collapsible.Content>
<Show when={resolved() && !props.readonly}>
<Collapsible.Content>{resolved()}</Collapsible.Content>
</Show>
</Collapsible>
// <>
@@ -177,15 +173,15 @@ function BasicTool(props: { icon: IconProps["name"]; trigger: TriggerTitle | JSX
}
function GenericTool(props: ToolProps<any>) {
return <BasicTool icon="mcp" trigger={{ title: props.tool }} />
return <BasicTool icon="mcp" trigger={{ title: props.tool }} readonly={props.readonly} />
}
type ToolProps<T extends Tool.Info> = {
input: Partial<Tool.InferParameters<T>>
metadata: Partial<Tool.InferMetadata<T>>
// permission: Record<string, any>
tool: string
output?: string
readonly?: boolean
}
const ToolRegistry = (() => {
@@ -393,9 +393,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
<img src={`https://models.dev/logos/${i.provider.id}.svg`} class="size-6 p-0.5 shrink-0 " />
<div class="flex gap-x-3 items-baseline flex-[1_0_0]">
<span class="text-14-medium text-text-strong overflow-hidden text-ellipsis">{i.name}</span>
<span class="text-12-medium text-text-weak overflow-hidden text-ellipsis truncate min-w-0">
{DateTime.fromFormat(i.release_date, "yyyy-MM-dd").toFormat("LLL yyyy")}
</span>
<Show when={i.release_date}>
<span class="text-12-medium text-text-weak overflow-hidden text-ellipsis truncate min-w-0">
{DateTime.fromFormat(i.release_date, "yyyy-MM-dd").toFormat("LLL yyyy")}
</span>
</Show>
</div>
</div>
<Show when={!i.cost || i.cost?.input === 0}>
-1
View File
@@ -481,7 +481,6 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
if (!message) return ""
if (Array.isArray(message)) return message.map((m) => getMessageText(m)).join(" ")
const fileParts = sync.data.part[message.id]?.filter((p) => p.type === "file")
console.log(fileParts)
return sync.data.part[message.id]
?.filter((p) => p.type === "text")
+72 -15
View File
@@ -33,7 +33,7 @@ import { Code } from "@/components/code"
import { useSync } from "@/context/sync"
import { useSDK } from "@/context/sdk"
import { ProgressCircle } from "@/components/progress-circle"
import { AssistantMessage } from "@/components/assistant-message"
import { AssistantMessage, Part } from "@/components/assistant-message"
import { type AssistantMessage as AssistantMessageType } from "@opencode-ai/sdk"
import { DiffChanges } from "@/components/diff-changes"
@@ -178,6 +178,8 @@ export default function Page() {
}
const handleDiffTriggerClick = (event: MouseEvent) => {
// disabling scroll to diff for now
return
const target = event.currentTarget as HTMLElement
queueMicrotask(() => {
if (target.getAttribute("aria-expanded") !== "true") return
@@ -636,6 +638,7 @@ export default function Page() {
<div class="flex flex-col items-start gap-50 pb-50">
<For each={local.session.userMessages()}>
{(message) => {
const [expanded, setExpanded] = createSignal(false)
const title = createMemo(() => message.summary?.title)
const prompt = createMemo(() => local.session.getMessageText(message))
const summary = createMemo(() => message.summary?.body)
@@ -649,15 +652,12 @@ export default function Page() {
if (!last) return false
return !last.time.completed
})
const lastWithContent = createMemo(() =>
assistantMessages().findLast((m) => {
const parts = sync.data.part[m.id]
return parts?.find((p) => p.type === "text" || p.type === "tool")
}),
)
return (
<div data-message={message.id} class="flex flex-col items-start self-stretch gap-8">
<div
data-message={message.id}
class="flex flex-col items-start self-stretch gap-8 min-h-[calc(100vh-15rem)]"
>
{/* Title */}
<div class="py-2 flex flex-col items-start gap-2 self-stretch sticky top-0 bg-background-stronger">
<h1 class="text-14-medium text-text-strong overflow-hidden text-ellipsis min-w-0">
@@ -665,14 +665,19 @@ export default function Page() {
</h1>
</div>
<Show when={title}>
<div class="-mt-5 text-12-regular text-text-base line-clamp-3">{prompt()}</div>
<div class="-mt-8 text-12-regular text-text-base line-clamp-3">{prompt()}</div>
</Show>
{/* Response */}
<div class="w-full flex flex-col gap-2">
<Collapsible variant="ghost">
<Collapsible variant="ghost" open={expanded()} onOpenChange={setExpanded}>
<Collapsible.Trigger class="text-text-weak hover:text-text-strong">
<div class="flex items-center gap-1 self-stretch">
<h2 class="text-12-medium">Show steps</h2>
<h2 class="text-12-medium">
<Switch>
<Match when={expanded()}>Hide steps</Match>
<Match when={!expanded()}>Show steps</Match>
</Switch>
</h2>
<Collapsible.Arrow />
</div>
</Collapsible.Trigger>
@@ -687,11 +692,63 @@ export default function Page() {
</div>
</Collapsible.Content>
</Collapsible>
<Show when={working() && lastWithContent()}>
{(last) => {
const lastParts = createMemo(() => sync.data.part[last().id])
<Show when={working() && !expanded()}>
{(_) => {
const lastMessageWithText = createMemo(() =>
assistantMessages().findLast((m) => {
const parts = sync.data.part[m.id]
return parts?.find((p) => p.type === "text")
}),
)
const lastMessageWithReasoning = createMemo(() =>
assistantMessages().findLast((m) => {
const parts = sync.data.part[m.id]
return parts?.find((p) => p.type === "reasoning")
}),
)
const lastMessageWithTool = createMemo(() =>
assistantMessages().findLast((m) => {
const parts = sync.data.part[m.id]
return parts?.find(
(p) => p.type === "tool" && p.state.status === "completed",
)
}),
)
return (
<AssistantMessage lastToolOnly message={last()} parts={lastParts()} />
<div class="w-full flex flex-col gap-2">
<Switch>
<Match when={lastMessageWithText()}>
{(last) => {
const lastTextPart = createMemo(() =>
sync.data.part[last().id].findLast((p) => p.type === "text"),
)
return <Part message={last()} part={lastTextPart()!} readonly />
}}
</Match>
<Match when={lastMessageWithReasoning()}>
{(last) => {
const lastReasoningPart = createMemo(() =>
sync.data.part[last().id].findLast(
(p) => p.type === "reasoning",
),
)
return (
<Part message={last()} part={lastReasoningPart()!} readonly />
)
}}
</Match>
</Switch>
<Show when={lastMessageWithTool()}>
{(last) => {
const lastToolPart = createMemo(() =>
sync.data.part[last().id].findLast(
(p) => p.type === "tool" && p.state.status === "completed",
),
)
return <Part message={last()} part={lastToolPart()!} readonly />
}}
</Show>
</div>
)
}}
</Show>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/function",
"version": "0.15.23",
"version": "0.15.25",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.15.23",
"version": "0.15.25",
"name": "opencode",
"type": "module",
"private": true,
+3 -1
View File
@@ -142,7 +142,9 @@ export namespace Installation {
export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
export async function latest() {
return fetch(`https://registry.npmjs.org/opencode-ai/${CHANNEL}`)
const [major] = VERSION.split(".").map((x) => Number(x))
const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
return fetch(`https://registry.npmjs.org/opencode-ai/${channel}`)
.then((res) => {
if (!res.ok) throw new Error(res.statusText)
return res.json()
+53 -14
View File
@@ -1,12 +1,16 @@
import { Hono, type Context } from "hono"
import { describeRoute, resolver, validator } from "hono-openapi"
import { z } from "zod"
import { AsyncQueue } from "../util/queue"
interface Request {
path: string
body: any
}
const TuiRequest = z.object({
path: z.string(),
body: z.any(),
})
const request = new AsyncQueue<Request>()
type TuiRequest = z.infer<typeof TuiRequest>
const request = new AsyncQueue<TuiRequest>()
const response = new AsyncQueue<any>()
export async function callTui(ctx: Context) {
@@ -19,12 +23,47 @@ export async function callTui(ctx: Context) {
}
export const TuiRoute = new Hono()
.get("/next", async (c) => {
const req = await request.next()
return c.json(req)
})
.post("/response", async (c) => {
const body = await c.req.json()
response.push(body)
return c.json(true)
})
.get(
"/next",
describeRoute({
description: "Get the next TUI request from the queue",
operationId: "tui.control.next",
responses: {
200: {
description: "Next TUI request",
content: {
"application/json": {
schema: resolver(TuiRequest),
},
},
},
},
}),
async (c) => {
const req = await request.next()
return c.json(req)
},
)
.post(
"/response",
describeRoute({
description: "Submit a response to the TUI request queue",
operationId: "tui.control.response",
responses: {
200: {
description: "Response submitted successfully",
content: {
"application/json": {
schema: resolver(z.boolean()),
},
},
},
},
}),
validator("json", z.any()),
async (c) => {
const body = c.req.valid("json")
response.push(body)
return c.json(true)
},
)
+46 -23
View File
@@ -286,7 +286,11 @@ export namespace SessionPrompt {
OUTPUT_TOKEN_MAX,
),
abortSignal: abort.signal,
providerOptions: ProviderTransform.providerOptions(model.npm, model.providerID, params.options),
providerOptions: ProviderTransform.providerOptions(
model.npm,
model.providerID,
params.options,
),
stopWhen: stepCountIs(1),
temperature: params.temperature,
topP: params.topP,
@@ -321,7 +325,11 @@ export namespace SessionPrompt {
async transformParams(args) {
if (args.type === "stream") {
// @ts-expect-error
args.params.prompt = ProviderTransform.message(args.params.prompt, model.providerID, model.modelID)
args.params.prompt = ProviderTransform.message(
args.params.prompt,
model.providerID,
model.modelID,
)
}
return args.params
},
@@ -504,7 +512,11 @@ export namespace SessionPrompt {
)
for (const item of await ToolRegistry.tools(input.providerID, input.modelID)) {
if (Wildcard.all(item.id, enabledTools) === false) continue
const schema = ProviderTransform.schema(input.providerID, input.modelID, z.toJSONSchema(item.parameters))
const schema = ProviderTransform.schema(
input.providerID,
input.modelID,
z.toJSONSchema(item.parameters),
)
tools[item.id] = tool({
id: item.id as any,
description: item.description,
@@ -521,6 +533,7 @@ export namespace SessionPrompt {
args,
},
)
item.parameters.parse(args)
const result = await item.execute(args, {
sessionID: input.sessionID,
abort: options.abortSignal!,
@@ -585,17 +598,7 @@ export namespace SessionPrompt {
args,
},
)
const result = await execute(args, opts).catch((err: unknown) => {
log.error("Error executing tool", { error: err, tool: key })
return {
content: [
{
type: "text",
text: `Failed to execute tool: ${err instanceof Error ? err.message : String(err)}`,
},
],
}
})
const result = await execute(args, opts)
await Plugin.trigger(
"tool.execute.after",
@@ -809,7 +812,9 @@ export namespace SessionPrompt {
messageID: info.id,
sessionID: input.sessionID,
type: "file",
url: `data:${part.mime};base64,` + Buffer.from(await file.bytes()).toString("base64"),
url:
`data:${part.mime};base64,` +
Buffer.from(await file.bytes()).toString("base64"),
mime: part.mime,
filename: part.filename!,
source: part.source,
@@ -883,7 +888,9 @@ export namespace SessionPrompt {
synthetic: true,
})
}
const wasPlan = input.messages.some((msg) => msg.info.role === "assistant" && msg.info.mode === "plan")
const wasPlan = input.messages.some(
(msg) => msg.info.role === "assistant" && msg.info.mode === "plan",
)
if (wasPlan && input.agent.name === "build") {
userMessage.parts.push({
id: Identifier.ascending("part"),
@@ -963,7 +970,10 @@ export namespace SessionPrompt {
partFromToolCall(toolCallID: string) {
return toolcalls[toolCallID]
},
async process(stream: StreamTextResult<Record<string, AITool>, never>, retries: { count: number; max: number }) {
async process(
stream: StreamTextResult<Record<string, AITool>, never>,
retries: { count: number; max: number },
) {
log.info("process")
if (!assistantMsg) throw new Error("call next() first before processing")
let shouldRetry = false
@@ -1094,7 +1104,10 @@ export namespace SessionPrompt {
status: "error",
input: value.input,
error: (value.error as any).toString(),
metadata: value.error instanceof Permission.RejectedError ? value.error.metadata : undefined,
metadata:
value.error instanceof Permission.RejectedError
? value.error.metadata
: undefined,
time: {
start: match.state.time.start,
end: Date.now(),
@@ -1218,7 +1231,11 @@ export namespace SessionPrompt {
error: e,
})
const error = MessageV2.fromError(e, { providerID: input.providerID })
if (retries.count < retries.max && MessageV2.APIError.isInstance(error) && error.data.isRetryable) {
if (
retries.count < retries.max &&
MessageV2.APIError.isInstance(error) &&
error.data.isRetryable
) {
shouldRetry = true
await Session.updatePart({
id: Identifier.ascending("part"),
@@ -1241,7 +1258,11 @@ export namespace SessionPrompt {
}
const p = await Session.getParts(assistantMsg.id)
for (const part of p) {
if (part.type === "tool" && part.state.status !== "completed" && part.state.status !== "error") {
if (
part.type === "tool" &&
part.state.status !== "completed" &&
part.state.status !== "error"
) {
Session.updatePart({
...part,
state: {
@@ -1705,11 +1726,13 @@ export namespace SessionPrompt {
if (input.session.parentID) return
if (!Session.isDefaultTitle(input.session.title)) return
const isFirst =
input.history.filter((m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic))
.length === 1
input.history.filter(
(m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic),
).length === 1
if (!isFirst) return
const small =
(await Provider.getSmallModel(input.providerID)) ?? (await Provider.getModel(input.providerID, input.modelID))
(await Provider.getSmallModel(input.providerID)) ??
(await Provider.getModel(input.providerID, input.modelID))
const options = {
...ProviderTransform.options(small.providerID, small.modelID, input.session.id),
...small.info.options,
+22 -6
View File
@@ -29,7 +29,15 @@ export namespace SessionSummary {
)
async function summarizeSession(input: { sessionID: string; messages: MessageV2.WithParts[] }) {
const diffs = await computeDiff({ messages: input.messages })
const files = new Set(
input.messages
.flatMap((x) => x.parts)
.filter((x) => x.type === "patch")
.flatMap((x) => x.files),
)
const diffs = await computeDiff({ messages: input.messages }).then((x) =>
x.filter((x) => files.has(x.file)),
)
await Session.update(input.sessionID, (draft) => {
draft.summary = {
diffs,
@@ -39,7 +47,9 @@ export namespace SessionSummary {
async function summarizeMessage(input: { messageID: string; messages: MessageV2.WithParts[] }) {
const messages = input.messages.filter(
(m) => m.info.id === input.messageID || (m.info.role === "assistant" && m.info.parentID === input.messageID),
(m) =>
m.info.id === input.messageID ||
(m.info.role === "assistant" && m.info.parentID === input.messageID),
)
const msgWithParts = messages.find((m) => m.info.id === input.messageID)!
const userMsg = msgWithParts.info as MessageV2.User
@@ -50,11 +60,14 @@ export namespace SessionSummary {
}
await Session.updateMessage(userMsg)
const assistantMsg = messages.find((m) => m.info.role === "assistant")!.info as MessageV2.Assistant
const assistantMsg = messages.find((m) => m.info.role === "assistant")!
.info as MessageV2.Assistant
const small = await Provider.getSmallModel(assistantMsg.providerID)
if (!small) return
const textPart = msgWithParts.parts.find((p) => p.type === "text" && !p.synthetic) as MessageV2.TextPart
const textPart = msgWithParts.parts.find(
(p) => p.type === "text" && !p.synthetic,
) as MessageV2.TextPart
if (textPart && !userMsg.summary?.title) {
const result = await generateText({
maxOutputTokens: small.info.reasoning ? 1500 : 20,
@@ -81,7 +94,8 @@ export namespace SessionSummary {
if (
messages.some(
(m) =>
m.info.role === "assistant" && m.parts.some((p) => p.type === "step-finish" && p.reason !== "tool-calls"),
m.info.role === "assistant" &&
m.parts.some((p) => p.type === "step-finish" && p.reason !== "tool-calls"),
)
) {
const result = await generateText({
@@ -114,7 +128,9 @@ export namespace SessionSummary {
let all = await Session.messages(input.sessionID)
if (input.messageID)
all = all.filter(
(x) => x.info.id === input.messageID || (x.info.role === "assistant" && x.info.parentID === input.messageID),
(x) =>
x.info.id === input.messageID ||
(x.info.role === "assistant" && x.info.parentID === input.messageID),
)
return computeDiff({
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/plugin",
"version": "0.15.23",
"version": "0.15.25",
"type": "module",
"scripts": {
"typecheck": "tsgo --noEmit",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "0.15.23",
"version": "0.15.25",
"type": "module",
"scripts": {
"typecheck": "tsgo --noEmit",
+39
View File
@@ -125,6 +125,10 @@ import type {
TuiExecuteCommandErrors,
TuiShowToastData,
TuiShowToastResponses,
TuiControlNextData,
TuiControlNextResponses,
TuiControlResponseData,
TuiControlResponseResponses,
AuthSetData,
AuthSetResponses,
AuthSetErrors,
@@ -750,6 +754,40 @@ class Mcp extends _HeyApiClient {
}
}
class Control extends _HeyApiClient {
/**
* Get the next TUI request from the queue
*/
public next<ThrowOnError extends boolean = false>(
options?: Options<TuiControlNextData, ThrowOnError>,
) {
return (options?.client ?? this._client).get<TuiControlNextResponses, unknown, ThrowOnError>({
url: "/tui/control/next",
...options,
})
}
/**
* Submit a response to the TUI request queue
*/
public response<ThrowOnError extends boolean = false>(
options?: Options<TuiControlResponseData, ThrowOnError>,
) {
return (options?.client ?? this._client).post<
TuiControlResponseResponses,
unknown,
ThrowOnError
>({
url: "/tui/control/response",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers,
},
})
}
}
class Tui extends _HeyApiClient {
/**
* Append prompt to the TUI
@@ -878,6 +916,7 @@ class Tui extends _HeyApiClient {
},
})
}
control = new Control({ client: this._client })
}
class Auth extends _HeyApiClient {
+40
View File
@@ -2632,6 +2632,46 @@ export type TuiShowToastResponses = {
export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]
export type TuiControlNextData = {
body?: never
path?: never
query?: {
directory?: string
}
url: "/tui/control/next"
}
export type TuiControlNextResponses = {
/**
* Next TUI request
*/
200: {
path: string
body: unknown
}
}
export type TuiControlNextResponse = TuiControlNextResponses[keyof TuiControlNextResponses]
export type TuiControlResponseData = {
body?: unknown
path?: never
query?: {
directory?: string
}
url: "/tui/control/response"
}
export type TuiControlResponseResponses = {
/**
* Response submitted successfully
*/
200: boolean
}
export type TuiControlResponseResponse =
TuiControlResponseResponses[keyof TuiControlResponseResponses]
export type AuthSetData = {
body?: Auth
path: {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/slack",
"version": "0.15.23",
"version": "0.15.25",
"type": "module",
"scripts": {
"dev": "bun run src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/ui",
"version": "0.15.23",
"version": "0.15.25",
"type": "module",
"exports": {
".": "./src/components/index.ts",
+4 -2
View File
@@ -2,7 +2,7 @@
[data-slot="diff-hunk-separator-line-number"] {
position: sticky;
left: 0;
background-color: hsla(209, 96%, 90%, 1);
background-color: var(--surface-diff-hidden-strong);
z-index: 2;
display: flex;
align-items: center;
@@ -12,11 +12,13 @@
aspect-ratio: 1;
width: 24px;
height: 24px;
color: var(--icon-strong-base);
}
}
[data-slot="diff-hunk-separator-content"] {
position: sticky;
background-color: hsla(210, 100%, 96%, 1);
background-color: var(--surface-diff-hidden-base);
color: var(--text-base);
width: var(--pjs-column-content-width);
left: var(--pjs-column-number-width);
padding-left: 8px;
+50 -2
View File
@@ -34,8 +34,8 @@
--smoke-dark-alpha-9: #faf5f467;
--smoke-dark-alpha-10: #fbf5f576;
--smoke-dark-alpha-11: #fcf9f9b2;
--smoke-light-alpha-1: #55000003;
--smoke-dark-alpha-12: #fdfbfbf0;
--smoke-light-alpha-1: #55000003;
--smoke-light-alpha-2: #25000007;
--smoke-light-alpha-3: #1100000f;
--smoke-light-alpha-4: #0c000017;
@@ -125,8 +125,8 @@
--cobalt-dark-alpha-9: #034cff;
--cobalt-dark-alpha-10: #003bffed;
--cobalt-dark-alpha-11: #89b5ff;
--cobalt-light-8: #73a4ff;
--cobalt-dark-alpha-12: #cde2ff;
--cobalt-light-8: #73a4ff;
--cobalt-light-9: #034cff;
--cobalt-light-10: #0443de;
--cobalt-light-11: #1251ec;
@@ -445,4 +445,52 @@
--mint-light-alpha-10: #0cc7006c;
--mint-light-alpha-11: #016800cf;
--mint-light-alpha-12: #022e00e2;
--blue-dark-1: #0e161f;
--blue-dark-2: #0f1b2d;
--blue-dark-3: #0f233c;
--blue-dark-4: #10294b;
--blue-dark-5: #0e2f57;
--blue-dark-6: #0c3768;
--blue-dark-7: #094280;
--blue-dark-8: #0854a4;
--blue-dark-9: #0091ff;
--blue-dark-10: #389eff;
--blue-dark-11: #51a8ff;
--blue-dark-12: #eaf6ff;
--blue-light-1: #f9fcff;
--blue-light-2: #f5faff;
--blue-light-3: #eaf4ff;
--blue-light-4: #e0efff;
--blue-light-5: #cde6fd;
--blue-light-6: #b9d9f8;
--blue-light-7: #96c7f2;
--blue-light-8: #5cafee;
--blue-light-9: #0091ff;
--blue-light-10: #007fef;
--blue-light-11: #0069db;
--blue-light-12: #00254d;
--blue-dark-alpha-1: #00000000;
--blue-dark-alpha-2: #0c58fc0f;
--blue-dark-alpha-3: #1576fd23;
--blue-dark-alpha-4: #1576fd33;
--blue-dark-alpha-5: #107bfd3f;
--blue-dark-alpha-6: #0a7cff51;
--blue-dark-alpha-7: #057dff70;
--blue-dark-alpha-8: #057dff99;
--blue-dark-alpha-9: #0094fff9;
--blue-dark-alpha-10: #38a2fff9;
--blue-dark-alpha-11: #51abfff9;
--blue-dark-alpha-12: #effbfff9;
--blue-light-alpha-1: #0582ff05;
--blue-light-alpha-2: #0582ff0a;
--blue-light-alpha-3: #007fff11;
--blue-light-alpha-4: #007fff1e;
--blue-light-alpha-5: #017fee30;
--blue-light-alpha-6: #0176e447;
--blue-light-alpha-7: #0077e068;
--blue-light-alpha-8: #0082e5a0;
--blue-light-alpha-9: #0090fff9;
--blue-light-alpha-10: #007feff9;
--blue-light-alpha-11: #0066dbf9;
--blue-light-alpha-12: #002047f9;
}
+36 -30
View File
@@ -50,9 +50,11 @@
--radius-4xl: 2rem;
--shadow-xs:
0 1px 2px -1px rgba(19, 16, 16, 0.04), 0 1px 2px 0 rgba(19, 16, 16, 0.06), 0 1px 3px 0 rgba(19, 16, 16, 0.08);
0 1px 2px -1px rgba(19, 16, 16, 0.04), 0 1px 2px 0 rgba(19, 16, 16, 0.06),
0 1px 3px 0 rgba(19, 16, 16, 0.08);
--shadow-md:
0 6px 8px -4px rgba(19, 16, 16, 0.12), 0 4px 3px -2px rgba(19, 16, 16, 0.12), 0 1px 2px -1px rgba(19, 16, 16, 0.12);
0 6px 8px -4px rgba(19, 16, 16, 0.12), 0 4px 3px -2px rgba(19, 16, 16, 0.12),
0 1px 2px -1px rgba(19, 16, 16, 0.12);
--shadow-xs-border-selected:
0 0 0 3px var(--border-weak-selected, rgba(1, 103, 255, 0.29)),
0 0 0 1px var(--border-selected, rgba(0, 74, 255, 0.99)), 0 1px 2px -1px rgba(19, 16, 16, 0.25),
@@ -66,8 +68,8 @@
--background-weak: var(--smoke-light-3);
--background-strong: var(--smoke-light-1);
--background-stronger: #fcfcfc;
--base: var(--smoke-light-alpha-2);
--surface-base: var(--smoke-light-alpha-2);
--base: var(--smoke-light-alpha-2);
--surface-base-hover: #0500000f;
--surface-base-active: var(--smoke-light-alpha-3);
--surface-base-interactive-active: var(--cobalt-light-alpha-3);
@@ -81,6 +83,7 @@
--surface-float-base: var(--smoke-dark-1);
--surface-float-base-hover: var(--smoke-dark-2);
--surface-raised-base-hover: var(--smoke-light-alpha-2);
--surface-raised-base-active: var(--smoke-light-alpha-3);
--surface-raised-strong: var(--smoke-light-1);
--surface-raised-strong-hover: var(--white);
--surface-raised-stronger: var(--white);
@@ -107,9 +110,9 @@
--surface-info-base: var(--lilac-light-3);
--surface-info-weak: var(--lilac-light-2);
--surface-info-strong: var(--lilac-light-9);
--surface-diff-hidden-base: var(--blue-light-3);
--surface-diff-skip-base: var(--smoke-light-2);
--surface-diff-unchanged-base: #ffffff00;
--surface-diff-skip-base: var(--smoke-light-2);
--surface-diff-hidden-base: var(--blue-light-3);
--surface-diff-hidden-weak: var(--blue-light-2);
--surface-diff-hidden-weaker: var(--blue-light-1);
--surface-diff-hidden-strong: var(--blue-light-5);
@@ -142,7 +145,7 @@
--text-on-warning-base: var(--smoke-dark-alpha-11);
--text-on-info-base: var(--smoke-dark-alpha-11);
--text-diff-add-base: var(--mint-light-11);
--text-diff-delete-base: var(--ember-light-11);
--text-diff-delete-base: var(--ember-light-10);
--text-diff-delete-strong: var(--ember-light-12);
--text-diff-add-strong: var(--mint-light-12);
--text-on-info-weak: var(--smoke-dark-alpha-9);
@@ -198,19 +201,19 @@
--icon-selected: var(--smoke-light-12);
--icon-disabled: var(--smoke-light-8);
--icon-focus: var(--smoke-light-12);
--icon-weak-base: var(--smoke-light-7);
--icon-invert-base: #ffffff;
--icon-weak-base: var(--smoke-light-7);
--icon-weak-hover: var(--smoke-light-8);
--icon-weak-active: var(--smoke-light-9);
--icon-weak-selected: var(--smoke-light-10);
--icon-weak-disabled: var(--smoke-light-6);
--icon-weak-focus: var(--smoke-light-9);
--icon-strong-base: var(--smoke-light-12);
--icon-strong-hover: var(--smoke-light-12);
--icon-strong-active: var(--smoke-light-12);
--icon-strong-selected: var(--smoke-light-12);
--icon-strong-hover: #151313;
--icon-strong-active: #020202;
--icon-strong-selected: #020202;
--icon-strong-disabled: var(--smoke-light-8);
--icon-strong-focus: var(--smoke-light-12);
--icon-strong-focus: #020202;
--icon-brand-base: var(--smoke-light-12);
--icon-interactive-base: var(--cobalt-light-9);
--icon-success-base: var(--apple-light-7);
@@ -248,9 +251,8 @@
--icon-diff-add-base: var(--mint-light-11);
--icon-diff-add-hover: var(--mint-light-12);
--icon-diff-add-active: var(--mint-light-12);
--icon-diff-delete-base: var(--ember-light-9);
--icon-diff-delete-hover: var(--ember-light-10);
--icon-diff-delete-active: var(--ember-light-11);
--icon-diff-delete-base: var(--ember-light-10);
--icon-diff-delete-hover: var(--ember-light-11);
--syntax-comment: #8a8a8a;
--syntax-string: #d68c27;
--syntax-keyword: #3b7dd8;
@@ -286,6 +288,8 @@
--border-weaker-selected: var(--cobalt-light-alpha-4);
--border-weaker-disabled: var(--smoke-light-alpha-2);
--border-weaker-focus: var(--smoke-light-alpha-6);
--button-ghost-hover: var(--smoke-light-alpha-2);
--button-ghost-hover2: var(--smoke-light-alpha-3);
@media (prefers-color-scheme: dark) {
/* OC-1-Dark */
@@ -294,8 +298,8 @@
--background-weak: #201d1d;
--background-strong: #151313;
--background-stronger: #201c1c;
--base: var(--smoke-dark-alpha-2);
--surface-base: var(--smoke-dark-alpha-2);
--base: var(--smoke-dark-alpha-2);
--surface-base-hover: #e0b7b716;
--surface-base-active: var(--smoke-dark-alpha-3);
--surface-base-interactive-active: var(--cobalt-dark-alpha-2);
@@ -309,6 +313,7 @@
--surface-float-base: var(--smoke-dark-1);
--surface-float-base-hover: var(--smoke-dark-2);
--surface-raised-base-hover: var(--smoke-dark-alpha-4);
--surface-raised-base-active: var(--smoke-dark-alpha-5);
--surface-raised-strong: var(--smoke-dark-alpha-4);
--surface-raised-strong-hover: var(--smoke-dark-alpha-6);
--surface-raised-stronger: var(--smoke-dark-alpha-6);
@@ -329,15 +334,15 @@
--surface-warning-base: var(--solaris-light-3);
--surface-warning-weak: var(--solaris-light-2);
--surface-warning-strong: var(--solaris-light-9);
--surface-critical-base: var(--ember-light-3);
--surface-critical-weak: var(--ember-light-2);
--surface-critical-strong: var(--ember-light-9);
--surface-critical-base: var(--ember-dark-3);
--surface-critical-weak: var(--ember-dark-2);
--surface-critical-strong: var(--ember-dark-9);
--surface-info-base: var(--lilac-light-3);
--surface-info-weak: var(--lilac-light-2);
--surface-info-strong: var(--lilac-light-9);
--surface-diff-hidden-base: var(--blue-dark-2);
--surface-diff-skip-base: var(--smoke-dark-alpha-1);
--surface-diff-unchanged-base: var(--smoke-dark-1);
--surface-diff-skip-base: var(--smoke-dark-alpha-1);
--surface-diff-hidden-base: var(--blue-dark-2);
--surface-diff-hidden-weak: var(--blue-dark-1);
--surface-diff-hidden-weaker: var(--blue-dark-3);
--surface-diff-hidden-strong: var(--blue-dark-5);
@@ -414,9 +419,9 @@
--border-warning-base: var(--solaris-light-6);
--border-warning-hover: var(--solaris-light-7);
--border-warning-selected: var(--solaris-light-9);
--border-critical-base: var(--ember-light-6);
--border-critical-hover: var(--ember-light-7);
--border-critical-selected: var(--ember-light-9);
--border-critical-base: var(--ember-dark-5);
--border-critical-hover: var(--ember-dark-7);
--border-critical-selected: var(--ember-dark-9);
--border-info-base: var(--lilac-light-6);
--border-info-hover: var(--lilac-light-7);
--border-info-selected: var(--lilac-light-9);
@@ -426,19 +431,19 @@
--icon-selected: var(--smoke-dark-12);
--icon-disabled: var(--smoke-dark-7);
--icon-focus: var(--smoke-dark-12);
--icon-weak-base: var(--smoke-dark-6);
--icon-invert-base: var(--smoke-dark-1);
--icon-weak-base: var(--smoke-dark-6);
--icon-weak-hover: var(--smoke-light-7);
--icon-weak-active: var(--smoke-light-8);
--icon-weak-selected: var(--smoke-light-9);
--icon-weak-disabled: var(--smoke-light-4);
--icon-weak-focus: var(--smoke-light-9);
--icon-strong-base: var(--smoke-dark-12);
--icon-strong-hover: var(--smoke-light-12);
--icon-strong-active: var(--smoke-light-12);
--icon-strong-selected: var(--smoke-light-12);
--icon-strong-disabled: var(--smoke-light-8);
--icon-strong-focus: var(--smoke-light-12);
--icon-strong-hover: #f6f3f3;
--icon-strong-active: #fcfcfc;
--icon-strong-selected: #fdfcfc;
--icon-strong-disabled: var(--smoke-dark-8);
--icon-strong-focus: #fdfcfc;
--icon-brand-base: var(--white);
--icon-interactive-base: var(--cobalt-dark-9);
--icon-success-base: var(--apple-dark-7);
@@ -478,7 +483,6 @@
--icon-diff-add-active: var(--mint-dark-11);
--icon-diff-delete-base: var(--ember-dark-9);
--icon-diff-delete-hover: var(--ember-dark-10);
--icon-diff-delete-active: var(--ember-dark-11);
--syntax-comment: #808080;
--syntax-string: #9d7cd8;
--syntax-keyword: #fab283;
@@ -514,5 +518,7 @@
--border-weaker-selected: var(--cobalt-dark-alpha-3);
--border-weaker-disabled: var(--smoke-dark-alpha-2);
--border-weaker-focus: var(--smoke-dark-alpha-6);
--button-ghost-hover: var(--smoke-dark-alpha-2);
--button-ghost-hover2: var(--smoke-dark-alpha-3);
}
}
-29
View File
@@ -48,35 +48,6 @@
border-width: 0;
}
.scroller {
--fade-height: 1.5rem;
--mask-top: linear-gradient(to bottom, transparent, black var(--fade-height));
--mask-bottom: linear-gradient(to top, transparent, black var(--fade-height));
mask-image: var(--mask-top), var(--mask-bottom);
mask-repeat: no-repeat;
mask-size: 100% var(--fade-height);
animation: adjust-masks linear;
animation-timeline: scroll(self);
}
@keyframes adjust-masks {
from {
mask-position:
0 calc(0% - var(--fade-height)),
0 100%;
}
to {
mask-position:
0 0,
0 calc(100% + var(--fade-height));
}
}
.truncate-start {
text-overflow: ellipsis;
overflow: hidden;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/web",
"type": "module",
"version": "0.15.23",
"version": "0.15.25",
"scripts": {
"dev": "astro dev",
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "opencode",
"displayName": "opencode",
"description": "opencode for VS Code",
"version": "0.15.23",
"version": "0.15.25",
"publisher": "sst-dev",
"repository": {
"type": "git",