Compare commits

..

1 commit
dev ... v2.4.0

Author SHA1 Message Date
github-actions[bot]
44aed4fd14 release: v2.4.0 2026-11-23 08:24:58 +00:00
3577 changed files with 38391 additions and 511304 deletions

2
.gitattributes vendored
View file

@ -23,8 +23,6 @@ packages/cli-rs/crates/ui/src/keymap/generated.rs linguist-generated
packages/cli-rs/crates/ui/src/theme/generated/** linguist-generated
packages/cli-rs/crates/util/fixtures/time.tsv linguist-generated
packages/core/src/**/*.txt text eol=lf
# test/opencode-api-skill.test.ts compares the generated API reference byte for byte, so Windows checkouts keep LF.
packages/core/src/plugin/skill/opencode/** text eol=lf
packages/httpapi-codegen/test/generated/*.ts text eol=lf
# The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF.
services/site/** text=auto eol=lf

View file

@ -11,6 +11,7 @@ kommander
ludvigrask
MrMushrooooom
neriousy
nexxeln
R44VC0RP
rekram1-node
thdxr
@ -18,8 +19,4 @@ simonklee
Slickstef11
usrnk1
vimtor
Tarquinen
dc85
vaprdev
hearnadam
heimoshuiyu
StarpTech

View file

@ -1,53 +0,0 @@
#!/usr/bin/env bash
# backfill-blockmaps.sh <version>...: builds the .blockmap for each published Windows installer and macOS zip of
# the given stable versions from the signed files on opencode.ai/files and uploads it next to them. Releases before
# publish-desktop.sh built blockmaps shipped without them, so electron-updater could not update differentially
# from them. A blockmap that already exists is left alone; a file the version never shipped is skipped.
. "$(dirname "$0")/lib.sh"
actor=${GITHUB_TRIGGERING_ACTOR:-${GITHUB_ACTOR:-}}
if ! (shopt -s nocasematch; [[ "$actor" = thdxr || "$actor" = Hona || "$actor" = rekram1-node ]]); then
die "${actor:-An unknown actor} is not allowed to backfill release files"
fi
[ $# -gt 0 ] || die "No versions given"
for version in "$@"; do
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] && [[ "$version" != 0.0.0-* ]] ||
die "Invalid release version: $version"
done
names=(opencode-desktop-win-arm64.exe opencode-desktop-win-x64.exe opencode-desktop-mac-arm64.zip opencode-desktop-mac-x64.zip)
status() {
curl -sS -o /dev/null -w '%{http_code}' --head "$1"
}
credentials=false
for version in "$@"; do
dir=$(mktemp -d)
for name in "${names[@]}"; do
url="https://opencode.ai/files/bin/$version/$name"
case "$(status "$url.blockmap")" in
200) echo "$version/$name.blockmap exists" && continue ;;
404) ;;
*) die "Could not check $url.blockmap" ;;
esac
case "$(status "$url")" in
200) ;;
404) echo "$version/$name was not published" && continue ;;
*) die "Could not check $url" ;;
esac
curl -fsSL --retry 3 -o "$dir/$name" "$url"
node "$release_dir/blockmap.mjs" "$dir/$name"
if dry_run; then
echo "dry-run upload: bin/$version/$name.blockmap ($(size "$dir/$name.blockmap") bytes)"
continue
fi
if [ "$credentials" = false ]; then
r2_credentials
credentials=true
fi
OPENCODE_VERSION=$version upload_file "$dir/$name.blockmap" "$name.blockmap" application/octet-stream ||
die "Upload failed: $version/$name.blockmap"
echo "uploaded bin/$version/$name.blockmap"
done
rm -rf "$dir"
done

View file

@ -1,179 +0,0 @@
// blockmap.mjs <file>...: writes <file>.blockmap next to each file, the gzipped block map electron-updater fetches
// for a differential download. It matches electron-builder's buildBlockMap (app-builder-lib 26): Rabin
// content-defined chunks of 8-32 KB and a 18-byte BLAKE2b checksum per chunk. electron-builder builds it at pack
// time, but signing changes the installer, so the release builds it here from the final signed files.
//
// It runs in publish jobs that hold secrets, so it uses Node's standard library only.
import { createReadStream, writeFileSync } from "node:fs"
import { gzipSync } from "node:zlib"
const MIN = 8192
const MAX = 32768
const MASK = 16384 - 1
const WINDOW = 64
// Rabin fingerprint tables for the degree-63 polynomial 0xbfe6b8a5bf378d83 (github.com/aclements/go-rabin), each
// 64-bit entry split into signed 32-bit hi and lo words.
const POLY = 0xbfe6b8a5bf378d83n
const PUSH_HI = new Int32Array(256)
const PUSH_LO = new Int32Array(256)
const POP_HI = new Int32Array(256)
const POP_LO = new Int32Array(256)
{
const mod = (a) => {
for (let d = a.toString(2).length - 1; a !== 0n && d >= 63; d = a.toString(2).length - 1)
a ^= POLY << BigInt(d - 63)
return a
}
const set = (hi, lo, i, x) => {
hi[i] = Number(BigInt.asIntN(32, x >> 32n))
lo[i] = Number(BigInt.asIntN(32, x))
}
for (let i = 0; i < 256; i++) {
const b = BigInt(i)
set(PUSH_HI, PUSH_LO, i, BigInt.asUintN(64, (b << 63n) ^ mod(b << 63n)))
set(POP_HI, POP_LO, i, mod(b << BigInt((WINDOW - 1) * 8)))
}
}
// BLAKE2b (RFC 7693) with an 18-byte digest and no key, on 32-bit word pairs. Node's crypto offers only BLAKE2b-512,
// whose digest length is part of the parameter block, so truncating it gives a different hash.
const IV = new Uint32Array([
0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1,
0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
])
const SIGMA = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
[14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3],
[11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4],
[7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8],
[9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13],
[2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9],
[12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11],
[13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10],
[6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5],
[10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0],
].map((row) => row.map((i) => i * 2))
const ROUNDS = [...SIGMA, SIGMA[0], SIGMA[1]]
const DIGEST = 18
const v = new Uint32Array(32)
const m = new Uint32Array(32)
const h = new Uint32Array(16)
const block = new Uint8Array(128)
const view = new DataView(block.buffer)
function add(a, b0, b1) {
const lo = v[a] + b0
v[a + 1] = v[a + 1] + b1 + (lo >= 0x100000000 ? 1 : 0)
v[a] = lo
}
function mix(a, b, c, d, x, y) {
add(a, v[b], v[b + 1])
add(a, m[x], m[x + 1])
let lo = v[d] ^ v[a]
let hi = v[d + 1] ^ v[a + 1]
v[d] = hi
v[d + 1] = lo
add(c, v[d], v[d + 1])
lo = v[b] ^ v[c]
hi = v[b + 1] ^ v[c + 1]
v[b] = (lo >>> 24) ^ (hi << 8)
v[b + 1] = (hi >>> 24) ^ (lo << 8)
add(a, v[b], v[b + 1])
add(a, m[y], m[y + 1])
lo = v[d] ^ v[a]
hi = v[d + 1] ^ v[a + 1]
v[d] = (lo >>> 16) ^ (hi << 16)
v[d + 1] = (hi >>> 16) ^ (lo << 16)
add(c, v[d], v[d + 1])
lo = v[b] ^ v[c]
hi = v[b + 1] ^ v[c + 1]
v[b] = (hi >>> 31) ^ (lo << 1)
v[b + 1] = (lo >>> 31) ^ (hi << 1)
}
function compress(count, last) {
for (let i = 0; i < 16; i++) {
v[i] = h[i]
v[i + 16] = IV[i]
}
v[24] ^= count
v[25] ^= Math.floor(count / 0x100000000)
if (last) {
v[28] = ~v[28]
v[29] = ~v[29]
}
for (let i = 0; i < 32; i++) m[i] = view.getUint32(i * 4, true)
for (const s of ROUNDS) {
mix(0, 8, 16, 24, s[0], s[1])
mix(2, 10, 18, 26, s[2], s[3])
mix(4, 12, 20, 28, s[4], s[5])
mix(6, 14, 22, 30, s[6], s[7])
mix(0, 10, 20, 30, s[8], s[9])
mix(2, 12, 22, 24, s[10], s[11])
mix(4, 14, 16, 26, s[12], s[13])
mix(6, 8, 18, 28, s[14], s[15])
}
for (let i = 0; i < 16; i++) h[i] ^= v[i] ^ v[i + 16]
}
function blake2b(data) {
h.set(IV)
h[0] ^= 0x01010000 ^ DIGEST
let offset = 0
while (data.length - offset > 128) {
block.set(data.subarray(offset, offset + 128))
offset += 128
compress(offset, false)
}
block.fill(0)
block.set(data.subarray(offset))
compress(data.length, true)
return Buffer.from(h.buffer, h.byteOffset, DIGEST).toString("base64")
}
async function blockmap(file) {
const checksums = []
const sizes = []
const chunk = Buffer.allocUnsafe(MAX)
const win = new Uint8Array(WINDOW)
let n = 0
let hi = 0
let lo = 0
let pos = 0
const emit = () => {
checksums.push(blake2b(chunk.subarray(0, n)))
sizes.push(n)
n = hi = lo = pos = 0
win.fill(0)
}
for await (const data of createReadStream(file, { highWaterMark: 256 * 1024 })) {
for (let i = 0; i < data.length; i++) {
const b = data[i]
chunk[n++] = b
if (n <= MIN - WINDOW) continue
if (n > MIN) {
const old = win[pos]
hi ^= POP_HI[old]
lo ^= POP_LO[old]
}
win[pos] = b
pos = (pos + 1) % WINDOW
const top = (hi >>> 23) & 0xff
const nhi = ((hi << 8) | (lo >>> 24)) & 0x7fffffff
const nlo = (lo << 8) | b
hi = nhi ^ PUSH_HI[top]
lo = nlo ^ PUSH_LO[top]
if (n >= MIN && ((lo & MASK) === MASK || n >= MAX)) emit()
}
}
if (n > 0) emit()
const map = { version: "2", files: [{ name: "file", offset: 0, checksums, sizes }] }
writeFileSync(`${file}.blockmap`, gzipSync(Buffer.from(JSON.stringify(map)), { level: 9 }))
}
for (const file of process.argv.slice(2)) await blockmap(file)

View file

@ -24,13 +24,7 @@ feed() {
done | jq -s --arg date "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" '{files: ., releaseDate: $date}'
}
# electron-updater fetches <file>.blockmap next to the Windows installer and the macOS zip for a differential
# download. Signing changes these files, so the blockmaps electron-builder made at pack time no longer match.
differential=("${win[@]}" "$macos/opencode-desktop-mac-arm64.zip" "$macos/opencode-desktop-mac-x64.zip")
node "$release_dir/blockmap.mjs" "${differential[@]}"
blockmaps=("${differential[@]/%/.blockmap}")
files=$(upload_files "${win[@]}" "${mac[@]}" "${linux[@]}" "${linux_arm[@]}" "${bundles[@]}" "${blockmaps[@]}")
files=$(upload_files "${win[@]}" "${mac[@]}" "${linux[@]}" "${linux_arm[@]}" "${bundles[@]}")
manifests=$(jq -n --argjson win "$(feed "${win[@]}")" --argjson mac "$(feed "${mac[@]}")" \
--argjson linux "$(feed "${linux[@]}")" --argjson linux_arm64 "$(feed "${linux_arm[@]}")" \
'{"desktop.yml": $win, "desktop-mac.yml": $mac, "desktop-linux.yml": $linux, "desktop-linux-arm64.yml": $linux_arm64}')

View file

@ -6,8 +6,7 @@
tag="v$OPENCODE_VERSION"
payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \
--arg url "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag" '
($notes | gsub("(?m)^#{4,6}[ \\t]+(?<heading>[^\\r\\n]+)"; "**\(.heading)**") |
if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description |
($notes | if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description |
{
allowed_mentions: {parse: []},
embeds: [{title: "OpenCode V2 \($tag)", url: $url, description: $description, color: 2829099}]

View file

@ -11,10 +11,10 @@
"harfbuzz.wasm": { "type": "wasm" },
"satori-layout.wasm": { "type": "wasm" },
"resvg.wasm": { "type": "wasm" },
"openmono-regular-rest.bin": { "type": "data" },
"openmono-regular-latin.bin": { "type": "data" },
"openmono-bold-rest.bin": { "type": "data" },
"openmono-bold-latin.bin": { "type": "data" }
"opentui-mono-regular-rest.bin": { "type": "data" },
"opentui-mono-regular-latin.bin": { "type": "data" },
"opentui-mono-bold-rest.bin": { "type": "data" },
"opentui-mono-bold-latin.bin": { "type": "data" }
}
}
}

View file

@ -11,10 +11,10 @@
"harfbuzz.wasm": { "type": "wasm" },
"satori-layout.wasm": { "type": "wasm" },
"resvg.wasm": { "type": "wasm" },
"openmono-regular-rest.bin": { "type": "data" },
"openmono-regular-latin.bin": { "type": "data" },
"openmono-bold-rest.bin": { "type": "data" },
"openmono-bold-latin.bin": { "type": "data" }
"opentui-mono-regular-rest.bin": { "type": "data" },
"opentui-mono-regular-latin.bin": { "type": "data" },
"opentui-mono-bold-rest.bin": { "type": "data" },
"opentui-mono-bold-latin.bin": { "type": "data" }
}
}
}

View file

@ -19,58 +19,7 @@
"!/v1/docs/assets/*",
"!/v1/docs/pagefind/*",
"!/v1/docs/llms.txt",
"!/v1/docs/theme.json",
"/zh/docs",
"/zh/docs/*",
"!/zh/docs/pagefind/*",
"/zht/docs",
"/zht/docs/*",
"!/zht/docs/pagefind/*",
"/ko/docs",
"/ko/docs/*",
"!/ko/docs/pagefind/*",
"/de/docs",
"/de/docs/*",
"!/de/docs/pagefind/*",
"/es/docs",
"/es/docs/*",
"!/es/docs/pagefind/*",
"/fr/docs",
"/fr/docs/*",
"!/fr/docs/pagefind/*",
"/it/docs",
"/it/docs/*",
"!/it/docs/pagefind/*",
"/da/docs",
"/da/docs/*",
"!/da/docs/pagefind/*",
"/ja/docs",
"/ja/docs/*",
"!/ja/docs/pagefind/*",
"/pl/docs",
"/pl/docs/*",
"!/pl/docs/pagefind/*",
"/ru/docs",
"/ru/docs/*",
"!/ru/docs/pagefind/*",
"/uk/docs",
"/uk/docs/*",
"!/uk/docs/pagefind/*",
"/ar/docs",
"/ar/docs/*",
"!/ar/docs/pagefind/*",
"/no/docs",
"/no/docs/*",
"!/no/docs/pagefind/*",
"/br/docs",
"/br/docs/*",
"!/br/docs/pagefind/*",
"/th/docs",
"/th/docs/*",
"!/th/docs/pagefind/*",
"/tr/docs",
"/tr/docs/*",
"!/tr/docs/pagefind/*"
"!/v1/docs/theme.json"
]
},
"domains": ["dev.opencode.ai", "docs.dev.opencode.ai"],

View file

@ -19,58 +19,7 @@
"!/v1/docs/assets/*",
"!/v1/docs/pagefind/*",
"!/v1/docs/llms.txt",
"!/v1/docs/theme.json",
"/zh/docs",
"/zh/docs/*",
"!/zh/docs/pagefind/*",
"/zht/docs",
"/zht/docs/*",
"!/zht/docs/pagefind/*",
"/ko/docs",
"/ko/docs/*",
"!/ko/docs/pagefind/*",
"/de/docs",
"/de/docs/*",
"!/de/docs/pagefind/*",
"/es/docs",
"/es/docs/*",
"!/es/docs/pagefind/*",
"/fr/docs",
"/fr/docs/*",
"!/fr/docs/pagefind/*",
"/it/docs",
"/it/docs/*",
"!/it/docs/pagefind/*",
"/da/docs",
"/da/docs/*",
"!/da/docs/pagefind/*",
"/ja/docs",
"/ja/docs/*",
"!/ja/docs/pagefind/*",
"/pl/docs",
"/pl/docs/*",
"!/pl/docs/pagefind/*",
"/ru/docs",
"/ru/docs/*",
"!/ru/docs/pagefind/*",
"/uk/docs",
"/uk/docs/*",
"!/uk/docs/pagefind/*",
"/ar/docs",
"/ar/docs/*",
"!/ar/docs/pagefind/*",
"/no/docs",
"/no/docs/*",
"!/no/docs/pagefind/*",
"/br/docs",
"/br/docs/*",
"!/br/docs/pagefind/*",
"/th/docs",
"/th/docs/*",
"!/th/docs/pagefind/*",
"/tr/docs",
"/tr/docs/*",
"!/tr/docs/pagefind/*"
"!/v1/docs/theme.json"
]
},
"domains": ["opencode.ai", "docs.opencode.ai"],

View file

@ -1,70 +0,0 @@
name: backfill-blockmaps
# Uploads the .blockmap files electron-updater needs for a differential update next to desktop releases that
# shipped without them (2.2.0 through 2.4.1). Like release.yml's publish jobs, it runs in the release environment,
# checks out only .github/release/ and treats the published files as data; releasers only.
on:
workflow_dispatch:
inputs:
versions:
description: "Space-separated stable versions, such as 2.4.0 2.4.1"
required: true
type: string
dry_run:
description: "Build the blockmaps without uploading them"
required: false
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: read
jobs:
backfill:
if: github.repository == 'anomalyco/opencode' && github.ref == 'refs/heads/dev'
runs-on: ubuntu-24.04
environment: release
permissions:
contents: read
id-token: write
env:
OPENCODE_DRY_RUN: ${{ inputs.dry_run }}
steps:
- name: Check out release scripts
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
sparse-checkout: /.github/release/
sparse-checkout-cone-mode: false
persist-credentials: false
- id: aws
name: Configure AWS credentials
if: inputs.dry_run != true
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
output-env-credentials: false
output-credentials: true
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Cloudflare token
id: cloudflare-token
if: inputs.dry_run != true
run: bash .github/release/cloudflare-token.sh
env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
- name: Backfill
run: |
read -ra versions <<< "$VERSIONS"
bash .github/release/backfill-blockmaps.sh "${versions[@]}"
env:
VERSIONS: ${{ inputs.versions }}
CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}

View file

@ -1,51 +0,0 @@
name: check-cli-rs
# Checks packages/cli-rs, the Rust client, which check-test.yml leaves out. Pull requests run it only when they change
# the client. Its tests and check:drift also compare it with the TypeScript packages below, so a dev push that changes
# one runs it too: a TypeScript change that breaks the client shows on dev, not on other teams' pull requests.
on:
pull_request:
paths:
- packages/cli-rs/**
- .github/workflows/check-cli-rs.yml
push:
branches: [dev]
paths:
- packages/cli-rs/**
- packages/cli/src/**
- packages/client/**
- packages/plugin/**
- packages/protocol/**
- packages/schema/**
- packages/theme/**
- packages/tui/**
- packages/util/**
- bun.lock
- .github/workflows/check-cli-rs.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 45
defaults:
run:
working-directory: packages/cli-rs
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
# Bun and node_modules: the tests and check:drift run the TypeScript side they compare against.
- uses: ./.github/actions/setup-bun
# rustup reads rust-toolchain.toml; `bun run cargo` first fetches OpenTUI's native library from its release.
- run: rustup toolchain install
- run: bun run cargo fmt --check
- run: bun run cargo clippy --locked --workspace --all-targets -- -D warnings
# Every crate's tests, even after one fails, so one run shows every failure.
- run: bun run cargo test --locked --workspace --no-fail-fast
- run: bun run check:drift

View file

@ -1,126 +0,0 @@
name: cli-rs release
# Builds opencode-native, the Rust client in packages/cli-rs, natively on each runner below and keeps each archive as an
# artifact. A cli-rs-v<version> tag also publishes them as a GitHub release. It never becomes Latest: the monorepo's
# Latest release drives OpenCode's own update paths.
on:
push:
tags:
- "cli-rs-v*"
pull_request:
paths:
- .github/workflows/release-cli-rs.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Zig links Linux against glibc 2.17, OpenTUI's floor. zig_sha is the archive's, from ziglang.org.
- runner: ubuntu-24.04
target: x86_64-unknown-linux-gnu
zig: x86_64-linux-gnu.2.17
zig_sha: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
zig: aarch64-linux-gnu.2.17
zig_sha: a1546d5646eb184437918d6635ca6b762a0e889eac09cef720ee7a1ed3fe7795
- { runner: macos-15-intel, target: x86_64-apple-darwin }
- { runner: macos-15, target: aarch64-apple-darwin }
- { runner: windows-2025, target: x86_64-pc-windows-msvc, exe: .exe }
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
defaults:
run:
shell: bash
working-directory: packages/cli-rs
env:
OPENCODE_NATIVE_COMMIT: ${{ github.sha }}
CARGO_PROFILE_DIST_STRIP: symbols
MACOSX_DEPLOYMENT_TARGET: "13.0"
# No Visual C++ runtime to install beside the .exe.
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS: -C target-feature=+crt-static
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: package.json
# The version opencode-native --version prints: the tag's, or 0.0.0-<commit> for any other run.
- name: Version
run: |
version=0.0.0-$GITHUB_SHA
if [[ $GITHUB_REF == refs/tags/cli-rs-v* ]]; then version=${GITHUB_REF_NAME#cli-rs-v}; fi
echo "OPENCODE_VERSION=$version" >> "$GITHUB_ENV"
# Zig 0.17.1 as the C and C++ compiler and the linker. The wrapper drops flags zig rejects: cc's --target, and
# rustc's Cortex-A53 erratum fix on aarch64.
- if: matrix.zig
working-directory: ${{ runner.temp }}
run: |
file=zig-$(uname -m)-linux-0.17.1
curl -fsSL --retry 3 -o zig.tar.xz "https://ziglang.org/download/0.17.1/$file.tar.xz"
echo "${{ matrix.zig_sha }} zig.tar.xz" | sha256sum -c
tar -xJf zig.tar.xz
for tool in cc c++; do
cat > "zig-$tool" <<EOF
#!/bin/sh
for a; do shift; case \$a in --target=*|-Wl,--fix-cortex-a53-843419) ;; *) set -- "\$@" "\$a" ;; esac; done
exec "$PWD/$file/zig" $tool -target ${{ matrix.zig }} "\$@"
EOF
chmod +x "zig-$tool"
done
triple=$(tr a-z- A-Z_ <<< "${{ matrix.target }}")
{ echo "CARGO_TARGET_${triple}_LINKER=$PWD/zig-cc"; echo "CC_${triple,,}=$PWD/zig-cc"
echo "CXX_${triple,,}=$PWD/zig-c++"; echo "CXXSTDLIB_${triple,,}=c++"; } >> "$GITHUB_ENV"
# rustup reads rust-toolchain.toml; `bun run cargo` first fetches OpenTUI's native library from its release.
- run: rustup toolchain install
- run: bun run cargo build --locked --profile dist --bin opencode-native
- name: Check glibc 2.17 and no libstdc++
if: matrix.zig
run: "! readelf -dV target/dist/opencode-native | grep -E 'GLIBC_2\\.(1[89]|[2-9][0-9])|libstdc\\+\\+'"
- name: Package
run: |
name=opencode-native-$OPENCODE_VERSION-${{ matrix.target }}
mkdir -p "dist/$name"
cp "target/dist/opencode-native${{ matrix.exe }}" "dist/$name/"
# Our licence, and OpenTUI's licences (FFmpeg's among them) from its native release zip.
cp ../../LICENSE "dist/$name/"
cp -r .opentui/*/host/licenses "dist/$name/"
tar -C dist -czf "dist/$name.tar.gz" "$name"
ls -l "dist/$name" "dist/$name.tar.gz"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-native-${{ matrix.target }}
path: packages/cli-rs/dist/*.tar.gz
if-no-files-found: error
compression-level: 0
release:
needs: build
if: startsWith(github.ref, 'refs/tags/cli-rs-v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: opencode-native-*
merge-multiple: true
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
run: |
sha256sum ./*.tar.gz > SHA256SUMS
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --latest=false \
--title "opencode-native ${GITHUB_REF_NAME#cli-rs-v}" --notes "The Rust client (packages/cli-rs) at $GITHUB_SHA." \
./*.tar.gz SHA256SUMS

View file

@ -2,17 +2,8 @@ name: triage-close-issues
on:
schedule:
- cron: "0 2 * * *" # Daily at 2:00 AM UTC
- cron: "0 2 * * *" # Daily at 2:00 AM
workflow_dispatch:
inputs:
dry-run:
description: "Log matching issues without closing them"
type: boolean
default: true
concurrency:
group: triage-close-issues
cancel-in-progress: false
jobs:
close:
@ -27,12 +18,7 @@ jobs:
with:
bun-version: latest
- name: Close stale waiting-for-info issues
- name: Close stale issues
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
args=()
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs['dry-run'] }}" != "false" ]; then
args+=("--dry-run")
fi
bun script/github/close-issues.ts "${args[@]}"
run: bun script/github/close-issues.ts

View file

@ -1,397 +0,0 @@
name: triage-close-linked
# Closes what GitHub native auto-close misses on merge into the default branch:
# - additional issues in lists ("Fixes #1, #2 and #3" -> closes #2 and #3; GitHub closes #1)
# - superseded pull requests ("Supersedes #4", "Replaces #5")
#
# Runs entirely against the GitHub API with no checkout, so pull_request_target is safe.
permissions:
contents: read
on:
pull_request_target:
types: [closed]
workflow_dispatch:
inputs:
pr_number:
description: "Merged PR whose description to read"
required: true
type: string
dry_run:
description: "Log targets without closing them"
required: false
type: boolean
default: true
jobs:
close-linked:
if: >
github.repository == 'anomalyco/opencode' &&
(github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true)
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
issues: write
pull-requests: write
steps:
- name: Close linked issues and superseded PRs
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const ISSUE_KEYWORDS = new Set([
"close", "closes", "closed",
"fix", "fixes", "fixed",
"resolve", "resolves", "resolved",
]);
const PR_KEYWORDS = new Set([
"supersede", "supersedes", "superseded",
"replace", "replaces", "replaced",
]);
const KEYWORDS = new Set([...ISSUE_KEYWORDS, ...PR_KEYWORDS]);
const HEDGES = new Set([
"may", "might", "could", "would", "possibly", "probably", "potentially",
"maybe", "perhaps", "hopefully", "likely", "unlikely", "partially", "partly", "partial",
]);
const SUBORDINATORS = new Set(["if", "whether", "when", "whenever", "once", "until", "unless", "before", "after"]);
const DISQUALIFIERS = new Set([
"not", "never", "neither", "nor", "without", "cannot", "can't", "doesn't", "don't",
"won't", "didn't", "isn't", "wasn't", "hasn't", "haven't", "hadn't", "wouldn't",
"couldn't", "shouldn't", "mightn't", "mustn't",
...HEDGES,
...SUBORDINATORS,
"the", "a", "an", "of", "on", "in", "by", "from", "with", "for", "than",
]);
const BASE_FORMS = new Set(["close", "fix", "resolve", "supersede", "replace"]);
const VERB_MARKERS = new Set(["does", "do", "did", "and"]);
const DETERMINERS = new Set(["this", "that", "the", "a", "an"]);
const INTERVENING = new Set([
"also", "fully", "completely", "entirely", "actually", "really", "yet", "directly", "properly",
"have", "has", "had",
]);
const MAX_TARGETS = 10;
function stripNonProse(body) {
const lines = body.replaceAll("\r\n", "\n").split("\n");
const kept = [];
let fence = null;
let inComment = false;
let paragraph = false;
for (const line of lines) {
if (inComment) {
const end = line.indexOf("-->");
if (end === -1) { kept.push(""); continue; }
inComment = false;
kept.push(line.slice(end + 3));
continue;
}
const trimmed = line.trim();
if (fence !== null) {
if (trimmed.startsWith(fence) && [...trimmed].every(c => c === fence[0])) fence = null;
paragraph = false;
kept.push("");
continue;
}
if (trimmed === "") { paragraph = false; kept.push(""); continue; }
// Skip 4-space or tab indented code blocks outside a paragraph.
if (!paragraph && (/^ {4}/.test(line) || line.startsWith("\t"))) {
kept.push("");
continue;
}
const fenceMatch = /^(`{3,}|~{3,})/.exec(trimmed);
if (fenceMatch && (fenceMatch[1][0] === "~" || !trimmed.slice(fenceMatch[1].length).includes("`"))) {
fence = fenceMatch[1];
paragraph = false;
kept.push("");
continue;
}
if (trimmed.startsWith(">")) { paragraph = false; kept.push(""); continue; }
// Skip markdown task list items like "- [ ] Fix #99".
if (/^[-*+]\s+\[[ xX]\]/.test(trimmed)) { paragraph = false; kept.push(""); continue; }
// Strip inline code spans BEFORE HTML comments so `<!--` in backticks is not a comment.
let cleaned = line.replace(/`[^`\n]+`/g, " code ");
while (cleaned.includes("<!--")) {
const start = cleaned.indexOf("<!--");
const end = cleaned.indexOf("-->", start + 4);
if (end === -1) {
cleaned = cleaned.slice(0, start);
inComment = true;
break;
}
cleaned = cleaned.slice(0, start) + " " + cleaned.slice(end + 3);
}
paragraph = !/^#{1,6}\s/.test(trimmed);
kept.push(cleaned);
}
let text = kept.join("\n");
text = text.replace(/~~[^~\n]+~~/g, " ");
text = text.replace(/<(?:s|del|strike)\b[^>]*>[\s\S]*?<\/(?:s|del|strike)>/gi, " ");
return text;
}
function tokenize(text) {
const tokens = [];
let i = 0;
while (i < text.length) {
const c = text[i];
if (c === "\n") {
if (tokens.at(-1)?.kind === "newline") tokens[tokens.length - 1] = { kind: "break" };
else if (tokens.at(-1)?.kind !== "break") tokens.push({ kind: "newline" });
i++;
continue;
}
if (c.trim() === "") { i++; continue; }
const urlMatch = /^https?:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/(?:issues|pull)\/(\d+)(?![\w])/i.exec(text.slice(i));
if (urlMatch) {
tokens.push({ kind: "ref", repository: urlMatch[1].toLowerCase(), number: Number(urlMatch[2]) });
i += urlMatch[0].length;
continue;
}
const repoRefMatch = /^([\w.-]+\/[\w.-]+)#(\d+)(?![\w'\u2019])/.exec(text.slice(i));
if (repoRefMatch) {
tokens.push({ kind: "ref", repository: repoRefMatch[1].toLowerCase(), number: Number(repoRefMatch[2]) });
i += repoRefMatch[0].length;
continue;
}
const bareRefMatch = /^#(\d+)(?![\w'\u2019])/.exec(text.slice(i));
if (bareRefMatch) {
tokens.push({ kind: "ref", repository: null, number: Number(bareRefMatch[1]) });
i += bareRefMatch[0].length;
continue;
}
const wordMatch = /^[A-Za-z][A-Za-z0-9'\u2019-]*/.exec(text.slice(i));
if (wordMatch) {
tokens.push({ kind: "word", text: wordMatch[0].toLowerCase().replaceAll("\u2019", "'") });
i += wordMatch[0].length;
continue;
}
tokens.push({ kind: "punct", text: c });
i++;
}
return tokens;
}
const isPunct = (t, s) => t?.kind === "punct" && t.text === s;
const isWord = (t, s) => t?.kind === "word" && t.text === s;
const skipEmph = (tokens, i) => { while (isPunct(tokens[i], "*") || isPunct(tokens[i], "_")) i++; return i; };
const skipEmphBack = (tokens, i) => { while (i >= 0 && (isPunct(tokens[i], "*") || isPunct(tokens[i], "_"))) i--; return i; };
const skipInterveningBack = (tokens, i) => {
for (;;) {
i = skipEmphBack(tokens, i);
if (i < 0 || tokens[i].kind !== "word" || !INTERVENING.has(tokens[i].text)) return i;
i--;
}
};
const endsWithRef = (tokens, k) => {
const p = skipEmphBack(tokens, k);
const t = tokens[p];
if (!t) return false;
if (t.kind === "ref") return true;
if (isPunct(t, ">")) return tokens[p - 1]?.kind === "ref" && isPunct(tokens[p - 2], "<");
if (isPunct(t, ")")) {
if (tokens[p - 1]?.kind === "ref" && isPunct(tokens[p - 2], "(")) return true;
if (isPunct(tokens[p - 2], "(") && isPunct(tokens[p - 3], "]")) return tokens[p - 4]?.kind === "ref" && isPunct(tokens[p - 5], "[");
}
return false;
};
// A continuation reference must terminate cleanly (end of text/line/clause or list separator),
// so "Fixes #12, #13 is tracked separately" does NOT close #13.
const endsCleanly = (tokens, j) => {
const next = tokens[skipEmph(tokens, j)];
if (!next || next.kind === "newline" || next.kind === "break") return true;
if (next.kind === "punct" && ".,;:)&".includes(next.text)) return true;
if (isWord(next, "and")) return true;
return false;
};
function isClosingStatement(tokens, index, keyword) {
let k = skipInterveningBack(tokens, index - 1);
// Skip parenthetical / dash / colon lead-ins from a reference ("Reverts #100 (fixes #99)", "TODO: fix #99").
if (isPunct(tokens[k], ":") && tokens[k - 1]?.kind === "word" && ["todo", "note", "fyi"].includes(tokens[k - 1].text)) return false;
if (tokens[k]?.kind === "punct" && "(—–-".includes(tokens[k].text)) {
let q = skipInterveningBack(tokens, k - 1);
while (tokens[q]?.kind === "punct" && "-—–".includes(tokens[q].text)) q = skipInterveningBack(tokens, q - 1);
if (endsWithRef(tokens, q)) return false;
}
if (endsWithRef(tokens, k)) return false;
const lineStart = tokens[k]?.kind === "newline" || tokens[k]?.kind === "break" || k < 0;
if (tokens[k]?.kind === "newline") {
const e = skipEmphBack(tokens, k - 1);
const w = skipInterveningBack(tokens, e);
if (w < e && endsWithRef(tokens, w)) return false;
k = w;
}
const before = tokens[k];
if (!before || before.kind !== "word") return true;
if (before.text === "which" || before.text === "that") {
let p = skipInterveningBack(tokens, k - 1);
while (tokens[p]?.kind === "newline" || (tokens[p]?.kind === "punct" && ",(;:-\u2013\u2014".includes(tokens[p].text))) {
p = skipInterveningBack(tokens, p - 1);
}
if (endsWithRef(tokens, p)) return false;
}
if (DISQUALIFIERS.has(before.text)) return false;
let p = skipInterveningBack(tokens, k - 1);
if (tokens[p]?.kind === "newline") p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "word" && DETERMINERS.has(tokens[p].text)) {
p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "newline") p = skipInterveningBack(tokens, p - 1);
}
if (isPunct(tokens[p], ",")) p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "word" && (SUBORDINATORS.has(tokens[p].text) || HEDGES.has(tokens[p].text))) return false;
if (!BASE_FORMS.has(keyword)) return true;
return lineStart ? before.text !== "to" : VERB_MARKERS.has(before.text);
}
function readRef(tokens, index) {
index = skipEmph(tokens, index);
const t = tokens[index];
if (!t) return null;
if (t.kind === "ref") return { token: t, end: index + 1 };
if (isPunct(t, "<") && tokens[index + 1]?.kind === "ref" && isPunct(tokens[index + 2], ">")) {
return { token: tokens[index + 1], end: index + 3 };
}
if (isPunct(t, "[")) {
let close = index + 1;
while (close < tokens.length && close < index + 10 && !isPunct(tokens[close], "]")) {
if (tokens[close].kind === "newline" || tokens[close].kind === "break") return null;
close++;
}
if (isPunct(tokens[close], "]") && isPunct(tokens[close + 1], "(") && isPunct(tokens[close + 3], ")")) {
if (tokens[close + 2]?.kind === "ref") return { token: tokens[close + 2], end: close + 4 };
if (close === index + 2 && tokens[index + 1]?.kind === "ref") return { token: tokens[index + 1], end: close + 4 };
}
}
return null;
}
function findLinkedReferences(body, repository) {
const self = repository.toLowerCase();
const tokens = tokenize(stripNonProse(body));
const found = [];
let i = 0;
while (i < tokens.length) {
const token = tokens[i];
if (token.kind !== "word" || !KEYWORDS.has(token.text) || !isClosingStatement(tokens, i, token.text)) {
i++;
continue;
}
const targetKind = PR_KEYWORDS.has(token.text) ? "pull" : "issue";
let j = i + 1;
if (isPunct(tokens[j], ":")) j++;
let ref = readRef(tokens, j);
if (!ref) { i++; continue; }
let pos = 0;
for (;;) {
// For issue keywords, GitHub natively closes pos === 0 when bare #N/URL/owner/repo#N.
// Still emit pos === 0 only for markdown-link/PR keywords, or list continuations (pos > 0),
// avoiding racing GitHub native auto-close.
const nativeClose = targetKind === "issue" && pos === 0 && tokens[skipEmph(tokens, j)]?.kind === "ref";
if (!nativeClose && (pos === 0 || endsCleanly(tokens, ref.end))) {
found.push({ repository: ref.token.repository ?? self, number: ref.token.number, keyword: token.text, targetKind });
}
j = ref.end;
pos++;
let k = skipEmph(tokens, j);
let sep = false;
if (isPunct(tokens[k], ",")) { k++; sep = true; }
if (isWord(tokens[k], "and") || isPunct(tokens[k], "&")) { k++; sep = true; }
if (!sep) break;
ref = readRef(tokens, k);
if (!ref) break;
if (!endsCleanly(tokens, ref.end)) break;
}
i = j;
}
return found;
}
const { owner, repo } = context.repo;
const repository = `${owner}/${repo}`;
const expectedRepoUrl = `https://api.github.com/repos/${repository.toLowerCase()}`;
const inputs = context.payload.inputs ?? {};
const event = context.payload.pull_request;
const prNumber = event?.number ?? Number(inputs.pr_number);
const dryRun = String(inputs.dry_run ?? "false") === "true";
if (!Number.isInteger(prNumber) || prNumber <= 0) {
core.setFailed(`Invalid pull request number: ${inputs.pr_number}`);
return;
}
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber });
if (!pr.merged) {
core.info(`#${prNumber}: not merged, skipping`);
return;
}
const defaultBranch = pr.base.repo.default_branch;
if (pr.base.ref !== defaultBranch) {
core.info(`#${prNumber}: merged into ${pr.base.ref}, not ${defaultBranch}, skipping`);
return;
}
const prAuthor = pr.user?.login?.toLowerCase();
const trustedAuthor = ["OWNER", "MEMBER"].includes(pr.author_association);
const body = (event ? event.body : pr.body) ?? "";
const seen = new Set();
const targets = [];
for (const ref of findLinkedReferences(body, repository)) {
if (ref.repository !== repository.toLowerCase()) continue;
if (ref.number === prNumber || seen.has(ref.number)) continue;
seen.add(ref.number);
targets.push(ref);
}
if (targets.length === 0) {
core.info(`#${prNumber}: no additional linked references to close`);
return;
}
if (targets.length > MAX_TARGETS) {
core.warning(`#${prNumber}: found ${targets.length} references (cap ${MAX_TARGETS}); refusing bulk close`);
return;
}
let failed = 0;
for (const ref of targets) {
let item;
try {
({ data: item } = await github.rest.issues.get({ owner, repo, issue_number: ref.number }));
} catch (error) {
if (error.status === 404 || error.status === 410) continue;
failed++;
core.error(`#${ref.number}: ${error.message}`);
continue;
}
if (item.repository_url && item.repository_url.toLowerCase() !== expectedRepoUrl) continue;
if (item.state !== "open") continue;
const isPull = item.pull_request !== undefined;
// Only close issues for close/fix/resolve, and only close PRs for supersede/replace.
if (ref.targetKind === "issue" && isPull) continue;
if (ref.targetKind === "pull" && !isPull) continue;
// Only allow an outside contributor PR to supersede their own PR.
if (isPull && !trustedAuthor && item.user?.login?.toLowerCase() !== prAuthor) {
core.info(`#${ref.number}: skipping supersede of another contributor PR by non-member`);
continue;
}
if (dryRun) {
core.info(`[dry-run] Would close ${isPull ? "PR" : "issue"} #${ref.number} (${ref.keyword} in #${prNumber})`);
continue;
}
try {
if (isPull) {
await github.rest.pulls.update({ owner, repo, pull_number: ref.number, state: "closed" });
} else {
await github.rest.issues.update({ owner, repo, issue_number: ref.number, state: "closed", state_reason: "completed" });
}
await github.rest.issues.createComment({
owner,
repo,
issue_number: ref.number,
body: isPull ? `Superseded by #${prNumber}.` : `Closed as completed by #${prNumber}.`,
});
} catch (error) {
failed++;
core.error(`#${ref.number}: ${error.message}`);
}
}
if (failed > 0) core.setFailed(`${failed} of ${targets.length} references could not be closed`);

View file

@ -1,90 +0,0 @@
name: triage-slop
permissions:
contents: read
on:
pull_request_target:
types: [labeled]
jobs:
close-slop:
runs-on: ubuntu-latest
if: >
github.event.label.name == 'slop' &&
github.repository == 'anomalyco/opencode' &&
github.event.pull_request.state == 'open'
timeout-minutes: 5
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Close, scrub, and comment on AI slop PR
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const pr = context.payload.pull_request;
const pullNumber = pr.number;
const login = pr.user?.login?.toLowerCase();
// Never touch merged/closed PRs, bots, or team members.
if (pr.state !== "open" || pr.merged) return;
if (pr.user?.type === "Bot" || ["OWNER", "MEMBER"].includes(pr.author_association)) {
core.info(`Skipping #${pullNumber}: author ${pr.user?.login} is exempt`);
return;
}
try {
const { data: file } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: ".github/TEAM_MEMBERS",
ref: "dev",
});
const members = new Set(
Buffer.from(file.content, "base64").toString("utf8").split("\n").map((l) => l.trim().toLowerCase()).filter(Boolean),
);
if (login && members.has(login)) {
core.info(`Skipping #${pullNumber}: author ${pr.user?.login} is in TEAM_MEMBERS`);
return;
}
} catch (error) {
core.warning(`Could not read TEAM_MEMBERS: ${error.message}`);
return;
}
// Close and scrub first so a failed update never leaves a misleading closed comment.
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullNumber,
title: 'ai slop',
body: 'This pull request was closed as AI slop and its title/description were cleared to avoid misleading reviewers. If you believe this was closed in error, leave a comment explaining why.',
state: 'closed',
});
const marker = "<!-- triage-slop -->";
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullNumber,
per_page: 100,
});
if (comments.some((c) => (c.body || "").includes(marker))) return;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullNumber,
body: [
marker,
'This pull request has been closed because it was flagged as low-quality AI slop.',
'',
'Common reasons include:',
'- Failing to verify the underlying problem exists',
'- Failing to test that the change actually fixes it',
'- Making unverified assumptions about the codebase or adding speculative/misleading changes',
'',
'If you believe this was closed in error, leave a comment explaining how you reproduced and verified the change.',
].join('\n'),
});

View file

@ -13,12 +13,12 @@ Requirements:
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
- Also preserve every term listed in the Do-Not-Translate glossary below.
- Also apply the matching locale file when available: `.opencode/glossary/<locale>.md` for the marketing site, `services/site/src/docs/i18n/glossary/<locale>.md` for the docs (for example, `zh-cn.md` and `zh.md`).
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`).
- Do not modify fenced code blocks.
- Output ONLY the translation (no commentary).
If the target locale is missing, ask the user to provide it.
If no locale-specific glossary exists, use the shared glossary only.
If no locale-specific glossary exists, use the global glossary only.
---
@ -35,31 +35,6 @@ When translating the marketing site (`services/site/src/i18n/<locale>.ts` and `s
---
# V2 Docs Pages (opencode.ai/docs)
When translating a page of the latest docs (`services/site/src/docs/content`):
- Translate the English page at `src/docs/content/<same path>.mdx` into `src/docs/content/<locale>/<same path>.mdx`, using the site's language folder (`zh`, `zht`, `ko`, `de`, `es`, `fr`, `it`, `da`, `ja`, `pl`, `ru`, `uk`, `ar`, `no`, `br`, `th`, `tr`). English stays at the root.
- Translate the frontmatter's `title` and `description`; keep every other key and value as written.
- Keep the English heading structure: the same headings, in the same order and depth. Translated pages reuse the English heading ids, so `#anchors` keep working in every language. A translation whose heading depths differ is treated as stale: the build warns, the page shows the English fallback, and `check-translations.ts` lists it. If the English page gains a heading, update the translation's headings in the same place.
- Never call OpenCode an "AI coding agent": it is an "open source coding agent" in every language. Do not add "AI" to that phrase; "AI models" and "AI providers" are fine.
- Keep every MDX component, prop, code block, inline code span, path, URL, command, flag, config key and product name exactly as written. Translate only prose, table headers and code-block captions.
- Keep internal links docs-root-relative (`/config`): the site adds the page's language prefix. Do not write `/docs/...`, `/<locale>/docs/...` or `https://opencode.ai/docs/...`.
- A page you do not translate is served in English under that language's chrome, with a notice, so partial translations are safe.
- From `services/site`, run `bun src/docs/script/check-translations.ts <locale>` to list missing pages and pages whose English changed since their stamp, then run it with `--stamp` once the language is up to date. Stamps live in `src/docs/i18n/stamps/<locale>.json`.
## Review before shipping a language
- Compare every page paragraph by paragraph, list item, table row and code block against the CURRENT English page, not an older translation, and re-read pages whose English changed since their stamp.
- Read the result as native prose: remove translationese and literal calques, and keep the tone of the English page.
- Check numbers, prices, model IDs and version numbers against the English.
- Keep proper nouns, identifiers and code exactly as written, per the shared rules in `src/docs/i18n/glossary.md`.
- Keep the English heading order, depth and count; anchors depend on it.
- Apply the shared rules in `src/docs/i18n/glossary.md` and the language's terms in `src/docs/i18n/glossary/<locale>.md`.
- Spot-check two or three rendered pages in the built site: title, sidebar and code blocks.
---
# Locale-Specific Glossaries
When a locale glossary exists, use it to:

View file

@ -1,43 +0,0 @@
# uk Glossary
## Sources
- Review of the desktop app's Ukrainian UI copy
## Do Not Translate (Locale Additions)
- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
- `OpenCode CLI`
- `CLI`, `TUI`, `MCP`, `LSP`, `OAuth` (never transliterate them as `МКП` or `ЛСП`)
- Commands, flags, file paths, and code literals (keep exactly as written)
## Preferred Terms
| English | Preferred | Notes |
| ------------------------------------------------ | ------------------------------ | --------------------------------------------------------------------------- |
| session | сесія | Not `сеанс` |
| project | проєкт | 2019 orthography, not `проект` |
| worktree | робоче дерево | Not `робоча область` or `робоче місце` |
| Experimental (settings tab) | Експериментальні функції | Not the bare adjective `Експериментальний` |
| shell (tool, activity category, mode) | Термінал | `Використано: Читання, Запис, Термінал`; `режим термінала` |
| shell (a running command or process) | команда | `3 команди`, `запущено 2 команди`, `Очікування команди`, `Зупинити команду` |
| shell command | команда термінала | `Введіть команду термінала…` |
| shell (bash, zsh, PowerShell chosen in settings) | оболонка | Only where the user picks the shell program itself |
| terminal (genitive) | термінала | Not `терміналу` |
| About (settings tab) | Про OpenCode | Not a bare `Про` |
| third-party notices | ліцензії сторонніх компонентів | Not `повідомлення третіх сторін` |
| Released under the MIT License | Поширюється за ліцензією MIT | |
## Guidance
- Prefer natural Ukrainian phrasing over literal translation
- Keep tone clear and direct in UI labels and docs prose
- Fill every plural form the locale uses: `.one`, `.few`, `.many`, `.other`
- Keep the English punctuation of short taglines when it reads naturally (for example `OpenCode, агент кодування з відкритим кодом`)
- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
## Avoid
- Avoid `оболонка` for shell activity, counts, and tool labels; it reads as jargon next to `Читання` and `Запис`
- Avoid translating product and protocol names that are fixed identifiers
- Avoid mixing multiple Ukrainian terms for the same recurring UI action once a preferred term is established

View file

@ -1,69 +0,0 @@
# vi Glossary
## Sources
- PR #55925: https://github.com/anomalyco/opencode/pull/55925 (terminology fixes in this file)
- PR #55922: https://github.com/anomalyco/opencode/pull/55922 (Vietnamese Console locale)
- Existing Vietnamese copy on dev: `packages/app/src/runtime/i18n/vi.ts`, `packages/ui/src/i18n/vi.ts`, `README.vi.md`
## Do Not Translate (Locale Additions)
- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
- `Zen`, `Go`, `Go Plus`, `Black`, `Enterprise`, `Models.dev`
- `TUI`, `LSP`, `LLM`, `API`, `CLI`, `MCP`, `SSO`, `SDK`, `IDE`, `SSE`, `ZDR`, `MIT License`
- `terminal`, `desktop`, `web`, `shell`
- Plan names such as `Black 20`, `Black 100`, `Black 200`
- Commands, flags, file paths, and code literals (keep exactly as written)
## Preferred Terms
| English | Preferred | Notes |
| -------------------------- | --------------------- | -------------------------------------------------------- |
| coding agent (the product) | `trợ lý lập trình AI` | Matches the tagline already used in `README.vi.md` |
| agent (an instance) | `tác nhân` | Used in app UI copy; keep consistent with `packages/app` |
| session | `phiên` | Matches `packages/app/src/runtime/i18n/vi.ts` |
| file | `tệp` | `tệp đính kèm` for attachment |
| provider | `nhà cung cấp` | |
| model | `mô hình` | |
| docs | `tài liệu` | |
| download | `tải về` | |
| sign in / log in | `đăng nhập` | |
| sign up | `đăng ký` | |
| subscribe | `đăng ký` | Prefer `đăng ký gói ...` for plans |
| cancel | `hủy` | |
| privacy | `quyền riêng tư` | |
| settings | `cài đặt` | |
| usage limits | `hạn mức sử dụng` | |
| top up (balance/credit) | `nạp thêm` | `nạp thêm số dư` / `nạp thêm tín dụng` |
| refund | `hoàn tiền` | |
| waitlist | `danh sách chờ` | |
| server | `máy chủ` | |
| workspace | `không gian làm việc` | |
| brand | `thương hiệu` | |
| changelog | `nhật ký thay đổi` | |
| local models | `mô hình chạy cục bộ` | |
| prompt | `lời nhắc` | |
| token | `token` | Keep in English; do not use `mã thông báo` |
| skill | `kỹ năng` | Matches the app UI label for the skills tab |
| plugin | `tiện ích mở rộng` | Matches the app UI label for extensions |
| command | `lệnh` | |
| theme | `giao diện` | |
| formatter | `trình định dạng` | |
| compaction | `nén` | |
| attachment | `tệp đính kèm` | |
| data | `dữ liệu` | |
## Guidance
- Prefer natural Vietnamese phrasing over literal translation; short labels stay short
- Keep language names static/native in language pickers: always `Tiếng Việt`, never a translated form
- Keep `$` amounts in the original currency notation and numbers, e.g. `$10/month`
- Vietnamese has no grammatical plural, so `*_one` and `*_other` strings may be identical
- Write dates and numbers with the Latin digits used elsewhere in the UI
## Avoid
- Avoid translating language names differently per current locale in language lists
- Avoid `mã nguồn` for `token` and `token` for `source code`
- Avoid Sino-Vietnamese calques such as `chủ đề` for `topic` when `chủ đề` already means theme
- Avoid translating `Zen`, `Go`, and `Black` as generic words like `đỉnh cao` or `đi`

View file

@ -15,14 +15,14 @@ Read these first rather than repeating them:
## Stories and `mount`
- **Location.** Put the Lab page next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-plugins`. The story server indexes `*.lab.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each page's `export default { title, id }` and its `export const` states (the stories a test mounts) from source. Name a page that needs the story server's fixture runtime `*.standalone.lab.tsx`: the in-app Lab skips those.
- **Story ID.** It is the meta `id` if one is set (`packages/session-ui/src/components/session-review.lab.tsx:25`). Otherwise it is the kebab-cased `title`, then `--`, then the kebab-cased export. Check it at `http://127.0.0.1:6006/?id=<id>` on a running story server (`bun --cwd packages/stories dev`). A wrong ID renders nothing (the page throws `No story has the id …`), so `mount` waits out its full 30 s root wait (`story.ts:39`) and then fails.
- **Location.** Put the story next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-plugins`. The story server indexes `*.stories.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each file's `export default { title, id }` and its `export const` stories from source.
- **Story ID.** It is the meta `id` if one is set (`packages/session-ui/src/components/session-review.stories.tsx:25`). Otherwise it is the kebab-cased `title`, then `--`, then the kebab-cased export. Check it at `http://127.0.0.1:6006/?id=<id>` on a running story server (`bun --cwd packages/stories dev`). A wrong ID renders nothing (the page throws `No story has the id …`), so `mount` waits out its full 30 s root wait (`story.ts:39`) and then fails.
- **URL args.** `mount(id, { args, globals })` writes them into the URL as `key:value` pairs (`story.ts:20-36`). The frame reads every one: a value becomes a boolean or number when the story's own default for that key is one, `!true`/`!false`/`!null`/`!undefined` keep Storybook's meaning, and anything else stays text.
- Give every arg a typed default. With `args: { split: false }` (`session-review.lab.tsx:129`), `split:false` arrives as a boolean.
- Give every arg a typed default. With `args: { split: false }` (`session-review.stories.tsx:129`), `split:false` arrives as a boolean.
- A value containing `;` would split the pair list, so pick such values inside the story, from a `scenario`-style arg.
- **Globals** are `theme` (default `light`), `direction` and `locale` (`packages/stories/src/frame.tsx`).
- **Portaled UI.** `mount` returns `#story-root`. Dialogs, menus and drawers render outside it, so locate them from `page` (`packages/app/component-tests/composer.spec.ts:101-107`).
- **Server state** comes from the `resolve.alias` list in `packages/stories/vite.config.ts`, which points app server, SDK and sync modules at `packages/stories/mocks/app/**`. Extend a mock rather than adding a server. The app's Lab (`/components`) renders the same pages inside the real app instead, so a story must not depend on a mock-only export. Tests reset mock state on every mount.
- **Server state** comes from the `resolve.alias` list in `packages/stories/vite.config.ts`, which points app server, SDK and sync modules at `packages/stories/mocks/app/**`. Extend a mock rather than adding a server. The app's components lab renders the same stories inside the real app instead, so a story must not depend on a mock-only export. Tests reset mock state on every mount.
- **Requests the mocks do not answer.** Route them with `page.route`. That includes server endpoints such as `/api/fs/read` (`packages/session-ui/component-tests/read-image.spec.ts:20`) and external URLs such as favicons (`packages/session-ui/component-tests/markdown.spec.ts:217`).
## Fixtures imported by URL
@ -44,10 +44,10 @@ Use these when the contract is not visible in a story, such as construction coun
## Vite pre-bundling and reloads
`packages/stories/vite.config.ts` sets `optimizeDeps.entries`: every `*.lab.tsx` and `*.worker.ts` under the four `src/` trees, every module a component spec names by a `./` or `../` string literal ending in `.ts`/`.tsx` (collected at the top of the file), and the frame's `index.html`. Vite pre-bundles their bare imports before the first page loads. A dependency the scan misses is found on first import instead. If that changes chunks already served, Vite logs `✨ optimized dependencies changed. reloading` and sends `full-reload` with path `*` to every page in every worker, and requests with a stale `?v=` hash get a 504 "Outdated Optimize Dep".
`packages/stories/vite.config.ts` sets `optimizeDeps.entries`: every `*.stories.tsx` and `*.worker.ts` under the four `src/` trees, every module a component spec names by a `./` or `../` string literal ending in `.ts`/`.tsx` (collected at the top of the file), and the frame's `index.html`. Vite pre-bundles their bare imports before the first page loads. A dependency the scan misses is found on first import instead. If that changes chunks already served, Vite logs `✨ optimized dependencies changed. reloading` and sends `full-reload` with path `*` to every page in every worker, and requests with a stale `?v=` hash get a 504 "Outdated Optimize Dep".
- **The bar is zero reloads.** A cold run of either suite should print neither `new dependencies optimized` nor `optimized dependencies changed`, so these lines are the signal to watch.
- **Keep new code reachable by the scan.** A module path built at runtime, in a template literal, or without its extension is not collected, and neither is a spec named other than `*.spec.ts`. Name Lab pages `*.lab.tsx`: the story index and the scan read only that extension. Name workers `*.worker.ts`, since the scan does not follow `new Worker(new URL(…))`. Add an `optimizeDeps.include` entry only for a dependency the scan cannot reach. Vite names it in `✨ new dependencies optimized: …`, and `DEBUG=vite:deps` replaces that line with scan and discovery detail.
- **Keep new code reachable by the scan.** A module path built at runtime, in a template literal, or without its extension is not collected, and neither is a spec named other than `*.spec.ts`. Name stories `*.stories.tsx`: the story index and the scan read only that extension. Name workers `*.worker.ts`, since the scan does not follow `new Worker(new URL(…))`. Add an `optimizeDeps.include` entry only for a dependency the scan cannot reach. Vite names it in `✨ new dependencies optimized: …`, and `DEBUG=vite:deps` replaces that line with scan and discovery detail.
- **Symptoms.** "page.evaluate: Execution context was destroyed", "Failed to fetch dynamically imported module …/@fs/…", or fixture state that is gone right after `mount` ("Registrations: 1" not found, an empty tab strip).
- **Only `mount()` survives a reload,** because it navigates back to the same URL. A reload loses everything set up after it: `page.evaluate` imports, mounted fixtures, state from earlier clicks, and the elements your locators pointed at. Another worker's discovery can trigger it at any moment.
- **Fix reloads in the scan, never with retries, timeouts or import order.** The import-everything-before-mount `Promise.all` in `browser-pane-restore.spec.ts:43-58` (comment at `:56`) only narrowed the window. Before the entries existed, that file's `:123` and `:150` were retried in 31 CI jobs each, and failed attempts cost about 39-47 s (Linux) and 34 s (Windows) of worker time per run.

View file

@ -11,7 +11,7 @@ Use one default ring when someone navigates focus to a control, not when they cl
- Use `:focus-visible` for the ring. Don’t use `:focus` to decide whether to show it. `base.css` supplies `outline: 2px solid var(--v2-border-border-focus); outline-offset: 2px` and a 4px radius for links.
- Offset: `2px` outward by default. `-2px` inset for full-width rows and for controls flush against an edge that clips or scrolls (segmented items, split buttons, titlebar buttons, clear buttons). No other offsets.
- Follow the control’s radius; give a square text action or link 4px where appropriate. Use a wrapper with `:has(> trigger:focus-visible)` when the wrapper owns the visible shape or the trigger’s ring would clip, as with tabs and Settings project cards. End the selector at the wrapper or its pseudo-element (`wrapper:has(…)::after`). A selector that continues after `:has()` (`wrapper:has(…) ~ other`) restyles everything inside the wrapper on each focus change; around the timeline that made scrolling hitch (`packages/app/AGENTS.md`, Timeline stability).
- Follow the control’s radius; give a square text action or link 4px where appropriate. Use a wrapper with `:has(> trigger:focus-visible)` when the wrapper owns the visible shape or the trigger’s ring would clip, as with tabs and Settings project cards.
- Outline only. Don't draw focus with `box-shadow`: Windows High Contrast removes shadows, so the ring disappears, and shadow rings looked different from every other ring.
- Rings appear and disappear instantly. Draw no outline at rest and leave `outline-color` out of `transition`; animating it from the default colour flashes black. Don't use `outline: 2px solid transparent` at rest: High Contrast turns it into a visible outline on every control.
- Keep a border that identifies an unfocused control. Where Chromium's forced colours remove the shadow that draws a control's edge, give it a system-colour border in `@media (forced-colors: active)`, separate from the ring, as switches and radios do.
@ -23,7 +23,7 @@ Use one default ring when someone navigates focus to a control, not when they cl
Chromium matches `:focus-visible` on every focused text field, and on anything that has focus once a key is pressed. A ring on a large surface then shows after a click, when the app moves focus there, and on returning to the window.
- A text field never draws the ring, the composer and Home search included. Focus shows as the caret and the field's focused border or background. Don't add ring state or pointer tracking to a field.
- A scroll area (the timeline, Home's list) takes focus from a click so the keyboard can scroll it, and draws no ring. It is not a Tab stop: Tab moves between the items inside it, and they show the ring. In a session, PageUp and PageDown in the composer page the timeline.
- A scroll area (the timeline, Home's list) takes focus so the keyboard can scroll it, and draws no ring. Show focus on the items inside it instead.
- Moving a screen reader’s reading cursor alone does not move DOM focus.
## Rows
@ -62,12 +62,9 @@ Chromium matches `:focus-visible` on every focused text field, and on anything t
- Move focus in response to a user action or to recover focus when its target disappears. Background updates, streamed output, toasts, and incoming prompts must not steal focus.
- If a focused item is closed or deleted, move focus to the next place the user can continue the same task: the next or previous item in the same list, or a stable fallback such as the list heading or the control that opened it. Use the visually nearest control only when it serves that task. Don’t leave focus on `<body>`.
- Chromium drops focus to `<body>` without an event when the focused element is removed, disabled, or stops being editable. `packages/ui/src/context/focus-rescue.tsx` (installed in `AppBaseProviders`) recovers it inside a `data-focus-scope`: the next item, or the previous after the last, widening to the enclosing scope when the inner one is empty, and back to what had focus before when nothing is left. The control it moves focus to shows its ring only when Tab or an arrow key last moved focus; typing, shortcuts and a key pressed on a clicked control don't count. Mark a new list, strip, chip row or panel with `data-focus-scope` rather than adding per-feature focus code. Rescue never moves focus into a `role="tablist"`, because Kobalte tabs select themselves on focus, so don't mark a tab list as a scope. Items in an overlay leave the return to the overlay; rescue steps in only when the overlay's opener is gone too. Move focus explicitly when the task has a better target than the neighbour, such as the composer after the last chip.
- A row that scrolls out of a virtualized list is not a removed item. The list unmounts it with its focused control, and the rescue would then focus a control in another row, which scrolls the list to that row. The list gives focus to its own viewport first, with `preventScroll: true`, as `VirtualRow` does in `packages/app/src/session/timeline/virtualizer.tsx`. Do the same in a new virtualized list.
- `focus()` scrolls its target into view. Inside a scroll container, pass `{ preventScroll: true }` unless the reader must see that control next: keyboard navigation to it, or the item that takes the place of a removed one (`packages/app/AGENTS.md`, Timeline stability).
## Verify
- A story is optional, for visual checks such as clipping, colour, and forced colours. Use one if the repo has a suitable focus story, or a local one you don't commit; don't add a case for every fix. Test focus order, removal and restoration in the app with real input, not in a story.
- Use real keyboard and pointer input for the behaviour you changed. Check Tab and Shift+Tab for order and clipping, and when you replace a control, remove a ring or reuse a picker, run them through the whole changed flow and check both where focus lands and whether you can see it. Check arrow keys for composites, and shortcuts for programmatic focus. For overlay return, check keyboard open with Escape, keyboard open with a pointer dismissal, pointer open with a backdrop click, and pointer open with Escape. Forced focus shows appearance, not whether navigation or restoration works.
- After a change to focus in or near the timeline, click a tool header in it, then scroll up and down with the wheel. The timeline must follow the wheel.
- Use real keyboard and pointer input for the behaviour you changed. Check Tab and Shift+Tab for order and clipping, arrow keys for composites, and shortcuts for programmatic focus. For overlay return, check keyboard open with Escape, keyboard open with a pointer dismissal, pointer open with a backdrop click, and pointer open with Escape. Forced focus shows appearance, not whether navigation or restoration works.
- Check light, dark, and forced colours when the indicator or its background changes. Report Chromium forced-colours emulation (DevTools → Rendering → `forced-colors: active`) separately from native Windows High Contrast or assistive-technology testing.

View file

@ -2,5 +2,4 @@ sst-env.d.ts
packages/desktop/src/bindings.ts
packages/client/src/generated/
packages/client/src/generated-effect/
packages/core/src/plugin/skill/opencode/
packages/plugins/figma/skills/

View file

@ -2,63 +2,6 @@
Release notes for OpenCode V2, newest first.
## v2.4.1 — 2026-11-23
### Highlights
- **macOS 12 Session Fix**: OpenCode can save assistant messages again on the older SQLite version included with macOS 12. ([#65771](https://github.com/anomalyco/opencode/pull/65771))
- **Config-Only Providers Show Their Models**: Providers you set up only in your config, such as Ollama, now show their models in `/models` without a `/connect` login. ([#65793](https://github.com/anomalyco/opencode/pull/65793))
- **Unread `/btw` Answers**: When a side question finishes behind another side-panel tab, its tab shows an unread dot until you open it. ([#65821](https://github.com/anomalyco/opencode/pull/65821))
### Core
#### Improvements
- With `experimental.model_speeds` enabled, model service tiers are exposed as remembered speeds instead of separate model-picker entries. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
#### Bug fixes
- Fixed assistant messages failing to save on macOS 12 because its system SQLite does not support the JSON operator used in v2.4.0. ([#65771](https://github.com/anomalyco/opencode/pull/65771))
- Fixed compaction retaining more recent history than `keep.tokens`, including when a single newest message already exceeds the allowance. ([#65768](https://github.com/anomalyco/opencode/pull/65768))
- Fixed occasional extra cache cost in long goal sessions after a compaction. ([#65788](https://github.com/anomalyco/opencode/pull/65788))
### TUI
#### Improvements
- With `experimental.model_speeds` enabled, `/speed` and `/fast` list the current model’s service tiers and relative prices. The `speed.list` and `speed.cycle` keybinds are available without default bindings. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
#### Bug fixes
- Fixed `/models` hiding models from config-only providers such as Ollama when no `/connect` login exists. ([#65793](https://github.com/anomalyco/opencode/pull/65793))
### Desktop
#### Improvements
- With `experimental.model_speeds` enabled, models with service tiers have a speed dropdown beside the variant selector; `/speed` cycles through the available speeds. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
- Layout choices in Settings now use consistent navigation-card previews and accent styling. ([#65757](https://github.com/anomalyco/opencode/pull/65757), [#65800](https://github.com/anomalyco/opencode/pull/65800))
#### Bug fixes
- Fixed `/btw` answers completed behind another side-panel tab providing no unread indication. The tab now shows a dot until viewed. ([#65821](https://github.com/anomalyco/opencode/pull/65821))
- Fixed the timeline, Home list, file viewers and tool output adding invisible or oversized stops to keyboard Tab navigation. They remain focusable by clicking for keyboard scrolling. ([#65758](https://github.com/anomalyco/opencode/pull/65758), [#65785](https://github.com/anomalyco/opencode/pull/65785))
- Fixed unwanted focus rings around clicked Settings pages, error details, What’s New and the terminal, and corrected the split button’s focus-ring corners. ([#65783](https://github.com/anomalyco/opencode/pull/65783), [#65785](https://github.com/anomalyco/opencode/pull/65785))
- Fixed folder paths showing middle-truncation markers unnecessarily at fractional UI zoom levels. ([#65225](https://github.com/anomalyco/opencode/pull/65225))
### SDK
#### Bug fixes
- An aborted shared event subscription now stops immediately even when the source has already completed or failed with buffered events remaining. Thanks @chirag127. ([#65441](https://github.com/anomalyco/opencode/pull/65441))
### Extensions
#### Improvements
- Effect and Promise plugins can create, list and delete automations through `ctx.experimental.automation.{create,list,delete}`. ([#65747](https://github.com/anomalyco/opencode/pull/65747))
- `@opencode/plugin` now supports `@opentui/core` and `@opentui/solid` from version 0.8.0, allowing plugins capped below OpenTUI 0.9 to install again. ([#65819](https://github.com/anomalyco/opencode/pull/65819))
## v2.4.0 — 2026-11-23
### Highlights

340
bun.lock
View file

@ -29,7 +29,7 @@
},
"packages/ai": {
"name": "@opencode/ai",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@aws-sdk/credential-providers": "3.1057.0",
"@opencode/schema": "workspace:*",
@ -51,12 +51,13 @@
},
"packages/app": {
"name": "@opencode/app",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@corvu/drawer": "catalog:",
"@dnd-kit/abstract": "0.5.0",
"@dnd-kit/dom": "0.5.0",
"@dnd-kit/solid": "0.5.0",
"@ibm/plex": "6.4.1",
"@kobalte/core": "catalog:",
"@opencode/client": "workspace:*",
"@opencode/gui-plugins": "workspace:*",
@ -106,7 +107,7 @@
},
"packages/cli": {
"name": "@opencode/cli",
"version": "2.4.1",
"version": "2.4.0",
"bin": {
"opencode": "./bin/opencode.cjs",
"opencode2": "./bin/opencode2.cjs",
@ -187,7 +188,7 @@
},
"packages/client": {
"name": "@opencode/client",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/protocol": "workspace:*",
"@opencode/schema": "workspace:*",
@ -213,11 +214,11 @@
},
"packages/codemode": {
"name": "@opencode/codemode",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"acorn": "8.15.0",
"effect": "catalog:",
"psychoscript": "0.3.0",
"psychoscript": "0.2.1",
},
"devDependencies": {
"@tsconfig/bun": "catalog:",
@ -227,7 +228,7 @@
},
"packages/core": {
"name": "@opencode/core",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@ai-sdk/provider": "3.0.19",
"@effect/platform-node": "catalog:",
@ -294,7 +295,6 @@
"@types/which": "3.0.4",
"drizzle-kit": "catalog:",
"fast-check": "catalog:",
"miniflare": "4.20260708.1",
},
"optionalDependencies": {
"@number0/iroh": "1.2.0",
@ -308,11 +308,10 @@
},
"packages/data/app": {
"name": "@opencode/data-app",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@kobalte/core": "catalog:",
"@opencode/data-core": "workspace:*",
"@opencode/locale": "workspace:*",
"@opencode/nav-menus": "workspace:*",
"@opencode/ui": "workspace:*",
"@resvg/resvg-wasm": "2.6.2",
@ -337,7 +336,7 @@
},
"packages/data/core": {
"name": "@opencode/data-core",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@planetscale/database": "1.19.0",
"drizzle-orm": "catalog:",
@ -354,7 +353,7 @@
},
"packages/data/server": {
"name": "@opencode/data-server",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/data-core": "workspace:*",
"effect": "catalog:",
@ -370,7 +369,7 @@
},
"packages/desktop": {
"name": "@opencode/desktop",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@zip.js/zip.js": "2.7.62",
"electron-context-menu": "5.0.0",
@ -418,7 +417,7 @@
},
"packages/gui-plugins": {
"name": "@opencode/gui-plugins",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@betteroffice/docx": "0.4.3",
"@betteroffice/fonts": "0.4.0",
@ -465,7 +464,7 @@
},
"packages/http-recorder": {
"name": "@opencode/http-recorder",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@effect/platform-node-shared": "catalog:",
},
@ -484,7 +483,7 @@
},
"packages/httpapi-codegen": {
"name": "@opencode/httpapi-codegen",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"effect": "catalog:",
"prettier": "3.6.2",
@ -497,7 +496,7 @@
},
"packages/latex": {
"name": "@opencode/latex",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/plugin": "workspace:*",
"@opentui/core": "catalog:",
@ -509,18 +508,9 @@
"@typescript/native": "catalog:",
},
},
"packages/locale": {
"name": "@opencode/locale",
"version": "2.4.1",
"devDependencies": {
"@types/bun": "catalog:",
"@typescript/native": "catalog:",
"typescript": "catalog:",
},
},
"packages/merman": {
"name": "@opencode/merman",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/plugin": "workspace:*",
"@opentui/core": "catalog:",
@ -535,7 +525,7 @@
},
"packages/nav-menus": {
"name": "@opencode/nav-menus",
"version": "2.4.1",
"version": "2.4.0",
"devDependencies": {
"@happy-dom/global-registrator": "20.0.11",
"@types/bun": "catalog:",
@ -546,7 +536,7 @@
},
"packages/patchmark": {
"name": "@opencode/patchmark",
"version": "2.4.1",
"version": "2.4.0",
"devDependencies": {
"@tsconfig/bun": "catalog:",
"@types/bun": "catalog:",
@ -559,7 +549,7 @@
},
"packages/plugin": {
"name": "@opencode/plugin",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@ai-sdk/provider": "3.0.8",
"@opencode/ai": "workspace:*",
@ -585,8 +575,8 @@
},
"peerDependencies": {
"@opencode/theme": "workspace:*",
"@opentui/core": ">=0.8.0",
"@opentui/solid": ">=0.8.0",
"@opentui/core": ">=0.9.4",
"@opentui/solid": ">=0.9.4",
"electron": "*",
"solid-js": ">=1.9.0",
"vite": ">=6",
@ -604,7 +594,7 @@
},
"packages/plugin-browser": {
"name": "@opencode/plugin-browser",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/plugin": "workspace:*",
"@opencode/schema": "workspace:*",
@ -620,7 +610,7 @@
},
"packages/plugins/figma": {
"name": "@opencode/plugin-figma",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"gray-matter": "4.0.3",
},
@ -635,7 +625,7 @@
},
"packages/protocol": {
"name": "@opencode/protocol",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/schema": "workspace:*",
"effect": "catalog:",
@ -650,7 +640,7 @@
},
"packages/schema": {
"name": "@opencode/schema",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@standard-schema/spec": "catalog:",
"effect": "catalog:",
@ -674,7 +664,7 @@
},
"packages/sdk": {
"name": "@opencode/sdk",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/client": "workspace:*",
"@opencode/core": "workspace:*",
@ -695,7 +685,7 @@
},
"packages/server": {
"name": "@opencode/server",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@effect/platform-node": "catalog:",
"@effect/platform-node-shared": "catalog:",
@ -718,7 +708,7 @@
},
"packages/session-ui": {
"name": "@opencode/session-ui",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@kitlangton/solid-motion": "0.2.2",
"@kobalte/core": "catalog:",
@ -750,7 +740,7 @@
},
"packages/simulation": {
"name": "@opencode/simulation",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/ai": "workspace:*",
"@opencode/core": "workspace:*",
@ -788,7 +778,7 @@
},
"packages/theme": {
"name": "@opencode/theme",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opentui/core": "catalog:",
"effect": "catalog:",
@ -802,7 +792,7 @@
},
"packages/tui": {
"name": "@opencode/tui",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@opencode/client": "workspace:*",
"@opencode/core": "workspace:*",
@ -834,7 +824,7 @@
},
"packages/ui": {
"name": "@opencode/ui",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@kitlangton/solid-motion": "0.2.2",
"@kobalte/core": "catalog:",
@ -870,7 +860,7 @@
},
"packages/util": {
"name": "@opencode/util",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"@effect/opentelemetry": "catalog:",
"@effect/platform-node": "catalog:",
@ -950,7 +940,6 @@
"dependencies": {
"@ibm/plex": "6.4.1",
"@kitlangton/rolling-number": "0.4.1",
"@opencode/locale": "workspace:*",
"@opencode/nav-menus": "workspace:*",
"@opencode/ui": "workspace:*",
"@solidjs/meta": "catalog:",
@ -1010,7 +999,7 @@
},
"services/update": {
"name": "@opencode/update",
"version": "2.4.1",
"version": "2.4.0",
"dependencies": {
"jose": "6.0.11",
"semver": "catalog:",
@ -1037,7 +1026,6 @@
"@brendonovich/vite-plugin-opencode@0.1.3": "patches/@brendonovich%2Fvite-plugin-opencode@0.1.3.patch",
"electron-updater@6.8.9": "patches/electron-updater@6.8.9.patch",
"@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch",
"bun-pty@0.4.11": "patches/bun-pty@0.4.11.patch",
"pacote@21.5.1": "patches/pacote@21.5.1.patch",
"@npmcli/agent@4.0.2": "patches/@npmcli%2Fagent@4.0.2.patch",
"@silvia-odwyer/photon-node@0.3.4": "patches/@silvia-odwyer%2Fphoton-node@0.3.4.patch",
@ -1074,9 +1062,9 @@
"@lydell/node-pty": "1.2.0-beta.12",
"@npmcli/arborist": "9.4.0",
"@octokit/rest": "22.0.0",
"@opentui/core": "0.9.9",
"@opentui/keymap": "0.9.9",
"@opentui/solid": "0.9.9",
"@opentui/core": "0.9.4",
"@opentui/keymap": "0.9.4",
"@opentui/solid": "0.9.4",
"@pierre/diffs": "1.6.1",
"@pierre/highlights": "0.2.0",
"@playwright/test": "1.60.0",
@ -1889,8 +1877,6 @@
"@opencode/legacy": ["@opencode/legacy@workspace:services/legacy"],
"@opencode/locale": ["@opencode/locale@workspace:packages/locale"],
"@opencode/merman": ["@opencode/merman@workspace:packages/merman"],
"@opencode/nav-menus": ["@opencode/nav-menus@workspace:packages/nav-menus"],
@ -1979,27 +1965,27 @@
"@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.43.0", "", {}, "sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg=="],
"@opentui/core": ["@opentui/core@0.9.9", "", { "dependencies": { "bun-ffi-structs": "0.3.1", "diff": "9.0.0", "string-width": "7.2.0" }, "optionalDependencies": { "@opentui/core-darwin-arm64": "0.9.9", "@opentui/core-darwin-x64": "0.9.9", "@opentui/core-linux-arm64": "0.9.9", "@opentui/core-linux-arm64-musl": "0.9.9", "@opentui/core-linux-x64": "0.9.9", "@opentui/core-linux-x64-musl": "0.9.9", "@opentui/core-win32-arm64": "0.9.9", "@opentui/core-win32-x64": "0.9.9" }, "peerDependencies": { "web-tree-sitter": "0.25.10" } }, "sha512-Dq4pFkTvM6QkQw8lcplnRF1JFbW5vSSYmymUA/nIVKOoqSUV/cxV3ns3KkOGwzR/JpeGxGrzc4wXEuY5RYrTzQ=="],
"@opentui/core": ["@opentui/core@0.9.4", "", { "dependencies": { "bun-ffi-structs": "0.3.1", "diff": "9.0.0", "string-width": "7.2.0" }, "optionalDependencies": { "@opentui/core-darwin-arm64": "0.9.4", "@opentui/core-darwin-x64": "0.9.4", "@opentui/core-linux-arm64": "0.9.4", "@opentui/core-linux-arm64-musl": "0.9.4", "@opentui/core-linux-x64": "0.9.4", "@opentui/core-linux-x64-musl": "0.9.4", "@opentui/core-win32-arm64": "0.9.4", "@opentui/core-win32-x64": "0.9.4" }, "peerDependencies": { "web-tree-sitter": "0.25.10" } }, "sha512-jV8ZAkI87juANCq6XD6UDMp3/WzNpfxloejmdwfCA9UaxBghVkqzoS8RyEYnXDUaS9u+DTCYy1RQMXc1UVibjQ=="],
"@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.9.9", "", { "os": "darwin", "cpu": "arm64" }, "sha512-KmDAKo9GnvJ8HNw8C9YSUdeA8jO1xjp7YxObPhhfdxfpWCwHOrM2W91pmgW14p52vOdvhCBMZvgX/1mHFAXYbQ=="],
"@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-hwQBFr+YSjQ7jxfsLj7AVa1het5veMLfRPFmH1z6eLNlvukdfFA7R4Jl1lHFm3ip5RZRGTanFQDaShOw2l0DMw=="],
"@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.9.9", "", { "os": "darwin", "cpu": "x64" }, "sha512-3fz8z5kZwawz/PvewzDVDkyVYMrLqIDA/Eat1jwVkzFrqCVqh903P7Qr6Wpf/Ahg5La/qqqZMxRRYjc40qEW+A=="],
"@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.9.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-aBZAjQovTrP/EIsWJb/WXHFzz5Oh+MdOpojNCb567eBVtIRY3W6e/60qwZVgovu7wZcdYbtKYPkuS7+Hh+OGdA=="],
"@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.9.9", "", { "os": "linux", "cpu": "arm64" }, "sha512-nHLjJH04gqsE2WW6P0yNuzlxddeBYTwDpyDfscico9YBtOj21stfpEf7G5PIGhfeMCSmsY3D1B52ebrISq0YgA=="],
"@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-/igVllJGl12d9TXI4I8AZ4NFA1wGLwm8If6r+wtnd2Yq3LrZsuEf6MZ836XTnQJHJKNR2QY5TwkLSQg/Qslx5w=="],
"@opentui/core-linux-arm64-musl": ["@opentui/core-linux-arm64-musl@0.9.9", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-FdbKKXfXk6Y5z46wojVNnHyPuEns8Dn7/ONhYTgBi0Z/dBVc/aRWRYzXHIn7x3ZBLpA0fNU01wTAW3SxgOmBmQ=="],
"@opentui/core-linux-arm64-musl": ["@opentui/core-linux-arm64-musl@0.9.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-qUOnjER4CY0I4GJc9X0KyNYaxtgUSf/yy+3NwdvOZODbvLMeGyBDQ3209K2iuyfc8c1WU93J5cIXqJj+k18hIw=="],
"@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.9.9", "", { "os": "linux", "cpu": "x64" }, "sha512-7W0ffV5ci202+6IkY3oh5Y67QWj/CjVJY0LkSaGu56/rLtRWL6RIl0/V9S5NSu2EcwqAyTp8C+EIhBdOoDwhCA=="],
"@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-6jKg9AkJ1g3d4n1I8Ug09PouzWBD+FZWhmMEduiULiA0lbYjZL22Y07nfMOSzx/Ehqt/GcY5q8m0V/rK/QWlcQ=="],
"@opentui/core-linux-x64-musl": ["@opentui/core-linux-x64-musl@0.9.9", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-LvFHYVK/oWTsjaMj7UknAWMmRlhfpo85vW+RALHd2Y/t0PnRCHlEr2uRWPAlrymqIxU4tqei6BIodQLozc0HLg=="],
"@opentui/core-linux-x64-musl": ["@opentui/core-linux-x64-musl@0.9.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-0xjtikRbFJlV33zvtiMhvL90ZlugFV0YWrx07GFoRvUdADxVtB9YSQFjfkdsavZLbc3snd86Qsus6BBAcHg0MA=="],
"@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.9.9", "", { "os": "win32", "cpu": "arm64" }, "sha512-EiLfLFuNV4z1iXzx0fCDKGuweME4qkQOZgtLQmKak7IXicng02w3hbgkeWZrtPvuuZWB3WkqnNa0j6OD7UbpJQ=="],
"@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.9.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-rLXIEoQBh9tUzTwf79TSRbpC94wtIyUOwRp2CykcgB8m57wM73I9fGKsWEip4scyUkybOH97XvGD/mWZF9ftzA=="],
"@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.9.9", "", { "os": "win32", "cpu": "x64" }, "sha512-WhLVmvPr5V+K0LN7ss0Ss0LxgYHyM0SKAaOtWP9oJSt4LnyFnRd3Hy6OQh67dANlCmr/sSkRN8OqQ0thmWuFyA=="],
"@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.9.4", "", { "os": "win32", "cpu": "x64" }, "sha512-pZVlwwJZ3VqOjN/fmVFwaLA1H8JNOvuW27DoXzOIBDxoMi+l1UsL6rHGsLRDSPssQ3pjSn/jFCWo+xD/EtcbAA=="],
"@opentui/keymap": ["@opentui/keymap@0.9.9", "", { "dependencies": { "@opentui/core": "0.9.9" }, "peerDependencies": { "@opentui/react": "0.9.9", "@opentui/solid": "0.9.9", "react": ">=19.2.0", "solid-js": "^1.9.12" }, "optionalPeers": ["@opentui/react", "@opentui/solid", "react", "solid-js"] }, "sha512-XCxlKiuNBf9Dd6DjuUN54bElHikZ2EMi5fKP7ucJ9pc/n5Kgzcq/tu+qOx1K33LGvTLYpoSMWkMlW3WLgUqKtw=="],
"@opentui/keymap": ["@opentui/keymap@0.9.4", "", { "dependencies": { "@opentui/core": "0.9.4" }, "peerDependencies": { "@opentui/react": "0.9.4", "@opentui/solid": "0.9.4", "react": ">=19.2.0", "solid-js": "^1.9.12" }, "optionalPeers": ["@opentui/react", "@opentui/solid", "react", "solid-js"] }, "sha512-T2SSIT1p9Ex8O5eLp9g8Ou0z0wR3xeDg/70xz5RS++xksdXtZI7KS66QN0XXQmo86Quos7qwiiJdsSXUQNSwnQ=="],
"@opentui/solid": ["@opentui/solid@0.9.9", "", { "dependencies": { "@babel/core": "7.29.7", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.9.9", "babel-preset-solid": "1.9.16", "entities": "7.0.1", "s-js": "^0.4.9" }, "peerDependencies": { "solid-js": "^1.9.12" } }, "sha512-8bDc7vZThFMK4QX2LtHz+sHiZAdwwIn6c/0Pm4iFKoUSkCtuHg6YcXK5c7ZZdReXXMPbfh5Km9MI8iL0LW2ddg=="],
"@opentui/solid": ["@opentui/solid@0.9.4", "", { "dependencies": { "@babel/core": "7.29.7", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.9.4", "babel-plugin-module-resolver": "5.0.2", "babel-preset-solid": "1.9.16", "entities": "7.0.1", "s-js": "^0.4.9" }, "peerDependencies": { "solid-js": "^1.9.12" } }, "sha512-dTX+7qlxm8+/YoKL09pGMGfTPVYnnwIIhxL4+q84Zrh2atqJ+4Xx1xeRoqjVkdGUDOIt1WrLkT9VWQ9A30fYNA=="],
"@opentunnel/client": ["@opentunnel/client@0.6.1", "", { "dependencies": { "@opentunnel/protocol": "0.6.1" }, "peerDependencies": { "effect": "^4.0.0", "undici": ">=7.0.0" }, "optionalPeers": ["undici"] }, "sha512-OuVNlWywQebIXCtkixjVHebOsR3KFRxJ0DSZry6Dzj4hHaHIf3eTVmQ7VwLCjuVmw+ctU2qHIP6RxuAPr07WDw=="],
@ -2347,7 +2333,7 @@
"@silvia-odwyer/photon-node": ["@silvia-odwyer/photon-node@0.3.4", "", {}, "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA=="],
"@sindresorhus/is": ["@sindresorhus/is@7.2.0", "", {}, "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw=="],
"@sindresorhus/is": ["@sindresorhus/is@4.6.0", "", {}, "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="],
"@smithy/core": ["@smithy/core@3.33.2", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CUGXpnPkVdjUCbix+83sWLW9VFgQOm44MDOx/ihITJMAnOZKvL8YYIc7DR9pP/tZ8CIRvMiON/TucvygqbHO3w=="],
@ -2715,6 +2701,8 @@
"babel-plugin-jsx-dom-expressions": ["babel-plugin-jsx-dom-expressions@0.40.10", "", { "dependencies": { "@babel/helper-module-imports": "7.18.6", "@babel/plugin-syntax-jsx": "^7.18.6", "@babel/types": "^7.20.7", "html-entities": "2.3.3", "parse5": "^7.1.2" }, "peerDependencies": { "@babel/core": "^7.20.12" } }, "sha512-lxve6Y02YiZTldB7efKpnbf1BH00XCFZNYYW235jSGsYaJNFtHrYlKV6/O+miHbjqpIr9FTe5+0no4hofAMbfA=="],
"babel-plugin-module-resolver": ["babel-plugin-module-resolver@5.0.2", "", { "dependencies": { "find-babel-config": "^2.1.1", "glob": "^9.3.3", "pkg-up": "^3.1.0", "reselect": "^4.1.7", "resolve": "^1.22.8" } }, "sha512-9KtaCazHee2xc0ibfqsDeamwDps6FZNo5S0Q81dUqEuFzVwPhcT4J5jOqIVvgCA3Q/wO9hKYxN/Ds3tIsp5ygg=="],
"babel-plugin-polyfill-corejs2": ["babel-plugin-polyfill-corejs2@0.4.17", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-define-polyfill-provider": "^0.6.8", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w=="],
"babel-plugin-polyfill-corejs3": ["babel-plugin-polyfill-corejs3@0.14.2", "", { "dependencies": { "@babel/helper-define-polyfill-provider": "^0.6.8", "core-js-compat": "^3.48.0" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "sha512-coWpDLJ410R781Npmn/SIBZEsAetR4xVi0SxLMXPaMO4lSf1MwnkGYMtkFxew0Dn8B3/CpbpYxN0JCgg8mn67g=="],
@ -3163,6 +3151,8 @@
"finalhandler": ["finalhandler@2.1.1", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA=="],
"find-babel-config": ["find-babel-config@2.1.2", "", { "dependencies": { "json5": "^2.2.3" } }, "sha512-ZfZp1rQyp4gyuxqt1ZqjFGVeVBvmpURMqdIWXbPRfB97Bf6BzdK/xSIbylEINzQ0kB5tlDQfn9HkNXXWsqTqLg=="],
"find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
"for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="],
@ -3715,7 +3705,7 @@
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
"miniflare": ["miniflare@4.20260708.1", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.34.5", "undici": "7.28.0", "workerd": "1.20260708.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-c94O9zRDISdqO18EHt6l0iF/fWgWt8p18PJvRsA/L/NJZ9Cfke3s/F5Blg1XXF7WDutVRzWVWy8Vy4LaT5ifsA=="],
"miniflare": ["miniflare@5.20260930.0-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.4", "undici": "7.29.1", "workerd": "1.20260930.2", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-vZljfRtOEeynbhJtuvYsnCU8t6zF5wIUm9ql4YFHB7zvYw2+F2tpT0BzXjzaa++eiUIml1gsODCf02qShBmJdg=="],
"minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="],
@ -3837,6 +3827,8 @@
"p-map": ["p-map@7.0.6", "", {}, "sha512-I4Prw6ivkd6p8PiYR1tXASOAOBzIJwu0TB7fqaX0c/8c3QAehNYmX57EijyGGGBt3c/BIowGwV03RVBtXvHEVg=="],
"p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],
"package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="],
"pacote": ["pacote@21.5.1", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/git": "^7.0.0", "@npmcli/installed-package-contents": "^4.0.0", "@npmcli/package-json": "^7.0.0", "@npmcli/promise-spawn": "^9.0.0", "@npmcli/run-script": "^10.0.0", "cacache": "^20.0.0", "fs-minipass": "^3.0.0", "minipass": "^7.0.2", "npm-package-arg": "^13.0.0", "npm-packlist": "^10.0.1", "npm-pick-manifest": "^11.0.1", "npm-registry-fetch": "^19.0.0", "proc-log": "^6.0.0", "sigstore": "^4.0.0", "ssri": "^13.0.0", "tar": "^7.4.3" }, "bin": { "pacote": "bin/index.js" } }, "sha512-KvcJ9iy3crysCsgqc4+PknH/w6jkrp8JN36mpZBPwNaDRwTfMZD37YzRazNstiZUOhuF5pno9f78n9mEJBavwg=="],
@ -3881,6 +3873,8 @@
"pkce-challenge": ["pkce-challenge@5.0.1", "", {}, "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ=="],
"pkg-up": ["pkg-up@3.1.0", "", { "dependencies": { "find-up": "^3.0.0" } }, "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA=="],
"pkijs": ["pkijs@3.4.0", "", { "dependencies": { "@noble/hashes": "1.4.0", "asn1js": "^3.0.6", "bytestreamjs": "^2.0.1", "pvtsutils": "^1.3.6", "pvutils": "^1.1.3", "tslib": "^2.8.1" } }, "sha512-emEcLuomt2j03vxD54giVB4SxTjnsqkU692xZOZXHDVoYyypEm+b3jpiTcc+Cf+myooc+/Ly0z01jqeNHVgJGw=="],
"playwright": ["playwright@1.60.0", "", { "dependencies": { "playwright-core": "1.60.0" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-hheHdokM8cdqCb0lcE3s+zT4t4W+vvjpGxsZlDnikarzx8tSzMebh3UiFtgqwFwnTnjYQcsyMF8ei2mCO/tpeA=="],
@ -3931,7 +3925,7 @@
"proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="],
"psychoscript": ["psychoscript@0.3.0", "", { "dependencies": { "acorn": "8.15.0" }, "peerDependencies": { "effect": "^4.1.0" }, "optionalPeers": ["effect"] }, "sha512-S4VohBlR6aXJtitKUZaYJ0OYs7AHjdKqBGYEL+6YoMU0oBFiVTFw8vTPrFujKBRuhjtj5kNu69CCJ/MBk4eM2g=="],
"psychoscript": ["psychoscript@0.2.1", "", { "dependencies": { "acorn": "8.15.0" }, "peerDependencies": { "effect": "^4.1.0" }, "optionalPeers": ["effect"] }, "sha512-kzDhlTdkk6DurnTMD95Vd98nfw5TFS6Sf4QyxEP0vclAlniB2vt2ZWjNwQ3NKXynfJL4lsbP+wjrRRdqkahUiw=="],
"pump": ["pump@3.0.4", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
@ -4029,6 +4023,8 @@
"resedit": ["resedit@1.7.2", "", { "dependencies": { "pe-library": "^0.4.1" } }, "sha512-vHjcY2MlAITJhC0eRD/Vv8Vlgmu9Sd3LX9zZvtGzU5ZImdTN3+d6e/4mnTyV8vEbyf1sgNIrWxhWlrys52OkEA=="],
"reselect": ["reselect@4.1.8", "", {}, "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ=="],
"resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="],
"resolve-alpn": ["resolve-alpn@1.2.1", "", {}, "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g=="],
@ -4643,8 +4639,6 @@
"@opencode/site/@types/react": ["@types/react@19.3.0", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg=="],
"@opencode/site/miniflare": ["miniflare@5.20260930.0-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.4", "undici": "7.29.1", "workerd": "1.20260930.2", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-vZljfRtOEeynbhJtuvYsnCU8t6zF5wIUm9ql4YFHB7zvYw2+F2tpT0BzXjzaa++eiUIml1gsODCf02qShBmJdg=="],
"@opencode/stories/@tailwindcss/vite": ["@tailwindcss/vite@4.1.11", "", { "dependencies": { "@tailwindcss/node": "4.1.11", "@tailwindcss/oxide": "4.1.11", "tailwindcss": "4.1.11" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7" } }, "sha512-RHYhrR3hku0MJFRV+fN2gNbDNEh3dwKvY8XJvTxCSXeMOsCRSr+uKvDWQcbizrHgjML6ZmTE5OwMrl5wKcujCw=="],
"@opencode/stories/vite": ["vite@7.3.7", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA=="],
@ -4683,6 +4677,8 @@
"@pierre/diffs/diff": ["diff@9.0.0", "", {}, "sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw=="],
"@poppinss/dumper/@sindresorhus/is": ["@sindresorhus/is@7.2.0", "", {}, "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw=="],
"@poppinss/dumper/supports-color": ["supports-color@10.2.2", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
"@puppeteer/browsers/yargs": ["yargs@18.1.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^8.2.1", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg=="],
@ -4739,14 +4735,14 @@
"babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="],
"babel-plugin-module-resolver/glob": ["glob@9.3.5", "", { "dependencies": { "fs.realpath": "^1.0.0", "minimatch": "^8.0.2", "minipass": "^4.2.4", "path-scurry": "^1.6.1" } }, "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q=="],
"babel-plugin-polyfill-corejs2/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"body-parser/content-type": ["content-type@2.1.0", "", {}, "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag=="],
"builder-util/js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="],
"cf/miniflare": ["miniflare@5.20260930.0-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.4", "undici": "7.29.1", "workerd": "1.20260930.2", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-vZljfRtOEeynbhJtuvYsnCU8t6zF5wIUm9ql4YFHB7zvYw2+F2tpT0BzXjzaa++eiUIml1gsODCf02qShBmJdg=="],
"chromium-bidi/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
"cliui/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
@ -4811,8 +4807,6 @@
"gitlab-ai-provider/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
"got/@sindresorhus/is": ["@sindresorhus/is@4.6.0", "", {}, "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="],
"h3/rou3": ["rou3@1.0.0", "", {}, "sha512-ySeaQkSrua+ut9g+65I7FHqOFBaY8tV0FmccXItoq0q21se32Q3u4YiW7/RqXSosWgYJaaKwRHXy3BST9PeCNQ=="],
"h3/srvx": ["srvx@1.0.6", "", { "bin": { "srvx": "./bin/srvx.mjs" } }, "sha512-QeTKgAhk8OSsfeq60bl3wuVs9PmBftzmk7owBInA/F1YQne+TRw0UcPymNpURldAmx8hfmM2PNNGH/zgo3GpLA=="],
@ -4837,7 +4831,11 @@
"micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
"miniflare/undici": ["undici@7.28.0", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],
"miniflare/sharp": ["sharp@0.35.4", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.4", "@img/sharp-darwin-x64": "0.35.4", "@img/sharp-freebsd-wasm32": "0.35.4", "@img/sharp-libvips-darwin-arm64": "1.3.3", "@img/sharp-libvips-darwin-x64": "1.3.3", "@img/sharp-libvips-linux-arm": "1.3.3", "@img/sharp-libvips-linux-arm64": "1.3.3", "@img/sharp-libvips-linux-ppc64": "1.3.3", "@img/sharp-libvips-linux-riscv64": "1.3.3", "@img/sharp-libvips-linux-s390x": "1.3.3", "@img/sharp-libvips-linux-x64": "1.3.3", "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", "@img/sharp-libvips-linuxmusl-x64": "1.3.3", "@img/sharp-linux-arm": "0.35.4", "@img/sharp-linux-arm64": "0.35.4", "@img/sharp-linux-ppc64": "0.35.4", "@img/sharp-linux-riscv64": "0.35.4", "@img/sharp-linux-s390x": "0.35.4", "@img/sharp-linux-x64": "0.35.4", "@img/sharp-linuxmusl-arm64": "0.35.4", "@img/sharp-linuxmusl-x64": "0.35.4", "@img/sharp-webcontainers-wasm32": "0.35.4", "@img/sharp-win32-arm64": "0.35.4", "@img/sharp-win32-ia32": "0.35.4", "@img/sharp-win32-x64": "0.35.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA=="],
"miniflare/undici": ["undici@7.29.1", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="],
"miniflare/workerd": ["workerd@1.20260930.2", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20260930.2", "@cloudflare/workerd-darwin-arm64": "1.20260930.2", "@cloudflare/workerd-linux-64": "1.20260930.2", "@cloudflare/workerd-linux-arm64": "1.20260930.2", "@cloudflare/workerd-windows-64": "1.20260930.2" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-k1lQzEiGyCDqaRsR5+o9PBT5wVU5omtas6hXx3spbEHHMFo8a7tkAixVCMsWFeiT7xhrmg21Hd6a9jLNrkcUMg=="],
"minipass-flush/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="],
@ -4857,6 +4855,8 @@
"parse5/entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="],
"pkg-up/find-up": ["find-up@3.0.0", "", { "dependencies": { "locate-path": "^3.0.0" } }, "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg=="],
"pkijs/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="],
"playwright/fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
@ -4939,6 +4939,8 @@
"wrangler/esbuild": ["esbuild@0.28.1", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.28.1", "@esbuild/android-arm": "0.28.1", "@esbuild/android-arm64": "0.28.1", "@esbuild/android-x64": "0.28.1", "@esbuild/darwin-arm64": "0.28.1", "@esbuild/darwin-x64": "0.28.1", "@esbuild/freebsd-arm64": "0.28.1", "@esbuild/freebsd-x64": "0.28.1", "@esbuild/linux-arm": "0.28.1", "@esbuild/linux-arm64": "0.28.1", "@esbuild/linux-ia32": "0.28.1", "@esbuild/linux-loong64": "0.28.1", "@esbuild/linux-mips64el": "0.28.1", "@esbuild/linux-ppc64": "0.28.1", "@esbuild/linux-riscv64": "0.28.1", "@esbuild/linux-s390x": "0.28.1", "@esbuild/linux-x64": "0.28.1", "@esbuild/netbsd-arm64": "0.28.1", "@esbuild/netbsd-x64": "0.28.1", "@esbuild/openbsd-arm64": "0.28.1", "@esbuild/openbsd-x64": "0.28.1", "@esbuild/openharmony-arm64": "0.28.1", "@esbuild/sunos-x64": "0.28.1", "@esbuild/win32-arm64": "0.28.1", "@esbuild/win32-ia32": "0.28.1", "@esbuild/win32-x64": "0.28.1" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw=="],
"wrangler/miniflare": ["miniflare@4.20260708.1", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.34.5", "undici": "7.28.0", "workerd": "1.20260708.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-c94O9zRDISdqO18EHt6l0iF/fWgWt8p18PJvRsA/L/NJZ9Cfke3s/F5Blg1XXF7WDutVRzWVWy8Vy4LaT5ifsA=="],
"wrangler/path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
"wrap-ansi/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
@ -5019,12 +5021,6 @@
"@opencode/legacy/wrangler/workerd": ["workerd@1.20261102.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261102.1", "@cloudflare/workerd-darwin-arm64": "1.20261102.1", "@cloudflare/workerd-linux-64": "1.20261102.1", "@cloudflare/workerd-linux-arm64": "1.20261102.1", "@cloudflare/workerd-windows-64": "1.20261102.1" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-5A+/vm0M5oc98pB3aR+DZ5cIOvRMhVWVS9tg+CrjUap7PIo8tqAnvNdvuiHBIE47/wkxtNM3jToAaU38dBsZTw=="],
"@opencode/site/miniflare/sharp": ["sharp@0.35.4", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.4", "@img/sharp-darwin-x64": "0.35.4", "@img/sharp-freebsd-wasm32": "0.35.4", "@img/sharp-libvips-darwin-arm64": "1.3.3", "@img/sharp-libvips-darwin-x64": "1.3.3", "@img/sharp-libvips-linux-arm": "1.3.3", "@img/sharp-libvips-linux-arm64": "1.3.3", "@img/sharp-libvips-linux-ppc64": "1.3.3", "@img/sharp-libvips-linux-riscv64": "1.3.3", "@img/sharp-libvips-linux-s390x": "1.3.3", "@img/sharp-libvips-linux-x64": "1.3.3", "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", "@img/sharp-libvips-linuxmusl-x64": "1.3.3", "@img/sharp-linux-arm": "0.35.4", "@img/sharp-linux-arm64": "0.35.4", "@img/sharp-linux-ppc64": "0.35.4", "@img/sharp-linux-riscv64": "0.35.4", "@img/sharp-linux-s390x": "0.35.4", "@img/sharp-linux-x64": "0.35.4", "@img/sharp-linuxmusl-arm64": "0.35.4", "@img/sharp-linuxmusl-x64": "0.35.4", "@img/sharp-webcontainers-wasm32": "0.35.4", "@img/sharp-win32-arm64": "0.35.4", "@img/sharp-win32-ia32": "0.35.4", "@img/sharp-win32-x64": "0.35.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA=="],
"@opencode/site/miniflare/undici": ["undici@7.29.1", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="],
"@opencode/site/miniflare/workerd": ["workerd@1.20260930.2", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20260930.2", "@cloudflare/workerd-darwin-arm64": "1.20260930.2", "@cloudflare/workerd-linux-64": "1.20260930.2", "@cloudflare/workerd-linux-arm64": "1.20260930.2", "@cloudflare/workerd-windows-64": "1.20260930.2" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-k1lQzEiGyCDqaRsR5+o9PBT5wVU5omtas6hXx3spbEHHMFo8a7tkAixVCMsWFeiT7xhrmg21Hd6a9jLNrkcUMg=="],
"@opencode/stories/@tailwindcss/vite/@tailwindcss/node": ["@tailwindcss/node@4.1.11", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", "tailwindcss": "4.1.11" } }, "sha512-yzhzuGRmv5QyU9qLNg4GTlYI6STedBWRE7NjxP45CsFYYq9taI0zJXZBMqIC/c8fViNLhmrbpSFS57EoxUmD6Q=="],
"@opencode/stories/@tailwindcss/vite/@tailwindcss/oxide": ["@tailwindcss/oxide@4.1.11", "", { "dependencies": { "detect-libc": "^2.0.4", "tar": "^7.4.3" }, "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.1.11", "@tailwindcss/oxide-darwin-arm64": "4.1.11", "@tailwindcss/oxide-darwin-x64": "4.1.11", "@tailwindcss/oxide-freebsd-x64": "4.1.11", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.11", "@tailwindcss/oxide-linux-arm64-gnu": "4.1.11", "@tailwindcss/oxide-linux-arm64-musl": "4.1.11", "@tailwindcss/oxide-linux-x64-gnu": "4.1.11", "@tailwindcss/oxide-linux-x64-musl": "4.1.11", "@tailwindcss/oxide-wasm32-wasi": "4.1.11", "@tailwindcss/oxide-win32-arm64-msvc": "4.1.11", "@tailwindcss/oxide-win32-x64-msvc": "4.1.11" } }, "sha512-Q69XzrtAhuyfHo+5/HMgr1lAiPP/G40OMFAnws7xcFEYqcypZmdW8eGXaOUIeOl1dzPJBPENXgbjsOyhg2nkrg=="],
@ -5079,11 +5075,11 @@
"app-builder-lib/which/isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="],
"cf/miniflare/sharp": ["sharp@0.35.4", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.4", "@img/sharp-darwin-x64": "0.35.4", "@img/sharp-freebsd-wasm32": "0.35.4", "@img/sharp-libvips-darwin-arm64": "1.3.3", "@img/sharp-libvips-darwin-x64": "1.3.3", "@img/sharp-libvips-linux-arm": "1.3.3", "@img/sharp-libvips-linux-arm64": "1.3.3", "@img/sharp-libvips-linux-ppc64": "1.3.3", "@img/sharp-libvips-linux-riscv64": "1.3.3", "@img/sharp-libvips-linux-s390x": "1.3.3", "@img/sharp-libvips-linux-x64": "1.3.3", "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", "@img/sharp-libvips-linuxmusl-x64": "1.3.3", "@img/sharp-linux-arm": "0.35.4", "@img/sharp-linux-arm64": "0.35.4", "@img/sharp-linux-ppc64": "0.35.4", "@img/sharp-linux-riscv64": "0.35.4", "@img/sharp-linux-s390x": "0.35.4", "@img/sharp-linux-x64": "0.35.4", "@img/sharp-linuxmusl-arm64": "0.35.4", "@img/sharp-linuxmusl-x64": "0.35.4", "@img/sharp-webcontainers-wasm32": "0.35.4", "@img/sharp-win32-arm64": "0.35.4", "@img/sharp-win32-ia32": "0.35.4", "@img/sharp-win32-x64": "0.35.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA=="],
"babel-plugin-module-resolver/glob/minimatch": ["minimatch@8.0.7", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg=="],
"cf/miniflare/undici": ["undici@7.29.1", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="],
"babel-plugin-module-resolver/glob/minipass": ["minipass@4.2.8", "", {}, "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ=="],
"cf/miniflare/workerd": ["workerd@1.20260930.2", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20260930.2", "@cloudflare/workerd-darwin-arm64": "1.20260930.2", "@cloudflare/workerd-linux-64": "1.20260930.2", "@cloudflare/workerd-linux-arm64": "1.20260930.2", "@cloudflare/workerd-windows-64": "1.20260930.2" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-k1lQzEiGyCDqaRsR5+o9PBT5wVU5omtas6hXx3spbEHHMFo8a7tkAixVCMsWFeiT7xhrmg21Hd6a9jLNrkcUMg=="],
"babel-plugin-module-resolver/glob/path-scurry": ["path-scurry@1.11.1", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
"cliui/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
@ -5109,6 +5105,62 @@
"hosted-git-info/lru-cache/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],
"miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.3" }, "os": "darwin", "cpu": "arm64" }, "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA=="],
"miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.3" }, "os": "darwin", "cpu": "x64" }, "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw=="],
"miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="],
"miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="],
"miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.3", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA=="],
"miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A=="],
"miniflare/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.3", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w=="],
"miniflare/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.3", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ=="],
"miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.3", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q=="],
"miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA=="],
"miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="],
"miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw=="],
"miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.3" }, "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A=="],
"miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ=="],
"miniflare/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.3" }, "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ=="],
"miniflare/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.3" }, "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA=="],
"miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.3" }, "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ=="],
"miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA=="],
"miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA=="],
"miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg=="],
"miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="],
"miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="],
"miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.4", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="],
"miniflare/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260930.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-wxKsfekWeev6xkjHEMx3x7nz6WfWOn1/scQ8geqWQhUm8qRl1ZRZhjnj+rucIMLhLhP9RGSYMZIjEm3AV0zwVQ=="],
"miniflare/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20260930.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cviPpheZGQ2H5X+Ctxd3wfxhksNrdyoNprjSgg3br2+psetKacjdEvK8CILdN/2GF+u1KOExvr45amSL6lgzGA=="],
"miniflare/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20260930.2", "", { "os": "linux", "cpu": "x64" }, "sha512-cwrJAC5y/avPd1OzGyhc5OvUUfPXBFc065TY5CjXp7Hb3dhiTx6JeB5Pc8L3G8L8M44HyAfRHSpoLtRr+SR3cQ=="],
"miniflare/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20260930.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-FHucB4gak1IuT+IxLx3KbtMBMapZhcqD9EdhHvBxk1FpHwD2QU5x26MRRVN53jIKG/O25HUmE9yffb3cMANQgw=="],
"miniflare/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20260930.2", "", { "os": "win32", "cpu": "x64" }, "sha512-JHFMdGFMqP+M2QiVzZq1S8Ie66Gvxo7Og5EYz/KtmDvGCqge5L3lK+ksZxAhF3j/tpSLqdvlUvcTKoR9PkwTTQ=="],
"minipass-flush/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],
"minipass-pipeline/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],
@ -5145,6 +5197,8 @@
"nitro/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.14", "", { "os": "win32", "cpu": "x64" }, "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ=="],
"pkg-up/find-up/locate-path": ["locate-path@3.0.0", "", { "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A=="],
"rimraf/glob/jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
"rimraf/glob/minimatch": ["minimatch@9.0.9", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],
@ -5207,6 +5261,8 @@
"wrangler/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.1", "", { "os": "win32", "cpu": "x64" }, "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A=="],
"wrangler/miniflare/undici": ["undici@7.28.0", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="],
"wrap-ansi-cjs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
"wrap-ansi-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
@ -5335,62 +5391,6 @@
"@opencode/legacy/wrangler/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261102.1", "", { "os": "win32", "cpu": "x64" }, "sha512-s9iKBbAdNIdVjpMUHh48zbCfCHw5wbLl8I2aIW74H3OtxpWZP/cHeEwZZMq3xAz5kt4MmvwwO4hDbNYoAD4yhw=="],
"@opencode/site/miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.3" }, "os": "darwin", "cpu": "arm64" }, "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA=="],
"@opencode/site/miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.3" }, "os": "darwin", "cpu": "x64" }, "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.3", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.3", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.3", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.3", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="],
"@opencode/site/miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.3" }, "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.3" }, "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.3" }, "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.3" }, "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ=="],
"@opencode/site/miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA=="],
"@opencode/site/miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA=="],
"@opencode/site/miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg=="],
"@opencode/site/miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="],
"@opencode/site/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="],
"@opencode/site/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.4", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="],
"@opencode/site/miniflare/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260930.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-wxKsfekWeev6xkjHEMx3x7nz6WfWOn1/scQ8geqWQhUm8qRl1ZRZhjnj+rucIMLhLhP9RGSYMZIjEm3AV0zwVQ=="],
"@opencode/site/miniflare/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20260930.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cviPpheZGQ2H5X+Ctxd3wfxhksNrdyoNprjSgg3br2+psetKacjdEvK8CILdN/2GF+u1KOExvr45amSL6lgzGA=="],
"@opencode/site/miniflare/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20260930.2", "", { "os": "linux", "cpu": "x64" }, "sha512-cwrJAC5y/avPd1OzGyhc5OvUUfPXBFc065TY5CjXp7Hb3dhiTx6JeB5Pc8L3G8L8M44HyAfRHSpoLtRr+SR3cQ=="],
"@opencode/site/miniflare/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20260930.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-FHucB4gak1IuT+IxLx3KbtMBMapZhcqD9EdhHvBxk1FpHwD2QU5x26MRRVN53jIKG/O25HUmE9yffb3cMANQgw=="],
"@opencode/site/miniflare/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20260930.2", "", { "os": "win32", "cpu": "x64" }, "sha512-JHFMdGFMqP+M2QiVzZq1S8Ie66Gvxo7Og5EYz/KtmDvGCqge5L3lK+ksZxAhF3j/tpSLqdvlUvcTKoR9PkwTTQ=="],
"@opencode/stories/@tailwindcss/vite/@tailwindcss/node/lightningcss": ["lightningcss@1.30.1", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-darwin-arm64": "1.30.1", "lightningcss-darwin-x64": "1.30.1", "lightningcss-freebsd-x64": "1.30.1", "lightningcss-linux-arm-gnueabihf": "1.30.1", "lightningcss-linux-arm64-gnu": "1.30.1", "lightningcss-linux-arm64-musl": "1.30.1", "lightningcss-linux-x64-gnu": "1.30.1", "lightningcss-linux-x64-musl": "1.30.1", "lightningcss-win32-arm64-msvc": "1.30.1", "lightningcss-win32-x64-msvc": "1.30.1" } }, "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg=="],
"@opencode/stories/@tailwindcss/vite/@tailwindcss/oxide/@tailwindcss/oxide-android-arm64": ["@tailwindcss/oxide-android-arm64@4.1.11", "", { "os": "android", "cpu": "arm64" }, "sha512-3IfFuATVRUMZZprEIx9OGDjG3Ou3jG4xQzNTvjDoKmU9JdmoCohQJ83MYd0GPnQIu89YoJqvMM0G3uqLRFtetg=="],
@ -5425,66 +5425,20 @@
"@textjs/app/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="],
"cf/miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.3" }, "os": "darwin", "cpu": "arm64" }, "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA=="],
"babel-plugin-module-resolver/glob/minimatch/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="],
"cf/miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.3" }, "os": "darwin", "cpu": "x64" }, "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw=="],
"babel-plugin-module-resolver/glob/path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
"cf/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="],
"cf/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.3", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.3", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.3", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.3", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q=="],
"cf/miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA=="],
"cf/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="],
"cf/miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.3", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw=="],
"cf/miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.3" }, "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A=="],
"cf/miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ=="],
"cf/miniflare/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.3" }, "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ=="],
"cf/miniflare/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.3" }, "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA=="],
"cf/miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.3" }, "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ=="],
"cf/miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA=="],
"cf/miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA=="],
"cf/miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.4", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.3" }, "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg=="],
"cf/miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="],
"cf/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="],
"cf/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.4", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="],
"cf/miniflare/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260930.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-wxKsfekWeev6xkjHEMx3x7nz6WfWOn1/scQ8geqWQhUm8qRl1ZRZhjnj+rucIMLhLhP9RGSYMZIjEm3AV0zwVQ=="],
"cf/miniflare/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20260930.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cviPpheZGQ2H5X+Ctxd3wfxhksNrdyoNprjSgg3br2+psetKacjdEvK8CILdN/2GF+u1KOExvr45amSL6lgzGA=="],
"cf/miniflare/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20260930.2", "", { "os": "linux", "cpu": "x64" }, "sha512-cwrJAC5y/avPd1OzGyhc5OvUUfPXBFc065TY5CjXp7Hb3dhiTx6JeB5Pc8L3G8L8M44HyAfRHSpoLtRr+SR3cQ=="],
"cf/miniflare/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20260930.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-FHucB4gak1IuT+IxLx3KbtMBMapZhcqD9EdhHvBxk1FpHwD2QU5x26MRRVN53jIKG/O25HUmE9yffb3cMANQgw=="],
"cf/miniflare/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20260930.2", "", { "os": "win32", "cpu": "x64" }, "sha512-JHFMdGFMqP+M2QiVzZq1S8Ie66Gvxo7Og5EYz/KtmDvGCqge5L3lK+ksZxAhF3j/tpSLqdvlUvcTKoR9PkwTTQ=="],
"babel-plugin-module-resolver/glob/path-scurry/minipass": ["minipass@7.1.3", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
"dir-compare/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"filelist/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"pkg-up/find-up/locate-path/p-locate": ["p-locate@3.0.0", "", { "dependencies": { "p-limit": "^2.0.0" } }, "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ=="],
"pkg-up/find-up/locate-path/path-exists": ["path-exists@3.0.0", "", {}, "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ=="],
"rimraf/glob/jackspeak/@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
"rimraf/glob/minimatch/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="],
@ -5579,6 +5533,10 @@
"@puppeteer/browsers/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
"babel-plugin-module-resolver/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"pkg-up/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],
"rimraf/glob/jackspeak/@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
"rimraf/glob/jackspeak/@isaacs/cliui/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],

View file

@ -1,7 +1,7 @@
{
"nodeModules": {
"x86_64-linux": "sha256-LhAICCt8oDBwcwwxDf11PBxJPgKx9gz0TcLcWEoSxp4=",
"aarch64-linux": "sha256-lDEEZsLHGVvMgI7dsQqURo+Fo/dUyMisoOy2bb9qUGA=",
"aarch64-darwin": "sha256-ktDDSk98gLUiafmmuWhsIO/1zqi06QeMzp1QvPoaWFE="
"x86_64-linux": "sha256-1YrR3eb2bEvJZx3q3iIpcQHk36nULYu1gs3X6nBEj8o=",
"aarch64-linux": "sha256-PnkwTGoX8CwvCw9+rZ10nXum4vzYY9OO2PEZfFj0yqw=",
"aarch64-darwin": "sha256-BLUBWz7HjYSgH4v+Y9nLy/lOsQeEcrel+KsagEE6Xro="
}
}

View file

@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/package.json",
"name": "opencode",
"description": "AI-powered development tool",
"version": "2.4.1",
"version": "2.4.0",
"private": true,
"type": "module",
"packageManager": "bun@1.4.4",
@ -51,9 +51,9 @@
"@hona/strobe": "0.44.1",
"@types/cross-spawn": "6.0.6",
"@octokit/rest": "22.0.0",
"@opentui/core": "0.9.9",
"@opentui/keymap": "0.9.9",
"@opentui/solid": "0.9.9",
"@opentui/core": "0.9.4",
"@opentui/keymap": "0.9.4",
"@opentui/solid": "0.9.4",
"@tanstack/solid-virtual": "3.13.37",
"@standard-schema/spec": "1.1.0",
"@kobalte/core": "0.13.13",
@ -175,7 +175,6 @@
"@pierre/trees@1.0.0-beta.6": "patches/@pierre%2Ftrees@1.0.0-beta.6.patch",
"@brendonovich/vite-plugin-opencode@0.1.3": "patches/@brendonovich%2Fvite-plugin-opencode@0.1.3.patch",
"@modelcontextprotocol/client@2.4.0": "patches/@modelcontextprotocol%2Fclient@2.4.0.patch",
"@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch",
"bun-pty@0.4.11": "patches/bun-pty@0.4.11.patch"
"@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch"
}
}

View file

@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "2.4.1",
"version": "2.4.0",
"name": "@opencode/ai",
"type": "module",
"license": "MIT",

View file

@ -44,8 +44,6 @@ export const protocol = Protocol.make({
}),
},
stream: AnthropicMessages.protocol.stream,
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
toolUpdates: AnthropicMessages.protocol.toolUpdates,
})
export * as AlibabaMessages from "./alibaba-messages.js"

View file

@ -81,7 +81,6 @@ export const protocol = Protocol.make({
),
)
}),
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
})
export * as AlibabaResponses from "./alibaba-responses.js"

View file

@ -62,8 +62,6 @@ export const protocol = Protocol.make({
id: "meta-messages",
body: { schema: Body, from: fromRequest },
stream: AnthropicMessages.protocol.stream,
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
toolUpdates: AnthropicMessages.protocol.toolUpdates,
})
export * as MetaMessages from "./meta-messages.js"

View file

@ -242,7 +242,6 @@ export const protocol = Protocol.make({
step,
terminal: OpenResponses.terminal,
},
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
})
export const httpTransport = OpenResponses.httpTransport

View file

@ -30,7 +30,7 @@ import {
withUntypedFrames,
} from "./shared.js"
import { classifyProviderFailure } from "../provider-error.js"
import { effortUpdate, resolveEffortUpdates } from "../effort-updates.js"
import { effortUpdate } from "../effort-updates.js"
import { toolsUpdate } from "../tool-updates.js"
import { OpenResponsesOptions } from "./utils/open-responses-options.js"
import { Lifecycle } from "./utils/lifecycle.js"
@ -496,11 +496,11 @@ export const lowerTool = Effect.fnUntraced(function* (protocolName: string, tool
})
export const lowerCustomTool = (tool: ToolDefinition, custom: OpenAIFreeform.Custom) => {
const grammar = OpenAIFreeform.grammar(custom)
const grammar = OpenAIFreeform.grammar(custom.format)
return {
type: "custom" as const,
name: tool.name,
description: OpenAIFreeform.description(tool, custom),
description: tool.description,
format: grammar ? { type: "grammar" as const, ...grammar } : { type: "text" as const },
}
}
@ -560,7 +560,7 @@ const lowerToolCall = (
...(id === undefined ? {} : { id }),
call_id: part.id,
name: part.name,
input: OpenAIFreeform.toRaw(custom, part.input, part.providerMetadata?.[providerMetadataKey]?.header),
input: OpenAIFreeform.toRaw(custom, part.input),
}
return {
type: "function_call",
@ -653,17 +653,10 @@ const lowerToolResultOutput = Effect.fnUntraced(function* (
const DEFAULT_EFFORT = "medium"
// A call's output only follows the whole assistant turn, and Meta's Muse models, directly or through a gateway,
// reject a commentary message replayed while a call is waiting for it. Text after a call keeps its place without
// the phase there; other providers accept it and keep the phase.
const rejectsPendingCommentary = (request: LLMRequest) =>
request.model.provider === "meta" || /(?:^|\/)muse-/i.test(request.model.id)
export const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter: ProviderAdapter) {
const input: OpenResponsesInputItem[] = []
const providerMetadataKey = metadataKey(request.model)
const custom = OpenAIFreeform.tools(request)
const pendingCommentaryRejected = rejectsPendingCommentary(request)
const customTool = (part: ToolCallPart | ToolResultPart) =>
part.namespace === undefined ? custom.get(part.name) : undefined
@ -708,7 +701,6 @@ export const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, a
const content: TextPart[] = []
const reasoningItems: Record<string, OpenResponsesReasoningInput> = {}
const hostedToolItems = new Set<string>()
let calledTool = false
const flushText = () => {
if (content.length === 0) return
const groups = content.reduce<
@ -717,8 +709,7 @@ export const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, a
const partMetadata = part.providerMetadata?.[providerMetadataKey]
const id = itemID(part.providerMetadata, providerMetadataKey) ?? metadata?.itemId
const partPhase = messagePhase(partMetadata?.phase)
const declared = partPhase === undefined ? metadata?.phase : partPhase
const phase = calledTool && declared === "commentary" && pendingCommentaryRejected ? undefined : declared
const phase = partPhase === undefined ? metadata?.phase : partPhase
const group = groups.at(-1)
if (group && group.id === id && group.phase === phase) group.parts.push(part)
else groups.push({ id, phase, parts: [part] })
@ -770,7 +761,6 @@ export const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, a
flushText()
if (part.providerExecuted === true) continue
input.push(lowerToolCall(part, providerMetadataKey, customTool(part)))
calledTool = true
continue
}
if (part.type === "tool-result" && part.providerExecuted === true) {
@ -904,10 +894,9 @@ export const fromRequestWithAdapter = Effect.fn("OpenResponses.fromRequestWithAd
const definitions = ProviderShared.flattenTools(request.tools)
const options = OpenResponsesOptions.resolve(request)
const custom = OpenAIFreeform.tools(request)
const updates = resolveEffortUpdates(request, options.reasoningEffort)
return {
...(yield* lowerConversation(updates.request, adapter)),
...lowerGeneration(request, { ...options, reasoningEffort: updates.effort }),
...(yield* lowerConversation(request, adapter)),
...lowerGeneration(request, options),
tools: definitions.length === 0 ? undefined : yield* lowerTools(definitions, adapter, custom),
tool_choice:
allowedToolChoice(options, custom) ??
@ -1348,25 +1337,19 @@ const onOutputItemDone = Effect.fnUntraced(function* (state: ParserState, item:
if (!item.call_id || !item.name) return [state, NO_EVENTS] satisfies StepResult
const custom = item.type === "custom_tool_call"
const metadata = providerMetadata(state, OpenAIFreeform.metadata(item.id, custom))
const final = { custom: state.custom.get(item.name), raw: rawInput(item) }
const input = custom ? OpenAIFreeform.fromRaw(final.custom, final.raw) : item.arguments
const registered = state.tools[item.id] !== undefined
const started = registered
? state.tools
const closed = custom ? OpenAIFreeform.close(state.tools, [item.id], final) : undefined
const tools = registered
? (closed?.tools ?? state.tools)
: ToolStream.start(state.tools, item.id, {
id: item.call_id,
name: item.name,
namespace: item.namespace,
providerMetadata: metadata,
})
// A custom call's final raw text sets its input, so it finishes without an override.
const closed = custom
? OpenAIFreeform.close(started, [item.id], state.custom, state.providerMetadataKey, rawInput(item))
: undefined
const result = yield* ToolStream.finish(
state.id,
closed?.tools ?? started,
item.id,
custom ? undefined : item.arguments,
)
const result = yield* ToolStream.finish(state.id, tools, item.id, input)
const events: LLMEvent[] = []
const finished = [...(closed?.events ?? []), ...(result.events ?? [])]
// A done-only call never streamed a start event, so open its lifecycle here.
@ -1458,16 +1441,7 @@ const onResponseFinish = Effect.fnUntraced(function* (state: ParserState, event:
events.push(...emitted)
}
// Some compatible providers omit output_item.done even after completing the response.
const open = OpenAIFreeform.close(
current.tools,
Object.keys(current.tools).filter(
(key) => current.tools[key]?.providerMetadata?.[current.providerMetadataKey]?.custom === true,
),
current.custom,
current.providerMetadataKey,
)
events.push(...open.events)
const pending = yield* ToolStream.finishAll(current.id, open.tools)
const pending = yield* ToolStream.finishAll(current.id, current.tools)
current = {
...current,
tools: pending.tools,
@ -1640,8 +1614,6 @@ export const protocol = Protocol.make({
step: (state: ParserState, event: Event) => step(state, normalize(state, event)),
terminal,
},
// Not every Open Responses server accepts `configuration_update`, so only models that opt in get it.
supportsEffortUpdates: (request) => request.model.capabilities?.reasoning?.updates === true,
})
export const httpTransport = HttpTransport.sseJson.with<OpenResponsesBody>()

View file

@ -406,12 +406,12 @@ const lowerTool = (
custom: OpenAIFreeform.Custom | undefined,
): OpenAIChatTool => {
if (custom) {
const grammar = OpenAIFreeform.grammar(custom)
const grammar = OpenAIFreeform.grammar(custom.format)
return {
type: "custom",
custom: {
name: tool.name,
description: OpenAIFreeform.description(tool, custom),
description: tool.description,
format: grammar ? { type: "grammar", grammar } : { type: "text" },
},
cache_control: options.cacheControl?.(tool.cache),
@ -450,10 +450,7 @@ const lowerToolCall = (part: ToolCallPart, options: MessageLoweringOptions): Ope
return {
id: options.toolCallID?.(part.id) ?? part.id,
type: "custom",
custom: {
name: part.name,
input: OpenAIFreeform.toRaw(custom, part.input, part.providerMetadata?.[options.providerMetadataKey]?.header),
},
custom: { name: part.name, input: OpenAIFreeform.toRaw(custom, part.input) },
}
return {
id: options.toolCallID?.(part.id) ?? part.id,
@ -950,12 +947,8 @@ const mapFinishReason = Effect.fnUntraced(function* (event: OpenAIChatEvent, rea
case "end":
return "stop" as const
case "length":
// Z.AI stops with this when the prompt plus the generated output fill the context window.
case "model_context_window_exceeded":
return "length" as const
case "content_filter":
// Z.AI ends a response its safety review blocked with "sensitive".
case "sensitive":
return "content-filter" as const
case "function_call":
case "tool_calls":
@ -1295,7 +1288,7 @@ const step = (state: ParserState, event: OpenAIChatEvent) =>
!incompleteTools &&
state.finishReason === undefined &&
Object.keys(tools).length > 0
? yield* finishTools(state, tools, customCalls)
? yield* finishTools(tools, customCalls)
: undefined
return [
@ -1324,12 +1317,8 @@ const step = (state: ParserState, event: OpenAIChatEvent) =>
})
// Custom calls close their JSON fragment before every pending call finishes.
const finishTools = Effect.fnUntraced(function* (
state: ParserState,
tools: ParserState["tools"],
customCalls: ReadonlySet<number>,
) {
const closed = OpenAIFreeform.close(tools, customCalls, state.custom, state.providerMetadataKey)
const finishTools = Effect.fnUntraced(function* (tools: ParserState["tools"], customCalls: ReadonlySet<number>) {
const closed = OpenAIFreeform.close(tools, customCalls)
const finished = yield* ToolStream.finishAll(ADAPTER, closed.tools)
return { tools: finished.tools, events: [...closed.events, ...finished.events] }
})
@ -1346,7 +1335,7 @@ export const finishEvents = Effect.fnUntraced(function* (state: ParserState) {
const events: LLMEvent[] = []
const toolCallEvents =
state.finishReason === undefined && Object.keys(state.tools).length > 0
? (yield* finishTools(state, state.tools, state.customCalls)).events
? (yield* finishTools(state.tools, state.customCalls)).events
: state.toolCallEvents
const hasToolCalls = toolCallEvents.length > 0
const reason = state.finishReason

View file

@ -1,6 +1,5 @@
import { Option, Schema } from "effect"
import {
JsonSchema,
ToolDefinition,
type Freeform,
type LLMEvent,
@ -16,198 +15,43 @@ import { toolsUpdate } from "../tool-updates.js"
// Calls keep the normal `{ field: raw }` input everywhere else; only the wire carries raw text.
export interface Custom {
/** The tool's required string parameter, which the raw text fills. */
/** The tool's one required string parameter, which the raw text fills. */
readonly field: string
readonly format: Freeform
/** The tool's other parameters, set on a first line. */
readonly options?: {
readonly fields: ReadonlyArray<OptionField>
/** How to write the line, added to the custom tool's description. */
readonly description: string
/** The grammar for the line and the raw text, when the model takes Lark. */
readonly grammar?: string
}
}
interface OptionField {
readonly name: string
readonly schema: JsonSchema
readonly required: boolean
}
// The other parameters go on a first line as a JSON object, `// @options: {"timeout": 5000}`, then the field's text.
// It is a JavaScript comment, so the line reads naturally before code.
export const PREFIX = "// @options:"
/**
* How a tool goes out: a custom tool when it declares `freeform` in a format the model accepts (`formats`; none when
* unset), with its required string parameter. Other parameters need a grammar for their values, and a raw
* text body when the model can't take Lark; otherwise the tool stays a JSON tool.
*/
export const resolve = (tool: ToolDefinition, formats: ReadonlyArray<Freeform["type"]> = []): Custom | undefined => {
const field = ToolDefinition.freeformField(tool.inputSchema, tool.freeform)
/** How a tool goes out: a custom tool when it declares `freeform` with one required string parameter. */
export const resolve = (tool: ToolDefinition): Custom | undefined => {
const field = ToolDefinition.freeformField(tool.inputSchema)
if (tool.freeform === undefined || tool.native !== undefined || field === undefined) return undefined
if (!formats.includes(tool.freeform.type)) return undefined
const lark = formats.includes("lark")
const required = Array.isArray(tool.inputSchema.required) ? tool.inputSchema.required : []
const fields = Object.entries(Schema.is(JsonSchema)(tool.inputSchema.properties) ? tool.inputSchema.properties : {})
.filter(([name]) => name !== field)
.map(([name, schema]) => ({
name,
schema: Schema.is(JsonSchema)(schema) ? schema : {},
required: required.includes(name),
}))
if (fields.length === 0) return { field, format: tool.freeform }
const rules = fields.flatMap((item) => valueRule(item.schema) ?? [])
if (rules.length !== fields.length || (!lark && tool.freeform.type !== "text")) return undefined
return {
field,
format: tool.freeform,
options: {
fields,
description: describe(field, fields),
grammar: lark ? lineGrammar(fields, rules, tool.freeform) : undefined,
},
}
return { field, format: tool.freeform }
}
// Keys in any order, with spaces after `{`, `:` and `,` and before `}`. The tool's own schema checks the values it
// gets, as it does for a JSON call. Without required parameters a call may leave the line out, so plain raw text
// can't start with the prefix. A tool's own grammar becomes the body, its `start` renamed to `fb_start`.
const lineGrammar = (fields: ReadonlyArray<OptionField>, rules: ReadonlyArray<string>, format: Freeform) => {
const body = format.type === "text" ? "ff_body" : "fb_start"
const plain = format.type === "text" ? "ff_plain" : body
return [
`start: ff_line ${body}${fields.some((item) => item.required) ? "" : ` | ${plain}`}`,
`ff_line: ${larkString(PREFIX)} " "* "{" " "* ff_pair (" "* "," " "* ff_pair)* " "* "}" "\\n"`,
`ff_pair: ${fields.map((item, index) => `${larkString(encodeJson(item.name))} " "* ":" " "* ${rules[index]}`).join(" | ")}`,
...(format.type === "text"
? ["ff_body: /[\\s\\S]+/", `ff_plain: /${notStartingWith(PREFIX)}/`]
: format.type === "regex"
? [`fb_start: /${format.pattern.replace(/\\?\//g, "\\/")}/`]
: [format.grammar.replace(/^([ \t]*)start([ \t]*:)/m, "$1fb_start$2")]),
].join("\n")
}
const valueRule = (schema: JsonSchema) => {
if (Array.isArray(schema.enum))
return schema.enum.length === 0
? undefined
: `(${schema.enum.map((item) => larkString(encodeJson(item))).join(" | ")})`
if (schema.type === "boolean") return '("true" | "false")'
if (schema.type === "number") return "/-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?/"
if (schema.type === "string") return '/"(?:[^"\\\\\\x00-\\x1f]|\\\\["\\\\\\/bfnrt]|\\\\u[0-9a-fA-F]{4})*"/'
if (schema.type !== "integer") return undefined
const lowest = minimum(schema)
if (lowest >= 1) return "/[1-9][0-9]*/"
return lowest >= 0 ? "/0|[1-9][0-9]*/" : "/-?(?:0|[1-9][0-9]*)/"
}
const minimum = (schema: JsonSchema) =>
Math.max(
typeof schema.minimum === "number" ? schema.minimum : -Infinity,
typeof schema.exclusiveMinimum === "number" ? schema.exclusiveMinimum + 1 : -Infinity,
)
const describe = (field: string, fields: ReadonlyArray<OptionField>) => {
const required = fields.filter((item) => item.required)
const example = required.length > 0 ? required : [fields.find((item) => item.schema.type === "boolean") ?? fields[0]]
return [
required.length === 0
? `To set the parameters below, start with a \`${PREFIX}\` line holding a JSON object of them, then write \`${field}\` from the next line. Leave the line out to use the defaults.`
: `Start with a \`${PREFIX}\` line holding a JSON object of the parameters below, then write \`${field}\` from the next line.`,
...fields.map(
(item) =>
`- \`${item.name}\` (${Array.isArray(item.schema.enum) ? `one of ${item.schema.enum.map((value) => encodeJson(value)).join(", ")}` : String(item.schema.type)}${item.required ? ", required" : ""})${typeof item.schema.description === "string" ? `: ${item.schema.description}` : ""}`,
),
"For example:",
`${PREFIX} {${example.map((item) => `${encodeJson(item.name)}: ${encodeJson(sample(item.schema))}`).join(", ")}}`,
`<${field}>`,
].join("\n")
}
const sample = (schema: JsonSchema) => {
if (Array.isArray(schema.enum)) return schema.enum[0]
if (schema.type === "boolean") return true
if (schema.type === "string") return "..."
return Math.max(1, minimum(schema))
}
const larkString = (text: string) => JSON.stringify(text)
// A regex for text that does not start with `prefix`: it differs from the prefix at some character, or is a shorter
// prefix of it.
const notStartingWith = (prefix: string) => {
const chars = [...prefix]
const head = (end: number) => chars.slice(0, end).map(escapeRegex).join("")
const differs = chars.map((char, index) => `${head(index)}[^${escapeClass(char)}]`)
const shorter = chars.slice(1).map((_, index) => head(index + 1))
return [`(?:${differs.join("|")})[\\s\\S]*`, ...shorter].join("|")
}
const escapeRegex = (char: string) => char.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&")
const escapeClass = (char: string) => char.replace(/[\\\]^\-/]/g, "\\$&")
/** Custom tools in this request, including ones added mid-conversation, by flattened tool name. */
export const tools = (request: LLMRequest): ReadonlyMap<string, Custom> => {
const formats = request.model.capabilities?.tools?.freeform
const added = request.messages.flatMap((message) => toolsUpdate(message)?.add ?? [])
return new Map(
flattenTools([...request.tools, ...added]).flatMap((tool) => {
const custom = resolve(tool, formats)
const custom = resolve(tool)
return custom ? [[tool.name, custom] as const] : []
}),
)
}
/** The grammar to send, or `undefined` for unconstrained text. */
export const grammar = (custom: Custom) => {
if (custom.options)
return custom.options.grammar === undefined
? undefined
: { syntax: "lark" as const, definition: custom.options.grammar }
const format = custom.format
if (format.type === "text") return undefined
return { syntax: format.type, definition: format.type === "regex" ? format.pattern : format.grammar }
}
/** The format's grammar, or `undefined` for unconstrained text. */
export const grammar = (format: Freeform) =>
format.type === "text"
? undefined
: { syntax: format.type, definition: format.type === "regex" ? format.pattern : format.grammar }
/** The custom tool's description, with how to write the line when the tool has other parameters. */
export const description = (tool: ToolDefinition, custom: Custom) =>
custom.options ? `${tool.description}\n\n${custom.options.description}` : tool.description
/**
* Raw text replayed for a past call: its field after a line for the other parameters, or the whole input as JSON when
* the field is not a string. The line the model wrote, saved as `header`, replays as is while it still says the same,
* so the prompt cache holds; otherwise, as for a call another model made, a fresh line is written.
*/
export const toRaw = (custom: Custom, input: unknown, header?: unknown) => {
/** Raw text replayed for a past call: its field, or the whole input as JSON when the field is not a string. */
export const toRaw = (custom: Custom, input: unknown) => {
const value = isRecord(input) ? input[custom.field] : undefined
if (typeof value !== "string" || !isRecord(input)) return encodeJson(input ?? {})
const fields = custom.options?.fields ?? []
const options = encodeJson(pick(fields, input))
if (options === "{}") return value
const saved = typeof header === "string" ? Option.getOrUndefined(decodeLine(header)) : undefined
const same = saved !== undefined && encodeJson(pick(fields, saved)) === options
return `${same ? header : `${PREFIX} ${options}`}\n${value}`
return typeof value === "string" ? value : encodeJson(input ?? {})
}
const pick = (fields: ReadonlyArray<OptionField>, input: Readonly<Record<string, unknown>>) =>
Object.fromEntries(fields.flatMap((item) => (input[item.name] === undefined ? [] : [[item.name, input[item.name]]])))
/**
* JSON arguments for a raw call, with its line as `header`. A call to an undeclared custom tool fills `input`. A line
* that isn't a JSON object stays raw text, which fails as malformed JSON; the tool's schema checks the rest.
*/
export const parse = (custom: Custom | undefined, raw: string) => {
const end = raw.indexOf("\n")
if (!custom?.options || !raw.startsWith(PREFIX) || end === -1) return { input: encodeJson({ [field(custom)]: raw }) }
const header = raw.slice(0, end)
const options = Option.getOrUndefined(decodeLine(header))
if (options === undefined) return { input: raw }
return { input: encodeJson({ ...options, [custom.field]: raw.slice(end + 1) }), header }
}
const decodeLine = (header: string) => decodeArguments(header.slice(PREFIX.length))
/** JSON arguments for a raw call. A call to an undeclared custom tool fills `input`. */
export const fromRaw = (custom: Custom | undefined, raw: string) => encodeJson({ [field(custom)]: raw })
const field = (custom: Custom | undefined) => custom?.field ?? "input"
@ -221,59 +65,25 @@ const STREAM_END = '"}'
const decodeArguments = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown)))
/**
* Close the JSON fragment of each open custom call, and set its input from the raw text. With a `final` raw input
* that the streamed fragments don't decode to, the final one sets the input and the streamed one stays unclosed. A
* line the model wrote goes in the call's provider metadata as `header`, so it replays exactly.
* Close the JSON fragment of each open custom call. With a `final` raw input, a call only closes when its fragments
* decode to it, so an authoritative final input that disagrees replaces the streamed one instead.
*/
export const close = <K extends string | number>(
tools: ToolStream.State<K>,
keys: Iterable<K>,
custom: ReadonlyMap<string, Custom>,
metadataKey: string,
final?: string,
final?: { readonly custom: Custom | undefined; readonly raw: string },
) =>
[...keys].reduce<{ readonly tools: ToolStream.State<K>; readonly events: ReadonlyArray<LLMEvent> }>(
(result, key) => {
const pending = result.tools[key]
if (!pending) return result
const definition = custom.get(pending.name)
const streamed = Option.getOrUndefined(decodeArguments(`${pending.input}${STREAM_END}`))?.[field(definition)]
if (final !== undefined && streamed !== final)
return {
tools: { ...result.tools, [key]: settle(pending, definition, metadataKey, final) },
events: result.events,
}
const streamed = pending && Option.getOrUndefined(decodeArguments(`${pending.input}${STREAM_END}`))
if (!pending || (final !== undefined && streamed?.[field(final.custom)] !== final.raw)) return result
const appended = ToolStream.append(result.tools, key, STREAM_END)
if (!appended) return result
return {
tools:
typeof streamed === "string"
? { ...appended.tools, [key]: settle(appended.tool, definition, metadataKey, streamed) }
: appended.tools,
events: [...result.events, ...appended.events],
}
return appended ? { tools: appended.tools, events: [...result.events, ...appended.events] } : result
},
{ tools, events: [] },
)
const settle = (
tool: ToolStream.PendingTool,
custom: Custom | undefined,
metadataKey: string,
raw: string,
): ToolStream.PendingTool => {
const parsed = parse(custom, raw)
if (parsed.header === undefined) return { ...tool, input: parsed.input }
return {
...tool,
input: parsed.input,
providerMetadata: {
...tool.providerMetadata,
[metadataKey]: { ...tool.providerMetadata?.[metadataKey], header: parsed.header },
},
}
}
/** Provider metadata marking a call that arrived as a custom tool call. */
export const metadata = (itemId: string, custom: boolean) => (custom ? { itemId, custom: true } : { itemId })

View file

@ -188,10 +188,7 @@ const toolUpdates = {
const isHostedTool = (tool: ToolEntry) => tool.type === "tool" && tool.native !== undefined
// Automatic `context_management` compaction drops developer messages, removal notices included, while the tools stay
// declared, so tool changes fold alongside it.
const declaresInPlace = (request: LLMRequest) =>
request.providerOptions?.contextManagement === undefined && toolUpdateKinds(request).includes("add")
const declaresInPlace = (request: LLMRequest) => toolUpdateKinds(request).includes("add")
const nativeImageToolInput = (tool: ToolDefinition) => {
const native = tool.native?.openai

View file

@ -92,7 +92,6 @@ export const protocol = Protocol.make({
from: fromRequest,
},
stream: ResponsesHostedTools.stream(adapter, HOSTED_TOOLS),
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
})
const compactFlat = ResponsesCompaction.make(adapter, (request) =>

View file

@ -29,8 +29,6 @@ export const protocol = Protocol.make({
id: "zai-messages",
body: { schema: Body, from: fromRequest },
stream: AnthropicMessages.protocol.stream,
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
toolUpdates: AnthropicMessages.protocol.toolUpdates,
})
export * as ZAIMessages from "./zai-messages.js"

View file

@ -18,8 +18,6 @@ const patterns = [
/input is too long for (?:the )?(?:requested|selected) model/i,
// OpenCode Go
/too large for the model'?s configured input limit/i,
// Tencent TokenHub code 400003, which OpenCode Go passes through for Hy models.
/input tokens exceeds? the model'?s? context limit/i,
// Cloudflare Workers AI reports this as HTTP 413.
/exceeded this model context window limit/i,
/exceeds the context window/i,

View file

@ -237,7 +237,6 @@ const responsesProtocol = Protocol.make({
),
},
stream: OpenResponses.protocol.stream,
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
})
export const route = Route.make({

View file

@ -113,19 +113,14 @@ const rateLimitDetails = (headers: Record<string, string>, retryAfter: number |
const MAX_BODY_CHARS = 2000
const requestTarget = (url: string) => {
const parsed = URL.parse(url)
return parsed ? `${parsed.origin}${parsed.pathname}` : url.split(/[?#]/)[0]
}
// Without a recognized message, show the raw body so the provider's explanation is never dropped.
const providerMessage = (request: HttpClientRequest.HttpClientRequest, status: number, body: string | void) => {
const providerMessage = (status: number, body: string | void) => {
const fallback = `Provider request failed with HTTP ${status}`
const text = body?.trim() ?? ""
const message = providerErrorMessage(text)
if (message) return message
// Gateway and proxy HTML error pages are markup, not an explanation.
if (!text || /^<(?:!doctype|html)/i.test(text)) return `${fallback} (${request.method} ${requestTarget(request.url)})`
if (!text || /^<(?:!doctype|html)/i.test(text)) return fallback
return `${fallback}: ${text.length > MAX_BODY_CHARS ? `${text.slice(0, MAX_BODY_CHARS)}…` : text}`
}
@ -134,11 +129,7 @@ const statusError = (response: HttpClientResponse.HttpClientResponse) =>
if (response.status < 400) return response
const result = yield* response.text.pipe(Effect.result)
return yield* httpFailure({
message: providerMessage(
response.request,
response.status,
result._tag === "Success" ? result.success : undefined,
),
message: providerMessage(response.status, result._tag === "Success" ? result.success : undefined),
url: response.request.url,
status: response.status,
responseHeaders: headerDetails(response.headers),

View file

@ -190,25 +190,14 @@ export class AIError extends Schema.TaggedError<AIError>()("AI.Error", {
return undefined
}
/**
* The provider's `x-should-retry` answer for a failed response. A successful response's header was sent before the
* failure happened, such as a connection dropped while the body streams, so it says nothing about it.
*/
get retryHint(): boolean | undefined {
const http = this.reason.http
if (http === undefined || http.status < 400) return undefined
const header = http.headers["x-should-retry"]
if (header === "true") return true
if (header === "false") return false
return undefined
}
/**
* Whether a failed call may succeed when sent again: rate limits, provider-side failures, transport failures that did
* not deliver an accepted write, and unrecognized failures. Callers decide which calls are safe to repeat.
*/
get isRetryable(): boolean {
if (this.retryHint !== undefined) return this.retryHint
const override = this.reason.http?.headers["x-should-retry"]
if (override === "true") return true
if (override === "false") return false
switch (this.reason._tag) {
case "RateLimit":
case "ProviderInternal":

View file

@ -393,9 +393,8 @@ const toolChanges = (input: ToolChangesInput): ToolChanges => ({
})
/**
* Raw-text wire encoding for a tool with exactly one required string parameter, or the one its `field` names among
* others. Models that accept the format write that parameter's value directly instead of JSON arguments, after a
* first line holding the others; calls still decode to the normal object input.
* Raw-text wire encoding for a tool with exactly one required string parameter. Models that accept the format
* write that parameter's value directly instead of JSON arguments; calls still decode to the normal object input.
*/
export const Freeform = Tool.Freeform
export type Freeform = Tool.Freeform
@ -427,15 +426,12 @@ export namespace ToolDefinition {
/** Normalize tool definition input into the canonical `ToolDefinition` class. */
export const make = (input: Input) => (input instanceof ToolDefinition ? input : new ToolDefinition(input))
/**
* The parameter a freeform call fills, when it is a required string: the one the format's `field` names, otherwise
* the input schema's only property.
*/
export const freeformField = (schema: JsonSchema, freeform?: Freeform) => {
/** The parameter a freeform call fills: the input schema's only property, when it is a required string. */
export const freeformField = (schema: JsonSchema) => {
const properties = Object.entries(Schema.is(JsonSchema)(schema.properties) ? schema.properties : {})
if (freeform?.field === undefined && properties.length !== 1) return undefined
const [name, property] = properties.find(([name]) => (freeform?.field ?? name) === name) ?? []
if (name === undefined || !Schema.is(JsonSchema)(property) || property.type !== "string") return undefined
if (properties.length !== 1) return undefined
const [name, property] = properties[0]
if (!Schema.is(JsonSchema)(property) || property.type !== "string") return undefined
return Array.isArray(schema.required) && schema.required.includes(name) ? name : undefined
}
}

View file

@ -247,7 +247,7 @@ export interface Capabilities {
readonly strict?: boolean
readonly choice?: ReadonlyArray<"auto" | "none" | "required" | "tool">
readonly search?: boolean
/** Input formats accepted by custom (free-form) tools. Unset or empty: freeform tools go out as JSON tools. */
/** Input formats accepted by custom (free-form) tools. */
readonly freeform?: ReadonlyArray<"text" | "lark" | "regex">
/**
* Tool changes the model takes mid-conversation without changing the leading tool declaration, so the prompt

View file

@ -59,22 +59,13 @@ type FreeformField<T> = {
: never
}[keyof T]
type RequiredStringField<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? never : T[K] extends string ? K : never
}[keyof T]
/**
* `Freeform` for exactly one required string field or unknown ones (a JSON Schema `input`), `Freeform` naming its
* `field` for a required string field among others, otherwise `undefined`.
*/
/** `Freeform` for exactly one required string field or unknown ones (a JSON Schema `input`), otherwise `undefined`. */
export type FreeformOption<Input extends ToolInput> =
unknown extends ToolInputType<Input>
? Freeform
: [FreeformField<ToolInputType<Input>>] extends [never]
? [RequiredStringField<ToolInputType<Input>>] extends [never]
? undefined
: Freeform & { readonly field: RequiredStringField<ToolInputType<Input>> }
: Freeform & { readonly field?: FreeformField<ToolInputType<Input>> }
? undefined
: Freeform
/**
* A type-safe LLM tool. Each tool bundles its own description, input
@ -249,12 +240,8 @@ export const emptyInputJsonSchema = (schema: Schema.Top): JsonSchema.JsonSchema
}
const definition = (input: ToolDefinitionInput) => {
if (input.freeform !== undefined && ToolDefinition.freeformField(input.inputSchema, input.freeform) === undefined)
throw new Error(
input.freeform.field === undefined
? "A freeform tool needs exactly one parameter, a required string"
: `A freeform tool's \`${input.freeform.field}\` parameter must be a required string`,
)
if (input.freeform !== undefined && ToolDefinition.freeformField(input.inputSchema) === undefined)
throw new Error("A freeform tool needs exactly one parameter, a required string")
return new ToolDefinition(input)
}

View file

@ -6,17 +6,7 @@ import { compileRequest } from "../src/route/client.js"
import { AnthropicMessages } from "../src/protocols/anthropic-messages.js"
import { OpenAIResponses } from "../src/protocols/openai-responses.js"
import { Gemini } from "../src/protocols/gemini.js"
import {
Alibaba,
AmazonBedrockMantle,
GoogleVertexMessages,
Meta,
OpenAI,
OpenRouter,
XAI,
ZAICodingPlan,
} from "../src/providers.js"
import { OpenAICompatibleResponses } from "../src/protocols/openai-compatible-responses.js"
import { AmazonBedrockMantle, GoogleVertexMessages, OpenAI } from "../src/providers.js"
import { applyEffortUpdates } from "../src/effort-updates.js"
import { it, testEffect } from "./lib/effect.js"
import { dynamicResponse } from "./lib/http.js"
@ -582,95 +572,3 @@ describe("OpenAI Responses effort updates", () => {
}),
)
})
describe("Open Responses effort updates", () => {
const compatible = (updates?: boolean) =>
OpenAICompatibleResponses.route
.with({
provider: "github-copilot",
endpoint: { baseURL: "https://api.githubcopilot.test" },
auth: Auth.bearer("test"),
})
.model({ id: "gpt-6.2-sol", capabilities: updates === undefined ? undefined : { reasoning: { updates } } })
it.effect("lowers markers to configuration_update items and freezes reasoning.effort for opted-in models", () =>
Effect.gen(function* () {
const prepared = yield* compileRequest(
ai.request({ model: compatible(true), messages: conversation, providerOptions: { reasoningEffort: "low" } }),
)
expect(prepared.body.reasoning).toEqual({ effort: "high" })
expect(prepared.body.input).toEqual([
{ type: "message", role: "user", content: [{ type: "input_text", text: "Before." }] },
{ type: "configuration_update", reasoning: { effort: "low" } },
{ type: "message", role: "user", content: [{ type: "input_text", text: "After." }] },
])
}),
)
it.effect("strips markers unless the model opts in", () =>
Effect.gen(function* () {
const prepared = yield* compileRequest(
ai.request({ model: compatible(), messages: conversation, providerOptions: { reasoningEffort: "low" } }),
)
expect(updates(prepared.body)).toEqual([])
expect(prepared.body.reasoning).toEqual({ effort: "low" })
}),
)
})
describe("Routes built on the Anthropic Messages and Open Responses formats", () => {
// Each of these routes makes its own protocol from a shared body; the effort update support must come along.
const wrapped = [
...Alibaba.routes,
...Meta.routes,
...ZAICodingPlan.routes,
...XAI.routes,
...OpenRouter.routes,
].filter((route) => route.id.endsWith("-messages") || route.id.endsWith("-responses"))
test("covers every wrapping route", () => {
expect(wrapped.map((route) => route.id).toSorted()).toEqual([
"alibaba-messages",
"alibaba-responses",
"meta-messages",
"meta-responses",
"openrouter-responses",
"xai-responses",
"zai-coding-messages",
"zai-coding-responses",
])
})
for (const route of wrapped) {
const model = (updates?: boolean) =>
route
.with({ endpoint: { baseURL: "https://api.example.test/v1" }, auth: Auth.bearer("test") })
.model({ id: "test-model", capabilities: updates === undefined ? undefined : { reasoning: { updates } } })
const messages = route.id.endsWith("-messages")
it.effect(`${route.id} sends effort updates only for models that opt in`, () =>
Effect.gen(function* () {
const send = (updates?: boolean) =>
compileRequest(
ai.request({
model: model(updates),
messages: conversation,
providerOptions: messages ? { effort: "low" } : { reasoningEffort: "low" },
cache: "none",
}),
).pipe(
Effect.map((prepared) => {
const body = prepared.body as { messages?: Array<{ role: string }>; input?: Array<{ type?: string }> }
return messages
? (body.messages ?? []).some((message) => message.role === "system")
: (body.input ?? []).some((item) => item.type === "configuration_update")
}),
)
expect(yield* send(true)).toBe(true)
expect(yield* send()).toBe(false)
}),
)
}
})

View file

@ -474,33 +474,12 @@ describe("RequestExecutor", () => {
}).pipe(Effect.provide(fixedResponse("x".repeat(5000), { status: 400 }))),
)
it.effect("shows the request method and URL without its query for empty error bodies", () =>
Effect.gen(function* () {
const executor = yield* RequestExecutor.Service
const error = yield* executor
.execute(HttpClientRequest.post("https://host.test/path?key=secret#fragment"))
.pipe(Effect.flip)
expect(error.message).toBe("Provider request failed with HTTP 404 (POST https://host.test/path)")
expect(error.message).not.toContain("secret")
}).pipe(Effect.provide(fixedResponse("", { status: 404 }))),
)
it.effect("keeps provider error bodies without the request URL", () =>
Effect.gen(function* () {
const executor = yield* RequestExecutor.Service
const error = yield* executor.execute(request).pipe(Effect.flip)
expect(error.message).toBe('Provider request failed with HTTP 404: {"code":"not_found"}')
}).pipe(Effect.provide(fixedResponse('{"code":"not_found"}', { status: 404 }))),
)
it.effect("does not show HTML error pages", () =>
Effect.gen(function* () {
const executor = yield* RequestExecutor.Service
const error = yield* executor.execute(request).pipe(Effect.flip)
expect(error.message).toBe("Provider request failed with HTTP 502 (POST https://provider.test/v1/chat)")
expect(error.message).toBe("Provider request failed with HTTP 502")
expect(error.reason.body).toContain("Bad Gateway")
}).pipe(Effect.provide(fixedResponse("<!DOCTYPE html><html><body>Bad Gateway</body></html>", { status: 502 }))),
)

View file

@ -11,44 +11,28 @@ const inputSchema = {
}
const tool = (input: Partial<ToolDefinition.Input> = {}) =>
ToolDefinition.make({ name: "run", description: "Run code", inputSchema, freeform: { type: "text" }, ...input })
// The formats a model that takes every kind of freeform tool lists.
const resolve = (
definition: ToolDefinition,
formats: ReadonlyArray<"text" | "lark" | "regex"> = ["text", "lark", "regex"],
) => OpenAIFreeform.resolve(definition, formats)
const custom = { field: "code", format: { type: "text" } } as const
const customs = new Map([["run", custom]])
const RAW = ['say "hi"\n\tdone\\', "naïve 😀 \u2028", "\u0000 }{ ]"]
describe("OpenAI freeform tools", () => {
test("resolves a freeform tool to its string field", () => {
expect(resolve(tool())).toEqual(custom)
expect(resolve(tool({ freeform: undefined }))).toBeUndefined()
expect(resolve(tool({ native: { openai: {} } }))).toBeUndefined()
expect(resolve(tool({ inputSchema: { ...inputSchema, properties: { code: { type: "number" } } } }))).toBeUndefined()
expect(resolve(tool({ inputSchema: { ...inputSchema, required: [] } }))).toBeUndefined()
// Naming the only field changes nothing.
expect(resolve(tool({ freeform: { type: "text", field: "code" } }))).toEqual({
field: "code",
format: { type: "text", field: "code" },
})
})
test("only sends a format the model accepts, and none when the model doesn't say", () => {
expect(resolve(tool(), ["text", "lark"])).toEqual(custom)
expect(OpenAIFreeform.resolve(tool())).toBeUndefined()
expect(resolve(tool(), [])).toBeUndefined()
expect(resolve(tool(), ["regex"])).toBeUndefined()
expect(OpenAIFreeform.resolve(tool())).toEqual(custom)
expect(OpenAIFreeform.resolve(tool({ freeform: undefined }))).toBeUndefined()
expect(OpenAIFreeform.resolve(tool({ native: { openai: {} } }))).toBeUndefined()
expect(
OpenAIFreeform.resolve(tool({ inputSchema: { ...inputSchema, properties: { code: { type: "number" } } } })),
).toBeUndefined()
expect(OpenAIFreeform.resolve(tool({ inputSchema: { ...inputSchema, required: [] } }))).toBeUndefined()
})
test("converts between raw text and the JSON input", () => {
for (const raw of RAW) {
const parsed = OpenAIFreeform.parse(custom, raw)
expect("input" in parsed && JSON.parse(parsed.input)).toEqual({ code: raw })
expect(OpenAIFreeform.toRaw(custom, { code: raw })).toBe(raw)
const json = OpenAIFreeform.fromRaw(custom, raw)
expect(JSON.parse(json)).toEqual({ code: raw })
expect(OpenAIFreeform.toRaw(custom, JSON.parse(json))).toBe(raw)
}
expect(OpenAIFreeform.parse(undefined, "x")).toEqual({ input: '{"input":"x"}' })
expect(OpenAIFreeform.fromRaw(undefined, "x")).toBe('{"input":"x"}')
expect(OpenAIFreeform.toRaw(custom, { code: 1 })).toBe('{"code":1}')
})
@ -62,24 +46,22 @@ describe("OpenAI freeform tools", () => {
name: "run",
input: fragments.join(""),
})
const closed = OpenAIFreeform.close(started, ["ctc_1"], customs, "openai", raw)
const closed = OpenAIFreeform.close(started, ["ctc_1"], { custom, raw })
expect(closed.events).toMatchObject([{ type: "tool-input-delta", text: '"}' }])
expect(JSON.parse(closed.tools.ctc_1?.input ?? "")).toEqual({ code: raw })
}
})
test("takes the final input when it disagrees with the streamed one", () => {
test("leaves a call open when the final input disagrees with the streamed one", () => {
const tools = ToolStream.start(ToolStream.empty<string>(), "ctc_1", {
id: "call_1",
name: "run",
input: OpenAIFreeform.streamStart(custom, "partial"),
})
const closed = OpenAIFreeform.close(tools, ["ctc_1", "missing"], customs, "openai", "different")
const closed = OpenAIFreeform.close(tools, ["ctc_1", "missing"], { custom, raw: "different" })
expect(closed.events).toEqual([])
expect(JSON.parse(closed.tools.ctc_1?.input ?? "")).toEqual({ code: "different" })
expect(
OpenAIFreeform.close(tools, ["ctc_1"], customs, "openai").events.filter(LLMEvent.is.toolInputDelta),
).toHaveLength(1)
expect(closed.tools).toBe(tools)
expect(OpenAIFreeform.close(tools, ["ctc_1"]).events.filter(LLMEvent.is.toolInputDelta)).toHaveLength(1)
})
test("keeps an item id only while the call type is unchanged", () => {
@ -92,162 +74,3 @@ describe("OpenAI freeform tools", () => {
expect(OpenAIFreeform.keepsItemID(undefined, "openai", false)).toBe(true)
})
})
describe("OpenAI freeform tools with other parameters", () => {
const schema = (properties: Record<string, unknown>, required = ["code"]) => ({
type: "object",
properties: { code: { type: "string" }, ...properties },
required,
})
const executeSchema = schema({
timeout: { type: "integer", exclusiveMinimum: 0, description: "How long to wait." },
background: { type: "boolean" },
})
const format = { type: "text", field: "code" } as const
const options = resolve(tool({ inputSchema: executeSchema, freeform: format }))!
const parsed = (raw: string, definition = options) => {
const result = OpenAIFreeform.parse(definition, raw)
return { input: JSON.parse(result.input), header: result.header }
}
test("sends an order-free grammar and a description built from the schema", () => {
expect(options.options?.grammar).toBe(
[
"start: ff_line ff_body | ff_plain",
'ff_line: "// @options:" " "* "{" " "* ff_pair (" "* "," " "* ff_pair)* " "* "}" "\\n"',
'ff_pair: "\\"timeout\\"" " "* ":" " "* /[1-9][0-9]*/ | "\\"background\\"" " "* ":" " "* ("true" | "false")',
"ff_body: /[\\s\\S]+/",
String.raw`ff_plain: /(?:[^\/]|\/[^\/]|\/\/[^ ]|\/\/ [^@]|\/\/ @[^o]|\/\/ @o[^p]|\/\/ @op[^t]|\/\/ @opt[^i]|\/\/ @opti[^o]|\/\/ @optio[^n]|\/\/ @option[^s]|\/\/ @options[^:])[\s\S]*|\/|\/\/|\/\/ |\/\/ @|\/\/ @o|\/\/ @op|\/\/ @opt|\/\/ @opti|\/\/ @optio|\/\/ @option|\/\/ @options/`,
].join("\n"),
)
expect(OpenAIFreeform.description(tool(), options)).toBe(
[
"Run code",
"",
"To set the parameters below, start with a `// @options:` line holding a JSON object of them, then write `code` from the next line. Leave the line out to use the defaults.",
"- `timeout` (integer): How long to wait.",
"- `background` (boolean)",
"For example:",
'// @options: {"background": true}',
"<code>",
].join("\n"),
)
})
test("reads keys in any order, with spaces, and replays the line as written", () => {
const cases = [
['// @options: {"timeout":5000}\nawait build()', { code: "await build()", timeout: 5000 }],
['// @options: { "timeout": 1, "background": true }\nx', { code: "x", timeout: 1, background: true }],
['// @options:{"background" :false,"timeout":2}\r\nx', { code: "x", timeout: 2, background: false }],
["await build()", { code: "await build()" }],
] as const
for (const [raw, input] of cases) {
const result = parsed(raw)
expect(result).toEqual({ input, header: raw.startsWith("//") ? raw.slice(0, raw.indexOf("\n")) : undefined })
expect(OpenAIFreeform.toRaw(options, input, "header" in result ? result.header : undefined)).toBe(raw)
}
})
test("writes a fresh line when the input no longer matches the saved one, or there is none", () => {
const header = '// @options: { "background": true }'
expect(OpenAIFreeform.toRaw(options, { code: "x", background: true, timeout: 9 }, header)).toBe(
'// @options: {"timeout":9,"background":true}\nx',
)
expect(OpenAIFreeform.toRaw(options, { code: "x", background: true })).toBe('// @options: {"background":true}\nx')
expect(OpenAIFreeform.toRaw(options, { code: "x" }, header)).toBe("x")
})
test("leaves a line that isn't a JSON object as raw text, so it fails as malformed JSON", () => {
expect(OpenAIFreeform.parse(options, "// @options: {timeout: 1}\nx")).toEqual({
input: "// @options: {timeout: 1}\nx",
})
// The tool's own schema checks keys and values, as for a JSON call.
expect(parsed('// @options: {"timeout":"5"}\nx')).toEqual({
input: { code: "x", timeout: "5" },
header: '// @options: {"timeout":"5"}',
})
// A line with nothing after it is plain text, not a call with empty code.
expect(parsed('// @options: {"background":true}')).toEqual({ input: { code: '// @options: {"background":true}' } })
})
test("takes number, string and enum values", () => {
const definition = resolve(
tool({
inputSchema: schema({
ratio: { type: "number" },
cwd: { type: "string" },
mode: { type: "string", enum: ["fast", "safe"] },
}),
freeform: format,
}),
)!
expect(definition.options?.grammar).toContain(
'"\\"ratio\\"" " "* ":" " "* /-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?/',
)
expect(definition.options?.grammar).toContain(
'"\\"cwd\\"" " "* ":" " "* /"(?:[^"\\\\\\x00-\\x1f]|\\\\["\\\\\\/bfnrt]|\\\\u[0-9a-fA-F]{4})*"/',
)
expect(definition.options?.grammar).toContain('"\\"mode\\"" " "* ":" " "* ("\\"fast\\"" | "\\"safe\\"")')
const raw = '// @options: {"mode": "safe", "ratio": 1.5e2, "cwd": "C:\\\\src"}\nls'
expect(parsed(raw, definition)).toMatchObject({ input: { code: "ls", mode: "safe", ratio: 150, cwd: "C:\\src" } })
})
test("requires the line when a parameter is required", () => {
const definition = resolve(
tool({ inputSchema: schema({ path: { type: "string" } }, ["code", "path"]), freeform: format }),
)!
expect(definition.options?.grammar?.split("\n").at(0)).toBe("start: ff_line ff_body")
expect(parsed('// @options: {"path": "a.ts"}\nx', definition)).toMatchObject({ input: { code: "x", path: "a.ts" } })
})
test("composes a tool's own grammar as the body", () => {
const grammar = ["start: patch LF", 'patch: "*** " /(.+)/', "%import common.LF"].join("\n")
const definition = resolve(
tool({ inputSchema: executeSchema, freeform: { type: "lark", grammar, field: "code" } }),
)!
expect(definition.options?.grammar?.split("\n").at(0)).toBe("start: ff_line fb_start | fb_start")
expect(definition.options?.grammar?.split("\n").slice(-3)).toEqual([
"fb_start: patch LF",
'patch: "*** " /(.+)/',
"%import common.LF",
])
})
test("parses the line without a grammar for a model that only takes text", () => {
const definition = resolve(tool({ inputSchema: executeSchema, freeform: format }), ["text"])!
expect(OpenAIFreeform.grammar(definition)).toBeUndefined()
expect(definition.options?.description).toBe(options.options?.description)
expect(parsed('// @options: {"background": true}\nx', definition)).toMatchObject({
input: { code: "x", background: true },
})
// Without Lark, only a raw text body can share the wire with the line.
expect(
resolve(tool({ inputSchema: executeSchema, freeform: { type: "regex", pattern: "x", field: "code" } }), [
"text",
"regex",
]),
).toBeUndefined()
})
test("stays a JSON tool when a parameter can't go on the line", () => {
for (const property of [{ type: "object" }, { type: ["string", "null"] }, { enum: [] }])
expect(resolve(tool({ inputSchema: schema({ env: property }), freeform: format }))).toBeUndefined()
expect(resolve(tool({ inputSchema: executeSchema, freeform: { ...format, field: "script" } }))).toBeUndefined()
})
test("closes a streamed call with the parsed input and its line in the metadata", () => {
const raw = '// @options: {"background": true}\nx'
const started = ToolStream.start(ToolStream.empty<number>(), 0, {
id: "call_1",
name: "run",
input: OpenAIFreeform.streamStart(options, raw),
providerMetadata: { openai: { itemId: "ctc_1", custom: true } },
})
const closed = OpenAIFreeform.close(started, [0], new Map([["run", options]]), "openai")
expect(closed.events).toMatchObject([{ type: "tool-input-delta", text: '"}' }])
expect(JSON.parse(closed.tools[0]?.input ?? "")).toEqual({ code: "x", background: true })
expect(closed.tools[0]?.providerMetadata).toEqual({
openai: { itemId: "ctc_1", custom: true, header: '// @options: {"background": true}' },
})
})
})

View file

@ -21,8 +21,6 @@ describe("provider error classification", () => {
"Prompt exceeds max length",
"The input is too long for the selected model.",
"This text request is too large for the model's configured input limit.",
"[400003] Input tokens exceed the model context limit.",
"The number of input tokens exceeds the model's context limit.",
// LiteLLM's own check, before it calls the model.
"litellm.ContextWindowExceededError: litellm.BadRequestError: litellm._pre_call_checks: Context Window exceeded for given call. No models have context window large enough for this call.",
]
@ -30,19 +28,6 @@ describe("provider error classification", () => {
expect(messages.every(isContextOverflow)).toBe(true)
})
test("classifies Tencent's 400003 passed through OpenCode Go as context overflow", () => {
const go = {
error: {
type: "server_error",
message: "Upstream request failed: [400003] Input tokens exceed the model context limit.",
},
}
expect(
classifyProviderFailure({ message: go.error.message, status: 400, rawBody: JSON.stringify(go) }),
).toMatchObject({ _tag: "InvalidRequest", classification: "context-overflow" })
})
test("classifies Anthropic request_too_large as recoverable overflow", () => {
expect(
classifyProviderFailure({
@ -805,24 +790,6 @@ describe("AIError getters", () => {
expect([rateLimit, invalidRequest, transport].map(isRetryable)).toEqual([true, false, true])
})
test("retryHint applies to failed responses, not streams that drop after a successful one", () => {
const failure = (status: number, hint: string) =>
new AIError({
reason: new TransportError({
message: "Connection lost while reading the response: ECONNRESET",
transport: "http",
operation: "read",
code: "ECONNRESET",
http: new HttpContext({ url: "https://api.test/v1", status, headers: { "x-should-retry": hint } }),
}),
})
expect([failure(500, "false").retryHint, failure(500, "true").retryHint]).toEqual([false, true])
expect([failure(200, "false").retryHint, failure(200, "true").retryHint]).toEqual([undefined, undefined])
expect(failure(500, "false").isRetryable).toBe(false)
expect(failure(200, "false").isRetryable).toBe(true)
})
test("retryAfterMs", () => {
expect([rateLimit.retryAfterMs, invalidRequest.retryAfterMs, transport.retryAfterMs]).toEqual([
2000,

View file

@ -1,6 +1,14 @@
import { describe, expect } from "bun:test"
import { Effect, Schema } from "effect"
import { ai, type Freeform, LanguageModel, LLMEvent, Message, toDefinitions, ToolCallPart } from "../../src/effect.js"
import {
ai,
type Freeform,
type LanguageModel,
LLMEvent,
Message,
toDefinitions,
ToolCallPart,
} from "../../src/effect.js"
import * as AmazonBedrockMantle from "../../src/providers/amazon-bedrock-mantle.js"
import * as Anthropic from "../../src/providers/anthropic.js"
import * as Azure from "../../src/providers/azure.js"
@ -40,17 +48,8 @@ const body = (model: LanguageModel, freeform = lark) =>
Effect.map((prepared) => prepared.body),
)
// A model only takes freeform tools in the formats its capabilities list.
const withFreeform = <Model extends LanguageModel>(model: Model) =>
LanguageModel.update(model, {
capabilities: {
...model.capabilities,
tools: { ...model.capabilities?.tools, freeform: ["text", "lark", "regex"] },
},
})
const responses = withFreeform(OpenAI.model("gpt-5.4", { apiKey: "test" }))
const chat = withFreeform(OpenAI.chatModel("gpt-5.4", { apiKey: "test" }))
const responses = OpenAI.model("gpt-5.4", { apiKey: "test" })
const chat = OpenAI.chatModel("gpt-5.4", { apiKey: "test" })
const RESPONSES_LARK = {
type: "custom",
@ -119,14 +118,14 @@ describe("freeform tools", () => {
OpenRouter.responsesModel("openai/gpt-5.4", settings),
DigitalOcean.responsesModel("openai-gpt-5.4", settings),
Venice.responsesModel("openai-gpt-54", settings),
].map(withFreeform)
]
const chatModels = [
Azure.chatModel("gpt-5.4", { ...settings, resourceName: "fixture" }),
AmazonBedrockMantle.chatModel("openai.gpt-5.4", { ...settings, region: "us-east-1" }),
VercelAIGateway.chatModel("openai/gpt-5.4", settings),
OpenRouter.model("openai/gpt-5.4", settings),
OpenAICompatible.model("gpt-5.4", { ...settings, baseURL: "https://chat.test/v1" }),
].map(withFreeform)
]
for (const model of responsesModels) {
const prepared = yield* body(model)
expect(prepared.tools).toEqual([RESPONSES_LARK])
@ -313,143 +312,4 @@ describe("freeform tools", () => {
expect(make(Schema.Struct({ code: Schema.String }))._definition.freeform).toEqual({ type: "text" })
}),
)
// A tool whose raw body is one field among others takes them on a first line.
const optionsTool = toDefinitions([
tool({
name: "run",
description: "Run code",
input: Schema.Struct({
code: Schema.String,
timeout: Schema.optionalKey(Schema.Number.check(Schema.isInt())),
background: Schema.optionalKey(Schema.Boolean),
}),
success: Schema.String,
freeform: { type: "text", field: "code" },
}),
])
const LINE = '// @options: { "background": true, "timeout": 5 }'
const RAW = `${LINE}\nawait build()`
const INPUT = { code: "await build()", background: true, timeout: 5 }
const item = { type: "custom_tool_call", id: "ctc_1", call_id: "call_1", name: "run", input: "" }
const generate = (events: ReadonlyArray<unknown>, model: LanguageModel = responses) =>
LLMClient.generate(ai.request({ model, prompt: "Run it.", tools: optionsTool })).pipe(
Effect.provide(fixedResponse(sseEvents(...events))),
)
it.effect("sends a tool with other parameters with a grammar and a description of the line", () =>
Effect.gen(function* () {
const [sent] = (yield* body(responses, optionsTool)).tools
expect(sent).toMatchObject({ type: "custom", name: "run", format: { type: "grammar", syntax: "lark" } })
expect(sent.description).toStartWith("Run code\n\nTo set the parameters below, start with a `// @options:`")
expect(sent.format.definition).toContain('| "\\"background\\"" " "* ":" " "* ("true" | "false")')
expect((yield* body(chat, optionsTool)).tools[0]).toMatchObject({
type: "custom",
custom: {
description: sent.description,
format: { type: "grammar", grammar: { syntax: "lark", definition: sent.format.definition } },
},
})
// A model that only takes text gets no grammar, and other protocols the JSON tool as is.
const text = LanguageModel.update(responses, { capabilities: { tools: { freeform: ["text"] } } })
expect((yield* body(text, optionsTool)).tools).toEqual([{ ...sent, format: { type: "text" } }])
expect((yield* body(Anthropic.model("claude-sonnet-4-5", { apiKey: "test" }), optionsTool)).tools).toMatchObject([
{ name: "run", description: "Run code", input_schema: { properties: { background: {}, timeout: {} } } },
])
}),
)
it.effect("reads the line on Responses and replays it exactly as written", () =>
Effect.gen(function* () {
const response = yield* generate([
{ type: "response.output_item.added", output_index: 0, item },
{ type: "response.custom_tool_call_input.delta", output_index: 0, item_id: "ctc_1", delta: `${LINE}\n` },
{ type: "response.custom_tool_call_input.delta", output_index: 0, item_id: "ctc_1", delta: "await build()" },
{ type: "response.output_item.done", output_index: 0, item: { ...item, input: RAW } },
{ type: "response.completed", response: { id: "resp_1" } },
])
expect(response.events.filter(LLMEvent.is.toolCall)).toEqual([
expect.objectContaining({
id: "call_1",
input: INPUT,
providerMetadata: { openai: { itemId: "ctc_1", custom: true, header: LINE } },
}),
])
const replay = (message: Message) =>
compileRequest(ai.request({ model: responses, messages: [message], tools: optionsTool })).pipe(
Effect.map((prepared) => prepared.body.input[0]),
)
expect(yield* replay(response.message)).toMatchObject({ type: "custom_tool_call", call_id: "call_1", input: RAW })
// A changed input, like one a hook edited, gets a fresh line.
const call = response.message.content.find((part) => part.type === "tool-call")!
const edited = Message.assistant([ToolCallPart.make({ ...call, input: { ...INPUT, timeout: 6 } })])
expect(yield* replay(edited)).toMatchObject({
input: '// @options: {"timeout":6,"background":true}\nawait build()',
})
}),
)
it.effect("reads the line on Chat and replays it exactly as written", () =>
Effect.gen(function* () {
const chunk = (call: Record<string, unknown>) => ({
id: "chatcmpl_1",
choices: [{ index: 0, delta: { tool_calls: [{ index: 0, ...call }] }, finish_reason: null }],
})
const response = yield* generate(
[
chunk({ id: "call_1", type: "custom", custom: { name: "run", input: `${LINE}\n` } }),
chunk({ custom: { input: "await build()" } }),
{ id: "chatcmpl_1", choices: [{ index: 0, delta: {}, finish_reason: "tool_calls" }] },
],
chat,
)
expect(response.events.filter(LLMEvent.is.toolCall)).toEqual([
expect.objectContaining({ id: "call_1", input: INPUT }),
])
const replay = yield* compileRequest(
ai.request({ model: chat, messages: [response.message], tools: optionsTool }),
)
expect(replay.body.messages[0]).toMatchObject({ tool_calls: [{ type: "custom", custom: { input: RAW } }] })
}),
)
it.effect("finishes a custom call that only the completed response ends", () =>
Effect.gen(function* () {
const response = yield* generate([
{ type: "response.output_item.added", output_index: 0, item },
{ type: "response.custom_tool_call_input.delta", output_index: 0, item_id: "ctc_1", delta: RAW },
{ type: "response.completed", response: { id: "resp_1" } },
])
expect(response.events.filter(LLMEvent.is.toolCall)).toEqual([
expect.objectContaining({ id: "call_1", input: INPUT }),
])
}),
)
it.effect("fails a call whose line isn't a JSON object as malformed input", () =>
Effect.gen(function* () {
const raw = "// @options: {background: true}\nawait build()"
const response = yield* generate([
{ type: "response.output_item.done", output_index: 0, item: { ...item, input: raw } },
{ type: "response.completed", response: { id: "resp_1" } },
])
expect(response.events.filter(LLMEvent.is.toolCall)).toEqual([])
expect(response.events.filter(LLMEvent.is.toolInputError)).toEqual([
expect.objectContaining({ id: "call_1", raw }),
])
}),
)
it.effect("rejects a named field that is not a required string", () =>
Effect.sync(() => {
expect(() =>
tool({
name: "run",
description: "Run code",
input: Schema.toJsonSchemaDocument(Schema.Struct({ code: Schema.String, lang: Schema.String })).schema,
freeform: { type: "text", field: "script" },
}),
).toThrow("A freeform tool's `script` parameter must be a required string")
}),
)
})

View file

@ -1,7 +1,7 @@
import { describe, expect } from "bun:test"
import { Effect } from "effect"
import { ai, LLMEvent, Message } from "../../src/effect.js"
import { Meta, OpenAI } from "../../src/providers.js"
import { OpenAI } from "../../src/providers.js"
import { configure } from "../../src/providers/openai-compatible-responses.js"
import { compileRequest, LLMClient } from "../../src/route/client.js"
import { it } from "../lib/effect.js"
@ -118,79 +118,3 @@ for (const model of [
)
})
}
describe("Responses replay of commentary after a tool call in the same turn", () => {
const compatible = configure({ apiKey: "test-key", baseURL: "https://responses.example.test/v1" })
const call = (key: string, id: string, input: Record<string, unknown>) => ({
type: "tool-call" as const,
id,
name: "execute",
input,
providerMetadata: { [key]: { itemId: `fc_${id}` } },
})
const commentary = (key: string, id: string, text: string) => ({
type: "text" as const,
text,
providerMetadata: { [key]: { itemId: id, phase: "commentary" } },
})
for (const [model, keepsPhase] of [
[Meta.configure({ apiKey: "test-key" }).responses("muse-ember-1.0"), false],
[OpenAI.configure({ apiKey: "test-key" }).responses("muse-ember-1.0"), false],
[compatible.model("meta/muse-spark-1.3"), false],
[OpenAI.configure({ apiKey: "test-key" }).responses("gpt-6.1"), true],
[compatible.model("example-model"), true],
] as const) {
it.effect(`${keepsPhase ? "keeps" : "drops"} the phase for ${model.route.protocol} ${model.id}`, () =>
Effect.gen(function* () {
const key = model.route.providerMetadataKey ?? "openresponses"
const prepared = yield* compileRequest(
ai.request({
model,
messages: [
Message.user("Check the fillet"),
Message.make({
role: "assistant",
content: [
commentary(key, "msg_before", "Reading the schematic."),
call(key, "call_a", {}),
commentary(key, "msg_after", "Checking the fillet."),
call(key, "call_b", { code: "1" }),
],
}),
Message.make({
role: "tool",
content: [
{ type: "tool-result", id: "call_a", name: "execute", result: { type: "error", value: "Bad input" } },
{ type: "tool-result", id: "call_b", name: "execute", result: { type: "text", value: "1" } },
],
}),
],
}),
)
expect(prepared.body.input.slice(1)).toEqual([
{
type: "message",
role: "assistant",
id: "msg_before",
phase: "commentary",
status: "completed",
content: [{ type: "output_text", text: "Reading the schematic." }],
},
{ type: "function_call", id: "fc_call_a", call_id: "call_a", name: "execute", arguments: "{}" },
{
type: "message",
role: "assistant",
id: "msg_after",
...(keepsPhase ? { phase: "commentary" } : {}),
status: "completed",
content: [{ type: "output_text", text: "Checking the fillet." }],
},
{ type: "function_call", id: "fc_call_b", call_id: "call_b", name: "execute", arguments: '{"code":"1"}' },
{ type: "function_call_output", call_id: "call_a", output: "Bad input" },
{ type: "function_call_output", call_id: "call_b", output: "1" },
])
}),
)
}
})

View file

@ -647,16 +647,6 @@ describe("OpenAI-compatible Chat route", () => {
}),
)
it.effect("maps Z.AI's model_context_window_exceeded finish to a length finish", () =>
Effect.gen(function* () {
const response = yield* LLMClient.generate(request).pipe(
Effect.provide(fixedResponse(sseEvents(deltaChunk({}, "model_context_window_exceeded")))),
)
expect(response.finishReason).toEqual({ normalized: "length", raw: "model_context_window_exceeded" })
}),
)
it.effect("preserves content-filter finishes in the common reason algebra", () =>
Effect.gen(function* () {
const filtered = yield* LLMClient.generate(request).pipe(
@ -667,16 +657,6 @@ describe("OpenAI-compatible Chat route", () => {
}),
)
it.effect("maps Z.AI's sensitive finish to a content-filter finish", () =>
Effect.gen(function* () {
const filtered = yield* LLMClient.generate(request).pipe(
Effect.provide(fixedResponse(sseEvents(deltaChunk({}, "sensitive")))),
)
expect(filtered.finishReason).toEqual({ normalized: "content-filter", raw: "sensitive" })
}),
)
it.effect("names the content filter that blocked a response", () =>
Effect.gen(function* () {
const finish = (choice: object) =>

View file

@ -1,6 +1,6 @@
import { expect } from "bun:test"
import { Effect, Schema } from "effect"
import { ai, LanguageModel, LLMEvent, toDefinitions } from "../../src/effect.js"
import { ai, LLMEvent, toDefinitions } from "../../src/effect.js"
import { DigitalOcean, OpenRouter, Venice } from "../../src/providers.js"
import { LLMClient } from "../../src/route.js"
import { tool } from "../../src/tool.js"
@ -76,7 +76,7 @@ for (const item of [
Effect.gen(function* () {
const response = yield* LLMClient.generate(
ai.request({
model: LanguageModel.update(item.model, { capabilities: { tools: { freeform: ["text"] } } }),
model: item.model,
prompt: "Use the run tool to execute exactly this code: print(1)",
tools: run,
toolChoice: "required",

View file

@ -2,7 +2,6 @@ import { describe, expect, test } from "bun:test"
import { Effect, Schema, Stream } from "effect"
import {
ai,
LanguageModel,
LLMEvent,
Message,
tool,
@ -787,10 +786,9 @@ describe("OpenAI Responses tool updates", () => {
inputSchema: { type: "object", properties: { code: { type: "string" } }, required: ["code"] },
freeform: { type: "text" },
})
const model = LanguageModel.update(astra, { capabilities: { tools: { updates: ALL, freeform: ["text"] } } })
const prepared = yield* compileRequest(
ai.request({
model,
model: astra,
tools: [read],
messages: [
Message.user("Run it."),
@ -800,13 +798,7 @@ describe("OpenAI Responses tool updates", () => {
],
}),
)
const plain = yield* compileRequest(
ai.request({
model: LanguageModel.update(openai("gpt-6-astra"), { capabilities: { tools: { freeform: ["text"] } } }),
tools: [read, run],
prompt: "x",
}),
)
const plain = yield* compileRequest(ai.request({ model: openai("gpt-6-astra"), tools: [read, run], prompt: "x" }))
expect(prepared.body.input[3]).toEqual({
type: "additional_tools",
@ -818,22 +810,6 @@ describe("OpenAI Responses tool updates", () => {
}),
)
it.effect("folds tool changes alongside automatic context_management compaction", () =>
Effect.gen(function* () {
const prepared = yield* compileRequest(
ai.request({
model: astra,
tools: [read, edit],
messages: conversation,
providerOptions: { contextManagement: [{ type: "compaction", compactThreshold: 9000 }] },
}),
)
expect(additional(prepared.body)).toEqual([])
expect(topLevel(prepared.body)).toEqual(["read", "write"])
}),
)
it.effect("keeps top-level tools and folds markers without updates", () =>
Effect.gen(function* () {
const prepared = yield* compileRequest(

View file

@ -79,11 +79,10 @@ Users choose three fonts in Settings > Appearance. Every surface uses one of the
| Code font | Shell commands, code, paths shown as code, diffs, logs, tool input | `var(--font-family-mono)`, `var(--v2-font-family-code)`, `font-mono`, or a `<code>` / `<pre>` element |
| Terminal font | Terminal output only | `appearance.font("mono")` from the GUI plugin SDK |
- Never write a literal family (`Inter`, `"OpenMono"`, `monospace`, `Menlo`, `system-ui`) in production CSS, classes, inline styles, canvas `font` strings or widget options. A literal ignores the user's setting.
- Never add an `@font-face`, font file, or font package outside `packages/app/src/index.css`. That file is the only place the app ships faces: Inter (variable), and OpenMono Regular (weights below 600), Bold (600 and up) and Italic for both code and the terminal. If a design needs a face that is not shipped, add it there and say why in the PR.
- The OpenMono files in `src/assets/fonts` are made from the app build of OpenMono Nerd: no ligatures and every character one cell wide. Each style has a `-latin` file, which loads with the app, and a `-cyrillic` and a `-rest` file, which `unicode-range` loads when a character of theirs is drawn. The nine text files and their `unicode-range` values are the same as the websites' (`services/site/script/openmono.py`); change both scripts together. All styles share `OpenMono-icons.woff2` (the Nerd Fonts icons), whose rules come last in `src/index.css`. They are in `src`, not `public`, so that each URL has a content hash: the web server caches font files for a year. Do not replace them with the files from the OpenMono release, which have ligatures. Rebuild them with `uvx --from 'fonttools[woff]==4.60.1' python script/openmono.py <app-nerd build folder>` from `packages/app`. It writes nothing unless the build is complete, its icons are the same in every style, every character is in the `unicode-range` of its own rule in `src/index.css`, and its copyright lines are in the third-party notices.
- Never write a literal family (`Inter`, `"IBM Plex Mono"`, `monospace`, `Menlo`, `system-ui`) in production CSS, classes, inline styles, canvas `font` strings or widget options. A literal ignores the user's setting.
- Never add an `@font-face`, font file, or font package outside `packages/app/src/index.css`. That file is the only place the app ships faces: Inter (variable), IBM Plex Mono Text (weights below 600), Bold (600 and up) and Text Italic, and JetBrainsMono Nerd Font Mono Regular and Bold. If a design needs a face that is not shipped, add it there and say why in the PR.
- Show shell commands with the timeline shell metrics: code font, `13px`, weight `440`, `-0.04px` letter spacing. Do not invent another size for the same content.
- Prefer weight tokens (`font-medium`, `var(--font-weight-medium)`) over literal weights. Mono at `600` or more renders OpenMono Bold, so reserve it for real emphasis.
- Prefer weight tokens (`font-medium`, `var(--font-weight-medium)`) over literal weights. Mono at `600` or more renders IBM Plex Mono Bold, so reserve it for real emphasis.
- Do not read font settings directly. `src/settings/model.tsx` writes them to the CSS variables above, and the plugin host passes the terminal font through `appearance.font`.
## Loading Indicators
@ -117,78 +116,6 @@ This section is the single source for scroll containers across `app`, `ui`, `ses
- `ScrollView` (`@opencode/ui/scroll-view`) is only for the session timeline and Home, which draw the thumb in an external track (`thumbContainer`) and, in the timeline, correct it for virtualized rows. Use it again only for one of those needs, and not for menus.
- Never set `scrollbar-width: thin`, `scrollbar-width: auto` or `scrollbar-color`. Chromium then ignores the shared style and draws the native Windows scrollbar. Hide a scrollbar only with `no-scrollbar` or `scrollbar-width: none`.
## Timeline stability
This section is the single source for what may move or restyle the session timeline. It applies to every component and stylesheet that renders in or around the timeline, across `app`, `ui`, `session-ui` and `gui-plugins`. Each rule comes from a regression that shipped.
### Transcript size
- A session keeps every history page the reader loads, so a pass over the whole transcript costs more with each page. A history page that lands shifts every index of the message list, and each memo that reads the list runs again and reads every message through the store.
- Read a message's parts through a memo for that message (`mapArray` over the messages with a `createMemo` inside, as `messageParts` in `packages/session-ui/src/timeline/projection.ts` and `createSessionBackground` do), and fold over the memos. A page that lands, or a tool that updates, then reads that page or that message.
- Do not read the transcript for something that cannot show: the todo pill reads it only while a turn runs and todos are on.
- Still whole-transcript: `Timeline.constructSessionMessageRows` and its indexes. It was 24 of 68 ms of script when a page landed with 30 pages loaded.
### Scroll position
- The timeline moves when the reader scrolls it or asks to go somewhere (a jump, a search hit, a link). Nothing else scrolls it: not focus, not an update, not a row that mounts.
- `element.focus()` scrolls its element into view. When code moves focus inside a scroll container, pass `{ preventScroll: true }` unless the reader must see that control next: keyboard navigation to it, or the item that takes the place of a removed one.
- A virtualized row unmounts when it scrolls out of range, and a control that holds focus goes with it. Chromium then leaves focus on `<body>`, and the focus rescue (`packages/ui/src/context/focus-rescue.tsx`) handles the row as a deleted item: it focuses a control in another row, and the browser scrolls the timeline there. After a click on one tool header, the timeline jumped 13 times in 8 wheel bursts.
- A virtualized list therefore gives focus to its own viewport, without scrolling, before a row that holds focus unmounts. `VirtualRow`'s `onCleanup` in `src/session/timeline/virtualizer.tsx` does this. Keep it when you change how rows mount, and do the same in a new virtualized list.
- Keeper: "a focused control that scrolls out of the mounted rows leaves the timeline where it was scrolled" in `e2e/regression/session-timeline-accessibility.spec.ts`.
- To check by hand: click a tool header, a link and a notice in the timeline, then scroll up and down with the wheel. The timeline must follow the wheel.
### Scroll writes
- A native scroll write (`scrollTo`, `scrollTop =`) forces a layout when anything is dirty. TanStack corrects the scroll position once for each row it resizes above the view, so a batch of measured rows forced one layout for each row.
- `scrollToFn` in `src/session/timeline/virtualizer.tsx` holds the corrections made while a batch of sizes is applied and writes the last one once. Keep scroll writes for size changes on that path, and call `flushHeldScroll` before code inside the batch reads the native offset.
- Keeper: "corrects the scroll position once for each batch of rows an older page measures" in `e2e/regression/timeline-history.spec.ts`.
### Scroll events
- A scroll event must read before it writes. A style write followed by a read of `scrollTop`, `scrollHeight` or a rect, in the same event, makes the browser recalculate style (and lay out, when the write changed a size) inside the event.
- `ScrollView` (`packages/ui/src/components/scroll-view.tsx`) therefore reads the thumb's geometry first (`readThumb`), forwards the event to the timeline, and writes the thumb in the next animation frame (`applyThumb`). Keep that order when you add work to a scroll handler.
- Keeper: "handles a scroll event without a forced style or layout pass" in `e2e/regression/timeline-geometry.spec.ts`, for both timelines. It counts the passes in a Chrome trace; the old order forced one in every scroll event.
### Rows that load above the reader
- Older history loads above rows the reader is looking at. The virtualizer keeps the first row in view where it was, so the rows stay still only if no mounted row changes when the row before it arrives.
- Never give a row space, a divider or a label above its content that depends on the row before it. That row grows on top when its predecessor loads, and everything in view moves down: 16 to 32px on every page of the New timeline while its rows took their gap on top.
- The row directly above holds the space between two rows, below its own content. A row that starts a turn gets a row of its own for it, the turn gap, which arrives and leaves with the turn. `timelineGaps` in `packages/session-ui/src/timeline-next/spacing.ts` decides this for the New timeline.
- Keeper: "keeps the New timeline's rows fixed while older pages land in a turn and above a prompt" in `e2e/regression/timeline-history.spec.ts`.
- To check by hand: scroll to the top of the loaded history with the network throttled, and watch the first rows while the older page lands.
### Stuck headers
- An open group's header sticks under the session title. Collapsing the group from there scrolls the timeline first, by how far the header is stuck, so the header stays under the pointer.
- Measure that distance from where the header rests, not from the group's top. A header with a margin rests that margin away from the top: the New timeline's rests 6px above it, and the header moved up 6px on every collapse.
- Keeper: "collapsing a group from its stuck header leaves the header where it was" in `e2e/regression/patch-sticky-header.spec.ts`.
### Transcript reads
- The reader keeps their place only while the rows in view stay in the transcript. `session.message.sync` (`packages/client/src/solid/data.ts`) reads the newest page again on every reconnect of the event stream, and when a turn ends with a tool still running. It once replaced the transcript with that page: a reader further back than the page jumped 3,400 to 8,100 px, and the older pages were gone.
- A new read of the newest page keeps the loaded messages before it and their cursor. When the page does not reach the loaded messages, it reads older pages until they meet; after a long absence it gives up and keeps the newest messages only.
- Never join a page to messages it does not adjoin. A transcript that skips messages is worse than a lost place, and nothing shows the reader that messages are missing. `loadMore` drops an older page when a newer read replaced the transcript the page continued.
- A message counts as loaded history only where the server put it. The row of a waiting input sits where the input was admitted until its delivery moves it, so it cannot tell where a page meets the history.
- Keepers: "reading the newest page again keeps the loaded history" and the cases after it in `packages/client/test/solid-data.test.ts`, and "a reconnect of the event stream keeps a reader in older history where they were" in `e2e/regression/timeline-history.spec.ts`.
- To check by hand: scroll several screens back in a long session, then run `window.dispatchEvent(new Event("online"))` in DevTools. The app drops the event stream and reads the transcript again. The rows in view must not move.
### `:has()` selectors
- Chromium rechecks an element's `:has()` when focus moves, an attribute changes, or an element is added or removed near it. In and around the timeline, that happens many times a second during a scroll.
- When the selector ends at the `:has()` element (`x:has(…)`, `x:has(…)::after`), a recheck restyles that element only.
- When the selector continues (`x:has(…) y`, `x:has(…) ~ y`), a recheck restyles nearly every element inside `x`. Other rules decide how many: once any rule in the app ends in `[data-slot=…]` after a `:has()`, a recheck restyles every element inside `x` that has a `data-slot` attribute, whatever its value. Such rules exist, and almost every element has a `data-slot`.
- On an element that contains the timeline, a list, a panel or a page, end the selector at the `:has()` element. To style another element, set a `data-` attribute on that element from code.
- On a small component (a row, a tab, a card, a menu), the selector may continue after `:has()`. A recheck costs the size of that component.
- Never select on `style` inside `:has()`. Every inline style write then rechecks the `:has()` of the element's ancestors, and the virtualizer writes inline styles while the reader scrolls. Set a `data-` attribute when the element is built, and select on that.
- To check: record a Chrome trace of the `devtools.timeline` category while you scroll through history that has not been visited, click in the timeline and press a scroll key. Read `elementCount` on each `UpdateLayoutTree` event; DevTools shows it as Recalculate Style, Elements Affected. A pass that affects about as many elements as the timeline contains is this regression.
### Work on every transcript change
- The transcript changes with each message, tool update and history page. A memo that reads it and returns a new array or object (`visibleUserMessages()`, the revert view, the list of running tasks) notifies its readers every time, whether or not their result changes.
- Code outside the timeline that needs one fact about the transcript reads it through a memo of that fact, such as a boolean or an id. The session command list (`src/session/commands/use-session-commands.tsx`) does this. When it read the transcript directly, every history page rebuilt all commands, registered every keybind again and rebuilt the review toggle in the session header, whose fit forces a layout.
- A control that shows a keybind reads `command.keybind()` or `command.keybindParts()`, which change only when a keybind does. Do not read `command.options` for a label.
- Keeper: "the header keeps its controls while the transcript changes" in `e2e/regression/session-header.spec.ts`.
## Localization
- NEVER hardcode user-visible English strings in production code. ALWAYS use an i18n key for visible copy, placeholders, accessible labels, tooltips, menus, dialogs, toasts, empty states, and displayed errors.

View file

@ -1,7 +1,7 @@
import type { Locator, Page } from "@playwright/test"
import { expect, sourceURL, story } from "../../stories/playwright/story"
import type { ParentProps } from "solid-js"
import type { Command } from "@opencode/plugin/gui"
import type { Accessor, ParentProps } from "solid-js"
import type { Command, MenuItem } from "@opencode/plugin/gui"
import type { Item } from "../src/runtime/plugin/host"
const source = (path: string) => sourceURL(new URL(path, import.meta.url))
@ -114,6 +114,7 @@ story.beforeEach(async ({ mount, page }) => {
closeNewTab: () => boolean
}
| undefined
shortcut: (shortcut: Accessor<string>) => void
}) => {
const command = commands.useCommand()
// As in the app, the session screen's focus listener starts after the shell's key listener.
@ -121,6 +122,17 @@ story.beforeEach(async ({ mount, page }) => {
const owner = solid.getOwner()
queueMicrotask(() => (inSide = solid.runWithOwner(owner, closed.createSideFocus)!))
const pluginHost = host.usePluginHost()
// What the side strip's + shows beside the browser item, through the host's own formatter.
props.shortcut(() => {
const item = pluginHost
.items(sdk.MenuItem)
.find(
(entry: { plugin: string; value: MenuItem }) =>
entry.plugin === "browser" && entry.value.menu === "session.panel",
)?.value
return item?.menu === "session.panel" && item.keybind ? command.keybind(item.keybind) : ""
})
// As the session's commands: ⌘T and ⌘W inside the side region, unless the focused panel binds the key there.
const sideKey = (event: KeyboardEvent) =>
@ -205,20 +217,6 @@ story.beforeEach(async ({ mount, page }) => {
return null
},
Contribution: renderer.Contribution,
NewTabSlot: (props: { session: unknown; screen: unknown }) =>
renderer.PluginSlot({
at: "session.panel.new",
input: {
get session() {
return props.session
},
get screen() {
return props.screen
},
target() {},
autofocus: () => () => {},
},
}),
appendTab: sessionTabs.appendSessionTab,
pruneKeys: layoutKeys.pruneSessionKeys,
})
@ -255,7 +253,7 @@ story("closes a blank browser tab from its address field without closing the ses
await outside.click()
await expect(root.getByTestId("session-state")).toHaveText("open")
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
await address.fill("example.com")
await expect(address).toBeFocused()
await address.press("ControlOrMeta+w")
@ -274,7 +272,7 @@ story("toggles the element picker from the shortcut only inside the browser pane
await root.getByRole("button", { name: "Blank page", exact: true }).click()
// While the comment tool waits for a pick, the pane says so in a status line.
const picking = root.getByText("Click part of the page to comment on it. Press Escape to cancel.", { exact: true })
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
await address.click()
await address.press("ControlOrMeta+Shift+c")
await expect(root.getByTestId("browser-inspects")).toHaveText("[]")
@ -368,7 +366,7 @@ story(
const root = page.getByTestId("browser-region-fixture")
const mac = await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))
const toggle = mac ? "Meta+Shift+r" : "Control+Shift+r"
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const composer = root.getByRole("textbox", { name: "Composer", exact: true })
const side = root.getByTestId("side-state")
@ -390,32 +388,34 @@ story(
},
)
story("⌘T inside the browser pane opens the side panel's New tab, and a session everywhere else", async ({ page }) => {
story("opens a browser tab with ⌘T inside the pane and a session everywhere else", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mac = await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))
const mod = mac ? "Meta" : "Control"
const outside = root.getByRole("button", { name: "Beta", exact: true })
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const editor = page.frameLocator('iframe[title="Browser page"]').getByRole("textbox", { name: "Editor page input" })
const opens = root.getByTestId("browser-opens")
const sessions = root.getByTestId("new-sessions")
const newTabs = root.getByTestId("side-new-tabs")
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
// The + advertises the browser launcher's own shortcut, whichever tab shows; ⌘T stays the pane's.
await expect(root.getByTestId("add-shortcut")).toHaveText(mac ? "⌃⌘B" : "Ctrl+Alt+B")
await outside.click()
await expect(root.getByText("Registrations: 2", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "First inventory", exact: true }).click()
await expect(root.getByRole("tab", { name: "Preview", exact: true })).toHaveAttribute("aria-selected", "true")
await expect(root.getByTestId("add-shortcut")).toHaveText(mac ? "⌃⌘B" : "Ctrl+Alt+B")
// Outside the pane the shell keeps ⌘T.
await outside.focus()
await outside.press(`${mod}+t`)
await expect(sessions).toHaveText("1")
await expect(newTabs).toHaveText("0")
await expect(opens).toHaveText("0")
// Inside the pane, as anywhere in the side panel, it opens a New tab rather than a blank browser tab.
// Inside the pane it opens a browser tab instead.
await address.focus()
await address.press(`${mod}+t`)
await expect(newTabs).toHaveText("1")
await expect(opens).toHaveText("1")
// Dvorak's T sits on the physical K key: the shortcut follows the character, not the key position.
await address.evaluate((element, meta) => {
@ -430,47 +430,18 @@ story("⌘T inside the browser pane opens the side panel's New tab, and a sessio
}),
)
}, mac)
await expect(newTabs).toHaveText("2")
await expect(opens).toHaveText("2")
// A focused page hands the reserved chord to the pane before it sees it.
await editor.focus()
await editor.press(`${mod}+t`)
await expect(newTabs).toHaveText("3")
await expect(opens).toHaveText("3")
await expect(sessions).toHaveText("1")
await expect(opens).toHaveText("0")
// The browser's own chord, which opens a blank browser tab, reaches the app from the page too.
// The Browser launcher's own chord reaches the app from the page too.
await editor.focus()
await editor.press(mac ? "Control+Meta+b" : "Control+Alt+b")
await expect(opens).toHaveText("1")
})
story("the side panel's New tab opens what its address field names in a browser tab", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mod = (await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))) ? "Meta" : "Control"
const panel = page.locator("#review-panel")
const field = root.getByTestId("side-new-tab-view").getByRole("combobox", { name: "Browser address", exact: true })
const opens = root.getByTestId("browser-opens")
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Beta", exact: true }).click()
await root.getByRole("button", { name: "First inventory", exact: true }).click()
await expect(root.getByTestId("selected")).toHaveText(/^browser:/)
await expect(field).toHaveCount(0)
await panel.getByTestId("selected").click()
await page.keyboard.press(`${mod}+t`)
await expect(root.getByTestId("side-new-tab")).toHaveText("shown")
// An address opens as typed; main adds the scheme. Other text searches the web.
await field.fill("example.com")
await field.press("Enter")
await expect(opens).toHaveText("1")
await expect(root.getByRole("status").getByText("example.com", { exact: true })).toBeVisible()
await field.fill("solid signals")
await field.press("Enter")
await expect(opens).toHaveText("2")
await expect(root.getByRole("status").getByText("https://www.google.com/search?q=solid%20signals", { exact: true })).toBeVisible()
await expect(opens).toHaveText("4")
})
story("⌘T and ⌘W follow focus: side tabs inside the side panel, session tabs elsewhere", async ({ page }) => {
@ -497,16 +468,13 @@ story("⌘T and ⌘W follow focus: side tabs inside the side panel, session tabs
await editor.click()
await expect(panel).toHaveAttribute("data-focused")
await editor.press(`${mod}+t`)
await expect(newTab).toHaveText("shown")
await expect(opens).toHaveText("0")
await expect(opens).toHaveText("1")
await expect(sessions).toHaveText("1")
// A click on the side panel's own surface, nothing focusable, leaves focus on the panel: ⌘W closes the new tab view
// and ⌘T opens another, then ⌘W closes that view, then the selected tab.
// A click on the side panel's own surface, nothing focusable, leaves focus on the panel: ⌘T opens its new tab view
// and ⌘W closes that view, then the selected tab.
await panel.getByTestId("selected").click()
await expect(panel).toHaveAttribute("data-focused")
await page.keyboard.press(`${mod}+w`)
await expect(newTab).toHaveText("none")
await page.keyboard.press(`${mod}+t`)
await expect(newTab).toHaveText("shown")
await page.keyboard.press(`${mod}+w`)
@ -522,7 +490,7 @@ story("⌘L selects the browser address from the page and the pane, and nowhere
const root = page.getByTestId("browser-region-fixture")
const mod = (await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))) ? "Meta" : "Control"
const outside = root.getByRole("button", { name: "Beta", exact: true })
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const editor = page.frameLocator('iframe[title="Browser page"]').getByRole("textbox", { name: "Editor page input" })
const selected = () =>
@ -557,11 +525,28 @@ story("⌘L selects the browser address from the page and the pane, and nowhere
await expect.poll(selected).toBe(true)
})
story("keeps ⌘T in the browser pane after a click on its loading surface", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mod = (await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))) ? "Meta" : "Control"
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Beta", exact: true }).click()
await root.getByRole("button", { name: "First inventory", exact: true }).click()
await expect(root.getByTestId("selected")).toHaveText(/^browser:/)
// A page still loading shows the pane's own surface where the native page goes; clicking it must not drop focus
// to the side panel around the pane, where ⌘T would open the region's new tab view instead of a browser tab.
await page.locator('#browser-panel [data-component="browser-bar"]').click({ position: { x: 2, y: 2 } })
await page.keyboard.press(`${mod}+t`)
await expect(root.getByTestId("browser-opens")).toHaveText("1")
await expect(root.getByTestId("side-new-tab")).toHaveText("none")
await expect(root.getByTestId("new-sessions")).toHaveText("0")
})
story("reloads the browser tab with ⌘R inside the pane and leaves it to the window elsewhere", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mac = await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))
const outside = root.getByRole("button", { name: "Beta", exact: true })
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const reloads = root.getByTestId("browser-reloads")
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
await outside.click()
@ -596,31 +581,30 @@ story("reloads the browser tab with ⌘R inside the pane and leaves it to the wi
story("keeps blank browser tabs when adding tabs and selecting another panel", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mac = await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Beta", exact: true }).click()
await expect(root.getByText("Registrations: 2", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Blank page", exact: true }).click()
const tabs = root.getByRole("tab", { name: "New tab", exact: true })
await expect(tabs).toHaveAttribute("aria-selected", "true")
await expect(root.getByRole("tab", { name: "New tab", exact: true })).toHaveAttribute("aria-selected", "true")
// The side panel's New tab opens over the blank browser tab and leaves it in the strip.
await address.press(`${mac ? "Meta" : "Control"}+t`)
await expect(root.getByTestId("side-new-tabs")).toHaveText("1")
await expect(tabs).toHaveCount(1)
const tabs = root.getByRole("tab", { name: "New tab", exact: true })
await expect(tabs).toHaveCount(2)
await expect(tabs.nth(1)).toHaveAttribute("aria-selected", "true")
await expect(root.getByTestId("browser-closes")).toHaveText("[]")
// Selecting a different panel must not treat blank browser tabs as disposable placeholders.
await address.press(`${mac ? "Meta" : "Control"}+1`)
await expect(root.getByRole("tab", { name: "beta.ts", exact: true })).toHaveAttribute("aria-selected", "true")
await expect(tabs).toHaveCount(1)
await expect(tabs).toHaveCount(2)
await expect(root.getByTestId("browser-closes")).toHaveText("[]")
})
story("a new tab request that opened no blank tab leaves a later blank page's address alone", async ({ page }) => {
const root = page.getByTestId("browser-region-fixture")
const mac = await page.evaluate(() => /Mac|iPhone|iPad|iPod/.test(navigator.platform))
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const composer = root.getByRole("textbox", { name: "Composer", exact: true })
await expect(root.getByText("Registrations: 1", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Beta", exact: true }).click()
@ -628,7 +612,7 @@ story("a new tab request that opened no blank tab leaves a later blank page's ad
await expect(root.getByRole("tab", { name: "Preview", exact: true })).toHaveAttribute("aria-selected", "true")
// Main answers this request without a new blank tab.
await address.press(mac ? "Control+Meta+b" : "Control+Alt+b")
await address.press(`${mac ? "Meta" : "Control"}+t`)
await expect(root.getByTestId("browser-opens")).toHaveText("1")
// The page the agent blanks later must not take focus from the composer; a dispatched click leaves focus in place.
@ -835,7 +819,7 @@ const reopen = async (page: Page, quit: () => Promise<void> = async () => {}) =>
story("holds every restored tab's box, label and icon from the reopen until its page has loaded", async ({ page }) => {
// The pane's Ipc is still starting when the window draws its first frame.
const { root, first, stable } = await reopen(page, () => page.getByTestId("browser-region-fixture").getByRole("button", { name: "Pane away", exact: true }).click())
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
await expect(root.getByText("Registrations: 2", { exact: true })).toBeVisible()
await root.getByRole("button", { name: "Pane back", exact: true }).click()
@ -1017,7 +1001,7 @@ story("a tab a link opens behind appears at once beside the tab it came from, an
story("a tab a link opens in front appears at once, selected, beside the tab it came from, and its page's title is its only other change", async ({ page }) => {
const { root, tabs, listed, selected } = await linkStrip(page)
const front = linkPage("tab_88888888-8888-8888-8888-888888888888", "front", "In front")
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
const before = await drawn(tabs)
// The person clicks a `target="_blank"` link in Docs: main lists the tab after Docs and brings it to the front, in
@ -1143,7 +1127,7 @@ story("a restored tab on a server without a browser says that the browser could
await expect(loading).toBeVisible()
await stable()
await send(root, inventory(restoredPreview, restoredDocs))
await expect(root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })).toHaveValue("http://localhost:4173/")
await expect(root.getByRole("combobox", { name: "Browser address", exact: true })).toHaveValue("http://localhost:4173/")
await stable()
})
@ -1185,7 +1169,7 @@ story("?W right after an agent shows another page closes that browser tab, not t
const root = page.getByTestId("browser-region-fixture")
await root.getByRole("button", { name: "Beta", exact: true }).click()
await root.getByRole("button", { name: "First inventory", exact: true }).click()
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
await address.click()
// The request arrives with no input from the person: the keyboard stays in the pane, where ?W is the pane's.
await root.getByRole("button", { name: "Agent shows another page", exact: true }).dispatchEvent("click")
@ -1257,7 +1241,7 @@ story(
await expect(reviews).toHaveText("0")
// F6, Shift+F6 and the address shortcut leave the prompt open for the address field, as in Chrome; Tab comes back.
const address = root.locator("#browser-panel").getByRole("combobox", { name: "Browser address", exact: true })
const address = root.getByRole("combobox", { name: "Browser address", exact: true })
for (const chord of ["F6", "Shift+F6", "ControlOrMeta+l"]) {
await field.focus()

View file

@ -91,7 +91,7 @@ story("no setting decides what an import brings: the import section has its brow
const section = view.root.getByRole("region", { name: "Import from another browser", exact: true })
// The section is its title and one row per browser, whose button opens the import dialog with its two boxes.
await expect(section.getByRole("button", { name: "Import", exact: true })).toHaveCount(2)
await expect(section.getByRole("button", { name: "Import…", exact: true })).toHaveCount(2)
await expect(section.locator("p")).toHaveCount(0)
await expect(view.advanced).toHaveAttribute("aria-expanded", "true")
// Advanced holds two switches, neither of them about importing.
@ -227,19 +227,26 @@ story("Add an extension aligns controls without top clipping and switches cleanl
const closeSvg = node.querySelector('[data-slot="dialog-close-button"] svg')?.getBoundingClientRect()
const input = node.querySelector('[data-component="text-input-v2"]')?.getBoundingClientRect()
const topAdd = node.querySelector('[data-component="text-input-v2"]')?.parentElement?.querySelector("button")?.getBoundingClientRect()
const done = node.querySelector('[data-slot="dialog-footer"] button:last-child')?.getBoundingClientRect()
const browserHeading = Array.from(node.querySelectorAll("span")).find((el) => el.textContent === "From your browsers")?.getBoundingClientRect()
const selectChevron = node.querySelector('[data-slot="select-v2-chevron"]')?.getBoundingClientRect()
const devSummary = node.querySelector("details > summary")?.getBoundingClientRect()
const done = node.querySelector('[data-slot="dialog-footer"] button')?.getBoundingClientRect()
const rowButtons = Array.from(node.querySelectorAll('[data-slot="menu-scroll-content"] button')).map((el) => el.getBoundingClientRect())
return {
topClearanceInput: body && input ? Math.round(input.top - body.top) : -1,
topClearanceButton: body && topAdd ? Math.round(topAdd.top - body.top) : -1,
leftDeltas:
title && input ? [input.left - title.left].map((value) => Math.round(value))
title && input && browserHeading && devSummary
? [input.left - title.left, browserHeading.left - title.left, devSummary.left - title.left].map((value) => Math.round(value))
: [],
rightDeltas:
done && closeSvg && topAdd
done && closeSvg && topAdd && selectChevron
? [
closeSvg.right - done.right,
topAdd.right - done.right,
selectChevron.right - done.right,
...rowButtons.map((box) => box.right - done.right),
].map((value) => Math.round(value))
: [],
}
@ -247,7 +254,7 @@ story("Add an extension aligns controls without top clipping and switches cleanl
expect(metrics.topClearanceInput).toBeGreaterThanOrEqual(4)
expect(metrics.topClearanceButton).toBeGreaterThanOrEqual(4)
expect(metrics.leftDeltas).toEqual([0])
expect(metrics.leftDeltas).toEqual([0, 0, 0])
expect(metrics.rightDeltas.every((delta) => delta === 0)).toBe(true)
// Clicking Add switches the whole dialog into a concise confirmation step without the browser list underneath.
@ -257,21 +264,21 @@ story("Add an extension aligns controls without top clipping and switches cleanl
await expect(confirm.getByText("It can:")).toBeVisible()
await expect(confirm.getByText("Read and change every page you visit")).toBeVisible()
await expect(confirm.getByText("See and change your sign-ins")).toBeVisible()
await expect(confirm.getByText("Partly supported")).toBeVisible()
await expect(confirm.getByText("From", { exact: true })).toHaveCount(0)
await expect(confirm.getByText("May not fully work here")).toBeVisible()
await expect(confirm.getByText("From your browsers")).toHaveCount(0)
await expect(confirm.getByText("Details")).toHaveCount(0)
await expect(confirm.getByText(/Copied from another browser/)).toHaveCount(0)
// Cancel returns smoothly to the picker list.
await confirm.getByRole("button", { name: "Cancel" }).click()
await expect(page.getByRole("dialog", { name: "Add an extension" })).toBeVisible()
await expect(dialog.getByText("From", { exact: true })).toBeVisible()
await expect(dialog.getByText("From your browsers")).toBeVisible()
// Unsupported extensions offer "Add anyway" in the confirmation footer.
await dialog.getByRole("button", { name: "Add anyway" }).click()
const unsupported = page.getByRole("dialog", { name: 'Add "OpenCode Browse"?' })
await expect(unsupported).toBeVisible()
await expect(unsupported.getByText("Not supported")).toBeVisible()
await expect(unsupported.getByText("Probably won't work here")).toBeVisible()
await expect(unsupported.getByRole("button", { name: "Add anyway" })).toBeVisible()
await unsupported.getByRole("button", { name: "Cancel" }).click()
@ -287,8 +294,8 @@ story("installed extension rows stack compatibility under the name and align con
const view = await open(page, { extensions: true, installed: true })
const section = view.root.locator('section.settings-section[aria-label="Extensions"]')
await expect(section.getByText("Partly supported")).toBeVisible()
await expect(section.getByText("Not supported")).toBeVisible()
await expect(section.getByText("May not fully work here")).toBeVisible()
await expect(section.getByText("Probably won't work here")).toBeVisible()
const metrics = await section.evaluate((node) => {
const rows = Array.from(node.querySelectorAll('[data-component="settings-row"]')).slice(0, 3)

View file

@ -1,4 +1,4 @@
import type { Locator, Page } from "@playwright/test"
import type { Page } from "@playwright/test"
import { expect, sourceURL, story } from "../../stories/playwright/story"
// What the fixture's faked browser profile answers; see `SiteScenario` in the fixture.
@ -25,8 +25,7 @@ const modules = {
}
// Any story loads the app styles; the fixture opens the real import dialog in the real dialog host beside it. Most
// cases here are about the site list, so the dialog opens on "Only sites I choose" unless the case says otherwise. The
// faked browser has two profiles, so the dialog offers a profile picker and its title names no browser.
// cases here are about the site list, so the dialog opens with it shown unless the case says otherwise.
async function open(page: Page, given: SiteScenario, direction: "ltr" | "rtl" = "ltr") {
const scenario = { reveal: true, ...given }
@ -39,7 +38,7 @@ async function open(page: Page, given: SiteScenario, direction: "ltr" | "rtl" =
{ modules, scenario, direction },
)
const dialog = page.getByRole("dialog", { name: "Import from another browser", exact: true })
const dialog = page.getByRole("dialog", { name: /^Import from Google Chrome/ })
return {
dialog,
@ -51,24 +50,12 @@ async function open(page: Page, given: SiteScenario, direction: "ltr" | "rtl" =
// What comes over: two real checkboxes, ticked until the person unticks one.
signins: dialog.getByRole("checkbox", { name: "Sign-ins", exact: true }),
history: dialog.getByRole("checkbox", { name: "Browsing history", exact: true }),
// Which sites: every one, or only the ticked ones, which start with none.
every: dialog.getByRole("radio", { name: /^All sites/ }),
only: dialog.getByRole("radio", { name: "Only sites I choose", exact: true }),
// One box ticks or unticks every site the search shows.
selectAll: dialog.getByRole("checkbox", { name: /^Select (all|[\d,]+ shown)$/ }),
profile: dialog.getByRole("button", { name: /Browser profile/ }),
selectNone: dialog.getByRole("button", { name: "Select none", exact: true }),
// The dialog is modal, so the record beside it is hidden from the accessibility tree.
record: page.getByTestId("site-chooser-imports"),
}
}
// A radio's or a box's input is visually hidden under the control drawn for it, which takes the pointer.
const press = (input: Locator) =>
input
.locator('xpath=ancestor::*[@data-slot="radio-v2-item" or @data-slot="checkbox-v2"][1]')
.locator('[data-slot$="-control"]')
.click()
story.beforeEach(async ({ mount }) => {
await mount("ui-line-comment--editor")
})
@ -79,36 +66,35 @@ story("lists 5,000 sites in a window of rows, as one keyboard stop with roving f
await expect(view.options.first()).toHaveAttribute("data-site", "github.com")
await expect(view.list).toHaveAttribute("aria-multiselectable", "true")
await expect(view.options.first()).toHaveAttribute("aria-setsize", "5000")
// Only the sites the person ticks come over, and none is ticked yet: there is nothing to import.
await expect(view.dialog.getByText("0 of 5,000 selected")).toBeVisible()
// Every site comes over until the person changes that.
await expect(view.dialog.getByText("5,000 of 5,000 selected")).toBeVisible()
expect(await view.options.count()).toBeLessThan(45)
await expect(view.importButton).toHaveText("Import")
await expect(view.importButton).toBeDisabled()
// Reading order: the profile, the two boxes and the choice of sites come before the search. Tab goes from the
// search, past the box that ticks every site, to the list, then out of it.
// The two boxes come before the search in reading order. Tab goes from the search, past the profile and the
// selection's one enabled action, to the list, then out of it.
await expect(view.search).toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(view.only).toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(view.history).toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(view.signins).toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(view.profile).toBeFocused()
await page.keyboard.press("Tab")
await page.keyboard.press("Tab")
await page.keyboard.press("Tab")
await page.keyboard.press("Tab")
await expect(view.search).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.selectAll).toBeFocused()
await expect(view.dialog.getByRole("button", { name: /Browser profile/ })).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.selectNone).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.list).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.dialog.getByRole("button", { name: "Cancel", exact: true })).toBeFocused()
await expect(view.dialog.getByRole("button", { name: "Choose sites" })).toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(view.list).toBeFocused()
await view.selectNone.click()
await expect(view.dialog.getByText("0 of 5,000 selected")).toBeVisible()
await expect(view.importButton).toBeDisabled()
await view.list.focus()
// Down moves, Space toggles, End goes to the last site, and type-ahead jumps to the next site that starts so.
await page.keyboard.press("ArrowDown")
@ -132,15 +118,15 @@ story("lists 5,000 sites in a window of rows, as one keyboard stop with roving f
await expect(view.record).toHaveAttribute("data-imported", "1")
})
story("the box that ticks every site acts on what a search shows, and says so", async ({ page }) => {
story("says what Select acts on while a search is active, and only offers what would change something", async ({ page }) => {
const view = await open(page, { sites: 5_000 })
await view.selectNone.click()
await view.search.fill("site-01")
await expect(view.dialog.getByText("100 shown, 0 selected")).toBeVisible()
await expect(view.selectAll).toHaveAccessibleName("Select 100 shown")
await press(view.selectAll)
await expect(view.selectAll).toBeChecked()
await expect(view.dialog.getByText("100 shown, 100 selected")).toBeVisible()
await view.dialog.getByRole("button", { name: "Select 100 shown", exact: true }).click()
await expect(view.dialog.getByRole("button", { name: "Deselect 100 shown", exact: true })).toBeEnabled()
await expect(view.dialog.getByRole("button", { name: "Select 100 shown", exact: true })).toBeDisabled()
await view.search.fill("github")
await expect(view.options).toHaveCount(1)
await view.options.click()
@ -179,17 +165,17 @@ story("leaves Escape and ArrowDown to an input method while it composes", async
await expect(view.record).toHaveAttribute("data-closed", "true")
})
story("switches profiles at the top with none of another profile's sites chosen, and reads a profile only once while open", async ({ page }) => {
story("switches profiles back to every site chosen, at the top, and reads a profile only once while open", async ({ page }) => {
const view = await open(page, { sites: 5_000 })
await view.options.first().click()
await view.list.focus()
await page.keyboard.press("End")
await view.profile.click()
await view.dialog.getByRole("button", { name: /Browser profile/ }).click()
await page.getByRole("option", { name: "Google Chrome · Home" }).click()
await expect(view.options).toHaveCount(4)
await expect(view.dialog.getByText("0 of 4 selected")).toBeVisible()
await view.profile.click()
await expect(view.dialog.getByText("4 of 4 selected")).toBeVisible()
await view.dialog.getByRole("button", { name: /Browser profile/ }).click()
await page.getByRole("option", { name: "Google Chrome · Work" }).click()
await expect(view.options.first()).toHaveAttribute("data-site", "github.com")
await expect(view.options.first()).toBeInViewport()
@ -203,10 +189,8 @@ story("starts from the site a passkey request came from, brings its sign-in alon
await expect(view.options).toHaveAttribute("data-site", "github.com")
// The site the page belongs to is chosen already.
await expect(view.options).toHaveAttribute("aria-selected", "true")
// This dialog is about one site's sign-in: it offers neither box nor a choice of sites, and asks main for no history.
await expect(view.signins).toHaveCount(0)
await expect(view.history).toHaveCount(0)
await expect(view.dialog.getByRole("radio")).toHaveCount(0)
// This dialog is about one site's sign-in: it offers no boxes, and asks main for no history.
await expect(view.dialog.getByRole("checkbox")).toHaveCount(0)
await view.importButton.click()
await expect(view.record.locator("li")).toHaveText([JSON.stringify({ source: "chrome", profile: "Default", sites: ["github.com"], cookies: true, history: false })])
const status = view.dialog.getByRole("status")
@ -230,8 +214,8 @@ story("starts from the site a passkey request came from, brings its sign-in alon
topClearanceSearch: body && search ? Math.round(search.top - body.top) : -1,
topClearanceSelect: body && select ? Math.round(select.top - body.top) : -1,
leftDeltas: title && search && msg ? [search.left - title.left, msg.left - title.left].map((v) => Math.round(v)) : [],
// The profile picker is as wide as its name, so only the close button ends on the buttons' edge.
rightDeltas: importBtn && closeSvg ? [Math.round(closeSvg.right - importBtn.right)] : [],
rightDeltas:
importBtn && closeSvg && select ? [closeSvg.right - importBtn.right, select.right - importBtn.right].map((v) => Math.round(v)) : [],
}
})
@ -239,13 +223,13 @@ story("starts from the site a passkey request came from, brings its sign-in alon
expect(layout.topClearanceSearch).toBeGreaterThanOrEqual(4)
expect(layout.topClearanceSelect).toBeGreaterThanOrEqual(4)
expect(layout.leftDeltas).toEqual([0, 0])
expect(layout.rightDeltas).toEqual([0])
expect(layout.rightDeltas).toEqual([0, 0])
})
story("opened for a site, moves on to the browser profile that has exactly it, and chooses only that one", async ({ page }) => {
const view = await open(page, { sites: 5, site: { name: "google.com", choose: true } })
await expect(view.profile).toContainText("Home")
await expect(view.dialog.getByRole("button", { name: /Browser profile/ })).toContainText("Home")
await expect(view.options).toHaveCount(2)
await expect(view.dialog.locator('[data-site="google.com"]')).toHaveAttribute("aria-selected", "true")
await expect(view.dialog.locator('[data-site="google.com.au"]')).toHaveAttribute("aria-selected", "false")
@ -302,7 +286,7 @@ story("keeps the active row off the list's edges, and brings it into view from t
// The count alone is a live region, so a selection is announced.
await page.keyboard.press("Space")
await expect(view.dialog.locator('[aria-live="polite"]')).toHaveText("1 of 5,000 selected")
await expect(view.dialog.locator('[aria-live="polite"]')).toHaveText("4,999 of 5,000 selected")
})
story("shows what the list is doing in its place, with a way to try again", async ({ page }) => {
@ -331,7 +315,7 @@ story("an empty profile says so", async ({ page }) => {
await expect(view.importButton).toBeDisabled()
})
// Where the two boxes of what comes over are in the dialog, in CSS pixels: each box's left edge and label against the title's left edge,
// Where the two boxes are in the dialog, in CSS pixels: each box's left edge and label against the title's left edge,
// each 28px row's top from the dialog's top, and how far the first box's focus ring (a 2px outline, 2px off the 16px
// box) stays inside what clips the body.
const boxes = (dialog: ReturnType<Page["getByRole"]>) =>
@ -347,7 +331,7 @@ const boxes = (dialog: ReturnType<Page["getByRole"]>) =>
const container = (node.closest('[data-slot="dialog-container"]') ?? node).getBoundingClientRect()
const title = text(node.querySelector('[data-slot="dialog-title"]'))
const clip = node.querySelector('[data-slot="dialog-body"] [data-scrollable]')?.getBoundingClientRect()
const kinds = Array.from(node.querySelectorAll('[data-slot="dialog-body"] section:first-of-type [data-slot="checkbox-v2"]'))
const kinds = Array.from(node.querySelectorAll('[data-slot="dialog-body"] [data-slot="checkbox-v2"]:not([aria-hidden])'))
const controls = kinds.map((kind) => kind.querySelector('[data-slot="checkbox-v2-control"]')?.getBoundingClientRect())
const first = controls[0]
const last = controls[controls.length - 1]
@ -361,15 +345,15 @@ const boxes = (dialog: ReturnType<Page["getByRole"]>) =>
}
})
story("opens on two ticked boxes, All sites and Import, which brings everything without the list", async ({ page }) => {
story("opens on two ticked boxes and Import, which brings everything without the list", async ({ page }) => {
const view = await open(page, { sites: 5, reveal: false, pages: 4210 })
// No sentence: the title, the two boxes, the choice of sites and the buttons say it.
// No sentence: the title, the two boxes and the buttons say it.
await expect(view.signins).toBeChecked()
await expect(view.history).toBeChecked()
await expect(view.every).toBeChecked()
await expect(view.dialog.locator('[data-slot="dialog-description"]')).toHaveCount(0)
await expect(view.list).toHaveCount(0)
await expect(view.dialog.getByRole("button", { name: "Choose sites" })).toHaveAttribute("aria-expanded", "false")
await expect(view.importButton).toHaveText("Import")
await page.evaluate(() => document.fonts.ready.then(() => undefined))
const collapsed = await boxes(view.dialog)
@ -378,14 +362,13 @@ story("opens on two ticked boxes, All sites and Import, which brings everything
expect(collapsed).toMatchObject({ left: [0, 0], label: [24, 24], height: [28, 28] })
expect(Math.min(...collapsed.ring)).toBeGreaterThanOrEqual(0)
// "Only sites I choose" opens the list under the choice; the dialog keeps its top edge, so the boxes stay where they
// are.
await press(view.only)
// "Choose sites" opens the list under the boxes, which stay where they are.
await view.dialog.getByRole("button", { name: "Choose sites" }).click()
await expect(view.options).toHaveCount(5)
const expanded = await boxes(view.dialog)
expect(expanded).toMatchObject({ left: [0, 0], label: [24, 24], height: [28, 28], top: collapsed.top })
expect(Math.min(...expanded.ring)).toBeGreaterThanOrEqual(0)
await press(view.every)
await view.dialog.getByRole("button", { name: "Choose sites" }).click()
await expect(view.list).toHaveCount(0)
await view.importButton.click()
@ -397,14 +380,12 @@ story("opens on two ticked boxes, All sites and Import, which brings everything
story("a box the person unticks stays behind, Import needs one of them, and Enter on a box imports", async ({ page }) => {
const view = await open(page, { sites: 5, reveal: false, pages: 4210 })
// The dialog opens with the focus on itself. Tab reaches the boxes in reading order, after Close and the profile;
// Space toggles the one that has the focus.
// The dialog opens with the focus on itself. Tab reaches the boxes in reading order, after Close; Space toggles the
// one that has the focus.
await expect(view.dialog.locator('[data-slot="dialog-content"]').or(view.dialog)).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.dialog.getByRole("button", { name: "Close", exact: true })).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.profile).toBeFocused()
await page.keyboard.press("Tab")
await expect(view.signins).toBeFocused()
await page.keyboard.press("Space")
await expect(view.signins).not.toBeChecked()
@ -432,9 +413,11 @@ story("with Browsing history unticked the import brings sign-ins alone, of the c
await view.dialog.getByText("Browsing history", { exact: true }).click()
await expect(view.history).not.toBeChecked()
await view.dialog.locator('[data-site="github.com"]').click()
await expect(view.importButton).toHaveText("Import 1 site")
await expect(view.importButton).toHaveText("Import 4 sites")
await view.importButton.click()
await expect(view.record.locator("li")).toHaveText([JSON.stringify({ source: "chrome", profile: "Default", sites: ["github.com"], cookies: true, history: false })])
const sent = JSON.parse((await view.record.locator("li").textContent()) ?? "{}")
expect(sent).toMatchObject({ cookies: true, history: false })
expect(sent.sites).toHaveLength(4)
})
story("empty fallback uses a compact fit dialog when no browsers are found", async ({ page }) => {
@ -453,33 +436,32 @@ story("empty fallback uses a compact fit dialog when no browsers are found", asy
expect(box && box.width <= 480 && box.height < 250).toBe(true)
})
story("Only sites I choose shows the list in place with none ticked, and the button then names how many it brings", async ({ page }) => {
story("Choose sites shows the list in place, every site ticked, and the button then names how many it brings", async ({ page }) => {
const view = await open(page, { sites: 5, reveal: false })
const choose = view.dialog.getByRole("button", { name: "Choose sites" })
await press(view.only)
await choose.click()
await expect(choose).toHaveAttribute("aria-expanded", "true")
await expect(view.options).toHaveCount(5)
await expect(view.dialog.getByText("0 of 5 selected")).toBeVisible()
await expect(view.importButton).toHaveText("Import")
await expect(view.importButton).toBeDisabled()
await view.dialog.locator('[data-site="github.com"]').click()
await expect(view.importButton).toHaveText("Import 1 site")
// Every site ticked is everything again.
await press(view.selectAll)
await expect(view.dialog.getByText("5 of 5 selected")).toBeVisible()
await expect(view.importButton).toHaveText("Import")
await view.dialog.locator('[data-site="github.com"]').click()
await expect(view.importButton).toHaveText("Import 4 sites")
// Ticking it again is everything again.
await view.dialog.locator('[data-site="github.com"]').click()
await expect(view.importButton).toHaveText("Import")
await view.dialog.locator('[data-site="github.com"]').click()
await view.importButton.click()
const sent = JSON.parse((await view.record.locator("li").textContent()) ?? "{}")
expect(sent.sites).toHaveLength(4)
expect(sent.sites).not.toContain("github.com")
})
story("a list that Only sites I choose showed after its sites loaded still draws the rows it scrolls to", async ({ page }) => {
story("a list that Choose sites revealed after its sites loaded still draws the rows it scrolls to", async ({ page }) => {
const view = await open(page, { sites: 5_000, reveal: false })
await press(view.only)
await expect(view.dialog.getByText("0 of 5,000 selected")).toBeVisible()
await view.dialog.getByRole("button", { name: "Choose sites" }).click()
await expect(view.dialog.getByText("5,000 of 5,000 selected")).toBeVisible()
await view.list.hover()
await page.mouse.wheel(0, 4_000)
await expect(view.dialog.locator('[data-site="github.com"]')).not.toBeInViewport()
@ -539,9 +521,7 @@ story("the bar's own dialog brings history alone when Sign-ins is unticked, and
await page.getByRole("button", { name: "Import from another browser", exact: true }).click()
await page.getByRole("menuitem", { name: "Choose sites to import", exact: true }).click()
const dialog = page.getByRole("dialog", { name: "Import from another browser", exact: true })
// It opens on the sites the person ticks, none yet; All sites brings the whole profile.
await press(dialog.getByRole("radio", { name: /^All sites/ }))
const dialog = page.getByRole("dialog", { name: /^Import from Google Chrome/ })
await dialog.getByText("Sign-ins", { exact: true }).click()
await expect(dialog.getByRole("checkbox", { name: "Sign-ins", exact: true })).not.toBeChecked()
await dialog.getByRole("button", { name: "Import", exact: true }).click()

View file

@ -1,11 +1,11 @@
import { expect, story } from "../../stories/playwright/story"
story("opens a page from the standalone Lab and previews its states", async ({ page }) => {
story("opens a component from the standalone catalog and previews its states", async ({ page }) => {
await page.goto("/")
await expect(page.getByRole("tree")).toBeVisible({ timeout: 30_000 })
await page.getByRole("button", { name: /Search pages/ }).click()
await page.getByRole("button", { name: /Search components/ }).click()
const search = page.getByPlaceholder("Search pages")
const search = page.getByPlaceholder("Search components")
await search.fill("Composer docks")
await search.press("Enter")
@ -13,10 +13,10 @@ story("opens a page from the standalone Lab and previews its states", async ({ p
await expect(page.getByText("Rename the Alpha export", { exact: true })).toBeVisible()
})
story("edits a page's state argument from the inspector", async ({ page }) => {
await page.goto("/?page=../../app/src/composer/composer-touch.lab.tsx")
story("edits a story's state argument from the inspector", async ({ page }) => {
await page.goto("/?story=../../app/src/composer/composer-touch.stories.tsx")
await page
.getByRole("region", { name: "lab controls" })
.getByRole("region", { name: "components-lab controls" })
.getByRole("button", { name: "state", exact: true })
.click()
await page.getByRole("menuitemradio", { name: "shell", exact: true }).click()

View file

@ -267,49 +267,6 @@ story("compact checkboxes use the design system control states and focus ring",
await expect(controls.nth(0)).toHaveCSS("outline-offset", "2px")
})
story("radios support their surfaces with the design system control states", async ({ mount, page }) => {
const root = await mount("ui-radio--surfaces")
await page.addStyleTag({
content: `[data-component="radio-v2"] {
--v2-background-bg-base: rgb(20, 30, 40);
--v2-background-bg-layer-01: rgb(50, 60, 70);
--v2-background-bg-accent: rgb(1, 2, 3);
--v2-border-border-strong: rgb(4, 5, 6);
--v2-overlay-simple-overlay-hover: rgb(10, 20, 30);
--v2-state-fg-danger: rgb(7, 8, 9);
}`,
})
const controls = root.locator('[data-slot="radio-v2-item-control"]')
for (const [index, background] of [
[0, "rgb(20, 30, 40)"],
[2, "rgb(20, 30, 40)"],
[4, "rgb(50, 60, 70)"],
[6, "rgb(50, 60, 70)"],
] as const) {
await expect(controls.nth(index)).toHaveCSS("background-color", background)
await expect(controls.nth(index)).toHaveCSS("background-image", "none")
}
for (const index of [1, 5]) {
await expect(controls.nth(index)).toHaveCSS("background-color", "rgb(1, 2, 3)")
await expect(controls.nth(index)).not.toHaveCSS("background-image", "none")
}
for (const index of [3, 7]) {
await expect(controls.nth(index)).toHaveCSS("box-shadow", "rgb(7, 8, 9) 0px 0px 0px 0.5px inset")
}
await controls.nth(4).hover()
await expect(controls.nth(4)).toHaveCSS("background-color", "rgb(50, 60, 70)")
await expect(controls.nth(4)).toHaveCSS(
"box-shadow",
/^rgb\(4, 5, 6\) 0px 0px 0px 0\.5px inset, rgb\(10, 20, 30\) 0px 0px 0px [\d.]+px inset$/,
)
})
story(
"text inputs keep clear and copy actions equally sized and inset across sizes and directions",
async ({ mount, page }) => {

View file

@ -1,45 +0,0 @@
import type { Locator } from "@playwright/test"
import { expect, story } from "../../stories/playwright/story"
// The list's scroll position, read from its scrolling viewport.
const scrollTop = (list: Locator) =>
list.evaluate((element) => element.closest<HTMLElement>('[data-slot="search-list-scroll"]')?.scrollTop ?? NaN)
const frames = (list: Locator) =>
list.evaluate(() => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done))))
story("unfavoriting a model from its flyout keeps the list where it is", async ({ mount, page }) => {
await mount("app-dialog-model-selector--long-list")
const list = page.getByRole("dialog").getByRole("listbox")
// The second favorite, so the pointer has to take the highlight. Its own group is far below the fold.
const favorite = list.getByRole("group", { name: "Favorites" }).getByRole("option", { name: /Zeta Model 24/ })
await expect(favorite).toBeVisible()
expect(await scrollTop(list)).toBe(0)
await favorite.hover({ position: { x: 24, y: 6 } })
await favorite.hover({ position: { x: 40, y: 10 } })
await page.getByRole("menuitem", { name: /Unfavorite/ }).click()
await expect(list.getByRole("group", { name: "Favorites" }).getByRole("option")).toHaveCount(1)
// A reveal would run on the next frame.
await frames(list)
expect(await scrollTop(list)).toBe(0)
})
story("unfavoriting from the keyboard follows the model to its group", async ({ mount, page }) => {
await mount("app-dialog-model-selector--long-list")
const list = page.getByRole("dialog").getByRole("listbox")
const search = page.getByRole("combobox", { name: "Search models" })
await expect(list.getByRole("group", { name: "Favorites" }).getByRole("option")).toHaveCount(2)
await search.press("ArrowDown")
await expect(list.getByRole("option", { name: /Zeta Model 24/, selected: true })).toBeVisible()
await search.press("ControlOrMeta+f")
await expect(list.getByRole("group", { name: "Favorites" }).getByRole("option")).toHaveCount(1)
await expect(
list.getByRole("group", { name: "Zeta" }).getByRole("option", { name: /Zeta Model 24/ }),
).toBeInViewport()
expect(await scrollTop(list)).toBeGreaterThan(0)
})

View file

@ -1,103 +0,0 @@
import type { Locator, Page } from "@playwright/test"
import { expect, story } from "../../stories/playwright/story"
const box = async (locator: Locator) => {
const value = await locator.boundingBox()
if (!value) throw new Error("not laid out")
return value
}
// Hovers "Sidebar position", then walks the pointer into its submenu, as a hand does, and picks one side.
const pick = async (page: Page, side: "Left" | "Right", checked: "Left" | "Right") => {
const trigger = page.getByRole("menuitem", { name: "Sidebar position" })
await trigger.hover()
const option = page.getByRole("menuitemradio", { name: side })
await expect(page.getByRole("menuitemradio", { name: checked })).toHaveAttribute("aria-checked", "true")
const target = await box(option)
await page.mouse.move(target.x + target.width / 2, target.y + target.height / 2, { steps: 10 })
await option.click()
await expect(page.getByRole("menuitemradio")).toHaveCount(0)
}
for (const { name, id } of [
{ name: "Review", id: "plugins-review--changes-and-comments" },
{ name: "Open file", id: "plugins-files--source" },
]) {
story(`${name}: the Sidebar position submenu moves the file tree right and back`, async ({ mount, page }) => {
const component = await mount(id)
const panel = component.locator('[data-component="session-review-v2"]')
const sidebar = panel.locator('[data-slot="session-review-v2-sidebar"]')
const preview = panel.locator('[data-slot="session-review-v2-preview"]')
const toggle = panel.getByRole("button", { name: "Toggle file tree" })
await expect(sidebar).toBeVisible()
await expect(panel).toHaveAttribute("data-sidebar-side", "start")
expect((await box(sidebar)).x).toBeLessThan((await box(preview)).x)
await panel.locator('[data-slot="session-review-v2-sidebar-header"]').click({ button: "right" })
await pick(page, "Right", "Left")
await expect(panel).toHaveAttribute("data-sidebar-side", "end")
expect((await box(sidebar)).x).toBeGreaterThan((await box(preview)).x)
// The toggle follows the tree to the right edge.
expect((await box(toggle)).x).toBeGreaterThan((await box(sidebar)).x)
// Collapsed, the toggle keeps the menu.
await toggle.click()
await expect(sidebar).toBeHidden()
await toggle.click({ button: "right" })
await pick(page, "Left", "Right")
await expect(panel).toHaveAttribute("data-sidebar-side", "start")
await toggle.click()
await expect(sidebar).toBeVisible()
expect((await box(sidebar)).x).toBeLessThan((await box(preview)).x)
})
}
const pickWithKeyboard = async (page: Page, side: "Left" | "Right") => {
await expect(page.getByRole("menu")).toBeFocused()
await page.keyboard.press("ArrowDown")
await expect(page.getByRole("menuitem", { name: "Sidebar position" })).toBeFocused()
await page.keyboard.press("ArrowRight")
await expect(page.getByRole("menuitemradio", { name: "Left" })).toBeFocused()
await expect(page.getByRole("menuitemradio", { name: "Left" })).toHaveAttribute("aria-checked", "true")
if (side === "Right") await page.keyboard.press("ArrowDown")
await expect(page.getByRole("menuitemradio", { name: side })).toBeFocused()
await page.keyboard.press("Enter")
await expect(page.getByRole("menuitemradio")).toHaveCount(0)
}
story("Shift+F10 on the toggle opens the position menu and returns focus", async ({ mount, page }) => {
const component = await mount("plugins-review--changes-and-comments")
const panel = component.locator('[data-component="session-review-v2"]')
const toggle = panel.getByRole("button", { name: "Toggle file tree" })
await toggle.focus()
await page.keyboard.press("Shift+F10")
await expect(page.getByRole("menu")).toBeFocused()
await page.keyboard.press("Escape")
await expect(toggle).toBeFocused()
await page.keyboard.press("Shift+F10")
await pickWithKeyboard(page, "Right")
await expect(panel).toHaveAttribute("data-sidebar-side", "end")
await expect(toggle).toBeFocused()
})
story("the file tree filter keeps the system context menu", async ({ mount, page }) => {
const component = await mount("plugins-review--changes-and-comments")
const filter = component.getByRole("searchbox", { name: "Filter files" })
await filter.click({ button: "right" })
await expect(page.getByRole("menuitem", { name: "Sidebar position" })).toHaveCount(0)
await filter.focus()
await page.keyboard.press("Shift+F10")
await expect(page.getByRole("menuitem", { name: "Sidebar position" })).toHaveCount(0)
})

View file

@ -9,7 +9,6 @@ import {
type App,
type Keybinds,
type MountedSession,
type PanelSidebar,
type Router,
type Servers,
type SessionScreen,
@ -599,15 +598,7 @@ export function mountSessionRegion(input: {
// oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
const screen = route as unknown as SessionScreen
const sidebar: PanelSidebar = {
opened: () => false,
width: () => 0,
transition: () => false,
resize() {},
toggle() {},
side: () => "start",
move() {},
}
const sidebar = { opened: () => false, width: () => 0, transition: () => false, resize() {}, toggle() {} }
function Region() {
const host = usePluginHost()
@ -720,7 +711,7 @@ export function mountSessionRegion(input: {
* theme picker's choices as Settings › Appearance lists them; `disable` and `enable` toggle a plugin as
* Extensions › Plugins does. With `pending`, the plugin list has not arrived until `load()`. `applied` counts the
* provider's `onThemeApplied` calls, which show a desktop window. `preview`, `previewScheme`, `commit` and `cancel`
* drive the provider's preview, as the Lab does.
* drive the provider's preview, as the components lab does.
*/
export function mountThemes(input: { definitions: readonly Entry[]; pending?: true }) {
const container = document.createElement("div")

View file

@ -752,7 +752,7 @@ story(
const read = () => ({
state: reads.state?.(),
font: reads.font?.().startsWith('"OpenMono"') ? "default mono" : reads.font?.(),
font: reads.font?.().startsWith('"JetBrainsMono Nerd Font Mono"') ? "default mono" : reads.font?.(),
prefs: reads.prefs?.value?.count,
ready: reads.prefs?.ready(),
writes: [...host.writes],
@ -1765,7 +1765,7 @@ story(
expect(result).toEqual({
// Alphabetical among the app's themes, not appended after them.
neighbors: ["Mercury", "Midnight", "Modus"],
neighbors: ["Mercury", "Midnight", "Monokai"],
withdrawn: { listed: false, selected: "oc-2", stored: "acme:midnight" },
restored: "acme:midnight",
})

View file

@ -1,52 +0,0 @@
import { expect, story } from "../../stories/playwright/story"
story(
"chooses a worktree for a session whose folder is gone from the shared worktree dialog",
async ({ mount, page }) => {
await mount("session-missing-location--many-worktrees")
const trigger = page.getByRole("button", { name: "Choose worktree", exact: true })
const search = page.getByRole("combobox", { name: "Search worktrees", exact: true })
const rows = page.getByRole("option")
await trigger.focus()
await page.keyboard.press("Enter")
await expect(search).toBeFocused()
await expect(rows.first()).toContainText("/Users/alex/work/opencode")
// Hovering moves the highlight, never focus, so typing still reaches the search field.
for (const index of [2, 3, 4, 5, 6, 7, 8]) {
await rows.nth(index).hover()
await expect(search).toBeFocused()
}
// The search field names the active row, so Tab and Shift+Tab never land on a row.
for (const key of ["Tab", "Shift+Tab"]) {
await search.focus()
await page.keyboard.press(key)
await expect(page.locator('[role="option"]:focus')).toHaveCount(0)
}
await search.focus()
await page.keyboard.type("rev")
await expect(search).toHaveValue("rev")
await page.keyboard.press("Escape")
await expect(search).toBeHidden()
await expect(trigger).toBeFocused()
expect(await trigger.evaluate((element) => element.matches(":focus-visible"))).toBe(true)
await page.keyboard.press("Enter")
await expect(search).toBeFocused()
await page.keyboard.type("comp")
await expect(rows).toHaveCount(1)
await expect(rows).toContainText("opencode-composer")
// The main checkout leads the list, so clearing the search and pressing Enter moves the session there.
await search.fill("")
await page.keyboard.press("Enter")
await expect(page.getByText("Session moved to /Users/alex/work/opencode", { exact: true })).toBeVisible()
},
)

File diff suppressed because it is too large Load diff

View file

@ -1,78 +0,0 @@
import { For, onCleanup } from "solid-js"
import { createStore } from "solid-js/store"
import { render } from "solid-js/web"
import { Icon } from "@opencode/ui/icon"
import { IconButton } from "@opencode/ui/icon-button"
import { Tabs } from "@opencode/ui/tabs"
import { createTabStripScroll } from "../src/runtime/plugin/tab-strip-scroll"
import { createTabStripWidths } from "../src/runtime/plugin/tab-strip-widths"
const [state, setState] = createStore<{ titles: string[]; width: number }>({ titles: [], width: 0 })
const host = document.createElement("div")
/** A side pane tab strip built as `PaneTabs` builds it, with the host's tab styles, close buttons and sticky "+". */
export function mountTabStrip(input: { titles: string[]; width: number; dir: "ltr" | "rtl" }) {
setState({ titles: input.titles, width: input.width })
host.dataset.testid = "tab-strip-fixture"
host.dir = input.dir
// Above the story, at a fixed place in the viewport, so pointer positions stay put.
host.style.cssText = "position: fixed; top: 200px; left: 20px; z-index: 1000"
document.body.appendChild(host)
render(() => {
const close = (title: string) => setState("titles", (titles) => titles.filter((item) => item !== title))
return (
<aside id="review-panel" class="relative flex" style={{ width: `${state.width}px` }}>
<Tabs value={state.titles[0] ?? ""}>
<div class="session-review-v2-tabs-bar sticky top-0 shrink-0 flex items-center">
<Tabs.List
ref={(el: HTMLDivElement) => {
onCleanup(createTabStripScroll({ el, lead: () => false }))
onCleanup(createTabStripWidths(el))
}}
>
<For each={state.titles}>
{(title) => (
<div data-pane-tab={title} class="h-full flex items-center">
<div class="relative min-w-0">
<Tabs.Trigger
value={title}
onMiddleClick={title.startsWith("pinned") ? undefined : () => close(title)}
closeButton={
<IconButton
size="small"
variant="ghost-muted"
onPointerDown={(event) => {
event.preventDefault()
event.stopPropagation()
}}
onClick={(event) => {
event.preventDefault()
event.stopPropagation()
close(title)
}}
icon={<Icon name="close" />}
aria-label={`Close ${title}`}
/>
}
hideCloseButton
>
<span class="truncate">{title}</span>
</Tabs.Trigger>
</div>
</div>
)}
</For>
<div class="h-full shrink-0 sticky end-0 z-10 flex items-center justify-center bg-v2-background-bg-base">
<IconButton icon={<Icon name="plus" />} variant="ghost-muted" size="large" aria-label="Add tab" />
</div>
</Tabs.List>
</div>
</Tabs>
</aside>
)
}, host)
}
export const setTabStripWidth = (width: number) => setState("width", width)

View file

@ -1,165 +0,0 @@
import type { Page } from "@playwright/test"
import { expect, sourceURL, story } from "../../stories/playwright/story"
const fixture = sourceURL(new URL("./tab-strip-widths.fixture.tsx", import.meta.url))
const long = (name: string) => `a-file-name-long-enough-to-truncate-${name}.md`
story.beforeEach(async ({ mount }) => {
// Any story loads the app's styles; the fixture mounts the strip beside it.
await mount("ui-line-comment--editor")
})
async function mountStrip(page: Page, input: { titles: string[]; width: number; dir?: "ltr" | "rtl" }) {
await page.evaluate(
async ({ fixture, input }) => {
const { mountTabStrip } = await import(fixture)
mountTabStrip({ dir: "ltr", ...input })
await document.fonts.ready
},
{ fixture, input },
)
await expect(strip(page).locator("[data-pane-tab]")).toHaveCount(input.titles.length)
}
const strip = (page: Page) => page.getByTestId("tab-strip-fixture").locator('[data-slot="tabs-list"]')
const closeButton = (page: Page, title: string) =>
strip(page).locator(`[data-pane-tab="${title}"] [data-slot="tabs-trigger-close-button"]`)
async function center(page: Page, title: string) {
const box = (await closeButton(page, title).boundingBox())!
return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
}
// The tab whose close button is at the point.
const under = (page: Page, point: { x: number; y: number }) =>
page.evaluate(
(point) =>
document
.elementFromPoint(point.x, point.y)
?.closest('[data-slot="tabs-trigger-close-button"]')
?.closest<HTMLElement>("[data-pane-tab]")?.dataset.paneTab,
point,
)
const hold = (page: Page) => strip(page).evaluate((el) => el.style.paddingInlineEnd)
const tabWidth = async (page: Page, title: string) =>
(await strip(page).locator(`[data-pane-tab="${title}"]`).boundingBox())!.width
story(
"a mouse close keeps the next close button under the pointer until the pointer leaves the strip",
async ({ page }) => {
const titles = [long("alpha"), "a.md", long("beta"), long("gamma"), "b.md", long("delta")]
await mountStrip(page, { titles, width: 900 })
const width = await tabWidth(page, long("gamma"))
const middle = await center(page, long("beta"))
await page.mouse.click(middle.x, middle.y)
await expect(strip(page).locator(`[data-pane-tab="${long("beta")}"]`)).toHaveCount(0)
await expect.poll(() => under(page, middle)).toBe(long("gamma"))
// The short tab before the last one keeps its width, so the long ones fill the closed tab's place.
const last = await center(page, long("delta"))
await page.mouse.click(last.x, last.y)
await expect(strip(page).locator(`[data-pane-tab="${long("delta")}"]`)).toHaveCount(0)
await expect.poll(() => under(page, last)).toBe("b.md")
// The "+" stays a gap after the last tab, and the held strip shows no end fade.
const gap = await strip(page).evaluate((el) => {
const plus = el.lastElementChild!.getBoundingClientRect()
const tab = el.querySelector('[data-pane-tab="b.md"]')!.getBoundingClientRect()
return Math.round(plus.left - tab.right)
})
expect(gap).toBe(8)
expect(await strip(page).evaluate((el) => el.style.getPropertyValue("--tab-strip-fade-end"))).toBe("0px")
await page.mouse.move(middle.x, middle.y + 200)
await expect.poll(() => hold(page)).toBe("")
await expect.poll(() => tabWidth(page, long("gamma"))).toBeGreaterThan(width + 1)
},
)
story("a middle click close holds the strip, and resizing the strip releases it", async ({ page }) => {
const titles = [long("alpha"), long("beta"), long("gamma"), long("delta")]
await mountStrip(page, { titles, width: 700 })
const width = await tabWidth(page, long("gamma"))
await strip(page)
.locator(`[data-pane-tab="${long("beta")}"] [role="tab"]`)
.click({ button: "middle" })
await expect(strip(page).locator(`[data-pane-tab="${long("beta")}"]`)).toHaveCount(0)
await expect.poll(() => tabWidth(page, long("gamma"))).toBeCloseTo(width, 0)
// Held, the three tabs would shrink with the strip; released, they share the whole of it.
await page.evaluate(async (fixture) => {
const { setTabStripWidth } = await import(fixture)
setTabStripWidth(650)
}, fixture)
await expect.poll(() => tabWidth(page, long("gamma"))).toBeGreaterThan(width + 1)
expect(await hold(page)).toBe("")
})
story("closing from the keyboard, or a middle click that closes nothing, resizes the tabs", async ({ page }) => {
const titles = [long("alpha"), "pinned.md", long("beta"), long("gamma")]
await mountStrip(page, { titles, width: 700 })
const width = await tabWidth(page, long("gamma"))
// The middle click on a tab without a middle-click close arms nothing for the keyboard close that follows.
await strip(page).locator('[data-pane-tab="pinned.md"] [role="tab"]').click({ button: "middle" })
await closeButton(page, "pinned.md").getByRole("button").focus()
await page.keyboard.press("Enter")
await expect(strip(page).locator('[data-pane-tab="pinned.md"]')).toHaveCount(0)
await expect.poll(() => tabWidth(page, long("gamma"))).toBeGreaterThan(width + 1)
const next = await tabWidth(page, long("gamma"))
await closeButton(page, long("alpha")).getByRole("button").focus()
await page.keyboard.press("Enter")
await expect(strip(page).locator(`[data-pane-tab="${long("alpha")}"]`)).toHaveCount(0)
await expect.poll(() => tabWidth(page, long("gamma"))).toBeGreaterThan(next + 1)
})
story("in a right-to-left strip the next close button slides under the pointer", async ({ page }) => {
const titles = [long("alpha"), long("beta"), long("gamma"), long("delta")]
await mountStrip(page, { titles, width: 700, dir: "rtl" })
const middle = await center(page, long("beta"))
await page.mouse.click(middle.x, middle.y)
await expect(strip(page).locator(`[data-pane-tab="${long("beta")}"]`)).toHaveCount(0)
await expect.poll(() => under(page, middle)).toBe(long("gamma"))
})
story(
"an overflowing strip is never held, so closing its last tab keeps the other tabs at their width",
async ({ page }) => {
const titles = Array.from({ length: 8 }, (_, index) => long(String(index)))
await mountStrip(page, { titles, width: 400 })
expect(await strip(page).evaluate((el) => el.scrollWidth > el.clientWidth)).toBe(true)
const width = await tabWidth(page, titles[6])
await strip(page).evaluate((el) => (el.scrollLeft = el.scrollWidth))
const last = await center(page, titles[7])
await page.mouse.click(last.x, last.y)
await expect(strip(page).locator("[data-pane-tab]")).toHaveCount(7)
expect(await hold(page)).toBe("")
expect(await tabWidth(page, titles[6])).toBeCloseTo(width, 0)
},
)
story.describe("touch", () => {
story.use({ hasTouch: true })
story("a tap on a close button never holds the strip", async ({ page }) => {
const titles = [long("alpha"), long("beta"), long("gamma"), long("delta")]
await mountStrip(page, { titles, width: 700 })
const width = await tabWidth(page, long("gamma"))
await closeButton(page, long("beta")).getByRole("button").tap()
await expect(strip(page).locator(`[data-pane-tab="${long("beta")}"]`)).toHaveCount(0)
await expect.poll(() => tabWidth(page, long("gamma"))).toBeGreaterThan(width + 1)
})
})

View file

@ -1,257 +0,0 @@
import type { AutomationInfo } from "@opencode/client/promise"
import { expect, test } from "@playwright/test"
import { project, provider, REMOTE_SERVER, seed, SERVER, sessionHref } from "../utils/app"
import { mockServers } from "../utils/mock-server"
import { mockWorkspace } from "../utils/workspace"
test("inspects event and timer automations and manages the selected row", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 })
const directory = "C:/OpenCode/Atlas"
const now = Date.UTC(2026, 10, 17, 9, 10)
const base = {
projectID: "proj_atlas",
directory: `${directory}/release`,
tz: "UTC",
sessionID: "ses_release",
status: "active",
runCount: 3,
time: { created: now, updated: now },
} as const
const automations: AutomationInfo[] = [
{
...base,
id: "aut_deploy",
name: "Release health watch",
trigger: { type: "event", server: "deployments", event: "deployment.finished", args: { environment: "staging" } },
action: {
type: "code",
code: 'console.log(`Deployment status: ${event.data.status}`)\nif (event.data.status === "failed")\n return { send: { prompt: "Review the failed deployment." } }',
},
lastRunAt: now,
lastOutcome: "fired",
lastOutput: "Deployment status: succeeded",
},
{
...base,
id: "aut_brief",
name: "Morning release brief",
trigger: { type: "cron", cron: "0 9 * * 1-5" },
action: { type: "prompt", prompt: "Summarize release activity since yesterday.", to: { session: "ses_brief" } },
nextDueAt: now + 86_400_000,
},
{
...base,
id: "aut_smoke",
name: "Nightly smoke test",
trigger: { type: "cron", cron: "0 2 * * *" },
action: { type: "shell", command: "bun run test:smoke --reporter=dot" },
nextDueAt: now + 2 * 86_400_000,
lastRunAt: now,
lastOutcome: "fired",
lastOutput: "Exit code: 0\n42 pass, 0 fail",
},
{
...base,
id: "aut_docs",
name: "Documentation review",
status: "paused",
trigger: { type: "every", every: "1 day" },
action: { type: "prompt", prompt: "Review the documentation changes.", to: { subagent: "reviewer" } },
},
]
await mockWorkspace(page, {
name: "Atlas",
directory,
project: { name: "Atlas (sample)" },
hostname: "release-runner-03",
commands: [{ name: "automation" }],
sessions: [
{ id: "ses_release", title: "Release planning" },
{ id: "ses_brief", title: "Release notes" },
],
automations,
seed: {
theme: { id: "oc-2", scheme: "dark" },
settings: { appearance: { tabLayout: "vertical", sidebarOpen: true } },
},
})
await page.goto(sessionHref("ses_release"))
const nav = page.getByRole("button", { name: "Automations", exact: true })
await nav.click()
await expect(page.getByRole("button", { name: /Morning release brief/ })).toContainText("Weekdays at 9:00 AM")
const detail = page.getByRole("article")
await page.getByRole("button", { name: /Release health watch/ }).click()
await expect(detail.getByRole("heading", { name: "Release health watch" })).toBeVisible()
await expect(detail.getByText("deployment.finished from deployments", { exact: true })).toBeVisible()
await expect(detail.getByText("release-runner-03")).toHaveCount(0)
await expect(detail.getByText('environment = "staging"', { exact: true })).toBeVisible()
await expect(detail.getByText("Next run")).toHaveCount(0)
await expect(
detail.getByText("Wakes the creating session only when the code returns send", { exact: false }),
).toBeVisible()
await expect(detail.getByText(`${directory}/release`, { exact: true })).toBeVisible()
await expect(detail.getByText("Deployment status: succeeded", { exact: true })).toBeVisible()
await page.screenshot({ path: test.info().outputPath("automation-inspector.png"), animations: "disabled" })
await detail.getByRole("button", { name: "Pause", exact: true }).click()
await expect(nav).toContainText("2")
await detail.getByRole("button", { name: "Resume", exact: true }).click()
await expect(nav).toContainText("3")
await detail.getByRole("button", { name: "Delete", exact: true }).click()
await page.getByRole("dialog").getByRole("button", { name: "Delete", exact: true }).click()
await expect(page.getByRole("button", { name: /Release health watch/ })).toHaveCount(0)
await expect(detail.getByText("Next run")).toBeVisible()
await expect(detail.getByRole("button", { name: "Release planning" })).toBeVisible()
await expect(detail.getByRole("button", { name: "Release notes" })).toBeVisible()
await page.getByRole("button", { name: /Nightly smoke test/ }).click()
await expect(detail.getByText("bun run test:smoke --reporter=dot", { exact: true })).toBeVisible()
await expect(detail.getByText("Doesn’t wake a session", { exact: false })).toBeVisible()
await page.getByRole("button", { name: /Documentation review/ }).click()
await expect(detail.getByText("Send a prompt to a new reviewer subagent")).toBeVisible()
await page.getByRole("button", { name: "New automation" }).click()
await expect(page.locator('[data-component="composer-editor"]')).toHaveText(/\/automation/)
})
test("keeps the entry for an empty server and withdraws New automation when the server removes its command", async ({
page,
}) => {
let enabled = true
const { push, directory } = await mockWorkspace(page, {
name: "Empty",
commands: () => (enabled ? [{ name: "automation" }] : []),
})
await page.goto("/automations")
await expect(page.getByRole("heading", { name: "No automations yet" })).toBeVisible()
enabled = false
await push([
{ id: "evt_automation_disabled", created: 1, type: "command.updated", location: { directory }, data: {} },
])
await expect(page.getByRole("button", { name: "New automation" })).toHaveCount(0)
await expect(page.getByRole("heading", { name: "No automations yet" })).toBeVisible()
await expect(page.getByRole("button", { name: "Automations", exact: true })).toBeVisible()
})
test("manages a watch outside open locations and opens the recipient instead of its last viewed child", async ({
page,
}) => {
const directory = "/projects/repo"
const docs = `${directory}/docs`
await mockWorkspace(page, {
name: "Repo",
directory,
commands: (dir) => (dir === docs ? [{ name: "automation" }] : []),
automations: [
{
id: "aut_docs",
projectID: "proj_repo",
directory: docs,
name: "Review docs",
tz: "UTC",
trigger: { type: "every", every: "1 day" },
action: { type: "prompt", prompt: "Review new documentation.", to: { session: "ses_parent" } },
status: "active",
runCount: 0,
time: { created: 1, updated: 1 },
},
],
sessions: [
{ id: "ses_parent", title: "Docs planning" },
{ id: "ses_child", title: "Research notes", parentID: "ses_parent" },
],
seed: {
storage: {
"opencode.window.browser.dat:tabs": [
{
type: "session",
sessionId: "ses_parent",
server: SERVER,
routeSessionId: "ses_child",
routeParentId: "ses_parent",
},
],
},
},
})
await page.goto(sessionHref("ses_child"))
await expect(page.getByRole("heading", { name: "Research notes", exact: true })).toBeVisible()
await page.getByRole("button", { name: "Automations", exact: true }).click()
const detail = page.getByRole("article")
await expect(detail.getByRole("heading", { name: "Review docs" })).toBeVisible()
await expect(detail.getByText(docs, { exact: true })).toBeVisible()
await expect(page.getByRole("button", { name: "New automation" })).toBeVisible()
await detail.getByRole("button", { name: /Docs planning|ses_parent/ }).click()
await expect(page).toHaveURL(sessionHref("ses_parent"))
await expect(page.locator('[data-component="composer-editor"]')).toBeEditable()
})
test("keeps identically keyed automations on separate servers and starts the draft in the row’s saved directory", async ({
page,
}) => {
const servers = [SERVER, REMOTE_SERVER] as const
const creates: unknown[] = []
const commands: unknown[] = []
await mockServers(
page,
Object.fromEntries(
servers.map((server) => {
const name = server === SERVER ? "Local" : "Remote"
const directory = `/projects/${name.toLowerCase()}`
const row: AutomationInfo = {
id: "aut_brief",
name: `${name} brief`,
projectID: "proj_shared",
directory: `${directory}/worktrees/docs`,
status: "active",
runCount: 0,
trigger: { type: "at", at: "2027-01-04T09:00" },
tz: "UTC",
action: { type: "prompt", prompt: "Review the release notes.", to: { session: "ses_notes" } },
time: { created: 1, updated: 1 },
}
return [
server,
{
directory,
project: project({ id: row.projectID, directory, name: `${name} project` }),
provider: provider(),
pageMessages: () => ({ items: [] }),
onSessionCreate: (body: { location?: unknown }) => void creates.push({ server, location: body.location }),
onCommand: (input: { body: unknown }) => void commands.push({ server, body: input.body }),
sessions: [],
commands: [{ name: "automation" }],
automations: [row],
},
]
}),
),
)
await seed(page, {
servers: [REMOTE_SERVER],
usedProjects: { local: ["proj_shared"], [REMOTE_SERVER]: ["proj_shared"] },
})
await page.goto("/automations")
await page.getByRole("button", { name: /Remote brief/ }).click()
const detail = page.getByRole("article")
await expect(detail.getByText("Remote project", { exact: true })).toBeVisible()
await expect(detail.getByText("Created by")).toHaveCount(0)
await expect(detail.getByRole("button", { name: "another session" })).toBeVisible()
const directory = "/projects/remote/worktrees/docs"
await expect(detail.getByText(directory, { exact: true })).toBeVisible()
await page.getByRole("button", { name: "New automation" }).click()
const editor = page.locator('[data-component="composer-editor"]')
await expect(editor).toHaveText(/\/automation/)
await editor.fill("/automation Review the release notes on Friday")
await editor.press("Enter")
await expect.poll(() => creates).toEqual([{ server: REMOTE_SERVER, location: { directory } }])
await expect
.poll(() => commands)
.toMatchObject([
{ server: REMOTE_SERVER, body: { name: "automation", text: "Review the release notes on Friday" } },
])
})

View file

@ -136,38 +136,6 @@ test("isolates concurrent side questions and makes interrupted and blank answers
expect(prompts).toEqual([])
})
test("marks a side question answered behind another tab until it is shown", async ({ page }) => {
const held = Promise.withResolvers<void>()
const { editor } = await openSession(page, {
name: "BtwUnread",
generate: async (input) => {
if (!input.prompt.includes("slow question")) return { text: "Fast answer" }
await held.promise
return { text: "Slow answer" }
},
})
const panel = page.locator('[data-slot="session-btw-panel"]')
const slow = page.getByRole("tab", { name: "slow question", exact: true })
const fast = page.getByRole("tab", { name: "fast question", exact: true })
const unread = page.getByRole("tab", { name: "slow question New answer", exact: true })
await editor.fill("/btw slow question")
await editor.press("Enter")
await expect(panel.getByRole("status")).toContainText("Working")
await editor.fill("/btw fast question")
await editor.press("Enter")
await expect(panel.getByText("Fast answer", { exact: true })).toBeVisible()
await expect(fast).toHaveAttribute("data-selected", "")
await expect(slow).toBeVisible()
held.resolve()
await unread.click()
await expect(panel.getByText("Slow answer", { exact: true })).toBeVisible()
await expect(slow).toHaveAttribute("data-selected", "")
await expect(unread).toHaveCount(0)
})
test("keeps many long-titled side tabs usable at a narrow desktop width", async ({ page }, testInfo) => {
await page.setViewportSize({ width: 900, height: 700 })

View file

@ -132,35 +132,7 @@ test("titlebar search lists recent sessions and opens the typed match", async ({
await expect(page.getByRole("heading", { name: paletteSession.title, exact: true })).toBeVisible()
})
test("titlebar search finds archived sessions dimmed but keeps them out of recent sessions", async ({ page }) => {
const archived = {
...paletteSession,
id: "ses_command_palette_archived",
title: "Palette archived session",
time: { ...paletteSession.time, updated: paletteSession.time.updated + 1, archived: 1700000000500 },
}
await openPaletteWorkspace(page, true, [paletteSession, archived])
await page.getByRole("banner").getByRole("button", { name: "Search sessions", exact: true }).click()
const dialog = page.getByRole("dialog")
const input = dialog.getByRole("combobox")
const row = dialog.getByRole("option", { name: /Palette archived session/ })
await expect(dialog.getByRole("option", { name: /Palette fixture session/ })).toBeVisible()
await expect(row).toHaveCount(0)
await input.fill("Palette")
await expect(dialog.getByRole("option")).toHaveCount(2)
await expect(row.locator(".command-palette-title")).toHaveClass(/opacity-70/)
await expect(
dialog.getByRole("option", { name: /Palette fixture session/ }).locator(".command-palette-title"),
).not.toHaveClass(/opacity-70/)
await row.click()
await expect(dialog).toHaveCount(0)
await expect(page.getByRole("heading", { name: archived.title, exact: true })).toBeVisible()
})
test("titlebar search asks for one bounded active and one bounded archived result set after a pause in typing", async ({
page,
}) => {
test("titlebar search asks for one bounded result set after a pause in typing", async ({ page }) => {
await openPaletteWorkspace(page, true)
const searches: URL[] = []
page.on("request", (request) => {
@ -199,17 +171,13 @@ test("titlebar search asks for one bounded active and one bounded archived resul
}
})
await searched
const request = new URL((await searched).url())
await expect(dialog.getByRole("option", { name: /Palette fixture session/ })).toBeVisible()
await expect.poll(() => searches.length).toBe(2)
expect(searches.map((url) => url.searchParams.get("archived")).toSorted()).toEqual(["false", "true"])
for (const url of searches) {
expect(url.searchParams.get("search")).toBe("Palette fixture")
expect(url.searchParams.get("limit")).toBe("50")
expect(url.searchParams.get("parentID")).toBe("null")
expect(url.searchParams.get("cursor")).toBeNull()
}
expect(searches).toHaveLength(1)
expect(request.searchParams.get("limit")).toBe("50")
expect(request.searchParams.get("parentID")).toBe("null")
expect(request.searchParams.get("archived")).toBe("false")
expect(request.searchParams.get("cursor")).toBeNull()
})
test("titlebar search shows one server's matches while another server's search fails", async ({ page }) => {

View file

@ -295,14 +295,16 @@ test("the free usage limit opens the Go dialog once, swaps the composer for the
await expect(view.editor).toHaveCount(0)
await expect(page.getByText("Free usage limit reached.")).toHaveCount(0)
// Subscribe -> OpenCode sign-in -> choosing the workspace's Go model switches the model in the current session
// Subscribe -> OpenCode sign-in -> the workspace's Go model -> Continue switches the model in the current session
// without opening a new draft tab.
await upsell.getByRole("button", { name: "Subscribe", exact: true }).click()
const connect = page.getByRole("dialog", { name: "Connect OpenCode", exact: true })
await connect.getByRole("button", { name: "OpenCode account", exact: true }).click()
const connected = page.getByRole("dialog", { name: "Connected to OpenCode" })
await connected.getByRole("combobox", { name: "Search OpenCode models", exact: true }).fill("glm")
await connected.getByRole("option", { name: "GLM-5 Go", exact: true }).click()
const go = connected.getByRole("radio", { name: "GLM-5 Go", exact: true })
await go.click()
await expect(go).toHaveAttribute("aria-checked", "true")
await connected.getByRole("button", { name: "Continue", exact: true }).click()
await expect(page.getByRole("dialog")).toHaveCount(0)
await expectPath(page, sessionHref(sessionID))
await expect(page.locator("[data-titlebar-tab-slot]")).toHaveCount(1)
@ -1392,7 +1394,6 @@ test("lists slash commands in their built-in order", async ({ page }) => {
await expect(page.locator('[data-component="composer-suggestions"] [data-suggestion-id] bdi')).toHaveText([
"/init",
"/review",
"/rename",
"/new",
"/undo",
"/compact",

View file

@ -40,8 +40,6 @@ test("Home projects, utility rows, search and recent sessions show keyboard focu
const projectButton = projects.getByRole("button", { name: /HomeFocus/ })
const automations = projects.getByRole("button", { name: "Automations", exact: true })
const settings = projects.getByRole("button", { name: "Settings", exact: true })
const help = projects.getByRole("button", { name: "Help", exact: true })
@ -60,13 +58,10 @@ test("Home projects, utility rows, search and recent sessions show keyboard focu
)
.toBe("solid")
// The two project row actions come before the utility buttons, which start with Automations.
// The two project row actions come before the utility buttons.
await page.keyboard.press("Tab")
await page.keyboard.press("Tab")
await page.keyboard.press("Tab")
await expect(automations).toBeFocused()
await expect(automations).toHaveCSS("outline-style", "solid")
await page.keyboard.press("Tab")
await expect(settings).toBeFocused()
await expect(settings).toHaveCSS("outline-style", "solid")
await expect(settings).not.toHaveCSS("transition-property", /\b(all|outline)\b/)
@ -95,17 +90,12 @@ test("Home projects, utility rows, search and recent sessions show keyboard focu
await expect(sessionRow).toHaveCSS("outline-offset", "-2px")
await page.setViewportSize({ width: 1280, height: 200 })
await expect.poll(() => viewport.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(true)
await expect(viewport).toHaveAttribute("tabindex", "-1")
await projects.getByRole("button", { name: "Add project", exact: true }).press("Shift+Tab")
await expect(viewport).not.toBeFocused()
// A click still focuses the list so the keyboard can scroll it, without a ring around the whole area.
await viewport.click({ position: { x: 4, y: 4 } })
await expect(viewport).toHaveAttribute("tabindex", "0")
await viewport.press("Shift+Tab")
await page.keyboard.press("Tab")
// The list takes focus so the keyboard can scroll it, without a ring around the whole area.
await expect(viewport).toBeFocused()
await expect(viewport).toHaveCSS("outline-style", "none")
await page.keyboard.press("PageDown")
await expect.poll(() => viewport.evaluate((element) => element.scrollTop)).toBeGreaterThan(0)
})
test("Home keeps the session list in every interface mode", async ({ page }) => {
@ -207,14 +197,7 @@ test("the session context menu renames, exports, and deletes a Home session", as
const box = await target.boundingBox()
await target.click({ button: "right", position: { x: 48, y: 12 } })
await expect(page).toHaveURL("/")
await expect(page.getByRole("menuitem")).toHaveText([
"Open",
"Open in background",
"Rename",
"Copy",
"Export…",
"Delete…",
])
await expect(page.getByRole("menuitem")).toHaveText(["Open", "Open in background", "Rename", "Export…", "Delete…"])
const menu = await page.locator('[data-component="menu-v2-content"]').boundingBox()
expect(Math.abs((menu?.x ?? 0) - (box?.x ?? 0) - 48)).toBeLessThan(4)
@ -352,31 +335,6 @@ test("tabbing out of session search closes its results, and tabbing back reopens
await expect(panel.getByRole("option")).toContainText(earlier.title)
})
test("picking a project from the picker in session search clears the search", async ({ page }) => {
const earlier = { id: "ses_home_search_scope", title: "Finished earlier" }
const workspace = await mockWorkspace(page, { name: "HomeScope", sessions: [earlier] })
await seed(page, { usedProjects: { local: [workspace.projectID] } })
// Between md and lg the project picker sits inside the search field instead of a projects column.
await page.setViewportSize({ width: 900, height: 720 })
await page.goto("/")
const search = page.getByRole("textbox", { name: /Search sessions/ })
const panel = page.locator('[data-component="home-session-search-panel"]')
await expect(row(page, earlier.title)).toBeVisible()
await search.fill("Finished")
await expect(panel.getByRole("option")).toContainText(earlier.title)
await page.getByRole("button", { name: "Projects", exact: true }).click()
await page
.getByRole("dialog", { name: "Projects", exact: true })
.getByRole("button", { name: /HomeScope/ })
.click()
// The results panel closes with the picker, so a query left in the field would no longer filter anything.
await expect(search).toHaveValue("")
await expect(search).toHaveAttribute("placeholder", "Search sessions in HomeScope")
await expect(row(page, earlier.title)).toBeVisible()
})
test("Escape cancels an inline rename whose save does not answer", async ({ page }) => {
const target = { id: "ses_home_rename_hang", title: "Rename me" }
await mockWorkspace(page, { name: "HomeRename", sessions: [target] })

View file

@ -16,13 +16,6 @@ import { capturePromptMotion, markPrompt, promptMotionIssues, readPromptPosition
// The thumb's track is the part of the timeline above the composer region, which the timeline scrolls on under.
const thumbSelector = '[data-slot="session-timeline-visible"] [data-orientation="vertical"]'
// The timeline's own scroll region. A shell tool's output inside it is a scroll region of the same name.
const timelineScroller = (page: Page) =>
page
.locator('[data-slot="session-timeline-scroll"]')
.getByRole("region", { name: "scrollable content", exact: true })
.filter({ has: page.locator("[data-timeline-key]") })
// Compositor prediction can add 20–25px to discrete CDP moves even in a plain
// scrollport. Disable it so the visual assertion measures the supplied gesture.
test.use({ colorScheme: "light", launchOptions: { args: ["--disable-features=ResamplingScrollEvents"] } })
@ -46,7 +39,9 @@ for (const device of ["Pixel 7", "iPhone 13"]) {
viewport: { width: 390, height: 844 },
})
const scroller = timelineScroller(page)
const scroller = page
.locator('[data-slot="session-timeline-scroll"]')
.getByRole("region", { name: "scrollable content", exact: true })
const part = page.locator(`[data-timeline-part-id="${renderedPartID(partID)}"]`)
const anchor = part.getByText("Reading earlier output 59.", { exact: true })
@ -368,7 +363,7 @@ for (const device of ["Pixel 7", "iPhone 13"]) {
})
const timeline = page.locator('[data-slot="session-timeline-scroll"]')
const scroller = timelineScroller(page)
const scroller = timeline.getByRole("region", { name: "scrollable content", exact: true })
const tail = page.getByText("Read output 59.", { exact: true })
await expect(timeline.locator("[data-timeline-virtual-content]")).toBeVisible()
await expect(tail).toBeInViewport()
@ -482,7 +477,7 @@ for (const device of ["Pixel 7", "iPhone 13"]) {
})
const timeline = page.locator('[data-slot="session-timeline-scroll"]')
const scroller = timelineScroller(page)
const scroller = timeline.getByRole("region", { name: "scrollable content", exact: true })
await expect(timeline.locator("[data-timeline-virtual-content]")).toBeVisible()
await expect(page.getByText("Reading 59.", { exact: true })).toBeInViewport()
await page.evaluate(() => document.fonts.ready)
@ -693,7 +688,7 @@ for (const device of ["Pixel 7", "iPhone 13"]) {
})
const timeline = page.locator('[data-slot="session-timeline-scroll"]')
const scroller = timelineScroller(page)
const scroller = timeline.getByRole("region", { name: "scrollable content", exact: true })
const hidden = page.locator(`${thumbSelector}[data-visible="false"]`)
const heading = page.locator(`[data-timeline-part-id="${renderedPartID("prt_target_heading")}"]`)
const last = detach === "scroll" ? page.getByText("Part 79.", { exact: true }) : heading
@ -810,7 +805,7 @@ for (const device of ["Pixel 7", "iPhone 13"]) {
viewport: { width: 700, height: 844 },
})
const timeline = page.locator('[data-slot="session-timeline-scroll"]')
const scroller = timelineScroller(page)
const scroller = timeline.getByRole("region", { name: "scrollable content", exact: true })
await expect(timeline.locator("[data-timeline-virtual-content]")).toBeVisible()
const tail = page.getByText("Section 39.", { exact: false })
await expect(tail).toBeInViewport()
@ -873,7 +868,7 @@ test("painted motion rejects a prompt whose pixels disappear", async ({ page })
const prompt = timeline.locator('[data-timeline-row="UserMessage"]')
await expect(prompt).toBeInViewport()
await markPrompt(page)
const view = (await timelineScroller(page).boundingBox())!
const view = (await timeline.getByRole("region", { name: "scrollable content", exact: true }).boundingBox())!
const frames = [(await page.screenshot({ type: "jpeg" })).toString("base64")]
// Negative control: a captured disappearance must fail even if the layout recovers.
await prompt.evaluate((element) => (element.style.transform = "translateY(-500px)"))
@ -887,7 +882,7 @@ test("painted motion rejects a prompt whose pixels disappear", async ({ page })
async function readFrom(page: Page, text: string) {
const timeline = page.locator('[data-slot="session-timeline-scroll"]')
const scroller = timelineScroller(page)
const scroller = timeline.getByRole("region", { name: "scrollable content", exact: true })
await expect(timeline.locator("[data-timeline-virtual-content]")).toBeVisible()
await page.evaluate(() => document.fonts.ready)
await scroller.evaluate((element) => {

View file

@ -233,9 +233,6 @@ for (const binding of ["custom", "none"]) {
await view.editor.press(`${modifier}+Alt+k`)
await expect(newSessionBaseBranch(page)).toHaveText("from main")
await newSessionBaseBranch(page).hover()
await expect(tooltip).toContainText("Choose worktree")
await expect(keys).toHaveText([/X$/, /B$/])
await view.editor.press(`${modifier}+Alt+x`)
const search = page.getByRole("combobox", { name: "Search worktrees", exact: true })
@ -446,20 +443,11 @@ test("the checkout branch opens the current project's worktree step", async ({ p
await expect(local).toHaveText("dev")
await local.click()
await expect(search).toBeFocused()
await expect(dialog.getByRole("group", { name: "Run session in", exact: true })).toBeVisible()
await expect(back).toHaveText("Run session in")
await expect(options.locator(".command-palette-title")).toHaveText(["Custom project", "New worktree", "quiet-river"])
await search.press("ArrowDown")
await expect(create).toHaveAttribute("data-active")
await expect(selected).toHaveAccessibleName(main)
// "Run session in" is the list's heading, not a Tab stop, and neither are the rows the search field names.
await search.press("Tab")
await expect(dialog.getByText("Run session in", { exact: true })).not.toBeFocused()
await expect(dialog.locator('[role="option"]:focus')).toHaveCount(0)
// The back arrow in the search field is, and it shows the ring.
await search.focus()
await search.press("Shift+Tab")
await expect(back).toBeFocused()
await expect(back).toHaveCSS("outline-style", "solid")
// Stepping back lands on the projects step with the drilled project active, as after drilling in with →.
await back.click()
@ -516,8 +504,8 @@ test("the branch shortcut chooses a base branch and stays inactive on the main c
await expect(base).toHaveAccessibleName("Choose base branch")
await base.hover()
await expect(page.getByRole("tooltip")).toContainText(/Choose worktree.*Choose base branch/)
await expect(page.getByRole("tooltip").locator('[data-component="keybind-v2"]')).toHaveText([/O$/, /B$/])
await expect(page.getByRole("tooltip")).toContainText("Choose base branch")
await expect(page.getByRole("tooltip").locator('[data-component="keybind-v2"]')).toContainText("B")
await expect(view.editor).toBeFocused()
await view.editor.press(shortcut)
await expect(search).toBeFocused()
@ -1321,7 +1309,7 @@ test("the location dialog separates added projects from server projects and tags
const rows = options.filter({ has: page.locator(".new-session-location-name") })
const names = options.locator(".new-session-location-name")
const paths = options.locator(".command-palette-description")
const heading = dialog.getByText("Run session in", { exact: true })
const back = dialog.locator(".new-session-location-back")
const arrow = dialog.locator(".new-session-location-search-back")
const leading = dialog.locator("[data-slot='text-input-v2-leading-icon']")
const input = dialog.locator("[data-slot='text-input-v2-input']")
@ -1370,7 +1358,7 @@ test("the location dialog separates added projects from server projects and tags
const inputBox = await input.boundingBox()
await others.click()
await expect(names).toHaveText(["console", "sstapollo"])
await expect(heading).toHaveCount(0)
await expect(back).toHaveCount(0)
await expect(arrow).toBeVisible()
await expect(search).toHaveAttribute("placeholder", "Search other projects")
expect(await leading.boundingBox()).toEqual(leadingBox)
@ -1405,8 +1393,7 @@ test("the location dialog separates added projects from server projects and tags
await page.keyboard.press("ArrowRight")
// The worktree step has no "Add project".
await expect(add).toHaveCount(0)
await expect(heading).toBeVisible()
await expect(arrow).toBeVisible()
await expect(back).toHaveText("Run session in")
await expect(options.nth(0).locator('[data-component="tag"]')).toHaveText("apollo")
await expect(dialog.getByRole("option", { selected: true })).toHaveCount(0)
await search.fill("apollo-release")
@ -1424,11 +1411,11 @@ test("the location dialog separates added projects from server projects and tags
const open = (await page.evaluate(() => navigator.platform.includes("Mac"))) ? "Meta+o" : "Control+o"
await search.fill("open")
await page.keyboard.press(open)
await expect(heading).toHaveCount(0)
await expect(back).toHaveCount(0)
await expect(search).toHaveAttribute("placeholder", "Search servers")
await expect(search).toHaveValue("")
await page.keyboard.press("Escape")
await expect(heading).toBeVisible()
await expect(back).toHaveText("Run session in")
await expect(search).toHaveValue("open")
await expect(options.locator(".command-palette-title")).toHaveText(["opencode", "New worktree", "opencode-beta"])
await expect(options.nth(0)).toHaveAttribute("data-active")
@ -1444,7 +1431,7 @@ test("the location dialog separates added projects from server projects and tags
await page.keyboard.press("ArrowUp")
await expect(options.nth(3)).toHaveAttribute("aria-selected", "true")
await page.keyboard.press(open)
await expect(heading).toHaveCount(0)
await expect(back).toHaveCount(0)
// The server the app runs beside shows its hostname and "This computer" instead of its address.
await expect(options).toHaveText(["hailmaryThis computer", "apollo"])
await search.press("Escape")

View file

@ -261,60 +261,3 @@ for (const scenario of scenarios) {
})
}
}
// The header rests 6px above its group's top in both timelines.
for (const newTimeline of [false, true]) {
test(`collapsing a group from its stuck header leaves the header where it was (${newTimeline ? "New" : "current"} timeline)`, async ({
page,
}) => {
await setupTimeline(page, {
messages: [
userMessage(),
assistantMessage([
...Array.from({ length: 80 }, (_, index) =>
toolPart(
`prt_stuck_shell_${String(index).padStart(2, "0")}`,
"shell",
"completed",
{ command: `echo ${index}` },
{ output: "ok" },
),
),
textPart("prt_after_group", "Following explanation.\n\n".repeat(60)),
]),
],
settings: { timelineDetail: timelinePresets[2].value, newTimeline },
reducedMotion: true,
viewport: { width: 1400, height: 900 },
})
const scroller = page.locator('[data-slot="session-timeline-scroll"] .scroll-view__viewport')
const group = page.locator('[data-component="collapsed-tool-group"]')
const header = group.locator(':scope > [data-component="collapsible"] > [data-slot="collapsible-trigger"]')
await header.click()
await expect(header).toHaveAttribute("aria-expanded", "true")
// Leave follow-latest mode, then put the group's top above the view so its header sticks.
await scroller.hover()
await page.mouse.wheel(0, -100)
await group.evaluate((element) => {
const viewport = element.closest<HTMLElement>(".scroll-view__viewport")!
viewport.scrollTop += element.getBoundingClientRect().top - viewport.getBoundingClientRect().top + 300
})
await expect
.poll(() =>
header.evaluate(
(element) =>
element.getBoundingClientRect().top -
element.closest('[data-component="collapsed-tool-group"]')!.getBoundingClientRect().top,
),
)
.toBeGreaterThan(200)
const top = () => header.evaluate((element) => element.getBoundingClientRect().top)
const stuck = await top()
await header.click()
await expect(header).toHaveAttribute("aria-expanded", "false")
await expect.poll(top).toBe(stuck)
})
}

View file

@ -37,7 +37,7 @@ test("review toggle shows its tooltip with the side panel open or closed", async
await expect(tooltip).toBeVisible()
})
test("review rings stay visible on the mode trigger and file tree, and none surrounds the diff", async ({ page }) => {
test("review rings stay visible on the mode trigger, file tree, and diff", async ({ page }) => {
await openSession(page, {
name: "ReviewModeFocus",
vcsDiff: [fileDiff("alpha.ts"), fileDiff("beta.ts")],
@ -73,21 +73,10 @@ test("review rings stay visible on the mode trigger and file tree, and none surr
const diff = panel.locator('[data-component="file"][data-mode="diff"]')
// The diff has no ring, so it is not a Tab stop: Tab passes over it in both directions.
await expect(diff).toHaveAttribute("tabindex", "-1")
await mode.focus()
await diff.press("Shift+Tab")
await page.keyboard.press("Tab")
await expect(diff).not.toBeFocused()
await page.keyboard.press("Shift+Tab")
await expect(mode).toBeFocused()
// It still takes focus so the keyboard can scroll and search it, without a ring around the whole viewer. A click on a diff line opens the comment editor, so focus it directly.
await diff.focus()
await expect(diff).toBeFocused()
await page.keyboard.press("ArrowDown")
await expect(diff).toBeFocused()
await expect(diff).toHaveCSS("outline-style", "none")
await expect.poll(() => diff.evaluate((element) => getComputedStyle(element, "::after").outlineStyle)).toBe("none")
await expect.poll(() => diff.evaluate((element) => getComputedStyle(element, "::after").outlineOffset)).toBe("-2px")
})
for (const view of ["desktop", "mobile"] as const) {

View file

@ -3,17 +3,7 @@ import { expect, test, type Page } from "@playwright/test"
import { REMOTE_SERVER, seed, sessionHref } from "../utils/app"
import { fixture, mockStressTimeline } from "../utils/session-fixture"
import { reviewTabs } from "../utils/side-panel"
import {
assistantMessage,
chooseUserMessageAction,
historyMessages,
openUserMessageMenu,
partUpdated,
setupTimeline,
shell,
textPart,
userMessage,
} from "../utils/timeline"
import { chooseUserMessageAction, openUserMessageMenu } from "../utils/timeline"
import { expectSessionTitle } from "../utils/waits"
import { mockRemoteServer, mockWorkspace, openSession } from "../utils/workspace"
@ -228,106 +218,6 @@ test("the web session header leaves window dragging to the browser", async ({ pa
await expect(page.locator('[data-slot="shell-drag-inset"]')).toHaveCount(0)
})
// The header fits its controls again, with a forced layout, whenever one of them is rebuilt.
test("the header keeps its controls while the transcript changes", async ({ page }) => {
const messages = [
...historyMessages(30),
userMessage(),
assistantMessage([textPart("prt_active", "Checking the route")], { completed: false }),
]
const timeline = await setupTimeline(page, {
sessionMessages: messages,
pageMessages: (_, limit, before) => {
const end = before ? messages.findIndex((message) => message.id === before) : messages.length
const start = Math.max(0, end - Math.min(16, limit))
return { items: messages.slice(start, end), cursor: start ? messages[start]!.id : undefined }
},
})
const scroller = page.locator(".scroll-view__viewport", { has: page.locator("[data-timeline-row]") })
const review = page.getByRole("button", { name: "Toggle review", exact: true })
await expect(scroller.getByText("Checking the route", { exact: true })).toBeInViewport()
await expect(review).toBeVisible()
// Every node the header gains or loses from here on. A control that is rendered again is other nodes.
const header = await page.locator("[data-session-title]").evaluateHandle((element) => {
const seen = { nodes: 0 }
new MutationObserver((records) => {
seen.nodes += records.reduce((count, record) => count + record.addedNodes.length + record.removedNodes.length, 0)
}).observe(element, { childList: true, subtree: true })
return seen
})
const commandList = await commandListBuilds(page)
// A running shell enables Move to background, so the command list is built again; the review keybind does not change.
// This is the one build the count must see: it shows that the count below is of the function that builds the list.
await timeline.send(partUpdated(shell("prt_header_shell", "running")))
await expect(scroller.locator('[data-timeline-part-ids*="prt_header_shell"]')).toBeVisible()
expect(await commandList()).toBeGreaterThan(0)
// Each scroll to the top loads an older page, until the first message is in view.
await scroller.hover()
await expect(async () => {
await page.mouse.wheel(0, -100_000)
await expect(scroller.getByText(/^Historical response 0\. /)).toBeInViewport({ timeout: 1_000 })
}).toPass()
// The pages change the transcript and no command. The header's count includes the shell above.
expect({
commandListBuilds: await commandList(),
headerNodes: await header.evaluate((seen) => seen.nodes),
}).toEqual({ commandListBuilds: 0, headerNodes: 0 })
})
// Counts the runs of the function that builds the session's commands, with V8's call counts. That function is the
// smallest one that ran and whose source names both commands below. The first count finds it, so take the first count
// after a change that builds the list.
async function commandListBuilds(page: Page) {
const devtools = await page.context().newCDPSession(page)
const list = { url: "", start: 0, end: 0 }
await devtools.send("Profiler.enable")
await devtools.send("Profiler.startPreciseCoverage", { callCount: true, detailed: false })
return async () => {
const coverage = await devtools.send("Profiler.takePreciseCoverage")
const ran = coverage.result.flatMap((script) =>
script.functions.map((item) => ({ url: script.url, ...item.ranges[0]! })).filter((item) => item.count > 0),
)
if (!list.url) {
// A script that is not a file of the app has no address to read it from.
const sources = new Map(
await Promise.all(
[...new Set(ran.map((item) => item.url))].map(
async (url) => [url, url.startsWith("http") ? await (await page.request.get(url)).text() : ""] as const,
),
),
)
const found = ran
.filter((item) => {
const source = sources.get(item.url)?.slice(item.startOffset, item.endOffset) ?? ""
return source.includes("session.background") && source.includes("session.undo")
})
.sort((a, b) => a.endOffset - a.startOffset - (b.endOffset - b.startOffset))[0]
if (!found) return 0
Object.assign(list, { url: found.url, start: found.startOffset, end: found.endOffset })
}
return ran
.filter((item) => item.url === list.url && item.startOffset === list.start && item.endOffset === list.end)
.reduce((count, item) => count + item.count, 0)
}
}
test.describe("location", () => {
const root = "C:/OpenCode/Location"
const worktree = "C:/OpenCode/Worktrees/location/quiet-falcon"

View file

@ -117,10 +117,10 @@ test("replaces the composer when the location is not found and recovers by movin
const connection = await transport.waitForConnection()
await page.getByRole("button", { name: "Choose worktree", exact: true }).click()
const worktree = page.getByRole("option", { name: `existing-worktree ${destination}`, exact: true })
const worktree = page.getByRole("menuitem", { name: "existing-worktree", exact: true })
await expect(worktree).toBeVisible()
// Reconnecting checks the folder again without remounting the missing view, so the open worktree dialog survives.
// Reconnecting checks the folder again without remounting the missing view, so the open menu survives.
const rechecked = page.waitForResponse(
(response) =>
new URL(response.url()).searchParams.get("location[directory]") === directory && response.status() === 404,
@ -131,7 +131,7 @@ test("replaces the composer when the location is not found and recovers by movin
await rechecked
expect(requests).toBe(2)
await expect(worktree).toBeVisible()
// The open dialog hides the page from role locators.
// The open menu hides the page from role locators.
await expect(page.getByText("Session location unavailable", { exact: true })).toBeVisible()
await worktree.click()

View file

@ -341,41 +341,6 @@ test("a blank Enter leaves the running session alone while Stop still interrupts
expect(mock.prompts).toEqual([])
})
test("stopping before the model answers takes the prompt back, as in the TUI", async ({ page }) => {
const mock = createQueueMock(
[],
[
{ id: "msg_queue_unanswered", type: "user", text: "Reword this prompt", time: { created: 1 } },
{
id: "msg_queue_thinking",
type: "assistant",
agent: "build",
model: { id: "queue-model", providerID: "opencode" },
content: [{ type: "reasoning", text: "Thinking it over" }],
time: { created: 2 },
},
],
)
const view = await openQueue(page, mock)
const requests: string[] = []
page.on("request", (request) => {
const path = new URL(request.url()).pathname
const step = ["/interrupt", "/wait", "/revert/stage", "/revert/commit"].find((suffix) =>
path.endsWith(`/${sessionID}${suffix}`),
)
if (step) requests.push(step)
})
await expect(userRow(page, "msg_queue_unanswered")).toBeVisible()
await view.input.press("Escape")
await expect.poll(() => requests).toEqual(["/interrupt", "/wait", "/revert/stage", "/revert/commit"])
await expect(view.input).toHaveText("Reword this prompt")
})
test.describe("touch keyboard", () => {
test.use({ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true })

View file

@ -171,184 +171,6 @@ test("replies with predefined choices and the edited custom multiselect answer",
expect(cancellations).toEqual([])
})
const includeForm = (id: string) => ({
id,
sessionID,
title: "Questions",
metadata: { kind: "question" },
fields: [
{
key: "q0",
type: "multiselect",
title: "Include",
description: "Which supporting surfaces should remain visible?",
options: [
{ value: "files", label: "Changed files" },
{ value: "terminal", label: "Terminal" },
],
custom: true,
},
],
})
const waitForReply = (page: Page, id: string) =>
page.waitForRequest(
(request) =>
request.method() === "POST" && new URL(request.url()).pathname === `/api/session/${sessionID}/form/${id}/reply`,
)
test.describe("classic question dock", () => {
test("Enter submits a multiselect answer, and Shift+Enter marks answers and breaks custom lines", async ({
page,
}) => {
await mockServer(page, {
forms: [includeForm("frm_question_enter")],
})
await page.goto(sessionHref(sessionID))
await expectSessionTitle(page, title)
const question = page.locator('[data-component="dock-prompt"][data-kind="question"]')
const files = question.getByRole("checkbox", { name: "Changed files", exact: true })
const terminal = question.getByRole("checkbox", { name: "Terminal", exact: true })
const custom = question.getByRole("checkbox", { name: "Type your own answer…", exact: true })
const input = question.getByRole("textbox", { name: "Type your own answer…", exact: true })
const submit = question.getByRole("button", { name: "Submit", exact: true })
await expect(submit).toHaveAttribute("aria-keyshortcuts", "Enter Meta+Enter Control+Enter")
await files.press("Shift+Enter")
await expect(files).toBeChecked()
await terminal.press("Shift+Enter")
await terminal.press("Shift+Enter")
await expect(terminal).not.toBeChecked()
const height = await input.evaluate((el) => el.getBoundingClientRect().height)
await input.click()
await input.pressSequentially("First line")
await input.press("Shift+Enter")
await input.pressSequentially("Second line")
await expect(input).toHaveValue("First line\nSecond line")
await expect(custom).toBeChecked()
expect(await input.evaluate((el) => el.getBoundingClientRect().height)).toBeGreaterThan(height)
const reply = waitForReply(page, "frm_question_enter")
await input.press("Enter")
expect((await reply).postDataJSON()).toEqual({ answer: { q0: ["files", "First line\nSecond line"] } })
})
test("Enter on a highlighted answer submits the answers marked so far", async ({ page }) => {
await mockServer(page, {
forms: [includeForm("frm_question_enter_option")],
})
await page.goto(sessionHref(sessionID))
await expectSessionTitle(page, title)
const question = page.locator('[data-component="dock-prompt"][data-kind="question"]')
const files = question.getByRole("checkbox", { name: "Changed files", exact: true })
const terminal = question.getByRole("checkbox", { name: "Terminal", exact: true })
await terminal.press("Space")
await expect(terminal).toBeChecked()
const reply = waitForReply(page, "frm_question_enter_option")
await files.press("Enter")
expect((await reply).postDataJSON()).toEqual({ answer: { q0: ["terminal"] } })
})
test("Enter on a single-choice answer picks it and submits", async ({ page }) => {
await mockServer(page, {
forms: [
{
id: "frm_question_single_enter",
sessionID,
title: "Questions",
metadata: { kind: "question" },
fields: [
{
key: "q0",
type: "string",
title: "Implementation",
description: "Which implementation should be used?",
options: [
{ value: "minimal", label: "Minimal" },
{ value: "extended", label: "Extended" },
],
custom: true,
},
],
},
],
})
await page.goto(sessionHref(sessionID))
await expectSessionTitle(page, title)
const question = page.locator('[data-component="dock-prompt"][data-kind="question"]')
const reply = waitForReply(page, "frm_question_single_enter")
await question.getByRole("radio", { name: /Extended/ }).press("Enter")
expect((await reply).postDataJSON()).toEqual({ answer: { q0: "extended" } })
})
test("with Cmd/Ctrl+Enter set to submit, Enter marks answers and breaks custom lines", async ({ page }) => {
await mockServer(page, {
forms: [includeForm("frm_question_mod_enter")],
seed: { settings: { general: { questionSubmitKey: "mod+enter" } } },
})
await page.goto(sessionHref(sessionID))
await expectSessionTitle(page, title)
const question = page.locator('[data-component="dock-prompt"][data-kind="question"]')
const files = question.getByRole("checkbox", { name: "Changed files", exact: true })
const input = question.getByRole("textbox", { name: "Type your own answer…", exact: true })
const submit = question.getByRole("button", { name: "Submit", exact: true })
const replies: unknown[] = []
page.on("request", (request) => {
if (
request.method() === "POST" &&
new URL(request.url()).pathname === `/api/session/${sessionID}/form/frm_question_mod_enter/reply`
)
replies.push(request.postDataJSON())
})
await expect(submit).toHaveAttribute("aria-keyshortcuts", "Meta+Enter Control+Enter")
await files.press("Enter")
await expect(files).toBeChecked()
await input.click()
await input.pressSequentially("One")
await input.press("Enter")
await input.pressSequentially("Two")
await expect(input).toHaveValue("One\nTwo")
expect(replies).toEqual([])
const reply = waitForReply(page, "frm_question_mod_enter")
await input.press("Control+Enter")
expect((await reply).postDataJSON()).toEqual({ answer: { q0: ["files", "One\nTwo"] } })
})
test("refits a wrapped custom answer when the dock narrows and widens", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 })
await mockServer(page, {
forms: [includeForm("frm_question_resize")],
})
await page.goto(sessionHref(sessionID))
const input = page.getByRole("textbox", { name: "Type your own answer…", exact: true })
await expect(input).toBeEditable()
await input.fill(
"A wrapping answer with enough text to take several lines when the question dock becomes narrow. ".repeat(3),
)
const wide = await input.evaluate((el) => el.clientHeight)
await page.setViewportSize({ width: 560, height: 1000 })
await expect.poll(() => input.evaluate((el) => el.clientHeight)).toBeGreaterThan(wide)
await expect.poll(() => input.evaluate((el) => el.scrollHeight - el.clientHeight)).toBe(0)
await page.setViewportSize({ width: 1440, height: 1000 })
await expect.poll(() => input.evaluate((el) => el.clientHeight)).toBe(wide)
})
})
test("keeps a choice when a custom answer with its value is turned off, and replies once", async ({ page }) => {
const form = {
id: "frm_question_once",
@ -446,7 +268,6 @@ test("shows a pending permission dock", async ({ page }) => {
const permission = page.locator('[data-component="dock-prompt"][data-kind="permission"]')
await expect(permission).toBeVisible()
await expect(permission.getByText("Run shell commands", { exact: true })).toBeVisible()
await expect(permission.getByText("git status")).toBeVisible()
await expect(permission.getByText("git diff")).toBeVisible()
await expect(permission.locator('[data-slot="permission-footer-actions"] button')).toHaveCount(3)
@ -893,9 +714,6 @@ test("restores the draft caret before typing after a request dock closes", async
await expect(editor).toHaveText(`${draft.slice(0, cursor)}x${draft.slice(cursor)}`)
})
function mockServer(
page: Page,
requests: Pick<WorkspaceInput, "sessionPermissions" | "onPermissionReply" | "forms" | "seed">,
) {
function mockServer(page: Page, requests: Pick<WorkspaceInput, "sessionPermissions" | "onPermissionReply" | "forms">) {
return mockWorkspace(page, { name: "RequestDocks", directory, sessions: [{ id: sessionID, title }], ...requests })
}

View file

@ -1,4 +1,4 @@
import { expect, test, type Locator } from "@playwright/test"
import { expect, test } from "@playwright/test"
import {
assistantMessage,
renderedPartID,
@ -46,46 +46,6 @@ test("space activates a focused timeline button instead of scrolling", async ({
expect(await scroller.evaluate((element) => element.scrollTop)).toBe(before)
})
test("Tab moves between timeline controls without stopping on the timeline itself", async ({ page }) => {
await setupTimeline(page, {
messages: [userMessage(), assistantMessage([textPart("prt_tab_stop_text", "Long response. ".repeat(600))])],
seedHistory: true,
})
const scroller = page.locator(".scroll-view__viewport", { has: page.locator("[data-timeline-row]") })
const first = scroller.getByRole("button", { name: "More actions", exact: true })
await expect.poll(() => scroller.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(true)
await expect(scroller).toHaveAttribute("tabindex", "-1")
await first.press("Shift+Tab")
await expect(scroller).not.toBeFocused()
})
test("a focused control that scrolls out of the mounted rows leaves the timeline where it was scrolled", async ({
page,
}) => {
await setupTimeline(page, {
messages: [
userMessage(),
assistantMessage([
shell("prt_focus_unmount_shell", "completed", lines(5)),
textPart("prt_focus_unmount_text", "Latest response."),
]),
],
settings: { shellToolPartsExpanded: false },
seedHistory: true,
})
const scroller = page.locator(".scroll-view__viewport", { has: page.locator("[data-timeline-row]") })
const trigger = page.getByRole("button", { name: "Used 1 Shell", exact: true })
await trigger.focus()
await expect(trigger).toBeFocused()
await scroller.hover()
await page.mouse.wheel(0, -100_000)
// The row left the mounted range, and its control went with it.
await expect(trigger).toHaveCount(0)
// The timeline keeps focus for the scroll keys. No control in another row takes it and scrolls the timeline to itself.
await expect(scroller).toBeFocused()
expect(await scroller.evaluate((element) => element.scrollTop)).toBe(0)
})
test("jump to latest is reachable only while it is shown", async ({ page }) => {
await setupTimeline(page, {
messages: [userMessage(), assistantMessage([textPart("prt_jump_latest_text", "Latest response.")])],
@ -118,73 +78,6 @@ test("jump to latest is reachable only while it is shown", async ({ page }) => {
await expect(page.getByRole("textbox", { name: "Prompt", exact: true })).toBeFocused()
})
// A working turn shows controls the reader can use, such as a tool header and a link in a reply. The keyboard stops
// on each one where the reader can see it, and none is hidden from a screen reader.
for (const newTimeline of [false, true]) {
test(`every Tab stop of a working turn can be seen and read (${newTimeline ? "New" : "current"} timeline)`, async ({
page,
}) => {
await setupTimeline(page, {
messages: [
userMessage(),
assistantMessage(
[
shell("prt_working_stop_shell", "completed", lines(5)),
textPart("prt_working_stop_text", "See [the notes](https://example.com/notes) while this runs."),
],
{ completed: false },
),
],
settings: { newTimeline, shellToolPartsExpanded: false },
})
await expect(page.getByRole("button", { name: "Stop" })).toBeVisible()
await expect(page.getByText("while this runs.")).toBeVisible()
// The timeline's stops in the order the key reaches them, from the control it starts on to the first stop outside.
const walk = async (key: "Tab" | "Shift+Tab", from: Locator) => {
await from.focus()
const stops: { name: string; tool: boolean; hidden: boolean; shown: boolean }[] = []
for (let press = 0; press < 20; press++) {
await page.keyboard.press(key)
const stop = await page.evaluate(() => {
const element = document.activeElement
if (!(element instanceof HTMLElement) || !element.closest("[data-timeline-row]")) return undefined
const box = element.getBoundingClientRect()
return {
name: (element.getAttribute("aria-label") ?? element.textContent ?? "").trim().replace(/\s+/g, " "),
tool: element.matches("button[aria-expanded]"),
hidden: element.closest('[aria-hidden="true"]') !== null,
shown:
element.checkVisibility({ opacityProperty: true, visibilityProperty: true }) &&
box.bottom > 0 &&
box.top < innerHeight,
}
})
if (stop) stops.push(stop)
if (!stop && stops.length > 0) break
}
return stops
}
const forward = await walk("Tab", page.getByRole("button", { name: "More actions", exact: true }))
const back = await walk("Shift+Tab", page.getByRole("textbox", { name: "Prompt", exact: true }))
for (const stops of [forward, back]) {
expect(stops.filter((stop) => stop.hidden || !stop.shown)).toEqual([])
// The walk passed the turn's tool header and its link.
expect(stops.some((stop) => stop.tool)).toBe(true)
expect(stops.map((stop) => stop.name)).toContain("the notes")
}
})
}
function lines(count: number) {
return Array.from({ length: count }, (_, index) => `line ${index + 1}`).join("\n")
}

View file

@ -6,7 +6,6 @@ import { mockRemoteServer, mockWorkspace, openSession, openSettings, type Worksp
import { CONSOLE_URL, consoleGateway, consoleSignIn } from "../utils/console"
import { recordNotifications } from "../utils/notifications"
import { installSseTransport } from "../utils/sse-transport"
import { APP_READY_TIMEOUT } from "../utils/waits"
import { dict as ar } from "../../src/runtime/i18n/ar"
import { dict as en } from "../../src/runtime/i18n/en"
@ -1138,18 +1137,6 @@ test("single extension rows stay aligned when switching tabs", async ({ page })
}
})
test("a settings page takes focus from a click on its text without a ring around the whole page", async ({ page }) => {
const { settings } = await open(page)
const panel = settings.getByRole("tabpanel").filter({ has: page.getByRole("heading", { name: "Preferences" }) })
await panel.getByRole("heading", { name: "Preferences", exact: true }).click()
// Chromium matches :focus-visible on the focused page once a key is pressed; the controls inside show focus instead.
await page.keyboard.press("ArrowDown")
await expect(panel).toBeFocused()
await expect(panel).toHaveCSS("outline-style", "none")
})
test.describe("pages open before slow data", () => {
test("worktrees", async ({ page }) => {
const { settings } = await open(page)
@ -2771,36 +2758,6 @@ test("the Side tabs interface mode switches to vertical tabs and survives reload
await expect(page.locator('[data-slot="titlebar-tabs"]')).toHaveCount(0)
})
test("settings lines its sidebar and content up with Home's columns", async ({ page }) => {
await mockWorkspace(page, { name: "SettingsAlign", sessions: [] })
await page.goto("/")
const entry = page
.getByRole("complementary", { name: "Projects" })
.getByRole("button", { name: "Settings", exact: true })
await expect(entry).toBeVisible()
const field = await page.locator('[data-slot="home-session-search-field"]').boundingBox()
const item = await entry.boundingBox()
await entry.click()
const settings = page.getByTestId("settings-screen")
await expect(settings).toBeFocused({ timeout: APP_READY_TIMEOUT })
const tab = await settings.getByRole("tab", { name: "Preferences", exact: true }).boundingBox()
// The panel keeps 4px on each side for card shadows; its content box is what lines up with the search field.
const content = await settings.locator(".settings-content > .settings-panel:visible").evaluate((panel) => {
const box = panel.getBoundingClientRect()
const style = getComputedStyle(panel)
const start = parseFloat(style.paddingLeft)
return { x: box.x + start, width: box.width - start - parseFloat(style.paddingRight) }
})
expect({ x: tab?.x, width: tab?.width }).toEqual({ x: item?.x, width: item?.width })
expect(content).toEqual({ x: field?.x, width: field?.width })
})
for (const viewport of [
{ name: "desktop", width: 1280, height: 720, bottom: false },
{ name: "mobile", width: 390, height: 844, bottom: true },

View file

@ -275,74 +275,6 @@ test("tabs in a narrow side strip shrink to keep their close buttons, and a tab'
await expect(side.getByRole("tab", { name: "a.md", exact: true })).toHaveCount(0)
})
test("closing side tabs with the mouse keeps the next close button under the pointer until it leaves the strip", async ({
page,
}) => {
// Wide enough for every tab, narrow enough that they shrink below their titles.
await page.setViewportSize({ width: 1600, height: 700 })
const directory = "C:/OpenCode/CloseWidths"
const key = `local\u0000${base64Encode(directory)}/ses_closewidths`
// A short tab before the last one keeps its own width while the long ones fill the strip.
const files = [...Array.from({ length: 6 }, (_, index) => `notes-file-${index}.md`), "b.md", "notes-file-7.md"]
await openSession(page, {
name: "CloseWidths",
fileList: () => [],
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
seed: {
panes: { ses_closewidths: { review: true, sessionWidth: 640 } },
storage: {
"opencode.global.dat:layout": {
sessionTabs: { [key]: { all: files.map((file) => `file://${file}`), active: `file://${files[0]}` } },
},
},
},
})
const side = page.locator('[data-pane-content="side"]')
const tabs = side.locator('[data-pane-strip="side"] [data-pane-tab]')
const close = (file: string) =>
side.locator(`[data-pane-tab="file://${file}"] [data-slot="tabs-trigger-close-button"]`)
const center = async (file: string) => {
const box = (await close(file).boundingBox())!
return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
}
const under = (point: { x: number; y: number }) =>
page.evaluate(
(point) =>
document
.elementFromPoint(point.x, point.y)
?.closest('[data-slot="tabs-trigger-close-button"]')
?.closest<HTMLElement>("[data-pane-tab]")?.dataset.paneTab,
point,
)
await expect(tabs).toHaveCount(files.length)
await expect(side.getByRole("tab", { name: files[0], exact: true })).toHaveAttribute("aria-selected", "true")
await page.evaluate(() => document.fonts.ready.then(() => undefined))
const width = (await tabs.nth(1).boundingBox())!.width
// The next tab slides under the pointer at its old width.
const middle = await center(files[2])
await page.mouse.click(middle.x, middle.y)
await expect(tabs).toHaveCount(files.length - 1)
await expect.poll(() => under(middle)).toBe(`file://${files[3]}`)
// Closing the last tab brings the one before it under the pointer.
const last = await center(files[7])
await page.mouse.click(last.x, last.y)
await expect(tabs).toHaveCount(files.length - 2)
await expect.poll(() => under(last)).toBe("file://b.md")
// Once the pointer leaves the strip, the tabs fill it again.
await page.mouse.move(middle.x, middle.y + 200)
await expect.poll(async () => (await tabs.nth(1).boundingBox())!.width).toBeGreaterThan(width + 1)
})
test("a reopened side tab returns to where it closed", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 })
const directory = "C:/OpenCode/ReopenPlace"

View file

@ -4,10 +4,8 @@ import { expect, test, type Locator, type Page } from "@playwright/test"
import { expectPath, SERVER, sessionHref } from "../utils/app"
import { currentSession } from "../utils/mock-server"
import { assistantMessage, session, sessionID, setupTimeline, textPart, userMessage } from "../utils/timeline"
import { storedStrips } from "../utils/side-panel"
import { expectSessionTitle } from "../utils/waits"
import { mockWorkspace, type WorkspaceInput } from "../utils/workspace"
import { base64Encode } from "@opencode/util/encode"
import { mockWorkspace } from "../utils/workspace"
const directory = "C:/OpenCode/SubagentNavigation"
@ -80,52 +78,6 @@ test("keeps the parent title anchored when opening a subagent", async ({ page })
}
})
test("shows the parent session's side panel tabs in a subagent", async ({ page }) => {
const parentStrip = `local\u0000${base64Encode(directory)}/${parentID}`
await setup(page, undefined, 0, {
fileList: () => [],
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
seed: {
tabs: [parentID],
panes: { [parentID]: { review: true } },
storage: {
"opencode.global.dat:layout": {
sessionTabs: {
[parentStrip]: { all: ["file://README.md", "file://notes.md"], active: "file://notes.md" },
},
},
},
},
})
const side = page.locator('[data-pane-content="side"]')
const strip = side.getByRole("tab")
const expectParentStrip = async () => {
await expect(strip).toHaveText(["README.md", "notes.md"])
await expect(side.getByRole("tab", { name: "notes.md", exact: true })).toHaveAttribute("aria-selected", "true")
}
await page.goto(sessionHref(parentID))
await expectSessionTitle(page, parentTitle)
await expectParentStrip()
await page.locator(`a[href="${sessionHref(childID)}"]`).click()
await expectSessionTitle(page, taskDescription)
await expectParentStrip()
// A tab picked in the subagent is the parent's too.
await side.getByRole("tab", { name: "README.md", exact: true }).click()
await expect(side.getByRole("tab", { name: "README.md", exact: true })).toHaveAttribute("aria-selected", "true")
await page.locator('[data-slot="session-title-parent"]').click()
await expectSessionTitle(page, parentTitle)
await expect(side.getByRole("tab", { name: "README.md", exact: true })).toHaveAttribute("aria-selected", "true")
await expect(strip).toHaveText(["README.md", "notes.md"])
expect(await storedStrips(page)).toEqual([parentStrip])
})
test("navigates from a running subagent card without a background control", async ({ page }) => {
const runningChildID = "ses_running_child"
await setupTimeline(page, {
@ -423,12 +375,7 @@ test.describe("session ID links", () => {
})
})
async function setup(
page: Page,
events?: () => OpenCodeEvent[],
nestedDepth: 0 | 1 | 2 = 0,
input: Partial<WorkspaceInput> = {},
) {
async function setup(page: Page, events?: () => OpenCodeEvent[], nestedDepth: 0 | 1 | 2 = 0) {
await mockWorkspace(page, {
name: "SubagentNavigation",
sessions: [
@ -445,7 +392,6 @@ async function setup(
events,
eventRetry: events ? 16 : undefined,
seed: { tabs: [parentID] },
...input,
})
// The child session resolves by ID but is absent from the session list,
// matching a subagent session that has not been loaded into the list cache yet.

View file

@ -334,7 +334,6 @@ for (const [tabLayout, direction, label] of [
await tabB.click({ button: "right" })
await expect(menu.getByRole("menuitem")).toHaveText([
"Rename",
"Copy",
"Export…",
"Close tab",
"Close other tabs",
@ -497,73 +496,6 @@ test("⌘⇧S archives the open session and moves to the next tab", async ({ pag
await expect(page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(b.id)}"])`)).toBeVisible()
})
test("⌘⇧S toggles archive on the open session, and Unarchive session has its own command", async ({ page }) => {
const archived = { ...a, time: { created: Date.now(), archived: Date.now() } }
const workspace = await mockWorkspace(page, {
name: "UnarchiveShortcut",
sessions: [archived, b],
seed: { tabs: [a.id, b.id] },
})
await page.goto(sessionHref(a.id))
await expectSessionTitle(page, a.title)
const update = () =>
page.waitForRequest(
(request) => request.method() === "PATCH" && new URL(request.url()).pathname === `/api/session/${a.id}`,
)
// The mock doesn't announce updates, so send the server's event once the request lands.
const unarchived = () =>
workspace.push([
{
id: "evt_unarchived",
type: "session.unarchived",
created: Date.now(),
location: { directory: workspace.directory },
durable: { aggregateID: a.id, seq: 1, version: 1 },
data: { sessionID: a.id },
} satisfies Extract<OpenCodeEvent, { type: "session.unarchived" }>,
])
const prompt = page.getByRole("textbox", { name: "Prompt", exact: true })
// ⌘⇧S on an archived session unarchives it and keeps it open.
const shortcut = update()
await prompt.click()
await page.keyboard.press("ControlOrMeta+Shift+s")
expect((await shortcut).postDataJSON()).toMatchObject({ archived: false })
await expectPath(page, sessionHref(a.id))
unarchived()
// Unarchived now, so the same shortcut archives it, and Unarchive session is no longer offered.
await prompt.click()
await page.keyboard.press("ControlOrMeta+Shift+p")
const dialog = page.getByRole("dialog")
await dialog.getByRole("combobox").fill("archive session")
await expect(dialog.getByRole("option", { name: /^Archive session/ })).toBeVisible()
await expect(dialog.getByRole("option", { name: /^Unarchive session/ })).toHaveCount(0)
await page.keyboard.press("Escape")
const archive = update()
await prompt.click()
await page.keyboard.press("ControlOrMeta+Shift+s")
expect((await archive).postDataJSON()).toMatchObject({ archived: true })
await expectPath(page, sessionHref(b.id))
// From the palette on an archived session.
await page.goto(sessionHref(a.id))
await expectSessionTitle(page, a.title)
await prompt.click()
await page.keyboard.press("ControlOrMeta+Shift+p")
await dialog.getByRole("combobox").fill("unarchive session")
const command = update()
await dialog.getByRole("option", { name: /^Unarchive session/ }).click()
expect((await command).postDataJSON()).toMatchObject({ archived: false })
await expectPath(page, sessionHref(a.id))
})
test("option arrows move to the previous or next tab, and with shift to the next unread one", async ({ page }) => {
await mockWorkspace(page, {
name: "Tabs",
@ -787,9 +719,8 @@ test("an unread tab whose run failed shows the failed dot, as the inbox does", a
await tab(c.id).locator("[data-titlebar-tab-link]").click({ button: "right" })
await expect(page.getByRole("menu").getByRole("menuitem")).toHaveText([
"Rename",
"Mark as unread",
"Copy",
"Export…",
"Mark as unread",
"Close tab",
"Close other tabs",
"Close tabs to the right",
@ -815,32 +746,6 @@ test("an unread tab whose run failed shows the failed dot, as the inbox does", a
await expect(tab(c.id).locator('[data-mark="unread"]')).toBeHidden()
})
test("the tab menu copies the session ID, title and project ID", async ({ page, context }) => {
await context.grantPermissions(["clipboard-read", "clipboard-write"])
const workspace = await mockWorkspace(page, { name: "CopyTabs", sessions: [a, b] })
await page.goto(sessionHref(a.id))
const link = page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(b.id)}"]) [data-titlebar-tab-link]`)
const copy = async (item: string) => {
await link.click({ button: "right" })
await page.getByRole("menuitem", { name: "Copy", exact: true }).hover()
await page.getByRole("menu").last().getByRole("menuitem", { name: item, exact: true }).click()
await expect(page.getByRole("menu")).toHaveCount(0)
}
const clipboard = () => page.evaluate(() => navigator.clipboard.readText())
await copy("Session ID")
await expect.poll(clipboard).toBe(b.id)
await copy("Session title")
await expect.poll(clipboard).toBe(b.title)
await copy("Project ID")
await expect.poll(clipboard).toBe(workspace.projectID)
})
test("Recent and Pinned rows show the side tabs' status dots and shortcuts for sessions that aren't open as tabs", async ({
page,
}) => {
@ -1123,19 +1028,17 @@ test("vertical tabs resize, scroll, show shortcut hints, and navigate", async ({
expect(gutter.x + gutter.width).toBe(chat.x)
const actions = await Promise.all(
["vertical-tabs-home", "vertical-tabs-search", "vertical-tabs-automations", "vertical-tabs-new-session"].map(
async (action) => {
const box = await sidebar.locator(`[data-action="${action}"]`).boundingBox()
["vertical-tabs-home", "vertical-tabs-search", "vertical-tabs-new-session"].map(async (action) => {
const box = await sidebar.locator(`[data-action="${action}"]`).boundingBox()
if (!box) throw new Error(`${action} is not rendered`)
if (!box) throw new Error(`${action} is not rendered`)
return box
},
),
return box
}),
)
const gaps = actions.slice(1).map((box, index) => box.y - (actions[index].y + actions[index].height))
expect(gaps).toEqual([3, 3, 3])
expect(gaps).toEqual([3, 3])
const handle = sidebar.locator('[data-component="resize-handle"]')
@ -2142,33 +2045,6 @@ test("the Windows menu shares the vertical sidebar's icon lane", async ({ page }
await expect.poll(async () => [(await menu.boundingBox())?.x, (await home.boundingBox())?.x]).toEqual([19, 19])
})
// #65864: Linux hides the top titlebar in vertical tabs and Inbox, so the app menu moves into the sidebar header.
test("the Linux app menu renders in the vertical sidebar header without duplicating", async ({ page }) => {
await mockWorkspace(page, {
name: "LinuxMenu",
sessions: [],
seed: { settings: { appearance: { tabLayout: "inbox" } } },
})
await page.goto(`/e2e/utils/windows-menu.html?${new URLSearchParams({ server: SERVER, os: "linux" })}`)
const button = page
.locator('[data-slot="sidebar-header"]')
.getByRole("button", { name: "OpenCode menu", exact: true })
const home = page.locator('[data-action="vertical-tabs-home"] svg')
await expect(home).toBeVisible()
await expect(button).toBeVisible()
await expect(page.locator('[data-component="desktop-icon-button"]')).toHaveCount(1)
await expect
.poll(async () => [(await button.locator("svg").boundingBox())?.x, (await home.boundingBox())?.x])
.toEqual([19, 19])
await button.click()
await page.getByRole("menuitem", { name: "File", exact: true }).click()
await page.getByRole("menuitem", { name: /^Settings/ }).click()
await expect(page.getByRole("heading", { name: "General" })).toBeVisible()
})
for (const row of [
{ name: "left tabs", width: 1280, settings: { appearance: { tabLayout: "vertical" } }, position: { x: 20, y: 25 } },
{ name: "top tabs", width: 1280, settings: { appearance: { tabLayout: "horizontal" } }, position: { x: 14, y: 15 } },
@ -2403,7 +2279,6 @@ test("opening a session from the inbox keeps the list's scroll position and rows
const target = items.filter({ hasText: "Inbox session 14" })
await expect(items).toHaveCount(10)
await expect(items).toContainText(Array.from({ length: 10 }, (_, index) => `Inbox session ${23 - index}`))
await expect(list.getByRole("group", { name: "Recent", exact: true })).toBeVisible()
await expect(list.getByText("Recent", { exact: true })).toBeVisible()
await list.evaluate((element) => element.scrollTo(0, element.scrollHeight))
await expect(target).toBeInViewport({ ratio: 1 })
@ -2423,46 +2298,6 @@ test("opening a session from the inbox keeps the list's scroll position and rows
expect(await list.evaluate((element) => element.scrollTop)).toBe(offset)
})
test("the inbox opens sessions without tabs and ignores the tab shortcuts", async ({ page }) => {
const prompts: string[] = []
await mockWorkspace(page, {
name: "InboxNoTabs",
sessions: [a, b],
seed: { settings: { appearance: { tabLayout: "inbox" } }, tabs: [] },
onPrompt: (input) => void prompts.push(input.sessionID),
})
await page.goto("/")
const rows = page.locator('[data-slot="sidebar-inbox"] [data-slot="sidebar-inbox-item"]')
const editor = page.locator('[data-component="composer-editor"]')
const storedTabs = async () =>
JSON.parse((await page.evaluate(() => localStorage.getItem("opencode.window.browser.dat:tabs"))) ?? "[]")
await rows.filter({ hasText: a.title }).click()
await expectPath(page, sessionHref(a.id))
await rows.filter({ hasText: b.title }).click()
await expectPath(page, sessionHref(b.id))
await expect(editor).toBeEditable()
// ⌘W, ⌥⌘W and ⇧⌘T act on tabs, which the inbox doesn't have.
await page.keyboard.press("ControlOrMeta+w")
await page.keyboard.press("ControlOrMeta+Alt+w")
await page.keyboard.press("ControlOrMeta+Shift+t")
await expectPath(page, sessionHref(b.id))
await expect(rows.filter({ hasText: b.title })).toHaveAttribute("data-state", "active")
await expect.poll(storedTabs).toEqual([])
// Sending from a session with no tab still works, and opens none.
await editor.fill("Hello from the inbox")
await editor.press("Enter")
await expect.poll(() => prompts).toEqual([b.id])
await expect(page.locator('[data-timeline-row="UserMessage"]')).toContainText("Hello from the inbox")
await expect.poll(storedTabs).toEqual([])
})
test("renaming an inbox card updates the same session on Home", async ({ page }) => {
await mockWorkspace(page, {
name: "RenameInbox",
@ -2496,70 +2331,18 @@ test("renaming an inbox card updates the same session on Home", async ({ page })
await expect(home).toContainText("Renamed inbox title")
})
test("archiving the open inbox session opens the row below it, not the next tab", async ({ page }) => {
const sessions = ["First", "Second", "Third", "Fourth"].map((name, index) => ({
id: `ses_inbox_next_${index}`,
title: `${name} inbox row`,
time: { created: T0, updated: T0, idle: T0 - index, viewed: T0 + 100 },
}))
const [first, second, third, fourth] = sessions
// The tab order differs from the inbox's, so the tab next to each archived session is another row.
await mockWorkspace(page, {
name: "ArchiveInboxNext",
sessions,
seed: {
settings: { appearance: { tabLayout: "inbox" } },
tabs: [second.id, fourth.id, first.id, third.id],
},
})
await page.goto(sessionHref(second.id))
await expectSessionTitle(page, second.title)
const items = page.locator('[data-slot="sidebar-inbox"] [data-slot="sidebar-inbox-item"]')
const row = (session: { title: string }) => items.filter({ hasText: session.title })
await expect(items).toContainText(sessions.map((session) => session.title))
await expect(row(second)).toHaveAttribute("data-state", "active")
await row(second).click({ button: "right" })
await page.getByRole("menuitem", { name: "Archive", exact: true }).click()
await expectPath(page, sessionHref(third.id))
await expect(row(third)).toHaveAttribute("data-state", "active")
await expect(items).toContainText([first, third, fourth].map((session) => session.title))
await page.getByRole("textbox", { name: "Prompt", exact: true }).click()
await page.keyboard.press("ControlOrMeta+Shift+s")
await expectPath(page, sessionHref(fourth.id))
await expect(row(fourth)).toHaveAttribute("data-state", "active")
await expect(items).toContainText([first, fourth].map((session) => session.title))
await expect(page.getByRole("heading", { name: fourth.title, exact: true })).toBeVisible()
// The last row has nothing below it, so the row above opens.
await page.getByRole("textbox", { name: "Prompt", exact: true }).click()
await page.keyboard.press("ControlOrMeta+Shift+s")
await expectPath(page, sessionHref(first.id))
await expect(row(first)).toHaveAttribute("data-state", "active")
})
test("the inbox lists archived sessions in a collapsed section and pins sessions at the top of Recent", async ({ page }) => {
test("the inbox Archived dialog searches only archived sessions and restores the selected session", async ({
page,
}) => {
await page.clock.install({ time: T0 + 41 * 60_000 })
await mockWorkspace(page, {
name: "ArchivedInbox",
sessions: [
{ id: "ses_archive_active", title: "Active inbox session", time: { created: T0, updated: T0, idle: T0 } },
{
id: "ses_archive_older",
title: "Older inbox session",
time: { created: T0 - 200, updated: T0 - 200, idle: T0 - 200 },
},
...["First archived session", "Second archived session"].map((title, index) => ({
id: `ses_archive_${index}`,
title,
time: { created: T0 - 100, updated: T0 + index, idle: T0 - 100, archived: T0 + 10 + index },
time: { created: T0 - 100, updated: T0 + index, idle: index ? T0 - 100 : T0, archived: T0 + 10 },
})),
],
seed: {
@ -2576,322 +2359,43 @@ test("the inbox lists archived sessions in a collapsed section and pins sessions
const rows = inbox.locator('[data-slot="sidebar-inbox-item"]')
await expect(rows).toHaveText([/Active inbox session/, /Older inbox session/])
await expect(archived).toHaveAttribute("aria-expanded", "false")
await archived.click()
await expect(archived).toHaveAttribute("aria-expanded", "true")
await expect(rows).toHaveText([
/Active inbox session/,
/Older inbox session/,
/Second archived session/,
/First archived session/,
])
await rows.filter({ hasText: "Older inbox session" }).click({ button: "right" })
await expect(page.getByRole("menu").getByRole("menuitem")).toHaveText([
"Rename",
"Pin",
"Mark as read",
"Copy",
"Export…",
"Archive",
"Delete…",
])
// One separator before Copy and Export, and one before Archive and Delete.
await expect(page.getByRole("menu").getByRole("separator")).toHaveCount(2)
await page.getByRole("menuitem", { name: "Pin", exact: true }).click()
const recent = inbox.getByRole("group", { name: "Recent", exact: true }).locator('[data-slot="sidebar-inbox-item"]')
const pinIcon = 'use[href="#opencode-v2-icon-pin"]'
const pin = inbox.locator(pinIcon)
await expect(recent).toHaveText([/Older inbox session/, /Active inbox session/])
await expect(recent.filter({ hasText: "Older inbox session" }).locator(pinIcon)).toHaveCount(1)
await expect(pin).toHaveCount(1)
await expect(rows).toHaveText([
/Older inbox session/,
/Active inbox session/,
/Second archived session/,
/First archived session/,
])
await rows.filter({ hasText: "Older inbox session" }).click({ button: "right" })
await page.getByRole("menuitem", { name: "Unpin", exact: true }).click()
await expect(pin).toHaveCount(0)
await expect(recent).toHaveText([/Active inbox session/, /Older inbox session/])
})
test("an archived session that asks a question joins Needs attention and goes back to Archived once answered", async ({
page,
}) => {
await page.clock.install({ time: T0 + 10 * 60_000 })
const workspace = await mockWorkspace(page, {
name: "ArchivedQuestion",
sessions: [
{ id: "ses_asking_read", title: "Read inbox session", time: { created: T0, updated: T0, idle: T0, viewed: T0 } },
{
id: "ses_asking_archived",
title: "Clean email inbox",
time: { created: T0, updated: T0 + 1, busy: T0 + 60_000, archived: T0 + 10 },
},
],
sessionStatus: { ses_asking_archived: { type: "running" } },
seed: {
settings: { appearance: { tabLayout: "inbox" } },
tabs: [],
storage: { "opencode.global.dat:sidebar.inbox": { workingExpanded: true } },
},
})
await page.goto("/")
const inbox = page.locator('[data-slot="sidebar-inbox"]')
const list = inbox.locator('[data-slot="sidebar-inbox-scroll"]')
const needs = inbox
.getByRole("group", { name: "Needs attention", exact: true })
.locator('[data-slot="sidebar-inbox-item"]')
const archived = inbox.getByRole("button", { name: "Archived", exact: true })
await expect(list.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([/Read inbox session/])
await expect(rows).toHaveCount(1)
await expect(rows).toContainText("Active inbox session")
await expect(archived).toBeVisible()
await archived.focus()
await archived.press("Enter")
workspace.push([
{
id: "evt_archived_question",
type: "form.created",
created: T0 + 9 * 60_000,
location: { directory: workspace.directory },
data: {
form: {
id: "form_archived_question",
sessionID: "ses_asking_archived",
title: "Unsubscribe from these?",
metadata: { kind: "question" },
fields: [{ key: "answer", type: "string", title: "Answer" }],
},
},
} satisfies Extract<OpenCodeEvent, { type: "form.created" }>,
])
const dialog = page.getByRole("dialog")
await expect(needs).toHaveText([/Clean email inbox/])
await expect(needs.first()).not.toHaveClass(/opacity-50/)
// It was the only archived session, so Archived has nothing left to show.
await expect(archived).toHaveCount(0)
const search = dialog.getByRole("combobox")
// Still archived: the menu offers to unarchive it.
await needs.first().click({ button: "right" })
await expect(page.getByRole("menuitem", { name: "Unarchive", exact: true })).toBeVisible()
await page.keyboard.press("Escape")
await expect(search).toBeFocused()
await expect(search).toHaveAttribute("placeholder", "Search sessions")
await expect(dialog.getByText("Archived sessions", { exact: true })).toBeVisible()
await expect(dialog.getByRole("option")).toHaveCount(2)
await expect(dialog.getByRole("option", { name: /First archived session/ })).toBeVisible()
await expect(dialog.getByRole("option", { name: /Second archived session/ })).toBeVisible()
await search.fill("Active inbox session")
await expect(dialog.getByText("No results found", { exact: true })).toBeVisible()
await search.fill("First archived")
await expect(dialog.getByRole("option")).toHaveCount(1)
const option = dialog.getByRole("option", { name: /First archived session/ })
await expect(option).toHaveAttribute("aria-selected", "true")
workspace.push([
{
id: "evt_archived_question_replied",
type: "form.replied",
created: T0 + 10 * 60_000,
location: { directory: workspace.directory },
data: { sessionID: "ses_asking_archived", id: "form_archived_question", answer: { answer: "yes" } },
} satisfies Extract<OpenCodeEvent, { type: "form.replied" }>,
])
await expect(needs).toHaveCount(0)
await expect(archived).toBeVisible()
await archived.click()
await expect(list.locator('[data-slot="sidebar-inbox-item"]').filter({ hasText: "Clean email inbox" })).toHaveClass(
/opacity-50/,
)
})
test("in the inbox, ⌘1-9 and option arrows move through sessions in the order the list shows", async ({ page }) => {
await mockWorkspace(page, {
name: "InboxShortcuts",
sessions: [
{
id: "ses_keys_first",
title: "First read session",
time: { created: T0, updated: T0 + 3, idle: T0 + 3, viewed: T0 + 3 },
},
{ id: "ses_keys_unread", title: "Unread session", time: { created: T0, updated: T0 + 2, idle: T0 + 2 } },
{
id: "ses_keys_second",
title: "Second read session",
time: { created: T0, updated: T0 + 1, idle: T0 + 1, viewed: T0 + 1 },
},
{
id: "ses_keys_archived",
title: "Archived session",
time: { created: T0, updated: T0 + 4, idle: T0 + 4, viewed: T0 + 4, archived: T0 + 10 },
},
],
seed: { settings: { appearance: { tabLayout: "inbox" } }, tabs: [] },
})
await page.goto("/")
const rows = page.locator('[data-slot="sidebar-inbox"] [data-slot="sidebar-inbox-item"]')
await expect(rows).toHaveText([/First read session/, /Unread session/, /Second read session/])
await page.keyboard.press("ControlOrMeta+1")
await expectPath(page, sessionHref("ses_keys_first"))
await page.keyboard.press("Alt+ArrowDown")
await expectPath(page, sessionHref("ses_keys_unread"))
await page.keyboard.press("Alt+ArrowDown")
await expectPath(page, sessionHref("ses_keys_second"))
// Past the last row it wraps to the first, skipping the collapsed Archived section.
await page.keyboard.press("Alt+ArrowDown")
await expectPath(page, sessionHref("ses_keys_first"))
await page.keyboard.press("Shift+Alt+ArrowDown")
await expectPath(page, sessionHref("ses_keys_unread"))
await page.keyboard.press("ControlOrMeta+3")
await expectPath(page, sessionHref("ses_keys_second"))
await page.keyboard.press("Alt+ArrowUp")
await expectPath(page, sessionHref("ses_keys_unread"))
})
test("the inbox list's own menu moves Working between the bottom shelf and above Archived", async ({ page }) => {
await mockWorkspace(page, {
name: "WorkingPlacement",
sessions: [
{ id: "ses_place_read", title: "Read inbox session", time: { created: T0, updated: T0, idle: T0, viewed: T0 } },
{ id: "ses_place_working", title: "Working inbox session", time: { created: T0, updated: T0 + 1, busy: T0 } },
{
id: "ses_place_archived",
title: "Archived inbox session",
time: { created: T0, updated: T0, idle: T0, archived: T0 + 10 },
},
],
sessionStatus: { ses_place_working: { type: "running" } },
seed: {
settings: { appearance: { tabLayout: "inbox" } },
tabs: [],
storage: { "opencode.global.dat:sidebar.inbox": { workingExpanded: true, archivedExpanded: true } },
},
})
await page.goto("/")
const inbox = page.locator('[data-slot="sidebar-inbox"]')
const list = inbox.locator('[data-slot="sidebar-inbox-scroll"]')
const shelf = inbox.locator('[data-slot="sidebar-inbox-working"]')
await expect(shelf.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([/Working inbox session/])
await expect(list.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([
/Read inbox session/,
/Archived inbox session/,
])
// A card's own menu stays the card's.
await list.locator('[data-slot="sidebar-inbox-item"]').filter({ hasText: "Read inbox session" }).click({ button: "right" })
await expect(page.getByRole("menuitemradio")).toHaveCount(0)
await page.keyboard.press("Escape")
await inbox.getByRole("button", { name: "Archived", exact: true }).click({ button: "right" })
await expect(page.getByRole("menuitemradio")).toHaveCount(0)
await page.getByRole("menuitem", { name: "Working sessions", exact: true }).click()
await expect(page.getByRole("menuitemradio", { name: "Pinned to the bottom" })).toBeChecked()
await page.getByRole("menuitemradio", { name: "Above archived" }).click()
await expect(shelf).toHaveCount(0)
await expect(list.getByRole("group", { name: "Working", exact: true })).toBeVisible()
await expect(list.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([
/Read inbox session/,
/Working inbox session/,
/Archived inbox session/,
])
await page.reload()
await expect(list.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([
/Read inbox session/,
/Working inbox session/,
/Archived inbox session/,
])
await inbox.getByRole("button", { name: "Working", exact: true }).click({ button: "right" })
await page.getByRole("menuitem", { name: "Working sessions", exact: true }).click()
await page.getByRole("menuitemradio", { name: "Pinned to the bottom" }).click()
await expect(shelf.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([/Working inbox session/])
})
test("a working session finishing in the inbox shelf leaves the list where it was", async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 480 })
const workspace = await mockWorkspace(page, {
name: "InboxFinish",
sessions: [
...Array.from({ length: 12 }, (_, index) => ({
id: `ses_finish_read_${String(index).padStart(2, "0")}`,
title: `Read session ${index}`,
time: { created: T0, updated: T0 + 100 - index, idle: T0 + 100 - index, viewed: T0 + 200 },
})),
{ id: "ses_finish_working", title: "Working session", time: { created: T0, updated: T0 + 150, busy: T0 } },
],
sessionStatus: { ses_finish_working: { type: "running" } },
seed: {
settings: { appearance: { tabLayout: "inbox" } },
tabs: [],
storage: { "opencode.global.dat:sidebar.inbox": { workingExpanded: true, recentExpanded: true } },
},
})
await page.goto("/")
const inbox = page.locator('[data-slot="sidebar-inbox"]')
const list = inbox.locator('[data-slot="sidebar-inbox-scroll"]')
const shelf = inbox.locator('[data-slot="sidebar-inbox-working"]')
const recent = list.getByRole("group", { name: "Recent", exact: true }).locator('[data-slot="sidebar-inbox-item"]')
await expect(shelf.locator('[data-slot="sidebar-inbox-item"]')).toHaveText([/Working session/])
await expect(recent).toHaveCount(12)
expect(await list.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(true)
// Open the first session, then move focus down the list to the working card without opening it. The card that
// opened the session hands focus to its composer once the session loads, so wait for that before going back to the
// list: otherwise the composer can take focus from the list partway through.
await recent.first().click()
await expectPath(page, sessionHref("ses_finish_read_00"))
await expect(page.locator('[data-component="composer-editor"]')).toBeFocused()
await recent.first().click()
await expectPath(page, sessionHref("ses_finish_read_00"))
await expect(recent.first()).toBeFocused()
await page.keyboard.press("End")
await expect(shelf.locator('[data-slot="sidebar-inbox-item"]')).toBeFocused()
await list.evaluate((element) => element.scrollTo(0, 0))
expect(await list.evaluate((element) => element.scrollTop)).toBe(0)
// The mock serves these records, so the session's next load sees the run's end.
const working = workspace.sessions.find((session) => session.id === "ses_finish_working")
if (!working) throw new Error("Unknown session ses_finish_working")
Object.assign(working, { time: { ...working.time, updated: T0 + 300, idle: T0 + 300 } })
await workspace.push([
{
id: "evt_finish_succeeded",
created: T0 + 300,
type: "session.execution.succeeded",
location: { directory: workspace.directory },
durable: { aggregateID: "ses_finish_working", seq: 1, version: 1 },
data: { sessionID: "ses_finish_working" },
} satisfies Extract<OpenCodeEvent, { type: "session.execution.succeeded" }>,
])
// The finished run is the newest unread result, at the top of Recent, and the list stays at the top to show it.
await expect(shelf).toHaveCount(0)
await expect(recent.first()).toContainText("Working session")
await expect(recent.first()).toHaveAttribute("data-status", "done")
await expect(recent.first()).toBeFocused()
await expect(recent.first()).toBeInViewport({ ratio: 1 })
expect(await list.evaluate((element) => element.scrollTop)).toBe(0)
// A second Enter while the restore is in flight restores and opens the session once.
const restore = await holdRoute(page, /\/api\/session\/ses_archive_0(\?|$)/, { method: "PATCH" })
await search.press("Enter")
await restore.arrived
await expect(option).toHaveAttribute("aria-busy", "true")
await expect(option.getByRole("img", { name: "Loading", exact: true })).toBeVisible()
await search.press("Enter")
await expect(dialog).toBeVisible()
restore.release()
await expect(dialog).toHaveCount(0)
expect(restore.requests).toHaveLength(1)
await expectPath(page, sessionHref("ses_archive_0"))
await expect(page.locator('[data-component="composer-editor"]')).toBeEditable()
await expect(rows.filter({ hasText: "First archived session" })).toHaveAttribute("data-state", "active")
})
test("deleting from the inbox closes its dialog at once and a slow delete leaves the next dialog open", async ({
@ -2938,16 +2442,11 @@ test("deleting from the inbox closes its dialog at once and a slow delete leaves
expect(remove.requests).toHaveLength(1)
})
test("opening a working session expands its shelf, and collapsing it keeps only the selected session", async ({
page,
}) => {
test("opening a working session expands its shelf and still allows manual collapse", async ({ page }) => {
await openSession(page, {
name: "WorkingInbox",
sessions: [
{ id: "ses_working_selected", title: "Selected working session" },
{ id: "ses_working_other", title: "Other working session" },
],
sessionStatus: { ses_working_selected: { type: "running" }, ses_working_other: { type: "running" } },
sessions: [{ id: "ses_working_selected", title: "Selected working session" }],
sessionStatus: { ses_working_selected: { type: "running" } },
seed: {
settings: { appearance: { tabLayout: "inbox" } },
storage: { "opencode.global.dat:sidebar.inbox": { workingExpanded: false } },
@ -2960,25 +2459,20 @@ test("opening a working session expands its shelf, and collapsing it keeps only
const toggle = shelf.getByRole("button", { name: "Working", exact: true })
const rows = shelf.locator('[data-slot="sidebar-inbox-item"]')
const selected = rows.filter({ hasText: "Selected working session" })
const row = shelf.locator('[data-slot="sidebar-inbox-item"]')
await expect(toggle).toHaveAttribute("aria-expanded", "true")
await expect(rows).toHaveCount(2)
await expect(selected).toHaveAttribute("data-state", "active")
await expect(row).toHaveAttribute("data-state", "active")
await expect(toggle.locator('[data-component="text-shimmer"]')).toHaveCount(0)
await toggle.click()
await expect(toggle).toHaveAttribute("aria-expanded", "false")
await expect(rows).toHaveText([/Selected working session/])
await expect(selected).toHaveAttribute("data-state", "active")
await expect(row).toHaveCount(0)
await expect(toggle.locator('[data-component="text-shimmer"]')).toHaveAttribute("data-active", "true")
await expectPath(page, sessionHref("ses_working_selected"))
await expect(page.locator('[data-component="composer-editor"]')).toBeEditable()
await toggle.press("Enter")
await expect(toggle).toHaveAttribute("aria-expanded", "true")
await expect(rows).toHaveCount(2)
await expect(selected).toHaveAttribute("data-state", "active")
await expect(row).toHaveAttribute("data-state", "active")
await expect(toggle.locator('[data-component="text-shimmer"]')).toHaveCount(0)
})
@ -3046,27 +2540,22 @@ test("sessions opened from Home and Search get a temporary Current session row w
await expect(rows).toHaveCount(10)
})
test("the inbox lists unread results in Recent by when they settled, and reading one keeps its place", async ({
test("the inbox keeps every unread result separate from expandable Recent, including never-run sessions", async ({
page,
}) => {
await mockWorkspace(page, {
name: "InboxSections",
sessions: [
...Array.from({ length: 6 }, (_, index) => ({
...Array.from({ length: 12 }, (_, index) => ({
id: `ses_unread_${index}`,
title: `Unread result ${index}`,
outcome: index === 0 ? "failed" : "succeeded",
time: { created: T0, updated: T0 + 2 * index + 1, idle: T0 + 2 * index + 1 },
time: { created: T0, updated: T0 + index, idle: T0 + index },
})),
...Array.from({ length: 6 }, (_, index) => ({
...Array.from({ length: 12 }, (_, index) => ({
id: `ses_read_${index}`,
title: index === 0 ? "Never-run session" : `Read session ${index}`,
time: {
created: T0,
updated: index ? T0 + 2 * index : T0 + 12,
idle: index ? T0 + 2 * index : undefined,
viewed: T0 + 200,
},
time: { created: T0, updated: T0 + 100 - index, idle: index ? T0 + 100 - index : undefined, viewed: T0 + 200 },
})),
],
seed: { settings: { appearance: { tabLayout: "inbox" } }, tabs: [] },
@ -3075,65 +2564,47 @@ test("the inbox lists unread results in Recent by when they settled, and reading
const inbox = page.locator('[data-slot="sidebar-inbox"]')
const unread = inbox.getByRole("group", { name: "Unread", exact: true }).locator('[data-slot="sidebar-inbox-item"]')
const recent = inbox.getByRole("group", { name: "Recent", exact: true }).locator('[data-slot="sidebar-inbox-item"]')
const order = [
await expect(unread).toContainText(Array.from({ length: 12 }, (_, index) => `Unread result ${11 - index}`))
await expect(unread.filter({ hasText: "Unread result 0" })).toHaveAttribute("data-status", "failed")
await expect(recent).toContainText([
"Never-run session",
"Unread result 5",
"Read session 5",
"Unread result 4",
"Read session 4",
"Unread result 3",
"Read session 3",
"Unread result 2",
"Read session 2",
"Unread result 1",
"Read session 1",
"Unread result 0",
]
await expect(recent).toContainText(order.slice(0, 10))
...Array.from({ length: 9 }, (_, index) => `Read session ${index + 1}`),
])
await expect(recent).toHaveCount(10)
await expect(inbox.getByRole("group", { name: "Unread", exact: true })).toHaveCount(0)
await expect(recent.filter({ hasText: "Unread result 5" })).toHaveAttribute("data-status", "done")
await expect(recent.filter({ hasText: "Read session 5" })).toHaveAttribute("data-status", "ready")
await expect(inbox.locator('[data-slot="sidebar-inbox-item"][tabindex="0"]')).toHaveCount(1)
await recent.filter({ hasText: "Never-run session" }).focus()
await unread.filter({ hasText: "Unread result 11" }).focus()
await page.keyboard.press("ArrowDown")
await expect(recent.filter({ hasText: "Unread result 5" })).toBeFocused()
await expect(unread.filter({ hasText: "Unread result 10" })).toBeFocused()
await page.keyboard.press("End")
await expect(recent.filter({ hasText: "Unread result 1" })).toBeFocused()
await expect(recent.filter({ hasText: "Read session 9" })).toBeFocused()
await page.keyboard.press("Home")
await expect(recent.filter({ hasText: "Never-run session" })).toBeFocused()
await expect(unread.filter({ hasText: "Unread result 11" })).toBeFocused()
await inbox.getByRole("button", { name: "Show more", exact: true }).click()
await expect(recent).toHaveCount(12)
await expect(recent).toContainText(order)
await expect(recent.filter({ hasText: "Unread result 0" })).toHaveAttribute("data-status", "failed")
await expect(recent.filter({ hasText: "Read session 11" })).toHaveCount(1)
await expect(unread).toHaveCount(12)
await page.reload()
await expect(recent).toHaveCount(12)
await inbox.getByRole("button", { name: "Show less", exact: true }).click()
await expect(recent).toHaveCount(10)
await expect(unread).toHaveCount(12)
// Reading or unreading a session changes its mark, not its place.
const read = recent.nth(3)
const marked = page.getByText("Read session 1", { exact: true })
await expect(read).toContainText("Unread result 4")
await read.click({ button: "right" })
await page.getByRole("menuitem", { name: "Mark as read", exact: true }).click()
await expect(read).toHaveAttribute("data-status", "ready")
await expect(read).toContainText("Unread result 4")
await expect(recent).toContainText(order.slice(0, 10))
const unread = recent.nth(8)
await expect(unread).toContainText("Read session 2")
await unread.click({ button: "right" })
await recent.filter({ has: marked }).click({ button: "right" })
await page.getByRole("menuitem", { name: "Mark as unread", exact: true }).click()
await expect(unread).toHaveAttribute("data-status", "done")
await expect(unread).toContainText("Read session 2")
await expect(recent).toContainText(order.slice(0, 10))
await expect(unread.filter({ has: marked })).toHaveCount(1)
await expect(recent.filter({ has: marked })).toHaveCount(0)
await unread.filter({ has: marked }).click({ button: "right" })
await page.getByRole("menuitem", { name: "Mark as read", exact: true }).click()
await expect(recent.filter({ has: marked })).toHaveCount(1)
await expect(unread.filter({ has: marked })).toHaveCount(0)
})
test("the inbox waits for initial requests and orders attention by waiting age rather than last update", async ({

View file

@ -42,56 +42,6 @@ test("restores a terminal from the server's snapshot after a reload", async ({ p
])
})
test("draws terminal characters whose font files arrive after the first paint", async ({ page }) => {
// The Nerd Fonts icons and the characters outside Latin and Cyrillic are font files of their own, which load when
// a terminal first draws one of their characters.
const icons = await holdRoute(page, /OpenMono-icons[^/]*\.woff2/)
const rest = await holdRoute(page, /OpenMono-Regular-rest[^/]*\.woff2/)
// A folder icon and a Greek letter (λ, in the "rest" file) on the first row, with the cursor, whose row the terminal
// redraws by itself, on the last one.
const { persistentPty } = await openSession(page, {
name: "Terminals",
persistentPty: {
initial: [{ id: "pty_icons", sessionID: SESSION, title: "Build", output: "ls \uf07b \u03bb\x1b[999;1H" }],
},
})
await openSide(page)
await showTerminal(page, "Build", "pty_icons")
await Promise.all([icons.arrived, rest.arrived])
// What the first cells of a row show: undefined while they are blank, else a checksum of their pixels.
const row = (index: number) =>
terminalScreen(page, "pty_icons")
.locator("canvas")
.evaluate(
(canvas: HTMLCanvasElement, input) => {
const height = Math.round(canvas.height / input.rows)
const pixels = canvas.getContext("2d")!.getImageData(0, input.index * height, 80, height).data
if (pixels.every((value, index) => value === pixels[index % 4])) return
return pixels.reduce((sum, value) => (sum * 31 + value) >>> 0, 0)
},
{ index, rows: persistentPty.terminals[0]!.size.rows },
)
await expect.poll(() => row(0)).toBeDefined()
const fallback = await row(0)
icons.release()
rest.release()
await page.evaluate(() => document.fonts.ready.then(() => undefined))
// The same text on the third row, first drawn with the files loaded, is what the first row must now show.
persistentPty.output("pty_icons", "\x1b[3;1Hls \uf07b \u03bb\x1b[999;1H")
await expect.poll(() => row(2)).toBeDefined()
const loaded = await row(2)
expect(loaded).not.toBe(fallback)
await expect.poll(() => row(0)).toBe(loaded)
})
test("after a reload, the close shortcut closes the restored terminal", async ({ page }) => {
// Elsewhere Ctrl+W reaches the shell, so the terminal hands only macOS's Cmd+W to the app.
await page.addInitScript(() => Object.defineProperty(navigator, "platform", { get: () => "MacIntel" }))

View file

@ -448,7 +448,7 @@ test("keeps the old workspace's shell on its own Location while destination hist
})
test("loads the transcript code font before opening rich history", async ({ page }) => {
const font = page.waitForResponse((response) => /OpenMono-Regular-latin[^/]*\.woff2/.test(response.url()))
const font = page.waitForResponse((response) => /IBMPlexMono-Text[^/]*\.woff2/.test(response.url()))
await openTabs(page, {
pageMessages: () => ({
items: [{ id: "msg_font_source", type: "user", text: "A transcript with no code", time: { created: 1 } }],
@ -468,7 +468,7 @@ test("loads the transcript code font before opening rich history", async ({ page
code.style.font = "440 13px var(--font-family-mono)"
code.textContent = "code"
code.getBoundingClientRect()
const loaded = document.fonts.check('440 13px "OpenMono"')
const loaded = document.fonts.check('440 13px "IBM Plex Mono"')
code.remove()
return loaded

View file

@ -1089,116 +1089,3 @@ test("folds a prompt past 12 lines to its first 8 and keeps it open after scroll
await expect(toggle).toHaveAttribute("aria-expanded", "true")
await expect.poll(highlights).toBe(1)
})
// The thumb used to be written before the timeline's own scroll handler ran. The handler's first read of the scroll
// position then recalculated style in every scroll event, and laid out again whenever the thumb changed size.
for (const timeline of [
{ name: "old", newTimeline: false },
{ name: "new", newTimeline: true },
]) {
test(`handles a scroll event without a forced style or layout pass in the ${timeline.name} timeline`, async ({
page,
browser,
}) => {
// One reply taller than two viewports: scrolling inside it mounts no row, so only the scroll handlers run.
await setupTimeline(page, {
settings: { newTimeline: timeline.newTimeline },
messages: [
userMessage([userText("Write a long reply.", { id: "prt_msg_0001_tall_text" })], {
id: "msg_0001_tall",
created: 1700000000000,
}),
assistantMessage(
[
{
id: "prt_msg_0002_tall_text",
type: "text",
text: Array.from({ length: 160 }, (_, line) => `Line ${line} of a long reply.`).join("\n\n"),
},
],
{ id: "msg_0002_tall", parentID: "msg_0001_tall", created: 1700000001000 },
),
userMessage([userText("Thanks.", { id: "prt_msg_0003_tall_text" })], {
id: "msg_0003_tall",
created: 1700000002000,
}),
assistantMessage([{ id: "prt_msg_0004_tall_text", type: "text", text: "The end of the transcript." }], {
id: "msg_0004_tall",
parentID: "msg_0003_tall",
created: 1700000003000,
}),
],
})
const scroller = page.locator(".scroll-view__viewport", { has: page.locator("[data-timeline-row]") })
const end = scroller.getByText("The end of the transcript.", { exact: true })
await expect(end).toBeInViewport()
// A cold timeline scrolls itself to the end while it mounts, which undoes a scroll made before it is done.
await expect(page.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible")
await waitForVisualSettle(page, ["[data-timeline-virtual-content]"])
// Leave the end as a reader does, with a page key from the composer, which holds the focus: a scripted scroll is no
// reader input, so the timeline may go back to the end it follows. The pointer stays off the timeline: rows that
// pass under it change hover state, which dirties style by itself.
const editor = page.locator('[data-component="composer-editor"]')
await editor.press("PageUp")
await editor.press("PageUp")
await expect(end).not.toBeInViewport()
await waitForVisualSettle(page, ["[data-timeline-virtual-content]"])
const scrolls = await scroller.evaluateHandle((element) => {
const seen = { count: 0 }
element.addEventListener("scroll", () => seen.count++)
return seen
})
await browser.startTracing(page, {
categories: ["devtools.timeline", "disabled-by-default-devtools.timeline.stack"],
})
// Scroll events alone, as dragging the scrollbar or autoscroll sends them. A wheel event runs handlers of its own.
for (const step of Array.from({ length: 15 }, (_, index) => index + 1)) {
await scroller.evaluate((element) => (element.scrollTop -= 30))
await expect.poll(() => scrolls.evaluate((seen) => seen.count)).toBeGreaterThanOrEqual(step)
}
const trace: { traceEvents: TraceEvent[] } = JSON.parse((await browser.stopTracing()).toString())
const passes = forcedInScroll(trace.traceEvents)
expect(passes.scrolls).toBeGreaterThanOrEqual(15)
// Before, every scroll event forced one.
expect(passes.forced).toBeLessThanOrEqual(3)
})
}
type TraceEvent = {
name: string
ph: string
ts: number
dur?: number
pid: number
tid: number
args?: { data?: { type?: string; stackTrace?: unknown[] }; beginData?: { stackTrace?: unknown[] } }
}
// Style and layout passes that script forced while a scroll event was handled. Chrome records the script's stack on
// such a pass; a pass of the rendering update has none.
function forcedInScroll(events: TraceEvent[]) {
const scrolls = events.filter(
(event) => event.name === "EventDispatch" && event.ph === "X" && event.args?.data?.type === "scroll",
)
const forced = events.filter(
(event) =>
(event.name === "UpdateLayoutTree" || event.name === "Layout") &&
!!(event.args?.beginData?.stackTrace ?? event.args?.data?.stackTrace)?.length &&
scrolls.some(
(scroll) =>
scroll.pid === event.pid &&
scroll.tid === event.tid &&
event.ts >= scroll.ts &&
event.ts <= scroll.ts + (scroll.dur ?? 0),
),
)
return { scrolls: scrolls.length, forced: forced.length }
}

View file

@ -12,7 +12,6 @@ import {
session,
sessionID,
setupTimeline,
shell,
status,
textPart,
userID,
@ -240,216 +239,6 @@ test.describe("timeline history", () => {
await expect.poll(positions).toEqual(before)
})
// Each native scroll write forces a layout of the rows resized before it.
test("corrects the scroll position once for each batch of rows an older page measures", async ({ page }) => {
const messages = [
...historyMessages(40),
userMessage(),
assistantMessage([textPart("prt_active", "Checking the route")]),
]
// Scroll writes on the timeline, counted for each synchronous run: a batch of measured rows is one run.
await page.addInitScript(() => {
const scrollTo = Element.prototype.scrollTo
const runs: number[] = (window.__scrollWrites = [])
const run = { open: false }
Element.prototype.scrollTo = function (
this: Element,
...args: [options?: ScrollToOptions] | [x: number, y: number]
) {
if (this.matches(".scroll-view__viewport") && !run.open) {
run.open = true
runs.push(0)
queueMicrotask(() => (run.open = false))
}
if (this.matches(".scroll-view__viewport")) runs[runs.length - 1]!++
const scroll = scrollTo.bind(this)
if (args.length === 2) return scroll(args[0], args[1])
return scroll(args[0])
}
})
await setupTimeline(page, {
sessionMessages: messages,
pageMessages: (_, limit, before) => {
const end = before ? messages.findIndex((message) => message.id === before) : messages.length
const start = Math.max(0, end - Math.min(16, limit))
return { items: messages.slice(start, end), cursor: start ? messages[start]!.id : undefined }
},
})
const scroller = timelineScroller(page)
await expect(scroller.getByText("Checking the route", { exact: true })).toBeInViewport()
await page.evaluate(() => window.__scrollWrites?.splice(0))
// Each scroll to the top loads an older page, whose rows are measured above the reader.
await scroller.hover()
await expect(async () => {
await page.mouse.wheel(0, -100_000)
await expect(scroller.getByText(/^Historical response 0\. /)).toBeInViewport({ timeout: 1_000 })
}).toPass()
const writes = await page.evaluate(() => window.__scrollWrites ?? [])
expect(writes.length).toBeGreaterThan(0)
expect(Math.max(...writes)).toBe(1)
})
// The New timeline spaces rows by what the row before each one is. A page lands above a row the reader is looking
// at, in the middle of a turn or at a prompt, and that row must not take the space on top of what it shows.
test("keeps the New timeline's rows fixed while older pages land in a turn and above a prompt", async ({ page }) => {
const reply = (name: string) => Array.from({ length: 40 }, (_, index) => `${name} paragraph ${index}.`).join("\n\n")
const messages = [
userMessage([textPart("prt_gap_0", "Oldest prompt")], { id: "msg_gap_0", created: 1 }),
assistantMessage([textPart("prt_gap_1", "Oldest reply.")], {
id: "msg_gap_1",
parentID: "msg_gap_0",
created: 2,
}),
userMessage([textPart("prt_gap_2", "Middle prompt")], { id: "msg_gap_2", created: 3 }),
assistantMessage([shell("prt_gap_3", "completed", "ok")], { id: "msg_gap_3", parentID: "msg_gap_2", created: 4 }),
assistantMessage([textPart("prt_gap_4", reply("Middle"))], {
id: "msg_gap_4",
parentID: "msg_gap_2",
created: 5,
}),
userMessage([textPart("prt_gap_5", "Latest prompt")], { id: "msg_gap_5", created: 6 }),
assistantMessage([textPart("prt_gap_6", reply("Latest"))], {
id: "msg_gap_6",
parentID: "msg_gap_5",
created: 7,
}),
]
const held = { turn: Promise.withResolvers<void>(), prompt: Promise.withResolvers<void>() }
const requests: { before?: string; phase: "start" | "end" }[] = []
await setupTimeline(page, {
settings: { newTimeline: true },
sessionMessages: messages,
// The newest page starts inside the middle turn, at its reply; the page before it starts at that turn's prompt.
pageMessages: (_, _limit, before) => {
if (before === "prompt") return { items: messages.slice(0, 2) }
if (before === "turn") return { items: messages.slice(2, 4), cursor: "prompt" }
return { items: messages.slice(4), cursor: "turn" }
},
beforeMessagesResponse: ({ before }) =>
before === "turn" || before === "prompt" ? held[before].promise : Promise.resolve(),
onMessages: (request) => requests.push(request),
})
const scroller = timelineScroller(page)
await expect(page.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible")
const lands = async (before: "turn" | "prompt", older: string, visible: string[]) => {
// One upward gesture to the top of what is loaded, where the row the page lands above is in view.
await scroller.evaluate((element) => {
element.dispatchEvent(new WheelEvent("wheel", { bubbles: true, deltaY: -1 }))
element.scrollTop = 0
})
await expect.poll(() => requests.some((request) => request.before === before)).toBe(true)
await expect.poll(() => scroller.evaluate((element) => element.scrollTop)).toBe(0)
const rows = visible.map((text) => scroller.getByText(text, { exact: true }))
await Promise.all(rows.map((row) => expect(row).toBeInViewport()))
const positions = async () =>
(await Promise.all(rows.map((row) => row.boundingBox()))).map((box) => box && Math.round(box.y))
const settled = await positions()
expect(requests.some((request) => request.before === before && request.phase === "end")).toBe(false)
held[before].resolve()
// The older page has landed above the visible rows.
await expect(scroller.getByText(older, { exact: true })).toBeAttached()
await expect.poll(positions).toEqual(settled)
}
await lands("turn", "Middle prompt", ["Middle paragraph 0.", "Middle paragraph 4."])
await lands("prompt", "Oldest reply.", ["Middle prompt", "Middle paragraph 0."])
})
test("a reconnect of the event stream keeps a reader in older history where they were", async ({ page }) => {
const messages: SessionMessageInfo[] = historyMessages(30)
const timeline = await setupTimeline(page, {
sessionMessages: messages,
pageMessages: (_, limit, before) => {
const end = before ? messages.findIndex((message) => message.id === before) : messages.length
const start = Math.max(0, end - limit)
return { items: messages.slice(start, end), cursor: start ? messages[start]!.id : undefined }
},
})
const scroller = timelineScroller(page)
await expect(page.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible")
// Load the older page, then rest at its start: further back than the newest page reaches.
const top = () =>
scroller.evaluate((element) => {
element.dispatchEvent(new WheelEvent("wheel", { bubbles: true, deltaY: -1 }))
element.scrollTop = 0
})
await top()
await expect.poll(() => scroller.evaluate((element) => element.scrollTop)).toBeGreaterThan(200)
await top()
await expect(scroller.getByText(/^Historical response 0\./)).toBeInViewport()
await expect(scroller.getByText(/^Historical response 1\./)).toBeInViewport()
const keys = await scroller.evaluate((element) => {
const view = element.getBoundingClientRect()
return [...element.querySelectorAll<HTMLElement>("[data-timeline-part-id]")]
.filter((row) => {
const rect = row.getBoundingClientRect()
return rect.bottom > view.top && rect.top < view.bottom
})
.flatMap((row) => (row.dataset.timelinePartId ? [row.dataset.timelinePartId] : []))
.slice(0, 3)
})
expect(keys).toHaveLength(3)
const positions = () =>
scroller.evaluate((element, keys) => {
const top = element.getBoundingClientRect().top
return keys.map((key) => {
const row = element.querySelector<HTMLElement>(`[data-timeline-part-id="${key}"]`)
if (!row) return undefined
return Math.round((row.getBoundingClientRect().top - top) * devicePixelRatio) / devicePixelRatio
})
}, keys)
const before = await positions()
const height = await scroller.evaluate((element) => element.scrollHeight)
const connection = await timeline.transport.waitForConnection()
// The client gets no event for this turn, so it hears of it only when the reconnect reads the newest page again.
messages.push(
userMessage([textPart("prt_missed_prompt", "Ship it")], {
id: "msg_09000_missed_a_user",
created: 1700000000000,
}),
assistantMessage([textPart("prt_missed_reply", "Shipped.")], {
id: "msg_09000_missed_b_assistant",
parentID: "msg_09000_missed_a_user",
created: 1700000001000,
}),
)
await timeline.transport.disconnect()
await timeline.transport.waitForConnection({ after: connection.id })
// The newest page was read again: the missed turn makes the transcript taller.
await expect.poll(() => scroller.evaluate((element) => element.scrollHeight)).toBeGreaterThan(height)
await expect.poll(positions).toEqual(before)
})
test("mounts every part once and in order while paging to the start", async ({ page }) => {
test.setTimeout(240_000)
const errors = trackPageErrors(page)
@ -900,7 +689,6 @@ test.describe("timeline history", () => {
declare global {
interface Window {
__historyRootProbe?: { arm(): string[]; hidden: boolean; settle(final: ProbeFinal): void; settled: boolean }
__scrollWrites?: number[]
}
}

View file

@ -250,7 +250,7 @@ test.describe("static projection", () => {
"aria-label",
"Used 2 Patch, Read",
)
await expect(page.locator('[data-timeline-spacing="tool"]')).toHaveCSS("padding-top", "16px")
await expect(page.locator('[data-timeline-spacing="tool"]')).toHaveCSS("padding-top", "8px")
})
})
@ -914,7 +914,7 @@ test.describe("Working", () => {
const trigger = page
.locator('[data-component="collapsed-tool-group"]')
.getByRole("button", { name: "Used 2 Shell", exact: true })
.getByRole("button", { name: "Used 2 Shell", exact: true, includeHidden: true })
await expect(trigger).toHaveAttribute("aria-expanded", "false")
await expect(working).toBeVisible()
@ -2037,17 +2037,18 @@ test("quotes plain timeline text into the composer, with or without a comment",
.poll(() => prompts)
.toEqual([
[
"The user quoted the following from earlier in the conversation:",
"> Explain the build",
">",
"> ",
"> It has two steps:",
"> compile",
"> bundle",
"The user quoted the following from earlier in the conversation:",
"> It has two steps:",
"> compile",
"> bundle",
"",
"> It has two steps:",
"> compile",
"> bundle",
"",
"Why two?",
"The user made the following comment regarding this quote: Why two?",
].join("\n"),
])
expect(metadata).toEqual([
@ -2814,13 +2815,14 @@ test("quotes table rows and diff lines selected across a diff viewer", async ({
.poll(() => prompts)
.toEqual([
[
"The user quoted the following from earlier in the conversation:",
"> a.ts\trename",
">",
"> ",
"> -export const value = 'before'",
"> +export const value = 'after'",
"",
"The user quoted the following from earlier in the conversation:",
"> a.ts\trename",
">",
"> ",
"> -export const value = 'before'",
].join("\n"),
])

View file

@ -73,8 +73,6 @@ test("What's New shows the highlights since the version seen, pages to Get start
const title = dialog.getByRole("heading", { level: 1 })
const next = dialog.getByRole("button", { name: "Next", exact: true })
await expect(title).toHaveText("Split panes")
// Focus opens on Next, a visible control, rather than on a wrapper with no ring.
await expect(next).toBeFocused()
await expect(dialog.getByText("Work side by side.", { exact: true })).toBeVisible()
await expect(dialog.getByRole("img", { name: "Split panes", exact: true })).toHaveAttribute("src", "/split.png")
// Seen as soon as it shows, so however it closes, the next start shows nothing.
@ -97,8 +95,6 @@ test("What's New shows the highlights since the version seen, pages to Get start
await next.click()
await expect(title).toHaveText("Session tabs")
await expect(next).toHaveCount(0)
// Next becomes Get started in place, so focus doesn't drop to the page on the last highlight.
await expect(dialog.getByRole("button", { name: "Get started", exact: true })).toBeFocused()
await dialog.getByRole("button", { name: "Get started", exact: true }).click()
await expect(dialog).toBeHidden()
expect(requests).toHaveLength(1)

View file

@ -196,11 +196,6 @@ const Group = HttpApiGroup.make("mock")
)
.add(HttpApiEndpoint.get("command", "/api/command", { success: Json }))
.add(HttpApiEndpoint.get("skill", "/api/skill", { success: Json }))
.add(
HttpApiEndpoint.get("skillFile", "/api/experimental/skill/:skillID/file/*", {
success: Schema.Uint8Array.pipe(HttpApiSchema.asUint8Array()),
}),
)
.add(HttpApiEndpoint.get("plugin", "/api/plugin", { success: Json }))
.add(HttpApiEndpoint.get("mcp", "/api/mcp", { success: Json }))
.add(
@ -240,35 +235,7 @@ const Group = HttpApiGroup.make("mock")
)
.add(HttpApiEndpoint.get("websearchProviders", "/api/websearch/provider", { success: Json }))
.add(HttpApiEndpoint.get("usageLimits", "/api/experimental/usage/limits", { success: Json }))
.add(HttpApiEndpoint.get("flagList", "/api/experimental/flag", { success: Json }))
.add(HttpApiEndpoint.get("jobList", "/api/experimental/job", { success: Json }))
.add(
HttpApiEndpoint.get("automationList", "/api/experimental/automation", {
query: Schema.Struct({ sessionID: Schema.optional(Schema.String) }),
success: Json,
}),
)
.add(
HttpApiEndpoint.post("automationPause", "/api/experimental/automation/:automationID/pause", {
params: Schema.Struct({ automationID: Schema.String }),
success: Json,
error: [MockNotFound],
}),
)
.add(
HttpApiEndpoint.post("automationResume", "/api/experimental/automation/:automationID/resume", {
params: Schema.Struct({ automationID: Schema.String }),
success: Json,
error: [MockNotFound],
}),
)
.add(
HttpApiEndpoint.delete("automationDelete", "/api/experimental/automation/:automationID", {
params: Schema.Struct({ automationID: Schema.String }),
success: NoContent,
error: [MockNotFound],
}),
)
.add(
HttpApiEndpoint.get("worktreeList", "/api/worktree", {
query: Schema.Struct({ projectID: Schema.String }),

View file

@ -1,5 +1,5 @@
import type { Page } from "@playwright/test"
import type { OpenCodeEvent, AutomationInfo, SessionMessageInfo } from "@opencode/client/promise"
import type { OpenCodeEvent, SessionMessageInfo } from "@opencode/client/promise"
import { Permission } from "@opencode/schema/permission"
import { artifactKind, artifactMime } from "@opencode/util/artifact"
import { Model } from "@opencode/schema/model"
@ -151,7 +151,7 @@ export interface MockServerConfig {
// Title of created sessions (default: the request's title, else "New session").
createdSessionTitle?: string
// Slash commands served by `/api/command`.
commands?: unknown[] | ((directory: string) => unknown[])
commands?: Resolvable<unknown[]>
// Records POST /api/session/:id/command (204). Without it, commands answer 501 MockUnsupported.
onCommand?: (input: { sessionID: string; body: unknown }) => void
fileList?: (path: string) => unknown[] | Promise<unknown[]>
@ -168,8 +168,6 @@ export interface MockServerConfig {
generate?: (input: { sessionID: string; prompt: string }) => { text: string } | Promise<{ text: string }>
onInboxChange?: (input: { sessionID: string; inboxID: string; action: "cancel" | "steer" | "queue" }) => void
onBackground?: (input: { sessionID: string }) => void
// Serves `/api/experimental/automation*`; defaults to an empty list.
automations?: AutomationInfo[]
// Serves the session-scoped persistent PTY routes and their connect WebSockets (`e2e/utils/persistent-pty.ts`).
// Without it, the server has a working daemon and no terminals; `capability: false` makes the routes answer 503.
persistentPty?: MockPersistentPtyConfig
@ -717,26 +715,6 @@ function mockHandlers(
)
}),
)
// Serves a listed skill's inline content as its SKILL.md.
.handleRaw("skillFile", (ctx) =>
Effect.sync(() => {
const path = `skill://${decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice("/api/experimental/skill/".length)).replace("/file/", "/")}`
const skill = resolve(config.skills ?? []).find(
(item) => Predicate.hasProperty(item, "path") && item.path === path,
)
if (Predicate.hasProperty(skill, "content") && Predicate.isString(skill.content))
return HttpServerResponse.uint8Array(new TextEncoder().encode(skill.content))
return HttpServerResponse.jsonUnsafe(
// SAFETY: the server's wire body for a missing file, which the client decodes into its own error.
// oxlint-disable-next-line anti-slop-effect/no-manual-tagged-construction -- see SAFETY above
{ _tag: "FileNotFoundError", path, message: `File not found: ${path}` },
{ status: 404 },
)
}),
)
// Raw, so a hook's answer can replace the status and body.
.handleRaw("worktreeCreate", (ctx) =>
Effect.gen(function* () {
@ -926,14 +904,10 @@ function mockHandlers(
),
credentialRemove: () => noContent,
command: (ctx) =>
Effect.sync(() => {
const directory = requestDirectory(config, ctx.request)
return {
location: location(config, directory),
data: Predicate.isFunction(config.commands) ? config.commands(directory) : config.commands ?? [],
}
}),
Effect.sync(() => ({
location: location(config, requestDirectory(config, ctx.request)),
data: resolve(config.commands ?? []),
})),
skill: () => Effect.sync(() => ({ location: location(config), data: resolve(config.skills ?? []) })),
plugin: () => Effect.sync(() => ({ location: location(config), data: resolve(config.plugins ?? []) })),
mcp: (ctx) =>
@ -973,50 +947,8 @@ function mockHandlers(
Effect.sync(() => ({ location: location(config), data: resolve(config.websearchProviders ?? []) })),
// No scenario signs in to an OpenCode Console workspace, so none has usage limits.
usageLimits: () => Effect.succeed({ location: location(config), data: null }),
// No scenario turns on a feature flag, so every flag is off.
flagList: (ctx) =>
Effect.sync(() => ({ location: location(config, requestDirectory(config, ctx.request)), data: {} })),
// No scenario runs background jobs (Code Mode scripts or subagent work), so none is running.
jobList: () => Effect.succeed({ data: [] }),
automationList: (ctx) =>
Effect.sync(() => {
const list = config.automations ?? []
const filtered = ctx.query.sessionID ? list.filter((item) => item.sessionID === ctx.query.sessionID) : list
return { data: filtered }
}),
automationPause: (ctx) =>
Effect.suspend(() => {
const list = config.automations ?? []
const index = list.findIndex((item) => item.id === ctx.params.automationID)
if (index === -1) return Effect.fail(new MockNotFound({ message: `Automation not found: ${ctx.params.automationID}` }))
const updated: AutomationInfo = { ...list[index]!, status: "paused", time: { ...list[index]!.time, updated: Date.now() } }
list[index] = updated
return Effect.succeed({ data: updated })
}),
automationResume: (ctx) =>
Effect.suspend(() => {
const list = config.automations ?? []
const index = list.findIndex((item) => item.id === ctx.params.automationID)
if (index === -1) return Effect.fail(new MockNotFound({ message: `Automation not found: ${ctx.params.automationID}` }))
const updated: AutomationInfo = { ...list[index]!, status: "active", time: { ...list[index]!.time, updated: Date.now() } }
list[index] = updated
return Effect.succeed({ data: updated })
}),
automationDelete: (ctx) =>
Effect.suspend(() => {
const list = config.automations ?? []
const index = list.findIndex((item) => item.id === ctx.params.automationID)
if (index === -1) return Effect.fail(new MockNotFound({ message: `Automation not found: ${ctx.params.automationID}` }))
list.splice(index, 1)
return noContent
}),
worktreeList: () =>
Effect.sync(() => {
if (config.worktrees) return resolve(config.worktrees)
@ -1477,20 +1409,10 @@ function mockHandlers(
if (update.title !== undefined) session.title = update.title
if (update.archived !== undefined) {
const archived = update.archived ? Date.now() : undefined
session.time = { ...currentSession(session, config.directory).time, archived }
// Like the server, so sessions the client already loaded change section too.
state.emit([
{
id: `evt_${update.archived ? "archived" : "unarchived"}_${session.id}_${archived ?? Date.now()}`,
created: archived ?? Date.now(),
type: update.archived ? "session.archived" : "session.unarchived",
durable: { aggregateID: session.id, seq: 1, version: 1 },
location: { directory: requestDirectory(config, ctx.request) },
data: { sessionID: session.id },
},
])
session.time = {
...currentSession(session, config.directory).time,
archived: update.archived ? Date.now() : undefined,
}
}
}).pipe(Effect.andThen(noContent)),
sessionCommand: (ctx) => {
@ -1502,11 +1424,8 @@ function mockHandlers(
Effect.andThen(noContent),
)
},
// Like the server: an idle session has nothing running to interrupt.
sessionInterrupt: (ctx) =>
Effect.succeed({
interrupted: resolve(config.sessionStatus ?? {})[ctx.params.sessionID]?.type === "running",
}),
// Like the server for an idle session: nothing was running to interrupt.
sessionInterrupt: () => Effect.succeed({ interrupted: false }),
// The mock runs no agent loop, so every session is already idle.
sessionWait: () => noContent,
sessionRevertStage: (ctx) => {

View file

@ -8,13 +8,7 @@ import { PlatformProvider, type Platform } from "../../src/runtime/platform/plat
// The app on a Windows desktop platform, so the titlebar shows the app menu. Menu actions are listed in an output.
// `path` opens a route other than Home. `holdOpen` records an opened path but never answers, like an editor that keeps
// the launch running until it exits.
export function mount(input: {
server: string
path?: string
os?: "macos" | "linux"
openApps?: boolean
holdOpen?: boolean
}) {
export function mount(input: { server: string; path?: string; os?: "macos"; openApps?: boolean; holdOpen?: boolean }) {
const root = document.getElementById("root")
if (!root) throw new Error("Missing fixture root")

View file

@ -9,11 +9,10 @@
<script type="module">
import { mount } from "./windows-menu.fixture.tsx"
const params = new URLSearchParams(location.search)
const os = params.get("os")
mount({
server: params.get("server"),
path: params.get("path") ?? undefined,
os: os === "macos" || os === "linux" ? os : undefined,
os: params.get("os") === "macos" ? "macos" : undefined,
openApps: params.get("openApps") === "1",
holdOpen: params.get("holdOpen") === "1",
})

View file

@ -1,6 +1,6 @@
{
"name": "@opencode/app",
"version": "2.4.1",
"version": "2.4.0",
"description": "",
"type": "module",
"exports": {
@ -21,9 +21,9 @@
"build": "vite build",
"serve": "vite preview",
"test": "bun run test:unit && bun run test:browser",
"test:unit": "bun test --conditions=browser --only-failures --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:unit": "bun test --conditions=solid --only-failures --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:browser": "bun test --conditions=browser --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./test-browser",
"test:unit:watch": "bun test --conditions=browser --watch --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:unit:watch": "bun test --conditions=solid --watch --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts ./src",
"test:e2e": "playwright test",
"test:e2e:built": "PLAYWRIGHT_BUILD=1 playwright test",
"test:e2e:local": "playwright test",
@ -59,6 +59,7 @@
"@dnd-kit/abstract": "0.5.0",
"@dnd-kit/dom": "0.5.0",
"@dnd-kit/solid": "0.5.0",
"@ibm/plex": "6.4.1",
"@kobalte/core": "catalog:",
"@opencode/client": "workspace:*",
"@opencode/schema": "workspace:*",

View file

@ -19,6 +19,7 @@ build on the e2e mock server, so they need no backend.
| `docks.bench.ts` | open and close request docks | A permission dock and an MCP elicitation over a 20-turn session. |
| `subagent-pill.bench.ts` | scroll pill static · scroll pill with live events | 20 long-running subagents in the background activity popover. |
| `send.bench.ts` | send a prompt | Enter until the prompt request reaches the server, 20 turns. |
| `question.bench.ts` | switch questions | The new question dock with its motion on: five questions. |
| `desktop.bench.ts` | idle | The packaged desktop app, every process, doing nothing for 5 s. |
Every case decides `main.work` (renderer main-thread task time per run) unless it says otherwise: it is continuous,

View file

@ -24,9 +24,10 @@ export function scriptTools(): SessionMessageAssistant["content"] {
content: [{ type: "text", text: `${count} files` }],
metadata: {
toolCalls: Array.from({ length: count }, (_, call) => ({
tool: "read",
tool: "Bun",
status: "completed",
input: {
method: "file",
path: `C:/OpenCode/TimelineStateRegression/packages/app/src/module-${script}-${call}.ts`,
},
})),

View file

@ -0,0 +1,85 @@
// The new question dock with its motion on: five questions, switched with the arrow keys while each switch is still
// moving, so the frame loop steps the switch, the dock's heights and the footer every frame. At 1440×900.
import { bench, web } from "@hona/strobe"
import { sessionHref } from "../e2e/utils/app"
import { mockOpenCodeServer } from "../e2e/utils/mock-server"
import { fixture } from "../e2e/utils/session-fixture"
import { cached } from "./fixtures/mock"
const sessionID = "ses_perf_question"
const question = '[data-component="dock-prompt"][data-kind="question"]'
const title = `${question} [data-slot="question-header-title"]`
export default bench({
targets: {
web: web({
expect: { title: "OpenCode" },
viewport: { width: 1440, height: 900 },
async prepare(ctx) {
const { url } = ctx
const server = new URL(url).origin
const page = cached(ctx)
await mockOpenCodeServer(page, {
server,
directory: fixture.directory,
project: fixture.project,
provider: fixture.provider,
sessions: [{ ...fixture.sessions[0], id: sessionID, title: "Question workload" }],
pageMessages: () => ({ items: [] }),
forms: [
{
id: "frm_perf_question",
sessionID,
title: "Questions",
metadata: { kind: "question" },
fields: Array.from({ length: 5 }, (_, index) => ({
key: `q${index}`,
type: index % 2 ? "multiselect" : "string",
title: `Question ${index + 1}`,
description: `Question ${index + 1}: ${"Which of these should the change keep as it is? ".repeat(index + 1)}`,
options: Array.from({ length: 3 + index }, (_, option) => ({
value: `option-${option}`,
label: `Option ${option + 1}`,
description: "Keeps the current behavior and adds coverage for it.",
})),
custom: true,
})),
},
],
})
await page.addInitScript(() => {
localStorage.setItem("settings.v3", JSON.stringify({ general: { newQuestionUI: true } }))
localStorage.setItem("opencode.motion.v2", JSON.stringify({ "question.motion": 1 }))
})
return { path: sessionHref(sessionID, server) }
},
url: ({ prepared }) => prepared.path,
}),
},
async setup({ page }) {
await page.waitFor(`${question} [data-slot="question-option"]:focus`, { timeout: 60_000 })
await page.idle()
},
cases: {
// Four switches on and four back, each key a frame into the last switch.
"switch questions": {
primary: "main.work",
metrics: ["frames.dropped.pct"],
async run({ page }) {
for (const key of ["ArrowRight", "ArrowRight", "ArrowRight", "ArrowRight"])
await page.press(key, { until: "frame" })
await page.waitFor(title, { text: "5 of 5 questions" })
for (const key of ["ArrowLeft", "ArrowLeft", "ArrowLeft", "ArrowLeft"]) await page.press(key, { until: "frame" })
await page.waitFor(title, { text: "1 of 5 questions" })
await page.idle()
},
},
},
})

Some files were not shown because too many files have changed in this diff Show more