Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

ci: remove redundant checks and test runs (#522)

Gener9845f8f9b24f
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 7ee326f2b..596175687 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -4,8 +4,7 @@
# CI/CD workflows require review
.github/ @alookai/core-dev
-# Private workspace agent-driver API entry points and their golden reports
-/src/daemon/agent-driver/etc/api/ @alookai/core-dev
+# Private workspace agent-driver API entry points
/src/daemon/agent-driver/src/index.ts @alookai/core-dev
/src/daemon/agent-driver/src/host.ts @alookai/core-dev
/src/daemon/agent-driver/src/adapter-author.ts @alookai/core-dev
diff --git a/.github/api-surface-owners.json b/.github/api-surface-owners.json
deleted file mode 100644
index 83a026a4d..000000000
--- a/.github/api-surface-owners.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "owners": ["gusye1234", "GenerQAQ", "LindsayLiu777"]
-}
diff --git a/.github/workflows/api-surface-check.yml b/.github/workflows/api-surface-check.yml
deleted file mode 100644
index a429d95cc..000000000
--- a/.github/workflows/api-surface-check.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: API Surface Check
-
-on:
- pull_request:
- branches: [main]
-
-permissions:
- contents: read
-
-concurrency:
- group: api-check-${{ github.event.pull_request.number }}
- cancel-in-progress: true
-
-jobs:
- api-check:
- name: API Report Check
- runs-on: ubuntu-latest
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
- with:
- node-version: 22
- cache: pnpm
- - run: pnpm install --frozen-lockfile
- - run: pnpm api:check
diff --git a/.github/workflows/api-surface-guard.yml b/.github/workflows/api-surface-guard.yml
deleted file mode 100644
index 892afebd2..000000000
--- a/.github/workflows/api-surface-guard.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: API Surface Guard
-
-on:
- pull_request_target:
- branches: [main]
- types: [opened, synchronize, reopened, labeled, unlabeled]
- pull_request_review:
- types: [submitted, dismissed]
-
-permissions:
- contents: read
- pull-requests: read
-
-concurrency:
- group: api-surface-${{ github.event.pull_request.number }}
- cancel-in-progress: true
-
-jobs:
- api-surface-guard:
- if: github.event.pull_request.base.ref == 'main'
- name: Current-head API Owner Approval
- runs-on: ubuntu-latest
- timeout-minutes: 5
- steps:
- - name: Checkout trusted base
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- ref: ${{ github.event.pull_request.base.sha }}
- - name: Enforce current-head independent approval
- env:
- API_BASE_SHA: ${{ github.event.pull_request.base.sha }}
- API_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- API_PR_AUTHOR: ${{ github.event.pull_request.user.login }}
- API_PR_NUMBER: ${{ github.event.pull_request.number }}
- API_REPOSITORY: ${{ github.repository }}
- API_GITHUB_TOKEN: ${{ github.token }}
- API_LABELS_JSON: ${{ toJSON(github.event.pull_request.labels) }}
- run: node scripts/ci/api-surface-guard.mjs
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a6ea4b7bb..14249ca6b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,8 +7,6 @@ on:
branches: [main]
merge_group:
types: [checks_requested]
- schedule:
- - cron: "17 3 * * *"
workflow_dispatch:
permissions:
@@ -42,7 +40,7 @@ jobs:
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event_name == 'merge_group' && github.event.merge_group.base_sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- FORCE_FULL: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+ FORCE_FULL: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: |
printf 'base_sha=%s\nhead_sha=%s\n' "$BASE_SHA" "$HEAD_SHA" >> "$GITHUB_OUTPUT"
args=(--base "$BASE_SHA" --head "$HEAD_SHA" --output "$GITHUB_OUTPUT" --summary "$GITHUB_STEP_SUMMARY")
@@ -72,17 +70,20 @@ jobs:
- run: pnpm --filter @alook/web validate:blog
- run: pnpm build --filter=@alook/web
- quality:
- name: Typecheck & Lint
+ static-checks:
+ name: Static checks
needs: scope
if: needs.scope.outputs.run_code_checks == 'true'
runs-on: ubuntu-latest
- timeout-minutes: 10
+ timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ with:
+ bun-version: 1.3.11
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 22
@@ -110,44 +111,35 @@ jobs:
run: pnpm turbo run lint --affected
- run: pnpm typegrep:ws
- run: pnpm typegrep:agent-driver
-
- knip:
- name: Dead Code Detection (knip)
- needs: scope
- if: needs.scope.outputs.run_knip == 'true'
- runs-on: ubuntu-latest
- timeout-minutes: 10
- continue-on-error: true
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- fetch-depth: 0
- - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
- with:
- node-version: 22
- cache: pnpm
- - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- with:
- path: .turbo/cache
- key: turbo-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ github.sha }}
- restore-keys: |
- turbo-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-
- - run: pnpm install --frozen-lockfile
- - if: needs.scope.outputs.full == 'true'
+ - name: Build
+ if: needs.scope.outputs.full == 'true'
+ run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker
+ - name: Build affected packages
+ if: needs.scope.outputs.full != 'true'
+ env:
+ TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
+ TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
+ run: pnpm turbo run build --affected --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker
+ - name: Dead code detection
+ if: needs.scope.outputs.run_knip == 'true' && needs.scope.outputs.full == 'true'
+ continue-on-error: true
run: pnpm knip
- - if: needs.scope.outputs.full != 'true'
+ - name: Dead code detection for affected packages
+ if: needs.scope.outputs.run_knip == 'true' && needs.scope.outputs.full != 'true'
+ continue-on-error: true
env:
TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
run: pnpm turbo run knip --affected
test-linux:
- name: Tests (ubuntu-latest)
+ name: Tests & Coverage (ubuntu-latest)
needs: scope
if: needs.scope.outputs.run_code_checks == 'true'
runs-on: ubuntu-latest
- timeout-minutes: 10
+ timeout-minutes: 15
+ env:
+ RUN_COVERAGE: ${{ github.event_name != 'push' || startsWith(github.event.head_commit.message, 'release:') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
@@ -167,29 +159,30 @@ jobs:
restore-keys: |
turbo-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-
- run: pnpm install --frozen-lockfile
+ - name: Build agent-driver for coverage
+ if: env.RUN_COVERAGE == 'true'
+ run: pnpm --filter @alook/agent-driver build
+ - name: Run full tests with coverage
+ if: env.RUN_COVERAGE == 'true'
+ run: pnpm vitest run --coverage --coverage.reporter=json --coverage.reporter=text
- name: Run daemon tests in isolation
- if: needs.scope.outputs.full == 'true'
+ if: env.RUN_COVERAGE != 'true'
env:
VITEST_MAX_WORKERS: 1
run: pnpm turbo run test --filter=@alook/daemon
- - name: Run affected daemon tests in isolation
- if: needs.scope.outputs.full != 'true'
- env:
- VITEST_MAX_WORKERS: 1
- TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
- TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
- run: pnpm turbo run test --affected --filter=@alook/daemon
- name: Run remaining workspace tests
- if: needs.scope.outputs.full == 'true'
+ if: env.RUN_COVERAGE != 'true'
run: pnpm turbo run test --filter='!@alook/daemon'
- - name: Run affected workspace tests
- if: needs.scope.outputs.full != 'true'
- env:
- TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
- TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
- run: pnpm turbo run test --affected --filter='!@alook/daemon'
- name: Run CI script tests
+ if: env.RUN_COVERAGE != 'true'
run: pnpm vitest run --project ci-scripts
+ - name: Upload coverage
+ if: env.RUN_COVERAGE == 'true'
+ uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: ./coverage/coverage-final.json
+ fail_ci_if_error: true
test-windows:
name: Tests (windows-latest)
@@ -233,26 +226,18 @@ jobs:
pnpm --filter @alook/agent-driver build
pnpm --filter @alook/daemon exec vitest run src/daemon/createDaemon.test.ts -t "starts the builtin Codex lane from a fresh nested daemon workspace"
- name: Run daemon tests in isolation
- if: needs.scope.outputs.full == 'true'
- env:
- VITEST_MAX_WORKERS: 1
- run: pnpm --filter @alook/daemon test
- - name: Run affected daemon tests in isolation
- if: needs.scope.outputs.full != 'true'
env:
VITEST_MAX_WORKERS: 1
run: pnpm --filter @alook/daemon test
- - name: Run remaining workspace tests
+ - name: Run Windows-relevant workspace tests
if: needs.scope.outputs.full == 'true'
- run: pnpm turbo run test --filter='!@alook/daemon' --filter='!@alook/agent-driver'
- - name: Run affected workspace tests
+ run: pnpm turbo run test --filter=@alook/cli --filter=@alook/app --filter=@alook/shared
+ - name: Run affected Windows-relevant workspace tests
if: needs.scope.outputs.full != 'true'
env:
TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
- run: pnpm turbo run test --affected --filter='!@alook/daemon' --filter='!@alook/agent-driver'
- - name: Run CI script tests
- run: pnpm vitest run --project ci-scripts
+ run: pnpm turbo run test --affected --filter=@alook/cli --filter=@alook/app --filter=@alook/shared
e2e:
name: E2E Tests
@@ -310,64 +295,6 @@ jobs:
- run: pnpm --filter @alook/cli run test:integration
- run: pnpm --filter @alook/daemon run test:integration
- build:
- name: Build
- needs: scope
- if: needs.scope.outputs.run_code_checks == 'true'
- runs-on: ubuntu-latest
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- fetch-depth: 0
- - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- with:
- bun-version: 1.3.11
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
- with:
- node-version: 22
- cache: pnpm
- - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- with:
- path: .turbo/cache
- key: turbo-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ github.sha }}
- restore-keys: |
- turbo-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-
- - run: pnpm install --frozen-lockfile
- - if: needs.scope.outputs.full == 'true'
- run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker
- - if: needs.scope.outputs.full != 'true'
- env:
- TURBO_SCM_BASE: ${{ needs.scope.outputs.base_sha }}
- TURBO_SCM_HEAD: ${{ needs.scope.outputs.head_sha }}
- run: pnpm turbo run build --affected --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker
-
- coverage:
- name: Coverage
- needs: scope
- if: needs.scope.outputs.run_code_checks == 'true' && (github.event_name != 'push' || startsWith(github.event.head_commit.message, 'release:'))
- runs-on: ubuntu-latest
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- with:
- bun-version: 1.3.11
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
- with:
- node-version: 22
- cache: pnpm
- - run: pnpm install --frozen-lockfile
- - run: pnpm --filter @alook/agent-driver build
- - run: pnpm vitest run --coverage --coverage.reporter=json --coverage.reporter=text
- - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ./coverage/coverage-final.json
- fail_ci_if_error: true
-
desktop-rust:
name: Desktop Rust (test + machete)
needs: scope
@@ -419,13 +346,10 @@ jobs:
needs:
- scope
- blog-content
- - quality
- - knip
+ - static-checks
- test-linux
- test-windows
- e2e
- - build
- - coverage
- desktop-rust
- lighthouse
runs-on: ubuntu-latest
@@ -435,13 +359,10 @@ jobs:
[
{"name":"scope","expected":true,"result":"${{ needs.scope.result }}"},
{"name":"blog-content","expected":${{ needs.scope.outputs.blog_only == 'true' }},"result":"${{ needs.blog-content.result }}"},
- {"name":"quality","expected":${{ needs.scope.outputs.run_code_checks == 'true' }},"result":"${{ needs.quality.result }}"},
- {"name":"knip","expected":${{ needs.scope.outputs.run_knip == 'true' }},"result":"${{ needs.knip.result }}"},
+ {"name":"static-checks","expected":${{ needs.scope.outputs.run_code_checks == 'true' }},"result":"${{ needs.static-checks.result }}"},
{"name":"test-linux","expected":${{ needs.scope.outputs.run_code_checks == 'true' }},"result":"${{ needs.test-linux.result }}"},
{"name":"test-windows","expected":${{ needs.scope.outputs.run_windows == 'true' }},"result":"${{ needs.test-windows.result }}"},
{"name":"e2e","expected":${{ needs.scope.outputs.run_e2e == 'true' && github.event_name != 'push' }},"result":"${{ needs.e2e.result }}"},
- {"name":"build","expected":${{ needs.scope.outputs.run_code_checks == 'true' }},"result":"${{ needs.build.result }}"},
- {"name":"coverage","expected":${{ needs.scope.outputs.run_code_checks == 'true' && (github.event_name != 'push' || startsWith(github.event.head_commit.message, 'release:')) }},"result":"${{ needs.coverage.result }}"},
{"name":"desktop-rust","expected":${{ needs.scope.outputs.run_rust == 'true' }},"result":"${{ needs.desktop-rust.result }}"},
{"name":"lighthouse","expected":${{ needs.scope.outputs.run_lighthouse == 'true' && github.event_name != 'push' }},"result":"${{ needs.lighthouse.result }}"}
]
diff --git a/.github/workflows/e2e-ui.yml b/.github/workflows/e2e-ui.yml
index 5ccf7a5e7..f26ab84f7 100644
--- a/.github/workflows/e2e-ui.yml
+++ b/.github/workflows/e2e-ui.yml
@@ -5,8 +5,6 @@ on:
branches: [main]
merge_group:
types: [checks_requested]
- schedule:
- - cron: "17 3 * * *"
workflow_dispatch:
permissions:
@@ -32,7 +30,7 @@ jobs:
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event_name == 'merge_group' && github.event.merge_group.base_sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- FORCE_FULL: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+ FORCE_FULL: ${{ github.event_name == 'workflow_dispatch' }}
run: |
args=(--base "$BASE_SHA" --head "$HEAD_SHA" --output "$GITHUB_OUTPUT" --summary "$GITHUB_STEP_SUMMARY")
if [[ "$FORCE_FULL" == "true" ]]; then args+=(--force-full); fi
@@ -86,23 +84,27 @@ jobs:
- if: ${{ !cancelled() && matrix.shard == 1 }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
- name: playwright-merge-runtime
+ name: playwright-merge-runtime-${{ github.run_id }}-${{ github.run_attempt }}
path: src/web/playwright-merge-runtime/
+ if-no-files-found: error
retention-days: 1
- if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
- name: blob-report-${{ matrix.shard }}
+ name: blob-report-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.shard }}
path: src/web/blob-report/
+ if-no-files-found: error
retention-days: 1
- if: failure()
+ continue-on-error: true
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
- name: playwright-artifacts-${{ matrix.shard }}
+ name: playwright-artifacts-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.shard }}
path: |
src/web/test-results/
src/web/e2e-service-logs/
- retention-days: 14
+ if-no-files-found: ignore
+ retention-days: 7
merge-reports:
name: Merge Playwright Reports
@@ -113,17 +115,17 @@ jobs:
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
- pattern: blob-report-*
+ pattern: blob-report-${{ github.run_id }}-${{ github.run_attempt }}-*
path: all-blob-reports
merge-multiple: true
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
- name: playwright-merge-runtime
+ name: playwright-merge-runtime-${{ github.run_id }}-${{ github.run_attempt }}
path: playwright-merge-runtime
- run: node playwright-merge-runtime/node_modules/@playwright/test/cli.js merge-reports --reporter html all-blob-reports
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
- name: playwright-report
+ name: playwright-report-${{ github.run_id }}-${{ github.run_attempt }}
path: playwright-report/
retention-days: 14
diff --git a/AGENTS.md b/AGENTS.md
index 02596be8e..0a4c602a1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -44,7 +44,7 @@ This triggers:
- **CF Workers** → each module redeploys when its own `package.json` changes
### E2E UI (browser tests)
-Playwright browser E2E for the web UI lives in `src/web/src/test/e2e-ui/`. The `e2e-ui.yml` workflow starts for every PR and merge-queue check, then runs the browser matrix only when the diff touches `src/web`/`src/shared`/`src/ws-do`; blog-only and unrelated changes finish through the lightweight scope and gate jobs. The workflow also supports scheduled and manual full runs, but does not run after pushes to `main`. It is deliberately NOT tied to the release chain: a `release:` bump only changes version numbers, so gating there would test nothing, and the production web app deploys via Cloudflare's own Git integration (outside GitHub Actions) which a workflow gate can't block anyway. Run locally with `pnpm test:e2e-ui` (backs up and restores your local `.wrangler/state`).
+Playwright browser E2E for the web UI lives in `src/web/src/test/e2e-ui/`. The `e2e-ui.yml` workflow starts for every PR and merge-queue check, then runs the browser matrix only when the diff touches `src/web`/`src/shared`/`src/ws-do`; blog-only and unrelated changes finish through the lightweight scope and gate jobs. The workflow also supports manual full runs, but does not run after pushes to `main`. It is deliberately NOT tied to the release chain: a `release:` bump only changes version numbers, so gating there would test nothing, and the production web app deploys via Cloudflare's own Git integration (outside GitHub Actions) which a workflow gate can't block anyway. Run locally with `pnpm test:e2e-ui` (backs up and restores your local `.wrangler/state`).
> Branch protection may require the stable `UI E2E Gate` check. Do not require the individual `UI Playwright E2E (n/N)` matrix jobs, because skipped shards are expected for changes outside the UI scope.
diff --git a/package.json b/package.json
index 5de9289f7..723c6880e 100644
--- a/package.json
+++ b/package.json
@@ -41,8 +41,6 @@
"bump": "node scripts/bump-version.mjs",
"typegrep:ws": "node scripts/lint-ws-events.mjs",
"typegrep:agent-driver": "node scripts/check-agent-driver-boundaries.mjs",
- "api:check": "pnpm --filter @alook/agent-driver api:check",
- "api:update": "pnpm --filter @alook/agent-driver api:update",
"logo:generate": "node scripts/generate-logo-assets.mjs",
"readme:capture": "node src/web/readme-capture/capture.mjs",
"prepare": "simple-git-hooks"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 00f5b9b76..546e610e3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -151,9 +151,6 @@ importers:
src/daemon/agent-driver:
devDependencies:
- '@microsoft/api-extractor':
- specifier: ^7.58.13
- version: 7.58.13(@types/[email protected])
'@types/node':
specifier: ^20.0.0
version: 20.19.43
@@ -2330,21 +2327,6 @@ packages:
'@mermaid-js/[email protected]':
resolution: {integrity: sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw==}
- '@microsoft/[email protected]':
- resolution: {integrity: sha512-iDu1AtuRC2Z8XVs2SieZieVavF1FXPBX1C9pMexJh8Dx/Dd/3ZZ4nRQp/PU2Vk2rUHWuBz1wOyL4DcuhVnBXwg==}
- engines: {node: '>=20.9.0'}
-
- '@microsoft/[email protected]':
- resolution: {integrity: sha512-htjkWdR+ovlBiQuBbMutIuiu/dzKYpFrBRRuHGlpo7J81cPzmMTBKxE8j+aWSs5HxvXHCvatVe4vQ9CKqSvZaA==}
- engines: {node: '>=20.9.0'}
- hasBin: true
-
- '@microsoft/[email protected]':
- resolution: {integrity: sha512-9brPoVdfN9k9g0dcWkFeA7IH9bbcttzDJlXvkf8b2OBzd5MueR1V2wkKBL0abn0otvmkHJC6aapBOTJDDeMCZg==}
-
- '@microsoft/[email protected]':
- resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==}
-
'@modelcontextprotocol/[email protected]':
resolution: {integrity: sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==}
engines: {node: '>=18'}
@@ -3067,39 +3049,6 @@ packages:
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
- '@rushstack/[email protected]':
- resolution: {integrity: sha512-g/Z47ZwARn/VkTnHcyJslrR26erRf1G5JbqPlfGZGBCrOcrEt8fTQXXDVhUDDNl/g/v3TXI1dNiAAT5FEks8BA==}
- engines: {node: '>=20.9.0'}
- peerDependencies:
- '@types/node': '*'
- peerDependenciesMeta:
- '@types/node':
- optional: true
-
- '@rushstack/[email protected]':
- resolution: {integrity: sha512-gulfhBs6n+I5b7DvjKRfhMGyUejtSgOHTclF/eONr8hcgF1APEDjhxIsfdUYYMzC3rvLwGluqLjbwCFZ8nxrog==}
- peerDependencies:
- '@types/node': '*'
- peerDependenciesMeta:
- '@types/node':
- optional: true
-
- '@rushstack/[email protected]':
- resolution: {integrity: sha512-aAA518n6wxxjCfnTAOjQnm7ngNE0FVHxHAw2pxKlIhxrMn0XQjGcXKF0oKWpjBgJOmsaJpVob/v+zr3zxgPWuA==}
-
- '@rushstack/[email protected]':
- resolution: {integrity: sha512-KxphDhPGC4xDrKg8O4yrWCEpPMi87aJc1iycXqMVh1dLgV0M34hiH9ZTgWjBRmcrT/OIHoOeWf48npcQFzgp+g==}
- engines: {node: '>=20.9.0'}
- peerDependencies:
- '@types/node': '*'
- peerDependenciesMeta:
- '@types/node':
- optional: true
-
- '@rushstack/[email protected]':
- resolution: {integrity: sha512-+jNbxhh8CkrZYxMk9X3GRYM2+Myr1xCCj+eHbJ9Vp+PCdNHS0TUl5QQFT6UbM/aTFRCzs5jiBTKYzBRpe5uYbQ==}
- engines: {node: '>=20.9.0'}
-
'@sec-ant/[email protected]':
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
@@ -3824,9 +3773,6 @@ packages:
resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}
- '@types/[email protected]':
- resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
-
resolution: {integrity: sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==}
@@ -4306,14 +4252,6 @@ packages:
resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==}
engines: {node: '>= 8.0.0'}
- resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==}
- peerDependencies:
- ajv: ^8.5.0
- peerDependenciesMeta:
- ajv:
- optional: true
-
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
@@ -4333,9 +4271,6 @@ packages:
resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==}
- resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==}
-
resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}
@@ -5958,10 +5893,6 @@ packages:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
- resolution: {integrity: sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==}
- engines: {node: '>=14.14'}
-
resolution: {integrity: sha512-EQsFzMUJkCKGr1ePqlYADkIUmHW1s3ZXr5Yqy6wbGrfUCphpl2maM/kyOIRA2HpP3AaFQTZXD4ldjek+nccddA==}
engines: {node: '>=14.14'}
@@ -6284,10 +6215,6 @@ packages:
resolution: {integrity: sha512-AiohS3H80sXO6owEltjGX+glb7qXaDhBoJb9XcQVH4UI207xu/bDLUcadVKp7Qe576reg9yr/PXZjV5qx8gfbA==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
engines: {node: '>=0.8.19'}
@@ -6580,9 +6507,6 @@ packages:
resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
hasBin: true
- resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==}
-
resolution: {integrity: sha512-XrchZOFZUl/T3vTwRe8XK+cJrGtMF4th1ARnDfwbBXFKThGhlsxEE4Zu03AD/bjJSt/9jT/mxrOCkJWOg77aPA==}
@@ -7268,10 +7192,6 @@ packages:
resolution: {integrity: sha512-Bv1j2kcKKNwXLWuCx+j0xGt7z318mqQkJmEN6ellM9sCESbPBDTM9ofZMbKqx47jSnoGA3CiaUkAmzGVXUa/wQ==}
engines: {node: '>=22.0.0'}
- resolution: {integrity: sha512-Rwi3pnapEqirPSbWbrZaa6N3nmqq4Xer/2XooiOKyV3q12ML06f7MOuc5DVH8ONZIFhwIYQ3yzPH4nt7iWHaTg==}
- engines: {node: 18 || 20 || >=22}
-
resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==}
engines: {node: 18 || 20 || >=22}
@@ -8117,11 +8037,6 @@ packages:
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
- resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==}
- engines: {node: '>= 0.4'}
- hasBin: true
-
resolution: {integrity: sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==}
engines: {node: '>= 0.4'}
@@ -8227,11 +8142,6 @@ packages:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
- resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==}
- engines: {node: '>=10'}
- hasBin: true
-
resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==}
engines: {node: '>=10'}
@@ -8435,10 +8345,6 @@ packages:
resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}
- resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
- engines: {node: '>=0.6.19'}
-
resolution: {integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==}
engines: {node: '>=4'}
@@ -8568,10 +8474,6 @@ packages:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
- engines: {node: '>=10'}
-
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
@@ -11198,41 +11100,6 @@ snapshots:
dependencies:
langium: 4.2.2
- '@microsoft/[email protected](@types/[email protected])':
- dependencies:
- '@microsoft/tsdoc': 0.16.0
- '@microsoft/tsdoc-config': 0.18.1
- '@rushstack/node-core-library': 5.24.0(@types/[email protected])
- transitivePeerDependencies:
- - '@types/node'
-
- '@microsoft/[email protected](@types/[email protected])':
- dependencies:
- '@microsoft/api-extractor-model': 7.33.11(@types/[email protected])
- '@microsoft/tsdoc': 0.16.0
- '@microsoft/tsdoc-config': 0.18.1
- '@rushstack/node-core-library': 5.24.0(@types/[email protected])
- '@rushstack/rig-package': 0.7.3
- '@rushstack/terminal': 0.24.3(@types/[email protected])
- '@rushstack/ts-command-line': 5.3.13(@types/[email protected])
- diff: 8.0.4
- minimatch: 10.2.3
- resolve: 1.22.12
- semver: 7.7.4
- source-map: 0.6.1
- typescript: 5.9.3
- transitivePeerDependencies:
- - '@types/node'
-
- '@microsoft/[email protected]':
- dependencies:
- '@microsoft/tsdoc': 0.16.0
- ajv: 8.18.0
- jju: 1.4.0
- resolve: 1.22.12
-
- '@microsoft/[email protected]': {}
-
'@modelcontextprotocol/[email protected]([email protected])':
dependencies:
'@hono/node-server': 2.1.1([email protected])
@@ -11773,45 +11640,6 @@ snapshots:
'@rtsao/[email protected]': {}
- '@rushstack/[email protected](@types/[email protected])':
- dependencies:
- ajv: 8.20.0
- ajv-draft-04: 1.0.0([email protected])
- ajv-formats: 3.0.1([email protected])
- fs-extra: 11.3.6
- import-lazy: 4.0.0
- jju: 1.4.0
- resolve: 1.22.12
- semver: 7.7.4
- optionalDependencies:
- '@types/node': 20.19.43
-
- '@rushstack/[email protected](@types/[email protected])':
- optionalDependencies:
- '@types/node': 20.19.43
-
- '@rushstack/[email protected]':
- dependencies:
- jju: 1.4.0
- resolve: 1.22.12
-
- '@rushstack/[email protected](@types/[email protected])':
- dependencies:
- '@rushstack/node-core-library': 5.24.0(@types/[email protected])
- '@rushstack/problem-matcher': 0.2.1(@types/[email protected])
- supports-color: 8.1.1
- optionalDependencies:
- '@types/node': 20.19.43
-
- '@rushstack/[email protected](@types/[email protected])':
- dependencies:
- '@rushstack/terminal': 0.24.3(@types/[email protected])
- '@types/argparse': 1.0.38
- argparse: 1.0.10
- string-argv: 0.3.2
- transitivePeerDependencies:
- - '@types/node'
-
'@sec-ant/[email protected]': {}
'@sentry-internal/[email protected]':
@@ -12561,8 +12389,6 @@ snapshots:
tslib: 2.8.1
optional: true
- '@types/[email protected]': {}
-
dependencies:
'@types/node': 25.9.4
@@ -13119,10 +12945,6 @@ snapshots:
dependencies:
humanize-ms: 1.2.1
- optionalDependencies:
- ajv: 8.20.0
-
optionalDependencies:
ajv: 8.20.0
@@ -13138,13 +12960,6 @@ snapshots:
json-schema-traverse: 0.4.1
uri-js: 4.4.1
- dependencies:
- fast-deep-equal: 3.1.3
- fast-uri: 3.1.5
- json-schema-traverse: 1.0.0
- require-from-string: 2.0.2
-
dependencies:
fast-deep-equal: 3.1.3
@@ -14986,12 +14801,6 @@ snapshots:
- dependencies:
- graceful-fs: 4.2.11
- jsonfile: 6.2.1
- universalify: 2.0.1
-
dependencies:
graceful-fs: 4.2.11
@@ -15416,8 +15225,6 @@ snapshots:
es-module-lexer: 2.3.1
module-details-from-path: 1.0.4
-
@@ -15692,8 +15499,6 @@ snapshots:
-
@@ -16655,10 +16460,6 @@ snapshots:
- bufferutil
- utf-8-validate
- dependencies:
- brace-expansion: 5.0.9
-
dependencies:
brace-expansion: 5.0.7
@@ -17821,13 +17622,6 @@ snapshots:
- dependencies:
- es-errors: 1.3.0
- is-core-module: 2.16.2
- path-parse: 1.0.7
- supports-preserve-symlinks-flag: 1.0.0
-
dependencies:
es-errors: 1.3.0
@@ -17951,8 +17745,6 @@ snapshots:
-
@@ -18376,8 +18168,6 @@ snapshots:
optional: true
-
dependencies:
is-fullwidth-code-point: 2.0.0
@@ -18527,10 +18317,6 @@ snapshots:
dependencies:
has-flag: 4.0.0
- dependencies:
- has-flag: 4.0.0
-
diff --git a/scripts/ci/api-report-contract.test.ts b/scripts/ci/api-report-contract.test.ts
deleted file mode 100644
index 197ac070f..000000000
--- a/scripts/ci/api-report-contract.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { readFileSync } from "node:fs";
-import { resolve } from "node:path";
-import { describe, expect, it } from "vitest";
-
-const apiDirectory = resolve(process.cwd(), "src/daemon/agent-driver/etc/api");
-
-describe("agent-driver API reports", () => {
- it.each(["root", "host", "adapter-author", "testing"])("has no hidden exported dependency in %s", (name) => {
- const report = readFileSync(resolve(apiDirectory, `${name}.api.md`), "utf8");
- expect(report).not.toContain("ae-forgotten-export");
- });
-
- it("captures transitively exposed adapter-author input shapes", () => {
- const report = readFileSync(resolve(apiDirectory, "adapter-author.api.md"), "utf8");
- expect(report).toContain("export interface AdapterLaunchConfig");
- expect(report).toContain("runtimeConfig?: Config;");
- expect(report).toContain("export type InputMode = \"busy\" | \"idle\";");
- });
-});
diff --git a/scripts/ci/api-surface-guard.mjs b/scripts/ci/api-surface-guard.mjs
deleted file mode 100644
index f2621a89f..000000000
--- a/scripts/ci/api-surface-guard.mjs
+++ /dev/null
@@ -1,291 +0,0 @@
-import { readFile } from "node:fs/promises";
-import { dirname, resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-
-const API_LABELS = ["api-additive", "api-breaking"];
-const API_REPORT_PREFIX = "src/daemon/agent-driver/etc/api/";
-const API_SOURCE_PATHS = new Set([
- "src/daemon/agent-driver/src/index.ts",
- "src/daemon/agent-driver/src/host.ts",
- "src/daemon/agent-driver/src/adapter-author.ts",
- "src/daemon/agent-driver/src/testing/index.ts",
- "src/daemon/agent-driver/src/testing/conformance.ts",
- "src/daemon/agent-driver/src/testing/fake-host.ts",
- "src/daemon/agent-driver/src/public-contract.ts",
- "src/daemon/agent-driver/src/public-sdk.ts",
- "src/daemon/agent-driver/src/contract.ts",
- "src/daemon/agent-driver/src/registry.ts",
- "src/daemon/agent-driver/src/internal/adapter.ts",
-]);
-const API_MECHANISM_PATHS = new Set([
- ".github/CODEOWNERS",
- ".github/api-surface-owners.json",
- ".github/workflows/api-surface-check.yml",
- ".github/workflows/api-surface-guard.yml",
- "package.json",
- "pnpm-lock.yaml",
- "pnpm-workspace.yaml",
- "scripts/ci/api-report-contract.test.ts",
- "scripts/ci/api-surface-guard.mjs",
- "scripts/ci/api-surface-guard.test.ts",
- "src/daemon/agent-driver/api-extractor.adapter-author.json",
- "src/daemon/agent-driver/api-extractor.host.json",
- "src/daemon/agent-driver/api-extractor.root.json",
- "src/daemon/agent-driver/api-extractor.testing.json",
- "src/daemon/agent-driver/package.json",
- "src/daemon/agent-driver/scripts/api-reports.mjs",
- "src/daemon/agent-driver/scripts/prepare-dist.mjs",
- "src/daemon/agent-driver/scripts/prune-dist.mjs",
- "src/daemon/agent-driver/tsconfig.build.json",
- "src/daemon/agent-driver/tsconfig.json",
- "vitest.config.ts",
-]);
-
-export function isApiSurfacePath(path) {
- return path.startsWith(API_REPORT_PREFIX) || API_SOURCE_PATHS.has(path);
-}
-
-export function isApiMechanismPath(path) {
- return API_MECHANISM_PATHS.has(path);
-}
-
-export function collectChangedPaths(files, expectedChangedFileCount) {
- if (!Array.isArray(files)) throw new Error("Invalid pull request files response");
- if (!Number.isSafeInteger(expectedChangedFileCount) || expectedChangedFileCount < 0) {
- throw new Error("Invalid pull request changed_files count");
- }
-
- const returnedFileNames = new Set();
- const changedPaths = new Set();
- for (const file of files) {
- if (!file || typeof file.filename !== "string" || file.filename.length === 0) {
- throw new Error("Invalid pull request file entry");
- }
- returnedFileNames.add(file.filename);
- changedPaths.add(file.filename);
- if (file.previous_filename !== undefined) {
- if (typeof file.previous_filename !== "string" || file.previous_filename.length === 0) {
- throw new Error("Invalid pull request previous filename");
- }
- changedPaths.add(file.previous_filename);
- }
- }
-
- if (returnedFileNames.size !== expectedChangedFileCount) {
- throw new Error(
- `Incomplete pull request files response: expected ${expectedChangedFileCount}, received ${returnedFileNames.size}`,
- );
- }
- return [...changedPaths];
-}
-
-export function parseAdapterAuthorContractVersion(source) {
- const identifier = "ADAPTER_AUTHOR_CONTRACT_VERSION";
- const occurrences = source.match(new RegExp(`\\b${identifier}\\b`, "g")) ?? [];
- if (occurrences.length === 0) return null;
- if (occurrences.length > 1) throw new Error("Multiple adapter-author contract version references");
-
- let offset = source.charCodeAt(0) === 0xfeff ? 1 : 0;
- while (offset < source.length) {
- const remainder = source.slice(offset);
- const whitespace = remainder.match(/^\s+/);
- if (whitespace) {
- offset += whitespace[0].length;
- continue;
- }
- if (remainder.startsWith("//")) {
- const newline = remainder.indexOf("\n");
- offset += newline === -1 ? remainder.length : newline + 1;
- continue;
- }
- if (remainder.startsWith("/*")) {
- const end = remainder.indexOf("*/", 2);
- if (end === -1) throw new Error("Unterminated leading comment in adapter-author contract source");
- offset += end + 2;
- continue;
- }
- break;
- }
-
- const declaration = source.slice(offset).match(
- /^export[\t ]+const[\t ]+ADAPTER_AUTHOR_CONTRACT_VERSION[\t ]*=[\t ]*(\d+)(?:[\t ]+as[\t ]+const)?[\t ]*;?[\t ]*(?:\r?\n|$)/,
- );
- if (!declaration) throw new Error("Invalid adapter-author contract version declaration");
- const version = Number(declaration[1]);
- if (!Number.isSafeInteger(version) || version < 1) {
- throw new Error("Invalid adapter-author contract version declaration");
- }
- return version;
-}
-
-export function evaluateApiSurfaceGuard(input) {
- const changedApiPaths = input.changedPaths.filter(isApiSurfacePath);
- const changedMechanismPaths = input.changedPaths.filter(isApiMechanismPath);
- if (changedApiPaths.length === 0 && changedMechanismPaths.length === 0) {
- return { ok: true, reason: "no_api_surface_change" };
- }
-
- const selectedLabels = API_LABELS.filter((label) => input.labels.includes(label));
- const adapterAuthorReportChanged = changedApiPaths.includes(`${API_REPORT_PREFIX}adapter-author.api.md`);
- let baseVersion;
- let headVersion;
- let baseHasVersion;
- let headHasVersion;
- if (changedApiPaths.length > 0) {
- baseVersion = input.baseContractVersion;
- headVersion = input.headContractVersion;
- baseHasVersion = Number.isSafeInteger(baseVersion) && baseVersion >= 1;
- headHasVersion = Number.isSafeInteger(headVersion) && headVersion >= 1;
- if ((baseVersion !== null && !baseHasVersion) || (headVersion !== null && !headHasVersion)) {
- return { ok: false, reason: "invalid_adapter_author_contract_version", changedApiPaths };
- }
- if (baseHasVersion && (!headHasVersion || headVersion < baseVersion)) {
- return { ok: false, reason: "adapter_author_contract_version_must_not_regress", changedApiPaths };
- }
- if (baseHasVersion && headHasVersion && headVersion > baseVersion) {
- const isBreakingReportChange = adapterAuthorReportChanged
- && selectedLabels.length === 1
- && selectedLabels[0] === "api-breaking";
- if (!isBreakingReportChange) {
- return { ok: false, reason: "adapter_author_contract_version_bump_requires_breaking_report", changedApiPaths };
- }
- }
- if (adapterAuthorReportChanged && !headHasVersion) {
- return { ok: false, reason: "adapter_author_contract_version_required", changedApiPaths };
- }
- if (baseVersion === null && headHasVersion) {
- const isBreakingBootstrap = adapterAuthorReportChanged
- && selectedLabels.length === 1
- && selectedLabels[0] === "api-breaking"
- && headVersion === 1;
- if (!isBreakingBootstrap) {
- return { ok: false, reason: "adapter_author_contract_version_bootstrap_requires_breaking_v1", changedApiPaths };
- }
- }
- if (selectedLabels.length !== 1) {
- return { ok: false, reason: "exactly_one_api_label_required", changedApiPaths };
- }
- }
-
- const latestByReviewer = new Map();
- for (const review of [...input.reviews].sort((a, b) => a.id - b.id)) {
- latestByReviewer.set(review.login.toLowerCase(), review);
- }
- const author = input.prAuthor.toLowerCase();
- const owners = new Set(input.owners.map((owner) => owner.toLowerCase()));
- const approver = [...latestByReviewer.values()].find((review) =>
- owners.has(review.login.toLowerCase())
- && review.login.toLowerCase() !== author
- && review.state === "APPROVED"
- && review.commitId === input.headSha
- );
- if (!approver) {
- return {
- ok: false,
- reason: "current_head_independent_owner_approval_required",
- changedApiPaths,
- changedMechanismPaths,
- };
- }
-
- if (selectedLabels[0] === "api-breaking" && adapterAuthorReportChanged) {
- const isInitialVersion = baseVersion === null && headVersion === 1;
- const isIncrement = baseHasVersion && headHasVersion && headVersion > baseVersion;
- if (!isInitialVersion && !isIncrement) {
- return { ok: false, reason: "adapter_author_contract_version_must_increase", changedApiPaths };
- }
- }
-
- return { ok: true, reason: "approved", approver: approver.login, changedApiPaths, changedMechanismPaths };
-}
-
-export async function githubJson(url, token, allowNotFound = false) {
- const response = await fetch(url, {
- headers: {
- Accept: "application/vnd.github+json",
- Authorization: `Bearer ${token}`,
- "X-GitHub-Api-Version": "2022-11-28",
- },
- });
- if (allowNotFound && response.status === 404) return null;
- if (!response.ok) throw new Error(`GitHub API failed: ${response.status}`);
- return response.json();
-}
-
-export async function fetchAllPages(repository, pullNumber, resource, token) {
- const values = [];
- for (let page = 1; ; page += 1) {
- const pageValues = await githubJson(
- `https://api.github.com/repos/${repository}/pulls/${pullNumber}/${resource}?per_page=100&page=${page}`,
- token,
- );
- values.push(...pageValues);
- if (pageValues.length < 100) break;
- }
- return values;
-}
-
-export async function fetchAllReviews(repository, pullNumber, token) {
- const reviews = await fetchAllPages(repository, pullNumber, "reviews", token);
- return reviews.filter((review) => review.user?.login).map((review) => ({
- id: review.id,
- login: review.user.login,
- state: review.state,
- commitId: review.commit_id,
- }));
-}
-
-export async function contractVersionAt(repository, sha, token) {
- const path = "src/daemon/agent-driver/src/adapter-author.ts";
- const value = await githubJson(
- `https://api.github.com/repos/${repository}/contents/${path}?ref=${sha}`,
- token,
- true,
- );
- if (!value?.content || value.encoding !== "base64") return null;
- const source = Buffer.from(value.content, "base64").toString("utf8");
- return parseAdapterAuthorContractVersion(source);
-}
-
-export async function main() {
- const required = ["API_BASE_SHA", "API_HEAD_SHA", "API_PR_AUTHOR", "API_PR_NUMBER", "API_REPOSITORY", "API_GITHUB_TOKEN"];
- for (const name of required) {
- if (!process.env[name]) throw new Error(`Missing ${name}`);
- }
- const baseSha = process.env.API_BASE_SHA;
- const headSha = process.env.API_HEAD_SHA;
- if (!/^[0-9a-f]{40}$/i.test(baseSha) || !/^[0-9a-f]{40}$/i.test(headSha)) {
- throw new Error("Invalid base/head SHA");
- }
- const repository = process.env.API_REPOSITORY;
- const pullNumber = process.env.API_PR_NUMBER;
- const token = process.env.API_GITHUB_TOKEN;
- const pull = await githubJson(`https://api.github.com/repos/${repository}/pulls/${pullNumber}`, token);
- if (pull.base.sha !== baseSha || pull.head.sha !== headSha || pull.user.login !== process.env.API_PR_AUTHOR) {
- throw new Error("Pull request identity changed while evaluating API approval");
- }
- const changedPaths = collectChangedPaths(
- await fetchAllPages(repository, pullNumber, "files", token),
- pull.changed_files,
- );
- const labels = JSON.parse(process.env.API_LABELS_JSON ?? "[]").map((label) =>
- typeof label === "string" ? label : label.name
- );
- const scriptRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
- const ownerConfig = JSON.parse(await readFile(resolve(scriptRoot, ".github/api-surface-owners.json"), "utf8"));
- const reviews = await fetchAllReviews(repository, pullNumber, token);
- const result = evaluateApiSurfaceGuard({
- changedPaths,
- labels,
- reviews,
- owners: ownerConfig.owners,
- prAuthor: process.env.API_PR_AUTHOR,
- headSha,
- baseContractVersion: await contractVersionAt(repository, baseSha, token),
- headContractVersion: await contractVersionAt(repository, headSha, token),
- });
- process.stdout.write(`${JSON.stringify(result)}\n`);
- if (!result.ok) process.exitCode = 1;
-}
-
-if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) await main();
diff --git a/scripts/ci/api-surface-guard.test.ts b/scripts/ci/api-surface-guard.test.ts
deleted file mode 100644
index 25f154777..000000000
--- a/scripts/ci/api-surface-guard.test.ts
+++ /dev/null
@@ -1,454 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { readFileSync } from "node:fs";
-import { resolve } from "node:path";
-import {
- collectChangedPaths,
- contractVersionAt,
- evaluateApiSurfaceGuard,
- fetchAllPages,
- fetchAllReviews,
- githubJson,
- main,
- parseAdapterAuthorContractVersion,
-} from "./api-surface-guard.mjs";
-
-const headSha = "b".repeat(40);
-const publicSource = "src/daemon/agent-driver/src/adapter-author.ts";
-const golden = "src/daemon/agent-driver/etc/api/adapter-author.api.md";
-const ownerApproval = { id: 1, login: "independent-owner", state: "APPROVED", commitId: headSha };
-
-const requiredCliEnv = {
- API_BASE_SHA: "a".repeat(40),
- API_HEAD_SHA: headSha,
- API_PR_AUTHOR: "author",
- API_PR_NUMBER: "510",
- API_REPOSITORY: "alookai/alook",
- API_GITHUB_TOKEN: "test-token",
-};
-
-function response(body: unknown, status = 200): Response {
- return {
- ok: status >= 200 && status < 300,
- status,
- json: async () => body,
- } as Response;
-}
-
-function stubCliEnv(labels?: unknown[]) {
- for (const [name, value] of Object.entries(requiredCliEnv)) vi.stubEnv(name, value);
- if (labels === undefined) delete process.env.API_LABELS_JSON;
- else vi.stubEnv("API_LABELS_JSON", JSON.stringify(labels));
-}
-
-function contractSource(version: number) {
- return Buffer.from(`export const ADAPTER_AUTHOR_CONTRACT_VERSION = ${version} as const;\n`).toString("base64");
-}
-
-afterEach(() => {
- vi.restoreAllMocks();
- vi.unstubAllEnvs();
- process.exitCode = undefined;
-});
-
-function evaluate(overrides: Record<string, unknown> = {}) {
- return evaluateApiSurfaceGuard({
- changedPaths: [publicSource],
- labels: ["api-additive"],
- reviews: [ownerApproval],
- owners: ["author", "independent-owner"],
- prAuthor: "author",
- headSha,
- baseContractVersion: 1,
- headContractVersion: 1,
- ...overrides,
- } as never);
-}
-
-describe("api surface approval guard", () => {
- it("requires exactly one API change label for public source", () => {
- expect(evaluate({ labels: [] })).toMatchObject({ ok: false, reason: "exactly_one_api_label_required" });
- expect(evaluate({ labels: ["api-additive", "api-breaking"] }))
- .toMatchObject({ ok: false, reason: "exactly_one_api_label_required" });
- });
-
- it("rejects source plus golden drift without an independent current-head owner approval", () => {
- expect(evaluate({ changedPaths: [publicSource, golden], reviews: [] }))
- .toMatchObject({ ok: false, reason: "current_head_independent_owner_approval_required" });
- expect(evaluate({ reviews: [{ ...ownerApproval, login: "author" }] }))
- .toMatchObject({ ok: false, reason: "current_head_independent_owner_approval_required" });
- expect(evaluate({ reviews: [{ ...ownerApproval, commitId: "a".repeat(40) }] }))
- .toMatchObject({ ok: false, reason: "current_head_independent_owner_approval_required" });
- });
-
- it("accepts an allow-listed independent approval on the exact head", () => {
- expect(evaluate({
- reviews: [
- { ...ownerApproval, id: 2 },
- { ...ownerApproval, id: 1, state: "CHANGES_REQUESTED" },
- ],
- })).toMatchObject({ ok: true, reason: "approved", approver: "independent-owner" });
- });
-
- it("allows only version 1 when bootstrapping the adapter-author contract", () => {
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-breaking"],
- baseContractVersion: null,
- headContractVersion: 1,
- })).toMatchObject({ ok: true });
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-breaking"],
- baseContractVersion: null,
- headContractVersion: 2,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bootstrap_requires_breaking_v1" });
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-additive"],
- baseContractVersion: null,
- headContractVersion: 1,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bootstrap_requires_breaking_v1" });
- expect(evaluate({
- changedPaths: [golden],
- labels: [],
- baseContractVersion: null,
- headContractVersion: 1,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bootstrap_requires_breaking_v1" });
- });
-
- it("requires an established adapter-author contract version to increase for a breaking report", () => {
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-breaking"],
- baseContractVersion: 1,
- headContractVersion: 1,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_must_increase" });
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-breaking"],
- baseContractVersion: 1,
- headContractVersion: 2,
- })).toMatchObject({ ok: true });
- });
-
- it("forbids established contract removal or regression regardless of the API label", () => {
- for (const labels of [["api-additive"], ["api-breaking"], []]) {
- expect(evaluate({
- changedPaths: [golden],
- labels,
- baseContractVersion: 2,
- headContractVersion: 1,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_must_not_regress" });
- expect(evaluate({
- changedPaths: [golden],
- labels,
- baseContractVersion: 1,
- headContractVersion: null,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_must_not_regress" });
- }
- });
-
- it("allows established version bumps only for a breaking adapter-author report", () => {
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-additive"],
- baseContractVersion: 1,
- headContractVersion: 2,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bump_requires_breaking_report" });
- expect(evaluate({
- changedPaths: [publicSource],
- labels: ["api-breaking"],
- baseContractVersion: 1,
- headContractVersion: 2,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bump_requires_breaking_report" });
- expect(evaluate({
- changedPaths: [golden],
- labels: [],
- baseContractVersion: 1,
- headContractVersion: 2,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_bump_requires_breaking_report" });
- });
-
- it("reads one canonical contract declaration as the first non-comment statement", () => {
- expect(parseAdapterAuthorContractVersion([
- "/** Adapter-author contract version. */",
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 1 as const;",
- "export type Example = string;",
- ].join("\n"))).toBe(1);
- expect(parseAdapterAuthorContractVersion([
- "\ufeff // leading line comment",
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 2;",
- ].join("\n"))).toBe(2);
- expect(parseAdapterAuthorContractVersion("export type Example = string;\n")).toBeNull();
- });
-
- it("rejects comment and string decoys instead of reading them as a bump", () => {
- expect(() => parseAdapterAuthorContractVersion([
- "// ADAPTER_AUTHOR_CONTRACT_VERSION = 2",
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 1 as const;",
- ].join("\n"))).toThrow("Multiple adapter-author contract version references");
- expect(() => parseAdapterAuthorContractVersion([
- "const decoy = `export const ADAPTER_AUTHOR_CONTRACT_VERSION = 2`;",
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 1 as const;",
- ].join("\n"))).toThrow("Multiple adapter-author contract version references");
- expect(() => parseAdapterAuthorContractVersion(
- "const decoy = 'ADAPTER_AUTHOR_CONTRACT_VERSION = 2';",
- )).toThrow("Invalid adapter-author contract version declaration");
- });
-
- it("fails closed on multiple exported contract declarations", () => {
- expect(() => parseAdapterAuthorContractVersion([
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 1",
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 2",
- ].join("\n"))).toThrow("Multiple adapter-author contract version references");
- expect(() => parseAdapterAuthorContractVersion(
- "/* ADAPTER_AUTHOR_CONTRACT_VERSION",
- )).toThrow("Unterminated leading comment in adapter-author contract source");
- expect(() => parseAdapterAuthorContractVersion(
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 0;",
- )).toThrow("Invalid adapter-author contract version declaration");
- expect(() => parseAdapterAuthorContractVersion(
- "export const ADAPTER_AUTHOR_CONTRACT_VERSION = 999999999999999999999999;",
- )).toThrow("Invalid adapter-author contract version declaration");
- });
-
- it("includes a rename's protected previous path without inflating the returned file count", () => {
- const changedPaths = collectChangedPaths([{
- filename: "src/daemon/agent-driver/src/internal/legacy-adapter-author.ts",
- previous_filename: publicSource,
- }], 1);
- expect(changedPaths).toEqual([
- "src/daemon/agent-driver/src/internal/legacy-adapter-author.ts",
- publicSource,
- ]);
- expect(evaluate({ changedPaths, labels: [], reviews: [] }))
- .toMatchObject({ ok: false, reason: "exactly_one_api_label_required" });
- });
-
- it("fails closed when the pull request files response is incomplete", () => {
- expect(() => collectChangedPaths([
- { filename: "src/daemon/agent-driver/src/adapters/claude/index.ts" },
- ], 2)).toThrow("Incomplete pull request files response: expected 2, received 1");
- expect(() => collectChangedPaths(null as never, 0)).toThrow("Invalid pull request files response");
- expect(() => collectChangedPaths([], -1)).toThrow("Invalid pull request changed_files count");
- expect(() => collectChangedPaths([null] as never, 1)).toThrow("Invalid pull request file entry");
- expect(() => collectChangedPaths([{ filename: publicSource, previous_filename: "" }], 1))
- .toThrow("Invalid pull request previous filename");
- });
-
- it("rejects invalid version values and a missing version on adapter-author report drift", () => {
- expect(evaluate({ baseContractVersion: 0 }))
- .toMatchObject({ ok: false, reason: "invalid_adapter_author_contract_version" });
- expect(evaluate({
- changedPaths: [golden],
- labels: ["api-breaking"],
- baseContractVersion: null,
- headContractVersion: null,
- })).toMatchObject({ ok: false, reason: "adapter_author_contract_version_required" });
- });
-
- it("does not require an API label or review for unrelated internal changes", () => {
- expect(evaluate({
- changedPaths: ["src/daemon/agent-driver/src/adapters/claude/index.ts"],
- labels: [],
- reviews: [],
- })).toEqual({ ok: true, reason: "no_api_surface_change" });
- });
-
- it("protects the API report generation chain and trusted guard mechanism itself", () => {
- const mechanismPaths = [
- ".github/CODEOWNERS",
- ".github/api-surface-owners.json",
- ".github/workflows/api-surface-check.yml",
- ".github/workflows/api-surface-guard.yml",
- "package.json",
- "pnpm-lock.yaml",
- "pnpm-workspace.yaml",
- "scripts/ci/api-report-contract.test.ts",
- "scripts/ci/api-surface-guard.mjs",
- "scripts/ci/api-surface-guard.test.ts",
- "src/daemon/agent-driver/api-extractor.adapter-author.json",
- "src/daemon/agent-driver/api-extractor.host.json",
- "src/daemon/agent-driver/api-extractor.root.json",
- "src/daemon/agent-driver/api-extractor.testing.json",
- "src/daemon/agent-driver/package.json",
- "src/daemon/agent-driver/scripts/api-reports.mjs",
- "src/daemon/agent-driver/scripts/prepare-dist.mjs",
- "src/daemon/agent-driver/scripts/prune-dist.mjs",
- "src/daemon/agent-driver/tsconfig.build.json",
- "src/daemon/agent-driver/tsconfig.json",
- "vitest.config.ts",
- ];
- for (const path of mechanismPaths) {
- expect(evaluate({ changedPaths: [path], labels: [], reviews: [] }))
- .toMatchObject({ ok: false, reason: "current_head_independent_owner_approval_required" });
- expect(evaluate({ changedPaths: [path], labels: [], reviews: [ownerApproval] }))
- .toMatchObject({ ok: true, reason: "approved", changedApiPaths: [], changedMechanismPaths: [path] });
- }
- });
-
- it("still requires one API label when surface and mechanism paths change together", () => {
- expect(evaluate({
- changedPaths: [publicSource, "scripts/ci/api-surface-guard.mjs"],
- labels: [],
- reviews: [ownerApproval],
- })).toMatchObject({ ok: false, reason: "exactly_one_api_label_required" });
- });
-
- it("keeps approval enforcement base-owned and never executes pull-request head code", () => {
- const workflow = readFileSync(resolve(process.cwd(), ".github/workflows/api-surface-guard.yml"), "utf8");
- const lfWorkflow = workflow.replaceAll("\r\n", "\n");
- for (const workflowSource of [lfWorkflow, lfWorkflow.replaceAll("\n", "\r\n")]) {
- const normalizedWorkflow = workflowSource.replaceAll("\r\n", "\n");
- expect(normalizedWorkflow).toContain("pull_request_target:");
- expect(normalizedWorkflow).toMatch(/pull_request_review:\n\s+types: \[submitted, dismissed\]/);
- expect(normalizedWorkflow).toContain("if: github.event.pull_request.base.ref == 'main'");
- expect(normalizedWorkflow).toContain("ref: ${{ github.event.pull_request.base.sha }}");
- expect(normalizedWorkflow).not.toContain("pnpm install");
- expect(normalizedWorkflow).not.toContain("pull request head");
- expect(normalizedWorkflow).not.toContain("if [[ ! -f");
- }
- });
-
- it("handles GitHub JSON success, not-found, and error responses", async () => {
- const fetchMock = vi.fn()
- .mockResolvedValueOnce(response({ ok: true }))
- .mockResolvedValueOnce(response({}, 404))
- .mockResolvedValueOnce(response({}, 500));
- vi.stubGlobal("fetch", fetchMock);
-
- await expect(githubJson("https://example.test/success", "token"))
- .resolves.toEqual({ ok: true });
- await expect(githubJson("https://example.test/missing", "token", true)).resolves.toBeNull();
- await expect(githubJson("https://example.test/error", "token"))
- .rejects.toThrow("GitHub API failed: 500");
- expect(fetchMock).toHaveBeenCalledWith("https://example.test/success", {
- headers: {
- Accept: "application/vnd.github+json",
- Authorization: "Bearer token",
- "X-GitHub-Api-Version": "2022-11-28",
- },
- });
- });
-
- it("paginates GitHub resources and normalizes review identities", async () => {
- const firstPage = Array.from({ length: 100 }, (_, id) => ({ id }));
- const fetchMock = vi.fn()
- .mockResolvedValueOnce(response(firstPage))
- .mockResolvedValueOnce(response([{ id: 100 }]))
- .mockResolvedValueOnce(response([
- { id: 1, user: { login: "owner" }, state: "APPROVED", commit_id: headSha },
- { id: 2, user: null, state: "COMMENTED", commit_id: headSha },
- ]));
- vi.stubGlobal("fetch", fetchMock);
-
- await expect(fetchAllPages("alookai/alook", "510", "files", "token"))
- .resolves.toHaveLength(101);
- await expect(fetchAllReviews("alookai/alook", "510", "token")).resolves.toEqual([{
- id: 1,
- login: "owner",
- state: "APPROVED",
- commitId: headSha,
- }]);
- expect(fetchMock.mock.calls.map(([url]) => url)).toEqual([
- "https://api.github.com/repos/alookai/alook/pulls/510/files?per_page=100&page=1",
- "https://api.github.com/repos/alookai/alook/pulls/510/files?per_page=100&page=2",
- "https://api.github.com/repos/alookai/alook/pulls/510/reviews?per_page=100&page=1",
- ]);
- });
-
- it("reads contract versions from GitHub contents and treats absent files as unversioned", async () => {
- vi.stubGlobal("fetch", vi.fn()
- .mockResolvedValueOnce(response({}, 404))
- .mockResolvedValueOnce(response({ content: "not-used", encoding: "utf8" }))
- .mockResolvedValueOnce(response({ content: contractSource(3), encoding: "base64" })));
-
- await expect(contractVersionAt("alookai/alook", requiredCliEnv.API_BASE_SHA, "token"))
- .resolves.toBeNull();
- await expect(contractVersionAt("alookai/alook", requiredCliEnv.API_BASE_SHA, "token"))
- .resolves.toBeNull();
- await expect(contractVersionAt("alookai/alook", requiredCliEnv.API_HEAD_SHA, "token"))
- .resolves.toBe(3);
- });
-
- it("runs the real CLI orchestration against validated pull identity", async () => {
- stubCliEnv([{ name: "api-additive" }]);
- const fetchMock = vi.fn(async (input: string | URL | Request) => {
- const url = String(input);
- if (url.endsWith("/pulls/510")) {
- return response({
- base: { sha: requiredCliEnv.API_BASE_SHA },
- head: { sha: requiredCliEnv.API_HEAD_SHA },
- user: { login: requiredCliEnv.API_PR_AUTHOR },
- changed_files: 1,
- });
- }
- if (url.includes("/files?")) return response([{ filename: publicSource }]);
- if (url.includes("/reviews?")) {
- return response([{
- id: 1,
- user: { login: "GenerQAQ" },
- state: "APPROVED",
- commit_id: requiredCliEnv.API_HEAD_SHA,
- }]);
- }
- if (url.includes(`/contents/${publicSource}?ref=${requiredCliEnv.API_BASE_SHA}`)) {
- return response({ content: contractSource(1), encoding: "base64" });
- }
- if (url.includes(`/contents/${publicSource}?ref=${requiredCliEnv.API_HEAD_SHA}`)) {
- return response({ content: contractSource(1), encoding: "base64" });
- }
- throw new Error(`Unexpected URL: ${url}`);
- });
- vi.stubGlobal("fetch", fetchMock);
- const write = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
-
- await main();
-
- expect(write).toHaveBeenCalledWith(expect.stringContaining('"reason":"approved"'));
- expect(process.exitCode).toBeUndefined();
- });
-
- it("fails the CLI closed for invalid invocation, identity drift, and rejected policy", async () => {
- stubCliEnv();
- delete process.env.API_GITHUB_TOKEN;
- await expect(main()).rejects.toThrow("Missing API_GITHUB_TOKEN");
-
- vi.stubEnv("API_GITHUB_TOKEN", requiredCliEnv.API_GITHUB_TOKEN);
- vi.stubEnv("API_BASE_SHA", "not-a-sha");
- await expect(main()).rejects.toThrow("Invalid base/head SHA");
-
- vi.stubEnv("API_BASE_SHA", requiredCliEnv.API_BASE_SHA);
- vi.stubGlobal("fetch", vi.fn().mockResolvedValue(response({
- base: { sha: requiredCliEnv.API_BASE_SHA },
- head: { sha: requiredCliEnv.API_HEAD_SHA },
- user: { login: "different-author" },
- changed_files: 0,
- })));
- await expect(main()).rejects.toThrow("Pull request identity changed while evaluating API approval");
-
- vi.stubGlobal("fetch", vi.fn(async (input: string | URL | Request) => {
- const url = String(input);
- if (url.endsWith("/pulls/510")) {
- return response({
- base: { sha: requiredCliEnv.API_BASE_SHA },
- head: { sha: requiredCliEnv.API_HEAD_SHA },
- user: { login: requiredCliEnv.API_PR_AUTHOR },
- changed_files: 1,
- });
- }
- if (url.includes("/files?")) return response([{ filename: "scripts/ci/api-surface-guard.mjs" }]);
- if (url.includes("/reviews?")) return response([]);
- if (url.includes("/contents/")) return response({}, 404);
- throw new Error(`Unexpected URL: ${url}`);
- }));
- const write = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
-
- await main();
-
- expect(write).toHaveBeenCalledWith(expect.stringContaining(
- '"reason":"current_head_independent_owner_approval_required"',
- ));
- expect(process.exitCode).toBe(1);
- });
-});
diff --git a/scripts/ci/workflow-contract.test.ts b/scripts/ci/workflow-contract.test.ts
index 3bdcebc7e..4ad6f8f7c 100644
--- a/scripts/ci/workflow-contract.test.ts
+++ b/scripts/ci/workflow-contract.test.ts
@@ -10,6 +10,10 @@ function normalizeWorkflow(text: string): string {
const workflow = normalizeWorkflow(readFileSync(resolve(workflowRoot, "e2e-ui.yml"), "utf8"))
const ciWorkflow = normalizeWorkflow(readFileSync(resolve(workflowRoot, "ci.yml"), "utf8"))
+const playwrightConfig = readFileSync(
+ resolve(import.meta.dirname, "../../src/web/playwright.config.ts"),
+ "utf8",
+)
type WorkerModuleContract = {
name: string
packageJson: {
@@ -77,7 +81,12 @@ const publishDaemonWorkflow = normalizeWorkflow(
)
const agentDriverPackage = JSON.parse(
readFileSync(resolve(repositoryRoot, "src/daemon/agent-driver/package.json"), "utf8"),
-) as { private?: boolean; publishConfig?: unknown }
+) as {
+ private?: boolean
+ publishConfig?: unknown
+ scripts: Record<string, string>
+ devDependencies: Record<string, string>
+}
const daemonPackage = JSON.parse(
readFileSync(resolve(repositoryRoot, "src/daemon/package.json"), "utf8"),
) as { devDependencies?: Record<string, string> }
@@ -91,14 +100,34 @@ function ciJob(name: string): string {
}
describe("E2E UI workflow", () => {
- it("runs before merge without running on main pushes", () => {
+ it("runs before merge and manually without push or schedule triggers", () => {
expect(workflow).toMatch(/^ pull_request:/m)
expect(workflow).toMatch(/^ merge_group:/m)
+ expect(workflow).toMatch(/^ workflow_dispatch:/m)
expect(workflow).not.toMatch(/^ push:/m)
+ expect(workflow).not.toMatch(/^ schedule:/m)
})
- it("uploads service logs when a Playwright shard fails", () => {
+ it("keeps failure diagnostics best-effort and merge inputs strict", () => {
expect(workflow).toContain("src/web/e2e-service-logs/")
+ expect(workflow).toContain("continue-on-error: true")
+ expect(workflow).toContain("if-no-files-found: ignore")
+ expect(workflow).toContain("retention-days: 7")
+ expect(workflow).toContain(
+ "name: blob-report-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.shard }}",
+ )
+ expect(workflow).toContain(
+ "pattern: blob-report-${{ github.run_id }}-${{ github.run_attempt }}-*",
+ )
+ expect(workflow).toContain(
+ "name: playwright-merge-runtime-${{ github.run_id }}-${{ github.run_attempt }}",
+ )
+ expect(workflow.match(/if-no-files-found: error/g)).toHaveLength(2)
+ expect(workflow.match(/continue-on-error: true/g)).toHaveLength(1)
+ })
+
+ it("reports shard failures directly to GitHub Checks", () => {
+ expect(playwrightConfig).toContain('[["blob"], ["github"], ["list"]]')
})
it("does not install Bun for Node-only browser tests", () => {
@@ -122,7 +151,7 @@ describe("Bun workflow setup", () => {
})
it("installs pinned Bun in every CI job that builds a daemon package fixture", () => {
- const bunJobs = ["test-linux", "test-windows", "build", "coverage"]
+ const bunJobs = ["static-checks", "test-linux", "test-windows"]
expect(ciWorkflow.match(/oven-sh\/setup-bun/g)).toHaveLength(bunJobs.length)
for (const job of bunJobs) {
expect(ciJob(job)).toContain("oven-sh/setup-bun")
@@ -135,6 +164,41 @@ describe("Bun workflow setup", () => {
})
})
+describe("CI workflow graph", () => {
+ it("keeps approved triggers without a daily schedule", () => {
+ expect(ciWorkflow).toMatch(/^ push:/m)
+ expect(ciWorkflow).toMatch(/^ pull_request:/m)
+ expect(ciWorkflow).toMatch(/^ merge_group:/m)
+ expect(ciWorkflow).toMatch(/^ workflow_dispatch:/m)
+ expect(ciWorkflow).not.toMatch(/^ schedule:/m)
+ })
+
+ it("consolidates static work and preserves non-blocking Knip steps", () => {
+ const staticChecks = ciJob("static-checks")
+ expect(ciWorkflow).not.toMatch(/^ quality:/m)
+ expect(ciWorkflow).not.toMatch(/^ knip:/m)
+ expect(ciWorkflow).not.toMatch(/^ build:/m)
+ expect(staticChecks.match(/pnpm install --frozen-lockfile/g)).toHaveLength(1)
+ expect(staticChecks.match(/continue-on-error: true/g)).toHaveLength(2)
+ expect(staticChecks).toContain("run: pnpm typecheck")
+ expect(staticChecks).toContain("run: pnpm lint")
+ expect(staticChecks).toContain("run: pnpm build")
+ expect(staticChecks).toContain("run: pnpm knip")
+ })
+
+ it("gates the consolidated jobs under the stable CI Gate", () => {
+ const gate = ciJob("ci-gate")
+ for (const job of ["static-checks", "test-linux", "test-windows"]) {
+ expect(gate).toContain(`- ${job}`)
+ expect(gate).toContain(`"name":"${job}"`)
+ }
+ for (const removed of ["quality", "knip", "build", "coverage"]) {
+ expect(gate).not.toContain(`- ${removed}`)
+ expect(gate).not.toContain(`"name":"${removed}"`)
+ }
+ })
+})
+
describe("Private agent driver package", () => {
it("remains an independent private workspace dependency of the daemon", () => {
expect(agentDriverPackage.private).toBe(true)
@@ -153,6 +217,27 @@ describe("Private agent driver package", () => {
expect(driverBuild).toBeGreaterThan(0)
expect(daemonBuild).toBeGreaterThan(driverBuild)
})
+
+ it("keeps runtime and artifact contracts without the removed API report mechanism", () => {
+ expect(agentDriverPackage.scripts).not.toHaveProperty("api:check")
+ expect(agentDriverPackage.scripts).not.toHaveProperty("api:update")
+ expect(agentDriverPackage.devDependencies).not.toHaveProperty("@microsoft/api-extractor")
+ expect(rootPackageJson.scripts).not.toHaveProperty("api:check")
+ expect(rootPackageJson.scripts).not.toHaveProperty("api:update")
+ for (const path of [
+ ".github/api-surface-owners.json",
+ ".github/workflows/api-surface-check.yml",
+ ".github/workflows/api-surface-guard.yml",
+ "scripts/ci/api-report-contract.test.ts",
+ "scripts/ci/api-surface-guard.mjs",
+ "scripts/ci/api-surface-guard.test.ts",
+ "src/daemon/agent-driver/scripts/api-reports.mjs",
+ "src/daemon/agent-driver/etc/api/root.api.md",
+ "src/daemon/agent-driver/api-extractor.root.json",
+ ]) {
+ expect(existsSync(resolve(repositoryRoot, path))).toBe(false)
+ }
+ })
})
describe("CI test budgets", () => {
@@ -187,14 +272,18 @@ describe("CI test budgets", () => {
expect(windows).toContain("fail_ci_if_error: true")
})
- it("does not rerun Windows process-bearing packages inside the Turbo workspace step", () => {
+ it("runs only Windows-relevant workspace packages after the process-bearing suites", () => {
const windows = ciJob("test-windows")
expect(windows).toContain(
- "run: pnpm turbo run test --filter='!@alook/daemon' --filter='!@alook/agent-driver'",
+ "run: pnpm turbo run test --filter=@alook/cli --filter=@alook/app --filter=@alook/shared",
)
expect(windows).toContain(
- "run: pnpm turbo run test --affected --filter='!@alook/daemon' --filter='!@alook/agent-driver'",
+ "run: pnpm turbo run test --affected --filter=@alook/cli --filter=@alook/app --filter=@alook/shared",
)
+ for (const packageName of ["web", "email-worker", "ws-do", "wake-worker"]) {
+ expect(windows).not.toContain(`--filter=@alook/${packageName}`)
+ }
+ expect(windows).not.toContain("--project ci-scripts")
})
})
@@ -223,8 +312,8 @@ describe("CI dependency setup", () => {
})
describe("Turbo CI execution", () => {
- const cachedJobs = ["blog-content", "quality", "knip", "test-linux", "test-windows", "build"]
- const affectedJobs = ["quality", "knip", "test-linux", "test-windows", "build"]
+ const cachedJobs = ["blog-content", "static-checks", "test-linux", "test-windows"]
+ const affectedJobs = ["static-checks", "test-windows"]
it("persists a task cache isolated by operating system, architecture, and job", () => {
expect(ciWorkflow.match(/actions\/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9/g))
@@ -259,22 +348,25 @@ describe("Turbo CI execution", () => {
})
it("retains full commands when scope classification fails closed", () => {
- expect(ciJob("quality")).toContain("run: pnpm typecheck")
- expect(ciJob("quality")).toContain("run: pnpm lint")
- expect(ciJob("knip")).toContain("run: pnpm knip")
+ const staticChecks = ciJob("static-checks")
+ expect(staticChecks).toContain("run: pnpm typecheck")
+ expect(staticChecks).toContain("run: pnpm lint")
+ expect(staticChecks).toContain("run: pnpm knip")
+ expect(staticChecks).toContain(
+ "run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker",
+ )
+ expect(staticChecks.match(/pnpm install --frozen-lockfile/g)).toHaveLength(1)
const linux = ciJob("test-linux")
expect(linux).toContain("run: pnpm turbo run test --filter=@alook/daemon")
const windows = ciJob("test-windows")
expect(windows).toContain("run: pnpm --filter @alook/daemon test")
expect(linux).toContain("run: pnpm turbo run test --filter='!@alook/daemon'")
expect(windows).toContain(
- "run: pnpm turbo run test --filter='!@alook/daemon' --filter='!@alook/agent-driver'",
- )
- for (const definition of [linux, windows])
- expect(definition.match(/VITEST_MAX_WORKERS: 1/g)).toHaveLength(2)
- expect(ciJob("build")).toContain(
- "run: pnpm build --filter=@alook/shared --filter=@alook/web --filter=@alook/cli --filter=@alook/email-worker --filter=@alook/ws-do --filter=@alook/wake-worker",
+ "run: pnpm turbo run test --filter=@alook/cli --filter=@alook/app --filter=@alook/shared",
)
+ for (const definition of [linux, windows]) {
+ expect(definition.match(/VITEST_MAX_WORKERS: 1/g)).toHaveLength(1)
+ }
})
it("runs each direct Worker Node and runtime project once through its standard test task", () => {
@@ -306,6 +398,21 @@ describe("Turbo CI execution", () => {
expect(rootVitestConfig).toContain('"src/**/*.{ts,tsx,js,jsx}"')
expect(rootVitestConfig).toContain('"**/test-runtime/**"')
expect(rootVitestConfig).toContain('"**/test-harness.ts"')
+ for (const project of [
+ "src/shared",
+ "src/web",
+ "src/cli",
+ "src/daemon",
+ "src/daemon/agent-driver",
+ "src/email-worker",
+ "src/ws-do",
+ "src/wake-worker",
+ "src/app",
+ "tests/utils",
+ "scripts/ci",
+ ]) {
+ expect(rootVitestConfig).toContain(`"${project}"`)
+ }
for (const [index, module] of directWorkerModules.entries()) {
expect(rootVitestConfig).toContain(`"src/${module.name}"`)
expect(
@@ -321,13 +428,19 @@ describe("Turbo CI execution", () => {
)
})
- it("uploads the single Istanbul report through the existing Codecov step", () => {
- const coverageJob = ciJob("coverage")
- expect(coverageJob.match(/pnpm vitest run --coverage/g)).toHaveLength(1)
- expect(coverageJob.match(/codecov\/codecov-action/g)).toHaveLength(1)
- expect(coverageJob).toContain("files: ./coverage/coverage-final.json")
- expect(coverageJob).not.toContain("coverage:workers")
- expect(coverageJob).not.toContain("workers-runtime")
+ it("runs tests once and uploads the single Istanbul report only for coverage events", () => {
+ const linux = ciJob("test-linux")
+ expect(linux).toContain(
+ "RUN_COVERAGE: ${{ github.event_name != 'push' || startsWith(github.event.head_commit.message, 'release:') }}",
+ )
+ expect(linux.match(/pnpm vitest run --coverage/g)).toHaveLength(1)
+ expect(linux.match(/codecov\/codecov-action/g)).toHaveLength(1)
+ expect(linux).toContain("if: env.RUN_COVERAGE == 'true'")
+ expect(linux).toContain("if: env.RUN_COVERAGE != 'true'")
+ expect(linux).toContain("files: ./coverage/coverage-final.json")
+ expect(linux).not.toContain("coverage:workers")
+ expect(linux).not.toContain("workers-runtime")
+ expect(ciWorkflow).not.toMatch(/^ coverage:/m)
expect(rootPackageJson.scripts).not.toHaveProperty("coverage:workers")
})
diff --git a/src/daemon/agent-driver/AGENTS.md b/src/daemon/agent-driver/AGENTS.md
index 3d64857bc..00b319a15 100644
--- a/src/daemon/agent-driver/AGENTS.md
+++ b/src/daemon/agent-driver/AGENTS.md
@@ -9,7 +9,7 @@ These rules add to `../AGENTS.md` for the independent
consumer. Its purpose is to make daemon/provider coupling structurally
impossible. Do not fold it into daemon source or change its directory/package
boundary merely because publishing is a lower priority.
-- Keep its manifest, declared exports, build, tests, API reports, ownership, and
+- Keep its manifest, declared exports, build, tests, ownership, and
artifact-isolation checks. Daemon consumes only declared root/host contracts;
it never deep-imports adapters, controllers, transports, provider SDKs, or
internals.
@@ -51,5 +51,5 @@ These rules add to `../AGENTS.md` for the independent
complete process cleanup for every built-in adapter. A fake adapter alone is
not evidence for real providers.
- Adapter-specific behavior may strengthen but never weaken shared semantics.
- Public exports, API reports, and packaged artifacts must preserve the same
+ Public exports and packaged artifacts must preserve the same
boundary as source imports.
diff --git a/src/daemon/agent-driver/api-extractor.adapter-author.json b/src/daemon/agent-driver/api-extractor.adapter-author.json
deleted file mode 100644
index c49fcc001..000000000
--- a/src/daemon/agent-driver/api-extractor.adapter-author.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
- "newlineKind": "lf",
- "mainEntryPointFilePath": "<projectFolder>/dist/adapter-author.d.ts",
- "apiReport": {
- "enabled": true,
- "reportFileName": "adapter-author",
- "reportFolder": "<projectFolder>/etc/api",
- "reportTempFolder": "<projectFolder>/temp/api"
- },
- "docModel": { "enabled": false },
- "dtsRollup": { "enabled": false },
- "tsdocMetadata": { "enabled": false },
- "messages": {
- "extractorMessageReporting": {
- "ae-missing-release-tag": { "logLevel": "none" },
- "ae-forgotten-export": { "logLevel": "error", "addToApiReportFile": false }
- }
- }
-}
diff --git a/src/daemon/agent-driver/api-extractor.host.json b/src/daemon/agent-driver/api-extractor.host.json
deleted file mode 100644
index 3e121c7bc..000000000
--- a/src/daemon/agent-driver/api-extractor.host.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
- "newlineKind": "lf",
- "mainEntryPointFilePath": "<projectFolder>/dist/host.d.ts",
- "apiReport": {
- "enabled": true,
- "reportFileName": "host",
- "reportFolder": "<projectFolder>/etc/api",
- "reportTempFolder": "<projectFolder>/temp/api"
- },
- "docModel": { "enabled": false },
- "dtsRollup": { "enabled": false },
- "tsdocMetadata": { "enabled": false },
- "messages": {
- "extractorMessageReporting": {
- "ae-missing-release-tag": { "logLevel": "none" },
- "ae-forgotten-export": { "logLevel": "error", "addToApiReportFile": false }
- }
- }
-}
diff --git a/src/daemon/agent-driver/api-extractor.root.json b/src/daemon/agent-driver/api-extractor.root.json
deleted file mode 100644
index de0842f68..000000000
--- a/src/daemon/agent-driver/api-extractor.root.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
- "newlineKind": "lf",
- "mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
- "apiReport": {
- "enabled": true,
- "reportFileName": "root",
- "reportFolder": "<projectFolder>/etc/api",
- "reportTempFolder": "<projectFolder>/temp/api"
- },
- "docModel": { "enabled": false },
- "dtsRollup": { "enabled": false },
- "tsdocMetadata": { "enabled": false },
- "messages": {
- "extractorMessageReporting": {
- "ae-missing-release-tag": { "logLevel": "none" },
- "ae-forgotten-export": { "logLevel": "error", "addToApiReportFile": false }
- }
- }
-}
diff --git a/src/daemon/agent-driver/api-extractor.testing.json b/src/daemon/agent-driver/api-extractor.testing.json
deleted file mode 100644
index 8046fb73e..000000000
--- a/src/daemon/agent-driver/api-extractor.testing.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
- "newlineKind": "lf",
- "mainEntryPointFilePath": "<projectFolder>/dist/testing/index.d.ts",
- "apiReport": {
- "enabled": true,
- "reportFileName": "testing",
- "reportFolder": "<projectFolder>/etc/api",
- "reportTempFolder": "<projectFolder>/temp/api"
- },
- "docModel": { "enabled": false },
- "dtsRollup": { "enabled": false },
- "tsdocMetadata": { "enabled": false },
- "messages": {
- "extractorMessageReporting": {
- "ae-missing-release-tag": { "logLevel": "none" },
- "ae-forgotten-export": { "logLevel": "error", "addToApiReportFile": false }
- }
- }
-}
diff --git a/src/daemon/agent-driver/etc/api/adapter-author.api.md b/src/daemon/agent-driver/etc/api/adapter-author.api.md
deleted file mode 100644
index dc209f657..000000000
--- a/src/daemon/agent-driver/etc/api/adapter-author.api.md
+++ /dev/null
@@ -1,1068 +0,0 @@
-## API Report File for "@alook/agent-driver"
-
-> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
-
-```ts
-
-// @public
-export const ADAPTER_AUTHOR_CONTRACT_VERSION: 1;
-
-// @public (undocumented)
-export type AdapterEvent = {
- kind: "session_init";
- sessionId: string;
-} | {
- kind: "thinking";
- text: string;
-} | {
- kind: "text";
- text: string;
-} | {
- kind: "tool_call";
- name: string;
- input: unknown;
-} | {
- kind: "tool_output";
- name: string;
-} | {
- kind: "compaction_started";
-} | {
- kind: "compaction_finished";
-} | {
- kind: "review_started";
-} | {
- kind: "review_finished";
-} | {
- kind: "internal_progress";
- source?: string;
- itemType?: string;
- payloadBytes?: number;
-} | {
- kind: "runtime_diagnostic";
- severity?: string;
- source?: string;
- message: string;
-} | {
- kind: "runtime_metric";
- name: "sse_reconnect";
- increment: 1;
-} | {
- kind: "turn_owner";
- receipt: string;
-} | {
- kind: "turn_end";
- sessionId?: string;
- turnOwner?: string;
-} | {
- kind: "error";
- message: string;
-} | {
- kind: "telemetry";
- name: "token_usage" | "rate_limits";
- source: string;
- usageKind?: string;
- attrs: Record<string, unknown>;
-};
-
-// @public (undocumented)
-export interface AdapterLaunchConfig<Config = BackendConfig> {
- // (undocumented)
- agentDiscriminator?: string;
- // (undocumented)
- agentHandle?: string;
- // (undocumented)
- agentName?: string;
- // (undocumented)
- description?: string;
- // (undocumented)
- ownerHandle?: string;
- // (undocumented)
- runtimeConfig?: Config;
- // (undocumented)
- runtimeContext?: AdapterRuntimeContext;
- // (undocumented)
- sessionId?: string;
-}
-
-// @public (undocumented)
-export interface AdapterLaunchContext<Id extends string = BuiltinBackendId, Config = BackendConfig> {
- // (undocumented)
- agentId: string;
- // (undocumented)
- backend: Id;
- // (undocumented)
- config: AdapterLaunchConfig<Config>;
- // (undocumented)
- launchId: string;
- // (undocumented)
- prepared: PreparedExecutionResource;
- // (undocumented)
- prompt: string;
- // (undocumented)
- standingPrompt: string;
- // (undocumented)
- workingDirectory: string;
-}
-
-// @public (undocumented)
-export interface AdapterRuntimeContext {
- // (undocumented)
- agentId: string;
- // (undocumented)
- computerId: string;
- // (undocumented)
- computerName: string;
- // (undocumented)
- daemonVersion: string;
- // (undocumented)
- hostname: string;
- // (undocumented)
- os: string;
- // (undocumented)
- serverId: string;
- // (undocumented)
- workspacePath: string;
-}
-
-// @public (undocumented)
-export interface AdapterTransport {
- // (undocumented)
- readonly kind: WellKnownTransportKind | (string & {});
- // (undocumented)
- readonly metadata?: Readonly<Record<string, JsonValue>>;
- // (undocumented)
- readonly protocol: string;
-}
-
-// @public (undocumented)
-export interface AgentBackendRegistration<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly capabilities: CapabilitiesOf<Specs, Id>;
- // (undocumented)
- readonly contractVersion: 1;
- // (undocumented)
- createAdapter(): BackendAdapter<Id, ConfigOf<Specs, Id>>;
- // (undocumented)
- readonly id: Id;
-}
-
-// @public (undocumented)
-export type AgentBackendRegistrationOf<Specs> = {
- [Id in BackendId<Specs>]: AgentBackendRegistration<Specs, Id>;
-}[BackendId<Specs>];
-
-// @public (undocumented)
-export interface AgentDriverError {
- // (undocumented)
- readonly category: "runtime_unavailable" | "authentication" | "configuration" | "protocol" | "process" | "sdk" | "timeout" | "cancelled" | "buffer_overflow" | "internal";
- // (undocumented)
- readonly code: string;
- // (undocumented)
- readonly details?: JsonObject;
- // (undocumented)
- readonly message: string;
- // (undocumented)
- readonly retryable: boolean;
-}
-
-// @public (undocumented)
-export interface AgentDriverHost {
- // (undocumented)
- createId(): string;
- // (undocumented)
- now(): number;
- // (undocumented)
- onRawOutput(event: RawOutputEvent): void;
- // (undocumented)
- prepareExecution(input: PrepareExecutionInput): Promise<PrepareExecutionResult>;
-}
-
-// @public (undocumented)
-export interface AgentDriverRegistry<Specs> {
- // (undocumented)
- readonly backendIds: readonly BackendId<Specs>[];
- // (undocumented)
- get<Id extends BackendId<Specs>>(id: Id): AgentBackendRegistration<Specs, Id>;
-}
-
-// @public (undocumented)
-export interface AgentDriverSdk<Specs = BuiltinBackendSpecs> {
- // (undocumented)
- readonly backendIds: readonly BackendId<Specs>[];
- // (undocumented)
- open<Id extends BackendId<Specs>>(input: OpenSessionInput<Specs, Id>): Promise<OpenSessionResult<Specs, Id>>;
- // (undocumented)
- probe<Id extends BackendId<Specs>>(input: ProbeInput<Specs, Id>): Promise<BackendProbe<CapabilitiesOf<Specs, Id>>>;
-}
-
-// @public (undocumented)
-export type AgentEvent<Specs, Id extends BackendId<Specs>> = AgentEventEnvelope & (CoreAgentEventPayload | ExtraEventOf<Specs, Id>);
-
-// @public (undocumented)
-export interface AgentEventEnvelope {
- // (undocumented)
- readonly at: number;
- // (undocumented)
- readonly sequence: number;
- // (undocumented)
- readonly sessionInstanceId: string;
-}
-
-// @public (undocumented)
-export interface AgentEventStream<Event> extends AsyncIterable<Event> {
- // (undocumented)
- readonly maxBufferedBytes: 4_194_304;
-}
-
-// @public (undocumented)
-export interface AgentInstructions {
- // (undocumented)
- readonly content: string;
- // (undocumented)
- readonly format: "markdown";
-}
-
-// @public (undocumented)
-export interface AgentLaunchContext {
- // (undocumented)
- readonly instructions: AgentInstructions;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly resumeSessionId?: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export interface AgentMessage {
- // (undocumented)
- readonly id: string;
- // (undocumented)
- readonly kind: "user" | "system" | "recovery";
- // (undocumented)
- readonly sequence?: number;
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export interface AgentSession<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly capabilities: CapabilitiesOf<Specs, Id>;
- // (undocumented)
- readonly closed: Promise<AgentSessionResult>;
- // (undocumented)
- readonly events: AgentEventStream<AgentEvent<Specs, Id>>;
- // (undocumented)
- interrupt(input: {
- readonly requestId: string;
- readonly reason: string;
- }): Promise<InterruptResult>;
- // (undocumented)
- invokeExtension<Name extends ExtensionNames<Specs, Id>>(name: Name, input: ExtensionInput<Specs, Id, Name>): Promise<ExtensionResult<ExtensionOutput<Specs, Id, Name>>>;
- // (undocumented)
- send(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- snapshot(): AgentSessionSnapshot;
- // (undocumented)
- start(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- stop(input: StopInput): Promise<StopReceipt>;
-}
-
-// @public (undocumented)
-export type AgentSessionResult = {
- readonly outcome: "stopped";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly exitCode?: number | null;
- readonly signal?: string | null;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "crashed";
- readonly requested: false;
- readonly backendSessionId?: string;
- readonly exitCode: number | null;
- readonly signal: string | null;
- readonly error?: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "failed_to_start";
- readonly requested: false;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "forced";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-};
-
-// @public (undocumented)
-export interface AgentSessionSnapshot {
- // (undocumented)
- readonly activeTurn?: {
- readonly turnId: string;
- readonly commandIds: readonly string[];
- };
- // (undocumented)
- readonly backendSessionId?: string;
- // (undocumented)
- readonly diagnostics: {
- readonly deliveryPhase: "idle" | "admission_wait" | "steering" | "next_turn_queued" | "compacting" | "reviewing" | "tool_wait" | "working";
- readonly metrics: {
- readonly physicalOpenCount: number;
- readonly turnCount: number;
- readonly commandAdmissionCount: number;
- readonly commandAdmissionLatencyTotalMs: number;
- readonly queueDwellCount: number;
- readonly queueDwellTotalMs: number;
- readonly sseReconnectCount: number;
- readonly resumeOutcome: "not_requested" | "pending" | "resumed" | "reset_required" | "failed";
- readonly terminalOwnerKind: "transport_request" | "vendor_message" | "prompt_invocation" | "lane_generation";
- };
- };
- // (undocumented)
- readonly lastEventSequence: number;
- // (undocumented)
- readonly queuedCommands: readonly {
- readonly commandId: string;
- readonly kind: AgentMessage["kind"];
- }[];
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- readonly state: "new" | "awaiting_first_message" | "starting" | "idle" | "working" | "stopping" | "closed";
-}
-
-// @public (undocumented)
-export type AgentTurnResult = {
- readonly outcome: "success";
- readonly backendSessionId: string;
-} | {
- readonly outcome: "interrupted";
- readonly backendSessionId?: string;
-} | {
- readonly outcome: "failed";
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface BackendAdapter<Id extends string = BuiltinBackendId, Config = BackendConfig> {
- beginTurn?(): string;
- // (undocumented)
- readonly execution: BackendExecution;
- // (undocumented)
- readonly id: Id;
- // (undocumented)
- readonly instructionDelivery: {
- readonly kind: "native";
- } | {
- readonly kind: "workspace_file";
- readonly canonical: string;
- readonly aliases: readonly string[];
- };
- // (undocumented)
- openLane(ctx: AdapterLaunchContext<Id, Config>, options?: RuntimeLaneOpenOptions): Promise<RuntimeLane>;
- // (undocumented)
- probe(command?: string): ProbeResult | Promise<ProbeResult>;
-}
-
-// @public (undocumented)
-export interface BackendCapabilities {
- // (undocumented)
- readonly commandOverride: boolean;
- // (undocumented)
- readonly disallowedTools: boolean;
- // (undocumented)
- readonly fastMode: boolean;
- // (undocumented)
- readonly interrupt: boolean;
- // (undocumented)
- readonly midTurnDelivery: "steer" | "safe_boundary_queue" | "next_turn_queue";
- // (undocumented)
- readonly modelSelection: "launchable" | "suggestion_only" | "unsupported";
- // (undocumented)
- readonly providerConfiguration: boolean;
- // (undocumented)
- readonly reasoningEffort: boolean;
- // (undocumented)
- readonly resume: "by_id" | "none";
- // (undocumented)
- readonly sessionLifetime: "persistent" | "per_turn";
-}
-
-// @public (undocumented)
-export type BackendConfig = ClaudeConfig | CodexConfig | CursorConfig | OpenCodeConfig | PiConfig;
-
-// @public (undocumented)
-export interface BackendExecution {
- // (undocumented)
- readonly lifetime: "session" | "turn";
- // (undocumented)
- readonly terminalOwnership: TerminalOwnership;
- // (undocumented)
- readonly transport: AdapterTransport;
- // (undocumented)
- readonly wakeStart: "immediate" | "deferred";
-}
-
-// @public (undocumented)
-export interface BackendExtensionSpec<Input, Output> {
- // (undocumented)
- readonly input: Input;
- // (undocumented)
- readonly output: Output;
-}
-
-// @public (undocumented)
-export type BackendId<Specs> = Extract<keyof Specs, string>;
-
-// @public (undocumented)
-export type BackendProbe<Capabilities> = {
- readonly status: "healthy";
- readonly version?: string;
- readonly capabilities: Capabilities;
-} | {
- readonly status: "unhealthy";
- readonly error: AgentDriverError;
- readonly capabilities: Capabilities;
-};
-
-// @public (undocumented)
-export interface BackendTypeSpec<Config, Capabilities, Extensions, ExtraEvent> {
- // (undocumented)
- readonly capabilities: Capabilities;
- // (undocumented)
- readonly config: Config;
- // (undocumented)
- readonly extensions: Extensions;
- // (undocumented)
- readonly extraEvent: ExtraEvent;
-}
-
-// @public (undocumented)
-export interface BaseBackendConfig {
- // (undocumented)
- readonly command?: string;
- // (undocumented)
- readonly environment?: Readonly<Record<string, string>>;
-}
-
-// @public (undocumented)
-export type BuiltinBackendId = "claude" | "codex" | "cursor" | "opencode" | "pi";
-
-// @public (undocumented)
-export interface BuiltinBackendSpecs {
- // (undocumented)
- readonly claude: BackendTypeSpec<ClaudeConfig, ClaudeCapabilities, {}, never>;
- // (undocumented)
- readonly codex: BackendTypeSpec<CodexConfig, CodexCapabilities, {}, never>;
- // (undocumented)
- readonly cursor: BackendTypeSpec<CursorConfig, CursorCapabilities, {}, never>;
- // (undocumented)
- readonly opencode: BackendTypeSpec<OpenCodeConfig, OpenCodeCapabilities, {}, never>;
- // (undocumented)
- readonly pi: BackendTypeSpec<PiConfig, PiCapabilities, {}, never>;
-}
-
-// @public (undocumented)
-export type CapabilitiesOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer Caps, infer _Extensions, infer _Event> ? Caps : never;
-
-// @public (undocumented)
-export type ClaudeCapabilities = FixedCapabilities<true, true, true, true, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface ClaudeConfig extends BaseBackendConfig {
- // (undocumented)
- readonly disallowedTools?: string;
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: ClaudeProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ClaudeProvider = DefaultProvider | {
- readonly kind: "custom_endpoint";
- readonly apiUrl: string;
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export type CodexCapabilities = FixedCapabilities<false, true, true, false, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface CodexConfig extends BaseBackendConfig {
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ConfigOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer Config, infer _Caps, infer _Extensions, infer _Event> ? Config : never;
-
-// @public (undocumented)
-export type CoreAgentEventPayload = {
- readonly type: "session_started";
- readonly backendSessionId: string;
-} | {
- readonly type: "command_queued";
- readonly commandId: string;
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
-} | {
- readonly type: "command_accepted";
- readonly commandId: string;
- readonly turnId: string;
- readonly delivery: "prompt" | "steer";
-} | {
- readonly type: "command_failed";
- readonly commandId: string;
- readonly turnId?: string;
- readonly error: AgentDriverError;
-} | {
- readonly type: "turn_started";
- readonly turnId: string;
- readonly commandIds: readonly string[];
-} | {
- readonly type: "thinking_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "text_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "tool_started";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly input: JsonValue;
-} | {
- readonly type: "tool_finished";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly output?: JsonValue;
-} | {
- readonly type: "compaction_started";
- readonly turnId: string;
-} | {
- readonly type: "compaction_finished";
- readonly turnId: string;
-} | {
- readonly type: "review_started";
- readonly turnId: string;
-} | {
- readonly type: "review_finished";
- readonly turnId: string;
-} | {
- readonly type: "internal_progress";
- readonly turnId?: string;
- readonly source?: string;
- readonly itemType?: string;
- readonly payloadBytes?: number;
-} | {
- readonly type: "diagnostic";
- readonly turnId?: string;
- readonly severity: "debug" | "info" | "warning" | "error";
- readonly source?: string;
- readonly message: string;
-} | {
- readonly type: "token_usage";
- readonly turnId?: string;
- readonly source: string;
- readonly usage: TokenUsage;
- readonly details: JsonObject;
-} | {
- readonly type: "rate_limits";
- readonly turnId?: string;
- readonly source: string;
- readonly details: JsonObject;
-} | {
- readonly type: "turn_completed";
- readonly turnId: string;
- readonly commandIds: readonly string[];
- readonly result: AgentTurnResult;
-} | {
- readonly type: "session_failed";
- readonly error: AgentDriverError;
-} | {
- readonly type: "session_closed";
- readonly result: AgentSessionResult;
-};
-
-// @public (undocumented)
-export function createAgentDriverRegistry<Specs>(registrations: readonly AgentBackendRegistrationOf<Specs>[]): AgentDriverRegistry<Specs>;
-
-// @public (undocumented)
-export interface CreateAgentDriverSdkOptions {
- // (undocumented)
- readonly host?: AgentDriverHost;
- // (undocumented)
- readonly hostReleaseTimeoutMs?: number;
-}
-
-// @public (undocumented)
-export function createAgentDriverSdkWithRegistry<Specs>(options: CreateAgentDriverSdkOptions & {
- readonly registry: AgentDriverRegistry<Specs>;
-}): AgentDriverSdk<Specs>;
-
-// @public (undocumented)
-export function createBuiltinAgentDriverRegistry(): AgentDriverRegistry<BuiltinBackendSpecs>;
-
-// @public (undocumented)
-export type CursorCapabilities = FixedCapabilities<false, false, false, false, true, "next_turn_queue", "persistent">;
-
-// @public (undocumented)
-export type CursorConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface DefaultAgentDriverHostOptions {
- // (undocumented)
- readonly environment?: Readonly<Record<string, string | undefined>>;
- // (undocumented)
- readonly onRawOutput?: (event: RawOutputEvent) => void;
-}
-
-// @public (undocumented)
-export type DefaultProvider = {
- readonly kind: "default";
-};
-
-// @public (undocumented)
-export type DeliveryReceipt = {
- readonly status: "accepted";
- readonly delivery: "prompt" | "steer";
- readonly commandId: string;
- readonly turnId: string;
-} | {
- readonly status: "queued";
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
- readonly commandId: string;
-} | {
- readonly status: "rejected";
- readonly reason: "closed" | "unsupported" | "invalid_input" | "runtime_unavailable" | "already_started" | "not_started" | "duplicate_conflict";
- readonly error?: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface EncodeMessageOptions {
- // (undocumented)
- mode?: InputMode;
-}
-
-// @public (undocumented)
-export type ExtensionInput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer Input, infer _Output> ? Input : never;
-
-// @public (undocumented)
-export type ExtensionNames<Specs, Id extends BackendId<Specs>> = Extract<keyof ExtensionsOf<Specs, Id>, string>;
-
-// @public (undocumented)
-export type ExtensionOutput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer _Input, infer Output> ? Output : never;
-
-// @public (undocumented)
-export type ExtensionResult<Output> = {
- readonly ok: true;
- readonly value: Output;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionsOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer Extensions, infer _Event> ? Extensions : never;
-
-// @public (undocumented)
-export type ExtraEventOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer _Extensions, infer Event> ? Event : never;
-
-// @public (undocumented)
-export type FixedCapabilities<Provider extends boolean, Reasoning extends boolean, Fast extends boolean, Tools extends boolean, Command extends boolean, Delivery extends BackendCapabilities["midTurnDelivery"], Lifetime extends BackendCapabilities["sessionLifetime"]> = BackendCapabilities & {
- readonly modelSelection: "launchable";
- readonly providerConfiguration: Provider;
- readonly reasoningEffort: Reasoning;
- readonly fastMode: Fast;
- readonly disallowedTools: Tools;
- readonly commandOverride: Command;
- readonly resume: "by_id";
- readonly sessionLifetime: Lifetime;
- readonly midTurnDelivery: Delivery;
- readonly interrupt: true;
-};
-
-// @public (undocumented)
-export type HostCleanupResult = {
- readonly status: "not_acquired";
-} | {
- readonly status: "released";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-} | {
- readonly status: "timed_out";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type InputMode = "busy" | "idle";
-
-// @public (undocumented)
-export type InterruptResult = {
- readonly status: "accepted";
- readonly requestId: string;
- readonly turnId: string;
-} | {
- readonly status: "not_running";
-} | {
- readonly status: "unsupported";
-} | {
- readonly status: "closed";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type JsonObject = {
- readonly [key: string]: JsonValue;
-};
-
-// @public (undocumented)
-export type JsonPrimitive = string | number | boolean | null;
-
-// @public (undocumented)
-export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
-
-// @public (undocumented)
-export type LaneAdmission = {
- readonly ok: true;
- readonly acceptedAs: "prompt" | "steer";
- readonly receipt: string;
-} | {
- readonly ok: false;
- readonly reason: string;
- readonly error?: string;
-};
-
-// @public (undocumented)
-export interface LaneInterruptInput {
- // (undocumented)
- readonly reason?: string;
- // (undocumented)
- readonly requestId?: string;
-}
-
-// @public (undocumented)
-export interface LaneSendInput extends LaneStartInput {
- // (undocumented)
- readonly mode: InputMode;
-}
-
-// @public (undocumented)
-export interface LaneStartInput {
- // (undocumented)
- readonly sessionId?: string;
- // (undocumented)
- readonly terminalOwner?: string;
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export interface LaneStopInput {
- // (undocumented)
- readonly forceAfterMs?: number;
- // (undocumented)
- readonly reason?: string;
- // (undocumented)
- readonly signal?: "SIGTERM" | "SIGINT" | "SIGKILL";
-}
-
-// @public (undocumented)
-export interface ModelBackendConfig extends BaseBackendConfig {
- // (undocumented)
- readonly model: ModelSelection;
-}
-
-// @public (undocumented)
-export type ModelSelection = {
- readonly kind: "default";
-} | {
- readonly kind: "named";
- readonly name: string;
-} | {
- readonly kind: "custom";
- readonly name: string;
-};
-
-// @public (undocumented)
-export type OpenCodeCapabilities = FixedCapabilities<false, false, false, false, true, "steer", "persistent">;
-
-// @public (undocumented)
-export type OpenCodeConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface OpenSessionInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly config: ConfigOf<Specs, Id>;
- // (undocumented)
- readonly launch: AgentLaunchContext;
-}
-
-// @public (undocumented)
-export type OpenSessionResult<Specs, Id extends BackendId<Specs>> = {
- readonly ok: true;
- readonly session: AgentSession<Specs, Id>;
- readonly capabilities: CapabilitiesOf<Specs, Id>;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type PiCapabilities = FixedCapabilities<true, true, false, false, false, "steer", "persistent">;
-
-// @public (undocumented)
-export interface PiConfig extends Omit<BaseBackendConfig, "command"> {
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: PiProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type PiProvider = DefaultProvider | {
- readonly kind: "builtin";
- readonly providerId: "google" | "openai" | "openrouter" | (string & {});
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export interface PreparedExecutionResource {
- // (undocumented)
- readonly environmentLayers: Readonly<Record<"base" | "hostStatic" | "identityProtected" | "platformProtected" | "runtimeProtected" | "networkProtected" | "credentialSensitive", Readonly<Record<string, string | undefined>>>>;
- // (undocumented)
- readonly executablePath?: string;
- // (undocumented)
- release(input: {
- readonly reason: "normal" | "failed_start" | "crash" | "requested_stop" | "consumer_closed";
- readonly signal: AbortSignal;
- readonly deadlineAt: number;
- }): Promise<void>;
-}
-
-// @public (undocumented)
-export interface PrepareExecutionInput {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export type PrepareExecutionResult = {
- readonly ok: true;
- readonly resource: PreparedExecutionResource;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface ProbeInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly command?: string;
-}
-
-// @public (undocumented)
-export interface ProbeResult {
- // (undocumented)
- lastError?: string;
- // (undocumented)
- status: "healthy" | "unhealthy";
- // (undocumented)
- version?: string;
-}
-
-// @public (undocumented)
-export interface RawOutputEvent {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly stream: "stdout" | "stderr";
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export type ReasoningEffort = "low" | "medium" | "high";
-
-// @public (undocumented)
-export interface RuntimeLane {
- // (undocumented)
- readonly currentSessionId: string | null;
- // (undocumented)
- interrupt(input: LaneInterruptInput): Promise<boolean>;
- // (undocumented)
- on<K extends keyof RuntimeLaneEventMap>(event: K, listener: (value: RuntimeLaneEventMap[K]) => void): void;
- // (undocumented)
- send(input: LaneSendInput): Promise<LaneAdmission>;
- // (undocumented)
- start(input: LaneStartInput): Promise<LaneAdmission>;
- // (undocumented)
- stop(input: LaneStopInput): Promise<void>;
-}
-
-// @public (undocumented)
-export interface RuntimeLaneEventMap {
- // (undocumented)
- readonly error: unknown;
- // (undocumented)
- readonly exit: RuntimeLaneExit;
- // (undocumented)
- readonly runtime_event: AdapterEvent;
- // (undocumented)
- readonly stderr: string;
-}
-
-// @public (undocumented)
-export interface RuntimeLaneExit {
- // (undocumented)
- readonly code: number | null;
- // (undocumented)
- readonly reason: "requested" | "runtime_exit";
- // (undocumented)
- readonly signal: string | null;
-}
-
-// @public (undocumented)
-export interface RuntimeLaneOpenOptions {
- // (undocumented)
- readonly onRawStdoutLine?: (line: string) => void;
-}
-
-// @public (undocumented)
-export interface SpawnedProcess {
- // (undocumented)
- process: SpawnedProcessHandle;
-}
-
-// @public (undocumented)
-export interface SpawnedProcessHandle {
- // (undocumented)
- readonly exitCode: number | null;
- // (undocumented)
- kill(signal?: "SIGTERM" | "SIGINT" | "SIGKILL"): boolean;
- // (undocumented)
- on(event: "error", listener: (error: unknown) => void): unknown;
- // (undocumented)
- on(event: "exit" | "close", listener: (code: number | null, signal: string | null) => void): unknown;
- // (undocumented)
- readonly pid?: number;
- // (undocumented)
- readonly signalCode: string | null;
- // (undocumented)
- readonly stderr?: {
- on(event: "data", listener: (chunk: {
- toString(): string;
- }) => void): unknown;
- } | null;
- // (undocumented)
- readonly stdin?: {
- readonly destroyed?: boolean;
- readonly writable?: boolean;
- readonly writableEnded?: boolean;
- write(chunk: string): unknown;
- } | null;
- // (undocumented)
- readonly stdout?: {
- on(event: "data", listener: (chunk: {
- toString(): string;
- }) => void): unknown;
- } | null;
-}
-
-// @public (undocumented)
-export interface StopInput {
- // (undocumented)
- readonly forceAfterMs: number;
- // (undocumented)
- readonly reason: "owner_request" | "idle_timeout" | "stalled" | "shutdown" | "reset";
-}
-
-// @public (undocumented)
-export type StopReceipt = {
- readonly status: "accepted";
- readonly requestId: string;
-} | {
- readonly status: "already_stopping";
- readonly requestId: string;
-} | {
- readonly status: "closed";
- readonly result: AgentSessionResult;
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type TerminalOwnership = "transport_request" | "vendor_message" | "prompt_invocation" | "lane_generation";
-
-// @public (undocumented)
-export interface TokenUsage {
- // (undocumented)
- readonly cachedInputTokens?: number;
- // (undocumented)
- readonly inputTokens?: number;
- // (undocumented)
- readonly outputTokens?: number;
- // (undocumented)
- readonly reasoningTokens?: number;
- // (undocumented)
- readonly totalTokens?: number;
-}
-
-// @public (undocumented)
-export interface VendorSessionHandle {
- // (undocumented)
- abort?(): void | Promise<void>;
- // (undocumented)
- dispose?(): void | Promise<void>;
- // (undocumented)
- readonly isStreaming?: boolean;
- // (undocumented)
- prompt(text: string): void | Promise<void>;
- // (undocumented)
- steer(text: string): void | Promise<void>;
-}
-
-// @public (undocumented)
-export type WellKnownTransportKind = "stdio_stream" | "stdio_rpc" | "http_sse" | "in_process_sdk" | "one_shot_cli";
-
-// (No @packageDocumentation comment for this package)
-
-```
diff --git a/src/daemon/agent-driver/etc/api/host.api.md b/src/daemon/agent-driver/etc/api/host.api.md
deleted file mode 100644
index 0d41d3a2b..000000000
--- a/src/daemon/agent-driver/etc/api/host.api.md
+++ /dev/null
@@ -1,706 +0,0 @@
-## API Report File for "@alook/agent-driver"
-
-> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
-
-```ts
-
-// @public (undocumented)
-export interface AgentDriverError {
- // (undocumented)
- readonly category: "runtime_unavailable" | "authentication" | "configuration" | "protocol" | "process" | "sdk" | "timeout" | "cancelled" | "buffer_overflow" | "internal";
- // (undocumented)
- readonly code: string;
- // (undocumented)
- readonly details?: JsonObject;
- // (undocumented)
- readonly message: string;
- // (undocumented)
- readonly retryable: boolean;
-}
-
-// @public (undocumented)
-export interface AgentDriverHost {
- // (undocumented)
- createId(): string;
- // (undocumented)
- now(): number;
- // (undocumented)
- onRawOutput(event: RawOutputEvent): void;
- // (undocumented)
- prepareExecution(input: PrepareExecutionInput): Promise<PrepareExecutionResult>;
-}
-
-// @public (undocumented)
-export interface AgentDriverSdk<Specs = BuiltinBackendSpecs> {
- // (undocumented)
- readonly backendIds: readonly BackendId<Specs>[];
- // (undocumented)
- open<Id extends BackendId<Specs>>(input: OpenSessionInput<Specs, Id>): Promise<OpenSessionResult<Specs, Id>>;
- // (undocumented)
- probe<Id extends BackendId<Specs>>(input: ProbeInput<Specs, Id>): Promise<BackendProbe<CapabilitiesOf<Specs, Id>>>;
-}
-
-// @public (undocumented)
-export type AgentEvent<Specs, Id extends BackendId<Specs>> = AgentEventEnvelope & (CoreAgentEventPayload | ExtraEventOf<Specs, Id>);
-
-// @public (undocumented)
-export interface AgentEventEnvelope {
- // (undocumented)
- readonly at: number;
- // (undocumented)
- readonly sequence: number;
- // (undocumented)
- readonly sessionInstanceId: string;
-}
-
-// @public (undocumented)
-export interface AgentEventStream<Event> extends AsyncIterable<Event> {
- // (undocumented)
- readonly maxBufferedBytes: 4_194_304;
-}
-
-// @public (undocumented)
-export interface AgentInstructions {
- // (undocumented)
- readonly content: string;
- // (undocumented)
- readonly format: "markdown";
-}
-
-// @public (undocumented)
-export interface AgentLaunchContext {
- // (undocumented)
- readonly instructions: AgentInstructions;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly resumeSessionId?: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export interface AgentMessage {
- // (undocumented)
- readonly id: string;
- // (undocumented)
- readonly kind: "user" | "system" | "recovery";
- // (undocumented)
- readonly sequence?: number;
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export interface AgentSession<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly capabilities: CapabilitiesOf<Specs, Id>;
- // (undocumented)
- readonly closed: Promise<AgentSessionResult>;
- // (undocumented)
- readonly events: AgentEventStream<AgentEvent<Specs, Id>>;
- // (undocumented)
- interrupt(input: {
- readonly requestId: string;
- readonly reason: string;
- }): Promise<InterruptResult>;
- // (undocumented)
- invokeExtension<Name extends ExtensionNames<Specs, Id>>(name: Name, input: ExtensionInput<Specs, Id, Name>): Promise<ExtensionResult<ExtensionOutput<Specs, Id, Name>>>;
- // (undocumented)
- send(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- snapshot(): AgentSessionSnapshot;
- // (undocumented)
- start(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- stop(input: StopInput): Promise<StopReceipt>;
-}
-
-// @public (undocumented)
-export type AgentSessionResult = {
- readonly outcome: "stopped";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly exitCode?: number | null;
- readonly signal?: string | null;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "crashed";
- readonly requested: false;
- readonly backendSessionId?: string;
- readonly exitCode: number | null;
- readonly signal: string | null;
- readonly error?: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "failed_to_start";
- readonly requested: false;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "forced";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-};
-
-// @public (undocumented)
-export interface AgentSessionSnapshot {
- // (undocumented)
- readonly activeTurn?: {
- readonly turnId: string;
- readonly commandIds: readonly string[];
- };
- // (undocumented)
- readonly backendSessionId?: string;
- // (undocumented)
- readonly diagnostics: {
- readonly deliveryPhase: "idle" | "admission_wait" | "steering" | "next_turn_queued" | "compacting" | "reviewing" | "tool_wait" | "working";
- readonly metrics: {
- readonly physicalOpenCount: number;
- readonly turnCount: number;
- readonly commandAdmissionCount: number;
- readonly commandAdmissionLatencyTotalMs: number;
- readonly queueDwellCount: number;
- readonly queueDwellTotalMs: number;
- readonly sseReconnectCount: number;
- readonly resumeOutcome: "not_requested" | "pending" | "resumed" | "reset_required" | "failed";
- readonly terminalOwnerKind: "transport_request" | "vendor_message" | "prompt_invocation" | "lane_generation";
- };
- };
- // (undocumented)
- readonly lastEventSequence: number;
- // (undocumented)
- readonly queuedCommands: readonly {
- readonly commandId: string;
- readonly kind: AgentMessage["kind"];
- }[];
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- readonly state: "new" | "awaiting_first_message" | "starting" | "idle" | "working" | "stopping" | "closed";
-}
-
-// @public (undocumented)
-export type AgentTurnResult = {
- readonly outcome: "success";
- readonly backendSessionId: string;
-} | {
- readonly outcome: "interrupted";
- readonly backendSessionId?: string;
-} | {
- readonly outcome: "failed";
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface BackendCapabilities {
- // (undocumented)
- readonly commandOverride: boolean;
- // (undocumented)
- readonly disallowedTools: boolean;
- // (undocumented)
- readonly fastMode: boolean;
- // (undocumented)
- readonly interrupt: boolean;
- // (undocumented)
- readonly midTurnDelivery: "steer" | "safe_boundary_queue" | "next_turn_queue";
- // (undocumented)
- readonly modelSelection: "launchable" | "suggestion_only" | "unsupported";
- // (undocumented)
- readonly providerConfiguration: boolean;
- // (undocumented)
- readonly reasoningEffort: boolean;
- // (undocumented)
- readonly resume: "by_id" | "none";
- // (undocumented)
- readonly sessionLifetime: "persistent" | "per_turn";
-}
-
-// @public (undocumented)
-export interface BackendExtensionSpec<Input, Output> {
- // (undocumented)
- readonly input: Input;
- // (undocumented)
- readonly output: Output;
-}
-
-// @public (undocumented)
-export type BackendId<Specs> = Extract<keyof Specs, string>;
-
-// @public (undocumented)
-export type BackendProbe<Capabilities> = {
- readonly status: "healthy";
- readonly version?: string;
- readonly capabilities: Capabilities;
-} | {
- readonly status: "unhealthy";
- readonly error: AgentDriverError;
- readonly capabilities: Capabilities;
-};
-
-// @public (undocumented)
-export interface BackendTypeSpec<Config, Capabilities, Extensions, ExtraEvent> {
- // (undocumented)
- readonly capabilities: Capabilities;
- // (undocumented)
- readonly config: Config;
- // (undocumented)
- readonly extensions: Extensions;
- // (undocumented)
- readonly extraEvent: ExtraEvent;
-}
-
-// @public (undocumented)
-export interface BaseBackendConfig {
- // (undocumented)
- readonly command?: string;
- // (undocumented)
- readonly environment?: Readonly<Record<string, string>>;
-}
-
-// @public (undocumented)
-export type BuiltinBackendId = "claude" | "codex" | "cursor" | "opencode" | "pi";
-
-// @public (undocumented)
-export interface BuiltinBackendSpecs {
- // (undocumented)
- readonly claude: BackendTypeSpec<ClaudeConfig, ClaudeCapabilities, {}, never>;
- // (undocumented)
- readonly codex: BackendTypeSpec<CodexConfig, CodexCapabilities, {}, never>;
- // (undocumented)
- readonly cursor: BackendTypeSpec<CursorConfig, CursorCapabilities, {}, never>;
- // (undocumented)
- readonly opencode: BackendTypeSpec<OpenCodeConfig, OpenCodeCapabilities, {}, never>;
- // (undocumented)
- readonly pi: BackendTypeSpec<PiConfig, PiCapabilities, {}, never>;
-}
-
-// @public (undocumented)
-export type CapabilitiesOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer Caps, infer _Extensions, infer _Event> ? Caps : never;
-
-// @public (undocumented)
-export type ClaudeCapabilities = FixedCapabilities<true, true, true, true, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface ClaudeConfig extends BaseBackendConfig {
- // (undocumented)
- readonly disallowedTools?: string;
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: ClaudeProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ClaudeProvider = DefaultProvider | {
- readonly kind: "custom_endpoint";
- readonly apiUrl: string;
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export type CodexCapabilities = FixedCapabilities<false, true, true, false, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface CodexConfig extends BaseBackendConfig {
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ConfigOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer Config, infer _Caps, infer _Extensions, infer _Event> ? Config : never;
-
-// @public (undocumented)
-export type CoreAgentEventPayload = {
- readonly type: "session_started";
- readonly backendSessionId: string;
-} | {
- readonly type: "command_queued";
- readonly commandId: string;
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
-} | {
- readonly type: "command_accepted";
- readonly commandId: string;
- readonly turnId: string;
- readonly delivery: "prompt" | "steer";
-} | {
- readonly type: "command_failed";
- readonly commandId: string;
- readonly turnId?: string;
- readonly error: AgentDriverError;
-} | {
- readonly type: "turn_started";
- readonly turnId: string;
- readonly commandIds: readonly string[];
-} | {
- readonly type: "thinking_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "text_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "tool_started";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly input: JsonValue;
-} | {
- readonly type: "tool_finished";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly output?: JsonValue;
-} | {
- readonly type: "compaction_started";
- readonly turnId: string;
-} | {
- readonly type: "compaction_finished";
- readonly turnId: string;
-} | {
- readonly type: "review_started";
- readonly turnId: string;
-} | {
- readonly type: "review_finished";
- readonly turnId: string;
-} | {
- readonly type: "internal_progress";
- readonly turnId?: string;
- readonly source?: string;
- readonly itemType?: string;
- readonly payloadBytes?: number;
-} | {
- readonly type: "diagnostic";
- readonly turnId?: string;
- readonly severity: "debug" | "info" | "warning" | "error";
- readonly source?: string;
- readonly message: string;
-} | {
- readonly type: "token_usage";
- readonly turnId?: string;
- readonly source: string;
- readonly usage: TokenUsage;
- readonly details: JsonObject;
-} | {
- readonly type: "rate_limits";
- readonly turnId?: string;
- readonly source: string;
- readonly details: JsonObject;
-} | {
- readonly type: "turn_completed";
- readonly turnId: string;
- readonly commandIds: readonly string[];
- readonly result: AgentTurnResult;
-} | {
- readonly type: "session_failed";
- readonly error: AgentDriverError;
-} | {
- readonly type: "session_closed";
- readonly result: AgentSessionResult;
-};
-
-// @public (undocumented)
-export interface CreateAgentDriverSdkOptions {
- // (undocumented)
- readonly host?: AgentDriverHost;
- // (undocumented)
- readonly hostReleaseTimeoutMs?: number;
-}
-
-// @public (undocumented)
-export function createBuiltinAgentDriverSdk(options?: CreateAgentDriverSdkOptions): AgentDriverSdk<BuiltinBackendSpecs>;
-
-// @public (undocumented)
-export function createDefaultAgentDriverHost(options?: DefaultAgentDriverHostOptions): AgentDriverHost;
-
-// @public (undocumented)
-export type CursorCapabilities = FixedCapabilities<false, false, false, false, true, "next_turn_queue", "persistent">;
-
-// @public (undocumented)
-export type CursorConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface DefaultAgentDriverHostOptions {
- // (undocumented)
- readonly environment?: Readonly<Record<string, string | undefined>>;
- // (undocumented)
- readonly onRawOutput?: (event: RawOutputEvent) => void;
-}
-
-// @public (undocumented)
-export type DefaultProvider = {
- readonly kind: "default";
-};
-
-// @public (undocumented)
-export type DeliveryReceipt = {
- readonly status: "accepted";
- readonly delivery: "prompt" | "steer";
- readonly commandId: string;
- readonly turnId: string;
-} | {
- readonly status: "queued";
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
- readonly commandId: string;
-} | {
- readonly status: "rejected";
- readonly reason: "closed" | "unsupported" | "invalid_input" | "runtime_unavailable" | "already_started" | "not_started" | "duplicate_conflict";
- readonly error?: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionInput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer Input, infer _Output> ? Input : never;
-
-// @public (undocumented)
-export type ExtensionNames<Specs, Id extends BackendId<Specs>> = Extract<keyof ExtensionsOf<Specs, Id>, string>;
-
-// @public (undocumented)
-export type ExtensionOutput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer _Input, infer Output> ? Output : never;
-
-// @public (undocumented)
-export type ExtensionResult<Output> = {
- readonly ok: true;
- readonly value: Output;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionsOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer Extensions, infer _Event> ? Extensions : never;
-
-// @public (undocumented)
-export type ExtraEventOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer _Extensions, infer Event> ? Event : never;
-
-// @public (undocumented)
-export type FixedCapabilities<Provider extends boolean, Reasoning extends boolean, Fast extends boolean, Tools extends boolean, Command extends boolean, Delivery extends BackendCapabilities["midTurnDelivery"], Lifetime extends BackendCapabilities["sessionLifetime"]> = BackendCapabilities & {
- readonly modelSelection: "launchable";
- readonly providerConfiguration: Provider;
- readonly reasoningEffort: Reasoning;
- readonly fastMode: Fast;
- readonly disallowedTools: Tools;
- readonly commandOverride: Command;
- readonly resume: "by_id";
- readonly sessionLifetime: Lifetime;
- readonly midTurnDelivery: Delivery;
- readonly interrupt: true;
-};
-
-// @public (undocumented)
-export type HostCleanupResult = {
- readonly status: "not_acquired";
-} | {
- readonly status: "released";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-} | {
- readonly status: "timed_out";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type InterruptResult = {
- readonly status: "accepted";
- readonly requestId: string;
- readonly turnId: string;
-} | {
- readonly status: "not_running";
-} | {
- readonly status: "unsupported";
-} | {
- readonly status: "closed";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type JsonObject = {
- readonly [key: string]: JsonValue;
-};
-
-// @public (undocumented)
-export type JsonPrimitive = string | number | boolean | null;
-
-// @public (undocumented)
-export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
-
-// @public (undocumented)
-export interface ModelBackendConfig extends BaseBackendConfig {
- // (undocumented)
- readonly model: ModelSelection;
-}
-
-// @public (undocumented)
-export type ModelSelection = {
- readonly kind: "default";
-} | {
- readonly kind: "named";
- readonly name: string;
-} | {
- readonly kind: "custom";
- readonly name: string;
-};
-
-// @public (undocumented)
-export type OpenCodeCapabilities = FixedCapabilities<false, false, false, false, true, "steer", "persistent">;
-
-// @public (undocumented)
-export type OpenCodeConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface OpenSessionInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly config: ConfigOf<Specs, Id>;
- // (undocumented)
- readonly launch: AgentLaunchContext;
-}
-
-// @public (undocumented)
-export type OpenSessionResult<Specs, Id extends BackendId<Specs>> = {
- readonly ok: true;
- readonly session: AgentSession<Specs, Id>;
- readonly capabilities: CapabilitiesOf<Specs, Id>;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type PiCapabilities = FixedCapabilities<true, true, false, false, false, "steer", "persistent">;
-
-// @public (undocumented)
-export interface PiConfig extends Omit<BaseBackendConfig, "command"> {
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: PiProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type PiProvider = DefaultProvider | {
- readonly kind: "builtin";
- readonly providerId: "google" | "openai" | "openrouter" | (string & {});
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export interface PreparedExecutionResource {
- // (undocumented)
- readonly environmentLayers: Readonly<Record<"base" | "hostStatic" | "identityProtected" | "platformProtected" | "runtimeProtected" | "networkProtected" | "credentialSensitive", Readonly<Record<string, string | undefined>>>>;
- // (undocumented)
- readonly executablePath?: string;
- // (undocumented)
- release(input: {
- readonly reason: "normal" | "failed_start" | "crash" | "requested_stop" | "consumer_closed";
- readonly signal: AbortSignal;
- readonly deadlineAt: number;
- }): Promise<void>;
-}
-
-// @public (undocumented)
-export interface PrepareExecutionInput {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export type PrepareExecutionResult = {
- readonly ok: true;
- readonly resource: PreparedExecutionResource;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface ProbeInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly command?: string;
-}
-
-// @public (undocumented)
-export interface RawOutputEvent {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly stream: "stdout" | "stderr";
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export type ReasoningEffort = "low" | "medium" | "high";
-
-// @public (undocumented)
-export function scrubAgentDriverDiagnosticText(value: unknown, fallback?: string): string;
-
-// @public (undocumented)
-export interface StopInput {
- // (undocumented)
- readonly forceAfterMs: number;
- // (undocumented)
- readonly reason: "owner_request" | "idle_timeout" | "stalled" | "shutdown" | "reset";
-}
-
-// @public (undocumented)
-export type StopReceipt = {
- readonly status: "accepted";
- readonly requestId: string;
-} | {
- readonly status: "already_stopping";
- readonly requestId: string;
-} | {
- readonly status: "closed";
- readonly result: AgentSessionResult;
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface TokenUsage {
- // (undocumented)
- readonly cachedInputTokens?: number;
- // (undocumented)
- readonly inputTokens?: number;
- // (undocumented)
- readonly outputTokens?: number;
- // (undocumented)
- readonly reasoningTokens?: number;
- // (undocumented)
- readonly totalTokens?: number;
-}
-
-// (No @packageDocumentation comment for this package)
-
-```
diff --git a/src/daemon/agent-driver/etc/api/root.api.md b/src/daemon/agent-driver/etc/api/root.api.md
deleted file mode 100644
index e16abf6b6..000000000
--- a/src/daemon/agent-driver/etc/api/root.api.md
+++ /dev/null
@@ -1,682 +0,0 @@
-## API Report File for "@alook/agent-driver"
-
-> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
-
-```ts
-
-// @public (undocumented)
-export interface AgentDriverError {
- // (undocumented)
- readonly category: "runtime_unavailable" | "authentication" | "configuration" | "protocol" | "process" | "sdk" | "timeout" | "cancelled" | "buffer_overflow" | "internal";
- // (undocumented)
- readonly code: string;
- // (undocumented)
- readonly details?: JsonObject;
- // (undocumented)
- readonly message: string;
- // (undocumented)
- readonly retryable: boolean;
-}
-
-// @public (undocumented)
-export interface AgentDriverSdk<Specs = BuiltinBackendSpecs> {
- // (undocumented)
- readonly backendIds: readonly BackendId<Specs>[];
- // (undocumented)
- open<Id extends BackendId<Specs>>(input: OpenSessionInput<Specs, Id>): Promise<OpenSessionResult<Specs, Id>>;
- // (undocumented)
- probe<Id extends BackendId<Specs>>(input: ProbeInput<Specs, Id>): Promise<BackendProbe<CapabilitiesOf<Specs, Id>>>;
-}
-
-// @public (undocumented)
-export type AgentEvent<Specs, Id extends BackendId<Specs>> = AgentEventEnvelope & (CoreAgentEventPayload | ExtraEventOf<Specs, Id>);
-
-// @public (undocumented)
-export interface AgentEventEnvelope {
- // (undocumented)
- readonly at: number;
- // (undocumented)
- readonly sequence: number;
- // (undocumented)
- readonly sessionInstanceId: string;
-}
-
-// @public (undocumented)
-export interface AgentEventStream<Event> extends AsyncIterable<Event> {
- // (undocumented)
- readonly maxBufferedBytes: 4_194_304;
-}
-
-// @public (undocumented)
-export interface AgentInstructions {
- // (undocumented)
- readonly content: string;
- // (undocumented)
- readonly format: "markdown";
-}
-
-// @public (undocumented)
-export interface AgentLaunchContext {
- // (undocumented)
- readonly instructions: AgentInstructions;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly resumeSessionId?: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export interface AgentMessage {
- // (undocumented)
- readonly id: string;
- // (undocumented)
- readonly kind: "user" | "system" | "recovery";
- // (undocumented)
- readonly sequence?: number;
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export interface AgentSession<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly capabilities: CapabilitiesOf<Specs, Id>;
- // (undocumented)
- readonly closed: Promise<AgentSessionResult>;
- // (undocumented)
- readonly events: AgentEventStream<AgentEvent<Specs, Id>>;
- // (undocumented)
- interrupt(input: {
- readonly requestId: string;
- readonly reason: string;
- }): Promise<InterruptResult>;
- // (undocumented)
- invokeExtension<Name extends ExtensionNames<Specs, Id>>(name: Name, input: ExtensionInput<Specs, Id, Name>): Promise<ExtensionResult<ExtensionOutput<Specs, Id, Name>>>;
- // (undocumented)
- send(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- snapshot(): AgentSessionSnapshot;
- // (undocumented)
- start(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- stop(input: StopInput): Promise<StopReceipt>;
-}
-
-// @public (undocumented)
-export type AgentSessionResult = {
- readonly outcome: "stopped";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly exitCode?: number | null;
- readonly signal?: string | null;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "crashed";
- readonly requested: false;
- readonly backendSessionId?: string;
- readonly exitCode: number | null;
- readonly signal: string | null;
- readonly error?: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "failed_to_start";
- readonly requested: false;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "forced";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-};
-
-// @public (undocumented)
-export interface AgentSessionSnapshot {
- // (undocumented)
- readonly activeTurn?: {
- readonly turnId: string;
- readonly commandIds: readonly string[];
- };
- // (undocumented)
- readonly backendSessionId?: string;
- // (undocumented)
- readonly diagnostics: {
- readonly deliveryPhase: "idle" | "admission_wait" | "steering" | "next_turn_queued" | "compacting" | "reviewing" | "tool_wait" | "working";
- readonly metrics: {
- readonly physicalOpenCount: number;
- readonly turnCount: number;
- readonly commandAdmissionCount: number;
- readonly commandAdmissionLatencyTotalMs: number;
- readonly queueDwellCount: number;
- readonly queueDwellTotalMs: number;
- readonly sseReconnectCount: number;
- readonly resumeOutcome: "not_requested" | "pending" | "resumed" | "reset_required" | "failed";
- readonly terminalOwnerKind: "transport_request" | "vendor_message" | "prompt_invocation" | "lane_generation";
- };
- };
- // (undocumented)
- readonly lastEventSequence: number;
- // (undocumented)
- readonly queuedCommands: readonly {
- readonly commandId: string;
- readonly kind: AgentMessage["kind"];
- }[];
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- readonly state: "new" | "awaiting_first_message" | "starting" | "idle" | "working" | "stopping" | "closed";
-}
-
-// @public (undocumented)
-export type AgentTurnResult = {
- readonly outcome: "success";
- readonly backendSessionId: string;
-} | {
- readonly outcome: "interrupted";
- readonly backendSessionId?: string;
-} | {
- readonly outcome: "failed";
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface BackendCapabilities {
- // (undocumented)
- readonly commandOverride: boolean;
- // (undocumented)
- readonly disallowedTools: boolean;
- // (undocumented)
- readonly fastMode: boolean;
- // (undocumented)
- readonly interrupt: boolean;
- // (undocumented)
- readonly midTurnDelivery: "steer" | "safe_boundary_queue" | "next_turn_queue";
- // (undocumented)
- readonly modelSelection: "launchable" | "suggestion_only" | "unsupported";
- // (undocumented)
- readonly providerConfiguration: boolean;
- // (undocumented)
- readonly reasoningEffort: boolean;
- // (undocumented)
- readonly resume: "by_id" | "none";
- // (undocumented)
- readonly sessionLifetime: "persistent" | "per_turn";
-}
-
-// @public (undocumented)
-export interface BackendExtensionSpec<Input, Output> {
- // (undocumented)
- readonly input: Input;
- // (undocumented)
- readonly output: Output;
-}
-
-// @public (undocumented)
-export type BackendId<Specs> = Extract<keyof Specs, string>;
-
-// @public (undocumented)
-export type BackendProbe<Capabilities> = {
- readonly status: "healthy";
- readonly version?: string;
- readonly capabilities: Capabilities;
-} | {
- readonly status: "unhealthy";
- readonly error: AgentDriverError;
- readonly capabilities: Capabilities;
-};
-
-// @public (undocumented)
-export interface BackendTypeSpec<Config, Capabilities, Extensions, ExtraEvent> {
- // (undocumented)
- readonly capabilities: Capabilities;
- // (undocumented)
- readonly config: Config;
- // (undocumented)
- readonly extensions: Extensions;
- // (undocumented)
- readonly extraEvent: ExtraEvent;
-}
-
-// @public (undocumented)
-export interface BaseBackendConfig {
- // (undocumented)
- readonly command?: string;
- // (undocumented)
- readonly environment?: Readonly<Record<string, string>>;
-}
-
-// @public (undocumented)
-export const BUILTIN_BACKEND_IDS: readonly ["claude", "codex", "cursor", "opencode", "pi"];
-
-// @public (undocumented)
-export type BuiltinBackendId = "claude" | "codex" | "cursor" | "opencode" | "pi";
-
-// @public (undocumented)
-export type BuiltinBackendSelection = {
- [Id in BuiltinBackendId]: {
- readonly backend: Id;
- readonly config: ConfigOf<BuiltinBackendSpecs, Id>;
- };
-}[BuiltinBackendId];
-
-// @public (undocumented)
-export interface BuiltinBackendSpecs {
- // (undocumented)
- readonly claude: BackendTypeSpec<ClaudeConfig, ClaudeCapabilities, {}, never>;
- // (undocumented)
- readonly codex: BackendTypeSpec<CodexConfig, CodexCapabilities, {}, never>;
- // (undocumented)
- readonly cursor: BackendTypeSpec<CursorConfig, CursorCapabilities, {}, never>;
- // (undocumented)
- readonly opencode: BackendTypeSpec<OpenCodeConfig, OpenCodeCapabilities, {}, never>;
- // (undocumented)
- readonly pi: BackendTypeSpec<PiConfig, PiCapabilities, {}, never>;
-}
-
-// @public (undocumented)
-export interface BuiltinRuntimeConfigInput {
- // (undocumented)
- readonly command?: string;
- // (undocumented)
- readonly disallowedTools?: string;
- // (undocumented)
- readonly envVars?: Readonly<Record<string, string>>;
- // (undocumented)
- readonly mode: {
- readonly kind: "default" | "fast";
- };
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider?: {
- readonly kind: "default";
- } | {
- readonly kind: "custom";
- readonly apiUrl: string;
- readonly apiKey: string;
- } | {
- readonly kind: "pi-builtin";
- readonly providerId: string;
- readonly apiKey: string;
- };
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
- // (undocumented)
- readonly runtime: string;
-}
-
-// @public (undocumented)
-export type CapabilitiesOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer Caps, infer _Extensions, infer _Event> ? Caps : never;
-
-// @public (undocumented)
-export type ClaudeCapabilities = FixedCapabilities<true, true, true, true, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface ClaudeConfig extends BaseBackendConfig {
- // (undocumented)
- readonly disallowedTools?: string;
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: ClaudeProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ClaudeProvider = DefaultProvider | {
- readonly kind: "custom_endpoint";
- readonly apiUrl: string;
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export type CodexCapabilities = FixedCapabilities<false, true, true, false, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface CodexConfig extends BaseBackendConfig {
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ConfigOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer Config, infer _Caps, infer _Extensions, infer _Event> ? Config : never;
-
-// @public (undocumented)
-export type CoreAgentEventPayload = {
- readonly type: "session_started";
- readonly backendSessionId: string;
-} | {
- readonly type: "command_queued";
- readonly commandId: string;
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
-} | {
- readonly type: "command_accepted";
- readonly commandId: string;
- readonly turnId: string;
- readonly delivery: "prompt" | "steer";
-} | {
- readonly type: "command_failed";
- readonly commandId: string;
- readonly turnId?: string;
- readonly error: AgentDriverError;
-} | {
- readonly type: "turn_started";
- readonly turnId: string;
- readonly commandIds: readonly string[];
-} | {
- readonly type: "thinking_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "text_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "tool_started";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly input: JsonValue;
-} | {
- readonly type: "tool_finished";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly output?: JsonValue;
-} | {
- readonly type: "compaction_started";
- readonly turnId: string;
-} | {
- readonly type: "compaction_finished";
- readonly turnId: string;
-} | {
- readonly type: "review_started";
- readonly turnId: string;
-} | {
- readonly type: "review_finished";
- readonly turnId: string;
-} | {
- readonly type: "internal_progress";
- readonly turnId?: string;
- readonly source?: string;
- readonly itemType?: string;
- readonly payloadBytes?: number;
-} | {
- readonly type: "diagnostic";
- readonly turnId?: string;
- readonly severity: "debug" | "info" | "warning" | "error";
- readonly source?: string;
- readonly message: string;
-} | {
- readonly type: "token_usage";
- readonly turnId?: string;
- readonly source: string;
- readonly usage: TokenUsage;
- readonly details: JsonObject;
-} | {
- readonly type: "rate_limits";
- readonly turnId?: string;
- readonly source: string;
- readonly details: JsonObject;
-} | {
- readonly type: "turn_completed";
- readonly turnId: string;
- readonly commandIds: readonly string[];
- readonly result: AgentTurnResult;
-} | {
- readonly type: "session_failed";
- readonly error: AgentDriverError;
-} | {
- readonly type: "session_closed";
- readonly result: AgentSessionResult;
-};
-
-// @public (undocumented)
-export function createAgentDriverSdk(options?: PublicAgentDriverSdkOptions): AgentDriverSdk<BuiltinBackendSpecs>;
-
-// @public (undocumented)
-export type CursorCapabilities = FixedCapabilities<false, false, false, false, true, "next_turn_queue", "persistent">;
-
-// @public (undocumented)
-export type CursorConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export type DefaultProvider = {
- readonly kind: "default";
-};
-
-// @public (undocumented)
-export type DeliveryReceipt = {
- readonly status: "accepted";
- readonly delivery: "prompt" | "steer";
- readonly commandId: string;
- readonly turnId: string;
-} | {
- readonly status: "queued";
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
- readonly commandId: string;
-} | {
- readonly status: "rejected";
- readonly reason: "closed" | "unsupported" | "invalid_input" | "runtime_unavailable" | "already_started" | "not_started" | "duplicate_conflict";
- readonly error?: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionInput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer Input, infer _Output> ? Input : never;
-
-// @public (undocumented)
-export type ExtensionNames<Specs, Id extends BackendId<Specs>> = Extract<keyof ExtensionsOf<Specs, Id>, string>;
-
-// @public (undocumented)
-export type ExtensionOutput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer _Input, infer Output> ? Output : never;
-
-// @public (undocumented)
-export type ExtensionResult<Output> = {
- readonly ok: true;
- readonly value: Output;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionsOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer Extensions, infer _Event> ? Extensions : never;
-
-// @public (undocumented)
-export type ExtraEventOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer _Extensions, infer Event> ? Event : never;
-
-// @public (undocumented)
-export type FixedCapabilities<Provider extends boolean, Reasoning extends boolean, Fast extends boolean, Tools extends boolean, Command extends boolean, Delivery extends BackendCapabilities["midTurnDelivery"], Lifetime extends BackendCapabilities["sessionLifetime"]> = BackendCapabilities & {
- readonly modelSelection: "launchable";
- readonly providerConfiguration: Provider;
- readonly reasoningEffort: Reasoning;
- readonly fastMode: Fast;
- readonly disallowedTools: Tools;
- readonly commandOverride: Command;
- readonly resume: "by_id";
- readonly sessionLifetime: Lifetime;
- readonly midTurnDelivery: Delivery;
- readonly interrupt: true;
-};
-
-// @public (undocumented)
-export function getBuiltinBackendCapabilities<Id extends BuiltinBackendId>(backend: Id): CapabilitiesOf<BuiltinBackendSpecs, Id>;
-
-// @public (undocumented)
-export type HostCleanupResult = {
- readonly status: "not_acquired";
-} | {
- readonly status: "released";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-} | {
- readonly status: "timed_out";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type InterruptResult = {
- readonly status: "accepted";
- readonly requestId: string;
- readonly turnId: string;
-} | {
- readonly status: "not_running";
-} | {
- readonly status: "unsupported";
-} | {
- readonly status: "closed";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type JsonObject = {
- readonly [key: string]: JsonValue;
-};
-
-// @public (undocumented)
-export type JsonPrimitive = string | number | boolean | null;
-
-// @public (undocumented)
-export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
-
-// @public (undocumented)
-export interface ModelBackendConfig extends BaseBackendConfig {
- // (undocumented)
- readonly model: ModelSelection;
-}
-
-// @public (undocumented)
-export type ModelSelection = {
- readonly kind: "default";
-} | {
- readonly kind: "named";
- readonly name: string;
-} | {
- readonly kind: "custom";
- readonly name: string;
-};
-
-// @public (undocumented)
-export type OpenCodeCapabilities = FixedCapabilities<false, false, false, false, true, "steer", "persistent">;
-
-// @public (undocumented)
-export type OpenCodeConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface OpenSessionInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly config: ConfigOf<Specs, Id>;
- // (undocumented)
- readonly launch: AgentLaunchContext;
-}
-
-// @public (undocumented)
-export type OpenSessionResult<Specs, Id extends BackendId<Specs>> = {
- readonly ok: true;
- readonly session: AgentSession<Specs, Id>;
- readonly capabilities: CapabilitiesOf<Specs, Id>;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type PiCapabilities = FixedCapabilities<true, true, false, false, false, "steer", "persistent">;
-
-// @public (undocumented)
-export interface PiConfig extends Omit<BaseBackendConfig, "command"> {
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: PiProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type PiProvider = DefaultProvider | {
- readonly kind: "builtin";
- readonly providerId: "google" | "openai" | "openrouter" | (string & {});
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export interface ProbeInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly command?: string;
-}
-
-// @public (undocumented)
-export interface PublicAgentDriverSdkOptions {
- // (undocumented)
- readonly hostReleaseTimeoutMs?: number;
-}
-
-// @public (undocumented)
-export type ReasoningEffort = "low" | "medium" | "high";
-
-// @public (undocumented)
-export interface StopInput {
- // (undocumented)
- readonly forceAfterMs: number;
- // (undocumented)
- readonly reason: "owner_request" | "idle_timeout" | "stalled" | "shutdown" | "reset";
-}
-
-// @public (undocumented)
-export type StopReceipt = {
- readonly status: "accepted";
- readonly requestId: string;
-} | {
- readonly status: "already_stopping";
- readonly requestId: string;
-} | {
- readonly status: "closed";
- readonly result: AgentSessionResult;
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export function toBuiltinBackendSelection(config: BuiltinRuntimeConfigInput): BuiltinBackendSelection;
-
-// @public (undocumented)
-export interface TokenUsage {
- // (undocumented)
- readonly cachedInputTokens?: number;
- // (undocumented)
- readonly inputTokens?: number;
- // (undocumented)
- readonly outputTokens?: number;
- // (undocumented)
- readonly reasoningTokens?: number;
- // (undocumented)
- readonly totalTokens?: number;
-}
-
-// (No @packageDocumentation comment for this package)
-
-```
diff --git a/src/daemon/agent-driver/etc/api/testing.api.md b/src/daemon/agent-driver/etc/api/testing.api.md
deleted file mode 100644
index 267de3795..000000000
--- a/src/daemon/agent-driver/etc/api/testing.api.md
+++ /dev/null
@@ -1,732 +0,0 @@
-## API Report File for "@alook/agent-driver"
-
-> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
-
-```ts
-
-// @public (undocumented)
-export interface AgentDriverConformanceFixture<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- completeFirstTurn(): Promise<void>;
- // (undocumented)
- readonly session: AgentSession<Specs, Id>;
-}
-
-// @public (undocumented)
-export interface AgentDriverConformanceResult {
- // (undocumented)
- readonly conflictingDuplicate: DeliveryReceipt;
- // (undocumented)
- readonly duplicateStart: DeliveryReceipt;
- // (undocumented)
- readonly events: readonly {
- readonly type: string;
- readonly sequence: number;
- }[];
- // (undocumented)
- readonly firstStart: DeliveryReceipt;
- // (undocumented)
- readonly secondStart: DeliveryReceipt;
- // (undocumented)
- readonly sendBeforeStart: DeliveryReceipt;
- // (undocumented)
- readonly stop: StopReceipt;
-}
-
-// @public (undocumented)
-export interface AgentDriverError {
- // (undocumented)
- readonly category: "runtime_unavailable" | "authentication" | "configuration" | "protocol" | "process" | "sdk" | "timeout" | "cancelled" | "buffer_overflow" | "internal";
- // (undocumented)
- readonly code: string;
- // (undocumented)
- readonly details?: JsonObject;
- // (undocumented)
- readonly message: string;
- // (undocumented)
- readonly retryable: boolean;
-}
-
-// @public (undocumented)
-export interface AgentDriverHost {
- // (undocumented)
- createId(): string;
- // (undocumented)
- now(): number;
- // (undocumented)
- onRawOutput(event: RawOutputEvent): void;
- // (undocumented)
- prepareExecution(input: PrepareExecutionInput): Promise<PrepareExecutionResult>;
-}
-
-// @public (undocumented)
-export interface AgentDriverSdk<Specs = BuiltinBackendSpecs> {
- // (undocumented)
- readonly backendIds: readonly BackendId<Specs>[];
- // (undocumented)
- open<Id extends BackendId<Specs>>(input: OpenSessionInput<Specs, Id>): Promise<OpenSessionResult<Specs, Id>>;
- // (undocumented)
- probe<Id extends BackendId<Specs>>(input: ProbeInput<Specs, Id>): Promise<BackendProbe<CapabilitiesOf<Specs, Id>>>;
-}
-
-// @public (undocumented)
-export type AgentEvent<Specs, Id extends BackendId<Specs>> = AgentEventEnvelope & (CoreAgentEventPayload | ExtraEventOf<Specs, Id>);
-
-// @public (undocumented)
-export interface AgentEventEnvelope {
- // (undocumented)
- readonly at: number;
- // (undocumented)
- readonly sequence: number;
- // (undocumented)
- readonly sessionInstanceId: string;
-}
-
-// @public (undocumented)
-export interface AgentEventStream<Event> extends AsyncIterable<Event> {
- // (undocumented)
- readonly maxBufferedBytes: 4_194_304;
-}
-
-// @public (undocumented)
-export interface AgentInstructions {
- // (undocumented)
- readonly content: string;
- // (undocumented)
- readonly format: "markdown";
-}
-
-// @public (undocumented)
-export interface AgentLaunchContext {
- // (undocumented)
- readonly instructions: AgentInstructions;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly resumeSessionId?: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export interface AgentMessage {
- // (undocumented)
- readonly id: string;
- // (undocumented)
- readonly kind: "user" | "system" | "recovery";
- // (undocumented)
- readonly sequence?: number;
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export interface AgentSession<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly capabilities: CapabilitiesOf<Specs, Id>;
- // (undocumented)
- readonly closed: Promise<AgentSessionResult>;
- // (undocumented)
- readonly events: AgentEventStream<AgentEvent<Specs, Id>>;
- // (undocumented)
- interrupt(input: {
- readonly requestId: string;
- readonly reason: string;
- }): Promise<InterruptResult>;
- // (undocumented)
- invokeExtension<Name extends ExtensionNames<Specs, Id>>(name: Name, input: ExtensionInput<Specs, Id, Name>): Promise<ExtensionResult<ExtensionOutput<Specs, Id, Name>>>;
- // (undocumented)
- send(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- snapshot(): AgentSessionSnapshot;
- // (undocumented)
- start(message: AgentMessage): Promise<DeliveryReceipt>;
- // (undocumented)
- stop(input: StopInput): Promise<StopReceipt>;
-}
-
-// @public (undocumented)
-export type AgentSessionResult = {
- readonly outcome: "stopped";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly exitCode?: number | null;
- readonly signal?: string | null;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "crashed";
- readonly requested: false;
- readonly backendSessionId?: string;
- readonly exitCode: number | null;
- readonly signal: string | null;
- readonly error?: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "failed_to_start";
- readonly requested: false;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-} | {
- readonly outcome: "forced";
- readonly requested: true;
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
- readonly cleanup: HostCleanupResult;
-};
-
-// @public (undocumented)
-export interface AgentSessionSnapshot {
- // (undocumented)
- readonly activeTurn?: {
- readonly turnId: string;
- readonly commandIds: readonly string[];
- };
- // (undocumented)
- readonly backendSessionId?: string;
- // (undocumented)
- readonly diagnostics: {
- readonly deliveryPhase: "idle" | "admission_wait" | "steering" | "next_turn_queued" | "compacting" | "reviewing" | "tool_wait" | "working";
- readonly metrics: {
- readonly physicalOpenCount: number;
- readonly turnCount: number;
- readonly commandAdmissionCount: number;
- readonly commandAdmissionLatencyTotalMs: number;
- readonly queueDwellCount: number;
- readonly queueDwellTotalMs: number;
- readonly sseReconnectCount: number;
- readonly resumeOutcome: "not_requested" | "pending" | "resumed" | "reset_required" | "failed";
- readonly terminalOwnerKind: "transport_request" | "vendor_message" | "prompt_invocation" | "lane_generation";
- };
- };
- // (undocumented)
- readonly lastEventSequence: number;
- // (undocumented)
- readonly queuedCommands: readonly {
- readonly commandId: string;
- readonly kind: AgentMessage["kind"];
- }[];
- // (undocumented)
- readonly sessionInstanceId: string;
- // (undocumented)
- readonly state: "new" | "awaiting_first_message" | "starting" | "idle" | "working" | "stopping" | "closed";
-}
-
-// @public (undocumented)
-export type AgentTurnResult = {
- readonly outcome: "success";
- readonly backendSessionId: string;
-} | {
- readonly outcome: "interrupted";
- readonly backendSessionId?: string;
-} | {
- readonly outcome: "failed";
- readonly backendSessionId?: string;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface BackendCapabilities {
- // (undocumented)
- readonly commandOverride: boolean;
- // (undocumented)
- readonly disallowedTools: boolean;
- // (undocumented)
- readonly fastMode: boolean;
- // (undocumented)
- readonly interrupt: boolean;
- // (undocumented)
- readonly midTurnDelivery: "steer" | "safe_boundary_queue" | "next_turn_queue";
- // (undocumented)
- readonly modelSelection: "launchable" | "suggestion_only" | "unsupported";
- // (undocumented)
- readonly providerConfiguration: boolean;
- // (undocumented)
- readonly reasoningEffort: boolean;
- // (undocumented)
- readonly resume: "by_id" | "none";
- // (undocumented)
- readonly sessionLifetime: "persistent" | "per_turn";
-}
-
-// @public (undocumented)
-export interface BackendExtensionSpec<Input, Output> {
- // (undocumented)
- readonly input: Input;
- // (undocumented)
- readonly output: Output;
-}
-
-// @public (undocumented)
-export type BackendId<Specs> = Extract<keyof Specs, string>;
-
-// @public (undocumented)
-export type BackendProbe<Capabilities> = {
- readonly status: "healthy";
- readonly version?: string;
- readonly capabilities: Capabilities;
-} | {
- readonly status: "unhealthy";
- readonly error: AgentDriverError;
- readonly capabilities: Capabilities;
-};
-
-// @public (undocumented)
-export interface BackendTypeSpec<Config, Capabilities, Extensions, ExtraEvent> {
- // (undocumented)
- readonly capabilities: Capabilities;
- // (undocumented)
- readonly config: Config;
- // (undocumented)
- readonly extensions: Extensions;
- // (undocumented)
- readonly extraEvent: ExtraEvent;
-}
-
-// @public (undocumented)
-export interface BaseBackendConfig {
- // (undocumented)
- readonly command?: string;
- // (undocumented)
- readonly environment?: Readonly<Record<string, string>>;
-}
-
-// @public (undocumented)
-export type BuiltinBackendId = "claude" | "codex" | "cursor" | "opencode" | "pi";
-
-// @public (undocumented)
-export interface BuiltinBackendSpecs {
- // (undocumented)
- readonly claude: BackendTypeSpec<ClaudeConfig, ClaudeCapabilities, {}, never>;
- // (undocumented)
- readonly codex: BackendTypeSpec<CodexConfig, CodexCapabilities, {}, never>;
- // (undocumented)
- readonly cursor: BackendTypeSpec<CursorConfig, CursorCapabilities, {}, never>;
- // (undocumented)
- readonly opencode: BackendTypeSpec<OpenCodeConfig, OpenCodeCapabilities, {}, never>;
- // (undocumented)
- readonly pi: BackendTypeSpec<PiConfig, PiCapabilities, {}, never>;
-}
-
-// @public (undocumented)
-export type CapabilitiesOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer Caps, infer _Extensions, infer _Event> ? Caps : never;
-
-// @public (undocumented)
-export type ClaudeCapabilities = FixedCapabilities<true, true, true, true, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface ClaudeConfig extends BaseBackendConfig {
- // (undocumented)
- readonly disallowedTools?: string;
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: ClaudeProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ClaudeProvider = DefaultProvider | {
- readonly kind: "custom_endpoint";
- readonly apiUrl: string;
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export type CodexCapabilities = FixedCapabilities<false, true, true, false, true, "safe_boundary_queue", "persistent">;
-
-// @public (undocumented)
-export interface CodexConfig extends BaseBackendConfig {
- // (undocumented)
- readonly mode: "default" | "fast";
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type ConfigOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer Config, infer _Caps, infer _Extensions, infer _Event> ? Config : never;
-
-// @public (undocumented)
-export type CoreAgentEventPayload = {
- readonly type: "session_started";
- readonly backendSessionId: string;
-} | {
- readonly type: "command_queued";
- readonly commandId: string;
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
-} | {
- readonly type: "command_accepted";
- readonly commandId: string;
- readonly turnId: string;
- readonly delivery: "prompt" | "steer";
-} | {
- readonly type: "command_failed";
- readonly commandId: string;
- readonly turnId?: string;
- readonly error: AgentDriverError;
-} | {
- readonly type: "turn_started";
- readonly turnId: string;
- readonly commandIds: readonly string[];
-} | {
- readonly type: "thinking_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "text_delta";
- readonly turnId: string;
- readonly text: string;
-} | {
- readonly type: "tool_started";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly input: JsonValue;
-} | {
- readonly type: "tool_finished";
- readonly turnId: string;
- readonly callId?: string;
- readonly name: string;
- readonly output?: JsonValue;
-} | {
- readonly type: "compaction_started";
- readonly turnId: string;
-} | {
- readonly type: "compaction_finished";
- readonly turnId: string;
-} | {
- readonly type: "review_started";
- readonly turnId: string;
-} | {
- readonly type: "review_finished";
- readonly turnId: string;
-} | {
- readonly type: "internal_progress";
- readonly turnId?: string;
- readonly source?: string;
- readonly itemType?: string;
- readonly payloadBytes?: number;
-} | {
- readonly type: "diagnostic";
- readonly turnId?: string;
- readonly severity: "debug" | "info" | "warning" | "error";
- readonly source?: string;
- readonly message: string;
-} | {
- readonly type: "token_usage";
- readonly turnId?: string;
- readonly source: string;
- readonly usage: TokenUsage;
- readonly details: JsonObject;
-} | {
- readonly type: "rate_limits";
- readonly turnId?: string;
- readonly source: string;
- readonly details: JsonObject;
-} | {
- readonly type: "turn_completed";
- readonly turnId: string;
- readonly commandIds: readonly string[];
- readonly result: AgentTurnResult;
-} | {
- readonly type: "session_failed";
- readonly error: AgentDriverError;
-} | {
- readonly type: "session_closed";
- readonly result: AgentSessionResult;
-};
-
-// @public (undocumented)
-export function createFakeAgentDriverHost(overrides?: Partial<PreparedExecutionResource>): FakeAgentDriverHost;
-
-// @public (undocumented)
-export type CursorCapabilities = FixedCapabilities<false, false, false, false, true, "next_turn_queue", "persistent">;
-
-// @public (undocumented)
-export type CursorConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface DefaultAgentDriverHostOptions {
- // (undocumented)
- readonly environment?: Readonly<Record<string, string | undefined>>;
- // (undocumented)
- readonly onRawOutput?: (event: RawOutputEvent) => void;
-}
-
-// @public (undocumented)
-export type DefaultProvider = {
- readonly kind: "default";
-};
-
-// @public (undocumented)
-export type DeliveryReceipt = {
- readonly status: "accepted";
- readonly delivery: "prompt" | "steer";
- readonly commandId: string;
- readonly turnId: string;
-} | {
- readonly status: "queued";
- readonly reason: "unsafe_boundary" | "runtime_busy" | "waiting_for_message";
- readonly commandId: string;
-} | {
- readonly status: "rejected";
- readonly reason: "closed" | "unsupported" | "invalid_input" | "runtime_unavailable" | "already_started" | "not_started" | "duplicate_conflict";
- readonly error?: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionInput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer Input, infer _Output> ? Input : never;
-
-// @public (undocumented)
-export type ExtensionNames<Specs, Id extends BackendId<Specs>> = Extract<keyof ExtensionsOf<Specs, Id>, string>;
-
-// @public (undocumented)
-export type ExtensionOutput<Specs, Id extends BackendId<Specs>, Name extends ExtensionNames<Specs, Id>> = ExtensionsOf<Specs, Id>[Name] extends BackendExtensionSpec<infer _Input, infer Output> ? Output : never;
-
-// @public (undocumented)
-export type ExtensionResult<Output> = {
- readonly ok: true;
- readonly value: Output;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type ExtensionsOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer Extensions, infer _Event> ? Extensions : never;
-
-// @public (undocumented)
-export type ExtraEventOf<Specs, Id extends BackendId<Specs>> = Specs[Id] extends BackendTypeSpec<infer _Config, infer _Caps, infer _Extensions, infer Event> ? Event : never;
-
-// @public (undocumented)
-export interface FakeAgentDriverHost extends AgentDriverHost {
- // (undocumented)
- readonly rawOutput: RawOutputEvent[];
- // (undocumented)
- readonly releases: Array<Parameters<PreparedExecutionResource["release"]>[0]>;
-}
-
-// @public (undocumented)
-export type FixedCapabilities<Provider extends boolean, Reasoning extends boolean, Fast extends boolean, Tools extends boolean, Command extends boolean, Delivery extends BackendCapabilities["midTurnDelivery"], Lifetime extends BackendCapabilities["sessionLifetime"]> = BackendCapabilities & {
- readonly modelSelection: "launchable";
- readonly providerConfiguration: Provider;
- readonly reasoningEffort: Reasoning;
- readonly fastMode: Fast;
- readonly disallowedTools: Tools;
- readonly commandOverride: Command;
- readonly resume: "by_id";
- readonly sessionLifetime: Lifetime;
- readonly midTurnDelivery: Delivery;
- readonly interrupt: true;
-};
-
-// @public (undocumented)
-export type HostCleanupResult = {
- readonly status: "not_acquired";
-} | {
- readonly status: "released";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-} | {
- readonly status: "timed_out";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type InterruptResult = {
- readonly status: "accepted";
- readonly requestId: string;
- readonly turnId: string;
-} | {
- readonly status: "not_running";
-} | {
- readonly status: "unsupported";
-} | {
- readonly status: "closed";
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type JsonObject = {
- readonly [key: string]: JsonValue;
-};
-
-// @public (undocumented)
-export type JsonPrimitive = string | number | boolean | null;
-
-// @public (undocumented)
-export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
-
-// @public (undocumented)
-export interface ModelBackendConfig extends BaseBackendConfig {
- // (undocumented)
- readonly model: ModelSelection;
-}
-
-// @public (undocumented)
-export type ModelSelection = {
- readonly kind: "default";
-} | {
- readonly kind: "named";
- readonly name: string;
-} | {
- readonly kind: "custom";
- readonly name: string;
-};
-
-// @public (undocumented)
-export type OpenCodeCapabilities = FixedCapabilities<false, false, false, false, true, "steer", "persistent">;
-
-// @public (undocumented)
-export type OpenCodeConfig = ModelBackendConfig;
-
-// @public (undocumented)
-export interface OpenSessionInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly config: ConfigOf<Specs, Id>;
- // (undocumented)
- readonly launch: AgentLaunchContext;
-}
-
-// @public (undocumented)
-export type OpenSessionResult<Specs, Id extends BackendId<Specs>> = {
- readonly ok: true;
- readonly session: AgentSession<Specs, Id>;
- readonly capabilities: CapabilitiesOf<Specs, Id>;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export type PiCapabilities = FixedCapabilities<true, true, false, false, false, "steer", "persistent">;
-
-// @public (undocumented)
-export interface PiConfig extends Omit<BaseBackendConfig, "command"> {
- // (undocumented)
- readonly model: ModelSelection;
- // (undocumented)
- readonly provider: PiProvider;
- // (undocumented)
- readonly reasoningEffort?: ReasoningEffort;
-}
-
-// @public (undocumented)
-export type PiProvider = DefaultProvider | {
- readonly kind: "builtin";
- readonly providerId: "google" | "openai" | "openrouter" | (string & {});
- readonly apiKey: string;
-};
-
-// @public (undocumented)
-export interface PreparedExecutionResource {
- // (undocumented)
- readonly environmentLayers: Readonly<Record<"base" | "hostStatic" | "identityProtected" | "platformProtected" | "runtimeProtected" | "networkProtected" | "credentialSensitive", Readonly<Record<string, string | undefined>>>>;
- // (undocumented)
- readonly executablePath?: string;
- // (undocumented)
- release(input: {
- readonly reason: "normal" | "failed_start" | "crash" | "requested_stop" | "consumer_closed";
- readonly signal: AbortSignal;
- readonly deadlineAt: number;
- }): Promise<void>;
-}
-
-// @public (undocumented)
-export interface PrepareExecutionInput {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly workingDirectory: string;
-}
-
-// @public (undocumented)
-export type PrepareExecutionResult = {
- readonly ok: true;
- readonly resource: PreparedExecutionResource;
-} | {
- readonly ok: false;
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface ProbeInput<Specs, Id extends BackendId<Specs>> {
- // (undocumented)
- readonly backend: Id;
- // (undocumented)
- readonly command?: string;
-}
-
-// @public (undocumented)
-export interface RawOutputEvent {
- // (undocumented)
- readonly backend: string;
- // (undocumented)
- readonly launchId: string;
- // (undocumented)
- readonly stream: "stdout" | "stderr";
- // (undocumented)
- readonly text: string;
-}
-
-// @public (undocumented)
-export type ReasoningEffort = "low" | "medium" | "high";
-
-// @public
-export function runAgentDriverConformance<Specs, Id extends BackendId<Specs>>(create: () => Promise<AgentDriverConformanceFixture<Specs, Id>> | AgentDriverConformanceFixture<Specs, Id>): Promise<AgentDriverConformanceResult>;
-
-// @public (undocumented)
-export interface StopInput {
- // (undocumented)
- readonly forceAfterMs: number;
- // (undocumented)
- readonly reason: "owner_request" | "idle_timeout" | "stalled" | "shutdown" | "reset";
-}
-
-// @public (undocumented)
-export type StopReceipt = {
- readonly status: "accepted";
- readonly requestId: string;
-} | {
- readonly status: "already_stopping";
- readonly requestId: string;
-} | {
- readonly status: "closed";
- readonly result: AgentSessionResult;
-} | {
- readonly status: "failed";
- readonly error: AgentDriverError;
-};
-
-// @public (undocumented)
-export interface TokenUsage {
- // (undocumented)
- readonly cachedInputTokens?: number;
- // (undocumented)
- readonly inputTokens?: number;
- // (undocumented)
- readonly outputTokens?: number;
- // (undocumented)
- readonly reasoningTokens?: number;
- // (undocumented)
- readonly totalTokens?: number;
-}
-
-// (No @packageDocumentation comment for this package)
-
-```
diff --git a/src/daemon/agent-driver/package.json b/src/daemon/agent-driver/package.json
index a67c278a7..871b17686 100644
--- a/src/daemon/agent-driver/package.json
+++ b/src/daemon/agent-driver/package.json
@@ -45,12 +45,9 @@
"typecheck": "tsc --noEmit",
"test": "vitest run",
"lint": "eslint .",
- "knip": "knip",
- "api:check": "pnpm run build && node scripts/api-reports.mjs check",
- "api:update": "pnpm run build && node scripts/api-reports.mjs update"
+ "knip": "knip"
},
"devDependencies": {
- "@microsoft/api-extractor": "^7.58.13",
"@types/node": "^20.0.0",
"eslint": "^9.39.5",
"knip": "^5.85.0",
diff --git a/src/daemon/agent-driver/scripts/api-reports.mjs b/src/daemon/agent-driver/scripts/api-reports.mjs
deleted file mode 100644
index cb09c3b1b..000000000
--- a/src/daemon/agent-driver/scripts/api-reports.mjs
+++ /dev/null
@@ -1,24 +0,0 @@
-import { resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
-
-const packageRoot = resolve(fileURLToPath(new URL("..", import.meta.url)));
-const mode = process.argv[2];
-if (mode !== "check" && mode !== "update") {
- throw new Error("Usage: node scripts/api-reports.mjs <check|update>");
-}
-
-const reports = ["root", "host", "adapter-author", "testing"];
-let failed = false;
-for (const report of reports) {
- const configPath = resolve(packageRoot, `api-extractor.${report}.json`);
- const config = ExtractorConfig.loadFileAndPrepare(configPath);
- const result = Extractor.invoke(config, {
- localBuild: mode === "update",
- showDiagnostics: false,
- showVerboseMessages: false,
- });
- if (!result.succeeded) failed = true;
-}
-
-if (failed) process.exitCode = 1;
diff --git a/src/web/playwright.config.ts b/src/web/playwright.config.ts
index 039a5b68e..54b8cc25f 100644
--- a/src/web/playwright.config.ts
+++ b/src/web/playwright.config.ts
@@ -11,7 +11,7 @@ export default defineConfig({
// single-worker and zero-retry; parallelism or retries would reuse state.
retries: 0,
workers: 1,
- reporter: process.env.CI ? [["blob"], ["list"]] : "list",
+ reporter: process.env.CI ? [["blob"], ["github"], ["list"]] : "list",
globalSetup: "./src/test/e2e-ui/_setup/global-setup.ts",
globalTeardown: "./src/test/e2e-ui/_setup/global-teardown.ts",
timeout: 60_000,
diff --git a/src/web/src/test/playwright-config.test.ts b/src/web/src/test/playwright-config.test.ts
new file mode 100644
index 000000000..f27809c80
--- /dev/null
+++ b/src/web/src/test/playwright-config.test.ts
@@ -0,0 +1,38 @@
+import { afterEach, describe, expect, it, vi } from "vitest"
+
+const originalCi = process.env.CI
+
+async function loadReporter(ci: string | undefined) {
+ if (ci === undefined) {
+ delete process.env.CI
+ } else {
+ process.env.CI = ci
+ }
+
+ vi.resetModules()
+ const { default: config } = await import("../../playwright.config")
+ return config.reporter
+}
+
+afterEach(() => {
+ if (originalCi === undefined) {
+ delete process.env.CI
+ } else {
+ process.env.CI = originalCi
+ }
+ vi.resetModules()
+})
+
+describe("Playwright reporter configuration", () => {
+ it("publishes blob, GitHub, and list reporters in CI", async () => {
+ await expect(loadReporter("1")).resolves.toEqual([
+ ["blob"],
+ ["github"],
+ ["list"],
+ ])
+ })
+
+ it("uses the list reporter outside CI", async () => {
+ await expect(loadReporter(undefined)).resolves.toBe("list")
+ })
+})