TypeScript Pipeline

A production-ready typed pipeline with an BetaWindowClient class, quality gate assertions, and CI-friendly exit codes.

Setup

cd examples/typescript-pipeline
npm install   # installs typescript + ts-node

export AGENTQA_TOKEN="eyJ..."
export APP_URL="https://your-app.vercel.app"

# Run with ts-node (dev)
npx ts-node pipeline.ts

# Or compile first
npx tsc && node dist/pipeline.js

Types

type Tier = 'quick' | 'standard' | 'deep'
type JobStatus = 'pending' | 'in_progress' | 'complete' | 'cancelled' | 'failed'
type BugSeverity = 'low' | 'medium' | 'high' | 'critical'

interface Job {
  id: string
  status: JobStatus
  tier: Tier
  submitted_url: string
  rating?: number        // 1–5
  summary?: string
  bugs: Bug[]
  network_log_url?: string
  console_log_url?: string
  duration_seconds?: number
}

BetaWindowClient

const client = new BetaWindowClient(process.env.AGENTQA_TOKEN!)

// Create a job
const job = await client.createJob({
  url: 'https://your-app.vercel.app',
  tier: 'standard',
  title: 'Full smoke test',
  instructions: '...',
})

// Poll until complete (with progress callback)
const done = await client.pollUntilComplete(job.id, {
  intervalMs: 15_000,
  onProgress: (j) => console.log(j.status),
})

Quality gates

assertJobQuality() returns a typed result and the pipeline exits 1 on any failure:

const result = assertJobQuality(completedJob, {
  minRating: 3,                        // fail if rating < 3/5
  maxBugs: 5,                          // fail if > 5 bugs found
  forbiddenSeverities: ['critical'],   // fail on any critical bug
})

if (!result.passed) {
  console.error(result.failures)
  process.exit(1)
}

GitHub Actions

jobs:
  human-qa:
    runs-on: ubuntu-latest
    needs: [deploy]   # run after Vercel deploy step
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - name: Install
        run: cd examples/typescript-pipeline && npm install
      - name: Run QA pipeline
        env:
          AGENTQA_TOKEN: ${{ secrets.AGENTQA_TOKEN }}
          APP_URL: ${{ needs.deploy.outputs.url }}
        run: |
          cd examples/typescript-pipeline
          npx ts-node pipeline.ts

Next steps