Compare commits

...

6 Commits

Author SHA1 Message Date
Frank ec0cc1f5ab pin version
publish-github-action / publish (push) Waiting to run
2025-09-19 15:06:07 -04:00
Frank 9e0333f767 Pin opencode version 2025-09-01 17:23:46 -04:00
Frank a67106b700 wip: github action
publish-github-action / publish (push) Waiting to run
2025-07-25 18:33:45 -04:00
Dax Raad 5a3aed4e88 qwen optimizations it works good now 2025-07-25 18:31:08 -04:00
Frank a3bd92ee60 wip: github actions
publish-github-action / publish (push) Waiting to run
publish / publish (push) Waiting to run
2025-07-25 18:29:53 -04:00
Michael Hanson 7e3fe04b06 Fix a broken example in the MCP documentation and add more clarity (#1322) 2025-07-25 17:47:01 -04:00
6 changed files with 58 additions and 16 deletions
+1 -1
View File
@@ -27,4 +27,4 @@ jobs:
git config --global user.email "opencode@sst.dev"
git config --global user.name "opencode"
./script/publish
working-directory: ./sdks/github
working-directory: ./github
+2
View File
@@ -19,6 +19,8 @@ runs:
- name: Install opencode
shell: bash
run: curl -fsSL https://opencode.ai/install | bash
env:
VERSION: 0.5.5
- name: Run opencode
shell: bash
+21 -7
View File
@@ -375,6 +375,9 @@ export const GithubRunCommand = cmd({
const runUrl = `/${owner}/${repo}/actions/runs/${runId}`
const shareBaseUrl = isMock ? "https://dev.opencode.ai" : "https://opencode.ai"
// TODO
console.log("payload", payload)
let appToken: string
let octoRest: Octokit
let octoGraph: typeof graphql
@@ -386,7 +389,6 @@ export const GithubRunCommand = cmd({
type PromptFiles = Awaited<ReturnType<typeof getUserPrompt>>["promptFiles"]
try {
const { userPrompt, promptFiles } = await getUserPrompt()
const actionToken = isMock ? args.token! : await getOidcToken()
appToken = await exchangeForAppToken(actionToken)
octoRest = new Octokit({ auth: appToken })
@@ -394,6 +396,7 @@ export const GithubRunCommand = cmd({
headers: { authorization: `token ${appToken}` },
})
const { userPrompt, promptFiles } = await getUserPrompt()
await configureGit(appToken)
await assertPermissions()
@@ -531,20 +534,31 @@ export const GithubRunCommand = cmd({
}[] = []
// Search for files
// 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 imgTags = prompt.matchAll(/!?\[.*?\]\((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)
let offset = 0
for (const imgTag of imgTags) {
const tag = imgTag[0]
const url = imgTag[1]
const start = imgTag.index
for (const m of matches) {
const tag = m[0]
const url = m[1]
const start = m.index
const filename = path.basename(url)
// Download image
const res = await fetch(url)
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${appToken}`,
Accept: "application/vnd.github.v3+json",
},
})
if (!res.ok) {
// TODO
//console.log(res)
//throw new Error("manual")
console.error(`Failed to download image: ${url}`)
continue
}
+5 -4
View File
@@ -23,8 +23,9 @@ 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]
if (lastContent && typeof lastContent === "object") {
@@ -35,7 +36,7 @@ export namespace ProviderTransform {
continue
}
}
msg.providerOptions = {
...msg.providerOptions,
...providerOptions,
@@ -46,7 +47,7 @@ export namespace ProviderTransform {
}
export function temperature(_providerID: string, modelID: string) {
if (modelID.includes("qwen")) return 0.55
if (modelID.toLowerCase().includes("qwen")) return 0.55
return 0
}
}
+2 -2
View File
@@ -64,12 +64,12 @@ export namespace ToolRegistry {
}
export function enabled(_providerID: string, modelID: string): Record<string, boolean> {
if (modelID.includes("claude")) {
if (modelID.toLowerCase().includes("claude")) {
return {
patch: false,
}
}
if (modelID.includes("qwen")) {
if (modelID.toLowerCase().includes("qwen")) {
return {
patch: false,
todowrite: false,
@@ -18,7 +18,7 @@ You can define MCP servers in your opencode config under `mcp`.
### Local
Add local MCP servers under `mcp` with `"type": "local"`.
Add local MCP servers using `"type": "local"` within the MCP object. Multiple MCP servers can be added. The key string for each server can be any arbitrary name.
```json title="opencode.json"
{
@@ -31,7 +31,7 @@ Add local MCP servers under `mcp` with `"type": "local"`.
"environment": {
"MY_ENV_VAR": "my_env_var_value"
}
}, {
},
"my-different-local-mcp-server": {
"type": "local",
"command": ["bun", "x", "my-other-mcp-command"],
@@ -62,3 +62,28 @@ Add remote MCP servers under `mcp` with `"type": "remote"`.
}
}
```
Local and remote servers can be used together within the same `mcp` config object.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"my-local-mcp-server": {
"type": "local",
"command": ["bun", "x", "my-mcp-command"],
"enabled": true,
"environment": {
"MY_ENV_VAR": "my_env_var_value"
}
},
"my-remote-mcp": {
"type": "remote",
"url": "https://my-mcp-server.com",
"enabled": true,
"headers": {
"Authorization": "Bearer MY_API_KEY"
}
}
}
}