mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
Merge remote-tracking branch 'origin/main' into dev/stevenlee/plugin-service-preview-routing
# Conflicts: # codex-rs/app-server/src/request_processors/plugins.rs # codex-rs/codex-mcp/src/codex_apps.rs # codex-rs/codex-mcp/src/connection_manager_tests.rs # codex-rs/codex-mcp/src/mcp/mod.rs # codex-rs/core/src/connectors.rs # codex-rs/core/src/mcp_tool_call_tests.rs # codex-rs/core/src/session/mcp.rs # codex-rs/core/src/session/session.rs
This commit is contained in:
@@ -107,8 +107,9 @@ common:ci-bazel --config=ci
|
||||
common:ci-bazel --build_metadata=TAG_workflow=bazel
|
||||
# Keep code-mode integration cases out of ordinary Bazel legs. The
|
||||
# Windows-cross config below re-enables them after generating its Windows V8
|
||||
# snapshot on the Windows runner.
|
||||
common:ci-bazel --test_env=CODEX_BAZEL_TEST_SKIP_FILTERS=suite::code_mode::
|
||||
# snapshot on the Windows runner. Also skip the ConPTY Ctrl-C integration test
|
||||
# until Windows Bazel CI can reliably interrupt foreground processes.
|
||||
common:ci-bazel --test_env=CODEX_BAZEL_TEST_SKIP_FILTERS=suite::code_mode::,tests::windows_tests::conpty_ctrl_c_interrupts_powershell_foreground_child
|
||||
|
||||
# Shared config for Bazel-backed Rust linting.
|
||||
build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
|
||||
@@ -191,11 +192,12 @@ common:ci-windows-cross --strategy=TestRunner=local
|
||||
common:ci-windows-cross --strategy=V8Mksnapshot=local
|
||||
common:ci-windows-cross --local_test_jobs=4
|
||||
common:ci-windows-cross --test_env=RUST_TEST_THREADS=1
|
||||
# Native Windows CI still covers the PowerShell tests. The cross-built gnullvm
|
||||
# binaries currently hang in PowerShell AST parser tests when those binaries are
|
||||
# run on the Windows runner. Keep V8-backed code-mode tests enabled except for
|
||||
# the hidden dynamic-tool callback test, which currently times out on Windows.
|
||||
common:ci-windows-cross --test_env=CODEX_BAZEL_TEST_SKIP_FILTERS=powershell,suite::code_mode::code_mode_can_call_hidden_dynamic_tools
|
||||
# Native Windows CI still covers the PowerShell parser-process tests. The
|
||||
# cross-built gnullvm binaries currently hang in those tests when run on the
|
||||
# Windows runner. Keep V8-backed code-mode tests enabled except for the hidden
|
||||
# dynamic-tool callback test, which currently times out on Windows. This config
|
||||
# replaces the base skip list, so repeat the exact ConPTY Ctrl-C test exclusion.
|
||||
common:ci-windows-cross --test_env=CODEX_BAZEL_TEST_SKIP_FILTERS=command_safety::powershell_parser::tests::,suite::code_mode::code_mode_can_call_hidden_dynamic_tools,tests::windows_tests::conpty_ctrl_c_interrupts_powershell_foreground_child
|
||||
common:ci-windows-cross --platforms=//:windows_x86_64_gnullvm
|
||||
common:ci-windows-cross --extra_execution_platforms=//:rbe,//:windows_x86_64_msvc
|
||||
common:ci-windows-cross --extra_toolchains=//:windows_gnullvm_tests_on_msvc_host_toolchain
|
||||
|
||||
@@ -1,17 +1,104 @@
|
||||
---
|
||||
name: remote-tests
|
||||
description: How to run tests using remote executor.
|
||||
description: Testing against remote executors in integration tests.
|
||||
---
|
||||
|
||||
Some Codex integration tests select `local`, `docker`, or `wine-exec` through
|
||||
`CODEX_TEST_ENVIRONMENT`. The legacy `CODEX_TEST_REMOTE_ENV=<container>` still
|
||||
selects Docker; otherwise execution is local.
|
||||
Remote executor tests exercise the app-server/exec-server split to ensure that agent features work
|
||||
in both local and remote execution environments.
|
||||
|
||||
Docker container is built and initialized via ./scripts/test-remote-env.sh
|
||||
Remote executor tests currently require an x86_64 Linux host machine. There are two flavors:
|
||||
|
||||
On x86-64 Linux, run Wine exec with
|
||||
`bazel test //codex-rs/core:core-all-wine-exec-test --test_output=errors`.
|
||||
Temporary blockers belong beside the test in `skip_if_wine_exec!` calls.
|
||||
1. Docker (Linux exec-server)
|
||||
2. Wine (Windows exec-server)
|
||||
|
||||
## Test Fixtures
|
||||
|
||||
Individual test cases must opt-in to being run against a remote executor.
|
||||
|
||||
### codex_core
|
||||
|
||||
Use `TestCodexBuilder::build_with_auto_env()` to opt-in to remote execution in core integration
|
||||
tests unless the test needs more precise control over its executor.
|
||||
|
||||
### app-server
|
||||
|
||||
Start the server with `TestAppServer::new_with_auto_env()` unless the test defines its own
|
||||
`$CODEX_HOME/environments.toml` or will define custom environments at runtime.
|
||||
|
||||
Start threads with `TestAppServer::send_thread_start_request_with_auto_env()` if you've created the
|
||||
server with the `auto_env` approach. Omit `ThreadStartParams.environments` (leave it as `None`) when
|
||||
doing so.
|
||||
|
||||
## Test Skips
|
||||
|
||||
If a test doesn't pass in a particular remote executor configuration you can skip it in just that
|
||||
configuration. Include a string reason for future readers when the selected skip macro supports
|
||||
one.
|
||||
|
||||
Choose the skip macro by what causes the test to fail:
|
||||
|
||||
- `skip_if_target_windows!`: Windows target behavior.
|
||||
- `skip_if_wine_exec!`: Wine-exec runner constraints.
|
||||
- `skip_if_host_windows!`: Windows host constraints.
|
||||
- `skip_if_remote!`: Local-only test behavior.
|
||||
- `skip_if_no_remote_env!`: Remote-only test behavior.
|
||||
|
||||
Prefer defining tests that run in all host/target configurations by default. See the `$path-types`
|
||||
skill for the most common changes required to make tests compatible.
|
||||
|
||||
## Docker
|
||||
|
||||
Docker container is built and initialized via ./scripts/test-remote-env.sh. Sourcing this script
|
||||
in bash also provides the `codex_remote_env_cleanup` function to use after testing.
|
||||
|
||||
To run core integration tests against a Docker remote executor:
|
||||
|
||||
```bash
|
||||
bash -c '
|
||||
set -euo pipefail
|
||||
unset CODEX_TEST_REMOTE_EXEC_SERVER_URL
|
||||
source scripts/test-remote-env.sh
|
||||
trap codex_remote_env_cleanup EXIT
|
||||
|
||||
cd codex-rs
|
||||
just test -p codex-core --test all
|
||||
'
|
||||
```
|
||||
|
||||
To run app-server integration tests against a Docker remote executor:
|
||||
|
||||
```bash
|
||||
bash -c '
|
||||
set -euo pipefail
|
||||
unset CODEX_TEST_REMOTE_EXEC_SERVER_URL
|
||||
source scripts/test-remote-env.sh
|
||||
trap codex_remote_env_cleanup EXIT
|
||||
|
||||
cd codex-rs
|
||||
just test -p codex-app-server --test all
|
||||
'
|
||||
```
|
||||
|
||||
## Wine
|
||||
|
||||
These tests build an exec-server for Windows and run it under Wine, with the app-server staying on
|
||||
the Linux host. The cross-platform build dependency means they only run in Bazel.
|
||||
|
||||
For core integration tests:
|
||||
|
||||
```sh
|
||||
bazel test //codex-rs/core:core-all-wine-exec-test
|
||||
```
|
||||
|
||||
For app-server integration tests:
|
||||
|
||||
```sh
|
||||
bazel test //codex-rs/app-server:app-server-all-wine-exec-test
|
||||
```
|
||||
|
||||
## Devboxes
|
||||
|
||||
You can use a devbox to run these tests if you are running on a macOS machine.
|
||||
|
||||
You can list devboxes via `applied_devbox ls`, pick the one with `codex` in the name.
|
||||
Connect to devbox via `ssh <devbox_name>`.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Core crate ownership.
|
||||
/codex-rs/core/ @openai/codex-core-agent-team
|
||||
/codex-rs/exec-server-protocol/ @openai/codex-core-agent-team
|
||||
/codex-rs/ext/extension-api/ @openai/codex-core-agent-team
|
||||
/codex-rs/prompts/ @openai/codex-core-agent-team
|
||||
/codex-rs/utils/path-uri/ @openai/codex-core-agent-team
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
name: check-clean-worktree
|
||||
description: Fail when a CI job leaves tracked changes or untracked files in the repository worktree.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check for a clean worktree
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
status="$(git -C "${GITHUB_WORKSPACE}" status --porcelain=v1 --untracked-files=normal --ignore-submodules=none)"
|
||||
if [[ -z "${status}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "::error::CI job left tracked changes or untracked files in the repository worktree"
|
||||
printf '%s\n' "${status}"
|
||||
exit 1
|
||||
@@ -34,6 +34,10 @@ runs:
|
||||
|
||||
- name: Set up Bazel
|
||||
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
|
||||
# Without an explicit Bazelisk version, setup-bazel leaves PATH unchanged
|
||||
# and Windows can use the runner's standalone Bazel, ignoring .bazelversion.
|
||||
with:
|
||||
bazelisk-version: 1.28.1
|
||||
|
||||
- name: Configure Bazel repository cache
|
||||
id: configure_bazel_repository_cache
|
||||
|
||||
@@ -5,21 +5,25 @@
|
||||
"macos-aarch64": {
|
||||
"name": "codex-zsh-aarch64-apple-darwin.tar.gz",
|
||||
"format": "tar.gz",
|
||||
"hash": "sha256",
|
||||
"path": "codex-zsh/bin/zsh"
|
||||
},
|
||||
"macos-x86_64": {
|
||||
"name": "codex-zsh-x86_64-apple-darwin.tar.gz",
|
||||
"format": "tar.gz",
|
||||
"hash": "sha256",
|
||||
"path": "codex-zsh/bin/zsh"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"name": "codex-zsh-x86_64-unknown-linux-musl.tar.gz",
|
||||
"format": "tar.gz",
|
||||
"hash": "sha256",
|
||||
"path": "codex-zsh/bin/zsh"
|
||||
},
|
||||
"linux-aarch64": {
|
||||
"name": "codex-zsh-aarch64-unknown-linux-musl.tar.gz",
|
||||
"format": "tar.gz",
|
||||
"hash": "sha256",
|
||||
"path": "codex-zsh/bin/zsh"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ Usage: build-codex-package-archive.sh \
|
||||
--entrypoint-dir <dir> \
|
||||
--archive-dir <dir> \
|
||||
[--bwrap-bin <path>] \
|
||||
[--zsh-manifest <path>] \
|
||||
[--codex-command-runner-bin <path>] \
|
||||
[--codex-windows-sandbox-setup-bin <path>] \
|
||||
[--target-suffixed-entrypoint]
|
||||
@@ -48,6 +49,10 @@ while [[ $# -gt 0 ]]; do
|
||||
bwrap_bin_provided="true"
|
||||
shift 2
|
||||
;;
|
||||
--zsh-manifest)
|
||||
resource_args+=(--zsh-manifest "${2:?--zsh-manifest requires a value}")
|
||||
shift 2
|
||||
;;
|
||||
--codex-command-runner-bin)
|
||||
resource_args+=(
|
||||
--codex-command-runner-bin
|
||||
|
||||
@@ -134,6 +134,10 @@ jobs:
|
||||
path: ${{ steps.prepare_bazel.outputs.repository-cache-path }}
|
||||
key: ${{ steps.prepare_bazel.outputs.repository-cache-key }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
test-windows-shard:
|
||||
# Split the Windows Bazel test leg across separate Windows hosts. Jobs with
|
||||
# BuildBuddy credentials use Linux RBE for build actions; test execution
|
||||
@@ -239,6 +243,10 @@ jobs:
|
||||
path: ${{ runner.temp }}/bazel-execution-logs
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
test-windows:
|
||||
# Preserve the existing required-check surface while the real work happens
|
||||
# in the sharded Windows jobs above.
|
||||
@@ -333,6 +341,10 @@ jobs:
|
||||
path: ${{ steps.prepare_bazel.outputs.repository-cache-path }}
|
||||
key: ${{ steps.prepare_bazel.outputs.repository-cache-key }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
clippy:
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
@@ -433,6 +445,10 @@ jobs:
|
||||
path: ${{ steps.prepare_bazel.outputs.repository-cache-path }}
|
||||
key: ${{ steps.prepare_bazel.outputs.repository-cache-key }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
verify-release-build:
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
@@ -545,3 +561,7 @@ jobs:
|
||||
with:
|
||||
path: ${{ steps.prepare_bazel.outputs.repository-cache-path }}
|
||||
key: ${{ steps.prepare_bazel.outputs.repository-cache-key }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -32,3 +32,7 @@ jobs:
|
||||
--head "$HEAD_SHA" \
|
||||
--max-bytes 512000 \
|
||||
--allowlist .github/blob-size-allowlist.txt
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -32,3 +32,7 @@ jobs:
|
||||
with:
|
||||
rust-version: 1.95.0
|
||||
manifest-path: ./codex-rs/Cargo.toml
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -88,3 +88,7 @@ jobs:
|
||||
|
||||
- name: Prettier (run `pnpm run format:fix` to fix)
|
||||
run: pnpm run format
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -28,3 +28,7 @@ jobs:
|
||||
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # v2.2
|
||||
with:
|
||||
ignore_words_file: .codespellignore
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -58,6 +58,10 @@ jobs:
|
||||
echo "codex=$codex" >> "$GITHUB_OUTPUT"
|
||||
echo "workflows=$workflows" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
# --- Fast Cargo-native PR checks -------------------------------------------
|
||||
general:
|
||||
name: Format / etc
|
||||
@@ -83,6 +87,10 @@ jobs:
|
||||
- name: Rust benchmark smoke test
|
||||
run: just bench-smoke
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
cargo_shear:
|
||||
name: cargo shear
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -103,6 +111,10 @@ jobs:
|
||||
- name: cargo shear
|
||||
run: cargo shear --deny-warnings
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
argument_comment_lint_package:
|
||||
name: Argument comment lint package
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -154,6 +166,10 @@ jobs:
|
||||
env:
|
||||
RUST_MIN_STACK: "8388608" # 8 MiB
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
argument_comment_lint_prebuilt:
|
||||
name: Argument comment lint - ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.runs_on || matrix.runner }}
|
||||
@@ -205,6 +221,10 @@ jobs:
|
||||
target: ${{ runner.os }}
|
||||
buildbuddy-api-key: ${{ secrets.BUILDBUDDY_API_KEY }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled() && steps.argument_comment_lint_gate.outputs.run == 'true'
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
# --- Gatherer job that you mark as the ONLY required status -----------------
|
||||
results:
|
||||
name: CI results (required)
|
||||
|
||||
@@ -1,15 +1,56 @@
|
||||
name: rust-release-zsh
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
push:
|
||||
tags:
|
||||
- "codex-zsh-v*.*.*"
|
||||
|
||||
env:
|
||||
ZSH_COMMIT: 77045ef899e53b9598bebc5a41db93a548a40ca6
|
||||
ZSH_PATCH: codex-rs/shell-escalation/patches/zsh-exec-wrapper.patch
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}::${{ github.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
metadata:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_tag: ${{ steps.release_tag.outputs.release_tag }}
|
||||
|
||||
steps:
|
||||
- name: Validate release tag
|
||||
id: release_tag
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.ref_name }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! "${RELEASE_TAG}" =~ ^codex-zsh-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Tag ${RELEASE_TAG} does not match codex-zsh-vX.Y.Z." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "release_tag=${RELEASE_TAG}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Ensure release does not exist
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ steps.release_tag.outputs.release_tag }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if gh release view "${RELEASE_TAG}" --repo "${GITHUB_REPOSITORY}" > /dev/null 2>&1; then
|
||||
echo "Release ${RELEASE_TAG} already exists; publish changed artifacts under a new tag." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
linux:
|
||||
name: Build zsh (Linux) - ${{ matrix.variant }} - ${{ matrix.target }}
|
||||
needs: metadata
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 30
|
||||
container:
|
||||
@@ -62,6 +103,7 @@ jobs:
|
||||
|
||||
darwin:
|
||||
name: Build zsh (macOS) - ${{ matrix.variant }} - ${{ matrix.target }}
|
||||
needs: metadata
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 30
|
||||
|
||||
@@ -101,3 +143,40 @@ jobs:
|
||||
with:
|
||||
name: codex-zsh-${{ matrix.target }}
|
||||
path: dist/zsh/${{ matrix.target }}/*
|
||||
|
||||
publish-release:
|
||||
needs:
|
||||
- metadata
|
||||
- linux
|
||||
- darwin
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
path: dist
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
|
||||
with:
|
||||
tag_name: ${{ needs.metadata.outputs.release_tag }}
|
||||
name: ${{ needs.metadata.outputs.release_tag }}
|
||||
files: dist/**
|
||||
# Keep zsh artifact releases out of Codex's normal "latest release" channel.
|
||||
prerelease: true
|
||||
|
||||
- name: Publish DotSlash manifest
|
||||
uses: facebook/dotslash-publish-release@9c9ec027515c34db9282a09a25a9cab5880b2c52 # v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag: ${{ needs.metadata.outputs.release_tag }}
|
||||
config: .github/dotslash-zsh-config.json
|
||||
|
||||
@@ -14,6 +14,9 @@ on:
|
||||
tags:
|
||||
- "rust-v*.*.*"
|
||||
|
||||
env:
|
||||
CODEX_ZSH_RELEASE_TAG: codex-zsh-v0.1.0
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
@@ -354,6 +357,15 @@ jobs:
|
||||
cp target/${{ matrix.target }}/release/codex-${{ matrix.target }}.dmg "$dest/codex-${{ matrix.target }}.dmg"
|
||||
fi
|
||||
|
||||
- name: Download packaged zsh manifest
|
||||
if: ${{ runner.os != 'macOS' }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSL \
|
||||
"https://github.com/${GITHUB_REPOSITORY}/releases/download/${CODEX_ZSH_RELEASE_TAG}/codex-zsh" \
|
||||
-o "${RUNNER_TEMP}/codex-zsh"
|
||||
|
||||
- name: Build Codex package archive
|
||||
if: ${{ runner.os != 'macOS' }}
|
||||
shell: bash
|
||||
@@ -366,7 +378,8 @@ jobs:
|
||||
--target "$TARGET" \
|
||||
--bundle "$BUNDLE" \
|
||||
--entrypoint-dir "target/${TARGET}/release" \
|
||||
--archive-dir "dist/${TARGET}"
|
||||
--archive-dir "dist/${TARGET}" \
|
||||
--zsh-manifest "${RUNNER_TEMP}/codex-zsh"
|
||||
|
||||
- name: Build Python runtime wheel
|
||||
if: ${{ matrix.bundle == 'primary' && runner.os != 'macOS' }}
|
||||
@@ -697,6 +710,14 @@ jobs:
|
||||
cp "target/${{ matrix.target }}/release/${binary}" "$dest/${binary}-${{ matrix.target }}"
|
||||
done
|
||||
|
||||
- name: Download packaged zsh manifest
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSL \
|
||||
"https://github.com/${GITHUB_REPOSITORY}/releases/download/${CODEX_ZSH_RELEASE_TAG}/codex-zsh" \
|
||||
-o "${RUNNER_TEMP}/codex-zsh"
|
||||
|
||||
- name: Build Codex package archive
|
||||
shell: bash
|
||||
env:
|
||||
@@ -708,7 +729,8 @@ jobs:
|
||||
--target "$TARGET" \
|
||||
--bundle "$BUNDLE" \
|
||||
--entrypoint-dir "target/${TARGET}/release" \
|
||||
--archive-dir "dist/${TARGET}"
|
||||
--archive-dir "dist/${TARGET}" \
|
||||
--zsh-manifest "${RUNNER_TEMP}/codex-zsh"
|
||||
|
||||
- name: Build Python runtime wheel
|
||||
if: ${{ matrix.bundle == 'primary' }}
|
||||
@@ -1043,11 +1065,6 @@ jobs:
|
||||
with:
|
||||
publish: true
|
||||
|
||||
zsh-release-assets:
|
||||
name: zsh release assets
|
||||
needs: tag-check
|
||||
uses: ./.github/workflows/rust-release-zsh.yml
|
||||
|
||||
release:
|
||||
needs:
|
||||
- tag-check
|
||||
@@ -1055,7 +1072,6 @@ jobs:
|
||||
- finalize-macos
|
||||
- build-windows
|
||||
- argument-comment-lint-release-assets
|
||||
- zsh-release-assets
|
||||
if: >-
|
||||
${{
|
||||
always() &&
|
||||
@@ -1063,8 +1079,7 @@ jobs:
|
||||
needs.build.result == 'success' &&
|
||||
needs.finalize-macos.result == 'success' &&
|
||||
needs.build-windows.result == 'success' &&
|
||||
needs.argument-comment-lint-release-assets.result == 'success' &&
|
||||
needs.zsh-release-assets.result == 'success'
|
||||
needs.argument-comment-lint-release-assets.result == 'success'
|
||||
}}
|
||||
name: release
|
||||
runs-on: ubuntu-latest
|
||||
@@ -1113,7 +1128,7 @@ jobs:
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
path: dist
|
||||
pattern: "{*-symbols,argument-comment-lint-*,codex-zsh-*,python-runtime-wheel-*}"
|
||||
pattern: "{*-symbols,argument-comment-lint-*,python-runtime-wheel-*}"
|
||||
|
||||
- name: List
|
||||
run: ls -R dist/
|
||||
@@ -1236,13 +1251,6 @@ jobs:
|
||||
tag: ${{ github.ref_name }}
|
||||
config: .github/dotslash-config.json
|
||||
|
||||
- uses: facebook/dotslash-publish-release@9c9ec027515c34db9282a09a25a9cab5880b2c52 # v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag: ${{ github.ref_name }}
|
||||
config: .github/dotslash-zsh-config.json
|
||||
|
||||
- uses: facebook/dotslash-publish-release@9c9ec027515c34db9282a09a25a9cab5880b2c52 # v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -41,6 +41,10 @@ jobs:
|
||||
/tmp/uv/bin/uv run --frozen --no-sync pytest
|
||||
'
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
sdks:
|
||||
runs-on:
|
||||
group: ${{ github.event.repository.name }}-runners
|
||||
@@ -161,3 +165,7 @@ jobs:
|
||||
path: |
|
||||
~/.cache/bazel-repo-cache
|
||||
key: bazel-cache-x86_64-unknown-linux-gnu-${{ hashFiles('MODULE.bazel', 'codex-rs/Cargo.lock', 'codex-rs/Cargo.toml') }}
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -97,6 +97,10 @@ jobs:
|
||||
echo "${output}"
|
||||
echo "${output}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.variant }} ${{ matrix.target }}
|
||||
needs: metadata
|
||||
@@ -322,6 +326,10 @@ jobs:
|
||||
name: v8-canary-${{ needs.metadata.outputs.v8_version }}-${{ matrix.variant }}-${{ matrix.target }}
|
||||
path: dist/${{ matrix.target }}/*
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
build-windows-source:
|
||||
name: Build ptrcomp-sandbox ${{ matrix.target }} from source
|
||||
needs: metadata
|
||||
@@ -459,3 +467,7 @@ jobs:
|
||||
with:
|
||||
name: v8-canary-${{ needs.metadata.outputs.v8_version }}-ptrcomp-sandbox-${{ matrix.target }}
|
||||
path: dist/${{ matrix.target }}/*
|
||||
|
||||
- name: Check for a clean worktree
|
||||
if: always() && !cancelled()
|
||||
uses: ./.github/actions/check-clean-worktree
|
||||
|
||||
@@ -60,6 +60,8 @@ yarn-error.log*
|
||||
# ci
|
||||
.vercel/
|
||||
.netlify/
|
||||
/.tmp/sdk-ci/
|
||||
/upstream-rusty-v8/
|
||||
|
||||
# patches
|
||||
apply_patch/
|
||||
|
||||
@@ -35,9 +35,8 @@ In the codex-rs folder where the rust code lives:
|
||||
- When working with MCP tool calls, prefer using `codex-rs/codex-mcp/src/mcp_connection_manager.rs` to handle mutation of tools and tool calls. Aim to minimize the footprint of changes and leverage existing abstractions rather than plumbing code through multiple levels of function calls.
|
||||
- Do not call `reset_client_session` unnecessarily; let the incremental check logic decide whether to reuse the previous request.
|
||||
- If you change Rust dependencies (`Cargo.toml` or `Cargo.lock`), run `just bazel-lock-update` from the
|
||||
repo root to refresh `MODULE.bazel.lock`, and include that lockfile update in the same change.
|
||||
- After dependency changes, run `just bazel-lock-check` from the repo root so lockfile drift is caught
|
||||
locally before CI.
|
||||
repo root to refresh `MODULE.bazel.lock`, and include that lockfile update in the same change. CI
|
||||
verifies lockfile drift.
|
||||
- Bazel does not automatically make source-tree files available to compile-time Rust file access. If
|
||||
you add `include_str!`, `include_bytes!`, `sqlx::migrate!`, or similar build-time file or
|
||||
directory reads, update the crate's `BUILD.bazel` (`compile_data`, `build_script_data`, or test
|
||||
@@ -220,10 +219,13 @@ Use `just bench-smoke` to dry-run the benchmark for a single iteration to ensure
|
||||
- Under Bazel, binaries and resources may live under runfiles; use `codex_utils_cargo_bin::cargo_bin` to resolve absolute paths that remain stable after `chdir`.
|
||||
- When locating fixture files or test resources under Bazel, avoid `env!("CARGO_MANIFEST_DIR")`. Prefer `codex_utils_cargo_bin::find_resource!` so paths resolve correctly under both Cargo and Bazel runfiles.
|
||||
|
||||
### Integration tests (core)
|
||||
### Integration tests
|
||||
|
||||
#### codex_core integration testing
|
||||
|
||||
- Prefer the utilities in `core_test_support::responses` when writing end-to-end Codex tests.
|
||||
|
||||
- Use `TestCodexBuilder::build_with_auto_env()` by default to ensure that new tests work with
|
||||
foreign app/exec OSes. See $remote-tests for details.
|
||||
- All `mount_sse*` helpers return a `ResponseMock`; hold onto it so you can assert against outbound `/responses` POST bodies.
|
||||
- Use `ResponseMock::single_request()` when a test should only issue one POST, or `ResponseMock::requests()` to inspect every captured `ResponsesRequest`.
|
||||
- `ResponsesRequest` exposes helpers (`body_json`, `input`, `function_call_output`, `custom_tool_call_output`, `call_output`, `header`, `path`, `query_param`) so assertions can target structured payloads instead of manual JSON digging.
|
||||
@@ -247,6 +249,14 @@ Use `just bench-smoke` to dry-run the benchmark for a single iteration to ensure
|
||||
// assert using request.function_call_output(call_id) or request.json_body() or other helpers.
|
||||
```
|
||||
|
||||
#### app-server integration testing
|
||||
|
||||
- Tests should exercise app-server's public JSON-RPC API.
|
||||
- Use similar server mocking as for core integration tests.
|
||||
- Use `TestAppServer::new_with_auto_env()` and `TestAppServer::send_thread_start_request_with_auto_env()`
|
||||
by default to ensure that new tests work with foreign app/exec OSes. See `$remote-tests` for
|
||||
details.
|
||||
|
||||
## App-server API Development Best Practices
|
||||
|
||||
These guidelines apply to app-server protocol work in `codex-rs`, especially:
|
||||
@@ -307,3 +317,6 @@ closest `pyproject.toml`'s `requires-python` field to see what minimum runtime v
|
||||
## Platform Support
|
||||
|
||||
Tests and features must support Linux, macOS and Windows unless feature is explicitly OS-specific.
|
||||
|
||||
Codex supports running connected app-server and exec-server on different operating systems. See the
|
||||
`$remote-tests` skill for details about integration testing these configurations.
|
||||
|
||||
Generated
+61
-14
@@ -402,6 +402,7 @@ dependencies = [
|
||||
"codex-app-server-protocol",
|
||||
"codex-config",
|
||||
"codex-core",
|
||||
"codex-exec-server",
|
||||
"codex-features",
|
||||
"codex-login",
|
||||
"codex-models-manager",
|
||||
@@ -1975,6 +1976,7 @@ dependencies = [
|
||||
"codex-chatgpt",
|
||||
"codex-cloud-config",
|
||||
"codex-config",
|
||||
"codex-connectors",
|
||||
"codex-core",
|
||||
"codex-core-plugins",
|
||||
"codex-exec-server",
|
||||
@@ -2162,6 +2164,7 @@ dependencies = [
|
||||
"codex-core",
|
||||
"codex-login",
|
||||
"codex-model-provider",
|
||||
"codex-protocol",
|
||||
"codex-state",
|
||||
"codex-uds",
|
||||
"codex-utils-absolute-path",
|
||||
@@ -2291,7 +2294,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"codex-app-server-protocol",
|
||||
"codex-connectors",
|
||||
"codex-core",
|
||||
"codex-features",
|
||||
@@ -2503,6 +2505,7 @@ dependencies = [
|
||||
"codex-code-mode-protocol",
|
||||
"codex-protocol",
|
||||
"deno_core_icudata",
|
||||
"futures",
|
||||
"pretty_assertions",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
@@ -2514,6 +2517,14 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "codex-code-mode-host"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"codex-code-mode",
|
||||
"codex-code-mode-protocol",
|
||||
"pretty_assertions",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-code-mode-protocol"
|
||||
@@ -2537,7 +2548,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"codex-app-server-protocol",
|
||||
"codex-execpolicy",
|
||||
"codex-features",
|
||||
"codex-file-system",
|
||||
@@ -2558,6 +2568,7 @@ dependencies = [
|
||||
"multimap",
|
||||
"pretty_assertions",
|
||||
"prost 0.14.3",
|
||||
"regex-lite",
|
||||
"schemars 0.8.22",
|
||||
"serde",
|
||||
"serde_ignored",
|
||||
@@ -2584,8 +2595,9 @@ name = "codex-connectors"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"codex-app-server-protocol",
|
||||
"codex-config",
|
||||
"codex-plugin",
|
||||
"indexmap 2.14.0",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2596,6 +2608,18 @@ dependencies = [
|
||||
"urlencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-connectors-extension"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"codex-connectors",
|
||||
"codex-core-plugins",
|
||||
"codex-plugin",
|
||||
"codex-utils-path-uri",
|
||||
"serde_json",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-context-fragments"
|
||||
version = "0.0.0"
|
||||
@@ -2617,6 +2641,7 @@ dependencies = [
|
||||
"bm25",
|
||||
"chrono",
|
||||
"clap",
|
||||
"codex-agent-graph-store",
|
||||
"codex-analytics",
|
||||
"codex-api",
|
||||
"codex-app-server-protocol",
|
||||
@@ -2757,6 +2782,7 @@ dependencies = [
|
||||
"codex-analytics",
|
||||
"codex-app-server-protocol",
|
||||
"codex-config",
|
||||
"codex-connectors",
|
||||
"codex-core-skills",
|
||||
"codex-exec-server",
|
||||
"codex-git-utils",
|
||||
@@ -2769,13 +2795,14 @@ dependencies = [
|
||||
"codex-protocol",
|
||||
"codex-tools",
|
||||
"codex-utils-absolute-path",
|
||||
"codex-utils-path",
|
||||
"codex-utils-path-uri",
|
||||
"codex-utils-plugins",
|
||||
"dirs",
|
||||
"flate2",
|
||||
"indexmap 2.14.0",
|
||||
"libc",
|
||||
"pretty_assertions",
|
||||
"regex",
|
||||
"reqwest 0.12.28",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -2799,7 +2826,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"codex-analytics",
|
||||
"codex-app-server-protocol",
|
||||
"codex-config",
|
||||
"codex-context-fragments",
|
||||
"codex-exec-server",
|
||||
@@ -2885,13 +2911,13 @@ dependencies = [
|
||||
"bytes",
|
||||
"clatter",
|
||||
"codex-api",
|
||||
"codex-app-server-protocol",
|
||||
"codex-client",
|
||||
"codex-exec-server-protocol",
|
||||
"codex-file-system",
|
||||
"codex-network-proxy",
|
||||
"codex-otel",
|
||||
"codex-protocol",
|
||||
"codex-sandboxing",
|
||||
"codex-shell-command",
|
||||
"codex-test-binary-support",
|
||||
"codex-utils-absolute-path",
|
||||
"codex-utils-path-uri",
|
||||
@@ -2901,6 +2927,8 @@ dependencies = [
|
||||
"futures",
|
||||
"http 1.4.0",
|
||||
"libc",
|
||||
"opentelemetry",
|
||||
"opentelemetry_sdk",
|
||||
"pretty_assertions",
|
||||
"prost 0.14.3",
|
||||
"reqwest 0.12.28",
|
||||
@@ -2915,11 +2943,28 @@ dependencies = [
|
||||
"tokio-util",
|
||||
"toml 0.9.11+spec-1.1.0",
|
||||
"tracing",
|
||||
"tracing-opentelemetry",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
"windows-sys 0.52.0",
|
||||
"wiremock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-exec-server-protocol"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"codex-file-system",
|
||||
"codex-network-proxy",
|
||||
"codex-protocol",
|
||||
"codex-shell-command",
|
||||
"codex-utils-path-uri",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-execpolicy"
|
||||
version = "0.0.0"
|
||||
@@ -2976,6 +3021,7 @@ dependencies = [
|
||||
"codex-tools",
|
||||
"codex-utils-absolute-path",
|
||||
"pretty_assertions",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
@@ -3164,8 +3210,10 @@ dependencies = [
|
||||
name = "codex-image-generation-extension"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"codex-api",
|
||||
"codex-core",
|
||||
"codex-exec-server",
|
||||
"codex-extension-api",
|
||||
"codex-login",
|
||||
"codex-model-provider",
|
||||
@@ -3181,6 +3229,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3247,7 +3296,6 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"codex-agent-identity",
|
||||
"codex-app-server-protocol",
|
||||
"codex-client",
|
||||
"codex-config",
|
||||
"codex-keyring-store",
|
||||
@@ -3291,6 +3339,7 @@ dependencies = [
|
||||
"codex-api",
|
||||
"codex-async-utils",
|
||||
"codex-config",
|
||||
"codex-connectors",
|
||||
"codex-exec-server",
|
||||
"codex-login",
|
||||
"codex-model-provider",
|
||||
@@ -3320,6 +3369,7 @@ name = "codex-mcp-extension"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"codex-config",
|
||||
"codex-connectors-extension",
|
||||
"codex-core",
|
||||
"codex-core-plugins",
|
||||
"codex-exec-server",
|
||||
@@ -3482,7 +3532,6 @@ name = "codex-model-provider-info"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"codex-api",
|
||||
"codex-app-server-protocol",
|
||||
"codex-protocol",
|
||||
"codex-utils-absolute-path",
|
||||
"http 1.4.0",
|
||||
@@ -3499,7 +3548,6 @@ name = "codex-models-manager"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"codex-app-server-protocol",
|
||||
"codex-collaboration-mode-templates",
|
||||
"codex-login",
|
||||
"codex-otel",
|
||||
@@ -3535,6 +3583,7 @@ dependencies = [
|
||||
"rama-tcp",
|
||||
"rama-tls-rustls",
|
||||
"rama-unix",
|
||||
"rand 0.9.3",
|
||||
"rustls-native-certs",
|
||||
"schannel",
|
||||
"security-framework 3.5.1",
|
||||
@@ -3575,7 +3624,6 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"codex-api",
|
||||
"codex-app-server-protocol",
|
||||
"codex-protocol",
|
||||
"codex-utils-absolute-path",
|
||||
"codex-utils-string",
|
||||
@@ -3608,6 +3656,7 @@ dependencies = [
|
||||
"codex-config",
|
||||
"codex-protocol",
|
||||
"codex-utils-absolute-path",
|
||||
"codex-utils-path-uri",
|
||||
"codex-utils-plugins",
|
||||
"pretty_assertions",
|
||||
"thiserror 2.0.18",
|
||||
@@ -3722,7 +3771,6 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"codex-api",
|
||||
"codex-client",
|
||||
"codex-config",
|
||||
"codex-exec-server",
|
||||
"codex-keyring-store",
|
||||
@@ -3763,7 +3811,6 @@ dependencies = [
|
||||
"chrono",
|
||||
"codex-file-search",
|
||||
"codex-git-utils",
|
||||
"codex-login",
|
||||
"codex-otel",
|
||||
"codex-protocol",
|
||||
"codex-state",
|
||||
@@ -4001,8 +4048,8 @@ dependencies = [
|
||||
name = "codex-tools"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"codex-app-server-protocol",
|
||||
"codex-code-mode",
|
||||
"codex-connectors",
|
||||
"codex-features",
|
||||
"codex-file-system",
|
||||
"codex-protocol",
|
||||
|
||||
+4
-1
@@ -44,9 +44,11 @@ members = [
|
||||
"secrets",
|
||||
"exec",
|
||||
"file-system",
|
||||
"exec-server-protocol",
|
||||
"exec-server",
|
||||
"execpolicy",
|
||||
"execpolicy-legacy",
|
||||
"ext/connectors",
|
||||
"ext/extension-api",
|
||||
"ext/goal",
|
||||
"ext/guardian",
|
||||
@@ -164,6 +166,7 @@ codex-code-mode-protocol = { path = "code-mode-protocol" }
|
||||
codex-home = { path = "codex-home" }
|
||||
codex-config = { path = "config" }
|
||||
codex-connectors = { path = "connectors" }
|
||||
codex-connectors-extension = { path = "ext/connectors" }
|
||||
codex-context-fragments = { path = "context-fragments" }
|
||||
codex-core = { path = "core" }
|
||||
codex-core-api = { path = "core-api" }
|
||||
@@ -171,6 +174,7 @@ codex-core-plugins = { path = "core-plugins" }
|
||||
codex-core-skills = { path = "core-skills" }
|
||||
codex-exec = { path = "exec" }
|
||||
codex-file-system = { path = "file-system" }
|
||||
codex-exec-server-protocol = { path = "exec-server-protocol" }
|
||||
codex-exec-server = { path = "exec-server" }
|
||||
codex-execpolicy = { path = "execpolicy" }
|
||||
codex-extension-api = { path = "ext/extension-api" }
|
||||
@@ -502,7 +506,6 @@ unwrap_used = "deny"
|
||||
# silence the false positive here instead of deleting a real dependency.
|
||||
[workspace.metadata.cargo-shear]
|
||||
ignored = [
|
||||
"codex-agent-graph-store",
|
||||
"icu_provider",
|
||||
"openssl-sys",
|
||||
"codex-v8-poc",
|
||||
|
||||
@@ -22,4 +22,4 @@ thiserror = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync"] }
|
||||
|
||||
@@ -9,4 +9,5 @@ pub use error::AgentGraphStoreError;
|
||||
pub use error::AgentGraphStoreResult;
|
||||
pub use local::LocalAgentGraphStore;
|
||||
pub use store::AgentGraphStore;
|
||||
pub use store::AgentGraphStoreFuture;
|
||||
pub use types::ThreadSpawnEdgeStatus;
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use crate::AgentGraphStore;
|
||||
use crate::AgentGraphStoreError;
|
||||
use crate::AgentGraphStoreResult;
|
||||
use crate::AgentGraphStoreFuture;
|
||||
use crate::ThreadSpawnEdgeStatus;
|
||||
|
||||
/// SQLite-backed implementation of [`AgentGraphStore`] using an existing state runtime.
|
||||
@@ -29,65 +29,83 @@ impl LocalAgentGraphStore {
|
||||
}
|
||||
|
||||
impl AgentGraphStore for LocalAgentGraphStore {
|
||||
async fn upsert_thread_spawn_edge(
|
||||
fn upsert_thread_spawn_edge(
|
||||
&self,
|
||||
parent_thread_id: ThreadId,
|
||||
child_thread_id: ThreadId,
|
||||
status: ThreadSpawnEdgeStatus,
|
||||
) -> AgentGraphStoreResult<()> {
|
||||
self.state_db
|
||||
.upsert_thread_spawn_edge(parent_thread_id, child_thread_id, to_state_status(status))
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
) -> AgentGraphStoreFuture<'_, ()> {
|
||||
Box::pin(async move {
|
||||
self.state_db
|
||||
.upsert_thread_spawn_edge(
|
||||
parent_thread_id,
|
||||
child_thread_id,
|
||||
to_state_status(status),
|
||||
)
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
})
|
||||
}
|
||||
|
||||
async fn set_thread_spawn_edge_status(
|
||||
fn set_thread_spawn_edge_status(
|
||||
&self,
|
||||
child_thread_id: ThreadId,
|
||||
status: ThreadSpawnEdgeStatus,
|
||||
) -> AgentGraphStoreResult<()> {
|
||||
self.state_db
|
||||
.set_thread_spawn_edge_status(child_thread_id, to_state_status(status))
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
) -> AgentGraphStoreFuture<'_, ()> {
|
||||
Box::pin(async move {
|
||||
self.state_db
|
||||
.set_thread_spawn_edge_status(child_thread_id, to_state_status(status))
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
})
|
||||
}
|
||||
|
||||
async fn list_thread_spawn_children(
|
||||
fn list_thread_spawn_children(
|
||||
&self,
|
||||
parent_thread_id: ThreadId,
|
||||
status_filter: Option<ThreadSpawnEdgeStatus>,
|
||||
) -> AgentGraphStoreResult<Vec<ThreadId>> {
|
||||
if let Some(status) = status_filter {
|
||||
return self
|
||||
.state_db
|
||||
.list_thread_spawn_children_with_status(parent_thread_id, to_state_status(status))
|
||||
.await
|
||||
.map_err(internal_error);
|
||||
}
|
||||
) -> AgentGraphStoreFuture<'_, Vec<ThreadId>> {
|
||||
Box::pin(async move {
|
||||
if let Some(status) = status_filter {
|
||||
return self
|
||||
.state_db
|
||||
.list_thread_spawn_children_with_status(
|
||||
parent_thread_id,
|
||||
to_state_status(status),
|
||||
)
|
||||
.await
|
||||
.map_err(internal_error);
|
||||
}
|
||||
|
||||
self.state_db
|
||||
.list_thread_spawn_children(parent_thread_id)
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
self.state_db
|
||||
.list_thread_spawn_children(parent_thread_id)
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
})
|
||||
}
|
||||
|
||||
async fn list_thread_spawn_descendants(
|
||||
fn list_thread_spawn_descendants(
|
||||
&self,
|
||||
root_thread_id: ThreadId,
|
||||
status_filter: Option<ThreadSpawnEdgeStatus>,
|
||||
) -> AgentGraphStoreResult<Vec<ThreadId>> {
|
||||
match status_filter {
|
||||
Some(status) => self
|
||||
.state_db
|
||||
.list_thread_spawn_descendants_with_status(root_thread_id, to_state_status(status))
|
||||
.await
|
||||
.map_err(internal_error),
|
||||
None => self
|
||||
.state_db
|
||||
.list_thread_spawn_descendants(root_thread_id)
|
||||
.await
|
||||
.map_err(internal_error),
|
||||
}
|
||||
) -> AgentGraphStoreFuture<'_, Vec<ThreadId>> {
|
||||
Box::pin(async move {
|
||||
match status_filter {
|
||||
Some(status) => self
|
||||
.state_db
|
||||
.list_thread_spawn_descendants_with_status(
|
||||
root_thread_id,
|
||||
to_state_status(status),
|
||||
)
|
||||
.await
|
||||
.map_err(internal_error),
|
||||
None => self
|
||||
.state_db
|
||||
.list_thread_spawn_descendants(root_thread_id)
|
||||
.await
|
||||
.map_err(internal_error),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
use codex_protocol::ThreadId;
|
||||
|
||||
use crate::AgentGraphStoreResult;
|
||||
use crate::ThreadSpawnEdgeStatus;
|
||||
|
||||
/// Future returned by [`AgentGraphStore`] operations.
|
||||
pub type AgentGraphStoreFuture<'a, T> =
|
||||
Pin<Box<dyn Future<Output = AgentGraphStoreResult<T>> + Send + 'a>>;
|
||||
|
||||
/// Storage-neutral boundary for persisted thread-spawn parent/child topology.
|
||||
///
|
||||
/// Implementations are expected to return stable ordering for list methods so callers can merge
|
||||
@@ -17,7 +24,7 @@ pub trait AgentGraphStore: Send + Sync {
|
||||
parent_thread_id: ThreadId,
|
||||
child_thread_id: ThreadId,
|
||||
status: ThreadSpawnEdgeStatus,
|
||||
) -> impl std::future::Future<Output = AgentGraphStoreResult<()>> + Send;
|
||||
) -> AgentGraphStoreFuture<'_, ()>;
|
||||
|
||||
/// Update the persisted lifecycle status of a spawned thread's incoming edge.
|
||||
///
|
||||
@@ -26,7 +33,7 @@ pub trait AgentGraphStore: Send + Sync {
|
||||
&self,
|
||||
child_thread_id: ThreadId,
|
||||
status: ThreadSpawnEdgeStatus,
|
||||
) -> impl std::future::Future<Output = AgentGraphStoreResult<()>> + Send;
|
||||
) -> AgentGraphStoreFuture<'_, ()>;
|
||||
|
||||
/// List direct spawned children of a parent thread.
|
||||
///
|
||||
@@ -37,7 +44,7 @@ pub trait AgentGraphStore: Send + Sync {
|
||||
&self,
|
||||
parent_thread_id: ThreadId,
|
||||
status_filter: Option<ThreadSpawnEdgeStatus>,
|
||||
) -> impl std::future::Future<Output = AgentGraphStoreResult<Vec<ThreadId>>> + Send;
|
||||
) -> AgentGraphStoreFuture<'_, Vec<ThreadId>>;
|
||||
|
||||
/// List spawned descendants breadth-first by depth, then by thread id.
|
||||
///
|
||||
@@ -49,5 +56,5 @@ pub trait AgentGraphStore: Send + Sync {
|
||||
&self,
|
||||
root_thread_id: ThreadId,
|
||||
status_filter: Option<ThreadSpawnEdgeStatus>,
|
||||
) -> impl std::future::Future<Output = AgentGraphStoreResult<Vec<ThreadId>>> + Send;
|
||||
) -> AgentGraphStoreFuture<'_, Vec<ThreadId>>;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ use crate::facts::HookRunInput;
|
||||
use crate::facts::InputError;
|
||||
use crate::facts::InvocationType;
|
||||
use crate::facts::PluginInstallFailedInput;
|
||||
use crate::facts::PluginInstallRequestSource;
|
||||
use crate::facts::PluginInstallRequested;
|
||||
use crate::facts::PluginInstallRequestedInput;
|
||||
use crate::facts::PluginInstallRequestedPlugin;
|
||||
use crate::facts::PluginState;
|
||||
use crate::facts::PluginStateChangedInput;
|
||||
use crate::facts::PluginUsedInput;
|
||||
@@ -168,6 +172,17 @@ use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
const TEST_PRODUCT_CLIENT_ID: &str = "codex_work_desktop";
|
||||
|
||||
fn test_tracking_context(thread_id: &str, turn_id: &str) -> TrackEventsContext {
|
||||
TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: thread_id.to_string(),
|
||||
turn_id: turn_id.to_string(),
|
||||
product_client_id: TEST_PRODUCT_CLIENT_ID.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn sample_thread_with_metadata(
|
||||
thread_id: &str,
|
||||
ephemeral: bool,
|
||||
@@ -1024,11 +1039,7 @@ fn normalize_path_for_skill_id_repo_root_not_in_skill_path_uses_absolute_path()
|
||||
|
||||
#[test]
|
||||
fn app_mentioned_event_serializes_expected_shape() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
let event = TrackEventRequest::AppMentioned(CodexAppMentionedEventRequest {
|
||||
event_type: "codex_app_mentioned",
|
||||
event_params: codex_app_metadata(
|
||||
@@ -1052,7 +1063,7 @@ fn app_mentioned_event_serializes_expected_shape() {
|
||||
"thread_id": "thread-1",
|
||||
"turn_id": "turn-1",
|
||||
"app_name": "Calendar",
|
||||
"product_client_id": originator().value,
|
||||
"product_client_id": TEST_PRODUCT_CLIENT_ID,
|
||||
"invoke_type": "explicit",
|
||||
"model_slug": "gpt-5"
|
||||
}
|
||||
@@ -1062,11 +1073,7 @@ fn app_mentioned_event_serializes_expected_shape() {
|
||||
|
||||
#[test]
|
||||
fn app_used_event_serializes_expected_shape() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-2".to_string(),
|
||||
turn_id: "turn-2".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-2", "turn-2");
|
||||
let event = TrackEventRequest::AppUsed(CodexAppUsedEventRequest {
|
||||
event_type: "codex_app_used",
|
||||
event_params: codex_app_metadata(
|
||||
@@ -1090,7 +1097,7 @@ fn app_used_event_serializes_expected_shape() {
|
||||
"thread_id": "thread-2",
|
||||
"turn_id": "turn-2",
|
||||
"app_name": "Google Drive",
|
||||
"product_client_id": originator().value,
|
||||
"product_client_id": TEST_PRODUCT_CLIENT_ID,
|
||||
"invoke_type": "implicit",
|
||||
"model_slug": "gpt-5"
|
||||
}
|
||||
@@ -1381,16 +1388,8 @@ fn app_used_dedupe_is_keyed_by_turn_and_connector() {
|
||||
invocation_type: Some(InvocationType::Implicit),
|
||||
};
|
||||
|
||||
let turn_1 = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let turn_2 = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-2".to_string(),
|
||||
};
|
||||
let turn_1 = test_tracking_context("thread-1", "turn-1");
|
||||
let turn_2 = test_tracking_context("thread-1", "turn-2");
|
||||
|
||||
assert_eq!(queue.should_enqueue_app_used(&turn_1, &app), true);
|
||||
assert_eq!(queue.should_enqueue_app_used(&turn_1, &app), false);
|
||||
@@ -3009,11 +3008,7 @@ async fn subagent_tool_items_inherit_parent_connection_metadata() {
|
||||
|
||||
#[test]
|
||||
fn plugin_used_event_serializes_expected_shape() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-3".to_string(),
|
||||
turn_id: "turn-3".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-3", "turn-3");
|
||||
let event = TrackEventRequest::PluginUsed(CodexPluginUsedEventRequest {
|
||||
event_type: "codex_plugin_used",
|
||||
event_params: codex_plugin_used_metadata(&tracking, sample_plugin_metadata()),
|
||||
@@ -3033,7 +3028,7 @@ fn plugin_used_event_serializes_expected_shape() {
|
||||
"has_skills": true,
|
||||
"mcp_server_count": 2,
|
||||
"connector_ids": ["calendar", "drive"],
|
||||
"product_client_id": originator().value,
|
||||
"product_client_id": TEST_PRODUCT_CLIENT_ID,
|
||||
"mcp_server_names": ["mcp-1", "mcp-2"],
|
||||
"thread_id": "thread-3",
|
||||
"turn_id": "turn-3",
|
||||
@@ -3132,11 +3127,7 @@ fn plugin_management_event_keeps_plugin_id_local_when_remote_id_exists() {
|
||||
|
||||
#[test]
|
||||
fn hook_run_event_serializes_expected_shape() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-3".to_string(),
|
||||
turn_id: "turn-3".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-3", "turn-3");
|
||||
let event = TrackEventRequest::HookRun(CodexHookRunEventRequest {
|
||||
event_type: "codex_hook_run",
|
||||
event_params: codex_hook_run_metadata(
|
||||
@@ -3158,6 +3149,7 @@ fn hook_run_event_serializes_expected_shape() {
|
||||
"event_params": {
|
||||
"thread_id": "thread-3",
|
||||
"turn_id": "turn-3",
|
||||
"product_client_id": TEST_PRODUCT_CLIENT_ID,
|
||||
"model_slug": "gpt-5",
|
||||
"hook_name": "PreToolUse",
|
||||
"hook_source": "user",
|
||||
@@ -3169,11 +3161,7 @@ fn hook_run_event_serializes_expected_shape() {
|
||||
|
||||
#[test]
|
||||
fn hook_run_metadata_maps_sources_and_statuses() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
|
||||
let system = serde_json::to_value(codex_hook_run_metadata(
|
||||
&tracking,
|
||||
@@ -3224,11 +3212,7 @@ fn hook_run_metadata_maps_sources_and_statuses() {
|
||||
|
||||
#[test]
|
||||
fn hook_run_metadata_maps_stopped_status() {
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
|
||||
let stopped = serde_json::to_value(codex_hook_run_metadata(
|
||||
&tracking,
|
||||
@@ -3254,16 +3238,8 @@ fn plugin_used_dedupe_is_keyed_by_turn_and_plugin() {
|
||||
};
|
||||
let plugin = sample_plugin_metadata();
|
||||
|
||||
let turn_1 = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let turn_2 = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-2".to_string(),
|
||||
};
|
||||
let turn_1 = test_tracking_context("thread-1", "turn-1");
|
||||
let turn_2 = test_tracking_context("thread-1", "turn-2");
|
||||
|
||||
assert_eq!(queue.should_enqueue_plugin_used(&turn_1, &plugin), true);
|
||||
assert_eq!(queue.should_enqueue_plugin_used(&turn_1, &plugin), false);
|
||||
@@ -3274,11 +3250,7 @@ fn plugin_used_dedupe_is_keyed_by_turn_and_plugin() {
|
||||
async fn reducer_ingests_skill_invoked_fact() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut events = Vec::new();
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
let skill_path = PathBuf::from("/Users/abc/.codex/skills/doc/SKILL.md");
|
||||
let expected_skill_id = skill_id_for_local_skill(
|
||||
/*repo_url*/ None,
|
||||
@@ -3311,7 +3283,7 @@ async fn reducer_ingests_skill_invoked_fact() {
|
||||
"skill_id": expected_skill_id,
|
||||
"skill_name": "doc",
|
||||
"event_params": {
|
||||
"product_client_id": originator().value,
|
||||
"product_client_id": TEST_PRODUCT_CLIENT_ID,
|
||||
"skill_scope": "user",
|
||||
"plugin_id": null,
|
||||
"repo_url": null,
|
||||
@@ -3328,11 +3300,7 @@ async fn reducer_ingests_skill_invoked_fact() {
|
||||
async fn reducer_includes_plugin_id_for_plugin_skill_invocations() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut events = Vec::new();
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
let skill_path =
|
||||
PathBuf::from("/Users/abc/.codex/plugins/cache/test/sample/skills/doc/SKILL.md");
|
||||
|
||||
@@ -3367,11 +3335,7 @@ async fn reducer_ingests_hook_run_fact() {
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::HookRun(HookRunInput {
|
||||
tracking: TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
},
|
||||
tracking: test_tracking_context("thread-1", "turn-1"),
|
||||
hook: HookRunFact {
|
||||
event_name: HookEventName::PostToolUse,
|
||||
hook_source: HookSource::Unknown,
|
||||
@@ -3394,11 +3358,7 @@ async fn reducer_ingests_hook_run_fact() {
|
||||
async fn reducer_ingests_app_and_plugin_facts() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut events = Vec::new();
|
||||
let tracking = TrackEventsContext {
|
||||
model_slug: "gpt-5".to_string(),
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
};
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
|
||||
reducer
|
||||
.ingest(
|
||||
@@ -3441,6 +3401,18 @@ async fn reducer_ingests_app_and_plugin_facts() {
|
||||
assert_eq!(payload[0]["event_type"], "codex_app_mentioned");
|
||||
assert_eq!(payload[1]["event_type"], "codex_app_used");
|
||||
assert_eq!(payload[2]["event_type"], "codex_plugin_used");
|
||||
assert_eq!(
|
||||
payload[0]["event_params"]["product_client_id"],
|
||||
TEST_PRODUCT_CLIENT_ID
|
||||
);
|
||||
assert_eq!(
|
||||
payload[1]["event_params"]["product_client_id"],
|
||||
TEST_PRODUCT_CLIENT_ID
|
||||
);
|
||||
assert_eq!(
|
||||
payload[2]["event_params"]["product_client_id"],
|
||||
TEST_PRODUCT_CLIENT_ID
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -3479,6 +3451,66 @@ async fn reducer_ingests_plugin_state_changed_fact() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reducer_ingests_plugin_install_requested_fact() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut events = Vec::new();
|
||||
let tracking = test_tracking_context("thread-1", "turn-1");
|
||||
let request = PluginInstallRequested {
|
||||
suggestion_id: "request_plugin_install_call-1".to_string(),
|
||||
plugins: vec![
|
||||
PluginInstallRequestedPlugin {
|
||||
plugin_id: "calendar@openai-curated-remote".to_string(),
|
||||
remote_plugin_id: Some("plugin_calendar".to_string()),
|
||||
plugin_name: "Calendar".to_string(),
|
||||
connector_ids: vec!["connector_calendar".to_string()],
|
||||
},
|
||||
PluginInstallRequestedPlugin {
|
||||
plugin_id: "github@openai-curated-remote".to_string(),
|
||||
remote_plugin_id: None,
|
||||
plugin_name: "GitHub".to_string(),
|
||||
connector_ids: vec!["connector_github".to_string()],
|
||||
},
|
||||
],
|
||||
source: PluginInstallRequestSource::EndpointRecommendation,
|
||||
};
|
||||
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::PluginInstallRequested(
|
||||
PluginInstallRequestedInput { tracking, request },
|
||||
)),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(&events).expect("serialize events"),
|
||||
json!([{
|
||||
"event_type": "codex_plugin_install_requested",
|
||||
"event_params": {
|
||||
"suggestion_id": "request_plugin_install_call-1",
|
||||
"plugins": [{
|
||||
"plugin_id": "calendar@openai-curated-remote",
|
||||
"remote_plugin_id": "plugin_calendar",
|
||||
"plugin_name": "Calendar",
|
||||
"connector_ids": ["connector_calendar"],
|
||||
}, {
|
||||
"plugin_id": "github@openai-curated-remote",
|
||||
"remote_plugin_id": null,
|
||||
"plugin_name": "GitHub",
|
||||
"connector_ids": ["connector_github"],
|
||||
}],
|
||||
"source": "endpoint_recommendation",
|
||||
"thread_id": "thread-1",
|
||||
"turn_id": "turn-1",
|
||||
"model_slug": "gpt-5",
|
||||
"product_client_id": originator().value,
|
||||
}
|
||||
}])
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reducer_ingests_plugin_install_failed_fact() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
|
||||
@@ -16,6 +16,8 @@ use crate::facts::ExternalAgentConfigImportFailureInput;
|
||||
use crate::facts::HookRunFact;
|
||||
use crate::facts::HookRunInput;
|
||||
use crate::facts::PluginInstallFailedInput;
|
||||
use crate::facts::PluginInstallRequested;
|
||||
use crate::facts::PluginInstallRequestedInput;
|
||||
use crate::facts::PluginState;
|
||||
use crate::facts::PluginStateChangedInput;
|
||||
use crate::facts::SkillInvocation;
|
||||
@@ -310,6 +312,19 @@ impl AnalyticsEventsClient {
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn track_plugin_install_requested(
|
||||
&self,
|
||||
tracking: TrackEventsContext,
|
||||
request: PluginInstallRequested,
|
||||
) {
|
||||
self.record_fact(AnalyticsFact::Custom(
|
||||
CustomAnalyticsFact::PluginInstallRequested(PluginInstallRequestedInput {
|
||||
tracking,
|
||||
request,
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
pub fn track_compaction(&self, event: crate::facts::CodexCompactionEvent) {
|
||||
self.record_fact(AnalyticsFact::Custom(CustomAnalyticsFact::Compaction(
|
||||
Box::new(event),
|
||||
|
||||
@@ -14,6 +14,7 @@ use crate::facts::CompactionTrigger;
|
||||
use crate::facts::GoalEventKind;
|
||||
use crate::facts::HookRunFact;
|
||||
use crate::facts::InvocationType;
|
||||
use crate::facts::PluginInstallRequested;
|
||||
use crate::facts::PluginState;
|
||||
use crate::facts::SubAgentThreadStartedInput;
|
||||
use crate::facts::ThreadInitializationMode;
|
||||
@@ -80,6 +81,7 @@ pub(crate) enum TrackEventRequest {
|
||||
#[allow(dead_code)]
|
||||
ReviewEvent(CodexReviewEventRequest),
|
||||
PluginUsed(CodexPluginUsedEventRequest),
|
||||
PluginInstallRequested(CodexPluginInstallRequestedEventRequest),
|
||||
PluginInstalled(CodexPluginEventRequest),
|
||||
PluginUninstalled(CodexPluginEventRequest),
|
||||
PluginEnabled(CodexPluginEventRequest),
|
||||
@@ -773,6 +775,7 @@ pub(crate) struct CodexAppUsedEventRequest {
|
||||
pub(crate) struct CodexHookRunMetadata {
|
||||
pub(crate) thread_id: Option<String>,
|
||||
pub(crate) turn_id: Option<String>,
|
||||
pub(crate) product_client_id: Option<String>,
|
||||
pub(crate) model_slug: Option<String>,
|
||||
pub(crate) hook_name: Option<String>,
|
||||
pub(crate) hook_source: Option<&'static str>,
|
||||
@@ -953,6 +956,31 @@ pub(crate) struct CodexPluginUsedMetadata {
|
||||
pub(crate) model_slug: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct CodexPluginInstallRequestedPluginMetadata {
|
||||
pub(crate) plugin_id: String,
|
||||
pub(crate) remote_plugin_id: Option<String>,
|
||||
pub(crate) plugin_name: String,
|
||||
pub(crate) connector_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct CodexPluginInstallRequestedMetadata {
|
||||
pub(crate) suggestion_id: String,
|
||||
pub(crate) plugins: Vec<CodexPluginInstallRequestedPluginMetadata>,
|
||||
pub(crate) source: crate::facts::PluginInstallRequestSource,
|
||||
pub(crate) thread_id: String,
|
||||
pub(crate) turn_id: String,
|
||||
pub(crate) model_slug: String,
|
||||
pub(crate) product_client_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct CodexPluginInstallRequestedEventRequest {
|
||||
pub(crate) event_type: &'static str,
|
||||
pub(crate) event_params: CodexPluginInstallRequestedMetadata,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct CodexPluginEventRequest {
|
||||
pub(crate) event_type: &'static str,
|
||||
@@ -1030,13 +1058,20 @@ pub(crate) fn codex_app_metadata(
|
||||
thread_id: Some(tracking.thread_id.clone()),
|
||||
turn_id: Some(tracking.turn_id.clone()),
|
||||
app_name: app.app_name,
|
||||
product_client_id: Some(originator().value),
|
||||
product_client_id: Some(tracking.product_client_id.clone()),
|
||||
invoke_type: app.invocation_type,
|
||||
model_slug: Some(tracking.model_slug.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn codex_plugin_metadata(plugin: PluginTelemetryMetadata) -> CodexPluginMetadata {
|
||||
codex_plugin_metadata_with_product_client_id(plugin, originator().value)
|
||||
}
|
||||
|
||||
fn codex_plugin_metadata_with_product_client_id(
|
||||
plugin: PluginTelemetryMetadata,
|
||||
product_client_id: String,
|
||||
) -> CodexPluginMetadata {
|
||||
let PluginTelemetryMetadata {
|
||||
plugin_id,
|
||||
remote_plugin_id,
|
||||
@@ -1062,6 +1097,30 @@ pub(crate) fn codex_plugin_metadata(plugin: PluginTelemetryMetadata) -> CodexPlu
|
||||
.map(|connector_id| connector_id.0)
|
||||
.collect()
|
||||
}),
|
||||
product_client_id: Some(product_client_id),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn codex_plugin_install_requested_metadata(
|
||||
tracking: &TrackEventsContext,
|
||||
request: PluginInstallRequested,
|
||||
) -> CodexPluginInstallRequestedMetadata {
|
||||
CodexPluginInstallRequestedMetadata {
|
||||
suggestion_id: request.suggestion_id,
|
||||
plugins: request
|
||||
.plugins
|
||||
.into_iter()
|
||||
.map(|plugin| CodexPluginInstallRequestedPluginMetadata {
|
||||
plugin_id: plugin.plugin_id,
|
||||
remote_plugin_id: plugin.remote_plugin_id,
|
||||
plugin_name: plugin.plugin_name,
|
||||
connector_ids: plugin.connector_ids,
|
||||
})
|
||||
.collect(),
|
||||
source: request.source,
|
||||
thread_id: tracking.thread_id.clone(),
|
||||
turn_id: tracking.turn_id.clone(),
|
||||
model_slug: tracking.model_slug.clone(),
|
||||
product_client_id: Some(originator().value),
|
||||
}
|
||||
}
|
||||
@@ -1139,7 +1198,10 @@ pub(crate) fn codex_plugin_used_metadata(
|
||||
.as_ref()
|
||||
.map(|summary| summary.mcp_server_names.clone());
|
||||
CodexPluginUsedMetadata {
|
||||
plugin: codex_plugin_metadata(plugin),
|
||||
plugin: codex_plugin_metadata_with_product_client_id(
|
||||
plugin,
|
||||
tracking.product_client_id.clone(),
|
||||
),
|
||||
mcp_server_names,
|
||||
thread_id: Some(tracking.thread_id.clone()),
|
||||
turn_id: Some(tracking.turn_id.clone()),
|
||||
@@ -1154,6 +1216,7 @@ pub(crate) fn codex_hook_run_metadata(
|
||||
CodexHookRunMetadata {
|
||||
thread_id: Some(tracking.thread_id.clone()),
|
||||
turn_id: Some(tracking.turn_id.clone()),
|
||||
product_client_id: Some(tracking.product_client_id.clone()),
|
||||
model_slug: Some(tracking.model_slug.clone()),
|
||||
hook_name: Some(analytics_hook_event_name(hook.event_name).to_owned()),
|
||||
hook_source: Some(analytics_hook_source(hook.hook_source)),
|
||||
|
||||
@@ -41,17 +41,20 @@ pub struct TrackEventsContext {
|
||||
pub model_slug: String,
|
||||
pub thread_id: String,
|
||||
pub turn_id: String,
|
||||
pub product_client_id: String,
|
||||
}
|
||||
|
||||
pub fn build_track_events_context(
|
||||
model_slug: String,
|
||||
thread_id: String,
|
||||
turn_id: String,
|
||||
product_client_id: String,
|
||||
) -> TrackEventsContext {
|
||||
TrackEventsContext {
|
||||
model_slug,
|
||||
thread_id,
|
||||
turn_id,
|
||||
product_client_id,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +142,7 @@ impl TurnCodexErrorFact {
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum CodexErrKind {
|
||||
TurnAborted,
|
||||
SessionBudgetExceeded,
|
||||
Stream,
|
||||
ContextWindowExceeded,
|
||||
ThreadNotFound,
|
||||
@@ -195,6 +199,7 @@ impl From<&CodexErr> for CodexErrKind {
|
||||
fn from(error: &CodexErr) -> Self {
|
||||
match error {
|
||||
CodexErr::TurnAborted => CodexErrKind::TurnAborted,
|
||||
CodexErr::SessionBudgetExceeded => CodexErrKind::SessionBudgetExceeded,
|
||||
CodexErr::Stream(..) => CodexErrKind::Stream,
|
||||
CodexErr::ContextWindowExceeded => CodexErrKind::ContextWindowExceeded,
|
||||
CodexErr::ThreadNotFound(_) => CodexErrKind::ThreadNotFound,
|
||||
@@ -503,6 +508,7 @@ pub(crate) enum CustomAnalyticsFact {
|
||||
AppUsed(AppUsedInput),
|
||||
HookRun(HookRunInput),
|
||||
PluginUsed(PluginUsedInput),
|
||||
PluginInstallRequested(PluginInstallRequestedInput),
|
||||
PluginStateChanged(PluginStateChangedInput),
|
||||
PluginInstallFailed(PluginInstallFailedInput),
|
||||
ExternalAgentConfigImportCompleted(ExternalAgentConfigImportCompletedInput),
|
||||
@@ -540,6 +546,33 @@ pub(crate) struct PluginUsedInput {
|
||||
pub plugin: PluginTelemetryMetadata,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PluginInstallRequestSource {
|
||||
EndpointRecommendation,
|
||||
LegacyDiscovery,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PluginInstallRequested {
|
||||
pub suggestion_id: String,
|
||||
pub plugins: Vec<PluginInstallRequestedPlugin>,
|
||||
pub source: PluginInstallRequestSource,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PluginInstallRequestedPlugin {
|
||||
pub plugin_id: String,
|
||||
pub remote_plugin_id: Option<String>,
|
||||
pub plugin_name: String,
|
||||
pub connector_ids: Vec<String>,
|
||||
}
|
||||
|
||||
pub(crate) struct PluginInstallRequestedInput {
|
||||
pub tracking: TrackEventsContext,
|
||||
pub request: PluginInstallRequested,
|
||||
}
|
||||
|
||||
pub(crate) struct PluginStateChangedInput {
|
||||
pub plugin: PluginTelemetryMetadata,
|
||||
pub state: PluginState,
|
||||
|
||||
@@ -42,6 +42,9 @@ pub use facts::GoalEventKind;
|
||||
pub use facts::HookRunFact;
|
||||
pub use facts::InputError;
|
||||
pub use facts::InvocationType;
|
||||
pub use facts::PluginInstallRequestSource;
|
||||
pub use facts::PluginInstallRequested;
|
||||
pub use facts::PluginInstallRequestedPlugin;
|
||||
pub use facts::SkillInvocation;
|
||||
pub use facts::SubAgentThreadStartedInput;
|
||||
pub use facts::ThreadInitializationMode;
|
||||
|
||||
@@ -28,6 +28,7 @@ use crate::events::CodexOnboardingExternalAgentImportFailureMetadata;
|
||||
use crate::events::CodexPluginEventRequest;
|
||||
use crate::events::CodexPluginInstallFailedEventRequest;
|
||||
use crate::events::CodexPluginInstallFailedMetadata;
|
||||
use crate::events::CodexPluginInstallRequestedEventRequest;
|
||||
use crate::events::CodexPluginUsedEventRequest;
|
||||
use crate::events::CodexReviewEventParams;
|
||||
use crate::events::CodexReviewEventRequest;
|
||||
@@ -60,6 +61,7 @@ use crate::events::codex_app_metadata;
|
||||
use crate::events::codex_compaction_event_params;
|
||||
use crate::events::codex_goal_event_params;
|
||||
use crate::events::codex_hook_run_metadata;
|
||||
use crate::events::codex_plugin_install_requested_metadata;
|
||||
use crate::events::codex_plugin_metadata;
|
||||
use crate::events::codex_plugin_used_metadata;
|
||||
use crate::events::plugin_state_event_type;
|
||||
@@ -76,6 +78,7 @@ use crate::facts::ExternalAgentConfigImportCompletedInput;
|
||||
use crate::facts::ExternalAgentConfigImportFailureInput;
|
||||
use crate::facts::HookRunInput;
|
||||
use crate::facts::PluginInstallFailedInput;
|
||||
use crate::facts::PluginInstallRequestedInput;
|
||||
use crate::facts::PluginState;
|
||||
use crate::facts::PluginStateChangedInput;
|
||||
use crate::facts::PluginUsedInput;
|
||||
@@ -517,6 +520,9 @@ impl AnalyticsReducer {
|
||||
CustomAnalyticsFact::PluginUsed(input) => {
|
||||
self.ingest_plugin_used(input, out);
|
||||
}
|
||||
CustomAnalyticsFact::PluginInstallRequested(input) => {
|
||||
self.ingest_plugin_install_requested(input, out);
|
||||
}
|
||||
CustomAnalyticsFact::PluginStateChanged(input) => {
|
||||
self.ingest_plugin_state_changed(input, out);
|
||||
}
|
||||
@@ -729,7 +735,7 @@ impl AnalyticsReducer {
|
||||
turn_id: Some(tracking.turn_id.clone()),
|
||||
invoke_type: Some(invocation.invocation_type),
|
||||
model_slug: Some(tracking.model_slug.clone()),
|
||||
product_client_id: Some(originator().value),
|
||||
product_client_id: Some(tracking.product_client_id.clone()),
|
||||
repo_url,
|
||||
skill_scope: Some(skill_scope.to_string()),
|
||||
plugin_id: invocation.plugin_id,
|
||||
@@ -775,6 +781,20 @@ impl AnalyticsReducer {
|
||||
}));
|
||||
}
|
||||
|
||||
fn ingest_plugin_install_requested(
|
||||
&mut self,
|
||||
input: PluginInstallRequestedInput,
|
||||
out: &mut Vec<TrackEventRequest>,
|
||||
) {
|
||||
let PluginInstallRequestedInput { tracking, request } = input;
|
||||
out.push(TrackEventRequest::PluginInstallRequested(
|
||||
CodexPluginInstallRequestedEventRequest {
|
||||
event_type: "codex_plugin_install_requested",
|
||||
event_params: codex_plugin_install_requested_metadata(&tracking, request),
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
fn ingest_plugin_state_changed(
|
||||
&mut self,
|
||||
input: PluginStateChangedInput,
|
||||
|
||||
@@ -15,6 +15,7 @@ use anyhow::anyhow;
|
||||
pub use backend::BackendKind;
|
||||
use backend::BackendPaths;
|
||||
use codex_app_server_protocol::RemoteControlConnectionStatus;
|
||||
use codex_app_server_protocol::RemoteControlPairingStartResponse;
|
||||
use codex_app_server_transport::app_server_control_socket_path;
|
||||
use codex_utils_home_dir::find_codex_home;
|
||||
use managed_install::managed_codex_bin;
|
||||
@@ -225,6 +226,13 @@ pub async fn enable_remote_control_on_socket(
|
||||
.await
|
||||
}
|
||||
|
||||
/// Starts a manual pairing session through an already-running daemon app-server.
|
||||
pub async fn start_remote_control_pairing() -> Result<RemoteControlPairingStartResponse> {
|
||||
ensure_supported_platform()?;
|
||||
let daemon = Daemon::from_environment()?;
|
||||
remote_control_client::start_pairing(&daemon.socket_path).await
|
||||
}
|
||||
|
||||
pub async fn set_remote_control(mode: RemoteControlMode) -> Result<RemoteControlOutput> {
|
||||
ensure_supported_platform()?;
|
||||
Daemon::from_environment()?.set_remote_control(mode).await
|
||||
|
||||
@@ -12,6 +12,8 @@ use codex_app_server_protocol::RemoteControlDisableParams;
|
||||
use codex_app_server_protocol::RemoteControlDisableResponse;
|
||||
use codex_app_server_protocol::RemoteControlEnableParams;
|
||||
use codex_app_server_protocol::RemoteControlEnableResponse;
|
||||
use codex_app_server_protocol::RemoteControlPairingStartParams;
|
||||
use codex_app_server_protocol::RemoteControlPairingStartResponse;
|
||||
use codex_app_server_protocol::RemoteControlStatusChangedNotification;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use serde::de::DeserializeOwned;
|
||||
@@ -53,6 +55,35 @@ pub(crate) async fn disable_remote_control(socket_path: &Path) -> Result<RemoteC
|
||||
Ok(RemoteControlReadyStatus::from(response))
|
||||
}
|
||||
|
||||
pub(crate) async fn start_pairing(socket_path: &Path) -> Result<RemoteControlPairingStartResponse> {
|
||||
let mut websocket = client::connect(socket_path).await?;
|
||||
initialize_client(&mut websocket).await?;
|
||||
let params = serde_json::to_value(RemoteControlPairingStartParams { manual_code: true })?;
|
||||
send_remote_control_request(
|
||||
&mut websocket,
|
||||
REMOTE_CONTROL_REQUEST_ID.clone(),
|
||||
"remoteControl/pairing/start",
|
||||
Some(params),
|
||||
)
|
||||
.await?;
|
||||
let response = match read_remote_control_response(
|
||||
&mut websocket,
|
||||
&REMOTE_CONTROL_REQUEST_ID,
|
||||
"remoteControl/pairing/start",
|
||||
)
|
||||
.await?
|
||||
{
|
||||
RemoteControlRpcResponse::Success(response) => response,
|
||||
RemoteControlRpcResponse::InvalidParams => {
|
||||
return Err(anyhow!(
|
||||
"remoteControl/pairing/start rejected manual pairing parameters"
|
||||
));
|
||||
}
|
||||
};
|
||||
websocket.close(None).await.ok();
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
pub(crate) async fn enable_remote_control_with_connect_retry(
|
||||
socket_path: &Path,
|
||||
connect_timeout: Duration,
|
||||
@@ -538,6 +569,53 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn start_pairing_requests_manual_code() -> Result<()> {
|
||||
let dir = TempDir::new()?;
|
||||
let socket_path = dir.path().join("app-server.sock");
|
||||
let listener = UnixListener::bind(&socket_path).await?;
|
||||
let server_task = tokio::spawn(async move {
|
||||
let mut websocket = accept_initialized_client(listener).await?;
|
||||
let pairing = client::read_message(&mut websocket).await?;
|
||||
let JSONRPCMessage::Request(pairing) = pairing else {
|
||||
panic!("expected remoteControl/pairing/start request");
|
||||
};
|
||||
assert_eq!(pairing.id, REMOTE_CONTROL_REQUEST_ID);
|
||||
assert_eq!(pairing.method, "remoteControl/pairing/start");
|
||||
assert_eq!(
|
||||
pairing.params,
|
||||
Some(serde_json::json!({ "manualCode": true }))
|
||||
);
|
||||
client::send_message(
|
||||
&mut websocket,
|
||||
&JSONRPCMessage::Response(JSONRPCResponse {
|
||||
id: REMOTE_CONTROL_REQUEST_ID,
|
||||
result: serde_json::to_value(RemoteControlPairingStartResponse {
|
||||
pairing_code: "pairing-code".to_string(),
|
||||
manual_pairing_code: Some("ABCD-EFGH".to_string()),
|
||||
environment_id: "env_test".to_string(),
|
||||
expires_at: 1_700_000_000,
|
||||
})?,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
Ok::<_, anyhow::Error>(())
|
||||
});
|
||||
|
||||
let response = start_pairing(&socket_path).await?;
|
||||
server_task.await??;
|
||||
assert_eq!(
|
||||
response,
|
||||
RemoteControlPairingStartResponse {
|
||||
pairing_code: "pairing-code".to_string(),
|
||||
manual_pairing_code: Some("ABCD-EFGH".to_string()),
|
||||
environment_id: "env_test".to_string(),
|
||||
expires_at: 1_700_000_000,
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct EnableScenario {
|
||||
initial_notification: Option<RemoteControlStatusChangedNotification>,
|
||||
enable_response: RemoteControlStatusChangedNotification,
|
||||
|
||||
@@ -209,6 +209,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"description": "Absolute path for the root in the selected environment.",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
@@ -1618,6 +1619,12 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"timeoutSecs": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
@@ -1722,6 +1729,13 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skills": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/SkillMigration"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subagents": {
|
||||
"default": [],
|
||||
"items": {
|
||||
@@ -3406,6 +3420,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillsConfigWriteParams": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
@@ -4149,6 +4174,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"ThreadRollbackParams": {
|
||||
"description": "DEPRECATED: `thread/rollback` will be removed soon.",
|
||||
"properties": {
|
||||
"numTurns": {
|
||||
"description": "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.",
|
||||
|
||||
@@ -241,6 +241,24 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconDarkAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -573,6 +591,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
@@ -2351,6 +2370,12 @@
|
||||
},
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -2359,6 +2384,12 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"McpServerStartupFailureReason": {
|
||||
"enum": [
|
||||
"reauthenticationRequired"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"McpServerStartupState": {
|
||||
"enum": [
|
||||
"starting",
|
||||
@@ -2376,6 +2407,16 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"failureReason": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/McpServerStartupFailureReason"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+67
@@ -6406,6 +6406,24 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconDarkAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -7043,6 +7061,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"description": "Absolute path for the root in the selected environment.",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
@@ -7069,6 +7088,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
@@ -12006,6 +12026,12 @@
|
||||
},
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -12030,6 +12056,12 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"timeoutSecs": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
@@ -12062,6 +12094,12 @@
|
||||
"title": "McpServerRefreshResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"McpServerStartupFailureReason": {
|
||||
"enum": [
|
||||
"reauthenticationRequired"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"McpServerStartupState": {
|
||||
"enum": [
|
||||
"starting",
|
||||
@@ -12133,6 +12171,16 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"failureReason": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/McpServerStartupFailureReason"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -12390,6 +12438,13 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skills": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/SkillMigration"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subagents": {
|
||||
"default": [],
|
||||
"items": {
|
||||
@@ -16336,6 +16391,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillScope": {
|
||||
"enum": [
|
||||
"user",
|
||||
@@ -18947,6 +19013,7 @@
|
||||
},
|
||||
"ThreadRollbackParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"description": "DEPRECATED: `thread/rollback` will be removed soon.",
|
||||
"properties": {
|
||||
"numTurns": {
|
||||
"description": "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.",
|
||||
|
||||
+67
@@ -532,6 +532,24 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconDarkAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1169,6 +1187,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"description": "Absolute path for the root in the selected environment.",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
@@ -3309,6 +3328,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
@@ -8410,6 +8430,12 @@
|
||||
},
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -8434,6 +8460,12 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"timeoutSecs": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
@@ -8466,6 +8498,12 @@
|
||||
"title": "McpServerRefreshResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"McpServerStartupFailureReason": {
|
||||
"enum": [
|
||||
"reauthenticationRequired"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"McpServerStartupState": {
|
||||
"enum": [
|
||||
"starting",
|
||||
@@ -8537,6 +8575,16 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"failureReason": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/McpServerStartupFailureReason"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -8794,6 +8842,13 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skills": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/SkillMigration"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subagents": {
|
||||
"default": [],
|
||||
"items": {
|
||||
@@ -14115,6 +14170,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillScope": {
|
||||
"enum": [
|
||||
"user",
|
||||
@@ -16726,6 +16792,7 @@
|
||||
},
|
||||
"ThreadRollbackParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"description": "DEPRECATED: `thread/rollback` will be removed soon.",
|
||||
"properties": {
|
||||
"numTurns": {
|
||||
"description": "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.",
|
||||
|
||||
@@ -78,6 +78,24 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconDarkAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -78,6 +78,24 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"iconDarkAssets": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
+18
@@ -117,6 +117,13 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skills": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/SkillMigration"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subagents": {
|
||||
"default": [],
|
||||
"items": {
|
||||
@@ -166,6 +173,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SubagentMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
|
||||
+18
@@ -117,6 +117,13 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skills": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/SkillMigration"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subagents": {
|
||||
"default": [],
|
||||
"items": {
|
||||
@@ -166,6 +173,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SkillMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SubagentMigration": {
|
||||
"properties": {
|
||||
"name": {
|
||||
|
||||
+6
@@ -12,6 +12,12 @@
|
||||
},
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"threadId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"timeoutSecs": {
|
||||
"format": "int64",
|
||||
"type": [
|
||||
|
||||
+16
@@ -1,6 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"McpServerStartupFailureReason": {
|
||||
"enum": [
|
||||
"reauthenticationRequired"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"McpServerStartupState": {
|
||||
"enum": [
|
||||
"starting",
|
||||
@@ -18,6 +24,16 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"failureReason": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/McpServerStartupFailureReason"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
+1
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"description": "DEPRECATED: `thread/rollback` will be removed soon.",
|
||||
"properties": {
|
||||
"numTurns": {
|
||||
"description": "The number of turns to drop from the end of the thread. Must be >= 1.\n\nThis only modifies the thread's history and does not revert local file changes that have been made by the agent. Clients are responsible for reverting these changes.",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"description": "Absolute path for the root in the selected environment.",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
{
|
||||
"enum": [
|
||||
"contextWindowExceeded",
|
||||
"sessionBudgetExceeded",
|
||||
"usageLimitExceeded",
|
||||
"serverOverloaded",
|
||||
"cyberPolicy",
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { AppMetadata } from "./AppMetadata";
|
||||
/**
|
||||
* EXPERIMENTAL - app metadata returned by app-list APIs.
|
||||
*/
|
||||
export type AppInfo = { id: string, name: string, description: string | null, logoUrl: string | null, logoUrlDark: string | null, distributionChannel: string | null, branding: AppBranding | null, appMetadata: AppMetadata | null, labels: { [key in string]?: string } | null, installUrl: string | null, isAccessible: boolean,
|
||||
export type AppInfo = { id: string, name: string, description: string | null, logoUrl: string | null, logoUrlDark: string | null, iconAssets: { [key in string]?: string } | null, iconDarkAssets: { [key in string]?: string } | null, distributionChannel: string | null, branding: AppBranding | null, appMetadata: AppMetadata | null, labels: { [key in string]?: string } | null, installUrl: string | null, isAccessible: boolean,
|
||||
/**
|
||||
* Whether this app is enabled in config.toml.
|
||||
* Example:
|
||||
|
||||
+5
-1
@@ -5,4 +5,8 @@
|
||||
/**
|
||||
* Location used to resolve a selected capability root.
|
||||
*/
|
||||
export type CapabilityRootLocation = { "type": "environment", environmentId: string, path: string, };
|
||||
export type CapabilityRootLocation = { "type": "environment", environmentId: string,
|
||||
/**
|
||||
* Absolute path for the root in the selected environment.
|
||||
*/
|
||||
path: string, };
|
||||
|
||||
@@ -9,4 +9,4 @@ import type { NonSteerableTurnKind } from "./NonSteerableTurnKind";
|
||||
* When an upstream HTTP status is available (for example, from the Responses API or a provider),
|
||||
* it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.
|
||||
*/
|
||||
export type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOverloaded" | "cyberPolicy" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | { "activeTurnNotSteerable": { turnKind: NonSteerableTurnKind, } } | "other";
|
||||
export type CodexErrorInfo = "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" | "serverOverloaded" | "cyberPolicy" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | { "activeTurnNotSteerable": { turnKind: NonSteerableTurnKind, } } | "other";
|
||||
|
||||
Generated
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type McpServerOauthLoginCompletedNotification = { name: string, success: boolean, error?: string, };
|
||||
export type McpServerOauthLoginCompletedNotification = { name: string, threadId: string | null, success: boolean, error?: string, };
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type McpServerOauthLoginParams = { name: string, scopes?: Array<string> | null, timeoutSecs?: bigint | null, };
|
||||
export type McpServerOauthLoginParams = { name: string, threadId?: string | null, scopes?: Array<string> | null, timeoutSecs?: bigint | null, };
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type McpServerStartupFailureReason = "reauthenticationRequired";
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { McpServerStartupFailureReason } from "./McpServerStartupFailureReason";
|
||||
import type { McpServerStartupState } from "./McpServerStartupState";
|
||||
|
||||
export type McpServerStatusUpdatedNotification = { threadId: string | null, name: string, status: McpServerStartupState, error: string | null, };
|
||||
export type McpServerStatusUpdatedNotification = { threadId: string | null, name: string, status: McpServerStartupState, error: string | null, failureReason: McpServerStartupFailureReason | null, };
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { HookMigration } from "./HookMigration";
|
||||
import type { McpServerMigration } from "./McpServerMigration";
|
||||
import type { PluginsMigration } from "./PluginsMigration";
|
||||
import type { SessionMigration } from "./SessionMigration";
|
||||
import type { SkillMigration } from "./SkillMigration";
|
||||
import type { SubagentMigration } from "./SubagentMigration";
|
||||
|
||||
export type MigrationDetails = { plugins: Array<PluginsMigration>, sessions: Array<SessionMigration>, mcpServers: Array<McpServerMigration>, hooks: Array<HookMigration>, subagents: Array<SubagentMigration>, commands: Array<CommandMigration>, };
|
||||
export type MigrationDetails = { plugins: Array<PluginsMigration>, skills: Array<SkillMigration>, sessions: Array<SessionMigration>, mcpServers: Array<McpServerMigration>, hooks: Array<HookMigration>, subagents: Array<SubagentMigration>, commands: Array<CommandMigration>, };
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type SkillMigration = { name: string, };
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* DEPRECATED: `thread/rollback` will be removed soon.
|
||||
*/
|
||||
export type ThreadRollbackParams = { threadId: string,
|
||||
/**
|
||||
* The number of turns to drop from the end of the thread. Must be >= 1.
|
||||
|
||||
@@ -238,6 +238,7 @@ export type { McpServerOauthLoginCompletedNotification } from "./McpServerOauthL
|
||||
export type { McpServerOauthLoginParams } from "./McpServerOauthLoginParams";
|
||||
export type { McpServerOauthLoginResponse } from "./McpServerOauthLoginResponse";
|
||||
export type { McpServerRefreshResponse } from "./McpServerRefreshResponse";
|
||||
export type { McpServerStartupFailureReason } from "./McpServerStartupFailureReason";
|
||||
export type { McpServerStartupState } from "./McpServerStartupState";
|
||||
export type { McpServerStatus } from "./McpServerStatus";
|
||||
export type { McpServerStatusDetail } from "./McpServerStatusDetail";
|
||||
@@ -363,6 +364,7 @@ export type { SkillDependencies } from "./SkillDependencies";
|
||||
export type { SkillErrorInfo } from "./SkillErrorInfo";
|
||||
export type { SkillInterface } from "./SkillInterface";
|
||||
export type { SkillMetadata } from "./SkillMetadata";
|
||||
export type { SkillMigration } from "./SkillMigration";
|
||||
export type { SkillScope } from "./SkillScope";
|
||||
export type { SkillSummary } from "./SkillSummary";
|
||||
export type { SkillToolDependency } from "./SkillToolDependency";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod experimental_api;
|
||||
mod export;
|
||||
mod jsonrpc_lite;
|
||||
mod protocol;
|
||||
pub mod rpc;
|
||||
mod schema_fixtures;
|
||||
|
||||
pub use experimental_api::*;
|
||||
@@ -12,7 +12,6 @@ pub use export::generate_json_with_experimental;
|
||||
pub use export::generate_ts;
|
||||
pub use export::generate_ts_with_options;
|
||||
pub use export::generate_types;
|
||||
pub use jsonrpc_lite::*;
|
||||
pub use protocol::common::*;
|
||||
pub use protocol::event_mapping::*;
|
||||
pub use protocol::item_builders::*;
|
||||
@@ -40,6 +39,7 @@ pub use protocol::v1::SandboxSettings;
|
||||
pub use protocol::v1::Tools;
|
||||
pub use protocol::v1::UserSavedConfig;
|
||||
pub use protocol::v2::*;
|
||||
pub use rpc::*;
|
||||
pub use schema_fixtures::SchemaFixtureOptions;
|
||||
#[doc(hidden)]
|
||||
pub use schema_fixtures::generate_typescript_schema_fixture_subtree_for_tests;
|
||||
|
||||
@@ -641,12 +641,12 @@ client_request_definitions! {
|
||||
serialization: None,
|
||||
response: v2::ThreadTurnsListResponse,
|
||||
},
|
||||
#[experimental("thread/turns/items/list")]
|
||||
ThreadTurnsItemsList => "thread/turns/items/list" {
|
||||
params: v2::ThreadTurnsItemsListParams,
|
||||
#[experimental("thread/items/list")]
|
||||
ThreadItemsList => "thread/items/list" {
|
||||
params: v2::ThreadItemsListParams,
|
||||
// Explicitly concurrent: this primarily reads append-only rollout storage.
|
||||
serialization: None,
|
||||
response: v2::ThreadTurnsItemsListResponse,
|
||||
response: v2::ThreadItemsListResponse,
|
||||
},
|
||||
/// Append raw Responses API items to the thread history without starting a user turn.
|
||||
ThreadInjectItems => "thread/inject_items" {
|
||||
@@ -1913,6 +1913,7 @@ mod tests {
|
||||
request_id: request_id(),
|
||||
params: v2::McpServerOauthLoginParams {
|
||||
name: "server-a".to_string(),
|
||||
thread_id: None,
|
||||
scopes: None,
|
||||
timeout_secs: None,
|
||||
},
|
||||
@@ -2090,17 +2091,17 @@ mod tests {
|
||||
};
|
||||
assert_eq!(thread_turns_list.serialization_scope(), None);
|
||||
|
||||
let thread_turns_items_list = ClientRequest::ThreadTurnsItemsList {
|
||||
let thread_items_list = ClientRequest::ThreadItemsList {
|
||||
request_id: request_id(),
|
||||
params: v2::ThreadTurnsItemsListParams {
|
||||
params: v2::ThreadItemsListParams {
|
||||
thread_id: "thread-1".to_string(),
|
||||
turn_id: "turn-1".to_string(),
|
||||
turn_id: None,
|
||||
cursor: None,
|
||||
limit: None,
|
||||
sort_direction: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(thread_turns_items_list.serialization_scope(), None);
|
||||
assert_eq!(thread_items_list.serialization_scope(), None);
|
||||
|
||||
let mcp_resource_read = ClientRequest::McpResourceRead {
|
||||
request_id: request_id(),
|
||||
|
||||
@@ -386,7 +386,9 @@ impl ThreadHistoryBuilder {
|
||||
RolloutItem::Compacted(payload) => self.handle_compacted(payload),
|
||||
RolloutItem::ResponseItem(item) => self.handle_response_item(item),
|
||||
RolloutItem::InterAgentCommunication(_)
|
||||
| RolloutItem::InterAgentCommunicationMetadata { .. }
|
||||
| RolloutItem::TurnContext(_)
|
||||
| RolloutItem::WorldState(_)
|
||||
| RolloutItem::SessionMeta(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ pub struct AppInfo {
|
||||
pub description: Option<String>,
|
||||
pub logo_url: Option<String>,
|
||||
pub logo_url_dark: Option<String>,
|
||||
pub icon_assets: Option<HashMap<String, String>>,
|
||||
pub icon_dark_assets: Option<HashMap<String, String>>,
|
||||
pub distribution_channel: Option<String>,
|
||||
pub branding: Option<AppBranding>,
|
||||
pub app_metadata: Option<AppMetadata>,
|
||||
|
||||
@@ -574,6 +574,13 @@ pub struct PluginsMigration {
|
||||
pub plugin_names: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct SkillMigration {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
@@ -618,6 +625,8 @@ pub struct MigrationDetails {
|
||||
#[serde(default)]
|
||||
pub plugins: Vec<PluginsMigration>,
|
||||
#[serde(default)]
|
||||
pub skills: Vec<SkillMigration>,
|
||||
#[serde(default)]
|
||||
pub sessions: Vec<SessionMigration>,
|
||||
#[serde(default)]
|
||||
pub mcp_servers: Vec<McpServerMigration>,
|
||||
|
||||
@@ -23,6 +23,12 @@ v2_enum_from_core!(
|
||||
}
|
||||
);
|
||||
|
||||
v2_enum_from_core!(
|
||||
pub enum McpServerStartupFailureReason from codex_protocol::protocol::McpStartupFailureReason {
|
||||
ReauthenticationRequired
|
||||
}
|
||||
);
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
@@ -186,6 +192,8 @@ pub struct McpServerRefreshResponse {}
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct McpServerOauthLoginParams {
|
||||
pub name: String,
|
||||
#[ts(optional = nullable)]
|
||||
pub thread_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub scopes: Option<Vec<String>>,
|
||||
@@ -215,6 +223,7 @@ pub struct McpToolCallProgressNotification {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct McpServerOauthLoginCompletedNotification {
|
||||
pub name: String,
|
||||
pub thread_id: Option<String>,
|
||||
pub success: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
@@ -239,6 +248,7 @@ pub struct McpServerStatusUpdatedNotification {
|
||||
pub name: String,
|
||||
pub status: McpServerStartupState,
|
||||
pub error: Option<String>,
|
||||
pub failure_reason: Option<McpServerStartupFailureReason>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
|
||||
@@ -70,6 +70,7 @@ pub enum NonSteerableTurnKind {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum CodexErrorInfo {
|
||||
ContextWindowExceeded,
|
||||
SessionBudgetExceeded,
|
||||
UsageLimitExceeded,
|
||||
ServerOverloaded,
|
||||
CyberPolicy,
|
||||
@@ -115,6 +116,7 @@ impl From<CoreCodexErrorInfo> for CodexErrorInfo {
|
||||
fn from(value: CoreCodexErrorInfo) -> Self {
|
||||
match value {
|
||||
CoreCodexErrorInfo::ContextWindowExceeded => CodexErrorInfo::ContextWindowExceeded,
|
||||
CoreCodexErrorInfo::SessionBudgetExceeded => CodexErrorInfo::SessionBudgetExceeded,
|
||||
CoreCodexErrorInfo::UsageLimitExceeded => CodexErrorInfo::UsageLimitExceeded,
|
||||
CoreCodexErrorInfo::ServerOverloaded => CodexErrorInfo::ServerOverloaded,
|
||||
CoreCodexErrorInfo::CyberPolicy => CodexErrorInfo::CyberPolicy,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::*;
|
||||
use crate::ServerNotification;
|
||||
use codex_protocol::approvals::ElicitationRequest as CoreElicitationRequest;
|
||||
use codex_protocol::config_types::MultiAgentMode;
|
||||
use codex_protocol::items::AgentMessageContent;
|
||||
@@ -224,10 +225,10 @@ fn thread_resume_response_round_trips_initial_turns_page() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_turns_items_list_round_trips() {
|
||||
let params = ThreadTurnsItemsListParams {
|
||||
fn thread_items_list_round_trips() {
|
||||
let params = ThreadItemsListParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
turn_id: "turn_456".to_string(),
|
||||
turn_id: Some("turn_456".to_string()),
|
||||
cursor: Some("cursor_1".to_string()),
|
||||
limit: Some(50),
|
||||
sort_direction: Some(SortDirection::Asc),
|
||||
@@ -243,7 +244,7 @@ fn thread_turns_items_list_round_trips() {
|
||||
"sortDirection": "asc",
|
||||
})
|
||||
);
|
||||
let response = ThreadTurnsItemsListResponse {
|
||||
let response = ThreadItemsListResponse {
|
||||
data: vec![ThreadItem::ContextCompaction {
|
||||
id: "item_1".to_string(),
|
||||
}],
|
||||
@@ -259,6 +260,32 @@ fn thread_turns_items_list_round_trips() {
|
||||
"backwardsCursor": "cursor_0",
|
||||
})
|
||||
);
|
||||
|
||||
let params_without_turn = ThreadItemsListParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
turn_id: None,
|
||||
cursor: None,
|
||||
limit: None,
|
||||
sort_direction: None,
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(¶ms_without_turn).expect("serialize params without turn"),
|
||||
json!({
|
||||
"threadId": "thr_123",
|
||||
"turnId": null,
|
||||
"cursor": null,
|
||||
"limit": null,
|
||||
"sortDirection": null,
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_value::<ThreadItemsListParams>(json!({
|
||||
"threadId": "thr_123",
|
||||
}))
|
||||
.expect("deserialize params without turn"),
|
||||
params_without_turn
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2129,6 +2156,7 @@ fn mcp_server_status_updated_accepts_missing_thread_id() {
|
||||
name: "optional_broken".to_string(),
|
||||
status: McpServerStartupState::Failed,
|
||||
error: Some("handshake failed".to_string()),
|
||||
failure_reason: None,
|
||||
};
|
||||
assert_eq!(notification, expected);
|
||||
assert_eq!(
|
||||
@@ -2138,6 +2166,33 @@ fn mcp_server_status_updated_accepts_missing_thread_id() {
|
||||
"name": "optional_broken",
|
||||
"status": "failed",
|
||||
"error": "handshake failed",
|
||||
"failureReason": null,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mcp_server_status_updated_serializes_failure_reason() {
|
||||
let notification =
|
||||
ServerNotification::McpServerStatusUpdated(McpServerStatusUpdatedNotification {
|
||||
thread_id: Some("thread-1".to_string()),
|
||||
name: "expired-oauth".to_string(),
|
||||
status: McpServerStartupState::Failed,
|
||||
error: Some("OAuth credentials expired".to_string()),
|
||||
failure_reason: Some(McpServerStartupFailureReason::ReauthenticationRequired),
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(notification).expect("notification should serialize"),
|
||||
json!({
|
||||
"method": "mcpServer/startupStatus/updated",
|
||||
"params": {
|
||||
"threadId": "thread-1",
|
||||
"name": "expired-oauth",
|
||||
"status": "failed",
|
||||
"error": "OAuth credentials expired",
|
||||
"failureReason": "reauthenticationRequired",
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ pub struct ThreadStartParams {
|
||||
pub model: Option<String>,
|
||||
#[ts(optional = nullable)]
|
||||
pub model_provider: Option<String>,
|
||||
/// Allow a provider with an authoritative static model catalog to replace an unavailable
|
||||
/// requested model with its default.
|
||||
#[experimental("thread/start.allowProviderModelFallback")]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub allow_provider_model_fallback: bool,
|
||||
#[serde(
|
||||
default,
|
||||
deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option",
|
||||
@@ -94,9 +99,7 @@ pub struct ThreadStartParams {
|
||||
pub developer_instructions: Option<String>,
|
||||
#[ts(optional = nullable)]
|
||||
pub personality: Option<Personality>,
|
||||
/// Set the initial multi-agent mode for this thread. `none` leaves the
|
||||
/// multi-agent tools available without injecting mode instructions.
|
||||
/// Omitted defaults to `explicitRequestOnly`.
|
||||
/// @deprecated Ignored. Use Ultra reasoning effort for proactive multi-agent behavior.
|
||||
#[experimental("thread/start.multiAgentMode")]
|
||||
#[ts(optional = nullable)]
|
||||
pub multi_agent_mode: Option<MultiAgentMode>,
|
||||
@@ -186,7 +189,7 @@ pub struct ThreadStartResponse {
|
||||
#[serde(default)]
|
||||
pub active_permission_profile: Option<ActivePermissionProfile>,
|
||||
pub reasoning_effort: Option<ReasoningEffort>,
|
||||
/// Current multi-agent mode for this thread.
|
||||
/// @deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior.
|
||||
#[experimental("thread/start.multiAgentMode")]
|
||||
#[serde(default)]
|
||||
pub multi_agent_mode: MultiAgentMode,
|
||||
@@ -250,7 +253,7 @@ pub struct ThreadSettingsUpdateParams {
|
||||
#[experimental("thread/settings/update.collaborationMode")]
|
||||
#[ts(optional = nullable)]
|
||||
pub collaboration_mode: Option<CollaborationMode>,
|
||||
/// Select the multi-agent mode for subsequent turns.
|
||||
/// @deprecated Ignored. Use `effort: "ultra"` for proactive multi-agent behavior.
|
||||
#[experimental("thread/settings/update.multiAgentMode")]
|
||||
#[ts(optional = nullable)]
|
||||
pub multi_agent_mode: Option<MultiAgentMode>,
|
||||
@@ -279,7 +282,7 @@ pub struct ThreadSettings {
|
||||
pub effort: Option<ReasoningEffort>,
|
||||
pub summary: Option<ReasoningSummary>,
|
||||
pub collaboration_mode: CollaborationMode,
|
||||
/// Current multi-agent mode for this thread.
|
||||
/// @deprecated Always `explicitRequestOnly`. Use `effort` for Ultra behavior.
|
||||
#[experimental("thread/settings.multiAgentMode")]
|
||||
#[serde(default)]
|
||||
pub multi_agent_mode: MultiAgentMode,
|
||||
@@ -419,7 +422,7 @@ pub struct ThreadResumeResponse {
|
||||
#[serde(default)]
|
||||
pub active_permission_profile: Option<ActivePermissionProfile>,
|
||||
pub reasoning_effort: Option<ReasoningEffort>,
|
||||
/// Current multi-agent mode for this thread.
|
||||
/// @deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior.
|
||||
#[experimental("thread/resume.multiAgentMode")]
|
||||
#[serde(default)]
|
||||
pub multi_agent_mode: MultiAgentMode,
|
||||
@@ -578,7 +581,7 @@ pub struct ThreadForkResponse {
|
||||
#[serde(default)]
|
||||
pub active_permission_profile: Option<ActivePermissionProfile>,
|
||||
pub reasoning_effort: Option<ReasoningEffort>,
|
||||
/// Current multi-agent mode for this thread.
|
||||
/// @deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior.
|
||||
#[experimental("thread/fork.multiAgentMode")]
|
||||
#[serde(default)]
|
||||
pub multi_agent_mode: MultiAgentMode,
|
||||
@@ -1027,6 +1030,7 @@ pub struct ThreadBackgroundTerminalsTerminateResponse {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
/// DEPRECATED: `thread/rollback` will be removed soon.
|
||||
pub struct ThreadRollbackParams {
|
||||
pub thread_id: String,
|
||||
/// The number of turns to drop from the end of the thread. Must be >= 1.
|
||||
@@ -1088,10 +1092,15 @@ pub struct ThreadListParams {
|
||||
/// Optional substring filter for the extracted thread title.
|
||||
#[ts(optional = nullable)]
|
||||
pub search_term: Option<String>,
|
||||
/// Optional direct parent thread filter.
|
||||
/// Optional direct parent thread filter. Mutually exclusive with `ancestorThreadId`.
|
||||
#[experimental("thread/list.parentThreadId")]
|
||||
#[ts(optional = nullable)]
|
||||
pub parent_thread_id: Option<String>,
|
||||
/// Optional ancestor thread filter. Returns spawned descendants at any depth, excluding the
|
||||
/// ancestor itself. Mutually exclusive with `parentThreadId`.
|
||||
#[experimental("thread/list.ancestorThreadId")]
|
||||
#[ts(optional = nullable)]
|
||||
pub ancestor_thread_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
@@ -1316,9 +1325,11 @@ pub struct ThreadTurnsListResponse {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadTurnsItemsListParams {
|
||||
pub struct ThreadItemsListParams {
|
||||
pub thread_id: String,
|
||||
pub turn_id: String,
|
||||
/// Optional turn id to filter by. When omitted, returns items across the thread.
|
||||
#[ts(optional = nullable)]
|
||||
pub turn_id: Option<String>,
|
||||
/// Opaque cursor to pass to the next call to continue after the last item.
|
||||
#[ts(optional = nullable)]
|
||||
pub cursor: Option<String>,
|
||||
@@ -1333,7 +1344,7 @@ pub struct ThreadTurnsItemsListParams {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadTurnsItemsListResponse {
|
||||
pub struct ThreadItemsListResponse {
|
||||
pub data: Vec<ThreadItem>,
|
||||
/// Opaque cursor to pass to the next call to continue after the last item.
|
||||
/// if None, there are no more items to return.
|
||||
|
||||
@@ -151,9 +151,7 @@ pub struct TurnStartParams {
|
||||
#[ts(optional = nullable)]
|
||||
pub collaboration_mode: Option<CollaborationMode>,
|
||||
|
||||
/// Controls multi-agent v2 delegation instructions. `none` leaves the
|
||||
/// multi-agent tools available without injecting mode instructions. Omitted
|
||||
/// keeps the loaded session's current mode.
|
||||
/// @deprecated Ignored. Use `effort: "ultra"` for proactive multi-agent behavior.
|
||||
#[experimental("turn/start.multiAgentMode")]
|
||||
#[ts(optional = nullable)]
|
||||
pub multi_agent_mode: Option<MultiAgentMode>,
|
||||
|
||||
@@ -1222,6 +1222,7 @@ async fn thread_list(endpoint: &Endpoint, config_overrides: &[String], limit: u3
|
||||
source_kinds: None,
|
||||
archived: None,
|
||||
parent_thread_id: None,
|
||||
ancestor_thread_id: None,
|
||||
cwd: None,
|
||||
use_state_db_only: false,
|
||||
search_term: None,
|
||||
|
||||
@@ -55,6 +55,7 @@ uuid = { workspace = true, features = ["serde", "v7"] }
|
||||
[dev-dependencies]
|
||||
chrono = { workspace = true }
|
||||
codex-config = { workspace = true }
|
||||
codex-protocol = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tokio = { workspace = true, features = ["test-util"] }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use axum::http::HeaderMap;
|
||||
use axum::http::HeaderValue;
|
||||
use codex_api::SharedAuthProvider;
|
||||
use codex_login::AuthManager;
|
||||
use codex_login::UnauthorizedRecovery;
|
||||
@@ -8,11 +10,30 @@ use tokio::sync::watch;
|
||||
use tracing::info;
|
||||
use tracing::warn;
|
||||
|
||||
pub(super) const REMOTE_CONTROL_ACCOUNT_ID_HEADER: &str = "chatgpt-account-id";
|
||||
|
||||
pub(super) struct RemoteControlConnectionAuth {
|
||||
pub(super) auth_provider: SharedAuthProvider,
|
||||
pub(super) account_id: String,
|
||||
}
|
||||
|
||||
impl RemoteControlConnectionAuth {
|
||||
pub(super) fn request_headers(&self) -> io::Result<HeaderMap> {
|
||||
let mut headers = HeaderMap::new();
|
||||
self.auth_provider.add_auth_headers(&mut headers);
|
||||
headers.insert(
|
||||
REMOTE_CONTROL_ACCOUNT_ID_HEADER,
|
||||
HeaderValue::from_str(&self.account_id).map_err(|err| {
|
||||
io::Error::new(
|
||||
ErrorKind::InvalidInput,
|
||||
format!("invalid remote control account id header: {err}"),
|
||||
)
|
||||
})?,
|
||||
);
|
||||
Ok(headers)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn load_remote_control_auth(
|
||||
auth_manager: &Arc<AuthManager>,
|
||||
) -> io::Result<RemoteControlConnectionAuth> {
|
||||
@@ -103,3 +124,100 @@ pub(super) fn mark_recovery_auth_change_seen(
|
||||
auth_change_rx.borrow_and_update();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codex_api::AuthProvider;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct TestAuthProvider {
|
||||
account_ids: Vec<&'static str>,
|
||||
}
|
||||
|
||||
impl AuthProvider for TestAuthProvider {
|
||||
fn add_auth_headers(&self, headers: &mut HeaderMap) {
|
||||
headers.insert(
|
||||
axum::http::header::AUTHORIZATION,
|
||||
HeaderValue::from_static("Bearer test-token"),
|
||||
);
|
||||
headers.insert("x-openai-fedramp", HeaderValue::from_static("true"));
|
||||
for account_id in &self.account_ids {
|
||||
headers.append("ChatGPT-Account-ID", HeaderValue::from_static(account_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn remote_control_auth(
|
||||
account_id: &str,
|
||||
provider_account_ids: Vec<&'static str>,
|
||||
) -> RemoteControlConnectionAuth {
|
||||
RemoteControlConnectionAuth {
|
||||
auth_provider: Arc::new(TestAuthProvider {
|
||||
account_ids: provider_account_ids,
|
||||
}),
|
||||
account_id: account_id.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn request_headers_adds_account_header_when_provider_omits_it() {
|
||||
let headers = remote_control_auth("selected-account", Vec::new())
|
||||
.request_headers()
|
||||
.expect("request headers should build");
|
||||
|
||||
assert_eq!(
|
||||
headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER)
|
||||
.iter()
|
||||
.map(|value| value.to_str().expect("account header should be text"))
|
||||
.collect::<Vec<_>>(),
|
||||
vec!["selected-account"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn request_headers_replaces_provider_accounts_and_preserves_other_headers() {
|
||||
let headers = remote_control_auth(
|
||||
"selected-account",
|
||||
vec!["provider-account-a", "provider-account-b"],
|
||||
)
|
||||
.request_headers()
|
||||
.expect("request headers should build");
|
||||
|
||||
assert_eq!(
|
||||
headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER)
|
||||
.iter()
|
||||
.map(|value| value.to_str().expect("account header should be text"))
|
||||
.collect::<Vec<_>>(),
|
||||
vec!["selected-account"]
|
||||
);
|
||||
assert_eq!(
|
||||
headers
|
||||
.get(axum::http::header::AUTHORIZATION)
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("Bearer test-token")
|
||||
);
|
||||
assert_eq!(
|
||||
headers
|
||||
.get("x-openai-fedramp")
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("true")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn request_headers_rejects_invalid_account_header_value() {
|
||||
let err = remote_control_auth("invalid\naccount", Vec::new())
|
||||
.request_headers()
|
||||
.expect_err("invalid account header should fail");
|
||||
|
||||
assert_eq!(err.kind(), ErrorKind::InvalidInput);
|
||||
assert!(
|
||||
err.to_string()
|
||||
.starts_with("invalid remote control account id header:")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use super::auth::RemoteControlConnectionAuth;
|
||||
use super::auth::load_remote_control_auth;
|
||||
use super::auth::recover_remote_control_auth;
|
||||
use super::enroll::REMOTE_CONTROL_ACCOUNT_ID_HEADER;
|
||||
use super::enroll::format_headers;
|
||||
use super::enroll::preview_remote_control_response_body;
|
||||
use super::protocol::normalize_remote_control_base_url;
|
||||
@@ -188,8 +187,7 @@ async fn send_client_management_request_once(
|
||||
action: &str,
|
||||
) -> io::Result<ClientManagementResponse> {
|
||||
let client = build_reqwest_client();
|
||||
let mut auth_headers = HeaderMap::new();
|
||||
auth.auth_provider.add_auth_headers(&mut auth_headers);
|
||||
let auth_headers = auth.request_headers()?;
|
||||
let request = match request {
|
||||
ClientManagementRequest::List { url, params } => {
|
||||
let mut query = Vec::new();
|
||||
@@ -216,7 +214,6 @@ async fn send_client_management_request_once(
|
||||
let response = request
|
||||
.timeout(REMOTE_CONTROL_CLIENT_MANAGEMENT_TIMEOUT)
|
||||
.headers(auth_headers)
|
||||
.header(REMOTE_CONTROL_ACCOUNT_ID_HEADER, &auth.account_id)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|err| io::Error::other(format!("failed to {action}: {err}")))?;
|
||||
|
||||
@@ -31,7 +31,6 @@ const REMOTE_CONTROL_SERVER_TOKEN_REFRESH_SKEW_SECS: i64 = 30;
|
||||
const REQUEST_ID_HEADER: &str = "x-request-id";
|
||||
const OAI_REQUEST_ID_HEADER: &str = "x-oai-request-id";
|
||||
const CF_RAY_HEADER: &str = "cf-ray";
|
||||
pub(super) const REMOTE_CONTROL_ACCOUNT_ID_HEADER: &str = "chatgpt-account-id";
|
||||
pub(super) const REMOTE_CONTROL_INSTALLATION_ID_HEADER: &str = "x-codex-installation-id";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -492,13 +491,11 @@ where
|
||||
Response: DeserializeOwned,
|
||||
{
|
||||
let client = build_reqwest_client();
|
||||
let mut auth_headers = HeaderMap::new();
|
||||
auth.auth_provider.add_auth_headers(&mut auth_headers);
|
||||
let auth_headers = auth.request_headers()?;
|
||||
let response = client
|
||||
.post(url)
|
||||
.timeout(REMOTE_CONTROL_ENROLL_TIMEOUT)
|
||||
.headers(auth_headers)
|
||||
.header(REMOTE_CONTROL_ACCOUNT_ID_HEADER, &auth.account_id)
|
||||
.header(REMOTE_CONTROL_INSTALLATION_ID_HEADER, installation_id)
|
||||
.json(request)
|
||||
.send()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::enroll::REMOTE_CONTROL_ACCOUNT_ID_HEADER;
|
||||
use super::auth::REMOTE_CONTROL_ACCOUNT_ID_HEADER;
|
||||
use super::enroll::REMOTE_CONTROL_INSTALLATION_ID_HEADER;
|
||||
use super::enroll::RemoteControlEnrollment;
|
||||
use super::enroll::load_persisted_remote_control_enrollment;
|
||||
@@ -18,7 +18,6 @@ use crate::transport::CHANNEL_CAPACITY;
|
||||
use crate::transport::ConnectionOrigin;
|
||||
use crate::transport::TransportEvent;
|
||||
use base64::Engine;
|
||||
use codex_app_server_protocol::AuthMode;
|
||||
use codex_app_server_protocol::ConfigWarningNotification;
|
||||
use codex_app_server_protocol::JSONRPCMessage;
|
||||
use codex_app_server_protocol::RemoteControlConnectionStatus;
|
||||
@@ -36,6 +35,7 @@ use codex_login::CodexAuth;
|
||||
use codex_login::save_auth;
|
||||
use codex_login::token_data::TokenData;
|
||||
use codex_login::token_data::parse_chatgpt_jwt_claims;
|
||||
use codex_protocol::auth::AuthMode;
|
||||
use codex_state::RemoteControlEnrollmentRecord;
|
||||
use codex_state::StateRuntime;
|
||||
use futures::SinkExt;
|
||||
@@ -1473,14 +1473,16 @@ async fn remote_control_http_mode_enrolls_before_connecting() {
|
||||
Some(&"Bearer Access Token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
enroll_request.headers.get(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
Some(&"account_id".to_string())
|
||||
enroll_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
assert_eq!(
|
||||
enroll_request
|
||||
.headers
|
||||
.get(REMOTE_CONTROL_INSTALLATION_ID_HEADER),
|
||||
Some(&TEST_INSTALLATION_ID.to_string())
|
||||
.get_all(REMOTE_CONTROL_INSTALLATION_ID_HEADER),
|
||||
vec![TEST_INSTALLATION_ID]
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<serde_json::Value>(&enroll_request.body)
|
||||
@@ -1720,6 +1722,18 @@ async fn remote_control_http_mode_refreshes_persisted_enrollment_before_connecti
|
||||
refresh_request.headers.get("authorization"),
|
||||
Some(&"Bearer Access Token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
refresh_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
assert_eq!(
|
||||
refresh_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_INSTALLATION_ID_HEADER),
|
||||
vec![TEST_INSTALLATION_ID]
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<serde_json::Value>(&refresh_request.body)
|
||||
.expect("refresh body should deserialize"),
|
||||
@@ -2578,10 +2592,35 @@ async fn remote_control_http_mode_preserves_enrollment_after_generic_websocket_4
|
||||
struct CapturedHttpRequest {
|
||||
stream: TcpStream,
|
||||
request_line: String,
|
||||
headers: BTreeMap<String, String>,
|
||||
headers: CapturedHttpHeaders,
|
||||
body: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct CapturedHttpHeaders(Vec<(String, String)>);
|
||||
|
||||
impl CapturedHttpHeaders {
|
||||
fn append(&mut self, name: String, value: String) {
|
||||
self.0.push((name, value));
|
||||
}
|
||||
|
||||
fn get(&self, name: &str) -> Option<&String> {
|
||||
self.0
|
||||
.iter()
|
||||
.rev()
|
||||
.find(|(candidate, _value)| candidate.eq_ignore_ascii_case(name))
|
||||
.map(|(_name, value)| value)
|
||||
}
|
||||
|
||||
fn get_all(&self, name: &str) -> Vec<&str> {
|
||||
self.0
|
||||
.iter()
|
||||
.filter(|(candidate, _value)| candidate.eq_ignore_ascii_case(name))
|
||||
.map(|(_name, value)| value.as_str())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
struct CapturedWebSocketRequest {
|
||||
path: String,
|
||||
@@ -2612,7 +2651,7 @@ async fn accept_http_request(listener: &TcpListener) -> CapturedHttpRequest {
|
||||
.expect("request line should read");
|
||||
let request_line = request_line.trim_end_matches("\r\n").to_string();
|
||||
|
||||
let mut headers = BTreeMap::new();
|
||||
let mut headers = CapturedHttpHeaders::default();
|
||||
loop {
|
||||
let mut line = String::new();
|
||||
reader
|
||||
@@ -2624,7 +2663,7 @@ async fn accept_http_request(listener: &TcpListener) -> CapturedHttpRequest {
|
||||
}
|
||||
let line = line.trim_end_matches("\r\n");
|
||||
let (name, value) = line.split_once(':').expect("header should contain colon");
|
||||
headers.insert(name.to_ascii_lowercase(), value.trim().to_string());
|
||||
headers.append(name.to_ascii_lowercase(), value.trim().to_string());
|
||||
}
|
||||
|
||||
let content_length = headers
|
||||
|
||||
@@ -60,8 +60,8 @@ async fn remote_control_handle_lists_clients_while_disabled() {
|
||||
Some(&"Bearer Access Token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
request.headers.get(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
Some(&"account_id".to_string())
|
||||
request.headers.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_json(
|
||||
request.stream,
|
||||
@@ -127,6 +127,14 @@ async fn remote_control_handle_revokes_client_while_disabled() {
|
||||
request.request_line,
|
||||
"DELETE /backend-api/wham/remote/control/environments/env%20%2F%3F/clients/client%20%2F%3F HTTP/1.1"
|
||||
);
|
||||
assert_eq!(
|
||||
request.headers.get("authorization"),
|
||||
Some(&"Bearer Access Token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
request.headers.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_status(request.stream, "204 No Content", "").await;
|
||||
});
|
||||
let handle = client_management_handle(remote_control_url, remote_control_auth_manager());
|
||||
@@ -155,6 +163,12 @@ async fn list_remote_control_clients_recovers_auth_after_unauthorized() {
|
||||
stale_request.headers.get("authorization"),
|
||||
Some(&"Bearer stale-token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
stale_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_status(stale_request.stream, "401 Unauthorized", "").await;
|
||||
|
||||
let recovered_request = accept_http_request(&listener).await;
|
||||
@@ -162,6 +176,12 @@ async fn list_remote_control_clients_recovers_auth_after_unauthorized() {
|
||||
recovered_request.headers.get("authorization"),
|
||||
Some(&"Bearer fresh-token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
recovered_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_json(recovered_request.stream, empty_client_list()).await;
|
||||
});
|
||||
let codex_home = TempDir::new().expect("temp dir should create");
|
||||
@@ -235,6 +255,12 @@ async fn list_remote_control_clients_retries_unauthorized_only_once() {
|
||||
stale_request.headers.get("authorization"),
|
||||
Some(&"Bearer stale-token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
stale_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_status(stale_request.stream, "401 Unauthorized", "").await;
|
||||
|
||||
let recovered_request = accept_http_request(&listener).await;
|
||||
@@ -242,6 +268,12 @@ async fn list_remote_control_clients_retries_unauthorized_only_once() {
|
||||
recovered_request.headers.get("authorization"),
|
||||
Some(&"Bearer fresh-token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
recovered_request
|
||||
.headers
|
||||
.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_status(recovered_request.stream, "401 Unauthorized", "").await;
|
||||
|
||||
assert!(
|
||||
@@ -311,6 +343,14 @@ async fn revoke_remote_control_client_does_not_retry_forbidden() {
|
||||
let remote_control_url = remote_control_url_for_listener(&listener);
|
||||
let server_task = tokio::spawn(async move {
|
||||
let request = accept_http_request(&listener).await;
|
||||
assert_eq!(
|
||||
request.headers.get("authorization"),
|
||||
Some(&"Bearer Access Token".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
request.headers.get_all(REMOTE_CONTROL_ACCOUNT_ID_HEADER),
|
||||
vec!["account_id"]
|
||||
);
|
||||
respond_with_status_and_headers(
|
||||
request.stream,
|
||||
"403 Forbidden",
|
||||
|
||||
@@ -1813,7 +1813,6 @@ mod tests {
|
||||
use crate::transport::remote_control::protocol::StreamId;
|
||||
use crate::transport::remote_control::protocol::normalize_remote_control_url;
|
||||
use chrono::Utc;
|
||||
use codex_app_server_protocol::AuthMode;
|
||||
use codex_app_server_protocol::ConfigWarningNotification;
|
||||
use codex_app_server_protocol::JSONRPCMessage;
|
||||
use codex_app_server_protocol::JSONRPCNotification;
|
||||
@@ -1826,6 +1825,7 @@ mod tests {
|
||||
use codex_login::save_auth;
|
||||
use codex_login::token_data::TokenData;
|
||||
use codex_login::token_data::parse_chatgpt_jwt_claims;
|
||||
use codex_protocol::auth::AuthMode;
|
||||
use codex_state::StateRuntime;
|
||||
use futures::StreamExt;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -11,6 +11,7 @@ codex_rust_crate(
|
||||
"//codex-rs/rmcp-client:test_stdio_server",
|
||||
],
|
||||
integration_test_timeout = "long",
|
||||
run_tests_with_wine_exec = True,
|
||||
test_shard_counts = {
|
||||
# Note app-server-all-test has a large number of integration tests, so
|
||||
# even a single shard can be quite slow. When there is a legitimate
|
||||
|
||||
@@ -33,6 +33,7 @@ codex-analytics = { workspace = true }
|
||||
codex-arg0 = { workspace = true }
|
||||
codex-cloud-config = { workspace = true }
|
||||
codex-config = { workspace = true }
|
||||
codex-connectors = { workspace = true }
|
||||
codex-core = { workspace = true }
|
||||
codex-core-plugins = { workspace = true }
|
||||
codex-home = { workspace = true }
|
||||
|
||||
@@ -137,17 +137,17 @@ Example with notification opt-out:
|
||||
|
||||
## API Overview
|
||||
|
||||
- `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. Experimental `runtimeWorkspaceRoots` replaces the thread-scoped runtime workspace roots used to materialize `:workspace_roots`; paths must be absolute. For permissions, prefer experimental `permissions` profile selection by id; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissions`. Experimental `multiAgentMode` selects the initial thread mode and defaults to `explicitRequestOnly` when omitted; use `none` to keep multi-agent tools available without injecting mode instructions. Experimental `environments` selects the sticky execution environments for turns on the thread; omit it to use the server default, pass `[]` to disable environments, or pass explicit environment ids with per-environment `cwd`. Experimental `selectedCapabilityRoots` selects environment-owned plugin or standalone-skill roots. Skills found below those roots are listed and read through the owning environment. Stdio MCP servers declared by selected plugins are also started in that environment; HTTP MCP declarations remain inactive.
|
||||
- `thread/resume` — reopen an existing thread by id so subsequent `turn/start` calls append to it. Accepts the same permission override rules as `thread/start`. Multi-agent mode restores the last effective mode from rollout history when available; clients can select another mode on the first `turn/start`.
|
||||
- `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. Experimental `allowProviderModelFallback` lets providers backed by an authoritative static model catalog replace an unavailable requested `model` with the catalog default; dynamic or cached catalogs preserve the requested model. Experimental `runtimeWorkspaceRoots` replaces the thread-scoped runtime workspace roots used to materialize `:workspace_roots`; paths must be absolute. For permissions, prefer experimental `permissions` profile selection by id; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissions`. Deprecated experimental `multiAgentMode` is ignored; use Ultra reasoning effort for proactive multi-agent behavior. Experimental `environments` selects the sticky execution environments for turns on the thread; omit it to use the server default, pass `[]` to disable environments, or pass explicit environment ids with per-environment `cwd`. Experimental `selectedCapabilityRoots` selects environment-owned plugin or standalone-skill roots using environment-native absolute paths. Skills found below those roots are listed and read through the owning environment. Stdio MCP servers declared by selected plugins are started in that environment, and HTTP MCP connections use that environment's HTTP client.
|
||||
- `thread/resume` — reopen an existing thread by id so subsequent `turn/start` calls append to it. Accepts the same permission override rules as `thread/start`.
|
||||
- `thread/fork` — fork an existing thread into a new thread id by copying the stored history; if the source thread is currently mid-turn, the fork records the same interruption marker as `turn/interrupt` instead of inheriting an unmarked partial turn suffix. The returned `thread.forkedFromId` points at the source thread when known. Accepts `ephemeral: true` for an in-memory temporary fork, emits `thread/started` (including the current `thread.status`), and auto-subscribes you to turn/item events for the new thread. Experimental clients can pass `excludeTurns: true` when they plan to page fork history via `thread/turns/list` instead of receiving the full turn array immediately. Accepts the same permission override rules as `thread/start`.
|
||||
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. `instructionSources` lists loaded instruction files using each source environment's native absolute path syntax, including files loaded from remote environments. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known. Their experimental `multiAgentMode` field, and the corresponding thread setting, report the thread's current mode. Turn construction separately determines whether that mode is applicable to the selected model and runtime configuration.
|
||||
- `thread/list` — page through stored threads; supports cursor-based pagination and optional `modelProviders`, `sourceKinds`, `archived`, `cwd`, and `searchTerm` filters. Experimental clients can use `parentThreadId` to filter direct spawned children represented by persisted spawn-edge state. Review and Guardian threads are not included because they do not participate in that spawn-edge lifecycle. Each returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded. Subagent threads also include `parentThreadId` when the immediate parent is known.
|
||||
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. `instructionSources` lists loaded instruction files using each source environment's native absolute path syntax, including files loaded from remote environments. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known. Their deprecated experimental `multiAgentMode` field, and the corresponding thread setting, always report `explicitRequestOnly`; Ultra reasoning effort is the source of proactive multi-agent behavior.
|
||||
- `thread/list` — page through stored threads; supports cursor-based pagination and optional `modelProviders`, `sourceKinds`, `archived`, `cwd`, and `searchTerm` filters. Experimental clients can use `parentThreadId` for direct spawned children or `ancestorThreadId` for spawned descendants at any depth; the two filters are mutually exclusive. Review and Guardian threads are not included because they do not participate in that spawn-edge lifecycle. Each returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded. Subagent threads also include `parentThreadId` when the immediate parent is known.
|
||||
- `thread/loaded/list` — list the thread ids currently loaded in memory.
|
||||
- `thread/read` — read a stored thread by id without resuming it; optionally include turns via `includeTurns`. The returned `thread` includes `status` (`ThreadStatus`), defaulting to `notLoaded` when the thread is not currently loaded.
|
||||
- `thread/turns/list` — experimental; page through a stored thread’s turn history without resuming it; supports cursor-based pagination with `sortDirection`, `itemsView`, `nextCursor`, and `backwardsCursor`.
|
||||
- `thread/turns/items/list` — experimental; reserved for paging full items for one turn. The API shape is present, but app-server currently returns an unsupported-method JSON-RPC error.
|
||||
- `thread/items/list` — experimental; page through persisted thread items without resuming the thread. Pass `turnId` to restrict results to one turn, or omit it to page items across the thread. The active thread store must support item pagination.
|
||||
- `thread/metadata/update` — patch stored thread metadata in sqlite; currently supports updating persisted `gitInfo` fields and returns the refreshed `thread`.
|
||||
- `thread/settings/update` — experimental; queue a partial update to a loaded thread’s next-turn settings without starting a turn or adding transcript items. Omitted fields leave settings unchanged; `serviceTier: null` clears the tier; `multiAgentMode` selects `none`, `explicitRequestOnly`, or `proactive` for subsequent turns; `sandboxPolicy` and `permissions` cannot be combined. Returns `{}` when the update is accepted and emits `thread/settings/updated` with the full effective settings only if they actually change. `turn/start` settings overrides emit the same notification when they change the stored settings.
|
||||
- `thread/settings/update` — experimental; queue a partial update to a loaded thread’s next-turn settings without starting a turn or adding transcript items. Omitted fields leave settings unchanged; `serviceTier: null` clears the tier; deprecated `multiAgentMode` is ignored, while Ultra reasoning effort enables proactive multi-agent behavior; `sandboxPolicy` and `permissions` cannot be combined. Returns `{}` when the update is accepted and emits `thread/settings/updated` with the full effective settings only if they actually change. `turn/start` settings overrides emit the same notification when they change the stored settings.
|
||||
- `thread/memoryMode/set` — experimental; set a thread’s persisted memory eligibility to `"enabled"` or `"disabled"` for either a loaded thread or a stored rollout; returns `{}` on success.
|
||||
- `memory/reset` — experimental; clear the current `CODEX_HOME/memories` directory and reset persisted memory stage data in sqlite while preserving existing thread memory modes; returns `{}` on success.
|
||||
- `thread/goal/set` — create or update the single persisted goal for a materialized thread; returns the current goal and emits `thread/goal/updated`.
|
||||
@@ -167,8 +167,8 @@ Example with notification opt-out:
|
||||
- `thread/backgroundTerminals/clean` — terminate all running background terminals for a thread (experimental; requires `capabilities.experimentalApi`); returns `{}` when the cleanup request is accepted.
|
||||
- `thread/backgroundTerminals/list` — list running background terminals for a loaded thread (experimental; requires `capabilities.experimentalApi`); returns `data` with the running terminal ids.
|
||||
- `thread/backgroundTerminals/terminate` — terminate one running background terminal by app-server `processId` (experimental; requires `capabilities.experimentalApi`); returns whether a process was terminated.
|
||||
- `thread/rollback` — drop the last N turns from the agent’s in-memory context and persist a rollback marker in the rollout so future resumes see the pruned history; returns the updated `thread` (with `turns` populated) on success.
|
||||
- `turn/start` — add user input to a thread and begin Codex generation; responds with the initial `turn` object and streams `turn/started`, `item/*`, and `turn/completed` notifications. `clientUserMessageId` is optional; when supplied, the corresponding `userMessage` item echoes it as `clientId`. Experimental `runtimeWorkspaceRoots` replaces the thread-scoped runtime workspace roots used to materialize `:workspace_roots`; paths must be absolute. Prefer experimental `permissions` profile selection by id for permission overrides; the legacy `sandboxPolicy` field is still accepted but cannot be combined with `permissions`. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode". Experimental `multiAgentMode` accepts `none`, `explicitRequestOnly`, or `proactive`; `none` keeps the tools available without injecting mode instructions, and omission keeps the loaded session's current mode. The requested mode is retained for the loaded session without rejecting unsupported configurations, and eligible multi-agent v2 turns use it directly.
|
||||
- `thread/rollback` — deprecated and will be removed soon. Drop the last N turns from the agent’s in-memory context and persist a rollback marker in the rollout so future resumes see the pruned history; returns the updated `thread` (with `turns` populated) on success.
|
||||
- `turn/start` — add user input to a thread and begin Codex generation; responds with the initial `turn` object and streams `turn/started`, `item/*`, and `turn/completed` notifications. `clientUserMessageId` is optional; when supplied, the corresponding `userMessage` item echoes it as `clientId`. Experimental `runtimeWorkspaceRoots` replaces the thread-scoped runtime workspace roots used to materialize `:workspace_roots`; paths must be absolute. Prefer experimental `permissions` profile selection by id for permission overrides; the legacy `sandboxPolicy` field is still accepted but cannot be combined with `permissions`. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode". Deprecated experimental `multiAgentMode` is ignored; Ultra reasoning effort selects proactive behavior.
|
||||
- `thread/inject_items` — append raw Responses API items to a loaded thread’s model-visible history without starting a user turn; returns `{}` on success.
|
||||
- `turn/steer` — add user input to an already in-flight regular turn without starting a new turn; returns the active `turnId` that accepted the input. `clientUserMessageId` is optional; when supplied, the corresponding `userMessage` item echoes it as `clientId`. Review and manual compaction turns reject `turn/steer`.
|
||||
- `turn/interrupt` — request cancellation of an in-flight turn by `(thread_id, turn_id)`; success is an empty `{}` response and the turn finishes with `status: "interrupted"`.
|
||||
@@ -229,7 +229,7 @@ Example with notification opt-out:
|
||||
- `skills/config/write` — write user-level skill config by name or absolute path.
|
||||
- `plugin/install` — install a plugin from a discovered marketplace entry, rejecting marketplace entries marked unavailable for install, install MCPs if any, and return the effective plugin auth policy plus any apps that still need auth (**under development; do not call from production clients yet**).
|
||||
- `plugin/uninstall` — uninstall a local plugin by `pluginId` in `<plugin>@<marketplace>` form by removing its cached files and clearing its user-level config entry, or uninstall a remote ChatGPT plugin by backend `pluginId` by forwarding the uninstall to the ChatGPT plugin backend and removing any downloaded remote-plugin cache (**under development; do not call from production clients yet**).
|
||||
- `mcpServer/oauth/login` — start an OAuth login for a configured MCP server; returns an `authorization_url` and later emits `mcpServer/oauthLogin/completed` once the browser flow finishes.
|
||||
- `mcpServer/oauth/login` — start an OAuth login for a configured MCP server; pass `threadId` to resolve servers from that thread's selected plugins and executor, and receive an `authorization_url` followed by `mcpServer/oauthLogin/completed` once the browser flow finishes.
|
||||
- `tool/requestUserInput` — prompt the user with 1–3 short questions for a tool call and return their answers (experimental).
|
||||
- `config/mcpServer/reload` — reload MCP server config from disk and queue a refresh for loaded threads (applied on each thread's next active turn); returns `{}`. Use this after editing `config.toml` without restarting the server.
|
||||
- `mcpServerStatus/list` — enumerate configured MCP servers with their tools, auth status, server info, plus resources/resource templates for `full` detail; supports optional `threadId` and cursor+limit pagination. If `threadId` is omitted, the server reads from the latest global config directly. If `detail` is omitted, the server defaults to `full`.
|
||||
@@ -238,8 +238,8 @@ Example with notification opt-out:
|
||||
- `windowsSandbox/setupStart` — start Windows sandbox setup for the selected mode (`elevated` or `unelevated`); accepts an optional absolute `cwd` to target setup for a specific workspace, returns `{ started: true }` immediately, and later emits `windowsSandbox/setupCompleted`.
|
||||
- `feedback/upload` — submit a feedback report (classification + optional reason/logs, conversation_id, and optional `extraLogFiles` attachments array); returns the tracking thread id.
|
||||
- `config/read` — fetch the effective config on disk after resolving config layering, including opaque `desktop` values stored in `config.toml`.
|
||||
- `externalAgentConfig/detect` — detect migratable external-agent artifacts with `includeHome` and optional `cwds`; each detected item includes `cwd` (`null` for home), and plugin/session migration items may additionally include structured `details` grouping plugin ids or session metadata.
|
||||
- `externalAgentConfig/import` — apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home) and any plugin/session `details` returned by detect. Callers may pass `source` to identify the product that initiated the import; omitted or `null` means unspecified. The response acknowledges the synchronous import phase with an `importId`. Expected migration failures are reported as per-item failures rather than JSON-RPC errors, so the server still returns that `importId` and emits `externalAgentConfig/import/completed` with the same ID once all synchronous and background work finishes. The completion notification contains type-level `itemTypeResults` with successes and failures, including raw failure messages for the client to report separately.
|
||||
- `externalAgentConfig/detect` — detect migratable external-agent artifacts with `includeHome` and optional `cwds`; each detected item includes `cwd` (`null` for home), and multi-item migrations may additionally include structured `details` with plugin ids, skill names, session metadata, or other artifact names.
|
||||
- `externalAgentConfig/import` — apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home) and any `details` returned by detect. Callers may pass `source` to identify the product that initiated the import; omitted or `null` means unspecified. The response acknowledges the synchronous import phase with an `importId`. Expected migration failures are reported as per-item failures rather than JSON-RPC errors, so the server still returns that `importId` and emits `externalAgentConfig/import/completed` with the same ID once all synchronous and background work finishes. The completion notification contains type-level `itemTypeResults` with successes and failures, including raw failure messages for the client to report separately.
|
||||
- `config/value/write` — write a single config key/value to the user's config.toml on disk; dotted paths such as `desktop.someKey` use the same generic write surface.
|
||||
- `config/batchWrite` — apply multiple config edits atomically to the user's config.toml on disk, with optional `reloadUserConfig: true` to hot-reload loaded threads, including multiple `desktop.*` edits.
|
||||
- `configRequirements/read` — fetch loaded requirements constraints from `requirements.toml` and/or MDM (or `null` if none are configured), including allow-lists (`allowedApprovalPolicies`, `allowedSandboxModes`, `allowedWebSearchModes`), the layered permission-profile allow map (`allowedPermissionProfiles`), the managed permission-profile default (`defaultPermissions`), lifecycle hook lockdown (`allowManagedHooksOnly`), remote-control policy (`allowRemoteControl`; `false` force-disables remote control while `true` or `null` preserves existing behavior), computer use policy (`computerUse`), pinned feature values (`featureRequirements`), managed lifecycle hooks (`hooks`), `enforceResidency`, and `network` constraints such as canonical domain/socket permissions plus `managedAllowedDomainsOnly` and `dangerFullAccessDenylistOnly`.
|
||||
@@ -267,7 +267,6 @@ Start a fresh thread when you need a new Codex conversation.
|
||||
"location": {
|
||||
"type": "environment",
|
||||
"environmentId": "workspace",
|
||||
// Opaque to app-server; interpreted in the selected environment.
|
||||
"path": "/opt/cca/plugins/github"
|
||||
}
|
||||
}
|
||||
@@ -404,18 +403,19 @@ Example:
|
||||
|
||||
When `nextCursor` is `null`, you’ve reached the final page.
|
||||
|
||||
### Example: List direct child threads
|
||||
### Example: List descendant threads
|
||||
|
||||
Enable `capabilities.experimentalApi` during initialization, then use `thread/list` with `parentThreadId` to page through a thread's direct spawned children from persisted spawn-edge state. Results do not recursively include grandchildren. Review and Guardian threads are not included because they do not participate in the spawn-edge lifecycle. When `modelProviders` or `sourceKinds` is omitted, parent-filtered requests include every provider or source kind, respectively. Explicit filters retain the ordinary `thread/list` behavior, including the interactive-only default for an empty `sourceKinds` list.
|
||||
Enable `capabilities.experimentalApi` during initialization, then use `thread/list` with `ancestorThreadId` to page through every spawned descendant of a thread from persisted spawn-edge state. The ancestor itself is excluded, and each result's `parentThreadId` remains its immediate parent. Use `parentThreadId` instead when only direct children are wanted; sending both filters is invalid. Review and Guardian threads are not included because they do not participate in the spawn-edge lifecycle. When `modelProviders` or `sourceKinds` is omitted, relationship-filtered requests include every provider or source kind, respectively. Explicit filters retain the ordinary `thread/list` behavior, including the interactive-only default for an empty `sourceKinds` list.
|
||||
|
||||
```json
|
||||
{ "method": "thread/list", "id": 21, "params": {
|
||||
"parentThreadId": "00000000-0000-0000-0000-000000000100",
|
||||
"ancestorThreadId": "00000000-0000-0000-0000-000000000100",
|
||||
"limit": 25
|
||||
} }
|
||||
{ "id": 21, "result": {
|
||||
"data": [
|
||||
{ "id": "00000000-0000-0000-0000-000000000101", "parentThreadId": "00000000-0000-0000-0000-000000000100", "status": { "type": "notLoaded" } }
|
||||
{ "id": "00000000-0000-0000-0000-000000000101", "parentThreadId": "00000000-0000-0000-0000-000000000100", "status": { "type": "notLoaded" } },
|
||||
{ "id": "00000000-0000-0000-0000-000000000102", "parentThreadId": "00000000-0000-0000-0000-000000000101", "status": { "type": "notLoaded" } }
|
||||
],
|
||||
"nextCursor": null,
|
||||
"backwardsCursor": null
|
||||
@@ -514,10 +514,10 @@ Every returned `Turn` includes `itemsView`, which tells clients whether the `ite
|
||||
} }
|
||||
```
|
||||
|
||||
`thread/turns/items/list` is the planned hydration API for fetching full items for one turn:
|
||||
`thread/items/list` pages full persisted items across a thread, optionally filtered to one turn:
|
||||
|
||||
```json
|
||||
{ "method": "thread/turns/items/list", "id": 25, "params": {
|
||||
{ "method": "thread/items/list", "id": 25, "params": {
|
||||
"threadId": "thr_123",
|
||||
"turnId": "turn_456",
|
||||
"limit": 100,
|
||||
@@ -525,7 +525,7 @@ Every returned `Turn` includes `itemsView`, which tells clients whether the `ite
|
||||
} }
|
||||
```
|
||||
|
||||
This method currently returns JSON-RPC `-32601` with message `thread/turns/items/list is not supported yet`.
|
||||
Omit `turnId` or pass `null` to page items across the thread. Thread stores that do not implement item pagination return JSON-RPC `-32601` with message `thread/items/list is not supported yet`.
|
||||
|
||||
### Example: Update stored thread metadata
|
||||
|
||||
@@ -1345,7 +1345,7 @@ Because audio is intentionally separate from `ThreadItem`, clients can opt out o
|
||||
|
||||
### MCP server startup events
|
||||
|
||||
- `mcpServer/startupStatus/updated` — `{ threadId, name, status, error }` when app-server observes an MCP server startup transition. `threadId` identifies the owning thread when startup is thread-scoped and is `null` when startup is app-scoped. `status` is one of `starting`, `ready`, `failed`, or `cancelled`. `error` is `null` except for `failed`.
|
||||
- `mcpServer/startupStatus/updated` — `{ threadId, name, status, error, failureReason }` when app-server observes an MCP server startup transition. `threadId` identifies the owning thread when startup is thread-scoped and is `null` when startup is app-scoped. `status` is one of `starting`, `ready`, `failed`, or `cancelled`. `error` and `failureReason` are `null` except for `failed`; `failureReason` is `reauthenticationRequired` when stored OAuth credentials have expired and cannot be refreshed, so clients can prompt the user to reconnect the named server.
|
||||
|
||||
### Turn events
|
||||
|
||||
@@ -1424,6 +1424,7 @@ There are additional item-specific events:
|
||||
`codexErrorInfo` maps to the `CodexErrorInfo` enum. Common values:
|
||||
|
||||
- `ContextWindowExceeded`
|
||||
- `SessionBudgetExceeded`
|
||||
- `UsageLimitExceeded`
|
||||
- `HttpConnectionFailed { httpStatusCode? }`: upstream HTTP failures including 4xx/5xx
|
||||
- `ResponseStreamConnectionFailed { httpStatusCode? }`: failure to connect to the response SSE stream
|
||||
@@ -1786,7 +1787,7 @@ To disable a non-managed hook, upsert a state entry at `hooks.state` with `confi
|
||||
To re-enable it, upsert the same hook key with `"enabled": true`.
|
||||
## Apps
|
||||
|
||||
Use `app/list` to fetch available apps (connectors). Each entry includes metadata like the app `id`, display `name`, `installUrl`, `branding`, `appMetadata`, `labels`, whether it is currently accessible, and whether it is enabled in config.
|
||||
Use `app/list` to fetch available apps (connectors). Each entry includes metadata like the app `id`, display `name`, `installUrl`, legacy logo URLs, structured light and dark icon assets, `branding`, `appMetadata`, `labels`, whether it is currently accessible, and whether it is enabled in config.
|
||||
|
||||
```json
|
||||
{ "method": "app/list", "id": 50, "params": {
|
||||
@@ -1803,6 +1804,10 @@ Use `app/list` to fetch available apps (connectors). Each entry includes metadat
|
||||
"description": "Example connector for documentation.",
|
||||
"logoUrl": "https://example.com/demo-app.png",
|
||||
"logoUrlDark": null,
|
||||
"iconAssets": {
|
||||
"256_square": "https://example.com/demo-app-square.png"
|
||||
},
|
||||
"iconDarkAssets": null,
|
||||
"distributionChannel": null,
|
||||
"branding": null,
|
||||
"appMetadata": null,
|
||||
@@ -1833,6 +1838,10 @@ The server also emits `app/list/updated` notifications whenever either source (a
|
||||
"description": "Example connector for documentation.",
|
||||
"logoUrl": "https://example.com/demo-app.png",
|
||||
"logoUrlDark": null,
|
||||
"iconAssets": {
|
||||
"256_square": "https://example.com/demo-app-square.png"
|
||||
},
|
||||
"iconDarkAssets": null,
|
||||
"distributionChannel": null,
|
||||
"branding": null,
|
||||
"appMetadata": null,
|
||||
@@ -1925,8 +1934,8 @@ Codex supports these authentication modes. The current mode is surfaced in `acco
|
||||
- `account/workspaceMessages/read` — fetch active workspace messages, including workspace notification headlines when available.
|
||||
- `account/rateLimits/updated` (notify) — emitted whenever a user's ChatGPT rate limits change. This is a sparse rolling update; merge available values into the most recent `account/rateLimits/read` response or refetch that snapshot.
|
||||
- `account/sendAddCreditsNudgeEmail` — ask ChatGPT to email the workspace owner about depleted credits or a reached usage limit.
|
||||
- `mcpServer/oauthLogin/completed` (notify) — emitted after a `mcpServer/oauth/login` flow finishes for a server; payload includes `{ name, success, error? }`.
|
||||
- `mcpServer/startupStatus/updated` (notify) — emitted when a configured MCP server's startup status changes; payload includes `{ threadId, name, status, error }`, where `threadId` is the owning thread when startup is thread-scoped and `null` when it is app-scoped, and `status` is `starting`, `ready`, `failed`, or `cancelled`.
|
||||
- `mcpServer/oauthLogin/completed` (notify) — emitted after a `mcpServer/oauth/login` flow finishes for a server; payload includes `{ name, threadId, success, error? }`.
|
||||
- `mcpServer/startupStatus/updated` (notify) — emitted when a configured MCP server's startup status changes; payload includes `{ threadId, name, status, error, failureReason }`, where `threadId` is the owning thread when startup is thread-scoped and `null` when it is app-scoped, and `status` is `starting`, `ready`, `failed`, or `cancelled`. `failureReason` is `reauthenticationRequired` when stored OAuth credentials have expired and cannot be refreshed, so clients can prompt the user to reconnect the named server.
|
||||
|
||||
### 1) Check auth state
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
use codex_app_server_protocol::AppBranding as ApiAppBranding;
|
||||
use codex_app_server_protocol::AppInfo as ApiAppInfo;
|
||||
use codex_app_server_protocol::AppMetadata as ApiAppMetadata;
|
||||
use codex_app_server_protocol::AppReview as ApiAppReview;
|
||||
use codex_app_server_protocol::AppScreenshot as ApiAppScreenshot;
|
||||
use codex_connectors::AppBranding;
|
||||
use codex_connectors::AppInfo;
|
||||
use codex_connectors::AppMetadata;
|
||||
use codex_connectors::AppReview;
|
||||
use codex_connectors::AppScreenshot;
|
||||
|
||||
/// Converts connector-domain app metadata owned by `codex-connectors` into the app-server wire
|
||||
/// type owned by `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the connector
|
||||
/// domain crate. Because this crate owns neither type, Rust's orphan rules require an explicit
|
||||
/// conversion function instead of a `From` implementation.
|
||||
pub(crate) fn app_info_to_api(app: AppInfo) -> ApiAppInfo {
|
||||
let AppInfo {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
logo_url,
|
||||
logo_url_dark,
|
||||
icon_assets,
|
||||
icon_dark_assets,
|
||||
distribution_channel,
|
||||
branding,
|
||||
app_metadata,
|
||||
labels,
|
||||
install_url,
|
||||
is_accessible,
|
||||
is_enabled,
|
||||
plugin_display_names,
|
||||
} = app;
|
||||
ApiAppInfo {
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
logo_url,
|
||||
logo_url_dark,
|
||||
icon_assets,
|
||||
icon_dark_assets,
|
||||
distribution_channel,
|
||||
branding: branding.map(app_branding_to_api),
|
||||
app_metadata: app_metadata.map(app_metadata_to_api),
|
||||
labels,
|
||||
install_url,
|
||||
is_accessible,
|
||||
is_enabled,
|
||||
plugin_display_names,
|
||||
}
|
||||
}
|
||||
|
||||
fn app_branding_to_api(branding: AppBranding) -> ApiAppBranding {
|
||||
let AppBranding {
|
||||
category,
|
||||
developer,
|
||||
website,
|
||||
privacy_policy,
|
||||
terms_of_service,
|
||||
is_discoverable_app,
|
||||
} = branding;
|
||||
ApiAppBranding {
|
||||
category,
|
||||
developer,
|
||||
website,
|
||||
privacy_policy,
|
||||
terms_of_service,
|
||||
is_discoverable_app,
|
||||
}
|
||||
}
|
||||
|
||||
fn app_review_to_api(review: AppReview) -> ApiAppReview {
|
||||
let AppReview { status } = review;
|
||||
ApiAppReview { status }
|
||||
}
|
||||
|
||||
fn app_screenshot_to_api(screenshot: AppScreenshot) -> ApiAppScreenshot {
|
||||
let AppScreenshot {
|
||||
url,
|
||||
file_id,
|
||||
user_prompt,
|
||||
} = screenshot;
|
||||
ApiAppScreenshot {
|
||||
url,
|
||||
file_id,
|
||||
user_prompt,
|
||||
}
|
||||
}
|
||||
|
||||
fn app_metadata_to_api(metadata: AppMetadata) -> ApiAppMetadata {
|
||||
let AppMetadata {
|
||||
review,
|
||||
categories,
|
||||
sub_categories,
|
||||
seo_description,
|
||||
screenshots,
|
||||
developer,
|
||||
version,
|
||||
version_id,
|
||||
version_notes,
|
||||
first_party_type,
|
||||
first_party_requires_install,
|
||||
show_in_composer_when_unlinked,
|
||||
} = metadata;
|
||||
ApiAppMetadata {
|
||||
review: review.map(app_review_to_api),
|
||||
categories,
|
||||
sub_categories,
|
||||
seo_description,
|
||||
screenshots: screenshots
|
||||
.map(|screenshots| screenshots.into_iter().map(app_screenshot_to_api).collect()),
|
||||
developer,
|
||||
version,
|
||||
version_id,
|
||||
version_notes,
|
||||
first_party_type,
|
||||
first_party_requires_install,
|
||||
show_in_composer_when_unlinked,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
use codex_app_server_protocol::AuthMode as ApiAuthMode;
|
||||
use codex_protocol::auth::AuthMode;
|
||||
|
||||
/// Converts the domain auth mode owned by `codex-protocol` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into domain crates.
|
||||
/// Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn auth_mode_to_api(auth_mode: AuthMode) -> ApiAuthMode {
|
||||
match auth_mode {
|
||||
AuthMode::ApiKey => ApiAuthMode::ApiKey,
|
||||
AuthMode::Chatgpt => ApiAuthMode::Chatgpt,
|
||||
AuthMode::ChatgptAuthTokens => ApiAuthMode::ChatgptAuthTokens,
|
||||
AuthMode::AgentIdentity => ApiAuthMode::AgentIdentity,
|
||||
AuthMode::PersonalAccessToken => ApiAuthMode::PersonalAccessToken,
|
||||
AuthMode::BedrockApiKey => ApiAuthMode::BedrockApiKey,
|
||||
}
|
||||
}
|
||||
@@ -200,18 +200,20 @@ pub(crate) async fn apply_bespoke_event_handling(
|
||||
.await;
|
||||
}
|
||||
EventMsg::McpStartupUpdate(update) => {
|
||||
let (status, error) = match update.status {
|
||||
let (status, error, failure_reason) = match update.status {
|
||||
codex_protocol::protocol::McpStartupStatus::Starting => {
|
||||
(McpServerStartupState::Starting, None)
|
||||
(McpServerStartupState::Starting, None, None)
|
||||
}
|
||||
codex_protocol::protocol::McpStartupStatus::Ready => {
|
||||
(McpServerStartupState::Ready, None)
|
||||
}
|
||||
codex_protocol::protocol::McpStartupStatus::Failed { error } => {
|
||||
(McpServerStartupState::Failed, Some(error))
|
||||
(McpServerStartupState::Ready, None, None)
|
||||
}
|
||||
codex_protocol::protocol::McpStartupStatus::Failed { error, reason } => (
|
||||
McpServerStartupState::Failed,
|
||||
Some(error),
|
||||
reason.map(Into::into),
|
||||
),
|
||||
codex_protocol::protocol::McpStartupStatus::Cancelled => {
|
||||
(McpServerStartupState::Cancelled, None)
|
||||
(McpServerStartupState::Cancelled, None, None)
|
||||
}
|
||||
};
|
||||
let notification = McpServerStatusUpdatedNotification {
|
||||
@@ -219,6 +221,7 @@ pub(crate) async fn apply_bespoke_event_handling(
|
||||
name: update.server,
|
||||
status,
|
||||
error,
|
||||
failure_reason,
|
||||
};
|
||||
outgoing
|
||||
.send_server_notification(ServerNotification::McpServerStatusUpdated(notification))
|
||||
|
||||
@@ -72,6 +72,7 @@ pub(crate) struct NamedMigration {
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub(crate) struct MigrationDetails {
|
||||
pub plugins: Vec<PluginsMigration>,
|
||||
pub skills: Vec<NamedMigration>,
|
||||
pub sessions: Vec<ExternalAgentSessionMigration>,
|
||||
pub mcp_servers: Vec<NamedMigration>,
|
||||
pub hooks: Vec<NamedMigration>,
|
||||
@@ -570,7 +571,8 @@ impl ExternalAgentConfigService {
|
||||
|| self.home_target_skills_dir(),
|
||||
|repo_root| repo_root.join(".agents").join("skills"),
|
||||
);
|
||||
let skills_count = count_missing_subdirectories(&source_skills, &target_skills)?;
|
||||
let skill_names = missing_subdirectory_names(&source_skills, &target_skills)?;
|
||||
let skills_count = skill_names.len();
|
||||
if skills_count > 0 {
|
||||
items.push(ExternalAgentConfigMigrationItem {
|
||||
item_type: ExternalAgentConfigMigrationItemType::Skills,
|
||||
@@ -580,7 +582,10 @@ impl ExternalAgentConfigService {
|
||||
target_skills.display()
|
||||
),
|
||||
cwd: cwd.clone(),
|
||||
details: None,
|
||||
details: Some(MigrationDetails {
|
||||
skills: named_migrations(skill_names),
|
||||
..Default::default()
|
||||
}),
|
||||
});
|
||||
emit_migration_metric(
|
||||
EXTERNAL_AGENT_CONFIG_DETECT_METRIC,
|
||||
@@ -877,6 +882,16 @@ impl ExternalAgentConfigService {
|
||||
"plugins migration item is missing details".to_string(),
|
||||
));
|
||||
};
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(self.codex_home.clone())
|
||||
.fallback_cwd(Some(
|
||||
cwd.map(Path::to_path_buf)
|
||||
.unwrap_or_else(|| self.codex_home.clone()),
|
||||
))
|
||||
.build()
|
||||
.await
|
||||
.map_err(|err| io::Error::other(format!("failed to load config: {err}")))?;
|
||||
let requirements = config.config_layer_stack.requirements().clone();
|
||||
let mut outcome = PluginImportOutcome::default();
|
||||
let plugins_manager = PluginsManager::new(self.codex_home.clone());
|
||||
for plugin_group in plugins {
|
||||
@@ -916,7 +931,8 @@ impl ExternalAgentConfigService {
|
||||
ref_name: import_source.ref_name,
|
||||
sparse_paths: Vec::new(),
|
||||
};
|
||||
let add_marketplace_outcome = add_marketplace(self.codex_home.clone(), request).await;
|
||||
let add_marketplace_outcome =
|
||||
add_marketplace(self.codex_home.clone(), requirements.clone(), request).await;
|
||||
let marketplace_path = match add_marketplace_outcome {
|
||||
Ok(add_marketplace_outcome) => {
|
||||
let Some(marketplace_path) = find_marketplace_manifest_path(
|
||||
@@ -954,12 +970,37 @@ impl ExternalAgentConfigService {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let install_config = match ConfigBuilder::default()
|
||||
.codex_home(self.codex_home.clone())
|
||||
.fallback_cwd(Some(
|
||||
cwd.map(Path::to_path_buf)
|
||||
.unwrap_or_else(|| self.codex_home.clone()),
|
||||
))
|
||||
.build()
|
||||
.await
|
||||
{
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
record_plugin_import_errors(
|
||||
&mut outcome,
|
||||
cwd,
|
||||
&plugin_ids,
|
||||
"plugin_import",
|
||||
format!("failed to reload config after adding marketplace: {err}"),
|
||||
);
|
||||
outcome.failed_plugin_ids.extend(plugin_ids);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
for plugin_name in plugin_names {
|
||||
match plugins_manager
|
||||
.install_plugin(PluginInstallRequest {
|
||||
plugin_name: plugin_name.clone(),
|
||||
marketplace_path: marketplace_path.clone(),
|
||||
})
|
||||
.install_plugin(
|
||||
&install_config.config_layer_stack,
|
||||
PluginInstallRequest {
|
||||
plugin_name: plugin_name.clone(),
|
||||
marketplace_path: marketplace_path.clone(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(_) => outcome
|
||||
@@ -1533,13 +1574,16 @@ fn collect_subdirectory_names(path: &Path) -> io::Result<HashSet<OsString>> {
|
||||
Ok(names)
|
||||
}
|
||||
|
||||
fn count_missing_subdirectories(source: &Path, target: &Path) -> io::Result<usize> {
|
||||
fn missing_subdirectory_names(source: &Path, target: &Path) -> io::Result<Vec<String>> {
|
||||
let source_names = collect_subdirectory_names(source)?;
|
||||
let target_names = collect_subdirectory_names(target)?;
|
||||
Ok(source_names
|
||||
.iter()
|
||||
.filter(|name| !target_names.contains(*name))
|
||||
.count())
|
||||
let mut missing_names = source_names
|
||||
.into_iter()
|
||||
.filter(|name| !target_names.contains(name))
|
||||
.map(|name| name.to_string_lossy().into_owned())
|
||||
.collect::<Vec<_>>();
|
||||
missing_names.sort();
|
||||
Ok(missing_names)
|
||||
}
|
||||
|
||||
fn is_missing_or_empty_text_file(path: &Path) -> io::Result<bool> {
|
||||
|
||||
@@ -113,7 +113,10 @@ async fn detect_home_lists_config_skills_and_agents_md() {
|
||||
agents_skills.display()
|
||||
),
|
||||
cwd: None,
|
||||
details: None,
|
||||
details: Some(MigrationDetails {
|
||||
skills: named_migrations(vec!["skill-a".to_string()]),
|
||||
..Default::default()
|
||||
}),
|
||||
},
|
||||
ExternalAgentConfigMigrationItem {
|
||||
item_type: ExternalAgentConfigMigrationItemType::AgentsMd,
|
||||
@@ -305,7 +308,10 @@ async fn detect_repo_still_reports_non_plugin_items_when_home_config_is_invalid(
|
||||
repo_root.join(".agents").join("skills").display()
|
||||
),
|
||||
cwd: Some(repo_root.clone()),
|
||||
details: None,
|
||||
details: Some(MigrationDetails {
|
||||
skills: named_migrations(vec!["skill-a".to_string()]),
|
||||
..Default::default()
|
||||
}),
|
||||
},
|
||||
ExternalAgentConfigMigrationItem {
|
||||
item_type: ExternalAgentConfigMigrationItemType::AgentsMd,
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
use codex_app_server_protocol::ConfigLayer as ApiConfigLayer;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata as ApiConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource as ApiConfigLayerSource;
|
||||
use codex_config::ConfigLayer;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
|
||||
/// Converts a config-layer source owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_source_to_api(source: ConfigLayerSource) -> ApiConfigLayerSource {
|
||||
match source {
|
||||
ConfigLayerSource::Mdm { domain, key } => ApiConfigLayerSource::Mdm { domain, key },
|
||||
ConfigLayerSource::System { file } => ApiConfigLayerSource::System { file },
|
||||
ConfigLayerSource::EnterpriseManaged { id, name } => {
|
||||
ApiConfigLayerSource::EnterpriseManaged { id, name }
|
||||
}
|
||||
ConfigLayerSource::User { file, profile } => ApiConfigLayerSource::User { file, profile },
|
||||
ConfigLayerSource::Project { dot_codex_folder } => {
|
||||
ApiConfigLayerSource::Project { dot_codex_folder }
|
||||
}
|
||||
ConfigLayerSource::SessionFlags => ApiConfigLayerSource::SessionFlags,
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromFile { file } => {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromFile { file }
|
||||
}
|
||||
ConfigLayerSource::LegacyManagedConfigTomlFromMdm => {
|
||||
ApiConfigLayerSource::LegacyManagedConfigTomlFromMdm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts config-layer metadata owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_metadata_to_api(
|
||||
metadata: ConfigLayerMetadata,
|
||||
) -> ApiConfigLayerMetadata {
|
||||
ApiConfigLayerMetadata {
|
||||
name: config_layer_source_to_api(metadata.name),
|
||||
version: metadata.version,
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a config layer owned by `codex-config` into the app-server wire type owned by
|
||||
/// `codex-app-server-protocol`.
|
||||
///
|
||||
/// The types stay separate so app-server protocol ownership does not leak into the config domain
|
||||
/// crate. Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
||||
/// function instead of a `From` implementation.
|
||||
pub(crate) fn config_layer_to_api(layer: ConfigLayer) -> ApiConfigLayer {
|
||||
ApiConfigLayer {
|
||||
name: config_layer_source_to_api(layer.name),
|
||||
version: layer.version,
|
||||
config: layer.config,
|
||||
disabled_reason: layer.disabled_reason,
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::config_layer::config_layer_metadata_to_api;
|
||||
use crate::config_layer::config_layer_to_api;
|
||||
use crate::config_manager::ConfigManager;
|
||||
use codex_app_server_protocol::Config as ApiConfig;
|
||||
use codex_app_server_protocol::ConfigBatchWriteParams;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::ConfigReadParams;
|
||||
use codex_app_server_protocol::ConfigReadResponse;
|
||||
use codex_app_server_protocol::ConfigValueWriteParams;
|
||||
@@ -13,6 +13,8 @@ use codex_app_server_protocol::OverriddenMetadata;
|
||||
use codex_app_server_protocol::WriteStatus;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
@@ -136,7 +138,11 @@ impl ConfigManager {
|
||||
|
||||
Ok(ConfigReadResponse {
|
||||
config,
|
||||
origins: layers.origins(),
|
||||
origins: layers
|
||||
.origins()
|
||||
.into_iter()
|
||||
.map(|(path, metadata)| (path, config_layer_metadata_to_api(metadata)))
|
||||
.collect(),
|
||||
layers: params.include_layers.then(|| {
|
||||
layers
|
||||
.get_layers(
|
||||
@@ -144,7 +150,7 @@ impl ConfigManager {
|
||||
/*include_disabled*/ true,
|
||||
)
|
||||
.iter()
|
||||
.map(|layer| layer.as_layer())
|
||||
.map(|layer| config_layer_to_api(layer.as_layer()))
|
||||
.collect()
|
||||
}),
|
||||
})
|
||||
@@ -671,7 +677,7 @@ fn compute_override_metadata(
|
||||
|
||||
Some(OverriddenMetadata {
|
||||
message,
|
||||
overriding_layer,
|
||||
overriding_layer: config_layer_metadata_to_api(overriding_layer),
|
||||
effective_value: effective_value
|
||||
.and_then(|value| serde_json::to_value(value).ok())
|
||||
.unwrap_or(JsonValue::Null),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user