Skip to content

Commit 8b2ce54

Browse files
committed
Merge branch 'dev' into opentui
2 parents f1f51b4 + 5b86fa9 commit 8b2ce54

File tree

285 files changed

+23537
-513
lines changed

Some content is hidden

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

285 files changed

+23537
-513
lines changed

.github/publish-python-sdk.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#
2+
# This file is intentionally in the wrong dir, will move and add later....
3+
#
4+
5+
# name: publish-python-sdk
6+
7+
# on:
8+
# release:
9+
# types: [published]
10+
# workflow_dispatch:
11+
12+
# jobs:
13+
# publish:
14+
# runs-on: ubuntu-latest
15+
# permissions:
16+
# contents: read
17+
# steps:
18+
# - name: Checkout repository
19+
# uses: actions/checkout@v4
20+
21+
# - name: Setup Bun
22+
# uses: oven-sh/setup-bun@v1
23+
# with:
24+
# bun-version: 1.2.21
25+
26+
# - name: Install dependencies (JS/Bun)
27+
# run: bun install
28+
29+
# - name: Install uv
30+
# shell: bash
31+
# run: curl -LsSf https://astral.sh/uv/install.sh | sh
32+
33+
# - name: Generate Python SDK from OpenAPI (CLI)
34+
# shell: bash
35+
# run: |
36+
# ~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/generate.py --source cli
37+
38+
# - name: Sync Python dependencies
39+
# shell: bash
40+
# run: |
41+
# ~/.local/bin/uv sync --dev --project packages/sdk/python
42+
43+
# - name: Set version from release tag
44+
# shell: bash
45+
# run: |
46+
# TAG="${GITHUB_REF_NAME:-}"
47+
# if [ -z "$TAG" ]; then
48+
# TAG="$(git describe --tags --abbrev=0 || echo 0.0.0)"
49+
# fi
50+
# echo "Using version: $TAG"
51+
# VERSION="$TAG" ~/.local/bin/uv run --project packages/sdk/python python - <<'PY'
52+
# import os, re, pathlib
53+
# root = pathlib.Path('packages/sdk/python')
54+
# pt = (root / 'pyproject.toml').read_text()
55+
# version = os.environ.get('VERSION','0.0.0').lstrip('v')
56+
# pt = re.sub(r'(?m)^(version\s*=\s*")[^"]+("\s*)$', f"\\1{version}\\2", pt)
57+
# (root / 'pyproject.toml').write_text(pt)
58+
# # Also update generator config override for consistency
59+
# cfgp = root / 'openapi-python-client.yaml'
60+
# if cfgp.exists():
61+
# cfg = cfgp.read_text()
62+
# cfg = re.sub(r'(?m)^(package_version_override:\s*)\S+$', f"\\1{version}", cfg)
63+
# cfgp.write_text(cfg)
64+
# PY
65+
66+
# - name: Build and publish to PyPI
67+
# env:
68+
# PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
69+
# shell: bash
70+
# run: |
71+
# ~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/publish.py

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ jobs:
5353
- name: Install OpenCode
5454
run: curl -fsSL https://opencode.ai/install | bash
5555

56+
- name: Setup npm auth
57+
run: |
58+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59+
5660
- name: Publish
5761
run: |
5862
./script/publish.ts
5963
env:
6064
OPENCODE_BUMP: ${{ inputs.bump }}
6165
OPENCODE_CHANNEL: latest
66+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
6267
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
6368
AUR_KEY: ${{ secrets.AUR_KEY }}
64-
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
6569
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}

STATS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@
122122
| 2025-10-26 | 584,409 (+5,482) | 521,179 (+5,050) | 1,105,588 (+10,532) |
123123
| 2025-10-27 | 589,999 (+5,590) | 526,001 (+4,822) | 1,116,000 (+10,412) |
124124
| 2025-10-28 | 595,776 (+5,777) | 532,438 (+6,437) | 1,128,214 (+12,214) |
125+
| 2025-10-29 | 606,259 (+10,483) | 542,064 (+9,626) | 1,148,323 (+20,109) |

bun.lock

Lines changed: 28 additions & 60 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@tsconfig/bun": "1.0.9",
2929
"@cloudflare/workers-types": "4.20251008.0",
3030
"@openauthjs/openauth": "0.0.0-20250322224806",
31-
"@pierre/precision-diffs": "0.3.2",
31+
"@pierre/precision-diffs": "0.3.6",
3232
"@solidjs/meta": "0.29.4",
3333
"@tailwindcss/vite": "4.1.11",
3434
"diff": "8.0.2",
@@ -66,7 +66,7 @@
6666
"license": "MIT",
6767
"prettier": {
6868
"semi": false,
69-
"printWidth": 120
69+
"printWidth": 100
7070
},
7171
"trustedDependencies": [
7272
"esbuild",

packages/console/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev",
88
"build": "vinxi build && ../../opencode/script/schema.ts ./.output/public/config.json",
99
"start": "vinxi start",
10-
"version": "0.15.20"
10+
"version": "0.15.23"
1111
},
1212
"dependencies": {
1313
"@ibm/plex": "6.4.1",

packages/console/app/src/routes/zen/util/handler.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function handler(
4343
})
4444
const zenData = ZenData.list()
4545
const modelInfo = validateModel(zenData, body.model)
46-
const providerInfo = selectProvider(zenData, modelInfo)
46+
const providerInfo = selectProvider(zenData, modelInfo, input.request.headers.get("x-real-ip") ?? "")
4747
const authInfo = await authenticate(modelInfo, providerInfo)
4848
validateBilling(modelInfo, authInfo)
4949
validateModelSettings(authInfo)
@@ -222,11 +222,15 @@ export async function handler(
222222
return { id: modelId, ...modelData }
223223
}
224224

225-
function selectProvider(zenData: ZenData, model: Awaited<ReturnType<typeof validateModel>>) {
225+
function selectProvider(zenData: ZenData, model: Awaited<ReturnType<typeof validateModel>>, ip: string) {
226226
const providers = model.providers
227227
.filter((provider) => !provider.disabled)
228228
.flatMap((provider) => Array<typeof provider>(provider.weight ?? 1).fill(provider))
229-
const provider = providers[Math.floor(Math.random() * providers.length)]
229+
230+
// Use last character of IP address to select a provider
231+
const lastChar = ip.charCodeAt(ip.length - 1) || 0
232+
const index = lastChar % providers.length
233+
const provider = providers[index]
230234

231235
if (!(provider.id in zenData.providers)) {
232236
throw new ModelError(`Provider ${provider.id} not supported`)

packages/console/app/src/routes/zen/v1/models.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export async function GET(input: APIEvent) {
2525
object: "list",
2626
data: Object.entries(zenData.models)
2727
.filter(([id]) => !disabledModels.includes(id))
28-
.map(([id, model]) => ({
29-
id: `opencode/${id}`,
28+
.map(([id, _model]) => ({
29+
id,
3030
object: "model",
3131
created: Math.floor(Date.now() / 1000),
3232
owned_by: "opencode",
@@ -50,7 +50,10 @@ export async function GET(input: APIEvent) {
5050
})
5151
.from(KeyTable)
5252
.innerJoin(WorkspaceTable, eq(WorkspaceTable.id, KeyTable.workspaceID))
53-
.leftJoin(ModelTable, and(eq(ModelTable.workspaceID, KeyTable.workspaceID), isNull(ModelTable.timeDeleted)))
53+
.leftJoin(
54+
ModelTable,
55+
and(eq(ModelTable.workspaceID, KeyTable.workspaceID), isNull(ModelTable.timeDeleted)),
56+
)
5457
.where(and(eq(KeyTable.key, apiKey), isNull(KeyTable.timeDeleted)))
5558
.then((rows) => rows.map((row) => row.model)),
5659
)

packages/console/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "@opencode-ai/console-core",
4-
"version": "0.15.20",
4+
"version": "0.15.23",
55
"private": true,
66
"type": "module",
77
"dependencies": {

packages/console/function/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opencode-ai/console-function",
3-
"version": "0.15.20",
3+
"version": "0.15.23",
44
"$schema": "https://json.schemastore.org/package.json",
55
"private": true,
66
"type": "module",

0 commit comments

Comments
 (0)