Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/app",
"version": "1.1.43",
"version": "1.1.45",
"description": "",
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/console/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-app",
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/console/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/console-core",
"version": "1.1.43",
"version": "1.1.45",
"private": true,
"type": "module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/function/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-function",
"version": "1.1.43",
"version": "1.1.45",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/mail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-mail",
"version": "1.1.43",
"version": "1.1.45",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/desktop",
"private": true,
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/enterprise/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/enterprise",
"version": "1.1.43",
"version": "1.1.45",
"private": true,
"type": "module",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions packages/extensions/zed/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id = "opencode"
name = "OpenCode"
description = "The open source coding agent."
version = "1.1.43"
version = "1.1.45"
schema_version = 1
authors = ["Anomaly"]
repository = "https://github.com/anomalyco/opencode"
Expand All @@ -11,26 +11,26 @@ name = "OpenCode"
icon = "./icons/opencode.svg"

[agent_servers.opencode.targets.darwin-aarch64]
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.43/opencode-darwin-arm64.zip"
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.45/opencode-darwin-arm64.zip"
cmd = "./opencode"
args = ["acp"]

[agent_servers.opencode.targets.darwin-x86_64]
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.43/opencode-darwin-x64.zip"
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.45/opencode-darwin-x64.zip"
cmd = "./opencode"
args = ["acp"]

[agent_servers.opencode.targets.linux-aarch64]
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.43/opencode-linux-arm64.tar.gz"
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.45/opencode-linux-arm64.tar.gz"
cmd = "./opencode"
args = ["acp"]

[agent_servers.opencode.targets.linux-x86_64]
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.43/opencode-linux-x64.tar.gz"
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.45/opencode-linux-x64.tar.gz"
cmd = "./opencode"
args = ["acp"]

[agent_servers.opencode.targets.windows-x86_64]
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.43/opencode-windows-x64.zip"
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.45/opencode-windows-x64.zip"
cmd = "./opencode.exe"
args = ["acp"]
2 changes: 1 addition & 1 deletion packages/function/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/function",
"version": "1.1.43",
"version": "1.1.45",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.1.43",
"version": "1.1.45",
"name": "opencode",
"type": "module",
"license": "MIT",
Expand Down
11 changes: 11 additions & 0 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,17 @@ export namespace Provider {
opts.signal = combined
}

// Inject metadata from model.options if enableMeta is set
if (provider.options?.enableMeta && opts.body && opts.method === "POST") {
try {
options.headers["x-opencode-session"] = model.options.metadata.user_id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "the train has already left the station", but I would prefer not adding opencode specific headers that give away where my traffic is coming from like this. Also, should we be using a metadata

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses the issue where many model providers cannot properly enable caching functionality. I attempted to add parameters like user_id in the metadata.
However, the model providers cannot recognize them correctly, including AWS Claude Code and several third-party provided Claude models.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "the train has already left the station", but I would prefer not adding opencode specific headers that give away where my traffic is coming from like this. Also, should we be using a metadata

I think some API endpoint like AWS bedrock/Azure are alao require this fix to get better prompt cache support

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I ran into this issue while using AWS


const body = JSON.parse(opts.body as string)
body.metadata = model.options.metadata
opts.body = JSON.stringify(body)
} catch {}
}

// Strip openai itemId metadata following what codex does
// Codex uses #[serde(skip_serializing)] on id fields for all item types:
// Message, Reasoning, FunctionCall, LocalShellCall, CustomToolCall, WebSearchCall
Expand Down
10 changes: 7 additions & 3 deletions packages/opencode/src/session/llm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os from "os"
import { Installation } from "@/installation"
import { Provider } from "@/provider/provider"
import { Log } from "@/util/log"
Expand All @@ -9,7 +8,6 @@ import {
type StreamTextResult,
type Tool,
type ToolSet,
extractReasoningMiddleware,
tool,
jsonSchema,
} from "ai"
Expand Down Expand Up @@ -64,6 +62,13 @@ export namespace LLM {
Provider.getProvider(input.model.providerID),
Auth.get(input.model.providerID),
])
if (provider.options?.enableMeta) {
input.model.options.metadata = {
user_id: `user_${Instance.project.id ?? "unknown"}_account__session_${input.sessionID}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_session_id would be more clear. or, ideally, let's make user_id just be user_id and concatenate our values at the site of use.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the purpose of this combination is to simulate the behavior in the Claude Code CLI, which is why this approach is adopted

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a variable name, it could indeed be optimized to user_session_id to express the meaning more clearly

project_id: Instance.project.id,
session_id: input.sessionID,
}
}
const isCodex = provider.id === "openai" && auth?.type === "oauth"

const system = []
Expand Down Expand Up @@ -261,7 +266,6 @@ export namespace LLM {
return args.params
},
},
extractReasoningMiddleware({ tagName: "think", startWithReasoning: false }),
],
}),
experimental_telemetry: {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/plugin",
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/slack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/slack",
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/ui",
"version": "1.1.43",
"version": "1.1.45",
"type": "module",
"license": "MIT",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/util",
"version": "1.1.43",
"version": "1.1.45",
"private": true,
"type": "module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@opencode-ai/web",
"type": "module",
"license": "MIT",
"version": "1.1.43",
"version": "1.1.45",
"scripts": {
"dev": "astro dev",
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
Expand Down
2 changes: 1 addition & 1 deletion sdks/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "opencode",
"displayName": "opencode",
"description": "opencode for VS Code",
"version": "1.1.43",
"version": "1.1.45",
"publisher": "sst-dev",
"repository": {
"type": "git",
Expand Down