Compare commits
6 Commits
v0.3.72
...
github-v1.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
| ec0cc1f5ab | |||
| 9e0333f767 | |||
| a67106b700 | |||
| 5a3aed4e88 | |||
| a3bd92ee60 | |||
| 7e3fe04b06 |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. 
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user