From 23f55418557be986073c5255a79ebcdb9495c95b Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 19 Aug 2025 15:21:58 -0600 Subject: [PATCH 1/5] Add deploy workflow to main branch --- .github/workflows/deploy.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..afc165040 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Deploy to Porter + +on: + workflow_run: + workflows: ["Build and Push Server Docker Image"] + types: + - completed + branches: [main, staging] + +jobs: + deploy: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: blacksmith-2vcpu-ubuntu-2404 + environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || 'staging' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + + - name: Setup porter + uses: porter-dev/setup-porter@v0.1.0 + + - name: Update Porter app tag + run: | + if [[ "${{ github.event.workflow_run.head_branch }}" == "main" ]]; then + porter app update-tag ${{ vars.PORTER_APP_NAME }} --tag main + else + porter app update-tag ${{ vars.PORTER_APP_NAME }} --tag staging + fi + env: + PORTER_TOKEN: ${{ secrets.PORTER_TOKEN }} + PORTER_HOST: https://dashboard.porter.run + PORTER_PROJECT: ${{ vars.PORTER_PROJECT }} + PORTER_CLUSTER: ${{ vars.PORTER_CLUSTER }} \ No newline at end of file From f2dbbb56f63ea96bf2fb7080746355c063abc010 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 19 Aug 2025 15:30:50 -0600 Subject: [PATCH 2/5] feat: promote GitHub workflow improvements from staging to main - Update CI workflow with parallel jobs and Blacksmith runners - Improve database migration workflow with concurrency control - Add docker-build-server workflow - Update Porter deployment to use Blacksmith runners - Enhance Trigger.dev deployment with better caching --- .github/workflows/ci.yml | 142 +++++++++++---- .github/workflows/database-migrations.yml | 43 +++-- .github/workflows/docker-build-server.yml | 165 ++++++++++++++++++ .../porter_app_main-hono-server_3155.yml | 2 +- .github/workflows/trigger-deployment.yml | 43 +++-- 5 files changed, 325 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/docker-build-server.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 967c63411..45eac1318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,23 +3,23 @@ name: CI on: pull_request: +# Cancel in-progress runs when a new commit is pushed to the same PR +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: CI: true - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ vars.TURBO_TEAM }} - TURBO_REMOTE_ONLY: true jobs: - ci: - name: Build, Lint & Test + # Build job - runs in parallel + build: + name: Build runs-on: blacksmith-4vcpu-ubuntu-2404 - timeout-minutes: 30 - + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 2 - name: Install pnpm uses: pnpm/action-setup@v2 @@ -30,18 +30,19 @@ jobs: uses: useblacksmith/setup-node@v5 with: node-version: 22 - # Remove cache here since we're using stickydisk for pnpm store - - - name: Get pnpm store directory - shell: bash + cache: 'pnpm' + + - name: Fix pnpm store permissions run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Mount pnpm store sticky disk - uses: useblacksmith/stickydisk@v1 - with: - key: ${{ github.repository }}-pnpm-store - path: ${{ env.STORE_PATH }} + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + # Clear corrupted cache entries + find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true + find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true + # Fix permissions on remaining files + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi - name: Mount Turbo cache sticky disk uses: useblacksmith/stickydisk@v1 @@ -49,19 +50,6 @@ jobs: key: ${{ github.repository }}-turbo-cache path: ./.turbo - - name: Check if lockfile changed - id: lockfile-check - run: | - if git diff HEAD~1 HEAD --name-only | grep -q "pnpm-lock.yaml"; then - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "changed=false" >> $GITHUB_OUTPUT - fi - - - name: Fetch dependencies (if lockfile changed) - if: steps.lockfile-check.outputs.changed == 'true' - run: pnpm fetch --frozen-lockfile - - name: Install dependencies run: pnpm install --frozen-lockfile --prefer-offline @@ -70,9 +58,97 @@ jobs: env: NODE_ENV: production + # Lint job - runs in parallel + lint: + name: Lint + runs-on: blacksmith-2vcpu-ubuntu-2404 + timeout-minutes: 5 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.0 + + - name: Setup Node.js + uses: useblacksmith/setup-node@v5 + with: + node-version: 22 + cache: 'pnpm' + + - name: Fix pnpm store permissions + run: | + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + # Clear corrupted cache entries + find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true + find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true + # Fix permissions on remaining files + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi + + - name: Mount Turbo cache sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-turbo-cache + path: ./.turbo + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + - name: Lint all packages (excluding web) run: pnpm lint --filter='!@buster-app/web' + # Test job - runs after build completes + test: + name: Test + runs-on: blacksmith-4vcpu-ubuntu-2404 + timeout-minutes: 15 + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.0 + + - name: Setup Node.js + uses: useblacksmith/setup-node@v5 + with: + node-version: 22 + cache: 'pnpm' + + - name: Fix pnpm store permissions + run: | + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + # Clear corrupted cache entries + find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true + find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true + # Fix permissions on remaining files + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi + + - name: Mount Turbo cache sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-turbo-cache + path: ./.turbo + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + + - name: Build required packages + run: pnpm build --filter='!@buster-app/web' + env: + NODE_ENV: production + - name: Run all unit tests (excluding web) run: pnpm test:unit --filter='!@buster-app/web' diff --git a/.github/workflows/database-migrations.yml b/.github/workflows/database-migrations.yml index 2d5a29858..27bc63ef4 100644 --- a/.github/workflows/database-migrations.yml +++ b/.github/workflows/database-migrations.yml @@ -8,38 +8,45 @@ on: - 'packages/database/drizzle.config.ts' - '.github/workflows/database-migrations.yml' +# Only one migration per environment at a time +concurrency: + group: db-migrate-${{ github.ref }} + cancel-in-progress: false # Never cancel migrations + jobs: migrate: - runs-on: blacksmith-8vcpu-ubuntu-2204 + runs-on: blacksmith-2vcpu-ubuntu-2404 environment: ${{ github.ref_name }} steps: - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '22.x' - - name: Install pnpm uses: pnpm/action-setup@v2 with: version: 9.15.0 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v3 + - name: Setup Node.js + uses: useblacksmith/setup-node@v5 with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: 22 + cache: 'pnpm' + + - name: Fix pnpm store permissions + run: | + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi + + - name: Mount Turbo cache sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-turbo-cache + path: ./.turbo - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --prefer-offline - name: Run migrations run: pnpm run db:migrate diff --git a/.github/workflows/docker-build-server.yml b/.github/workflows/docker-build-server.yml new file mode 100644 index 000000000..d5d0e9937 --- /dev/null +++ b/.github/workflows/docker-build-server.yml @@ -0,0 +1,165 @@ +name: Build and Push Server Docker Image + +on: + push: + branches: [main, staging] + paths: + - 'apps/server/**' + - 'packages/**' + - 'pnpm-lock.yaml' + - '.github/workflows/docker-build-server.yml' + +# Only one build per branch at a time, queue others +concurrency: + group: docker-build-${{ github.ref }} + cancel-in-progress: false # Don't cancel, queue instead for deployments + +env: + REGISTRY: ghcr.io + IMAGE_NAME: buster-so/buster-server + +jobs: + build-and-push: + runs-on: blacksmith-8vcpu-ubuntu-2404 + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.0 + + - name: Setup Node.js + uses: useblacksmith/setup-node@v5 + with: + node-version: 22 + cache: 'pnpm' + + - name: Fix pnpm store permissions + run: | + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi + + - name: Install bun + run: npm install -g bun@1.2.15 + + - name: Mount Turbo cache sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-turbo-cache + path: ./.turbo + + - name: Mount Docker buildkit sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-buildkit-cache + path: /tmp/.buildkit-cache + + - name: Install dependencies + run: | + echo "๐Ÿ“ฆ Installing dependencies with pnpm..." + pnpm install --frozen-lockfile --prefer-offline + + - name: Build with Turbo + run: | + echo "๐Ÿ”จ Building server with Turbo (using sticky disk cache)..." + pnpm turbo run build --filter=@buster-app/server + echo "โœ… Build complete!" + env: + NODE_ENV: production + DOCKER_BUILD: true + CI: true + + - name: Build server bundle + run: | + echo "๐Ÿ“ฆ Creating server bundle with bun..." + cd apps/server + bun build src/index.ts --outdir ./dist --target bun --external pino-pretty + ls -la dist/ + cd ../.. + + - name: Prepare production dependencies + run: | + echo "๐Ÿงน Preparing production-only dependencies..." + # Create a temporary directory for production deps + mkdir -p /tmp/prod-deps/apps/server + cp package.json pnpm-lock.yaml pnpm-workspace.yaml /tmp/prod-deps/ + cp -r packages /tmp/prod-deps/ + cp apps/server/package.json /tmp/prod-deps/apps/server/ + + # Install production dependencies only + cd /tmp/prod-deps + pnpm install --frozen-lockfile --prod --ignore-scripts --no-optional + + # Copy back to workspace + cd - + mkdir -p docker-context + cp -r /tmp/prod-deps/node_modules docker-context/ + cp -r apps/server/dist docker-context/ + cp apps/server/package.json docker-context/ + + - name: Set up Docker Builder with Blacksmith cache + uses: useblacksmith/setup-docker-builder@v1 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata and determine tags + id: meta + run: | + SHA_SHORT=$(git rev-parse --short HEAD) + echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT + + if [[ "${{ github.ref_name }}" == "main" ]]; then + # For main: use commit SHA and latest + echo "tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${SHA_SHORT},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "staging" ]]; then + # For staging: use staging-SHA and staging + echo "tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-${SHA_SHORT},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging" >> $GITHUB_OUTPUT + fi + + # Set build timestamp + echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + uses: useblacksmith/build-push-action@v2 + with: + context: ./docker-context + file: ./apps/server/Dockerfile.prebuilt + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.created=${{ steps.meta.outputs.timestamp }} + org.opencontainers.image.ref.name=${{ github.ref_name }} + build-args: | + COMMIT_SHA=${{ steps.meta.outputs.sha_short }} + BUILD_DATE=${{ steps.meta.outputs.timestamp }} + + - name: Output image details + run: | + echo "โœ… Docker image built and pushed successfully!" + echo "๐Ÿ“ฆ Image tags:" + echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' | sed 's/^/ - /' + echo "" + echo "๐Ÿ”ง To use in Porter:" + if [[ "${{ github.ref_name }}" == "main" ]]; then + echo " Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.sha_short }}" + else + echo " Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-${{ steps.meta.outputs.sha_short }}" + fi \ No newline at end of file diff --git a/.github/workflows/porter_app_main-hono-server_3155.yml b/.github/workflows/porter_app_main-hono-server_3155.yml index 8f47772f1..1e3aa0e74 100644 --- a/.github/workflows/porter_app_main-hono-server_3155.yml +++ b/.github/workflows/porter_app_main-hono-server_3155.yml @@ -5,7 +5,7 @@ name: Deploy to main-hono-server jobs: porter-deploy: - runs-on: ubuntu-latest + runs-on: blacksmith-8vcpu-ubuntu-2204 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/trigger-deployment.yml b/.github/workflows/trigger-deployment.yml index 6ae4657ec..8d66bc9f3 100644 --- a/.github/workflows/trigger-deployment.yml +++ b/.github/workflows/trigger-deployment.yml @@ -4,39 +4,46 @@ on: push: branches: [main, staging] +# Only one deployment per environment at a time +concurrency: + group: trigger-deploy-${{ github.ref }} + cancel-in-progress: false # Never cancel deployments + jobs: deploy: - runs-on: blacksmith-8vcpu-ubuntu-2204 + runs-on: blacksmith-4vcpu-ubuntu-2404 environment: ${{ github.ref_name }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '22.x' - - name: Install pnpm uses: pnpm/action-setup@v2 with: version: 9.15.0 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v3 + - name: Setup Node.js + uses: useblacksmith/setup-node@v5 with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: 22 + cache: 'pnpm' + + - name: Fix pnpm store permissions + run: | + STORE_PATH=$(pnpm store path --silent) + if [ -d "$STORE_PATH" ]; then + sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true + chmod -R u+rw "$STORE_PATH" || true + fi + + - name: Mount Turbo cache sticky disk + uses: useblacksmith/stickydisk@v1 + with: + key: ${{ github.repository }}-turbo-cache + path: ./.turbo - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --prefer-offline - name: ๐Ÿš€ Deploy to ${{ github.ref_name == 'main' && 'Production' || 'Staging' }} env: From 43077e4ad6be31ca9818b4d13058e62c40e801c9 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 19 Aug 2025 15:38:34 -0600 Subject: [PATCH 3/5] feat: add optimized Dockerfile.prebuilt for production deployments This Dockerfile is designed for pre-built artifacts from GitHub Actions, enabling faster and more efficient production deployments with minimal runtime overhead and optimized layer caching. --- apps/server/Dockerfile.prebuilt | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 apps/server/Dockerfile.prebuilt diff --git a/apps/server/Dockerfile.prebuilt b/apps/server/Dockerfile.prebuilt new file mode 100644 index 000000000..6c17913f5 --- /dev/null +++ b/apps/server/Dockerfile.prebuilt @@ -0,0 +1,46 @@ +# ================================================================ +# Optimized Dockerfile for pre-built artifacts +# This expects the app to be already built by GitHub Actions +# ================================================================ + +FROM oven/bun:1.2.15-alpine AS runtime + +WORKDIR /app + +# Set production environment +ENV NODE_ENV=production + +# Add build metadata as labels +ARG COMMIT_SHA +ARG BUILD_DATE +LABEL org.opencontainers.image.revision="${COMMIT_SHA}" +LABEL org.opencontainers.image.created="${BUILD_DATE}" + +# Create non-root user +RUN addgroup --system --gid 1001 bunuser && \ + adduser --system --uid 1001 bunuser + +# Copy pre-built application files +# These are prepared by GitHub Actions: +# - dist/ contains the built server bundle +# - node_modules/ contains production dependencies only +# - package.json for runtime metadata +COPY --chown=bunuser:bunuser dist ./dist +COPY --chown=bunuser:bunuser node_modules ./node_modules +COPY --chown=bunuser:bunuser package.json ./ + +# Show image info +RUN echo "=== Production image ready ===" && \ + echo "Commit: ${COMMIT_SHA:-unknown}" && \ + echo "Built: ${BUILD_DATE:-unknown}" && \ + echo "Size: $(du -sh /app | cut -f1)" + +USER bunuser +EXPOSE 3002 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD bun -e "fetch('http://localhost:' + (process.env.SERVER_PORT || 3002) + '/healthcheck').then(r => r.ok ? process.exit(0) : process.exit(1))" + +# Start the application +CMD ["bun", "run", "dist/index.js"] \ No newline at end of file From 40b0540e6f298df676c3f1be158de92022e93c13 Mon Sep 17 00:00:00 2001 From: dal Date: Wed, 20 Aug 2025 09:14:05 -0600 Subject: [PATCH 4/5] chore: update license to Business Source License 1.1 --- LICENSE | 74 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 7e1f824e8..7fa60d968 100644 --- a/LICENSE +++ b/LICENSE @@ -1,25 +1,65 @@ -Copyright (c) 2024 Sprint Labs, Inc. +Business Source License 1.1 + +Licensor: Sprint Labs, Inc. +Licensed Work: Sprint Labs Software +The Licensed Work is (c) 2024 Sprint Labs, Inc. Portions of this software are licensed as follows: - All content that resides under the "ee/" and/or "web/src/ee" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE". - All third party components incorporated into the Sprint Labs Software are licensed under the original license provided by the owner of the applicable component. -- Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below. +- Content outside of the above mentioned directories or restrictions above is available under the "Business Source License 1.1" as defined below. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +License Grant: You may make use of the Licensed Work, including running, +modifying, and self-hosting it, provided that you do not offer the Licensed +Work, in whole or in part, as a managed or hosted service where third +parties pay you to use the Licensed Work or any substantial portion of its +functionality. For clarity, you may use the Licensed Work internally for +your own business operations or embed it within your own applications or +services, so long as those services are not substantially a substitute for +the Licensed Work itself. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Change Date: Three years from the date of each release of the Licensed Work. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +Change License: On the Change Date for each release, that version of the +Licensed Work will automatically become available under the following license: + +---------------------------------------------------------------------- +MIT License (Expat) + +Copyright (c) 2024 Sprint Labs, Inc. + +Portions of this software are licensed as follows: + +- All content that resides under the "ee/" and/or "web/src/ee" directories + of this repository, if these directories exist, is licensed under the + license defined in "ee/LICENSE". +- All third party components incorporated into the Sprint Labs Software + are licensed under the original license provided by the owner of the + applicable component. +- Content outside of the above mentioned directories or restrictions above + is available under the "MIT Expat" license as defined below. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- + +Clarification: This Change License applies only to versions of the Licensed +Work released prior to their respective Change Dates. Sprint Labs, Inc. +reserves the right to license future versions of the Licensed Work under +different terms, including proprietary licenses. \ No newline at end of file From 1084bfd48527d3ede5d533705d33d74f65c7297c Mon Sep 17 00:00:00 2001 From: dal Date: Thu, 21 Aug 2025 09:18:58 -0600 Subject: [PATCH 5/5] add gpt5 to fallback chain on sonnet 4 --- packages/ai/src/steps/analyst-step.ts | 1 + packages/ai/src/steps/think-and-prep-step.ts | 1 + packages/ai/src/utils/models/sonnet-4.ts | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/ai/src/steps/analyst-step.ts b/packages/ai/src/steps/analyst-step.ts index 3dcf3a91f..54a241abc 100644 --- a/packages/ai/src/steps/analyst-step.ts +++ b/packages/ai/src/steps/analyst-step.ts @@ -60,6 +60,7 @@ const outputSchema = z.object({ const DEFAULT_CACHE_OPTIONS = { anthropic: { cacheControl: { type: 'ephemeral', ttl: '1h' } }, + openai: { parallelToolCalls: false, reasoningEffort: 'minimal' }, }; /** diff --git a/packages/ai/src/steps/think-and-prep-step.ts b/packages/ai/src/steps/think-and-prep-step.ts index b4a384517..f916181ec 100644 --- a/packages/ai/src/steps/think-and-prep-step.ts +++ b/packages/ai/src/steps/think-and-prep-step.ts @@ -82,6 +82,7 @@ const outputSchema = ThinkAndPrepOutputSchema; const DEFAULT_CACHE_OPTIONS = { anthropic: { cacheControl: { type: 'ephemeral', ttl: '1h' } }, + openai: { parallelToolCalls: false, reasoningEffort: 'minimal' }, }; // Helper function to create the result object diff --git a/packages/ai/src/utils/models/sonnet-4.ts b/packages/ai/src/utils/models/sonnet-4.ts index 03bb8ecd3..46ade010b 100644 --- a/packages/ai/src/utils/models/sonnet-4.ts +++ b/packages/ai/src/utils/models/sonnet-4.ts @@ -1,6 +1,7 @@ import type { LanguageModelV1 } from '@ai-sdk/provider'; import { createFallback } from './ai-fallback'; import { anthropicModel } from './providers/anthropic'; +import { openaiModel } from './providers/openai'; import { vertexModel } from './providers/vertex'; // Lazy initialization to allow mocking in tests @@ -24,13 +25,13 @@ function initializeSonnet4() { } } - // Only include Vertex if credentials are available - if (process.env.VERTEX_CLIENT_EMAIL && process.env.VERTEX_PRIVATE_KEY) { + if (process.env.OPENAI_API_KEY) { try { - models.push(vertexModel('claude-sonnet-4@20250514')); - console.info('Sonnet4: Vertex AI model added to fallback chain'); + models.push(openaiModel('gpt-5')); + + console.info('Sonnet4: OpenAI model added to fallback chain'); } catch (error) { - console.warn('Sonnet4: Failed to initialize Vertex AI model:', error); + console.warn('Sonnet4: Failed to initialize OpenAI model:', error); } }