Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit c6e830c

Browse files
committed
Merge branch 'dev' of https://github.com/sst/opencode into dev
2 parents 7088bfa + fc78c28 commit c6e830c

288 files changed

Lines changed: 10452 additions & 13172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/auto-label-tui.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
const title = issue.title;
2121
const description = issue.body || '';
2222
23-
// Check for web/desktop keywords
24-
const webPattern = /\b(web|desktop)\b/i;
23+
// Check for "opencode web" keyword
24+
const webPattern = /(opencode web)/i;
2525
const isWebRelated = webPattern.test(title) || webPattern.test(description);
2626
2727
// Check for version patterns like v1.0.x or 1.0.x

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- major
1313
- minor
1414
- patch
15+
version:
16+
description: "Override version (optional)"
17+
required: false
18+
type: string
1519

1620
concurrency: ${{ github.workflow }}-${{ github.ref }}
1721

@@ -62,6 +66,7 @@ jobs:
6266
./script/publish.ts
6367
env:
6468
OPENCODE_BUMP: ${{ inputs.bump }}
69+
OPENCODE_VERSION: ${{ inputs.version }}
6570
OPENCODE_CHANNEL: latest
6671
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
6772
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "sync-zed-extension"
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
zed:
10+
name: Release Zed Extension
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: ./.github/actions/setup-bun
18+
19+
- name: Get version tag
20+
id: get_tag
21+
run: |
22+
if [ "${{ github.event_name }}" = "release" ]; then
23+
TAG="${{ github.event.release.tag_name }}"
24+
else
25+
TAG=$(git tag --list 'v[0-9]*.*' --sort=-version:refname | head -n 1)
26+
fi
27+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
28+
echo "Using tag: ${TAG}"
29+
30+
- name: Sync Zed extension
31+
run: |
32+
./script/sync-zed.ts ${{ steps.get_tag.outputs.tag }}
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
File renamed without changes.

AGENTS.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@
2121

2222
json
2323
{
24-
"recipient_name": "multi_tool_use.parallel",
25-
"parameters": {
26-
"tool_uses": [
27-
{
28-
"recipient_name": "functions.read",
29-
"parameters": {
30-
"filePath": "path/to/file.tsx"
31-
}
32-
},
33-
{
34-
"recipient_name": "functions.read",
35-
"parameters": {
36-
"filePath": "path/to/file.ts"
37-
}
38-
},
39-
{
40-
"recipient_name": "functions.read",
41-
"parameters": {
42-
"filePath": "path/to/file.md"
43-
}
44-
}
45-
]
46-
}
24+
"recipient_name": "multi_tool_use.parallel",
25+
"parameters": {
26+
"tool_uses": [
27+
{
28+
"recipient_name": "functions.read",
29+
"parameters": {
30+
"filePath": "path/to/file.tsx"
31+
}
32+
},
33+
{
34+
"recipient_name": "functions.read",
35+
"parameters": {
36+
"filePath": "path/to/file.ts"
37+
}
38+
},
39+
{
40+
"recipient_name": "functions.read",
41+
"parameters": {
42+
"filePath": "path/to/file.md"
43+
}
44+
}
45+
]
46+
}
4747
}

STATS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,9 @@
130130
| 2025-11-02 | 644,067 (+7,967) | 590,004 (+8,198) | 1,234,071 (+16,165) |
131131
| 2025-11-03 | 653,130 (+9,063) | 597,139 (+7,135) | 1,250,269 (+16,198) |
132132
| 2025-11-04 | 663,912 (+10,782) | 608,056 (+10,917) | 1,271,968 (+21,699) |
133+
| 2025-11-05 | 675,074 (+11,162) | 619,690 (+11,634) | 1,294,764 (+22,796) |
134+
| 2025-11-06 | 686,252 (+11,178) | 630,885 (+11,195) | 1,317,137 (+22,373) |
135+
| 2025-11-07 | 696,646 (+10,394) | 642,146 (+11,261) | 1,338,792 (+21,655) |
136+
| 2025-11-08 | 706,035 (+9,389) | 653,489 (+11,343) | 1,359,524 (+20,732) |
137+
| 2025-11-09 | 713,462 (+7,427) | 660,459 (+6,970) | 1,373,921 (+14,397) |
138+
| 2025-11-10 | 722,288 (+8,826) | 668,225 (+7,766) | 1,390,513 (+16,592) |

bun.lock

Lines changed: 178 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/index.ts

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ try {
171171
const summary = await summarize(response)
172172
await pushToLocalBranch(summary)
173173
}
174-
const hasShared = prData.comments.nodes.some((c) =>
175-
c.body.includes(`${useShareUrl()}/s/${shareId}`),
176-
)
174+
const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${useShareUrl()}/s/${shareId}`))
177175
await updateComment(`${response}${footer({ image: !hasShared })}`)
178176
}
179177
// Fork PR
@@ -185,9 +183,7 @@ try {
185183
const summary = await summarize(response)
186184
await pushToForkBranch(summary, prData)
187185
}
188-
const hasShared = prData.comments.nodes.some((c) =>
189-
c.body.includes(`${useShareUrl()}/s/${shareId}`),
190-
)
186+
const hasShared = prData.comments.nodes.some((c) => c.body.includes(`${useShareUrl()}/s/${shareId}`))
191187
await updateComment(`${response}${footer({ image: !hasShared })}`)
192188
}
193189
}
@@ -368,9 +364,7 @@ async function getAccessToken() {
368364

369365
if (!response.ok) {
370366
const responseJson = (await response.json()) as { error?: string }
371-
throw new Error(
372-
`App token exchange failed: ${response.status} ${response.statusText} - ${responseJson.error}`,
373-
)
367+
throw new Error(`App token exchange failed: ${response.status} ${response.statusText} - ${responseJson.error}`)
374368
}
375369

376370
const responseJson = (await response.json()) as { token: string }
@@ -411,12 +405,8 @@ async function getUserPrompt() {
411405
// ie. <img alt="Image" src="https://github.com/user-attachments/assets/xxxx" />
412406
// ie. [api.json](https://github.com/user-attachments/files/21433810/api.json)
413407
// ie. ![Image](https://github.com/user-attachments/assets/xxxx)
414-
const mdMatches = prompt.matchAll(
415-
/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi,
416-
)
417-
const tagMatches = prompt.matchAll(
418-
/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi,
419-
)
408+
const mdMatches = prompt.matchAll(/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi)
409+
const tagMatches = prompt.matchAll(/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi)
420410
const matches = [...mdMatches, ...tagMatches].sort((a, b) => a.index - b.index)
421411
console.log("Images", JSON.stringify(matches, null, 2))
422412

@@ -443,8 +433,7 @@ async function getUserPrompt() {
443433

444434
// Replace img tag with file path, ie. @image.png
445435
const replacement = `@${filename}`
446-
prompt =
447-
prompt.slice(0, start + offset) + replacement + prompt.slice(start + offset + tag.length)
436+
prompt = prompt.slice(0, start + offset) + replacement + prompt.slice(start + offset + tag.length)
448437
offset += replacement.length - tag.length
449438

450439
const contentType = res.headers.get("content-type")
@@ -512,12 +501,7 @@ async function subscribeSessionEvents() {
512501
? JSON.stringify(part.state.input)
513502
: "Unknown"
514503
console.log()
515-
console.log(
516-
color + `|`,
517-
"\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`,
518-
"",
519-
"\x1b[0m" + title,
520-
)
504+
console.log(color + `|`, "\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`, "", "\x1b[0m" + title)
521505
}
522506

523507
if (part.type === "text") {
@@ -729,8 +713,7 @@ async function assertPermissions() {
729713
throw new Error(`Failed to check permissions for user ${actor}: ${error}`)
730714
}
731715

732-
if (!["admin", "write"].includes(permission))
733-
throw new Error(`User ${actor} does not have write permissions`)
716+
if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
734717
}
735718

736719
async function updateComment(body: string) {
@@ -774,9 +757,7 @@ function footer(opts?: { image?: boolean }) {
774757

775758
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`
776759
})()
777-
const shareUrl = shareId
778-
? `[opencode session](${useShareUrl()}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;`
779-
: ""
760+
const shareUrl = shareId ? `[opencode session](${useShareUrl()}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
780761
return `\n\n${image}${shareUrl}[github run](${useEnvRunUrl()})`
781762
}
782763

@@ -959,13 +940,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
959940
})
960941
.map((c) => `- ${c.author.login} at ${c.createdAt}: ${c.body}`)
961942

962-
const files = (pr.files.nodes || []).map(
963-
(f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`,
964-
)
943+
const files = (pr.files.nodes || []).map((f) => `- ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`)
965944
const reviewData = (pr.reviews.nodes || []).map((r) => {
966-
const comments = (r.comments.nodes || []).map(
967-
(c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`,
968-
)
945+
const comments = (r.comments.nodes || []).map((c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`)
969946
return [
970947
`- ${r.author.login} at ${r.submittedAt}:`,
971948
` - Review body: ${r.body}`,
@@ -987,15 +964,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
987964
`Deletions: ${pr.deletions}`,
988965
`Total Commits: ${pr.commits.totalCount}`,
989966
`Changed Files: ${pr.files.nodes.length} files`,
990-
...(comments.length > 0
991-
? ["<pull_request_comments>", ...comments, "</pull_request_comments>"]
992-
: []),
993-
...(files.length > 0
994-
? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"]
995-
: []),
996-
...(reviewData.length > 0
997-
? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"]
998-
: []),
967+
...(comments.length > 0 ? ["<pull_request_comments>", ...comments, "</pull_request_comments>"] : []),
968+
...(files.length > 0 ? ["<pull_request_changed_files>", ...files, "</pull_request_changed_files>"] : []),
969+
...(reviewData.length > 0 ? ["<pull_request_reviews>", ...reviewData, "</pull_request_reviews>"] : []),
999970
"</pull_request>",
1000971
].join("\n")
1001972
}

github/sst-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
/// <reference path="../sst-env.d.ts" />
77

88
import "sst"
9-
export {}
9+
export {}

infra/console.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ export const auth = new sst.cloudflare.Worker("AuthApi", {
6161
domain: `auth.${domain}`,
6262
handler: "packages/console/function/src/auth.ts",
6363
url: true,
64-
link: [
65-
database,
66-
authStorage,
67-
GITHUB_CLIENT_ID_CONSOLE,
68-
GITHUB_CLIENT_SECRET_CONSOLE,
69-
GOOGLE_CLIENT_ID,
70-
],
64+
link: [database, authStorage, GITHUB_CLIENT_ID_CONSOLE, GITHUB_CLIENT_SECRET_CONSOLE, GOOGLE_CLIENT_ID],
7165
})
7266

7367
////////////////
@@ -112,6 +106,7 @@ const AUTH_API_URL = new sst.Linkable("AUTH_API_URL", {
112106
const STRIPE_WEBHOOK_SECRET = new sst.Linkable("STRIPE_WEBHOOK_SECRET", {
113107
properties: { value: stripeWebhook.secret },
114108
})
109+
const gatewayKv = new sst.cloudflare.Kv("GatewayKv")
115110

116111
////////////////
117112
// CONSOLE
@@ -142,6 +137,13 @@ new sst.cloudflare.x.SolidStart("Console", {
142137
EMAILOCTOPUS_API_KEY,
143138
AWS_SES_ACCESS_KEY_ID,
144139
AWS_SES_SECRET_ACCESS_KEY,
140+
...($dev
141+
? [
142+
new sst.Secret("CLOUDFLARE_DEFAULT_ACCOUNT_ID", process.env.CLOUDFLARE_DEFAULT_ACCOUNT_ID!),
143+
new sst.Secret("CLOUDFLARE_API_TOKEN", process.env.CLOUDFLARE_API_TOKEN!),
144+
]
145+
: []),
146+
gatewayKv,
145147
],
146148
environment: {
147149
//VITE_DOCS_URL: web.url.apply((url) => url!),

0 commit comments

Comments
 (0)