Compare commits
4 Commits
048456b8a5
...
release/io
| Author | SHA1 | Date | |
|---|---|---|---|
| b540f01759 | |||
| e719cbb92d | |||
| cb5a973ac7 | |||
| e2443162b0 |
@@ -1,44 +1,39 @@
|
|||||||
name: TestFlight
|
name: TestFlight
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "release/ios/v*"
|
- "release/ios/v*.*.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
testflight:
|
testflight:
|
||||||
|
name: Build and upload
|
||||||
runs-on: macos-arm64
|
runs-on: macos-arm64
|
||||||
|
timeout-minutes: 90
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Check out the release tag
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: "3.1.7"
|
ruby-version: "3.3.11"
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
working-directory: ios
|
working-directory: ios
|
||||||
|
|
||||||
- name: Install XcodeGen
|
- name: Install XcodeGen
|
||||||
run: command -v xcodegen >/dev/null 2>&1 || brew install xcodegen
|
run: command -v xcodegen >/dev/null 2>&1 || brew install xcodegen
|
||||||
|
|
||||||
- name: Upload to TestFlight
|
- name: Build and upload to TestFlight
|
||||||
working-directory: ios
|
working-directory: ios
|
||||||
env:
|
env:
|
||||||
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
|
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
|
||||||
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
|
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
|
||||||
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}
|
ASC_KEY: ${{ secrets.ASC_KEY }}
|
||||||
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
||||||
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
|
|
||||||
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
|
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
|
||||||
SYBIL_BUILD_NUMBER: ${{ github.run_number }}
|
CI: "true"
|
||||||
FASTLANE_SKIP_UPDATE_CHECK: "1"
|
FASTLANE_SKIP_UPDATE_CHECK: "1"
|
||||||
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: "120"
|
FASTLANE_HIDE_CHANGELOG: "1"
|
||||||
# act_runner does not propagate setup-ruby's PATH changes into later
|
run: bundle exec fastlane ios beta
|
||||||
# steps, so put the selected Ruby back on PATH or `bundle` resolves to
|
|
||||||
# the toolcache default and misses the gems installed above.
|
|
||||||
run: |
|
|
||||||
export PATH="/Users/runner/hostedtoolcache/Ruby/3.1.7/arm64/bin:${PATH}"
|
|
||||||
bundle exec fastlane ios beta
|
|
||||||
|
|||||||
@@ -1,24 +1,5 @@
|
|||||||
FASTLANE_APP_IDENTIFIER=net.buzzert.sybil2
|
ASC_KEY_ID=
|
||||||
FASTLANE_TEAM_ID=DQQH5H6GBD
|
ASC_ISSUER_ID=
|
||||||
FASTLANE_SKIP_UPDATE_CHECK=1
|
ASC_KEY=
|
||||||
FASTLANE_HIDE_CHANGELOG=1
|
MATCH_PASSWORD=
|
||||||
SYBIL_APP_STORE_APPLE_ID=6759442828
|
MATCH_GIT_BASIC_AUTHORIZATION=
|
||||||
SYBIL_PROVIDER_PUBLIC_ID=c043d167-ad88-4036-84ea-76c223f1b1b2
|
|
||||||
SYBIL_PROVISIONING_PROFILE_SPECIFIER=Sybil AppStore CI
|
|
||||||
SYBIL_PROVISIONING_PROFILE_UUID=
|
|
||||||
SYBIL_CODE_SIGN_IDENTITY=Apple Distribution: James Magahern (DQQH5H6GBD)
|
|
||||||
SYBIL_XCODE_CODE_SIGN_IDENTITY=6B74B268C4761720FB2051D01D8BB3E47B55D9F5
|
|
||||||
SYBIL_EXPORT_SIGNING_CERTIFICATE=Apple Distribution
|
|
||||||
SYBIL_SIGNING_CERTIFICATE_ID=
|
|
||||||
SYBIL_SIGNING_KEYCHAIN=
|
|
||||||
|
|
||||||
# App Store Connect API key settings for TestFlight upload and signing setup.
|
|
||||||
APP_STORE_CONNECT_API_KEY_ID=
|
|
||||||
APP_STORE_CONNECT_API_ISSUER_ID=
|
|
||||||
APP_STORE_CONNECT_API_KEY_PATH=
|
|
||||||
APP_STORE_CONNECT_API_KEY_CONTENT=
|
|
||||||
APP_STORE_CONNECT_API_KEY_CONTENT_BASE64=false
|
|
||||||
|
|
||||||
# Optional deployment overrides.
|
|
||||||
SYBIL_BUILD_NUMBER=
|
|
||||||
SYBIL_VERSION_TAG=
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "fastlane"
|
gem "fastlane", "2.237.0"
|
||||||
|
|||||||
137
ios/Gemfile.lock
137
ios/Gemfile.lock
@@ -1,46 +1,49 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (3.0.9)
|
CFPropertyList (3.0.8)
|
||||||
abbrev (0.1.2)
|
abbrev (0.1.2)
|
||||||
addressable (2.9.0)
|
addressable (2.9.0)
|
||||||
public_suffix (>= 2.0.2, < 8.0)
|
public_suffix (>= 2.0.2, < 8.0)
|
||||||
artifactory (3.0.17)
|
artifactory (3.0.17)
|
||||||
atomos (0.1.3)
|
atomos (0.1.3)
|
||||||
aws-eventstream (1.3.2)
|
aws-eventstream (1.4.0)
|
||||||
aws-partitions (1.1109.0)
|
aws-partitions (1.1274.0)
|
||||||
aws-sdk-core (3.224.1)
|
aws-sdk-core (3.254.0)
|
||||||
aws-eventstream (~> 1, >= 1.3.0)
|
aws-eventstream (~> 1, >= 1.3.0)
|
||||||
aws-partitions (~> 1, >= 1.992.0)
|
aws-partitions (~> 1, >= 1.992.0)
|
||||||
aws-sigv4 (~> 1.9)
|
aws-sigv4 (~> 1.9)
|
||||||
base64
|
base64
|
||||||
|
bigdecimal
|
||||||
jmespath (~> 1, >= 1.6.1)
|
jmespath (~> 1, >= 1.6.1)
|
||||||
logger
|
logger
|
||||||
aws-sdk-kms (1.101.0)
|
aws-sdk-kms (1.130.0)
|
||||||
aws-sdk-core (~> 3, >= 3.216.0)
|
aws-sdk-core (~> 3, >= 3.254.0)
|
||||||
aws-sigv4 (~> 1.5)
|
aws-sigv4 (~> 1.5)
|
||||||
aws-sdk-s3 (1.188.0)
|
aws-sdk-s3 (1.228.1)
|
||||||
aws-sdk-core (~> 3, >= 3.224.1)
|
aws-sdk-core (~> 3, >= 3.254.0)
|
||||||
aws-sdk-kms (~> 1)
|
aws-sdk-kms (~> 1)
|
||||||
aws-sigv4 (~> 1.5)
|
aws-sigv4 (~> 1.5)
|
||||||
aws-sigv4 (1.11.0)
|
aws-sigv4 (1.12.1)
|
||||||
aws-eventstream (~> 1, >= 1.0.2)
|
aws-eventstream (~> 1, >= 1.0.2)
|
||||||
babosa (1.0.4)
|
babosa (1.0.4)
|
||||||
base64 (0.2.0)
|
base64 (0.3.0)
|
||||||
|
benchmark (0.5.0)
|
||||||
|
bigdecimal (4.1.2)
|
||||||
claide (1.1.0)
|
claide (1.1.0)
|
||||||
colored (1.2)
|
colored (1.2)
|
||||||
colored2 (3.1.2)
|
colored2 (3.1.2)
|
||||||
commander (4.6.0)
|
commander (4.6.0)
|
||||||
highline (~> 2.0.0)
|
highline (~> 2.0.0)
|
||||||
csv (3.3.5)
|
csv (3.3.6)
|
||||||
declarative (0.0.20)
|
declarative (0.0.20)
|
||||||
digest-crc (0.7.0)
|
digest-crc (0.7.0)
|
||||||
rake (>= 12.0.0, < 14.0.0)
|
rake (>= 12.0.0, < 14.0.0)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.6.20240107)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
|
||||||
dotenv (2.8.1)
|
dotenv (2.8.1)
|
||||||
emoji_regex (3.2.3)
|
emoji_regex (3.2.3)
|
||||||
excon (0.109.0)
|
excon (1.6.0)
|
||||||
|
logger
|
||||||
faraday (1.10.6)
|
faraday (1.10.6)
|
||||||
faraday-em_http (~> 1.0)
|
faraday-em_http (~> 1.0)
|
||||||
faraday-em_synchrony (~> 1.0)
|
faraday-em_synchrony (~> 1.0)
|
||||||
@@ -70,42 +73,45 @@ GEM
|
|||||||
faraday_middleware (1.2.1)
|
faraday_middleware (1.2.1)
|
||||||
faraday (~> 1.0)
|
faraday (~> 1.0)
|
||||||
fastimage (2.4.1)
|
fastimage (2.4.1)
|
||||||
fastlane (2.230.0)
|
fastlane (2.237.0)
|
||||||
CFPropertyList (>= 2.3, < 4.0.0)
|
CFPropertyList (>= 2.3, < 5.0.0)
|
||||||
abbrev (~> 0.1.2)
|
abbrev (~> 0.1)
|
||||||
addressable (>= 2.8, < 3.0.0)
|
addressable (>= 2.9.0, < 3.0.0)
|
||||||
artifactory (~> 3.0)
|
artifactory (~> 3.0)
|
||||||
aws-sdk-s3 (~> 1.0)
|
aws-sdk-s3 (~> 1.197)
|
||||||
babosa (>= 1.0.3, < 2.0.0)
|
babosa (>= 1.0.3, < 2.0.0)
|
||||||
base64 (~> 0.2.0)
|
base64 (~> 0.2)
|
||||||
bundler (>= 1.12.0, < 3.0.0)
|
benchmark (>= 0.1.0)
|
||||||
|
bundler (>= 2.4.0, < 5.0.0)
|
||||||
colored (~> 1.2)
|
colored (~> 1.2)
|
||||||
commander (~> 4.6)
|
commander (~> 4.6)
|
||||||
csv (~> 3.3)
|
csv (~> 3.3)
|
||||||
dotenv (>= 2.1.1, < 3.0.0)
|
dotenv (>= 2.1.1, < 3.0.0)
|
||||||
emoji_regex (>= 0.1, < 4.0)
|
emoji_regex (>= 0.1, < 4.0)
|
||||||
excon (>= 0.71.0, < 1.0.0)
|
excon (>= 0.71.0, < 2.0.0)
|
||||||
faraday (~> 1.0)
|
faraday (~> 1.0)
|
||||||
faraday-cookie_jar (~> 0.0.6)
|
faraday-cookie_jar (~> 0.0.6)
|
||||||
faraday_middleware (~> 1.0)
|
faraday_middleware (~> 1.0)
|
||||||
fastimage (>= 2.1.0, < 3.0.0)
|
fastimage (>= 2.1.0, < 3.0.0)
|
||||||
fastlane-sirp (>= 1.0.0)
|
fastlane-sirp (>= 1.1.0)
|
||||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||||
google-apis-androidpublisher_v3 (~> 0.3)
|
google-apis-androidpublisher_v3 (~> 0.3)
|
||||||
google-apis-playcustomapp_v1 (~> 0.1)
|
google-apis-playcustomapp_v1 (~> 0.1)
|
||||||
google-cloud-env (>= 1.6.0, < 2.0.0)
|
google-cloud-env (>= 1.6.0, < 2.3.0)
|
||||||
google-cloud-storage (~> 1.31)
|
google-cloud-storage (~> 1.31)
|
||||||
highline (~> 2.0)
|
highline (~> 2.0)
|
||||||
http-cookie (~> 1.0.5)
|
http-cookie (~> 1.0.5)
|
||||||
json (< 3.0.0)
|
json (< 3.0.0)
|
||||||
jwt (>= 2.1.0, < 3)
|
jwt (>= 2.10.3, < 4)
|
||||||
logger (>= 1.6, < 2.0)
|
logger (>= 1.6, < 2.0)
|
||||||
mini_magick (>= 4.9.4, < 5.0.0)
|
mini_magick (>= 4.9.4, < 5.0.0)
|
||||||
|
multi_json (~> 1.12)
|
||||||
multipart-post (>= 2.0.0, < 3.0.0)
|
multipart-post (>= 2.0.0, < 3.0.0)
|
||||||
mutex_m (~> 0.3.0)
|
mutex_m (~> 0.3)
|
||||||
naturally (~> 2.2)
|
naturally (~> 2.2)
|
||||||
nkf (~> 0.2.0)
|
nkf (~> 0.2)
|
||||||
optparse (>= 0.1.1, < 1.0.0)
|
optparse (>= 0.1.1, < 1.0.0)
|
||||||
|
ostruct (>= 0.1.0)
|
||||||
plist (>= 3.1.0, < 4.0.0)
|
plist (>= 3.1.0, < 4.0.0)
|
||||||
rubyzip (>= 2.0.0, < 3.0.0)
|
rubyzip (>= 2.0.0, < 3.0.0)
|
||||||
security (= 0.1.5)
|
security (= 0.1.5)
|
||||||
@@ -120,41 +126,46 @@ GEM
|
|||||||
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
|
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
|
||||||
fastlane-sirp (1.1.0)
|
fastlane-sirp (1.1.0)
|
||||||
gh_inspector (1.1.3)
|
gh_inspector (1.1.3)
|
||||||
google-apis-androidpublisher_v3 (0.54.0)
|
google-apis-androidpublisher_v3 (0.106.0)
|
||||||
google-apis-core (>= 0.11.0, < 2.a)
|
google-apis-core (>= 0.15.0, < 2.a)
|
||||||
google-apis-core (0.11.3)
|
google-apis-core (0.18.0)
|
||||||
addressable (~> 2.5, >= 2.5.1)
|
addressable (~> 2.5, >= 2.5.1)
|
||||||
googleauth (>= 0.16.2, < 2.a)
|
googleauth (~> 1.9)
|
||||||
httpclient (>= 2.8.1, < 3.a)
|
httpclient (>= 2.8.3, < 3.a)
|
||||||
mini_mime (~> 1.0)
|
mini_mime (~> 1.0)
|
||||||
|
mutex_m
|
||||||
representable (~> 3.0)
|
representable (~> 3.0)
|
||||||
retriable (>= 2.0, < 4.a)
|
retriable (>= 2.0, < 4.a)
|
||||||
rexml
|
google-apis-iamcredentials_v1 (0.28.0)
|
||||||
google-apis-iamcredentials_v1 (0.17.0)
|
google-apis-core (>= 0.15.0, < 2.a)
|
||||||
google-apis-core (>= 0.11.0, < 2.a)
|
google-apis-playcustomapp_v1 (0.18.0)
|
||||||
google-apis-playcustomapp_v1 (0.13.0)
|
google-apis-core (>= 0.15.0, < 2.a)
|
||||||
google-apis-core (>= 0.11.0, < 2.a)
|
google-apis-storage_v1 (0.65.0)
|
||||||
google-apis-storage_v1 (0.29.0)
|
google-apis-core (>= 0.15.0, < 2.a)
|
||||||
google-apis-core (>= 0.11.0, < 2.a)
|
google-cloud-core (1.9.0)
|
||||||
google-cloud-core (1.6.1)
|
|
||||||
google-cloud-env (>= 1.0, < 3.a)
|
google-cloud-env (>= 1.0, < 3.a)
|
||||||
google-cloud-errors (~> 1.0)
|
google-cloud-errors (~> 1.0)
|
||||||
google-cloud-env (1.6.0)
|
google-cloud-env (2.2.2)
|
||||||
faraday (>= 0.17.3, < 3.0)
|
base64 (~> 0.2)
|
||||||
google-cloud-errors (1.3.1)
|
faraday (>= 1.0, < 3.a)
|
||||||
google-cloud-storage (1.45.0)
|
google-cloud-errors (1.7.0)
|
||||||
|
google-cloud-storage (1.62.0)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
digest-crc (~> 0.4)
|
digest-crc (~> 0.4)
|
||||||
google-apis-iamcredentials_v1 (~> 0.1)
|
google-apis-core (>= 0.18, < 2)
|
||||||
google-apis-storage_v1 (~> 0.29.0)
|
google-apis-iamcredentials_v1 (~> 0.18)
|
||||||
|
google-apis-storage_v1 (>= 0.42)
|
||||||
google-cloud-core (~> 1.6)
|
google-cloud-core (~> 1.6)
|
||||||
googleauth (>= 0.16.2, < 2.a)
|
googleauth (~> 1.9)
|
||||||
mini_mime (~> 1.0)
|
mini_mime (~> 1.0)
|
||||||
googleauth (1.8.1)
|
google-logging-utils (0.2.0)
|
||||||
faraday (>= 0.17.3, < 3.a)
|
googleauth (1.17.2)
|
||||||
jwt (>= 1.4, < 3.0)
|
faraday (>= 1.0, < 3.a)
|
||||||
multi_json (~> 1.11)
|
google-cloud-env (~> 2.2)
|
||||||
|
google-logging-utils (~> 0.1)
|
||||||
|
jwt (>= 1.4, < 4.0)
|
||||||
os (>= 0.9, < 2.0)
|
os (>= 0.9, < 2.0)
|
||||||
|
pstore (~> 0.1)
|
||||||
signet (>= 0.16, < 2.a)
|
signet (>= 0.16, < 2.a)
|
||||||
highline (2.0.3)
|
highline (2.0.3)
|
||||||
http-cookie (1.0.8)
|
http-cookie (1.0.8)
|
||||||
@@ -162,22 +173,24 @@ GEM
|
|||||||
httpclient (2.9.0)
|
httpclient (2.9.0)
|
||||||
mutex_m
|
mutex_m
|
||||||
jmespath (1.6.2)
|
jmespath (1.6.2)
|
||||||
json (2.7.6)
|
json (2.21.1)
|
||||||
jwt (2.10.3)
|
jwt (3.2.0)
|
||||||
base64
|
base64
|
||||||
logger (1.7.0)
|
logger (1.7.0)
|
||||||
mini_magick (4.13.2)
|
mini_magick (4.13.2)
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
multi_json (1.15.0)
|
multi_json (1.21.1)
|
||||||
multipart-post (2.4.1)
|
multipart-post (2.4.1)
|
||||||
mutex_m (0.3.0)
|
mutex_m (0.3.0)
|
||||||
nanaimo (0.4.0)
|
nanaimo (0.4.0)
|
||||||
naturally (2.3.0)
|
naturally (2.3.0)
|
||||||
nkf (0.2.0)
|
nkf (0.3.0)
|
||||||
optparse (0.8.1)
|
optparse (0.8.1)
|
||||||
os (1.1.4)
|
os (1.1.4)
|
||||||
|
ostruct (0.6.3)
|
||||||
plist (3.7.2)
|
plist (3.7.2)
|
||||||
public_suffix (5.1.1)
|
pstore (0.2.1)
|
||||||
|
public_suffix (7.0.5)
|
||||||
rake (13.4.2)
|
rake (13.4.2)
|
||||||
representable (3.2.0)
|
representable (3.2.0)
|
||||||
declarative (< 0.1.0)
|
declarative (< 0.1.0)
|
||||||
@@ -189,11 +202,10 @@ GEM
|
|||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
rubyzip (2.4.1)
|
rubyzip (2.4.1)
|
||||||
security (0.1.5)
|
security (0.1.5)
|
||||||
signet (0.18.0)
|
signet (0.22.0)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
faraday (>= 0.17.5, < 3.a)
|
faraday (>= 0.17.5, < 3.a)
|
||||||
jwt (>= 1.5, < 3.0)
|
jwt (>= 1.5, < 4.0)
|
||||||
multi_json (~> 1.10)
|
|
||||||
simctl (1.6.10)
|
simctl (1.6.10)
|
||||||
CFPropertyList
|
CFPropertyList
|
||||||
naturally
|
naturally
|
||||||
@@ -206,15 +218,16 @@ GEM
|
|||||||
tty-spinner (0.9.3)
|
tty-spinner (0.9.3)
|
||||||
tty-cursor (~> 0.7)
|
tty-cursor (~> 0.7)
|
||||||
uber (0.1.0)
|
uber (0.1.0)
|
||||||
unf (0.2.0)
|
|
||||||
unicode-display_width (2.6.0)
|
unicode-display_width (2.6.0)
|
||||||
word_wrap (1.0.0)
|
word_wrap (1.0.0)
|
||||||
xcodeproj (1.27.0)
|
xcodeproj (1.28.1)
|
||||||
CFPropertyList (>= 2.3.3, < 4.0)
|
CFPropertyList (>= 2.3.3, < 4.0)
|
||||||
atomos (~> 0.1.3)
|
atomos (~> 0.1.3)
|
||||||
|
base64
|
||||||
claide (>= 1.0.2, < 2.0)
|
claide (>= 1.0.2, < 2.0)
|
||||||
colored2 (~> 3.1)
|
colored2 (~> 3.1)
|
||||||
nanaimo (~> 0.4.0)
|
nanaimo (~> 0.4.0)
|
||||||
|
nkf
|
||||||
rexml (>= 3.3.6, < 4.0)
|
rexml (>= 3.3.6, < 4.0)
|
||||||
xcpretty (0.4.1)
|
xcpretty (0.4.1)
|
||||||
rouge (~> 3.28.0)
|
rouge (~> 3.28.0)
|
||||||
@@ -225,7 +238,7 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
fastlane
|
fastlane (= 2.237.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.5.23
|
2.5.23
|
||||||
|
|||||||
2
ios/fastlane/Appfile
Normal file
2
ios/fastlane/Appfile
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
app_identifier("net.buzzert.sybil2")
|
||||||
|
team_id("DQQH5H6GBD")
|
||||||
@@ -1,164 +1,47 @@
|
|||||||
require "shellwords"
|
|
||||||
|
|
||||||
default_platform(:ios)
|
default_platform(:ios)
|
||||||
|
|
||||||
APP_IDENTIFIER = "net.buzzert.sybil2"
|
|
||||||
SCHEME = "Sybil"
|
|
||||||
TEAM_ID = "DQQH5H6GBD"
|
|
||||||
PROFILE_NAME = "Sybil AppStore CI"
|
|
||||||
CI_KEYCHAIN_NAME = "sybil_ci_keychain"
|
|
||||||
CI_KEYCHAIN_PASSWORD = "sybil-ci-keychain-password"
|
|
||||||
CI_KEYCHAIN_DB_PATH = File.expand_path("~/Library/Keychains/#{CI_KEYCHAIN_NAME}-db")
|
|
||||||
IOS_ROOT = File.expand_path("..", __dir__)
|
|
||||||
PROJECT_FILE = File.join(IOS_ROOT, "Sybil.xcodeproj")
|
|
||||||
PROJECT_SPEC = File.join(IOS_ROOT, "project.yml")
|
|
||||||
APP_PROJECT_SPEC = File.join(IOS_ROOT, "Apps/Sybil/project.yml")
|
|
||||||
|
|
||||||
def present?(value)
|
|
||||||
!value.to_s.strip.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
def ci?
|
|
||||||
present?(ENV["CI"])
|
|
||||||
end
|
|
||||||
|
|
||||||
def release_version
|
|
||||||
tag = ENV["SYBIL_VERSION_TAG"]
|
|
||||||
tag = ENV["GITHUB_REF_NAME"] if !present?(tag)
|
|
||||||
tag = ENV["GITHUB_REF"].to_s.sub(%r{\Arefs/tags/}, "") if !present?(tag)
|
|
||||||
tag = sh("git describe --tags --abbrev=0").strip if !present?(tag)
|
|
||||||
match = tag.to_s.match(%r{\Arelease/ios/v(\d+\.\d+\.\d+)\z})
|
|
||||||
|
|
||||||
unless match
|
|
||||||
UI.user_error!("Release tag must look like release/ios/v1.2.3; got #{tag.inspect}")
|
|
||||||
end
|
|
||||||
|
|
||||||
match[1]
|
|
||||||
end
|
|
||||||
|
|
||||||
# App Store Connect requires CFBundleVersion to be unique and strictly
|
|
||||||
# increasing app-wide (not just per marketing version), so we derive it from
|
|
||||||
# the monotonic CI run number rather than querying TestFlight (that query can
|
|
||||||
# lag behind builds still processing and hand back a colliding value).
|
|
||||||
def build_number
|
|
||||||
value = present?(ENV["SYBIL_BUILD_NUMBER"]) ? ENV["SYBIL_BUILD_NUMBER"] : ENV["GITHUB_RUN_NUMBER"]
|
|
||||||
|
|
||||||
unless value.to_s.match?(/\A\d+\z/)
|
|
||||||
UI.user_error!("Build number must come from SYBIL_BUILD_NUMBER/GITHUB_RUN_NUMBER; got #{value.inspect}")
|
|
||||||
end
|
|
||||||
|
|
||||||
value.to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
def stamp_marketing_version(version)
|
|
||||||
contents = File.read(APP_PROJECT_SPEC)
|
|
||||||
updated = contents.sub(/^(\s*MARKETING_VERSION:\s*).*/, "\\1\"#{version}\"")
|
|
||||||
|
|
||||||
if updated == contents
|
|
||||||
UI.user_error!("Could not find MARKETING_VERSION in #{APP_PROJECT_SPEC}")
|
|
||||||
end
|
|
||||||
|
|
||||||
File.write(APP_PROJECT_SPEC, updated)
|
|
||||||
end
|
|
||||||
|
|
||||||
platform :ios do
|
platform :ios do
|
||||||
private_lane :app_store_api_key do
|
desc "Build a release tag and upload it to TestFlight"
|
||||||
app_store_connect_api_key(
|
lane :beta do
|
||||||
key_id: ENV.fetch("APP_STORE_CONNECT_KEY_ID"),
|
setup_ci
|
||||||
issuer_id: ENV.fetch("APP_STORE_CONNECT_ISSUER_ID"),
|
|
||||||
key_content: ENV.fetch("APP_STORE_CONNECT_KEY_CONTENT"),
|
match(type: "appstore")
|
||||||
|
|
||||||
|
tag = ENV.fetch("GITHUB_REF_NAME")
|
||||||
|
version = tag[%r{\Arelease/ios/v(\d+\.\d+\.\d+)\z}, 1]
|
||||||
|
UI.user_error!("Expected a tag in the form release/ios/vX.Y.Z; got #{tag.inspect}") unless version
|
||||||
|
|
||||||
|
build_number = ENV.fetch("GITHUB_RUN_NUMBER")
|
||||||
|
UI.user_error!("GITHUB_RUN_NUMBER must be a positive integer") unless build_number.match?(/\A[1-9]\d*\z/)
|
||||||
|
|
||||||
|
ios_dir = File.expand_path("..", __dir__)
|
||||||
|
project_spec = File.join(ios_dir, "Apps/Sybil/project.yml")
|
||||||
|
contents = File.read(project_spec)
|
||||||
|
unless contents.match?(/^\s*MARKETING_VERSION:/) && contents.match?(/^\s*CURRENT_PROJECT_VERSION:/)
|
||||||
|
UI.user_error!("Could not find version settings in #{project_spec}")
|
||||||
|
end
|
||||||
|
contents.sub!(/^(\s*MARKETING_VERSION:\s*).*/, "\\1\"#{version}\"")
|
||||||
|
contents.sub!(/^(\s*CURRENT_PROJECT_VERSION:\s*).*/, "\\1#{build_number}")
|
||||||
|
File.write(project_spec, contents)
|
||||||
|
|
||||||
|
sh("xcodegen", "--spec", File.join(ios_dir, "project.yml"))
|
||||||
|
|
||||||
|
api_key = app_store_connect_api_key(
|
||||||
|
key_id: ENV.fetch("ASC_KEY_ID"),
|
||||||
|
issuer_id: ENV.fetch("ASC_ISSUER_ID"),
|
||||||
|
key_content: ENV.fetch("ASC_KEY"),
|
||||||
is_key_content_base64: true
|
is_key_content_base64: true
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
# CI signs headlessly, so match needs a fresh unlocked keychain to import
|
|
||||||
# into. codesign resolves identities through the user keychain *search list*
|
|
||||||
# (first match wins; the --keychain flag does not restrict the lookup), and
|
|
||||||
# other projects' keychains on this runner hold the same identity but are
|
|
||||||
# usually locked — so ours must come first. delete_keychain in the beta
|
|
||||||
# lane's ensure removes both the keychain and its search-list entry, which
|
|
||||||
# also keeps our (later locked) copy from shadowing those other projects.
|
|
||||||
private_lane :prepare_ci_keychain do
|
|
||||||
next unless ci?
|
|
||||||
|
|
||||||
delete_keychain(name: CI_KEYCHAIN_NAME) if File.file?(CI_KEYCHAIN_DB_PATH)
|
|
||||||
create_keychain(
|
|
||||||
name: CI_KEYCHAIN_NAME,
|
|
||||||
password: CI_KEYCHAIN_PASSWORD,
|
|
||||||
unlock: true,
|
|
||||||
timeout: 3600,
|
|
||||||
add_to_search_list: false
|
|
||||||
)
|
|
||||||
|
|
||||||
others = sh("security list-keychains -d user", log: false)
|
|
||||||
.scan(/"([^"]+)"/)
|
|
||||||
.flatten
|
|
||||||
.reject { |path| path.include?(CI_KEYCHAIN_NAME) }
|
|
||||||
sh("security list-keychains -d user -s #{([CI_KEYCHAIN_DB_PATH] + others).shelljoin}")
|
|
||||||
|
|
||||||
ENV["MATCH_KEYCHAIN_NAME"] = CI_KEYCHAIN_NAME
|
|
||||||
ENV["MATCH_KEYCHAIN_PASSWORD"] = CI_KEYCHAIN_PASSWORD
|
|
||||||
end
|
|
||||||
|
|
||||||
private_lane :sync_signing do |options|
|
|
||||||
match(
|
|
||||||
type: "appstore",
|
|
||||||
readonly: options.fetch(:readonly),
|
|
||||||
app_identifier: APP_IDENTIFIER,
|
|
||||||
team_id: TEAM_ID,
|
|
||||||
profile_name: PROFILE_NAME,
|
|
||||||
git_url: ENV.fetch("MATCH_GIT_URL"),
|
|
||||||
git_branch: "master",
|
|
||||||
git_full_name: "Sybil Release Bot",
|
|
||||||
git_user_email: "james.magahern@me.com",
|
|
||||||
api_key: options.fetch(:api_key)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Create or update match signing assets"
|
|
||||||
lane :setup_signing do
|
|
||||||
sync_signing(api_key: app_store_api_key, readonly: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Build and upload to TestFlight"
|
|
||||||
lane :beta do
|
|
||||||
prepare_ci_keychain
|
|
||||||
|
|
||||||
api_key = app_store_api_key
|
|
||||||
|
|
||||||
version = release_version
|
|
||||||
stamp_marketing_version(version)
|
|
||||||
sh("xcodegen", "--spec", PROJECT_SPEC)
|
|
||||||
|
|
||||||
increment_version_number(version_number: version, xcodeproj: PROJECT_FILE)
|
|
||||||
increment_build_number(build_number: build_number, xcodeproj: PROJECT_FILE)
|
|
||||||
|
|
||||||
sync_signing(api_key: api_key, readonly: true)
|
|
||||||
|
|
||||||
build_app(
|
build_app(
|
||||||
project: PROJECT_FILE,
|
project: File.join(ios_dir, "Sybil.xcodeproj"),
|
||||||
scheme: SCHEME,
|
scheme: "Sybil"
|
||||||
export_method: "app-store",
|
|
||||||
xcargs: [
|
|
||||||
"DEVELOPMENT_TEAM=#{TEAM_ID.shellescape}",
|
|
||||||
"CODE_SIGN_STYLE=Manual",
|
|
||||||
"CODE_SIGN_IDENTITY=Apple\\ Distribution",
|
|
||||||
"PROVISIONING_PROFILE_SPECIFIER=#{PROFILE_NAME.shellescape}"
|
|
||||||
].join(" "),
|
|
||||||
export_options: {
|
|
||||||
signingStyle: "manual",
|
|
||||||
teamID: TEAM_ID,
|
|
||||||
provisioningProfiles: {
|
|
||||||
APP_IDENTIFIER => PROFILE_NAME
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
upload_to_testflight(
|
upload_to_testflight(
|
||||||
api_key: api_key,
|
api_key: api_key,
|
||||||
skip_waiting_for_build_processing: true
|
skip_waiting_for_build_processing: true,
|
||||||
|
uses_non_exempt_encryption: false
|
||||||
)
|
)
|
||||||
ensure
|
|
||||||
delete_keychain(name: CI_KEYCHAIN_NAME) if ci? && File.file?(CI_KEYCHAIN_DB_PATH)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
7
ios/fastlane/Matchfile
Normal file
7
ios/fastlane/Matchfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
git_url("https://code.buzzert.dev/buzzert/fastlane-match.git")
|
||||||
|
storage_mode("git")
|
||||||
|
type("appstore")
|
||||||
|
|
||||||
|
app_identifier(["net.buzzert.sybil2"])
|
||||||
|
team_id("DQQH5H6GBD")
|
||||||
|
profile_name("Sybil AppStore CI")
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
|
"test": "node --test --experimental-strip-types tests/*.test.mjs",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -63,9 +63,16 @@ import {
|
|||||||
type WorkspaceItem,
|
type WorkspaceItem,
|
||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { useSessionAuth } from "@/hooks/use-session-auth";
|
import { useSessionAuth } from "@/hooks/use-session-auth";
|
||||||
|
import {
|
||||||
|
getChatModelSelection,
|
||||||
|
getChatModelSelectionSyncKey,
|
||||||
|
} from "@/lib/chat-model-selection";
|
||||||
|
import {
|
||||||
|
resolveSidebarSelectionAfterRefresh,
|
||||||
|
type SidebarSelection,
|
||||||
|
} from "@/lib/sidebar-selection";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
type SidebarSelection = { kind: "chat" | "search"; id: string };
|
|
||||||
type DraftSelectionKind = "chat" | "search";
|
type DraftSelectionKind = "chat" | "search";
|
||||||
type SidebarItem = SidebarSelection & {
|
type SidebarItem = SidebarSelection & {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -94,7 +101,7 @@ type ActiveRunsState = {
|
|||||||
searches: Record<string, true>;
|
searches: Record<string, true>;
|
||||||
};
|
};
|
||||||
type RefreshCollectionsOptions = {
|
type RefreshCollectionsOptions = {
|
||||||
preferredSelection?: SidebarSelection;
|
initialSelection?: SidebarSelection;
|
||||||
reportTransientError?: boolean;
|
reportTransientError?: boolean;
|
||||||
selectFallback?: boolean;
|
selectFallback?: boolean;
|
||||||
};
|
};
|
||||||
@@ -542,14 +549,6 @@ function normalizeEnabledTools(value: unknown, availableTools: ChatToolInfo[]) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChatModelSelection(chat: Pick<ChatSummary, "lastUsedProvider" | "lastUsedModel"> | Pick<ChatDetail, "lastUsedProvider" | "lastUsedModel"> | null) {
|
|
||||||
if (!chat?.lastUsedProvider || !chat.lastUsedModel?.trim()) return null;
|
|
||||||
return {
|
|
||||||
provider: chat.lastUsedProvider,
|
|
||||||
model: chat.lastUsedModel.trim(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
type ToolLogMetadata = {
|
type ToolLogMetadata = {
|
||||||
kind: "tool_call";
|
kind: "tool_call";
|
||||||
toolCallId?: string;
|
toolCallId?: string;
|
||||||
@@ -1131,7 +1130,7 @@ export default function App() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const refreshCollections = async ({
|
const refreshCollections = async ({
|
||||||
preferredSelection,
|
initialSelection,
|
||||||
reportTransientError = true,
|
reportTransientError = true,
|
||||||
selectFallback = false,
|
selectFallback = false,
|
||||||
}: RefreshCollectionsOptions = {}) => {
|
}: RefreshCollectionsOptions = {}) => {
|
||||||
@@ -1143,24 +1142,12 @@ export default function App() {
|
|||||||
setChats(nextChats);
|
setChats(nextChats);
|
||||||
setSearches(nextSearches);
|
setSearches(nextSearches);
|
||||||
|
|
||||||
setSelectedItem((current) => {
|
setSelectedItem((current) =>
|
||||||
const hasItem = (candidate: SidebarSelection | null) => {
|
resolveSidebarSelectionAfterRefresh(current, nextWorkspaceItems, {
|
||||||
if (!candidate) return false;
|
initialSelection,
|
||||||
return nextWorkspaceItems.some((item) => item.type === candidate.kind && item.id === candidate.id);
|
selectFallback,
|
||||||
};
|
})
|
||||||
|
);
|
||||||
if (preferredSelection && hasItem(preferredSelection)) {
|
|
||||||
return preferredSelection;
|
|
||||||
}
|
|
||||||
if (hasItem(current)) {
|
|
||||||
return current;
|
|
||||||
}
|
|
||||||
if (!selectFallback) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const first = nextWorkspaceItems[0];
|
|
||||||
return first ? { kind: first.type, id: first.id } : null;
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err instanceof Error ? err.message : String(err);
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
if (message.includes("bearer token")) {
|
if (message.includes("bearer token")) {
|
||||||
@@ -1252,10 +1239,10 @@ export default function App() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isAuthenticated) return;
|
if (!isAuthenticated) return;
|
||||||
const preferredSelection = initialRouteSelectionRef.current;
|
const initialSelection = initialRouteSelectionRef.current;
|
||||||
initialRouteSelectionRef.current = null;
|
initialRouteSelectionRef.current = null;
|
||||||
void Promise.all([
|
void Promise.all([
|
||||||
refreshCollections({ preferredSelection: preferredSelection ?? undefined, selectFallback: true }),
|
refreshCollections({ initialSelection: initialSelection ?? undefined, selectFallback: true }),
|
||||||
refreshModels(),
|
refreshModels(),
|
||||||
refreshChatTools(),
|
refreshChatTools(),
|
||||||
refreshActiveRuns(),
|
refreshActiveRuns(),
|
||||||
@@ -1571,15 +1558,32 @@ export default function App() {
|
|||||||
return searches.find((search) => search.id === selectedItem.id) ?? null;
|
return searches.find((search) => search.id === selectedItem.id) ?? null;
|
||||||
}, [searches, selectedItem]);
|
}, [searches, selectedItem]);
|
||||||
|
|
||||||
useEffect(() => {
|
const selectedChatModelSelection = useMemo(() => {
|
||||||
if (draftKind || selectedItem?.kind !== "chat") return;
|
if (draftKind || selectedItem?.kind !== "chat") return null;
|
||||||
const detailSelection = selectedChat?.id === selectedItem.id ? getChatModelSelection(selectedChat) : null;
|
const detailSelection = selectedChat?.id === selectedItem.id ? getChatModelSelection(selectedChat) : null;
|
||||||
const summarySelection = getChatModelSelection(selectedChatSummary);
|
const summarySelection = getChatModelSelection(selectedChatSummary);
|
||||||
const nextSelection = detailSelection ?? summarySelection;
|
return detailSelection ?? summarySelection;
|
||||||
if (!nextSelection) return;
|
}, [
|
||||||
setProvider(nextSelection.provider);
|
draftKind,
|
||||||
setModel(nextSelection.model);
|
selectedChat?.id,
|
||||||
}, [draftKind, selectedChat, selectedChatSummary, selectedItem]);
|
selectedChat?.lastUsedModel,
|
||||||
|
selectedChat?.lastUsedProvider,
|
||||||
|
selectedChatSummary?.id,
|
||||||
|
selectedChatSummary?.lastUsedModel,
|
||||||
|
selectedChatSummary?.lastUsedProvider,
|
||||||
|
selectedItem?.id,
|
||||||
|
selectedItem?.kind,
|
||||||
|
]);
|
||||||
|
const selectedChatModelSelectionSyncKey = getChatModelSelectionSyncKey(
|
||||||
|
selectedItem?.kind === "chat" ? selectedItem.id : null,
|
||||||
|
selectedChatModelSelection
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!selectedChatModelSelection) return;
|
||||||
|
setProvider(selectedChatModelSelection.provider);
|
||||||
|
setModel(selectedChatModelSelection.model);
|
||||||
|
}, [selectedChatModelSelectionSyncKey]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (draftKind === "chat") return;
|
if (draftKind === "chat") return;
|
||||||
@@ -2480,7 +2484,7 @@ export default function App() {
|
|||||||
|
|
||||||
backgroundSuspendedChatStreamsRef.current.delete(chatId);
|
backgroundSuspendedChatStreamsRef.current.delete(chatId);
|
||||||
const persistedChat = await retryAfterAppResume(() => getChat(chatId));
|
const persistedChat = await retryAfterAppResume(() => getChat(chatId));
|
||||||
await refreshCollections({ preferredSelection: target, reportTransientError: false });
|
await refreshCollections({ reportTransientError: false });
|
||||||
if (isCurrentSelection(target)) {
|
if (isCurrentSelection(target)) {
|
||||||
setSelectedChat(persistedChat);
|
setSelectedChat(persistedChat);
|
||||||
setSelectedSearch(null);
|
setSelectedSearch(null);
|
||||||
@@ -2694,7 +2698,7 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await refreshCollections({ preferredSelection: target });
|
await refreshCollections();
|
||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2813,7 +2817,7 @@ export default function App() {
|
|||||||
setSelectedChat(persistedChat);
|
setSelectedChat(persistedChat);
|
||||||
setSelectedSearch(null);
|
setSelectedSearch(null);
|
||||||
}
|
}
|
||||||
void refreshCollections({ preferredSelection: target });
|
void refreshCollections();
|
||||||
return;
|
return;
|
||||||
} catch (resumeError) {
|
} catch (resumeError) {
|
||||||
err = resumeError;
|
err = resumeError;
|
||||||
@@ -2919,7 +2923,7 @@ export default function App() {
|
|||||||
{ signal: abortController.signal }
|
{ signal: abortController.signal }
|
||||||
);
|
);
|
||||||
|
|
||||||
await refreshCollections({ preferredSelection: target });
|
await refreshCollections();
|
||||||
if (isCurrentSelection(target)) {
|
if (isCurrentSelection(target)) {
|
||||||
await refreshSearch(searchId);
|
await refreshSearch(searchId);
|
||||||
}
|
}
|
||||||
@@ -2987,7 +2991,7 @@ export default function App() {
|
|||||||
messages: [],
|
messages: [],
|
||||||
});
|
});
|
||||||
setSelectedSearch(null);
|
setSelectedSearch(null);
|
||||||
await refreshCollections({ preferredSelection: { kind: "chat", id: chat.id } });
|
await refreshCollections();
|
||||||
await refreshChat(chat.id);
|
await refreshChat(chat.id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err instanceof Error ? err.message : String(err);
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
@@ -3149,7 +3153,7 @@ export default function App() {
|
|||||||
messages: [],
|
messages: [],
|
||||||
});
|
});
|
||||||
setSelectedSearch(null);
|
setSelectedSearch(null);
|
||||||
await refreshCollections({ preferredSelection: { kind: "chat", id: chat.id } });
|
await refreshCollections();
|
||||||
await refreshChat(chat.id);
|
await refreshChat(chat.id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err instanceof Error ? err.message : String(err);
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
|
|||||||
24
web/src/lib/chat-model-selection.ts
Normal file
24
web/src/lib/chat-model-selection.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import type { Provider } from "./api";
|
||||||
|
|
||||||
|
type PersistedChatModel = {
|
||||||
|
lastUsedProvider: Provider | null;
|
||||||
|
lastUsedModel: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatModelSelection = {
|
||||||
|
provider: Provider;
|
||||||
|
model: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getChatModelSelection(chat: PersistedChatModel | null): ChatModelSelection | null {
|
||||||
|
if (!chat?.lastUsedProvider || !chat.lastUsedModel?.trim()) return null;
|
||||||
|
return {
|
||||||
|
provider: chat.lastUsedProvider,
|
||||||
|
model: chat.lastUsedModel.trim(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getChatModelSelectionSyncKey(chatId: string | null, selection: ChatModelSelection | null) {
|
||||||
|
if (!chatId || !selection) return null;
|
||||||
|
return JSON.stringify([chatId, selection.provider, selection.model]);
|
||||||
|
}
|
||||||
31
web/src/lib/sidebar-selection.ts
Normal file
31
web/src/lib/sidebar-selection.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
export type SidebarSelection = { kind: "chat" | "search"; id: string };
|
||||||
|
|
||||||
|
type WorkspaceSelectionItem = { type: SidebarSelection["kind"]; id: string };
|
||||||
|
|
||||||
|
type ResolveSidebarSelectionOptions = {
|
||||||
|
initialSelection?: SidebarSelection;
|
||||||
|
selectFallback?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function resolveSidebarSelectionAfterRefresh(
|
||||||
|
current: SidebarSelection | null,
|
||||||
|
workspaceItems: WorkspaceSelectionItem[],
|
||||||
|
{ initialSelection, selectFallback = false }: ResolveSidebarSelectionOptions = {}
|
||||||
|
): SidebarSelection | null {
|
||||||
|
const hasItem = (candidate: SidebarSelection | null | undefined) => {
|
||||||
|
if (!candidate) return false;
|
||||||
|
return workspaceItems.some((item) => item.type === candidate.kind && item.id === candidate.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (hasItem(current)) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
if (hasItem(initialSelection)) {
|
||||||
|
return initialSelection ?? null;
|
||||||
|
}
|
||||||
|
if (!selectFallback) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const first = workspaceItems[0];
|
||||||
|
return first ? { kind: first.type, id: first.id } : null;
|
||||||
|
}
|
||||||
49
web/tests/chat-model-selection.test.mjs
Normal file
49
web/tests/chat-model-selection.test.mjs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import {
|
||||||
|
getChatModelSelection,
|
||||||
|
getChatModelSelectionSyncKey,
|
||||||
|
} from "../src/lib/chat-model-selection.ts";
|
||||||
|
|
||||||
|
test("chat model selections are normalized from persisted metadata", () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
getChatModelSelection({
|
||||||
|
lastUsedProvider: "anthropic",
|
||||||
|
lastUsedModel: " claude-sonnet-4-5 ",
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
provider: "anthropic",
|
||||||
|
model: "claude-sonnet-4-5",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("unrelated chat updates do not change the model synchronization key", () => {
|
||||||
|
const beforeSettingsSave = getChatModelSelection({
|
||||||
|
lastUsedProvider: "openai",
|
||||||
|
lastUsedModel: "gpt-4.1-mini",
|
||||||
|
});
|
||||||
|
const afterSettingsSave = getChatModelSelection({
|
||||||
|
lastUsedProvider: "openai",
|
||||||
|
lastUsedModel: "gpt-4.1-mini",
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
getChatModelSelectionSyncKey("chat-1", beforeSettingsSave),
|
||||||
|
getChatModelSelectionSyncKey("chat-1", afterSettingsSave)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("switching chats or persisted models changes the synchronization key", () => {
|
||||||
|
const original = { provider: "openai", model: "gpt-4.1-mini" };
|
||||||
|
const updated = { provider: "gemini", model: "gemini-3.5-flash" };
|
||||||
|
|
||||||
|
assert.notEqual(
|
||||||
|
getChatModelSelectionSyncKey("chat-1", original),
|
||||||
|
getChatModelSelectionSyncKey("chat-2", original)
|
||||||
|
);
|
||||||
|
assert.notEqual(
|
||||||
|
getChatModelSelectionSyncKey("chat-1", original),
|
||||||
|
getChatModelSelectionSyncKey("chat-1", updated)
|
||||||
|
);
|
||||||
|
});
|
||||||
45
web/tests/sidebar-selection.test.mjs
Normal file
45
web/tests/sidebar-selection.test.mjs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { resolveSidebarSelectionAfterRefresh } from "../src/lib/sidebar-selection.ts";
|
||||||
|
|
||||||
|
const workspaceItems = [
|
||||||
|
{ type: "chat", id: "completed-chat" },
|
||||||
|
{ type: "chat", id: "selected-chat" },
|
||||||
|
{ type: "search", id: "selected-search" },
|
||||||
|
];
|
||||||
|
|
||||||
|
test("a collection refresh preserves the current thread selection", () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
resolveSidebarSelectionAfterRefresh({ kind: "chat", id: "selected-chat" }, workspaceItems),
|
||||||
|
{ kind: "chat", id: "selected-chat" }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("an initial route selection cannot override a current thread selection", () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
resolveSidebarSelectionAfterRefresh(
|
||||||
|
{ kind: "search", id: "selected-search" },
|
||||||
|
workspaceItems,
|
||||||
|
{ initialSelection: { kind: "chat", id: "completed-chat" }, selectFallback: true }
|
||||||
|
),
|
||||||
|
{ kind: "search", id: "selected-search" }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a collection refresh preserves an intentionally empty selection", () => {
|
||||||
|
assert.equal(resolveSidebarSelectionAfterRefresh(null, workspaceItems), null);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("initial load can select the URL thread or fall back to the first item", () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
resolveSidebarSelectionAfterRefresh(null, workspaceItems, {
|
||||||
|
initialSelection: { kind: "search", id: "selected-search" },
|
||||||
|
selectFallback: true,
|
||||||
|
}),
|
||||||
|
{ kind: "search", id: "selected-search" }
|
||||||
|
);
|
||||||
|
assert.deepEqual(resolveSidebarSelectionAfterRefresh(null, workspaceItems, { selectFallback: true }), {
|
||||||
|
kind: "chat",
|
||||||
|
id: "completed-chat",
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1 +1 @@
|
|||||||
{"root":["./src/App.tsx","./src/main.tsx","./src/pwa.ts","./src/root-router.tsx","./src/vite-env.d.ts","./src/components/sybil-character.tsx","./src/components/auth/auth-screen.tsx","./src/components/chat/chat-attachment-list.tsx","./src/components/chat/chat-messages-panel.tsx","./src/components/markdown/markdown-content.tsx","./src/components/search/search-results-panel.tsx","./src/components/ui/button.tsx","./src/components/ui/input.tsx","./src/components/ui/scroll-area.tsx","./src/components/ui/separator.tsx","./src/components/ui/textarea.tsx","./src/hooks/use-session-auth.ts","./src/lib/api.ts","./src/lib/utils.ts","./src/pages/search-route-page.tsx"],"version":"5.9.3"}
|
{"root":["./src/App.tsx","./src/main.tsx","./src/pwa.ts","./src/root-router.tsx","./src/vite-env.d.ts","./src/components/sybil-character.tsx","./src/components/auth/auth-screen.tsx","./src/components/chat/chat-attachment-list.tsx","./src/components/chat/chat-messages-panel.tsx","./src/components/markdown/markdown-content.tsx","./src/components/search/search-results-panel.tsx","./src/components/ui/button.tsx","./src/components/ui/input.tsx","./src/components/ui/scroll-area.tsx","./src/components/ui/separator.tsx","./src/components/ui/textarea.tsx","./src/hooks/use-session-auth.ts","./src/lib/api.ts","./src/lib/chat-model-selection.ts","./src/lib/sidebar-selection.ts","./src/lib/utils.ts","./src/pages/search-route-page.tsx"],"version":"5.9.3"}
|
||||||
Reference in New Issue
Block a user