Compare commits

..

9 Commits

Author SHA1 Message Date
Dax
0ea7e75e0b Merge branch 'dev' into refactor/node-server-adapter 2026-03-10 11:40:35 -04:00
Aiden Cline
ad08fd57df chore: rekram1-node is no longer on vacation (#16905) 2026-03-10 10:27:04 -05:00
opencode-agent[bot]
54ba59d3e1 chore: generate 2026-03-10 15:14:46 +00:00
James Long
a4330a225d feat(core): allow passing workspaceID into session create endpoint (#16798) 2026-03-10 11:12:51 -04:00
James Long
69ddc91c35 fix(core): a chunk timeout when processing llm stream (#16366) 2026-03-10 11:12:14 -04:00
James Long
4c4aed5a87 fix(core): make worktrees read the project id from local workspace (#16795) 2026-03-10 11:11:28 -04:00
opencode-agent[bot]
5a40158abf chore: generate 2026-03-10 15:07:35 +00:00
Jérôme Benoit
4dce485854 fix(opencode): add thinking variants support for SAP AI provider (#14958)
Co-authored-by: Test <test@test.com>
Co-authored-by: Stephen Collings <stevoland@gmail.com>
2026-03-10 10:05:45 -05:00
Dax Raad
2724335b28 refactor(server): replace Bun serve with Hono node adapters 2026-03-09 17:57:00 -04:00
44 changed files with 611 additions and 495 deletions

View File

@@ -5,16 +5,8 @@ import DESCRIPTION from "./github-triage.txt"
const TEAM = {
desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"],
zen: ["fwang", "MrMushrooooom"],
tui: [
"thdxr",
"kommander",
// "rekram1-node" (on vacation)
],
core: [
"thdxr",
// "rekram1-node", (on vacation)
"jlongster",
],
tui: ["thdxr", "kommander", "rekram1-node"],
core: ["thdxr", "rekram1-node", "jlongster"],
docs: ["R44VC0RP"],
windows: ["Hona"],
} as const
@@ -50,7 +42,10 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) {
export default tool({
description: DESCRIPTION,
args: {
assignee: tool.schema.enum(ASSIGNEES as [string, ...string[]]).describe("The username of the assignee"),
assignee: tool.schema
.enum(ASSIGNEES as [string, ...string[]])
.describe("The username of the assignee")
.default("rekram1-node"),
labels: tool.schema
.array(tool.schema.enum(["nix", "opentui", "perf", "web", "desktop", "zen", "docs", "windows", "core"]))
.describe("The labels(s) to add to the issue")
@@ -73,8 +68,7 @@ export default tool({
results.push("Dropped label: nix (issue does not mention nix)")
}
// const assignee = nix ? "rekram1-node" : web ? pick(TEAM.desktop) : args.assignee
const assignee = web ? pick(TEAM.desktop) : args.assignee
const assignee = nix ? "rekram1-node" : web ? pick(TEAM.desktop) : args.assignee
if (labels.includes("zen") && !zen) {
throw new Error("Only add the zen label when issue title/body contains 'zen'")

View File

@@ -4,5 +4,3 @@ Choose labels and assignee using the current triage policy and ownership rules.
Pick the most fitting labels for the issue and assign one owner.
If unsure, choose the team/section with the most overlap with the issue and assign a member from that team at random.
(Note: rekram1-node is on vacation, do not assign issues to him.)

View File

@@ -81,6 +81,8 @@
"@gitlab/gitlab-ai-provider": "3.6.0",
"@gitlab/opencode-gitlab-auth": "1.3.3",
"@hono/standard-validator": "0.1.5",
"@hono/node-server": "1.19.11",
"@hono/node-ws": "1.3.0",
"@hono/zod-validator": "catalog:",
"@modelcontextprotocol/sdk": "1.25.2",
"@octokit/graphql": "9.0.2",

View File

@@ -23,7 +23,7 @@ export const AcpCommand = cmd({
process.env.OPENCODE_CLIENT = "acp"
await bootstrap(process.cwd(), async () => {
const opts = await resolveNetworkOptions(args)
const server = Server.listen(opts)
const server = await Server.listen(opts)
const sdk = createOpencodeClient({
baseUrl: `http://${server.hostname}:${server.port}`,

View File

@@ -15,7 +15,7 @@ export const ServeCommand = cmd({
console.log("Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
}
const opts = await resolveNetworkOptions(args)
const server = Server.listen(opts)
const server = await Server.listen(opts)
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
await new Promise(() => {})

View File

@@ -402,9 +402,12 @@ function App() {
const current = promptRef.current
// Don't require focus - if there's any text, preserve it
const currentPrompt = current?.current?.input ? current.current : undefined
const workspaceID =
route.data.type === "session" ? sync.session.get(route.data.sessionID)?.workspaceID : undefined
route.navigate({
type: "home",
initialPrompt: currentPrompt,
workspaceID,
})
dialog.clear()
},

View File

@@ -47,7 +47,7 @@ async function openWorkspace(input: {
}
let created: Session | undefined
while (!created) {
const result = await client.session.create({}).catch(() => undefined)
const result = await client.session.create({ workspaceID: input.workspaceID }).catch(() => undefined)
if (!result) {
input.toast.show({
message: "Failed to open workspace",

View File

@@ -37,6 +37,7 @@ import { DialogSkill } from "../dialog-skill"
export type PromptProps = {
sessionID?: string
workspaceID?: string
visible?: boolean
disabled?: boolean
onSubmit?: () => void
@@ -542,7 +543,9 @@ export function Prompt(props: PromptProps) {
let sessionID = props.sessionID
if (sessionID == null) {
const res = await sdk.client.session.create({})
const res = await sdk.client.session.create({
workspaceID: props.workspaceID,
})
if (res.error) {
console.log("Creating a session failed:", res.error)

View File

@@ -5,6 +5,7 @@ import type { PromptInfo } from "../component/prompt/history"
export type HomeRoute = {
type: "home"
initialPrompt?: PromptInfo
workspaceID?: string
}
export type SessionRoute = {

View File

@@ -121,6 +121,7 @@ export function Home() {
promptRef.set(r)
}}
hint={Hint}
workspaceID={route.workspaceID}
/>
</box>
<box height={4} minHeight={0} width="100%" maxWidth={75} alignItems="center" paddingTop={3} flexShrink={1}>

View File

@@ -8,7 +8,6 @@ import { upgrade } from "@/cli/upgrade"
import { Config } from "@/config/config"
import { GlobalBus } from "@/bus/global"
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/v2"
import type { BunWebSocketData } from "hono/bun"
import { Flag } from "@/flag/flag"
import { setTimeout as sleep } from "node:timers/promises"
@@ -38,7 +37,7 @@ GlobalBus.on("event", (event) => {
Rpc.emit("global.event", event)
})
let server: Bun.Server<BunWebSocketData> | undefined
let server: Awaited<ReturnType<typeof Server.listen>> | undefined
const eventStream = {
abort: undefined as AbortController | undefined,
@@ -120,7 +119,7 @@ export const rpc = {
},
async server(input: { port: number; hostname: string; mdns?: boolean; cors?: string[] }) {
if (server) await server.stop(true)
server = Server.listen(input)
server = await Server.listen(input)
return { url: server.url.toString() }
},
async checkUpgrade(input: { directory: string }) {
@@ -143,7 +142,7 @@ export const rpc = {
Log.Default.info("worker shutting down")
if (eventStream.abort) eventStream.abort.abort()
await Instance.disposeAll()
if (server) server.stop(true)
if (server) await server.stop(true)
},
}

View File

@@ -37,7 +37,7 @@ export const WebCommand = cmd({
UI.println(UI.Style.TEXT_WARNING_BOLD + "! " + "OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
}
const opts = await resolveNetworkOptions(args)
const server = Server.listen(opts)
const server = await Server.listen(opts)
UI.empty()
UI.println(UI.logo(" "))
UI.empty()

View File

@@ -972,6 +972,14 @@ export namespace Config {
.describe(
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
),
chunkTimeout: z
.number()
.int()
.positive()
.optional()
.describe(
"Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.",
),
})
.catchall(z.any())
.optional(),

View File

@@ -88,6 +88,12 @@ export namespace Project {
}
}
function readCachedId(dir: string) {
return Filesystem.readText(path.join(dir, "opencode"))
.then((x) => x.trim())
.catch(() => undefined)
}
export async function fromDirectory(directory: string) {
log.info("fromDirectory", { directory })
@@ -101,19 +107,43 @@ export namespace Project {
const gitBinary = which("git")
// cached id calculation
let id = await Filesystem.readText(path.join(dotgit, "opencode"))
.then((x) => x.trim())
.catch(() => undefined)
let id = await readCachedId(dotgit)
if (!gitBinary) {
return {
id: id ?? "global",
worktree: sandbox,
sandbox: sandbox,
sandbox,
vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
}
}
const worktree = await git(["rev-parse", "--git-common-dir"], {
cwd: sandbox,
})
.then(async (result) => {
const common = gitpath(sandbox, await result.text())
// Avoid going to parent of sandbox when git-common-dir is empty.
return common === sandbox ? sandbox : path.dirname(common)
})
.catch(() => undefined)
if (!worktree) {
return {
id: id ?? "global",
worktree: sandbox,
sandbox,
vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
}
}
// In the case of a git worktree, it can't cache the id
// because `.git` is not a folder, but it always needs the
// same project id as the common dir, so we resolve it now
if (id == null) {
id = await readCachedId(path.join(worktree, ".git"))
}
// generate id from root commit
if (!id) {
const roots = await git(["rev-list", "--max-parents=0", "--all"], {
@@ -132,7 +162,7 @@ export namespace Project {
return {
id: "global",
worktree: sandbox,
sandbox: sandbox,
sandbox,
vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
}
}
@@ -147,7 +177,7 @@ export namespace Project {
return {
id: "global",
worktree: sandbox,
sandbox: sandbox,
sandbox,
vcs: "git",
}
}
@@ -161,33 +191,14 @@ export namespace Project {
if (!top) {
return {
id,
sandbox,
worktree: sandbox,
sandbox,
vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
}
}
sandbox = top
const worktree = await git(["rev-parse", "--git-common-dir"], {
cwd: sandbox,
})
.then(async (result) => {
const common = gitpath(sandbox, await result.text())
// Avoid going to parent of sandbox when git-common-dir is empty.
return common === sandbox ? sandbox : path.dirname(common)
})
.catch(() => undefined)
if (!worktree) {
return {
id,
sandbox,
worktree: sandbox,
vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
}
}
return {
id,
sandbox,

View File

@@ -46,6 +46,8 @@ import { GoogleAuth } from "google-auth-library"
import { ProviderTransform } from "./transform"
import { Installation } from "../installation"
const DEFAULT_CHUNK_TIMEOUT = 120_000
export namespace Provider {
const log = Log.create({ service: "provider" })
@@ -85,6 +87,54 @@ export namespace Provider {
})
}
function wrapSSE(res: Response, ms: number, ctl: AbortController) {
if (typeof ms !== "number" || ms <= 0) return res
if (!res.body) return res
if (!res.headers.get("content-type")?.includes("text/event-stream")) return res
const reader = res.body.getReader()
const body = new ReadableStream<Uint8Array>({
async pull(ctrl) {
const part = await new Promise<Awaited<ReturnType<typeof reader.read>>>((resolve, reject) => {
const id = setTimeout(() => {
const err = new Error("SSE read timed out")
ctl.abort(err)
void reader.cancel(err)
reject(err)
}, ms)
reader.read().then(
(part) => {
clearTimeout(id)
resolve(part)
},
(err) => {
clearTimeout(id)
reject(err)
},
)
})
if (part.done) {
ctrl.close()
return
}
ctrl.enqueue(part.value)
},
async cancel(reason) {
ctl.abort(reason)
await reader.cancel(reason)
},
})
return new Response(body, {
headers: new Headers(res.headers),
status: res.status,
statusText: res.statusText,
})
}
const BUNDLED_PROVIDERS: Record<string, (options: any) => SDK> = {
"@ai-sdk/amazon-bedrock": createAmazonBedrock,
"@ai-sdk/anthropic": createAnthropic,
@@ -1092,21 +1142,23 @@ export namespace Provider {
if (existing) return existing
const customFetch = options["fetch"]
const chunkTimeout = options["chunkTimeout"] || DEFAULT_CHUNK_TIMEOUT
delete options["chunkTimeout"]
options["fetch"] = async (input: any, init?: BunFetchRequestInit) => {
// Preserve custom fetch if it exists, wrap it with timeout logic
const fetchFn = customFetch ?? fetch
const opts = init ?? {}
const chunkAbortCtl = typeof chunkTimeout === "number" && chunkTimeout > 0 ? new AbortController() : undefined
const signals: AbortSignal[] = []
if (options["timeout"] !== undefined && options["timeout"] !== null) {
const signals: AbortSignal[] = []
if (opts.signal) signals.push(opts.signal)
if (options["timeout"] !== false) signals.push(AbortSignal.timeout(options["timeout"]))
if (opts.signal) signals.push(opts.signal)
if (chunkAbortCtl) signals.push(chunkAbortCtl.signal)
if (options["timeout"] !== undefined && options["timeout"] !== null && options["timeout"] !== false)
signals.push(AbortSignal.timeout(options["timeout"]))
const combined = signals.length > 1 ? AbortSignal.any(signals) : signals[0]
opts.signal = combined
}
const combined = signals.length === 0 ? null : signals.length === 1 ? signals[0] : AbortSignal.any(signals)
if (combined) opts.signal = combined
// Strip openai itemId metadata following what codex does
// Codex uses #[serde(skip_serializing)] on id fields for all item types:
@@ -1126,11 +1178,14 @@ export namespace Provider {
}
}
return fetchFn(input, {
const res = await fetchFn(input, {
...opts,
// @ts-ignore see here: https://github.com/oven-sh/bun/issues/16682
timeout: false,
})
if (!chunkAbortCtl) return res
return wrapSSE(res, chunkTimeout, chunkAbortCtl)
}
const bundledFn = BUNDLED_PROVIDERS[model.api.npm]

View File

@@ -657,9 +657,21 @@ export namespace ProviderTransform {
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/perplexity
return {}
case "@mymediset/sap-ai-provider":
case "@jerome-benoit/sap-ai-provider-v2":
if (model.api.id.includes("anthropic")) {
if (isAnthropicAdaptive) {
return Object.fromEntries(
adaptiveEfforts.map((effort) => [
effort,
{
thinking: {
type: "adaptive",
},
effort,
},
]),
)
}
return {
high: {
thinking: {
@@ -675,7 +687,26 @@ export namespace ProviderTransform {
},
}
}
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))
if (model.api.id.includes("gemini") && id.includes("2.5")) {
return {
high: {
thinkingConfig: {
includeThoughts: true,
thinkingBudget: 16000,
},
},
max: {
thinkingConfig: {
includeThoughts: true,
thinkingBudget: 24576,
},
},
}
}
if (model.api.id.includes("gpt") || /\bo[1-9]/.test(model.api.id)) {
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))
}
return {}
}
return {}
}

View File

@@ -23,6 +23,8 @@ export namespace Pty {
close: (code?: number, reason?: string) => void
}
const key = (ws: Socket) => (ws.data && typeof ws.data === "object" ? ws.data : ws)
// WebSocket control frame: 0x00 + UTF-8 JSON.
const meta = (cursor: number) => {
const json = JSON.stringify({ cursor })
@@ -97,9 +99,9 @@ export namespace Pty {
try {
session.process.kill()
} catch {}
for (const [key, ws] of session.subscribers.entries()) {
for (const [id, ws] of session.subscribers.entries()) {
try {
if (ws.data === key) ws.close()
if (key(ws) === id) ws.close()
} catch {
// ignore
}
@@ -170,21 +172,21 @@ export namespace Pty {
ptyProcess.onData((chunk) => {
session.cursor += chunk.length
for (const [key, ws] of session.subscribers.entries()) {
for (const [id, ws] of session.subscribers.entries()) {
if (ws.readyState !== 1) {
session.subscribers.delete(key)
session.subscribers.delete(id)
continue
}
if (ws.data !== key) {
session.subscribers.delete(key)
if (key(ws) !== id) {
session.subscribers.delete(id)
continue
}
try {
ws.send(chunk)
} catch {
session.subscribers.delete(key)
session.subscribers.delete(id)
}
}
@@ -226,9 +228,9 @@ export namespace Pty {
try {
session.process.kill()
} catch {}
for (const [key, ws] of session.subscribers.entries()) {
for (const [id, ws] of session.subscribers.entries()) {
try {
if (ws.data === key) ws.close()
if (key(ws) === id) ws.close()
} catch {
// ignore
}
@@ -259,16 +261,13 @@ export namespace Pty {
}
log.info("client connected to session", { id })
// Use ws.data as the unique key for this connection lifecycle.
// If ws.data is undefined, fallback to ws object.
const connectionKey = ws.data && typeof ws.data === "object" ? ws.data : ws
const sub = key(ws)
// Optionally cleanup if the key somehow exists
session.subscribers.delete(connectionKey)
session.subscribers.set(connectionKey, ws)
session.subscribers.delete(sub)
session.subscribers.set(sub, ws)
const cleanup = () => {
session.subscribers.delete(connectionKey)
session.subscribers.delete(sub)
}
const start = session.bufferCursor

View File

@@ -1,14 +1,13 @@
import { Hono } from "hono"
import { describeRoute, validator, resolver } from "hono-openapi"
import { upgradeWebSocket } from "hono/bun"
import type { UpgradeWebSocket } from "hono/ws"
import z from "zod"
import { Pty } from "@/pty"
import { NotFoundError } from "../../storage/db"
import { errors } from "../error"
import { lazy } from "../../util/lazy"
export const PtyRoutes = lazy(() =>
new Hono()
export function PtyRoutes(upgradeWebSocket: UpgradeWebSocket) {
return new Hono()
.get(
"/",
describeRoute({
@@ -196,5 +195,5 @@ export const PtyRoutes = lazy(() =>
},
}
}),
),
)
)
}

View File

@@ -34,7 +34,8 @@ import { ProviderRoutes } from "./routes/provider"
import { InstanceBootstrap } from "../project/bootstrap"
import { NotFoundError } from "../storage/db"
import type { ContentfulStatusCode } from "hono/utils/http-status"
import { websocket } from "hono/bun"
import { createAdaptorServer, type ServerType } from "@hono/node-server"
import { createNodeWebSocket } from "@hono/node-ws"
import { HTTPException } from "hono/http-exception"
import { errors } from "./error"
import { Filesystem } from "@/util/filesystem"
@@ -48,13 +49,20 @@ import { lazy } from "@/util/lazy"
globalThis.AI_SDK_LOG_WARNINGS = false
export namespace Server {
const log = Log.create({ service: "server" })
export type Listener = {
hostname: string
port: number
url: URL
stop: (close?: boolean) => Promise<void>
}
export const Default = lazy(() => createApp({}))
export const Default = lazy(() => create({}).app)
export const createApp = (opts: { cors?: string[] }): Hono => {
function create(opts: { cors?: string[] }) {
const log = Log.create({ service: "server" })
const app = new Hono()
return app
const ws = createNodeWebSocket({ app })
const route = app
.onError((err, c) => {
log.error("failed", {
error: err,
@@ -239,7 +247,6 @@ export namespace Server {
),
)
.route("/project", ProjectRoutes())
.route("/pty", PtyRoutes())
.route("/config", ConfigRoutes())
.route("/experimental", ExperimentalRoutes())
.route("/session", SessionRoutes())
@@ -552,6 +559,7 @@ export namespace Server {
})
},
)
.route("/pty", PtyRoutes(ws.upgradeWebSocket))
.all("/*", async (c) => {
const path = c.req.path
@@ -568,6 +576,11 @@ export namespace Server {
)
return response
})
return {
app: route as Hono,
ws,
}
}
export async function openapi() {
@@ -585,48 +598,86 @@ export namespace Server {
return result
}
export function listen(opts: {
export async function listen(opts: {
port: number
hostname: string
mdns?: boolean
mdnsDomain?: string
cors?: string[]
}) {
const app = createApp(opts)
const args = {
hostname: opts.hostname,
idleTimeout: 0,
fetch: app.fetch,
websocket: websocket,
} as const
const tryServe = (port: number) => {
try {
return Bun.serve({ ...args, port })
} catch {
return undefined
}
}): Promise<Listener> {
const log = Log.create({ service: "server" })
const built = create({
...opts,
})
const start = (port: number) =>
new Promise<ServerType>((resolve, reject) => {
const server = createAdaptorServer({ fetch: built.app.fetch })
built.ws.injectWebSocket(server)
const fail = (err: Error) => {
cleanup()
reject(err)
}
const ready = () => {
cleanup()
resolve(server)
}
const cleanup = () => {
server.off("error", fail)
server.off("listening", ready)
}
server.once("error", fail)
server.once("listening", ready)
server.listen(port, opts.hostname)
})
const server = opts.port === 0 ? await start(4096).catch(() => start(0)) : await start(opts.port)
const addr = server.address()
if (!addr || typeof addr === "string") {
throw new Error(`Failed to resolve server address for port ${opts.port}`)
}
const server = opts.port === 0 ? (tryServe(4096) ?? tryServe(0)) : tryServe(opts.port)
if (!server) throw new Error(`Failed to start server on port ${opts.port}`)
const url = new URL("http://localhost")
url.hostname = opts.hostname
url.port = String(addr.port)
const shouldPublishMDNS =
opts.mdns &&
server.port &&
addr.port &&
opts.hostname !== "127.0.0.1" &&
opts.hostname !== "localhost" &&
opts.hostname !== "::1"
if (shouldPublishMDNS) {
MDNS.publish(server.port!, opts.mdnsDomain)
MDNS.publish(addr.port, opts.mdnsDomain)
} else if (opts.mdns) {
log.warn("mDNS enabled but hostname is loopback; skipping mDNS publish")
}
const originalStop = server.stop.bind(server)
server.stop = async (closeActiveConnections?: boolean) => {
if (shouldPublishMDNS) MDNS.unpublish()
return originalStop(closeActiveConnections)
let closing: Promise<void> | undefined
return {
hostname: opts.hostname,
port: addr.port,
url,
stop(close?: boolean) {
closing ??= new Promise((resolve, reject) => {
if (shouldPublishMDNS) MDNS.unpublish()
server.close((err) => {
if (err) {
reject(err)
return
}
resolve()
})
if (close) {
if ("closeAllConnections" in server && typeof server.closeAllConnections === "function") {
server.closeAllConnections()
}
if ("closeIdleConnections" in server && typeof server.closeIdleConnections === "function") {
server.closeIdleConnections()
}
}
})
return closing
},
}
return server
}
}

View File

@@ -219,6 +219,7 @@ export namespace Session {
parentID: Identifier.schema("session").optional(),
title: z.string().optional(),
permission: Info.shape.permission,
workspaceID: Identifier.schema("workspace").optional(),
})
.optional(),
async (input) => {
@@ -227,6 +228,7 @@ export namespace Session {
directory: Instance.directory,
title: input?.title,
permission: input?.permission,
workspaceID: input?.workspaceID,
})
},
)
@@ -242,6 +244,7 @@ export namespace Session {
const title = getForkedTitle(original.title)
const session = await createNext({
directory: Instance.directory,
workspaceID: original.workspaceID,
title,
})
const msgs = await messages({ sessionID: input.sessionID })
@@ -292,6 +295,7 @@ export namespace Session {
id?: string
title?: string
parentID?: string
workspaceID?: string
directory: string
permission?: PermissionNext.Ruleset
}) {
@@ -301,7 +305,7 @@ export namespace Session {
version: Installation.VERSION,
projectID: Instance.project.id,
directory: input.directory,
workspaceID: WorkspaceContext.workspaceID,
workspaceID: input.workspaceID,
parentID: input.parentID,
title: input.title ?? createDefaultTitle(!!input.parentID),
permission: input.permission,

View File

@@ -413,7 +413,7 @@ export namespace Worktree {
await runStartScripts(info.directory, { projectID, extra })
}
void start().catch((error) => {
return start().catch((error) => {
log.error("worktree start task failed", { directory: info.directory, error })
})
}

View File

@@ -260,6 +260,7 @@ test("env variable takes precedence, config merges options", async () => {
anthropic: {
options: {
timeout: 60000,
chunkTimeout: 15000,
},
},
},
@@ -277,6 +278,7 @@ test("env variable takes precedence, config merges options", async () => {
expect(providers["anthropic"]).toBeDefined()
// Config options should be merged
expect(providers["anthropic"].options.timeout).toBe(60000)
expect(providers["anthropic"].options.chunkTimeout).toBe(15000)
},
})
})

View File

@@ -2479,4 +2479,144 @@ describe("ProviderTransform.variants", () => {
expect(result).toEqual({})
})
})
describe("@jerome-benoit/sap-ai-provider-v2", () => {
test("anthropic models return thinking variants", () => {
const model = createMockModel({
id: "sap-ai-core/anthropic--claude-sonnet-4",
providerID: "sap-ai-core",
api: {
id: "anthropic--claude-sonnet-4",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["high", "max"])
expect(result.high).toEqual({
thinking: {
type: "enabled",
budgetTokens: 16000,
},
})
expect(result.max).toEqual({
thinking: {
type: "enabled",
budgetTokens: 31999,
},
})
})
test("anthropic 4.6 models return adaptive thinking variants", () => {
const model = createMockModel({
id: "sap-ai-core/anthropic--claude-sonnet-4-6",
providerID: "sap-ai-core",
api: {
id: "anthropic--claude-sonnet-4-6",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high", "max"])
expect(result.low).toEqual({
thinking: {
type: "adaptive",
},
effort: "low",
})
expect(result.max).toEqual({
thinking: {
type: "adaptive",
},
effort: "max",
})
})
test("gemini 2.5 models return thinkingConfig variants", () => {
const model = createMockModel({
id: "sap-ai-core/gcp--gemini-2.5-pro",
providerID: "sap-ai-core",
api: {
id: "gcp--gemini-2.5-pro",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["high", "max"])
expect(result.high).toEqual({
thinkingConfig: {
includeThoughts: true,
thinkingBudget: 16000,
},
})
expect(result.max).toEqual({
thinkingConfig: {
includeThoughts: true,
thinkingBudget: 24576,
},
})
})
test("gpt models return reasoningEffort variants", () => {
const model = createMockModel({
id: "sap-ai-core/azure-openai--gpt-4o",
providerID: "sap-ai-core",
api: {
id: "azure-openai--gpt-4o",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})
test("o-series models return reasoningEffort variants", () => {
const model = createMockModel({
id: "sap-ai-core/azure-openai--o3-mini",
providerID: "sap-ai-core",
api: {
id: "azure-openai--o3-mini",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})
test("sonar models return empty object", () => {
const model = createMockModel({
id: "sap-ai-core/perplexity--sonar-pro",
providerID: "sap-ai-core",
api: {
id: "perplexity--sonar-pro",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
})
test("mistral models return empty object", () => {
const model = createMockModel({
id: "sap-ai-core/mistral--mistral-large",
providerID: "sap-ai-core",
api: {
id: "mistral--mistral-large",
url: "https://api.ai.sap",
npm: "@jerome-benoit/sap-ai-provider-v2",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
})
})
})

View File

@@ -1295,6 +1295,7 @@ export class Session2 extends HeyApiClient {
parentID?: string
title?: string
permission?: PermissionRuleset
workspaceID?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -1308,6 +1309,7 @@ export class Session2 extends HeyApiClient {
{ in: "body", key: "parentID" },
{ in: "body", key: "title" },
{ in: "body", key: "permission" },
{ in: "body", key: "workspaceID" },
],
},
],

View File

@@ -1225,7 +1225,11 @@ export type ProviderConfig = {
* Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
*/
timeout?: number | false
[key: string]: unknown | string | boolean | number | false | undefined
/**
* Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.
*/
chunkTimeout?: number
[key: string]: unknown | string | boolean | number | false | number | undefined
}
}
@@ -2764,6 +2768,7 @@ export type SessionCreateData = {
parentID?: string
title?: string
permission?: PermissionRuleset
workspaceID?: string
}
path?: never
query?: {

View File

@@ -1832,6 +1832,10 @@
},
"permission": {
"$ref": "#/components/schemas/PermissionRuleset"
},
"workspaceID": {
"type": "string",
"pattern": "^wrk.*"
}
}
}
@@ -10108,6 +10112,12 @@
"const": false
}
]
},
"chunkTimeout": {
"description": "Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"additionalProperties": {}

View File

@@ -135,25 +135,12 @@ export function generateScale(seed: HexColor, isDark: boolean): HexColor[] {
const scale: HexColor[] = []
const lightSteps = isDark
? [
0.182,
0.21,
0.261,
0.302,
0.341,
0.387,
0.443,
0.514,
base.l,
Math.max(0, base.l - 0.017),
Math.min(0.94, Math.max(0.84, base.l + 0.02)),
0.975,
]
: [0.993, 0.983, 0.962, 0.936, 0.906, 0.866, 0.811, 0.74, base.l, Math.max(0, base.l - 0.036), 0.49, 0.27]
? [0.182, 0.21, 0.261, 0.302, 0.341, 0.387, 0.443, 0.514, base.l, Math.max(0, base.l - 0.017), 0.8, 0.93]
: [0.993, 0.983, 0.962, 0.936, 0.906, 0.866, 0.811, 0.74, base.l, Math.max(0, base.l - 0.036), 0.548, 0.33]
const chromaMultipliers = isDark
? [0.34, 0.45, 0.64, 0.82, 0.96, 1.06, 1.14, 1.2, 1.24, 1.28, 1.34, 1.08]
: [0.12, 0.24, 0.46, 0.68, 0.84, 0.98, 1.08, 1.16, 1.22, 1.26, 1.18, 0.98]
? [0.205, 0.275, 0.46, 0.62, 0.71, 0.79, 0.87, 0.97, 1.04, 1.03, 1, 0.58]
: [0.045, 0.128, 0.34, 0.5, 0.61, 0.69, 0.77, 0.89, 1, 1, 0.97, 0.56]
for (let i = 0; i < 12; i++) {
scale.push(
@@ -168,35 +155,10 @@ export function generateScale(seed: HexColor, isDark: boolean): HexColor[] {
return scale
}
export function generateNeutralScale(seed: HexColor, isDark: boolean, ink?: HexColor): HexColor[] {
if (ink) {
const base = hexToOklch(seed)
const lift = (tone: number) =>
oklchToHex({
l: base.l + (1 - base.l) * tone,
c: base.c * Math.max(0, 1 - tone),
h: base.h,
})
const sink = (tone: number) =>
oklchToHex({
l: base.l * (1 - tone),
c: base.c * Math.max(0, 1 - tone * 0.3),
h: base.h,
})
const bg = isDark
? sink(clamp(0.06 + Math.max(0, base.l - 0.18) * 0.22 + base.c * 1.4, 0.06, 0.14))
: base.l < 0.82
? lift(0.86)
: lift(clamp(0.1 + base.c * 3.2 + Math.max(0, 0.95 - base.l) * 0.35, 0.1, 0.28))
const steps = isDark
? [0, 0.03, 0.055, 0.085, 0.125, 0.18, 0.255, 0.35, 0.5, 0.67, 0.84, 0.975]
: [0, 0.022, 0.042, 0.068, 0.102, 0.146, 0.208, 0.296, 0.432, 0.61, 0.81, 0.965]
return steps.map((step) => mixColors(bg, ink, step))
}
export function generateNeutralScale(seed: HexColor, isDark: boolean): HexColor[] {
const base = hexToOklch(seed)
const scale: HexColor[] = []
const neutralChroma = Math.min(base.c, isDark ? 0.05 : 0.04)
const neutralChroma = Math.min(base.c, 0.02)
const lightSteps = isDark
? [0.2, 0.226, 0.256, 0.277, 0.301, 0.325, 0.364, 0.431, base.l, 0.593, 0.706, 0.946]

View File

@@ -1,11 +1,11 @@
import type { ColorValue, DesktopTheme, HexColor, ResolvedTheme, ThemeVariant } from "./types"
import { blend, generateNeutralScale, generateScale, hexToOklch, hexToRgb, shift, withAlpha } from "./color"
import { blend, generateNeutralScale, generateScale, hexToOklch, oklchToHex, shift, withAlpha } from "./color"
export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): ResolvedTheme {
const colors = getColors(variant)
const { overrides = {} } = variant
const neutral = generateNeutralScale(colors.neutral, isDark, colors.ink)
const neutral = generateNeutralScale(colors.neutral, isDark)
const primary = generateScale(colors.primary, isDark)
const accent = generateScale(colors.accent, isDark)
const success = generateScale(colors.success, isDark)
@@ -39,20 +39,12 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
isDark,
)
const ink = colors.ink ?? colors.neutral
const tint = hasInk ? hexToOklch(ink) : undefined
const body = tint
? shift(ink, {
l: isDark ? Math.max(0, 0.88 - tint.l) * 0.4 : -Math.max(0, tint.l - 0.18) * 0.24,
c: isDark ? 1.04 : 1.02,
})
: undefined
const backgroundOverride = overrides["background-base"]
const backgroundHex = getHex(backgroundOverride)
const overlay = noInk || (Boolean(backgroundOverride) && !backgroundHex)
const content = (seed: HexColor, scale: HexColor[]) => {
const base = hexToOklch(seed)
const value = isDark ? (base.l > 0.84 ? shift(seed, { c: 1.18 }) : scale[10]) : scale[10]
return shift(value, { l: isDark ? 0.034 : -0.024, c: isDark ? 1.3 : 1.18 })
const value = isDark ? seed : hexToOklch(seed).l > 0.82 ? scale[10] : seed
return shift(value, { c: isDark ? 1.16 : 1.1 })
}
const modified = () => {
if (!colors.compact) return isDark ? "#ffba92" : "#FF8C00"
@@ -95,9 +87,9 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
const compactInkBackground =
colors.compact && hasInk && isDark
? {
base: neutral[0],
weak: neutral[1],
strong: neutral[0],
base: neutral[2],
weak: neutral[3],
strong: neutral[1],
stronger: neutral[2],
}
: undefined
@@ -126,40 +118,6 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
)
const neutralAlpha = noInk ? generateNeutralOverlayScale(neutral, isDark) : generateNeutralAlphaScale(neutral, isDark)
const brandb = brandl[isDark ? 9 : 8]
const brandh = brandl[isDark ? 10 : 9]
const interb = interactive[isDark ? 5 : 4]
const interh = interactive[isDark ? 6 : 5]
const interw = interactive[isDark ? 4 : 3]
const succb = success[isDark ? 5 : 4]
const succw = success[isDark ? 4 : 3]
const succs = success[10]
const warnb = (noInk && isDark ? warningl : warning)[isDark ? 5 : 4]
const warnw = (noInk && isDark ? warningl : warning)[isDark ? 4 : 3]
const warns = (noInk && isDark ? warningl : warning)[10]
const critb = error[isDark ? 5 : 4]
const critw = error[isDark ? 4 : 3]
const crits = error[10]
const infob = (noInk && isDark ? infol : info)[isDark ? 5 : 4]
const infow = (noInk && isDark ? infol : info)[isDark ? 4 : 3]
const infos = (noInk && isDark ? infol : info)[10]
const lum = (hex: HexColor) => {
const rgb = hexToRgb(hex)
const lift = (v: number) => (v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4))
return 0.2126 * lift(rgb.r) + 0.7152 * lift(rgb.g) + 0.0722 * lift(rgb.b)
}
const hit = (a: HexColor, b: HexColor) => {
const x = lum(a)
const y = lum(b)
const light = Math.max(x, y)
const dark = Math.min(x, y)
return (light + 0.05) / (dark + 0.05)
}
const on = (fill: HexColor) => {
const light = "#ffffff" as HexColor
const dark = "#000000" as HexColor
return hit(light, fill) > hit(dark, fill) ? light : dark
}
const tokens: ResolvedTheme = {}
@@ -183,8 +141,8 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
: (withAlpha(neutral[3], 0.09) as ColorValue)
tokens["surface-inset-strong-hover"] = tokens["surface-inset-strong"]
tokens["surface-raised-base"] = neutralAlpha[0]
tokens["surface-float-base"] = isDark ? (hasInk ? neutral[1] : neutral[0]) : noInk ? shadow[0] : neutral[11]
tokens["surface-float-base-hover"] = isDark ? (hasInk ? neutral[2] : neutral[1]) : noInk ? shadow[1] : neutral[10]
tokens["surface-float-base"] = isDark ? neutral[0] : noInk ? shadow[0] : neutral[11]
tokens["surface-float-base-hover"] = isDark ? neutral[1] : noInk ? shadow[1] : neutral[10]
tokens["surface-raised-base-hover"] = neutralAlpha[1]
tokens["surface-raised-base-active"] = neutralAlpha[2]
tokens["surface-raised-strong"] = isDark ? neutralAlpha[3] : neutral[0]
@@ -196,26 +154,26 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["surface-strong"] = isDark ? neutralAlpha[6] : "#ffffff"
tokens["surface-raised-stronger-non-alpha"] = isDark ? neutral[2] : "#ffffff"
tokens["surface-brand-base"] = brandb
tokens["surface-brand-hover"] = brandh
tokens["surface-brand-base"] = brandl[8]
tokens["surface-brand-hover"] = brandl[9]
tokens["surface-interactive-base"] = interb
tokens["surface-interactive-hover"] = interh
tokens["surface-interactive-weak"] = interw
tokens["surface-interactive-weak-hover"] = noInk && isDark ? interl[5] : interb
tokens["surface-interactive-base"] = interactive[isDark ? 4 : 3]
tokens["surface-interactive-hover"] = interactive[isDark ? 5 : 4]
tokens["surface-interactive-weak"] = interactive[isDark ? 3 : 2]
tokens["surface-interactive-weak-hover"] = noInk && isDark ? interl[4] : interactive[isDark ? 4 : 3]
tokens["surface-success-base"] = succb
tokens["surface-success-weak"] = succw
tokens["surface-success-strong"] = succs
tokens["surface-warning-base"] = warnb
tokens["surface-warning-weak"] = warnw
tokens["surface-warning-strong"] = warns
tokens["surface-critical-base"] = critb
tokens["surface-critical-weak"] = critw
tokens["surface-critical-strong"] = crits
tokens["surface-info-base"] = infob
tokens["surface-info-weak"] = infow
tokens["surface-info-strong"] = infos
tokens["surface-success-base"] = success[isDark ? 4 : 3]
tokens["surface-success-weak"] = success[isDark ? 3 : 2]
tokens["surface-success-strong"] = success[9]
tokens["surface-warning-base"] = (noInk && isDark ? warningl : warning)[isDark ? 4 : 3]
tokens["surface-warning-weak"] = (noInk && isDark ? warningl : warning)[isDark ? 3 : 2]
tokens["surface-warning-strong"] = (noInk && isDark ? warningl : warning)[9]
tokens["surface-critical-base"] = error[isDark ? 4 : 3]
tokens["surface-critical-weak"] = error[isDark ? 3 : 2]
tokens["surface-critical-strong"] = error[9]
tokens["surface-info-base"] = (noInk && isDark ? infol : info)[isDark ? 4 : 3]
tokens["surface-info-weak"] = (noInk && isDark ? infol : info)[isDark ? 3 : 2]
tokens["surface-info-strong"] = (noInk && isDark ? infol : info)[9]
tokens["surface-diff-unchanged-base"] = isDark ? neutral[0] : "#ffffff00"
tokens["surface-diff-skip-base"] = isDark ? neutralAlpha[0] : neutral[1]
@@ -242,16 +200,16 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["input-focus"] = interactive[0]
tokens["input-disabled"] = neutral[3]
tokens["text-base"] = hasInk ? (body as HexColor) : noInk ? (isDark ? neutralAlpha[10] : neutral[10]) : neutral[10]
tokens["text-base"] = hasInk ? ink : noInk ? (isDark ? neutralAlpha[10] : neutral[10]) : neutral[10]
tokens["text-weak"] = hasInk
? shift(body as HexColor, { l: isDark ? -0.11 : 0.11, c: 0.9 })
? shift(ink, { l: isDark ? -0.18 : 0.16, c: 0.88 })
: noInk
? isDark
? neutralAlpha[8]
: neutral[8]
: neutral[8]
tokens["text-weaker"] = hasInk
? shift(body as HexColor, { l: isDark ? -0.2 : 0.21, c: isDark ? 0.78 : 0.72 })
? shift(ink, { l: isDark ? -0.3 : 0.26, c: isDark ? 0.74 : 0.68 })
: noInk
? isDark
? neutralAlpha[7]
@@ -259,8 +217,8 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
: neutral[7]
tokens["text-strong"] = hasInk
? isDark && colors.compact
? blend("#ffffff", body as HexColor, 0.9)
: shift(body as HexColor, { l: isDark ? 0.055 : -0.07, c: 1.04 })
? blend("#ffffff", ink, 0.82)
: shift(ink, { l: isDark ? 0.06 : -0.09, c: 1 })
: noInk
? isDark
? neutralAlpha[11]
@@ -276,29 +234,29 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["text-invert-weak"] = isDark ? neutral[8] : neutral[2]
tokens["text-invert-weaker"] = isDark ? neutral[7] : neutral[3]
tokens["text-invert-strong"] = isDark ? neutral[11] : neutral[0]
tokens["text-interactive-base"] = interactive[isDark ? 10 : 9]
tokens["text-on-brand-base"] = on(brandb)
tokens["text-on-interactive-base"] = on(interb)
tokens["text-on-interactive-weak"] = on(interb)
tokens["text-on-success-base"] = on(succb)
tokens["text-on-critical-base"] = on(critb)
tokens["text-on-critical-weak"] = on(critb)
tokens["text-on-critical-strong"] = on(crits)
tokens["text-on-warning-base"] = on(warnb)
tokens["text-on-info-base"] = on(infob)
tokens["text-interactive-base"] = interactive[isDark ? 10 : 8]
tokens["text-on-brand-base"] = neutralAlpha[10]
tokens["text-on-interactive-base"] = isDark ? neutral[11] : neutral[0]
tokens["text-on-interactive-weak"] = neutralAlpha[10]
tokens["text-on-success-base"] = success[isDark ? 8 : 9]
tokens["text-on-critical-base"] = error[isDark ? 8 : 9]
tokens["text-on-critical-weak"] = error[7]
tokens["text-on-critical-strong"] = error[11]
tokens["text-on-warning-base"] = neutralAlpha[10]
tokens["text-on-info-base"] = neutralAlpha[10]
tokens["text-diff-add-base"] = diffAdd[10]
tokens["text-diff-delete-base"] = diffDelete[isDark ? 8 : 9]
tokens["text-diff-delete-strong"] = diffDelete[11]
tokens["text-diff-add-strong"] = diffAdd[isDark ? 7 : 11]
tokens["text-on-info-weak"] = on(infob)
tokens["text-on-info-strong"] = on(infos)
tokens["text-on-warning-weak"] = on(warnb)
tokens["text-on-warning-strong"] = on(warns)
tokens["text-on-success-weak"] = on(succb)
tokens["text-on-success-strong"] = on(succs)
tokens["text-on-brand-weak"] = on(brandb)
tokens["text-on-brand-weaker"] = on(brandb)
tokens["text-on-brand-strong"] = on(brandh)
tokens["text-on-info-weak"] = neutralAlpha[8]
tokens["text-on-info-strong"] = neutralAlpha[11]
tokens["text-on-warning-weak"] = neutralAlpha[8]
tokens["text-on-warning-strong"] = neutralAlpha[11]
tokens["text-on-success-weak"] = success[isDark ? 7 : 5]
tokens["text-on-success-strong"] = success[11]
tokens["text-on-brand-weak"] = neutralAlpha[8]
tokens["text-on-brand-weaker"] = neutralAlpha[7]
tokens["text-on-brand-strong"] = neutralAlpha[11]
tokens["button-primary-base"] = neutral[11]
tokens["button-secondary-base"] = noInk ? (isDark ? neutral[1] : neutral[0]) : isDark ? neutral[2] : neutral[0]
@@ -309,27 +267,27 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
if (noInk) {
const tone = (alpha: number) => alphaTone((isDark ? "#ffffff" : "#000000") as HexColor, alpha)
if (isDark) {
tokens["surface-base"] = tone(0.045)
tokens["surface-base-hover"] = tone(0.065)
tokens["surface-base-active"] = tone(0.095)
tokens["surface-raised-base"] = tone(0.085)
tokens["surface-raised-base-hover"] = tone(0.115)
tokens["surface-raised-base-active"] = tone(0.15)
tokens["surface-raised-strong"] = tone(0.115)
tokens["surface-raised-strong-hover"] = tone(0.17)
tokens["surface-raised-stronger"] = tone(0.17)
tokens["surface-raised-stronger-hover"] = tone(0.22)
tokens["surface-weak"] = tone(0.115)
tokens["surface-weaker"] = tone(0.15)
tokens["surface-strong"] = tone(0.22)
tokens["surface-base"] = tone(0.031)
tokens["surface-base-hover"] = tone(0.039)
tokens["surface-base-active"] = tone(0.059)
tokens["surface-raised-base"] = tone(0.059)
tokens["surface-raised-base-hover"] = tone(0.078)
tokens["surface-raised-base-active"] = tone(0.102)
tokens["surface-raised-strong"] = tone(0.078)
tokens["surface-raised-strong-hover"] = tone(0.129)
tokens["surface-raised-stronger"] = tone(0.129)
tokens["surface-raised-stronger-hover"] = tone(0.169)
tokens["surface-weak"] = tone(0.078)
tokens["surface-weaker"] = tone(0.102)
tokens["surface-strong"] = tone(0.169)
tokens["surface-raised-stronger-non-alpha"] = neutral[1]
tokens["surface-inset-base"] = withAlpha("#000000", 0.5) as ColorValue
tokens["surface-inset-base-hover"] = tokens["surface-inset-base"]
tokens["surface-inset-strong"] = withAlpha("#000000", 0.8) as ColorValue
tokens["surface-inset-strong-hover"] = tokens["surface-inset-strong"]
tokens["button-secondary-hover"] = tone(0.065)
tokens["button-ghost-hover"] = tone(0.045)
tokens["button-ghost-hover2"] = tone(0.095)
tokens["button-secondary-hover"] = tone(0.039)
tokens["button-ghost-hover"] = tone(0.031)
tokens["button-ghost-hover2"] = tone(0.059)
tokens["input-base"] = neutral[1]
tokens["input-hover"] = neutral[1]
tokens["input-selected"] = interactive[1]
@@ -337,30 +295,30 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
}
if (!isDark) {
tokens["surface-base"] = tone(0.045)
tokens["surface-base-hover"] = tone(0.08)
tokens["surface-base-active"] = tone(0.105)
tokens["surface-raised-base"] = tone(0.05)
tokens["surface-raised-base-hover"] = tone(0.08)
tokens["surface-raised-base-active"] = tone(0.125)
tokens["surface-base"] = tone(0.031)
tokens["surface-base-hover"] = tone(0.059)
tokens["surface-base-active"] = tone(0.051)
tokens["surface-raised-base"] = tone(0.031)
tokens["surface-raised-base-hover"] = tone(0.051)
tokens["surface-raised-base-active"] = tone(0.09)
tokens["surface-raised-strong"] = neutral[0]
tokens["surface-raised-strong-hover"] = "#ffffff"
tokens["surface-raised-stronger"] = "#ffffff"
tokens["surface-raised-stronger-hover"] = "#ffffff"
tokens["surface-weak"] = tone(0.08)
tokens["surface-weaker"] = tone(0.105)
tokens["surface-weak"] = tone(0.051)
tokens["surface-weaker"] = tone(0.071)
tokens["surface-strong"] = "#ffffff"
tokens["surface-raised-stronger-non-alpha"] = "#ffffff"
tokens["surface-inset-strong"] = tone(0.09)
tokens["surface-inset-strong-hover"] = tokens["surface-inset-strong"]
tokens["button-secondary-hover"] = blend("#ffffff", background, 0.04)
tokens["button-ghost-hover"] = tone(0.045)
tokens["button-ghost-hover2"] = tone(0.08)
tokens["button-ghost-hover"] = tone(0.031)
tokens["button-ghost-hover2"] = tone(0.051)
tokens["input-base"] = neutral[0]
tokens["input-hover"] = neutral[1]
}
tokens["surface-base-interactive-active"] = withAlpha(colors.interactive, isDark ? 0.18 : 0.12) as ColorValue
tokens["surface-base-interactive-active"] = withAlpha(colors.interactive, isDark ? 0.125 : 0.09) as ColorValue
}
tokens["border-base"] = hasInk ? borderTone(0.22, 0.16) : neutralAlpha[6]
@@ -412,25 +370,25 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["border-focus"] = tokens["border-active"]
}
tokens["border-interactive-base"] = (noInk && isDark ? interl : interactive)[7]
tokens["border-interactive-hover"] = (noInk && isDark ? interl : interactive)[8]
tokens["border-interactive-active"] = (noInk && isDark ? interl : interactive)[9]
tokens["border-interactive-selected"] = (noInk && isDark ? interl : interactive)[9]
tokens["border-interactive-base"] = (noInk && isDark ? interl : interactive)[6]
tokens["border-interactive-hover"] = (noInk && isDark ? interl : interactive)[7]
tokens["border-interactive-active"] = (noInk && isDark ? interl : interactive)[8]
tokens["border-interactive-selected"] = (noInk && isDark ? interl : interactive)[8]
tokens["border-interactive-disabled"] = neutral[7]
tokens["border-interactive-focus"] = (noInk && isDark ? interl : interactive)[9]
tokens["border-interactive-focus"] = (noInk && isDark ? interl : interactive)[8]
tokens["border-success-base"] = (noInk && isDark ? successl : success)[6]
tokens["border-success-hover"] = (noInk && isDark ? successl : success)[7]
tokens["border-success-selected"] = (noInk && isDark ? successl : success)[9]
tokens["border-warning-base"] = (noInk && isDark ? warningl : warning)[6]
tokens["border-warning-hover"] = (noInk && isDark ? warningl : warning)[7]
tokens["border-warning-selected"] = (noInk && isDark ? warningl : warning)[9]
tokens["border-critical-base"] = error[isDark ? 5 : 6]
tokens["border-critical-hover"] = error[7]
tokens["border-critical-selected"] = error[9]
tokens["border-info-base"] = (noInk && isDark ? infol : info)[6]
tokens["border-info-hover"] = (noInk && isDark ? infol : info)[7]
tokens["border-info-selected"] = (noInk && isDark ? infol : info)[9]
tokens["border-success-base"] = (noInk && isDark ? successl : success)[5]
tokens["border-success-hover"] = (noInk && isDark ? successl : success)[6]
tokens["border-success-selected"] = (noInk && isDark ? successl : success)[8]
tokens["border-warning-base"] = (noInk && isDark ? warningl : warning)[5]
tokens["border-warning-hover"] = (noInk && isDark ? warningl : warning)[6]
tokens["border-warning-selected"] = (noInk && isDark ? warningl : warning)[8]
tokens["border-critical-base"] = error[isDark ? 4 : 5]
tokens["border-critical-hover"] = error[6]
tokens["border-critical-selected"] = error[8]
tokens["border-info-base"] = (noInk && isDark ? infol : info)[5]
tokens["border-info-hover"] = (noInk && isDark ? infol : info)[6]
tokens["border-info-selected"] = (noInk && isDark ? infol : info)[8]
tokens["border-color"] = "#ffffff"
tokens["icon-base"] = hasInk && !isDark ? tokens["text-weak"] : neutral[isDark ? 9 : 8]
@@ -453,7 +411,7 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["icon-strong-disabled"] = noInk && isDark ? neutral[6] : neutral[7]
tokens["icon-strong-focus"] = isDark ? "#fdfcfc" : "#020202"
tokens["icon-brand-base"] = isDark ? "#ffffff" : neutral[11]
tokens["icon-interactive-base"] = interactive[9]
tokens["icon-interactive-base"] = interactive[8]
tokens["icon-success-base"] = success[isDark ? 8 : 6]
tokens["icon-success-hover"] = success[isDark ? 9 : 7]
tokens["icon-success-active"] = success[10]
@@ -466,28 +424,28 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["icon-info-base"] = info[isDark ? 6 : 6]
tokens["icon-info-hover"] = info[7]
tokens["icon-info-active"] = info[10]
tokens["icon-on-brand-base"] = on(brandb)
tokens["icon-on-brand-hover"] = on(brandh)
tokens["icon-on-brand-selected"] = on(brandh)
tokens["icon-on-interactive-base"] = on(interb)
tokens["icon-on-brand-base"] = neutralAlpha[10]
tokens["icon-on-brand-hover"] = neutralAlpha[11]
tokens["icon-on-brand-selected"] = neutralAlpha[11]
tokens["icon-on-interactive-base"] = isDark ? neutral[11] : neutral[0]
tokens["icon-agent-plan-base"] = info[8]
tokens["icon-agent-docs-base"] = amber[8]
tokens["icon-agent-ask-base"] = blue[8]
tokens["icon-agent-build-base"] = interactive[isDark ? 10 : 8]
tokens["icon-on-success-base"] = on(succb)
tokens["icon-on-success-hover"] = on(succs)
tokens["icon-on-success-selected"] = on(succs)
tokens["icon-on-warning-base"] = on(warnb)
tokens["icon-on-warning-hover"] = on(warns)
tokens["icon-on-warning-selected"] = on(warns)
tokens["icon-on-critical-base"] = on(critb)
tokens["icon-on-critical-hover"] = on(crits)
tokens["icon-on-critical-selected"] = on(crits)
tokens["icon-on-info-base"] = on(infob)
tokens["icon-on-info-hover"] = on(infos)
tokens["icon-on-info-selected"] = on(infos)
tokens["icon-on-success-base"] = withAlpha(success[8], 0.9) as ColorValue
tokens["icon-on-success-hover"] = withAlpha(success[9], 0.9) as ColorValue
tokens["icon-on-success-selected"] = withAlpha(success[10], 0.9) as ColorValue
tokens["icon-on-warning-base"] = withAlpha(amber[8], 0.9) as ColorValue
tokens["icon-on-warning-hover"] = withAlpha(amber[9], 0.9) as ColorValue
tokens["icon-on-warning-selected"] = withAlpha(amber[10], 0.9) as ColorValue
tokens["icon-on-critical-base"] = withAlpha(error[8], 0.9) as ColorValue
tokens["icon-on-critical-hover"] = withAlpha(error[9], 0.9) as ColorValue
tokens["icon-on-critical-selected"] = withAlpha(error[10], 0.9) as ColorValue
tokens["icon-on-info-base"] = info[8]
tokens["icon-on-info-hover"] = withAlpha(info[9], 0.9) as ColorValue
tokens["icon-on-info-selected"] = withAlpha(info[10], 0.9) as ColorValue
tokens["icon-diff-add-base"] = diffAdd[10]
tokens["icon-diff-add-hover"] = diffAdd[isDark ? 9 : 11]
@@ -501,7 +459,7 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["syntax-comment"] = "var(--text-weak)"
tokens["syntax-regexp"] = "var(--text-base)"
tokens["syntax-string"] = isDark ? "#00ceb9" : "#006656"
tokens["syntax-keyword"] = content(colors.accent, accent)
tokens["syntax-keyword"] = "var(--text-weak)"
tokens["syntax-primitive"] = isDark ? "#ffba92" : "#fb4804"
tokens["syntax-operator"] = isDark ? "var(--text-weak)" : "var(--text-base)"
tokens["syntax-variable"] = "var(--text-strong)"
@@ -510,9 +468,9 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["syntax-constant"] = isDark ? "#93e9f6" : "#007b80"
tokens["syntax-punctuation"] = isDark ? "var(--text-weak)" : "var(--text-base)"
tokens["syntax-object"] = "var(--text-strong)"
tokens["syntax-success"] = success[10]
tokens["syntax-warning"] = amber[10]
tokens["syntax-critical"] = error[10]
tokens["syntax-success"] = success[9]
tokens["syntax-warning"] = amber[9]
tokens["syntax-critical"] = error[9]
tokens["syntax-info"] = isDark ? "#93e9f6" : "#0092a8"
tokens["syntax-diff-add"] = diffAdd[10]
tokens["syntax-diff-delete"] = diffDelete[10]
@@ -538,18 +496,18 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["syntax-comment"] = "var(--text-weak)"
tokens["syntax-regexp"] = "var(--text-base)"
tokens["syntax-string"] = content(colors.success, success)
tokens["syntax-keyword"] = content(colors.accent, accent)
tokens["syntax-primitive"] = content(colors.primary, primary)
tokens["syntax-keyword"] = "var(--text-weak)"
tokens["syntax-primitive"] = content(colors.accent, accent)
tokens["syntax-operator"] = isDark ? "var(--text-weak)" : "var(--text-base)"
tokens["syntax-variable"] = "var(--text-strong)"
tokens["syntax-property"] = content(colors.info, info)
tokens["syntax-property"] = content(colors.primary, primary)
tokens["syntax-type"] = content(colors.warning, warning)
tokens["syntax-constant"] = content(colors.accent, accent)
tokens["syntax-constant"] = content(colors.info, info)
tokens["syntax-punctuation"] = isDark ? "var(--text-weak)" : "var(--text-base)"
tokens["syntax-object"] = "var(--text-strong)"
tokens["syntax-success"] = success[10]
tokens["syntax-warning"] = amber[10]
tokens["syntax-critical"] = error[10]
tokens["syntax-success"] = success[9]
tokens["syntax-warning"] = amber[9]
tokens["syntax-critical"] = error[9]
tokens["syntax-info"] = content(colors.info, info)
tokens["syntax-diff-add"] = diffAdd[10]
tokens["syntax-diff-delete"] = diffDelete[10]
@@ -585,9 +543,9 @@ export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): Res
tokens["syntax-constant"] = isDark ? "#93e9f6" : "#007b80"
tokens["syntax-punctuation"] = isDark ? "var(--text-weak)" : "var(--text-base)"
tokens["syntax-object"] = "var(--text-strong)"
tokens["syntax-success"] = success[10]
tokens["syntax-warning"] = amber[10]
tokens["syntax-critical"] = error[10]
tokens["syntax-success"] = success[9]
tokens["syntax-warning"] = amber[9]
tokens["syntax-critical"] = error[9]
tokens["syntax-info"] = isDark ? "#93e9f6" : "#0092a8"
tokens["syntax-diff-add"] = diffAdd[10]
tokens["syntax-diff-delete"] = diffDelete[10]
@@ -719,10 +677,17 @@ function generateNeutralOverlayScale(neutralScale: HexColor[], isDark: boolean):
function generateNeutralAlphaScale(neutralScale: HexColor[], isDark: boolean): HexColor[] {
const alphas = isDark
? [0.05, 0.085, 0.13, 0.18, 0.24, 0.31, 0.4, 0.52, 0.64, 0.76, 0.88, 0.98]
: [0.03, 0.06, 0.1, 0.145, 0.2, 0.265, 0.35, 0.47, 0.61, 0.74, 0.86, 0.97]
? [0.024, 0.048, 0.088, 0.128, 0.17, 0.215, 0.275, 0.38, 0.46, 0.54, 0.74, 0.95]
: [0.014, 0.034, 0.066, 0.098, 0.128, 0.158, 0.208, 0.282, 0.47, 0.625, 0.515, 0.88]
return alphas.map((alpha) => blend(neutralScale[11], neutralScale[0], alpha))
return neutralScale.map((hex, i) => {
const baseOklch = hexToOklch(hex)
const targetL = isDark ? 0.1 + alphas[i] * 0.8 : 1 - alphas[i] * 0.8
return oklchToHex({
...baseOklch,
l: baseOklch.l * alphas[i] + targetL * (1 - alphas[i]),
})
})
}
function getHex(value: ColorValue | undefined): HexColor | undefined {

View File

@@ -16,13 +16,7 @@
"diffDelete": "#f5b3b3"
},
"overrides": {
"syntax-comment": "#8d88a3",
"syntax-keyword": "#7b5ae0",
"syntax-string": "#2b8a57",
"syntax-primitive": "#2f78b8",
"syntax-property": "#a96a22",
"syntax-type": "#2b8a57",
"syntax-constant": "#d94f4f"
"syntax-keyword": "#7b5ae0"
}
},
"dark": {
@@ -39,13 +33,7 @@
"diffDelete": "#ff6767"
},
"overrides": {
"syntax-comment": "#6d6a7e",
"syntax-keyword": "#a277ff",
"syntax-string": "#61ffca",
"syntax-primitive": "#82e2ff",
"syntax-property": "#ffca85",
"syntax-type": "#61ffca",
"syntax-constant": "#ff6767"
"syntax-keyword": "#a277ff"
}
}
}

View File

@@ -16,13 +16,7 @@
"diffDelete": "#e6656a"
},
"overrides": {
"syntax-comment": "#6e7681",
"syntax-keyword": "#c76a1a",
"syntax-string": "#6f8f00",
"syntax-primitive": "#b87500",
"syntax-property": "#2f86b7",
"syntax-type": "#227fc0",
"syntax-constant": "#a37acc"
"syntax-keyword": "#ea9f41"
}
},
"dark": {
@@ -39,13 +33,7 @@
"diffDelete": "#f58572"
},
"overrides": {
"syntax-comment": "#5a6673",
"syntax-keyword": "#ff8f40",
"syntax-string": "#aad94c",
"syntax-primitive": "#ffb454",
"syntax-property": "#39bae6",
"syntax-type": "#59c2ff",
"syntax-constant": "#d2a6ff"
"syntax-keyword": "#ffad66"
}
}
}

View File

@@ -17,13 +17,7 @@
"diffDelete": "#da1e28"
},
"overrides": {
"syntax-comment": "#6f6f6f",
"syntax-keyword": "#8a3ffc",
"syntax-string": "#198038",
"syntax-primitive": "#0f62fe",
"syntax-property": "#0043ce",
"syntax-type": "#8a5f00",
"syntax-constant": "#da1e28"
"syntax-keyword": "#8a3ffc"
}
},
"dark": {
@@ -41,13 +35,7 @@
"diffDelete": "#ff8389"
},
"overrides": {
"syntax-comment": "#6f6f6f",
"syntax-keyword": "#be95ff",
"syntax-string": "#42be65",
"syntax-primitive": "#33b1ff",
"syntax-property": "#78a9ff",
"syntax-type": "#f1c21b",
"syntax-constant": "#ff8389"
"syntax-keyword": "#be95ff"
}
}
}

View File

@@ -16,10 +16,8 @@
"diffDelete": "#e78284"
},
"overrides": {
"syntax-comment": "#6c7086",
"syntax-keyword": "#8839ef",
"syntax-primitive": "#1e66f5",
"syntax-constant": "#ca6702"
"syntax-primitive": "#fe640b"
}
},
"dark": {
@@ -36,10 +34,8 @@
"diffDelete": "#f38ba8"
},
"overrides": {
"syntax-comment": "#6c7086",
"syntax-keyword": "#cba6f7",
"syntax-primitive": "#89b4fa",
"syntax-constant": "#fab387"
"syntax-primitive": "#fab387"
}
}
}

View File

@@ -16,12 +16,9 @@
"diffDelete": "#f8a1b8"
},
"overrides": {
"syntax-comment": "#7d7f97",
"syntax-keyword": "#d16090",
"syntax-string": "#596600",
"syntax-primitive": "#2f8f57",
"syntax-property": "#1d7fc5",
"syntax-constant": "#7c6bf5"
"syntax-primitive": "#7c6bf5"
}
},
"dark": {
@@ -38,12 +35,9 @@
"diffDelete": "#ff6b81"
},
"overrides": {
"syntax-comment": "#6272a4",
"syntax-keyword": "#ff79c6",
"syntax-string": "#f1fa8c",
"syntax-primitive": "#50fa7b",
"syntax-property": "#8be9fd",
"syntax-constant": "#bd93f9"
"syntax-primitive": "#bd93f9"
}
}
}

View File

@@ -16,10 +16,8 @@
"diffDelete": "#9d0006"
},
"overrides": {
"syntax-comment": "#928374",
"syntax-keyword": "#9d0006",
"syntax-primitive": "#076678",
"syntax-constant": "#8f3f71"
"syntax-primitive": "#8f3f71"
}
},
"dark": {
@@ -36,10 +34,8 @@
"diffDelete": "#fb4934"
},
"overrides": {
"syntax-comment": "#928374",
"syntax-keyword": "#fb4934",
"syntax-primitive": "#83a598",
"syntax-constant": "#d3869b"
"syntax-primitive": "#d3869b"
}
}
}

View File

@@ -16,12 +16,9 @@
"diffDelete": "#f6a3ae"
},
"overrides": {
"syntax-comment": "#8a816f",
"syntax-keyword": "#d9487c",
"syntax-string": "#8a6500",
"syntax-primitive": "#3c8d2f",
"syntax-property": "#1f88c8",
"syntax-constant": "#9b5fe0"
"syntax-primitive": "#bf7bff"
}
},
"dark": {
@@ -38,12 +35,9 @@
"diffDelete": "#f4477c"
},
"overrides": {
"syntax-comment": "#75715e",
"syntax-keyword": "#f92672",
"syntax-string": "#e6db74",
"syntax-primitive": "#a6e22e",
"syntax-property": "#66d9ef",
"syntax-constant": "#ae81ff"
"syntax-primitive": "#ae81ff"
}
}
}

View File

@@ -16,10 +16,7 @@
"diffDelete": "#de3d3b"
},
"overrides": {
"syntax-comment": "#7a8181",
"syntax-keyword": "#994cc3",
"syntax-primitive": "#4876d6",
"syntax-constant": "#c96765"
"syntax-keyword": "#994cc3"
}
},
"dark": {
@@ -39,8 +36,7 @@
"syntax-comment": "#637777",
"syntax-keyword": "#c792ea",
"syntax-string": "#ecc48d",
"syntax-primitive": "#82aaff",
"syntax-constant": "#f78c6c"
"syntax-primitive": "#f78c6c"
}
}
}

View File

@@ -16,11 +16,9 @@
"diffDelete": "#bf616a"
},
"overrides": {
"syntax-comment": "#6b7282",
"syntax-keyword": "#5e81ac",
"syntax-string": "#6f8758",
"syntax-primitive": "#5e81ac",
"syntax-constant": "#8d6886"
"syntax-string": "#a3be8c",
"syntax-primitive": "#b48ead"
}
},
"dark": {
@@ -37,10 +35,8 @@
"diffDelete": "#bf616a"
},
"overrides": {
"syntax-comment": "#616e88",
"syntax-keyword": "#81a1c1",
"syntax-primitive": "#88c0d0",
"syntax-constant": "#b48ead"
"syntax-primitive": "#b48ead"
}
}
}

View File

@@ -13,18 +13,6 @@
"interactive": "#034cff",
"diffAdd": "#9ff29a",
"diffDelete": "#fc533a"
},
"overrides": {
"syntax-comment": "#7a7a7a",
"syntax-keyword": "#a753ae",
"syntax-string": "#0c8e12",
"syntax-primitive": "#034cff",
"syntax-property": "#a753ae",
"syntax-type": "#8a6f00",
"syntax-constant": "#007b80",
"syntax-critical": "#ff8c00",
"syntax-diff-delete": "#ff8c00",
"syntax-diff-unknown": "#a753ae"
}
},
"dark": {
@@ -38,18 +26,6 @@
"interactive": "#034cff",
"diffAdd": "#c8ffc4",
"diffDelete": "#fc533a"
},
"overrides": {
"syntax-comment": "#8f8f8f",
"syntax-keyword": "#edb2f1",
"syntax-string": "#12c905",
"syntax-primitive": "#8cb0ff",
"syntax-property": "#fab283",
"syntax-type": "#fcd53a",
"syntax-constant": "#93e9f6",
"syntax-critical": "#fab283",
"syntax-diff-delete": "#fab283",
"syntax-diff-unknown": "#edb2f1"
}
}
}

View File

@@ -16,10 +16,8 @@
"diffDelete": "#f7c1c5"
},
"overrides": {
"syntax-comment": "#6a717d",
"syntax-keyword": "#a626a4",
"syntax-primitive": "#4078f2",
"syntax-constant": "#986801"
"syntax-primitive": "#986801"
}
},
"dark": {
@@ -36,10 +34,8 @@
"diffDelete": "#b2555f"
},
"overrides": {
"syntax-comment": "#5c6370",
"syntax-keyword": "#c678dd",
"syntax-primitive": "#61afef",
"syntax-constant": "#d19a66"
"syntax-primitive": "#d19a66"
}
}
}

View File

@@ -16,13 +16,7 @@
"diffDelete": "#ffc3ef"
},
"overrides": {
"syntax-comment": "#8e4be3",
"syntax-keyword": "#c45f00",
"syntax-string": "#2f8b32",
"syntax-primitive": "#a13bd6",
"syntax-property": "#008fb8",
"syntax-type": "#9d7a00",
"syntax-constant": "#e04d7a"
"syntax-keyword": "#ff6bd5"
}
},
"dark": {
@@ -39,13 +33,7 @@
"diffDelete": "#d85aa0"
},
"overrides": {
"syntax-comment": "#b362ff",
"syntax-keyword": "#ff9d00",
"syntax-string": "#a5ff90",
"syntax-primitive": "#fb94ff",
"syntax-property": "#9effff",
"syntax-type": "#fad000",
"syntax-constant": "#ff628c"
"syntax-keyword": "#ff7ac6"
}
}
}

View File

@@ -16,12 +16,8 @@
"diffDelete": "#f2a1a1"
},
"overrides": {
"syntax-comment": "#657b83",
"syntax-keyword": "#728600",
"syntax-string": "#1f8f88",
"syntax-primitive": "#268bd2",
"syntax-property": "#268bd2",
"syntax-constant": "#d33682"
"syntax-keyword": "#859900",
"syntax-string": "#2aa198"
}
},
"dark": {
@@ -38,12 +34,8 @@
"diffDelete": "#c34b4b"
},
"overrides": {
"syntax-comment": "#586e75",
"syntax-keyword": "#859900",
"syntax-string": "#2aa198",
"syntax-primitive": "#268bd2",
"syntax-property": "#268bd2",
"syntax-constant": "#d33682"
"syntax-string": "#2aa198"
}
}
}

View File

@@ -16,11 +16,7 @@
"diffDelete": "#d05f7c"
},
"overrides": {
"syntax-comment": "#6b6f7a",
"syntax-keyword": "#9854f1",
"syntax-primitive": "#1f6fd4",
"syntax-property": "#007197",
"syntax-constant": "#b15c00"
"syntax-keyword": "#9854f1"
}
},
"dark": {
@@ -37,11 +33,7 @@
"diffDelete": "#c34043"
},
"overrides": {
"syntax-comment": "#565f89",
"syntax-keyword": "#bb9af7",
"syntax-primitive": "#7aa2f7",
"syntax-property": "#7dcfff",
"syntax-constant": "#ff9e64"
"syntax-keyword": "#bb9af7"
}
}
}

View File

@@ -16,13 +16,7 @@
"diffDelete": "#FF8080"
},
"overrides": {
"syntax-comment": "#7a7a7a",
"syntax-keyword": "#6e6e6e",
"syntax-string": "#117e69",
"syntax-primitive": "#8d541c",
"syntax-property": "#101010",
"syntax-type": "#8d541c",
"syntax-constant": "#8d541c"
"syntax-keyword": "#b30000"
}
},
"dark": {
@@ -39,13 +33,8 @@
"diffDelete": "#FF8080"
},
"overrides": {
"syntax-comment": "#8b8b8b",
"syntax-keyword": "#a0a0a0",
"syntax-string": "#99ffe4",
"syntax-primitive": "#ffc799",
"syntax-property": "#ffffff",
"syntax-type": "#ffc799",
"syntax-constant": "#ffc799"
"syntax-keyword": "#ff8080",
"syntax-primitive": "#ffc799"
}
}
}

View File

@@ -244,7 +244,7 @@ You can configure the providers and models you want to use in your OpenCode conf
The `small_model` option configures a separate model for lightweight tasks like title generation. By default, OpenCode tries to use a cheaper model if one is available from your provider, otherwise it falls back to your main model.
Provider options can include `timeout` and `setCacheKey`:
Provider options can include `timeout`, `chunkTimeout`, and `setCacheKey`:
```json title="opencode.json"
{
@@ -253,6 +253,7 @@ Provider options can include `timeout` and `setCacheKey`:
"anthropic": {
"options": {
"timeout": 600000,
"chunkTimeout": 30000,
"setCacheKey": true
}
}
@@ -261,6 +262,7 @@ Provider options can include `timeout` and `setCacheKey`:
```
- `timeout` - Request timeout in milliseconds (default: 300000). Set to `false` to disable.
- `chunkTimeout` - Timeout in milliseconds between streamed response chunks. If no chunk arrives in time, the request is aborted.
- `setCacheKey` - Ensure a cache key is always set for designated provider.
You can also configure [local models](/docs/models#local). [Learn more](/docs/models).