summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGitHub Action <[email protected]>2025-11-08 01:59:02 +0000
committerGitHub Action <[email protected]>2025-11-08 01:59:02 +0000
commit34ff87d504836ff71b3bb2d466842c00ee3c5ec2 (patch)
treecc8ac777f2f082ff676b179017c7dc0f3270314b
parent16357e804145b7f96a2a53badb7dcb6c5453dafe (diff)
downloadopencode-34ff87d504836ff71b3bb2d466842c00ee3c5ec2.tar.gz
opencode-34ff87d504836ff71b3bb2d466842c00ee3c5ec2.zip
chore: format code
-rw-r--r--github/index.ts57
-rw-r--r--infra/console.ts8
-rw-r--r--packages/console/app/src/app.tsx5
-rw-r--r--packages/console/app/src/component/faq.tsx5
-rw-r--r--packages/console/app/src/component/icon.tsx133
-rw-r--r--packages/console/app/src/lib/github.ts5
-rw-r--r--packages/console/app/src/routes/auth/authorize.ts5
-rw-r--r--packages/console/app/src/routes/brand/index.tsx144
-rw-r--r--packages/console/app/src/routes/enterprise/index.tsx57
-rw-r--r--packages/console/app/src/routes/index.tsx778
-rw-r--r--packages/console/app/src/routes/stripe/webhook.ts23
-rw-r--r--packages/console/app/src/routes/temp.tsx10
-rw-r--r--packages/console/app/src/routes/workspace-picker.tsx11
-rw-r--r--packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx32
-rw-r--r--packages/console/app/src/routes/workspace/[id]/billing/monthly-limit-section.tsx8
-rw-r--r--packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx5
-rw-r--r--packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx14
-rw-r--r--packages/console/app/src/routes/workspace/[id]/index.tsx4
-rw-r--r--packages/console/app/src/routes/workspace/[id]/keys/key-section.tsx10
-rw-r--r--packages/console/app/src/routes/workspace/[id]/members/member-section.tsx7
-rw-r--r--packages/console/app/src/routes/workspace/[id]/model-section.tsx13
-rw-r--r--packages/console/app/src/routes/workspace/[id]/new-user-section.tsx15
-rw-r--r--packages/console/app/src/routes/workspace/[id]/provider-section.tsx16
-rw-r--r--packages/console/app/src/routes/workspace/common.tsx5
-rw-r--r--packages/console/app/src/routes/zen/index.tsx132
-rw-r--r--packages/console/app/src/routes/zen/util/handler.ts64
-rw-r--r--packages/console/app/src/routes/zen/util/provider/anthropic.ts26
-rw-r--r--packages/console/app/src/routes/zen/util/provider/openai-compatible.ts31
-rw-r--r--packages/console/app/src/routes/zen/util/provider/openai.ts38
-rw-r--r--packages/console/app/src/routes/zen/v1/models.ts5
-rw-r--r--packages/console/app/src/style/token/font.css3
-rw-r--r--packages/console/core/script/lookup-user.ts13
-rw-r--r--packages/console/core/script/reset-db.ts10
-rw-r--r--packages/console/core/src/aws.ts53
-rw-r--r--packages/console/core/src/drizzle/index.ts10
-rw-r--r--packages/console/core/src/key.ts10
-rw-r--r--packages/console/core/src/model.ts4
-rw-r--r--packages/console/core/src/provider.ts11
-rw-r--r--packages/console/core/src/schema/auth.sql.ts9
-rw-r--r--packages/console/core/src/schema/model.sql.ts5
-rw-r--r--packages/console/core/src/schema/provider.sql.ts5
-rw-r--r--packages/console/core/src/schema/user.sql.ts10
-rw-r--r--packages/console/core/src/user.ts28
-rw-r--r--packages/console/mail/emails/templates/InviteEmail.tsx25
-rw-r--r--packages/function/src/api.ts6
-rwxr-xr-xpackages/opencode/script/build.ts8
-rw-r--r--packages/opencode/script/postinstall.mjs7
-rwxr-xr-xpackages/opencode/script/publish.ts16
-rwxr-xr-xpackages/opencode/script/schema.ts15
-rw-r--r--packages/opencode/src/acp/agent.ts24
-rw-r--r--packages/opencode/src/acp/session.ts6
-rw-r--r--packages/opencode/src/agent/agent.ts18
-rw-r--r--packages/opencode/src/bun/index.ts5
-rw-r--r--packages/opencode/src/bus/index.ts10
-rw-r--r--packages/opencode/src/cli/cmd/auth.ts17
-rw-r--r--packages/opencode/src/cli/cmd/debug/lsp.ts6
-rw-r--r--packages/opencode/src/cli/cmd/debug/ripgrep.ts7
-rw-r--r--packages/opencode/src/cli/cmd/debug/snapshot.ts3
-rw-r--r--packages/opencode/src/cli/cmd/github.ts60
-rw-r--r--packages/opencode/src/cli/cmd/run.ts23
-rw-r--r--packages/opencode/src/cli/cmd/stats.ts19
-rw-r--r--packages/opencode/src/cli/cmd/tui/app.tsx19
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx6
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx4
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx5
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/logo.tsx14
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx33
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx49
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/local.tsx8
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/sync.tsx14
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/theme.tsx8
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/home.tsx15
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx4
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx12
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/header.tsx18
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/index.tsx129
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx18
-rw-r--r--packages/opencode/src/cli/cmd/tui/spawn.ts7
-rw-r--r--packages/opencode/src/cli/cmd/tui/thread.ts4
-rw-r--r--packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx4
-rw-r--r--packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx11
-rw-r--r--packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx24
-rw-r--r--packages/opencode/src/cli/cmd/tui/util/editor.ts5
-rw-r--r--packages/opencode/src/cli/cmd/upgrade.ts4
-rw-r--r--packages/opencode/src/cli/cmd/web.ts6
-rw-r--r--packages/opencode/src/cli/error.ts9
-rw-r--r--packages/opencode/src/config/config.ts159
-rw-r--r--packages/opencode/src/file/fzf.ts4
-rw-r--r--packages/opencode/src/file/index.ts19
-rw-r--r--packages/opencode/src/file/ripgrep.ts11
-rw-r--r--packages/opencode/src/file/time.ts5
-rw-r--r--packages/opencode/src/file/watcher.ts6
-rw-r--r--packages/opencode/src/format/formatter.ts16
-rw-r--r--packages/opencode/src/id/id.ts6
-rw-r--r--packages/opencode/src/ide/index.ts5
-rw-r--r--packages/opencode/src/lsp/client.ts25
-rw-r--r--packages/opencode/src/lsp/index.ts4
-rw-r--r--packages/opencode/src/lsp/server.ts137
-rw-r--r--packages/opencode/src/patch/index.ts28
-rw-r--r--packages/opencode/src/permission/index.ts28
-rw-r--r--packages/opencode/src/project/instance.ts6
-rw-r--r--packages/opencode/src/project/state.ts6
-rw-r--r--packages/opencode/src/provider/provider.ts68
-rw-r--r--packages/opencode/src/provider/transform.ts34
-rw-r--r--packages/opencode/src/server/server.ts22
-rw-r--r--packages/opencode/src/session/compaction.ts39
-rw-r--r--packages/opencode/src/session/index.ts11
-rw-r--r--packages/opencode/src/session/message-v2.ts33
-rw-r--r--packages/opencode/src/session/message.ts23
-rw-r--r--packages/opencode/src/session/prompt.ts60
-rw-r--r--packages/opencode/src/session/revert.ts4
-rw-r--r--packages/opencode/src/session/summary.ts14
-rw-r--r--packages/opencode/src/session/system.ts9
-rw-r--r--packages/opencode/src/session/todo.ts4
-rw-r--r--packages/opencode/src/share/share.ts9
-rw-r--r--packages/opencode/src/snapshot/index.ts25
-rw-r--r--packages/opencode/src/storage/storage.ts20
-rw-r--r--packages/opencode/src/tool/bash.ts9
-rw-r--r--packages/opencode/src/tool/edit.ts30
-rw-r--r--packages/opencode/src/tool/grep.ts10
-rw-r--r--packages/opencode/src/tool/ls.ts9
-rw-r--r--packages/opencode/src/tool/lsp-diagnostics.ts4
-rw-r--r--packages/opencode/src/tool/multiedit.ts9
-rw-r--r--packages/opencode/src/tool/read.ts12
-rw-r--r--packages/opencode/src/tool/task.ts12
-rw-r--r--packages/opencode/src/tool/webfetch.ts10
-rw-r--r--packages/opencode/src/tool/write.ts8
-rw-r--r--packages/opencode/src/util/binary.ts6
-rw-r--r--packages/opencode/src/util/defer.ts4
-rw-r--r--packages/opencode/src/util/eventloop.ts10
-rw-r--r--packages/opencode/src/util/lock.ts7
-rw-r--r--packages/opencode/src/util/log.ts10
-rw-r--r--packages/opencode/src/util/rpc.ts5
-rw-r--r--packages/opencode/src/util/wildcard.ts17
-rw-r--r--packages/opencode/test/config/config.test.ts6
-rw-r--r--packages/opencode/test/ide/ide.test.ts12
-rw-r--r--packages/opencode/test/session/retry.test.ts4
-rw-r--r--packages/opencode/test/tool/patch.test.ts12
-rw-r--r--packages/opencode/test/util/wildcard.test.ts13
-rw-r--r--packages/plugin/src/index.ts5
-rw-r--r--packages/script/src/index.ts11
-rw-r--r--packages/sdk/js/src/gen/client.gen.ts7
-rw-r--r--packages/sdk/js/src/gen/client/client.gen.ts4
-rw-r--r--packages/sdk/js/src/gen/client/types.gen.ts19
-rw-r--r--packages/sdk/js/src/gen/client/utils.gen.ts37
-rw-r--r--packages/sdk/js/src/gen/core/bodySerializer.gen.ts4
-rw-r--r--packages/sdk/js/src/gen/core/pathSerializer.gen.ts12
-rw-r--r--packages/sdk/js/src/gen/core/serverSentEvents.gen.ts6
-rw-r--r--packages/sdk/js/src/gen/core/types.gen.ts11
-rw-r--r--packages/sdk/js/src/gen/core/utils.gen.ts4
-rw-r--r--packages/sdk/js/src/gen/sdk.gen.ts338
-rw-r--r--packages/sdk/js/src/gen/types.gen.ts17
-rw-r--r--packages/sdk/js/src/server.ts16
-rw-r--r--packages/slack/src/index.ts5
-rw-r--r--packages/ui/src/components/checkbox.tsx13
-rw-r--r--packages/ui/src/components/dialog.tsx6
-rw-r--r--packages/ui/src/components/diff-changes.tsx6
-rw-r--r--packages/ui/src/components/diff.tsx22
-rw-r--r--packages/ui/src/components/icon-button.tsx6
-rw-r--r--packages/ui/src/components/input.tsx7
-rw-r--r--packages/ui/src/components/list.tsx8
-rw-r--r--packages/ui/src/components/message-part.tsx21
-rw-r--r--packages/ui/src/components/progress-circle.tsx16
-rw-r--r--packages/ui/src/components/select-dialog.tsx22
-rw-r--r--packages/ui/src/components/select.tsx4
-rw-r--r--packages/ui/src/components/typewriter.tsx6
-rw-r--r--packages/ui/src/demo.tsx24
-rw-r--r--packages/ui/src/hooks/use-filtered-list.tsx8
-rw-r--r--packages/ui/src/styles/base.css4
-rw-r--r--packages/ui/src/styles/theme.css9
-rw-r--r--packages/web/config.mjs3
-rw-r--r--packages/web/src/components/Share.tsx46
-rw-r--r--packages/web/src/components/icons/index.tsx9
-rw-r--r--packages/web/src/components/share/common.tsx7
-rw-r--r--packages/web/src/components/share/content-code.tsx6
-rw-r--r--packages/web/src/components/share/content-diff.tsx20
-rw-r--r--packages/web/src/components/share/copy-button.tsx6
-rw-r--r--packages/web/src/components/share/part.tsx115
-rw-r--r--packages/web/src/content/docs/rules.mdx6
-rwxr-xr-xscript/stats.ts14
-rw-r--r--sdks/vscode/src/extension.ts67
-rw-r--r--theme-test.tsx10
182 files changed, 941 insertions, 3647 deletions
diff --git a/github/index.ts b/github/index.ts
index 789aad898..b681ff92f 100644
--- a/github/index.ts
+++ b/github/index.ts
@@ -171,9 +171,7 @@ try {
const summary = await summarize(response)
await pushToLocalBranch(summary)
}
- const hasShared = prData.comments.nodes.some((c) =>
- c.body.includes(`${useShareUrl()}/s/${shareId}`),
- )
+ const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${useShareUrl()}/s/${shareId}`))
await updateComment(`${response}${footer({ image: !hasShared })}`)
}
// Fork PR
@@ -185,9 +183,7 @@ try {
const summary = await summarize(response)
await pushToForkBranch(summary, prData)
}
- const hasShared = prData.comments.nodes.some((c) =>
- c.body.includes(`${useShareUrl()}/s/${shareId}`),
- )
+ const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${useShareUrl()}/s/${shareId}`))
await updateComment(`${response}${footer({ image: !hasShared })}`)
}
}
@@ -368,9 +364,7 @@ async function getAccessToken() {
if (!response.ok) {
const responseJson = (await response.json()) as { error?: string }
- throw new Error(
- `App token exchange failed: ${response.status} ${response.statusText} - ${responseJson.error}`,
- )
+ throw new Error(`App token exchange failed: ${response.status} ${response.statusText} - ${responseJson.error}`)
}
const responseJson = (await response.json()) as { token: string }
@@ -411,12 +405,8 @@ async function getUserPrompt() {
// ie. <img alt="Image" src="https://github.com/user-attachments/assets/xxxx" />
// ie. [api.json](https://github.com/user-attachments/files/21433810/api.json)
// ie. ![Image](https://github.com/user-attachments/assets/xxxx)
- const mdMatches = prompt.matchAll(
- /!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi,
- )
- const tagMatches = prompt.matchAll(
- /<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi,
- )
+ const mdMatches = prompt.matchAll(/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi)
+ const tagMatches = prompt.matchAll(/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi)
const matches = [...mdMatches, ...tagMatches].sort((a, b) => a.index - b.index)
console.log("Images", JSON.stringify(matches, null, 2))
@@ -443,8 +433,7 @@ async function getUserPrompt() {
// Replace img tag with file path, ie. @image.png
const replacement = `@${filename}`
- prompt =
- prompt.slice(0, start + offset) + replacement + prompt.slice(start + offset + tag.length)
+ prompt = prompt.slice(0, start + offset) + replacement + prompt.slice(start + offset + tag.length)
offset += replacement.length - tag.length
const contentType = res.headers.get("content-type")
@@ -512,12 +501,7 @@ async function subscribeSessionEvents() {
? JSON.stringify(part.state.input)
: "Unknown"
console.log()
- console.log(
- color + `|`,
- "\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`,
- "",
- "\x1b[0m" + title,
- )
+ console.log(color + `|`, "\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`, "", "\x1b[0m" + title)
}
if (part.type === "text") {
@@ -729,8 +713,7 @@ async function assertPermissions() {
throw new Error(`Failed to check permissions for user ${actor}: ${error}`)
}
- if (!["admin", "write"].includes(permission))
- throw new Error(`User ${actor} does not have write permissions`)
+ if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
}
async function updateComment(body: string) {
@@ -774,9 +757,7 @@ function footer(opts?: { image?: boolean }) {
return `<a href="${useShareUrl()}/s/${shareId}"><img width="200" alt="${titleAlt}" src="https://social-cards.sst.dev/opencode-share/${title64}.png?model=${providerID}/${modelID}&version=${session.version}&id=${shareId}" /></a>\n`
})()
- const shareUrl = shareId
- ? `[opencode session](${useShareUrl()}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;`
- : ""
+ const shareUrl = shareId ? `[opencode session](${useShareUrl()}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
return `\n\n${image}${shareUrl}[github run](${useEnvRunUrl()})`
}
@@ -959,13 +940,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
})
.map((c) => `- ${c.author.login} at ${c.createdAt}: ${c.body}`)
- const files = (pr.files.nodes || []).map(
- (f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`,
- )
+ const files = (pr.files.nodes || []).map((f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`)
const reviewData = (pr.reviews.nodes || []).map((r) => {
- const comments = (r.comments.nodes || []).map(
- (c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`,
- )
+ const comments = (r.comments.nodes || []).map((c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`)
return [
`- ${r.author.login} at ${r.submittedAt}:`,
` - Review body: ${r.body}`,
@@ -987,15 +964,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
`Deletions: ${pr.deletions}`,
`Total Commits: ${pr.commits.totalCount}`,
`Changed Files: ${pr.files.nodes.length} files`,
- ...(comments.length > 0
- ? ["<pull_request_comments>", ...comments, "</pull_request_comments>"]
- : []),
- ...(files.length > 0
- ? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"]
- : []),
- ...(reviewData.length > 0
- ? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"]
- : []),
+ ...(comments.length > 0 ? ["<pull_request_comments>", ...comments, "</pull_request_comments>"] : []),
+ ...(files.length > 0 ? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"] : []),
+ ...(reviewData.length > 0 ? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"] : []),
"</pull_request>",
].join("\n")
}
diff --git a/infra/console.ts b/infra/console.ts
index 7fbf92bfd..98cc4c3f0 100644
--- a/infra/console.ts
+++ b/infra/console.ts
@@ -61,13 +61,7 @@ export const auth = new sst.cloudflare.Worker("AuthApi", {
domain: `auth.${domain}`,
handler: "packages/console/function/src/auth.ts",
url: true,
- link: [
- database,
- authStorage,
- GITHUB_CLIENT_ID_CONSOLE,
- GITHUB_CLIENT_SECRET_CONSOLE,
- GOOGLE_CLIENT_ID,
- ],
+ link: [database, authStorage, GITHUB_CLIENT_ID_CONSOLE, GITHUB_CLIENT_SECRET_CONSOLE, GOOGLE_CLIENT_ID],
})
////////////////
diff --git a/packages/console/app/src/app.tsx b/packages/console/app/src/app.tsx
index 7976f6b3b..1cf963642 100644
--- a/packages/console/app/src/app.tsx
+++ b/packages/console/app/src/app.tsx
@@ -12,10 +12,7 @@ export default function App() {
root={(props) => (
<MetaProvider>
<Title>opencode</Title>
- <Meta
- name="description"
- content="OpenCode - The AI coding agent built for the terminal."
- />
+ <Meta name="description" content="OpenCode - The AI coding agent built for the terminal." />
<Suspense>{props.children}</Suspense>
</MetaProvider>
)}
diff --git a/packages/console/app/src/component/faq.tsx b/packages/console/app/src/component/faq.tsx
index 47dca9513..753a0dce4 100644
--- a/packages/console/app/src/component/faq.tsx
+++ b/packages/console/app/src/component/faq.tsx
@@ -13,10 +13,7 @@ export function Faq(props: ParentProps & { question: string }) {
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
- <path
- d="M12.5 11.5H19V12.5H12.5V19H11.5V12.5H5V11.5H11.5V5H12.5V11.5Z"
- fill="currentColor"
- />
+ <path d="M12.5 11.5H19V12.5H12.5V19H11.5V12.5H5V11.5H11.5V5H12.5V11.5Z" fill="currentColor" />
</svg>
<svg
data-slot="faq-icon-minus"
diff --git a/packages/console/app/src/component/icon.tsx b/packages/console/app/src/component/icon.tsx
index d0bce947b..0395cad52 100644
--- a/packages/console/app/src/component/icon.tsx
+++ b/packages/console/app/src/component/icon.tsx
@@ -9,23 +9,10 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
<path d="M13.7124 9.14333V4.5719H18.2838V9.14333H13.7124Z" fill="currentColor" />
<path d="M13.7124 13.7136V9.14221H18.2838V13.7136H13.7124Z" fill="currentColor" />
<path d="M0 18.2857V13.7142H4.57143V18.2857H0Z" fill="currentColor" fill-opacity="0.2" />
- <rect
- width="4.57143"
- height="4.57143"
- transform="translate(4.57178 13.7141)"
- fill="currentColor"
- />
- <path
- d="M4.57178 18.2855V13.7141H9.14321V18.2855H4.57178Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <rect width="4.57143" height="4.57143" transform="translate(4.57178 13.7141)" fill="currentColor" />
+ <path d="M4.57178 18.2855V13.7141H9.14321V18.2855H4.57178Z" fill="currentColor" fill-opacity="0.2" />
<path d="M9.1438 18.2855V13.7141H13.7152V18.2855H9.1438Z" fill="currentColor" />
- <path
- d="M13.7156 18.2855V13.7141H18.287V18.2855H13.7156Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M13.7156 18.2855V13.7141H18.287V18.2855H13.7156Z" fill="currentColor" fill-opacity="0.2" />
<rect width="4.57143" height="4.57143" transform="translate(0 18.2859)" fill="currentColor" />
<path d="M0 22.8572V18.2858H4.57143V22.8572H0Z" fill="currentColor" fill-opacity="0.2" />
<rect
@@ -36,16 +23,8 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
fill-opacity="0.2"
/>
<path d="M4.57178 22.8573V18.2859H9.14321V22.8573H4.57178Z" fill="currentColor" />
- <path
- d="M9.1438 22.8573V18.2859H13.7152V22.8573H9.1438Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M13.7156 22.8573V18.2859H18.287V22.8573H13.7156Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M9.1438 22.8573V18.2859H13.7152V22.8573H9.1438Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M13.7156 22.8573V18.2859H18.287V22.8573H13.7156Z" fill="currentColor" fill-opacity="0.2" />
<path d="M0 27.4292V22.8578H4.57143V27.4292H0Z" fill="currentColor" />
<path d="M4.57178 27.4292V22.8578H9.14321V27.4292H4.57178Z" fill="currentColor" />
<path d="M9.1438 27.4276V22.8562H13.7152V27.4276H9.1438Z" fill="currentColor" />
@@ -61,21 +40,9 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
<path d="M32.001 18.2855V13.7141H36.5724V18.2855H32.001Z" fill="currentColor" />
<path d="M36.5698 18.2855V13.7141H41.1413V18.2855H36.5698Z" fill="currentColor" />
<path d="M22.8572 22.8573V18.2859H27.4286V22.8573H22.8572Z" fill="currentColor" />
- <path
- d="M27.4292 22.8573V18.2859H32.0006V22.8573H27.4292Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M32.001 22.8573V18.2859H36.5724V22.8573H32.001Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M36.5698 22.8573V18.2859H41.1413V22.8573H36.5698Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M27.4292 22.8573V18.2859H32.0006V22.8573H27.4292Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M32.001 22.8573V18.2859H36.5724V22.8573H32.001Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M36.5698 22.8573V18.2859H41.1413V22.8573H36.5698Z" fill="currentColor" fill-opacity="0.2" />
<path d="M22.8572 27.4292V22.8578H27.4286V27.4292H22.8572Z" fill="currentColor" />
<path d="M27.4292 27.4276V22.8562H32.0006V27.4276H27.4292Z" fill="currentColor" />
<path d="M32.001 27.4276V22.8562H36.5724V27.4276H32.001Z" fill="currentColor" />
@@ -86,40 +53,16 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
<path d="M45.7144 13.7136V9.14221H50.2858V13.7136H45.7144Z" fill="currentColor" />
<path d="M59.4299 13.7152V9.1438H64.0014V13.7152H59.4299Z" fill="currentColor" />
<path d="M45.7144 18.2855V13.7141H50.2858V18.2855H45.7144Z" fill="currentColor" />
- <path
- d="M50.2861 18.2857V13.7142H54.8576V18.2857H50.2861Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M54.8579 18.2855V13.7141H59.4293V18.2855H54.8579Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M50.2861 18.2857V13.7142H54.8576V18.2857H50.2861Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M54.8579 18.2855V13.7141H59.4293V18.2855H54.8579Z" fill="currentColor" fill-opacity="0.2" />
<path d="M59.4299 18.2855V13.7141H64.0014V18.2855H59.4299Z" fill="currentColor" />
<path d="M45.7144 22.8573V18.2859H50.2858V22.8573H45.7144Z" fill="currentColor" />
- <path
- d="M50.2861 22.8572V18.2858H54.8576V22.8572H50.2861Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M54.8579 22.8573V18.2859H59.4293V22.8573H54.8579Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M50.2861 22.8572V18.2858H54.8576V22.8572H50.2861Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M54.8579 22.8573V18.2859H59.4293V22.8573H54.8579Z" fill="currentColor" fill-opacity="0.2" />
<path d="M59.4299 22.8573V18.2859H64.0014V22.8573H59.4299Z" fill="currentColor" />
<path d="M45.7144 27.4292V22.8578H50.2858V27.4292H45.7144Z" fill="currentColor" />
- <path
- d="M50.2861 27.4286V22.8572H54.8576V27.4286H50.2861Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
- <path
- d="M54.8579 27.4285V22.8571H59.4293V27.4285H54.8579Z"
- fill="currentColor"
- fill-opacity="0.2"
- />
+ <path d="M50.2861 27.4286V22.8572H54.8576V27.4286H50.2861Z" fill="currentColor" fill-opacity="0.2" />
+ <path d="M54.8579 27.4285V22.8571H59.4293V27.4285H54.8579Z" fill="currentColor" fill-opacity="0.2" />
<path d="M59.4299 27.4292V22.8578H64.0014V27.4292H59.4299Z" fill="currentColor" />
</svg>
)
@@ -127,14 +70,7 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
export function IconCopy(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
- <svg
- {...props}
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg {...props} width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M8.75 8.75V2.75H21.25V15.25H15.25M15.25 8.75H2.75V21.25H15.25V8.75Z"
stroke="currentColor"
@@ -147,20 +83,8 @@ export function IconCopy(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
export function IconCheck(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
- <svg
- {...props}
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M2.75 15.0938L9 20.25L21.25 3.75"
- stroke="#03B000"
- stroke-width="2"
- stroke-linecap="square"
- />
+ <svg {...props} width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M2.75 15.0938L9 20.25L21.25 3.75" stroke="#03B000" stroke-width="2" stroke-linecap="square" />
</svg>
)
}
@@ -189,14 +113,7 @@ export function IconStripe(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
export function IconChevron(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
- <svg
- {...props}
- width="8"
- height="6"
- viewBox="0 0 8 6"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg {...props} width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill="currentColor"
d="M4.00024 5.04041L7.37401 1.66663L6.66691 0.959525L4.00024 3.62619L1.33357 0.959525L0.626465 1.66663L4.00024 5.04041Z"
@@ -207,14 +124,7 @@ export function IconChevron(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
export function IconWorkspaceLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
- <svg
- {...props}
- width="24"
- height="30"
- viewBox="0 0 24 30"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg {...props} width="24" height="30" viewBox="0 0 24 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 6H6V24H18V6ZM24 30H0V0H24V30Z" fill="currentColor" />
</svg>
)
@@ -234,10 +144,7 @@ export function IconOpenAI(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
export function IconAnthropic(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
<svg {...props} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
- <path
- fill="currentColor"
- d="M13.7891 3.93188L20.2223 20.068H23.7502L17.317 3.93188H13.7891Z"
- />
+ <path fill="currentColor" d="M13.7891 3.93188L20.2223 20.068H23.7502L17.317 3.93188H13.7891Z" />
<path
fill="currentColor"
d="M6.32538 13.6827L8.52662 8.01201L10.7279 13.6827H6.32538ZM6.68225 3.93188L0.25 20.068H3.84652L5.16202 16.6794H11.8914L13.2067 20.068H16.8033L10.371 3.93188H6.68225Z"
diff --git a/packages/console/app/src/lib/github.ts b/packages/console/app/src/lib/github.ts
index dab317751..bc49d2e62 100644
--- a/packages/console/app/src/lib/github.ts
+++ b/packages/console/app/src/lib/github.ts
@@ -7,10 +7,7 @@ export const github = query(async () => {
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
}
- const apiBaseUrl = config.github.repoUrl.replace(
- "https://github.com/",
- "https://api.github.com/repos/",
- )
+ const apiBaseUrl = config.github.repoUrl.replace("https://github.com/", "https://api.github.com/repos/")
try {
const [meta, releases, contributors] = await Promise.all([
fetch(apiBaseUrl, { headers }).then((res) => res.json()),
diff --git a/packages/console/app/src/routes/auth/authorize.ts b/packages/console/app/src/routes/auth/authorize.ts
index 293e9ede7..166466ef8 100644
--- a/packages/console/app/src/routes/auth/authorize.ts
+++ b/packages/console/app/src/routes/auth/authorize.ts
@@ -2,9 +2,6 @@ import type { APIEvent } from "@solidjs/start/server"
import { AuthClient } from "~/context/auth"
export async function GET(input: APIEvent) {
- const result = await AuthClient.authorize(
- new URL("./callback", input.request.url).toString(),
- "code",
- )
+ const result = await AuthClient.authorize(new URL("./callback", input.request.url).toString(), "code")
return Response.redirect(result.url, 302)
}
diff --git a/packages/console/app/src/routes/brand/index.tsx b/packages/console/app/src/routes/brand/index.tsx
index 72ea0f150..6aac4517a 100644
--- a/packages/console/app/src/routes/brand/index.tsx
+++ b/packages/console/app/src/routes/brand/index.tsx
@@ -68,13 +68,7 @@ export default function Brand() {
onClick={() => downloadFile(brandAssets, "opencode-brand-assets.zip")}
>
Download all assets
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -90,13 +84,7 @@ export default function Brand() {
<div data-component="actions">
<button onClick={() => downloadFile(logoLightPng, "opencode-logo-light.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -107,13 +95,7 @@ export default function Brand() {
</button>
<button onClick={() => downloadFile(logoLightSvg, "opencode-logo-light.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -129,13 +111,7 @@ export default function Brand() {
<div data-component="actions">
<button onClick={() => downloadFile(logoDarkPng, "opencode-logo-dark.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -146,13 +122,7 @@ export default function Brand() {
</button>
<button onClick={() => downloadFile(logoDarkSvg, "opencode-logo-dark.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -166,17 +136,9 @@ export default function Brand() {
<div>
<img src={previewWordmarkLight} alt="OpenCode brand guidelines" />
<div data-component="actions">
- <button
- onClick={() => downloadFile(wordmarkLightPng, "opencode-wordmark-light.png")}
- >
+ <button onClick={() => downloadFile(wordmarkLightPng, "opencode-wordmark-light.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -185,17 +147,9 @@ export default function Brand() {
/>
</svg>
</button>
- <button
- onClick={() => downloadFile(wordmarkLightSvg, "opencode-wordmark-light.svg")}
- >
+ <button onClick={() => downloadFile(wordmarkLightSvg, "opencode-wordmark-light.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -209,17 +163,9 @@ export default function Brand() {
<div>
<img src={previewWordmarkDark} alt="OpenCode brand guidelines" />
<div data-component="actions">
- <button
- onClick={() => downloadFile(wordmarkDarkPng, "opencode-wordmark-dark.png")}
- >
+ <button onClick={() => downloadFile(wordmarkDarkPng, "opencode-wordmark-dark.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -228,17 +174,9 @@ export default function Brand() {
/>
</svg>
</button>
- <button
- onClick={() => downloadFile(wordmarkDarkSvg, "opencode-wordmark-dark.svg")}
- >
+ <button onClick={() => downloadFile(wordmarkDarkSvg, "opencode-wordmark-dark.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -252,19 +190,9 @@ export default function Brand() {
<div>
<img src={previewWordmarkSimpleLight} alt="OpenCode brand guidelines" />
<div data-component="actions">
- <button
- onClick={() =>
- downloadFile(wordmarkSimpleLightPng, "opencode-wordmark-simple-light.png")
- }
- >
+ <button onClick={() => downloadFile(wordmarkSimpleLightPng, "opencode-wordmark-simple-light.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -273,19 +201,9 @@ export default function Brand() {
/>
</svg>
</button>
- <button
- onClick={() =>
- downloadFile(wordmarkSimpleLightSvg, "opencode-wordmark-simple-light.svg")
- }
- >
+ <button onClick={() => downloadFile(wordmarkSimpleLightSvg, "opencode-wordmark-simple-light.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -299,19 +217,9 @@ export default function Brand() {
<div>
<img src={previewWordmarkSimpleDark} alt="OpenCode brand guidelines" />
<div data-component="actions">
- <button
- onClick={() =>
- downloadFile(wordmarkSimpleDarkPng, "opencode-wordmark-simple-dark.png")
- }
- >
+ <button onClick={() => downloadFile(wordmarkSimpleDarkPng, "opencode-wordmark-simple-dark.png")}>
PNG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
@@ -320,19 +228,9 @@ export default function Brand() {
/>
</svg>
</button>
- <button
- onClick={() =>
- downloadFile(wordmarkSimpleDarkSvg, "opencode-wordmark-simple-dark.svg")
- }
- >
+ <button onClick={() => downloadFile(wordmarkSimpleDarkSvg, "opencode-wordmark-simple-dark.svg")}>
SVG
- <svg
- width="20"
- height="20"
- viewBox="0 0 20 20"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.9583 10.6247L10 14.583L6.04167 10.6247M10 2.08301V13.958M16.25 17.9163H3.75"
stroke="currentColor"
diff --git a/packages/console/app/src/routes/enterprise/index.tsx b/packages/console/app/src/routes/enterprise/index.tsx
index 4bff061a8..095ed97a2 100644
--- a/packages/console/app/src/routes/enterprise/index.tsx
+++ b/packages/console/app/src/routes/enterprise/index.tsx
@@ -66,39 +66,26 @@ export default function Enterprise() {
<div data-component="enterprise-column-1">
<h1>Your code is yours</h1>
<p>
- OpenCode operates securely inside your organization with no data or context stored
- and no licensing restrictions or ownership claims. Start a trial with your team,
- then deploy it across your organization by integrating it with your SSO and
- internal AI gateway.
+ OpenCode operates securely inside your organization with no data or context stored and no licensing
+ restrictions or ownership claims. Start a trial with your team, then deploy it across your
+ organization by integrating it with your SSO and internal AI gateway.
</p>
<p>Let us know and how we can help.</p>
<Show when={false}>
<div data-component="testimonial">
<div data-component="quotation">
- <svg
- width="20"
- height="17"
- viewBox="0 0 20 17"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="20" height="17" viewBox="0 0 20 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M19.4118 0L16.5882 9.20833H20V17H12.2353V10.0938L16 0H19.4118ZM7.17647 0L4.35294 9.20833H7.76471V17H0V10.0938L3.76471 0H7.17647Z"
fill="currentColor"
/>
</svg>
</div>
- Thanks to OpenCode, we found a way to create software to track all our assets —
- even the imaginary ones.
+ Thanks to OpenCode, we found a way to create software to track all our assets — even the imaginary
+ ones.
<div data-component="testimonial-logo">
- <svg
- width="80"
- height="79"
- viewBox="0 0 80 79"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="80" height="79" viewBox="0 0 80 79" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -215,11 +202,7 @@ export default function Enterprise() {
</button>
</form>
- {showSuccess() && (
- <div data-component="success-message">
- Message sent, we'll be in touch soon.
- </div>
- )}
+ {showSuccess() && <div data-component="success-message">Message sent, we'll be in touch soon.</div>}
</div>
</div>
</div>
@@ -232,31 +215,29 @@ export default function Enterprise() {
<ul>
<li>
<Faq question="What is OpenCode Enterprise?">
- OpenCode Enterprise is for organizations that want to ensure that their code and
- data never leaves their infrastructure. It can do this by using a centralized
- config that integrates with your SSO and internal AI gateway.
+ OpenCode Enterprise is for organizations that want to ensure that their code and data never leaves
+ their infrastructure. It can do this by using a centralized config that integrates with your SSO and
+ internal AI gateway.
</Faq>
</li>
<li>
<Faq question="How do I get started with OpenCode Enterprise?">
- Simply start with an internal trial with your team. OpenCode by default does not
- store your code or context data, making it easy to get started. Then contact us to
- discuss pricing and implementation options.
+ Simply start with an internal trial with your team. OpenCode by default does not store your code or
+ context data, making it easy to get started. Then contact us to discuss pricing and implementation
+ options.
</Faq>
</li>
<li>
<Faq question="How does enterprise pricing work?">
- We offer per-seat enterprise pricing. If you have your own LLM gateway, we do not
- charge for tokens used. For further details, contact us for a custom quote based
- on your organization's needs.
+ We offer per-seat enterprise pricing. If you have your own LLM gateway, we do not charge for tokens
+ used. For further details, contact us for a custom quote based on your organization's needs.
</Faq>
</li>
<li>
<Faq question="Is my data secure with OpenCode Enterprise?">
- Yes. OpenCode does not store your code or context data. All processing happens
- locally or through direct API calls to your AI provider. With central config and
- SSO integration, your data remains secure within your organization's
- infrastructure.
+ Yes. OpenCode does not store your code or context data. All processing happens locally or through
+ direct API calls to your AI provider. With central config and SSO integration, your data remains
+ secure within your organization's infrastructure.
</Faq>
</li>
</ul>
diff --git a/packages/console/app/src/routes/index.tsx b/packages/console/app/src/routes/index.tsx
index ee138e140..8b8f44999 100644
--- a/packages/console/app/src/routes/index.tsx
+++ b/packages/console/app/src/routes/index.tsx
@@ -42,10 +42,7 @@ export default function Home() {
return (
<main data-page="opencode">
- <HttpHeader
- name="Cache-Control"
- value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400"
- />
+ <HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" />
<Title>OpenCode | The AI coding agent built for the terminal</Title>
<Link rel="canonical" href={config.baseUrl} />
<Link rel="icon" type="image/svg+xml" href="/favicon.svg" />
@@ -57,27 +54,17 @@ export default function Home() {
<div data-component="content">
<section data-component="hero">
<div data-slot="hero-copy">
- <a
- data-slot="releases"
- href={release()?.url ?? `${config.github.repoUrl}/releases`}
- target="_blank"
- >
+ <a data-slot="releases" href={release()?.url ?? `${config.github.repoUrl}/releases`} target="_blank">
What’s new in {release()?.name ?? "the latest release"}
</a>
<h1>The AI coding agent built for the terminal</h1>
<p>
- OpenCode is fully open source, giving you control and freedom to use any provider,
- any model, and any editor.
+ OpenCode is fully open source, giving you control and freedom to use any provider, any model, and any
+ editor.
</p>
<a href="/docs">
<span>Read docs </span>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M6.5 12L17 12M13 16.5L17.5 12L13 7.5"
stroke="currentColor"
@@ -176,10 +163,7 @@ export default function Home() {
<section data-component="what">
<div data-slot="section-title">
<h3>What is OpenCode?</h3>
- <p>
- OpenCode is an open source agent that helps you write and run code directly from the
- terminal.
- </p>
+ <p>OpenCode is an open source agent that helps you write and run code directly from the terminal.</p>
</div>
<ul>
<li>
@@ -197,8 +181,7 @@ export default function Home() {
<li>
<span>[*]</span>
<div>
- <strong>Multi-session</strong> Start multiple agents in parallel on the same
- project
+ <strong>Multi-session</strong> Start multiple agents in parallel on the same project
</div>
</li>
<li>
@@ -210,15 +193,13 @@ export default function Home() {
<li>
<span>[*]</span>
<div>
- <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max
- account
+ <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max account
</div>
</li>
<li>
<span>[*]</span>
<div>
- <strong>Any model</strong> 75+ LLM providers through Models.dev, including local
- models
+ <strong>Any model</strong> 75+ LLM providers through Models.dev, including local models
</div>
</li>
<li>
@@ -238,21 +219,15 @@ export default function Home() {
<p>
With over <strong>{config.github.starsFormatted.full}</strong> GitHub stars,{" "}
<strong>{config.stats.contributors}</strong> contributors, and almost{" "}
- <strong>{config.stats.commits}</strong> commits, OpenCode is used and trusted by
- over <strong>{config.stats.monthlyUsers}</strong> developers every month.
+ <strong>{config.stats.commits}</strong> commits, OpenCode is used and trusted by over{" "}
+ <strong>{config.stats.monthlyUsers}</strong> developers every month.
</p>
</div>
<div data-component="growth-stats">
<div data-component="growth-stat">
<div data-component="stat-illustration">
- <svg
- width="205"
- height="264"
- viewBox="0 0 205 264"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="205" height="264" viewBox="0 0 205 264" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.5" clip-path="url(#clip0_236_15902)">
<mask
id="mask0_236_15902"
@@ -298,20 +273,13 @@ export default function Home() {
</svg>
</div>
<span>
- <figure>Fig 1.</figure> <strong>{config.github.starsFormatted.compact}</strong>{" "}
- GitHub Stars
+ <figure>Fig 1.</figure> <strong>{config.github.starsFormatted.compact}</strong> GitHub Stars
</span>
</div>
<div data-component="growth-stat">
<div data-component="stat-illustration">
- <svg
- width="205"
- height="264"
- viewBox="0 0 205 264"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="205" height="264" viewBox="0 0 205 264" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.5" clip-path="url(#clip0_236_15557)">
<g clip-path="url(#clip1_236_15557)">
<rect opacity="0.81" width="6" height="6" fill="#CFCECD" />
@@ -440,54 +408,12 @@ export default function Home() {
<rect opacity="0.32" x="70" y="112" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.52" x="84" y="112" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.02" x="98" y="112" width="6" height="6" fill="#CFCECD" />
- <rect
- opacity="0.88"
- x="126"
- y="112"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.12"
- x="140"
- y="112"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.93"
- x="154"
- y="112"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.79"
- x="168"
- y="112"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.24"
- x="182"
- y="112"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.64"
- x="196"
- y="112"
- width="6"
- height="6"
- fill="#CFCECD"
- />
+ <rect opacity="0.88" x="126" y="112" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.12" x="140" y="112" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.93" x="154" y="112" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.79" x="168" y="112" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.24" x="182" y="112" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.64" x="196" y="112" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.57" y="126" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.6" x="14" y="126" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.05" x="28" y="126" width="6" height="6" fill="#BCBBBB" />
@@ -496,55 +422,13 @@ export default function Home() {
<rect opacity="0.93" x="70" y="126" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.63" x="84" y="126" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.58" x="98" y="126" width="6" height="6" fill="#DAD9D9" />
- <rect
- opacity="0.64"
- x="112"
- y="126"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.74"
- x="126"
- y="126"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.74"
- x="140"
- y="126"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.64" x="112" y="126" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.74" x="126" y="126" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.74" x="140" y="126" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.1" x="154" y="126" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.93"
- x="168"
- y="126"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.43"
- x="182"
- y="126"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.45"
- x="196"
- y="126"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
+ <rect opacity="0.93" x="168" y="126" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.43" x="182" y="126" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.45" x="196" y="126" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.77" y="140" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.78" x="14" y="140" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.18" x="28" y="140" width="6" height="6" fill="#DAD9D9" />
@@ -553,55 +437,13 @@ export default function Home() {
<rect opacity="0.53" x="70" y="140" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.06" x="84" y="140" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.81" x="98" y="140" width="6" height="6" fill="#DAD9D9" />
- <rect
- opacity="0.49"
- x="112"
- y="140"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.45"
- x="126"
- y="140"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.37"
- x="140"
- y="140"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.58"
- x="154"
- y="140"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.49" x="112" y="140" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.45" x="126" y="140" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.37" x="140" y="140" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.58" x="154" y="140" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.8" x="168" y="140" width="6" height="6" fill="#BCBBBB" />
- <rect
- opacity="0.35"
- x="182"
- y="140"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.73"
- x="196"
- y="140"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.35" x="182" y="140" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.73" x="196" y="140" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.92" y="154" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.32" x="14" y="154" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.3" x="28" y="154" width="6" height="6" fill="#8E8B8B" />
@@ -610,47 +452,12 @@ export default function Home() {
<rect opacity="0.66" x="70" y="154" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.83" x="84" y="154" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.52" x="98" y="154" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.82"
- x="112"
- y="154"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.95"
- x="126"
- y="154"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.89"
- x="140"
- y="154"
- width="6"
- height="6"
- fill="#CFCECD"
- />
+ <rect opacity="0.82" x="112" y="154" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.95" x="126" y="154" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.89" x="140" y="154" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.2" x="154" y="154" width="6" height="6" fill="#BCBBBB" />
- <rect
- opacity="0.61"
- x="168"
- y="154"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.34"
- x="196"
- y="154"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
+ <rect opacity="0.61" x="168" y="154" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.34" x="196" y="154" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.9" y="168" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.99" x="14" y="168" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.49" x="28" y="168" width="6" height="6" fill="#BCBBBB" />
@@ -659,55 +466,13 @@ export default function Home() {
<rect opacity="0.92" x="70" y="168" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.79" x="84" y="168" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.8" x="98" y="168" width="6" height="6" fill="#BCBBBB" />
- <rect
- opacity="0.74"
- x="112"
- y="168"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.38"
- x="126"
- y="168"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.56"
- x="140"
- y="168"
- width="6"
- height="6"
- fill="#CFCECD"
- />
+ <rect opacity="0.74" x="112" y="168" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.38" x="126" y="168" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.56" x="140" y="168" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.7" x="154" y="168" width="6" height="6" fill="#DAD9D9" />
- <rect
- opacity="0.47"
- x="168"
- y="168"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.92"
- x="182"
- y="168"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.19"
- x="196"
- y="168"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
+ <rect opacity="0.47" x="168" y="168" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.92" x="182" y="168" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.19" x="196" y="168" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.12" y="182" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.16" x="14" y="182" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.98" x="28" y="182" width="6" height="6" fill="#8E8B8B" />
@@ -716,55 +481,13 @@ export default function Home() {
<rect opacity="0.17" x="70" y="182" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.26" x="84" y="182" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.3" x="98" y="182" width="6" height="6" fill="#DAD9D9" />
- <rect
- opacity="0.12"
- x="112"
- y="182"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.31"
- x="126"
- y="182"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.62"
- x="140"
- y="182"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.74"
- x="154"
- y="182"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
+ <rect opacity="0.12" x="112" y="182" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.31" x="126" y="182" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.62" x="140" y="182" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.74" x="154" y="182" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.8" x="168" y="182" width="6" height="6" fill="#CFCECD" />
- <rect
- opacity="0.89"
- x="182"
- y="182"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.75"
- x="196"
- y="182"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
+ <rect opacity="0.89" x="182" y="182" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.75" x="196" y="182" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.1" y="196" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.11" x="14" y="196" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.79" x="28" y="196" width="6" height="6" fill="#BCBBBB" />
@@ -773,62 +496,13 @@ export default function Home() {
<rect opacity="0.31" x="70" y="196" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.33" x="84" y="196" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.2" x="98" y="196" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.21"
- x="112"
- y="196"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.02"
- x="126"
- y="196"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.82"
- x="140"
- y="196"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.28"
- x="154"
- y="196"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.19"
- x="168"
- y="196"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.97"
- x="182"
- y="196"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.45"
- x="196"
- y="196"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
+ <rect opacity="0.21" x="112" y="196" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.02" x="126" y="196" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.82" x="140" y="196" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.28" x="154" y="196" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.19" x="168" y="196" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.97" x="182" y="196" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.45" x="196" y="196" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.88" y="210" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.58" x="14" y="210" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.53" x="28" y="210" width="6" height="6" fill="#BCBBBB" />
@@ -837,55 +511,13 @@ export default function Home() {
<rect opacity="0.73" x="70" y="210" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.87" x="84" y="210" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.35" x="98" y="210" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.61"
- x="112"
- y="210"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.61" x="112" y="210" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.8" x="126" y="210" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.87"
- x="140"
- y="210"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.77"
- x="154"
- y="210"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.94"
- x="168"
- y="210"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.59"
- x="182"
- y="210"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.37"
- x="196"
- y="210"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.87" x="140" y="210" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.77" x="154" y="210" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.94" x="168" y="210" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.59" x="182" y="210" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.37" x="196" y="210" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.7" y="224" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.72" x="14" y="224" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.95" x="28" y="224" width="6" height="6" fill="#CFCECD" />
@@ -895,54 +527,12 @@ export default function Home() {
<rect opacity="0.2" x="84" y="224" width="6" height="6" fill="#BCBBBB" />
<rect opacity="0.63" x="98" y="224" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.5" x="112" y="224" width="6" height="6" fill="#8E8B8B" />
- <rect
- opacity="0.79"
- x="126"
- y="224"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.02"
- x="140"
- y="224"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.17"
- x="154"
- y="224"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.99"
- x="168"
- y="224"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.82"
- x="182"
- y="224"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.28"
- x="196"
- y="224"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
+ <rect opacity="0.79" x="126" y="224" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.02" x="140" y="224" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.17" x="154" y="224" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.99" x="168" y="224" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.82" x="182" y="224" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.28" x="196" y="224" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.76" y="238" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.39" x="14" y="238" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.14" x="28" y="238" width="6" height="6" fill="#8E8B8B" />
@@ -951,62 +541,13 @@ export default function Home() {
<rect opacity="0.13" x="70" y="238" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.35" x="84" y="238" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.13" x="98" y="238" width="6" height="6" fill="#BCBBBB" />
- <rect
- opacity="0.55"
- x="112"
- y="238"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.83"
- x="126"
- y="238"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.86"
- x="140"
- y="238"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.63"
- x="154"
- y="238"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.38"
- x="168"
- y="238"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.57"
- x="182"
- y="238"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.13"
- x="196"
- y="238"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.55" x="112" y="238" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.83" x="126" y="238" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.86" x="140" y="238" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.63" x="154" y="238" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.38" x="168" y="238" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.57" x="182" y="238" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.13" x="196" y="238" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.9" y="252" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.63" x="14" y="252" width="6" height="6" fill="#CFCECD" />
<rect opacity="0.23" x="28" y="252" width="6" height="6" fill="#8E8B8B" />
@@ -1015,54 +556,12 @@ export default function Home() {
<rect opacity="0.19" x="70" y="252" width="6" height="6" fill="#DAD9D9" />
<rect opacity="0.29" x="84" y="252" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.78" x="98" y="252" width="6" height="6" fill="#BCBBBB" />
- <rect
- opacity="0.14"
- x="112"
- y="252"
- width="6"
- height="6"
- fill="#BCBBBB"
- />
- <rect
- opacity="0.64"
- x="126"
- y="252"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
- <rect
- opacity="0.27"
- x="140"
- y="252"
- width="6"
- height="6"
- fill="#CFCECD"
- />
- <rect
- opacity="0.85"
- x="154"
- y="252"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.02"
- x="168"
- y="252"
- width="6"
- height="6"
- fill="#DAD9D9"
- />
- <rect
- opacity="0.29"
- x="182"
- y="252"
- width="6"
- height="6"
- fill="#8E8B8B"
- />
+ <rect opacity="0.14" x="112" y="252" width="6" height="6" fill="#BCBBBB" />
+ <rect opacity="0.64" x="126" y="252" width="6" height="6" fill="#8E8B8B" />
+ <rect opacity="0.27" x="140" y="252" width="6" height="6" fill="#CFCECD" />
+ <rect opacity="0.85" x="154" y="252" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.02" x="168" y="252" width="6" height="6" fill="#DAD9D9" />
+ <rect opacity="0.29" x="182" y="252" width="6" height="6" fill="#8E8B8B" />
<rect opacity="0.4" x="196" y="252" width="6" height="6" fill="#8E8B8B" />
</g>
</g>
@@ -1071,31 +570,19 @@ export default function Home() {
<rect width="205" height="264" fill="white" />
</clipPath>
<clipPath id="clip1_236_15557">
- <rect
- width="236"
- height="264"
- fill="white"
- transform="translate(-0.164062)"
- />
+ <rect width="236" height="264" fill="white" transform="translate(-0.164062)" />
</clipPath>
</defs>
</svg>
</div>
<span>
- <figure>Fig 2.</figure> <strong>{config.stats.contributors}</strong>{" "}
- Contributors
+ <figure>Fig 2.</figure> <strong>{config.stats.contributors}</strong> Contributors
</span>
</div>
<div data-component="growth-stat">
<div data-component="stat-illustration">
- <svg
- width="205"
- height="264"
- viewBox="0 0 205 264"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="205" height="264" viewBox="0 0 205 264" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.5">
<path d="M205 0H203.985V264H205V0Z" fill="#8E8B8B" />
<path d="M197.896 34H196.881V264H197.896V34Z" fill="#8E8B8B" />
@@ -1131,8 +618,7 @@ export default function Home() {
</svg>
</div>
<span>
- <figure>Fig 3.</figure> <strong>{config.stats.monthlyUsers}</strong> Monthly
- Devs
+ <figure>Fig 3.</figure> <strong>{config.stats.monthlyUsers}</strong> Monthly Devs
</span>
</div>
</div>
@@ -1146,9 +632,8 @@ export default function Home() {
<span>[*]</span>
<p>
- OpenCode does not store any of your code or context data, so that it can operate
- in privacy sensitive environments. Learn more about{" "}
- <a href="/docs/enterprise/ ">privacy</a>.
+ OpenCode does not store any of your code or context data, so that it can operate in privacy sensitive
+ environments. Learn more about <a href="/docs/enterprise/ ">privacy</a>.
</p>
</div>
</div>
@@ -1161,9 +646,9 @@ export default function Home() {
<ul>
<li>
<Faq question="What is OpenCode?">
- OpenCode is an open source agent that helps you write and run code directly from
- the terminal. You can pair OpenCode with any AI model, and because it’s
- terminal-based you can pair it with your preferred code editor.
+ OpenCode is an open source agent that helps you write and run code directly from the terminal. You can
+ pair OpenCode with any AI model, and because it’s terminal-based you can pair it with your preferred
+ code editor.
</Faq>
</li>
<li>
@@ -1173,32 +658,30 @@ export default function Home() {
</li>
<li>
<Faq question="Do I need extra AI subscriptions to use OpenCode?">
- Not necessarily, but probably. You’ll need an AI subscription if you want to
- connect OpenCode to a paid provider, although you can work with{" "}
+ Not necessarily, but probably. You’ll need an AI subscription if you want to connect OpenCode to a
+ paid provider, although you can work with{" "}
<a href="/docs/providers/#lm-studio" target="_blank">
local models
</a>{" "}
- for free. While we encourage users to use <A href="/zen">Zen</A>, OpenCode works
- with all popular providers such as OpenAI, Anthropic, xAI etc.
+ for free. While we encourage users to use <A href="/zen">Zen</A>, OpenCode works with all popular
+ providers such as OpenAI, Anthropic, xAI etc.
</Faq>
</li>
<li>
<Faq question="Can I only use OpenCode in the terminal?">
- Yes, for now. We are actively working on a desktop app. Join the waitlist for
- early access.
+ Yes, for now. We are actively working on a desktop app. Join the waitlist for early access.
</Faq>
</li>
<li>
<Faq question="How much does OpenCode cost?">
- OpenCode is 100% free to use. Any additional costs will come from your
- subscription to a model provider. While OpenCode works with any model provider, we
- recommend using <A href="/zen">Zen</A>.
+ OpenCode is 100% free to use. Any additional costs will come from your subscription to a model
+ provider. While OpenCode works with any model provider, we recommend using <A href="/zen">Zen</A>.
</Faq>
</li>
<li>
<Faq question="What about data and privacy?">
- Your data and information is only stored when you create sharable links in
- OpenCode. Learn more about <a href="/docs/share/#privacy">share pages</a>.
+ Your data and information is only stored when you create sharable links in OpenCode. Learn more about{" "}
+ <a href="/docs/share/#privacy">share pages</a>.
</Faq>
</li>
<li>
@@ -1211,8 +694,8 @@ export default function Home() {
<a href={`${config.github.repoUrl}?tab=MIT-1-ov-file#readme`} target="_blank">
MIT License
</a>
- , meaning anyone can use, modify, or contribute to its development. Anyone from
- the community can file issues, submit pull requests, and extend functionality.
+ , meaning anyone can use, modify, or contribute to its development. Anyone from the community can file
+ issues, submit pull requests, and extend functionality.
</Faq>
</li>
</ul>
@@ -1222,19 +705,13 @@ export default function Home() {
<div data-slot="zen-cta-copy">
<strong>Access reliable optimized models for coding agents</strong>
<p>
- Zen gives you access to a handpicked set of AI models that OpenCode has tested and
- benchmarked specifically for coding agents. No need to worry about inconsistent
- performance and quality across providers, use validated models that work.
+ Zen gives you access to a handpicked set of AI models that OpenCode has tested and benchmarked
+ specifically for coding agents. No need to worry about inconsistent performance and quality across
+ providers, use validated models that work.
</p>
<div data-slot="model-logos">
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask
id="mask0_79_128586"
style="mask-type:luminance"
@@ -1255,17 +732,8 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M13.7891 3.93164L20.2223 20.0677H23.7502L17.317 3.93164H13.7891Z"
- fill="currentColor"
- />
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M13.7891 3.93164L20.2223 20.0677H23.7502L17.317 3.93164H13.7891Z" fill="currentColor" />
<path
d="M6.32538 13.6824L8.52662 8.01177L10.7279 13.6824H6.32538ZM6.68225 3.93164L0.25 20.0677H3.84652L5.16202 16.6791H11.8914L13.2067 20.0677H16.8033L10.371 3.93164H6.68225Z"
fill="currentColor"
@@ -1273,13 +741,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M9.16861 16.0529L17.2018 9.85156C17.5957 9.54755 18.1586 9.66612 18.3463 10.1384C19.3339 12.6288 18.8926 15.6217 16.9276 17.6766C14.9626 19.7314 12.2285 20.1821 9.72948 19.1557L6.9995 20.4775C10.9151 23.2763 15.6699 22.5841 18.6411 19.4749C20.9979 17.0103 21.7278 13.6508 21.0453 10.6214L21.0515 10.6278C20.0617 6.17736 21.2948 4.39847 23.8207 0.760904C23.8804 0.674655 23.9402 0.588405 24 0.5L20.6762 3.97585V3.96506L9.16658 16.0551"
fill="currentColor"
@@ -1291,13 +753,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -1307,13 +763,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12.6241 11.346L20.3848 3.44816C20.5309 3.29931 20.4487 3 20.2601 3H16.0842C16.0388 3 15.9949 3.01897 15.9594 3.05541L7.59764 11.5629C7.46721 11.6944 7.27446 11.5771 7.27446 11.3666V3.25183C7.27446 3.11242 7.18515 3 7.07594 3H4.19843C4.08932 3 4 3.11242 4 3.25183V20.7482C4 20.8876 4.08932 21 4.19843 21H7.07594C7.18515 21 7.27446 20.8876 7.27446 20.7482V17.1834C7.27446 17.1073 7.30136 17.0344 7.34815 16.987L9.94075 14.3486C10.0031 14.2853 10.0895 14.2757 10.159 14.3232L17.0934 19.5573C18.2289 20.3412 19.4975 20.8226 20.786 20.9652C20.9008 20.9778 21 20.8606 21 20.7133V17.3559C21 17.2276 20.9249 17.1232 20.8243 17.1073C20.0659 16.9853 19.326 16.6845 18.6569 16.222L12.6538 11.764C12.5291 11.6785 12.5135 11.4584 12.6241 11.346Z"
fill="currentColor"
@@ -1323,13 +773,7 @@ export default function Home() {
</div>
<A href="/zen">
<span>Learn about Zen </span>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M6.5 12L17 12M13 16.5L17.5 12L13 7.5"
stroke="currentColor"
diff --git a/packages/console/app/src/routes/stripe/webhook.ts b/packages/console/app/src/routes/stripe/webhook.ts
index d8d857255..3260f31b2 100644
--- a/packages/console/app/src/routes/stripe/webhook.ts
+++ b/packages/console/app/src/routes/stripe/webhook.ts
@@ -41,8 +41,7 @@ export async function POST(input: APIEvent) {
}
if (body.type === "checkout.session.completed") {
const workspaceID = body.data.object.metadata?.workspaceID
- const amountInCents =
- body.data.object.metadata?.amount && parseInt(body.data.object.metadata?.amount)
+ const amountInCents = body.data.object.metadata?.amount && parseInt(body.data.object.metadata?.amount)
const customerID = body.data.object.customer as string
const paymentID = body.data.object.payment_intent as string
const invoiceID = body.data.object.invoice as string
@@ -55,8 +54,7 @@ export async function POST(input: APIEvent) {
await Actor.provide("system", { workspaceID }, async () => {
const customer = await Billing.get()
- if (customer?.customerID && customer.customerID !== customerID)
- throw new Error("Customer ID mismatch")
+ if (customer?.customerID && customer.customerID !== customerID) throw new Error("Customer ID mismatch")
// set customer metadata
if (!customer?.customerID) {
@@ -72,8 +70,7 @@ export async function POST(input: APIEvent) {
expand: ["payment_method"],
})
const paymentMethod = paymentIntent.payment_method
- if (!paymentMethod || typeof paymentMethod === "string")
- throw new Error("Payment method not expanded")
+ if (!paymentMethod || typeof paymentMethod === "string") throw new Error("Payment method not expanded")
await Database.transaction(async (tx) => {
await tx
@@ -128,12 +125,7 @@ export async function POST(input: APIEvent) {
amount: PaymentTable.amount,
})
.from(PaymentTable)
- .where(
- and(
- eq(PaymentTable.paymentID, paymentIntentID),
- eq(PaymentTable.workspaceID, workspaceID),
- ),
- )
+ .where(and(eq(PaymentTable.paymentID, paymentIntentID), eq(PaymentTable.workspaceID, workspaceID)))
.then((rows) => rows[0]?.amount),
)
if (!amount) throw new Error("Payment not found")
@@ -144,12 +136,7 @@ export async function POST(input: APIEvent) {
.set({
timeRefunded: new Date(body.created * 1000),
})
- .where(
- and(
- eq(PaymentTable.paymentID, paymentIntentID),
- eq(PaymentTable.workspaceID, workspaceID),
- ),
- )
+ .where(and(eq(PaymentTable.paymentID, paymentIntentID), eq(PaymentTable.workspaceID, workspaceID)))
await tx
.update(BillingTable)
diff --git a/packages/console/app/src/routes/temp.tsx b/packages/console/app/src/routes/temp.tsx
index 59987e4d0..b0aef00e7 100644
--- a/packages/console/app/src/routes/temp.tsx
+++ b/packages/console/app/src/routes/temp.tsx
@@ -79,19 +79,17 @@ export default function Home() {
<strong>LSP enabled</strong> Automatically loads the right LSPs for the LLM
</li>
<li>
- <strong>opencode zen</strong> A <a href="/docs/zen">curated list of models</a>{" "}
- provided by opencode <label>New</label>
+ <strong>opencode zen</strong> A <a href="/docs/zen">curated list of models</a> provided by opencode{" "}
+ <label>New</label>
</li>
<li>
<strong>Multi-session</strong> Start multiple agents in parallel on the same project
</li>
<li>
- <strong>Shareable links</strong> Share a link to any sessions for reference or to
- debug
+ <strong>Shareable links</strong> Share a link to any sessions for reference or to debug
</li>
<li>
- <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max
- account
+ <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max account
</li>
<li>
<strong>Use any model</strong> Supports 75+ LLM providers through{" "}
diff --git a/packages/console/app/src/routes/workspace-picker.tsx b/packages/console/app/src/routes/workspace-picker.tsx
index 4e218227c..fa8cf1d21 100644
--- a/packages/console/app/src/routes/workspace-picker.tsx
+++ b/packages/console/app/src/routes/workspace-picker.tsx
@@ -85,10 +85,7 @@ export function WorkspacePicker() {
<Dropdown trigger={currentWorkspace()} align="left">
<For each={workspaces()}>
{(workspace) => (
- <DropdownItem
- selected={workspace.id === params.id}
- onClick={() => handleSelectWorkspace(workspace.id)}
- >
+ <DropdownItem selected={workspace.id === params.id} onClick={() => handleSelectWorkspace(workspace.id)}>
{workspace.name || workspace.slug}
</DropdownItem>
)}
@@ -98,11 +95,7 @@ export function WorkspacePicker() {
</button>
</Dropdown>
- <Modal
- open={store.showForm}
- onClose={() => setStore("showForm", false)}
- title="Create New Workspace"
- >
+ <Modal open={store.showForm} onClose={() => setStore("showForm", false)} title="Create New Workspace">
<form data-slot="create-form" action={createWorkspace} method="post">
<div data-slot="create-input-group">
<input
diff --git a/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
index 9e51bbe10..05f8edd01 100644
--- a/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/billing/billing-section.tsx
@@ -133,8 +133,7 @@ export function BillingSection() {
<div data-slot="section-title">
<h2>Billing</h2>
<p>
- Manage payments methods. <a href="mailto:[email protected]">Contact us</a> if you have any
- questions.
+ Manage payments methods. <a href="mailto:[email protected]">Contact us</a> if you have any questions.
</p>
</div>
<div data-slot="section-content">
@@ -164,32 +163,20 @@ export function BillingSection() {
placeholder="Enter amount"
/>
<div data-slot="form-actions">
- <button
- data-color="ghost"
- type="button"
- onClick={() => hideAddBalanceForm()}
- >
+ <button data-color="ghost" type="button" onClick={() => hideAddBalanceForm()}>
Cancel
</button>
<button
data-color="primary"
type="button"
- disabled={
- !store.addBalanceAmount ||
- checkoutSubmission.pending ||
- store.checkoutRedirecting
- }
+ disabled={!store.addBalanceAmount || checkoutSubmission.pending || store.checkoutRedirecting}
onClick={onClickCheckout}
>
- {checkoutSubmission.pending || store.checkoutRedirecting
- ? "Loading..."
- : "Add"}
+ {checkoutSubmission.pending || store.checkoutRedirecting ? "Loading..." : "Add"}
</button>
</div>
</div>
- <Show
- when={checkoutSubmission.result && (checkoutSubmission.result as any).error}
- >
+ <Show when={checkoutSubmission.result && (checkoutSubmission.result as any).error}>
{(err: any) => <div data-slot="form-error">{err()}</div>}
</Show>
</div>
@@ -210,10 +197,7 @@ export function BillingSection() {
<div data-slot="card-details">
<Switch>
<Match when={billingInfo()?.paymentMethodType === "card"}>
- <Show
- when={billingInfo()?.paymentMethodLast4}
- fallback={<span data-slot="number">----</span>}
- >
+ <Show when={billingInfo()?.paymentMethodLast4} fallback={<span data-slot="number">----</span>}>
<span data-slot="secret">••••</span>
<span data-slot="number">{billingInfo()?.paymentMethodLast4}</span>
</Show>
@@ -241,9 +225,7 @@ export function BillingSection() {
disabled={checkoutSubmission.pending || store.checkoutRedirecting}
onClick={onClickCheckout}
>
- {checkoutSubmission.pending || store.checkoutRedirecting
- ? "Loading..."
- : "Enable Billing"}
+ {checkoutSubmission.pending || store.checkoutRedirecting ? "Loading..." : "Enable Billing"}
</button>
</Show>
</div>
diff --git a/packages/console/app/src/routes/workspace/[id]/billing/monthly-limit-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/monthly-limit-section.tsx
index e6461ac83..77c017964 100644
--- a/packages/console/app/src/routes/workspace/[id]/billing/monthly-limit-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/billing/monthly-limit-section.tsx
@@ -104,13 +104,9 @@ export function MonthlyLimitSection() {
</button>
</Show>
</div>
- <Show
- when={billingInfo()?.monthlyLimit}
- fallback={<p data-slot="usage-status">No usage limit set.</p>}
- >
+ <Show when={billingInfo()?.monthlyLimit} fallback={<p data-slot="usage-status">No usage limit set.</p>}>
<p data-slot="usage-status">
- Current usage for{" "}
- {new Date().toLocaleDateString("en-US", { month: "long", timeZone: "UTC" })} is $
+ Current usage for {new Date().toLocaleDateString("en-US", { month: "long", timeZone: "UTC" })} is $
{(() => {
const dateLastUsed = billingInfo()?.timeMonthlyUsageUpdated
if (!dateLastUsed) return "0"
diff --git a/packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx
index a7218546d..0fb2a0df6 100644
--- a/packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx
@@ -89,10 +89,7 @@ export function PaymentSection() {
<td data-slot="payment-receipt">
<button
onClick={async () => {
- const receiptUrl = await downloadReceiptAction(
- params.id,
- payment.paymentID!,
- )
+ const receiptUrl = await downloadReceiptAction(params.id, payment.paymentID!)
if (receiptUrl) {
window.open(receiptUrl, "_blank")
}
diff --git a/packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx b/packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx
index 50d00ef30..8dcc4da92 100644
--- a/packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/billing/reload-section.tsx
@@ -69,11 +69,7 @@ export function ReloadSection() {
})
createEffect(() => {
- if (
- !setReloadSubmission.pending &&
- setReloadSubmission.result &&
- !(setReloadSubmission.result as any).error
- ) {
+ if (!setReloadSubmission.pending && setReloadSubmission.result && !(setReloadSubmission.result as any).error) {
setStore("show", false)
}
})
@@ -108,8 +104,8 @@ export function ReloadSection() {
}
>
<p>
- Auto reload is <b>enabled</b>. We'll reload <b>${billingInfo()?.reloadAmount}</b>{" "}
- (+$1.23 processing fee) when balance reaches <b>${billingInfo()?.reloadTrigger}</b>.
+ Auto reload is <b>enabled</b>. We'll reload <b>${billingInfo()?.reloadAmount}</b> (+$1.23 processing fee)
+ when balance reaches <b>${billingInfo()?.reloadTrigger}</b>.
</p>
</Show>
<button data-color="primary" type="button" onClick={() => show()}>
@@ -194,8 +190,8 @@ export function ReloadSection() {
minute: "2-digit",
second: "2-digit",
})}
- . Reason: {billingInfo()?.reloadError?.replace(/\.$/, "")}. Please update your payment
- method and try again.
+ . Reason: {billingInfo()?.reloadError?.replace(/\.$/, "")}. Please update your payment method and try
+ again.
</p>
<form action={reload} method="post" data-slot="create-form">
<input type="hidden" name="workspaceID" value={params.id} />
diff --git a/packages/console/app/src/routes/workspace/[id]/index.tsx b/packages/console/app/src/routes/workspace/[id]/index.tsx
index 2e7f7d64b..45f67ca38 100644
--- a/packages/console/app/src/routes/workspace/[id]/index.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/index.tsx
@@ -51,9 +51,7 @@ export default function () {
disabled={checkoutSubmission.pending || store.checkoutRedirecting}
onClick={onClickCheckout}
>
- {checkoutSubmission.pending || store.checkoutRedirecting
- ? "Loading..."
- : "Enable billing"}
+ {checkoutSubmission.pending || store.checkoutRedirecting ? "Loading..." : "Enable billing"}
</button>
}
>
diff --git a/packages/console/app/src/routes/workspace/[id]/keys/key-section.tsx b/packages/console/app/src/routes/workspace/[id]/keys/key-section.tsx
index e1c2c00cf..565981c7f 100644
--- a/packages/console/app/src/routes/workspace/[id]/keys/key-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/keys/key-section.tsx
@@ -146,20 +146,14 @@ export function KeySection() {
title="Copy API key"
>
<span>{key.keyDisplay}</span>
- <Show
- when={copied()}
- fallback={<IconCopy style={{ width: "14px", height: "14px" }} />}
- >
+ <Show when={copied()} fallback={<IconCopy style={{ width: "14px", height: "14px" }} />}>
<IconCheck style={{ width: "14px", height: "14px" }} />
</Show>
</button>
</Show>
</td>
<td data-slot="key-user-email">{key.email}</td>
- <td
- data-slot="key-last-used"
- title={key.timeUsed ? formatDateUTC(key.timeUsed) : undefined}
- >
+ <td data-slot="key-last-used" title={key.timeUsed ? formatDateUTC(key.timeUsed) : undefined}>
{key.timeUsed ? formatDateForTable(key.timeUsed) : "-"}
</td>
<td data-slot="key-actions">
diff --git a/packages/console/app/src/routes/workspace/[id]/members/member-section.tsx b/packages/console/app/src/routes/workspace/[id]/members/member-section.tsx
index 4b2a12fdc..5aa1b969e 100644
--- a/packages/console/app/src/routes/workspace/[id]/members/member-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/members/member-section.tsx
@@ -85,12 +85,7 @@ const updateMember = action(async (form: FormData) => {
)
}, "member.update")
-function MemberRow(props: {
- member: any
- workspaceID: string
- actorID: string
- actorRole: string
-}) {
+function MemberRow(props: { member: any; workspaceID: string; actorID: string; actorRole: string }) {
const submission = useSubmission(updateMember)
const isCurrentUser = () => props.actorID === props.member.id
const isAdmin = () => props.actorRole === "admin"
diff --git a/packages/console/app/src/routes/workspace/[id]/model-section.tsx b/packages/console/app/src/routes/workspace/[id]/model-section.tsx
index 223d69fc8..7a1980ebe 100644
--- a/packages/console/app/src/routes/workspace/[id]/model-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/model-section.tsx
@@ -5,15 +5,7 @@ import { withActor } from "~/context/auth.withActor"
import { ZenData } from "@opencode-ai/console-core/model.js"
import styles from "./model-section.module.css"
import { querySessionInfo } from "../common"
-import {
- IconAlibaba,
- IconAnthropic,
- IconMoonshotAI,
- IconOpenAI,
- IconStealth,
- IconXai,
- IconZai,
-} from "~/component/icon"
+import { IconAlibaba, IconAnthropic, IconMoonshotAI, IconOpenAI, IconStealth, IconXai, IconZai } from "~/component/icon"
const getModelLab = (modelId: string) => {
if (modelId.startsWith("claude")) return "Anthropic"
@@ -76,8 +68,7 @@ export function ModelSection() {
<div data-slot="section-title">
<h2>Models</h2>
<p>
- Manage which models workspace members can access.{" "}
- <a href="/docs/zen#pricing ">Learn more</a>.
+ Manage which models workspace members can access. <a href="/docs/zen#pricing ">Learn more</a>.
</p>
</div>
<div data-slot="models-list">
diff --git a/packages/console/app/src/routes/workspace/[id]/new-user-section.tsx b/packages/console/app/src/routes/workspace/[id]/new-user-section.tsx
index 7b949c661..65edc6847 100644
--- a/packages/console/app/src/routes/workspace/[id]/new-user-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/new-user-section.tsx
@@ -43,24 +43,15 @@ export function NewUserSection() {
<div data-component="feature-grid">
<div data-slot="feature">
<h3>Tested & Verified Models</h3>
- <p>
- We've benchmarked and tested models specifically for coding agents to ensure the best
- performance.
- </p>
+ <p>We've benchmarked and tested models specifically for coding agents to ensure the best performance.</p>
</div>
<div data-slot="feature">
<h3>Highest Quality</h3>
- <p>
- Access models configured for optimal performance - no downgrades or routing to cheaper
- providers.
- </p>
+ <p>Access models configured for optimal performance - no downgrades or routing to cheaper providers.</p>
</div>
<div data-slot="feature">
<h3>No Lock-in</h3>
- <p>
- Use Zen with any coding agent, and continue using other providers with opencode
- whenever you want.
- </p>
+ <p>Use Zen with any coding agent, and continue using other providers with opencode whenever you want.</p>
</div>
</div>
diff --git a/packages/console/app/src/routes/workspace/[id]/provider-section.tsx b/packages/console/app/src/routes/workspace/[id]/provider-section.tsx
index 67314fbdc..5419ed7fb 100644
--- a/packages/console/app/src/routes/workspace/[id]/provider-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/provider-section.tsx
@@ -55,10 +55,7 @@ const listProviders = query(async (workspaceID: string) => {
function ProviderRow(props: { provider: Provider }) {
const params = useParams()
const providers = createAsync(() => listProviders(params.id))
- const saveSubmission = useSubmission(
- saveProvider,
- ([fd]) => fd.get("provider")?.toString() === props.provider.key,
- )
+ const saveSubmission = useSubmission(saveProvider, ([fd]) => fd.get("provider")?.toString() === props.provider.key)
const removeSubmission = useSubmission(
removeProvider,
([fd]) => fd.get("provider")?.toString() === props.provider.key,
@@ -94,16 +91,9 @@ function ProviderRow(props: { provider: Provider }) {
<td data-slot="provider-key">
<Show
when={store.editing}
- fallback={
- <span>{providerData() ? maskCredentials(providerData()!.credentials) : "-"}</span>
- }
+ fallback={<span>{providerData() ? maskCredentials(providerData()!.credentials) : "-"}</span>}
>
- <form
- id={`provider-form-${props.provider.key}`}
- action={saveProvider}
- method="post"
- data-slot="edit-form"
- >
+ <form id={`provider-form-${props.provider.key}`} action={saveProvider} method="post" data-slot="edit-form">
<div data-slot="input-wrapper">
<input
ref={(r) => (input = r)}
diff --git a/packages/console/app/src/routes/workspace/common.tsx b/packages/console/app/src/routes/workspace/common.tsx
index 5b638192c..a6eaaeb1e 100644
--- a/packages/console/app/src/routes/workspace/common.tsx
+++ b/packages/console/app/src/routes/workspace/common.tsx
@@ -67,10 +67,7 @@ export const querySessionInfo = query(async (workspaceID: string) => {
return withActor(() => {
return {
isAdmin: Actor.userRole() === "admin",
- isBeta:
- Resource.App.stage === "production"
- ? workspaceID === "wrk_01K46JDFR0E75SG2Q8K172KF3Y"
- : true,
+ isBeta: Resource.App.stage === "production" ? workspaceID === "wrk_01K46JDFR0E75SG2Q8K172KF3Y" : true,
}
}, workspaceID)
}, "session.get")
diff --git a/packages/console/app/src/routes/zen/index.tsx b/packages/console/app/src/routes/zen/index.tsx
index a096b52d7..4eab4dcb9 100644
--- a/packages/console/app/src/routes/zen/index.tsx
+++ b/packages/console/app/src/routes/zen/index.tsx
@@ -29,10 +29,7 @@ export default function Home() {
createAsync(() => checkLoggedIn())
return (
<main data-page="zen">
- <HttpHeader
- name="Cache-Control"
- value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400"
- />
+ <HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" />
<Title>OpenCode Zen | A curated set of reliable optimized models for coding agents</Title>
<Link rel="canonical" href={`${config.baseUrl}/zen`} />
<Link rel="icon" type="image/svg+xml" href="/favicon-zen.svg" />
@@ -49,19 +46,13 @@ export default function Home() {
<img data-slot="zen logo dark" src={zenLogoDark} alt="zen logo dark" />
<h1>Reliable optimized models for coding agents</h1>
<p>
- Zen gives you access to a curated set of AI models that OpenCode has tested and
- benchmarked specifically for coding agents. No need to worry about inconsistent
- performance and quality, use validated models that work.
+ Zen gives you access to a curated set of AI models that OpenCode has tested and benchmarked specifically
+ for coding agents. No need to worry about inconsistent performance and quality, use validated models
+ that work.
</p>
<div data-slot="model-logos">
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask
id="mask0_79_128586"
style="mask-type:luminance"
@@ -82,17 +73,8 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M13.7891 3.93164L20.2223 20.0677H23.7502L17.317 3.93164H13.7891Z"
- fill="currentColor"
- />
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M13.7891 3.93164L20.2223 20.0677H23.7502L17.317 3.93164H13.7891Z" fill="currentColor" />
<path
d="M6.32538 13.6824L8.52662 8.01177L10.7279 13.6824H6.32538ZM6.68225 3.93164L0.25 20.0677H3.84652L5.16202 16.6791H11.8914L13.2067 20.0677H16.8033L10.371 3.93164H6.68225Z"
fill="currentColor"
@@ -100,13 +82,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M9.16861 16.0529L17.2018 9.85156C17.5957 9.54755 18.1586 9.66612 18.3463 10.1384C19.3339 12.6288 18.8926 15.6217 16.9276 17.6766C14.9626 19.7314 12.2285 20.1821 9.72948 19.1557L6.9995 20.4775C10.9151 23.2763 15.6699 22.5841 18.6411 19.4749C20.9979 17.0103 21.7278 13.6508 21.0453 10.6214L21.0515 10.6278C20.0617 6.17736 21.2948 4.39847 23.8207 0.760904C23.8804 0.674655 23.9402 0.588405 24 0.5L20.6762 3.97585V3.96506L9.16658 16.0551"
fill="currentColor"
@@ -118,13 +94,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
@@ -134,13 +104,7 @@ export default function Home() {
</svg>
</div>
<div>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12.6241 11.346L20.3848 3.44816C20.5309 3.29931 20.4487 3 20.2601 3H16.0842C16.0388 3 15.9949 3.01897 15.9594 3.05541L7.59764 11.5629C7.46721 11.6944 7.27446 11.5771 7.27446 11.3666V3.25183C7.27446 3.11242 7.18515 3 7.07594 3H4.19843C4.08932 3 4 3.11242 4 3.25183V20.7482C4 20.8876 4.08932 21 4.19843 21H7.07594C7.18515 21 7.27446 20.8876 7.27446 20.7482V17.1834C7.27446 17.1073 7.30136 17.0344 7.34815 16.987L9.94075 14.3486C10.0031 14.2853 10.0895 14.2757 10.159 14.3232L17.0934 19.5573C18.2289 20.3412 19.4975 20.8226 20.786 20.9652C20.9008 20.9778 21 20.8606 21 20.7133V17.3559C21 17.2276 20.9249 17.1232 20.8243 17.1073C20.0659 16.9853 19.326 16.6845 18.6569 16.222L12.6538 11.764C12.5291 11.6785 12.5135 11.4584 12.6241 11.346Z"
fill="currentColor"
@@ -150,13 +114,7 @@ export default function Home() {
</div>
<a href="/auth">
<span>Get started with Zen </span>
- <svg
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M6.5 12L17 12M13 16.5L17.5 12L13 7.5"
stroke="currentColor"
@@ -168,23 +126,14 @@ export default function Home() {
</div>
<div data-slot="pricing-copy">
<p>
- <strong>Add $20 Pay as you go balance</strong>{" "}
- <span>(+$1.23 card processing fee)</span>
+ <strong>Add $20 Pay as you go balance</strong> <span>(+$1.23 card processing fee)</span>
</p>
<p>Use with any agent. Set monthly spend limits. Cancel any time.</p>
</div>
</section>
<section data-component="comparison">
- <video
- src={compareVideo}
- autoplay
- playsinline
- loop
- muted
- preload="auto"
- poster={compareVideoPoster}
- >
+ <video src={compareVideo} autoplay playsinline loop muted preload="auto" poster={compareVideoPoster}>
Your browser does not support the video tag.
</video>
</section>
@@ -193,8 +142,8 @@ export default function Home() {
<div data-slot="section-title">
<h3>What problem is Zen solving?</h3>
<p>
- There are so many models available, but only a few work well with coding agents.
- Most providers configure them differently with varying results.
+ There are so many models available, but only a few work well with coding agents. Most providers
+ configure them differently with varying results.
</p>
</div>
<p>We're fixing this for everyone, not just OpenCode users.</p>
@@ -229,15 +178,14 @@ export default function Home() {
<li>
<span>[2]</span>
<div>
- <strong>Use Zen with transparent pricing</strong> -{" "}
- <a href="/docs/zen/#pricing">pay per request</a> with zero markups
+ <strong>Use Zen with transparent pricing</strong> - <a href="/docs/zen/#pricing">pay per request</a>{" "}
+ with zero markups
</div>
</li>
<li>
<span>[3]</span>
<div>
- <strong>Auto-top up</strong> - when your balance reaches $5 we’ll automatically
- add $20
+ <strong>Auto-top up</strong> - when your balance reaches $5 we’ll automatically add $20
</div>
</li>
</ul>
@@ -249,9 +197,8 @@ export default function Home() {
<div>
<span>[*]</span>
<p>
- All Zen models are hosted in the US. Providers follow a zero-retention policy and
- do not use your data for model training, with the{" "}
- <a href="/docs/zen/#privacy">following exceptions</a>.
+ All Zen models are hosted in the US. Providers follow a zero-retention policy and do not use your data
+ for model training, with the <a href="/docs/zen/#privacy">following exceptions</a>.
</p>
</div>
</div>
@@ -306,8 +253,7 @@ export default function Home() {
<span>ex-Head of Design, Laravel</span>
</div>
<div data-slot="quote">
- With <span>@OpenCode</span> Zen I know all the models are tested and perfect for
- coding agents.
+ With <span>@OpenCode</span> Zen I know all the models are tested and perfect for coding agents.
</div>
</div>
</a>
@@ -331,44 +277,38 @@ export default function Home() {
<ul>
<li>
<Faq question="What is OpenCode Zen?">
- Zen is a curated set of AI models tested and benchmarked for coding agents created
- by the team behind OpenCode.
+ Zen is a curated set of AI models tested and benchmarked for coding agents created by the team behind
+ OpenCode.
</Faq>
</li>
<li>
<Faq question="What makes Zen more accurate?">
- Zen only provides models that have been specifically tested and benchmarked for
- coding agents. You wouldn’t use a butter knife to cut steak, don’t use poor models
- for coding.
+ Zen only provides models that have been specifically tested and benchmarked for coding agents. You
+ wouldn’t use a butter knife to cut steak, don’t use poor models for coding.
</Faq>
</li>
<li>
<Faq question="Is Zen cheaper?">
- Zen is not for profit. Zen passes through the costs from the model providers to
- you. The higher Zen’s usage the more OpenCode can negotiate better rates and pass
- those to you.
+ Zen is not for profit. Zen passes through the costs from the model providers to you. The higher Zen’s
+ usage the more OpenCode can negotiate better rates and pass those to you.
</Faq>
</li>
<li>
<Faq question="How much does Zen cost?">
- Zen <a href="/docs/zen/#pricing">charges per request</a> with zero markups, so you
- pay exactly what the model provider charges. Your total cost depends on usage, and
- you can set monthly spend limits in your <a href="/auth">account</a>. To cover
- costs, OpenCode adds only a small payment processing fee of $1.23 per $20 balance
- top-up.
+ Zen <a href="/docs/zen/#pricing">charges per request</a> with zero markups, so you pay exactly what
+ the model provider charges. Your total cost depends on usage, and you can set monthly spend limits in
+ your <a href="/auth">account</a>. To cover costs, OpenCode adds only a small payment processing fee of
+ $1.23 per $20 balance top-up.
</Faq>
</li>
<li>
<Faq question="What about data and privacy?">
- All Zen models are hosted in the US. Providers follow a zero-retention policy and
- do not use your data for model training, with the{" "}
- <a href="/docs/zen/#privacy">following exceptions</a>.
+ All Zen models are hosted in the US. Providers follow a zero-retention policy and do not use your data
+ for model training, with the <a href="/docs/zen/#privacy">following exceptions</a>.
</Faq>
</li>
<li>
- <Faq question="Can I set spend limits?">
- Yes, you can set monthly spending limits in your account.
- </Faq>
+ <Faq question="Can I set spend limits?">Yes, you can set monthly spending limits in your account.</Faq>
</li>
<li>
<Faq question="Can I cancel?">
@@ -377,8 +317,8 @@ export default function Home() {
</li>
<li>
<Faq question="Can I use Zen with other coding agents?">
- While Zen works great with OpenCode, you can use Zen with any agent. Follow the
- setup instructions in your preferred coding agent.
+ While Zen works great with OpenCode, you can use Zen with any agent. Follow the setup instructions in
+ your preferred coding agent.
</Faq>
</li>
</ul>
diff --git a/packages/console/app/src/routes/zen/util/handler.ts b/packages/console/app/src/routes/zen/util/handler.ts
index deab7ded2..194a7c71e 100644
--- a/packages/console/app/src/routes/zen/util/handler.ts
+++ b/packages/console/app/src/routes/zen/util/handler.ts
@@ -13,11 +13,7 @@ import { ModelTable } from "@opencode-ai/console-core/schema/model.sql.js"
import { ProviderTable } from "@opencode-ai/console-core/schema/provider.sql.js"
import { logger } from "./logger"
import { AuthError, CreditsError, MonthlyLimitError, UserLimitError, ModelError } from "./error"
-import {
- createBodyConverter,
- createStreamPartConverter,
- createResponseConverter,
-} from "./provider/provider"
+import { createBodyConverter, createStreamPartConverter, createResponseConverter } from "./provider/provider"
import { anthropicHelper } from "./provider/anthropic"
import { openaiHelper } from "./provider/openai"
import { oaCompatHelper } from "./provider/openai-compatible"
@@ -46,11 +42,7 @@ export async function handler(
})
const zenData = ZenData.list()
const modelInfo = validateModel(zenData, body.model)
- const providerInfo = selectProvider(
- zenData,
- modelInfo,
- input.request.headers.get("x-real-ip") ?? "",
- )
+ const providerInfo = selectProvider(zenData, modelInfo, input.request.headers.get("x-real-ip") ?? "")
const authInfo = await authenticate(modelInfo, providerInfo)
validateBilling(modelInfo, authInfo)
validateModelSettings(authInfo)
@@ -229,11 +221,7 @@ export async function handler(
return { id: modelId, ...modelData }
}
- function selectProvider(
- zenData: ZenData,
- model: Awaited<ReturnType<typeof validateModel>>,
- ip: string,
- ) {
+ function selectProvider(zenData: ZenData, model: Awaited<ReturnType<typeof validateModel>>, ip: string) {
const providers = model.providers
.filter((provider) => !provider.disabled)
.flatMap((provider) => Array<typeof provider>(provider.weight ?? 1).fill(provider))
@@ -252,11 +240,7 @@ export async function handler(
return {
...provider,
...zenData.providers[provider.id],
- ...(format === "anthropic"
- ? anthropicHelper
- : format === "openai"
- ? openaiHelper
- : oaCompatHelper),
+ ...(format === "anthropic" ? anthropicHelper : format === "openai" ? openaiHelper : oaCompatHelper),
}
}
@@ -297,20 +281,11 @@ export async function handler(
.from(KeyTable)
.innerJoin(WorkspaceTable, eq(WorkspaceTable.id, KeyTable.workspaceID))
.innerJoin(BillingTable, eq(BillingTable.workspaceID, KeyTable.workspaceID))
- .innerJoin(
- UserTable,
- and(eq(UserTable.workspaceID, KeyTable.workspaceID), eq(UserTable.id, KeyTable.userID)),
- )
- .leftJoin(
- ModelTable,
- and(eq(ModelTable.workspaceID, KeyTable.workspaceID), eq(ModelTable.model, model.id)),
- )
+ .innerJoin(UserTable, and(eq(UserTable.workspaceID, KeyTable.workspaceID), eq(UserTable.id, KeyTable.userID)))
+ .leftJoin(ModelTable, and(eq(ModelTable.workspaceID, KeyTable.workspaceID), eq(ModelTable.model, model.id)))
.leftJoin(
ProviderTable,
- and(
- eq(ProviderTable.workspaceID, KeyTable.workspaceID),
- eq(ProviderTable.provider, providerInfo.id),
- ),
+ and(eq(ProviderTable.workspaceID, KeyTable.workspaceID), eq(ProviderTable.provider, providerInfo.id)),
)
.where(and(eq(KeyTable.key, apiKey), isNull(KeyTable.timeDeleted)))
.then((rows) => rows[0]),
@@ -401,19 +376,12 @@ export async function handler(
providerInfo: Awaited<ReturnType<typeof selectProvider>>,
usage: any,
) {
- const {
- inputTokens,
- outputTokens,
- reasoningTokens,
- cacheReadTokens,
- cacheWrite5mTokens,
- cacheWrite1hTokens,
- } = providerInfo.normalizeUsage(usage)
+ const { inputTokens, outputTokens, reasoningTokens, cacheReadTokens, cacheWrite5mTokens, cacheWrite1hTokens } =
+ providerInfo.normalizeUsage(usage)
const modelCost =
modelInfo.cost200K &&
- inputTokens + (cacheReadTokens ?? 0) + (cacheWrite5mTokens ?? 0) + (cacheWrite1hTokens ?? 0) >
- 200_000
+ inputTokens + (cacheReadTokens ?? 0) + (cacheWrite5mTokens ?? 0) + (cacheWrite1hTokens ?? 0) > 200_000
? modelInfo.cost200K
: modelInfo.cost
@@ -464,8 +432,7 @@ export async function handler(
if (!authInfo) return
- const cost =
- authInfo.isFree || authInfo.provider?.credentials ? 0 : centsToMicroCents(totalCostInCent)
+ const cost = authInfo.isFree || authInfo.provider?.credentials ? 0 : centsToMicroCents(totalCostInCent)
await Database.transaction(async (tx) => {
await tx.insert(UsageTable).values({
workspaceID: authInfo.workspaceID,
@@ -505,9 +472,7 @@ export async function handler(
`,
timeMonthlyUsageUpdated: sql`now()`,
})
- .where(
- and(eq(UserTable.workspaceID, authInfo.workspaceID), eq(UserTable.id, authInfo.user.id)),
- )
+ .where(and(eq(UserTable.workspaceID, authInfo.workspaceID), eq(UserTable.id, authInfo.user.id)))
})
await Database.use((tx) =>
@@ -537,10 +502,7 @@ export async function handler(
BillingTable.balance,
centsToMicroCents((authInfo.billing.reloadTrigger ?? Billing.RELOAD_TRIGGER) * 100),
),
- or(
- isNull(BillingTable.timeReloadLockedTill),
- lt(BillingTable.timeReloadLockedTill, sql`now()`),
- ),
+ or(isNull(BillingTable.timeReloadLockedTill), lt(BillingTable.timeReloadLockedTill, sql`now()`)),
),
),
)
diff --git a/packages/console/app/src/routes/zen/util/provider/anthropic.ts b/packages/console/app/src/routes/zen/util/provider/anthropic.ts
index f4e8dc44d..d8d1cd741 100644
--- a/packages/console/app/src/routes/zen/util/provider/anthropic.ts
+++ b/packages/console/app/src/routes/zen/util/provider/anthropic.ts
@@ -123,15 +123,12 @@ export function fromAnthropicRequest(body: any): CommonRequest {
if ((p as any).type === "tool_result") {
const id = (p as any).tool_use_id
const content =
- typeof (p as any).content === "string"
- ? (p as any).content
- : JSON.stringify((p as any).content)
+ typeof (p as any).content === "string" ? (p as any).content : JSON.stringify((p as any).content)
msgs.push({ role: "tool", tool_call_id: id, content })
}
}
if (partsOut.length > 0) {
- if (partsOut.length === 1 && partsOut[0].type === "text")
- msgs.push({ role: "user", content: partsOut[0].text })
+ if (partsOut.length === 1 && partsOut[0].type === "text") msgs.push({ role: "user", content: partsOut[0].text })
else msgs.push({ role: "user", content: partsOut })
}
continue
@@ -143,8 +140,7 @@ export function fromAnthropicRequest(body: any): CommonRequest {
const tcs: any[] = []
for (const p of partsIn) {
if (!p || !(p as any).type) continue
- if ((p as any).type === "text" && typeof (p as any).text === "string")
- texts.push((p as any).text)
+ if ((p as any).type === "text" && typeof (p as any).text === "string") texts.push((p as any).text)
if ((p as any).type === "tool_use") {
const name = (p as any).name
const id = (p as any).id
@@ -214,9 +210,7 @@ export function fromAnthropicRequest(body: any): CommonRequest {
export function toAnthropicRequest(body: CommonRequest) {
if (!body || typeof body !== "object") return body
- const sysIn = Array.isArray(body.messages)
- ? body.messages.filter((m: any) => m && m.role === "system")
- : []
+ const sysIn = Array.isArray(body.messages) ? body.messages.filter((m: any) => m && m.role === "system") : []
let ccCount = 0
const cc = () => {
ccCount++
@@ -367,9 +361,7 @@ export function fromAnthropicResponse(resp: any): CommonResponse {
const idIn = (resp as any).id
const id =
- typeof idIn === "string"
- ? idIn.replace(/^msg_/, "chatcmpl_")
- : `chatcmpl_${Math.random().toString(36).slice(2)}`
+ typeof idIn === "string" ? idIn.replace(/^msg_/, "chatcmpl_") : `chatcmpl_${Math.random().toString(36).slice(2)}`
const model = (resp as any).model
const blocks: any[] = Array.isArray((resp as any).content) ? (resp as any).content : []
@@ -412,9 +404,7 @@ export function fromAnthropicResponse(resp: any): CommonResponse {
const ct = typeof (u as any).output_tokens === "number" ? (u as any).output_tokens : undefined
const total = pt != null && ct != null ? pt + ct : undefined
const cached =
- typeof (u as any).cache_read_input_tokens === "number"
- ? (u as any).cache_read_input_tokens
- : undefined
+ typeof (u as any).cache_read_input_tokens === "number" ? (u as any).cache_read_input_tokens : undefined
const details = cached != null ? { cached_tokens: cached } : undefined
return {
prompt_tokens: pt,
@@ -591,9 +581,7 @@ export function fromAnthropicChunk(chunk: string): CommonChunk | string {
prompt_tokens: u.input_tokens,
completion_tokens: u.output_tokens,
total_tokens: (u.input_tokens || 0) + (u.output_tokens || 0),
- ...(u.cache_read_input_tokens
- ? { prompt_tokens_details: { cached_tokens: u.cache_read_input_tokens } }
- : {}),
+ ...(u.cache_read_input_tokens ? { prompt_tokens_details: { cached_tokens: u.cache_read_input_tokens } } : {}),
}
}
diff --git a/packages/console/app/src/routes/zen/util/provider/openai-compatible.ts b/packages/console/app/src/routes/zen/util/provider/openai-compatible.ts
index d69985728..8a9170ef1 100644
--- a/packages/console/app/src/routes/zen/util/provider/openai-compatible.ts
+++ b/packages/console/app/src/routes/zen/util/provider/openai-compatible.ts
@@ -57,8 +57,7 @@ export const oaCompatHelper = {
const inputTokens = usage.prompt_tokens ?? 0
const outputTokens = usage.completion_tokens ?? 0
const reasoningTokens = usage.completion_tokens_details?.reasoning_tokens ?? undefined
- const cacheReadTokens =
- usage.cached_tokens ?? usage.prompt_tokens_details?.cached_tokens ?? undefined
+ const cacheReadTokens = usage.cached_tokens ?? usage.prompt_tokens_details?.cached_tokens ?? undefined
return {
inputTokens: inputTokens - (cacheReadTokens ?? 0),
outputTokens,
@@ -80,8 +79,7 @@ export function fromOaCompatibleRequest(body: any): CommonRequest {
if (!m || !m.role) continue
if (m.role === "system") {
- if (typeof m.content === "string" && m.content.length > 0)
- msgsOut.push({ role: "system", content: m.content })
+ if (typeof m.content === "string" && m.content.length > 0) msgsOut.push({ role: "system", content: m.content })
continue
}
@@ -92,12 +90,10 @@ export function fromOaCompatibleRequest(body: any): CommonRequest {
const parts: any[] = []
for (const p of m.content) {
if (!p || !p.type) continue
- if (p.type === "text" && typeof p.text === "string")
- parts.push({ type: "text", text: p.text })
+ if (p.type === "text" && typeof p.text === "string") parts.push({ type: "text", text: p.text })
if (p.type === "image_url") parts.push({ type: "image_url", image_url: p.image_url })
}
- if (parts.length === 1 && parts[0].type === "text")
- msgsOut.push({ role: "user", content: parts[0].text })
+ if (parts.length === 1 && parts[0].type === "text") msgsOut.push({ role: "user", content: parts[0].text })
else if (parts.length > 0) msgsOut.push({ role: "user", content: parts })
}
continue
@@ -141,8 +137,7 @@ export function toOaCompatibleRequest(body: CommonRequest) {
if (p.type === "image_url" && p.image_url) return { type: "image_url", image_url: p.image_url }
const s = (p as any).source
if (!s || typeof s !== "object") return undefined
- if (s.type === "url" && typeof s.url === "string")
- return { type: "image_url", image_url: { url: s.url } }
+ if (s.type === "url" && typeof s.url === "string") return { type: "image_url", image_url: { url: s.url } }
if (s.type === "base64" && typeof s.media_type === "string" && typeof s.data === "string")
return { type: "image_url", image_url: { url: `data:${s.media_type};base64,${s.data}` } }
return undefined
@@ -152,8 +147,7 @@ export function toOaCompatibleRequest(body: CommonRequest) {
if (!m || !m.role) continue
if (m.role === "system") {
- if (typeof m.content === "string" && m.content.length > 0)
- msgsOut.push({ role: "system", content: m.content })
+ if (typeof m.content === "string" && m.content.length > 0) msgsOut.push({ role: "system", content: m.content })
continue
}
@@ -166,13 +160,11 @@ export function toOaCompatibleRequest(body: CommonRequest) {
const parts: any[] = []
for (const p of m.content) {
if (!p || !p.type) continue
- if (p.type === "text" && typeof p.text === "string")
- parts.push({ type: "text", text: p.text })
+ if (p.type === "text" && typeof p.text === "string") parts.push({ type: "text", text: p.text })
const ip = toImg(p)
if (ip) parts.push(ip)
}
- if (parts.length === 1 && parts[0].type === "text")
- msgsOut.push({ role: "user", content: parts[0].text })
+ if (parts.length === 1 && parts[0].type === "text") msgsOut.push({ role: "user", content: parts[0].text })
else if (parts.length > 0) msgsOut.push({ role: "user", content: parts })
}
continue
@@ -325,9 +317,7 @@ export function toOaCompatibleResponse(resp: CommonResponse) {
const idIn = (resp as any).id
const id =
- typeof idIn === "string"
- ? idIn.replace(/^msg_/, "chatcmpl_")
- : `chatcmpl_${Math.random().toString(36).slice(2)}`
+ typeof idIn === "string" ? idIn.replace(/^msg_/, "chatcmpl_") : `chatcmpl_${Math.random().toString(36).slice(2)}`
const model = (resp as any).model
const blocks: any[] = Array.isArray((resp as any).content) ? (resp as any).content : []
@@ -369,8 +359,7 @@ export function toOaCompatibleResponse(resp: CommonResponse) {
const pt = typeof u.input_tokens === "number" ? u.input_tokens : undefined
const ct = typeof u.output_tokens === "number" ? u.output_tokens : undefined
const total = pt != null && ct != null ? pt + ct : undefined
- const cached =
- typeof u.cache_read_input_tokens === "number" ? u.cache_read_input_tokens : undefined
+ const cached = typeof u.cache_read_input_tokens === "number" ? u.cache_read_input_tokens : undefined
const details = cached != null ? { cached_tokens: cached } : undefined
return {
prompt_tokens: pt,
diff --git a/packages/console/app/src/routes/zen/util/provider/openai.ts b/packages/console/app/src/routes/zen/util/provider/openai.ts
index fa0776b7a..e79e83579 100644
--- a/packages/console/app/src/routes/zen/util/provider/openai.ts
+++ b/packages/console/app/src/routes/zen/util/provider/openai.ts
@@ -86,11 +86,7 @@ export function fromOpenaiRequest(body: any): CommonRequest {
const msgs: any[] = []
- const inMsgs = Array.isArray(body.input)
- ? body.input
- : Array.isArray(body.messages)
- ? body.messages
- : []
+ const inMsgs = Array.isArray(body.input) ? body.input : Array.isArray(body.messages) ? body.messages : []
for (const m of inMsgs) {
if (!m) continue
@@ -103,9 +99,7 @@ export function fromOpenaiRequest(body: any): CommonRequest {
const args = typeof a === "string" ? a : JSON.stringify(a ?? {})
msgs.push({
role: "assistant",
- tool_calls: [
- { id: (m as any).id, type: "function", function: { name, arguments: args } },
- ],
+ tool_calls: [{ id: (m as any).id, type: "function", function: { name, arguments: args } }],
})
}
if ((m as any).type === "function_call_output") {
@@ -122,8 +116,7 @@ export function fromOpenaiRequest(body: any): CommonRequest {
if (typeof c === "string" && c.length > 0) msgs.push({ role: "system", content: c })
if (Array.isArray(c)) {
const t = c.find((p: any) => p && typeof p.text === "string")
- if (t && typeof t.text === "string" && t.text.length > 0)
- msgs.push({ role: "system", content: t.text })
+ if (t && typeof t.text === "string" && t.text.length > 0) msgs.push({ role: "system", content: t.text })
}
continue
}
@@ -136,24 +129,18 @@ export function fromOpenaiRequest(body: any): CommonRequest {
const parts: any[] = []
for (const p of c) {
if (!p || !(p as any).type) continue
- if (
- ((p as any).type === "text" || (p as any).type === "input_text") &&
- typeof (p as any).text === "string"
- )
+ if (((p as any).type === "text" || (p as any).type === "input_text") && typeof (p as any).text === "string")
parts.push({ type: "text", text: (p as any).text })
const ip = toImg(p)
if (ip) parts.push(ip)
if ((p as any).type === "tool_result") {
const id = (p as any).tool_call_id
const content =
- typeof (p as any).content === "string"
- ? (p as any).content
- : JSON.stringify((p as any).content)
+ typeof (p as any).content === "string" ? (p as any).content : JSON.stringify((p as any).content)
msgs.push({ role: "tool", tool_call_id: id, content })
}
}
- if (parts.length === 1 && parts[0].type === "text")
- msgs.push({ role: "user", content: parts[0].text })
+ if (parts.length === 1 && parts[0].type === "text") msgs.push({ role: "user", content: parts[0].text })
else if (parts.length > 0) msgs.push({ role: "user", content: parts })
}
continue
@@ -280,10 +267,7 @@ export function toOpenaiRequest(body: CommonRequest) {
}
if ((m as any).role === "tool") {
- const out =
- typeof (m as any).content === "string"
- ? (m as any).content
- : JSON.stringify((m as any).content)
+ const out = typeof (m as any).content === "string" ? (m as any).content : JSON.stringify((m as any).content)
input.push({ type: "function_call_output", call_id: (m as any).tool_call_id, output: out })
continue
}
@@ -351,9 +335,7 @@ export function fromOpenaiResponse(resp: any): CommonResponse {
const idIn = (r as any).id
const id =
- typeof idIn === "string"
- ? idIn.replace(/^resp_/, "chatcmpl_")
- : `chatcmpl_${Math.random().toString(36).slice(2)}`
+ typeof idIn === "string" ? idIn.replace(/^resp_/, "chatcmpl_") : `chatcmpl_${Math.random().toString(36).slice(2)}`
const model = (r as any).model ?? (resp as any).model
const out = Array.isArray((r as any).output) ? (r as any).output : []
@@ -480,9 +462,7 @@ export function toOpenaiResponse(resp: CommonResponse) {
})()
return {
- id:
- (resp as any).id?.replace(/^chatcmpl_/, "resp_") ??
- `resp_${Math.random().toString(36).slice(2)}`,
+ id: (resp as any).id?.replace(/^chatcmpl_/, "resp_") ?? `resp_${Math.random().toString(36).slice(2)}`,
object: "response",
model: (resp as any).model,
output: outputItems,
diff --git a/packages/console/app/src/routes/zen/v1/models.ts b/packages/console/app/src/routes/zen/v1/models.ts
index 3d0c31470..ee2b3ab54 100644
--- a/packages/console/app/src/routes/zen/v1/models.ts
+++ b/packages/console/app/src/routes/zen/v1/models.ts
@@ -50,10 +50,7 @@ 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)),
)
diff --git a/packages/console/app/src/style/token/font.css b/packages/console/app/src/style/token/font.css
index dc0d298f1..67143e662 100644
--- a/packages/console/app/src/style/token/font.css
+++ b/packages/console/app/src/style/token/font.css
@@ -15,7 +15,6 @@ body {
--font-size-9xl: 8rem;
--font-mono:
- "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
- "Courier New", monospace;
+ "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-sans: var(--font-mono);
}
diff --git a/packages/console/core/script/lookup-user.ts b/packages/console/core/script/lookup-user.ts
index af9bcc3a1..1ae18c4dd 100644
--- a/packages/console/core/script/lookup-user.ts
+++ b/packages/console/core/script/lookup-user.ts
@@ -8,22 +8,15 @@ if (!email) {
process.exit(1)
}
-const authData = await printTable("Auth", (tx) =>
- tx.select().from(AuthTable).where(eq(AuthTable.subject, email)),
-)
+const authData = await printTable("Auth", (tx) => tx.select().from(AuthTable).where(eq(AuthTable.subject, email)))
if (authData.length === 0) {
console.error("User not found")
process.exit(1)
}
-await printTable("Auth", (tx) =>
- tx.select().from(AuthTable).where(eq(AuthTable.accountID, authData[0].accountID)),
-)
+await printTable("Auth", (tx) => tx.select().from(AuthTable).where(eq(AuthTable.accountID, authData[0].accountID)))
-function printTable(
- title: string,
- callback: (tx: Database.TxOrDb) => Promise<any[]>,
-): Promise<any[]> {
+function printTable(title: string, callback: (tx: Database.TxOrDb) => Promise<any[]>): Promise<any[]> {
return Database.use(async (tx) => {
const data = await callback(tx)
console.log(`== ${title} ==`)
diff --git a/packages/console/core/script/reset-db.ts b/packages/console/core/script/reset-db.ts
index bd00e1962..02d498901 100644
--- a/packages/console/core/script/reset-db.ts
+++ b/packages/console/core/script/reset-db.ts
@@ -8,14 +8,6 @@ import { KeyTable } from "../src/schema/key.sql.js"
if (Resource.App.stage !== "frank") throw new Error("This script is only for frank")
-for (const table of [
- AccountTable,
- BillingTable,
- KeyTable,
- PaymentTable,
- UsageTable,
- UserTable,
- WorkspaceTable,
-]) {
+for (const table of [AccountTable, BillingTable, KeyTable, PaymentTable, UsageTable, UserTable, WorkspaceTable]) {
await Database.use((tx) => tx.delete(table))
}
diff --git a/packages/console/core/src/aws.ts b/packages/console/core/src/aws.ts
index ce4a20f44..e87ada6ef 100644
--- a/packages/console/core/src/aws.ts
+++ b/packages/console/core/src/aws.ts
@@ -24,40 +24,37 @@ export namespace AWS {
body: z.string(),
}),
async (input) => {
- const res = await createClient().fetch(
- "https://email.us-east-1.amazonaws.com/v2/email/outbound-emails",
- {
- method: "POST",
- headers: {
- "X-Amz-Target": "SES.SendEmail",
- "Content-Type": "application/json",
+ const res = await createClient().fetch("https://email.us-east-1.amazonaws.com/v2/email/outbound-emails", {
+ method: "POST",
+ headers: {
+ "X-Amz-Target": "SES.SendEmail",
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ FromEmailAddress: `OpenCode Zen <[email protected]>`,
+ Destination: {
+ ToAddresses: [input.to],
},
- body: JSON.stringify({
- FromEmailAddress: `OpenCode Zen <[email protected]>`,
- Destination: {
- ToAddresses: [input.to],
- },
- Content: {
- Simple: {
- Subject: {
+ Content: {
+ Simple: {
+ Subject: {
+ Charset: "UTF-8",
+ Data: input.subject,
+ },
+ Body: {
+ Text: {
Charset: "UTF-8",
- Data: input.subject,
+ Data: input.body,
},
- Body: {
- Text: {
- Charset: "UTF-8",
- Data: input.body,
- },
- Html: {
- Charset: "UTF-8",
- Data: input.body,
- },
+ Html: {
+ Charset: "UTF-8",
+ Data: input.body,
},
},
},
- }),
- },
- )
+ },
+ }),
+ })
if (!res.ok) {
throw new Error(`Failed to send email: ${res.statusText}`)
}
diff --git a/packages/console/core/src/drizzle/index.ts b/packages/console/core/src/drizzle/index.ts
index 8b37b1f9c..f0f065de4 100644
--- a/packages/console/core/src/drizzle/index.ts
+++ b/packages/console/core/src/drizzle/index.ts
@@ -5,10 +5,7 @@ import { Client } from "@planetscale/database"
import { MySqlTransaction, type MySqlTransactionConfig } from "drizzle-orm/mysql-core"
import type { ExtractTablesWithRelations } from "drizzle-orm"
-import type {
- PlanetScalePreparedQueryHKT,
- PlanetscaleQueryResultHKT,
-} from "drizzle-orm/planetscale-serverless"
+import type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from "drizzle-orm/planetscale-serverless"
import { Context } from "../context"
import { memo } from "../util/memo"
@@ -70,10 +67,7 @@ export namespace Database {
}
}
- export async function transaction<T>(
- callback: (tx: TxOrDb) => Promise<T>,
- config?: MySqlTransactionConfig,
- ) {
+ export async function transaction<T>(callback: (tx: TxOrDb) => Promise<T>, config?: MySqlTransactionConfig) {
try {
const { tx } = TransactionContext.use()
return callback(tx)
diff --git a/packages/console/core/src/key.ts b/packages/console/core/src/key.ts
index 6396fd0b8..688f19b3d 100644
--- a/packages/console/core/src/key.ts
+++ b/packages/console/core/src/key.ts
@@ -20,14 +20,8 @@ export namespace Key {
email: AuthTable.subject,
})
.from(KeyTable)
- .innerJoin(
- UserTable,
- and(eq(KeyTable.userID, UserTable.id), eq(KeyTable.workspaceID, UserTable.workspaceID)),
- )
- .innerJoin(
- AuthTable,
- and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")),
- )
+ .innerJoin(UserTable, and(eq(KeyTable.userID, UserTable.id), eq(KeyTable.workspaceID, UserTable.workspaceID)))
+ .innerJoin(AuthTable, and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")))
.where(
and(
...[
diff --git a/packages/console/core/src/model.ts b/packages/console/core/src/model.ts
index 30cc15e45..ea719534d 100644
--- a/packages/console/core/src/model.ts
+++ b/packages/console/core/src/model.ts
@@ -60,9 +60,7 @@ export namespace Model {
export const enable = fn(z.object({ model: z.string() }), ({ model }) => {
Actor.assertAdmin()
return Database.use((db) =>
- db
- .delete(ModelTable)
- .where(and(eq(ModelTable.workspaceID, Actor.workspace()), eq(ModelTable.model, model))),
+ db.delete(ModelTable).where(and(eq(ModelTable.workspaceID, Actor.workspace()), eq(ModelTable.model, model))),
)
})
diff --git a/packages/console/core/src/provider.ts b/packages/console/core/src/provider.ts
index 0af642f71..cf2040b59 100644
--- a/packages/console/core/src/provider.ts
+++ b/packages/console/core/src/provider.ts
@@ -11,9 +11,7 @@ export namespace Provider {
tx
.select()
.from(ProviderTable)
- .where(
- and(eq(ProviderTable.workspaceID, Actor.workspace()), isNull(ProviderTable.timeDeleted)),
- ),
+ .where(and(eq(ProviderTable.workspaceID, Actor.workspace()), isNull(ProviderTable.timeDeleted))),
),
)
@@ -52,12 +50,7 @@ export namespace Provider {
return Database.transaction((tx) =>
tx
.delete(ProviderTable)
- .where(
- and(
- eq(ProviderTable.provider, provider),
- eq(ProviderTable.workspaceID, Actor.workspace()),
- ),
- ),
+ .where(and(eq(ProviderTable.provider, provider), eq(ProviderTable.workspaceID, Actor.workspace()))),
)
},
)
diff --git a/packages/console/core/src/schema/auth.sql.ts b/packages/console/core/src/schema/auth.sql.ts
index d55e605aa..27c926d6f 100644
--- a/packages/console/core/src/schema/auth.sql.ts
+++ b/packages/console/core/src/schema/auth.sql.ts
@@ -1,11 +1,4 @@
-import {
- index,
- mysqlEnum,
- mysqlTable,
- primaryKey,
- uniqueIndex,
- varchar,
-} from "drizzle-orm/mysql-core"
+import { index, mysqlEnum, mysqlTable, primaryKey, uniqueIndex, varchar } from "drizzle-orm/mysql-core"
import { id, timestamps, ulid } from "../drizzle/types"
export const AuthProvider = ["email", "github", "google"] as const
diff --git a/packages/console/core/src/schema/model.sql.ts b/packages/console/core/src/schema/model.sql.ts
index 343b0c4f3..1c032aad2 100644
--- a/packages/console/core/src/schema/model.sql.ts
+++ b/packages/console/core/src/schema/model.sql.ts
@@ -9,8 +9,5 @@ export const ModelTable = mysqlTable(
...timestamps,
model: varchar("model", { length: 64 }).notNull(),
},
- (table) => [
- ...workspaceIndexes(table),
- uniqueIndex("model_workspace_model").on(table.workspaceID, table.model),
- ],
+ (table) => [...workspaceIndexes(table), uniqueIndex("model_workspace_model").on(table.workspaceID, table.model)],
)
diff --git a/packages/console/core/src/schema/provider.sql.ts b/packages/console/core/src/schema/provider.sql.ts
index 04d11e2e5..11be5b4d7 100644
--- a/packages/console/core/src/schema/provider.sql.ts
+++ b/packages/console/core/src/schema/provider.sql.ts
@@ -10,8 +10,5 @@ export const ProviderTable = mysqlTable(
provider: varchar("provider", { length: 64 }).notNull(),
credentials: text("credentials").notNull(),
},
- (table) => [
- ...workspaceIndexes(table),
- uniqueIndex("workspace_provider").on(table.workspaceID, table.provider),
- ],
+ (table) => [...workspaceIndexes(table), uniqueIndex("workspace_provider").on(table.workspaceID, table.provider)],
)
diff --git a/packages/console/core/src/schema/user.sql.ts b/packages/console/core/src/schema/user.sql.ts
index ce5b6c53e..7fd7f5e1e 100644
--- a/packages/console/core/src/schema/user.sql.ts
+++ b/packages/console/core/src/schema/user.sql.ts
@@ -1,12 +1,4 @@
-import {
- mysqlTable,
- uniqueIndex,
- varchar,
- int,
- mysqlEnum,
- index,
- bigint,
-} from "drizzle-orm/mysql-core"
+import { mysqlTable, uniqueIndex, varchar, int, mysqlEnum, index, bigint } from "drizzle-orm/mysql-core"
import { timestamps, ulid, utc, workspaceColumns } from "../drizzle/types"
import { workspaceIndexes } from "./workspace.sql"
diff --git a/packages/console/core/src/user.ts b/packages/console/core/src/user.ts
index cbb1ac827..8b7a96f44 100644
--- a/packages/console/core/src/user.ts
+++ b/packages/console/core/src/user.ts
@@ -26,10 +26,7 @@ export namespace User {
authEmail: AuthTable.subject,
})
.from(UserTable)
- .leftJoin(
- AuthTable,
- and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")),
- )
+ .leftJoin(AuthTable, and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")))
.where(and(eq(UserTable.workspaceID, Actor.workspace()), isNull(UserTable.timeDeleted))),
),
)
@@ -39,13 +36,7 @@ export namespace User {
tx
.select()
.from(UserTable)
- .where(
- and(
- eq(UserTable.workspaceID, Actor.workspace()),
- eq(UserTable.id, id),
- isNull(UserTable.timeDeleted),
- ),
- )
+ .where(and(eq(UserTable.workspaceID, Actor.workspace()), eq(UserTable.id, id), isNull(UserTable.timeDeleted)))
.then((rows) => rows[0]),
),
)
@@ -57,10 +48,7 @@ export namespace User {
email: AuthTable.subject,
})
.from(UserTable)
- .leftJoin(
- AuthTable,
- and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")),
- )
+ .leftJoin(AuthTable, and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")))
.where(and(eq(UserTable.workspaceID, Actor.workspace()), eq(UserTable.id, id)))
.then((rows) => rows[0]?.email),
),
@@ -142,16 +130,10 @@ export namespace User {
workspaceName: WorkspaceTable.name,
})
.from(UserTable)
- .innerJoin(
- AuthTable,
- and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")),
- )
+ .innerJoin(AuthTable, and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")))
.innerJoin(WorkspaceTable, eq(WorkspaceTable.id, workspaceID))
.where(
- and(
- eq(UserTable.workspaceID, workspaceID),
- eq(UserTable.id, Actor.assert("user").properties.userID),
- ),
+ and(eq(UserTable.workspaceID, workspaceID), eq(UserTable.id, Actor.assert("user").properties.userID)),
)
.then((rows) => rows[0]),
)
diff --git a/packages/console/mail/emails/templates/InviteEmail.tsx b/packages/console/mail/emails/templates/InviteEmail.tsx
index e94eb564c..baf0d383f 100644
--- a/packages/console/mail/emails/templates/InviteEmail.tsx
+++ b/packages/console/mail/emails/templates/InviteEmail.tsx
@@ -1,18 +1,6 @@
// @ts-nocheck
import React from "react"
-import {
- Img,
- Row,
- Html,
- Link,
- Body,
- Head,
- Button,
- Column,
- Preview,
- Section,
- Container,
-} from "@jsx-email/all"
+import { Img, Row, Html, Link, Body, Head, Button, Column, Preview, Section, Container } from "@jsx-email/all"
import { Text, Fonts, Title, A, Span } from "../components"
import {
unit,
@@ -64,8 +52,8 @@ export const InviteEmail = ({
<Section style={{ padding: `${unit * 2}px 0 0 0` }}>
<Text style={headingText}>Join your team's OpenCode workspace</Text>
<Text style={contentText}>
- You have been invited by <Span style={contentHighlightText}>{inviter}</Span> to join
- the <Span style={contentHighlightText}>{workspaceName}</Span> workspace on OpenCode.
+ You have been invited by <Span style={contentHighlightText}>{inviter}</Span> to join the{" "}
+ <Span style={contentHighlightText}>{workspaceName}</Span> workspace on OpenCode.
</Text>
</Section>
@@ -73,12 +61,7 @@ export const InviteEmail = ({
<Button style={button} href={url}>
<Text style={buttonText}>
Join workspace
- <Img
- width="24"
- height="24"
- src={`${assetsUrl}/right-arrow.png`}
- alt="Arrow right"
- />
+ <Img width="24" height="24" src={`${assetsUrl}/right-arrow.png`} alt="Arrow right" />
</Text>
</Button>
</Section>
diff --git a/packages/function/src/api.ts b/packages/function/src/api.ts
index 3475f5d72..6f00dae9a 100644
--- a/packages/function/src/api.ts
+++ b/packages/function/src/api.ts
@@ -268,11 +268,7 @@ export default new Hono<{ Bindings: Env }>()
// Verify permissions
const userClient = new Octokit({ auth: token })
const { data: repoData } = await userClient.repos.get({ owner, repo })
- if (
- !repoData.permissions.admin &&
- !repoData.permissions.push &&
- !repoData.permissions.maintain
- )
+ if (!repoData.permissions.admin && !repoData.permissions.push && !repoData.permissions.maintain)
throw new Error("User does not have write permissions")
// Get installation token
diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts
index 4ce8bfbad..29706c09c 100755
--- a/packages/opencode/script/build.ts
+++ b/packages/opencode/script/build.ts
@@ -41,9 +41,7 @@ for (const [os, arch] of targets) {
const opentui = `@opentui/core-${os === "windows" ? "win32" : os}-${arch.replace("-baseline", "")}`
await $`mkdir -p ../../node_modules/${opentui}`
- await $`npm pack ${opentui}@${pkg.dependencies["@opentui/core"]}`.cwd(
- path.join(dir, "../../node_modules"),
- )
+ await $`npm pack ${opentui}@${pkg.dependencies["@opentui/core"]}`.cwd(path.join(dir, "../../node_modules"))
await $`tar -xf ../../node_modules/${opentui.replace("@opentui/", "opentui-")}-*.tgz -C ../../node_modules/${opentui} --strip-components=1`
const watcher = `@parcel/watcher-${os === "windows" ? "win32" : os}-${arch.replace("-baseline", "")}${os === "linux" ? "-glibc" : ""}`
@@ -51,9 +49,7 @@ for (const [os, arch] of targets) {
await $`npm pack ${watcher}`.cwd(path.join(dir, "../../node_modules")).quiet()
await $`tar -xf ../../node_modules/${watcher.replace("@parcel/", "parcel-")}-*.tgz -C ../../node_modules/${watcher} --strip-components=1`
- const parserWorker = fs.realpathSync(
- path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"),
- )
+ const parserWorker = fs.realpathSync(path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"))
const workerPath = "./src/cli/cmd/tui/worker.ts"
await Bun.build({
diff --git a/packages/opencode/script/postinstall.mjs b/packages/opencode/script/postinstall.mjs
index 41865273d..b875d158f 100644
--- a/packages/opencode/script/postinstall.mjs
+++ b/packages/opencode/script/postinstall.mjs
@@ -77,8 +77,7 @@ async function regenerateWindowsCmdWrappers() {
// npm_config_global is string | undefined
// if it exists, the value is true
- const isGlobal =
- process.env.npm_config_global === "true" || pkgPath.includes(path.join("npm", "node_modules"))
+ const isGlobal = process.env.npm_config_global === "true" || pkgPath.includes(path.join("npm", "node_modules"))
// The npm rebuild command does 2 things - Execute lifecycle scripts and rebuild bin links
// We want to skip lifecycle scripts to avoid infinite loops, so we use --ignore-scripts
@@ -94,9 +93,7 @@ async function regenerateWindowsCmdWrappers() {
console.log("Successfully rebuilt npm bin links")
} catch (error) {
console.error("Error rebuilding npm links:", error.message)
- console.error(
- "npm rebuild failed. You may need to manually run: npm rebuild opencode-ai --ignore-scripts",
- )
+ console.error("npm rebuild failed. You may need to manually run: npm rebuild opencode-ai --ignore-scripts")
}
}
diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts
index 3ae4ccf9f..3e989cc6a 100755
--- a/packages/opencode/script/publish.ts
+++ b/packages/opencode/script/publish.ts
@@ -55,18 +55,10 @@ if (!Script.preview) {
}
// Calculate SHA values
- const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`
- .text()
- .then((x) => x.trim())
- const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`
- .text()
- .then((x) => x.trim())
- const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`
- .text()
- .then((x) => x.trim())
- const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`
- .text()
- .then((x) => x.trim())
+ const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
+ const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
+ const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
+ const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
const [pkgver, _subver = ""] = Script.version.split(/(-.*)/, 2)
diff --git a/packages/opencode/script/schema.ts b/packages/opencode/script/schema.ts
index 48bf65442..585701c95 100755
--- a/packages/opencode/script/schema.ts
+++ b/packages/opencode/script/schema.ts
@@ -19,23 +19,12 @@ const result = z.toJSONSchema(Config.Info, {
const schema = ctx.jsonSchema
// Preserve strictness: set additionalProperties: false for objects
- if (
- schema &&
- typeof schema === "object" &&
- schema.type === "object" &&
- schema.additionalProperties === undefined
- ) {
+ if (schema && typeof schema === "object" && schema.type === "object" && schema.additionalProperties === undefined) {
schema.additionalProperties = false
}
// Add examples and default descriptions for string fields with defaults
- if (
- schema &&
- typeof schema === "object" &&
- "type" in schema &&
- schema.type === "string" &&
- schema?.default
- ) {
+ if (schema && typeof schema === "object" && "type" in schema && schema.type === "string" && schema?.default) {
if (!schema.examples) {
schema.examples = [schema.default]
}
diff --git a/packages/opencode/src/acp/agent.ts b/packages/opencode/src/acp/agent.ts
index b25b66888..ff71b0453 100644
--- a/packages/opencode/src/acp/agent.ts
+++ b/packages/opencode/src/acp/agent.ts
@@ -199,10 +199,8 @@ export namespace ACP {
if (kind === "edit") {
const input = part.state.input
- const filePath =
- typeof input["filePath"] === "string" ? input["filePath"] : ""
- const oldText =
- typeof input["oldString"] === "string" ? input["oldString"] : ""
+ const filePath = typeof input["filePath"] === "string" ? input["filePath"] : ""
+ const oldText = typeof input["oldString"] === "string" ? input["oldString"] : ""
const newText =
typeof input["newString"] === "string"
? input["newString"]
@@ -218,9 +216,7 @@ export namespace ACP {
}
if (part.tool === "todowrite") {
- const parsedTodos = z
- .array(Todo.Info)
- .safeParse(JSON.parse(part.state.output))
+ const parsedTodos = z.array(Todo.Info).safeParse(JSON.parse(part.state.output))
if (parsedTodos.success) {
await this.connection
.sessionUpdate({
@@ -229,9 +225,7 @@ export namespace ACP {
sessionUpdate: "plan",
entries: parsedTodos.data.map((todo) => {
const status: PlanEntry["status"] =
- todo.status === "cancelled"
- ? "completed"
- : (todo.status as PlanEntry["status"])
+ todo.status === "cancelled" ? "completed" : (todo.status as PlanEntry["status"])
return {
priority: "medium",
status,
@@ -481,8 +475,7 @@ export namespace ACP {
description: agent.description,
}))
- const currentModeId =
- availableModes.find((m) => m.name === "build")?.id ?? availableModes[0].id
+ const currentModeId = availableModes.find((m) => m.name === "build")?.id ?? availableModes[0].id
const mcpServers: Record<string, Config.Mcp> = {}
for (const server of params.mcpServers) {
@@ -587,8 +580,7 @@ export namespace ACP {
const agent = session.modeId ?? "build"
const parts: Array<
- | { type: "text"; text: string }
- | { type: "file"; url: string; filename: string; mime: string }
+ { type: "text"; text: string } | { type: "file"; url: string; filename: string; mime: string }
> = []
for (const part of params.prompt) {
switch (part.type) {
@@ -794,9 +786,7 @@ export namespace ACP {
function parseUri(
uri: string,
- ):
- | { type: "file"; url: string; filename: string; mime: string }
- | { type: "text"; text: string } {
+ ): { type: "file"; url: string; filename: string; mime: string } | { type: "text"; text: string } {
try {
if (uri.startsWith("file://")) {
const path = uri.slice(7)
diff --git a/packages/opencode/src/acp/session.ts b/packages/opencode/src/acp/session.ts
index eb9dd5229..63948a8c1 100644
--- a/packages/opencode/src/acp/session.ts
+++ b/packages/opencode/src/acp/session.ts
@@ -13,11 +13,7 @@ export class ACPSessionManager {
this.sdk = sdk
}
- async create(
- cwd: string,
- mcpServers: McpServer[],
- model?: ACPSessionState["model"],
- ): Promise<ACPSessionState> {
+ async create(cwd: string, mcpServers: McpServer[], model?: ACPSessionState["model"]): Promise<ACPSessionState> {
const session = await this.sdk.session
.create({
body: {
diff --git a/packages/opencode/src/agent/agent.ts b/packages/opencode/src/agent/agent.ts
index 16f401629..a6933708b 100644
--- a/packages/opencode/src/agent/agent.ts
+++ b/packages/opencode/src/agent/agent.ts
@@ -143,18 +143,7 @@ export namespace Agent {
tools: {},
builtIn: false,
}
- const {
- name,
- model,
- prompt,
- tools,
- description,
- temperature,
- top_p,
- mode,
- permission,
- ...extra
- } = value
+ const { name, model, prompt, tools, description, temperature, top_p, mode, permission, ...extra } = value
item.options = {
...item.options,
...extra,
@@ -223,10 +212,7 @@ export namespace Agent {
}
}
-function mergeAgentPermissions(
- basePermission: any,
- overridePermission: any,
-): Agent.Info["permission"] {
+function mergeAgentPermissions(basePermission: any, overridePermission: any): Agent.Info["permission"] {
if (typeof basePermission.bash === "string") {
basePermission.bash = {
"*": basePermission.bash,
diff --git a/packages/opencode/src/bun/index.ts b/packages/opencode/src/bun/index.ts
index 2a8b48eff..5f1847275 100644
--- a/packages/opencode/src/bun/index.ts
+++ b/packages/opencode/src/bun/index.ts
@@ -8,10 +8,7 @@ import { readableStreamToText } from "bun"
export namespace BunProc {
const log = Log.create({ service: "bun" })
- export async function run(
- cmd: string[],
- options?: Bun.SpawnOptions.OptionsObject<any, any, any>,
- ) {
+ export async function run(cmd: string[], options?: Bun.SpawnOptions.OptionsObject<any, any, any>) {
log.info("running", {
cmd: [which(), ...cmd],
...options,
diff --git a/packages/opencode/src/bus/index.ts b/packages/opencode/src/bus/index.ts
index c424eb879..f4dd3ed2c 100644
--- a/packages/opencode/src/bus/index.ts
+++ b/packages/opencode/src/bus/index.ts
@@ -19,10 +19,7 @@ export namespace Bus {
const registry = new Map<string, EventDefinition>()
- export function event<Type extends string, Properties extends ZodType>(
- type: Type,
- properties: Properties,
- ) {
+ export function event<Type extends string, Properties extends ZodType>(type: Type, properties: Properties) {
const result = {
type,
properties,
@@ -73,10 +70,7 @@ export namespace Bus {
export function subscribe<Definition extends EventDefinition>(
def: Definition,
- callback: (event: {
- type: Definition["type"]
- properties: z.infer<Definition["properties"]>
- }) => void,
+ callback: (event: { type: Definition["type"]; properties: z.infer<Definition["properties"]> }) => void,
) {
return raw(def.type, callback)
}
diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts
index b4c47f0a4..ae24fbef5 100644
--- a/packages/opencode/src/cli/cmd/auth.ts
+++ b/packages/opencode/src/cli/cmd/auth.ts
@@ -14,11 +14,7 @@ export const AuthCommand = cmd({
command: "auth",
describe: "manage credentials",
builder: (yargs) =>
- yargs
- .command(AuthLoginCommand)
- .command(AuthLogoutCommand)
- .command(AuthListCommand)
- .demandCommand(),
+ yargs.command(AuthLoginCommand).command(AuthLogoutCommand).command(AuthListCommand).demandCommand(),
async handler() {},
})
@@ -64,9 +60,7 @@ export const AuthListCommand = cmd({
prompts.log.info(`${provider} ${UI.Style.TEXT_DIM}${envVar}`)
}
- prompts.outro(
- `${activeEnvVars.length} environment variable` + (activeEnvVars.length === 1 ? "" : "s"),
- )
+ prompts.outro(`${activeEnvVars.length} environment variable` + (activeEnvVars.length === 1 ? "" : "s"))
}
},
})
@@ -86,9 +80,7 @@ export const AuthLoginCommand = cmd({
UI.empty()
prompts.intro("Add credential")
if (args.url) {
- const wellknown = await fetch(`${args.url}/.well-known/opencode`).then(
- (x) => x.json() as any,
- )
+ const wellknown = await fetch(`${args.url}/.well-known/opencode`).then((x) => x.json() as any)
prompts.log.info(`Running \`${wellknown.auth.command.join(" ")}\``)
const proc = Bun.spawn({
cmd: wellknown.auth.command,
@@ -290,8 +282,7 @@ export const AuthLoginCommand = cmd({
if (provider === "other") {
provider = await prompts.text({
message: "Enter provider id",
- validate: (x) =>
- x && x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only",
+ validate: (x) => (x && x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
})
if (prompts.isCancel(provider)) throw new UI.CancelledError()
provider = provider.replace(/^@ai-sdk\//, "")
diff --git a/packages/opencode/src/cli/cmd/debug/lsp.ts b/packages/opencode/src/cli/cmd/debug/lsp.ts
index 8492395d1..2f5977195 100644
--- a/packages/opencode/src/cli/cmd/debug/lsp.ts
+++ b/packages/opencode/src/cli/cmd/debug/lsp.ts
@@ -7,11 +7,7 @@ import { EOL } from "os"
export const LSPCommand = cmd({
command: "lsp",
builder: (yargs) =>
- yargs
- .command(DiagnosticsCommand)
- .command(SymbolsCommand)
- .command(DocumentSymbolsCommand)
- .demandCommand(),
+ yargs.command(DiagnosticsCommand).command(SymbolsCommand).command(DocumentSymbolsCommand).demandCommand(),
async handler() {},
})
diff --git a/packages/opencode/src/cli/cmd/debug/ripgrep.ts b/packages/opencode/src/cli/cmd/debug/ripgrep.ts
index 7c1d0d96a..4c18bce90 100644
--- a/packages/opencode/src/cli/cmd/debug/ripgrep.ts
+++ b/packages/opencode/src/cli/cmd/debug/ripgrep.ts
@@ -6,8 +6,7 @@ import { cmd } from "../cmd"
export const RipgrepCommand = cmd({
command: "rg",
- builder: (yargs) =>
- yargs.command(TreeCommand).command(FilesCommand).command(SearchCommand).demandCommand(),
+ builder: (yargs) => yargs.command(TreeCommand).command(FilesCommand).command(SearchCommand).demandCommand(),
async handler() {},
})
@@ -19,9 +18,7 @@ const TreeCommand = cmd({
}),
async handler(args) {
await bootstrap(process.cwd(), async () => {
- process.stdout.write(
- (await Ripgrep.tree({ cwd: Instance.directory, limit: args.limit })) + EOL,
- )
+ process.stdout.write((await Ripgrep.tree({ cwd: Instance.directory, limit: args.limit })) + EOL)
})
},
})
diff --git a/packages/opencode/src/cli/cmd/debug/snapshot.ts b/packages/opencode/src/cli/cmd/debug/snapshot.ts
index b114122b7..1849fe270 100644
--- a/packages/opencode/src/cli/cmd/debug/snapshot.ts
+++ b/packages/opencode/src/cli/cmd/debug/snapshot.ts
@@ -4,8 +4,7 @@ import { cmd } from "../cmd"
export const SnapshotCommand = cmd({
command: "snapshot",
- builder: (yargs) =>
- yargs.command(TrackCommand).command(PatchCommand).command(DiffCommand).demandCommand(),
+ builder: (yargs) => yargs.command(TrackCommand).command(PatchCommand).command(DiffCommand).demandCommand(),
async handler() {},
})
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts
index 6fbeee2ea..cd3ceb94b 100644
--- a/packages/opencode/src/cli/cmd/github.ts
+++ b/packages/opencode/src/cli/cmd/github.ts
@@ -189,9 +189,7 @@ export const GithubInstallCommand = cmd({
async function getAppInfo() {
const project = Instance.project
if (project.vcs !== "git") {
- prompts.log.error(
- `Could not find git repository. Please run this command from a git repository.`,
- )
+ prompts.log.error(`Could not find git repository. Please run this command from a git repository.`)
throw new UI.CancelledError()
}
@@ -204,13 +202,9 @@ export const GithubInstallCommand = cmd({
// ie. [email protected]:sst/opencode
// ie. ssh://[email protected]/sst/opencode.git
// ie. ssh://[email protected]/sst/opencode
- const parsed = info.match(
- /^(?:(?:https?|ssh):\/\/)?(?:git@)?github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/,
- )
+ const parsed = info.match(/^(?:(?:https?|ssh):\/\/)?(?:git@)?github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/)
if (!parsed) {
- prompts.log.error(
- `Could not find git repository. Please run this command from a git repository.`,
- )
+ prompts.log.error(`Could not find git repository. Please run this command from a git repository.`)
throw new UI.CancelledError()
}
const [, owner, repo] = parsed
@@ -451,9 +445,7 @@ export const GithubRunCommand = cmd({
const summary = await summarize(response)
await pushToLocalBranch(summary)
}
- const hasShared = prData.comments.nodes.some((c) =>
- c.body.includes(`${shareBaseUrl}/s/${shareId}`),
- )
+ const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${shareBaseUrl}/s/${shareId}`))
await updateComment(`${response}${footer({ image: !hasShared })}`)
}
// Fork PR
@@ -465,9 +457,7 @@ export const GithubRunCommand = cmd({
const summary = await summarize(response)
await pushToForkBranch(summary, prData)
}
- const hasShared = prData.comments.nodes.some((c) =>
- c.body.includes(`${shareBaseUrl}/s/${shareId}`),
- )
+ const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${shareBaseUrl}/s/${shareId}`))
await updateComment(`${response}${footer({ image: !hasShared })}`)
}
}
@@ -557,12 +547,8 @@ export const GithubRunCommand = cmd({
// ie. <img alt="Image" src="https://github.com/user-attachments/assets/xxxx" />
// ie. [api.json](https://github.com/user-attachments/files/21433810/api.json)
// ie. ![Image](https://github.com/user-attachments/assets/xxxx)
- const mdMatches = prompt.matchAll(
- /!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi,
- )
- const tagMatches = prompt.matchAll(
- /<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi,
- )
+ const mdMatches = prompt.matchAll(/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi)
+ const tagMatches = prompt.matchAll(/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi)
const matches = [...mdMatches, ...tagMatches].sort((a, b) => a.index - b.index)
console.log("Images", JSON.stringify(matches, null, 2))
@@ -587,10 +573,7 @@ export const GithubRunCommand = cmd({
// Replace img tag with file path, ie. @image.png
const replacement = `@${filename}`
- prompt =
- prompt.slice(0, start + offset) +
- replacement +
- prompt.slice(start + offset + tag.length)
+ prompt = prompt.slice(0, start + offset) + replacement + prompt.slice(start + offset + tag.length)
offset += replacement.length - tag.length
const contentType = res.headers.get("content-type")
@@ -873,8 +856,7 @@ Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
throw new Error(`Failed to check permissions for user ${actor}: ${error}`)
}
- if (!["admin", "write"].includes(permission))
- throw new Error(`User ${actor} does not have write permissions`)
+ if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
}
async function createComment() {
@@ -922,9 +904,7 @@ Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
return `<a href="${shareBaseUrl}/s/${shareId}"><img width="200" alt="${titleAlt}" src="https://social-cards.sst.dev/opencode-share/${title64}.png?model=${providerID}/${modelID}&version=${session.version}&id=${shareId}" /></a>\n`
})()
- const shareUrl = shareId
- ? `[opencode session](${shareBaseUrl}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;`
- : ""
+ const shareUrl = shareId ? `[opencode session](${shareBaseUrl}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
return `\n\n${image}${shareUrl}[github run](${runUrl})`
}
@@ -1100,13 +1080,9 @@ query($owner: String!, $repo: String!, $number: Int!) {
})
.map((c) => `- ${c.author.login} at ${c.createdAt}: ${c.body}`)
- const files = (pr.files.nodes || []).map(
- (f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`,
- )
+ const files = (pr.files.nodes || []).map((f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`)
const reviewData = (pr.reviews.nodes || []).map((r) => {
- const comments = (r.comments.nodes || []).map(
- (c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`,
- )
+ const comments = (r.comments.nodes || []).map((c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`)
return [
`- ${r.author.login} at ${r.submittedAt}:`,
` - Review body: ${r.body}`,
@@ -1128,15 +1104,9 @@ query($owner: String!, $repo: String!, $number: Int!) {
`Deletions: ${pr.deletions}`,
`Total Commits: ${pr.commits.totalCount}`,
`Changed Files: ${pr.files.nodes.length} files`,
- ...(comments.length > 0
- ? ["<pull_request_comments>", ...comments, "</pull_request_comments>"]
- : []),
- ...(files.length > 0
- ? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"]
- : []),
- ...(reviewData.length > 0
- ? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"]
- : []),
+ ...(comments.length > 0 ? ["<pull_request_comments>", ...comments, "</pull_request_comments>"] : []),
+ ...(files.length > 0 ? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"] : []),
+ ...(reviewData.length > 0 ? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"] : []),
"</pull_request>",
].join("\n")
}
diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts
index 756776d05..b646f0b15 100644
--- a/packages/opencode/src/cli/cmd/run.ts
+++ b/packages/opencode/src/cli/cmd/run.ts
@@ -138,9 +138,7 @@ export const RunCommand = cmd({
const outputJsonEvent = (type: string, data: any) => {
if (args.format === "json") {
- process.stdout.write(
- JSON.stringify({ type, timestamp: Date.now(), sessionID, ...data }) + EOL,
- )
+ process.stdout.write(JSON.stringify({ type, timestamp: Date.now(), sessionID, ...data }) + EOL)
return true
}
return false
@@ -160,9 +158,7 @@ export const RunCommand = cmd({
const [tool, color] = TOOL[part.tool] ?? [part.tool, UI.Style.TEXT_INFO_BOLD]
const title =
part.state.title ||
- (Object.keys(part.state.input).length > 0
- ? JSON.stringify(part.state.input)
- : "Unknown")
+ (Object.keys(part.state.input).length > 0 ? JSON.stringify(part.state.input) : "Unknown")
printEvent(color, tool, title)
if (part.tool === "bash" && part.state.output?.trim()) {
UI.println()
@@ -215,10 +211,7 @@ export const RunCommand = cmd({
],
initialValue: "once",
}).catch(() => "reject")
- const response = (result.toString().includes("cancel") ? "reject" : result) as
- | "once"
- | "always"
- | "reject"
+ const response = (result.toString().includes("cancel") ? "reject" : result) as "once" | "always" | "reject"
await sdk.postSessionIdPermissionsPermissionId({
path: { id: sessionID, permissionID: permission.id },
body: { response },
@@ -280,10 +273,7 @@ export const RunCommand = cmd({
}
const cfgResult = await sdk.config.get()
- if (
- cfgResult.data &&
- (cfgResult.data.share === "auto" || Flag.OPENCODE_AUTO_SHARE || args.share)
- ) {
+ if (cfgResult.data && (cfgResult.data.share === "auto" || Flag.OPENCODE_AUTO_SHARE || args.share)) {
const shareResult = await sdk.session.share({ path: { id: sessionID } }).catch((error) => {
if (error instanceof Error && error.message.includes("disabled")) {
UI.println(UI.Style.TEXT_DANGER_BOLD + "! " + error.message)
@@ -336,10 +326,7 @@ export const RunCommand = cmd({
}
const cfgResult = await sdk.config.get()
- if (
- cfgResult.data &&
- (cfgResult.data.share === "auto" || Flag.OPENCODE_AUTO_SHARE || args.share)
- ) {
+ if (cfgResult.data && (cfgResult.data.share === "auto" || Flag.OPENCODE_AUTO_SHARE || args.share)) {
const shareResult = await sdk.session.share({ path: { id: sessionID } }).catch((error) => {
if (error instanceof Error && error.message.includes("disabled")) {
UI.println(UI.Style.TEXT_DANGER_BOLD + "! " + error.message)
diff --git a/packages/opencode/src/cli/cmd/stats.ts b/packages/opencode/src/cli/cmd/stats.ts
index d7afbe330..58e8397db 100644
--- a/packages/opencode/src/cli/cmd/stats.ts
+++ b/packages/opencode/src/cli/cmd/stats.ts
@@ -68,9 +68,7 @@ async function getAllSessions(): Promise<Session.Info[]> {
if (!project) continue
const sessionKeys = await Storage.list(["session", project.id])
- const projectSessions = await Promise.all(
- sessionKeys.map((key) => Storage.read<Session.Info>(key)),
- )
+ const projectSessions = await Promise.all(sessionKeys.map((key) => Storage.read<Session.Info>(key)))
for (const session of projectSessions) {
if (session) {
@@ -87,16 +85,12 @@ async function aggregateSessionStats(days?: number, projectFilter?: string): Pro
const DAYS_IN_SECOND = 24 * 60 * 60 * 1000
const cutoffTime = days ? Date.now() - days * DAYS_IN_SECOND : 0
- let filteredSessions = days
- ? sessions.filter((session) => session.time.updated >= cutoffTime)
- : sessions
+ let filteredSessions = days ? sessions.filter((session) => session.time.updated >= cutoffTime) : sessions
if (projectFilter !== undefined) {
if (projectFilter === "") {
const currentProject = await getCurrentProject()
- filteredSessions = filteredSessions.filter(
- (session) => session.projectID === currentProject.id,
- )
+ filteredSessions = filteredSessions.filter((session) => session.projectID === currentProject.id)
} else {
filteredSessions = filteredSessions.filter((session) => session.projectID === projectFilter)
}
@@ -125,9 +119,7 @@ async function aggregateSessionStats(days?: number, projectFilter?: string): Pro
}
if (filteredSessions.length > 1000) {
- console.log(
- `Large dataset detected (${filteredSessions.length} sessions). This may take a while...`,
- )
+ console.log(`Large dataset detected (${filteredSessions.length} sessions). This may take a while...`)
}
if (filteredSessions.length === 0) {
@@ -262,8 +254,7 @@ export function displayStats(stats: SessionStats, toolLimit?: number) {
const percentage = ((count / totalToolUsage) * 100).toFixed(1)
const maxToolLength = 18
- const truncatedTool =
- tool.length > maxToolLength ? tool.substring(0, maxToolLength - 2) + ".." : tool
+ const truncatedTool = tool.length > maxToolLength ? tool.substring(0, maxToolLength - 2) + ".." : tool
const toolName = truncatedTool.padEnd(maxToolLength)
const content = ` ${toolName} ${bar.padEnd(20)} ${count.toString().padStart(3)} (${percentage.padStart(4)}%)`
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx
index 9d30ed6d8..fad233987 100644
--- a/packages/opencode/src/cli/cmd/tui/app.tsx
+++ b/packages/opencode/src/cli/cmd/tui/app.tsx
@@ -115,11 +115,7 @@ export function tui(input: {
render(
() => {
return (
- <ErrorBoundary
- fallback={(error, reset) => (
- <ErrorComponent error={error} reset={reset} onExit={onExit} />
- )}
- >
+ <ErrorBoundary fallback={(error, reset) => <ErrorComponent error={error} reset={reset} onExit={onExit} />}>
<ExitProvider onExit={onExit}>
<KVProvider>
<ToastProvider>
@@ -413,12 +409,7 @@ function App() {
flexShrink={0}
>
<box flexDirection="row">
- <box
- flexDirection="row"
- backgroundColor={theme.backgroundElement}
- paddingLeft={1}
- paddingRight={1}
- >
+ <box flexDirection="row" backgroundColor={theme.backgroundElement} paddingLeft={1} paddingRight={1}>
<text fg={theme.textMuted}>open</text>
<text fg={theme.text} attributes={TextAttributes.BOLD}>
code{" "}
@@ -434,11 +425,7 @@ function App() {
tab
</text>
<text fg={local.agent.color(local.agent.current().name)}>{""}</text>
- <text
- bg={local.agent.color(local.agent.current().name)}
- fg={theme.background}
- wrapMode={undefined}
- >
+ <text bg={local.agent.color(local.agent.current().name)} fg={theme.background} wrapMode={undefined}>
<span style={{ bold: true }}> {local.agent.current().name.toUpperCase()}</span>
<span> AGENT </span>
</text>
diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
index 154995997..04f2f6523 100644
--- a/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx
@@ -52,11 +52,7 @@ export function DialogModel() {
description: provider.name,
category: provider.name,
})),
- filter(
- (x) =>
- Boolean(ref()?.filter) ||
- !local.model.recent().find((y) => isDeepEqual(y, x.value)),
- ),
+ filter((x) => Boolean(ref()?.filter) || !local.model.recent().find((y) => isDeepEqual(y, x.value))),
),
),
),
diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
index c4f318451..5e0095a8d 100644
--- a/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
@@ -20,9 +20,7 @@ export function DialogSessionList() {
const deleteKeybind = "ctrl+d"
- const currentSessionID = createMemo(() =>
- route.data.type === "session" ? route.data.sessionID : undefined,
- )
+ const currentSessionID = createMemo(() => (route.data.type === "session" ? route.data.sessionID : undefined))
const options = createMemo(() => {
const today = new Date().toDateString()
diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx
index d1ef5ca56..e427e24e9 100644
--- a/packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx
@@ -77,10 +77,7 @@ export function DialogStatus() {
</For>
</box>
)}
- <Show
- when={enabledFormatters().length > 0}
- fallback={<text fg={theme.text}>No Formatters</text>}
- >
+ <Show when={enabledFormatters().length > 0} fallback={<text fg={theme.text}>No Formatters</text>}>
<box>
<text fg={theme.text}>{enabledFormatters().length} Formatters</text>
<For each={enabledFormatters()}>
diff --git a/packages/opencode/src/cli/cmd/tui/component/logo.tsx b/packages/opencode/src/cli/cmd/tui/component/logo.tsx
index 7cac51ecc..59db5fe7d 100644
--- a/packages/opencode/src/cli/cmd/tui/component/logo.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/logo.tsx
@@ -3,19 +3,9 @@ import { TextAttributes } from "@opentui/core"
import { For } from "solid-js"
import { useTheme } from "@tui/context/theme"
-const LOGO_LEFT = [
- ` `,
- `█▀▀█ █▀▀█ █▀▀█ █▀▀▄`,
- `█░░█ █░░█ █▀▀▀ █░░█`,
- `▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀`,
-]
+const LOGO_LEFT = [` `, `█▀▀█ █▀▀█ █▀▀█ █▀▀▄`, `█░░█ █░░█ █▀▀▀ █░░█`, `▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀`]
-const LOGO_RIGHT = [
- ` ▄ `,
- `█▀▀▀ █▀▀█ █▀▀█ █▀▀█`,
- `█░░░ █░░█ █░░█ █▀▀▀`,
- `▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`,
-]
+const LOGO_RIGHT = [` ▄ `, `█▀▀▀ █▀▀█ █▀▀█ █▀▀█`, `█░░░ █░░█ █░░█ █▀▀▀`, `▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`]
export function Logo() {
const { theme } = useTheme()
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
index 88ca32420..68578e708 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
@@ -83,12 +83,7 @@ export function Autocomplete(props: {
const extmarkStart = store.index
const extmarkEnd = extmarkStart + Bun.stringWidth(virtualText)
- const styleId =
- part.type === "file"
- ? props.fileStyleId
- : part.type === "agent"
- ? props.agentStyleId
- : undefined
+ const styleId = part.type === "file" ? props.fileStyleId : part.type === "agent" ? props.agentStyleId : undefined
const extmarkId = input.extmarks.create({
start: extmarkStart,
@@ -185,9 +180,7 @@ export function Autocomplete(props: {
)
})
- const session = createMemo(() =>
- props.sessionID ? sync.session.get(props.sessionID) : undefined,
- )
+ const session = createMemo(() => (props.sessionID ? sync.session.get(props.sessionID) : undefined))
const commands = createMemo((): AutocompleteOption[] => {
const results: AutocompleteOption[] = []
const s = session()
@@ -324,9 +317,7 @@ export function Autocomplete(props: {
const options = createMemo(() => {
const mixed: AutocompleteOption[] = (
- store.visible === "@"
- ? [...agents(), ...(files.loading ? files.latest || [] : files())]
- : [...commands()]
+ store.visible === "@" ? [...agents(), ...(files.loading ? files.latest || [] : files())] : [...commands()]
).filter((x) => x.disabled !== true)
const currentFilter = filter()
if (!currentFilter) return mixed.slice(0, 10)
@@ -393,9 +384,7 @@ export function Autocomplete(props: {
return
}
// Check if a space was typed after the trigger character
- const currentText = props
- .input()
- .getTextRange(store.index + 1, props.input().cursorOffset + 1)
+ const currentText = props.input().getTextRange(store.index + 1, props.input().cursorOffset + 1)
if (currentText.includes(" ")) {
hide()
}
@@ -433,13 +422,8 @@ export function Autocomplete(props: {
if (e.name === "@") {
const cursorOffset = props.input().cursorOffset
const charBeforeCursor =
- cursorOffset === 0
- ? undefined
- : props.input().getTextRange(cursorOffset - 1, cursorOffset)
- const canTrigger =
- charBeforeCursor === undefined ||
- charBeforeCursor === "" ||
- /\s/.test(charBeforeCursor)
+ cursorOffset === 0 ? undefined : props.input().getTextRange(cursorOffset - 1, cursorOffset)
+ const canTrigger = charBeforeCursor === undefined || charBeforeCursor === "" || /\s/.test(charBeforeCursor)
if (canTrigger) show("@")
}
@@ -487,10 +471,7 @@ export function Autocomplete(props: {
{option.display}
</text>
<Show when={option.description}>
- <text
- fg={index() === store.selected ? theme.background : theme.textMuted}
- wrapMode="none"
- >
+ <text fg={index() === store.selected ? theme.background : theme.textMuted} wrapMode="none">
{option.description}
</text>
</Show>
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
index b9e406598..eac00d9e7 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
@@ -334,9 +334,7 @@ export function Prompt(props: PromptProps) {
// Expand pasted text inline before submitting
const allExtmarks = input.extmarks.getAllForTypeId(promptPartTypeId)
- const sortedExtmarks = allExtmarks.sort(
- (a: { start: number }, b: { start: number }) => b.start - a.start,
- )
+ const sortedExtmarks = allExtmarks.sort((a: { start: number }, b: { start: number }) => b.start - a.start)
for (const extmark of sortedExtmarks) {
const partIndex = store.extmarkToPartIndex.get(extmark.id)
@@ -499,28 +497,15 @@ export function Prompt(props: PromptProps) {
<box
flexDirection="row"
{...SplitBorder}
- borderColor={
- keybind.leader ? theme.accent : store.mode === "shell" ? theme.secondary : theme.border
- }
+ borderColor={keybind.leader ? theme.accent : store.mode === "shell" ? theme.secondary : theme.border}
justifyContent="space-evenly"
>
- <box
- backgroundColor={theme.backgroundElement}
- width={3}
- height="100%"
- alignItems="center"
- paddingTop={1}
- >
+ <box backgroundColor={theme.backgroundElement} width={3} height="100%" alignItems="center" paddingTop={1}>
<text attributes={TextAttributes.BOLD} fg={theme.primary}>
{store.mode === "normal" ? ">" : "!"}
</text>
</box>
- <box
- paddingTop={1}
- paddingBottom={1}
- backgroundColor={theme.backgroundElement}
- flexGrow={1}
- >
+ <box paddingTop={1} paddingBottom={1} backgroundColor={theme.backgroundElement} flexGrow={1}>
<textarea
placeholder={
props.showPlaceholder
@@ -575,10 +560,7 @@ export function Prompt(props: PromptProps) {
return
}
if (store.mode === "shell") {
- if (
- (e.name === "backspace" && input.visualCursor.offset === 0) ||
- e.name === "escape"
- ) {
+ if ((e.name === "backspace" && input.visualCursor.offset === 0) || e.name === "escape") {
setStore("mode", "normal")
e.preventDefault()
return
@@ -588,8 +570,7 @@ export function Prompt(props: PromptProps) {
if (!autocomplete.visible) {
if (
(keybind.match("history_previous", e) && input.cursorOffset === 0) ||
- (keybind.match("history_next", e) &&
- input.cursorOffset === input.plainText.length)
+ (keybind.match("history_next", e) && input.cursorOffset === input.plainText.length)
) {
const direction = keybind.match("history_previous", e) ? -1 : 1
const item = history.move(direction, input.plainText)
@@ -605,12 +586,8 @@ export function Prompt(props: PromptProps) {
return
}
- if (keybind.match("history_previous", e) && input.visualCursor.visualRow === 0)
- input.cursorOffset = 0
- if (
- keybind.match("history_next", e) &&
- input.visualCursor.visualRow === input.height - 1
- )
+ if (keybind.match("history_previous", e) && input.visualCursor.visualRow === 0) input.cursorOffset = 0
+ if (keybind.match("history_next", e) && input.visualCursor.visualRow === input.height - 1)
input.cursorOffset = input.plainText.length
}
}}
@@ -701,12 +678,7 @@ export function Prompt(props: PromptProps) {
syntaxStyle={syntax()}
/>
</box>
- <box
- backgroundColor={theme.backgroundElement}
- width={1}
- justifyContent="center"
- alignItems="center"
- ></box>
+ <box backgroundColor={theme.backgroundElement} width={1} justifyContent="center" alignItems="center"></box>
</box>
<box flexDirection="row" justifyContent="space-between">
<text flexShrink={0} wrapMode="none" fg={theme.text}>
@@ -727,8 +699,7 @@ export function Prompt(props: PromptProps) {
<Match when={props.hint}>{props.hint!}</Match>
<Match when={true}>
<text fg={theme.text}>
- {keybind.print("command_list")}{" "}
- <span style={{ fg: theme.textMuted }}>commands</span>
+ {keybind.print("command_list")} <span style={{ fg: theme.textMuted }}>commands</span>
</text>
</Match>
</Switch>
diff --git a/packages/opencode/src/cli/cmd/tui/context/local.tsx b/packages/opencode/src/cli/cmd/tui/context/local.tsx
index ef26ee656..0b7017c6d 100644
--- a/packages/opencode/src/cli/cmd/tui/context/local.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/local.tsx
@@ -22,9 +22,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
return !!provider?.models[model.modelID]
}
- function getFirstValidModel(
- ...modelFns: (() => { providerID: string; modelID: string } | undefined)[]
- ) {
+ function getFirstValidModel(...modelFns: (() => { providerID: string; modelID: string } | undefined)[]) {
for (const modelFn of modelFns) {
const model = modelFn()
if (!model) continue
@@ -213,9 +211,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
const current = currentModel()
if (!current) return
const recent = modelStore.recent
- const index = recent.findIndex(
- (x) => x.providerID === current.providerID && x.modelID === current.modelID,
- )
+ const index = recent.findIndex((x) => x.providerID === current.providerID && x.modelID === current.modelID)
if (index === -1) return
let next = index + direction
if (next < 0) next = recent.length - 1
diff --git a/packages/opencode/src/cli/cmd/tui/context/sync.tsx b/packages/opencode/src/cli/cmd/tui/context/sync.tsx
index 60758aeb1..13425cd28 100644
--- a/packages/opencode/src/cli/cmd/tui/context/sync.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/sync.tsx
@@ -146,12 +146,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
}
const result = Binary.search(messages, event.properties.info.id, (m) => m.id)
if (result.found) {
- setStore(
- "message",
- event.properties.info.sessionID,
- result.index,
- reconcile(event.properties.info),
- )
+ setStore("message", event.properties.info.sessionID, result.index, reconcile(event.properties.info))
break
}
setStore(
@@ -186,12 +181,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
}
const result = Binary.search(parts, event.properties.part.id, (p) => p.id)
if (result.found) {
- setStore(
- "part",
- event.properties.part.messageID,
- result.index,
- reconcile(event.properties.part),
- )
+ setStore("part", event.properties.part.messageID, result.index, reconcile(event.properties.part))
break
}
setStore(
diff --git a/packages/opencode/src/cli/cmd/tui/context/theme.tsx b/packages/opencode/src/cli/cmd/tui/context/theme.tsx
index a609bcc94..e7967c2b5 100644
--- a/packages/opencode/src/cli/cmd/tui/context/theme.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/theme.tsx
@@ -528,13 +528,7 @@ function generateSyntax(theme: Theme) {
},
},
{
- scope: [
- "variable.builtin",
- "type.builtin",
- "function.builtin",
- "module.builtin",
- "constant.builtin",
- ],
+ scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin"],
style: {
foreground: theme.error,
},
diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx
index a01bfa6a2..b6748ac8a 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx
@@ -26,11 +26,7 @@ export function Home() {
</Match>
<Match when={true}>
<span style={{ fg: theme.success }}>•</span>{" "}
- {Locale.pluralize(
- Object.values(sync.data.mcp).length,
- "{} mcp server",
- "{} mcp servers",
- )}
+ {Locale.pluralize(Object.values(sync.data.mcp).length, "{} mcp server", "{} mcp servers")}
</Match>
</Switch>
</text>
@@ -39,14 +35,7 @@ export function Home() {
)
return (
- <box
- flexGrow={1}
- justifyContent="center"
- alignItems="center"
- paddingLeft={2}
- paddingRight={2}
- gap={1}
- >
+ <box flexGrow={1} justifyContent="center" alignItems="center" paddingLeft={2} paddingRight={2} gap={1}>
<Logo />
<box width={39}>
<HelpRow keybind="command_list">Commands</HelpRow>
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx
index cfdd4d694..ee2b77afc 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx
@@ -7,9 +7,7 @@ import { useRoute } from "@tui/context/route"
export function DialogMessage(props: { messageID: string; sessionID: string }) {
const sync = useSync()
const sdk = useSDK()
- const message = createMemo(() =>
- sync.data.message[props.sessionID]?.find((x) => x.id === props.messageID),
- )
+ const message = createMemo(() => sync.data.message[props.sessionID]?.find((x) => x.id === props.messageID))
const route = useRoute()
return (
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx
index b440ee1a0..f5976cdf0 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-timeline.tsx
@@ -19,9 +19,7 @@ export function DialogTimeline(props: { sessionID: string; onMove: (messageID: s
const result = [] as DialogSelectOption<string>[]
for (const message of messages) {
if (message.role !== "user") continue
- const part = (sync.data.part[message.id] ?? []).find(
- (x) => x.type === "text" && !x.synthetic,
- ) as TextPart
+ const part = (sync.data.part[message.id] ?? []).find((x) => x.type === "text" && !x.synthetic) as TextPart
if (!part) continue
result.push({
title: part.text.replace(/\n/g, " "),
@@ -35,11 +33,5 @@ export function DialogTimeline(props: { sessionID: string; onMove: (messageID: s
return result
})
- return (
- <DialogSelect
- onMove={(option) => props.onMove(option.value)}
- title="Timeline"
- options={options()}
- />
- )
+ return <DialogSelect onMove={(option) => props.onMove(option.value)} title="Timeline" options={options()} />
}
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/header.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/header.tsx
index 019042519..9988fbd55 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/header.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/header.tsx
@@ -46,16 +46,10 @@ export function Header() {
})
const context = createMemo(() => {
- const last = messages().findLast(
- (x) => x.role === "assistant" && x.tokens.output > 0,
- ) as AssistantMessage
+ const last = messages().findLast((x) => x.role === "assistant" && x.tokens.output > 0) as AssistantMessage
if (!last) return
const total =
- last.tokens.input +
- last.tokens.output +
- last.tokens.reasoning +
- last.tokens.cache.read +
- last.tokens.cache.write
+ last.tokens.input + last.tokens.output + last.tokens.reasoning + last.tokens.cache.read + last.tokens.cache.write
const model = sync.data.provider.find((x) => x.id === last.providerID)?.models[last.modelID]
let result = total.toLocaleString()
if (model?.limit.context) {
@@ -67,13 +61,7 @@ export function Header() {
const { theme } = useTheme()
return (
- <box
- paddingLeft={1}
- paddingRight={1}
- {...SplitBorder}
- borderColor={theme.backgroundElement}
- flexShrink={0}
- >
+ <box paddingLeft={1} paddingRight={1} {...SplitBorder} borderColor={theme.backgroundElement} flexShrink={0}>
<Show
when={shareEnabled()}
fallback={
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
index cd3a8f72d..50bf21e0f 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
@@ -19,14 +19,7 @@ import { SplitBorder } from "@tui/component/border"
import { useTheme } from "@tui/context/theme"
import { BoxRenderable, ScrollBoxRenderable, addDefaultParsers } from "@opentui/core"
import { Prompt, type PromptRef } from "@tui/component/prompt"
-import type {
- AssistantMessage,
- Part,
- ToolPart,
- UserMessage,
- TextPart,
- ReasoningPart,
-} from "@opencode-ai/sdk"
+import type { AssistantMessage, Part, ToolPart, UserMessage, TextPart, ReasoningPart } from "@opencode-ai/sdk"
import { useLocal } from "@tui/context/local"
import { Locale } from "@/util/locale"
import type { Tool } from "@/tool/tool"
@@ -41,13 +34,7 @@ import type { EditTool } from "@/tool/edit"
import type { PatchTool } from "@/tool/patch"
import type { WebFetchTool } from "@/tool/webfetch"
import type { TaskTool } from "@/tool/task"
-import {
- useKeyboard,
- useRenderer,
- useTerminalDimensions,
- type BoxProps,
- type JSX,
-} from "@opentui/solid"
+import { useKeyboard, useRenderer, useTerminalDimensions, type BoxProps, type JSX } from "@opentui/solid"
import { useSDK } from "@tui/context/sdk"
import { useCommandDialog } from "@tui/component/dialog-command"
import { Shimmer } from "@tui/ui/shimmer"
@@ -653,14 +640,7 @@ export function Session() {
conceal,
}}
>
- <box
- flexDirection="row"
- paddingBottom={1}
- paddingTop={1}
- paddingLeft={2}
- paddingRight={2}
- gap={2}
- >
+ <box flexDirection="row" paddingBottom={1} paddingTop={1} paddingLeft={2} paddingRight={2} gap={2}>
<box flexGrow={1} gap={1}>
<Show when={session()}>
<Show when={session().parentID}>
@@ -675,19 +655,13 @@ export function Session() {
paddingRight={2}
>
<text fg={theme.text}>
- Previous{" "}
- <span style={{ fg: theme.textMuted }}>
- {keybind.print("session_child_cycle_reverse")}
- </span>
+ Previous <span style={{ fg: theme.textMuted }}>{keybind.print("session_child_cycle_reverse")}</span>
</text>
<text fg={theme.text}>
<b>Viewing subagent session</b>
</text>
<text fg={theme.text}>
- <span style={{ fg: theme.textMuted }}>
- {keybind.print("session_child_cycle")}
- </span>{" "}
- Next
+ <span style={{ fg: theme.textMuted }}>{keybind.print("session_child_cycle")}</span> Next
</text>
</box>
</Show>
@@ -743,18 +717,12 @@ export function Session() {
paddingTop={1}
paddingBottom={1}
paddingLeft={2}
- backgroundColor={
- hover() ? theme.backgroundElement : theme.backgroundPanel
- }
+ backgroundColor={hover() ? theme.backgroundElement : theme.backgroundPanel}
>
+ <text fg={theme.textMuted}>{revert()!.reverted.length} message reverted</text>
<text fg={theme.textMuted}>
- {revert()!.reverted.length} message reverted
- </text>
- <text fg={theme.textMuted}>
- <span style={{ fg: theme.text }}>
- {keybind.print("messages_redo")}
- </span>{" "}
- or /redo to restore
+ <span style={{ fg: theme.text }}>{keybind.print("messages_redo")}</span> or /redo to
+ restore
</text>
<Show when={revert()!.diffFiles?.length}>
<box marginTop={1}>
@@ -763,16 +731,10 @@ export function Session() {
<text>
{file.filename}
<Show when={file.additions > 0}>
- <span style={{ fg: theme.diffAdded }}>
- {" "}
- +{file.additions}
- </span>
+ <span style={{ fg: theme.diffAdded }}> +{file.additions}</span>
</Show>
<Show when={file.deletions > 0}>
- <span style={{ fg: theme.diffRemoved }}>
- {" "}
- -{file.deletions}
- </span>
+ <span style={{ fg: theme.diffRemoved }}> -{file.deletions}</span>
</Show>
</text>
)}
@@ -792,9 +754,7 @@ export function Session() {
index={index()}
onMouseUp={() => {
if (renderer.getSelection()?.getSelectedText()) return
- dialog.replace(() => (
- <DialogMessage messageID={message.id} sessionID={route.sessionID} />
- ))
+ dialog.replace(() => <DialogMessage messageID={message.id} sessionID={route.sessionID} />)
}}
message={message as UserMessage}
parts={sync.data.part[message.id] ?? []}
@@ -850,9 +810,7 @@ function UserMessage(props: {
index: number
pending?: string
}) {
- const text = createMemo(
- () => props.parts.flatMap((x) => (x.type === "text" && !x.synthetic ? [x] : []))[0],
- )
+ const text = createMemo(() => props.parts.flatMap((x) => (x.type === "text" && !x.synthetic ? [x] : []))[0])
const files = createMemo(() => props.parts.flatMap((x) => (x.type === "file" ? [x] : [])))
const sync = useSync()
const { theme } = useTheme()
@@ -893,14 +851,8 @@ function UserMessage(props: {
})
return (
<text fg={theme.text}>
- <span style={{ bg: bg(), fg: theme.background }}>
- {" "}
- {MIME_BADGE[file.mime] ?? file.mime}{" "}
- </span>
- <span style={{ bg: theme.backgroundElement, fg: theme.textMuted }}>
- {" "}
- {file.filename}{" "}
- </span>
+ <span style={{ bg: bg(), fg: theme.background }}> {MIME_BADGE[file.mime] ?? file.mime} </span>
+ <span style={{ bg: theme.backgroundElement, fg: theme.textMuted }}> {file.filename} </span>
</text>
)
}}
@@ -911,16 +863,9 @@ function UserMessage(props: {
{sync.data.config.username ?? "You"}{" "}
<Show
when={queued()}
- fallback={
- <span style={{ fg: theme.textMuted }}>
- ({Locale.time(props.message.time.created)})
- </span>
- }
+ fallback={<span style={{ fg: theme.textMuted }}>({Locale.time(props.message.time.created)})</span>}
>
- <span style={{ bg: theme.accent, fg: theme.backgroundPanel, bold: true }}>
- {" "}
- QUEUED{" "}
- </span>
+ <span style={{ bg: theme.accent, fg: theme.backgroundPanel, bold: true }}> QUEUED </span>
</Show>
</text>
</box>
@@ -960,8 +905,7 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
<Show
when={
!props.message.time.completed ||
- (props.last &&
- props.parts.some((item) => item.type === "step-finish" && item.reason === "tool-calls"))
+ (props.last && props.parts.some((item) => item.type === "step-finish" && item.reason === "tool-calls"))
}
>
<box
@@ -973,9 +917,7 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
customBorderChars={SplitBorder.customBorderChars}
borderColor={theme.backgroundElement}
>
- <text fg={local.agent.color(props.message.mode)}>
- {Locale.titlecase(props.message.mode)}
- </text>
+ <text fg={local.agent.color(props.message.mode)}>{Locale.titlecase(props.message.mode)}</text>
<Shimmer text={`${props.message.modelID}`} color={theme.text} />
</box>
</Show>
@@ -987,9 +929,7 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
>
<box paddingLeft={3}>
<text marginTop={1}>
- <span style={{ fg: local.agent.color(props.message.mode) }}>
- {Locale.titlecase(props.message.mode)}
- </span>{" "}
+ <span style={{ fg: local.agent.color(props.message.mode) }}>{Locale.titlecase(props.message.mode)}</span>{" "}
<span style={{ fg: theme.textMuted }}>{props.message.modelID}</span>
</text>
</box>
@@ -1016,12 +956,7 @@ function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }
customBorderChars={SplitBorder.customBorderChars}
borderColor={theme.backgroundPanel}
>
- <box
- paddingTop={1}
- paddingBottom={1}
- paddingLeft={2}
- backgroundColor={theme.backgroundPanel}
- >
+ <box paddingTop={1} paddingBottom={1} paddingLeft={2} backgroundColor={theme.backgroundPanel}>
<text fg={theme.text}>{props.part.text.trim()}</text>
</box>
</box>
@@ -1261,16 +1196,10 @@ ToolRegistry.register<typeof WriteTool>({
</ToolTitle>
<box flexDirection="row">
<box flexShrink={0}>
- <For each={numbers()}>
- {(value) => <text style={{ fg: theme.textMuted }}>{value}</text>}
- </For>
+ <For each={numbers()}>{(value) => <text style={{ fg: theme.textMuted }}>{value}</text>}</For>
</box>
<box paddingLeft={1} flexGrow={1}>
- <code
- filetype={filetype(props.input.filePath!)}
- syntaxStyle={syntax()}
- content={code()}
- />
+ <code filetype={filetype(props.input.filePath!)} syntaxStyle={syntax()} content={code()} />
</box>
</box>
</>
@@ -1285,8 +1214,7 @@ ToolRegistry.register<typeof GlobTool>({
return (
<>
<ToolTitle icon="✱" fallback="Finding files..." when={props.input.pattern}>
- Glob "{props.input.pattern}"{" "}
- <Show when={props.input.path}>in {normalizePath(props.input.path)} </Show>
+ Glob "{props.input.pattern}" <Show when={props.input.path}>in {normalizePath(props.input.path)} </Show>
<Show when={props.metadata.count}>({props.metadata.count} matches)</Show>
</ToolTitle>
</>
@@ -1300,8 +1228,7 @@ ToolRegistry.register<typeof GrepTool>({
render(props) {
return (
<ToolTitle icon="✱" fallback="Searching content..." when={props.input.pattern}>
- Grep "{props.input.pattern}"{" "}
- <Show when={props.input.path}>in {normalizePath(props.input.path)} </Show>
+ Grep "{props.input.pattern}" <Show when={props.input.path}>in {normalizePath(props.input.path)} </Show>
<Show when={props.metadata.matches}>({props.metadata.matches} matches)</Show>
</ToolTitle>
)
@@ -1337,11 +1264,7 @@ ToolRegistry.register<typeof TaskTool>({
return (
<>
- <ToolTitle
- icon="%"
- fallback="Delegating..."
- when={props.input.subagent_type ?? props.input.description}
- >
+ <ToolTitle icon="%" fallback="Delegating..." when={props.input.subagent_type ?? props.input.description}>
Task [{props.input.subagent_type ?? "unknown"}] {props.input.description}
</ToolTitle>
<Show when={props.metadata.summary?.length}>
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx
index 776b80bfd..f6f3f7c73 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx
@@ -22,16 +22,10 @@ export function Sidebar(props: { sessionID: string }) {
})
const context = createMemo(() => {
- const last = messages().findLast(
- (x) => x.role === "assistant" && x.tokens.output > 0,
- ) as AssistantMessage
+ const last = messages().findLast((x) => x.role === "assistant" && x.tokens.output > 0) as AssistantMessage
if (!last) return
const total =
- last.tokens.input +
- last.tokens.output +
- last.tokens.reasoning +
- last.tokens.cache.read +
- last.tokens.cache.write
+ last.tokens.input + last.tokens.output + last.tokens.reasoning + last.tokens.cache.read + last.tokens.cache.write
const model = sync.data.provider.find((x) => x.id === last.providerID)?.models[last.modelID]
return {
tokens: total.toLocaleString(),
@@ -84,9 +78,7 @@ export function Sidebar(props: { sessionID: string }) {
<span style={{ fg: theme.textMuted }}>
<Switch>
<Match when={item.status === "connected"}>Connected</Match>
- <Match when={item.status === "failed" && item}>
- {(val) => <i>{val().error}</i>}
- </Match>
+ <Match when={item.status === "failed" && item}>{(val) => <i>{val().error}</i>}</Match>
<Match when={item.status === "disabled"}>Disabled in configuration</Match>
</Switch>
</span>
@@ -162,9 +154,7 @@ export function Sidebar(props: { sessionID: string }) {
</text>
<For each={todo()}>
{(todo) => (
- <text
- style={{ fg: todo.status === "in_progress" ? theme.success : theme.textMuted }}
- >
+ <text style={{ fg: todo.status === "in_progress" ? theme.success : theme.textMuted }}>
[{todo.status === "completed" ? "✓" : " "}] {todo.content}
</text>
)}
diff --git a/packages/opencode/src/cli/cmd/tui/spawn.ts b/packages/opencode/src/cli/cmd/tui/spawn.ts
index 6a1975131..29c9a3590 100644
--- a/packages/opencode/src/cli/cmd/tui/spawn.ts
+++ b/packages/opencode/src/cli/cmd/tui/spawn.ts
@@ -41,12 +41,7 @@ export const TuiSpawnCommand = cmd({
)
cwd = new URL("../../../../", import.meta.url).pathname
} else cmd.push(process.execPath)
- cmd.push(
- "attach",
- server.url.toString(),
- "--dir",
- args.project ? path.resolve(args.project) : process.cwd(),
- )
+ cmd.push("attach", server.url.toString(), "--dir", args.project ? path.resolve(args.project) : process.cwd())
const proc = Bun.spawn({
cmd,
cwd,
diff --git a/packages/opencode/src/cli/cmd/tui/thread.ts b/packages/opencode/src/cli/cmd/tui/thread.ts
index c530c8884..c4b96e6da 100644
--- a/packages/opencode/src/cli/cmd/tui/thread.ts
+++ b/packages/opencode/src/cli/cmd/tui/thread.ts
@@ -99,9 +99,7 @@ export const TuiThreadCommand = cmd({
const worker = new Worker(workerPath, {
env: Object.fromEntries(
- Object.entries(process.env).filter(
- (entry): entry is [string, string] => entry[1] !== undefined,
- ),
+ Object.entries(process.env).filter((entry): entry is [string, string] => entry[1] !== undefined),
),
})
worker.onerror = console.error
diff --git a/packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx b/packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx
index f79ae0555..dd5b238b1 100644
--- a/packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx
+++ b/packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx
@@ -53,9 +53,7 @@ export function DialogConfirm(props: DialogConfirmProps) {
dialog.clear()
}}
>
- <text fg={key === store.active ? theme.background : theme.textMuted}>
- {Locale.titlecase(key)}
- </text>
+ <text fg={key === store.active ? theme.background : theme.textMuted}>{Locale.titlecase(key)}</text>
</box>
)}
</For>
diff --git a/packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx b/packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx
index f08e0dabf..19624147d 100644
--- a/packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx
+++ b/packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx
@@ -20,17 +20,10 @@ export function DialogHelp() {
<text fg={theme.textMuted}>esc/enter</text>
</box>
<box paddingBottom={1}>
- <text fg={theme.textMuted}>
- Press Ctrl+P to see all available actions and commands in any context.
- </text>
+ <text fg={theme.textMuted}>Press Ctrl+P to see all available actions and commands in any context.</text>
</box>
<box flexDirection="row" justifyContent="flex-end" paddingBottom={1}>
- <box
- paddingLeft={3}
- paddingRight={3}
- backgroundColor={theme.primary}
- onMouseUp={() => dialog.clear()}
- >
+ <box paddingLeft={3} paddingRight={3} backgroundColor={theme.primary} onMouseUp={() => dialog.clear()}>
<text fg={theme.background}>ok</text>
</box>
</box>
diff --git a/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx b/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
index b442f7b34..106510679 100644
--- a/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
+++ b/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
@@ -57,8 +57,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
const result = pipe(
props.options,
filter((x) => x.disabled !== true),
- (x) =>
- !needle ? x : fuzzysort.go(needle, x, { keys: ["title", "category"] }).map((x) => x.obj),
+ (x) => (!needle ? x : fuzzysort.go(needle, x, { keys: ["title", "category"] }).map((x) => x.obj)),
)
return result
})
@@ -214,15 +213,11 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
props.onSelect?.(option)
}}
onMouseOver={() => {
- const index = filtered().findIndex((x) =>
- isDeepEqual(x.value, option.value),
- )
+ const index = filtered().findIndex((x) => isDeepEqual(x.value, option.value))
if (index === -1) return
moveTo(index)
}}
- backgroundColor={
- active() ? (option.bg ?? theme.primary) : RGBA.fromInts(0, 0, 0, 0)
- }
+ backgroundColor={active() ? (option.bg ?? theme.primary) : RGBA.fromInts(0, 0, 0, 0)}
paddingLeft={1}
paddingRight={1}
gap={1}
@@ -230,9 +225,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
<Option
title={option.title}
footer={option.footer}
- description={
- option.description !== category ? option.description : undefined
- }
+ description={option.description !== category ? option.description : undefined}
active={active()}
current={isDeepEqual(option.value, props.current)}
/>
@@ -248,9 +241,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
<For each={props.keybind ?? []}>
{(item) => (
<text>
- <span style={{ fg: theme.text, attributes: TextAttributes.BOLD }}>
- {Keybind.toString(item.keybind)}
- </span>
+ <span style={{ fg: theme.text, attributes: TextAttributes.BOLD }}>{Keybind.toString(item.keybind)}</span>
<span style={{ fg: theme.textMuted }}> {item.title}</span>
</text>
)}
@@ -284,10 +275,7 @@ function Option(props: {
wrapMode="none"
>
{Locale.truncate(props.title, 62)}
- <span style={{ fg: props.active ? theme.background : theme.textMuted }}>
- {" "}
- {props.description}
- </span>
+ <span style={{ fg: props.active ? theme.background : theme.textMuted }}> {props.description}</span>
</text>
<Show when={props.footer}>
<box flexShrink={0}>
diff --git a/packages/opencode/src/cli/cmd/tui/util/editor.ts b/packages/opencode/src/cli/cmd/tui/util/editor.ts
index 18a1400c9..0aa69dcd8 100644
--- a/packages/opencode/src/cli/cmd/tui/util/editor.ts
+++ b/packages/opencode/src/cli/cmd/tui/util/editor.ts
@@ -5,10 +5,7 @@ import { join } from "node:path"
import { CliRenderer } from "@opentui/core"
export namespace Editor {
- export async function open(opts: {
- value: string
- renderer: CliRenderer
- }): Promise<string | undefined> {
+ export async function open(opts: { value: string; renderer: CliRenderer }): Promise<string | undefined> {
const editor = process.env["EDITOR"]
if (!editor) return
diff --git a/packages/opencode/src/cli/cmd/upgrade.ts b/packages/opencode/src/cli/cmd/upgrade.ts
index f0ca48014..65f3bab4d 100644
--- a/packages/opencode/src/cli/cmd/upgrade.ts
+++ b/packages/opencode/src/cli/cmd/upgrade.ts
@@ -27,9 +27,7 @@ export const UpgradeCommand = {
const detectedMethod = await Installation.method()
const method = (args.method as Installation.Method) ?? detectedMethod
if (method === "unknown") {
- prompts.log.error(
- `opencode is installed to ${process.execPath} and may be managed by a package manager`,
- )
+ prompts.log.error(`opencode is installed to ${process.execPath} and may be managed by a package manager`)
const install = await prompts.select({
message: "Install anyways?",
options: [
diff --git a/packages/opencode/src/cli/cmd/web.ts b/packages/opencode/src/cli/cmd/web.ts
index 9d3a42539..3d3036b1b 100644
--- a/packages/opencode/src/cli/cmd/web.ts
+++ b/packages/opencode/src/cli/cmd/web.ts
@@ -56,11 +56,7 @@ export const WebCommand = cmd({
if (hostname === "0.0.0.0") {
// Show localhost for local access
const localhostUrl = `http://localhost:${server.port}`
- UI.println(
- UI.Style.TEXT_INFO_BOLD + " Local access: ",
- UI.Style.TEXT_NORMAL,
- localhostUrl,
- )
+ UI.println(UI.Style.TEXT_INFO_BOLD + " Local access: ", UI.Style.TEXT_NORMAL, localhostUrl)
// Show network IPs for remote access
const networkIPs = getNetworkIPs()
diff --git a/packages/opencode/src/cli/error.ts b/packages/opencode/src/cli/error.ts
index 7c873ae50..b3ff5670e 100644
--- a/packages/opencode/src/cli/error.ts
+++ b/packages/opencode/src/cli/error.ts
@@ -8,8 +8,7 @@ export function FormatError(input: unknown) {
return `MCP server "${input.data.name}" failed. Note, opencode does not support MCP authentication yet.`
if (Config.JsonError.isInstance(input)) {
return (
- `Config file at ${input.data.path} is not valid JSON(C)` +
- (input.data.message ? `: ${input.data.message}` : "")
+ `Config file at ${input.data.path} is not valid JSON(C)` + (input.data.message ? `: ${input.data.message}` : "")
)
}
if (Config.ConfigDirectoryTypoError.isInstance(input)) {
@@ -20,10 +19,8 @@ export function FormatError(input: unknown) {
}
if (Config.InvalidError.isInstance(input))
return [
- `Config file at ${input.data.path} is invalid` +
- (input.data.message ? `: ${input.data.message}` : ""),
- ...(input.data.issues?.map((issue) => "↳ " + issue.message + " " + issue.path.join(".")) ??
- []),
+ `Config file at ${input.data.path} is invalid` + (input.data.message ? `: ${input.data.message}` : ""),
+ ...(input.data.issues?.map((issue) => "↳ " + issue.message + " " + issue.path.join(".")) ?? []),
].join("\n")
if (UI.CancelledError.isInstance(input)) return ""
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index 8330c88dc..7008141a0 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -11,11 +11,7 @@ import { lazy } from "../util/lazy"
import { NamedError } from "../util/error"
import { Flag } from "../flag/flag"
import { Auth } from "../auth"
-import {
- type ParseError as JsoncParseError,
- parse as parseJsonc,
- printParseErrorCode,
-} from "jsonc-parser"
+import { type ParseError as JsoncParseError, parse as parseJsonc, printParseErrorCode } from "jsonc-parser"
import { Instance } from "../project/instance"
import { LSPServer } from "../lsp/server"
import { BunProc } from "@/bun"
@@ -50,10 +46,7 @@ export namespace Config {
if (value.type === "wellknown") {
process.env[value.key] = value.token
const wellknown = (await fetch(`${key}/.well-known/opencode`).then((x) => x.json())) as any
- result = mergeDeep(
- result,
- await load(JSON.stringify(wellknown.config ?? {}), process.cwd()),
- )
+ result = mergeDeep(result, await load(JSON.stringify(wellknown.config ?? {}), process.cwd()))
}
}
@@ -159,18 +152,10 @@ export namespace Config {
const gitignore = path.join(dir, ".gitignore")
const hasGitIgnore = await Bun.file(gitignore).exists()
- if (!hasGitIgnore)
- await Bun.write(
- gitignore,
- ["node_modules", "package.json", "bun.lock", ".gitignore"].join("\n"),
- )
+ if (!hasGitIgnore) await Bun.write(gitignore, ["node_modules", "package.json", "bun.lock", ".gitignore"].join("\n"))
await BunProc.run(
- [
- "add",
- "@opencode-ai/plugin@" + (Installation.isLocal() ? "latest" : Installation.VERSION),
- "--exact",
- ],
+ ["add", "@opencode-ai/plugin@" + (Installation.isLocal() ? "latest" : Installation.VERSION), "--exact"],
{
cwd: dir,
},
@@ -330,10 +315,7 @@ export namespace Config {
type: z.literal("remote").describe("Type of MCP server connection"),
url: z.string().describe("URL of the remote MCP server"),
enabled: z.boolean().optional().describe("Enable or disable the MCP server on startup"),
- headers: z
- .record(z.string(), z.string())
- .optional()
- .describe("Headers to send with the request"),
+ headers: z.record(z.string(), z.string()).optional().describe("Headers to send with the request"),
timeout: z
.number()
.int()
@@ -389,70 +371,30 @@ export namespace Config {
export const Keybinds = z
.object({
- leader: z
- .string()
- .optional()
- .default("ctrl+x")
- .describe("Leader key for keybind combinations"),
- app_exit: z
- .string()
- .optional()
- .default("ctrl+c,ctrl+d,<leader>q")
- .describe("Exit the application"),
+ leader: z.string().optional().default("ctrl+x").describe("Leader key for keybind combinations"),
+ app_exit: z.string().optional().default("ctrl+c,ctrl+d,<leader>q").describe("Exit the application"),
editor_open: z.string().optional().default("<leader>e").describe("Open external editor"),
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
status_view: z.string().optional().default("<leader>s").describe("View status"),
- session_export: z
- .string()
- .optional()
- .default("<leader>x")
- .describe("Export session to editor"),
+ session_export: z.string().optional().default("<leader>x").describe("Export session to editor"),
session_new: z.string().optional().default("<leader>n").describe("Create a new session"),
session_list: z.string().optional().default("<leader>l").describe("List all sessions"),
- session_timeline: z
- .string()
- .optional()
- .default("<leader>g")
- .describe("Show session timeline"),
+ session_timeline: z.string().optional().default("<leader>g").describe("Show session timeline"),
session_share: z.string().optional().default("none").describe("Share current session"),
session_unshare: z.string().optional().default("none").describe("Unshare current session"),
- session_interrupt: z
- .string()
- .optional()
- .default("escape")
- .describe("Interrupt current session"),
+ session_interrupt: z.string().optional().default("escape").describe("Interrupt current session"),
session_compact: z.string().optional().default("<leader>c").describe("Compact the session"),
- messages_page_up: z
- .string()
- .optional()
- .default("pageup")
- .describe("Scroll messages up by one page"),
- messages_page_down: z
- .string()
- .optional()
- .default("pagedown")
- .describe("Scroll messages down by one page"),
- messages_half_page_up: z
- .string()
- .optional()
- .default("ctrl+alt+u")
- .describe("Scroll messages up by half page"),
+ messages_page_up: z.string().optional().default("pageup").describe("Scroll messages up by one page"),
+ messages_page_down: z.string().optional().default("pagedown").describe("Scroll messages down by one page"),
+ messages_half_page_up: z.string().optional().default("ctrl+alt+u").describe("Scroll messages up by half page"),
messages_half_page_down: z
.string()
.optional()
.default("ctrl+alt+d")
.describe("Scroll messages down by half page"),
- messages_first: z
- .string()
- .optional()
- .default("ctrl+g,home")
- .describe("Navigate to first message"),
- messages_last: z
- .string()
- .optional()
- .default("ctrl+alt+g,end")
- .describe("Navigate to last message"),
+ messages_first: z.string().optional().default("ctrl+g,home").describe("Navigate to first message"),
+ messages_last: z.string().optional().default("ctrl+alt+g,end").describe("Navigate to last message"),
messages_copy: z.string().optional().default("<leader>y").describe("Copy message"),
messages_undo: z.string().optional().default("<leader>u").describe("Undo message"),
messages_redo: z.string().optional().default("<leader>r").describe("Redo message"),
@@ -463,11 +405,7 @@ export namespace Config {
.describe("Toggle code block concealment in messages"),
model_list: z.string().optional().default("<leader>m").describe("List available models"),
model_cycle_recent: z.string().optional().default("f2").describe("Next recently used model"),
- model_cycle_recent_reverse: z
- .string()
- .optional()
- .default("shift+f2")
- .describe("Previous recently used model"),
+ model_cycle_recent_reverse: z.string().optional().default("shift+f2").describe("Previous recently used model"),
command_list: z.string().optional().default("ctrl+p").describe("List available commands"),
agent_list: z.string().optional().default("<leader>a").describe("List agents"),
agent_cycle: z.string().optional().default("tab").describe("Next agent"),
@@ -476,23 +414,11 @@ export namespace Config {
input_forward_delete: z.string().optional().default("ctrl+d").describe("Forward delete"),
input_paste: z.string().optional().default("ctrl+v").describe("Paste from clipboard"),
input_submit: z.string().optional().default("return").describe("Submit input"),
- input_newline: z
- .string()
- .optional()
- .default("shift+return,ctrl+j")
- .describe("Insert newline in input"),
+ input_newline: z.string().optional().default("shift+return,ctrl+j").describe("Insert newline in input"),
history_previous: z.string().optional().default("up").describe("Previous history item"),
history_next: z.string().optional().default("down").describe("Next history item"),
- session_child_cycle: z
- .string()
- .optional()
- .default("ctrl+right")
- .describe("Next child session"),
- session_child_cycle_reverse: z
- .string()
- .optional()
- .default("ctrl+left")
- .describe("Previous child session"),
+ session_child_cycle: z.string().optional().default("ctrl+right").describe("Next child session"),
+ session_child_cycle_reverse: z.string().optional().default("ctrl+left").describe("Previous child session"),
})
.strict()
.meta({
@@ -534,23 +460,13 @@ export namespace Config {
autoshare: z
.boolean()
.optional()
- .describe(
- "@deprecated Use 'share' field instead. Share newly created sessions automatically",
- ),
+ .describe("@deprecated Use 'share' field instead. Share newly created sessions automatically"),
autoupdate: z.boolean().optional().describe("Automatically update to the latest version"),
- disabled_providers: z
- .array(z.string())
- .optional()
- .describe("Disable providers that are loaded automatically"),
- model: z
- .string()
- .describe("Model to use in the format of provider/model, eg anthropic/claude-2")
- .optional(),
+ disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"),
+ model: z.string().describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(),
small_model: z
.string()
- .describe(
- "Small model to use for tasks like title generation in the format of provider/model",
- )
+ .describe("Small model to use for tasks like title generation in the format of provider/model")
.optional(),
username: z
.string()
@@ -583,10 +499,7 @@ export namespace Config {
.object({
apiKey: z.string().optional(),
baseURL: z.string().optional(),
- enterpriseUrl: z
- .string()
- .optional()
- .describe("GitHub Enterprise URL for copilot authentication"),
+ enterpriseUrl: z.string().optional().describe("GitHub Enterprise URL for copilot authentication"),
timeout: z
.union([
z
@@ -610,10 +523,7 @@ export namespace Config {
)
.optional()
.describe("Custom provider configurations and model overrides"),
- mcp: z
- .record(z.string(), Mcp)
- .optional()
- .describe("MCP (Model Context Protocol) server configurations"),
+ mcp: z.record(z.string(), Mcp).optional().describe("MCP (Model Context Protocol) server configurations"),
formatter: z
.record(
z.string(),
@@ -657,10 +567,7 @@ export namespace Config {
error: "For custom LSP servers, 'extensions' array is required.",
},
),
- instructions: z
- .array(z.string())
- .optional()
- .describe("Additional instruction files or patterns to include"),
+ instructions: z.array(z.string()).optional().describe("Additional instruction files or patterns to include"),
layout: Layout.optional().describe("@deprecated Always uses stretch layout."),
permission: z
.object({
@@ -694,10 +601,7 @@ export namespace Config {
.optional(),
})
.optional(),
- chatMaxRetries: z
- .number()
- .optional()
- .describe("Number of retries for chat completions on failure"),
+ chatMaxRetries: z.number().optional().describe("Number of retries for chat completions on failure"),
disable_paste_summary: z.boolean().optional(),
})
.optional(),
@@ -727,10 +631,7 @@ export namespace Config {
if (provider && model) result.model = `${provider}/${model}`
result["$schema"] = "https://opencode.ai/config.json"
result = mergeDeep(result, rest)
- await Bun.write(
- path.join(Global.Path.config, "config.json"),
- JSON.stringify(result, null, 2),
- )
+ await Bun.write(path.join(Global.Path.config, "config.json"), JSON.stringify(result, null, 2))
await fs.unlink(path.join(Global.Path.config, "config"))
})
.catch(() => {})
@@ -769,9 +670,7 @@ export namespace Config {
if (filePath.startsWith("~/")) {
filePath = path.join(os.homedir(), filePath.slice(2))
}
- const resolvedPath = path.isAbsolute(filePath)
- ? filePath
- : path.resolve(configDir, filePath)
+ const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(configDir, filePath)
const fileContent = (
await Bun.file(resolvedPath)
.text()
diff --git a/packages/opencode/src/file/fzf.ts b/packages/opencode/src/file/fzf.ts
index 702688b17..cd0aa4fc8 100644
--- a/packages/opencode/src/file/fzf.ts
+++ b/packages/opencode/src/file/fzf.ts
@@ -81,9 +81,7 @@ export namespace Fzf {
})
}
if (config.extension === "zip") {
- const zipFileReader = new ZipReader(
- new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()])),
- )
+ const zipFileReader = new ZipReader(new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()])))
const entries = await zipFileReader.getEntries()
let fzfEntry: any
for (const entry of entries) {
diff --git a/packages/opencode/src/file/index.ts b/packages/opencode/src/file/index.ts
index 3a143d072..aae7061c1 100644
--- a/packages/opencode/src/file/index.ts
+++ b/packages/opencode/src/file/index.ts
@@ -165,11 +165,7 @@ export namespace File {
const project = Instance.project
if (project.vcs !== "git") return []
- const diffOutput = await $`git diff --numstat HEAD`
- .cwd(Instance.directory)
- .quiet()
- .nothrow()
- .text()
+ const diffOutput = await $`git diff --numstat HEAD`.cwd(Instance.directory).quiet().nothrow().text()
const changedFiles: Info[] = []
@@ -261,14 +257,9 @@ export namespace File {
if (project.vcs === "git") {
let diff = await $`git diff ${file}`.cwd(Instance.directory).quiet().nothrow().text()
- if (!diff.trim())
- diff = await $`git diff --staged ${file}`.cwd(Instance.directory).quiet().nothrow().text()
+ if (!diff.trim()) diff = await $`git diff --staged ${file}`.cwd(Instance.directory).quiet().nothrow().text()
if (diff.trim()) {
- const original = await $`git show HEAD:${file}`
- .cwd(Instance.directory)
- .quiet()
- .nothrow()
- .text()
+ const original = await $`git show HEAD:${file}`.cwd(Instance.directory).quiet().nothrow().text()
const patch = structuredPatch(file, file, original, content, "old", "new", {
context: Infinity,
ignoreWhitespace: true,
@@ -321,9 +312,7 @@ export namespace File {
const limit = input.limit ?? 100
const result = await state().then((x) => x.files())
if (!input.query)
- return input.dirs !== false
- ? result.dirs.toSorted().slice(0, limit)
- : result.files.slice(0, limit)
+ return input.dirs !== false ? result.dirs.toSorted().slice(0, limit) : result.files.slice(0, limit)
const items = input.dirs !== false ? [...result.files, ...result.dirs] : result.files
const sorted = fuzzysort.go(input.query, items, { limit: limit }).map((r) => r.target)
log.info("search", { query: input.query, results: sorted.length })
diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts
index 84a45e386..29014d199 100644
--- a/packages/opencode/src/file/ripgrep.ts
+++ b/packages/opencode/src/file/ripgrep.ts
@@ -161,9 +161,7 @@ export namespace Ripgrep {
}
if (config.extension === "zip") {
if (config.extension === "zip") {
- const zipFileReader = new ZipReader(
- new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()])),
- )
+ const zipFileReader = new ZipReader(new BlobReader(new Blob([await Bun.file(archivePath).arrayBuffer()])))
const entries = await zipFileReader.getEntries()
let rgEntry: any
for (const entry of entries) {
@@ -356,12 +354,7 @@ export namespace Ripgrep {
return lines.join("\n")
}
- export async function search(input: {
- cwd: string
- pattern: string
- glob?: string[]
- limit?: number
- }) {
+ export async function search(input: { cwd: string; pattern: string; glob?: string[]; limit?: number }) {
const args = [`${await filepath()}`, "--json", "--hidden", "--glob='!.git/*'"]
if (input.glob) {
diff --git a/packages/opencode/src/file/time.ts b/packages/opencode/src/file/time.ts
index fe1dcff49..5cba5e820 100644
--- a/packages/opencode/src/file/time.ts
+++ b/packages/opencode/src/file/time.ts
@@ -27,10 +27,7 @@ export namespace FileTime {
export async function assert(sessionID: string, filepath: string) {
const time = get(sessionID, filepath)
- if (!time)
- throw new Error(
- `You must read the file ${filepath} before overwriting it. Use the Read tool first`,
- )
+ if (!time) throw new Error(`You must read the file ${filepath} before overwriting it. Use the Read tool first`)
const stats = await Bun.file(filepath).stat()
if (stats.mtime.getTime() > time.getTime()) {
throw new Error(
diff --git a/packages/opencode/src/file/watcher.ts b/packages/opencode/src/file/watcher.ts
index e9304af70..d5985b582 100644
--- a/packages/opencode/src/file/watcher.ts
+++ b/packages/opencode/src/file/watcher.ts
@@ -51,10 +51,8 @@ export namespace FileWatcher {
for (const evt of evts) {
log.info("event", evt)
if (evt.type === "create") Bus.publish(Event.Updated, { file: evt.path, event: "add" })
- if (evt.type === "update")
- Bus.publish(Event.Updated, { file: evt.path, event: "change" })
- if (evt.type === "delete")
- Bus.publish(Event.Updated, { file: evt.path, event: "unlink" })
+ if (evt.type === "update") Bus.publish(Event.Updated, { file: evt.path, event: "change" })
+ if (evt.type === "delete") Bus.publish(Event.Updated, { file: evt.path, event: "unlink" })
}
},
{
diff --git a/packages/opencode/src/format/formatter.ts b/packages/opencode/src/format/formatter.ts
index a8b8e9de5..d1bff181f 100644
--- a/packages/opencode/src/format/formatter.ts
+++ b/packages/opencode/src/format/formatter.ts
@@ -132,21 +132,7 @@ export const zig: Info = {
export const clang: Info = {
name: "clang-format",
command: ["clang-format", "-i", "$FILE"],
- extensions: [
- ".c",
- ".cc",
- ".cpp",
- ".cxx",
- ".c++",
- ".h",
- ".hh",
- ".hpp",
- ".hxx",
- ".h++",
- ".ino",
- ".C",
- ".H",
- ],
+ extensions: [".c", ".cc", ".cpp", ".cxx", ".c++", ".h", ".hh", ".hpp", ".hxx", ".h++", ".ino", ".C", ".H"],
async enabled() {
const items = await Filesystem.findUp(".clang-format", Instance.directory, Instance.worktree)
return items.length > 0
diff --git a/packages/opencode/src/id/id.ts b/packages/opencode/src/id/id.ts
index 76b6a46be..99eb6c9ff 100644
--- a/packages/opencode/src/id/id.ts
+++ b/packages/opencode/src/id/id.ts
@@ -49,11 +49,7 @@ export namespace Identifier {
return result
}
- export function create(
- prefix: keyof typeof prefixes,
- descending: boolean,
- timestamp?: number,
- ): string {
+ export function create(prefix: keyof typeof prefixes, descending: boolean, timestamp?: number): string {
const currentTimestamp = timestamp ?? Date.now()
if (currentTimestamp !== lastTimestamp) {
diff --git a/packages/opencode/src/ide/index.ts b/packages/opencode/src/ide/index.ts
index a6a997e11..035bccecf 100644
--- a/packages/opencode/src/ide/index.ts
+++ b/packages/opencode/src/ide/index.ts
@@ -44,10 +44,7 @@ export namespace Ide {
}
export function alreadyInstalled() {
- return (
- process.env["OPENCODE_CALLER"] === "vscode" ||
- process.env["OPENCODE_CALLER"] === "vscode-insiders"
- )
+ return process.env["OPENCODE_CALLER"] === "vscode" || process.env["OPENCODE_CALLER"] === "vscode-insiders"
}
export async function install(ide: (typeof SUPPORTED_IDES)[number]["name"]) {
diff --git a/packages/opencode/src/lsp/client.ts b/packages/opencode/src/lsp/client.ts
index 920cecc62..1a6e2cb71 100644
--- a/packages/opencode/src/lsp/client.ts
+++ b/packages/opencode/src/lsp/client.ts
@@ -1,9 +1,5 @@
import path from "path"
-import {
- createMessageConnection,
- StreamMessageReader,
- StreamMessageWriter,
-} from "vscode-jsonrpc/node"
+import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from "vscode-jsonrpc/node"
import type { Diagnostic as VSCodeDiagnostic } from "vscode-languageserver-types"
import { Log } from "../util/log"
import { LANGUAGE_EXTENSIONS } from "./language"
@@ -38,11 +34,7 @@ export namespace LSPClient {
),
}
- export async function create(input: {
- serverID: string
- server: LSPServer.Handle
- root: string
- }) {
+ export async function create(input: { serverID: string; server: LSPServer.Handle; root: string }) {
const l = log.clone().tag("serverID", input.serverID)
l.info("starting client")
@@ -137,9 +129,7 @@ export namespace LSPClient {
},
notify: {
async open(input: { path: string }) {
- input.path = path.isAbsolute(input.path)
- ? input.path
- : path.resolve(Instance.directory, input.path)
+ input.path = path.isAbsolute(input.path) ? input.path : path.resolve(Instance.directory, input.path)
const file = Bun.file(input.path)
const text = await file.text()
const extension = path.extname(input.path)
@@ -181,18 +171,13 @@ export namespace LSPClient {
return diagnostics
},
async waitForDiagnostics(input: { path: string }) {
- input.path = path.isAbsolute(input.path)
- ? input.path
- : path.resolve(Instance.directory, input.path)
+ input.path = path.isAbsolute(input.path) ? input.path : path.resolve(Instance.directory, input.path)
log.info("waiting for diagnostics", input)
let unsub: () => void
return await withTimeout(
new Promise<void>((resolve) => {
unsub = Bus.subscribe(Event.Diagnostics, (event) => {
- if (
- event.properties.path === input.path &&
- event.properties.serverID === result.serverID
- ) {
+ if (event.properties.path === input.path && event.properties.serverID === result.serverID) {
log.info("got diagnostics", input)
unsub?.()
resolve()
diff --git a/packages/opencode/src/lsp/index.ts b/packages/opencode/src/lsp/index.ts
index 67dd838ac..8640489b1 100644
--- a/packages/opencode/src/lsp/index.ts
+++ b/packages/opencode/src/lsp/index.ts
@@ -197,9 +197,7 @@ export namespace LSP {
await run(async (client) => {
if (!clients.includes(client)) return
- const wait = waitForDiagnostics
- ? client.waitForDiagnostics({ path: input })
- : Promise.resolve()
+ const wait = waitForDiagnostics ? client.waitForDiagnostics({ path: input }) : Promise.resolve()
await client.notify.open({ path: input })
return wait
}).catch((err) => {
diff --git a/packages/opencode/src/lsp/server.ts b/packages/opencode/src/lsp/server.ts
index d0fb11e94..1132bbc7c 100644
--- a/packages/opencode/src/lsp/server.ts
+++ b/packages/opencode/src/lsp/server.ts
@@ -88,9 +88,7 @@ export namespace LSPServer {
),
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"],
async spawn(root) {
- const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(
- () => {},
- )
+ const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
if (!tsserver) return
const proc = spawn(BunProc.which(), ["x", "typescript-language-server", "--stdio"], {
cwd: root,
@@ -113,13 +111,7 @@ export namespace LSPServer {
export const Vue: Info = {
id: "vue",
extensions: [".vue"],
- root: NearestRoot([
- "package-lock.json",
- "bun.lockb",
- "bun.lock",
- "pnpm-lock.yaml",
- "yarn.lock",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
async spawn(root) {
let binary = Bun.which("vue-language-server")
const args: string[] = []
@@ -167,31 +159,17 @@ export namespace LSPServer {
export const ESLint: Info = {
id: "eslint",
- root: NearestRoot([
- "package-lock.json",
- "bun.lockb",
- "bun.lock",
- "pnpm-lock.yaml",
- "yarn.lock",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue"],
async spawn(root) {
const eslint = await Bun.resolve("eslint", Instance.directory).catch(() => {})
if (!eslint) return
log.info("spawning eslint server")
- const serverPath = path.join(
- Global.Path.bin,
- "vscode-eslint",
- "server",
- "out",
- "eslintServer.js",
- )
+ const serverPath = path.join(Global.Path.bin, "vscode-eslint", "server", "out", "eslintServer.js")
if (!(await Bun.file(serverPath).exists())) {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("downloading and building VS Code ESLint server")
- const response = await fetch(
- "https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip",
- )
+ const response = await fetch("https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip")
if (!response.ok) return
const zipPath = path.join(Global.Path.bin, "vscode-eslint.zip")
@@ -316,25 +294,12 @@ export namespace LSPServer {
export const Pyright: Info = {
id: "pyright",
extensions: [".py", ".pyi"],
- root: NearestRoot([
- "pyproject.toml",
- "setup.py",
- "setup.cfg",
- "requirements.txt",
- "Pipfile",
- "pyrightconfig.json",
- ]),
+ root: NearestRoot(["pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile", "pyrightconfig.json"]),
async spawn(root) {
let binary = Bun.which("pyright-langserver")
const args = []
if (!binary) {
- const js = path.join(
- Global.Path.bin,
- "node_modules",
- "pyright",
- "dist",
- "pyright-langserver.js",
- )
+ const js = path.join(Global.Path.bin, "node_modules", "pyright", "dist", "pyright-langserver.js")
if (!(await Bun.file(js).exists())) {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
await Bun.spawn([BunProc.which(), "install", "pyright"], {
@@ -352,11 +317,9 @@ export namespace LSPServer {
const initialization: Record<string, string> = {}
- const potentialVenvPaths = [
- process.env["VIRTUAL_ENV"],
- path.join(root, ".venv"),
- path.join(root, "venv"),
- ].filter((p): p is string => p !== undefined)
+ const potentialVenvPaths = [process.env["VIRTUAL_ENV"], path.join(root, ".venv"), path.join(root, "venv")].filter(
+ (p): p is string => p !== undefined,
+ )
for (const venvPath of potentialVenvPaths) {
const isWindows = process.platform === "win32"
const potentialPythonPath = isWindows
@@ -407,9 +370,7 @@ export namespace LSPServer {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("downloading elixir-ls from GitHub releases")
- const response = await fetch(
- "https://github.com/elixir-lsp/elixir-ls/archive/refs/heads/master.zip",
- )
+ const response = await fetch("https://github.com/elixir-lsp/elixir-ls/archive/refs/heads/master.zip")
if (!response.ok) return
const zipPath = path.join(Global.Path.bin, "elixir-ls.zip")
await Bun.file(zipPath).write(response)
@@ -459,9 +420,7 @@ export namespace LSPServer {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("downloading zls from GitHub releases")
- const releaseResponse = await fetch(
- "https://api.github.com/repos/zigtools/zls/releases/latest",
- )
+ const releaseResponse = await fetch("https://api.github.com/repos/zigtools/zls/releases/latest")
if (!releaseResponse.ok) {
log.error("Failed to fetch zls release info")
return
@@ -636,13 +595,7 @@ export namespace LSPServer {
export const Clangd: Info = {
id: "clangd",
- root: NearestRoot([
- "compile_commands.json",
- "compile_flags.txt",
- ".clangd",
- "CMakeLists.txt",
- "Makefile",
- ]),
+ root: NearestRoot(["compile_commands.json", "compile_flags.txt", ".clangd", "CMakeLists.txt", "Makefile"]),
extensions: [".c", ".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".hxx", ".h++"],
async spawn(root) {
let bin = Bun.which("clangd", {
@@ -652,9 +605,7 @@ export namespace LSPServer {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("downloading clangd from GitHub releases")
- const releaseResponse = await fetch(
- "https://api.github.com/repos/clangd/clangd/releases/latest",
- )
+ const releaseResponse = await fetch("https://api.github.com/repos/clangd/clangd/releases/latest")
if (!releaseResponse.ok) {
log.error("Failed to fetch clangd release info")
return
@@ -723,24 +674,12 @@ export namespace LSPServer {
export const Svelte: Info = {
id: "svelte",
extensions: [".svelte"],
- root: NearestRoot([
- "package-lock.json",
- "bun.lockb",
- "bun.lock",
- "pnpm-lock.yaml",
- "yarn.lock",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
async spawn(root) {
let binary = Bun.which("svelteserver")
const args: string[] = []
if (!binary) {
- const js = path.join(
- Global.Path.bin,
- "node_modules",
- "svelte-language-server",
- "bin",
- "server.js",
- )
+ const js = path.join(Global.Path.bin, "node_modules", "svelte-language-server", "bin", "server.js")
if (!(await Bun.file(js).exists())) {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
await Bun.spawn([BunProc.which(), "install", "svelte-language-server"], {
@@ -775,17 +714,9 @@ export namespace LSPServer {
export const Astro: Info = {
id: "astro",
extensions: [".astro"],
- root: NearestRoot([
- "package-lock.json",
- "bun.lockb",
- "bun.lock",
- "pnpm-lock.yaml",
- "yarn.lock",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
async spawn(root) {
- const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(
- () => {},
- )
+ const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
if (!tsserver) {
log.info("typescript not found, required for Astro language server")
return
@@ -795,14 +726,7 @@ export namespace LSPServer {
let binary = Bun.which("astro-ls")
const args: string[] = []
if (!binary) {
- const js = path.join(
- Global.Path.bin,
- "node_modules",
- "@astrojs",
- "language-server",
- "bin",
- "nodeServer.js",
- )
+ const js = path.join(Global.Path.bin, "node_modules", "@astrojs", "language-server", "bin", "nodeServer.js")
if (!(await Bun.file(js).exists())) {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
await Bun.spawn([BunProc.which(), "install", "@astrojs/language-server"], {
@@ -880,9 +804,7 @@ export namespace LSPServer {
.then(({ stdout }) => stdout.toString().trim())
const launcherJar = path.join(launcherDir, jarFileName)
if (!(await fs.exists(launcherJar))) {
- log.error(
- `Failed to locate the JDTLS launcher module in the installed directory: ${distPath}.`,
- )
+ log.error(`Failed to locate the JDTLS launcher module in the installed directory: ${distPath}.`)
return
}
const configFile = path.join(
@@ -948,9 +870,7 @@ export namespace LSPServer {
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
log.info("downloading lua-language-server from GitHub releases")
- const releaseResponse = await fetch(
- "https://api.github.com/repos/LuaLS/lua-language-server/releases/latest",
- )
+ const releaseResponse = await fetch("https://api.github.com/repos/LuaLS/lua-language-server/releases/latest")
if (!releaseResponse.ok) {
log.error("Failed to fetch lua-language-server release info")
return
@@ -987,9 +907,7 @@ export namespace LSPServer {
const assetSuffix = `${lualsPlatform}-${lualsArch}.${ext}`
if (!supportedCombos.includes(assetSuffix)) {
- log.error(
- `Platform ${platform} and architecture ${arch} is not supported by lua-language-server`,
- )
+ log.error(`Platform ${platform} and architecture ${arch} is not supported by lua-language-server`)
return
}
@@ -1012,10 +930,7 @@ export namespace LSPServer {
// Unlike zls which is a single self-contained binary,
// lua-language-server needs supporting files (meta/, locale/, etc.)
// Extract entire archive to dedicated directory to preserve all files
- const installDir = path.join(
- Global.Path.bin,
- `lua-language-server-${lualsArch}-${lualsPlatform}`,
- )
+ const installDir = path.join(Global.Path.bin, `lua-language-server-${lualsArch}-${lualsPlatform}`)
// Remove old installation if exists
const stats = await fs.stat(installDir).catch(() => undefined)
@@ -1040,11 +955,7 @@ export namespace LSPServer {
await fs.rm(tempPath, { force: true })
// Binary is located in bin/ subdirectory within the extracted archive
- bin = path.join(
- installDir,
- "bin",
- "lua-language-server" + (platform === "win32" ? ".exe" : ""),
- )
+ bin = path.join(installDir, "bin", "lua-language-server" + (platform === "win32" ? ".exe" : ""))
if (!(await Bun.file(bin).exists())) {
log.error("Failed to extract lua-language-server binary")
diff --git a/packages/opencode/src/patch/index.ts b/packages/opencode/src/patch/index.ts
index 46467e0ba..91d52065f 100644
--- a/packages/opencode/src/patch/index.ts
+++ b/packages/opencode/src/patch/index.ts
@@ -104,10 +104,7 @@ export namespace Patch {
return null
}
- function parseUpdateFileChunks(
- lines: string[],
- startIdx: number,
- ): { chunks: UpdateFileChunk[]; nextIdx: number } {
+ function parseUpdateFileChunks(lines: string[], startIdx: number): { chunks: UpdateFileChunk[]; nextIdx: number } {
const chunks: UpdateFileChunk[] = []
let i = startIdx
@@ -161,10 +158,7 @@ export namespace Patch {
return { chunks, nextIdx: i }
}
- function parseAddFileContent(
- lines: string[],
- startIdx: number,
- ): { content: string; nextIdx: number } {
+ function parseAddFileContent(lines: string[], startIdx: number): { content: string; nextIdx: number } {
let content = ""
let i = startIdx
@@ -303,10 +297,7 @@ export namespace Patch {
content: string
}
- export function deriveNewContentsFromChunks(
- filePath: string,
- chunks: UpdateFileChunk[],
- ): ApplyPatchFileUpdate {
+ export function deriveNewContentsFromChunks(filePath: string, chunks: UpdateFileChunk[]): ApplyPatchFileUpdate {
// Read original file content
let originalContent: string
try {
@@ -387,9 +378,7 @@ export namespace Patch {
replacements.push([found, pattern.length, newSlice])
lineIndex = found + pattern.length
} else {
- throw new Error(
- `Failed to find expected lines in ${filePath}:\n${chunk.old_lines.join("\n")}`,
- )
+ throw new Error(`Failed to find expected lines in ${filePath}:\n${chunk.old_lines.join("\n")}`)
}
}
@@ -399,10 +388,7 @@ export namespace Patch {
return replacements
}
- function applyReplacements(
- lines: string[],
- replacements: Array<[number, number, string[]]>,
- ): string[] {
+ function applyReplacements(lines: string[], replacements: Array<[number, number, string[]]>): string[] {
// Apply replacements in reverse order to avoid index shifting
const result = [...lines]
@@ -601,9 +587,7 @@ export namespace Patch {
changes.set(resolvedPath, {
type: "update",
unified_diff: fileUpdate.unified_diff,
- move_path: hunk.move_path
- ? path.resolve(effectiveCwd, hunk.move_path)
- : undefined,
+ move_path: hunk.move_path ? path.resolve(effectiveCwd, hunk.move_path) : undefined,
new_content: fileUpdate.content,
})
} catch (error) {
diff --git a/packages/opencode/src/permission/index.ts b/packages/opencode/src/permission/index.ts
index fbcda6cf6..3a4a9901b 100644
--- a/packages/opencode/src/permission/index.ts
+++ b/packages/opencode/src/permission/index.ts
@@ -75,14 +75,7 @@ export namespace Permission {
async (state) => {
for (const pending of Object.values(state.pending)) {
for (const item of Object.values(pending)) {
- item.reject(
- new RejectedError(
- item.info.sessionID,
- item.info.id,
- item.info.callID,
- item.info.metadata,
- ),
- )
+ item.reject(new RejectedError(item.info.sessionID, item.info.id, item.info.callID, item.info.metadata))
}
}
},
@@ -150,11 +143,7 @@ export namespace Permission {
export const Response = z.enum(["once", "always", "reject"])
export type Response = z.infer<typeof Response>
- export function respond(input: {
- sessionID: Info["sessionID"]
- permissionID: Info["id"]
- response: Response
- }) {
+ export function respond(input: { sessionID: Info["sessionID"]; permissionID: Info["id"]; response: Response }) {
log.info("response", input)
const { pending, approved } = state()
const match = pending[input.sessionID]?.[input.permissionID]
@@ -166,14 +155,7 @@ export namespace Permission {
response: input.response,
})
if (input.response === "reject") {
- match.reject(
- new RejectedError(
- input.sessionID,
- input.permissionID,
- match.info.callID,
- match.info.metadata,
- ),
- )
+ match.reject(new RejectedError(input.sessionID, input.permissionID, match.info.callID, match.info.metadata))
return
}
match.resolve()
@@ -205,9 +187,7 @@ export namespace Permission {
public readonly toolCallID?: string,
public readonly metadata?: Record<string, any>,
) {
- super(
- `The user rejected permission to use this specific tool call. You may try again with different parameters.`,
- )
+ super(`The user rejected permission to use this specific tool call. You may try again with different parameters.`)
}
}
}
diff --git a/packages/opencode/src/project/instance.ts b/packages/opencode/src/project/instance.ts
index ce9a57d17..496913b61 100644
--- a/packages/opencode/src/project/instance.ts
+++ b/packages/opencode/src/project/instance.ts
@@ -12,11 +12,7 @@ const context = Context.create<Context>("instance")
const cache = new Map<string, Context>()
export const Instance = {
- async provide<R>(input: {
- directory: string
- init?: () => Promise<any>
- fn: () => R
- }): Promise<R> {
+ async provide<R>(input: { directory: string; init?: () => Promise<any>; fn: () => R }): Promise<R> {
let existing = cache.get(input.directory)
if (!existing) {
const project = await Project.fromDirectory(input.directory)
diff --git a/packages/opencode/src/project/state.ts b/packages/opencode/src/project/state.ts
index 908ae316b..5846bf856 100644
--- a/packages/opencode/src/project/state.ts
+++ b/packages/opencode/src/project/state.ts
@@ -9,11 +9,7 @@ export namespace State {
const log = Log.create({ service: "state" })
const recordsByKey = new Map<string, Map<any, Entry>>()
- export function create<S>(
- root: () => string,
- init: () => S,
- dispose?: (state: Awaited<S>) => Promise<void>,
- ) {
+ export function create<S>(root: () => string, init: () => S, dispose?: (state: Awaited<S>) => Promise<void>) {
return () => {
const key = root()
let entries = recordsByKey.get(key)
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts
index 2ed072e51..1bec5d51d 100644
--- a/packages/opencode/src/provider/provider.ts
+++ b/packages/opencode/src/provider/provider.ts
@@ -78,18 +78,12 @@ export namespace Provider {
}
},
"amazon-bedrock": async () => {
- if (
- !process.env["AWS_PROFILE"] &&
- !process.env["AWS_ACCESS_KEY_ID"] &&
- !process.env["AWS_BEARER_TOKEN_BEDROCK"]
- )
+ if (!process.env["AWS_PROFILE"] && !process.env["AWS_ACCESS_KEY_ID"] && !process.env["AWS_BEARER_TOKEN_BEDROCK"])
return { autoload: false }
const region = process.env["AWS_REGION"] ?? "us-east-1"
- const { fromNodeProviderChain } = await import(
- await BunProc.install("@aws-sdk/credential-providers")
- )
+ const { fromNodeProviderChain } = await import(await BunProc.install("@aws-sdk/credential-providers"))
return {
autoload: true,
options: {
@@ -125,13 +119,9 @@ export namespace Provider {
"eu-south-1",
"eu-south-2",
].some((r) => region.includes(r))
- const modelRequiresPrefix = [
- "claude",
- "nova-lite",
- "nova-micro",
- "llama3",
- "pixtral",
- ].some((m) => modelID.includes(m))
+ const modelRequiresPrefix = ["claude", "nova-lite", "nova-micro", "llama3", "pixtral"].some((m) =>
+ modelID.includes(m),
+ )
if (regionRequiresPrefix && modelRequiresPrefix) {
modelID = `${regionPrefix}.${modelID}`
}
@@ -141,15 +131,13 @@ export namespace Provider {
const isAustraliaRegion = ["ap-southeast-2", "ap-southeast-4"].includes(region)
if (
isAustraliaRegion &&
- ["anthropic.claude-sonnet-4-5", "anthropic.claude-haiku"].some((m) =>
- modelID.includes(m),
- )
+ ["anthropic.claude-sonnet-4-5", "anthropic.claude-haiku"].some((m) => modelID.includes(m))
) {
regionPrefix = "au"
modelID = `${regionPrefix}.${modelID}`
} else {
- const modelRequiresPrefix = ["claude", "nova-lite", "nova-micro", "nova-pro"].some(
- (m) => modelID.includes(m),
+ const modelRequiresPrefix = ["claude", "nova-lite", "nova-micro", "nova-pro"].some((m) =>
+ modelID.includes(m),
)
if (modelRequiresPrefix) {
regionPrefix = "apac"
@@ -187,12 +175,8 @@ export namespace Provider {
}
},
"google-vertex": async () => {
- const project =
- process.env["GOOGLE_CLOUD_PROJECT"] ??
- process.env["GCP_PROJECT"] ??
- process.env["GCLOUD_PROJECT"]
- const location =
- process.env["GOOGLE_CLOUD_LOCATION"] ?? process.env["VERTEX_LOCATION"] ?? "us-east5"
+ const project = process.env["GOOGLE_CLOUD_PROJECT"] ?? process.env["GCP_PROJECT"] ?? process.env["GCLOUD_PROJECT"]
+ const location = process.env["GOOGLE_CLOUD_LOCATION"] ?? process.env["VERTEX_LOCATION"] ?? "us-east5"
const autoload = Boolean(project)
if (!autoload) return { autoload: false }
return {
@@ -208,12 +192,8 @@ export namespace Provider {
}
},
"google-vertex-anthropic": async () => {
- const project =
- process.env["GOOGLE_CLOUD_PROJECT"] ??
- process.env["GCP_PROJECT"] ??
- process.env["GCLOUD_PROJECT"]
- const location =
- process.env["GOOGLE_CLOUD_LOCATION"] ?? process.env["VERTEX_LOCATION"] ?? "us-east5"
+ const project = process.env["GOOGLE_CLOUD_PROJECT"] ?? process.env["GCP_PROJECT"] ?? process.env["GCLOUD_PROJECT"]
+ const location = process.env["GOOGLE_CLOUD_LOCATION"] ?? process.env["VERTEX_LOCATION"] ?? "us-east5"
const autoload = Boolean(project)
if (!autoload) return { autoload: false }
return {
@@ -408,10 +388,7 @@ export namespace Provider {
// Load for the main provider if auth exists
if (auth) {
- const options = await plugin.auth.loader(
- () => Auth.get(providerID) as any,
- database[plugin.auth.provider],
- )
+ const options = await plugin.auth.loader(() => Auth.get(providerID) as any, database[plugin.auth.provider])
mergeProvider(plugin.auth.provider, options ?? {}, "custom")
}
@@ -442,14 +419,12 @@ export namespace Provider {
// Filter out blacklisted models
.filter(
([modelID]) =>
- modelID !== "gpt-5-chat-latest" &&
- !(providerID === "openrouter" && modelID === "openai/gpt-5-chat"),
+ modelID !== "gpt-5-chat-latest" && !(providerID === "openrouter" && modelID === "openai/gpt-5-chat"),
)
// Filter out experimental models
.filter(
([, model]) =>
- ((!model.experimental && model.status !== "alpha") ||
- Flag.OPENCODE_ENABLE_EXPERIMENTAL_MODELS) &&
+ ((!model.experimental && model.status !== "alpha") || Flag.OPENCODE_ENABLE_EXPERIMENTAL_MODELS) &&
model.status !== "deprecated",
),
)
@@ -496,9 +471,7 @@ export namespace Provider {
// In addition, Bun's dynamic import logic does not support subpath imports,
// so we patch the import path to load directly from `dist`.
const modPath =
- provider.id === "google-vertex-anthropic"
- ? `${installedPath}/dist/anthropic/index.mjs`
- : installedPath
+ provider.id === "google-vertex-anthropic" ? `${installedPath}/dist/anthropic/index.mjs` : installedPath
const mod = await import(modPath)
if (options["timeout"] !== undefined && options["timeout"] !== null) {
// Preserve custom fetch if it exists, wrap it with timeout logic
@@ -597,14 +570,7 @@ export namespace Provider {
const provider = await state().then((state) => state.providers[providerID])
if (!provider) return
- let priority = [
- "claude-haiku-4-5",
- "claude-haiku-4.5",
- "3-5-haiku",
- "3.5-haiku",
- "gemini-2.5-flash",
- "gpt-5-nano",
- ]
+ let priority = ["claude-haiku-4-5", "claude-haiku-4.5", "3-5-haiku", "3.5-haiku", "gemini-2.5-flash", "gpt-5-nano"]
// claude-haiku-4.5 is considered a premium model in github copilot, we shouldn't use premium requests for title gen
if (providerID === "github-copilot") {
priority = priority.filter((m) => m !== "claude-haiku-4.5")
diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts
index a81c4dd0b..e578d806f 100644
--- a/packages/opencode/src/provider/transform.ts
+++ b/packages/opencode/src/provider/transform.ts
@@ -3,19 +3,12 @@ import { unique } from "remeda"
import type { JSONSchema } from "zod/v4/core"
export namespace ProviderTransform {
- function normalizeMessages(
- msgs: ModelMessage[],
- providerID: string,
- modelID: string,
- ): ModelMessage[] {
+ function normalizeMessages(msgs: ModelMessage[], providerID: string, modelID: string): ModelMessage[] {
if (modelID.includes("claude")) {
return msgs.map((msg) => {
if ((msg.role === "assistant" || msg.role === "tool") && Array.isArray(msg.content)) {
msg.content = msg.content.map((part) => {
- if (
- (part.type === "tool-call" || part.type === "tool-result") &&
- "toolCallId" in part
- ) {
+ if ((part.type === "tool-call" || part.type === "tool-result") && "toolCallId" in part) {
return {
...part,
toolCallId: part.toolCallId.replace(/[^a-zA-Z0-9_-]/g, "_"),
@@ -36,10 +29,7 @@ export namespace ProviderTransform {
if ((msg.role === "assistant" || msg.role === "tool") && Array.isArray(msg.content)) {
msg.content = msg.content.map((part) => {
- if (
- (part.type === "tool-call" || part.type === "tool-result") &&
- "toolCallId" in part
- ) {
+ if ((part.type === "tool-call" || part.type === "tool-result") && "toolCallId" in part) {
// Mistral requires alphanumeric tool call IDs with exactly 9 characters
const normalizedId = part.toolCallId
.replace(/[^a-zA-Z0-9]/g, "") // Remove non-alphanumeric characters
@@ -96,8 +86,7 @@ export namespace ProviderTransform {
}
for (const msg of unique([...system, ...final])) {
- const shouldUseContentOptions =
- providerID !== "anthropic" && Array.isArray(msg.content) && msg.content.length > 0
+ const shouldUseContentOptions = providerID !== "anthropic" && Array.isArray(msg.content) && msg.content.length > 0
if (shouldUseContentOptions) {
const lastContent = msg.content[msg.content.length - 1]
@@ -139,11 +128,7 @@ export namespace ProviderTransform {
return undefined
}
- export function options(
- providerID: string,
- modelID: string,
- sessionID: string,
- ): Record<string, any> | undefined {
+ export function options(providerID: string, modelID: string, sessionID: string): Record<string, any> | undefined {
const result: Record<string, any> = {}
if (providerID === "openai") {
@@ -168,11 +153,7 @@ export namespace ProviderTransform {
return result
}
- export function providerOptions(
- npm: string | undefined,
- providerID: string,
- options: { [x: string]: any },
- ) {
+ export function providerOptions(npm: string | undefined, providerID: string, options: { [x: string]: any }) {
switch (npm) {
case "@ai-sdk/openai":
case "@ai-sdk/azure":
@@ -205,8 +186,7 @@ export namespace ProviderTransform {
if (providerID === "anthropic") {
const thinking = options?.["thinking"]
- const budgetTokens =
- typeof thinking?.["budgetTokens"] === "number" ? thinking["budgetTokens"] : 0
+ const budgetTokens = typeof thinking?.["budgetTokens"] === "number" ? thinking["budgetTokens"] : 0
const enabled = thinking?.["type"] === "enabled"
if (enabled && budgetTokens > 0) {
// Return text tokens so that text + thinking <= model cap, preferring 32k text when possible.
diff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.ts
index bfe804ae1..11705fc81 100644
--- a/packages/opencode/src/server/server.ts
+++ b/packages/opencode/src/server/server.ts
@@ -1,12 +1,6 @@
import { Log } from "../util/log"
import { Bus } from "../bus"
-import {
- describeRoute,
- generateSpecs,
- validator,
- resolver,
- openAPIRouteHandler,
-} from "hono-openapi"
+import { describeRoute, generateSpecs, validator, resolver, openAPIRouteHandler } from "hono-openapi"
import { Hono } from "hono"
import { cors } from "hono/cors"
import { stream, streamSSE } from "hono/streaming"
@@ -257,9 +251,7 @@ export namespace Server {
id: t.id,
description: t.description,
// Handle both Zod schemas and plain JSON schemas
- parameters: (t.parameters as any)?._def
- ? zodToJsonSchema(t.parameters as any)
- : t.parameters,
+ parameters: (t.parameters as any)?._def ? zodToJsonSchema(t.parameters as any) : t.parameters,
})),
)
},
@@ -1086,10 +1078,7 @@ export namespace Server {
const providers = await Provider.list().then((x) => mapValues(x, (item) => item.info))
return c.json({
providers: Object.values(providers),
- default: mapValues(
- providers,
- (item) => Provider.sort(Object.values(item.models))[0].id,
- ),
+ default: mapValues(providers, (item) => Provider.sort(Object.values(item.models))[0].id),
})
},
)
@@ -1683,10 +1672,7 @@ export namespace Server {
),
async (c) => {
const evt = c.req.valid("json")
- await Bus.publish(
- Object.values(TuiEvent).find((def) => def.type === evt.type)!,
- evt.properties,
- )
+ await Bus.publish(Object.values(TuiEvent).find((def) => def.type === evt.type)!, evt.properties)
return c.json(true)
},
)
diff --git a/packages/opencode/src/session/compaction.ts b/packages/opencode/src/session/compaction.ts
index 678311012..504f7a4b2 100644
--- a/packages/opencode/src/session/compaction.ts
+++ b/packages/opencode/src/session/compaction.ts
@@ -30,17 +30,12 @@ export namespace SessionCompaction {
),
}
- export function isOverflow(input: {
- tokens: MessageV2.Assistant["tokens"]
- model: ModelsDev.Model
- }) {
+ export function isOverflow(input: { tokens: MessageV2.Assistant["tokens"]; model: ModelsDev.Model }) {
if (Flag.OPENCODE_DISABLE_AUTOCOMPACT) return false
const context = input.model.limit.context
if (context === 0) return false
const count = input.tokens.input + input.tokens.cache.read + input.tokens.output
- const output =
- Math.min(input.model.limit.output, SessionPrompt.OUTPUT_TOKEN_MAX) ||
- SessionPrompt.OUTPUT_TOKEN_MAX
+ const output = Math.min(input.model.limit.output, SessionPrompt.OUTPUT_TOKEN_MAX) || SessionPrompt.OUTPUT_TOKEN_MAX
const usable = context - output
return count > usable
}
@@ -92,15 +87,9 @@ export namespace SessionCompaction {
}
}
- export async function run(input: {
- sessionID: string
- providerID: string
- modelID: string
- signal?: AbortSignal
- }) {
+ export async function run(input: { sessionID: string; providerID: string; modelID: string; signal?: AbortSignal }) {
if (!input.signal) SessionLock.assertUnlocked(input.sessionID)
- await using lock =
- input.signal === undefined ? SessionLock.acquire({ sessionID: input.sessionID }) : undefined
+ await using lock = input.signal === undefined ? SessionLock.acquire({ sessionID: input.sessionID }) : undefined
const signal = input.signal ?? lock!.signal
await Session.update(input.sessionID, (draft) => {
@@ -160,11 +149,7 @@ export namespace SessionCompaction {
// set to 0, we handle loop
maxRetries: 0,
model: model.language,
- providerOptions: ProviderTransform.providerOptions(
- model.npm,
- model.providerID,
- model.info.options,
- ),
+ providerOptions: ProviderTransform.providerOptions(model.npm, model.providerID, model.info.options),
headers: model.info.headers,
abortSignal: signal,
onError(error) {
@@ -244,11 +229,7 @@ export namespace SessionCompaction {
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"),
@@ -287,9 +268,7 @@ export namespace SessionCompaction {
})
if (result.shouldRetry) {
for (let retry = 1; retry < maxRetries; retry++) {
- const lastRetryPart = result.parts.findLast(
- (p): p is MessageV2.RetryPart => p.type === "retry",
- )
+ const lastRetryPart = result.parts.findLast((p): p is MessageV2.RetryPart => p.type === "retry")
if (lastRetryPart) {
const delayMs = SessionRetry.getRetryDelayInMs(lastRetryPart.error, retry)
@@ -338,9 +317,7 @@ export namespace SessionCompaction {
if (
!msg.error ||
(MessageV2.AbortedError.isInstance(msg.error) &&
- result.parts.some(
- (part): part is MessageV2.TextPart => part.type === "text" && part.text.length > 0,
- ))
+ result.parts.some((part): part is MessageV2.TextPart => part.type === "text" && part.text.length > 0))
) {
msg.summary = true
Bus.publish(Event.Compacted, {
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 831c2dddf..d0bdfb9e1 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -172,12 +172,7 @@ export namespace Session {
})
})
- export async function createNext(input: {
- id?: string
- title?: string
- parentID?: string
- directory: string
- }) {
+ export async function createNext(input: { id?: string; title?: string; parentID?: string; directory: string }) {
const result: Info = {
id: Identifier.descending("session", input.id),
version: Installation.VERSION,
@@ -400,9 +395,7 @@ export namespace Session {
.add(new Decimal(tokens.input).mul(input.model.cost?.input ?? 0).div(1_000_000))
.add(new Decimal(tokens.output).mul(input.model.cost?.output ?? 0).div(1_000_000))
.add(new Decimal(tokens.cache.read).mul(input.model.cost?.cache_read ?? 0).div(1_000_000))
- .add(
- new Decimal(tokens.cache.write).mul(input.model.cost?.cache_write ?? 0).div(1_000_000),
- )
+ .add(new Decimal(tokens.cache.write).mul(input.model.cost?.cache_write ?? 0).div(1_000_000))
.toNumber(),
tokens,
}
diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts
index bf15d7341..5435b9e24 100644
--- a/packages/opencode/src/session/message-v2.ts
+++ b/packages/opencode/src/session/message-v2.ts
@@ -2,13 +2,7 @@ import z from "zod"
import { Bus } from "../bus"
import { NamedError } from "../util/error"
import { Message } from "./message"
-import {
- APICallError,
- convertToModelMessages,
- LoadAPIKeyError,
- type ModelMessage,
- type UIMessage,
-} from "ai"
+import { APICallError, convertToModelMessages, LoadAPIKeyError, type ModelMessage, type UIMessage } from "ai"
import { Identifier } from "../id/id"
import { LSP } from "../lsp"
import { Snapshot } from "@/snapshot"
@@ -17,10 +11,7 @@ import { Storage } from "@/storage/storage"
export namespace MessageV2 {
export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
- export const AbortedError = NamedError.create(
- "MessageAbortedError",
- z.object({ message: z.string() }),
- )
+ export const AbortedError = NamedError.create("MessageAbortedError", z.object({ message: z.string() }))
export const AuthError = NamedError.create(
"ProviderAuthError",
z.object({
@@ -253,12 +244,7 @@ export namespace MessageV2 {
export type ToolStateError = z.infer<typeof ToolStateError>
export const ToolState = z
- .discriminatedUnion("status", [
- ToolStatePending,
- ToolStateRunning,
- ToolStateCompleted,
- ToolStateError,
- ])
+ .discriminatedUnion("status", [ToolStatePending, ToolStateRunning, ToolStateCompleted, ToolStateError])
.meta({
ref: "ToolState",
})
@@ -454,8 +440,7 @@ export namespace MessageV2 {
}
}
- const { title, time, ...metadata } =
- v1.metadata.tool[part.toolInvocation.toolCallId] ?? {}
+ const { title, time, ...metadata } = v1.metadata.tool[part.toolInvocation.toolCallId] ?? {}
if (part.toolInvocation.state === "call") {
return {
status: "running",
@@ -556,11 +541,7 @@ export namespace MessageV2 {
},
]
// text/plain and directory files are converted into text parts, ignore them
- if (
- part.type === "file" &&
- part.mime !== "text/plain" &&
- part.mime !== "application/x-directory"
- )
+ if (part.type === "file" && part.mime !== "text/plain" && part.mime !== "application/x-directory")
return [
{
type: "file",
@@ -619,9 +600,7 @@ export namespace MessageV2 {
state: "output-available",
toolCallId: part.callID,
input: part.state.input,
- output: part.state.time.compacted
- ? "[Old tool result content cleared]"
- : part.state.output,
+ output: part.state.time.compacted ? "[Old tool result content cleared]" : part.state.output,
callProviderMetadata: part.metadata,
},
]
diff --git a/packages/opencode/src/session/message.ts b/packages/opencode/src/session/message.ts
index baa8c00f1..4471f9235 100644
--- a/packages/opencode/src/session/message.ts
+++ b/packages/opencode/src/session/message.ts
@@ -51,11 +51,9 @@ export namespace Message {
})
export type ToolResult = z.infer<typeof ToolResult>
- export const ToolInvocation = z
- .discriminatedUnion("state", [ToolCall, ToolPartialCall, ToolResult])
- .meta({
- ref: "ToolInvocation",
- })
+ export const ToolInvocation = z.discriminatedUnion("state", [ToolCall, ToolPartialCall, ToolResult]).meta({
+ ref: "ToolInvocation",
+ })
export type ToolInvocation = z.infer<typeof ToolInvocation>
export const TextPart = z
@@ -124,14 +122,7 @@ export namespace Message {
export type StepStartPart = z.infer<typeof StepStartPart>
export const MessagePart = z
- .discriminatedUnion("type", [
- TextPart,
- ReasoningPart,
- ToolInvocationPart,
- SourceUrlPart,
- FilePart,
- StepStartPart,
- ])
+ .discriminatedUnion("type", [TextPart, ReasoningPart, ToolInvocationPart, SourceUrlPart, FilePart, StepStartPart])
.meta({
ref: "MessagePart",
})
@@ -149,11 +140,7 @@ export namespace Message {
completed: z.number().optional(),
}),
error: z
- .discriminatedUnion("name", [
- AuthError.Schema,
- NamedError.Unknown.Schema,
- OutputLengthError.Schema,
- ])
+ .discriminatedUnion("name", [AuthError.Schema, NamedError.Unknown.Schema, OutputLengthError.Schema])
.optional(),
sessionID: z.string(),
tool: z.record(
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts
index 3210a08fd..1802b1a3b 100644
--- a/packages/opencode/src/session/prompt.ts
+++ b/packages/opencode/src/session/prompt.ts
@@ -301,11 +301,7 @@ 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,
@@ -340,11 +336,7 @@ 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
},
@@ -362,9 +354,7 @@ export namespace SessionPrompt {
})
if (result.shouldRetry) {
for (let retry = 1; retry < maxRetries; retry++) {
- const lastRetryPart = result.parts.findLast(
- (p): p is MessageV2.RetryPart => p.type === "retry",
- )
+ const lastRetryPart = result.parts.findLast((p): p is MessageV2.RetryPart => p.type === "retry")
if (lastRetryPart) {
const delayMs = SessionRetry.getRetryDelayInMs(lastRetryPart.error, retry)
@@ -529,11 +519,7 @@ 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,
@@ -853,9 +839,7 @@ 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,
@@ -929,9 +913,7 @@ 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"),
@@ -1010,10 +992,7 @@ 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
@@ -1169,10 +1148,7 @@ 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(),
@@ -1296,11 +1272,7 @@ 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"),
@@ -1323,11 +1295,7 @@ export namespace SessionPrompt {
}
const p = await MessageV2.parts(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") {
await Session.updatePart({
...part,
state: {
@@ -1822,13 +1790,11 @@ 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,
diff --git a/packages/opencode/src/session/revert.ts b/packages/opencode/src/session/revert.ts
index cd8e34f82..dbf81edc7 100644
--- a/packages/opencode/src/session/revert.ts
+++ b/packages/opencode/src/session/revert.ts
@@ -45,9 +45,7 @@ export namespace SessionRevert {
if (!revert) {
if ((msg.info.id === input.messageID && !input.partID) || part.id === input.partID) {
// if no useful parts left in message, same as reverting whole message
- const partID = remaining.some((item) => ["text", "tool"].includes(item.type))
- ? input.partID
- : undefined
+ const partID = remaining.some((item) => ["text", "tool"].includes(item.type)) ? input.partID : undefined
revert = {
messageID: !partID && lastUser ? lastUser.id : msg.info.id,
partID,
diff --git a/packages/opencode/src/session/summary.ts b/packages/opencode/src/session/summary.ts
index de3e22bd8..3e290c6c0 100644
--- a/packages/opencode/src/session/summary.ts
+++ b/packages/opencode/src/session/summary.ts
@@ -60,9 +60,7 @@ 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
@@ -73,14 +71,11 @@ 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,
@@ -113,8 +108,7 @@ 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"),
)
) {
let summary = messages
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index 3bff0772b..3173dcac5 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -24,8 +24,7 @@ export namespace SystemPrompt {
export function provider(modelID: string) {
if (modelID.includes("gpt-5")) return [PROMPT_CODEX]
- if (modelID.includes("gpt-") || modelID.includes("o1") || modelID.includes("o3"))
- return [PROMPT_BEAST]
+ if (modelID.includes("gpt-") || modelID.includes("o1") || modelID.includes("o3")) return [PROMPT_BEAST]
if (modelID.includes("gemini-")) return [PROMPT_GEMINI]
if (modelID.includes("claude")) return [PROMPT_ANTHROPIC]
return [PROMPT_ANTHROPIC_WITHOUT_TODO]
@@ -100,11 +99,7 @@ export namespace SystemPrompt {
}),
).catch(() => [])
} else {
- matches = await Filesystem.globUp(
- instruction,
- Instance.directory,
- Instance.worktree,
- ).catch(() => [])
+ matches = await Filesystem.globUp(instruction, Instance.directory, Instance.worktree).catch(() => [])
}
matches.forEach((path) => paths.add(path))
}
diff --git a/packages/opencode/src/session/todo.ts b/packages/opencode/src/session/todo.ts
index 4d9a2650d..d52087739 100644
--- a/packages/opencode/src/session/todo.ts
+++ b/packages/opencode/src/session/todo.ts
@@ -6,9 +6,7 @@ export namespace Todo {
export const Info = z
.object({
content: z.string().describe("Brief description of the task"),
- status: z
- .string()
- .describe("Current status of the task: pending, in_progress, completed, cancelled"),
+ status: z.string().describe("Current status of the task: pending, in_progress, completed, cancelled"),
priority: z.string().describe("Priority level of the task: high, medium, low"),
id: z.string().describe("Unique identifier for the todo item"),
})
diff --git a/packages/opencode/src/share/share.ts b/packages/opencode/src/share/share.ts
index d48d76f89..1006b23d5 100644
--- a/packages/opencode/src/share/share.ts
+++ b/packages/opencode/src/share/share.ts
@@ -50,10 +50,7 @@ export namespace Share {
await sync("session/info/" + evt.properties.info.id, evt.properties.info)
})
Bus.subscribe(MessageV2.Event.Updated, async (evt) => {
- await sync(
- "session/message/" + evt.properties.info.sessionID + "/" + evt.properties.info.id,
- evt.properties.info,
- )
+ await sync("session/message/" + evt.properties.info.sessionID + "/" + evt.properties.info.id, evt.properties.info)
})
Bus.subscribe(MessageV2.Event.PartUpdated, async (evt) => {
await sync(
@@ -70,9 +67,7 @@ export namespace Share {
export const URL =
process.env["OPENCODE_API"] ??
- (Installation.isPreview() || Installation.isLocal()
- ? "https://api.dev.opencode.ai"
- : "https://api.opencode.ai")
+ (Installation.isPreview() || Installation.isLocal() ? "https://api.dev.opencode.ai" : "https://api.opencode.ai")
export async function create(sessionID: string) {
return fetch(`${URL}/share_create`, {
diff --git a/packages/opencode/src/snapshot/index.ts b/packages/opencode/src/snapshot/index.ts
index b4deee97c..98b316804 100644
--- a/packages/opencode/src/snapshot/index.ts
+++ b/packages/opencode/src/snapshot/index.ts
@@ -27,11 +27,7 @@ export namespace Snapshot {
log.info("initialized")
}
await $`git --git-dir ${git} add .`.quiet().cwd(Instance.directory).nothrow()
- const hash = await $`git --git-dir ${git} write-tree`
- .quiet()
- .cwd(Instance.directory)
- .nothrow()
- .text()
+ const hash = await $`git --git-dir ${git} write-tree`.quiet().cwd(Instance.directory).nothrow().text()
log.info("tracking", { hash, cwd: Instance.directory, git })
return hash.trim()
}
@@ -45,10 +41,7 @@ export namespace Snapshot {
export async function patch(hash: string): Promise<Patch> {
const git = gitdir()
await $`git --git-dir ${git} add .`.quiet().cwd(Instance.directory).nothrow()
- const result = await $`git --git-dir ${git} diff --name-only ${hash} -- .`
- .quiet()
- .cwd(Instance.directory)
- .nothrow()
+ const result = await $`git --git-dir ${git} diff --name-only ${hash} -- .`.quiet().cwd(Instance.directory).nothrow()
// If git diff fails, return empty patch
if (result.exitCode !== 0) {
@@ -71,11 +64,10 @@ export namespace Snapshot {
export async function restore(snapshot: string) {
log.info("restore", { commit: snapshot })
const git = gitdir()
- const result =
- await $`git --git-dir=${git} read-tree ${snapshot} && git --git-dir=${git} checkout-index -a -f`
- .quiet()
- .cwd(Instance.worktree)
- .nothrow()
+ const result = await $`git --git-dir=${git} read-tree ${snapshot} && git --git-dir=${git} checkout-index -a -f`
+ .quiet()
+ .cwd(Instance.worktree)
+ .nothrow()
if (result.exitCode !== 0) {
log.error("failed to restore snapshot", {
@@ -121,10 +113,7 @@ export namespace Snapshot {
export async function diff(hash: string) {
const git = gitdir()
await $`git --git-dir ${git} add .`.quiet().cwd(Instance.directory).nothrow()
- const result = await $`git --git-dir=${git} diff ${hash} -- .`
- .quiet()
- .cwd(Instance.worktree)
- .nothrow()
+ const result = await $`git --git-dir=${git} diff ${hash} -- .`.quiet().cwd(Instance.worktree).nothrow()
if (result.exitCode !== 0) {
log.warn("failed to get diff", {
diff --git a/packages/opencode/src/storage/storage.ts b/packages/opencode/src/storage/storage.ts
index 66ce20d95..cff7211cc 100644
--- a/packages/opencode/src/storage/storage.ts
+++ b/packages/opencode/src/storage/storage.ts
@@ -85,9 +85,7 @@ export namespace Storage {
const session = await Bun.file(sessionFile).json()
await Bun.write(dest, JSON.stringify(session))
log.info(`migrating messages for session ${session.id}`)
- for await (const msgFile of new Bun.Glob(
- `storage/session/message/${session.id}/*.json`,
- ).scan({
+ for await (const msgFile of new Bun.Glob(`storage/session/message/${session.id}/*.json`).scan({
cwd: fullProjectDir,
absolute: true,
})) {
@@ -100,12 +98,12 @@ export namespace Storage {
await Bun.write(dest, JSON.stringify(message))
log.info(`migrating parts for message ${message.id}`)
- for await (const partFile of new Bun.Glob(
- `storage/session/part/${session.id}/${message.id}/*.json`,
- ).scan({
- cwd: fullProjectDir,
- absolute: true,
- })) {
+ for await (const partFile of new Bun.Glob(`storage/session/part/${session.id}/${message.id}/*.json`).scan(
+ {
+ cwd: fullProjectDir,
+ absolute: true,
+ },
+ )) {
const dest = path.join(dir, "part", message.id, path.basename(partFile))
const part = await Bun.file(partFile).json()
log.info("copying", {
@@ -128,9 +126,7 @@ export namespace Storage {
if (!session.projectID) continue
if (!session.summary?.diffs) continue
const { diffs } = session.summary
- await Bun.file(path.join(dir, "session_diff", session.id + ".json")).write(
- JSON.stringify(diffs),
- )
+ await Bun.file(path.join(dir, "session_diff", session.id + ".json")).write(JSON.stringify(diffs))
await Bun.file(path.join(dir, "session", session.projectID, session.id + ".json")).write(
JSON.stringify({
...session,
diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts
index febd253a0..a3ccfc397 100644
--- a/packages/opencode/src/tool/bash.ts
+++ b/packages/opencode/src/tool/bash.ts
@@ -51,9 +51,7 @@ export const BashTool = Tool.define("bash", {
}),
async execute(params, ctx) {
if (params.timeout !== undefined && params.timeout < 0) {
- throw new Error(
- `Invalid timeout value: ${params.timeout}. Timeout must be a positive number.`,
- )
+ throw new Error(`Invalid timeout value: ${params.timeout}. Timeout must be a positive number.`)
}
const timeout = Math.min(params.timeout ?? DEFAULT_TIMEOUT, MAX_TIMEOUT)
const tree = await parser().then((p) => p.parse(params.command))
@@ -101,10 +99,7 @@ export const BashTool = Tool.define("bash", {
// always allow cd if it passes above check
if (command[0] !== "cd") {
- const action = Wildcard.allStructured(
- { head: command[0], tail: command.slice(1) },
- permissions,
- )
+ const action = Wildcard.allStructured({ head: command[0], tail: command.slice(1) }, permissions)
if (action === "deny") {
throw new Error(
`The user has specifically restricted access to this command, you are not allowed to execute it. Here is the configuration: ${JSON.stringify(permissions)}`,
diff --git a/packages/opencode/src/tool/edit.ts b/packages/opencode/src/tool/edit.ts
index 057fb9e8f..ba3d2c0bf 100644
--- a/packages/opencode/src/tool/edit.ts
+++ b/packages/opencode/src/tool/edit.ts
@@ -23,13 +23,8 @@ export const EditTool = Tool.define("edit", {
parameters: z.object({
filePath: z.string().describe("The absolute path to the file to modify"),
oldString: z.string().describe("The text to replace"),
- newString: z
- .string()
- .describe("The text to replace it with (must be different from oldString)"),
- replaceAll: z
- .boolean()
- .optional()
- .describe("Replace all occurrences of oldString (default false)"),
+ newString: z.string().describe("The text to replace it with (must be different from oldString)"),
+ replaceAll: z.boolean().optional().describe("Replace all occurrences of oldString (default false)"),
}),
async execute(params, ctx) {
if (!params.filePath) {
@@ -40,9 +35,7 @@ export const EditTool = Tool.define("edit", {
throw new Error("oldString and newString must be different")
}
- const filePath = path.isAbsolute(params.filePath)
- ? params.filePath
- : path.join(Instance.directory, params.filePath)
+ const filePath = path.isAbsolute(params.filePath) ? params.filePath : path.join(Instance.directory, params.filePath)
if (!Filesystem.contains(Instance.directory, filePath)) {
const parentDir = path.dirname(filePath)
await Permission.ask({
@@ -179,11 +172,7 @@ function levenshtein(a: string, b: string): number {
for (let i = 1; i <= a.length; i++) {
for (let j = 1; j <= b.length; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1
- matrix[i][j] = Math.min(
- matrix[i - 1][j] + 1,
- matrix[i][j - 1] + 1,
- matrix[i - 1][j - 1] + cost,
- )
+ matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j - 1] + cost)
}
}
return matrix[a.length][b.length]
@@ -385,9 +374,7 @@ export const WhitespaceNormalizedReplacer: Replacer = function* (content, find)
// Find the actual substring in the original line that matches
const words = find.trim().split(/\s+/)
if (words.length > 0) {
- const pattern = words
- .map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
- .join("\\s+")
+ const pattern = words.map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+")
try {
const regex = new RegExp(pattern)
const match = line.match(regex)
@@ -625,12 +612,7 @@ export function trimDiff(diff: string): string {
return trimmedLines.join("\n")
}
-export function replace(
- content: string,
- oldString: string,
- newString: string,
- replaceAll = false,
-): string {
+export function replace(content: string, oldString: string, newString: string, replaceAll = false): string {
if (oldString === newString) {
throw new Error("oldString and newString must be different")
}
diff --git a/packages/opencode/src/tool/grep.ts b/packages/opencode/src/tool/grep.ts
index 9f7d04ea1..5390be21a 100644
--- a/packages/opencode/src/tool/grep.ts
+++ b/packages/opencode/src/tool/grep.ts
@@ -9,14 +9,8 @@ export const GrepTool = Tool.define("grep", {
description: DESCRIPTION,
parameters: z.object({
pattern: z.string().describe("The regex pattern to search for in file contents"),
- path: z
- .string()
- .optional()
- .describe("The directory to search in. Defaults to the current working directory."),
- include: z
- .string()
- .optional()
- .describe('File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")'),
+ path: z.string().optional().describe("The directory to search in. Defaults to the current working directory."),
+ include: z.string().optional().describe('File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")'),
}),
async execute(params) {
if (!params.pattern) {
diff --git a/packages/opencode/src/tool/ls.ts b/packages/opencode/src/tool/ls.ts
index 4fcfcaa8c..95c36e745 100644
--- a/packages/opencode/src/tool/ls.ts
+++ b/packages/opencode/src/tool/ls.ts
@@ -37,18 +37,13 @@ const LIMIT = 100
export const ListTool = Tool.define("list", {
description: DESCRIPTION,
parameters: z.object({
- path: z
- .string()
- .describe("The absolute path to the directory to list (must be absolute, not relative)")
- .optional(),
+ path: z.string().describe("The absolute path to the directory to list (must be absolute, not relative)").optional(),
ignore: z.array(z.string()).describe("List of glob patterns to ignore").optional(),
}),
async execute(params) {
const searchPath = path.resolve(Instance.directory, params.path || ".")
- const ignoreGlobs = IGNORE_PATTERNS.map((p) => `!${p}*`).concat(
- params.ignore?.map((p) => `!${p}`) || [],
- )
+ const ignoreGlobs = IGNORE_PATTERNS.map((p) => `!${p}*`).concat(params.ignore?.map((p) => `!${p}`) || [])
const files = []
for await (const file of Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs })) {
files.push(file)
diff --git a/packages/opencode/src/tool/lsp-diagnostics.ts b/packages/opencode/src/tool/lsp-diagnostics.ts
index 78c8c3cae..18a6868b6 100644
--- a/packages/opencode/src/tool/lsp-diagnostics.ts
+++ b/packages/opencode/src/tool/lsp-diagnostics.ts
@@ -11,9 +11,7 @@ export const LspDiagnosticTool = Tool.define("lsp_diagnostics", {
path: z.string().describe("The path to the file to get diagnostics."),
}),
execute: async (args) => {
- const normalized = path.isAbsolute(args.path)
- ? args.path
- : path.join(Instance.directory, args.path)
+ const normalized = path.isAbsolute(args.path) ? args.path : path.join(Instance.directory, args.path)
await LSP.touchFile(normalized, true)
const diagnostics = await LSP.diagnostics()
const file = diagnostics[normalized]
diff --git a/packages/opencode/src/tool/multiedit.ts b/packages/opencode/src/tool/multiedit.ts
index f3a657354..7f562f473 100644
--- a/packages/opencode/src/tool/multiedit.ts
+++ b/packages/opencode/src/tool/multiedit.ts
@@ -14,13 +14,8 @@ export const MultiEditTool = Tool.define("multiedit", {
z.object({
filePath: z.string().describe("The absolute path to the file to modify"),
oldString: z.string().describe("The text to replace"),
- newString: z
- .string()
- .describe("The text to replace it with (must be different from oldString)"),
- replaceAll: z
- .boolean()
- .optional()
- .describe("Replace all occurrences of oldString (default false)"),
+ newString: z.string().describe("The text to replace it with (must be different from oldString)"),
+ replaceAll: z.boolean().optional().describe("Replace all occurrences of oldString (default false)"),
}),
)
.describe("Array of edit operations to perform sequentially on the file"),
diff --git a/packages/opencode/src/tool/read.ts b/packages/opencode/src/tool/read.ts
index 56a67bb03..963636fd1 100644
--- a/packages/opencode/src/tool/read.ts
+++ b/packages/opencode/src/tool/read.ts
@@ -18,10 +18,7 @@ export const ReadTool = Tool.define("read", {
description: DESCRIPTION,
parameters: z.object({
filePath: z.string().describe("The path to the file to read"),
- offset: z.coerce
- .number()
- .describe("The line number to start reading from (0-based)")
- .optional(),
+ offset: z.coerce.number().describe("The line number to start reading from (0-based)").optional(),
limit: z.coerce.number().describe("The number of lines to read (defaults to 2000)").optional(),
}),
async execute(params, ctx) {
@@ -56,16 +53,13 @@ export const ReadTool = Tool.define("read", {
const suggestions = dirEntries
.filter(
(entry) =>
- entry.toLowerCase().includes(base.toLowerCase()) ||
- base.toLowerCase().includes(entry.toLowerCase()),
+ entry.toLowerCase().includes(base.toLowerCase()) || base.toLowerCase().includes(entry.toLowerCase()),
)
.map((entry) => path.join(dir, entry))
.slice(0, 3)
if (suggestions.length > 0) {
- throw new Error(
- `File not found: ${filepath}\n\nDid you mean one of these?\n${suggestions.join("\n")}`,
- )
+ throw new Error(`File not found: ${filepath}\n\nDid you mean one of these?\n${suggestions.join("\n")}`)
}
throw new Error(`File not found: ${filepath}`)
diff --git a/packages/opencode/src/tool/task.ts b/packages/opencode/src/tool/task.ts
index 312c3bba7..845a0e8c8 100644
--- a/packages/opencode/src/tool/task.ts
+++ b/packages/opencode/src/tool/task.ts
@@ -14,10 +14,7 @@ export const TaskTool = Tool.define("task", async () => {
const description = DESCRIPTION.replace(
"{agents}",
agents
- .map(
- (a) =>
- `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`,
- )
+ .map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`)
.join("\n"),
)
return {
@@ -29,8 +26,7 @@ export const TaskTool = Tool.define("task", async () => {
}),
async execute(params, ctx) {
const agent = await Agent.get(params.subagent_type)
- if (!agent)
- throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)
+ if (!agent) throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)
const session = await Session.create({
parentID: ctx.sessionID,
title: params.description + ` (@${agent.name} subagent)`,
@@ -95,9 +91,7 @@ export const TaskTool = Tool.define("task", async () => {
let all
all = await Session.messages({ sessionID: session.id })
all = all.filter((x) => x.info.role === "assistant")
- all = all.flatMap(
- (msg) => msg.parts.filter((x: any) => x.type === "tool") as MessageV2.ToolPart[],
- )
+ all = all.flatMap((msg) => msg.parts.filter((x: any) => x.type === "tool") as MessageV2.ToolPart[])
return {
title: params.description,
metadata: {
diff --git a/packages/opencode/src/tool/webfetch.ts b/packages/opencode/src/tool/webfetch.ts
index d85351ffe..0333bb018 100644
--- a/packages/opencode/src/tool/webfetch.ts
+++ b/packages/opencode/src/tool/webfetch.ts
@@ -48,15 +48,13 @@ export const WebFetchTool = Tool.define("webfetch", {
let acceptHeader = "*/*"
switch (params.format) {
case "markdown":
- acceptHeader =
- "text/markdown;q=1.0, text/x-markdown;q=0.9, text/plain;q=0.8, text/html;q=0.7, */*;q=0.1"
+ acceptHeader = "text/markdown;q=1.0, text/x-markdown;q=0.9, text/plain;q=0.8, text/html;q=0.7, */*;q=0.1"
break
case "text":
acceptHeader = "text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1"
break
case "html":
- acceptHeader =
- "text/html;q=1.0, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/markdown;q=0.7, */*;q=0.1"
+ acceptHeader = "text/html;q=1.0, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/markdown;q=0.7, */*;q=0.1"
break
default:
acceptHeader =
@@ -160,9 +158,7 @@ async function extractTextFromHTML(html: string) {
.on("*", {
element(element) {
// Reset skip flag when entering other elements
- if (
- !["script", "style", "noscript", "iframe", "object", "embed"].includes(element.tagName)
- ) {
+ if (!["script", "style", "noscript", "iframe", "object", "embed"].includes(element.tagName)) {
skipContent = false
}
},
diff --git a/packages/opencode/src/tool/write.ts b/packages/opencode/src/tool/write.ts
index c7b998160..acaa12392 100644
--- a/packages/opencode/src/tool/write.ts
+++ b/packages/opencode/src/tool/write.ts
@@ -15,14 +15,10 @@ export const WriteTool = Tool.define("write", {
description: DESCRIPTION,
parameters: z.object({
content: z.string().describe("The content to write to the file"),
- filePath: z
- .string()
- .describe("The absolute path to the file to write (must be absolute, not relative)"),
+ filePath: z.string().describe("The absolute path to the file to write (must be absolute, not relative)"),
}),
async execute(params, ctx) {
- const filepath = path.isAbsolute(params.filePath)
- ? params.filePath
- : path.join(Instance.directory, params.filePath)
+ const filepath = path.isAbsolute(params.filePath) ? params.filePath : path.join(Instance.directory, params.filePath)
if (!Filesystem.contains(Instance.directory, filepath)) {
const parentDir = path.dirname(filepath)
await Permission.ask({
diff --git a/packages/opencode/src/util/binary.ts b/packages/opencode/src/util/binary.ts
index d72cc85d4..3d8f61851 100644
--- a/packages/opencode/src/util/binary.ts
+++ b/packages/opencode/src/util/binary.ts
@@ -1,9 +1,5 @@
export namespace Binary {
- export function search<T>(
- array: T[],
- id: string,
- compare: (item: T) => string,
- ): { found: boolean; index: number } {
+ export function search<T>(array: T[], id: string, compare: (item: T) => string): { found: boolean; index: number } {
let left = 0
let right = array.length - 1
diff --git a/packages/opencode/src/util/defer.ts b/packages/opencode/src/util/defer.ts
index 69b5c1788..8de21528c 100644
--- a/packages/opencode/src/util/defer.ts
+++ b/packages/opencode/src/util/defer.ts
@@ -1,8 +1,6 @@
export function defer<T extends () => void | Promise<void>>(
fn: T,
-): T extends () => Promise<void>
- ? { [Symbol.asyncDispose]: () => Promise<void> }
- : { [Symbol.dispose]: () => void } {
+): T extends () => Promise<void> ? { [Symbol.asyncDispose]: () => Promise<void> } : { [Symbol.dispose]: () => void } {
return {
[Symbol.dispose]() {
fn()
diff --git a/packages/opencode/src/util/eventloop.ts b/packages/opencode/src/util/eventloop.ts
index f7096d383..87f6eef41 100644
--- a/packages/opencode/src/util/eventloop.ts
+++ b/packages/opencode/src/util/eventloop.ts
@@ -4,17 +4,11 @@ export namespace EventLoop {
export async function wait() {
return new Promise<void>((resolve) => {
const check = () => {
- const active = [
- ...(process as any)._getActiveHandles(),
- ...(process as any)._getActiveRequests(),
- ]
+ const active = [...(process as any)._getActiveHandles(), ...(process as any)._getActiveRequests()]
Log.Default.info("eventloop", {
active,
})
- if (
- (process as any)._getActiveHandles().length === 0 &&
- (process as any)._getActiveRequests().length === 0
- ) {
+ if ((process as any)._getActiveHandles().length === 0 && (process as any)._getActiveRequests().length === 0) {
resolve()
} else {
setImmediate(check)
diff --git a/packages/opencode/src/util/lock.ts b/packages/opencode/src/util/lock.ts
index c503ddd33..3aea64394 100644
--- a/packages/opencode/src/util/lock.ts
+++ b/packages/opencode/src/util/lock.ts
@@ -39,12 +39,7 @@ export namespace Lock {
}
// Clean up empty locks
- if (
- lock.readers === 0 &&
- !lock.writer &&
- lock.waitingReaders.length === 0 &&
- lock.waitingWriters.length === 0
- ) {
+ if (lock.readers === 0 && !lock.writer && lock.waitingReaders.length === 0 && lock.waitingWriters.length === 0) {
locks.delete(key)
}
}
diff --git a/packages/opencode/src/util/log.ts b/packages/opencode/src/util/log.ts
index e771a903a..209f73032 100644
--- a/packages/opencode/src/util/log.ts
+++ b/packages/opencode/src/util/log.ts
@@ -4,9 +4,7 @@ import { Global } from "../global"
import z from "zod"
export namespace Log {
- export const Level = z
- .enum(["DEBUG", "INFO", "WARN", "ERROR"])
- .meta({ ref: "LogLevel", description: "Log level" })
+ export const Level = z.enum(["DEBUG", "INFO", "WARN", "ERROR"]).meta({ ref: "LogLevel", description: "Log level" })
export type Level = z.infer<typeof Level>
const levelPriority: Record<Level, number> = {
@@ -121,11 +119,7 @@ export namespace Log {
const next = new Date()
const diff = next.getTime() - last
last = next.getTime()
- return (
- [next.toISOString().split(".")[0], "+" + diff + "ms", prefix, message]
- .filter(Boolean)
- .join(" ") + "\n"
- )
+ return [next.toISOString().split(".")[0], "+" + diff + "ms", prefix, message].filter(Boolean).join(" ") + "\n"
}
const result: Logger = {
debug(message?: any, extra?: Record<string, any>) {
diff --git a/packages/opencode/src/util/rpc.ts b/packages/opencode/src/util/rpc.ts
index 981cc0714..57c695c48 100644
--- a/packages/opencode/src/util/rpc.ts
+++ b/packages/opencode/src/util/rpc.ts
@@ -30,10 +30,7 @@ export namespace Rpc {
}
}
return {
- call<Method extends keyof T>(
- method: Method,
- input: Parameters<T[Method]>[0],
- ): Promise<ReturnType<T[Method]>> {
+ call<Method extends keyof T>(method: Method, input: Parameters<T[Method]>[0]): Promise<ReturnType<T[Method]>> {
const requestId = id++
return new Promise((resolve) => {
pending.set(requestId, resolve)
diff --git a/packages/opencode/src/util/wildcard.ts b/packages/opencode/src/util/wildcard.ts
index feda96961..9b595a0a9 100644
--- a/packages/opencode/src/util/wildcard.ts
+++ b/packages/opencode/src/util/wildcard.ts
@@ -15,11 +15,7 @@ export namespace Wildcard {
}
export function all(input: string, patterns: Record<string, any>) {
- const sorted = pipe(
- patterns,
- Object.entries,
- sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]),
- )
+ const sorted = pipe(patterns, Object.entries, sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]))
let result = undefined
for (const [pattern, value] of sorted) {
if (match(input, pattern)) {
@@ -30,15 +26,8 @@ export namespace Wildcard {
return result
}
- export function allStructured(
- input: { head: string; tail: string[] },
- patterns: Record<string, any>,
- ) {
- const sorted = pipe(
- patterns,
- Object.entries,
- sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]),
- )
+ export function allStructured(input: { head: string; tail: string[] }, patterns: Record<string, any>) {
+ const sorted = pipe(patterns, Object.entries, sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]))
let result = undefined
for (const [pattern, value] of sorted) {
const parts = pattern.split(/\s+/)
diff --git a/packages/opencode/test/config/config.test.ts b/packages/opencode/test/config/config.test.ts
index 75b41fc00..967972842 100644
--- a/packages/opencode/test/config/config.test.ts
+++ b/packages/opencode/test/config/config.test.ts
@@ -381,11 +381,7 @@ test("resolves scoped npm plugins in config", async () => {
await Bun.write(
path.join(dir, "opencode.json"),
- JSON.stringify(
- { $schema: "https://opencode.ai/config.json", plugin: ["@scope/plugin"] },
- null,
- 2,
- ),
+ JSON.stringify({ $schema: "https://opencode.ai/config.json", plugin: ["@scope/plugin"] }, null, 2),
)
},
})
diff --git a/packages/opencode/test/ide/ide.test.ts b/packages/opencode/test/ide/ide.test.ts
index 9678aa90e..4d7014019 100644
--- a/packages/opencode/test/ide/ide.test.ts
+++ b/packages/opencode/test/ide/ide.test.ts
@@ -13,8 +13,7 @@ describe("ide", () => {
test("should detect Visual Studio Code", () => {
process.env["TERM_PROGRAM"] = "vscode"
- process.env["GIT_ASKPASS"] =
- "/path/to/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
+ process.env["GIT_ASKPASS"] = "/path/to/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Visual Studio Code")
})
@@ -29,24 +28,21 @@ describe("ide", () => {
test("should detect Cursor", () => {
process.env["TERM_PROGRAM"] = "vscode"
- process.env["GIT_ASKPASS"] =
- "/path/to/Cursor.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
+ process.env["GIT_ASKPASS"] = "/path/to/Cursor.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Cursor")
})
test("should detect VSCodium", () => {
process.env["TERM_PROGRAM"] = "vscode"
- process.env["GIT_ASKPASS"] =
- "/path/to/VSCodium.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
+ process.env["GIT_ASKPASS"] = "/path/to/VSCodium.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("VSCodium")
})
test("should detect Windsurf", () => {
process.env["TERM_PROGRAM"] = "vscode"
- process.env["GIT_ASKPASS"] =
- "/path/to/Windsurf.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
+ process.env["GIT_ASKPASS"] = "/path/to/Windsurf.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Windsurf")
})
diff --git a/packages/opencode/test/session/retry.test.ts b/packages/opencode/test/session/retry.test.ts
index ebcee80df..edce412c2 100644
--- a/packages/opencode/test/session/retry.test.ts
+++ b/packages/opencode/test/session/retry.test.ts
@@ -13,9 +13,7 @@ function apiError(headers?: Record<string, string>): MessageV2.APIError {
describe("session.retry.getRetryDelayInMs", () => {
test("doubles delay on each attempt when headers missing", () => {
const error = apiError()
- const delays = Array.from({ length: 7 }, (_, index) =>
- SessionRetry.getRetryDelayInMs(error, index + 1),
- )
+ const delays = Array.from({ length: 7 }, (_, index) => SessionRetry.getRetryDelayInMs(error, index + 1))
expect(delays).toStrictEqual([2000, 4000, 8000, 16000, 32000, 64000, 128000])
})
diff --git a/packages/opencode/test/tool/patch.test.ts b/packages/opencode/test/tool/patch.test.ts
index bf3c02e07..dcdefabb8 100644
--- a/packages/opencode/test/tool/patch.test.ts
+++ b/packages/opencode/test/tool/patch.test.ts
@@ -31,9 +31,7 @@ describe("tool.patch", () => {
await Instance.provide({
directory: "/tmp",
fn: async () => {
- expect(patchTool.execute({ patchText: "invalid patch" }, ctx)).rejects.toThrow(
- "Failed to parse patch",
- )
+ expect(patchTool.execute({ patchText: "invalid patch" }, ctx)).rejects.toThrow("Failed to parse patch")
},
})
})
@@ -45,9 +43,7 @@ describe("tool.patch", () => {
const emptyPatch = `*** Begin Patch
*** End Patch`
- expect(patchTool.execute({ patchText: emptyPatch }, ctx)).rejects.toThrow(
- "No file changes found in patch",
- )
+ expect(patchTool.execute({ patchText: emptyPatch }, ctx)).rejects.toThrow("No file changes found in patch")
},
})
})
@@ -116,9 +112,7 @@ describe("tool.patch", () => {
// Verify file was created with correct content
const filePath = path.join(fixture.path, "config.js")
const content = await fs.readFile(filePath, "utf-8")
- expect(content).toBe(
- 'const API_KEY = "test-key"\nconst DEBUG = false\nconst VERSION = "1.0"',
- )
+ expect(content).toBe('const API_KEY = "test-key"\nconst DEBUG = false\nconst VERSION = "1.0"')
},
})
})
diff --git a/packages/opencode/test/util/wildcard.test.ts b/packages/opencode/test/util/wildcard.test.ts
index 968b4f288..f7f1e1545 100644
--- a/packages/opencode/test/util/wildcard.test.ts
+++ b/packages/opencode/test/util/wildcard.test.ts
@@ -24,12 +24,9 @@ test("allStructured matches command sequences", () => {
"git status*": "allow",
}
expect(Wildcard.allStructured({ head: "git", tail: ["status", "--short"] }, rules)).toBe("allow")
- expect(
- Wildcard.allStructured(
- { head: "npm", tail: ["run", "build", "--watch"] },
- { "npm run *": "allow" },
- ),
- ).toBe("allow")
+ expect(Wildcard.allStructured({ head: "npm", tail: ["run", "build", "--watch"] }, { "npm run *": "allow" })).toBe(
+ "allow",
+ )
expect(Wildcard.allStructured({ head: "ls", tail: ["-la"] }, rules)).toBeUndefined()
})
@@ -54,7 +51,5 @@ test("allStructured handles sed flags", () => {
expect(Wildcard.allStructured({ head: "sed", tail: ["-i", "file"] }, rules)).toBe("ask")
expect(Wildcard.allStructured({ head: "sed", tail: ["-i.bak", "file"] }, rules)).toBe("ask")
expect(Wildcard.allStructured({ head: "sed", tail: ["-n", "1p", "file"] }, rules)).toBe("allow")
- expect(
- Wildcard.allStructured({ head: "sed", tail: ["-i", "-n", "/./p", "myfile.txt"] }, rules),
- ).toBe("ask")
+ expect(Wildcard.allStructured({ head: "sed", tail: ["-i", "-n", "/./p", "myfile.txt"] }, rules)).toBe("ask")
})
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index 1c8c6d2a1..f103749bd 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -151,10 +151,7 @@ export interface Hooks {
input: { model: Model; provider: Provider; message: UserMessage },
output: { temperature: number; topP: number; options: Record<string, any> },
) => Promise<void>
- "permission.ask"?: (
- input: Permission,
- output: { status: "ask" | "deny" | "allow" },
- ) => Promise<void>
+ "permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void>
"tool.execute.before"?: (
input: { tool: string; sessionID: string; callID: string },
output: { args: any },
diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts
index 695a45143..141d2b750 100644
--- a/packages/script/src/index.ts
+++ b/packages/script/src/index.ts
@@ -10,19 +10,14 @@ if (!expectedBunVersion) {
}
if (process.versions.bun !== expectedBunVersion) {
- throw new Error(
- `This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`,
- )
+ throw new Error(`This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
}
-const CHANNEL =
- process.env["OPENCODE_CHANNEL"] ??
- (await $`git branch --show-current`.text().then((x) => x.trim()))
+const CHANNEL = process.env["OPENCODE_CHANNEL"] ?? (await $`git branch --show-current`.text().then((x) => x.trim()))
const IS_PREVIEW = CHANNEL !== "latest"
const VERSION = await (async () => {
if (process.env["OPENCODE_VERSION"]) return process.env["OPENCODE_VERSION"]
- if (IS_PREVIEW)
- return `0.0.0-${CHANNEL}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
+ if (IS_PREVIEW) return `0.0.0-${CHANNEL}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
const version = await fetch("https://registry.npmjs.org/opencode-ai/latest")
.then((res) => {
if (!res.ok) throw new Error(res.statusText)
diff --git a/packages/sdk/js/src/gen/client.gen.ts b/packages/sdk/js/src/gen/client.gen.ts
index 77ef579a6..e7cdb292c 100644
--- a/packages/sdk/js/src/gen/client.gen.ts
+++ b/packages/sdk/js/src/gen/client.gen.ts
@@ -1,12 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { ClientOptions } from "./types.gen.js"
-import {
- type Config,
- type ClientOptions as DefaultClientOptions,
- createClient,
- createConfig,
-} from "./client/index.js"
+import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js"
/**
* The `createClientConfig()` function will be called on client initialization
diff --git a/packages/sdk/js/src/gen/client/client.gen.ts b/packages/sdk/js/src/gen/client/client.gen.ts
index 3a2499efb..34a8d0bec 100644
--- a/packages/sdk/js/src/gen/client/client.gen.ts
+++ b/packages/sdk/js/src/gen/client/client.gen.ts
@@ -107,9 +107,7 @@ export const createClient = (config: Config = {}): Client => {
}
const parseAs =
- (opts.parseAs === "auto"
- ? getParseAs(response.headers.get("Content-Type"))
- : opts.parseAs) ?? "json"
+ (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json"
let data: any
switch (parseAs) {
diff --git a/packages/sdk/js/src/gen/client/types.gen.ts b/packages/sdk/js/src/gen/client/types.gen.ts
index 1761dacbf..db8e544cf 100644
--- a/packages/sdk/js/src/gen/client/types.gen.ts
+++ b/packages/sdk/js/src/gen/client/types.gen.ts
@@ -1,10 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { Auth } from "../core/auth.gen.js"
-import type {
- ServerSentEventsOptions,
- ServerSentEventsResult,
-} from "../core/serverSentEvents.gen.js"
+import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.js"
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen.js"
import type { Middleware } from "./utils.gen.js"
@@ -65,11 +62,7 @@ export interface RequestOptions<
}>,
Pick<
ServerSentEventsOptions<TData>,
- | "onSseError"
- | "onSseEvent"
- | "sseDefaultRetryDelay"
- | "sseMaxRetryAttempts"
- | "sseMaxRetryDelay"
+ "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"
> {
/**
* Any body that you want to add to your request.
@@ -209,10 +202,7 @@ export type Options<
ThrowOnError extends boolean = boolean,
TResponse = unknown,
TResponseStyle extends ResponseStyle = "fields",
-> = OmitKeys<
- RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
- "body" | "path" | "query" | "url"
-> &
+> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> &
Omit<TData, "url">
export type OptionsLegacyParser<
@@ -221,8 +211,7 @@ export type OptionsLegacyParser<
TResponseStyle extends ResponseStyle = "fields",
> = TData extends { body?: any }
? TData extends { headers?: any }
- ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "headers" | "url"> &
- TData
+ ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "headers" | "url"> & TData
: OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "url"> &
TData &
Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers">
diff --git a/packages/sdk/js/src/gen/client/utils.gen.ts b/packages/sdk/js/src/gen/client/utils.gen.ts
index 53ffbad1b..209bfbe8e 100644
--- a/packages/sdk/js/src/gen/client/utils.gen.ts
+++ b/packages/sdk/js/src/gen/client/utils.gen.ts
@@ -3,19 +3,11 @@
import { getAuthToken } from "../core/auth.gen.js"
import type { QuerySerializerOptions } from "../core/bodySerializer.gen.js"
import { jsonBodySerializer } from "../core/bodySerializer.gen.js"
-import {
- serializeArrayParam,
- serializeObjectParam,
- serializePrimitiveParam,
-} from "../core/pathSerializer.gen.js"
+import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.gen.js"
import { getUrl } from "../core/utils.gen.js"
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js"
-export const createQuerySerializer = <T = unknown>({
- allowReserved,
- array,
- object,
-}: QuerySerializerOptions = {}) => {
+export const createQuerySerializer = <T = unknown>({ allowReserved, array, object }: QuerySerializerOptions = {}) => {
const querySerializer = (queryParams: T) => {
const search: string[] = []
if (queryParams && typeof queryParams === "object") {
@@ -85,9 +77,7 @@ export const getParseAs = (contentType: string | null): Exclude<Config["parseAs"
return "formData"
}
- if (
- ["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))
- ) {
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
return "blob"
}
@@ -107,11 +97,7 @@ const checkForExistence = (
if (!name) {
return false
}
- if (
- options.headers.has(name) ||
- options.query?.[name] ||
- options.headers.get("Cookie")?.includes(`${name}=`)
- ) {
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
return true
}
return false
@@ -176,9 +162,7 @@ export const mergeConfigs = (a: Config, b: Config): Config => {
return config
}
-export const mergeHeaders = (
- ...headers: Array<Required<Config>["headers"] | undefined>
-): Headers => {
+export const mergeHeaders = (...headers: Array<Required<Config>["headers"] | undefined>): Headers => {
const mergedHeaders = new Headers()
for (const header of headers) {
if (!header || typeof header !== "object") {
@@ -197,10 +181,7 @@ export const mergeHeaders = (
} else if (value !== undefined) {
// assume object headers are meant to be JSON stringified, i.e. their
// content value in OpenAPI specification is 'application/json'
- mergedHeaders.set(
- key,
- typeof value === "object" ? JSON.stringify(value) : (value as string),
- )
+ mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : (value as string))
}
}
}
@@ -216,11 +197,7 @@ type ErrInterceptor<Err, Res, Req, Options> = (
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>
-type ResInterceptor<Res, Req, Options> = (
- response: Res,
- request: Req,
- options: Options,
-) => Res | Promise<Res>
+type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>
class Interceptors<Interceptor> {
_fns: (Interceptor | null)[]
diff --git a/packages/sdk/js/src/gen/core/bodySerializer.gen.ts b/packages/sdk/js/src/gen/core/bodySerializer.gen.ts
index 83e3f56d7..066061605 100644
--- a/packages/sdk/js/src/gen/core/bodySerializer.gen.ts
+++ b/packages/sdk/js/src/gen/core/bodySerializer.gen.ts
@@ -31,9 +31,7 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
}
export const formDataBodySerializer = {
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
- body: T,
- ): FormData => {
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): FormData => {
const data = new FormData()
Object.entries(body).forEach(([key, value]) => {
diff --git a/packages/sdk/js/src/gen/core/pathSerializer.gen.ts b/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
index f13528357..96be3bc5a 100644
--- a/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
+++ b/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
@@ -74,9 +74,9 @@ export const serializeArrayParam = ({
value: unknown[]
}) => {
if (!explode) {
- const joinedValues = (
- allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
- ).join(separatorArrayNoExplode(style))
+ const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join(
+ separatorArrayNoExplode(style),
+ )
switch (style) {
case "label":
return `.${joinedValues}`
@@ -106,11 +106,7 @@ export const serializeArrayParam = ({
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues
}
-export const serializePrimitiveParam = ({
- allowReserved,
- name,
- value,
-}: SerializePrimitiveParam) => {
+export const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => {
if (value === undefined || value === null) {
return ""
}
diff --git a/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts b/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts
index 183855da1..8f7fac549 100644
--- a/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts
+++ b/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts
@@ -60,11 +60,7 @@ export interface StreamEvent<TData = unknown> {
}
export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
- stream: AsyncGenerator<
- TData extends Record<string, unknown> ? TData[keyof TData] : TData,
- TReturn,
- TNext
- >
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>
}
export const createSseClient = <TData = unknown>({
diff --git a/packages/sdk/js/src/gen/core/types.gen.ts b/packages/sdk/js/src/gen/core/types.gen.ts
index b60604fee..16408b2d0 100644
--- a/packages/sdk/js/src/gen/core/types.gen.ts
+++ b/packages/sdk/js/src/gen/core/types.gen.ts
@@ -1,11 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { Auth, AuthToken } from "./auth.gen.js"
-import type {
- BodySerializer,
- QuerySerializer,
- QuerySerializerOptions,
-} from "./bodySerializer.gen.js"
+import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js"
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
/**
@@ -45,10 +41,7 @@ export interface Config {
*/
headers?:
| RequestInit["headers"]
- | Record<
- string,
- string | number | boolean | (string | number | boolean)[] | null | undefined | unknown
- >
+ | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>
/**
* The request method.
*
diff --git a/packages/sdk/js/src/gen/core/utils.gen.ts b/packages/sdk/js/src/gen/core/utils.gen.ts
index 62e02972c..be18c608a 100644
--- a/packages/sdk/js/src/gen/core/utils.gen.ts
+++ b/packages/sdk/js/src/gen/core/utils.gen.ts
@@ -73,9 +73,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
continue
}
- const replaceValue = encodeURIComponent(
- style === "label" ? `.${value as string}` : (value as string),
- )
+ const replaceValue = encodeURIComponent(style === "label" ? `.${value as string}` : (value as string))
url = url.replace(match, replaceValue)
}
}
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts
index f902d91ab..6987eb471 100644
--- a/packages/sdk/js/src/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/gen/sdk.gen.ts
@@ -148,10 +148,10 @@ import type {
} from "./types.gen.js"
import { client as _heyApiClient } from "./client.gen.js"
-export type Options<
- TData extends TDataShape = TDataShape,
- ThrowOnError extends boolean = boolean,
-> = ClientOptions<TData, ThrowOnError> & {
+export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
+ TData,
+ ThrowOnError
+> & {
/**
* You can provide a client instance returned by `createClient()` instead of
* individual options. This might be also useful if you want to implement a
@@ -179,9 +179,7 @@ class Project extends _HeyApiClient {
/**
* List all projects
*/
- public list<ThrowOnError extends boolean = false>(
- options?: Options<ProjectListData, ThrowOnError>,
- ) {
+ public list<ThrowOnError extends boolean = false>(options?: Options<ProjectListData, ThrowOnError>) {
return (options?.client ?? this._client).get<ProjectListResponses, unknown, ThrowOnError>({
url: "/project",
...options,
@@ -191,9 +189,7 @@ class Project extends _HeyApiClient {
/**
* Get the current project
*/
- public current<ThrowOnError extends boolean = false>(
- options?: Options<ProjectCurrentData, ThrowOnError>,
- ) {
+ public current<ThrowOnError extends boolean = false>(options?: Options<ProjectCurrentData, ThrowOnError>) {
return (options?.client ?? this._client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
url: "/project/current",
...options,
@@ -215,14 +211,8 @@ class Config extends _HeyApiClient {
/**
* Update config
*/
- public update<ThrowOnError extends boolean = false>(
- options?: Options<ConfigUpdateData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).patch<
- ConfigUpdateResponses,
- ConfigUpdateErrors,
- ThrowOnError
- >({
+ public update<ThrowOnError extends boolean = false>(options?: Options<ConfigUpdateData, ThrowOnError>) {
+ return (options?.client ?? this._client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
url: "/config",
...options,
headers: {
@@ -235,9 +225,7 @@ class Config extends _HeyApiClient {
/**
* List all providers
*/
- public providers<ThrowOnError extends boolean = false>(
- options?: Options<ConfigProvidersData, ThrowOnError>,
- ) {
+ public providers<ThrowOnError extends boolean = false>(options?: Options<ConfigProvidersData, ThrowOnError>) {
return (options?.client ?? this._client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
url: "/config/providers",
...options,
@@ -283,9 +271,7 @@ class Session extends _HeyApiClient {
/**
* List all sessions
*/
- public list<ThrowOnError extends boolean = false>(
- options?: Options<SessionListData, ThrowOnError>,
- ) {
+ public list<ThrowOnError extends boolean = false>(options?: Options<SessionListData, ThrowOnError>) {
return (options?.client ?? this._client).get<SessionListResponses, unknown, ThrowOnError>({
url: "/session",
...options,
@@ -295,14 +281,8 @@ class Session extends _HeyApiClient {
/**
* Create a new session
*/
- public create<ThrowOnError extends boolean = false>(
- options?: Options<SessionCreateData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).post<
- SessionCreateResponses,
- SessionCreateErrors,
- ThrowOnError
- >({
+ public create<ThrowOnError extends boolean = false>(options?: Options<SessionCreateData, ThrowOnError>) {
+ return (options?.client ?? this._client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
url: "/session",
...options,
headers: {
@@ -315,14 +295,8 @@ class Session extends _HeyApiClient {
/**
* Delete a session and all its data
*/
- public delete<ThrowOnError extends boolean = false>(
- options: Options<SessionDeleteData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).delete<
- SessionDeleteResponses,
- SessionDeleteErrors,
- ThrowOnError
- >({
+ public delete<ThrowOnError extends boolean = false>(options: Options<SessionDeleteData, ThrowOnError>) {
+ return (options.client ?? this._client).delete<SessionDeleteResponses, SessionDeleteErrors, ThrowOnError>({
url: "/session/{id}",
...options,
})
@@ -332,11 +306,7 @@ class Session extends _HeyApiClient {
* Get session
*/
public get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>) {
- return (options.client ?? this._client).get<
- SessionGetResponses,
- SessionGetErrors,
- ThrowOnError
- >({
+ return (options.client ?? this._client).get<SessionGetResponses, SessionGetErrors, ThrowOnError>({
url: "/session/{id}",
...options,
})
@@ -345,14 +315,8 @@ class Session extends _HeyApiClient {
/**
* Update session properties
*/
- public update<ThrowOnError extends boolean = false>(
- options: Options<SessionUpdateData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).patch<
- SessionUpdateResponses,
- SessionUpdateErrors,
- ThrowOnError
- >({
+ public update<ThrowOnError extends boolean = false>(options: Options<SessionUpdateData, ThrowOnError>) {
+ return (options.client ?? this._client).patch<SessionUpdateResponses, SessionUpdateErrors, ThrowOnError>({
url: "/session/{id}",
...options,
headers: {
@@ -365,14 +329,8 @@ class Session extends _HeyApiClient {
/**
* Get a session's children
*/
- public children<ThrowOnError extends boolean = false>(
- options: Options<SessionChildrenData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).get<
- SessionChildrenResponses,
- SessionChildrenErrors,
- ThrowOnError
- >({
+ public children<ThrowOnError extends boolean = false>(options: Options<SessionChildrenData, ThrowOnError>) {
+ return (options.client ?? this._client).get<SessionChildrenResponses, SessionChildrenErrors, ThrowOnError>({
url: "/session/{id}/children",
...options,
})
@@ -381,14 +339,8 @@ class Session extends _HeyApiClient {
/**
* Get the todo list for a session
*/
- public todo<ThrowOnError extends boolean = false>(
- options: Options<SessionTodoData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).get<
- SessionTodoResponses,
- SessionTodoErrors,
- ThrowOnError
- >({
+ public todo<ThrowOnError extends boolean = false>(options: Options<SessionTodoData, ThrowOnError>) {
+ return (options.client ?? this._client).get<SessionTodoResponses, SessionTodoErrors, ThrowOnError>({
url: "/session/{id}/todo",
...options,
})
@@ -397,14 +349,8 @@ class Session extends _HeyApiClient {
/**
* Analyze the app and create an AGENTS.md file
*/
- public init<ThrowOnError extends boolean = false>(
- options: Options<SessionInitData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionInitResponses,
- SessionInitErrors,
- ThrowOnError
- >({
+ public init<ThrowOnError extends boolean = false>(options: Options<SessionInitData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionInitResponses, SessionInitErrors, ThrowOnError>({
url: "/session/{id}/init",
...options,
headers: {
@@ -417,9 +363,7 @@ class Session extends _HeyApiClient {
/**
* Fork an existing session at a specific message
*/
- public fork<ThrowOnError extends boolean = false>(
- options: Options<SessionForkData, ThrowOnError>,
- ) {
+ public fork<ThrowOnError extends boolean = false>(options: Options<SessionForkData, ThrowOnError>) {
return (options.client ?? this._client).post<SessionForkResponses, unknown, ThrowOnError>({
url: "/session/{id}/fork",
...options,
@@ -433,14 +377,8 @@ class Session extends _HeyApiClient {
/**
* Abort a session
*/
- public abort<ThrowOnError extends boolean = false>(
- options: Options<SessionAbortData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionAbortResponses,
- SessionAbortErrors,
- ThrowOnError
- >({
+ public abort<ThrowOnError extends boolean = false>(options: Options<SessionAbortData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionAbortResponses, SessionAbortErrors, ThrowOnError>({
url: "/session/{id}/abort",
...options,
})
@@ -449,14 +387,8 @@ class Session extends _HeyApiClient {
/**
* Unshare the session
*/
- public unshare<ThrowOnError extends boolean = false>(
- options: Options<SessionUnshareData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).delete<
- SessionUnshareResponses,
- SessionUnshareErrors,
- ThrowOnError
- >({
+ public unshare<ThrowOnError extends boolean = false>(options: Options<SessionUnshareData, ThrowOnError>) {
+ return (options.client ?? this._client).delete<SessionUnshareResponses, SessionUnshareErrors, ThrowOnError>({
url: "/session/{id}/share",
...options,
})
@@ -465,14 +397,8 @@ class Session extends _HeyApiClient {
/**
* Share a session
*/
- public share<ThrowOnError extends boolean = false>(
- options: Options<SessionShareData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionShareResponses,
- SessionShareErrors,
- ThrowOnError
- >({
+ public share<ThrowOnError extends boolean = false>(options: Options<SessionShareData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionShareResponses, SessionShareErrors, ThrowOnError>({
url: "/session/{id}/share",
...options,
})
@@ -481,14 +407,8 @@ class Session extends _HeyApiClient {
/**
* Get the diff for this session
*/
- public diff<ThrowOnError extends boolean = false>(
- options: Options<SessionDiffData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).get<
- SessionDiffResponses,
- SessionDiffErrors,
- ThrowOnError
- >({
+ public diff<ThrowOnError extends boolean = false>(options: Options<SessionDiffData, ThrowOnError>) {
+ return (options.client ?? this._client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({
url: "/session/{id}/diff",
...options,
})
@@ -497,14 +417,8 @@ class Session extends _HeyApiClient {
/**
* Summarize the session
*/
- public summarize<ThrowOnError extends boolean = false>(
- options: Options<SessionSummarizeData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionSummarizeResponses,
- SessionSummarizeErrors,
- ThrowOnError
- >({
+ public summarize<ThrowOnError extends boolean = false>(options: Options<SessionSummarizeData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError>({
url: "/session/{id}/summarize",
...options,
headers: {
@@ -517,14 +431,8 @@ class Session extends _HeyApiClient {
/**
* List messages for a session
*/
- public messages<ThrowOnError extends boolean = false>(
- options: Options<SessionMessagesData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).get<
- SessionMessagesResponses,
- SessionMessagesErrors,
- ThrowOnError
- >({
+ public messages<ThrowOnError extends boolean = false>(options: Options<SessionMessagesData, ThrowOnError>) {
+ return (options.client ?? this._client).get<SessionMessagesResponses, SessionMessagesErrors, ThrowOnError>({
url: "/session/{id}/message",
...options,
})
@@ -533,14 +441,8 @@ class Session extends _HeyApiClient {
/**
* Create and send a new message to a session
*/
- public prompt<ThrowOnError extends boolean = false>(
- options: Options<SessionPromptData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionPromptResponses,
- SessionPromptErrors,
- ThrowOnError
- >({
+ public prompt<ThrowOnError extends boolean = false>(options: Options<SessionPromptData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionPromptResponses, SessionPromptErrors, ThrowOnError>({
url: "/session/{id}/message",
...options,
headers: {
@@ -553,14 +455,8 @@ class Session extends _HeyApiClient {
/**
* Get a message from a session
*/
- public message<ThrowOnError extends boolean = false>(
- options: Options<SessionMessageData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).get<
- SessionMessageResponses,
- SessionMessageErrors,
- ThrowOnError
- >({
+ public message<ThrowOnError extends boolean = false>(options: Options<SessionMessageData, ThrowOnError>) {
+ return (options.client ?? this._client).get<SessionMessageResponses, SessionMessageErrors, ThrowOnError>({
url: "/session/{id}/message/{messageID}",
...options,
})
@@ -569,14 +465,8 @@ class Session extends _HeyApiClient {
/**
* Send a new command to a session
*/
- public command<ThrowOnError extends boolean = false>(
- options: Options<SessionCommandData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionCommandResponses,
- SessionCommandErrors,
- ThrowOnError
- >({
+ public command<ThrowOnError extends boolean = false>(options: Options<SessionCommandData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionCommandResponses, SessionCommandErrors, ThrowOnError>({
url: "/session/{id}/command",
...options,
headers: {
@@ -589,14 +479,8 @@ class Session extends _HeyApiClient {
/**
* Run a shell command
*/
- public shell<ThrowOnError extends boolean = false>(
- options: Options<SessionShellData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionShellResponses,
- SessionShellErrors,
- ThrowOnError
- >({
+ public shell<ThrowOnError extends boolean = false>(options: Options<SessionShellData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionShellResponses, SessionShellErrors, ThrowOnError>({
url: "/session/{id}/shell",
...options,
headers: {
@@ -609,14 +493,8 @@ class Session extends _HeyApiClient {
/**
* Revert a message
*/
- public revert<ThrowOnError extends boolean = false>(
- options: Options<SessionRevertData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionRevertResponses,
- SessionRevertErrors,
- ThrowOnError
- >({
+ public revert<ThrowOnError extends boolean = false>(options: Options<SessionRevertData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionRevertResponses, SessionRevertErrors, ThrowOnError>({
url: "/session/{id}/revert",
...options,
headers: {
@@ -629,14 +507,8 @@ class Session extends _HeyApiClient {
/**
* Restore all reverted messages
*/
- public unrevert<ThrowOnError extends boolean = false>(
- options: Options<SessionUnrevertData, ThrowOnError>,
- ) {
- return (options.client ?? this._client).post<
- SessionUnrevertResponses,
- SessionUnrevertErrors,
- ThrowOnError
- >({
+ public unrevert<ThrowOnError extends boolean = false>(options: Options<SessionUnrevertData, ThrowOnError>) {
+ return (options.client ?? this._client).post<SessionUnrevertResponses, SessionUnrevertErrors, ThrowOnError>({
url: "/session/{id}/unrevert",
...options,
})
@@ -647,9 +519,7 @@ class Command extends _HeyApiClient {
/**
* List all commands
*/
- public list<ThrowOnError extends boolean = false>(
- options?: Options<CommandListData, ThrowOnError>,
- ) {
+ public list<ThrowOnError extends boolean = false>(options?: Options<CommandListData, ThrowOnError>) {
return (options?.client ?? this._client).get<CommandListResponses, unknown, ThrowOnError>({
url: "/command",
...options,
@@ -671,9 +541,7 @@ class Find extends _HeyApiClient {
/**
* Find files
*/
- public files<ThrowOnError extends boolean = false>(
- options: Options<FindFilesData, ThrowOnError>,
- ) {
+ public files<ThrowOnError extends boolean = false>(options: Options<FindFilesData, ThrowOnError>) {
return (options.client ?? this._client).get<FindFilesResponses, unknown, ThrowOnError>({
url: "/find/file",
...options,
@@ -683,9 +551,7 @@ class Find extends _HeyApiClient {
/**
* Find workspace symbols
*/
- public symbols<ThrowOnError extends boolean = false>(
- options: Options<FindSymbolsData, ThrowOnError>,
- ) {
+ public symbols<ThrowOnError extends boolean = false>(options: Options<FindSymbolsData, ThrowOnError>) {
return (options.client ?? this._client).get<FindSymbolsResponses, unknown, ThrowOnError>({
url: "/find/symbol",
...options,
@@ -717,9 +583,7 @@ class File extends _HeyApiClient {
/**
* Get file status
*/
- public status<ThrowOnError extends boolean = false>(
- options?: Options<FileStatusData, ThrowOnError>,
- ) {
+ public status<ThrowOnError extends boolean = false>(options?: Options<FileStatusData, ThrowOnError>) {
return (options?.client ?? this._client).get<FileStatusResponses, unknown, ThrowOnError>({
url: "/file/status",
...options,
@@ -745,9 +609,7 @@ class App extends _HeyApiClient {
/**
* List all agents
*/
- public agents<ThrowOnError extends boolean = false>(
- options?: Options<AppAgentsData, ThrowOnError>,
- ) {
+ public agents<ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>) {
return (options?.client ?? this._client).get<AppAgentsResponses, unknown, ThrowOnError>({
url: "/agent",
...options,
@@ -759,9 +621,7 @@ class Mcp extends _HeyApiClient {
/**
* Get MCP server status
*/
- public status<ThrowOnError extends boolean = false>(
- options?: Options<McpStatusData, ThrowOnError>,
- ) {
+ public status<ThrowOnError extends boolean = false>(options?: Options<McpStatusData, ThrowOnError>) {
return (options?.client ?? this._client).get<McpStatusResponses, unknown, ThrowOnError>({
url: "/mcp",
...options,
@@ -787,9 +647,7 @@ class Lsp extends _HeyApiClient {
/**
* Get LSP server status
*/
- public status<ThrowOnError extends boolean = false>(
- options?: Options<LspStatusData, ThrowOnError>,
- ) {
+ public status<ThrowOnError extends boolean = false>(options?: Options<LspStatusData, ThrowOnError>) {
return (options?.client ?? this._client).get<LspStatusResponses, unknown, ThrowOnError>({
url: "/lsp",
...options,
@@ -801,9 +659,7 @@ class Formatter extends _HeyApiClient {
/**
* Get formatter status
*/
- public status<ThrowOnError extends boolean = false>(
- options?: Options<FormatterStatusData, ThrowOnError>,
- ) {
+ public status<ThrowOnError extends boolean = false>(options?: Options<FormatterStatusData, ThrowOnError>) {
return (options?.client ?? this._client).get<FormatterStatusResponses, unknown, ThrowOnError>({
url: "/formatter",
...options,
@@ -815,9 +671,7 @@ class Control extends _HeyApiClient {
/**
* Get the next TUI request from the queue
*/
- public next<ThrowOnError extends boolean = false>(
- options?: Options<TuiControlNextData, ThrowOnError>,
- ) {
+ public next<ThrowOnError extends boolean = false>(options?: Options<TuiControlNextData, ThrowOnError>) {
return (options?.client ?? this._client).get<TuiControlNextResponses, unknown, ThrowOnError>({
url: "/tui/control/next",
...options,
@@ -827,14 +681,8 @@ class Control extends _HeyApiClient {
/**
* 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
- >({
+ 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: {
@@ -849,14 +697,8 @@ class Tui extends _HeyApiClient {
/**
* Append prompt to the TUI
*/
- public appendPrompt<ThrowOnError extends boolean = false>(
- options?: Options<TuiAppendPromptData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).post<
- TuiAppendPromptResponses,
- TuiAppendPromptErrors,
- ThrowOnError
- >({
+ public appendPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiAppendPromptData, ThrowOnError>) {
+ return (options?.client ?? this._client).post<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError>({
url: "/tui/append-prompt",
...options,
headers: {
@@ -869,9 +711,7 @@ class Tui extends _HeyApiClient {
/**
* Open the help dialog
*/
- public openHelp<ThrowOnError extends boolean = false>(
- options?: Options<TuiOpenHelpData, ThrowOnError>,
- ) {
+ public openHelp<ThrowOnError extends boolean = false>(options?: Options<TuiOpenHelpData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({
url: "/tui/open-help",
...options,
@@ -881,9 +721,7 @@ class Tui extends _HeyApiClient {
/**
* Open the session dialog
*/
- public openSessions<ThrowOnError extends boolean = false>(
- options?: Options<TuiOpenSessionsData, ThrowOnError>,
- ) {
+ public openSessions<ThrowOnError extends boolean = false>(options?: Options<TuiOpenSessionsData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({
url: "/tui/open-sessions",
...options,
@@ -893,9 +731,7 @@ class Tui extends _HeyApiClient {
/**
* Open the theme dialog
*/
- public openThemes<ThrowOnError extends boolean = false>(
- options?: Options<TuiOpenThemesData, ThrowOnError>,
- ) {
+ public openThemes<ThrowOnError extends boolean = false>(options?: Options<TuiOpenThemesData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({
url: "/tui/open-themes",
...options,
@@ -905,9 +741,7 @@ class Tui extends _HeyApiClient {
/**
* Open the model dialog
*/
- public openModels<ThrowOnError extends boolean = false>(
- options?: Options<TuiOpenModelsData, ThrowOnError>,
- ) {
+ public openModels<ThrowOnError extends boolean = false>(options?: Options<TuiOpenModelsData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({
url: "/tui/open-models",
...options,
@@ -917,9 +751,7 @@ class Tui extends _HeyApiClient {
/**
* Submit the prompt
*/
- public submitPrompt<ThrowOnError extends boolean = false>(
- options?: Options<TuiSubmitPromptData, ThrowOnError>,
- ) {
+ public submitPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiSubmitPromptData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({
url: "/tui/submit-prompt",
...options,
@@ -929,9 +761,7 @@ class Tui extends _HeyApiClient {
/**
* Clear the prompt
*/
- public clearPrompt<ThrowOnError extends boolean = false>(
- options?: Options<TuiClearPromptData, ThrowOnError>,
- ) {
+ public clearPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiClearPromptResponses, unknown, ThrowOnError>({
url: "/tui/clear-prompt",
...options,
@@ -941,14 +771,8 @@ class Tui extends _HeyApiClient {
/**
* Execute a TUI command (e.g. agent_cycle)
*/
- public executeCommand<ThrowOnError extends boolean = false>(
- options?: Options<TuiExecuteCommandData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).post<
- TuiExecuteCommandResponses,
- TuiExecuteCommandErrors,
- ThrowOnError
- >({
+ public executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>) {
+ return (options?.client ?? this._client).post<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError>({
url: "/tui/execute-command",
...options,
headers: {
@@ -961,9 +785,7 @@ class Tui extends _HeyApiClient {
/**
* Show a toast notification in the TUI
*/
- public showToast<ThrowOnError extends boolean = false>(
- options?: Options<TuiShowToastData, ThrowOnError>,
- ) {
+ public showToast<ThrowOnError extends boolean = false>(options?: Options<TuiShowToastData, ThrowOnError>) {
return (options?.client ?? this._client).post<TuiShowToastResponses, unknown, ThrowOnError>({
url: "/tui/show-toast",
...options,
@@ -977,14 +799,8 @@ class Tui extends _HeyApiClient {
/**
* Publish a TUI event
*/
- public publish<ThrowOnError extends boolean = false>(
- options?: Options<TuiPublishData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).post<
- TuiPublishResponses,
- TuiPublishErrors,
- ThrowOnError
- >({
+ public publish<ThrowOnError extends boolean = false>(options?: Options<TuiPublishData, ThrowOnError>) {
+ return (options?.client ?? this._client).post<TuiPublishResponses, TuiPublishErrors, ThrowOnError>({
url: "/tui/publish",
...options,
headers: {
@@ -1016,14 +832,8 @@ class Event extends _HeyApiClient {
/**
* Get events
*/
- public subscribe<ThrowOnError extends boolean = false>(
- options?: Options<EventSubscribeData, ThrowOnError>,
- ) {
- return (options?.client ?? this._client).get.sse<
- EventSubscribeResponses,
- unknown,
- ThrowOnError
- >({
+ public subscribe<ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>) {
+ return (options?.client ?? this._client).get.sse<EventSubscribeResponses, unknown, ThrowOnError>({
url: "/event",
...options,
})
diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts
index 08ce17b45..abbce39b8 100644
--- a/packages/sdk/js/src/gen/types.gen.ts
+++ b/packages/sdk/js/src/gen/types.gen.ts
@@ -644,12 +644,7 @@ export type AssistantMessage = {
created: number
completed?: number
}
- error?:
- | ProviderAuthError
- | UnknownError
- | MessageOutputLengthError
- | MessageAbortedError
- | ApiError
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError
parentID: string
modelID: string
providerID: string
@@ -1311,12 +1306,7 @@ export type EventSessionError = {
type: "session.error"
properties: {
sessionID?: string
- error?:
- | ProviderAuthError
- | UnknownError
- | MessageOutputLengthError
- | MessageAbortedError
- | ApiError
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError
}
}
@@ -2876,8 +2866,7 @@ export type TuiControlResponseResponses = {
200: boolean
}
-export type TuiControlResponseResponse =
- TuiControlResponseResponses[keyof TuiControlResponseResponses]
+export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]
export type AuthSetData = {
body?: Auth
diff --git a/packages/sdk/js/src/server.ts b/packages/sdk/js/src/server.ts
index 151477457..a09e14ab2 100644
--- a/packages/sdk/js/src/server.ts
+++ b/packages/sdk/js/src/server.ts
@@ -28,17 +28,13 @@ export async function createOpencodeServer(options?: ServerOptions) {
options ?? {},
)
- const proc = spawn(
- `opencode`,
- [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`],
- {
- signal: options.signal,
- env: {
- ...process.env,
- OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
- },
+ const proc = spawn(`opencode`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
+ signal: options.signal,
+ env: {
+ ...process.env,
+ OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
},
- )
+ })
const url = await new Promise<string>((resolve, reject) => {
const id = setTimeout(() => {
diff --git a/packages/slack/src/index.ts b/packages/slack/src/index.ts
index 2a952b63e..d07e3dfb4 100644
--- a/packages/slack/src/index.ts
+++ b/packages/slack/src/index.ts
@@ -19,10 +19,7 @@ const opencode = await createOpencode({
})
console.log("✅ Opencode server ready")
-const sessions = new Map<
- string,
- { client: any; server: any; sessionId: string; channel: string; thread: string }
->()
+const sessions = new Map<string, { client: any; server: any; sessionId: string; channel: string; thread: string }>()
;(async () => {
const events = await opencode.client.event.subscribe()
for await (const event of events.stream) {
diff --git a/packages/ui/src/components/checkbox.tsx b/packages/ui/src/components/checkbox.tsx
index ac9abfdab..2009a430b 100644
--- a/packages/ui/src/components/checkbox.tsx
+++ b/packages/ui/src/components/checkbox.tsx
@@ -9,14 +9,7 @@ export interface CheckboxProps extends ParentProps<ComponentProps<typeof Kobalte
}
export function Checkbox(props: CheckboxProps) {
- const [local, others] = splitProps(props, [
- "children",
- "class",
- "label",
- "hideLabel",
- "description",
- "icon",
- ])
+ const [local, others] = splitProps(props, ["children", "class", "label", "hideLabel", "description", "icon"])
const resolved = children(() => local.children)
return (
<Kobalte {...others} data-component="checkbox">
@@ -42,9 +35,7 @@ export function Checkbox(props: CheckboxProps) {
</Kobalte.Label>
</Show>
<Show when={local.description}>
- <Kobalte.Description data-slot="checkbox-description">
- {local.description}
- </Kobalte.Description>
+ <Kobalte.Description data-slot="checkbox-description">{local.description}</Kobalte.Description>
</Show>
<Kobalte.ErrorMessage data-slot="checkbox-error" />
</div>
diff --git a/packages/ui/src/components/dialog.tsx b/packages/ui/src/components/dialog.tsx
index fdbb9022d..ce7a4b3ac 100644
--- a/packages/ui/src/components/dialog.tsx
+++ b/packages/ui/src/components/dialog.tsx
@@ -38,11 +38,7 @@ export function DialogRoot(props: DialogProps) {
return (
<Kobalte {...others}>
<Show when={props.trigger}>
- <Kobalte.Trigger
- ref={trigger}
- data-component="dialog-trigger"
- onFocusIn={handleTriggerFocus}
- >
+ <Kobalte.Trigger ref={trigger} data-component="dialog-trigger" onFocusIn={handleTriggerFocus}>
{props.trigger}
</Kobalte.Trigger>
</Show>
diff --git a/packages/ui/src/components/diff-changes.tsx b/packages/ui/src/components/diff-changes.tsx
index 3095ddbdb..a8ab737f7 100644
--- a/packages/ui/src/components/diff-changes.tsx
+++ b/packages/ui/src/components/diff-changes.tsx
@@ -93,11 +93,7 @@ export function DiffChanges(props: {
return (
<Show when={variant() === "default" ? total() > 0 : true}>
- <div
- data-component="diff-changes"
- data-variant={variant()}
- classList={{ [props.class ?? ""]: true }}
- >
+ <div data-component="diff-changes" data-variant={variant()} classList={{ [props.class ?? ""]: true }}>
<Switch>
<Match when={variant() === "bars"}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 12" fill="none">
diff --git a/packages/ui/src/components/diff.tsx b/packages/ui/src/components/diff.tsx
index 21ff980c1..a53d5b3f3 100644
--- a/packages/ui/src/components/diff.tsx
+++ b/packages/ui/src/components/diff.tsx
@@ -23,13 +23,7 @@ export type DiffProps<T = {}> = FileDiffOptions<T> & {
export function Diff<T>(props: DiffProps<T>) {
let container!: HTMLDivElement
- const [local, others] = splitProps(props, [
- "before",
- "after",
- "class",
- "classList",
- "annotations",
- ])
+ const [local, others] = splitProps(props, ["before", "after", "class", "classList", "annotations"])
// const lineAnnotations: DiffLineAnnotation<ThreadMetadata>[] = [
// {
@@ -226,13 +220,7 @@ registerCustomTheme("OpenCode", () => {
},
},
{
- scope: [
- "constant",
- "entity.name.constant",
- "variable.other.constant",
- "variable.language",
- "entity",
- ],
+ scope: ["constant", "entity.name.constant", "variable.other.constant", "variable.language", "entity"],
settings: {
foreground: "var(--syntax-constant)",
},
@@ -320,11 +308,7 @@ registerCustomTheme("OpenCode", () => {
},
},
{
- scope: [
- "support.type.object.module",
- "variable.other.object",
- "support.type.property-name.css",
- ],
+ scope: ["support.type.object.module", "variable.other.object", "support.type.property-name.css"],
settings: {
foreground: "var(--syntax-object)",
},
diff --git a/packages/ui/src/components/icon-button.tsx b/packages/ui/src/components/icon-button.tsx
index fccdebd04..79a7cb9c9 100644
--- a/packages/ui/src/components/icon-button.tsx
+++ b/packages/ui/src/components/icon-button.tsx
@@ -22,11 +22,7 @@ export function IconButton(props: ComponentProps<"button"> & IconButtonProps) {
[split.class ?? ""]: !!split.class,
}}
>
- <Icon
- data-slot="icon"
- name={props.icon}
- size={split.iconSize ?? (split.size === "large" ? "normal" : "small")}
- />
+ <Icon data-slot="icon" name={props.icon} size={split.iconSize ?? (split.size === "large" ? "normal" : "small")} />
</Kobalte>
)
}
diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx
index 7688d9fc5..9557e90f3 100644
--- a/packages/ui/src/components/input.tsx
+++ b/packages/ui/src/components/input.tsx
@@ -21,12 +21,7 @@ export function Input(props: InputProps) {
"onKeyDown",
])
return (
- <Kobalte
- data-component="input"
- value={local.value}
- onChange={local.onChange}
- onKeyDown={local.onKeyDown}
- >
+ <Kobalte data-component="input" value={local.value} onChange={local.onChange} onKeyDown={local.onKeyDown}>
<Show when={local.label}>
<Kobalte.Label data-slot="label" classList={{ "sr-only": local.hideLabel }}>
{local.label}
diff --git a/packages/ui/src/components/list.tsx b/packages/ui/src/components/list.tsx
index 766979ae6..aaba61fdf 100644
--- a/packages/ui/src/components/list.tsx
+++ b/packages/ui/src/components/list.tsx
@@ -62,13 +62,7 @@ export function List<T>(props: ListProps<T>) {
})
return (
- <VList
- data-component="list"
- ref={setVirtualizer}
- data={props.data}
- onKeyDown={handleKey}
- class={props.class}
- >
+ <VList data-component="list" ref={setVirtualizer} data={props.data} onKeyDown={handleKey} class={props.class}>
{(item) => (
<button
data-slot="item"
diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx
index 38870b5a3..74d9a3113 100644
--- a/packages/ui/src/components/message-part.tsx
+++ b/packages/ui/src/components/message-part.tsx
@@ -53,16 +53,11 @@ export function Message(props: MessageProps) {
return (
<Switch>
<Match when={props.message.role === "user" && props.message}>
- {(userMessage) => (
- <UserMessageDisplay message={userMessage() as UserMessage} parts={props.parts} />
- )}
+ {(userMessage) => <UserMessageDisplay message={userMessage() as UserMessage} parts={props.parts} />}
</Match>
<Match when={props.message.role === "assistant" && props.message}>
{(assistantMessage) => (
- <AssistantMessageDisplay
- message={assistantMessage() as AssistantMessage}
- parts={props.parts}
- />
+ <AssistantMessageDisplay message={assistantMessage() as AssistantMessage} parts={props.parts} />
)}
</Match>
</Switch>
@@ -93,12 +88,7 @@ export function Part(props: MessagePartProps) {
const component = createMemo(() => PART_MAPPING[props.part.type])
return (
<Show when={component()}>
- <Dynamic
- component={component()}
- part={props.part}
- message={props.message}
- hideDetails={props.hideDetails}
- />
+ <Dynamic component={component()} part={props.part} message={props.message} hideDetails={props.hideDetails} />
</Show>
)
}
@@ -226,10 +216,7 @@ ToolRegistry.register({
name: "list",
render(props) {
return (
- <BasicTool
- icon="bullet-list"
- trigger={{ title: "List", subtitle: getDirectory(props.input.path || "/") }}
- >
+ <BasicTool icon="bullet-list" trigger={{ title: "List", subtitle: getDirectory(props.input.path || "/") }}>
<Show when={false && props.output}>
<div data-component="tool-output">{props.output}</div>
</Show>
diff --git a/packages/ui/src/components/progress-circle.tsx b/packages/ui/src/components/progress-circle.tsx
index a659c0f2e..f2e497fe5 100644
--- a/packages/ui/src/components/progress-circle.tsx
+++ b/packages/ui/src/components/progress-circle.tsx
@@ -7,13 +7,7 @@ export interface ProgressCircleProps extends Pick<ComponentProps<"svg">, "class"
}
export function ProgressCircle(props: ProgressCircleProps) {
- const [split, rest] = splitProps(props, [
- "percentage",
- "size",
- "strokeWidth",
- "class",
- "classList",
- ])
+ const [split, rest] = splitProps(props, ["percentage", "size", "strokeWidth", "class", "classList"])
const size = () => split.size || 16
const strokeWidth = () => split.strokeWidth || 3
@@ -42,13 +36,7 @@ export function ProgressCircle(props: ProgressCircleProps) {
[split.class ?? ""]: !!split.class,
}}
>
- <circle
- cx={center}
- cy={center}
- r={radius()}
- data-slot="background"
- stroke-width={strokeWidth()}
- />
+ <circle cx={center} cy={center} r={radius()} data-slot="background" stroke-width={strokeWidth()} />
<circle
cx={center}
cy={center}
diff --git a/packages/ui/src/components/select-dialog.tsx b/packages/ui/src/components/select-dialog.tsx
index 7018888f3..63fad13ec 100644
--- a/packages/ui/src/components/select-dialog.tsx
+++ b/packages/ui/src/components/select-dialog.tsx
@@ -21,16 +21,15 @@ export function SelectDialog<T>(props: SelectDialogProps<T>) {
mouseActive: false,
})
- const { filter, grouped, flat, reset, clear, active, setActive, onKeyDown, onInput } =
- useFilteredList<T>({
- items: others.items,
- key: others.key,
- filterKeys: others.filterKeys,
- current: others.current,
- groupBy: others.groupBy,
- sortBy: others.sortBy,
- sortGroupsBy: others.sortGroupsBy,
- })
+ const { filter, grouped, flat, reset, clear, active, setActive, onKeyDown, onInput } = useFilteredList<T>({
+ items: others.items,
+ key: others.key,
+ filterKeys: others.filterKeys,
+ current: others.current,
+ groupBy: others.groupBy,
+ sortBy: others.sortBy,
+ sortGroupsBy: others.sortGroupsBy,
+ })
createEffect(() => {
filter()
@@ -118,8 +117,7 @@ export function SelectDialog<T>(props: SelectDialogProps<T>) {
fallback={
<div data-slot="empty-state">
<div data-slot="message">
- {props.emptyMessage ?? "No search results"} for{" "}
- <span data-slot="filter">&quot;{filter()}&quot;</span>
+ {props.emptyMessage ?? "No search results"} for <span data-slot="filter">&quot;{filter()}&quot;</span>
</div>
</div>
}
diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx
index 305e8a4f8..dea6743ee 100644
--- a/packages/ui/src/components/select.tsx
+++ b/packages/ui/src/components/select.tsx
@@ -49,9 +49,7 @@ export function Select<T>(props: SelectProps<T> & ButtonProps) {
{...itemProps}
>
<Kobalte.ItemLabel data-slot="select-item-label">
- {props.label
- ? props.label(itemProps.item.rawValue)
- : (itemProps.item.rawValue as string)}
+ {props.label ? props.label(itemProps.item.rawValue) : (itemProps.item.rawValue as string)}
</Kobalte.ItemLabel>
<Kobalte.ItemIndicator data-slot="select-item-indicator">
<Icon name="check-small" size="small" />
diff --git a/packages/ui/src/components/typewriter.tsx b/packages/ui/src/components/typewriter.tsx
index 9adb267ad..2f6ecb016 100644
--- a/packages/ui/src/components/typewriter.tsx
+++ b/packages/ui/src/components/typewriter.tsx
@@ -2,11 +2,7 @@ import { createEffect, Show, type ValidComponent } from "solid-js"
import { createStore } from "solid-js/store"
import { Dynamic } from "solid-js/web"
-export const Typewriter = <T extends ValidComponent = "p">(props: {
- text?: string
- class?: string
- as?: T
-}) => {
+export const Typewriter = <T extends ValidComponent = "p">(props: { text?: string; class?: string; as?: T }) => {
const [store, setStore] = createStore({
typing: false,
displayed: "",
diff --git a/packages/ui/src/demo.tsx b/packages/ui/src/demo.tsx
index 6d60c25ae..96579c999 100644
--- a/packages/ui/src/demo.tsx
+++ b/packages/ui/src/demo.tsx
@@ -141,9 +141,7 @@ const Demo: Component = () => {
<Input
placeholder="Enter text..."
value={inputValue()}
- onInput={(e: InputEvent & { currentTarget: HTMLInputElement }) =>
- setInputValue(e.currentTarget.value)
- }
+ onInput={(e: InputEvent & { currentTarget: HTMLInputElement }) => setInputValue(e.currentTarget.value)}
/>
<Input placeholder="Disabled input" disabled />
<Input type="password" placeholder="Password input" />
@@ -160,15 +158,8 @@ const Demo: Component = () => {
checked={checked()}
onChange={setChecked}
/>
- <Checkbox
- label="With description"
- description="This is a helpful description for the checkbox"
- />
- <Checkbox
- label="Indeterminate state"
- description="Useful for nested checkbox lists"
- indeterminate
- />
+ <Checkbox label="With description" description="This is a helpful description for the checkbox" />
+ <Checkbox label="Indeterminate state" description="Useful for nested checkbox lists" indeterminate />
<Checkbox
label="I agree to the Terms and Conditions"
description="You must agree to continue"
@@ -199,9 +190,7 @@ const Demo: Component = () => {
<Button onClick={() => setDialogOpen(true)}>Open Dialog</Button>
<Dialog open={dialogOpen()} onOpenChange={setDialogOpen}>
<Dialog.Title>Example Dialog</Dialog.Title>
- <Dialog.Description>
- This is an example dialog with a title and description.
- </Dialog.Description>
+ <Dialog.Description>This is an example dialog with a title and description.</Dialog.Description>
<div
style={{
"margin-top": "16px",
@@ -267,10 +256,7 @@ const Demo: Component = () => {
</Accordion.Header>
<Accordion.Content>
<div style={{ padding: "16px" }}>
- <p>
- Kobalte is a UI toolkit for building accessible web apps and design systems with
- SolidJS.
- </p>
+ <p>Kobalte is a UI toolkit for building accessible web apps and design systems with SolidJS.</p>
</div>
</Accordion.Content>
</Accordion.Item>
diff --git a/packages/ui/src/hooks/use-filtered-list.tsx b/packages/ui/src/hooks/use-filtered-list.tsx
index ca9bc5388..e0cb6e7aa 100644
--- a/packages/ui/src/hooks/use-filtered-list.tsx
+++ b/packages/ui/src/hooks/use-filtered-list.tsx
@@ -11,10 +11,7 @@ export interface FilteredListProps<T> {
current?: T
groupBy?: (x: T) => string
sortBy?: (a: T, b: T) => number
- sortGroupsBy?: (
- a: { category: string; items: T[] },
- b: { category: string; items: T[] },
- ) => number
+ sortGroupsBy?: (a: { category: string; items: T[] }, b: { category: string; items: T[] }) => number
onSelect?: (value: T | undefined) => void
}
@@ -25,8 +22,7 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
() => store.filter,
async (filter) => {
const needle = filter?.toLowerCase()
- const all =
- (typeof props.items === "function" ? await props.items(needle) : props.items) || []
+ const all = (typeof props.items === "function" ? await props.items(needle) : props.items) || []
const result = pipe(
all,
(x) => {
diff --git a/packages/ui/src/styles/base.css b/packages/ui/src/styles/base.css
index 02b473238..b80398e1d 100644
--- a/packages/ui/src/styles/base.css
+++ b/packages/ui/src/styles/base.css
@@ -269,8 +269,8 @@ textarea,
crash when using `color-mix(…)` with `currentcolor`. (https://github.com/tailwindlabs/tailwindcss/issues/17194)
*/
-@supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or
- (contain-intrinsic-size: 1px) /* Safari 17+ */ {
+@supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or (contain-intrinsic-size: 1px)
+ /* Safari 17+ */ {
::placeholder {
color: color-mix(in oklab, currentcolor 50%, transparent);
}
diff --git a/packages/ui/src/styles/theme.css b/packages/ui/src/styles/theme.css
index 431d811da..2f05aad56 100644
--- a/packages/ui/src/styles/theme.css
+++ b/packages/ui/src/styles/theme.css
@@ -50,11 +50,9 @@
--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:
0 0 0 1px var(--border-base, rgba(11, 6, 0, 0.2)), 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);
@@ -64,8 +62,7 @@
0 1px 2px 0 rgba(19, 16, 16, 0.08), 0 1px 3px 0 rgba(19, 16, 16, 0.12);
--shadow-xs-border-focus:
0 0 0 1px var(--border-base, rgba(11, 6, 0, 0.2)), 0 1px 2px -1px rgba(19, 16, 16, 0.25),
- 0 1px 2px 0 rgba(19, 16, 16, 0.08), 0 1px 3px 0 rgba(19, 16, 16, 0.12),
- 0 0 0 2px var(--background-weak, #f1f0f0),
+ 0 1px 2px 0 rgba(19, 16, 16, 0.08), 0 1px 3px 0 rgba(19, 16, 16, 0.12), 0 0 0 2px var(--background-weak, #f1f0f0),
0 0 0 3px var(--border-selected, rgba(0, 74, 255, 0.99));
--text-mix-blend-mode: multiply;
diff --git a/packages/web/config.mjs b/packages/web/config.mjs
index 7adb147cd..5e2c8d3e4 100644
--- a/packages/web/config.mjs
+++ b/packages/web/config.mjs
@@ -2,8 +2,7 @@ const stage = process.env.SST_STAGE || "dev"
export default {
url: stage === "production" ? "https://opencode.ai" : `https://${stage}.opencode.ai`,
- console:
- stage === "production" ? "https://opencode.ai/auth" : `https://${stage}.opencode.ai/auth`,
+ console: stage === "production" ? "https://opencode.ai/auth" : `https://${stage}.opencode.ai/auth`,
socialCard: "https://social-cards.sst.dev",
github: "https://github.com/sst/opencode",
diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx
index 486b6e44b..062449712 100644
--- a/packages/web/src/components/Share.tsx
+++ b/packages/web/src/components/Share.tsx
@@ -1,14 +1,4 @@
-import {
- For,
- Show,
- onMount,
- Suspense,
- onCleanup,
- createMemo,
- createSignal,
- SuspenseList,
- createEffect,
-} from "solid-js"
+import { For, Show, onMount, Suspense, onCleanup, createMemo, createSignal, SuspenseList, createEffect } from "solid-js"
import { DateTime } from "luxon"
import { createStore, reconcile, unwrap } from "solid-js/store"
import { IconArrowDown } from "./icons"
@@ -76,13 +66,8 @@ export default function Share(props: { id: string; api: string; info: Session.In
},
messages: {},
})
- const messages = createMemo(() =>
- Object.values(store.messages).toSorted((a, b) => a.id?.localeCompare(b.id)),
- )
- const [connectionStatus, setConnectionStatus] = createSignal<[Status, string?]>([
- "disconnected",
- "Disconnected",
- ])
+ const messages = createMemo(() => Object.values(store.messages).toSorted((a, b) => a.id?.localeCompare(b.id)))
+ const [connectionStatus, setConnectionStatus] = createSignal<[Status, string?]>(["disconnected", "Disconnected"])
createEffect(() => {
console.log(unwrap(store))
})
@@ -345,9 +330,7 @@ export default function Share(props: { id: string; api: string; info: Session.In
</ul>
<div
data-component="header-time"
- title={DateTime.fromMillis(data().created || 0).toLocaleString(
- DateTime.DATETIME_FULL_WITH_SECONDS,
- )}
+ title={DateTime.fromMillis(data().created || 0).toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}
>
{DateTime.fromMillis(data().created || 0).toLocaleString(DateTime.DATETIME_MED)}
</div>
@@ -369,10 +352,7 @@ export default function Share(props: { id: string; api: string; info: Session.In
if (x.type === "text" && x.synthetic === true) return false
if (x.type === "tool" && x.tool === "todoread") return false
if (x.type === "text" && !x.text) return false
- if (
- x.type === "tool" &&
- (x.state.status === "pending" || x.state.status === "running")
- )
+ if (x.type === "tool" && (x.state.status === "pending" || x.state.status === "running"))
return false
return true
}),
@@ -384,8 +364,7 @@ export default function Share(props: { id: string; api: string; info: Session.In
{(part, partIndex) => {
const last = createMemo(
() =>
- data().messages.length === msgIndex() + 1 &&
- filteredParts().length === partIndex() + 1,
+ data().messages.length === msgIndex() + 1 && filteredParts().length === partIndex() + 1,
)
onMount(() => {
@@ -402,9 +381,7 @@ export default function Share(props: { id: string; api: string; info: Session.In
}
})
- return (
- <Part last={last()} part={part} index={partIndex()} message={msg} />
- )
+ return <Part last={last()} part={part} index={partIndex()} message={msg} />
}}
</For>
</Suspense>
@@ -429,11 +406,7 @@ export default function Share(props: { id: string; api: string; info: Session.In
</li>
<li>
<span data-element-label>Input Tokens</span>
- {data().tokens.input ? (
- <span>{data().tokens.input}</span>
- ) : (
- <span data-placeholder>&mdash;</span>
- )}
+ {data().tokens.input ? <span>{data().tokens.input}</span> : <span data-placeholder>&mdash;</span>}
</li>
<li>
<span data-element-label>Output Tokens</span>
@@ -587,8 +560,7 @@ export function fromV1(v1: Message.Info): MessageWithParts {
}
}
- const { title, time, ...metadata } =
- v1.metadata.tool[part.toolInvocation.toolCallId]
+ const { title, time, ...metadata } = v1.metadata.tool[part.toolInvocation.toolCallId]
if (part.toolInvocation.state === "call") {
return {
status: "running",
diff --git a/packages/web/src/components/icons/index.tsx b/packages/web/src/components/icons/index.tsx
index 9aef7a927..62445611f 100644
--- a/packages/web/src/components/icons/index.tsx
+++ b/packages/web/src/components/icons/index.tsx
@@ -4418,14 +4418,7 @@ export function IconMultiSelect(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
}
export function IconSettings(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
return (
- <svg
- {...props}
- width="16"
- height="16"
- viewBox="0 0 16 16"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
+ <svg {...props} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1256_16163)">
<path
fill-rule="evenodd"
diff --git a/packages/web/src/components/share/common.tsx b/packages/web/src/components/share/common.tsx
index 9520516c6..cab2dbdb0 100644
--- a/packages/web/src/components/share/common.tsx
+++ b/packages/web/src/components/share/common.tsx
@@ -10,12 +10,7 @@ export function AnchorIcon(props: AnchorProps) {
const [copied, setCopied] = createSignal(false)
return (
- <div
- {...rest}
- data-element-anchor
- title="Link to this message"
- data-status={copied() ? "copied" : ""}
- >
+ <div {...rest} data-element-anchor title="Link to this message" data-status={copied() ? "copied" : ""}>
<a
href={`#${local.id}`}
onClick={(e) => {
diff --git a/packages/web/src/components/share/content-code.tsx b/packages/web/src/components/share/content-code.tsx
index 0f9d28fa3..2f383b8be 100644
--- a/packages/web/src/components/share/content-code.tsx
+++ b/packages/web/src/components/share/content-code.tsx
@@ -26,11 +26,7 @@ export function ContentCode(props: Props) {
)
return (
<Suspense>
- <div
- innerHTML={html()}
- class={style.root}
- data-flush={props.flush === true ? true : undefined}
- />
+ <div innerHTML={html()} class={style.root} data-flush={props.flush === true ? true : undefined} />
</Suspense>
)
}
diff --git a/packages/web/src/components/share/content-diff.tsx b/packages/web/src/components/share/content-diff.tsx
index 79c2723cb..9ccd554d0 100644
--- a/packages/web/src/components/share/content-diff.tsx
+++ b/packages/web/src/components/share/content-diff.tsx
@@ -124,9 +124,7 @@ export function ContentDiff(props: Props) {
// Collect consecutive modified/removed/added rows
while (
i < currentRows.length &&
- (currentRows[i].type === "modified" ||
- currentRows[i].type === "removed" ||
- currentRows[i].type === "added")
+ (currentRows[i].type === "modified" || currentRows[i].type === "removed" || currentRows[i].type === "added")
) {
const row = currentRows[i]
if (row.left && (row.type === "removed" || row.type === "modified")) {
@@ -164,16 +162,10 @@ export function ContentDiff(props: Props) {
<div data-component="desktop">
{rows().map((r) => (
<div data-component="diff-row" data-type={r.type}>
- <div
- data-slot="before"
- data-diff-type={r.type === "removed" || r.type === "modified" ? "removed" : ""}
- >
+ <div data-slot="before" data-diff-type={r.type === "removed" || r.type === "modified" ? "removed" : ""}>
<ContentCode code={r.left} flush lang={props.lang} />
</div>
- <div
- data-slot="after"
- data-diff-type={r.type === "added" || r.type === "modified" ? "added" : ""}
- >
+ <div data-slot="after" data-diff-type={r.type === "added" || r.type === "modified" ? "added" : ""}>
<ContentCode code={r.right} lang={props.lang} flush />
</div>
</div>
@@ -184,11 +176,7 @@ export function ContentDiff(props: Props) {
{mobileRows().map((block) => (
<div data-component="diff-block" data-type={block.type}>
{block.lines.map((line) => (
- <div
- data-diff-type={
- block.type === "removed" ? "removed" : block.type === "added" ? "added" : ""
- }
- >
+ <div data-diff-type={block.type === "removed" ? "removed" : block.type === "added" ? "added" : ""}>
<ContentCode code={line} lang={props.lang} flush />
</div>
))}
diff --git a/packages/web/src/components/share/copy-button.tsx b/packages/web/src/components/share/copy-button.tsx
index 6f51bb4d8..892d5553f 100644
--- a/packages/web/src/components/share/copy-button.tsx
+++ b/packages/web/src/components/share/copy-button.tsx
@@ -21,11 +21,7 @@ export function CopyButton(props: CopyButtonProps) {
return (
<div data-component="copy-button" class={styles.root}>
<button type="button" onClick={handleCopyClick} data-copied={copied() ? true : undefined}>
- {copied() ? (
- <IconCheckCircle width={16} height={16} />
- ) : (
- <IconClipboard width={16} height={16} />
- )}
+ {copied() ? <IconCheckCircle width={16} height={16} /> : <IconClipboard width={16} height={16} />}
</button>
</div>
)
diff --git a/packages/web/src/components/share/part.tsx b/packages/web/src/components/share/part.tsx
index 6ad18273b..f7a6a9304 100644
--- a/packages/web/src/components/share/part.tsx
+++ b/packages/web/src/components/share/part.tsx
@@ -1,15 +1,6 @@
import map from "lang-map"
import { DateTime } from "luxon"
-import {
- For,
- Show,
- Match,
- Switch,
- type JSX,
- createMemo,
- createSignal,
- type ParentProps,
-} from "solid-js"
+import { For, Show, Match, Switch, type JSX, createMemo, createSignal, type ParentProps } from "solid-js"
import {
IconHashtag,
IconSparkles,
@@ -28,14 +19,7 @@ import {
IconMagnifyingGlass,
IconDocumentMagnifyingGlass,
} from "../icons"
-import {
- IconMeta,
- IconRobot,
- IconOpenAI,
- IconGemini,
- IconAnthropic,
- IconBrain,
-} from "../icons/custom"
+import { IconMeta, IconRobot, IconOpenAI, IconGemini, IconAnthropic, IconBrain } from "../icons/custom"
import { ContentCode } from "./content-code"
import { ContentDiff } from "./content-diff"
import { ContentText } from "./content-text"
@@ -95,11 +79,7 @@ export function Part(props: PartProps) {
<IconPaperClip width={18} height={18} />
</Match>
<Match
- when={
- props.part.type === "step-start" &&
- props.message.role === "assistant" &&
- props.message.modelID
- }
+ when={props.part.type === "step-start" && props.message.role === "assistant" && props.message.modelID}
>
{(model) => <ProviderIcon model={model()} size={18} />}
</Match>
@@ -167,9 +147,7 @@ export function Part(props: PartProps) {
DateTime.DATETIME_FULL_WITH_SECONDS,
)}
>
- {DateTime.fromMillis(props.message.time.completed).toLocaleString(
- DateTime.DATETIME_MED,
- )}
+ {DateTime.fromMillis(props.message.time.completed).toLocaleString(DateTime.DATETIME_MED)}
</Footer>
)}
</div>
@@ -365,10 +343,7 @@ function getShikiLang(filename: string) {
return type ? (overrides[type] ?? type) : "plaintext"
}
-function getDiagnostics(
- diagnosticsByFile: Record<string, Diagnostic[]>,
- currentFile: string,
-): JSX.Element[] {
+function getDiagnostics(diagnosticsByFile: Record<string, Diagnostic[]>, currentFile: string): JSX.Element[] {
const result: JSX.Element[] = []
if (diagnosticsByFile === undefined || diagnosticsByFile[currentFile] === undefined) return result
@@ -422,9 +397,7 @@ export function TodoWriteTool(props: ToolProps) {
completed: 2,
}
const todos = createMemo(() =>
- ((props.state.input?.todos ?? []) as Todo[])
- .slice()
- .sort((a, b) => priority[a.status] - priority[b.status]),
+ ((props.state.input?.todos ?? []) as Todo[]).slice().sort((a, b) => priority[a.status] - priority[b.status]),
)
const starting = () => todos().every((t: Todo) => t.status === "pending")
const finished = () => todos().every((t: Todo) => t.status === "completed")
@@ -466,23 +439,13 @@ export function GrepTool(props: ToolProps) {
<Switch>
<Match when={props.state.metadata?.matches && props.state.metadata?.matches > 0}>
<ResultsButton
- showCopy={
- props.state.metadata?.matches === 1
- ? "1 match"
- : `${props.state.metadata?.matches} matches`
- }
+ showCopy={props.state.metadata?.matches === 1 ? "1 match" : `${props.state.metadata?.matches} matches`}
>
<ContentText expand compact text={props.state.output} />
</ResultsButton>
</Match>
<Match when={props.state.output}>
- <ContentText
- expand
- compact
- text={props.state.output}
- data-size="sm"
- data-color="dimmed"
- />
+ <ContentText expand compact text={props.state.output} data-size="sm" data-color="dimmed" />
</Match>
</Switch>
</div>
@@ -542,9 +505,7 @@ export function WebFetchTool(props: ToolProps) {
}
export function ReadTool(props: ToolProps) {
- const filePath = createMemo(() =>
- stripWorkingDirectory(props.state.input?.filePath, props.message.path.cwd),
- )
+ const filePath = createMemo(() => stripWorkingDirectory(props.state.input?.filePath, props.message.path.cwd))
return (
<>
@@ -561,10 +522,7 @@ export function ReadTool(props: ToolProps) {
</Match>
<Match when={typeof props.state.metadata?.preview === "string"}>
<ResultsButton showCopy="Show preview" hideCopy="Hide preview">
- <ContentCode
- lang={getShikiLang(filePath() || "")}
- code={props.state.metadata?.preview}
- />
+ <ContentCode lang={getShikiLang(filePath() || "")} code={props.state.metadata?.preview} />
</ResultsButton>
</Match>
<Match when={typeof props.state.metadata?.preview !== "string" && props.state.output}>
@@ -579,12 +537,8 @@ export function ReadTool(props: ToolProps) {
}
export function WriteTool(props: ToolProps) {
- const filePath = createMemo(() =>
- stripWorkingDirectory(props.state.input?.filePath, props.message.path.cwd),
- )
- const diagnostics = createMemo(() =>
- getDiagnostics(props.state.metadata?.diagnostics, props.state.input.filePath),
- )
+ const filePath = createMemo(() => stripWorkingDirectory(props.state.input?.filePath, props.message.path.cwd))
+ const diagnostics = createMemo(() => getDiagnostics(props.state.metadata?.diagnostics, props.state.input.filePath))
return (
<>
@@ -604,10 +558,7 @@ export function WriteTool(props: ToolProps) {
</Match>
<Match when={props.state.input?.content}>
<ResultsButton showCopy="Show contents" hideCopy="Hide contents">
- <ContentCode
- lang={getShikiLang(filePath() || "")}
- code={props.state.input?.content}
- />
+ <ContentCode lang={getShikiLang(filePath() || "")} code={props.state.input?.content} />
</ResultsButton>
</Match>
</Switch>
@@ -617,12 +568,8 @@ export function WriteTool(props: ToolProps) {
}
export function EditTool(props: ToolProps) {
- const filePath = createMemo(() =>
- stripWorkingDirectory(props.state.input.filePath, props.message.path.cwd),
- )
- const diagnostics = createMemo(() =>
- getDiagnostics(props.state.metadata?.diagnostics, props.state.input.filePath),
- )
+ const filePath = createMemo(() => stripWorkingDirectory(props.state.input.filePath, props.message.path.cwd))
+ const diagnostics = createMemo(() => getDiagnostics(props.state.metadata?.diagnostics, props.state.input.filePath))
return (
<>
@@ -639,10 +586,7 @@ export function EditTool(props: ToolProps) {
</Match>
<Match when={props.state.metadata?.diff}>
<div data-component="diff">
- <ContentDiff
- diff={props.state.metadata?.diff}
- lang={getShikiLang(filePath() || "")}
- />
+ <ContentDiff diff={props.state.metadata?.diff} lang={getShikiLang(filePath() || "")} />
</div>
</Match>
</Switch>
@@ -675,11 +619,7 @@ export function GlobTool(props: ToolProps) {
<Match when={props.state.metadata?.count && props.state.metadata?.count > 0}>
<div data-component="tool-result">
<ResultsButton
- showCopy={
- props.state.metadata?.count === 1
- ? "1 result"
- : `${props.state.metadata?.count} results`
- }
+ showCopy={props.state.metadata?.count === 1 ? "1 result" : `${props.state.metadata?.count} results`}
>
<ContentText expand compact text={props.state.output} />
</ResultsButton>
@@ -702,12 +642,7 @@ function ResultsButton(props: ResultsButtonProps) {
return (
<>
- <button
- type="button"
- data-component="button-text"
- data-more
- onClick={() => setShow((e) => !e)}
- >
+ <button type="button" data-component="button-text" data-more onClick={() => setShow((e) => !e)}>
<span>{show() ? props.hideCopy || "Hide results" : props.showCopy || "Show results"}</span>
<span data-slot="icon">
<Show when={show()} fallback={<IconChevronRight width={11} height={11} />}>
@@ -733,11 +668,7 @@ function Footer(props: ParentProps<{ title: string }>) {
}
function ToolFooter(props: { time: number }) {
- return (
- props.time > MIN_DURATION && (
- <Footer title={`${props.time}ms`}>{formatDuration(props.time)}</Footer>
- )
- )
+ return props.time > MIN_DURATION && <Footer title={`${props.time}ms`}>{formatDuration(props.time)}</Footer>
}
function TaskTool(props: ToolProps) {
@@ -778,13 +709,7 @@ export function FallbackTool(props: ToolProps) {
<Match when={props.state.output}>
<div data-component="tool-result">
<ResultsButton>
- <ContentText
- expand
- compact
- text={props.state.output}
- data-size="sm"
- data-color="dimmed"
- />
+ <ContentText expand compact text={props.state.output} data-size="sm" data-color="dimmed" />
</ResultsButton>
</div>
</Match>
diff --git a/packages/web/src/content/docs/rules.mdx b/packages/web/src/content/docs/rules.mdx
index 6346a02ea..aa5590bb5 100644
--- a/packages/web/src/content/docs/rules.mdx
+++ b/packages/web/src/content/docs/rules.mdx
@@ -107,11 +107,7 @@ The recommended approach is to use the `instructions` field in `opencode.json`:
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
- "instructions": [
- "docs/development-standards.md",
- "test/testing-guidelines.md",
- "packages/*/AGENTS.md"
- ]
+ "instructions": ["docs/development-standards.md", "test/testing-guidelines.md", "packages/*/AGENTS.md"]
}
```
diff --git a/script/stats.ts b/script/stats.ts
index 30e71ffd5..d5f6c103f 100755
--- a/script/stats.ts
+++ b/script/stats.ts
@@ -54,9 +54,7 @@ async function fetchNpmDownloads(packageName: string): Promise<number> {
// Use a range from 2020 to current year + 5 years to ensure it works forever
const currentYear = new Date().getFullYear()
const endYear = currentYear + 5
- const response = await fetch(
- `https://api.npmjs.org/downloads/range/2020-01-01:${endYear}-12-31/${packageName}`,
- )
+ const response = await fetch(`https://api.npmjs.org/downloads/range/2020-01-01:${endYear}-12-31/${packageName}`)
if (!response.ok) {
console.warn(`Failed to fetch npm downloads for ${packageName}: ${response.status}`)
return 0
@@ -168,11 +166,7 @@ async function save(githubTotal: number, npmDownloads: number) {
? ` (${githubChange.toLocaleString()})`
: " (+0)"
const npmChangeStr =
- npmChange > 0
- ? ` (+${npmChange.toLocaleString()})`
- : npmChange < 0
- ? ` (${npmChange.toLocaleString()})`
- : " (+0)"
+ npmChange > 0 ? ` (+${npmChange.toLocaleString()})` : npmChange < 0 ? ` (${npmChange.toLocaleString()})` : " (+0)"
const totalChangeStr =
totalChange > 0
? ` (+${totalChange.toLocaleString()})`
@@ -226,8 +220,6 @@ console.log(` npm: ${npmDownloads.toLocaleString()}`)
console.log("=".repeat(60))
console.log("-".repeat(60))
-console.log(
- `GitHub Total: ${githubTotal.toLocaleString()} downloads across ${releases.length} releases`,
-)
+console.log(`GitHub Total: ${githubTotal.toLocaleString()} downloads across ${releases.length} releases`)
console.log(`npm Total: ${npmDownloads.toLocaleString()} downloads`)
console.log(`Combined Total: ${totalDownloads.toLocaleString()} downloads`)
diff --git a/sdks/vscode/src/extension.ts b/sdks/vscode/src/extension.ts
index 2f90229d5..63d8d332e 100644
--- a/sdks/vscode/src/extension.ts
+++ b/sdks/vscode/src/extension.ts
@@ -6,48 +6,39 @@ import * as vscode from "vscode"
const TERMINAL_NAME = "opencode"
export function activate(context: vscode.ExtensionContext) {
- let openNewTerminalDisposable = vscode.commands.registerCommand(
- "opencode.openNewTerminal",
- async () => {
- await openTerminal()
- },
- )
-
- let openTerminalDisposable = vscode.commands.registerCommand(
- "opencode.openTerminal",
- async () => {
- // An opencode terminal already exists => focus it
- const existingTerminal = vscode.window.terminals.find((t) => t.name === TERMINAL_NAME)
- if (existingTerminal) {
- existingTerminal.show()
- return
- }
+ let openNewTerminalDisposable = vscode.commands.registerCommand("opencode.openNewTerminal", async () => {
+ await openTerminal()
+ })
+
+ let openTerminalDisposable = vscode.commands.registerCommand("opencode.openTerminal", async () => {
+ // An opencode terminal already exists => focus it
+ const existingTerminal = vscode.window.terminals.find((t) => t.name === TERMINAL_NAME)
+ if (existingTerminal) {
+ existingTerminal.show()
+ return
+ }
- await openTerminal()
- },
- )
+ await openTerminal()
+ })
- let addFilepathDisposable = vscode.commands.registerCommand(
- "opencode.addFilepathToTerminal",
- async () => {
- const fileRef = getActiveFile()
- if (!fileRef) {
- return
- }
+ let addFilepathDisposable = vscode.commands.registerCommand("opencode.addFilepathToTerminal", async () => {
+ const fileRef = getActiveFile()
+ if (!fileRef) {
+ return
+ }
- const terminal = vscode.window.activeTerminal
- if (!terminal) {
- return
- }
+ const terminal = vscode.window.activeTerminal
+ if (!terminal) {
+ return
+ }
- if (terminal.name === TERMINAL_NAME) {
- // @ts-ignore
- const port = terminal.creationOptions.env?.["_EXTENSION_OPENCODE_PORT"]
- port ? await appendPrompt(parseInt(port), fileRef) : terminal.sendText(fileRef)
- terminal.show()
- }
- },
- )
+ if (terminal.name === TERMINAL_NAME) {
+ // @ts-ignore
+ const port = terminal.creationOptions.env?.["_EXTENSION_OPENCODE_PORT"]
+ port ? await appendPrompt(parseInt(port), fileRef) : terminal.sendText(fileRef)
+ terminal.show()
+ }
+ })
context.subscriptions.push(openTerminalDisposable, addFilepathDisposable)
diff --git a/theme-test.tsx b/theme-test.tsx
index 61837473e..810ff4fc1 100644
--- a/theme-test.tsx
+++ b/theme-test.tsx
@@ -135,10 +135,7 @@ const htmlTemplate = `
`
// Arrow functions
-const debounce = <T extends (...args: any[]) => any>(
- func: T,
- wait: number,
-): ((...args: Parameters<T>) => void) => {
+const debounce = <T extends (...args: any[]) => any>(func: T, wait: number): ((...args: Parameters<T>) => void) => {
let timeout: NodeJS.Timeout
return (...args: Parameters<T>) => {
clearTimeout(timeout)
@@ -161,10 +158,7 @@ async function fetchUserData(userId: number): Promise<User> {
}
// React component with various patterns
-const ThemeProvider: FC<{ children: ReactNode; theme?: Theme }> = ({
- children,
- theme = "auto",
-}) => {
+const ThemeProvider: FC<{ children: ReactNode; theme?: Theme }> = ({ children, theme = "auto" }) => {
const [currentTheme, setCurrentTheme] = useState<Theme>(theme)
const [status, setStatus] = useState<Status>("pending")