diff --git a/.gitattributes b/.gitattributes index 8e1fcf5679..e620e43d37 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,8 @@ packages/client/src/effect/generated/** linguist-generated packages/client/src/effect/api/** linguist-generated packages/core/src/**/*.txt 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 + +CHANGELOG.md merge=ours +README.*.md merge=ours diff --git a/packages/console/app/src/asset/logo-ornate-dark.svg b/.github/assets/logo-ornate-dark.svg similarity index 100% rename from packages/console/app/src/asset/logo-ornate-dark.svg rename to .github/assets/logo-ornate-dark.svg diff --git a/packages/console/app/src/asset/logo-ornate-light.svg b/.github/assets/logo-ornate-light.svg similarity index 100% rename from packages/console/app/src/asset/logo-ornate-light.svg rename to .github/assets/logo-ornate-light.svg diff --git a/.github/release/cloudflare-token.sh b/.github/release/cloudflare-token.sh new file mode 100755 index 0000000000..bc8e59d80c --- /dev/null +++ b/.github/release/cloudflare-token.sh @@ -0,0 +1,110 @@ +#!/usr/bin/env bash +# Mints a short-lived Cloudflare token for the current job from the token issuer +# (anomalyco/secrets). Run after aws-actions/configure-aws-credentials has assumed +# arn:aws:iam::604439173067:role/github/opencode- (release, dev or production): the Lambda +# identifies the role from the SigV4 signature and mints only that stage's token. No repo, stage, +# permission or TTL is sent in the request, and the token is pinned to the runner's IP. +# +# Step-scoped by default: the token goes to $GITHUB_OUTPUT and only steps that list +# `CLOUDFLARE_API_TOKEN: ${{ steps..outputs.token }}` in their env receive it. +set -euo pipefail +set +x + +url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/} +account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968} + +# One argv value, never a line in curl's config: a newline in an override must not be able to +# inject curl options or move the AWS credentials into Basic auth. +url_pattern='^https://[a-z0-9]+\.lambda-url\.us-east-1\.on\.aws/$' +if ! [[ "$url" =~ $url_pattern ]]; then + echo "::error::CLOUDFLARE_TOKEN_URL is not the token issuer's function URL." >&2 + exit 1 +fi +case "$account" in + *[!0-9a-f]*|"") + echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2 + exit 1 + ;; +esac +if [ ${#account} -ne 32 ]; then + echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2 + exit 1 +fi +for name in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do + if [ -z "${!name:-}" ]; then + echo "::error::$name is not set; run aws-actions/configure-aws-credentials first." >&2 + exit 1 + fi +done + +# The response is captured, never streamed: it contains the token. AWS credentials go to curl +# through stdin, not argv, so they stay out of `ps` and any trace of this script. +response=$( + printf 'user = "%s:%s"\nheader = "x-amz-security-token: %s"\n' \ + "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$AWS_SESSION_TOKEN" | + curl --config - \ + --proto '=https' --proto-redir '=https' \ + --aws-sigv4 "aws:amz:us-east-1:lambda" \ + --request POST --url "$url" \ + --fail-with-body --silent --show-error --max-time 20 +) + +token=$(printf '%s' "$response" | jq -er 'if (.token | type) == "string" then .token else error("token") end' 2>/dev/null) +expires=$(printf '%s' "$response" | jq -er 'if (.expires_on | type) == "string" then .expires_on else error("expires_on") end' 2>/dev/null) + +# Validate before any output. No error below includes the token value. +case "$token" in + ""|*[[:space:]]*) + echo "::error::The token issuer returned an invalid token." >&2 + exit 1 + ;; +esac +if [ ${#token} -lt 8 ] || [ ${#token} -gt 512 ]; then + echo "::error::The token issuer returned an invalid token length." >&2 + exit 1 +fi +case "$expires" in + ""|*[[:space:]]*) + echo "::error::The token issuer returned an invalid expires_on." >&2 + exit 1 + ;; +esac +iso_pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z$' +if ! printf '%s' "$response" | jq -e --arg re "$iso_pattern" '(.expires_on | type) == "string" and (.expires_on | test($re))' > /dev/null; then + echo "::error::The token issuer returned an invalid expires_on." >&2 + exit 1 +fi +if ! [[ "$expires" =~ $iso_pattern ]]; then + echo "::error::The token issuer returned an invalid expires_on." >&2 + exit 1 +fi + +# GitHub masks the exact string everywhere after this, including accidental traces and our own +# error messages. This is the first output that contains it. +printf '::add-mask::%s\n' "$token" + +if [ -n "${GITHUB_OUTPUT:-}" ]; then + { + printf 'token=%s\n' "$token" + printf 'expires_on=%s\n' "$expires" + } >> "$GITHUB_OUTPUT" +elif [ -n "${GITHUB_ENV:-}" ]; then + printf 'CLOUDFLARE_API_TOKEN=%s\n' "$token" >> "$GITHUB_ENV" +fi + +# Verify immediately, with the token on curl's stdin rather than argv. A runner whose Cloudflare +# egress address differs from the address Lambda saw (IPv4 vs IPv6, or a different NAT address) +# fails here instead of part way through an upload. +verify_url="https://api.cloudflare.com/client/v4/accounts/$account/tokens/verify" +if ! verify=$(printf 'header = "Authorization: Bearer %s"\nurl = "%s"\n' "$token" "$verify_url" | + curl --config - --proto '=https' --proto-redir '=https' --silent --show-error --fail-with-body --max-time 20); then + echo "::error::Cloudflare rejected the freshly minted token. The runner's egress IP to Cloudflare may differ from the IP Lambda saw (IPv4 vs IPv6 or a different NAT address). Use a runner with stable egress." >&2 + exit 1 +fi + +if ! printf '%s' "$verify" | jq -e '.success == true and .result.status == "active"' > /dev/null; then + echo "::error::Cloudflare did not report the freshly minted token as active." >&2 + exit 1 +fi + +echo "::notice::Cloudflare token ready; expires $expires" diff --git a/.github/release/lib.sh b/.github/release/lib.sh index a85f5ad844..9b5414c504 100644 --- a/.github/release/lib.sh +++ b/.github/release/lib.sh @@ -90,6 +90,8 @@ r2_credentials() { export AWS_ACCESS_KEY_ID="$id" AWS_SECRET_ACCESS_KEY=$(printf '%s' "$CLOUDFLARE_API_TOKEN" | sha256 | cut -c1-64) export AWS_SECRET_ACCESS_KEY + # These are R2's own credentials, so drop the role credentials the job assumed to read Secrets Manager. + unset AWS_SESSION_TOKEN AWS_PROFILE AWS_REGION export AWS_DEFAULT_REGION=auto AWS_REQUEST_CHECKSUM_CALCULATION=when_required AWS_RESPONSE_CHECKSUM_VALIDATION=when_required # Larger parts mean fewer CompleteMultipartUpload parts for the 200-350 MB desktop builds. AWS_CONFIG_FILE=$(mktemp) diff --git a/.github/release/publish-npm.sh b/.github/release/publish-npm.sh index ed63a4a0aa..67163d839b 100755 --- a/.github/release/publish-npm.sh +++ b/.github/release/publish-npm.sh @@ -44,10 +44,12 @@ for file in "${files[@]}"; do done for name in $expected; do cut -f1 "$list" | grep -qxF -- "$name" || die "Missing package $name"; done -# The CLI wrappers resolve their platform packages, so they publish last. -order=$(mktemp) -{ grep -vP '^@opencode/cli(-node)?\t' "$list" || true; grep -P '^@opencode/cli(-node)?\t' "$list"; } > "$order" -cat "$order" +# The CLI wrappers resolve their platform packages from postinstall, so they publish last. +packages=$(mktemp) +wrappers=$(mktemp) +grep -vP '^@opencode/cli(-node)?\t' "$list" > "$packages" || true +grep -P '^@opencode/cli(-node)?\t' "$list" > "$wrappers" || true +cat "$packages" "$wrappers" # A clean directory and config, so nothing from an artifact can redirect the registry. printf 'registry=https://registry.npmjs.org/\n' > "$RUNNER_TEMP/npmrc" @@ -55,10 +57,33 @@ export NPM_CONFIG_USERCONFIG="$RUNNER_TEMP/npmrc" cd "$(mktemp -d)" flags=(--tag "$OPENCODE_NPM_TAG" --access public --ignore-scripts) if dry_run; then flags+=(--dry-run); else flags+=(--provenance); fi -while IFS=$'\t' read -r name file; do - if ! dry_run && npm view "$name@$OPENCODE_VERSION" version > /dev/null 2>&1; then - echo "already published $name@$OPENCODE_VERSION" - continue - fi - npm publish "$file" "${flags[@]}" -done < "$order" + +publish() { + while IFS=$'\t' read -r name file; do + if ! dry_run && npm view "$name@$OPENCODE_VERSION" version > /dev/null 2>&1; then + echo "already published $name@$OPENCODE_VERSION" + continue + fi + npm publish "$file" "${flags[@]}" + done < "$1" +} + +# npm publish returns while the registry is still processing the version: a large platform tarball can take ten +# minutes to become available, and versions appear out of publish order. A wrapper published in that window makes +# its postinstall fail with ETARGET, and rolling the dist-tag back does not repair an install that already failed, +# so wait for every other package to resolve at this version before publishing the wrappers. +wait_for_registry() { + if dry_run; then return; fi + while IFS= read -r name; do + for attempt in $(seq 1 180); do + if npm view --prefer-online "$name@$OPENCODE_VERSION" version > /dev/null 2>&1; then break; fi + if [ "$attempt" = 180 ]; then die "$name@$OPENCODE_VERSION did not appear in the registry"; fi + echo "waiting for $name@$OPENCODE_VERSION" + sleep 10 + done + done < <(cut -f1 "$1") +} + +publish "$packages" +wait_for_registry "$packages" +publish "$wrappers" diff --git a/.github/release/render-winget.sh b/.github/release/render-winget.sh index b36e7e90ba..92c0f18e27 100755 --- a/.github/release/render-winget.sh +++ b/.github/release/render-winget.sh @@ -25,7 +25,7 @@ manifests() { "PublisherSupportUrl: https://github.com/anomalyco/opencode/issues" "PrivacyUrl: https://opencode.ai/legal/privacy-policy" \ "PackageName: $name" "PackageUrl: https://opencode.ai/" "License: MIT" "LicenseUrl: https://github.com/anomalyco/opencode/blob/HEAD/LICENSE" \ "ShortDescription: $description" "Moniker: $moniker" "Tags:" "- ai" "- coding-agent" "- developer-tools" \ - "Documentations:" "- DocumentLabel: Docs" " DocumentUrl: https://opencode.ai/v2/docs" + "Documentations:" "- DocumentLabel: Docs" " DocumentUrl: https://opencode.ai/docs" footer defaultLocale } > "$out/$id/$id.locale.en-US.yaml" } diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml new file mode 100644 index 0000000000..a065382882 --- /dev/null +++ b/.github/workflows/check-docs.yml @@ -0,0 +1,42 @@ +name: check-docs + +# Builds the V2 docs on their own (services/site/src/docs/script/build.ts): compiles every MDX page, +# prerenders it, builds search, checks every link and that pages load nothing from outside /docs. The +# site's deploy runs the same step, so a broken page fails here instead of blocking the deploy. +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - services/site/** + - packages/protocol/openapi.json + - packages/cli/src/config/** + - .github/workflows/check-docs.yml + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + docs: + name: docs build + if: ${{ !github.event.pull_request.draft }} + runs-on: blacksmith-4vcpu-ubuntu-2404 + timeout-minutes: 10 + defaults: + run: + working-directory: services/site + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - uses: ./.github/actions/setup-bun + + # The API reference and the config schema the pages link (/docs/openapi.json, /v2/cli.json). + - name: Generate + run: bun run generate + + - name: Build docs + run: bun src/docs/script/build.ts --out "$RUNNER_TEMP/docs" diff --git a/.github/workflows/deploy-changelog.yml b/.github/workflows/deploy-changelog.yml deleted file mode 100644 index 5b32ef2041..0000000000 --- a/.github/workflows/deploy-changelog.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: deploy-changelog - -on: - push: - branches: - - dev - paths: - - services/changelog/** - - .github/workflows/deploy-changelog.yml - workflow_dispatch: - -concurrency: - group: deploy-changelog - cancel-in-progress: false - -permissions: - contents: read - -jobs: - deploy: - if: github.repository == 'anomalyco/opencode' && github.ref_name == 'dev' - runs-on: blacksmith-4vcpu-ubuntu-2404 - environment: dev - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - - - uses: ./.github/actions/setup-bun - - - name: Typecheck - working-directory: services/changelog - run: bun run typecheck:tsc - - - name: Test - working-directory: services/changelog - run: bun test - - - name: Deploy - working-directory: services/changelog - run: bun run deploy - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/deploy-files.yml b/.github/workflows/deploy-files.yml index 0bf8b81500..d26dcbbb5d 100644 --- a/.github/workflows/deploy-files.yml +++ b/.github/workflows/deploy-files.yml @@ -19,6 +19,9 @@ jobs: if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production') runs-on: blacksmith-4vcpu-ubuntu-2404 environment: ${{ github.ref_name }} + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 @@ -28,8 +31,25 @@ jobs: working-directory: services/files run: bun run typecheck:tsc + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 + with: + role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }} + role-session-name: opencode-${{ github.run_id }} + aws-region: us-east-1 + + # A 15-minute token for this stage's Workers only, minted by the token issuer (anomalyco/secrets) from the role + # above. It is a step output, so only the Deploy step gets it. + - name: Cloudflare token + id: cloudflare-token + run: bash .github/release/cloudflare-token.sh + env: + CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} + + # wrangler.jsonc has no account id, and the token can't list accounts. - name: Deploy working-directory: services/files run: bun run deploy --env ${{ github.ref_name == 'production' && 'production' || 'dev' }} env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968 + CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }} diff --git a/.github/workflows/deploy-posts.yml b/.github/workflows/deploy-posts.yml deleted file mode 100644 index bb95efe256..0000000000 --- a/.github/workflows/deploy-posts.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: deploy-posts - -on: - push: - branches: - - production - paths: - - packages/posts/** - - bun.lock - - .github/workflows/deploy-posts.yml - workflow_dispatch: - -concurrency: - group: deploy-posts-${{ github.ref_name }} - cancel-in-progress: false - -permissions: - contents: read - -jobs: - deploy: - if: github.repository == 'anomalyco/opencode' && github.ref_name == 'production' - runs-on: blacksmith-4vcpu-ubuntu-2404 - environment: production - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - - - uses: ./.github/actions/setup-bun - - - name: Build - working-directory: packages/posts - run: bun run build - - - name: Deploy - working-directory: packages/posts - run: bun run deploy - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000000..7e9735bf62 --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,57 @@ +name: deploy-site + +on: + push: + branches: + - dev + - production + workflow_dispatch: + +concurrency: + group: deploy-site-${{ github.ref_name }} + cancel-in-progress: false + +permissions: + contents: read + +jobs: + deploy: + if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production') + runs-on: blacksmith-4vcpu-ubuntu-2404 + environment: ${{ github.ref_name }} + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - uses: ./.github/actions/setup-bun + + # The workflow's own token, at build time only: script/github-snapshot.ts records the repo + # numbers and releases the site falls back to. The Worker never gets a GitHub token. + - name: Build + working-directory: services/site + run: bun script/build.ts --mode ${{ github.ref_name }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 + with: + role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }} + role-session-name: opencode-${{ github.run_id }} + aws-region: us-east-1 + + # A 15-minute token for this stage's Workers only, minted by the token issuer (anomalyco/secrets) from the role + # above. It is a step output, so only the Deploy step gets it. + - name: Cloudflare token + id: cloudflare-token + run: bash .github/release/cloudflare-token.sh + env: + CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} + + - name: Deploy + working-directory: services/site + run: bunx cf deploy --prebuilt --mode ${{ github.ref_name }} + env: + CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }} diff --git a/.github/workflows/deploy-update.yml b/.github/workflows/deploy-update.yml index af40d9f62d..621d96e08d 100644 --- a/.github/workflows/deploy-update.yml +++ b/.github/workflows/deploy-update.yml @@ -18,6 +18,9 @@ jobs: if: github.repository == 'anomalyco/opencode' && github.ref_name == 'production' runs-on: blacksmith-4vcpu-ubuntu-2404 environment: production + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 @@ -27,8 +30,25 @@ jobs: working-directory: services/update run: bun run typecheck:tsc + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 + with: + role-to-assume: arn:aws:iam::604439173067:role/github/opencode-production + role-session-name: opencode-${{ github.run_id }} + aws-region: us-east-1 + + # A 15-minute token for the production Workers only, minted by the token issuer (anomalyco/secrets) from the role + # above. It is a step output, so only the Deploy step gets it. + - name: Cloudflare token + id: cloudflare-token + run: bash .github/release/cloudflare-token.sh + env: + CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} + + # wrangler.jsonc has no account id, and the token can't list accounts. - name: Deploy working-directory: services/update run: bun run deploy env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968 + CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }} diff --git a/.github/workflows/deploy-www.yml b/.github/workflows/deploy-www.yml deleted file mode 100644 index 45f4cbebec..0000000000 --- a/.github/workflows/deploy-www.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: deploy-www - -on: - push: - branches: - - dev - - production - workflow_dispatch: - -concurrency: - group: deploy-www-${{ github.ref_name }} - cancel-in-progress: false - -permissions: - contents: read - -jobs: - deploy: - if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production') - runs-on: blacksmith-4vcpu-ubuntu-2404 - environment: ${{ github.ref_name }} - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - - - uses: ./.github/actions/setup-bun - - - name: Build - working-directory: services/www - run: bun run build - env: - CLOUDFLARE_ENV: ${{ github.ref_name == 'production' && 'production' || 'dev' }} - - - name: Deploy - working-directory: services/www - run: bun run deploy - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml deleted file mode 100644 index 056c89cb96..0000000000 --- a/.github/workflows/release-dry-run.yml +++ /dev/null @@ -1,733 +0,0 @@ -name: release-dry-run -run-name: "${{ format('release {0}{1}', inputs.bump, inputs.version) }}" - -# Builds are separated from signing and publishing. -# - build-* jobs run repository code (`bun run build`, `bun run pack`) with no environment, secrets or id-token. -# - sign-* and publish-* jobs run in the release environment, check out only .github/release/, and run those -# scripts on verified artifacts, which they treat as data. They never execute repository code. -# - plan decides version, channel and npm dist-tag from the event, inputs and ref; only a dispatch with a bump or -# version on dev reaches latest. -# .github/release/ and this file are the security boundary for releases. - -# TEMPORARY copy of release.yml for this PR's dry run: GitHub does not start runs for the release.yml path on -# pull requests (it is the old name of publish.yml). Delete before merging. -on: - pull_request: - paths: [.github/workflows/release.yml, .github/workflows/release-dry-run.yml, .github/release/**] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ (inputs.bump || inputs.version) && 'release' || 'build' }} - # Beta ships only the newest commit to the team. A cancelled beta run can leave unreferenced files in R2, but only - # publish-desktop records a release, in one request. - cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref_name == 'beta' }} - -permissions: - contents: read - -defaults: - run: - shell: bash - -jobs: - plan: - if: github.repository == 'anomalyco/opencode' - runs-on: ubuntu-24.04 - permissions: {} - outputs: - version: ${{ steps.plan.outputs.version }} - channel: ${{ steps.plan.outputs.channel }} - npm_tag: ${{ steps.plan.outputs.npm_tag }} - dry_run: ${{ steps.plan.outputs.dry_run }} - cli: ${{ steps.plan.outputs.cli }} - desktop: ${{ steps.plan.outputs.desktop }} - node: ${{ steps.plan.outputs.node }} - release: ${{ steps.plan.outputs.release }} - steps: - - &checkout-release - 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: plan - name: Plan - run: bash .github/release/plan-release.sh - env: - INPUT_BUMP: ${{ inputs.bump }} - INPUT_VERSION: ${{ inputs.version }} - - # A versioned release builds from a commit with its versions and changelog on the dispatched dev commit, - # tagged v. Runs git only. - tag: - needs: plan - runs-on: ubuntu-24.04 - permissions: - contents: write - env: &env - OPENCODE_VERSION: ${{ needs.plan.outputs.version }} - OPENCODE_CHANNEL: ${{ needs.plan.outputs.channel }} - OPENCODE_NPM_TAG: ${{ needs.plan.outputs.npm_tag }} - OPENCODE_DRY_RUN: ${{ needs.plan.outputs.dry_run }} - outputs: - sha: ${{ steps.tag.outputs.sha || github.sha }} - steps: - - name: Check out - if: needs.plan.outputs.channel == 'latest' - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - id: tag - name: Tag - if: needs.plan.outputs.channel == 'latest' - run: bash .github/release/tag-release.sh - env: - OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} - - # ---- Build: repository code; no environment, secrets or id-token -------------------------------------------- - - # Fetches the models.dev catalog once per run, so every CLI bundles the same copy. - models-catalog: - needs: [plan, tag] - runs-on: blacksmith-4vcpu-ubuntu-2404 - timeout-minutes: 10 - env: *env - steps: - - &checkout - name: Check out - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - ref: ${{ needs.tag.outputs.sha }} - persist-credentials: false - - name: Set up Bun - uses: ./.github/actions/setup-bun - - name: Fetch - run: bun packages/core/script/update-models-snapshot.ts .cache/models-catalog/api.json - - name: Upload - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: models-catalog - path: .cache/models-catalog/api.json - if-no-files-found: error - - build-cli: - needs: [plan, tag, models-catalog] - runs-on: blacksmith-4vcpu-ubuntu-2404 - timeout-minutes: 30 - env: *env - steps: - - *checkout - - name: Set up Bun - uses: ./.github/actions/setup-bun - with: - bun-version: 1.4.4 - - &download-models-catalog - name: Download models catalog - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - name: models-catalog - path: .cache/models-catalog - - name: Build - working-directory: packages/cli - run: bun run build && rm -rf dist/.bun - env: - BUN_COMPILE_RELEASE: bun-v1.4.4 - OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json - OPENCODE_RELEASE_NOTES: ${{ needs.plan.outputs.channel == 'latest' && inputs.release_notes || '' }} - GH_TOKEN: ${{ github.token }} # read-only; raises the rate limit for Bun release downloads - - name: Verify bundled models catalog - run: bun packages/cli/script/catalog-smoke.ts packages/cli/dist/cli-linux-x64/bin/opencode - env: - OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json - - name: Upload - uses: ./.github/release/upload - with: - name: build-cli - path: packages/cli/dist - - build-node: - needs: [plan, tag, models-catalog] - if: needs.plan.outputs.node == 'true' - strategy: - fail-fast: false - matrix: - include: - - { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm } - - { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 } - - { target: darwin-arm64, host: macos-26 } - - { target: windows-arm64, host: blacksmith-4vcpu-windows-2025 } - - { target: windows-x64, host: blacksmith-4vcpu-windows-2025 } - runs-on: ${{ matrix.host }} - env: *env - steps: - - *checkout - - name: Set up Bun - uses: ./.github/actions/setup-bun - - name: Set up Node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: "26.4.0" - - *download-models-catalog - - name: Build - working-directory: packages/cli - run: bun run build:node - env: - OPENCODE_TARGET: ${{ matrix.target }} - OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json - - name: Test - if: matrix.target != 'windows-arm64' - working-directory: packages/cli - run: bun run script/service-smoke.ts --node - - name: Verify bundled models catalog - if: matrix.target != 'windows-arm64' - run: bun packages/cli/script/catalog-smoke.ts "packages/cli/dist/node/cli-node-$OPENCODE_TARGET/bin/opencode2-node$EXE" - env: - OPENCODE_TARGET: ${{ matrix.target }} - EXE: ${{ startsWith(matrix.target, 'windows') && '.exe' || '' }} - OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json - - name: Upload - uses: ./.github/release/upload - with: - name: build-node-${{ matrix.target }} - path: packages/cli/dist/node - - # `bun run pack` packs every npm package into dist/npm and the Linux and Node CLI archives into dist/archives. - # The macOS and Windows CLI packages and archives are re-packed after signing. - build-npm: - needs: [plan, tag, build-cli, build-node] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }} - runs-on: blacksmith-4vcpu-ubuntu-2404 - timeout-minutes: 30 - env: *env - steps: - - *checkout - - name: Set up Bun - uses: ./.github/actions/setup-bun - - &download-cli - name: Download - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - name: build-cli - path: packages/cli/dist - - name: Download Node CLI - if: needs.plan.outputs.node == 'true' - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - pattern: build-node-* - path: packages/cli/dist/node - merge-multiple: true - - name: Pack - run: rm packages/cli/dist/SHA256SUMS && bun run pack - - name: Upload - uses: ./.github/release/upload - with: - name: build-npm - path: dist/npm - - name: Upload archives - uses: ./.github/release/upload - with: - name: build-archives - path: dist/archives - - build-docker: - needs: [plan, tag, build-cli] - if: needs.plan.outputs.release == 'true' - runs-on: blacksmith-4vcpu-ubuntu-2404 - env: *env - steps: - - *checkout - - *download-cli - - name: Set up QEMU - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 - - name: Set up Buildx - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - - name: Set up Bun - uses: ./.github/actions/setup-bun - - name: Pack - working-directory: packages/cli - run: bun run pack:docker - - name: Upload - uses: ./.github/release/upload - with: - name: build-docker - path: dist/docker - - # macOS and Windows pack an unsigned app; Linux packs the final AppImage, deb and rpm. - # Dev and beta package macOS x64 on Apple Silicon and Windows arm64 on Blacksmith for speed. electron-builder's - # afterPack rejects a bundle whose CLI or node-pty does not match the target CPU. - build-desktop: - needs: [plan, tag, build-cli] - if: needs.plan.outputs.desktop == 'true' - permissions: - contents: read - pull-requests: read # beta builds read who made each change and what it does for "What's new in beta" - strategy: - fail-fast: false - matrix: - include: - - target: darwin-x64 - host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'macos-26' || 'macos-26-intel' }} - install: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && '--os=darwin --cpu=*' || '--os=darwin --cpu=x64' }} - - { target: darwin-arm64, host: macos-26, install: --os=darwin --cpu=arm64 } - # github-hosted: blacksmith lacks the ARM64 MSVC cross-compilation toolchain - - target: windows-arm64 - host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }} - install: --cpu=* - - { target: windows-x64, host: blacksmith-4vcpu-windows-2025 } - - { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 } - - { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm } - runs-on: ${{ matrix.host }} - env: *env - steps: - - *checkout - - *download-cli - - name: Set up Bun - uses: ./.github/actions/setup-bun - with: - install-flags: ${{ matrix.install }} - - name: Set up rpm - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends rpm - # The beta build embeds the subjects of its newest commits for "What's new in beta" - # (packages/desktop/script/beta-notes.ts). Commits without file contents are enough. - - name: Fetch beta history - if: needs.plan.outputs.channel == 'beta' - run: git fetch --no-tags --filter=blob:none --depth=300 origin "$SHA" - env: - SHA: ${{ needs.tag.outputs.sha }} - # Dev and beta trade larger packages for faster packaging. fpm sets XZ_OPT for the deb and rpm level, but xz - # still reads XZ_DEFAULTS, so it uses every CPU. - - name: Preview packaging settings - if: (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && runner.os == 'Linux' - run: echo "XZ_DEFAULTS=-T0" >> "$GITHUB_ENV" - - name: Build - working-directory: packages/desktop - run: bun run build - env: - OPENCODE_TARGET: ${{ matrix.target }} - NODE_OPTIONS: --max-old-space-size=4096 - VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }} - VITE_SENTRY_ENVIRONMENT: ${{ needs.plan.outputs.channel == 'latest' && 'production' || needs.plan.outputs.channel }} - VITE_SENTRY_RELEASE: desktop@${{ needs.plan.outputs.version }} - GITHUB_TOKEN: ${{ github.token }} # read-only; beta notes read pull request authors and descriptions - - name: Pack - working-directory: packages/desktop - timeout-minutes: 60 - run: bun run pack - env: - OPENCODE_TARGET: ${{ matrix.target }} - - name: Upload - uses: ./.github/release/upload - with: - name: build-desktop-${{ matrix.target }} - path: dist/desktop - - # Packs the NSIS installer around the signed app. This runs repository config, so it is a build job; the - # installer is signed next. - build-desktop-windows-installer: - needs: [plan, tag, sign-windows] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }} - strategy: - fail-fast: false - matrix: - include: - - target: windows-arm64 - host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }} - install: --cpu=* - - { target: windows-x64, host: blacksmith-4vcpu-windows-2025 } - runs-on: ${{ matrix.host }} - env: *env - steps: - - *checkout - - name: Set up Bun - uses: ./.github/actions/setup-bun - with: - install-flags: ${{ matrix.install }} - - name: Download - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - name: sign-desktop-${{ matrix.target }} - path: ${{ runner.temp }}/app - - name: Pack - working-directory: packages/desktop - timeout-minutes: 30 - run: bun run pack - env: - OPENCODE_TARGET: ${{ matrix.target }} - OPENCODE_DESKTOP_APP: ${{ runner.temp }}/app/app - - name: Upload - uses: ./.github/release/upload - with: - name: build-desktop-windows-installer-${{ matrix.target }} - path: dist/desktop - - # ---- Sign: release environment; only .github/release/ is checked out ---------------------------------------- - # Pull requests run sign and publish jobs without an environment, so steps that need a secret skip or dry-run. - - # Signs the macOS CLI; signs the desktop apps inside-out, notarizes them in one submission, staples them, and - # only then builds the zip, dmg and .app.tar.gz from the stapled apps. - sign-macos: - needs: [plan, build-npm, build-desktop] - if: ${{ !cancelled() && !failure() && (needs.plan.outputs.cli == 'true' || needs.plan.outputs.desktop == 'true') }} - runs-on: macos-26 - timeout-minutes: 90 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - env: *env - outputs: - digest: ${{ steps.upload.outputs.digest }} - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{build-npm,build-desktop-darwin-*}" - # The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up - # the identity in build.keychain, and codesign finds the key through the user search list. - - name: Import certificate - if: needs.plan.outputs.dry_run != 'true' - run: | - cert="$RUNNER_TEMP/cert.p12" - keychain_password=$(openssl rand -base64 32) - printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert" - security create-keychain -p "$keychain_password" build.keychain - security set-keychain-settings -lut 21600 build.keychain - security unlock-keychain -p "$keychain_password" build.keychain - security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null - security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"') - rm -f "$cert" - env: - APPLE_SIGNING_CERTIFICATE: ${{ secrets.APPLE_SIGNING_CERTIFICATE }} - - name: Sign CLI - if: needs.plan.outputs.cli == 'true' - run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out" - - name: Sign desktop - if: needs.plan.outputs.desktop == 'true' - run: | - bash .github/release/sign-desktop-macos.sh "$RUNNER_TEMP/out" \ - "$RUNNER_TEMP"/in/build-desktop-darwin-*/opencode-desktop-mac-*.app.tar - env: - APPLE_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }} - APPLE_NOTARY_KEY_ID: ${{ vars.APPLE_NOTARY_KEY_ID }} - APPLE_NOTARY_ISSUER_ID: ${{ vars.APPLE_NOTARY_ISSUER_ID }} - - id: upload - name: Upload - uses: ./.github/release/upload - with: - name: sign-macos - path: ${{ runner.temp }}/out - - name: Delete keychain - if: always() && needs.plan.outputs.dry_run != 'true' - run: | - rm -f "$RUNNER_TEMP/cert.p12" - security delete-keychain build.keychain || true - - # Signs the Windows CLI and every executable and native module of the unpacked desktop apps. - sign-windows: - needs: [plan, build-npm, build-desktop] - if: ${{ !cancelled() && !failure() && (needs.plan.outputs.cli == 'true' || needs.plan.outputs.desktop == 'true') }} - runs-on: windows-2025 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - outputs: - digest: ${{ steps.upload.outputs.digest }} - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{build-npm,build-desktop-windows-*}" - - name: Unpack - run: bash .github/release/unpack-windows.sh "$RUNNER_TEMP/in" "$RUNNER_TEMP/work" - - &azure-login - name: Log in to Azure - if: needs.plan.outputs.dry_run != 'true' - uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - &azure-sign - name: Sign - if: needs.plan.outputs.dry_run != 'true' - uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0 - with: - endpoint: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }} - signing-account-name: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }} - certificate-profile-name: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }} - files-folder: ${{ runner.temp }}\work - files-folder-filter: exe,node - files-folder-recurse: true - exclude-environment-credential: true - exclude-workload-identity-credential: true - exclude-managed-identity-credential: true - exclude-shared-token-cache-credential: true - exclude-visual-studio-credential: true - exclude-visual-studio-code-credential: true - exclude-azure-cli-credential: false - exclude-azure-powershell-credential: true - exclude-azure-developer-cli-credential: true - exclude-interactive-browser-credential: true - - name: Repack - run: bash .github/release/repack-windows.sh "$RUNNER_TEMP/work" "$RUNNER_TEMP/out" - - id: upload - name: Upload - if: needs.plan.outputs.cli == 'true' - uses: ./.github/release/upload - with: - name: sign-windows - path: ${{ runner.temp }}/out - - name: Upload arm64 app - if: needs.plan.outputs.desktop == 'true' - uses: ./.github/release/upload - with: - name: sign-desktop-windows-arm64 - path: ${{ runner.temp }}/work/desktop-windows-arm64 - - name: Upload x64 app - if: needs.plan.outputs.desktop == 'true' - uses: ./.github/release/upload - with: - name: sign-desktop-windows-x64 - path: ${{ runner.temp }}/work/desktop-windows-x64 - - sign-desktop-windows-installer: - needs: [plan, build-desktop-windows-installer] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }} - runs-on: windows-2025 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - outputs: - digest: ${{ steps.upload.outputs.digest }} - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: build-desktop-windows-installer-* - - name: Unpack - run: mkdir -p "$RUNNER_TEMP/work" && cp "$RUNNER_TEMP"/in/build-desktop-windows-installer-*/*.exe "$RUNNER_TEMP/work/" - - *azure-login - - *azure-sign - - name: Repack - run: bash .github/release/repack-windows.sh "$RUNNER_TEMP/work" "$RUNNER_TEMP/out" - - id: upload - name: Upload - uses: ./.github/release/upload - with: - name: sign-desktop-windows-installer - path: ${{ runner.temp }}/work - - # ---- Publish: release environment; only .github/release/ is checked out ------------------------------------- - # Destinations, names and channels come from plan and the scripts, never from artifacts. - - # Build provenance for the npm tarballs and Linux archives. No secrets; id-token only for Sigstore. - publish-attestations: - needs: [plan, build-npm] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' && needs.plan.outputs.dry_run != 'true' }} - runs-on: ubuntu-24.04 - permissions: - contents: read - id-token: write - attestations: write - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{build-npm,build-archives}" - - name: Sign - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 - with: - subject-path: | - ${{ runner.temp }}/in/build-npm/*.tgz - ${{ runner.temp }}/in/build-archives/opencode* - - publish-npm: - needs: [plan, sign-macos, sign-windows, publish-attestations] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - attestations: read - env: *env - steps: - - *checkout-release - - name: Set up Node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: "24.11.0" - - &download-signed-cli - name: Download - uses: ./.github/release/download - with: - pattern: "{build-npm,build-archives,sign-macos,sign-windows}" - digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-windows=${{ needs.sign-windows.outputs.digest }} - - name: Publish - run: bash .github/release/publish-npm.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows" - env: - GH_TOKEN: ${{ github.token }} - - publish-cli: - needs: [plan, sign-macos, sign-windows, publish-npm] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - steps: - - *checkout-release - - *download-signed-cli - - name: Publish - run: bash .github/release/publish-cli.sh "$RUNNER_TEMP/in/build-archives" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows" - env: &cloudflare - CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968 - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - - publish-desktop: - needs: [plan, sign-macos, sign-desktop-windows-installer] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{sign-macos,sign-desktop-windows-installer,build-desktop-linux-*}" - digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }} - - name: Publish - run: | - bash .github/release/publish-desktop.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-desktop-windows-installer" \ - "$RUNNER_TEMP/in/build-desktop-linux-x64" "$RUNNER_TEMP/in/build-desktop-linux-arm64" - env: *cloudflare - - publish-docker: - needs: [plan, build-docker] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - packages: write - env: *env - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: build-docker - - name: Publish - run: bash .github/release/publish-docker.sh "$RUNNER_TEMP/in/build-docker" - env: - GH_TOKEN: ${{ github.token }} - - publish-homebrew: - needs: [plan, sign-macos, sign-windows, publish-cli] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - steps: - - *checkout-release - - *download-signed-cli - - name: Publish - run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives" - env: - HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }} - - # The AUR package installs the published npm tarballs, so it follows the npm publish. - publish-aur: - needs: [plan, sign-macos, sign-windows, publish-npm] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: read - id-token: write - env: *env - steps: - - *checkout-release - - *download-signed-cli - - name: Publish - run: bash .github/release/publish-aur.sh "$RUNNER_TEMP/in/build-npm" - env: - AUR_KEY: ${{ secrets.AUR_KEY }} - - # WinGet manifests as data. Submission to microsoft/winget-pkgs stays paused until the packages are accepted. - publish-winget: - needs: [plan, sign-windows, sign-desktop-windows-installer] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} - runs-on: ubuntu-24.04 - env: *env - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{sign-windows,sign-desktop-windows-installer}" - digests: sign-windows=${{ needs.sign-windows.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }} - - name: Render - run: bash .github/release/render-winget.sh "$RUNNER_TEMP/in/sign-windows" "$RUNNER_TEMP/in/sign-desktop-windows-installer" "$RUNNER_TEMP/out" - - name: Upload - uses: ./.github/release/upload - with: - name: publish-winget - path: ${{ runner.temp }}/out - - publish-github-release: - needs: [plan, sign-macos, sign-windows, sign-desktop-windows-installer, publish-cli, publish-desktop] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} - runs-on: ubuntu-24.04 - environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} - permissions: - contents: write - env: *env - steps: - - *checkout-release - - name: Download - uses: ./.github/release/download - with: - pattern: "{build-archives,build-desktop-linux-*,sign-macos,sign-windows,sign-desktop-windows-installer}" - digests: >- - sign-macos=${{ needs.sign-macos.outputs.digest }} sign-windows=${{ needs.sign-windows.outputs.digest }} - sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }} - - name: Publish - run: bash .github/release/publish-github-release.sh "$RUNNER_TEMP"/in/* - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} - - # Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR. - publish-version-pr: - needs: [plan, tag, publish-npm, publish-cli, publish-desktop, publish-github-release] - if: ${{ !cancelled() && !failure() && needs.plan.outputs.channel == 'latest' }} - runs-on: ubuntu-24.04 - permissions: - contents: write - pull-requests: write - env: *env - steps: - - *checkout-release - - name: Publish - run: bash .github/release/publish-version-pr.sh "$SHA" - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - SHA: ${{ needs.tag.outputs.sha }} diff --git a/.github/workflows/release-process-daemon.yml b/.github/workflows/release-process-daemon.yml index 147f3ddf58..8818655819 100644 --- a/.github/workflows/release-process-daemon.yml +++ b/.github/workflows/release-process-daemon.yml @@ -25,7 +25,6 @@ defaults: env: CARGO_TERM_COLOR: always - PROTOCOL_VERSION: 7 ZIG_VERSION: 0.16.0 GNU_GLIBC_VERSION: "2.30" CARGO_ZIGBUILD_VERSION: 0.23.2 @@ -33,6 +32,8 @@ env: jobs: checks: runs-on: ubuntu-22.04 + outputs: + protocol: ${{ steps.protocol.outputs.protocol }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 @@ -45,6 +46,12 @@ jobs: echo "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin" >> "$GITHUB_PATH" - name: Install Rust run: rustup toolchain install 1.90.0 --profile minimal --component clippy --component rustfmt + - name: Read protocol version + id: protocol + run: | + protocol="$(sed -nE 's/^pub const PROTOCOL_VERSION: u32 = ([0-9]+);$/\1/p' src/protocol.rs)" + test -n "$protocol" + echo "protocol=$protocol" >> "$GITHUB_OUTPUT" - name: Validate tag run: | package_version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "opencode-pty") | .version')" @@ -80,6 +87,7 @@ jobs: target: aarch64-apple-darwin runs-on: ${{ matrix.runner }} env: + PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} MACOSX_DEPLOYMENT_TARGET: "11.0" steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -165,6 +173,7 @@ jobs: shell: pwsh working-directory: packages/process-daemon env: + PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} CARGO_BUILD_TARGET: ${{ matrix.target }} RUSTUP_TOOLCHAIN: 1.90.0-x86_64-pc-windows-msvc # Portable CPU for Ghostty (see build.rs) and no Visual C++ runtime dependency. @@ -238,12 +247,14 @@ jobs: if-no-files-found: error release: - needs: [build, build-windows] + needs: [checks, build, build-windows] runs-on: ubuntu-22.04 permissions: contents: write id-token: write attestations: write + env: + PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.gitignore b/.gitignore index 591185d60c..214b47c6f1 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ dist-node .scripts .cache RELEASE_REVIEW.md + +# Legal drafts pending review are kept outside the repository; never copy them in. +legal-drafts-private/ diff --git a/.opencode/agent/translator.md b/.opencode/agent/translator.md new file mode 100644 index 0000000000..5bf8f6caaf --- /dev/null +++ b/.opencode/agent/translator.md @@ -0,0 +1,918 @@ +--- +description: Translate content for a specified locale while preserving technical terms +mode: subagent +model: opencode/gpt-5.6-sol +--- + +You are a professional translator and localization specialist. + +Translate the user's content into the requested target locale (language + region, e.g. fr-FR, de-DE). + +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 locale-specific guidance from `.opencode/glossary/.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 global glossary only. + +--- + +# Website Copy (opencode.ai) + +When translating the marketing site (`services/site/src/i18n/.ts` and `services/site/src/i18n/content/.ts`): + +- Keep every `{{param}}`, every link id in `[text](id)` (translate the text, keep the id) and every `` `code` `` span exactly. +- Keep these names as written: OpenCode, OpenCode Models, OpenCode Go, OpenCode Go Plus, Claude Opus 5.5, Anomaly, Console, and every company, model and app name. +- Never describe OpenCode as an AI coding agent: it is an "open source coding agent". Do not add "AI" to that phrase in any language. "AI models" and "AI providers" are fine. +- Prefer natural phrasing over literal translation. Use statements, not questions. Avoid colons where the language allows another construction. +- Keep strings about as long as the English. Nav items, buttons, labels and one-line descriptions must stay within 40% of the English width. +- From `services/site`, run `bun src/i18n/check.ts ` to list what is untranslated or changed in English, translate those entries, and run it again until it reports 0 errors. Then run `bun src/i18n/check.ts --stamp` to record the English each entry was translated from (`src/i18n/stamps/.json`). + +--- + +# Locale-Specific Glossaries + +When a locale glossary exists, use it to: + +- Apply preferred wording for recurring UI/docs terms in that locale +- Preserve locale-specific do-not-translate terms and casing decisions +- Prefer natural phrasing over literal translation when the locale file calls it out +- If the repo uses a locale alias slug, apply that file too (for example, `pt-BR` maps to `br.md` in this repo) + +Locale guidance does not override code/command preservation rules or the global Do-Not-Translate glossary below. + +--- + +# Do-Not-Translate Terms (OpenCode Docs) + +Generated from: `services/site/src/docs/v1/content/*.mdx` (default English docs) +Generated on: 2026-02-10 + +Use this as a translation QA checklist / glossary. Preserve listed terms exactly (spelling, casing, punctuation). + +General rules (verbatim, even if not listed below): + +- Anything inside inline code (single backticks) or fenced code blocks (triple backticks) +- MDX/JS code in docs: `import ... from "..."`, component tags, identifiers +- CLI commands, flags, config keys/values, file paths, URLs/domains, and env vars + +## Proper nouns and product names + +- OpenCode Models +- OpenCode Go +- OpenCode Go Plus +- Claude Opus 5.5 +- Anomaly + +Additional (not reliably captured via link text): + +```text +Astro +Bun +Chocolatey +Cursor +Docker +Git +GitHub Actions +GitLab CI +GNOME Terminal +Homebrew +Mise +Neovim +Node.js +npm +Obsidian +opencode +opencode-ai +Paru +pnpm +ripgrep +Scoop +SST +Starlight +Visual Studio Code +VS Code +VSCodium +Windsurf +Windows Terminal +Yarn +Zellij +Zed +anomalyco +``` + +Extracted from link labels in the English docs (review and prune as desired): + +```text +@openspoon/subtask2 +302.AI console +ACP progress report +Agent Client Protocol +Agent Skills +Agentic +AGENTS.md +AI SDK +Alacritty +Anthropic +Anthropic's Data Policies +Atom One +Avante.nvim +Ayu +Azure AI Foundry +Azure portal +Baseten +built-in GITHUB_TOKEN +Bun.$ +Catppuccin +Cerebras console +ChatGPT Plus or Pro +Cloudflare dashboard +CodeCompanion.nvim +CodeNomad +Configuring Adapters: Environment Variables +Context7 MCP server +Cortecs console +Deep Infra dashboard +DeepSeek console +Duo Agent Platform +Everforest +Fireworks AI console +Firmware dashboard +Ghostty +GitLab CLI agents docs +GitLab docs +GitLab User Settings > Access Tokens +Granular Rules (Object Syntax) +Grep by Vercel +Groq console +Gruvbox +Helicone +Helicone documentation +Helicone Header Directory +Helicone's Model Directory +Hugging Face Inference Providers +Hugging Face settings +install WSL +IO.NET console +JetBrains IDE +Kanagawa +Kitty +MiniMax API Console +Models.dev +Moonshot AI console +Nebius Token Factory console +Nord +OAuth +Ollama integration docs +OpenAI's Data Policies +OpenChamber +OpenCode +OpenCode config +OpenCode Config +OpenCode TUI with the opencode theme +OpenCode Web - Active Session +OpenCode Web - New Session +OpenCode Web - See Servers +OpenCode Zen +OpenCode-Obsidian +OpenRouter dashboard +OpenWork +OVHcloud panel +Pro+ subscription +SAP BTP Cockpit +Scaleway Console IAM settings +Scaleway Generative APIs +SDK documentation +Sentry MCP server +shell API +Together AI console +Tokyonight +Unified Billing +Venice AI console +Vercel dashboard +WezTerm +Windows Subsystem for Linux (WSL) +WSL +WSL (Windows Subsystem for Linux) +WSL extension +xAI console +Z.AI API console +Zed +ZenMux dashboard +Zod +``` + +## Acronyms and initialisms + +```text +ACP +AGENTS +AI +AI21 +ANSI +API +AST +AWS +BTP +CD +CDN +CI +CLI +CMD +CORS +DEBUG +EKS +ERROR +FAQ +GLM +GNOME +GPT +HTML +HTTP +HTTPS +IAM +ID +IDE +INFO +IO +IP +IRSA +JS +JSON +JSONC +K2 +LLM +LM +LSP +M2 +MCP +MR +NET +NPM +NTLM +OIDC +OS +PAT +PATH +PHP +PR +PTY +README +RFC +RPC +SAP +SDK +SKILL +SSE +SSO +TS +TTY +TUI +UI +URL +US +UX +VCS +VPC +VPN +VS +WARN +WSL +X11 +YAML +``` + +## Code identifiers used in prose (CamelCase, mixedCase) + +```text +apiKey +AppleScript +AssistantMessage +baseURL +BurntSushi +ChatGPT +ClangFormat +CodeCompanion +CodeNomad +DeepSeek +DefaultV2 +FileContent +FileDiff +FileNode +fineGrained +FormatterStatus +GitHub +GitLab +iTerm2 +JavaScript +JetBrains +macOS +mDNS +MiniMax +NeuralNomadsAI +NickvanDyke +NoeFabris +OpenAI +OpenAPI +OpenChamber +OpenCode +OpenRouter +OpenTUI +OpenWork +ownUserPermissions +PowerShell +ProviderAuthAuthorization +ProviderAuthMethod +ProviderInitError +SessionStatus +TabItem +tokenType +ToolIDs +ToolList +TypeScript +typesUrl +UserMessage +VcsInfo +WebView2 +WezTerm +xAI +ZenMux +``` + +## OpenCode CLI commands (as shown in docs) + +```text +opencode +opencode [project] +opencode /path/to/project +opencode acp +opencode agent [command] +opencode agent create +opencode agent list +opencode attach [url] +opencode attach http://10.20.30.40:4096 +opencode attach http://localhost:4096 +opencode auth [command] +opencode auth list +opencode auth login +opencode auth logout +opencode auth ls +opencode export [sessionID] +opencode github [command] +opencode github install +opencode github run +opencode import +opencode import https://opncd.ai/s/abc123 +opencode import session.json +opencode mcp [command] +opencode mcp add +opencode mcp auth [name] +opencode mcp auth list +opencode mcp auth ls +opencode mcp auth my-oauth-server +opencode mcp auth sentry +opencode mcp debug +opencode mcp debug my-oauth-server +opencode mcp list +opencode mcp logout [name] +opencode mcp logout my-oauth-server +opencode mcp ls +opencode models --refresh +opencode models [provider] +opencode models anthropic +opencode run [message..] +opencode run Explain the use of context in Go +opencode serve +opencode serve --cors http://localhost:5173 --cors https://app.example.com +opencode serve --hostname 0.0.0.0 --port 4096 +opencode serve [--port ] [--hostname ] [--cors ] +opencode session [command] +opencode session list +opencode session delete +opencode stats +opencode uninstall +opencode upgrade +opencode upgrade [target] +opencode upgrade v0.1.48 +opencode web +opencode web --cors https://example.com +opencode web --hostname 0.0.0.0 +opencode web --mdns +opencode web --mdns --mdns-domain myproject.local +opencode web --port 4096 +opencode web --port 4096 --hostname 0.0.0.0 +opencode.server.close() +``` + +## Slash commands and routes + +```text +/agent +/auth/:id +/clear +/command +/config +/config/providers +/connect +/continue +/doc +/editor +/event +/experimental/tool?provider=

&model= +/experimental/tool/ids +/export +/file?path= +/file/content?path=

+/file/status +/find?pattern= +/find/file +/find/file?query= +/find/symbol?query= +/formatter +/global/event +/global/health +/help +/init +/instance/dispose +/log +/lsp +/mcp +/mnt/ +/mnt/c/ +/mnt/d/ +/models +/oc +/opencode +/path +/project +/project/current +/provider +/provider/{id}/oauth/authorize +/provider/{id}/oauth/callback +/provider/auth +/q +/quit +/redo +/resume +/session +/session/:id +/session/:id/abort +/session/:id/children +/session/:id/command +/session/:id/diff +/session/:id/fork +/session/:id/init +/session/:id/message +/session/:id/message/:messageID +/session/:id/permissions/:permissionID +/session/:id/prompt_async +/session/:id/revert +/session/:id/share +/session/:id/shell +/session/:id/summarize +/session/:id/todo +/session/:id/unrevert +/session/status +/share +/summarize +/theme +/tui +/tui/append-prompt +/tui/clear-prompt +/tui/control/next +/tui/control/response +/tui/execute-command +/tui/open-help +/tui/open-models +/tui/open-sessions +/tui/open-themes +/tui/show-toast +/tui/submit-prompt +/undo +/Users/username +/Users/username/projects/* +/vcs +``` + +## CLI flags and short options + +```text +--agent +--attach +--command +--continue +--cors +--cwd +--days +--dir +--dry-run +--event +--file +--force +--fork +--format +--help +--hostname +--hostname 0.0.0.0 +--keep-config +--keep-data +--log-level +--max-count +--mdns +--mdns-domain +--method +--model +--models +--port +--print-logs +--project +--prompt +--refresh +--session +--share +--title +--token +--tools +--verbose +--version +--wait + +-c +-d +-f +-h +-m +-n +-s +-v +``` + +## Environment variables + +```text +AI_API_URL +AI_FLOW_CONTEXT +AI_FLOW_EVENT +AI_FLOW_INPUT +AICORE_DEPLOYMENT_ID +AICORE_RESOURCE_GROUP +AICORE_SERVICE_KEY +ANTHROPIC_API_KEY +AWS_ACCESS_KEY_ID +AWS_BEARER_TOKEN_BEDROCK +AWS_PROFILE +AWS_REGION +AWS_ROLE_ARN +AWS_SECRET_ACCESS_KEY +AWS_WEB_IDENTITY_TOKEN_FILE +AZURE_COGNITIVE_SERVICES_RESOURCE_NAME +AZURE_RESOURCE_NAME +CI_PROJECT_DIR +CI_SERVER_FQDN +CI_WORKLOAD_REF +CLOUDFLARE_ACCOUNT_ID +CLOUDFLARE_API_TOKEN +CLOUDFLARE_GATEWAY_ID +CONTEXT7_API_KEY +GITHUB_TOKEN +GITLAB_AI_GATEWAY_URL +GITLAB_HOST +GITLAB_INSTANCE_URL +GITLAB_OAUTH_CLIENT_ID +GITLAB_TOKEN +GITLAB_TOKEN_OPENCODE +GOOGLE_APPLICATION_CREDENTIALS +GOOGLE_CLOUD_PROJECT +HTTP_PROXY +HTTPS_PROXY +K2_ +MY_API_KEY +MY_ENV_VAR +MY_MCP_CLIENT_ID +MY_MCP_CLIENT_SECRET +NO_PROXY +NODE_ENV +NODE_EXTRA_CA_CERTS +NPM_AUTH_TOKEN +OC_ALLOW_WAYLAND +OPENCODE_API_KEY +OPENCODE_AUTH_JSON +OPENCODE_AUTO_SHARE +OPENCODE_CLIENT +OPENCODE_CONFIG +OPENCODE_CONFIG_CONTENT +OPENCODE_CONFIG_DIR +OPENCODE_DISABLE_AUTOCOMPACT +OPENCODE_DISABLE_AUTOUPDATE +OPENCODE_DISABLE_CLAUDE_CODE +OPENCODE_DISABLE_CLAUDE_CODE_PROMPT +OPENCODE_DISABLE_CLAUDE_CODE_SKILLS +OPENCODE_DISABLE_DEFAULT_PLUGINS +OPENCODE_DISABLE_LSP_DOWNLOAD +OPENCODE_DISABLE_MODELS_FETCH +OPENCODE_DISABLE_PRUNE +OPENCODE_DISABLE_TERMINAL_TITLE +OPENCODE_ENABLE_EXA +OPENCODE_ENABLE_EXPERIMENTAL_MODELS +OPENCODE_EXPERIMENTAL +OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS +OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT +OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER +OPENCODE_EXPERIMENTAL_EXA +OPENCODE_EXPERIMENTAL_FILEWATCHER +OPENCODE_EXPERIMENTAL_ICON_DISCOVERY +OPENCODE_EXPERIMENTAL_LSP_TOOL +OPENCODE_EXPERIMENTAL_LSP_TY +OPENCODE_EXPERIMENTAL_MARKDOWN +OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX +OPENCODE_EXPERIMENTAL_OXFMT +OPENCODE_EXPERIMENTAL_PLAN_MODE +OPENCODE_ENABLE_QUESTION_TOOL +OPENCODE_FAKE_VCS +OPENCODE_GIT_BASH_PATH +OPENCODE_MODEL +OPENCODE_MODELS_URL +OPENCODE_PERMISSION +OPENCODE_PORT +OPENCODE_SERVER_PASSWORD +OPENCODE_SERVER_USERNAME +PROJECT_ROOT +RESOURCE_NAME +RUST_LOG +VARIABLE_NAME +VERTEX_LOCATION +XDG_CONFIG_HOME +``` + +## Package/module identifiers + +```text +../../../config.mjs +@astrojs/starlight/components +@opencode-ai/plugin +@opencode-ai/sdk +path +shescape +zod + +@ +@ai-sdk/anthropic +@ai-sdk/cerebras +@ai-sdk/google +@ai-sdk/openai +@ai-sdk/openai-compatible +@File#L37-42 +@modelcontextprotocol/server-everything +@opencode +``` + +## GitHub owner/repo slugs referenced in docs + +```text +24601/opencode-zellij-namer +angristan/opencode-wakatime +anomalyco/opencode +apps/opencode-agent +athal7/opencode-devcontainers +awesome-opencode/awesome-opencode +backnotprop/plannotator +ben-vargas/ai-sdk-provider-opencode-sdk +btriapitsyn/openchamber +BurntSushi/ripgrep +Cluster444/agentic +code-yeongyu/oh-my-opencode +darrenhinde/opencode-agents +different-ai/opencode-scheduler +different-ai/openwork +features/copilot +folke/tokyonight.nvim +franlol/opencode-md-table-formatter +ggml-org/llama.cpp +ghoulr/opencode-websearch-cited.git +H2Shami/opencode-helicone-session +hosenur/portal +jamesmurdza/daytona +jenslys/opencode-gemini-auth +JRedeker/opencode-morph-fast-apply +JRedeker/opencode-shell-strategy +kdcokenny/ocx +kdcokenny/opencode-background-agents +kdcokenny/opencode-notify +kdcokenny/opencode-workspace +kdcokenny/opencode-worktree +login/device +mohak34/opencode-notifier +morhetz/gruvbox +mtymek/opencode-obsidian +NeuralNomadsAI/CodeNomad +nick-vi/opencode-type-inject +NickvanDyke/opencode.nvim +NoeFabris/opencode-antigravity-auth +nordtheme/nord +numman-ali/opencode-openai-codex-auth +olimorris/codecompanion.nvim +panta82/opencode-notificator +rebelot/kanagawa.nvim +remorses/kimaki +sainnhe/everforest +shekohex/opencode-google-antigravity-auth +shekohex/opencode-pty.git +spoons-and-mirrors/subtask2 +sudo-tee/opencode.nvim +supermemoryai/opencode-supermemory +Tarquinen/opencode-dynamic-context-pruning +Th3Whit3Wolf/one-nvim +upstash/context7 +vtemian/micode +vtemian/octto +yetone/avante.nvim +zenobi-us/opencode-plugin-template +zenobi-us/opencode-skillful +``` + +## Paths, filenames, globs, and URLs + +```text +./.opencode/themes/*.json +.//storage/ +./config/#custom-directory +./global/storage/ +.agents/skills/*/SKILL.md +.agents/skills//SKILL.md +.clang-format +.claude +.claude/skills +.claude/skills/*/SKILL.md +.claude/skills//SKILL.md +.env +.github/workflows/opencode.yml +.gitignore +.gitlab-ci.yml +.ignore +.NET SDK +.npmrc +.ocamlformat +.opencode +.opencode/ +.opencode/agents/ +.opencode/commands/ +.opencode/commands/test.md +.opencode/modes/ +.opencode/plans/*.md +.opencode/plugins/ +.opencode/skills//SKILL.md +.opencode/skills/git-release/SKILL.md +.opencode/tools/ +.well-known/opencode +{ type: "raw" \| "patch", content: string } +{file:path/to/file} +**/*.js +%USERPROFILE%/intelephense/license.txt +%USERPROFILE%\.cache\opencode +%USERPROFILE%\.config\opencode\opencode.jsonc +%USERPROFILE%\.config\opencode\plugins +%USERPROFILE%\.local\share\opencode +%USERPROFILE%\.local\share\opencode\log +/.opencode/themes/*.json +/ +/.opencode/plugins/ +~ +~/... +~/.agents/skills/*/SKILL.md +~/.agents/skills//SKILL.md +~/.aws/credentials +~/.bashrc +~/.cache/opencode +~/.cache/opencode/node_modules/ +~/.claude/CLAUDE.md +~/.claude/skills/ +~/.claude/skills/*/SKILL.md +~/.claude/skills//SKILL.md +~/.config/opencode +~/.config/opencode/AGENTS.md +~/.config/opencode/agents/ +~/.config/opencode/commands/ +~/.config/opencode/modes/ +~/.config/opencode/opencode.json +~/.config/opencode/opencode.jsonc +~/.config/opencode/plugins/ +~/.config/opencode/skills/*/SKILL.md +~/.config/opencode/skills//SKILL.md +~/.config/opencode/themes/*.json +~/.config/opencode/tools/ +~/.config/zed/settings.json +~/.local/share +~/.local/share/opencode/ +~/.local/share/opencode/auth.json +~/.local/share/opencode/log/ +~/.local/share/opencode/mcp-auth.json +~/.local/share/opencode/opencode.jsonc +~/.npmrc +~/.zshrc +~/code/ +~/Library/Application Support +~/projects/* +~/projects/personal/ +${config.github}/blob/dev/packages/sdk/js/src/gen/types.gen.ts +$HOME/intelephense/license.txt +$HOME/projects/* +$XDG_CONFIG_HOME/opencode/themes/*.json +agent/ +agents/ +build/ +commands/ +dist/ +http://:4096 +http://127.0.0.1:8080/callback +http://localhost: +http://localhost:4096 +http://localhost:4096/doc +https://app.example.com +https://AZURE_COGNITIVE_SERVICES_RESOURCE_NAME.cognitiveservices.azure.com/ +https://opencode.ai/zen/v1/chat/completions +https://opencode.ai/zen/v1/messages +https://opencode.ai/zen/v1/models/gemini-3-flash +https://opencode.ai/zen/v1/models/gemini-3-pro +https://opencode.ai/zen/v1/responses +https://RESOURCE_NAME.openai.azure.com/ +laravel/pint +log/ +model: "anthropic/claude-sonnet-4-5" +modes/ +node_modules/ +openai/gpt-4.1 +opencode.ai/config.json +opencode/ +opencode/gpt-5.1-codex +opencode/gpt-5.2-codex +opencode/kimi-k2 +openrouter/google/gemini-2.5-flash +opncd.ai/s/ +packages/*/AGENTS.md +plugins/ +project/ +provider_id/model_id +provider/model +provider/model-id +rm -rf ~/.cache/opencode +skills/ +skills/*/SKILL.md +src/**/*.ts +themes/ +tools/ +``` + +## Keybind strings + +```text +alt+b +Alt+Ctrl+K +alt+d +alt+f +Cmd+Esc +Cmd+Option+K +Cmd+Shift+Esc +Cmd+Shift+G +Cmd+Shift+P +ctrl+a +ctrl+b +ctrl+d +ctrl+e +Ctrl+Esc +ctrl+f +ctrl+g +ctrl+k +Ctrl+Shift+Esc +Ctrl+Shift+P +ctrl+t +ctrl+u +ctrl+w +ctrl+x +DELETE +Shift+Enter +WIN+R +``` + +## Model ID strings referenced + +```text +{env:OPENCODE_MODEL} +anthropic/claude-3-5-sonnet-20241022 +anthropic/claude-haiku-4-20250514 +anthropic/claude-haiku-4-5 +anthropic/claude-sonnet-4-20250514 +anthropic/claude-sonnet-4-5 +gitlab/duo-chat-haiku-4-5 +lmstudio/google/gemma-3n-e4b +openai/gpt-4.1 +openai/gpt-5 +opencode/gpt-5.1-codex +opencode/gpt-5.2-codex +opencode/kimi-k2 +openrouter/google/gemini-2.5-flash +``` diff --git a/.opencode/skills/app-e2e-tests/SKILL.md b/.opencode/skills/app-e2e-tests/SKILL.md index d7d0f0690e..d8afe92c36 100644 --- a/.opencode/skills/app-e2e-tests/SKILL.md +++ b/.opencode/skills/app-e2e-tests/SKILL.md @@ -105,7 +105,7 @@ Most of these rarely reproduce on an idle local machine. Run from `packages/app`: - [ ] Run in built mode, as CI does: `bun run test:e2e:built -- e2e/regression/.spec.ts`. Dev mode serves unbundled modules, with the API on another origin (`playwright.config.ts:19-21`). -- [ ] Use a free port when another worktree or agent may hold 3000: `PLAYWRIGHT_PORT=4310 bun run test:e2e:built -- ...`. Built runs never reuse a server, and `serve.ts` fails on a busy port. Stay below 49152 on Windows: it reserves ports from there up and hands them out for outgoing connections (`services/www/src/docs/content/cli/web.mdx:43`, `packages/client/test/fixture/service-fixture.ts:108-109`). +- [ ] Use a free port when another worktree or agent may hold 3000: `PLAYWRIGHT_PORT=4310 bun run test:e2e:built -- ...`. Built runs never reuse a server, and `serve.ts` fails on a busy port. Stay below 49152 on Windows: it reserves ports from there up and hands them out for outgoing connections (`services/site/src/docs/content/cli/web.mdx:43`, `packages/client/test/fixture/service-fixture.ts:108-109`). - [ ] To repeat without rebuilding: - build once with `VITE_OPENCODE_TEST_FIXTURES=1 bun run build`; - keep `bun e2e/utils/serve.ts --host 127.0.0.1 --port 4310` running; @@ -122,9 +122,9 @@ Run from `packages/app`: ## When CI flakes -- **Find it.** e2e runs on pull requests that affect `@opencode/app` or `@opencode/stories`, including their workspace dependencies, and on every manual dispatch (`.github/workflows/check-test.yml:50-62`). It never runs on dev (`:28`). +- **Find it.** e2e runs on every push to dev and beta, on nightly and manual runs, and as the gate `release.yml` calls before a stable release. Pull requests never run it. On a push the `affected` gate still skips it when nothing in `@opencode/app` or `@opencode/stories`, or their workspace dependencies, changed (`.github/workflows/check-test.yml`). - Each OS has the legs `app-1` and `app-2` (the shards), `session-ui-components` and `app-components`. - - The required `e2e (linux)` and `e2e (windows)` checks only aggregate those legs (`:329-352`). + - The `e2e (linux)` and `e2e (windows)` checks only aggregate those legs. - A pass on retry leaves a leg green. Check each Windows shard report's Flaky list, and make sure your new tests are not on it. - **Download:** `gh run download -n playwright-windows-app-2-1 -D

`. Artifacts are named `playwright---` (`check-test.yml:314-327`). App e2e results are in `/app/e2e/`. - **In CI, the failing first attempt has no trace and no video** (`playwright.config.ts:62-65`). diff --git a/.opencode/skills/component-tests/SKILL.md b/.opencode/skills/component-tests/SKILL.md index 530a616685..cea2978803 100644 --- a/.opencode/skills/component-tests/SKILL.md +++ b/.opencode/skills/component-tests/SKILL.md @@ -101,11 +101,11 @@ From the owning package (`packages/session-ui` or `packages/app`): 5. **Windows.** Check platform keys and labels and font-dependent geometry. The Windows component legs are the authoritative check. - Do not skip on Windows, and do not raise `config.ts` timeouts, retries or the `mount` wait. - If one test does genuinely expensive work, call `story.setTimeout(...)` in that test, with a comment that names the work. -6. **Confirm CI ran the component legs.** E2E never runs on pushes to dev (`check-test.yml:28`), so no post-merge run catches a regression. - - The `affected` gate filters on `@opencode/app` and `@opencode/stories` (`check-test.yml:60-61`). `ui`, `session-ui` and `gui-plugins` count through app's dependencies. `workflow_dispatch` forces the legs on (`check-test.yml:56-59`). +6. **Confirm CI ran the component legs.** Pull requests run only the affected unit tests on Linux, so the component legs come from a push to dev or beta, a nightly run or the release gate. + - The `affected` gate filters on `@opencode/app` and `@opencode/stories`. `ui`, `session-ui` and `gui-plugins` count through app's dependencies. Manual runs force the legs on. - `check-test.yml` is listed in `globalDependencies` (`turbo.json:8`), so editing it marks every package affected. - - The required `e2e (linux)` and `e2e (windows)` checks also pass when no leg was needed (`check-test.yml:329-352`). Look for `e2e (, session-ui-components)` and `e2e (, app-components)`. - - If CI skipped them, report your local cold run in the PR. + - The `e2e (linux)` and `e2e (windows)` checks also pass when no leg was needed. Look for `e2e (, session-ui-components)` and `e2e (, app-components)`. + - If no push has run them, report your local cold run in the PR. ## When CI flakes diff --git a/.oxlintrc.json b/.oxlintrc.json index c7ca982f46..3d864727ed 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -193,6 +193,8 @@ ".pi/**", ".roo/**", ".windsurf/**", - "script/oxlint/anti-slop/**" + "script/oxlint/anti-slop/**", + "services/site/public/arcade3d/basis/**", + "services/site/public/arcade3d/draco/**" ] } diff --git a/AGENTS.md b/AGENTS.md index 7fdbe171b1..ebfc4fd6d9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -202,6 +202,14 @@ const table = sqliteTable("session", { - Local `typecheck` scripts use `bun check`. CI and package publishing run `typecheck:tsc`, which uses the official TypeScript compiler (`@typescript/native`). When the two disagree, `tsc` is the source of truth; reproduce with `bun run typecheck:tsc` from the package directory. - `bun check` aims to match TypeScript 7.1, not the `7.0.2` that `process.versions.typescript` reports (oven-sh/bun#46536). When `bun check` and `tsc` from the pinned `@typescript/native` report different errors, file a minimal, dependency-free repro at https://github.com/oven-sh/bun/issues, with the output of both. `bun check` writes no declaration files, so declaration-emit errors such as TS5088 or TS2883 are expected to appear only in `tsc`; do not report those. +## Plugin Loading + +- Plugins load asynchronously. Server handlers never wait for them (`Plugin.awaitActivation`), never retry until something appears, and never turn slow plugins into a timeout or 503. This applies to reads and to actions such as `rpc.call` and `vcs.init`. +- Temporary exception: endpoints that list or use providers managed policy can deny (`model.list`, `model.default`, `provider.list`, `generate.*`, `voice.*` and `websearch.query`) wait through `awaitPlugins` in `packages/server/src/location.ts`, because policy is applied by the last plugin to activate and is missing until then. Don't add new waits; this goes away once a plugin batch becomes visible only when it ends. +- The server answers with what is loaded now: lists may be empty or partial on a cold Location, and an action whose model, provider or RPC hasn't loaded yet fails with not-found. That is expected, not a bug to fix on the server. +- Clients are responsible for making sure what they need is loaded before they call. Long-lived clients refresh on the matching `*.updated` event (`model.updated`, `agent.updated`, `skill.updated`, `integration.updated`, `plugin.updated`, ...). One-shot clients (CLI commands, ACP, SDK callers) wait on their side, for example by polling `plugin.list` or the entry they need. See `packages/cli/src/services/plugin-startup.ts`. +- Running the hooks that are registered and waiting for their result is fine (for example `hooks.trigger("session", "http.request", ...)`). What is not allowed is waiting for plugins to load first: if the plugin that adds a hook hasn't loaded yet, the call runs without that hook. + ## Session Core - Keep durable events minimal: record irreducible new facts and do not repeat state derivable by folding the ordered aggregate history. Enrich projections and read models with previous or derived state when consumers need self-contained views. diff --git a/CHANGELOG.md b/CHANGELOG.md index 141fc89914..eb470fab1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,23 @@ Release notes in this repository are generated from git history, not hand-writte ## [Unreleased] +## [2.0.4] - 2026-11-11 + +### Added + +- An animated companion in the session sidebar and on the home screen. It has idle, thinking, typing, alert, sleep and coffee states, and three built-in characters: Codex, Hoots and BSOD. +- Settings → Pet controls the companion: on or off, character, body color and animations. +- Custom companions through `pet.custom` in `~/.config/opencode/cli.json`, with a color palette and per-state frames. + +### Changed + +- Synced with upstream OpenCode dev (2.2.7): session engine, model discovery, MCP events, embeddings, desktop and TUI updates, and release tooling. +- The companion is off by default. Enable it in Settings → Pet. + +### Fixed + +- `bun run sync` failed on a clean tree because `git diff-index` received `HEAD--` instead of `HEAD --`. + ## [2.0.3] - 2026-11-05 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30b74296fd..3f3b36d072 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,7 +98,62 @@ bun run --cwd packages/desktop dev > [!NOTE] > If you change the API or SDK, run `./script/generate.ts` to regenerate the SDK and related files. -Follow the [style guide](./AGENTS.md). +## Adding Providers + +New providers should rarely require OpenCode changes. Add the provider to [models.dev](https://github.com/anomalyco/models.dev) first. + +## Development + +OpenCode requires the Bun version in the `packageManager` field of [`package.json`](./package.json) or newer. From the repository root: + +```bash +bun install +bun dev [directory] +``` + +`bun dev` runs the V2 CLI and TUI. Pass a directory to open another project, or `.` to open this repository. + +To test a development TUI against your installed OpenCode V2 background service and live sessions: + +```bash +bun run dev:live [directory] +``` + +For web development, run the backend and app in separate terminals. Other interfaces have root scripts: + +```bash +bun dev serve --port 4096 +bun run dev:web +bun run dev:desktop +bun run dev:site +``` + +### Packages + +- `packages/schema`: shared wire and storage contracts +- `packages/core`: domain behavior and persistence +- `packages/protocol`: public API definitions +- `packages/server`: HTTP server and runtime composition +- `packages/client`: generated TypeScript clients +- `packages/cli`: command-line entrypoint and service lifecycle +- `packages/tui`: terminal interface +- `packages/app`: shared web interface +- `packages/desktop`: Electron desktop application +- `packages/plugin`: plugin API + +### Verification + +Run typechecks, and tests where defined, from the affected package rather than the repository root: + +```bash +cd packages/core +bun run test +bun typecheck +``` + +Follow package-specific instructions in nearby `AGENTS.md` files. After changing the public Protocol or Server `HttpApi`, run `bun run generate` from `packages/client`; never edit generated client files directly. + +Follow the repository [style guide](./AGENTS.md). ## Pull Requests diff --git a/README b/README index db75ead68f..2cf93d5b6e 100644 --- a/README +++ b/README @@ -11,10 +11,10 @@ Install ------------------------- Linux and macOS: -curl -fsSL https://raw.githubusercontent.com/NoNFake/fuckcode/dev/install | bash +curl -fsSL https://raw.githubusercontent.com/NoNFake/fuckcode/fuck-dev/install | bash Windows PowerShell: -irm https://raw.githubusercontent.com/NoNFake/fuckcode/dev/install.ps1 | iex +irm https://raw.githubusercontent.com/NoNFake/fuckcode/fuck-dev/install.ps1 | iex The installer fetches the release for your platform and puts `fuckcode` on `PATH` diff --git a/README.md.old b/README.md.old deleted file mode 100644 index dfd67593cf..0000000000 --- a/README.md.old +++ /dev/null @@ -1,132 +0,0 @@ -# FuckCode - -FuckCode is a fork of [OpenCode](https://github.com/anomalyco/opencode) built for security auditing, penetration testing, reverse engineering, and infrastructure vulnerability assessment. - -![fuckcode](https://github.com/NoNFake/fuckcode/raw/dev/.github/logo.png) - -## Features - -- **Local models (llama.cpp)**: connect to a local `llama-server` without boilerplate JSON, discover models from `/v1/models`, and set the server URL from the model picker (`Ctrl+P`). -- **Token efficiency**: ANSI and progress stripping from tool output, capped tool output with full logs on disk, pruning of stale tool results, and eco mode (`--token-saving` / `--eco`, or `token_saving` in config) with moderate and aggressive caps. -- **Verification indicator**: the footer shows `verify N` when assistant text references files that no tool result confirms. This is a heuristic prompt to verify, not proof of hallucination. -- **Security skill catalog**: 30+ embedded skills covering engagement phases, services, playbooks, web vulnerability classes, API/cloud/CI-CD/deserialization classes, fuzzing, AI security, and reverse engineering. Skills load on demand based on task context. -- **Reverse engineering tools**: `binary` tool with `emulate` (radare2 ESIL), `entropy`, `functions`, `patch` (rasm2), and hardening reports; loads only when the reverse config is enabled. -- **Pentest module**: sandboxed execution, scope enforcement, evidence store, structured parsing, and report generation (details below). -- **Red and black theme**: high-contrast palette with project and global config discovery for `fuckcode.json` and `fuckcode.jsonc`. - -## Install - -macOS and Linux: - -```bash -curl -fsSL https://raw.githubusercontent.com/NoNFake/fuckcode/dev/install | bash -``` - -Windows (PowerShell): - -```powershell -irm https://raw.githubusercontent.com/NoNFake/fuckcode/dev/install.ps1 | iex -``` - -The installer downloads the release for your platform and adds `fuckcode` to PATH. Options: `--version ` pins a specific release, `--binary ` installs a local build, `--no-modify-path` skips shell config edits. - -## Build from source - -FuckCode requires [Bun](https://bun.sh): - -```bash -bun install -bun run dev # interactive TUI from source -bun run script/build.ts --single --skip-ui # build a local binary -``` - -### Local model (llama.cpp) - -```bash -./llama-server -m /path/to/model.gguf --port 8080 -c 32768 -bun run dev -``` - -Open the model picker with `Ctrl+P`. Models on `http://127.0.0.1:8080` are detected automatically; use "Set llama.cpp Server URL..." for other hosts. - -## Configuration - -Project `fuckcode.json` or global `~/.config/fuckcode/fuckcode.json`: - -```json -{ - "$schema": "https://opencode.ai/config.json", - "provider": { - "llamacpp": { - "baseURL": "http://127.0.0.1:8080/v1" - } - } -} -``` - -Pentest scope: - -```json -{ - "pentest": { - "enabled": true, - "sandboxTimeout": 30000, - "scope": { - "domains": ["target.corp", "*.target.corp"], - "cidrs": ["10.0.0.0/8", "172.16.0.0/12"], - "ports": [80, 443], - "children": { - "web": { "domains": ["web.target.corp"], "ports": [80, 443, 8080, 8443] } - } - } - } -} -``` - -## Security skills - -The agent loads skills on demand from the embedded catalog: - -- **Phases**: recon, enumeration, vulnerability assessment, exploitation, post-exploitation, reporting. -- **Services**: SSH, SMB, DNS, database, Docker/Kubernetes, FTP, mail, pivoting. -- **Playbooks**: web application, Active Directory, cloud, infrastructure. -- **Web classes**: SQL injection, auth bypass and IDOR, upload RCE, SSTI, SSRF, XXE, LFI and traversal, deserialization. -- **Other**: API security, cloud, CI/CD pipelines, fuzzing, AI security, bug identification, vulnerability classes, fast checking, Effect v4 patterns for this codebase. - -Example prompts: - -- "Perform active reconnaissance and port discovery on 192.168.1.50" -- "Test http://target.local/api/item?id=1 for SQL injection and XSS" -- "Enumerate shares, users, and permissions on 10.10.10.10" -- "Generate a structured security assessment report with CVSS scoring and remediation steps" - -## Pentest module - -- **Sandbox**: rootless namespace wrapper (pasta, slirp4netns, or unshare) with egress restricted to scope. -- **DNS whitelist**: embedded forwarder answers NXDOMAIN for out-of-scope domains and blocks DoH/DoT bypasses. -- **Scopes**: hierarchical child scopes with inherited constraints and subagent `scope_override`. -- **Evidence store**: SQLite WAL with FTS5 trigram search, transaction batching, and deduplication. -- **Parsers**: nmap, nuclei, cme, ffuf, sqlmap, nikto, whatweb, Burp, HAR, OpenAPI, recon. -- **Tools**: `read_evidence`, `state_update`, `report_gen`, `inject_probe`, `filename_bypass`, `oob`, `recon`, `scan_import`, `scope_import`, `ensure_tools`, `os_hook`, `session`, `knowledge_update`, plus the `/report` command. -- **Reports**: markdown, JSON, and SARIF output with evidence chains. - -Tests: - -```bash -bun test src/pentest/__tests__/ -``` - -## Development - -```bash -bun run --cwd packages/opencode typecheck -bun run --cwd packages/tui typecheck -bun run --cwd packages/core typecheck -bun run lint -``` - -Run tests from package directories, for example `bun test` in `packages/opencode`. - -## Upstream - -FuckCode tracks upstream OpenCode through `bun run sync` and adds the security tooling on top. See [CHANGELOG.md](./CHANGELOG.md) for release notes. diff --git a/bun.lock b/bun.lock index e6fe68bc34..15ebfa8c56 100644 --- a/bun.lock +++ b/bun.lock @@ -24,13 +24,12 @@ "oxlint": "1.60.0", "prettier": "3.6.2", "semver": "^7.6.0", - "sst": "catalog:", "turbo": "2.10.2", }, }, "packages/ai": { "name": "@opencode/ai", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@aws-sdk/credential-providers": "3.1057.0", "@opencode/schema": "workspace:*", @@ -52,7 +51,7 @@ }, "packages/app": { "name": "@opencode/app", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@corvu/drawer": "catalog:", "@dnd-kit/abstract": "0.5.0", @@ -107,7 +106,7 @@ }, "packages/cli": { "name": "@opencode/cli", - "version": "2.0.3", + "version": "2.0.4", "bin": { "opencode": "./bin/opencode.cjs", "opencode2": "./bin/opencode2.cjs", @@ -173,14 +172,14 @@ }, "packages/client": { "name": "@opencode/client", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/protocol": "workspace:*", "@opencode/schema": "workspace:*", }, "devDependencies": { "@effect/platform-node": "catalog:", - "@modelcontextprotocol/client": "2.3.1", + "@modelcontextprotocol/client": "2.4.0", "@opencode/httpapi-codegen": "workspace:*", "@tsconfig/bun": "catalog:", "@types/bun": "catalog:", @@ -199,7 +198,7 @@ }, "packages/codemode": { "name": "@opencode/codemode", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "acorn": "8.15.0", "effect": "catalog:", @@ -210,50 +209,11 @@ "@typescript/native": "catalog:", }, }, - "packages/console/app": { - "name": "@opencode/console-app", - "version": "2.2.5", - "dependencies": { - "@ibm/plex": "6.4.1", - "@kobalte/core": "catalog:", - "@opencode/console-resource": "workspace:*", - "@opencode/ui": "workspace:*", - "@solidjs/meta": "catalog:", - "@solidjs/router": "catalog:", - "@solidjs/start": "catalog:", - "aws4fetch": "1.0.20", - "nitro": "3.0.260903-beta", - "number-flow": "0.6.2", - "solid-js": "catalog:", - "vite": "8.2.4", - "zod": "catalog:", - }, - "devDependencies": { - "@types/bun": "catalog:", - "@typescript/native": "catalog:", - "@webgpu/types": "0.1.54", - "typescript": "catalog:", - "wrangler": "4.50.0", - }, - }, - "packages/console/resource": { - "name": "@opencode/console-resource", - "dependencies": { - "@cloudflare/workers-types": "catalog:", - }, - "devDependencies": { - "@cloudflare/workers-types": "catalog:", - "@tsconfig/node22": "22.0.2", - "@types/node": "catalog:", - "cloudflare": "5.2.0", - }, - }, "packages/core": { "name": "@opencode/core", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@ai-sdk/provider": "3.0.19", - "@ai-sdk/provider-utils": "4.0.62", "@effect/platform-node": "catalog:", "@effect/platform-node-shared": "catalog:", "@effect/sql-sqlite-bun": "catalog:", @@ -261,14 +221,14 @@ "@ff-labs/fff-bun": "0.10.5", "@ff-labs/fff-node": "0.10.5", "@lydell/node-pty": "catalog:", - "@modelcontextprotocol/client": "2.3.1", - "@modelcontextprotocol/core": "2.3.1", - "@modelcontextprotocol/server": "2.3.1", + "@modelcontextprotocol/client": "2.4.0", + "@modelcontextprotocol/core": "2.4.0", + "@modelcontextprotocol/server": "2.4.0", "@opencode/ai": "workspace:*", "@opencode/codemode": "workspace:*", "@opencode/plugin": "workspace:*", "@opencode/plugin-browser": "workspace:*", - "@opencode/pty": "0.4.0", + "@opencode/pty": "0.5.0", "@opencode/schema": "workspace:*", "@opencode/util": "workspace:*", "@parcel/watcher": "2.5.1", @@ -321,7 +281,7 @@ }, "packages/desktop": { "name": "@opencode/desktop", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@zip.js/zip.js": "2.7.62", "electron-context-menu": "5.0.0", @@ -366,25 +326,9 @@ "@lydell/node-pty-win32-x64": "1.2.0-beta.12", }, }, - "packages/function": { - "name": "@opencode/function", - "version": "2.2.5", - "dependencies": { - "@octokit/auth-app": "8.0.1", - "@octokit/rest": "catalog:", - "hono": "catalog:", - "jose": "6.0.11", - }, - "devDependencies": { - "@cloudflare/workers-types": "catalog:", - "@tsconfig/node22": "22.0.2", - "@types/node": "catalog:", - "typescript": "catalog:", - }, - }, "packages/gui-plugins": { "name": "@opencode/gui-plugins", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@betteroffice/docx": "0.4.3", "@betteroffice/fonts": "0.4.0", @@ -429,7 +373,7 @@ }, "packages/http-recorder": { "name": "@opencode/http-recorder", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@effect/platform-node-shared": "catalog:", }, @@ -448,7 +392,7 @@ }, "packages/httpapi-codegen": { "name": "@opencode/httpapi-codegen", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "effect": "catalog:", "prettier": "3.6.2", @@ -461,7 +405,7 @@ }, "packages/latex": { "name": "@opencode/latex", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/plugin": "workspace:*", "@opentui/core": "catalog:", @@ -475,7 +419,7 @@ }, "packages/merman": { "name": "@opencode/merman", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/plugin": "workspace:*", "@opentui/core": "catalog:", @@ -488,9 +432,20 @@ "@typescript/native": "catalog:", }, }, + "packages/nav-menus": { + "name": "@opencode/nav-menus", + "version": "2.2.7", + "devDependencies": { + "@happy-dom/global-registrator": "20.0.11", + "@types/bun": "catalog:", + "@typescript/native": "catalog:", + "happy-dom": "20.11.1", + "typescript": "catalog:", + }, + }, "packages/patchmark": { "name": "@opencode/patchmark", - "version": "2.2.5", + "version": "2.2.7", "devDependencies": { "@tsconfig/bun": "catalog:", "@types/bun": "catalog:", @@ -503,7 +458,7 @@ }, "packages/plugin": { "name": "@opencode/plugin", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@ai-sdk/provider": "3.0.8", "@opencode/ai": "workspace:*", @@ -529,8 +484,8 @@ }, "peerDependencies": { "@opencode/theme": "workspace:*", - "@opentui/core": ">=0.8.1", - "@opentui/solid": ">=0.8.1", + "@opentui/core": ">=0.8.4", + "@opentui/solid": ">=0.8.4", "electron": "*", "solid-js": ">=1.9.0", "vite": ">=6", @@ -548,7 +503,7 @@ }, "packages/plugin-browser": { "name": "@opencode/plugin-browser", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/plugin": "workspace:*", "@opencode/schema": "workspace:*", @@ -563,7 +518,7 @@ }, "packages/plugins/figma": { "name": "@opencode/plugin-figma", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "gray-matter": "4.0.3", }, @@ -576,24 +531,9 @@ "@opencode/plugin": "^2.0.27 || ^0.0.0-dev", }, }, - "packages/posts": { - "name": "@opencode/posts", - "dependencies": { - "@astrojs/mdx": "7.0.5", - "@fontsource/commit-mono": "5.3.0", - "astro": "catalog:", - }, - "devDependencies": { - "@astrojs/check": "0.9.6", - "@astrojs/cloudflare": "14.1.4", - "@types/bun": "catalog:", - "typescript": "catalog:", - "wrangler": "4.110.0", - }, - }, "packages/protocol": { "name": "@opencode/protocol", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/schema": "workspace:*", "effect": "catalog:", @@ -608,7 +548,7 @@ }, "packages/schema": { "name": "@opencode/schema", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@standard-schema/spec": "catalog:", "effect": "catalog:", @@ -632,7 +572,7 @@ }, "packages/sdk": { "name": "@opencode/sdk", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/client": "workspace:*", "@opencode/core": "workspace:*", @@ -653,7 +593,7 @@ }, "packages/server": { "name": "@opencode/server", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@effect/platform-node": "catalog:", "@effect/platform-node-shared": "catalog:", @@ -667,7 +607,7 @@ "devDependencies": { "@opencode/client": "workspace:*", "@opencode/plugin": "workspace:*", - "@opencode/pty": "0.4.0", + "@opencode/pty": "0.5.0", "@tsconfig/bun": "catalog:", "@types/bun": "catalog:", "@typescript/native": "catalog:", @@ -676,7 +616,7 @@ }, "packages/session-ui": { "name": "@opencode/session-ui", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@kitlangton/solid-motion": "0.2.2", "@kobalte/core": "catalog:", @@ -708,7 +648,7 @@ }, "packages/simulation": { "name": "@opencode/simulation", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/ai": "workspace:*", "@opencode/core": "workspace:*", @@ -728,12 +668,13 @@ }, "packages/stats/app": { "name": "@opencode/stats-app", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { - "@ibm/plex": "6.4.1", "@kobalte/core": "catalog:", + "@opencode/nav-menus": "workspace:*", "@opencode/stats-core": "workspace:*", "@opencode/ui": "workspace:*", + "@resvg/resvg-wasm": "2.6.2", "@solidjs/meta": "catalog:", "@solidjs/router": "catalog:", "@solidjs/start": "catalog:", @@ -741,8 +682,8 @@ "effect": "catalog:", "i18n-iso-countries": "7.14.0", "nitro": "3.0.260903-beta", + "satori": "0.63.2", "solid-js": "catalog:", - "sst": "catalog:", "vite": "8.2.4", }, "devDependencies": { @@ -750,16 +691,16 @@ "@types/d3-scale": "4.0.9", "@typescript/native": "catalog:", "typescript": "catalog:", + "wawoff2": "2.0.1", }, }, "packages/stats/core": { "name": "@opencode/stats-core", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@planetscale/database": "1.19.0", "drizzle-orm": "catalog:", "effect": "catalog:", - "sst": "catalog:", }, "devDependencies": { "@tsconfig/node22": "catalog:", @@ -772,11 +713,10 @@ }, "packages/stats/server": { "name": "@opencode/stats-server", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/stats-core": "workspace:*", "effect": "catalog:", - "sst": "catalog:", }, "devDependencies": { "@cloudflare/workers-types": "catalog:", @@ -807,7 +747,7 @@ }, "packages/theme": { "name": "@opencode/theme", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opentui/core": "catalog:", "effect": "catalog:", @@ -821,7 +761,7 @@ }, "packages/tui": { "name": "@opencode/tui", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@opencode/client": "workspace:*", "@opencode/core": "workspace:*", @@ -854,7 +794,7 @@ }, "packages/ui": { "name": "@opencode/ui", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@kitlangton/solid-motion": "0.2.2", "@kobalte/core": "catalog:", @@ -890,7 +830,7 @@ }, "packages/util": { "name": "@opencode/util", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "@effect/opentelemetry": "catalog:", "@effect/platform-node": "catalog:", @@ -927,61 +867,109 @@ "jsqr": "1.4.0", }, }, - "packages/web": { - "name": "@opencode/web", - "version": "2.2.5", - "dependencies": { - "@astrojs/cloudflare": "14.1.4", - "@astrojs/markdown-remark": "7.3.2", - "@astrojs/solid-js": "7.1.0", - "@astrojs/starlight": "catalog:", - "@fontsource/ibm-plex-mono": "5.2.5", - "@solid-primitives/resize-observer": "catalog:", - "@types/luxon": "catalog:", - "astro": "catalog:", - "diff": "catalog:", - "js-base64": "3.7.7", - "lang-map": "0.4.0", - "luxon": "catalog:", - "marked": "catalog:", - "marked-shiki": "catalog:", - "rehype-autolink-headings": "7.1.0", - "shiki": "catalog:", - "solid-js": "catalog:", - "toolbeam-docs-theme": "0.4.8", - "vscode-languageserver-types": "3.17.5", - }, + "services/data": { + "name": "@opencode/data", "devDependencies": { - "@astrojs/check": "0.9.11", - "@types/node": "catalog:", + "@cloudflare/build-output-utils": "0.8.5", + "@cloudflare/config": "0.23.0", + "@opencode/stats-app": "workspace:*", + "@opencode/stats-server": "workspace:*", + "@types/bun": "catalog:", + "@typescript/native": "catalog:", + "cf": "1.0.0-beta.12", "typescript": "catalog:", }, }, - "services/changelog": { - "name": "@opencode/changelog", - "dependencies": { - "marked": "catalog:", - }, + "services/files": { + "name": "@opencode/files", "devDependencies": { "@cloudflare/workers-types": "catalog:", "@tsconfig/node22": "catalog:", - "@types/bun": "catalog:", "@typescript/native": "catalog:", "wrangler": "4.110.0", }, }, - "services/files": { - "name": "@opencode/files", + "services/legacy": { + "name": "@opencode/legacy", + "dependencies": { + "@octokit/auth-app": "8.0.1", + "@octokit/rest": "catalog:", + "hono": "catalog:", + "jose": "6.0.11", + }, "devDependencies": { "@cloudflare/workers-types": "catalog:", "@tsconfig/node22": "catalog:", "@typescript/native": "catalog:", - "wrangler": "4.110.0", + "cf": "1.0.0-beta.12", + "wrangler": "4.156.2", + }, + }, + "services/site": { + "name": "@opencode/site", + "dependencies": { + "@ibm/plex": "6.4.1", + "@kitlangton/rolling-number": "0.4.1", + "@opencode/nav-menus": "workspace:*", + "@opencode/ui": "workspace:*", + "@solidjs/meta": "catalog:", + "@solidjs/router": "catalog:", + "@solidjs/start": "catalog:", + "@textjs/app": "1.6.1", + "@textjs/core": "1.6.1", + "@textjs/opencode": "1.6.1", + "@textjs/react": "1.6.1", + "fuzzysort": "3.1.0", + "nitro": "3.0.260903-beta", + "react": "19.3.1", + "react-dom": "19.3.1", + "solid-js": "catalog:", + "three": "0.180.0", + "uqr": "0.1.3", + "vite": "8.2.4", + "zod": "catalog:", + }, + "devDependencies": { + "@babel/core": "7.29.7", + "@cloudflare/build-output-utils": "0.8.5", + "@cloudflare/config": "0.23.0", + "@hona/strobe": "catalog:", + "@mdx-js/mdx": "3.1.1", + "@types/babel__core": "7.20.5", + "@types/bun": "catalog:", + "@types/estree-jsx": "1.0.5", + "@types/hast": "3.0.5", + "@types/mdast": "4.0.4", + "@types/react": "19.3.0", + "@types/three": "0.180.0", + "@typescript/native": "catalog:", + "@webgpu/types": "0.1.54", + "babel-preset-solid": "1.9.15", + "cf": "1.0.0-beta.12", + "estree-util-visit": "2.0.0", + "github-slugger": "2.0.0", + "hast-util-to-text": "4.0.2", + "mdast-util-mdx-jsx": "3.2.0", + "miniflare": "5.20260930.0-alpha", + "pagefind": "1.5.2", + "playwright-core": "1.59.1", + "remark-directive": "4.0.0", + "remark-gfm": "4.0.1", + "remark-smartypants": "3.0.3", + "satori": "0.63.2", + "sharp": "0.34.5", + "shiki": "catalog:", + "typescript": "catalog:", + "unist-util-visit": "5.1.0", + "vfile": "6.0.3", + "vite-plugin-solid": "2.11.14", + "wawoff2": "2.0.1", + "yaml": "2.9.1", }, }, "services/update": { "name": "@opencode/update", - "version": "2.2.5", + "version": "2.2.7", "dependencies": { "jose": "6.0.11", "semver": "catalog:", @@ -996,22 +984,6 @@ "wrangler": "4.110.0", }, }, - "services/www": { - "name": "@opencode/www", - "dependencies": { - "@astrojs/mdx": "7.0.5", - "astro": "catalog:", - }, - "devDependencies": { - "@astrojs/check": "0.9.6", - "@astrojs/cloudflare": "14.1.4", - "@astrojs/markdown-remark": "7.3.2", - "@types/bun": "catalog:", - "pagefind": "1.5.2", - "typescript": "catalog:", - "wrangler": "4.110.0", - }, - }, }, "trustedDependencies": [ "electron", @@ -1019,6 +991,7 @@ ], "patchedDependencies": { "@ai-sdk/openai-compatible@2.0.41": "patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch", + "@modelcontextprotocol/client@2.4.0": "patches/@modelcontextprotocol%2Fclient@2.4.0.patch", "@tanstack/virtual-core@3.17.8": "patches/@tanstack%2Fvirtual-core@3.17.8.patch", "@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", @@ -1027,7 +1000,6 @@ "@silvia-odwyer/photon-node@0.3.4": "patches/@silvia-odwyer%2Fphoton-node@0.3.4.patch", "@pierre/trees@1.0.0-beta.6": "patches/@pierre%2Ftrees@1.0.0-beta.6.patch", "vite@8.2.4": "patches/vite@8.2.4.patch", - "@modelcontextprotocol/client@2.3.1": "patches/@modelcontextprotocol%2Fclient@2.3.1.patch", "@ff-labs/fff-bun@0.10.5": "patches/@ff-labs%2Ffff-bun@0.10.5.patch", "app-builder-lib@26.15.7": "patches/app-builder-lib@26.15.7.patch", "@corvu/drawer@0.2.4": "patches/@corvu%2Fdrawer@0.2.4.patch", @@ -1035,21 +1007,18 @@ "solid-js@1.9.17": "patches/solid-js@1.9.17.patch", }, "overrides": { - "@astrojs/starlight": "catalog:", "@effect/platform-node-shared": "catalog:", "@opentui/core": "catalog:", "@opentui/keymap": "catalog:", "@opentui/solid": "catalog:", "@types/bun": "catalog:", "@types/node": "catalog:", - "astro": "catalog:", "bun-types": "1.4.4", "effect": "catalog:", "open": "11.0.4", "solid-js": "catalog:", }, "catalog": { - "@astrojs/starlight": "0.41.11", "@cloudflare/workers-types": "4.20251008.0", "@corvu/drawer": "0.2.4", "@effect/opentelemetry": "4.1.0", @@ -1057,14 +1026,14 @@ "@effect/platform-node-shared": "4.1.0", "@effect/sql-sqlite-bun": "4.1.0", "@effect/sql-sqlite-node": "4.1.0", - "@hona/strobe": "0.7.3", + "@hona/strobe": "0.28.0", "@kobalte/core": "0.13.13", "@lydell/node-pty": "1.2.0-beta.12", "@npmcli/arborist": "9.4.0", "@octokit/rest": "22.0.0", - "@opentui/core": "0.8.1", - "@opentui/keymap": "0.8.1", - "@opentui/solid": "0.8.1", + "@opentui/core": "0.8.4", + "@opentui/keymap": "0.8.4", + "@opentui/solid": "0.8.4", "@pierre/diffs": "1.6.1", "@pierre/highlights": "0.2.0", "@playwright/test": "1.60.0", @@ -1088,7 +1057,6 @@ "@types/node": "24.12.2", "@types/semver": "7.7.1", "@typescript/native": "npm:typescript@7.1.0-beta", - "astro": "7.3.8", "cross-spawn": "7.0.6", "diff": "8.0.4", "dompurify": "3.4.17", @@ -1108,7 +1076,6 @@ "solid-js": "1.9.17", "solid-list": "0.3.0", "solid-sonner": "0.3.1", - "sst": "4.13.1", "string-width": "7.2.0", "tailwindcss": "4.1.11", "typescript": "npm:@typescript/typescript6@6.0.2", @@ -1123,7 +1090,7 @@ "@ai-sdk/provider": ["@ai-sdk/provider@3.0.19", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-5lWq7zSfRaU5ylDESn3sDQjgGl2AI1vjZKO/6JY3aFW70ct4zcP1kN+ZUYOuTXr28fVsYbyu2YFhddLdIgQFZQ=="], - "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.62", "", { "dependencies": { "@ai-sdk/provider": "3.0.19", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8", "undici": "^6.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-+FXkZ2e169zASBHP5HAakP0Iai3Eoa8zgh7bnuZExsek3N9HgGt/c7l1Oibdxb79vvsn5Mrg2Sjam80mR6bL8A=="], + "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.23", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-z8GlDaCmRSDlqkMF2f4/RFgWxdarvIbyuk+m6WXT1LYgsnGiXRJGTD2Z1+SDl3LqtFuRtGX1aghYvQLoHL/9pg=="], "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], @@ -1167,62 +1134,6 @@ "@ast-grep/cli-win32-x64-msvc": ["@ast-grep/cli-win32-x64-msvc@0.44.0", "", { "os": "win32", "cpu": "x64" }, "sha512-OJEo7f95YYaSuS1byUB7ZctbzxoA7/wCoAol+pt6pvfdW/8Wq+L1qU28glwx7dQ0HgTsnPZbWpXQwmZpCBHhZg=="], - "@astrojs/astro2tsx": ["@astrojs/astro2tsx@0.1.3", "", { "dependencies": { "@emnapi/core": "1.11.3", "@napi-rs/wasm-runtime": "1.2.4" } }, "sha512-GMDC7Eo0myBUA/QLBl0u+OcegJ8LiBhccmNZR34KmprQNP8gQUJlWlOOZWUsxNA2rNS6GuPYcGDyLoPnjmn4/Q=="], - - "@astrojs/check": ["@astrojs/check@0.9.6", "", { "dependencies": { "@astrojs/language-server": "^2.16.1", "chokidar": "^4.0.1", "kleur": "^4.1.5", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": "^5.0.0" }, "bin": { "astro-check": "bin/astro-check.js" } }, "sha512-jlaEu5SxvSgmfGIFfNgcn5/f+29H61NJzEMfAZ82Xopr4XBchXB1GVlcJsE+elUlsYSbXlptZLX+JMG3b/wZEA=="], - - "@astrojs/cloudflare": ["@astrojs/cloudflare@14.1.4", "", { "dependencies": { "@astrojs/internal-helpers": "0.10.1", "@astrojs/underscore-redirects": "1.0.3", "@cloudflare/vite-plugin": "^1.39.0", "piccolore": "^0.1.3", "vite": "^8.0.13" }, "peerDependencies": { "astro": "^7.0.0", "wrangler": "^4.83.0" } }, "sha512-Zyo1E/5/dmegmKODbwUzOd67euNd6oKcbllhAwe3uFFprA7mIFNkpF6yBBa78vIkpMNuU13MkBJHCLd+yJSuEA=="], - - "@astrojs/compiler": ["@astrojs/compiler@2.13.1", "", {}, "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg=="], - - "@astrojs/compiler-binding": ["@astrojs/compiler-binding@0.5.2", "", { "optionalDependencies": { "@astrojs/compiler-binding-android-arm64": "0.5.2", "@astrojs/compiler-binding-darwin-arm64": "0.5.2", "@astrojs/compiler-binding-darwin-x64": "0.5.2", "@astrojs/compiler-binding-linux-arm64-gnu": "0.5.2", "@astrojs/compiler-binding-linux-arm64-musl": "0.5.2", "@astrojs/compiler-binding-linux-x64-gnu": "0.5.2", "@astrojs/compiler-binding-linux-x64-musl": "0.5.2", "@astrojs/compiler-binding-wasm32-wasi": "0.5.2", "@astrojs/compiler-binding-win32-arm64-msvc": "0.5.2", "@astrojs/compiler-binding-win32-x64-msvc": "0.5.2" } }, "sha512-lEn76+0JcMQ5RDXU0wSMWJg2ZppiZvSULpghC29cfv4o9bhvWFDbQjsCtvjjXN9iVLFQ7fL3wTR2L2UU13mP8g=="], - - "@astrojs/compiler-binding-android-arm64": ["@astrojs/compiler-binding-android-arm64@0.5.2", "", { "os": "android", "cpu": "arm64" }, "sha512-kckIxon6Rm/Bxzh9mGPYpRRqUbToUQoHptCmpMmE+Yt0Xumq8CqrKUidyYhrBsrHVO7bxuRzzWUUqvpf+iYceQ=="], - - "@astrojs/compiler-binding-darwin-arm64": ["@astrojs/compiler-binding-darwin-arm64@0.5.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-1ZG5Ar3dD8HtodX9XH1mRmE0qBXZlvjYXSFfpgFwocqfWnvhFuqtGUNseL8wgfImiRMztIjpQqlogQFQQtgiag=="], - - "@astrojs/compiler-binding-darwin-x64": ["@astrojs/compiler-binding-darwin-x64@0.5.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-+kl35S7hiHJ2cb7eujwEsPFYYuSgE11uEE2Z20lAJ+undpgulMcW+weQqFPOSSZccEKHOiLIY+kQHkb4e4092w=="], - - "@astrojs/compiler-binding-linux-arm64-gnu": ["@astrojs/compiler-binding-linux-arm64-gnu@0.5.2", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-BqlR0EHNQLPLwgL9+xogjsAc7zGf0cHho2CPdhv0P1yqbVMwGVaGAqrANP6VYAXCqSC43AF4Czcxc2n+oqdesg=="], - - "@astrojs/compiler-binding-linux-arm64-musl": ["@astrojs/compiler-binding-linux-arm64-musl@0.5.2", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-GRGyby3AZWw5d6JQzidyxPyvGgHWsSusrpgKyFVpDTKctABF7L3Pd5V1cRJbV36/rcu+Eh292/wL7pF7MkmGkQ=="], - - "@astrojs/compiler-binding-linux-x64-gnu": ["@astrojs/compiler-binding-linux-x64-gnu@0.5.2", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-9XAqGTMQAtIslMsjK3xdyY6OI9d59OZqcLBB6pvD/DcoR0daYswfrKx2azdDERDY4AqAnWPC7odVM1BmxYv3Vw=="], - - "@astrojs/compiler-binding-linux-x64-musl": ["@astrojs/compiler-binding-linux-x64-musl@0.5.2", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-jOViewGeTh9bSfS8vK72ECxoy2yvmA+Pd/ZcEvBI5c7+7IcfHwZ5qA4L9fRYuOhSrAifvQ2dV4vm1XAtloaWBw=="], - - "@astrojs/compiler-binding-wasm32-wasi": ["@astrojs/compiler-binding-wasm32-wasi@0.5.2", "", { "dependencies": { "@emnapi/core": "1.11.3", "@emnapi/runtime": "1.11.3", "@napi-rs/wasm-runtime": "^1.2.5" }, "cpu": "none" }, "sha512-Z7p64doar1uvR5C9Xs6j1CV9lGlPVQX7OQ2aAtZ/xKC5aGS6GB13nyc2UfQXTQLvZrvVwsyaflTQy6ziY5Bekw=="], - - "@astrojs/compiler-binding-win32-arm64-msvc": ["@astrojs/compiler-binding-win32-arm64-msvc@0.5.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-Tr13bh+ahTWsjXjzctK7pFpWV+dUU4FtBfETlR7gO+ueex0F+RDch7eRr0YfKysaRhk9tWm14lsCJ5uWyFPNHQ=="], - - "@astrojs/compiler-binding-win32-x64-msvc": ["@astrojs/compiler-binding-win32-x64-msvc@0.5.2", "", { "os": "win32", "cpu": "x64" }, "sha512-SfKkI+jOQYLh6wojPvVPV0lFfQnxisweN9B+qCzRvZp7DHAuGif8Y0WcC5PUgN4jb8VKy57LggQDtggR46Du1g=="], - - "@astrojs/compiler-rs": ["@astrojs/compiler-rs@0.5.2", "", { "dependencies": { "@astrojs/compiler-binding": "0.5.2" } }, "sha512-IvwYLB8t1M86rKO4oPdBi9GP4gzXcgrVlNgocjwos1jeeUuEIV8d9Crn1PvYD/5IKteWOxpIHomf7e8iYlkE+Q=="], - - "@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.10.1", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "js-yaml": "^4.1.1", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.6.0", "unified": "^11.0.5" } }, "sha512-5phcroT/vmOOrYuuAxtkbPixy5hePtlz9i8K4OeDv3dNK6/UQRuXPOSRTxIOBbUY5Sonw2UaxjbuVc43Mcir6Q=="], - - "@astrojs/language-server": ["@astrojs/language-server@2.16.14", "", { "dependencies": { "@astrojs/compiler": "^2.13.1", "@astrojs/yaml2ts": "^0.2.4", "@jridgewell/sourcemap-codec": "^1.5.5", "@volar/kit": "~2.4.28", "@volar/language-core": "~2.4.28", "@volar/language-server": "~2.4.28", "@volar/language-service": "~2.4.28", "muggle-string": "^0.4.1", "tinyglobby": "^0.2.16", "volar-service-css": "0.0.71", "volar-service-emmet": "0.0.71", "volar-service-html": "0.0.71", "volar-service-prettier": "0.0.71", "volar-service-typescript": "0.0.71", "volar-service-typescript-twoslash-queries": "0.0.71", "volar-service-yaml": "0.0.71", "vscode-html-languageservice": "^5.6.2", "vscode-uri": "^3.1.0" }, "peerDependencies": { "prettier": "^3.0.0", "prettier-plugin-astro": ">=0.11.0" }, "optionalPeers": ["prettier", "prettier-plugin-astro"], "bin": { "astro-ls": "./bin/nodeServer.js" } }, "sha512-YPXkBu6N4d1sT09pvBmIDGZay+1MemV551FSgdEM3aZRDzbkxd2H7Cvf8MsVJLVB1mIEyTf1XbMN/30gp7s46w=="], - - "@astrojs/markdown-remark": ["@astrojs/markdown-remark@7.3.2", "", { "dependencies": { "@astrojs/internal-helpers": "0.12.0", "@astrojs/prism": "4.0.2", "@mdx-js/mdx": "^3.1.1", "acorn": "^8.16.0", "estree-util-visit": "^2.0.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-html": "^9.0.5", "hast-util-to-text": "^4.0.2", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", "source-map": "^0.7.6", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "sha512-ubszw8SVEI4OHR5Y+0jTbkmzG8xatrW47iAkQNqH7wUM1bky7DOnr51FGgoUdXt/fmKpUl7sRRX9talmU64Y+g=="], - - "@astrojs/markdown-satteri": ["@astrojs/markdown-satteri@0.4.3", "", { "dependencies": { "@astrojs/internal-helpers": "0.12.0", "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "satteri": "^0.10.3" } }, "sha512-PFbEHPnwUlLvpXd7RXrrKM+j12akF4bG+DSuNuoN+3eiwjOwp4HaPi+QQdbkBV7QEYXmzyKca50OJsmGxhNIUA=="], - - "@astrojs/mdx": ["@astrojs/mdx@7.0.5", "", { "dependencies": { "@astrojs/internal-helpers": "0.10.2", "@astrojs/markdown-remark": "7.2.2", "@mdx-js/mdx": "^3.1.1", "acorn": "^8.16.0", "es-module-lexer": "^2.0.0", "estree-util-visit": "^2.0.0", "hast-util-to-html": "^9.0.5", "piccolore": "^0.1.3", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.1", "remark-smartypants": "^3.0.2", "source-map": "^0.7.6", "unist-util-visit": "^5.1.0", "vfile": "^6.0.3" }, "peerDependencies": { "@astrojs/markdown-satteri": "^0.3.1", "astro": "^7.0.0" }, "optionalPeers": ["@astrojs/markdown-satteri"] }, "sha512-wEM/HH1RiEntyPVagdiF+yArzfcYLKBB0C1RZspVidKZ97rRMbaqP1Nbl/GR0sJs8zwaceqxRymw8aOKKJRdYw=="], - - "@astrojs/prism": ["@astrojs/prism@4.0.2", "", { "dependencies": { "prismjs": "^1.30.0" } }, "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA=="], - - "@astrojs/sitemap": ["@astrojs/sitemap@3.7.3", "", { "dependencies": { "sitemap": "^9.0.0", "stream-replace-string": "^2.0.0", "zod": "^4.3.6" } }, "sha512-f8euLVsyeAmAkSm/1M2Kb8sL8byQmfgbvBNaHFItCheTj/IpiJYSEWVcqDHZ/yEHxiS7+w87mQkzwZaPHmk5GA=="], - - "@astrojs/solid-js": ["@astrojs/solid-js@7.1.0", "", { "dependencies": { "vite": "^8.3.4", "vite-plugin-solid": "^2.11.14", "vitefu": "^1.1.3" }, "peerDependencies": { "solid-devtools": "^0.34.5", "solid-js": "^1.9.13" }, "optionalPeers": ["solid-devtools"] }, "sha512-l8iE3Mqd8bdTxKh8VeLfmCPpd8X5BQ/CT+lLaF50f+41auSK9ylJo772sarmuqkONEG5gzFH8/hSHdWopyRMYQ=="], - - "@astrojs/starlight": ["@astrojs/starlight@0.41.11", "", { "dependencies": { "@astrojs/markdown-satteri": "^0.3.5", "@astrojs/mdx": "^7.0.5", "@astrojs/sitemap": "^3.7.3", "@pagefind/default-ui": "^1.3.0", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", "@types/mdast": "^4.0.4", "astro-expressive-code": "^0.44.0", "bcp-47": "^2.1.0", "hast-util-from-html": "^2.0.3", "hast-util-select": "^6.0.4", "hast-util-to-string": "^3.0.1", "hastscript": "^9.0.1", "i18next": "^26.0.7", "js-yaml": "^4.1.1", "klona": "^2.0.6", "magic-string": "^0.30.21", "mdast-util-directive": "^3.1.0", "mdast-util-to-markdown": "^2.1.2", "mdast-util-to-string": "^4.0.0", "pagefind": "^1.5.2", "rehype": "^13.0.2", "rehype-format": "^5.0.1", "remark-directive": "^4.0.0", "satteri": "^0.9.1", "ultrahtml": "^1.6.0", "unified": "^11.0.5", "unist-util-visit": "^5.1.0", "vfile": "^6.0.3" }, "peerDependencies": { "@astrojs/markdown-remark": "^7.2.0", "astro": "^7.0.2" }, "optionalPeers": ["@astrojs/markdown-remark"] }, "sha512-hM95Mbsl4l60SBwaNQA/HTxpOLGfeB5EfR9qY3kr0SsAVKUspCssjO0RVBsLiPAE6EA5xuORcCoz/Q6DTX+MuQ=="], - - "@astrojs/telemetry": ["@astrojs/telemetry@3.3.3", "", { "dependencies": { "ci-info": "^4.4.0", "dset": "^3.1.4", "is-docker": "^4.0.0", "package-manager-detector": "^1.6.0" } }, "sha512-C1TLn5sPJr0x4vk56piHWKbnqlEB8BKyte5Y45V02U+D7BGO5eMqZDH5aPjnkXQWJggvmsTXxH03QMZ9NgWLzQ=="], - - "@astrojs/underscore-redirects": ["@astrojs/underscore-redirects@1.0.3", "", {}, "sha512-cxnGSw+sJigBLdX4TMSZKkzV6C3gMLJMucDk2W+n281Xhie68T2/9f1+1NMNDCZsc5i0FED7Qt5I10g2O9wtZg=="], - - "@astrojs/yaml2ts": ["@astrojs/yaml2ts@0.2.4", "", { "dependencies": { "yaml": "^2.8.3" } }, "sha512-8oddpOae35pJsXPQXhTkM0ypfKPskVsh2bCxRtbf7e+/Epw2nReakFYpLKjZMEr75CsoF203PMnCocpfz0s69A=="], - "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], "@aws-crypto/sha256-browser": ["@aws-crypto/sha256-browser@5.2.0", "", { "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw=="], @@ -1235,8 +1146,6 @@ "@aws-sdk/client-cognito-identity": ["@aws-sdk/client-cognito-identity@3.1057.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.15", "@aws-sdk/credential-provider-node": "^3.972.47", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.5", "@smithy/fetch-http-handler": "^5.4.5", "@smithy/node-http-handler": "^4.7.5", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-5MliYkp2u0+2arTp5fZIaxl+xmm90LEKv/VeSxhfNQW4t0fvWJrNO429/jchWQenNoDRrOGE59VfbuZUfwFujg=="], - "@aws-sdk/client-lambda": ["@aws-sdk/client-lambda@3.1111.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.8", "@aws-sdk/credential-provider-node": "^3.972.80", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/fetch-http-handler": "^5.6.13", "@smithy/node-http-handler": "^4.9.13", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-jG2rB6LY2rx3XT55axgH3C0aIv1egvI0kqPYC6jfghVp82kWssU7R/1dJxXr0PnPLv4wq+WXRyLEmjyKURUjFQ=="], - "@aws-sdk/core": ["@aws-sdk/core@3.977.8", "", { "dependencies": { "@aws-sdk/types": "^3.974.4", "@aws-sdk/xml-builder": "^3.972.39", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.31.1", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.16.1", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-7+Kcrkvrk9lM/m7jRhHpT4jCdvzGHsuaSRbF8TdzzkY1mRzp/Ogwf9c7H29k4gGhey0BBWhCWr16+t0J61gwmg=="], "@aws-sdk/credential-provider-cognito-identity": ["@aws-sdk/credential-provider-cognito-identity@3.972.68", "", { "dependencies": { "@aws-sdk/nested-clients": "^3.997.43", "@aws-sdk/types": "^3.974.4", "@smithy/core": "^3.31.1", "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-Fo2RC5hZmEVhnVLMzNjYL6Iu78F4wDuaNtkgzRVU4DlUaFhcXxsnxWBOTH2drxZ59OHSipQ1LndfkCWPxGBJHA=="], @@ -1271,8 +1180,6 @@ "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.39", "", { "dependencies": { "@smithy/types": "^4.16.1", "tslib": "^2.6.2" } }, "sha512-FTti8DS5MMWXNUWiRwXAJeYS+0GHHiMy0+7XOhcwk63ILHmfS2UFy2z/HNpZCSOJJ3P3dnWY6hfYNW3DF0nXUA=="], - "@aws/durable-execution-sdk-js": ["@aws/durable-execution-sdk-js@1.0.2", "", { "dependencies": { "@aws-sdk/client-lambda": "^3.943.0" } }, "sha512-KIYBVqV9gArkWdPEDYOjJqLlO+NecmCXOXadNBlOspJTmqztwuiyb6aZc468bYWSGuL4Me/gyTIK97ubkwFNCw=="], - "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.3.0", "", {}, "sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ=="], "@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], @@ -1425,6 +1332,10 @@ "@babel/plugin-transform-property-literals": ["@babel/plugin-transform-property-literals@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-bOMRLQuI0A5ZqHq3OWJ89/rXpJ/NJrbVhXiP4zwPGMs6kpcVsuTUNjwoE30K0Qm3mf48a/TnRYYD6vPNqcg6jA=="], + "@babel/plugin-transform-react-jsx-self": ["@babel/plugin-transform-react-jsx-self@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw=="], + + "@babel/plugin-transform-react-jsx-source": ["@babel/plugin-transform-react-jsx-source@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q=="], + "@babel/plugin-transform-regenerator": ["@babel/plugin-transform-regenerator@7.29.8", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-0UpIXPtdDtMXfnV2OJAVMLpj3H/92vmkA6lpSRakmycJvj3VUy6Xs1dM8tXRugupykr5WB+LpiVl0J8LMVg2mg=="], "@babel/plugin-transform-regexp-modifiers": ["@babel/plugin-transform-regexp-modifiers@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-mB5Fs0VWrJ42ZCmc8114v60qetdaUVNkj9PmSZRmanCZM3S9hm0CFRLjRmYIsuXav14l2jvZ+4T8iiCGnhj3nQ=="], @@ -1475,35 +1386,21 @@ "@brendonovich/vite-plugin-opencode": ["@brendonovich/vite-plugin-opencode@0.1.3", "", { "dependencies": { "@babel/core": "^7.29.0", "@opencode-ai/client": "0.0.0-beta-18050" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-iiIwlNoycOMUiaUzL1ZirLapCG3WY8cg9hSj4KgE/JYIWgqauoHikIlfUt7SdMqqGIkb4iZu6I1MxgDDJaRfBA=="], - "@bruits/satteri-darwin-arm64": ["@bruits/satteri-darwin-arm64@0.9.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-iw4nZgx9v30lWo/MTngQqi1pI78KI0DnkSm+lVJGYdmPLgAyDNJigVhpG42/Iq55A6c1Ll8q66ljyyRiQUxwow=="], - - "@bruits/satteri-darwin-x64": ["@bruits/satteri-darwin-x64@0.9.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-6T26Z5Kf3cFW2PSlk9p7zT7yVxvuBSiJvYyz9u8KjYwMTqZyIDOj2wDyNpxKV4+6yUVG7rddq2QwvG/8LJA2+Q=="], - - "@bruits/satteri-linux-arm64-gnu": ["@bruits/satteri-linux-arm64-gnu@0.9.5", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-u51id17uJwNEMK9nBlICsq6U31c+XVqQueVBkwRIzZG+gMpS8TOJctt5h5Wz33Z8xnMdTd+adtACVz0yHgGuOA=="], - - "@bruits/satteri-linux-arm64-musl": ["@bruits/satteri-linux-arm64-musl@0.9.5", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-v39HxiwGC5Rqm01HksP6+5Y+xKLPlsuVFgIgpEAo+SiQ22c+mJVhS3u7Z6ePAKdhL5NJoK1xq70kLz3L13AhpQ=="], - - "@bruits/satteri-linux-x64-gnu": ["@bruits/satteri-linux-x64-gnu@0.9.5", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-F3uO8uFp3pAP5ZGXttwvh57GS7s0lL953tnNdyI2gRyP4kOOkp6pyGojNJzCjkDvWI2Cvb9iNrKok3aqQPauAw=="], - - "@bruits/satteri-linux-x64-musl": ["@bruits/satteri-linux-x64-musl@0.9.5", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-bicEqglLlz++mWyADaZoP0JY20s4vDfLjaPYgQqC+NI4zZLTOOg1T4GB8aqtc822Pqji8SQBmSrTb7CrP8i08Q=="], - - "@bruits/satteri-wasm32-wasi": ["@bruits/satteri-wasm32-wasi@0.9.5", "", { "dependencies": { "@emnapi/core": "1.11.1", "@emnapi/runtime": "1.11.1", "@napi-rs/wasm-runtime": "^1.1.6" }, "cpu": "none" }, "sha512-zauAuMwfPnKPUkd4AFixRFpXdgKwP2mKgxrIIo2gJzW0/ZneF9dbHnLkojSpaBnCCp7VUL1hIi5WWZvB1CqmAQ=="], - - "@bruits/satteri-win32-arm64-msvc": ["@bruits/satteri-win32-arm64-msvc@0.9.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-SrfE7NEsgZjBvU3c+RR6oQRu0ToXY5uVJEbieXEF0YTctIV2zAVlbaMjWLts074QCgh3a+XHWkR/lWh2VH2LUg=="], + "@clack/core": ["@clack/core@1.0.0-alpha.1", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-rFbCU83JnN7l3W1nfgCqqme4ZZvTTgsiKQ6FM0l+r0P+o2eJpExcocBUWUIwnDzL76Aca9VhUdWmB2MbUv+Qyg=="], - "@bruits/satteri-win32-x64-msvc": ["@bruits/satteri-win32-x64-msvc@0.9.5", "", { "os": "win32", "cpu": "x64" }, "sha512-5Kw9ZAtTGS8WHizyn+CJhjjfIQrw+7jcZodpmpXJjefnO15M8UexIi6JR2E5thyvsmHyhL6ZDDMUNR4bKJPd4g=="], + "@clack/prompts": ["@clack/prompts@1.0.0-alpha.1", "", { "dependencies": { "@clack/core": "1.0.0-alpha.1", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-07MNT0OsxjKOcyVfX8KhXBhJiyUbDP1vuIAcHc+nx5v93MJO23pX3X/k3bWz6T3rpM9dgWPq90i4Jq7gZAyMbw=="], - "@capsizecss/unpack": ["@capsizecss/unpack@4.0.1", "", { "dependencies": { "fontkitten": "^1.0.3" } }, "sha512-CuNiSqg7+e1cO/GjffyMOm5Tt2jUF9CWHHnvQ/UkqvtkGfHdgwEC0wpmq7fkN3gxwpRnrAN0WzO3vREKmNolMQ=="], + "@cloudflare/build-output-utils": ["@cloudflare/build-output-utils@0.8.5", "", { "dependencies": { "@cloudflare/config": "0.23.0" } }, "sha512-xnwcDCyBSErZeOj5eUy1gTrmVjwIY51TZ0Pz9W7mZqLGA3IkIckud7dNtFdGhKSXL2szfxBRbGM4R4qFE4SoPA=="], - "@clack/core": ["@clack/core@1.0.0-alpha.1", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-rFbCU83JnN7l3W1nfgCqqme4ZZvTTgsiKQ6FM0l+r0P+o2eJpExcocBUWUIwnDzL76Aca9VhUdWmB2MbUv+Qyg=="], + "@cloudflare/codemods": ["@cloudflare/codemods@0.4.0", "", { "bin": { "cloudflare-codemods": "dist/bin.mjs" } }, "sha512-qeRpKNXtvqhTtagx/5cLmDaFx/voBhWJ1S6SdFdBkE3OtgcPVz+Q8MtIG26zltW9Z0Icsu2FGBxV5RFmuHI/Bg=="], - "@clack/prompts": ["@clack/prompts@1.0.0-alpha.1", "", { "dependencies": { "@clack/core": "1.0.0-alpha.1", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-07MNT0OsxjKOcyVfX8KhXBhJiyUbDP1vuIAcHc+nx5v93MJO23pX3X/k3bWz6T3rpM9dgWPq90i4Jq7gZAyMbw=="], + "@cloudflare/config": ["@cloudflare/config@0.23.0", "", { "dependencies": { "zod": "4.4.3" } }, "sha512-oE0S7X54esZmJHr9hhCoqODR+yTxxkSYWCLtRiItQdPs0gQuqYw9a13zChhK+8DmdCUJIFBsMAR6t+mfu8g+9w=="], "@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.5.0", "", {}, "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg=="], - "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.16.1", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": ">1.20260305.0 <2.0.0-0" }, "optionalPeers": ["workerd"] }, "sha512-ECxObrMfyTl5bhQf/lZCXwo5G6xX9IAUo+nDMKK4SZ8m4Jvvxp52vilxyySSWh2YTZz8+HQ07qGH/2rEom1vDw=="], + "@cloudflare/runtime-types": ["@cloudflare/runtime-types@0.1.7", "", { "dependencies": { "miniflare": "5.20261001.0-alpha", "workerd": "1.20261001.1" } }, "sha512-avgC1wfTunbVea8HOq4ygiQ0WFQVNxcUHOQvH9TM47+0NTdsVTqB8rPQg6Tb5BfVkcWh/a0RAjk+Elr/h35mtQ=="], - "@cloudflare/vite-plugin": ["@cloudflare/vite-plugin@1.52.1", "", { "dependencies": { "@cloudflare/unenv-preset": "2.16.1", "miniflare": "5.20260811.1-alpha", "unenv": "2.0.0-rc.24", "workerd": "1.20260811.1", "wrangler": "4.123.0", "ws": "8.21.0" }, "peerDependencies": { "vite": "^6.1.0 || ^7.0.0 || ^8.0.0" }, "bin": { "cf-vite": "bin/cf-vite" } }, "sha512-O2IkD8E03qsUxNBdDRfDI9JPl25XIPt+76WJf8tgm206c34jYk8nn12ylBiOI/6NA8XUFhLjRTF1BGY+kVylXw=="], + "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.16.1", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": ">1.20260305.0 <2.0.0-0" }, "optionalPeers": ["workerd"] }, "sha512-ECxObrMfyTl5bhQf/lZCXwo5G6xX9IAUo+nDMKK4SZ8m4Jvvxp52vilxyySSWh2YTZz8+HQ07qGH/2rEom1vDw=="], "@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260708.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-HXFCvhS1wpg3uXO0CLUwmwC41i2loM5FSK69EUchOBpmYBAXxT1oHLm6EOA5lqhTk5Mu9kjRiQYxa1GwKPwfJg=="], @@ -1525,7 +1422,7 @@ "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], - "@ctrl/tinycolor": ["@ctrl/tinycolor@4.2.0", "", {}, "sha512-kzyuwOAQnXJNLS9PSyrk0CWk35nWJW/zl/6KvnTBMFK65gm7U1/Z5BqjxeapjZCIhQcM/DsrEmcbRwDyXyXK4A=="], + "@dimforge/rapier3d-compat": ["@dimforge/rapier3d-compat@0.12.0", "", {}, "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow=="], "@dnd-kit/abstract": ["@dnd-kit/abstract@0.5.0", "", { "dependencies": { "@dnd-kit/geometry": "^0.5.0", "@dnd-kit/state": "^0.5.0", "tslib": "^2.6.2" } }, "sha512-hi13iMJgjPX/KDYVKg5VeDIhmYiV6buc9bAX+tCLYf4QdyYjPbsXjn2sPo6m7fQ6SGJBEFgHJ2PemeKDUbwBaA=="], @@ -1569,23 +1466,9 @@ "@electron/windows-sign": ["@electron/windows-sign@1.2.2", "", { "dependencies": { "cross-dirname": "^0.1.0", "debug": "^4.3.4", "fs-extra": "^11.1.1", "minimist": "^1.2.8", "postject": "^1.0.0-alpha.6" }, "bin": { "electron-windows-sign": "bin/electron-windows-sign.js" } }, "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ=="], - "@emmetio/abbreviation": ["@emmetio/abbreviation@2.3.3", "", { "dependencies": { "@emmetio/scanner": "^1.0.4" } }, "sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA=="], - - "@emmetio/css-abbreviation": ["@emmetio/css-abbreviation@2.1.8", "", { "dependencies": { "@emmetio/scanner": "^1.0.4" } }, "sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw=="], - - "@emmetio/css-parser": ["@emmetio/css-parser@0.4.1", "", { "dependencies": { "@emmetio/stream-reader": "^2.2.0", "@emmetio/stream-reader-utils": "^0.1.0" } }, "sha512-2bC6m0MV/voF4CTZiAbG5MWKbq5EBmDPKu9Sb7s7nVcEzNQlrZP6mFFFlIaISM8X6514H9shWMme1fCm8cWAfQ=="], - - "@emmetio/html-matcher": ["@emmetio/html-matcher@1.3.0", "", { "dependencies": { "@emmetio/scanner": "^1.0.0" } }, "sha512-NTbsvppE5eVyBMuyGfVu2CRrLvo7J4YHb6t9sBFLyY03WYhXET37qA4zOYUjBWFCRHO7pS1B9khERtY0f5JXPQ=="], - - "@emmetio/scanner": ["@emmetio/scanner@1.0.4", "", {}, "sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA=="], - - "@emmetio/stream-reader": ["@emmetio/stream-reader@2.2.0", "", {}, "sha512-fXVXEyFA5Yv3M3n8sUGT7+fvecGrZP4k6FnWWMSZVQf69kAq0LLpaBQLGcPR30m3zMmKYhECP4k/ZkzvhEW5kw=="], - - "@emmetio/stream-reader-utils": ["@emmetio/stream-reader-utils@0.1.0", "", {}, "sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A=="], - "@emnapi/core": ["@emnapi/core@1.11.2", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA=="], - "@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="], + "@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], @@ -1641,14 +1524,6 @@ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.12", "", { "os": "win32", "cpu": "x64" }, "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA=="], - "@expressive-code/core": ["@expressive-code/core@0.44.2", "", { "dependencies": { "@ctrl/tinycolor": "^4.0.4", "hast-util-select": "^6.0.2", "hast-util-to-html": "^9.0.1", "hast-util-to-text": "^4.0.1", "hastscript": "^9.0.0", "postcss": "^8.4.38", "postcss-nested": "^6.0.1", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1" } }, "sha512-Yw5KonQCD1HoOO2P89y4wifqS9qrJcGVY0LkVMUsVZjhi++bhz4WwQ37inenKFNOEVo50P7cjoVsCdaVnUbq8w=="], - - "@expressive-code/plugin-frames": ["@expressive-code/plugin-frames@0.44.2", "", { "dependencies": { "@expressive-code/core": "^0.44.2" } }, "sha512-gVLm6TQMNIRWIaM7o+mCtxkGNjLZY5/2faSTLoXeo9wv/Pkj/0QAtZyXPVPrRsPARqiipATNFmfvQFLJudxPHQ=="], - - "@expressive-code/plugin-shiki": ["@expressive-code/plugin-shiki@0.44.2", "", { "dependencies": { "@expressive-code/core": "^0.44.2", "shiki": "^4.0.2" } }, "sha512-ebWIvCDzXvjyD8rH6T6DfytYJw1GoArLR4nusIAE4VxXrCQf3d+owytiv010KU/dUg+SRLZskDn0N+HaFXeuSg=="], - - "@expressive-code/plugin-text-markers": ["@expressive-code/plugin-text-markers@0.44.2", "", { "dependencies": { "@expressive-code/core": "^0.44.2" } }, "sha512-SNI7EgUSiADqbqUzzMbj1ZeC/r2pa5eg3KyFOGAd3a7EsIA4qzjXQLp+ODWQtHVDKFCdGs4J3ovSJUqvKIK96g=="], - "@ff-labs/fff-bin-android-arm64": ["@ff-labs/fff-bin-android-arm64@0.10.5", "", { "os": "android", "cpu": "arm64" }, "sha512-idn1m9ycwv0Dzz6ih4H8e/X1WpGF6kglUxqP78oYgoC2sgAdPtLxD6hIAZK13p8isK7H8EMwrMze/4lynEDcKQ=="], "@ff-labs/fff-bin-darwin-arm64": ["@ff-labs/fff-bin-darwin-arm64@0.10.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-tG0VSt6fs3C2/Y6NDp57YJVXGEnrJ4F/e5gDrFCbNeuwJe9LmcCKh6oHWUEZOaaymYT90kQmwuXZTvORP3G6Vw=="], @@ -1677,10 +1552,6 @@ "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="], - "@fontsource/commit-mono": ["@fontsource/commit-mono@5.3.0", "", {}, "sha512-Bs+zlEWHDgk/cCVWEMJJaA7LbBU3Ixi5Zums+SSwMKdm2N7RJ4P7jCJTwsMHRt5WFiXYB0tu0q9HMfkn0YsLsQ=="], - - "@fontsource/ibm-plex-mono": ["@fontsource/ibm-plex-mono@5.2.5", "", {}, "sha512-G09N3GfuT9qj3Ax2FDZvKqZttzM3v+cco2l8uXamhKyXLdmlaUDH5o88/C3vtTHj2oT7yRKsvxz9F+BXbWKMYA=="], - "@formatjs/ecma402-abstract": ["@formatjs/ecma402-abstract@2.3.6", "", { "dependencies": { "@formatjs/fast-memoize": "2.2.7", "@formatjs/intl-localematcher": "0.6.2", "decimal.js": "^10.4.3", "tslib": "^2.8.0" } }, "sha512-HJnTFeRM2kVFVr5gr5kH1XP6K0JcJtE7Lzvtr3FS/so5f1kpsqqqxy5JF+FRaO6H2qmcMfAUIox7AJteieRtVw=="], "@formatjs/fast-memoize": ["@formatjs/fast-memoize@2.2.7", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-Yabmi9nSvyOMrlSeGGWDiH7rf3a7sIwplbvo/dlz9WCIjzIQAfy1RMf4S0X3yG724n5Ghu2GmEl5NJIV6O9sZQ=="], @@ -1697,17 +1568,19 @@ "@happy-dom/global-registrator": ["@happy-dom/global-registrator@20.0.11", "", { "dependencies": { "@types/node": "^20.0.0", "happy-dom": "^20.0.11" } }, "sha512-GqNqiShBT/lzkHTMC/slKBrvN0DsD4Di8ssBk4aDaVgEn+2WMzE6DXxq701ndSXj7/0cJ8mNT71pM7Bnrr6JRw=="], - "@hona/strobe": ["@hona/strobe@0.7.3", "", { "optionalDependencies": { "@hona/strobe-darwin-arm64": "0.7.3", "@hona/strobe-darwin-x64": "0.7.3", "@hona/strobe-linux-arm64": "0.7.3", "@hona/strobe-linux-x64": "0.7.3", "@hona/strobe-win32-x64": "0.7.3" }, "bin": { "strobe": "bin/strobe.js" } }, "sha512-EZb4MdTqSnHPLncuEQhnpj65mywDFjYhNEWGjNg2Gtee1YhBxbNY9QZgSwj/EJaIahW10myDKFJTs8slY1drbQ=="], + "@hona/strobe": ["@hona/strobe@0.28.0", "", { "optionalDependencies": { "@hona/strobe-darwin-arm64": "0.28.0", "@hona/strobe-darwin-x64": "0.28.0", "@hona/strobe-linux-arm64": "0.28.0", "@hona/strobe-linux-x64": "0.28.0", "@hona/strobe-win32-arm64": "0.28.0", "@hona/strobe-win32-x64": "0.28.0" }, "bin": { "strobe": "bin/strobe.js" } }, "sha512-5JzZqIMxeiLR5encQ1e+tCZl8zlkN+QGHAga/e+WOm2rk9m1Ep4bDy0oWUiPynhha45X9luOlJxoxs+8T5bJXg=="], - "@hona/strobe-darwin-arm64": ["@hona/strobe-darwin-arm64@0.7.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ksvvLAujXeUTC7+qN8YxZzT0F52JD5Bp7GqkTRZ9auvkXz7iuqWFxEDrQayKx+NAQeMHuXTuHgKB1zaViUYI4A=="], + "@hona/strobe-darwin-arm64": ["@hona/strobe-darwin-arm64@0.28.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zv10Kv1eYtJC8aVxcqOFdwxkBNQ4JWbo95+7dHxboFhf+zR6h4foV2VEmaSpHb59vSPFn29/OTTpkQD8UVg9pA=="], - "@hona/strobe-darwin-x64": ["@hona/strobe-darwin-x64@0.7.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-M4llAmpdGvlMBLHWYPIreVfO9bMkU5U/+XklO8LCUD9lG19aBAKCmWtCCJ8K1ZpRCHMLdadWiywiWJe9IaukxA=="], + "@hona/strobe-darwin-x64": ["@hona/strobe-darwin-x64@0.28.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-8EsxZu6i/HfwUhfGqPdbyvPuK4PMHV23R6fVk0s60CB72VSsstl92PMY5REtEOE6nDysF1azsPs/myUVFzDlKw=="], - "@hona/strobe-linux-arm64": ["@hona/strobe-linux-arm64@0.7.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-wkeYba5BXjJe8HjeJTYuFxvUPVZjWw3MRp1IHgSXt3l7Iwmwtn7/PB05OZMpdvT0j5PxXhizTJ8voLcBCgrTTw=="], + "@hona/strobe-linux-arm64": ["@hona/strobe-linux-arm64@0.28.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-n/C0mRzvNcVUntBmCUes7j21N0Y25sGCgy/r53D/WZStysn/QVfOzCWtkkPjZ09TJ8MDY4bIOk7WPdV5s/fMgA=="], - "@hona/strobe-linux-x64": ["@hona/strobe-linux-x64@0.7.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Ka5e9d4zgWwOyueHMpBzPgMLHcQ94lg6tuQuudzcdCkhc3FdyarqD7W6CQ9deVLvzCpBf7fTP7kELVHdSA42xA=="], + "@hona/strobe-linux-x64": ["@hona/strobe-linux-x64@0.28.0", "", { "os": "linux", "cpu": "x64" }, "sha512-G+z9vgn0OwF/K3tKx3QGpAI+GML1O2XJUGjorIYLQ0wmgi6G6FnKCb8Zk/hcKTdUxp5VNsElibPsd7JEGfrQvA=="], - "@hona/strobe-win32-x64": ["@hona/strobe-win32-x64@0.7.3", "", { "os": "win32", "cpu": "x64" }, "sha512-BW5EUcD1TnwAomS8cHwvhGrjP12j2JEkZ57UXzq3q4ydI9zqQ47LG+e7v3YmjpQwXAVH9Md90m29Um9mPBHn2Q=="], + "@hona/strobe-win32-arm64": ["@hona/strobe-win32-arm64@0.28.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-rHPNY0+XO+3dTaZO9r0gKWoWPr4aHNhZC6KNX5kIvJbJ2/QuEUyEJmzFkvSlx68ixl5rbg3lBGB2tO7YNOvotg=="], + + "@hona/strobe-win32-x64": ["@hona/strobe-win32-x64@0.28.0", "", { "os": "win32", "cpu": "x64" }, "sha512-kZJ9l/lZ7zneU2NVj7p1WmSifVrWwRQFzIOw3MfEjaC1TqGD2+w0JFCNuzYCp7j8irtRC/OM7W5/9fLjGy/kxQ=="], "@hono/node-server": ["@hono/node-server@2.1.5", "", { "peerDependencies": { "hono": "^4 || ^5.0.0-0" } }, "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q=="], @@ -1717,57 +1590,57 @@ "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="], - "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg=="], + "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], - "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.4" }, "os": "darwin", "cpu": "x64" }, "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw=="], + "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.2.4" }, "os": "darwin", "cpu": "x64" }, "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw=="], - "@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "os": "freebsd" }, "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw=="], + "@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.4", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "os": "freebsd" }, "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA=="], - "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw=="], + "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g=="], - "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ=="], + "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg=="], - "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.4", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw=="], + "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.2.4", "", { "os": "linux", "cpu": "arm" }, "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A=="], - "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A=="], + "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw=="], - "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ=="], + "@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.2.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA=="], - "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.4", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q=="], + "@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.2.4", "", { "os": "linux", "cpu": "none" }, "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA=="], - "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ=="], + "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.2.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ=="], - "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw=="], + "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw=="], - "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA=="], + "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw=="], - "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg=="], + "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg=="], - "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.4" }, "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ=="], + "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.2.4" }, "os": "linux", "cpu": "arm" }, "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw=="], - "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ=="], + "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg=="], - "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.4" }, "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA=="], + "@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.2.4" }, "os": "linux", "cpu": "ppc64" }, "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA=="], - "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.4" }, "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ=="], + "@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.2.4" }, "os": "linux", "cpu": "none" }, "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw=="], - "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.4" }, "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA=="], + "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.2.4" }, "os": "linux", "cpu": "s390x" }, "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg=="], - "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.4" }, "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog=="], + "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ=="], - "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg=="], + "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg=="], - "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.4" }, "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A=="], + "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q=="], "@img/sharp-wasm32": ["@img/sharp-wasm32@0.34.5", "", { "dependencies": { "@emnapi/runtime": "^1.7.0" }, "cpu": "none" }, "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw=="], - "@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "cpu": "none" }, "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA=="], + "@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.4", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "cpu": "none" }, "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA=="], - "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q=="], + "@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.34.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g=="], - "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A=="], + "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.34.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg=="], - "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.5", "", { "os": "win32", "cpu": "x64" }, "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg=="], + "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], "@internationalized/number": ["@internationalized/number@3.6.7", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-3ji1fcrT+FPAK86UqEhB/psHixYo6niWPJtt7+qRaYFynt/BaJG8GhAPimtWUpEiVSTq8ZM8L5psMxGquiB/Vg=="], @@ -1819,13 +1692,13 @@ "@mdx-js/mdx": ["@mdx-js/mdx@3.1.1", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdx": "^2.0.0", "acorn": "^8.0.0", "collapse-white-space": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-util-scope": "^1.0.0", "estree-walker": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "markdown-extensions": "^2.0.0", "recma-build-jsx": "^1.0.0", "recma-jsx": "^1.0.0", "recma-stringify": "^1.0.0", "rehype-recma": "^1.0.0", "remark-mdx": "^3.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "source-map": "^0.7.0", "unified": "^11.0.0", "unist-util-position-from-estree": "^2.0.0", "unist-util-stringify-position": "^4.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ=="], - "@modelcontextprotocol/client": ["@modelcontextprotocol/client@2.3.1", "", { "dependencies": { "@modelcontextprotocol/core": "2.3.1", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.8", "jose": "^6.1.3", "pkce-challenge": "^5.0.0", "zod": "^4.2.0" } }, "sha512-mIGZXpHsjnZ6lD+gD/WCMpR5k8yVQQ8nNFH1N0Srf7AvnwTUMYD6pvTY8ng2+He5FfV7YMZLmrjL7cLa/cc3dQ=="], + "@modelcontextprotocol/client": ["@modelcontextprotocol/client@2.4.0", "", { "dependencies": { "@modelcontextprotocol/core": "2.4.0", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.8", "jose": "^6.1.3", "pkce-challenge": "^5.0.0", "zod": "^4.2.0" } }, "sha512-LgrD2OphHuG12vfKFKz6SOnq7bKHQmhGJIAYdD+MZBn2npHEyry6uD8zvktodtl5CQM85MO0anUyD9JwmUmxww=="], - "@modelcontextprotocol/core": ["@modelcontextprotocol/core@2.3.1", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-laVmIhPGpWi7rG9q+0UigblRN0Hws/Yjlb6qLFtVqryXVLkc4h+yN8z731POD2LnAGQlFe7/tXhUm7Bi0YB91g=="], + "@modelcontextprotocol/core": ["@modelcontextprotocol/core@2.4.0", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q=="], "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.32.2", "", { "dependencies": { "@hono/node-server": "^1.19.9 || ^2.0.5", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-SWsVtH/0vULSQStoZ6xxH2K09Li8fXYTMC64ZeogCdpZ3XSi1eCPOByV1OpuJxuI3OcmHhosDWYyii07tpPsLw=="], - "@modelcontextprotocol/server": ["@modelcontextprotocol/server@2.3.1", "", { "dependencies": { "@modelcontextprotocol/core": "2.3.1", "zod": "^4.2.0" } }, "sha512-e59MfWuSssj6DoQ96JCTqdW1AXT5/XtnTl0WWd6MU1Ka434fFUGGosCLJbGNySDhHGvxQWoRWK137FXYFkYNWw=="], + "@modelcontextprotocol/server": ["@modelcontextprotocol/server@2.4.0", "", { "dependencies": { "@modelcontextprotocol/core": "2.4.0", "zod": "^4.2.0" } }, "sha512-rgR9yxSaAJ+bcsi/XroT/S2AfPiIWloXAnrdfYSCms9ivVju0ishu/wW0J21Ho6+ZOR1r7RyeRbjiRuF87ix5Q=="], "@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="], @@ -1917,26 +1790,20 @@ "@opencode/app": ["@opencode/app@workspace:packages/app"], - "@opencode/changelog": ["@opencode/changelog@workspace:services/changelog"], - "@opencode/cli": ["@opencode/cli@workspace:packages/cli"], "@opencode/client": ["@opencode/client@workspace:packages/client"], "@opencode/codemode": ["@opencode/codemode@workspace:packages/codemode"], - "@opencode/console-app": ["@opencode/console-app@workspace:packages/console/app"], - - "@opencode/console-resource": ["@opencode/console-resource@workspace:packages/console/resource"], - "@opencode/core": ["@opencode/core@workspace:packages/core"], + "@opencode/data": ["@opencode/data@workspace:services/data"], + "@opencode/desktop": ["@opencode/desktop@workspace:packages/desktop"], "@opencode/files": ["@opencode/files@workspace:services/files"], - "@opencode/function": ["@opencode/function@workspace:packages/function"], - "@opencode/gui-plugins": ["@opencode/gui-plugins@workspace:packages/gui-plugins"], "@opencode/http-recorder": ["@opencode/http-recorder@workspace:packages/http-recorder"], @@ -1945,8 +1812,12 @@ "@opencode/latex": ["@opencode/latex@workspace:packages/latex"], + "@opencode/legacy": ["@opencode/legacy@workspace:services/legacy"], + "@opencode/merman": ["@opencode/merman@workspace:packages/merman"], + "@opencode/nav-menus": ["@opencode/nav-menus@workspace:packages/nav-menus"], + "@opencode/patchmark": ["@opencode/patchmark@workspace:packages/patchmark"], "@opencode/plugin": ["@opencode/plugin@workspace:packages/plugin"], @@ -1955,8 +1826,6 @@ "@opencode/plugin-figma": ["@opencode/plugin-figma@workspace:packages/plugins/figma"], - "@opencode/posts": ["@opencode/posts@workspace:packages/posts"], - "@opencode/protocol": ["@opencode/protocol@workspace:packages/protocol"], "@opencode/pty": ["@opencode/pty@0.4.0", "", { "optionalDependencies": { "@opencode/pty-darwin-arm64": "0.4.0", "@opencode/pty-darwin-x64": "0.4.0", "@opencode/pty-linux-arm64-gnu": "0.4.0", "@opencode/pty-linux-arm64-musl": "0.4.0", "@opencode/pty-linux-x64-gnu": "0.4.0", "@opencode/pty-linux-x64-musl": "0.4.0", "@opencode/pty-win32-arm64": "0.4.0", "@opencode/pty-win32-x64": "0.4.0" }, "bin": { "opencode-pty": "bin/opencode-pty.js" } }, "sha512-v7cLT71yfoNM5FlyPGwMjeqIJbr0DneGq4NpoOY5iAKpsevzOIcsI2E0fiDWajuk5xAFRxwyv4CpGqow7cu79Q=="], @@ -1989,6 +1858,8 @@ "@opencode/simulation": ["@opencode/simulation@workspace:packages/simulation"], + "@opencode/site": ["@opencode/site@workspace:services/site"], + "@opencode/stats-app": ["@opencode/stats-app@workspace:packages/stats/app"], "@opencode/stats-core": ["@opencode/stats-core@workspace:packages/stats/core"], @@ -2007,10 +1878,6 @@ "@opencode/util": ["@opencode/util@workspace:packages/util"], - "@opencode/web": ["@opencode/web@workspace:packages/web"], - - "@opencode/www": ["@opencode/www@workspace:services/www"], - "@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="], "@opentelemetry/api-logs": ["@opentelemetry/api-logs@0.219.0", "", { "dependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-FFx7YnaYJlIjqWW/AG/yAZ0L/NEY724PipXXXQLdtZPbLwBGbUMTGL1i/esI56TWfTUXxhLfpgrnWJCG8aUJyg=="], @@ -2041,34 +1908,32 @@ "@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.43.0", "", {}, "sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg=="], - "@opentui/core": ["@opentui/core@0.8.1", "", { "dependencies": { "bun-ffi-structs": "0.3.1", "diff": "9.0.0", "marked": "17.0.1", "string-width": "7.2.0" }, "optionalDependencies": { "@opentui/core-darwin-arm64": "0.8.1", "@opentui/core-darwin-x64": "0.8.1", "@opentui/core-linux-arm64": "0.8.1", "@opentui/core-linux-arm64-musl": "0.8.1", "@opentui/core-linux-x64": "0.8.1", "@opentui/core-linux-x64-musl": "0.8.1", "@opentui/core-win32-arm64": "0.8.1", "@opentui/core-win32-x64": "0.8.1" }, "peerDependencies": { "web-tree-sitter": "0.25.10" } }, "sha512-WmnpnVZn2MdyYNEahQNn4k3OrIkQKfcwPVrX/DjguLtl/S2g5fPeXCqHZjCg2GLMf1N4HJap0LEkTPJEvfrDXw=="], + "@opentui/core": ["@opentui/core@0.8.4", "", { "dependencies": { "bun-ffi-structs": "0.3.1", "diff": "9.0.0", "marked": "17.0.1", "string-width": "7.2.0" }, "optionalDependencies": { "@opentui/core-darwin-arm64": "0.8.4", "@opentui/core-darwin-x64": "0.8.4", "@opentui/core-linux-arm64": "0.8.4", "@opentui/core-linux-arm64-musl": "0.8.4", "@opentui/core-linux-x64": "0.8.4", "@opentui/core-linux-x64-musl": "0.8.4", "@opentui/core-win32-arm64": "0.8.4", "@opentui/core-win32-x64": "0.8.4" }, "peerDependencies": { "web-tree-sitter": "0.25.10" } }, "sha512-s2z2FFEWxsQ6IPVEiAjlHHY5yssnCI+dIltL54+ZhVz1EWxylaB0HER+ypPL2goot0DKwKqrM57rnomh19/2rQ=="], - "@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.8.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-22jdbN55W9hCraw6k1y3TklzCvF90UJG7d1wvtUYwsn9LOEvOZn+i3fUyqkpP+kBgL31RBt+sB4RKsUmNzjWaw=="], + "@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.8.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-kAWCmLsGuxQANeq4AjjX0Yodca2VIofQGUfIH9Edg9BKajYpf941heZfMJkkkJUXawYTNFTR2lBYsdneUUJBrg=="], - "@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.8.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-rlqzXisgUl3U7WmrWySFLLZq6x9ZQiSRSGLyyULBFWTZLJY4qrs2a7y/8B0NpIFY7Ngku17qVIKcVwQZZBoLbw=="], + "@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.8.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-0S62YHtIh1Q9tTun7065njEtYUUtf1zXwllDKXr63R1cVgq+8eRdVQ2PsAGNOqB5OYYno+M8o2tuK/Es2uvmBA=="], - "@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.8.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-UtJzpwvAy67RU60T1IFNBYHH3tUrmcIHsLrNI+8WFFxoOk6btwRp67NKiZd3qoDcztTz2q/yKf9KQI0yr+P6MQ=="], + "@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.8.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-VGnBN3ItBwZog109wtPIou8pn93TseZwA5OZ05X2PYIYPw+IC6mVeO2Dn0qwwozLBDxeyH3ydbHMFlwzS4/fLg=="], - "@opentui/core-linux-arm64-musl": ["@opentui/core-linux-arm64-musl@0.8.1", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-BzVCOuG5Vw/nB9ffLwZq82uEg0f0BE4wkd5EvrqOET9qK5D5emT4Zo8tZJFY8NG0/xBuWj6S9xVpazQWjZR17A=="], + "@opentui/core-linux-arm64-musl": ["@opentui/core-linux-arm64-musl@0.8.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-IG887NHjPJEw5D1dvNl9jPbcwNFREFKj2fnqEjdrwCnDRywtjNL7k7GgTo24NNlyMAZAq0OkoM0M0Sn6ex/Adg=="], - "@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.8.1", "", { "os": "linux", "cpu": "x64" }, "sha512-du4V6YlGvCWs/ggc6Tj7Oc7qaoYdPpzwAeJMKUbjrg+Zv5zweNHFMN4YLbzIutTi6Ukz4KsW/hwEaQIjXHlUcA=="], + "@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.8.4", "", { "os": "linux", "cpu": "x64" }, "sha512-N/uxyaPpWkCZlDXz3fgHMfMuj1L3IVZ/xZ4JifUc4NW9bwa/CYWFJ5J5jBoy2QsAIqoqo8/OD3iFpXR4o12mNQ=="], - "@opentui/core-linux-x64-musl": ["@opentui/core-linux-x64-musl@0.8.1", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-RB/u2G5X4KpW1/rT5iabCLYbmfMWKF3OASj2Z29+RAj38I7caRU3/TTntpX3CpHzjQrDTVWyMYzcnu+WFF8thg=="], + "@opentui/core-linux-x64-musl": ["@opentui/core-linux-x64-musl@0.8.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-FAiH7wMt/ZbpP2w6TL62deNExTg5w6mujKUBSK89+gJV8FN4jk/K2xz9f522aYhC6SdbpyIKwS0oGIJldYLkcg=="], - "@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.8.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-wF5AZRWDCjkfRHT1cRfyvHkf+RI/Pxjb0oMFVg2h2ayndBu8CSgyQDhtNgZd0ON+xrP4xceikCkHDhDLe5bv1w=="], + "@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.8.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-vjDuuIcmanoipIKdME8A7ZuBgIw2E1fv4pRJp6M19+Zfx0HIUmtA8bv+mT/kaz8Cpad9EUzJkNI5fV8P2p/iKg=="], - "@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.8.1", "", { "os": "win32", "cpu": "x64" }, "sha512-+rIrkvwBJMGWdXn4GGQAmM4y+RH1Xvb9nveNyJ58SOsTOBqyWyi+63qMlxe58WVl+sVAJodEjAILcWdwrzMJ3Q=="], + "@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.8.4", "", { "os": "win32", "cpu": "x64" }, "sha512-I4XnzUmyKCb8cRD1UntQXRkIEl0fxfQnzS3bTODWbENAOdRsK2c7Ff07DG2qTAqNijyTuk63C+uLmAT9ObOQ1Q=="], - "@opentui/keymap": ["@opentui/keymap@0.8.1", "", { "dependencies": { "@opentui/core": "0.8.1" }, "peerDependencies": { "@opentui/react": "0.8.1", "@opentui/solid": "0.8.1", "react": ">=19.2.0", "solid-js": "^1.9.12" }, "optionalPeers": ["@opentui/react", "@opentui/solid", "react", "solid-js"] }, "sha512-3fDU4EkZ3fn+sc/A9thbyqrPx1hWieFlj3EsPmxxBp2sIHdXG5ro6lDMtPYKQDlZKJ/WhbELo4Rik011hz0OwA=="], + "@opentui/keymap": ["@opentui/keymap@0.8.4", "", { "dependencies": { "@opentui/core": "0.8.4" }, "peerDependencies": { "@opentui/react": "0.8.4", "@opentui/solid": "0.8.4", "react": ">=19.2.0", "solid-js": "^1.9.12" }, "optionalPeers": ["@opentui/react", "@opentui/solid", "react", "solid-js"] }, "sha512-dOHQYgvToXsYr4Am44wBEhvSvaF2bqZfJM8xPhEEZlpcnww3/+eh3OEq30btAKcukIMxDH0dI5cyCUfF2/8yUw=="], - "@opentui/solid": ["@opentui/solid@0.8.1", "", { "dependencies": { "@babel/core": "7.29.7", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.8.1", "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-jnGtUnPrySoTSYkM669yGXVzps0GKLuLPkeFnmqxn9cwmelcSEMH3M8FHu4OLpRP9yF48lPg7zRVBSVQTtVxPA=="], + "@opentui/solid": ["@opentui/solid@0.8.4", "", { "dependencies": { "@babel/core": "7.29.7", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.8.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-QyaWIAtZTaAdYJiP4K2cG6hbXQkNUBfa0hjYQwvvr/V2OFIZWZ7l+SP8CYM05lBqVDfOraeThvSrhX+IuvKySA=="], "@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=="], "@opentunnel/protocol": ["@opentunnel/protocol@0.6.1", "", { "peerDependencies": { "effect": "^4.0.0" } }, "sha512-fdckKvQ4TEJSQ2Ia/M/GKmDbCTCw148Wc1zo6HcpUBjSwsFeKs6Tbql4Uih1oIVR8NVqtGrcPZukVVvWFyOEHA=="], - "@oslojs/encoding": ["@oslojs/encoding@1.1.0", "", {}, "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ=="], - "@oxc-parser/binding-android-arm-eabi": ["@oxc-parser/binding-android-arm-eabi@0.141.0", "", { "os": "android", "cpu": "arm" }, "sha512-jk7086MFvR/T4DG9IY7MKBVt1PMxvSZoz/TvnifodvS0pjghVwJHRttnAExhlwdMOgHv1TmLdENnbNpYk2zjvA=="], "@oxc-parser/binding-android-arm64": ["@oxc-parser/binding-android-arm64@0.141.0", "", { "os": "android", "cpu": "arm64" }, "sha512-a4XDQ27ZT7e7zwAlxJDTiCA7IBGWDuy2+MhFq85Of7XlBSmpkfcBFml11q0Zx6f7RMuI0B4xCtt2ytBS4yOptg=="], @@ -2155,8 +2020,6 @@ "@pagefind/darwin-x64": ["@pagefind/darwin-x64@1.5.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw=="], - "@pagefind/default-ui": ["@pagefind/default-ui@1.5.2", "", {}, "sha512-pm1LMnQg8N2B3n2TnjKlhaFihpz6zTiA4HiGQ6/slKO/+8K9CAU5kcjdSSPgpuk1PMuuN4hxLipUIifnrkl3Sg=="], - "@pagefind/freebsd-x64": ["@pagefind/freebsd-x64@1.5.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA=="], "@pagefind/linux-arm64": ["@pagefind/linux-arm64@1.5.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw=="], @@ -2241,6 +2104,8 @@ "@redis/time-series": ["@redis/time-series@6.2.1", "", { "peerDependencies": { "@redis/client": "^6.2.1" } }, "sha512-kiYniph04dJOole+L359B6C9E+jYS2uDP7hca6Onj0xF38ZIpyxARO0Iq0W4ZRn1e8Q6vqW00QFZVSMRA/2Ijw=="], + "@resvg/resvg-wasm": ["@resvg/resvg-wasm@2.6.2", "", {}, "sha512-FqALmHI8D4o6lk/LRWDnhw95z5eO+eAa6ORjVg09YRR7BkcM6oPHU9uyC0gtQG5vpFLvgpeU4+zEAz2H8APHNw=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.5", "", { "os": "android", "cpu": "arm" }, "sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA=="], "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.5", "", { "os": "android", "cpu": "arm64" }, "sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig=="], @@ -2395,6 +2260,8 @@ "@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="], + "@shuding/opentype.js": ["@shuding/opentype.js@1.4.0-beta.0", "", { "dependencies": { "fflate": "^0.7.3", "string.prototype.codepointat": "^0.2.1" }, "bin": { "ot": "bin/ot" } }, "sha512-3NgmNyH3l/Hv6EvsWJbsvpcpUba6R8IREQ83nH83cyakCw7uM1arZKNfHwv1Wz6jgqrF/j4x5ELvR6PnK9nTcA=="], + "@sigstore/bundle": ["@sigstore/bundle@4.0.0", "", { "dependencies": { "@sigstore/protobuf-specs": "^0.5.0" } }, "sha512-NwCl5Y0V6Di0NexvkTqdoVfmjTaQwoLM236r89KEojGmq/jMls8S+zb7yOwAPdXvbwfKDlP+lmXgAL4vKSQT+A=="], "@sigstore/core": ["@sigstore/core@3.2.1", "", {}, "sha512-qRsxPnCrbC/puegGxKuynfnxgLiHqWStrSjxkoB4YKqq3Z3s4cyZyj42ZdWFAEblNP65C+rBH8EuREHIXoi83g=="], @@ -2519,6 +2386,14 @@ "@tanstack/virtual-core": ["@tanstack/virtual-core@3.17.8", "", {}, "sha512-BfEvehNpOT75r5Ksc5xW6NZuXujTfb7nlSEyVu4XHG3gdxNg1KqXruWbDewXOUaUYIo4oRbSfkjIajz4MAT8tA=="], + "@textjs/app": ["@textjs/app@1.6.1", "", { "dependencies": { "@modelcontextprotocol/sdk": "^1.32.2", "@textjs/core": "1.6.1", "@textjs/opencode": "1.6.1", "@textjs/react": "1.6.1", "@vitejs/plugin-react": "^4.5.2", "vite": "^6.3.5", "zod": "^4" }, "peerDependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" }, "bin": { "text": "bin/text.js" } }, "sha512-67ulJUsraW0sq8Vvj1eoXF1bag9NNGnLA26HRQ/f0jDlgcT/IJsQOLVAryLzN/YHIGzGBeYiyhWpZYyaIgNThQ=="], + + "@textjs/core": ["@textjs/core@1.6.1", "", { "dependencies": { "yoga-layout": "3.2.1" } }, "sha512-uCMPzetps3mqNoFCvw3QYn0dB9K02lApQvsvkkH0aB7mCm+02VL4j8wZVrb0srshOyoC+8q0JAMxLLOC2MRsCQ=="], + + "@textjs/opencode": ["@textjs/opencode@1.6.1", "", { "bin": { "textjs-opencode": "bin/textjs-opencode.js" } }, "sha512-Axoj9PUXqsDqJ/Zx/IXkTUWdHB9tMjG1ZmfHfiv+nkNedpArmVm4+gMkV98yHFrpQQfgON+wGBe21JsctmcBcg=="], + + "@textjs/react": ["@textjs/react@1.6.1", "", { "dependencies": { "@textjs/core": "1.6.1", "react-reconciler": "^0.34.0", "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" }, "optionalPeers": ["react-dom"] }, "sha512-iu2GdVulz9oWRr942VCc3uq11WCGxWZpYwtLUWPQuDhgnUU6acWqdA9jRRXXQWxB+W1HBo6aGPnvLFa9f2D/cg=="], + "@trickfilm400/rollup-plugin-off-main-thread": ["@trickfilm400/rollup-plugin-off-main-thread@3.0.0-pre1", "", { "dependencies": { "ejs": "^3.1.10", "json5": "^2.2.3", "magic-string": "^0.30.21", "string.prototype.matchall": "^4.0.12" } }, "sha512-/67zpWDBLV+oYAEL682s1ktXL0HgqX76f6gaVGkGnVZlBbm1zd0v4Bz8MFF2GGhoX9rvfq3KSQHubFHwa6w6/Q=="], "@tsconfig/bun": ["@tsconfig/bun@1.0.9", "", {}, "sha512-4M0/Ivfwcpz325z6CwSifOBZYji3DFOEpY6zEUt0+Xi2qRhzwvmqQN9XAHJh3OVvRJuAqVTLU2abdCplvp6mwQ=="], @@ -2541,6 +2416,8 @@ "@turbo/windows-arm64": ["@turbo/windows-arm64@2.10.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-Gf+S7ICAdimT/n02bOuVWKvhHnct/HYjZg3oBNIz5hZ9ZyWHbQim9J3P5Qip8WpX0ksxF7eaBVziJCuLnjhqDg=="], + "@tweenjs/tween.js": ["@tweenjs/tween.js@23.1.3", "", {}, "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA=="], + "@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], "@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="], @@ -2577,12 +2454,8 @@ "@types/http-cache-semantics": ["@types/http-cache-semantics@4.2.0", "", {}, "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q=="], - "@types/js-yaml": ["@types/js-yaml@4.0.9", "", {}, "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg=="], - "@types/keyv": ["@types/keyv@3.1.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg=="], - "@types/luxon": ["@types/luxon@3.7.1", "", {}, "sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg=="], - "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="], "@types/mdx": ["@types/mdx@2.0.14", "", {}, "sha512-T48PeuJtvLosNTPVhfnIp3i/n3a4g4Bad7YCq5k64D4u7NwDrAotikQ+5+sjtUvBmxCMlbo3dVL+C2dP0rWHzg=="], @@ -2619,16 +2492,20 @@ "@types/responselike": ["@types/responselike@1.0.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw=="], - "@types/sax": ["@types/sax@1.2.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A=="], - "@types/semver": ["@types/semver@7.8.0", "", {}, "sha512-1mAINjtQCXXeLkJ9ehXkwOcBpqtLxiVtKhpUf83DdRNdQKV0iXZpaHYqRr7nj+wvxuJzoAmAwXI+sCNMv1CzLQ=="], "@types/ssri": ["@types/ssri@7.1.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-odD/56S3B51liILSk5aXJlnYt99S6Rt9EFDDqGtJM26rKHApHcwyU/UoYHrzKkdkHMAIquGWCuHtQTbes+FRQw=="], + "@types/stats.js": ["@types/stats.js@0.17.4", "", {}, "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA=="], + + "@types/three": ["@types/three@0.180.0", "", { "dependencies": { "@dimforge/rapier3d-compat": "~0.12.0", "@tweenjs/tween.js": "~23.1.3", "@types/stats.js": "*", "@types/webxr": "*", "@webgpu/types": "*", "fflate": "~0.8.2", "meshoptimizer": "~0.22.0" } }, "sha512-ykFtgCqNnY0IPvDro7h+9ZeLY+qjgUWv+qEvUt84grhenO60Hqd4hScHE7VTB9nOQ/3QM8lkbNE+4vKjEpUxKg=="], + "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="], + "@types/webxr": ["@types/webxr@0.5.24", "", {}, "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg=="], + "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], "@types/which": ["@types/which@3.0.4", "", {}, "sha512-liyfuo/106JdlgSchJzXEQCVArk0CvevqPote8F8HgWgJ3dRCcTHgJIsLDuee0kxk/mhbInzIZk3QWSZJ8R+2w=="], @@ -2683,22 +2560,6 @@ "@ungap/structured-clone": ["@ungap/structured-clone@1.3.3", "", {}, "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg=="], - "@volar/kit": ["@volar/kit@2.4.28", "", { "dependencies": { "@volar/language-service": "2.4.28", "@volar/typescript": "2.4.28", "typesafe-path": "^0.2.2", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "typescript": "*" } }, "sha512-cKX4vK9dtZvDRaAzeoUdaAJEew6IdxHNCRrdp5Kvcl6zZOqb6jTOfk3kXkIkG3T7oTFXguEMt5+9ptyqYR84Pg=="], - - "@volar/language-core": ["@volar/language-core@2.4.28", "", { "dependencies": { "@volar/source-map": "2.4.28" } }, "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ=="], - - "@volar/language-server": ["@volar/language-server@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "@volar/language-service": "2.4.28", "@volar/typescript": "2.4.28", "path-browserify": "^1.0.1", "request-light": "^0.7.0", "vscode-languageserver": "^9.0.1", "vscode-languageserver-protocol": "^3.17.5", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" } }, "sha512-NqcLnE5gERKuS4PUFwlhMxf6vqYo7hXtbMFbViXcbVkbZ905AIVWhnSo0ZNBC2V127H1/2zP7RvVOVnyITFfBw=="], - - "@volar/language-service": ["@volar/language-service@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "vscode-languageserver-protocol": "^3.17.5", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" } }, "sha512-Rh/wYCZJrI5vCwMk9xyw/Z+MsWxlJY1rmMZPsxUoJKfzIRjS/NF1NmnuEcrMbEVGja00aVpCsInJfixQTMdvLw=="], - - "@volar/source-map": ["@volar/source-map@2.4.28", "", {}, "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ=="], - - "@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], - - "@vscode/emmet-helper": ["@vscode/emmet-helper@2.11.0", "", { "dependencies": { "emmet": "^2.4.3", "jsonc-parser": "^2.3.0", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.15.1", "vscode-uri": "^3.0.8" } }, "sha512-QLxjQR3imPZPQltfbWRnHU6JecWTF1QSWhx3GAKQpslx7y3Dp6sIIXhKjiUJ/BR9FX8PVthjr9PD6pNwOJfAzw=="], - - "@vscode/l10n": ["@vscode/l10n@0.0.18", "", {}, "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ=="], - "@webgpu/types": ["@webgpu/types@0.1.54", "", {}, "sha512-81oaalC8LFrXjhsczomEQ0u3jG+TqE6V9QHLA8GNZq/Rnot0KDugu3LhSYSlie8tSdooAN1Hov05asrUUp9qgg=="], "@xmldom/xmldom": ["@xmldom/xmldom@0.8.14", "", {}, "sha512-T4EDRUBVZYRldYApjEJiU0e1stYWaRAX7CuSnKzrpwdZKo53zGV8/pqfzV6FfwNl9YThD2OumQYvqtvjvgG7aQ=="], @@ -2729,45 +2590,27 @@ "abbrev": ["abbrev@4.0.0", "", {}, "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA=="], - "abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="], - "accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="], "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], - "acorn-walk": ["acorn-walk@8.3.2", "", {}, "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A=="], - "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="], - "ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], - "ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="], - "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], - "ajv-i18n": ["ajv-i18n@4.2.0", "", { "peerDependencies": { "ajv": "^8.0.0-beta.0" } }, "sha512-v/ei2UkCEeuKNXh8RToiFsUclmU+G57LO1Oo22OagNMENIw+Yb8eMwvHu7Vn9fmkjJyv6XclhJ8TbuigSglPkg=="], - - "am-i-vibing": ["am-i-vibing@0.5.0", "", { "dependencies": { "process-ancestry": "^0.1.0" }, "bin": { "am-i-vibing": "dist/cli.mjs" } }, "sha512-KLcsDhqf1XRrJmJr+9I/C0EX2K+sGrAGZFgkmd84c8TJO9zJBu+/kFInjazu1KfJWFhWDKdRWkpBzEs7s35DVA=="], - "ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="], "ansi-regex": ["ansi-regex@6.3.0", "", {}, "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ=="], "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "anymatch": ["anymatch@3.1.3", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="], - "app-builder-lib": ["app-builder-lib@26.15.7", "", { "dependencies": { "@electron/asar": "3.4.1", "@electron/fuses": "^1.8.0", "@electron/get": "^3.0.0", "@electron/notarize": "2.5.0", "@electron/osx-sign": "1.3.3", "@electron/rebuild": "^4.0.4", "@electron/universal": "2.0.3", "@malept/flatpak-bundler": "^0.4.0", "@noble/hashes": "^2.2.0", "@peculiar/webcrypto": "^1.7.1", "@types/fs-extra": "9.0.13", "ajv": "^8.18.0", "asn1js": "^3.0.10", "async-exit-hook": "^2.0.1", "builder-util": "26.15.3", "builder-util-runtime": "9.7.0", "chromium-pickle-js": "^0.2.0", "ci-info": "4.3.1", "debug": "^4.3.4", "dotenv": "^16.4.5", "dotenv-expand": "^11.0.6", "ejs": "^3.1.8", "electron-publish": "26.15.3", "fs-extra": "^10.1.0", "hosted-git-info": "^4.1.0", "isbinaryfile": "^5.0.0", "jiti": "^2.4.2", "js-yaml": "^4.1.0", "json5": "^2.2.3", "lazy-val": "^1.0.5", "minimatch": "^10.2.5", "pkijs": "^3.4.0", "plist": "3.1.0", "proper-lockfile": "^4.1.2", "resedit": "^1.7.0", "semver": "~7.7.3", "tar": "^7.5.7", "temp-file": "^3.4.0", "tiny-async-pool": "1.3.0", "unzipper": "^0.12.3", "which": "^5.0.0" }, "peerDependencies": { "dmg-builder": "26.15.7", "electron-builder-squirrel-windows": "26.15.7" } }, "sha512-C7APoYISPExUmrEntNhDpz9Tccb4uWuEDfLaC0WPPc7/pwzz0WZGznCz/ycPfkkzw6tKOalceD8g6TgHmVz1QA=="], - "arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="], - - "argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], - - "aria-query": ["aria-query@5.3.2", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="], + "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "array-buffer-byte-length": ["array-buffer-byte-length@1.0.2", "", { "dependencies": { "call-bound": "^1.0.3", "is-array-buffer": "^3.0.5" } }, "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw=="], @@ -2779,10 +2622,6 @@ "astring": ["astring@1.9.0", "", { "bin": { "astring": "bin/astring" } }, "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg=="], - "astro": ["astro@7.3.8", "", { "dependencies": { "@astrojs/compiler-rs": "^0.5.1", "@astrojs/internal-helpers": "0.12.0", "@astrojs/markdown-satteri": "0.4.3", "@astrojs/telemetry": "3.3.3", "@capsizecss/unpack": "^4.0.1", "@clack/prompts": "^1.8.1", "@oslojs/encoding": "^1.1.0", "am-i-vibing": "^0.5.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "ci-info": "^4.4.0", "clsx": "^2.1.1", "common-ancestor-path": "^2.0.0", "cookie": "^2.0.1", "devalue": "^5.9.4", "diff": "^9.0.0", "dset": "^3.1.4", "es-module-lexer": "^3.0.2", "find-proc": "0.2.0", "flattie": "^1.1.1", "fontace": "~0.4.1", "get-tsconfig": "5.0.0-beta.6", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", "jsonc-parser": "^3.3.1", "magic-string": "^1.4.2", "magicast": "^0.5.5", "mrmime": "^2.0.1", "neotraverse": "^1.0.1", "obug": "^3.0.0", "p-limit": "^7.3.3", "p-queue": "^9.3.3", "package-manager-detector": "^1.8.0", "piccolore": "^0.1.3", "picomatch": "^4.0.7", "rolldown": "^1.2.11", "shiki": "^4.4.3", "smol-toml": "^1.9.0", "svgo": "^4.1.0", "tinyclip": "^1.0.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "ultrahtml": "^1.7.0", "unifont": "~0.7.5", "unstorage": "^1.17.5", "verkit": "^0.5.0", "vite": "^8.3.1", "vitefu": "^1.1.3", "xxhash-wasm": "^1.1.0", "yargs-parser": "^22.0.0", "zod": "^4.6.5" }, "optionalDependencies": { "sharp": "^0.35.4" }, "peerDependencies": { "@astrojs/markdown-remark": "^7.3.0" }, "optionalPeers": ["@astrojs/markdown-remark"], "bin": { "astro": "./bin/astro.mjs" } }, "sha512-LHzDHSaV+YzZiR3EFndDYTLLeNeuMtP1qX1FLcCNUUHOCqTTIWPczy2UV3zpA5VqvJe5cWZolqM9Z8JFqR2i9w=="], - - "astro-expressive-code": ["astro-expressive-code@0.44.2", "", { "dependencies": { "rehype-expressive-code": "^0.44.2", "url-extras": "^0.1.0" }, "peerDependencies": { "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0 || ^6.0.0-beta || ^7.0.0" } }, "sha512-avop7nZcRwC7quvIxVguhwEZ9Tp6IoTzKUCLwP30Fb7+er+pWQgcysP01dcuzRIJo81kLGg30q/YAI2Yb1Sdzg=="], - "async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="], "async-exit-hook": ["async-exit-hook@2.0.1", "", {}, "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw=="], @@ -2803,8 +2642,6 @@ "axe-core": ["axe-core@4.13.0", "", {}, "sha512-UzGt8zg7Ny8djbYMhxl2zuEevVa7r2gJjYY5Lwr1xM7+XU2nd6CkIWFTVcCIbAP63vSz71NaVyyuSk9lHKcy0A=="], - "axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="], - "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=="], @@ -2825,10 +2662,6 @@ "baseline-browser-mapping": ["baseline-browser-mapping@2.11.15", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-FwMjJJ7HnyZpWe+oWxegG0fezZyBZUagI5LZEoO3GCbtbKNwRfMH9Ue5d5v01PNePBy1QSfPSDTTeVL0Hb9EzA=="], - "bcp-47": ["bcp-47@2.1.1", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-KLw+H/gd2p4zly1X7Yh/qziuyae5/w/QFnvTng9eZL5fvszL7Whl3MBoWF8yxL7ksUjBfOD+OxkytiqbBpG+Fw=="], - - "bcp-47-match": ["bcp-47-match@2.0.3", "", {}, "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ=="], - "before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="], "bignumber.js": ["bignumber.js@9.3.1", "", {}, "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ=="], @@ -2889,10 +2722,14 @@ "call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="], + "camelize": ["camelize@1.0.1", "", {}, "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="], + "caniuse-lite": ["caniuse-lite@1.0.30001809", "", {}, "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], + "cf": ["cf@1.0.0-beta.12", "", { "dependencies": { "@cloudflare/build-output-utils": "0.8.5", "@cloudflare/codemods": "0.4.0", "@cloudflare/config": "0.23.0", "@cloudflare/runtime-types": "0.1.7", "blake3-wasm": "2.1.5", "miniflare": "5.20260930.0-alpha", "minisearch": "7.2.0" }, "bin": { "cf": "./bin/cf", "cloudflare": "./bin/cf" } }, "sha512-tyQ+Jpnw+4NDwDtl7ZNteXBm7N0TeJ6gYww79kkabpcYoCEXkUUpmt9BlDUKH8ub17tjAeiuyqa9NQzH0vp2Aw=="], + "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="], @@ -2903,8 +2740,6 @@ "character-reference-invalid": ["character-reference-invalid@2.0.1", "", {}, "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw=="], - "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], - "chownr": ["chownr@3.0.0", "", {}, "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="], "chrome-launcher": ["chrome-launcher@1.2.1", "", { "dependencies": { "@types/node": "*", "escape-string-regexp": "^4.0.0", "is-wsl": "^2.2.0", "lighthouse-logger": "^2.0.1" }, "bin": { "print-chrome-path": "bin/print-chrome-path.cjs" } }, "sha512-qmFR5PLMzHyuNJHwOloHPAHhbaNglkfeV/xDtt5b7xiFFyU1I+AZZX0PYseMuhenJSSirgxELYIbswcoc+5H4A=="], @@ -2923,24 +2758,16 @@ "clone-response": ["clone-response@1.0.3", "", { "dependencies": { "mimic-response": "^1.0.0" } }, "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA=="], - "cloudflare": ["cloudflare@5.2.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-dVzqDpPFYR9ApEC9e+JJshFJZXcw4HzM8W+3DHzO5oy9+8rLC53G7x6fEf9A7/gSuSCxuvndzui5qJKftfIM9A=="], - - "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], - "cluster-key-slot": ["cluster-key-slot@1.1.2", "", {}, "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA=="], "cmd-shim": ["cmd-shim@8.0.0", "", {}, "sha512-Jk/BK6NCapZ58BKUxlSI+ouKRbjH1NLZCgJkYoab+vEHUY3f6OzpNBN9u7HFSv9J6TRDGs4PLOHezoKGaFRSCA=="], "collapse-white-space": ["collapse-white-space@2.1.0", "", {}, "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw=="], - "color": ["color@4.2.3", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="], - "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "color-string": ["color-string@1.9.1", "", { "dependencies": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" } }, "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg=="], - "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="], "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="], @@ -2969,7 +2796,7 @@ "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - "cookie": ["cookie@2.0.1", "", {}, "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w=="], + "cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="], "cookie-es": ["cookie-es@3.1.1", "", {}, "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg=="], @@ -2993,17 +2820,21 @@ "csp_evaluator": ["csp_evaluator@1.1.8", "", {}, "sha512-EwOnfYuNbTytvbMKsLixTrRgnjOa0WZCxGy8A9nnSYAicrdwn+T/epU/yjgymmOxlgKnvH+8wXt+7p/8ak5Feg=="], - "css-select": ["css-select@6.0.0", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^7.0.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "nth-check": "^2.1.1" } }, "sha512-rZZVSLle8v0+EY8QAkDWrKhpgt6SA5OtHsgBnsj6ZaLb5dmDVOWUDtQitd9ydxxvEjhewNudS6eTVU7uOyzvXw=="], + "css-background-parser": ["css-background-parser@0.1.0", "", {}, "sha512-2EZLisiZQ+7m4wwur/qiYJRniHX4K5Tc9w93MT3AS0WS1u5kaZ4FKXlOTBhOjc+CgEgPiGY+fX1yWD8UwpEqUA=="], - "css-selector-parser": ["css-selector-parser@3.3.0", "", {}, "sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g=="], + "css-box-shadow": ["css-box-shadow@1.0.0-3", "", {}, "sha512-9jaqR6e7Ohds+aWwmhe6wILJ99xYQbfmK9QQB9CcMjDbTxPZjwEmUQpU91OG05Xgm8BahT5fW+svbsQGjS/zPg=="], - "css-tree": ["css-tree@3.2.1", "", { "dependencies": { "mdn-data": "2.27.1", "source-map-js": "^1.2.1" } }, "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA=="], + "css-color-keywords": ["css-color-keywords@1.0.0", "", {}, "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg=="], - "css-what": ["css-what@7.0.0", "", {}, "sha512-wD5oz5xibMOPHzy13CyGmogB3phdvcDaB5t0W/Nr5Z2O/agcB8YwOz6e2Lsp10pNDzBoDO9nVa3RGs/2BttpHQ=="], + "css-gradient-parser": ["css-gradient-parser@0.0.17", "", {}, "sha512-w2Xy9UMMwlKtou0vlRnXvWglPAceXCTtcmVSo8ZBUvqCV5aXEFP/PC6d+I464810I9FT++UACwTD5511bmGPUg=="], - "cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], + "css-select": ["css-select@5.2.2", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", "domhandler": "^5.0.2", "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw=="], + + "css-to-react-native": ["css-to-react-native@3.2.0", "", { "dependencies": { "camelize": "^1.0.0", "css-color-keywords": "^1.0.0", "postcss-value-parser": "^4.0.2" } }, "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ=="], - "csso": ["csso@5.0.5", "", { "dependencies": { "css-tree": "~2.2.0" } }, "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ=="], + "css-what": ["css-what@6.2.2", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="], + + "cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], @@ -3061,14 +2892,10 @@ "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], - "destr": ["destr@2.0.5", "", {}, "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA=="], - "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], "detect-node": ["detect-node@2.1.0", "", {}, "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g=="], - "devalue": ["devalue@5.9.4", "", {}, "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg=="], - "devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="], "devtools-protocol": ["devtools-protocol@0.0.1687809", "", {}, "sha512-t7kSb+UKYdyxcmqy98U2P86ne6rCve3DIJ4+lp54i/hhClgFuG35JrLj23rO14Jw3sWDsp7i+22QhNU0+/qk8g=="], @@ -3079,8 +2906,6 @@ "dir-compare": ["dir-compare@4.2.0", "", { "dependencies": { "minimatch": "^3.0.5", "p-limit": "^3.1.0 " } }, "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ=="], - "direction": ["direction@2.0.1", "", { "bin": { "direction": "cli.js" } }, "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA=="], - "dmg-builder": ["dmg-builder@26.15.7", "", { "dependencies": { "app-builder-lib": "26.15.7", "builder-util": "26.15.3", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0" } }, "sha512-rfo1YyAWO0L3cZLKCqKQiLYbW6ZXebRUfK0kWp4oXxO7dDFLrf7alRkWImNuXvZVQhs6Idzy++cwOk8I+xPDhw=="], "dom-serializer": ["dom-serializer@2.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="], @@ -3103,8 +2928,6 @@ "drizzle-orm": ["drizzle-orm@1.0.0-rc.5-169397b", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@drizzle-team/minipg": ">=0.3.2", "@effect/sql-d1": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-libsql": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-mysql2": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-pg": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-pglite": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-sqlite-bun": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-sqlite-do": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-sqlite-node": ">=4.0.0-beta.105 || >=4.0.0", "@effect/sql-sqlite-wasm": ">=4.0.0-beta.105 || >=4.0.0", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=17", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", "@sinclair/typebox": ">=0.34.8", "@sqlitecloud/drivers": ">=1.0.653", "@tidbcloud/serverless": "*", "@tursodatabase/database": ">=0.7.1", "@tursodatabase/database-common": ">=0.7.1", "@tursodatabase/database-wasm": ">=0.7.1", "@tursodatabase/serverless": ">=1.4.0", "@tursodatabase/sync": ">=0.7.1", "@types/better-sqlite3": "*", "@types/mssql": "^9.1.4", "@types/pg": "*", "@types/sql.js": "*", "@upstash/redis": ">=1.34.7", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "arktype": ">=2.0.0", "better-sqlite3": ">=9.3.0", "bun-types": "*", "effect": ">=4.0.0-beta.105 || >=4.0.0", "expo-sqlite": ">=14.0.0", "mssql": "^11.0.1", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5", "typebox": ">=1.2.0", "valibot": ">=1.0.0-beta.7", "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@drizzle-team/minipg", "@effect/sql-d1", "@effect/sql-libsql", "@effect/sql-mysql2", "@effect/sql-pg", "@effect/sql-pglite", "@effect/sql-sqlite-bun", "@effect/sql-sqlite-do", "@effect/sql-sqlite-node", "@effect/sql-sqlite-wasm", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@sinclair/typebox", "@sqlitecloud/drivers", "@tidbcloud/serverless", "@tursodatabase/database", "@tursodatabase/database-common", "@tursodatabase/database-wasm", "@tursodatabase/serverless", "@tursodatabase/sync", "@types/better-sqlite3", "@types/mssql", "@types/pg", "@types/sql.js", "@upstash/redis", "@vercel/postgres", "@xata.io/client", "arktype", "better-sqlite3", "bun-types", "effect", "expo-sqlite", "mssql", "mysql2", "pg", "postgres", "sql.js", "sqlite3", "typebox", "valibot", "zod"] }, "sha512-xf5TudQhFplMMzjwgmMY5f64Sqbv4iwXxdTHBHqvLMt+SHyY8rAYhzNLQchEkDxiqMclTS/txPEOg5pdQy0Tcw=="], - "dset": ["dset@3.1.4", "", {}, "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA=="], - "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], "duplexer2": ["duplexer2@0.1.4", "", { "dependencies": { "readable-stream": "^2.0.2" } }, "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA=="], @@ -3143,10 +2966,10 @@ "electron-winstaller": ["electron-winstaller@5.4.0", "", { "dependencies": { "@electron/asar": "^3.2.1", "debug": "^4.1.1", "fs-extra": "^7.0.1", "lodash": "^4.17.21", "temp": "^0.9.0" }, "optionalDependencies": { "@electron/windows-sign": "^1.1.2" } }, "sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg=="], - "emmet": ["emmet@2.4.11", "", { "dependencies": { "@emmetio/abbreviation": "^2.3.3", "@emmetio/css-abbreviation": "^2.1.8" } }, "sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ=="], - "emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + "emoji-regex-xs": ["emoji-regex-xs@2.0.1", "", {}, "sha512-1QFuh8l7LqUcKe24LsPUNzjrzJQ7pgRwp1QMcZ5MX6mFplk2zQ08NVCM84++1cveaUUYtcCYHmeFEuNg16sU4g=="], + "encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="], "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="], @@ -3201,8 +3024,6 @@ "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], - "esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="], - "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], "estree-util-attach-comments": ["estree-util-attach-comments@3.0.0", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw=="], @@ -3225,24 +3046,16 @@ "etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="], - "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="], - - "eventemitter3": ["eventemitter3@5.0.4", "", {}, "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw=="], - "eventsource": ["eventsource@3.0.7", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA=="], "eventsource-parser": ["eventsource-parser@3.1.1", "", {}, "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ=="], - "exit-hook": ["exit-hook@2.2.1", "", {}, "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw=="], - "exponential-backoff": ["exponential-backoff@3.1.3", "", {}, "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA=="], "express": ["express@5.3.0", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.3.0", "content-disposition": "^2.0.1", "content-type": "^2.0.0", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "depd": "^2.0.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.8", "qs": "^6.16.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.1.0", "vary": "^1.1.2" } }, "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g=="], "express-rate-limit": ["express-rate-limit@8.7.1", "", { "dependencies": { "debug": "^4.4.3", "ip-address": "^10.2.0" }, "peerDependencies": { "express": ">= 4.11" } }, "sha512-2FXbqkygil3mZiXzEtM0IjE/UBmBNot0J1GEVrJT4JbrvwOSoEtqtO+wHbiMQELWe1eNvHoYRg2dkjOid+6JkA=="], - "expressive-code": ["expressive-code@0.44.2", "", { "dependencies": { "@expressive-code/core": "^0.44.2", "@expressive-code/plugin-frames": "^0.44.2", "@expressive-code/plugin-shiki": "^0.44.2", "@expressive-code/plugin-text-markers": "^0.44.2" } }, "sha512-MLNghkvhyFgVW4oCD5DxBuYnnTXIf0PygzGmfT6OZeOOYWh/D4sH1j931biElkA5RG/J9wY/iuSMGAPF5vzHOg=="], - "exsolve": ["exsolve@1.1.3", "", {}, "sha512-kuzL9zherLQoqDeQaS55AiiIg1kb4KYXaSusTtgZTPlvKP2gGCI82LNmBNh5RjDVUXIcmgx+/Mx7vPwRzBbhJA=="], "ext-list": ["ext-list@2.2.2", "", { "dependencies": { "mime-db": "^1.28.0" } }, "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA=="], @@ -3263,14 +3076,8 @@ "fast-sha256": ["fast-sha256@1.3.0", "", {}, "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ=="], - "fast-string-truncated-width": ["fast-string-truncated-width@3.0.3", "", {}, "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g=="], - - "fast-string-width": ["fast-string-width@3.0.2", "", { "dependencies": { "fast-string-truncated-width": "^3.0.2" } }, "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg=="], - "fast-uri": ["fast-uri@3.1.5", "", {}, "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw=="], - "fast-wrap-ansi": ["fast-wrap-ansi@0.2.2", "", { "dependencies": { "fast-string-width": "^3.0.2" } }, "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q=="], - "fastq": ["fastq@1.20.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], @@ -3279,6 +3086,8 @@ "ffi-rs": ["ffi-rs@1.3.7", "", { "optionalDependencies": { "@yuuang/ffi-rs-android-arm64": "1.3.7", "@yuuang/ffi-rs-darwin-arm64": "1.3.7", "@yuuang/ffi-rs-darwin-x64": "1.3.7", "@yuuang/ffi-rs-linux-arm-gnueabihf": "1.3.7", "@yuuang/ffi-rs-linux-arm64-gnu": "1.3.7", "@yuuang/ffi-rs-linux-arm64-musl": "1.3.7", "@yuuang/ffi-rs-linux-x64-gnu": "1.3.7", "@yuuang/ffi-rs-linux-x64-musl": "1.3.7", "@yuuang/ffi-rs-win32-arm64-msvc": "1.3.7", "@yuuang/ffi-rs-win32-ia32-msvc": "1.3.7", "@yuuang/ffi-rs-win32-x64-msvc": "1.3.7" } }, "sha512-5MMZQS2t/6f/ec3sx0f51gBcKGZPGfolPAW04lvLOSYnr7gmOKs8YzH1Rh+34WGO+VtcgcTuxaUUoJLcR4Tirg=="], + "fflate": ["fflate@0.8.3", "", {}, "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA=="], + "filelist": ["filelist@1.0.6", "", { "dependencies": { "minimatch": "^5.0.1" } }, "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA=="], "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], @@ -3287,26 +3096,14 @@ "find-babel-config": ["find-babel-config@2.1.2", "", { "dependencies": { "json5": "^2.2.3" } }, "sha512-ZfZp1rQyp4gyuxqt1ZqjFGVeVBvmpURMqdIWXbPRfB97Bf6BzdK/xSIbylEINzQ0kB5tlDQfn9HkNXXWsqTqLg=="], - "find-proc": ["find-proc@0.2.0", "", {}, "sha512-a6h2nTrgB3g5Wrn4au9Ux4kMk7IJtyF6oA8uGn+mk3weLZssUtc1cp6meHIzzuW2o1srrBAxzkmXLbqjRkgB6w=="], - "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], - "flattie": ["flattie@1.1.1", "", {}, "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ=="], - - "fontace": ["fontace@0.4.1", "", { "dependencies": { "fontkitten": "^1.0.2" } }, "sha512-lDMvbAzSnHmbYMTEld5qdtvNH2/pWpICOqpean9IgC7vUbUJc3k+k5Dokp85CegamqQpFbXf0rAVkbzpyTA8aw=="], - - "fontkitten": ["fontkitten@1.0.3", "", { "dependencies": { "tiny-inflate": "^1.0.3" } }, "sha512-Wp1zXWPVUPBmfoa3Cqc9ctaKuzKAV6uLstRqlR56kSjplf5uAce+qeyYym7F+PHbGTk+tCEdkCW6RD7DX/gBZw=="], - "for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], "foreground-child": ["foreground-child@3.3.1", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="], "form-data": ["form-data@4.0.6", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.4", "mime-types": "^2.1.35" } }, "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ=="], - "form-data-encoder": ["form-data-encoder@1.7.2", "", {}, "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="], - - "formdata-node": ["formdata-node@4.4.1", "", { "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.3" } }, "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ=="], - "formdata-polyfill": ["formdata-polyfill@4.0.10", "", { "dependencies": { "fetch-blob": "^3.1.2" } }, "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g=="], "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="], @@ -3363,8 +3160,6 @@ "glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], - "glob-to-regexp": ["glob-to-regexp@0.4.1", "", {}, "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw=="], - "global-agent": ["global-agent@3.0.0", "", { "dependencies": { "boolean": "^3.0.1", "es6-error": "^4.1.1", "matcher": "^3.0.0", "roarr": "^2.15.3", "semver": "^7.3.2", "serialize-error": "^7.0.1" } }, "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q=="], "globalthis": ["globalthis@1.0.4", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="], @@ -3393,6 +3188,8 @@ "happy-dom": ["happy-dom@20.11.1", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-XSt8tMzbW9ymE7687xztkO1ckR7qJNQ3LywY9vlYGhGi3zXrGBHuUo2Cl1ztZaICW+1eAGdkLbj6iwVqDT33kg=="], + "harfbuzzjs": ["harfbuzzjs@0.10.0", "", {}, "sha512-SN8LVwCOzvTq3OPNd0+EAghgXugItz56wst567D1vs7LnnKGWprhi3EG58aVOBwhN8HEbQxL4I9NDWkcXUutRw=="], + "has-bigints": ["has-bigints@1.1.0", "", {}, "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg=="], "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], @@ -3407,50 +3204,22 @@ "hasown": ["hasown@2.0.4", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="], - "hast-util-embedded": ["hast-util-embedded@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0" } }, "sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA=="], - - "hast-util-format": ["hast-util-format@1.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-minify-whitespace": "^1.0.0", "hast-util-phrasing": "^3.0.0", "hast-util-whitespace": "^3.0.0", "html-whitespace-sensitive-tag-names": "^3.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-yY1UDz6bC9rDvCWHpx12aIBGRG7krurX0p0Fm6pT547LwDIZZiNr8a+IHDogorAdreULSEzP82Nlv5SZkHZcjA=="], - - "hast-util-from-html": ["hast-util-from-html@2.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.1.0", "hast-util-from-parse5": "^8.0.0", "parse5": "^7.0.0", "vfile": "^6.0.0", "vfile-message": "^4.0.0" } }, "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw=="], - - "hast-util-from-parse5": ["hast-util-from-parse5@8.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="], - - "hast-util-has-property": ["hast-util-has-property@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA=="], - - "hast-util-heading-rank": ["hast-util-heading-rank@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA=="], - - "hast-util-is-body-ok-link": ["hast-util-is-body-ok-link@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ=="], - "hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], - "hast-util-minify-whitespace": ["hast-util-minify-whitespace@1.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-is-element": "^3.0.0", "hast-util-whitespace": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw=="], - - "hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], - - "hast-util-phrasing": ["hast-util-phrasing@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-has-property": "^3.0.0", "hast-util-is-body-ok-link": "^3.0.0", "hast-util-is-element": "^3.0.0" } }, "sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ=="], - - "hast-util-raw": ["hast-util-raw@9.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-from-parse5": "^8.0.0", "hast-util-to-parse5": "^8.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "parse5": "^7.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw=="], - - "hast-util-select": ["hast-util-select@6.0.4", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "bcp-47-match": "^2.0.0", "comma-separated-tokens": "^2.0.0", "css-selector-parser": "^3.0.0", "devlop": "^1.0.0", "direction": "^2.0.0", "hast-util-has-property": "^3.0.0", "hast-util-to-string": "^3.0.0", "hast-util-whitespace": "^3.0.0", "nth-check": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw=="], - "hast-util-to-estree": ["hast-util-to-estree@3.1.3", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-attach-comments": "^3.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w=="], "hast-util-to-html": ["hast-util-to-html@9.0.5", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="], "hast-util-to-jsx-runtime": ["hast-util-to-jsx-runtime@2.3.6", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "vfile-message": "^4.0.0" } }, "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg=="], - "hast-util-to-parse5": ["hast-util-to-parse5@8.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA=="], - - "hast-util-to-string": ["hast-util-to-string@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A=="], - "hast-util-to-text": ["hast-util-to-text@4.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-find-after": "^5.0.0" } }, "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A=="], "hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="], - "hastscript": ["hastscript@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="], - "he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="], + "hex-rgb": ["hex-rgb@4.3.0", "", {}, "sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw=="], + "hono": ["hono@4.13.13", "", {}, "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA=="], "hookable": ["hookable@6.1.2", "", {}, "sha512-+abwxtiEA52GCVIsQqut3S/uKTbUwYIp4Pe/vv+6py5XiXBCqMZHg6pA6Y5qhgLSEys0/cYuPbO0z1QFj5ZCmg=="], @@ -3459,14 +3228,10 @@ "html-entities": ["html-entities@2.3.3", "", {}, "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="], - "html-escaper": ["html-escaper@3.0.3", "", {}, "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="], - "html-to-image": ["html-to-image@1.11.13", "", {}, "sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg=="], "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="], - "html-whitespace-sensitive-tag-names": ["html-whitespace-sensitive-tag-names@3.0.1", "", {}, "sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA=="], - "htmlparser2": ["htmlparser2@8.0.2", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.0.1", "entities": "^4.4.0" } }, "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA=="], "http-cache-semantics": ["http-cache-semantics@4.3.0", "", {}, "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA=="], @@ -3483,14 +3248,10 @@ "httpxy": ["httpxy@0.5.5", "", {}, "sha512-uDjmnPyp1q4Sgzf3w+J/Fc6UqcCEj0x4Wjp7OqK5dGhNeDgpyrAmnS6ey8QWrX3SWDon2DMKf9sBa5X9+CVyMA=="], - "humanize-ms": ["humanize-ms@1.2.1", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="], - "husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="], "i18n-iso-countries": ["i18n-iso-countries@7.14.0", "", { "dependencies": { "diacritics": "1.3.0" } }, "sha512-nXHJZYtNrfsi1UQbyRqm3Gou431elgLjKl//CYlnBGt5aTWdRPH1PiS2T/p/n8Q8LnqYqzQJik3Q7mkwvLokeg=="], - "i18next": ["i18next@26.5.3", "", { "peerDependencies": { "typescript": "^5 || ^6 || ^7" }, "optionalPeers": ["typescript"] }, "sha512-6pRwOwJ6lBCBB66fqNZaSoUmvsALHMord7FL6GsDhubT1CrPabTMEJIqddm0nn2YEbKofdI/3VAtGrQPuztY1Q=="], - "iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="], "idb": ["idb@7.1.1", "", {}, "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ=="], @@ -3521,16 +3282,12 @@ "ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="], - "iron-webcrypto": ["iron-webcrypto@1.2.1", "", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="], - "is-alphabetical": ["is-alphabetical@2.0.1", "", {}, "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ=="], "is-alphanumerical": ["is-alphanumerical@2.0.1", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw=="], "is-array-buffer": ["is-array-buffer@3.0.5", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "get-intrinsic": "^1.2.6" } }, "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A=="], - "is-arrayish": ["is-arrayish@0.3.4", "", {}, "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA=="], - "is-async-function": ["is-async-function@2.1.1", "", { "dependencies": { "async-function": "^1.0.0", "call-bound": "^1.0.3", "get-proto": "^1.0.1", "has-tostringtag": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ=="], "is-bigint": ["is-bigint@1.1.0", "", { "dependencies": { "has-bigints": "^1.0.2" } }, "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ=="], @@ -3547,7 +3304,7 @@ "is-decimal": ["is-decimal@2.0.1", "", {}, "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A=="], - "is-docker": ["is-docker@4.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA=="], + "is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="], "is-document.all": ["is-document.all@1.0.0", "", { "dependencies": { "call-bound": "^1.0.4" } }, "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g=="], @@ -3629,8 +3386,6 @@ "jpeg-js": ["jpeg-js@0.4.4", "", {}, "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg=="], - "js-base64": ["js-base64@3.7.7", "", {}, "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="], - "js-library-detector": ["js-library-detector@6.7.0", "", {}, "sha512-c80Qupofp43y4cJ7+8TTDN/AsDwLi5oOm/plBrWI+iQt485vKXCco+yVmOwEgdo9VOdsYTuV0UlTeetVPTriXA=="], "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], @@ -3689,14 +3444,8 @@ "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], - "klona": ["klona@2.0.6", "", {}, "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA=="], - "knobs": ["@kitlangton/knobs@0.4.0-next.22", "", { "dependencies": { "@kitlangton/rolling-number": "^0.4.1" }, "peerDependencies": { "@pierre/diffs": "^1.5.2", "react": ">=18", "solid-js": ">=1.8" }, "optionalPeers": ["@pierre/diffs", "react", "solid-js"] }, "sha512-YuEogbCIT1vMamHVa9VNt2xcwEdgvjcSMzOc6be6f4c69IRrofHX/2aQG74SCR/y+QBtvY3dZWAnKfcVPdj3rg=="], - "lang-map": ["lang-map@0.4.0", "", { "dependencies": { "language-map": "^1.1.0" } }, "sha512-oiSqZIEUnWdFeDNsp4HId4tAxdFbx5iMBOwA3666Fn2L8Khj8NiD9xRvMsGmKXopPVkaDFtSv3CJOmXFUB0Hcg=="], - - "language-map": ["language-map@1.5.0", "", {}, "sha512-n7gFZpe+DwEAX9cXVTw43i3wiudWDDtSn28RmdnS/HCPr284dQI/SztsamWanRr75oSlKSaGbV2nmWCTzGCoVg=="], - "lazy-val": ["lazy-val@1.0.5", "", {}, "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q=="], "legacy-javascript": ["legacy-javascript@0.0.1", "", {}, "sha512-lPyntS4/aS7jpuvOlitZDFifBCb4W8L/3QU0PLbUTUj+zYah8rfVjYic88yG7ZKTxhS5h9iz7duT8oUXKszLhg=="], @@ -3733,6 +3482,8 @@ "lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.33.0", "", { "os": "win32", "cpu": "x64" }, "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA=="], + "linebreak": ["linebreak@1.1.0", "", { "dependencies": { "base64-js": "0.0.8", "unicode-trie": "^2.0.0" } }, "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ=="], + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], "lodash": ["lodash@4.18.1", "", {}, "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="], @@ -3755,12 +3506,8 @@ "lru_map": ["lru_map@0.4.1", "", {}, "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg=="], - "luxon": ["luxon@3.6.1", "", {}, "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ=="], - "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - "magicast": ["magicast@0.5.5", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "source-map-js": "^1.2.1" } }, "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA=="], - "make-fetch-happen": ["make-fetch-happen@15.0.6", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/agent": "^4.0.0", "@npmcli/redact": "^4.0.0", "cacache": "^20.0.1", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", "minipass-fetch": "^5.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", "proc-log": "^6.0.0", "ssri": "^13.0.0" } }, "sha512-Je0fLJ0F5atA7F+eIlLzk+Wkcl57JDf4kf+EW8xiP5E31xOQxkIxTbgf1Oi1Lw9tRI9UEMRdI5Vz2xTzoNU1Jw=="], "markdown-extensions": ["markdown-extensions@2.0.0", "", {}, "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q=="], @@ -3769,16 +3516,12 @@ "marked": ["marked@18.0.11", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw=="], - "marked-shiki": ["marked-shiki@1.2.1", "", { "peerDependencies": { "marked": ">=7.0.0", "shiki": ">=1.0.0" } }, "sha512-yHxYQhPY5oYaIRnROn98foKhuClark7M373/VpLxiy5TrDu9Jd/LsMwo8w+U91Up4oDb9IXFrP0N1MFRz8W/DQ=="], - "marky": ["marky@1.3.0", "", {}, "sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ=="], "matcher": ["matcher@3.0.0", "", { "dependencies": { "escape-string-regexp": "^4.0.0" } }, "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng=="], "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], - "mdast-util-definitions": ["mdast-util-definitions@6.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ=="], - "mdast-util-directive": ["mdast-util-directive@3.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-I3fNFt+DHmpWCYAT7quoM6lHf9wuqtI+oCOfvILnoicNIqjh5E3dEJWiXuYME2gNe8vl1iMQwyUHa7bgFmak6Q=="], "mdast-util-find-and-replace": ["mdast-util-find-and-replace@3.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg=="], @@ -3813,8 +3556,6 @@ "mdast-util-to-string": ["mdast-util-to-string@4.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0" } }, "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg=="], - "mdn-data": ["mdn-data@2.27.1", "", {}, "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ=="], - "mdurl": ["mdurl@1.0.1", "", {}, "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="], "media-typer": ["media-typer@1.1.1", "", {}, "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ=="], @@ -3825,6 +3566,8 @@ "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], + "meshoptimizer": ["meshoptimizer@0.22.0", "", {}, "sha512-IebiK79sqIy+E4EgOr+CAw+Ke8hAspXKzBd0JdgEmPHiAwmvEj2S4h1rfvo+o/BnfEYd/jAOg5IeeIjzlzSnDg=="], + "micromark": ["micromark@4.0.2", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA=="], "micromark-core-commonmark": ["micromark-core-commonmark@2.0.3", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-destination": "^2.0.0", "micromark-factory-label": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-title": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-html-tag-name": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg=="], @@ -3899,7 +3642,7 @@ "micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="], - "mime": ["mime@3.0.0", "", { "bin": { "mime": "cli.js" } }, "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A=="], + "mime": ["mime@2.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg=="], "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], @@ -3907,7 +3650,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=="], @@ -3925,6 +3668,8 @@ "minipass-sized": ["minipass-sized@2.0.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA=="], + "minisearch": ["minisearch@7.2.0", "", {}, "sha512-dqT2XBYUOZOiC5t2HRnwADjhNS2cecp9u+TJRiJ1Qp/f5qjkeT5APcGPjHw+bz89Ms8Jp+cG4AlE+QZ/QnDglg=="], + "minizlib": ["minizlib@3.1.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw=="], "mitt": ["mitt@3.0.1", "", {}, "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="], @@ -3939,20 +3684,14 @@ "motion-utils": ["motion-utils@14.0.0", "", {}, "sha512-jBsyjVxTTRZNeuvd/v+btVXr90LQkYl4HhRu9T2ARc+PMnvkmjsjRVeAg4Qm10b6TlTw+kykWI8gu/6LuvpLSQ=="], - "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], - "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], - "muggle-string": ["muggle-string@0.4.1", "", {}, "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ=="], - "nanoevents": ["nanoevents@7.0.1", "", {}, "sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q=="], "nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="], "negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="], - "neotraverse": ["neotraverse@1.0.1", "", {}, "sha512-WmmLty1YWwJl9yZi77v2dVIV6X2kuYV8YYBI/G3LWGKdGHmHUvL1z7FW0iDvEvGAwNEoc5x1tOOOyDnf5jJw/w=="], - "nf3": ["nf3@0.3.24", "", {}, "sha512-HxLK4bo+5jNsEETZp4w3tJblHOA9MCBY14IN9nZJJV8JDxt9yNIYxuBuLMjTAR5GFa3HL61+8VQDUrXv3/C8fw=="], "nitro": ["nitro@3.0.260903-beta", "", { "dependencies": { "consola": "^3.4.2", "crossws": "^0.4.12", "db0": "^0.4.1", "env-runner": "^0.2.1", "h3": "^2.0.1-rc.31", "hookable": "^6.1.1", "nf3": "^0.3.24", "ocache": "^0.3.0", "rolldown": "^1.2.7", "rou3": "^0.9.2", "srvx": "^1.0.3", "unenv": "^2.0.0-rc.24", "unstorage": "^2.0.0-alpha.10" }, "bin": { "nitro": "dist/cli/index.mjs" } }, "sha512-54gANPi62O8rfMvepiJUVuIzEIinYfpeHbebywlLxvVTgIYXDwSvpaU9Id+0sJOBjBx0wC1/CVYXJkH7SY+l0g=="], @@ -3967,9 +3706,7 @@ "node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="], - "node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], - - "node-fetch-native": ["node-fetch-native@1.6.7", "", {}, "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q=="], + "node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], "node-gyp": ["node-gyp@12.4.0", "", { "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", "graceful-fs": "^4.2.6", "nopt": "^9.0.0", "proc-log": "^6.0.0", "semver": "^7.3.5", "tar": "^7.5.4", "tinyglobby": "^0.2.12", "undici": "^6.25.0", "which": "^6.0.0" }, "bin": { "node-gyp": "bin/node-gyp.js" } }, "sha512-OMcPNvqTCFUnNaBlmdgq+lfNqY7gTiSmNRDjY3uAXRyudeKZEZxu3CLtjMQrx4zZxCX2b/mpNqTtwuCJgXhHkw=="], @@ -3977,14 +3714,10 @@ "node-int64": ["node-int64@0.4.0", "", {}, "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw=="], - "node-mock-http": ["node-mock-http@1.0.5", "", {}, "sha512-KQyt/wLjG3TAc7DOUhpqWzgd4ERxR80JOlTK5VE5R1S12IaPVN5qkj4klBce9HPG1Njuup4Sb5bljaT34lIyjw=="], - "node-releases": ["node-releases@2.0.53", "", {}, "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ=="], "nopt": ["nopt@9.0.0", "", { "dependencies": { "abbrev": "^4.0.0" }, "bin": { "nopt": "bin/nopt.js" } }, "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw=="], - "normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="], - "normalize-url": ["normalize-url@6.1.0", "", {}, "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A=="], "npm-bundled": ["npm-bundled@5.0.0", "", { "dependencies": { "npm-normalize-package-bin": "^5.0.0" } }, "sha512-JLSpbzh6UUXIEoqPsYBvVNVmyrjVZ1fzEFbqxKkTJQkWBO3xFzFT+KDnSKQWwOQNbuWRwt5LSD6HOTLGIWzfrw=="], @@ -4003,28 +3736,16 @@ "nth-check": ["nth-check@2.1.1", "", { "dependencies": { "boolbase": "^1.0.0" } }, "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w=="], - "number-flow": ["number-flow@0.6.2", "", { "dependencies": { "esm-env": "^1.1.4" } }, "sha512-MCnImG4Q5vPwhSXnov56nOuyyKn6LC+Qd7II1UiKc+ACRtug5iAtn0+CwXNxM38AC5lSowEY+oYEtZX2qMnUyw=="], - "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], - "object-hash": ["object-hash@2.2.0", "", {}, "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="], - "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="], "object-keys": ["object-keys@1.1.1", "", {}, "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="], "object.assign": ["object.assign@4.1.7", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0", "has-symbols": "^1.1.0", "object-keys": "^1.1.1" } }, "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw=="], - "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], - "ocache": ["ocache@0.3.1", "", {}, "sha512-qeBrhQ0ly6tgXsakgNwLx6diRUppJZIcV5OjVGa5yp9HzztutkaGDDXJqVMo1fKWz5fNDtTp3iPU2fuhHf0+Lg=="], - "ofetch": ["ofetch@1.5.1", "", { "dependencies": { "destr": "^2.0.5", "node-fetch-native": "^1.6.7", "ufo": "^1.6.1" } }, "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA=="], - - "ohash": ["ohash@2.0.12", "", {}, "sha512-65S/5gk9YSsaRjcyf7Nfa6h/d3E8/1gslpXfI4W7Dxn/oap8IKRuNT5VXkLQ1YFKIEg4apRY4Pj6aiwFzrDdmw=="], - - "oidc-token-hash": ["oidc-token-hash@5.2.0", "", {}, "sha512-6gj2m8cJZ+iSW8bm0FXdGF0YhIQbKrfP4yWTNzxc31U6MOjfEmB1rHvlYvxI1B7t7BCi1F2vYTT6YhtQRG4hxw=="], - "on-finished": ["on-finished@2.4.2", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ=="], "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="], @@ -4037,8 +3758,6 @@ "openai": ["openai@6.49.0", "", { "peerDependencies": { "@aws-sdk/credential-provider-node": ">=3.972.0 <4", "@smithy/hash-node": ">=4.3.0 <5", "@smithy/signature-v4": ">=5.4.0 <6", "ws": "^8.18.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["@aws-sdk/credential-provider-node", "@smithy/hash-node", "@smithy/signature-v4", "ws", "zod"] }, "sha512-aYCc0C6L864eR6WSYIwQGyXriw/nIyZx0ObvhzOEVuk0zoBDpynjSbrionWI7q65B5H8jJX0DXR9snEzM6bfPg=="], - "openid-client": ["openid-client@5.6.4", "", { "dependencies": { "jose": "^4.15.4", "lru-cache": "^6.0.0", "object-hash": "^2.2.0", "oidc-token-hash": "^5.0.3" } }, "sha512-T1h3B10BRPKfcObdBklX639tVz+xh34O7GjofqrqiAQdm7eHsQ00ih18x6wuJ/E6FxdtS2u3FmUGPDeEcMwzNA=="], - "own-keys": ["own-keys@1.0.2", "", { "dependencies": { "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg=="], "oxc-parser": ["oxc-parser@0.141.0", "", { "dependencies": { "@oxc-project/types": "^0.141.0" }, "optionalDependencies": { "@oxc-parser/binding-android-arm-eabi": "0.141.0", "@oxc-parser/binding-android-arm64": "0.141.0", "@oxc-parser/binding-darwin-arm64": "0.141.0", "@oxc-parser/binding-darwin-x64": "0.141.0", "@oxc-parser/binding-freebsd-x64": "0.141.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.141.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.141.0", "@oxc-parser/binding-linux-arm64-gnu": "0.141.0", "@oxc-parser/binding-linux-arm64-musl": "0.141.0", "@oxc-parser/binding-linux-ppc64-gnu": "0.141.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.141.0", "@oxc-parser/binding-linux-riscv64-musl": "0.141.0", "@oxc-parser/binding-linux-s390x-gnu": "0.141.0", "@oxc-parser/binding-linux-x64-gnu": "0.141.0", "@oxc-parser/binding-linux-x64-musl": "0.141.0", "@oxc-parser/binding-openharmony-arm64": "0.141.0", "@oxc-parser/binding-wasm32-wasi": "0.141.0", "@oxc-parser/binding-win32-arm64-msvc": "0.141.0", "@oxc-parser/binding-win32-ia32-msvc": "0.141.0", "@oxc-parser/binding-win32-x64-msvc": "0.141.0" } }, "sha512-uFkGGr1KMWd6aWv9UAqooYrN78trw8MWWmoPvgWokfBEUq1+eiIQ+qfj3wokhy0fxtZWZk+0dHoS7/yRTJtd6w=="], @@ -4047,28 +3766,26 @@ "p-cancelable": ["p-cancelable@2.1.1", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="], - "p-limit": ["p-limit@7.3.3", "", { "dependencies": { "yocto-queue": "^1.2.1" } }, "sha512-SKgVvDU5TNIxQ4r30U75BNLC6a+6GOEjngrk/ysM5+Zu3oJuk1SC5ApzIzY/7PjCEjoVPMWJ0zho/4QUiEB7TQ=="], + "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], "p-map": ["p-map@7.0.6", "", {}, "sha512-I4Prw6ivkd6p8PiYR1tXASOAOBzIJwu0TB7fqaX0c/8c3QAehNYmX57EijyGGGBt3c/BIowGwV03RVBtXvHEVg=="], - "p-queue": ["p-queue@9.3.3", "", { "dependencies": { "eventemitter3": "^5.0.4", "p-timeout": "^7.0.0" } }, "sha512-NXAOdnEe5FsZJfT4oK84lE1Y5cFFdWlRuOo5tww8DyNMxyRXwn39fIkUtNLKppcPC+UYU/bXujNCUGDv01y7CA=="], - - "p-timeout": ["p-timeout@7.0.1", "", {}, "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg=="], - "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=="], - "package-manager-detector": ["package-manager-detector@1.8.0", "", {}, "sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A=="], - "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=="], "pagefind": ["pagefind@1.5.2", "", { "optionalDependencies": { "@pagefind/darwin-arm64": "1.5.2", "@pagefind/darwin-x64": "1.5.2", "@pagefind/freebsd-x64": "1.5.2", "@pagefind/linux-arm64": "1.5.2", "@pagefind/linux-x64": "1.5.2", "@pagefind/windows-arm64": "1.5.2", "@pagefind/windows-x64": "1.5.2" }, "bin": { "pagefind": "lib/runner/bin.cjs" } }, "sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q=="], + "pako": ["pako@0.2.9", "", {}, "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA=="], + "parse-conflict-json": ["parse-conflict-json@5.0.1", "", { "dependencies": { "json-parse-even-better-errors": "^5.0.0", "just-diff": "^6.0.0", "just-diff-apply": "^5.2.0" } }, "sha512-ZHEmNKMq1wyJXNwLxyHnluPfRAFSIliBvbK/UiOceROt4Xh9Pz0fq49NytIaeaCUf5VR86hwQ/34FCcNU5/LKQ=="], + "parse-css-color": ["parse-css-color@0.2.1", "", { "dependencies": { "color-name": "^1.1.4", "hex-rgb": "^4.1.0" } }, "sha512-bwS/GGIFV3b6KS4uwpzCFj4w297Yl3uqnSgIPsoQkx7GMLROXfMnWvxfNkL0oh8HVhZA4hvJoEoEIqonfJ3BWg=="], + "parse-entities": ["parse-entities@4.0.2", "", { "dependencies": { "@types/unist": "^2.0.0", "character-entities-legacy": "^3.0.0", "character-reference-invalid": "^2.0.0", "decode-named-character-reference": "^1.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0", "is-hexadecimal": "^2.0.0" } }, "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw=="], "parse-latin": ["parse-latin@7.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "@types/unist": "^3.0.0", "nlcst-to-string": "^4.0.0", "unist-util-modify-children": "^4.0.0", "unist-util-visit-children": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ=="], @@ -4077,8 +3794,6 @@ "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="], - "path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="], - "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], "path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="], @@ -4097,8 +3812,6 @@ "pele": ["pele@1.7.0", "", {}, "sha512-nkYb5VnxsTgwD4NThF6j4pJEC4AhGLJ9ptiL4q/vIzGr9q6ZtoRE3hFr94LgHpZ/xy56d1pw42UAQGaZkjM5XA=="], - "piccolore": ["piccolore@0.1.3", "", {}, "sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw=="], - "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], "picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], @@ -4111,7 +3824,7 @@ "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=="], - "playwright-core": ["playwright-core@1.60.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA=="], + "playwright-core": ["playwright-core@1.59.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg=="], "plist": ["plist@3.1.0", "", { "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", "xmlbuilder": "^15.1.1" } }, "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ=="], @@ -4119,10 +3832,10 @@ "postcss": ["postcss@8.5.26", "", { "dependencies": { "nanoid": "^3.3.17", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ=="], - "postcss-nested": ["postcss-nested@6.2.0", "", { "dependencies": { "postcss-selector-parser": "^6.1.1" }, "peerDependencies": { "postcss": "^8.2.14" } }, "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ=="], - "postcss-selector-parser": ["postcss-selector-parser@7.1.6", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw=="], + "postcss-value-parser": ["postcss-value-parser@4.2.0", "", {}, "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="], + "postject": ["postject@1.0.0-alpha.6", "", { "dependencies": { "commander": "^9.4.0" }, "bin": { "postject": "dist/cli.js" } }, "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A=="], "powershell-utils": ["powershell-utils@0.2.1", "", {}, "sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A=="], @@ -4135,12 +3848,8 @@ "pretty-bytes": ["pretty-bytes@6.1.1", "", {}, "sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ=="], - "prismjs": ["prismjs@1.30.0", "", {}, "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw=="], - "proc-log": ["proc-log@6.1.0", "", {}, "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ=="], - "process-ancestry": ["process-ancestry@0.1.0", "", {}, "sha512-tGqJW/UnclpYASFcM6Xh8D8l/BMtaQ9+CSG0vlJSJTcdMM4lDRv4c6H0Pdcsfted+bVczdYSfk2fdukg2gQkZg=="], - "process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="], "proggy": ["proggy@4.0.0", "", {}, "sha512-MbA4R+WQT76ZBm/5JUpV9yqcJt92175+Y0Bodg3HgiXzrmKu7Ggq+bpn6y6wHH+gN9NcyKn3yg1+d47VaKwNAQ=="], @@ -4187,9 +3896,13 @@ "raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="], - "react": ["react@19.2.8", "", {}, "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw=="], + "react": ["react@19.3.1", "", {}, "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw=="], + + "react-dom": ["react-dom@19.3.1", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.1" } }, "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ=="], - "react-dom": ["react-dom@19.2.8", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.8" } }, "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ=="], + "react-reconciler": ["react-reconciler@0.34.0", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.0" } }, "sha512-eVibvB1fc9j5Qf1KRkiM3GzRPBdjg2P6G6QV2f3P6Eb3OGMxRBhdg2rrUwjbV5JrQaJj8nOa8uajmmJA5tJWjQ=="], + + "react-refresh": ["react-refresh@0.17.0", "", {}, "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ=="], "read-binary-file-arch": ["read-binary-file-arch@1.0.6", "", { "dependencies": { "debug": "^4.3.4" }, "bin": { "read-binary-file-arch": "cli.js" } }, "sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg=="], @@ -4197,8 +3910,6 @@ "readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], - "readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], - "recma-build-jsx": ["recma-build-jsx@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-util-build-jsx": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew=="], "recma-jsx": ["recma-jsx@1.0.1", "", { "dependencies": { "acorn-jsx": "^5.0.0", "estree-util-to-js": "^2.0.0", "recma-parse": "^1.0.0", "recma-stringify": "^1.0.0", "unified": "^11.0.0" }, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-huSIy7VU2Z5OLv6oFLosQGGDqPqdO1iq6bWNAdhzMxSJP7RAso4fCZ1cKu8j9YHCZf3TPrq4dw3okhrylgcd7w=="], @@ -4229,22 +3940,8 @@ "regjsparser": ["regjsparser@0.13.2", "", { "dependencies": { "jsesc": "~3.1.0" }, "bin": { "regjsparser": "bin/parser" } }, "sha512-NgRBy2Nx/bE+9F27nVHnqcN5HjyLmecqsqx2PJHu3/IEtADD4WuxuXIVExD5PoSDFVrl78dOonfcOe5O+5nbzQ=="], - "rehype": ["rehype@13.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "rehype-parse": "^9.0.0", "rehype-stringify": "^10.0.0", "unified": "^11.0.0" } }, "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A=="], - - "rehype-autolink-headings": ["rehype-autolink-headings@7.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-heading-rank": "^3.0.0", "hast-util-is-element": "^3.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-rItO/pSdvnvsP4QRB1pmPiNHUskikqtPojZKJPPPAVx9Hj8i8TwMBhofrrAYRhYOOBZH9tgmG5lPqDLuIWPWmw=="], - - "rehype-expressive-code": ["rehype-expressive-code@0.44.2", "", { "dependencies": { "expressive-code": "^0.44.2" } }, "sha512-jvjQpsfWKBquDrEl5YQA3CJybRRIuDOYsui1BJTs5oKDUK8pPkJSSxY8FjxNlIFIdtgrTjC1zuahuY4Cc1j9SQ=="], - - "rehype-format": ["rehype-format@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-format": "^1.0.0" } }, "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ=="], - - "rehype-parse": ["rehype-parse@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="], - - "rehype-raw": ["rehype-raw@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="], - "rehype-recma": ["rehype-recma@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "hast-util-to-estree": "^3.0.0" } }, "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw=="], - "rehype-stringify": ["rehype-stringify@10.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-html": "^9.0.0", "unified": "^11.0.0" } }, "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA=="], - "remark-directive": ["remark-directive@4.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-directive": "^3.0.0", "micromark-extension-directive": "^4.0.0", "unified": "^11.0.0" } }, "sha512-7sxn4RfF1o3izevPV1DheyGDD6X4c9hrGpfdUpm7uC++dqrnJxIZVkk7CoKqcLm0VUMAuOol7Mno3m6g8cfMuA=="], "remark-gfm": ["remark-gfm@4.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg=="], @@ -4261,8 +3958,6 @@ "remeda": ["remeda@2.26.0", "", { "dependencies": { "type-fest": "^4.41.0" } }, "sha512-lmNNwtaC6Co4m0WTTNoZ/JlpjEqAjPZO0+czC9YVRQUpkbS4x8Hmh+Mn9HPfJfiXqUQ5IXXgSXSOB2pBKAytdA=="], - "request-light": ["request-light@0.7.0", "", {}, "sha512-lMbBMrDoxgsyO+yB3sDcrDuX85yYt7sS8BfQd11jtbW/z5ZWgLZRcEGLsLoYw7I0WSUGQBs8CC8ScIxkTX1+6Q=="], - "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], @@ -4325,7 +4020,7 @@ "sanitize-filename": ["sanitize-filename@1.6.4", "", { "dependencies": { "truncate-utf8-bytes": "^1.0.0" } }, "sha512-9ZyI08PsvdQl2r/bBIGubpVdR3RR9sY6RDiWFPreA21C/EFlQhmgo20UZlNjZMMZNubusLhAQozkA0Od5J21Eg=="], - "satteri": ["satteri@0.9.5", "", { "dependencies": { "@types/estree-jsx": "^1.0.5", "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "@types/unist": "^3.0.3" }, "optionalDependencies": { "@bruits/satteri-darwin-arm64": "0.9.5", "@bruits/satteri-darwin-x64": "0.9.5", "@bruits/satteri-linux-arm64-gnu": "0.9.5", "@bruits/satteri-linux-arm64-musl": "0.9.5", "@bruits/satteri-linux-x64-gnu": "0.9.5", "@bruits/satteri-linux-x64-musl": "0.9.5", "@bruits/satteri-wasm32-wasi": "0.9.5", "@bruits/satteri-win32-arm64-msvc": "0.9.5", "@bruits/satteri-win32-x64-msvc": "0.9.5" } }, "sha512-ZuWVl+vnM64y+/TtX8Kosv2c00W+hLQiiwnEL6H0UKVVrxFqMw4D2CJHHQaouVd89OAhtBBfjWLqhKi3TVUV4w=="], + "satori": ["satori@0.63.2", "", { "dependencies": { "@shuding/opentype.js": "1.4.0-beta.0", "css-background-parser": "^0.1.0", "css-box-shadow": "1.0.0-3", "css-gradient-parser": "^0.0.17", "css-to-react-native": "^3.0.0", "emoji-regex-xs": "^2.0.1", "escape-html": "^1.0.3", "fflate": "0.7.3", "harfbuzzjs": "0.10.0", "linebreak": "^1.1.0", "parse-css-color": "^0.2.1", "postcss-value-parser": "^4.2.0" } }, "sha512-h7dm4BRMo8F53l9vOXOIfJoqeVXuZvyz13VsvVuwJb72sLfq+8uddJIJcjLKLv2BqWzDvYIpzi3rvBBS+ETuvw=="], "sax": ["sax@1.6.1", "", {}, "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q=="], @@ -4357,7 +4052,7 @@ "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], - "sharp": ["sharp@0.35.5", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.5", "@img/sharp-darwin-x64": "0.35.5", "@img/sharp-freebsd-wasm32": "0.35.5", "@img/sharp-libvips-darwin-arm64": "1.3.4", "@img/sharp-libvips-darwin-x64": "1.3.4", "@img/sharp-libvips-linux-arm": "1.3.4", "@img/sharp-libvips-linux-arm64": "1.3.4", "@img/sharp-libvips-linux-ppc64": "1.3.4", "@img/sharp-libvips-linux-riscv64": "1.3.4", "@img/sharp-libvips-linux-s390x": "1.3.4", "@img/sharp-libvips-linux-x64": "1.3.4", "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", "@img/sharp-libvips-linuxmusl-x64": "1.3.4", "@img/sharp-linux-arm": "0.35.5", "@img/sharp-linux-arm64": "0.35.5", "@img/sharp-linux-ppc64": "0.35.5", "@img/sharp-linux-riscv64": "0.35.5", "@img/sharp-linux-s390x": "0.35.5", "@img/sharp-linux-x64": "0.35.5", "@img/sharp-linuxmusl-arm64": "0.35.5", "@img/sharp-linuxmusl-x64": "0.35.5", "@img/sharp-webcontainers-wasm32": "0.35.5", "@img/sharp-win32-arm64": "0.35.5", "@img/sharp-win32-ia32": "0.35.5", "@img/sharp-win32-x64": "0.35.5" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g=="], + "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], @@ -4377,22 +4072,16 @@ "sigstore": ["sigstore@4.1.1", "", { "dependencies": { "@sigstore/bundle": "^4.0.0", "@sigstore/core": "^3.2.1", "@sigstore/protobuf-specs": "^0.5.0", "@sigstore/sign": "^4.1.1", "@sigstore/tuf": "^4.0.2", "@sigstore/verify": "^3.1.1" } }, "sha512-endqECJkfhozrXMK5ngu/UAA0xVcVEFdnHJCElGaExypjW+HK5i6zu3NteLoaX/iFbRUbC3+DjttQs0GARr+5w=="], - "simple-swizzle": ["simple-swizzle@0.2.4", "", { "dependencies": { "is-arrayish": "^0.3.1" } }, "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw=="], - "simple-update-notifier": ["simple-update-notifier@2.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w=="], "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="], - "sitemap": ["sitemap@9.0.1", "", { "dependencies": { "@types/node": "^24.9.2", "@types/sax": "^1.2.1", "arg": "^5.0.0", "sax": "^1.4.1" }, "bin": { "sitemap": "dist/esm/cli.js" } }, "sha512-S6hzjGJSG3d6if0YoF5kTyeRJvia6FSTBroE5fQ0bu1QNxyJqhhinfUsXi9fH3MgtXODWvwo2BDyQSnhPQ88uQ=="], - "slice-ansi": ["slice-ansi@5.0.0", "", { "dependencies": { "ansi-styles": "^6.0.0", "is-fullwidth-code-point": "^4.0.0" } }, "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ=="], "smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="], "smob": ["smob@1.6.2", "", {}, "sha512-RQsvleCbF8cVHEv+xuDGaA4pOizFqJ0GgjtMSRo6oP8pnN7WsigHgVGey6aILRBKv4W2YOMHLqbKdnB6hpB9fw=="], - "smol-toml": ["smol-toml@1.9.1", "", {}, "sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ=="], - "socket.io-client": ["socket.io-client@4.8.3", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-client": "~6.6.1", "socket.io-parser": "~4.2.4" } }, "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g=="], "socket.io-parser": ["socket.io-parser@4.2.7", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1" } }, "sha512-IH/iSeO9T6gz1KkFleGDWkG9N3dl4jXVYUtMhIqH10Md0ttMer8nUNWiP1DKuNrybD2xBrixLJdCC9J6ECoYkg=="], @@ -4447,24 +4136,6 @@ "ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], - "sst": ["sst@4.13.1", "", { "dependencies": { "@aws/durable-execution-sdk-js": "1.0.2", "aws4fetch": "1.0.18", "jose": "5.2.3", "openid-client": "5.6.4" }, "optionalDependencies": { "sst-darwin-arm64": "4.13.1", "sst-darwin-x64": "4.13.1", "sst-linux-arm64": "4.13.1", "sst-linux-x64": "4.13.1", "sst-linux-x86": "4.13.1", "sst-win32-arm64": "4.13.1", "sst-win32-x64": "4.13.1", "sst-win32-x86": "4.13.1" }, "bin": { "sst": "bin/sst.mjs" } }, "sha512-FKzhWuqV5NPhFWH7b+Ktf5+Mvox6DCMc8iOrjaS3mkjnnmyEcOZq7HNx2/ZlIcBwgOZE9sCPR3ot1zXtXkXzZg=="], - - "sst-darwin-arm64": ["sst-darwin-arm64@4.13.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gGwfgZGOsulU6iGeZJtxP5BpSZFsRUy1dG/yTqJa++n1P1APWXZC64u2qRHm6rdwLAjEeWaCQ9k7ouKgn0zh5Q=="], - - "sst-darwin-x64": ["sst-darwin-x64@4.13.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-RcKLI2oAY+Wk5fWUF0gJFKvwMSpid3qw9L3OcfgFL2ymZH652ybLpQPBxtoJ95FdyknWIMnYf6ZK9C2jnH5eaw=="], - - "sst-linux-arm64": ["sst-linux-arm64@4.13.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-Lp/8BWhH8KZnb50xPd8A6bkZ7QqCH3Dar9l16TPwuAmPxxRUlkmg42h+ACZ9n02vSJl8y/WLnV4JB6SgJpRFVg=="], - - "sst-linux-x64": ["sst-linux-x64@4.13.1", "", { "os": "linux", "cpu": "x64" }, "sha512-f4eHOsApoP+CpUzLUGzfoTBYsqqr6nl/M0gjYsVNi1T+6v92lc84AhQ4DoDZx033QggyxkqRezj8jOkjkKxa7w=="], - - "sst-linux-x86": ["sst-linux-x86@4.13.1", "", { "os": "linux", "cpu": "none" }, "sha512-5OHdtPa0GmozDpBPdsD9Tv+SGnpjJSoTXptgK59ivQg3UYNWBBotidvEyUJs1MU9B/3+I+Fmw32zsF2O+ZtPgg=="], - - "sst-win32-arm64": ["sst-win32-arm64@4.13.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-qAUuCQj6wDdZ84a9W4FhnRTHYlEnYRHGYFqO3cmMImbnAQEoKSQR1XuWqt0Ev4RT3kU4Lz/fgvJjGkR7WUstLg=="], - - "sst-win32-x64": ["sst-win32-x64@4.13.1", "", { "os": "win32", "cpu": "x64" }, "sha512-r+83NMwpe4MLAvkVoOxi1KNs6nIqilFucsTr+VN1PgknsiVBY1emITjSWS2jDJJMuH8xJXL5xJzF/l5rcKWErg=="], - - "sst-win32-x86": ["sst-win32-x86@4.13.1", "", { "os": "win32", "cpu": "none" }, "sha512-YPxBVdac/MsrzwlC6pF0NrrvMcmfdBLYjv7MbzHc5jNh1FQ1WPh6bdWQqgv0KD9EQTNLLEkej0beydgUvcCWJg=="], - "standardwebhooks": ["standardwebhooks@1.1.1", "", { "dependencies": { "@stablelib/base64": "^1.0.0", "fast-sha256": "^1.3.0" } }, "sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ=="], "stat-mode": ["stat-mode@1.0.0", "", {}, "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg=="], @@ -4473,14 +4144,12 @@ "stop-iteration-iterator": ["stop-iteration-iterator@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "internal-slot": "^1.1.0" } }, "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ=="], - "stoppable": ["stoppable@1.1.0", "", {}, "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="], - - "stream-replace-string": ["stream-replace-string@2.0.0", "", {}, "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w=="], - "string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "string-width-cjs": ["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=="], + "string.prototype.codepointat": ["string.prototype.codepointat@0.2.1", "", {}, "sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg=="], + "string.prototype.matchall": ["string.prototype.matchall@4.0.12", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-abstract": "^1.23.6", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.6", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "internal-slot": "^1.1.0", "regexp.prototype.flags": "^1.5.3", "set-function-name": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA=="], "string.prototype.trim": ["string.prototype.trim@1.2.11", "", { "dependencies": { "call-bind": "^1.0.9", "call-bound": "^1.0.4", "define-data-property": "^1.1.4", "define-properties": "^1.2.1", "es-abstract": "^1.24.2", "es-object-atoms": "^1.1.2", "has-property-descriptors": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w=="], @@ -4517,8 +4186,6 @@ "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], - "svgo": ["svgo@4.1.0", "", { "dependencies": { "commander": "^11.1.0", "css-select": "^6.0.0", "css-tree": "^3.0.1", "css-what": "^7.0.0", "csso": "^5.0.5", "picocolors": "^1.1.1", "sax": "1.6.1" }, "bin": { "svgo": "bin/svgo.js" } }, "sha512-bkxnTg1kSU0guhIBmibA6UUhrQmPVA1XsQLN+ylCd+UWzbnLkySOcXpyk1mrl05f+pcaCx2eHb+sp6BgMZWX+Q=="], - "tailwindcss": ["tailwindcss@4.3.3", "", {}, "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ=="], "tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="], @@ -4539,15 +4206,15 @@ "third-party-web": ["third-party-web@0.29.2", "", {}, "sha512-fegtha91tq2DHphyoiBXVHjVi2YG9zFaRnboT9C28tO1en9Y3wJsfspuy40F+u5wl3hHVbw7cnd1b67kEGHb8g=="], + "three": ["three@0.180.0", "", {}, "sha512-o+qycAMZrh+TsE01GqWUxUIKR1AL0S8pq7zDkYOQw8GqfX8b8VoCKYUoHbhiX5j+7hr8XsuHDVU6+gkQJQKg9w=="], + "tiny-async-pool": ["tiny-async-pool@1.3.0", "", { "dependencies": { "semver": "^5.5.0" } }, "sha512-01EAw5EDrcVrdgyCLgoSPvqznC0sVxDSVeiOz09FUpjh71G79VCqneOr+xvt7T1r76CF6ZZfPjHorN2+d+3mqA=="], "tiny-inflate": ["tiny-inflate@1.0.3", "", {}, "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw=="], "tiny-typed-emitter": ["tiny-typed-emitter@2.1.0", "", {}, "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA=="], - "tinyclip": ["tinyclip@1.0.3", "", {}, "sha512-nTv2raKFMzGG6JJp0lpNDsRPdfFE6UHlu2rVEjXo8vkx1ZS3LW2CVXqIaLu8xZlu+6tbFs9V58Qc/Jmk/Ii7wA=="], - - "tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], + "tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], @@ -4565,8 +4232,6 @@ "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="], - "toolbeam-docs-theme": ["toolbeam-docs-theme@0.4.8", "", { "peerDependencies": { "@astrojs/starlight": "^0.34.3", "astro": "^5.7.13" } }, "sha512-b+5ynEFp4Woe5a22hzNQm42lD23t13ZMihVxHbzjA50zdcM9aOSJTIjdJ0PDSd4/50HbBXcpHiQsz6rM4N88ww=="], - "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], "treeverse": ["treeverse@3.0.0", "", {}, "sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ=="], @@ -4601,20 +4266,10 @@ "typed-query-selector": ["typed-query-selector@2.12.2", "", {}, "sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ=="], - "typesafe-path": ["typesafe-path@0.2.2", "", {}, "sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA=="], - "typescript": ["@typescript/typescript6@6.0.2", "", { "dependencies": { "@typescript/old": "npm:typescript@^6" }, "bin": { "tsc6": "bin/tsc6" } }, "sha512-mbCddXd+jm7hfx7w2YU64/Av4/NqqeG3GoRZgxPcgoTxYjhrcfJRw9ULch71SS4G+Q3bOXFhRvPqjguN0Hyp5w=="], - "typescript-auto-import-cache": ["typescript-auto-import-cache@0.3.6", "", { "dependencies": { "semver": "^7.3.8" } }, "sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ=="], - - "ufo": ["ufo@1.6.4", "", {}, "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA=="], - - "ultrahtml": ["ultrahtml@1.7.0", "", {}, "sha512-2xRd0VHoAQE4M+vF/DvFFB7pUV0ZxTW1TLi7lHQWnF/Sb5TPeEUV/l+hxcNnGO00ZXGnR0voCMmYRKQf+rvJ2g=="], - "unbox-primitive": ["unbox-primitive@1.1.0", "", { "dependencies": { "call-bound": "^1.0.3", "has-bigints": "^1.0.2", "has-symbols": "^1.1.0", "which-boxed-primitive": "^1.1.1" } }, "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw=="], - "uncrypto": ["uncrypto@0.1.3", "", {}, "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q=="], - "undici": ["undici@8.12.3", "", {}, "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw=="], "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], @@ -4629,9 +4284,9 @@ "unicode-property-aliases-ecmascript": ["unicode-property-aliases-ecmascript@2.2.0", "", {}, "sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ=="], - "unified": ["unified@11.0.5", "", { "dependencies": { "@types/unist": "^3.0.0", "bail": "^2.0.0", "devlop": "^1.0.0", "extend": "^3.0.0", "is-plain-obj": "^4.0.0", "trough": "^2.0.0", "vfile": "^6.0.0" } }, "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA=="], + "unicode-trie": ["unicode-trie@2.0.0", "", { "dependencies": { "pako": "^0.2.5", "tiny-inflate": "^1.0.0" } }, "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ=="], - "unifont": ["unifont@0.7.5", "", { "dependencies": { "css-tree": "^3.1.0", "ohash": "^2.0.11", "undici": "^8.0.0" } }, "sha512-ULe/Cs+ZIsq+dcFofNkhqielCrUJnb5mr+Yc4EBM2VlL+6OZR6+cjtI2mT1bJvRBrVncqHAbLURxmPLcCXzWMg=="], + "unified": ["unified@11.0.5", "", { "dependencies": { "@types/unist": "^3.0.0", "bail": "^2.0.0", "devlop": "^1.0.0", "extend": "^3.0.0", "is-plain-obj": "^4.0.0", "trough": "^2.0.0", "vfile": "^6.0.0" } }, "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA=="], "unique-string": ["unique-string@2.0.0", "", { "dependencies": { "crypto-random-string": "^2.0.0" } }, "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg=="], @@ -4645,8 +4300,6 @@ "unist-util-position-from-estree": ["unist-util-position-from-estree@2.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ=="], - "unist-util-remove-position": ["unist-util-remove-position@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q=="], - "unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="], "unist-util-visit": ["unist-util-visit@5.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg=="], @@ -4673,7 +4326,7 @@ "update-browserslist-db": ["update-browserslist-db@1.3.1", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="], - "url-extras": ["url-extras@0.1.0", "", {}, "sha512-8tzwTeXFPuX/5PHuCDQE5Dd9Ts4rwoq2t9aIT+HS4iAVpmj5l4Ao7Q+BuuFjvWRqrLswBhQDk8O96ZicgCqQqw=="], + "uqr": ["uqr@0.1.3", "", {}, "sha512-0rjE8iEJe4YmT9TOhwsZtqCMRLc5DXZUI2UEYUUg63ikBkqqE5EYWaI0etFe/5KUcmcYwLih2RND1kq+hrUJXA=="], "utf8-byte-length": ["utf8-byte-length@1.0.5", "", {}, "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA=="], @@ -4683,12 +4336,8 @@ "vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="], - "verkit": ["verkit@0.5.0", "", {}, "sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g=="], - "vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="], - "vfile-location": ["vfile-location@5.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="], - "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], "vite": ["vite@8.2.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.5", "postcss": "^8.5.26", "rolldown": "~1.2.4", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.4.0 || ^0.5.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.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", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-lfauXnrf2x0p+UoA+wXh0dgFWnUjCyG6Js95KBkgaCwUU9k0DAHI4W6Q0WCx+h+5g+Alce1y4Zi2QjjK0UvGBw=="], @@ -4701,47 +4350,15 @@ "vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="], - "volar-service-css": ["volar-service-css@0.0.71", "", { "dependencies": { "vscode-css-languageservice": "^6.3.0", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-wRRFt9BpjMKCazcgOh67MSjUjiWUCAh99DyYSDIOTuxaRjEtDC7PpB0k1Y1wbJIW/pVtMUSVbpPo3UGSm0Byxw=="], - - "volar-service-emmet": ["volar-service-emmet@0.0.71", "", { "dependencies": { "@emmetio/css-parser": "^0.4.1", "@emmetio/html-matcher": "^1.3.0", "@vscode/emmet-helper": "^2.9.3", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-zqjzt6bN95e3CUstBm0PBFAJnrfz0ZAARka87fart46/gNCLLuP3Vujy8V/J8HEziTFLnfkgIASLFYPUhonJcA=="], - - "volar-service-html": ["volar-service-html@0.0.71", "", { "dependencies": { "vscode-html-languageservice": "^5.3.0", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-e8tHPhgQ7ooLfudAEIku+kgd9pWkq3SSz8RbnQDI1+Eb8wbenkLGHqoirLqz5ORLV6wIMr2Iv08RWBG5eOcgpw=="], - - "volar-service-prettier": ["volar-service-prettier@0.0.71", "", { "dependencies": { "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0", "prettier": "^2.2 || ^3.0" }, "optionalPeers": ["@volar/language-service", "prettier"] }, "sha512-Rz7JVH3qD108UCdmIEiZvOBNljMt2nLFdbN8AXcDfn7xD9F5I2aCIsDVqBbXw21PsnxG0b7MfwtNF+zPS/NKUg=="], - - "volar-service-typescript": ["volar-service-typescript@0.0.71", "", { "dependencies": { "path-browserify": "^1.0.1", "semver": "^7.6.2", "typescript-auto-import-cache": "^0.3.5", "vscode-languageserver-textdocument": "^1.0.11", "vscode-nls": "^5.2.0", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-yTtM/BVT6hoyEYnDtaCyAtNhdNeS/mhTTABlBOdw3NNiRBUin3IznFJpgfjer4c6RYopiPjjQjc9VFhxVl1mLw=="], - - "volar-service-typescript-twoslash-queries": ["volar-service-typescript-twoslash-queries@0.0.71", "", { "dependencies": { "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-9K2k72s4n7rV9s4bX0MyjbX9iBribvKZbBJKuEmTCZfeWJXs6Yh7bGpY4eoc7UufAjvpheBqwyZCOIPBvxCv0A=="], - - "volar-service-yaml": ["volar-service-yaml@0.0.71", "", { "dependencies": { "vscode-uri": "^3.0.8", "yaml-language-server": "~1.23.0" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-qYGWGuVpUTnZGu5P/CR4KLK4aIR8RrcVnmfZ2eRcj9q/I8VZCoC5yy9FtEvfNvnDp4MU17yhdJcvpQPIqhJS2Q=="], - - "vscode-css-languageservice": ["vscode-css-languageservice@6.3.10", "", { "dependencies": { "@vscode/l10n": "^0.0.18", "vscode-languageserver-textdocument": "^1.0.12", "vscode-languageserver-types": "3.17.5", "vscode-uri": "^3.1.0" } }, "sha512-eq5N9Er3fC4vA9zd9EFhyBG90wtCCuXgRSpAndaOgXMh1Wgep5lBgRIeDgjZBW9pa+332yC9+49cZMW8jcL3MA=="], - - "vscode-html-languageservice": ["vscode-html-languageservice@5.6.2", "", { "dependencies": { "@vscode/l10n": "^0.0.18", "vscode-languageserver-textdocument": "^1.0.12", "vscode-languageserver-types": "^3.17.5", "vscode-uri": "^3.1.0" } }, "sha512-ulCrSnFnfQ16YzvwnYUgEbUEl/ZG7u2eV27YhvLObSHKkb8fw1Z9cgsnUwjTEeDIdJDoTDTDpxuhQwoenoLNMg=="], - - "vscode-json-languageservice": ["vscode-json-languageservice@4.1.8", "", { "dependencies": { "jsonc-parser": "^3.0.0", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.16.0", "vscode-nls": "^5.0.0", "vscode-uri": "^3.0.2" } }, "sha512-0vSpg6Xd9hfV+eZAaYN63xVVMOTmJ4GgHxXnkLCh+9RsQBkWKIghzLhW2B9ebfG+LQQg8uLtsQ2aUKjTgE+QOg=="], - "vscode-jsonrpc": ["vscode-jsonrpc@8.2.1", "", {}, "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ=="], - "vscode-languageserver": ["vscode-languageserver@9.0.1", "", { "dependencies": { "vscode-languageserver-protocol": "3.17.5" }, "bin": { "installServerIntoExtension": "bin/installServerIntoExtension" } }, "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g=="], - - "vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.18.2", "", { "dependencies": { "vscode-jsonrpc": "9.0.1", "vscode-languageserver-types": "3.18.0" } }, "sha512-XRyDbT0Pp3sSNti3JmxVEUMySWCSi1hhM+/KUlCy1hV1zmrqpM1OwO12EAki8blhmLuIMpaJrYbo0OzGVfK2Qg=="], - - "vscode-languageserver-textdocument": ["vscode-languageserver-textdocument@1.0.12", "", {}, "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA=="], - - "vscode-languageserver-types": ["vscode-languageserver-types@3.17.5", "", {}, "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg=="], - - "vscode-nls": ["vscode-nls@5.2.0", "", {}, "sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng=="], - - "vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="], - "walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], - "web-features": ["web-features@3.37.0", "", {}, "sha512-47x5zchtpsvvH/EEQ0h3d3E9kZyFxFyk6LkmYHXDZjLF0RAa3OV2s8dMRqphp/PTxxrd/iZwz37dte6xWgV7mQ=="], + "wawoff2": ["wawoff2@2.0.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "woff2_compress.js": "bin/woff2_compress.js", "woff2_decompress.js": "bin/woff2_decompress.js" } }, "sha512-r0CEmvpH63r4T15ebFqeOjGqU4+EgTx4I510NtK35EMciSdcTxCw3Byy3JnBonz7iyIFZ0AbVo0bbFpEVuhCYA=="], - "web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="], + "web-features": ["web-features@3.37.0", "", {}, "sha512-47x5zchtpsvvH/EEQ0h3d3E9kZyFxFyk6LkmYHXDZjLF0RAa3OV2s8dMRqphp/PTxxrd/iZwz37dte6xWgV7mQ=="], - "web-streams-polyfill": ["web-streams-polyfill@4.0.0-beta.3", "", {}, "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug=="], + "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], "web-tree-sitter": ["web-tree-sitter@0.25.10", "", { "peerDependencies": { "@types/emscripten": "^1.40.0" }, "optionalPeers": ["@types/emscripten"] }, "sha512-Y09sF44/13XvgVKgO2cNDw5rGk6s26MgoZPXLESvMXeefBf7i6/73eFurre0IsTW6E14Y0ArIzhUMmjoc7xyzA=="], @@ -4821,21 +4438,19 @@ "xmlhttprequest-ssl": ["xmlhttprequest-ssl@2.1.2", "", {}, "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ=="], - "xxhash-wasm": ["xxhash-wasm@1.1.0", "", {}, "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA=="], - "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], "yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="], - "yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="], - - "yaml-language-server": ["yaml-language-server@1.23.0", "", { "dependencies": { "@vscode/l10n": "^0.0.18", "ajv": "^8.17.1", "ajv-draft-04": "^1.0.0", "ajv-i18n": "^4.2.0", "prettier": "^3.8.1", "request-light": "^0.5.7", "vscode-json-languageservice": "4.1.8", "vscode-languageserver": "^9.0.0", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.16.0", "vscode-uri": "^3.0.2", "yaml": "2.8.3" }, "bin": { "yaml-language-server": "bin/yaml-language-server" } }, "sha512-3qVyCOexLCWw06PQa5kRPwvMWMZ/eZeCRWUvgD6a0OkqL/4iCnxy2WumbWifa937Uo5xhyWJ0uxlU39ljhNh7A=="], + "yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], "yargs": ["yargs@17.7.3", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g=="], "yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], - "yocto-queue": ["yocto-queue@1.2.2", "", {}, "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ=="], + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], + + "yoga-layout": ["yoga-layout@3.2.1", "", {}, "sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ=="], "youch": ["youch@4.1.0-beta.10", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@poppinss/dumper": "^0.6.4", "@speed-highlight/core": "^1.2.7", "cookie": "^1.0.2", "youch-core": "^0.3.3" } }, "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ=="], @@ -4849,44 +4464,10 @@ "@ai-sdk/openai-compatible/@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="], - "@ai-sdk/openai-compatible/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.23", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-z8GlDaCmRSDlqkMF2f4/RFgWxdarvIbyuk+m6WXT1LYgsnGiXRJGTD2Z1+SDl3LqtFuRtGX1aghYvQLoHL/9pg=="], - - "@ai-sdk/provider-utils/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], + "@ai-sdk/provider-utils/@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="], "@anthropic-ai/sdk/@opentelemetry/api": ["@opentelemetry/api@1.9.1", "", {}, "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q=="], - "@astrojs/astro2tsx/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], - - "@astrojs/astro2tsx/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g=="], - - "@astrojs/compiler-binding-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], - - "@astrojs/compiler-binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - - "@astrojs/internal-helpers/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=="], - - "@astrojs/markdown-remark/@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.12.0", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.8.0", "unified": "^11.0.5", "yaml": "^2.9.1" } }, "sha512-pKPuwCDtO0L7zgmt1JGd9X4Aes1+0SX3IEBSqBNPHsScYdPMlfmed3Y7DTbXyF7E+8ylnb563o/0OzGQPOFehw=="], - - "@astrojs/markdown-remark/acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], - - "@astrojs/markdown-satteri/@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.12.0", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.8.0", "unified": "^11.0.5", "yaml": "^2.9.1" } }, "sha512-pKPuwCDtO0L7zgmt1JGd9X4Aes1+0SX3IEBSqBNPHsScYdPMlfmed3Y7DTbXyF7E+8ylnb563o/0OzGQPOFehw=="], - - "@astrojs/markdown-satteri/satteri": ["satteri@0.10.5", "", { "dependencies": { "@types/estree-jsx": "^1.0.5", "@types/hast": "^3.0.5", "@types/mdast": "^4.0.4", "@types/unist": "^3.0.3" }, "optionalDependencies": { "@bruits/satteri-darwin-arm64": "0.10.5", "@bruits/satteri-darwin-x64": "0.10.5", "@bruits/satteri-linux-arm64-gnu": "0.10.5", "@bruits/satteri-linux-arm64-musl": "0.10.5", "@bruits/satteri-linux-x64-gnu": "0.10.5", "@bruits/satteri-linux-x64-musl": "0.10.5", "@bruits/satteri-wasm32-wasi": "0.10.5", "@bruits/satteri-win32-arm64-msvc": "0.10.5", "@bruits/satteri-win32-x64-msvc": "0.10.5" } }, "sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ=="], - - "@astrojs/mdx/@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.10.2", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "js-yaml": "^4.3.0", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.6.0", "unified": "^11.0.5" } }, "sha512-yt7fMgPYqSM4Tmr+taTW6Per+hjJ8Pk6lA1PAcDyqzOt8HzJ6Kje5WzCxA2Sd+9wsUW7uhkLeoTMK0cXPwH9rQ=="], - - "@astrojs/mdx/@astrojs/markdown-remark": ["@astrojs/markdown-remark@7.2.2", "", { "dependencies": { "@astrojs/internal-helpers": "0.10.2", "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "sha512-FGfmK84zSNcrsBd0dl1gXE9JvZYElp8EXQa2jpHVAxG4deGKAp43wspxFupjADJX7MSsMRHwYCnfT6EyVmgeFQ=="], - - "@astrojs/mdx/acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], - - "@astrojs/solid-js/vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.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", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], - - "@astrojs/starlight/@astrojs/markdown-satteri": ["@astrojs/markdown-satteri@0.3.8", "", { "dependencies": { "@astrojs/internal-helpers": "0.10.4", "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "satteri": "^0.10.3" } }, "sha512-n8ItpFTCmlDsVR5+rwDmehSf+jFCYLWmZiisZNGuF7xILqYhsVeBfcha4qgS2Seq3fAc9Tm58ZVrvqFQ6RQgRQ=="], - - "@astrojs/starlight/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=="], - - "@astrojs/telemetry/ci-info": ["ci-info@4.4.0", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], "@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], @@ -4903,15 +4484,11 @@ "@babel/preset-env/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], - - "@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], + "@cloudflare/config/zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="], - "@cloudflare/vite-plugin/miniflare": ["miniflare@5.20260811.1-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.2", "undici": "7.29.0", "workerd": "1.20260811.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-DtOG0BeanIxs2sH0smFvExZD89cBQwGckbHiFkRJrrNAUu3NGClZkUxqu+zy7HYfKBAgq935EMY49vIPm3JVdA=="], + "@cloudflare/runtime-types/miniflare": ["miniflare@5.20261001.0-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.4", "undici": "7.29.1", "workerd": "1.20261001.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-GaimS5mSIOMyvd16ga+e1/QkI8cmp3z35QPHFex0DktqNQf2RVZQwMPQXdyoUreUiFP/0Gpe2MoQInTyMAD5xA=="], - "@cloudflare/vite-plugin/workerd": ["workerd@1.20260811.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20260811.1", "@cloudflare/workerd-darwin-arm64": "1.20260811.1", "@cloudflare/workerd-linux-64": "1.20260811.1", "@cloudflare/workerd-linux-arm64": "1.20260811.1", "@cloudflare/workerd-windows-64": "1.20260811.1" }, "bin": { "workerd": "bin/workerd" } }, "sha512-kh+FFm55JQ4ssxhHZV9VPdMQq3D1nHxNJgwxMtWGD4dGppJvLySdguTRDKgeNTvgq6heSz+6TTXyPSDGj8Yllw=="], - - "@cloudflare/vite-plugin/wrangler": ["wrangler@4.123.0", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.5.0", "@cloudflare/unenv-preset": "2.16.1", "blake3-wasm": "2.1.5", "esbuild": "0.28.1", "miniflare": "5.20260811.1-alpha", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20260811.1" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@cloudflare/workers-types": "^5.20260811.1" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js", "cf-wrangler": "bin/cf-wrangler.js" } }, "sha512-VXo2I1oa0x9aGAKIFPRSQPqTh0RBY5Ktl44YOhNmsJQFUdJKDA2vVTU6Xj+FC2koll6orJqWZN8jbXVIk9O67Q=="], + "@cloudflare/runtime-types/workerd": ["workerd@1.20261001.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261001.1", "@cloudflare/workerd-darwin-arm64": "1.20261001.1", "@cloudflare/workerd-linux-64": "1.20261001.1", "@cloudflare/workerd-linux-arm64": "1.20261001.1", "@cloudflare/workerd-windows-64": "1.20261001.1" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-d/SIYHFO0PT/wiFZg8in4NpRIxYuFwslX1HdylOtWkBIIUmSpkGFhK820cV84XACFylwJ48xuRoWW/8DWDPsPQ=="], "@cspotcode/source-map-support/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], @@ -4941,13 +4518,9 @@ "@electron/windows-sign/fs-extra": ["fs-extra@11.4.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-EQsFzMUJkCKGr1ePqlYADkIUmHW1s3ZXr5Yqy6wbGrfUCphpl2maM/kyOIRA2HpP3AaFQTZXD4ldjek+nccddA=="], - "@expressive-code/core/postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], - - "@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.5", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ=="], + "@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.4", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA=="], - "@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - - "@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.5", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ=="], + "@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.4", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA=="], "@malept/flatpak-bundler/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], @@ -4991,20 +4564,26 @@ "@opencode/cli/vite-plugin-solid": ["vite-plugin-solid@2.11.10", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Yr1dQybmtDtDAHkii6hXuc1oVH9CPcS/Zb2jN/P36qqcrkNnVPsMTzQ06jyzFPFjj3U1IYKMVt/9ZqcwGCEbjw=="], - "@opencode/console-app/wrangler": ["wrangler@4.50.0", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.4.0", "@cloudflare/unenv-preset": "2.7.11", "blake3-wasm": "2.1.5", "esbuild": "0.25.4", "miniflare": "4.20251118.1", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20251118.0" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20251118.0" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-+nuZuHZxDdKmAyXOSrHlciGshCoAPiy5dM+t6mEohWm7HpXvTHmWQGUf/na9jjWlWJHCJYOWzkA1P5HBJqrIEA=="], + "@opencode/core/@opencode/pty": ["@opencode/pty@0.5.0", "", { "optionalDependencies": { "@opencode/pty-darwin-arm64": "0.5.0", "@opencode/pty-darwin-x64": "0.5.0", "@opencode/pty-linux-arm64-gnu": "0.5.0", "@opencode/pty-linux-arm64-musl": "0.5.0", "@opencode/pty-linux-x64-gnu": "0.5.0", "@opencode/pty-linux-x64-musl": "0.5.0", "@opencode/pty-win32-arm64": "0.5.0", "@opencode/pty-win32-x64": "0.5.0" }, "bin": { "opencode-pty": "bin/opencode-pty.js" } }, "sha512-2U0RfT5U1lp1BcegXLoSBYfBx9sBNw3uJ/pao4UWdNV6UDfmDNGzdc8m4K1Q4ByBkXhbh8hexa0JS7HZ0vSsgg=="], "@opencode/gui-plugins/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=="], + "@opencode/legacy/wrangler": ["wrangler@4.156.2", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.5.0", "@cloudflare/unenv-preset": "2.16.2", "@cspotcode/source-map-support": "0.8.1", "blake3-wasm": "2.1.5", "esbuild": "0.28.2", "miniflare": "5.20261102.0-beta", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20261102.1" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@cloudflare/workers-types": "^5.20261102.1" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js", "cf-wrangler": "bin/cf-wrangler.js" } }, "sha512-3RKI10rRqDHlqLFeCgCOmuPzoXw8npyGZbixYB5Vj5RW9jWPoSrupo8CzxCSkw1nVdvpzlFaRrHFjh4+AMt8Cw=="], + "@opencode/plugin/@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="], "@opencode/plugin/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=="], "@opencode/plugin/vite-plugin-solid": ["vite-plugin-solid@2.11.10", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Yr1dQybmtDtDAHkii6hXuc1oVH9CPcS/Zb2jN/P36qqcrkNnVPsMTzQ06jyzFPFjj3U1IYKMVt/9ZqcwGCEbjw=="], + "@opencode/server/@opencode/pty": ["@opencode/pty@0.5.0", "", { "optionalDependencies": { "@opencode/pty-darwin-arm64": "0.5.0", "@opencode/pty-darwin-x64": "0.5.0", "@opencode/pty-linux-arm64-gnu": "0.5.0", "@opencode/pty-linux-arm64-musl": "0.5.0", "@opencode/pty-linux-x64-gnu": "0.5.0", "@opencode/pty-linux-x64-musl": "0.5.0", "@opencode/pty-win32-arm64": "0.5.0", "@opencode/pty-win32-x64": "0.5.0" }, "bin": { "opencode-pty": "bin/opencode-pty.js" } }, "sha512-2U0RfT5U1lp1BcegXLoSBYfBx9sBNw3uJ/pao4UWdNV6UDfmDNGzdc8m4K1Q4ByBkXhbh8hexa0JS7HZ0vSsgg=="], + "@opencode/session-ui/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=="], "@opencode/session-ui/vite-plugin-solid": ["vite-plugin-solid@2.11.10", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Yr1dQybmtDtDAHkii6hXuc1oVH9CPcS/Zb2jN/P36qqcrkNnVPsMTzQ06jyzFPFjj3U1IYKMVt/9ZqcwGCEbjw=="], + "@opencode/site/@types/react": ["@types/react@19.3.0", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg=="], + "@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=="], @@ -5021,7 +4600,7 @@ "@opencode/update/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], - "@opencode/web/@astrojs/check": ["@astrojs/check@0.9.11", "", { "dependencies": { "@astrojs/language-server": "^2.17.2", "chokidar": "^5.0.0", "kleur": "^4.1.5", "yargs": "^18.2.0" }, "peerDependencies": { "typescript": "^5.0.0 || ^6.0.0" }, "bin": { "astro-check": "./bin/astro-check.js" } }, "sha512-TcDC2KT3t0XHFv/geBsA02/HuVXuzLwAfAzLPG2FvBW/DL3tzxu2voVaqcKSN56dN2DNlYC/3FKrmxrDs6actg=="], + "@opencode/update/yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="], "@opentelemetry/api-logs/@opentelemetry/api": ["@opentelemetry/api@1.9.1", "", {}, "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q=="], @@ -5037,6 +4616,8 @@ "@opentui/solid/babel-preset-solid": ["babel-preset-solid@1.9.16", "", { "dependencies": { "babel-plugin-jsx-dom-expressions": "^0.40.11" }, "peerDependencies": { "@babel/core": "^7.0.0", "solid-js": "^1.9.16" }, "optionalPeers": ["solid-js"] }, "sha512-+0h40Qk2oBfkQ4OGDBHIDtvq/XQiOnCfzjNHmMxriAr8MmdsaIbyJgqYglDs4d70sF8O08sSpx61TKdpUt3oRw=="], + "@oxc-parser/binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="], + "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], "@pierre/diffs/@pierre/theming": ["@pierre/theming@1.0.2", "", { "peerDependencies": { "@pierre/theme": "^1.1.0 || ^2.0.0", "@shikijs/themes": "^3.0.0 || ^4.0.0", "react": "^18.3.1 || ^19.0.0", "react-dom": "^18.3.1 || ^19.0.0", "shiki": "^3.0.0 || ^4.0.0" }, "optionalPeers": ["@pierre/theme", "@shikijs/themes", "react", "react-dom", "shiki"] }, "sha512-RmXLLqtx31UGcR8kZyO5hGAQ1EXz6loT1Cu0BFAGsbnBboIxp2BlomkLfWyvdT4WZXnBGyu25onL1gKpFQuSUw=="], @@ -5057,6 +4638,8 @@ "@sentry/cli/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "@sentry/cli/node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], + "@sentry/cli/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "@sentry/node/@opentelemetry/api": ["@opentelemetry/api@1.9.1", "", {}, "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q=="], @@ -5071,6 +4654,8 @@ "@sentry/server-utils/@sentry/core": ["@sentry/core@10.73.0", "", { "dependencies": { "@sentry/conventions": "^0.16.0" } }, "sha512-FLO1UgH19RyasVpofu612WCOgb2nEH0dZy+R72d7p65XU9i0wxlMKm3+sgfwKmiSJp1Qhilaaxs4Jg6BbiM5HA=="], + "@shuding/opentype.js/fflate": ["fflate@0.7.3", "", {}, "sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw=="], + "@solidjs/start/path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="], "@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="], @@ -5087,9 +4672,9 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@vscode/emmet-helper/jsonc-parser": ["jsonc-parser@2.3.1", "", {}, "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg=="], + "@textjs/app/@vitejs/plugin-react": ["@vitejs/plugin-react@4.7.0", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA=="], - "anymatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], + "@textjs/app/vite": ["vite@6.4.5", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "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-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg=="], "app-builder-lib/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=="], @@ -5097,30 +4682,6 @@ "app-builder-lib/which": ["which@5.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ=="], - "astro/@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.12.0", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.8.0", "unified": "^11.0.5", "yaml": "^2.9.1" } }, "sha512-pKPuwCDtO0L7zgmt1JGd9X4Aes1+0SX3IEBSqBNPHsScYdPMlfmed3Y7DTbXyF7E+8ylnb563o/0OzGQPOFehw=="], - - "astro/@clack/prompts": ["@clack/prompts@1.8.1", "", { "dependencies": { "@clack/core": "1.5.1", "fast-string-width": "^3.0.2", "fast-wrap-ansi": "^0.2.0", "sisteransi": "^1.0.5" } }, "sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ=="], - - "astro/ci-info": ["ci-info@4.4.0", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="], - - "astro/diff": ["diff@9.0.0", "", {}, "sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw=="], - - "astro/es-module-lexer": ["es-module-lexer@3.0.4", "", {}, "sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA=="], - - "astro/get-tsconfig": ["get-tsconfig@5.0.0-beta.6", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-X6fBC0pmImC70gvX2zm56go9hx0MyoGVdG0tUCkg/D+Xnh5TJsOZ7iDbOdI3PvmtrDxnu1YdDufpK2QJX1Meqw=="], - - "astro/magic-string": ["magic-string@1.4.3", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ=="], - - "astro/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - - "astro/rolldown": ["rolldown@1.2.14", "", { "dependencies": { "@oxc-project/types": "=0.154.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.14", "@rolldown/binding-android-arm64": "1.2.14", "@rolldown/binding-darwin-arm64": "1.2.14", "@rolldown/binding-darwin-x64": "1.2.14", "@rolldown/binding-freebsd-x64": "1.2.14", "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", "@rolldown/binding-linux-arm64-gnu": "1.2.14", "@rolldown/binding-linux-arm64-musl": "1.2.14", "@rolldown/binding-linux-ppc64-gnu": "1.2.14", "@rolldown/binding-linux-s390x-gnu": "1.2.14", "@rolldown/binding-linux-x64-gnu": "1.2.14", "@rolldown/binding-linux-x64-musl": "1.2.14", "@rolldown/binding-openharmony-arm64": "1.2.14", "@rolldown/binding-win32-arm64-msvc": "1.2.14", "@rolldown/binding-win32-x64-msvc": "1.2.14" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw=="], - - "astro/unstorage": ["unstorage@1.17.5", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.10", "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg=="], - - "astro/vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.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", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], - - "astro/yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="], - "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=="], @@ -5141,14 +4702,12 @@ "commonmark/entities": ["entities@3.0.1", "", {}, "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q=="], - "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + "cross-fetch/node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], - "csso/css-tree": ["css-tree@2.2.1", "", { "dependencies": { "mdn-data": "2.0.28", "source-map-js": "^1.0.1" } }, "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA=="], + "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "dir-compare/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], - "dir-compare/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], - "dmg-builder/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=="], "dom-serializer/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], @@ -5157,8 +4716,6 @@ "electron-builder/ci-info": ["ci-info@4.4.0", "", {}, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="], - "electron-publish/mime": ["mime@2.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg=="], - "electron-updater/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=="], "electron-updater/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], @@ -5175,8 +4732,6 @@ "express/cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="], - "fetch-blob/web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], - "ffi-rs/@yuuang/ffi-rs-darwin-arm64": ["@yuuang/ffi-rs-darwin-arm64@1.3.7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-OueBlUFBT9IwD9pQnoYs0UszRBEySskfrEPXXfvKfGjL/DXnfn6kUheQ3oIP6sSmshVGNQUwrTCPo6feAa4QjA=="], "ffi-rs/@yuuang/ffi-rs-linux-arm64-gnu": ["@yuuang/ffi-rs-linux-arm64-gnu@1.3.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-nrW4MlFlyQInfxTsI5wtcIpbV4KlHLWo2BCk4CHIETlUT+PUspNFqDg+Byy7My3hpCZlXp0WsMVP/3N0LlybNw=="], @@ -5193,8 +4748,6 @@ "form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "gaxios/node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], - "gcp-metadata/gaxios": ["gaxios@7.1.3", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2", "rimraf": "^5.0.1" } }, "sha512-YGGyuEdVIjqxkxVH1pUTMY/XtmmsApXrCVv5EU25iX6inEPbV+VakJfLealkBtJN69AQmh1eGOdCl9Sm1UP6XQ=="], "gcp-metadata/google-logging-utils": ["google-logging-utils@1.1.3", "", {}, "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA=="], @@ -5211,23 +4764,27 @@ "htmlparser2/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], - "is-inside-container/is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="], - "is-wsl/is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="], + "js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + "lighthouse/devtools-protocol": ["devtools-protocol@0.0.1663043", "", {}, "sha512-33aOY3ZnBP1dgZsshgaL+/XlsQleiFZgyUaDtdZkEa1nbZhVY1MoDeWjk+wxg25fU924l1ZJfoGNmjjeA/5s1w=="], "lighthouse/ws": ["ws@7.5.13", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-rsKI6xDBFVf4r/x8XyChGK04QR/XHroxs/jUcoWvtEZM8TPU/X/uIY9B1CsSzYws9ZJb/6bbBu7dPhFW00CAoA=="], + "linebreak/base64-js": ["base64-js@0.0.8", "", {}, "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw=="], + "mdast-util-find-and-replace/escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="], "micromark-extension-mdxjs/acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], "micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], - "miniflare/sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], + "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/undici": ["undici@7.28.0", "", {}, "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA=="], + "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=="], @@ -5239,18 +4796,10 @@ "node-gyp/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], - "node-html-parser/css-select": ["css-select@5.2.2", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", "domhandler": "^5.0.2", "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw=="], - "npm-package-arg/hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="], - "openid-client/jose": ["jose@4.15.9", "", {}, "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA=="], - - "openid-client/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], - "oxc-parser/@oxc-project/types": ["@oxc-project/types@0.141.0", "", {}, "sha512-S4as7z0j0xQkXcJlyY5ehntwK8/wRkQb9Cyqw+J/N2rkWGQGK0SxD6X6DhQTc7qsxVTBxXbxZtBJh3mr3PtIzQ=="], - "p-locate/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], - "parse-entities/@types/unist": ["@types/unist@2.0.11", "", {}, "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="], "parse5/entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], @@ -5261,7 +4810,7 @@ "playwright/fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="], - "postcss-nested/postcss-selector-parser": ["postcss-selector-parser@6.1.5", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-TEHFzb5KRDKaOgJ4TYE+0jyJtFbjLvkdVOu0fZ2b6MTWzoqZd4Le+61aEppWkvTlYePgOX4ATL1wsAIPMLTw6Q=="], + "playwright/playwright-core": ["playwright-core@1.60.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA=="], "postject/commander": ["commander@9.5.0", "", {}, "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="], @@ -5269,6 +4818,10 @@ "puppeteer-core/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="], + "react-dom/scheduler": ["scheduler@0.28.0", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="], + + "react-reconciler/scheduler": ["scheduler@0.28.0", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="], + "readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], "rimraf/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], @@ -5281,6 +4834,8 @@ "safe-push-apply/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="], + "satori/fflate": ["fflate@0.7.3", "", {}, "sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw=="], + "serialize-error/type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="], "slice-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], @@ -5293,10 +4848,6 @@ "source-map-support/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], - "sst/aws4fetch": ["aws4fetch@1.0.18", "", {}, "sha512-3Cf+YaUl07p24MoQ46rFwulAmiyCwH2+1zw1ZyPAX5OtJ34Hh185DwB8y/qRLb6cYYYtSFJ9pthyLc0MD4e8sQ=="], - - "sst/jose": ["jose@5.2.3", "", {}, "sha512-KUXdbctm1uHVL8BYhnyHkgp3zDX5KW8ZhAKVFEfUbU2P8Alpzjb+48hHvjOdQIyPshoblhzsuqOwEEAbtHVirA=="], - "string-width-cjs/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "string-width-cjs/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], @@ -5305,8 +4856,6 @@ "strip-ansi-cjs/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "svgo/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], - "temp/rimraf": ["rimraf@2.6.3", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "./bin.js" } }, "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA=="], "tempy/type-fest": ["type-fest@0.16.0", "", {}, "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg=="], @@ -5329,14 +4878,6 @@ "vite-plugin-icons-spritesheet/glob": ["glob@11.1.0", "", { "dependencies": { "foreground-child": "^3.3.1", "jackspeak": "^4.1.1", "minimatch": "^10.1.1", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw=="], - "vite-plugin-icons-spritesheet/tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], - - "vscode-languageserver/vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.17.5", "", { "dependencies": { "vscode-jsonrpc": "8.2.0", "vscode-languageserver-types": "3.17.5" } }, "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg=="], - - "vscode-languageserver-protocol/vscode-jsonrpc": ["vscode-jsonrpc@9.0.1", "", {}, "sha512-rfuA6T75H6m5EkbhtEPzre9pT0HPcDI2MMy4+nPFIBks5J8JBAUHD4tRYSgaBOijIEC7SRkC1kKyXTLqbmh9jw=="], - - "vscode-languageserver-protocol/vscode-languageserver-types": ["vscode-languageserver-types@3.18.0", "", {}, "sha512-8TsGPNMIMiiBdkORgRSvLjuiEIiAFtO+KssmYWxQ+uSVvlf7RjK8YKCOjPzZ+YA04jXEV7+7LvkSmHkhpNS99g=="], - "which-builtin-type/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="], "workbox-build/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], @@ -5349,6 +4890,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=="], + "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=="], "wrap-ansi/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], @@ -5363,81 +4906,29 @@ "wsl-utils/powershell-utils": ["powershell-utils@0.1.0", "", {}, "sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A=="], - "yaml-language-server/prettier": ["prettier@3.9.6", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g=="], - - "yaml-language-server/request-light": ["request-light@0.5.8", "", {}, "sha512-3Zjgh+8b5fhRJBQZoy+zbVKpAQGLyka0MPgW3zruTF4dFFJ8Fqcfu9YsAvi/rvdcaTeWG3MkbZv4WKxAn/84Lg=="], - - "yaml-language-server/yaml": ["yaml@2.8.3", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg=="], - "yargs/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=="], - "youch/cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="], - "youch-core/error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="], - "@astrojs/astro2tsx/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], - - "@astrojs/compiler-binding-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], - - "@astrojs/internal-helpers/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - - "@astrojs/markdown-remark/@astrojs/internal-helpers/yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], - - "@astrojs/markdown-satteri/@astrojs/internal-helpers/yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-darwin-arm64": ["@bruits/satteri-darwin-arm64@0.10.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-27KTVl4TJkVahMy/ohyA7qd4938G5UNneFUz/PsScYfpIhj0IVAS23mpcJXdPF44sa6nva198lmV/cKIb2YPyA=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-darwin-x64": ["@bruits/satteri-darwin-x64@0.10.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-IjnLe3nKspq6qaeqGgjT7MT8VrTV74yWRlaag7ZdNsI8TDAYZ0iPxMCo+9KQZHUk5EyVB+reBI/PFWL5KuFw9Q=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-arm64-gnu": ["@bruits/satteri-linux-arm64-gnu@0.10.5", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-glkYXZCJywjP13v67eAyAMSJdF+ncvEbYvgi/wOtffL9tQ27lr/zsyzUfgs+ovjJ9d8JNQKiXeiArJcX8PJL9w=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-arm64-musl": ["@bruits/satteri-linux-arm64-musl@0.10.5", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-yWdgG1g17Nh2QyGVlFUxGRa3FEFwiMcpZEyMNWkbM3deC94cmVc+/i9OuyFpdKuWo3GkgoCtYVOoxk1uCnCZIA=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-x64-gnu": ["@bruits/satteri-linux-x64-gnu@0.10.5", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-FVaLoPT1fBgGl0J+AYebyyXJYBachGl8Oyyrf1lye4RTqCB4S0Gwkj1uM9RJyThUOvx5VUmAT1CnNh1SFHA+kw=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-x64-musl": ["@bruits/satteri-linux-x64-musl@0.10.5", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-EHpVAx2bqW3GINHTKkljtxVfQmVDGWIuwOYOP5YghTj+0PkBa2o8oKPRtQ9Kbsr1Fye8jtUcDjhwj2jMNugZKg=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi": ["@bruits/satteri-wasm32-wasi@0.10.5", "", { "dependencies": { "@emnapi/core": "1.11.1", "@emnapi/runtime": "1.11.1", "@napi-rs/wasm-runtime": "^1.2.3" }, "cpu": "none" }, "sha512-ypz8c/Zmipxp4IoeDa228Gstv6TLzVmNs3yC6wKCoNSOjx1iwpgzu87Y3hTkXFdwChVGU85qeUDuOIarGUZQLw=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-win32-arm64-msvc": ["@bruits/satteri-win32-arm64-msvc@0.10.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-siTV88nb0LRqNpkL2gXboqCwVdq95sLtzMHS1/3eONV2gLbB3NAK46wmSMvCO/yquBvI2lvaFIfd8P12ecsxBw=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-win32-x64-msvc": ["@bruits/satteri-win32-x64-msvc@0.10.5", "", { "os": "win32", "cpu": "x64" }, "sha512-C3IfPvfvMXmlzBxaMPKFS1XiuV9pu2mC7YqkPk7PSvTgPZ8gbdASIpHpztDLvTTQjqZ0z1Ol8tK5X+V6XXC0wQ=="], - - "@astrojs/mdx/@astrojs/internal-helpers/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=="], - - "@astrojs/solid-js/vite/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - - "@astrojs/solid-js/vite/postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], - - "@astrojs/solid-js/vite/rolldown": ["rolldown@1.2.14", "", { "dependencies": { "@oxc-project/types": "=0.154.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.14", "@rolldown/binding-android-arm64": "1.2.14", "@rolldown/binding-darwin-arm64": "1.2.14", "@rolldown/binding-darwin-x64": "1.2.14", "@rolldown/binding-freebsd-x64": "1.2.14", "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", "@rolldown/binding-linux-arm64-gnu": "1.2.14", "@rolldown/binding-linux-arm64-musl": "1.2.14", "@rolldown/binding-linux-ppc64-gnu": "1.2.14", "@rolldown/binding-linux-s390x-gnu": "1.2.14", "@rolldown/binding-linux-x64-gnu": "1.2.14", "@rolldown/binding-linux-x64-musl": "1.2.14", "@rolldown/binding-openharmony-arm64": "1.2.14", "@rolldown/binding-win32-arm64-msvc": "1.2.14", "@rolldown/binding-win32-x64-msvc": "1.2.14" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.10.4", "", { "dependencies": { "@types/hast": "^3.0.4", "@types/mdast": "^4.0.4", "js-yaml": "^4.3.0", "picomatch": "^4.0.4", "retext-smartypants": "^6.2.0", "shiki": "^4.0.2", "smol-toml": "^1.6.0", "unified": "^11.0.5" } }, "sha512-nozZSy/mKYLqe4YrqbKtdOszedAfXYCtw3wZ0d+CAjz4GqQ4L9rl1ltIL5BlgwmYVinJg/RZ0MgGuWOdlyRZlA=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri": ["satteri@0.10.5", "", { "dependencies": { "@types/estree-jsx": "^1.0.5", "@types/hast": "^3.0.5", "@types/mdast": "^4.0.4", "@types/unist": "^3.0.3" }, "optionalDependencies": { "@bruits/satteri-darwin-arm64": "0.10.5", "@bruits/satteri-darwin-x64": "0.10.5", "@bruits/satteri-linux-arm64-gnu": "0.10.5", "@bruits/satteri-linux-arm64-musl": "0.10.5", "@bruits/satteri-linux-x64-gnu": "0.10.5", "@bruits/satteri-linux-x64-musl": "0.10.5", "@bruits/satteri-wasm32-wasi": "0.10.5", "@bruits/satteri-win32-arm64-msvc": "0.10.5", "@bruits/satteri-win32-x64-msvc": "0.10.5" } }, "sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ=="], - - "@astrojs/starlight/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], - "@cloudflare/vite-plugin/miniflare/sharp": ["sharp@0.35.2", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.4" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.2", "@img/sharp-darwin-x64": "0.35.2", "@img/sharp-freebsd-wasm32": "0.35.2", "@img/sharp-libvips-darwin-arm64": "1.3.1", "@img/sharp-libvips-darwin-x64": "1.3.1", "@img/sharp-libvips-linux-arm": "1.3.1", "@img/sharp-libvips-linux-arm64": "1.3.1", "@img/sharp-libvips-linux-ppc64": "1.3.1", "@img/sharp-libvips-linux-riscv64": "1.3.1", "@img/sharp-libvips-linux-s390x": "1.3.1", "@img/sharp-libvips-linux-x64": "1.3.1", "@img/sharp-libvips-linuxmusl-arm64": "1.3.1", "@img/sharp-libvips-linuxmusl-x64": "1.3.1", "@img/sharp-linux-arm": "0.35.2", "@img/sharp-linux-arm64": "0.35.2", "@img/sharp-linux-ppc64": "0.35.2", "@img/sharp-linux-riscv64": "0.35.2", "@img/sharp-linux-s390x": "0.35.2", "@img/sharp-linux-x64": "0.35.2", "@img/sharp-linuxmusl-arm64": "0.35.2", "@img/sharp-linuxmusl-x64": "0.35.2", "@img/sharp-webcontainers-wasm32": "0.35.2", "@img/sharp-win32-arm64": "0.35.2", "@img/sharp-win32-ia32": "0.35.2", "@img/sharp-win32-x64": "0.35.2" } }, "sha512-FVtFjtBCMiJS6yb5CX7Sop45WFMpeGw6oRKuJnXYgf/f1ms/D7LE/ZUSNxnW7rZ/dbslQWYkoqFHGPaDBtaK4w=="], - - "@cloudflare/vite-plugin/miniflare/undici": ["undici@7.29.0", "", {}, "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260811.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-i5jqz+ywtOefr0AJbiAc8qxBLfSim/B0WJG7aW3B+pWnoVfMJdUQvi+BWcFKZJ0MoCci3KadTx6g31VfuEEqpQ=="], + "@cloudflare/runtime-types/miniflare/undici": ["undici@7.29.1", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="], - "@cloudflare/vite-plugin/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20260811.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-NoOUM/nvaDdm2Onlnz33FikWjtatzulNtvwvy4xs0IrHaTCHwC0c8NwIt6s+AI13FkDs02/vm2I3GTPLCT9+hQ=="], + "@cloudflare/runtime-types/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20261001.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-4cgSgDf28JSw/P5Dj5GCS59hzVqS5XnmGAWNkvYHLI6ODU9idGaMMNEuhJXDkEG/lsABmlVlnCgsdh2VbKWepw=="], - "@cloudflare/vite-plugin/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20260811.1", "", { "os": "linux", "cpu": "x64" }, "sha512-sdYq2jL1AD1supa3fsi5O4zTB28wSjvTHj7Migh6/ts8EROPdvrSwv+rdGHhv8HJNAz/wbIAY3wZsi1Rw4uUIg=="], + "@cloudflare/runtime-types/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20261001.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-8ulAWruEVouNmEIsQsy9WSSCS9zkLu93W2MTwp5esiFyoPp05BNSVFIFsYSPi1pkFmBBd7fsnwMpbLkaJLaVPQ=="], - "@cloudflare/vite-plugin/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20260811.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-RIRv4shbu1kg05sD+DHTpSFCNnb5Dl2SkPDMUykqZa508tkPqe7VVw7gO0Q5msTBGyL0FfFrLuRxwwfA8u5Sow=="], + "@cloudflare/runtime-types/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20261001.1", "", { "os": "linux", "cpu": "x64" }, "sha512-kZbTZJGrhsMOdqZ2BIybjaBRLZjYsRLWj7mcNw/6Y3hodOhp5MrNzcz4iWGwNVWwyIV+7Pl+/LX5VcgnRqdHOg=="], - "@cloudflare/vite-plugin/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20260811.1", "", { "os": "win32", "cpu": "x64" }, "sha512-g6VquwjASlYAibcNW/0E6Zszht4qLkmnXOGwIjjRHl2A0Qz48kVeMcGvyH6eA0G9U3OzZojjYFpP+YeyQmmdjw=="], + "@cloudflare/runtime-types/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20261001.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-oOk3Zj6k/8oP0FJgZBWDn7+BqbsqIMEMaV95pulHPVbwVu4wYoLfQq2hp0vkbCNsCFLqZb7cqixXdrwD54ZIow=="], - "@cloudflare/vite-plugin/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=="], + "@cloudflare/runtime-types/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261001.1", "", { "os": "win32", "cpu": "x64" }, "sha512-uRxm5W4VyBkoSaoP1BfOuH0873tE+vxsknF4sab6/5YIRvIAufChq3QDp+zlAn67PuGPGcn7W8QraA0t4ucmOQ=="], "@electron/asar/minimatch/brace-expansion": ["brace-expansion@1.1.21", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw=="], @@ -5447,12 +4938,6 @@ "@electron/universal/minimatch/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="], - "@expressive-code/core/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], - - "@img/sharp-freebsd-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - - "@img/sharp-webcontainers-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - "@octokit/auth-oauth-app/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@28.0.0", "", {}, "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ=="], "@octokit/auth-oauth-device/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@28.0.0", "", {}, "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ=="], @@ -5475,27 +4960,51 @@ "@octokit/request/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@28.0.0", "", {}, "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ=="], - "@opencode/console-app/wrangler/@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.4.0", "", { "dependencies": { "mime": "^3.0.0" } }, "sha512-+tv3z+SPp+gqTIcImN9o0hqE9xyfQjI1XD9pL6NuKjua9B1y7mNYv0S9cP+QEbA4ppVgGZEmKOvHX5G5Ei1CVA=="], + "@opencode/core/@opencode/pty/@opencode/pty-darwin-arm64": ["@opencode/pty-darwin-arm64@0.5.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-D+L/TnNUc35airWTBlLussnuDbZpKPQ2/uBHVkcycw6KrLYDb4hVoUJn8N5PXmLTnhmU64B4MUsdH9JoOZIi8w=="], - "@opencode/console-app/wrangler/@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.7.11", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": "^1.20251106.1" }, "optionalPeers": ["workerd"] }, "sha512-se23f1D4PxKrMKOq+Stz+Yn7AJ9ITHcEecXo2Yjb+UgbUDCEBch1FXQC6hx6uT5fNA3kmX3mfzeZiUmpK1W9IQ=="], + "@opencode/core/@opencode/pty/@opencode/pty-darwin-x64": ["@opencode/pty-darwin-x64@0.5.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-/JMtOIAY9WWszsauWnCwjl2Qr8PBihS94tLsxa8prZBVhbbpOzcFslQsqR8JnJ1gAVlYINxEVS79+QQPQ4NC9g=="], - "@opencode/console-app/wrangler/esbuild": ["esbuild@0.25.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.4", "@esbuild/android-arm": "0.25.4", "@esbuild/android-arm64": "0.25.4", "@esbuild/android-x64": "0.25.4", "@esbuild/darwin-arm64": "0.25.4", "@esbuild/darwin-x64": "0.25.4", "@esbuild/freebsd-arm64": "0.25.4", "@esbuild/freebsd-x64": "0.25.4", "@esbuild/linux-arm": "0.25.4", "@esbuild/linux-arm64": "0.25.4", "@esbuild/linux-ia32": "0.25.4", "@esbuild/linux-loong64": "0.25.4", "@esbuild/linux-mips64el": "0.25.4", "@esbuild/linux-ppc64": "0.25.4", "@esbuild/linux-riscv64": "0.25.4", "@esbuild/linux-s390x": "0.25.4", "@esbuild/linux-x64": "0.25.4", "@esbuild/netbsd-arm64": "0.25.4", "@esbuild/netbsd-x64": "0.25.4", "@esbuild/openbsd-arm64": "0.25.4", "@esbuild/openbsd-x64": "0.25.4", "@esbuild/sunos-x64": "0.25.4", "@esbuild/win32-arm64": "0.25.4", "@esbuild/win32-ia32": "0.25.4", "@esbuild/win32-x64": "0.25.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q=="], + "@opencode/core/@opencode/pty/@opencode/pty-linux-arm64-gnu": ["@opencode/pty-linux-arm64-gnu@0.5.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-vNiHKopfKrX6vj8OmDXYxZ+5JEZwf5djDzt3LOqeYuwStQRX2rxcl2/zjrvd5i8rAJw30RpJ+PTdS1t08vqtLA=="], - "@opencode/console-app/wrangler/miniflare": ["miniflare@4.20251118.1", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "acorn": "8.14.0", "acorn-walk": "8.3.2", "exit-hook": "2.2.1", "glob-to-regexp": "0.4.1", "sharp": "^0.33.5", "stoppable": "1.1.0", "undici": "7.14.0", "workerd": "1.20251118.0", "ws": "8.18.0", "youch": "4.1.0-beta.10", "zod": "3.22.3" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-uLSAE/DvOm392fiaig4LOaatxLjM7xzIniFRG5Y3yF9IduOYLLK/pkCPQNCgKQH3ou0YJRHnTN+09LPfqYNTQQ=="], + "@opencode/core/@opencode/pty/@opencode/pty-linux-arm64-musl": ["@opencode/pty-linux-arm64-musl@0.5.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-aW3lNGjit3FNAfpEskJgvTrtE2Lfnukpn8KmUVPUBN/EbRhT56h/N3ghzHYc5jIExETy06Xpy9i2xZxZQy0McQ=="], - "@opencode/console-app/wrangler/workerd": ["workerd@1.20251118.0", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20251118.0", "@cloudflare/workerd-darwin-arm64": "1.20251118.0", "@cloudflare/workerd-linux-64": "1.20251118.0", "@cloudflare/workerd-linux-arm64": "1.20251118.0", "@cloudflare/workerd-windows-64": "1.20251118.0" }, "bin": { "workerd": "bin/workerd" } }, "sha512-Om5ns0Lyx/LKtYI04IV0bjIrkBgoFNg0p6urzr2asekJlfP18RqFzyqMFZKf0i9Gnjtz/JfAS/Ol6tjCe5JJsQ=="], + "@opencode/core/@opencode/pty/@opencode/pty-linux-x64-gnu": ["@opencode/pty-linux-x64-gnu@0.5.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-XaMnBSh1QvJmcYKSOtx1fVvldZ+x212zAHaq8ovyafufqp6/Xl3AuqPCXwPFnycW2PfbUDwfZ7dBCXThQtOt3Q=="], - "@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/core/@opencode/pty/@opencode/pty-linux-x64-musl": ["@opencode/pty-linux-x64-musl@0.5.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-30LVc91GrJP8YD6chLic4+5nMsLz3hCYu2cxPQczSKyRWMyBjuwvCf040UzlRAQiGllp8KBb7nYa8SCtq2/49Q=="], - "@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=="], + "@opencode/core/@opencode/pty/@opencode/pty-win32-arm64": ["@opencode/pty-win32-arm64@0.5.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-BYVSytysZvXmIQcP9VbbXbOV417RLW/BATiAK8MMbHBF6fzqQlpAMTi4cQmWJKOlHgrREKeMBw786qZ8BES3Vg=="], - "@opencode/stories/@tailwindcss/vite/tailwindcss": ["tailwindcss@4.1.11", "", {}, "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA=="], + "@opencode/core/@opencode/pty/@opencode/pty-win32-x64": ["@opencode/pty-win32-x64@0.5.0", "", { "os": "win32", "cpu": "x64" }, "sha512-42OEc6vvlL/gXAairdWf4DLX6juPrpOycES9sp3iE3UfQ5KsRsuQ6F3HFFmSBkiZ/yUhJtKoJdJbquBTNEL+Ow=="], + + "@opencode/legacy/wrangler/@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.16.2", "", { "peerDependencies": { "unenv": "2.0.0-rc.24", "workerd": ">1.20260305.0 <2.0.0-0" }, "optionalPeers": ["workerd"] }, "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ=="], + + "@opencode/legacy/wrangler/esbuild": ["esbuild@0.28.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.28.2", "@esbuild/android-arm": "0.28.2", "@esbuild/android-arm64": "0.28.2", "@esbuild/android-x64": "0.28.2", "@esbuild/darwin-arm64": "0.28.2", "@esbuild/darwin-x64": "0.28.2", "@esbuild/freebsd-arm64": "0.28.2", "@esbuild/freebsd-x64": "0.28.2", "@esbuild/linux-arm": "0.28.2", "@esbuild/linux-arm64": "0.28.2", "@esbuild/linux-ia32": "0.28.2", "@esbuild/linux-loong64": "0.28.2", "@esbuild/linux-mips64el": "0.28.2", "@esbuild/linux-ppc64": "0.28.2", "@esbuild/linux-riscv64": "0.28.2", "@esbuild/linux-s390x": "0.28.2", "@esbuild/linux-x64": "0.28.2", "@esbuild/netbsd-arm64": "0.28.2", "@esbuild/netbsd-x64": "0.28.2", "@esbuild/openbsd-arm64": "0.28.2", "@esbuild/openbsd-x64": "0.28.2", "@esbuild/openharmony-arm64": "0.28.2", "@esbuild/sunos-x64": "0.28.2", "@esbuild/win32-arm64": "0.28.2", "@esbuild/win32-ia32": "0.28.2", "@esbuild/win32-x64": "0.28.2" }, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA=="], + + "@opencode/legacy/wrangler/miniflare": ["miniflare@5.20261102.0-beta", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.5", "undici": "7.30.1", "workerd": "1.20261102.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-FGqoi2BF7Vq6v8aSraq9Tmhg8ORpUBC5RkNGhfa11J597cWlLJ5QP9vJwDMOzwJx+W4U+IuHWSidVceBK6VRZQ=="], + + "@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/server/@opencode/pty/@opencode/pty-darwin-arm64": ["@opencode/pty-darwin-arm64@0.5.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-D+L/TnNUc35airWTBlLussnuDbZpKPQ2/uBHVkcycw6KrLYDb4hVoUJn8N5PXmLTnhmU64B4MUsdH9JoOZIi8w=="], + + "@opencode/server/@opencode/pty/@opencode/pty-darwin-x64": ["@opencode/pty-darwin-x64@0.5.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-/JMtOIAY9WWszsauWnCwjl2Qr8PBihS94tLsxa8prZBVhbbpOzcFslQsqR8JnJ1gAVlYINxEVS79+QQPQ4NC9g=="], + + "@opencode/server/@opencode/pty/@opencode/pty-linux-arm64-gnu": ["@opencode/pty-linux-arm64-gnu@0.5.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-vNiHKopfKrX6vj8OmDXYxZ+5JEZwf5djDzt3LOqeYuwStQRX2rxcl2/zjrvd5i8rAJw30RpJ+PTdS1t08vqtLA=="], + + "@opencode/server/@opencode/pty/@opencode/pty-linux-arm64-musl": ["@opencode/pty-linux-arm64-musl@0.5.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-aW3lNGjit3FNAfpEskJgvTrtE2Lfnukpn8KmUVPUBN/EbRhT56h/N3ghzHYc5jIExETy06Xpy9i2xZxZQy0McQ=="], + + "@opencode/server/@opencode/pty/@opencode/pty-linux-x64-gnu": ["@opencode/pty-linux-x64-gnu@0.5.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-XaMnBSh1QvJmcYKSOtx1fVvldZ+x212zAHaq8ovyafufqp6/Xl3AuqPCXwPFnycW2PfbUDwfZ7dBCXThQtOt3Q=="], + + "@opencode/server/@opencode/pty/@opencode/pty-linux-x64-musl": ["@opencode/pty-linux-x64-musl@0.5.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-30LVc91GrJP8YD6chLic4+5nMsLz3hCYu2cxPQczSKyRWMyBjuwvCf040UzlRAQiGllp8KBb7nYa8SCtq2/49Q=="], - "@opencode/web/@astrojs/check/@astrojs/language-server": ["@astrojs/language-server@2.17.2", "", { "dependencies": { "@astrojs/astro2tsx": "^0.1.2", "@astrojs/yaml2ts": "^0.2.4", "@volar/kit": "~2.4.28", "@volar/language-core": "~2.4.28", "@volar/language-server": "~2.4.28", "@volar/language-service": "~2.4.28", "muggle-string": "^0.4.1", "tinyglobby": "^0.2.17", "volar-service-css": "0.0.71", "volar-service-emmet": "0.0.71", "volar-service-html": "0.0.71", "volar-service-prettier": "0.0.71", "volar-service-typescript": "0.0.71", "volar-service-typescript-twoslash-queries": "0.0.71", "volar-service-yaml": "0.0.71", "vscode-html-languageservice": "^5.6.2", "vscode-uri": "^3.2.0" }, "peerDependencies": { "prettier": "^3.0.0", "prettier-plugin-astro": ">=0.11.0" }, "optionalPeers": ["prettier", "prettier-plugin-astro"], "bin": { "astro-ls": "./bin/nodeServer.js" } }, "sha512-WzqCBYo0RtKrkPLPMnTz2+UOQPosaFhoG/PvoSyPIgBU0BKeS6qeaYv7Rscq7P1LxJdoN0VosQF2h2TZTsIGHg=="], + "@opencode/server/@opencode/pty/@opencode/pty-win32-arm64": ["@opencode/pty-win32-arm64@0.5.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-BYVSytysZvXmIQcP9VbbXbOV417RLW/BATiAK8MMbHBF6fzqQlpAMTi4cQmWJKOlHgrREKeMBw786qZ8BES3Vg=="], - "@opencode/web/@astrojs/check/chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], + "@opencode/server/@opencode/pty/@opencode/pty-win32-x64": ["@opencode/pty-win32-x64@0.5.0", "", { "os": "win32", "cpu": "x64" }, "sha512-42OEc6vvlL/gXAairdWf4DLX6juPrpOycES9sp3iE3UfQ5KsRsuQ6F3HFFmSBkiZ/yUhJtKoJdJbquBTNEL+Ow=="], - "@opencode/web/@astrojs/check/yargs": ["yargs@18.2.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-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w=="], + "@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=="], + + "@opencode/stories/@tailwindcss/vite/tailwindcss": ["tailwindcss@4.1.11", "", {}, "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA=="], "@opentelemetry/instrumentation/@opentelemetry/api-logs/@opentelemetry/api": ["@opentelemetry/api@1.9.1", "", {}, "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q=="], @@ -5537,55 +5046,13 @@ "@tailwindcss/node/lightningcss/lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="], - "app-builder-lib/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - - "app-builder-lib/which/isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="], - - "astro/@astrojs/internal-helpers/picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], - - "astro/@astrojs/internal-helpers/yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], - - "astro/@clack/prompts/@clack/core": ["@clack/core@1.5.1", "", { "dependencies": { "fast-wrap-ansi": "^0.2.0", "sisteransi": "^1.0.5" } }, "sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ=="], - - "astro/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="], + "@textjs/app/@vitejs/plugin-react/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.27", "", {}, "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA=="], - "astro/rolldown/@oxc-project/types": ["@oxc-project/types@0.154.0", "", {}, "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA=="], + "@textjs/app/vite/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "astro/rolldown/@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.14", "", { "os": "android", "cpu": "arm" }, "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg=="], + "@textjs/app/vite/postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], - "astro/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.14", "", { "os": "android", "cpu": "arm64" }, "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ=="], - - "astro/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.14", "", { "os": "darwin", "cpu": "arm64" }, "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw=="], - - "astro/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.14", "", { "os": "darwin", "cpu": "x64" }, "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA=="], - - "astro/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.14", "", { "os": "freebsd", "cpu": "x64" }, "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA=="], - - "astro/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.14", "", { "os": "linux", "cpu": "arm" }, "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg=="], - - "astro/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ=="], - - "astro/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg=="], - - "astro/rolldown/@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.14", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q=="], - - "astro/rolldown/@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.14", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A=="], - - "astro/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg=="], - - "astro/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg=="], - - "astro/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.14", "", { "os": "none", "cpu": "arm64" }, "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q=="], - - "astro/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.14", "", { "os": "win32", "cpu": "arm64" }, "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA=="], - - "astro/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.14", "", { "os": "win32", "cpu": "x64" }, "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ=="], - - "astro/unstorage/chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], - - "astro/unstorage/h3": ["h3@1.15.11", "", { "dependencies": { "cookie-es": "^1.2.3", "crossws": "^0.3.5", "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg=="], - - "astro/vite/postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], + "app-builder-lib/which/isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="], "babel-plugin-module-resolver/glob/minimatch": ["minimatch@8.0.7", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg=="], @@ -5593,24 +5060,14 @@ "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=="], - "builder-util/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - "cliui/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], "cliui/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], - "csso/css-tree/mdn-data": ["mdn-data@2.0.28", "", {}, "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g=="], - "dir-compare/minimatch/brace-expansion": ["brace-expansion@1.1.21", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw=="], - "dir-compare/p-limit/yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], - - "dmg-builder/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - - "electron-updater/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - "electron-winstaller/fs-extra/jsonfile": ["jsonfile@4.0.0", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="], "electron-winstaller/fs-extra/universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="], @@ -5625,55 +5082,63 @@ "form-data/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], - "gcp-metadata/gaxios/node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], - "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.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], + "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-darwin-x64": ["@img/sharp-darwin-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.2.4" }, "os": "darwin", "cpu": "x64" }, "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw=="], + "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-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g=="], + "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-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg=="], + "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-arm": ["@img/sharp-libvips-linux-arm@1.2.4", "", { "os": "linux", "cpu": "arm" }, "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A=="], + "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-arm64": ["@img/sharp-libvips-linux-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw=="], + "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-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.2.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA=="], + "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-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.2.4", "", { "os": "linux", "cpu": "none" }, "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA=="], + "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-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.2.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ=="], + "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-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw=="], + "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-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw=="], + "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-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg=="], + "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-arm": ["@img/sharp-linux-arm@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.2.4" }, "os": "linux", "cpu": "arm" }, "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw=="], + "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-arm64": ["@img/sharp-linux-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg=="], + "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-linux-ppc64": ["@img/sharp-linux-ppc64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.2.4" }, "os": "linux", "cpu": "ppc64" }, "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA=="], + "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-linux-riscv64": ["@img/sharp-linux-riscv64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.2.4" }, "os": "linux", "cpu": "none" }, "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw=="], + "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-linux-s390x": ["@img/sharp-linux-s390x@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.2.4" }, "os": "linux", "cpu": "s390x" }, "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg=="], + "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-linux-x64": ["@img/sharp-linux-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ=="], + "miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="], - "miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.2.4" }, "os": "linux", "cpu": "arm64" }, "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg=="], + "miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.4", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="], - "miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.2.4" }, "os": "linux", "cpu": "x64" }, "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q=="], + "miniflare/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20260930.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-wxKsfekWeev6xkjHEMx3x7nz6WfWOn1/scQ8geqWQhUm8qRl1ZRZhjnj+rucIMLhLhP9RGSYMZIjEm3AV0zwVQ=="], - "miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.34.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g=="], + "miniflare/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20260930.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cviPpheZGQ2H5X+Ctxd3wfxhksNrdyoNprjSgg3br2+psetKacjdEvK8CILdN/2GF+u1KOExvr45amSL6lgzGA=="], - "miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.34.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg=="], + "miniflare/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20260930.2", "", { "os": "linux", "cpu": "x64" }, "sha512-cwrJAC5y/avPd1OzGyhc5OvUUfPXBFc065TY5CjXp7Hb3dhiTx6JeB5Pc8L3G8L8M44HyAfRHSpoLtRr+SR3cQ=="], - "miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], + "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=="], @@ -5711,12 +5176,6 @@ "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=="], - "node-html-parser/css-select/css-what": ["css-what@6.2.2", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="], - - "openid-client/lru-cache/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - - "p-locate/p-limit/yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], - "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=="], @@ -5729,8 +5188,6 @@ "temp/rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], - "vscode-languageserver/vscode-languageserver-protocol/vscode-jsonrpc": ["vscode-jsonrpc@8.2.0", "", {}, "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA=="], - "wrangler/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.28.1", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ=="], "wrangler/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.28.1", "", { "os": "android", "cpu": "arm" }, "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ=="], @@ -5783,6 +5240,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=="], @@ -5795,243 +5254,121 @@ "yargs/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], - - "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], - - "@astrojs/mdx/@astrojs/internal-helpers/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - - "@astrojs/solid-js/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], - - "@astrojs/solid-js/vite/rolldown/@oxc-project/types": ["@oxc-project/types@0.154.0", "", {}, "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.14", "", { "os": "android", "cpu": "arm" }, "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.14", "", { "os": "android", "cpu": "arm64" }, "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.14", "", { "os": "darwin", "cpu": "arm64" }, "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.14", "", { "os": "darwin", "cpu": "x64" }, "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.14", "", { "os": "freebsd", "cpu": "x64" }, "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.14", "", { "os": "linux", "cpu": "arm" }, "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.14", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.14", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.14", "", { "os": "none", "cpu": "arm64" }, "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.14", "", { "os": "win32", "cpu": "arm64" }, "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA=="], - - "@astrojs/solid-js/vite/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.14", "", { "os": "win32", "cpu": "x64" }, "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/@astrojs/internal-helpers/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-darwin-arm64": ["@bruits/satteri-darwin-arm64@0.10.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-27KTVl4TJkVahMy/ohyA7qd4938G5UNneFUz/PsScYfpIhj0IVAS23mpcJXdPF44sa6nva198lmV/cKIb2YPyA=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-darwin-x64": ["@bruits/satteri-darwin-x64@0.10.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-IjnLe3nKspq6qaeqGgjT7MT8VrTV74yWRlaag7ZdNsI8TDAYZ0iPxMCo+9KQZHUk5EyVB+reBI/PFWL5KuFw9Q=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-arm64-gnu": ["@bruits/satteri-linux-arm64-gnu@0.10.5", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-glkYXZCJywjP13v67eAyAMSJdF+ncvEbYvgi/wOtffL9tQ27lr/zsyzUfgs+ovjJ9d8JNQKiXeiArJcX8PJL9w=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-arm64-musl": ["@bruits/satteri-linux-arm64-musl@0.10.5", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-yWdgG1g17Nh2QyGVlFUxGRa3FEFwiMcpZEyMNWkbM3deC94cmVc+/i9OuyFpdKuWo3GkgoCtYVOoxk1uCnCZIA=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-x64-gnu": ["@bruits/satteri-linux-x64-gnu@0.10.5", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-FVaLoPT1fBgGl0J+AYebyyXJYBachGl8Oyyrf1lye4RTqCB4S0Gwkj1uM9RJyThUOvx5VUmAT1CnNh1SFHA+kw=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-linux-x64-musl": ["@bruits/satteri-linux-x64-musl@0.10.5", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-EHpVAx2bqW3GINHTKkljtxVfQmVDGWIuwOYOP5YghTj+0PkBa2o8oKPRtQ9Kbsr1Fye8jtUcDjhwj2jMNugZKg=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi": ["@bruits/satteri-wasm32-wasi@0.10.5", "", { "dependencies": { "@emnapi/core": "1.11.1", "@emnapi/runtime": "1.11.1", "@napi-rs/wasm-runtime": "^1.2.3" }, "cpu": "none" }, "sha512-ypz8c/Zmipxp4IoeDa228Gstv6TLzVmNs3yC6wKCoNSOjx1iwpgzu87Y3hTkXFdwChVGU85qeUDuOIarGUZQLw=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-win32-arm64-msvc": ["@bruits/satteri-win32-arm64-msvc@0.10.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-siTV88nb0LRqNpkL2gXboqCwVdq95sLtzMHS1/3eONV2gLbB3NAK46wmSMvCO/yquBvI2lvaFIfd8P12ecsxBw=="], - - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-win32-x64-msvc": ["@bruits/satteri-win32-x64-msvc@0.10.5", "", { "os": "win32", "cpu": "x64" }, "sha512-C3IfPvfvMXmlzBxaMPKFS1XiuV9pu2mC7YqkPk7PSvTgPZ8gbdASIpHpztDLvTTQjqZ0z1Ol8tK5X+V6XXC0wQ=="], - - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.1" }, "os": "darwin", "cpu": "arm64" }, "sha512-eEieHsMksAW4IiO5NzauESRl2D2qz3J/kwUxUrSfV06A93eEaRfMpHXyUb1mAqrR7i8U9A0GRqE9pjn6u1Jjpg=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.1" }, "os": "darwin", "cpu": "x64" }, "sha512-BaktuGPCeHJMARpodR8jK4uKiZrPAy9WrfQW0sdI37clracq8Bp01AYS3SZgi5FS/y5twa9t4+LIuuxQjqRrWw=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.2", "", { "dependencies": { "@img/sharp-wasm32": "0.35.2" }, "os": "freebsd" }, "sha512-YoAxdnd8hPUkvLHd3bWY+YA8nw3xM/RyRopYucNsWHVSan8NLVM3X2volsfoRDcXdUJPg6tXahSd7HXPK7lRnw=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-4V/M3roRMTYjiwZY9IOVQOE8OyeCxFAkYmyZDrZl51uOKjibm3oeEJ4WAmLxutAfzFbC9jqUiPs2gbnGflH+7g=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-c0/DxItpJv2+dGhgycJBBgotdqruGYDvA79drdh0MD1dFpy7JzJ/PlXwi1H4rFf0eTy8tgbI91aHDnZIceY3jQ=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.1", "", { "os": "linux", "cpu": "arm" }, "sha512-aGGy9aWzXgHBG7HNyQPWorZthlp7+x6fDRoPAQbGO3ThcttuTyKIx3NuSHb6zb4gBNq6/yNn9f1cy9nFKS/Vmg=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-JznefmcK9j1JKPz8AkQDh89kjojubyfOasWBPKfzMIhPwsgDy9evpE/naJTXXXmghS1iFwR8u/kTwh/I2/+GCw=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-1EkwGNCZk6iWNCMWqrvdJ+r1j0PT1zIz60CNPhYnJlK/zyeWqlsPZIe+ocBVqPF8k/Ssee/NCk+tE9Ryrko6ng=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.1", "", { "os": "linux", "cpu": "none" }, "sha512-Ilays+w2bXdnxzxtQdmXR62u8o8GYa3eL4+Gr+1KiE4xperMZUslRaVPJwwPkzlHEjGfXAfRVAa/7CYCtSqsBw=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-VfBwVHQTbRoj4XlpA/KLZ7ltgMpz+4WSejFzQ+GnoImjo1PtEJ59QB2qR1xQEeRPYIkNrPIm2L4cICMvz4C2ew=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.1", "", { "os": "linux", "cpu": "x64" }, "sha512-+c8ukgwU62DS54nCAjw7keOfHUkmr0B5QHEdcOqRnodF/MNXJbVI8Eopoj4B/0H8Asr65I+A4Amrn7a85/md6A=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.3", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-qlKb/pwbkAi1WMsJrYHk7CuDrd12s27U2QnRhFYUoJNrRCmkosMTttuRFat/DDB3IlDm5qE1TJgZ4JDnHX8Ldw=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.1", "", { "os": "linux", "cpu": "x64" }, "sha512-yO21HwoUVLN8Qa+/SBjQLMYwBWAVJjeGPNe+hc0OUeMeifEtJqu5a1c4HayE1nNpDih9y3/KkoltfkDodmKAlg=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.1" }, "os": "linux", "cpu": "arm" }, "sha512-SE4kzF2mepn6z+6E7L6lsV8FzuLL6IPQdyX8ZiwROAG/G8td+hP/m7FsFPwidtrF19gvajuC9l6TxAVcsA4S7A=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.1" }, "os": "linux", "cpu": "arm64" }, "sha512-af12Pnd0ZGu2HfP8NayB0kk6eC/lrfbQE6HlR4jD+34wdJ1Vw9TF6TMn6ZvffT+WgqVsl0hRbmNvz2u/23VmwA=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.1" }, "os": "linux", "cpu": "ppc64" }, "sha512-hYSBm7zcNtDCozCxQHYZJiu63b/bXsgRZuOxCIBZsStMM9Vap47iFHdbX4kCvQsblPB/k+clhELpdQJHQLSHvg=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.1" }, "os": "linux", "cpu": "none" }, "sha512-qQt0Kc13+Hoan/Awq/qMSQw3L+RI1NCRPgD5cUJ/1WSSmIoysLOc72jlRM3E0OHN9Yr313jgeQ2T+zW+F03QFA=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.1" }, "os": "linux", "cpu": "s390x" }, "sha512-E4fLLfRPzDLlEeDaTzI98OFLcv++WL5ChLLMwPoVd0CIoZQqupBSNbOisPL5am9XsbQ9T84+iiMpUvbFtkunbA=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.1" }, "os": "linux", "cpu": "x64" }, "sha512-gi0zFJJRLswfCZmHtJdikXPOc5u7qamSOS3NHedLqLd4W8Q0NqjdBr6TTRIgsfFjqfTsHFgdfvJ9LwqSgcHiAA=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.1" }, "os": "linux", "cpu": "arm64" }, "sha512-siWbOW1u6HFnFLrp0waKyW7VEf7jYvcDWdrXEFa8AkdAQgEvuu5Fz8/Y70w9EeqAdwDtfU012BhEHHaDqvQNzg=="], + "@cloudflare/runtime-types/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=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.2", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.1" }, "os": "linux", "cpu": "x64" }, "sha512-YBqMMcjDi4QGYiSn4vNOYBhmlC4z5AXqkOUUqI2e0AFA4urNv4ESgOgwNl3K+4etQhha0twXlzeF20bbULm9Yg=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.2", "", { "dependencies": { "@img/sharp-wasm32": "0.35.2" }, "cpu": "none" }, "sha512-QNV27pxs9wpApEiCfvHM1RDoP1w1+2KrUWWDPEhEwg+latvOrfuhWrHWZKwdSFwU6jh3myjw/yOCRsUIuOft3g=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-BiVRYc/t6/Vl3e1hBx0hugG4oN9Pydf4fgMSpxTQJmwGUg/YoXTWHiFeRymHfCZzifxu4F4rpk/I67D0LQ20wQ=="], - - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-YYEhx9PImCC7T0tI8JDMi4DB9LwLCXCU5OWNYEXAxh5Q1ShKkyC6byxzoBJ3gEFDnH2lQckWuDe70G7mB2XJog=="], - - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.2", "", { "os": "win32", "cpu": "x64" }, "sha512-imoOyBcoM/iiUr4J6VPpCNjPnjvP/Gks95898yB8YqoGGYmHYbOyCuNv9FMhFgtaiHFGbHW8bxKqRV6VjtXThQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.28.1", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.28.1", "", { "os": "android", "cpu": "arm" }, "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.28.1", "", { "os": "android", "cpu": "arm64" }, "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.28.1", "", { "os": "android", "cpu": "x64" }, "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.28.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.28.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.28.1", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.28.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.28.1", "", { "os": "linux", "cpu": "arm" }, "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.28.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.28.1", "", { "os": "linux", "cpu": "ia32" }, "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.28.1", "", { "os": "linux", "cpu": "none" }, "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.28.1", "", { "os": "linux", "cpu": "none" }, "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.28.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.28.1", "", { "os": "linux", "cpu": "none" }, "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.28.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.28.1", "", { "os": "linux", "cpu": "x64" }, "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.28.1", "", { "os": "none", "cpu": "arm64" }, "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.28.1", "", { "os": "none", "cpu": "x64" }, "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.28.1", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.28.1", "", { "os": "openbsd", "cpu": "x64" }, "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.28.1", "", { "os": "none", "cpu": "arm64" }, "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.28.1", "", { "os": "sunos", "cpu": "x64" }, "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.28.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.28.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg=="], - - "@cloudflare/vite-plugin/wrangler/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.1", "", { "os": "win32", "cpu": "x64" }, "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A=="], + "@cloudflare/runtime-types/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.4", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="], "@electron/asar/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], "@electron/universal/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.4", "", { "os": "aix", "cpu": "ppc64" }, "sha512-1VCICWypeQKhVbE9oW/sJaAmjLxhVqacdkvPLEjwlttjfwENRSClS8EjBz0KzRyFSCPDIkuXW34Je/vk7zdB7Q=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.28.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.4", "", { "os": "android", "cpu": "arm" }, "sha512-QNdQEps7DfFwE3hXiU4BZeOV68HHzYwGd0Nthhd3uCkkEKK7/R6MTgM0P7H7FAs5pU/DIWsviMmEGxEoxIZ+ZQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.28.2", "", { "os": "android", "cpu": "arm" }, "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.4", "", { "os": "android", "cpu": "arm64" }, "sha512-bBy69pgfhMGtCnwpC/x5QhfxAz/cBgQ9enbtwjf6V9lnPI/hMyT9iWpR1arm0l3kttTr4L0KSLpKmLp/ilKS9A=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.28.2", "", { "os": "android", "cpu": "arm64" }, "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.4", "", { "os": "android", "cpu": "x64" }, "sha512-TVhdVtQIFuVpIIR282btcGC2oGQoSfZfmBdTip2anCaVYcqWlZXGcdcKIUklfX2wj0JklNYgz39OBqh2cqXvcQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.28.2", "", { "os": "android", "cpu": "x64" }, "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Y1giCfM4nlHDWEfSckMzeWNdQS31BQGs9/rouw6Ub91tkK79aIMTH3q9xHvzH8d0wDru5Ci0kWB8b3up/nl16g=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.28.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-CJsry8ZGM5VFVeyUYB3cdKpd/H69PYez4eJh1W/t38vzutdjEjtP7hB6eLKBoOdxcAlCtEYHzQ/PJ/oU9I4u0A=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.28.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yYq+39NlTRzU2XmoPW4l5Ifpl9fqSk0nAJYM/V/WUGPEFfek1epLHJIkTQM6bBs1swApjO5nWgvr843g6TjxuQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.28.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-0FgvOJ6UUMflsHSPLzdfDnnBBVoCDtBTVyn/MrWloUNvq/5SFmh13l3dvgRPkDihRxb77Y17MbqbCAa2strMQQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.28.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.4", "", { "os": "linux", "cpu": "arm" }, "sha512-kro4c0P85GMfFYqW4TWOpvmF8rFShbWGnrLqlzp4X1TNWjRY3JMYUfDCtOxPKOIY8B0WC8HN51hGP4I4hz4AaQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.28.2", "", { "os": "linux", "cpu": "arm" }, "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-+89UsQTfXdmjIvZS6nUnOOLoXnkUTB9hR5QAeLrQdzOSWZvNSAXAtcRDHWtqAUtAmv7ZM1WPOOeSxDzzzMogiQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.28.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.4", "", { "os": "linux", "cpu": "ia32" }, "sha512-yTEjoapy8UP3rv8dB0ip3AfMpRbyhSN3+hY8mo/i4QXFeDxmiYbEKp3ZRjBKcOP862Ua4b1PDfwlvbuwY7hIGQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.28.2", "", { "os": "linux", "cpu": "ia32" }, "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-NeqqYkrcGzFwi6CGRGNMOjWGGSYOpqwCjS9fvaUlX5s3zwOtn1qwg1s2iE2svBe4Q/YOG1q6875lcAoQK/F4VA=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-IcvTlF9dtLrfL/M8WgNI/qJYBENP3ekgsHbYUIzEzq5XJzzVEV/fXY9WFPfEEXmu3ck2qJP8LG/p3Q8f7Zc2Xg=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-HOy0aLTJTVtoTeGZh4HSXaO6M95qu4k5lJcH4gxv56iaycfz1S8GO/5Jh6X4Y1YiI0h7cRyLi+HixMR+88swag=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.28.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.4", "", { "os": "linux", "cpu": "none" }, "sha512-i8JUDAufpz9jOzo4yIShCTcXzS07vEgWzyX3NH2G7LEFVgrLEhjwL3ajFE4fZI3I4ZgiM7JH3GQ7ReObROvSUA=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-jFnu+6UbLlzIjPQpWCNh5QtrcNfMLjgIavnwPQAfoGx4q17ocOU9MsQ2QVvFxwQoWpZT8DvTLooTvmOQXkO51g=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.28.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.4", "", { "os": "linux", "cpu": "x64" }, "sha512-6e0cvXwzOnVWJHq+mskP8DNSrKBr1bULBvnFLpc1KY+d+irZSgZ02TGse5FsafKS5jg2e4pbvK6TPXaF/A6+CA=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.28.2", "", { "os": "linux", "cpu": "x64" }, "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.4", "", { "os": "none", "cpu": "arm64" }, "sha512-vUnkBYxZW4hL/ie91hSqaSNjulOnYXE1VSLusnvHg2u3jewJBz3YzB9+oCw8DABeVqZGg94t9tyZFoHma8gWZQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.4", "", { "os": "none", "cpu": "x64" }, "sha512-XAg8pIQn5CzhOB8odIcAm42QsOfa98SBeKUdo4xa8OvX8LbMZqEtgeWE9P/Wxt7MlG2QqvjGths+nq48TrUiKw=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.28.2", "", { "os": "none", "cpu": "x64" }, "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.4", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-Ct2WcFEANlFDtp1nVAXSNBPDxyU+j7+tId//iHXU2f/lN5AmO4zLyhDcpR5Cz1r08mVxzt3Jpyt4PmXQ1O6+7A=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.28.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-xAGGhyOQ9Otm1Xu8NT1ifGLnA6M3sJxZ6ixylb+vIUVzvvd6GOALpwQrYrtlPouMqd/vSbgehz6HaVk4+7Afhw=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.28.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.4", "", { "os": "sunos", "cpu": "x64" }, "sha512-Mw+tzy4pp6wZEK0+Lwr76pWLjrtjmJyUB23tHKqEDP74R3q95luY/bXqXZeYl4NYlvwOqoRKlInQialgCKy67Q=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-AVUP428VQTSddguz9dO9ngb+E5aScyg7nOeJDrF1HPYu555gmza3bDGMPhmVXL8svDSoqPCsCPjb265yG/kLKQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.28.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-i1sW+1i+oWvQzSgfRcxxG2k4I9n3O9NRqy8U+uugaT2Dy7kLO9Y7wI72haOahxceMX8hZAzgGou1FhndRldxRg=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.28.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ=="], - "@opencode/console-app/wrangler/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.4", "", { "os": "win32", "cpu": "x64" }, "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.28.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA=="], - "@opencode/console-app/wrangler/miniflare/acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], + "@opencode/legacy/wrangler/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.2", "", { "os": "win32", "cpu": "x64" }, "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g=="], - "@opencode/console-app/wrangler/miniflare/sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="], + "@opencode/legacy/wrangler/miniflare/sharp": ["sharp@0.35.5", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.5", "@img/sharp-darwin-x64": "0.35.5", "@img/sharp-freebsd-wasm32": "0.35.5", "@img/sharp-libvips-darwin-arm64": "1.3.4", "@img/sharp-libvips-darwin-x64": "1.3.4", "@img/sharp-libvips-linux-arm": "1.3.4", "@img/sharp-libvips-linux-arm64": "1.3.4", "@img/sharp-libvips-linux-ppc64": "1.3.4", "@img/sharp-libvips-linux-riscv64": "1.3.4", "@img/sharp-libvips-linux-s390x": "1.3.4", "@img/sharp-libvips-linux-x64": "1.3.4", "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", "@img/sharp-libvips-linuxmusl-x64": "1.3.4", "@img/sharp-linux-arm": "0.35.5", "@img/sharp-linux-arm64": "0.35.5", "@img/sharp-linux-ppc64": "0.35.5", "@img/sharp-linux-riscv64": "0.35.5", "@img/sharp-linux-s390x": "0.35.5", "@img/sharp-linux-x64": "0.35.5", "@img/sharp-linuxmusl-arm64": "0.35.5", "@img/sharp-linuxmusl-x64": "0.35.5", "@img/sharp-webcontainers-wasm32": "0.35.5", "@img/sharp-win32-arm64": "0.35.5", "@img/sharp-win32-ia32": "0.35.5", "@img/sharp-win32-x64": "0.35.5" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g=="], - "@opencode/console-app/wrangler/miniflare/undici": ["undici@7.14.0", "", {}, "sha512-Vqs8HTzjpQXZeXdpsfChQTlafcMQaaIwnGwLam1wudSSjlJeQ3bw1j+TLPePgrCnCpUXx7Ba5Pdpf5OBih62NQ=="], + "@opencode/legacy/wrangler/miniflare/undici": ["undici@7.30.1", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="], - "@opencode/console-app/wrangler/miniflare/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], + "@opencode/legacy/wrangler/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20261102.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-5vxE27qqftDMv9H0mCZt0B1cr+EvszT/lhpoFmdKqtS2Uu+Jo2PMIUYGepLe6yxbdV1hPKkgLBD2scnW3lXe/Q=="], - "@opencode/console-app/wrangler/miniflare/zod": ["zod@3.22.3", "", {}, "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug=="], + "@opencode/legacy/wrangler/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20261102.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-VanKNl3pLP2k8j9nEvETp/l3+dvfGvdWKI6bNJByKVz5szVVIMnGvDvrr+JmotreUZHWTDqfLh2RzPGRq1cZzg=="], - "@opencode/console-app/wrangler/workerd/@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20251118.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-UmWmYEYS/LkK/4HFKN6xf3Hk8cw70PviR+ftr3hUvs9HYZS92IseZEp16pkL6ZBETrPRpZC7OrzoYF7ky6kHsg=="], + "@opencode/legacy/wrangler/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20261102.1", "", { "os": "linux", "cpu": "x64" }, "sha512-hQdSdaHLS4UFGZRoue9TFVOO9UPnOAGWw3ZTZnUtXoUGWf4THwatq0l55F7IbOQYcOJfeKpHoFcMoGEH/88GCA=="], - "@opencode/console-app/wrangler/workerd/@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20251118.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RockU7Qzf4rxNfY1lx3j4rvwutNLjTIX7rr2hogbQ4mzLo8Ea40/oZTzXVxl+on75joLBrt0YpenGW8o/r44QA=="], + "@opencode/legacy/wrangler/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20261102.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-cqMnRpvDT6v6K80YClFs7XnZMq2RC5H6aHawlrVsIHrmVdSEXUm7OEVMQ9lY5nx3EI4JftiTeFpkLHFZqTSNVg=="], - "@opencode/console-app/wrangler/workerd/@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20251118.0", "", { "os": "linux", "cpu": "x64" }, "sha512-aT97GnOAbJDuuOG0zPVhgRk0xFtB1dzBMrxMZ09eubDLoU4djH4BuORaqvxNRMmHgKfa4T6drthckT0NjUvBdw=="], - - "@opencode/console-app/wrangler/workerd/@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20251118.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-bXZPJcwlq00MPOXqP7DMWjr+goYj0+Fqyw6zgEC2M3FR1+SWla4yjghnZ4IdpN+H1t7VbUrsi5np2LzMUFs0NA=="], - - "@opencode/console-app/wrangler/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20251118.0", "", { "os": "win32", "cpu": "x64" }, "sha512-2LV99AHSlpr8WcCb/BYbU2QsYkXLUL1izN6YKWkN9Eibv80JKX0RtgmD3dfmajE5sNvClavxZejgzVvHD9N9Ag=="], + "@opencode/legacy/wrangler/workerd/@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20261102.1", "", { "os": "win32", "cpu": "x64" }, "sha512-s9iKBbAdNIdVjpMUHh48zbCfCHw5wbLl8I2aIW74H3OtxpWZP/cHeEwZZMq3xAz5kt4MmvwwO4hDbNYoAD4yhw=="], "@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=="], @@ -6059,29 +5396,13 @@ "@opencode/stories/@tailwindcss/vite/@tailwindcss/oxide/@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.1.11", "", { "os": "win32", "cpu": "x64" }, "sha512-YfHoggn1j0LK7wR82TOucWc5LDCguHnoS879idHekmmiR7g9HUtMw9MI0NHatS28u/Xlkfi9w5RJWgz2Dl+5Qg=="], - "@opencode/web/@astrojs/check/@astrojs/language-server/vscode-uri": ["vscode-uri@3.2.0", "", {}, "sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg=="], - - "@opencode/web/@astrojs/check/chokidar/readdirp": ["readdirp@5.1.1", "", {}, "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA=="], - - "@opencode/web/@astrojs/check/yargs/cliui": ["cliui@9.0.1", "", { "dependencies": { "string-width": "^7.2.0", "strip-ansi": "^7.1.0", "wrap-ansi": "^9.0.0" } }, "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w=="], - - "@opencode/web/@astrojs/check/yargs/string-width": ["string-width@8.2.2", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg=="], - - "@opencode/web/@astrojs/check/yargs/yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="], - "@opentui/solid/babel-preset-solid/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=="], "@puppeteer/browsers/yargs/cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "@puppeteer/browsers/yargs/cliui/wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], - "astro/unstorage/chokidar/readdirp": ["readdirp@5.1.1", "", {}, "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA=="], - - "astro/unstorage/h3/cookie-es": ["cookie-es@1.2.3", "", {}, "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw=="], - - "astro/unstorage/h3/crossws": ["crossws@0.3.5", "", { "dependencies": { "uncrypto": "^0.1.3" } }, "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA=="], - - "astro/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], + "@textjs/app/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], "babel-plugin-module-resolver/glob/minimatch/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="], @@ -6107,53 +5428,55 @@ "yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg=="], - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.4" }, "os": "darwin", "cpu": "x64" }, "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw=="], - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-freebsd-wasm32": ["@img/sharp-freebsd-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "os": "freebsd" }, "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.2", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-Mrv4JQNYVQ94xH+jzZ9r+gowleN8mv2FTgKT+PI6bx5C0G8TdNYndu161pg2i7uoBwxy2ImPMHrJOM2LZef7Bw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.2", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-Mrv4JQNYVQ94xH+jzZ9r+gowleN8mv2FTgKT+PI6bx5C0G8TdNYndu161pg2i7uoBwxy2ImPMHrJOM2LZef7Bw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.0.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.3.4", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.0.4" }, "os": "darwin", "cpu": "x64" }, "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.0.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-ppc64": ["@img/sharp-libvips-linux-ppc64@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.0.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-riscv64": ["@img/sharp-libvips-linux-riscv64@1.3.4", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.0.5", "", { "os": "linux", "cpu": "arm" }, "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.0.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.4" }, "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.0.5" }, "os": "linux", "cpu": "arm" }, "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-ppc64": ["@img/sharp-linux-ppc64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.4" }, "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-riscv64": ["@img/sharp-linux-riscv64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.4" }, "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.0.4" }, "os": "linux", "cpu": "s390x" }, "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.4" }, "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.4" }, "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" }, "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.35.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.4" }, "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-wasm32": ["@img/sharp-wasm32@0.33.5", "", { "dependencies": { "@emnapi/runtime": "^1.2.0" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-webcontainers-wasm32": ["@img/sharp-webcontainers-wasm32@0.35.5", "", { "dependencies": { "@img/sharp-wasm32": "0.35.5" }, "cpu": "none" }, "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.33.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-win32-arm64": ["@img/sharp-win32-arm64@0.35.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q=="], - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.33.5", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.35.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A=="], + + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.5", "", { "os": "win32", "cpu": "x64" }, "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg=="], "@opencode/stories/@tailwindcss/vite/@tailwindcss/node/lightningcss/lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.30.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ=="], @@ -6187,10 +5510,6 @@ "@opencode/stories/@tailwindcss/vite/@tailwindcss/oxide/@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@opencode/web/@astrojs/check/yargs/cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], - - "@opencode/web/@astrojs/check/yargs/cliui/wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], - "@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=="], @@ -6205,16 +5524,12 @@ "temp/rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.21", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-freebsd-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.5", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-webcontainers-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], - - "@opencode/console-app/wrangler/miniflare/sharp/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], + "@opencode/legacy/wrangler/miniflare/sharp/@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.5", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ=="], "@opencode/stories/@tailwindcss/vite/@tailwindcss/oxide/@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime/@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], - "@opencode/web/@astrojs/check/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], - "rimraf/glob/jackspeak/@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], "rimraf/glob/jackspeak/@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], diff --git a/bunfig.toml b/bunfig.toml index 23f0523551..670dc7555a 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -2,7 +2,7 @@ exact = true # Only install newly resolved package versions published at least 3 days ago. minimumReleaseAge = 259200 -minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "typescript@7.1.0-beta"] +minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-arm64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "typescript@7.1.0-beta", "@textjs/app", "@textjs/core", "@textjs/opencode", "@textjs/react"] [test] root = "./do-not-run-tests-from-root" diff --git a/infra/app.ts b/infra/app.ts deleted file mode 100644 index d413dab7cd..0000000000 --- a/infra/app.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { domain } from "./stage" - -const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID") -const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY") -export const EMAILOCTOPUS_API_KEY = new sst.Secret("EMAILOCTOPUS_API_KEY") -const ADMIN_SECRET = new sst.Secret("ADMIN_SECRET") - -export const api = new sst.cloudflare.Worker("Api", { - domain: `api.${domain}`, - handler: "packages/function/src/api.ts", - url: true, - link: [GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, ADMIN_SECRET], - transform: { - worker: (args) => { - args.logpush = true - }, - }, -}) - -new sst.cloudflare.x.Astro("Web", { - domain: "docs." + domain, - path: "packages/web", - environment: { - // For astro config - SST_STAGE: $app.stage, - VITE_API_URL: api.url.apply((url) => url!), - }, -}) diff --git a/infra/console.ts b/infra/console.ts deleted file mode 100644 index 84e64d05a7..0000000000 --- a/infra/console.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { domain } from "./stage" -import { EMAILOCTOPUS_API_KEY } from "./app" - -// Archived Zen request/response dumps (writer removed May 2026). Retained on purpose; nothing reads or writes them. -new sst.cloudflare.Bucket("ZenData") -new sst.cloudflare.Bucket("ZenDataNew") - -const AWS_SES_ACCESS_KEY_ID = new sst.Secret("AWS_SES_ACCESS_KEY_ID") -const AWS_SES_SECRET_ACCESS_KEY = new sst.Secret("AWS_SES_SECRET_ACCESS_KEY") -const ENTERPRISE_SALES_INBOX_EMAIL = new sst.Secret("ENTERPRISE_SALES_INBOX_EMAIL") -// OpenCode API key for Jev spam scoring of enterprise form submissions. -const ENTERPRISE_SPAM_API_KEY = new sst.Secret("ENTERPRISE_SPAM_API_KEY") -// hCaptcha guards the enterprise form; the site key is public and baked into the client bundle. -const HCAPTCHA_SITE_KEY = new sst.Secret("HCAPTCHA_SITE_KEY") -const HCAPTCHA_SECRET_KEY = new sst.Secret("HCAPTCHA_SECRET_KEY") - -const SALESFORCE_CLIENT_ID = new sst.Secret("SALESFORCE_CLIENT_ID") -const SALESFORCE_CLIENT_SECRET = new sst.Secret("SALESFORCE_CLIENT_SECRET") -const SALESFORCE_INSTANCE_URL = new sst.Secret("SALESFORCE_INSTANCE_URL") - -new sst.cloudflare.x.SolidStart("Console", { - domain, - path: "packages/console/app", - link: [ - EMAILOCTOPUS_API_KEY, - AWS_SES_ACCESS_KEY_ID, - AWS_SES_SECRET_ACCESS_KEY, - ENTERPRISE_SALES_INBOX_EMAIL, - ENTERPRISE_SPAM_API_KEY, - HCAPTCHA_SECRET_KEY, - SALESFORCE_CLIENT_ID, - SALESFORCE_CLIENT_SECRET, - SALESFORCE_INSTANCE_URL, - ], - environment: { - //VITE_DOCS_URL: web.url.apply((url) => url!), - //VITE_API_URL: gateway.url.apply((url) => url!), - VITE_CONSOLE_MARKETING_ENABLED: $app.stage === "dev" ? "true" : "false", - VITE_HCAPTCHA_SITE_KEY: HCAPTCHA_SITE_KEY.value, - }, - transform: { - server: { - placement: { region: "aws:us-east-2" }, - transform: { - worker: (args) => { - args.compatibilityFlags = $resolve(args.compatibilityFlags).apply((flags) => [ - ...(flags ?? []), - "global_fetch_strictly_public", - ]) - }, - }, - }, - }, -}) diff --git a/infra/share.ts b/infra/share.ts deleted file mode 100644 index 4f54cb07d8..0000000000 --- a/infra/share.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { shortDomain } from "./stage" - -// The Share worker takes over the hostname of the retired Teams worker. Cloudflare rejects a second custom domain for -// the same hostname, so adopt the Teams domain and replace it, deleting the old one first. -$transform(cloudflare.WorkersCustomDomain, (_args, opts, name) => { - if (name !== "ShareDomain") return - opts.aliases = [ - `urn:pulumi:${$app.stage}::${$app.name}::sst:cloudflare:SolidStart$sst:cloudflare:Worker$cloudflare:index/workersCustomDomain:WorkersCustomDomain::TeamsWorkerDomain`, - ] - opts.deleteBeforeReplace = true - opts.replaceOnChanges = ["*"] -}) - -new sst.cloudflare.Worker("Share", { - domain: shortDomain, - handler: "packages/function/src/share.ts", -}) diff --git a/infra/stage.ts b/infra/stage.ts deleted file mode 100644 index f4ccb18d80..0000000000 --- a/infra/stage.ts +++ /dev/null @@ -1,40 +0,0 @@ -export const domain = (() => { - if ($app.stage === "production") return "opencode.ai" - if ($app.stage === "dev") return "dev.opencode.ai" - return `${$app.stage}.dev.opencode.ai` -})() - -export const zoneID = "430ba34c138cfb5360826c4909f99be8" -export const awsStage = $app.stage === "production" ? "production" : "dev" -export const deployStats = $app.stage === awsStage - -if ($app.stage === "production") { - new cloudflare.DnsRecord("TrustCenter", { - zoneId: zoneID, - name: "trust.opencode.ai", - type: "CNAME", - content: "3a69a5bb27875189.vercel-dns-016.com", - proxied: false, - ttl: 60, - }) - - new cloudflare.DnsRecord("TrustCenterVerification", { - zoneId: zoneID, - name: "opencode.ai", - type: "TXT", - content: "compai-domain-verification=org_6993a99c6200a2d642bb115d", - ttl: 60, - }) -} - -new cloudflare.RegionalHostname("RegionalHostname", { - hostname: domain, - regionKey: "us", - zoneId: zoneID, -}) - -export const shortDomain = (() => { - if ($app.stage === "production") return "opncd.ai" - if ($app.stage === "dev") return "dev.opncd.ai" - return `${$app.stage}.dev.opncd.ai` -})() diff --git a/infra/stats.ts b/infra/stats.ts deleted file mode 100644 index 58e3c6165a..0000000000 --- a/infra/stats.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { EMAILOCTOPUS_API_KEY } from "./app" -import { domain } from "./stage" - -//////////////// -// DATABASE -//////////////// - -const cluster = planetscale.getDatabaseOutput({ - name: "opencode-stats", - organization: "anomalyco", -}) - -const branch = - $app.stage === "production" - ? planetscale.getBranchOutput({ - name: "production", - organization: cluster.organization, - database: cluster.name, - }) - : new planetscale.Branch("StatsDatabaseBranch", { - database: cluster.name, - organization: cluster.organization, - name: $app.stage, - parentBranch: "production", - }) - -const password = new planetscale.Password("StatsDatabasePassword", { - name: $app.stage, - database: cluster.name, - organization: cluster.organization, - branch: branch.name, -}) - -const databaseUrl = $interpolate`mysql://${password.username.apply(encodeURIComponent)}:${password.plaintext.apply( - encodeURIComponent, -)}@${password.accessHostUrl}/${cluster.name}` - -export const database = new sst.Linkable("StatsDatabase", { - properties: { - host: password.accessHostUrl, - database: cluster.name, - username: password.username, - password: password.plaintext, - port: 3306, - url: databaseUrl, - }, -}) - -new sst.x.DevCommand("StatsStudio", { - link: [database], - environment: { - DATABASE_URL: databaseUrl, - }, - dev: { - command: "bun db:studio", - directory: "packages/stats/core", - autostart: false, - }, -}) - -//////////////// -// APP -//////////////// - -export const app = new sst.cloudflare.x.SolidStart("Stats", { - path: "packages/stats/app", - buildCommand: "bun run build", - domain: `stats.${domain}`, - link: [database, EMAILOCTOPUS_API_KEY], - environment: { - PUBLIC_URL: `https://${domain}/data`, - }, -}) - -//////////////// -// SERVICES -//////////////// - -const statsSyncConfig = new sst.Linkable("StatsSyncConfig", { - properties: { - dataset: "zen", - }, -}) - -// Comma-separated model IDs kept off the public stats site. A secret, so excluding -// an unreleased model does not publish its name in git. -const statsHiddenModels = new sst.Secret("StatsHiddenModels", "") - -const r2SqlAuthToken = new sst.Secret("R2SqlAuthToken") -const r2Sql = new sst.Linkable("R2Sql", { - properties: { - accountId: "15d29c8639fd3733b1b5486a2acfd968", - bucket: `platform-${$app.stage}-lake`, - namespace: "inference", - table: "generation", - }, -}) - -// One instance per run: a plan step, then one step per stat period and retention -// cohort. See packages/stats/README.md for triggering a run by hand. -export const statsSyncWorkflow = new sst.cloudflare.Workflow("StatsSyncWorkflow", { - handler: "packages/stats/server/src/workflow.ts", - className: "StatsSyncWorkflow", - link: [database, r2Sql, r2SqlAuthToken, statsHiddenModels, statsSyncConfig], - transform: { - worker: { - transform: { - worker: (args) => { - // Raise CPU time from the 30-second default to the 5-minute maximum for - // ranking a full week of geo rows. - args.limits = { cpuMs: 300_000 } - args.observability = { enabled: true } - }, - }, - }, - }, -}) - -// Schedules must match packages/stats/server/src/schedule.ts, which maps the -// daily one to a history run. -if (!$dev) - new sst.cloudflare.Cron("StatsSyncCron", { - schedules: ["5 * * * *", "20 3 * * *"], - worker: { - handler: "packages/stats/server/src/cron.ts", - link: [statsSyncWorkflow], - transform: { - worker: (args) => { - args.observability = { enabled: true } - }, - }, - }, - }) - -new sst.x.DevCommand("StatsSync", { - link: [database, r2Sql, r2SqlAuthToken, statsHiddenModels, statsSyncConfig], - dev: { - command: "bun src/sync.ts", - directory: "packages/stats/server", - autostart: false, - }, -}) diff --git a/infra/webapp.ts b/infra/webapp.ts deleted file mode 100644 index ed0ef7914f..0000000000 --- a/infra/webapp.ts +++ /dev/null @@ -1,21 +0,0 @@ -export function createWebApp(domain: string) { - // Workers Static Assets uploads files as-is, up to 25 MiB each. StaticSite stored them base64-encoded in KV, which - // pushed the 20 MB Word preview engine past KV's 25 MiB value limit. - return new sst.cloudflare.StaticSiteV2("WebApp", { - domain, - path: "packages/app", - environment: - $app.stage === "beta" - ? { - OPENCODE_CHANNEL: "beta", - VITE_OPENCODE_SERVER_MODE: "none", - VITE_SENTRY_ENVIRONMENT: "beta", - } - : undefined, - build: { - // Preserve Sentry credentials and run source-map uploads on every deployment. - command: "bun run build", - output: "./dist", - }, - }) -} diff --git a/install b/install index 19c025109e..0ee3db3020 100755 --- a/install +++ b/install @@ -21,8 +21,8 @@ Options: --no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.) Examples: - curl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/dev/install | bash - curl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/dev/install | bash -s -- --version 1.0.0 + curl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/fuck-dev/install | bash + curl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/fuck-dev/install | bash -s -- --version 1.0.0 ./install --binary /path/to/fuckcode EOF } @@ -182,9 +182,9 @@ else if [ -z "$requested_version" ]; then url="https://github.com/${GITHUB_REPO}/releases/latest/download/$filename" - specific_version=$(curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p') + specific_version=$(curl -fsSI "https://github.com/${GITHUB_REPO}/releases/latest" | sed -n 's|^[Ll]ocation:.*/tag/v\([^[:space:]]*\).*|\1|p' | tr -d '\r') - if [[ $? -ne 0 || -z "$specific_version" ]]; then + if [[ -z "$specific_version" ]]; then echo -e "${RED}Failed to fetch version information from ${GITHUB_REPO}${NC}" exit 1 fi diff --git a/package.json b/package.json index be8c72e7b7..8786a4fa14 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/package.json", "name": "opencode", "description": "Autonomous CLI security auditing and coding assistant", - "version": "2.0.3", + "version": "2.0.4", "private": true, "type": "module", "packageManager": "bun@1.4.4", @@ -13,10 +13,10 @@ "dev:vite:live": "sh -c 'OPENCODE_TUI_CHANNEL=dev OPENCODE_PASSWORD=\"$(opencode service get password)\" exec bun run dev:vite \"$@\" --server \"$(opencode service status)\"' --", "dev:desktop": "bun --cwd packages/desktop dev", "dev:web": "bun --cwd packages/app dev", - "dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev", "dev:stats": "bun sst shell --stage=production -- bun run --cwd packages/stats/app dev", "dev:www": "bun run --cwd services/www dev", "dev:storybook": "bun --cwd packages/storybook storybook", + "dev:site": "bun run --cwd services/site dev", "lint": "oxlint && ast-grep scan -c script/ast-grep/gui-plugins/sgconfig.yml && bun script/sdk-docs.ts", "lint:changed": "bun script/lint-changed.ts", "lint:effect-patterns": "ast-grep scan -c script/ast-grep/sgconfig.yml packages/util/src packages/core/src packages/server/src packages/protocol/src packages/cli/src", @@ -44,7 +44,6 @@ "packages/*", "packages/plugins/*", "services/*", - "packages/console/*", "packages/stats/*" ], "catalog": { @@ -55,12 +54,12 @@ "@effect/sql-sqlite-node": "4.1.0", "@npmcli/arborist": "9.4.0", "@types/bun": "1.4.3", - "@hona/strobe": "0.7.3", + "@hona/strobe": "0.28.0", "@types/cross-spawn": "6.0.6", "@octokit/rest": "22.0.0", - "@opentui/core": "0.8.1", - "@opentui/keymap": "0.8.1", - "@opentui/solid": "0.8.1", + "@opentui/core": "0.8.4", + "@opentui/keymap": "0.8.4", + "@opentui/solid": "0.8.4", "@tanstack/solid-virtual": "3.13.37", "@standard-schema/spec": "1.1.0", "@kobalte/core": "0.13.13", @@ -70,11 +69,9 @@ "@types/semver": "7.7.1", "@tsconfig/node22": "22.0.2", "@tsconfig/bun": "1.0.9", - "@astrojs/starlight": "0.41.11", "@cloudflare/workers-types": "4.20251008.0", "@pierre/diffs": "1.6.1", "@pierre/highlights": "0.2.0", - "astro": "7.3.8", "@solid-primitives/event-listener": "2.4.6", "@solid-primitives/media": "2.3.6", "@solid-primitives/resize-observer": "2.2.0", @@ -99,7 +96,6 @@ "@typescript/native": "npm:typescript@7.1.0-beta", "zod": "4.6.7", "remeda": "2.26.0", - "sst": "4.13.1", "shiki": "4.4.3", "solid-list": "0.3.0", "string-width": "7.2.0", @@ -131,7 +127,6 @@ "oxlint": "1.60.0", "prettier": "3.6.2", "semver": "^7.6.0", - "sst": "catalog:", "turbo": "2.10.2" }, "dependencies": { @@ -164,8 +159,6 @@ "bun-types": "1.4.4", "effect": "catalog:", "open": "11.0.4", - "astro": "catalog:", - "@astrojs/starlight": "catalog:", "solid-js": "catalog:" }, "patchedDependencies": { @@ -182,11 +175,11 @@ "@tanstack/virtual-core@3.17.8": "patches/@tanstack%2Fvirtual-core@3.17.8.patch", "@ff-labs/fff-bun@0.10.5": "patches/@ff-labs%2Ffff-bun@0.10.5.patch", "vite@8.2.4": "patches/vite@8.2.4.patch", - "@modelcontextprotocol/client@2.3.1": "patches/@modelcontextprotocol%2Fclient@2.3.1.patch", "@corvu/drawer@0.2.4": "patches/@corvu%2Fdrawer@0.2.4.patch", "app-builder-lib@26.15.7": "patches/app-builder-lib@26.15.7.patch", "electron-updater@6.8.9": "patches/electron-updater@6.8.9.patch", "@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" + "@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" } } diff --git a/packages/ai/README.md b/packages/ai/README.md index fd1b9783dd..7b27dd07d3 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -1,6 +1,6 @@ # @opencode/ai -Schema-first APIs for text, images, and decisions, built with Effect. Video, speech, transcription, extraction, and +Schema-first APIs for text, images, decisions, and embeddings, built with Effect. Video, speech, transcription, extraction, and realtime voice are [experimental](#experimental). `@opencode/ai` is the Promise API: one managed runtime behind the LLM and media methods, plus asset helpers. `ai.file` @@ -16,7 +16,7 @@ const input = { model: openai.responses("gpt-4o-mini"), prompt: "Say hello." } const response = await ai.generate(input) console.log(response.text) const generated = await ai.image.generate({ model: openai.image("gpt-image-2"), prompt: "A lighthouse" }) -await ai.write(generated.image, "./lighthouse.png") // also ai.file(path), ai.bytes(asset), ai.base64(asset), ai.materialize(asset) +await ai.write(generated.images[0], "./lighthouse.png") // also ai.file(path), ai.bytes(asset), ai.base64(asset), ai.materialize(asset) for await (const event of ai.stream(ai.request(input))) { // LLMEvent } @@ -226,7 +226,7 @@ const image = Effect.gen(function* () { resolution: "1K", providerOptions: { quality: "high" }, // typed per image model }) - yield* Media.write(response.image, "./garden.png") + yield* Media.write(response.images[0], "./garden.png") }) // `Media.file` / `Media.write` use the Effect `FileSystem` service; provide your platform's layer. @@ -322,6 +322,8 @@ const [refund, department] = response.answers ``` `input` is a JSON object or an ordered list of `text`, `json` and `media` parts. Answers come back in question order. +A `predicate` can say what counts as true and as false with `criteria: { true, false }`; hosts without a criteria field +read them appended to the instructions. A question the host declines is `{ name, type: "error", reason, message? }`, with `reason` such as `"refusal"`; the other answers still come back. `response.usage` has `inputTokens`, `outputTokens`, `totalTokens` and the host's reported `cost` when it sends one; @@ -355,6 +357,95 @@ CloudflareAIGateway.configure({ accountId }).decision("typesafe/jev") OpenAI and Vercel AI Gateway use OpenAI's `/v1/decisions` API. TypeSafe, OpenCode, OpenRouter, Baseten and DigitalOcean use System One (`/systemone`), and Cloudflare sends the System One body through `/ai/run`. +## Embeddings + +Embedding models turn each value into a vector, returned in value order. + +```ts +import { ai } from "@opencode/ai" +import { OpenAI } from "@opencode/ai/providers" + +const response = await ai.embedding.generate({ + model: OpenAI.configure().embedding("text-embedding-3-small"), + values: ["I was charged twice.", "How do I reset my password?"], + dimensions: 256, + inputType: "document", +}) +const [charge, password] = response.embeddings +``` + +A string value is text; media values are an `Asset` (or bytes or a URL) for hosts that embed images or documents. +`dimensions` asks models that can shorten their vectors for that length. `inputType` says whether the values are +search queries or stored documents; hosts with no such field (OpenAI's `/embeddings` API) ignore it, and host-specific +task types go in `providerOptions` (NVIDIA's `input_type: "passage"`). `response.usage.inputTokens` is the host's +token count, and its raw usage stays in `providerMetadata`. Media values fail the call on hosts that only embed text. + +```ts +import { + Alibaba, + Azure, + Cohere, + DeepInfra, + DigitalOcean, + Fireworks, + OpenAICompatible, + OpenRouter, + VercelAIGateway, +} from "@opencode/ai/providers" + +OpenRouter.configure().embedding("openai/text-embedding-3-small") +VercelAIGateway.configure().embedding("openai/text-embedding-3-small") +Cohere.configure().embedding("embed-v4.0") +DeepInfra.configure().embedding("BAAI/bge-m3") +Fireworks.configure().embedding("nomic-ai/nomic-embed-text-v1.5") +DigitalOcean.configure().embedding("bge-m3") +Alibaba.configure({ region: "ap-southeast-1" }).embedding("text-embedding-v4") +Azure.configure({ resourceName }).embedding("text-embedding-3-small") +OpenAICompatible.configure({ provider: "nvidia", baseURL: "https://integrate.api.nvidia.com/v1" }).embedding( + "nvidia/nemotron-3.5-embed-1b", +) +``` + +Every host here uses OpenAI's `/embeddings` API; Cohere through its compatibility API +(`https://api.cohere.ai/compatibility/v1`). Package entry points are `@opencode/ai/providers//embeddings`. + +Google embeds through `embedContent`, which also takes images, audio, video and PDFs on `gemini-embedding-2`. Each +value is its own content and gets its own vector (several parts in one content would be averaged into one). `dimensions` +is `outputDimensionality`, `inputType` becomes `taskType` `RETRIEVAL_QUERY` or `RETRIEVAL_DOCUMENT`, and `taskType` or +`title` in `providerOptions` replace or add to it. `gemini-embedding-2` ignores task types; Google recommends writing the +task into the text instead (`task: search result | query: …`, `title: none | text: …`). + +```ts +import { Google, GoogleVertex } from "@opencode/ai/providers" + +const response = await ai.embedding.generate({ + model: Google.configure().embedding("gemini-embedding-2"), + values: [await ai.file("./receipt.png"), "A receipt for two coffees."], + dimensions: 768, +}) + +GoogleVertex.configure({ project, location: "global" }).embedding("gemini-embedding-2") +``` + +`GoogleVertex.configure().embedding(id)` picks the API from the model id: `gemini-embedding-2*` uses `embedContent`, +and every other model (`gemini-embedding-001`, `text-embedding-005`, `text-multilingual-embedding-002`) uses the +text-only `:predict` API, which also works with Express Mode keys. On `:predict`, `inputType` and the `taskType` and +`title` options go on each instance (`task_type`, `title`), and `dimensions`, `autoTruncate` and other options go under +`parameters`. + +```ts +GoogleVertex.configure({ apiKey }).embedding("text-embedding-005") +GoogleVertex.configure({ apiKey }).embedding("gemini-embedding-001") +``` + +The Gemini API sends up to 100 values per `batchEmbedContents` request, and Vertex `:predict` up to 250 per request +(one for `gemini-embedding-001`, as Google documents). Vertex `embedContent` takes one value per request, so a call +sends one request per value, four at a time, and needs project credentials: Vertex Express Mode API keys can't call +`embedContent`. `gemini-embedding-2` runs in the `global`, `us` and `eu` Vertex locations. When a call +is split into several requests, the vectors stay in value order, `usage.inputTokens` is their sum, and each request's +metadata is listed in order under `providerMetadata..responses`. The package entry points are +`@opencode/ai/providers/google/embeddings` and `@opencode/ai/providers/google-vertex/embeddings`. + ## Alibaba Cloud Model Studio `Alibaba` provides standard Model Studio inference. Configure a region explicitly, then select @@ -956,8 +1047,9 @@ Everything below is exported from `@opencode/ai/effect` unless noted. - **`Media`** — the shared asset type (`Media.Asset`, `Media.Source`) and constructors used by messages, tool results, and media requests. - **`Generation`** — provider-neutral handle for an in-flight media generation (`await`, `refresh`, `cancel`, `events`) used by queued media routes. - **`ai.decision.request` / `ai.decision.generate`** — typed predicate, choice, and score questions over text, JSON, and media input; `DecisionClient` is its Effect service and layer. +- **`ai.embedding.request` / `ai.embedding.generate`** — one vector per text or media value, with optional `dimensions` and `inputType`; `EmbeddingClient` is its Effect service and layer. - **`AIClient.layer` / `AIClient.layerWith(executor)`** — every modality client plus the request executor in one layer. -- **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `compact`, `canCompact`) at the top level plus `image` and `decision` (plus `experimental.video`, `experimental.speech`, and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer? })` builds a client over a custom executor. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`. +- **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `compact`, `canCompact`) at the top level plus `image`, `decision` and `embedding` (plus `experimental.video`, `experimental.speech`, and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer? })` builds a client over a custom executor. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`. - **`@opencode/ai/experimental`** — APIs that may change without compatibility guarantees: `Video`, `Speech`, `Transcription`, `Extraction`, and `Realtime`. See [Experimental](#experimental). ## Experimental diff --git a/packages/ai/example/tutorial.ts b/packages/ai/example/tutorial.ts index f02a2890d4..1266e53516 100644 --- a/packages/ai/example/tutorial.ts +++ b/packages/ai/example/tutorial.ts @@ -241,7 +241,7 @@ const generateFake = Effect.gen(function* () { }) // 8. Image generation uses the same facade and the same request/generate shape. -// `response.image` is a `Media.Asset`: bytes decode lazily and are cached, and +// `response.images[0]` is a `Media.Asset`: bytes decode lazily and are cached, and // `Media.write` persists them through the Effect `FileSystem`. const generateImage = Effect.gen(function* () { const response = yield* ai.image.generate({ @@ -253,10 +253,10 @@ const generateImage = Effect.gen(function* () { }) console.log("\n== image ==") - console.log("media type:", response.image.mediaType) - console.log("bytes:", (yield* response.image.bytes()).byteLength) + console.log("media type:", response.images[0].mediaType) + console.log("bytes:", (yield* response.images[0].bytes()).byteLength) console.log("usage", Formatter.formatJson(response.usage, { space: 2 })) - yield* Media.write(response.image, "tutorial-image.jpg").pipe(Effect.provide(NodeFileSystem.layer)) + yield* Media.write(response.images[0], "tutorial-image.jpg").pipe(Effect.provide(NodeFileSystem.layer)) }) // Provide every modality client and the HTTP request executor once with diff --git a/packages/ai/package.json b/packages/ai/package.json index 3c89a6c762..fc81f06bcd 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "2.2.5", + "version": "2.2.7", "name": "@opencode/ai", "type": "module", "license": "MIT", @@ -24,6 +24,7 @@ "./providers": "./src/providers.ts", "./providers/alibaba": "./src/providers/alibaba.ts", "./providers/alibaba/chat": "./src/providers/alibaba/chat.ts", + "./providers/alibaba/embeddings": "./src/providers/alibaba/embeddings.ts", "./providers/alibaba/images": "./src/providers/alibaba/images.ts", "./providers/alibaba/messages": "./src/providers/alibaba/messages.ts", "./providers/alibaba/responses": "./src/providers/alibaba/responses.ts", @@ -37,6 +38,7 @@ "./providers/assemblyai": "./src/providers/assemblyai.ts", "./providers/azure": "./src/providers/azure.ts", "./providers/azure/chat": "./src/providers/azure/chat.ts", + "./providers/azure/embeddings": "./src/providers/azure/embeddings.ts", "./providers/azure/images": "./src/providers/azure/images.ts", "./providers/azure/messages": "./src/providers/azure/messages.ts", "./providers/azure/responses": "./src/providers/azure/responses.ts", @@ -51,25 +53,31 @@ "./providers/cloudflare-workers-ai/images": "./src/providers/cloudflare-workers-ai/images.ts", "./providers/cohere": "./src/providers/cohere.ts", "./providers/cohere/chat": "./src/providers/cohere/chat.ts", + "./providers/cohere/embeddings": "./src/providers/cohere/embeddings.ts", "./providers/deepgram": "./src/providers/deepgram.ts", "./providers/deepinfra": "./src/providers/deepinfra.ts", + "./providers/deepinfra/embeddings": "./src/providers/deepinfra/embeddings.ts", "./providers/deepseek": "./src/providers/deepseek.ts", "./providers/digitalocean": "./src/providers/digitalocean.ts", "./providers/digitalocean/decisions": "./src/providers/digitalocean/decisions.ts", + "./providers/digitalocean/embeddings": "./src/providers/digitalocean/embeddings.ts", "./providers/digitalocean/images": "./src/providers/digitalocean/images.ts", "./providers/digitalocean/responses": "./src/providers/digitalocean/responses.ts", "./providers/elevenlabs": "./src/providers/elevenlabs.ts", "./providers/fireworks": "./src/providers/fireworks.ts", + "./providers/fireworks/embeddings": "./src/providers/fireworks/embeddings.ts", "./providers/google": "./src/providers/google.ts", "./providers/google-vertex": "./src/providers/google-vertex.ts", "./providers/google-vertex-messages": "./src/providers/google-vertex-messages.ts", "./providers/google-vertex/chat": "./src/providers/google-vertex/chat.ts", + "./providers/google-vertex/embeddings": "./src/providers/google-vertex/embeddings.ts", "./providers/google-vertex/gemini": "./src/providers/google-vertex/gemini.ts", "./providers/google-vertex/images": "./src/providers/google-vertex/images.ts", "./providers/google-vertex/interactions": "./src/providers/google-vertex/interactions.ts", "./providers/google-vertex/messages": "./src/providers/google-vertex/messages.ts", "./providers/google-vertex/mistral": "./src/providers/google-vertex/mistral.ts", "./providers/google-vertex/responses": "./src/providers/google-vertex/responses.ts", + "./providers/google/embeddings": "./src/providers/google/embeddings.ts", "./providers/google/images": "./src/providers/google/images.ts", "./providers/google/interactions": "./src/providers/google/interactions.ts", "./providers/groq": "./src/providers/groq.ts", @@ -91,15 +99,19 @@ "./providers/openai": "./src/providers/openai.ts", "./providers/openai-compatible": "./src/providers/openai-compatible.ts", "./providers/openai-compatible-responses": "./src/providers/openai-compatible-responses.ts", + "./providers/openai-compatible/decisions": "./src/providers/openai-compatible/decisions.ts", + "./providers/openai-compatible/embeddings": "./src/providers/openai-compatible/embeddings.ts", "./providers/openai-compatible/images": "./src/providers/openai-compatible/images.ts", "./providers/openai-compatible/responses": "./src/providers/openai-compatible/responses.ts", "./providers/openai/chat": "./src/providers/openai/chat.ts", + "./providers/openai/embeddings": "./src/providers/openai/embeddings.ts", "./providers/openai/images": "./src/providers/openai/images.ts", "./providers/openai/responses": "./src/providers/openai/responses.ts", "./providers/opencode": "./src/providers/opencode.ts", "./providers/opencode/decisions": "./src/providers/opencode/decisions.ts", "./providers/openrouter": "./src/providers/openrouter.ts", "./providers/openrouter/decisions": "./src/providers/openrouter/decisions.ts", + "./providers/openrouter/embeddings": "./src/providers/openrouter/embeddings.ts", "./providers/openrouter/images": "./src/providers/openrouter/images.ts", "./providers/openrouter/responses": "./src/providers/openrouter/responses.ts", "./providers/runway": "./src/providers/runway.ts", @@ -111,6 +123,7 @@ "./providers/vercel-ai-gateway": "./src/providers/vercel-ai-gateway.ts", "./providers/vercel-ai-gateway/chat": "./src/providers/vercel-ai-gateway/chat.ts", "./providers/vercel-ai-gateway/decisions": "./src/providers/vercel-ai-gateway/decisions.ts", + "./providers/vercel-ai-gateway/embeddings": "./src/providers/vercel-ai-gateway/embeddings.ts", "./providers/vercel-ai-gateway/images": "./src/providers/vercel-ai-gateway/images.ts", "./providers/vercel-ai-gateway/messages": "./src/providers/vercel-ai-gateway/messages.ts", "./providers/vercel-ai-gateway/responses": "./src/providers/vercel-ai-gateway/responses.ts", @@ -133,6 +146,7 @@ "./protocols/google-transcription": "./src/protocols/google-transcription.ts", "./protocols/openai-chat": "./src/protocols/openai-chat.ts", "./protocols/openai-decisions": "./src/protocols/openai-decisions.ts", + "./protocols/openai-embeddings": "./src/protocols/openai-embeddings.ts", "./protocols/openai-images": "./src/protocols/openai-images.ts", "./protocols/openai-responses": "./src/protocols/openai-responses.ts", "./protocols/openai-speech": "./src/protocols/openai-speech.ts", diff --git a/packages/ai/src/ai-client.ts b/packages/ai/src/ai-client.ts index d8ac3e4ada..71a716c289 100644 --- a/packages/ai/src/ai-client.ts +++ b/packages/ai/src/ai-client.ts @@ -1,5 +1,6 @@ import { Layer } from "effect" import { DecisionClient } from "./decision-client.js" +import { EmbeddingClient } from "./embedding-client.js" import { ImageClient } from "./image-client.js" import { LLMClient } from "./route/client.js" import { RequestExecutor } from "./route/executor.js" @@ -16,6 +17,7 @@ export const layerWith = (executor: Layer.Layer diff --git a/packages/ai/src/effect.ts b/packages/ai/src/effect.ts index b8cf5acbf3..7f3d88461c 100644 --- a/packages/ai/src/effect.ts +++ b/packages/ai/src/effect.ts @@ -1,4 +1,5 @@ import { Decision } from "./decision.js" +import { Embedding } from "./embedding.js" import { Image } from "./image.js" import { LLM } from "./llm.js" import { Speech } from "./speech.js" @@ -16,6 +17,7 @@ export const ai = { canCompact: LLM.canCompact, image: Image, decision: Decision, + embedding: Embedding, /** Experimental: may change without compatibility guarantees. */ experimental: { speech: Speech, @@ -32,6 +34,8 @@ export { ProviderPackage } from "./provider-package.js" export type { LLMClientService } from "./route/client.js" export { DecisionClient } from "./decision-client.js" export { DecisionRoute } from "./route/decision.js" +export { EmbeddingClient } from "./embedding-client.js" +export { EmbeddingRoute } from "./route/embedding.js" export { Generation } from "./generation.js" export { ToolFailure, emptyInputJsonSchema, toDefinitions, tool } from "./tool.js" export { ToolRuntime } from "./tool-runtime.js" diff --git a/packages/ai/src/embedding-client.ts b/packages/ai/src/embedding-client.ts new file mode 100644 index 0000000000..127d87ac30 --- /dev/null +++ b/packages/ai/src/embedding-client.ts @@ -0,0 +1,46 @@ +import { Context, Effect, Layer } from "effect" +import type { EmbeddingModel, EmbeddingOptions, EmbeddingRequest, EmbeddingResponse } from "./embedding.js" +import { RequestExecutor } from "./route/executor.js" +import { AIError, InvalidProviderOutputError } from "./schema/index.js" + +export type Execute = RequestExecutor.Interface["execute"] + +export interface Interface { + readonly generate: ( + request: EmbeddingRequest>, + ) => Effect.Effect +} + +export class Service extends Context.Service()("@opencode/AI/EmbeddingClient") {} + +export const generate = ( + request: EmbeddingRequest>, +): Effect.Effect => Effect.flatMap(Service, (client) => client.generate(request)) + +export const layer: Layer.Layer = Layer.effect( + Service, + Effect.gen(function* () { + const executor = yield* RequestExecutor.Service + return Service.of({ + generate: Effect.fnUntraced(function* (request) { + const route = request.model.route + const response = yield* route.generate(request, executor.execute) + if (response.embeddings.length === request.values.length) return response + return yield* new AIError({ + reason: new InvalidProviderOutputError({ + route: route.id, + message: `Expected ${request.values.length} embeddings, got ${response.embeddings.length}`, + }), + }) + }), + }) + }), +) +export const fetchLayer = layer.pipe(Layer.provideMerge(RequestExecutor.fetchLayer)) + +export const EmbeddingClient = { + Service, + layer, + fetchLayer, + generate, +} as const diff --git a/packages/ai/src/embedding.ts b/packages/ai/src/embedding.ts new file mode 100644 index 0000000000..a8039fb946 --- /dev/null +++ b/packages/ai/src/embedding.ts @@ -0,0 +1,163 @@ +import { Effect, Schema } from "effect" +import { EmbeddingClient, Service, type Execute } from "./embedding-client.js" +import { Media } from "./media.js" +import { tryRequest } from "./media-model.js" +import { + type AIError, + type BaseRequest, + type HttpOptions, + ModelID, + ProviderID, + ProviderMetadata, + ProviderOptions, +} from "./schema/index.js" + +// --------------------------------------------------------------------------- +// Input +// --------------------------------------------------------------------------- + +/** One value to embed: text, or a media asset for hosts that embed images, audio or documents. */ +export const EmbeddingValue = Schema.Union([Schema.String, Media.AssetSchema]) +export type EmbeddingValue = Schema.Schema.Type + +/** A string is always text; media is an `Asset` or plain bytes or a URL, normalized with `Media.make`. */ +export type EmbeddingValueInput = string | Exclude + +/** + * What the vectors are for: a search `query`, or a `document` stored to be searched. Hosts without such a field embed + * both the same way and ignore it. + */ +export type EmbeddingInputType = "query" | "document" + +// --------------------------------------------------------------------------- +// Model +// --------------------------------------------------------------------------- + +export type EmbeddingOptions = Record + +/** What an embedding model's route does; `EmbeddingRoute.make(...).model(...)` builds one from a protocol. */ +export interface EmbeddingModelRoute { + readonly id: string + generate(request: EmbeddingRequest>, execute: Execute): Effect.Effect +} + +export class EmbeddingModel { + declare protected readonly _Options: Options + readonly id: ModelID + readonly provider: ProviderID + readonly route: EmbeddingModelRoute + readonly http?: HttpOptions + /** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */ + readonly providerOptions?: ProviderOptions + + constructor(input: EmbeddingModel.Input) { + this.id = input.id + this.provider = input.provider + this.route = input.route + this.http = input.http + this.providerOptions = input.providerOptions + } + + static make(input: EmbeddingModel.MakeInput) { + return new EmbeddingModel({ + ...input, + id: ModelID.make(input.id), + provider: ProviderID.make(input.provider), + }) + } +} + +export namespace EmbeddingModel { + export interface Input { + readonly id: ModelID + readonly provider: ProviderID + readonly route: EmbeddingModelRoute + readonly http?: HttpOptions + readonly providerOptions?: ProviderOptions + } + + export interface MakeInput + extends Omit, "id" | "provider"> { + readonly id: string | ModelID + readonly provider: string | ProviderID + } +} + +export const EmbeddingModelSchema = Schema.declare( + (value): value is EmbeddingModel => value instanceof EmbeddingModel, + { expected: "Embedding.Model" }, +) + +export type EmbeddingModelOptions = Model extends EmbeddingModel ? Options : never + +// --------------------------------------------------------------------------- +// Request and response +// --------------------------------------------------------------------------- + +const EmbeddingRequestSchema = Schema.Struct({ + model: EmbeddingModelSchema, + values: Schema.Array(EmbeddingValue).pipe( + Schema.refine((x): x is typeof x => x.length > 0, { message: "Embedding values must not be empty" }), + ), + dimensions: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))), + inputType: Schema.optional(Schema.Literals(["query", "document"])), + providerOptions: Schema.optional(ProviderOptions), +}) + +/** A normalized embedding request, the plain object `ai.embedding.request(...)` returns. */ +export interface EmbeddingRequest + extends BaseRequest> { + readonly values: ReadonlyArray + /** Requested vector length, for models that can shorten their output. */ + readonly dimensions?: number + readonly inputType?: EmbeddingInputType +} + +/** Input accepted by `ai.embedding.request` and `generate`. An `EmbeddingRequest` is also a valid input. */ +export interface EmbeddingRequestInput + extends BaseRequest>> { + readonly values: ReadonlyArray + readonly dimensions?: number + readonly inputType?: EmbeddingInputType +} + +/** What embedding hosts report; their raw usage stays in the response's `providerMetadata`. */ +export class EmbeddingUsage extends Schema.Class("Embedding.Usage")({ + inputTokens: Schema.optional(Schema.Number), +}) {} + +export class EmbeddingResponse extends Schema.Class("Embedding.Response")({ + /** One vector per value, in value order. */ + embeddings: Schema.Array(Schema.Array(Schema.Number)), + usage: Schema.optional(EmbeddingUsage), + providerMetadata: Schema.optional(ProviderMetadata), +}) {} + +// --------------------------------------------------------------------------- +// Call API +// --------------------------------------------------------------------------- + +/** Normalize embedding request input into a plain `EmbeddingRequest`; non-string values become `Media.Asset`s. */ +export const request = ( + input: EmbeddingRequestInput, +): EmbeddingRequest => ({ + ...input, + values: input.values.map((value) => (typeof value === "string" ? value : Media.make(value))), +}) + +const validate = Schema.decodeUnknownSync(EmbeddingRequestSchema) + +export function generate( + input: EmbeddingRequestInput, +): Effect.Effect { + return tryRequest(() => { + const normalized = request(input) + validate(normalized) + return normalized + }).pipe(Effect.flatMap(EmbeddingClient.generate)) +} + +export const Embedding = { + request, + generate, +} as const diff --git a/packages/ai/src/image-client.ts b/packages/ai/src/image-client.ts index 5c5846635a..44e819e389 100644 --- a/packages/ai/src/image-client.ts +++ b/packages/ai/src/image-client.ts @@ -1,6 +1,6 @@ import { Context } from "effect" import { MediaClient } from "./media-client.js" -import { ImageOutputEvent, ImageFinishEvent, type ImageEvent, type ImageRequest, type ImageResponse } from "./image.js" +import type { ImageEvent, ImageRequest, ImageResponse } from "./image.js" export type Interface = MediaClient.Interface @@ -13,11 +13,8 @@ export const ImageClient = { ...MediaClient.make(Service, { modality: "image", responseEvents: (response: ImageResponse) => [ - ...response.images.map((image, index) => ImageOutputEvent.make({ index, image })), - ImageFinishEvent.make({ - usage: response.usage, - providerMetadata: response.providerMetadata, - }), + ...response.images.map((image, index) => ({ type: "image" as const, index, image })), + { type: "finish" as const, usage: response.usage, providerMetadata: response.providerMetadata }, ], }), } as const diff --git a/packages/ai/src/image.ts b/packages/ai/src/image.ts index 27533df5ce..fb242669dd 100644 --- a/packages/ai/src/image.ts +++ b/packages/ai/src/image.ts @@ -106,11 +106,7 @@ export class ImageResponse extends Schema.Class("Image.Response") images: Schema.Array(Media.AssetSchema), usage: Schema.optional(MediaUsage), providerMetadata: Schema.optional(ProviderMetadata), -}) { - get image() { - return this.images[0] - } -} +}) {} /** The `index`-th lower-fidelity preview of an image still generating; the `image` event supersedes it. */ export const ImagePartialEvent = Schema.Struct({ diff --git a/packages/ai/src/index.ts b/packages/ai/src/index.ts index 35e4cea568..32823a8c9a 100644 --- a/packages/ai/src/index.ts +++ b/packages/ai/src/index.ts @@ -1,6 +1,7 @@ import { Effect, Layer, ManagedRuntime, Schema, Stream } from "effect" import { AIClient } from "./ai-client.js" import { Decision, type DecisionModel, type DecisionQuestions, type DecisionRequestInput } from "./decision.js" +import { Embedding, type EmbeddingModel, type EmbeddingRequestInput } from "./embedding.js" import type { AwaitOptions, Event, Generation, Snapshot } from "./generation.js" import { Image, type ImageModel, type ImageRequest, type ImageRequestInput } from "./image.js" import { LLM } from "./llm.js" @@ -45,8 +46,8 @@ import { Video, type VideoModel, type VideoRequest, type VideoRequestInput } fro /** * Promise-first entrypoint for scripts and non-Effect callers. One `ManagedRuntime` hosts the LLM, image, video, speech, - * transcription and decision clients over a request executor; every method runs the corresponding Effect API and rethrows - * `AIError` unchanged. `file` and `write` load `node:fs/promises` on first use, so importing this module does not. + * transcription, decision and embedding clients over a request executor; every method runs the corresponding Effect API + * and rethrows `AIError` unchanged. `file` and `write` load `node:fs/promises` on first use, so importing this module does not. */ export interface Options { /** Executor layer; defaults to `RequestExecutor.fetchLayer`. Inject a recorder or `RequestExecutor.middleware(fn)` here. */ @@ -249,6 +250,11 @@ export const make = (options: Options = {}) => { options?: RunOptions, ) => run(Decision.generate(input), options), }, + embedding: { + request: Embedding.request, + generate: (input: EmbeddingRequestInput, options?: RunOptions) => + run(Embedding.generate(input), options), + }, /** Experimental: may change without compatibility guarantees. */ experimental: { speech: { diff --git a/packages/ai/src/protocols/alibaba-chat.ts b/packages/ai/src/protocols/alibaba-chat.ts index b016c4b791..6913c1cbe2 100644 --- a/packages/ai/src/protocols/alibaba-chat.ts +++ b/packages/ai/src/protocols/alibaba-chat.ts @@ -1,6 +1,6 @@ import { Effect, Schema } from "effect" import { Protocol } from "../route/protocol.js" -import type { LanguageModelCompatibility } from "../schema/index.js" +import type { LanguageModelCompatibility, Capabilities } from "../schema/index.js" import { OpenAIChat } from "./openai-chat.js" import { JsonObject, ProviderShared } from "./shared.js" import { cacheControl } from "./utils/cache.js" @@ -41,11 +41,12 @@ export type OptionsInput = typeof Options.Type export const compatibility = { maxTokensField: "max_completion_tokens", - supportsStrictMode: false, reasoningField: "reasoning_content", zaiToolStream: false, } satisfies LanguageModelCompatibility +export const capabilities = { tools: { strict: false } } satisfies Capabilities + export const protocol = Protocol.make({ id: "alibaba-chat", body: { diff --git a/packages/ai/src/protocols/anthropic-messages.ts b/packages/ai/src/protocols/anthropic-messages.ts index 119cea7df7..0fa7a6cb27 100644 --- a/packages/ai/src/protocols/anthropic-messages.ts +++ b/packages/ai/src/protocols/anthropic-messages.ts @@ -745,6 +745,8 @@ const requireThinkingSignature = (request: LLMRequest) => { // Opus 4.8 and every Claude 5 model accept mid-conversation system messages; later versions inherit support. const supportsNativeSystemUpdates = (request: LLMRequest) => { + const override = request.model.capabilities?.systemUpdates + if (override !== undefined) return override const version = claudeVersion(request.model.id) if (version === undefined) return false if (version.family === "opus" && version.major === 4) return version.minor >= 8 @@ -913,15 +915,14 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, breakpoi return messages }) -// TODO: Move per-model capability heuristics (`supportsEffortUpdates`, `supportsNativeSystemUpdates`, -// `supportsThinkingBlockBinding`) into explicit model/provider `compatibility` metadata so the protocol -// only reads `request.model.compatibility`. +// The model-ID checks below are fallbacks for models that leave `capabilities.reasoning.updates`, +// `capabilities.systemUpdates` and `compatibility.supportsThinkingBlockBinding` unset. const isThinkingOff = Schema.is(AnthropicThinkingDisabled) // Per-turn effort started with Claude Opus 5 and every Claude 5.1 model; later versions of any family inherit it. const supportsEffortUpdates = (request: LLMRequest) => { if (isThinkingOff(request.providerOptions?.thinking)) return false - const override = request.model.compatibility?.supportsEffortUpdates + const override = request.model.capabilities?.reasoning?.updates if (override !== undefined) return override const version = claudeVersion(request.model.id) if (version === undefined) return false @@ -1031,7 +1032,11 @@ const mapFinishReason = (reason: string | null | undefined): FinishReason => { // inclusive `inputTokens` the rest of the contract expects. Extended // thinking tokens are included in `output_tokens`; newer responses also // expose that subset through `output_tokens_details.thinking_tokens`. -const mapUsage = (usage: AnthropicUsage | undefined, providerMetadataKey: string): Usage | undefined => { +const mapUsage = ( + usage: AnthropicUsage | undefined, + providerMetadataKey: string, + frame?: AnthropicEvent, +): Usage | undefined => { if (!usage) return undefined const iterations = usage.iterations?.length ? usage.iterations : [usage] const last = usage.iterations?.at(-1) @@ -1058,7 +1063,7 @@ const mapUsage = (usage: AnthropicUsage | undefined, providerMetadataKey: string cacheWriteInputTokens: cacheWrite, reasoningTokens: ProviderShared.sumTokens(...iterations.map((item) => item.output_tokens_details?.thinking_tokens)), totalTokens: ProviderShared.totalTokens(inputTokens, outputTokens, undefined), - ...ProviderShared.reportedBilling(usage), + ...ProviderShared.reportedBilling(usage, frame), providerMetadata: { [providerMetadataKey]: usage }, }) } @@ -1330,7 +1335,11 @@ const onMessageDelta = ( state: ParserState, event: AnthropicEvent & { readonly delta?: AnthropicStreamDelta }, ): StepResult => { - const usage = mergeUsage(state.usage, mapUsage(event.usage, state.providerMetadataKey), state.providerMetadataKey) + const usage = mergeUsage( + state.usage, + mapUsage(event.usage, state.providerMetadataKey, event), + state.providerMetadataKey, + ) const pendingFinish = (() => { const stopReason = event.delta?.stop_reason if (stopReason === null || stopReason === undefined) return state.pendingFinish diff --git a/packages/ai/src/protocols/google-embed-content.ts b/packages/ai/src/protocols/google-embed-content.ts new file mode 100644 index 0000000000..1ed2d78d3f --- /dev/null +++ b/packages/ai/src/protocols/google-embed-content.ts @@ -0,0 +1,165 @@ +import { Effect, Schema } from "effect" +import { EmbeddingResponse, EmbeddingUsage, type EmbeddingRequest } from "../embedding.js" +import { EmbeddingRoute } from "../route/embedding.js" +import { Endpoint } from "../route/endpoint.js" +import { MediaProtocol } from "../route/media-protocol.js" +import { mergeJsonRecords, type AIError, type OpenString } from "../schema/index.js" +import { GeminiGenerateContent } from "./utils/gemini-generate-content.js" + +const ID = "google-embed-content" +const NAME = "Google embedContent" +export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta" +/** `batchEmbedContents` takes at most 100 requests. */ +export const MAX_BATCH = 100 + +export type TaskType = OpenString< + | "RETRIEVAL_QUERY" + | "RETRIEVAL_DOCUMENT" + | "SEMANTIC_SIMILARITY" + | "CLASSIFICATION" + | "CLUSTERING" + | "QUESTION_ANSWERING" + | "FACT_VERIFICATION" + | "CODE_RETRIEVAL_QUERY" +> + +/** + * Per-value embedding fields, sent with each value. `taskType` replaces the one `inputType` maps to; Gemini Embedding 2 + * ignores task types and documents task prefixes in the text instead (`task: search result | query: …`). + */ +export interface OptionsInput { + readonly [key: string]: unknown + readonly taskType?: TaskType + readonly title?: string +} + +/** Vertex `embedContentConfig` fields; Vertex alone takes `autoTruncate`, `documentOcr` and `audioTrackExtraction`. */ +export interface VertexOptionsInput extends OptionsInput { + readonly autoTruncate?: boolean + readonly documentOcr?: boolean + readonly audioTrackExtraction?: boolean +} + +const Values = Schema.Struct({ values: Schema.Array(Schema.Number) }) + +const UsageMetadata = Schema.StructWithRest(Schema.Struct({ promptTokenCount: Schema.optional(Schema.Number) }), [ + Schema.Record(Schema.String, Schema.Unknown), +]) + +const BatchResponse = Schema.Struct({ + embeddings: Schema.Array(Values), + usageMetadata: Schema.optional(UsageMetadata), +}) + +const SingleResponse = Schema.Struct({ + embedding: Values, + usageMetadata: Schema.optional(UsageMetadata), + truncated: Schema.optional(Schema.Boolean), +}) + +const TASK_TYPES = { query: "RETRIEVAL_QUERY", document: "RETRIEVAL_DOCUMENT" } as const + +// Each value is its own content: several parts in one content embed into one aggregated vector. +const content = (value: EmbeddingRequest["values"][number]): Effect.Effect<{ readonly parts: [unknown] }, AIError> => + typeof value === "string" + ? Effect.succeed({ parts: [{ text: value }] }) + : GeminiGenerateContent.mediaPart(NAME, value).pipe(Effect.map((part) => ({ parts: [part] }))) + +const config = (request: EmbeddingRequest) => ({ + ...(request.inputType === undefined ? {} : { taskType: TASK_TYPES[request.inputType] }), + ...(request.dimensions === undefined ? {} : { outputDimensionality: request.dimensions }), + ...request.providerOptions, +}) + +const identity = MediaProtocol.identity({ id: ID, name: NAME, provider: "google" }) +const decodeBatch = identity.decodeJson(BatchResponse) +const decodeSingle = identity.decodeJson(SingleResponse) + +const usage = (metadata: Schema.Schema.Type | undefined) => + metadata?.promptTokenCount === undefined ? undefined : new EmbeddingUsage({ inputTokens: metadata.promptTokenCount }) + +/** Gemini API `batchEmbedContents`: one request per value, so every value gets its own vector. */ +export const protocol = EmbeddingRoute.protocol({ + id: ID, + name: NAME, + body: { + from: Effect.fn("GoogleEmbedContent.fromRequest")(function* (request: EmbeddingRequest) { + const contents = yield* Effect.forEach(request.values, content) + const fields = config(request) + return ( + mergeJsonRecords( + { requests: contents.map((item) => ({ model: `models/${request.model.id}`, content: item, ...fields })) }, + request.http?.body, + ) ?? {} + ) + }), + }, + response: { + decode: Effect.fn("GoogleEmbedContent.decodeResponse")(function* (response, context) { + const output = yield* decodeBatch(response) + return new EmbeddingResponse({ + embeddings: output.value.embeddings.map((item) => item.values), + usage: usage(output.value.usageMetadata), + providerMetadata: { + [context.providerMetadataKey]: + output.value.usageMetadata === undefined ? {} : { usageMetadata: output.value.usageMetadata }, + }, + }) + }), + }, +}) + +/** + * Vertex `embedContent`: one content per request, with options under `embedContentConfig`. Routes using it set + * `maxValues: 1`. + */ +export const vertexProtocol = EmbeddingRoute.protocol({ + id: "google-vertex-embed-content", + name: "Google Vertex embedContent", + body: { + from: Effect.fn("GoogleEmbedContent.vertexFromRequest")(function* (request: EmbeddingRequest) { + const contents = yield* Effect.forEach(request.values, content) + const fields = config(request) + return ( + mergeJsonRecords( + { + content: contents[0], + ...(Object.keys(fields).length === 0 ? {} : { embedContentConfig: fields }), + }, + request.http?.body, + ) ?? {} + ) + }), + }, + response: { + decode: Effect.fn("GoogleEmbedContent.vertexDecodeResponse")(function* (response, context) { + const output = yield* decodeSingle(response) + return new EmbeddingResponse({ + embeddings: [output.value.embedding.values], + usage: usage(output.value.usageMetadata), + providerMetadata: { + [context.providerMetadataKey]: { + ...(output.value.usageMetadata === undefined ? {} : { usageMetadata: output.value.usageMetadata }), + ...(output.value.truncated === undefined ? {} : { truncated: output.value.truncated }), + }, + }, + }) + }), + }, +}) + +export const route = EmbeddingRoute.make({ + id: ID, + provider: "google", + protocol, + endpoint: Endpoint.path(({ request }) => `/models/${request.model.id}:batchEmbedContents`, { + baseURL: DEFAULT_BASE_URL, + }), + maxValues: MAX_BATCH, +}) + +export const GoogleEmbedContent = { + protocol, + vertexProtocol, + route, +} as const diff --git a/packages/ai/src/protocols/google-vertex-predict-embeddings.ts b/packages/ai/src/protocols/google-vertex-predict-embeddings.ts new file mode 100644 index 0000000000..a6a3d9f3e3 --- /dev/null +++ b/packages/ai/src/protocols/google-vertex-predict-embeddings.ts @@ -0,0 +1,104 @@ +import { Effect, Schema } from "effect" +import { EmbeddingResponse, EmbeddingUsage, type EmbeddingRequest } from "../embedding.js" +import { EmbeddingRoute } from "../route/embedding.js" +import { MediaProtocol } from "../route/media-protocol.js" +import { AIError, UnsupportedOperationError, mergeJsonRecords } from "../schema/index.js" +import type { TaskType } from "./google-embed-content.js" + +const ID = "google-vertex-predict-embeddings" +const NAME = "Google Vertex text embeddings" +/** `text-embedding-005` and `text-multilingual-embedding-002` take up to 250 instances per request. */ +export const MAX_INSTANCES = 250 + +/** + * The same option names as `embedContent`, so a model can move between the two APIs: `taskType` and `title` go on + * each instance (`task_type`, `title`), and `autoTruncate` and anything else go under `parameters`. + */ +export interface OptionsInput { + readonly [key: string]: unknown + readonly taskType?: TaskType + readonly title?: string + readonly autoTruncate?: boolean +} + +const Statistics = Schema.StructWithRest( + Schema.Struct({ token_count: Schema.optional(Schema.Number), truncated: Schema.optional(Schema.Boolean) }), + [Schema.Record(Schema.String, Schema.Unknown)], +) + +const Response = Schema.Struct({ + predictions: Schema.Array( + Schema.Struct({ + embeddings: Schema.Struct({ values: Schema.Array(Schema.Number), statistics: Schema.optional(Statistics) }), + }), + ), + metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)), +}) + +const TASK_TYPES = { query: "RETRIEVAL_QUERY", document: "RETRIEVAL_DOCUMENT" } as const + +const fromRequest = Effect.fn("GoogleVertexPredictEmbeddings.fromRequest")(function* (request: EmbeddingRequest) { + const contents = request.values.filter((value) => typeof value === "string") + if (contents.length !== request.values.length) + return yield* new AIError({ + reason: new UnsupportedOperationError({ + operation: "embedding.media", + provider: request.model.provider, + route: request.model.route.id, + message: `${request.model.id} on Vertex :predict embeds text only; use gemini-embedding-2 for media values`, + }), + }) + const { taskType, title, ...parameters } = request.providerOptions ?? {} + const instance = { + ...(taskType === undefined + ? request.inputType === undefined + ? {} + : { task_type: TASK_TYPES[request.inputType] } + : { task_type: taskType }), + ...(title === undefined ? {} : { title }), + } + const merged = { + ...(request.dimensions === undefined ? {} : { outputDimensionality: request.dimensions }), + ...parameters, + } + return ( + mergeJsonRecords( + { + instances: contents.map((content) => ({ content, ...instance })), + ...(Object.keys(merged).length === 0 ? {} : { parameters: merged }), + }, + request.http?.body, + ) ?? {} + ) +}) + +const decodeDocument = MediaProtocol.identity({ id: ID, name: NAME, provider: "google-vertex" }).decodeJson(Response) + +export const protocol = EmbeddingRoute.protocol({ + id: ID, + name: NAME, + body: { from: fromRequest }, + response: { + decode: Effect.fn("GoogleVertexPredictEmbeddings.decodeResponse")(function* (response, context) { + const output = yield* decodeDocument(response) + const statistics = output.value.predictions.map((prediction) => prediction.embeddings.statistics ?? {}) + const tokens = statistics.map((item) => item.token_count) + return new EmbeddingResponse({ + embeddings: output.value.predictions.map((prediction) => prediction.embeddings.values), + usage: tokens.every((count) => count !== undefined) + ? new EmbeddingUsage({ inputTokens: tokens.reduce((sum, count) => sum + count, 0) }) + : undefined, + providerMetadata: { + [context.providerMetadataKey]: { + statistics, + ...(output.value.metadata === undefined ? {} : { metadata: output.value.metadata }), + }, + }, + }) + }), + }, +}) + +export const GoogleVertexPredictEmbeddings = { + protocol, +} as const diff --git a/packages/ai/src/protocols/index.ts b/packages/ai/src/protocols/index.ts index 145e9a52da..14baffe0a2 100644 --- a/packages/ai/src/protocols/index.ts +++ b/packages/ai/src/protocols/index.ts @@ -3,10 +3,13 @@ export * as BedrockConverse from "./bedrock-converse.js" export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js" export * as CohereChat from "./cohere-chat.js" export * as Gemini from "./gemini.js" +export * as GoogleEmbedContent from "./google-embed-content.js" export * as GoogleInteractions from "./google-interactions.js" +export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js" export * as MistralChat from "./mistral-chat.js" export * as OpenAIChat from "./openai-chat.js" export * as OpenAIDecisions from "./openai-decisions.js" +export * as OpenAIEmbeddings from "./openai-embeddings.js" export * as OpenAIImages from "./openai-images.js" export * as OpenAICompatibleChat from "./openai-compatible-chat.js" export * as OpenAICompatibleResponses from "./openai-compatible-responses.js" diff --git a/packages/ai/src/protocols/open-responses-channel.ts b/packages/ai/src/protocols/open-responses-channel.ts index ab47b0a053..e54680fc66 100644 --- a/packages/ai/src/protocols/open-responses-channel.ts +++ b/packages/ai/src/protocols/open-responses-channel.ts @@ -85,11 +85,7 @@ const observer = (options: Options) => { if (event.type === "response.created") { const created = event.response?.id if (responseID) - return yield* ProviderShared.eventError( - options.id, - `${options.name} emitted duplicate response.created`, - frame, - ) + return yield* ProviderShared.eventError(options.id, `${options.name} emitted duplicate response.created`, frame) if (!created) return yield* ProviderShared.eventError( options.id, @@ -108,11 +104,7 @@ const observer = (options: Options) => { frame, ) if (event.response?.id && event.response.id !== responseID) - return yield* ProviderShared.eventError( - options.id, - `${options.name} response ID changed during execution`, - frame, - ) + return yield* ProviderShared.eventError(options.id, `${options.name} response ID changed during execution`, frame) if (event.type === "response.completed") { terminal = true return { type: "completed", frame } diff --git a/packages/ai/src/protocols/open-responses.ts b/packages/ai/src/protocols/open-responses.ts index 27fe1865e1..4fd87951bf 100644 --- a/packages/ai/src/protocols/open-responses.ts +++ b/packages/ai/src/protocols/open-responses.ts @@ -890,7 +890,11 @@ export const fromRequest = (request: LLMRequest) => fromRequestWithAdapter(reque // cached-read and cache-write subsets, and `output_tokens` (inclusive total) // with a `reasoning_tokens` subset. Pass the totals through and derive the // non-cached breakdown. -export const mapUsage = (usage: OpenResponsesUsage | null | undefined, providerMetadataKey: string) => { +export const mapUsage = ( + usage: OpenResponsesUsage | null | undefined, + providerMetadataKey: string, + ...frames: ReadonlyArray +) => { if (!usage) return undefined const cached = usage.input_tokens_details?.cached_tokens const cacheWrite = usage.input_tokens_details?.cache_write_tokens @@ -904,11 +908,41 @@ export const mapUsage = (usage: OpenResponsesUsage | null | undefined, providerM cacheWriteInputTokens: cacheWrite, reasoningTokens: reasoning, totalTokens: ProviderShared.totalTokens(usage.input_tokens, usage.output_tokens, usage.total_tokens), - ...ProviderShared.reportedBilling(usage), + ...ProviderShared.reportedBilling(usage, ...frames), providerMetadata: { [providerMetadataKey]: usage }, }) } +// GitHub Copilot lists the filters that ran; the blocking one names its rule in `content_filter_raw`. +const decodeContentFilters = Schema.decodeUnknownOption( + Schema.Array( + Schema.Struct({ + source_type: Schema.optional(Schema.String), + blocked: Schema.optional(Schema.Boolean), + content_filter_raw: Schema.optional( + Schema.Array( + Schema.Struct({ + action: Schema.optional(Schema.String), + label: Schema.optional(Schema.String), + result: Schema.optional(Schema.Unknown), + }), + ), + ), + content_filter_results: Schema.optional(Schema.Unknown), + }), + ), +) + +const contentFilterCategory = (raw: unknown) => { + const blocked = Option.getOrElse(decodeContentFilters(raw), () => []).filter((filter) => filter.blocked) + const filter = blocked.find((item) => item.source_type === "completion") ?? blocked[0] + if (!filter) return undefined + return ( + filter.content_filter_raw?.find((rule) => rule.action === "BLOCK" && rule.result === true)?.label ?? + ProviderShared.contentFilterCategory(filter.content_filter_results) + ) +} + const mapFinishReason = (event: Event, hasFunctionCall: boolean): FinishReason => { const reason = event.response?.incomplete_details?.reason if (reason === undefined) { @@ -981,8 +1015,9 @@ const ITEM_ID_PREFIX: Readonly> = { compaction: "cmp", } -// An item without an id adopts the id already open in its output slot, -// otherwise it gets a locally minted one. +// An item adopts the id already open in its output slot, since GitHub Copilot +// sends a different id on every event, including the item's own done event. +// Otherwise it keeps its id or gets a locally minted one. const resolveItem = ( state: Pick, item: StreamItem, @@ -990,8 +1025,8 @@ const resolveItem = ( ): OutputItem => ({ ...item, id: - item.id ?? (index === undefined ? undefined : state.outputItems[index]) ?? + item.id ?? `${ITEM_ID_PREFIX[item.type] ?? "item"}_${crypto.randomUUID().replaceAll("-", "")}`, }) @@ -1392,12 +1427,15 @@ const onResponseFinish = Effect.fnUntraced(function* (state: ParserState, event: } events.push(...pending.events) } + const normalized = mapFinishReason(event, current.hasFunctionCall) const lifecycle = Lifecycle.finish(current.lifecycle, events, { reason: { - normalized: mapFinishReason(event, current.hasFunctionCall), + normalized, raw: event.response?.incomplete_details?.reason, + ...(normalized === "content-filter" ? { category: contentFilterCategory(event.response?.content_filters) } : {}), }, - usage: mapUsage(event.response?.usage, current.providerMetadataKey), + // Copilot reports its billing on the terminal event, beside `response`. + usage: mapUsage(event.response?.usage, current.providerMetadataKey, event, event.response), providerMetadata: event.response?.id || event.response?.service_tier ? providerMetadata(current, { diff --git a/packages/ai/src/protocols/openai-chat.ts b/packages/ai/src/protocols/openai-chat.ts index 274b597935..da0622e226 100644 --- a/packages/ai/src/protocols/openai-chat.ts +++ b/packages/ai/src/protocols/openai-chat.ts @@ -195,6 +195,7 @@ export const OpenAIChatMessage = Schema.Union([ reasoning: Schema.optional(Schema.String), reasoning_text: Schema.optional(Schema.String), reasoning_details: Schema.optional(Schema.Unknown), + reasoning_opaque: Schema.optional(Schema.String), }), [Schema.Record(Schema.String, Schema.Unknown)], ), @@ -264,6 +265,8 @@ export const OpenAIChatUsage = Schema.StructWithRest( prompt_cache_hit_tokens: optionalNull(Schema.Number), cache_read_input_tokens: optionalNull(Schema.Number), cache_created_input_tokens: optionalNull(Schema.Number), + // GitHub Copilot reports reasoning at the top level instead of in `completion_tokens_details`. + reasoning_tokens: optionalNull(Schema.Number), prompt_tokens_details: optionalNull( Schema.StructWithRest( Schema.Struct({ @@ -309,6 +312,8 @@ export const OpenAIChatDelta = Schema.StructWithRest( reasoning: optionalNull(Schema.String), reasoning_text: optionalNull(Schema.String), reasoning_details: optionalNull(Schema.Unknown), + // GitHub Copilot's opaque reasoning state, which must be replayed for multi-turn reasoning. + reasoning_opaque: optionalNull(Schema.String), tool_calls: optionalNull(Schema.Array(OpenAIChatToolCallDelta)), }), [Schema.Record(Schema.String, Schema.Unknown)], @@ -368,6 +373,8 @@ export interface ParserState { readonly reasoningTextObserved: boolean readonly reasoningDetails: Array readonly reasoningDetailsObserved: boolean + /** Latest `reasoning_opaque`; interleaved reasoning sends a new one before each tool call. */ + readonly reasoningOpaque?: string readonly reasoningEmitted: boolean readonly latestToolIndex?: number readonly nextToolIndex: number @@ -496,6 +503,13 @@ const lowerReasoningDetail = (detail: ReasoningDetail) => { return detail } +// Interleaved reasoning yields one opaque value per segment; like the Copilot VS Code +// client, replay the latest one with the concatenated reasoning text. +const reasoningOpaque = (parts: ReadonlyArray, providerMetadataKey: string) => + parts + .map((part) => part.providerMetadata?.[providerMetadataKey]?.reasoningOpaque) + .findLast((value) => typeof value === "string") + const isKimiDetail = (detail: { readonly type: string }) => detail.type === "summary" || detail.type === "encrypted" const lowerUserMessage = Effect.fnUntraced(function* (message: UserMessage, options: LoweringOptions) { @@ -560,7 +574,9 @@ const lowerAssistantMessage = Effect.fnUntraced(function* ( // even when thinking arrived only through structured details. if (details?.some(isKimiDetail)) return "reasoning_content" })() - const reasoningText = reasoning.length === 0 ? (requireReasoning ? "" : undefined) : text + const opaque = reasoningOpaque(reasoning, options.providerMetadataKey) + const reasoningText = + reasoning.length === 0 || (opaque !== undefined && text === "") ? (requireReasoning ? "" : undefined) : text const result = { role: "assistant" as const, content: (() => { @@ -570,6 +586,7 @@ const lowerAssistantMessage = Effect.fnUntraced(function* ( })(), ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}), ...(details !== undefined ? { reasoning_details: details } : {}), + ...(opaque !== undefined ? { reasoning_opaque: opaque } : {}), } if (field === undefined || reasoningText === undefined) return result return { ...result, [field]: reasoningText } @@ -830,7 +847,7 @@ const lowerOptions = (request: LLMRequest, supportsStore: boolean, hasActiveTool // the key where compatibility explicitly allows it. Header-based affinity // (x-session-affinity, x-grok-conv-id, ...) is unaffected. const cacheKey = - (request.model.compatibility?.supportsPromptCacheKey ?? false) ? ProviderShared.promptCacheKey(request) : undefined + (request.model.capabilities?.promptCacheKey ?? false) ? ProviderShared.promptCacheKey(request) : undefined return { ...(supportsStore ? { store: options.store ?? false } : {}), ...(cacheKey ? { prompt_cache_key: cacheKey } : {}), @@ -861,9 +878,8 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* ( const baseURL = request.model.route.endpoint.baseURL const detectedMaxTokensField = detectMaxTokensField(provider, baseURL) const maxTokensField = request.model.compatibility?.maxTokensField ?? detectedMaxTokensField - const supportsStore = request.model.compatibility?.supportsStore ?? detectSupportsStore(provider, baseURL) - const supportsStrictMode = - request.model.compatibility?.supportsStrictMode ?? detectSupportsStrictMode(provider, baseURL) + const supportsStore = request.model.capabilities?.store ?? detectSupportsStore(provider, baseURL) + const supportsStrictMode = request.model.capabilities?.tools?.strict ?? detectSupportsStrictMode(provider, baseURL) const zaiToolStream = request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id) const hasHistory = hasToolHistory(request.messages) @@ -881,7 +897,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* ( : flattened.tools.map((tool) => lowerTool(tool, lowering, supportsStrictMode, custom.get(tool.name))), tool_choice: hasActiveTools && request.toolChoice ? yield* lowerToolChoice(request.toolChoice, custom) : undefined, stream: true as const, - ...((request.model.compatibility?.streamUsage ?? true) ? { stream_options: { include_usage: true } } : {}), + ...((request.model.capabilities?.streamUsage ?? true) ? { stream_options: { include_usage: true } } : {}), ...(zaiToolStream && hasActiveTools ? { tool_stream: true } : {}), ...(maxTokensField === "max_completion_tokens" ? { max_completion_tokens: request.maxTokens } @@ -946,10 +962,14 @@ const mapFinishReason = Effect.fnUntraced(function* (event: OpenAIChatEvent, rea // `prompt_tokens_details.cached_tokens`, DeepSeek uses // `prompt_cache_hit_tokens`, Zai uses top-level `cached_tokens`, and // DigitalOcean uses top-level `cache_read_input_tokens` / `cache_created_input_tokens`. -const mapUsage = (usage: OpenAIChatEvent["usage"], providerMetadataKey: string): Usage | undefined => { +const mapUsage = ( + usage: OpenAIChatEvent["usage"], + providerMetadataKey: string, + frame: OpenAIChatEvent, +): Usage | undefined => { if (!usage) return undefined const input = usage.prompt_tokens ?? undefined - const output = usage.completion_tokens ?? undefined + const completion = usage.completion_tokens ?? undefined const cached = usage.prompt_tokens_details?.cached_tokens ?? usage.prompt_cache_hit_tokens ?? @@ -957,7 +977,14 @@ const mapUsage = (usage: OpenAIChatEvent["usage"], providerMetadataKey: string): usage.cache_read_input_tokens ?? undefined const cacheWrite = usage.prompt_tokens_details?.cache_write_tokens ?? usage.cache_created_input_tokens ?? undefined - const reasoning = usage.completion_tokens_details?.reasoning_tokens ?? undefined + const reasoning = usage.completion_tokens_details?.reasoning_tokens ?? usage.reasoning_tokens ?? undefined + // Copilot's Gemini counts reasoning beside `completion_tokens` rather than inside it; the total tells which. + const output = + completion !== undefined && + reasoning !== undefined && + usage.total_tokens === ProviderShared.sumTokens(input, completion, reasoning) + ? completion + reasoning + : completion const nonCached = ProviderShared.subtractTokens(input, ProviderShared.sumTokens(cached, cacheWrite)) return new Usage({ inputTokens: input, @@ -967,7 +994,7 @@ const mapUsage = (usage: OpenAIChatEvent["usage"], providerMetadataKey: string): cacheWriteInputTokens: cacheWrite, reasoningTokens: reasoning, totalTokens: ProviderShared.totalTokens(input, output, usage.total_tokens ?? undefined), - ...ProviderShared.reportedBilling(usage), + ...ProviderShared.reportedBilling(usage, frame), providerMetadata: { [providerMetadataKey]: usage }, }) } @@ -1076,10 +1103,12 @@ const reasoningMetadata = ( providerMetadataKey: string, field: ParserState["reasoningField"], details?: ReadonlyArray, + opaque?: string, ) => ({ [providerMetadataKey]: { ...(field ? { reasoningField: field } : {}), ...(details ? { reasoningDetails: details } : {}), + ...(opaque ? { reasoningOpaque: opaque } : {}), }, }) @@ -1100,14 +1129,22 @@ const step = (state: ParserState, event: OpenAIChatEvent) => // Moonshot (and a few other OpenAI-compatible providers) attach usage to // `choice.usage` instead of the top-level `usage` field. const usage = - mapUsage(event.usage, state.providerMetadataKey) ?? - mapUsage(choice?.usage, state.providerMetadataKey) ?? + mapUsage(event.usage, state.providerMetadataKey, event) ?? + mapUsage(choice?.usage, state.providerMetadataKey, event) ?? state.usage const rawFinishReason = choice?.finish_reason const finishReason = rawFinishReason ? { normalized: yield* mapFinishReason(event, rawFinishReason), raw: choice?.native_finish_reason ?? rawFinishReason, + ...(rawFinishReason === "content_filter" + ? { + category: ProviderShared.contentFilterCategory( + choice?.delta?.copilot_annotations, + choice?.content_filter_results, + ), + } + : {}), } : state.finishReason const delta = choice?.delta @@ -1144,13 +1181,14 @@ const step = (state: ParserState, event: OpenAIChatEvent) => : undefined if (detailDelta !== undefined) appendReasoningDetails(state.reasoningDetails, detailDelta) const reasoningDetailsObserved = state.reasoningDetailsObserved || detailDelta !== undefined + const reasoningOpaque = delta?.reasoning_opaque || state.reasoningOpaque const deltaMetadata = reasoningMetadata(state.providerMetadataKey, reasoningField) const text = detailDelta?.length ? (detailText(detailDelta, reasoningTextObserved) ?? reasoning?.text) : reasoning?.text if (text !== undefined) lifecycle = Lifecycle.reasoningDelta(lifecycle, events, "reasoning-0", text, deltaMetadata) else if ( - reasoningDetailsObserved && + (reasoningDetailsObserved || reasoningOpaque !== undefined) && !lifecycle.reasoning.has("reasoning-0") && (Boolean(delta?.content) || Boolean(delta?.refusal) || toolDeltas.length > 0) ) @@ -1263,6 +1301,7 @@ const step = (state: ParserState, event: OpenAIChatEvent) => reasoningTextObserved, reasoningDetails: state.reasoningDetails, reasoningDetailsObserved, + reasoningOpaque, reasoningEmitted, latestToolIndex, nextToolIndex, @@ -1307,9 +1346,10 @@ export const finishEvents = Effect.fnUntraced(function* (state: ParserState) { state.providerMetadataKey, state.reasoningField, state.reasoningDetailsObserved ? [...state.reasoningDetails] : undefined, + state.reasoningOpaque, ) const started = - state.reasoningDetailsObserved && !state.reasoningEmitted + (state.reasoningDetailsObserved || state.reasoningOpaque !== undefined) && !state.reasoningEmitted ? Lifecycle.reasoningStart( state.lifecycle, events, diff --git a/packages/ai/src/protocols/openai-compatible-responses.ts b/packages/ai/src/protocols/openai-compatible-responses.ts index 26c35fc49c..19966c9a3e 100644 --- a/packages/ai/src/protocols/openai-compatible-responses.ts +++ b/packages/ai/src/protocols/openai-compatible-responses.ts @@ -15,7 +15,7 @@ export const route = Route.make({ protocol: OpenResponses.protocol, endpoint: Endpoint.path(OpenResponses.PATH), transport: OpenResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export * as OpenAICompatibleResponses from "./openai-compatible-responses.js" diff --git a/packages/ai/src/protocols/openai-decisions.ts b/packages/ai/src/protocols/openai-decisions.ts index 50c27b7d31..0c300d98df 100644 --- a/packages/ai/src/protocols/openai-decisions.ts +++ b/packages/ai/src/protocols/openai-decisions.ts @@ -72,7 +72,20 @@ const fromRequest = Effect.fn("OpenAIDecisions.fromRequest")(function* (request: ), model: request.model.id, input: [{ role: "user", content: yield* Effect.forEach(request.input, (part) => inputPart(request, part)) }], - questions: request.questions, + questions: request.questions.map((question) => { + if (question.type !== "predicate") return question + // Predicates have no criteria field, so what true and false mean is appended to the instructions. + const meanings = [ + question.criteria?.true === undefined ? [] : [`True means: ${question.criteria.true}`], + question.criteria?.false === undefined ? [] : [`False means: ${question.criteria.false}`], + ].flat() + return { + name: question.name, + type: question.type, + instructions: + meanings.length === 0 ? question.instructions : `${question.instructions}\n\n${meanings.join("\n")}`, + } + }), } }) diff --git a/packages/ai/src/protocols/openai-embeddings.ts b/packages/ai/src/protocols/openai-embeddings.ts new file mode 100644 index 0000000000..ee48ce71bc --- /dev/null +++ b/packages/ai/src/protocols/openai-embeddings.ts @@ -0,0 +1,105 @@ +import { Effect, Schema } from "effect" +import { Base64 } from "effect/encoding" +import { EmbeddingResponse, EmbeddingUsage, type EmbeddingRequest } from "../embedding.js" +import { EmbeddingRoute } from "../route/embedding.js" +import { Endpoint } from "../route/endpoint.js" +import { MediaProtocol } from "../route/media-protocol.js" +import { AIError, UnsupportedOperationError, mergeJsonRecords, type OpenString } from "../schema/index.js" + +const ID = "openai-embeddings" +const NAME = "OpenAI Embeddings" +export const DEFAULT_BASE_URL = "https://api.openai.com/v1" +export const PATH = "/embeddings" + +/** Sent as given; anything else a host accepts (`input_type`, `truncate`, …) goes alongside. */ +export interface OptionsInput { + readonly [key: string]: unknown + readonly user?: string + readonly encoding_format?: OpenString<"float" | "base64"> +} + +const Response = Schema.Struct({ + data: Schema.Array( + Schema.Struct({ + index: Schema.optional(Schema.Int), + // `base64` encoding returns little-endian float32 bytes instead of a number list. + embedding: Schema.Union([Schema.Array(Schema.Number), Schema.String]), + }), + ), + model: Schema.optional(Schema.String), + usage: Schema.optional( + Schema.StructWithRest( + Schema.Struct({ prompt_tokens: Schema.optional(Schema.Number), total_tokens: Schema.optional(Schema.Number) }), + [Schema.Record(Schema.String, Schema.Unknown)], + ), + ), +}) + +// `inputType` has no field here; OpenAI's models embed queries and documents the same way. +const fromRequest = Effect.fn("OpenAIEmbeddings.fromRequest")(function* (request: EmbeddingRequest) { + const input = request.values.filter((value) => typeof value === "string") + if (input.length !== request.values.length) + return yield* new AIError({ + reason: new UnsupportedOperationError({ + operation: "embedding.media", + provider: request.model.provider, + route: request.model.route.id, + message: `${NAME} embeds text only; pass media values to a host with a multimodal embedding API`, + }), + }) + return { + ...mergeJsonRecords({ encoding_format: "float", ...request.providerOptions }, request.http?.body), + model: request.model.id, + input, + ...(request.dimensions === undefined ? {} : { dimensions: request.dimensions }), + } +}) + +const decodeDocument = MediaProtocol.identity({ id: ID, name: NAME, provider: "openai" }).decodeJson(Response) + +export const protocol = EmbeddingRoute.protocol({ + id: ID, + name: NAME, + body: { from: fromRequest }, + response: { + decode: Effect.fn("OpenAIEmbeddings.decodeResponse")(function* (response, context) { + const output = yield* decodeDocument(response) + const embeddings = yield* Effect.forEach( + output.value.data + .map((item, position) => ({ index: item.index ?? position, embedding: item.embedding })) + .toSorted((a, b) => a.index - b.index), + (item) => + typeof item.embedding !== "string" + ? Effect.succeed(item.embedding) + : Effect.fromResult(Base64.decode(item.embedding)).pipe( + Effect.map((bytes) => Array.from(new Float32Array(bytes.slice().buffer))), + Effect.mapError((cause) => output.invalid(`${NAME} returned an invalid base64 embedding`, cause)), + ), + ) + const usage = output.value.usage + return new EmbeddingResponse({ + embeddings, + usage: + usage?.prompt_tokens === undefined ? undefined : new EmbeddingUsage({ inputTokens: usage.prompt_tokens }), + providerMetadata: { + [context.providerMetadataKey]: { + ...(output.value.model === undefined ? {} : { model: output.value.model }), + ...(usage === undefined ? {} : { usage }), + }, + }, + }) + }), + }, +}) + +export const route = EmbeddingRoute.make({ + id: ID, + provider: "openai", + protocol, + endpoint: Endpoint.path(PATH, { baseURL: DEFAULT_BASE_URL }), +}) + +export const OpenAIEmbeddings = { + protocol, + route, +} as const diff --git a/packages/ai/src/protocols/openai-responses.ts b/packages/ai/src/protocols/openai-responses.ts index 4e905856ff..d50c44a3a5 100644 --- a/packages/ai/src/protocols/openai-responses.ts +++ b/packages/ai/src/protocols/openai-responses.ts @@ -167,7 +167,7 @@ const supportsEffortUpdates = (request: LLMRequest) => { if (request.providerOptions?.contextManagement !== undefined) return false if (request.providerOptions?.reasoningMode === "pro") return false if (Schema.is(Schema.Struct({ mode: Schema.Literal("pro") }))(request.http?.body?.reasoning)) return false - const override = request.model.compatibility?.supportsEffortUpdates + const override = request.model.capabilities?.reasoning?.updates if (override !== undefined) return override const match = /(?:^|\/)gpt-(\d+)(?:\.\d+)?(?:-|$)/i.exec(request.model.id) return match !== null && Number(match[1]) >= 6 @@ -360,7 +360,7 @@ export const route = Route.make({ endpoint, auth, transport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export * as OpenAIResponses from "./openai-responses.js" diff --git a/packages/ai/src/protocols/shared.ts b/packages/ai/src/protocols/shared.ts index 6913ab7716..9ead5424ba 100644 --- a/packages/ai/src/protocols/shared.ts +++ b/packages/ai/src/protocols/shared.ts @@ -54,12 +54,36 @@ export const ReportedBilling = Schema.Struct({ cost: billedAmount, }) -/** Reads `ReportedBilling` from a raw usage object, which provider metadata keeps as the endpoint sent it. */ -export const reportedBilling = (usage: unknown) => - Option.match(Schema.decodeUnknownOption(ReportedBilling)(usage), { - onNone: () => ({}), - onSome: (billing) => ({ cost: billing.cost }), - }) +/** + * GitHub Copilot reports its charge beside usage on the frame that carries it, as `copilot_usage.total_nano_aiu`: + * billionths of an AI credit, which costs $0.01. + */ +const CopilotBilling = Schema.Struct({ + copilot_usage: Schema.Struct({ total_nano_aiu: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)) }), +}) +const decodeCopilotBilling = Schema.decodeUnknownOption(CopilotBilling) + +/** + * Reads `ReportedBilling` from a raw usage object, which provider metadata keeps as the endpoint sent it, or + * Copilot's billing from the frames that carry the usage. + */ +export const reportedBilling = (usage: unknown, ...frames: ReadonlyArray) => { + const reported = Option.getOrUndefined(Schema.decodeUnknownOption(ReportedBilling)(usage))?.cost + if (reported !== undefined) return { cost: reported } + const nanoAiu = frames + .map((frame) => Option.getOrUndefined(decodeCopilotBilling(frame))?.copilot_usage.total_nano_aiu) + .find((value) => value !== undefined) + return nanoAiu === undefined ? {} : { cost: nanoAiu / 100_000_000_000 } +} + +/** + * The filter that blocked a response, from maps keyed by filter name: Azure's `content_filter_results` + * (`{ hate: { filtered: true } }`) or GitHub Copilot's `copilot_annotations` (`{ TextCopyright: [...] }`). + */ +export const contentFilterCategory = (...sources: ReadonlyArray) => + sources + .flatMap((source) => (isRecord(source) ? Object.entries(source) : [])) + .find(([, value]) => (isRecord(value) && "filtered" in value ? value.filtered === true : Boolean(value)))?.[0] /** * Accepts stream frames that carry no `type`, alongside the typed event schema. Gateways inject such frames as @@ -88,7 +112,7 @@ export const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64 // Body-level `prompt_cache_key` is off when caching is disabled or the model // explicitly rejects the field. Header-based affinity is unaffected. export const sendsPromptCacheKey = (request: LLMRequest) => - request.cache !== "none" && request.model.compatibility?.supportsPromptCacheKey !== false + request.cache !== "none" && request.model.capabilities?.promptCacheKey !== false // OpenAI limits `prompt_cache_key` to 64 chars; DeepSeek and Zai inherit the same // limit via their OpenAI-compatible APIs. Clamp with unicode-aware slicing. diff --git a/packages/ai/src/protocols/system-one.ts b/packages/ai/src/protocols/system-one.ts index 588cf57ca4..10bb6a6069 100644 --- a/packages/ai/src/protocols/system-one.ts +++ b/packages/ai/src/protocols/system-one.ts @@ -70,7 +70,14 @@ export const encodeBody = Effect.fn("SystemOne.encodeBody")(function* (request: const encodeQuestions = (questions: ReadonlyArray) => Effect.forEach(questions, (question): Effect.Effect => { if (question.type === "predicate") - return Effect.succeed([question.name, { type: "noul", instructions: question.instructions }] as const) + return Effect.succeed([ + question.name, + { + type: "noul", + instructions: question.instructions, + ...(question.criteria === undefined ? {} : { criteria: question.criteria }), + }, + ] as const) if (question.type === "score") return Effect.succeed([ question.name, diff --git a/packages/ai/src/protocols/venice-chat.ts b/packages/ai/src/protocols/venice-chat.ts index 93f9ccc73e..e99c3899f0 100644 --- a/packages/ai/src/protocols/venice-chat.ts +++ b/packages/ai/src/protocols/venice-chat.ts @@ -1,6 +1,12 @@ import { Effect, Schema } from "effect" import { Protocol } from "../route/protocol.js" -import { AIError, LLMEvent, type LanguageModelCompatibility, type LLMRequest } from "../schema/index.js" +import { + AIError, + LLMEvent, + type LanguageModelCompatibility, + type LLMRequest, + type Capabilities, +} from "../schema/index.js" import { classifyProviderFailure } from "../provider-error.js" import { OpenAIChat } from "./openai-chat.js" import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js" @@ -325,9 +331,10 @@ const onHalt = Effect.fn("VeniceChat.onHalt")(function* (state: State) { export const compatibility = { maxTokensField: "max_completion_tokens", - supportsPromptCacheKey: true, } satisfies LanguageModelCompatibility +export const capabilities = { promptCacheKey: true } satisfies Capabilities + export const protocol = Protocol.make({ id: "venice-chat", body: { schema: Body, from: fromRequest }, diff --git a/packages/ai/src/protocols/zai-chat.ts b/packages/ai/src/protocols/zai-chat.ts index 8b410ebc60..5b8cdd4e80 100644 --- a/packages/ai/src/protocols/zai-chat.ts +++ b/packages/ai/src/protocols/zai-chat.ts @@ -1,6 +1,6 @@ import { Effect, Schema } from "effect" import { Protocol } from "../route/protocol.js" -import type { LanguageModelCompatibility, LLMRequest } from "../schema/index.js" +import type { LanguageModelCompatibility, LLMRequest, Capabilities } from "../schema/index.js" import { OpenAIChat } from "./openai-chat.js" import { ProviderShared } from "./shared.js" import { OpenResponsesOptions } from "./utils/open-responses-options.js" @@ -56,11 +56,12 @@ const fromRequest = Effect.fn("ZAIChat.fromRequest")(function* (request: LLMRequ export const compatibility = { maxTokensField: "max_tokens", - supportsStrictMode: false, reasoningField: "reasoning_content", zaiToolStream: false, } satisfies LanguageModelCompatibility +export const capabilities = { tools: { strict: false } } satisfies Capabilities + export const protocol = Protocol.make({ id: "zai-chat", body: { schema: Body, from: fromRequest }, diff --git a/packages/ai/src/provider-error.ts b/packages/ai/src/provider-error.ts index 0ef65a3588..09d636945f 100644 --- a/packages/ai/src/provider-error.ts +++ b/packages/ai/src/provider-error.ts @@ -142,7 +142,7 @@ const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?ma // Z.ai reports balance, plan expiry, plan limits, and plan model access on 429. // Cerebras reports its per-minute token throttle as `token_quota_exceeded`; that is a rate limit. const QUOTA_TEXT = - /insufficient[-_\s]?(?:quota|balance)|(? & { readonly workspaceID?: string } export type Config = Location & - Omit & + Omit & ProviderAuthOption<"optional"> & { readonly providerOptions?: ChatOptionsInput | MessagesOptionsInput | ResponsesOptionsInput } @@ -103,7 +105,9 @@ export const configure = (input: Config) => { const opts = { ...rest, auth: AuthOptions.bearer(input, ["DASHSCOPE_API_KEY", "ALIBABA_API_KEY"]) } const common = { ...opts, endpoint: { baseURL: baseURL ?? `https://${host}/compatible-mode/v1` } } const chat = (id: string | ModelID) => - chatRoute.with(common).model({ id, compatibility: AlibabaChat.compatibility }) + chatRoute + .with(common) + .model({ id, compatibility: AlibabaChat.compatibility, capabilities: AlibabaChat.capabilities }) const messages = (id: string | ModelID) => messagesRoute .with({ @@ -115,7 +119,16 @@ export const configure = (input: Config) => { const media = MediaRoute.deployment({ ...input, baseURL: baseURL ?? `https://${host}/api/v1` }, opts.auth) const image = (id: string | ModelID, providerOptions?: ProviderOptions) => AlibabaImages.model({ ...media, id, providerOptions }) - return { id, model: chat, chat, messages, responses, image, configure } + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: common.endpoint, + auth: opts.auth, + headers: input.headers, + http: input.http, + }) + const embedding = (id: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id, providerOptions }) + return { id, model: chat, chat, messages, responses, image, embedding, configure } } export const provider = { id, configure } @@ -134,6 +147,10 @@ export const imageModel = (id: string, settings: Settings) => { const input = config(settings) return configure(input).image(id, input.providerOptions) } +export const embeddingModel = (id: string, settings: Settings) => { + const input = config(settings) + return configure(input).embedding(id, input.providerOptions) +} function config(input: Settings) { const { body, ...rest } = input diff --git a/packages/ai/src/providers/alibaba/embeddings.ts b/packages/ai/src/providers/alibaba/embeddings.ts new file mode 100644 index 0000000000..89d2881867 --- /dev/null +++ b/packages/ai/src/providers/alibaba/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../alibaba.js" +export type { Settings } from "../alibaba.js" diff --git a/packages/ai/src/providers/amazon-bedrock-mantle.ts b/packages/ai/src/providers/amazon-bedrock-mantle.ts index c8512ba92a..94ec349fff 100644 --- a/packages/ai/src/providers/amazon-bedrock-mantle.ts +++ b/packages/ai/src/providers/amazon-bedrock-mantle.ts @@ -1,4 +1,4 @@ -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import type { ProviderPackage } from "../provider-package.js" import { AnthropicMessages } from "../protocols/anthropic-messages.js" @@ -6,7 +6,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { BedrockAuth, type Credentials } from "../protocols/utils/bedrock-auth.js" import { claudeVersion } from "../protocols/utils/claude-model.js" -import { ProviderConfigurationError, ProviderID, type ModelID } from "../schema/index.js" +import { ProviderConfigurationError, ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { withOpenAIOptions, type OpenAIProviderOptionsInput } from "./openai-options.js" export const id = ProviderID.make("amazon-bedrock") @@ -14,7 +14,7 @@ export const id = ProviderID.make("amazon-bedrock") export type OpenAIOptionsInput = OpenAIProviderOptionsInput export type MessagesOptionsInput = AnthropicMessages.ProviderOptionsInput -export type Config = Omit & { +export type Config = Omit & { /** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */ readonly apiKey?: string /** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */ @@ -55,7 +55,7 @@ const responsesRoute = Route.make({ protocol: OpenResponses.protocol, endpoint: Endpoint.path(OpenResponses.PATH), transport: OpenResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) const chatRoute = OpenAIChat.route.with({ @@ -73,7 +73,7 @@ const messagesRoute = Route.make({ // Mantle rejects mid-conversation `output_config` on Opus 5.0; support starts at 5.1+. supportsEffortUpdates: (request) => { if (!(AnthropicMessages.protocol.supportsEffortUpdates?.(request) ?? false)) return false - if (request.model.compatibility?.supportsEffortUpdates !== undefined) return true + if (request.model.capabilities?.reasoning?.updates !== undefined) return true const version = claudeVersion(request.model.id) return version !== undefined && (version.major > 5 || (version.major === 5 && version.minor >= 1)) }, diff --git a/packages/ai/src/providers/amazon-bedrock.ts b/packages/ai/src/providers/amazon-bedrock.ts index bb9e580cd5..490e0fbd85 100644 --- a/packages/ai/src/providers/amazon-bedrock.ts +++ b/packages/ai/src/providers/amazon-bedrock.ts @@ -1,13 +1,12 @@ -import type { RouteDefaultsInput } from "../route/client.js" import type { ProviderPackage } from "../provider-package.js" -import { ProviderConfigurationError, ProviderID, type ModelID } from "../schema/index.js" +import { ProviderConfigurationError, ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import * as BedrockConverse from "../protocols/bedrock-converse.js" import type { BedrockCredentials } from "../protocols/bedrock-converse.js" import { BedrockAuth } from "../protocols/utils/bedrock-auth.js" export const id = ProviderID.make("amazon-bedrock") -export type Config = RouteDefaultsInput & { +export type Config = RequestOptions & { /** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */ readonly apiKey?: string /** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */ diff --git a/packages/ai/src/providers/anthropic-compatible.ts b/packages/ai/src/providers/anthropic-compatible.ts index 09b648ed55..fabd8476fe 100644 --- a/packages/ai/src/providers/anthropic-compatible.ts +++ b/packages/ai/src/providers/anthropic-compatible.ts @@ -2,8 +2,7 @@ import type { ProviderPackage } from "../provider-package.js" import { AnthropicMessages } from "../protocols/anthropic-messages.js" import { Auth } from "../route/auth.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" -import type { RouteDefaultsInput } from "../route/client.js" -import { ProviderConfigurationError, ProviderID, type ModelID } from "../schema/index.js" +import { ProviderConfigurationError, ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" export type AnthropicOptionsInput = AnthropicMessages.OptionsInput export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput @@ -11,7 +10,7 @@ export type AnthropicThinkingInput = AnthropicMessages.ThinkingInput export const id = ProviderID.make("anthropic-compatible") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & ProviderAuthOption<"optional"> & { readonly provider?: string readonly baseURL: string diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts index 8071da941c..43b265f3e5 100644 --- a/packages/ai/src/providers/anthropic.ts +++ b/packages/ai/src/providers/anthropic.ts @@ -1,8 +1,7 @@ -import type { RouteDefaultsInput } from "../route/client.js" import { Auth } from "../route/auth.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" import type { ProviderPackage } from "../provider-package.js" -import { ProviderConfigurationError, ProviderID, type ModelID } from "../schema/index.js" +import { ProviderConfigurationError, ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { AnthropicMessages } from "../protocols/anthropic-messages.js" import { AnthropicCompatible } from "./anthropic-compatible.js" @@ -14,7 +13,7 @@ export const id = ProviderID.make("anthropic") export const routes = [AnthropicMessages.route] -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: AnthropicMessages.ProviderOptionsInput diff --git a/packages/ai/src/providers/azure.ts b/packages/ai/src/providers/azure.ts index a3e8793e3f..cfa400145c 100644 --- a/packages/ai/src/providers/azure.ts +++ b/packages/ai/src/providers/azure.ts @@ -1,12 +1,19 @@ import { Auth } from "../route/auth.js" import { AuthOptions, type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js" -import type { Route, RouteDefaultsInput, CompactionOperations } from "../route/client.js" +import type { Route, CompactionOperations } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import type { ProviderPackage } from "../provider-package.js" import { MediaRoute } from "../route/media.js" -import { ProviderConfigurationError, ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { + ProviderConfigurationError, + ProviderID, + type ModelID, + type ProviderOptions, + type RequestOptions, +} from "../schema/index.js" import { AnthropicMessages } from "../protocols/anthropic-messages.js" import { OpenAIImages } from "../protocols/openai-images.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import * as OpenAIChat from "../protocols/openai-chat.js" import * as OpenAIResponses from "../protocols/openai-responses.js" import { withOpenAIOptions, type OpenAIProviderOptionsInput } from "./openai-options.js" @@ -20,7 +27,7 @@ const RESPONSES_WEBSOCKET_ROTATE_AFTER_MS = 55 * 60 * 1000 type AzureURL = AtLeastOne<{ readonly resourceName: string; readonly baseURL: string }> export type Config = AzureURL & - RouteDefaultsInput & + RequestOptions & ProviderAuthOption<"optional"> & { readonly apiVersion?: string readonly queryParams?: Record @@ -133,7 +140,7 @@ export const configure = (input: Config) => { const chat = (modelID: string | ModelID) => configuredRoute(chatRoute, input, modelID) .with(withOpenAIOptions(modelID, modelDefaults)) - .model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }) + .model({ id: modelID, capabilities: { promptCacheKey: true } }) const messages = (modelID: string | ModelID) => messagesRoute @@ -161,6 +168,17 @@ export const configure = (input: Config) => { }) } + const embedding = (modelID: string | ModelID, providerOptions?: ProviderOptions) => + OpenAIEmbeddings.route + .with({ + provider: id, + endpoint: endpoint(input, modelID), + auth: auth(input), + headers: input.headers, + http: input.http, + }) + .model({ id: modelID, providerOptions }) + return { id, model: responses, @@ -168,6 +186,7 @@ export const configure = (input: Config) => { chat, messages, image, + embedding, configure, } } @@ -217,6 +236,10 @@ export const imageModel = (modelID: string, settings: Settings) => { const input = config(settings) return configure(input).image(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings: Settings) => { + const input = config(settings) + return configure(input).embedding(modelID, input.providerOptions) +} export const model = responsesModel export const responses = responsesModel export const chat = chatModel diff --git a/packages/ai/src/providers/azure/embeddings.ts b/packages/ai/src/providers/azure/embeddings.ts new file mode 100644 index 0000000000..5b2887913a --- /dev/null +++ b/packages/ai/src/providers/azure/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../azure.js" +export type { Settings } from "../azure.js" diff --git a/packages/ai/src/providers/baseten.ts b/packages/ai/src/providers/baseten.ts index 245e2241ef..f9e4185a16 100644 --- a/packages/ai/src/providers/baseten.ts +++ b/packages/ai/src/providers/baseten.ts @@ -3,17 +3,17 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { SystemOne } from "../protocols/system-one.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { DecisionRoute } from "../route/decision.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("baseten") const baseURL = "https://inference.baseten.co/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput diff --git a/packages/ai/src/providers/cerebras.ts b/packages/ai/src/providers/cerebras.ts index 2034236896..17049c405f 100644 --- a/packages/ai/src/providers/cerebras.ts +++ b/packages/ai/src/providers/cerebras.ts @@ -1,16 +1,16 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("cerebras") const baseURL = "https://api.cerebras.ai/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput @@ -43,8 +43,8 @@ export const configure = (input: Config = {}) => { compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning", - supportsPromptCacheKey: true, }, + capabilities: { promptCacheKey: true }, }), configure, } diff --git a/packages/ai/src/providers/cloudflare-ai-gateway.ts b/packages/ai/src/providers/cloudflare-ai-gateway.ts index 9fba899650..09ce25a36d 100644 --- a/packages/ai/src/providers/cloudflare-ai-gateway.ts +++ b/packages/ai/src/providers/cloudflare-ai-gateway.ts @@ -4,8 +4,7 @@ import { CloudflareRunDecisions } from "../protocols/cloudflare-run-decisions.js import { AnthropicMessages, OpenAIChat, OpenAIResponses } from "../protocols/index.js" import { Auth } from "../route/auth.js" import { AuthOptions, type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js" -import type { RouteDefaultsInput } from "../route/client.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import { encodeJson } from "../utils/json.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { CloudflareShared } from "./cloudflare-shared.js" @@ -29,7 +28,7 @@ type GatewayOptions = { export type Config = GatewayURL & GatewayOptions & - Omit & + Omit & ProviderAuthOption<"optional"> & { readonly gatewayApiKey?: string | Redacted.Redacted | Config.Config readonly providerOptions?: OpenAIProviderOptionsInput diff --git a/packages/ai/src/providers/cloudflare-workers-ai.ts b/packages/ai/src/providers/cloudflare-workers-ai.ts index 728801e100..def5db10bc 100644 --- a/packages/ai/src/providers/cloudflare-workers-ai.ts +++ b/packages/ai/src/providers/cloudflare-workers-ai.ts @@ -4,10 +4,10 @@ import { CloudflareRunDecisions } from "../protocols/cloudflare-run-decisions.js import { CloudflareWorkersAIImages } from "../protocols/cloudflare-workers-ai-images.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { AuthOptions, type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { CloudflareShared } from "./cloudflare-shared.js" @@ -20,7 +20,7 @@ type WorkersAIURL = AtLeastOne<{ }> export type Config = WorkersAIURL & - Omit & + Omit & ProviderAuthOption<"optional"> & { readonly providerOptions?: OpenAIProviderOptionsInput } diff --git a/packages/ai/src/providers/cohere.ts b/packages/ai/src/providers/cohere.ts index 8c9fcdc286..89e4079501 100644 --- a/packages/ai/src/providers/cohere.ts +++ b/packages/ai/src/providers/cohere.ts @@ -1,9 +1,10 @@ import { CohereChat } from "../protocols/cohere-chat.js" import { OpenAIChat } from "../protocols/openai-chat.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { ProviderID, type ModelID, type OpenString } from "../schema/index.js" +import { ProviderID, type ModelID, type OpenString, type RequestOptions } from "../schema/index.js" import type { ProviderPackage } from "../provider-package.js" import { bearerRouteDefaults, toConfig } from "./settings.js" @@ -11,7 +12,7 @@ export const id = ProviderID.make("cohere") const COMPATIBILITY_BASE_URL = "https://api.cohere.ai/compatibility/v1" export type ChatOptionsInput = { readonly reasoningEffort?: OpenString<"none" | "high"> } export type ProviderOptions = CohereChat.ProviderOptionsInput & ChatOptionsInput -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ProviderOptions @@ -33,7 +34,15 @@ export const routes = [route, chatRoute] export const configure = (input: Config = {}) => { const options = bearerRouteDefaults(input, "COHERE_API_KEY", CohereChat.DEFAULT_BASE_URL) const native = route.with(options) - const chat = chatRoute.with({ ...options, endpoint: { baseURL: input.baseURL ?? COMPATIBILITY_BASE_URL } }) + const compatibility = { ...options, endpoint: { baseURL: input.baseURL ?? COMPATIBILITY_BASE_URL } } + const chat = chatRoute.with(compatibility) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: compatibility.endpoint, + auth: options.auth, + headers: input.headers, + http: input.http, + }) return { id, model: (modelID: string | ModelID) => native.model({ id: modelID }), @@ -43,14 +52,22 @@ export const configure = (input: Config = {}) => { compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", - supportsStrictMode: false, }, + capabilities: { tools: { strict: false } }, }), + /** Embeddings through the OpenAI-compatible API; the native `/v2/embed` API is not wired up. */ + embedding: (modelID: string | ModelID, providerOptions?: Readonly>) => + embeddingRoute.model({ id: modelID, providerOptions }), configure, } } export const provider = configure() export const chat = provider.chat +export const embedding = provider.embedding export const model: ProviderPackage.Model = (modelID, settings) => configure(toConfig(settings)).model(modelID) +export const embeddingModel = (modelID: string, settings?: Settings>>) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} export * as Cohere from "./cohere.js" diff --git a/packages/ai/src/providers/cohere/embeddings.ts b/packages/ai/src/providers/cohere/embeddings.ts new file mode 100644 index 0000000000..312c01a690 --- /dev/null +++ b/packages/ai/src/providers/cohere/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../cohere.js" +export type { Settings } from "../cohere.js" diff --git a/packages/ai/src/providers/deepinfra.ts b/packages/ai/src/providers/deepinfra.ts index 573c487fe5..0c2a1faaf4 100644 --- a/packages/ai/src/providers/deepinfra.ts +++ b/packages/ai/src/providers/deepinfra.ts @@ -1,16 +1,17 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("deepinfra") const baseURL = "https://api.deepinfra.com/v1/openai" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput @@ -35,11 +36,19 @@ export const routes = [route] export const configure = (input: Config = {}) => { const root = input.baseURL?.replace(/\/+$/, "") - const configured = route.with({ + const options = { ...bearerRouteDefaults(input, "DEEPINFRA_API_KEY"), endpoint: { baseURL: root === undefined ? baseURL : root.endsWith("/openai") ? root : `${root}/openai`, }, + } + const configured = route.with(options) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: options.endpoint, + auth: options.auth, + headers: input.headers, + http: input.http, }) return { id, @@ -49,9 +58,11 @@ export const configure = (input: Config = {}) => { compatibility: { maxTokensField: "max_tokens", reasoningField: "reasoning_content", - supportsPromptCacheKey: true, }, + capabilities: { promptCacheKey: true }, }), + embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }), configure, } } @@ -60,3 +71,7 @@ export const provider = configure() export const model: ProviderPackage.Model = (modelID, settings) => configure(toConfig(settings)).model(modelID) +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} diff --git a/packages/ai/src/providers/deepinfra/embeddings.ts b/packages/ai/src/providers/deepinfra/embeddings.ts new file mode 100644 index 0000000000..6aaeae3975 --- /dev/null +++ b/packages/ai/src/providers/deepinfra/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../deepinfra.js" +export type { Settings } from "../deepinfra.js" diff --git a/packages/ai/src/providers/deepseek.ts b/packages/ai/src/providers/deepseek.ts index 98262990d6..38fc384f89 100644 --- a/packages/ai/src/providers/deepseek.ts +++ b/packages/ai/src/providers/deepseek.ts @@ -1,16 +1,16 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("deepseek") const baseURL = "https://api.deepseek.com/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput diff --git a/packages/ai/src/providers/digitalocean.ts b/packages/ai/src/providers/digitalocean.ts index 700947d3ab..6b52d4b9de 100644 --- a/packages/ai/src/providers/digitalocean.ts +++ b/packages/ai/src/providers/digitalocean.ts @@ -1,15 +1,16 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import { OpenAIImages } from "../protocols/openai-images.js" import { OpenResponses } from "../protocols/open-responses.js" import { SystemOne } from "../protocols/system-one.js" import { cacheControl } from "../protocols/utils/cache.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" import { Protocol } from "../route/protocol.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" import { bearerRouteDefaults } from "./settings.js" @@ -17,7 +18,7 @@ import { bearerRouteDefaults } from "./settings.js" export const id = ProviderID.make("digitalocean") const baseURL = "https://inference.do-ai.run/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput | OpenResponsesProviderOptionsInput @@ -51,7 +52,7 @@ const responsesRoute = Route.make({ protocol: OpenResponses.protocol, endpoint: Endpoint.path("/responses", { baseURL }), transport: OpenResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export const routes = [route, responsesRoute] @@ -78,12 +79,19 @@ export const configure = (input: Config = {}) => { const media = MediaRoute.deployment({ ...input, baseURL: options.endpoint.baseURL }, options.auth) const image = (modelID: string | ModelID, providerOptions?: ProviderOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions }) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: options.endpoint, + auth: options.auth, + headers: input.headers, + http: input.http, + }) + const embedding = (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }) const chat = (modelID: string | ModelID) => configured.model({ id: modelID, - compatibility: { - supportsPromptCacheKey: true, - }, + capabilities: { promptCacheKey: true }, }) return { id, @@ -93,12 +101,14 @@ export const configure = (input: Config = {}) => { configuredResponses.model({ id: modelID }), image, decision, + embedding, configure, } } export const provider = configure() export const decision = provider.decision +export const embedding = provider.embedding export const image = provider.image export const chat = provider.chat export const responses = provider.responses @@ -118,6 +128,11 @@ export const decisionModel = (modelID: string, settings?: Settings) => { return configure(input).decision(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = config(settings) + return configure(input).embedding(modelID, input.providerOptions) +} + function config({ apiKey, baseURL, body, headers, ...providerOptions }: Settings = {}) { return { apiKey, diff --git a/packages/ai/src/providers/digitalocean/embeddings.ts b/packages/ai/src/providers/digitalocean/embeddings.ts new file mode 100644 index 0000000000..568eccfb08 --- /dev/null +++ b/packages/ai/src/providers/digitalocean/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../digitalocean.js" +export type { Settings } from "../digitalocean.js" diff --git a/packages/ai/src/providers/fireworks.ts b/packages/ai/src/providers/fireworks.ts index aa9dbcb851..7a19e8081e 100644 --- a/packages/ai/src/providers/fireworks.ts +++ b/packages/ai/src/providers/fireworks.ts @@ -1,16 +1,17 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("fireworks") const baseURL = "https://api.fireworks.ai/inference/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput @@ -34,11 +35,21 @@ export const route = Route.make({ export const routes = [route] export const configure = (input: Config = {}) => { - const configured = route.with(bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL)) + const options = bearerRouteDefaults(input, "FIREWORKS_API_KEY", baseURL) + const configured = route.with(options) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: options.endpoint, + auth: options.auth, + headers: input.headers, + http: input.http, + }) return { id, model: (modelID: string | ModelID) => - configured.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }), + configured.model({ id: modelID, capabilities: { promptCacheKey: true } }), + embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }), configure, } } @@ -48,4 +59,9 @@ export const provider = configure() export const model: ProviderPackage.Model = (modelID, settings) => configure(toConfig(settings)).model(modelID) +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} + export * as Fireworks from "./fireworks.js" diff --git a/packages/ai/src/providers/fireworks/embeddings.ts b/packages/ai/src/providers/fireworks/embeddings.ts new file mode 100644 index 0000000000..87519e0700 --- /dev/null +++ b/packages/ai/src/providers/fireworks/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../fireworks.js" +export type { Settings } from "../fireworks.js" diff --git a/packages/ai/src/providers/google-vertex-chat.ts b/packages/ai/src/providers/google-vertex-chat.ts index 5352646368..f35218d20f 100644 --- a/packages/ai/src/providers/google-vertex-chat.ts +++ b/packages/ai/src/providers/google-vertex-chat.ts @@ -1,14 +1,14 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & { readonly baseURL?: string readonly location?: string diff --git a/packages/ai/src/providers/google-vertex-interactions.ts b/packages/ai/src/providers/google-vertex-interactions.ts index 39e1b0040f..f3aa1e681a 100644 --- a/packages/ai/src/providers/google-vertex-interactions.ts +++ b/packages/ai/src/providers/google-vertex-interactions.ts @@ -1,17 +1,17 @@ import type { ProviderPackage } from "../provider-package.js" import { GoogleInteractions } from "../protocols/google-interactions.js" import { Auth } from "../route/auth.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Framing } from "../route/framing.js" -import { ProviderConfigurationError, ProviderID, type ModelID } from "../schema/index.js" +import { ProviderConfigurationError, ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" export type GoogleInteractionsOptionsInput = GoogleInteractions.OptionsInput export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.ApiKeyOptions & { readonly baseURL?: string readonly location?: string diff --git a/packages/ai/src/providers/google-vertex-messages.ts b/packages/ai/src/providers/google-vertex-messages.ts index 43d72f567f..97bb8e66d0 100644 --- a/packages/ai/src/providers/google-vertex-messages.ts +++ b/packages/ai/src/providers/google-vertex-messages.ts @@ -2,10 +2,10 @@ import { Effect, Schema, Struct } from "effect" import type { ProviderPackage } from "../provider-package.js" import { AnthropicMessages } from "../protocols/anthropic-messages.js" import { Auth } from "../route/auth.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Protocol } from "../route/protocol.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" export type AnthropicOptionsInput = AnthropicMessages.OptionsInput @@ -17,7 +17,7 @@ const HEADER_VERSION = "2023-06-01" as const export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & { readonly baseURL?: string readonly location?: string diff --git a/packages/ai/src/providers/google-vertex-mistral.ts b/packages/ai/src/providers/google-vertex-mistral.ts index 09d1ff5d75..59eaed1c56 100644 --- a/packages/ai/src/providers/google-vertex-mistral.ts +++ b/packages/ai/src/providers/google-vertex-mistral.ts @@ -2,16 +2,16 @@ import { Effect, Schema, Struct } from "effect" import type { ProviderPackage } from "../provider-package.js" import { MistralChat } from "../protocols/mistral-chat.js" import { Auth } from "../route/auth.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Protocol } from "../route/protocol.js" import { HttpTransport } from "../route/transport/index.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & { readonly baseURL?: string readonly location?: string diff --git a/packages/ai/src/providers/google-vertex-responses.ts b/packages/ai/src/providers/google-vertex-responses.ts index b86c840c79..523d847ddb 100644 --- a/packages/ai/src/providers/google-vertex-responses.ts +++ b/packages/ai/src/providers/google-vertex-responses.ts @@ -1,14 +1,14 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenResponses } from "../protocols/open-responses.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.OAuthOptions & { readonly baseURL?: string readonly location?: string @@ -32,7 +32,7 @@ const route = Route.make({ protocol: OpenResponses.protocol, endpoint: Endpoint.path(OpenResponses.PATH), transport: OpenResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export const routes = [route] diff --git a/packages/ai/src/providers/google-vertex-shared.ts b/packages/ai/src/providers/google-vertex-shared.ts index fbf1572640..9590ff1875 100644 --- a/packages/ai/src/providers/google-vertex-shared.ts +++ b/packages/ai/src/providers/google-vertex-shared.ts @@ -2,8 +2,8 @@ import type { AnyAuthClient, GoogleAuthOptions } from "google-auth-library" import { Effect, Redacted } from "effect" import type { ProviderPackage } from "../provider-package.js" import { Auth, MissingCredentialError } from "../route/auth.js" -import type { CompactionOperations, Route, RouteDefaultsInput } from "../route/client.js" -import { ProviderConfigurationError, ProviderID } from "../schema/index.js" +import type { CompactionOperations, Route } from "../route/client.js" +import { ProviderConfigurationError, ProviderID, type RequestOptions } from "../schema/index.js" const SCOPE = "https://www.googleapis.com/auth/cloud-platform" const id = ProviderID.make("google-vertex") @@ -117,7 +117,7 @@ export const oauth = (input: OAuthOptions, project?: string) => { export const oauthRoute = ( route: Route, label: string, - input: RouteDefaultsInput & + input: RequestOptions & OAuthOptions & { readonly baseURL?: string; readonly location?: string; readonly project?: string }, url: (project: string, location: string) => string, ) => { diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.ts index ffff607099..3edeec7baa 100644 --- a/packages/ai/src/providers/google-vertex.ts +++ b/packages/ai/src/providers/google-vertex.ts @@ -1,10 +1,17 @@ import { Effect } from "effect" import type { ProviderPackage } from "../provider-package.js" import { Gemini } from "../protocols/gemini.js" +import { GoogleEmbedContent, type VertexOptionsInput } from "../protocols/google-embed-content.js" import { GoogleImages } from "../protocols/google-images.js" +import { + GoogleVertexPredictEmbeddings, + MAX_INSTANCES, + type OptionsInput as PredictOptionsInput, +} from "../protocols/google-vertex-predict-embeddings.js" import { ProviderShared } from "../protocols/shared.js" import { Auth } from "../route/auth.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" +import { EmbeddingRoute } from "../route/embedding.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" import { @@ -13,6 +20,7 @@ import { type LLMRequest, type ModelID, type ProviderOptions, + type RequestOptions, } from "../schema/index.js" import { GoogleVertexShared } from "./google-vertex-shared.js" @@ -24,7 +32,7 @@ export type GeminiProviderOptionsInput = GeminiOptionsInput export const id = ProviderID.make("google-vertex") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & GoogleVertexShared.ApiKeyOptions & { readonly baseURL?: string readonly location?: string @@ -81,6 +89,43 @@ const route = Route.make({ export const routes = [route] +export type { VertexOptionsInput as GoogleVertexEmbeddingOptions } from "../protocols/google-embed-content.js" +export type { OptionsInput as GoogleVertexPredictEmbeddingOptions } from "../protocols/google-vertex-predict-embeddings.js" + +const embedContentRoute = EmbeddingRoute.make({ + id: "google-vertex-embed-content", + provider: id, + providerMetadataKey: "vertex", + protocol: GoogleEmbedContent.vertexProtocol, + endpoint: Endpoint.path(({ request }) => `/models/${request.model.id}:embedContent`), + // Vertex embedContent embeds one content per request. + maxValues: 1, +}) + +const predictRoute = EmbeddingRoute.make({ + id: "google-vertex-predict-embeddings", + provider: id, + providerMetadataKey: "vertex", + protocol: GoogleVertexPredictEmbeddings.protocol, + // Tuned embedding models are deployed to `endpoints/{id}`, which serve `:predict` outside `publishers/google`. + endpoint: Endpoint.path(({ request }) => { + const model = request.model.id + return `/${model.startsWith("endpoints/") ? model : `models/${model}`}:predict` + }), + maxValues: MAX_INSTANCES, +}) + +/** + * `gemini-embedding-2*` models use `embedContent`, which takes media; every other embedding model uses the older + * text-only `:predict` API. `gemini-embedding-001` takes one text per `:predict` request. + */ +const embeddingTarget = (modelID: string) => { + if (modelID.startsWith("gemini-embedding-2")) return { route: embedContentRoute, embedContent: true } + if (modelID.startsWith("gemini-embedding-001")) + return { route: predictRoute.with({ maxValues: 1 }), embedContent: false } + return { route: predictRoute, embedContent: false } +} + const configuredRoute = (input: Config, modelID: string | ModelID) => { const { accessToken: _accessToken, @@ -128,6 +173,19 @@ export const configure = (input: Config = {}) => { providerOptions, }) }, + /** `gemini-embedding-2*` through `embedContent`, other models through `:predict`; see `embeddingTarget`. */ + embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => { + const target = connection(input, modelID) + const selected = embeddingTarget(modelID) + if (selected.embedContent && GoogleVertexShared.apiKey(input) !== undefined && input.baseURL === undefined) + throw new ProviderConfigurationError({ + provider: id, + message: "Google Vertex embedContent does not support Express Mode API keys; use project credentials", + }) + return selected.route + .with({ endpoint: target.endpoint, auth: target.auth, headers: input.headers, http: input.http }) + .model({ id: modelID, providerOptions }) + }, configure, } } @@ -142,6 +200,10 @@ export const imageModel = (modelID: string, settings?: Settings) => { const input = config(settings) return configure(input).image(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = config(settings) + return configure(input).embedding(modelID, input.providerOptions) +} function config({ accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }: Settings = {}) { if (apiKey !== undefined && accessToken !== undefined) diff --git a/packages/ai/src/providers/google-vertex/embeddings.ts b/packages/ai/src/providers/google-vertex/embeddings.ts new file mode 100644 index 0000000000..f18a110b37 --- /dev/null +++ b/packages/ai/src/providers/google-vertex/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../google-vertex.js" +export type { Settings } from "../google-vertex.js" diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.ts index 330c690a1b..145e8ce524 100644 --- a/packages/ai/src/providers/google.ts +++ b/packages/ai/src/providers/google.ts @@ -1,10 +1,13 @@ -import type { RouteDefaultsInput } from "../route/client.js" import { Auth } from "../route/auth.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" import { MediaRoute } from "../route/media.js" import type { ProviderPackage } from "../provider-package.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import { Gemini } from "../protocols/gemini.js" +import { + GoogleEmbedContent, + type OptionsInput as GoogleEmbeddingOptionsInput, +} from "../protocols/google-embed-content.js" import { GoogleInteractions } from "../protocols/google-interactions.js" import { GoogleImages } from "../protocols/google-images.js" import { GoogleSpeech } from "../protocols/google-speech.js" @@ -12,6 +15,7 @@ import { GoogleTranscription } from "../protocols/google-transcription.js" import { GoogleVideo } from "../protocols/google-video.js" import { toConfig } from "./settings.js" +export type { OptionsInput as GoogleEmbeddingOptions } from "../protocols/google-embed-content.js" export type { GoogleImageOptions } from "../protocols/google-images.js" export type { GoogleSpeechOptions } from "../protocols/google-speech.js" export type { GoogleTranscriptionOptions } from "../protocols/google-transcription.js" @@ -24,7 +28,7 @@ export const id = ProviderID.make("google") export const routes = [Gemini.route, GoogleInteractions.route] -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: Gemini.ProviderOptionsInput & GoogleInteractions.ProviderOptionsInput @@ -53,6 +57,13 @@ export const configure = (input: Config = {}) => { const route = configuredRoute(input) const media = MediaRoute.deployment(input, auth(input)) const gemini = (modelID: string | ModelID) => route.model({ id: modelID }) + const embeddingRoute = GoogleEmbedContent.route.with({ + provider: id, + endpoint: { baseURL: input.baseURL }, + auth: auth(input), + headers: input.headers, + http: input.http, + }) return { id, model: gemini, @@ -64,6 +75,8 @@ export const configure = (input: Config = {}) => { video: (modelID: string | ModelID) => GoogleVideo.model({ ...media, id: modelID }), speech: (modelID: string | ModelID) => GoogleSpeech.model({ ...media, id: modelID }), transcription: (modelID: string | ModelID) => GoogleTranscription.model({ ...media, id: modelID }), + embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }), configure, } } @@ -75,8 +88,13 @@ export const imageModel = (modelID: string, settings?: Settings) => { const input = toConfig(settings) return configure(input).image(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} export const image = provider.image +export const embedding = provider.embedding export const gemini = provider.gemini export const interactions = provider.interactions export const video = provider.video diff --git a/packages/ai/src/providers/google/embeddings.ts b/packages/ai/src/providers/google/embeddings.ts new file mode 100644 index 0000000000..35cbe81627 --- /dev/null +++ b/packages/ai/src/providers/google/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../google.js" +export type { Settings } from "../google.js" diff --git a/packages/ai/src/providers/groq.ts b/packages/ai/src/providers/groq.ts index 25106e44ae..c77695138e 100644 --- a/packages/ai/src/providers/groq.ts +++ b/packages/ai/src/providers/groq.ts @@ -3,10 +3,10 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { ProviderShared } from "../protocols/shared.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Protocol } from "../route/protocol.js" -import { ProviderID, type ModelID, type LLMRequest } from "../schema/index.js" +import { ProviderID, type ModelID, type LLMRequest, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" @@ -21,7 +21,7 @@ export type ProviderOptions = Pick & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ProviderOptions @@ -83,8 +83,8 @@ export const configure = (input: Config = {}) => { maxTokensField: "max_completion_tokens", reasoningField: "reasoning", requireReasoning: false, - supportsStrictMode: false, }, + capabilities: { tools: { strict: false } }, }), configure, } diff --git a/packages/ai/src/providers/meta.ts b/packages/ai/src/providers/meta.ts index 6260d781ea..7100017c23 100644 --- a/packages/ai/src/providers/meta.ts +++ b/packages/ai/src/providers/meta.ts @@ -5,10 +5,10 @@ import { MetaResponses } from "../protocols/meta-responses.js" import { MetaMessages } from "../protocols/meta-messages.js" import { MetaImages } from "../protocols/meta-images.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" -import { ProviderID, ToolDefinition, type ModelID, type OpenString } from "../schema/index.js" +import { ProviderID, ToolDefinition, type ModelID, type OpenString, type RequestOptions } from "../schema/index.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" @@ -75,7 +75,7 @@ export const imageGeneration = (options: ImageGenerationOptions = {}) => }, }) -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ProviderOptionsInput @@ -95,7 +95,7 @@ const responsesRoute = Route.make({ endpoint: Endpoint.path("/responses", { baseURL }), // Meta Responses does not support WebSocket upgrades; always use HTTP/SSE. transport: MetaResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) const chatRoute = Route.make({ @@ -114,7 +114,7 @@ const messagesRoute = Route.make({ protocol: MetaMessages.protocol, endpoint: Endpoint.path("/messages", { baseURL }), framing: AnthropicMessages.framing, - defaults: { providerOptions: { thinking: { type: "adaptive", display: "omitted" } } }, + options: { providerOptions: { thinking: { type: "adaptive", display: "omitted" } } }, }) export const routes = [responsesRoute, chatRoute, messagesRoute] @@ -129,7 +129,8 @@ export const configure = (input: Config = {}) => { const chat = (modelID: string | ModelID) => configuredChat.model({ id: modelID, - compatibility: { maxTokensField: "max_completion_tokens", supportsPromptCacheKey: true }, + compatibility: { maxTokensField: "max_completion_tokens" }, + capabilities: { promptCacheKey: true }, }) const messages = (modelID: string | ModelID) => configuredMessages.model({ diff --git a/packages/ai/src/providers/minimax.ts b/packages/ai/src/providers/minimax.ts index 406ff50ccc..18f515194a 100644 --- a/packages/ai/src/providers/minimax.ts +++ b/packages/ai/src/providers/minimax.ts @@ -6,12 +6,18 @@ import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { ProviderShared } from "../protocols/shared.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Framing } from "../route/framing.js" import { MediaRoute } from "../route/media.js" import { Protocol } from "../route/protocol.js" -import { ProviderID, type LLMRequest, type ModelID, type ProviderOptions } from "../schema/index.js" +import { + ProviderID, + type LLMRequest, + type ModelID, + type ProviderOptions, + type RequestOptions, +} from "../schema/index.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("minimax") @@ -36,7 +42,7 @@ export type ResponsesOptionsInput = { export type ProviderOptionsInput = MessagesOptionsInput | ChatOptionsInput | ResponsesOptionsInput -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { /** Overrides the selected API's base URL, including its version prefix. */ readonly baseURL?: string @@ -119,7 +125,7 @@ export const configure = (input: Config = {}) => { const chat = (modelID: string | ModelID) => chatRoute.with(defaults).model({ id: modelID, - compatibility: { supportsStrictMode: false }, + capabilities: { tools: { strict: false } }, }) const responses = (modelID: string | ModelID) => responsesRoute.with(defaults).model({ id: modelID }) diff --git a/packages/ai/src/providers/mistral.ts b/packages/ai/src/providers/mistral.ts index 87e86edbbb..aeb9776c77 100644 --- a/packages/ai/src/providers/mistral.ts +++ b/packages/ai/src/providers/mistral.ts @@ -1,15 +1,14 @@ import type { ProviderPackage } from "../provider-package.js" import { MistralChat } from "../protocols/mistral-chat.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import type { RouteDefaultsInput } from "../route/client.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("mistral") export type ProviderOptions = MistralChat.ProviderOptionsInput -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ProviderOptions diff --git a/packages/ai/src/providers/moonshot.ts b/packages/ai/src/providers/moonshot.ts index 25dbb504c4..8f09f2601a 100644 --- a/packages/ai/src/providers/moonshot.ts +++ b/packages/ai/src/providers/moonshot.ts @@ -5,11 +5,11 @@ import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { ProviderShared } from "../protocols/shared.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Framing } from "../route/framing.js" import { Protocol } from "../route/protocol.js" -import { ProviderID, type LLMRequest, type ModelID } from "../schema/index.js" +import { ProviderID, type LLMRequest, type ModelID, type RequestOptions } from "../schema/index.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("moonshotai") @@ -36,7 +36,7 @@ export type ResponsesOptionsInput = { readonly safetyIdentifier?: string } -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { /** Overrides the selected API's base URL, including its version prefix. */ readonly baseURL?: string @@ -106,11 +106,10 @@ export const configure = (input: Config = {}) => { id: modelID, compatibility: { maxTokensField: "max_tokens", - supportsStrictMode: false, - supportsPromptCacheKey: true, sanitizer: "moonshot", reasoningField: "reasoning_content", }, + capabilities: { tools: { strict: false }, promptCacheKey: true }, }) const messages = (modelID: string | ModelID) => messagesRoute.with(defaults).model({ diff --git a/packages/ai/src/providers/openai-compatible-responses.ts b/packages/ai/src/providers/openai-compatible-responses.ts index 652e0f1e59..72c2248651 100644 --- a/packages/ai/src/providers/openai-compatible-responses.ts +++ b/packages/ai/src/providers/openai-compatible-responses.ts @@ -1,8 +1,7 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAICompatibleResponses } from "../protocols/openai-compatible-responses.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" -import type { RouteDefaultsInput } from "../route/client.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" import { toConfig } from "./settings.js" @@ -10,7 +9,7 @@ export type { OpenResponsesOptionsInput, OpenResponsesProviderOptionsInput } fro export const id = ProviderID.make("openai-compatible") -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & ProviderAuthOption<"optional"> & { readonly provider?: string readonly baseURL: string diff --git a/packages/ai/src/providers/openai-compatible.ts b/packages/ai/src/providers/openai-compatible.ts index d3203c0500..6f9d634635 100644 --- a/packages/ai/src/providers/openai-compatible.ts +++ b/packages/ai/src/providers/openai-compatible.ts @@ -1,8 +1,15 @@ -import { mergeProviderOptions, ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { + mergeProviderOptions, + ProviderID, + type ModelID, + type ProviderOptions, + type RequestOptions, +} from "../schema/index.js" import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js" +import { OpenAIEmbeddings, type OptionsInput as OpenAIEmbeddingOptionsInput } from "../protocols/openai-embeddings.js" import { OpenAIImages } from "../protocols/openai-images.js" +import { SystemOne } from "../protocols/system-one.js" import { MediaRoute } from "../route/media.js" -import type { RouteDefaultsInput } from "../route/client.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" import type { ProviderPackage } from "../provider-package.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" @@ -10,7 +17,7 @@ import { toConfig } from "./settings.js" export const id = ProviderID.make("openai-compatible") -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly provider?: string readonly baseURL: string @@ -37,6 +44,20 @@ export const configure = (input: Config) => { auth, }) const media = MediaRoute.deployment(input, auth) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider, + endpoint: { baseURL }, + auth, + headers: input.headers, + http: input.http, + }) + const decisionRoute = SystemOne.route.with({ + provider, + endpoint: { baseURL }, + auth, + headers: input.headers, + http: input.http, + }) return { id: ProviderID.make(provider), model: (modelID: string | ModelID) => route.model({ id: modelID }), @@ -52,6 +73,11 @@ export const configure = (input: Config) => { providerOptions, ), }), + embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }), + // Compatible hosts follow llama.cpp's System One API, which takes inline media in root `images` (alias of `files`). + decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => + decisionRoute.model({ id: modelID, compatibility: { mediaInput: "root" }, providerOptions }), configure, } } @@ -67,6 +93,14 @@ export const imageModel = (modelID: string, settings: Settings) => { const input = config(settings) return configure(input).image(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings: Settings) => { + const input = config(settings) + return configure(input).embedding(modelID, input.providerOptions) +} +export const decisionModel = (modelID: string, settings: Settings) => { + const input = config(settings) + return configure(input).decision(modelID, input.providerOptions) +} function config({ provider, ...settings }: Settings) { return { ...toConfig(settings), provider } diff --git a/packages/ai/src/providers/openai-compatible/decisions.ts b/packages/ai/src/providers/openai-compatible/decisions.ts new file mode 100644 index 0000000000..8370306e56 --- /dev/null +++ b/packages/ai/src/providers/openai-compatible/decisions.ts @@ -0,0 +1,2 @@ +export { decisionModel as model } from "../openai-compatible.js" +export type { Settings } from "../openai-compatible.js" diff --git a/packages/ai/src/providers/openai-compatible/embeddings.ts b/packages/ai/src/providers/openai-compatible/embeddings.ts new file mode 100644 index 0000000000..649ce8c33f --- /dev/null +++ b/packages/ai/src/providers/openai-compatible/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../openai-compatible.js" +export type { Settings } from "../openai-compatible.js" diff --git a/packages/ai/src/providers/openai.ts b/packages/ai/src/providers/openai.ts index d52f9b2042..04d347878a 100644 --- a/packages/ai/src/providers/openai.ts +++ b/packages/ai/src/providers/openai.ts @@ -1,8 +1,15 @@ import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" -import type { Route, RouteDefaultsInput, CompactionOperations } from "../route/client.js" +import type { Route, CompactionOperations } from "../route/client.js" import { MediaRoute } from "../route/media.js" import type { ProviderPackage } from "../provider-package.js" -import { ProviderID, ToolDefinition, type ModelID, type OpenString, type ProviderOptions } from "../schema/index.js" +import { + ProviderID, + ToolDefinition, + type ModelID, + type OpenString, + type ProviderOptions, + type RequestOptions, +} from "../schema/index.js" import * as OpenAIChat from "../protocols/openai-chat.js" import * as OpenAIResponses from "../protocols/openai-responses.js" import { withOpenAIOptions, type OpenAIProviderOptionsInput } from "./openai-options.js" @@ -10,12 +17,14 @@ import { OpenAIImages } from "../protocols/openai-images.js" import { OpenAISpeech } from "../protocols/openai-speech.js" import { OpenAITranscription } from "../protocols/openai-transcription.js" import { OpenAIDecisions, type OptionsInput as OpenAIDecisionOptionsInput } from "../protocols/openai-decisions.js" +import { OpenAIEmbeddings, type OptionsInput as OpenAIEmbeddingOptionsInput } from "../protocols/openai-embeddings.js" export type { OpenAIOptionsInput, OpenAIResponseIncludable, OpenAIServiceTier } from "./openai-options.js" export type { OpenAIImageOptions } from "../protocols/openai-images.js" export type { OpenAISpeechOptions } from "../protocols/openai-speech.js" export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js" export type { OptionsInput as OpenAIDecisionOptions } from "../protocols/openai-decisions.js" +export type { OptionsInput as OpenAIEmbeddingOptions } from "../protocols/openai-embeddings.js" export const id = ProviderID.make("openai") @@ -24,7 +33,7 @@ export const routes = [OpenAIResponses.route, OpenAIChat.route] // This provider facade wraps the lower-level Responses and Chat model factories // with OpenAI-specific conveniences: typed options, API-key sugar, env fallback, // and default option normalization. -export type Config = RouteDefaultsInput & +export type Config = RequestOptions & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly queryParams?: Record @@ -98,7 +107,7 @@ export const configure = (input: Config = {}) => { const chat = (id: string | ModelID) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({ id, - compatibility: { supportsPromptCacheKey: true }, + capabilities: { promptCacheKey: true }, }) const deployment = MediaRoute.deployment(input, auth(input)) const media = { @@ -119,6 +128,14 @@ export const configure = (input: Config = {}) => { }) const decision = (modelID: string | ModelID, providerOptions?: ProviderOptions) => decisionRoute.model({ id: modelID, providerOptions }) + const embeddingRoute = OpenAIEmbeddings.route.with({ + endpoint: { baseURL: media.baseURL }, + auth: media.auth, + headers: media.headers, + http: media.http, + }) + const embedding = (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }) return { id, @@ -129,6 +146,7 @@ export const configure = (input: Config = {}) => { speech, transcription, decision, + embedding, configure, } } @@ -178,9 +196,14 @@ export const decisionModel = (modelID: string, settings?: Settings) => { const input = config(settings) return configure(input).decision(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = config(settings) + return configure(input).embedding(modelID, input.providerOptions) +} export const responses = provider.responses export const chat = provider.chat export const image = provider.image export const speech = provider.speech export const transcription = provider.transcription export const decision = provider.decision +export const embedding = provider.embedding diff --git a/packages/ai/src/providers/openai/embeddings.ts b/packages/ai/src/providers/openai/embeddings.ts new file mode 100644 index 0000000000..d85f9a261e --- /dev/null +++ b/packages/ai/src/providers/openai/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../openai.js" +export type { Settings } from "../openai.js" diff --git a/packages/ai/src/providers/openrouter.ts b/packages/ai/src/providers/openrouter.ts index 911d160537..565f9fbcb2 100644 --- a/packages/ai/src/providers/openrouter.ts +++ b/packages/ai/src/providers/openrouter.ts @@ -1,11 +1,18 @@ import { Effect, Schema } from "effect" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Protocol } from "../route/protocol.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { ProviderID, type ModelID, type OpenString, type ProviderOptions } from "../schema/index.js" +import { + ProviderID, + type ModelID, + type OpenString, + type ProviderOptions, + type RequestOptions, +} from "../schema/index.js" import type { ProviderPackage } from "../provider-package.js" import { SystemOne } from "../protocols/system-one.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import { OpenAIImages, type OpenAIImageSizing } from "../protocols/openai-images.js" import { MediaRoute } from "../route/media.js" import { HttpTransport } from "../route/transport/index.js" @@ -87,7 +94,13 @@ export interface OpenRouterDecisionOptions { readonly user?: string } -export type Config = Omit & +export interface OpenRouterEmbeddingOptions { + readonly [key: string]: unknown + readonly provider?: OpenRouterProviderRouting + readonly user?: string +} + +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenRouterProviderOptionsInput | OpenRouterResponsesProviderOptionsInput @@ -238,7 +251,7 @@ const responsesRoute = Route.make({ protocol: responsesProtocol, endpoint: Endpoint.path("/responses", { baseURL }), transport: HttpTransport.sseJson.with(), - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export const routes = [route, responsesRoute] @@ -271,8 +284,17 @@ export const configure = (input: Config = {}) => { compatibility: { mediaInput: "state" }, providerOptions, }) + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: options.endpoint, + auth: options.auth, + headers: input.headers, + http: input.http, + }) + const embedding = (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }) const chat = (modelID: string | ModelID) => - chatRoute.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }) + chatRoute.model({ id: modelID, capabilities: { promptCacheKey: true } }) return { id, model: chat, @@ -281,12 +303,14 @@ export const configure = (input: Config = {}) => { configuredResponses.model({ id: modelID }), image, decision, + embedding, configure, } } export const provider = configure() export const decision = provider.decision +export const embedding = provider.embedding export const image = provider.image export const chat = provider.chat export const responses = provider.responses @@ -305,4 +329,9 @@ export const decisionModel = (modelID: string, settings?: Settings) => { return configure(input).decision(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} + export * as OpenRouter from "./openrouter.js" diff --git a/packages/ai/src/providers/openrouter/embeddings.ts b/packages/ai/src/providers/openrouter/embeddings.ts new file mode 100644 index 0000000000..dee35014dd --- /dev/null +++ b/packages/ai/src/providers/openrouter/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../openrouter.js" +export type { Settings } from "../openrouter.js" diff --git a/packages/ai/src/providers/settings.ts b/packages/ai/src/providers/settings.ts index 6161b9e8b8..15926a76ff 100644 --- a/packages/ai/src/providers/settings.ts +++ b/packages/ai/src/providers/settings.ts @@ -31,7 +31,7 @@ export function toConfig({ apiKey, baseURL, body, headers, ...providerOptions }: type BearerInput = ProviderAuthOption<"optional"> & { readonly baseURL?: string } /** - * Turns provider config into route defaults with `Authorization: Bearer` auth. The endpoint falls back to + * Turns provider config into route options with `Authorization: Bearer` auth. The endpoint falls back to * `baseURL` when given, otherwise it is left to the route. */ export function bearerRouteDefaults( diff --git a/packages/ai/src/providers/togetherai.ts b/packages/ai/src/providers/togetherai.ts index c6fc265112..a8857bb6f8 100644 --- a/packages/ai/src/providers/togetherai.ts +++ b/packages/ai/src/providers/togetherai.ts @@ -1,16 +1,16 @@ import type { ProviderPackage } from "../provider-package.js" import { OpenAIChat } from "../protocols/openai-chat.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import type { OpenAIProviderOptionsInput } from "./openai-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("togetherai") const baseURL = "https://api.together.xyz/v1" -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: OpenAIProviderOptionsInput @@ -40,7 +40,8 @@ export const configure = (input: Config = {}) => { model: (modelID: string | ModelID) => configured.model({ id: modelID, - compatibility: { maxTokensField: "max_tokens", supportsStrictMode: false }, + compatibility: { maxTokensField: "max_tokens" }, + capabilities: { tools: { strict: false } }, }), configure, } diff --git a/packages/ai/src/providers/venice.ts b/packages/ai/src/providers/venice.ts index 7ce5555e54..e1fac0d3c4 100644 --- a/packages/ai/src/providers/venice.ts +++ b/packages/ai/src/providers/venice.ts @@ -3,14 +3,14 @@ import { VeniceChat } from "../protocols/venice-chat.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" export const id = ProviderID.make("venice") export type ChatOptionsInput = VeniceChat.OptionsInput -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly queryParams?: Readonly> @@ -40,7 +40,7 @@ const responsesRoute = Route.make({ protocol: OpenResponses.protocol, endpoint: Endpoint.path("/responses", { baseURL }), transport: OpenResponses.httpTransport, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) export const routes = [route, responsesRoute] @@ -52,7 +52,11 @@ export const configure = (input: Config = {}) => { auth: AuthOptions.bearer(input, "VENICE_API_KEY"), } const chat = (modelID: string | ModelID) => - route.with(options).model({ id: modelID, compatibility: VeniceChat.compatibility }) + route.with(options).model({ + id: modelID, + compatibility: VeniceChat.compatibility, + capabilities: VeniceChat.capabilities, + }) const responses = (modelID: string | ModelID) => responsesRoute.with(options).model({ id: modelID }) return { id, model: chat, chat, responses, configure } diff --git a/packages/ai/src/providers/vercel-ai-gateway.ts b/packages/ai/src/providers/vercel-ai-gateway.ts index 7bf8194977..95744a7646 100644 --- a/packages/ai/src/providers/vercel-ai-gateway.ts +++ b/packages/ai/src/providers/vercel-ai-gateway.ts @@ -3,13 +3,14 @@ import { AnthropicMessages } from "../protocols/anthropic-messages.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { OpenAIDecisions } from "../protocols/openai-decisions.js" +import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js" import { OpenAIImages, type OpenAIImageSizing } from "../protocols/openai-images.js" import { XAIImages } from "../protocols/xai-images.js" import { ProviderShared } from "../protocols/shared.js" import { gatewayProtocol } from "../protocols/utils/gateway-protocol.js" import type { ProviderPackage } from "../provider-package.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Framing } from "../route/framing.js" import { MediaRoute } from "../route/media.js" @@ -21,6 +22,7 @@ import { ProviderMetadata, ReasoningEffort, type ProviderOptions, + type RequestOptions, } from "../schema/index.js" import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" import { bearerRouteDefaults, toConfig } from "./settings.js" @@ -100,7 +102,7 @@ export type ProviderOptionsInput = OpenResponsesProviderOptionsInput & readonly cacheAnchorItems?: number } -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ProviderOptionsInput @@ -174,7 +176,7 @@ const route = (input: { readonly api: "messages" | "responses" | "chat" readonly path: string readonly framing: Framing.Definition - readonly defaults?: RouteDefaultsInput + readonly options?: RequestOptions }) => Route.make({ id: input.id, @@ -185,7 +187,7 @@ const route = (input: { framing: input.framing, headers: ({ request }): Record => request.promptCacheKey ? { "x-session-affinity": request.promptCacheKey } : {}, - defaults: input.defaults, + options: input.options, }) const messagesRoute = route({ @@ -194,7 +196,7 @@ const messagesRoute = route({ api: "messages", path: "/messages", framing: AnthropicMessages.framing, - defaults: { headers: { "anthropic-version": "2023-06-01" } }, + options: { headers: { "anthropic-version": "2023-06-01" } }, }) const responsesRoute = route({ id: "vercel-ai-gateway-responses", @@ -202,7 +204,7 @@ const responsesRoute = route({ api: "responses", path: "/responses", framing: Framing.sse, - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) const chatRoute = route({ id: "vercel-ai-gateway-chat", @@ -254,11 +256,21 @@ export const configure = (input: Config = {}) => { }) const decision = (modelID: string | ModelID, providerOptions?: ProviderOptions) => decisionRoute.model({ id: modelID, providerOptions }) - return { id, model, messages, responses, chat, image, decision, configure } + const embeddingRoute = OpenAIEmbeddings.route.with({ + provider: id, + endpoint: { baseURL: configured.endpoint.baseURL }, + auth: configured.auth, + headers: input.headers, + http: input.http, + }) + const embedding = (modelID: string | ModelID, providerOptions?: ProviderOptions) => + embeddingRoute.model({ id: modelID, providerOptions }) + return { id, model, messages, responses, chat, image, decision, embedding, configure } } export const provider = configure() export const decision = provider.decision +export const embedding = provider.embedding export const messages = provider.messages export const responses = provider.responses export const chat = provider.chat @@ -281,4 +293,9 @@ export const decisionModel = (modelID: string, settings?: Settings) => { return configure(input).decision(modelID, input.providerOptions) } +export const embeddingModel = (modelID: string, settings?: Settings) => { + const input = toConfig(settings) + return configure(input).embedding(modelID, input.providerOptions) +} + export * as VercelAIGateway from "./vercel-ai-gateway.js" diff --git a/packages/ai/src/providers/vercel-ai-gateway/embeddings.ts b/packages/ai/src/providers/vercel-ai-gateway/embeddings.ts new file mode 100644 index 0000000000..c06c25c94f --- /dev/null +++ b/packages/ai/src/providers/vercel-ai-gateway/embeddings.ts @@ -0,0 +1,2 @@ +export { embeddingModel as model } from "../vercel-ai-gateway.js" +export type { Settings } from "../vercel-ai-gateway.js" diff --git a/packages/ai/src/providers/xai.ts b/packages/ai/src/providers/xai.ts index accba2ae90..ef2ce340b9 100644 --- a/packages/ai/src/providers/xai.ts +++ b/packages/ai/src/providers/xai.ts @@ -1,8 +1,8 @@ import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponsesChannel } from "../protocols/open-responses-channel.js" import { XAIResponses } from "../protocols/xai-responses.js" @@ -18,7 +18,7 @@ const baseURL = "https://api.x.ai/v1" export type XAIProviderOptionsInput = OpenAIOptionsInput & XAIResponses.OptionsInput & { readonly contextManagement?: never } -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: XAIProviderOptionsInput @@ -51,7 +51,7 @@ const responsesRoute = Route.make({ // rejects `instructions` next to `previous_response_id` and keeps the instructions of the response it continues. continuation: ({ instructions: _instructions, ...request }) => (request.store === false ? undefined : request), }), - defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, + options: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) const chatRoute = Route.make({ diff --git a/packages/ai/src/providers/zai-coding-plan.ts b/packages/ai/src/providers/zai-coding-plan.ts index f4e28b2f47..f2a9c3696f 100644 --- a/packages/ai/src/providers/zai-coding-plan.ts +++ b/packages/ai/src/providers/zai-coding-plan.ts @@ -5,10 +5,10 @@ import { OpenResponses } from "../protocols/open-responses.js" import { ZAIChat } from "../protocols/zai-chat.js" import { ZAIMessages } from "../protocols/zai-messages.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { Framing } from "../route/framing.js" -import { ProviderID, type ModelID } from "../schema/index.js" +import { ProviderID, type ModelID, type RequestOptions } from "../schema/index.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("zai-coding-plan") @@ -17,7 +17,7 @@ export type ChatOptionsInput = ZAIChat.OptionsInput export type MessagesOptionsInput = ZAIMessages.OptionsInput export type ResponsesOptionsInput = { readonly reasoningEffort?: ZAIChat.ReasoningEffort } -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { /** Overrides the selected API's complete base URL. */ readonly baseURL?: string @@ -61,7 +61,11 @@ export const routes = [chatRoute, messagesRoute, responsesRoute] export const configure = (input: Config = {}) => { const defaults = bearerRouteDefaults(input, "ZAI_API_KEY") const chat = (modelID: string | ModelID) => - chatRoute.with(defaults).model({ id: modelID, compatibility: ZAIChat.compatibility }) + chatRoute.with(defaults).model({ + id: modelID, + compatibility: ZAIChat.compatibility, + capabilities: ZAIChat.capabilities, + }) const messages = (modelID: string | ModelID) => messagesRoute .with(defaults) diff --git a/packages/ai/src/providers/zai.ts b/packages/ai/src/providers/zai.ts index 6dd41a3a61..133f71ef24 100644 --- a/packages/ai/src/providers/zai.ts +++ b/packages/ai/src/providers/zai.ts @@ -3,17 +3,17 @@ import { ZAIChat } from "../protocols/zai-chat.js" import { ZAIImages } from "../protocols/zai-images.js" import { OpenAIChat } from "../protocols/openai-chat.js" import type { ProviderAuthOption } from "../route/auth-options.js" -import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Route } from "../route/client.js" import { Endpoint } from "../route/endpoint.js" import { MediaRoute } from "../route/media.js" -import { ProviderID, type ModelID, type ProviderOptions } from "../schema/index.js" +import { ProviderID, type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js" import { bearerRouteDefaults, toConfig } from "./settings.js" export const id = ProviderID.make("zai") export type ChatOptionsInput = ZAIChat.OptionsInput -export type Config = Omit & +export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string readonly providerOptions?: ChatOptionsInput @@ -41,7 +41,11 @@ export const routes = [chatRoute] export const configure = (input: Config = {}) => { const defaults = bearerRouteDefaults(input, "ZAI_API_KEY") const chat = (modelID: string | ModelID) => - chatRoute.with(defaults).model({ id: modelID, compatibility: ZAIChat.compatibility }) + chatRoute.with(defaults).model({ + id: modelID, + compatibility: ZAIChat.compatibility, + capabilities: ZAIChat.capabilities, + }) const media = MediaRoute.deployment(input, defaults.auth) const image = (modelID: string | ModelID, providerOptions?: ProviderOptions) => ZAIImages.model({ ...media, id: modelID, providerOptions }) diff --git a/packages/ai/src/public.ts b/packages/ai/src/public.ts index 405d07129d..d2af57d227 100644 --- a/packages/ai/src/public.ts +++ b/packages/ai/src/public.ts @@ -93,7 +93,7 @@ export type { ContentPartInput, GenerationOptionsFields, HttpOptions, - LanguageModelDefaults, + RequestOptions, LanguageModelInput, LanguageModelProviderOptions, LLMRequest, @@ -152,6 +152,16 @@ export type { DecisionResponseFor, DecisionModelRoute, } from "./decision.js" +export { EmbeddingModel, EmbeddingModelSchema, EmbeddingResponse, EmbeddingUsage, EmbeddingValue } from "./embedding.js" +export type { + EmbeddingInputType, + EmbeddingModelOptions, + EmbeddingModelRoute, + EmbeddingOptions, + EmbeddingRequest, + EmbeddingRequestInput, + EmbeddingValueInput, +} from "./embedding.js" export { Media } from "./media.js" export type { AwaitOptions as GenerationAwaitOptions, diff --git a/packages/ai/src/route/client.ts b/packages/ai/src/route/client.ts index be5d3f9b4e..9781477d8f 100644 --- a/packages/ai/src/route/client.ts +++ b/packages/ai/src/route/client.ts @@ -31,9 +31,10 @@ import { ToolEntry, type LLMRequest, mergeGeneration, + mergeRequestOptions, mergeProviderOptions, mergeTransport, - type LanguageModelDefaults, + type RequestOptions, withPartial, } from "../schema/index.js" @@ -60,7 +61,8 @@ export interface Route< /** Deployment headers resolved once for every operation, before transport authentication. */ readonly headers?: (input: { readonly request: LLMRequest }) => Record readonly transport: Transport - readonly defaults: RouteDefaults + /** Options every model built on this route starts from. */ + readonly options?: RequestOptions readonly body: RouteBody readonly supportsEffortUpdates?: (request: LLMRequest) => boolean readonly sanitizer?: LanguageModelSanitizerCompatibility @@ -103,11 +105,7 @@ export type RouteLanguageModelInput = Omit -export type RouteDefaults = LanguageModelDefaults - -export type RouteDefaultsInput = LanguageModelDefaults - -export interface RoutePatch extends RouteDefaultsInput { +export interface RoutePatch extends RequestOptions { readonly compact?: CompactionOperations readonly id?: string readonly provider?: string | ProviderID @@ -137,14 +135,6 @@ const makeRouteLanguageModel = ({ - ...base, - ...patch, - ...mergeTransport(base, patch), - ...mergeGeneration(base, patch), - providerOptions: mergeProviderOptions(base?.providerOptions, patch.providerOptions), -}) - export interface Interface { readonly compact: CompactMethod readonly stream: StreamMethod @@ -255,17 +245,12 @@ export type Service = LLMClientService const resolveRequestOptions = (request: LLMRequest): LLMRequest => { const messages = normalizeToolHistory(request.messages) const normalized = messages === request.messages ? request : { ...request, messages } - const routeDefaults = normalized.model.route.defaults - const modelDefaults = normalized.model.defaults + const options = normalized.model.options return { ...normalized, - ...mergeGeneration(routeDefaults, modelDefaults, normalized), - providerOptions: mergeProviderOptions( - routeDefaults.providerOptions, - modelDefaults?.providerOptions, - normalized.providerOptions, - ), - ...mergeTransport(routeDefaults, modelDefaults, normalized), + ...mergeGeneration(options, normalized), + providerOptions: mergeProviderOptions(options?.providerOptions, normalized.providerOptions), + ...mergeTransport(options, normalized), } } @@ -287,8 +272,8 @@ export interface MakeInput { readonly framing: Framing.Definition /** Static / per-request headers added before `auth` runs. */ readonly headers?: (input: { readonly request: LLMRequest }) => Record - /** Route/request defaults used when compiling requests for this route. */ - readonly defaults?: RouteDefaultsInput + /** Options every model built on this route starts from. */ + readonly options?: RequestOptions } export interface MakeTransportInput { @@ -309,8 +294,8 @@ export interface MakeTransportInput { readonly headers?: (input: { readonly request: LLMRequest }) => Record /** Runnable transport route. */ readonly transport: Transport - /** Route/request defaults used when compiling requests for this route. */ - readonly defaults?: RouteDefaultsInput + /** Options every model built on this route starts from. */ + readonly options?: RequestOptions } const streamError = (route: string, message: string, cause: Cause.Cause) => { @@ -375,9 +360,7 @@ function makeFromTransport( ), ) - type BuiltRouteInput = Omit, "defaults"> & { - readonly defaults?: RouteDefaults - } + type BuiltRouteInput = MakeTransportInput const build = (routeInput: BuiltRouteInput): Route => { const route: Route = { @@ -390,12 +373,12 @@ function makeFromTransport( auth: routeInput.auth ?? Auth.none, headers: routeInput.headers, transport: routeInput.transport, - defaults: routeInput.defaults ?? {}, + options: routeInput.options, body: protocol.body, supportsEffortUpdates: protocol.supportsEffortUpdates, sanitizer: protocol.sanitizer, with: (patch: RoutePatch) => { - const { compact, id, provider, providerMetadataKey, auth, transport, endpoint, ...defaults } = patch + const { compact, id, provider, providerMetadataKey, auth, transport, endpoint, ...options } = patch return build({ ...routeInput, compact: "compact" in patch ? compact : routeInput.compact, @@ -407,7 +390,7 @@ function makeFromTransport( auth: auth ?? routeInput.auth, endpoint: endpoint ? Endpoint.merge(routeInput.endpoint, endpoint) : routeInput.endpoint, transport: (transport as Transport | undefined) ?? routeInput.transport, - defaults: mergeRouteDefaults(route.defaults, defaults), + options: mergeRequestOptions(route.options, options), }) }, model: (input: RouteMappedLanguageModelInput) => @@ -507,7 +490,7 @@ function makeFromTransport( return route } - return build({ ...input, defaults: mergeRouteDefaults(undefined, input.defaults ?? {}) }) + return build({ ...input, options: mergeRequestOptions(input.options) }) } export function make( @@ -552,7 +535,7 @@ export function make( auth: input.auth, headers: input.headers, transport: HttpTransport.httpJson({ framing: input.framing }), - defaults: input.defaults, + options: input.options, }) } diff --git a/packages/ai/src/route/embedding.ts b/packages/ai/src/route/embedding.ts new file mode 100644 index 0000000000..457e546aeb --- /dev/null +++ b/packages/ai/src/route/embedding.ts @@ -0,0 +1,175 @@ +import { Effect } from "effect" +import type { HttpClientResponse } from "effect/http" +import { + EmbeddingModel, + EmbeddingResponse, + EmbeddingUsage, + type EmbeddingOptions, + type EmbeddingRequest, +} from "../embedding.js" +import { ProviderID, type HttpOptions, type AIError, type ProviderOptions } from "../schema/index.js" +import { Auth } from "./auth.js" +import { Endpoint } from "./endpoint.js" +import { MediaProtocol } from "./media-protocol.js" +import { MediaRoute } from "./media.js" + +/** One embedding API: how a request becomes its JSON body and how its response becomes an `EmbeddingResponse`. */ +export interface Protocol { + readonly id: string + readonly name: string + readonly body: { readonly from: (request: EmbeddingRequest) => Effect.Effect, AIError> } + readonly response: { + readonly decode: ( + response: HttpClientResponse.HttpClientResponse, + context: { readonly request: EmbeddingRequest; readonly providerMetadataKey: string }, + ) => Effect.Effect + } +} + +export const protocol = (input: Protocol) => input + +export interface Patch { + readonly id?: string + readonly provider?: string | ProviderID + /** ProviderMetadata namespace for responses; defaults to the provider. */ + readonly providerMetadataKey?: string + readonly endpoint?: Endpoint.EndpointPatch + readonly auth?: Auth.Definition + readonly headers?: Record + readonly http?: HttpOptions + /** + * Most values one HTTP request may carry. Longer requests are split into requests of this size, sent a few at a + * time, and joined back in value order. + */ + readonly maxValues?: number +} + +export interface Route { + readonly id: string + readonly provider: ProviderID + readonly providerMetadataKey: string + readonly protocol: Protocol + readonly endpoint: Endpoint.Definition + readonly auth: Auth.Definition + readonly headers?: Record + readonly http?: HttpOptions + readonly maxValues?: number + readonly with: (patch: Patch) => Route + readonly model: (input: { + readonly id: string + readonly providerOptions?: ProviderOptions + }) => EmbeddingModel +} + +export interface MakeInput extends Omit { + readonly id: string + readonly provider: string | ProviderID + readonly protocol: Protocol + readonly endpoint: Endpoint.Definition +} + +export const make = (input: MakeInput): Route => { + const provider = ProviderID.make(input.provider) + const route: Omit = { + id: input.id, + provider, + providerMetadataKey: input.providerMetadataKey ?? provider, + protocol: input.protocol, + endpoint: input.endpoint, + auth: input.auth ?? Auth.none, + headers: input.headers, + http: input.http, + maxValues: input.maxValues, + } + return { + ...route, + with: (patch) => + make({ + ...route, + ...patch, + // A new provider gets its own metadata key unless the patch names one. + providerMetadataKey: + patch.providerMetadataKey ?? (patch.provider === undefined ? route.providerMetadataKey : undefined), + endpoint: patch.endpoint === undefined ? route.endpoint : Endpoint.merge(route.endpoint, patch.endpoint), + headers: patch.headers === undefined ? route.headers : { ...route.headers, ...patch.headers }, + http: patch.http ?? route.http, + maxValues: patch.maxValues ?? route.maxValues, + }), + model: (model: { + readonly id: string + readonly providerOptions?: ProviderOptions + }) => + EmbeddingModel.make({ + id: model.id, + provider, + http: route.http, + providerOptions: model.providerOptions, + route: { id: route.id, generate: split(route.maxValues, transport(route).generate) }, + }), + } +} + +const CONCURRENCY = 4 + +/** + * Splits a request whose values exceed `maxValues` and joins the parts: vectors in value order, `inputTokens` summed + * when every part reports it, and each part's metadata in order under `providerMetadata[key].responses`. + */ +const split = + (maxValues: number | undefined, generate: Generate): Generate => + (request, execute) => { + if (maxValues === undefined || request.values.length <= maxValues) return generate(request, execute) + const chunks = Array.from({ length: Math.ceil(request.values.length / maxValues) }, (_, index) => + request.values.slice(index * maxValues, (index + 1) * maxValues), + ) + return Effect.forEach(chunks, (values) => generate({ ...request, values }, execute), { + concurrency: CONCURRENCY, + }).pipe( + Effect.map((responses) => { + const tokens = responses.map((response) => response.usage?.inputTokens) + const keys = [...new Set(responses.flatMap((response) => Object.keys(response.providerMetadata ?? {})))] + return new EmbeddingResponse({ + embeddings: responses.flatMap((response) => response.embeddings), + usage: tokens.every((count) => count !== undefined) + ? new EmbeddingUsage({ inputTokens: tokens.reduce((sum, count) => sum + count, 0) }) + : undefined, + providerMetadata: + keys.length === 0 + ? undefined + : Object.fromEntries( + keys.map((key) => [ + key, + { responses: responses.map((response) => response.providerMetadata?.[key] ?? {}) }, + ]), + ), + }) + }), + ) + } + +type Generate = EmbeddingModel["route"]["generate"] + +// The HTTP plumbing (URL, query, auth, headers, `http` overlays, surrogate sanitizing) is the one media routes use. +const transport = (route: Omit) => + MediaRoute.inline({ + protocol: MediaProtocol.inline( + MediaProtocol.identity({ id: route.id, name: route.protocol.name, provider: route.provider }), + { + body: { + from: (request) => route.protocol.body.from(request).pipe(Effect.map((body) => MediaProtocol.json(body))), + }, + response: { + decode: (response, context) => + route.protocol.response.decode(response, { + request: context.request, + providerMetadataKey: route.providerMetadataKey, + }), + }, + }, + ), + endpoint: route.endpoint, + auth: route.auth, + headers: route.headers, + }) + +export * as EmbeddingRoute from "./embedding.js" diff --git a/packages/ai/src/route/index.ts b/packages/ai/src/route/index.ts index 9ff082b0c3..f820a78836 100644 --- a/packages/ai/src/route/index.ts +++ b/packages/ai/src/route/index.ts @@ -2,8 +2,6 @@ export { Route, LLMClient } from "./client.js" export type { RouteLanguageModelInput, RouteRoutedLanguageModelInput, - RouteDefaults, - RouteDefaultsInput, AnyRoute, LLMClientService, StreamOptions, diff --git a/packages/ai/src/schema/messages.ts b/packages/ai/src/schema/messages.ts index 30dc991403..2e7007c08a 100644 --- a/packages/ai/src/schema/messages.ts +++ b/packages/ai/src/schema/messages.ts @@ -369,12 +369,8 @@ export const Message = withStatics(messageSchema, { * 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 = Schema.Union([ - Schema.Struct({ type: Schema.Literal("text") }), - Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }), - Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }), -]).annotate({ identifier: "LLM.Freeform" }) -export type Freeform = Schema.Schema.Type +export const Freeform = Tool.Freeform +export type Freeform = Tool.Freeform const toolDefinitionFields = { name: Schema.String, diff --git a/packages/ai/src/schema/options.ts b/packages/ai/src/schema/options.ts index 7eadfaa01a..f9d6bff13e 100644 --- a/packages/ai/src/schema/options.ts +++ b/packages/ai/src/schema/options.ts @@ -161,11 +161,23 @@ export const mergeGeneration = (...items: ReadonlyArray [key, last(items.map((item) => item?.[key as keyof GenerationOptionsFields]))]), ) as GenerationOptionsFields -/** Request defaults a selected model applies under each request. */ -export interface LanguageModelDefaults extends TransportOptions, GenerationOptionsFields { +/** Request options a model applies under each request: the same keys as a request, and the request wins. */ +export interface RequestOptions extends TransportOptions, GenerationOptionsFields { readonly providerOptions?: ProviderOptions } +/** Merge model options; later items win per key. Empty results are `undefined`. */ +export const mergeRequestOptions = ( + ...items: ReadonlyArray +): RequestOptions | undefined => { + const merged = Object.entries({ + ...mergeTransport(...items), + ...mergeGeneration(...items), + providerOptions: mergeProviderOptions(...items.map((item) => item?.providerOptions)), + }).filter(([, value]) => value !== undefined) + return merged.length === 0 ? undefined : (Object.fromEntries(merged) as RequestOptions) +} + /** Provider-defined string enum: known values for autocomplete, any string accepted. */ export type OpenString = Known | (string & {}) @@ -198,22 +210,12 @@ export class LanguageModelCompatibility extends Schema.Class + readonly search?: boolean + /** Input formats accepted by custom (free-form) tools. */ + readonly freeform?: ReadonlyArray<"text" | "lark" | "regex"> + /** Accepts a changed tool list mid-conversation. */ + readonly updates?: boolean + } + readonly reasoning?: { + readonly supported?: boolean + readonly default?: + | { readonly type: "toggle"; readonly value: boolean } + | { readonly type: "effort"; readonly value: ReasoningEffort } + | { readonly type: "budget"; readonly value: number } + readonly toggle?: boolean + readonly effort?: ReadonlyArray + readonly budget?: { readonly min?: number; readonly max?: number } + /** Accepts per-message effort updates. Detected from the model ID when unset. */ + readonly updates?: boolean + } + readonly cache?: + | false + | { + readonly implicit?: true | { readonly ttl?: ReadonlyArray; readonly minTokens?: number } + readonly explicit?: + | true + | { + readonly ttl?: ReadonlyArray + readonly maxBreakpoints?: number + readonly targets?: ReadonlyArray<"tools" | "system" | "messages"> + readonly minTokens?: number + } + } + readonly structuredOutput?: boolean + readonly temperature?: boolean + readonly topP?: boolean + readonly topK?: boolean + /** Accepts mid-conversation system messages. Anthropic Messages detects it from the model ID when unset. */ + readonly systemUpdates?: boolean + /** Accepts `store`. OpenAI Chat detects it from the provider when unset. */ + readonly store?: boolean + /** Accepts `stream_options.include_usage`. OpenAI Chat defaults to true. */ + readonly streamUsage?: boolean + // Accepts `prompt_cache_key` in the request body. Chat omits the key unless + // this is true; other protocols omit it only when this is false. + // Session-affinity headers still flow regardless. + readonly promptCacheKey?: boolean + readonly serviceTier?: ReadonlyArray> +} + export class LanguageModel< Options extends ProviderOptions = ProviderOptions, Compact extends CompactionOperations | undefined = CompactionOperations | undefined, @@ -232,14 +292,16 @@ export class LanguageModel< readonly id: ModelID readonly provider: ProviderID readonly route: AnyRoute - readonly defaults?: LanguageModelDefaults + readonly options?: RequestOptions + readonly capabilities?: Capabilities readonly compatibility?: LanguageModelCompatibility constructor(input: LanguageModel.ConstructorInput) { this.id = input.id this.provider = input.provider this.route = input.route - this.defaults = input.defaults + this.options = input.options + this.capabilities = input.capabilities this.compatibility = input.compatibility } @@ -251,7 +313,9 @@ export class LanguageModel< id: ModelID.make(input.id), provider: ProviderID.make(input.provider), route: input.route, - defaults: input.defaults, + // The route's options are a preset under the model's own. + options: mergeRequestOptions(input.route.options, input.options), + capabilities: input.capabilities, compatibility: input.compatibility === undefined ? undefined : LanguageModelCompatibility.make(input.compatibility), }) @@ -264,7 +328,8 @@ export class LanguageModel< id: model.id, provider: model.provider, route: model.route, - defaults: model.defaults, + options: model.options, + capabilities: model.capabilities, compatibility: model.compatibility, } } @@ -296,7 +361,8 @@ export namespace LanguageModel { readonly id: ModelID readonly provider: ProviderID readonly route: AnyRoute - readonly defaults?: LanguageModelDefaults + readonly options?: RequestOptions + readonly capabilities?: Capabilities readonly compatibility?: LanguageModelCompatibility } diff --git a/packages/ai/src/speech-client.ts b/packages/ai/src/speech-client.ts index d2c137652b..2671037053 100644 --- a/packages/ai/src/speech-client.ts +++ b/packages/ai/src/speech-client.ts @@ -1,12 +1,6 @@ import { Context } from "effect" import { MediaClient } from "./media-client.js" -import { - SpeechTimestampsEvent, - SpeechFinishEvent, - type SpeechEvent, - type SpeechRequest, - type SpeechResponse, -} from "./speech.js" +import type { SpeechEvent, SpeechRequest, SpeechResponse } from "./speech.js" export type Interface = MediaClient.Interface @@ -19,12 +13,13 @@ export const SpeechClient = { ...MediaClient.make(Service, { modality: "speech", responseEvents: (response: SpeechResponse) => [ - ...(response.timestamps === undefined ? [] : [SpeechTimestampsEvent.make({ items: response.timestamps })]), - SpeechFinishEvent.make({ + ...(response.timestamps === undefined ? [] : [{ type: "timestamps" as const, items: response.timestamps }]), + { + type: "finish" as const, audio: response.audio, usage: response.usage, providerMetadata: response.providerMetadata, - }), + }, ], }), } as const diff --git a/packages/ai/src/transcription-client.ts b/packages/ai/src/transcription-client.ts index 3fe567f94f..4b33199edc 100644 --- a/packages/ai/src/transcription-client.ts +++ b/packages/ai/src/transcription-client.ts @@ -1,11 +1,6 @@ import { Context } from "effect" import { MediaClient } from "./media-client.js" -import { - TranscriptionFinishEvent, - type TranscriptionEvent, - type TranscriptionRequest, - type TranscriptionResponse, -} from "./transcription.js" +import type { TranscriptionEvent, TranscriptionRequest, TranscriptionResponse } from "./transcription.js" export type Interface = MediaClient.Interface @@ -19,6 +14,6 @@ export const TranscriptionClient = { Service, ...MediaClient.make(Service, { modality: "transcription", - responseEvents: (response: TranscriptionResponse) => [TranscriptionFinishEvent.make({ ...response })], + responseEvents: (response: TranscriptionResponse) => [{ type: "finish" as const, ...response }], }), } as const diff --git a/packages/ai/src/video-client.ts b/packages/ai/src/video-client.ts index 7a89ef1ac8..5369167fec 100644 --- a/packages/ai/src/video-client.ts +++ b/packages/ai/src/video-client.ts @@ -1,6 +1,6 @@ import { Context } from "effect" import { MediaClient } from "./media-client.js" -import { VideoOutputEvent, VideoFinishEvent, type VideoEvent, type VideoRequest, type VideoResponse } from "./video.js" +import type { VideoEvent, VideoRequest, VideoResponse } from "./video.js" export type Interface = MediaClient.Interface @@ -13,11 +13,8 @@ export const VideoClient = { ...MediaClient.make(Service, { modality: "video", responseEvents: (response: VideoResponse) => [ - ...response.videos.map((video, index) => VideoOutputEvent.make({ index, video })), - VideoFinishEvent.make({ - usage: response.usage, - providerMetadata: response.providerMetadata, - }), + ...response.videos.map((video, index) => ({ type: "video" as const, index, video })), + { type: "finish" as const, usage: response.usage, providerMetadata: response.providerMetadata }, ], }), } as const diff --git a/packages/ai/sst-env.d.ts b/packages/ai/sst-env.d.ts deleted file mode 100644 index 64441936d7..0000000000 --- a/packages/ai/sst-env.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* This file is auto-generated by SST. Do not edit. */ -/* tslint:disable */ -/* eslint-disable */ -/* deno-fmt-ignore-file */ -/* biome-ignore-all lint: auto-generated */ - -/// - -import "sst" -export {} \ No newline at end of file diff --git a/packages/ai/test/compile.test.ts b/packages/ai/test/compile.test.ts index c8436ffddc..abad911f7c 100644 --- a/packages/ai/test/compile.test.ts +++ b/packages/ai/test/compile.test.ts @@ -52,7 +52,7 @@ describe("request option precedence", () => { }) const model = route.model({ id: "gpt-4o-mini", - defaults: { + options: { maxTokens: 20, temperature: 0.5, frequencyPenalty: 0.25, @@ -203,7 +203,7 @@ describe("request option precedence", () => { }) .model({ id: "gpt-4o-mini", - defaults: { + options: { headers: { "x-model": "model", "x-shared": "model" }, http: { body: { metadata: { model: true, shared: "model" }, value: "model" }, diff --git a/packages/ai/test/decision.test.ts b/packages/ai/test/decision.test.ts index 03ed44c758..8b84c828e8 100644 --- a/packages/ai/test/decision.test.ts +++ b/packages/ai/test/decision.test.ts @@ -35,6 +35,16 @@ const questions = [ { name: "refund", type: "predicate", instructions: "Is the customer asking for a refund?" }, ] as const +const defect = { + name: "defect", + type: "predicate", + instructions: "Is the customer reporting a product defect?", + criteria: { + true: "The product itself is broken or faulty.", + false: "Preference, sizing, shipping, or pricing complaint.", + }, +} as const + const systemOneAnswers = { department: { type: "choice", choice: "billing", probabilities: { technical: 0.1, billing: 0.9 }, confidence: 0.8 }, urgency: { @@ -516,6 +526,76 @@ describe("Decision", () => { ), ) + it.effect("sends predicate criteria as System One criteria", () => + ai.decision + .generate({ + model: TypeSafeAI.configure({ apiKey: "test" }).decision("jev-latest"), + input: [{ type: "text", text: "I returned the sweater because I prefer green." }], + questions: [defect], + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => + expect(response.answers).toEqual([{ name: "defect", type: "predicate", probability: 0.03 }]), + ), + ), + Effect.provide( + client((input) => { + expect(JSON.parse(input.text).questions).toEqual({ + defect: { + type: "noul", + instructions: "Is the customer reporting a product defect?", + criteria: { + true: "The product itself is broken or faulty.", + false: "Preference, sizing, shipping, or pricing complaint.", + }, + }, + }) + return Effect.succeed( + json(input, { model: "jev-latest", answers: { defect: { type: "noul", noul: 0.03 } } }), + ) + }), + ), + ), + ) + + it.effect("appends predicate criteria to OpenAI Decisions instructions", () => + ai.decision + .generate({ + model: OpenAI.configure({ apiKey: "openai-key" }).decision("gpt-6-luna"), + input: [{ type: "text", text: "I returned the sweater because I prefer green." }], + questions: [defect, { ...defect, name: "only_true", criteria: { true: "The product is broken." } }], + }) + .pipe( + Effect.provide( + client((input) => { + expect(JSON.parse(input.text).questions).toEqual([ + { + name: "defect", + type: "predicate", + instructions: + "Is the customer reporting a product defect?\n\nTrue means: The product itself is broken or faulty.\nFalse means: Preference, sizing, shipping, or pricing complaint.", + }, + { + name: "only_true", + type: "predicate", + instructions: "Is the customer reporting a product defect?\n\nTrue means: The product is broken.", + }, + ]) + return Effect.succeed( + json(input, { + model: "gpt-6-luna", + answers: [ + { type: "predicate", name: "defect", probability: 0.03 }, + { type: "predicate", name: "only_true", probability: 0.04 }, + ], + }), + ) + }), + ), + ), + ) + it.effect("puts media in Clef's top-level lists on Cloudflare Run", () => ai.decision .generate({ diff --git a/packages/ai/test/effort-updates.test.ts b/packages/ai/test/effort-updates.test.ts index 468ed2ea5c..7dedf329e2 100644 --- a/packages/ai/test/effort-updates.test.ts +++ b/packages/ai/test/effort-updates.test.ts @@ -12,15 +12,15 @@ import { it, testEffect } from "./lib/effect.js" import { dynamicResponse } from "./lib/http.js" import { sseEvents } from "./lib/sse.js" -const anthropic = (id: string, compatibility?: { readonly supportsEffortUpdates?: boolean }) => +const anthropic = (id: string, updates?: boolean) => AnthropicMessages.route .with({ endpoint: { baseURL: "https://api.anthropic.test/v1/" }, auth: Auth.header("x-api-key", "test") }) - .model({ id, compatibility }) + .model({ id, capabilities: updates === undefined ? undefined : { reasoning: { updates } } }) -const openai = (id: string, compatibility?: { readonly supportsEffortUpdates?: boolean }) => +const openai = (id: string, updates?: boolean) => OpenAIResponses.route .with({ endpoint: { baseURL: "https://api.openai.test/v1/" }, auth: Auth.bearer("test") }) - .model({ id, compatibility }) + .model({ id, capabilities: updates === undefined ? undefined : { reasoning: { updates } } }) const opus5 = anthropic("claude-opus-5") const astra = openai("gpt-6-astra") @@ -250,14 +250,14 @@ describe("Anthropic Messages effort updates", () => { Effect.gen(function* () { const enabled = yield* compileRequest( ai.request({ - model: anthropic("claude-sonnet-5", { supportsEffortUpdates: true }), + model: anthropic("claude-sonnet-5", true), messages: conversation, providerOptions: { effort: "low" }, }), ) const disabled = yield* compileRequest( ai.request({ - model: anthropic("claude-opus-5", { supportsEffortUpdates: false }), + model: anthropic("claude-opus-5", false), messages: conversation, providerOptions: { effort: "low" }, }), @@ -506,14 +506,14 @@ describe("OpenAI Responses effort updates", () => { Effect.gen(function* () { const enabled = yield* compileRequest( ai.request({ - model: openai("gpt-5.5", { supportsEffortUpdates: true }), + model: openai("gpt-5.5", true), messages: conversation, providerOptions: { reasoningEffort: "low" }, }), ) const disabled = yield* compileRequest( ai.request({ - model: openai("gpt-6-astra", { supportsEffortUpdates: false }), + model: openai("gpt-6-astra", false), messages: conversation, providerOptions: { reasoningEffort: "low" }, }), diff --git a/packages/ai/test/embedding.test.ts b/packages/ai/test/embedding.test.ts new file mode 100644 index 0000000000..ce346279e8 --- /dev/null +++ b/packages/ai/test/embedding.test.ts @@ -0,0 +1,455 @@ +import { describe, expect, test } from "bun:test" +import { Effect, Layer } from "effect" +import { ai, EmbeddingClient, EmbeddingUsage, Media } from "../src/effect.js" +import { Google, GoogleVertex, OpenAI, OpenAICompatible } from "../src/providers.js" +import { embeddingModel as googleEmbeddingModel } from "../src/providers/google.js" +import { it } from "./lib/effect.js" +import { dynamicResponse, json, type Handler } from "./lib/http.js" + +const client = (handler: Handler) => EmbeddingClient.layer.pipe(Layer.provide(dynamicResponse(handler))) +const offline = client(() => Effect.die("an invalid embedding request reached the network")) + +const openai = OpenAI.configure({ apiKey: "openai-key" }) + +describe("Embedding", () => { + it.effect("sends text values to OpenAI and returns vectors in value order", () => + ai.embedding + .generate({ + model: openai.embedding("text-embedding-3-small"), + values: ["first", "second"], + dimensions: 2, + inputType: "query", + providerOptions: { user: "user-1" }, + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => { + expect(response.embeddings).toEqual([ + [0.1, 0.2], + [0.3, 0.4], + ]) + expect(response.usage).toEqual(new EmbeddingUsage({ inputTokens: 4 })) + expect(response.providerMetadata).toEqual({ + openai: { model: "text-embedding-3-small", usage: { prompt_tokens: 4, total_tokens: 4 } }, + }) + }), + ), + Effect.provide( + client((input) => { + expect(input.request.url).toBe("https://api.openai.com/v1/embeddings") + expect(input.request.headers.authorization).toBe("Bearer openai-key") + expect(JSON.parse(input.text)).toEqual({ + encoding_format: "float", + user: "user-1", + model: "text-embedding-3-small", + input: ["first", "second"], + dimensions: 2, + }) + return Effect.succeed( + json(input, { + object: "list", + model: "text-embedding-3-small", + data: [ + { object: "embedding", index: 1, embedding: [0.3, 0.4] }, + { object: "embedding", index: 0, embedding: [0.1, 0.2] }, + ], + usage: { prompt_tokens: 4, total_tokens: 4 }, + }), + ) + }), + ), + ), + ) + + it.effect("sends host fields through a custom OpenAI-compatible endpoint and decodes base64 vectors", () => + ai.embedding + .generate({ + model: OpenAICompatible.configure({ + provider: "nvidia", + apiKey: "nvidia-key", + baseURL: "https://integrate.api.nvidia.test/v1/", + http: { body: { truncate: "END" } }, + }).embedding("nvidia/nemotron-3.5-embed-1b"), + values: ["a document"], + providerOptions: { input_type: "passage", encoding_format: "base64" }, + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => { + expect(response.embeddings).toEqual([[1, -2]]) + expect(response.usage).toBeUndefined() + expect(response.providerMetadata).toEqual({ nvidia: {} }) + }), + ), + Effect.provide( + client((input) => { + expect(input.request.url).toBe("https://integrate.api.nvidia.test/v1/embeddings") + expect(input.request.headers.authorization).toBe("Bearer nvidia-key") + expect(JSON.parse(input.text)).toEqual({ + encoding_format: "base64", + input_type: "passage", + truncate: "END", + model: "nvidia/nemotron-3.5-embed-1b", + input: ["a document"], + }) + const vector = Buffer.from(new Float32Array([1, -2]).buffer).toString("base64") + return Effect.succeed(json(input, { data: [{ embedding: vector }] })) + }), + ), + ), + ) + + it.effect("rejects media values before sending them to OpenAI", () => + Effect.gen(function* () { + const error = yield* ai.embedding + .generate({ + model: openai.embedding("text-embedding-3-small"), + values: ["caption", Media.bytes(new Uint8Array([1, 2, 3]), "image/png")], + }) + .pipe(Effect.flip) + expect(error.reason._tag).toBe("UnsupportedOperation") + expect(error.message).toContain("embeds text only") + }).pipe(Effect.provide(offline)), + ) + + it.effect("rejects an empty value list", () => + Effect.gen(function* () { + const error = yield* ai.embedding + .generate({ model: openai.embedding("text-embedding-3-small"), values: [] }) + .pipe(Effect.flip) + expect(error.reason._tag).toBe("InvalidRequest") + expect(error.message).toContain("Embedding values must not be empty") + }).pipe(Effect.provide(offline)), + ) + + it.effect("fails when the host returns a different number of vectors", () => + Effect.gen(function* () { + const error = yield* ai.embedding + .generate({ model: openai.embedding("text-embedding-3-small"), values: ["one", "two"] }) + .pipe(Effect.flip) + expect(error.reason._tag).toBe("InvalidProviderOutput") + expect(error.message).toContain("Expected 2 embeddings, got 1") + }).pipe(Effect.provide(client((input) => Effect.succeed(json(input, { data: [{ index: 0, embedding: [0.1] }] }))))), + ) + + it.effect("batches Google values as one content each and maps inputType to taskType", () => + ai.embedding + .generate({ + model: Google.configure({ apiKey: "google-key" }).embedding("gemini-embedding-2"), + values: ["a caption", Media.base64("iVBORw0KGgo=", "image/png")], + dimensions: 256, + inputType: "document", + providerOptions: { title: "Restroom" }, + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => { + expect(response.embeddings).toEqual([ + [0.1, 0.2], + [0.3, 0.4], + ]) + expect(response.usage).toEqual(new EmbeddingUsage({ inputTokens: 260 })) + expect(response.providerMetadata).toEqual({ google: { usageMetadata: { promptTokenCount: 260 } } }) + }), + ), + Effect.provide( + client((input) => { + expect(input.request.url).toBe( + "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-2:batchEmbedContents", + ) + expect(input.request.headers["x-goog-api-key"]).toBe("google-key") + const fields = { taskType: "RETRIEVAL_DOCUMENT", outputDimensionality: 256, title: "Restroom" } + expect(JSON.parse(input.text)).toEqual({ + requests: [ + { model: "models/gemini-embedding-2", content: { parts: [{ text: "a caption" }] }, ...fields }, + { + model: "models/gemini-embedding-2", + content: { parts: [{ inlineData: { mimeType: "image/png", data: "iVBORw0KGgo=" } }] }, + ...fields, + }, + ], + }) + return Effect.succeed( + json(input, { + embeddings: [{ values: [0.1, 0.2] }, { values: [0.3, 0.4] }], + usageMetadata: { promptTokenCount: 260 }, + }), + ) + }), + ), + ), + ) + + it.effect("lets a Google taskType option replace the inputType mapping and sends settings", () => + ai.embedding + .generate({ + model: googleEmbeddingModel("gemini-embedding-001", { + apiKey: "google-key", + headers: { "x-test": "yes" }, + body: { extra: true }, + }), + values: ["query"], + inputType: "query", + providerOptions: { taskType: "CODE_RETRIEVAL_QUERY" }, + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => { + expect(response.usage).toBeUndefined() + expect(response.providerMetadata).toEqual({ google: {} }) + }), + ), + Effect.provide( + client((input) => { + expect(input.request.headers["x-test"]).toBe("yes") + expect(JSON.parse(input.text)).toEqual({ + requests: [ + { + model: "models/gemini-embedding-001", + content: { parts: [{ text: "query" }] }, + taskType: "CODE_RETRIEVAL_QUERY", + }, + ], + extra: true, + }) + return Effect.succeed(json(input, { embeddings: [{ values: [1] }] })) + }), + ), + ), + ) + + it.effect("splits more than 100 Google values across batches and joins them in order", () => + Effect.gen(function* () { + const sizes: Array = [] + const response = yield* ai.embedding + .generate({ + model: Google.configure({ apiKey: "google-key" }).embedding("gemini-embedding-2"), + values: Array.from({ length: 105 }, (_, index) => `${index}`), + }) + .pipe( + Effect.provide( + client((input) => { + const requests: Array<{ content: { parts: Array<{ text: string }> } }> = JSON.parse(input.text).requests + sizes.push(requests.length) + return Effect.succeed( + json(input, { + embeddings: requests.map((request) => ({ values: [Number(request.content.parts[0].text)] })), + usageMetadata: { promptTokenCount: requests.length }, + }), + ) + }), + ), + ) + expect(sizes.toSorted((a, b) => a - b)).toEqual([5, 100]) + expect(response.embeddings).toEqual(Array.from({ length: 105 }, (_, index) => [index])) + expect(response.usage).toEqual(new EmbeddingUsage({ inputTokens: 105 })) + expect(response.providerMetadata).toEqual({ + google: { + responses: [{ usageMetadata: { promptTokenCount: 100 } }, { usageMetadata: { promptTokenCount: 5 } }], + }, + }) + }), + ) + + it.effect("sends one Vertex embedContent request per value with embedContentConfig", () => + Effect.gen(function* () { + const bodies: Array = [] + const response = yield* ai.embedding + .generate({ + model: GoogleVertex.configure({ accessToken: "vertex-token", project: "proj", location: "us" }).embedding( + "gemini-embedding-2", + ), + values: ["first", Media.base64("JVBERi0=", "application/pdf")], + dimensions: 128, + providerOptions: { documentOcr: true }, + }) + .pipe( + Effect.provide( + client((input) => { + expect(input.request.url).toBe( + "https://aiplatform.us.rep.googleapis.com/v1beta1/projects/proj/locations/us/publishers/google/models/gemini-embedding-2:embedContent", + ) + expect(input.request.headers.authorization).toBe("Bearer vertex-token") + const body = JSON.parse(input.text) + bodies.push(body) + return Effect.succeed( + json(input, { + embedding: { values: ["text" in body.content.parts[0] ? 1 : 2] }, + usageMetadata: { promptTokenCount: 3 }, + truncated: false, + }), + ) + }), + ), + ) + expect(bodies).toContainEqual({ + content: { parts: [{ text: "first" }] }, + embedContentConfig: { outputDimensionality: 128, documentOcr: true }, + }) + expect(bodies).toContainEqual({ + content: { parts: [{ inlineData: { mimeType: "application/pdf", data: "JVBERi0=" } }] }, + embedContentConfig: { outputDimensionality: 128, documentOcr: true }, + }) + expect(response.embeddings).toEqual([[1], [2]]) + expect(response.usage).toEqual(new EmbeddingUsage({ inputTokens: 6 })) + expect(response.providerMetadata).toEqual({ + vertex: { + responses: [ + { usageMetadata: { promptTokenCount: 3 }, truncated: false }, + { usageMetadata: { promptTokenCount: 3 }, truncated: false }, + ], + }, + }) + }), + ) + + test("rejects Vertex Express Mode keys for embedContent", () => { + expect(() => GoogleVertex.configure({ apiKey: "vertex-key" }).embedding("gemini-embedding-2")).toThrow( + "does not support Express Mode API keys", + ) + }) + + it.effect("sends Vertex text embedding models through :predict with instances and parameters", () => + ai.embedding + .generate({ + model: GoogleVertex.configure({ apiKey: "vertex-key" }).embedding("text-embedding-005"), + values: ["first", "second"], + dimensions: 256, + inputType: "query", + providerOptions: { title: "Docs", autoTruncate: false }, + }) + .pipe( + Effect.tap((response) => + Effect.sync(() => { + expect(response.embeddings).toEqual([[0.1], [0.2]]) + expect(response.usage).toEqual(new EmbeddingUsage({ inputTokens: 5 })) + expect(response.providerMetadata).toEqual({ + vertex: { + statistics: [ + { token_count: 2, truncated: false }, + { token_count: 3, truncated: false }, + ], + metadata: { billableCharacterCount: 11 }, + }, + }) + }), + ), + Effect.provide( + client((input) => { + expect(input.request.url).toBe( + "https://aiplatform.googleapis.com/v1/publishers/google/models/text-embedding-005:predict", + ) + expect(input.request.headers["x-goog-api-key"]).toBe("vertex-key") + expect(JSON.parse(input.text)).toEqual({ + instances: [ + { content: "first", task_type: "RETRIEVAL_QUERY", title: "Docs" }, + { content: "second", task_type: "RETRIEVAL_QUERY", title: "Docs" }, + ], + parameters: { outputDimensionality: 256, autoTruncate: false }, + }) + return Effect.succeed( + json(input, { + predictions: [ + { embeddings: { values: [0.1], statistics: { token_count: 2, truncated: false } } }, + { embeddings: { values: [0.2], statistics: { token_count: 3, truncated: false } } }, + ], + metadata: { billableCharacterCount: 11 }, + }), + ) + }), + ), + ), + ) + + it.effect("sends gemini-embedding-001 on Vertex one text per :predict request", () => + Effect.gen(function* () { + const sent: Array = [] + const response = yield* ai.embedding + .generate({ + model: GoogleVertex.configure({ apiKey: "vertex-key" }).embedding("gemini-embedding-001"), + values: ["0", "1", "2"], + providerOptions: { taskType: "CLUSTERING" }, + }) + .pipe( + Effect.provide( + client((input) => { + const body = JSON.parse(input.text) + expect(body.instances).toHaveLength(1) + expect(body.instances[0].task_type).toBe("CLUSTERING") + expect(body.parameters).toBeUndefined() + sent.push(body.instances[0].content) + return Effect.succeed( + json(input, { + predictions: [{ embeddings: { values: [Number(body.instances[0].content)] } }], + }), + ) + }), + ), + ) + expect(sent.toSorted()).toEqual(["0", "1", "2"]) + expect(response.embeddings).toEqual([[0], [1], [2]]) + expect(response.usage).toBeUndefined() + }), + ) + + it.effect("splits more than 250 Vertex :predict values", () => + Effect.gen(function* () { + const sizes: Array = [] + const response = yield* ai.embedding + .generate({ + model: GoogleVertex.configure({ apiKey: "vertex-key" }).embedding("text-multilingual-embedding-002"), + values: Array.from({ length: 251 }, (_, index) => `${index}`), + }) + .pipe( + Effect.provide( + client((input) => { + const instances: Array<{ content: string }> = JSON.parse(input.text).instances + sizes.push(instances.length) + return Effect.succeed( + json(input, { + predictions: instances.map((instance) => ({ embeddings: { values: [Number(instance.content)] } })), + }), + ) + }), + ), + ) + expect(sizes.toSorted((a, b) => a - b)).toEqual([1, 250]) + expect(response.embeddings).toEqual(Array.from({ length: 251 }, (_, index) => [index])) + }), + ) + + it.effect("rejects media values before sending them to Vertex :predict", () => + Effect.gen(function* () { + const error = yield* ai.embedding + .generate({ + model: GoogleVertex.configure({ apiKey: "vertex-key" }).embedding("text-embedding-005"), + values: [Media.bytes(new Uint8Array([1, 2, 3]), "image/png")], + }) + .pipe(Effect.flip) + expect(error.reason._tag).toBe("UnsupportedOperation") + expect(error.message).toContain("embeds text only") + }).pipe(Effect.provide(offline)), + ) + + it.effect("sends tuned Vertex embedding endpoints through :predict", () => + ai.embedding + .generate({ + model: GoogleVertex.configure({ + accessToken: "vertex-token", + project: "proj", + location: "us-central1", + }).embedding("endpoints/123"), + values: ["text"], + }) + .pipe( + Effect.provide( + client((input) => { + expect(input.request.url).toBe( + "https://us-central1-aiplatform.googleapis.com/v1beta1/projects/proj/locations/us-central1/endpoints/123:predict", + ) + return Effect.succeed(json(input, { predictions: [{ embeddings: { values: [1] } }] })) + }), + ), + ), + ) +}) diff --git a/packages/ai/test/exports.test.ts b/packages/ai/test/exports.test.ts index b49a625890..5d0daa0a4c 100644 --- a/packages/ai/test/exports.test.ts +++ b/packages/ai/test/exports.test.ts @@ -5,6 +5,7 @@ import { AIClient, AIError, DecisionClient, + EmbeddingClient, Generation, ImageClient, LanguageModel, @@ -87,6 +88,9 @@ describe("public exports", () => { expect(ai.decision.generate).toBeFunction() expect(DecisionClient.layer).toBeDefined() expect(DecisionClient.fetchLayer).toBeDefined() + expect(ai.embedding.generate).toBeFunction() + expect(EmbeddingClient.layer).toBeDefined() + expect(AI.ai.embedding.generate).toBeFunction() }) test("both entry points export the raw event type", () => { @@ -112,6 +116,8 @@ describe("public exports", () => { yield* VideoClient.Service yield* SpeechClient.Service yield* TranscriptionClient.Service + yield* DecisionClient.Service + yield* EmbeddingClient.Service yield* RequestExecutor.Service }).pipe(Effect.provide(AIClient.layerWith(counting))), ) @@ -128,6 +134,7 @@ describe("public exports", () => { const { OpenAICompatibleResponses } = await import("@opencode/ai/providers") expect(OpenAI.model).toBeFunction() + expect(OpenAI.embedding).toBeFunction() expect(OpenAI.provider.responses).toBe(OpenAI.responses) expect(OpenAI.configure({ apiKey: "fixture" }).responses).toBeFunction() for (const provider of [Baseten, DeepSeek, Fireworks]) { diff --git a/packages/ai/test/fixtures/recordings/cohere-embedding/embeds-text-through-the-compatibility-api.json b/packages/ai/test/fixtures/recordings/cohere-embedding/embeds-text-through-the-compatibility-api.json new file mode 100644 index 0000000000..b719228c11 --- /dev/null +++ b/packages/ai/test/fixtures/recordings/cohere-embedding/embeds-text-through-the-compatibility-api.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "metadata": { + "model": "embed-v4.0", + "tags": [ + "prefix:cohere-embedding", + "provider:cohere", + "protocol:openai-embeddings" + ], + "name": "cohere-embedding/embeds-text-through-the-compatibility-api", + "recordedAt": "2026-11-09T05:56:40.410Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://api.cohere.ai/compatibility/v1/embeddings", + "headers": { + "content-type": "application/json" + }, + "body": "{\"encoding_format\":\"float\",\"model\":\"embed-v4.0\",\"input\":[\"The invoice was charged twice.\",\"Refund the duplicate payment.\"],\"dimensions\":256}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": "{\"id\":\"476f323c-e9b2-4149-9162-bf110aa48d15\",\"object\":\"list\",\"data\":[{\"index\":0,\"object\":\"embedding\",\"embedding\":[-0.050742682,-0.031341065,0.053184845,-0.13079129,-0.1090832,0.02876323,-0.12644967,0.035004307,0.018723235,0.009768644,-0.09171672,-0.0076656723,-0.15629831,-0.11451022,0.01024351,-0.016552424,-0.031476744,0.014110263,-0.0058001326,0.028356206,0.032562148,-0.053727545,0.16932318,0.002357364,-0.15955453,0.029170258,-0.0061054025,-0.08574699,0.13621832,-0.015534858,-0.044501606,0.05047133,0.005969727,-0.010311347,-0.11233941,0.04368755,0.013771075,-0.06132538,-0.0066820243,-0.025642691,0.0065463483,-0.038531873,0.008140537,-0.05427025,-0.091174014,-0.037717823,-0.0126856705,0.0026965528,-0.032969173,0.052370787,0.05698376,0.09171672,-0.11668103,0.09008861,0.12807779,-0.019130262,-0.024964314,0.035004307,-0.009022429,0.05969727,-0.05698376,-0.019944316,-0.02292918,0.07923456,0.034461606,-0.098771855,-0.00216233,0.07977726,0.075978346,0.045315657,-0.08249078,0.045044307,-0.009565131,-0.0545416,0.13241939,0.062410783,-0.013228372,-0.065938346,0.009090266,0.0010090874,0.05047133,-0.0012465197,0.06838051,0.13621832,0.0052235113,0.015263507,0.024828639,-0.04612971,-0.00495216,0.07163673,-0.024285935,0.016145399,-0.10528427,-0.01485648,0.0058340514,-0.02971296,-0.075435646,0.04151674,-0.08954591,-0.0076995916,0.07326483,-0.032969173,0.026728097,-0.040702682,-0.004138106,-0.010650536,-0.103113465,-0.00012030612,-0.020215666,-0.047215115,0.03554701,-0.044772957,0.06349619,-0.123736165,-0.042330794,-0.06268213,0.07109402,-0.045315657,-0.026185393,0.0033240528,0.0083440505,0.03744647,-0.027949177,-0.01763783,0.032697823,0.058340516,0.056169704,-0.09225942,-0.07923456,-0.067023754,-0.023607558,0.02007999,0.037989173,0.036632415,0.009225942,0.08900321,-0.037989173,0.006783781,0.15738371,-0.039345928,-0.1101686,-0.06946591,-0.012821346,-0.03744647,0.031341065,0.08411889,0.10365617,-0.042059444,-0.14761508,-0.025099989,-0.034190256,-0.013228372,-0.08086266,-0.032155123,0.008513645,0.017366478,0.052370787,-0.10094266,0.09008861,-0.042059444,0.09334482,-0.1101686,-0.012957022,0.030934041,0.02007999,-0.0065124296,0.042602144,-0.01207513,0.013974588,0.020622695,-0.014924318,0.046943765,0.058883216,0.00014415535,-0.035004307,0.053998895,-0.00033282925,-0.032833498,0.018451884,-0.078149155,-0.032562148,-0.11613833,-0.032833498,-0.064038895,-0.0007631753,0.0015178709,-0.10474157,0.055898353,-0.029034583,0.14978588,-0.044501606,0.06132538,-0.026049718,-0.081405364,0.020351341,-0.040702682,-0.015941884,-0.06810916,-0.031205392,-0.07380754,0.05942592,0.022522153,-0.04097404,0.039074577,-0.061596733,-0.0030187825,-0.14544426,-0.14652966,-0.034732956,-0.00742824,-0.037989173,0.002043614,0.015670532,0.06810916,0.064581595,-0.006410673,-0.0028661476,0.00025333182,-0.010379185,0.024692964,0.049657278,-0.05047133,-0.033104848,0.067023754,-0.013771075,-0.07706375,0.17257938,-0.040702682,-0.021165397,0.050742682,-0.029441608,0.08194808,0.010311347,0.099314556,-0.014720804,0.017502153,-0.10419887,-0.10691239,-0.13730372,0.03066269,0.00037310793,0.021572422,-0.00712297,0.100399956,-0.005732295,-0.03744647,-0.0136354,0.03161242,-0.12970589,-0.008513645,-0.099314556,-0.007360402,0.050742682,-0.058611866,0.0879178,0.018180532]},{\"index\":1,\"object\":\"embedding\",\"embedding\":[-0.059229366,0.10517365,-0.00012325037,-0.12510128,-0.03736432,-0.036810774,-0.12178001,0.036810774,-0.030029843,-0.04151591,-0.055077776,-0.07196091,-0.04068559,-0.15056437,0.04040882,0.041792683,-0.091335006,-0.021034729,-0.034596592,-0.012593159,-0.026985344,0.020481182,0.22141819,-0.060890004,-0.100745276,0.045667503,-0.044837188,-0.03708755,0.06725578,0.058952596,-0.026570184,0.0106557505,0.036810774,0.0741751,-0.109048456,0.08303182,0.005881421,-0.037917867,-0.008718342,0.021449888,0.010309785,-0.032935955,-0.058675826,-0.019374093,0.06144355,-0.017505877,0.035150137,0.100745276,0.027677273,-0.016260399,0.009548659,-0.0042207846,-0.075835735,-0.060059685,0.0035288525,-0.092442095,-0.024632776,0.11070909,-0.035703685,0.011832035,0.021449888,-0.018543774,-0.067532554,0.029614683,0.019789252,-0.17713456,0.011624455,0.018128615,0.05424746,0.039024957,-0.0051202956,0.06144355,-0.016467977,-0.06476482,0.123994194,0.031690482,0.004428364,-0.058675826,-0.00041515913,0.075835735,-0.018958934,-0.006538756,0.014738149,0.17934875,0.015222501,0.13451156,0.031828865,-0.008995114,-0.004376469,0.028369207,-0.021173116,-0.047051366,-0.09410273,0.059229366,-0.025463091,0.050926182,-0.106834285,0.047881685,-0.046221048,-0.020066025,0.07971056,-0.014461376,0.103513,-0.028369207,-0.0067809327,-0.031552095,-0.030168228,0.09687046,-0.101852365,-0.100745276,0.007749637,0.039024957,-0.02823082,-0.16717073,-0.030721774,0.034043048,-0.035980456,0.026293412,-0.045113955,-0.04843523,0.0053278753,0.0068501253,-0.05646164,0.013492672,0.06531837,0.022972137,-0.024632776,-0.107941374,-0.029061139,-0.11347683,-0.07085382,0.043730095,0.036810774,0.033489503,0.0021795854,-0.019789252,-0.04649782,-0.005293279,0.08469246,-0.11735165,-0.041792683,-0.11236973,-0.103513,-0.050372638,-0.0068501253,0.021311501,-0.02712373,-0.04400687,-0.07749637,0.045667503,-0.00781883,0.019789252,-0.050095864,0.024217615,0.01432299,-0.019650865,0.053417142,-0.04151591,-0.0068155285,-0.04123914,0.06421127,-0.106834285,0.017851843,-0.0025428494,0.060059685,0.024771161,0.13783282,-0.10572719,-0.092442095,0.022556977,-0.033766277,0.042899776,0.06559514,0.018128615,0.011901228,0.041792683,0.035288524,0.05231005,-0.030445002,-0.11790519,-0.08081764,-0.045944273,0.044560414,-0.060336456,0.03625723,-0.029476298,-0.107387826,0.013492672,0.013977024,-0.030860161,-0.020066025,0.05978291,0.006677143,-0.036534004,-0.015499274,-0.07002351,-0.068086095,-0.07915701,-0.075282186,-0.10019173,0.042069457,0.065041594,-0.084138915,0.038748186,-0.075835735,0.028507592,-0.10019173,-0.12786901,-0.060059685,-0.031690482,-0.05729196,0.016260399,0.010171398,-0.029476298,0.03307434,-0.04539073,0.026570184,0.025047932,0.046774592,0.028507592,0.04898878,0.06946996,-0.033351116,0.11458392,-0.02172666,-0.11126264,0.050095864,-0.09963819,-0.0041688895,0.003442361,0.015706854,0.0741751,0.076942824,0.020481182,-0.017990228,0.07306801,-0.10240591,-0.13174382,-0.085246004,0.0020844447,-0.092442095,0.045113955,-0.02020441,0.07140737,0.059506137,-0.09078146,-0.009271887,0.02781566,-0.08137118,0.0014271095,0.005085699,-0.018543774,-0.07915701,-0.049542323,0.101298824,-0.015360887]}],\"model\":\"embed-v4.0\",\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":0,\"total_tokens\":11,\"text_tokens\":11}}" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/google-embedding/embeds-an-image-and-text-into-one-vector-each.json b/packages/ai/test/fixtures/recordings/google-embedding/embeds-an-image-and-text-into-one-vector-each.json new file mode 100644 index 0000000000..a4b548b94f --- /dev/null +++ b/packages/ai/test/fixtures/recordings/google-embedding/embeds-an-image-and-text-into-one-vector-each.json @@ -0,0 +1,32 @@ +{ + "version": 1, + "metadata": { + "tags": [ + "prefix:google-embedding", + "provider:google", + "protocol:google-embed-content" + ], + "name": "google-embedding/embeds-an-image-and-text-into-one-vector-each", + "recordedAt": "2026-11-09T06:56:09.697Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-2:batchEmbedContents", + "headers": { + "content-type": "application/json" + }, + "body": "{\"requests\":[{\"model\":\"models/gemini-embedding-2\",\"content\":{\"parts\":[{\"inlineData\":{\"mimeType\":\"image/jpeg\",\"data\":\"/9j/4AAQSkZJRgABAgAAAQABAAD//gAQTGF2YzYwLjMxLjEwMgD/2wBDAAgQEBMQExYWFhYWFhoYGhsbGxoaGhobGxsdHR0iIiIdHR0bGx0dICAiIiUmJSMjIiMmJigoKDAwLi44ODpFRVP/xABrAAEBAQEBAQAAAAAAAAAAAAAABwgGBAUBAQAAAAAAAAAAAAAAAAAAAAAQAAICAQEFBwMEAwEAAAAAAAABAwIEEQYFEiFhwXGBUUExE6GRU0LwciLh8bEjEQEAAAAAAAAAAAAAAAAAAAAA/8AAEQgAgACAAwEiAAIRAAMRAP/aAAwDAQACEQMRAD8Av4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB458iLFjtLNesdK+9rPRf76e4yMiPFivNLbhpHV2s+i7X6LzMhb33xPvabitrWKrfxxa8qrzfnZ+r8EBTc/bPm64USa/LLrz61omvq/AnMu0W9ZXq8q9elFSi+ldTigB2se0W9Ynqsq9ul1S6+tSiYG2b1Vc2Jafli15dXRt/R+BBgBuvHyIcqOssN6yUt7Wq9V/h9HzPYY03RvefdM3HTW0dn/AOkWvKy815WXo/ua+x8iPKhpNFbipJVWq/36r2a8wPaAAAAAAAAAAIDtnnvWLCq+WnyydfSlX9X9iDHZ7QyuXeuW3+m6ou6lUjjAAAAAAAXbYzeDVpcKz5NfLH0ftdLv5P7kJOw2flcW9cRr1k4H3XTr2gbHAAAAAAAAAAGO9oYnFvXLT/VdXXdeqZxhdts8Bq0WZVcmvik6NaujffzX2ISAAAAAADr9wRuXeuGl6ScfhRO3YcgXHYzAdpZcyy/rRfFH1s+dmu5aLxA0MAAAAAAAAAAPDk40WXDJDLXipJXha7V1Xuupj7eu6p91TuORO1Hr8cmnK67LL1Rs8+fk4sOZFaKeOslLe6f/AFP3T8muYGGAXHP2Nkq3bDlV6/jl5WXRXXJ+KROpdxb0ielsOZ/wXGvvRsDkwdXHuLekr0WHMv5V4F97tFDwNjZrtWzJVHX8cb4rvo7acK8NQJtuvdc+9Z1FGtKrT5JNP60r2vyXqbBxMWLCgjgiXDSNaLzfm31b5sYuJBhRKKCOsdF6L1fm37t9WfRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/9k=\"}}]},\"outputDimensionality\":128},{\"model\":\"models/gemini-embedding-2\",\"content\":{\"parts\":[{\"text\":\"A small square image.\"}]},\"outputDimensionality\":128}]}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"embeddings\": [\n {\n \"values\": [\n -0.060695454,\n -0.16676353,\n -0.014622029,\n -0.0369989,\n -0.07764896,\n -0.024174407,\n 0.042032935,\n -0.0015557865,\n -0.023695432,\n -0.1497187,\n -0.025017679,\n 0.06438567,\n 0.010775195,\n -0.1025198,\n 0.08094253,\n 0.020372627,\n -0.0042680614,\n -0.01302046,\n 0.016640898,\n 0.03898399,\n -0.04134967,\n -0.036376182,\n 0.022557853,\n 0.03913328,\n -0.08211433,\n 0.01890385,\n 0.012346725,\n -0.04081329,\n -0.044884365,\n 0.35187453,\n -0.012423337,\n -0.04902881,\n 0.055406027,\n -0.024738494,\n 0.0910491,\n -0.09677539,\n -0.03170299,\n 0.082624085,\n 0.019814415,\n -0.008206397,\n -0.034400895,\n -0.016858248,\n 0.0113725355,\n 0.047203444,\n -0.011291501,\n -0.08147267,\n 0.024802648,\n -0.0113782985,\n 0.0049352786,\n 0.035522662,\n 0.10245429,\n 0.00234546,\n -0.1333667,\n -0.007869423,\n 0.030382834,\n 0.05243392,\n -0.03965319,\n 0.021363147,\n -0.021653442,\n -0.064418085,\n -0.024809368,\n -0.002167328,\n -0.017991243,\n 0.041653287,\n -0.062733434,\n -0.015845643,\n 0.045335785,\n -0.05263401,\n -0.047420107,\n -0.050459415,\n 0.012136268,\n 0.0106795635,\n 0.018208819,\n 0.047718324,\n 0.050123528,\n -0.057227056,\n -0.05015243,\n -0.026977116,\n 0.01494459,\n -0.021070806,\n -0.0010004406,\n -0.02632088,\n -0.03466405,\n -0.010536535,\n -0.060299378,\n -0.021053744,\n 0.06964341,\n -0.022528982,\n 0.045283075,\n 0.015700605,\n -0.012671969,\n -0.030455485,\n -0.015061047,\n 0.008110022,\n -0.032319747,\n -0.07088189,\n -0.020862978,\n 0.0012270943,\n -0.048924483,\n 0.061084464,\n 0.007996045,\n 0.0019241121,\n -0.069225684,\n -0.019252202,\n 0.0012802874,\n -0.052421395,\n 0.06391537,\n -0.030530954,\n -0.07110764,\n -0.0691781,\n -0.036115203,\n -0.36308432,\n -0.022246694,\n -0.05472309,\n 0.017038023,\n 0.6788818,\n -0.04438193,\n 0.022014968,\n 0.036325,\n 0.02110961,\n -0.033575546,\n -0.0011139157,\n -0.0132337855,\n 0.027654596,\n 0.02986413,\n -0.00597513,\n -0.047889307,\n -0.03105767\n ]\n },\n {\n \"values\": [\n -0.07348734,\n 0.058014095,\n -0.07439354,\n 0.005782239,\n 0.03540112,\n -0.020454172,\n -0.043367438,\n 0.0076436116,\n -0.043582547,\n -0.16619165,\n 0.11180406,\n 0.027603088,\n 0.11537567,\n -0.050174788,\n 0.01823103,\n -0.057214037,\n -0.00063154247,\n 0.08172401,\n 0.010149112,\n -0.013878285,\n 0.004687302,\n -0.007362179,\n -0.038548544,\n -0.012590715,\n 0.032411125,\n -0.031378265,\n -0.03343408,\n 0.080075584,\n 0.020124901,\n 0.36560065,\n -0.005742146,\n 0.12878247,\n -0.07061178,\n -0.06762567,\n 0.04209995,\n -0.05458626,\n 0.04457706,\n 0.011975002,\n 0.028867552,\n -0.099761575,\n -0.023624368,\n 0.000761353,\n -0.03569734,\n 0.08086029,\n -0.1480097,\n 0.061061267,\n -0.03427503,\n 0.05064104,\n 0.024667451,\n 0.059212048,\n 0.04548406,\n 0.0013026758,\n 0.05403232,\n 0.040431008,\n 0.08995319,\n 0.015512121,\n -0.045479815,\n 0.018925536,\n -0.06662972,\n 0.0070882696,\n 0.032891102,\n -0.13106298,\n -0.009988906,\n -0.03928157,\n 0.010292592,\n 0.012359754,\n 0.037858266,\n 0.05525646,\n 0.0076784333,\n 0.037685215,\n -0.039831035,\n -0.052651886,\n 0.055160705,\n 0.039733298,\n -0.07184765,\n -0.18210597,\n -0.049278192,\n 0.05887453,\n 0.012229632,\n -0.0106056845,\n 0.117099665,\n 0.04492413,\n 0.027917886,\n -0.019317398,\n -0.057401214,\n -0.13336012,\n -0.07114207,\n 0.0077259336,\n -0.04206231,\n 0.031035932,\n -0.044222888,\n 0.054862186,\n -0.06381428,\n 0.019193633,\n -0.1454552,\n -0.06991198,\n 0.033321287,\n 0.17329463,\n 0.06438023,\n 0.022623677,\n -0.009573466,\n -0.018114265,\n -0.02589199,\n 0.027245803,\n 0.04145004,\n 0.006055637,\n 0.024168594,\n -0.016137246,\n 0.003217981,\n 0.0276925,\n 0.061841067,\n -0.6379371,\n -0.06398904,\n 0.019271554,\n -0.035416443,\n -0.07965318,\n -0.12509108,\n 0.00091902283,\n -0.027904658,\n 0.014234293,\n -0.07321166,\n -0.052702807,\n -0.06417575,\n 0.042428393,\n -0.008938485,\n -0.048144527,\n 0.029265637,\n 0.03570763\n ]\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": 263,\n \"promptTokenDetails\": [\n {\n \"modality\": \"IMAGE\",\n \"tokenCount\": 258\n },\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 5\n }\n ]\n }\n}\n" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/google-embedding/embeds-text-through-batchembedcontents.json b/packages/ai/test/fixtures/recordings/google-embedding/embeds-text-through-batchembedcontents.json new file mode 100644 index 0000000000..f5728c5df2 --- /dev/null +++ b/packages/ai/test/fixtures/recordings/google-embedding/embeds-text-through-batchembedcontents.json @@ -0,0 +1,32 @@ +{ + "version": 1, + "metadata": { + "tags": [ + "prefix:google-embedding", + "provider:google", + "protocol:google-embed-content" + ], + "name": "google-embedding/embeds-text-through-batchembedcontents", + "recordedAt": "2026-11-09T06:56:16.394Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-2:batchEmbedContents", + "headers": { + "content-type": "application/json" + }, + "body": "{\"requests\":[{\"model\":\"models/gemini-embedding-2\",\"content\":{\"parts\":[{\"text\":\"The invoice was charged twice.\"}]},\"taskType\":\"RETRIEVAL_DOCUMENT\",\"outputDimensionality\":256},{\"model\":\"models/gemini-embedding-2\",\"content\":{\"parts\":[{\"text\":\"Refund the duplicate payment.\"}]},\"taskType\":\"RETRIEVAL_DOCUMENT\",\"outputDimensionality\":256}]}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"embeddings\": [\n {\n \"values\": [\n 0.08826861,\n -0.010503297,\n -0.003593779,\n -0.04362853,\n -0.036237195,\n -0.055654835,\n -0.083461575,\n 0.033482846,\n 0.036843903,\n -0.17836286,\n -0.012956421,\n 0.021917608,\n 0.05855208,\n 0.016266014,\n 0.05865058,\n 0.009627632,\n 0.053421967,\n -0.014696311,\n -0.06453404,\n -0.018494826,\n -0.042978473,\n -0.058279276,\n -0.029961104,\n -0.030288767,\n 0.0073536662,\n -0.046593722,\n 0.015977599,\n 0.019617883,\n 0.03970064,\n 0.38354987,\n -0.033308115,\n 0.031935018,\n -0.03247434,\n -0.03815824,\n 0.05267559,\n -0.10165431,\n -0.041823577,\n 0.06042345,\n 0.0018351023,\n 0.051456507,\n 0.052291792,\n 2.8428964e-05,\n -0.07374836,\n -0.0061268187,\n -0.035403196,\n 0.0024109676,\n -0.0416654,\n -0.0021237924,\n 0.04037082,\n -0.079502486,\n -0.05369692,\n -0.015340817,\n -0.0644507,\n 0.04906819,\n 0.043795276,\n 0.011756599,\n 0.027179904,\n -0.014487515,\n 0.040554237,\n 0.05260127,\n -0.07062641,\n 0.010476285,\n 0.06995466,\n 0.05079814,\n -0.021293104,\n 0.054295633,\n -0.027834542,\n -0.072753094,\n 0.07105707,\n 0.06042876,\n -0.12779789,\n 0.038879916,\n -0.08831736,\n 0.06513875,\n -0.007510305,\n -0.13622166,\n -0.074078396,\n 0.06498969,\n 0.044894755,\n 0.019542063,\n -0.04276829,\n -0.011232061,\n -0.057544988,\n -0.020430364,\n -0.060440596,\n 0.04143041,\n -0.030176722,\n -0.0069830897,\n -0.07553233,\n 0.030186994,\n -0.041128784,\n -0.13769294,\n 0.08790415,\n -0.0050185462,\n -0.089577004,\n 0.009078706,\n 0.07965475,\n 0.059314027,\n -0.014337807,\n -0.009616872,\n 0.017148038,\n -0.0559987,\n -0.084258616,\n -0.087398924,\n 0.023736937,\n -0.006153544,\n 0.012847555,\n -0.051635522,\n -0.023994954,\n -0.017216988,\n 0.005052825,\n -0.48903733,\n -0.031868614,\n -0.00405748,\n 0.049377847,\n -0.11121355,\n 0.03040298,\n 0.0657372,\n -0.052349366,\n 0.027236087,\n 0.059038788,\n 0.009941072,\n -0.016297461,\n -0.011371718,\n -0.010174601,\n 0.08847744,\n 0.07474075,\n -0.018525193,\n -0.0049489983,\n -0.016156295,\n -0.0008972978,\n 0.084703036,\n -8.523724e-05,\n -0.016584247,\n -0.018745024,\n -0.0027212733,\n 0.089199334,\n -0.0036129493,\n 0.026515242,\n -0.0068128984,\n -0.007686669,\n 0.0028604842,\n 0.040065005,\n -0.05489823,\n -0.0055631036,\n 0.058329903,\n 0.011494569,\n -0.034512483,\n -0.008964485,\n -0.046100236,\n -0.028631702,\n 0.053142093,\n 0.10161717,\n 0.008478608,\n -0.025940085,\n 0.041855946,\n 0.036950104,\n 0.03752138,\n -0.031569928,\n -0.09411969,\n -0.07016315,\n -0.077472076,\n 0.054901585,\n 0.032077942,\n 0.0002365121,\n -0.021486815,\n -0.03782185,\n 0.06342147,\n -0.0400071,\n 0.013592747,\n 0.029044827,\n -0.04941764,\n 0.027012195,\n -0.020215036,\n 0.035024326,\n -0.018768141,\n -0.010166947,\n 0.0063576326,\n -0.035777643,\n -0.03318015,\n -0.0013767413,\n -0.016789285,\n -0.023925936,\n -0.02882159,\n 0.09833145,\n 0.03744801,\n -0.0014872245,\n -0.057880018,\n 0.014366774,\n 0.055709057,\n 0.012810761,\n 0.06668003,\n 0.00017016666,\n 0.0012475014,\n 0.00870707,\n -0.070864856,\n -0.04660088,\n 0.011100339,\n 0.027194036,\n 0.0289681,\n -0.060197454,\n 0.005464363,\n 0.010492512,\n -0.041788977,\n -0.037648804,\n -0.086552024,\n -0.043190144,\n 0.02386924,\n -0.011399005,\n 0.06646394,\n 0.050833337,\n 0.03239632,\n 0.049356397,\n 0.036520176,\n 0.008604959,\n 0.020041626,\n 0.01113018,\n 0.15001084,\n 0.016630875,\n 0.018221907,\n 0.006113152,\n 0.09078522,\n 0.027637133,\n 0.018309548,\n -0.01633641,\n -0.02608749,\n 0.052398287,\n 0.011247799,\n -0.060354326,\n 0.021876536,\n 0.12617895,\n 0.01963028,\n 0.080168225,\n -0.043625426,\n 0.008349975,\n 0.025866184,\n 0.018640447,\n 0.060024187,\n -0.015962755,\n -0.0036795249,\n 0.009187861,\n -0.05795868,\n -0.01515489,\n -0.03210024,\n -0.04497872,\n 0.04977143,\n -0.037073787,\n -0.010589404,\n -0.002064704,\n 0.0034019554,\n -0.048233703,\n 0.103998035,\n 0.020032499,\n 0.005160983,\n 0.042482056,\n 0.020384656\n ]\n },\n {\n \"values\": [\n 0.055573214,\n 0.005882677,\n 0.01826917,\n -0.027935615,\n -0.035022806,\n -0.0056345863,\n -0.059873283,\n 0.08781313,\n 0.031654596,\n -0.21276161,\n -0.03063806,\n -0.015950669,\n 0.022213425,\n -0.019672554,\n 0.014765447,\n 0.018805644,\n 0.088912874,\n -0.052033007,\n -0.04261618,\n 0.040153656,\n 0.0002709653,\n 0.027197575,\n -0.028945133,\n -0.023637824,\n -0.07464421,\n 0.0021192082,\n -0.0066155978,\n 0.0103703495,\n 0.046237614,\n 0.37369522,\n -0.026183352,\n -0.0074142427,\n -0.064248495,\n -0.04772917,\n 0.03777998,\n -0.08207684,\n -0.07380202,\n 0.06946735,\n 0.006707171,\n -0.008991639,\n 0.12729676,\n -0.0020389983,\n -0.049856912,\n 0.025080126,\n 0.04332476,\n -0.009537268,\n -0.02804633,\n -0.033539128,\n 0.06978733,\n -0.061974753,\n -0.044053447,\n -0.019087778,\n -0.05079465,\n 0.06880674,\n 0.021709887,\n 0.0013433662,\n 0.03357279,\n -0.020821936,\n 0.06484281,\n 0.047331396,\n -0.06765697,\n 0.006802375,\n -0.021252241,\n 0.05977433,\n 0.00339868,\n -0.013671367,\n 0.0049018324,\n -0.064193174,\n 0.12076415,\n 0.123991035,\n -0.08617238,\n -0.043577645,\n -0.057860445,\n 0.0712765,\n -0.023838129,\n -0.0927374,\n -0.053347606,\n 0.015069004,\n 0.0048751193,\n 0.035117477,\n -0.039658908,\n -0.0112140775,\n -0.05246642,\n -0.013988502,\n -0.096250586,\n -0.0014971048,\n -0.0013022952,\n 0.015804112,\n -0.057270862,\n 0.016260924,\n -0.100514844,\n -0.04636865,\n 0.010188983,\n -0.043096192,\n -0.048539747,\n 0.029445156,\n 0.049847852,\n 0.025705785,\n -0.01587146,\n 0.0136724375,\n 0.019404871,\n 0.011149615,\n -0.12750958,\n -0.08901808,\n -0.006742344,\n 0.023663288,\n -0.023679776,\n -0.024047747,\n -0.05614705,\n 0.024845188,\n 0.0130731305,\n -0.45807788,\n -0.033288486,\n 0.002387504,\n 0.05757872,\n -0.10141078,\n 0.018331088,\n 0.066774756,\n 0.030569423,\n 0.02577125,\n 0.038817436,\n -0.0115171885,\n -0.03519031,\n 0.008516701,\n -0.025135018,\n 0.06304102,\n 0.092472196,\n -0.077763535,\n 0.053744473,\n 0.014108602,\n -0.02527797,\n 0.10871733,\n 0.0029466082,\n -0.0019035314,\n -0.046041057,\n -0.0016688341,\n 0.06353252,\n -0.016068991,\n 0.035331856,\n 0.017738545,\n 0.019702058,\n 0.0352097,\n 0.04297009,\n -0.060130455,\n 0.0014609741,\n 0.08829011,\n 0.065697975,\n -0.050308824,\n 0.008562518,\n -0.02146485,\n 0.009379907,\n 0.080687515,\n 0.08388223,\n 0.01195018,\n -0.027259015,\n -0.08552416,\n -0.022187022,\n 0.054287627,\n -0.016185338,\n -0.06198485,\n -0.11792418,\n -0.07332939,\n -0.051198054,\n 0.03868018,\n -0.03734517,\n 0.00849145,\n -0.036531594,\n 0.025943676,\n -0.12947097,\n 0.009934093,\n -0.012165758,\n -0.018885039,\n -0.0057292483,\n 0.01055107,\n 0.04069054,\n 0.016645007,\n -0.009185493,\n -0.0055974717,\n 0.0031500375,\n -0.025355576,\n -0.02472688,\n -0.026464252,\n -0.03355686,\n 0.015095607,\n 0.061247155,\n 0.03455652,\n 0.047235593,\n -0.067785725,\n 0.027664077,\n 0.0226711,\n 0.07874564,\n 0.019857094,\n -0.028619839,\n 0.011504168,\n 0.041439142,\n 0.011528595,\n 0.012672718,\n 0.011122911,\n 0.042298287,\n 0.024844902,\n -0.0306643,\n 0.056554127,\n 0.034346133,\n -0.052996196,\n -0.029159157,\n -0.14677109,\n -0.03259311,\n 0.029201353,\n -0.00033933605,\n 0.0044265073,\n 0.06981597,\n 0.040167153,\n -0.023513084,\n 0.013591094,\n 0.0060894717,\n 0.047549773,\n 0.032060564,\n 0.1500461,\n -0.0125145,\n -0.007945927,\n -0.030586757,\n 0.079504035,\n 0.041778732,\n 0.015542834,\n 0.0014314849,\n 0.0018921786,\n 0.030846952,\n 0.03526715,\n -0.028502392,\n 0.033490326,\n 0.079798624,\n 0.0016604621,\n 0.093993016,\n -0.004698624,\n 0.022417571,\n 0.004761023,\n 0.014730654,\n 0.05114591,\n 0.034675676,\n 0.02710423,\n 0.074968666,\n -0.035762616,\n -0.015032275,\n -0.10261388,\n -0.10068578,\n 0.073554195,\n -0.0034417463,\n 0.047156025,\n 0.019664466,\n -0.02528637,\n -0.034683526,\n 0.06354508,\n 0.023256633,\n 0.051614694,\n 0.061911386,\n -0.0050556194\n ]\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": 11,\n \"promptTokenDetails\": [\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 11\n }\n ]\n }\n}\n" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/google-embedding/maps-inputtype-to-a-task-type-for-gemini-embedding-001.json b/packages/ai/test/fixtures/recordings/google-embedding/maps-inputtype-to-a-task-type-for-gemini-embedding-001.json new file mode 100644 index 0000000000..bf73134dac --- /dev/null +++ b/packages/ai/test/fixtures/recordings/google-embedding/maps-inputtype-to-a-task-type-for-gemini-embedding-001.json @@ -0,0 +1,50 @@ +{ + "version": 1, + "metadata": { + "tags": [ + "prefix:google-embedding", + "provider:google", + "protocol:google-embed-content" + ], + "name": "google-embedding/maps-inputtype-to-a-task-type-for-gemini-embedding-001", + "recordedAt": "2026-11-09T06:56:10.031Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:batchEmbedContents", + "headers": { + "content-type": "application/json" + }, + "body": "{\"requests\":[{\"model\":\"models/gemini-embedding-001\",\"content\":{\"parts\":[{\"text\":\"The invoice was charged twice.\"}]},\"taskType\":\"RETRIEVAL_QUERY\",\"outputDimensionality\":64}]}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"embeddings\": [\n {\n \"values\": [\n 0.04013612,\n -0.01537641,\n -0.00894363,\n -0.045427274,\n 0.015747963,\n -0.009066882,\n 0.034106165,\n 0.008299592,\n -0.029671155,\n 0.0073614777,\n 0.011705497,\n -0.008064136,\n -0.012201166,\n -0.023549316,\n 0.12342585,\n 0.011068751,\n -0.003649386,\n -0.0046033487,\n -0.011378856,\n 0.008659822,\n -0.024897752,\n 0.001241405,\n -0.0016047506,\n 0.032963928,\n 0.014408621,\n -0.011485396,\n 0.011547241,\n -0.0087663345,\n 0.029018002,\n 0.01399287,\n -0.0005734975,\n 0.009806568,\n -0.033623748,\n 0.013897123,\n 0.027592098,\n -0.001526048,\n 0.024996622,\n -0.0028200862,\n -0.0016486795,\n -0.019535935,\n -0.0060296683,\n 0.020810796,\n -0.014712436,\n 0.0027340506,\n -0.021106219,\n -0.022350833,\n 0.0039701443,\n 0.010802266,\n -0.0124504585,\n -0.0040887143,\n -0.0062737963,\n -0.018470604,\n 0.021161897,\n -0.16764373,\n 0.018159335,\n -0.015530227,\n -0.025055906,\n -0.026749635,\n 0.002768487,\n -0.03824891,\n -0.010511027,\n 0.014685062,\n -0.015881633,\n -0.042950973\n ]\n }\n ]\n}\n" + } + }, + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:batchEmbedContents", + "headers": { + "content-type": "application/json" + }, + "body": "{\"requests\":[{\"model\":\"models/gemini-embedding-001\",\"content\":{\"parts\":[{\"text\":\"The invoice was charged twice.\"}]},\"taskType\":\"RETRIEVAL_DOCUMENT\",\"outputDimensionality\":64}]}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"embeddings\": [\n {\n \"values\": [\n 0.0067660585,\n -0.008564701,\n 0.006918798,\n -0.0653632,\n 0.010584768,\n 0.0019771366,\n 0.024187071,\n 0.00468459,\n -0.022482483,\n -0.0011979828,\n 0.01025464,\n -0.012994005,\n 0.010501545,\n -0.008400968,\n 0.1354296,\n -0.003842612,\n -0.009868842,\n 0.0045481804,\n -0.012495539,\n 0.010945229,\n -0.012774331,\n 0.0018108432,\n 0.004564442,\n 0.024119604,\n 0.0096224435,\n 0.0008170349,\n 0.013087967,\n 0.0028655464,\n 0.038301487,\n 0.013128475,\n 0.008370898,\n 0.01710832,\n -0.02379502,\n 0.006764786,\n 0.028454835,\n 0.01613345,\n 0.013660678,\n 0.0013027737,\n 0.003783348,\n -0.0053537926,\n -0.0019457041,\n 0.022436744,\n -0.021374583,\n 0.0048431614,\n 0.0014370559,\n -0.0071425945,\n -0.0075106425,\n 0.0035781835,\n -0.002726382,\n -0.0017613088,\n 0.00242477,\n -0.012590718,\n 0.0015917314,\n -0.23083314,\n 0.006775061,\n -0.013197291,\n -0.020559328,\n -0.01887775,\n 0.011951808,\n -0.03615789,\n -0.017971825,\n 0.011554768,\n -0.017077072,\n -0.033402666\n ]\n }\n ]\n}\n" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-gemini-embedding-001-one-text-per-predict-request.json b/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-gemini-embedding-001-one-text-per-predict-request.json new file mode 100644 index 0000000000..8b45594f12 --- /dev/null +++ b/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-gemini-embedding-001-one-text-per-predict-request.json @@ -0,0 +1,50 @@ +{ + "version": 1, + "metadata": { + "tags": [ + "prefix:google-vertex-embedding", + "provider:google-vertex", + "protocol:google-vertex-predict-embeddings" + ], + "name": "google-vertex-embedding/embeds-gemini-embedding-001-one-text-per-predict-request", + "recordedAt": "2026-11-09T06:59:31.632Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://aiplatform.googleapis.com/v1/publishers/google/models/gemini-embedding-001:predict", + "headers": { + "content-type": "application/json" + }, + "body": "{\"instances\":[{\"content\":\"The invoice was charged twice.\",\"task_type\":\"RETRIEVAL_DOCUMENT\"}],\"parameters\":{\"outputDimensionality\":256}}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"predictions\": [\n {\n \"embeddings\": {\n \"values\": [\n 0.0067660585045814514,\n -0.0085647013038396835,\n 0.0069187982007861137,\n -0.065363198518753052,\n 0.010584767907857895,\n 0.00197713659144938,\n 0.024187071248888969,\n 0.0046845898032188416,\n -0.022482482716441154,\n -0.0011979828123003244,\n 0.010254640132188797,\n -0.012994005344808102,\n 0.010501544922590256,\n -0.00840096827596426,\n 0.13542960584163666,\n -0.0038426120299845934,\n -0.0098688416182994843,\n 0.0045481803826987743,\n -0.012495539151132107,\n 0.010945228859782219,\n -0.01277433056384325,\n 0.0018108432414010167,\n 0.0045644422061741352,\n 0.024119604378938675,\n 0.0096224434673786163,\n 0.00081703491741791368,\n 0.013087967410683632,\n 0.0028655463829636574,\n 0.038301486521959305,\n 0.013128475286066532,\n 0.0083708977326750755,\n 0.017108319327235222,\n -0.023795019835233688,\n 0.0067647858522832394,\n 0.028454834595322609,\n 0.016133449971675873,\n 0.013660677708685398,\n 0.0013027737149968743,\n 0.0037833480164408684,\n -0.0053537925705313683,\n -0.001945704105310142,\n 0.022436743602156639,\n -0.02137458324432373,\n 0.004843161441385746,\n 0.001437055878341198,\n -0.0071425945498049259,\n -0.0075106425210833549,\n 0.00357818347401917,\n -0.0027263821102678776,\n -0.0017613087547942996,\n 0.0024247700348496437,\n -0.012590718455612659,\n 0.0015917314449325204,\n -0.23083314299583435,\n 0.0067750611342489719,\n -0.01319729071110487,\n -0.020559327676892281,\n -0.018877750262618065,\n 0.011951807886362076,\n -0.036157891154289246,\n -0.01797182485461235,\n 0.011554768308997154,\n -0.017077071592211723,\n -0.033402666449546814,\n 0.0045520104467868805,\n 0.0057813716121017933,\n 0.031204313039779663,\n 0.0050185457803308964,\n -0.029458943754434586,\n 0.01047586090862751,\n 0.019013198092579842,\n -0.00085729057900607586,\n -0.0035896955523639917,\n -0.0043161846697330475,\n 0.017398606985807419,\n -0.024509260430932045,\n 0.013744445517659187,\n 0.011067190207540989,\n 0.00025354739045724273,\n 0.023840703070163727,\n -0.01208164170384407,\n 0.003840302349999547,\n 0.0029796466697007418,\n 0.0068140486255288124,\n -0.010366370901465416,\n -0.0031967712566256523,\n -0.00697317672893405,\n -0.0020322313066571951,\n -0.0059412242844700813,\n 0.010612445883452892,\n -0.0092285443097352982,\n -0.015197069384157658,\n 0.0014370731078088284,\n -0.0017412337474524975,\n -0.0070323105901479721,\n 0.019875036552548409,\n 0.029290527105331421,\n 0.0289757177233696,\n -0.0038262808229774237,\n -0.014225708320736885,\n -0.00371581525541842,\n -0.016808141022920609,\n 0.004887663759291172,\n 0.00061835406813770533,\n 0.005032537505030632,\n -0.02474505640566349,\n 0.0034599290229380131,\n -0.012170085683465004,\n 0.0056557897478342056,\n 0.029591554775834084,\n 0.039655052125453949,\n 0.0067881694994866848,\n -0.0096319923177361488,\n 0.00475343968719244,\n 0.011865638196468353,\n -0.19928640127182007,\n 0.012274152599275112,\n 0.00062509195413440466,\n -0.00571814738214016,\n -0.0024908464401960373,\n -0.022102171555161476,\n 0.0074850837700068951,\n -0.00820449274033308,\n -0.0084552057087421417,\n -0.011187656782567501,\n -0.022399133071303368,\n 0.0058224014937877655,\n 0.009354323148727417,\n 0.011815812438726425,\n 0.024097854271531105,\n 0.012300743721425533,\n -0.0256738793104887,\n -0.011287794448435307,\n -0.0024454677477478981,\n -0.011749359779059887,\n 0.00553865497931838,\n -0.014438388869166374,\n -0.0010055131278932095,\n 0.0070596258156001568,\n -0.0030477442778646946,\n 0.0021093375980854034,\n 0.022868849337100983,\n -0.0056079705245792866,\n -0.0067839380353689194,\n 0.0069176671095192432,\n 0.000866447517182678,\n 0.023985898122191429,\n 0.019078481942415237,\n -0.023755257949233055,\n -0.0059529505670070648,\n -0.016447391360998154,\n -0.013105044141411781,\n 0.021976910531520844,\n 0.014983474276959896,\n 0.016634903848171234,\n -0.046319186687469482,\n -0.0065894210711121559,\n 0.0093624712899327278,\n 0.0031360220164060593,\n -0.0020975479856133461,\n 0.0014287699013948441,\n -0.00151301478035748,\n -0.012178033590316772,\n 0.016093716025352478,\n 0.0079509653151035309,\n 0.0068156043998897076,\n -0.0036917317193001509,\n -0.0032526454888284206,\n -0.010500140488147736,\n -0.0004793420375790447,\n 0.017142651602625847,\n -0.0067786742001771927,\n -7.8917153587099165e-05,\n 0.0061723329126834869,\n -0.0171542689204216,\n -0.0099367247894406319,\n -0.014308856800198555,\n 0.011710342019796371,\n 0.024345936253666878,\n -0.0057628350332379341,\n -0.013812691904604435,\n -0.0041048177517950535,\n 0.019136350601911545,\n -0.017500845715403557,\n -0.0010348347714170814,\n -0.012096963822841644,\n -0.0034979472402483225,\n -0.011065957136452198,\n -0.013109938241541386,\n -0.013565410859882832,\n 0.0010659786639735103,\n -0.00054438959341496229,\n -0.0085298968479037285,\n -0.0098329167813062668,\n 0.0052420594729483128,\n -0.016172362491488457,\n 0.016174633055925369,\n 0.018317727372050285,\n 0.011240617372095585,\n 0.0068462379276752472,\n -0.0028174305334687233,\n -0.016127871349453926,\n -0.010659696534276009,\n 0.0058405338786542416,\n -0.017512813210487366,\n 0.011040158569812775,\n -0.034939385950565338,\n 0.010531795211136341,\n -0.0017718352610245347,\n 0.034210711717605591,\n -0.0030972147360444069,\n 0.02190331369638443,\n 0.011023883707821369,\n -0.0038704578764736652,\n 0.0071401228196918964,\n -0.018221959471702576,\n -0.012704534456133842,\n -0.012427784502506256,\n 0.012414312921464443,\n -0.0075588314794003963,\n 0.018483005464076996,\n 0.0090407971292734146,\n 0.017520347610116005,\n 0.011372721754014492,\n 0.014358802698552608,\n 0.014496205374598503,\n 0.016226889565587044,\n 0.0055721034295856953,\n 0.0082014091312885284,\n 0.0093504572287201881,\n 0.0017033391632139683,\n 0.015988010913133621,\n -0.018357038497924805,\n -0.020195357501506805,\n 0.0023756271693855524,\n 0.0022688012104481459,\n 0.016902128234505653,\n -0.00051239511230960488,\n -0.016316685825586319,\n 0.026997905224561691,\n -0.013396486639976501,\n 0.018556755036115646,\n 0.012741131708025932,\n -0.011232925578951836,\n -0.0080870315432548523,\n -0.0057254252023994923,\n 0.00036137655843049288,\n 0.010254818014800549,\n 0.010583529248833656,\n 0.0074212402105331421,\n 0.0045569813810288906,\n 0.016776753589510918,\n 0.0097003653645515442,\n 0.00484503386542201,\n 0.0089116860181093216,\n 0.0063658878207206726\n ],\n \"statistics\": {\n \"truncated\": false,\n \"token_count\": 6\n }\n }\n }\n ],\n \"metadata\": {\n \"billableCharacterCount\": 26\n }\n}\n" + } + }, + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://aiplatform.googleapis.com/v1/publishers/google/models/gemini-embedding-001:predict", + "headers": { + "content-type": "application/json" + }, + "body": "{\"instances\":[{\"content\":\"Refund the duplicate payment.\",\"task_type\":\"RETRIEVAL_DOCUMENT\"}],\"parameters\":{\"outputDimensionality\":256}}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"predictions\": [\n {\n \"embeddings\": {\n \"statistics\": {\n \"truncated\": false,\n \"token_count\": 5\n },\n \"values\": [\n -0.015905311331152916,\n -0.0056857587769627571,\n -0.0014159578131511807,\n -0.067296974360942841,\n 0.0085425078868865967,\n 0.0045022079721093178,\n 0.021991433575749397,\n 0.0065784379839897156,\n -0.0094855464994907379,\n -0.020789481699466705,\n 0.022638626396656036,\n 0.0050572548061609268,\n 0.013418455608189106,\n -0.019938837736845016,\n 0.12935233116149902,\n -0.013154824264347553,\n -0.021605784073472023,\n -0.0018863728037104011,\n -0.0076831011101603508,\n 0.027134472504258156,\n 0.0056780297309160233,\n 0.013628485612571239,\n -0.0014095158549025655,\n -0.0020986020099371672,\n 0.014016011729836464,\n -0.003760138526558876,\n 0.021607851609587669,\n -0.000887892150785774,\n 0.054522652179002762,\n 0.0028050725813955069,\n 0.0069945552386343479,\n 0.028112351894378662,\n -0.031565282493829727,\n 0.017475798726081848,\n 0.018708541989326477,\n 0.014090320095419884,\n -0.00460298964753747,\n 0.009071027860045433,\n -0.016234820708632469,\n 0.0033288595732301474,\n -0.0054771672002971172,\n 0.0063132480718195438,\n -0.014089591801166534,\n 0.00968361459672451,\n 0.015383710153400898,\n -0.0098425894975662231,\n -0.012892510741949081,\n 0.015032731927931309,\n -0.00393438758328557,\n 0.010172100737690926,\n 0.0095537435263395309,\n -0.017628304660320282,\n -0.0099089313298463821,\n -0.2334417998790741,\n 0.0075070555321872234,\n -0.0014154553646221757,\n -0.012201015837490559,\n -0.025741841644048691,\n -0.015567008405923843,\n -0.038253471255302429,\n -0.014190055429935455,\n 0.0079748649150133133,\n -0.029500873759388924,\n -0.0070689786225557327,\n 0.019225917756557465,\n 0.025636516511440277,\n 0.015224512666463852,\n 0.0016231501940637827,\n -0.02805720642209053,\n 0.0094428611919283867,\n 0.033857911825180054,\n -0.00709107331931591,\n -0.0010066621471196413,\n -0.0020923125557601452,\n 0.0038011148571968079,\n -0.017363451421260834,\n 0.014269712381064892,\n 0.015253742225468159,\n 0.0046899449080228806,\n 0.020639928057789803,\n 0.0027638138271868229,\n 0.0065052988938987255,\n -0.012222182936966419,\n 0.011815601959824562,\n 0.003372010076418519,\n 0.014723263680934906,\n -0.014894044026732445,\n 0.014738556928932667,\n -0.0035750898532569408,\n 0.014145515859127045,\n -0.012784446589648724,\n -0.01562844030559063,\n 0.0028845618944615126,\n 0.015956263989210129,\n -0.00068820756860077381,\n 0.027811318635940552,\n 0.0080250753089785576,\n 0.029092390090227127,\n 0.0053472039289772511,\n -0.01524832658469677,\n -0.0082057751715183258,\n -0.020605525001883507,\n -0.001913537853397429,\n -0.0065258098766207695,\n -0.0020626033656299114,\n -0.027848334982991219,\n 0.00471580820158124,\n -0.029862707480788231,\n 0.013365537859499454,\n 0.020384369418025017,\n 0.031455293297767639,\n -0.0076728812418878078,\n -0.012699383310973644,\n -0.0054380912333726883,\n 0.0078898174688220024,\n -0.199729785323143,\n 0.00925278477370739,\n 0.00932475458830595,\n -0.018936391919851303,\n -0.0031726884189993143,\n -0.01422481145709753,\n 0.0063391854055225849,\n -0.0061564766801893711,\n -0.005842824000865221,\n 0.0025422645267099142,\n -0.021028833463788033,\n 0.015636513009667397,\n 0.0034926661755889654,\n 0.0066494802013039589,\n 0.018434807658195496,\n 0.01092606782913208,\n -0.038852676749229431,\n -0.0075784595683217049,\n 0.00633108289912343,\n -0.011530201882123947,\n 0.01853465661406517,\n -0.016267910599708557,\n -0.011544159613549709,\n -0.012343384325504303,\n -0.005778199527412653,\n -0.0066109383478760719,\n 0.0054909060709178448,\n 0.00060546351596713066,\n -0.010138139128684998,\n 0.0056817904114723206,\n 0.0048238844610750675,\n 0.016669074073433876,\n 0.0039969254285097122,\n -0.0130785396322608,\n -0.020323848351836205,\n -0.00864898506551981,\n -0.004756496287882328,\n 0.020297903567552567,\n 0.0042840819805860519,\n 0.0113634392619133,\n -0.050979748368263245,\n -0.017383363097906113,\n -0.0059591364115476608,\n 0.0013819884043186903,\n 0.00095673120813444257,\n -0.0049520311877131462,\n 0.0040857419371604919,\n 0.0035866068210452795,\n 0.015622366219758987,\n 0.012371500954031944,\n -0.00082286156248301268,\n -0.012604278512299061,\n -0.015122790820896626,\n 0.0012029259232804179,\n -0.010619593784213066,\n -0.0070626223459839821,\n -0.011009919457137585,\n -0.012052502483129501,\n 0.0069020022638142109,\n -0.00952170416712761,\n -0.0011780181666836143,\n -0.0016638821689411998,\n 0.018668744713068008,\n 0.042046044021844864,\n 0.0055653462186455727,\n -0.0049124807119369507,\n -0.0011956486850976944,\n 0.0184326209127903,\n -0.013337674550712109,\n -0.0081566134467720985,\n -0.0074433758854866028,\n 0.01746869832277298,\n 3.2026771805249155e-05,\n -0.0070867659524083138,\n -0.017893336713314056,\n 0.00974167138338089,\n 0.0046065794304013252,\n -0.0029813593719154596,\n -0.019144205376505852,\n 0.011301816441118717,\n -0.015721673145890236,\n 0.022007806226611137,\n 0.0066210082732141018,\n 0.012291237711906433,\n 0.0055887843482196331,\n -8.3568018453661352e-05,\n 0.0087585737928748131,\n -0.014350417070090771,\n 0.0078971777111291885,\n -0.0031209103763103485,\n 0.01318366639316082,\n -0.0094801979139447212,\n -0.012990517541766167,\n 0.00061398721300065517,\n 0.011689984239637852,\n -0.008281082846224308,\n -0.0020994374062865973,\n -0.00084611156489700079,\n -0.0085931625217199326,\n -0.0063145016320049763,\n -0.021207630634307861,\n -0.0071528875268995762,\n 0.0069712246768176556,\n 0.013173436746001244,\n -0.013405535370111465,\n 0.016438724473118782,\n 0.021915558725595474,\n 0.041398316621780396,\n 0.017608946189284325,\n 0.019274923950433731,\n -0.000942415848840028,\n 0.017784159630537033,\n -0.012849887832999229,\n -0.0009983930503949523,\n -0.0030502281151711941,\n 0.008967171423137188,\n 0.018606634810566902,\n -0.028792452067136765,\n 0.0034894363489001989,\n 0.00712304562330246,\n 0.017767619341611862,\n 0.00092676974600180984,\n -0.0042112790979444981,\n -0.0065563172101974487,\n 0.020865850150585175,\n -0.0045312177389860153,\n 0.0011327519314363599,\n 0.011248116381466389,\n -0.0023097714874893427,\n 0.0061918916180729866,\n -0.0010475626913830638,\n 0.0050952681340277195,\n 0.0061448989436030388,\n 0.015117951668798923,\n 0.0085631981492042542,\n -0.00077939307084307075,\n 0.021069753915071487,\n 0.02839408814907074,\n 0.0030101132579147816,\n 0.0084867104887962341,\n 0.0092281065881252289\n ]\n }\n }\n ],\n \"metadata\": {\n \"billableCharacterCount\": 26\n }\n}\n" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-text-through-predict.json b/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-text-through-predict.json new file mode 100644 index 0000000000..2488457762 --- /dev/null +++ b/packages/ai/test/fixtures/recordings/google-vertex-embedding/embeds-text-through-predict.json @@ -0,0 +1,32 @@ +{ + "version": 1, + "metadata": { + "tags": [ + "prefix:google-vertex-embedding", + "provider:google-vertex", + "protocol:google-vertex-predict-embeddings" + ], + "name": "google-vertex-embedding/embeds-text-through-predict", + "recordedAt": "2026-11-09T06:59:31.429Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://aiplatform.googleapis.com/v1/publishers/google/models/text-embedding-005:predict", + "headers": { + "content-type": "application/json" + }, + "body": "{\"instances\":[{\"content\":\"The invoice was charged twice.\",\"task_type\":\"RETRIEVAL_DOCUMENT\"},{\"content\":\"Refund the duplicate payment.\",\"task_type\":\"RETRIEVAL_DOCUMENT\"}],\"parameters\":{\"outputDimensionality\":256}}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=UTF-8" + }, + "body": "{\n \"predictions\": [\n {\n \"embeddings\": {\n \"statistics\": {\n \"truncated\": false,\n \"token_count\": 6\n },\n \"values\": [\n 0.010089091025292873,\n -0.021172000095248222,\n -0.03215993195772171,\n -0.028103061020374298,\n 0.020822117105126381,\n 0.060487713664770126,\n 0.044251147657632828,\n 0.072687186300754547,\n 0.006489126943051815,\n 0.012657723389565945,\n -0.041781105101108551,\n -0.03050604835152626,\n -0.015166119672358036,\n -0.07944197952747345,\n -0.00081911479355767369,\n 0.027369877323508263,\n 0.026000970974564552,\n -0.056994039565324783,\n 0.015087085776031017,\n -0.0012828441103920341,\n 0.0049489405937492847,\n -0.080751143395900726,\n -0.015585768036544323,\n -0.019934650510549545,\n 0.0018892384832724929,\n -0.014798305928707123,\n -0.035757627338171005,\n 0.0037471805699169636,\n -0.032804571092128754,\n 0.0087509229779243469,\n 0.015425511635839939,\n -0.045502949506044388,\n 0.015241718851029873,\n -0.022187745198607445,\n -0.043013136833906174,\n 0.013413292355835438,\n 0.033085577189922333,\n 0.0058327852748334408,\n 0.0017741929041221738,\n -0.0037749786861240864,\n 0.0626307874917984,\n -0.0051058256067335606,\n -0.0035001081414520741,\n -0.015594284981489182,\n -0.032153964042663574,\n 0.055247526615858078,\n -0.026334216818213463,\n -0.018296137452125549,\n -0.030987706035375595,\n -0.0533766970038414,\n -0.009856298565864563,\n 0.071704775094985962,\n 0.007357289083302021,\n -0.032556038349866867,\n 0.0544215552508831,\n 0.061744842678308487,\n 0.0031820752192288637,\n 0.021865151822566986,\n 0.0028361387085169554,\n -0.010873475112020969,\n -0.0043554254807531834,\n -0.019791414961218834,\n -0.022391438484191895,\n -0.0089368894696235657,\n -0.021630320698022842,\n 0.04578157514333725,\n 0.035819511860609055,\n 0.074948601424694061,\n 0.021978322416543961,\n -0.042299393564462662,\n -0.0060110618360340595,\n -0.063296332955360413,\n 0.0076078916899859905,\n -0.043914597481489182,\n 0.0086917057633399963,\n -0.018620552495121956,\n -0.00056277617113664746,\n 0.023446079343557358,\n -0.063267655670642853,\n -0.031797882169485092,\n -0.041561957448720932,\n 0.022985417395830154,\n -0.04175553098320961,\n 0.022119300439953804,\n -0.010639178566634655,\n -0.027414193376898766,\n -0.014274679124355316,\n -0.06055590882897377,\n -0.020993318408727646,\n -0.034934092313051224,\n -0.070998318493366241,\n -0.017668940126895905,\n -0.045002676546573639,\n 0.046049155294895172,\n 0.0053670415654778481,\n 0.031798776239156723,\n 0.001069289050064981,\n 0.023623792454600334,\n -0.047902360558509827,\n -0.046876557171344757,\n 0.00066854240139946342,\n 0.039643198251724243,\n -0.03065485879778862,\n -0.043762646615505219,\n -0.047729652374982834,\n -0.033246457576751709,\n -0.070082873106002808,\n 0.021932143718004227,\n 0.064103171229362488,\n -0.013234709389507771,\n -0.034569956362247467,\n -0.00753868417814374,\n 0.00032098489464260638,\n -0.0044606942683458328,\n -0.064021587371826172,\n 0.015381334349513054,\n -0.0092226462438702583,\n -0.02815825492143631,\n -0.10107077658176422,\n -0.026940921321511269,\n -0.044667642563581467,\n 0.021352047100663185,\n 0.16679723560810089,\n 0.027555657550692558,\n -0.0028255409561097622,\n 0.023350121453404427,\n 0.040368709713220596,\n -0.018881680443882942,\n -0.00936870276927948,\n -0.0054004774428904057,\n -0.034475281834602356,\n -0.07392033189535141,\n 0.002728327875956893,\n 0.082851044833660126,\n -0.030159503221511841,\n 0.0097292624413967133,\n -0.043598826974630356,\n -0.038216322660446167,\n -0.043027903884649277,\n 0.01086803525686264,\n -0.0077005503699183464,\n -0.01267440989613533,\n -0.023193800821900368,\n 0.022233219817280769,\n -0.0674622431397438,\n -0.034523598849773407,\n 0.0085685430094599724,\n 0.057415012270212173,\n -0.011132320389151573,\n -0.011617244221270084,\n -0.011062991805374622,\n 0.028432361781597137,\n -0.056147821247577667,\n 0.012360644526779652,\n 0.07147216796875,\n -0.010854613967239857,\n -0.024184359237551689,\n -0.0060069598257541656,\n 0.01635165698826313,\n -0.022917132824659348,\n -0.02951180562376976,\n -0.033272679895162582,\n -0.030624942854046822,\n 0.015901271253824234,\n -0.058558985590934753,\n 0.039093997329473495,\n 0.034510165452957153,\n 0.0269000306725502,\n 0.0077861789613962173,\n -0.045509543269872665,\n -0.00018029735656455159,\n -0.027065020054578781,\n -0.040661294013261795,\n 0.019282491877675056,\n -0.010852081701159477,\n 0.0038428083062171936,\n -0.062635444104671478,\n -0.062968887388706207,\n 0.014295505359768867,\n -0.065042257308959961,\n -0.068114921450614929,\n -0.018507601693272591,\n 0.033719245344400406,\n 0.032109882682561874,\n -0.17987364530563354,\n -0.0062305992469191551,\n -0.0363224595785141,\n 0.0051918178796768188,\n -0.060132022947072983,\n -0.0024526072666049004,\n -0.032326482236385345,\n -0.0019413036061450839,\n -0.016355698928236961,\n 0.023477610200643539,\n 0.022238090634346008,\n 0.045779317617416382,\n 0.057724926620721817,\n -0.072423264384269714,\n 0.017856564372777939,\n 0.044147618114948273,\n -0.046756140887737274,\n 0.00914136040955782,\n 0.023515034466981888,\n 0.030471131205558777,\n -0.0403815433382988,\n -0.00084660481661558151,\n 0.0158234890550375,\n 0.0008254116983152926,\n 0.01898491382598877,\n 0.0068344492465257645,\n 0.013516022823750973,\n 0.022542726248502731,\n -0.098071232438087463,\n -0.045251660048961639,\n -0.06123020127415657,\n -0.04105396568775177,\n 0.0065012620761990547,\n -0.0486881397664547,\n 0.039271533489227295,\n -0.013128015212714672,\n 0.069765195250511169,\n 0.033548921346664429,\n -0.13399717211723328,\n 0.01402578316628933,\n -0.0047884956002235413,\n -0.014274562709033489,\n 0.018150914460420609,\n -0.05020739883184433,\n 0.013115089386701584,\n 0.017697995528578758,\n -0.024946028366684914,\n 0.056322082877159119,\n -0.016759889200329781,\n 0.00675848638638854,\n -0.0066966880112886429,\n -0.0014787078835070133,\n -0.0091128349304199219,\n 0.0037094529252499342,\n -0.10045605897903442,\n 0.024172300472855568,\n 0.016660645604133606,\n 0.038575254380702972,\n -0.030676728114485741,\n -0.040559355169534683,\n -0.041816640645265579,\n 0.010390101931989193,\n -0.024003826081752777,\n 0.026955360546708107,\n -0.048503398895263672,\n -0.045432474464178085,\n -0.027649920433759689,\n 0.025558039546012878,\n -0.024483393877744675,\n 0.076974838972091675,\n 0.032787200063467026,\n -0.098210573196411133\n ]\n }\n },\n {\n \"embeddings\": {\n \"values\": [\n -0.026719260960817337,\n -0.016964785754680634,\n -0.012886191718280315,\n -0.035490527749061584,\n 0.0493902787566185,\n 0.0907195582985878,\n 0.011536585167050362,\n 0.05349133163690567,\n -0.0030017727985978127,\n -0.00801507756114006,\n -0.053646311163902283,\n -0.02986159548163414,\n -0.037292763590812683,\n -0.052176211029291153,\n 0.018141571432352066,\n 0.018718067556619644,\n -0.020449981093406677,\n -0.047641772776842117,\n 0.01187115628272295,\n -0.000522763526532799,\n 0.025434160605072975,\n -0.051115073263645172,\n 0.0178085770457983,\n -0.032450255006551743,\n 0.00035488171852193773,\n -0.028786094859242439,\n -0.033380623906850815,\n -0.014813639223575592,\n -0.043488774448633194,\n 0.0055399802513420582,\n 0.042336553335189819,\n -0.034189704805612564,\n -0.014066697098314762,\n -0.0072617931291460991,\n -0.056853000074625015,\n 0.0040946155786514282,\n 0.019371990114450455,\n -0.0024213411379605532,\n 0.025406355038285255,\n -0.025995111092925072,\n 0.0357375368475914,\n 0.01154481153935194,\n 0.010546684265136719,\n -0.027408720925450325,\n 0.00019354916003067046,\n 0.065718702971935272,\n -0.054879102855920792,\n -0.022258926182985306,\n -0.027522578835487366,\n -0.073073215782642365,\n -0.003109257435426116,\n 0.089089855551719666,\n 0.036394480615854263,\n -0.038705561310052872,\n 0.041149850934743881,\n 0.0429534837603569,\n 0.013225913979113102,\n -0.00366626912727952,\n -0.017269808799028397,\n -0.023182293400168419,\n 0.018884923309087753,\n -0.010113047435879707,\n -0.027139119803905487,\n -0.0034144727978855371,\n -0.041510917246341705,\n 0.047672640532255173,\n 0.042551539838314056,\n 0.046964894980192184,\n 0.0145271560177207,\n -0.072001352906227112,\n -0.0019756222609430552,\n -0.069281063973903656,\n 0.020264128223061562,\n -0.069919057190418243,\n 0.015158792026340961,\n -0.014617034234106541,\n -0.014769143424928188,\n 0.041259590536355972,\n -0.045265961438417435,\n -0.008505016565322876,\n -0.0299678985029459,\n 0.0342765748500824,\n -0.036579493433237076,\n 0.0538581907749176,\n -0.01060539111495018,\n -0.023373264819383621,\n -0.042085908353328705,\n -0.071415185928344727,\n -0.021104184910655022,\n -0.040613278746604919,\n -0.055130757391452789,\n -0.023512518033385277,\n -0.046667102724313736,\n 0.049006294459104538,\n 0.032405953854322433,\n 0.052311945706605911,\n 0.010541277937591076,\n 0.025950068607926369,\n -0.058000773191452026,\n -0.03512316569685936,\n -0.0065026539377868176,\n 0.030985882505774498,\n -0.031502928584814072,\n -0.048309493809938431,\n -0.035125698894262314,\n -0.013599181547760963,\n -0.08572135865688324,\n -0.013115177862346172,\n 0.11107030510902405,\n -0.010665208101272583,\n -0.030003365129232407,\n 0.0024615854490548372,\n 0.0147521598264575,\n 0.010722251608967781,\n -0.0687655583024025,\n -0.0029937480576336384,\n 0.0091697899624705315,\n -0.008864622563123703,\n -0.075202308595180511,\n -0.047160293906927109,\n -0.0025246669538319111,\n 0.01963505707681179,\n 0.14752255380153656,\n 0.01840117946267128,\n -0.015555731020867825,\n 0.00327743380330503,\n 0.030688485130667686,\n -0.06073007732629776,\n 0.0021213861182332039,\n -0.024166615679860115,\n -0.02651706151664257,\n -0.057780064642429352,\n 0.013259752653539181,\n 0.0914272740483284,\n -0.0580664798617363,\n 0.0495041199028492,\n -0.065650880336761475,\n -0.039173830300569534,\n -0.041340377181768417,\n -0.007333134301006794,\n -0.011819807812571526,\n -0.020367294549942017,\n -0.034994058310985565,\n -0.00085709791164845228,\n -0.055306769907474518,\n -0.052485834807157516,\n 0.02215772308409214,\n 0.050774004310369492,\n 0.0031618715729564428,\n 0.00058185216039419174,\n -0.044573653489351273,\n 0.0058100218884646893,\n -0.035753153264522552,\n -0.00017624667088966817,\n 0.039308499544858932,\n -0.025680975988507271,\n -0.013562181033194065,\n -0.019340069964528084,\n 0.0361672006547451,\n -0.030097978189587593,\n -0.00677384901791811,\n -0.0025942539796233177,\n -0.021742649376392365,\n -0.0063570970669388771,\n -0.050387658178806305,\n -0.0028856645803898573,\n 0.022599140182137489,\n 0.001837728195823729,\n 0.0019226009026169777,\n -0.054896581918001175,\n -0.009358956478536129,\n -0.041054673492908478,\n -0.065244197845458984,\n 0.017342856153845787,\n -0.047054063528776169,\n 0.020691234618425369,\n -0.090374015271663666,\n -0.034258738160133362,\n 0.002993294969201088,\n -0.089860200881958008,\n -0.10112492740154266,\n -0.015419585630297661,\n 0.026872316375374794,\n 0.035944778472185135,\n -0.169467031955719,\n 0.021409172564744949,\n -0.02235826663672924,\n 0.0041170213371515274,\n -0.072779461741447449,\n 0.0160713791847229,\n 0.002984306076541543,\n 0.0041085644625127316,\n -0.017974629998207092,\n -0.022078821435570717,\n 0.00966233666986227,\n 0.060972493141889572,\n 0.049414332956075668,\n -0.083362221717834473,\n 0.031805220991373062,\n 0.017768271267414093,\n -0.027809975668787956,\n 0.041466940194368362,\n 0.036885760724544525,\n 0.059725262224674225,\n -0.035200592130422592,\n -0.017431791871786118,\n 0.013621802441775799,\n -0.0052686990238726139,\n 0.032135765999555588,\n -0.012099550105631351,\n 0.051472045481204987,\n 0.025693919509649277,\n -0.094167672097682953,\n -0.031817492097616196,\n -0.0648769736289978,\n -0.0326068215072155,\n 0.018941827118396759,\n -0.0125488992780447,\n 0.03026355616748333,\n -0.019255572929978371,\n 0.0646309182047844,\n 0.034603029489517212,\n -0.1127113401889801,\n 0.022112105041742325,\n -0.018970629200339317,\n -0.0010678264079615474,\n -0.015053817071020603,\n -0.047266479581594467,\n 0.015845056623220444,\n 0.043663837015628815,\n -0.025260595604777336,\n 0.067890450358390808,\n -0.013192646205425262,\n 0.030554592609405518,\n -0.0070182085037231445,\n 0.0062643713317811489,\n -0.01656414195895195,\n 0.0060378913767635822,\n -0.10211841762065887,\n 0.016359293833374977,\n -0.0037240509409457445,\n 0.029204016551375389,\n -0.00047372488188557327,\n -0.053209356963634491,\n -0.033076848834753036,\n 0.0098949307575821877,\n -0.017976900562644005,\n 0.037532459944486618,\n -0.029235765337944031,\n -0.037699148058891296,\n -0.0028372935485094786,\n -0.0080636003986001015,\n -0.011886352673172951,\n 0.064054392278194427,\n 0.012836837209761143,\n -0.098286077380180359\n ],\n \"statistics\": {\n \"truncated\": false,\n \"token_count\": 6\n }\n }\n }\n ],\n \"metadata\": {\n \"billableCharacterCount\": 52\n }\n}\n" + } + } + ] +} diff --git a/packages/ai/test/fixtures/recordings/openai-embedding/embeds-text-with-requested-dimensions.json b/packages/ai/test/fixtures/recordings/openai-embedding/embeds-text-with-requested-dimensions.json new file mode 100644 index 0000000000..324c0e21f5 --- /dev/null +++ b/packages/ai/test/fixtures/recordings/openai-embedding/embeds-text-with-requested-dimensions.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "metadata": { + "model": "text-embedding-3-small", + "tags": [ + "prefix:openai-embedding", + "provider:openai", + "protocol:openai-embeddings" + ], + "name": "openai-embedding/embeds-text-with-requested-dimensions", + "recordedAt": "2026-11-09T05:56:40.129Z" + }, + "interactions": [ + { + "transport": "http", + "request": { + "method": "POST", + "url": "https://api.openai.com/v1/embeddings", + "headers": { + "content-type": "application/json" + }, + "body": "{\"encoding_format\":\"float\",\"model\":\"text-embedding-3-small\",\"input\":[\"The invoice was charged twice.\",\"Refund the duplicate payment.\"],\"dimensions\":256}" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": "{\"object\":\"list\",\"data\":[{\"object\":\"embedding\",\"embedding\":[0.0249176025390625,-0.03631591796875,0.0139923095703125,-0.07012939453125,-0.024261474609375,0.08331298828125,-0.04400634765625,-0.010009765625,-0.01317596435546875,-0.107666015625,0.10601806640625,-0.01247406005859375,-0.0090789794921875,-0.01506805419921875,0.053924560546875,0.07061767578125,-0.0176544189453125,0.044464111328125,-0.12457275390625,0.07684326171875,-0.059295654296875,0.061370849609375,0.10626220703125,0.0242156982421875,-0.0506591796875,-0.07550048828125,0.053192138671875,-0.10382080078125,0.0310821533203125,-0.0283966064453125,0.07568359375,-0.04217529296875,0.06207275390625,-0.02105712890625,-0.05169677734375,0.041046142578125,-0.0021038055419921875,0.10595703125,0.0164337158203125,0.021392822265625,-0.09893798828125,-0.0750732421875,-0.0306854248046875,0.07940673828125,0.01280975341796875,0.063720703125,-0.01959228515625,0.0187835693359375,0.040618896484375,0.013427734375,0.05120849609375,-0.03106689453125,0.0007801055908203125,0.0030612945556640625,0.03106689453125,-0.01396942138671875,0.039337158203125,0.09637451171875,0.01294708251953125,-0.06390380859375,0.08819580078125,-0.11480712890625,0.0216217041015625,0.035552978515625,-0.0216064453125,0.00988006591796875,-0.038238525390625,0.0706787109375,0.0233612060546875,-0.06964111328125,-0.08758544921875,0.128662109375,0.0411376953125,-0.04193115234375,0.0985107421875,-0.040802001953125,0.00920867919921875,0.02392578125,0.08062744140625,0.135986328125,0.031890869140625,-0.033782958984375,-0.0921630859375,-0.025726318359375,-0.0279693603515625,-0.045745849609375,-0.1444091796875,-0.057281494140625,-0.046966552734375,-0.051727294921875,-0.038665771484375,0.072265625,0.058319091796875,-0.052093505859375,0.050140380859375,0.040252685546875,-0.0947265625,0.0139923095703125,-0.0148468017578125,0.110107421875,0.1103515625,0.02008056640625,0.03375244140625,0.190673828125,-0.06103515625,0.01751708984375,0.047149658203125,0.01107025146484375,-0.11138916015625,-0.0789794921875,0.06536865234375,0.004970550537109375,-0.046234130859375,-0.0635986328125,0.07427978515625,-0.005462646484375,-0.057220458984375,0.08660888671875,-0.09027099609375,-0.08306884765625,-0.11761474609375,-0.042694091796875,0.00624847412109375,-0.13037109375,-0.02423095703125,-0.0848388671875,-0.04913330078125,-0.024139404296875,-0.028778076171875,0.00020706653594970703,-0.00971221923828125,0.03253173828125,0.0718994140625,-0.098388671875,-0.017578125,-0.017181396484375,0.01580810546875,-0.061798095703125,-0.0662841796875,-0.055084228515625,-0.043731689453125,-0.01480865478515625,0.0279388427734375,0.0313720703125,-0.01898193359375,0.0465087890625,-0.06475830078125,-0.007175445556640625,-0.01457977294921875,-0.0703125,-0.0426025390625,0.02398681640625,-0.01470184326171875,-0.09832763671875,-0.050201416015625,0.019439697265625,0.035308837890625,0.0755615234375,0.01419830322265625,0.0660400390625,-0.07574462890625,0.01267242431640625,0.055419921875,-0.0172119140625,-0.02069091796875,-0.0124053955078125,-0.0545654296875,-0.01407623291015625,-0.09649658203125,-0.10589599609375,-0.09552001953125,-0.0115509033203125,-0.0819091796875,-0.07958984375,-0.025604248046875,-0.061126708984375,-0.10137939453125,-0.09893798828125,0.045806884765625,-0.0311737060546875,0.04266357421875,0.0308380126953125,0.060882568359375,0.06854248046875,-0.013397216796875,-0.0684814453125,0.00043654441833496094,0.030242919921875,0.052215576171875,0.16943359375,0.1138916015625,-0.01236724853515625,0.0462646484375,0.060150146484375,-0.061187744140625,-0.10723876953125,0.0034122467041015625,0.008331298828125,-0.10577392578125,0.04205322265625,0.055938720703125,-0.0662841796875,0.066650390625,0.1002197265625,0.01153564453125,-0.041046142578125,-0.10589599609375,-0.04827880859375,0.09039306640625,-0.05010986328125,0.1339111328125,-0.050567626953125,-0.11566162109375,-0.025604248046875,-0.092529296875,-0.096435546875,-0.00513458251953125,-0.0177459716796875,0.0004112720489501953,-0.027618408203125,0.028076171875,-0.058319091796875,-0.059295654296875,-0.0031108856201171875,0.0230560302734375,0.08453369140625,0.0127716064453125,-0.0162811279296875,-0.06451416015625,-0.1456298828125,0.0014095306396484375,0.04150390625,0.0537109375,-0.111083984375,0.043426513671875,0.0254974365234375,0.06646728515625,0.029327392578125,-0.052398681640625,-0.0242767333984375,-0.07562255859375,0.072998046875,0.0158843994140625,0.07257080078125,-0.048492431640625,-0.0184173583984375,-0.0247955322265625,0.061676025390625,0.08673095703125,0.01064300537109375,-0.0266876220703125,0.07421875,0.03271484375,0.0225372314453125,-0.06622314453125,-0.0308990478515625],\"index\":0},{\"object\":\"embedding\",\"embedding\":[0.0040283203125,-0.06475830078125,-0.04193115234375,-0.00682830810546875,-0.0989990234375,0.0318603515625,-0.059783935546875,0.0975341796875,-0.043304443359375,-0.0206146240234375,0.139404296875,-0.08636474609375,-0.03594970703125,-0.0135040283203125,0.08441162109375,0.043212890625,-0.046417236328125,0.0311737060546875,-0.01009368896484375,0.09735107421875,-0.04254150390625,0.0718994140625,0.049407958984375,0.012725830078125,-0.0256805419921875,-0.004852294921875,0.016326904296875,-0.161865234375,-0.0009107589721679688,-0.01094818115234375,0.0706787109375,-0.03955078125,0.033782958984375,0.022430419921875,0.00428009033203125,0.035919189453125,-0.1182861328125,0.128173828125,-0.024078369140625,0.039947509765625,-0.06939697265625,-0.04638671875,0.0458984375,0.033111572265625,0.019256591796875,0.1710205078125,0.0792236328125,-0.060760498046875,-0.0001672506332397461,-0.02978515625,0.008453369140625,-0.08685302734375,-0.1085205078125,0.00794219970703125,0.03704833984375,0.0287017822265625,0.0021419525146484375,0.07666015625,-0.0032978057861328125,-0.0321044921875,-0.0200958251953125,0.01383209228515625,0.0439453125,-0.028564453125,0.002262115478515625,0.045196533203125,-0.027923583984375,0.10723876953125,-0.024871826171875,0.0247802734375,-0.0672607421875,0.048919677734375,0.05621337890625,-0.11114501953125,0.10321044921875,0.058929443359375,0.1097412109375,0.00743865966796875,-0.011749267578125,-0.001300811767578125,0.0472412109375,0.0029144287109375,0.05120849609375,0.035919189453125,0.0214080810546875,-0.09661865234375,-0.0289764404296875,-0.002971649169921875,-0.00542449951171875,-0.07183837890625,0.07220458984375,0.14013671875,-0.03155517578125,0.03326416015625,-0.033782958984375,-0.006809234619140625,0.02484130859375,-0.024871826171875,0.01508331298828125,0.1712646484375,0.032745361328125,-0.059356689453125,-0.0098114013671875,0.09686279296875,-0.042327880859375,0.05426025390625,-0.0028629302978515625,0.08001708984375,-0.03485107421875,0.05194091796875,-0.038421630859375,0.0019273757934570312,0.0204315185546875,-0.037811279296875,0.052093505859375,-0.0173797607421875,-0.124755859375,-0.031219482421875,-0.072265625,-0.09527587890625,-0.11480712890625,-0.0311737060546875,0.07958984375,-0.10284423828125,0.005443572998046875,-0.09967041015625,0.03131103515625,0.031707763671875,0.0028743743896484375,-0.0831298828125,0.1202392578125,0.03375244140625,-0.03314208984375,-0.0169219970703125,-0.016693115234375,0.040435791015625,0.01067352294921875,0.00048661231994628906,-0.08636474609375,-0.0723876953125,-0.05072021484375,-0.05078125,-0.057037353515625,0.017608642578125,0.042877197265625,0.0007386207580566406,-0.035003662109375,-0.07110595703125,-0.062347412109375,-0.05926513671875,0.06292724609375,-0.052734375,0.05078125,-0.05767822265625,-0.03668212890625,-0.03082275390625,0.03363037109375,0.11492919921875,-0.037322998046875,0.058074951171875,-0.0985107421875,0.0179290771484375,0.04937744140625,0.0311126708984375,0.0128173828125,0.06549072265625,-0.11688232421875,-0.010986328125,-0.140625,-0.08050537109375,-0.10052490234375,-0.0002529621124267578,-0.0270233154296875,-0.046142578125,0.004547119140625,0.024932861328125,0.020904541015625,-0.1014404296875,0.0653076171875,-0.0457763671875,0.12335205078125,0.00565338134765625,0.1326904296875,0.0853271484375,-0.0243682861328125,-0.06439208984375,-0.034759521484375,-0.004497528076171875,0.00226593017578125,0.08929443359375,0.08514404296875,-0.02716064453125,-0.01337432861328125,0.0318603515625,-0.125732421875,-0.037811279296875,0.01348114013671875,0.066162109375,-0.11871337890625,0.0049591064453125,-0.039581298828125,-0.049530029296875,0.077392578125,0.1041259765625,-0.040496826171875,0.00846099853515625,-0.03857421875,-0.14453125,0.046112060546875,-0.024658203125,0.1627197265625,-0.03521728515625,-0.08660888671875,-0.0035381317138671875,-0.0572509765625,-0.046630859375,0.005847930908203125,0.040374755859375,-0.01378631591796875,0.0220489501953125,0.055938720703125,-0.0260772705078125,0.041168212890625,0.058074951171875,0.057586669921875,-0.006938934326171875,0.051361083984375,0.023223876953125,-0.135986328125,0.03399658203125,-0.0269775390625,0.1708984375,-0.05035400390625,0.0634765625,-0.031524658203125,0.039947509765625,-0.0163421630859375,-0.03240966796875,-0.0000527501106262207,-0.08294677734375,-0.06317138671875,0.0235595703125,-0.0679931640625,0.06195068359375,-0.047821044921875,0.018768310546875,-0.046234130859375,0.0228424072265625,0.05670166015625,-0.0310821533203125,0.0287017822265625,0.11859130859375,0.04473876953125,-0.0535888671875,-0.006710052490234375,-0.02911376953125],\"index\":1}],\"model\":\"text-embedding-3-small\",\"usage\":{\"prompt_tokens\":12,\"total_tokens\":12}}" + } + } + ] +} diff --git a/packages/ai/test/image.test.ts b/packages/ai/test/image.test.ts index f362c20257..b44949bfdc 100644 --- a/packages/ai/test/image.test.ts +++ b/packages/ai/test/image.test.ts @@ -73,14 +73,14 @@ describe("Image", () => { }) expect(response.images).toHaveLength(2) - expect(response.image.mediaType).toBe("image/webp") - expect(response.image.source).toEqual({ + expect(response.images[0].mediaType).toBe("image/webp") + expect(response.images[0].source).toEqual({ type: "bytes", data: Uint8Array.from([1, 2, 3]), mediaType: "image/webp", }) - expect(yield* response.image.bytes()).toEqual(Uint8Array.from([1, 2, 3])) - expect(response.image.info).toEqual({ format: "webp", width: 2048, height: 2048 }) + expect(yield* response.images[0].bytes()).toEqual(Uint8Array.from([1, 2, 3])) + expect(response.images[0].info).toEqual({ format: "webp", width: 2048, height: 2048 }) expect(response.usage).toMatchObject({ type: "tokens", total: 12 }) expect(response.providerMetadata).toEqual({ openai: { outputFormat: "webp", size: "2048x2048", quality: "high", background: "opaque" }, @@ -151,7 +151,7 @@ describe("Image", () => { ), ), ) - expect(response.image.source).toEqual({ + expect(response.images[0].source).toEqual({ type: "bytes", data: Uint8Array.from([0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10]), mediaType: "image/jpeg", @@ -208,22 +208,22 @@ describe("Image", () => { it.effect("keeps an http url as a URL asset", () => Effect.gen(function* () { const response = yield* generate([{ url: "https://cdn.image.test/result.png" }]) - expect(response.image.source).toEqual({ type: "url", url: "https://cdn.image.test/result.png" }) + expect(response.images[0].source).toEqual({ type: "url", url: "https://cdn.image.test/result.png" }) }), ) it.effect("decodes a data url inline with its media type", () => Effect.gen(function* () { const response = yield* generate([{ url: "data:image/png;base64,iVBORw==" }]) - expect(response.image.source).toEqual({ type: "base64", data: "iVBORw==", mediaType: "image/png" }) - expect(response.image.mediaType).toBe("image/png") + expect(response.images[0].source).toEqual({ type: "base64", data: "iVBORw==", mediaType: "image/png" }) + expect(response.images[0].mediaType).toBe("image/png") }), ) it.effect("prefers b64_json when url is null", () => Effect.gen(function* () { const response = yield* generate([{ b64_json: "/9j/4AAQ", url: null }]) - expect(response.image.source).toEqual({ + expect(response.images[0].source).toEqual({ type: "bytes", data: Uint8Array.from([0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10]), mediaType: "image/jpeg", @@ -449,7 +449,7 @@ describe("Image", () => { .pipe( Effect.tap((response) => Effect.sync(() => { - expect(response.image.mediaType).toBe("image/avif") + expect(response.images[0].mediaType).toBe("image/avif") }), ), Effect.provide( diff --git a/packages/ai/test/llm.test.ts b/packages/ai/test/llm.test.ts index 013cd21fb3..510cce9824 100644 --- a/packages/ai/test/llm.test.ts +++ b/packages/ai/test/llm.test.ts @@ -160,7 +160,7 @@ describe("llm constructors", () => { }) const updated = LanguageModel.update(base, { route: responsesRoute, - defaults: { maxTokens: 20 }, + options: { maxTokens: 20 }, compatibility: { sanitizer: "gemini", requireFinishReason: false }, }) const updatedInput = LanguageModel.input(updated) @@ -168,9 +168,9 @@ describe("llm constructors", () => { expect(updated).toBeInstanceOf(LanguageModel) expect(String(updated.id)).toBe("fake-model") expect(updated.route).toBe(responsesRoute) - expect(updated.defaults?.maxTokens).toBe(20) + expect(updated.options?.maxTokens).toBe(20) expect(updated.compatibility).toEqual({ sanitizer: "gemini", requireFinishReason: false }) - expect(updatedInput.defaults).toBe(updated.defaults) + expect(updatedInput.options).toBe(updated.options) expect(updatedInput.compatibility).toBe(updated.compatibility) expect(String(updatedInput.provider)).toBe("fake") expect(LanguageModel.update(updated, {})).toBe(updated) @@ -179,7 +179,7 @@ describe("llm constructors", () => { test("carries model defaults and compatibility through route model selection", () => { const model = chatRoute.model({ id: "kimi-k2", - defaults: { + options: { maxTokens: 1_024, stop: ["END"], providerOptions: { parallelToolCalls: false }, @@ -189,9 +189,9 @@ describe("llm constructors", () => { }) const request = ai.request({ model, prompt: "Say hello." }) - expect(request.model.defaults).toMatchObject({ maxTokens: 1_024, stop: ["END"] }) - expect(request.model.defaults?.providerOptions).toEqual({ parallelToolCalls: false }) - expect(request.model.defaults?.http).toEqual({ body: { extra_body: true } }) + expect(request.model.options).toMatchObject({ maxTokens: 1_024, stop: ["END"] }) + expect(request.model.options?.providerOptions).toEqual({ parallelToolCalls: false }) + expect(request.model.options?.http).toEqual({ body: { extra_body: true } }) expect(request.model.compatibility).toEqual({ sanitizer: "moonshot" }) expect(request.maxTokens).toBeUndefined() expect(request.providerOptions).toBeUndefined() diff --git a/packages/ai/test/promise-parity.types.ts b/packages/ai/test/promise-parity.types.ts index 301dde3b81..365c2071d3 100644 --- a/packages/ai/test/promise-parity.types.ts +++ b/packages/ai/test/promise-parity.types.ts @@ -12,7 +12,7 @@ type Assert> = T type PromiseAI = Omit type EffectAI = typeof ai type Helpers = "run" | "bytes" | "base64" | "materialize" | "file" | "write" -type Namespaces = "image" | "decision" | "experimental" +type Namespaces = "image" | "decision" | "embedding" | "experimental" type Signatures = F extends { (...args: infer A1): infer R1 @@ -70,6 +70,7 @@ export type Checks = [ Assert, Omit>>, Assert>, Assert>, + Assert>, Assert>, Assert>, Assert>, diff --git a/packages/ai/test/promise.test.ts b/packages/ai/test/promise.test.ts index 86fce9dae4..a794dd699c 100644 --- a/packages/ai/test/promise.test.ts +++ b/packages/ai/test/promise.test.ts @@ -130,13 +130,13 @@ describe("AI promise client", () => { expect((await ai.generate({ model: openai.chat("gpt-4o-mini"), prompt: "Say hello." })).text).toBe("Hello world") const image = await ai.image.generate({ model: openai.image("gpt-image-2"), prompt: "A lighthouse" }) - expect(image.image).toBeInstanceOf(Media.Asset) - expect(image.image.mediaType).toBe("image/png") - expect(await ai.run(image.image.bytes())).toEqual(Uint8Array.from([1, 2, 3])) + expect(image.images[0]).toBeInstanceOf(Media.Asset) + expect(image.images[0].mediaType).toBe("image/png") + expect(await ai.run(image.images[0].bytes())).toEqual(Uint8Array.from([1, 2, 3])) const requested = await ai.image.generate( ai.image.request({ model: openai.image("gpt-image-2"), prompt: "A lighthouse" }), ) - expect(requested.image.mediaType).toBe("image/png") + expect(requested.images[0].mediaType).toBe("image/png") const deltas: Array = [] for await (const event of ai.stream(request)) { diff --git a/packages/ai/test/provider-error.test.ts b/packages/ai/test/provider-error.test.ts index 870835d2fd..9b955e4654 100644 --- a/packages/ai/test/provider-error.test.ts +++ b/packages/ai/test/provider-error.test.ts @@ -457,17 +457,23 @@ describe("provider error classification", () => { expect(isContextOverflow("Too many tokens")).toBe(true) }) - test("classifies 429 token throttles as retryable rate limits, not context overflow", () => { + test("classifies 429 throttles as retryable rate limits, not context overflow", () => { const bodies = [ // Cerebras, captured live '{"message":"Tokens per minute limit exceeded - too many tokens processed.","type":"too_many_tokens_error","param":"quota","code":"token_quota_exceeded"}', '{"message":"Token limit reached: too many tokens per minute for this model."}', + '{"error":{"message":"User 10s request rate limit exhausted (3 of 3).","type":"rate_limit_exceeded","code":null}}', ] for (const body of bodies) { const error = new AIError({ - reason: classifyProviderFailure({ message: providerErrorMessage(body), status: 429, rawBody: body }), + reason: classifyProviderFailure({ + message: providerErrorMessage(body), + status: 429, + rawBody: body, + retryAfterMs: 4000, + }), }) - expect(error.reason._tag).toBe("RateLimit") + expect(error.reason).toMatchObject({ _tag: "RateLimit", retryAfterMs: 4000 }) expect(isRetryable(error)).toBe(true) } }) diff --git a/packages/ai/test/provider-options/checkpoint.types.ts b/packages/ai/test/provider-options/checkpoint.types.ts index c376e24e16..2e1f5f4e45 100644 --- a/packages/ai/test/provider-options/checkpoint.types.ts +++ b/packages/ai/test/provider-options/checkpoint.types.ts @@ -47,7 +47,7 @@ for (const selected of [ OpenAI.model("fixture", {}), model.route.with({ headers: { fixture: "test" } }).model({ id: "fixture" }), LanguageModel.make(LanguageModel.input(model)), - LanguageModel.update(model, { defaults: { maxTokens: 100 } }), + LanguageModel.update(model, { options: { maxTokens: 100 } }), ]) { ai.compact(ai.request({ model: selected, prompt: "Hello" }), { mechanism: "trigger" }) } diff --git a/packages/ai/test/provider-options/compaction.types.ts b/packages/ai/test/provider-options/compaction.types.ts index a933de6c0c..158e680409 100644 --- a/packages/ai/test/provider-options/compaction.types.ts +++ b/packages/ai/test/provider-options/compaction.types.ts @@ -25,7 +25,7 @@ for (const model of [ Azure.responsesModel("fixture", { resourceName: "test" }), XAI.model("fixture", {}), openai.route.with({ headers: { "x-test": "test" } }).model({ id: "fixture" }), - LanguageModel.update(openai, { defaults: { maxTokens: 100 } }), + LanguageModel.update(openai, { options: { maxTokens: 100 } }), LanguageModel.make(LanguageModel.input(openai)), ]) { ai.compact(ai.request({ model, prompt: "hello" })) diff --git a/packages/ai/test/provider-package.test.ts b/packages/ai/test/provider-package.test.ts index 7b53054f48..1a330eeb8f 100644 --- a/packages/ai/test/provider-package.test.ts +++ b/packages/ai/test/provider-package.test.ts @@ -29,8 +29,8 @@ describe("provider package entrypoints", () => { expect(model.route.endpoint.baseURL).toBe( `https://llm-fixture.eu-central-1.maas.aliyuncs.com/${index === 2 ? "apps/anthropic/v1" : "compatible-mode/v1"}`, ) - expect(model.route.defaults.headers).toEqual(settings.headers) - expect(model.route.defaults.http?.body).toEqual(settings.body) + expect(model.options?.headers).toEqual(settings.headers) + expect(model.options?.http?.body).toEqual(settings.body) }) }) @@ -53,8 +53,8 @@ describe("provider package entrypoints", () => { expect(selected.provider).toBe("moonshotai") expect(selected.route.id).toBe(routes[index]) expect(selected.route.endpoint.baseURL).toBe(settings.baseURL) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) }) }) @@ -91,9 +91,9 @@ describe("provider package entrypoints", () => { expect(selected.route.id).toBe(`${provider}-responses`) expect(selected.route.protocol).toBe(protocol) expect(selected.route.endpoint).toMatchObject({ baseURL, path: "/responses" }) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) - expect(selected.route.defaults.providerOptions).toEqual({ + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) + expect(selected.options?.providerOptions).toEqual({ reasoningEffort: "low", store: false, include: ["reasoning.encrypted_content"], @@ -118,8 +118,8 @@ describe("provider package entrypoints", () => { const selected = module.model("command-a-03-2025", settings) expect(selected.provider).toBe("cohere") expect([selected.route.id, selected.route.endpoint.baseURL]).toEqual(routes[index]) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) }) }) @@ -142,8 +142,8 @@ describe("provider package entrypoints", () => { expect(selected.provider).toBe("minimax") expect(selected.route.id).toBe(routes[index]) expect(selected.route.endpoint.baseURL).toBe(settings.baseURL) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) }) }) @@ -175,8 +175,8 @@ describe("provider package entrypoints", () => { expect(selected.provider).toBe(index < 2 ? "zai" : "zai-coding-plan") expect(selected.route.id).toBe(routes[index]) expect(selected.route.endpoint.baseURL).toBe(settings.baseURL) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) }) }) @@ -193,9 +193,9 @@ describe("provider package entrypoints", () => { expect(deepinfra.route.id).toBe("deepinfra-chat") expect(deepinfra.route.endpoint.baseURL).toBe("https://provider.example.test/v1/openai") - expect(deepinfra.route.defaults.providerOptions).toEqual({ reasoningEffort: "high" }) - expect(deepinfra.route.defaults.headers).toEqual(settings.headers) - expect(deepinfra.route.defaults.http?.body).toEqual(settings.body) + expect(deepinfra.options?.providerOptions).toEqual({ reasoningEffort: "high" }) + expect(deepinfra.options?.headers).toEqual(settings.headers) + expect(deepinfra.options?.http?.body).toEqual(settings.body) }) test("maps Cloudflare package settings onto provider-owned models", async () => { @@ -213,9 +213,9 @@ describe("provider package entrypoints", () => { }) expect(selected.provider).toBe(provider.id) expect(selected.route.endpoint.baseURL).toBe(provider.baseURL({ accountId: "account" })) - expect(selected.route.defaults.headers).toMatchObject({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ custom: true }) - expect(selected.route.defaults.providerOptions).toEqual({ reasoningEffort: "high" }) + expect(selected.options?.headers).toMatchObject({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ custom: true }) + expect(selected.options?.providerOptions).toEqual({ reasoningEffort: "high" }) } }) @@ -239,11 +239,11 @@ describe("provider package entrypoints", () => { for (const selected of [openrouter, xai]) { expect(selected.route.endpoint.baseURL).toBe(settings.baseURL) - expect(selected.route.defaults.headers).toEqual(settings.headers) - expect(selected.route.defaults.http?.body).toEqual(settings.body) + expect(selected.options?.headers).toEqual(settings.headers) + expect(selected.options?.http?.body).toEqual(settings.body) } - expect(openrouter.route.defaults.providerOptions).toEqual({ usage: true }) - expect(xai.route.defaults.providerOptions).toMatchObject({ reasoningEffort: "high", store: false }) + expect(openrouter.options?.providerOptions).toEqual({ usage: true }) + expect(xai.options?.providerOptions).toMatchObject({ reasoningEffort: "high", store: false }) }) test("maps package settings onto the executable model", () => { @@ -256,8 +256,8 @@ describe("provider package entrypoints", () => { }) expect(selected.route.id).toBe("openai-responses") - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ service_tier: "priority" }) + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ service_tier: "priority" }) }) test("maps OpenAI-compatible Responses settings onto the executable model", async () => { @@ -278,9 +278,9 @@ describe("provider package entrypoints", () => { baseURL: "https://responses.example.test/v1", path: "/responses", }) - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ service_tier: "priority" }) - expect(selected.route.defaults.providerOptions).toEqual({ + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ service_tier: "priority" }) + expect(selected.options?.providerOptions).toEqual({ reasoningEffort: "low", store: true, include: ["reasoning.encrypted_content"], @@ -311,9 +311,9 @@ describe("provider package entrypoints", () => { body: {}, }).toString(), ).toBe("https://messages.example.test/v1/messages") - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ metadata: { user_id: "user_1" } }) - expect(selected.route.defaults.providerOptions).toEqual({ effort: "low" }) + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ metadata: { user_id: "user_1" } }) + expect(selected.options?.providerOptions).toEqual({ effort: "low" }) }) test("maps Anthropic provider options onto the executable model", async () => { @@ -324,7 +324,7 @@ describe("provider package entrypoints", () => { }) expect(selected.route.id).toBe("anthropic-messages") - expect(selected.route.defaults.providerOptions).toEqual({ thinking: { type: "adaptive" } }) + expect(selected.options?.providerOptions).toEqual({ thinking: { type: "adaptive" } }) }) test("requires an Anthropic-compatible base URL at runtime", async () => { @@ -362,7 +362,7 @@ describe("provider package entrypoints", () => { project: "proj_123", }) - expect(selected.route.defaults.headers).toMatchObject({ + expect(selected.options?.headers).toMatchObject({ "OpenAI-Organization": "org_123", "OpenAI-Project": "proj_123", }) @@ -385,8 +385,8 @@ describe("provider package entrypoints", () => { expect(Azure.model("deployment", settings).route.id).toBe("azure-openai-responses") expect(responses.route.id).toBe("azure-openai-responses") expect(responses.route.endpoint.baseURL).toBe("https://opencode-test.openai.azure.com/openai/v1") - expect(responses.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(responses.route.defaults.http?.body).toEqual({ service_tier: "priority" }) + expect(responses.options?.headers).toEqual({ "x-application": "opencode" }) + expect(responses.options?.http?.body).toEqual({ service_tier: "priority" }) expect(chat.route.id).toBe("azure-openai-chat") }) @@ -424,9 +424,9 @@ describe("provider package entrypoints", () => { expect(selected.route.id).toBe("gemini") expect(selected.route.endpoint.baseURL).toBe("https://generativelanguage.test/v1beta") - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ safetySettings: [] }) - expect(selected.route.defaults.providerOptions).toEqual({ thinkingConfig: { thinkingBudget: 1_024 } }) + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ safetySettings: [] }) + expect(selected.options?.providerOptions).toEqual({ thinkingConfig: { thinkingBudget: 1_024 } }) const interactions = GoogleInteractions.model("gemini-3.8-flash", { apiKey: "fixture", baseURL: "https://generativelanguage.test/v1beta", @@ -435,7 +435,7 @@ describe("provider package entrypoints", () => { }) expect(interactions.route.id).toBe("google-interactions") expect(interactions.route.endpoint.baseURL).toBe("https://generativelanguage.test/v1beta") - expect(interactions.route.defaults.providerOptions).toEqual({ thinkingLevel: "low", store: true }) + expect(interactions.options?.providerOptions).toEqual({ thinkingLevel: "low", store: true }) expect(Google.configure().interactions("gemini-3.8-flash").route.protocol).toBe("google-interactions") }) @@ -468,8 +468,8 @@ describe("provider package entrypoints", () => { expect(gemini.route.id).toBe("google-vertex-gemini") expect(gemini.route.protocol).toBe("gemini") expect(gemini.route.endpoint.baseURL).toBe("https://aiplatform.googleapis.com/v1/publishers/google") - expect(gemini.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(gemini.route.defaults.http?.body).toEqual({ safetySettings: [] }) + expect(gemini.options?.headers).toEqual({ "x-application": "opencode" }) + expect(gemini.options?.http?.body).toEqual({ safetySettings: [] }) expect( GoogleVertex.model("gemini-3.5-flash", { accessToken: "fixture", @@ -494,7 +494,7 @@ describe("provider package entrypoints", () => { baseURL: "https://aiplatform.googleapis.com/v1/projects/vertex-project/locations/global/endpoints/openapi", path: "/responses", }) - expect(responses.route.defaults.providerOptions).toEqual({ + expect(responses.options?.providerOptions).toEqual({ store: false, include: ["reasoning.encrypted_content"], }) @@ -518,9 +518,9 @@ describe("provider package entrypoints", () => { path: "/interactions", query: { alt: "sse" }, }) - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ generation_config: { temperature: 0.5 } }) - expect(selected.route.defaults.providerOptions).toEqual({ thinkingLevel: "low", store: false }) + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ generation_config: { temperature: 0.5 } }) + expect(selected.options?.providerOptions).toEqual({ thinkingLevel: "low", store: false }) }) test("rejects conflicting Vertex auth settings at runtime", async () => { diff --git a/packages/ai/test/provider/alibaba-images.recorded.test.ts b/packages/ai/test/provider/alibaba-images.recorded.test.ts index 26f929d8bf..3989b81a1e 100644 --- a/packages/ai/test/provider/alibaba-images.recorded.test.ts +++ b/packages/ai/test/provider/alibaba-images.recorded.test.ts @@ -27,7 +27,7 @@ describe("Alibaba Images recorded", () => { }) expect(response.images).toHaveLength(2) - expect(response.image.source.type === "url" && response.image.source.url).toStartWith("https://") + expect(response.images[0].source.type === "url" && response.images[0].source.url).toStartWith("https://") expect(response.providerMetadata?.alibaba).toMatchObject({ usage: { image_count: 2, width: 512, height: 512 } }) }), ) @@ -64,7 +64,7 @@ describe("Alibaba Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.source.type).toBe("url") + expect(response.images[0].source.type).toBe("url") }), { timeout: 60_000 }, ) diff --git a/packages/ai/test/provider/anthropic-messages.test.ts b/packages/ai/test/provider/anthropic-messages.test.ts index b708df2bd2..7e32f4fa8d 100644 --- a/packages/ai/test/provider/anthropic-messages.test.ts +++ b/packages/ai/test/provider/anthropic-messages.test.ts @@ -1360,6 +1360,29 @@ describe("Anthropic Messages route", () => { }), ) + it.effect("converts the GitHub Copilot billing on the message delta to USD", () => + Effect.gen(function* () { + const response = yield* LLMClient.generate(request).pipe( + Effect.provide( + fixedResponse( + sseEvents( + { type: "message_start", message: { usage: { input_tokens: 5 } } }, + { + type: "message_delta", + delta: { stop_reason: "end_turn" }, + usage: { output_tokens: 2 }, + copilot_usage: { total_nano_aiu: 4_473_525_000 }, + }, + { type: "message_stop" }, + ), + ), + ), + ) + + expect(response.usage).toMatchObject({ inputTokens: 5, outputTokens: 2, cost: 0.04473525 }) + }), + ) + it.effect("preserves terminal state across usage-only message deltas", () => Effect.gen(function* () { const response = yield* LLMClient.generate(request).pipe( diff --git a/packages/ai/test/provider/cloudflare-workers-ai-images.recorded.test.ts b/packages/ai/test/provider/cloudflare-workers-ai-images.recorded.test.ts index cce34bd520..0eca18a934 100644 --- a/packages/ai/test/provider/cloudflare-workers-ai-images.recorded.test.ts +++ b/packages/ai/test/provider/cloudflare-workers-ai-images.recorded.test.ts @@ -34,8 +34,8 @@ describe("Cloudflare Workers AI Images recorded", () => { }) // The Run API labels this response image/png, but the bytes are JPEG. - expect(response.image.mediaType).toBe("image/jpeg") - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 256, height: 256 }) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 256, height: 256 }) }), ) @@ -49,8 +49,8 @@ describe("Cloudflare Workers AI Images recorded", () => { providerOptions: { width: 64, height: 64, seed: 3, steps: 1 }, }) - expect(response.image.mediaType).toBe("image/jpeg") - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 64, height: 64 }) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 64, height: 64 }) }), { timeout: 60_000 }, ) diff --git a/packages/ai/test/provider/cloudflare-workers-ai-images.test.ts b/packages/ai/test/provider/cloudflare-workers-ai-images.test.ts index b072c2f0e1..f058cc2cdd 100644 --- a/packages/ai/test/provider/cloudflare-workers-ai-images.test.ts +++ b/packages/ai/test/provider/cloudflare-workers-ai-images.test.ts @@ -30,7 +30,7 @@ describe("Cloudflare Workers AI Images", () => { http: { body: { guidance: 5 } }, }) - expect(response.image.mediaType).toBe("image/png") + expect(response.images[0].mediaType).toBe("image/png") expect(response.providerMetadata).toEqual({ "cloudflare-workers-ai": { usage: { neurons: 12 } } }) }).pipe( Effect.provide( diff --git a/packages/ai/test/provider/cloudflare.test.ts b/packages/ai/test/provider/cloudflare.test.ts index cf58e06ca8..558d2b7476 100644 --- a/packages/ai/test/provider/cloudflare.test.ts +++ b/packages/ai/test/provider/cloudflare.test.ts @@ -153,7 +153,7 @@ describe("Cloudflare", () => { }), ) - expect(prepared.model.route.defaults.headers).toMatchObject({ "cf-aig-gateway-id": "default" }) + expect(prepared.model.options?.headers).toMatchObject({ "cf-aig-gateway-id": "default" }) }), ) diff --git a/packages/ai/test/provider/cohere.test.ts b/packages/ai/test/provider/cohere.test.ts index ac52ea06a0..350ee4e92f 100644 --- a/packages/ai/test/provider/cohere.test.ts +++ b/packages/ai/test/provider/cohere.test.ts @@ -14,7 +14,7 @@ test("Cohere exposes native and compatible endpoints without Core remapping", () expect(cohere.chat("command-a-03-2025").route.endpoint.baseURL).toBe("https://api.cohere.ai/compatibility/v1") expect( Cohere.model("command-a-03-2025", { apiKey: "fixture", headers: { "X-Test": "yes" }, body: { temperature: 0 } }) - .route.defaults?.http, + .options?.http, ).toMatchObject({ body: { temperature: 0 } }) }) diff --git a/packages/ai/test/provider/digitalocean.test.ts b/packages/ai/test/provider/digitalocean.test.ts index 3b29fd871e..54e95ff8d4 100644 --- a/packages/ai/test/provider/digitalocean.test.ts +++ b/packages/ai/test/provider/digitalocean.test.ts @@ -15,7 +15,7 @@ describe("DigitalOcean", () => { headers: { "X-Test": "fixture" }, body: { temperature: 0 }, }) - expect(model.route.defaults).toMatchObject({ + expect(model.options).toMatchObject({ headers: { "X-Test": "fixture" }, http: { body: { temperature: 0 } }, }) diff --git a/packages/ai/test/provider/embedding.recorded.test.ts b/packages/ai/test/provider/embedding.recorded.test.ts new file mode 100644 index 0000000000..32ed22858a --- /dev/null +++ b/packages/ai/test/provider/embedding.recorded.test.ts @@ -0,0 +1,109 @@ +import { describe, expect } from "bun:test" +import { Effect } from "effect" +import { ai, Media, type EmbeddingModel, type EmbeddingOptions } from "../../src/effect.js" +import { Cohere, Google, GoogleVertex, OpenAI } from "../../src/providers.js" +import { recordedTests } from "../recorded-test.js" + +const values = ["The invoice was charged twice.", "Refund the duplicate payment."] + +const openai = recordedTests({ + prefix: "openai-embedding", + provider: "openai", + protocol: "openai-embeddings", + requires: ["OPENAI_API_KEY"], + metadata: { model: "text-embedding-3-small" }, +}) + +const cohere = recordedTests({ + prefix: "cohere-embedding", + provider: "cohere", + protocol: "openai-embeddings", + requires: ["COHERE_API_KEY"], + metadata: { model: "embed-v4.0" }, +}) + +const google = recordedTests({ + prefix: "google-embedding", + provider: "google", + protocol: "google-embed-content", + requires: ["GOOGLE_GENERATIVE_AI_API_KEY"], +}) + +const vertex = recordedTests({ + prefix: "google-vertex-embedding", + provider: "google-vertex", + protocol: "google-vertex-predict-embeddings", + requires: ["GOOGLE_VERTEX_API_KEY"], +}) + +const vertexProvider = GoogleVertex.configure({ apiKey: process.env.GOOGLE_VERTEX_API_KEY ?? "fixture" }) + +const googleProvider = Google.configure({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY ?? "fixture" }) + +describe("Embedding recorded", () => { + openai.effect("embeds text with requested dimensions", () => + assertEmbedding( + OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY ?? "fixture" }).embedding("text-embedding-3-small"), + ), + ) + + cohere.effect("embeds text through the compatibility API", () => + assertEmbedding(Cohere.configure({ apiKey: process.env.COHERE_API_KEY ?? "fixture" }).embedding("embed-v4.0")), + ) + + google.effect("embeds text through batchEmbedContents", () => + assertEmbedding(googleProvider.embedding("gemini-embedding-2")), + ) + + google.effect("embeds an image and text into one vector each", () => + Effect.gen(function* () { + const image = Media.bytes( + new Uint8Array( + yield* Effect.promise(() => Bun.file(`${import.meta.dir}/../fixtures/images/edit-source.jpg`).arrayBuffer()), + ), + "image/jpeg", + ) + const response = yield* ai.embedding.generate({ + model: googleProvider.embedding("gemini-embedding-2"), + values: [image, "A small square image."], + dimensions: 128, + }) + expect(response.embeddings).toHaveLength(2) + for (const vector of response.embeddings) expect(vector).toHaveLength(128) + expect(response.usage?.inputTokens).toBeGreaterThan(258) + }), + ) + + google.effect("maps inputType to a task type for gemini-embedding-001", () => + Effect.gen(function* () { + const model = googleProvider.embedding("gemini-embedding-001") + const query = yield* ai.embedding.generate({ model, values: [values[0]], dimensions: 64, inputType: "query" }) + const document = yield* ai.embedding.generate({ + model, + values: [values[0]], + dimensions: 64, + inputType: "document", + }) + expect(query.embeddings[0]).toHaveLength(64) + expect(query.embeddings[0]).not.toEqual(document.embeddings[0]) + }), + ) +}) + +describe("Google Vertex embedding recorded", () => { + vertex.effect("embeds text through :predict", () => assertEmbedding(vertexProvider.embedding("text-embedding-005"))) + + vertex.effect("embeds gemini-embedding-001 one text per :predict request", () => + assertEmbedding(vertexProvider.embedding("gemini-embedding-001")), + ) +}) + +const assertEmbedding = (model: EmbeddingModel) => + Effect.gen(function* () { + const response = yield* ai.embedding.generate({ model, values, dimensions: 256, inputType: "document" }) + expect(response.embeddings).toHaveLength(2) + for (const vector of response.embeddings) expect(vector).toHaveLength(256) + expect(response.embeddings[0]).not.toEqual(response.embeddings[1]) + expect(response.usage?.inputTokens).toBeGreaterThan(0) + return response + }) diff --git a/packages/ai/test/provider/explicit-compaction.test.ts b/packages/ai/test/provider/explicit-compaction.test.ts index 0d6a7ad312..ea09f03abd 100644 --- a/packages/ai/test/provider/explicit-compaction.test.ts +++ b/packages/ai/test/provider/explicit-compaction.test.ts @@ -61,7 +61,7 @@ testEffect( headers.push(String(request.model.id)) return { "x-deployment": "fixture", "x-override": "route" } }, - defaults: { + options: { headers: { "x-default": "configured", "x-override": "configured" }, providerOptions: { store: false }, http: { body: { instructions: "default instructions" } }, diff --git a/packages/ai/test/provider/google-images.recorded.test.ts b/packages/ai/test/provider/google-images.recorded.test.ts index e47a962948..add7474ff7 100644 --- a/packages/ai/test/provider/google-images.recorded.test.ts +++ b/packages/ai/test/provider/google-images.recorded.test.ts @@ -26,8 +26,8 @@ describe("Google Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toMatch(/^image\//) - expect((yield* response.image.bytes()).length).toBeGreaterThan(0) + expect(response.images[0].mediaType).toMatch(/^image\//) + expect((yield* response.images[0].bytes()).length).toBeGreaterThan(0) }), ) @@ -46,8 +46,8 @@ describe("Google Images recorded", () => { aspect: "1:1", }) - expect(response.image.mediaType).toBe("image/jpeg") - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1024, height: 1024 }) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1024, height: 1024 }) }), ) }) diff --git a/packages/ai/test/provider/groq.test.ts b/packages/ai/test/provider/groq.test.ts index 2947e621cd..5343e9803b 100644 --- a/packages/ai/test/provider/groq.test.ts +++ b/packages/ai/test/provider/groq.test.ts @@ -48,8 +48,8 @@ it.effect("Groq lowers its own options for custom catalog identities and endpoin }), ) expect(model.route.endpoint.baseURL).toBe("https://gateway.example/v1") - expect(model.route.defaults.headers).toEqual({ "x-client": "test" }) - expect(model.route.defaults.http?.body).toEqual({ custom: "value" }) + expect(model.options?.headers).toEqual({ "x-client": "test" }) + expect(model.options?.http?.body).toEqual({ custom: "value" }) expect(compiled.body).toMatchObject({ reasoning_effort: "default", reasoning_format: "parsed", diff --git a/packages/ai/test/provider/media-entrypoints.test.ts b/packages/ai/test/provider/media-entrypoints.test.ts index 79a1e33e24..063be80f7e 100644 --- a/packages/ai/test/provider/media-entrypoints.test.ts +++ b/packages/ai/test/provider/media-entrypoints.test.ts @@ -1,6 +1,14 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" -import { ai, DecisionClient, type DecisionModel, ImageClient, type ImageModel } from "../../src/effect.js" +import { + ai, + DecisionClient, + type DecisionModel, + EmbeddingClient, + type EmbeddingModel, + ImageClient, + type ImageModel, +} from "../../src/effect.js" import { it } from "../lib/effect.js" import { dynamicResponse, observe, type Call } from "../lib/http.js" @@ -32,6 +40,15 @@ const sentDecision = (model: DecisionModel) => return calls }) +const sentEmbedding = (model: EmbeddingModel) => + Effect.gen(function* () { + const calls: Array = [] + yield* ai.embedding + .generate({ model, values: ["The sky is red."] }) + .pipe(Effect.exit, Effect.provide(EmbeddingClient.layer.pipe(Layer.provide(record(calls))))) + return calls + }) + interface Case { readonly name: string readonly load: () => Promise @@ -45,7 +62,11 @@ interface Case { readonly bodyInInput?: boolean } -const expectRequest = (calls: ReadonlyArray, model: ImageModel | DecisionModel, entry: Case) => { +const expectRequest = ( + calls: ReadonlyArray, + model: ImageModel | DecisionModel | EmbeddingModel, + entry: Case, +) => { expect(calls).toHaveLength(1) const call = calls[0] expect(call.url).toBe(entry.url) @@ -243,6 +264,21 @@ const decisions: ReadonlyArray> = [ auth: ["authorization", "Bearer openrouter-key"], provider: "openrouter", }, + { + name: "openai-compatible", + load: async () => { + const { model } = await import("@opencode/ai/providers/openai-compatible/decisions") + return model("clef-flash", { + ...shared, + apiKey: "local-key", + baseURL: "http://127.0.0.1:1234/v1", + provider: "lmstudio", + }) + }, + url: "http://127.0.0.1:1234/v1/systemone", + auth: ["authorization", "Bearer local-key"], + provider: "lmstudio", + }, { name: "baseten", load: async () => { @@ -303,6 +339,138 @@ const decisions: ReadonlyArray> = [ }, ] +const embeddings: ReadonlyArray> = [ + { + name: "openai", + load: async () => { + const { model } = await import("@opencode/ai/providers/openai/embeddings") + return model("text-embedding-3-small", { ...shared, apiKey: "openai-key", organization: "org-1" }) + }, + url: "https://api.openai.com/v1/embeddings", + auth: ["authorization", "Bearer openai-key"], + headers: { "openai-organization": "org-1" }, + provider: "openai", + }, + { + name: "openai-compatible", + load: async () => { + const { model } = await import("@opencode/ai/providers/openai-compatible/embeddings") + return model("nvidia/nemotron-3.5-embed-1b", { + ...shared, + apiKey: "nvidia-key", + baseURL: "https://integrate.api.nvidia.test/v1", + provider: "nvidia", + }) + }, + url: "https://integrate.api.nvidia.test/v1/embeddings", + auth: ["authorization", "Bearer nvidia-key"], + provider: "nvidia", + }, + { + name: "openrouter", + load: async () => { + const { model } = await import("@opencode/ai/providers/openrouter/embeddings") + return model("openai/text-embedding-3-small", { ...shared, apiKey: "openrouter-key" }) + }, + url: "https://openrouter.ai/api/v1/embeddings", + auth: ["authorization", "Bearer openrouter-key"], + provider: "openrouter", + }, + { + name: "vercel-ai-gateway", + load: async () => { + const { model } = await import("@opencode/ai/providers/vercel-ai-gateway/embeddings") + return model("openai/text-embedding-3-small", { ...shared, apiKey: "vercel-key" }) + }, + url: "https://ai-gateway.vercel.sh/v1/embeddings", + auth: ["authorization", "Bearer vercel-key"], + provider: "vercel-ai-gateway", + }, + { + name: "deepinfra", + load: async () => { + const { model } = await import("@opencode/ai/providers/deepinfra/embeddings") + return model("BAAI/bge-m3", { ...shared, apiKey: "deepinfra-key" }) + }, + url: "https://api.deepinfra.com/v1/openai/embeddings", + auth: ["authorization", "Bearer deepinfra-key"], + provider: "deepinfra", + }, + { + name: "fireworks", + load: async () => { + const { model } = await import("@opencode/ai/providers/fireworks/embeddings") + return model("nomic-ai/nomic-embed-text-v1.5", { ...shared, apiKey: "fireworks-key" }) + }, + url: "https://api.fireworks.ai/inference/v1/embeddings", + auth: ["authorization", "Bearer fireworks-key"], + provider: "fireworks", + }, + { + name: "cohere", + load: async () => { + const { model } = await import("@opencode/ai/providers/cohere/embeddings") + return model("embed-v4.0", { ...shared, apiKey: "cohere-key" }) + }, + url: "https://api.cohere.ai/compatibility/v1/embeddings", + auth: ["authorization", "Bearer cohere-key"], + provider: "cohere", + }, + { + name: "digitalocean", + load: async () => { + const { model } = await import("@opencode/ai/providers/digitalocean/embeddings") + return model("bge-m3", { ...shared, apiKey: "do-key" }) + }, + url: "https://inference.do-ai.run/v1/embeddings", + auth: ["authorization", "Bearer do-key"], + provider: "digitalocean", + }, + { + name: "alibaba", + load: async () => { + const { model } = await import("@opencode/ai/providers/alibaba/embeddings") + return model("text-embedding-v4", { ...shared, apiKey: "dashscope-key", region: "ap-southeast-1" }) + }, + url: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/embeddings", + auth: ["authorization", "Bearer dashscope-key"], + provider: "alibaba", + }, + { + name: "azure", + load: async () => { + const { model } = await import("@opencode/ai/providers/azure/embeddings") + return model("text-embedding-3-small", { ...shared, apiKey: "azure-key", resourceName: "fixture" }) + }, + url: "https://fixture.openai.azure.com/openai/v1/embeddings?api-version=v1", + auth: ["api-key", "azure-key"], + headers: { authorization: null }, + provider: "azure", + }, + { + name: "google", + load: async () => { + const { model } = await import("@opencode/ai/providers/google/embeddings") + return model("gemini-embedding-001", { ...shared, apiKey: "google-key" }) + }, + url: "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:batchEmbedContents", + modelInURL: true, + auth: ["x-goog-api-key", "google-key"], + provider: "google", + }, + { + name: "google-vertex", + load: async () => { + const { model } = await import("@opencode/ai/providers/google-vertex/embeddings") + return model("text-embedding-005", { ...shared, apiKey: "vertex-key" }) + }, + url: "https://aiplatform.googleapis.com/v1/publishers/google/models/text-embedding-005:predict", + modelInURL: true, + auth: ["x-goog-api-key", "vertex-key"], + provider: "google-vertex", + }, +] + describe("image entrypoints", () => { for (const entry of images) it.effect(`providers/${entry.name}/images sends a configured request`, () => @@ -322,3 +490,13 @@ describe("decision entrypoints", () => { }), ) }) + +describe("embedding entrypoints", () => { + for (const entry of embeddings) + it.effect(`providers/${entry.name}/embeddings sends a configured request`, () => + Effect.gen(function* () { + const model = yield* Effect.promise(entry.load) + expectRequest(yield* sentEmbedding(model), model, entry) + }), + ) +}) diff --git a/packages/ai/test/provider/meta-capabilities.test.ts b/packages/ai/test/provider/meta-capabilities.test.ts index de37f90be5..878537bbee 100644 --- a/packages/ai/test/provider/meta-capabilities.test.ts +++ b/packages/ai/test/provider/meta-capabilities.test.ts @@ -88,8 +88,8 @@ it.effect("Meta Images preserves request overlays, bearer auth, JSON edit inputs }, http: { body: { output_format: "jpeg", future_option: true }, query: { trace: "1" } }, }) - expect(response.image.mediaType).toBe("image/jpeg") - expect(response.image.source).toEqual({ + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(response.images[0].source).toEqual({ type: "url", url: "https://images.example/result.jpg", mediaType: "image/jpeg", diff --git a/packages/ai/test/provider/meta-images.recorded.test.ts b/packages/ai/test/provider/meta-images.recorded.test.ts index b4c6731d80..5fc09f59fe 100644 --- a/packages/ai/test/provider/meta-images.recorded.test.ts +++ b/packages/ai/test/provider/meta-images.recorded.test.ts @@ -32,8 +32,8 @@ recorded.effect.with( providerOptions: { ...controls, size: "256x256" }, }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toBe("image/webp") - const bytes = yield* response.image.bytes() + expect(response.images[0].mediaType).toBe("image/webp") + const bytes = yield* response.images[0].bytes() expect(new TextDecoder().decode(bytes.slice(0, 4))).toBe("RIFF") expect(new TextDecoder().decode(bytes.slice(8, 12))).toBe("WEBP") expect(response.usage?.type === "tokens" ? response.usage.output : undefined).toBeGreaterThan(0) @@ -58,8 +58,8 @@ recorded.effect.with( n: 1, providerOptions: { ...controls, size: "256x256", outputFormat: "png" }, }) - expect(response.image.mediaType).toBe("image/png") - expect(Array.from((yield* response.image.bytes()).slice(0, 8))).toEqual([137, 80, 78, 71, 13, 10, 26, 10]) + expect(response.images[0].mediaType).toBe("image/png") + expect(Array.from((yield* response.images[0].bytes()).slice(0, 8))).toEqual([137, 80, 78, 71, 13, 10, 26, 10]) }), 180_000, ) diff --git a/packages/ai/test/provider/meta.test.ts b/packages/ai/test/provider/meta.test.ts index 743bc8a56a..fb8b118894 100644 --- a/packages/ai/test/provider/meta.test.ts +++ b/packages/ai/test/provider/meta.test.ts @@ -90,8 +90,8 @@ it.effect("Meta package selectors preserve overrides and Chat token policy on cu reasoningEffort: "future-effort", }) expect(model.route.endpoint.baseURL).toBe("https://gateway.example/v1") - expect(model.route.defaults.headers).toEqual({ "x-client": "test" }) - expect(model.route.defaults.http?.body).toEqual({ custom: "value" }) + expect(model.options?.headers).toEqual({ "x-client": "test" }) + expect(model.options?.http?.body).toEqual({ custom: "value" }) const compiled = yield* compileRequest( ai.request({ model, diff --git a/packages/ai/test/provider/minimax-images.recorded.test.ts b/packages/ai/test/provider/minimax-images.recorded.test.ts index a90f5eee59..a46d59df4d 100644 --- a/packages/ai/test/provider/minimax-images.recorded.test.ts +++ b/packages/ai/test/provider/minimax-images.recorded.test.ts @@ -25,8 +25,8 @@ describe("MiniMax Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toMatch(/^image\/(jpeg|png)$/) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 512, height: 512 }) + expect(response.images[0].mediaType).toMatch(/^image\/(jpeg|png)$/) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 512, height: 512 }) expect(response.providerMetadata?.minimax).toBeDefined() }), ) @@ -46,7 +46,7 @@ describe("MiniMax Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 512, height: 512 }) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 512, height: 512 }) }), ) }) diff --git a/packages/ai/test/provider/mistral-chat.test.ts b/packages/ai/test/provider/mistral-chat.test.ts index b20e5c73c6..2bb60059a6 100644 --- a/packages/ai/test/provider/mistral-chat.test.ts +++ b/packages/ai/test/provider/mistral-chat.test.ts @@ -203,7 +203,7 @@ describe("Mistral Chat", () => { const unsupported = yield* compileRequest( ai.request({ - model: LanguageModel.update(model, { compatibility: { supportsPromptCacheKey: false } }), + model: LanguageModel.update(model, { capabilities: { promptCacheKey: false } }), prompt: "Hello", promptCacheKey: "common-key", providerOptions: { promptCacheKey: "native-key" }, diff --git a/packages/ai/test/provider/native-providers.test.ts b/packages/ai/test/provider/native-providers.test.ts index eb4c0bdabd..bbe06b031e 100644 --- a/packages/ai/test/provider/native-providers.test.ts +++ b/packages/ai/test/provider/native-providers.test.ts @@ -83,7 +83,8 @@ describe("native OpenAI-compatible providers", () => { expect(together).toMatchObject({ provider: "togetherai", - compatibility: { maxTokensField: "max_tokens", supportsStrictMode: false }, + compatibility: { maxTokensField: "max_tokens" }, + capabilities: { tools: { strict: false } }, route: { id: "togetherai-chat", protocol: "openai-chat" }, }) expect(together.route.endpoint.baseURL).toBe("https://api.together.xyz/v1") @@ -212,9 +213,9 @@ describe("native OpenAI-compatible providers", () => { }) expect(selected.route.endpoint.baseURL).toBe("https://gateway.example/v1") - expect(selected.route.defaults.headers).toEqual({ "x-application": "opencode" }) - expect(selected.route.defaults.http?.body).toEqual({ service_tier: "priority" }) - expect(selected.route.defaults.providerOptions).toEqual({ reasoningEffort: "high" }) + expect(selected.options?.headers).toEqual({ "x-application": "opencode" }) + expect(selected.options?.http?.body).toEqual({ service_tier: "priority" }) + expect(selected.options?.providerOptions).toEqual({ reasoningEffort: "high" }) } }) diff --git a/packages/ai/test/provider/openai-chat.test.ts b/packages/ai/test/provider/openai-chat.test.ts index b014a05358..c3cadaed4e 100644 --- a/packages/ai/test/provider/openai-chat.test.ts +++ b/packages/ai/test/provider/openai-chat.test.ts @@ -67,7 +67,7 @@ describe("OpenAI Chat route", () => { Effect.gen(function* () { const prepared = yield* compileRequest( ai.request({ - model: LanguageModel.update(model, { compatibility: { streamUsage: false } }), + model: LanguageModel.update(model, { capabilities: { streamUsage: false } }), prompt: "Hello", }), ) @@ -89,7 +89,7 @@ describe("OpenAI Chat route", () => { const optedIn = yield* compileRequest( ai.request({ model: LanguageModel.update(compatible.model("compatible-model"), { - compatibility: { supportsStore: true }, + capabilities: { store: true }, }), prompt: "Hello", }), @@ -378,7 +378,7 @@ describe("OpenAI Chat route", () => { ai.request({ model: OpenAIChat.route .with({ endpoint: { baseURL: "https://api.compatible.test/v1" }, auth: Auth.bearer("test") }) - .model({ id: "compatible-model", compatibility: { supportsPromptCacheKey: true } }), + .model({ id: "compatible-model", capabilities: { promptCacheKey: true } }), prompt: "Hello", promptCacheKey: "session_123", }), @@ -1264,6 +1264,42 @@ describe("OpenAI Chat route", () => { }), ) + it.effect("reads top-level reasoning tokens whether or not completion tokens include them", () => + Effect.gen(function* () { + const generate = (usage: object) => + LLMClient.generate(request).pipe( + Effect.provide(fixedResponse(sseEvents(deltaChunk({ content: "Hi" }, "stop"), usageChunk(usage)))), + Effect.map((response) => response.usage), + ) + + // Copilot's Gemini: total = prompt + completion + reasoning. + expect( + yield* generate({ prompt_tokens: 7, completion_tokens: 2, total_tokens: 62, reasoning_tokens: 53 }), + ).toMatchObject({ outputTokens: 55, reasoningTokens: 53, totalTokens: 62 }) + // Copilot's Kimi: total = prompt + completion, which already includes reasoning. + expect( + yield* generate({ prompt_tokens: 96, completion_tokens: 50, total_tokens: 146, reasoning_tokens: 35 }), + ).toMatchObject({ outputTokens: 50, reasoningTokens: 35, totalTokens: 146 }) + }), + ) + + it.effect("converts the GitHub Copilot billing beside usage to USD", () => + Effect.gen(function* () { + const response = yield* LLMClient.generate(request).pipe( + Effect.provide( + fixedResponse( + sseEvents(deltaChunk({ content: "Hello" }, "stop"), { + ...usageChunk({ prompt_tokens: 5, completion_tokens: 2 }), + copilot_usage: { total_nano_aiu: 4_473_525_000, token_details: [] }, + }), + ), + ), + ) + + expect(response.usage).toMatchObject({ inputTokens: 5, outputTokens: 2, cost: 0.04473525 }) + }), + ) + it.effect("drops a malformed billed cost without failing the stream", () => Effect.gen(function* () { const response = yield* LLMClient.generate(request).pipe( diff --git a/packages/ai/test/provider/openai-compatible-chat.test.ts b/packages/ai/test/provider/openai-compatible-chat.test.ts index bdd5897237..ee29dfbfa5 100644 --- a/packages/ai/test/provider/openai-compatible-chat.test.ts +++ b/packages/ai/test/provider/openai-compatible-chat.test.ts @@ -29,6 +29,11 @@ const request = ai.request({ temperature: 0, }) +const copilot = OpenAICompatibleChat.route + .with({ provider: "github-copilot", endpoint: { baseURL: "https://api.githubcopilot.test" } }) + .model({ id: "gemini-3-pro" }) +const copilotRequest = ai.request({ model: copilot, prompt: "Read the project." }) + const deltaChunk = (delta: object, finishReason: string | null = null) => ({ id: "chatcmpl_fixture", choices: [{ delta, finish_reason: finishReason }], @@ -652,6 +657,31 @@ describe("OpenAI-compatible Chat route", () => { }), ) + it.effect("names the content filter that blocked a response", () => + Effect.gen(function* () { + const finish = (choice: object) => + LLMClient.generate(request).pipe( + Effect.provide( + fixedResponse( + sseEvents({ id: "chatcmpl_fixture", choices: [{ finish_reason: "content_filter", ...choice }] }), + ), + ), + Effect.map((response) => response.finishReason), + ) + + expect(yield* finish({ delta: { copilot_annotations: { TextCopyright: [{ id: 1 }] } } })).toMatchObject({ + normalized: "content-filter", + category: "TextCopyright", + }) + expect( + yield* finish({ + delta: {}, + content_filter_results: { hate: { filtered: false }, violence: { filtered: true } }, + }), + ).toMatchObject({ normalized: "content-filter", category: "violence" }) + }), + ) + it.effect("preserves late text and reasoning for replay without changing the finished tool call", () => Effect.gen(function* () { const details = [{ type: "reasoning.encrypted", data: "opaque", id: "late-reasoning" }] @@ -694,6 +724,75 @@ describe("OpenAI-compatible Chat route", () => { }), ) + it.effect("replays the latest reasoning_opaque with the concatenated reasoning text", () => + Effect.gen(function* () { + const response = yield* LLMClient.generate(copilotRequest).pipe( + Effect.provide( + fixedResponse( + sseEvents( + deltaChunk({ reasoning_text: "Read the readme first." }), + deltaChunk({ + reasoning_opaque: "opaque-first", + tool_calls: [{ index: 0, id: "call_first", function: { name: "read", arguments: "{}" } }], + }), + deltaChunk({ reasoning_text: " Then the manifest." }), + deltaChunk({ + reasoning_opaque: "opaque-second", + tool_calls: [{ index: 1, id: "call_second", function: { name: "read", arguments: "{}" } }], + }), + deltaChunk({}, "tool_calls"), + ), + ), + ), + ) + + expect(response.reasoning).toBe("Read the readme first. Then the manifest.") + expect(response.events.filter(LLMEvent.is.reasoningEnd)).toMatchObject([ + { + providerMetadata: { + "github-copilot": { reasoningField: "reasoning_text", reasoningOpaque: "opaque-second" }, + }, + }, + ]) + expect(response.toolCalls.map((call) => call.id)).toEqual(["call_first", "call_second"]) + const replay = yield* compileRequest(ai.request({ model: copilot, messages: [response.message] })) + expect(replay.body.messages[0]).toMatchObject({ + role: "assistant", + content: null, + reasoning_text: "Read the readme first. Then the manifest.", + reasoning_opaque: "opaque-second", + }) + }), + ) + + it.effect("keeps a reasoning_opaque that arrives without reasoning text", () => + Effect.gen(function* () { + const response = yield* LLMClient.generate(copilotRequest).pipe( + Effect.provide( + fixedResponse( + sseEvents( + deltaChunk({ content: "Checking.", reasoning_opaque: "opaque-only" }), + deltaChunk({ tool_calls: [{ index: 0, id: "call_1", function: { name: "read", arguments: "{}" } }] }), + deltaChunk({}, "tool_calls"), + ), + ), + ), + ) + + expect(response.reasoning).toBe("") + expect(response.events.filter(LLMEvent.is.reasoningEnd)).toMatchObject([ + { providerMetadata: { "github-copilot": { reasoningOpaque: "opaque-only" } } }, + ]) + const replay = yield* compileRequest(ai.request({ model: copilot, messages: [response.message] })) + expect(replay.body.messages[0]).toEqual({ + role: "assistant", + content: "Checking.", + tool_calls: [{ id: "call_1", type: "function", function: { name: "read", arguments: "{}" } }], + reasoning_opaque: "opaque-only", + }) + }), + ) + it.effect("rejects tool changes after a terminal chunk", () => Effect.gen(function* () { const error = yield* LLMClient.generate(request).pipe( diff --git a/packages/ai/test/provider/openai-compatible-responses.test.ts b/packages/ai/test/provider/openai-compatible-responses.test.ts index b961e4a024..b05858e101 100644 --- a/packages/ai/test/provider/openai-compatible-responses.test.ts +++ b/packages/ai/test/provider/openai-compatible-responses.test.ts @@ -400,6 +400,98 @@ describe("Open Responses-compatible route", () => { }), ) + it.effect("keeps one item when GitHub Copilot sends a new item id on every event", () => + Effect.gen(function* () { + const model = configure({ apiKey: "test-key", baseURL: "https://api.githubcopilot.test" }).model("gpt-5") + const response = yield* LLMClient.generate(ai.request({ model, prompt: "Say hello." })).pipe( + Effect.provide( + fixedResponse( + sseEvents( + { type: "response.output_item.added", output_index: 0, item: { type: "reasoning", id: "rs-added" } }, + { type: "response.reasoning_summary_part.added", output_index: 0, item_id: "rs-part", summary_index: 0 }, + { + type: "response.reasoning_summary_text.delta", + output_index: 0, + item_id: "rs-delta", + summary_index: 0, + delta: "Thinking", + }, + { + type: "response.output_item.done", + output_index: 0, + item: { type: "reasoning", id: "rs-done", encrypted_content: "opaque", summary: [] }, + }, + { type: "response.output_item.added", output_index: 1, item: { type: "message", id: "msg-added" } }, + { type: "response.output_text.delta", output_index: 1, item_id: "msg-delta", delta: "Hello" }, + { type: "response.output_item.done", output_index: 1, item: { type: "message", id: "msg-done" } }, + { type: "response.completed", response: { id: "resp_1" } }, + ), + ), + ), + ) + + expect(response.events.filter(LLMEvent.is.reasoningStart)).toHaveLength(1) + expect(response.message.content).toMatchObject([ + { + type: "reasoning", + text: "Thinking", + providerMetadata: { + "openai-compatible": { itemId: "rs-added", reasoningEncryptedContent: "opaque" }, + }, + }, + { type: "text", text: "Hello" }, + ]) + }), + ) + + it.effect("names the GitHub Copilot content filter that blocked a response", () => + Effect.gen(function* () { + const model = configure({ apiKey: "test-key", baseURL: "https://api.githubcopilot.test" }).model("gpt-5") + const response = yield* LLMClient.generate(ai.request({ model, prompt: "Say hello." })).pipe( + Effect.provide( + fixedResponse( + sseEvents({ + type: "response.incomplete", + response: { + id: "resp_1", + incomplete_details: { reason: "content_filter" }, + content_filters: [ + { source_type: "prompt", blocked: false }, + { + source_type: "completion", + blocked: true, + content_filter_raw: [{ action: "BLOCK", label: "TextCopyright", result: true }], + }, + ], + }, + }), + ), + ), + ) + + expect(response.finishReason).toMatchObject({ normalized: "content-filter", category: "TextCopyright" }) + }), + ) + + it.effect("converts the GitHub Copilot billing on the completed event to USD", () => + Effect.gen(function* () { + const model = configure({ apiKey: "test-key", baseURL: "https://api.githubcopilot.test" }).model("gpt-5") + const response = yield* LLMClient.generate(ai.request({ model, prompt: "Say hello." })).pipe( + Effect.provide( + fixedResponse( + sseEvents({ + type: "response.completed", + response: { id: "resp_1", usage: { input_tokens: 5, output_tokens: 2, total_tokens: 7 } }, + copilot_usage: { total_nano_aiu: 4_473_525_000 }, + }), + ), + ), + ) + + expect(response.usage).toMatchObject({ inputTokens: 5, outputTokens: 2, cost: 0.04473525 }) + }), + ) + it.effect("ignores bare null frames between events", () => Effect.gen(function* () { const model = configure({ diff --git a/packages/ai/test/provider/openai-images.recorded.test.ts b/packages/ai/test/provider/openai-images.recorded.test.ts index d3e4ffc089..88982f68a5 100644 --- a/packages/ai/test/provider/openai-images.recorded.test.ts +++ b/packages/ai/test/provider/openai-images.recorded.test.ts @@ -27,9 +27,9 @@ describe("OpenAI Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toBe("image/jpeg") - expect(response.image.info).toEqual({ format: "jpeg", width: 1024, height: 1024 }) - expect((yield* response.image.bytes()).length).toBeGreaterThan(0) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(response.images[0].info).toEqual({ format: "jpeg", width: 1024, height: 1024 }) + expect((yield* response.images[0].bytes()).length).toBeGreaterThan(0) expect(response.providerMetadata).toEqual({ openai: { outputFormat: "jpeg", size: "1024x1024", quality: "low", background: "opaque" }, }) @@ -57,8 +57,8 @@ describe("OpenAI Images recorded", () => { providerOptions: { size: "1024x1024", outputFormat: "jpeg", quality: "low", outputCompression: 10 }, }) - expect(response.image.mediaType).toBe("image/jpeg") - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1024, height: 1024 }) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1024, height: 1024 }) }), ) diff --git a/packages/ai/test/provider/openai-responses.test.ts b/packages/ai/test/provider/openai-responses.test.ts index 9de3ab1a81..f7dcb5af59 100644 --- a/packages/ai/test/provider/openai-responses.test.ts +++ b/packages/ai/test/provider/openai-responses.test.ts @@ -2229,18 +2229,18 @@ describe("OpenAI Responses route", () => { }), ) - it.effect("omits the prompt cache key when compatibility disables it", () => + it.effect("omits the prompt cache key when capabilities disable it", () => Effect.gen(function* () { const prepared = yield* compileRequest( ai.request({ - model: LanguageModel.update(model, { compatibility: { supportsPromptCacheKey: false } }), + model: LanguageModel.update(model, { capabilities: { promptCacheKey: false } }), prompt: "Hello", promptCacheKey: "request_cache", }), ) expect(prepared.body).not.toHaveProperty("prompt_cache_key") - expect(model.compatibility?.supportsPromptCacheKey).toBeUndefined() + expect(model.capabilities?.promptCacheKey).toBeUndefined() expect( (yield* compileRequest(ai.request({ model, prompt: "Hello", promptCacheKey: "request_cache" }))).body, ).toHaveProperty("prompt_cache_key", "request_cache") diff --git a/packages/ai/test/provider/openrouter-images.recorded.test.ts b/packages/ai/test/provider/openrouter-images.recorded.test.ts index 383c53b54a..ae95337b14 100644 --- a/packages/ai/test/provider/openrouter-images.recorded.test.ts +++ b/packages/ai/test/provider/openrouter-images.recorded.test.ts @@ -28,7 +28,7 @@ describe("OpenRouter Images recorded", () => { resolution: "2K", }) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 2752, height: 1536 }) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 2752, height: 1536 }) }), { timeout: 120_000 }, ) @@ -44,7 +44,7 @@ describe("OpenRouter Images recorded", () => { resolution: "1K", }) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1360, height: 768 }) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1360, height: 768 }) }), { timeout: 120_000 }, ) @@ -68,8 +68,8 @@ describe("OpenRouter Images recorded", () => { providerOptions: { outputFormat: "jpeg", quality: "low", outputCompression: 10 }, }) - expect(response.image.mediaType).toBe("image/jpeg") - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1024, height: 1024 }) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1024, height: 1024 }) }), { timeout: 120_000 }, ) diff --git a/packages/ai/test/provider/vercel-ai-gateway-images.recorded.test.ts b/packages/ai/test/provider/vercel-ai-gateway-images.recorded.test.ts index d135fea444..4a71624cde 100644 --- a/packages/ai/test/provider/vercel-ai-gateway-images.recorded.test.ts +++ b/packages/ai/test/provider/vercel-ai-gateway-images.recorded.test.ts @@ -26,8 +26,8 @@ describe("Vercel AI Gateway Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toBe("image/webp") - expect(new TextDecoder().decode((yield* response.image.bytes()).subarray(8, 12))).toBe("WEBP") + expect(response.images[0].mediaType).toBe("image/webp") + expect(new TextDecoder().decode((yield* response.images[0].bytes()).subarray(8, 12))).toBe("WEBP") expect(model.provider).toBe("vercel-ai-gateway") expect(response.usage?.details).toHaveProperty("vercel-ai-gateway") expect(response.providerMetadata).toHaveProperty("vercel-ai-gateway") @@ -48,7 +48,7 @@ describe("Vercel AI Gateway Images recorded", () => { resolution: "1K", }) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1280, height: 720 }) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1280, height: 720 }) }), { timeout: 120_000 }, ) diff --git a/packages/ai/test/provider/xai-images.recorded.test.ts b/packages/ai/test/provider/xai-images.recorded.test.ts index 0a9cf6960a..7b7b1b7197 100644 --- a/packages/ai/test/provider/xai-images.recorded.test.ts +++ b/packages/ai/test/provider/xai-images.recorded.test.ts @@ -27,8 +27,8 @@ describe("xAI Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType.startsWith("image/")).toBe(true) - expect((yield* response.image.bytes()).length).toBeGreaterThan(0) + expect(response.images[0].mediaType.startsWith("image/")).toBe(true) + expect((yield* response.images[0].bytes()).length).toBeGreaterThan(0) }), ) @@ -47,8 +47,8 @@ describe("xAI Images recorded", () => { resolution: "1K", }) - expect(response.image.mediaType).toMatch(/^image\/(jpeg|png)$/) - expect(dimensions(yield* response.image.bytes())).toEqual({ width: 1024, height: 1024 }) + expect(response.images[0].mediaType).toMatch(/^image\/(jpeg|png)$/) + expect(dimensions(yield* response.images[0].bytes())).toEqual({ width: 1024, height: 1024 }) }), ) }) diff --git a/packages/ai/test/provider/xai-images.test.ts b/packages/ai/test/provider/xai-images.test.ts index 1f142f8151..2faf2c3002 100644 --- a/packages/ai/test/provider/xai-images.test.ts +++ b/packages/ai/test/provider/xai-images.test.ts @@ -32,8 +32,8 @@ describe("xAI Images", () => { }) expect(response.images).toHaveLength(2) - expect(response.image.mediaType).toBe("image/jpeg") - expect(yield* response.image.bytes()).toEqual(Uint8Array.from([1, 2, 3])) + expect(response.images[0].mediaType).toBe("image/jpeg") + expect(yield* response.images[0].bytes()).toEqual(Uint8Array.from([1, 2, 3])) expect(response.images[1].mediaType).toBe("application/octet-stream") expect(response.images[1].source).toEqual({ type: "url", url: "https://api.xai.test/image.jpg" }) expect(response.usage).toBeUndefined() diff --git a/packages/ai/test/provider/zai-images.recorded.test.ts b/packages/ai/test/provider/zai-images.recorded.test.ts index 764501e79a..6255d6bcb3 100644 --- a/packages/ai/test/provider/zai-images.recorded.test.ts +++ b/packages/ai/test/provider/zai-images.recorded.test.ts @@ -24,9 +24,9 @@ describe("Z.ai Images recorded", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toBe("application/octet-stream") - expect(response.image.source.type).toBe("url") - expect(response.image.source.type === "url" && response.image.source.url).toStartWith("https://") + expect(response.images[0].mediaType).toBe("application/octet-stream") + expect(response.images[0].source.type).toBe("url") + expect(response.images[0].source.type === "url" && response.images[0].source.url).toStartWith("https://") expect(response.providerMetadata?.zai).toBeDefined() }), ) diff --git a/packages/ai/test/provider/zai-images.test.ts b/packages/ai/test/provider/zai-images.test.ts index 19ec33f882..bb3d60f442 100644 --- a/packages/ai/test/provider/zai-images.test.ts +++ b/packages/ai/test/provider/zai-images.test.ts @@ -28,9 +28,9 @@ describe("Z.ai Images", () => { }) expect(response.images).toHaveLength(1) - expect(response.image.mediaType).toBe("application/octet-stream") + expect(response.images[0].mediaType).toBe("application/octet-stream") // Z.ai documents that output URLs expire 30 days after generation; the test clock starts at 0. - expect(response.image.source).toEqual({ + expect(response.images[0].source).toEqual({ type: "url", url: "https://cdn.z.ai/generated.png", expiresAt: 30 * 24 * 60 * 60 * 1000, diff --git a/packages/ai/test/recorded-test.ts b/packages/ai/test/recorded-test.ts index 2954322dac..8795ca21df 100644 --- a/packages/ai/test/recorded-test.ts +++ b/packages/ai/test/recorded-test.ts @@ -11,6 +11,8 @@ import { SpeechClient } from "../src/speech-client.js" import { TranscriptionClient } from "../src/transcription-client.js" import { DecisionClient } from "../src/decision-client.js" import type { Service as DecisionClientService } from "../src/decision-client.js" +import { EmbeddingClient } from "../src/embedding-client.js" +import type { Service as EmbeddingClientService } from "../src/embedding-client.js" import type { Service as ImageClientService } from "../src/image-client.js" import type { Service as VideoClientService } from "../src/video-client.js" import type { Service as SpeechClientService } from "../src/speech-client.js" @@ -34,6 +36,7 @@ type RecordedEnv = | SpeechClientService | TranscriptionClientService | DecisionClientService + | EmbeddingClientService | Socket.WebSocketConstructor type RecordedTestsOptions = RecordedGroupOptions & { @@ -109,6 +112,7 @@ export const recordedTests = (options: RecordedTestsOptions) => SpeechClient.layer.pipe(Layer.provide(requestExecutor)), TranscriptionClient.layer.pipe(Layer.provide(requestExecutor)), DecisionClient.layer.pipe(Layer.provide(requestExecutor)), + EmbeddingClient.layer.pipe(Layer.provide(requestExecutor)), webSocket, ) if (!recording) return layer diff --git a/packages/ai/test/route.test.ts b/packages/ai/test/route.test.ts index ca3fd1ce74..e3b9231222 100644 --- a/packages/ai/test/route.test.ts +++ b/packages/ai/test/route.test.ts @@ -35,7 +35,7 @@ describe("Route.with", () => { path: "/chat/completions", query: { keep: "patch", base: "1", patch: "1" }, }) - expect(route.defaults.headers).toEqual({ + expect(route.options?.headers).toEqual({ "x-base": "base", "x-override": "patch", "x-patch": "patch", @@ -48,7 +48,7 @@ describe("Route.with", () => { expect(route.providerMetadataKey).toBe("azure") expect(overridden.providerMetadataKey).toBe("custom-azure") - expect(overridden.defaults).not.toHaveProperty("providerMetadataKey") + expect(overridden.options).not.toHaveProperty("providerMetadataKey") }) }) diff --git a/packages/app/README.md b/packages/app/README.md index 90951727d6..32f8139af1 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -69,24 +69,13 @@ Environment options: - `PLAYWRIGHT_PORT` (managed dev or static server port, default: `3000`) - `PLAYWRIGHT_BASE_URL` (use an externally managed app instead of starting a server; otherwise defaults to `http://127.0.0.1:`) -## Deployment - -The `deploy` GitHub Actions workflow uses SST to deploy the web app to `beta.opencode.ai` on every push to the -`beta` branch in `anomalyco/opencode`. The `dev` and `production` stages do not deploy the web app. - -`beta` is the team's dogfooding branch: `dev` merged in by hand, plus commits pushed directly to it. Do not rebase or -force-push it. Each push also runs the `release` workflow, which ships the same commit as the OpenCode Beta desktop app -(see `packages/desktop/README.md`). - -The beta SST stage deploys only the web app, using the `WebApp` StaticSiteV2 definition in `infra/webapp.ts`. It sets -the build channel and Sentry environment to `beta` without deploying the API, console, database, or billing -infrastructure. +## Server mode `VITE_OPENCODE_SERVER_MODE` controls which server the web build provides at startup: | Mode | Initial server | | ------------------ | ------------------------------------------------------------------------------------ | -| `none` | No initial server. The beta deployment uses this mode. | +| `none` | No initial server. | | `origin` (default) | The current page's origin. CLI builds explicitly use this mode for `opencode serve`. | In Vite development mode, `origin` uses `VITE_OPENCODE_SERVER_HOST` / `VITE_OPENCODE_SERVER_PORT` @@ -116,11 +105,3 @@ HTTPS-to-HTTP error instead of the generic connection failure. HTTP servers on ` browser local-network permissions can allow some HTTP LAN connections. QR scanning is enabled only in a browser-reported secure context with camera support and an available video input; insecure pages and unavailable cameras show an explanation beside the disabled action. - -The workflow reuses the repository's `CLOUDFLARE_API_TOKEN` and web Sentry settings. The Cloudflare token -must cover SST's R2 state storage, KV assets, Workers, and custom-domain management in the account that -owns `opencode.ai`. The beta GitHub environment must allow deployments from the `beta` branch; it does not -need AWS credentials. - -SST manages the beta site's custom domain. The first deployment creates its DNS record and TLS certificate. -Do not create a CNAME for `beta.opencode.ai` first, because it would conflict with the Workers custom domain. diff --git a/packages/app/component-tests/browser-pane.spec.ts b/packages/app/component-tests/browser-pane.spec.ts index bd0b3496a9..9c6a3376c5 100644 --- a/packages/app/component-tests/browser-pane.spec.ts +++ b/packages/app/component-tests/browser-pane.spec.ts @@ -641,6 +641,14 @@ story("keeps the submitted URL visible until the browser reports navigation", as await expect(address).toHaveValue("https://example.com/") await expect(root.getByText("Open a page", { exact: true })).toBeHidden() + // Focusing and leaving the field before the browser reports keeps the submitted address. + await address.focus() + await expect(address).toHaveValue("https://example.com/") + await address.press("Escape") + await expect(address).not.toBeFocused() + await expect(address).toHaveValue("https://example.com/") + await expect(root.getByText("Open a page", { exact: true })).toBeHidden() + await root.getByRole("button", { name: "Complete navigation", exact: true }).click() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") await expect(address).toHaveValue("https://example.com/") diff --git a/packages/app/component-tests/composer.spec.ts b/packages/app/component-tests/composer.spec.ts index d40c189691..974cd78249 100644 --- a/packages/app/component-tests/composer.spec.ts +++ b/packages/app/component-tests/composer.spec.ts @@ -38,7 +38,9 @@ story("cycles full prompts with plain arrows without opening the picker", async await input.press("ArrowUp") await input.press("ArrowUp") await expect(input).toHaveText("Review the composer layout\nKeep keyboard navigation accessible") - await input.fill("") + // A history step places the caret a frame later. Keys flush it first; a fill's direct selection would lose to it. + await input.press("ControlOrMeta+a") + await input.press("Delete") await input.press("ArrowUp") await expect(input).toHaveText("Explain the latest changes") await expect(component.getByRole("img", { name: "layout.png", exact: true })).toHaveCount(0) @@ -60,7 +62,8 @@ story("cycles full prompts with plain arrows without opening the picker", async await input.press("ArrowUp") await expect(input).toHaveText("R!eview the composer layout\nKeep keyboard navigation accessible") - await input.fill("") + await input.press("ControlOrMeta+a") + await input.press("Delete") await input.press("ArrowUp") await expect(input).toHaveText("Explain the latest changes") await input.press("Enter") @@ -70,7 +73,8 @@ story("cycles full prompts with plain arrows without opening the picker", async await expect(input).toHaveText("Explain the latest changes") await expect(options).toHaveCount(0) - await input.fill("!") + await input.press("ControlOrMeta+a") + await input.press("!") await expect(input).toBeEmpty() await input.press("ArrowUp") await expect(input).toHaveText("bun typecheck") @@ -191,6 +195,30 @@ story( await expect(composer).toHaveCSS("height", `${restoredHeight}px`) await expect(component.getByRole("img", { name: "layout.png", exact: true })).toBeVisible() await expect(component.getByText("Keep the search separate from the draft", { exact: true })).toBeVisible() + + // A click elsewhere cancels the preview too; it used to leave the previewed prompt in place of the draft. + await input.press("Shift+ArrowUp") + await expect(input).toHaveText("Explain the latest changes") + await page.mouse.click(1, 1) + await expect(options).toHaveCount(0) + await expect(input).toBeEmpty() + await expect(component.getByRole("img", { name: "layout.png", exact: true })).toBeVisible() + await expect(component.getByText("Keep the search separate from the draft", { exact: true })).toBeVisible() + + // A click into the draft keeps the previewed prompt to edit. + await input.press("Shift+ArrowUp") + await expect(search).toBeFocused() + await input.click() + await expect(options).toHaveCount(0) + await expect(input).toHaveText("Explain the latest changes") + + // Opening the file picker while browsing keeps the way back to the draft; it used to end browsing. + await input.fill("") + await input.press("ArrowUp") + await expect(input).toHaveText("Explain the latest changes") + await input.press("ControlOrMeta+u") + await input.press("ArrowDown") + await expect(input).toBeEmpty() }, ) @@ -412,6 +440,9 @@ for (const direction of ["ltr", "rtl"]) { await expect(add).toBeInViewport() await add.click() await expect(page.getByRole("menuitem", { name: "Images and files" })).toBeVisible() + // The menu takes focus a task after it opens. Closed before that, it returns focus to the trigger later still, + // taking it from the prompt this test fills next. + await expect(page.getByRole("menu")).toBeFocused() await page.keyboard.press("Escape") await expect(add).toBeFocused() expect(await add.boundingBox()).toEqual(fixedAdd) @@ -458,6 +489,8 @@ story("keeps toolbar focus rings whole and keyboard-only", async ({ mount, page // A menu the pointer opened returns focus to its trigger without a ring, even when Escape closes it. await variant.click() await expect(page.getByRole("menuitemradio", { name: "high", exact: true })).toBeVisible() + // The menu takes focus a task after it opens; an Escape before that rings the trigger, which still holds focus. + await expect(page.getByRole("menu")).toBeFocused() await page.keyboard.press("Escape") await expect(variant).toBeFocused() await expect(variant).toHaveCSS("outline-style", "none") diff --git a/packages/app/component-tests/debug-bar.spec.ts b/packages/app/component-tests/debug-bar.spec.ts index 43ad2b90eb..7afec7b163 100644 --- a/packages/app/component-tests/debug-bar.spec.ts +++ b/packages/app/component-tests/debug-bar.spec.ts @@ -52,6 +52,37 @@ story("the debug bar stays open across a remount until its close button hides it expect(result).toEqual({ opened: true, saved: { visible: false, motion: false }, reopened: false }) }) +story("running memory diagnostics pin the bar without a close button, and its Knobs still open", async ({ page }) => { + const result = await page.evaluate(async (modules) => { + const { mountPlugins, until } = await import(modules.fixture) + const debug = await import(modules.debug) + const definition = { ...debug.default, id: "debug", windowEntry: () => import(modules.renderer) } + const memory = { state: () => ({ on: true, env: false }), set: async () => undefined, on: () => () => {} } + + // The user hid the bar and left the Knobs open before turning diagnostics on. + const host = mountPlugins({ + definitions: [definition], + stored: { "plugin.debug.bar": { visible: false, motion: true } }, + ipc: (token: { readonly id: string }) => (token.id === "debug.memory" ? memory : undefined), + }) + + host.release() + await until(() => host.container.querySelector("aside") !== null) + await until(() => document.querySelector('button[aria-label="Close Knobs"]') !== null) + + const view = { + close: host.container.querySelector('button[aria-label="Hide debug bar"]') !== null, + knobs: document.querySelector('button[aria-label="Close Knobs"]') !== null, + } + + host.unmount() + + return view + }, modules) + + expect(result).toEqual({ close: false, knobs: true }) +}) + story("a feature page's Enabled switch turns that feature on after another feature's page", async ({ page }) => { const result = await page.evaluate( async (modules) => { diff --git a/packages/app/component-tests/dialog-popups.spec.ts b/packages/app/component-tests/dialog-popups.spec.ts new file mode 100644 index 0000000000..0eccc18dad --- /dev/null +++ b/packages/app/component-tests/dialog-popups.spec.ts @@ -0,0 +1,49 @@ +import type { Page } from "@playwright/test" +import { expect, story } from "../../stories/playwright/story" + +// Role queries skip aria-hidden content, so each popup is only found if assistive tech can reach it too. A modal dialog +// hides content added outside it a task and a frame after it mounts, so each check waits that long before looking. +const settled = (page: Page) => + page.evaluate( + () => new Promise((resolve) => setTimeout(() => requestAnimationFrame(() => requestAnimationFrame(resolve)))), + ) + +story.beforeEach(async ({ mount, page }) => { + await mount("ui-dialog--with-popups") + await expect(page.getByRole("dialog", { name: "Popups" })).toBeVisible() +}) + +story("a select opened from a dialog lists its options", async ({ page }) => { + const trigger = page.getByRole("dialog").locator('[data-component="select-v2"]') + await trigger.click() + await expect(page.locator('[data-slot="select-v2-listbox"]')).toBeVisible() + await settled(page) + await expect(page.getByRole("option")).toHaveCount(3) + await page.getByRole("option", { name: "Banana" }).click() + await expect(trigger).toContainText("Banana") +}) + +story("a non-modal menu and its submenu opened from a dialog list their items", async ({ page }) => { + await page.getByRole("dialog").getByRole("button", { name: "Actions" }).click() + await expect(page.getByText("Rename", { exact: true })).toBeVisible() + await settled(page) + await expect(page.getByRole("menuitem", { name: "Rename" })).toBeVisible() + await page.getByRole("menuitem", { name: "Move to" }).hover() + await expect(page.getByText("Archive", { exact: true })).toBeVisible() + await settled(page) + await expect(page.getByRole("menuitem", { name: "Archive" })).toBeVisible() +}) + +story("a tooltip opened from a dialog is announced", async ({ page }) => { + await page.getByRole("dialog").getByRole("button", { name: "Copy" }).hover() + await expect(page.getByText("Copy the link")).toBeVisible() + await settled(page) + await expect(page.getByRole("tooltip", { name: "Copy the link" })).toBeVisible() +}) + +story("a toast shown from a dialog is announced", async ({ page }) => { + await page.getByRole("dialog").getByRole("button", { name: "Save" }).click() + await expect(page.getByText("Saved", { exact: true })).toBeVisible() + await settled(page) + await expect(page.getByRole("listitem").filter({ hasText: "Saved" })).toBeVisible() +}) diff --git a/packages/app/component-tests/file-icon.spec.ts b/packages/app/component-tests/file-icon.spec.ts new file mode 100644 index 0000000000..aae0931cea --- /dev/null +++ b/packages/app/component-tests/file-icon.spec.ts @@ -0,0 +1,14 @@ +import { expect, story } from "../../stories/playwright/story" + +story("shows the fallback glyph when an icon chunk fails to load", async ({ mount, page }) => { + await page.route("**/file-types/typescript.svg*", (route) => route.abort()) + const root = await mount("components-file-icon--samples") + + await expect( + root + .locator("div") + .filter({ hasText: /^index\.ts$/ }) + .locator("use"), + ).toHaveAttribute("href", "#file-icon-Document") + await expect(page.locator("#file-icon-sprite > #file-icon-Document")).toHaveCount(1) +}) diff --git a/packages/app/component-tests/focus-ring.spec.ts b/packages/app/component-tests/focus-ring.spec.ts index 4f6cfd3d4e..50027375ca 100644 --- a/packages/app/component-tests/focus-ring.spec.ts +++ b/packages/app/component-tests/focus-ring.spec.ts @@ -6,6 +6,8 @@ story("returns focus to a menu trigger without a ring after a pointer open", asy await trigger.click() await expect(page.getByRole("menuitem", { name: "Save" })).toBeVisible() + // The menu takes focus a task after it opens; an Escape before that rings the trigger, which still holds focus. + await expect(page.getByRole("menu")).toBeFocused() await page.keyboard.press("Escape") await expect(trigger).toBeFocused() await expect(trigger).toHaveCSS("outline-style", "none") @@ -24,6 +26,37 @@ story("keeps the ring on a menu trigger after a keyboard open", async ({ mount, await expect(trigger).toHaveCSS("outline-style", "solid") }) +story("keeps the ring on a menu trigger opened from code after a pointer open", async ({ mount, page }) => { + await mount("ui-menu--programmatic-and-non-modal") + const trigger = page.getByRole("button", { name: "Controlled" }) + + await trigger.click() + await expect(page.getByRole("menuitem", { name: "Rename" })).toBeVisible() + await page.keyboard.press("Escape") + await expect(page.getByRole("menuitem", { name: "Rename" })).toHaveCount(0) + await page.getByRole("button", { name: "Open from code" }).click() + await expect(page.getByRole("menuitem", { name: "Rename" })).toBeVisible() + await page.keyboard.press("Escape") + await expect(trigger).toBeFocused() + await expect(trigger).toHaveCSS("outline-style", "solid") +}) + +story("leaves focus where an outside click put it when a non-modal menu closes", async ({ mount, page }) => { + await mount("ui-menu--programmatic-and-non-modal") + const trigger = page.getByRole("button", { name: "Non-modal" }) + + await trigger.click() + await expect(page.getByRole("menuitem", { name: "Pin" })).toBeVisible() + // Kobalte starts listening for outside presses a task after the menu opens, queued behind the one that focuses it. + await expect(page.getByRole("menu")).toBeFocused() + await page.mouse.click(4, 300) + await expect(page.getByRole("menuitem", { name: "Pin" })).toHaveCount(0) + // The close focus restore has run once the story counts it; the click on empty space left focus on the body. + await expect(page.getByLabel("Non-modal focus restores")).toHaveText("1") + expect(await page.evaluate(() => document.activeElement === document.body)).toBe(true) + await expect(trigger).not.toBeFocused() +}) + story("returns focus to a dialog's trigger without a ring after a pointer open", async ({ mount, page }) => { await mount("ui-dialog--opened-from-button") const trigger = page.getByRole("button", { name: "Choose model" }) diff --git a/packages/app/component-tests/input-surfaces.spec.ts b/packages/app/component-tests/input-surfaces.spec.ts index fa2fde9473..1cce08660c 100644 --- a/packages/app/component-tests/input-surfaces.spec.ts +++ b/packages/app/component-tests/input-surfaces.spec.ts @@ -125,6 +125,32 @@ story("select fields come in the text input sizes and default to the inline trig await expect(fields.nth(3)).toHaveCSS("box-shadow", "none") }) +story( + "a select previews the highlighted option, reverts it on Escape, and keeps the chosen one", + async ({ mount, page }) => { + const root = await mount("ui-select--highlight-preview") + const trigger = root.locator('[data-component="select-v2"]') + const preview = root.locator('[data-slot="select-preview"]') + + await trigger.click() + await page.getByRole("option", { name: "Cherry", exact: true }).hover() + await expect(preview).toHaveText("Showing Cherry") + await page.keyboard.press("Escape") + await expect(page.getByRole("listbox")).toHaveCount(0) + await expect(preview).toHaveText("Showing Apple") + + await trigger.click() + const banana = page.getByRole("option", { name: "Banana", exact: true }) + await banana.hover() + await expect(preview).toHaveText("Showing Banana") + await banana.click() + await expect(page.getByRole("listbox")).toHaveCount(0) + await expect(trigger).toContainText("Banana") + // Choosing the previewed option must not run its undo afterwards. + await expect(preview).toHaveText("Showing Banana") + }, +) + story("compact checkboxes use the design system control states and focus ring", async ({ mount, page }) => { const root = await mount("ui-checkbox--compact") diff --git a/packages/app/component-tests/line-comment.spec.ts b/packages/app/component-tests/line-comment.spec.ts index d8c204d7a0..d7fc85e895 100644 --- a/packages/app/component-tests/line-comment.spec.ts +++ b/packages/app/component-tests/line-comment.spec.ts @@ -44,6 +44,65 @@ story("autosizes compact comments without native field-sizing", async ({ mount, await expect.poll(() => textarea.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(true) }) +story("Enter on a list whose refined search still runs waits instead of picking a stale row", async ({ mount }) => { + const component = await mount("ui-line-comment--editor-with-mentions") + const textarea = component.getByRole("textbox") + const items = component.locator('[data-slot="line-comment-v2-mention-item"]') + // From the keyboard, so the pointer does not rest over the list that opens and highlight a row. + const finish = () => component.getByRole("button", { name: "Finish search", exact: true }).press("Enter") + + await textarea.fill("Check @src") + await finish() + await expect(items).toHaveText(["src/app.ts", "src/api.ts", "src/server.ts"]) + + await textarea.pressSequentially("/a") + await textarea.press("Enter") + await expect(textarea).toHaveValue("Check @src/a") + + await finish() + await expect(items).toHaveText(["src/app.ts", "src/api.ts"]) + await textarea.press("Enter") + await expect(textarea).toHaveValue("Check @src/app.ts ") + await expect(items).toHaveCount(0) +}) + +story("Enter sends at once while a search runs with no list on screen", async ({ mount }) => { + const component = await mount("ui-line-comment--editor-with-mentions") + const textarea = component.getByRole("textbox") + + await textarea.fill("Mail a@b.com") + await textarea.press("Enter") + await expect(component.getByRole("status", { name: "Editor result" })).toHaveText("Submitted: Mail a@b.com") +}) + +story("Escape after a bare @ cancels the comment", async ({ mount }) => { + const component = await mount("ui-line-comment--editor-with-mentions") + const textarea = component.getByRole("textbox") + + await textarea.fill("see @") + await textarea.press("Escape") + await expect(component.getByRole("status", { name: "Editor result" })).toHaveText("Cancelled") +}) + +story( + "Escape in a popover's comment field cancels the comment, and on its buttons closes the popover", + async ({ mount, page }) => { + const component = await mount("ui-line-comment--editor-in-popover") + const popover = component.locator('[data-component="popover-content"]') + const textarea = popover.getByRole("textbox") + + await component.getByRole("button", { name: "Open editor", exact: true }).click() + await textarea.fill("Keep this") + await textarea.press("Escape") + await expect(component.getByRole("status", { name: "Editor result" })).toHaveText("Cancelled") + await expect(popover).toBeVisible() + + await popover.getByRole("button", { name: "Cancel", exact: true }).focus() + await page.keyboard.press("Escape") + await expect(popover).toHaveCount(0) + }, +) + story("completes compact optional comments with or without text", async ({ mount }) => { const component = await mount("ui-line-comment--editor", { args: { variant: "compact", allowEmpty: true } }) const action = component.getByRole("button", { name: "Comment", exact: true }) diff --git a/packages/app/component-tests/list.spec.ts b/packages/app/component-tests/list.spec.ts new file mode 100644 index 0000000000..dd8123ab78 --- /dev/null +++ b/packages/app/component-tests/list.spec.ts @@ -0,0 +1,7 @@ +import { expect, story } from "../../stories/playwright/story" + +story("reports a rejected async load instead of no results", async ({ mount }) => { + const root = await mount("components-list--load-failed") + + await expect(root.locator('[data-slot="list-message"]')).toHaveText("Failed to load results") +}) diff --git a/packages/app/component-tests/pairing.spec.ts b/packages/app/component-tests/pairing.spec.ts new file mode 100644 index 0000000000..6123a64521 --- /dev/null +++ b/packages/app/component-tests/pairing.spec.ts @@ -0,0 +1,26 @@ +import { expect, story } from "../../stories/playwright/story" + +story("a Keep screen active read that fails offers Try again and keeps the switch enabled", async ({ mount, page }) => { + // The page reads three more times, 1, 2 and 4 seconds apart, before it shows the failure. + await page.clock.install() + const component = await mount("plugins-pairing--screen-setting-fails") + const toggle = component.getByRole("switch", { name: "Keep screen active", exact: true }) + const error = component.getByRole("alert").filter({ hasText: "Could not update the screen activity setting." }) + const retry = component.getByRole("button", { name: "Try again", exact: true }) + + await expect(toggle).toBeDisabled() + await page.clock.runFor(8_000) + await expect(error).toBeVisible() + await expect(toggle).toBeEnabled() + await expect(toggle).not.toBeChecked() + + await retry.click() + await expect(error).toHaveCount(0) + await expect(retry).toHaveCount(0) + await expect(toggle).toBeEnabled() + + await toggle.focus() + await toggle.press("Space") + await expect(toggle).toBeChecked() + await expect(toggle).toBeEnabled() +}) diff --git a/packages/app/component-tests/plugin-host.fixture.tsx b/packages/app/component-tests/plugin-host.fixture.tsx index e54ccb7758..6379e61a78 100644 --- a/packages/app/component-tests/plugin-host.fixture.tsx +++ b/packages/app/component-tests/plugin-host.fixture.tsx @@ -495,6 +495,7 @@ export function mountPanelWidths(input: { definitions: readonly Entry[]; active: setActive: (key) => key && setActive(key), close() {}, remap() {}, + target() {}, }), closed: createClosedTabs(), open() {}, @@ -615,6 +616,7 @@ export function mountSessionRegion(input: { setActive() {}, close() {}, remap() {}, + target() {}, }), closed: createClosedTabs(), open() {}, diff --git a/packages/app/component-tests/session-question-dock.spec.ts b/packages/app/component-tests/session-question-dock.spec.ts index ec457e265f..0baa97d51e 100644 --- a/packages/app/component-tests/session-question-dock.spec.ts +++ b/packages/app/component-tests/session-question-dock.spec.ts @@ -1009,12 +1009,13 @@ story.describe("with the new question UI experiment enabled", () => { expect(values.slice(1).every((value, i) => way * (value - values[i]!) >= -0.01)).toBe(true) } - story("fades Back in and out and turns Next into Submit with the switch", async ({ mount }) => { + story("fades Back in and out and turns Next into Submit with the switch", async ({ mount, page }) => { const component = await mount("session-question-switch--question-series") const question = component.locator('[data-component="dock-prompt"][data-kind="question"]') const back = question.locator('[data-slot="question-footer-back"]') await expect(question.getByRole("radio").first()).toBeFocused() await expect(question.getByRole("button", { name: "Back", exact: true })).toHaveCount(0) + await page.evaluate(() => document.fonts.ready.then(() => undefined)) // Going on from the first question, Back comes in and can be clicked at once, while Next stays where it is. const nextBox = await question.getByRole("button", { name: "Next", exact: true }).boundingBox() diff --git a/packages/app/component-tests/timeline-virtualizer.fixture.tsx b/packages/app/component-tests/timeline-virtualizer.fixture.tsx index 460a681d10..fb6d15e9c4 100644 --- a/packages/app/component-tests/timeline-virtualizer.fixture.tsx +++ b/packages/app/component-tests/timeline-virtualizer.fixture.tsx @@ -99,7 +99,7 @@ export function mountTimelineVirtualizer(input: { }) return ( -
+
@@ -127,6 +127,15 @@ export function mountTimelineVirtualizer(input: { + {/* A tool inside a group of several, which names them all on the group, as a reveal anchors it. */} +
{row().userMessageID}
diff --git a/packages/app/component-tests/timeline-virtualizer.spec.ts b/packages/app/component-tests/timeline-virtualizer.spec.ts index d2d71c1250..af213ad5a2 100644 --- a/packages/app/component-tests/timeline-virtualizer.spec.ts +++ b/packages/app/component-tests/timeline-virtualizer.spec.ts @@ -147,6 +147,27 @@ story("leaves a reader who scrolled up in place after a scroll to the zoomed end expect(await distance()).toBeGreaterThan(70) }) +story("holds a revealed tool inside a group of several through a later resize", async ({ page }) => { + // The anchor looked only for an element naming the tool alone, so a grouped tool let go on the next resize. + await page.evaluate(async (fixture) => { + const { mountTimelineVirtualizer } = await import(fixture) + mountTimelineVirtualizer({ count: 40, rowHeight: 60, immediate: true }) + }, fixture) + const root = page.getByTestId("timeline-virtualizer-fixture") + const controls = root.getByTestId("timeline-controls") + await root.getByRole("button", { name: "Complete Markdown", exact: true }).click() + await expect(root.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible") + await expect(controls).toHaveAttribute("data-pinned", "true") + + await root.getByRole("button", { name: "Anchor first row", exact: true }).click() + await expect(root.locator('[data-timeline-part-ids="prt_first,prt_grouped"]')).toBeAttached() + await root.getByRole("button", { name: "Grow last row", exact: true }).click() + + const viewport = root.locator("[data-scrollable]") + await expect.poll(() => viewport.evaluate((element) => element.scrollTop)).toBe(0) + await expect(controls).toHaveAttribute("data-anchored", "true") +}) + for (const input of [ { name: "offset-only", count: 1, rowHeight: 600, reveal: { scrollTop: 0 } }, { name: "zero-height", count: 4, rowHeight: 60, reveal: {} }, diff --git a/packages/app/e2e/regression/btw-sidebar.spec.ts b/packages/app/e2e/regression/btw-sidebar.spec.ts index 9fab346331..6ae47c9a64 100644 --- a/packages/app/e2e/regression/btw-sidebar.spec.ts +++ b/packages/app/e2e/regression/btw-sidebar.spec.ts @@ -225,7 +225,7 @@ test("answers /btw in the side panel without admitting a prompt", async ({ page await expect(panel.getByText("exponential backoff", { exact: false })).toBeVisible() await expect(panel.getByText("const delay = 2 ** attempt", { exact: true })).toBeVisible() await expect(panel.getByRole("button", { name: "Copy message", exact: true })).toHaveCount(1) - await expect(panel.getByRole("button", { name: "Rewind to here", exact: true })).toHaveCount(0) + await expect(panel.getByRole("button", { name: "Revert to here", exact: true })).toHaveCount(0) await expect(panel.getByRole("button", { name: "Copy answer", exact: true })).toHaveCount(1) await expect(panel.locator('[data-slot="text-part-meta"]')).toContainText(/\d+s/) await panel.locator('[data-component="user-message"]').hover() diff --git a/packages/app/e2e/regression/command-palette.spec.ts b/packages/app/e2e/regression/command-palette.spec.ts index 4b21742d6e..cb4c86c624 100644 --- a/packages/app/e2e/regression/command-palette.spec.ts +++ b/packages/app/e2e/regression/command-palette.spec.ts @@ -132,6 +132,54 @@ 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 asks for one bounded result set after a pause in typing", async ({ page }) => { + await openPaletteWorkspace(page, true) + const searches: URL[] = [] + page.on("request", (request) => { + const url = new URL(request.url()) + + if (request.method() !== "GET" || url.pathname !== "/api/session") return + + if (!url.searchParams.get("search")) return + + searches.push(url) + }) + await page.getByRole("banner").getByRole("button", { name: "Search sessions", exact: true }).click() + const dialog = page.getByRole("dialog") + const input = dialog.getByRole("combobox") + await expect(dialog.getByRole("option", { name: /Palette fixture session/ })).toHaveAttribute("aria-selected", "true") + + const searched = page.waitForRequest((request) => { + const url = new URL(request.url()) + + return ( + request.method() === "GET" && + url.pathname === "/api/session" && + url.searchParams.get("search") === "Palette fixture" + ) + }) + + // A burst of input in one task is one pause: every keystroke must supersede the last, and only the pause searches. + await input.evaluate((element) => { + // SAFETY: the dialog's combobox is SearchList's own text input, which is an HTMLInputElement. + const field = element as HTMLInputElement + const value = "Palette fixture" + + for (let index = 1; index <= value.length; index++) { + field.value = value.slice(0, index) + field.dispatchEvent(new InputEvent("input", { bubbles: true })) + } + }) + + const request = new URL((await searched).url()) + await expect(dialog.getByRole("option", { name: /Palette fixture session/ })).toBeVisible() + 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 }) => { await mockRemoteServer(page, { name: "Remote" }) const escape = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") @@ -249,7 +297,7 @@ declare global { } } -test("titlebar search opens recent sessions in the server's order on every open", async ({ page }) => { +test("titlebar search keeps recent order stable across agent steps", async ({ page }) => { const busy = { ...paletteSession, time: { ...paletteSession.time } } const fresh = { @@ -260,7 +308,7 @@ test("titlebar search opens recent sessions in the server's order on every open" } const mock = await openPaletteWorkspace(page, true, [busy, fresh]) - // A step starts after Home loaded its index, so the server now lists the busy session first. + // A step bumps the busy session's time on the server, but only a finished run reorders recent sessions. busy.time.updated = 1700000002000 // SAFETY: a step in a session whose transcript is not open; only its session ID and time matter here. await mock.push([ @@ -280,7 +328,7 @@ test("titlebar search opens recent sessions in the server's order on every open" } as OpenCodeEvent, ]) const home = page.getByRole("region", { name: "Recent sessions" }).getByRole("button", { name: /fixture session/ }) - await expect(home).toHaveText([/Palette fixture session/, /Fresh fixture session/]) + await expect(home).toHaveText([/Fresh fixture session/, /Palette fixture session/]) await page.evaluate(() => { const seen: string[][] = [] @@ -301,7 +349,7 @@ test("titlebar search opens recent sessions in the server's order on every open" const listed = page.waitForResponse((response) => new URL(response.url()).pathname === "/api/session") await page.getByRole("banner").getByRole("button", { name: "Search sessions", exact: true }).click() await listed - await expect(dialog.getByRole("option")).toHaveText([/Palette fixture session/, /Fresh fixture session/]) + await expect(dialog.getByRole("option")).toHaveText([/Fresh fixture session/, /Palette fixture session/]) await dialog.getByRole("combobox").press("Escape") await expect(dialog).toHaveCount(0) } @@ -309,7 +357,7 @@ test("titlebar search opens recent sessions in the server's order on every open" await openAndClose() await openAndClose() - expect(await page.evaluate(() => window.__paletteOrders)).toEqual([[paletteSession.title, fresh.title]]) + expect(await page.evaluate(() => window.__paletteOrders)).toEqual([[fresh.title, paletteSession.title]]) }) const olderSession = { diff --git a/packages/app/e2e/regression/composer.spec.ts b/packages/app/e2e/regression/composer.spec.ts index 8b3d9d8ba9..1a79fc4445 100644 --- a/packages/app/e2e/regression/composer.spec.ts +++ b/packages/app/e2e/regression/composer.spec.ts @@ -32,11 +32,17 @@ test("mention a session by title, send its stable token, and open its own tab", await view.editor.pressSequentially(" mid") await suggestions.getByRole("button", { name: /Auth middleware/ }).click() await expect(view.editor.locator('[data-mention="session"]')).toHaveText("@Auth middleware") + // The mention's context menu copies the ID it stands for; the rest of the editor keeps the native menu. + await view.editor.locator('[data-mention="session"]').click({ button: "right" }) + await page.getByRole("menuitem", { name: "Copy Session ID", exact: true }).click() + await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(target) + await expect(page.getByRole("menu")).toHaveCount(0) + await view.editor.press("End") await view.editor.press("Enter") await expect.poll(() => prompts.length).toBe(1) expect(prompts[0]?.text).toBe(`Compare with @session:${target} `) const message = page.locator('[data-timeline-row="UserMessage"]') - const chip = message.getByRole("button", { name: "Auth middleware", exact: true }) + const chip = message.getByRole("button", { name: "@Auth middleware", exact: true }) await expect(chip).toBeVisible() await chip.click() await expect(page).toHaveURL(new RegExp(`${target}$`)) @@ -115,6 +121,34 @@ test("a bare @ lists sessions, and a multi-word title matches while file search expect(prompts[1]?.text).toBe("@home now") }) +test("closing the @ menu aborts its session search", async ({ page }) => { + const view = await openSession(page, { + name: "SessionMentionAbort", + findFiles: () => [], + sessions: [{ id: "ses_mention_abort_source", title: "Review the plan" }], + seed: { tabs: ["ses_mention_abort_source"] }, + }) + + const suggestions = page.locator('[data-component="composer-suggestions"]') + const search = await holdRoute(page, /\/api\/session\?.*search=auth(&|$)/) + + try { + await view.editor.pressSequentially("@auth") + const request = await search.arrived + + const failed = page.waitForEvent("requestfailed", { + predicate: (candidate) => candidate === request, + timeout: 10_000, + }) + + await view.editor.press("Escape") + await expect(suggestions).toBeHidden() + expect((await failed).failure()?.errorText).toBe("net::ERR_ABORTED") + } finally { + search.release() + } +}) + test("the free usage limit opens the Go dialog once, leaves a readable notice, and restores the prompt", async ({ page, context, @@ -1343,6 +1377,13 @@ test("/reload reloads the server's configuration once and reports it", async ({ await expect(page.locator('[data-suggestion-id="config.reload"]')).toHaveAttribute("data-active", "") await editor.press("Enter") await expect(page.getByText("Reloading configuration…", { exact: true })).toBeVisible() + // A second /reload while the first runs joins it: no second request and no second toast. + await expect(editor).toBeEmpty() + await editor.fill("/reload") + await expect(page.locator('[data-suggestion-id="config.reload"]')).toHaveAttribute("data-active", "") + await editor.press("Enter") + await expect(editor).toBeEmpty() + await expect(page.getByText("Reloading configuration…", { exact: true })).toHaveCount(1) reloaded.resolve() await expect(page.getByText("Configuration reloaded", { exact: true })).toBeVisible() await expect(page.getByText("Reloading configuration…", { exact: true })).toBeHidden() @@ -1474,6 +1515,33 @@ for (const row of [ }) } +test("a sent shell command returns the composer to prompt mode, and ! enters shell mode again", async ({ page }) => { + const { editor } = await openSession(page, { + name: "ShellSend", + sessions: [{ id: "ses_shell_send", title: "Shell send" }], + }) + + const scroll = page.locator('[data-component="composer-scroll"]') + await expect(scroll).toHaveText("Ask anything, / for commands, @ for context…") + await editor.pressSequentially("!") + await expect(scroll).toHaveText("Enter shell command… git status") + await editor.pressSequentially("git status") + + const sent = page.waitForRequest( + (request) => request.method() === "POST" && new URL(request.url()).pathname.endsWith("/ses_shell_send/shell"), + ) + + await editor.press("Enter") + expect((await sent).postDataJSON()).toMatchObject({ command: "git status" }) + await expect(editor).toBeEmpty() + await expect(scroll).toHaveText("Ask anything, / for commands, @ for context…") + await expect(page.getByRole("button", { name: /^Exit/ })).toHaveCount(0) + + // The editor reads the draft's mode, so it agrees with the draft the send reset. + await editor.pressSequentially("!") + await expect(scroll).toHaveText("Enter shell command… git status") +}) + test("marks a Console provider with its workspace only when it is also connected directly", async ({ page }) => { const model = (id: string, name: string) => ({ [id]: { id, name, limit: { context: 200_000 } } }) diff --git a/packages/app/e2e/regression/home.spec.ts b/packages/app/e2e/regression/home.spec.ts index 0e860e0a5a..85734ab509 100644 --- a/packages/app/e2e/regression/home.spec.ts +++ b/packages/app/e2e/regression/home.spec.ts @@ -138,13 +138,19 @@ test("the session context menu renames, exports, and deletes a Home session", as await expect(dialog).toContainText('Delete session "Renamed from Home"?') await expect(dialog.getByRole("button", { name: "Cancel", exact: true })).toBeFocused() - const removed = page.waitForRequest( - (request) => request.method() === "DELETE" && new URL(request.url()).pathname.endsWith(`/${fixture.targetID}`), - ) + const removed = await holdRoute(page, (url) => url.pathname.endsWith(`/session/${fixture.targetID}`), { + method: "DELETE", + }) - await dialog.getByRole("button", { name: "Delete session" }).click() - await removed + // A double click claims one delete: the dialog stays open, with both buttons disabled, until the server answers. + await dialog.getByRole("button", { name: "Delete session" }).dblclick() + await removed.arrived + await expect(dialog.getByRole("button", { name: "Delete session" })).toBeDisabled() + await expect(dialog.getByRole("button", { name: "Cancel", exact: true })).toBeDisabled() + removed.release() + await expect(dialog).toBeHidden() await expect(renamedRow).toBeHidden() + expect(removed.requests).toHaveLength(1) }) test("a failed session list says so and loads again on Try again, instead of showing the empty state", async ({ diff --git a/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts b/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts index be99e560ac..51e5004fc0 100644 --- a/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts +++ b/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts @@ -20,7 +20,16 @@ type Surface = "popover" | "dialog" | "settings" // Extensions page opened (Ctrl+,) from the session. async function open( page: Page, - input: { surface: Surface } & Pick, + input: { surface: Surface } & Pick< + MockServerConfig, + | "mcp" + | "onMcpAction" + | "integrations" + | "onIntegrationOAuth" + | "onIntegrationOAuthStatus" + | "onIntegrationOAuthComplete" + | "mcpResourceFailures" + >, ) { const requests: { path: string; directory: string }[] = [] page.on("request", (request) => { @@ -41,6 +50,9 @@ async function open( onMcpAction: input.onMcpAction, integrations: input.integrations, onIntegrationOAuth: input.onIntegrationOAuth, + onIntegrationOAuthStatus: input.onIntegrationOAuthStatus, + onIntegrationOAuthComplete: input.onIntegrationOAuthComplete, + mcpResourceFailures: input.mcpResourceFailures, }) await page.goto(sessionHref(sessionID)) @@ -57,7 +69,9 @@ async function open( if (input.surface === "dialog") return page.keyboard.press("Control+;") if (input.surface === "settings") { - await page.keyboard.press("Control+,") + // Settings opens with the platform's command key, which the app reads from navigator.platform. + const mac = await page.evaluate(() => /(Mac|iPod|iPhone|iPad)/.test(navigator.platform)) + await page.keyboard.press(mac ? "Meta+," : "Control+,") return panel.getByRole("tab", { name: "Extensions", exact: true }).click() } @@ -467,6 +481,8 @@ test("toggling an MCP from the dialog keeps it highlighted", async ({ page }) => const row = view.panel.getByRole("option").filter({ hasText: "figma-desktop" }) const toggle = row.getByRole("switch", { name: "figma-desktop", exact: true }) + // The dialog focuses its search a task after it opens; keys pressed before then go to the composer behind it. + await expect(view.panel.getByRole("combobox", { name: "Search MCPs", exact: true })).toBeFocused() // From the keyboard, Enter toggles the highlighted server and the highlight stays on it. await page.keyboard.press("ArrowDown") await expect(row).toHaveAttribute("aria-selected", "true") @@ -548,6 +564,74 @@ for (const surface of ["popover", "dialog"] as const) { }) } +for (const surface of ["popover", "dialog"] as const) { + test(`a pasted MCP sign-in from the ${surface} submits once and recovers from a failed refresh`, async ({ + page, + context, + }) => { + const state = { signedIn: false, recovered: false } + const pasted: unknown[] = [] + await context.route("https://auth.example.test/**", (route) => route.fulfill({ body: "Sign in" })) + + const view = await open(page, { + surface, + mcp: () => [ + { + name: "figma-desktop", + integrationID: "figma-oauth", + status: state.signedIn ? { status: "connected" } : { status: "needs_auth", error: "Sign in required" }, + }, + ], + integrations: [{ id: "figma-oauth", name: "Figma", methods: [{ id: "oauth", type: "oauth" }], connections: [] }], + onIntegrationOAuth: () => ({ url: "https://auth.example.test/authorize", paste: true }), + onIntegrationOAuthStatus: () => (state.signedIn ? "complete" : "pending"), + // The server accepts the pasted URL and finishes the sign-in. + onIntegrationOAuthComplete: (input) => { + pasted.push(input.body) + state.signedIn = true + }, + // The MCP lists fail to reload after the sign-in until the user retries. + mcpResourceFailures: () => state.signedIn && !state.recovered, + }) + + const complete = await holdRoute( + page, + /\/api\/integration\/figma-oauth\/connect\/oauth\/[^/?]+\/complete(?:\?|$)/, + { + method: "POST", + }, + ) + + await view.panel.getByRole("button", { name: "Sign in to figma-desktop", exact: true }).click() + const dialog = page.getByRole("dialog", { name: "Sign in to figma-desktop", exact: true }) + const redirect = dialog.getByRole("textbox", { name: "Redirect URL", exact: true }) + + // The details popover closes behind the dialog and returns focus to its trigger; type once that settled. + if (surface === "popover") await expect(view.panel).toBeHidden() + + await redirect.fill("http://127.0.0.1:19876/callback?code=abc") + + // A second Enter while the paste is in flight does not send it again. + await redirect.press("Enter") + await expect(redirect).toHaveAttribute("readonly", "") + await redirect.press("Enter") + await complete.arrived + complete.release() + + // The sign-in succeeded but the lists did not reload: the dialog offers a retry instead of waiting forever. + const retry = dialog.getByRole("button", { name: "Try again", exact: true }) + await expect(retry).toBeVisible() + await expect(dialog.getByText("Waiting for authorization…", { exact: true })).toHaveCount(0) + await expect(redirect).toHaveCount(0) + + state.recovered = true + await retry.click() + await expect(dialog).toHaveCount(0) + expect(pasted).toEqual([expect.objectContaining({ code: "http://127.0.0.1:19876/callback?code=abc" })]) + expect(complete.requests).toHaveLength(1) + }) +} + for (const surface of ["popover", "dialog"] as const) { test(`long MCP names keep their status and controls visible in the ${surface}`, async ({ page }) => { const names = ["connected", "disabled", "failed", "needs_auth"].map( diff --git a/packages/app/e2e/regression/mobile-model-pickers.spec.ts b/packages/app/e2e/regression/mobile-model-pickers.spec.ts index af63687b06..1ccb5fb693 100644 --- a/packages/app/e2e/regression/mobile-model-pickers.spec.ts +++ b/packages/app/e2e/regression/mobile-model-pickers.spec.ts @@ -212,6 +212,41 @@ test("desktop model button shows only the choose-model hint, not the model detai await expect(tooltip.getByText("Input & Output", { exact: true })).toHaveCount(0) }) +test("model dialog flyout waits after the arrow keys and cools down after it closes", async ({ page }) => { + const { model, dialog } = await openDesktopPicker(page, "ltr") + const flyout = dialog.locator('[data-slot="model-dialog-flyout"]') + const search = dialog.getByRole("combobox", { name: "Search models", exact: true }) + const rowA = dialog.locator('[data-option-key="opencode:mobile-a"]') + const rowB = dialog.locator('[data-option-key="opencode:mobile-b"]') + await model.click() + await expect(search).toBeFocused() + // See "tab preview opens cold" in tabs.spec.ts: pause at a fixed offset from an explicit install time. + const start = Date.now() + await page.clock.install({ time: start }) + await page.clock.pauseAt(start + 10_000) + + // The arrow keys take over before the hover's open delay ends, so its flyout never opens. + await rowA.hover() + await search.press("ArrowDown") + await page.clock.runFor(200) + await expect(rowB).toHaveAttribute("data-active", "") + await expect(flyout).toHaveCount(0) + + await rowB.hover() + await page.clock.runFor(200) + await expect(flyout.getByRole("menuitemradio", { name: "max", exact: true })).toBeVisible() + + // Once the flyout has been closed for a moment, the next row waits for the open delay again. + await page.mouse.move(5, 5) + await expect(flyout).toHaveCount(0) + await page.clock.runFor(400) + await rowA.hover() + await expect(rowA).toHaveAttribute("data-active", "") + await expect(flyout).toHaveCount(0) + await page.clock.runFor(200) + await expect(flyout.getByRole("menuitemradio", { name: "balanced", exact: true })).toBeVisible() +}) + test("model dialog shows a summary and only the default variant for models without variants", async ({ page }) => { const { model, dialog } = await openDesktopPicker(page, "ltr") const flyout = dialog.locator('[data-slot="model-dialog-flyout"]') diff --git a/packages/app/e2e/regression/multi-server.spec.ts b/packages/app/e2e/regression/multi-server.spec.ts index 7703ff343d..9903ec2247 100644 --- a/packages/app/e2e/regression/multi-server.spec.ts +++ b/packages/app/e2e/regression/multi-server.spec.ts @@ -1,5 +1,16 @@ import { expect, test, type Page } from "@playwright/test" -import { REMOTE_SERVER, SERVER, expectPath, project, seed, session, sessionHref, type TabSeed } from "../utils/app" +import { + REMOTE_SERVER, + SERVER, + T0, + expectPath, + holdRoute, + project, + seed, + session, + sessionHref, + type TabSeed, +} from "../utils/app" import { mockServers, type MockServerConfig } from "../utils/mock-server" import { expectSessionTitle } from "../utils/waits" @@ -151,7 +162,9 @@ test("a remote session whose server signed the app out asks to sign in again, th }) await seed(page, { storage: { - "opencode.global.dat:server": { list: [{ type: "http", http: { url: REMOTE_SERVER, password: "old-password" } }] }, + "opencode.global.dat:server": { + list: [{ type: "http", http: { url: REMOTE_SERVER, password: "old-password" } }], + }, }, }) await page.goto(sessionHref(sessionB.id, REMOTE_SERVER)) @@ -176,6 +189,80 @@ test("a remote session whose server signed the app out asks to sign in again, th await expect(signedOut).toHaveCount(0) }) +// The session route waits this long for an uncached session before it calls the server unreachable. +const RESOLUTION_TIMEOUT_MS = 30_000 + +// How often the app checks each server's health. +const SERVER_HEALTH_POLL_MS = 10_000 + +test("a session its server never answers for says the server is unreachable, then opens", async ({ page }) => { + const late = session({ id: "ses_server_a_late", directory: directoryA, title: "Late session" }) + const sessions = [sessionA] + await setup(page, { tabs: [], a: { sessions } }) + const metadata = await holdRoute(page, new RegExp(`/api/session/${late.id}(\\?|$)`), { method: "GET" }) + await page.clock.install() + await page.goto(sessionHref(late.id)) + await metadata.arrived + const unreachable = page.getByText("Can't reach this server", { exact: true }) + await expect(unreachable).toHaveCount(0) + + await page.clock.fastForward(RESOLUTION_TIMEOUT_MS) + await expect(unreachable).toBeVisible() + await expect(page.getByRole("button", { name: "Close Tab", exact: true })).toBeVisible() + + // The request that hung still fills the cache when it answers. + sessions.push(late) + metadata.release() + await expectSessionTitle(page, late.title) + await expect(unreachable).toHaveCount(0) +}) + +// The inbox shows what it has once this long passes, even while a server still has not answered. +const INBOX_SETTLE_TIMEOUT_MS = 10_000 + +test("one server that never answers the inbox index does not hide the other server's sessions", async ({ page }) => { + await setup(page, { tabs: [] }) + await seed(page, { settings: { appearance: { tabLayout: "inbox" } } }) + + const index = await holdRoute(page, new RegExp(`^${REMOTE_SERVER}/api/session\\?(.*&)?order=desc`), { + method: "GET", + }) + + await page.clock.install() + await page.goto("/") + await index.arrived + + const inbox = page.locator('[data-slot="sidebar-inbox"]') + const row = inbox.locator('[data-slot="sidebar-inbox-item"]').filter({ hasText: sessionA.title }) + await expect(inbox).toHaveAttribute("aria-busy", "true") + await expect(row).toHaveCount(0) + + await page.clock.fastForward(INBOX_SETTLE_TIMEOUT_MS) + await expect(inbox).toHaveAttribute("aria-busy", "false") + await expect(row).toBeVisible() +}) + +test("an open session stays visible while its server stops answering", async ({ page }) => { + const late = session({ id: "ses_server_a_late", directory: directoryA, title: "Late session" }) + await setup(page, { tabs: [sessionA.id, late.id], a: { sessions: [sessionA] } }) + await holdRoute(page, new RegExp(`/api/session/${late.id}(\\?|$)`), { method: "GET" }) + await page.clock.install() + await page.goto(sessionHref(sessionA.id)) + await expectSessionTitle(page, sessionA.title) + + await page.route(`${SERVER}/api/info`, (route) => route.fulfill({ status: 503, body: "" })) + await page.clock.fastForward(SERVER_HEALTH_POLL_MS) + const unreachable = page.getByText("Can't reach this server", { exact: true }) + + // An uncached session on the same server proves the app now considers the server down. + await page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(late.id)}"])`).click() + await expect(unreachable).toBeVisible() + + await page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(sessionA.id)}"])`).click() + await expectSessionTitle(page, sessionA.title) + await expect(unreachable).toHaveCount(0) +}) + test("auto-accept responds for an unfocused server session and its child", async ({ page }) => { const view = await setup(page, { tabs: [sessionA.id, { session: sessionB.id, server: REMOTE_SERVER }] }) await page.goto(sessionHref(sessionA.id)) @@ -300,3 +387,137 @@ test("a project's auto-accept choice overrides the default in both directions", await page.getByRole("option", { name: "Use default (On)" }).click() await expect.poll(() => replies).toEqual(["permission-api", "permission-web"]) }) + +test("customized vertical sidebar merges a project across servers and narrows it with the view menu", async ({ + page, +}) => { + // The same repo on two machines shares its project ID, so both servers' sessions share one group. + const shared = (directory: string) => project({ id: "proj_shared", directory, name: "shared" }) + + const local = session({ id: "ses_local_open", directory: directoryA, title: "Local open", projectID: "proj_shared" }) + + const recent = session({ + id: "ses_local_recent", + directory: directoryA, + title: "Local recent", + projectID: "proj_shared", + created: T0 - 60_000, + }) + + const remote = session({ + id: "ses_remote_open", + directory: directoryB, + title: "Remote open", + projectID: "proj_shared", + }) + + const config = (directory: string, sessions: ReturnType[]) => ({ + directory, + project: shared(directory), + provider: { all: [], connected: [], default: {} }, + sessions, + pageMessages: () => ({ items: [] }), + }) + + await mockServers(page, { + [SERVER]: config(directoryA, [local, recent]), + [REMOTE_SERVER]: config(directoryB, [remote]), + }) + await seed(page, { + servers: [REMOTE_SERVER], + tabs: [local.id, { session: remote.id, server: REMOTE_SERVER }], + settings: { appearance: { tabLayout: "vertical" }, general: { sidebarOrganize: "customize" } }, + }) + await page.goto(sessionHref(local.id)) + await expectSessionTitle(page, local.title) + + const sidebar = page.locator('[data-slot="vertical-tabs"]') + + const groups = sidebar.locator("[data-sidebar-group]") + + const titles = sidebar.locator("[data-titlebar-tab-slot] [data-titlebar-tab-title]") + + await expect(groups).toHaveText([/shared$/]) + await expect(titles).toHaveText([local.title, remote.title]) + // Only the tab from the other machine names its server. + await expect(sidebar.locator('[data-slot="tab-label"]')).toHaveCount(1) + await expect(sidebar.getByRole("button", { name: recent.title })).toBeVisible() + + // Collapsing the group that holds the current session keeps only that session below it. + const header = groups.first().locator("button[aria-expanded]") + + await header.click() + await expect(header).toHaveAttribute("aria-expanded", "false") + // Only a collapsed group counts its open tabs. + await expect(groups).toHaveText([/shared\s*2$/]) + await expect(titles).toHaveText([local.title]) + await expect(sidebar.getByRole("button", { name: recent.title })).toHaveCount(0) + await header.click() + await expect(titles).toHaveText([local.title, remote.title]) + + const menu = page.getByRole("menu") + + await page.getByRole("button", { name: "View options" }).click() + + // Moving between submenu triggers swaps the open submenu instead of stacking them. + for (const [name, item] of [ + [/^Group by/, "Server → Project"], + [/^Sort by/, "Attention"], + ] as const) { + const box = await menu.getByRole("menuitem", { name }).boundingBox() + + if (!box) throw new Error(`no ${name} trigger`) + await page.mouse.move(box.x + 40, box.y + box.height / 2, { steps: 12 }) + await expect(menu.last()).toContainText(item) + } + + await expect(menu).toHaveCount(2) + await menu.getByRole("menuitem", { name: /^Group by/ }).click() + await page.getByRole("menuitemradio", { name: "Server → Project" }).click() + await page.keyboard.press("Escape") + await expect(groups).toHaveCount(4) + await expect(sidebar.locator('[data-slot="tab-label"]')).toHaveCount(0) + + // A server filter hides the other server's rows, but never the active tab. + await page.getByRole("button", { name: "View options" }).click() + await page.getByRole("menuitem", { name: /^Server/ }).click() + await page.getByRole("menuitemcheckbox").last().click() + await page.keyboard.press("Escape") + await page.keyboard.press("Escape") + await expect(titles).toHaveText([local.title, remote.title]) + await expect(sidebar.getByRole("button", { name: recent.title })).toHaveCount(0) + await page.getByRole("button", { name: "View options" }).click() + await menu.getByRole("menuitem", { name: "Reset filters" }).click() + await expect(sidebar.getByRole("button", { name: recent.title })).toBeVisible() +}) + +test("deleting a session's tab in the customized sidebar removes it from the list too", async ({ page }) => { + const first = session({ id: "ses_delete_first", directory: directoryA, title: "Delete me" }) + + const second = session({ id: "ses_delete_second", directory: directoryA, title: "Keep me" }) + + await mockServers(page, { + [SERVER]: { + directory: directoryA, + project: project({ id: "proj_delete", directory: directoryA }), + provider: { all: [], connected: [], default: {} }, + sessions: [first, second], + pageMessages: () => ({ items: [] }), + }, + }) + await seed(page, { + tabs: [first.id, second.id], + settings: { appearance: { tabLayout: "vertical" }, general: { sidebarOrganize: "customize" } }, + }) + await page.goto(sessionHref(first.id)) + await expectSessionTitle(page, first.title) + + const sidebar = page.locator('[data-slot="vertical-tabs"]') + + await sidebar.locator("[data-titlebar-tab-title]", { hasText: first.title }).click({ button: "right" }) + await page.getByRole("menuitem", { name: "Delete…", exact: true }).click() + await page.getByRole("dialog").getByRole("button", { name: "Delete session", exact: true }).click() + await expectSessionTitle(page, second.title) + // The session the app had loaded must not come back as a recent row, which would open a missing session. + await expect(sidebar.getByText(first.title)).toHaveCount(0) +}) diff --git a/packages/app/e2e/regression/new-session.spec.ts b/packages/app/e2e/regression/new-session.spec.ts index f03b2fe547..807a9b87dc 100644 --- a/packages/app/e2e/regression/new-session.spec.ts +++ b/packages/app/e2e/regression/new-session.spec.ts @@ -1,7 +1,7 @@ import { expect, test, type Locator, type Page } from "@playwright/test" import type { OpenCodeEvent, SessionMessageInfo, WorktreeDirectory } from "@opencode/client/promise" import { timelinePresets } from "@opencode/session-ui/timeline/detail" -import { draftHref, expectPath, NO_PROVIDER, project, provider, seed, sessionHref, T0 } from "../utils/app" +import { draftHref, expectPath, holdRoute, NO_PROVIDER, project, provider, seed, sessionHref, T0 } from "../utils/app" import { mockOpenCodeServer } from "../utils/mock-server" import { newSessionLocation, @@ -82,7 +82,7 @@ test("the location shortcuts choose worktrees from every state and keep cycling" await expect(page.locator('[data-slot="new-session-location-icon"]')).toHaveCount(0) await view.editor.press(`${modifier}+Alt+KeyO`) await expect(search).toBeFocused() - await page.getByRole("option", { name: /LocationShortcut C:\/OpenCode\/LocationShortcut$/ }).click() + await page.getByRole("option", { name: /LocationShortcut main C:\/OpenCode\/LocationShortcut$/ }).click() await view.editor.press(`${modifier}+Alt+KeyL`) await expect(newSessionWorktree(page)).toContainText("New worktree") await view.editor.press(`${modifier}+Alt+KeyO`) @@ -92,6 +92,62 @@ test("the location shortcuts choose worktrees from every state and keep cycling" await expect(view.editor).toBeFocused() }) +test("the main checkout shows its branch and is targeted when the draft opened in a worktree", async ({ page }) => { + const root = "C:/OpenCode/LocalFromWorktree" + + const worktree = `${root}/.worktrees/quiet-river` + + const created: unknown[] = [] + + const view = await openDraft(page, { + name: "LocalFromWorktree", + project: { sandboxes: [worktree] }, + worktrees: () => [{ directory: root }, { directory: worktree, strategy: "git" }], + vcs: (directory) => + directory === worktree + ? { current: "worktree-branch", default: "dev" } + : { current: "checkout-branch", default: "dev" }, + onSessionCreate: (body) => void created.push(body.location), + seed: { tabs: [{ draft: "draft_localfromworktree", directory: worktree }] }, + }) + + const screen = page.locator('[data-component="new-session"]') + + await expect(newSessionWorktree(page)).toHaveText("checkout-branch") + await expect(screen.getByText("checkout-branch", { exact: true })).toHaveCount(1) + await expect(screen.getByText("worktree-branch", { exact: true })).toHaveCount(0) + await view.editor.fill("Run in the main checkout") + await submit(page).click() + await expect.poll(() => created).toEqual([{ directory: root }]) +}) + +test("the main checkout trigger holds a placeholder while its branch loads, then shows the icon alone without one", async ({ + page, +}) => { + const vcs = Promise.withResolvers>>() + + await openDraft(page, { + name: "DetachedCheckout", + vcs: { default: "main" }, + beforeOpen: async () => { + vcs.resolve(await holdRoute(page, /\/api\/vcs\?/)) + }, + }) + + const held = await vcs.promise + const trigger = newSessionWorktree(page) + + await held.arrived + await expect(trigger).toHaveAttribute("aria-busy", "true") + await expect(trigger).toHaveAccessibleName("Choose worktree") + held.release() + await expect(trigger).toHaveAttribute("aria-busy", "false") + await expect(trigger).toHaveText("") + await expect(trigger).toHaveAccessibleName("Choose worktree") + await trigger.click() + await expect(page.getByRole("combobox", { name: "Search worktrees", exact: true })).toBeFocused() +}) + for (const binding of ["custom", "none"]) { test(`the picker tooltips reflect ${binding} shortcuts`, async ({ page }) => { const view = await openDraft(page, { @@ -125,7 +181,7 @@ for (const binding of ["custom", "none"]) { if (binding === "none") { await view.editor.press(`${modifier}+Alt+o`) await expect(page.getByRole("dialog")).toHaveCount(0) - await expect(newSessionWorktree(page)).toHaveText("Local") + await expect(newSessionWorktree(page)).toHaveText("main") return } @@ -325,12 +381,10 @@ test("the combined location picker shows checkout branches and chooses the base await page.getByRole("combobox", { name: "Search projects", exact: true }).press("ArrowRight") await page.getByRole("combobox", { name: "Search worktrees", exact: true }).fill("Custom project") await expect(page.getByRole("option")).toHaveCount(1) - await page.getByRole("option", { name: /Custom project C:\/OpenCode\/BranchContext/ }).click() + await page.getByRole("option", { name: /Custom project timeline-quotes C:\/OpenCode\/BranchContext$/ }).click() await expect(view.editor).toBeFocused() - await expect(screen.getByRole("button", { name: "Local", exact: true })).toBeVisible() - // The local checkout's branch is context, not a control: the app cannot switch it. - await expect(screen.getByText("timeline-quotes", { exact: true })).toBeVisible() - await expect(screen.getByRole("button", { name: "timeline-quotes", exact: true })).toHaveCount(0) + await expect(newSessionWorktree(page)).toHaveText("timeline-quotes") + await expect(screen.getByText("timeline-quotes", { exact: true })).toHaveCount(1) await expect(screen.getByRole("button", { name: /from / })).toHaveCount(0) await select(/^New worktree/) await expect(base).toBeVisible() @@ -359,13 +413,13 @@ test("the worktree trigger opens the current project's worktree step", async ({ }) const screen = page.locator('[data-component="new-session"]') - // The app cannot switch the checkout branch, so the local checkout names the mode instead of "dev". const local = newSessionWorktree(page) const dialog = page.getByRole("dialog") const search = dialog.getByRole("combobox", { name: "Search worktrees", exact: true }) const options = dialog.getByRole("option") const back = dialog.getByRole("button", { name: "Back to projects", exact: true }) + await expect(local).toHaveText("dev") await local.click() await expect(search).toBeFocused() await expect(back).toHaveText("Run session in") @@ -412,7 +466,7 @@ test("the worktree trigger opens the current project's worktree step", async ({ await expect(view.editor).toBeFocused() }) -test("the branch shortcut chooses a base branch and stays inactive on Local", async ({ page }) => { +test("the branch shortcut chooses a base branch and stays inactive on the main checkout", async ({ page }) => { const view = await openWorktreeDraft(page, { name: "BranchShortcut", vcs: () => ({ current: "dev", default: "dev" }), @@ -446,7 +500,7 @@ test("the branch shortcut chooses a base branch and stays inactive on Local", as await expect(view.editor).toBeFocused() await view.editor.press(`${modifier}+Alt+KeyL`) - await expect(newSessionWorktree(page)).toHaveText("Local") + await expect(newSessionWorktree(page)).toHaveText("dev") await view.editor.press(shortcut) await expect(search).toHaveCount(0) await expect(view.editor).toBeFocused() @@ -971,6 +1025,61 @@ test("keeps the draft on the main checkout when session creation fails, then ret await expect(page.locator('[data-component="user-message"] [data-slot="user-message-text"]')).toHaveText(text) }) +// Before, a create whose response stalled left the pending tab on "Starting session" with the prompt locked. +test("a stalled session create returns to the draft, and the Session it creates later is deleted unused", async ({ + page, +}) => { + const held = Promise.withResolvers() + const creates: string[] = [] + const prompts: string[] = [] + await page.clock.install() + + const view = await openDraft(page, { + ...pendingDraft, + onPrompt: (prompt) => void prompts.push(prompt.sessionID), + onSessionCreate: async (body, attempt) => { + creates.push(String(body.id)) + + if (attempt === 1) await held.promise + }, + }) + + await view.editor.fill(text) + await submit(page).click() + await expect.poll(() => creates.length).toBe(1) + const stalled = creates[0]! + await expectPath(page, sessionHref(stalled)) + await expect(page.locator('[data-component="session-preparing"]').getByRole("status")).toContainText( + "Starting session", + ) + + // The create phase's time limit, below the request queue's 60 s wait for response headers. + await page.clock.fastForward(30_000) + + await expectPath(page, draftHref(draftID)) + await expect(page.getByText("Failed to create session", { exact: true })).toBeVisible() + await expect( + page.getByText("The server took too long to respond. Send again to retry.", { exact: true }), + ).toBeVisible() + await expect(view.editor).toHaveText(text) + await expect(submit(page)).toBeEnabled() + await expect(tabLink(page, stalled)).toHaveCount(0) + + const removed = page.waitForRequest( + (request) => request.method() === "DELETE" && new URL(request.url()).pathname === `/api/session/${stalled}`, + ) + + held.resolve() + await removed + + await submit(page).click() + + await expect.poll(() => creates.length).toBe(2) + await expect.poll(() => prompts).toEqual([creates[1]]) + await expectPath(page, sessionHref(creates[1]!)) + await expect(page.locator('[data-component="user-message"] [data-slot="user-message-text"]')).toHaveText(text) +}) + test("a new session's first prompt stays once its missed admission echo resyncs the session", async ({ page }) => { const messages: SessionMessageInfo[] = [] const created: string[] = [] diff --git a/packages/app/e2e/regression/review.spec.ts b/packages/app/e2e/regression/review.spec.ts index d3bb97dfb7..f236e7eda1 100644 --- a/packages/app/e2e/regression/review.spec.ts +++ b/packages/app/e2e/regression/review.spec.ts @@ -151,6 +151,38 @@ test("a rejected Git init releases its session's button without showing an error await expect(init).toBeEnabled() }) +test("a created Git repository whose project refresh fails still refreshes the session without an error", async ({ + page, +}) => { + await openSession(page, { + name: "ReviewInitRefresh", + project: { vcs: undefined }, + onVcsInit: () => undefined, + sessions: [{ id: "ses_init_refresh", title: "Initialize Refresh" }], + seed: { + panes: { ses_init_refresh: { review: true } }, + storage: reviewTabs("C:/OpenCode/ReviewInitRefresh", "ses_init_refresh"), + }, + }) + const panel = page.locator("#review-panel") + const init = panel.getByRole("button", { name: "Create Git repository", exact: true }) + await expect(init).toBeEnabled() + + // The repository is created; the project list refresh after it fails. + await page.route(/\/api\/project(\?|$)/, (route) => + route.fulfill({ status: 500, headers: { "access-control-allow-origin": "*" }, json: {} }), + ) + const created = page.waitForResponse((item) => new URL(item.url()).pathname === "/api/vcs/init") + const project = page.waitForResponse((item) => new URL(item.url()).pathname === "/api/project") + const session = page.waitForResponse((item) => new URL(item.url()).pathname === "/api/session/ses_init_refresh") + await init.click() + expect((await created).status()).toBe(204) + expect((await project).status()).toBe(500) + expect((await session).status()).toBe(200) + await expect(panel.getByRole("button", { name: "Creating Git repository…", exact: true })).toHaveCount(0) + await expect(page.getByText("Request failed", { exact: true })).toHaveCount(0) +}) + test("opens file picker launchers when randomUUID is unavailable on insecure HTTP origins", async ({ page }) => { await page.addInitScript(() => { Object.defineProperty(globalThis, "isSecureContext", { configurable: true, value: false }) @@ -889,6 +921,7 @@ test("artifact actions copy and download content, switch source, and follow the await context.grantPermissions(["clipboard-read", "clipboard-write"]) const source = '' const table = 'name,role\n"Jensen, Oliver",Researcher\nIsabella,Support' + const broken = ' ({ @@ -935,7 +970,7 @@ test("artifact actions copy and download content, switch source, and follow the content: [ { type: "text", - text: "---\ndescription: Chat heading\n---\n\n[Vector](vector.svg) [Table](data.csv) [Notes](notes.md) [Binary](sample.bin)", + text: "---\ndescription: Chat heading\n---\n\n[Vector](vector.svg) [Table](data.csv) [Notes](notes.md) [Binary](sample.bin) [Broken](broken.svg)", }, ], time: { created: 1, completed: 2 }, @@ -1071,6 +1106,13 @@ test("artifact actions copy and download content, switch source, and follow the await expect(page.getByRole("menuitem", { name: "Download", exact: true })).toHaveCount(0) await page.getByRole("menuitem", { name: "Copy path", exact: true }).click() await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(`${workspace.directory}/sample.bin`) + + // A text SVG that fails to decode shows the binary placeholder but can still show its source. + await page.getByRole("link", { name: "Broken", exact: true }).click() + await expect(toolbar.getByText("broken.svg", { exact: true })).toBeVisible() + await expect(panel.getByText("Couldn't load this file.", { exact: true })).toBeVisible() + await toolbar.getByRole("button", { name: "View source", exact: true }).click() + await expect(panel.locator("diffs-container")).toContainText(broken) }) test("Markdown and DOCX sheets stay aligned when switching at wide and narrow preview widths", async ({ page }) => { @@ -1320,6 +1362,28 @@ test("image gestures anchor zoom, pan, and reset independently of the pane", asy await expect(stage).toHaveAttribute("data-zoom", "actual") expect((await image.boundingBox())!.x).toBeCloseTo(scrolled.x + 30, 1) expect((await image.boundingBox())!.y).toBeCloseTo(scrolled.y + 20, 1) + // A pan whose release the image never heard ends on the next move without the button, and pans nothing. + const touched = (await image.boundingBox())! + await page.mouse.down() + await expect(image).toHaveCSS("cursor", "grabbing") + await image.evaluate( + (element, point) => + element.dispatchEvent( + new PointerEvent("pointermove", { + bubbles: true, + pointerId: 1, + pointerType: "mouse", + isPrimary: true, + buttons: 0, + clientX: point.x, + clientY: point.y, + }), + ), + { x: anchor.x - 100, y: anchor.y - 100 }, + ) + await expect(image).toHaveCSS("cursor", "grab") + expect(await image.boundingBox()).toEqual(touched) + await page.mouse.up() // Keyboard-accessible fit restores the exact original geometry. await fit.focus() await page.keyboard.press("Enter") @@ -1485,7 +1549,14 @@ test("video files stream into the viewer behind a loading state, open into the p const ranged = Promise.withResolvers() const release = Promise.withResolvers() await page.route(`**/api/fs/read/${file}*`, async (route) => { - const headers = { "access-control-allow-origin": "*", "accept-ranges": "bytes", "content-type": "video/mp4" } + const headers = { + "access-control-allow-origin": "*", + "accept-ranges": "bytes", + "content-type": "video/mp4", + "content-disposition": `attachment; filename="${file}"`, + "content-security-policy": "default-src 'none'; img-src 'self'; media-src 'self'; sandbox", + "x-content-type-options": "nosniff", + } if (route.request().method() === "HEAD") return route.fulfill({ status: 200, headers: { ...headers, "content-length": String(mp4.length) } }) @@ -1867,6 +1938,116 @@ test("a failed diff request offers a retry instead of a clean working tree", asy await expect(failure).toHaveCount(0) }) +// A large file's full patch that failed to load used to leave its preview blank, with no reason and no way to load it. +test("a large file whose full diff fails to load says so, and loads on Try again", async ({ page }) => { + // The listing leaves the patch out, as the server does for a large file; the bounded request carries it. + await openSession(page, { + name: "ReviewDetailFailure", + vcsDiff: (input) => [fileDiff("big.ts", { loaded: input.context === "3" })], + }) + const full = { failing: true } + await page.route(/\/api\/vcs\/diff\?.*context=3/, (route) => { + if (!full.failing) return route.fallback() + + return route.fulfill({ status: 500, headers: { "access-control-allow-origin": "*" }, json: {} }) + }) + const panel = page.locator("#review-panel") + const preview = panel.locator('[data-slot="session-review-v2-diff-scroll"]') + const failure = preview.getByRole("alert") + + await page.getByRole("button", { name: "Toggle review", exact: true }).click() + await openReviewLauncher(panel) + await expect(panel.locator('[data-slot="session-review-v2-file-name"]')).toHaveText("big.ts") + // The request runs three times, a second and then two apart, before the preview gives up. + await expect(failure.getByText("Couldn't load changes", { exact: true })).toBeVisible() + full.failing = false + await failure.getByRole("button", { name: "Try again", exact: true }).click() + await expect(preview.locator("diffs-container")).toContainText("export const value = 'after'") + await expect(failure).toHaveCount(0) +}) + +// A failed search used to read "No results found", as if the workspace had no such file. +test("a failed file search offers a retry instead of no results", async ({ page }) => { + const directory = "C:/OpenCode/ReviewSearchFailure" + await openSession(page, { + name: "ReviewSearchFailure", + fileList: () => [fileNode(directory, "README.md")], + findFiles: (input) => (input.query === "nested" ? [fileNode(directory, "src/nested.ts")] : []), + seed: { panes: { ses_reviewsearchfailure: { review: true } } }, + }) + const search = { failing: true } + await page.route(/\/api\/fs\/find\?/, (route) => { + if (!search.failing) return route.fallback() + + return route.fulfill({ status: 500, headers: { "access-control-allow-origin": "*" }, json: {} }) + }) + const panel = page.locator("#review-panel") + const filter = panel.getByRole("combobox", { name: "Filter files" }) + const failure = panel.getByRole("alert") + + await openFileLauncher(panel) + await filter.fill("nested") + await expect(failure.getByText("Couldn't search files", { exact: true })).toBeVisible() + await expect(panel.getByText("No results found", { exact: true })).toHaveCount(0) + await page.screenshot({ path: test.info().outputPath("file-search-failed.png"), animations: "disabled" }) + search.failing = false + await failure.getByRole("button", { name: "Try again", exact: true }).click() + await expect(panel.getByRole("option", { name: /nested\.ts/ })).toBeVisible() + await expect(failure).toHaveCount(0) +}) + +// An untracked folder whose listing failed used to look empty, and opening it again never asked the server again. +test("an untracked folder that cannot load says so, and loads once it is opened again", async ({ page }) => { + const workspace = await openSession(page, { + name: "ReviewFolderFailure", + vcsDiff: (input) => + input.directory.endsWith("/untracked") + ? [fileDiff("untracked/notes.ts", { status: "added" })] + : [fileDiff("src/alpha.ts"), fileDiff("untracked/", { status: "added" })], + }) + + const listing = { failing: true, failures: 0 } + + await page.route(/\/api\/vcs\/diff\?/, (route) => { + const directory = new URL(route.request().url()).searchParams.get("location[directory]") + + if (!listing.failing || directory !== `${workspace.directory}/untracked`) return route.fallback() + listing.failures += 1 + + return route.fulfill({ status: 500, headers: { "access-control-allow-origin": "*" }, json: {} }) + }) + const panel = page.locator("#review-panel") + const folder = panel.getByRole("treeitem", { name: "untracked" }) + const notes = panel.getByRole("treeitem", { name: "notes.ts" }) + + await page.getByRole("button", { name: "Toggle review", exact: true }).click() + await openReviewLauncher(panel) + await expect(panel.getByRole("treeitem", { name: "alpha.ts" })).toBeVisible() + // Retries back off over 1, 2 and 4 seconds; the installed clock follows real time until a fast-forward skips it. + await page.clock.install() + await folder.click() + await expect(folder).toHaveAttribute("aria-expanded", "true") + + for (const failures of [1, 2, 3]) { + await expect.poll(() => listing.failures).toBe(failures) + await page.clock.fastForward(1_000 * 2 ** (failures - 1)) + } + + await expect.poll(() => listing.failures).toBe(4) + await expect(folder).toContainText("Couldn't load changes") + await expect(notes).toHaveCount(0) + + listing.failing = false + await folder.click() + await expect(folder).toHaveAttribute("aria-expanded", "false") + await expect(folder).not.toContainText("Couldn't load changes") + await folder.click() + await expect(folder).toHaveAttribute("aria-expanded", "true") + await expect(notes).toBeVisible() + await expect(folder).toContainText("1") + expect(listing.failures).toBe(4) +}) + test("a chosen mode the session stops offering shows as Git, and comes back when it is offered again", async ({ page, }) => { diff --git a/packages/app/e2e/regression/session-header.spec.ts b/packages/app/e2e/regression/session-header.spec.ts index 2a092fb272..42f91ae01e 100644 --- a/packages/app/e2e/regression/session-header.spec.ts +++ b/packages/app/e2e/regression/session-header.spec.ts @@ -3,6 +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 { chooseUserMessageAction, openUserMessageMenu } from "../utils/timeline" import { expectSessionTitle } from "../utils/waits" import { mockRemoteServer, mockWorkspace, openSession } from "../utils/workspace" @@ -509,6 +510,41 @@ test.describe("location", () => { }) } + test("an app launch that never answers releases the Open in controls", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 900 }) + + const mock = await mockWorkspace(page, { + ...workspace, + seed: { + storage: { ...reviewTabs(worktree, "ses_location"), "opencode.global.dat:plugin.file.app": { app: "vscode" } }, + }, + }) + + // An editor that does not detach keeps its launch running until the user closes it. + await page.goto( + `/e2e/utils/windows-menu.html?${new URLSearchParams({ + server: mock.server, + path: sessionHref("ses_location", "sidecar"), + os: "macos", + openApps: "1", + holdOpen: "1", + })}`, + ) + await expectSessionTitle(page, "Location session") + await page.getByRole("button", { name: "Toggle review", exact: true }).click() + await expect(page.getByRole("complementary", { name: "Review and files", exact: true })).toBeFocused() + // Control the launch timeout, not the page's initial focus and panel animation. + await page.clock.install() + const open = page.getByRole("button", { name: "Open in VS Code", exact: true }) + await open.click() + await expect(page.getByLabel("Opened paths")).toContainText("Visual Studio Code") + await expect(open).toBeDisabled() + + await page.clock.fastForward(10_000) + await expect(open).toBeEnabled() + await expect(page.getByText("Request failed", { exact: true })).toHaveCount(0) + }) + test.describe("touch", () => { test.use({ hasTouch: true }) @@ -690,7 +726,6 @@ test.describe("revert", () => { if (step) settles.push(step) }) const message = page.locator('[data-message-id="msg_second"]') - await message.hover() const response = page.waitForResponse( (response) => @@ -698,7 +733,8 @@ test.describe("revert", () => { new URL(response.url()).pathname === `/api/session/${session.id}/revert/stage`, ) - await message.getByRole("button", { name: "Rewind to here" }).click() + // The newest prompt's revert undoes the last turn. + await chooseUserMessageAction(page, message, "Undo") expect((await response).ok()).toBe(true) await expect(page.getByRole("textbox", { name: "Prompt" })).toHaveText("Second prompt") @@ -707,15 +743,14 @@ test.describe("revert", () => { expect(settles).toEqual(["/interrupt", "/wait", "/revert/stage"]) }) - test("Undo on the Rewound toast clears the revert and puts the draft back before the staged event arrives", async ({ + test("Undo on the Reverted toast clears the revert and puts the draft back before the staged event arrives", async ({ page, }) => { const { session, editor } = await openSession(page, workspace) const prompt = page.getByRole("textbox", { name: "Prompt" }) await editor.pressSequentially("Unsent draft") const message = page.locator('[data-message-id="msg_second"]') - await message.hover() - await message.getByRole("button", { name: "Rewind to here" }).click() + await chooseUserMessageAction(page, message, "Undo") await expect(prompt).toHaveText("Second prompt") const cleared = page.waitForRequest( @@ -787,9 +822,9 @@ test.describe("revert", () => { }) const prompt = page.getByRole("textbox", { name: "Prompt" }) await editor.pressSequentially("Draft in source") + // The session is already reverted to msg_second, so msg_first is the newest prompt left. const message = page.locator('[data-timeline-row="UserMessage"][data-message-id="msg_first"]') - await message.hover() - await message.getByRole("button", { name: "Rewind to here" }).click() + await chooseUserMessageAction(page, message, "Undo") await expect(prompt).toHaveText("First prompt") await tabs(page).filter({ hasText: "Rewind other" }).click() @@ -849,8 +884,7 @@ test.describe("revert", () => { }) await page.goto(sessionHref("ses_child")) await expectSessionTitle(page, "Session message revert") - const message = page.locator('[data-message-id="msg_second"]') - await message.hover() - await expect(message.getByRole("button", { name: "Rewind to here" })).toHaveCount(0) + const menu = await openUserMessageMenu(page, page.locator('[data-message-id="msg_second"]')) + await expect(menu.getByRole("menuitem", { name: /^(Revert to here|Undo)$/ })).toHaveCount(0) }) }) diff --git a/packages/app/e2e/regression/session-queue.spec.ts b/packages/app/e2e/regression/session-queue.spec.ts index 79ad241350..25b72f536b 100644 --- a/packages/app/e2e/regression/session-queue.spec.ts +++ b/packages/app/e2e/regression/session-queue.spec.ts @@ -8,6 +8,7 @@ import { Schema } from "effect" import { holdRoute, provider, seed, SERVER } from "../utils/app" import type { MockServerConfig } from "../utils/mock-server" import { installSseTransport } from "../utils/sse-transport" +import { chooseUserMessageAction, openUserMessageMenu } from "../utils/timeline" import { openSession } from "../utils/workspace" const sessionID = "ses_session_queue_regression" @@ -170,6 +171,7 @@ async function openQueue( revert?: string, status: "idle" | "running" = "running", model = { id: "queue-model", name: "Queue Model" }, + config: Pick = {}, ) { const options: Parameters[1] = { name: "SessionQueueRegression", @@ -191,6 +193,7 @@ async function openQueue( onBackground: mock.onBackground, shellCommands: () => mock.shells, events: mock.events, + ...config, } if (followUpBehavior) options.seed = { settings: { general: { followUpBehavior } } } @@ -233,6 +236,82 @@ test("follow-up preference controls Enter while Mod+Enter uses the alternate del await expect(view.input).toHaveText("") }) +test("Alt+Enter queues a follow-up first without steering, regardless of the follow-up preference", async ({ + page, +}) => { + const mock = createQueueMock(["Follow-up A", "Follow-up B"]) + + const view = await openQueue(page, mock, "steer") + + await view.input.fill("Follow-up C") + await view.input.press("Alt+Enter") + await expect(view.rows.locator('[data-action="session-queue-edit"]')).toHaveText([ + "Follow-up C", + "Follow-up A", + "Follow-up B", + ]) + await expect + .poll(() => mock.rows.map((row) => [row.payload.text, row.delivery])) + .toEqual([ + ["Follow-up C", "queue"], + ["Follow-up A", "queue"], + ["Follow-up B", "queue"], + ]) + await expect(view.input).toHaveText("") + expect(mock.changes.every((change) => change.action === "cancel")).toBe(true) + await view.input.fill("Another follow-up") + await view.composer.locator('[data-action="composer-alternate-delivery"]').hover() + await expect(page.getByRole("tooltip")).toContainText("Queue first") +}) + +for (const behavior of ["queue", "steer"] as const) { + test(`an empty Mod+Enter steers only the first queued prompt (${behavior} preference)`, async ({ page }) => { + const mock = createQueueMock(["Follow-up A", "Follow-up B", "Follow-up C"]) + + const view = await openQueue(page, mock, behavior) + + const steer = await holdRoute(page, new RegExp(`/api/session/${sessionID}/inbox/inb_seed_1(\\?|$)`), { + method: "PATCH", + }) + + await view.input.press("Enter") + await view.input.press("Alt+Enter") + await expect(view.rows.locator('[data-action="session-queue-edit"]')).toHaveText([ + "Follow-up A", + "Follow-up B", + "Follow-up C", + ]) + expect(mock.changes).toEqual([]) + + await view.input.press("ControlOrMeta+Enter") + await expect(view.rows.locator('[data-action="session-queue-edit"]')).toHaveText(["Follow-up B", "Follow-up C"]) + await steer.arrived + // A second press while A is still being steered must not jump to B. + await view.input.press("ControlOrMeta+Enter") + steer.release() + await expect.poll(() => mock.changes).toEqual([{ inboxID: "inb_seed_1", action: "steer" }]) + await expect(view.rows.locator('[data-action="session-queue-edit"]')).toHaveText(["Follow-up B", "Follow-up C"]) + expect(mock.prompts).toEqual([]) + }) +} + +for (const mode of ["parked", "shell"] as const) { + test(`empty Mod+Enter leaves the queue alone when ${mode}`, async ({ page }) => { + const mock = createQueueMock(["Keep queued"]) + + const view = await openQueue(page, mock, "queue", undefined, mode === "parked" ? "idle" : "running") + + if (mode === "shell") { + await view.input.pressSequentially("!") + await expect(view.composer.locator('[data-action="composer-exit-shell"]')).toBeVisible() + } + + await view.input.press("ControlOrMeta+Enter") + await expect(view.rows.locator('[data-action="session-queue-edit"]')).toHaveText(["Keep queued"]) + expect(mock.changes).toEqual([]) + }) +} + test("a blank Enter leaves the running session alone while Stop still interrupts it, as in the TUI", async ({ page, }) => { @@ -339,6 +418,37 @@ test("a steer shows as pending in the timeline as the composer clears, before th await expect(prompt.locator('[data-component="user-message"]')).toHaveAttribute("data-pending", "true") }) +test("a prompt sent while the session's agents and models load shows as pending at once and sends once they load", async ({ + page, +}) => { + const mock = createQueueMock( + [], + [{ id: "msg_queue_delivered", type: "user", text: "First prompt", time: { created: 1 } }], + ) + + // The Location's agents load only once released, so the composer has no agent or model to send with yet. + const agents = Promise.withResolvers() + + const view = await openQueue(page, mock, "steer", undefined, "idle", undefined, { + beforeAgentsResponse: () => agents.promise, + }) + + const prompt = page.locator('[data-timeline-virtual-content] [data-timeline-row="UserMessage"]', { + hasText: "read the deploy logs", + }) + + await expect(userRow(page, "msg_queue_delivered")).toContainText("First prompt") + await view.input.fill("read the deploy logs") + await view.input.press("Enter") + await expect(prompt.locator('[data-component="user-message"]')).toHaveAttribute("data-pending", "true") + await expect(view.input).toHaveText("") + expect(mock.prompts).toEqual([]) + + agents.resolve() + await expect.poll(() => mock.prompts.map((item) => item.text)).toEqual(["read the deploy logs"]) + await expect(prompt).toHaveCount(1) +}) + for (const row of [ { case: "a missed admission echo", reconnect: false }, { case: "an event stream reconnect", reconnect: true }, @@ -1034,14 +1144,12 @@ test("reverting to another prompt replaces the file chips of an earlier restore" const view = await openQueue(page, mock) const chip = view.composer.locator('[data-slot="composer-context-file"]') - for (const [id, text, chips] of [ - ["msg_queue_second", "Second prompt", 1], - ["msg_queue_first", "First prompt", 0], + // The newest prompt's revert is Undo. The mock never hides the reverted prompt, so the first stays an earlier one. + for (const [id, text, chips, action] of [ + ["msg_queue_second", "Second prompt", 1, "Undo"], + ["msg_queue_first", "First prompt", 0, "Revert to here"], ] as const) { - const row = userRow(page, id) - - await row.hover() - await row.getByRole("button", { name: "Rewind to here" }).click() + await chooseUserMessageAction(page, userRow(page, id), action) await expect(view.input).toHaveText(text) await expect(chip).toHaveCount(chips) } @@ -1087,8 +1195,7 @@ test("reverting a delivered prompt leaves queued prompts alone, as in the TUI", (response) => new URL(response.url()).pathname === `/api/session/${sessionID}/revert/stage`, ) - await delivered.hover() - await delivered.getByRole("button", { name: "Rewind to here" }).click() + await chooseUserMessageAction(page, delivered, "Undo") expect((await staged).ok()).toBe(true) await expect(view.input).toHaveText("First prompt") @@ -1161,9 +1268,9 @@ for (const [action, status] of [ if (status === "steering") await expect(message).toHaveAttribute("data-pending", "true") else await expect(message).not.toHaveAttribute("data-pending") - await pending.hover() - await expect(pending.getByRole("button", { name: "Rewind to here" })).toHaveCount(0) - await pending.getByRole("button", { name: action }).click() + const menu = await openUserMessageMenu(page, pending) + await expect(menu.getByRole("menuitem", { name: /^(Revert to here|Undo)$/ })).toHaveCount(0) + await menu.getByRole("menuitem", { name: action, exact: true }).click() await expect(pending).toHaveCount(0) expect(mock.changes).toEqual([{ inboxID, action: action === "Delete" ? "cancel" : "queue" }]) @@ -1175,7 +1282,7 @@ for (const [action, status] of [ }) } -test("waiting steers group under one Pending line, each keeping its own actions beside its bubble", async ({ +test("waiting steers group under one Pending line, each keeping its own actions in its chevron menu", async ({ page, }) => { const mock = createQueueMock( @@ -1195,8 +1302,8 @@ test("waiting steers group under one Pending line, each keeping its own actions await expect(first.locator('[data-slot="user-message-meta"]')).toBeHidden() await first.locator('[data-slot="user-message-text"]').hover() - await expect(first.locator('[data-slot="user-message-run-actions"]')).toHaveCSS("opacity", "1") - await first.getByRole("button", { name: "Move to queue" }).click() + await expect(first.locator('[data-slot="user-message-menu"]')).toHaveCSS("opacity", "1") + await chooseUserMessageAction(page, first, "Move to queue") await expect.poll(() => mock.changes).toEqual([{ inboxID: mock.rows[0].id, action: "queue" }]) }) @@ -1334,8 +1441,10 @@ for (const delivery of ["steer", "queue"] as const) { await expect(bubble).toHaveCSS("color", colors.pending.text) await expect(bubble).toHaveCSS("transition-duration", "0s") await expect(pending.locator('[data-slot="user-message-copy-wrapper"]')).toHaveCSS("opacity", "1") - // The steer keeps U1's agent and model, so Pending is all its meta line says. - await expect(pending.locator('[data-slot="user-message-meta"]')).toHaveText(/^Pending$/, { useInnerText: true }) + // Pending closes the meta line, after the agent and model that show on hover. + await expect(pending.locator('[data-slot="user-message-meta"]')).toHaveText(/^Queue Model\s*·\s*Pending$/, { + useInnerText: true, + }) await bubble.evaluate((element) => (element.dataset.deliveryMarker = "pending")) } diff --git a/packages/app/e2e/regression/session-request-docks.spec.ts b/packages/app/e2e/regression/session-request-docks.spec.ts index 38ed057437..ae1d0277e4 100644 --- a/packages/app/e2e/regression/session-request-docks.spec.ts +++ b/packages/app/e2e/regression/session-request-docks.spec.ts @@ -327,6 +327,135 @@ test("sends one permission reply and closes the dock when it lands, before permi expect(replies).toEqual([{ decision: "once" }]) }) +test("shows an auto-accepted permission in the dock once its replies stop answering", async ({ page }) => { + const permissionID = "permission-hung" + const attempts = { count: 0 } + await page.clock.install() + await mockWorkspace(page, { + name: "RequestDocks", + directory, + sessions: [{ id: sessionID, title }], + sessionPermissions: { + [sessionID]: [ + { id: permissionID, sessionID, action: "shell", resources: ["git status"], metadata: {}, save: [] }, + ], + }, + seed: { settings: { permissions: { autoApprove: true } } }, + }) + // Every reply reaches the server and never answers. + await page.route(new RegExp(`/api/session/${sessionID}/permission/${permissionID}/reply(\\?|$)`), (route) => { + if (route.request().method() !== "POST") return route.fallback() + attempts.count++ + }) + + await page.goto(sessionHref(sessionID)) + await expectSessionTitle(page, title) + const permission = page.locator('[data-component="dock-prompt"][data-kind="permission"]') + + // Each reply times out, then the next one starts after its retry delay. + await expect.poll(() => attempts.count).toBe(1) + await page.clock.fastForward(15_000) + await page.clock.fastForward(1_000) + await expect.poll(() => attempts.count).toBe(2) + await page.clock.fastForward(15_000) + await page.clock.fastForward(2_000) + await expect.poll(() => attempts.count).toBe(3) + await expect(permission).toHaveCount(0) + + await page.clock.fastForward(15_000) + await expect(permission.getByText("git status")).toBeVisible() + expect(attempts.count).toBe(3) +}) + +test("keeps a typed MCP elicitation answer across a session switch and submits it once", async ({ page }) => { + const other = { id: "ses_request_docks_other", title: "Other request session" } + + const form = { + id: "frm_mcp_draft", + sessionID, + title: "Deploy", + metadata: { kind: "mcp-elicitation", server: "release" }, + fields: [{ key: "env", type: "string", title: "Environment" }], + } + + const replies: unknown[] = [] + await mockWorkspace(page, { + name: "RequestDocks", + directory, + sessions: [{ id: sessionID, title }, other], + forms: () => (replies.length > 0 ? [] : [form]), + onFormReply: (reply) => replies.push(reply.body), + seed: { tabs: [sessionID, other.id] }, + }) + + await page.goto(sessionHref(sessionID)) + await expectSessionTitle(page, title) + const dock = page.locator('[data-component="session-elicitation-dock"]') + const input = dock.getByRole("textbox", { name: "Environment", exact: true }) + await input.fill("staging") + + await page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(other.id)}"])`).click() + await expectSessionTitle(page, other.title) + await expect(dock).toHaveCount(0) + await page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(sessionID)}"])`).click() + await expectSessionTitle(page, title) + await expect(input).toHaveValue("staging") + + await dock.getByRole("button", { name: "Submit", exact: true }).dblclick() + await expect(dock).toHaveCount(0) + await expect(page.locator('[data-component="composer"]')).toBeVisible() + expect(replies).toEqual([{ answer: { env: "staging" } }]) +}) + +test("gives a Location elicitation's hung reply back after 30 s and closes it on form.replied", async ({ page }) => { + const form = { + id: "frm_mcp_global", + sessionID: "global", + title: "Deploy", + metadata: { kind: "mcp-elicitation", server: "release" }, + fields: [{ key: "env", type: "string", title: "Environment" }], + } + + const replies: { body: unknown; directory: string | undefined }[] = [] + const transport = await installSseTransport(page, { server: SERVER, retry: 20 }) + await page.clock.install() + await mockServer(page, { forms: [form] }) + // The server takes the reply and never answers it. + await page.route(/\/api\/session\/global\/form\/frm_mcp_global\/reply(\?|$)/, (route) => { + if (route.request().method() !== "POST") return route.fallback() + replies.push({ body: route.request().postDataJSON(), directory: route.request().headers()["x-opencode-directory"] }) + }) + + await page.goto(sessionHref(sessionID)) + await transport.waitForConnection() + await expectSessionTitle(page, title) + const dock = page.locator('[data-component="session-elicitation-dock"]') + const input = dock.getByRole("textbox", { name: "Environment", exact: true }) + const submit = dock.getByRole("button", { name: "Submit", exact: true }) + await input.fill("prod") + + await submit.dblclick() + await expect.poll(() => replies.length).toBe(1) + await expect(submit).toBeDisabled() + expect(replies).toEqual([{ body: { answer: { env: "prod" } }, directory: encodeURIComponent(directory) }]) + + await page.clock.fastForward(30_000) + await expect(submit).toBeEnabled() + await expect(input).toHaveValue("prod") + await expect(page.getByText("Request failed", { exact: true })).toBeVisible() + + await transport.send({ + id: "evt_form_replied_global", + created: 1700000004000, + type: "form.replied", + location: { directory }, + data: { sessionID: "global", id: "frm_mcp_global", answer: { env: "prod" } }, + }) + await expect(dock).toHaveCount(0) + await expect(page.locator('[data-component="composer"]')).toBeVisible() + expect(replies).toHaveLength(1) +}) + test("names the MCP tool, the hook's message and the full input in the permission dock", async ({ page }) => { const body = "x".repeat(3000) await mockServer(page, { diff --git a/packages/app/e2e/regression/session-summary.spec.ts b/packages/app/e2e/regression/session-summary.spec.ts index b9b25f978b..a9752cc91f 100644 --- a/packages/app/e2e/regression/session-summary.spec.ts +++ b/packages/app/e2e/regression/session-summary.spec.ts @@ -150,6 +150,31 @@ test("the project menu loads changes on demand and opens review", async ({ page await expect(page.locator("#review-panel")).toBeVisible() }) +// A failed load used to read "No changes", a clean working tree the server never reported. +test("the project menu shows a failed changes load and loads again in place", async ({ page }) => { + await openSession(page, { + name: "ProjectChangesFailure", + vcsDiff: [fileDiff("README.md", { additions: 7, deletions: 3 })], + }) + const changes = { failing: true } + await page.route(/\/api\/vcs\/diff\?/, (route) => { + if (!changes.failing) return route.fallback() + + return route.fulfill({ status: 500, headers: cors, json: {} }) + }) + await page.locator('[data-slot="session-location-trigger"]').click() + const menu = page.locator('[data-slot="session-location-card"]') + const failed = menu.getByRole("menuitem", { name: /^Couldn't load changes.*Retry$/ }) + await expect(failed).toBeVisible() + await expect(menu.getByRole("menuitem", { name: "No changes", exact: true })).toHaveCount(0) + await page.screenshot({ path: test.info().outputPath("project-menu-changes-failed.png"), animations: "disabled" }) + + changes.failing = false + await failed.click() + await expect(menu).toBeVisible() + await expect(menu.getByRole("menuitem", { name: /1 Changed file/ })).toContainText("+7") +}) + test("a session in a worktree subfolder names its worktree and lists cached worktrees at once", async ({ page }) => { const root = "C:/OpenCode/SmokeWorktrees" await mockStressTimeline(page, { @@ -556,6 +581,26 @@ test("summary catalogs load, refresh while cached, and tell errors from empty", await expectRefreshKeeps(page, service.name, service.path, service.item) } + // A refresh that fails keeps the list it had, with its footer and its row's count. + state.fail = true + + const failed = page.waitForResponse( + (response) => new URL(response.url()).pathname === "/api/plugin" && response.status() === 500, + ) + + await page.keyboard.press("Escape") + await expect(menu("Skills")).toBeHidden() + await open("Plugins") + await failed + await expect(menu("Plugins")).toHaveAttribute("aria-busy", "false") + await expect(menu("Plugins").getByText("supermemory", { exact: true })).toBeVisible() + await expect(menu("Plugins").getByText("Configuration file")).toBeVisible() + await expect(menu("Plugins").getByRole("alert")).toHaveCount(0) + await expect( + summary.getByRole("button", { name: "Plugins", exact: true }).locator(".session-service-count"), + ).toHaveText("2") + state.fail = false + state.extra = true await expectRefreshKeeps(page, "Plugins", "/api/plugin", "supermemory") await expect(menu("Plugins").getByText("daytona", { exact: true })).toBeVisible() diff --git a/packages/app/e2e/regression/settings-search.spec.ts b/packages/app/e2e/regression/settings-search.spec.ts index 4e54032e2a..333abd9aff 100644 --- a/packages/app/e2e/regression/settings-search.spec.ts +++ b/packages/app/e2e/regression/settings-search.spec.ts @@ -1,7 +1,7 @@ import { expect, test, type Page } from "@playwright/test" import en from "../../src/runtime/i18n/en" import { clientSettings } from "../../src/settings/search-catalog" -import { NO_PROVIDER, REMOTE_SERVER, project, type SeedInput } from "../utils/app" +import { NO_PROVIDER, REMOTE_SERVER, holdRoute, project, type SeedInput } from "../utils/app" import { mockOpenCodeServer } from "../utils/mock-server" import { openSettings } from "../utils/workspace" @@ -420,6 +420,56 @@ test("a page reached through an opened result keeps its own way back", async ({ await expect(view.settings.getByRole("button", { name: "Back to projects", exact: true })).toBeVisible() }) +test("project edits queued behind a save reach their project in order across jumps away and back", async ({ page }) => { + const view = await open(page, { count: 2 }) + await view.search.fill("OpenCode 00 name") + await view.results.getByRole("option").click() + const name = view.settings.getByRole("textbox", { name: "Project name", exact: true }) + await expect(name).toHaveValue("OpenCode 00") + const hold = await holdRoute(page, /\/api\/project\/proj_search_\d+(\?|$)/, { method: "PATCH" }) + + await name.fill("Renamed") + await name.blur() + await hold.arrived + const startup = view.settings.getByRole("textbox", { name: "Worktree startup script", exact: true }) + await startup.fill("bun dev") + await startup.blur() + + const key = await page.evaluate(() => + /Mac|iPhone|iPad|iPod/.test(navigator.platform) ? "Meta+Shift+P" : "Control+Shift+P", + ) + + const jump = async (query: string, value: string) => { + await page.keyboard.press(key) + const palette = page.getByRole("dialog") + await palette.getByRole("combobox").fill(query) + await palette.getByRole("option", { name: /^Project name/ }).click() + await expect(name).toHaveValue(value) + } + + const sent = (projectID: string) => + hold.requests + .filter((request) => new URL(request.url()).pathname === `/api/project/${projectID}`) + .map((request) => request.postDataJSON()) + + await jump("OpenCode 01 name", "OpenCode 01") + + // Another project's save does not wait behind the first project's held one. + await name.fill("Bravo") + await name.blur() + await expect.poll(() => sent("proj_search_1")).toEqual([{ name: "Bravo" }]) + + // Back on the first project before its queued edit went out, a new save must not overtake it. + await jump("OpenCode 00 name", "OpenCode 00") + await startup.fill("bun start") + await startup.blur() + hold.release() + + await expect + .poll(() => sent("proj_search_0")) + .toEqual([{ name: "Renamed" }, { commands: { start: "bun dev" } }, { commands: { start: "bun start" } }]) +}) + test("IME confirmation does not activate a search result", async ({ page }) => { const view = await open(page) await view.search.fill("font") diff --git a/packages/app/e2e/regression/settings-wsl.spec.ts b/packages/app/e2e/regression/settings-wsl.spec.ts index 849ca540ba..4c8aec65db 100644 --- a/packages/app/e2e/regression/settings-wsl.spec.ts +++ b/packages/app/e2e/regression/settings-wsl.spec.ts @@ -1,11 +1,91 @@ import { base64Encode } from "@opencode/util/encode" -import { expect, test } from "@playwright/test" -import { NO_PROVIDER, REMOTE_SERVER, SERVER, project, provider, session } from "../utils/app" +import { expect, test, type Locator } from "@playwright/test" +import { NO_PROVIDER, REMOTE_SERVER, SERVER, holdRoute, project, provider, session } from "../utils/app" import { mockOpenCodeServer, mockServers } from "../utils/mock-server" import { expectSessionTitle } from "../utils/waits" test.use({ viewport: { width: 1280, height: 900 } }) +test("WSL distribution radios stay inset and aligned in both add-server lists", async ({ page }) => { + await mockOpenCodeServer(page, { + directory: "/repo", + project: project({ id: "proj_wsl_alignment", directory: "/repo", name: "WSL project" }), + provider: NO_PROVIDER, + sessions: [], + pageMessages: () => ({ items: [] }), + }) + await page.goto( + `/e2e/utils/settings-wsl.html?${new URLSearchParams({ + server: SERVER, + mode: "ready", + distros: "Ubuntu-24.04,AlmaLinux-9,Debian-WSL1", + })}`, + ) + const settings = page.getByTestId("settings-screen") + await settings.getByRole("tab", { name: "Servers", exact: true }).click() + await expect(settings.getByRole("region", { name: "Ubuntu", exact: true })).toHaveCount(1) + await settings.getByRole("button", { name: "Add server", exact: true }).press("Enter") + await page.getByRole("menuitem", { name: "Add WSL server", exact: true }).click() + const dialog = page.getByRole("dialog") + const ubuntu = dialog.getByRole("radio", { name: "Ubuntu-24.04 OpenCode not installed", exact: true }) + const alma = dialog.getByRole("radio", { name: "AlmaLinux-9 OpenCode not installed", exact: true }) + await expect(ubuntu).toBeEnabled() + await expect(dialog.getByText("OpenCode not installed", { exact: true })).toHaveCount(2) + await expect(dialog.getByRole("radio", { name: "Debian-WSL1 Unsupported · Use WSL 2", exact: true })).toBeDisabled() + await expectDistroLayout(dialog) + await dialog + .locator('[data-slot="radio-v2-item-label"]') + .filter({ has: page.getByText("AlmaLinux-9", { exact: true }) }) + .click() + await expect(alma).toBeChecked() + await alma.press("ArrowUp") + await expect(ubuntu).toBeChecked() + await expect(ubuntu).toBeFocused() + await expectDistroLayout(dialog) + + await dialog.getByRole("button", { name: /Need another distro/ }).click() + await expect(dialog.getByRole("heading", { name: "Install distro", exact: true })).toBeVisible() + await expect(dialog.getByRole("radio", { name: "Debian", exact: true })).toBeChecked() + await expectDistroLayout(dialog) + await dialog + .locator('[data-slot="radio-v2-item-label"]') + .filter({ has: page.getByText("FedoraLinux-43", { exact: true }) }) + .click() + await expect(dialog.getByRole("radio", { name: "FedoraLinux-43", exact: true })).toBeChecked() + await expectDistroLayout(dialog) +}) + +async function expectDistroLayout(dialog: Locator) { + // Keep the visible control inside its row and aligned with its label, including disabled rows, + // and keep rows flush so every divider sits the same distance from the content below it. + await expect + .poll(() => + dialog.locator(".settings-wsl-distro-row").evaluateAll((rows) => + rows.every((row, index) => { + const previous = rows[index - 1]?.getBoundingClientRect() + + if (previous && Math.abs(row.getBoundingClientRect().top - previous.bottom) > 1) return false + const control = row.querySelector('[data-slot="radio-v2-item-control"]') + const label = row.querySelector('[data-slot="radio-v2-item-label-text"]') + + if (!control || !label) return false + const bounds = row.getBoundingClientRect() + const circle = control.getBoundingClientRect() + const text = label.getBoundingClientRect() + + return ( + circle.left - bounds.left >= 8 && + circle.top - bounds.top >= 8 && + circle.bottom < bounds.bottom && + circle.right < text.left && + Math.abs(circle.top + circle.height / 2 - (text.top + text.height / 2)) <= 4 + ) + }), + ), + ) + .toBe(true) +} + for (const mode of ["failed", "stopped", "ready"] as const) { test(`manages a ${mode} configured WSL server from the Servers page`, async ({ page }) => { await mockOpenCodeServer(page, { @@ -250,3 +330,43 @@ test("an open session moves to the controller a new SSH sign-in creates", async await editor.press("Enter") await expect.poll(() => prompts).toEqual(["after sign-in"]) }) + +test("a session being created on an SSH host that turns out incompatible says so", async ({ page }) => { + const directory = "/home/box/project" + const box = session({ id: "ses_ssh_incompatible", directory, title: "SSH incompatible session" }) + + const config = { + directory, + project: project({ id: "proj_ssh_incompatible", directory }), + provider: provider(), + sessions: [box], + pageMessages: () => ({ items: [] }), + } + + await mockServers(page, { [SERVER]: { ...config, sessions: [] }, [REMOTE_SERVER]: config }) + const path = `/server/${base64Encode("ssh:box")}/session/${box.id}` + await page.goto( + `/e2e/utils/settings-wsl.html?${new URLSearchParams({ server: SERVER, mode: "ready", ssh: REMOTE_SERVER, path })}`, + ) + await expectSessionTitle(page, box.title) + await page.getByRole("button", { name: "New session", exact: true }).click() + + // The create request stays in flight, so the new session stays in preparation. + await holdRoute(page, new RegExp(`^${REMOTE_SERVER.replace(/[.]/g, "\\.")}/api/session(\\?|$)`), { method: "POST" }) + const editor = page.locator('[data-component="composer-editor"]') + const send = page.getByRole("button", { name: "Send", exact: true }) + await expect(page.locator('[data-component="new-session"]')).toBeVisible() + await expect(editor).toBeEditable() + await editor.fill("start on the box") + await expect(editor).toHaveText("start on the box") + await expect(send).toBeEnabled() + await send.click() + const preparing = page.locator('[data-component="session-preparing"]') + await expect(preparing).toBeVisible() + + // The SSH plugin covers a host that is not ready; the route stays mounted beneath its cover. + await page.getByRole("button", { name: "Report incompatible SSH server" }).click() + await expect(page.getByRole("heading", { name: "SSH connection inactive", exact: true })).toBeVisible() + await expect(page.getByText("This server version isn't supported", { exact: true })).toBeAttached() + await expect(preparing).toHaveCount(0) +}) diff --git a/packages/app/e2e/regression/settings.spec.ts b/packages/app/e2e/regression/settings.spec.ts index c4109cda5e..3abea682c7 100644 --- a/packages/app/e2e/regression/settings.spec.ts +++ b/packages/app/e2e/regression/settings.spec.ts @@ -3,6 +3,7 @@ import type { ConfigEntry, OpenCodeEvent, SessionMessageInfo, WorktreeDirectory import { NO_PROVIDER, REMOTE_SERVER, SERVER, holdRoute, project, seed, session } from "../utils/app" import { mockMissingLocation, mockOpenCodeServer } from "../utils/mock-server" import { mockRemoteServer, mockWorkspace, openSession, openSettings, type WorkspaceInput } from "../utils/workspace" +import { CONSOLE_URL, consoleGateway, consoleSignIn } from "../utils/console" import { recordNotifications } from "../utils/notifications" import { installSseTransport } from "../utils/sse-transport" @@ -96,6 +97,43 @@ test("a settings page survives refresh", async ({ page }) => { await expect(page).toHaveURL("/settings?tab=appearance") }) +// The Arabic dictionary chunks: built (`_assets/ar-.js`) and dev (`.../i18n/ar.ts`), for the app and the UI. +const arabic = /\/(?:_assets\/ar-[\w-]+\.js|i18n\/ar\.ts)(?:\?|$)/ + +async function pickArabic(page: Page) { + const { settings } = await open(page) + await settings.locator('[data-action="settings-language"]').click() + await page.getByRole("listbox").getByRole("option", { name: "العربية", exact: true }).click() + + return settings +} + +test("a language switch keeps settings on screen and flips direction only with the new strings", async ({ page }) => { + const chunks = await holdRoute(page, arabic) + const html = page.locator("html") + const settings = await pickArabic(page) + await chunks.arrived + + await expect(settings.getByText("Language", { exact: true })).toBeVisible() + await expect(html).toHaveAttribute("dir", "ltr") + await expect(html).toHaveAttribute("lang", "en") + + chunks.release() + await expect(settings.getByText("اللغة", { exact: true })).toBeVisible() + await expect(html).toHaveAttribute("dir", "rtl") + await expect(html).toHaveAttribute("lang", "ar") +}) + +test("a language whose chunk fails to load keeps English and says so", async ({ page }) => { + await page.route(arabic, (route) => route.abort("failed")) + const settings = await pickArabic(page) + + await expect(page.getByText("Failed to load العربية", { exact: true })).toBeVisible() + await expect(settings.getByText("Language", { exact: true })).toBeVisible() + await expect(page.locator("html")).toHaveAttribute("dir", "ltr") + await expect(settings.locator('[data-action="settings-language"]')).toContainText("English") +}) + test("Questions settings default independently of old Permissions settings and survive reload", async ({ page }) => { const { settings } = await open(page, { seed: { @@ -710,6 +748,133 @@ test("a project whose folder is gone opens its settings with a notice", async ({ await expect(notice).toContainText(directory) }) +test("a project plugin list that fails to load offers Retry instead of an empty list", async ({ page }) => { + const { settings } = await open(page) + await openProject(page) + const lists = { failing: true } + + // Only the project's list carries a location; the server-wide list still loads. + await page.route(/\/api\/plugin\?.*location/, (route) => + route.fulfill( + lists.failing + ? { + status: 500, + json: { name: "UnknownError", data: { message: "config is invalid" } }, + headers: { "access-control-allow-origin": "*" }, + } + : { + json: { + location: { directory }, + data: [{ id: "project-plugin", source: { type: "package", target: "project-plugin" } }], + }, + headers: { "access-control-allow-origin": "*" }, + }, + ), + ) + + await settings.getByRole("tab", { name: "Extensions", exact: true }).click() + await settings.getByRole("tab", { name: "Plugins", exact: true }).click() + const panel = settings.getByRole("tabpanel", { name: "Plugins", exact: true }) + await expect(panel.getByRole("status")).toContainText("Could not load plugins") + await expect(panel.getByText("No plugins yet", { exact: true })).toHaveCount(0) + + lists.failing = false + await panel.getByRole("button", { name: "Try again", exact: true }).click() + await expect(panel.getByText("project-plugin", { exact: true })).toBeVisible() + await expect(panel.getByRole("status")).toHaveCount(0) +}) + +test("project extensions link Console MCPs and skills and offer sign-in as the server-wide page does", async ({ + page, + context, +}) => { + const consoleUrl = CONSOLE_URL + await context.route("https://opencode.ai/console/**", (route) => route.fulfill({ body: "Console" })) + + const { settings } = await open(page, { + configEntries: [ + { + type: "document", + info: { + mcp: { + servers: { + slack: consoleGateway("slack"), + github: consoleGateway("github", { protocol: "2026-07-28" }), + }, + }, + }, + }, + ], + mcp: [ + ...["figma", "github", "slack"].map((name) => ({ name, status: { status: "connected" } })), + { name: "stripe", integrationID: "stripe-oauth", status: { status: "needs_auth", error: "Sign in required" } }, + ], + integrations: [ + consoleSignIn, + { + id: "stripe-oauth", + name: "Stripe", + methods: [{ id: "oauth", type: "oauth" }], + connections: [], + metadata: { source: "mcp" }, + }, + ], + skills: [ + { id: "review", name: "Code review", path: "/home/test/.config/opencode/skills/review/SKILL.md", content: "x" }, + { id: "funnel", name: "Funnel analytics", path: "skill://funnel/SKILL.md", content: "x" }, + ], + }) + + await openProject(page) + await settings.getByRole("tab", { name: "Extensions", exact: true }).click() + + // Console's servers are shared with every project, so they list under Shared. + const mcps = settings.getByRole("tabpanel", { name: "MCPs", exact: true }) + await mcps.getByRole("button", { name: /^Shared/ }).click() + await expect(mcps.getByRole("switch", { name: "figma", exact: true })).toBeVisible() + // As on the server-wide page, a dot shows each status and the words stay for assistive technology. + await expect(mcps.getByRole("switch", { name: "slack", exact: true })).toHaveAccessibleDescription("Connected") + await expect(mcps.getByRole("switch", { name: "github", exact: true })).toHaveCount(0) + await expect(mcps.getByRole("button", { name: "Manage figma in Console", exact: true })).toHaveCount(0) + // A server that needs a sign-in asks for it in the switch's place, as on the server-wide page. + await expect(mcps.getByRole("button", { name: "Sign in to stripe", exact: true })).toHaveText("Sign in") + await expect(mcps.getByRole("switch", { name: "stripe", exact: true })).toHaveCount(0) + + const connection = page.waitForEvent("popup") + await mcps.getByRole("button", { name: "Connect github in Console", exact: true }).click() + await expect(await connection).toHaveURL(`${consoleUrl}/org_acme/extensions?connect=github`) + + const manage = page.waitForEvent("popup") + await mcps.getByRole("button", { name: "Manage slack in Console", exact: true }).click() + await expect(await manage).toHaveURL(`${consoleUrl}/org_acme/extensions/mcp/slack`) + + await settings.getByRole("tab", { name: "Skills", exact: true }).click() + const skills = settings.getByRole("tabpanel", { name: "Skills", exact: true }) + await skills.getByRole("button", { name: /^Shared/ }).click() + await expect(skills.getByText("Code review", { exact: true })).toBeVisible() + await expect(skills.getByRole("button", { name: "Manage Code review in Console", exact: true })).toHaveCount(0) + + const skill = page.waitForEvent("popup") + await skills.getByRole("button", { name: "Manage Funnel analytics in Console", exact: true }).click() + await expect(await skill).toHaveURL(`${consoleUrl}/org_acme/extensions?kind=skills&search=funnel`) +}) + +test("a Console skill links to Console's home when no Console MCP names the workspace", async ({ page, context }) => { + await context.route(`${CONSOLE_URL}**`, (route) => route.fulfill({ body: "Console" })) + + const { settings } = await open(page, { + integrations: [consoleSignIn], + skills: [{ id: "funnel", name: "Funnel analytics", path: "skill://funnel/SKILL.md", content: "x" }], + }) + + await settings.getByRole("tab", { name: "Extensions", exact: true }).click() + await settings.getByRole("tab", { name: "Skills", exact: true }).click() + + const skill = page.waitForEvent("popup") + await settings.getByRole("button", { name: "Manage Funnel analytics in Console", exact: true }).click() + await expect(await skill).toHaveURL(CONSOLE_URL) +}) + for (const field of [ { name: "color", @@ -810,6 +975,45 @@ test("clearing project fields sends explicit removal values", async ({ page }) = } }) +test("Enter removes a custom project icon, and a failed save stays marked until it is sent again", async ({ page }) => { + const { settings } = await open(page) + await openProject(page) + const icon = settings.getByRole("button", { name: "Project icon", exact: true }) + await expect(icon.locator("img")).toHaveCount(1) + + // Keyboard and touch users never hover, so activating the icon alone removes it. + const cleared = patched(page) + await icon.focus() + await page.keyboard.press("Enter") + expect((await cleared).postDataJSON()).toEqual({ icon: { color: "orange", override: "" } }) + await expect(icon.locator("img")).toHaveCount(0) + await expect(settings.locator('[aria-busy="true"]')).toHaveCount(0) + + // Only the next save fails. + let failed = false + + await page.route(new RegExp(`/api/project/${projectID}(\\?|$)`), (route) => { + if (route.request().method() !== "PATCH" || failed) return route.fallback() + failed = true + + return route.fulfill({ status: 500, contentType: "application/json", body: JSON.stringify({ message: "down" }) }) + }) + + const blue = settings.getByRole("button", { name: "Select blue color", exact: true }) + const retry = settings.getByRole("button", { name: "Try again", exact: true }) + await blue.click() + await expect(retry).toBeVisible() + await expect(icon).toHaveAttribute("aria-invalid", "true") + await expect(blue).toHaveAttribute("aria-pressed", "true") + await expect(settings.locator('[aria-busy="true"]')).toHaveCount(0) + + const resent = patched(page) + await retry.click() + expect((await resent).postDataJSON()).toEqual({ icon: { color: "blue", override: "" } }) + await expect(retry).toHaveCount(0) + await expect(icon).not.toHaveAttribute("aria-invalid") +}) + test("shortcuts list Search sessions once and unbind a shortcut while recording it", async ({ page }) => { // Opening Settings from Home registers Home's Find, which must not add a second Search sessions. const { settings } = await open(page) @@ -938,7 +1142,14 @@ test.describe("pages open before slow data", () => { }) test("extensions", async ({ page }) => { - const { settings } = await open(page, { mcp: [{ name: "demo-mcp", status: { status: "connected" } }] }) + const { settings } = await open(page, { + mcp: [{ name: "demo-mcp", status: { status: "connected" } }], + skills: [ + { id: "opencode", name: "OpenCode", path: "skill://opencode/SKILL.md", content: "OpenCode help" }, + { id: "plugin-skill", name: "Plugin skill", path: "skill://plugin-skill/SKILL.md", content: "Plugin help" }, + ], + }) + const mcp = await holdRoute(page, (url) => url.pathname === "/api/mcp") await settings.getByRole("tab", { name: "Extensions", exact: true }).click() await mcp.arrived @@ -947,6 +1158,11 @@ test.describe("pages open before slow data", () => { mcp.release() await settings.getByRole("tab", { name: "MCPs", exact: true }).click() await expect(settings.getByRole("switch", { name: "demo-mcp" })).toBeChecked() + // Without a Console sign-in, a virtual skill is never linked to Console. + await settings.getByRole("tab", { name: "Skills", exact: true }).click() + await expect(settings.getByText("OpenCode", { exact: true })).toBeVisible() + await expect(settings.getByText("Plugin skill", { exact: true })).toBeVisible() + await expect(settings.getByRole("button", { name: /in Console$/ })).toHaveCount(0) }) test("extensions show MCP status dots with sign-in, error, and switch controls", async ({ page, context }) => { @@ -1003,6 +1219,100 @@ test.describe("pages open before slow data", () => { await expect(details.getByText(error, { exact: true })).toBeVisible() }) + test("extensions list Console MCPs and skills with local ones", async ({ page, context }) => { + await context.route("https://opencode.ai/console/**", (route) => route.fulfill({ body: "Console" })) + const consoleUrl = CONSOLE_URL + + const actions: string[] = [] + + const { settings, push } = await open(page, { + configEntries: [ + { + type: "document", + info: { + mcp: { + servers: { + linear: consoleGateway("linear"), + github: consoleGateway("github", { protocol: "2026-07-28" }), + clickhouse: consoleGateway("clickhouse"), + }, + }, + }, + }, + { + type: "document", + path: "/home/test/.config/opencode/opencode.json", + info: { mcp: { servers: { linear: { type: "remote", url: "https://mcp.linear.app/mcp" } } } }, + }, + ], + integrations: [consoleSignIn], + mcp: ["figma", "linear", "github", "clickhouse"].map((name) => ({ name, status: { status: "connected" } })), + skills: [ + { + id: "review", + name: "Code review", + path: "/home/test/.config/opencode/skills/review/SKILL.md", + content: "Review code", + }, + { id: "opencode", name: "OpenCode", path: "skill://opencode/SKILL.md", content: "OpenCode help" }, + { id: "report", name: "Report", path: "skill://report/SKILL.md", content: "Report bugs" }, + { id: "browser", name: "Browser", path: "skill://browser/SKILL.md", content: "Browser help" }, + { id: "funnel", name: "Funnel analytics", path: "skill://funnel/SKILL.md", content: "Analyze the funnel" }, + ], + onMcpAction: (input) => { + actions.push(`${input.server}:${input.action}`) + }, + }) + + await settings.getByRole("tab", { name: "Extensions", exact: true }).click() + + // One list: a name both configs define is one row, the user's server, with Console's link kept. A Console server + // whose account isn't connected asks for the connection in the switch's place. + await expect(settings.getByRole("switch")).toHaveCount(3) + await expect(settings.getByRole("switch", { name: "linear", exact: true })).toBeChecked() + await expect(settings.getByRole("switch", { name: "figma", exact: true })).toBeChecked() + await expect(settings.getByRole("switch", { name: "github", exact: true })).toHaveCount(0) + await expect(settings.getByRole("button", { name: "Manage linear in Console" })).toHaveText( + "Replaces OpenCode Console", + ) + await expect(settings.getByRole("button", { name: "Manage github in Console" })).toHaveText("github") + await expect(settings.getByRole("button", { name: "Manage clickhouse in Console" })).toHaveText("clickhouse") + await expect(settings.getByText("OpenCode Console", { exact: true })).toHaveCount(0) + await expect(settings.getByRole("button", { name: "Manage figma in Console" })).toHaveCount(0) + + const connection = page.waitForEvent("popup") + await settings.getByRole("button", { name: "Connect github in Console" }).click() + await expect(await connection).toHaveURL(`${consoleUrl}/org_acme/extensions?connect=github`) + + const manage = page.waitForEvent("popup") + await settings.getByRole("button", { name: "Manage linear in Console" }).click() + await expect(await manage).toHaveURL(`${consoleUrl}/org_acme/extensions/mcp/linear`) + + const toggle = settings.getByRole("switch", { name: "clickhouse", exact: true }) + await toggle.press("Space") + await expect(toggle).not.toBeChecked() + expect(actions).toEqual(["clickhouse:disconnect"]) + const refreshed = page.waitForResponse((response) => new URL(response.url()).pathname === "/api/config") + await push([{ id: "evt_config_extensions", created: 1, type: "config.updated", data: {} }]) + await refreshed + await expect(toggle).not.toBeChecked() + + // One sorted list: only a skill Console delivers links to Console, filtered to that skill. + await settings.getByRole("tab", { name: "Skills", exact: true }).click() + await expect(settings.locator(".settings-extension-name")).toHaveText([ + "Browser", + "Code review", + "Funnel analytics", + "OpenCode", + "Report", + ]) + await expect(settings.getByRole("button", { name: /in Console$/ })).toHaveCount(1) + + const skill = page.waitForEvent("popup") + await settings.getByRole("button", { name: "Manage Funnel analytics in Console", exact: true }).click() + await expect(await skill).toHaveURL(`${consoleUrl}/org_acme/extensions?kind=skills&search=funnel`) + }) + for (const fails of [false, true]) { test(`about ${fails ? "keeps its fallback when contributors fail" : "updates contributors later"}`, async ({ page, @@ -1190,6 +1500,52 @@ test("a failed worktree delete restores its row, and the next confirmation still expect(removals.requests).toBe(2) }) +test("a failed worktree check offers Retry, and the passing retry enables Delete", async ({ page }) => { + const inventory: WorktreeDirectory[] = [ + { directory }, + ...sandboxes.map((item) => ({ directory: item, strategy: "git" })), + ] + + const { settings } = await open(page, { + worktrees: () => inventory, + onWorktreeRemove: (body) => { + inventory.splice( + inventory.findIndex((item) => item.directory === body.directory), + 1, + ) + }, + }) + + const checks = { failing: true } + + await page.route(/\/api\/vcs\/status(\?|$)/, (route) => + checks.failing + ? route.fulfill({ + status: 500, + json: { name: "UnknownError", data: { message: "git is busy" } }, + headers: { "access-control-allow-origin": "*" }, + }) + : route.fallback(), + ) + + await settings.getByRole("tab", { name: "Worktrees", exact: true }).click() + await expect(settings.getByText("12 worktrees", { exact: true })).toBeVisible() + await settings.getByRole("button", { name: "Delete “workspace-1”?", exact: true }).click() + const dialog = page.getByRole("dialog", { name: "Delete “workspace-1”?", exact: true }) + const remove = dialog.getByRole("button", { name: "Delete worktree", exact: true }) + const retry = dialog.getByRole("button", { name: "Try again", exact: true }) + await expect(dialog.getByText("Unable to verify git status.", { exact: true })).toBeVisible() + await expect(remove).toBeDisabled() + + checks.failing = false + await retry.click() + await expect(remove).toBeEnabled() + await expect(retry).toHaveCount(0) + await expect(dialog.getByText("Unable to verify git status.", { exact: true })).toHaveCount(0) + await remove.click() + await expect(settings.getByText("11 worktrees", { exact: true })).toBeVisible() +}) + test.describe("worktrees prefetch", () => { const other = project({ id: "proj_other", directory: "/repo/other", name: "Other project" }) diff --git a/packages/app/e2e/regression/side-panels.spec.ts b/packages/app/e2e/regression/side-panels.spec.ts index d03eb1d705..25de381307 100644 --- a/packages/app/e2e/regression/side-panels.spec.ts +++ b/packages/app/e2e/regression/side-panels.spec.ts @@ -221,7 +221,7 @@ test("New tabs stay when a launcher in another one opens a tab, or when the tab await expect(toggle).toHaveAttribute("aria-expanded", "false") }) -test("tabs in a narrow side strip shrink to keep their close buttons, and a tab's menu closes the others", async ({ +test("tabs in a narrow side strip shrink to keep their close buttons, and a tab's menu closes the others or those to its right", async ({ page, }) => { await page.setViewportSize({ width: 1000, height: 700 }) @@ -257,16 +257,53 @@ test("tabs in a narrow side strip shrink to keep their close buttons, and a tab' expect(box.x + box.width).toBeLessThanOrEqual(end) } - await side.getByRole("tab", { name: "b.md", exact: true }).click({ button: "right" }) + await side.getByRole("tab", { name: files[1], exact: true }).click({ button: "right" }) + await page.getByRole("menuitem", { name: "Close tabs to the right", exact: true }).click() + await expect(side.getByRole("tab")).toHaveText(["a.md", files[1]]) + + await side.getByRole("tab", { name: "a.md", exact: true }).click({ button: "right" }) await page.getByRole("menuitem", { name: "Close other tabs", exact: true }).click() await expect(side.getByRole("tab")).toHaveCount(1) - await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveAttribute("aria-selected", "true") + await expect(side.getByRole("tab", { name: "a.md", exact: true })).toHaveAttribute("aria-selected", "true") // With nothing else to close, the menu offers only the tab itself. - await side.getByRole("tab", { name: "b.md", exact: true }).click({ button: "right" }) + await side.getByRole("tab", { name: "a.md", exact: true }).click({ button: "right" }) await expect(page.getByRole("menuitem", { name: "Close other tabs", exact: true })).toBeDisabled() + await expect(page.getByRole("menuitem", { name: "Close tabs to the right", exact: true })).toBeDisabled() await page.getByRole("menuitem", { name: "Close tab", exact: true }).click() - await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveCount(0) + await expect(side.getByRole("tab", { name: "a.md", exact: true })).toHaveCount(0) +}) + +test("a reopened side tab returns to where it closed", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 900 }) + const directory = "C:/OpenCode/ReopenPlace" + const key = `local\u0000${base64Encode(directory)}/ses_reopenplace` + const files = ["a.md", "b.md", "c.md"] + + await openSession(page, { + name: "ReopenPlace", + fileList: () => [], + fileContent: (path) => ({ type: "text", content: `contents:${path}` }), + seed: { + panes: { ses_reopenplace: { review: true } }, + storage: { + "opencode.global.dat:layout": { + sessionTabs: { [key]: { all: files.map((file) => `file://${file}`), active: "file://b.md" } }, + }, + }, + }, + }) + + const side = page.locator('[data-pane-content="side"]') + await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveAttribute("aria-selected", "true") + + await page.getByRole("textbox", { name: "Prompt", exact: true }).click() + await page.keyboard.press("ControlOrMeta+w") + await expect(side.getByRole("tab")).toHaveText(["a.md", "c.md"]) + + await page.keyboard.press("ControlOrMeta+Shift+t") + await expect(side.getByRole("tab")).toHaveText(["a.md", "b.md", "c.md"]) + await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveAttribute("aria-selected", "true") }) async function expectTreeSentinel(page: Page) { diff --git a/packages/app/e2e/regression/subagent-child-navigation.spec.ts b/packages/app/e2e/regression/subagent-child-navigation.spec.ts index cd01ef3369..c60b60acfd 100644 --- a/packages/app/e2e/regression/subagent-child-navigation.spec.ts +++ b/packages/app/e2e/regression/subagent-child-navigation.spec.ts @@ -331,16 +331,37 @@ test.describe("session ID links", () => { await expectSessionTitle(page, "Timeline visual stability") const markdown = page.locator('[data-component="markdown"]').filter({ hasText: "Visit" }) await expect(markdown).toHaveAttribute("data-markdown-ready", "") - await expect(markdown.getByRole("button", { name: "Linked session", exact: true })).toHaveCount(2) + await expect(markdown.getByRole("button", { name: "@Linked session", exact: true })).toHaveCount(2) await markdown .locator("p") .filter({ hasText: "Or" }) - .getByRole("button", { name: "Linked session", exact: true }) + .getByRole("button", { name: "@Linked session", exact: true }) .press("Enter") await expectPath(page, sessionHref(target)) await expect(page.locator(`[data-titlebar-tab-link][href$="/session/${target}"]`)).toContainText("Linked session") }) + test("titles a session this window never loaded and copies its ID from the context menu", async ({ + page, + context, + }) => { + await context.grantPermissions(["clipboard-read", "clipboard-write"]) + await setupTimeline(page, { + sessions: [session(), session({ id: target, title: "Linked session" })], + messages: [userMessage(), assistantMessage([textPart("prt_session_menu", `Visit ${target}.`)])], + }) + await expectSessionTitle(page, "Timeline visual stability") + const markdown = page.locator('[data-component="markdown"]').filter({ hasText: "Visit" }) + await expect(markdown).toHaveAttribute("data-markdown-ready", "") + await markdown.getByRole("button", { name: "@Linked session", exact: true }).click({ button: "right" }) + await expect(page.getByRole("menuitem", { name: "Open Session", exact: true })).toBeVisible() + await expect(page.getByRole("menuitem", { name: "Copy Session Title", exact: true })).toBeVisible() + await page.getByRole("menuitem", { name: "Copy Session ID", exact: true }).click() + await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(target) + await expect(page.getByRole("menu")).toHaveCount(0) + await expectPath(page, sessionHref(sessionID)) + }) + test("does not navigate to an ID that is absent from the current server", async ({ page }) => { await setupTimeline(page, { messages: [userMessage(), assistantMessage([textPart("prt_session_missing", `See ${missing}.`)])], diff --git a/packages/app/e2e/regression/tabs.spec.ts b/packages/app/e2e/regression/tabs.spec.ts index ca9480cb95..080c638976 100644 --- a/packages/app/e2e/regression/tabs.spec.ts +++ b/packages/app/e2e/regression/tabs.spec.ts @@ -334,10 +334,11 @@ for (const [tabLayout, direction, label] of [ await tabB.click({ button: "right" }) await expect(menu.getByRole("menuitem")).toHaveText([ "Rename", + "Export…", "Close tab", "Close other tabs", label, - "Delete session…", + "Delete…", ]) await menu.getByRole("menuitem", { name: "Close other tabs", exact: true }).click() await expect(titles).toHaveText([b.title]) @@ -439,7 +440,7 @@ for (const tabLayout of ["horizontal", "vertical"] as const) { await expect(title).toHaveText(a.title) await title.click({ button: "right" }) - await page.getByRole("menuitem", { name: "Delete session…", exact: true }).click() + await page.getByRole("menuitem", { name: "Delete…", exact: true }).click() const dialog = page.getByRole("dialog") await dialog.getByRole("button", { name: "Cancel", exact: true }).click() @@ -447,7 +448,7 @@ for (const tabLayout of ["horizontal", "vertical"] as const) { await expect(title).toHaveText(a.title) await title.click({ button: "right" }) - await page.getByRole("menuitem", { name: "Delete session…", exact: true }).click() + await page.getByRole("menuitem", { name: "Delete…", exact: true }).click() await dialog.getByRole("button", { name: "Delete session", exact: true }).click() await remove await expect(title).toHaveCount(0) @@ -654,6 +655,130 @@ test("icon-only inactive tabs retain their avatar and attention badge instead of await expect(tabB.locator('[data-slot="tab-avatar-unread-dot"]')).toHaveCount(0) }) +test("an unread tab whose run failed shows the failed dot, as the inbox does", async ({ page }) => { + const time = { created: T0, updated: T0, idle: T0 + 1 } + + await mockWorkspace(page, { + name: "FailedTabs", + sessions: [a, { ...b, outcome: "failed", time }, { ...c, outcome: "succeeded", time }], + }) + await page.goto(sessionHref(a.id)) + const tab = (id: string) => page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(id)}"])`) + + await expect(tab(b.id).locator('[data-mark="failed"]')).toBeVisible() + await expect(tab(b.id).locator('[data-mark="unread"]')).toBeHidden() + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeVisible() + await expect(tab(c.id).locator('[data-mark="failed"]')).toBeHidden() + + await tab(c.id).locator("[data-titlebar-tab-link]").click({ button: "right" }) + await page.getByRole("menuitem", { name: "Mark as read", exact: true }).click() + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeHidden() + await tab(c.id).locator("[data-titlebar-tab-link]").click({ button: "right" }) + await expect(page.getByRole("menu").getByRole("menuitem")).toHaveText([ + "Rename", + "Export…", + "Mark as unread", + "Close tab", + "Close other tabs", + "Close tabs to the right", + "Delete…", + ]) + await page.getByRole("menuitem", { name: "Mark as unread", exact: true }).click() + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeVisible() + await tab(c.id).locator("[data-titlebar-tab-link]").click() + await expectPath(page, sessionHref(c.id)) + await tab(c.id).locator("[data-titlebar-tab-link]").click({ button: "right" }) + await page.getByRole("menuitem", { name: "Mark as unread", exact: true }).click() + await page.mouse.move(0, 0) + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeVisible() + await expect(tab(c.id).locator('[data-slot="tab-status"]')).toHaveCSS("opacity", "1") + await tab(a.id).locator("[data-titlebar-tab-link]").click() + await expectPath(page, sessionHref(a.id)) + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeVisible() + await tab(c.id).locator("[data-titlebar-tab-link]").click() + await expectPath(page, sessionHref(c.id)) + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeHidden() + await tab(a.id).locator("[data-titlebar-tab-link]").click() + await expectPath(page, sessionHref(a.id)) + await expect(tab(c.id).locator('[data-mark="unread"]')).toBeHidden() +}) + +test("Recent and Pinned rows show the side tabs' status dots and shortcuts for sessions that aren't open as tabs", async ({ + page, +}) => { + const d = { id: "ses_tab_d", title: "Tab D session" } + + await mockWorkspace(page, { + name: "RecentUnread", + sessions: [ + { ...a, time: { created: T0 + 3, updated: T0 + 3 } }, + { ...b, outcome: "failed", time: { created: T0 + 1, updated: T0 + 1, idle: T0 + 1 } }, + { ...c, outcome: "succeeded", time: { created: T0 + 2, updated: T0 + 2, idle: T0 + 2 } }, + { ...d, time: { created: T0, updated: T0 } }, + ], + sessionStatus: { [d.id]: { type: "running" } }, + sessionPermissions: { + [d.id]: [ + { id: "permission-recent-d", sessionID: d.id, action: "shell", resources: ["ls"], metadata: {}, save: [] }, + ], + }, + seed: { + tabs: [], + settings: { appearance: { tabLayout: "vertical" }, general: { sidebarOrganize: "recent" } }, + }, + }) + // Recent is offered only on desktop, whose fixture names the server "sidecar". + const href = (id: string) => sessionHref(id, "sidecar") + await page.goto(`/e2e/utils/windows-menu.html?${new URLSearchParams({ server: SERVER, path: href(a.id) })}`) + const sidebar = page.locator('[data-slot="sidebar-recent"]') + const row = (id: string) => sidebar.locator(`[data-titlebar-tab-slot]:has(a[href="${href(id)}"])`) + const link = (id: string) => row(id).locator("[data-titlebar-tab-link]") + + await expect(link(a.id)).toHaveAttribute("aria-current", "page") + await expect(row(c.id).locator('[data-mark="unread"]')).toBeVisible() + await expect(row(c.id).locator('[data-mark="failed"]')).toBeHidden() + // A permission asked before the window connected marks the running session, as on an unselected side tab. + await expect(row(d.id).locator('[data-mark="attention"]')).toBeVisible() + + await link(b.id).click({ button: "right" }) + await page.getByRole("menuitem", { name: "Pin", exact: true }).click() + const pinned = page.getByRole("group", { name: "Pinned", exact: true }) + await expect(pinned.locator(`a[href="${href(b.id)}"]`)).toHaveCount(1) + await expect(row(b.id).locator('[data-mark="failed"]')).toBeVisible() + await expect(row(b.id).locator('[data-mark="unread"]')).toBeHidden() + + // The next-unread shortcut steps through Recent rows like side tabs; opening the finished session clears its dot. + await page.keyboard.press("Shift+Alt+ArrowDown") + await expect(link(c.id)).toHaveAttribute("aria-current", "page") + await expect(row(c.id).locator('[data-mark="unread"]')).toBeHidden() + await link(a.id).click() + await expect(link(a.id)).toHaveAttribute("aria-current", "page") + await expect(row(c.id).locator('[data-mark="unread"]')).toBeHidden() + await expect(row(b.id).locator('[data-mark="failed"]')).toBeVisible() +}) + +test("an unfocused window preserves a restored manual unread reminder", async ({ page }) => { + // Playwright emulates focus for each page, so model a background window explicitly. + await page.addInitScript(() => { + document.hasFocus = () => false + }) + await mockWorkspace(page, { + name: "BackgroundUnread", + sessions: [a, { ...c, time: { created: T0, updated: T0, idle: T0, viewed: T0 } }], + seed: { storage: { "opencode.global.dat:notification.manual-unread": { sessions: [c.id] } } }, + }) + await page.goto(sessionHref(c.id)) + await expectSessionTitle(page, c.title) + const tab = page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(c.id)}"])`) + + await expect(tab.locator('[data-mark="unread"]')).toBeVisible() + await page.evaluate(() => { + document.hasFocus = Document.prototype.hasFocus.bind(document) + window.dispatchEvent(new Event("focus")) + }) + await expect(tab.locator('[data-mark="unread"]')).toBeHidden() +}) + test("vertical tabs resize, scroll, show shortcut hints, and navigate", async ({ page }) => { await page.setViewportSize({ width: 1280, height: 480 }) const directory = "C:/OpenCode/Tabs" @@ -1060,6 +1185,10 @@ test("a remote tab stays busy while a child session runs", async ({ page }) => { test("inactive tabs stay busy while work waits in their inbox, and pulse on a new prompt, as in the TUI", async ({ page, }) => { + // An inactive tab reads its inbox after a delay. The mock's inbox never gains pushed items, so a prompt pushed + // before that read starts would be replaced by the older snapshot. + const inboxC = page.waitForResponse(new RegExp(`/api/session/${c.id}/inbox(\\?|$)`)) + const workspace = await openSession(page, { name: "TabInbox", sessions: [a, b, c], @@ -1088,6 +1217,7 @@ test("inactive tabs stay busy while work waits in their inbox, and pulse on a ne const progress = '[data-component="activity-ring"]' await expect(tab(b.id).locator(progress)).toBeVisible() + await inboxC await expect(tab(c.id).locator("[data-titlebar-tab-title]")).toHaveText(c.title) await expect(tab(c.id).locator(progress)).toBeHidden() await expect(tab(c.id).locator('[data-slot="tab-prompt-pulse"]')).toHaveCount(0) @@ -1470,8 +1600,10 @@ test("tab shortcuts cycle side-panel tabs when the side panel is focused with mu }) test("⌘W past the side panel's last tab keeps the session tab", async ({ page }) => { - const sessions = await emptySidePanel(page) + await page.clock.install() + const sessions = await emptySidePanel(page, () => holdClock(page)) await page.keyboard.press("ControlOrMeta+w") + await page.clock.resume() // From the composer ⌘W closes the session tab, so only a swallowed press above leaves Beta to land on. await page.getByRole("textbox", { name: "Prompt", exact: true }).click() @@ -1480,6 +1612,35 @@ test("⌘W past the side panel's last tab keeps the session tab", async ({ page await expect(sessions.alphaTab).toHaveCount(0) }) +test("⌘W past the side panel's last tab closes the session tab once ⌘W has rested", async ({ page }) => { + await page.clock.install() + const sessions = await emptySidePanel(page, () => holdClock(page)) + + // Each ⌘W within the rest is swallowed and restarts it, so the third lands 800ms after the panel closed. + await page.keyboard.press("ControlOrMeta+w") + await page.clock.runFor(400) + await page.keyboard.press("ControlOrMeta+w") + await page.clock.runFor(400) + await page.keyboard.press("ControlOrMeta+w") + await expect(sessions.alphaTab).toHaveCount(1) + + await page.clock.runFor(600) + await page.clock.resume() + await page.keyboard.press("ControlOrMeta+w") + await expectPath(page, sessionHref(sessions.beta.id)) + await expect(sessions.alphaTab).toHaveCount(0) +}) + +test("⌘⇧T brings back a side tab and opens the side panel it closed with", async ({ page }) => { + await emptySidePanel(page) + const panel = page.locator("#review-panel") + + await page.getByRole("textbox", { name: "Prompt", exact: true }).click() + await page.keyboard.press("ControlOrMeta+Shift+t") + await expect(panel).toHaveAttribute("aria-hidden", "false") + await expect(panel.getByRole("tab", { selected: true })).toHaveCount(1) +}) + test("⌘W past the side panel's last tab keeps the session tab when focus leaves the panel just after", async ({ page, }) => { @@ -1501,10 +1662,12 @@ test("⌘W past the side panel's last tab keeps the session tab when focus leave observer.observe(document, { subtree: true, attributes: true, attributeFilter: ["aria-hidden"] }) }) - const sessions = await emptySidePanel(page) + await page.clock.install() + const sessions = await emptySidePanel(page, () => holdClock(page)) const composer = page.getByRole("textbox", { name: "Prompt", exact: true }) await expect(composer).toBeFocused() await page.keyboard.press("ControlOrMeta+w") + await page.clock.resume() // Only a swallowed press above leaves Beta for this one to land on. await composer.click() @@ -1524,6 +1687,7 @@ test("⌘W closes the session tab again once the window loses focus after the si test("⌘W in the side panel closes its last New tab with the panel, and only then the session tab", async ({ page }) => { await page.setViewportSize({ width: 1440, height: 900 }) + await page.clock.install() const alpha = { id: "ses_side_new_alpha", title: "Side new alpha" } const beta = { id: "ses_side_new_beta", title: "Side new beta" } await openSession(page, { name: "SideCloseNewTab", sessions: [alpha, beta] }) @@ -1542,6 +1706,7 @@ test("⌘W in the side panel closes its last New tab with the panel, and only th await panel.getByRole("button", { name: /^Open file/ }).focus() // The New tab was the panel's last tab, so closing it closes the panel too, and focus goes back. + await holdClock(page) await page.keyboard.press("ControlOrMeta+w") await expect(newTab).toHaveCount(0) await expect(toggle).toHaveAttribute("aria-expanded", "false") @@ -1550,6 +1715,7 @@ test("⌘W in the side panel closes its last New tab with the panel, and only th // One press too many closes nothing rather than the session. await page.keyboard.press("ControlOrMeta+w") await expect(alphaTab).toHaveCount(1) + await page.clock.resume() await expectPath(page, sessionHref(alpha.id)) // With no panel open, ⌘W from the composer closes the session tab. @@ -1702,8 +1868,64 @@ test("⌘W in a focused Context tab closes it, then the panel, and keeps the ses await expectPath(page, sessionHref(alpha.id)) }) +test("with the side panel open, ⌘W closes its tabs from anywhere, ⌥⌘W the session tab, and ⌘⇧T undoes them newest first", async ({ + page, +}) => { + await page.setViewportSize({ width: 1440, height: 900 }) + const directory = "C:/OpenCode/SideCloseAnywhere" + const alpha = { id: "ses_side_anywhere_alpha", title: "Side anywhere alpha" } + const beta = { id: "ses_side_anywhere_beta", title: "Side anywhere beta" } + await openSession(page, { + name: "SideCloseAnywhere", + sessions: [alpha, beta], + fileList: (path) => (path ? [] : ["README.md"].map((file) => fileNode(directory, file))), + fileContent: (path) => ({ type: "text", content: `contents:${path}` }), + seed: { + panes: { [alpha.id]: { review: true }, [beta.id]: { review: true } }, + storage: reviewTabs(directory, alpha.id), + }, + }) + + const panel = page.locator("#review-panel") + const fileTab = panel.getByRole("tab", { name: "README.md", exact: true }) + const composer = page.getByRole("textbox", { name: "Prompt", exact: true }) + const sessionTab = (id: string) => page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(id)}"])`) + + // ⌥⌘W closes Beta's session tab although its side panel holds a tab that ⌘W would close. + await sessionTab(beta.id).locator("a").click() + await expectPath(page, sessionHref(beta.id)) + await expect(panel.getByRole("tab", { name: "New tab", exact: true })).toHaveAttribute("aria-selected", "true") + await composer.click() + await page.keyboard.press("ControlOrMeta+Alt+w") + await expect(sessionTab(beta.id)).toHaveCount(0) + await expectPath(page, sessionHref(alpha.id)) + + await openFileLauncher(panel) + await panel.getByRole("treeitem", { name: "README.md", exact: true }).click() + await expect(fileTab).toHaveAttribute("aria-selected", "true") + + // From the composer, ⌘W closes the side tab, not the session tab. + await composer.click() + await page.keyboard.press("ControlOrMeta+w") + await expect(fileTab).toHaveCount(0) + await expect(sessionTab(alpha.id)).toHaveCount(1) + await expectPath(page, sessionHref(alpha.id)) + + // The side tab closed after Beta, so it comes back first, then Beta. + await page.keyboard.press("ControlOrMeta+Shift+t") + await expect(fileTab).toHaveAttribute("aria-selected", "true") + await expect(sessionTab(beta.id)).toHaveCount(0) + await page.keyboard.press("ControlOrMeta+Shift+t") + await expect(sessionTab(beta.id)).toHaveCount(1) + await expectPath(page, sessionHref(beta.id)) +}) + +// Stops the clock `page.clock.install()` set up, so the ⌘W guard's rest after the panel empties only moves when the +// test moves it, however slow the runner. +const holdClock = (page: Page) => page.evaluate(() => Date.now()).then((now) => page.clock.pauseAt(now + 1_000)) + // Closes Alpha's side tabs with ⌘W until the side panel empties and collapses, as an overshooting hand would. -async function emptySidePanel(page: Page) { +async function emptySidePanel(page: Page, beforeLastClose?: () => Promise) { await page.setViewportSize({ width: 1440, height: 900 }) const directory = "C:/OpenCode/SideCloseOvershoot" const alpha = { id: "ses_side_close_alpha", title: "Side close alpha" } @@ -1730,6 +1952,7 @@ async function emptySidePanel(page: Page) { await page.keyboard.press("ControlOrMeta+w") await expect(fileTab).toHaveCount(0) await expect(reviewTab).toHaveAttribute("aria-selected", "true") + await beforeLastClose?.() await page.keyboard.press("ControlOrMeta+w") await expect(panel).toHaveAttribute("aria-hidden", "true") @@ -1782,6 +2005,39 @@ 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("renaming an inbox card updates the same session on Home", async ({ page }) => { + await mockWorkspace(page, { + name: "RenameInbox", + sessions: [ + { id: "ses_rename_inbox", title: "Original inbox title" }, + { id: "ses_rename_kept", title: "Unchanged title" }, + ], + seed: { settings: { appearance: { tabLayout: "inbox" } }, tabs: [] }, + }) + await page.goto("/") + const inbox = page.locator('[data-slot="sidebar-inbox"]') + + const home = page.locator('[data-component="home-session-row-container"][data-session-id="ses_rename_inbox"]') + + await expect(home).toContainText("Original inbox title") + await inbox + .locator('[data-slot="sidebar-inbox-item"]') + .filter({ hasText: "Original inbox title" }) + .click({ button: "right" }) + await page.getByRole("menuitem", { name: "Rename", exact: true }).click() + const dialog = page.getByRole("dialog") + + await dialog.getByRole("textbox").fill("Renamed inbox title") + await dialog.getByRole("button", { name: "Save", exact: true }).click() + await expect(dialog).toBeHidden() + await expect( + inbox.locator('[data-slot="sidebar-inbox-item"]').filter({ hasText: "Renamed inbox title" }), + ).toHaveCount(1) + await expect(inbox.getByText("Original inbox title", { exact: true })).toHaveCount(0) + await expect(inbox.getByText("Unchanged title", { exact: true })).toBeVisible() + await expect(home).toContainText("Renamed inbox title") +}) + test("the inbox Archived dialog searches only archived sessions and restores the selected session", async ({ page, }) => { @@ -1830,14 +2086,69 @@ test("the inbox Archived dialog searches only archived sessions and restores the await expect(dialog.getByText("No results found", { exact: true })).toBeVisible() await search.fill("First archived") await expect(dialog.getByRole("option")).toHaveCount(1) - await expect(dialog.getByRole("option", { name: /First archived session/ })).toHaveAttribute("aria-selected", "true") + const option = dialog.getByRole("option", { name: /First archived session/ }) + await expect(option).toHaveAttribute("aria-selected", "true") + + // 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 ({ + page, +}) => { + await mockWorkspace(page, { + name: "DeleteInbox", + sessions: [ + { id: "ses_delete_kept", title: "Kept inbox session", time: { created: T0, updated: T0, idle: T0, viewed: T0 } }, + { + id: "ses_delete_target", + title: "Deleted inbox session", + time: { created: T0, updated: T0 + 1, idle: T0 + 1, viewed: T0 + 1 }, + }, + ], + seed: { settings: { appearance: { tabLayout: "inbox" } }, tabs: [] }, + }) + const remove = await holdRoute(page, /\/api\/session\/ses_delete_target(\?|$)/, { method: "DELETE" }) + await page.goto("/") + + const rows = page.locator('[data-slot="sidebar-inbox"] [data-slot="sidebar-inbox-item"]') + await expect(rows).toHaveCount(2) + await rows.filter({ hasText: "Deleted inbox session" }).click({ button: "right" }) + await page.getByRole("menuitem", { name: "Delete…", exact: true }).click() + + const confirm = page.getByRole("dialog", { name: "Delete session" }) + await confirm.getByRole("button", { name: "Delete session", exact: true }).click() + await remove.arrived + await expect(confirm).toHaveCount(0) + await expect(rows).toHaveCount(1) + await expect(rows).toContainText("Kept inbox session") + + await page.getByRole("button", { name: "Search sessions", exact: true }).click() + const search = page.getByRole("dialog") + await expect(search.getByRole("combobox")).toBeFocused() + + const removed = page.waitForResponse( + (response) => response.request().method() === "DELETE" && response.url().includes("/api/session/ses_delete_target"), + ) + + remove.release() + await removed + await expect(search.getByRole("combobox")).toBeFocused() + expect(remove.requests).toHaveLength(1) +}) + test("opening a working session expands its shelf and still allows manual collapse", async ({ page }) => { await openSession(page, { name: "WorkingInbox", @@ -1990,6 +2301,17 @@ test("the inbox keeps every unread result separate from expandable Recent, inclu await inbox.getByRole("button", { name: "Show less", exact: true }).click() await expect(recent).toHaveCount(10) await expect(unread).toHaveCount(12) + + const marked = page.getByText("Read session 1", { exact: true }) + + await recent.filter({ has: marked }).click({ button: "right" }) + await page.getByRole("menuitem", { name: "Mark as unread", exact: true }).click() + 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 ({ @@ -2029,15 +2351,21 @@ test("the inbox waits for initial requests and orders attention by waiting age r }) const pending = await holdRoute(page, /\/api\/session\/ses_waiting_old\/permission(?:\?|$)/) + // Running sessions join Working only once this snapshot loads, which can be after the inbox shows; runs it reveals + // had already started, so they are not announced. + const running = await holdRoute(page, /\/api\/session\/active(?:\?|$)/) await page.goto("/") - await pending.arrived + await Promise.all([pending.arrived, running.arrived]) const inbox = page.locator('[data-slot="sidebar-inbox"]') await expect(inbox).toHaveAttribute("aria-busy", "true") await expect(inbox.getByText("Sessions you work on will appear here", { exact: true })).toHaveCount(0) + const checked = page.waitForResponse(/\/api\/session\/ses_waiting_old\/permission(?:\?|$)/) pending.release() + await checked + running.release() const needs = inbox .getByRole("group", { name: "Needs attention", exact: true }) diff --git a/packages/app/e2e/regression/terminal.spec.ts b/packages/app/e2e/regression/terminal.spec.ts index aa0ee3cafb..3cbcf093aa 100644 --- a/packages/app/e2e/regression/terminal.spec.ts +++ b/packages/app/e2e/regression/terminal.spec.ts @@ -58,6 +58,8 @@ test("after a reload, the close shortcut closes the restored terminal", async ({ await openSide(page) await showTerminal(page, "Shell", "pty_shell") + // Focus comes before the connection; a reload during its connect-token request would leave nothing connected. + await expect.poll(() => persistentPty.sockets.map((socket) => socket.id)).toEqual(["pty_shell"]) // The restored tab is selected before the server lists the session's terminals. const list = await holdRoute(page, /\/api\/experimental\/session\/ses_terminals\/terminal(\?|$)/, { method: "GET" }) @@ -189,6 +191,29 @@ test("a click into the composer while a new terminal is created keeps the focus await expect(editor).toBeFocused() }) +// Both presses used to send a create, so two tabs both titled "Terminal 1" opened. +test("pressing New terminal again while one is created creates one terminal", async ({ page }) => { + const { persistentPty, editor } = await openSession(page, { name: "Terminals", persistentPty: {} }) + + const create = await holdRoute(page, /\/api\/experimental\/session\/ses_terminals\/terminal(\?|$)/, { + method: "POST", + }) + + await editor.click() + await page.keyboard.press("Control+Alt+T") + await create.arrived + await page.keyboard.press("Control+Alt+T") + create.release() + + await expect(side(page).getByRole("tab", { name: "Terminal 1", exact: true })).toHaveAttribute( + "aria-selected", + "true", + ) + await expect(terminalScreen(page, persistentPty.created[0]!.id).locator("textarea")).toBeFocused() + expect(create.requests).toHaveLength(1) + expect(persistentPty.created.map((info) => info.title)).toEqual(["Terminal 1"]) +}) + test("another client's control ends at a click, which resizes the terminal to the pane", async ({ page }) => { const { persistentPty } = await openSession(page, { name: "Terminals", @@ -288,6 +313,37 @@ test("a terminal list that fails says why, and Try again lists the terminals", a await expect(side(page).getByText("Couldn't load terminals", { exact: true })).toHaveCount(0) }) +// A list the server accepted and never answered used to leave "Loading terminal." on screen with no way to retry. +test("a terminal list the server never answers says so, and Try again lists the terminals", async ({ page }) => { + await openSession(page, { + name: "Terminals", + persistentPty: { initial: [{ id: "pty_build", sessionID: SESSION, title: "Build", output: "still-here\r\n" }] }, + }) + + await openSide(page) + await side(page).getByRole("tab", { name: "Build", exact: true }).click() + const screen = terminalScreen(page, "pty_build") + await expect.poll(() => terminalText(page, screen)).toBe("still-here") + + const list = await holdRoute(page, /\/api\/experimental\/session\/ses_terminals\/terminal(\?|$)/, { method: "GET" }) + await page.clock.install() + await page.reload() + await list.arrived + await expect(side(page).getByText("Loading terminal…", { exact: true })).toBeVisible() + // The request budget, `TERMINAL_REQUEST_TIMEOUT_MS`. + await page.clock.fastForward(15_000) + + const failure = side(page).getByRole("alert") + await expect(failure.getByText("Couldn't load terminals", { exact: true })).toBeVisible() + await expect(failure.getByText("The server took too long to answer", { exact: true })).toBeVisible() + + list.release() + await failure.getByRole("button", { name: "Try again", exact: true }).click() + + await expect(side(page).getByRole("tab", { name: "Build", exact: true })).toHaveAttribute("aria-selected", "true") + await expect.poll(() => terminalText(page, screen)).toBe("still-here") +}) + test("after a server restart, showing the terminal again restores it from a new snapshot", async ({ page }) => { const output = "before-restart\r\n" @@ -373,11 +429,21 @@ test("selected terminal output quotes into the composer", async ({ page }) => { await side(page).getByRole("tab", { name: "Build", exact: true }).click() const screen = terminalScreen(page, "pty_quote") await expect.poll(() => terminalText(page, screen)).toBe("quote-me") + const toolbar = page.getByRole("toolbar", { name: "Quote selection", exact: true }) + await expect(toolbar).toBeVisible() - await page - .getByRole("toolbar", { name: "Quote selection", exact: true }) - .getByRole("button", { name: "Quote" }) - .click() + // A right click opens a context menu without a pointerup; it neither closes the toolbar nor blocks later reads. + await page.locator("body").dispatchEvent("pointerdown", { button: 2 }) + await page.locator("body").dispatchEvent("contextmenu") + await expect(toolbar).toBeVisible() + + // A cancelled touch ends without a pointerup too; the selection it left in place gets its toolbar back. + await page.locator("body").dispatchEvent("pointerdown", { button: 0 }) + await expect(toolbar).toHaveCount(0) + await page.locator("body").dispatchEvent("pointercancel") + await expect(toolbar).toBeVisible() + + await toolbar.getByRole("button", { name: "Quote" }).click() await expect(page.locator('[data-component="composer"]').getByText("quote-me")).toBeVisible() }) diff --git a/packages/app/e2e/regression/timeline-geometry.spec.ts b/packages/app/e2e/regression/timeline-geometry.spec.ts index f5990a4fd6..4e19574c8e 100644 --- a/packages/app/e2e/regression/timeline-geometry.spec.ts +++ b/packages/app/e2e/regression/timeline-geometry.spec.ts @@ -630,6 +630,37 @@ test("keeps a reader scrolled up in place when they submit a prompt", async ({ p await expect.poll(fromEnd).toBeLessThanOrEqual(1) }) +test("takes a reader scrolled up short of the jump button to their submitted prompt", async ({ page }) => { + await setupTimeline(page, { + reducedMotion: true, + sessionMessages: [ + ...validateTimelineMessages([...historyMessages(18), userMessage()]), + { id: "msg_1002_timeline_idle", type: "idle", outcome: "succeeded", time: { created: 1700000003000 } }, + ], + }) + const scroller = page.locator('[data-slot="session-timeline-scroll"] > [data-scrollable]') + const fromEnd = () => scroller.evaluate((element) => element.scrollHeight - element.clientHeight - element.scrollTop) + const jump = page.getByRole("button", { name: "Jump to latest" }) + const editor = page.locator('[data-component="composer"]').getByRole("textbox") + await expect(page.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible") + await expect.poll(fromEnd).toBeLessThanOrEqual(1) + + await scroller.hover() + + // Back-to-back prompts, each sent after a small scroll up, bring the reader down to the one just sent. + for (const text of ["First prompt sent just above the end.", "Second prompt sent right after."]) { + await page.mouse.wheel(0, -150) + await expect.poll(fromEnd).toBeGreaterThan(100) + // The hidden button only fades out, so its inert wrapper is what says it is not offered. + await expect(jump.locator("xpath=..")).toHaveAttribute("inert") + await editor.fill(text) + await editor.press("Enter") + await expect(editor).toHaveText("") + await expect(page.locator('[data-timeline-row="UserMessage"]').filter({ hasText: text })).toBeInViewport() + await expect.poll(fromEnd).toBeLessThanOrEqual(1) + } +}) + async function captureCardEdges(page: Page, card: Locator) { const box = await card.boundingBox() @@ -853,9 +884,9 @@ test("groups consecutive sent prompts under the last one's meta line, with each await expect(first.locator('[data-slot="user-message-copy-wrapper"]')).toBeHidden() await expect(last.locator('[data-slot="user-message-copy-wrapper"]')).toBeVisible() - // The first message keeps its own actions, shown beside its bubble on hover. + // The first message keeps its own actions, in a chevron its bubble shows on hover. await bubble(first).hover() - await expect(first.locator('[data-slot="user-message-run-actions"]')).toHaveCSS("opacity", "1") + await expect(first.locator('[data-slot="user-message-menu"]')).toHaveCSS("opacity", "1") await expect(first.getByRole("button", { name: "More actions" })).toHaveCount(1) }) diff --git a/packages/app/e2e/regression/timeline-history.spec.ts b/packages/app/e2e/regression/timeline-history.spec.ts index 8beb71693d..954e4f96b6 100644 --- a/packages/app/e2e/regression/timeline-history.spec.ts +++ b/packages/app/e2e/regression/timeline-history.spec.ts @@ -40,7 +40,6 @@ test.describe("timeline history", () => { ] const requests: (string | undefined)[] = [] - await page.clock.install() await openSession(page, { name: "HistoryRestore", sessions: [{ id }, { id: other, directory: "C:/OpenCode/HistoryOther" }], @@ -68,6 +67,9 @@ test.describe("timeline history", () => { await page.locator(`[data-slot="titlebar-tabs"] a[href="${sessionHref(other)}"]`).click() await expect(page.getByText("Other session", { exact: true })).toBeVisible() + // Only the return needs controlled time. A fake clock from the start also runs the first mount's frames late, + // and a scroll to the end queued by one of them lands after the upward gesture. + await page.clock.install() await page.locator(`[data-slot="titlebar-tabs"] a[href="${sessionHref(id)}"]`).click() await expect(page.locator("[data-timeline-virtual-content]")).toHaveCSS("visibility", "visible") // Exhaust the delayed leading-turn enrichment without a real-time sleep. diff --git a/packages/app/e2e/regression/timeline-stream.spec.ts b/packages/app/e2e/regression/timeline-stream.spec.ts index 1fc26e2609..54f3e0dbc8 100644 --- a/packages/app/e2e/regression/timeline-stream.spec.ts +++ b/packages/app/e2e/regression/timeline-stream.spec.ts @@ -1155,7 +1155,9 @@ test.describe("background shortcut", () => { const capsule = page.getByRole("button", { name: "1 shell", exact: true, includeHidden: true }) const list = page.getByRole("menu", { name: "1 shell", exact: true }) const closed = (await capsule.boundingBox())! - const inset = (await capsule.locator('[data-component="session-progress-indicator-v2"]').boundingBox())!.x - closed.x + + const inset = + (await capsule.locator('[data-component="session-progress-indicator-v2"]').boundingBox())!.x - closed.x await capsule.click() // Right placement shares the capsule's end edge and mirrors its inset there; centre placement shares its centre. @@ -1400,13 +1402,23 @@ test.describe("background shortcut", () => { await interrupt await expect(list).toBeVisible() - const kill = page.waitForRequest( - (request) => request.method() === "DELETE" && new URL(request.url()).pathname === "/api/shell/shell_backgrounded", - ) + const kill = await holdRoute(page, /\/api\/shell\/shell_backgrounded(\?|$)/, { method: "DELETE" }) + const shellRow = list.getByRole("menuitem", { name: /sleep 120/ }) - await list.getByRole("menuitem", { name: /sleep 120/ }).hover() + await shellRow.hover() + await page.keyboard.press("Delete") + await kill.arrived + // A second Delete, or a click on the row's stop button, while the first stop runs sends nothing more. + const stopping = shellRow.getByRole("button", { name: "Kill shell command", exact: true }) + await expect(stopping).toHaveAttribute("aria-busy", "true") await page.keyboard.press("Delete") - await kill + // aria-disabled leaves a real click through, which Playwright's actionability check would refuse. + await stopping.click({ force: true }) + await expect(stopping).toHaveAttribute("aria-busy", "true") + expect(kill.requests).toHaveLength(1) + kill.release() + await expect(stopping).not.toHaveAttribute("aria-busy") + expect(kill.requests).toHaveLength(1) await page.keyboard.press("Escape") await expect(list).toHaveCount(0) await expect(backgroundCard).toContainText("Background task (background)") @@ -2208,6 +2220,44 @@ test("a pending quote send hides mentions and keeps the comment read-only", asyn await expect.poll(() => sent).toEqual(["queue"]) }) +test("a double-clicked quote send sends once and keeps the popup open until it settles", async ({ page }) => { + const sent: string[] = [] + + await setupTimeline(page, { + messages: [userMessage(), assistantMessage([textPart("prt_quote_double", "Keep this quoted passage.")])], + onPrompt: (input) => void sent.push(String(input.body.delivery)), + }) + + const answer = page.locator( + `[data-timeline-part-id="${renderedPartID("prt_quote_double")}"] [data-slot="text-part-body"]`, + ) + + await expect(answer).toHaveText("Keep this quoted passage.") + await selectQuoteText(answer) + await page + .getByRole("toolbar", { name: "Quote selection" }) + .getByRole("button", { name: "Quote", exact: true }) + .click() + const popup = page.locator('[data-component="composer-quote-comment"]') + + const chip = page.locator('[data-component="composer-attachments"] [data-component="attachment-card"]') + + const modifier = await page.evaluate(() => (/(Mac|iPod|iPhone|iPad)/.test(navigator.platform) ? "Meta" : "Control")) + + await popup.locator("textarea").fill("Only once") + const admission = await holdRoute(page, new RegExp(`/api/session/${sessionID}/prompt(\\?|$)`), { method: "POST" }) + + await popup.locator('[data-slot="line-comment-v2-submit"]').dblclick({ modifiers: [modifier] }) + await admission.arrived + // A click on the quote's chip while the send is in flight leaves the popup and its pending send alone. + await chip.click() + await expect(popup.locator('[data-component="loader-v2"]')).toBeVisible() + admission.release() + await expect(popup).toHaveCount(0) + await expect.poll(() => sent.length).toBe(1) + expect(admission.requests).toHaveLength(1) +}) + function selectQuoteText(target: Locator) { return target.evaluate((element) => { const range = document.createRange() @@ -3213,6 +3263,8 @@ test("opens an optional comment beside the quote action and skips it with Alt-cl await page.keyboard.press("Enter") await expect(comment).toHaveCount(0) await expect(chips.nth(0)).toContainText("Why first?") + // The editor takes focus back a frame after the comment closes, and its caret would replace the next selection. + await expect(editor).toBeFocused() await select("The second sentence to quote.") await toolbar.getByRole("button", { name: "Quote", exact: true }).click() @@ -3317,6 +3369,16 @@ test("reaches the quote action from the keyboard and blocks a selection over the await expect(more).not.toBeFocused() expect(await page.evaluate(() => !!document.activeElement?.closest('[data-component="timeline-quote"]'))).toBe(false) await expect(composer).toHaveCount(1) + + // A press that turns into a native drag of the selection ends with dragend, and no pointerup follows. + await page.evaluate(() => window.getSelection()?.removeAllRanges()) + await expect(toolbar).toHaveCount(0) + await short.hover() + await page.mouse.down() + await page.evaluate(() => document.dispatchEvent(new Event("dragend"))) + await short.evaluate((element) => window.getSelection()?.selectAllChildren(element)) + await expect(toolbar).toBeVisible() + await page.mouse.up() }) function pauseExitAnimations(locator: Locator) { diff --git a/packages/app/e2e/service-worker/cache.spec.ts b/packages/app/e2e/service-worker/cache.spec.ts index 2877b6730d..143fb11f1a 100644 --- a/packages/app/e2e/service-worker/cache.spec.ts +++ b/packages/app/e2e/service-worker/cache.spec.ts @@ -10,6 +10,11 @@ import { fileURLToPath } from "node:url" import { build } from "vite" import { onDemandAsset, serviceWorker } from "../../vite.pwa" +// The updater the web app ships (Settings › Updates and the titlebar), built into the fixture pages. +const updaterDriver = fileURLToPath( + new URL("../../../gui-plugins/src/updater/web-driver.ts", import.meta.url), +).replaceAll("\\", "/") + type Site = { url: string deploy: (fault?: "failed" | "html" | "corrupt" | "mixed-html" | "blocked") => void @@ -35,7 +40,20 @@ const fixture = test.extend<{ site: Site }, { builds: Record { document.querySelector("output").textContent = await (await import("./lazy.js")).load() - };`, + }; + // ?updater runs the web app's real update driver, with its actions as buttons. + if (location.search.includes("updater")) import(${JSON.stringify(updaterDriver)}).then(({ startWebUpdater }) => { + const state = Object.assign(document.createElement("p"), { ariaLabel: "Update state" }); + const announced = Object.assign(document.createElement("p"), { ariaLabel: "Update offered" }); + const updater = startWebUpdater({ + changed: (next) => (state.textContent = next.status), + announce: () => (announced.textContent = "yes"), + report: () => {}, + }); + state.textContent = updater.state().status; + const action = (name, run) => Object.assign(document.createElement("button"), { textContent: name, onclick: run }); + document.body.append(state, announced, action("Check for updates", updater.check), action("Update now", updater.apply), action("Reload from server", updater.reset)); + });`, "lazy.js": `export async function load() { return (await import("./nested.js")).value }`, "nested.js": `export const value = "${version} nested lazy loaded"`, "public/nested/data.json": JSON.stringify({ version }), @@ -286,7 +304,9 @@ fixture( replacement.evaluate(() => { // This runs in the service worker, whose global scope holds its registration. const registration = - "registration" in self && self.registration instanceof ServiceWorkerRegistration ? self.registration : undefined + "registration" in self && self.registration instanceof ServiceWorkerRegistration + ? self.registration + : undefined return { waiting: !!registration?.waiting, active: registration?.active?.state } }), @@ -301,6 +321,63 @@ fixture( }, ) +fixture( + "the updater offers a new build and moves every open tab to it with one click", + async ({ page, context, site }) => { + await install(page, `${site.url}/?updater`) + await expect(page.getByLabel("Update state")).toHaveText("idle") + const second = await context.newPage() + await second.goto(`${site.url}/?updater`) + await expect(second.getByLabel("Update state")).toHaveText("idle") + + site.deploy() + await page.getByRole("button", { name: "Check for updates" }).click() + await expect(page.getByLabel("Update state")).toHaveText("ready") + await expect(page.getByLabel("Update offered")).toHaveText("yes") + // Every tab hears about the download, not only the one that checked. + await expect(second.getByLabel("Update state")).toHaveText("ready") + // A tab opened while the build waits offers it at once; before, it waited for every tab to close. + const third = await context.newPage() + await third.goto(`${site.url}/?updater`) + await expect(third.getByRole("heading")).toHaveText("old") + await expect(third.getByLabel("Update state")).toHaveText("ready") + + await second.getByRole("button", { name: "Update now" }).click() + + for (const tab of [page, second, third]) { + await expect(tab.getByRole("heading")).toHaveText("new") + await expect(tab.getByLabel("Update state")).toHaveText("idle") + } + + await page.getByRole("button", { name: "Load lazy" }).click() + await expect(page.getByRole("status")).toHaveText("new nested lazy loaded") + }, +) + +fixture( + "reload from server replaces a saved build that cannot update, in every open tab", + async ({ page, context, site }) => { + await install(page, `${site.url}/?updater`) + const second = await context.newPage() + await second.goto(`${site.url}/?updater`) + await expect(second.getByLabel("Update state")).toHaveText("idle") + site.deploy("failed") + await page.getByRole("button", { name: "Check for updates" }).click() + await expect(page.getByLabel("Update state")).toHaveText("error") + await page.reload() + await expect(page.getByRole("heading")).toHaveText("old") + + await page.getByRole("button", { name: "Reload from server" }).click() + await expect(page.getByRole("heading")).toHaveText("new") + expect(await page.evaluate(() => navigator.serviceWorker.controller)).toBeNull() + expect(await page.evaluate(async () => (await caches.keys()).length)).toBe(0) + // The other tab's old lazy chunks went with the caches, so it reloads too instead of failing its next import. + await expect(second.getByRole("heading")).toHaveText("new") + await second.getByRole("button", { name: "Load lazy" }).click() + await expect(second.getByRole("status")).toHaveText("new nested lazy loaded") + }, +) + for (const fault of ["failed", "html", "corrupt", "mixed-html"] as const) { fixture(`retains the old complete build when a precache download is ${fault}`, async ({ page, context, site }) => { await install(page, site.url) diff --git a/packages/app/e2e/utils/console.ts b/packages/app/e2e/utils/console.ts new file mode 100644 index 0000000000..d8c200fbc2 --- /dev/null +++ b/packages/app/e2e/utils/console.ts @@ -0,0 +1,23 @@ +export const CONSOLE_URL = "https://opencode.ai/console" + +// An MCP server OpenCode Console delivers through its gateway, with the gateway token that names its workspace. +// `protocol` is the pin Console sets while the member hasn't connected their account. +export function consoleGateway(slug: string, options: { workspace?: string; protocol?: "2026-07-28" } = {}) { + const claims = Buffer.from(JSON.stringify({ u: "user_fixture", w: options.workspace ?? "org_acme", d: 1 })) + + return { + type: "remote", + url: `${CONSOLE_URL}/api/integration-gateway/${slug}/mcp`, + oauth: false, + headers: { authorization: `Bearer ocgw_${claims.toString("base64url")}.signature` }, + protocol: options.protocol, + } +} + +// The OpenCode Console integration with a saved sign-in. +export const consoleSignIn = { + id: "opencode", + name: "OpenCode", + methods: [{ id: "oauth", type: "oauth" }], + connections: [{ type: "credential", id: "cred_console", label: "Acme", method: "oauth" }], +} diff --git a/packages/app/e2e/utils/mock-api.ts b/packages/app/e2e/utils/mock-api.ts index a86f746f7f..914ed5c61f 100644 --- a/packages/app/e2e/utils/mock-api.ts +++ b/packages/app/e2e/utils/mock-api.ts @@ -39,6 +39,7 @@ const Query = Schema.Struct({ query: Schema.optional(Schema.String), type: Schema.optional(Schema.String), mode: Schema.optional(Schema.String), + context: Schema.optional(Schema.String), }) const SessionParams = { sessionID: Schema.String } @@ -149,6 +150,18 @@ const Group = HttpApiGroup.make("mock") error: MockNotFound.pipe(HttpApiSchema.status(404)), }), ) + .add( + HttpApiEndpoint.post( + "integrationOAuthComplete", + "/api/integration/:integrationID/connect/oauth/:attemptID/complete", + { + params: { integrationID: Schema.String, attemptID: Schema.String }, + payload: JsonPayload, + success: NoContent, + error: Unsupported, + }, + ), + ) .add( HttpApiEndpoint.delete("integrationOAuthCancel", "/api/integration/:integrationID/connect/oauth/:attemptID", { params: { integrationID: Schema.String, attemptID: Schema.String }, @@ -199,7 +212,12 @@ const Group = HttpApiGroup.make("mock") error: MockNotFound.pipe(HttpApiSchema.status(404)), }), ) - .add(HttpApiEndpoint.get("mcpResource", "/api/mcp/resource", { success: Json })) + .add( + HttpApiEndpoint.get("mcpResource", "/api/mcp/resource", { + success: Json, + error: MockInternal.pipe(HttpApiSchema.status(500)), + }), + ) .add(HttpApiEndpoint.get("projectList", "/api/project", { success: Json })) .add( HttpApiEndpoint.patch("projectUpdate", "/api/project/:projectID", { @@ -370,12 +388,7 @@ const Group = HttpApiGroup.make("mock") .add( HttpApiEndpoint.post("sessionView", "/api/session/:sessionID/view", { params: SessionParams, - success: NoContent, - }), - ) - .add( - HttpApiEndpoint.post("sessionView", "/api/session/:sessionID/view", { - params: SessionParams, + payload: Schema.Struct({ idle: Schema.Number }), success: NoContent, }), ) diff --git a/packages/app/e2e/utils/mock-server.ts b/packages/app/e2e/utils/mock-server.ts index 217c3ec7c2..6b06efc02d 100644 --- a/packages/app/e2e/utils/mock-server.ts +++ b/packages/app/e2e/utils/mock-server.ts @@ -1,6 +1,7 @@ import type { Page } from "@playwright/test" 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" import { Worktree } from "@opencode/schema/worktree" import { Effect, Layer, Option, Predicate, Schema } from "effect" @@ -86,12 +87,15 @@ export interface MockServerConfig { items: SessionMessageInfo[] cursor?: string } - vcs?: { current: string; default: string } | ((directory: string) => { current: string; default: string }) + vcs?: { current?: string; default: string } | ((directory: string) => { current?: string; default: string }) branches?: (input: { directory: string; search?: string; limit?: number }) => string[] | Promise // Initializes the mock project's VCS; without a handler this mutation answers 501. onVcsInit?: (input: { directory: string; provider?: string }) => void - vcsDiff?: unknown[] | ((input: { mode?: string }) => unknown[]) + // `directory` is the requested `location[directory]`, such as an untracked folder the review opened. + /** `context` is the patch's lines of context, sent when the review asks for a large file's full patch. */ + vcsDiff?: unknown[] | ((input: { mode?: string; directory: string; context?: string }) => unknown[]) beforeMessagesResponse?: (input: { sessionID: string; before?: string }) => Promise + beforeAgentsResponse?: () => Promise onMessages?: (input: { sessionID: string; before?: string; phase: "start" | "end" }) => void message?: (sessionID: string, messageID: string) => SessionMessageInfo | undefined onMessage?: (input: { sessionID: string; messageID: string }) => void @@ -120,9 +124,17 @@ export interface MockServerConfig { onMcpAction?: (input: { server: string; action: "connect" | "disconnect"; directory: string }) => void | MockMcpStatus // Starts an OAuth attempt (POST .../connect/oauth) and returns its authorization URL; the attempt then stays pending. // Without it, OAuth connects answer 501 MockUnsupported. - onIntegrationOAuth?: (input: { integrationID: string; directory: string; body: unknown }) => { url: string } + // `paste` starts a sign-in that also accepts the redirect URL pasted from the browser. + onIntegrationOAuth?: (input: { integrationID: string; directory: string; body: unknown }) => { + url: string + paste?: boolean + } // Answers status polls for an OAuth attempt; without it every attempt stays pending. onIntegrationOAuthStatus?: (attemptID: string) => "pending" | "complete" + // Accepts a pasted redirect URL (POST .../connect/oauth/:attemptID/complete). Without it, pastes answer 501. + onIntegrationOAuthComplete?: (input: { attemptID: string; body: unknown }) => void + // Returning true fails the next `/api/mcp/resource` listing with a 500. + mcpResourceFailures?: () => boolean // Runs on DELETE .../connect/oauth/:attemptID, which closes an OAuth attempt the dialog left. onIntegrationOAuthCancel?: (attemptID: string) => void plugins?: Resolvable @@ -133,8 +145,9 @@ export interface MockServerConfig { // and return the answer; by default it creates `/`. A created directory joins the project's sandboxes. onWorktreeCreate?: (input: Schema.Json) => void | MockAnswer | Promise onWorktreeRemove?: (input: Worktree.RemoveInput) => void | Promise - // POST /api/session keeps the client-reserved `id` and `location`. Return an answer to fail the attempt (1-based). - onSessionCreate?: (body: Schema.JsonObject, attempt: number) => void | MockAnswer + // POST /api/session keeps the client-reserved `id` and `location`. Return an answer to fail the attempt (1-based); the + // hook may hold the request. + onSessionCreate?: (body: Schema.JsonObject, attempt: number) => void | MockAnswer | Promise // Title of created sessions (default: the request's title, else "New session"). createdSessionTitle?: string // Slash commands served by `/api/command`. @@ -679,13 +692,26 @@ function mockHandlers( const path = decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)) const value = yield* Effect.promise(() => Promise.resolve(config.fileContent?.(path))) - if (Predicate.isString(value)) return HttpServerResponse.uint8Array(new TextEncoder().encode(value)) + // Like the server, every read is a sandboxed download; media keeps its type so elements can play it. + const options = { + contentType: ["image", "audio", "video"].includes(artifactKind(path)) + ? artifactMime(path) + : "application/octet-stream", + headers: { + "content-disposition": "attachment", + "content-security-policy": "default-src 'none'; img-src 'self'; media-src 'self'; sandbox", + "x-content-type-options": "nosniff", + }, + } + + if (Predicate.isString(value)) return HttpServerResponse.uint8Array(new TextEncoder().encode(value), options) // Like the server, stream base64 content as the bytes it encodes. return HttpServerResponse.uint8Array( value?.encoding === "base64" ? Buffer.from(value.content, "base64") : new TextEncoder().encode(value?.content ?? ""), + options, ) }), ) @@ -720,7 +746,8 @@ function mockHandlers( const payload = Option.getOrElse(decodeJsonObject(input), () => ({})) const fields = Option.getOrUndefined(decodeSessionCreate(payload)) state.sessionCreates += 1 - const answer = config.onSessionCreate?.(payload, state.sessionCreates) + const attempt = state.sessionCreates + const answer = yield* Effect.promise(async () => config.onSessionCreate?.(payload, attempt)) if (answer) return HttpServerResponse.jsonUnsafe(answer.body, { status: answer.status }) @@ -776,20 +803,23 @@ function mockHandlers( }), config: () => Effect.succeed(configEntries), reference: () => Effect.succeed({ location: location(config), data: [] }), + // `beforeAgentsResponse` holds the Location's agent list, as a cold Location does while its plugins activate. agent: (ctx) => - Effect.succeed({ - location: location(config, requestDirectory(config, ctx.request)), - data: [ - { - id: "build", - name: "Build", - mode: "primary", - hidden: false, - request: { settings: {}, headers: {}, body: {} }, - permissions: [], - }, - ], - }), + Effect.promise(async () => config.beforeAgentsResponse?.()).pipe( + Effect.as({ + location: location(config, requestDirectory(config, ctx.request)), + data: [ + { + id: "build", + name: "Build", + mode: "primary", + hidden: false, + request: { settings: {}, headers: {}, body: {} }, + permissions: [], + }, + ], + }), + ), provider: () => Effect.succeed({ location: location(config), data: currentProviders(resolve(config.provider)) }), model: () => Effect.succeed({ location: location(config), data: currentModels(resolve(config.provider)) }), @@ -829,16 +859,15 @@ function mockHandlers( state.attempts.set(attemptID, created) const started = start({ integrationID: ctx.params.integrationID, directory, body: ctx.payload }) - return { - location: location(config, directory), - data: { - attemptID, - url: started.url, - instructions: "", - mode: "auto", - time: { created, expires: created + 600_000 }, - }, + const data = { + attemptID, + url: started.url, + instructions: "", + mode: "auto", + time: { created, expires: created + 600_000 }, } + + return { location: location(config, directory), data: started.paste ? { ...data, paste: true } : data } }) }, integrationOAuthStatus: (ctx) => @@ -855,6 +884,15 @@ function mockHandlers( }, }) }), + integrationOAuthComplete: (ctx) => { + const complete = config.onIntegrationOAuthComplete + + if (!complete) return unsupported("complete pasted OAuth sign-ins", "onIntegrationOAuthComplete") + + return Effect.sync(() => complete({ attemptID: ctx.params.attemptID, body: ctx.payload })).pipe( + Effect.andThen(noContent), + ) + }, integrationOAuthCancel: (ctx) => Effect.sync(() => config.onIntegrationOAuthCancel?.(ctx.params.attemptID)).pipe(Effect.andThen(noContent)), integrationConnectExternal: () => noContent, @@ -881,10 +919,14 @@ function mockHandlers( mcpConnect: (ctx) => mcpAction(ctx.params.server, "connect", ctx.request), mcpDisconnect: (ctx) => mcpAction(ctx.params.server, "disconnect", ctx.request), mcpResource: (ctx) => - Effect.succeed({ - location: location(config, requestDirectory(config, ctx.request)), - data: { resources: [], templates: [] }, - }), + Effect.suspend(() => + config.mcpResourceFailures?.() + ? Effect.fail(new MockInternal({ message: "MCP resource list failed" })) + : Effect.succeed({ + location: location(config, requestDirectory(config, ctx.request)), + data: { resources: [], templates: [] }, + }), + ), projectList: () => Effect.sync(() => { if (config.projects) return resolve(config.projects) @@ -998,7 +1040,11 @@ function mockHandlers( Effect.sync(() => ({ location: location(config), data: Predicate.isFunction(config.vcsDiff) - ? config.vcsDiff({ mode: ctx.query.mode }) + ? config.vcsDiff({ + mode: ctx.query.mode, + directory: requestDirectory(config, ctx.request), + context: ctx.query.context, + }) : (config.vcsDiff ?? []), })), fsList: (ctx) => @@ -1193,9 +1239,11 @@ function mockHandlers( ...Object.entries(config.sessionPermissions ?? {}).flatMap(([id, list]) => currentPermissions(list).length > 0 && status[id]?.type !== "idle" ? [id] : [], ), + // Location elicitations (`sessionID: "global"`) belong to no Session. ...resolve(config.forms ?? []).flatMap((form) => Predicate.isObject(form) && Predicate.isString(form.sessionID) && + form.sessionID !== "global" && status[form.sessionID]?.type !== "idle" ? [form.sessionID] : [], @@ -1215,7 +1263,25 @@ function mockHandlers( }), sessionRemove: () => noContent, sessionShell: () => noContent, - sessionView: () => noContent, + sessionView: (ctx) => + Effect.sync(() => { + const session = config.sessions.find((item) => item.id === ctx.params.sessionID) + + if (!session) return + const time = currentSession(session, config.directory).time + + session.time = { ...time, viewed: Math.max(time.viewed ?? 0, ctx.payload.idle) } + state.emit([ + { + id: `evt_viewed_${session.id}_${ctx.payload.idle}`, + created: Date.now(), + type: "session.viewed", + durable: { aggregateID: session.id, seq: 1, version: 1 }, + location: { directory: requestDirectory(config, ctx.request) }, + data: { sessionID: session.id, idle: ctx.payload.idle }, + }, + ]) + }).pipe(Effect.andThen(noContent)), sessionForm: (ctx) => Effect.succeed({ data: resolve(config.forms ?? []).filter( diff --git a/packages/app/e2e/utils/settings-wsl.fixture.tsx b/packages/app/e2e/utils/settings-wsl.fixture.tsx index d40fba4308..a6a2056528 100644 --- a/packages/app/e2e/utils/settings-wsl.fixture.tsx +++ b/packages/app/e2e/utils/settings-wsl.fixture.tsx @@ -29,6 +29,10 @@ export function mount(input: { ssh?: string | null storage?: string | null hold?: string | null + /** Comma-separated installed distributions for the add-server dialog. */ + distros?: string | null + /** Holds the distribution refresh job while inspecting disabled dialog controls. */ + busy?: string | null /** Enables the updater Ipc; check and install reject with this message, which may be empty. */ updater?: string | null }) { @@ -40,6 +44,7 @@ export function mount(input: { const endpoint = { url: input.wsl ?? input.server } const ready = () => ({ kind: "ready" as const, url: endpoint.url, password: null }) const held = Promise.withResolvers() + const distros = input.distros?.split(",").filter(Boolean) ?? [] const storage = (name?: string) => { const item = (key: string) => (name ? `${name}:${key}` : key) @@ -82,11 +87,18 @@ export function mount(input: { }, state: { runtime: { available: true, version: "2", error: null }, - installed: [], - online: [], - distroProbes: {}, + installed: distros.map((name) => ({ name, version: name === "Debian-WSL1" ? 1 : 2, isDefault: false })), + online: distros.length + ? ["Debian", "FedoraLinux-43", "openSUSE-Tumbleweed", "OracleLinux_9_1", "kali-linux"].map((name) => ({ + name, + label: name, + })) + : [], + distroProbes: Object.fromEntries( + distros.map((name) => [name, { name, canExecute: true, hasBash: true, hasCurl: true, error: null }]), + ), pendingRestart: false, - hostJob: "idle", + hostJob: input.busy ? "busy" : "idle", distroJobs: {}, servers: [ { @@ -101,6 +113,19 @@ export function mount(input: { }, ], opencodeChecks: { + ...Object.fromEntries( + distros.map((name) => [ + name, + { + distro: name, + resolvedPath: null, + version: null, + expectedVersion: "current", + matchesDesktop: null, + error: null, + }, + ]), + ), Ubuntu: { distro: "Ubuntu", resolvedPath: "/usr/bin/opencode", @@ -299,6 +324,16 @@ export function mount(input: { > Require SSH sign-in + {/* The remote server answering with a version this app does not support. */} + {store.connects} diff --git a/packages/app/e2e/utils/settings-wsl.html b/packages/app/e2e/utils/settings-wsl.html index 66daf0f865..44a44a31b1 100644 --- a/packages/app/e2e/utils/settings-wsl.html +++ b/packages/app/e2e/utils/settings-wsl.html @@ -18,6 +18,8 @@ ssh: query.get("ssh"), storage: query.get("storage"), hold: query.get("hold"), + distros: query.get("distros"), + busy: query.get("busy"), updater: query.get("updater"), }) diff --git a/packages/app/e2e/utils/timeline.ts b/packages/app/e2e/utils/timeline.ts index 5a8ae0fd5b..3197f2ac0a 100644 --- a/packages/app/e2e/utils/timeline.ts +++ b/packages/app/e2e/utils/timeline.ts @@ -11,7 +11,7 @@ import type { import { EventManifest } from "@opencode/schema/event-manifest" import { SessionMessage } from "@opencode/schema/session-message" import type { TimelineDetail } from "@opencode/session-ui/timeline/detail" -import { expect, test, type Page, type TestInfo } from "@playwright/test" +import { expect, test, type Locator, type Page, type TestInfo } from "@playwright/test" import { Schema } from "effect" import { SERVER, seed, sessionHref } from "./app" import { mockOpenCodeServer, type MockServerConfig } from "./mock-server" @@ -1117,3 +1117,25 @@ function provider() { default: { providerID: "opencode", modelID: "claude-opus-4-6" }, } } + +/** Hovers a user message, opens the chevron menu its bubble (or, without text, its footer) shows, and picks an action. */ +export async function chooseUserMessageAction(page: Page, row: Locator, name: string) { + await openUserMessageMenu(page, row) + await page.getByRole("menuitem", { name, exact: true }).click() +} + +/** Hovers a user message, opens its chevron menu, and returns the open menu. */ +export async function openUserMessageMenu(page: Page, row: Locator) { + const message = row.locator('[data-component="user-message"]') + const bubble = message.locator('[data-slot="user-message-text"]') + + // The bubble renders with its message. Counted before the row mounts, it reads 0, and hovering the whole message + // misses the bubble, the only place that reveals a text message's chevron. + await expect(message).toBeVisible() + + if ((await bubble.count()) > 0) await bubble.hover() + else await message.hover() + await row.getByRole("button", { name: "More actions", exact: true }).click() + + return page.getByRole("menu") +} diff --git a/packages/app/e2e/utils/windows-menu.fixture.tsx b/packages/app/e2e/utils/windows-menu.fixture.tsx index deee98939b..3668277aa5 100644 --- a/packages/app/e2e/utils/windows-menu.fixture.tsx +++ b/packages/app/e2e/utils/windows-menu.fixture.tsx @@ -6,8 +6,9 @@ import { AppBaseProviders, AppInterface } from "../../src/app" import { PlatformProvider, type Platform } from "../../src/runtime/platform/platform" // 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. -export function mount(input: { server: string; path?: string; os?: "macos"; openApps?: boolean }) { +// `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"; openApps?: boolean; holdOpen?: boolean }) { const root = document.getElementById("root") if (!root) throw new Error("Missing fixture root") @@ -62,7 +63,12 @@ export function mount(input: { server: string; path?: string; os?: "macos"; open if (input.openApps) { platform.checkAppExists = async (app) => app === "Visual Studio Code" || app === "code" - platform.openPath = async (path, app) => void setStore("opened", (opened) => [...opened, { path, app }]) + platform.openPath = (path, app) => { + setStore("opened", (opened) => [...opened, { path, app }]) + + return input.holdOpen ? new Promise(() => undefined) : Promise.resolve() + } + platform.revealPath = async () => true } diff --git a/packages/app/e2e/utils/windows-menu.html b/packages/app/e2e/utils/windows-menu.html index 5b2cc1d045..75a98a574d 100644 --- a/packages/app/e2e/utils/windows-menu.html +++ b/packages/app/e2e/utils/windows-menu.html @@ -4,7 +4,8 @@ -
+ +
diff --git a/packages/app/e2e/utils/workspace.ts b/packages/app/e2e/utils/workspace.ts index 20109c6a21..9095fca00b 100644 --- a/packages/app/e2e/utils/workspace.ts +++ b/packages/app/e2e/utils/workspace.ts @@ -71,12 +71,16 @@ export async function openSession(page: Page, input: WorkspaceInput & { sessionI } // Opens a new-session draft (no sessions by default) and waits until its composer accepts input. -export async function openDraft(page: Page, input: WorkspaceInput & { draftID?: string }) { +export async function openDraft( + page: Page, + input: WorkspaceInput & { draftID?: string; beforeOpen?: () => Promise }, +) { const draftID = input.draftID ?? `draft_${input.name.toLowerCase().replace(/[^a-z0-9]+/g, "_")}` const directory = input.directory ?? `C:/OpenCode/${input.name}` const sessions = input.sessions ?? [] const tabs: TabSeed[] = [...sessions.map((item) => item.id), { draft: draftID, directory }] const workspace = await mockWorkspace(page, { ...input, directory, sessions, seed: { tabs, ...input.seed } }) + await input.beforeOpen?.() await page.goto(draftHref(draftID)) const editor = page.locator('[data-component="composer-editor"]') await expect(editor).toBeEditable({ timeout: APP_READY_TIMEOUT }) @@ -92,7 +96,7 @@ export function newSessionLocation(page: Page) { return page.locator('[data-component="new-session"] [data-action="prompt-project"]') } -// The new-session trigger that shows the draft's worktree, or Local, and opens the project's worktree step. +// The new-session trigger that shows the draft's worktree or branch, and opens the project's worktree step. export function newSessionWorktree(page: Page) { return page.locator('[data-component="new-session"] [data-action="prompt-worktree"]') } diff --git a/packages/app/package.json b/packages/app/package.json index 70a57c1443..43d1204cbf 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/app", - "version": "2.2.5", + "version": "2.2.7", "description": "", "type": "module", "exports": { diff --git a/packages/app/perf/README.md b/packages/app/perf/README.md index f08f09c4e0..dd6cf7a8f7 100644 --- a/packages/app/perf/README.md +++ b/packages/app/perf/README.md @@ -1,23 +1,23 @@ # Benchmarks -The app's benchmarks run with [strobe](https://github.com/Hona/strobe). Each compares two builds in pairs of fresh +The app's benchmarks run with [strobe](https://github.com/anomalyco/strobe). Each compares two builds in pairs of fresh launches (A B, B A, …) at normal speed, decides one primary metric per case with an interval, and refuses setups it cannot defend (a hidden window, a software GPU, a throttled CPU, a busy machine). The web cases run the production build on the e2e mock server, so they need no backend. -| File | Cases | Workload | -| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -| `timeline.bench.ts` | scroll history · type in composer · find in session · expand an edit · drag the review's edge | A 120-turn session of markdown, code, tools and diffs. | -| `stream.bench.ts` | stream a reply · into a tool-heavy history · with review open · with Find open · wait on a running session | 160 markdown deltas at 40 a second from a server that never waits. | -| `tabs.bench.ts` | switch tab (warm, review open, after a resize, 1,200 models) · away and back with review open · open an unvisited tab (± review) | Two tabs of 200 long markdown exchanges each, loaded in full. | -| `navigation.bench.ts` | Home → session · close the last tab · new session (Home, titlebar) · new session page in and out · child session · restore 8 tabs · activate a restored tab · command palette (session, Home) | The stress fixture, paginated, from a fresh document every run. | -| `home.bench.ts` | load home · update a session in the background | 500, 5,000 and 10,000 root sessions across 12 folders. | -| `review.bench.ts` | open review · filter files · next file | 100 and 10,000 changed files of 100 lines each. | -| `diff.bench.ts` | open a long diff · open a huge diff · return to a long diff | A 1,559-line diff, highlighted; a 15,599-line one, plain. | -| `composer.bench.ts` | type in a large draft · move the cursor in it · recall a prompt from history | A 44,000-character saved draft; 100 prompts with screenshots. | -| `docks.bench.ts` | open and close request docks | A permission dock and an MCP elicitation over a 20-turn session. | -| `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. | +| File | Cases | Workload | +| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| `timeline.bench.ts` | scroll history · type in composer · find in session · expand an edit · drag the review's edge | A 120-turn session of markdown, code, tools and diffs. | +| `stream.bench.ts` | stream a reply · into a tool-heavy history · with review open · with Find open · wait on a running session | 160 markdown deltas at 40 a second from a server that never waits. | +| `tabs.bench.ts` | switch tab (warm, review open, after a resize, 1,200 models) · away and back with review open · open an unvisited tab (± review) | Two tabs of 200 long markdown exchanges each, loaded in full. | +| `navigation.bench.ts` | Home → session · close the last tab · new session (Home, titlebar) · new session page in and out · child session · restore 8 tabs · activate a restored tab · command palette (session, Home, scroll) | The stress fixture, paginated, from a fresh document every run. | +| `home.bench.ts` | load home · update a session in the background | 500, 5,000 and 10,000 root sessions across 12 folders. | +| `review.bench.ts` | open review · filter files · next file | 100 and 10,000 changed files of 100 lines each. | +| `diff.bench.ts` | open a long diff · open a huge diff · return to a long diff | A 1,559-line diff, highlighted; a 15,599-line one, plain. | +| `composer.bench.ts` | type in a large draft · move the cursor in it · recall a prompt from history | A 44,000-character saved draft; 100 prompts with screenshots. | +| `docks.bench.ts` | open and close request docks | A permission dock and an MCP elicitation over a 20-turn session. | +| `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, while durations that end on a presented frame move in whole vsyncs. Durations, interaction latency, frames and the @@ -140,12 +140,17 @@ strobe bench packages/app/perf/timeline.bench.ts --filter "scroll*" --bisect --engine firefox --headless --check --primary cpu.work`. `main.*` metrics are + Chromium's, so those cases are refused without `--primary cpu.work`. In Firefox the mock server publishes no events + after a mutation (it has no Playwright page to push them through); `eventSource` still delivers. - `run` is measured; `reset` puts the state back between runs and is not. A case that should pay a first visit every run reloads in `reset`; park the pointer with `page.hover(...)` afterwards, because the app prefetches a tab's transcript when the pointer rests on it, and the pointer stays where the last click left it. diff --git a/packages/app/perf/composer.bench.ts b/packages/app/perf/composer.bench.ts index ae9a93f5d3..3ef2ed743c 100644 --- a/packages/app/perf/composer.bench.ts +++ b/packages/app/perf/composer.bench.ts @@ -13,33 +13,38 @@ const newSession = '[data-component="new-session"] [data-component="composer-edi const typed = " Keep the existing error handling and add coverage." export default bench({ + // What a launch sets up: the large draft, or the prompt history. Cases with the same one share a launch. + setupKey: (ctx) => (ctx.case.includes("history") ? "history" : "draft"), + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, - async prepare({ case: name, playwright, mock, url }) { + async prepare(ctx) { + const { setupKey, url } = ctx const server = new URL(url).origin - const page = cached(playwright.page, mock) + const page = cached(ctx) - if (!name.includes("history")) { + if (setupKey === "draft") { await countDraftEncodes(page) return mockLargeDraft(page, server) } - await seedHistory(page, server) await mockStressTimeline(page, { server }) await installProjects(page, [fixture.directory]) - return { path: "/" } + // A static file first: setup seeds the history before the app opens its store. + return { path: "/favicon.svg" } }, url: ({ prepared }) => prepared.path, }), }, - async setup({ case: name, page }) { - if (name.includes("history")) { - await page.waitFor('[data-action="home-new-session"]', { timeout: 60_000 }) + async setup({ setupKey, page }) { + if (setupKey === "history") { + await page.eval(seedHistory) + await page.goto("/", { until: '[data-action="home-new-session"]', timeout: 60_000 }) await page.idle() return diff --git a/packages/app/perf/diff.bench.ts b/packages/app/perf/diff.bench.ts index b0452c4eea..a2669f4a24 100644 --- a/packages/app/perf/diff.bench.ts +++ b/packages/app/perf/diff.bench.ts @@ -4,6 +4,7 @@ import { bench, web, type Case } from "@hona/strobe" import { reviewDiffs, routesDiff } from "./fixtures/diffs" import { cached } from "./fixtures/mock" import { openReview, review } from "./fixtures/review" +import { keepStartStorage, saveStartStorage } from "./fixtures/storage" import { mockTimelineSession, serveDiffs, timeline } from "./fixtures/timeline" // The pane opening on the diff, in a fresh document each run. @@ -20,15 +21,29 @@ const open: Case<{}> = { }, } +/** What a launch sets up: the huge diff, the long one with the pane moved past it, or the long one. */ +type Setup = "huge" | "return" | "long" + export default bench({ + // The workspace's changes and where setup leaves the pane: cases with the same ones share a launch. + setupKey: ({ case: name }): Setup => { + if (name === "open a huge diff") return "huge" + + if (name === "return to a long diff") return "return" + + return "long" + }, + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1366, height: 768 }, - async prepare({ case: name, playwright, mock, url }) { - const page = cached(playwright.page, mock) + async prepare(ctx) { + const { setupKey, url } = ctx + const page = cached(ctx) + await keepStartStorage(page) const session = await mockTimelineSession(page, { server: new URL(url).origin, historyTurns: 0 }) - await serveDiffs(page, changes(name)) + await serveDiffs(page, changes(setupKey)) return session }, @@ -36,12 +51,14 @@ export default bench({ }), }, - async setup({ case: name, page }) { + async setup({ setupKey, page }) { await page.waitFor(timeline, { timeout: 60_000 }) // The long diff rendered once, then the pane moved to another file. - if (name === "return to a long diff") { + if (setupKey === "return") { await openReview(page) + // The pane widens to fit the diff after its first file shows, which moves Next: click it once the pane rests. + await page.idle() await page.click(review.next) await page.waitFor(review.file, { text: "routes.ts" }) await page.waitFor(review.line) @@ -50,6 +67,8 @@ export default bench({ } await page.idle() + // A reload keeps the review open (the app saves its layout on pagehide), so every run starts from this storage. + await saveStartStorage(page) }, cases: { @@ -75,11 +94,11 @@ export default bench({ }, }) -/** The workspace's changes for a case: the huge diff alone, a small file before the long one, or the long one alone. */ -function changes(name: string) { - if (name === "open a huge diff") return [routesDiff(1_200)] +/** The workspace's changes for a setup: the huge diff alone, a small file before the long one, or the long one alone. */ +function changes(setupKey: Setup) { + if (setupKey === "huge") return [routesDiff(1_200)] - if (name === "return to a long diff") return [reviewDiffs(1)[0], routesDiff(120)] + if (setupKey === "return") return [reviewDiffs(1)[0], routesDiff(120)] return [routesDiff(120)] } diff --git a/packages/app/perf/docks.bench.ts b/packages/app/perf/docks.bench.ts index 1d853b8095..428341b329 100644 --- a/packages/app/perf/docks.bench.ts +++ b/packages/app/perf/docks.bench.ts @@ -23,9 +23,9 @@ export default bench({ web: web({ expect: { title: "OpenCode" }, viewport: { width: 1366, height: 768 }, - prepare: ({ playwright, mock, url }) => - mockTimelineSession(cached(playwright.page, mock), { - server: new URL(url).origin, + prepare: (ctx) => + mockTimelineSession(cached(ctx), { + server: new URL(ctx.url).origin, historyTurns: 20, stream: true, }), diff --git a/packages/app/perf/fixtures/composer.ts b/packages/app/perf/fixtures/composer.ts index ff49c977e9..670ddee198 100644 --- a/packages/app/perf/fixtures/composer.ts +++ b/packages/app/perf/fixtures/composer.ts @@ -82,88 +82,85 @@ export const recalled = "Review the retry policy in src/network/request-0.ts." /** * A long prompt history in the browser's draft store: 100 prompts of about 460 characters with a code fence, every - * other one with a 1440×900 screenshot (five distinct images), and 100 shell commands. Seeded on the app's origin - * before the app first opens the store, from a static file so the app does not start. + * other one with a 1440×900 screenshot (five distinct images), and 100 shell commands. Runs in the page (`page.eval`) + * on the app's origin before the app first opens the store: from a static file, so the app has not started. */ -export async function seedHistory(page: Page, origin: string) { - await page.goto(new URL("/favicon.svg", origin).href) - await page.evaluate(async () => { - const normal = Array.from({ length: 100 }, (_, index) => { - const content = - `Review the retry policy in src/network/request-${index}.ts. Preserve cancellation and the existing error messages.\n\n` + - `The request should stop after three attempts. Add coverage for a 429 response, a connection reset, and a successful retry. Verify that only idempotent requests are retried.\n\n` + - `Report ${index}:\n\`\`\`ts\nexport async function request(input: Request) {\n const response = await fetch(input)\n if (!response.ok) throw new Error(response.statusText)\n return response.json()\n}\n\`\`\`` - - return { - prompt: [ - { type: "text", content, start: 0, end: content.length }, - ...(index % 2 === 0 - ? [ - { - type: "image", - id: `attachment-${index}`, - filename: `request-${index}.png`, - mime: "image/png", - blob: { id: `screenshot-${index % 10}` }, - }, - ] - : []), - ], - comments: [], - } - }) - - const shell = Array.from({ length: 100 }, (_, index) => { - const content = `bun test src/network/request-${index}.test.ts --timeout 30000` - - return { prompt: [{ type: "text", content, start: 0, end: content.length }], comments: [] } - }) - - const screenshots = await Promise.all( - [0, 2, 4, 6, 8].map(async (index) => { - const id = `screenshot-${index}` - const canvas = new OffscreenCanvas(1440, 900) - const context = canvas.getContext("2d")! - context.fillStyle = "#15191f" - context.fillRect(0, 0, 1440, 900) - context.font = "16px monospace" - context.fillStyle = "#b8c8d8" - context.fillText(`request.ts - ${id}`, 30, 35) - - for (let line = 0; line < 38; line++) { - context.fillStyle = line % 3 ? "#a8c7ba" : "#d4a882" - context.fillText( - `${String(line + 1).padStart(3)} const response${line} = await fetch('/api/request/${id}/${line}', { signal, headers });`, - 30, - 70 + line * 20, - ) - } - - return { id, blob: await canvas.convertToBlob({ type: "image/png" }) } - }), - ) - - const open = indexedDB.open("opencode-drafts", 1) - open.onupgradeneeded = () => { - open.result.createObjectStore("documents") - open.result.createObjectStore("blobs") +export async function seedHistory() { + const normal = Array.from({ length: 100 }, (_, index) => { + const content = + `Review the retry policy in src/network/request-${index}.ts. Preserve cancellation and the existing error messages.\n\n` + + `The request should stop after three attempts. Add coverage for a 429 response, a connection reset, and a successful retry. Verify that only idempotent requests are retried.\n\n` + + `Report ${index}:\n\`\`\`ts\nexport async function request(input: Request) {\n const response = await fetch(input)\n if (!response.ok) throw new Error(response.statusText)\n return response.json()\n}\n\`\`\`` + + return { + prompt: [ + { type: "text", content, start: 0, end: content.length }, + ...(index % 2 === 0 + ? [ + { + type: "image", + id: `attachment-${index}`, + filename: `request-${index}.png`, + mime: "image/png", + blob: { id: `screenshot-${index % 10}` }, + }, + ] + : []), + ], + comments: [], } + }) + + const shell = Array.from({ length: 100 }, (_, index) => { + const content = `bun test src/network/request-${index}.test.ts --timeout 30000` + + return { prompt: [{ type: "text", content, start: 0, end: content.length }], comments: [] } + }) + + const screenshots = await Promise.all( + [0, 2, 4, 6, 8].map(async (index) => { + const id = `screenshot-${index}` + const canvas = new OffscreenCanvas(1440, 900) + const context = canvas.getContext("2d")! + context.fillStyle = "#15191f" + context.fillRect(0, 0, 1440, 900) + context.font = "16px monospace" + context.fillStyle = "#b8c8d8" + context.fillText(`request.ts - ${id}`, 30, 35) + + for (let line = 0; line < 38; line++) { + context.fillStyle = line % 3 ? "#a8c7ba" : "#d4a882" + context.fillText( + `${String(line + 1).padStart(3)} const response${line} = await fetch('/api/request/${id}/${line}', { signal, headers });`, + 30, + 70 + line * 20, + ) + } + + return { id, blob: await canvas.convertToBlob({ type: "image/png" }) } + }), + ) + + const open = indexedDB.open("opencode-drafts", 1) + open.onupgradeneeded = () => { + open.result.createObjectStore("documents") + open.result.createObjectStore("blobs") + } + + const db = await new Promise((resolve, reject) => { + open.onsuccess = () => resolve(open.result) + open.onerror = () => reject(open.error) + }) - const db = await new Promise((resolve, reject) => { - open.onsuccess = () => resolve(open.result) - open.onerror = () => reject(open.error) - }) - - const transaction = db.transaction(["documents", "blobs"], "readwrite") - transaction.objectStore("documents").put(JSON.stringify({ entries: normal }), "opencode.global.dat:prompt-history") - transaction - .objectStore("documents") - .put(JSON.stringify({ entries: shell }), "opencode.global.dat:prompt-history-shell") - screenshots.forEach((screenshot) => transaction.objectStore("blobs").put(screenshot.blob, screenshot.id)) - await new Promise((resolve, reject) => { - transaction.oncomplete = () => resolve() - transaction.onerror = () => reject(transaction.error) - }) - db.close() + const transaction = db.transaction(["documents", "blobs"], "readwrite") + transaction.objectStore("documents").put(JSON.stringify({ entries: normal }), "opencode.global.dat:prompt-history") + transaction + .objectStore("documents") + .put(JSON.stringify({ entries: shell }), "opencode.global.dat:prompt-history-shell") + screenshots.forEach((screenshot) => transaction.objectStore("blobs").put(screenshot.blob, screenshot.id)) + await new Promise((resolve, reject) => { + transaction.oncomplete = () => resolve() + transaction.onerror = () => reject(transaction.error) }) + db.close() } diff --git a/packages/app/perf/fixtures/drag.ts b/packages/app/perf/fixtures/drag.ts index 47837f2bb0..0947f28391 100644 --- a/packages/app/perf/fixtures/drag.ts +++ b/packages/app/perf/fixtures/drag.ts @@ -1,7 +1,7 @@ -import type { Page } from "@playwright/test" +import type { Page } from "@hona/strobe" -/** A divider to drag: its centre, how far it can travel each way (px), and the display's frame period (ms). */ -export type Divider = { x: number; y: number; left: number; right: number; period: number } +/** A divider to drag: how far it can travel each way (px). */ +export type Divider = { left: number; right: number } type Leg = { seconds: number; at: (progress: number) => number } @@ -36,13 +36,11 @@ function legs(divider: Divider) { } /** - * Presses the divider, moves the pointer once per display frame along the drag above without letting go, and releases - * it where it started. strobe's driver has no pointer drag (`page.move` does not hold a button, and its `until: - * "frame"` waits two animation frames and a round trip per move), so Playwright's mouse drives the drag, from the - * runner, paced by the display's frame period on the wall clock. A frame the page misses is skipped, as a hand keeps - * moving while the screen lags. + * Presses the divider (`selector`), moves the pointer along the drag above without letting go, and releases it where + * it started. strobe's `page.drag` sends one move per display frame on its own clock, without waiting for the page to + * handle each, as a hand keeps moving while the screen lags; `input.rate` says how evenly the moves went out. */ -export async function dragDivider(mouse: Page["mouse"], divider: Divider) { +export function dragDivider(page: Page, selector: string, divider: Divider) { const path = legs(divider) const total = path.reduce((sum, leg) => sum + leg.seconds, 0) @@ -57,49 +55,19 @@ export async function dragDivider(mouse: Page["mouse"], divider: Divider) { return 0 } - await mouse.move(divider.x, divider.y) - await mouse.down() - const began = performance.now() - - for (let frame = 1; ; frame++) { - const wait = began + frame * divider.period - performance.now() - - if (wait > 0) await new Promise((resolve) => setTimeout(resolve, wait)) - frame = Math.max(frame, Math.floor((performance.now() - began) / divider.period)) - const seconds = (performance.now() - began) / 1000 - - if (seconds >= total) break - await mouse.move(divider.x + offset(seconds), divider.y) - } - - await mouse.move(divider.x, divider.y) - await mouse.up() + return page.drag(selector, (progress) => [offset(progress * total), 0], { duration: total * 1000 }) } /** - * Reads, in the page, where the divider `selector` sits, the room its panel `panel` has to shrink to `min` and grow to - * the row `row` less `rest` (px), and the display's frame period over 30 frames. Only in setup: it reads layout. + * Reads, in the page, the room the panel `panel` beside the divider `selector` has to shrink to `min` and grow to the + * row `row` less `rest` (px). Only in setup: it reads layout. */ -export function measureDivider(input: { selector: string; panel: string; row: string; min: number; rest: number }) { - return new Promise((resolve) => { - const box = document.querySelector(input.selector)!.getBoundingClientRect() - const width = document.querySelector(input.panel)!.getBoundingClientRect().width - const row = document.querySelector(input.row)!.getBoundingClientRect().width - const times: number[] = [] +export function measureDivider(input: { panel: string; row: string; min: number; rest: number }): Divider { + const width = document.querySelector(input.panel)!.getBoundingClientRect().width + const row = document.querySelector(input.row)!.getBoundingClientRect().width - const tick = (time: number) => { - times.push(time) - - if (times.length < 31) return requestAnimationFrame(tick) - resolve({ - x: box.left + box.width / 2, - y: box.top + box.height / 2, - left: Math.max(0, Math.min(360, width - input.min - 10)), - right: Math.max(0, Math.min(160, row - input.rest - width - 10)), - period: (times[30]! - times[0]!) / 30, - }) - } - - requestAnimationFrame(tick) - }) + return { + left: Math.max(0, Math.min(360, width - input.min - 10)), + right: Math.max(0, Math.min(160, row - input.rest - width - 10)), + } } diff --git a/packages/app/perf/fixtures/mock.ts b/packages/app/perf/fixtures/mock.ts index 561c9b1e04..d309b90a52 100644 --- a/packages/app/perf/fixtures/mock.ts +++ b/packages/app/perf/fixtures/mock.ts @@ -12,13 +12,19 @@ type Fulfill = { } /** - * `page`, with its routes answered through strobe's `mock` (`prepare`'s `ctx.mock`). Playwright's routing turns the - * browser's HTTP cache off for the whole page, so a case that reloads in `reset` would refetch every script, which no - * person does; `mock` pauses only the mocked URLs. Everything else on the page is Playwright's, so the e2e mock server - * and its fixtures run unchanged: routes keep Playwright's order (the latest answers first, `fallback` passes on). - * Routes take URL globs and last for the whole case. + * The block's page for the e2e mock server and the fixtures, with its routes answered through strobe's `mock` + * (`prepare`'s `ctx.mock`). Playwright's routing turns the browser's HTTP cache off for the whole page, so a case that + * reloads in `reset` would refetch every script, which no person does; `mock` pauses only the mocked URLs. Routes keep + * Playwright's order (the latest answers first, `fallback` passes on), take URL globs and last for the whole case. + * + * In Chromium it is Playwright's page, so the mock server and its fixtures run as in the e2e suites. Other engines + * (`--engine firefox`) have no Playwright page: a stand-in takes init scripts through strobe's `addInitScript` and + * cannot evaluate in the page, so the mock server publishes no events there after a mutation. */ -export function cached(page: Page, mock: PrepareContext["mock"]) { +export function cached(ctx: Pick, "playwright" | "mock" | "addInitScript">) { + const page = playwrightPage(ctx) ?? standIn(ctx.addInitScript) + const { mock } = ctx + page.route = async (url, handler) => { // oxlint-disable-next-line anti-slop/no-runtime-typeof -- discriminates Playwright's own URL matcher union if (typeof url !== "string") throw new Error("strobe mocks URL globs; no benchmark routes by RegExp or predicate") @@ -34,6 +40,34 @@ export function cached(page: Page, mock: PrepareContext["mock"]) { return page } +// `ctx.playwright` is Chromium's: reading it in another engine throws. +function playwrightPage(ctx: Pick, "playwright">): Page | undefined { + try { + // SAFETY: strobe hands Chromium blocks Playwright's own page. + return ctx.playwright.page as Page + } catch { + return undefined + } +} + +// The members of a page the e2e mock server and the fixtures use, over strobe's calls. `route` is set by `cached`. +function standIn(addInitScript: PrepareContext["addInitScript"]) { + const page = { + addInitScript, + // The block's browser closes with the block. + on: () => page, + isClosed: () => false, + // The mock server's event delivery treats a missing stream as retryable and drops the events. + evaluate: async () => { + throw new Error("No mock event stream: strobe drives this engine without Playwright") + }, + } + + // SAFETY: the e2e mock server and the benchmark fixtures call only these members (and `route`, `routeWebSocket`). + // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above + return page as unknown as Page +} + async function kept() { throw new Error("a strobe mock cannot be removed") } diff --git a/packages/app/perf/fixtures/storage.ts b/packages/app/perf/fixtures/storage.ts new file mode 100644 index 0000000000..80b868ee13 --- /dev/null +++ b/packages/app/perf/fixtures/storage.ts @@ -0,0 +1,29 @@ +import type { Page } from "@hona/strobe" +import type { Page as PlaywrightPage } from "@playwright/test" + +const KEY = "perf.start-storage" + +/** + * Every later document starts from the local storage that `saveStartStorage` recorded. The app writes its layout (the + * review pane open, its tab) on pagehide, so without this a reset's reload would carry what the run opened into the + * next run. + */ +export async function keepStartStorage(page: Pick) { + await page.addInitScript((key) => { + const saved = sessionStorage.getItem(key) + + if (saved === null) return + + localStorage.clear() + + // SAFETY: only saveStartStorage writes this key, as an object of localStorage's own strings. + const entries = Object.entries(JSON.parse(saved) as Record) + + for (const [name, value] of entries) localStorage.setItem(name, value) + }, KEY) +} + +/** Records the local storage runs start from: call last in `setup`, once the page has loaded. */ +export function saveStartStorage(page: Page) { + return page.eval((key) => sessionStorage.setItem(key, JSON.stringify({ ...localStorage })), KEY) +} diff --git a/packages/app/perf/home.bench.ts b/packages/app/perf/home.bench.ts index fde36c8772..91dec6add5 100644 --- a/packages/app/perf/home.bench.ts +++ b/packages/app/perf/home.bench.ts @@ -19,9 +19,10 @@ export default bench({ web: web({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, - async prepare({ params, playwright, mock, url }) { + async prepare(ctx) { + const { params, url } = ctx const server = new URL(url).origin - const page = cached(playwright.page, mock) + const page = cached(ctx) const source = await eventSource(page, server) const home = await mockHome(page, { server, count: params.sessions }) diff --git a/packages/app/perf/navigation.bench.ts b/packages/app/perf/navigation.bench.ts index f3d8964062..94a480cfba 100644 --- a/packages/app/perf/navigation.bench.ts +++ b/packages/app/perf/navigation.bench.ts @@ -38,6 +38,8 @@ const palette = '[role="dialog"] [role="combobox"]' const selected = '[role="dialog"] [role="option"][aria-selected="true"]' +const paletteList = '[role="dialog"] [data-component="menu-scroll"] > [data-scrollable]' + // Eight restored tabs of a normal 20-message first page each (44 parts, 139 KB). const restored = Array.from({ length: 8 }, (_, index) => ({ ...fixture.sessions[0], @@ -69,22 +71,38 @@ const restoring: Scene = { ready: answer(restored[0].id), } -/** Where each case starts: its open tabs, its first page and what that page shows once ready. */ -const scenes = new Map([ - ["open a session from home", onHome], - ["close the last tab", inSource], - ["new session from home", { ...onHome, ready: '[data-action="home-new-session"]' }], - ["new session from a session", inSource], - ["open the new session page", { ...inSource, draft: true }], - [ - "leave the new session page", - { tabs: [fixture.sourceID, fixture.targetID], draft: true, first: () => draftHref(draftID), ready: newSession }, - ], - ["open a child session", inSource], - ["restore 8 tabs", restoring], - ["activate a restored tab", restoring], - ["search commands in a session", inSource], - ["search commands on home", onHome], +/** The places cases start from: open tabs, a first page and what that page shows once ready. */ +const scenes = { + home: onHome, + "home, new session": { ...onHome, ready: '[data-action="home-new-session"]' }, + source: inSource, + "source, new session tab": { ...inSource, draft: true }, + "new session page": { + tabs: [fixture.sourceID, fixture.targetID], + draft: true, + first: () => draftHref(draftID), + ready: newSession, + }, + restoring, +} satisfies Record + +/** Where each case starts. */ +/** What a launch sets up: the scene, and whether setup opens the command palette. */ +type Setup = { scene: keyof typeof scenes; palette: boolean } + +const sceneOf = new Map([ + ["open a session from home", "home"], + ["close the last tab", "source"], + ["new session from home", "home, new session"], + ["new session from a session", "source"], + ["open the new session page", "source, new session tab"], + ["leave the new session page", "new session page"], + ["open a child session", "source"], + ["restore 8 tabs", "restoring"], + ["activate a restored tab", "restoring"], + ["search commands in a session", "source"], + ["search commands on home", "home"], + ["scroll the command palette", "source"], ]) const fresh: Pick, "reset"> = { @@ -97,16 +115,25 @@ const fresh: Pick, "reset"> = { const metrics = ["run.duration", "interaction.p50"] export default bench({ + // A case's scene, and whether setup opens the command palette: cases with the same ones share a launch. + setupKey: ({ case: name }): Setup => { + const scene = sceneOf.get(name) + + if (!scene) throw new Error(`navigation.bench.ts: no scene for "${name}"`) + + return { scene, palette: name === "scroll the command palette" } + }, + targets: { - web: web({ + // A target is made before the bench, so its hooks see the setup key as typed here. + web: web<{}, Setup>({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, - async prepare({ case: name, playwright, mock, url }) { + async prepare(ctx) { + const { url } = ctx const server = new URL(url).origin - const scene = scenes.get(name) - const page = cached(playwright.page, mock) - - if (!scene) throw new Error(`navigation.bench.ts: no scene for "${name}"`) + const scene: Scene = scenes[ctx.setupKey.scene] + const page = cached(ctx) if (scene === restoring) await mockOpenCodeServer(page, { @@ -133,8 +160,10 @@ export default bench({ }), }, - async setup({ page, prepared }) { + async setup({ setupKey, page, prepared }) { await page.waitFor(prepared.ready, { timeout: 60_000 }) + + if (setupKey.palette) await page.press("ControlOrMeta+Shift+P", { until: paletteList }) await page.idle() }, @@ -261,5 +290,21 @@ export default bench({ await page.idle() }, }, + + // The palette's result list scrolls in a MenuScroll, which moves its thumb on every scroll frame. + "scroll the command palette": { + primary: "main.busy", + metrics: ["main.work", "frames.dropped.pct"], + async run({ page }) { + await page.scroll(paletteList, { by: 3000, speed: 3000 }) + await page.scroll(paletteList, { by: -3000, speed: 3000 }) + }, + // Opens the palette again each run, so a run starts at the top even if something closed it. + async reset({ page }) { + await page.press("Escape") + await page.press("ControlOrMeta+Shift+P", { until: paletteList }) + await page.idle() + }, + }, }, }) diff --git a/packages/app/perf/question.bench.ts b/packages/app/perf/question.bench.ts index b95c8c2f9f..4d357def88 100644 --- a/packages/app/perf/question.bench.ts +++ b/packages/app/perf/question.bench.ts @@ -17,9 +17,10 @@ export default bench({ web: web({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, - async prepare({ playwright, mock, url }) { + async prepare(ctx) { + const { url } = ctx const server = new URL(url).origin - const page = cached(playwright.page, mock) + const page = cached(ctx) await mockOpenCodeServer(page, { server, diff --git a/packages/app/perf/review.bench.ts b/packages/app/perf/review.bench.ts index b2d494c199..6f272bb6a5 100644 --- a/packages/app/perf/review.bench.ts +++ b/packages/app/perf/review.bench.ts @@ -4,18 +4,24 @@ import { bench, web } from "@hona/strobe" import { scalingDiffs, scalingRows } from "./fixtures/diffs" import { cached } from "./fixtures/mock" import { openReview, review } from "./fixtures/review" +import { keepStartStorage, saveStartStorage } from "./fixtures/storage" import { mockTimelineSession, serveDiffs, timeline } from "./fixtures/timeline" export default bench({ // 100 and 10,000 by default; `--params all` adds the rest of the curve. params: { files: { run: [100, 10_000], more: [1, 10, 1_000] } }, + // Whether setup opens the pane: cases that start with it open share a launch. + setupKey: (ctx) => (ctx.case === "open review" ? "closed" : "open"), + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1366, height: 768 }, - async prepare({ params, playwright, mock, url }) { - const page = cached(playwright.page, mock) + async prepare(ctx) { + const { params, url } = ctx + const page = cached(ctx) + await keepStartStorage(page) const session = await mockTimelineSession(page, { server: new URL(url).origin, historyTurns: 0 }) // The app asks for the changes only when the pane opens. await serveDiffs(page, scalingDiffs(params.files)) @@ -26,11 +32,13 @@ export default bench({ }), }, - async setup({ case: name, page }) { + async setup({ setupKey, page }) { await page.waitFor(timeline, { timeout: 60_000 }) - if (name !== "open review") await openReview(page) + if (setupKey === "open") await openReview(page) await page.idle() + // A reload keeps the review open (the app saves its layout on pagehide), so every run starts from this storage. + await saveStartStorage(page) }, cases: { diff --git a/packages/app/perf/stream.bench.ts b/packages/app/perf/stream.bench.ts index b47564deca..481ea46bb8 100644 --- a/packages/app/perf/stream.bench.ts +++ b/packages/app/perf/stream.bench.ts @@ -45,34 +45,44 @@ const stream: Case<{}> = { }, } +/** What a case's launch sets up beyond the 120-turn session: cases with the same one share a launch. */ +const setups = new Map([ + ["stream into a tool-heavy history", "tool-heavy"], + ["stream with review open", "review"], + [withFind, "find"], + ["wait on a running session", "wait"], +]) + export default bench({ + setupKey: (ctx) => setups.get(ctx.case) ?? "plain", + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1366, height: 768 }, - prepare: ({ case: name, playwright, mock, url }) => - mockTimelineSession(cached(playwright.page, mock), { - server: new URL(url).origin, - historyTurns: name === "stream into a tool-heavy history" ? 320 : 120, - toolHeavy: name === "stream into a tool-heavy history", + prepare: (ctx) => + mockTimelineSession(cached(ctx), { + server: new URL(ctx.url).origin, + historyTurns: ctx.setupKey === "tool-heavy" ? 320 : 120, + toolHeavy: ctx.setupKey === "tool-heavy", busy: true, stream: true, - vcsDiff: name === "stream with review open" ? reviewDiffs() : undefined, + vcsDiff: ctx.setupKey === "review" ? reviewDiffs() : undefined, }), url: ({ prepared }) => prepared.path, }), }, - async setup({ case: name, page }) { + async setup({ setupKey, page }) { await page.waitFor(timeline, { timeout: 60_000 }) - if (name === "stream with review open") await openReview(page) + if (setupKey === "review") await openReview(page) - if (name === withFind) await openFind(page) + if (setupKey === "find") await openFind(page) // Its animations never stop, and with the attribution probes on a slow machine their frames can run long enough // that the page never counts as idle. - if (name === "wait on a running session") return page.wait(2000) + if (setupKey === "wait") return page.wait(2000) await page.idle() }, diff --git a/packages/app/perf/tabs.bench.ts b/packages/app/perf/tabs.bench.ts index f2eab8299c..01ae6a0694 100644 --- a/packages/app/perf/tabs.bench.ts +++ b/packages/app/perf/tabs.bench.ts @@ -36,10 +36,12 @@ const exported = exportFile ? (JSON.parse(readFileSync(exportFile, "utf8")) as S // The destination was rendered before and is cached: switching back and forth. A cached transcript is not fetched // again (`net.requests` on the history endpoint stays 0), and the switch moves nothing that was already on screen. +// The run ends on the frame after the answer shows: headless, it ends at its last step, and the wait at the first +// match, so the style and layout the switch left for that frame would count in main.work but not run.duration. const warm: Case<{}> = { primary: "main.work", metrics: ["run.duration", "interaction.p50", "net.requests{/api/session/*/message}", "layout.shift"], - run: ({ page, prepared }) => page.click(tab(prepared.target), { until: prepared.targetReady }), + run: ({ page, prepared }) => page.click(tab(prepared.target), { until: [prepared.targetReady, "frame"] }), async reset({ page, prepared }) { await page.click(tab(prepared.source), { until: prepared.sourceReady }) await page.idle() @@ -71,7 +73,7 @@ const cases = { ...warm, async run({ page, prepared }) { await page.click(tab(prepared.target), { until: prepared.targetReady }) - await page.click(tab(prepared.source), { until: prepared.sourceReady }) + await page.click(tab(prepared.source), { until: [prepared.sourceReady, "frame"] }) }, reset: ({ page }) => page.idle(), }, @@ -95,22 +97,34 @@ const cases = { } satisfies Record> export default bench({ + // What a case's launch sets up: the sessions and catalog it serves, the review pane, and whether setup has rendered + // the target tab already. Cases with the same setup share a launch. + setupKey: ({ case: name }) => ({ + export: !!exported && name.endsWith("your session"), + catalog: name.includes("model catalog"), + diffs: name.includes("review"), + review: name.includes("review open"), + warm: !name.startsWith("open"), + resized: name.includes("resized"), + }), + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1440, height: 900 }, - async prepare({ case: name, playwright, mock, url }) { + async prepare(ctx) { + const { setupKey: setup, url } = ctx const server = new URL(url).origin - const page = cached(playwright.page, mock) + const page = cached(ctx) - if (exported && name.endsWith("your session")) return mockExport(page, server, exported) + if (exported && setup.export) return mockExport(page, server, exported) await mockOpenCodeServer(page, { server, sessions: fixture.sessions, - provider: name.includes("model catalog") ? catalog(1_200) : fixture.provider, + provider: setup.catalog ? catalog(1_200) : fixture.provider, directory: fixture.directory, project: fixture.project, - vcsDiff: name.includes("review") ? reviewDiffs() : undefined, + vcsDiff: setup.diffs ? reviewDiffs() : undefined, pageMessages: (sessionID) => ({ items: messages[sessionID] ?? [] }), }) await installTimelineSettings(page) @@ -131,17 +145,17 @@ export default bench({ }), }, - async setup({ case: name, page, prepared }) { + async setup({ setupKey: setup, page, prepared }) { await page.waitFor(prepared.sourceReady, { timeout: 60_000 }) - if (name.includes("review open")) await openReview(page) + if (setup.review) await openReview(page) - if (!name.startsWith("open")) { + if (setup.warm) { await page.click(tab(prepared.target), { until: prepared.targetReady, timeout: 60_000 }) await page.click(tab(prepared.source), { until: prepared.sourceReady }) } - if (name.includes("resized")) await openReview(page) + if (setup.resized) await openReview(page) await page.idle() }, diff --git a/packages/app/perf/timeline.bench.ts b/packages/app/perf/timeline.bench.ts index a5a2e96825..4ed253c415 100644 --- a/packages/app/perf/timeline.bench.ts +++ b/packages/app/perf/timeline.bench.ts @@ -19,37 +19,40 @@ const drag = "drag the review's edge" // The divider between the session and the side panel, read once the review is open. The session panel keeps at least // 400px, the side panel 320px and the 8px gap. +const handle = '[data-slot="session-chat-panel"] > div > [data-component="resize-handle"]' + let divider: Divider | undefined export default bench({ + // The session a case's launch loads: the edits alone, the history beside the review, or the history. Cases with the + // same one share a launch. + setupKey: (ctx) => (ctx.case === "expand an edit" ? "edits" : ctx.case === drag ? "review" : "history"), + targets: { web: web({ expect: { title: "OpenCode" }, viewport: { width: 1366, height: 768 }, - prepare: async ({ case: name, playwright, mock, url }) => ({ - ...(await mockTimelineSession(cached(playwright.page, mock), { - server: new URL(url).origin, + prepare: async (ctx) => + mockTimelineSession(cached(ctx), { + server: new URL(ctx.url).origin, // The edits alone, so the case measures the diff, not the history around it. - historyTurns: name === "expand an edit" ? 0 : 120, - collapsedEdits: name === "expand an edit", - tools: name === "expand an edit" ? await editTools() : undefined, - vcsDiff: name === drag ? reviewDiffs() : undefined, - })), - mouse: playwright.page.mouse, - }), + historyTurns: ctx.setupKey === "edits" ? 0 : 120, + collapsedEdits: ctx.setupKey === "edits", + tools: ctx.setupKey === "edits" ? await editTools() : undefined, + vcsDiff: ctx.setupKey === "review" ? reviewDiffs() : undefined, + }), url: ({ prepared }) => prepared.path, }), }, - async setup({ case: name, page }) { + async setup({ setupKey, page }) { await page.waitFor(timeline, { timeout: 60_000 }) await page.waitFor(composer) - if (name === drag) { + if (setupKey === "review") { await openReview(page) await page.idle() divider = await page.eval(measureDivider, { - selector: '[data-slot="session-chat-panel"] > div > [data-component="resize-handle"]', panel: '[data-slot="session-chat-panel"]', row: "[data-pane-row]", min: 400, @@ -118,7 +121,7 @@ export default bench({ [drag]: { primary: "frames.dropped.pct", metrics: ["main.work", "main.layout", "main.style", "main.script", "frames.interval.p95"], - run: ({ prepared }) => dragDivider(prepared.mouse, divider!), + run: ({ page }) => dragDivider(page, handle, divider!), reset: ({ page }) => page.idle(), }, }, diff --git a/packages/app/src/components-lab/lab.tsx b/packages/app/src/components-lab/lab.tsx index fee9821ea8..3c2a6297f8 100644 --- a/packages/app/src/components-lab/lab.tsx +++ b/packages/app/src/components-lab/lab.tsx @@ -49,8 +49,12 @@ import { } from "./catalog" import { createLabStageState, + INITIAL_LAB_BROWSE_STATE, labStageIndex, + selectShouldToggleFolder, + transitionLabBrowse, transitionLabStage, + type LabBrowseEvent, type LabStageEffect, type LabStageEvent, } from "./machine" @@ -124,18 +128,20 @@ export default function ComponentsLab() { let palette: CommandPalette | undefined let toggle: ((id: string) => void) | undefined let focusTree: ((id?: string) => void) | undefined - // While browsing the tree by keys, a story that focuses something as it mounts (a dialog, a field) would take the - // keys away. A press or Tab anywhere ends browsing; a few returns at most, so a story that traps focus still wins. - let browsing = 0 - // The key behind the latest selection; none for a press. - let key: string | undefined + let browse = INITIAL_LAB_BROWSE_STATE + + const dispatchBrowse = (event: LabBrowseEvent) => { + const next = transitionLabBrowse(browse, event) + browse = next.state + next.effects.forEach(() => focusTree?.(params.story)) + } const entries = () => catalog()?.entries ?? [] const grid = () => params.view === "grid" const selected = createMemo(() => (grid() ? undefined : entries().find((entry) => entry.file === params.story))) const open = (file: string) => { - browsing = stories.contains(document.activeElement) ? 3 : 0 + dispatchBrowse({ type: "story.opened", fromTree: stories.contains(document.activeElement) }) setParams({ story: file, view: undefined }) } @@ -229,7 +235,7 @@ export default function ComponentsLab() { onSelect={(_, primary) => { if (!primary?.startsWith("folder:")) return primary && open(primary) - if (key === undefined || key === " ") toggle?.(primary) + if (selectShouldToggleFolder(browse)) toggle?.(primary) }} onActivate={(id) => (id.startsWith("folder:") ? toggle?.(id) : open(id))} /> @@ -261,20 +267,23 @@ export default function ComponentsLab() { )) - makeEventListener(window, "pointerdown", () => ((browsing = 0), (key = undefined)), { capture: true }) + const inTree = (event: Event) => event.target instanceof Node && stories.contains(event.target) + + makeEventListener(window, "pointerdown", (event) => dispatchBrowse({ type: "pointer.down", inTree: inTree(event) }), { + capture: true, + }) + // Bubbling, so the tree's own pointerup (which completes a press on a selected row) selects first. + makeEventListener(window, "pointerup", () => dispatchBrowse({ type: "pointer.ended" })) + makeEventListener(window, "pointercancel", () => dispatchBrowse({ type: "pointer.ended" })) makeEventListener( window, "keydown", - (event) => { - key = event.key - - if (event.key === "Tab") browsing = 0 - }, + (event) => dispatchBrowse({ type: "key.down", key: event.key, inTree: inTree(event) }), { capture: true }, ) - makeEventListener(stage, "focusin", () => { - if (browsing-- > 0) focusTree?.(params.story) - }) + makeEventListener(window, "keyup", () => dispatchBrowse({ type: "key.ended" })) + makeEventListener(window, "blur", () => dispatchBrowse({ type: "window.blurred" })) + makeEventListener(stage, "focusin", () => dispatchBrowse({ type: "stage.focused" })) let element!: HTMLDivElement diff --git a/packages/app/src/components-lab/machine.test.ts b/packages/app/src/components-lab/machine.test.ts index 2d3da78343..8650e39532 100644 --- a/packages/app/src/components-lab/machine.test.ts +++ b/packages/app/src/components-lab/machine.test.ts @@ -1,13 +1,91 @@ import { expect, test } from "bun:test" import { createLabStageState, + INITIAL_LAB_BROWSE_STATE, labStageIndex, + selectShouldToggleFolder, + transitionLabBrowse, transitionLabStage, + type LabBrowseEvent, + type LabBrowseState, type LabStageEvent, type LabStageState, type LabStageTransition, } from "./machine" +/** Each event's effects from `state`, and the state after the last. */ +const browse = (state: LabBrowseState, ...events: LabBrowseEvent[]) => + events.reduce<{ state: LabBrowseState; effects: string[] }>( + (current, event) => { + const next = transitionLabBrowse(current.state, event) + + return { state: next.state, effects: [...current.effects, ...next.effects.map((effect) => effect.type)] } + }, + { state, effects: [] }, + ) + +test("focus moving inside the stage at rest stays at rest", () => { + const focused = browse(INITIAL_LAB_BROWSE_STATE, { type: "stage.focused" }, { type: "stage.focused" }) + + expect(focused.state).toBe(INITIAL_LAB_BROWSE_STATE) + expect(focused.effects).toEqual([]) + + // Many focus moves later, a story opened from the tree still gets exactly three returns. + const opened = browse( + focused.state, + { type: "story.opened", fromTree: true }, + ...Array.from({ length: 4 }, () => ({ type: "stage.focused" }) as const), + ) + + expect(opened.effects).toEqual(["focus.tree", "focus.tree", "focus.tree"]) + expect(opened.state).toBe(INITIAL_LAB_BROWSE_STATE) +}) + +test.each([{ type: "key.ended" }, { type: "window.blurred" }] as const)( + "a Space press in the tree no longer toggles folders after $type", + (end) => { + const pressed = browse(INITIAL_LAB_BROWSE_STATE, { type: "key.down", key: " ", inTree: true }) + + expect(selectShouldToggleFolder(pressed.state)).toBe(true) + expect(selectShouldToggleFolder(browse(pressed.state, end).state)).toBe(false) + }, +) + +test("a Space press outside the tree and arrow keys in it never toggle folders", () => { + expect(selectShouldToggleFolder(INITIAL_LAB_BROWSE_STATE)).toBe(false) + expect(browse(INITIAL_LAB_BROWSE_STATE, { type: "key.down", key: " ", inTree: false }).state).toBe( + INITIAL_LAB_BROWSE_STATE, + ) + expect( + selectShouldToggleFolder( + browse( + INITIAL_LAB_BROWSE_STATE, + { type: "key.down", key: " ", inTree: true }, + { type: "key.down", key: "ArrowDown", inTree: true }, + ).state, + ), + ).toBe(false) +}) + +test("a click in the tree toggles folders until the press ends", () => { + const pressed = browse(INITIAL_LAB_BROWSE_STATE, { type: "pointer.down", inTree: true }) + + expect(selectShouldToggleFolder(pressed.state)).toBe(true) + expect(browse(pressed.state, { type: "pointer.ended" }).state).toBe(INITIAL_LAB_BROWSE_STATE) +}) + +test.each([ + { type: "key.down", key: "Tab", inTree: true }, + { type: "pointer.down", inTree: false }, +] as const)("$type ends browsing before the stage takes focus", (exit) => { + const ended = browse(INITIAL_LAB_BROWSE_STATE, { type: "story.opened", fromTree: true }, exit, { + type: "stage.focused", + }) + + expect(ended.effects).toEqual([]) + expect(ended.state).toBe(INITIAL_LAB_BROWSE_STATE) +}) + const names = ["Closed", "Opening", "Open"] /** The last transition of `events` from `state`. */ diff --git a/packages/app/src/components-lab/machine.ts b/packages/app/src/components-lab/machine.ts index 7699bde89f..1f1cd9b10c 100644 --- a/packages/app/src/components-lab/machine.ts +++ b/packages/app/src/components-lab/machine.ts @@ -139,3 +139,91 @@ function show( function unchanged(state: LabStageState): LabStageTransition { return { state, effects: [] } } + +/** + * How a press reached the tree. A folder opens and closes only by a click or Space in the tree, so moving by arrows + * (which selects as it goes) or a selection from elsewhere leaves it as it is. + */ +export type LabTreeGesture = "none" | "pointer" | "space" + +/** + * While browsing the tree by keys, a story that focuses something as it mounts (a dialog, a field) would take the + * keys away. A press or Tab anywhere ends browsing; a few returns at most, so a story that traps focus still wins. + */ +export type LabBrowseState = + | { readonly status: "idle"; readonly gesture: LabTreeGesture } + | { readonly status: "browsing"; readonly redirects: 1 | 2 | 3; readonly gesture: LabTreeGesture } + +export type LabBrowseEvent = + | { readonly type: "pointer.down"; readonly inTree: boolean } + | { readonly type: "pointer.ended" } + | { readonly type: "key.down"; readonly key: string; readonly inTree: boolean } + | { readonly type: "key.ended" } + | { readonly type: "window.blurred" } + | { readonly type: "story.opened"; readonly fromTree: boolean } + /** Focus moved into the stage. */ + | { readonly type: "stage.focused" } + +export type LabBrowseEffect = { readonly type: "focus.tree" } + +export type LabBrowseTransition = { + readonly state: LabBrowseState + readonly effects: readonly LabBrowseEffect[] +} + +export const INITIAL_LAB_BROWSE_STATE: LabBrowseState = Object.freeze({ status: "idle", gesture: "none" }) + +export function transitionLabBrowse(state: LabBrowseState, event: LabBrowseEvent): LabBrowseTransition { + if (event.type === "pointer.down") { + const gesture = event.inTree ? "pointer" : "none" + + return { state: state.status === "idle" && state.gesture === gesture ? state : idle(gesture), effects: [] } + } + + if (event.type === "key.down") { + if (event.key === "Tab") return { state: INITIAL_LAB_BROWSE_STATE, effects: [] } + + return { state: withGesture(state, event.key === " " && event.inTree ? "space" : "none"), effects: [] } + } + + if (event.type === "pointer.ended") + return { state: state.gesture === "pointer" ? withGesture(state, "none") : state, effects: [] } + + if (event.type === "key.ended") + return { state: state.gesture === "space" ? withGesture(state, "none") : state, effects: [] } + + if (event.type === "window.blurred") return { state: INITIAL_LAB_BROWSE_STATE, effects: [] } + + if (event.type === "story.opened") { + if (!event.fromTree) return { state: idle(state.gesture), effects: [] } + + return { state: { status: "browsing", redirects: 3, gesture: state.gesture }, effects: [] } + } + + if (state.status === "idle") return { state, effects: [] } + + return { + state: + state.redirects === 1 + ? idle(state.gesture) + : { status: "browsing", redirects: state.redirects === 3 ? 2 : 1, gesture: state.gesture }, + effects: [{ type: "focus.tree" }], + } +} + +/** A selection of a folder toggles it only while a click or Space in the tree caused it. */ +export function selectShouldToggleFolder(state: LabBrowseState) { + return state.gesture !== "none" +} + +function idle(gesture: LabTreeGesture): LabBrowseState { + return gesture === "none" ? INITIAL_LAB_BROWSE_STATE : { status: "idle", gesture } +} + +function withGesture(state: LabBrowseState, gesture: LabTreeGesture): LabBrowseState { + if (state.gesture === gesture) return state + + if (state.status === "idle") return idle(gesture) + + return { ...state, gesture } +} diff --git a/packages/app/src/composer/adapter.ts b/packages/app/src/composer/adapter.ts index adebf3de41..6822d7b919 100644 --- a/packages/app/src/composer/adapter.ts +++ b/packages/app/src/composer/adapter.ts @@ -51,14 +51,20 @@ export type ComposerQueue = { cancelEdit: () => void // Loads the first queued prompt into the composer. Returns false when the queue is empty. editFirst: () => boolean + // Moves an admitted follow-up ahead of the queued prompts, using the queue's serialized reorder. + first: (inboxID: string) => void + // Steers the next prompt only while the queue is idle; never skips a busy first row. + steerFirst: () => void } export type ComposerSession = { id: string directory: string - // The timeline's optimistic prompt: shown on `set`, held after `settle` until its admission echo, removed on `clear`. + // The timeline's optimistic prompt: shown on `set` (or `hold` while the send waits for the Location's agents and models), + // held after `settle` until its admission echo, removed on `clear`. handoff: { set: (handoff: SessionMessageHandoff) => void + hold: (handoff: SessionMessageHandoff) => void settle: (messageID: string) => void clear: (messageID: string) => void } @@ -81,11 +87,18 @@ export type ComposerSession = { ) => ReturnType } } + file: { + list: ( + input: Parameters[0], + ) => Promise<{ data: readonly { path: string }[] }> + } data: { location: { command: Pick } session: { prompt: (input: Parameters[0]) => ReturnType setStatus: Data["session"]["setStatus"] + // Records an accepted user send so the desktop list promotes the session immediately. + acceptSend: (sessionID: string) => void } } current: Accessor< diff --git a/packages/app/src/composer/attachments/attachments.ts b/packages/app/src/composer/attachments/attachments.ts index 0e1c00e760..6547a9aed3 100644 --- a/packages/app/src/composer/attachments/attachments.ts +++ b/packages/app/src/composer/attachments/attachments.ts @@ -1,5 +1,4 @@ import { onCleanup, onMount } from "solid-js" -import { createStore } from "solid-js/store" import { makeEventListener } from "@solid-primitives/event-listener" import { createBlobReference } from "@/runtime/persistence/drafts" import { uuid } from "@opencode/util/uuid" @@ -9,6 +8,8 @@ import type { AttachmentDestination } from "./destination" import { uploads } from "./uploads" type PromptTarget = { + /** The draft the prompt belongs to, which owns uploads started for it across composer remounts. */ + scope?: object current: () => ComposerPrompt cursor: () => number | undefined set: (prompt: ComposerPrompt, cursor?: number) => void @@ -55,8 +56,9 @@ export function createComposerAttachments( return { prompt, cursor: prompt.cursor() ?? cursorPosition(editor) } } - // Uploads this composer started; they finish (or fail) even if the composer unmounts. - const [pending, setPending] = createStore<{ ids: string[] }>({ ids: [] }) + // A composer without a draft scope owns its uploads itself. + const fallbackScope = {} + const scopeOf = (prompt = input.capture()) => prompt.scope ?? fallbackScope // Media the model reads natively travels inline with the prompt, so its bytes live in the draft // store. Everything else, including text, reaches the model as a path on the server that its @@ -125,19 +127,16 @@ export function createComposerAttachments( target: NonNullable>, destination: AttachmentDestination, ) => { - const id = uuid() - setPending("ids", (ids) => [...ids, id]) - const path = await uploads - .track({ id, filename: file.name, mime, size: file.size }, (report, signal) => - destination.upload(file, report, signal), + .track( + { id: uuid(), scope: scopeOf(target.prompt), filename: file.name, mime, size: file.size }, + (report, signal) => destination.upload(file, report, signal), ) .catch((error) => { input.onUploadError(error) return undefined }) - .finally(() => setPending("ids", (ids) => ids.filter((item) => item !== id))) if (path) addPath(target, { filename: file.name, mime, path }) } @@ -251,10 +250,8 @@ export function createComposerAttachments( handlePaste, handleDrop, /** Uploads still in flight for this composer; sending waits for them. */ - pending: () => uploads.items().filter((item) => pending.ids.includes(item.id)), - cancel(id: string) { - uploads.items().find((item) => item.id === id)?.cancel() - }, + pending: () => uploads.forScope(scopeOf()), + cancel: (id: string) => uploads.cancel(id), pick(fallback: () => void, done: () => void) { if (!input.picker) { fallback() diff --git a/packages/app/src/composer/attachments/upload-machine.ts b/packages/app/src/composer/attachments/upload-machine.ts new file mode 100644 index 0000000000..00f0423aa3 --- /dev/null +++ b/packages/app/src/composer/attachments/upload-machine.ts @@ -0,0 +1,185 @@ +// An upload whose body stops advancing for this long is stuck on a dead connection; it fails instead of blocking sends. +export const UPLOAD_STALL_TIMEOUT_MS = 60_000 + +/** The failure a stalled upload rejects with; it carries no message, so the toast shows the generic one. */ +export const UPLOAD_TIMED_OUT = Object.freeze({ reason: "timed-out" as const }) + +/** The draft an upload writes into, compared by identity; closing that draft cancels its uploads. */ +export type UploadScope = object + +export type UploadEntry = { + readonly id: string + readonly attempt: number + readonly scope: UploadScope + readonly filename: string + readonly mime: string + readonly size: number + readonly loaded: number + /** + * Only `sending` arms the stall timer. A `queued` request may wait behind the browser's per-host connection + * limit before its first progress event, and a `sent` body waits on the server's answer; neither is a stall. + */ + readonly transfer: "queued" | "sending" | "sent" +} + +/** + * Every upload in flight, process-wide: uploads outlive the composer view that started them. + * - `idle`: nothing uploads. + * - `uploading`: `entries` is never empty, in start order. + */ +export type UploadMachineState = + | { readonly status: "idle"; readonly issued: number } + | { readonly status: "uploading"; readonly issued: number; readonly entries: readonly UploadEntry[] } + +export type UploadMachineEvent = + | { + readonly type: "upload.started" + readonly id: string + readonly scope: UploadScope + readonly filename: string + readonly mime: string + readonly size: number + } + | { readonly type: "upload.progress"; readonly attempt: number; readonly loaded: number } + | { readonly type: "upload.succeeded"; readonly attempt: number; readonly path: string } + | { readonly type: "upload.failed"; readonly attempt: number; readonly error: unknown } + | { readonly type: "upload.timed-out"; readonly attempt: number } + | { readonly type: "upload.cancelled"; readonly id: string } + | { readonly type: "scope.cancelled"; readonly scope: UploadScope } + +export type UploadMachineEffect = + | { readonly type: "upload.run"; readonly attempt: number } + | { readonly type: "timer.reset"; readonly attempt: number; readonly timeoutMs: number } + | { readonly type: "timer.clear"; readonly attempt: number } + | { readonly type: "upload.abort"; readonly attempt: number } + | { readonly type: "upload.resolve"; readonly attempt: number; readonly path: string | undefined } + | { readonly type: "upload.reject"; readonly attempt: number; readonly error: unknown } + +export type UploadMachineTransition = { + readonly state: UploadMachineState + readonly effects: readonly UploadMachineEffect[] +} + +export const INITIAL_UPLOAD_MACHINE_STATE: UploadMachineState = Object.freeze({ status: "idle", issued: 0 }) + +const NO_EFFECTS: readonly UploadMachineEffect[] = Object.freeze([]) + +const NO_ENTRIES: readonly UploadEntry[] = Object.freeze([]) + +export function transitionUploads(state: UploadMachineState, event: UploadMachineEvent): UploadMachineTransition { + if (event.type === "upload.started") { + const entries = selectUploadEntries(state) + + if (entries.some((entry) => entry.id === event.id)) return stay(state) + const attempt = state.issued + 1 + + return { + state: { + status: "uploading", + issued: attempt, + entries: [ + ...entries, + { + id: event.id, + attempt, + scope: event.scope, + filename: event.filename, + mime: event.mime, + size: event.size, + loaded: 0, + transfer: "queued", + }, + ], + }, + effects: [{ type: "upload.run", attempt }], + } + } + + if (state.status === "idle") return stay(state) + + if (event.type === "scope.cancelled") { + const cancelled = state.entries.filter((entry) => entry.scope === event.scope) + + if (cancelled.length === 0) return stay(state) + + return finish( + state, + state.entries.filter((entry) => entry.scope !== event.scope), + cancelled.flatMap((entry) => cancel(entry.attempt)), + ) + } + + const entry = state.entries.find((item) => + event.type === "upload.cancelled" ? item.id === event.id : item.attempt === event.attempt, + ) + + if (!entry) return stay(state) + const rest = () => state.entries.filter((item) => item !== entry) + + switch (event.type) { + case "upload.progress": { + const loaded = Math.min(Math.max(event.loaded, entry.loaded), entry.size) + const transfer = loaded === entry.size ? "sent" : "sending" + + if (loaded === entry.loaded && transfer === entry.transfer) return stay(state) + + return { + state: { + ...state, + entries: state.entries.map((item) => (item === entry ? { ...entry, loaded, transfer } : item)), + }, + effects: + transfer === "sending" + ? [{ type: "timer.reset", attempt: entry.attempt, timeoutMs: UPLOAD_STALL_TIMEOUT_MS }] + : entry.transfer === "sending" + ? [{ type: "timer.clear", attempt: entry.attempt }] + : NO_EFFECTS, + } + } + + case "upload.succeeded": + return finish(state, rest(), [{ type: "upload.resolve", attempt: entry.attempt, path: event.path }]) + case "upload.failed": + return finish(state, rest(), [{ type: "upload.reject", attempt: entry.attempt, error: event.error }]) + case "upload.timed-out": + if (entry.transfer !== "sending") return stay(state) + + return finish(state, rest(), [ + { type: "upload.abort", attempt: entry.attempt }, + { type: "upload.reject", attempt: entry.attempt, error: UPLOAD_TIMED_OUT }, + ]) + case "upload.cancelled": + return finish(state, rest(), cancel(entry.attempt)) + } +} + +export function selectUploadEntries(state: UploadMachineState) { + return state.status === "uploading" ? state.entries : NO_ENTRIES +} + +export function uploadPercent(item: Pick) { + return item.size === 0 ? 100 : Math.floor((item.loaded / item.size) * 100) +} + +// A cancelled upload settles without its work: the work may wait where it cannot observe the abort. +function cancel(attempt: number): UploadMachineEffect[] { + return [ + { type: "upload.abort", attempt }, + { type: "upload.resolve", attempt, path: undefined }, + ] +} + +function finish( + state: Extract, + entries: readonly UploadEntry[], + effects: readonly UploadMachineEffect[], +): UploadMachineTransition { + return { + state: entries.length === 0 ? { status: "idle", issued: state.issued } : { ...state, entries }, + effects, + } +} + +function stay(state: UploadMachineState): UploadMachineTransition { + return { state, effects: NO_EFFECTS } +} diff --git a/packages/app/src/composer/attachments/uploads.test.ts b/packages/app/src/composer/attachments/uploads.test.ts index 2762313e62..9d1103650b 100644 --- a/packages/app/src/composer/attachments/uploads.test.ts +++ b/packages/app/src/composer/attachments/uploads.test.ts @@ -1,14 +1,127 @@ -import { expect, test } from "bun:test" +import { afterEach, describe, expect, jest, test } from "bun:test" import { uploads } from "./uploads" +import { + INITIAL_UPLOAD_MACHINE_STATE, + UPLOAD_STALL_TIMEOUT_MS, + UPLOAD_TIMED_OUT, + transitionUploads, + type UploadMachineEvent, + type UploadMachineState, + type UploadMachineTransition, + type UploadScope, +} from "./upload-machine" -test("cancelling an upload drops it even when its work never settles", async () => { - const pending = uploads.track({ id: "stalled", filename: "image.png", mime: "image/png", size: 1024 }, () => - new Promise(() => {}), - ) +const scopeA = {} - expect(uploads.items().map((item) => item.id)).toEqual(["stalled"]) - uploads.items()[0]?.cancel() +const scopeB = {} - expect(await pending).toBeUndefined() - expect(uploads.items()).toEqual([]) +function start(id: string, scope: UploadScope): UploadMachineEvent { + return { type: "upload.started", id, scope, filename: `${id}.bin`, mime: "application/octet-stream", size: 1024 } +} + +function replay(events: UploadMachineEvent[], state: UploadMachineState = INITIAL_UPLOAD_MACHINE_STATE) { + const initial: UploadMachineTransition = { state, effects: [] } + + return events.reduce((result, event) => transitionUploads(result.state, event), initial) +} + +afterEach(() => { + jest.useRealTimers() +}) + +describe("transitionUploads", () => { + test("a queued upload has no stall timer until its first progress event, then only forward progress resets it", () => { + const queued = replay([start("u1", scopeA)]) + + expect(queued.effects).toEqual([{ type: "upload.run", attempt: 1 }]) + expect(transitionUploads(queued.state, { type: "upload.timed-out", attempt: 1 }).state).toBe(queued.state) + + const connected = replay([{ type: "upload.progress", attempt: 1, loaded: 0 }], queued.state) + + expect(connected.state).toMatchObject({ entries: [{ id: "u1", loaded: 0, transfer: "sending" }] }) + expect(connected.effects).toEqual([{ type: "timer.reset", attempt: 1, timeoutMs: UPLOAD_STALL_TIMEOUT_MS }]) + + const progressed = replay([{ type: "upload.progress", attempt: 1, loaded: 512 }], connected.state) + + expect(progressed.effects).toEqual([{ type: "timer.reset", attempt: 1, timeoutMs: UPLOAD_STALL_TIMEOUT_MS }]) + expect(transitionUploads(progressed.state, { type: "upload.progress", attempt: 1, loaded: 256 }).state).toBe( + progressed.state, + ) + + expect(transitionUploads(progressed.state, { type: "upload.timed-out", attempt: 1 })).toEqual({ + state: { status: "idle", issued: 1 }, + effects: [ + { type: "upload.abort", attempt: 1 }, + { type: "upload.reject", attempt: 1, error: UPLOAD_TIMED_OUT }, + ], + }) + }) + + test("a fully sent body waits for the server's answer without a stall timer", () => { + const sending = replay([start("u1", scopeA), { type: "upload.progress", attempt: 1, loaded: 512 }]) + const sent = replay([{ type: "upload.progress", attempt: 1, loaded: 4096 }], sending.state) + + expect(sent.state).toMatchObject({ entries: [{ id: "u1", loaded: 1024, transfer: "sent" }] }) + expect(sent.effects).toEqual([{ type: "timer.clear", attempt: 1 }]) + expect(transitionUploads(sent.state, { type: "upload.timed-out", attempt: 1 }).state).toBe(sent.state) + expect(transitionUploads(sent.state, { type: "upload.succeeded", attempt: 1, path: "/tmp/u1.bin" })).toEqual({ + state: { status: "idle", issued: 1 }, + effects: [{ type: "upload.resolve", attempt: 1, path: "/tmp/u1.bin" }], + }) + }) + + test("closing a draft cancels only that draft's uploads", () => { + const result = replay([start("u1", scopeA), start("u2", scopeB), { type: "scope.cancelled", scope: scopeA }]) + + expect(result.state).toMatchObject({ status: "uploading", entries: [{ id: "u2", scope: scopeB }] }) + expect(result.effects).toEqual([ + { type: "upload.abort", attempt: 1 }, + { type: "upload.resolve", attempt: 1, path: undefined }, + ]) + }) + + test("a result for an upload that was cancelled or already settled is ignored", () => { + const cancelled = replay([start("u1", scopeA), { type: "upload.cancelled", id: "u1" }]) + + expect(cancelled.state).toEqual({ status: "idle", issued: 1 }) + expect(transitionUploads(cancelled.state, { type: "upload.failed", attempt: 1, error: new Error("x") }).state).toBe( + cancelled.state, + ) + expect(transitionUploads(cancelled.state, { type: "upload.cancelled", id: "u1" }).state).toBe(cancelled.state) + }) +}) + +describe("uploads", () => { + test("cancelling an upload drops it even when its work never settles", async () => { + const pending = uploads.track( + { id: "stalled", scope: scopeA, filename: "image.png", mime: "image/png", size: 1024 }, + () => new Promise(() => {}), + ) + + expect(uploads.items().map((item) => item.id)).toEqual(["stalled"]) + uploads.items()[0]?.cancel() + + expect(await pending).toBeUndefined() + expect(uploads.items()).toEqual([]) + }) + + test("an upload whose body stops advancing fails after the stall timeout instead of blocking sends", async () => { + jest.useFakeTimers() + + const pending = uploads.track( + { id: "hung", scope: scopeB, filename: "big.zip", mime: "application/zip", size: 1024 }, + (report) => { + report(100) + + return new Promise(() => {}) + }, + ) + + expect(uploads.forScope(scopeB).map((item) => item.id)).toEqual(["hung"]) + expect(uploads.forScope(scopeA)).toEqual([]) + jest.advanceTimersByTime(UPLOAD_STALL_TIMEOUT_MS) + + await expect(pending).rejects.toBe(UPLOAD_TIMED_OUT) + expect(uploads.forScope(scopeB)).toEqual([]) + }) }) diff --git a/packages/app/src/composer/attachments/uploads.tsx b/packages/app/src/composer/attachments/uploads.tsx index b8f5470b04..e2b9aed459 100644 --- a/packages/app/src/composer/attachments/uploads.tsx +++ b/packages/app/src/composer/attachments/uploads.tsx @@ -1,8 +1,19 @@ -import { createEffect, createRoot, For, on, onCleanup } from "solid-js" -import { createStore } from "solid-js/store" +import { createEffect, createRoot, createSignal, For, on, onCleanup, untrack } from "solid-js" +import { createStore, reconcile } from "solid-js/store" import { Icon } from "@opencode/ui/icon" import { Toast, toaster } from "@opencode/ui/toast" +import { abort } from "@opencode/util/abort" import { useLanguage } from "@/runtime/i18n/language" +import { + INITIAL_UPLOAD_MACHINE_STATE, + selectUploadEntries, + transitionUploads, + uploadPercent, + type UploadEntry, + type UploadScope, + type UploadMachineEffect, + type UploadMachineEvent, +} from "./upload-machine" export type Upload = { id: string @@ -13,39 +24,112 @@ export type Upload = { cancel: () => void } -// Uploads outlive the composer that started them, so one process-wide list feeds every chip +type UploadWork = (report: (loaded: number) => void, signal: AbortSignal) => Promise + +// Uploads outlive the composer that started them, so one process-wide machine feeds every chip // and the single progress toast. -const [state, setState] = createStore<{ items: Upload[] }>({ items: [] }) +const [machineState, setMachineState] = createSignal(INITIAL_UPLOAD_MACHINE_STATE) -export const uploads = { - items: () => state.items, - /** Runs `work` while the upload is listed. Resolves to undefined when the user cancels it. */ - async track( - input: Pick, - work: (report: (loaded: number) => void, signal: AbortSignal) => Promise, - ): Promise { - const controller = new AbortController() - - // The work may wait where it cannot observe the signal, such as a request queued behind - // others, so cancelling settles without it. - const cancelled = new Promise((resolve) => - controller.signal.addEventListener("abort", () => resolve(undefined), { once: true }), +// Rows keep their identity while progress streams, so a cancel button under the pointer is not replaced. +const [view, setView] = createStore<{ items: Upload[] }>({ items: [] }) + +type Run = { + work: UploadWork + result: PromiseWithResolvers + controller: AbortController + timer?: ReturnType +} + +const runs = new Map() + +// Handed from `track` to the `upload.run` effect its start causes in the same dispatch. +let starting: { work: UploadWork; result: PromiseWithResolvers } | undefined + +function dispatch(event: UploadMachineEvent) { + const previous = untrack(machineState) + const next = transitionUploads(previous, event) + + if (next.state !== previous) { + setMachineState(next.state) + setView("items", reconcile(selectUploadEntries(next.state).map(row), { key: "id" })) + } + + next.effects.forEach(run) +} + +function row(entry: UploadEntry): Upload { + return { + id: entry.id, + filename: entry.filename, + mime: entry.mime, + size: entry.size, + loaded: entry.loaded, + cancel: () => dispatch({ type: "upload.cancelled", id: entry.id }), + } +} + +function run(effect: UploadMachineEffect) { + const attempt = effect.attempt + + if (effect.type === "upload.run") { + if (!starting) return + const current: Run = { ...starting, controller: new AbortController() } + starting = undefined + runs.set(attempt, current) + void Promise.try(() => + current.work((loaded) => dispatch({ type: "upload.progress", attempt, loaded }), current.controller.signal), + ).then( + (path) => dispatch({ type: "upload.succeeded", attempt, path }), + (error) => dispatch({ type: "upload.failed", attempt, error }), ) - setState("items", (items) => [...items, { ...input, loaded: 0, cancel: () => controller.abort() }]) - - try { - return await Promise.race([ - work((loaded) => setState("items", (item) => item.id === input.id, "loaded", loaded), controller.signal), - cancelled, - ]) - } catch (error) { - if (controller.signal.aborted) return undefined - throw error - } finally { - setState("items", (items) => items.filter((item) => item.id !== input.id)) + return + } + + const current = runs.get(attempt) + + if (!current) return + clearTimeout(current.timer) + + if (effect.type === "timer.clear") return + + if (effect.type === "timer.reset") { + current.timer = setTimeout(() => dispatch({ type: "upload.timed-out", attempt }), effect.timeoutMs) + + return + } + + if (effect.type === "upload.abort") return abort(current.controller) + runs.delete(attempt) + + if (effect.type === "upload.resolve") return current.result.resolve(effect.path) + current.result.reject(effect.error) +} + +export const uploads = { + items: () => view.items, + /** Uploads in flight for one draft; they survive the composer view remounting. */ + forScope(scope: UploadScope) { + const ids = selectUploadEntries(machineState()).flatMap((entry) => (entry.scope === scope ? [entry.id] : [])) + + return view.items.filter((item) => ids.includes(item.id)) + }, + /** Runs `work` while the upload is listed and resolves to its path, or to undefined when it is cancelled. */ + track(input: Pick, work: UploadWork) { + const result = Promise.withResolvers() + starting = { work, result } + dispatch({ type: "upload.started", ...input }) + + // A duplicate id starts nothing. + if (starting) { + starting = undefined + result.resolve(undefined) } + + return result.promise }, + cancel: (id: string) => dispatch({ type: "upload.cancelled", id }), + cancelScope: (scope: UploadScope) => dispatch({ type: "scope.cancelled", scope }), } // Sonner builds toast content outside the app's Solid tree: no context and no owner. This host @@ -53,34 +137,45 @@ export const uploads = { // root of its own so progress stays reactive. export function UploadToastHost() { const language = useLanguage() - let active: { id: number; dispose: () => void } | undefined + let toast: { id: number; dispose: () => void } | undefined const dismiss = () => { - if (!active) return - toaster.dismiss(active.id) - active.dispose() - active = undefined + if (!toast) return + toaster.dismiss(toast.id) + toast.dispose() + toast = undefined } createEffect( on( - () => state.items.length > 0, + () => view.items.length > 0, (uploading) => { if (!uploading) return dismiss() - if (active) return + if (toast) return + let root: (() => void) | undefined const id = toaster.show( - (props) => - createRoot((dispose) => { - active = { id: props.toastId, dispose } + (props) => { + // Sonner renders the content again when the toast resizes; the previous root must not leak. + root?.() + + return createRoot((dispose) => { + root = dispose return - }), - { persistent: true, resize: () => state.items.length }, + }) + }, + { persistent: true, resize: () => view.items.length }, ) - active ??= { id, dispose: () => {} } + toast = { + id, + dispose: () => { + root?.() + root = undefined + }, + } }, ), ) @@ -90,12 +185,10 @@ export function UploadToastHost() { } function UploadToast(props: { toastId: number; language: ReturnType }) { - const percent = (item: Upload) => (item.size === 0 ? 100 : Math.floor((item.loaded / item.size) * 100)) - return ( - + {(item) => (
@@ -103,7 +196,7 @@ function UploadToast(props: { toastId: number; language: ReturnType - {props.language.t("prompt.toast.uploading.percent", { percent: percent(item) })} + {props.language.t("prompt.toast.uploading.percent", { percent: uploadPercent(item) })}
@@ -113,9 +206,9 @@ function UploadToast(props: { toastId: number; language: ReturnType -
+
-
+
document.activeElement?.scrollIntoView({ block: "nearest", inline: "nearest" })} - aria-hidden={state.mode === "shell"} - inert={state.mode === "shell" ? true : undefined} + aria-hidden={mode() === "shell"} + inert={mode() === "shell" ? true : undefined} style={buttons()} >
@@ -493,13 +510,15 @@ export function ComposerEditor(props: ComposerEditorProps) {
- + - + diff --git a/packages/app/src/composer/editor/interaction.ts b/packages/app/src/composer/editor/interaction.ts index 81361757b1..fe6f63f9f1 100644 --- a/packages/app/src/composer/editor/interaction.ts +++ b/packages/app/src/composer/editor/interaction.ts @@ -1,6 +1,6 @@ import { Predicate } from "effect" -import { createEffect, createMemo, createSignal, on, onCleanup, type Accessor } from "solid-js" -import { createStore, reconcile } from "solid-js/store" +import { createEffect, createMemo, createSignal, on, onCleanup, untrack, type Accessor } from "solid-js" +import { unwrap } from "solid-js/store" import { useFilteredList } from "@opencode/ui/hooks" import { abort } from "@opencode/util/abort" import { createComposerAttachments, type ComposerAttachmentConfig } from "../attachments/attachments" @@ -17,15 +17,32 @@ import type { ComposerSuggestion, } from "../types" import { + composerPopoverActiveID, createComposerInteractionState, + isComposerPopoverOpen, + selectComposerMode, transitionComposer, type ComposerInteractionCommand, type ComposerInteractionEvent, + type ComposerInteractionState, + type ComposerSavedDraft, } from "../suggestions/machine" +import { getCursorPosition, setCursorPosition } from "./dom" import { clonePrompt, isAttachment, promptLength } from "../prompt-parts" import type { ComposerDelivery, ComposerQueue } from "../adapter" import { isCommentItem } from "../state" -import type { ComposerQuoteAnchor } from "@opencode/plugin/gui" +import { createQuoteCommentController, type QuoteCommentController } from "../quote-comment-machine" +import { + INITIAL_MENTION_SEARCH_STATE, + isMentionFileStale, + selectMentionFiles, + selectMentionSessionsPending, + transitionMentionSearch, + type MentionSearchEffect, + type MentionSearchEvent, +} from "./mention-search-machine" + +const MENTION_CONTEXT_CLOSED: MentionSearchEvent = Object.freeze({ type: "context.closed" }) export type ComposerSelectControl = { options: Accessor @@ -58,7 +75,7 @@ export type ComposerEditorView = { delivery: Accessor onSubmit: (key: string, comment: string) => Promise } - onSubmit: (options?: { alternate?: boolean }) => void + onSubmit: (options?: { alternate?: boolean; first?: boolean }) => void onStop: () => void } shell?: { @@ -67,32 +84,29 @@ export type ComposerEditorView = { } } -export function createComposerEditorState(mode: "normal" | "shell" = "normal") { - return createStore({ ...createComposerInteractionState(), mode }) -} +const DRAFT_EDITED: ComposerInteractionEvent = Object.freeze({ type: "draft.edited" }) + +const HISTORY_RESET: ComposerInteractionEvent = Object.freeze({ type: "history.reset" }) + +const NO_IDS: readonly string[] = Object.freeze([]) export function createComposerEditor(input: { store: ComposerStateStoreInput - state?: ReturnType history?: ComposerHistory commands: Accessor context: Accessor searchContextFiles: (query: string, signal?: AbortSignal) => ComposerSuggestion[] | Promise /** Reads reactively, so newly found sessions refresh the list without waiting on file search. */ searchSessions?: (query: string) => ComposerSuggestion[] - /** Whether the session search for this query has yet to settle; reads reactively. */ - sessionsPending?: (query: string) => boolean + /** Loads sessions matching `word` into what `searchSessions` reads; settles once they are in. */ + requestSessionSearch?: (word: string, signal: AbortSignal) => Promise openAttachment?: (attachment: ComposerAttachment, origin?: HTMLElement) => void /** An object URL for the image file at this path, which a path attachment references without its bytes. */ readImage?: (path: string) => Promise openContext?: (key: string) => void onContextRemove?: (item: ComposerComment) => void onQuoteComment?: (item: Extract, comment: string) => void - quoteComment?: { - key: Accessor - anchor?: Accessor - set: (key?: string) => void - } + quoteComment?: QuoteCommentController onEditor?: (element: HTMLElement) => void onSuggestionSelect?: (item: ComposerSuggestion) => (() => void) | void view: ComposerEditorView @@ -115,20 +129,50 @@ export function createComposerEditor(input: { if (cursor === undefined) return cancelFocus() - editor?.focus() - setEditorCursor(editor, cursor) + + if (!editor) return + editor.focus() + setCursorPosition(editor, cursor) } onCleanup(cancelFocus) const draft = createComposerEditorActions(input.store) - const [localQuoteComment, setLocalQuoteComment] = createSignal() - const quoteComment = input.quoteComment ?? { key: localQuoteComment, set: setLocalQuoteComment } - const [state, setState] = input.state ?? createComposerEditorState(draft.state.mode) - const [savedHistory, setSavedHistory] = createStore<{ entry?: ComposerHistoryEntry; cursor?: number }>({}) - const [cycle, setCycle] = createStore<{ index: number; entry?: ComposerHistoryEntry; cursor?: number }>({ index: -1 }) - const resetCycle = () => setCycle({ index: -1, entry: undefined, cursor: undefined }) + const quoteComment = input.quoteComment ?? createQuoteCommentController() + // A signal, not a store: the machine shares frozen states, which a store write would merge into and mutate. Memos + // keep readers of one field from rerunning when another changes. + const [readState, writeState] = createSignal(createComposerInteractionState()) + const popover = createMemo(() => readState().popover) + const drag = createMemo(() => readState().drag) + const focus = createMemo(() => readState().focus) + const activeContextID = createMemo(() => readState().activeContextID) + + const state: ComposerInteractionState = { + get popover() { + return popover() + }, + get drag() { + return drag() + }, + get focus() { + return focus() + }, + get activeContextID() { + return activeContextID() + }, + } - createEffect(on([() => draft.state, () => state.mode], resetCycle, { defer: true })) + // The draft holds the only copy of the mode, so hydration, queue edits and sends change it without the editor. + const mode = () => selectComposerMode(draft.state) + + createEffect(on(mode, (next) => dispatch({ type: "mode.synced", mode: next }), { defer: true })) + // Another draft replaces this one, so neither recalled history nor its saved draft applies to it. + createEffect( + on( + () => draft.state, + () => dispatch(HISTORY_RESET), + { defer: true }, + ), + ) function addPart(part: ComposerPersistedState["prompt"][number]) { if (isAttachment(part)) return false @@ -148,9 +192,13 @@ export function createComposerEditor(input: { ? createComposerAttachments({ ...input.attachments, capture: () => ({ + scope: unwrap(draft.state), current: () => draft.state.prompt, cursor: () => draft.state.cursor, - set: (prompt, cursor) => draft.setPrompt(prompt, cursor), + set: (prompt, cursor) => { + draft.setPrompt(prompt, cursor) + dispatch(DRAFT_EDITED) + }, }), editor: () => editor, focusEditor: () => editor?.focus(), @@ -159,9 +207,8 @@ export function createComposerEditor(input: { }) : undefined + // Recalled history stays recalled until a file is actually added, so a cancelled picker loses nothing. const attach = () => { - resetCycle() - if (!attachments) { input.view.add?.onAttach() @@ -175,47 +222,74 @@ export function createComposerEditor(input: { ) } - const [found, setFound] = createStore<{ query?: string; files: ComposerSuggestion[] }>({ files: [] }) - let fileQuery: string | undefined - let fileAbort = new AbortController() - onCleanup(() => abort(fileAbort)) + // Debounced and abortable: each keystroke or close replaces the pending searches instead of queueing behind them. + const [mentionSearch, setMentionSearch] = createSignal(INITIAL_MENTION_SEARCH_STATE) + const mentionRuns = new Map; controller?: AbortController }>() - // Debounced and abortable: each keystroke or close replaces the pending file search instead of queueing behind it. - // The last results stay listed until the next ones arrive, so the menu keeps its rows and height while typing. - const findFiles = (query?: string) => { - if (query === fileQuery) return - abort(fileAbort) - const controller = new AbortController() - fileQuery = query - fileAbort = controller + const dispatchMentionSearch = (event: MentionSearchEvent) => { + const previous = untrack(mentionSearch) + const next = transitionMentionSearch(previous, event) - if (query === undefined || !query.trim() || /\s/.test(query)) { - if (found.files.length) setFound({ query: undefined, files: [] }) + if (next.state !== previous) setMentionSearch(next.state) + next.effects.forEach(runMentionSearch) + } + + const runMentionSearch = (effect: MentionSearchEffect) => { + const attempt = effect.attempt + + if (effect.type === "file.debounce") { + mentionRuns.set(attempt, { + timer: setTimeout(() => dispatchMentionSearch({ type: "file.debounce.fired", attempt }), effect.delayMs), + }) return } - const timer = setTimeout( - () => - void Promise.resolve(input.searchContextFiles(query, controller.signal)).then( - (files) => !controller.signal.aborted && setFound({ query, files }), - () => undefined, - ), - 150, - ) + clearTimeout(mentionRuns.get(attempt)?.timer) + + if (effect.type === "file.abort" || effect.type === "session.abort") { + const controller = mentionRuns.get(attempt)?.controller + mentionRuns.delete(attempt) + + if (controller) abort(controller) + + return + } + + const controller = new AbortController() + + if (effect.type === "file.search") { + mentionRuns.set(attempt, { + controller, + timer: setTimeout(() => dispatchMentionSearch({ type: "file.timed-out", attempt }), effect.timeoutMs), + }) + void Promise.try(() => input.searchContextFiles(effect.query, controller.signal)).then( + (items) => dispatchMentionSearch({ type: "file.resolved", attempt, items }), + () => dispatchMentionSearch({ type: "file.failed", attempt }), + ) - controller.signal.addEventListener("abort", () => clearTimeout(timer), { once: true }) + return + } + + mentionRuns.set(attempt, { + controller, + timer: setTimeout(() => dispatchMentionSearch({ type: "session.timed-out", attempt }), effect.timeoutMs), + }) + // A failed search settles too: the titles already known still match locally. + const settled = () => dispatchMentionSearch({ type: "session.settled", attempt }) + void Promise.try(() => input.requestSessionSearch?.(effect.word, controller.signal)).then(settled, settled) } + createEffect(() => { + if (state.popover.type !== "context") return untrack(() => dispatchMentionSearch(MENTION_CONTEXT_CLOSED)) + const query = state.popover.query + untrack(() => dispatchMentionSearch({ type: "context.changed", query, hasSessions: !!input.requestSessionSearch })) + }) + onCleanup(() => dispatchMentionSearch({ type: "disposed" })) + const contextList = useFilteredList({ items: (query) => { - if (state.popover.type !== "context") { - findFiles(undefined) - - return [] - } - - findFiles(query) + if (state.popover.type !== "context") return [] const sessions = input.searchSessions?.(query) ?? [] @@ -227,7 +301,12 @@ export function createComposerEditor(input: { const seen = new Set(recent.map((item) => item.id)) - return [...fixed, ...sessions, ...recent, ...found.files.filter((item) => !seen.has(item.id))] + return [ + ...fixed, + ...sessions, + ...recent, + ...selectMentionFiles(mentionSearch()).filter((item) => !seen.has(item.id)), + ] }, key: (item) => item.id, filterKeys: ["label"], @@ -263,7 +342,7 @@ export function createComposerEditor(input: { const list = () => (state.popover.type === "context" ? contextList : commandList) const history = createMemo(() => - (input.history?.entries(state.mode) ?? []).map((entry, index) => ({ + (input.history?.entries(mode()) ?? []).map((entry, index) => ({ id: `history:${index}`, kind: "history", label: entry.prompt.map((part) => ("content" in part ? part.content : "")).join(""), @@ -274,7 +353,10 @@ export function createComposerEditor(input: { // Files from the previous query stay listed while the next search runs, but the keyboard can't highlight or pick them. const stale = (item: ComposerSuggestion) => - state.popover.type === "context" && item.kind === "file" && !item.recent && found.query !== state.popover.query + state.popover.type === "context" && + item.kind === "file" && + !item.recent && + isMentionFileStale(mentionSearch(), state.popover.query) const selectable = () => suggestions().flatMap((item) => (stale(item) ? [] : [item.id])) @@ -294,8 +376,24 @@ export function createComposerEditor(input: { return } + if (command.type === "history.apply") { + applyHistory(command.entry, { cursor: command.cursor }) + + return + } + if (command.type === "history.restore") { - if (savedHistory.entry) applyHistory(savedHistory.entry, { cursor: savedHistory.cursor }) + applyHistory(command.draft.entry, { cursor: command.draft.cursor, focus: command.focus }) + + return + } + + if (command.type === "draft.setMode") { + draft.setMode(command.mode) + + if (command.mode === "shell") input.view.shell?.onOpen() + + if (command.mode === "normal") input.view.shell?.onClose() return } @@ -338,73 +436,48 @@ export function createComposerEditor(input: { return } - if (command.type === "focus.editor") { - if (state.popover.type === "history") return restoreFocus() - requestAnimationFrame(() => editor?.focus()) - } + if (command.type === "focus.editor") requestAnimationFrame(() => editor?.focus()) } + // Effects dispatch too, so neither the transition nor its commands subscribe the caller. function dispatch(event: ComposerInteractionEvent) { - if (event.type === "popover.active" && !selectable().includes(event.id)) return false + return untrack(() => { + if (event.type === "popover.active" && !selectable().includes(event.id)) return false - if (event.type === "popover.close") cancelFocus() + if (event.type === "popover.close") cancelFocus() + const previous = readState() + const result = transitionComposer(previous, event, draft.state) + const action = event.type === "popover.select" ? input.onSuggestionSelect?.(event.item) : undefined - if ( - event.type === "history.open" || - event.type === "commands.open" || - event.type === "context.open" || - event.type === "popover.select" - ) - resetCycle() + if (event.type === "popover.select") { + if (!action) result.commands.forEach(execute) - if (event.type === "popover.select" && event.item.kind === "history") { - if (!event.item.history) return false - setState({ popover: { type: "closed" }, focus: "editor" }) - applyHistory(event.item.history) - setSavedHistory({ entry: undefined, cursor: undefined }) - - return true - } - - const mode = state.mode - const result = transitionComposer(state, event, draft.state) - const action = event.type === "popover.select" ? input.onSuggestionSelect?.(event.item) : undefined - - if (event.type === "popover.select") { - if (!action) result.commands.forEach(execute) - - if (action && event.item.kind === "command" && state.popover.type !== "command-menu") { - draft.setPrompt(draft.state.prompt.filter(isAttachment), 0) + if (action && event.item.kind === "command" && previous.popover.type !== "command-menu") { + draft.setPrompt(draft.state.prompt.filter(isAttachment), 0) + } } - } - setState(reconcile(result.state)) + if (result.state !== previous) writeState(result.state) - if (mode !== result.state.mode) draft.setMode(result.state.mode) + if (event.type !== "popover.select") result.commands.forEach(execute) + action?.() - if (event.type !== "popover.select") result.commands.forEach(execute) - - if (state.popover.type !== "history") setSavedHistory({ entry: undefined, cursor: undefined }) - - if (mode !== result.state.mode) { - if (result.state.mode === "shell") input.view.shell?.onOpen() - - if (result.state.mode === "normal") input.view.shell?.onClose() - } - - if (event.type === "popover.select") { - if (!action) return result.handled - action() - } - - return result.handled + return result.handled + }) } - const onKeyDown = (event: KeyboardEvent) => { + const onKeyDown = (event: KeyboardEvent, height?: number) => { + // Escape, Enter and Tab cancel, confirm or cycle IME candidates; Safari can report them as keyCode 229. + if ( + event.isComposing || + (event.keyCode === 229 && (event.key === "Escape" || event.key === "Enter" || event.key === "Tab")) + ) + return true + flushFocus() if ( - state.mode === "normal" && + mode() === "normal" && (event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey && @@ -416,19 +489,28 @@ export function createComposerEditor(input: { return true } - const handled = dispatch({ - type: "key.down", - key: event.key, - ctrl: event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey, - composing: event.isComposing, - ids: selectable(), - empty: draft.state.prompt.every((part) => !("content" in part) || part.content.length === 0), - }) + const ctrl = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey + const open = isComposerPopoverOpen(readState()) + + // Every keystroke lands here. With no list open only Escape, Backspace and Ctrl+G reach the machine, so typing + // neither lists suggestions nor builds an event. + const handled = + (open || event.key === "Escape" || event.key === "Backspace" || (ctrl && event.key.toLowerCase() === "g")) && + dispatch({ + type: "key.down", + key: event.key, + ctrl, + composing: event.isComposing, + ids: open ? selectable() : NO_IDS, + empty: + event.key === "Backspace" && + draft.state.prompt.every((part) => !("content" in part) || part.content.length === 0), + }) if (handled) event.preventDefault() - if (handled && event.key !== "Enter" && event.key !== "Tab" && state.popover.type !== "closed") { - const activeID = state.popover.activeID ?? "" + if (handled && event.key !== "Enter" && event.key !== "Tab" && isComposerPopoverOpen(readState())) { + const activeID = composerPopoverActiveID(readState()) ?? "" requestAnimationFrame(() => document.querySelector(`[data-suggestion-id="${CSS.escape(activeID)}"]`)?.scrollIntoView({ block: "nearest" }), ) @@ -438,13 +520,12 @@ export function createComposerEditor(input: { // The suggestion lists don't page, and a page key must not move the caret out of the query or page the timeline. if ( - state.popover.type !== "closed" && + isComposerPopoverOpen(readState()) && (event.key === "PageUp" || event.key === "PageDown") && !event.shiftKey && !event.altKey && !event.ctrlKey && - !event.metaKey && - !event.isComposing + !event.metaKey ) { event.preventDefault() @@ -474,10 +555,9 @@ export function createComposerEditor(input: { !event.altKey && !event.ctrlKey && !event.metaKey && - !event.isComposing && (event.key === "ArrowUp" || event.key === "ArrowDown") && (event.shiftKey - ? event.key === "ArrowUp" && openHistory() + ? event.key === "ArrowUp" && openHistory(height) : navigateHistory(event.key === "ArrowUp" ? "up" : "down")) ) { event.preventDefault() @@ -489,7 +569,7 @@ export function createComposerEditor(input: { } createEffect(() => { - if (state.popover.type === "closed") return + if (!isComposerPopoverOpen(state)) return const ids = selectable() if (state.popover.activeID ? state.popover.chosen && ids.includes(state.popover.activeID) : ids.length === 0) return @@ -500,7 +580,7 @@ export function createComposerEditor(input: { createEffect(() => { if (state.popover.type !== "context" || !/\s/.test(state.popover.query)) return - if (input.sessionsPending?.(state.popover.query)) return + if (selectMentionSessionsPending(mentionSearch(), state.popover.query, !!input.requestSessionSearch)) return if (contextList.grouped.state === "ready" && contextList.flat().length === 0) dispatch({ type: "popover.close" }) }) @@ -519,67 +599,43 @@ export function createComposerEditor(input: { if (options?.focus !== false) restoreFocus(cursor) } - const openHistory = () => { - if (state.popover.type !== "closed" || !editor || !history().length) return false + const captureDraft = (): ComposerSavedDraft => ({ + entry: { prompt: clonePrompt(draft.state.prompt), metadata: input.history?.capture?.() }, + cursor: draft.state.cursor, + }) + + const caretInEditor = (element: HTMLElement) => { const selection = window.getSelection() - if (!selection?.isCollapsed || !editor.contains(selection.anchorNode)) return false + return !!selection?.isCollapsed && element.contains(selection.anchorNode) + } + + // `height` is the composer's height before the first preview replaces the draft; the composer keeps it while open. + const openHistory = (height?: number) => { + if (isComposerPopoverOpen(readState()) || !editor || !history().length || !caretInEditor(editor)) return false if (draft.state.prompt.some((part) => "content" in part && part.content.length > 0)) return false - setSavedHistory({ - entry: { prompt: clonePrompt(draft.state.prompt), metadata: input.history?.capture?.() }, - cursor: draft.state.cursor, - }) - dispatch({ type: "history.open", id: history()[0]!.id }) - return true + return dispatch({ type: "history.open", id: history()[0]!.id, saved: captureDraft(), height }) } const navigateHistory = (direction: "up" | "down") => { - if (state.popover.type !== "closed" || !input.history || !editor) return false - const selection = window.getSelection() - - if (!selection?.isCollapsed || !editor.contains(selection.anchorNode)) return false + if (isComposerPopoverOpen(readState()) || !input.history || !editor || !caretInEditor(editor)) return false const text = draft.state.prompt.map((part) => ("content" in part ? part.content : "")).join("") - if (!canNavigateHistory(direction, text, editorCursor(editor), cycle.index >= 0)) return false - const entries = input.history.entries(state.mode) - - if (direction === "up") { - if (entries.length === 0 || cycle.index >= entries.length - 1) return false - - if (cycle.index === -1) { - setCycle({ - entry: { prompt: clonePrompt(draft.state.prompt), metadata: input.history.capture?.() }, - cursor: draft.state.cursor, - }) - } - - const index = cycle.index + 1 - setCycle("index", index) - applyHistory(entries[index]!, { cursor: 0 }) - - return true - } - - if (cycle.index < 0 || !cycle.entry) return false - - if (cycle.index > 0) { - const index = cycle.index - 1 - setCycle("index", index) - applyHistory(entries[index]!) - - return true - } - - applyHistory(cycle.entry, { cursor: cycle.cursor }) - resetCycle() - - return true + return dispatch({ + type: "history.step", + direction, + text, + cursor: getCursorPosition(editor) ?? text.length, + entries: input.history.entries(mode()), + capture: captureDraft, + }) } return { state, + mode, view: input.view, suggestions, dispatch, @@ -612,9 +668,7 @@ export function createComposerEditor(input: { dispatch({ type: "context.active", id }) input.openContext?.(id) }, - editingQuote: () => quoteComment.key(), - quoteAnchor: () => input.quoteComment?.anchor?.(), - editQuote: (key?: string) => quoteComment.set(key), + quoteComment, focusQuotePrompt: () => restoreFocus(), commentQuote(id: string, comment: string) { const item = draft.state.context.items.find((entry) => entry.key === id) @@ -625,11 +679,12 @@ export function createComposerEditor(input: { return (await input.searchContextFiles(query)).flatMap((item) => (item.path ? [item.path] : [])) }, removeContext(id: string) { - resetCycle() const item = draft.state.context.items.find((entry) => entry.key === id) if (item) input.onContextRemove?.(item) draft.removeContext(id) + quoteComment.retain(draft.state.context.items.map((entry) => entry.key)) + dispatch(DRAFT_EDITED) if (state.activeContextID === id) dispatch({ type: "context.active", id }) }, @@ -645,8 +700,8 @@ export function createComposerEditor(input: { return input.readImage?.(attachment.path) ?? Promise.resolve(undefined) }, removeAttachment(id: string) { - resetCycle() draft.removeAttachment(id) + dispatch(DRAFT_EDITED) }, canSubmit() { if (input.view.submit.available?.() === false) return false @@ -658,7 +713,7 @@ export function createComposerEditor(input: { if (attachments?.pending().length) return false const persisted = draft.state - if (state.mode === "shell") { + if (selectComposerMode(persisted) === "shell") { return persisted.prompt.some((part) => "content" in part && !!part.content.trim()) } @@ -675,7 +730,6 @@ export function createComposerEditor(input: { restoreFocus, onInput(value: string, prompt?: ComposerPersistedState["prompt"], cursor?: number) { cancelFocus() - resetCycle() if (prompt) draft.setPrompt(prompt, cursor) @@ -694,13 +748,12 @@ export function createComposerEditor(input: { openShell() { dispatch({ type: "mode.shell" }) }, - submit(options?: { alternate?: boolean }) { + submit(options?: { alternate?: boolean; first?: boolean }) { if (input.view.submit.available?.() === false) return if (input.view.draftOnly) return if (attachments?.pending().length) return - resetCycle() input.view.submit.onSubmit(options) dispatch({ type: "popover.close" }) }, @@ -708,20 +761,16 @@ export function createComposerEditor(input: { input.view.submit.onStop() }, addHistory(prompt: ComposerPersistedState["prompt"], mode: "normal" | "shell") { - resetCycle() input.history?.add(prompt, mode) }, resetHistory() { - resetCycle() - - if (state.popover.type === "history") dispatch({ type: "popover.close" }) + dispatch(HISTORY_RESET) }, onPaste(event: ClipboardEvent) { const clipboard = event.clipboardData const text = clipboard?.getData("text/plain") if (attachments && shouldHandlePasteAsAttachment(clipboard, !!input.attachments?.readClipboardImage)) { - resetCycle() void attachments.handlePaste(event) return @@ -785,7 +834,6 @@ export function createComposerEditor(input: { }, addAttachments(files: File[]) { if (!attachments) return - resetCycle() void attachments.addAttachments(files) restoreFocus() }, @@ -804,49 +852,3 @@ export function shouldHandlePasteAsAttachment(clipboard: DataTransfer | null, re return readClipboardImage } - -function canNavigateHistory(direction: "up" | "down", text: string, cursor: number, inHistory: boolean) { - const position = Math.max(0, Math.min(cursor, text.length)) - - if (inHistory) return position === 0 || position === text.length - - if (direction === "up") return position === 0 && text.length === 0 - - return position === text.length -} - -function editorCursor(editor: HTMLElement) { - const selection = window.getSelection() - - if (!selection?.rangeCount || !editor.contains(selection.anchorNode)) return editor.textContent?.length ?? 0 - const range = selection.getRangeAt(0).cloneRange() - range.selectNodeContents(editor) - range.setEnd(selection.anchorNode!, selection.anchorOffset) - - return range.toString().length -} - -function setEditorCursor(editor: HTMLElement | undefined, cursor: number) { - if (!editor) return - const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT) - let remaining = cursor - let node = walker.nextNode() - - while (node) { - const length = node.textContent?.length ?? 0 - - if (remaining <= length) { - const range = document.createRange() - range.setStart(node, remaining) - range.collapse(true) - const selection = window.getSelection() - selection?.removeAllRanges() - selection?.addRange(range) - - return - } - - remaining -= length - node = walker.nextNode() - } -} diff --git a/packages/app/src/composer/editor/mention-search-machine.test.ts b/packages/app/src/composer/editor/mention-search-machine.test.ts new file mode 100644 index 0000000000..d8a39be8c6 --- /dev/null +++ b/packages/app/src/composer/editor/mention-search-machine.test.ts @@ -0,0 +1,111 @@ +import { describe, expect, test } from "bun:test" +import type { ComposerSuggestion } from "../types" +import { + INITIAL_MENTION_SEARCH_STATE, + MENTION_FILE_DEBOUNCE_MS, + MENTION_SEARCH_TIMEOUT_MS, + isMentionFileStale, + selectMentionFiles, + selectMentionSessionsPending, + transitionMentionSearch, + type MentionSearchEvent, + type MentionSearchState, + type MentionSearchTransition, +} from "./mention-search-machine" + +const plan: ComposerSuggestion = { id: "file:re/plan.md", kind: "file", label: "re/plan.md", path: "re/plan.md" } + +function replay(events: MentionSearchEvent[], state: MentionSearchState = INITIAL_MENTION_SEARCH_STATE) { + const initial: MentionSearchTransition = { state, effects: [] } + + return events.reduce((result, event) => transitionMentionSearch(result.state, event), initial) +} + +function changed(query: string, hasSessions = true): MentionSearchEvent { + return { type: "context.changed", query, hasSessions } +} + +describe("transitionMentionSearch", () => { + test("reopening @ on a word searched before waits for a fresh session search", () => { + const reopened = replay([ + changed("auth"), + { type: "session.settled", attempt: 2 }, + { type: "context.closed" }, + changed("auth "), + ]) + + expect(reopened.effects).toEqual([ + { type: "session.search", attempt: 3, word: "auth", timeoutMs: MENTION_SEARCH_TIMEOUT_MS }, + ]) + expect(selectMentionSessionsPending(reopened.state, "auth ", true)).toBe(true) + expect( + selectMentionSessionsPending( + transitionMentionSearch(reopened.state, { type: "session.settled", attempt: 3 }).state, + "auth ", + true, + ), + ).toBe(false) + }) + + test("closing @ aborts its pending file and session searches", () => { + const loading = replay([changed("re"), { type: "file.debounce.fired", attempt: 1 }]) + + expect(loading.effects).toEqual([ + { type: "file.search", attempt: 1, query: "re", timeoutMs: MENTION_SEARCH_TIMEOUT_MS }, + ]) + expect(transitionMentionSearch(loading.state, { type: "context.closed" })).toEqual({ + state: { status: "closed", issued: 2 }, + effects: [ + { type: "file.abort", attempt: 1 }, + { type: "session.abort", attempt: 2 }, + ], + }) + }) + + test("a failed or timed-out file search clears the previous query's rows", () => { + const typed = replay([ + changed("re", false), + { type: "file.debounce.fired", attempt: 1 }, + { type: "file.resolved", attempt: 1, items: [plan] }, + changed("rez", false), + ]) + + expect(typed.effects).toEqual([{ type: "file.debounce", attempt: 2, delayMs: MENTION_FILE_DEBOUNCE_MS }]) + expect(selectMentionFiles(typed.state)).toEqual([plan]) + expect(isMentionFileStale(typed.state, "rez")).toBe(true) + + for (const type of ["file.failed", "file.timed-out"] as const) { + const settled = replay( + [ + { type: "file.debounce.fired", attempt: 2 }, + { type, attempt: 2 }, + ], + typed.state, + ) + + expect(selectMentionFiles(settled.state)).toEqual([]) + expect(isMentionFileStale(settled.state, "rez")).toBe(false) + expect(settled.effects).toEqual([{ type: "file.abort", attempt: 2 }]) + } + }) + + test("refining a title keeps the in-flight session search and drops file search", () => { + const first = replay([changed("auth")]) + const refined = transitionMentionSearch(first.state, changed("auth token")) + + expect(refined.effects).toEqual([{ type: "file.abort", attempt: 1 }]) + expect(refined.state).toMatchObject({ files: { status: "idle" }, sessions: { status: "loading", attempt: 2 } }) + expect(transitionMentionSearch(refined.state, changed("auth token")).state).toBe(refined.state) + }) + + test("ignores stale results and everything after dispose", () => { + const first = replay([changed("re", false), changed("res", false)]) + + expect(transitionMentionSearch(first.state, { type: "file.debounce.fired", attempt: 1 }).state).toBe(first.state) + + const disposed = transitionMentionSearch(first.state, { type: "disposed" }) + + expect(disposed).toEqual({ state: { status: "disposed" }, effects: [{ type: "file.abort", attempt: 2 }] }) + expect(transitionMentionSearch(disposed.state, changed("re")).state).toBe(disposed.state) + }) +}) diff --git a/packages/app/src/composer/editor/mention-search-machine.ts b/packages/app/src/composer/editor/mention-search-machine.ts new file mode 100644 index 0000000000..2a6177af4b --- /dev/null +++ b/packages/app/src/composer/editor/mention-search-machine.ts @@ -0,0 +1,226 @@ +import type { ComposerSuggestion } from "../types" + +export const MENTION_FILE_DEBOUNCE_MS = 150 + +// A search that never answers settles as empty, so the menu cannot wait on it forever. +export const MENTION_SEARCH_TIMEOUT_MS = 10_000 + +/** + * The file search behind an open `@` menu. While the next query is `debouncing` or `loading`, the previous query's + * rows stay listed (`settledQuery`, `items`) so the menu keeps its height, but they cannot be picked. + */ +export type MentionFileSearchState = + | { readonly status: "idle" } + | { + readonly status: "debouncing" | "loading" + readonly attempt: number + readonly settledQuery: string | undefined + readonly items: readonly ComposerSuggestion[] + } + /** A failed or timed-out search settles with no rows. */ + | { readonly status: "settled"; readonly settledQuery: string; readonly items: readonly ComposerSuggestion[] } + +/** The server-side session search for the query's first word; titles then match the whole query locally. */ +export type MentionSessionSearchState = + | { readonly status: "disabled" } + | { readonly status: "loading"; readonly attempt: number; readonly word: string } + | { readonly status: "settled"; readonly word: string } + +/** + * The searches an `@` menu runs while it is open. + * - `closed`: no menu; closing aborts every search, so reopening on the same word searches again. + * - `active`: the menu shows `query`. + * - `disposed`: the composer unmounted; late results and timers are ignored. + */ +export type MentionSearchState = + | { readonly status: "closed"; readonly issued: number } + | { + readonly status: "active" + readonly issued: number + readonly query: string + readonly files: MentionFileSearchState + readonly sessions: MentionSessionSearchState + } + | { readonly status: "disposed" } + +export type MentionSearchEvent = + | { readonly type: "context.changed"; readonly query: string; readonly hasSessions: boolean } + | { readonly type: "context.closed" } + | { readonly type: "file.debounce.fired"; readonly attempt: number } + | { readonly type: "file.resolved"; readonly attempt: number; readonly items: readonly ComposerSuggestion[] } + | { readonly type: "file.failed"; readonly attempt: number } + | { readonly type: "file.timed-out"; readonly attempt: number } + | { readonly type: "session.settled"; readonly attempt: number } + | { readonly type: "session.timed-out"; readonly attempt: number } + | { readonly type: "disposed" } + +/** `file.abort` and `session.abort` also release a settled attempt's timer; aborting a settled request does nothing. */ +export type MentionSearchEffect = + | { readonly type: "file.debounce"; readonly attempt: number; readonly delayMs: number } + | { readonly type: "file.search"; readonly attempt: number; readonly query: string; readonly timeoutMs: number } + | { readonly type: "file.abort"; readonly attempt: number } + | { readonly type: "session.search"; readonly attempt: number; readonly word: string; readonly timeoutMs: number } + | { readonly type: "session.abort"; readonly attempt: number } + +export type MentionSearchTransition = { + readonly state: MentionSearchState + readonly effects: readonly MentionSearchEffect[] +} + +export const INITIAL_MENTION_SEARCH_STATE: MentionSearchState = Object.freeze({ status: "closed", issued: 0 }) + +const DISPOSED: MentionSearchState = Object.freeze({ status: "disposed" }) + +const IDLE_FILES: MentionFileSearchState = Object.freeze({ status: "idle" }) + +const DISABLED_SESSIONS: MentionSessionSearchState = Object.freeze({ status: "disabled" }) + +const NO_EFFECTS: readonly MentionSearchEffect[] = Object.freeze([]) + +const NO_SUGGESTIONS: readonly ComposerSuggestion[] = Object.freeze([]) + +export function transitionMentionSearch(state: MentionSearchState, event: MentionSearchEvent): MentionSearchTransition { + if (state.status === "disposed") return stay(state) + + if (event.type === "disposed") + return { state: DISPOSED, effects: state.status === "active" ? abortSearches(state) : NO_EFFECTS } + + if (event.type === "context.changed") return change(state, event.query, event.hasSessions) + + if (state.status === "closed") return stay(state) + + if (event.type === "context.closed") + return { state: { status: "closed", issued: state.issued }, effects: abortSearches(state) } + + if (event.type === "session.settled" || event.type === "session.timed-out") { + if (state.sessions.status !== "loading" || state.sessions.attempt !== event.attempt) return stay(state) + + return { + state: { ...state, sessions: { status: "settled", word: state.sessions.word } }, + effects: [{ type: "session.abort", attempt: event.attempt }], + } + } + + const files = state.files + + if (event.type === "file.debounce.fired") { + if (files.status !== "debouncing" || files.attempt !== event.attempt) return stay(state) + + return { + state: { ...state, files: { ...files, status: "loading" } }, + effects: [ + { type: "file.search", attempt: event.attempt, query: state.query, timeoutMs: MENTION_SEARCH_TIMEOUT_MS }, + ], + } + } + + if (files.status !== "loading" || files.attempt !== event.attempt) return stay(state) + + return { + state: { + ...state, + files: { + status: "settled", + settledQuery: state.query, + items: event.type === "file.resolved" ? event.items : NO_SUGGESTIONS, + }, + }, + effects: [{ type: "file.abort", attempt: event.attempt }], + } +} + +/** The file rows to list: the current query's, or the previous query's while the next search runs. */ +export function selectMentionFiles(state: MentionSearchState) { + return state.status === "active" && state.files.status !== "idle" ? state.files.items : NO_SUGGESTIONS +} + +/** Whether listed file rows belong to an earlier query, so the keyboard cannot highlight or pick them. */ +export function isMentionFileStale(state: MentionSearchState, query: string) { + return state.status !== "active" || state.files.status === "idle" || state.files.settledQuery !== query +} + +/** Whether the session search for this query has yet to settle, so the menu must not close as empty yet. */ +export function selectMentionSessionsPending(state: MentionSearchState, query: string, hasSessions: boolean) { + if (!hasSessions || state.status === "disposed") return false + + if (state.status === "closed") return true + + if (state.sessions.status === "disabled") return false + + if (state.sessions.word !== mentionSearchWord(query)) return true + + return state.sessions.status === "loading" +} + +/** The server narrows sessions by the first word. */ +export function mentionSearchWord(query: string) { + return query.toLowerCase().split(" ")[0] ?? "" +} + +function change( + state: Exclude, + query: string, + hasSessions: boolean, +): MentionSearchTransition { + const active = state.status === "active" ? state : undefined + + if (active?.query === query && (active.sessions.status !== "disabled") === hasSessions) return stay(state) + const effects: MentionSearchEffect[] = [] + const issued = { value: state.issued } + const files = active?.query === query ? active.files : nextFiles(active?.files ?? IDLE_FILES, query, issued, effects) + const previous = active?.sessions ?? DISABLED_SESSIONS + const word = mentionSearchWord(query) + + const keep = hasSessions && previous.status !== "disabled" && previous.word === word + + if (!keep && previous.status === "loading") effects.push({ type: "session.abort", attempt: previous.attempt }) + + const sessions = keep ? previous : hasSessions ? startSessions(word, issued, effects) : DISABLED_SESSIONS + + return { state: { status: "active", issued: issued.value, query, files, sessions }, effects } +} + +function nextFiles( + previous: MentionFileSearchState, + query: string, + issued: { value: number }, + effects: MentionSearchEffect[], +): MentionFileSearchState { + if (previous.status === "debouncing" || previous.status === "loading") + effects.push({ type: "file.abort", attempt: previous.attempt }) + + // Only paths are searched: an empty query lists recent files, and a space means prose or a session title. + if (!query.trim() || /\s/.test(query)) return IDLE_FILES + const attempt = ++issued.value + effects.push({ type: "file.debounce", attempt, delayMs: MENTION_FILE_DEBOUNCE_MS }) + + return previous.status === "idle" + ? { status: "debouncing", attempt, settledQuery: undefined, items: NO_SUGGESTIONS } + : { status: "debouncing", attempt, settledQuery: previous.settledQuery, items: previous.items } +} + +function startSessions( + word: string, + issued: { value: number }, + effects: MentionSearchEffect[], +): MentionSessionSearchState { + const attempt = ++issued.value + effects.push({ type: "session.search", attempt, word, timeoutMs: MENTION_SEARCH_TIMEOUT_MS }) + + return { status: "loading", attempt, word } +} + +function abortSearches(state: Extract) { + const files: readonly MentionSearchEffect[] = + state.files.status === "debouncing" || state.files.status === "loading" + ? [{ type: "file.abort", attempt: state.files.attempt }] + : NO_EFFECTS + + return state.sessions.status === "loading" + ? [...files, { type: "session.abort" as const, attempt: state.sessions.attempt }] + : files +} + +function stay(state: MentionSearchState): MentionSearchTransition { + return { state, effects: NO_EFFECTS } +} diff --git a/packages/app/src/composer/editor/quote-comment.tsx b/packages/app/src/composer/editor/quote-comment.tsx index 0068fd54f1..fc806a6163 100644 --- a/packages/app/src/composer/editor/quote-comment.tsx +++ b/packages/app/src/composer/editor/quote-comment.tsx @@ -8,6 +8,7 @@ import { MenuScroll } from "@opencode/ui/menu-scroll" import { useLanguage } from "@/runtime/i18n/language" import type { ComposerQuoteAnchor } from "@opencode/plugin/gui" import type { ComposerDelivery } from "../adapter" +import type { QuoteCommentView } from "../quote-comment-machine" const IS_MAC = /(Mac|iPod|iPhone|iPad)/.test(navigator.platform) @@ -25,28 +26,28 @@ export function QuoteCommentEditor(props: { anchor: HTMLElement source?: ComposerQuoteAnchor text: string + /** The saved comment. */ comment: string + view: QuoteCommentView mention: (query: string) => Promise + onInput: (draft: string) => void onSubmit: (comment: string) => void onClose: (focus?: boolean) => void send?: { available: boolean delivery: ComposerDelivery | undefined - onSubmit: (comment: string) => Promise + onSubmit: (comment: string) => void } }) { const language = useLanguage() const [state, setState] = createStore({ - draft: props.comment, rect: bounds(props.anchor), viewport: window.innerWidth, viewportHeight: window.innerHeight, revision: 0, height: 0, openingHeight: 0, - sending: false, - failed: false, }) const width = () => Math.min(WIDTH, state.viewport - GAP * 2) @@ -64,8 +65,6 @@ export function QuoteCommentEditor(props: { let frame: number | undefined - let mounted = true - const schedule = () => { if (frame !== undefined) return frame = requestAnimationFrame(() => { @@ -80,8 +79,6 @@ export function QuoteCommentEditor(props: { } onCleanup(() => { - mounted = false - if (frame !== undefined) cancelAnimationFrame(frame) }) @@ -93,7 +90,7 @@ export function QuoteCommentEditor(props: { if (target instanceof Node && (element?.contains(target) || props.anchor.contains(target))) return - if (!state.sending && state.draft.trim() === props.comment.trim()) props.onClose() + if (props.view.canDismissOutside) props.onClose() }) const left = () => Math.min(Math.max(source()?.left ?? state.rect.left, GAP), state.viewport - width() - GAP) @@ -118,16 +115,7 @@ export function QuoteCommentEditor(props: { label: language.t(sendLabels[send.delivery ?? "send"]), keys: [IS_MAC ? "⌘" : language.t("common.key.ctrl"), "⏎"], disabled: !send.available, - onSubmit: async (comment: string) => { - setState({ sending: true, failed: false }) - - const sent = await send.onSubmit(comment) - - if (!mounted) return - setState({ sending: false, failed: !sent }) - - if (sent) props.onClose() - }, + onSubmit: send.onSubmit, } }) @@ -163,17 +151,17 @@ export function QuoteCommentEditor(props: { setState("draft", value)} + value={props.view.draft} + onInput={props.onInput} onCancel={() => props.onClose(true)} onSubmit={props.onSubmit} - submitting={state.sending} + submitting={props.view.sending} alternateSubmit={alternateSubmit()} placeholder={language.t("session.quote.optionalCommentPlaceholder")} submitLabel={language.t( props.comment.trim() ? "common.save" - : state.draft.trim() + : props.view.draft.trim() ? "session.quote.addComment" : "session.quote.done", )} @@ -181,7 +169,7 @@ export function QuoteCommentEditor(props: { mention={{ items: props.mention }} selection={{props.text}} /> - + @@ -440,10 +505,14 @@ export function createHomeSessionsController(home: HomeController) { /> - - @@ -508,7 +577,8 @@ export function createHomeSessionsController(home: HomeController) { const tab = tabs.addSessionTab({ server: connKey, sessionId: session.id }) if (!options?.background) tabs.select(tab) - ctx.data.session.remember(session) + // Keep the canonical record's server times: the list row may carry a local send bump. + ctx.data.session.remember(ctx.data.session.get(session.id) ?? session) if (!options?.background) ctx.projects.touch(directory) }) @@ -532,7 +602,10 @@ export function createHomeSessionsController(home: HomeController) { }) }, rename, - export: exportSession, + export: (server: ServerConnection.Key, session: SessionInfo) => + exporter.export({ server, sessionID: session.id }), + exporting: (server: ServerConnection.Key, session: SessionInfo) => + exporter.exporting({ server, sessionID: session.id }), showDelete: (server: ServerConnection.Key, session: SessionInfo) => dialog.show(() => ), }, diff --git a/packages/app/src/home/sessions/index.test.ts b/packages/app/src/home/sessions/index.test.ts index 87eacbd623..cd6efc5385 100644 --- a/packages/app/src/home/sessions/index.test.ts +++ b/packages/app/src/home/sessions/index.test.ts @@ -1,10 +1,11 @@ import { describe, expect, test } from "bun:test" import type { SessionInfo } from "@opencode/client/promise" import { SESSION_RECENT_LIMIT, SESSION_RECENT_WINDOW } from "@/runtime/server/global-sync/types" +import { mergeRootSessionIndex } from "@/runtime/server/session-index" import { HOME_SESSION_INDEX_LIMIT, HOME_SESSION_LIMIT, - HOME_V2_SESSION_PAGE_LIMIT, + HOME_SESSION_PAGE_LIMIT, loadHomeSessionIndex, mergeHomeSessionIndex, parseHomeSessionIndex, @@ -12,6 +13,7 @@ import { } from "./index" const session = (id: string, input: Partial = {}) => + // SAFETY: fixtures spell every other field of the info they model, and each test only reads those fields. ({ id, projectID: "project", @@ -39,39 +41,33 @@ const history = (directory: string, count: number) => const ids = (sessions: SessionInfo[]) => sessions.map((item) => item.id) describe("Home session index", () => { - test("follows cursors across pages and bounds the result per directory", async () => { - const all = history("/repo", HOME_V2_SESSION_PAGE_LIMIT + 1) - const calls: Array<{ cursor?: string; parentID: null }> = [] + test("loads one bounded page of the newest sessions", async () => { + const all = history("/repo", HOME_SESSION_PAGE_LIMIT + 1) + const calls: Array<{ limit: number; order: "desc"; cursor?: string; parentID: null }> = [] const result = await loadHomeSessionIndex(async (input) => { calls.push(input) - if (!input.cursor) return { data: all.slice(0, HOME_V2_SESSION_PAGE_LIMIT), cursor: { next: "next" } } - - return { data: all.slice(HOME_V2_SESSION_PAGE_LIMIT), cursor: {} } + return { data: all.slice(0, input.limit), cursor: { next: "next" } } }) - expect(calls.map((call) => call.cursor)).toEqual([undefined, "next"]) - expect(calls.every((call) => call.parentID === null)).toBe(true) + expect(calls).toEqual([{ limit: HOME_SESSION_PAGE_LIMIT, order: "desc", parentID: null }]) // Newest rows in server order, plus the recent window beyond the limit. expect(ids(result)).toEqual(ids(all.slice(0, HOME_SESSION_INDEX_LIMIT + SESSION_RECENT_LIMIT))) }) - test("folds pages so every directory keeps its newest sessions", async () => { - const busy = history("/busy", HOME_V2_SESSION_PAGE_LIMIT + 300) + test("keeps each directory's newest sessions within the page", async () => { + const busy = history("/busy", 300) const quiet = history("/quiet", 3).map((item) => ({ ...item, time: { created: item.time.created - 6000 * minute, updated: item.time.updated - 6000 * minute }, })) - // Server order is global by updated time: /quiet is older than all of /busy - // and only arrives on the second page. - const result = await loadHomeSessionIndex(async (input) => { - if (!input.cursor) return { data: busy.slice(0, HOME_V2_SESSION_PAGE_LIMIT), cursor: { next: "next" } } - - return { data: [...busy.slice(HOME_V2_SESSION_PAGE_LIMIT), ...quiet], cursor: {} } - }) + const result = await loadHomeSessionIndex(async (input) => ({ + data: [...busy.slice(0, input.limit - quiet.length), ...quiet], + cursor: { next: "next" }, + })) expect(ids(result.filter((item) => item.location.directory === "/quiet"))).toEqual(ids(quiet)) expect(ids(result.filter((item) => item.location.directory === "/busy"))).toEqual( @@ -101,6 +97,18 @@ describe("Home session index", () => { ]).map((item) => item.id), ).toEqual(["root"]) }) + + test.each([ + { surface: "Home", merge: mergeHomeSessionIndex }, + { surface: "Inbox", merge: mergeRootSessionIndex }, + ])("$surface shows live metadata and advances an indexed row when idle advances", ({ merge }) => { + const index = session("root", { time: { created: 1, idle: 5, updated: 10 } }) + const live = { ...index, title: "Loaded", time: { ...index.time, updated: 30 } } + const created = session("new") + expect(merge([index], [live, created])).toEqual([{ ...live, time: index.time }, created]) + const ended = { ...live, time: { ...live.time, idle: 25 } } + expect(merge([index], [ended])).toEqual([ended]) + }) }) // Home merges locally known sessions and pending removals into the fetched @@ -130,7 +138,7 @@ describe("Home session index parity with the complete index", () => { const known = [ session("a-fresh", { time: { created: now, updated: now }, location: { directory: "/a" } }), // A fetched session that fell outside retention but was updated locally. - { ...complete[300], time: { created: now - 1, updated: now } }, + { ...complete[300], time: { created: now - 1, updated: now, idle: now } }, session("d-new", { time: { created: now, updated: now }, location: { directory: "/d" } }), ] diff --git a/packages/app/src/home/sessions/index.ts b/packages/app/src/home/sessions/index.ts index dd751ad7c8..aba78455d9 100644 --- a/packages/app/src/home/sessions/index.ts +++ b/packages/app/src/home/sessions/index.ts @@ -1,8 +1,11 @@ import type { SessionInfo, SessionsResponse } from "@opencode/client/promise" import { pathKey } from "@/workspaces/path-key" +import { mergeRootSessionIndex } from "@/runtime/server/session-index" import { SESSION_RECENT_LIMIT, SESSION_RECENT_WINDOW } from "@/runtime/server/global-sync/types" -export const HOME_V2_SESSION_PAGE_LIMIT = 5_000 +// One bounded page of the newest root sessions. Home shows 64 and the sidebar a handful per project, so older history +// is reached through the titlebar's server-backed search instead of downloading every session on startup. +export const HOME_SESSION_PAGE_LIMIT = 500 export const HOME_SESSION_LIMIT = 64 @@ -25,40 +28,18 @@ export async function loadHomeSessionIndex( ) => Promise, signal?: AbortSignal, ) { - const now = Date.now() - let retained: SessionInfo[] = [] - let cursor: string | undefined + const response = await list({ limit: HOME_SESSION_PAGE_LIMIT, order: "desc", parentID: null }, { signal }) - for (;;) { - const response = await list( - { - limit: HOME_V2_SESSION_PAGE_LIMIT, - order: "desc", - parentID: null, - ...(cursor ? { cursor } : {}), - }, - { signal }, - ) - - // Fold each page in as it arrives: pages are newest first, so later pages - // can only fill directories that still have room. Peak allocation is one - // page plus the retained subset, not the whole history. - retained = retainHomeSessions([...retained, ...parseHomeSessionIndex(response.data)], HOME_SESSION_INDEX_LIMIT, now) - - if (response.data.length < HOME_V2_SESSION_PAGE_LIMIT || !response.cursor.next) return retained - cursor = response.cursor.next - } + return retainHomeSessions(parseHomeSessionIndex(response.data), HOME_SESSION_INDEX_LIMIT, Date.now()) } // Keep this filter for locally known sessions merged into the fetched index. export function parseHomeSessionIndex(sessions: SessionInfo[]) { - return sessions.filter((session) => !session.parentID && typeof session.time.archived !== "number") + return sessions.filter((session) => !session.parentID && session.time.archived === undefined) } -export function mergeHomeSessionIndex(fetched: SessionInfo[], known: SessionInfo[]) { - return parseHomeSessionIndex([ - ...new Map([...fetched, ...known].map((session) => [session.id, session] as const)).values(), - ]) +export function mergeHomeSessionIndex(fetched: readonly SessionInfo[], known: readonly SessionInfo[]) { + return mergeRootSessionIndex(fetched, known).filter((session) => session.time.archived === undefined) } export function retainHomeSessions(sessions: SessionInfo[], limit: number, now: number) { diff --git a/packages/app/src/home/sessions/region.tsx b/packages/app/src/home/sessions/region.tsx index 2b05f47d66..be3b7b7cb4 100644 --- a/packages/app/src/home/sessions/region.tsx +++ b/packages/app/src/home/sessions/region.tsx @@ -37,6 +37,7 @@ export function HomeSessions(props: { onArchiveSession={props.sessions.session.archive} onRenameSession={props.sessions.session.rename} onExportSession={props.sessions.session.export} + isExportingSession={props.sessions.session.exporting} onDeleteSession={props.sessions.session.showDelete} onSetHoverTarget={props.scroll.viewport.setHoverTarget} onSetThumbTrack={props.scroll.viewport.setThumbTrack} diff --git a/packages/app/src/home/sessions/view.tsx b/packages/app/src/home/sessions/view.tsx index a46d680881..af4e51f2d2 100644 --- a/packages/app/src/home/sessions/view.tsx +++ b/packages/app/src/home/sessions/view.tsx @@ -16,6 +16,7 @@ import { ServerConnection } from "@/runtime/server/registry" import { SessionTabAvatarView } from "@/shell/layout/session-tab-avatar" import { showToast } from "@/shell/notifications/toast" import { sessionLabel } from "@/session/title" +import { SessionReadMenuItem } from "@/session/session-read-menu-item" import { shouldOpenSessionInBackground } from "./open" import { createAltHold } from "./alt-hold" import "./view.css" @@ -96,7 +97,8 @@ export type HomeSessionsViewProps = { title: string, signal: AbortSignal, ) => Promise - onExportSession: (server: ServerConnection.Key, session: SessionInfo) => Promise + onExportSession: (server: ServerConnection.Key, session: SessionInfo) => void + isExportingSession: (server: ServerConnection.Key, session: SessionInfo) => boolean onDeleteSession: (server: ServerConnection.Key, session: SessionInfo) => void onSetHoverTarget: (element: HTMLElement) => void onSetThumbTrack: (element: HTMLDivElement) => void @@ -577,7 +579,7 @@ function HomeSessionSearchResultRow( role="option" aria-selected={props.selected} class={` - flex h-10 w-full shrink-0 cursor-default items-center border-0 py-3 pl-[18px] pr-6 text-left + flex h-10 w-full shrink-0 cursor-default items-center border-0 py-3 pl-[18px] pr-6 text-left text-v2-text-text-muted transition-[background-color] duration-[120ms] ease-in-out hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none `} @@ -606,7 +608,7 @@ function HomeSessionSearchResultRow(
- + props.onRowEvent({ type: "editor.input", sessionID: sessionID(), draft: event.currentTarget.value }) } @@ -814,7 +816,7 @@ function HomeSessionRow( > - + {props.language.t("common.rename")} - void props.onExportSession(props.server, props.record.session)}> + props.onExportSession(props.server, props.record.session)} + > {props.language.t("common.export")}… + props.onDeleteSession(props.server, props.record.session)}> {props.language.t("common.delete")}… @@ -948,15 +954,13 @@ function HomeSessionLocation(props: { ) } -function HomeSessionProjectName(props: { name: string; search?: boolean; trailing?: boolean }) { +function HomeSessionProjectName(props: { name: string; search?: boolean }) { return ( diff --git a/packages/app/src/new-session/brick-breaker-machine.test.ts b/packages/app/src/new-session/brick-breaker-machine.test.ts new file mode 100644 index 0000000000..82582b3ebe --- /dev/null +++ b/packages/app/src/new-session/brick-breaker-machine.test.ts @@ -0,0 +1,120 @@ +import { describe, expect, test } from "bun:test" +import { + BRICK_BREAKER_TIMING, + acceptsBrickBreakerInput, + brickBreakerSpares, + createBrickBreakerState, + transitionBrickBreaker, + type BrickBreakerEvent, + type BrickBreakerState, +} from "./brick-breaker-machine" + +const frame = (now: number): BrickBreakerEvent => ({ type: "frame", now }) + +const launch: BrickBreakerEvent = { type: "launch" } + +const run = (events: BrickBreakerEvent[], state: BrickBreakerState = createBrickBreakerState(0)) => + events.reduce(transitionBrickBreaker, state) + +// Serving at 1, so a rally runs from there. +const playing = () => run([frame(0.4), frame(1), launch]) + +describe("brick breaker", () => { + test("the composer shrinks into the paddle, the ball lands on it, and a serve starts play", () => { + const entering = createBrickBreakerState(0) + const landed = transitionBrickBreaker(entering, frame(BRICK_BREAKER_TIMING.enterLand)) + const serving = transitionBrickBreaker(landed, frame(BRICK_BREAKER_TIMING.enter)) + + expect(transitionBrickBreaker(entering, frame(0.2))).toBe(entering) + expect(landed).toEqual({ status: "enter", startedAt: 0, landed: true }) + expect(serving).toEqual({ status: "serve", startedAt: BRICK_BREAKER_TIMING.enter, landed: true, lives: 3 }) + expect(transitionBrickBreaker(serving, launch)).toEqual({ status: "play", lives: 3 }) + }) + + // Before, the frame that cleared the last brick went on to the exit step with the rally's elapsed time, so after any + // rally over a second the paddle snapped back into the composer and the game ended in that same frame. + test("clearing the last brick after a long rally plays the whole exit morph", () => { + const won = transitionBrickBreaker(playing(), { type: "cleared", now: 25 }) + + expect(won).toEqual({ status: "exit", startedAt: 25, kind: "win" }) + expect(acceptsBrickBreakerInput(won)).toBe(false) + expect(transitionBrickBreaker(won, frame(25.5))).toBe(won) + expect(transitionBrickBreaker(won, frame(26))).toEqual({ status: "disposed" }) + }) + + // Before, the frame that lost the ball went on to the miss step with the rally's elapsed time, so after a rally over + // 0.55 s the pause was skipped: a life went at once, and on the last life the exit morph was skipped too. + test("missing after a long rally pauses before taking a life", () => { + const missed = transitionBrickBreaker(playing(), { type: "missed", now: 15 }) + + expect(missed).toEqual({ status: "miss", startedAt: 15, lives: 3 }) + expect(transitionBrickBreaker(missed, frame(15.2))).toBe(missed) + expect(transitionBrickBreaker(missed, frame(15.56))).toEqual({ + status: "serve", + startedAt: 15.56, + landed: false, + lives: 2, + }) + }) + + test("the last miss pauses, then plays the whole exit morph", () => { + const last: BrickBreakerState = { status: "miss", startedAt: 30, lives: 1 } + const lost = transitionBrickBreaker(last, frame(30.56)) + + expect(transitionBrickBreaker(last, frame(30.5))).toBe(last) + expect(lost).toEqual({ status: "exit", startedAt: 30.56, kind: "lose" }) + expect(transitionBrickBreaker(lost, frame(31.2))).toBe(lost) + expect(transitionBrickBreaker(lost, frame(31.6))).toEqual({ status: "disposed" }) + }) + + test("a ball dropping back onto the paddle cannot be served until it lands", () => { + const dropping: BrickBreakerState = { status: "serve", startedAt: 10, landed: false, lives: 2 } + const landed = transitionBrickBreaker(dropping, frame(10.43)) + + expect(transitionBrickBreaker(dropping, launch)).toBe(dropping) + expect(transitionBrickBreaker(dropping, frame(10.3))).toBe(dropping) + expect(landed).toEqual({ ...dropping, landed: true }) + expect(transitionBrickBreaker(landed, launch)).toEqual({ status: "play", lives: 2 }) + expect(brickBreakerSpares(landed)).toBe(1) + }) + + test("Escape quits from every phase, once", () => { + const states: BrickBreakerState[] = [ + createBrickBreakerState(0), + run([frame(1)]), + playing(), + transitionBrickBreaker(playing(), { type: "missed", now: 4 }), + ] + + states.forEach((state) => + expect(transitionBrickBreaker(state, { type: "quit", now: 5 })).toEqual({ + status: "exit", + startedAt: 5, + kind: "quit", + }), + ) + + const quit = transitionBrickBreaker(playing(), { type: "quit", now: 5 }) + expect(transitionBrickBreaker(quit, { type: "quit", now: 5.5 })).toBe(quit) + expect(transitionBrickBreaker(quit, { type: "missed", now: 5.5 })).toBe(quit) + }) + + test("frames that cross no threshold keep the same state, including a frame stamped before the phase began", () => { + const entering = createBrickBreakerState(10) + const rally = playing() + + expect(transitionBrickBreaker(entering, frame(9.992))).toBe(entering) + expect(transitionBrickBreaker(rally, frame(100))).toBe(rally) + expect(transitionBrickBreaker(rally, launch)).toBe(rally) + }) + + test("unmounting ends the game from any phase and ignores everything after", () => { + const disposed = transitionBrickBreaker(playing(), { type: "dispose" }) + + expect(disposed).toEqual({ status: "disposed" }) + expect(transitionBrickBreaker(createBrickBreakerState(0), { type: "dispose" })).toBe(disposed) + + for (const event of [frame(50), launch, { type: "quit", now: 50 }] satisfies BrickBreakerEvent[]) + expect(transitionBrickBreaker(disposed, event)).toBe(disposed) + }) +}) diff --git a/packages/app/src/new-session/brick-breaker-machine.ts b/packages/app/src/new-session/brick-breaker-machine.ts new file mode 100644 index 0000000000..550ccc42cc --- /dev/null +++ b/packages/app/src/new-session/brick-breaker-machine.ts @@ -0,0 +1,110 @@ +export const BRICK_BREAKER_LIVES = 3 + +// Phase lengths in seconds, shared with the animations that fill them. +export const BRICK_BREAKER_TIMING = { + // The ball lands on the shrinking composer, which has become the paddle by `enter`. + enterLand: 0.38, + enter: 0.85, + // After a miss the ball drops back onto the paddle before it can be served. + serveDrop: 0.42, + miss: 0.55, + exit: 1, +} as const + +export type BrickBreakerExit = "win" | "lose" | "quit" + +/** + * A brick breaker game, held in a plain variable by the frame loop and replaced whole, never in a Solid store. Each + * timed phase counts from `startedAt`, in the frame loop's clock (seconds). `landed` marks the ball resting on the + * paddle, which it must before it can be served. + */ +export type BrickBreakerState = + | { readonly status: "enter"; readonly startedAt: number; readonly landed: boolean } + | { readonly status: "serve"; readonly startedAt: number; readonly landed: boolean; readonly lives: number } + | { readonly status: "play"; readonly lives: number } + | { readonly status: "miss"; readonly startedAt: number; readonly lives: number } + | { readonly status: "exit"; readonly startedAt: number; readonly kind: BrickBreakerExit } + // The exit morph finished or the game unmounted. + | { readonly status: "disposed" } + +export type BrickBreakerEvent = + // The frame loop reuses one event object, so `now` is writable. + | { readonly type: "frame"; now: number } + | { readonly type: "launch" } + | { readonly type: "cleared"; readonly now: number } + | { readonly type: "missed"; readonly now: number } + | { readonly type: "quit"; readonly now: number } + | { readonly type: "dispose" } + +const DISPOSED: BrickBreakerState = Object.freeze({ status: "disposed" }) + +export function createBrickBreakerState(now: number): BrickBreakerState { + return { status: "enter", startedAt: now, landed: false } +} + +/** Returns the same object when no phase threshold is crossed, so the frame loop allocates nothing. */ +export function transitionBrickBreaker(state: BrickBreakerState, event: BrickBreakerEvent): BrickBreakerState { + if (state.status === "disposed") return state + + if (event.type === "dispose") return DISPOSED + + if (event.type === "quit") return state.status === "exit" ? state : exit(event.now, "quit") + + if (event.type === "launch") + return state.status === "serve" && state.landed ? { status: "play", lives: state.lives } : state + + if (event.type === "cleared") return state.status === "play" ? exit(event.now, "win") : state + + if (event.type === "missed") + return state.status === "play" ? { status: "miss", startedAt: event.now, lives: state.lives } : state + + if (state.status === "play") return state + const elapsed = event.now - state.startedAt + + if (state.status === "enter") { + if (elapsed >= BRICK_BREAKER_TIMING.enter) + return { status: "serve", startedAt: event.now, landed: true, lives: BRICK_BREAKER_LIVES } + + return !state.landed && elapsed >= BRICK_BREAKER_TIMING.enterLand ? { ...state, landed: true } : state + } + + if (state.status === "serve") + return !state.landed && elapsed >= BRICK_BREAKER_TIMING.serveDrop ? { ...state, landed: true } : state + + if (state.status === "miss") { + if (elapsed < BRICK_BREAKER_TIMING.miss) return state + + if (state.lives <= 1) return exit(event.now, "lose") + + return { status: "serve", startedAt: event.now, landed: false, lives: state.lives - 1 } + } + + return elapsed >= BRICK_BREAKER_TIMING.exit ? DISPOSED : state +} + +/** Input steers and serves until the exit morph starts. */ +export function acceptsBrickBreakerInput(state: BrickBreakerState) { + return state.status !== "exit" && state.status !== "disposed" +} + +/** The paddle follows input once the composer has shrunk into it, until it grows back. */ +export function movesBrickBreakerPaddle(state: BrickBreakerState) { + return state.status === "serve" || state.status === "play" || state.status === "miss" +} + +export function isBrickBreakerBallMoving(state: BrickBreakerState) { + return state.status === "play" || state.status === "miss" +} + +/** Spare lives shown beside the paddle, not counting the ball in play. */ +export function brickBreakerSpares(state: BrickBreakerState) { + if (state.status === "enter") return BRICK_BREAKER_LIVES - 1 + + if (state.status === "serve" || state.status === "play" || state.status === "miss") return state.lives - 1 + + return 0 +} + +function exit(now: number, kind: BrickBreakerExit): BrickBreakerState { + return { status: "exit", startedAt: now, kind } +} diff --git a/packages/app/src/new-session/brick-breaker.tsx b/packages/app/src/new-session/brick-breaker.tsx index 8ef2c9de02..a6706b4317 100644 --- a/packages/app/src/new-session/brick-breaker.tsx +++ b/packages/app/src/new-session/brick-breaker.tsx @@ -1,13 +1,25 @@ import { For, onCleanup, onMount } from "solid-js" +import { + BRICK_BREAKER_LIVES, + BRICK_BREAKER_TIMING, + acceptsBrickBreakerInput, + brickBreakerSpares, + createBrickBreakerState, + isBrickBreakerBallMoving, + movesBrickBreakerPaddle, + transitionBrickBreaker, + type BrickBreakerEvent, + type BrickBreakerExit, + type BrickBreakerState, +} from "./brick-breaker-machine" import type { PinBoardHandle } from "./pin-board" import { PinSound } from "./pin-sound" import type { LodgerBall } from "./wordmark" -const LIVES = 3 -const ENTER = 0.85 -const EXIT = 1 +const LAUNCH: BrickBreakerEvent = Object.freeze({ type: "launch" }) + +const DISPOSE: BrickBreakerEvent = Object.freeze({ type: "dispose" }) -type Phase = "enter" | "serve" | "play" | "miss" | "exit" type Box = { x: number; y: number; w: number; h: number; r: number } /** @@ -29,7 +41,13 @@ export function NewSessionBrickBreaker(props: { onMount(() => onCleanup( - mountGame({ panel: props.panel, paddle, hud, score, spares, walls }, props.board, props.ball, props.sound, props.onDone), + mountGame( + { panel: props.panel, paddle, hud, score, spares, walls }, + props.board, + props.ball, + props.sound, + props.onDone, + ), ), ) @@ -54,7 +72,7 @@ export function NewSessionBrickBreaker(props: { class="absolute right-4 top-3 font-mono text-[11px] leading-[16px] tabular-nums text-v2-text-text-faint" />
- + {(_, i) => ( (spares[i()] = el)} @@ -89,14 +107,19 @@ function mountGame( const surface = form ? getComputedStyle(form).backgroundColor : "" // The arena is exactly as wide as the wordmark, like Arkanoid's tall, narrow playfield. const view = { left: 0, top: 0, w: 0, h: 0, l: 0, r: 0 } - const g = { phase: "enter" as Phase, t0: performance.now() / 1000, last: 0, raf: 0, lives: LIVES, score: 0 } + let state: BrickBreakerState = createBrickBreakerState(performance.now() / 1000) + let last = 0 + let raf = 0 + let score = 0 + // Reused by every frame, so a frame that crosses no phase threshold allocates nothing. + const tick = { type: "frame" as const, now: 0 } const rally = { combo: 0, hits: 0, base: 0, speed: 0 } const pad = { x: 0, target: 0, v: 0, w: 0, h: 12, y: 0, tilt: 0, kickAt: -1, steer: 1 } - const b = { x: 0, y: 0, vx: 0, vy: 0, hitAt: -1, hitAngle: 0, hitAmp: 0, squintUntil: 0, curl: 0.85, landed: false } + const b = { x: 0, y: 0, vx: 0, vy: 0, hitAt: -1, hitAngle: 0, hitAmp: 0, squintUntil: 0, curl: 0.85 } const keys = { left: false, right: false } const start = { ball: ball.at(), composer: composerBox(), from: composerBox() } // The paddle's drawn shape, so the exit morph starts from wherever the paddle is. - const shape: Box = { ...start.composer } + const drawn: Box = { ...start.composer } const written = { w: -1, h: -1, r: -1, transform: "", score: "" } const layout = () => { @@ -124,32 +147,95 @@ function mountGame( function composerBox(): Box { const p = panel.getBoundingClientRect() const r = form?.getBoundingClientRect() + if (!r) return { x: p.width / 2 - 60, y: p.height - 64, w: 120, h: 12, r: 6 } const radius = form ? parseFloat(getComputedStyle(form).borderTopLeftRadius) : 12 + return { x: r.left - p.left, y: r.top - p.top, w: r.width, h: r.height, r: radius || 12 } } const paddleBox = (): Box => ({ x: pad.x - pad.w / 2, y: pad.y, w: pad.w, h: pad.h, r: pad.h / 2 }) + // Crosses any phase threshold first, then animates the one phase the frame is in. A phase entered while animating + // (a miss or the last brick) starts animating next frame, from its own start. const frame = (ms: number) => { - g.raf = 0 + raf = 0 const now = ms / 1000 - const dt = Math.min(1 / 30, Math.max(1 / 240, now - g.last)) - g.last = now - const t = now - g.t0 + const dt = Math.min(1 / 30, Math.max(1 / 240, now - last)) + last = now + tick.now = now + dispatch(tick) + + if (state.status === "disposed") return onDone() movePaddle(dt, now) - if (g.phase === "enter") enter(t) - if (g.phase === "serve") serve(t) - if (g.phase === "play") play(dt, now) - if (g.phase === "miss") miss(t) - if (g.phase === "exit") return exit(t) - pose(now) - board.steer(b.x, b.y) - g.raf = requestAnimationFrame(frame) + animate(dt, now) + + if (state.status !== "exit") { + pose(now) + board.steer(b.x, b.y) + } + + raf = requestAnimationFrame(frame) + } + + const animate = (dt: number, now: number) => { + if (state.status === "enter") return enter(now - state.startedAt) + + if (state.status === "serve") + return serve(state.landed ? 1 : seg(now - state.startedAt, 0, BRICK_BREAKER_TIMING.serveDrop)) + + if (state.status === "play") return play(dt, now) + + if (state.status === "exit") return exit(now - state.startedAt) + } + + const dispatch = (event: BrickBreakerEvent) => { + const prev = state + state = transitionBrickBreaker(prev, event) + + if (state !== prev) changed(prev, state) + } + + // What happens once as the game moves from one phase, or landing, to the next. + const changed = (prev: BrickBreakerState, next: BrickBreakerState) => { + if (next.status === "disposed") return + + const landed = + (prev.status === "enter" || prev.status === "serve") && + !prev.landed && + (next.status === "enter" || next.status === "serve") && + next.landed + + if (landed) { + bump(Math.PI / 2, prev.status === "enter" ? 0.32 : 0.36) + + if (sound()) PinSound.paddle(b.x, view.w) + } + + if (prev.status === "enter" && next.status === "serve") { + pad.target = pad.x + panel.style.cursor = "none" + } + + if (prev.status === "serve" && next.status === "play") launch() + + if (prev.status === "play" && next.status === "miss" && sound()) + PinSound.sweep({ duration: 0.45, columns: 78, reverse: true }) + + if (prev.status === "miss") { + const spares = brickBreakerSpares(next) + parts.spares.forEach((el, i) => { + el.style.opacity = i < spares ? "1" : "0" + el.style.transform = i < spares ? "" : "translateY(4px)" + }) + } + + if (next.status === "exit") finish(next.kind) } const movePaddle = (dt: number, now: number) => { - if (g.phase === "enter" || g.phase === "exit") return + if (!movesBrickBreakerPaddle(state)) return + if (keys.left !== keys.right) pad.target += (keys.right ? 1 : -1) * 1100 * dt pad.target = Math.max(view.l + pad.w / 2 + 4, Math.min(view.r - pad.w / 2 - 4, pad.target)) const prev = pad.x @@ -163,9 +249,10 @@ function mountGame( // The composer content fades, then its box springs down and narrows into the paddle while the ball rides on top. const enter = (t: number) => { - const u = seg(t, 0.1, ENTER) + const u = seg(t, 0.1, BRICK_BREAKER_TIMING.enter) const e = spring(u) const to = paddleBox() + const box = { x: lerp(start.from.x + start.from.w / 2, to.x + to.w / 2, e), y: lerp(start.from.y, to.y, e), @@ -173,44 +260,31 @@ function mountGame( h: Math.max(4, lerp(start.from.h, to.h, e)), r: lerp(start.from.r, to.r, Math.min(1, u * 1.6)), } + draw({ ...box, x: box.x - box.w / 2 }, 0) - const k = easeOut(seg(t, 0, 0.38)) + const k = easeOut(seg(t, 0, BRICK_BREAKER_TIMING.enterLand)) const r = ball.radius() b.x = lerp(start.ball.x, box.x, k) b.y = lerp(start.ball.y, box.y - r, k) - Math.sin(Math.PI * k) * 28 b.curl = lerp(0.85, 1, k) - if (k >= 1 && !b.landed) { - b.landed = true - bump(Math.PI / 2, 0.32) - if (sound()) PinSound.paddle(b.x, view.w) - } + // Once it has shrunk enough to read as a paddle, it takes on the colour of the pins it is about to break. if (t >= 0.3) parts.paddle.style.background = "var(--v2-icon-icon-muted)" + if (t >= 0.5) parts.hud.style.opacity = "1" - if (t < ENTER) return - pad.target = pad.x - setPhase("serve") - panel.style.cursor = "none" } // The ball waits on the paddle like Arkanoid's; after a miss it drops back onto it first. - const serve = (t: number) => { + const serve = (drop: number) => { const r = ball.radius() - const drop = g.lives < LIVES ? seg(t, 0, 0.42) : 1 b.x = pad.x b.y = pad.y - r - Math.pow(1 - drop, 2) * 110 b.vx = 0 b.vy = 0 b.curl = 1 - if (drop >= 1 && !b.landed) { - b.landed = true - bump(Math.PI / 2, 0.36) - if (sound()) PinSound.paddle(b.x, view.w) - } } const launch = () => { - if (g.phase !== "serve" || !b.landed) return // Serve away from the side the paddle is moving toward, up and to the right when still. const lean = Math.abs(pad.v) > 40 ? Math.sign(pad.v) : 1 const a = lean * (0.32 + Math.random() * 0.12) @@ -219,8 +293,8 @@ function mountGame( rally.combo = 0 pad.kickAt = performance.now() / 1000 bump(Math.PI / 2, 0.3) + if (sound()) PinSound.paddle(b.x, view.w) - setPhase("play") } const play = (dt: number, now: number) => { @@ -228,27 +302,28 @@ function mountGame( // Substeps keep the ball from tunnelling through a pin between frames at high speed. const steps = Math.max(1, Math.ceil((rally.speed * dt) / (r * 0.35))) const sdt = dt / steps + for (let i = 0; i < steps; i++) { b.x += b.vx * sdt b.y += b.vy * sdt + if (b.x < view.l + r || b.x > view.r - r) { b.x = Math.max(view.l + r, Math.min(view.r - r, b.x)) b.vx = b.x <= view.l + r ? Math.abs(b.vx) : -Math.abs(b.vx) bump(0, 0.22) + if (sound()) PinSound.bounce(b.x, view.w, 4000) } + if (b.y < r) { b.y = r b.vy = Math.abs(b.vy) bump(Math.PI / 2, 0.22) + if (sound()) PinSound.bounce(b.x, view.w, 4000) } - if ( - b.vy > 0 && - b.y + r >= pad.y && - b.y - r < pad.y + pad.h && - Math.abs(b.x - pad.x) <= pad.w / 2 + r * 0.6 - ) { + + if (b.vy > 0 && b.y + r >= pad.y && b.y - r < pad.y + pad.h && Math.abs(b.x - pad.x) <= pad.w / 2 + r * 0.6) { // Classic paddle control: where the ball lands sets its angle, up to 60° from vertical. const off = Math.max(-1, Math.min(1, (b.x - pad.x) / (pad.w / 2))) const a = off * (Math.PI / 3) + Math.max(-0.15, Math.min(0.15, pad.v / 6000)) @@ -260,57 +335,50 @@ function mountGame( b.y = pad.y - r pad.kickAt = now bump(Math.PI / 2, 0.34) + if (sound()) PinSound.paddle(b.x, view.w) } + // Each hit carves a round bite out of the wordmark rather than a single pin. const hit = board.collide(b.x, b.y, r, r * 0.55, b.vx, b.vy) + if (hit) { const side = Math.abs(hit.nx) > Math.abs(hit.ny) + if (side && b.vx * hit.nx < 0) b.vx = -b.vx + if (!side && b.vy * hit.ny < 0) b.vy = -b.vy rally.combo++ - g.score += hit.count * 10 * Math.min(8, rally.combo) + score += hit.count * 10 * Math.min(8, rally.combo) b.squintUntil = now + 0.14 bump(side ? 0 : Math.PI / 2, 0.26) + if (sound()) PinSound.brick(b.x, view.w, rally.combo) - if (!board.left()) return finish("win") + + if (!board.left()) return dispatch({ type: "cleared", now }) } + // A nearly flat rally never comes back down, so keep at least a quarter of the speed vertical. const min = rally.speed * 0.25 + if (Math.abs(b.vy) < min) { b.vy = (b.vy < 0 ? -1 : 1) * min b.vx = Math.sign(b.vx || 1) * Math.sqrt(rally.speed * rally.speed - min * min) } - if (b.y - r > view.h) { - setPhase("miss") - if (sound()) PinSound.sweep({ duration: 0.45, columns: 78, reverse: true }) - return - } - } - } - const miss = (t: number) => { - if (t < 0.55) return - g.lives-- - parts.spares.forEach((el, i) => { - el.style.opacity = i < g.lives - 1 ? "1" : "0" - el.style.transform = i < g.lives - 1 ? "" : "translateY(4px)" - }) - if (!g.lives) return finish("lose") - b.landed = false - setPhase("serve") + if (b.y - r > view.h) return dispatch({ type: "missed", now }) + } } - const finish = (kind: "win" | "lose" | "quit") => { - if (g.phase === "exit") return + const finish = (kind: BrickBreakerExit) => { start.composer = composerBox() - start.from = { ...shape } - setPhase("exit") + start.from = { ...drawn } panel.style.cursor = "" parts.hud.style.opacity = "0" parts.paddle.style.background = surface board.restore() ball.done() + if (sound()) PinSound.sweep({ duration: 0.9, columns: 78, reverse: kind !== "win" }) } @@ -328,21 +396,13 @@ function mountGame( }, pad.tilt * (1 - e), ) - if (t >= 0.75) { - if (wrap) wrap.style.opacity = "" - if (tip) tip.style.opacity = "" - parts.paddle.style.opacity = "0" - } - if (t < EXIT) { - g.raf = requestAnimationFrame(frame) - return - } - onDone() - } - const setPhase = (phase: Phase) => { - g.phase = phase - g.t0 = performance.now() / 1000 + if (t < 0.75) return + + if (wrap) wrap.style.opacity = "" + + if (tip) tip.style.opacity = "" + parts.paddle.style.opacity = "0" } const bump = (angle: number, amp: number) => { @@ -354,7 +414,7 @@ function mountGame( const pose = (now: number) => { const t = now - b.hitAt const jiggle = t < 0.45 ? b.hitAmp * Math.exp(-t * 12) * Math.cos(t * 38) : 0 - const moving = g.phase === "play" || g.phase === "miss" + const moving = isBrickBreakerBallMoving(state) const heading = Math.atan2(b.vy, b.vx) const squash = Math.abs(jiggle) > 0.015 ball.place(b.x, b.y, { @@ -365,7 +425,8 @@ function mountGame( squint: now < b.squintUntil ? 0.45 : 1, curl: b.curl, }) - const text = `${g.score}`.padStart(5, "0") + const text = `${score}`.padStart(5, "0") + if (text !== written.score) { written.score = text parts.score.textContent = text @@ -373,37 +434,45 @@ function mountGame( } const draw = (box: Box, tilt: number) => { - Object.assign(shape, box) + Object.assign(drawn, box) const el = parts.paddle const w = Math.round(box.w * 10) / 10 const h = Math.round(box.h * 10) / 10 + if (w !== written.w) el.style.width = `${(written.w = w)}px` + if (h !== written.h) el.style.height = `${(written.h = h)}px` + if (box.r !== written.r) el.style.borderRadius = `${(written.r = box.r)}px` const transform = `translate(${box.x.toFixed(1)}px, ${box.y.toFixed(1)}px) rotate(${tilt.toFixed(2)}deg)` + if (transform !== written.transform) el.style.transform = written.transform = transform } const onMove = (event: PointerEvent) => { pad.target = event.clientX - view.left } + const onDown = (event: PointerEvent) => { - if (event.button !== 0 || g.phase === "exit") return + if (event.button !== 0 || !acceptsBrickBreakerInput(state)) return event.preventDefault() event.stopPropagation() - launch() + dispatch(LAUNCH) } + const onKey = (event: KeyboardEvent) => { - if (g.phase === "exit") return + if (!acceptsBrickBreakerInput(state)) return const down = event.type === "keydown" - if (event.key === "Escape" && down) finish("quit") + + if (event.key === "Escape" && down) dispatch({ type: "quit", now: performance.now() / 1000 }) else if (event.key === "ArrowLeft" || event.key === "a") keys.left = down else if (event.key === "ArrowRight" || event.key === "d") keys.right = down - else if ((event.key === " " || event.key === "ArrowUp") && down) launch() + else if ((event.key === " " || event.key === "ArrowUp") && down) dispatch(LAUNCH) else return event.preventDefault() event.stopPropagation() } + const onBlur = () => { keys.left = false keys.right = false @@ -417,12 +486,15 @@ function mountGame( parts.paddle.style.background = surface parts.paddle.style.boxShadow = "var(--v2-elevation-raised)" parts.paddle.style.transition = "opacity 180ms ease-out, background-color 360ms ease-out" + // The provider tip sits where the paddle plays, so it steps aside for the game. if (tip) { tip.style.transition = "opacity 200ms ease-out" tip.style.opacity = "0" } + draw(start.composer, 0) + if (wrap) { if (wrap.contains(document.activeElement) && document.activeElement instanceof HTMLElement) document.activeElement.blur() @@ -431,6 +503,7 @@ function mountGame( wrap.style.pointerEvents = "none" wrap.inert = true } + board.play() const resize = new ResizeObserver(layout) resize.observe(panel) @@ -439,11 +512,12 @@ function mountGame( window.addEventListener("keydown", onKey, { capture: true }) window.addEventListener("keyup", onKey, { capture: true }) window.addEventListener("blur", onBlur) - g.last = performance.now() / 1000 - 1 / 60 - g.raf = requestAnimationFrame(frame) + last = performance.now() / 1000 - 1 / 60 + raf = requestAnimationFrame(frame) return () => { - cancelAnimationFrame(g.raf) + dispatch(DISPOSE) + cancelAnimationFrame(raf) resize.disconnect() panel.removeEventListener("pointermove", onMove) panel.removeEventListener("pointerdown", onDown, { capture: true }) @@ -451,10 +525,12 @@ function mountGame( window.removeEventListener("keyup", onKey, { capture: true }) window.removeEventListener("blur", onBlur) panel.style.cursor = "" + if (tip) { tip.style.opacity = "" tip.style.transition = "" } + if (!wrap) return wrap.style.opacity = "" wrap.style.transition = "" @@ -464,8 +540,12 @@ function mountGame( } const lerp = (a: number, b: number, t: number) => a + (b - a) * t + const seg = (t: number, from: number, to: number) => Math.max(0, Math.min(1, (t - from) / (to - from))) + const easeOut = (t: number) => 1 - Math.pow(1 - t, 3) + const easeInOut = (t: number) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2) + // An underdamped spring that settles by t = 1, overshooting about 9% on the way. const spring = (t: number) => (t >= 1 ? 1 : 1 - Math.exp(-7 * t) * Math.cos(9 * t)) diff --git a/packages/app/src/new-session/composer-adapter.ts b/packages/app/src/new-session/composer-adapter.ts index 8ea95f8a99..550d8dd2ab 100644 --- a/packages/app/src/new-session/composer-adapter.ts +++ b/packages/app/src/new-session/composer-adapter.ts @@ -1,7 +1,7 @@ import { Predicate } from "effect" import { base64Encode } from "@opencode/util/encode" import { Session } from "@opencode/schema/session" -import { createMemo, createSignal, onCleanup, startTransition } from "solid-js" +import { createMemo, createSignal, onCleanup, startTransition, untrack } from "solid-js" import type { ComposerSession, NewSessionComposerAdapter } from "@/composer/adapter" import { useComposerState } from "@/composer/persistence" import { createComposerControls, createComposerModelSelection } from "@/composer/selection" @@ -11,12 +11,12 @@ import { useLocal } from "@/providers/models/selection" import { useData, useServer } from "@/runtime/server/current" import { useServerSDK } from "@/runtime/server/client" import { useTabs } from "@/shell/tabs/tabs" -import { useWorkspaceLocation } from "@/workspaces/location" import { createWorktree } from "@/workspaces/create" import { showToast } from "@/shell/notifications/toast" import type { DraftMcpControls } from "./mcp" import { createNewSessionStartState, + isNewSessionStartActive, transitionNewSessionStart, viewNewSessionStart, type NewSessionStartEffect, @@ -24,23 +24,30 @@ import { type NewSessionStartTransition, } from "./machine" +// The phase each request runs in, which its timer ends. +const PHASES = { "worktree.create": "worktree", "mcp.prepare": "mcp", "session.create": "session" } as const + // Lives in the draft's tab memory, so an attempt outlives the draft screen that the pending tab replaces. export function createNewSessionStartStore() { const [state, setState] = createSignal(createNewSessionStartState()) - const runners = new Map Promise>() + // Only one attempt is active at a time, and one that has settled runs no further effects. + let runner: { attempt: number; run: (effect: NewSessionStartEffect) => Promise } | undefined - const run = (result: NewSessionStartTransition) => { - result.effects.forEach((effect) => void runners.get(effect.attempt)?.(effect)) + const commit = (result: NewSessionStartTransition) => { + setState(result.state) + const current = runner - // Only one attempt is active at a time, and one that has settled runs no further effects. - if (result.state.type !== "worktree" && result.state.type !== "mcp" && result.state.type !== "session") - runners.clear() + if (!isNewSessionStartActive(result.state)) runner = undefined + result.effects.forEach((effect) => { + if (current?.attempt !== effect.attempt) return + void Promise.try(() => current.run(effect)).catch((cause: unknown) => console.error("[new-session]", cause)) + }) } const dispatch = (event: NewSessionStartEvent) => { - const result = transitionNewSessionStart(state(), event) - setState(result.state) - run(result) + const result = transitionNewSessionStart(untrack(state), event) + + if (result.state !== untrack(state)) commit(result) } onCleanup(() => dispatch({ type: "dispose" })) @@ -53,12 +60,11 @@ export function createNewSessionStartStore() { event: Extract, open: (attempt: number) => (effect: NewSessionStartEffect) => Promise, ) { - const result = transitionNewSessionStart(state(), event) + const result = transitionNewSessionStart(untrack(state), event) - if (result.state === state() || result.state.type === "disposed") return false - setState(result.state) - runners.set(result.state.attempt, open(result.state.attempt)) - run(result) + if (!isNewSessionStartActive(result.state)) return false + runner = { attempt: result.state.attempt, run: open(result.state.attempt) } + commit(result) return true }, @@ -72,6 +78,7 @@ type Started = Awaited> export function createNewSessionComposerAdapter(props: { draftID: string worktree: () => string + root: () => string branch: () => string | undefined submitted: () => void mcp: DraftMcpControls @@ -84,7 +91,6 @@ export function createNewSessionComposerAdapter(props: { const server = useServer() const serverSDK = useServerSDK() const tabs = useTabs() - const location = useWorkspaceLocation() const language = useLanguage() const model = createComposerModelSelection({ agent: () => local.agent.current() }) const controls = createComposerControls({ model }) @@ -97,11 +103,7 @@ export function createNewSessionComposerAdapter(props: { working: () => false, submitted: props.submitted, start(selection, submission, message) { - const currentDirectory = location().directory - - const projectDirectory = - data.location.info({ directory: currentDirectory })?.project.canonical ?? currentDirectory - + const projectDirectory = props.root() const worktree = props.worktree() const directory = worktree === "main" ? projectDirectory : worktree const sessionID = Session.ID.create() @@ -125,10 +127,43 @@ export function createNewSessionComposerAdapter(props: { { message, selection, view: props.start.view }, ) + // Aborted when the attempt ends: MCP preparation stops between steps and a late Session create is undone. + const ended = new AbortController() + let timer: ReturnType | undefined + + const end = () => { + clearTimeout(timer) + ended.abort() + } + return async (effect) => { + // Settles before awaiting the tab, so a disposed attempt starts no request. + if (effect.type === "attempt.abort") { + end() + settled.resolve(undefined) + + return + } + + if (effect.type === "tab.rollback" || effect.type === "session.promote") end() + + if ( + effect.type === "worktree.create" || + effect.type === "mcp.prepare" || + effect.type === "session.create" + ) { + const phase = PHASES[effect.type] + + clearTimeout(timer) + timer = setTimeout(() => props.start.dispatch({ type: "timed-out", attempt, phase }), effect.timeoutMs) + } + await pending.ready + // The worktree request is not aborted: cutting it off can stop the project's setup script midway. A + // worktree it creates after the attempt ended stays, and shows up in the worktree list. if (effect.type === "worktree.create") { + if (ended.signal.aborted) return props.start.dispatch( await createWorktree({ api: serverSDK.api, @@ -146,13 +181,19 @@ export function createNewSessionComposerAdapter(props: { } if (effect.type === "mcp.prepare") { - const prepared = await props.mcp.prepare(effect.directory, effect.mcp) - props.start.dispatch({ type: prepared ? "mcp.prepared" : "mcp.failed", attempt }) + if (ended.signal.aborted) return + props.start.dispatch( + await props.mcp.prepare(effect.directory, effect.mcp, ended.signal).then( + (prepared) => ({ type: prepared ? "mcp.prepared" : "mcp.failed", attempt }) as const, + (error) => ({ type: "mcp.failed", attempt, message: errorMessage(language, error) }) as const, + ), + ) return } if (effect.type === "session.create") { + if (ended.signal.aborted) return props.start.dispatch( await data.session .create({ @@ -166,7 +207,12 @@ export function createNewSessionComposerAdapter(props: { location: { directory: effect.directory }, }) .request.then( - () => ({ type: "session.created", attempt }) as const, + () => { + // The attempt ended first, so the prompt was never sent and the Session is still empty. + if (ended.signal.aborted) void data.session.remove(effect.sessionID).catch(() => undefined) + + return { type: "session.created", attempt } as const + }, (error) => ({ type: "session.failed", attempt, message: errorMessage(language, error) }) as const, ), ) @@ -200,23 +246,24 @@ export function createNewSessionComposerAdapter(props: { return } - if (effect.type === "toast") { - showToast({ title: language.t(effect.title), description: effect.message }) + if (effect.type === "toast" || effect.type === "toast.timed-out") { + showToast({ + variant: effect.title === "session.summary.mcp.prepareFailed" ? "error" : undefined, + title: language.t(effect.title), + description: effect.type === "toast" ? effect.message : language.t("session.new.timedOut"), + }) return } - if (effect.type === "tab.rollback") { - if (effect.worktree) { - data.project.invalidate() - await data.project.sync().catch(() => undefined) - } - - await pending.rollback(effect.worktree?.directory) - - if (effect.worktree) props.mcp.remember(effect.worktree.directory, effect.worktree.mcp) + if (effect.worktree) { + data.project.invalidate() + await data.project.sync().catch(() => undefined) } + await pending.rollback(effect.worktree?.directory) + + if (effect.worktree) props.mcp.remember(effect.worktree.directory, effect.worktree.mcp) settled.resolve(undefined) } }, @@ -233,6 +280,7 @@ export function createNewSessionComposerAdapter(props: { directory, handoff: server.ctx.handoff.forSession(id), api: serverSDK.api.session, + file: serverSDK.api.file, data, current: () => data.session.get(id), admitted: (messageID) => data.session.input.has(id, messageID) || !!data.session.message.get(id, messageID), diff --git a/packages/app/src/new-session/location/dialog.css b/packages/app/src/new-session/location/dialog.css index bafc1911fa..95a1e39b66 100644 --- a/packages/app/src/new-session/location/dialog.css +++ b/packages/app/src/new-session/location/dialog.css @@ -161,6 +161,26 @@ gap: 6px; } +.new-session-location-branch { + display: flex; + min-width: 0; + align-items: center; + gap: 4px; + color: var(--v2-text-text-muted); +} + +.new-session-location-branch [data-slot="icon-svg"] { + flex-shrink: 0; + color: var(--v2-icon-icon-muted); +} + +.new-session-location-branch > span { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .new-session-location-tag { max-width: 160px; flex-shrink: 0; diff --git a/packages/app/src/new-session/location/dialog.tsx b/packages/app/src/new-session/location/dialog.tsx index c2b5d225b3..b689fcb0a0 100644 --- a/packages/app/src/new-session/location/dialog.tsx +++ b/packages/app/src/new-session/location/dialog.tsx @@ -20,6 +20,7 @@ import type { PromptProject, PromptProjectController, PromptServer } from "@/new import type { NewSessionWorkspaceController } from "@/new-session/workspace/controller" import { useLanguage } from "@/runtime/i18n/language" import { useServerSDK } from "@/runtime/server/client" +import { useData } from "@/runtime/server/current" import { ServerConnection, useServers } from "@/runtime/server/registry" import { useGlobal } from "@/runtime/server/runtime" import { useCommand } from "@/shell/commands/command" @@ -75,6 +76,7 @@ function NewSessionLocationDialog(props: { const global = useGlobal() const servers = useServers() const serverSDK = useServerSDK() + const data = useData() const [step, setStep] = createSignal(createLocationDialogState(props.drilled)) const view = createMemo(() => locationDialogView(step())) @@ -120,6 +122,10 @@ function NewSessionLocationDialog(props: { return !query || values.some((value) => value?.toLowerCase().includes(query)) } + // Only the current server's checkouts have a synced branch. + const checkout = (project: PromptProject) => + tagged(project.server) ? undefined : data.location.vcs.info({ directory: project.worktree })?.branch.current + const otherCount = createMemo(() => props.project.projects().filter((project) => !project.used).length) const projectEntries = createMemo(() => { @@ -169,7 +175,13 @@ function NewSessionLocationDialog(props: { value: directory, directory, })), - ].filter((entry) => matches(workspaceTitle(project, entry.value), entry.directory)) + ].filter((entry) => + matches( + workspaceTitle(project, entry.value), + entry.directory, + entry.value === "main" ? checkout(project) : undefined, + ), + ) }) const entries = () => { @@ -475,6 +487,7 @@ function NewSessionLocationDialog(props: { > @@ -495,7 +508,13 @@ function NewSessionLocationDialog(props: { ) } -function ProjectRow(props: { project: PromptProject; path: string; onDrill?: () => void; drillLabel: string }) { +function ProjectRow(props: { + project: PromptProject + branch?: string + path: string + onDrill?: () => void + drillLabel: string +}) { return ( <>
@@ -510,6 +529,14 @@ function ProjectRow(props: { project: PromptProject; path: string; onDrill?: () {displayName(props.project)} + + {(branch) => ( + + + {branch()} + + )} + {props.path} diff --git a/packages/app/src/new-session/machine.test.ts b/packages/app/src/new-session/machine.test.ts index 59cac187b4..371bffee21 100644 --- a/packages/app/src/new-session/machine.test.ts +++ b/packages/app/src/new-session/machine.test.ts @@ -1,6 +1,8 @@ import { expect, test } from "bun:test" import { Session } from "@opencode/schema/session" import { + NEW_SESSION_CREATE_TIMEOUT_MS, + NEW_SESSION_WORKTREE_TIMEOUT_MS, createNewSessionStartState, transitionNewSessionStart, viewNewSessionStart, @@ -131,11 +133,94 @@ test("a new worktree creates the Session in the created directory", () => { const result = replay([start(fresh), { type: "worktree.created", attempt: 1, directory: "/wt" }]) expect(result.effects).toEqual([ - { type: "worktree.create", attempt: 1, projectDirectory: "/repo", branch: "dev" }, - { type: "session.create", attempt: 1, sessionID, directory: "/wt" }, + { + type: "worktree.create", + attempt: 1, + projectDirectory: "/repo", + branch: "dev", + timeoutMs: NEW_SESSION_WORKTREE_TIMEOUT_MS, + }, + { type: "session.create", attempt: 1, sessionID, directory: "/wt", timeoutMs: NEW_SESSION_CREATE_TIMEOUT_MS }, ]) }) +// Before, no phase had a time limit: a create whose response stalled left the pending tab on "Starting session" with +// the prompt locked, for good. +test.each<{ name: string; events: NewSessionStartEvent[]; effects: NewSessionStartEffect[] }>([ + { + name: "worktree creation", + events: [start(fresh, { figma: true }), { type: "timed-out", attempt: 1, phase: "worktree" }], + effects: [ + { type: "toast.timed-out", attempt: 1, title: "prompt.toast.worktreeCreateFailed.title" }, + { type: "tab.rollback", attempt: 1, worktree: undefined }, + ], + }, + { + name: "MCP preparation in a created worktree", + events: [ + start(fresh, { figma: true }), + { type: "worktree.created", attempt: 1, directory: "/wt" }, + { type: "timed-out", attempt: 1, phase: "mcp" }, + ], + effects: [ + { type: "toast.timed-out", attempt: 1, title: "session.summary.mcp.prepareFailed" }, + { type: "tab.rollback", attempt: 1, worktree: { directory: "/wt", mcp: { figma: true } } }, + ], + }, + { + name: "session creation on an existing checkout", + events: [start(main), { type: "timed-out", attempt: 1, phase: "session" }], + effects: [ + { type: "toast.timed-out", attempt: 1, title: "prompt.toast.sessionCreateFailed.title" }, + { type: "tab.rollback", attempt: 1, worktree: undefined }, + ], + }, +])("a stalled $name times out and rolls back to the draft", (row) => { + const last = replay(row.events.slice(-1), replay(row.events.slice(0, -1)).state) + + expect(last.state).toEqual({ type: "idle", attempt: 1 }) + expect(last.effects).toEqual(row.effects) + // The draft can send again, as a new attempt. + expect(replay([start(main)], last.state).state).toMatchObject({ type: "session", attempt: 2 }) +}) + +test("each phase's time limit ends only that phase", () => { + const mcp = replay([start(fresh, { figma: true }), { type: "worktree.created", attempt: 1, directory: "/wt" }]).state + const session = replay([{ type: "mcp.prepared", attempt: 1 }], mcp).state + + const stale = transitionNewSessionStart(mcp, { type: "timed-out", attempt: 1, phase: "worktree" }) + expect(stale.state).toBe(mcp) + expect(stale.effects).toEqual([]) + expect(transitionNewSessionStart(session, { type: "timed-out", attempt: 1, phase: "mcp" }).state).toBe(session) + expect(transitionNewSessionStart(session, { type: "timed-out", attempt: 2, phase: "session" }).state).toBe(session) + // A timer that fires after the Session was created changes nothing. + const started = replay([{ type: "session.created", attempt: 1 }], session).state + expect(transitionNewSessionStart(started, { type: "timed-out", attempt: 1, phase: "session" }).state).toBe(started) +}) + +// Before, MCP preparation showed its own error even for an attempt that had already ended. +test("an MCP failure with a reason toasts through the machine, and nothing toasts once disposed", () => { + const preparing = replay([start(main, { figma: true })]).state + + expect( + transitionNewSessionStart(preparing, { type: "mcp.failed", attempt: 1, message: "Sign in to figma" }).effects, + ).toEqual([ + { type: "toast", attempt: 1, title: "session.summary.mcp.prepareFailed", message: "Sign in to figma" }, + { type: "tab.rollback", attempt: 1, worktree: undefined }, + ]) + + const disposed = replay([{ type: "dispose" }], preparing) + expect(disposed.effects).toEqual([{ type: "attempt.abort", attempt: 1 }]) + + const late: NewSessionStartEvent[] = [ + { type: "mcp.failed", attempt: 1, message: "Sign in to figma" }, + { type: "timed-out", attempt: 1, phase: "mcp" }, + { type: "session.failed", attempt: 1, message: "late" }, + ] + + late.forEach((event) => expect(transitionNewSessionStart(disposed.state, event).effects).toEqual([])) +}) + test.each<{ name: string; events: NewSessionStartEvent[]; effects: NewSessionStartEffect[] }>([ { name: "worktree creation fails", diff --git a/packages/app/src/new-session/machine.ts b/packages/app/src/new-session/machine.ts index 43b708e5a7..70158e9e90 100644 --- a/packages/app/src/new-session/machine.ts +++ b/packages/app/src/new-session/machine.ts @@ -2,6 +2,16 @@ import type { Session } from "@opencode/schema/session" type McpStates = Readonly> +// Outlasts the request queue's 10 minute budget for `POST /api/worktree`, which runs the project's setup script, so the +// phase only ends a create whose response stalled after that budget, never a slow setup script. +export const NEW_SESSION_WORKTREE_TIMEOUT_MS = 11 * 60_000 + +// Preparing waits for running MCP toggles (60 s each), then lists the servers, toggles them and lists them again. +export const NEW_SESSION_MCP_TIMEOUT_MS = 2 * 60_000 + +// Creating a Session is one small request. The prompt is sent only after it, so a create that lands later is empty. +export const NEW_SESSION_CREATE_TIMEOUT_MS = 30_000 + export type NewSessionWorkspace = // The main checkout or a worktree that already exists. | { readonly type: "existing"; readonly directory: string } @@ -31,6 +41,8 @@ export type NewSessionStartState = | { readonly type: "started"; readonly attempt: number } | { readonly type: "disposed" } +type ActiveState = Extract + export type NewSessionStartEvent = | { readonly type: "start" @@ -42,38 +54,58 @@ export type NewSessionStartEvent = } | { readonly type: "worktree.created"; readonly attempt: number; readonly directory: string } | { readonly type: "worktree.failed"; readonly attempt: number; readonly message: string } + // Without a message, the MCP controller already reported the failed toggle. | { readonly type: "mcp.prepared"; readonly attempt: number } - | { readonly type: "mcp.failed"; readonly attempt: number } + | { readonly type: "mcp.failed"; readonly attempt: number; readonly message?: string } | { readonly type: "session.created"; readonly attempt: number } | { readonly type: "session.failed"; readonly attempt: number; readonly message: string } + | { readonly type: "timed-out"; readonly attempt: number; readonly phase: ActiveState["type"] } | { readonly type: "dispose" } +type ToastTitle = + | "prompt.toast.worktreeCreateFailed.title" + | "session.summary.mcp.prepareFailed" + | "prompt.toast.sessionCreateFailed.title" + export type NewSessionStartEffect = + // Each phase's request carries the phase's time limit. | { readonly type: "worktree.create" readonly attempt: number readonly projectDirectory: string readonly branch?: string + readonly timeoutMs: number } - | { readonly type: "mcp.prepare"; readonly attempt: number; readonly directory: string; readonly mcp: McpStates } | { - readonly type: "session.create" | "session.promote" + readonly type: "mcp.prepare" + readonly attempt: number + readonly directory: string + readonly mcp: McpStates + readonly timeoutMs: number + } + | { + readonly type: "session.create" readonly attempt: number readonly sessionID: Session.ID readonly directory: string + readonly timeoutMs: number } | { - readonly type: "toast" + readonly type: "session.promote" readonly attempt: number - readonly title: "prompt.toast.worktreeCreateFailed.title" | "prompt.toast.sessionCreateFailed.title" - readonly message: string + readonly sessionID: Session.ID + readonly directory: string } - // Restores the draft tab. A created worktree becomes the draft's workspace and keeps the MCP choices. + | { readonly type: "toast"; readonly attempt: number; readonly title: ToastTitle; readonly message: string } + | { readonly type: "toast.timed-out"; readonly attempt: number; readonly title: ToastTitle } + // Ends the attempt and restores the draft tab. A created worktree becomes the draft's workspace and keeps the MCP + // choices. | { readonly type: "tab.rollback" readonly attempt: number readonly worktree?: { directory: string; mcp: McpStates } } + // Ends the attempt without touching the tabs, which are being removed. | { readonly type: "attempt.abort"; readonly attempt: number } export type NewSessionStartTransition = { @@ -81,6 +113,12 @@ export type NewSessionStartTransition = { readonly effects: readonly NewSessionStartEffect[] } +const TITLES = { + worktree: "prompt.toast.worktreeCreateFailed.title", + mcp: "session.summary.mcp.prepareFailed", + session: "prompt.toast.sessionCreateFailed.title", +} satisfies Record + export function createNewSessionStartState(): NewSessionStartState { return { type: "idle", attempt: 0 } } @@ -92,11 +130,21 @@ export function transitionNewSessionStart( if (state.type === "disposed") return unchanged(state) if (event.type === "dispose") - return changed({ type: "disposed" }, active(state) ? [{ type: "attempt.abort", attempt: state.attempt }] : []) + return changed( + { type: "disposed" }, + isNewSessionStartActive(state) ? [{ type: "attempt.abort", attempt: state.attempt }] : [], + ) if (event.type === "start") return start(state, event) - if (!active(state) || event.attempt !== state.attempt) return unchanged(state) + if (!isNewSessionStartActive(state) || event.attempt !== state.attempt) return unchanged(state) + + // A phase's timer only ends that phase; a later phase of the same attempt has its own. + if (event.type === "timed-out") { + if (event.phase !== state.type) return unchanged(state) + + return rollback(state, { type: "toast.timed-out", attempt: state.attempt, title: TITLES[state.type] }) + } if (state.type === "worktree" && event.type === "worktree.created") { return prepare( @@ -105,13 +153,12 @@ export function transitionNewSessionStart( ) } - if (state.type === "worktree" && event.type === "worktree.failed") - return rollback(state, { title: "prompt.toast.worktreeCreateFailed.title", message: event.message }) + if (state.type === "worktree" && event.type === "worktree.failed") return rollback(state, toast(state, event.message)) if (state.type === "mcp" && event.type === "mcp.prepared") return create(state) - // MCP preparation shows its own error. - if (state.type === "mcp" && event.type === "mcp.failed") return rollback(state) + if (state.type === "mcp" && event.type === "mcp.failed") + return rollback(state, event.message === undefined ? undefined : toast(state, event.message)) if (state.type === "session" && event.type === "session.created") { return changed({ type: "started", attempt: state.attempt }, [ @@ -119,8 +166,7 @@ export function transitionNewSessionStart( ]) } - if (state.type === "session" && event.type === "session.failed") - return rollback(state, { title: "prompt.toast.sessionCreateFailed.title", message: event.message }) + if (state.type === "session" && event.type === "session.failed") return rollback(state, toast(state, event.message)) return unchanged(state) } @@ -138,6 +184,11 @@ export function viewNewSessionStart(state: NewSessionStartState): NewSessionStar } } +/** Whether an attempt is running and its effects still apply. */ +export function isNewSessionStartActive(state: NewSessionStartState): state is ActiveState { + return state.type === "worktree" || state.type === "mcp" || state.type === "session" +} + function start( state: NewSessionStartState, event: Extract, @@ -152,6 +203,7 @@ function start( attempt, projectDirectory: event.workspace.projectDirectory, branch: event.workspace.branch, + timeoutMs: NEW_SESSION_WORKTREE_TIMEOUT_MS, }, ]) } @@ -169,35 +221,42 @@ function prepare(target: Target, toggling: boolean): NewSessionStartTransition { if (!toggling && Object.keys(target.mcp).length === 0) return create(target) return changed({ ...target, type: "mcp" }, [ - { type: "mcp.prepare", attempt: target.attempt, directory: target.directory, mcp: target.mcp }, + { + type: "mcp.prepare", + attempt: target.attempt, + directory: target.directory, + mcp: target.mcp, + timeoutMs: NEW_SESSION_MCP_TIMEOUT_MS, + }, ]) } function create(target: Target): NewSessionStartTransition { return changed({ ...target, type: "session" }, [ - { type: "session.create", attempt: target.attempt, sessionID: target.sessionID, directory: target.directory }, + { + type: "session.create", + attempt: target.attempt, + sessionID: target.sessionID, + directory: target.directory, + timeoutMs: NEW_SESSION_CREATE_TIMEOUT_MS, + }, ]) } -function rollback( - state: ActiveState, - toast?: Omit, "type" | "attempt">, -): NewSessionStartTransition { +function toast(state: ActiveState, message: string): NewSessionStartEffect { + return { type: "toast", attempt: state.attempt, title: TITLES[state.type], message } +} + +function rollback(state: ActiveState, toast?: NewSessionStartEffect): NewSessionStartTransition { const worktree = state.type !== "worktree" && state.created ? { directory: state.directory, mcp: state.mcp } : undefined return changed({ type: "idle", attempt: state.attempt }, [ - ...(toast ? [{ type: "toast" as const, attempt: state.attempt, ...toast }] : []), + ...(toast ? [toast] : []), { type: "tab.rollback", attempt: state.attempt, worktree }, ]) } -type ActiveState = Extract - -function active(state: NewSessionStartState): state is ActiveState { - return state.type === "worktree" || state.type === "mcp" || state.type === "session" -} - function changed( state: NewSessionStartState, effects: readonly NewSessionStartEffect[] = [], diff --git a/packages/app/src/new-session/mcp.ts b/packages/app/src/new-session/mcp.ts index 7298113b84..c4c142ebf7 100644 --- a/packages/app/src/new-session/mcp.ts +++ b/packages/app/src/new-session/mcp.ts @@ -69,18 +69,22 @@ export function createDraftMcpControls(input: { draftID: string; worktree: () => }, } - const apply = async (directory: string, states: Readonly>) => { + // Resolves whether the directory's servers match `states`, and rejects with the reason when one cannot. Once `signal` + // aborts it starts no further toggles; toggles already running belong to the shared controller and finish there. + const prepare = async (directory: string, states: Readonly>, signal: AbortSignal) => { const settled = pool.peek(directory)?.settle() if (settled && !(await settled)) return false const entries = Object.entries(states) if (entries.length === 0) return true - const catalog = await sdk.api.mcp.list({ location: { directory } }) + const catalog = await sdk.api.mcp.list({ location: { directory } }, { signal }) const missing = entries.find(([name, enabled]) => enabled && !catalog.data.some((server) => server.name === name)) if (missing) throw new Error(language.t("session.summary.mcp.unavailable", { name: missing[0] })) + if (signal.aborted) return false + const results = await Promise.all( entries.flatMap(([name, enabled]) => { const status = catalog.data.find((server) => server.name === name)?.status.status @@ -92,7 +96,7 @@ export function createDraftMcpControls(input: { draftID: string; worktree: () => ) if (results.some((success) => !success)) return false - const current = await sdk.api.mcp.list({ location: { directory } }) + const current = await sdk.api.mcp.list({ location: { directory } }, { signal }) const unresolved = entries.find(([name, enabled]) => { const status = current.data.find((server) => server.name === name)?.status.status @@ -121,17 +125,7 @@ export function createDraftMcpControls(input: { draftID: string; worktree: () => remember(directory: string, states: Readonly>) { tabs.updateDraft(input.draftID, { mcp: { target: key(directory), states: { ...states } } }) }, - prepare(directory: string, states: Readonly>) { - return apply(directory, states).catch((error) => { - showToast({ - variant: "error", - title: language.t("session.summary.mcp.prepareFailed"), - description: error instanceof Error ? error.message : String(error), - }) - - return false - }) - }, + prepare, } } diff --git a/packages/app/src/new-session/screen.tsx b/packages/app/src/new-session/screen.tsx index 96ba967ade..9e50542095 100644 --- a/packages/app/src/new-session/screen.tsx +++ b/packages/app/src/new-session/screen.tsx @@ -44,6 +44,7 @@ export default function NewSessionPage(props: { draftId: string }) { const composer = createNewSessionComposerAdapter({ draftID: props.draftId, worktree: workspace.selection.value, + root: workspace.project.root, branch: workspace.bar.branch, submitted: workspace.selection.remember, mcp, diff --git a/packages/app/src/new-session/view.tsx b/packages/app/src/new-session/view.tsx index 8bb849109f..f4b4922025 100644 --- a/packages/app/src/new-session/view.tsx +++ b/packages/app/src/new-session/view.tsx @@ -4,7 +4,7 @@ import { Icon } from "@opencode/ui/icon" import { Slash } from "@opencode/ui/slash" import { Keybind } from "@opencode/ui/keybind" import { useCommand } from "@/shell/commands/command" -import { Show, createMemo, createSignal, untrack, type JSX } from "solid-js" +import { Match, Show, Switch, createComputed, createMemo, createSignal, onCleanup, untrack, type JSX } from "solid-js" import { createStore } from "solid-js/store" import { createResizeObserver } from "@solid-primitives/resize-observer" import { getFilename } from "@opencode/util/path" @@ -34,6 +34,13 @@ import { Persist, persisted } from "@/runtime/persistence/storage" import { Persistence } from "@/runtime/persistence/schema" import { useSettings } from "@/settings/model" import type { NewSessionWorkspaceController } from "./workspace/controller" +import { + CHECKOUT_PLACEHOLDER_DELAY_MS, + INITIAL_CHECKOUT_LABEL_STATE, + selectCheckoutSkeleton, + transitionCheckoutLabel, + type CheckoutLabelEvent, +} from "./workspace/checkout-machine" import { NewSessionBranch } from "./workspace/selector" import { NewSessionBrickBreaker } from "./brick-breaker" import { NewSessionPinBoard } from "./pin-board" @@ -117,17 +124,29 @@ export function NewSessionView(props: {
- {(project) => ( - } - onboarding={onboardingReady() && !onboarding.used && props.workspace.bar.visible()} - onClick={() => location()} - onWorktree={project().id && project().vcs === "git" ? () => location(project()) : undefined} - /> - )} + {(project) => { + const workspace = () => (props.workspace.bar.visible() ? props.workspace.selection.value() : "main") + + const worktrees = () => + project().id && project().vcs === "git" ? () => location(project()) : undefined + + return ( + + ) + } + onboarding={onboardingReady() && !onboarding.used && props.workspace.bar.visible()} + onClick={() => location()} + onWorktree={worktrees()} + /> + ) + }}
@@ -280,6 +299,8 @@ function NewSessionLocation(props: { /** "main", "create", or a worktree directory. */ workspace: string root: string + /** Missing while the main checkout's Git info loads. */ + checkout?: { branch?: string } branch?: JSX.Element onboarding: boolean onClick: () => void @@ -301,6 +322,38 @@ function NewSessionLocation(props: { }, ]) + const [checkoutLabel, setCheckoutLabel] = createSignal(INITIAL_CHECKOUT_LABEL_STATE) + + const timers = new Map>() + + const dispatchCheckout = (event: CheckoutLabelEvent) => + untrack(() => { + const next = transitionCheckoutLabel(checkoutLabel(), event) + setCheckoutLabel(next.state) + next.effects.forEach((effect) => { + if (effect.type === "delay.stop") { + clearTimeout(timers.get(effect.attempt)) + timers.delete(effect.attempt) + + return + } + + timers.set( + effect.attempt, + setTimeout( + () => dispatchCheckout({ type: "delay.elapsed", attempt: effect.attempt }), + CHECKOUT_PLACEHOLDER_DELAY_MS, + ), + ) + }) + }) + + createComputed(() => + dispatchCheckout({ type: "checkout.changed", directory: props.root, loaded: props.checkout !== undefined }), + ) + + onCleanup(() => dispatchCheckout({ type: "disposed" })) + const worktree = () => { if (props.workspace === "main") return @@ -389,18 +442,28 @@ function NewSessionLocation(props: { type="button" data-action="prompt-worktree" aria-haspopup="dialog" + aria-label={worktree() ?? props.checkout?.branch ?? language.t("session.location.worktree")} + aria-busy={selectCheckoutSkeleton(checkoutLabel())} aria-description={language.t("session.location.worktree")} class={`${TRIGGER} min-w-0`} onClick={onWorktree()} > - - {worktree() ?? language.t("session.new.workspace.triggerLocal")} - + + + {(label) => {label()}} + + + + ( + (step, event) => transitionCheckoutLabel(step.state, event), + { state, effects: [] }, + ) +} + +const changed = (directory: string, loaded: boolean): CheckoutLabelEvent => ({ + type: "checkout.changed", + directory, + loaded, +}) + +const elapsed = (attempt: number): CheckoutLabelEvent => ({ type: "delay.elapsed", attempt }) + +describe("checkout label machine", () => { + test("a checkout that loads before the delay never shows the placeholder", () => { + const waiting = replay([changed("/repo", false)]) + + expect(waiting.effects).toEqual([{ type: "delay.start", attempt: 1 }]) + + const loaded = replay([changed("/repo", true)], waiting.state) + + expect(loaded.effects).toEqual([{ type: "delay.stop", attempt: 1 }]) + expect(selectCheckoutSkeleton(replay([elapsed(1)], loaded.state).state)).toBe(false) + }) + + test("a slow checkout shows the placeholder until it loads", () => { + const skeleton = replay([changed("/repo", false), elapsed(1)]) + + expect(selectCheckoutSkeleton(skeleton.state)).toBe(true) + + const loaded = replay([changed("/repo", true)], skeleton.state) + + expect(selectCheckoutSkeleton(loaded.state)).toBe(false) + expect(loaded.effects).toEqual([]) + }) + + test("another checkout restarts the delay and ignores the previous one's timer", () => { + const switched = replay([changed("/repo", false), changed("/other", false)]) + + expect(switched.effects).toEqual([ + { type: "delay.stop", attempt: 1 }, + { type: "delay.start", attempt: 2 }, + ]) + expect(replay([elapsed(1)], switched.state).state).toBe(switched.state) + expect(selectCheckoutSkeleton(replay([elapsed(2)], switched.state).state)).toBe(true) + }) + + test("the same pending checkout keeps its delay", () => { + const waiting = replay([changed("/repo", false)]) + + expect(transitionCheckoutLabel(waiting.state, changed("/repo", false)).state).toBe(waiting.state) + }) + + test("disposing stops a pending delay and ignores later events", () => { + const disposed = replay([changed("/repo", false), { type: "disposed" }]) + + expect(disposed.effects).toEqual([{ type: "delay.stop", attempt: 1 }]) + expect(transitionCheckoutLabel(disposed.state, elapsed(1)).state).toBe(disposed.state) + expect(transitionCheckoutLabel(disposed.state, changed("/repo", false)).state).toBe(disposed.state) + }) +}) diff --git a/packages/app/src/new-session/workspace/checkout-machine.ts b/packages/app/src/new-session/workspace/checkout-machine.ts new file mode 100644 index 0000000000..6a66a997e3 --- /dev/null +++ b/packages/app/src/new-session/workspace/checkout-machine.ts @@ -0,0 +1,69 @@ +/** A branch that has not loaded by then shows a placeholder; faster loads paint the name directly. */ +export const CHECKOUT_PLACEHOLDER_DELAY_MS = 250 + +/** + * The main checkout's branch label in the worktree trigger. While the checkout's Git info is missing it `waiting`s, + * then shows a placeholder (`skeleton`) once the delay passes. `loaded` covers both a branch and a checkout without + * one (detached HEAD, no commits), which shows the icon alone. + */ +export type CheckoutLabelState = + | { readonly status: "loaded"; readonly attempt: number } + | { readonly status: "waiting"; readonly directory: string; readonly attempt: number } + | { readonly status: "skeleton"; readonly directory: string; readonly attempt: number } + | { readonly status: "disposed" } + +export type CheckoutLabelEvent = + | { readonly type: "checkout.changed"; readonly directory: string; readonly loaded: boolean } + | { readonly type: "delay.elapsed"; readonly attempt: number } + | { readonly type: "disposed" } + +export type CheckoutLabelEffect = + | { readonly type: "delay.start"; readonly attempt: number } + | { readonly type: "delay.stop"; readonly attempt: number } + +export type CheckoutLabelTransition = { + readonly state: CheckoutLabelState + readonly effects: readonly CheckoutLabelEffect[] +} + +export const INITIAL_CHECKOUT_LABEL_STATE: CheckoutLabelState = Object.freeze({ status: "loaded", attempt: 0 }) + +const NONE: readonly CheckoutLabelEffect[] = Object.freeze([]) + +export function transitionCheckoutLabel(state: CheckoutLabelState, event: CheckoutLabelEvent): CheckoutLabelTransition { + if (state.status === "disposed") return unchanged(state) + + if (event.type === "disposed") return { state: { status: "disposed" }, effects: stop(state) } + + if (event.type === "delay.elapsed") { + if (state.status !== "waiting" || state.attempt !== event.attempt) return unchanged(state) + + return { state: { status: "skeleton", directory: state.directory, attempt: state.attempt }, effects: NONE } + } + + if (event.loaded) { + if (state.status === "loaded") return unchanged(state) + + return { state: { status: "loaded", attempt: state.attempt }, effects: stop(state) } + } + + if (state.status !== "loaded" && state.directory === event.directory) return unchanged(state) + const attempt = state.attempt + 1 + + return { + state: { status: "waiting", directory: event.directory, attempt }, + effects: [...stop(state), { type: "delay.start", attempt }], + } +} + +export function selectCheckoutSkeleton(state: CheckoutLabelState) { + return state.status === "skeleton" +} + +function stop(state: CheckoutLabelState): readonly CheckoutLabelEffect[] { + return state.status === "waiting" ? [{ type: "delay.stop", attempt: state.attempt }] : NONE +} + +function unchanged(state: CheckoutLabelState): CheckoutLabelTransition { + return { state, effects: NONE } +} diff --git a/packages/app/src/new-session/workspace/controller.test.ts b/packages/app/src/new-session/workspace/controller.test.ts index c4e0feaa49..0e29cf7144 100644 --- a/packages/app/src/new-session/workspace/controller.test.ts +++ b/packages/app/src/new-session/workspace/controller.test.ts @@ -38,19 +38,24 @@ describe("new session workspace selection", () => { expect(resolveNewSessionWorktree(input)).toBe(expected) }) - const branch = (worktree: string) => (worktree === "/project/feature" ? "feature" : undefined) + const branches = new Map([ + ["/project", "dev"], + ["/project/feature", "feature"], + ]) + + const branch = (worktree: string) => branches.get(worktree) test.each([ - { worktree: "main", directory: "/project/feature", createBranch: undefined, expected: "feature" }, - { worktree: "create", directory: "/project/feature", createBranch: undefined, expected: "feature" }, - { worktree: "/project/feature", directory: "/project", createBranch: undefined, expected: "feature" }, - { worktree: "/missing", directory: "/project/feature", createBranch: undefined, expected: undefined }, - { worktree: "create", directory: "/project/feature", createBranch: "release", expected: "release" }, - ])("resolves the branch for $worktree in $directory (new branch: $createBranch)", (row) => { + { worktree: "main", root: "/project", createBranch: undefined, expected: "dev" }, + { worktree: "create", root: "/project", createBranch: undefined, expected: "dev" }, + { worktree: "/project/feature", root: "/project", createBranch: undefined, expected: "feature" }, + { worktree: "/missing", root: "/project", createBranch: undefined, expected: undefined }, + { worktree: "create", root: "/project", createBranch: "release", expected: "release" }, + ])("resolves the branch for $worktree from $root (new branch: $createBranch)", (row) => { expect( resolveNewSessionBranch({ worktree: row.worktree, - directory: row.directory, + root: row.root, createBranch: row.createBranch, worktreeBranch: branch, }), diff --git a/packages/app/src/new-session/workspace/controller.ts b/packages/app/src/new-session/workspace/controller.ts index aec0789772..395a20dfd4 100644 --- a/packages/app/src/new-session/workspace/controller.ts +++ b/packages/app/src/new-session/workspace/controller.ts @@ -26,12 +26,12 @@ export function resolveNewSessionWorktree(input: { enabled: boolean; selected?: export function resolveNewSessionBranch(input: { worktree: string - directory: string + root: string createBranch?: string worktreeBranch: (worktree: string) => string | undefined }) { if (input.worktree === "create" && input.createBranch) return input.createBranch - const directory = input.worktree === "main" || input.worktree === "create" ? input.directory : input.worktree + const directory = input.worktree === "main" || input.worktree === "create" ? input.root : input.worktree return input.worktreeBranch(directory) } @@ -167,8 +167,13 @@ export function createNewSessionWorkspaceController(input: { }), ) - const projectRoot = createMemo(() => currentProject()?.worktree ?? sdk().directory) - const branchDirectory = () => (value() === "create" ? projectRoot() : sdk().directory) + // A draft opened from a worktree session keeps that worktree as its directory; Local still runs in the main checkout. + const projectRoot = createMemo( + () => + data.location.info({ directory: sdk().directory })?.project.canonical ?? + currentProject()?.worktree ?? + sdk().directory, + ) createEffect(() => { void Promise.all([ @@ -178,7 +183,7 @@ export function createNewSessionWorkspaceController(input: { ]).catch(() => undefined) }) createEffect(() => { - if (value() !== "create" || sameDirectory(projectRoot(), sdk().directory)) return + if ((value() !== "main" && value() !== "create") || sameDirectory(projectRoot(), sdk().directory)) return void data.location.vcs.sync({ directory: projectRoot() }).catch(() => undefined) }) // Only the selected worktree feeds the branch label. Syncing every worktree in the inventory boots @@ -197,12 +202,19 @@ export function createNewSessionWorkspaceController(input: { const branch = createMemo(() => resolveNewSessionBranch({ worktree: value(), - directory: branchDirectory(), + root: projectRoot(), createBranch: input.selectedBranch(), worktreeBranch: (worktree) => data.location.vcs.info({ directory: worktree })?.branch.current, }), ) + // Missing until the main checkout's Git info loads; a detached HEAD loads without a branch. + const checkout = createMemo(() => { + const info = data.location.vcs.info({ directory: projectRoot() }) + + return info ? { branch: info.branch.current } : undefined + }) + const remember = (worktree = value()) => { const project = currentProject() @@ -264,6 +276,7 @@ export function createNewSessionWorkspaceController(input: { bar: { visible, branch, + checkout, }, branches: (search: string, signal?: AbortSignal) => serverSDK.api.vcs.branch diff --git a/packages/app/src/providers/catalog/providers.ts b/packages/app/src/providers/catalog/providers.ts index 45033d6ffa..ae4000b647 100644 --- a/packages/app/src/providers/catalog/providers.ts +++ b/packages/app/src/providers/catalog/providers.ts @@ -1,8 +1,6 @@ import { useData } from "@/runtime/server/current" import { useServerSDK } from "@/runtime/server/client" import { normalizeProviderList } from "@/runtime/server/global-sync/utils" -import { isServiceUnavailableError } from "@opencode/client/promise" -import { retry } from "@opencode/util/retry" import { Iterable, pipe } from "effect" import { createEffect, createMemo, type Accessor } from "solid-js" import type { ProviderListResponse } from "@/runtime/server/types" @@ -15,10 +13,6 @@ const emptyProviderCatalog: ProviderListResponse = { all: new Map(), connected: const popularProviderSet = new Set(popularProviders) -// A cold Location lists its catalogs once its plugins activate, which can take longer than the server's 5 s wait. -export const syncWhileBooting = (load: () => Promise) => - retry(load, { attempts: 12, delay: 1000, maxDelay: 5000, retryIf: isServiceUnavailableError }) - export function useProviders(directory: Accessor) { const data = useData() const sdk = useServerSDK() @@ -35,9 +29,7 @@ export function useProviders(directory: Accessor) { void (async () => { if (!ref) await data.location.syncInfo() const resolved = ref ?? data.location.default() - await syncWhileBooting(() => - Promise.all([data.location.provider.sync(resolved), data.location.model.sync(resolved)]), - ) + await Promise.all([data.location.provider.sync(resolved), data.location.model.sync(resolved)]) })().catch(() => undefined) }) const integrations = useIntegrations(directory) diff --git a/packages/app/src/providers/connect/controller.ts b/packages/app/src/providers/connect/controller.ts index c2636311b3..4fe7ea1fbc 100644 --- a/packages/app/src/providers/connect/controller.ts +++ b/packages/app/src/providers/connect/controller.ts @@ -249,7 +249,10 @@ export function createProviderDialogController(options: { variant: "success", icon: "circle-check", title: language.t("provider.connect.toast.connected.title", { provider: name }), - description: language.t("provider.connect.toast.connected.description", { provider: name }), + description: + connectionModels().length > 0 + ? language.t("provider.connect.toast.connected.description", { provider: name }) + : undefined, }) return @@ -317,6 +320,27 @@ export function createProviderDialogController(options: { return } + // Desktop opens the browser over IPC, which can hang; a launch that does not answer in time counts as failed, so + // the form shows the link to open by hand. + if (effect.type === "form.open.browser") { + const timeout = Promise.withResolvers() + const timer = setTimeout(() => timeout.resolve(false), effect.timeoutMs) + void Promise.race([ + Promise.try(() => { + if (platform.openBrowser) return platform.openBrowser(effect.url) + platform.openExternal(effect.url) + + return true + }).catch(() => false), + timeout.promise, + ]).then((opened) => { + clearTimeout(timer) + result({ type: "form.browser.opened", attempt: effect.attempt, browser: effect.browser, opened }) + }) + + return + } + if (effect.type === "poll") { clearTimeout(pollTimer) pollTimer = undefined diff --git a/packages/app/src/providers/connect/dialog.tsx b/packages/app/src/providers/connect/dialog.tsx index 2787a078d3..5e07a913da 100644 --- a/packages/app/src/providers/connect/dialog.tsx +++ b/packages/app/src/providers/connect/dialog.tsx @@ -23,10 +23,11 @@ import { SettingsList } from "@/settings/list" import { Persist, persisted } from "@/runtime/persistence/storage" import { Persistence } from "@/runtime/persistence/schema" import { Schema } from "effect" -import type { FormAnswer, FormField, FormValue, IntegrationInfo } from "@opencode/client/promise" +import type { FormField, IntegrationInfo } from "@opencode/client/promise" import { createProviderDialogController, modelKey } from "./controller" import { CONSOLE_INTEGRATION, type ProviderDialogBody, type ProviderDialogFrame } from "./dialog-machine" -import { connectMethods, providerFormDefaults, selectProviderConnectView, type ProviderConnectMethod } from "./machine" +import { connectMethods, selectProviderConnectView, type ProviderConnectMethod } from "./machine" +import type { ProviderFormInput, ProviderFormView } from "./form-machine" import { ConsoleAuthorization } from "./console" import { DialogChatGPTPlanWelcome } from "./chatgpt-welcome" import { authServerName, RemoteAuthNotice } from "./remote" @@ -451,334 +452,212 @@ function ProviderSteps(props: { provider: string; controller: ProviderDialogCont // Asks one visible field at a time, like the TUI, so `when` conditions see every earlier answer. function AuthFormView() { - const method = connect().method - const fields = method && method.type !== "command" ? (method.form ?? []) : [] - const hidden = providerFormDefaults(fields) - - const [formStore, setFormStore] = createStore<{ - answer: FormAnswer - index: number - text: string - choice?: string - customOn: boolean - customText: string - picked: string[] - opened: boolean - error?: string - }>({ answer: {}, index: -1, text: "", customOn: false, customText: "", picked: [], opened: false }) - - const active = (field: FormField, answer: FormAnswer) => { - if (field.type === "external" || !field.when) return true - - return field.when.every((condition) => { - const value = answer[condition.key] - - if (value === undefined) return false - const hit = Array.isArray(value) ? value.includes(String(condition.value)) : value === condition.value - - return condition.op === "eq" ? hit : !hit - }) - } - - const asked = (field: FormField) => field.type === "external" || !field.hidden - - const field = createMemo(() => (formStore.index < 0 ? undefined : fields[formStore.index])) - - const external = () => { - const current = field() - - return current?.type === "external" ? current : undefined - } - - const multiselect = () => { - const current = field() - - return current?.type === "multiselect" ? current : undefined - } - - const text = () => { - const current = field() - - return current?.type === "string" ? current : undefined - } - - const required = () => { - const current = field() + const form = () => connect().form + const send = (event: ProviderFormInput) => props.controller.input({ type: "form", event }) - return current?.type !== "external" && !!current?.required - } - - // Prefills the next field from its default; the value only enters the answer once confirmed. - function advance(answer: FormAnswer) { - const merged = { ...hidden, ...answer } - const index = fields.findIndex((item, i) => i > formStore.index && asked(item) && active(item, merged)) - - if (index === -1) { - props.controller.input({ type: "form.submitted", answer }) - - return - } - - const next = fields[index] - setFormStore({ - answer, - index, - text: "", - choice: undefined, - customOn: false, - customText: "", - picked: next.type === "multiselect" ? [...(next.default ?? [])] : [], - opened: false, - error: undefined, - }) - - if (next.type === "boolean" && next.default !== undefined) setFormStore("choice", String(next.default)) + const external = createMemo(() => { + const current = form() - if ((next.type === "number" || next.type === "integer") && next.default !== undefined) - setFormStore("text", String(next.default)) - - if (next.type !== "string" || next.default === undefined) return - - if (!next.options) return setFormStore("text", next.default) + return current?.kind === "external" ? current : undefined + }) - if (next.options.some((option) => option.value === next.default)) return setFormStore("choice", next.default) + const multiselect = createMemo(() => { + const current = form() - if (next.custom) setFormStore({ customOn: true, customText: next.default }) - } + return current?.kind === "multiselect" ? current : undefined + }) - onMount(() => advance({})) + const choice = createMemo(() => { + const current = form() - const confirm = (value: FormValue | undefined) => { - const current = field() + return current?.kind === "choice" ? current : undefined + }) - if (!current) return + const text = createMemo(() => { + const current = form() - if (value === undefined && required()) { - setFormStore("error", language.t("provider.connect.form.required")) + return current?.kind === "text" ? current : undefined + }) - return - } + const error = () => { + const current = form() + const value = current?.kind === "choice" || current?.kind === "text" ? current.error : undefined - const answer = { ...formStore.answer } + if (value === "required") return language.t("provider.connect.form.required") - if (value !== undefined) answer[current.key] = value - advance(answer) + if (value === "number") return language.t("provider.connect.form.number") } - const submitText = (event: SubmitEvent) => { - event.preventDefault() - const current = field() - - if (!current || current.type === "external") return - const text = formStore.text.trim() - - if (!text) return confirm(undefined) + const issue = (value: Extract) => { + if (value.issue === "select-one") return language.t("provider.connect.form.selectOne") - if (current.type === "number" || current.type === "integer") { - const value = Number(text) - - if (!Number.isFinite(value) || (current.type === "integer" && !Number.isInteger(value))) { - setFormStore("error", language.t("provider.connect.form.number")) - - return - } + if (value.issue === "min-items") + return language.t("provider.connect.form.minItems", { count: value.field.minItems ?? 0 }) - return confirm(value) - } - - confirm(text) + if (value.issue === "max-items") + return language.t("provider.connect.form.maxItems", { count: value.field.maxItems ?? 0 }) } - const optionRows = (current: FormField) => { - if (current.type === "boolean") { + const optionRows = (field: Extract) => { + if (field.type === "boolean") { const rows = [ { value: "true", label: language.t("provider.connect.form.yes"), description: undefined }, { value: "false", label: language.t("provider.connect.form.no"), description: undefined }, ] - return current.default === false ? rows.toReversed() : rows + return field.default === false ? rows.toReversed() : rows } - if (current.type === "string" || current.type === "multiselect") - return (current.options ?? []).map((option) => ({ - value: option.value, - label: option.label, - description: option.description, - })) - - return [] - } - - const choose = () => { - const current = field() - - if (!current) return - - if (current.type === "boolean") - return confirm(formStore.choice === undefined ? undefined : formStore.choice === "true") - - if (formStore.customOn) return confirm(formStore.customText.trim() || undefined) - confirm(formStore.choice) - } - - const multiselectError = () => { - const current = field() - - if (current?.type !== "multiselect") return - const count = formStore.picked.length - - if (current.required && count === 0) return language.t("provider.connect.form.selectOne") - - if (current.minItems !== undefined && count < current.minItems) - return language.t("provider.connect.form.minItems", { count: current.minItems }) - - if (current.maxItems !== undefined && count > current.maxItems) - return language.t("provider.connect.form.maxItems", { count: current.maxItems }) - } - - const openLink = async (url: string) => { - const opened = await Promise.resolve() - .then(() => { - if (platform.openBrowser) return platform.openBrowser(url) - platform.openExternal(url) - - return true - }) - .catch(() => false) - - setFormStore("opened", (value) => value || opened) + return (field.options ?? []).map((option) => ({ + value: option.value, + label: option.label, + description: option.description, + })) } - const title = (current: FormField) => current.title ?? (current.type === "external" ? current.url : current.key) - return ( - - {(current) => ( -
-
-
- {title(current())} -
- - {(description) => ( -
- {description()} -
- )} -
+ // Keyed by step, so each step mounts fresh inputs that take focus. + +
+
+
+ {form()?.title}
- - - {(external) => ( + + {(description) => ( +
+ {description()} +
+ )} +
+
+ + + {(step) => ( + <>
- -
- )} -
- - {(multi) => { - const options = () => optionRows(multi()) - const custom = () => multi().custom - - return ( -
-
- !options().some((option) => option.value === item)) - .map((value) => ({ value, label: value, description: undefined })), - ]} - > - {(option) => ( - - setFormStore("picked", (picked) => - checked ? [...picked, option.value] : picked.filter((item) => item !== option.value), - ) - } - > - {option.label} - - )} - -
- -
{ - event.preventDefault() - const value = formStore.customText.trim() - - if (!value || formStore.picked.includes(value)) return - setFormStore({ picked: [...formStore.picked, value], customText: "" }) - }} - > - setFormStore("customText", event.currentTarget.value)} - /> - - -
- - {(error) =>
{error()}
} -
- + {(option) => ( + + send({ type: "option.toggled", value: option.value, checked }) + } + > + {option.label} + + )} +
- ) - }} -
- 0)} - > + +
{ + event.preventDefault() + send({ type: "custom.item.added" }) + }} + > + send({ type: "custom.text.changed", value: event.currentTarget.value })} + /> + + +
+ + {(message) =>
{message()}
} +
+ +
+ ) + }} + + + {(step) => (
{ - if (value === "custom") return setFormStore({ customOn: true, error: undefined }) - setFormStore({ customOn: false, choice: value, error: undefined }) - }} + value={step().selected} + onChange={(value) => send({ type: "choice.selected", value })} > - + {(option) => ( )} - + - +
queueMicrotask(() => input.focus())} type="text" label={language.t("ui.messagePart.option.typeOwnAnswer")} hideLabel - placeholder={text()?.placeholder ?? language.t("ui.question.custom.placeholder")} - value={formStore.customText} - onChange={(value) => setFormStore("customText", value)} + placeholder={step().placeholder ?? language.t("ui.question.custom.placeholder")} + value={step().customText} + onChange={(value) => send({ type: "custom.text.changed", value })} />
@@ -788,49 +667,57 @@ function ProviderSteps(props: { provider: string; controller: ProviderDialogCont - -
- - -
+ )} + + + {(step) => ( + { + event.preventDefault() + send({ type: "step.submitted" }) + }} + class="flex w-full flex-col items-start gap-4" + > queueMicrotask(() => input.focus({ preventScroll: true }))} class="!w-full" type="text" - inputMode={current().type === "string" ? undefined : "decimal"} - aria-label={title(current())} - placeholder={text()?.placeholder} - value={formStore.text} - invalid={formStore.error !== undefined} + inputMode={step().numeric ? "decimal" : undefined} + aria-label={step().title} + placeholder={step().placeholder} + value={step().text} + invalid={step().error !== undefined} autocomplete="off" spellcheck={false} - onInput={(event) => setFormStore({ text: event.currentTarget.value, error: undefined })} + onInput={(event) => send({ type: "text.changed", value: event.currentTarget.value })} /> -
- - - {(error) => ( - )} - -
- )} + + + + {(message) => ( + + )} + +
) } diff --git a/packages/app/src/providers/connect/form-machine.test.ts b/packages/app/src/providers/connect/form-machine.test.ts new file mode 100644 index 0000000000..738da5a152 --- /dev/null +++ b/packages/app/src/providers/connect/form-machine.test.ts @@ -0,0 +1,200 @@ +import { describe, expect, test } from "bun:test" +import type { FormField } from "@opencode/client/promise" +import { + createProviderFormState, + FORM_BROWSER_OPEN_TIMEOUT_MS, + selectProviderFormView, + transitionProviderForm, + type ProviderActiveForm, + type ProviderFormEvent, + type ProviderFormState, + type ProviderFormTransition, +} from "./form-machine" + +function active(state: ProviderFormState) { + if (state.status !== "active") throw new Error(`expected an active form, got ${state.status}`) + + return state +} + +function replay(fields: FormField[], events: ProviderFormEvent[]) { + return events.reduce((result, event) => transitionProviderForm(active(result.state), event), { + state: createProviderFormState(fields), + effects: [], + }) +} + +const view = (state: ProviderFormState) => selectProviderFormView(active(state)) + +const external = (key: string): FormField => ({ key, type: "external", url: `https://setup.example/${key}` }) + +describe("provider form machine", () => { + // The driver reports a launch that returns false, throws, or does not answer in time as not opened. + test("a browser that fails to open still lets the user finish with the link shown", () => { + const opening = replay([external("login")], [{ type: "external.open" }]) + + expect(opening.effects).toEqual([ + { type: "open.browser", attempt: 1, url: "https://setup.example/login", timeoutMs: FORM_BROWSER_OPEN_TIMEOUT_MS }, + ]) + expect(view(opening.state)).toMatchObject({ kind: "external", opening: true, canFinish: false }) + + const failed = transitionProviderForm(active(opening.state), { type: "external.opened", attempt: 1, opened: false }) + + expect(view(failed.state)).toMatchObject({ browserFailed: true, canFinish: true, opening: false }) + expect(transitionProviderForm(active(failed.state), { type: "step.submitted" }).state).toEqual({ + status: "completed", + answer: { login: true }, + }) + }) + + test("finishing is blocked until the first open answers, and stays open while reopening", () => { + const unopened = createProviderFormState([external("login")]) + + expect(transitionProviderForm(active(unopened), { type: "step.submitted" }).state).toBe(unopened) + + const opened = replay( + [external("login")], + [{ type: "external.open" }, { type: "external.opened", attempt: 1, opened: true }, { type: "external.open" }], + ) + + expect(view(opened.state)).toMatchObject({ opening: true, canFinish: true }) + expect(transitionProviderForm(active(opened.state), { type: "external.open" }).state).toBe(opened.state) + }) + + test("a late open from an earlier step does not mark the next step opened", () => { + const second = replay( + [external("first"), external("second")], + [ + { type: "external.open" }, + { type: "external.opened", attempt: 1, opened: false }, + { type: "external.open" }, + { type: "step.submitted" }, + ], + ) + + expect(view(second.state)).toMatchObject({ key: "1:second", canFinish: false }) + + const late = transitionProviderForm(active(second.state), { type: "external.opened", attempt: 2, opened: true }) + + expect(late.state).toBe(second.state) + + const opening = transitionProviderForm(active(second.state), { type: "external.open" }) + + expect( + transitionProviderForm(active(opening.state), { type: "external.opened", attempt: 2, opened: true }).state, + ).toBe(opening.state) + }) + + test("a hidden default whose condition depends on an earlier answer applies once that answer matches", () => { + const fields: FormField[] = [ + { + key: "region", + type: "string", + options: [ + { value: "eu", label: "EU" }, + { value: "us", label: "US" }, + ], + }, + { + key: "endpoint", + type: "string", + hidden: true, + default: "eu.example", + when: [{ key: "region", op: "eq", value: "eu" }], + }, + { key: "tenant", type: "string", when: [{ key: "endpoint", op: "eq", value: "eu.example" }] }, + ] + + const eu = replay(fields, [{ type: "choice.selected", value: "eu" }, { type: "step.submitted" }]) + + expect(view(eu.state)).toMatchObject({ kind: "text", key: "2:tenant" }) + expect(active(eu.state).answer).toEqual({ region: "eu", endpoint: "eu.example" }) + + const us = replay(fields, [{ type: "choice.selected", value: "us" }, { type: "step.submitted" }]) + + expect(us.state).toEqual({ status: "completed", answer: { region: "us" } }) + }) + + test("a form with nothing to ask answers itself with the hidden defaults", () => { + expect( + createProviderFormState([ + { key: "mode", type: "string", hidden: true, default: "fast" }, + { key: "extra", type: "string", when: [{ key: "mode", op: "eq", value: "slow" }] }, + ]), + ).toEqual({ status: "completed", answer: { mode: "fast" } }) + }) + + test("custom is only a choice on a string field that allows it, and its text survives a preset pick", () => { + const flag = createProviderFormState([{ key: "beta", type: "boolean" }]) + + expect(transitionProviderForm(active(flag), { type: "choice.selected", value: "custom" }).state).toBe(flag) + + const fields: FormField[] = [{ key: "model", type: "string", custom: true, options: [{ value: "a", label: "A" }] }] + + const typed = replay(fields, [ + { type: "choice.selected", value: "custom" }, + { type: "custom.text.changed", value: "my-model" }, + { type: "choice.selected", value: "a" }, + { type: "choice.selected", value: "custom" }, + ]) + + expect(view(typed.state)).toMatchObject({ selected: "custom", customText: "my-model", canContinue: true }) + expect(transitionProviderForm(active(typed.state), { type: "step.submitted" }).state).toEqual({ + status: "completed", + answer: { model: "my-model" }, + }) + }) + + test("text and number steps validate before they answer", () => { + const fields: FormField[] = [{ key: "port", type: "integer", required: true }] + const empty = replay(fields, [{ type: "step.submitted" }]) + + expect(view(empty.state)).toMatchObject({ error: "required" }) + + const fraction = replay(fields, [{ type: "text.changed", value: "1.5" }, { type: "step.submitted" }]) + + expect(view(fraction.state)).toMatchObject({ error: "number" }) + expect( + view(transitionProviderForm(active(fraction.state), { type: "text.changed", value: "8" }).state), + ).toMatchObject({ error: undefined }) + expect(replay(fields, [{ type: "text.changed", value: " 8080 " }, { type: "step.submitted" }]).state).toEqual({ + status: "completed", + answer: { port: 8080 }, + }) + }) + + test("a multiselect answers only within its limits", () => { + const fields: FormField[] = [ + { + key: "scopes", + type: "multiselect", + maxItems: 1, + custom: true, + options: [{ value: "read", label: "Read" }], + }, + ] + + const two = replay(fields, [ + { type: "option.toggled", value: "read", checked: true }, + { type: "custom.text.changed", value: "write" }, + { type: "custom.item.added" }, + ]) + + expect(view(two.state)).toMatchObject({ picked: ["read", "write"], issue: "max-items", canContinue: false }) + expect(transitionProviderForm(active(two.state), { type: "step.submitted" }).state).toBe(two.state) + + const one = transitionProviderForm(active(two.state), { type: "option.toggled", value: "read", checked: false }) + + expect(transitionProviderForm(active(one.state), { type: "step.submitted" }).state).toEqual({ + status: "completed", + answer: { scopes: ["write"] }, + }) + }) + + test("an inapplicable event returns the same state", () => { + const form: ProviderActiveForm = active(createProviderFormState([{ key: "name", type: "string" }])) + + expect(transitionProviderForm(form, { type: "external.open" }).state).toBe(form) + expect(transitionProviderForm(form, { type: "text.changed", value: "" }).state).toBe(form) + }) +}) diff --git a/packages/app/src/providers/connect/form-machine.ts b/packages/app/src/providers/connect/form-machine.ts new file mode 100644 index 0000000000..79b72e3216 --- /dev/null +++ b/packages/app/src/providers/connect/form-machine.ts @@ -0,0 +1,419 @@ +import type { FormAnswer, FormField, FormValue } from "@opencode/client/promise" + +/** How long opening the browser may take before the link is shown to open by hand; desktop IPC can hang. */ +export const FORM_BROWSER_OPEN_TIMEOUT_MS = 5_000 + +export type ProviderFormBrowser = + | { readonly status: "unopened" } + /** `unlocked` keeps "I finished" enabled while the link opens again after an earlier open. */ + | { readonly status: "opening"; readonly attempt: number; readonly unlocked: boolean } + | { readonly status: "opened" } + /** The browser did not open, so the link shows for the user to open by hand. */ + | { readonly status: "failed" } + +export type ProviderFormChoice = + | { readonly mode: "none"; readonly customDraft: string } + | { readonly mode: "preset"; readonly value: string; readonly customDraft: string } + | { readonly mode: "custom"; readonly text: string } + +/** The one field the form asks now; data that only one kind of field has lives in its variant. */ +export type ProviderFormStep = + | { + readonly kind: "external" + readonly index: number + readonly field: Extract + readonly browser: ProviderFormBrowser + } + | { + readonly kind: "multiselect" + readonly index: number + readonly field: Extract + readonly picked: readonly string[] + readonly customText: string + } + | { + readonly kind: "choice" + readonly index: number + readonly field: Extract + readonly choice: ProviderFormChoice + readonly error: "required" | undefined + } + | { + readonly kind: "text" + readonly index: number + readonly field: Extract + readonly text: string + readonly error: "required" | "number" | undefined + } + +/** + * A method's form, asked one visible field at a time like the TUI, so `when` conditions see every earlier answer. + * Browser opens take attempt numbers from `issued`, so a result for an earlier open or step is stale. + */ +export type ProviderFormState = + | { + readonly status: "active" + readonly fields: readonly FormField[] + readonly answer: FormAnswer + readonly issued: number + readonly step: ProviderFormStep + } + | { readonly status: "completed"; readonly answer: FormAnswer } + +export type ProviderActiveForm = Extract + +/** What the user does on the current step. */ +export type ProviderFormInput = + | { readonly type: "text.changed"; readonly value: string } + | { readonly type: "choice.selected"; readonly value: string } + | { readonly type: "custom.text.changed"; readonly value: string } + | { readonly type: "custom.item.added" } + | { readonly type: "option.toggled"; readonly value: string; readonly checked: boolean } + | { readonly type: "external.open" } + | { readonly type: "step.submitted" } + | { readonly type: "step.skipped" } + +export type ProviderFormEvent = + | ProviderFormInput + /** `opened` is false when the browser failed to open or did not answer in time. */ + | { readonly type: "external.opened"; readonly attempt: number; readonly opened: boolean } + +export type ProviderFormEffect = { + readonly type: "open.browser" + readonly attempt: number + readonly url: string + readonly timeoutMs: number +} + +export type ProviderFormTransition = { + readonly state: ProviderFormState + readonly effects: readonly ProviderFormEffect[] +} + +/** The form's first visible field, or its answer when every field is hidden or inactive. */ +export function createProviderFormState(fields: readonly FormField[] | undefined) { + return advance(fields ?? [], 0, {}, 0) +} + +export function transitionProviderForm(state: ProviderActiveForm, event: ProviderFormEvent): ProviderFormTransition { + const step = state.step + + if (step.kind === "external") return external(state, step, event) + + if (step.kind === "multiselect") { + if (event.type === "option.toggled") { + if (event.checked === step.picked.includes(event.value)) return unchanged(state) + + const picked = event.checked ? [...step.picked, event.value] : step.picked.filter((item) => item !== event.value) + + return unchanged({ ...state, step: { ...step, picked } }) + } + + if (event.type === "custom.text.changed") { + if (!step.field.custom || event.value === step.customText) return unchanged(state) + + return unchanged({ ...state, step: { ...step, customText: event.value } }) + } + + if (event.type === "custom.item.added") { + const value = step.customText.trim() + + if (!step.field.custom || !value || step.picked.includes(value)) return unchanged(state) + + return unchanged({ ...state, step: { ...step, picked: [...step.picked, value], customText: "" } }) + } + + if (event.type !== "step.submitted" || multiselectIssue(step) !== undefined) return unchanged(state) + + return next(state, step.picked.length ? [...step.picked] : undefined) + } + + if (step.kind === "choice") { + if (event.type === "choice.selected") { + const choice = select(step, event.value) + + return choice ? unchanged({ ...state, step: { ...step, choice, error: undefined } }) : unchanged(state) + } + + if (event.type === "custom.text.changed") { + if (step.choice.mode !== "custom" || event.value === step.choice.text) return unchanged(state) + + return unchanged({ ...state, step: { ...step, choice: { mode: "custom", text: event.value }, error: undefined } }) + } + + if (event.type === "step.skipped") return step.field.required ? unchanged(state) : next(state, undefined) + + if (event.type !== "step.submitted") return unchanged(state) + const value = choiceValue(step) + + if (value === undefined && step.field.required) return unchanged({ ...state, step: { ...step, error: "required" } }) + + return next(state, value) + } + + if (event.type === "text.changed") { + if (event.value === step.text && step.error === undefined) return unchanged(state) + + return unchanged({ ...state, step: { ...step, text: event.value, error: undefined } }) + } + + if (event.type !== "step.submitted") return unchanged(state) + const text = step.text.trim() + + if (!text) + return step.field.required ? unchanged({ ...state, step: { ...step, error: "required" } }) : next(state, undefined) + + if (step.field.type === "string") return next(state, text) + const value = Number(text) + + if (!Number.isFinite(value) || (step.field.type === "integer" && !Number.isInteger(value))) + return unchanged({ ...state, step: { ...step, error: "number" } }) + + return next(state, value) +} + +export function selectProviderFormView(state: ProviderActiveForm) { + const step = state.step + const field = step.field + + const base = { + // Changes with every step, so each step mounts fresh inputs; never empty, so step 0 is not falsy. + key: `${step.index}:${field.key}`, + title: field.title ?? (field.type === "external" ? field.url : field.key), + description: field.description, + } + + if (step.kind === "external") { + const browser = step.browser + + return { + ...base, + kind: step.kind, + url: step.field.url, + opening: browser.status === "opening", + browserFailed: browser.status === "failed", + // Also labels the link "Open link again". + canFinish: canFinish(browser), + } + } + + if (step.kind === "multiselect") { + const issue = multiselectIssue(step) + + return { + ...base, + kind: step.kind, + field: step.field, + picked: step.picked, + customText: step.customText, + issue, + canContinue: issue === undefined, + } + } + + if (step.kind === "choice") { + const choice = step.choice + + return { + ...base, + kind: step.kind, + field: step.field, + selected: selected(choice), + custom: step.field.type === "string" && !!step.field.custom, + placeholder: step.field.type === "string" ? step.field.placeholder : undefined, + customText: choice.mode === "custom" ? choice.text : "", + canContinue: choiceValue(step) !== undefined, + canSkip: !step.field.required, + error: step.error, + } + } + + return { + ...base, + kind: step.kind, + numeric: step.field.type !== "string", + placeholder: step.field.type === "string" ? step.field.placeholder : undefined, + text: step.text, + error: step.error, + } +} + +export type ProviderFormView = ReturnType + +// Whether a field applies given the answers so far; the TUI's rule. +function formFieldActive(field: FormField, answer: FormAnswer) { + if (field.type === "external" || !field.when) return true + + return field.when.every((condition) => { + const value = answer[condition.key] + + if (value === undefined) return false + const hit = Array.isArray(value) ? value.includes(String(condition.value)) : value === condition.value + + return condition.op === "eq" ? hit : !hit + }) +} + +function external( + state: ProviderActiveForm, + step: Extract, + event: ProviderFormEvent, +): ProviderFormTransition { + const browser = step.browser + + if (event.type === "external.open") { + if (browser.status === "opening") return unchanged(state) + const attempt = state.issued + 1 + + return { + state: { + ...state, + issued: attempt, + step: { + ...step, + browser: { + status: "opening", + attempt, + unlocked: browser.status === "opened" || browser.status === "failed", + }, + }, + }, + effects: [{ type: "open.browser", attempt, url: step.field.url, timeoutMs: FORM_BROWSER_OPEN_TIMEOUT_MS }], + } + } + + if (event.type === "external.opened") { + if (browser.status !== "opening" || browser.attempt !== event.attempt) return unchanged(state) + + return unchanged({ ...state, step: { ...step, browser: { status: event.opened ? "opened" : "failed" } } }) + } + + if (event.type !== "step.submitted" || !canFinish(browser)) return unchanged(state) + + return next(state, true) +} + +// A failed open still lets the user finish: they open the link by hand. +function canFinish(browser: ProviderFormBrowser) { + return browser.status !== "unopened" && (browser.status !== "opening" || browser.unlocked) +} + +// Records the step's answer and moves to the next visible field that applies. +function next(state: ProviderActiveForm, value: FormValue | undefined) { + const answer = value === undefined ? state.answer : { ...state.answer, [state.step.field.key]: value } + + return unchanged(advance(state.fields, state.step.index + 1, answer, state.issued)) +} + +// Hidden fields that apply take their default in order, so a later `when` sees them, as in the TUI. +function advance(fields: readonly FormField[], index: number, answer: FormAnswer, issued: number): ProviderFormState { + const field = fields.at(index) + + if (!field) return { status: "completed", answer } + + if (!formFieldActive(field, answer)) return advance(fields, index + 1, answer, issued) + + if (field.type !== "external" && field.hidden) + return advance( + fields, + index + 1, + field.default === undefined ? answer : { ...answer, [field.key]: field.default }, + issued, + ) + + return { status: "active", fields, answer, issued, step: initial(field, index) } +} + +// Prefills a step from its field's default; the value enters the answer only once the user confirms it. +function initial(field: FormField, index: number): ProviderFormStep { + if (field.type === "external") return { kind: "external", index, field, browser: { status: "unopened" } } + + if (field.type === "multiselect") + return { kind: "multiselect", index, field, picked: [...(field.default ?? [])], customText: "" } + + if (field.type === "boolean") + return { + kind: "choice", + index, + field, + choice: + field.default === undefined + ? { mode: "none", customDraft: "" } + : { mode: "preset", value: String(field.default), customDraft: "" }, + error: undefined, + } + + if (field.type === "string" && field.options?.length) { + const value = field.default + + const choice: ProviderFormChoice = + value === undefined + ? { mode: "none", customDraft: "" } + : field.options.some((option) => option.value === value) + ? { mode: "preset", value, customDraft: "" } + : field.custom + ? { mode: "custom", text: value } + : { mode: "none", customDraft: "" } + + return { kind: "choice", index, field, choice, error: undefined } + } + + return { + kind: "text", + index, + field, + text: field.default === undefined ? "" : String(field.default), + error: undefined, + } +} + +function select(step: Extract, value: string): ProviderFormChoice | undefined { + const choice = step.choice + + if (value === "custom") { + if (step.field.type !== "string" || !step.field.custom || choice.mode === "custom") return + + return { mode: "custom", text: choice.customDraft } + } + + const known = + step.field.type === "boolean" + ? value === "true" || value === "false" + : (step.field.options ?? []).some((option) => option.value === value) + + if (!known || (choice.mode === "preset" && choice.value === value)) return + + return { mode: "preset", value, customDraft: choice.mode === "custom" ? choice.text : choice.customDraft } +} + +// The radio value: a preset, "custom" while typing an own answer, or none. +function selected(choice: ProviderFormChoice) { + if (choice.mode === "preset") return choice.value + + if (choice.mode === "custom") return "custom" +} + +function choiceValue(step: Extract): FormValue | undefined { + const choice = step.choice + + if (choice.mode === "none") return + + if (choice.mode === "custom") return choice.text.trim() || undefined + + return step.field.type === "boolean" ? choice.value === "true" : choice.value +} + +function multiselectIssue(step: Extract) { + const count = step.picked.length + const field = step.field + + if (field.required && count === 0) return "select-one" as const + + if (field.minItems !== undefined && count < field.minItems) return "min-items" as const + + if (field.maxItems !== undefined && count > field.maxItems) return "max-items" as const +} + +function unchanged(state: ProviderFormState, effects: readonly ProviderFormEffect[] = []): ProviderFormTransition { + return { state, effects } +} diff --git a/packages/app/src/providers/connect/go-upsell-hero-art.test.ts b/packages/app/src/providers/connect/go-upsell-hero-art.test.ts index e40cfb4fb1..421dd80704 100644 --- a/packages/app/src/providers/connect/go-upsell-hero-art.test.ts +++ b/packages/app/src/providers/connect/go-upsell-hero-art.test.ts @@ -88,6 +88,49 @@ afterEach(() => { globalThis.requestAnimationFrame = original.requestAnimationFrame globalThis.cancelAnimationFrame = original.cancelAnimationFrame document.body.replaceChildren() + document.documentElement.removeAttribute("data-motion") + pageHidden(false) +}) + +function pageHidden(value: boolean) { + Object.defineProperty(document, "hidden", { value, configurable: true }) +} + +test("the app's Reduce Motion setting stops the loop and draws one still frame", async () => { + prefersReducedMotion(false) + const { canvas, count } = hero() + + const dispose = mountGoUpsellHero(canvas) + expect(frames.size).toBe(1) + expect(count.frames).toBe(0) + + document.documentElement.setAttribute("data-motion", "reduce") + // MutationObserver callbacks run as a microtask. + await Promise.resolve() + expect(frames.size).toBe(0) + expect(count.frames).toBe(1) + dispose() +}) + +test("a hidden page draws nothing when its size or theme changes", async () => { + prefersReducedMotion(true) + pageHidden(true) + const { canvas, count } = hero() + + const dispose = mountGoUpsellHero(canvas) + expect(count.frames).toBe(0) + + document.documentElement.setAttribute("data-theme", "other") + await Promise.resolve() + pixelRatio(2) + queries.find((query) => query.media === "(resolution: 1dppx)")!.dispatchEvent(new Event("change")) + expect(count.frames).toBe(0) + + pageHidden(false) + document.dispatchEvent(new Event("visibilitychange")) + expect(count.frames).toBe(1) + expect(canvas.width).toBe(960) + dispose() }) test("draws one still frame and runs no loop under reduced motion", () => { diff --git a/packages/app/src/providers/connect/go-upsell-hero-art.ts b/packages/app/src/providers/connect/go-upsell-hero-art.ts index a19c515dee..d5d28fa799 100644 --- a/packages/app/src/providers/connect/go-upsell-hero-art.ts +++ b/packages/app/src/providers/connect/go-upsell-hero-art.ts @@ -2,6 +2,8 @@ // warp's brake settles into a ring that the Ripple loop then continues. Every frame is a pure function of art // time `t` (ms since the dialog opened), so the reduced-motion still is just one chosen frame. +import { createHeroLoopState, selectHeroRedrawsStill, transitionHeroLoop } from "./go-upsell-hero-machine" + type RGB = readonly [number, number, number] type HeroPalette = { @@ -31,6 +33,9 @@ type Kind = 0 | 1 | 2 // G, O, shadow type LogoCell = { col: number; row: number; kind: Kind } +/** The palette colour each kind of cell starts from. */ +const TONES = ["logoG", "logoO", "shadow"] as const + const LOGO: LogoCell[] = GO.flatMap((line, uy) => Array.from(line).flatMap((ch, ux) => { if (ch === ".") return [] @@ -73,32 +78,33 @@ const envelope = (phase: number) => { return s * s * (3 - 2 * s) } -const mixRGB = (a: RGB, b: RGB, t: number): RGB => { - const k = clamp01(t) - - return [a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k, a[2] + (b[2] - a[2]) * k] -} +const rgba = (red: number, green: number, blue: number, a: number) => + `rgba(${red | 0},${green | 0},${blue | 0},${clamp01(a).toFixed(3)})` -const rgba = (c: RGB, a: number) => `rgba(${c[0] | 0},${c[1] | 0},${c[2] | 0},${clamp01(a).toFixed(3)})` - -// Colours repeat from frame to frame, so each CSS colour string is built once. +// Colours repeat from frame to frame, so each CSS colour string is built once. Channels are scalars, not arrays, +// because every cell of every frame asks for one. const styles = new Map() -function style(c: RGB, a: number) { +function style(red: number, green: number, blue: number, a: number) { const alpha = Math.round(clamp01(a) * 255) - const key = ((c[0] << 16) | (c[1] << 8) | c[2]) * 256 + alpha + const key = ((red << 16) | (green << 8) | blue) * 256 + alpha const cached = styles.get(key) if (cached) return cached if (styles.size > 4096) styles.clear() - const value = rgba(c, alpha / 255) + const value = rgba(red, green, blue, alpha / 255) styles.set(key, value) return value } +// The active rings of one frame: at most the brake ring and four loop rings. +const ringHead = new Float64Array(6) + +const ringAmp = new Float64Array(6) + // ── timeline (art ms) ───────────────────────────────────────────────────────── // 0–340 gather · 340–520 warp attack · cruise to 900 · brake (τ 260) · GO arrives 340–1000, lands ~720 // 560 the brake ring leaves GO, slows with the warp, then drifts at the loop's speed @@ -275,9 +281,10 @@ function renderBloom(g: Geometry, pal: HeroPalette) { const [x, y] = [g.cx * g.dpr, g.cy * g.dpr] const grad = ctx.createRadialGradient(x, y, 0, x, y, LOGO_COLS * g.P * 0.9 * g.dpr) - grad.addColorStop(0, rgba(pal.accent, 1)) - grad.addColorStop(0.45, rgba(pal.accent, 0.35)) - grad.addColorStop(1, rgba(pal.accent, 0)) + const accent = pal.accent + grad.addColorStop(0, rgba(accent[0], accent[1], accent[2], 1)) + grad.addColorStop(0.45, rgba(accent[0], accent[1], accent[2], 0.35)) + grad.addColorStop(1, rgba(accent[0], accent[1], accent[2], 0)) ctx.clearRect(0, 0, g.width, g.height) ctx.save() ctx.fillStyle = grad @@ -313,14 +320,18 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n const dim = 1 - smoothstep(300, ATTACK_END, t) * (1 - smoothstep(1300, 2300, t)) * 0.8 const breath = (0.5 + 0.5 * Math.sin(t * 0.0008)) * 0.05 * smoothstep(1800, 2600, t) - const rings: { head: number; amp: number }[] = [] + // Every frame runs this, so the active rings go into preallocated buffers rather than new objects. + let rings = 0 if (t > BRAKE_RING_START) { const phase = brakeRingPhase(t) // Strong on the brake, calming to a loop ring's strength, then fading out like one. const amp = lerp(1, 0.55, smoothstep(BRAKE, 1700, t)) * smoothstep(BRAKE_RING_START, BRAKE_RING_START + 120, t) - if (phase < 1) rings.push({ head: phase * R, amp: amp * (phase < 0.5 ? 1 : envelope(phase)) }) + if (phase < 1) { + ringHead[rings] = phase * R + ringAmp[rings++] = amp * (phase < 0.5 ? 1 : envelope(phase)) + } } if (t > LOOP_START) { @@ -329,7 +340,10 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n for (let n = Math.max(2, newest - 3); n <= newest; n++) { const phase = (t - RING_ORIGIN - n * SPACING) / PERIOD - if (phase >= 0 && phase < 1) rings.push({ head: phase * R, amp: envelope(phase) * 0.55 }) + if (phase >= 0 && phase < 1) { + ringHead[rings] = phase * R + ringAmp[rings++] = envelope(phase) * 0.55 + } } } @@ -340,11 +354,11 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n const d = g.dist[i]! let level = gather * Math.exp(-d / (P * 4)) * 0.9 - for (const ring of rings) { - const delta = d - ring.head + for (let ring = 0; ring < rings; ring++) { + const delta = d - ringHead[ring]! const c = Math.abs(delta) < crest ? 0.5 + 0.5 * Math.cos((delta / crest) * Math.PI) : 0 const tl = delta < 0 && delta > -tail ? (1 + delta / tail) ** 2.3 : 0 - level += (c * 0.62 + tl * 0.16) * ring.amp * g.falloff[i]! + level += (c * 0.62 + tl * 0.16) * ringAmp[ring]! * g.falloff[i]! } field[i] = level + breath * g.falloff[i]! @@ -390,7 +404,10 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n if (!steady && cool > 0 && t > ATTACK_START) { const hw = (LOGO_COLS / 2 + 1) * P const hh = (LOGO_ROWS / 2 + 1) * P - const color = mixRGB(pal.accent, pal.peak, v * 0.5) + const k = clamp01(v * 0.5) + const red = pal.accent[0] + (pal.peak[0] - pal.accent[0]) * k + const green = pal.accent[1] + (pal.peak[1] - pal.accent[1]) * k + const blue = pal.accent[2] + (pal.peak[2] - pal.accent[2]) * k ctx.lineCap = "round" for (const s of STARS) { @@ -407,7 +424,7 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n if (alpha < 0.01) continue const r0 = Math.max(edge, r - len) - ctx.strokeStyle = style(color, alpha) + ctx.strokeStyle = style(red, green, blue, alpha) ctx.lineWidth = s.width * 1.5 * dpr ctx.beginPath() ctx.moveTo((g.cx + dx * r0) * dpr, (g.cy + dy * r0) * dpr) @@ -475,7 +492,8 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n if (steady) ctx.putImageData(g.pixels, 0, 0) else if (maxX > minX && maxY > minY) { - const [sw, sh] = [maxX - minX, maxY - minY] + const sw = maxX - minX + const sh = maxY - minY g.grid.ctx.putImageData(g.pixels, 0, 0, minX, minY, sw, sh) ctx.drawImage(g.grid.canvas, minX, minY, sw, sh, minX, minY, sw, sh) } @@ -484,11 +502,13 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n const maxD = Math.hypot(LOGO_COLS / 2, LOGO_ROWS / 2) const shimmer = smoothstep(LOOP_START - 400, LOOP_START + 500, t) - const heads = [0, 0.5].map((off) => { - const ph = ((((t - RING_ORIGIN) / PERIOD + off + 0.71) % 1) + 1) % 1 - - return { head: ph * (maxD + 6), amp: envelope(ph) * shimmer } - }) + // Two shimmer heads, half a period apart. + const phaseA = shimmerPhase(t, 0) + const phaseB = shimmerPhase(t, 0.5) + const headA = phaseA * (maxD + 6) + const headB = phaseB * (maxD + 6) + const ampA = envelope(phaseA) * shimmer + const ampB = envelope(phaseB) * shimmer const scale = arrivalScale(t) const gap = Math.max(1, Math.round(P * 0.14 * dpr)) / dpr @@ -497,25 +517,37 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n const d = Math.hypot(cell.col + 0.5 - LOGO_COLS / 2, cell.row + 0.5 - LOGO_ROWS / 2) let peak = landing * 0.8 let glow = (1 - smoothstep(ATTACK_END, 1100, t)) * 0.7 * arrive + landing * 0.3 - - for (const h of heads) { - const delta = d - h.head - peak += Math.exp(-(Math.abs(delta / 1.3) ** 1.8)) * 0.5 * h.amp - glow += (delta < 0 && delta > -6 ? (1 + delta / 6) ** 2.6 : 0) * 0.3 * h.amp - } + const deltaA = d - headA + peak += Math.exp(-(Math.abs(deltaA / 1.3) ** 1.8)) * 0.5 * ampA + glow += (deltaA < 0 && deltaA > -6 ? (1 + deltaA / 6) ** 2.6 : 0) * 0.3 * ampA + const deltaB = d - headB + peak += Math.exp(-(Math.abs(deltaB / 1.3) ** 1.8)) * 0.5 * ampB + glow += (deltaB < 0 && deltaB > -6 ? (1 + deltaB / 6) ** 2.6 : 0) * 0.3 * ampB // Shadow cells are counters once they settle: they take only a fraction of the strokes' light. const damp = cell.kind === 2 ? lerp(1, COUNTER, smoothstep(0.7, 1, arrive)) : 1 - const tone = [pal.logoG, pal.logoO, pal.shadow][cell.kind]! - const hot = mixRGB(mixRGB(tone, pal.accent, Math.min(1, glow) * damp), pal.peak, Math.min(1, peak) * damp) - const color = arrive < 0.3 ? mixRGB(pal.dot, hot, arrive / 0.3) : hot + const tone = pal[TONES[cell.kind]] + // The tone heats towards the accent, then the peak, and fades in from a resting dot; kept in scalars. + const kGlow = clamp01(Math.min(1, glow) * damp) + const kPeak = clamp01(Math.min(1, peak) * damp) + const glowRed = tone[0] + (pal.accent[0] - tone[0]) * kGlow + const glowGreen = tone[1] + (pal.accent[1] - tone[1]) * kGlow + const glowBlue = tone[2] + (pal.accent[2] - tone[2]) * kGlow + const hotRed = glowRed + (pal.peak[0] - glowRed) * kPeak + const hotGreen = glowGreen + (pal.peak[1] - glowGreen) * kPeak + const hotBlue = glowBlue + (pal.peak[2] - glowBlue) * kPeak + const kArrive = clamp01(arrive / 0.3) + const early = arrive < 0.3 + const red = early ? pal.dot[0] + (hotRed - pal.dot[0]) * kArrive : hotRed + const green = early ? pal.dot[1] + (hotGreen - pal.dot[1]) * kArrive : hotGreen + const blue = early ? pal.dot[2] + (hotBlue - pal.dot[2]) * kArrive : hotBlue const alpha = lerp(pal.dotAlpha * 1.4, 1, smoothstep(0, 0.6, arrive)) * arrive if (alpha <= 0.002) continue const s = lerp(dot, P - gap, arrive ** 1.2) * scale * dpr const x = (g.cx + (g.ox + (g.lc + cell.col) * P + P / 2 - g.cx) * scale) * dpr - s / 2 const y = (g.cy + (g.oy + (g.lr + cell.row) * P + P / 2 - g.cy) * scale) * dpr - s / 2 - ctx.fillStyle = style(color, alpha) + ctx.fillStyle = style(red, green, blue, alpha) // Snap only at rest on the grid; while GO scales in, cells keep sub-pixel positions. if (scale === 1) ctx.fillRect(Math.round(x), Math.round(y), Math.round(s), Math.round(s)) @@ -523,6 +555,9 @@ function draw(ctx: CanvasRenderingContext2D, g: Geometry, pal: HeroPalette, t: n } } +/** Where a shimmer head is in its pass through GO, from 0 to 1. */ +const shimmerPhase = (t: number, offset: number) => ((((t - RING_ORIGIN) / PERIOD + offset + 0.71) % 1) + 1) % 1 + /** Source-over of a cell colour on a pixel of bloom (accent at `under`/255 alpha), unpremultiplied for ImageData. */ function over(red: number, green: number, blue: number, alpha: number, accent: RGB, under: number) { const a = alpha / 255 @@ -596,10 +631,23 @@ export function mountGoUpsellHero(canvas: HTMLCanvasElement) { let palette = readPalette(canvas, ctx) let g: Geometry | undefined let raf = 0 - let last = 0 - let t = 0 + // One event object for every frame, so the loop allocates nothing. + const frame = { type: "frame" as const, attempt: 0, now: 0 } + + // The app's Reduce Motion setting overrides the system preference, as in @opencode/ui/motion/reduced. + const reduced = () => { + const value = document.documentElement.getAttribute("data-motion") + + if (value === "reduce") return true + + if (value === "full") return false + + return reduce.matches + } + + let loop = createHeroLoopState({ reduced: reduced(), hidden: document.hidden, now: performance.now() }) - const render = () => { + const render = (t: number) => { const dpr = Math.min(3, window.devicePixelRatio || 1) const w = Math.max(1, canvas.clientWidth) const h = Math.max(1, canvas.clientHeight) @@ -610,30 +658,49 @@ export function mountGoUpsellHero(canvas: HTMLCanvasElement) { g = geometry(w, h, dpr) } - draw(ctx, g, palette, reduce.matches ? STILL_TIME : t) + draw(ctx, g, palette, t) } const tick = (now: number) => { - t += Math.min(100, now - last) - last = now - render() + frame.now = now + loop = transitionHeroLoop(loop, frame) + + if (loop.status !== "running" || loop.attempt !== frame.attempt) return + render(loop.time) raf = requestAnimationFrame(tick) } - const run = () => { + // Enters the new state's work: the loop schedules its first frame, a still paints once, a pause does nothing. + const enter = () => { cancelAnimationFrame(raf) raf = 0 - if (reduce.matches) return render() + if (loop.status === "still") return render(STILL_TIME) - if (document.hidden) return - last = performance.now() + if (loop.status !== "running") return + frame.attempt = loop.attempt raf = requestAnimationFrame(tick) } - // A still has to be redrawn when its size, pixel ratio or theme changes; a running loop picks them up next frame. + const sync = () => { + const previous = loop + loop = transitionHeroLoop(loop, { + type: "synced", + reduced: reduced(), + hidden: document.hidden, + now: performance.now(), + }) + + if (loop === previous) return false + enter() + + return true + } + + // A still has to be redrawn when its size, pixel ratio or theme changes; a running loop picks them up next frame, + // and a hidden page paints nothing until it shows again. const redraw = () => { - if (!raf) render() + if (selectHeroRedrawsStill(loop)) render(STILL_TIME) } // A resolution query matches only the current ratio, so each change re-arms it for the new one. @@ -650,9 +717,11 @@ export function mountGoUpsellHero(canvas: HTMLCanvasElement) { redraw() } + // The root's attributes carry both the theme and the app's Reduce Motion setting. const restyle = () => { palette = readPalette(canvas, ctx) - redraw() + + if (!sync()) redraw() } const resize = new ResizeObserver(redraw) @@ -660,20 +729,21 @@ export function mountGoUpsellHero(canvas: HTMLCanvasElement) { const theme = new MutationObserver(restyle) theme.observe(document.documentElement, { attributes: true, - attributeFilter: ["data-color-scheme", "data-theme", "style", "class"], + attributeFilter: ["data-color-scheme", "data-theme", "data-motion", "style", "class"], }) - document.addEventListener("visibilitychange", run) - reduce.addEventListener("change", run) + document.addEventListener("visibilitychange", sync) + reduce.addEventListener("change", sync) watchDensity() - run() + enter() return () => { + loop = transitionHeroLoop(loop, { type: "disposed" }) cancelAnimationFrame(raf) raf = 0 resize.disconnect() theme.disconnect() - document.removeEventListener("visibilitychange", run) - reduce.removeEventListener("change", run) + document.removeEventListener("visibilitychange", sync) + reduce.removeEventListener("change", sync) density?.removeEventListener("change", onDensity) } } diff --git a/packages/app/src/providers/connect/go-upsell-hero-machine.test.ts b/packages/app/src/providers/connect/go-upsell-hero-machine.test.ts new file mode 100644 index 0000000000..8e30a2c02c --- /dev/null +++ b/packages/app/src/providers/connect/go-upsell-hero-machine.test.ts @@ -0,0 +1,88 @@ +import { describe, expect, test } from "bun:test" +import { + createHeroLoopState, + HERO_MAX_DT_MS, + selectHeroRedrawsStill, + transitionHeroLoop, + type HeroLoopState, +} from "./go-upsell-hero-machine" + +const frame = (state: HeroLoopState, now: number) => + transitionHeroLoop(state, { type: "frame", attempt: state.status === "disposed" ? 0 : state.attempt, now }) + +const synced = (state: HeroLoopState, input: { reduced?: boolean; hidden?: boolean; now?: number }) => + transitionHeroLoop(state, { + type: "synced", + reduced: input.reduced ?? false, + hidden: input.hidden ?? false, + now: input.now ?? 0, + }) + +describe("go upsell hero loop", () => { + test("a first vsync timestamp before the loop started does not rewind art time", () => { + const running = createHeroLoopState({ reduced: false, hidden: false, now: 120 }) + + const early = frame(running, 112) + expect(early).toMatchObject({ status: "running", time: 0, last: 112 }) + expect(frame(early, 128)).toMatchObject({ time: 16, last: 128 }) + }) + + test("advances frames in place and caps a stalled frame", () => { + const running = createHeroLoopState({ reduced: false, hidden: false, now: 0 }) + + const next = frame(running, 5_000) + expect(next).toBe(running) + expect(next).toMatchObject({ time: HERO_MAX_DT_MS, last: 5_000 }) + }) + + test("ignores a frame scheduled by an earlier run", () => { + const running = createHeroLoopState({ reduced: false, hidden: false, now: 0 }) + const resumed = synced(synced(running, { hidden: true }), { now: 50 }) + + expect(transitionHeroLoop(resumed, { type: "frame", attempt: 1, now: 66 })).toMatchObject({ time: 0, last: 50 }) + }) + + test("a hidden page pauses instead of drawing the still, and shows the still again when it returns", () => { + const running = frame(createHeroLoopState({ reduced: false, hidden: false, now: 0 }), 16) + const paused = synced(running, { hidden: true }) + + expect(paused).toEqual({ status: "paused", attempt: 2, time: 16 }) + expect(selectHeroRedrawsStill(paused)).toBe(false) + + const still = synced(paused, { reduced: true, hidden: true }) + expect(still).toBe(paused) + expect(synced(still, { reduced: true })).toEqual({ status: "still", attempt: 3, time: 16 }) + }) + + test("reduced motion stills a running loop and resumes art time where it stopped", () => { + const running = frame(createHeroLoopState({ reduced: false, hidden: false, now: 0 }), 40) + const still = synced(running, { reduced: true }) + + expect(selectHeroRedrawsStill(still)).toBe(true) + expect(synced(still, { reduced: true })).toBe(still) + expect(synced(still, { now: 500 })).toEqual({ status: "running", attempt: 3, time: 40, last: 500 }) + }) + + test("starts paused or still from the page it mounts on", () => { + expect(createHeroLoopState({ reduced: true, hidden: true, now: 0 })).toEqual({ + status: "paused", + attempt: 1, + time: 0, + }) + expect(createHeroLoopState({ reduced: true, hidden: false, now: 0 })).toEqual({ + status: "still", + attempt: 1, + time: 0, + }) + }) + + test("ignores everything once disposed", () => { + const disposed = transitionHeroLoop(createHeroLoopState({ reduced: false, hidden: false, now: 0 }), { + type: "disposed", + }) + + expect(disposed).toEqual({ status: "disposed" }) + expect(synced(disposed, { reduced: true })).toBe(disposed) + expect(frame(disposed, 16)).toBe(disposed) + }) +}) diff --git a/packages/app/src/providers/connect/go-upsell-hero-machine.ts b/packages/app/src/providers/connect/go-upsell-hero-machine.ts new file mode 100644 index 0000000000..cc013b0924 --- /dev/null +++ b/packages/app/src/providers/connect/go-upsell-hero-machine.ts @@ -0,0 +1,68 @@ +/** The longest step one frame may advance the art, so a stalled tab resumes where it paused instead of skipping. */ +export const HERO_MAX_DT_MS = 100 + +/** + * Lifecycle of the Go upsell hero canvas. Kept in a plain variable, never a Solid store: `frame` advances `time` + * and `last` in place and returns the same object, so the animation loop allocates nothing per frame. + */ +export type HeroLoopState = + /** The rAF loop draws art time `time`; `last` is the previous frame's timestamp. */ + | { readonly status: "running"; readonly attempt: number; time: number; last: number } + /** The page is hidden: nothing draws and art time stands still. */ + | { readonly status: "paused"; readonly attempt: number; readonly time: number } + /** Reduced motion: one still frame, redrawn only when its size, pixel ratio or theme changes. */ + | { readonly status: "still"; readonly attempt: number; readonly time: number } + | { readonly status: "disposed" } + +export type HeroLoopEvent = + | { readonly type: "synced"; readonly reduced: boolean; readonly hidden: boolean; readonly now: number } + /** Reused by the driver for every frame. */ + | { readonly type: "frame"; attempt: number; now: number } + | { readonly type: "disposed" } + +const DISPOSED: HeroLoopState = Object.freeze({ status: "disposed" }) + +export function createHeroLoopState(input: { reduced: boolean; hidden: boolean; now: number }): HeroLoopState { + return enter({ attempt: 1, time: 0 }, input) +} + +export function transitionHeroLoop(state: HeroLoopState, event: HeroLoopEvent): HeroLoopState { + if (state.status === "disposed") return state + + if (event.type === "disposed") return DISPOSED + + if (event.type === "frame") { + if (state.status !== "running" || event.attempt !== state.attempt) return state + // The first frame's vsync timestamp can precede the `performance.now()` read when the loop started. + state.time += Math.max(0, Math.min(HERO_MAX_DT_MS, event.now - state.last)) + state.last = event.now + + return state + } + + if (status(event) === state.status) return state + + return enter({ attempt: state.attempt + 1, time: state.time }, event) +} + +/** Whether a size, pixel ratio or theme change must repaint now; a running loop picks it up on its next frame. */ +export function selectHeroRedrawsStill(state: HeroLoopState) { + return state.status === "still" +} + +function status(input: { reduced: boolean; hidden: boolean }) { + if (input.hidden) return "paused" + + return input.reduced ? "still" : "running" +} + +function enter( + base: { attempt: number; time: number }, + input: { reduced: boolean; hidden: boolean; now: number }, +): HeroLoopState { + const next = status(input) + + if (next === "running") return { status: next, attempt: base.attempt, time: base.time, last: input.now } + + return { status: next, attempt: base.attempt, time: base.time } +} diff --git a/packages/app/src/providers/connect/machine.test.ts b/packages/app/src/providers/connect/machine.test.ts index 102f3ef5bc..ad4f8e4f99 100644 --- a/packages/app/src/providers/connect/machine.test.ts +++ b/packages/app/src/providers/connect/machine.test.ts @@ -310,3 +310,56 @@ test("a failed refresh retries the refresh, not the sign-in", () => { { type: "refresh", method: key }, ]) }) + +const formOauth: ProviderConnectMethod = { + id: "oauth", + type: "oauth", + label: "Sign in", + form: [ + { key: "setup", type: "external", url: "https://setup.example.test" }, + { key: "region", type: "string", hidden: true, default: "eu" }, + ], +} + +test("an answered form starts the method with the answer and its hidden defaults", () => { + const form = replay([loaded([formOauth])]) + + expect(form.state.status).toBe("form") + expect(selectProviderConnectView(form.state).form).toMatchObject({ kind: "external", canFinish: false }) + + const opening = replay([{ type: "form", event: { type: "external.open" } }], form.state) + + expect(opening.effects).toMatchObject([{ type: "form.open.browser", attempt: 1, browser: 1 }]) + + const started = replay( + [ + { type: "form.browser.opened", attempt: 1, browser: 1, opened: false }, + { type: "form", event: { type: "step.submitted" } }, + ], + opening.state, + ) + + expect(started.state.status).toBe("starting") + expect(started.effects).toEqual([ + { type: "start", attempt: 2, method: formOauth, answer: { setup: true, region: "eu" } }, + ]) +}) + +test("a form with nothing to ask starts the method at once", () => { + const hidden: ProviderConnectMethod = { + ...key, + form: [{ key: "region", type: "string", hidden: true, default: "eu" }], + } + + expect(replay([loaded([hidden])]).state).toMatchObject({ status: "entering", answer: { region: "eu" } }) +}) + +test("Back while the form opens the browser ignores the late result", () => { + const opening = replay([loaded([formOauth]), { type: "form", event: { type: "external.open" } }]) + const back = replay([{ type: "back" }], opening.state) + + expect(back.state.status).toBe("choosing") + expect( + transitionProviderConnect(back.state, { type: "form.browser.opened", attempt: 1, browser: 1, opened: true }).state, + ).toBe(back.state) +}) diff --git a/packages/app/src/providers/connect/machine.ts b/packages/app/src/providers/connect/machine.ts index 0070d73838..0b22cdb115 100644 --- a/packages/app/src/providers/connect/machine.ts +++ b/packages/app/src/providers/connect/machine.ts @@ -1,11 +1,18 @@ import type { FormAnswer, - FormField, IntegrationCommandConnectOutput, IntegrationInfo, IntegrationMethod, IntegrationOauthConnectOutput, } from "@opencode/client/promise" +import { + createProviderFormState, + selectProviderFormView, + transitionProviderForm, + type ProviderActiveForm, + type ProviderFormEvent, + type ProviderFormInput, +} from "./form-machine" export type ProviderConnectMethod = Exclude @@ -64,7 +71,7 @@ type Selection = { export type ProviderConnectState = | { readonly status: "loading"; readonly attempt: number } | { readonly status: "choosing"; readonly attempt: number; readonly catalog: ProviderCatalog } - | (Selection & { readonly status: "form" }) + | (Selection & { readonly status: "form"; readonly form: ProviderActiveForm }) | (Selection & { readonly status: "starting" }) | (Selection & { readonly status: "entering" @@ -94,7 +101,14 @@ export type ProviderConnectEvent = readonly manual: boolean } | { readonly type: "method.selected"; readonly index: number } - | { readonly type: "form.submitted"; readonly answer: FormAnswer } + | { readonly type: "form"; readonly event: ProviderFormInput } + /** `browser` is the form's attempt for this open; `opened` is false when it failed or did not answer in time. */ + | { + readonly type: "form.browser.opened" + readonly attempt: number + readonly browser: number + readonly opened: boolean + } | { readonly type: "entry.submitted"; readonly value: string } | { readonly type: "oauth.started"; readonly attempt: number; readonly authorization: ProviderAuthorization } | { readonly type: "command.started"; readonly attempt: number; readonly command: ProviderCommandAttempt } @@ -121,6 +135,13 @@ export type ProviderConnectEffect = readonly answer?: FormAnswer } | { readonly type: "open.browser"; readonly attemptID: string; readonly url: string } + | { + readonly type: "form.open.browser" + readonly attempt: number + readonly browser: number + readonly url: string + readonly timeoutMs: number + } | { readonly type: "poll"; readonly attempt: number; readonly signIn: ProviderPolledSignIn; readonly delay: boolean } | { readonly type: "poll.stop" } | { readonly type: "cancel"; readonly target: "oauth" | "command"; readonly attemptID: string } @@ -148,26 +169,6 @@ export function connectMethods(integration: IntegrationInfo) { .toSorted((a, b) => Number(a.type === "key") - Number(b.type === "key")) } -export function providerFormDefaults(fields: ReadonlyArray | undefined) { - return (fields ?? []).reduce((answer, field) => { - if (field.type === "external" || !field.hidden || field.default === undefined) return answer - - const active = (field.when ?? []).every((condition) => { - const actual = answer[condition.key] - - if (actual === undefined) return false - - const equal = Array.isArray(actual) ? actual.some((item) => item === condition.value) : actual === condition.value - - return condition.op === "eq" ? equal : !equal - }) - - if (!active) return answer - - return Object.assign(answer, { [field.key]: field.default }) - }, {}) -} - export function startProviderConnect(): ProviderConnectTransition { return { state: { status: "loading", attempt: 0 }, effects: [{ type: "load", attempt: 0 }] } } @@ -237,9 +238,11 @@ export function transitionProviderConnect( } if (state.status === "form") { - if (event.type !== "form.submitted") return unchanged(state) + if (event.type === "form") return form(state, event.event) - return select(state.catalog, state.methodIndex, state.attempt + 1, event.answer) + if (event.type !== "form.browser.opened") return unchanged(state) + + return form(state, { type: "external.opened", attempt: event.browser, opened: event.opened }) } if (state.status === "starting") return started(state, event) @@ -328,6 +331,7 @@ export function selectProviderConnectView(state: ProviderConnectState) { authorization, browserFailed: signIn?.kind === "browser" && signIn.browserFailed, commandOutput: signIn?.kind === "command" ? signIn.output : "", + form: state.status === "form" ? selectProviderFormView(state.form) : undefined, entryError: state.status === "entering" ? state.error : undefined, // A typed secret is sent and the catalogs are refreshing: the form takes no second submit. submitting: state.status === "submitting" || state.status === "refreshing", @@ -364,19 +368,42 @@ function select( answer?: FormAnswer, ): ProviderConnectTransition { const method = catalog.methods[methodIndex] - const form = method.type === "command" ? undefined : method.form + // An answered form already holds the defaults of its hidden fields; one with nothing to ask answers itself. + const form = answer ? undefined : createProviderFormState(method.type === "command" ? undefined : method.form) - if (!answer && (form ?? []).some((field) => field.type === "external" || !field.hidden)) - return unchanged({ status: "form", attempt, catalog, methodIndex }) + if (form?.status === "active") return unchanged({ status: "form", attempt, catalog, methodIndex, form }) - const merged = { ...providerFormDefaults(form), ...answer } - const base = { attempt, catalog, methodIndex, answer: Object.keys(merged).length ? merged : undefined } + const resolved = answer ?? form?.answer ?? {} + const base = { attempt, catalog, methodIndex, answer: Object.keys(resolved).length ? resolved : undefined } if (method.type === "key") return unchanged({ ...base, status: "entering", signIn: { kind: "key", method } }) return { state: { ...base, status: "starting" }, effects: [{ type: "start", attempt, method, answer: base.answer }] } } +// Moves the form one step on; an answered form starts the method with the answer. +function form(state: Extract, event: ProviderFormEvent) { + const next = transitionProviderForm(state.form, event) + + if (next.state === state.form) return unchanged(state) + + if (next.state.status === "completed") + return select(state.catalog, state.methodIndex, state.attempt + 1, next.state.answer) + + return { + state: { ...state, form: next.state }, + effects: next.effects.map( + (effect): ProviderConnectEffect => ({ + type: "form.open.browser", + attempt: state.attempt, + browser: effect.attempt, + url: effect.url, + timeoutMs: effect.timeoutMs, + }), + ), + } +} + function started( state: Extract, event: ProviderConnectEvent, diff --git a/packages/app/src/providers/connect/mcp-dialog.tsx b/packages/app/src/providers/connect/mcp-dialog.tsx index f4c6d727ce..608dc17963 100644 --- a/packages/app/src/providers/connect/mcp-dialog.tsx +++ b/packages/app/src/providers/connect/mcp-dialog.tsx @@ -273,7 +273,6 @@ export function McpDialog(props: { -
- -
+ +
+ + + + + + +
+
+ + { + event.preventDefault() + dispatch({ type: "paste.submitted" }) + }} + class="flex flex-col items-start gap-5 self-stretch" + > - + {(error) => ( )} - diff --git a/packages/app/src/providers/connect/mcp.tsx b/packages/app/src/providers/connect/mcp.tsx index 41c43c1bbd..5f24f8b5c1 100644 --- a/packages/app/src/providers/connect/mcp.tsx +++ b/packages/app/src/providers/connect/mcp.tsx @@ -185,13 +185,13 @@ function createMcpController( url={signIn.url} lifetime={signIn.lifetime} location={ref} - onDone={async () => { + onSync={async () => { const data = input.ctx.data data.location.mcp.server.invalidate(ref) data.location.mcp.resource.invalidate(ref) await Promise.all([data.location.mcp.server.sync(ref), data.location.mcp.resource.sync(ref)]) - input.dialog.close(dialogID) }} + onClose={() => input.dialog.close(dialogID)} /> ), undefined, diff --git a/packages/app/src/providers/models/select-dialog-machine.test.ts b/packages/app/src/providers/models/select-dialog-machine.test.ts new file mode 100644 index 0000000000..d1178c4bb1 --- /dev/null +++ b/packages/app/src/providers/models/select-dialog-machine.test.ts @@ -0,0 +1,291 @@ +import { describe, expect, test } from "bun:test" +import { + correctFlyoutPosition, + createDialogFlyoutState, + createModelDrawerState, + FLYOUT_OPEN_DELAY_MS, + inside, + placeFlyout, + selectDrawerRestoreTrigger, + selectFlyoutOpenId, + transitionDialogFlyout, + transitionModelDrawer, + type DialogFlyoutEvent, + type DialogFlyoutState, + type DialogFlyoutTransition, + type ModelDrawerEvent, + type ModelDrawerState, + type ModelDrawerTransition, +} from "./select-dialog-machine" + +// The flyout sits to the right of the rows: x 300 to 460, y 100 to 300. +const flyoutRect = { left: 300, right: 460, top: 100, bottom: 300 } + +const position = { left: 300, top: 100 } + +function flyoutReplay(state: DialogFlyoutState, events: DialogFlyoutEvent[]) { + const initial: DialogFlyoutTransition = { state, effects: [] } + + return events.reduce((current, event) => transitionDialogFlyout(current.state, event), initial) +} + +const moved = (id: string, point: { x: number; y: number }, activeId?: string): DialogFlyoutEvent => ({ + type: "row.moved", + id, + activeId, + point, + flyout: flyoutRect, +}) + +/** Opens row `id`'s flyout the way a cold hover does: rest, the delay passes, the row is measured. */ +function opened(id: string) { + const resting = transitionDialogFlyout(createDialogFlyoutState(), moved(id, { x: 100, y: 120 })) + const attempt = resting.state.status === "opening" ? resting.state.attempt : -1 + const due = transitionDialogFlyout(resting.state, { type: "open.due", attempt }) + + return transitionDialogFlyout(due.state, { type: "placed", attempt, position }).state +} + +describe("model dialog flyout", () => { + test("a flyout opens at once only for a moment after the previous one closed", () => { + const open = opened("a") + expect(selectFlyoutOpenId(open)).toBe("a") + + const left = transitionDialogFlyout(open, { + type: "row.left", + into: "outside", + point: { x: 100, y: 400 }, + flyout: flyoutRect, + }) + + expect(left.state).toMatchObject({ status: "closed", warm: true }) + expect(left.effects).toEqual([{ type: "schedule", kind: "warm", attempt: 2, delayMs: 300 }]) + + // Straight back onto a row: no open delay. + expect(transitionDialogFlyout(left.state, moved("b", { x: 100, y: 150 })).state).toMatchObject({ + status: "open", + id: "b", + }) + + // Seconds later the warmth is gone, and the next row waits for the delay again. + const cooled = transitionDialogFlyout(left.state, { type: "warm.expired", attempt: 2 }) + expect(cooled.state).toMatchObject({ status: "closed", warm: false }) + const next = transitionDialogFlyout(cooled.state, moved("b", { x: 100, y: 150 })) + expect(next.state).toMatchObject({ status: "opening", id: "b" }) + expect(next.effects).toContainEqual({ type: "schedule", kind: "open", attempt: 3, delayMs: FLYOUT_OPEN_DELAY_MS }) + }) + + test.each([ + ["the arrow keys", { type: "keyboard" }], + ["a resize", { type: "dismissed" }], + ] as const)("%s cancel a pending open, so its timer opens nothing", (_name, event) => { + const resting = transitionDialogFlyout(createDialogFlyoutState(), moved("a", { x: 100, y: 120 })) + expect(resting.state).toMatchObject({ status: "opening", attempt: 1 }) + + const cancelled = transitionDialogFlyout(resting.state, event) + expect(cancelled.effects).toEqual([{ type: "cancel" }]) + expect(cancelled.state.status).toBe("closed") + + const late = transitionDialogFlyout(cancelled.state, { type: "open.due", attempt: 1 }) + expect(late.state).toBe(cancelled.state) + expect(selectFlyoutOpenId(late.state)).toBeUndefined() + }) + + test("typing closes a warm flyout state cold", () => { + const open = opened("a") + const typed = transitionDialogFlyout(open, { type: "keyboard" }) + + expect(typed.state).toMatchObject({ status: "closed", input: "keyboard", warm: false }) + expect(transitionDialogFlyout(typed.state, moved("b", { x: 100, y: 150 })).state.status).toBe("opening") + }) + + test("crossing a row inside the safe triangle keeps the flyout until the pointer rests there", () => { + const open = opened("a") + const aiming = transitionDialogFlyout(open, moved("b", { x: 200, y: 150 }, "a")) + expect(aiming.state).toMatchObject({ status: "aiming", id: "a", target: "b" }) + expect(selectFlyoutOpenId(aiming.state)).toBe("a") + const attempt = aiming.state.status === "aiming" ? aiming.state.attempt : -1 + expect(aiming.effects).toEqual([{ type: "schedule", kind: "aim", attempt, delayMs: 300 }]) + + // Still moving on the same row restarts the wait without a new state. + const still = transitionDialogFlyout(aiming.state, moved("b", { x: 210, y: 150 }, "a")) + expect(still.state).toBe(aiming.state) + expect(still.effects).toEqual([{ type: "schedule", kind: "aim", attempt, delayMs: 300 }]) + + const entered = transitionDialogFlyout(aiming.state, { type: "flyout.entered" }) + expect(entered.state).toMatchObject({ status: "open", id: "a" }) + expect(entered.effects).toEqual([{ type: "cancel" }]) + expect(transitionDialogFlyout(entered.state, { type: "aim.due", attempt, point: undefined }).state).toBe( + entered.state, + ) + + const rested = transitionDialogFlyout(aiming.state, { type: "aim.due", attempt, point: { x: 210, y: 152 } }) + expect(rested.state).toMatchObject({ status: "open", id: "b", apex: { x: 210, y: 152 } }) + expect(rested.effects).toEqual([ + { type: "activate", id: "b" }, + { type: "place", attempt: attempt + 1, id: "b" }, + ]) + }) + + test("a move on the flyout's own row moves the triangle's apex without a new state", () => { + const open = opened("a") + const next = transitionDialogFlyout(open, moved("a", { x: 140, y: 125 }, "a")) + + expect(next.state).toBe(open) + expect(next.effects).toEqual([]) + expect(open).toMatchObject({ apex: { x: 140, y: 125 } }) + }) + + test("leaving the triangle for empty space closes the flyout", () => { + const open = opened("a") + + expect( + transitionDialogFlyout(open, { type: "pointer.outside", point: { x: 250, y: 200 }, flyout: flyoutRect }).state, + ).toBe(open) + expect( + transitionDialogFlyout(open, { type: "pointer.outside", point: { x: 200, y: 50 }, flyout: flyoutRect }).state, + ).toMatchObject({ status: "closed", warm: true }) + }) + + test("a wheel scroll moves the highlight and flyout to the row under the pointer; a keyboard scroll does not", () => { + const keyboard = createDialogFlyoutState() + const target = { id: "c", point: { x: 100, y: 200 } } + expect(transitionDialogFlyout(keyboard, { type: "scrolled", target }).state).toBe(keyboard) + + const wheeled = flyoutReplay(keyboard, [{ type: "wheel" }, { type: "scrolled", target }]) + expect(wheeled.state).toMatchObject({ status: "open", id: "c" }) + expect(wheeled.effects).toEqual([ + { type: "activate", id: "c" }, + { type: "place", attempt: 1, id: "c" }, + ]) + + const nothing = transitionDialogFlyout(opened("a"), { type: "scrolled", target: undefined }) + expect(nothing.state).toMatchObject({ status: "closed", warm: false }) + }) + + test("a row that cannot be measured closes the flyout", () => { + const resting = transitionDialogFlyout(createDialogFlyoutState(), moved("a", { x: 100, y: 120 })) + const due = transitionDialogFlyout(resting.state, { type: "open.due", attempt: 1 }) + + expect(transitionDialogFlyout(due.state, { type: "placed", attempt: 1, position: undefined }).state).toMatchObject({ + status: "closed", + }) + }) + + test("disposal cancels a pending timer and ignores what comes after", () => { + const resting = transitionDialogFlyout(createDialogFlyoutState(), moved("a", { x: 100, y: 120 })) + const disposed = transitionDialogFlyout(resting.state, { type: "disposed" }) + + expect(disposed).toEqual({ state: { status: "disposed" }, effects: [{ type: "cancel" }] }) + expect(transitionDialogFlyout(disposed.state, { type: "open.due", attempt: 1 }).state).toBe(disposed.state) + }) + + test("places the flyout beside the row's end edge, else its start edge, else over the layer", () => { + const row = { left: 100, right: 400, top: 50, bottom: 80 } + + expect(placeFlyout(row, { left: 0, right: 800, top: 0, bottom: 600 }, false)).toEqual({ left: 406, top: 48 }) + expect(placeFlyout({ ...row, left: 200 }, { left: 0, right: 500, top: 0, bottom: 600 }, false)).toEqual({ + left: 34, + top: 48, + }) + expect(placeFlyout(row, { left: 50, right: 500, top: 0, bottom: 600 }, false)).toEqual({ left: 340, top: 48 }) + expect(placeFlyout(row, { left: 0, right: 800, top: 0, bottom: 600 }, true)).toEqual({ left: 406, top: 48 }) + expect(correctFlyoutPosition({ left: 406, top: 48 }, { x: 456, y: 58 })).toEqual({ left: 356, top: 38 }) + }) + + test("the safe triangle spans from the apex to the flyout's near corners", () => { + const apex = { x: 100, y: 120 } + + expect(inside({ x: 250, y: 150 }, apex, flyoutRect)).toBe(true) + expect(inside({ x: 250, y: 90 }, apex, flyoutRect)).toBe(false) + expect(inside({ x: 250, y: 150 }, apex, undefined)).toBe(false) + }) +}) + +function drawerReplay(state: ModelDrawerState, events: ModelDrawerEvent[]) { + const initial: ModelDrawerTransition = { state, effects: [] } + + return events.reduce((current, event) => transitionModelDrawer(current.state, event), initial) +} + +describe("mobile model drawer", () => { + test("reopening while it closes for an action does not run that action on the next dismiss", () => { + const managing = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "manage" }, + ]) + + expect(managing.state).toMatchObject({ status: "closing", action: "manage" }) + expect(selectDrawerRestoreTrigger(managing.state)).toBe(false) + + const reopened = transitionModelDrawer(managing.state, { type: "opened" }) + expect(reopened.effects).toEqual([{ type: "cancel-close-timeout" }]) + + const dismissed = transitionModelDrawer(reopened.state, { type: "dismissed" }) + expect(dismissed.state).toMatchObject({ status: "closing", action: undefined }) + expect(selectDrawerRestoreTrigger(dismissed.state)).toBe(true) + + const hidden = transitionModelDrawer(dismissed.state, { type: "hidden" }) + expect(hidden.state).toEqual({ status: "closed", attempt: 4, restoreTrigger: true }) + expect(hidden.effects).toEqual([{ type: "cancel-close-timeout" }]) + }) + + test("runs the action once the close transition ends", () => { + const selected = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "connect" }, + { type: "hidden" }, + ]) + + expect(selected.effects).toEqual([{ type: "cancel-close-timeout" }, { type: "run-action", action: "connect" }]) + expect(selectDrawerRestoreTrigger(selected.state)).toBe(false) + }) + + test("runs the action after a timeout when the close transition never reports its end", () => { + const closing = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "select" }, + ]) + + expect(closing.effects).toEqual([{ type: "schedule-close-timeout", attempt: 2, delayMs: 600 }]) + + const timedOut = transitionModelDrawer(closing.state, { type: "close.timed-out", attempt: 2 }) + expect(timedOut.effects).toEqual([{ type: "run-action", action: "select" }]) + expect(transitionModelDrawer(timedOut.state, { type: "hidden" }).effects).toEqual([]) + expect(transitionModelDrawer(timedOut.state, { type: "action.selected", action: "manage" }).effects).toEqual([]) + }) + + test("a second tap during the close transition is ignored", () => { + const closing = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "select" }, + ]) + + expect(transitionModelDrawer(closing.state, { type: "action.selected", action: "manage" }).state).toBe( + closing.state, + ) + }) + + test("a timeout from an earlier close is ignored", () => { + const reopened = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "manage" }, + { type: "opened" }, + { type: "dismissed" }, + ]) + + expect(transitionModelDrawer(reopened.state, { type: "close.timed-out", attempt: 2 }).state).toBe(reopened.state) + }) + + test("disposal cancels the timeout without running the action", () => { + const closing = drawerReplay(createModelDrawerState(), [ + { type: "opened" }, + { type: "action.selected", action: "manage" }, + ]) + + expect(transitionModelDrawer(closing.state, { type: "disposed" })).toEqual({ + state: { status: "disposed" }, + effects: [{ type: "cancel-close-timeout" }], + }) + }) +}) diff --git a/packages/app/src/providers/models/select-dialog-machine.ts b/packages/app/src/providers/models/select-dialog-machine.ts new file mode 100644 index 0000000000..bd3587a44c --- /dev/null +++ b/packages/app/src/providers/models/select-dialog-machine.ts @@ -0,0 +1,495 @@ +// ── Desktop model dialog: the variant flyout beside the highlighted row ──────── + +/** How long the pointer rests on a row before its flyout opens, unless a flyout was just open. */ +export const FLYOUT_OPEN_DELAY_MS = 100 + +/** How long the pointer may rest on a row inside the safe triangle before the flyout moves to that row. */ +export const FLYOUT_AIM_TIMEOUT_MS = 300 + +/** How long after a flyout closes that the next row's flyout still opens at once. */ +export const FLYOUT_WARM_MS = 300 + +export const FLYOUT_WIDTH_PX = 160 + +export const FLYOUT_GAP_PX = 6 + +export type FlyoutPoint = { readonly x: number; readonly y: number } + +export type FlyoutPosition = { readonly left: number; readonly top: number } + +export type FlyoutRect = { + readonly left: number + readonly right: number + readonly top: number + readonly bottom: number +} + +/** Where the pointer last rested on the flyout's row: the apex of the triangle that keeps the flyout open. */ +type Apex = { x: number; y: number } + +export type DialogFlyoutState = + /** `input` is what moved the highlight last; `warm` holds for a moment after a flyout closes under the pointer. */ + | { + readonly status: "closed" + readonly attempt: number + readonly input: "keyboard" | "pointer" + readonly warm: boolean + } + /** The pointer rests on row `id`; its flyout opens after the delay. */ + | { readonly status: "opening"; readonly attempt: number; readonly id: string; readonly apex: Apex } + /** `position` is undefined only until the driver measures the row, within the same dispatch. */ + | { + readonly status: "open" + readonly attempt: number + readonly id: string + readonly position: FlyoutPosition | undefined + readonly apex: Apex + } + /** The pointer crossed onto row `target` on its way to the flyout; the flyout stays on `id` while it keeps moving. */ + | { + readonly status: "aiming" + readonly attempt: number + readonly id: string + readonly position: FlyoutPosition | undefined + readonly apex: Apex + readonly target: string + } + | { readonly status: "disposed" } + +export type DialogFlyoutEvent = + /** Arrow keys, typing, a favorite toggled or a variant staged from the keyboard. */ + | { readonly type: "keyboard" } + | { readonly type: "wheel" } + | { + readonly type: "row.moved" + readonly id: string + readonly activeId: string | undefined + readonly point: FlyoutPoint + readonly flyout: FlyoutRect | undefined + } + | { + readonly type: "row.left" + readonly into: "row" | "flyout" | "outside" + readonly point: FlyoutPoint + readonly flyout: FlyoutRect | undefined + } + /** The pointer moved somewhere other than a row or the flyout while a flyout is open. */ + | { readonly type: "pointer.outside"; readonly point: FlyoutPoint; readonly flyout: FlyoutRect | undefined } + | { readonly type: "flyout.entered" } + /** The flyout's row moved or vanished without the pointer: a resize, a favorite toggled from the flyout. */ + | { readonly type: "dismissed" } + /** Rows scrolled under the pointer; `target` is the row now under it, if the pointer drives the highlight. */ + | { readonly type: "scrolled"; readonly target: { readonly id: string; readonly point: FlyoutPoint } | undefined } + | { readonly type: "placed"; readonly attempt: number; readonly position: FlyoutPosition | undefined } + | { readonly type: "open.due"; readonly attempt: number } + | { readonly type: "aim.due"; readonly attempt: number; readonly point: FlyoutPoint | undefined } + | { readonly type: "warm.expired"; readonly attempt: number } + | { readonly type: "disposed" } + +export type DialogFlyoutEffect = + | { readonly type: "activate"; readonly id: string } + | { + readonly type: "schedule" + readonly kind: "open" | "aim" | "warm" + readonly attempt: number + readonly delayMs: number + } + | { readonly type: "cancel" } + /** Measure row `id` and answer with `placed`. */ + | { readonly type: "place"; readonly attempt: number; readonly id: string } + +export type DialogFlyoutTransition = { + readonly state: DialogFlyoutState + readonly effects: readonly DialogFlyoutEffect[] +} + +type LiveFlyout = Exclude + +const NO_EFFECTS: readonly DialogFlyoutEffect[] = [] + +const CANCEL: readonly DialogFlyoutEffect[] = [{ type: "cancel" }] + +export function createDialogFlyoutState(): DialogFlyoutState { + return { status: "closed", attempt: 0, input: "keyboard", warm: false } +} + +export function transitionDialogFlyout(state: DialogFlyoutState, event: DialogFlyoutEvent): DialogFlyoutTransition { + if (state.status === "disposed") return same(state) + + const cancel = timed(state) ? CANCEL : NO_EFFECTS + const attempt = timed(state) ? state.attempt + 1 : state.attempt + + switch (event.type) { + case "disposed": + return { state: { status: "disposed" }, effects: cancel } + case "keyboard": + if (state.status === "closed" && state.input === "keyboard" && !state.warm) return same(state) + + return { state: { status: "closed", attempt, input: "keyboard", warm: false }, effects: cancel } + case "wheel": + if (state.status !== "closed" || state.input !== "keyboard") return same(state) + + return same({ ...state, input: "pointer" }) + case "row.moved": + return moved(state, event) + case "row.left": { + if (state.status === "opening") + return { state: { status: "closed", attempt, input: "pointer", warm: false }, effects: cancel } + + if (state.status !== "open" && state.status !== "aiming") return same(state) + + // The row the pointer enters decides. + if (event.into === "row") return same(state) + + if (event.into === "flyout" || inside(event.point, state.apex, event.flyout)) return settle(state) + + return cool(state) + } + + case "pointer.outside": + if (state.status !== "open" && state.status !== "aiming") return same(state) + + if (inside(event.point, state.apex, event.flyout)) return same(state) + + return cool(state) + case "flyout.entered": + return settle(state) + case "dismissed": + if (state.status === "closed" && !state.warm) return same(state) + + return { + state: { status: "closed", attempt, input: state.status === "closed" ? state.input : "pointer", warm: false }, + effects: cancel, + } + case "scrolled": { + // Scrolled by the arrow keys: the highlight stays, and nothing opens. + if (state.status === "closed" && state.input === "keyboard") return same(state) + + if (!event.target) return transitionDialogFlyout(state, { type: "dismissed" }) + + if (state.status === "open" && state.id === event.target.id) + return { state, effects: [{ type: "place", attempt: state.attempt, id: state.id }] } + + return show(state, event.target.id, event.target.point) + } + + case "placed": + if (state.status !== "open" || state.attempt !== event.attempt) return same(state) + + if (!event.position) + return { state: { status: "closed", attempt, input: "pointer", warm: false }, effects: NO_EFFECTS } + + if (state.position?.left === event.position.left && state.position.top === event.position.top) return same(state) + + return same({ ...state, position: event.position }) + case "open.due": + if (state.status !== "opening" || state.attempt !== event.attempt) return same(state) + + return { + state: { status: "open", attempt: state.attempt, id: state.id, position: undefined, apex: state.apex }, + effects: [{ type: "place", attempt: state.attempt, id: state.id }], + } + case "aim.due": { + if (state.status !== "aiming" || state.attempt !== event.attempt) return same(state) + const point = event.point ?? state.apex + const next = state.attempt + 1 + + return { + state: { + status: "open", + attempt: next, + id: state.target, + position: state.position, + apex: { x: point.x, y: point.y }, + }, + effects: [ + { type: "activate", id: state.target }, + { type: "place", attempt: next, id: state.target }, + ], + } + } + + case "warm.expired": + if (state.status !== "closed" || !state.warm || state.attempt !== event.attempt) return same(state) + + return same({ ...state, warm: false }) + } +} + +function moved(state: LiveFlyout, event: Extract): DialogFlyoutTransition { + const open = state.status === "open" || state.status === "aiming" + + // On its way to the flyout, the pointer crosses other rows without taking the flyout with it. + if (open && event.id !== state.id && inside(event.point, state.apex, event.flyout)) { + // Each move restarts the wait: the flyout moves only once the pointer rests on the row. + if (state.status === "aiming" && state.target === event.id) + return { + state, + effects: [{ type: "schedule", kind: "aim", attempt: state.attempt, delayMs: FLYOUT_AIM_TIMEOUT_MS }], + } + const attempt = state.attempt + 1 + + return { + state: { + status: "aiming", + attempt, + id: state.id, + position: state.position, + apex: state.apex, + target: event.id, + }, + effects: [{ type: "schedule", kind: "aim", attempt, delayMs: FLYOUT_AIM_TIMEOUT_MS }], + } + } + + // Back on the flyout's own row: the pointer becomes the triangle's apex again. + if ((state.status === "open" || state.status === "opening") && state.id === event.id && event.activeId === event.id) { + state.apex.x = event.point.x + state.apex.y = event.point.y + + return same(state) + } + + if (state.status === "aiming" && state.id === event.id) { + const attempt = state.attempt + 1 + + return { + state: { + status: "open", + attempt, + id: state.id, + position: state.position, + apex: { x: event.point.x, y: event.point.y }, + }, + effects: event.activeId === event.id ? CANCEL : [...CANCEL, { type: "activate", id: event.id }], + } + } + + if (warm(state)) return show(state, event.id, event.point) + const attempt = state.attempt + 1 + + return { + state: { status: "opening", attempt, id: event.id, apex: { x: event.point.x, y: event.point.y } }, + effects: [ + ...(timed(state) ? CANCEL : NO_EFFECTS), + { type: "activate", id: event.id }, + { type: "schedule", kind: "open", attempt, delayMs: FLYOUT_OPEN_DELAY_MS }, + ], + } +} + +/** Opens the flyout on row `id` at once. An open flyout keeps its place until the new row is measured. */ +function show(state: LiveFlyout, id: string, point: FlyoutPoint): DialogFlyoutTransition { + const attempt = state.attempt + 1 + const position = state.status === "open" || state.status === "aiming" ? state.position : undefined + + return { + state: { status: "open", attempt, id, position, apex: { x: point.x, y: point.y } }, + effects: [...(timed(state) ? CANCEL : NO_EFFECTS), { type: "activate", id }, { type: "place", attempt, id }], + } +} + +/** The pointer reached the flyout or rests in its triangle: a pending move to another row is called off. */ +function settle(state: LiveFlyout): DialogFlyoutTransition { + if (state.status !== "aiming") return same(state) + + return { + state: { + status: "open", + attempt: state.attempt + 1, + id: state.id, + position: state.position, + apex: { x: state.apex.x, y: state.apex.y }, + }, + effects: CANCEL, + } +} + +/** The pointer left the flyout behind: it closes, and the next row's flyout opens at once for a moment. */ +function cool(state: LiveFlyout): DialogFlyoutTransition { + const attempt = state.attempt + 1 + + return { + state: { status: "closed", attempt, input: "pointer", warm: true }, + effects: [{ type: "schedule", kind: "warm", attempt, delayMs: FLYOUT_WARM_MS }], + } +} + +function same(state: DialogFlyoutState): DialogFlyoutTransition { + return { state, effects: NO_EFFECTS } +} + +function timed(state: LiveFlyout) { + return state.status === "opening" || state.status === "aiming" || (state.status === "closed" && state.warm) +} + +function warm(state: LiveFlyout) { + return state.status === "open" || state.status === "aiming" || (state.status === "closed" && state.warm) +} + +/** The row whose flyout shows, once it has a position. */ +export function selectFlyoutOpenId(state: DialogFlyoutState) { + if (state.status !== "open" && state.status !== "aiming") return undefined + + return state.position ? state.id : undefined +} + +/** Whether scrolling moves the highlight and flyout to the row under the pointer; a keyboard scroll keeps both. */ +export function selectFlyoutFollowsPointer(state: DialogFlyoutState) { + return state.status !== "disposed" && (state.status !== "closed" || state.input === "pointer") +} + +export function selectFlyoutPosition(state: DialogFlyoutState) { + if (state.status !== "open" && state.status !== "aiming") return undefined + + return state.position +} + +/** + * 6px beside the row's end edge, else its start edge, else over the layer: always inside the layer that holds it. + */ +export function placeFlyout(row: FlyoutRect, layer: FlyoutRect | undefined, rtl: boolean): FlyoutPosition { + const fits = (x: number) => !layer || (x >= layer.left && x + FLYOUT_WIDTH_PX <= layer.right) + const end = rtl ? row.left - FLYOUT_GAP_PX - FLYOUT_WIDTH_PX : row.right + FLYOUT_GAP_PX + const start = rtl ? row.right + FLYOUT_GAP_PX : row.left - FLYOUT_GAP_PX - FLYOUT_WIDTH_PX + const over = layer ? Math.max(layer.left, Math.min(end, layer.right - FLYOUT_WIDTH_PX)) : end + const left = fits(end) ? end : fits(start) ? start : over + + return { left, top: row.top - 2 } +} + +/** + * A fixed element is placed against the viewport unless an ancestor contains it, as a component preview that holds + * its dialogs does. Corrects by where it landed. + */ +export function correctFlyoutPosition(target: FlyoutPosition, placed: FlyoutPoint): FlyoutPosition { + if (placed.x === target.left && placed.y === target.top) return target + + return { left: target.left * 2 - placed.x, top: target.top * 2 - placed.y } +} + +/** + * Whether `point` lies in the triangle from the apex to the flyout's near corners, as on macOS. Allocation-free: it + * runs on every pointer move while a flyout is open. + */ +export function inside(point: FlyoutPoint, apex: FlyoutPoint, flyout: FlyoutRect | undefined) { + if (!flyout) return false + const x = flyout.left > apex.x ? flyout.left : flyout.right + const a = side(point, apex.x, apex.y, x, flyout.top) + const b = side(point, x, flyout.top, x, flyout.bottom) + const c = side(point, x, flyout.bottom, apex.x, apex.y) + + return !((a < 0 || b < 0 || c < 0) && (a > 0 || b > 0 || c > 0)) +} + +function side(point: FlyoutPoint, ax: number, ay: number, bx: number, by: number) { + return (point.x - bx) * (ay - by) - (ax - bx) * (point.y - by) +} + +// ── Mobile model drawer: close first, then act ─────────────────────────────── + +/** Longer than the drawer's 200ms close transition: the deferred action runs even if its end is never reported. */ +export const DRAWER_CLOSE_TIMEOUT_MS = 600 + +export type ModelDrawerAction = "select" | "manage" | "connect" + +export type ModelDrawerState = + /** Never opened: the drawer is not mounted yet. */ + | { readonly status: "unloaded" } + | { readonly status: "closed"; readonly attempt: number; readonly restoreTrigger: boolean } + | { readonly status: "open"; readonly attempt: number } + /** The close transition runs; `action` waits for it to end. */ + | { readonly status: "closing"; readonly attempt: number; readonly action: ModelDrawerAction | undefined } + | { readonly status: "disposed" } + +export type ModelDrawerEvent = + | { readonly type: "opened" } + | { readonly type: "dismissed" } + | { readonly type: "action.selected"; readonly action: ModelDrawerAction } + | { readonly type: "hidden" } + | { readonly type: "close.timed-out"; readonly attempt: number } + | { readonly type: "disposed" } + +export type ModelDrawerEffect = + | { readonly type: "schedule-close-timeout"; readonly attempt: number; readonly delayMs: number } + | { readonly type: "cancel-close-timeout" } + | { readonly type: "run-action"; readonly action: ModelDrawerAction } + +export type ModelDrawerTransition = { + readonly state: ModelDrawerState + readonly effects: readonly ModelDrawerEffect[] +} + +const NO_DRAWER_EFFECTS: readonly ModelDrawerEffect[] = [] + +export function createModelDrawerState(): ModelDrawerState { + return { status: "unloaded" } +} + +export function transitionModelDrawer(state: ModelDrawerState, event: ModelDrawerEvent): ModelDrawerTransition { + if (state.status === "disposed") return { state, effects: NO_DRAWER_EFFECTS } + + switch (event.type) { + case "disposed": + return { + state: { status: "disposed" }, + effects: state.status === "closing" ? [{ type: "cancel-close-timeout" }] : NO_DRAWER_EFFECTS, + } + case "opened": + if (state.status === "open") return { state, effects: NO_DRAWER_EFFECTS } + + if (state.status === "unloaded") return { state: { status: "open", attempt: 1 }, effects: NO_DRAWER_EFFECTS } + + // Reopened before the close transition ended: the action it was waiting for is called off. + return { + state: { status: "open", attempt: state.attempt + 1 }, + effects: state.status === "closing" ? [{ type: "cancel-close-timeout" }] : NO_DRAWER_EFFECTS, + } + case "dismissed": + case "action.selected": { + if (state.status !== "open") return { state, effects: NO_DRAWER_EFFECTS } + const attempt = state.attempt + 1 + + return { + state: { status: "closing", attempt, action: event.type === "action.selected" ? event.action : undefined }, + effects: [{ type: "schedule-close-timeout", attempt, delayMs: DRAWER_CLOSE_TIMEOUT_MS }], + } + } + + case "hidden": + if (state.status !== "closing") return { state, effects: NO_DRAWER_EFFECTS } + + return closed(state, [{ type: "cancel-close-timeout" }]) + case "close.timed-out": + if (state.status !== "closing" || state.attempt !== event.attempt) return { state, effects: NO_DRAWER_EFFECTS } + + return closed(state, NO_DRAWER_EFFECTS) + } +} + +function closed( + state: Extract, + effects: readonly ModelDrawerEffect[], +): ModelDrawerTransition { + return { + // An action takes focus elsewhere, so focus returns to the trigger only after a plain dismiss. + state: { status: "closed", attempt: state.attempt, restoreTrigger: state.action === undefined }, + effects: state.action ? [...effects, { type: "run-action", action: state.action }] : effects, + } +} + +export function selectDrawerLoaded(state: ModelDrawerState) { + return state.status !== "unloaded" +} + +export function selectDrawerOpen(state: ModelDrawerState) { + return state.status === "open" +} + +export function selectDrawerRestoreTrigger(state: ModelDrawerState) { + if (state.status === "closing") return state.action === undefined + + if (state.status === "closed") return state.restoreTrigger + + return true +} diff --git a/packages/app/src/providers/models/select-dialog.tsx b/packages/app/src/providers/models/select-dialog.tsx index 1eea1c82a1..88356338d7 100644 --- a/packages/app/src/providers/models/select-dialog.tsx +++ b/packages/app/src/providers/models/select-dialog.tsx @@ -4,6 +4,7 @@ import { ComponentProps, createEffect, createMemo, + createSignal, For, JSX, Show, @@ -11,6 +12,7 @@ import { lazy, on, onCleanup, + untrack, } from "solid-js" import { createStore } from "solid-js/store" import { useLocal, type ModelSelection } from "@/providers/models/selection" @@ -34,7 +36,23 @@ import { ExternalLink } from "@/runtime/platform/external-link" import { useData } from "@/runtime/server/current" import { useWorkspaceLocation } from "@/workspaces/location" import { createModelUsage, ModelUsageTag } from "@/usage/model" -import { createSafeTriangle } from "@/shell/commands/safe-triangle" +import { + correctFlyoutPosition, + createDialogFlyoutState, + createModelDrawerState, + placeFlyout, + selectDrawerLoaded, + selectDrawerOpen, + selectDrawerRestoreTrigger, + selectFlyoutFollowsPointer, + selectFlyoutOpenId, + selectFlyoutPosition, + transitionDialogFlyout, + transitionModelDrawer, + type DialogFlyoutEffect, + type DialogFlyoutEvent, + type ModelDrawerEvent, +} from "./select-dialog-machine" import { formatKeybindParts, matchKeybind, parseKeybind } from "@/shell/commands/command" import { createEventListener } from "@solid-primitives/event-listener" import { matchesModelSearch } from "./search" @@ -338,16 +356,32 @@ function ModelDrawer(props: { onConnect?: () => void }) { const language = useLanguage() + const [drawer, setDrawer] = createSignal(createModelDrawerState()) + let closeTimer: ReturnType | undefined + + const dispatch = (event: ModelDrawerEvent) => { + const next = transitionModelDrawer(untrack(drawer), event) + setDrawer(next.state) + next.effects.forEach((effect) => { + if (effect.type === "schedule-close-timeout") { + clearTimeout(closeTimer) + closeTimer = setTimeout(() => dispatch({ type: "close.timed-out", attempt: effect.attempt }), effect.delayMs) + + return + } - const [store, setStore] = createStore<{ - open: boolean - loaded: boolean - restoreTrigger: boolean - action?: "select" | "manage" | "connect" - }>({ - open: false, - loaded: false, - restoreTrigger: true, + if (effect.type === "cancel-close-timeout") return clearTimeout(closeTimer) + + if (effect.action === "manage") return props.onManage() + + if (effect.action === "connect") return props.onConnect?.() + queueMicrotask(props.onClose) + }) + } + + onCleanup(() => { + clearTimeout(closeTimer) + dispatch({ type: "disposed" }) }) let trigger: HTMLDivElement | undefined @@ -359,41 +393,25 @@ function ModelDrawer(props: { {props.trigger({ "aria-haspopup": "dialog", get "aria-expanded"() { - return store.open + return selectDrawerOpen(drawer()) }, - onClick: () => setStore({ open: true, loaded: true, restoreTrigger: true }), + onClick: () => dispatch({ type: "opened" }), })}
- + setStore("open", open)} + open={selectDrawerOpen(drawer())} + onOpenChange={(open) => dispatch({ type: open ? "opened" : "dismissed" })} initialFocus={() => content} returnFocus={() => trigger?.querySelector("button") ?? undefined} onFinalFocus={(event) => { - if (!store.restoreTrigger) event.preventDefault() + if (!selectDrawerRestoreTrigger(drawer())) event.preventDefault() }} onContentPresentChange={(present) => { - if (present) return - const action = store.action - setStore("action", undefined) - - if (action === "manage") { - props.onManage() - - return - } - - if (action === "connect") { - props.onConnect?.() - - return - } - - if (action === "select") queueMicrotask(props.onClose) + if (!present) dispatch({ type: "hidden" }) }} >
setStore({ open: false, action: "select", restoreTrigger: false })} + onSelect={() => dispatch({ type: "action.selected", action: "select" })} />
@@ -416,7 +434,7 @@ function ModelDrawer(props: { variant="ghost" class="w-full !h-10 !justify-start" icon="outline-sliders" - onClick={() => setStore({ open: false, action: "manage", restoreTrigger: false })} + onClick={() => dispatch({ type: "action.selected", action: "manage" })} > {language.t("dialog.model.manage")} @@ -425,7 +443,7 @@ function ModelDrawer(props: { variant="ghost" class="w-full !h-10 !justify-start" icon="plus" - onClick={() => setStore({ open: false, action: "connect", restoreTrigger: false })} + onClick={() => dispatch({ type: "action.selected", action: "connect" })} > {language.t("command.provider.connect")} @@ -622,26 +640,21 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState const chatgptPlan = createChatgptPlan(controller.current) const usage = createModelUsage({ refresh: true }) - const [store, setStore] = createStore({ - search: "", - flyout: "", - keyboard: true, - navigated: false, - warm: false, - position: { left: 0, top: 0 }, - }) - + // `navigated`: the arrows have moved through the results since the query last changed. + const [query, setQuery] = createStore({ search: "", navigated: false }) + const [flyout, setFlyout] = createSignal(createDialogFlyoutState()) const [staged, setStaged] = createStore>({}) let list: SearchListHandle | undefined let flyoutRef: HTMLDivElement | undefined + let scroller: HTMLDivElement | undefined let timer: ReturnType | undefined - onCleanup(() => clearTimeout(timer)) + let pointer: { x: number; y: number } | undefined const groups = createMemo((): ModelGroup[] => { - const providers = controller.groups(controller.models(store.search)) + const providers = controller.groups(controller.models(query.search)) - if (store.search.trim()) return providers + if (query.search.trim()) return providers return withSections({ groups: providers, @@ -656,7 +669,14 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState ) const rowItem = (id: string) => rows().find((row) => row.id === id)?.item - const flyoutItem = () => (store.flyout ? rowItem(store.flyout) : undefined) + const flyoutId = createMemo(() => selectFlyoutOpenId(flyout())) + + const flyoutItem = () => { + const id = flyoutId() + + return id ? rowItem(id) : undefined + } + const variantsOf = (item: ModelItem) => Object.keys(item.variants ?? {}) const favorite = (item: ModelItem) => controller.favorites().some((entry) => modelKey(entry) === modelKey(item)) @@ -666,7 +686,10 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState const choose = (item: ModelItem, value?: string | null) => controller.select(item, value === undefined ? staged[modelKey(item)] : value) - const setSearch = (value: string) => setStore({ search: value, flyout: "", keyboard: true, navigated: false }) + const setSearch = (value: string) => { + setQuery({ search: value, navigated: false }) + dispatch({ type: "keyboard" }) + } const manage = async () => { const { DialogManageModels } = await import("./manage") @@ -681,70 +704,63 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState void dialog.show(() => ) } - const triangle = createSafeTriangle({ - flyout: () => (flyoutItem() && flyoutRef?.isConnected ? flyoutRef : undefined), - }) + const flyoutRect = () => (flyoutRef?.isConnected ? flyoutRef.getBoundingClientRect() : undefined) - const openFlyout = (id: string, row: HTMLElement) => { - if (!row.closest('[data-slot="dialog-container"]')) return - const box = row.getBoundingClientRect() - // 6px beside the row's end edge, else its start edge, else over the dialog: always inside the layer that holds it. - const bounds = row.closest("[data-dialog-layer]")?.getBoundingClientRect() - const fits = (x: number) => !bounds || (x >= bounds.left && x + 160 <= bounds.right) - const end = language.direction() === "rtl" ? box.left - 6 - 160 : box.right + 6 - const start = language.direction() === "rtl" ? box.right + 6 : box.left - 6 - 160 - const over = bounds ? Math.max(bounds.left, Math.min(end, bounds.right - 160)) : end - const left = fits(end) ? end : fits(start) ? start : over - const top = box.top - 2 - setStore({ flyout: id, warm: true, position: { left, top } }) + const measure = (id: string) => { + const row = scroller?.querySelector( + `[data-slot="search-list-row"][data-option-key="${CSS.escape(id)}"]`, + ) - // A fixed element is placed against the viewport unless an ancestor contains it, as a component preview that holds - // its dialogs does. Correct by where it landed, before it paints. - const placed = flyoutRef?.isConnected ? flyoutRef.getBoundingClientRect() : undefined + if (!row?.closest('[data-slot="dialog-container"]')) return undefined - if (placed && (placed.left !== left || placed.top !== top)) - setStore("position", { left: left * 2 - placed.left, top: top * 2 - placed.top }) + return placeFlyout( + row.getBoundingClientRect(), + row.closest("[data-dialog-layer]")?.getBoundingClientRect(), + language.direction() === "rtl", + ) } - // The row whose flyout is waiting on the open delay. - let pending = "" + const dispatch = (event: DialogFlyoutEvent) => { + const next = transitionDialogFlyout(untrack(flyout), event) + // Written before the effects run, so a `place` measures the flyout this state renders. + setFlyout(next.state) + next.effects.forEach(runFlyoutEffect) + } - const hover = (id: string, row: HTMLElement) => { - // A row highlighted by a scroll has no flyout yet, so moving on it still opens one. - if (list?.active()?.id === id && !store.keyboard && (store.flyout === id || pending === id)) return - list?.setActive(id) - setStore("keyboard", false) - clearTimeout(timer) - pending = "" - const item = rowItem(id) + const runFlyoutEffect = (effect: DialogFlyoutEffect) => { + if (effect.type === "activate") return list?.setActive(effect.id) - if (!item) return setStore("flyout", "") + if (effect.type === "cancel") return clearTimeout(timer) - if (store.warm) return openFlyout(id, row) + if (effect.type === "schedule") { + clearTimeout(timer) + timer = setTimeout(() => { + if (effect.kind === "open") return dispatch({ type: "open.due", attempt: effect.attempt }) - setStore("flyout", "") - pending = id - timer = setTimeout(() => { - pending = "" - openFlyout(id, row) - }, 100) - } + if (effect.kind === "aim") return dispatch({ type: "aim.due", attempt: effect.attempt, point: pointer }) + dispatch({ type: "warm.expired", attempt: effect.attempt }) + }, effect.delayMs) + + return + } - // Rows the pointer crosses on its way into the open flyout leave it alone. - const move = (id: string, event: MouseEvent & { currentTarget: HTMLElement }) => { - // A still cursor must not take the highlight while the arrow keys scroll rows beneath it. - if (event.movementX === 0 && event.movementY === 0) return - const row = event.currentTarget - const point = { x: event.clientX, y: event.clientY } + const position = measure(effect.id) + dispatch({ type: "placed", attempt: effect.attempt, position }) + // A fixed element is placed against the viewport unless an ancestor contains it, as a component preview that holds + // its dialogs does. Correct by where it landed, before it paints. + const placed = position ? flyoutRect() : undefined - if (flyoutItem() && store.flyout !== id && triangle.hold(point, () => hover(id, row))) return - triangle.anchor(point) - hover(id, row) + if (!position || !placed) return + const corrected = correctFlyoutPosition(position, { x: placed.left, y: placed.top }) + + if (corrected !== position) dispatch({ type: "placed", attempt: effect.attempt, position: corrected }) } - const close = () => setStore("flyout", "") + onCleanup(() => { + clearTimeout(timer) + dispatch({ type: "disposed" }) + }) - let pointer: { x: number; y: number } | undefined createEventListener(document, "pointermove", (event: PointerEvent) => { pointer = { x: event.clientX, y: event.clientY } }) @@ -753,21 +769,17 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState // under the cursor and moves the flyout beside it; a keyboard scroll keeps its highlight and closes the flyout, // which would otherwise be left beside a row that moved away. const follow = () => { - clearTimeout(timer) - pending = "" + if (!selectFlyoutFollowsPointer(untrack(flyout))) return + const point = pointer - if (store.keyboard || !pointer) return close() - const row = document.elementFromPoint(pointer.x, pointer.y)?.closest('[data-slot="search-list-row"]') - const id = row?.dataset.optionKey + const row = point + ? document.elementFromPoint(point.x, point.y)?.closest('[data-slot="search-list-row"]') + : undefined - if (!row || !id || !scroller?.contains(row)) return close() - list?.setActive(id) - triangle.anchor(pointer) - openFlyout(id, row) + const id = row?.dataset.optionKey + dispatch({ type: "scrolled", target: point && row && id && scroller?.contains(row) ? { id, point } : undefined }) } - let scroller: HTMLDivElement | undefined - // As on the home page, every header sticks for the whole list, so the next one slides over the stuck one while the // stuck label fades out over 16px. The topmost stuck header also fades a gradient in as rows scroll beneath it. const fadeHeaders = () => { @@ -813,22 +825,22 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState }), ) + // The flyout's row left the results, such as when the models change, so it would be left beside nothing. createEffect(() => { - if (!flyoutItem()) { - triangle.reset() + if (flyoutId() && !flyoutItem()) dispatch({ type: "dismissed" }) + }) - return - } - // Outside the rows, such as the gap before the flyout, leaving the triangle closes it. + createEffect(() => { + if (!flyoutId()) return + // Outside the rows, such as the gap before the flyout, leaving the triangle closes it. createEventListener(document, "pointermove", (event: PointerEvent) => { const target = event.target if (target instanceof Element && target.closest('[data-slot="search-list-row"]')) return if (target instanceof Node && flyoutRef?.contains(target)) return - - if (!triangle.contains({ x: event.clientX, y: event.clientY })) close() + dispatch({ type: "pointer.outside", point: { x: event.clientX, y: event.clientY }, flyout: flyoutRect() }) }) }) @@ -859,7 +871,7 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState }) // The flyout is placed once when it opens, so moving the rows under it closes it instead. - createEventListener(window, "resize", close) + createEventListener(window, "resize", () => dispatch({ type: "dismissed" })) const onKeyDown = (event: KeyboardEvent, active: ModelRow | undefined) => { if (matchKeybind(favoriteKeybind, event)) { @@ -868,13 +880,14 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState controller.toggleFavorite(active.item) // The model moves between Favorites and its group under the same key, so the highlight follows it. list?.setActive(active.id) - setStore({ flyout: "", keyboard: true }) + dispatch({ type: "keyboard" }) return } if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Home" || event.key === "End") { - setStore({ keyboard: true, navigated: true, flyout: "" }) + setQuery("navigated", true) + dispatch({ type: "keyboard" }) return } @@ -882,7 +895,7 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState if (event.metaKey || event.altKey || event.ctrlKey) return // While searching, left and right edit the query until the arrows have moved through the results. - if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && (!store.search || store.navigated)) { + if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && (!query.search || query.navigated)) { const item = active?.item if (!item || variantsOf(item).length === 0) return @@ -891,7 +904,7 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState const direction = (event.key === "ArrowRight") !== (language.direction() === "rtl") ? 1 : -1 const index = options.indexOf(variant(item)) setStaged(modelKey(item), options[(index + direction + options.length) % options.length] ?? null) - setStore({ keyboard: true, flyout: "" }) + dispatch({ type: "keyboard" }) } } @@ -906,18 +919,29 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState {...row.attrs} data-option-key={row.model.id} aria-current={selected() ? "true" : undefined} - onMouseMove={(event) => move(row.model.id, event)} + onMouseMove={(event) => { + // A still cursor must not take the highlight while the arrow keys scroll rows beneath it. + if (event.movementX === 0 && event.movementY === 0) return + + dispatch({ + type: "row.moved", + id: row.model.id, + activeId: list?.active()?.id, + point: { x: event.clientX, y: event.clientY }, + flyout: flyoutRect(), + }) + }} onMouseLeave={(event) => { - clearTimeout(timer) - pending = "" const target = event.relatedTarget - if (target instanceof Element && target.closest('[data-slot="search-list-row"]')) return - - if (target instanceof Node && flyoutRef?.contains(target)) return + const into = + target instanceof Element && target.closest('[data-slot="search-list-row"]') + ? "row" + : target instanceof Node && flyoutRef?.contains(target) + ? "flyout" + : "outside" - if (flyoutItem() && triangle.contains({ x: event.clientX, y: event.clientY })) return - close() + dispatch({ type: "row.left", into, point: { x: event.clientX, y: event.clientY }, flyout: flyoutRect() }) }} > @@ -975,12 +999,12 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState { capture: true }, ) // A wheel scroll is the pointer's, so the highlight and flyout follow the row under it. - createEventListener(element, "wheel", () => setStore("keyboard", false), { passive: true }) + createEventListener(element, "wheel", () => dispatch({ type: "wheel" }), { passive: true }) }} > (list = handle)} - query={store.search} + query={query.search} onQuery={setSearch} placeholder={language.t("dialog.model.search.placeholder")} trailing={ @@ -1037,8 +1061,11 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState ref={(element) => (flyoutRef = element)} data-component="menu-v2-content" data-slot="model-dialog-flyout" - style={{ left: `${store.position.left}px`, top: `${store.position.top}px` }} - onMouseEnter={() => triangle.cancel()} + style={{ + left: `${selectFlyoutPosition(flyout())?.left ?? 0}px`, + top: `${selectFlyoutPosition(flyout())?.top ?? 0}px`, + }} + onMouseEnter={() => dispatch({ type: "flyout.entered" })} > {/* A model without variants still lists Default, its only option. */} @@ -1071,7 +1098,7 @@ export function DialogSelectModel(props: { provider?: string; model?: ModelState onClick={() => { // The row moves between Favorites and its group, so the flyout would be left beside nothing. controller.toggleFavorite(item()) - close() + dispatch({ type: "dismissed" }) }} > diff --git a/packages/app/src/providers/models/selection.tsx b/packages/app/src/providers/models/selection.tsx index 96c661fc1a..93591a5e8f 100644 --- a/packages/app/src/providers/models/selection.tsx +++ b/packages/app/src/providers/models/selection.tsx @@ -5,7 +5,7 @@ import { batch, createEffect, createMemo, createRoot, createSignal, onCleanup, u import { Predicate, Schema, SchemaGetter } from "effect" import { useModels } from "@/providers/models/models" import { useSettings } from "@/settings/model" -import { syncWhileBooting, useProviders } from "@/providers/catalog/providers" +import { useProviders } from "@/providers/catalog/providers" import { Persist, persisted } from "@/runtime/persistence/storage" import { Persistence } from "@/runtime/persistence/schema" import { usePlatform, type Platform } from "@/runtime/platform/platform" @@ -331,7 +331,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ const directory = sdk().directory if (!directory) return - void syncWhileBooting(() => data.location.agent.sync({ directory })).catch(() => undefined) + void data.location.agent.sync({ directory }).catch(() => undefined) }) const agentsVisible = createMemo(() => settings.visibility.customAgents() || hasCustomAgent(list())) diff --git a/packages/app/src/runtime/i18n/am.ts b/packages/app/src/runtime/i18n/am.ts index a63b05c35f..db10d16196 100644 --- a/packages/app/src/runtime/i18n/am.ts +++ b/packages/app/src/runtime/i18n/am.ts @@ -333,7 +333,6 @@ export const dict = { "session.new.project.search": "የፍለጋ ፕሮጀክቶች", "session.new.project.add": "ፕሮጀክት አክል", "session.new.workspace.runIn": "ክፍለ ጊዜን በ ውስጥ ያሂዱ", - "session.new.workspace.triggerLocal": "አካባቢ", "session.new.workspace.local": "አካባቢያዊ ማከማቻ", "session.new.git.none": "ያለ Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/ar.ts b/packages/app/src/runtime/i18n/ar.ts index 283727f8f5..eb5286d1f6 100644 --- a/packages/app/src/runtime/i18n/ar.ts +++ b/packages/app/src/runtime/i18n/ar.ts @@ -344,7 +344,6 @@ export const dict = { "session.new.project.search": "البحث عن المشاريع", "session.new.project.add": "إضافة مشروع", "session.new.workspace.runIn": "تشغيل الجلسة في", - "session.new.workspace.triggerLocal": "محلي", "session.new.workspace.local": "المستودع المحلي", "session.new.git.none": "لا يوجد Git", "settings.tab.servers": "الخوادم", diff --git a/packages/app/src/runtime/i18n/az.ts b/packages/app/src/runtime/i18n/az.ts index 4c022f8061..729cff6bbc 100644 --- a/packages/app/src/runtime/i18n/az.ts +++ b/packages/app/src/runtime/i18n/az.ts @@ -343,7 +343,6 @@ export const dict = { "session.new.project.search": "Layihələri axtarın", "session.new.project.add": "Layihə əlavə edin", "session.new.workspace.runIn": "Sessiyanı burada işə sal", - "session.new.workspace.triggerLocal": "Yerli", "session.new.workspace.local": "Yerli depo", "session.new.git.none": "Git yoxdur", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/bg.ts b/packages/app/src/runtime/i18n/bg.ts index ae3db9b2b6..3d2955741b 100644 --- a/packages/app/src/runtime/i18n/bg.ts +++ b/packages/app/src/runtime/i18n/bg.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Търсене на проекти", "session.new.project.add": "Добавете проект", "session.new.workspace.runIn": "Стартирайте сесията", - "session.new.workspace.triggerLocal": "Местен", "session.new.workspace.local": "Локално хранилище", "session.new.git.none": "Не Git", "session.header.open.finder": "Търсач", diff --git a/packages/app/src/runtime/i18n/bn.ts b/packages/app/src/runtime/i18n/bn.ts index 917e9a7e84..447feb1203 100644 --- a/packages/app/src/runtime/i18n/bn.ts +++ b/packages/app/src/runtime/i18n/bn.ts @@ -341,7 +341,6 @@ export const dict = { "session.new.project.search": "অনুসন্ধান প্রকল্প", "session.new.project.add": "প্রকল্প যোগ করুন", "session.new.workspace.runIn": "সেশন চালান", - "session.new.workspace.triggerLocal": "স্থানীয়", "session.new.workspace.local": "স্থানীয় সংগ্রহস্থল", "session.new.git.none": "না Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/br.ts b/packages/app/src/runtime/i18n/br.ts index 74f461aeb1..c08a3a7580 100644 --- a/packages/app/src/runtime/i18n/br.ts +++ b/packages/app/src/runtime/i18n/br.ts @@ -549,7 +549,6 @@ export const dict = { "session.new.project.search": "Buscar projetos", "session.new.project.add": "Adicionar projeto", "session.new.workspace.runIn": "Executar sessão em", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Repositório local", "session.new.git.none": "Sem Git", "settings.tab.servers": "Servidores", diff --git a/packages/app/src/runtime/i18n/bs.ts b/packages/app/src/runtime/i18n/bs.ts index 18fb92eb47..7e90624196 100644 --- a/packages/app/src/runtime/i18n/bs.ts +++ b/packages/app/src/runtime/i18n/bs.ts @@ -373,7 +373,6 @@ export const dict = { "session.new.project.search": "Pretraži projekte", "session.new.project.add": "Dodaj projekat", "session.new.workspace.runIn": "Pokreni sesiju u", - "session.new.workspace.triggerLocal": "Lokalno", "session.new.workspace.local": "Lokalni repozitorij", "session.new.git.none": "Nema Gita", diff --git a/packages/app/src/runtime/i18n/ca.ts b/packages/app/src/runtime/i18n/ca.ts index 9760cca35d..399d51c801 100644 --- a/packages/app/src/runtime/i18n/ca.ts +++ b/packages/app/src/runtime/i18n/ca.ts @@ -339,7 +339,6 @@ export const dict = { "session.new.project.search": "Cerca projectes", "session.new.project.add": "Afegeix projecte", "session.new.workspace.runIn": "Executeu la sessió", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Repositori local", "session.new.git.none": "Sense Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/cs.ts b/packages/app/src/runtime/i18n/cs.ts index 5a88e85b02..232a1a543e 100644 --- a/packages/app/src/runtime/i18n/cs.ts +++ b/packages/app/src/runtime/i18n/cs.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Hledat projekty", "session.new.project.add": "Přidat projekt", "session.new.workspace.runIn": "Spustit relaci", - "session.new.workspace.triggerLocal": "Místní", "session.new.workspace.local": "Místní úložiště", "session.new.git.none": "ne Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/da.ts b/packages/app/src/runtime/i18n/da.ts index b6a4dc1a94..b89b381b15 100644 --- a/packages/app/src/runtime/i18n/da.ts +++ b/packages/app/src/runtime/i18n/da.ts @@ -500,7 +500,6 @@ export const dict = { "session.new.project.search": "Søg efter projekter", "session.new.project.add": "Tilføj projekt", "session.new.workspace.runIn": "Kør session i", - "session.new.workspace.triggerLocal": "Lokal", "session.new.workspace.local": "Lokalt repository", "session.new.git.none": "Ingen Git", diff --git a/packages/app/src/runtime/i18n/de.ts b/packages/app/src/runtime/i18n/de.ts index c216d95ec8..3e30fa70f1 100644 --- a/packages/app/src/runtime/i18n/de.ts +++ b/packages/app/src/runtime/i18n/de.ts @@ -483,7 +483,6 @@ export const dict = { "session.new.project.search": "Projekte durchsuchen", "session.new.project.add": "Projekt hinzufügen", "session.new.workspace.runIn": "Sitzung ausführen in", - "session.new.workspace.triggerLocal": "Lokal", "session.new.workspace.local": "Lokales Repository", "session.new.git.none": "Kein Git", "settings.tab.servers": "Server", diff --git a/packages/app/src/runtime/i18n/dv.ts b/packages/app/src/runtime/i18n/dv.ts index c6492f8b99..8b7ffe976f 100644 --- a/packages/app/src/runtime/i18n/dv.ts +++ b/packages/app/src/runtime/i18n/dv.ts @@ -348,7 +348,6 @@ export const dict = { "session.new.project.search": "ޕްރޮޖެކްޓްތައް ހޯދުން", "session.new.project.add": "ޕްރޮޖެކްޓް އިތުރުކުރުން", "session.new.workspace.runIn": "ރަން ސެޝަން އިން", - "session.new.workspace.triggerLocal": "ލޯކަލް", "session.new.workspace.local": "ލޯކަލް ރިޕޮޒިޓަރީ", "session.new.git.none": "އެއްވެސް Git އެއް ނެތެވެ", "session.header.open.finder": "Finder އެވެ", diff --git a/packages/app/src/runtime/i18n/dz.ts b/packages/app/src/runtime/i18n/dz.ts index f56b034d8f..5d1c63253f 100644 --- a/packages/app/src/runtime/i18n/dz.ts +++ b/packages/app/src/runtime/i18n/dz.ts @@ -350,7 +350,6 @@ export const dict = { "session.new.project.search": "ལས་གཞི་འཚོལ་ཞིབ།", "session.new.project.add": "ལས་འགུལ་ཁ་སྐོང་རྐྱབས།", "session.new.workspace.runIn": "ནང་ལཱ་ཡུན་གཡོག་བཀོལ།", - "session.new.workspace.triggerLocal": "ས་གནས་ཀྱི", "session.new.workspace.local": "ས་གནས་ཀྱི་མཛོད་ཁང་།", "session.new.git.none": "མེད། Git།", "session.header.open.finder": "Finder།", diff --git a/packages/app/src/runtime/i18n/el.ts b/packages/app/src/runtime/i18n/el.ts index b0bd60ab36..a09a64f342 100644 --- a/packages/app/src/runtime/i18n/el.ts +++ b/packages/app/src/runtime/i18n/el.ts @@ -342,7 +342,6 @@ export const dict = { "session.new.project.search": "Αναζήτηση έργων", "session.new.project.add": "Προσθήκη έργου", "session.new.workspace.runIn": "Εκτέλεση συνεδρίας σε", - "session.new.workspace.triggerLocal": "Τοπική", "session.new.workspace.local": "Τοπικό αποθετήριο", "session.new.git.none": "Χωρίς Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/en.ts b/packages/app/src/runtime/i18n/en.ts index 80f4213bc0..0d77a753ef 100644 --- a/packages/app/src/runtime/i18n/en.ts +++ b/packages/app/src/runtime/i18n/en.ts @@ -24,7 +24,7 @@ export const dict = { "session.location.choose": "Choose directory", "session.location.worktree": "Choose worktree", "session.location.worktreesFailed": "Failed to load worktrees", - "session.rewind.toast.title": "Rewound", + "session.rewind.toast.title": "Reverted", "session.rewind.toast.undo": "Undo", "session.location.moving": "Moving session…", "session.location.moveFailed": "Failed to move session", @@ -80,6 +80,7 @@ export const dict = { "command.file.open": "Open file", "command.tab.close": "Close tab", "command.tab.reopenClosed": "Reopen closed tab", + "command.tab.closeSession": "Close session tab", "command.context.addSelection": "Add selection to context", "command.context.addSelection.description": "Add selected lines from the current file", "command.input.focus": "Focus input", @@ -249,6 +250,7 @@ export const dict = { "provider.connect.form.open": "Open link", "provider.connect.form.openAgain": "Open link again", "provider.connect.form.finished": "I finished", + "provider.connect.form.browserFailed": "We couldn't open your browser. Open the link below, then select I finished.", "provider.connect.form.selectOne": "Select at least one option", "provider.connect.form.minItems": "Select at least {{count}}", "provider.connect.form.maxItems": "Select at most {{count}}", @@ -391,6 +393,7 @@ export const dict = { "dialog.mcp.signIn.paste.label": "Redirect URL", "dialog.mcp.signIn.paste.placeholder": "http://127.0.0.1:…/callback?code=…", "dialog.mcp.signIn.paste.required": "Paste the URL from the browser's address bar", + "dialog.mcp.signIn.syncFailed": "Signed in, but couldn't refresh {{name}}: {{error}}", "dialog.mcp.error.details": "MCP server: {{name}}\nStatus: failed\nConfiguration: mcp.servers.{{name}}\nError: {{error}}", "dialog.fork.search.empty": "No messages found", @@ -491,6 +494,7 @@ export const dict = { "toast.permissions.autoaccept.off.description": "Permission requests will require approval", "toast.file.loadFailed.title": "Failed to load file", + "toast.language.loadFailed.title": "Failed to load {{language}}", "toast.file.listFailed.title": "Failed to list files", "toast.context.noLineSelection.title": "No line selection", @@ -500,6 +504,7 @@ export const dict = { "toast.session.export.success.description": "Saved session to {{filename}}", "toast.session.export.failed.title": "Failed to export session", "toast.session.export.failed.description": "An error occurred while exporting the session", + "toast.session.import.pending": "Importing session…", "toast.session.copyID.failed.title": "Failed to copy session ID", "toast.session.copyID.failed.description": "An error occurred while copying the session ID", "toast.project.copyID.failed.title": "Failed to copy project ID", @@ -615,6 +620,9 @@ export const dict = { "session.panel.bottom": "Bottom panel", "session.panel.bottom.hide": "Hide bottom panel", "session.error.notFound": "This session cannot be found", + "session.reference.open": "Open Session", + "session.reference.copyTitle": "Copy Session Title", + "session.reference.copyTitle.failed": "Failed to copy session title", "session.error.notFound.description": "This tab points to a session that no longer exists on this server.", "session.error.notFound.closeTab": "Close Tab", "session.error.incompatible": "This server version isn't supported", @@ -637,6 +645,7 @@ export const dict = { "session.queue.count.one": "{{count}} queued", "session.queue.count.other": "{{count}} queued", "session.queue.steer": "Steer", + "session.queue.first": "Queue first", "session.queue.send": "Send", "session.queue.steerTooltip": "Send without interrupting", "session.queue.remove": "Remove", @@ -696,8 +705,8 @@ export const dict = { "session.new.project.trigger.tooltip": "Choose project", "session.new.worktree.creating": "Creating worktree", "session.new.starting": "Starting session", + "session.new.timedOut": "The server took too long to respond. Send again to retry.", "session.new.workspace.runIn": "Run session in", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Local repository", "session.new.workspace.existingLabel": "Worktree", "session.new.workspace.fromBranch": "from {{branch}}", @@ -808,6 +817,13 @@ export const dict = { "sidebar.inbox.elapsed.days.one": "{{count}}d", "sidebar.inbox.elapsed.days.other": "{{count}}d", "sidebar.inbox.time.now": "now", + "sidebar.recent.pinned": "Pinned", + "sidebar.recent.section.recent": "Recent", + "sidebar.recent.empty": "No recent sessions", + "sidebar.recent.pin": "Pin", + "sidebar.recent.unpin": "Unpin", + "sidebar.recent.moveUp": "Move up", + "sidebar.recent.moveDown": "Move down", "sidebar.project.recentSessions": "Recent sessions", "sidebar.project.clearNotifications": "Clear notifications", @@ -843,14 +859,46 @@ export const dict = { "settings.experimental.row.newQuestionUI.description": "Preview the keyboard-first question dock", "settings.experimental.row.sidebarOrganize.title": "Organize vertical sidebar", "settings.experimental.row.sidebarOrganize.description": - "Group side tabs by project or show one list. Only applies to side tabs.", + "Choose how sessions are listed in the sidebar. Only applies to side tabs.", + "settings.experimental.sidebarOrganize.recent": "Recent", "settings.experimental.sidebarOrganize.projects": "Projects", "settings.experimental.sidebarOrganize.list": "One list", + "settings.experimental.sidebarOrganize.customize": "Customize", "sidebar.organize.projects": "Projects", "sidebar.organize.openTab": "Open tab", "sidebar.organize.showMore": "Show more", "sidebar.organize.showLess": "Show less", "sidebar.organize.empty": "No sessions yet", + "sidebar.view.sessions": "Sessions", + "sidebar.view.options": "View options", + "sidebar.view.grouping": "Group by", + "sidebar.view.grouping.none": "None", + "sidebar.view.grouping.project": "Project", + "sidebar.view.grouping.server-project": "Server → Project", + "sidebar.view.grouping.server": "Server", + "sidebar.view.ordering": "Sort by", + "sidebar.view.ordering.manual": "Manual", + "sidebar.view.ordering.updated": "Updated", + "sidebar.view.ordering.created": "Created", + "sidebar.view.ordering.attention": "Attention", + "sidebar.view.ordering.hint": "Open tabs stay above recent sessions", + "sidebar.view.show": "Show", + "sidebar.view.show.recent": "Recent sessions", + "sidebar.view.show.subagents": "Subagents", + "sidebar.view.show.serverLabels": "Server labels", + "sidebar.view.filter.status": "Status", + "sidebar.view.filter.server": "Server", + "sidebar.view.filter.project": "Project", + "sidebar.view.status.input": "Needs input", + "sidebar.view.status.running": "Running", + "sidebar.view.status.unread": "Unread", + "sidebar.view.status.failed": "Failed", + "sidebar.view.status.idle": "Idle", + "sidebar.view.project.none": "No project", + "sidebar.view.other": "Other", + "sidebar.view.resetFilters": "Reset filters", + "sidebar.view.markAllRead": "Mark all as read", + "sidebar.view.noMatch": "No other sessions match", "settings.plugins.reload": "Reload", "settings.plugins.status.loading": "Loading", "settings.plugins.status.failed": "Failed", @@ -943,6 +991,13 @@ export const dict = { "settings.extensions.availableAll": "Available to all projects", "settings.extensions.manageConfig": "Manage in opencode.json", "settings.extensions.addSkills": "How to add skills", + "settings.extensions.plugins.loadFailed": "Could not load plugins", + "settings.extensions.sources.loadFailed": "Could not load extension sources", + "settings.extensions.console.temporary": + "Switches temporarily control MCP connections for the current project, not your Console preferences. Server configuration changes can reconnect them.", + "settings.extensions.console.replaced": "Replaces OpenCode Console", + "settings.extensions.console.connect": "Connect {{name}} in Console", + "settings.extensions.console.manage": "Manage {{name}} in Console", "project.settings.title": "Edit project", "project.settings.autoAccept.description": "Approve this project's permission requests without asking", "project.settings.autoAccept.default.on": "Use default (On)", @@ -1204,6 +1259,9 @@ export const dict = { "settings.permissions.tool.doom_loop.title": "Doom Loop", "settings.permissions.tool.doom_loop.description": "Detect repeated tool calls with identical input", + "session.markRead": "Mark as read", + "session.markUnread": "Mark as unread", + "session.delete.failed.title": "Failed to delete session", "session.delete.title": "Delete session", "session.delete.confirm": 'Delete session "{{name}}"?', diff --git a/packages/app/src/runtime/i18n/es.ts b/packages/app/src/runtime/i18n/es.ts index d01912a786..3ae91a09d4 100644 --- a/packages/app/src/runtime/i18n/es.ts +++ b/packages/app/src/runtime/i18n/es.ts @@ -590,7 +590,6 @@ export const dict = { "session.new.project.search": "Buscar proyectos", "session.new.project.add": "Añadir proyecto", "session.new.workspace.runIn": "Ejecutar sesión en", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Repositorio local", "session.new.git.none": "Sin Git", diff --git a/packages/app/src/runtime/i18n/et.ts b/packages/app/src/runtime/i18n/et.ts index d7e3bbec0e..de0a2f1e72 100644 --- a/packages/app/src/runtime/i18n/et.ts +++ b/packages/app/src/runtime/i18n/et.ts @@ -335,7 +335,6 @@ export const dict = { "session.new.project.search": "Otsige projekte", "session.new.project.add": "Lisa projekt", "session.new.workspace.runIn": "Käivitage seanss", - "session.new.workspace.triggerLocal": "Kohalik", "session.new.workspace.local": "Kohalik hoidla", "session.new.git.none": "Ei Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/fa.ts b/packages/app/src/runtime/i18n/fa.ts index fb2209cfb7..0b79749e8a 100644 --- a/packages/app/src/runtime/i18n/fa.ts +++ b/packages/app/src/runtime/i18n/fa.ts @@ -346,7 +346,6 @@ export const dict = { "session.new.project.search": "جستجوی پروژه ها", "session.new.project.add": "اضافه کردن پروژه", "session.new.workspace.runIn": "اجرای جلسه در", - "session.new.workspace.triggerLocal": "محلی", "session.new.workspace.local": "مخزن محلی", "session.new.git.none": "Git وجود ندارد", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/fi.ts b/packages/app/src/runtime/i18n/fi.ts index b08725930d..5af568fcfb 100644 --- a/packages/app/src/runtime/i18n/fi.ts +++ b/packages/app/src/runtime/i18n/fi.ts @@ -474,7 +474,6 @@ export const dict = { "session.new.project.search": "Etsi projekteja", "session.new.project.add": "Lisää projekti", "session.new.workspace.runIn": "Suorita istunto kohteessa", - "session.new.workspace.triggerLocal": "Paikallinen", "session.new.workspace.local": "Paikallinen säilö", "session.new.git.none": "Ei Gitiä", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/fo.ts b/packages/app/src/runtime/i18n/fo.ts index 2129f5bfa9..0db2b8b87c 100644 --- a/packages/app/src/runtime/i18n/fo.ts +++ b/packages/app/src/runtime/i18n/fo.ts @@ -337,7 +337,6 @@ export const dict = { "session.new.project.search": "Leita verkætlanir", "session.new.project.add": "Legg verkætlan til", "session.new.workspace.runIn": "Koyr setu í", - "session.new.workspace.triggerLocal": "Lokal", "session.new.workspace.local": "Lokal goymsla", "session.new.git.none": "Nei Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/fr.ts b/packages/app/src/runtime/i18n/fr.ts index 55425d2ffb..58b1ccacee 100644 --- a/packages/app/src/runtime/i18n/fr.ts +++ b/packages/app/src/runtime/i18n/fr.ts @@ -555,7 +555,6 @@ export const dict = { "session.new.project.search": "Rechercher des projets", "session.new.project.add": "Ajouter un projet", "session.new.workspace.runIn": "Exécuter la session dans", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Dépôt local", "session.new.git.none": "Pas de Git", "settings.tab.servers": "Serveurs", diff --git a/packages/app/src/runtime/i18n/he.ts b/packages/app/src/runtime/i18n/he.ts index c698dadd64..49e766cffa 100644 --- a/packages/app/src/runtime/i18n/he.ts +++ b/packages/app/src/runtime/i18n/he.ts @@ -345,7 +345,6 @@ export const dict = { "session.new.project.search": "חיפוש פרויקטים", "session.new.project.add": "הוסף פרויקט", "session.new.workspace.runIn": "הפעל את ההפעלה ב:", - "session.new.workspace.triggerLocal": "מקומי", "session.new.workspace.local": "מאגר מקומי", "session.new.git.none": "אין Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/hi.ts b/packages/app/src/runtime/i18n/hi.ts index 9a5367ad25..9b1c552a3e 100644 --- a/packages/app/src/runtime/i18n/hi.ts +++ b/packages/app/src/runtime/i18n/hi.ts @@ -345,7 +345,6 @@ export const dict = { "session.new.project.search": "प्रोजेक्ट खोजें", "session.new.project.add": "प्रोजेक्ट जोड़ें", "session.new.workspace.runIn": "सेशन यहाँ चलाएँ", - "session.new.workspace.triggerLocal": "स्थानीय", "session.new.workspace.local": "स्थानीय रिपॉजिटरी", "session.new.git.none": "कोई Git नहीं", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/hr.ts b/packages/app/src/runtime/i18n/hr.ts index f47a46269e..86fe21e1d2 100644 --- a/packages/app/src/runtime/i18n/hr.ts +++ b/packages/app/src/runtime/i18n/hr.ts @@ -352,7 +352,6 @@ export const dict = { "session.new.project.search": "Pretražite projekte", "session.new.project.add": "Dodaj projekt", "session.new.workspace.runIn": "Pokrenite sesiju", - "session.new.workspace.triggerLocal": "Lokalni", "session.new.workspace.local": "Lokalno spremište", "session.new.git.none": "Ne Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/hu.ts b/packages/app/src/runtime/i18n/hu.ts index 989c665c6d..f36006e931 100644 --- a/packages/app/src/runtime/i18n/hu.ts +++ b/packages/app/src/runtime/i18n/hu.ts @@ -350,7 +350,6 @@ export const dict = { "session.new.project.search": "Projektek keresése", "session.new.project.add": "Projekt hozzáadása", "session.new.workspace.runIn": "Futtassa a munkamenetet", - "session.new.workspace.triggerLocal": "Helyi", "session.new.workspace.local": "Helyi adattár", "session.new.git.none": "Nincs Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/hy.ts b/packages/app/src/runtime/i18n/hy.ts index c284fa0260..e6fcd771a2 100644 --- a/packages/app/src/runtime/i18n/hy.ts +++ b/packages/app/src/runtime/i18n/hy.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Որոնել նախագծեր", "session.new.project.add": "Ավելացնել նախագիծ", "session.new.workspace.runIn": "Գործարկել նիստը", - "session.new.workspace.triggerLocal": "Տեղական", "session.new.workspace.local": "Տեղական պահոց", "session.new.git.none": "Առանց Git-ի", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/id.ts b/packages/app/src/runtime/i18n/id.ts index c5093b0b39..42095b18c5 100644 --- a/packages/app/src/runtime/i18n/id.ts +++ b/packages/app/src/runtime/i18n/id.ts @@ -396,7 +396,6 @@ export const dict = { "session.new.project.search": "Cari proyek", "session.new.project.add": "Tambah proyek", "session.new.workspace.runIn": "Jalankan sesi dalam", - "session.new.workspace.triggerLocal": "Lokal", "session.new.workspace.local": "Repositori lokal", "session.new.git.none": "Tanpa Git", diff --git a/packages/app/src/runtime/i18n/is.ts b/packages/app/src/runtime/i18n/is.ts index a38af244fd..ab679da207 100644 --- a/packages/app/src/runtime/i18n/is.ts +++ b/packages/app/src/runtime/i18n/is.ts @@ -348,7 +348,6 @@ export const dict = { "session.new.project.search": "Leita að verkefnum", "session.new.project.add": "Bæta við verkefni", "session.new.workspace.runIn": "Keyra setu í", - "session.new.workspace.triggerLocal": "Staðbundið", "session.new.workspace.local": "Staðbundin geymsla", "session.new.git.none": "Engin Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/it.ts b/packages/app/src/runtime/i18n/it.ts index 027e79b419..822ab36796 100644 --- a/packages/app/src/runtime/i18n/it.ts +++ b/packages/app/src/runtime/i18n/it.ts @@ -495,7 +495,6 @@ export const dict = { "session.new.project.search": "Cerca progetti", "session.new.project.add": "Aggiungi progetto", "session.new.workspace.runIn": "Esegui la sessione in", - "session.new.workspace.triggerLocal": "Locale", "session.new.workspace.local": "Repository locale", "session.new.git.none": "Senza Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/ja.ts b/packages/app/src/runtime/i18n/ja.ts index 49dd4dcd70..12fa3212db 100644 --- a/packages/app/src/runtime/i18n/ja.ts +++ b/packages/app/src/runtime/i18n/ja.ts @@ -343,7 +343,6 @@ export const dict = { "session.new.project.search": "プロジェクトを検索", "session.new.project.add": "プロジェクトを追加", "session.new.workspace.runIn": "セッションの実行先", - "session.new.workspace.triggerLocal": "ローカル", "session.new.workspace.local": "ローカルリポジトリ", "session.new.workspace.local.tooltip": "現在のチェックアウトを使用", "session.new.workspace.new.tooltip": "独立したチェックアウトを作成", diff --git a/packages/app/src/runtime/i18n/ka.ts b/packages/app/src/runtime/i18n/ka.ts index aa8998c8fc..bbcbcbbed0 100644 --- a/packages/app/src/runtime/i18n/ka.ts +++ b/packages/app/src/runtime/i18n/ka.ts @@ -337,7 +337,6 @@ export const dict = { "session.new.project.search": "პროექტების ძიება", "session.new.project.add": "პროექტის დამატება", "session.new.workspace.runIn": "სესიის გაშვება", - "session.new.workspace.triggerLocal": "ადგილობრივი", "session.new.workspace.local": "ადგილობრივი საცავი", "session.new.git.none": "Git-ის გარეშე", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/km.ts b/packages/app/src/runtime/i18n/km.ts index 1264e73392..787d9324ed 100644 --- a/packages/app/src/runtime/i18n/km.ts +++ b/packages/app/src/runtime/i18n/km.ts @@ -345,7 +345,6 @@ export const dict = { "session.new.project.search": "គម្រោងស្វែងរក", "session.new.project.add": "បន្ថែមគម្រោង", "session.new.workspace.runIn": "ដំណើរការសម័យក្នុង", - "session.new.workspace.triggerLocal": "ក្នុងស្រុក", "session.new.workspace.local": "ឃ្លាំងមូលដ្ឋាន", "session.new.git.none": "គ្មាន Git", "session.header.open.finder": "អ្នកស្វែងរក", diff --git a/packages/app/src/runtime/i18n/ko.ts b/packages/app/src/runtime/i18n/ko.ts index 3ebbf1e38f..e7f7d70562 100644 --- a/packages/app/src/runtime/i18n/ko.ts +++ b/packages/app/src/runtime/i18n/ko.ts @@ -474,7 +474,6 @@ export const dict = { "session.new.project.search": "프로젝트 검색", "session.new.project.add": "프로젝트 추가", "session.new.workspace.runIn": "세션 실행 위치", - "session.new.workspace.triggerLocal": "로컬", "session.new.workspace.local": "로컬 저장소", "session.new.git.none": "Git 없음", diff --git a/packages/app/src/runtime/i18n/language.tsx b/packages/app/src/runtime/i18n/language.tsx index 90e7792a1a..4100d3560f 100644 --- a/packages/app/src/runtime/i18n/language.tsx +++ b/packages/app/src/runtime/i18n/language.tsx @@ -1,7 +1,8 @@ -import { createEffect, createMemo, createResource, type JSX } from "solid-js" +import { batch, createEffect, createMemo, createSignal, on, onCleanup, untrack, type JSX } from "solid-js" import { createStore } from "solid-js/store" import { Option, Schema, SchemaGetter } from "effect" import { createSimpleContext } from "@opencode/ui/context" +import { showToast } from "@opencode/ui/toast" import { I18nProvider, type UiI18n, @@ -25,6 +26,14 @@ import { type DesktopNativeBundle, type DesktopNativeLocale, } from "@/runtime/i18n/desktop-native" +import { + createLanguageState, + selectDictionary, + selectLocale, + transitionLanguage, + type LanguageEffect, + type LanguageEvent, +} from "@/runtime/i18n/machine" export type Locale = DesktopNativeLocale @@ -242,7 +251,64 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont const initial = props.locale ?? readStoredLocale() ?? detectLocale() const [store, setStore, _, ready] = persisted(Persist.global("language"), languageSchema, { locale: initial }) - const locale = createMemo(() => store.locale) + const stored = untrack(() => store.locale) + + const boot = createLanguageState({ + initial: stored, + cached: dicts.get(stored), + fallbackLocale: "en", + fallbackDictionary: base, + }) + + const [machine, setMachine] = createSignal(boot.state) + let timer: ReturnType | undefined + + const dispatch = (event: LanguageEvent) => + batch(() => { + const prev = untrack(machine) + const next = transitionLanguage(prev, event) + + if (next.state !== prev) setMachine(next.state) + next.effects.forEach(run) + }) + + const run = (effect: LanguageEffect) => { + if (effect.type === "load") + return void Promise.try(() => loadDict(effect.locale)).then( + (dictionary) => dispatch({ type: "load.succeeded", attempt: effect.attempt, dictionary }), + () => dispatch({ type: "load.failed", attempt: effect.attempt }), + ) + + if (effect.type === "timer.start") { + clearTimeout(timer) + timer = setTimeout(() => dispatch({ type: "load.timed-out", attempt: effect.attempt }), effect.timeoutMs) + + return + } + + if (effect.type === "timer.stop") { + clearTimeout(timer) + timer = undefined + + return + } + + if (effect.type === "persist") { + if (untrack(() => store.locale) !== effect.locale) setStore("locale", effect.locale) + + return + } + + showToast({ + variant: "error", + title: t("toast.language.loadFailed.title", { language: label(effect.locale) }), + }) + } + + // The committed pair: every reader switches only once the dictionary for the new locale is in hand, so `t()` + // never suspends and the direction never flips ahead of the strings. + const locale = createMemo(() => selectLocale(machine())) + const dictionary = createMemo(() => selectDictionary(machine())) const intl = createMemo(() => INTL[locale()]) // SAFETY: widens the initial `undefined` so a direction can be stored later. const [layout, setLayout] = createStore({ direction: undefined as Direction | undefined }) @@ -255,15 +321,11 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont return layout.direction === "rtl" ? "ar" : "en" }) - const [dictionary] = createResource(locale, loadDict, { - initialValue: dicts.get(initial) ?? base, - }) - const t = >( key: TranslationKey, params?: Record, ) => { - const template: string | undefined = (dictionary() ?? base)[key] + const template: string | undefined = dictionary()[key] // A key outside the dictionary translates to nothing, as it did with the package translator. return template === undefined ? template : resolveTemplate(template, params) @@ -275,7 +337,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont params?: Record, ) => { // SAFETY: every dictionary value is a string (`language.test.ts`). - const current = (dictionary.loading ? base : (dictionary() ?? base)) as Record + const current = dictionary() as Record const candidate = `${key}.${category}` const fallback = `${key}.other` @@ -306,7 +368,7 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont params: Record, ) => { // SAFETY: every dictionary value is a string (`language.test.ts`). - const current = (dictionary.loading ? base : (dictionary() ?? base)) as Record + const current = dictionary() as Record return richTemplateParts(current[key] ?? key, params) } @@ -337,15 +399,26 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont }) createEffect(() => { - if (!props.onNativeTranslations || dictionary.loading) return + if (!props.onNativeTranslations) return const current = dictionary() - if (!current) return props.onNativeTranslations( createDesktopNativeBundle(locale(), (key) => current[key] ?? DESKTOP_NATIVE_ENGLISH[key]), ) }) + // Storage hydrating after mount, or another window picking a language. + createEffect( + on( + () => store.locale, + (next) => dispatch({ type: "locale.synced", locale: next, cached: dicts.get(next) }), + { defer: true }, + ), + ) + + onCleanup(() => dispatch({ type: "disposed" })) + boot.effects.forEach(run) + return { ready, locale, @@ -363,7 +436,8 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont rich, list, setLocale(next: Locale) { - setStore("locale", normalizeLocale(next)) + const target = normalizeLocale(next) + dispatch({ type: "locale.requested", locale: target, cached: dicts.get(target) }) }, setDirection(next: Direction) { setLayout("direction", next === localeDirection(locale()) ? undefined : next) diff --git a/packages/app/src/runtime/i18n/lo.ts b/packages/app/src/runtime/i18n/lo.ts index 8f38bc0003..c6fac5b552 100644 --- a/packages/app/src/runtime/i18n/lo.ts +++ b/packages/app/src/runtime/i18n/lo.ts @@ -345,7 +345,6 @@ export const dict = { "session.new.project.search": "ໂຄງການຄົ້ນຫາ", "session.new.project.add": "ເພີ່ມໂຄງການ", "session.new.workspace.runIn": "ແລ່ນເຊສຊັນໃນ", - "session.new.workspace.triggerLocal": "ທ້ອງຖິ່ນ", "session.new.workspace.local": "ພື້ນທີ່ເກັບຂໍ້ມູນທ້ອງຖິ່ນ", "session.new.workspace.local.tooltip": "ໃຊ້ checkout ປັດຈຸບັນ", "session.new.workspace.new.tooltip": "ສ້າງ checkout ແຍກຕ່າງຫາກ", diff --git a/packages/app/src/runtime/i18n/lt.ts b/packages/app/src/runtime/i18n/lt.ts index c4533c4e29..8f7b22fedf 100644 --- a/packages/app/src/runtime/i18n/lt.ts +++ b/packages/app/src/runtime/i18n/lt.ts @@ -352,7 +352,6 @@ export const dict = { "session.new.project.search": "Ieškoti projektų", "session.new.project.add": "Pridėti projektą", "session.new.workspace.runIn": "Vykdykite sesiją", - "session.new.workspace.triggerLocal": "Vietinis", "session.new.workspace.local": "Vietinė saugykla", "session.new.git.none": "Nėra Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/lv.ts b/packages/app/src/runtime/i18n/lv.ts index 695fa99c05..da895eef67 100644 --- a/packages/app/src/runtime/i18n/lv.ts +++ b/packages/app/src/runtime/i18n/lv.ts @@ -339,7 +339,6 @@ export const dict = { "session.new.project.search": "Meklēt projektus", "session.new.project.add": "Pievienot projektu", "session.new.workspace.runIn": "Palaist sesiju iekš", - "session.new.workspace.triggerLocal": "Lokāli", "session.new.workspace.local": "Lokālais repozitorijs", "session.new.git.none": "Nav Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/machine.test.ts b/packages/app/src/runtime/i18n/machine.test.ts new file mode 100644 index 0000000000..98d9446b7a --- /dev/null +++ b/packages/app/src/runtime/i18n/machine.test.ts @@ -0,0 +1,148 @@ +import { describe, expect, test } from "bun:test" +import { + createLanguageState, + LOCALE_LOAD_TIMEOUT_MS, + selectDictionary, + selectLocale, + transitionLanguage, + type LanguageEffect, + type LanguageEvent, + type LanguageState, +} from "./machine" + +type Dict = { readonly hello: string } + +const en: Dict = { hello: "Hello" } + +const de: Dict = { hello: "Hallo" } + +const ar: Dict = { hello: "مرحبا" } + +const readyOn = (locale: "en" | "de", dictionary: Dict) => + createLanguageState({ initial: locale, cached: dictionary, fallbackLocale: "en", fallbackDictionary: en }).state + +function replay(state: LanguageState, events: readonly LanguageEvent[]) { + return events.reduce<{ state: LanguageState; effects: LanguageEffect[] }>( + (result, event) => { + const next = transitionLanguage(result.state, event) + + return { state: next.state, effects: [...result.effects, ...next.effects] } + }, + { state, effects: [] }, + ) +} + +const shown = (state: LanguageState) => ({ locale: selectLocale(state), dictionary: selectDictionary(state) }) + +describe("language machine", () => { + test("a failed chunk for a picked language keeps the current one and says so", () => { + const loading = transitionLanguage(readyOn("en", en), { type: "locale.requested", locale: "ar", cached: undefined }) + + expect(loading.effects).toEqual([ + { type: "load", attempt: 1, locale: "ar" }, + { type: "timer.start", attempt: 1, timeoutMs: LOCALE_LOAD_TIMEOUT_MS }, + ]) + expect(shown(loading.state)).toEqual({ locale: "en", dictionary: en }) + + const failed = transitionLanguage(loading.state, { type: "load.failed", attempt: 1 }) + + expect(failed.state).toEqual({ status: "ready", issued: 1, locale: "en", dictionary: en }) + expect(failed.effects).toEqual([{ type: "timer.stop" }, { type: "notify.error", locale: "ar" }]) + }) + + test("a stored language whose chunk fails at startup falls back to English quietly", () => { + const boot = createLanguageState({ + initial: "ja", + cached: undefined, + fallbackLocale: "en", + fallbackDictionary: en, + }) + + expect(shown(boot.state)).toEqual({ locale: "en", dictionary: en }) + expect(boot.effects[0]).toEqual({ type: "load", attempt: 1, locale: "ja" }) + + const failed = transitionLanguage(boot.state, { type: "load.failed", attempt: 1 }) + + expect(shown(failed.state)).toEqual({ locale: "en", dictionary: en }) + expect(failed.effects).toEqual([{ type: "timer.stop" }]) + }) + + test("a switch keeps the previous language and direction until the new dictionary lands, then commits both", () => { + const loading = transitionLanguage(readyOn("de", de), { type: "locale.requested", locale: "ar", cached: undefined }) + + expect(shown(loading.state)).toEqual({ locale: "de", dictionary: de }) + + const loaded = transitionLanguage(loading.state, { type: "load.succeeded", attempt: 1, dictionary: ar }) + + expect(shown(loaded.state)).toEqual({ locale: "ar", dictionary: ar }) + expect(loaded.effects).toEqual([{ type: "timer.stop" }, { type: "persist", locale: "ar" }]) + }) + + test("a chunk that never answers times out back to the committed language", () => { + const result = replay(readyOn("en", en), [ + { type: "locale.requested", locale: "ar", cached: undefined }, + { type: "load.timed-out", attempt: 1 }, + ]) + + expect(shown(result.state)).toEqual({ locale: "en", dictionary: en }) + expect(result.effects.slice(-2)).toEqual([{ type: "timer.stop" }, { type: "notify.error", locale: "ar" }]) + }) + + test.each([ + { name: "another uncached language", next: { locale: "fr", cached: undefined }, shows: "en" }, + { name: "a cached language", next: { locale: "de", cached: de }, shows: "de" }, + ] as const)("picking $name ignores the earlier load's late result", (input) => { + const switched = replay(readyOn("en", en), [ + { type: "locale.requested", locale: "ar", cached: undefined }, + { type: "locale.requested", ...input.next }, + ]) + + expect(switched.effects).toContainEqual({ type: "timer.stop" }) + + const late = transitionLanguage(switched.state, { type: "load.succeeded", attempt: 1, dictionary: ar }) + + expect(late).toEqual({ state: switched.state, effects: [] }) + expect(selectLocale(late.state)).toBe(input.shows) + }) + + test("storage syncing during the user's own pick does not replace it", () => { + const loading = transitionLanguage(readyOn("en", en), { type: "locale.requested", locale: "ar", cached: undefined }) + + expect(transitionLanguage(loading.state, { type: "locale.synced", locale: "de", cached: de })).toEqual({ + state: loading.state, + effects: [], + }) + }) + + test("a synced language loads without storing or announcing anything", () => { + const result = replay(readyOn("en", en), [ + { type: "locale.synced", locale: "ar", cached: undefined }, + { type: "load.failed", attempt: 1 }, + ]) + + expect(result.effects.filter((effect) => effect.type === "persist" || effect.type === "notify.error")).toEqual([]) + }) + + test("picking the language that is already showing stores it without reloading", () => { + const state = readyOn("en", en) + + expect(transitionLanguage(state, { type: "locale.requested", locale: "en", cached: en })).toEqual({ + state, + effects: [{ type: "persist", locale: "en" }], + }) + }) + + test("disposal stops the load timer, keeps the dictionary readable and ignores later results", () => { + const disposed = replay(readyOn("en", en), [ + { type: "locale.requested", locale: "ar", cached: undefined }, + { type: "disposed" }, + ]) + + expect(disposed.effects.at(-1)).toEqual({ type: "timer.stop" }) + expect(shown(disposed.state)).toEqual({ locale: "en", dictionary: en }) + expect(transitionLanguage(disposed.state, { type: "load.succeeded", attempt: 1, dictionary: ar })).toEqual({ + state: disposed.state, + effects: [], + }) + }) +}) diff --git a/packages/app/src/runtime/i18n/machine.ts b/packages/app/src/runtime/i18n/machine.ts new file mode 100644 index 0000000000..7907f0dc84 --- /dev/null +++ b/packages/app/src/runtime/i18n/machine.ts @@ -0,0 +1,164 @@ +import type { DesktopNativeLocale } from "./desktop-native" + +/** A dynamic `import()` can hang on a stalled network; past this the switch gives up and keeps the current language. */ +export const LOCALE_LOAD_TIMEOUT_MS = 10_000 + +/** + * `locale` and `dictionary` are always the committed pair every reader shows. A load keeps them until its dictionary + * arrives, so the strings, plural rules, `lang`/`dir` and the stored choice switch together, never one ahead. + */ +export type LanguageState = + | { + readonly status: "ready" + readonly issued: number + readonly locale: DesktopNativeLocale + readonly dictionary: Dict + } + | { + readonly status: "loading" + readonly issued: number + readonly attempt: number + readonly locale: DesktopNativeLocale + readonly dictionary: Dict + /** The locale whose dictionary is loading. */ + readonly target: DesktopNativeLocale + /** The user chose it: success stores the choice and failure tells them. A synced load does neither. */ + readonly persist: boolean + } + | { readonly status: "disposed"; readonly locale: DesktopNativeLocale; readonly dictionary: Dict } + +export type LanguageEvent = + /** The user picked a language. `cached` is its dictionary when it already loaded. */ + | { readonly type: "locale.requested"; readonly locale: DesktopNativeLocale; readonly cached: Dict | undefined } + /** The stored choice changed under us: storage hydrated, or another window picked a language. */ + | { readonly type: "locale.synced"; readonly locale: DesktopNativeLocale; readonly cached: Dict | undefined } + | { readonly type: "load.succeeded"; readonly attempt: number; readonly dictionary: Dict } + | { readonly type: "load.failed"; readonly attempt: number } + | { readonly type: "load.timed-out"; readonly attempt: number } + | { readonly type: "disposed" } + +export type LanguageEffect = + | { readonly type: "load"; readonly attempt: number; readonly locale: DesktopNativeLocale } + | { readonly type: "timer.start"; readonly attempt: number; readonly timeoutMs: number } + | { readonly type: "timer.stop" } + /** Store the committed choice. */ + | { readonly type: "persist"; readonly locale: DesktopNativeLocale } + | { readonly type: "notify.error"; readonly locale: DesktopNativeLocale } + +export type LanguageTransition = { + readonly state: LanguageState + readonly effects: readonly LanguageEffect[] +} + +/** Starts on `initial` when its dictionary is cached, else on the fallback while `initial` loads. */ +export function createLanguageState(input: { + readonly initial: DesktopNativeLocale + readonly cached: Dict | undefined + readonly fallbackLocale: DesktopNativeLocale + readonly fallbackDictionary: Dict +}): LanguageTransition { + if (input.cached !== undefined) + return { state: { status: "ready", issued: 0, locale: input.initial, dictionary: input.cached }, effects: [] } + + return load( + { status: "ready", issued: 0, locale: input.fallbackLocale, dictionary: input.fallbackDictionary }, + input.initial, + false, + ) +} + +export function transitionLanguage( + state: LanguageState, + event: LanguageEvent, +): LanguageTransition { + if (state.status === "disposed") return { state, effects: [] } + + const stop = state.status === "loading" ? [STOP] : [] + + if (event.type === "disposed") + return { state: { status: "disposed", locale: state.locale, dictionary: state.dictionary }, effects: stop } + + if (event.type === "locale.requested") { + const persist = { type: "persist", locale: event.locale } as const + + // The stored choice can differ from the committed one after a failed load at startup, so it is written again. + if (state.status === "ready" && state.locale === event.locale) return { state, effects: [persist] } + + if (event.cached !== undefined) + return { state: ready(state, event.locale, event.cached), effects: [...stop, persist] } + + if (state.status === "loading" && state.target === event.locale) + return { state: state.persist ? state : { ...state, persist: true }, effects: [] } + + return load(state, event.locale, true) + } + + if (event.type === "locale.synced") { + // The user's own pick wins over the stored value it is about to replace. + if (state.status === "loading" && state.persist) return { state, effects: [] } + + if (state.status === "ready" && state.locale === event.locale) return { state, effects: [] } + + if (event.cached !== undefined) return { state: ready(state, event.locale, event.cached), effects: stop } + + if (state.status === "loading" && state.target === event.locale) return { state, effects: [] } + + return load(state, event.locale, false) + } + + if (state.status !== "loading" || event.attempt !== state.attempt) return { state, effects: [] } + + if (event.type === "load.succeeded") + return { + state: ready(state, state.target, event.dictionary), + effects: state.persist ? [STOP, { type: "persist", locale: state.target }] : [STOP], + } + + return { + state: ready(state, state.locale, state.dictionary), + effects: state.persist ? [STOP, { type: "notify.error", locale: state.target }] : [STOP], + } +} + +export function selectLocale(state: LanguageState) { + return state.locale +} + +export function selectDictionary(state: LanguageState) { + return state.dictionary +} + +const STOP = { type: "timer.stop" } as const + +function ready( + state: Exclude, { status: "disposed" }>, + locale: DesktopNativeLocale, + dictionary: Dict, +): LanguageState { + return { status: "ready", issued: state.issued, locale, dictionary } +} + +function load( + state: Exclude, { status: "disposed" }>, + target: DesktopNativeLocale, + persist: boolean, +): LanguageTransition { + const attempt = state.issued + 1 + + return { + state: { + status: "loading", + issued: attempt, + attempt, + locale: state.locale, + dictionary: state.dictionary, + target, + persist, + }, + effects: [ + ...(state.status === "loading" ? [STOP] : []), + { type: "load", attempt, locale: target }, + { type: "timer.start", attempt, timeoutMs: LOCALE_LOAD_TIMEOUT_MS }, + ], + } +} diff --git a/packages/app/src/runtime/i18n/mk.ts b/packages/app/src/runtime/i18n/mk.ts index bbe3f1c099..8e74e0e89f 100644 --- a/packages/app/src/runtime/i18n/mk.ts +++ b/packages/app/src/runtime/i18n/mk.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Пребарувајте проекти", "session.new.project.add": "Додадете проект", "session.new.workspace.runIn": "Извршете ја сесијата внатре", - "session.new.workspace.triggerLocal": "Локално", "session.new.workspace.local": "Локално складиште", "session.new.git.none": "Не Git", "session.header.open.finder": "Пронаоѓач", diff --git a/packages/app/src/runtime/i18n/mn.ts b/packages/app/src/runtime/i18n/mn.ts index f8bb65fcfe..fa37481767 100644 --- a/packages/app/src/runtime/i18n/mn.ts +++ b/packages/app/src/runtime/i18n/mn.ts @@ -339,7 +339,6 @@ export const dict = { "session.new.project.search": "Төсөл хайх", "session.new.project.add": "Төсөл нэмэх", "session.new.workspace.runIn": "Сессийг ажиллуулах", - "session.new.workspace.triggerLocal": "Орон нутгийн", "session.new.workspace.local": "Орон нутгийн хадгалах газар", "session.new.git.none": "Үгүй Git", "session.header.open.finder": "Хайгч", diff --git a/packages/app/src/runtime/i18n/ms.ts b/packages/app/src/runtime/i18n/ms.ts index bcb7dbfaee..34126b9cf0 100644 --- a/packages/app/src/runtime/i18n/ms.ts +++ b/packages/app/src/runtime/i18n/ms.ts @@ -346,7 +346,6 @@ export const dict = { "session.new.project.search": "Cari projek", "session.new.project.add": "Tambah projek", "session.new.workspace.runIn": "Jalankan sesi dalam", - "session.new.workspace.triggerLocal": "Setempat", "session.new.workspace.local": "Repositori setempat", "session.new.git.none": "Tiada Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/my.ts b/packages/app/src/runtime/i18n/my.ts index ec069cdf7d..4aaff4edc2 100644 --- a/packages/app/src/runtime/i18n/my.ts +++ b/packages/app/src/runtime/i18n/my.ts @@ -349,7 +349,6 @@ export const dict = { "session.new.project.search": "ရှာဖွေရေး ပရောဂျက်များ", "session.new.project.add": "ပရောဂျက်ကို ထည့်ပါ။", "session.new.workspace.runIn": "စက်ရှင်ကို ဖွင့်ပါ။", - "session.new.workspace.triggerLocal": "ပြည်တွင်း", "session.new.workspace.local": "စက်တွင်းသိုလှောင်မှု", "session.new.git.none": "Git မရှိပါ။", "session.header.open.finder": "ရှာဖွေသူ", diff --git a/packages/app/src/runtime/i18n/ne.ts b/packages/app/src/runtime/i18n/ne.ts index 0f7b73416f..9f7c989095 100644 --- a/packages/app/src/runtime/i18n/ne.ts +++ b/packages/app/src/runtime/i18n/ne.ts @@ -341,7 +341,6 @@ export const dict = { "session.new.project.search": "परियोजनाहरू खोज्नुहोस्", "session.new.project.add": "परियोजना थप्नुहोस्", "session.new.workspace.runIn": "मा सत्र चलाउनुहोस्", - "session.new.workspace.triggerLocal": "स्थानीय", "session.new.workspace.local": "स्थानीय भण्डार", "session.new.git.none": "छैन Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/nl.ts b/packages/app/src/runtime/i18n/nl.ts index 2b1bbb0255..2fe2f9f2b4 100644 --- a/packages/app/src/runtime/i18n/nl.ts +++ b/packages/app/src/runtime/i18n/nl.ts @@ -545,7 +545,6 @@ export const dict = { "session.new.project.search": "Zoek projecten", "session.new.project.add": "Project toevoegen", "session.new.workspace.runIn": "Sessie uitvoeren in", - "session.new.workspace.triggerLocal": "Lokaal", "session.new.workspace.local": "Lokale repository", "session.new.git.none": "Geen Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/no.ts b/packages/app/src/runtime/i18n/no.ts index 5b01c5b316..9541be7ac3 100644 --- a/packages/app/src/runtime/i18n/no.ts +++ b/packages/app/src/runtime/i18n/no.ts @@ -793,7 +793,6 @@ export const dict = { "session.new.project.search": "Søk etter prosjekter", "session.new.project.add": "Legg til prosjekt", "session.new.workspace.runIn": "Kjør sesjonen i", - "session.new.workspace.triggerLocal": "Lokalt", "session.new.workspace.local": "Lokalt depot", "session.new.git.none": "Ingen Git", diff --git a/packages/app/src/runtime/i18n/pa.ts b/packages/app/src/runtime/i18n/pa.ts index cc7630da73..42b7deda7b 100644 --- a/packages/app/src/runtime/i18n/pa.ts +++ b/packages/app/src/runtime/i18n/pa.ts @@ -350,7 +350,6 @@ export const dict = { "session.new.project.search": "منصوبیاں دی تلاش کرو", "session.new.project.add": "پروجیکٹ شامل کرو", "session.new.workspace.runIn": "وچ سیشن چلاؤ", - "session.new.workspace.triggerLocal": "مقامی", "session.new.workspace.local": "مقامی مخزن", "session.new.git.none": "Git نئیں", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/pl.ts b/packages/app/src/runtime/i18n/pl.ts index abeef05c70..56f0548a6b 100644 --- a/packages/app/src/runtime/i18n/pl.ts +++ b/packages/app/src/runtime/i18n/pl.ts @@ -336,7 +336,6 @@ export const dict = { "session.new.project.search": "Szukaj projektów", "session.new.project.add": "Dodaj projekt", "session.new.workspace.runIn": "Uruchom sesję w", - "session.new.workspace.triggerLocal": "Lokalnie", "session.new.workspace.local": "Lokalne repozytorium", "session.new.git.none": "Brak Git", "settings.tab.servers": "Serwery", diff --git a/packages/app/src/runtime/i18n/ro.ts b/packages/app/src/runtime/i18n/ro.ts index cd86538d97..6e97233510 100644 --- a/packages/app/src/runtime/i18n/ro.ts +++ b/packages/app/src/runtime/i18n/ro.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Caută proiecte", "session.new.project.add": "Adaugă proiect", "session.new.workspace.runIn": "Rulează sesiunea în", - "session.new.workspace.triggerLocal": "Local", "session.new.workspace.local": "Depozit local", "session.new.git.none": "Fără Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/ru.ts b/packages/app/src/runtime/i18n/ru.ts index 7d3c41927e..cd494bee79 100644 --- a/packages/app/src/runtime/i18n/ru.ts +++ b/packages/app/src/runtime/i18n/ru.ts @@ -373,7 +373,6 @@ export const dict = { "session.new.project.search": "Поиск проектов", "session.new.project.add": "Добавить проект", "session.new.workspace.runIn": "Запустить сессию в", - "session.new.workspace.triggerLocal": "Локально", "session.new.workspace.local": "Локальный репозиторий", "session.new.git.none": "Нет Git", diff --git a/packages/app/src/runtime/i18n/si.ts b/packages/app/src/runtime/i18n/si.ts index eb7708a59f..401ab4fae0 100644 --- a/packages/app/src/runtime/i18n/si.ts +++ b/packages/app/src/runtime/i18n/si.ts @@ -339,7 +339,6 @@ export const dict = { "session.new.project.search": "ව්යාපෘති සොයන්න", "session.new.project.add": "ව්යාපෘතිය එකතු කරන්න", "session.new.workspace.runIn": "සැසිය ධාවනය කරන්න", - "session.new.workspace.triggerLocal": "දේශීය", "session.new.workspace.local": "දේශීය ගබඩාව", "session.new.git.none": "Git නැත", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/sk.ts b/packages/app/src/runtime/i18n/sk.ts index f636d8c4a7..993b296fb6 100644 --- a/packages/app/src/runtime/i18n/sk.ts +++ b/packages/app/src/runtime/i18n/sk.ts @@ -362,7 +362,6 @@ export const dict = { "session.new.project.search": "Hľadať projekty", "session.new.project.add": "Pridať projekt", "session.new.workspace.runIn": "Spustiť reláciu v", - "session.new.workspace.triggerLocal": "Lokálne", "session.new.workspace.local": "Lokálne úložisko", "session.new.git.none": "Bez Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/sl.ts b/packages/app/src/runtime/i18n/sl.ts index 679b943bb8..a571a3619f 100644 --- a/packages/app/src/runtime/i18n/sl.ts +++ b/packages/app/src/runtime/i18n/sl.ts @@ -362,7 +362,6 @@ export const dict = { "session.new.project.search": "Iskanje projektov", "session.new.project.add": "Dodajte projekt", "session.new.workspace.runIn": "Zaženi sejo", - "session.new.workspace.triggerLocal": "Lokalno", "session.new.workspace.local": "Lokalno skladišče", "session.new.git.none": "Ne Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/sq.ts b/packages/app/src/runtime/i18n/sq.ts index 0c03c4fe5b..a0fd4975fd 100644 --- a/packages/app/src/runtime/i18n/sq.ts +++ b/packages/app/src/runtime/i18n/sq.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Kërko projekte", "session.new.project.add": "Shto projekt", "session.new.workspace.runIn": "Drejtoni seancën brenda", - "session.new.workspace.triggerLocal": "Lokale", "session.new.workspace.local": "Depo lokale", "session.new.git.none": "Jo Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/sr.ts b/packages/app/src/runtime/i18n/sr.ts index 62e4694ad4..048c42ab09 100644 --- a/packages/app/src/runtime/i18n/sr.ts +++ b/packages/app/src/runtime/i18n/sr.ts @@ -351,7 +351,6 @@ export const dict = { "session.new.project.search": "Претрага пројеката", "session.new.project.add": "Додај пројекат", "session.new.workspace.runIn": "Покрените сесију у", - "session.new.workspace.triggerLocal": "локално", "session.new.workspace.local": "Локално спремиште", "session.new.git.none": "Не Git", "session.header.open.finder": "Финдер", diff --git a/packages/app/src/runtime/i18n/sv.ts b/packages/app/src/runtime/i18n/sv.ts index 3ab8129db3..49ede78a20 100644 --- a/packages/app/src/runtime/i18n/sv.ts +++ b/packages/app/src/runtime/i18n/sv.ts @@ -538,7 +538,6 @@ export const dict = { "session.new.project.search": "Sök efter projekt", "session.new.project.add": "Lägg till projekt", "session.new.workspace.runIn": "Kör sessionen i", - "session.new.workspace.triggerLocal": "Lokal", "session.new.workspace.local": "Lokalt arkiv", "session.new.git.none": "Ingen Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/tg.ts b/packages/app/src/runtime/i18n/tg.ts index b359780422..09c76d1782 100644 --- a/packages/app/src/runtime/i18n/tg.ts +++ b/packages/app/src/runtime/i18n/tg.ts @@ -337,7 +337,6 @@ export const dict = { "session.new.project.search": "Ҷустуҷӯи лоиҳаҳо", "session.new.project.add": "Илова кардани лоиҳа", "session.new.workspace.runIn": "Иҷлосия дар", - "session.new.workspace.triggerLocal": "маҳаллӣ", "session.new.workspace.local": "Анбори маҳаллӣ", "session.new.git.none": "Не Git", "session.header.open.finder": "Ҷустуҷӯ", diff --git a/packages/app/src/runtime/i18n/th.ts b/packages/app/src/runtime/i18n/th.ts index 335e8ca49c..a1f7278d6b 100644 --- a/packages/app/src/runtime/i18n/th.ts +++ b/packages/app/src/runtime/i18n/th.ts @@ -380,7 +380,6 @@ export const dict = { "session.new.project.search": "ค้นหาโปรเจกต์", "session.new.project.add": "เพิ่มโปรเจกต์", "session.new.workspace.runIn": "เรียกใช้เซสชันใน", - "session.new.workspace.triggerLocal": "ในเครื่อง", "session.new.workspace.local": "รีโพซิทอรีในเครื่อง", "session.new.workspace.local.tooltip": "ใช้ checkout ปัจจุบัน", "session.new.workspace.new.tooltip": "สร้าง checkout แยก", diff --git a/packages/app/src/runtime/i18n/tk.ts b/packages/app/src/runtime/i18n/tk.ts index 1ea1e08d9d..d8a9c0bbb2 100644 --- a/packages/app/src/runtime/i18n/tk.ts +++ b/packages/app/src/runtime/i18n/tk.ts @@ -336,7 +336,6 @@ export const dict = { "session.new.project.search": "Taslamalary gözläň", "session.new.project.add": "Taslama goşuň", "session.new.workspace.runIn": "Sessiýany işlediň", - "session.new.workspace.triggerLocal": "Localerli", "session.new.workspace.local": "Localerli ammar", "session.new.git.none": "Git ýok", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/tr.ts b/packages/app/src/runtime/i18n/tr.ts index eb618db8bf..1b1168bce1 100644 --- a/packages/app/src/runtime/i18n/tr.ts +++ b/packages/app/src/runtime/i18n/tr.ts @@ -385,7 +385,6 @@ export const dict = { "session.new.project.search": "Proje ara", "session.new.project.add": "Proje ekle", "session.new.workspace.runIn": "Oturumu şurada çalıştır", - "session.new.workspace.triggerLocal": "Yerel", "session.new.workspace.local": "Yerel depo", "session.new.git.none": "Git yok", diff --git a/packages/app/src/runtime/i18n/uk.ts b/packages/app/src/runtime/i18n/uk.ts index c2a11ee234..dfb1ee4c67 100644 --- a/packages/app/src/runtime/i18n/uk.ts +++ b/packages/app/src/runtime/i18n/uk.ts @@ -412,7 +412,6 @@ export const dict = { "session.new.project.search": "Пошук проєктів", "session.new.project.add": "Додати проєкт", "session.new.workspace.runIn": "Запустити сесію в", - "session.new.workspace.triggerLocal": "Локально", "session.new.workspace.local": "Локальний репозиторій", "session.new.git.none": "Немає Git", diff --git a/packages/app/src/runtime/i18n/ur.ts b/packages/app/src/runtime/i18n/ur.ts index 1d287d5de8..897ed4cfd6 100644 --- a/packages/app/src/runtime/i18n/ur.ts +++ b/packages/app/src/runtime/i18n/ur.ts @@ -351,7 +351,6 @@ export const dict = { "session.new.project.search": "پروجیکٹس تلاش کریں۔", "session.new.project.add": "پروجیکٹ شامل کریں۔", "session.new.workspace.runIn": "سیشن یہاں چلائیں", - "session.new.workspace.triggerLocal": "مقامی", "session.new.workspace.local": "مقامی ذخیرہ", "session.new.git.none": "کوئی Git نہیں۔", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/uz.ts b/packages/app/src/runtime/i18n/uz.ts index 6c8cc59d6f..aa296b782b 100644 --- a/packages/app/src/runtime/i18n/uz.ts +++ b/packages/app/src/runtime/i18n/uz.ts @@ -338,7 +338,6 @@ export const dict = { "session.new.project.search": "Loyihalarni qidirish", "session.new.project.add": "Loyiha qo'shish", "session.new.workspace.runIn": "Seansni ishga tushirish", - "session.new.workspace.triggerLocal": "Mahalliy", "session.new.workspace.local": "Mahalliy ombor", "session.new.git.none": "Git yo'q", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/vi.ts b/packages/app/src/runtime/i18n/vi.ts index 33e62ecebe..9734339b96 100644 --- a/packages/app/src/runtime/i18n/vi.ts +++ b/packages/app/src/runtime/i18n/vi.ts @@ -354,7 +354,6 @@ export const dict = { "session.new.project.search": "Tìm kiếm dự án", "session.new.project.add": "Thêm dự án", "session.new.workspace.runIn": "Chạy phiên trong", - "session.new.workspace.triggerLocal": "Cục bộ", "session.new.workspace.local": "Kho lưu trữ cục bộ", "session.new.git.none": "Không dùng Git", "session.header.open.finder": "Finder", diff --git a/packages/app/src/runtime/i18n/zh.ts b/packages/app/src/runtime/i18n/zh.ts index 3c4f5d5b42..d4cefa2541 100644 --- a/packages/app/src/runtime/i18n/zh.ts +++ b/packages/app/src/runtime/i18n/zh.ts @@ -384,7 +384,6 @@ export const dict = { "session.new.project.search": "搜索项目", "session.new.project.add": "添加项目", "session.new.workspace.runIn": "运行会话的位置", - "session.new.workspace.triggerLocal": "本地", "session.new.workspace.local": "本地仓库", "session.new.git.none": "无 Git", diff --git a/packages/app/src/runtime/i18n/zht.ts b/packages/app/src/runtime/i18n/zht.ts index 016d8f6a43..525214d6b7 100644 --- a/packages/app/src/runtime/i18n/zht.ts +++ b/packages/app/src/runtime/i18n/zht.ts @@ -376,7 +376,6 @@ export const dict = { "session.new.project.search": "搜尋專案", "session.new.project.add": "新增專案", "session.new.workspace.runIn": "工作階段執行位置", - "session.new.workspace.triggerLocal": "本機", "session.new.workspace.local": "本機儲存庫", "session.new.git.none": "無 Git", diff --git a/packages/app/src/runtime/persistence/README.md b/packages/app/src/runtime/persistence/README.md index 1c15ad439a..9d508e3364 100644 --- a/packages/app/src/runtime/persistence/README.md +++ b/packages/app/src/runtime/persistence/README.md @@ -142,7 +142,7 @@ stays visible; the renderer uploads the missing bytes again from the chunk text normally, fresh ids on a store without WebCrypto), and publishes. This covers a chunk another tab collected, and an image the composer kept in its history long after its blob was collected. The desktop host additionally refreshes `touched_at` for every blob a written -document references and collects only blobs unreferenced and untouched for `blobGrace`, so +document references and collects only blobs unreferenced and untouched for `BLOB_GRACE_MS`, so repairs stay rare. `persisted()` hands the draft store the encoded document (`setDocument`) rather than a serialized string, so the store does not re-parse the full document to externalize diff --git a/packages/app/src/runtime/persistence/drafts.test.ts b/packages/app/src/runtime/persistence/drafts.test.ts index 531fdbcab4..b8e11431ca 100644 --- a/packages/app/src/runtime/persistence/drafts.test.ts +++ b/packages/app/src/runtime/persistence/drafts.test.ts @@ -138,6 +138,50 @@ describe("draft store text externalization", () => { expect(new Uint8Array(await memory.blobs.get(image.id)!.arrayBuffer())).toEqual(new Uint8Array([1, 2, 3])) }) + test("a pasted file stays readable after its file on disk is deleted", async () => { + // Clipboard tools hand over temp files and delete them on the next copy; reads then fail. + class DiskFile extends File { + gone = false + + private check() { + if (this.gone) throw new DOMException("file is gone", "NotReadableError") + } + + override arrayBuffer() { + this.check() + + return super.arrayBuffer() + } + + override text() { + this.check() + + return super.text() + } + + override stream() { + this.check() + + return super.stream() + } + + override slice(...args: Parameters) { + this.check() + + return super.slice(...args) + } + } + + const memory = memoryDriver() + const store = createDraftStore(memory.driver) + const file = new DiskFile([new Uint8Array([1, 2, 3])], "1793877187508_d.png", { type: "image/png" }) + const image = await store.putBlob(file) + file.gone = true + // happy-dom's FileReader reads a blob's internal buffer, so only a public read can notice the deleted file. + expect(new Uint8Array(await memory.blobs.get(image.id)!.arrayBuffer())).toEqual(new Uint8Array([1, 2, 3])) + expect(await blobDataUrl(image, "image/png")).toBe("data:image/png;base64,AQID") + }) + test("the previous document stays visible until missing blobs are restored", async () => { const memory = memoryDriver() const store = createDraftStore(memory.driver) diff --git a/packages/app/src/runtime/persistence/drafts.ts b/packages/app/src/runtime/persistence/drafts.ts index 27543cdfdb..b98acd5f22 100644 --- a/packages/app/src/runtime/persistence/drafts.ts +++ b/packages/app/src/runtime/persistence/drafts.ts @@ -188,7 +188,15 @@ async function blobID(blob: Blob) { return id } -export async function createBlobReference(blob: Blob): Promise { +// A pasted or dropped File can be backed by a file on disk that the browser reads lazily. Clipboard +// tools delete such temp files once something else is copied, and the preview and the send would +// then fail to read it, so keep the bytes in memory from the start. +async function detach(blob: Blob) { + return blob instanceof File ? new Blob([await blob.arrayBuffer()], { type: blob.type }) : blob +} + +export async function createBlobReference(source: Blob): Promise { + const blob = await detach(source) const id = await blobID(blob) return { id, url: blobUrl(id, blob) } @@ -220,7 +228,8 @@ export function createDraftStore(driver: Driver, options: { grace?: number } = { storeLoaders.set(storeId, loadBlobUrl) - const putBlob = async (blob: Blob) => { + const putBlob = async (source: Blob) => { + const blob = await detach(source) const id = await driver.putBlob(blob) return { id, url: blobUrl(id, blob, grace) } diff --git a/packages/app/src/runtime/plugin/closed-tabs.ts b/packages/app/src/runtime/plugin/closed-tabs.ts index d9b1d61666..c5a4184c5e 100644 --- a/packages/app/src/runtime/plugin/closed-tabs.ts +++ b/packages/app/src/runtime/plugin/closed-tabs.ts @@ -3,6 +3,7 @@ import { createStore } from "solid-js/store" import { createEventListener } from "@solid-primitives/event-listener" import type { Panel, PanelProps, SessionRef } from "@opencode/plugin/gui" import { adjacentTabKey } from "@/shell/titlebar/tab-order" +import type { SessionPane } from "@/shell/state/session-tabs" /** The most closed tabs a session keeps. */ export const CLOSED_TABS_LIMIT = 30 @@ -20,6 +21,9 @@ export type ClosedSideTab = { readonly detail?: string /** What the panel's `restore` needs. */ readonly data?: string + /** The pane it showed in and its position in the strip, where it reopens. */ + readonly pane?: SessionPane + readonly index?: number /** When it closed, in milliseconds since the epoch. */ readonly closed: number } diff --git a/packages/app/src/runtime/plugin/host-apis.tsx b/packages/app/src/runtime/plugin/host-apis.tsx index d74740f03a..60b62226f6 100644 --- a/packages/app/src/runtime/plugin/host-apis.tsx +++ b/packages/app/src/runtime/plugin/host-apis.tsx @@ -16,6 +16,7 @@ import type { Schema } from "effect" import { useDialog } from "@opencode/ui/context/dialog" import { useTheme } from "@opencode/ui/theme/context" import { toaster } from "@opencode/ui/toast" +import { writeClipboard } from "@opencode/session-ui/copy" import { base64Encode } from "@opencode/util/encode" import { uuid } from "@opencode/util/uuid" import { @@ -294,7 +295,11 @@ export function createHostApis() { }, }), system: () => ({ - copy: (text) => platform.writeClipboardText?.(text) ?? navigator.clipboard.writeText(text), + async copy(text) { + if (platform.writeClipboardText) return platform.writeClipboardText(text) + + if (!(await writeClipboard(text))) throw new Error(language.t("common.requestFailed")) + }, async save(file) { if (platform.saveFile) return platform.saveFile({ defaultPath: file.name }, file.content) const url = URL.createObjectURL(new Blob([file.content], { type: "application/octet-stream" })) diff --git a/packages/app/src/runtime/plugin/panels.tsx b/packages/app/src/runtime/plugin/panels.tsx index 70a9a7eef4..a71ff059da 100644 --- a/packages/app/src/runtime/plugin/panels.tsx +++ b/packages/app/src/runtime/plugin/panels.tsx @@ -48,6 +48,7 @@ type Tabs = Accessor<{ setActive(tab: string | undefined): void close(tab: string): void remap(rewrite: (tab: string) => string): void + target(pane: SessionPane, plugin?: string, index?: number): void }> export type RegionEntry = { @@ -459,16 +460,21 @@ export function createRegion(input: { if (entry) entry.provider.enter?.(panelInput(input.view, input.screen, { tab: entry.tab })) settled(() => { const root = document.getElementById("review-panel") + const current = document.activeElement - if (root && !root.contains(document.activeElement)) root.focus({ preventScroll: true, focusVisible: false }) + // Focus the reader moved during the motion, such as into a menu they opened, stays where they put it. + if (!root || root.contains(current) || (current !== focused && current !== document.body)) return + root.focus({ preventScroll: true, focusVisible: false }) }) }, close(key: string) { const entry = byKey().get(key) const last = stored().length === 1 && stored()[0] === key const closed = entry && closedEntry(key, entry.provider, panelInput(input.view, input.screen, { tab: entry.tab })) + const index = stored().indexOf(key) - if (closed) input.closed.push(input.view(), closed) + if (closed) + input.closed.push(input.view(), { ...closed, pane: paneOfKey(key), index: index === -1 ? undefined : index }) // New tabs left in the strip keep the region open. batch(() => { input.tabs().close(key) @@ -493,14 +499,18 @@ export function createRegion(input: { return input.closed.list(input.view()).filter((entry) => !!entry.file && !open.has(entry.key)) }), - /** Brings back the closed tab under `key`, or the newest one. */ - reopen(key?: string) { + /** When the tab `reopen()` brings back closed. */ + lastClosedTime: () => input.closed.list(input.view())[0]?.closed, + /** Brings back the closed tab under `key`, or the newest one, where it closed or in `pane`. */ + reopen(key?: string, pane?: SessionPane) { const entry = input.closed.take(input.view(), key) if (!entry) return const plugin = entry.key.slice(0, entry.key.indexOf(":")) const provider = providers().find((item) => item.plugin === plugin)?.value + if (!stored().includes(entry.key)) input.tabs().target(pane ?? entry.pane ?? "side", plugin, entry.index) + if (!provider?.restore) return input.open(entry.key) provider.restore({ session: input.view(), diff --git a/packages/app/src/runtime/plugin/side-region.tsx b/packages/app/src/runtime/plugin/side-region.tsx index 4ebdc2ca8c..ad6a206e95 100644 --- a/packages/app/src/runtime/plugin/side-region.tsx +++ b/packages/app/src/runtime/plugin/side-region.tsx @@ -209,10 +209,7 @@ export function PaneTabs(props: { get entries() { return props.region.recent() }, - onReopen: (key: string) => { - target(key) - props.region.reopen(key) - }, + onReopen: (key: string) => props.region.reopen(key, props.pane.id), } const modifier = closedTabsModifier() @@ -229,6 +226,15 @@ export function PaneTabs(props: { }), ) + const after = createMemo(() => { + const keys = props.pane.keys() + const index = keys.indexOf(tabMenu.key) + + if (index === -1) return [] + + return keys.slice(index + 1).filter((key) => closable().includes(key)) + }) + // Without a new tab item, "+" opens a host-owned new tab view listing the launchers, as ⌘T does inside the region. const current = createMemo(() => props.region.shownNewTab(props.pane.id)) const add = () => props.region.openNewTab(props.pane.id) @@ -389,6 +395,9 @@ export function PaneTabs(props: { > {language.t("session.tab.closeOthers")} + after().forEach(props.region.close)}> + {language.t(language.direction() === "rtl" ? "common.closeTabsToLeft" : "common.closeTabsToRight")} + diff --git a/packages/app/src/runtime/server/data.test.ts b/packages/app/src/runtime/server/data.test.ts index 47b8d07998..160938dccc 100644 --- a/packages/app/src/runtime/server/data.test.ts +++ b/packages/app/src/runtime/server/data.test.ts @@ -1,6 +1,8 @@ -import { expect, test } from "bun:test" -import type { SessionInfo } from "@opencode/client/promise" -import { createSessionMutations } from "./data" +import { afterEach, expect, setSystemTime, test } from "bun:test" +import { createRoot } from "solid-js" +import { createData, type CreateDataInput } from "@opencode/client/solid" +import { OpenCode, type OpenCodeEvent, type SessionInfo } from "@opencode/client/promise" +import { createDesktopData, createSessionMutations, createSessionRecency, createSessionRefresh } from "./data" const session: SessionInfo = { id: "ses_test", @@ -11,6 +13,78 @@ const session: SessionInfo = { location: { directory: "/project" }, } +type EventData = { + [key: string]: string | number | boolean | null | EventData | readonly EventData[] +} + +afterEach(() => setSystemTime()) + +function setupDesktop(fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise) { + const listeners = new Set[0]>() + const handlers = new Map void>>() + let seq = 0 + + const setup = createRoot((dispose) => { + const api = OpenCode.make({ + baseUrl: "http://opencode.local", + fetch: Object.assign(fetch, { preconnect: () => {} }), + }) + + const on: CreateDataInput["event"]["on"] = (type, handler) => { + const set = handlers.get(type) ?? new Set() + // SAFETY: this test emitter mirrors the SDK event API; handlers are invoked only for their own event type. + const erased = handler as (event: OpenCodeEvent) => void + set.add(erased) + handlers.set(type, set) + + return () => set.delete(erased) + } + + const events: CreateDataInput["event"] = { + on, + listen(handler) { + listeners.add(handler) + + return () => listeners.delete(handler) + }, + } + + const data = createDesktopData({ + data: createData({ + api: () => api, + directory: "/project", + connection: { status: () => "connected" }, + event: events, + }), + remove: async () => {}, + }) + + return { data, dispose } + }) + + const emit = (type: OpenCodeEvent["type"], created: number, data: EventData = {}) => { + seq++ + + // SAFETY: the envelope matches the event's wire shape; `emit` is only called with the payload for `type`. + const event = { + id: `evt_${seq}`, + type, + created, + durable: { aggregateID: session.id, seq, version: 1 }, + data: { sessionID: session.id, ...data }, + } as OpenCodeEvent + + listeners.forEach((listener) => listener({ name: type, details: event })) + handlers.get(type)?.forEach((handler) => handler(event)) + } + + return { + ...setup, + emit, + seed: (updated: number) => setup.data.session.remember({ ...session, time: { created: 0, updated } }), + } +} + test("keeps a removed session hidden after its deletion event, for lists cached before it", async () => { const release = Promise.withResolvers() const mutation = createSessionMutations(async () => release.promise) @@ -54,3 +128,348 @@ test("treats SessionNotFoundError on removal as already deleted", async () => { await expect(mutation.remove(session.id)).resolves.toBeUndefined() expect(mutation.apply([session])).toEqual([]) }) + +test("passive session events do not promote a session", () => { + const setup = setupDesktop(async () => Response.json({ data: { ...session, time: { created: 0, updated: 10 } } })) + + try { + setup.seed(10) + setup.emit("session.inbox.enqueued", 51, { + inboxID: "msg_input", + item: { type: "user", payload: { text: "Hello" }, delivery: "steer" }, + }) + setup.emit("session.step.started", 52, { + assistantMessageID: "msg_assistant", + agent: "build", + model: { providerID: "provider", id: "model" }, + started: 52, + }) + setup.emit("session.step.ended", 53, { + assistantMessageID: "msg_assistant", + finish: "stop", + cost: 0, + tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }, + }) + setup.emit("session.step.failed", 54, { assistantMessageID: "msg_assistant", error: { type: "unknown" } }) + setup.emit("session.agent.selected", 55, { agent: "plan" }) + setup.emit("session.model.selected", 56, { model: { providerID: "provider", id: "model" } }) + setup.emit("session.metadata.updated", 57, { metadata: { source: "test" } }) + setup.emit("session.permissions", 58, { permissions: [] }) + setup.emit("session.moved", 59, { location: { directory: "/project" }, projectID: "project" }) + setup.emit("session.archived", 60) + setup.emit("session.unarchived", 61) + setup.emit("session.viewed", 62, { idle: 10 }) + + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 10 } }])[0].time.updated).toBe(10) + expect(setup.data.session.get(session.id)?.time.updated).toBe(10) + } finally { + setup.dispose() + } +}) + +test("a rename does not promote the session, including when a refetch returns the rename time", () => { + const setup = setupDesktop(async () => Response.json({ data: session })) + + try { + setup.seed(10) + setup.emit("session.renamed", 50, { title: "Renamed" }) + + const renamed = { ...session, title: "Renamed", time: { created: 0, updated: 50 } } + expect(setup.data.session.apply([renamed])[0].time.updated).toBe(10) + + // A later change promoted the session. A stale refetch at the rename time must not demote it. + expect(setup.data.session.apply([{ ...renamed, time: { created: 0, updated: 60 } }])[0].time.updated).toBe(60) + expect(setup.data.session.apply([renamed])[0].time.updated).toBe(60) + } finally { + setup.dispose() + } +}) + +test("a rename with no live record waits for a stale copy before settling", () => { + const stale = { ...session, time: { created: 0, updated: 10 } } + const renamed = { ...session, title: "Renamed", time: { created: 0, updated: 50 } } + + const batch = (records: SessionInfo[]) => { + const recency = createSessionRecency() + recency.renamed(session.id, undefined, 50) + + return recency.apply(records).map((item) => item.time.updated) + } + + // Whichever order the copies appear in, the stale copy supplies the pre-rename value. + expect(batch([stale, renamed])).toEqual([10, 10]) + expect(batch([renamed, stale])).toEqual([10, 10]) + + const sequence = (records: SessionInfo[]) => { + const recency = createSessionRecency() + recency.renamed(session.id, undefined, 50) + + return [...records, stale, renamed].map((record) => recency.apply([record])[0].time.updated) + } + + // A renamed-only read has nothing to compare against. It uses the creation floor instead of promoting to `at`. + const renamedFirst = sequence([renamed]) + expect(renamedFirst[0]).toBe(0) + expect(renamedFirst.slice(1)).toEqual([10, 10]) + + const staleFirst = sequence([stale]) + expect(staleFirst).toEqual([10, 10, 10]) +}) + +test("a pre-rename record observed before the rename supplies the guard value", () => { + const recency = createSessionRecency() + recency.apply([{ ...session, time: { created: 0, updated: 10 } }]) + recency.renamed(session.id, undefined, 50) + + expect(recency.apply([{ ...session, time: { created: 0, updated: 50 } }])[0].time.updated).toBe(10) +}) + +test("an accepted send promotes immediately and survives a stale fetch until the server catches up", () => { + const setup = setupDesktop(async () => Response.json({ data: session })) + + try { + setup.seed(100) + setSystemTime(new Date(1_000)) + setup.data.session.acceptSend(session.id) + + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 100 } }])[0].time.updated).toBe(1_000) + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 90 } }])[0].time.updated).toBe(1_000) + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 100 } }])[0].time.updated).toBe(1_000) + + // The server accepted the send, but its clock is behind ours. The send is no longer protected. + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 150 } }])[0].time.updated).toBe(150) + + // A stale list fetch after the catch-up must not demote it again. + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 100 } }])[0].time.updated).toBe(150) + } finally { + setup.dispose() + } +}) + +test("a send after a rename is not demoted by a stale refetch at the rename time", () => { + const setup = setupDesktop(async () => Response.json({ data: session })) + + try { + setup.seed(10) + setup.emit("session.renamed", 50, { title: "Renamed" }) + setSystemTime(new Date(1_000)) + setup.data.session.acceptSend(session.id) + + expect( + setup.data.session.apply([{ ...session, title: "Renamed", time: { created: 0, updated: 50 } }])[0].time.updated, + ).toBe(1_000) + } finally { + setup.dispose() + } +}) + +test("send catch-up does not depend on the order records are applied", () => { + const stale = { ...session, time: { created: 0, updated: 90 } } + const fresh = { ...session, time: { created: 0, updated: 150 } } + + const batch = (records: SessionInfo[]) => { + const recency = createSessionRecency() + recency.acceptSend(session.id, { ...session, time: { created: 0, updated: 100 } }, 1_000) + + return recency.apply(records).map((item) => item.time.updated) + } + + // The whole batch settles first, so a stale copy cannot briefly show the local bump beside a fresh copy. + expect(batch([stale, fresh])).toEqual([150, 150]) + expect(batch([fresh, stale])).toEqual([150, 150]) + expect(batch([stale])).toEqual([1_000]) + + const sequence = (records: SessionInfo[]) => { + const recency = createSessionRecency() + recency.acceptSend(session.id, { ...session, time: { created: 0, updated: 100 } }, 1_000) + records.forEach((record) => recency.apply([record])) + + return recency.apply([stale])[0].time.updated + } + + expect(sequence([stale, fresh])).toBe(150) + expect(sequence([fresh, stale])).toBe(150) +}) + +test("multiple renames keep the original pre-rename value through either renamed copy", () => { + const recency = createSessionRecency() + const pre = { ...session, time: { created: 0, updated: 10 } } + const first = { ...session, time: { created: 0, updated: 50 } } + const second = { ...session, time: { created: 0, updated: 80 } } + + recency.renamed(session.id, pre, 50) + expect(recency.apply([first])[0].time.updated).toBe(10) + + // The live store now holds the first rename time, but it is not real activity. + recency.renamed(session.id, first, 80) + expect(recency.apply([first])[0].time.updated).toBe(10) + expect(recency.apply([second])[0].time.updated).toBe(10) + expect(recency.apply([first, second]).map((item) => item.time.updated)).toEqual([10, 10]) +}) + +test("a refetch that lands before the rename event still supplies the pre-rename value", () => { + const recency = createSessionRecency() + const stale = { ...session, time: { created: 0, updated: 10 } } + const renamed = { ...session, time: { created: 0, updated: 50 } } + + recency.apply([stale]) + recency.apply([renamed]) + recency.renamed(session.id, undefined, 50) + + expect(recency.apply([renamed])[0].time.updated).toBe(10) +}) + +test("a rename during a send does not clamp the session to the local send time", () => { + const recency = createSessionRecency() + const before = { ...session, time: { created: 0, updated: 200 } } + + recency.acceptSend(session.id, before, 1_000) + recency.renamed(session.id, before, 300) + + expect(recency.apply([{ ...session, time: { created: 0, updated: 210 } }])[0].time.updated).toBe(210) +}) + +test("remember restores the raw server time after apply projected a send bump", () => { + const setup = setupDesktop(async () => Response.json({ data: session })) + + try { + setup.seed(100) + setSystemTime(new Date(1_000)) + setup.data.session.acceptSend(session.id) + + const bumped = setup.data.session.apply([{ ...session, time: { created: 0, updated: 100 } }])[0] + expect(bumped.time.updated).toBe(1_000) + setup.data.session.remember(bumped) + + expect(setup.data.session.get(session.id)?.time.updated).toBe(100) + // A synthetic value must not have settled the pending send and raised its floor. + expect(setup.data.session.apply([{ ...session, time: { created: 0, updated: 150 } }])[0].time.updated).toBe(150) + } finally { + setup.dispose() + } +}) + +test("bounds per-session recency state", () => { + const recency = createSessionRecency() + + for (let index = 0; index < 600; index++) recency.acceptSend(`ses_${index}`, undefined, 100_000 + index) + + expect(recency.apply([{ ...session, id: "ses_0", time: { created: 0, updated: 0 } }])[0].time.updated).toBe(0) +}) + +test("the newest indexed row keeps its pre-rename time across a large page batch", () => { + const recency = createSessionRecency() + const rows = Array.from({ length: 600 }, (_, i) => ({ ...session, id: `ses_${i}`, time: { created: 0, updated: 600 - i } })) + recency.apply(rows) + recency.renamed(rows[0].id, undefined, 1_000) + expect(recency.apply([{ ...rows[0], time: { created: 0, updated: 1_000 } }])[0].time.updated).toBe(600) +}) + +test("reading passively synced metadata leaves an accepted send pending for indexed lists", () => { + const recency = createSessionRecency() + const indexed = { ...session, time: { created: 0, updated: 10 } } + recency.acceptSend(session.id, indexed, 1_000) + expect(recency.project({ ...session, time: { created: 0, updated: 20 } }).time.updated).toBe(1_000) + expect(recency.apply([indexed])[0].time.updated).toBe(1_000) +}) + +test("a shutdown interruption does not refresh the session", async () => { + let gets = 0 + + const setup = setupDesktop(async () => { + gets++ + + return Response.json({ data: session }) + }) + + try { + setup.seed(10) + setup.emit("session.execution.interrupted", 50, { reason: "shutdown" }) + await new Promise((resolve) => setTimeout(resolve, 0)) + + expect(gets).toBe(0) + } finally { + setup.dispose() + } +}) + +test.each(["loaded", "listed"] as const)("an execution end refreshes a %s root exactly once", async (source) => { + let gets = 0 + const requested = Promise.withResolvers() + const refreshed = { ...session, time: { created: 0, updated: 50 } } + + const setup = setupDesktop(async (input) => { + const url = new URL(input instanceof Request ? input.url : input.toString()) + + if (url.pathname === `/api/session/${session.id}`) { + gets++ + requested.resolve() + + return Response.json({ data: refreshed }) + } + + return Response.json({ data: [] }) + }) + + try { + if (source === "loaded") setup.seed(10) + else setup.data.session.apply([session]) + setup.emit("session.execution.succeeded", 50) + await requested.promise + await setup.data.session.sync(session.id) + + expect(gets).toBe(1) + const info = setup.data.session.get(session.id) + expect(info?.time.updated).toBe(50) + expect(setup.data.session.apply(info ? [info] : [])[0]?.time.updated).toBe(50) + } finally { + setup.dispose() + } +}) + +test.each(["child", "unknown"] as const)("an execution end skips an unloaded %s session", async (source) => { + let gets = 0 + + const setup = setupDesktop(async () => { + gets++ + + return Response.json({ data: session }) + }) + + try { + if (source === "child") setup.data.session.apply([{ ...session, parentID: "ses_parent" }]) + setup.emit("session.execution.succeeded", 50) + await new Promise((resolve) => setTimeout(resolve, 0)) + + expect(gets).toBe(0) + expect(setup.data.session.get(session.id)).toBeUndefined() + } finally { + setup.dispose() + } +}) + +test("coalesces overlapping refreshes for one session and keeps a queued one", async () => { + const calls: string[] = [] + const gates = new Map void>() + + const refresh = createSessionRefresh( + (sessionID) => + new Promise((resolve) => { + calls.push(sessionID) + gates.set(`${sessionID}:${calls.length}`, resolve) + }), + ) + + const first = refresh("ses_a") + refresh("ses_a") + refresh("ses_a") + expect(calls).toEqual(["ses_a"]) + + gates.get("ses_a:1")?.() + await first + expect(calls).toEqual(["ses_a", "ses_a"]) + + gates.get("ses_a:2")?.() + await Promise.resolve() + expect(calls).toEqual(["ses_a", "ses_a"]) +}) diff --git a/packages/app/src/runtime/server/data.ts b/packages/app/src/runtime/server/data.ts index 0bb0a77f58..b711366afb 100644 --- a/packages/app/src/runtime/server/data.ts +++ b/packages/app/src/runtime/server/data.ts @@ -6,70 +6,339 @@ import { uuid } from "@opencode/util/uuid" type SessionMutation = { readonly id: string; readonly type: "remove"; readonly sessionID: string } +type SendRecency = { readonly sentAt: number; readonly serverUpdatedAt: number } + +type RenameRecency = { readonly ats: Set; readonly latest: number; previous?: number } + +type ObservedRecency = { readonly values: readonly number[] } + const REMOVED_SESSION_LIMIT = 512 -// The events on which the server advances a session's `time.updated` to the event's time. -const SESSION_ACTIVITY = [ - "session.inbox.enqueued", - "session.step.started", - "session.step.ended", - "session.step.failed", - "session.renamed", - "session.agent.selected", - "session.model.selected", - "session.metadata.updated", - "session.permissions", - "session.moved", - "session.archived", - "session.unarchived", - "session.revert.staged", - "session.revert.cleared", - "session.revert.committed", +// Recency bookkeeping is per session and only needed for lists; bound it like the removed-session set. +const RECENCY_SESSION_LIMIT = 512 + +const OBSERVED_VALUE_LIMIT = 4 + +// Times returned by apply() are projections. Remember their raw server value so remember() never stores the bump. +const syntheticTimes = new WeakMap() + +// A completed execution refreshes the session's server record so the list follows the server's `time.updated`. +const SESSION_EXECUTION_ENDED = [ + "session.execution.succeeded", + "session.execution.failed", + "session.execution.interrupted", ] satisfies OpenCodeEvent["type"][] export function createDesktopData(input: { data: Data; remove: (sessionID: string) => Promise }) { const mutation = createSessionMutations(input.remove) - const [activity, setActivity] = createStore>({}) + const recency = createSessionRecency() + const [version, setVersion] = createStore({ value: 0 }) + const changed = () => setVersion("value", (value) => value + 1) + + const refresh = createSessionRefresh((sessionID) => { + input.data.session.invalidate(sessionID) + + return input.data.session.sync(sessionID) + }) + onCleanup( input.data.on("session.deleted", (event) => { - setActivity(event.data.sessionID, undefined) + recency.forget(event.data.sessionID) + changed() mutation.deleted(event.data.sessionID) }), ) - - // Lists loaded earlier (the Home index, the live store, search results) learn each session's newer - // `time.updated` from its events, so they rank sessions in the server's order without reloading. - SESSION_ACTIVITY.forEach((type) => + // Renaming advances `time.updated` server-side. Remember the value shown before the rename so a refetch of the + // renamed record cannot promote the session; a newer record becomes the floor so stale refetches cannot demote it. + onCleanup( + input.data.on("session.renamed", (event) => { + recency.renamed(event.data.sessionID, session(event.data.sessionID), event.created) + changed() + }), + ) + // The SDK invalidates and syncs loaded sessions on execution end. Desktop also needs a fresh record for roots + // that only appear in a fetched index. Coalesce those reads across overlapping ends. + SESSION_EXECUTION_ENDED.forEach((type) => onCleanup( input.data.on(type, (event) => { - if (event.created > (activity[event.data.sessionID] ?? 0)) setActivity(event.data.sessionID, event.created) + // Shutdown interruptions do not advance the projected idle/updated markers. + if (event.type === "session.execution.interrupted" && event.data.reason === "shutdown") return + queueMicrotask(() => { + if (input.data.session.get(event.data.sessionID) || !recency.wasListedRoot(event.data.sessionID)) return + refresh(event.data.sessionID) + }) }), ), ) - const apply = (sessions: readonly SessionInfo[], options?: { activity?: boolean }) => - mutation.apply(sessions).map((session) => { - if (options?.activity === false) return session - const updated = activity[session.id] + function session(sessionID: string) { + return input.data.session.get(sessionID) ?? input.data.session.list().find((item) => item.id === sessionID) + } + + const apply = (sessions: readonly SessionInfo[]) => { + version.value - return updated && updated > session.time.updated ? { ...session, time: { ...session.time, updated } } : session - }) + const result = recency.apply(mutation.apply(sessions)) + + // A record can settle a send or a rename while a memo reads it. Rerun the other readers after this computation + // so every list converges on the same recency in the next tick. + if (recency.takeMutated()) queueMicrotask(changed) + + return result + } return { ...input.data, session: { ...input.data.session, - list: () => apply(input.data.session.list()), + list: () => { + version.value + + return mutation.apply(input.data.session.list()).map(recency.project) + }, + // Index consumers merge the raw server snapshots before applying pending sends and rename protection. + known: input.data.session.list, apply, + remember(info: SessionInfo) { + const raw = syntheticTimes.get(info.time) + + input.data.session.remember(raw === undefined ? info : { ...info, time: { ...info.time, updated: raw } }) + }, + // The composer calls this once the server accepts a prompt, including a queued one. + acceptSend: (sessionID: string) => { + recency.acceptSend(sessionID, session(sessionID), Date.now()) + changed() + }, remove: (sessionID: string) => mutation.remove(sessionID).then(() => { - setActivity(sessionID, undefined) + recency.forget(sessionID) + changed() input.data.session.forget(sessionID) }), }, } } +export function createSessionRecency() { + const sends = new Map() + const renames = new Map() + // The newest server value a send's catch-up has taught us. Stale list fetches must not drop below it. + const floors = new Map() + // Raw non-rename values already rendered, newest first. A rename with no live record recovers its pre-rename + // value from here even when a refetched rename record landed before the SSE event. + const observed = new Map() + // Run-end refresh eligibility comes from list reads. A send or rename can also populate timestamp history. + const listedRoots = new Map() + let mutated = false + + const keep = (map: Map, key: Key, value: Value) => { + map.delete(key) + map.set(key, value) + + if (map.size <= RECENCY_SESSION_LIMIT) return + + const oldest = map.keys().next().value + + if (oldest !== undefined) map.delete(oldest) + } + + const grow = (map: Map, sessionID: string, value: number) => { + if (value <= (map.get(sessionID) ?? Number.NEGATIVE_INFINITY)) return + keep(map, sessionID, value) + mutated = true + } + + const observe = (sessionID: string, value: number) => { + if (renames.get(sessionID)?.ats.has(value)) return + + const values = observed.get(sessionID)?.values ?? [] + + if (values.includes(value)) return + + keep(observed, sessionID, { + values: [...values, value].sort((a, b) => b - a).slice(0, OBSERVED_VALUE_LIMIT), + }) + } + + const observedPrior = (sessionID: string) => observed.get(sessionID)?.values[0] + + // Reading live metadata for status must not settle a send or change another list's ordering. + function project(info: SessionInfo) { + const send = sends.get(info.id) + const updated = rawTime(info) + + if (send) return withTime(info, Math.max(updated, send.sentAt, floors.get(info.id) ?? 0)) + + const rename = renames.get(info.id) + + const projected = rename + ? rename.ats.has(updated) + ? (rename.previous ?? observedPrior(info.id) ?? Math.min(info.time.created, rename.latest)) + : Math.max(updated, rename.previous ?? 0) + : updated + + return withTime(info, Math.max(projected, floors.get(info.id) ?? 0)) + } + + return { + project, + wasListedRoot: (sessionID: string) => listedRoots.has(sessionID), + acceptSend(sessionID: string, info: SessionInfo | undefined, sentAt: number) { + const previous = sends.get(sessionID) + const renamedAt = renames.get(sessionID)?.latest ?? 0 + const updated = info ? rawTime(info) : 0 + keep(sends, sessionID, { + sentAt, + // Keep the highest server value known before this send. A pending rename is already on the server, so a + // stale fetch at the rename time must not be mistaken for the send catching up. + serverUpdatedAt: Math.max(previous?.serverUpdatedAt ?? 0, updated, renamedAt, floors.get(sessionID) ?? 0), + }) + + if (info) observe(sessionID, updated) + }, + renamed(sessionID: string, info: SessionInfo | undefined, at: number) { + const existing = renames.get(sessionID) + const ats = new Set(existing?.ats ?? []) + ats.add(at) + + if (ats.size > RECENCY_SESSION_LIMIT) { + const oldest = ats.values().next().value + + if (oldest !== undefined) ats.delete(oldest) + } + + // The rename time itself is not activity. Drop it, and every earlier rename time, from the observed values. + const values = (observed.get(sessionID)?.values ?? []).filter((value) => !ats.has(value)) + + if (values.length > 0) keep(observed, sessionID, { values }) + else observed.delete(sessionID) + + const infoUpdated = info ? rawTime(info) : undefined + const infoPrior = infoUpdated !== undefined && !ats.has(infoUpdated) ? infoUpdated : undefined + + const previous = Math.max( + existing?.previous ?? Number.NEGATIVE_INFINITY, + infoPrior ?? Number.NEGATIVE_INFINITY, + values[0] ?? Number.NEGATIVE_INFINITY, + floors.get(sessionID) ?? Number.NEGATIVE_INFINITY, + ) + + keep(renames, sessionID, { + ats, + latest: Math.max(existing?.latest ?? 0, at), + previous: previous === Number.NEGATIVE_INFINITY ? undefined : previous, + }) + }, + apply(infos: readonly SessionInfo[]) { + mutated = false + const pending = new Map() + + // Settle state from the whole batch first, so [stale, fresh] and [fresh, stale] compute the same values. + for (const [index, info] of infos.entries()) { + const rename = renames.get(info.id) + const updated = rawTime(info) + const renameTime = rename?.ats.has(updated) ?? false + + if (index < RECENCY_SESSION_LIMIT) { + if (!info.parentID) keep(listedRoots, info.id, true) + + if (!renameTime) observe(info.id, updated) + } + + if (!sends.has(info.id) && !rename) continue + + const settled = pending.get(info.id) ?? { + newest: Number.NEGATIVE_INFINITY, + settled: rename?.previous ?? Number.NEGATIVE_INFINITY, + } + + if (!renameTime) { + settled.newest = Math.max(settled.newest, updated) + settled.settled = Math.max(settled.settled, updated) + } + + pending.set(info.id, settled) + } + + pending.forEach((settled, sessionID) => { + const send = sends.get(sessionID) + + if (send && settled.newest > send.serverUpdatedAt) { + sends.delete(sessionID) + mutated = true + grow(floors, sessionID, settled.newest) + } + + const rename = renames.get(sessionID) + + if (rename && settled.settled > (rename.previous ?? Number.NEGATIVE_INFINITY)) { + rename.previous = settled.settled + mutated = true + } + }) + + return infos.map(project) + }, + // True when apply settled a send or raised a floor, so the caller can rerun other readers once. + takeMutated() { + const value = mutated + mutated = false + + return value + }, + forget(sessionID: string) { + sends.delete(sessionID) + renames.delete(sessionID) + floors.delete(sessionID) + observed.delete(sessionID) + listedRoots.delete(sessionID) + }, + } +} + +function rawTime(info: SessionInfo) { + return syntheticTimes.get(info.time) ?? info.time.updated +} + +function withTime(info: SessionInfo, updated: number) { + const raw = rawTime(info) + + if (updated === raw && updated === info.time.updated) return info + + const time = { ...info.time, updated } + syntheticTimes.set(time, raw) + + return { ...info, time } +} + +// One refresh per session can run at a time; another end while it runs queues exactly one follow-up refresh. +export function createSessionRefresh(refresh: (sessionID: string) => Promise) { + const active = new Set() + const queued = new Set() + + const run = (sessionID: string): Promise => { + active.add(sessionID) + + return refresh(sessionID) + .catch(() => undefined) + .finally(() => { + active.delete(sessionID) + + if (queued.delete(sessionID)) void run(sessionID) + }) + } + + return (sessionID: string): Promise => { + if (active.has(sessionID)) { + queued.add(sessionID) + + return Promise.resolve() + } + + return run(sessionID) + } +} + export function createSessionMutations(remove: (sessionID: string) => Promise) { const [store, setStore] = createStore<{ session: SessionMutation[] }>({ session: [] }) diff --git a/packages/app/src/runtime/server/session-index.ts b/packages/app/src/runtime/server/session-index.ts new file mode 100644 index 0000000000..b75689aafa --- /dev/null +++ b/packages/app/src/runtime/server/session-index.ts @@ -0,0 +1,14 @@ +import type { SessionInfo } from "@opencode/client/promise" + +/** Merge live metadata into indexed roots. Only a completed run advances an indexed row's recency. */ +export function mergeRootSessionIndex(indexed: readonly SessionInfo[], known: readonly SessionInfo[]) { + const rows = new Map(indexed.map((info) => [info.id, info])) + + for (const info of known) { + const time = rows.get(info.id)?.time + const passive = time && (info.time.idle ?? 0) <= (time.idle ?? 0) && info.time.updated !== time.updated + rows.set(info.id, passive ? { ...info, time: { ...info.time, updated: time.updated } } : info) + } + + return [...rows.values()].filter((info) => !info.parentID) +} diff --git a/packages/app/src/servers/connect/camera.ts b/packages/app/src/servers/connect/camera.ts deleted file mode 100644 index 1f3adf17a1..0000000000 --- a/packages/app/src/servers/connect/camera.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { createResource } from "solid-js" -import { usePlatform } from "@/runtime/platform/platform" - -export function createCameraAvailability() { - const platform = usePlatform() - const supported = platform.platform === "web" && window.isSecureContext && !!navigator.mediaDevices?.getUserMedia - - const [available, actions] = createResource( - async () => { - if (!supported || !navigator.mediaDevices.enumerateDevices) return false - - const denied = await navigator.permissions?.query({ name: "camera" }).then( - (permission) => permission.state === "denied", - () => false, - ) - - if (denied) return false - - return navigator.mediaDevices.enumerateDevices().then( - (devices) => devices.some((device) => device.kind === "videoinput"), - () => false, - ) - }, - { initialValue: false }, - ) - - return { supported, available, refetch: actions.refetch } -} - -// Pages served over plain HTTP cannot open the camera. QR codes carry JSON, not a link, so the pasted link is the way in. -export function cameraHint() { - return window.isSecureContext ? "server.connect.camera.unavailable" : "server.connect.camera.native" -} diff --git a/packages/app/src/servers/connect/controller.ts b/packages/app/src/servers/connect/controller.ts index 8415c6756a..f801b0d4ba 100644 --- a/packages/app/src/servers/connect/controller.ts +++ b/packages/app/src/servers/connect/controller.ts @@ -5,9 +5,10 @@ import { useCheckServerHealth } from "@/runtime/server/health" import { ServerConnection, useServers } from "@/runtime/server/registry" import { replaceServerConnection } from "@/servers/registry/management" import { - createServerConnectState, selectServerConnectView, + startServerConnect, transitionServerConnect, + type ServerCameraSupport, type ServerConnectEffect, type ServerConnectEvent, type ServerConnectTarget, @@ -36,8 +37,10 @@ export function createServerConnectController(options: ServerConnectControllerOp const check = useCheckServerHealth() // Shared with the scanner, so a retry after a failed check reuses the token of a spent one-time code. const redeem = useRedeemPairing() - const [machine, setMachine] = createSignal(createServerConnectState(options.target)) + const initial = startServerConnect(options.target, cameraSupport(platform.platform)) + const [machine, setMachine] = createSignal(initial.state) let timer: ReturnType | undefined + let cameraTimer: ReturnType | undefined const dispatch = (event: ServerConnectEvent) => { const prev = untrack(machine) @@ -62,6 +65,24 @@ export function createServerConnectController(options: ServerConnectControllerOp return } + if (effect.type === "camera.probe") { + clearTimeout(cameraTimer) + cameraTimer = setTimeout(() => dispatch({ type: "camera.timed-out", attempt: effect.attempt }), effect.timeoutMs) + void Promise.try(probeCamera).then( + (available) => dispatch({ type: "camera.settled", attempt: effect.attempt, available }), + () => dispatch({ type: "camera.settled", attempt: effect.attempt, available: false }), + ) + + return + } + + if (effect.type === "camera.timer.stop") { + clearTimeout(cameraTimer) + cameraTimer = undefined + + return + } + if (effect.type === "connect.http") { const failed = () => dispatch({ @@ -154,6 +175,7 @@ export function createServerConnectController(options: ServerConnectControllerOp } onCleanup(() => dispatch({ type: "disposed" })) + initial.effects.forEach(run) const view = createMemo(() => selectServerConnectView(machine(), { @@ -165,3 +187,26 @@ export function createServerConnectController(options: ServerConnectControllerOp return { view, dispatch, redeem } } + +function cameraSupport(platform: string): ServerCameraSupport { + if (platform !== "web") return "none" + + if (!window.isSecureContext) return "insecure" + + if (!navigator.mediaDevices?.getUserMedia || !navigator.mediaDevices.enumerateDevices) return "unavailable" + + return "probe" +} + +async function probeCamera() { + const denied = await navigator.permissions?.query({ name: "camera" }).then( + (permission) => permission.state === "denied", + () => false, + ) + + if (denied) return false + + const devices = await navigator.mediaDevices.enumerateDevices() + + return devices.some((device) => device.kind === "videoinput") +} diff --git a/packages/app/src/servers/connect/dialog.tsx b/packages/app/src/servers/connect/dialog.tsx index 96d38e1936..a17e27c3d0 100644 --- a/packages/app/src/servers/connect/dialog.tsx +++ b/packages/app/src/servers/connect/dialog.tsx @@ -10,8 +10,6 @@ import { useLanguage } from "@/runtime/i18n/language" import { ServerConnection, useServers } from "@/runtime/server/registry" import { useTabs } from "@/shell/tabs/tabs" import { isServerUnauthorized } from "@/runtime/server/health-machine" -import { usePlatform } from "@/runtime/platform/platform" -import { cameraHint, createCameraAvailability } from "./camera" import { createServerConnectController } from "./controller" import type { ServerConnectField, ServerOriginal } from "./machine" import { ConnectMethodSwitch } from "./method" @@ -26,11 +24,9 @@ export const DialogServer: Component<{ }> = (props) => { const dialog = useDialog() const language = useLanguage() - const platform = usePlatform() const servers = useServers() const global = useGlobal() const tabs = useTabs() - const camera = createCameraAvailability() const edited = props.mode === "edit" ? props.server : undefined const originalOf = (server: ServerConnection.Http): ServerOriginal => ({ @@ -103,10 +99,7 @@ export const DialogServer: Component<{ fallback={ {language.t("server.connect.camera.starting")}

}> { - form.dispatch({ type: "scan.cancelled" }) - void camera.refetch() - }} + onCancel={() => form.dispatch({ type: "scan.cancelled" })} redeem={form.redeem} onScan={(link) => form.dispatch({ type: "scan.completed", link })} /> @@ -207,22 +200,18 @@ export const DialogServer: Component<{
- - {language.t(cameraHint())}} + + - + {language.t("server.connect.scan")} + + {(hint) => {hint()}} = {}): ServerOriginal => ({ const edit = (input: Partial = {}): ServerConnectTarget => ({ kind: "edit", original: original(input) }) -function replay(target: ServerConnectTarget, events: readonly ServerConnectEvent[]) { +function replay( + target: ServerConnectTarget, + events: readonly ServerConnectEvent[], + from: ServerConnectState = startServerConnect(target).state, +) { return events.reduce<{ state: ServerConnectState; effects: ServerConnectEffect[] }>( (result, event) => { const next = transitionServerConnect(result.state, event) return { state: next.state, effects: [...result.effects, ...next.effects] } }, - { state: createServerConnectState(target), effects: [] }, + { state: from, effects: [] }, ) } +/** The web app's form once its camera check found a camera. */ +const withCamera = (target: ServerConnectTarget) => + transitionServerConnect(startServerConnect(target, "probe").state, { + type: "camera.settled", + attempt: 1, + available: true, + }).state + const field = (name: "link" | "url" | "name" | "password", value: string): ServerConnectEvent => ({ type: "field.changed", field: name, @@ -131,10 +144,11 @@ describe("server connect form", () => { }) test("a scanned link submits once", () => { - const scanned = replay({ kind: "add" }, [ - { type: "scan.started" }, - { type: "scan.completed", link: "http://192.168.1.2:4096/auth/connect/abc" }, - ]) + const scanned = replay( + { kind: "add" }, + [{ type: "scan.started" }, { type: "scan.completed", link: "http://192.168.1.2:4096/auth/connect/abc" }], + withCamera({ kind: "add" }), + ) expect(scanned.state).toMatchObject({ status: "submitting", attempt: 1 }) expect(scanned.effects).toEqual([ @@ -155,15 +169,82 @@ describe("server connect form", () => { ).toBe(scanned.state) }) - test("a cancelled scan returns to the form with its values", () => { - const result = replay({ kind: "add" }, [ - field("name", "Remote"), - { type: "scan.started" }, - { type: "scan.cancelled" }, - ]) + test("a cancelled scan returns to the form with its values and checks the camera again", () => { + const result = replay( + { kind: "add" }, + [field("name", "Remote"), { type: "scan.started" }, { type: "scan.cancelled" }], + withCamera({ kind: "add" }), + ) expect(result.state).toMatchObject({ status: "editing", draft: { name: "Remote" } }) - expect(result.effects).toEqual([]) + expect(result.effects).toEqual([{ type: "camera.probe", attempt: 2, timeoutMs: CAMERA_PROBE_TIMEOUT_MS }]) + }) + + test("a camera check that never answers gives way to the hint", () => { + const start = startServerConnect({ kind: "add" }, "probe") + + expect(start.effects).toEqual([{ type: "camera.probe", attempt: 1, timeoutMs: CAMERA_PROBE_TIMEOUT_MS }]) + expect(selectServerConnectView(start.state, context)).toMatchObject({ + showScan: true, + canScan: false, + cameraHint: undefined, + }) + + const timedOut = transitionServerConnect(start.state, { type: "camera.timed-out", attempt: 1 }) + + expect(timedOut.effects).toEqual([{ type: "camera.timer.stop" }]) + expect(selectServerConnectView(timedOut.state, context)).toMatchObject({ + showScan: false, + canScan: false, + cameraHint: "server.connect.camera.unavailable", + }) + }) + + test("after a cancelled scan, Scan waits for the new camera check and follows its answer", () => { + const cancelled = replay( + { kind: "add" }, + [{ type: "scan.started" }, { type: "scan.cancelled" }], + withCamera({ kind: "add" }), + ) + + expect(selectServerConnectView(cancelled.state, context).canScan).toBe(false) + expect(transitionServerConnect(cancelled.state, { type: "scan.started" }).state).toBe(cancelled.state) + + // The answer of the first check is stale. + expect( + transitionServerConnect(cancelled.state, { type: "camera.settled", attempt: 1, available: true }).state, + ).toBe(cancelled.state) + + const denied = transitionServerConnect(cancelled.state, { type: "camera.settled", attempt: 2, available: false }) + + expect(selectServerConnectView(denied.state, context)).toMatchObject({ + canScan: false, + cameraHint: "server.connect.camera.unavailable", + }) + }) + + test.each([ + { support: "insecure", showScan: false, cameraHint: "server.connect.camera.native" }, + { support: "unavailable", showScan: false, cameraHint: "server.connect.camera.unavailable" }, + { support: "none", showScan: false, cameraHint: undefined }, + ] as const)("a $support camera shows its hint at once, with no check", (input) => { + const start = startServerConnect({ kind: "add" }, input.support) + + expect(start.effects).toEqual([]) + expect(selectServerConnectView(start.state, context)).toMatchObject({ + showScan: input.showScan, + cameraHint: input.cameraHint, + }) + expect(transitionServerConnect(start.state, { type: "scan.started" }).state).toBe(start.state) + }) + + test("closing during a camera check stops its timer and ignores its answer", () => { + const closed = transitionServerConnect(startServerConnect({ kind: "add" }, "probe").state, { type: "disposed" }) + + expect(closed.effects).toEqual([{ type: "camera.timer.stop" }]) + expect(transitionServerConnect(closed.state, { type: "camera.settled", attempt: 1, available: true }).state).toBe( + closed.state, + ) }) test("a result after the dialog unmounts saves nothing", () => { @@ -341,7 +422,7 @@ describe("server connect form", () => { }) test("an edit starts from the server, on a pairing link when it signed out", () => { - const view = (target: ServerConnectTarget) => selectServerConnectView(createServerConnectState(target), context) + const view = (target: ServerConnectTarget) => selectServerConnectView(startServerConnect(target).state, context) expect(view(edit({ displayName: "Remote", password: "secret" })).draft).toEqual({ method: "password", diff --git a/packages/app/src/servers/connect/machine.ts b/packages/app/src/servers/connect/machine.ts index 4e442255be..eada0c85d0 100644 --- a/packages/app/src/servers/connect/machine.ts +++ b/packages/app/src/servers/connect/machine.ts @@ -9,6 +9,21 @@ import { bareServerAddress, legacyPairingLink, pairingLink, serverAddress } from */ export const SERVER_CONNECT_TIMEOUT_MS = 75_000 +/** A wedged camera daemon can leave `enumerateDevices` pending; past this the scan button gives way to the hint. */ +export const CAMERA_PROBE_TIMEOUT_MS = 3_000 + +/** What the page can tell about the camera before probing: nothing to show off the web, or a probe to run. */ +export type ServerCameraSupport = "none" | "insecure" | "unavailable" | "probe" + +export type ServerCameraState = + /** Not the web app: the native apps pair by pasted link. */ + | { readonly status: "hidden" } + /** A plain-HTTP page cannot open the camera. */ + | { readonly status: "insecure" } + | { readonly status: "probing"; readonly attempt: number } + | { readonly status: "available" } + | { readonly status: "unavailable" } + /** The saved server an edit form started from, as it is now. */ export type ServerOriginal = { readonly url: string @@ -48,6 +63,8 @@ export type ServerSaveAction = type Form = { readonly attempt: number + readonly cameraAttempt: number + readonly camera: ServerCameraState readonly target: ServerConnectTarget readonly draft: ServerConnectDraft } @@ -69,6 +86,8 @@ export type ServerConnectState = export type ServerConnectEvent = | { readonly type: "method.changed"; readonly method: ConnectMethod } | { readonly type: "field.changed"; readonly field: ServerConnectField; readonly value: string } + | { readonly type: "camera.settled"; readonly attempt: number; readonly available: boolean } + | { readonly type: "camera.timed-out"; readonly attempt: number } | { readonly type: "scan.started" } | { readonly type: "scan.cancelled" } | { readonly type: "scan.completed"; readonly link: string } @@ -92,6 +111,9 @@ export type ServerConnectEffect = | { readonly type: "connect.http"; readonly attempt: number; readonly http: ServerConnection.HttpBase } | { readonly type: "timer.start"; readonly attempt: number; readonly timeoutMs: number } | { readonly type: "timer.stop" } + /** Check for a camera, and dispatch `camera.timed-out` after `timeoutMs`. */ + | { readonly type: "camera.probe"; readonly attempt: number; readonly timeoutMs: number } + | { readonly type: "camera.timer.stop" } | { readonly type: "save"; readonly action: ServerSaveAction } | { readonly type: "close"; readonly saved?: ServerConnection.Http } @@ -100,8 +122,19 @@ export type ServerConnectTransition = { readonly effects: readonly ServerConnectEffect[] } -export function createServerConnectState(target: ServerConnectTarget): ServerConnectState { - return { status: "editing", attempt: 0, target, draft: initialDraft(target) } +export function startServerConnect( + target: ServerConnectTarget, + support: ServerCameraSupport = "none", +): ServerConnectTransition { + const base = { status: "editing", attempt: 0, cameraAttempt: 0, target, draft: initialDraft(target) } as const + + if (support === "probe") + return { + state: { ...base, cameraAttempt: 1, camera: { status: "probing", attempt: 1 } }, + effects: [probe(1)], + } + + return { state: { ...base, camera: { status: support === "none" ? "hidden" : support } }, effects: [] } } export function transitionServerConnect(state: ServerConnectState, event: ServerConnectEvent): ServerConnectTransition { @@ -109,13 +142,35 @@ export function transitionServerConnect(state: ServerConnectState, event: Server if (state.status === "closed") return same - if (event.type === "disposed") - return { state: { ...form(state), status: "closed" }, effects: state.status === "submitting" ? [stop] : [] } + if (event.type === "disposed") return close(state, state.status === "submitting" ? [stop] : []) if (event.type === "original.synced") return synced(state, event.original) + if (event.type === "camera.settled" || event.type === "camera.timed-out") { + if (state.camera.status !== "probing" || state.camera.attempt !== event.attempt) return same + const available = event.type === "camera.settled" && event.available + + return { + state: { ...state, camera: { status: available ? "available" : "unavailable" } }, + effects: [{ type: "camera.timer.stop" }], + } + } + if (state.status === "scanning") { - if (event.type === "scan.cancelled") return { state: { ...form(state), status: "editing" }, effects: [] } + // The scanner may have just been denied the camera, so it is checked again before Scan is offered. + if (event.type === "scan.cancelled") { + const cameraAttempt = state.cameraAttempt + 1 + + return { + state: { + ...form(state), + status: "editing", + cameraAttempt, + camera: { status: "probing", attempt: cameraAttempt }, + }, + effects: [probe(cameraAttempt)], + } + } if (event.type === "scan.completed") return submit(state, { ...state.draft, method: "link", link: event.link }) @@ -149,7 +204,11 @@ export function transitionServerConnect(state: ServerConnectState, event: Server return { state: editing(state, { ...state.draft, [event.field]: event.value }), effects: [] } } - if (event.type === "scan.started") return { state: { ...form(state), status: "scanning" }, effects: [] } + if (event.type === "scan.started") { + if (state.camera.status !== "available") return same + + return { state: { ...form(state), status: "scanning" }, effects: [] } + } if (event.type === "submitted") return submit(state, state.draft) @@ -165,11 +224,16 @@ export type ServerConnectErrorKey = | "server.connect.failed" | "dialog.server.add.error" +export type ServerConnectViewKey = + | ServerConnectErrorKey + | "server.connect.camera.unavailable" + | "server.connect.camera.native" + export type ServerConnectErrorContext = { readonly surface: "screen" | "dialog" /** Set on the web app, where an HTTPS page cannot reach a plain-HTTP address. */ readonly pageHref: string | undefined - readonly t: (key: ServerConnectErrorKey) => string + readonly t: (key: ServerConnectViewKey) => string } export function formatServerConnectError(error: ServerConnectError, context: ServerConnectErrorContext) { @@ -187,9 +251,15 @@ export function formatServerConnectError(error: ServerConnectError, context: Ser } export function selectServerConnectView(state: ServerConnectState, context: ServerConnectErrorContext) { - const primary = state.draft.method === "link" ? state.draft.link : state.draft.url + const link = state.draft.method === "link" + const primary = link ? state.draft.link : state.draft.url + const camera = state.camera.status return { + // Shown, disabled, while the camera check runs, so the hint does not flash in first. + showScan: link && (camera === "available" || camera === "probing"), + canScan: state.status === "editing" && link && camera === "available", + cameraHint: link ? cameraHint(camera, context) : undefined, scanning: state.status === "scanning", busy: state.status === "submitting", disabled: state.status !== "editing", @@ -202,8 +272,29 @@ export function selectServerConnectView(state: ServerConnectState, context: Serv export type ServerConnectView = ReturnType +// QR codes carry JSON, not a link, so on a plain-HTTP page the pasted link is the way in. +function cameraHint(camera: ServerCameraState["status"], context: ServerConnectErrorContext) { + if (camera === "insecure") return context.t("server.connect.camera.native") + + if (camera === "unavailable") return context.t("server.connect.camera.unavailable") + + return undefined +} + const stop = { type: "timer.stop" } as const +function probe(attempt: number): ServerConnectEffect { + return { type: "camera.probe", attempt, timeoutMs: CAMERA_PROBE_TIMEOUT_MS } +} + +/** Closes the form, stopping a camera check that is still running. */ +function close(state: Form, effects: readonly ServerConnectEffect[]): ServerConnectTransition { + return { + state: { ...form(state), status: "closed" }, + effects: state.camera.status === "probing" ? [...effects, { type: "camera.timer.stop" }] : effects, + } +} + function initialDraft(target: ServerConnectTarget): ServerConnectDraft { if (target.kind !== "edit") return { @@ -225,11 +316,17 @@ function initialDraft(target: ServerConnectTarget): ServerConnectDraft { } function form(state: Form): Form { - return { attempt: state.attempt, target: state.target, draft: state.draft } + return { + attempt: state.attempt, + cameraAttempt: state.cameraAttempt, + camera: state.camera, + target: state.target, + draft: state.draft, + } } function editing(state: Form, draft: ServerConnectDraft, error?: ServerConnectError): ServerConnectState { - return { status: "editing", attempt: state.attempt, target: state.target, draft, error } + return { ...form(state), status: "editing", draft, error } } // Where the form points: a pasted or scanned pairing link wins, in either field; else the address and password. @@ -245,7 +342,7 @@ function submit(state: Form, draft: ServerConnectDraft): ServerConnectTransition const fallbackUrl = preferredUrl ?? link.urls[0] ?? value return { - state: { status: "submitting", attempt, target: state.target, draft, fallbackUrl }, + state: { ...form(state), status: "submitting", attempt, draft, fallbackUrl }, effects: [{ type: "connect.link", attempt, link: value, preferredUrl, fallbackUrl }, timer], } } @@ -275,12 +372,12 @@ function submit(state: Form, draft: ServerConnectDraft): ServerConnectTransition (draft.name.trim() || undefined) === original.displayName && password === original.password ) - return { state: { ...form(state), draft, status: "closed" }, effects: [{ type: "close" }] } + return close({ ...state, draft }, [{ type: "close" }]) const http = password ? { url, password } : { url } return { - state: { status: "submitting", attempt, target: state.target, draft, fallbackUrl: url }, + state: { ...form(state), status: "submitting", attempt, draft, fallbackUrl: url }, effects: [{ type: "connect.http", attempt, http }, timer], } } @@ -300,10 +397,7 @@ function saved(state: Form, http: ServerConnection.HttpBase): ServerConnectTrans ? { type: "replace", originalUrl: original.url, connection } : { type: "add", connection } - return { - state: { ...form(state), status: "closed" }, - effects: [stop, { type: "save", action }, { type: "close", saved: connection }], - } + return close(state, [stop, { type: "save", action }, { type: "close", saved: connection }]) } function synced( @@ -313,11 +407,7 @@ function synced( if (state.target.kind !== "edit") return { state, effects: [] } // The edited server was removed elsewhere: there is nothing left to save to. - if (!original) - return { - state: { ...form(state), status: "closed" }, - effects: [...(state.status === "submitting" ? [stop] : []), { type: "close" }], - } + if (!original) return close(state, [...(state.status === "submitting" ? [stop] : []), { type: "close" }]) const current = state.target.original diff --git a/packages/app/src/servers/connect/screen.tsx b/packages/app/src/servers/connect/screen.tsx index 45598c4a87..045209786b 100644 --- a/packages/app/src/servers/connect/screen.tsx +++ b/packages/app/src/servers/connect/screen.tsx @@ -3,8 +3,6 @@ import { Button } from "@opencode/ui/button" import { TextInput } from "@opencode/ui/text-input" import { Wordmark } from "@opencode/ui/wordmark" import { useLanguage } from "@/runtime/i18n/language" -import { usePlatform } from "@/runtime/platform/platform" -import { cameraHint, createCameraAvailability } from "./camera" import { createServerConnectController } from "./controller" import { ConnectMethodSwitch } from "./method" import "./screen.css" @@ -13,8 +11,6 @@ const PairingScanner = lazy(() => import("./scanner").then((module) => ({ defaul export function ConnectServerScreen(props: { url?: string } = {}) { const language = useLanguage() - const platform = usePlatform() - const camera = createCameraAvailability() // Read once: the screen leaves when the server it signs in to answers, so its address does not change while it shows. const form = createServerConnectController({ surface: "screen", target: { kind: "connect", url: props.url } }) const view = form.view @@ -39,10 +35,7 @@ export function ConnectServerScreen(props: { url?: string } = {}) { {language.t("server.connect.camera.starting")}

}> { - form.dispatch({ type: "scan.cancelled" }) - void camera.refetch() - }} + onCancel={() => form.dispatch({ type: "scan.cancelled" })} onScan={(link) => form.dispatch({ type: "scan.completed", link })} />
@@ -131,21 +124,17 @@ export function ConnectServerScreen(props: { url?: string } = {}) { {language.t(view().busy ? "dialog.server.add.checking" : "server.connect.button")} - - {language.t(cameraHint())}

} + + - + {language.t("server.connect.scan")} +
+ {(hint) =>

{hint()}

}
((steps, event) => { + steps.push(transitionSessionExport(steps.at(-1)?.state ?? from, event)) + + return steps + }, []) +} + +test("Export from the header menu while /export runs, or a second click on a Home row, fetches and saves once", () => { + const [first, repeat, fetched, again, saved] = replay([ + { type: "export.requested", target }, + { type: "export.requested", target: { ...target } }, + { type: "export.fetched", attempt: 1, target, data: exported }, + { type: "export.requested", target }, + { type: "export.saved", attempt: 1, target, filename: "ses_1.json", saved: true }, + ]) + + expect(first?.effects).toEqual([{ type: "export.fetch", attempt: 1, target }]) + expect(repeat?.state).toBe(first!.state) + expect(repeat?.effects).toEqual([]) + // The save dialog may stay open a long time; the export still holds the session until it answers. + expect(fetched?.state).toBe(first!.state) + expect(fetched?.effects).toEqual([{ type: "export.save", attempt: 1, target, data: exported }]) + expect(selectSessionExporting(fetched!.state, target)).toBe(true) + expect(again?.effects).toEqual([]) + expect(saved?.effects).toEqual([{ type: "toast.exported", filename: "ses_1.json" }]) + expect(selectSessionExporting(saved!.state, target)).toBe(false) +}) + +test("another session, or the same session on another server, exports alongside", () => { + const [, otherSession, otherServer] = replay([ + { type: "export.requested", target }, + { type: "export.requested", target: { server, sessionID: "ses_2" } }, + { type: "export.requested", target: { server: ServerConnection.Key.make("srv_2"), sessionID: "ses_1" } }, + ]) + + expect(otherSession?.effects).toEqual([{ type: "export.fetch", attempt: 2, target: { server, sessionID: "ses_2" } }]) + expect(otherServer?.effects).toMatchObject([{ type: "export.fetch", attempt: 3 }]) +}) + +test("a cancelled save is quiet, a failure toasts, and a stale result is dropped", () => { + const [, , cancelled] = replay([ + { type: "export.requested", target }, + { type: "export.fetched", attempt: 1, target, data: exported }, + { type: "export.saved", attempt: 1, target, filename: "ses_1.json", saved: false }, + ]) + + const [, failed, retried, stale] = replay([ + { type: "export.requested", target }, + { type: "export.failed", attempt: 1, target, message: "timed out" }, + { type: "export.requested", target }, + { type: "export.fetched", attempt: 1, target, data: exported }, + ]) + + expect(cancelled?.effects).toEqual([]) + expect(selectSessionExporting(cancelled!.state, target)).toBe(false) + expect(failed?.effects).toEqual([{ type: "toast.export-failed", message: "timed out" }]) + expect(retried?.effects).toEqual([{ type: "export.fetch", attempt: 2, target }]) + expect(stale?.state).toBe(retried!.state) + expect(stale?.effects).toEqual([]) +}) + +test("leaving the screen aborts the fetches still paging, and no save dialog or toast follows", () => { + const [, , disposed, lateFetch, lateFailure] = replay([ + { type: "export.requested", target }, + { type: "export.requested", target: { server, sessionID: "ses_2" } }, + { type: "disposed" }, + { type: "export.fetched", attempt: 1, target, data: exported }, + { type: "export.failed", attempt: 2, target: { server, sessionID: "ses_2" }, message: "aborted" }, + ]) + + expect(disposed?.state).toEqual({ status: "disposed" }) + expect(disposed?.effects).toEqual([ + { type: "export.abort", attempt: 1 }, + { type: "export.abort", attempt: 2 }, + ]) + expect(lateFetch?.state).toBe(disposed!.state) + expect(lateFetch?.effects).toEqual([]) + expect(lateFailure?.effects).toEqual([]) +}) diff --git a/packages/app/src/session/commands/export-machine.ts b/packages/app/src/session/commands/export-machine.ts new file mode 100644 index 0000000000..90b9d1e4e9 --- /dev/null +++ b/packages/app/src/session/commands/export-machine.ts @@ -0,0 +1,117 @@ +import type { ServerConnection } from "@/runtime/server/registry" +import type { SessionExportData } from "./export" + +export type SessionExportTarget = { + readonly server: ServerConnection.Key + readonly sessionID: string +} + +/** + * Session exports, keyed by server and session: /export, the session header's menu and Home's rows share one export + * per session, which holds it from the first page fetch until the save dialog answers. + */ +export type SessionExportState = + | { + readonly status: "active" + readonly issued: number + readonly exporting: Readonly> + } + | { readonly status: "disposed" } + +export type SessionExportEvent = + | { readonly type: "export.requested"; readonly target: SessionExportTarget } + | { + readonly type: "export.fetched" + readonly attempt: number + readonly target: SessionExportTarget + readonly data: SessionExportData + } + | { + readonly type: "export.saved" + readonly attempt: number + readonly target: SessionExportTarget + readonly filename: string + readonly saved: boolean + } + | { + readonly type: "export.failed" + readonly attempt: number + readonly target: SessionExportTarget + readonly message?: string + } + | { readonly type: "disposed" } + +export type SessionExportEffect = + | { readonly type: "export.fetch"; readonly attempt: number; readonly target: SessionExportTarget } + | { + readonly type: "export.save" + readonly attempt: number + readonly target: SessionExportTarget + readonly data: SessionExportData + } + | { readonly type: "export.abort"; readonly attempt: number } + | { readonly type: "toast.exported"; readonly filename: string } + | { readonly type: "toast.export-failed"; readonly message?: string } + +export type SessionExportTransition = { + readonly state: SessionExportState + readonly effects: readonly SessionExportEffect[] +} + +const NO_EFFECTS: readonly never[] = Object.freeze([]) + +export function createSessionExportState(): SessionExportState { + return { status: "active", issued: 0, exporting: {} } +} + +export function transitionSessionExport(state: SessionExportState, event: SessionExportEvent): SessionExportTransition { + if (state.status === "disposed") return { state, effects: NO_EFFECTS } + + if (event.type === "disposed") { + return { + state: { status: "disposed" }, + effects: Object.values(state.exporting).map((attempt) => ({ type: "export.abort", attempt })), + } + } + + const key = sessionExportKey(event.target) + + if (event.type === "export.requested") { + // Another surface, or a second click, joins the export already running for this session. + if (state.exporting[key] !== undefined) return { state, effects: NO_EFFECTS } + const attempt = state.issued + 1 + + return { + state: { status: "active", issued: attempt, exporting: { ...state.exporting, [key]: attempt } }, + effects: [{ type: "export.fetch", attempt, target: event.target }], + } + } + + if (state.exporting[key] !== event.attempt) return { state, effects: NO_EFFECTS } + + // The save dialog may stay open a long time; the export still holds the session until it answers. + if (event.type === "export.fetched") + return { + state, + effects: [{ type: "export.save", attempt: event.attempt, target: event.target, data: event.data }], + } + + const next: SessionExportState = { + ...state, + exporting: Object.fromEntries(Object.entries(state.exporting).filter(([entry]) => entry !== key)), + } + + if (event.type === "export.failed") + return { state: next, effects: [{ type: "toast.export-failed", message: event.message }] } + + // A cancelled save dialog is not a failure. + return { state: next, effects: event.saved ? [{ type: "toast.exported", filename: event.filename }] : NO_EFFECTS } +} + +export function selectSessionExporting(state: SessionExportState, target: SessionExportTarget) { + return state.status === "active" && state.exporting[sessionExportKey(target)] !== undefined +} + +function sessionExportKey(target: SessionExportTarget) { + return `${target.server}\0${target.sessionID}` +} diff --git a/packages/app/src/session/commands/export-session.tsx b/packages/app/src/session/commands/export-session.tsx new file mode 100644 index 0000000000..f302fca5a7 --- /dev/null +++ b/packages/app/src/session/commands/export-session.tsx @@ -0,0 +1,108 @@ +import { createSimpleContext } from "@opencode/ui/context" +import { createSignal, onCleanup, untrack } from "solid-js" +import { useLanguage } from "@/runtime/i18n/language" +import { usePlatform } from "@/runtime/platform/platform" +import { useGlobal } from "@/runtime/server/runtime" +import { showToast } from "@/shell/notifications/toast" +import { fetchSessionExport, saveSessionExport, sessionExportFilename } from "./export" +import { + createSessionExportState, + selectSessionExporting, + transitionSessionExport, + type SessionExportEffect, + type SessionExportEvent, + type SessionExportTarget, +} from "./export-machine" + +/** Runs session exports for its owner's lifetime; leaving the owner aborts the fetches still paging. */ +export function createSessionExporter() { + const global = useGlobal() + const language = useLanguage() + const platform = usePlatform() + const [exportState, setExportState] = createSignal(createSessionExportState()) + const fetches = new Map() + + const dispatch = (event: SessionExportEvent) => { + const previous = untrack(exportState) + const next = transitionSessionExport(previous, event) + + if (next.state !== previous) setExportState(next.state) + next.effects.forEach((effect) => + Promise.try(() => run(effect)).catch((cause: unknown) => console.error("[session.export]", cause)), + ) + } + + const failed = (attempt: number, target: SessionExportTarget) => (cause: unknown) => + dispatch({ + type: "export.failed", + attempt, + target, + message: cause instanceof Error ? cause.message : undefined, + }) + + function run(effect: SessionExportEffect) { + if (effect.type === "export.fetch") { + const api = untrack(() => global.serverCtx(effect.target.server))?.sdk.api + + if (!api) return dispatch({ type: "export.failed", attempt: effect.attempt, target: effect.target }) + const controller = new AbortController() + fetches.set(effect.attempt, controller) + void fetchSessionExport({ sessionID: effect.target.sessionID, api, signal: controller.signal }) + .finally(() => fetches.delete(effect.attempt)) + .then( + (data) => dispatch({ type: "export.fetched", attempt: effect.attempt, target: effect.target, data }), + failed(effect.attempt, effect.target), + ) + + return + } + + if (effect.type === "export.abort") { + fetches.get(effect.attempt)?.abort() + fetches.delete(effect.attempt) + + return + } + + if (effect.type === "export.save") { + const filename = sessionExportFilename(effect.data.info) + void Promise.try(() => saveSessionExport(filename, effect.data, platform)).then( + (saved) => dispatch({ type: "export.saved", attempt: effect.attempt, target: effect.target, filename, saved }), + failed(effect.attempt, effect.target), + ) + + return + } + + if (effect.type === "toast.exported") { + showToast({ + variant: "success", + icon: "circle-check", + title: language.t("toast.session.export.success.title"), + description: language.t("toast.session.export.success.description", { filename: effect.filename }), + }) + + return + } + + showToast({ + variant: "error", + title: language.t("toast.session.export.failed.title"), + description: effect.message ?? language.t("toast.session.export.failed.description"), + }) + } + + onCleanup(() => dispatch({ type: "disposed" })) + + return { + export: (target: SessionExportTarget) => dispatch({ type: "export.requested", target }), + exporting: (target: SessionExportTarget) => selectSessionExporting(exportState(), target), + } +} + +/** One exporter for the session screen, so /export and the header menu share each session's export. */ +export const { use: useSessionExporter, provider: SessionExportProvider } = createSimpleContext({ + name: "SessionExport", + gate: false, + init: createSessionExporter, +}) diff --git a/packages/app/src/session/commands/machine.test.ts b/packages/app/src/session/commands/machine.test.ts index 4eeb58dbf8..2768d02a12 100644 --- a/packages/app/src/session/commands/machine.test.ts +++ b/packages/app/src/session/commands/machine.test.ts @@ -1,6 +1,7 @@ import { describe, expect, test } from "bun:test" -import type { SessionInfo } from "@opencode/client/promise" import { + CLOSE_TAB_GUARD_QUIET_MS, + SESSION_DIALOG_LOAD_TIMEOUT_MS, createCloseTabGuardState, createSessionCommandsState, selectCloseTabSwallowed, @@ -12,11 +13,9 @@ import { type SessionCommandsEvent, type SessionCommandsState, type SessionCommandsTransition, + type SessionDialogKind, } from "./machine" -/* oxlint-disable anti-slop/require-safety-comment-for-type-assertion -- the machine passes export data through untouched */ -const exported = { info: { id: "ses_1" } as SessionInfo, messages: [] } - function replay(events: SessionCommandsEvent[], from: SessionCommandsState = createSessionCommandsState()) { return events.reduce((steps, event) => { steps.push(transitionSessionCommands(steps.at(-1)?.state ?? from, event)) @@ -64,98 +63,123 @@ describe("transitionSessionCommands", () => { expect(late?.effects).toEqual([]) }) - test("a repeated /export while one runs fetches and saves once", () => { - const [first, repeat, fetched, saved] = replay([ - { type: "export.requested", sessionID: "ses_1" }, - { type: "export.requested", sessionID: "ses_1" }, - { type: "export.fetched", attempt: 1, sessionID: "ses_1", data: exported }, - { type: "export.saved", attempt: 1, sessionID: "ses_1", filename: "ses_1.json", saved: true }, + test("leaving the session screen silences late results", () => { + const [, disposed, lateCompact] = replay([ + { type: "compact.requested", sessionID: "ses_1" }, + { type: "disposed" }, + { type: "compact.failed", attempt: 1, sessionID: "ses_1", cause: "late" }, ]) - expect(first?.effects).toEqual([{ type: "export.fetch", attempt: 1, sessionID: "ses_1" }]) - expect(repeat?.state).toBe(first!.state) - expect(repeat?.effects).toEqual([]) - // The save dialog may stay open a long time; the export still holds the session until it answers. - expect(fetched?.state).toBe(first!.state) - expect(fetched?.effects).toEqual([{ type: "export.save", attempt: 1, sessionID: "ses_1", data: exported }]) - expect(saved?.state).toMatchObject({ exporting: {} }) - expect(saved?.effects).toEqual([{ type: "toast.exported", filename: "ses_1.json" }]) + expect(disposed?.state).toEqual({ status: "disposed" }) + expect(lateCompact?.state).toBe(disposed!.state) + expect(lateCompact?.effects).toEqual([]) }) - test("a cancelled save is quiet and a failed fetch toasts", () => { - const [, , cancelled] = replay([ - { type: "export.requested", sessionID: "ses_1" }, - { type: "export.fetched", attempt: 1, sessionID: "ses_1", data: exported }, - { type: "export.saved", attempt: 1, sessionID: "ses_1", filename: "ses_1.json", saved: false }, + test.each(["fork", "palette", "mcp"])( + "a repeated request while the %s dialog loads opens it once", + (kind) => { + const [first, repeat, loaded, again] = replay([ + { type: "dialog.requested", kind, sessionKey: "A" }, + { type: "dialog.requested", kind, sessionKey: "A" }, + { type: "dialog.loaded", attempt: 1 }, + { type: "dialog.loaded", attempt: 1 }, + ]) + + expect(first?.effects).toEqual([ + { type: "dialog.load", attempt: 1, kind, timeoutMs: SESSION_DIALOG_LOAD_TIMEOUT_MS }, + ]) + expect(repeat?.state).toBe(first!.state) + expect(repeat?.effects).toEqual([]) + expect(loaded?.effects).toEqual([{ type: "dialog.cancel" }, { type: "dialog.show", kind }]) + expect(again?.state).toBe(loaded!.state) + expect(again?.effects).toEqual([]) + }, + ) + + // Before, /open and /mcp awaited the chunk with nothing to catch a failure: an unhandled rejection, and no toast. + test("a failed /open load toasts and the next request loads again", () => { + const [, failed, retried] = replay([ + { type: "dialog.requested", kind: "palette", sessionKey: "A" }, + { type: "dialog.load-failed", attempt: 1, cause: "ChunkLoadError" }, + { type: "dialog.requested", kind: "palette", sessionKey: "A" }, ]) - const [, failed] = replay([ - { type: "export.requested", sessionID: "ses_1" }, - { type: "export.failed", attempt: 1, sessionID: "ses_1", message: "timed out" }, + expect(failed?.effects).toEqual([ + { type: "dialog.cancel" }, + { type: "toast.request-failed", cause: "ChunkLoadError" }, + ]) + expect(failed?.state).toMatchObject({ dialog: { status: "closed" } }) + expect(retried?.effects).toEqual([ + { type: "dialog.load", attempt: 2, kind: "palette", timeoutMs: SESSION_DIALOG_LOAD_TIMEOUT_MS }, ]) - - expect(cancelled?.effects).toEqual([]) - expect(failed?.effects).toEqual([{ type: "toast.export-failed", message: "timed out" }]) }) - test("leaving the session screen aborts exports and silences late results", () => { - const [, , disposed, lateExport, lateCompact] = replay([ - { type: "compact.requested", sessionID: "ses_1" }, - { type: "export.requested", sessionID: "ses_2" }, - { type: "disposed" }, - { type: "export.failed", attempt: 2, sessionID: "ses_2", message: "aborted" }, - { type: "compact.failed", attempt: 1, sessionID: "ses_1", cause: "late" }, + // Before, a chunk that never arrived left the command doing nothing, for good. + test("a stalled /mcp load times out with a toast, and its late result opens nothing", () => { + const [, timedOut, late] = replay([ + { type: "dialog.requested", kind: "mcp", sessionKey: "A" }, + { type: "dialog.timed-out", attempt: 1 }, + { type: "dialog.loaded", attempt: 1 }, ]) - expect(disposed?.state).toEqual({ status: "disposed" }) - expect(disposed?.effects).toEqual([{ type: "export.abort", attempt: 2 }]) - expect(lateExport?.state).toBe(disposed!.state) - expect(lateExport?.effects).toEqual([]) - expect(lateCompact?.effects).toEqual([]) + expect(timedOut?.effects).toEqual([{ type: "toast.request-failed", cause: undefined }]) + expect(late?.state).toBe(timedOut!.state) + expect(late?.effects).toEqual([]) }) - test("a repeated /fork while the picker loads opens it once", () => { - const [first, repeat, loaded, again] = replay([ - { type: "fork.requested", sessionID: "ses_1" }, - { type: "fork.requested", sessionID: "ses_1" }, - { type: "fork.loaded", attempt: 1 }, - { type: "fork.loaded", attempt: 1 }, + test("another dialog replaces one still loading", () => { + const [, replaced, stale, loaded] = replay([ + { type: "dialog.requested", kind: "palette", sessionKey: "A" }, + { type: "dialog.requested", kind: "mcp", sessionKey: "A" }, + { type: "dialog.loaded", attempt: 1 }, + { type: "dialog.loaded", attempt: 2 }, ]) - expect(first?.effects).toEqual([{ type: "fork.load", attempt: 1 }]) - expect(repeat?.state).toBe(first!.state) - expect(loaded?.effects).toEqual([{ type: "fork.show" }]) - expect(again?.state).toBe(loaded!.state) - expect(again?.effects).toEqual([]) + expect(replaced?.effects).toEqual([ + { type: "dialog.cancel" }, + { type: "dialog.load", attempt: 2, kind: "mcp", timeoutMs: SESSION_DIALOG_LOAD_TIMEOUT_MS }, + ]) + expect(stale?.state).toBe(replaced!.state) + expect(loaded?.effects).toEqual([{ type: "dialog.cancel" }, { type: "dialog.show", kind: "mcp" }]) }) - test("the picker does not open over another session, and a failed load toasts", () => { - const [, moved, late] = replay([ - { type: "fork.requested", sessionID: "ses_1" }, - { type: "session.changed", sessionID: "ses_2" }, - { type: "fork.loaded", attempt: 1 }, + // Moved from the retired session ownership helper: leaving the session, even to come back, drops the load. + test("a dialog does not open over another session, or after returning to its own", () => { + const [, moved, back, late] = replay([ + { type: "dialog.requested", kind: "fork", sessionKey: "A" }, + { type: "session.changed", sessionKey: "B" }, + { type: "session.changed", sessionKey: "A" }, + { type: "dialog.loaded", attempt: 1 }, ]) - const [, failed] = replay([ - { type: "fork.requested", sessionID: "ses_1" }, - { type: "fork.load-failed", attempt: 1, cause: "chunk" }, + expect(moved?.state).toMatchObject({ dialog: { status: "closed" } }) + expect(moved?.effects).toEqual([{ type: "dialog.cancel" }]) + expect(back?.state).toBe(moved!.state) + expect(late?.effects).toEqual([]) + }) + + test("leaving the session screen cancels a loading dialog and ignores requests after", () => { + const [, disposed, requested, loaded] = replay([ + { type: "dialog.requested", kind: "palette", sessionKey: "A" }, + { type: "disposed" }, + { type: "dialog.requested", kind: "palette", sessionKey: "A" }, + { type: "dialog.loaded", attempt: 1 }, ]) - expect(moved?.state).toMatchObject({ forkDialog: { status: "closed" } }) - expect(late?.effects).toEqual([]) - expect(failed?.effects).toEqual([{ type: "toast.request-failed", cause: "chunk" }]) - expect(failed?.state).toMatchObject({ forkDialog: { status: "closed" } }) + expect(disposed?.effects).toEqual([{ type: "dialog.cancel" }]) + expect(requested?.state).toBe(disposed!.state) + expect(requested?.effects).toEqual([]) + expect(loaded?.effects).toEqual([]) }) - test("switching session keeps the other session's compaction and export running", () => { - const [, , changed] = replay([ + test("switching session keeps the other session's compaction running", () => { + const [, changed] = replay([ { type: "compact.requested", sessionID: "ses_1" }, - { type: "export.requested", sessionID: "ses_1" }, - { type: "session.changed", sessionID: "ses_2" }, + { type: "session.changed", sessionKey: "B" }, ]) expect(changed?.effects).toEqual([]) - expect(changed?.state).toMatchObject({ compacting: { ses_1: 1 }, exporting: { ses_1: 2 } }) + expect(changed?.state).toMatchObject({ compacting: { ses_1: 1 } }) }) }) @@ -171,7 +195,7 @@ describe("transitionCloseTabGuard", () => { ]) expect(armed?.state).toEqual({ status: "armed", attempt: 1, tabKey: "alpha", settling: true }) - expect(armed?.effects).toEqual([{ type: "settle.schedule", attempt: 1 }]) + expect(armed?.effects).toEqual([{ type: "settle.schedule", attempt: 1 }, { type: "quiet.schedule", attempt: 1, timeoutMs: CLOSE_TAB_GUARD_QUIET_MS }]) expect(focused?.state).toBe(armed!.state) expect(selectCloseTabSwallowed(focused!.state)).toBe(true) expect(settled?.state).toEqual({ status: "armed", attempt: 1, tabKey: "alpha", settling: false }) @@ -188,7 +212,7 @@ describe("transitionCloseTabGuard", () => { expect(synced?.state).toBe(armed!.state) expect(otherTab?.state).toEqual({ status: "disarmed", issued: 1 }) - expect(otherTab?.effects).toEqual([{ type: "settle.cancel" }]) + expect(otherTab?.effects).toEqual([{ type: "settle.cancel" }, { type: "quiet.cancel" }]) }) test("the panel reopening disarms the guard", () => { @@ -206,12 +230,12 @@ describe("transitionCloseTabGuard", () => { const [, , settled] = replayGuard([closedPanel, { type: "settle.completed", attempt: 1 }, event]) expect(settling?.state).toEqual({ status: "disarmed", issued: 1 }) - expect(settling?.effects).toEqual([{ type: "settle.cancel" }]) + expect(settling?.effects).toEqual([{ type: "settle.cancel" }, { type: "quiet.cancel" }]) expect(settled?.state).toEqual({ status: "disarmed", issued: 1 }) - expect(settled?.effects).toEqual([]) + expect(settled?.effects).toEqual([{ type: "quiet.cancel" }]) }) - test("modifier keys and repeated ⌘W keep swallowing", () => { + test("modifier keys and repeated ⌘W keep swallowing, each ⌘W restarting the rest", () => { const [armed, modifier, close] = replayGuard([ closedPanel, { type: "key.down", key: "Meta", matchesClose: false }, @@ -219,7 +243,22 @@ describe("transitionCloseTabGuard", () => { ]) expect(modifier?.state).toBe(armed!.state) + expect(modifier?.effects).toEqual([]) expect(close?.state).toBe(armed!.state) + expect(close?.effects).toEqual([{ type: "quiet.schedule", attempt: 1, timeoutMs: CLOSE_TAB_GUARD_QUIET_MS }]) + }) + + test("once ⌘W rests, the next ⌘W closes the session tab again", () => { + const [, , stale, rested] = replayGuard([ + closedPanel, + { type: "key.down", key: "w", matchesClose: true }, + { type: "quiet.elapsed", attempt: 0 }, + { type: "quiet.elapsed", attempt: 1 }, + ]) + + expect(selectCloseTabSwallowed(stale!.state)).toBe(true) + expect(rested?.state).toEqual({ status: "disarmed", issued: 1 }) + expect(selectCloseTabSwallowed(rested!.state)).toBe(false) }) test("a close from the palette, or one that leaves the panel open, does not arm", () => { @@ -232,7 +271,11 @@ describe("transitionCloseTabGuard", () => { test("re-arming fences the previous frame, and a stale settle is dropped", () => { const [, rearmed, stale] = replayGuard([closedPanel, closedPanel, { type: "settle.completed", attempt: 1 }]) - expect(rearmed?.effects).toEqual([{ type: "settle.cancel" }, { type: "settle.schedule", attempt: 2 }]) + expect(rearmed?.effects).toEqual([ + { type: "settle.cancel" }, + { type: "settle.schedule", attempt: 2 }, + { type: "quiet.schedule", attempt: 2, timeoutMs: CLOSE_TAB_GUARD_QUIET_MS }, + ]) expect(stale?.state).toBe(rearmed!.state) }) @@ -246,6 +289,7 @@ describe("transitionCloseTabGuard", () => { { type: "key.down", key: "a", matchesClose: false }, { type: "layout.synced", tabKey: "beta", sideOpened: true }, { type: "settle.completed", attempt: 1 }, + { type: "quiet.elapsed", attempt: 1 }, ] events.forEach((event) => expect(transitionCloseTabGuard(disarmed, event).state).toBe(disarmed)) @@ -254,7 +298,7 @@ describe("transitionCloseTabGuard", () => { test("disposing cancels a pending frame and ignores everything after", () => { const [, disposed, late] = replayGuard([closedPanel, { type: "disposed" }, closedPanel]) - expect(disposed?.effects).toEqual([{ type: "settle.cancel" }]) + expect(disposed?.effects).toEqual([{ type: "settle.cancel" }, { type: "quiet.cancel" }]) expect(late?.state).toBe(disposed!.state) expect(late?.effects).toEqual([]) }) diff --git a/packages/app/src/session/commands/machine.ts b/packages/app/src/session/commands/machine.ts index e6d7bd2b02..3d6a5404fb 100644 --- a/packages/app/src/session/commands/machine.ts +++ b/packages/app/src/session/commands/machine.ts @@ -1,20 +1,29 @@ -import type { SessionExportData } from "./export" +// --- Session commands: /compact and opening the /fork, /open and /mcp dialogs --- -// --- Session commands: /compact, /export and opening /fork --- +// A dialog's chunk that has not loaded by then is reported as a failed request. +export const SESSION_DIALOG_LOAD_TIMEOUT_MS = 15_000 + +/** The lazily loaded dialogs: the /fork picker, the /open file palette and the /mcp list. */ +export type SessionDialogKind = "fork" | "palette" | "mcp" /** - * The session commands stay mounted while tabs switch between sessions, so compactions and exports are keyed by the - * session they run for; the /fork picker loads for the session it was asked from. + * The session commands stay mounted while tabs switch between sessions, so compactions are keyed by the session they + * run for; a dialog loads for the session it was asked from and does not open over another. /export runs through + * `export-machine.ts`. */ export type SessionCommandsState = | { readonly status: "active" readonly issued: number readonly compacting: Readonly> - readonly exporting: Readonly> - readonly forkDialog: + readonly dialog: | { readonly status: "closed" } - | { readonly status: "loading"; readonly attempt: number; readonly sessionID: string } + | { + readonly status: "loading" + readonly attempt: number + readonly kind: SessionDialogKind + readonly sessionKey: string + } } | { readonly status: "disposed" } @@ -22,42 +31,25 @@ export type SessionCommandsEvent = | { readonly type: "compact.requested"; readonly sessionID: string } | { readonly type: "compact.succeeded"; readonly attempt: number; readonly sessionID: string } | { readonly type: "compact.failed"; readonly attempt: number; readonly sessionID: string; readonly cause: unknown } - | { readonly type: "export.requested"; readonly sessionID: string } - | { - readonly type: "export.fetched" - readonly attempt: number - readonly sessionID: string - readonly data: SessionExportData - } - | { - readonly type: "export.saved" - readonly attempt: number - readonly sessionID: string - readonly filename: string - readonly saved: boolean - } - | { readonly type: "export.failed"; readonly attempt: number; readonly sessionID: string; readonly message?: string } - | { readonly type: "fork.requested"; readonly sessionID: string } - | { readonly type: "fork.loaded"; readonly attempt: number } - | { readonly type: "fork.load-failed"; readonly attempt: number; readonly cause: unknown } - | { readonly type: "session.changed"; readonly sessionID: string | undefined } + | { readonly type: "dialog.requested"; readonly kind: SessionDialogKind; readonly sessionKey: string } + | { readonly type: "dialog.loaded"; readonly attempt: number } + | { readonly type: "dialog.load-failed"; readonly attempt: number; readonly cause: unknown } + | { readonly type: "dialog.timed-out"; readonly attempt: number } + | { readonly type: "session.changed"; readonly sessionKey: string } | { readonly type: "disposed" } export type SessionCommandsEffect = | { readonly type: "compact.run"; readonly attempt: number; readonly sessionID: string } - | { readonly type: "export.fetch"; readonly attempt: number; readonly sessionID: string } | { - readonly type: "export.save" + readonly type: "dialog.load" readonly attempt: number - readonly sessionID: string - readonly data: SessionExportData + readonly kind: SessionDialogKind + readonly timeoutMs: number } - | { readonly type: "export.abort"; readonly attempt: number } - | { readonly type: "fork.load"; readonly attempt: number } - | { readonly type: "fork.show" } + // Stops the load's timer; its result is dropped by attempt. + | { readonly type: "dialog.cancel" } + | { readonly type: "dialog.show"; readonly kind: SessionDialogKind } | { readonly type: "toast.request-failed"; readonly cause: unknown } - | { readonly type: "toast.exported"; readonly filename: string } - | { readonly type: "toast.export-failed"; readonly message?: string } export type SessionCommandsTransition = { readonly state: SessionCommandsState @@ -65,7 +57,7 @@ export type SessionCommandsTransition = { } export function createSessionCommandsState(): SessionCommandsState { - return { status: "active", issued: 0, compacting: {}, exporting: {}, forkDialog: { status: "closed" } } + return { status: "active", issued: 0, compacting: {}, dialog: { status: "closed" } } } export function transitionSessionCommands( @@ -74,12 +66,7 @@ export function transitionSessionCommands( ): SessionCommandsTransition { if (state.status === "disposed") return unchanged(state) - if (event.type === "disposed") { - return { - state: { status: "disposed" }, - effects: Object.values(state.exporting).map((attempt) => ({ type: "export.abort", attempt })), - } - } + if (event.type === "disposed") return { state: { status: "disposed" }, effects: cancelDialog(state) } if (event.type === "compact.requested") { // A compaction already admitting for this session answers a repeat, which would run with the same request. @@ -101,71 +88,60 @@ export function transitionSessionCommands( return { state: next, effects: [{ type: "toast.request-failed", cause: event.cause }] } } - if (event.type === "export.requested") { - if (state.exporting[event.sessionID] !== undefined) return unchanged(state) - const attempt = state.issued + 1 - - return { - state: { ...state, issued: attempt, exporting: { ...state.exporting, [event.sessionID]: attempt } }, - effects: [{ type: "export.fetch", attempt, sessionID: event.sessionID }], - } - } + if (event.type === "dialog.requested") { + const dialog = state.dialog - if (event.type === "export.fetched") { - if (state.exporting[event.sessionID] !== event.attempt) return unchanged(state) + // The dialog's chunk is still loading: a repeat would open it twice. + if (dialog.status === "loading" && dialog.kind === event.kind && dialog.sessionKey === event.sessionKey) + return unchanged(state) + const attempt = state.issued + 1 + // Another dialog replaces one still loading, as it would replace it once open. return { - state, - effects: [{ type: "export.save", attempt: event.attempt, sessionID: event.sessionID, data: event.data }], + state: { + ...state, + issued: attempt, + dialog: { status: "loading", attempt, kind: event.kind, sessionKey: event.sessionKey }, + }, + effects: [ + ...cancelDialog(state), + { type: "dialog.load", attempt, kind: event.kind, timeoutMs: SESSION_DIALOG_LOAD_TIMEOUT_MS }, + ], } } - if (event.type === "export.saved" || event.type === "export.failed") { - if (state.exporting[event.sessionID] !== event.attempt) return unchanged(state) - const next = { ...state, exporting: omit(state.exporting, event.sessionID) } - - if (event.type === "export.failed") { - return { state: next, effects: [{ type: "toast.export-failed", message: event.message }] } - } - - // A cancelled save dialog is not a failure. - return { state: next, effects: event.saved ? [{ type: "toast.exported", filename: event.filename }] : [] } - } + if (state.dialog.status !== "loading") return unchanged(state) + const closed: SessionCommandsState = { ...state, dialog: { status: "closed" } } - if (event.type === "fork.requested") { - // The picker's chunk is still loading: a repeat would open it twice. - if (state.forkDialog.status !== "closed") return unchanged(state) - const attempt = state.issued + 1 + // The dialogs belong to the session they were asked from, so none opens over another. + if (event.type === "session.changed") { + if (state.dialog.sessionKey === event.sessionKey) return unchanged(state) - return { - state: { ...state, issued: attempt, forkDialog: { status: "loading", attempt, sessionID: event.sessionID } }, - effects: [{ type: "fork.load", attempt }], - } + return { state: closed, effects: [{ type: "dialog.cancel" }] } } - if (event.type === "fork.loaded" || event.type === "fork.load-failed") { - if (state.forkDialog.status !== "loading" || state.forkDialog.attempt !== event.attempt) return unchanged(state) - const next: SessionCommandsState = { ...state, forkDialog: { status: "closed" } } - - if (event.type === "fork.load-failed") { - return { state: next, effects: [{ type: "toast.request-failed", cause: event.cause }] } - } + if (event.attempt !== state.dialog.attempt) return unchanged(state) - return { state: next, effects: [{ type: "fork.show" }] } - } + if (event.type === "dialog.loaded") + return { state: closed, effects: [{ type: "dialog.cancel" }, { type: "dialog.show", kind: state.dialog.kind }] } - // The picker lists one session's prompts, so it does not open over another. - if (state.forkDialog.status !== "loading" || state.forkDialog.sessionID === event.sessionID) return unchanged(state) + if (event.type === "dialog.load-failed") + return { state: closed, effects: [{ type: "dialog.cancel" }, { type: "toast.request-failed", cause: event.cause }] } - return { state: { ...state, forkDialog: { status: "closed" } }, effects: [] } + return { state: closed, effects: [{ type: "toast.request-failed", cause: undefined }] } } // --- ⌘W after the side panel empties --- +// How long ⌘W must rest after the side panel closes before it closes the session tab. +export const CLOSE_TAB_GUARD_QUIET_MS = 500 + /** * ⌘W on the side panel's last tab closes the panel; one press too many would then close the session tab. While armed, - * ⌘W closes nothing, until the user moves on by clicking, focusing elsewhere, pressing another key, leaving the window, - * or switching session. `settling` covers the frame after arming, in which closing the panel may still move focus. + * ⌘W closes nothing, until ⌘W rests for `CLOSE_TAB_GUARD_QUIET_MS` or the user moves on by clicking, focusing + * elsewhere, pressing another key, leaving the window, or switching session. Each swallowed ⌘W restarts the rest, so + * mashing or holding it never reaches the session tab. `settling` covers the frame after arming, in which closing the + * panel may still move focus. */ export type CloseTabGuardState = | { readonly status: "disarmed"; readonly issued: number } @@ -185,6 +161,7 @@ export type CloseTabGuardEvent = readonly sideOpened: boolean } | { readonly type: "settle.completed"; readonly attempt: number } + | { readonly type: "quiet.elapsed"; readonly attempt: number } | { readonly type: "pointer.down" } | { readonly type: "focus.in" } | { readonly type: "window.blur" } @@ -195,6 +172,8 @@ export type CloseTabGuardEvent = export type CloseTabGuardEffect = | { readonly type: "settle.schedule"; readonly attempt: number } | { readonly type: "settle.cancel" } + | { readonly type: "quiet.schedule"; readonly attempt: number; readonly timeoutMs: number } + | { readonly type: "quiet.cancel" } export type CloseTabGuardTransition = { readonly state: CloseTabGuardState @@ -212,7 +191,7 @@ const NO_GUARD_EFFECTS: readonly CloseTabGuardEffect[] = [] export function transitionCloseTabGuard(state: CloseTabGuardState, event: CloseTabGuardEvent): CloseTabGuardTransition { if (state.status === "disposed") return { state, effects: NO_GUARD_EFFECTS } - if (event.type === "disposed") return { state: { status: "disposed" }, effects: settleCancel(state) } + if (event.type === "disposed") return { state: { status: "disposed" }, effects: cancelTimers(state) } if (event.type === "close.completed") { if (event.keybind && !event.sideOpened) { @@ -220,7 +199,7 @@ export function transitionCloseTabGuard(state: CloseTabGuardState, event: CloseT return { state: { status: "armed", attempt, tabKey: event.tabKey, settling: true }, - effects: [...settleCancel(state), { type: "settle.schedule", attempt }], + effects: [...settleCancel(state), { type: "settle.schedule", attempt }, quietSchedule(attempt)], } } @@ -239,10 +218,16 @@ export function transitionCloseTabGuard(state: CloseTabGuardState, event: CloseT // Focus the panel's own close moves, in this frame, is not the user moving on. if (event.type === "focus.in" && state.settling) return { state, effects: NO_GUARD_EFFECTS } - if (event.type === "key.down" && (MODIFIER_KEYS.has(event.key) || event.matchesClose)) { - return { state, effects: NO_GUARD_EFFECTS } + if (event.type === "quiet.elapsed") { + if (event.attempt !== state.attempt) return { state, effects: NO_GUARD_EFFECTS } + + return disarm(state) } + if (event.type === "key.down" && event.matchesClose) return { state, effects: [quietSchedule(state.attempt)] } + + if (event.type === "key.down" && MODIFIER_KEYS.has(event.key)) return { state, effects: NO_GUARD_EFFECTS } + // The panel closing is what armed the guard; only another session or the panel reopening moves on. if (event.type === "layout.synced" && event.tabKey === state.tabKey && !event.sideOpened) { return { state, effects: NO_GUARD_EFFECTS } @@ -259,13 +244,25 @@ export function selectCloseTabSwallowed(state: CloseTabGuardState) { function disarm(state: Exclude): CloseTabGuardTransition { if (state.status === "disarmed") return { state, effects: NO_GUARD_EFFECTS } - return { state: { status: "disarmed", issued: state.attempt }, effects: settleCancel(state) } + return { state: { status: "disarmed", issued: state.attempt }, effects: cancelTimers(state) } +} + +function quietSchedule(attempt: number): CloseTabGuardEffect { + return { type: "quiet.schedule", attempt, timeoutMs: CLOSE_TAB_GUARD_QUIET_MS } +} + +function cancelTimers(state: CloseTabGuardState): CloseTabGuardEffect[] { + return state.status === "armed" ? [...settleCancel(state), { type: "quiet.cancel" }] : [] } function settleCancel(state: CloseTabGuardState): CloseTabGuardEffect[] { return state.status === "armed" && state.settling ? [{ type: "settle.cancel" }] : [] } +function cancelDialog(state: Extract): SessionCommandsEffect[] { + return state.dialog.status === "loading" ? [{ type: "dialog.cancel" }] : [] +} + function omit(record: Readonly>, key: string) { return Object.fromEntries(Object.entries(record).filter(([entry]) => entry !== key)) } diff --git a/packages/app/src/session/commands/rename-session.ts b/packages/app/src/session/commands/rename-session.ts new file mode 100644 index 0000000000..dba965c2e9 --- /dev/null +++ b/packages/app/src/session/commands/rename-session.ts @@ -0,0 +1,27 @@ +import type { SessionInfo } from "@opencode/client/promise" +import { useQueryClient } from "@tanstack/solid-query" +import { useLanguage } from "@/runtime/i18n/language" +import { ServerConnection } from "@/runtime/server/registry" +import { useGlobal } from "@/runtime/server/runtime" + +export function createSessionRenamer() { + const global = useGlobal() + + const language = useLanguage() + + const queryClient = useQueryClient() + + return async (server: ServerConnection.Key, session: SessionInfo, title: string) => { + const ctx = global.serverCtx(server) + + const conn = global.servers.list().find((item) => ServerConnection.key(item) === server) + + if (!ctx || !conn) throw new Error(language.t("common.requestFailed")) + await ctx.sdk.api.session.update({ sessionID: session.id, title }) + // The data layer's rename guard keeps the server's advanced time.updated from moving the session. + ctx.data.session.remember({ ...(ctx.data.session.get(session.id) ?? session), title }) + void queryClient.invalidateQueries({ queryKey: ["home-sessions", conn], exact: true }) + void queryClient.invalidateQueries({ queryKey: ["inbox-sessions", conn], exact: true }) + void queryClient.invalidateQueries({ queryKey: ["inbox-archived-sessions", conn], exact: true }) + } +} diff --git a/packages/app/src/session/commands/use-session-commands.tsx b/packages/app/src/session/commands/use-session-commands.tsx index f1703938eb..43980249d6 100644 --- a/packages/app/src/session/commands/use-session-commands.tsx +++ b/packages/app/src/session/commands/use-session-commands.tsx @@ -1,4 +1,4 @@ -import { createEffect, createSignal, on, onCleanup } from "solid-js" +import { createEffect, createSignal, on, onCleanup, type JSX } from "solid-js" import { createEventListener } from "@solid-primitives/event-listener" import { useCommand, type CommandOption } from "@/shell/commands/command" import { adjacentTabKey } from "@/shell/titlebar/tab-order" @@ -8,17 +8,18 @@ import { useFile, selectionFromLines, type FileSelection } from "@/workspaces/fi import { useLanguage } from "@/runtime/i18n/language" import { useComposerState } from "@/composer/persistence" import { useServerSDK } from "@/runtime/server/client" -import { useData } from "@/runtime/server/current" +import { useData, useServer } from "@/runtime/server/current" import { formatServerError } from "@/runtime/server/errors" import { projectSettingsKey, useSettings } from "@/settings/model" import { showToast } from "@/shell/notifications/toast" -import { fetchSessionExport, saveSessionExport, sessionExportFilename } from "@/session/commands/export" +import { useSessionExporter } from "@/session/commands/export-session" import { usePlatform } from "@/runtime/platform/platform" import type { SessionModel } from "@/session/model" import type { SessionRevert } from "@/session/revert" import { usePluginClaims, usePluginScoped } from "@/runtime/plugin/commands" import type { Region } from "@/runtime/plugin/panels" import { sideTabShortcuts } from "@/runtime/plugin/closed-tabs" +import { useTabs } from "@/shell/tabs/tabs" import { createCloseTabGuardState, createSessionCommandsState, @@ -28,6 +29,7 @@ import { type CloseTabGuardEvent, type SessionCommandsEffect, type SessionCommandsEvent, + type SessionDialogKind, } from "@/session/commands/machine" // Shared by every dispatch: pointer, focus and key events arrive constantly while the guard is disarmed. @@ -42,7 +44,6 @@ type SessionCommandSource = { data: Pick history: Pick layout: SessionModel["layout"] - ownership: SessionModel["ownership"] } export type SessionCommandContext = { @@ -66,6 +67,25 @@ const withCategory = (category: string) => { }) } +// Loads a dialog's chunk and returns its renderer. +async function loadDialog(kind: SessionDialogKind): Promise<() => JSX.Element> { + if (kind === "fork") { + const { DialogFork } = await import("@/session/commands/fork-dialog") + + return () => + } + + if (kind === "palette") { + const { DialogCommandPalette } = await import("@/shell/commands/dialog") + + return () => + } + + const { DialogSelectMcp } = await import("@/providers/connect/mcp-dialog") + + return () => +} + export const useSessionCommands = (actions: SessionCommandContext) => { const command = useCommand() const dialog = useDialog() @@ -73,17 +93,14 @@ export const useSessionCommands = (actions: SessionCommandContext) => { const language = useLanguage() const prompt = useComposerState() const serverSDK = useServerSDK() + const server = useServer() const data = useData() const settings = useSettings() const platform = usePlatform() + const exporter = useSessionExporter() const pluginScoped = usePluginScoped() const pluginClaims = usePluginClaims() - - const openDialog = async (load: () => Promise, show: (value: T) => void) => { - const owner = actions.session.ownership.capture() - const value = await load() - owner.run(() => show(value)) - } + const tabs = useTabs() // The file the selected side tab shows; other tabs have no line selection. const activeFile = () => actions.region.selected()?.tab.file @@ -98,18 +115,44 @@ export const useSessionCommands = (actions: SessionCommandContext) => { } const inSide = actions.region.focus - // ⌘T and ⌘W inside the side region open and close its tabs, unless the focused panel binds the key itself there. + // ⌘T inside the side region opens one of its tabs, unless the focused panel binds the key itself there. const sideKey = (event: KeyboardEvent) => inSide(event) && !pluginClaims(event) + + // As in a browser, ⌘⇧T reopens whichever tab closed last, side or session. + const reopensSideTab = () => { + const side = actions.region.lastClosedTime() + + if (side === undefined) return false + const session = tabs.lastClosedTime() + + return session === undefined || side >= session + } + // ⌘W on the side panel's last tab, or on a panel with nothing left to close, closes the panel and moves focus out of // it, where one press too many would close the session tab; the guard swallows that press. const [closeGuard, setCloseGuard] = createSignal(createCloseTabGuardState()) let settleFrame: number | undefined + let quietTimer: ReturnType | undefined const dispatchCloseGuard = (event: CloseTabGuardEvent) => { const next = transitionCloseTabGuard(closeGuard(), event) if (next.state !== closeGuard()) setCloseGuard(next.state) next.effects.forEach((effect) => { + if (effect.type === "quiet.schedule" || effect.type === "quiet.cancel") { + clearTimeout(quietTimer) + quietTimer = undefined + + if (effect.type === "quiet.cancel") return + const attempt = effect.attempt + quietTimer = setTimeout(() => { + quietTimer = undefined + dispatchCloseGuard({ type: "quiet.elapsed", attempt }) + }, effect.timeoutMs) + + return + } + if (settleFrame !== undefined) cancelAnimationFrame(settleFrame) settleFrame = undefined @@ -184,8 +227,9 @@ export const useSessionCommands = (actions: SessionCommandContext) => { const permissionsCommand = withCategory(language.t("command.category.permissions")) const [commandsState, setCommandsState] = createSignal(createSessionCommandsState()) - const exportFetches = new Map() - let forkModule: typeof import("@/session/commands/fork-dialog") | undefined + // Renders each dialog once its chunk has loaded. + const dialogs: Partial JSX.Element>> = {} + let dialogTimer: ReturnType | undefined const dispatchCommands = (event: SessionCommandsEvent) => { const next = transitionSessionCommands(commandsState(), event) @@ -207,118 +251,56 @@ export const useSessionCommands = (actions: SessionCommandContext) => { return } - if (effect.type === "export.fetch") { - const controller = new AbortController() - exportFetches.set(effect.attempt, controller) - fetchSessionExport({ sessionID: effect.sessionID, api: serverSDK.api, signal: controller.signal }) - .finally(() => exportFetches.delete(effect.attempt)) - .then( - (exported) => - dispatchCommands({ - type: "export.fetched", - attempt: effect.attempt, - sessionID: effect.sessionID, - data: exported, - }), - (cause: unknown) => - dispatchCommands({ - type: "export.failed", - attempt: effect.attempt, - sessionID: effect.sessionID, - message: cause instanceof Error ? cause.message : undefined, - }), - ) - - return - } - - if (effect.type === "export.abort") { - exportFetches.get(effect.attempt)?.abort() - exportFetches.delete(effect.attempt) - - return - } - - if (effect.type === "export.save") { - const filename = sessionExportFilename(effect.data.info) - Promise.try(() => saveSessionExport(filename, effect.data, platform)).then( - (saved) => - dispatchCommands({ - type: "export.saved", - attempt: effect.attempt, - sessionID: effect.sessionID, - filename, - saved, - }), - (cause: unknown) => - dispatchCommands({ - type: "export.failed", - attempt: effect.attempt, - sessionID: effect.sessionID, - message: cause instanceof Error ? cause.message : undefined, - }), - ) - - return - } - - if (effect.type === "fork.load") { - import("@/session/commands/fork-dialog").then( - (mod) => { - forkModule = mod - dispatchCommands({ type: "fork.loaded", attempt: effect.attempt }) + if (effect.type === "dialog.load") { + const attempt = effect.attempt + const kind = effect.kind + clearTimeout(dialogTimer) + dialogTimer = setTimeout(() => dispatchCommands({ type: "dialog.timed-out", attempt }), effect.timeoutMs) + loadDialog(kind).then( + (render) => { + dialogs[kind] = render + dispatchCommands({ type: "dialog.loaded", attempt }) }, - (cause: unknown) => dispatchCommands({ type: "fork.load-failed", attempt: effect.attempt, cause }), + (cause: unknown) => dispatchCommands({ type: "dialog.load-failed", attempt, cause }), ) return } - if (effect.type === "fork.show") { - const mod = forkModule - - if (mod) dialog.show(() => ) + if (effect.type === "dialog.cancel") { + clearTimeout(dialogTimer) + dialogTimer = undefined return } - if (effect.type === "toast.request-failed") { - showToast({ title: formatServerError(effect.cause, language.t, language.t("common.requestFailed")) }) + if (effect.type === "dialog.show") { + const render = dialogs[effect.kind] - return - } - - if (effect.type === "toast.exported") { - showToast({ - variant: "success", - icon: "circle-check", - title: language.t("toast.session.export.success.title"), - description: language.t("toast.session.export.success.description", { filename: effect.filename }), - }) + if (render) dialog.show(render) return } - showToast({ - variant: "error", - title: language.t("toast.session.export.failed.title"), - description: effect.message ?? language.t("toast.session.export.failed.description"), - }) + showToast({ title: formatServerError(effect.cause, language.t, language.t("common.requestFailed")) }) } createEffect( on( - () => actions.session.identity.params.id, - (sessionID) => dispatchCommands({ type: "session.changed", sessionID }), + () => actions.session.identity.sessionKey(), + (sessionKey) => dispatchCommands({ type: "session.changed", sessionKey }), { defer: true }, ), ) onCleanup(() => dispatchCommands({ type: "disposed" })) + const openDialog = (kind: SessionDialogKind) => + dispatchCommands({ type: "dialog.requested", kind, sessionKey: actions.session.identity.sessionKey() }) + const exportSession = () => { const sessionID = actions.session.identity.params.id - if (sessionID) dispatchCommands({ type: "export.requested", sessionID }) + if (sessionID) exporter.export({ server: server.key, sessionID }) } const copySessionID = async () => { @@ -365,12 +347,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => { } } - const openFile = () => { - void openDialog( - () => import("@/shell/commands/dialog"), - (x) => dialog.show(() => ), - ) - } + const openFile = () => openDialog("palette") // In the pane holding focus; the region itself, or a key a native page handed over, means the selected tab's pane. const focusedPane = () => { @@ -443,12 +420,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => { addSelectionToContext(path, selectionFromLines(range)) } - const chooseMcp = () => { - void openDialog( - () => import("@/providers/connect/mcp-dialog"), - (x) => dialog.show(() => ), - ) - } + const chooseMcp = () => openDialog("mcp") const sessionProject = () => projectSettingsKey(serverSDK.scope, actions.session.data.info()?.projectID) @@ -495,9 +467,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => { } const fork = () => { - const sessionID = actions.session.identity.params.id - - if (sessionID) dispatchCommands({ type: "fork.requested", sessionID }) + if (actions.session.identity.params.id) openDialog("fork") } const sessionCmds = () => [ @@ -551,7 +521,9 @@ export const useSessionCommands = (actions: SessionCommandContext) => { title: language.t("command.session.export"), description: language.t("command.session.export.description"), slash: "export", - disabled: !actions.session.identity.params.id, + disabled: + !actions.session.identity.params.id || + exporter.exporting({ server: server.key, sessionID: actions.session.identity.params.id }), onSelect: exportSession, }), sessionCommand({ @@ -582,7 +554,8 @@ export const useSessionCommands = (actions: SessionCommandContext) => { keybind: "mod+w", follows: "tab.close", hidden: !tab, - when: (event) => (side ? sideKey(event) : selectCloseTabSwallowed(closeGuard())), + // While the side region is open, ⌘W closes its tabs wherever focus is. + when: (event) => (side ? !pluginClaims(event) : selectCloseTabSwallowed(closeGuard())), onSelect: (source) => { if (!side) return closeTab() @@ -603,13 +576,12 @@ export const useSessionCommands = (actions: SessionCommandContext) => { when: sideKey, onSelect: openSideTab, }), - // As in a browser: in the side panel, ⌘⇧T reopens a side tab rather than a session tab. fileCommand({ id: "file.tab.reopen", title: "", keybind: settings.keybinds.get("tab.reopenClosed") ?? "mod+shift+t", hidden: true, - when: inSide, + when: (event) => reopensSideTab() && !pluginClaims(event), onSelect: () => actions.region.reopen(), }), cycle && diff --git a/packages/app/src/session/composer/activity-chips.css b/packages/app/src/session/composer/activity-chips.css index 575432cb50..a7deefe854 100644 --- a/packages/app/src/session/composer/activity-chips.css +++ b/packages/app/src/session/composer/activity-chips.css @@ -94,7 +94,12 @@ visibility: hidden; } - [data-component="menu-v2-item"][data-stoppable]:is(:hover, [data-highlighted]) { + /* A row whose Stop is in flight keeps showing its loader until the work leaves the list or the Stop settles. */ + [data-component="menu-v2-item"][data-stoppable]:is( + :hover, + [data-highlighted], + :has([data-slot="session-activity-stop"][aria-disabled="true"]) + ) { [data-slot="session-activity-stop"] { visibility: visible; } diff --git a/packages/app/src/session/composer/activity-chips.tsx b/packages/app/src/session/composer/activity-chips.tsx index 68dae78a4b..28da74e09e 100644 --- a/packages/app/src/session/composer/activity-chips.tsx +++ b/packages/app/src/session/composer/activity-chips.tsx @@ -1,5 +1,6 @@ import { Icon } from "@opencode/ui/icon" import { IconButton } from "@opencode/ui/icon-button" +import { Loader } from "@opencode/ui/loader" import { Menu } from "@opencode/ui/menu" import { MenuScroll } from "@opencode/ui/menu-scroll" import { SessionProgressIndicatorV2 } from "@opencode/session-ui/v2/session-progress-indicator-v2" @@ -9,7 +10,8 @@ import { createEffect, createMemo, createSignal, For, on, onCleanup, Show } from import { useLanguage } from "@/runtime/i18n/language" import { useSettings } from "@/settings/model" import { composerLanePlacement, useComposerLaneAlignment } from "./composer-lane" -import { createShellPanel, createShellTail, type ShellEnd } from "./shell-panel" +import { createShellPanel, createShellTail } from "./shell-panel" +import type { ShellEnd } from "./shell-panel-machine" import "./activity-chips.css" export type SessionActivityItem = { @@ -64,24 +66,46 @@ export function SessionActivityChips(props: { const language = useLanguage() const settings = useSettings() - const [open, setOpen] = createSignal(false) - const panel = createShellPanel({ shells: () => props.shells, stop: props.onStop, ended: props.shell.ended }) + const rows = new Map() + let content: HTMLElement | undefined + let back: HTMLElement | undefined - // A shell that ended while its panel is open still counts until the menu closes. - const held = () => { - const shell = panel.state.shell + const panel = createShellPanel({ + enabled: () => settings.general.backgroundActivity() !== "off", + subagents: () => props.subagents, + shells: () => props.shells, + stop: props.onStop, + ended: props.shell.ended, + focus: { + // Opening a shell moves focus to its back arrow. + back: () => back?.focus(), + // Back on the list, focus returns to that shell's row, or to the first row once the shell has left the list. + row: (key) => { + const row = rows.get(key) + + if (row?.isConnected) return row.focus() + content?.querySelector('[role="menuitem"]')?.focus() + }, + empty: () => { + const active = document.activeElement - return open() && shell && !props.shells.some((item) => item.key === shell.key) ? 1 : 0 - } + if (!active || active === document.body || !active.isConnected) props.onEmpty() + }, + // Stop gives way to how the shell ended; keep focus in the panel when it held Stop. + ended: () => { + const active = document.activeElement - const counts = () => ({ subagents: props.subagents.length, shells: props.shells.length + held() }) + if (!active || active === document.body || !active.isConnected || active.matches('[role="menu"]')) back?.focus() + }, + }, + }) - const active = () => - settings.general.backgroundActivity() !== "off" && (counts().subagents > 0 || counts().shells > 0) + const view = panel.view + const counts = () => view().counts + const active = () => view().active const alignment = useComposerLaneAlignment() - // A subagent can only be interrupted once its child session exists. const stoppable = (item: SessionActivityItem) => item.type === "shell" || !!item.sessionID @@ -94,89 +118,23 @@ export function SessionActivityChips(props: { if ((event.key !== "Delete" && event.key !== "Backspace") || !stoppable(item)) return event.preventDefault() - void props.onStop(item) + panel.stop(item) }, }) - // One clock for every row, ticking only while the panel is open. + const rowStopping = (item: SessionActivityItem) => view().stoppingKeys[item.key] !== undefined + + // One clock for every row, ticking only while the panel is open and something still runs. const [now, setNow] = createSignal(Date.now()) + const clockRunning = createMemo(() => view().clockRunning) createEffect(() => { - if (!open() || !active()) return + if (!clockRunning()) return setNow(Date.now()) const timer = setInterval(() => setNow(Date.now()), 1000) onCleanup(() => clearInterval(timer)) }) - const rows = new Map() - let content: HTMLElement | undefined - let back: HTMLElement | undefined - - // Focus moves a frame late: the menu refocuses itself when the selected row unmounts. One pending move at a time. - let frame = 0 - - const later = (move: () => void) => { - cancelAnimationFrame(frame) - frame = requestAnimationFrame(move) - } - - onCleanup(() => cancelAnimationFrame(frame)) - - // Opening a shell moves focus to its back arrow. - createEffect( - on( - () => panel.state.shell?.key, - (key) => key && later(() => open() && back?.focus()), - { defer: true }, - ), - ) - - // Going back returns focus to that shell's row, or to the first row once the shell has ended and left the list. With - // nothing left to list, going back closes the menu. - const goBack = () => { - const key = panel.state.shell?.key - - if (props.subagents.length + props.shells.length === 0) return changeOpen(false) - panel.back() - later(() => { - if (!open()) return - const row = key ? rows.get(key) : undefined - - if (row?.isConnected) return row.focus() - content?.querySelector('[role="menuitem"]')?.focus() - }) - } - - // Stop gives way to how the shell ended; keep focus in the panel when it held Stop. - createEffect( - on( - () => panel.state.end, - (end) => { - if (!end || !back) return - const active = document.activeElement - - if (!active || active === document.body || !active.isConnected || active.matches('[role="menu"]')) back.focus() - }, - ), - ) - - // The menu always opens on the list, and closing forgets the shell so nothing follows it while the menu is shut. - const changeOpen = (value: boolean) => { - const was = open() - setOpen(value) - - if (value || !was) return - panel.back() - cancelAnimationFrame(frame) - - if (props.subagents.length + props.shells.length > 0) return - later(() => { - const active = document.activeElement - - if (!active || active === document.body || !active.isConnected) props.onEmpty() - }) - } - // The run time and the stop button share the row's end; hovering a stoppable row swaps one for the other. const end = (item: SessionActivityItem) => ( @@ -200,8 +158,10 @@ export function SessionActivityChips(props: { variant="ghost-muted" tabIndex={-1} data-slot="session-activity-stop" - icon={} + icon={rowStopping(item) ? : } aria-label={language.t(item.type === "shell" ? "session.running.stop.shell" : "session.running.stop.subagent")} + aria-disabled={rowStopping(item) || undefined} + aria-busy={rowStopping(item) || undefined} onPointerDown={(event) => { event.preventDefault() event.stopPropagation() @@ -209,7 +169,7 @@ export function SessionActivityChips(props: { onPointerUp={(event) => event.stopPropagation()} onClick={(event) => { event.stopPropagation() - void props.onStop(item) + panel.stop(item) }} />
@@ -219,17 +179,10 @@ export function SessionActivityChips(props: { // Each session mounts its own composer, so a capsule that is already there on a switch stays at rest; only work // that starts while the session is open fades in. - const [enter, setEnter] = createSignal(!active()) - createEffect(() => { - if (active()) return - setEnter(true) - changeOpen(false) - }) - return (
- + @@ -251,12 +204,12 @@ export function SessionActivityChips(props: { @@ -301,7 +254,7 @@ export function SessionActivityChips(props: { data-slot="session-activity-back" aria-label={language.t("session.activity.shell.back")} closeOnSelect={false} - onSelect={goBack} + onSelect={panel.back} ref={(el: HTMLElement) => (back = el)} > @@ -314,19 +267,19 @@ export function SessionActivityChips(props: { dir="auto" class="text-[11px] tabular-nums whitespace-nowrap text-v2-text-text-muted" > - {formatElapsed((panel.state.end?.completed ?? now()) - shell().started, language.t)} + {formatElapsed((view().end?.completed ?? now()) - shell().started, language.t)} panel.stop()} > {language.t( - panel.state.stopping ? "session.activity.shell.stopping" : "session.activity.shell.stop", + view().stopping ? "session.activity.shell.stopping" : "session.activity.shell.stop", )} } @@ -347,7 +300,7 @@ export function SessionActivityChips(props: { diff --git a/packages/app/src/session/composer/adapter.ts b/packages/app/src/session/composer/adapter.ts index d215b910b2..3f4e96a44c 100644 --- a/packages/app/src/session/composer/adapter.ts +++ b/packages/app/src/session/composer/adapter.ts @@ -47,6 +47,7 @@ export function createActiveComposerAdapter(input: { directory: location().directory, handoff, api: server.api.session, + file: server.api.file, data, current: () => data.session.get(id), admitted: (messageID) => data.session.input.has(id, messageID) || !!data.session.message.get(id, messageID), diff --git a/packages/app/src/session/composer/location-missing-machine.test.ts b/packages/app/src/session/composer/location-missing-machine.test.ts new file mode 100644 index 0000000000..83401c2e61 --- /dev/null +++ b/packages/app/src/session/composer/location-missing-machine.test.ts @@ -0,0 +1,127 @@ +import { expect, test } from "bun:test" +import type { WorktreeDirectory } from "@opencode/client/promise" +import { + createLocationMissingState, + selectLocationMissingView, + transitionLocationMissing, + type LocationMissingEffect, + type LocationMissingEvent, + type LocationMissingState, +} from "./location-missing-machine" + +const missing = "/repo/.worktrees/gone" + +const sibling: WorktreeDirectory = { directory: "/repo/.worktrees/sibling", strategy: "git" } + +function replay(events: LocationMissingEvent[], from = createLocationMissingState([])) { + return events.reduce<{ state: LocationMissingState; effects: readonly LocationMissingEffect[] }>( + (current, event) => transitionLocationMissing(current.state, event), + { state: from, effects: [] }, + ) +} + +const attempt = (state: LocationMissingState) => ("attempt" in state ? state.attempt : -1) + +test("an open directory picker refuses a second picker or a worktree move, and its answer after unmount moves nothing", () => { + const picking = replay([{ type: "choose.requested" }]) + + expect(picking.effects).toEqual([{ type: "picker.open", attempt: 1 }]) + expect(selectLocationMissingView(picking.state, missing).disabled).toBe(true) + expect(transitionLocationMissing(picking.state, { type: "choose.requested" }).state).toBe(picking.state) + expect(transitionLocationMissing(picking.state, { type: "menu.toggled", open: true }).state).toBe(picking.state) + expect(transitionLocationMissing(picking.state, { type: "move.worktree", directory: sibling.directory }).state).toBe( + picking.state, + ) + + const disposed = transitionLocationMissing(picking.state, { type: "disposed" }) + + const late = transitionLocationMissing(disposed.state, { + type: "picker.settled", + attempt: attempt(picking.state), + directory: "/elsewhere", + dialogOpen: false, + }) + + expect(late.effects).toEqual([]) +}) + +test("a picked folder moves the session once", () => { + const picked = replay([ + { type: "choose.requested" }, + { type: "picker.settled", attempt: 1, directory: "/elsewhere", dialogOpen: false }, + ]) + + expect(picked.effects).toEqual([{ type: "move.run", attempt: 2, directory: "/elsewhere" }]) + expect(selectLocationMissingView(picked.state, missing).pendingDirectory).toBe(true) + expect( + transitionLocationMissing(picked.state, { + type: "picker.settled", + attempt: 1, + directory: "/elsewhere", + dialogOpen: false, + }).state, + ).toBe(picked.state) +}) + +test("a move the server accepted keeps the controls busy until the notice unmounts, or for its settle bound", () => { + const moving = replay([{ type: "move.worktree" }]) + + expect(moving.effects).toEqual([{ type: "move.run", attempt: 1 }]) + + const moved = transitionLocationMissing(moving.state, { type: "move.succeeded", attempt: 1 }) + + expect(moved.effects).toEqual([{ type: "timer.start", attempt: 1, phase: "moved" }]) + expect(selectLocationMissingView(moved.state, missing)).toMatchObject({ pendingWorktree: true, disabled: true }) + expect(transitionLocationMissing(moved.state, { type: "move.worktree" }).state).toBe(moved.state) + expect(transitionLocationMissing(moved.state, { type: "choose.requested" }).state).toBe(moved.state) + + const settled = transitionLocationMissing(moved.state, { type: "move.settle-timed-out", attempt: 1 }) + + expect(settled.state).toMatchObject({ status: "idle" }) + expect(selectLocationMissingView(settled.state, missing).disabled).toBe(false) +}) + +test("the worktree menu shows the worktrees it already has, and a stalled load ends with an error", () => { + const cached = replay([{ type: "menu.toggled", open: true }], createLocationMissingState([sibling])) + + expect(cached.effects).toEqual([ + { type: "worktrees.load", attempt: 1 }, + { type: "timer.start", attempt: 1, phase: "menu-loading" }, + ]) + expect(selectLocationMissingView(cached.state, missing)).toMatchObject({ + menuOpen: true, + menuLoading: false, + visibleWorktrees: [sibling], + }) + + const empty = replay([{ type: "menu.toggled", open: true }]) + + expect(selectLocationMissingView(empty.state, missing).menuLoading).toBe(true) + + const timedOut = transitionLocationMissing(empty.state, { type: "worktrees.timed-out", attempt: 1 }) + + expect(timedOut.state).toMatchObject({ status: "menu-ready" }) + expect(timedOut.effects).toEqual([{ type: "timer.cancel" }, { type: "toast.worktrees-failed" }]) + expect( + transitionLocationMissing(timedOut.state, { type: "worktrees.loaded", attempt: 1, items: [sibling] }).state, + ).toBe(timedOut.state) +}) + +test("a cancelled pick or failed move returns focus to Choose directory once no dialog covers it", () => { + const cancelled = replay([ + { type: "choose.requested" }, + { type: "picker.settled", attempt: 1, directory: undefined, dialogOpen: false }, + ]) + + expect(cancelled.effects).toEqual([{ type: "focus.choose" }]) + + const failed = replay([ + { type: "move.worktree" }, + { type: "move.failed", attempt: 1, error: new Error("denied"), dialogOpen: true }, + ]) + + expect(failed.effects).toEqual([{ type: "toast.move-failed", error: new Error("denied") }]) + expect(transitionLocationMissing(failed.state, { type: "dialog.changed", open: false }).effects).toEqual([ + { type: "focus.choose" }, + ]) +}) diff --git a/packages/app/src/session/composer/location-missing-machine.ts b/packages/app/src/session/composer/location-missing-machine.ts new file mode 100644 index 0000000000..05c6459f6a --- /dev/null +++ b/packages/app/src/session/composer/location-missing-machine.ts @@ -0,0 +1,227 @@ +import type { WorktreeDirectory } from "@opencode/client/promise" +import { getFilename, sameDirectory } from "@opencode/util/path" + +/** The menu shows what it already has, with an error, once a worktree refresh and list take this long. */ +export const WORKTREES_LOAD_TIMEOUT_MS = 15_000 + +/** A move the server accepted waits this long for the session's new Location to unmount the notice. */ +export const LOCATION_MOVE_SETTLE_TIMEOUT_MS = 5_000 + +export type LocationMissingSource = "worktree" | "directory" + +type LocationMissingBase = { + readonly issued: number + /** The project's worktrees as last loaded, shown at once when the menu opens. */ + readonly worktrees: readonly WorktreeDirectory[] +} + +/** + * Recovering a session whose folder is gone. `picking`: the directory picker is open. `moving`: the worktree or move + * request runs. `moved`: the server moved the session and the notice waits for the new Location to replace it. + * `restoreFocus`: a cancelled or failed move returns focus to Choose directory once the dialog over it closes. + */ +export type LocationMissingState = + | (LocationMissingBase & { readonly status: "idle"; readonly restoreFocus: boolean }) + | (LocationMissingBase & { readonly status: "menu-loading"; readonly attempt: number; readonly search: string }) + | (LocationMissingBase & { readonly status: "menu-ready"; readonly search: string }) + | (LocationMissingBase & { readonly status: "picking"; readonly attempt: number }) + | (LocationMissingBase & { + readonly status: "moving" | "moved" + readonly attempt: number + readonly source: LocationMissingSource + }) + | { readonly status: "disposed" } + +export type LocationMissingEvent = + | { readonly type: "menu.toggled"; readonly open: boolean } + | { readonly type: "search.changed"; readonly search: string } + | { + readonly type: "worktrees.loaded" + readonly attempt: number + readonly items: readonly WorktreeDirectory[] | undefined + } + | { readonly type: "worktrees.timed-out"; readonly attempt: number } + | { readonly type: "choose.requested" } + | { + readonly type: "picker.settled" + readonly attempt: number + readonly directory: string | undefined + readonly dialogOpen: boolean + } + | { readonly type: "move.worktree"; readonly directory?: string } + | { readonly type: "move.succeeded"; readonly attempt: number } + | { readonly type: "move.failed"; readonly attempt: number; readonly error: unknown; readonly dialogOpen: boolean } + | { readonly type: "move.settle-timed-out"; readonly attempt: number } + | { readonly type: "dialog.changed"; readonly open: boolean } + | { readonly type: "disposed" } + +export type LocationMissingEffect = + | { readonly type: "worktrees.load"; readonly attempt: number } + | { readonly type: "picker.open"; readonly attempt: number } + /** Without `directory`, the move first creates a worktree from the project's checkout. */ + | { readonly type: "move.run"; readonly attempt: number; readonly directory?: string } + | { readonly type: "timer.start"; readonly attempt: number; readonly phase: "menu-loading" | "moved" } + | { readonly type: "timer.cancel" } + | { readonly type: "focus.choose" } + | { readonly type: "toast.worktrees-failed" } + | { readonly type: "toast.move-failed"; readonly error: unknown } + +export type LocationMissingTransition = { + readonly state: LocationMissingState + readonly effects: readonly LocationMissingEffect[] +} + +const TIMER_CANCEL: LocationMissingEffect = { type: "timer.cancel" } + +export function createLocationMissingState(worktrees: readonly WorktreeDirectory[]): LocationMissingState { + return { status: "idle", issued: 0, worktrees, restoreFocus: false } +} + +export function transitionLocationMissing( + state: LocationMissingState, + event: LocationMissingEvent, +): LocationMissingTransition { + if (state.status === "disposed") return unchanged(state) + + if (event.type === "disposed") + return changed( + { status: "disposed" }, + state.status === "menu-loading" || state.status === "moved" ? [TIMER_CANCEL] : [], + ) + + const base = { issued: state.issued, worktrees: state.worktrees } + const loading = state.status === "menu-loading" ? [TIMER_CANCEL] : [] + + if (event.type === "menu.toggled") { + if (event.open && state.status === "idle") { + const attempt = state.issued + 1 + + return changed({ ...base, issued: attempt, status: "menu-loading", attempt, search: "" }, [ + { type: "worktrees.load", attempt }, + { type: "timer.start", attempt, phase: "menu-loading" }, + ]) + } + + if (!event.open && (state.status === "menu-loading" || state.status === "menu-ready")) + return changed({ ...base, status: "idle", restoreFocus: false }, loading) + + return unchanged(state) + } + + if (event.type === "search.changed") { + if ((state.status !== "menu-loading" && state.status !== "menu-ready") || state.search === event.search) + return unchanged(state) + + return changed({ ...state, search: event.search }) + } + + if (event.type === "worktrees.loaded" || event.type === "worktrees.timed-out") { + if (state.status !== "menu-loading" || state.attempt !== event.attempt) return unchanged(state) + const items = event.type === "worktrees.loaded" ? event.items : undefined + + return changed({ ...base, worktrees: items ?? state.worktrees, status: "menu-ready", search: state.search }, [ + TIMER_CANCEL, + ...(items ? [] : [{ type: "toast.worktrees-failed" as const }]), + ]) + } + + if (event.type === "choose.requested") { + if (state.status !== "idle" && state.status !== "menu-loading" && state.status !== "menu-ready") + return unchanged(state) + const attempt = state.issued + 1 + + return changed({ ...base, issued: attempt, status: "picking", attempt }, [ + ...loading, + { type: "picker.open", attempt }, + ]) + } + + if (event.type === "picker.settled") { + if (state.status !== "picking" || state.attempt !== event.attempt) return unchanged(state) + + if (!event.directory) return cancelled(base, event.dialogOpen) + + return move(base, "directory", event.directory) + } + + if (event.type === "move.worktree") { + if (state.status !== "idle" && state.status !== "menu-loading" && state.status !== "menu-ready") + return unchanged(state) + const next = move(base, "worktree", event.directory) + + return changed(next.state, [...loading, ...next.effects]) + } + + if (event.type === "move.succeeded") { + if (state.status !== "moving" || state.attempt !== event.attempt) return unchanged(state) + + return changed({ ...state, status: "moved" }, [{ type: "timer.start", attempt: state.attempt, phase: "moved" }]) + } + + if (event.type === "move.failed") { + if (state.status !== "moving" || state.attempt !== event.attempt) return unchanged(state) + const next = cancelled(base, event.dialogOpen) + + return changed(next.state, [{ type: "toast.move-failed", error: event.error }, ...next.effects]) + } + + if (event.type === "move.settle-timed-out") { + if (state.status !== "moved" || state.attempt !== event.attempt) return unchanged(state) + + return changed({ ...base, status: "idle", restoreFocus: false }, [TIMER_CANCEL]) + } + + if (event.open || state.status !== "idle" || !state.restoreFocus) return unchanged(state) + + return changed({ ...state, restoreFocus: false }, [{ type: "focus.choose" }]) +} + +export function selectLocationMissingView(state: LocationMissingState, directory: string) { + const live = state.status === "disposed" ? undefined : state + const search = live && "search" in live ? live.search : "" + const others = (live?.worktrees ?? []).filter((item) => item.strategy && !sameDirectory(item.directory, directory)) + const query = search.trim().toLowerCase() + const matches = query ? others.filter((item) => getFilename(item.directory).toLowerCase().includes(query)) : others + const loading = state.status === "menu-loading" && others.length === 0 + const pending = state.status === "moving" || state.status === "moved" ? state.source : undefined + + return { + menuOpen: state.status === "menu-loading" || state.status === "menu-ready", + search, + menuLoading: loading, + hasMenuSeparator: loading || others.length > 0, + searchable: others.length >= 10, + emptySearch: !!query && matches.length === 0, + visibleWorktrees: matches.slice(0, 10), + /** One move at a time: the desktop's native picker leaves the window usable while it is open. */ + disabled: !!pending || state.status === "picking" || state.status === "disposed", + pendingWorktree: pending === "worktree", + pendingDirectory: pending === "directory", + } +} + +type Base = Pick, "issued" | "worktrees"> + +function move(base: Base, source: LocationMissingSource, directory: string | undefined): LocationMissingTransition { + const attempt = base.issued + 1 + + return changed({ ...base, issued: attempt, status: "moving", attempt, source }, [ + directory ? { type: "move.run", attempt, directory } : { type: "move.run", attempt }, + ]) +} + +// Focus returns to Choose directory now, or once the dialog over it closes. +function cancelled(base: Base, dialogOpen: boolean): LocationMissingTransition { + return changed({ ...base, status: "idle", restoreFocus: dialogOpen }, dialogOpen ? [] : [{ type: "focus.choose" }]) +} + +function changed( + state: LocationMissingState, + effects: readonly LocationMissingEffect[] = [], +): LocationMissingTransition { + return { state, effects } +} + +function unchanged(state: LocationMissingState): LocationMissingTransition { + return { state, effects: [] } +} diff --git a/packages/app/src/session/composer/location-missing.tsx b/packages/app/src/session/composer/location-missing.tsx index ae120ed882..0d8333a6f2 100644 --- a/packages/app/src/session/composer/location-missing.tsx +++ b/packages/app/src/session/composer/location-missing.tsx @@ -5,16 +5,23 @@ import { Icon } from "@opencode/ui/icon" import { Loader } from "@opencode/ui/loader" import { Menu } from "@opencode/ui/menu" import { MenuScroll } from "@opencode/ui/menu-scroll" -import { getFilename, sameDirectory } from "@opencode/util/path" +import { getFilename } from "@opencode/util/path" import { makeEventListener } from "@solid-primitives/event-listener" -import { useMutation } from "@tanstack/solid-query" -import { createEffect, createResource, createUniqueId, For, Show } from "solid-js" -import { createStore } from "solid-js/store" +import { createEffect, createMemo, createSignal, createUniqueId, For, on, onCleanup, Show, untrack } from "solid-js" import { useLanguage } from "@/runtime/i18n/language" import { useData, useServer } from "@/runtime/server/current" import { showToast } from "@/shell/notifications/toast" import { createWorktree } from "@/workspaces/create" import { useDirectoryPicker } from "@/workspaces/selection/picker" +import { + createLocationMissingState, + LOCATION_MOVE_SETTLE_TIMEOUT_MS, + selectLocationMissingView, + transitionLocationMissing, + WORKTREES_LOAD_TIMEOUT_MS, + type LocationMissingEffect, + type LocationMissingEvent, +} from "./location-missing-machine" import "./location-missing.css" export function SessionLocationMissing(props: { sessionID: string; projectID: string; directory: string }) { @@ -23,93 +30,126 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st const data = useData() const dialog = useDialog() const pickDirectory = useDirectoryPicker() - const [state, setState] = createStore({ restoreFocus: false, worktreesOpen: false, search: "" }) const project = () => data.project.get(props.projectID) - const [worktrees] = createResource( - () => (state.worktreesOpen ? props.projectID : undefined), - async (projectID) => { - await server.ctx.sync.worktrees.refresh(projectID) - const items = await server.ctx.sync.worktrees.list(projectID) - - if (!items) showToast({ variant: "error", title: language.t("session.location.worktreesFailed") }) - - return items ?? [] - }, - // Seed latest so even the first fetch does not enter Suspense. - { initialValue: [] }, + const [machine, setMachine] = createSignal( + createLocationMissingState(untrack(() => server.ctx.sync.worktrees.cached(props.projectID) ?? [])), ) - const otherWorktrees = () => - worktrees.latest.filter((item) => item.strategy && !sameDirectory(item.directory, props.directory)) + const view = createMemo(() => selectLocationMissingView(machine(), props.directory)) + let timer: ReturnType | undefined + let button: HTMLButtonElement | undefined + let searchInput: HTMLInputElement | undefined - const searchable = () => otherWorktrees().length >= 10 + const dispatch = (event: LocationMissingEvent) => { + const next = transitionLocationMissing(untrack(machine), event) - const visibleWorktrees = () => { - const query = state.search.trim().toLowerCase() + if (next.state !== untrack(machine)) setMachine(next.state) + next.effects.forEach(run) + } - const matches = query - ? otherWorktrees().filter((item) => getFilename(item.directory).toLowerCase().includes(query)) - : otherWorktrees() + function run(effect: LocationMissingEffect) { + if (effect.type === "worktrees.load") { + const projectID = props.projectID - return matches.slice(0, 10) - } + void server.ctx.sync.worktrees + .refresh(projectID) + .then(() => server.ctx.sync.worktrees.list(projectID)) + .then((items) => dispatch({ type: "worktrees.loaded", attempt: effect.attempt, items })) - let button: HTMLButtonElement | undefined - let searchInput: HTMLInputElement | undefined + return + } - const move = useMutation(() => ({ - mutationFn: async (input: { source: "worktree" | "directory"; directory?: string }) => { - // The missing worktree cannot resolve its own Location, so create from the project's saved checkout. - const current = project() - - const destination = - input.directory ?? - (current && - (await createWorktree({ - api: server.ctx.sdk.api, - data, - directory: current.canonical, - project: { id: current.id, canonical: current.canonical, directory: current.canonical }, - }))) - - if (!destination) return - await server.ctx.sdk.api.session.move({ sessionID: props.sessionID, directory: destination }) - }, - onError: (error) => { - setState("restoreFocus", true) - showToast({ - variant: "error", - title: language.t("session.location.moveFailed"), - description: error instanceof Error ? error.message : language.t("common.requestFailed"), + if (effect.type === "picker.open") + return pickDirectory({ + server: server.conn, + title: language.t("session.location.choose"), + onSelect: (result) => + dispatch({ + type: "picker.settled", + attempt: effect.attempt, + directory: (Array.isArray(result) ? result[0] : result) ?? undefined, + dialogOpen: !!dialog.active, + }), }) - }, - })) - const pending = (source: "worktree" | "directory") => move.isPending && move.variables?.source === source - const id = createUniqueId() + if (effect.type === "move.run") { + // Creating the worktree is not aborted on unmount: cutting it off kills the project's setup script midway. + void moveSession(effect.directory).then( + () => dispatch({ type: "move.succeeded", attempt: effect.attempt }), + (error) => dispatch({ type: "move.failed", attempt: effect.attempt, error, dialogOpen: !!dialog.active }), + ) + + return + } + + if (effect.type === "timer.start") { + clearTimeout(timer) + timer = + effect.phase === "menu-loading" + ? setTimeout( + () => dispatch({ type: "worktrees.timed-out", attempt: effect.attempt }), + WORKTREES_LOAD_TIMEOUT_MS, + ) + : setTimeout( + () => dispatch({ type: "move.settle-timed-out", attempt: effect.attempt }), + LOCATION_MOVE_SETTLE_TIMEOUT_MS, + ) - createEffect(() => { - if (!state.restoreFocus || move.isPending || dialog.active) return - setState("restoreFocus", false) - button?.focus() - }) + return + } - function choose() { - if (move.isPending) return - pickDirectory({ - server: server.conn, - title: language.t("session.location.choose"), - onSelect: (result) => { - const selected = Array.isArray(result) ? result[0] : result + if (effect.type === "timer.cancel") { + clearTimeout(timer) + timer = undefined - if (selected) move.mutate({ source: "directory", directory: selected }) + return + } - if (!selected) setState("restoreFocus", true) - }, + if (effect.type === "focus.choose") return button?.focus() + + if (effect.type === "toast.worktrees-failed") + return void showToast({ variant: "error", title: language.t("session.location.worktreesFailed") }) + + showToast({ + variant: "error", + title: language.t("session.location.moveFailed"), + description: effect.error instanceof Error ? effect.error.message : language.t("common.requestFailed"), }) } + const moveSession = async (directory: string | undefined) => { + // The missing worktree cannot resolve its own Location, so create from the project's saved checkout. + const current = project() + + const destination = + directory ?? + (current && + (await createWorktree({ + api: server.ctx.sdk.api, + data, + directory: current.canonical, + project: { id: current.id, canonical: current.canonical, directory: current.canonical }, + }))) + + // The project has not loaded yet, so there is no checkout to create the worktree from. + if (!destination) throw new Error(language.t("common.requestFailed")) + await server.ctx.sdk.api.session.move({ sessionID: props.sessionID, directory: destination }) + // Read the moved session now, so the notice gives way even when the server's event lags. + await data.session.sync(props.sessionID).catch(() => undefined) + } + + createEffect( + on( + () => !!dialog.active, + (open) => dispatch({ type: "dialog.changed", open }), + { defer: true }, + ), + ) + onCleanup(() => dispatch({ type: "disposed" })) + + const id = createUniqueId() + return (
@@ -135,18 +175,22 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st - setState({ worktreesOpen: open, search: "" })}> + dispatch({ type: "menu.toggled", open })} + > - + - {language.t(pending("worktree") ? "session.location.moving" : "session.location.worktree")} - + {language.t(view().pendingWorktree ? "session.location.moving" : "session.location.worktree")} + @@ -164,7 +208,7 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st if (event.key.length !== 1 && event.key !== "Backspace") return - if (event.key === " " && !state.search) return + if (event.key === " " && !view().search) return event.stopPropagation() searchInput.focus({ preventScroll: true }) }, @@ -174,17 +218,17 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st class="max-h-[66.667dvh] w-[200px] !p-0" > - move.mutate({ source: "worktree" })} disabled={move.isPending}> + dispatch({ type: "move.worktree" })} disabled={view().disabled}> {language.t("workspace.new")} - 0}> + - + {language.t("common.loading")} - +
element.focus({ preventScroll: true })), ) }} - value={state.search} + value={view().search} placeholder={language.t("session.new.workspace.search.placeholder")} aria-label={language.t("session.new.workspace.search.placeholder")} class="h-7 min-w-0 flex-1 border-0 bg-transparent text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-base outline-none placeholder:text-v2-text-text-faint" - onInput={(event) => setState("search", event.currentTarget.value)} + onInput={(event) => dispatch({ type: "search.changed", search: event.currentTarget.value })} onKeyDown={(event) => { if ( event.key === "Escape" || @@ -213,17 +257,17 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st />
- +
{language.t("session.new.workspace.search.empty")}
- + {(worktree) => ( move.mutate({ source: "worktree", directory: worktree.directory })} - disabled={move.isPending} + onSelect={() => dispatch({ type: "move.worktree", directory: worktree.directory })} + disabled={view().disabled} > {getFilename(worktree.directory)} @@ -237,15 +281,15 @@ export function SessionLocationMissing(props: { sessionID: string; projectID: st
diff --git a/packages/app/src/session/composer/queue-machine.test.ts b/packages/app/src/session/composer/queue-machine.test.ts index f7b5cea73d..3f0c387022 100644 --- a/packages/app/src/session/composer/queue-machine.test.ts +++ b/packages/app/src/session/composer/queue-machine.test.ts @@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test" import type { Prompt } from "@/composer/state" import { createQueueState, + movedTarget, selectQueueRows, transitionQueue, viewQueue, @@ -55,6 +56,74 @@ const rowIDs = (state: QueueState) => selectQueueRows(state).map((row) => row.id const [one, two, three] = ["inb_1", "inb_2", "inb_3"].map((id) => item(id)) +describe("queue first shares the serialized reorder", () => { + test("a waiting request follows rewritten inbox IDs instead of resurrecting an original", () => { + const result = replay(createQueueState([one, two, three]), [ + { type: "reorder.requested", inboxIDs: [two.id, one.id, three.id], reverted: false }, + { type: "first.requested", id: three.id, reverted: false }, + { type: "mutation.moved", attempt: 1, moved: { [one.id]: "new_1", [two.id]: "new_2", [three.id]: "new_3" } }, + { type: "inbox.synced", items: [item("new_2"), item("new_1"), item("new_3")] }, + { type: "mutation.succeeded", attempt: 1 }, + ]) + + expect(runs(result.effects)).toMatchObject([ + { type: "reorder", inboxIDs: [two.id, one.id, three.id] }, + { type: "reorder", inboxIDs: ["new_3", "new_2", "new_1"] }, + ]) + expect(rowIDs(result.state)).toEqual(["new_3", "new_2", "new_1"]) + + const stale = transitionQueue(result.state, { type: "mutation.failed", attempt: 1, hidden: [] }) + + expect(stale.state).toBe(result.state) + expect(stale.effects).toEqual([]) + }) + + test.each([one.id, "delivered"])("%s needs no reorder", (id) => { + const state = createQueueState([one, two]) + + expect(transitionQueue(state, { type: "first.requested", id, reverted: false })).toEqual({ state, effects: [] }) + }) + + test.each(["mutation.succeeded", "mutation.failed", "mutation.timed-out", "dispose"] as const)( + "%s settles a queue-first reorder through the existing lifecycle", + (type) => { + const started = transitionQueue(createQueueState([one, two]), { + type: "first.requested", + id: two.id, + reverted: false, + }) + + const result = transitionQueue( + started.state, + type === "dispose" ? { type } : { type, attempt: 1, hidden: [], stage: "running" }, + ) + + expect(result.state.status).toBe(type === "dispose" ? "disposed" : "idle") + expect( + result.effects.some((effect) => effect.type === "mutation.timer.clear" || effect.type === "timer.clearAll"), + ).toBe(true) + }, + ) +}) + +test("steer-first ignores an open edit and a disposed or empty queue", () => { + const editing = transitionQueue(createQueueState([one, two]), { + type: "edit.start", + id: one.id, + reverted: false, + draft: draft("my draft"), + }).state + + const disposed = transitionQueue(createQueueState([one, two]), { type: "dispose" }).state + + for (const state of [editing, disposed, createQueueState([])]) { + const result = transitionQueue(state, { type: "steer-first.requested" }) + + expect(result.state).toBe(state) + expect(result.effects).toEqual([]) + } +}) + describe("an edit always returns the draft it replaced", () => { test("when the server delivers the prompt being edited", () => { const result = replay(createQueueState([one, two]), [ @@ -169,6 +238,55 @@ describe("queue changes run one at a time", () => { }) }) +describe("replaced inbox IDs", () => { + const moved = (state: QueueState) => viewQueue(state, { working: true, behavior: "queue" }).moved + + // Edits `id` as a queued prompt; its replacement and the prompts after it take `next`. + function edit(state: QueueState, id: string, next: string[]) { + const confirmed = replay(state, [ + { type: "edit.start", id, reverted: false, draft: draft("") }, + { type: "edit.confirm", delivery: "queue", reverted: false, prompt: prompt(`${id} edited`), ids: next }, + ]) + + return { state: confirmed.state, attempt: runs(confirmed.effects)[0].attempt } + } + + test("an edit's replacements chain across later edits until their prompts leave the queue", () => { + const first = edit(createQueueState([one]), "inb_1", ["msg_1"]) + // In flight, the panel already sees the replacement it may swap in. + expect(moved(first.state)).toEqual({ inb_1: "msg_1" }) + + const settled = replay(first.state, [ + { type: "inbox.synced", items: [item("msg_1")] }, + { type: "mutation.succeeded", attempt: first.attempt }, + ]).state + + expect(settled.status).toBe("idle") + expect(moved(settled)).toEqual({ inb_1: "msg_1" }) + + const second = edit(settled, "msg_1", ["msg_2"]) + + const chained = replay(second.state, [ + { type: "inbox.synced", items: [item("msg_2")] }, + { type: "mutation.succeeded", attempt: second.attempt }, + ]).state + + expect(movedTarget(moved(chained), "inb_1", new Set(["msg_2"]))).toBe("msg_2") + expect(movedTarget(moved(chained), "inb_1", new Set(["msg_1", "msg_2"]))).toBe("msg_1") + + // Once the last replacement is delivered, nothing it maps is queued. + expect(moved(transitionQueue(chained, { type: "inbox.synced", items: [] }).state)).toEqual({}) + }) + + test("a failed edit leaves no replacement behind", () => { + const sent = edit(createQueueState([one, two]), "inb_1", ["msg_1", "msg_2"]) + expect(moved(sent.state)).toEqual({ inb_1: "msg_1", inb_2: "msg_2" }) + + const failed = transitionQueue(sent.state, { type: "mutation.failed", attempt: sent.attempt, hidden: [] }) + expect(moved(failed.state)).toEqual({}) + }) +}) + describe("optimistic rows", () => { test("a steer hides its row until the server confirms or refuses it", () => { const requested = transitionQueue(createQueueState([one, two]), { type: "steer.requested", id: "inb_1" }) @@ -240,23 +358,168 @@ describe("stale results", () => { ]) }) - test("dispose returns the draft and ignores results for operations no longer in flight", () => { - const editing = replay(createQueueState([one, two]), [ + test("after dispose an operation that settles starts no expiry timer, toast or waiting operation", () => { + const editing = replay(createQueueState([one, two, three]), [ { type: "steer.requested", id: "inb_2" }, + { type: "remove.requested", id: "inb_3" }, { type: "edit.start", id: "inb_1", reverted: false, draft: draft("my draft") }, ]) + const attempt = runs(editing.effects)[0].attempt const disposed = transitionQueue(editing.state, { type: "dispose" }) - expect(disposed.state.status).toBe("mutating") + expect(disposed.state).toEqual({ status: "disposed" }) expect(disposed.effects).toEqual([ { type: "draft.restore", stash: draft("my draft"), focus: false }, { type: "timer.clearAll" }, ]) + expect(viewQueue(disposed.state, { working: true, behavior: "queue" })).toMatchObject({ rows: [], busy: false }) + + for (const event of [ + { type: "mutation.succeeded", attempt }, + { type: "mutation.failed", attempt, hidden: [] }, + ] satisfies QueueEvent[]) + expect(transitionQueue(disposed.state, event)).toEqual({ state: disposed.state, effects: [] }) + }) + + test("an edit the server never admitted before dispose returns to the saved draft if it then fails", () => { + const sent = replay(createQueueState([one]), [ + { type: "edit.start", id: "inb_1", reverted: false, draft: draft("") }, + { type: "edit.confirm", delivery: "queue", reverted: false, prompt: prompt("inb_1 edited"), ids }, + { type: "dispose" }, + ]) + + const attempt = runs(sent.effects)[0].attempt + + expect(transitionQueue(sent.state, { type: "mutation.failed", attempt, hidden: [] }).effects).toEqual([ + { type: "draft.merge", prompt: prompt("inb_1 edited"), context: [], focus: false }, + ]) - const stale = transitionQueue(disposed.state, { type: "mutation.succeeded", attempt: 0 }) + const admitted = transitionQueue(sent.state, { type: "mutation.admitted", attempt }).state + + expect(transitionQueue(admitted, { type: "mutation.failed", attempt, hidden: [] }).effects).toEqual([]) + }) + + test("dispose stops an undo before its cancel, and an undo the server applied anyway returns its prompt", () => { + const undoing = transitionQueue(createQueueState([one]), { type: "undo.requested", id: "inb_1", mode: "normal" }) + const attempt = runs(undoing.effects)[0].attempt + const disposed = transitionQueue(undoing.state, { type: "dispose" }) + + expect(disposed.effects).toEqual([{ type: "mutation.abort", attempt }, { type: "timer.clearAll" }]) + expect( + transitionQueue(disposed.state, { type: "mutation.undone", attempt, prompt: prompt("inb_1 text"), context: [] }) + .effects, + ).toEqual([{ type: "draft.merge", prompt: prompt("inb_1 text"), context: [], focus: false }]) + }) +}) + +describe("an operation past its bound", () => { + test("a stalled undo gives the composer back and ignores its late answer", () => { + const undoing = transitionQueue(createQueueState([one]), { type: "undo.requested", id: "inb_1", mode: "normal" }) + const attempt = runs(undoing.effects)[0].attempt + + expect(undoing.effects).toContainEqual({ type: "mutation.timer.start", attempt }) + expect(viewQueue(undoing.state, { working: true, behavior: "queue" }).undoing).toBe(true) + + const timedOut = transitionQueue(undoing.state, { + type: "mutation.timed-out", + attempt, + hidden: [], + stage: "running", + }) + + expect(timedOut.state.status).toBe("idle") + expect(viewQueue(timedOut.state, { working: true, behavior: "queue" }).undoing).toBe(false) + expect(timedOut.effects).toEqual([ + { type: "mutation.abort", attempt }, + { type: "toast", key: "common.requestFailed" }, + { type: "mutation.timer.clear" }, + ]) + expect(transitionQueue(timedOut.state, { type: "mutation.failed", attempt, hidden: [] }).state).toBe(timedOut.state) + }) + + test("a steered edit whose admission is in flight keeps the edit until the server answers", () => { + const sent = replay(createQueueState([one, two]), [ + { type: "edit.start", id: "inb_1", reverted: false, draft: draft("") }, + { type: "edit.confirm", delivery: "steer", reverted: false, prompt: prompt("inb_1 edited"), ids }, + ]) + + const attempt = runs(sent.effects)[0].attempt + const waiting = transitionQueue(sent.state, { type: "mutation.timed-out", attempt, hidden: [], stage: "committed" }) + + // The replacement may already be delivered: the composer must not get the edit back while it may have gone out. + expect(waiting.state).toBe(sent.state) + expect(waiting.effects).toEqual([]) + + // Delivered, a later failure of the original's cancel leaves the edit with the server. + const admitted = transitionQueue(waiting.state, { type: "mutation.admitted", attempt }).state + + expect( + transitionQueue(admitted, { type: "mutation.failed", attempt, hidden: [] }).effects.some( + (effect) => effect.type === "draft.merge", + ), + ).toBe(false) + + // Refused, it really did not go out, so it returns to the composer. + expect(transitionQueue(waiting.state, { type: "mutation.failed", attempt, hidden: [] }).effects).toContainEqual({ + type: "draft.merge", + prompt: prompt("inb_1 edited"), + context: [], + }) + }) + + test("an undo whose cancel is in flight waits for the server's answer", () => { + const undoing = transitionQueue(createQueueState([one]), { type: "undo.requested", id: "inb_1", mode: "normal" }) + const attempt = runs(undoing.effects)[0].attempt + + expect( + transitionQueue(undoing.state, { type: "mutation.timed-out", attempt, hidden: [], stage: "committed" }).state, + ).toBe(undoing.state) + }) + + test("a stalled reorder hides the copy it withdrew and starts the steer waiting behind it", () => { + const reordering = replay(createQueueState([one, two, three]), [ + { type: "reorder.requested", inboxIDs: ["inb_2", "inb_1", "inb_3"], reverted: false }, + { type: "steer.requested", id: "inb_3" }, + { type: "inbox.synced", items: [one, two, three, item("msg_2")] }, + ]) + + const attempt = runs(reordering.effects)[0].attempt + + const timedOut = transitionQueue(reordering.state, { + type: "mutation.timed-out", + attempt, + hidden: ["msg_2"], + stage: "running", + }) + + expect(timedOut.effects).toContainEqual({ type: "mutation.abort", attempt }) + expect(timedOut.effects).toContainEqual({ type: "toast", key: "common.requestFailed" }) + expect(timedOut.effects).toContainEqual(expect.objectContaining({ type: "timer.start" })) + expect(runs(timedOut.effects)).toMatchObject([{ type: "steer", id: "inb_3" }]) + expect(rowIDs(timedOut.state)).toEqual(["inb_1", "inb_2"]) + // A steer is one request the request queue already bounds, so it gets no timer of its own. + expect(timedOut.effects.filter((effect) => effect.type === "mutation.timer.start")).toEqual([]) + }) + + test("an edit the server holds whose queue re-read stalled counts as done", () => { + const sent = replay(createQueueState([one]), [ + { type: "edit.start", id: "inb_1", reverted: false, draft: draft("") }, + { type: "edit.confirm", delivery: "queue", reverted: false, prompt: prompt("inb_1 edited"), ids }, + ]) + + const attempt = runs(sent.effects)[0].attempt + + const timedOut = transitionQueue(sent.state, { + type: "mutation.timed-out", + attempt, + hidden: [], + stage: "settled", + }) - expect(stale.state).toBe(disposed.state) + expect(timedOut.state.status).toBe("idle") + expect(timedOut.effects).not.toContainEqual({ type: "toast", key: "common.requestFailed" }) + expect(timedOut.effects.some((effect) => effect.type === "draft.merge")).toBe(false) }) }) diff --git a/packages/app/src/session/composer/queue-machine.ts b/packages/app/src/session/composer/queue-machine.ts index e089d81726..7de6ae39da 100644 --- a/packages/app/src/session/composer/queue-machine.ts +++ b/packages/app/src/session/composer/queue-machine.ts @@ -50,6 +50,7 @@ export type QueuedOperation = | EditOperation | { readonly type: "steer"; readonly id: string } | { readonly type: "remove"; readonly id: string } + | { readonly type: "first"; readonly id: string } // Operations that leave the composer free, so a row can be edited while one runs. `cancelling` means the server // admitted every replacement, so a later failure must not hand the edit back to the composer. @@ -80,8 +81,33 @@ type QueueBase = { readonly seq: number readonly items: readonly QueuedPrompt[] readonly gone: readonly GoneEntry[] + // Each inbox ID a finished edit or reorder replaced, mapped to the ID admitted in its place, so the strip can swap + // the row in place. An entry is dropped once no ID along its chain is queued. + readonly moved: Readonly> } +const NO_MOVES: Readonly> = Object.freeze({}) + +/** + * Bounds an edit, reorder or undo, whose chains include local media reads and one request per rewritten prompt. Each + * request already fails on its own after the request queue's 60 s wait for headers; a steer or removal is one request, + * so it needs no other bound. + */ +export const QUEUE_MUTATION_TIMEOUT_MS = 60_000 + +/** + * How far a timed-out operation got. `committed`: a step it cannot take back is in flight (an undo's cancel, a steered + * edit's admission, or the cancels of a rewrite's originals once every copy is in), so the operation waits for its + * result. `settled`: the server holds the whole change and only re-reading its queue stalled. + */ +export type QueueMutationStage = "running" | "committed" | "settled" + +// After unmount, an operation still in flight can owe the composer's saved draft a prompt: an edit the server never +// admitted, or an undo whose cancel the server may still apply. +type DisposedReturn = + | { readonly type: "edit"; readonly attempt: number; readonly prompt: Prompt } + | { readonly type: "undo"; readonly attempt: number } + // Operations run one at a time in the order they were requested: `active` is in flight and `pending` waits for it. export type QueueState = | (QueueBase & { readonly status: "idle" }) @@ -97,6 +123,9 @@ export type QueueState = readonly active: ConcurrentOperation readonly pending: readonly QueuedOperation[] }) + | { readonly status: "disposed"; readonly returning?: DisposedReturn } + +type LiveQueueState = Exclude export type QueueEvent = | { readonly type: "inbox.synced"; readonly items: readonly QueuedPrompt[] } @@ -112,7 +141,9 @@ export type QueueEvent = readonly ids: readonly string[] } | { readonly type: "reorder.requested"; readonly inboxIDs: readonly string[]; readonly reverted: boolean } + | { readonly type: "first.requested"; readonly id: string; readonly reverted: boolean } | { readonly type: "steer.requested"; readonly id: string } + | { readonly type: "steer-first.requested" } | { readonly type: "remove.requested"; readonly id: string } | { readonly type: "undo.requested"; readonly id: string; readonly mode: "normal" | "shell" } | { readonly type: "mutation.moved"; readonly attempt: number; readonly moved: Readonly> } @@ -126,6 +157,13 @@ export type QueueEvent = } // `hidden` lists the inbox IDs the failed operation already withdrew or cancelled. | { readonly type: "mutation.failed"; readonly attempt: number; readonly hidden: readonly string[] } + // `hidden` as for a failure: what the operation withdrew or cancelled before the bound ran out. + | { + readonly type: "mutation.timed-out" + readonly attempt: number + readonly hidden: readonly string[] + readonly stage: QueueMutationStage + } | { readonly type: "gone.expired"; readonly expiry: number } | { readonly type: "dispose" } @@ -136,13 +174,23 @@ export type QueueEffect = // `keep` is the prompt the edit was loaded from: changes made to it join the restored draft. | { readonly type: "draft.restore"; readonly stash: EditStash; readonly focus: boolean; readonly keep?: QueuedPrompt } | { readonly type: "draft.pinned"; readonly blobs: ReadonlyMap } - | { readonly type: "draft.merge"; readonly prompt: Prompt; readonly context: readonly ContextItem[] } + // `focus: false` after unmount, when the merge lands in the session's saved draft. + | { + readonly type: "draft.merge" + readonly prompt: Prompt + readonly context: readonly ContextItem[] + readonly focus?: false + } | { readonly type: "media.pin" readonly attempt: number readonly attachments: readonly (ImageAttachmentPart | PathAttachmentPart)[] } | { readonly type: "mutation.run"; readonly operation: ActiveOperation } + // Stops the operation at its next step; a request already sent still finishes. + | { readonly type: "mutation.abort"; readonly attempt: number } + | { readonly type: "mutation.timer.start"; readonly attempt: number } + | { readonly type: "mutation.timer.clear" } | { readonly type: "timer.start"; readonly expiry: number } | { readonly type: "timer.clear"; readonly expiry: number } | { readonly type: "timer.clearAll" } @@ -157,13 +205,17 @@ export type QueueView = { readonly undoing: boolean readonly delivery: ComposerDelivery readonly alternate: ComposerDelivery | undefined + /** Inbox IDs replaced by an edit or reorder, finished or in flight, mapped to their replacements. */ + readonly moved: Readonly> } export function createQueueState(items: readonly QueuedPrompt[]): QueueState { - return { status: "idle", seq: 0, items, gone: [] } + return { status: "idle", seq: 0, items, gone: [], moved: NO_MOVES } } export function transitionQueue(state: QueueState, event: QueueEvent): QueueTransition { + if (state.status === "disposed") return settleDisposed(state, event) + if (event.type === "inbox.synced") return synced(state, event.items) if (event.type === "edit.start") return startEdit(state, event) @@ -183,8 +235,26 @@ export function transitionQueue(state: QueueState, event: QueueEvent): QueueTran if (event.type === "reorder.requested") return reorder(state, event) + if (event.type === "first.requested") { + if (event.reverted) return changed(state, [{ type: "toast", key: "session.queue.reverted" }]) + + const rows = selectQueueRows(state) + + if (!rows.some((row) => row.id === event.id) || rows[0]?.id === event.id) return unchanged(state) + + return enqueue(state, { type: "first", id: event.id }) + } + if (event.type === "steer.requested") return request(state, { type: "steer", id: event.id }) + if (event.type === "steer-first.requested") { + if (state.status !== "idle") return unchanged(state) + + const first = selectQueueRows(state)[0] + + return first && !first.pending ? request(state, { type: "steer", id: first.id }) : unchanged(state) + } + if (event.type === "remove.requested") return request(state, { type: "remove", id: event.id }) if (event.type === "undo.requested") return undo(state, event) @@ -197,16 +267,68 @@ export function transitionQueue(state: QueueState, event: QueueEvent): QueueTran if (event.type === "dispose") { const edit = editOf(state) - const closed = state.status === "editing" || state.status === "editing-while-mutating" ? closeEdit(state) : state - - // Operations in flight still finish: the server may already hold half of an edit. - return changed({ ...closed, gone: [] }, [...(edit ? [restore(edit, false)] : []), { type: "timer.clearAll" }]) + const active = state.status === "mutating" || state.status === "editing-while-mutating" ? state.active : undefined + + const returning: DisposedReturn | undefined = + active?.type === "edit" && active.phase === "admitting" + ? { type: "edit", attempt: active.attempt, prompt: active.prompt } + : active?.type === "undo" + ? { type: "undo", attempt: active.attempt } + : undefined + + // Operations in flight still finish, since the server may already hold half of an edit, but waiting ones never + // start. An undo stops before its cancel if it can: nothing would show the restored prompt. + return changed(returning ? { status: "disposed", returning } : { status: "disposed" }, [ + ...(edit ? [restore(edit, false)] : []), + ...(active?.type === "undo" ? [{ type: "mutation.abort" as const, attempt: active.attempt }] : []), + { type: "timer.clearAll" }, + ]) } + if (event.type === "mutation.timed-out") return timedOut(state, event) + return settle(state, event) } +function settleDisposed(state: Extract, event: QueueEvent): QueueTransition { + const returning = state.returning + + if (!returning || !("attempt" in event) || event.attempt !== returning.attempt) return unchanged(state) + + if (event.type === "mutation.admitted" || event.type === "mutation.succeeded") return changed({ status: "disposed" }) + + if (event.type === "mutation.undone") + return changed({ status: "disposed" }, [ + { type: "draft.merge", prompt: event.prompt, context: event.context, focus: false }, + ]) + + if (event.type !== "mutation.failed") return unchanged(state) + + return changed( + { status: "disposed" }, + returning.type === "edit" ? [{ type: "draft.merge", prompt: returning.prompt, context: [], focus: false }] : [], + ) +} + +// An operation past its bound ends as it got: a finished change succeeds, an undo whose cancel is in flight waits for +// it, and anything else fails with what it already withdrew, while its chain stops at the next step. +function timedOut(state: LiveQueueState, event: Extract) { + if (state.status !== "mutating" && state.status !== "editing-while-mutating") return unchanged(state) + + if (state.active.attempt !== event.attempt || event.stage === "committed") return unchanged(state) + + const next = settle( + state, + event.stage === "settled" + ? { type: "mutation.succeeded", attempt: event.attempt } + : { type: "mutation.failed", attempt: event.attempt, hidden: event.hidden }, + ) + + return changed(next.state, [{ type: "mutation.abort", attempt: event.attempt }, ...next.effects]) +} + export function selectQueueRows(state: QueueState): QueueRow[] { + if (state.status === "disposed") return [] const operations = operationsOf(state) const hidden = [ @@ -256,14 +378,36 @@ export function viewQueue( undoing: state.status === "mutating" && state.active.type === "undo", delivery: context.working ? context.behavior : "steer", alternate: editing ? "steer" : context.working ? (context.behavior === "queue" ? "steer" : "queue") : undefined, + moved: selectQueueMoved(state), + } +} + +export function selectQueueMoved(state: QueueState) { + if (state.status === "disposed") return NO_MOVES + const active = state.status === "mutating" || state.status === "editing-while-mutating" ? state.active : undefined + + if ((active?.type !== "edit" && active?.type !== "reorder") || !Object.keys(active.moved).length) return state.moved + + return { ...state.moved, ...active.moved } +} + +/** The first ID along `id`'s chain of replacements that `listed` holds. */ +export function movedTarget(moved: Readonly>, id: string, listed: ReadonlySet) { + // Every replacement is a freshly minted ID, so a chain cannot loop; the bound only guards malformed input. + const hops = Object.keys(moved).length + + for (let next = moved[id], step = 0; next !== undefined && step < hops; next = moved[next], step++) { + if (listed.has(next)) return next } + + return undefined } export function editingID(state: QueueState) { return editOf(state)?.id } -function synced(state: QueueState, items: readonly QueuedPrompt[]): QueueTransition { +function synced(state: LiveQueueState, items: readonly QueuedPrompt[]): QueueTransition { if (items === state.items) return unchanged(state) const listed = new Set(items.map((item) => item.id)) const gone = state.gone.filter((entry) => listed.has(entry.id)) @@ -272,7 +416,15 @@ function synced(state: QueueState, items: readonly QueuedPrompt[]): QueueTransit gone.some((entry) => entry.expiry === expiry) ? [] : [{ type: "timer.clear", expiry }], ) - const next = { ...state, items, gone } + // A replacement in flight can continue a finished one's chain. + const chains = selectQueueMoved(state) + + const kept = Object.entries(state.moved).filter( + ([, id]) => listed.has(id) || movedTarget(chains, id, listed) !== undefined, + ) + + const moved = kept.length === Object.keys(state.moved).length ? state.moved : Object.fromEntries(kept) + const next = { ...state, items, gone, moved } if (next.status !== "editing" && next.status !== "editing-while-mutating") return changed(next, cleared) @@ -283,7 +435,7 @@ function synced(state: QueueState, items: readonly QueuedPrompt[]): QueueTransit return changed(closeEdit(next), [...cleared, restore(next.edit, true, next.edit.item)]) } -function startEdit(state: QueueState, event: Extract): QueueTransition { +function startEdit(state: LiveQueueState, event: Extract): QueueTransition { // Other rows stay editable while an edit, steer or removal is in flight; the row it is changing ignores clicks and // shows as pending until the server catches up. if (state.status === "mutating" && !isConcurrent(state.active)) return unchanged(state) @@ -312,7 +464,7 @@ function startEdit(state: QueueState, event: Extract): QueueTransition { +function confirmEdit(state: LiveQueueState, event: Extract): QueueTransition { if (state.status !== "editing" && state.status !== "editing-while-mutating") return unchanged(state) if (event.reverted) return changed(state, [{ type: "toast", key: "session.queue.reverted" }]) @@ -365,7 +517,7 @@ function confirmEdit(state: QueueState, event: Extract): QueueTransition { +function reorder(state: LiveQueueState, event: Extract): QueueTransition { if (state.status !== "idle" && state.status !== "editing") return unchanged(state) if (event.reverted) return changed(state, [{ type: "toast", key: "session.queue.reverted" }]) @@ -377,15 +529,20 @@ function reorder(state: QueueState, event: Extract) { +function request(state: LiveQueueState, operation: Extract) { const row = selectQueueRows(state).find((entry) => entry.id === operation.id) if (!row || row.pending) return unchanged(state) @@ -396,7 +553,7 @@ function request(state: QueueState, operation: Extract): QueueTransition { +function undo(state: LiveQueueState, event: Extract): QueueTransition { if (state.status !== "idle") return unchanged(state) const row = selectQueueRows(state).find((entry) => entry.id === event.id) const item = state.items.find((entry) => entry.id === event.id) @@ -407,13 +564,21 @@ function undo(state: QueueState, event: Extract
-
@@ -160,7 +94,7 @@ export function SessionElicitationDock(props: { } >
- + {(field) => (
@@ -168,9 +102,9 @@ export function SessionElicitationDock(props: {
- + {/* The desktop's own server also lists the plugins main runs, so its rows stay while the list loads. */} + + + + +

{language.t("common.loading")}

+
+ + +
@@ -206,22 +274,38 @@ export const SettingsExtensions: Component<{ {language.t("settings.extensions.availableAll")} - + {language.t("settings.extensions.addSkills")}
- {(skill) => ( -
-
- - {skill.name} + {(skill) => { + const link = () => sources.skill(skill) + + return ( +
+
+ + {skill.name}} + > + {(href) => } + +
-
- )} + ) + }} + + +
diff --git a/packages/app/src/settings/providers/machine.test.ts b/packages/app/src/settings/providers/machine.test.ts index 6bc142e719..e6bb87e3ed 100644 --- a/packages/app/src/settings/providers/machine.test.ts +++ b/packages/app/src/settings/providers/machine.test.ts @@ -1,42 +1,74 @@ import { expect, test } from "bun:test" +import type { ProviderAccount } from "./accounts" import { + availableProviders, connectedProviders, - createProviderDisconnectState, + createSettingsProvidersState, + providerAccountView, providerRow, - transitionProviderDisconnect, - type ProviderDisconnectEffect, - type ProviderDisconnectEvent, - type ProviderDisconnectState, + transitionSettingsProviders, + type SettingsProvidersEffect, + type SettingsProvidersEvent, + type SettingsProvidersState, } from "./machine" +type Item = { readonly id: string } + const openai = { id: "openai" } const opencode = { id: "opencode" } const consoleGoogle = { id: "console-google" } -const disconnectOpenAI: ProviderDisconnectEvent = { +const disconnectOpenAI: SettingsProvidersEvent = { type: "disconnect.requested", providerIDs: ["openai"], integrationID: "openai", providerName: "OpenAI", } -const disconnectConsole: ProviderDisconnectEvent = { +const disconnectConsole: SettingsProvidersEvent = { type: "disconnect.requested", providerIDs: ["opencode", "console-google"], integrationID: "opencode", providerName: "OpenCode", } -function replay(events: ProviderDisconnectEvent[]) { - return events.reduce<{ state: ProviderDisconnectState; effects: ProviderDisconnectEffect[] }>( +const work: ProviderAccount = { type: "credential", id: "cred_work", label: "Work", method: "oauth" } + +const personal: ProviderAccount = { type: "credential", id: "cred_personal", label: "Personal", method: "oauth" } + +// The Console list before a switch, and the transient catalog in which the workspace providers dropped. +const before = [opencode, consoleGoogle, openai] + +const transient = [openai] + +const activate = (catalog: readonly Item[], account = personal): SettingsProvidersEvent => ({ + type: "account.activate.requested", + integrationID: "opencode", + providerName: "OpenCode", + account, + activeCredentialID: work.id, + catalog, +}) + +const remove = (catalog: readonly Item[]): SettingsProvidersEvent => ({ + type: "account.remove.requested", + integrationID: "opencode", + providerName: "OpenCode", + account: work, + final: false, + catalog, +}) + +function replay(events: SettingsProvidersEvent[], state = createSettingsProvidersState()) { + return events.reduce<{ state: SettingsProvidersState; effects: SettingsProvidersEffect[] }>( (current, event) => { - const result = transitionProviderDisconnect(current.state, event) + const result = transitionSettingsProviders(current.state, event) return { state: result.state, effects: [...current.effects, ...result.effects] } }, - { state: createProviderDisconnectState(), effects: [] }, + { state, effects: [] }, ) } @@ -81,7 +113,7 @@ test("a removed provider stays hidden until the catalog drops it, then shows aga expect(connectedProviders(removed.state, [openai])).toEqual([]) expect(removed.effects.at(-1)).toEqual({ type: "toast.disconnected", providerName: "OpenAI" }) - const dropped = transitionProviderDisconnect(removed.state, { type: "catalog.synced", providerIDs: [] }).state + const dropped = transitionSettingsProviders(removed.state, { type: "catalog.synced", providerIDs: [] }).state expect(connectedProviders(dropped, [openai])).toEqual([openai]) }) @@ -100,12 +132,12 @@ test("a removal confirmed after the catalog already dropped the provider leaves test("a result for a disconnect that a reconnect superseded is ignored", () => { const reconnected = replay([disconnectOpenAI, { type: "provider.reconnected", providerID: "openai" }]).state - expect(transitionProviderDisconnect(reconnected, { type: "disconnect.succeeded", attempt: 1 })).toEqual({ + expect(transitionSettingsProviders(reconnected, { type: "disconnect.succeeded", attempt: 1 })).toEqual({ state: reconnected, effects: [], }) expect( - transitionProviderDisconnect(reconnected, { + transitionSettingsProviders(reconnected, { type: "disconnect.failed", attempt: 1, reason: { kind: "no-credentials" }, @@ -128,5 +160,111 @@ test("reconnecting the Console clears its providers only", () => { test("a second disconnect while one is running starts no request", () => { const removing = replay([disconnectOpenAI]).state - expect(transitionProviderDisconnect(removing, disconnectOpenAI)).toEqual({ state: removing, effects: [] }) + expect(transitionSettingsProviders(removing, disconnectOpenAI)).toEqual({ state: removing, effects: [] }) +}) + +test("the dialog's late catalog refresh does not unfreeze the list while an account switch runs", () => { + const switching = replay([ + { type: "dialog.opened", catalog: before }, + { type: "dialog.closed", attempt: 1 }, + activate(transient), + { type: "dialog.refresh.settled", attempt: 1 }, + ]) + + expect(switching.effects).toEqual([ + { type: "dialog.open", attempt: 1, provider: undefined }, + { type: "catalog.refresh", attempt: 1 }, + { + type: "account.activate.run", + attempt: 2, + integrationID: "opencode", + providerName: "OpenCode", + account: personal, + }, + ]) + expect(availableProviders(switching.state, transient)).toEqual(before) + expect(providerAccountView(switching.state).busy).toBe(true) + + const settled = transitionSettingsProviders(switching.state, { type: "account.settled", attempt: 2 }).state + expect(availableProviders(settled, transient)).toEqual(transient) + expect(providerAccountView(settled).busy).toBe(false) +}) + +test("a finished account action does not unfreeze the list behind an open connect dialog", () => { + const open = replay([activate(before), { type: "dialog.opened", provider: "anthropic", catalog: transient }]) + + expect(open.effects.at(-1)).toEqual({ type: "dialog.open", attempt: 2, provider: "anthropic" }) + + const settled = replay([{ type: "account.settled", attempt: 1 }], open.state) + expect(availableProviders(settled.state, transient)).toEqual(before) + expect(providerAccountView(settled.state).busy).toBe(false) + + const closed = replay( + [ + { type: "dialog.closed", attempt: 2 }, + { type: "dialog.refresh.settled", attempt: 2 }, + ], + settled.state, + ) + + expect(closed.state.status).toBe("live") + expect(availableProviders(closed.state, transient)).toEqual(transient) +}) + +test("a closed dialog's refresh does not release a dialog opened after it", () => { + const second = replay([ + { type: "dialog.opened", catalog: before }, + { type: "dialog.closed", attempt: 1 }, + { type: "dialog.opened", catalog: transient }, + ]).state + + expect(transitionSettingsProviders(second, { type: "dialog.refresh.settled", attempt: 1 }).state).toBe(second) + expect(transitionSettingsProviders(second, { type: "dialog.closed", attempt: 1 }).state).toBe(second) + expect(availableProviders(second, transient)).toEqual(before) +}) + +test("an account action closes a rename and blocks renames and other account actions until it settles", () => { + const renaming = replay([{ type: "account.rename.started", credentialID: work.id }]).state + expect(providerAccountView(renaming)).toEqual({ busy: false, renaming: work.id }) + + const busy = transitionSettingsProviders(renaming, activate(before)).state + expect(providerAccountView(busy)).toEqual({ busy: true, renaming: undefined }) + + for (const event of [ + { type: "account.rename.started", credentialID: work.id }, + activate(before), + remove(before), + { type: "account.settled", attempt: 99 }, + ] satisfies SettingsProvidersEvent[]) + expect(transitionSettingsProviders(busy, event)).toEqual({ state: busy, effects: [] }) + + const done = transitionSettingsProviders(busy, { type: "account.settled", attempt: 1 }).state + expect(done).toEqual({ status: "live", rows: {}, nextAttempt: 2, renaming: undefined }) + expect(transitionSettingsProviders(done, remove(before)).effects).toEqual([ + { + type: "account.remove.run", + attempt: 2, + integrationID: "opencode", + providerName: "OpenCode", + account: work, + final: false, + }, + ]) +}) + +test("switching to the account that is already active starts nothing", () => { + const live = createSettingsProvidersState() + + expect(transitionSettingsProviders(live, activate(before, work))).toEqual({ state: live, effects: [] }) +}) + +test("a disconnect toast still reports while the list is held", () => { + const result = replay([ + { type: "dialog.opened", catalog: before }, + disconnectOpenAI, + { type: "disconnect.succeeded", attempt: 2 }, + ]) + + expect(result.state.status).toBe("holding") + expect(result.effects.at(-1)).toEqual({ type: "toast.disconnected", providerName: "OpenAI" }) }) diff --git a/packages/app/src/settings/providers/machine.ts b/packages/app/src/settings/providers/machine.ts index 2e8cfe8210..04ece2a9d4 100644 --- a/packages/app/src/settings/providers/machine.ts +++ b/packages/app/src/settings/providers/machine.ts @@ -1,3 +1,5 @@ +import type { ProviderAccount } from "./accounts" + export type DisconnectFailure = | { readonly kind: "no-credentials" } | { readonly kind: "request"; readonly error: unknown } @@ -15,13 +17,75 @@ export type ProviderRowState = // The server confirmed the removal but its catalog still lists the provider. | { readonly status: "removed"; readonly integrationID: string } -export type ProviderDisconnectState = { - /** Holds only rows that are not "connected"; a missing ID is a connected row. */ - readonly rows: Readonly>> +/** Holds only rows that are not "connected"; a missing ID is a connected row. */ +export type ProviderRows = Readonly>> + +/** The connect dialog is open, or closed and refreshing the catalog it may have changed. */ +export type ProviderDialogHold = { + readonly phase: "open" | "refreshing" + readonly attempt: number +} + +/** An account switch or removal that waits for the server and, for the Console, for the new workspace catalog. */ +export type ProviderAccountBusy = { + readonly phase: "activating" | "removing" + readonly attempt: number + readonly credentialID: string +} + +type ProvidersBase = { + readonly rows: ProviderRows readonly nextAttempt: number } -export type ProviderDisconnectEvent = +/** + * Settings › Providers. + * - `live`: the list follows the catalog; an inline account rename may be open. + * - `holding`: the connect dialog or an account action is running, so the Connected list stays on `held`, the list + * as it was when the first of them started. It goes live again only when both have finished. + * An account action closes any rename and disables every account menu until it settles. + */ +export type SettingsProvidersState = + | (ProvidersBase & { readonly status: "live"; readonly account?: undefined; readonly renaming?: string }) + | (ProvidersBase & { + readonly status: "holding" + readonly held: readonly T[] + readonly dialog: ProviderDialogHold + readonly account?: undefined + readonly renaming?: string + }) + | (ProvidersBase & { + readonly status: "holding" + readonly held: readonly T[] + readonly dialog?: ProviderDialogHold + readonly account: ProviderAccountBusy + readonly renaming?: undefined + }) + +export type SettingsProvidersEvent = + /** `catalog` is the live Connected list, which the list holds if nothing holds it yet. */ + | { readonly type: "dialog.opened"; readonly provider?: string; readonly catalog: readonly T[] } + | { readonly type: "dialog.closed"; readonly attempt: number } + | { readonly type: "dialog.refresh.settled"; readonly attempt: number } + | { readonly type: "account.rename.started"; readonly credentialID: string } + | { readonly type: "account.rename.closed" } + | { + readonly type: "account.activate.requested" + readonly integrationID: string + readonly providerName: string + readonly account: ProviderAccount + readonly activeCredentialID: string | undefined + readonly catalog: readonly T[] + } + | { + readonly type: "account.remove.requested" + readonly integrationID: string + readonly providerName: string + readonly account: ProviderAccount + readonly final: boolean + readonly catalog: readonly T[] + } + | { readonly type: "account.settled"; readonly attempt: number } | { readonly type: "disconnect.requested" /** The clicked provider, plus its Console workspace providers when it is the Console root. */ @@ -34,26 +98,130 @@ export type ProviderDisconnectEvent = | { readonly type: "provider.reconnected"; readonly providerID: string } | { readonly type: "catalog.synced"; readonly providerIDs: readonly string[] } -export type ProviderDisconnectEffect = +export type SettingsProvidersEffect = + | { readonly type: "dialog.open"; readonly attempt: number; readonly provider?: string } + | { readonly type: "catalog.refresh"; readonly attempt: number } + | { + readonly type: "account.activate.run" + readonly attempt: number + readonly integrationID: string + readonly providerName: string + readonly account: ProviderAccount + } + | { + readonly type: "account.remove.run" + readonly attempt: number + readonly integrationID: string + readonly providerName: string + readonly account: ProviderAccount + readonly final: boolean + } | { readonly type: "disconnect.run"; readonly attempt: number; readonly integrationID: string } | { readonly type: "toast.disconnected"; readonly providerName: string } | { readonly type: "toast.failed"; readonly providerName: string; readonly reason: DisconnectFailure } -export type ProviderDisconnectTransition = { - readonly state: ProviderDisconnectState - readonly effects: readonly ProviderDisconnectEffect[] +export type SettingsProvidersTransition = { + readonly state: SettingsProvidersState + readonly effects: readonly SettingsProvidersEffect[] } const CONNECTED: ProviderRowState = { status: "connected" } -export function createProviderDisconnectState(): ProviderDisconnectState { - return { rows: {}, nextAttempt: 1 } +export function createSettingsProvidersState(): SettingsProvidersState { + return { status: "live", rows: {}, nextAttempt: 1 } } -export function transitionProviderDisconnect( - state: ProviderDisconnectState, - event: ProviderDisconnectEvent, -): ProviderDisconnectTransition { +export function transitionSettingsProviders( + state: SettingsProvidersState, + event: SettingsProvidersEvent, +): SettingsProvidersTransition { + if (event.type === "dialog.opened") { + const attempt = state.nextAttempt + + return { + state: hold( + { ...state, nextAttempt: attempt + 1 }, + state.status === "holding" ? state.held : event.catalog, + { phase: "open", attempt }, + state.account, + state.renaming, + ), + effects: [{ type: "dialog.open", attempt, provider: event.provider }], + } + } + + if (event.type === "dialog.closed") { + if (state.status !== "holding" || state.dialog?.phase !== "open" || state.dialog.attempt !== event.attempt) + return { state, effects: [] } + + return { + state: hold(state, state.held, { phase: "refreshing", attempt: event.attempt }, state.account, state.renaming), + effects: [{ type: "catalog.refresh", attempt: event.attempt }], + } + } + + if (event.type === "dialog.refresh.settled") { + if (state.status !== "holding" || state.dialog?.phase !== "refreshing" || state.dialog.attempt !== event.attempt) + return { state, effects: [] } + + return { state: hold(state, state.held, undefined, state.account, state.renaming), effects: [] } + } + + if (event.type === "account.rename.started") { + if (state.account || state.renaming === event.credentialID) return { state, effects: [] } + + return { state: { ...state, renaming: event.credentialID }, effects: [] } + } + + if (event.type === "account.rename.closed") { + if (state.account || state.renaming === undefined) return { state, effects: [] } + + return { state: { ...state, renaming: undefined }, effects: [] } + } + + if (event.type === "account.activate.requested" || event.type === "account.remove.requested") { + if (state.account) return { state, effects: [] } + + if (event.type === "account.activate.requested" && event.account.id === event.activeCredentialID) + return { state, effects: [] } + const attempt = state.nextAttempt + const phase = event.type === "account.activate.requested" ? "activating" : "removing" + + return { + state: hold( + { ...state, nextAttempt: attempt + 1 }, + state.status === "holding" ? state.held : event.catalog, + state.status === "holding" ? state.dialog : undefined, + { phase, attempt, credentialID: event.account.id }, + undefined, + ), + effects: [ + event.type === "account.activate.requested" + ? { + type: "account.activate.run", + attempt, + integrationID: event.integrationID, + providerName: event.providerName, + account: event.account, + } + : { + type: "account.remove.run", + attempt, + integrationID: event.integrationID, + providerName: event.providerName, + account: event.account, + final: event.final, + }, + ], + } + } + + if (event.type === "account.settled") { + if (state.account?.attempt !== event.attempt || state.status !== "holding") return { state, effects: [] } + + return { state: hold(state, state.held, state.dialog, undefined, undefined), effects: [] } + } + if (event.type === "disconnect.requested") return requested(state, event) if (event.type === "disconnect.succeeded") return settled(state, event.attempt, undefined) @@ -80,27 +248,51 @@ export function transitionProviderDisconnect( } } -export function providerRow(state: ProviderDisconnectState, providerID: string): ProviderRowState { +/** The Connected list to show: the held one while the dialog or an account action runs, otherwise the live one. */ +export function availableProviders(state: SettingsProvidersState, live: readonly T[]) { + return state.status === "holding" ? state.held : live +} + +export function providerAccountView(state: SettingsProvidersState) { + return { busy: state.account !== undefined, renaming: state.renaming } +} + +export function providerRow(state: ProvidersBase, providerID: string): ProviderRowState { return state.rows[providerID] ?? CONNECTED } /** A row leaves the Connected list while its removal runs and after the server confirms it, and returns on failure. */ -export function connectedProviders( - state: ProviderDisconnectState, - available: readonly T[], -) { +export function connectedProviders(state: ProvidersBase, available: readonly T[]) { return available.filter((item) => providerRow(state, item.id).status === "connected") } -function requested( - state: ProviderDisconnectState, - event: Extract, -): ProviderDisconnectTransition { +function hold( + base: ProvidersBase, + held: readonly T[], + dialog: ProviderDialogHold | undefined, + account: ProviderAccountBusy | undefined, + renaming: string | undefined, +): SettingsProvidersState { + const rows = base.rows + const nextAttempt = base.nextAttempt + + if (account) return { status: "holding", rows, nextAttempt, held, dialog, account } + + if (dialog) return { status: "holding", rows, nextAttempt, held, dialog, renaming } + + return { status: "live", rows, nextAttempt, renaming } +} + +function requested( + state: SettingsProvidersState, + event: Extract, { type: "disconnect.requested" }>, +): SettingsProvidersTransition { if (event.providerIDs.some((id) => providerRow(state, id).status !== "connected")) return { state, effects: [] } const attempt = state.nextAttempt return { state: { + ...state, rows: { ...state.rows, ...Object.fromEntries( @@ -122,11 +314,11 @@ function requested( } } -function settled( - state: ProviderDisconnectState, +function settled( + state: SettingsProvidersState, attempt: number, failure: DisconnectFailure | undefined, -): ProviderDisconnectTransition { +): SettingsProvidersTransition { const current = Object.values(state.rows).find((row) => row.status === "removing" && row.attempt === attempt) if (current?.status !== "removing") return { state, effects: [] } @@ -148,10 +340,10 @@ function settled( } // Returns the same state object when no row changes, so the signal holding it does not notify. -function update( - state: ProviderDisconnectState, - next: (id: string, row: ProviderDisconnectState["rows"][string]) => ProviderRowState, -): ProviderDisconnectState { +function update( + state: SettingsProvidersState, + next: (id: string, row: ProviderRows[string]) => ProviderRowState, +): SettingsProvidersState { const entries = Object.entries(state.rows).map(([id, row]) => [id, row, next(id, row)] as const) if (entries.every(([, row, result]) => row === result)) return state diff --git a/packages/app/src/settings/providers/providers.tsx b/packages/app/src/settings/providers/providers.tsx index 33d9f6adea..6bc7d59aa5 100644 --- a/packages/app/src/settings/providers/providers.tsx +++ b/packages/app/src/settings/providers/providers.tsx @@ -10,7 +10,6 @@ import { popularProviders, useProviders } from "@/providers/catalog/providers" import { consoleProviderGroup } from "@/providers/catalog/console" import { useIntegrations } from "@/providers/catalog/integrations" import { createEffect, createMemo, createSignal, on, untrack, type Component, For, type JSX, Show } from "solid-js" -import { createStore } from "solid-js/store" import { useLanguage } from "@/runtime/i18n/language" import { useServerSDK } from "@/runtime/server/client" import { formatServerError } from "@/runtime/server/errors" @@ -22,11 +21,13 @@ import { activeProviderAccount, providerAccounts, type ProviderAccount } from ". import { AccountNameInput } from "./account-name" import { useProviderAccountActions } from "./account-actions" import { + availableProviders, connectedProviders, - createProviderDisconnectState, - transitionProviderDisconnect, - type ProviderDisconnectEffect, - type ProviderDisconnectEvent, + createSettingsProvidersState, + providerAccountView, + transitionSettingsProviders, + type SettingsProvidersEffect, + type SettingsProvidersEvent, } from "./machine" import "@/settings/settings.css" @@ -59,25 +60,62 @@ export const SettingsProviders: Component<{ const providerConnect = useProviderConnectController() const accountActions = useProviderAccountActions(() => props.directory) - const [state, setState] = createStore<{ - consoleExpanded: boolean - credentialID?: string - renaming?: string - held?: ProviderItem[] - }>({ - consoleExpanded: false, - }) - - const [disconnects, setDisconnects] = createSignal(createProviderDisconnectState()) + const [consoleExpanded, setConsoleExpanded] = createSignal(false) + const [pageState, setPageState] = createSignal(createSettingsProvidersState()) + const accountView = createMemo(() => providerAccountView(pageState())) - const dispatch = (event: ProviderDisconnectEvent) => { - const result = transitionProviderDisconnect(untrack(disconnects), event) - setDisconnects(result.state) - result.effects.forEach(run) + const dispatch = (event: SettingsProvidersEvent) => { + const result = transitionSettingsProviders(untrack(pageState), event) + setPageState(result.state) + result.effects.forEach( + (effect) => void Promise.try(() => run(effect)).catch((cause: unknown) => console.error(cause)), + ) } // Results that arrive after Settings closes still report through a toast, as the user asked for the change. - const run = (effect: ProviderDisconnectEffect) => { + const run = (effect: SettingsProvidersEffect) => { + if (effect.type === "dialog.open") { + providerConnect.select(effect.provider) + void dialog.show( + () => ( + dispatch({ type: "provider.reconnected", providerID })} + /> + ), + () => dispatch({ type: "dialog.closed", attempt: effect.attempt }), + ) + + return + } + + if (effect.type === "catalog.refresh") { + void accountActions + .refresh() + .catch(() => undefined) + .finally(() => dispatch({ type: "dialog.refresh.settled", attempt: effect.attempt })) + + return + } + + // The actions toast their own request failures; anything else they throw still settles the menus. + if (effect.type === "account.activate.run" || effect.type === "account.remove.run") { + const input = { integrationID: effect.integrationID, provider: effect.providerName, account: effect.account } + void Promise.try(() => + effect.type === "account.activate.run" + ? accountActions.activate(input) + : accountActions.remove({ ...input, final: effect.final }), + ) + .catch((error) => + showToast({ title: language.t("common.requestFailed"), description: formatServerError(error, language.t) }), + ) + .finally(() => dispatch({ type: "account.settled", attempt: effect.attempt })) + + return + } + if (effect.type === "disconnect.run") { void serverSdk.api.integration .get({ @@ -139,30 +177,11 @@ export const SettingsProviders: Component<{ return integrations.list().find((entry) => entry.id === id) } - const connect = (provider?: string) => { - // The list stays as it was while the dialog connects, so a new sign-in that briefly drops the - // Console workspace providers from the catalog can't flash rows behind the dialog. - setState("held", available()) - providerConnect.select(provider) - void dialog.show( - () => ( - dispatch({ type: "provider.reconnected", providerID })} - /> - ), - () => - void accountActions - .refresh() - .catch(() => undefined) - .finally(() => setState("held", undefined)), - ) - } + // The list stays as it was while the dialog connects, so a new sign-in that briefly drops the + // Console workspace providers from the catalog can't flash rows behind the dialog. + const connect = (provider?: string) => dispatch({ type: "dialog.opened", provider, catalog: untrack(available) }) - const available = createMemo(() => { - if (state.held) return state.held + const liveAvailable = createMemo(() => { const connected = providers.connected() const managedConsole = consoleProviderGroup(connected) @@ -182,6 +201,8 @@ export const SettingsProviders: Component<{ .toSorted((a, b) => Number(b.id === "opencode-go") - Number(a.id === "opencode-go")) }) + const available = createMemo(() => availableProviders(pageState(), liveAvailable())) + // Tells the machine which providers the server catalog lists, so a confirmed removal stops hiding a // provider once the server drops it and shows it again if it is later reconnected. createEffect( @@ -191,7 +212,7 @@ export const SettingsProviders: Component<{ ), ) - const connected = createMemo(() => connectedProviders(disconnects(), available())) + const connected = createMemo(() => connectedProviders(pageState(), available())) const consoleGroup = createMemo(() => consoleProviderGroup(available())) @@ -286,29 +307,31 @@ export const SettingsProviders: Component<{ }) } - const activate = async (provider: ProviderItem, providerName: string, account: ProviderAccount) => { - if (activeProviderAccount(integration(provider))?.id === account.id) return - setState({ credentialID: account.id, held: available() }) - await accountActions.activate({ integrationID: provider.integrationID ?? provider.id, provider: providerName, account }) - setState({ credentialID: undefined, held: undefined }) - } + const activate = (provider: ProviderItem, providerName: string, account: ProviderAccount) => + dispatch({ + type: "account.activate.requested", + integrationID: provider.integrationID ?? provider.id, + providerName, + account, + activeCredentialID: activeProviderAccount(integration(provider))?.id, + catalog: untrack(available), + }) - const remove = async (provider: ProviderItem, providerName: string, account: ProviderAccount) => { - setState({ credentialID: account.id, held: available() }) - await accountActions.remove({ + const remove = (provider: ProviderItem, providerName: string, account: ProviderAccount) => + dispatch({ + type: "account.remove.requested", integrationID: provider.integrationID ?? provider.id, - provider: providerName, + providerName, account, final: providerAccounts(integration(provider)).length === 1, + catalog: untrack(available), }) - setState({ credentialID: undefined, held: undefined }) - } function AccountMenu(menuProps: { provider: ProviderItem; name?: string }) { const accounts = () => providerAccounts(integration(menuProps.provider)) const active = () => activeProviderAccount(integration(menuProps.provider)) const name = () => menuProps.name ?? menuProps.provider.name - const renaming = () => accounts().find((account) => account.id === state.renaming) + const renaming = () => accounts().find((account) => account.id === accountView().renaming) return ( @@ -362,12 +385,12 @@ export const SettingsProviders: Component<{ onChange={(credentialID) => { const account = accounts().find((item) => item.id === credentialID) - if (account) void activate(menuProps.provider, name(), account) + if (account) activate(menuProps.provider, name(), account) }} > {(account) => ( - + )} @@ -375,7 +398,7 @@ export const SettingsProviders: Component<{ - connect(menuProps.provider.id)}> + connect(menuProps.provider.id)}> {language.t("settings.providers.account.add")} @@ -388,19 +411,25 @@ export const SettingsProviders: Component<{ variant="ghost-muted" size="large" icon={} - disabled={state.credentialID !== undefined || !active()} + disabled={accountView().busy || !active()} aria-label={language.t("dialog.provider.accounts.options", { account: active()?.label ?? "" })} /> - state.renaming && event.preventDefault()}> - setState("renaming", active()?.id)}> + accountView().renaming && event.preventDefault()}> + { + const account = active() + + if (account) dispatch({ type: "account.rename.started", credentialID: account.id }) + }} + > {language.t("common.rename")} { const account = active() - if (account) void remove(menuProps.provider, name(), account) + if (account) remove(menuProps.provider, name(), account) }} > {language.t("dialog.provider.accounts.remove")} @@ -445,9 +474,7 @@ export const SettingsProviders: Component<{
- - {item.name} - + {item.name} {type(item)}
@@ -502,8 +529,8 @@ export const SettingsProviders: Component<{ @@ -539,7 +566,7 @@ export const SettingsProviders: Component<{
- +