Compare commits

..

37 Commits

Author SHA1 Message Date
opencode 03f0b6dd7a release: v1.0.163 2025-12-16 14:56:33 +00:00
Brendan Allan f7f3ed1fa9 don't make release public until finished 2025-12-16 22:51:31 +08:00
Simon D'Morias be8116e2ea fix: preserve argument boundaries in run command (#4979) 2025-12-16 06:21:51 -06:00
David Hill f0ed1e38c9 Revert "fix: strip parentheses from file paths generated by llm"
This reverts commit 6c1a1a77b7.
2025-12-16 12:12:01 +00:00
GitHub Action ac0f1dbbdd ignore: update download stats 2025-12-16 2025-12-16 12:04:54 +00:00
GitHub Action 275a352e81 chore: format code 2025-12-16 11:51:08 +00:00
David Hill 9f3bc0e352 Merge branch 'dev' of https://github.com/sst/opencode into dev 2025-12-16 11:50:25 +00:00
David Hill 6c1a1a77b7 fix: strip parentheses from file paths generated by llm 2025-12-16 11:50:23 +00:00
David Hill 2e21c62320 fix: font size updates 2025-12-16 11:48:52 +00:00
David Hill 19c6fec4d1 wip: font-size updates 2025-12-16 11:12:08 +00:00
Brendan Allan 4779d99a13 tauri: explicitly kill sidecar before updater relaunch 2025-12-16 19:01:37 +08:00
David Hill 05e0759878 Merge branch 'dev' of https://github.com/sst/opencode into dev 2025-12-16 10:54:51 +00:00
David Hill 2330ec6dc3 fix: font size updates 2025-12-16 10:54:50 +00:00
GitHub Action 75e5130cf8 chore: format code 2025-12-16 10:33:49 +00:00
Brendan Allan 87efd27459 tauri: macos-only app menu 2025-12-16 18:33:04 +08:00
Aiden Cline 62f080b0e4 fix: small bug w/ install script 2025-12-16 00:20:05 -06:00
Aiden Cline ae3990a557 chore: centralize dep to catalog & fix typos 2025-12-15 23:07:55 -06:00
Aiden Cline d7b5b431d6 ci: Update issue assignment and labeling guidelines
Clarified assignment responsibilities and labeling for issues related to OpenCode tools.
2025-12-15 22:11:30 -06:00
Dax Raad e2fbd098d2 tui: fix dialog select items taking up 2 lines when truncated
Prevents text wrapping in dialog select options by removing wrapMode,
ensuring truncated text stays on single line and maintains proper timestamp visibility
2025-12-15 22:57:52 -05:00
Luke Parker ef78fd8bae fix: debounce LSP diagnostics to get complete results (#5600) 2025-12-15 21:26:59 -06:00
DS 72ebaeb8f7 fix: rejoin system prompt if experimental plugin hook triggers to preserve caching (#5550)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-15 20:00:26 -06:00
Lucas Duailibe 0dc62d5dad make install script use tmp dir (#5601) 2025-12-15 19:58:07 -06:00
Aiden Cline d118782a10 ci: cheaper model 2025-12-15 19:24:30 -06:00
Aiden Cline ff05647350 ci: ignore 2025-12-15 19:18:39 -06:00
GitHub Action 0e1c711c4e chore: format code 2025-12-16 01:16:20 +00:00
Aiden Cline bfb254dac6 ci: auto triage issues 2025-12-15 19:15:40 -06:00
opencode 92fe927785 release: v1.0.162 2025-12-16 00:40:27 +00:00
GitHub Action 2e25fe9d5d chore: format code 2025-12-16 00:36:01 +00:00
Dax Raad 38c5f23f4a tui: update dialog context and server to use new single dialog system 2025-12-15 19:35:19 -05:00
Dax Raad 112c58abf5 tui: refactor dialog system to use single active dialog instead of stack 2025-12-15 19:35:18 -05:00
opencode 0dce5173cc release: v1.0.161 2025-12-16 00:17:15 +00:00
Adam 2c70c0b00f fix: undefined events 2025-12-15 18:13:11 -06:00
opencode-agent[bot] 34024c2504 docs: models --refresh flag in cli.mdx (#5596)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
2025-12-15 18:04:47 -06:00
Luke Parker 27e826eba6 fix(win32): Normalise LSP paths on windows (fixes lua) (#5597) 2025-12-15 18:01:03 -06:00
Aiden Cline 89a4f1c1ae tweak: add .catch for extractZip calls 2025-12-15 17:41:28 -06:00
GitHub Action c0c61b25ff chore: format code 2025-12-15 23:30:06 +00:00
Luke Parker 0d1c6e0ca9 fix(win32): Missing LSP can now unzip on windows (#5594) 2025-12-15 17:29:30 -06:00
67 changed files with 757 additions and 369 deletions
-63
View File
@@ -1,63 +0,0 @@
name: Auto-label TUI Issues
on:
issues:
types: [opened]
jobs:
auto-label:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
issues: write
steps:
- name: Auto-label and assign issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue;
const title = issue.title;
const description = issue.body || '';
// Check for "opencode web" keyword
const webPattern = /(opencode web)/i;
const isWebRelated = webPattern.test(title) || webPattern.test(description);
// Check for version patterns like v1.0.x or 1.0.x
const versionPattern = /[v]?1\.0\./i;
const isVersionRelated = versionPattern.test(title) || versionPattern.test(description);
// Check for "nix" keyword
const nixPattern = /\bnix\b/i;
const isNixRelated = nixPattern.test(title) || nixPattern.test(description);
const labels = [];
if (isWebRelated) {
labels.push('web');
// Assign to adamdotdevin
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
assignees: ['adamdotdevin']
});
} else if (isVersionRelated) {
// Only add opentui if NOT web-related
labels.push('opentui');
}
if (isNixRelated) {
labels.push('nix');
}
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: labels
});
}
+8
View File
@@ -197,3 +197,11 @@ jobs:
releaseId: ${{ needs.publish.outputs.releaseId }}
tagName: ${{ needs.publish.outputs.tagName }}
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
publish-release:
needs:
- publish
- publish-tauri
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- run: gh release edit ${{ steps.publish.outputs.tagName }} --draft=false
+34
View File
@@ -0,0 +1,34 @@
name: Issue Triage
on:
issues:
types: [opened]
jobs:
triage:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install opencode
run: curl -fsSL https://opencode.ai/install | bash
- name: Triage issue
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
opencode run --agent triage "The following issue was just opened, triage it:
Title: $ISSUE_TITLE
$ISSUE_BODY"
+12
View File
@@ -0,0 +1,12 @@
---
mode: primary
hidden: true
model: opencode/gpt-5-nano
tools:
"*": false
"github-triage": true
---
You are a triage agent responsible for triaging github issues.
Use your github-triage tool to triage issues.
+49
View File
@@ -0,0 +1,49 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"dependencies": {
"@octokit/rest": "^22.0.1",
"@opencode-ai/plugin": "1.0.143",
},
},
},
"packages": {
"@octokit/auth-token": ["@octokit/auth-token@6.0.0", "", {}, "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w=="],
"@octokit/core": ["@octokit/core@7.0.6", "", { "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.3", "@octokit/request": "^10.0.6", "@octokit/request-error": "^7.0.2", "@octokit/types": "^16.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q=="],
"@octokit/endpoint": ["@octokit/endpoint@11.0.2", "", { "dependencies": { "@octokit/types": "^16.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-4zCpzP1fWc7QlqunZ5bSEjxc6yLAlRTnDwKtgXfcI/FxxGoqedDG8V2+xJ60bV2kODqcGB+nATdtap/XYq2NZQ=="],
"@octokit/graphql": ["@octokit/graphql@9.0.3", "", { "dependencies": { "@octokit/request": "^10.0.6", "@octokit/types": "^16.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA=="],
"@octokit/openapi-types": ["@octokit/openapi-types@27.0.0", "", {}, "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA=="],
"@octokit/plugin-paginate-rest": ["@octokit/plugin-paginate-rest@14.0.0", "", { "dependencies": { "@octokit/types": "^16.0.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw=="],
"@octokit/plugin-request-log": ["@octokit/plugin-request-log@6.0.0", "", { "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-UkOzeEN3W91/eBq9sPZNQ7sUBvYCqYbrrD8gTbBuGtHEuycE4/awMXcYvx6sVYo7LypPhmQwwpUe4Yyu4QZN5Q=="],
"@octokit/plugin-rest-endpoint-methods": ["@octokit/plugin-rest-endpoint-methods@17.0.0", "", { "dependencies": { "@octokit/types": "^16.0.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw=="],
"@octokit/request": ["@octokit/request@10.0.7", "", { "dependencies": { "@octokit/endpoint": "^11.0.2", "@octokit/request-error": "^7.0.2", "@octokit/types": "^16.0.0", "fast-content-type-parse": "^3.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-v93h0i1yu4idj8qFPZwjehoJx4j3Ntn+JhXsdJrG9pYaX6j/XRz2RmasMUHtNgQD39nrv/VwTWSqK0RNXR8upA=="],
"@octokit/request-error": ["@octokit/request-error@7.1.0", "", { "dependencies": { "@octokit/types": "^16.0.0" } }, "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw=="],
"@octokit/rest": ["@octokit/rest@22.0.1", "", { "dependencies": { "@octokit/core": "^7.0.6", "@octokit/plugin-paginate-rest": "^14.0.0", "@octokit/plugin-request-log": "^6.0.0", "@octokit/plugin-rest-endpoint-methods": "^17.0.0" } }, "sha512-Jzbhzl3CEexhnivb1iQ0KJ7s5vvjMWcmRtq5aUsKmKDrRW6z3r84ngmiFKFvpZjpiU/9/S6ITPFRpn5s/3uQJw=="],
"@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="],
"@opencode-ai/plugin": ["@opencode-ai/plugin@1.0.143", "", { "dependencies": { "@opencode-ai/sdk": "1.0.143", "zod": "4.1.8" } }, "sha512-yzaCmdazVJMDADJLbMM8KGp1X+Hd/HVyIXMlNt9qcvz/fcs/ET4EwHJsJaQi/9m/jLJ+plwBJAeIW08BMrECPg=="],
"@opencode-ai/sdk": ["@opencode-ai/sdk@1.0.143", "", {}, "sha512-dtmkBfJ7IIAHzL6KCzAlwc9GybfJONVeCsF6ePYySpkuhslDbRkZBJYb5vqGd1H5zdsgjc6JjuvmOf0rPWUL6A=="],
"before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="],
"fast-content-type-parse": ["fast-content-type-parse@3.0.0", "", {}, "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg=="],
"universal-user-agent": ["universal-user-agent@7.0.3", "", {}, "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A=="],
"zod": ["zod@4.1.8", "", {}, "sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ=="],
}
}
+4
View File
@@ -0,0 +1,4 @@
declare module "*.txt" {
const content: string
export default content
}
+3
View File
@@ -11,4 +11,7 @@
},
},
"mcp": {},
"tools": {
"github-triage": false,
},
}
+6
View File
@@ -0,0 +1,6 @@
{
"dependencies": {
"@octokit/rest": "^22.0.1",
"@opencode-ai/plugin": "1.0.143"
}
}
+51
View File
@@ -0,0 +1,51 @@
import { Octokit } from "@octokit/rest"
import { tool } from "@opencode-ai/plugin"
import DESCRIPTION from "./github-triage.txt"
function getIssueNumber(): number {
const issue = parseInt(process.env.ISSUE_NUMBER ?? "", 10)
if (!issue) throw new Error("ISSUE_NUMBER env var not set")
return issue
}
export default tool({
description: DESCRIPTION,
args: {
assignee: tool.schema
.enum(["thdxr", "adamdotdevin", "rekram1-node", "fwang", "jayair", "kommander"])
.describe("The username of the assignee")
.default("rekram1-node"),
labels: tool.schema
.array(tool.schema.enum(["nix", "opentui", "perf", "web", "zen", "docs"]))
.describe("The labels(s) to add to the issue")
.optional(),
},
async execute(args) {
const issue = getIssueNumber()
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
const owner = "sst"
const repo = "opencode"
const results: string[] = []
await octokit.rest.issues.addAssignees({
owner,
repo,
issue_number: issue,
assignees: [args.assignee],
})
results.push(`Assigned @${args.assignee} to issue #${issue}`)
if (args.labels && args.labels.length > 0) {
await octokit.rest.issues.addLabels({
owner,
repo,
issue_number: issue,
labels: args.labels,
})
results.push(`Added labels: ${args.labels.join(", ")}`)
}
return results.join("\n")
},
})
+80
View File
@@ -0,0 +1,80 @@
Use this tool to assign and/or label a Github issue.
You can assign the following users:
- thdxr
- adamdotdevin
- fwang
- jayair
- kommander
- rekram1-node
You can use the following labels:
- nix
- opentui
- perf
- web
- zen
- docs
Always try to assign an issue, if in doubt, assign rekram1-node to it.
## Breakdown of responsibilities:
### thdxr
Dax is responsible for managing core parts of the application, for large feature requests, api changes, or things that require significant changes to the codebase assign him.
This relates to OpenCode server primarily but has overlap with just about anything
### adamdotdevin
Adam is responsible for managing the Desktop/Web app. If there is an issue relating to the desktop app or `opencode web` command. Assign him.
### fwang
Frank is responsible for managing Zen, if you see complaints about OpenCode Zen, maybe it's the dashboard, the model quality, billing issues, etc. Assign him to the issue.
### jayair
Jay is responsible for documentation. If there is an issue relating to documentation assign him.
### kommander
Sebastian is responsible for managing an OpenTUI (a library for building terminal user interfaces). OpenCode's TUI is built with OpenTUI. If there are issues about:
- random characters on screen
- keybinds not working on different terminals
- general terminal stuff
Then assign the issue to Him.
### rekram1-node
Assign Aiden to an issue as a catch all, if you can't assign anyone else. Most of the time this will be bugs/polish things.
If no one else makes sense to assign, assign rekram1-node to it.
## Breakdown of Labels:
### nix
Any issue that mentions nix, or nixos should have a nix label
### opentui
Anything relating to the TUI itself should have an opentui label
### perf
Anything related to slow performance, high ram, high cpu usage, or any other performance related issue should have a perf label
### web
Anything related to `opencode web` or the desktop app should have a web label. Never add this label for anything terminal/tui related
### zen
Anything related to OpenCode Zen, billing, or model quality from Zen should have a zen label
### docs
Anything related to the documentation should have a docs label
+1
View File
@@ -171,3 +171,4 @@
| 2025-12-13 | 1,073,561 (+12,221) | 1,044,608 (+13,770) | 2,118,169 (+25,991) |
| 2025-12-14 | 1,082,042 (+8,481) | 1,052,425 (+7,817) | 2,134,467 (+16,298) |
| 2025-12-15 | 1,093,632 (+11,590) | 1,059,078 (+6,653) | 2,152,710 (+18,243) |
| 2025-12-16 | 1,120,477 (+26,845) | 1,078,022 (+18,944) | 2,198,499 (+45,789) |
+18 -17
View File
@@ -20,7 +20,7 @@
},
"packages/console/app": {
"name": "@opencode-ai/console-app",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@cloudflare/vite-plugin": "1.15.2",
"@ibm/plex": "6.4.1",
@@ -48,7 +48,7 @@
},
"packages/console/core": {
"name": "@opencode-ai/console-core",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@aws-sdk/client-sts": "3.782.0",
"@jsx-email/render": "1.1.1",
@@ -75,7 +75,7 @@
},
"packages/console/function": {
"name": "@opencode-ai/console-function",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@ai-sdk/anthropic": "2.0.0",
"@ai-sdk/openai": "2.0.2",
@@ -99,7 +99,7 @@
},
"packages/console/mail": {
"name": "@opencode-ai/console-mail",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
@@ -123,7 +123,7 @@
},
"packages/desktop": {
"name": "@opencode-ai/desktop",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@kobalte/core": "catalog:",
"@opencode-ai/sdk": "workspace:*",
@@ -170,7 +170,7 @@
},
"packages/enterprise": {
"name": "@opencode-ai/enterprise",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@opencode-ai/ui": "workspace:*",
"@opencode-ai/util": "workspace:*",
@@ -199,10 +199,10 @@
},
"packages/function": {
"name": "@opencode-ai/function",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@octokit/auth-app": "8.0.1",
"@octokit/rest": "22.0.0",
"@octokit/rest": "catalog:",
"hono": "catalog:",
"jose": "6.0.11",
},
@@ -215,7 +215,7 @@
},
"packages/opencode": {
"name": "opencode",
"version": "1.0.160",
"version": "1.0.163",
"bin": {
"opencode": "./bin/opencode",
},
@@ -238,7 +238,7 @@
"@hono/zod-validator": "catalog:",
"@modelcontextprotocol/sdk": "1.15.1",
"@octokit/graphql": "9.0.2",
"@octokit/rest": "22.0.0",
"@octokit/rest": "catalog:",
"@openauthjs/openauth": "catalog:",
"@opencode-ai/plugin": "workspace:*",
"@opencode-ai/script": "workspace:*",
@@ -307,7 +307,7 @@
},
"packages/plugin": {
"name": "@opencode-ai/plugin",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@opencode-ai/sdk": "workspace:*",
"zod": "catalog:",
@@ -327,7 +327,7 @@
},
"packages/sdk/js": {
"name": "@opencode-ai/sdk",
"version": "1.0.160",
"version": "1.0.163",
"devDependencies": {
"@hey-api/openapi-ts": "0.88.1",
"@tsconfig/node22": "catalog:",
@@ -338,7 +338,7 @@
},
"packages/slack": {
"name": "@opencode-ai/slack",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@opencode-ai/sdk": "workspace:*",
"@slack/bolt": "^3.17.1",
@@ -351,7 +351,7 @@
},
"packages/tauri": {
"name": "@opencode-ai/tauri",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@opencode-ai/desktop": "workspace:*",
"@tauri-apps/api": "^2",
@@ -376,7 +376,7 @@
},
"packages/ui": {
"name": "@opencode-ai/ui",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@kobalte/core": "catalog:",
"@opencode-ai/sdk": "workspace:*",
@@ -411,7 +411,7 @@
},
"packages/util": {
"name": "@opencode-ai/util",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"zod": "catalog:",
},
@@ -422,7 +422,7 @@
},
"packages/web": {
"name": "@opencode-ai/web",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@astrojs/cloudflare": "12.6.3",
"@astrojs/markdown-remark": "6.3.1",
@@ -470,6 +470,7 @@
"@cloudflare/workers-types": "4.20251008.0",
"@hono/zod-validator": "0.4.2",
"@kobalte/core": "0.13.11",
"@octokit/rest": "22.0.0",
"@openauthjs/openauth": "0.0.0-20250322224806",
"@pierre/diffs": "1.0.0-beta.3",
"@solidjs/meta": "0.29.4",
+1 -1
View File
@@ -13,7 +13,7 @@
"@actions/core": "1.11.1",
"@actions/github": "6.0.1",
"@octokit/graphql": "9.0.1",
"@octokit/rest": "22.0.0",
"@octokit/rest": "catalog:",
"@opencode-ai/sdk": "workspace:*"
}
}
+9 -8
View File
@@ -240,22 +240,23 @@ download_with_progress() {
download_and_install() {
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
mkdir -p opencodetmp && cd opencodetmp
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
mkdir -p "$tmp_dir"
if [[ "$os" == "windows" ]] || ! download_with_progress "$url" "$filename"; then
# Fallback to standard curl on Windows or if custom progress fails
curl -# -L -o "$filename" "$url"
if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
# Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
curl -# -L -o "$tmp_dir/$filename" "$url"
fi
if [ "$os" = "linux" ]; then
tar -xzf "$filename"
tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"
else
unzip -q "$filename"
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
fi
mv opencode "$INSTALL_DIR"
mv "$tmp_dir/opencode" "$INSTALL_DIR"
chmod 755 "${INSTALL_DIR}/opencode"
cd .. && rm -rf opencodetmp
rm -rf "$tmp_dir"
}
check_version
+1
View File
@@ -21,6 +21,7 @@
],
"catalog": {
"@types/bun": "1.3.4",
"@octokit/rest": "22.0.0",
"@hono/zod-validator": "0.4.2",
"ulid": "3.0.1",
"@kobalte/core": "0.13.11",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-app",
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"scripts": {
"typecheck": "tsgo --noEmit",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/console-core",
"version": "1.0.160",
"version": "1.0.163",
"private": true,
"type": "module",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-function",
"version": "1.0.160",
"version": "1.0.163",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-mail",
"version": "1.0.160",
"version": "1.0.163",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/desktop",
"version": "1.0.160",
"version": "1.0.163",
"description": "",
"type": "module",
"exports": {
@@ -108,20 +108,18 @@ export function DialogConnectProvider(props: { provider: string }) {
async function complete() {
await globalSDK.client.global.dispose()
setTimeout(() => {
showToast({
variant: "success",
icon: "circle-check",
title: `${provider().name} connected`,
description: `${provider().name} models are now available to use.`,
})
dialog.replace(() => <DialogSelectModel provider={props.provider} />)
}, 1000)
dialog.close()
showToast({
variant: "success",
icon: "circle-check",
title: `${provider().name} connected`,
description: `${provider().name} models are now available to use.`,
})
}
function goBack() {
if (methods().length === 1) {
dialog.replace(() => <DialogSelectProvider />)
dialog.show(() => <DialogSelectProvider />)
return
}
if (store.authorization) {
@@ -133,7 +131,7 @@ export function DialogConnectProvider(props: { provider: string }) {
setStore("methodIndex", undefined)
return
}
dialog.replace(() => <DialogSelectProvider />)
dialog.show(() => <DialogSelectProvider />)
}
return (
@@ -352,7 +350,7 @@ export function DialogConnectProvider(props: { provider: string }) {
})
if (result.error) {
// TODO: show error
dialog.clear()
dialog.close()
return
}
await complete()
@@ -27,7 +27,7 @@ export function DialogSelectFile() {
if (path) {
tabs().open("file://" + path)
}
dialog.clear()
dialog.close()
}}
>
{(i) => (
@@ -42,7 +42,7 @@ export const DialogSelectModelUnpaid: Component = () => {
local.model.set(x ? { modelID: x.id, providerID: x.provider.id } : undefined, {
recent: true,
})
dialog.clear()
dialog.close()
}}
>
{(i) => (
@@ -75,7 +75,7 @@ export const DialogSelectModelUnpaid: Component = () => {
}}
onSelect={(x) => {
if (!x) return
dialog.replace(() => <DialogConnectProvider provider={x.id} />)
dialog.show(() => <DialogConnectProvider provider={x.id} />)
}}
>
{(i) => (
@@ -105,7 +105,7 @@ export const DialogSelectModelUnpaid: Component = () => {
class="w-full justify-start px-[11px] py-3.5 gap-4.5 text-14-medium"
icon="dot-grid"
onClick={() => {
dialog.replace(() => <DialogSelectProvider />)
dialog.show(() => <DialogSelectProvider />)
}}
>
View all providers
@@ -28,7 +28,7 @@ export const DialogSelectModel: Component<{ provider?: string }> = (props) => {
class="h-7 -my-1 text-14-medium"
icon="plus-small"
tabIndex={-1}
onClick={() => dialog.replace(() => <DialogSelectProvider />)}
onClick={() => dialog.show(() => <DialogSelectProvider />)}
>
Connect provider
</Button>
@@ -57,7 +57,7 @@ export const DialogSelectModel: Component<{ provider?: string }> = (props) => {
local.model.set(x ? { modelID: x.id, providerID: x.provider.id } : undefined, {
recent: true,
})
dialog.clear()
dialog.close()
}}
>
{(i) => (
@@ -75,7 +75,7 @@ export const DialogSelectModel: Component<{ provider?: string }> = (props) => {
<Button
variant="ghost"
class="ml-3 mt-5 mb-6 text-text-base self-start"
onClick={() => dialog.replace(() => <DialogManageModels />)}
onClick={() => dialog.show(() => <DialogManageModels />)}
>
Manage models
</Button>
@@ -34,7 +34,7 @@ export const DialogSelectProvider: Component = () => {
}}
onSelect={(x) => {
if (!x) return
dialog.replace(() => <DialogConnectProvider provider={x.id} />)
dialog.show(() => <DialogConnectProvider provider={x.id} />)
}}
>
{(i) => (
@@ -864,9 +864,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
as="div"
variant="ghost"
onClick={() =>
dialog.replace(() =>
providers.paid().length > 0 ? <DialogSelectModel /> : <DialogSelectModelUnpaid />,
)
dialog.show(() => (providers.paid().length > 0 ? <DialogSelectModel /> : <DialogSelectModelUnpaid />))
}
>
{local.model.current()?.name ?? "Select model"}
+3 -3
View File
@@ -128,7 +128,7 @@ function DialogCommand(props: { options: CommandOption[] }) {
groupBy={(x) => x.category ?? ""}
onSelect={(option) => {
if (option) {
dialog.clear()
dialog.close()
option.onSelect?.("palette")
}
}}
@@ -174,8 +174,8 @@ export const { use: useCommand, provider: CommandProvider } = createSimpleContex
const suspended = () => suspendCount() > 0
const showPalette = () => {
if (dialog.stack.length === 0) {
dialog.replace(() => <DialogCommand options={options().filter((x) => !x.disabled)} />)
if (!dialog.active) {
dialog.show(() => <DialogCommand options={options().filter((x) => !x.disabled)} />)
}
}
@@ -138,6 +138,7 @@ export const { use: useGlobalSync, provider: GlobalSyncProvider } = createSimple
}
globalSDK.event.listen((e) => {
console.log(e)
const directory = e.name
const event = e.details
@@ -51,6 +51,7 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
// })
globalSDK.event.listen((e) => {
console.log(e)
const directory = e.name
const event = e.details
const base = {
@@ -58,7 +59,6 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
time: Date.now(),
viewed: false,
}
console.log(event)
switch (event.type) {
case "session.idle": {
const sessionID = event.properties.sessionID
+4 -4
View File
@@ -217,7 +217,7 @@ export default function Layout(props: ParentProps) {
])
function connectProvider() {
dialog.replace(() => <DialogSelectProvider />)
dialog.show(() => <DialogSelectProvider />)
}
function navigateToProject(directory: string | undefined) {
@@ -710,7 +710,7 @@ export default function Layout(props: ParentProps) {
<Match when={true}>
<Tooltip placement="right" value="Connect provider" inactive={layout.sidebar.opened()}>
<Button
class="flex w-full text-left justify-start text-12-medium text-text-base stroke-[1.5px] rounded-lg px-2"
class="flex w-full text-left justify-start text-text-base stroke-[1.5px] rounded-lg px-2"
variant="ghost"
size="large"
icon="plus"
@@ -724,7 +724,7 @@ export default function Layout(props: ParentProps) {
<Show when={platform.openDirectoryPickerDialog}>
<Tooltip placement="right" value="Open project" inactive={layout.sidebar.opened()}>
<Button
class="flex w-full text-left justify-start text-12-medium text-text-base stroke-[1.5px] rounded-lg px-2"
class="flex w-full text-left justify-start text-text-base stroke-[1.5px] rounded-lg px-2"
variant="ghost"
size="large"
icon="folder-add-left"
@@ -750,7 +750,7 @@ export default function Layout(props: ParentProps) {
as={"a"}
href="https://opencode.ai/desktop-feedback"
target="_blank"
class="flex w-full text-left justify-start text-12-medium text-text-base stroke-[1.5px] rounded-lg px-2"
class="flex w-full text-left justify-start text-text-base stroke-[1.5px] rounded-lg px-2"
variant="ghost"
size="large"
icon="bubble-5"
+4 -4
View File
@@ -176,7 +176,7 @@ export default function Page() {
category: "File",
keybind: "mod+p",
slash: "open",
onSelect: () => dialog.replace(() => <DialogSelectFile />),
onSelect: () => dialog.show(() => <DialogSelectFile />),
},
// {
// id: "theme.toggle",
@@ -245,7 +245,7 @@ export default function Page() {
category: "Model",
keybind: "mod+'",
slash: "model",
onSelect: () => dialog.replace(() => <DialogSelectModel />),
onSelect: () => dialog.show(() => <DialogSelectModel />),
},
{
id: "agent.cycle",
@@ -320,7 +320,7 @@ export default function Page() {
const handleKeyDown = (event: KeyboardEvent) => {
if ((document.activeElement as HTMLElement)?.dataset?.component === "terminal") return
if (dialog.stack.length > 0) return
if (dialog.active) return
if (event.key === "PageUp" || event.key === "PageDown") {
const scrollContainer = document.querySelector('[data-slot="session-turn-content"]') as HTMLElement
@@ -613,7 +613,7 @@ export default function Page() {
icon="plus-small"
variant="ghost"
iconSize="large"
onClick={() => dialog.replace(() => <DialogSelectFile />)}
onClick={() => dialog.show(() => <DialogSelectFile />)}
/>
</Tooltip>
</div>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/enterprise",
"version": "1.0.160",
"version": "1.0.163",
"private": true,
"type": "module",
"scripts": {
+6 -6
View File
@@ -1,7 +1,7 @@
id = "opencode"
name = "OpenCode"
description = "The open source coding agent."
version = "1.0.160"
version = "1.0.163"
schema_version = 1
authors = ["Anomaly"]
repository = "https://github.com/sst/opencode"
@@ -11,26 +11,26 @@ name = "OpenCode"
icon = "./icons/opencode.svg"
[agent_servers.opencode.targets.darwin-aarch64]
archive = "https://github.com/sst/opencode/releases/download/v1.0.160/opencode-darwin-arm64.zip"
archive = "https://github.com/sst/opencode/releases/download/v1.0.163/opencode-darwin-arm64.zip"
cmd = "./opencode"
args = ["acp"]
[agent_servers.opencode.targets.darwin-x86_64]
archive = "https://github.com/sst/opencode/releases/download/v1.0.160/opencode-darwin-x64.zip"
archive = "https://github.com/sst/opencode/releases/download/v1.0.163/opencode-darwin-x64.zip"
cmd = "./opencode"
args = ["acp"]
[agent_servers.opencode.targets.linux-aarch64]
archive = "https://github.com/sst/opencode/releases/download/v1.0.160/opencode-linux-arm64.tar.gz"
archive = "https://github.com/sst/opencode/releases/download/v1.0.163/opencode-linux-arm64.tar.gz"
cmd = "./opencode"
args = ["acp"]
[agent_servers.opencode.targets.linux-x86_64]
archive = "https://github.com/sst/opencode/releases/download/v1.0.160/opencode-linux-x64.tar.gz"
archive = "https://github.com/sst/opencode/releases/download/v1.0.163/opencode-linux-x64.tar.gz"
cmd = "./opencode"
args = ["acp"]
[agent_servers.opencode.targets.windows-x86_64]
archive = "https://github.com/sst/opencode/releases/download/v1.0.160/opencode-windows-x64.zip"
archive = "https://github.com/sst/opencode/releases/download/v1.0.163/opencode-windows-x64.zip"
cmd = "./opencode.exe"
args = ["acp"]
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/function",
"version": "1.0.160",
"version": "1.0.163",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
@@ -12,7 +12,7 @@
},
"dependencies": {
"@octokit/auth-app": "8.0.1",
"@octokit/rest": "22.0.0",
"@octokit/rest": "catalog:",
"hono": "catalog:",
"jose": "6.0.11"
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.0.160",
"version": "1.0.163",
"name": "opencode",
"type": "module",
"private": true,
@@ -64,7 +64,7 @@
"@hono/zod-validator": "catalog:",
"@modelcontextprotocol/sdk": "1.15.1",
"@octokit/graphql": "9.0.2",
"@octokit/rest": "22.0.0",
"@octokit/rest": "catalog:",
"@openauthjs/openauth": "catalog:",
"@opencode-ai/plugin": "workspace:*",
"@opencode-ai/script": "workspace:*",
+3 -1
View File
@@ -88,7 +88,9 @@ export const RunCommand = cmd({
})
},
handler: async (args) => {
let message = [...args.message, ...(args["--"] || [])].join(" ")
let message = [...args.message, ...(args["--"] || [])]
.map((arg) => (arg.includes(" ") ? `"${arg.replace(/"/g, '\\"')}"` : arg))
.join(" ")
const fileParts: any[] = []
if (args.file) {
@@ -64,6 +64,7 @@ import { Editor } from "../../util/editor"
import stripAnsi from "strip-ansi"
import { Footer } from "./footer.tsx"
import { usePromptRef } from "../../context/prompt"
import { Filesystem } from "@/util/filesystem"
addDefaultParsers(parsers.parsers)
@@ -1414,7 +1415,10 @@ ToolRegistry.register<typeof WriteTool>({
return props.input.content
})
const diagnostics = createMemo(() => props.metadata.diagnostics?.[props.input.filePath ?? ""] ?? [])
const diagnostics = createMemo(() => {
const filePath = Filesystem.normalizePath(props.input.filePath ?? "")
return props.metadata.diagnostics?.[filePath] ?? []
})
return (
<>
@@ -1587,7 +1591,8 @@ ToolRegistry.register<typeof EditTool>({
const diffContent = createMemo(() => props.metadata.diff ?? props.permission["diff"])
const diagnostics = createMemo(() => {
const arr = props.metadata.diagnostics?.[props.input.filePath ?? ""] ?? []
const filePath = Filesystem.normalizePath(props.input.filePath ?? "")
const arr = props.metadata.diagnostics?.[filePath] ?? []
return arr.filter((x) => x.severity === 1).slice(0, 3)
})
@@ -307,10 +307,9 @@ function Option(props: {
fg={props.active ? fg : props.current ? theme.primary : theme.text}
attributes={props.active ? TextAttributes.BOLD : undefined}
overflow="hidden"
wrapMode="word"
paddingLeft={3}
>
{Locale.truncate(props.title, 62)}
{Locale.truncate(props.title, 61)}
<Show when={props.description}>
<span style={{ fg: props.active ? fg : theme.textMuted }}> {props.description}</span>
</Show>
+23 -11
View File
@@ -11,6 +11,9 @@ import type { LSPServer } from "./server"
import { NamedError } from "@opencode-ai/util/error"
import { withTimeout } from "../util/timeout"
import { Instance } from "../project/instance"
import { Filesystem } from "../util/filesystem"
const DIAGNOSTICS_DEBOUNCE_MS = 150
export namespace LSPClient {
const log = Log.create({ service: "lsp.client" })
@@ -47,14 +50,15 @@ export namespace LSPClient {
const diagnostics = new Map<string, Diagnostic[]>()
connection.onNotification("textDocument/publishDiagnostics", (params) => {
const path = fileURLToPath(params.uri)
const filePath = Filesystem.normalizePath(fileURLToPath(params.uri))
l.info("textDocument/publishDiagnostics", {
path,
path: filePath,
count: params.diagnostics.length,
})
const exists = diagnostics.has(path)
diagnostics.set(path, params.diagnostics)
const exists = diagnostics.has(filePath)
diagnostics.set(filePath, params.diagnostics)
if (!exists && input.serverID === "typescript") return
Bus.publish(Event.Diagnostics, { path, serverID: input.serverID })
Bus.publish(Event.Diagnostics, { path: filePath, serverID: input.serverID })
})
connection.onRequest("window/workDoneProgress/create", (params) => {
l.info("window/workDoneProgress/create", params)
@@ -181,16 +185,23 @@ export namespace LSPClient {
return diagnostics
},
async waitForDiagnostics(input: { path: string }) {
input.path = path.isAbsolute(input.path) ? input.path : path.resolve(Instance.directory, input.path)
log.info("waiting for diagnostics", input)
const normalizedPath = Filesystem.normalizePath(
path.isAbsolute(input.path) ? input.path : path.resolve(Instance.directory, input.path),
)
log.info("waiting for diagnostics", { path: normalizedPath })
let unsub: () => void
let debounceTimer: ReturnType<typeof setTimeout> | undefined
return await withTimeout(
new Promise<void>((resolve) => {
unsub = Bus.subscribe(Event.Diagnostics, (event) => {
if (event.properties.path === input.path && event.properties.serverID === result.serverID) {
log.info("got diagnostics", input)
unsub?.()
resolve()
if (event.properties.path === normalizedPath && event.properties.serverID === result.serverID) {
// Debounce to allow LSP to send follow-up diagnostics (e.g., semantic after syntax)
if (debounceTimer) clearTimeout(debounceTimer)
debounceTimer = setTimeout(() => {
log.info("got diagnostics", { path: normalizedPath })
unsub?.()
resolve()
}, DIAGNOSTICS_DEBOUNCE_MS)
}
})
}),
@@ -198,6 +209,7 @@ export namespace LSPClient {
)
.catch(() => {})
.finally(() => {
if (debounceTimer) clearTimeout(debounceTimer)
unsub?.()
})
},
+56 -12
View File
@@ -9,6 +9,7 @@ import fs from "fs/promises"
import { Filesystem } from "../util/filesystem"
import { Instance } from "../project/instance"
import { Flag } from "../flag/flag"
import { Archive } from "../util/archive"
export namespace LSPServer {
const log = Log.create({ service: "lsp.server" })
@@ -176,7 +177,13 @@ export namespace LSPServer {
const zipPath = path.join(Global.Path.bin, "vscode-eslint.zip")
await Bun.file(zipPath).write(response)
await $`unzip -o -q ${zipPath}`.quiet().cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(zipPath, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract vscode-eslint archive", { error })
return false
})
if (!ok) return
await fs.rm(zipPath, { force: true })
const extractedPath = path.join(Global.Path.bin, "vscode-eslint-main")
@@ -438,7 +445,13 @@ export namespace LSPServer {
const zipPath = path.join(Global.Path.bin, "elixir-ls.zip")
await Bun.file(zipPath).write(response)
await $`unzip -o -q ${zipPath}`.quiet().cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(zipPath, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract elixir-ls archive", { error })
return false
})
if (!ok) return
await fs.rm(zipPath, {
force: true,
@@ -541,7 +554,13 @@ export namespace LSPServer {
await Bun.file(tempPath).write(downloadResponse)
if (ext === "zip") {
await $`unzip -o -q ${tempPath}`.quiet().cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(tempPath, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract zls archive", { error })
return false
})
if (!ok) return
} else {
await $`tar -xf ${tempPath}`.cwd(Global.Path.bin).nothrow()
}
@@ -840,7 +859,13 @@ export namespace LSPServer {
}
if (zip) {
await $`unzip -o -q ${archive}`.quiet().cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(archive, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract clangd archive", { error })
return false
})
if (!ok) return
}
if (tar) {
await $`tar -xf ${archive}`.cwd(Global.Path.bin).nothrow()
@@ -1188,14 +1213,21 @@ export namespace LSPServer {
await fs.mkdir(installDir, { recursive: true })
if (ext === "zip") {
const ok = await $`unzip -o -q ${tempPath} -d ${installDir}`.quiet().catch((error) => {
log.error("Failed to extract lua-language-server archive", { error })
})
const ok = await Archive.extractZip(tempPath, installDir)
.then(() => true)
.catch((error) => {
log.error("Failed to extract lua-language-server archive", { error })
return false
})
if (!ok) return
} else {
const ok = await $`tar -xzf ${tempPath} -C ${installDir}`.quiet().catch((error) => {
log.error("Failed to extract lua-language-server archive", { error })
})
const ok = await $`tar -xzf ${tempPath} -C ${installDir}`
.quiet()
.then(() => true)
.catch((error) => {
log.error("Failed to extract lua-language-server archive", { error })
return false
})
if (!ok) return
}
@@ -1396,7 +1428,13 @@ export namespace LSPServer {
const tempPath = path.join(Global.Path.bin, assetName)
await Bun.file(tempPath).write(downloadResponse)
await $`unzip -o -q ${tempPath}`.cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(tempPath, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract terraform-ls archive", { error })
return false
})
if (!ok) return
await fs.rm(tempPath, { force: true })
bin = path.join(Global.Path.bin, "terraform-ls" + (platform === "win32" ? ".exe" : ""))
@@ -1481,7 +1519,13 @@ export namespace LSPServer {
await Bun.file(tempPath).write(downloadResponse)
if (ext === "zip") {
await $`unzip -o -q ${tempPath}`.cwd(Global.Path.bin).nothrow()
const ok = await Archive.extractZip(tempPath, Global.Path.bin)
.then(() => true)
.catch((error) => {
log.error("Failed to extract texlab archive", { error })
return false
})
if (!ok) return
}
if (ext === "tar.gz") {
await $`tar -xzf ${tempPath}`.cwd(Global.Path.bin).nothrow()
+4 -2
View File
@@ -127,8 +127,10 @@ export namespace Server {
return streamSSE(c, async (stream) => {
stream.writeSSE({
data: JSON.stringify({
type: "server.connected",
properties: {},
payload: {
type: "server.connected",
properties: {},
},
}),
})
async function handler(event: any) {
+7
View File
@@ -60,11 +60,18 @@ export namespace LLM {
.join("\n"),
)
const header = system[0]
const original = clone(system)
await Plugin.trigger("experimental.chat.system.transform", {}, { system })
if (system.length === 0) {
system.push(...original)
}
// rejoin to maintain 2-part structure for caching if header unchanged
if (system.length > 2 && system[0] === header) {
const rest = system.slice(1)
system.length = 0
system.push(header, rest.join("\n"))
}
const params = await Plugin.trigger(
"chat.params",
+8 -10
View File
@@ -140,16 +140,14 @@ export const EditTool = Tool.define("edit", {
let output = ""
await LSP.touchFile(filePath, true)
const diagnostics = await LSP.diagnostics()
for (const [file, issues] of Object.entries(diagnostics)) {
if (issues.length === 0) continue
if (file === filePath) {
const errors = issues.filter((item) => item.severity === 1)
const limited = errors.slice(0, MAX_DIAGNOSTICS_PER_FILE)
const suffix =
errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : ""
output += `\nThis file has errors, please fix\n<file_diagnostics>\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</file_diagnostics>\n`
continue
}
const normalizedFilePath = Filesystem.normalizePath(filePath)
const issues = diagnostics[normalizedFilePath] ?? []
if (issues.length > 0) {
const errors = issues.filter((item) => item.severity === 1)
const limited = errors.slice(0, MAX_DIAGNOSTICS_PER_FILE)
const suffix =
errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : ""
output += `\nThis file has errors, please fix\n<file_diagnostics>\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</file_diagnostics>\n`
}
const filediff: Snapshot.FileDiff = {
+2 -1
View File
@@ -80,6 +80,7 @@ export const WriteTool = Tool.define("write", {
let output = ""
await LSP.touchFile(filepath, true)
const diagnostics = await LSP.diagnostics()
const normalizedFilepath = Filesystem.normalizePath(filepath)
let projectDiagnosticsCount = 0
for (const [file, issues] of Object.entries(diagnostics)) {
if (issues.length === 0) continue
@@ -87,7 +88,7 @@ export const WriteTool = Tool.define("write", {
const limited = sorted.slice(0, MAX_DIAGNOSTICS_PER_FILE)
const suffix =
issues.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${issues.length - MAX_DIAGNOSTICS_PER_FILE} more` : ""
if (file === filepath) {
if (file === normalizedFilepath) {
output += `\nThis file has errors, please fix\n<file_diagnostics>\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</file_diagnostics>\n`
continue
}
+16
View File
@@ -0,0 +1,16 @@
import { $ } from "bun"
import path from "path"
export namespace Archive {
export async function extractZip(zipPath: string, destDir: string) {
if (process.platform === "win32") {
const winZipPath = path.resolve(zipPath)
const winDestDir = path.resolve(destDir)
// $global:ProgressPreference suppresses PowerShell's blue progress bar popup
const cmd = `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${winZipPath}' -DestinationPath '${winDestDir}' -Force`
await $`powershell -NoProfile -NonInteractive -Command ${cmd}`.quiet()
} else {
await $`unzip -o -q ${zipPath} -d ${destDir}`.quiet()
}
}
}
+14
View File
@@ -1,7 +1,21 @@
import { realpathSync } from "fs"
import { exists } from "fs/promises"
import { dirname, join, relative } from "path"
export namespace Filesystem {
/**
* On Windows, normalize a path to its canonical casing using the filesystem.
* This is needed because Windows paths are case-insensitive but LSP servers
* may return paths with different casing than what we send them.
*/
export function normalizePath(p: string): string {
if (process.platform !== "win32") return p
try {
return realpathSync.native(p)
} catch {
return p
}
}
export function overlaps(a: string, b: string) {
const relA = relative(a, b)
const relB = relative(b, a)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/plugin",
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"scripts": {
"typecheck": "tsgo --noEmit",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"scripts": {
"typecheck": "tsgo --noEmit",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/slack",
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"scripts": {
"dev": "bun run src/index.ts",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/tauri",
"private": true,
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"scripts": {
"typecheck": "tsgo -b",
-1
View File
@@ -1,4 +1,3 @@
import * as fs from "node:fs/promises"
import { $ } from "bun"
import { copyBinaryToSidecarFolder, getCurrentSidecar } from "./utils"
+25 -77
View File
@@ -1,13 +1,11 @@
use std::{
net::{SocketAddr, TcpListener},
process::Command,
sync::{Arc, Mutex},
time::{Duration, Instant},
};
#[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
use tauri::{AppHandle, LogicalSize, Manager, Monitor, RunEvent, WebviewUrl, WebviewWindow};
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogResult};
use tauri::{AppHandle, LogicalSize, Manager, RunEvent, WebviewUrl, WebviewWindow};
use tauri_plugin_shell::process::{CommandChild, CommandEvent};
use tauri_plugin_shell::ShellExt;
use tokio::net::TcpSocket;
@@ -15,6 +13,28 @@ use tokio::net::TcpSocket;
#[derive(Clone)]
struct ServerState(Arc<Mutex<Option<CommandChild>>>);
#[tauri::command]
fn kill_sidecar(app: AppHandle) {
let Some(server_state) = app.try_state::<ServerState>() else {
println!("Server not running");
return;
};
let Some(server_state) = server_state
.0
.lock()
.expect("Failed to acquire mutex lock")
.take()
else {
println!("Server state missing");
return;
};
let _ = server_state.kill();
println!("Killed server");
}
fn get_sidecar_port() -> u16 {
option_env!("OPENCODE_PORT")
.map(|s| s.to_string())
@@ -29,40 +49,6 @@ fn get_sidecar_port() -> u16 {
})
}
fn find_and_kill_process_on_port(port: u16) -> Result<(), Box<dyn std::error::Error>> {
// Find all listeners on the specified port
let listeners = listeners::get_processes_by_port(port)?;
if listeners.is_empty() {
println!("No processes found listening on port {}", port);
return Ok(());
}
for listener in listeners {
let pid = listener.pid;
println!("Found process {} listening on port {}", pid, port);
// Kill the process using platform-appropriate command
#[cfg(target_os = "windows")]
{
Command::new("taskkill")
.args(["/F", "/PID", &pid.to_string()])
.output()?;
}
#[cfg(not(target_os = "windows"))]
{
Command::new("kill")
.args(["-9", &pid.to_string()])
.output()?;
}
println!("Killed process {}", pid);
}
Ok(())
}
fn spawn_sidecar(app: &AppHandle, port: u16) -> CommandChild {
let (mut rx, child) = app
.shell()
@@ -116,6 +102,7 @@ pub fn run() {
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![kill_sidecar])
.setup(move |app| {
let app = app.handle().clone();
@@ -124,28 +111,6 @@ pub fn run() {
let should_spawn_sidecar = !is_server_running(port).await;
// if server_running {
// let res = app
// .dialog()
// .message(
// "OpenCode Server is already running, would you like to restart it?",
// )
// .buttons(MessageDialogButtons::YesNo)
// .blocking_show_with_result();
// match res {
// MessageDialogResult::Yes => {
// if let Err(e) = find_and_kill_process_on_port(port) {
// eprintln!("Failed to kill process on port {}: {}", port, e);
// }
// true
// }
// _ => false,
// }
// } else {
// true
// };
let child = if should_spawn_sidecar {
let child = spawn_sidecar(&app, port);
@@ -218,24 +183,7 @@ pub fn run() {
if let RunEvent::Exit = event {
println!("Received Exit");
let Some(server_state) = app.try_state::<ServerState>() else {
println!("Server not running");
return;
};
let Some(server_state) = server_state
.0
.lock()
.expect("Failed to acquire mutex lock")
.take()
else {
println!("Server state missing");
return;
};
let _ = server_state.kill();
println!("Killed server");
kill_sidecar(app.clone());
}
});
}
+6 -2
View File
@@ -1,12 +1,14 @@
// @refresh reload
import { render } from "solid-js/web"
import { App, PlatformProvider, Platform } from "@opencode-ai/desktop"
import { runUpdater } from "./updater"
import { onMount } from "solid-js"
import { open, save } from "@tauri-apps/plugin-dialog"
import { open as shellOpen } from "@tauri-apps/plugin-shell"
import { type as ostype } from "@tauri-apps/plugin-os"
import { runUpdater, UPDATER_ENABLED } from "./updater"
import { createMenu } from "./menu"
const root = document.getElementById("root")
if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
throw new Error(
@@ -48,9 +50,11 @@ const platform: Platform = {
},
}
createMenu()
render(() => {
onMount(() => {
if (window.__OPENCODE__?.updaterEnabled) runUpdater()
if (UPDATER_ENABLED) runUpdater()
})
return (
+94
View File
@@ -0,0 +1,94 @@
import { Menu, MenuItem, PredefinedMenuItem, Submenu } from "@tauri-apps/api/menu"
import { type as ostype } from "@tauri-apps/plugin-os"
import { runUpdater, UPDATER_ENABLED } from "./updater"
export async function createMenu() {
if (ostype() !== "macos") return
const menu = await Menu.new({
items: [
await Submenu.new({
text: "OpenCode",
items: [
await PredefinedMenuItem.new({
item: { About: null },
}),
await MenuItem.new({
enabled: UPDATER_ENABLED,
action: () => runUpdater(),
text: "Check For Updates...",
}),
await PredefinedMenuItem.new({
item: "Separator",
}),
await PredefinedMenuItem.new({
item: "Hide",
}),
await PredefinedMenuItem.new({
item: "HideOthers",
}),
await PredefinedMenuItem.new({
item: "ShowAll",
}),
await PredefinedMenuItem.new({
item: "Separator",
}),
await PredefinedMenuItem.new({
item: "Quit",
}),
].filter(Boolean),
}),
// await Submenu.new({
// text: "File",
// items: [
// await MenuItem.new({
// enabled: false,
// text: "Open Project...",
// }),
// await PredefinedMenuItem.new({
// item: "Separator"
// }),
// await MenuItem.new({
// enabled: false,
// text: "New Session",
// }),
// await PredefinedMenuItem.new({
// item: "Separator"
// }),
// await MenuItem.new({
// enabled: false,
// text: "Close Project",
// })
// ]
// }),
await Submenu.new({
text: "Edit",
items: [
await PredefinedMenuItem.new({
item: "Undo",
}),
await PredefinedMenuItem.new({
item: "Redo",
}),
await PredefinedMenuItem.new({
item: "Separator",
}),
await PredefinedMenuItem.new({
item: "Cut",
}),
await PredefinedMenuItem.new({
item: "Copy",
}),
await PredefinedMenuItem.new({
item: "Paste",
}),
await PredefinedMenuItem.new({
item: "SelectAll",
}),
],
}),
],
})
menu.setAsAppMenu()
}
+4
View File
@@ -1,6 +1,9 @@
import { check, DownloadEvent } from "@tauri-apps/plugin-updater"
import { relaunch } from "@tauri-apps/plugin-process"
import { ask, message } from "@tauri-apps/plugin-dialog"
import { invoke } from "@tauri-apps/api/core"
export const UPDATER_ENABLED = window.__OPENCODE__?.updaterEnabled ?? false
export async function runUpdater(onDownloadEvent?: (progress: DownloadEvent) => void) {
let update
@@ -32,6 +35,7 @@ export async function runUpdater(onDownloadEvent?: (progress: DownloadEvent) =>
return false
}
await invoke("kill_sidecar")
await relaunch()
return true
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/ui",
"version": "1.0.160",
"version": "1.0.163",
"type": "module",
"exports": {
"./*": "./src/components/*.tsx",
+62 -15
View File
@@ -5,30 +5,69 @@
color: var(--text-base);
text-wrap: pretty;
/* text-12-regular */
font-family: var(--font-family-sans);
font-size: var(--font-size-small);
font-style: normal;
font-weight: var(--font-weight-regular);
line-height: var(--line-height-large); /* 166.667% */
letter-spacing: var(--letter-spacing-normal);
h1,
h2,
h3 {
margin-top: 16px;
margin-bottom: 8px;
strong {
font-weight: var(--font-weight-medium);
}
/* text-12-regular */
font-family: var(--font-family-sans);
font-size: var(--font-size-base);
font-style: normal;
font-weight: var(--font-weight-regular);
line-height: var(--line-height-large);
letter-spacing: var(--letter-spacing-normal);
h1 {
margin-top: 40px;
font-weight: var(--font-weight-medium);
color: var(--text-strong);
strong {
font-weight: var(--font-weight-medium);
}
}
h2 {
margin-top: 32px;
font-weight: var(--font-weight-medium);
color: var(--text-strong);
strong {
font-weight: var(--font-weight-medium);
}
}
h3 {
margin-top: 24px;
font-weight: var(--font-weight-medium);
color: var(--text-strong);
strong {
font-weight: var(--font-weight-medium);
}
}
h1 {
font-size: 15px;
}
p {
margin-top: 16px;
margin-bottom: 8px;
}
ul,
ol {
margin-top: 16px;
margin-bottom: 16px;
li {
margin-bottom: 12px;
line-height: var(--line-height-large);
}
li:last-child {
margin-bottom: 0;
}
}
hr {
@@ -37,6 +76,14 @@
border-color: var(--border-weaker-base);
}
.shiki {
font-size: 13px;
background: var(--surface-raised-base) !important; /* temporary fix to test style */
padding: 8px 12px;
border-radius: 4px;
border: 0.5px solid var(--border-weak-base);
}
pre {
margin-top: 2rem;
margin-bottom: 2rem;
@@ -51,7 +98,7 @@
:not(pre) > code {
font-family: var(--font-family-mono);
font-feature-settings: var(--font-family-mono--font-feature-settings);
font-size: 0.9em;
font-size: 13px;
/* background-color: var(--surface-base-strong); */
/* padding: 0.15em 0.35em; */
/* border-radius: var(--radius-sm); */
+8 -3
View File
@@ -8,7 +8,7 @@
[data-component="user-message"] {
font-family: var(--font-family-sans);
font-size: var(--font-size-small);
font-size: var(--font-size-base);
font-style: normal;
font-weight: var(--font-weight-regular);
line-height: var(--line-height-large);
@@ -77,6 +77,10 @@
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
background: var(--surface-inset-base);
padding: 2px 6px;
border-radius: 4px;
border: 0.5px solid var(--border-weak-base);
}
.text-text-strong {
@@ -93,6 +97,7 @@
[data-component="markdown"] {
margin-top: 32px;
font-size: var(--font-size-base);
}
}
@@ -124,7 +129,7 @@
[data-slot="message-part-tool-error-title"] {
font-family: var(--font-family-sans);
font-size: var(--font-size-small);
font-size: var(--font-size-base);
font-style: normal;
font-weight: var(--font-weight-medium);
line-height: var(--line-height-large);
@@ -188,7 +193,7 @@
[data-slot="message-part-title"] {
flex-shrink: 0;
font-family: var(--font-family-sans);
font-size: var(--font-size-small);
font-size: var(--font-size-base);
font-style: normal;
font-weight: var(--font-weight-medium);
line-height: var(--line-height-large);
@@ -28,7 +28,7 @@
[data-slot="session-review-title"] {
font-family: var(--font-family-sans);
font-size: var(--font-size-base);
font-size: var(--font-size-large);
font-weight: var(--font-weight-medium);
line-height: var(--line-height-large);
color: var(--text-strong);
+9 -4
View File
@@ -64,7 +64,7 @@
[data-slot="session-turn-message-title"] {
width: 100%;
font-size: 14px; /* text-14-medium */
font-size: var(--font-size-large);
font-weight: 500;
color: var(--text-strong);
overflow: hidden;
@@ -104,17 +104,22 @@
align-items: flex-start;
gap: 4px;
align-self: stretch;
p {
font-size: var(--font-size-base);
line-height: var(--line-height-x-large);
}
}
[data-slot="session-turn-summary-title"] {
font-size: 12px; /* text-12-medium */
font-size: 13px; /* text-12-medium */
font-weight: 500;
color: var(--text-weak);
}
[data-slot="session-turn-markdown"] {
&[data-diffs="true"] {
font-size: 14px; /* text-14-regular */
font-size: 15px;
}
&[data-fade="true"] > * {
@@ -319,7 +324,7 @@
}
[data-slot="session-turn-details-text"] {
font-size: 12px; /* text-12-medium */
font-size: 13px; /* text-12-medium */
font-weight: 500;
}
+50 -72
View File
@@ -1,9 +1,7 @@
import {
createContext,
createEffect,
createMemo,
createSignal,
For,
getOwner,
Owner,
ParentProps,
@@ -13,74 +11,59 @@ import {
type JSX,
} from "solid-js"
import { Dialog as Kobalte } from "@kobalte/core/dialog"
import { iife } from "@opencode-ai/util/iife"
type DialogElement = () => JSX.Element
const Context = createContext<ReturnType<typeof init>>()
function init() {
const [store, setStore] = createSignal<
{
id: string
element: DialogElement
onClose?: () => void
owner: Owner
}[]
>([])
const [active, setActive] = createSignal<
| {
id: string
element: DialogElement
onClose?: () => void
owner: Owner
}
| undefined
>()
const result = {
get stack() {
return store()
get active() {
return active()
},
pop() {
const current = store().at(-1)
if (!current) return
current?.onClose?.()
setStore((stack) => {
stack.pop()
return [...stack]
close() {
active()?.onClose?.()
setActive(undefined)
},
show(element: DialogElement, owner: Owner, onClose?: () => void) {
active()?.onClose?.()
const id = Math.random().toString(36).slice(2)
setActive({
id,
element: () =>
runWithOwner(owner, () => (
<Show when={active()?.id === id}>
<Kobalte
modal
open={true}
onOpenChange={(open) => {
if (!open) {
console.log("closing")
result.close()
}
}}
>
<Kobalte.Portal>
<Kobalte.Overlay data-component="dialog-overlay" />
{element()}
</Kobalte.Portal>
</Kobalte>
</Show>
)),
onClose,
owner,
})
},
replace(element: DialogElement, owner: Owner, onClose?: () => void) {
for (const item of store()) {
item.onClose?.()
}
const id = Math.random().toString(36)
setStore([
{
id,
element: () =>
runWithOwner(owner, () => (
<Show when={result.stack.at(-1)?.id === id}>
<Kobalte
modal
defaultOpen
onOpenChange={(open) => {
if (!open) {
onClose?.()
result.pop()
}
}}
>
<Kobalte.Portal>
<Kobalte.Overlay data-component="dialog-overlay" />
{element()}
</Kobalte.Portal>
</Kobalte>
</Show>
)),
onClose,
owner,
},
])
},
clear() {
for (const item of store()) {
item.onClose?.()
}
setStore([])
},
}
return result
@@ -89,14 +72,12 @@ function init() {
export function DialogProvider(props: ParentProps) {
const ctx = init()
createEffect(() => {
console.log("store", ctx.stack.length)
console.log("active", ctx.active)
})
return (
<Context.Provider value={ctx}>
{props.children}
<div data-component="dialog-stack">
<For each={ctx.stack}>{(item) => <>{item.element()}</>}</For>
</div>
<div data-component="dialog-stack">{ctx.active?.element?.()}</div>
</Context.Provider>
)
}
@@ -111,17 +92,14 @@ export function useDialog() {
throw new Error("useDialog must be used within a DialogProvider")
}
return {
get stack() {
return ctx.stack
get active() {
return ctx.active
},
replace(element: DialogElement, onClose?: () => void) {
ctx.replace(element, owner, onClose)
show(element: DialogElement, onClose?: () => void) {
ctx.show(element, owner, onClose)
},
pop() {
ctx.pop()
},
clear() {
ctx.clear()
close() {
ctx.close()
},
}
}
+3 -3
View File
@@ -10,9 +10,9 @@
--font-size-x-large: 20px;
--font-weight-regular: 400;
--font-weight-medium: 500;
--line-height-large: 20px;
--line-height-x-large: 24px;
--line-height-2x-large: 30px;
--line-height-large: 150%;
--line-height-x-large: 180%;
--line-height-2x-large: 200%;
--letter-spacing-normal: 0;
--letter-spacing-tight: -0.1599999964237213;
--letter-spacing-tightest: -0.3199999928474426;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/util",
"version": "1.0.160",
"version": "1.0.163",
"private": true,
"type": "module",
"exports": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/web",
"type": "module",
"version": "1.0.160",
"version": "1.0.163",
"scripts": {
"dev": "astro dev",
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
+20 -1
View File
@@ -161,13 +161,32 @@ opencode github run
List all available models from configured providers.
```bash
opencode models
opencode models [provider]
```
This command displays all models available across your configured providers in the format `provider/model`.
This is useful for figuring out the exact model name to use in [your config](/docs/config/).
You can optionally pass a provider ID to filter models by that provider.
```bash
opencode models anthropic
```
#### Flags
| Flag | Description |
| ----------- | ------------------------------------------------------------ |
| `--refresh` | Refresh the models cache from models.dev |
| `--verbose` | Use more verbose model output (includes metadata like costs) |
Use the `--refresh` flag to update the cached model list. This is useful when new models have been added to a provider and you want to see them in OpenCode.
```bash
opencode models --refresh
```
---
### run
+1 -1
View File
@@ -155,7 +155,7 @@ if (!Script.preview) {
await $`git cherry-pick HEAD..origin/dev`.nothrow()
await $`git push origin HEAD --tags --no-verify --force-with-lease`
await new Promise((resolve) => setTimeout(resolve, 5_000))
await $`gh release create v${Script.version} --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz`
await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz`
const release = await $`gh release view v${Script.version} --json id,tagName`.json()
if (process.env.GITHUB_OUTPUT) {
await Bun.write(process.env.GITHUB_OUTPUT, `releaseId=${release.id}\ntagName=${release.tagName}\n`)
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "opencode",
"displayName": "opencode",
"description": "opencode for VS Code",
"version": "1.0.160",
"version": "1.0.163",
"publisher": "sst-dev",
"repository": {
"type": "git",